| [ Index ] |
PHP Cross Reference of WordPress Trunk (Updated Daily) |
[Summary view] [Print] [Text view]
1 (function() { 2 "use strict"; 3 var wp; 4 (wp ||= {}).mediaUtils = (() => { 5 var __create = Object.create; 6 var __defProp = Object.defineProperty; 7 var __getOwnPropDesc = Object.getOwnPropertyDescriptor; 8 var __getOwnPropNames = Object.getOwnPropertyNames; 9 var __getProtoOf = Object.getPrototypeOf; 10 var __hasOwnProp = Object.prototype.hasOwnProperty; 11 var __commonJS = (cb, mod) => function __require() { 12 return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; 13 }; 14 var __export = (target, all) => { 15 for (var name in all) 16 __defProp(target, name, { get: all[name], enumerable: true }); 17 }; 18 var __copyProps = (to, from, except, desc) => { 19 if (from && typeof from === "object" || typeof from === "function") { 20 for (let key of __getOwnPropNames(from)) 21 if (!__hasOwnProp.call(to, key) && key !== except) 22 __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); 23 } 24 return to; 25 }; 26 var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( 27 // If the importer is in node compatibility mode or this is not an ESM 28 // file that has been converted to a CommonJS file using a Babel- 29 // compatible transform (i.e. "__esModule" has not been set), then set 30 // "default" to the CommonJS "module.exports" for node compatibility. 31 isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, 32 mod 33 )); 34 var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); 35 36 // package-external:@wordpress/element 37 var require_element = __commonJS({ 38 "package-external:@wordpress/element"(exports, module) { 39 module.exports = window.wp.element; 40 } 41 }); 42 43 // package-external:@wordpress/i18n 44 var require_i18n = __commonJS({ 45 "package-external:@wordpress/i18n"(exports, module) { 46 module.exports = window.wp.i18n; 47 } 48 }); 49 50 // package-external:@wordpress/deprecated 51 var require_deprecated = __commonJS({ 52 "package-external:@wordpress/deprecated"(exports, module) { 53 module.exports = window.wp.deprecated; 54 } 55 }); 56 57 // package-external:@wordpress/data 58 var require_data = __commonJS({ 59 "package-external:@wordpress/data"(exports, module) { 60 module.exports = window.wp.data; 61 } 62 }); 63 64 // package-external:@wordpress/core-data 65 var require_core_data = __commonJS({ 66 "package-external:@wordpress/core-data"(exports, module) { 67 module.exports = window.wp.coreData; 68 } 69 }); 70 71 // package-external:@wordpress/blob 72 var require_blob = __commonJS({ 73 "package-external:@wordpress/blob"(exports, module) { 74 module.exports = window.wp.blob; 75 } 76 }); 77 78 // package-external:@wordpress/api-fetch 79 var require_api_fetch = __commonJS({ 80 "package-external:@wordpress/api-fetch"(exports, module) { 81 module.exports = window.wp.apiFetch; 82 } 83 }); 84 85 // package-external:@wordpress/components 86 var require_components = __commonJS({ 87 "package-external:@wordpress/components"(exports, module) { 88 module.exports = window.wp.components; 89 } 90 }); 91 92 // package-external:@wordpress/primitives 93 var require_primitives = __commonJS({ 94 "package-external:@wordpress/primitives"(exports, module) { 95 module.exports = window.wp.primitives; 96 } 97 }); 98 99 // vendor-external:react/jsx-runtime 100 var require_jsx_runtime = __commonJS({ 101 "vendor-external:react/jsx-runtime"(exports, module) { 102 module.exports = window.ReactJSXRuntime; 103 } 104 }); 105 106 // package-external:@wordpress/compose 107 var require_compose = __commonJS({ 108 "package-external:@wordpress/compose"(exports, module) { 109 module.exports = window.wp.compose; 110 } 111 }); 112 113 // vendor-external:react 114 var require_react = __commonJS({ 115 "vendor-external:react"(exports, module) { 116 module.exports = window.React; 117 } 118 }); 119 120 // vendor-external:react-dom 121 var require_react_dom = __commonJS({ 122 "vendor-external:react-dom"(exports, module) { 123 module.exports = window.ReactDOM; 124 } 125 }); 126 127 // node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js 128 var require_use_sync_external_store_shim_development = __commonJS({ 129 "node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js"(exports) { 130 "use strict"; 131 (function() { 132 function is(x2, y2) { 133 return x2 === y2 && (0 !== x2 || 1 / x2 === 1 / y2) || x2 !== x2 && y2 !== y2; 134 } 135 function useSyncExternalStore$2(subscribe2, getSnapshot) { 136 didWarnOld18Alpha || void 0 === React147.startTransition || (didWarnOld18Alpha = true, console.error( 137 "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." 138 )); 139 var value = getSnapshot(); 140 if (!didWarnUncachedGetSnapshot) { 141 var cachedValue = getSnapshot(); 142 objectIs(value, cachedValue) || (console.error( 143 "The result of getSnapshot should be cached to avoid an infinite loop" 144 ), didWarnUncachedGetSnapshot = true); 145 } 146 cachedValue = useState58({ 147 inst: { value, getSnapshot } 148 }); 149 var inst = cachedValue[0].inst, forceUpdate = cachedValue[1]; 150 useLayoutEffect7( 151 function() { 152 inst.value = value; 153 inst.getSnapshot = getSnapshot; 154 checkIfSnapshotChanged(inst) && forceUpdate({ inst }); 155 }, 156 [subscribe2, value, getSnapshot] 157 ); 158 useEffect52( 159 function() { 160 checkIfSnapshotChanged(inst) && forceUpdate({ inst }); 161 return subscribe2(function() { 162 checkIfSnapshotChanged(inst) && forceUpdate({ inst }); 163 }); 164 }, 165 [subscribe2] 166 ); 167 useDebugValue2(value); 168 return value; 169 } 170 function checkIfSnapshotChanged(inst) { 171 var latestGetSnapshot = inst.getSnapshot; 172 inst = inst.value; 173 try { 174 var nextValue = latestGetSnapshot(); 175 return !objectIs(inst, nextValue); 176 } catch (error2) { 177 return true; 178 } 179 } 180 function useSyncExternalStore$1(subscribe2, getSnapshot) { 181 return getSnapshot(); 182 } 183 "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error()); 184 var React147 = require_react(), objectIs = "function" === typeof Object.is ? Object.is : is, useState58 = React147.useState, useEffect52 = React147.useEffect, useLayoutEffect7 = React147.useLayoutEffect, useDebugValue2 = React147.useDebugValue, didWarnOld18Alpha = false, didWarnUncachedGetSnapshot = false, shim = "undefined" === typeof window || "undefined" === typeof window.document || "undefined" === typeof window.document.createElement ? useSyncExternalStore$1 : useSyncExternalStore$2; 185 exports.useSyncExternalStore = void 0 !== React147.useSyncExternalStore ? React147.useSyncExternalStore : shim; 186 "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error()); 187 })(); 188 } 189 }); 190 191 // node_modules/use-sync-external-store/shim/index.js 192 var require_shim = __commonJS({ 193 "node_modules/use-sync-external-store/shim/index.js"(exports, module) { 194 "use strict"; 195 if (false) { 196 module.exports = null; 197 } else { 198 module.exports = require_use_sync_external_store_shim_development(); 199 } 200 } 201 }); 202 203 // node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js 204 var require_with_selector_development = __commonJS({ 205 "node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js"(exports) { 206 "use strict"; 207 (function() { 208 function is(x2, y2) { 209 return x2 === y2 && (0 !== x2 || 1 / x2 === 1 / y2) || x2 !== x2 && y2 !== y2; 210 } 211 "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error()); 212 var React147 = require_react(), shim = require_shim(), objectIs = "function" === typeof Object.is ? Object.is : is, useSyncExternalStore4 = shim.useSyncExternalStore, useRef93 = React147.useRef, useEffect52 = React147.useEffect, useMemo70 = React147.useMemo, useDebugValue2 = React147.useDebugValue; 213 exports.useSyncExternalStoreWithSelector = function(subscribe2, getSnapshot, getServerSnapshot, selector2, isEqual) { 214 var instRef = useRef93(null); 215 if (null === instRef.current) { 216 var inst = { hasValue: false, value: null }; 217 instRef.current = inst; 218 } else inst = instRef.current; 219 instRef = useMemo70( 220 function() { 221 function memoizedSelector(nextSnapshot) { 222 if (!hasMemo) { 223 hasMemo = true; 224 memoizedSnapshot = nextSnapshot; 225 nextSnapshot = selector2(nextSnapshot); 226 if (void 0 !== isEqual && inst.hasValue) { 227 var currentSelection = inst.value; 228 if (isEqual(currentSelection, nextSnapshot)) 229 return memoizedSelection = currentSelection; 230 } 231 return memoizedSelection = nextSnapshot; 232 } 233 currentSelection = memoizedSelection; 234 if (objectIs(memoizedSnapshot, nextSnapshot)) 235 return currentSelection; 236 var nextSelection = selector2(nextSnapshot); 237 if (void 0 !== isEqual && isEqual(currentSelection, nextSelection)) 238 return memoizedSnapshot = nextSnapshot, currentSelection; 239 memoizedSnapshot = nextSnapshot; 240 return memoizedSelection = nextSelection; 241 } 242 var hasMemo = false, memoizedSnapshot, memoizedSelection, maybeGetServerSnapshot = void 0 === getServerSnapshot ? null : getServerSnapshot; 243 return [ 244 function() { 245 return memoizedSelector(getSnapshot()); 246 }, 247 null === maybeGetServerSnapshot ? void 0 : function() { 248 return memoizedSelector(maybeGetServerSnapshot()); 249 } 250 ]; 251 }, 252 [getSnapshot, getServerSnapshot, selector2, isEqual] 253 ); 254 var value = useSyncExternalStore4(subscribe2, instRef[0], instRef[1]); 255 useEffect52( 256 function() { 257 inst.hasValue = true; 258 inst.value = value; 259 }, 260 [value] 261 ); 262 useDebugValue2(value); 263 return value; 264 }; 265 "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error()); 266 })(); 267 } 268 }); 269 270 // node_modules/use-sync-external-store/shim/with-selector.js 271 var require_with_selector = __commonJS({ 272 "node_modules/use-sync-external-store/shim/with-selector.js"(exports, module) { 273 "use strict"; 274 if (false) { 275 module.exports = null; 276 } else { 277 module.exports = require_with_selector_development(); 278 } 279 } 280 }); 281 282 // package-external:@wordpress/theme 283 var require_theme = __commonJS({ 284 "package-external:@wordpress/theme"(exports, module) { 285 module.exports = window.wp.theme; 286 } 287 }); 288 289 // package-external:@wordpress/private-apis 290 var require_private_apis = __commonJS({ 291 "package-external:@wordpress/private-apis"(exports, module) { 292 module.exports = window.wp.privateApis; 293 } 294 }); 295 296 // package-external:@wordpress/a11y 297 var require_a11y = __commonJS({ 298 "package-external:@wordpress/a11y"(exports, module) { 299 module.exports = window.wp.a11y; 300 } 301 }); 302 303 // package-external:@wordpress/warning 304 var require_warning = __commonJS({ 305 "package-external:@wordpress/warning"(exports, module) { 306 module.exports = window.wp.warning; 307 } 308 }); 309 310 // package-external:@wordpress/keycodes 311 var require_keycodes = __commonJS({ 312 "package-external:@wordpress/keycodes"(exports, module) { 313 module.exports = window.wp.keycodes; 314 } 315 }); 316 317 // node_modules/remove-accents/index.js 318 var require_remove_accents = __commonJS({ 319 "node_modules/remove-accents/index.js"(exports, module) { 320 var characterMap = { 321 "\xC0": "A", 322 "\xC1": "A", 323 "\xC2": "A", 324 "\xC3": "A", 325 "\xC4": "A", 326 "\xC5": "A", 327 "\u1EA4": "A", 328 "\u1EAE": "A", 329 "\u1EB2": "A", 330 "\u1EB4": "A", 331 "\u1EB6": "A", 332 "\xC6": "AE", 333 "\u1EA6": "A", 334 "\u1EB0": "A", 335 "\u0202": "A", 336 "\u1EA2": "A", 337 "\u1EA0": "A", 338 "\u1EA8": "A", 339 "\u1EAA": "A", 340 "\u1EAC": "A", 341 "\xC7": "C", 342 "\u1E08": "C", 343 "\xC8": "E", 344 "\xC9": "E", 345 "\xCA": "E", 346 "\xCB": "E", 347 "\u1EBE": "E", 348 "\u1E16": "E", 349 "\u1EC0": "E", 350 "\u1E14": "E", 351 "\u1E1C": "E", 352 "\u0206": "E", 353 "\u1EBA": "E", 354 "\u1EBC": "E", 355 "\u1EB8": "E", 356 "\u1EC2": "E", 357 "\u1EC4": "E", 358 "\u1EC6": "E", 359 "\xCC": "I", 360 "\xCD": "I", 361 "\xCE": "I", 362 "\xCF": "I", 363 "\u1E2E": "I", 364 "\u020A": "I", 365 "\u1EC8": "I", 366 "\u1ECA": "I", 367 "\xD0": "D", 368 "\xD1": "N", 369 "\xD2": "O", 370 "\xD3": "O", 371 "\xD4": "O", 372 "\xD5": "O", 373 "\xD6": "O", 374 "\xD8": "O", 375 "\u1ED0": "O", 376 "\u1E4C": "O", 377 "\u1E52": "O", 378 "\u020E": "O", 379 "\u1ECE": "O", 380 "\u1ECC": "O", 381 "\u1ED4": "O", 382 "\u1ED6": "O", 383 "\u1ED8": "O", 384 "\u1EDC": "O", 385 "\u1EDE": "O", 386 "\u1EE0": "O", 387 "\u1EDA": "O", 388 "\u1EE2": "O", 389 "\xD9": "U", 390 "\xDA": "U", 391 "\xDB": "U", 392 "\xDC": "U", 393 "\u1EE6": "U", 394 "\u1EE4": "U", 395 "\u1EEC": "U", 396 "\u1EEE": "U", 397 "\u1EF0": "U", 398 "\xDD": "Y", 399 "\xE0": "a", 400 "\xE1": "a", 401 "\xE2": "a", 402 "\xE3": "a", 403 "\xE4": "a", 404 "\xE5": "a", 405 "\u1EA5": "a", 406 "\u1EAF": "a", 407 "\u1EB3": "a", 408 "\u1EB5": "a", 409 "\u1EB7": "a", 410 "\xE6": "ae", 411 "\u1EA7": "a", 412 "\u1EB1": "a", 413 "\u0203": "a", 414 "\u1EA3": "a", 415 "\u1EA1": "a", 416 "\u1EA9": "a", 417 "\u1EAB": "a", 418 "\u1EAD": "a", 419 "\xE7": "c", 420 "\u1E09": "c", 421 "\xE8": "e", 422 "\xE9": "e", 423 "\xEA": "e", 424 "\xEB": "e", 425 "\u1EBF": "e", 426 "\u1E17": "e", 427 "\u1EC1": "e", 428 "\u1E15": "e", 429 "\u1E1D": "e", 430 "\u0207": "e", 431 "\u1EBB": "e", 432 "\u1EBD": "e", 433 "\u1EB9": "e", 434 "\u1EC3": "e", 435 "\u1EC5": "e", 436 "\u1EC7": "e", 437 "\xEC": "i", 438 "\xED": "i", 439 "\xEE": "i", 440 "\xEF": "i", 441 "\u1E2F": "i", 442 "\u020B": "i", 443 "\u1EC9": "i", 444 "\u1ECB": "i", 445 "\xF0": "d", 446 "\xF1": "n", 447 "\xF2": "o", 448 "\xF3": "o", 449 "\xF4": "o", 450 "\xF5": "o", 451 "\xF6": "o", 452 "\xF8": "o", 453 "\u1ED1": "o", 454 "\u1E4D": "o", 455 "\u1E53": "o", 456 "\u020F": "o", 457 "\u1ECF": "o", 458 "\u1ECD": "o", 459 "\u1ED5": "o", 460 "\u1ED7": "o", 461 "\u1ED9": "o", 462 "\u1EDD": "o", 463 "\u1EDF": "o", 464 "\u1EE1": "o", 465 "\u1EDB": "o", 466 "\u1EE3": "o", 467 "\xF9": "u", 468 "\xFA": "u", 469 "\xFB": "u", 470 "\xFC": "u", 471 "\u1EE7": "u", 472 "\u1EE5": "u", 473 "\u1EED": "u", 474 "\u1EEF": "u", 475 "\u1EF1": "u", 476 "\xFD": "y", 477 "\xFF": "y", 478 "\u0100": "A", 479 "\u0101": "a", 480 "\u0102": "A", 481 "\u0103": "a", 482 "\u0104": "A", 483 "\u0105": "a", 484 "\u0106": "C", 485 "\u0107": "c", 486 "\u0108": "C", 487 "\u0109": "c", 488 "\u010A": "C", 489 "\u010B": "c", 490 "\u010C": "C", 491 "\u010D": "c", 492 "C\u0306": "C", 493 "c\u0306": "c", 494 "\u010E": "D", 495 "\u010F": "d", 496 "\u0110": "D", 497 "\u0111": "d", 498 "\u0112": "E", 499 "\u0113": "e", 500 "\u0114": "E", 501 "\u0115": "e", 502 "\u0116": "E", 503 "\u0117": "e", 504 "\u0118": "E", 505 "\u0119": "e", 506 "\u011A": "E", 507 "\u011B": "e", 508 "\u011C": "G", 509 "\u01F4": "G", 510 "\u011D": "g", 511 "\u01F5": "g", 512 "\u011E": "G", 513 "\u011F": "g", 514 "\u0120": "G", 515 "\u0121": "g", 516 "\u0122": "G", 517 "\u0123": "g", 518 "\u0124": "H", 519 "\u0125": "h", 520 "\u0126": "H", 521 "\u0127": "h", 522 "\u1E2A": "H", 523 "\u1E2B": "h", 524 "\u0128": "I", 525 "\u0129": "i", 526 "\u012A": "I", 527 "\u012B": "i", 528 "\u012C": "I", 529 "\u012D": "i", 530 "\u012E": "I", 531 "\u012F": "i", 532 "\u0130": "I", 533 "\u0131": "i", 534 "\u0132": "IJ", 535 "\u0133": "ij", 536 "\u0134": "J", 537 "\u0135": "j", 538 "\u0136": "K", 539 "\u0137": "k", 540 "\u1E30": "K", 541 "\u1E31": "k", 542 "K\u0306": "K", 543 "k\u0306": "k", 544 "\u0139": "L", 545 "\u013A": "l", 546 "\u013B": "L", 547 "\u013C": "l", 548 "\u013D": "L", 549 "\u013E": "l", 550 "\u013F": "L", 551 "\u0140": "l", 552 "\u0141": "l", 553 "\u0142": "l", 554 "\u1E3E": "M", 555 "\u1E3F": "m", 556 "M\u0306": "M", 557 "m\u0306": "m", 558 "\u0143": "N", 559 "\u0144": "n", 560 "\u0145": "N", 561 "\u0146": "n", 562 "\u0147": "N", 563 "\u0148": "n", 564 "\u0149": "n", 565 "N\u0306": "N", 566 "n\u0306": "n", 567 "\u014C": "O", 568 "\u014D": "o", 569 "\u014E": "O", 570 "\u014F": "o", 571 "\u0150": "O", 572 "\u0151": "o", 573 "\u0152": "OE", 574 "\u0153": "oe", 575 "P\u0306": "P", 576 "p\u0306": "p", 577 "\u0154": "R", 578 "\u0155": "r", 579 "\u0156": "R", 580 "\u0157": "r", 581 "\u0158": "R", 582 "\u0159": "r", 583 "R\u0306": "R", 584 "r\u0306": "r", 585 "\u0212": "R", 586 "\u0213": "r", 587 "\u015A": "S", 588 "\u015B": "s", 589 "\u015C": "S", 590 "\u015D": "s", 591 "\u015E": "S", 592 "\u0218": "S", 593 "\u0219": "s", 594 "\u015F": "s", 595 "\u0160": "S", 596 "\u0161": "s", 597 "\u0162": "T", 598 "\u0163": "t", 599 "\u021B": "t", 600 "\u021A": "T", 601 "\u0164": "T", 602 "\u0165": "t", 603 "\u0166": "T", 604 "\u0167": "t", 605 "T\u0306": "T", 606 "t\u0306": "t", 607 "\u0168": "U", 608 "\u0169": "u", 609 "\u016A": "U", 610 "\u016B": "u", 611 "\u016C": "U", 612 "\u016D": "u", 613 "\u016E": "U", 614 "\u016F": "u", 615 "\u0170": "U", 616 "\u0171": "u", 617 "\u0172": "U", 618 "\u0173": "u", 619 "\u0216": "U", 620 "\u0217": "u", 621 "V\u0306": "V", 622 "v\u0306": "v", 623 "\u0174": "W", 624 "\u0175": "w", 625 "\u1E82": "W", 626 "\u1E83": "w", 627 "X\u0306": "X", 628 "x\u0306": "x", 629 "\u0176": "Y", 630 "\u0177": "y", 631 "\u0178": "Y", 632 "Y\u0306": "Y", 633 "y\u0306": "y", 634 "\u0179": "Z", 635 "\u017A": "z", 636 "\u017B": "Z", 637 "\u017C": "z", 638 "\u017D": "Z", 639 "\u017E": "z", 640 "\u017F": "s", 641 "\u0192": "f", 642 "\u01A0": "O", 643 "\u01A1": "o", 644 "\u01AF": "U", 645 "\u01B0": "u", 646 "\u01CD": "A", 647 "\u01CE": "a", 648 "\u01CF": "I", 649 "\u01D0": "i", 650 "\u01D1": "O", 651 "\u01D2": "o", 652 "\u01D3": "U", 653 "\u01D4": "u", 654 "\u01D5": "U", 655 "\u01D6": "u", 656 "\u01D7": "U", 657 "\u01D8": "u", 658 "\u01D9": "U", 659 "\u01DA": "u", 660 "\u01DB": "U", 661 "\u01DC": "u", 662 "\u1EE8": "U", 663 "\u1EE9": "u", 664 "\u1E78": "U", 665 "\u1E79": "u", 666 "\u01FA": "A", 667 "\u01FB": "a", 668 "\u01FC": "AE", 669 "\u01FD": "ae", 670 "\u01FE": "O", 671 "\u01FF": "o", 672 "\xDE": "TH", 673 "\xFE": "th", 674 "\u1E54": "P", 675 "\u1E55": "p", 676 "\u1E64": "S", 677 "\u1E65": "s", 678 "X\u0301": "X", 679 "x\u0301": "x", 680 "\u0403": "\u0413", 681 "\u0453": "\u0433", 682 "\u040C": "\u041A", 683 "\u045C": "\u043A", 684 "A\u030B": "A", 685 "a\u030B": "a", 686 "E\u030B": "E", 687 "e\u030B": "e", 688 "I\u030B": "I", 689 "i\u030B": "i", 690 "\u01F8": "N", 691 "\u01F9": "n", 692 "\u1ED2": "O", 693 "\u1ED3": "o", 694 "\u1E50": "O", 695 "\u1E51": "o", 696 "\u1EEA": "U", 697 "\u1EEB": "u", 698 "\u1E80": "W", 699 "\u1E81": "w", 700 "\u1EF2": "Y", 701 "\u1EF3": "y", 702 "\u0200": "A", 703 "\u0201": "a", 704 "\u0204": "E", 705 "\u0205": "e", 706 "\u0208": "I", 707 "\u0209": "i", 708 "\u020C": "O", 709 "\u020D": "o", 710 "\u0210": "R", 711 "\u0211": "r", 712 "\u0214": "U", 713 "\u0215": "u", 714 "B\u030C": "B", 715 "b\u030C": "b", 716 "\u010C\u0323": "C", 717 "\u010D\u0323": "c", 718 "\xCA\u030C": "E", 719 "\xEA\u030C": "e", 720 "F\u030C": "F", 721 "f\u030C": "f", 722 "\u01E6": "G", 723 "\u01E7": "g", 724 "\u021E": "H", 725 "\u021F": "h", 726 "J\u030C": "J", 727 "\u01F0": "j", 728 "\u01E8": "K", 729 "\u01E9": "k", 730 "M\u030C": "M", 731 "m\u030C": "m", 732 "P\u030C": "P", 733 "p\u030C": "p", 734 "Q\u030C": "Q", 735 "q\u030C": "q", 736 "\u0158\u0329": "R", 737 "\u0159\u0329": "r", 738 "\u1E66": "S", 739 "\u1E67": "s", 740 "V\u030C": "V", 741 "v\u030C": "v", 742 "W\u030C": "W", 743 "w\u030C": "w", 744 "X\u030C": "X", 745 "x\u030C": "x", 746 "Y\u030C": "Y", 747 "y\u030C": "y", 748 "A\u0327": "A", 749 "a\u0327": "a", 750 "B\u0327": "B", 751 "b\u0327": "b", 752 "\u1E10": "D", 753 "\u1E11": "d", 754 "\u0228": "E", 755 "\u0229": "e", 756 "\u0190\u0327": "E", 757 "\u025B\u0327": "e", 758 "\u1E28": "H", 759 "\u1E29": "h", 760 "I\u0327": "I", 761 "i\u0327": "i", 762 "\u0197\u0327": "I", 763 "\u0268\u0327": "i", 764 "M\u0327": "M", 765 "m\u0327": "m", 766 "O\u0327": "O", 767 "o\u0327": "o", 768 "Q\u0327": "Q", 769 "q\u0327": "q", 770 "U\u0327": "U", 771 "u\u0327": "u", 772 "X\u0327": "X", 773 "x\u0327": "x", 774 "Z\u0327": "Z", 775 "z\u0327": "z", 776 "\u0439": "\u0438", 777 "\u0419": "\u0418", 778 "\u0451": "\u0435", 779 "\u0401": "\u0415" 780 }; 781 var chars = Object.keys(characterMap).join("|"); 782 var allAccents = new RegExp(chars, "g"); 783 var firstAccent = new RegExp(chars, ""); 784 function matcher(match2) { 785 return characterMap[match2]; 786 } 787 var removeAccents2 = function(string) { 788 return string.replace(allAccents, matcher); 789 }; 790 var hasAccents = function(string) { 791 return !!string.match(firstAccent); 792 }; 793 module.exports = removeAccents2; 794 module.exports.has = hasAccents; 795 module.exports.remove = removeAccents2; 796 } 797 }); 798 799 // node_modules/fast-deep-equal/es6/index.js 800 var require_es6 = __commonJS({ 801 "node_modules/fast-deep-equal/es6/index.js"(exports, module) { 802 "use strict"; 803 module.exports = function equal(a, b) { 804 if (a === b) return true; 805 if (a && b && typeof a == "object" && typeof b == "object") { 806 if (a.constructor !== b.constructor) return false; 807 var length, i, keys; 808 if (Array.isArray(a)) { 809 length = a.length; 810 if (length != b.length) return false; 811 for (i = length; i-- !== 0; ) 812 if (!equal(a[i], b[i])) return false; 813 return true; 814 } 815 if (a instanceof Map && b instanceof Map) { 816 if (a.size !== b.size) return false; 817 for (i of a.entries()) 818 if (!b.has(i[0])) return false; 819 for (i of a.entries()) 820 if (!equal(i[1], b.get(i[0]))) return false; 821 return true; 822 } 823 if (a instanceof Set && b instanceof Set) { 824 if (a.size !== b.size) return false; 825 for (i of a.entries()) 826 if (!b.has(i[0])) return false; 827 return true; 828 } 829 if (ArrayBuffer.isView(a) && ArrayBuffer.isView(b)) { 830 length = a.length; 831 if (length != b.length) return false; 832 for (i = length; i-- !== 0; ) 833 if (a[i] !== b[i]) return false; 834 return true; 835 } 836 if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags; 837 if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf(); 838 if (a.toString !== Object.prototype.toString) return a.toString() === b.toString(); 839 keys = Object.keys(a); 840 length = keys.length; 841 if (length !== Object.keys(b).length) return false; 842 for (i = length; i-- !== 0; ) 843 if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false; 844 for (i = length; i-- !== 0; ) { 845 var key = keys[i]; 846 if (!equal(a[key], b[key])) return false; 847 } 848 return true; 849 } 850 return a !== a && b !== b; 851 }; 852 } 853 }); 854 855 // package-external:@wordpress/date 856 var require_date = __commonJS({ 857 "package-external:@wordpress/date"(exports, module) { 858 module.exports = window.wp.date; 859 } 860 }); 861 862 // package-external:@wordpress/preferences 863 var require_preferences = __commonJS({ 864 "package-external:@wordpress/preferences"(exports, module) { 865 module.exports = window.wp.preferences; 866 } 867 }); 868 869 // package-external:@wordpress/url 870 var require_url = __commonJS({ 871 "package-external:@wordpress/url"(exports, module) { 872 module.exports = window.wp.url; 873 } 874 }); 875 876 // package-external:@wordpress/notices 877 var require_notices = __commonJS({ 878 "package-external:@wordpress/notices"(exports, module) { 879 module.exports = window.wp.notices; 880 } 881 }); 882 883 // packages/media-utils/build-module/index.mjs 884 var index_exports = {}; 885 __export(index_exports, { 886 MediaUpload: () => media_upload_default, 887 privateApis: () => privateApis, 888 transformAttachment: () => transformAttachment, 889 uploadMedia: () => uploadMedia, 890 validateFileSize: () => validateFileSize, 891 validateMimeType: () => validateMimeType, 892 validateMimeTypeForUser: () => validateMimeTypeForUser 893 }); 894 895 // packages/media-utils/build-module/components/media-upload/index.mjs 896 var import_element = __toESM(require_element(), 1); 897 var import_i18n = __toESM(require_i18n(), 1); 898 var import_deprecated = __toESM(require_deprecated(), 1); 899 var import_data = __toESM(require_data(), 1); 900 901 // packages/media-utils/build-module/utils/invalidate-attachment-resolutions.mjs 902 var import_core_data = __toESM(require_core_data(), 1); 903 function invalidateAttachmentResolutions(registry) { 904 const resolvers = registry.select(import_core_data.store).getCachedResolvers(); 905 const entityRecordResolutions = resolvers.getEntityRecords; 906 entityRecordResolutions?.forEach((_value, args) => { 907 if (args[0] === "postType" && args[1] === "attachment") { 908 registry.dispatch(import_core_data.store).invalidateResolution("getEntityRecords", args); 909 } 910 }); 911 } 912 913 // packages/media-utils/build-module/components/media-upload/index.mjs 914 var DEFAULT_EMPTY_GALLERY = []; 915 var getFeaturedImageMediaFrame = () => { 916 const { wp } = window; 917 return wp.media.view.MediaFrame.Select.extend({ 918 /** 919 * Enables the Set Featured Image Button. 920 * 921 * @param {Object} toolbar toolbar for featured image state 922 * @return {void} 923 */ 924 featuredImageToolbar(toolbar) { 925 this.createSelectToolbar(toolbar, { 926 text: wp.media.view.l10n.setFeaturedImage, 927 state: this.options.state 928 }); 929 }, 930 /** 931 * Handle the edit state requirements of selected media item. 932 * 933 * @return {void} 934 */ 935 editState() { 936 const selection = this.state("featured-image").get("selection"); 937 const view = new wp.media.view.EditImage({ 938 model: selection.single(), 939 controller: this 940 }).render(); 941 this.content.set(view); 942 view.loadEditor(); 943 }, 944 /** 945 * Create the default states. 946 * 947 * @return {void} 948 */ 949 createStates: function createStates() { 950 this.on( 951 "toolbar:create:featured-image", 952 this.featuredImageToolbar, 953 this 954 ); 955 this.on("content:render:edit-image", this.editState, this); 956 this.states.add([ 957 new wp.media.controller.FeaturedImage(), 958 new wp.media.controller.EditImage({ 959 model: this.options.editImage 960 }) 961 ]); 962 } 963 }); 964 }; 965 var getSingleMediaFrame = () => { 966 const { wp } = window; 967 return wp.media.view.MediaFrame.Select.extend({ 968 /** 969 * Create the default states on the frame. 970 */ 971 createStates() { 972 const options = this.options; 973 if (this.options.states) { 974 return; 975 } 976 this.states.add([ 977 // Main states. 978 new wp.media.controller.Library({ 979 library: wp.media.query(options.library), 980 multiple: options.multiple, 981 title: options.title, 982 priority: 20, 983 filterable: "uploaded" 984 // Allow filtering by uploaded images. 985 }), 986 new wp.media.controller.EditImage({ 987 model: options.editImage 988 }) 989 ]); 990 } 991 }); 992 }; 993 var getGalleryDetailsMediaFrame = () => { 994 const { wp } = window; 995 return wp.media.view.MediaFrame.Post.extend({ 996 /** 997 * Set up gallery toolbar. 998 * 999 * @return {void} 1000 */ 1001 galleryToolbar() { 1002 const editing = this.state().get("editing"); 1003 this.toolbar.set( 1004 new wp.media.view.Toolbar({ 1005 controller: this, 1006 items: { 1007 insert: { 1008 style: "primary", 1009 text: editing ? wp.media.view.l10n.updateGallery : wp.media.view.l10n.insertGallery, 1010 priority: 80, 1011 requires: { library: true }, 1012 /** 1013 * @fires wp.media.controller.State#update 1014 */ 1015 click() { 1016 const controller = this.controller, state = controller.state(); 1017 controller.close(); 1018 state.trigger( 1019 "update", 1020 state.get("library") 1021 ); 1022 controller.setState(controller.options.state); 1023 controller.reset(); 1024 } 1025 } 1026 } 1027 }) 1028 ); 1029 }, 1030 /** 1031 * Handle the edit state requirements of selected media item. 1032 * 1033 * @return {void} 1034 */ 1035 editState() { 1036 const selection = this.state("gallery").get("selection"); 1037 const view = new wp.media.view.EditImage({ 1038 model: selection.single(), 1039 controller: this 1040 }).render(); 1041 this.content.set(view); 1042 view.loadEditor(); 1043 }, 1044 /** 1045 * Create the default states. 1046 * 1047 * @return {void} 1048 */ 1049 createStates: function createStates() { 1050 this.on("toolbar:create:main-gallery", this.galleryToolbar, this); 1051 this.on("content:render:edit-image", this.editState, this); 1052 this.states.add([ 1053 new wp.media.controller.Library({ 1054 id: "gallery", 1055 title: wp.media.view.l10n.createGalleryTitle, 1056 priority: 40, 1057 toolbar: "main-gallery", 1058 filterable: "uploaded", 1059 multiple: "add", 1060 editable: false, 1061 library: wp.media.query({ 1062 type: "image", 1063 ...this.options.library 1064 }) 1065 }), 1066 new wp.media.controller.EditImage({ 1067 model: this.options.editImage 1068 }), 1069 new wp.media.controller.GalleryEdit({ 1070 library: this.options.selection, 1071 editing: this.options.editing, 1072 menu: "gallery", 1073 displaySettings: false, 1074 multiple: true 1075 }), 1076 new wp.media.controller.GalleryAdd() 1077 ]); 1078 } 1079 }); 1080 }; 1081 var slimImageObject = (img) => { 1082 const attrSet = [ 1083 "sizes", 1084 "mime", 1085 "type", 1086 "subtype", 1087 "id", 1088 "url", 1089 "alt", 1090 "link", 1091 "caption" 1092 ]; 1093 return attrSet.reduce((result, key) => { 1094 if (img?.hasOwnProperty(key)) { 1095 result[key] = img[key]; 1096 } 1097 return result; 1098 }, {}); 1099 }; 1100 var getAttachmentsCollection = (ids) => { 1101 const { wp } = window; 1102 return wp.media.query({ 1103 order: "ASC", 1104 orderby: "post__in", 1105 post__in: ids, 1106 posts_per_page: -1, 1107 query: true, 1108 type: "image" 1109 }); 1110 }; 1111 var MediaUpload = class extends import_element.Component { 1112 constructor() { 1113 super(...arguments); 1114 this.openModal = this.openModal.bind(this); 1115 this.onOpen = this.onOpen.bind(this); 1116 this.onSelect = this.onSelect.bind(this); 1117 this.onUpdate = this.onUpdate.bind(this); 1118 this.onClose = this.onClose.bind(this); 1119 this.stopUndoRedoPropagation = this.stopUndoRedoPropagation.bind(this); 1120 } 1121 stopUndoRedoPropagation(event) { 1122 if (!event.metaKey && !event.ctrlKey) { 1123 return; 1124 } 1125 const character = event.key?.toLowerCase(); 1126 if (character !== "z" && character !== "y") { 1127 return; 1128 } 1129 event.stopPropagation(); 1130 } 1131 initializeListeners() { 1132 this.frame.on("select", this.onSelect); 1133 this.frame.on("update", this.onUpdate); 1134 this.frame.on("open", this.onOpen); 1135 this.frame.on("close", this.onClose); 1136 } 1137 /** 1138 * Sets the Gallery frame and initializes listeners. 1139 * 1140 * @return {void} 1141 */ 1142 buildAndSetGalleryFrame() { 1143 const { 1144 addToGallery = false, 1145 allowedTypes, 1146 multiple = false, 1147 value = DEFAULT_EMPTY_GALLERY 1148 } = this.props; 1149 if (value === this.lastGalleryValue) { 1150 return; 1151 } 1152 const { wp } = window; 1153 this.lastGalleryValue = value; 1154 if (this.frame) { 1155 this.frame.remove(); 1156 } 1157 let currentState; 1158 if (addToGallery) { 1159 currentState = "gallery-library"; 1160 } else { 1161 currentState = value && value.length ? "gallery-edit" : "gallery"; 1162 } 1163 if (!this.GalleryDetailsMediaFrame) { 1164 this.GalleryDetailsMediaFrame = getGalleryDetailsMediaFrame(); 1165 } 1166 const attachments = getAttachmentsCollection(value); 1167 const selection = new wp.media.model.Selection(attachments.models, { 1168 props: attachments.props.toJSON(), 1169 multiple 1170 }); 1171 this.frame = new this.GalleryDetailsMediaFrame({ 1172 mimeType: allowedTypes, 1173 state: currentState, 1174 multiple, 1175 selection, 1176 editing: !!value?.length 1177 }); 1178 wp.media.frame = this.frame; 1179 this.initializeListeners(); 1180 } 1181 /** 1182 * Initializes the Media Library requirements for the featured image flow. 1183 * 1184 * @return {void} 1185 */ 1186 buildAndSetFeatureImageFrame() { 1187 const { wp } = window; 1188 const { value: featuredImageId, multiple, allowedTypes } = this.props; 1189 const featuredImageFrame = getFeaturedImageMediaFrame(); 1190 const attachments = getAttachmentsCollection(featuredImageId); 1191 const selection = new wp.media.model.Selection(attachments.models, { 1192 props: attachments.props.toJSON() 1193 }); 1194 this.frame = new featuredImageFrame({ 1195 mimeType: allowedTypes, 1196 state: "featured-image", 1197 multiple, 1198 selection, 1199 editing: featuredImageId 1200 }); 1201 wp.media.frame = this.frame; 1202 wp.media.view.settings.post = { 1203 ...wp.media.view.settings.post, 1204 featuredImageId: featuredImageId || -1 1205 }; 1206 } 1207 /** 1208 * Initializes the Media Library requirements for the single image flow. 1209 * 1210 * @return {void} 1211 */ 1212 buildAndSetSingleMediaFrame() { 1213 const { wp } = window; 1214 const { 1215 allowedTypes, 1216 multiple = false, 1217 title = (0, import_i18n.__)("Select or Upload Media"), 1218 value 1219 } = this.props; 1220 const frameConfig = { 1221 title, 1222 multiple 1223 }; 1224 if (!!allowedTypes) { 1225 frameConfig.library = { type: allowedTypes }; 1226 } 1227 if (this.frame) { 1228 this.frame.remove(); 1229 } 1230 const singleImageFrame = getSingleMediaFrame(); 1231 const attachments = getAttachmentsCollection(value); 1232 const selection = new wp.media.model.Selection(attachments.models, { 1233 props: attachments.props.toJSON() 1234 }); 1235 this.frame = new singleImageFrame({ 1236 mimeType: allowedTypes, 1237 multiple, 1238 selection, 1239 ...frameConfig 1240 }); 1241 wp.media.frame = this.frame; 1242 } 1243 componentWillUnmount() { 1244 this.detachUndoRedoGuard(); 1245 this.frame?.close(); 1246 this.frame?.modal?.remove(); 1247 this.frame?.remove(); 1248 } 1249 detachUndoRedoGuard() { 1250 if (this.frame?.modal?.el) { 1251 this.frame.modal.el.removeEventListener( 1252 "keydown", 1253 this.stopUndoRedoPropagation, 1254 true 1255 ); 1256 } 1257 } 1258 onUpdate(selections) { 1259 const { onSelect, multiple = false } = this.props; 1260 const state = this.frame.state(); 1261 const selectedImages = selections || state.get("selection"); 1262 if (!selectedImages || !selectedImages.models.length) { 1263 return; 1264 } 1265 if (multiple) { 1266 onSelect( 1267 selectedImages.models.map( 1268 (model) => slimImageObject(model.toJSON()) 1269 ) 1270 ); 1271 } else { 1272 onSelect(slimImageObject(selectedImages.models[0].toJSON())); 1273 } 1274 } 1275 onSelect() { 1276 const { onSelect, multiple = false } = this.props; 1277 const attachment = this.frame.state().get("selection").toJSON(); 1278 onSelect(multiple ? attachment : attachment[0]); 1279 } 1280 onOpen() { 1281 const { wp } = window; 1282 const { value } = this.props; 1283 this.updateCollection(); 1284 if (this.frame?.modal?.el) { 1285 this.frame.modal.el.addEventListener( 1286 "keydown", 1287 this.stopUndoRedoPropagation, 1288 true 1289 ); 1290 } 1291 if (this.props.mode) { 1292 this.frame.content.mode(this.props.mode); 1293 } 1294 const hasMedia = Array.isArray(value) ? !!value?.length : !!value; 1295 if (!hasMedia) { 1296 return; 1297 } 1298 const isGallery = this.props.gallery; 1299 const selection = this.frame.state().get("selection"); 1300 const valueArray = Array.isArray(value) ? value : [value]; 1301 if (!isGallery) { 1302 valueArray.forEach((id) => { 1303 selection.add(wp.media.attachment(id)); 1304 }); 1305 } 1306 const attachments = getAttachmentsCollection(valueArray); 1307 attachments.more().done(function() { 1308 if (isGallery && attachments?.models?.length) { 1309 selection.add(attachments.models); 1310 } 1311 }); 1312 } 1313 onClose() { 1314 const { onClose } = this.props; 1315 this.detachUndoRedoGuard(); 1316 if (onClose) { 1317 onClose(); 1318 } 1319 invalidateAttachmentResolutions({ select: import_data.select, dispatch: import_data.dispatch }); 1320 this.frame.detach(); 1321 } 1322 updateCollection() { 1323 const frameContent = this.frame.content.get(); 1324 if (frameContent && frameContent.collection) { 1325 const collection = frameContent.collection; 1326 collection.toArray().forEach((model) => model.trigger("destroy", model)); 1327 collection.mirroring._hasMore = true; 1328 collection.more(); 1329 } 1330 } 1331 openModal() { 1332 const { 1333 gallery = false, 1334 featuredImageFlow, 1335 unstableFeaturedImageFlow, 1336 modalClass 1337 } = this.props; 1338 if (unstableFeaturedImageFlow !== void 0 && featuredImageFlow === void 0) { 1339 (0, import_deprecated.default)( 1340 "wp.mediaUtils.MediaUpload unstableFeaturedImageFlow prop", 1341 { 1342 since: "7.2", 1343 alternative: "featuredImageFlow", 1344 version: "7.4" 1345 } 1346 ); 1347 } 1348 if (gallery) { 1349 this.buildAndSetGalleryFrame(); 1350 } else { 1351 this.buildAndSetSingleMediaFrame(); 1352 } 1353 if (modalClass) { 1354 this.frame.$el.addClass(modalClass); 1355 } 1356 if (featuredImageFlow ?? unstableFeaturedImageFlow) { 1357 this.buildAndSetFeatureImageFrame(); 1358 } 1359 this.initializeListeners(); 1360 this.frame.open(); 1361 } 1362 render() { 1363 return this.props.render({ open: this.openModal }); 1364 } 1365 }; 1366 var media_upload_default = MediaUpload; 1367 1368 // packages/media-utils/build-module/utils/upload-media.mjs 1369 var import_i18n6 = __toESM(require_i18n(), 1); 1370 var import_blob = __toESM(require_blob(), 1); 1371 1372 // packages/media-utils/build-module/utils/upload-to-server.mjs 1373 var import_api_fetch = __toESM(require_api_fetch(), 1); 1374 1375 // packages/media-utils/build-module/utils/flatten-form-data.mjs 1376 function isPlainObject(data) { 1377 return data !== null && typeof data === "object" && Object.getPrototypeOf(data) === Object.prototype; 1378 } 1379 function flattenFormData(formData, key, data) { 1380 if (Array.isArray(data) || isPlainObject(data)) { 1381 for (const [name, value] of Object.entries(data)) { 1382 flattenFormData(formData, `$key}[$name}]`, value); 1383 } 1384 } else if (data !== void 0) { 1385 formData.append(key, String(data)); 1386 } 1387 } 1388 1389 // packages/media-utils/build-module/utils/transform-attachment.mjs 1390 function transformAttachment(attachment) { 1391 const { alt_text, source_url, ...savedMediaProps } = attachment; 1392 return { 1393 ...savedMediaProps, 1394 alt: attachment.alt_text, 1395 caption: attachment.caption?.raw ?? "", 1396 title: attachment.title.raw, 1397 url: attachment.source_url, 1398 poster: attachment._embedded?.["wp:featuredmedia"]?.[0]?.source_url || void 0 1399 }; 1400 } 1401 1402 // packages/media-utils/build-module/utils/upload-to-server.mjs 1403 async function uploadToServer(file, additionalData = {}, signal) { 1404 const data = new FormData(); 1405 data.append("file", file, file.name || file.type.replace("/", ".")); 1406 for (const [key, value] of Object.entries(additionalData)) { 1407 flattenFormData(data, key, value); 1408 } 1409 return transformAttachment( 1410 await (0, import_api_fetch.default)({ 1411 // This allows the video block to directly get a video's poster image. 1412 path: "/wp/v2/media?_embed=wp:featuredmedia", 1413 body: data, 1414 method: "POST", 1415 signal 1416 }) 1417 ); 1418 } 1419 1420 // packages/media-utils/build-module/utils/validate-mime-type.mjs 1421 var import_i18n2 = __toESM(require_i18n(), 1); 1422 1423 // packages/media-utils/build-module/utils/upload-error.mjs 1424 var UploadError = class extends Error { 1425 code; 1426 file; 1427 constructor({ code, message: message2, file, cause }) { 1428 super(message2, { cause }); 1429 Object.setPrototypeOf(this, new.target.prototype); 1430 this.code = code; 1431 this.file = file; 1432 } 1433 }; 1434 1435 // packages/media-utils/build-module/utils/validate-mime-type.mjs 1436 function validateMimeType(file, allowedTypes) { 1437 if (!allowedTypes || allowedTypes.includes("*")) { 1438 return; 1439 } 1440 const isAllowedType = allowedTypes.some((allowedType) => { 1441 if (allowedType.includes("/")) { 1442 return allowedType === file.type; 1443 } 1444 return file.type.startsWith(`$allowedType}/`); 1445 }); 1446 if (file.type && !isAllowedType) { 1447 throw new UploadError({ 1448 code: "MIME_TYPE_NOT_SUPPORTED", 1449 message: (0, import_i18n2.sprintf)( 1450 // translators: %s: file name. 1451 (0, import_i18n2.__)("%s: Sorry, this file type is not supported here."), 1452 file.name 1453 ), 1454 file 1455 }); 1456 } 1457 } 1458 1459 // packages/media-utils/build-module/utils/validate-mime-type-for-user.mjs 1460 var import_i18n3 = __toESM(require_i18n(), 1); 1461 1462 // packages/media-utils/build-module/utils/get-mime-types-array.mjs 1463 function getMimeTypesArray(wpMimeTypesObject) { 1464 if (!wpMimeTypesObject) { 1465 return null; 1466 } 1467 return Object.entries(wpMimeTypesObject).flatMap( 1468 ([extensionsString, mime]) => { 1469 const [type] = mime.split("/"); 1470 const extensions = extensionsString.split("|"); 1471 return [ 1472 mime, 1473 ...extensions.map( 1474 (extension) => `$type}/$extension}` 1475 ) 1476 ]; 1477 } 1478 ); 1479 } 1480 1481 // packages/media-utils/build-module/utils/validate-mime-type-for-user.mjs 1482 function validateMimeTypeForUser(file, wpAllowedMimeTypes) { 1483 const allowedMimeTypesForUser = getMimeTypesArray(wpAllowedMimeTypes); 1484 if (!allowedMimeTypesForUser) { 1485 return; 1486 } 1487 const isAllowedMimeTypeForUser = allowedMimeTypesForUser.includes( 1488 file.type 1489 ); 1490 if (file.type && !isAllowedMimeTypeForUser) { 1491 throw new UploadError({ 1492 code: "MIME_TYPE_NOT_ALLOWED_FOR_USER", 1493 message: (0, import_i18n3.sprintf)( 1494 // translators: %s: file name. 1495 (0, import_i18n3.__)( 1496 "%s: Sorry, you are not allowed to upload this file type." 1497 ), 1498 file.name 1499 ), 1500 file 1501 }); 1502 } 1503 } 1504 1505 // packages/media-utils/build-module/utils/validate-file-size.mjs 1506 var import_i18n4 = __toESM(require_i18n(), 1); 1507 function validateFileSize(file, maxUploadFileSize) { 1508 if (file.size <= 0) { 1509 throw new UploadError({ 1510 code: "EMPTY_FILE", 1511 message: (0, import_i18n4.sprintf)( 1512 // translators: %s: file name. 1513 (0, import_i18n4.__)("%s: This file is empty."), 1514 file.name 1515 ), 1516 file 1517 }); 1518 } 1519 if (maxUploadFileSize && file.size > maxUploadFileSize) { 1520 throw new UploadError({ 1521 code: "SIZE_ABOVE_LIMIT", 1522 message: (0, import_i18n4.sprintf)( 1523 // translators: %s: file name. 1524 (0, import_i18n4.__)( 1525 "%s: This file exceeds the maximum upload size for this site." 1526 ), 1527 file.name 1528 ), 1529 file 1530 }); 1531 } 1532 } 1533 1534 // packages/media-utils/build-module/utils/get-upload-error-message.mjs 1535 var import_i18n5 = __toESM(require_i18n(), 1); 1536 var OPAQUE_ERROR_CODES = ["invalid_json", "unknown_error"]; 1537 function getUploadErrorMessage(error2, fileName) { 1538 const serverError = (0, import_i18n5.sprintf)( 1539 /* translators: %s: file name */ 1540 (0, import_i18n5.__)('Failed to upload "%s". Please try again.'), 1541 fileName 1542 ); 1543 if (typeof error2 === "string") { 1544 return error2 || serverError; 1545 } 1546 const { code, message: message2 } = error2 ?? {}; 1547 if (typeof code === "string" && OPAQUE_ERROR_CODES.includes(code)) { 1548 return serverError; 1549 } 1550 return typeof message2 === "string" && message2 ? message2 : serverError; 1551 } 1552 1553 // packages/media-utils/build-module/utils/upload-media.mjs 1554 function uploadMedia({ 1555 wpAllowedMimeTypes, 1556 allowedTypes, 1557 additionalData = {}, 1558 filesList, 1559 maxUploadFileSize, 1560 onError, 1561 onFileChange, 1562 signal, 1563 multiple = true 1564 }) { 1565 if (!multiple && filesList.length > 1) { 1566 onError?.(new Error((0, import_i18n6.__)("Only one file can be used here."))); 1567 return; 1568 } 1569 const validFiles = []; 1570 const filesSet = []; 1571 const setAndUpdateFiles = (index2, value) => { 1572 if (!window.__clientSideMediaProcessing) { 1573 if (filesSet[index2]?.url) { 1574 (0, import_blob.revokeBlobURL)(filesSet[index2].url); 1575 } 1576 } 1577 filesSet[index2] = value; 1578 onFileChange?.( 1579 filesSet.filter((attachment) => attachment !== null) 1580 ); 1581 }; 1582 for (const mediaFile of filesList) { 1583 try { 1584 validateMimeTypeForUser(mediaFile, wpAllowedMimeTypes); 1585 } catch (error2) { 1586 onError?.(error2); 1587 continue; 1588 } 1589 try { 1590 validateMimeType(mediaFile, allowedTypes); 1591 } catch (error2) { 1592 onError?.(error2); 1593 continue; 1594 } 1595 try { 1596 validateFileSize(mediaFile, maxUploadFileSize); 1597 } catch (error2) { 1598 onError?.(error2); 1599 continue; 1600 } 1601 validFiles.push(mediaFile); 1602 if (!window.__clientSideMediaProcessing) { 1603 filesSet.push({ url: (0, import_blob.createBlobURL)(mediaFile) }); 1604 onFileChange?.(filesSet); 1605 } 1606 } 1607 validFiles.map(async (file, index2) => { 1608 try { 1609 const attachment = await uploadToServer( 1610 file, 1611 additionalData, 1612 signal 1613 ); 1614 setAndUpdateFiles(index2, attachment); 1615 } catch (error2) { 1616 setAndUpdateFiles(index2, null); 1617 onError?.( 1618 new UploadError({ 1619 code: "GENERAL", 1620 message: getUploadErrorMessage(error2, file.name), 1621 file, 1622 cause: error2 instanceof Error ? error2 : void 0 1623 }) 1624 ); 1625 } 1626 }); 1627 } 1628 1629 // packages/media-utils/build-module/utils/sideload-to-server.mjs 1630 var import_api_fetch2 = __toESM(require_api_fetch(), 1); 1631 async function sideloadToServer(file, attachmentId, additionalData = {}, signal) { 1632 const data = new FormData(); 1633 data.append("file", file, file.name || file.type.replace("/", ".")); 1634 for (const [key, value] of Object.entries(additionalData)) { 1635 flattenFormData(data, key, value); 1636 } 1637 return (0, import_api_fetch2.default)({ 1638 path: `/wp/v2/media/$attachmentId}/sideload`, 1639 body: data, 1640 method: "POST", 1641 signal 1642 }); 1643 } 1644 1645 // packages/media-utils/build-module/utils/sideload-media.mjs 1646 var noop = () => { 1647 }; 1648 async function sideloadMedia({ 1649 file, 1650 attachmentId, 1651 additionalData = {}, 1652 signal, 1653 onSuccess, 1654 onError = noop 1655 }) { 1656 try { 1657 const subSizeData = await sideloadToServer( 1658 file, 1659 attachmentId, 1660 additionalData, 1661 signal 1662 ); 1663 onSuccess?.(subSizeData); 1664 } catch (error2) { 1665 onError( 1666 new UploadError({ 1667 code: "GENERAL", 1668 message: getUploadErrorMessage(error2, file.name), 1669 file, 1670 cause: error2 instanceof Error ? error2 : void 0 1671 }) 1672 ); 1673 } 1674 } 1675 1676 // node_modules/clsx/dist/clsx.mjs 1677 function r(e) { 1678 var t, f, n = ""; 1679 if ("string" == typeof e || "number" == typeof e) n += e; 1680 else if ("object" == typeof e) if (Array.isArray(e)) { 1681 var o = e.length; 1682 for (t = 0; t < o; t++) e[t] && (f = r(e[t])) && (n && (n += " "), n += f); 1683 } else for (f in e) e[f] && (n && (n += " "), n += f); 1684 return n; 1685 } 1686 function clsx() { 1687 for (var e, t, f = 0, n = "", o = arguments.length; f < o; f++) (e = arguments[f]) && (t = r(e)) && (n && (n += " "), n += t); 1688 return n; 1689 } 1690 var clsx_default = clsx; 1691 1692 // packages/media-utils/build-module/components/media-upload-modal/index.mjs 1693 var import_element150 = __toESM(require_element(), 1); 1694 var import_i18n79 = __toESM(require_i18n(), 1); 1695 var import_core_data6 = __toESM(require_core_data(), 1); 1696 var import_data14 = __toESM(require_data(), 1); 1697 var import_components54 = __toESM(require_components(), 1); 1698 1699 // packages/icons/build-module/library/arrow-down.mjs 1700 var import_primitives = __toESM(require_primitives(), 1); 1701 var import_jsx_runtime = __toESM(require_jsx_runtime(), 1); 1702 var arrow_down_default = /* @__PURE__ */ (0, import_jsx_runtime.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_runtime.jsx)(import_primitives.Path, { d: "M12 4V19M7 14L12 19L17 14", vectorEffect: "non-scaling-stroke" }) }); 1703 1704 // packages/icons/build-module/library/arrow-left.mjs 1705 var import_primitives2 = __toESM(require_primitives(), 1); 1706 var import_jsx_runtime2 = __toESM(require_jsx_runtime(), 1); 1707 var arrow_left_default = /* @__PURE__ */ (0, import_jsx_runtime2.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_runtime2.jsx)(import_primitives2.Path, { d: "M20 12L5 12M10 7L5 12L10 17", vectorEffect: "non-scaling-stroke" }) }); 1708 1709 // packages/icons/build-module/library/arrow-right.mjs 1710 var import_primitives3 = __toESM(require_primitives(), 1); 1711 var import_jsx_runtime3 = __toESM(require_jsx_runtime(), 1); 1712 var arrow_right_default = /* @__PURE__ */ (0, import_jsx_runtime3.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_runtime3.jsx)(import_primitives3.Path, { d: "M4 12L19 12M14 17L19 12L14 7", vectorEffect: "non-scaling-stroke" }) }); 1713 1714 // packages/icons/build-module/library/arrow-up.mjs 1715 var import_primitives4 = __toESM(require_primitives(), 1); 1716 var import_jsx_runtime4 = __toESM(require_jsx_runtime(), 1); 1717 var arrow_up_default = /* @__PURE__ */ (0, import_jsx_runtime4.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_runtime4.jsx)(import_primitives4.Path, { d: "M12 20L12 5M17 10L12 5L7 10", vectorEffect: "non-scaling-stroke" }) }); 1718 1719 // packages/icons/build-module/library/audio.mjs 1720 var import_primitives5 = __toESM(require_primitives(), 1); 1721 var import_jsx_runtime5 = __toESM(require_jsx_runtime(), 1); 1722 var audio_default = /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_primitives5.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", style: { fill: "none" }, stroke: "currentColor", strokeWidth: "1.5", children: [ 1723 /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_primitives5.Path, { d: "M13.25 16.5C13.25 18.0188 12.0188 19.25 10.5 19.25C8.98122 19.25 7.75 18.0188 7.75 16.5C7.75 14.9812 8.98122 13.75 10.5 13.75C12.0188 13.75 13.25 14.9812 13.25 16.5Z", fill: "currentColor", stroke: "none" }), 1724 /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_primitives5.Path, { d: "M10.5 19.25C12.0188 19.25 13.25 18.0188 13.25 16.5C13.25 14.9812 12.0188 13.75 10.5 13.75C8.98122 13.75 7.75 14.9812 7.75 16.5C7.75 18.0188 8.98122 19.25 10.5 19.25ZM10.5 19.25C13.4867 19.25 13.75 16.5 13.75 15.1379V7.99998C13.75 4.9108 16.4 5.00254 18 5.00233", vectorEffect: "non-scaling-stroke" }) 1725 ] }); 1726 1727 // packages/icons/build-module/library/block-table.mjs 1728 var import_primitives6 = __toESM(require_primitives(), 1); 1729 var import_jsx_runtime6 = __toESM(require_jsx_runtime(), 1); 1730 var block_table_default = /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_primitives6.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_runtime6.jsx)(import_primitives6.Path, { d: "M4.75 9.5V6C4.75 5.30964 5.30964 4.75 6 4.75L18 4.75C18.6904 4.75 19.25 5.30964 19.25 6V9.5M4.75 9.5H12M4.75 9.5V14.5M19.25 9.5H12M19.25 9.5V14.5M12 9.5V14.5M12 19.25H18C18.6904 19.25 19.25 18.6904 19.25 18V14.5M12 19.25H6C5.30964 19.25 4.75 18.6904 4.75 18V14.5M12 19.25V14.5M12 14.5H19.25M12 14.5H4.75", vectorEffect: "non-scaling-stroke" }) }); 1731 1732 // packages/icons/build-module/library/category.mjs 1733 var import_primitives7 = __toESM(require_primitives(), 1); 1734 var import_jsx_runtime7 = __toESM(require_jsx_runtime(), 1); 1735 var category_default = /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_primitives7.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", style: { fill: "none" }, stroke: "currentColor", strokeWidth: "1.5", children: [ 1736 /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_primitives7.Path, { d: "M4.75 6C4.75 5.30964 5.30964 4.75 6 4.75H9C9.69036 4.75 10.25 5.30964 10.25 6V9C10.25 9.69036 9.69036 10.25 9 10.25H6C5.30964 10.25 4.75 9.69036 4.75 9V6Z", vectorEffect: "non-scaling-stroke" }), 1737 /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_primitives7.Path, { d: "M4.75 15C4.75 14.3096 5.30964 13.75 6 13.75H9C9.69036 13.75 10.25 14.3096 10.25 15V18C10.25 18.6904 9.69036 19.25 9 19.25H6C5.30964 19.25 4.75 18.6904 4.75 18V15Z", vectorEffect: "non-scaling-stroke" }), 1738 /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_primitives7.Path, { d: "M13.75 6C13.75 5.30964 14.3096 4.75 15 4.75H18C18.6904 4.75 19.25 5.30964 19.25 6V9C19.25 9.69036 18.6904 10.25 18 10.25H15C14.3096 10.25 13.75 9.69036 13.75 9V6Z", vectorEffect: "non-scaling-stroke" }), 1739 /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_primitives7.Path, { d: "M13.75 15C13.75 14.3096 14.3096 13.75 15 13.75H18C18.6904 13.75 19.25 14.3096 19.25 15V18C19.25 18.6904 18.6904 19.25 18 19.25H15C14.3096 19.25 13.75 18.6904 13.75 18V15Z", vectorEffect: "non-scaling-stroke" }) 1740 ] }); 1741 1742 // packages/icons/build-module/library/check.mjs 1743 var import_primitives8 = __toESM(require_primitives(), 1); 1744 var import_jsx_runtime8 = __toESM(require_jsx_runtime(), 1); 1745 var check_default = /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_primitives8.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_runtime8.jsx)(import_primitives8.Path, { d: "M7 12L10 15L17 8", vectorEffect: "non-scaling-stroke" }) }); 1746 1747 // packages/icons/build-module/library/chevron-down.mjs 1748 var import_primitives9 = __toESM(require_primitives(), 1); 1749 var import_jsx_runtime9 = __toESM(require_jsx_runtime(), 1); 1750 var chevron_down_default = /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_primitives9.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_runtime9.jsx)(import_primitives9.Path, { d: "M7 11L12 15L17 11", vectorEffect: "non-scaling-stroke" }) }); 1751 1752 // packages/icons/build-module/library/chevron-left.mjs 1753 var import_primitives10 = __toESM(require_primitives(), 1); 1754 var import_jsx_runtime10 = __toESM(require_jsx_runtime(), 1); 1755 var chevron_left_default = /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_primitives10.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_runtime10.jsx)(import_primitives10.Path, { d: "M14 6.5L9 12L14 17.5", vectorEffect: "non-scaling-stroke" }) }); 1756 1757 // packages/icons/build-module/library/chevron-right-small.mjs 1758 var import_primitives11 = __toESM(require_primitives(), 1); 1759 var import_jsx_runtime11 = __toESM(require_jsx_runtime(), 1); 1760 var chevron_right_small_default = /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_primitives11.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_runtime11.jsx)(import_primitives11.Path, { d: "M10.5 8.5L13.5 12L10.5 15.5", vectorEffect: "non-scaling-stroke" }) }); 1761 1762 // packages/icons/build-module/library/chevron-right.mjs 1763 var import_primitives12 = __toESM(require_primitives(), 1); 1764 var import_jsx_runtime12 = __toESM(require_jsx_runtime(), 1); 1765 var chevron_right_default = /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_primitives12.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_primitives12.Path, { d: "M10 6.5L15 12L10 17.5", vectorEffect: "non-scaling-stroke" }) }); 1766 1767 // packages/icons/build-module/library/close-small.mjs 1768 var import_primitives13 = __toESM(require_primitives(), 1); 1769 var import_jsx_runtime13 = __toESM(require_jsx_runtime(), 1); 1770 var close_small_default = /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_primitives13.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_primitives13.Path, { d: "M7.75 16.25L16.25 7.75M16.25 16.25L7.75 7.75", vectorEffect: "non-scaling-stroke" }) }); 1771 1772 // packages/icons/build-module/library/cog.mjs 1773 var import_primitives14 = __toESM(require_primitives(), 1); 1774 var import_jsx_runtime14 = __toESM(require_jsx_runtime(), 1); 1775 var cog_default = /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_primitives14.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", style: { fill: "none" }, stroke: "currentColor", strokeWidth: "1.5", children: [ 1776 /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_primitives14.Path, { d: "M5.38646 8.95505C5.36302 8.99564 5.37092 9.04706 5.40547 9.07874L6.96476 10.509C7.08306 10.1089 7.24777 9.72864 7.45264 9.37456C7.66022 9.01579 7.90904 8.68387 8.19262 8.38527L6.17287 7.74956C6.12816 7.73549 6.07968 7.75436 6.05624 7.79495L5.38646 8.95505Z", fill: "currentColor", strokeLinejoin: "round", vectorEffect: "non-scaling-stroke" }), 1777 /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_primitives14.Path, { d: "M12.6698 19.25C12.7167 19.25 12.7573 19.2174 12.7674 19.1717L13.2265 17.106C12.833 17.2001 12.4223 17.25 12 17.25C11.5777 17.25 11.167 17.2001 10.7736 17.106L11.2326 19.1717C11.2428 19.2174 11.2834 19.25 11.3303 19.25L12.6698 19.25Z", fill: "currentColor", strokeLinejoin: "round", vectorEffect: "non-scaling-stroke" }), 1778 /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_primitives14.Path, { d: "M11.3303 4.75C11.2834 4.75 11.2428 4.78255 11.2326 4.82831L10.7736 6.89403C11.167 6.79986 11.5777 6.75 12 6.75C12.4223 6.75 12.833 6.79987 13.2265 6.89403L12.7674 4.82831C12.7573 4.78255 12.7167 4.75 12.6698 4.75L11.3303 4.75Z", fill: "currentColor", strokeLinejoin: "round", vectorEffect: "non-scaling-stroke" }), 1779 /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_primitives14.Path, { d: "M17.9438 7.79495C17.9204 7.75436 17.8719 7.73549 17.8272 7.74956L15.8074 8.38528C16.091 8.68388 16.3398 9.0158 16.5474 9.37457C16.7523 9.72865 16.917 10.1089 17.0353 10.509L18.5946 9.07874C18.6291 9.04706 18.637 8.99564 18.6136 8.95505L17.9438 7.79495Z", fill: "currentColor", strokeLinejoin: "round", vectorEffect: "non-scaling-stroke" }), 1780 /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_primitives14.Path, { d: "M6.05625 16.205C6.07968 16.2456 6.12816 16.2645 6.17287 16.2504L8.19262 15.6147C7.90904 15.3161 7.66022 14.9842 7.45264 14.6254C7.24777 14.2714 7.08307 13.8911 6.96476 13.491L5.40547 14.9213C5.37093 14.9529 5.36303 15.0044 5.38646 15.045L6.05625 16.205Z", fill: "currentColor", strokeLinejoin: "round", vectorEffect: "non-scaling-stroke" }), 1781 /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_primitives14.Path, { d: "M18.6136 15.0449C18.637 15.0044 18.6291 14.9529 18.5946 14.9213L17.0353 13.491C16.917 13.8911 16.7523 14.2713 16.5474 14.6254C16.3398 14.9842 16.091 15.3161 15.8074 15.6147L17.8272 16.2504C17.8719 16.2645 17.9204 16.2456 17.9438 16.205L18.6136 15.0449Z", fill: "currentColor", strokeLinejoin: "round", vectorEffect: "non-scaling-stroke" }), 1782 /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_primitives14.Path, { d: "M12 6.75C14.8995 6.75 17.25 9.10051 17.25 12C17.25 14.8995 14.8995 17.25 12 17.25C9.10051 17.25 6.75 14.8995 6.75 12C6.75 9.10051 9.10051 6.75 12 6.75Z", vectorEffect: "non-scaling-stroke" }), 1783 /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_primitives14.Path, { d: "M12 8C14.2091 8 16 9.79086 16 12C16 14.2091 14.2091 16 12 16C9.79086 16 8 14.2091 8 12C8 9.79086 9.79086 8 12 8Z", vectorEffect: "non-scaling-stroke" }) 1784 ] }); 1785 1786 // packages/icons/build-module/library/comment-author-avatar.mjs 1787 var import_primitives15 = __toESM(require_primitives(), 1); 1788 var import_jsx_runtime15 = __toESM(require_jsx_runtime(), 1); 1789 var comment_author_avatar_default = /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_primitives15.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", style: { fill: "none" }, stroke: "currentColor", strokeWidth: "1.5", children: [ 1790 /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_primitives15.Path, { d: "M8 18.0476V16C8 14.8954 8.89543 14 10 14H14C15.1046 14 16 14.8954 16 16V18.0476", vectorEffect: "non-scaling-stroke" }), 1791 /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_primitives15.Path, { d: "M12 4.75C7.99594 4.75 4.75 7.99593 4.75 12C4.75 16.0041 7.99593 19.25 12 19.25C16.0041 19.25 19.25 16.0041 19.25 12C19.25 7.99594 16.0041 4.75 12 4.75Z", strokeLinejoin: "round", vectorEffect: "non-scaling-stroke" }), 1792 /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_primitives15.Path, { d: "M13.75 10C13.75 10.9665 12.9665 11.75 12 11.75C11.0335 11.75 10.25 10.9665 10.25 10C10.25 9.0335 11.0335 8.25 12 8.25C12.9665 8.25 13.75 9.0335 13.75 10Z", vectorEffect: "non-scaling-stroke" }) 1793 ] }); 1794 1795 // packages/icons/build-module/library/envelope.mjs 1796 var import_primitives16 = __toESM(require_primitives(), 1); 1797 var import_jsx_runtime16 = __toESM(require_jsx_runtime(), 1); 1798 var envelope_default = /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_primitives16.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_primitives16.Path, { d: "M20.25 8.5V7C20.25 6.30964 19.6904 5.75 19 5.75H5C4.30964 5.75 3.75 6.30964 3.75 7V8.5M20.25 8.5V17C20.25 17.6904 19.6904 18.25 19 18.25H5C4.30964 18.25 3.75 17.6904 3.75 17V8.5M20.25 8.5L12 14.5L3.75 8.5", vectorEffect: "non-scaling-stroke" }) }); 1799 1800 // packages/icons/build-module/library/error.mjs 1801 var import_primitives17 = __toESM(require_primitives(), 1); 1802 var import_jsx_runtime17 = __toESM(require_jsx_runtime(), 1); 1803 var error_default = /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_primitives17.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_runtime17.jsx)(import_primitives17.Path, { d: "M12 9L12 14M12 15.5V17M11.1284 5.04947L3.83827 18.0097C3.46331 18.6763 3.94502 19.5 4.70985 19.5H19.2902C20.055 19.5 20.5367 18.6763 20.1617 18.0097L12.8716 5.04947C12.4893 4.36982 11.5107 4.36982 11.1284 5.04947Z", vectorEffect: "non-scaling-stroke" }) }); 1804 1805 // packages/icons/build-module/library/file.mjs 1806 var import_primitives18 = __toESM(require_primitives(), 1); 1807 var import_jsx_runtime18 = __toESM(require_jsx_runtime(), 1); 1808 var file_default = /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_primitives18.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_runtime18.jsx)(import_primitives18.Path, { d: "M3.75 6V17.5C3.75 18.1904 4.30964 18.75 5 18.75H19C19.6904 18.75 20.25 18.1904 20.25 17.5V8.5C20.25 7.80964 19.6904 7.25 19 7.25H13.3463C12.8352 7.25 12.3755 6.93881 12.1857 6.46424L11.8143 5.53576C11.6245 5.06119 11.1648 4.75 10.6537 4.75H5C4.30964 4.75 3.75 5.30964 3.75 6Z", vectorEffect: "non-scaling-stroke" }) }); 1809 1810 // packages/icons/build-module/library/format-list-bullets-rtl.mjs 1811 var import_primitives19 = __toESM(require_primitives(), 1); 1812 var import_jsx_runtime19 = __toESM(require_jsx_runtime(), 1); 1813 var format_list_bullets_rtl_default = /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_primitives19.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", style: { fill: "none" }, stroke: "currentColor", strokeWidth: "1.5", children: [ 1814 /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_primitives19.Path, { d: "M13 8H4M13 16H4", vectorEffect: "non-scaling-stroke" }), 1815 /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_primitives19.Path, { d: "M18 9.25C17.3096 9.25 16.75 8.69036 16.75 8C16.75 7.30964 17.3096 6.75 18 6.75C18.6904 6.75 19.25 7.30964 19.25 8C19.25 8.69036 18.6904 9.25 18 9.25Z", fill: "currentColor", stroke: "none" }), 1816 /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_primitives19.Path, { d: "M18 17.25C17.3096 17.25 16.75 16.6904 16.75 16C16.75 15.3096 17.3096 14.75 18 14.75C18.6904 14.75 19.25 15.3096 19.25 16C19.25 16.6904 18.6904 17.25 18 17.25Z", fill: "currentColor", stroke: "none" }), 1817 /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_primitives19.Path, { d: "M18 9.25C17.3096 9.25 16.75 8.69036 16.75 8C16.75 7.30964 17.3096 6.75 18 6.75C18.6904 6.75 19.25 7.30964 19.25 8C19.25 8.69036 18.6904 9.25 18 9.25Z", vectorEffect: "non-scaling-stroke" }), 1818 /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_primitives19.Path, { d: "M18 17.25C17.3096 17.25 16.75 16.6904 16.75 16C16.75 15.3096 17.3096 14.75 18 14.75C18.6904 14.75 19.25 15.3096 19.25 16C19.25 16.6904 18.6904 17.25 18 17.25Z", vectorEffect: "non-scaling-stroke" }) 1819 ] }); 1820 1821 // packages/icons/build-module/library/format-list-bullets.mjs 1822 var import_primitives20 = __toESM(require_primitives(), 1); 1823 var import_jsx_runtime20 = __toESM(require_jsx_runtime(), 1); 1824 var format_list_bullets_default = /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_primitives20.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", style: { fill: "none" }, stroke: "currentColor", strokeWidth: "1.5", children: [ 1825 /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_primitives20.Path, { d: "M11 8H20M11 16H20", vectorEffect: "non-scaling-stroke" }), 1826 /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_primitives20.Path, { d: "M6 9.25C6.69036 9.25 7.25 8.69036 7.25 8C7.25 7.30964 6.69036 6.75 6 6.75C5.30964 6.75 4.75 7.30964 4.75 8C4.75 8.69036 5.30964 9.25 6 9.25Z", fill: "currentColor", stroke: "none" }), 1827 /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_primitives20.Path, { d: "M6 17.25C6.69036 17.25 7.25 16.6904 7.25 16C7.25 15.3096 6.69036 14.75 6 14.75C5.30964 14.75 4.75 15.3096 4.75 16C4.75 16.6904 5.30964 17.25 6 17.25Z", fill: "currentColor", stroke: "none" }), 1828 /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_primitives20.Path, { d: "M6 9.25C6.69036 9.25 7.25 8.69036 7.25 8C7.25 7.30964 6.69036 6.75 6 6.75C5.30964 6.75 4.75 7.30964 4.75 8C4.75 8.69036 5.30964 9.25 6 9.25Z", vectorEffect: "non-scaling-stroke" }), 1829 /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_primitives20.Path, { d: "M6 17.25C6.69036 17.25 7.25 16.6904 7.25 16C7.25 15.3096 6.69036 14.75 6 14.75C5.30964 14.75 4.75 15.3096 4.75 16C4.75 16.6904 5.30964 17.25 6 17.25Z", vectorEffect: "non-scaling-stroke" }) 1830 ] }); 1831 1832 // packages/icons/build-module/library/funnel.mjs 1833 var import_primitives21 = __toESM(require_primitives(), 1); 1834 var import_jsx_runtime21 = __toESM(require_jsx_runtime(), 1); 1835 var funnel_default = /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_primitives21.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_runtime21.jsx)(import_primitives21.Path, { d: "M10 17.5H14M8 12H16M6 6.5H18", strokeLinejoin: "round", vectorEffect: "non-scaling-stroke" }) }); 1836 1837 // packages/icons/build-module/library/image.mjs 1838 var import_primitives22 = __toESM(require_primitives(), 1); 1839 var import_jsx_runtime22 = __toESM(require_jsx_runtime(), 1); 1840 var image_default = /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_primitives22.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_runtime22.jsx)(import_primitives22.Path, { d: "M19.25 14.2513L16.0707 11.0707C16.0317 11.0317 15.9683 11.0317 15.9293 11.0707L12.0584 14.9416C12.0245 14.9755 11.9713 14.9806 11.9316 14.9537L8.65791 12.7392C8.62313 12.7156 8.57736 12.7163 8.54332 12.7409L4.75 15.4808M19.25 14.2513V6C19.25 5.30964 18.6904 4.75 18 4.75H6C5.30964 4.75 4.75 5.30964 4.75 6V15.4808M19.25 14.2513V18C19.25 18.6904 18.6904 19.25 18 19.25H6C5.30964 19.25 4.75 18.6904 4.75 18V15.4808", vectorEffect: "non-scaling-stroke" }) }); 1841 1842 // packages/icons/build-module/library/link.mjs 1843 var import_primitives23 = __toESM(require_primitives(), 1); 1844 var import_jsx_runtime23 = __toESM(require_jsx_runtime(), 1); 1845 var link_default = /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_primitives23.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_runtime23.jsx)(import_primitives23.Path, { d: "M9.5 12L14.5 12M10 7.75H8.25C5.90279 7.75 4 9.65279 4 12C4 14.3472 5.90279 16.25 8.25 16.25H10M14 16.25H15.75C18.0972 16.25 20 14.3472 20 12C20 9.65279 18.0972 7.75 15.75 7.75L14 7.75", vectorEffect: "non-scaling-stroke" }) }); 1846 1847 // packages/icons/build-module/library/mobile.mjs 1848 var import_primitives24 = __toESM(require_primitives(), 1); 1849 var import_jsx_runtime24 = __toESM(require_jsx_runtime(), 1); 1850 var mobile_default = /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_primitives24.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_runtime24.jsx)(import_primitives24.Path, { d: "M11 16.5H13M16.25 18V6C16.25 5.30964 15.6904 4.75 15 4.75H9C8.30964 4.75 7.75 5.30964 7.75 6L7.75 18C7.75 18.6904 8.30964 19.25 9 19.25H15C15.6904 19.25 16.25 18.6904 16.25 18Z", vectorEffect: "non-scaling-stroke" }) }); 1851 1852 // packages/icons/build-module/library/more-vertical.mjs 1853 var import_primitives25 = __toESM(require_primitives(), 1); 1854 var import_jsx_runtime25 = __toESM(require_jsx_runtime(), 1); 1855 var more_vertical_default = /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_primitives25.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", style: { fill: "none" }, stroke: "currentColor", strokeWidth: "1.5", children: [ 1856 /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_primitives25.Path, { d: "M11.75 18.25L12.25 18.25L12.25 17.75L11.75 17.75L11.75 18.25Z", fill: "currentColor", stroke: "none" }), 1857 /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_primitives25.Path, { d: "M11.75 12.25L12.25 12.25L12.25 11.75L11.75 11.75L11.75 12.25Z", fill: "currentColor", stroke: "none" }), 1858 /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_primitives25.Path, { d: "M11.75 6.25L12.25 6.25L12.25 5.75L11.75 5.75L11.75 6.25Z", fill: "currentColor", stroke: "none" }), 1859 /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_primitives25.Path, { d: "M11.75 18.25L12.25 18.25L12.25 17.75L11.75 17.75L11.75 18.25Z", vectorEffect: "non-scaling-stroke" }), 1860 /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_primitives25.Path, { d: "M11.75 12.25L12.25 12.25L12.25 11.75L11.75 11.75L11.75 12.25Z", vectorEffect: "non-scaling-stroke" }), 1861 /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_primitives25.Path, { d: "M11.75 6.25L12.25 6.25L12.25 5.75L11.75 5.75L11.75 6.25Z", vectorEffect: "non-scaling-stroke" }) 1862 ] }); 1863 1864 // packages/icons/build-module/library/next.mjs 1865 var import_primitives26 = __toESM(require_primitives(), 1); 1866 var import_jsx_runtime26 = __toESM(require_jsx_runtime(), 1); 1867 var next_default = /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_primitives26.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_runtime26.jsx)(import_primitives26.Path, { d: "M7 17.5L12 12L7 6.5M13 17.5L18 12L13 6.5", vectorEffect: "non-scaling-stroke" }) }); 1868 1869 // packages/icons/build-module/library/previous.mjs 1870 var import_primitives27 = __toESM(require_primitives(), 1); 1871 var import_jsx_runtime27 = __toESM(require_jsx_runtime(), 1); 1872 var previous_default = /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_primitives27.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_runtime27.jsx)(import_primitives27.Path, { d: "M17 6.5L12 12L17 17.5M11 6.5L6 12L11 17.5", vectorEffect: "non-scaling-stroke" }) }); 1873 1874 // packages/icons/build-module/library/published.mjs 1875 var import_primitives28 = __toESM(require_primitives(), 1); 1876 var import_jsx_runtime28 = __toESM(require_jsx_runtime(), 1); 1877 var published_default = /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_primitives28.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", style: { fill: "none" }, stroke: "currentColor", strokeWidth: "1.5", children: [ 1878 /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_primitives28.Path, { d: "M12 19.25C16.0041 19.25 19.25 16.0041 19.25 12C19.25 7.99594 16.0041 4.75 12 4.75C7.99594 4.75 4.75 7.99594 4.75 12C4.75 16.0041 7.99594 19.25 12 19.25Z", strokeLinejoin: "round", vectorEffect: "non-scaling-stroke" }), 1879 /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_primitives28.Path, { d: "M9 12L11 14L15 10", vectorEffect: "non-scaling-stroke" }) 1880 ] }); 1881 1882 // packages/icons/build-module/library/scheduled.mjs 1883 var import_primitives29 = __toESM(require_primitives(), 1); 1884 var import_jsx_runtime29 = __toESM(require_jsx_runtime(), 1); 1885 var scheduled_default = /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_primitives29.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", style: { fill: "none" }, stroke: "currentColor", strokeWidth: "1.5", children: [ 1886 /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_primitives29.Path, { d: "M12 19.25C16.0041 19.25 19.25 16.0041 19.25 12C19.25 7.99594 16.0041 4.75 12 4.75C7.99594 4.75 4.75 7.99594 4.75 12C4.75 16.0041 7.99594 19.25 12 19.25Z", strokeLinejoin: "round", vectorEffect: "non-scaling-stroke" }), 1887 /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_primitives29.Path, { d: "M9.5 12.25H12.25V8", vectorEffect: "non-scaling-stroke" }) 1888 ] }); 1889 1890 // packages/icons/build-module/library/search.mjs 1891 var import_primitives30 = __toESM(require_primitives(), 1); 1892 var import_jsx_runtime30 = __toESM(require_jsx_runtime(), 1); 1893 var search_default = /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_primitives30.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_runtime30.jsx)(import_primitives30.Path, { d: "M5 19L9.28769 14.7123M18.25 11C18.25 13.8995 15.8995 16.25 13 16.25C10.1005 16.25 7.75 13.8995 7.75 11C7.75 8.10051 10.1005 5.75 13 5.75C15.8995 5.75 18.25 8.10051 18.25 11Z", vectorEffect: "non-scaling-stroke" }) }); 1894 1895 // packages/icons/build-module/library/seen.mjs 1896 var import_primitives31 = __toESM(require_primitives(), 1); 1897 var import_jsx_runtime31 = __toESM(require_jsx_runtime(), 1); 1898 var seen_default = /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_primitives31.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", style: { fill: "none" }, stroke: "currentColor", strokeWidth: "1.5", children: [ 1899 /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_primitives31.Path, { d: "M20.0645 13C18.5918 10.0366 15.5337 8 12 8C8.46631 8 5.40825 10.0366 3.93555 13", vectorEffect: "non-scaling-stroke" }), 1900 /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_primitives31.Circle, { cx: "12", cy: "12.5", r: "3", fill: "currentColor", vectorEffect: "non-scaling-stroke" }) 1901 ] }); 1902 1903 // packages/icons/build-module/library/unseen.mjs 1904 var import_primitives32 = __toESM(require_primitives(), 1); 1905 var import_jsx_runtime32 = __toESM(require_jsx_runtime(), 1); 1906 var unseen_default = /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_primitives32.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", style: { fill: "none" }, stroke: "currentColor", strokeWidth: "1.5", children: [ 1907 /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_primitives32.Path, { d: "M8 21L10.6587 15.1842M13.1523 9.72929L13.8553 8.19144L16 3.5M20.0645 13C19.2118 11.2841 17.8276 9.87898 16.1272 9M3.93555 13C5.40825 10.0366 8.46631 8 12 8C12.636 8 13.2566 8.06597 13.8553 8.19144M13.1523 9.72929C12.7975 9.58156 12.4083 9.5 12 9.5C10.3431 9.5 9 10.8431 9 12.5C9 13.6747 9.67519 14.6917 10.6587 15.1842M13.1523 9.72929L10.6587 15.1842M13.1755 15.261C14.2481 14.8037 15 13.7397 15 12.5C15 12.1819 14.9505 11.8753 14.8587 11.5876", vectorEffect: "non-scaling-stroke" }), 1908 /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_primitives32.Path, { d: "M12 9.5C10.3431 9.5 9 10.8431 9 12.5C9 13.6747 9.67519 14.6917 10.6587 15.1842L13.1523 9.72929C12.7975 9.58156 12.4083 9.5 12 9.5Z", fill: "currentColor", vectorEffect: "non-scaling-stroke" }) 1909 ] }); 1910 1911 // packages/icons/build-module/library/upload.mjs 1912 var import_primitives33 = __toESM(require_primitives(), 1); 1913 var import_jsx_runtime33 = __toESM(require_jsx_runtime(), 1); 1914 var upload_default = /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_primitives33.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_runtime33.jsx)(import_primitives33.Path, { d: "M4.75 15V19.25H12M12 19.25V4.5M12 19.25H19.25V15M17.5 10L12 4.5L6.5 10", vectorEffect: "non-scaling-stroke" }) }); 1915 1916 // packages/icons/build-module/library/video.mjs 1917 var import_primitives34 = __toESM(require_primitives(), 1); 1918 var import_jsx_runtime34 = __toESM(require_jsx_runtime(), 1); 1919 var video_default = /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_primitives34.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", style: { fill: "none" }, stroke: "currentColor", strokeWidth: "1.5", children: [ 1920 /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_primitives34.Path, { d: "M10 15L15 12L10 9V15Z", fill: "currentColor", stroke: "none" }), 1921 /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_primitives34.Path, { d: "M4.75 6C4.75 5.30964 5.30964 4.75 6 4.75H18C18.6904 4.75 19.25 5.30964 19.25 6V18C19.25 18.6904 18.6904 19.25 18 19.25H6C5.30964 19.25 4.75 18.6904 4.75 18V6Z", vectorEffect: "non-scaling-stroke" }) 1922 ] }); 1923 1924 // packages/ui/build-module/badge/badge.mjs 1925 var import_element16 = __toESM(require_element(), 1); 1926 1927 // node_modules/@base-ui/utils/useControlled.mjs 1928 var React = __toESM(require_react(), 1); 1929 1930 // node_modules/@base-ui/utils/createLogOnce.mjs 1931 var loggedMessages; 1932 if (true) { 1933 loggedMessages = /* @__PURE__ */ new Set(); 1934 } 1935 function createLogOnce(severity, prefix) { 1936 return function logOnce(...messages) { 1937 if (true) { 1938 const message2 = messages.join(" "); 1939 const output = prefix ? `$prefix}: $message2}` : message2; 1940 const key = `$severity}:$output}`; 1941 if (!loggedMessages.has(key)) { 1942 loggedMessages.add(key); 1943 if (severity === "warn") { 1944 console.warn(output); 1945 } else { 1946 console.error(output); 1947 } 1948 } 1949 } 1950 }; 1951 } 1952 1953 // node_modules/@base-ui/utils/error.mjs 1954 var error = createLogOnce("error", "Base UI"); 1955 1956 // node_modules/@base-ui/utils/useControlled.mjs 1957 function useControlled({ 1958 controlled, 1959 default: defaultProp, 1960 name, 1961 state = "value" 1962 }) { 1963 const { 1964 current: isControlled 1965 } = React.useRef(controlled !== void 0); 1966 const [valueState, setValue] = React.useState(defaultProp); 1967 const value = isControlled && controlled !== void 0 ? controlled : valueState; 1968 if (true) { 1969 React.useEffect(() => { 1970 if (isControlled !== (controlled !== void 0)) { 1971 error([`A component is changing the $isControlled ? "" : "un"}controlled $state} state of $name} to be $isControlled ? "un" : ""}controlled.`, "Elements should not switch from uncontrolled to controlled (or vice versa).", `Decide between using a controlled or uncontrolled $name} element for the lifetime of the component.`, "The nature of the state is determined during the first render. It's considered controlled if the value is not `undefined`.", "More info: https://fb.me/react-controlled-components"].join("\n")); 1972 } 1973 }, [state, name, controlled]); 1974 const { 1975 current: defaultValue2 1976 } = React.useRef(defaultProp); 1977 React.useEffect(() => { 1978 if (!isControlled && serializeToDevModeString(defaultValue2) !== serializeToDevModeString(defaultProp)) { 1979 error([`A component is changing the default $state} state of an uncontrolled $name} after being initialized. To suppress this warning opt to use a controlled $name}.`].join("\n")); 1980 } 1981 }, [defaultProp]); 1982 } 1983 const setValueIfUncontrolled = React.useCallback((newValue) => { 1984 if (!isControlled) { 1985 setValue(newValue); 1986 } 1987 }, []); 1988 return [value, setValueIfUncontrolled]; 1989 } 1990 function serializeToDevModeString(input) { 1991 let nextId = 0; 1992 const seen = /* @__PURE__ */ new WeakMap(); 1993 try { 1994 const result = JSON.stringify(input, function replacer(key, value) { 1995 if (key === "_owner" && this != null && typeof this === "object" && "$$typeof" in this) { 1996 return void 0; 1997 } 1998 if (typeof value === "bigint") { 1999 return `__bigint__:$value}`; 2000 } 2001 if (value !== null && typeof value === "object") { 2002 const id = seen.get(value); 2003 if (id !== void 0) { 2004 return `__object__:$id}`; 2005 } 2006 seen.set(value, nextId); 2007 nextId += 1; 2008 } 2009 return value; 2010 }); 2011 return result ?? `__top__:$typeof input}`; 2012 } catch { 2013 return "__unserializable__"; 2014 } 2015 } 2016 2017 // node_modules/@base-ui/utils/safeReact.mjs 2018 var React2 = __toESM(require_react(), 1); 2019 var SafeReact = { 2020 ...React2 2021 }; 2022 2023 // node_modules/@base-ui/utils/useRefWithInit.mjs 2024 var React3 = __toESM(require_react(), 1); 2025 var UNINITIALIZED = {}; 2026 function useRefWithInit(init2, initArg) { 2027 const ref = React3.useRef(UNINITIALIZED); 2028 if (ref.current === UNINITIALIZED) { 2029 ref.current = init2(initArg); 2030 } 2031 return ref; 2032 } 2033 2034 // node_modules/@base-ui/utils/useStableCallback.mjs 2035 var useInsertionEffect = SafeReact.useInsertionEffect; 2036 var useSafeInsertionEffect = ( 2037 // React 17 doesn't have useInsertionEffect. 2038 useInsertionEffect && // Preact replaces useInsertionEffect with useLayoutEffect and fires too late. 2039 useInsertionEffect !== SafeReact.useLayoutEffect ? useInsertionEffect : (fn) => fn() 2040 ); 2041 function useStableCallback(callback) { 2042 const stable = useRefWithInit(createStableCallback).current; 2043 stable.next = callback; 2044 useSafeInsertionEffect(stable.effect); 2045 return stable.trampoline; 2046 } 2047 function createStableCallback() { 2048 const stable = { 2049 next: void 0, 2050 callback: assertNotCalled, 2051 trampoline: (...args) => stable.callback?.(...args), 2052 effect: () => { 2053 stable.callback = stable.next; 2054 } 2055 }; 2056 return stable; 2057 } 2058 function assertNotCalled() { 2059 if (true) { 2060 throw ( 2061 /* minify-error-disabled */ 2062 new Error("Base UI: Cannot call an event handler while rendering.") 2063 ); 2064 } 2065 } 2066 2067 // node_modules/@base-ui/utils/warn.mjs 2068 var warn = createLogOnce("warn", "Base UI"); 2069 2070 // node_modules/@base-ui/utils/empty.mjs 2071 function NOOP() { 2072 } 2073 var EMPTY_ARRAY = Object.freeze([]); 2074 var EMPTY_OBJECT = Object.freeze({}); 2075 2076 // node_modules/@base-ui/react/internals/composite/list/CompositeList.mjs 2077 var React6 = __toESM(require_react(), 1); 2078 2079 // node_modules/@base-ui/utils/useIsoLayoutEffect.mjs 2080 var React4 = __toESM(require_react(), 1); 2081 var noop2 = () => { 2082 }; 2083 var useIsoLayoutEffect = typeof document !== "undefined" ? React4.useLayoutEffect : noop2; 2084 2085 // node_modules/@base-ui/react/internals/composite/list/CompositeListContext.mjs 2086 var React5 = __toESM(require_react(), 1); 2087 var CompositeListContext = /* @__PURE__ */ React5.createContext({ 2088 register: () => { 2089 }, 2090 unregister: () => { 2091 }, 2092 subscribeMapChange: () => () => { 2093 }, 2094 nextIndexRef: { 2095 current: 0 2096 } 2097 }); 2098 if (true) CompositeListContext.displayName = "CompositeListContext"; 2099 function useCompositeListContext() { 2100 return React5.useContext(CompositeListContext); 2101 } 2102 2103 // node_modules/@base-ui/react/internals/composite/list/CompositeList.mjs 2104 var import_jsx_runtime35 = __toESM(require_jsx_runtime(), 1); 2105 function CompositeList(props) { 2106 const { 2107 children, 2108 elementsRef, 2109 labelsRef, 2110 onMapChange: onMapChangeProp 2111 } = props; 2112 const onMapChange = useStableCallback(onMapChangeProp); 2113 const [, setMapTick] = React6.useState(false); 2114 const listeners = useRefWithInit(createListeners).current; 2115 const map = useRefWithInit(createMap).current; 2116 const nextIndexRef = React6.useRef(0); 2117 const isDirtyRef = React6.useRef(true); 2118 const itemsRef = React6.useRef(null); 2119 const mutationObserverRef = React6.useRef(null); 2120 const scheduleMapUpdate = useStableCallback(() => { 2121 if (isDirtyRef.current) { 2122 return; 2123 } 2124 isDirtyRef.current = true; 2125 setMapTick((tick) => !tick); 2126 }); 2127 const register2 = useStableCallback((node, registration) => { 2128 map.set(node, registration); 2129 scheduleMapUpdate(); 2130 }); 2131 const unregister = useStableCallback((node) => { 2132 map.delete(node); 2133 scheduleMapUpdate(); 2134 }); 2135 const syncRefs = useStableCallback((items) => { 2136 const nextMap = /* @__PURE__ */ new Map(); 2137 elementsRef.current.length = 0; 2138 if (labelsRef) { 2139 labelsRef.current.length = 0; 2140 } 2141 items.forEach((item) => { 2142 nextMap.set(item.element, { 2143 ...item.registration.metadata ?? {}, 2144 index: item.index 2145 }); 2146 elementsRef.current[item.index] = item.element; 2147 if (labelsRef) { 2148 labelsRef.current[item.index] = item.registration.label !== void 0 ? item.registration.label : item.registration.textRef?.current?.textContent ?? item.element.textContent; 2149 } 2150 }); 2151 nextIndexRef.current = elementsRef.current.length; 2152 return nextMap; 2153 }); 2154 function observe(sortedNodes) { 2155 mutationObserverRef.current?.disconnect(); 2156 mutationObserverRef.current = null; 2157 if (typeof MutationObserver !== "function" || sortedNodes.length < 2) { 2158 return; 2159 } 2160 const mutationObserver = new MutationObserver((entries) => { 2161 if (!hasMovedNode(entries)) { 2162 return; 2163 } 2164 let previousConnectedNode = null; 2165 for (const node of sortedNodes) { 2166 if (!node.isConnected) { 2167 continue; 2168 } 2169 if (previousConnectedNode && sortByDocumentPosition(previousConnectedNode, node) > 0) { 2170 mutationObserver.disconnect(); 2171 scheduleMapUpdate(); 2172 return; 2173 } 2174 previousConnectedNode = node; 2175 } 2176 }); 2177 mutationObserverRef.current = mutationObserver; 2178 const roots = /* @__PURE__ */ new Set(); 2179 for (let i = 1; i < sortedNodes.length; i += 1) { 2180 const root = getCommonAncestor(sortedNodes[i - 1], sortedNodes[i]); 2181 if (root) { 2182 roots.add(root); 2183 } 2184 } 2185 roots.forEach((root) => mutationObserver.observe(root, { 2186 childList: true 2187 })); 2188 } 2189 const flush = useStableCallback(() => { 2190 const [items, automaticNodes] = getCompositeListSnapshot(map); 2191 const nextMap = syncRefs(items); 2192 const previousItems = itemsRef.current; 2193 const changed = !previousItems || previousItems.length !== items.length || items.some((item, index2) => { 2194 const previousItem = previousItems[index2]; 2195 return item.index !== previousItem.index || item.element !== previousItem.element || item.registration.index !== previousItem.registration.index || item.registration.metadata !== previousItem.registration.metadata; 2196 }); 2197 observe(automaticNodes); 2198 itemsRef.current = items; 2199 isDirtyRef.current = false; 2200 if (!changed) { 2201 return; 2202 } 2203 listeners.forEach((listener) => listener(nextMap)); 2204 onMapChange(nextMap); 2205 }); 2206 useIsoLayoutEffect(() => { 2207 if (!isDirtyRef.current && itemsRef.current) { 2208 syncRefs(itemsRef.current); 2209 } 2210 return () => { 2211 elementsRef.current = []; 2212 if (labelsRef) { 2213 labelsRef.current = []; 2214 } 2215 }; 2216 }, [elementsRef, labelsRef, syncRefs]); 2217 useIsoLayoutEffect(() => { 2218 if (isDirtyRef.current) { 2219 flush(); 2220 } 2221 }); 2222 useIsoLayoutEffect(() => { 2223 return () => { 2224 mutationObserverRef.current?.disconnect(); 2225 isDirtyRef.current = true; 2226 }; 2227 }, []); 2228 const subscribeMapChange = useStableCallback((fn) => { 2229 listeners.add(fn); 2230 return () => { 2231 listeners.delete(fn); 2232 }; 2233 }); 2234 const contextValue = React6.useMemo(() => ({ 2235 register: register2, 2236 unregister, 2237 subscribeMapChange, 2238 nextIndexRef 2239 }), [register2, unregister, subscribeMapChange, nextIndexRef]); 2240 return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(CompositeListContext.Provider, { 2241 value: contextValue, 2242 children 2243 }); 2244 } 2245 function createMap() { 2246 return /* @__PURE__ */ new Map(); 2247 } 2248 function createListeners() { 2249 return /* @__PURE__ */ new Set(); 2250 } 2251 function getCompositeListSnapshot(map) { 2252 const reservedIndices = /* @__PURE__ */ new Set(); 2253 const items = []; 2254 const automaticItems = []; 2255 map.forEach((registration, node) => { 2256 if (!node.isConnected) { 2257 return; 2258 } 2259 const index2 = registration.index; 2260 const item = { 2261 index: index2 ?? -1, 2262 element: node, 2263 registration 2264 }; 2265 if (index2 === null) { 2266 automaticItems.push(item); 2267 } else if (index2 >= 0) { 2268 reservedIndices.add(index2); 2269 items.push(item); 2270 } 2271 }); 2272 let nextAutomaticIndex = 0; 2273 automaticItems.sort((a, b) => sortByDocumentPosition(a.element, b.element)); 2274 automaticItems.forEach((item) => { 2275 while (reservedIndices.has(nextAutomaticIndex)) { 2276 nextAutomaticIndex += 1; 2277 } 2278 item.index = nextAutomaticIndex; 2279 items.push(item); 2280 nextAutomaticIndex += 1; 2281 }); 2282 if (reservedIndices.size > 0) { 2283 items.sort((a, b) => a.index - b.index); 2284 } 2285 return [items, automaticItems.map((item) => item.element)]; 2286 } 2287 function getCommonAncestor(firstNode, lastNode) { 2288 let ancestor = firstNode.parentElement; 2289 while (ancestor && !ancestor.contains(lastNode)) { 2290 ancestor = ancestor.parentElement; 2291 } 2292 return ancestor; 2293 } 2294 function hasMovedNode(entries) { 2295 for (const entry of entries) { 2296 for (let i = 0; i < entry.removedNodes.length; i += 1) { 2297 if (entry.removedNodes[i].isConnected) { 2298 return true; 2299 } 2300 } 2301 } 2302 return false; 2303 } 2304 function sortByDocumentPosition(a, b) { 2305 return a.compareDocumentPosition(b) & Node.DOCUMENT_POSITION_FOLLOWING ? -1 : 1; 2306 } 2307 2308 // node_modules/@base-ui/react/internals/useRenderElement.mjs 2309 var React9 = __toESM(require_react(), 1); 2310 2311 // node_modules/@base-ui/utils/useMergedRefs.mjs 2312 function useMergedRefs(a, b, c2, d) { 2313 const forkRef = useRefWithInit(createForkRef).current; 2314 if (didChange(forkRef, a, b, c2, d)) { 2315 update(forkRef, [a, b, c2, d]); 2316 } 2317 return forkRef.callback; 2318 } 2319 function useMergedRefsN(refs) { 2320 const forkRef = useRefWithInit(createForkRef).current; 2321 if (didChangeN(forkRef, refs)) { 2322 update(forkRef, refs); 2323 } 2324 return forkRef.callback; 2325 } 2326 function createForkRef() { 2327 return { 2328 callback: null, 2329 cleanup: null, 2330 refs: [] 2331 }; 2332 } 2333 function didChange(forkRef, a, b, c2, d) { 2334 return forkRef.refs[0] !== a || forkRef.refs[1] !== b || forkRef.refs[2] !== c2 || forkRef.refs[3] !== d; 2335 } 2336 function didChangeN(forkRef, newRefs) { 2337 return forkRef.refs.length !== newRefs.length || forkRef.refs.some((ref, index2) => ref !== newRefs[index2]); 2338 } 2339 function update(forkRef, refs) { 2340 forkRef.refs = refs; 2341 if (refs.every((ref) => ref == null)) { 2342 forkRef.callback = null; 2343 return; 2344 } 2345 forkRef.callback = (instance) => { 2346 if (forkRef.cleanup) { 2347 forkRef.cleanup(); 2348 forkRef.cleanup = null; 2349 } 2350 if (instance != null) { 2351 const cleanupCallbacks = Array(refs.length).fill(null); 2352 for (let i = 0; i < refs.length; i += 1) { 2353 const ref = refs[i]; 2354 if (ref == null) { 2355 continue; 2356 } 2357 switch (typeof ref) { 2358 case "function": { 2359 const refCleanup = ref(instance); 2360 if (typeof refCleanup === "function") { 2361 cleanupCallbacks[i] = refCleanup; 2362 } 2363 break; 2364 } 2365 case "object": { 2366 ref.current = instance; 2367 break; 2368 } 2369 default: 2370 } 2371 } 2372 forkRef.cleanup = () => { 2373 for (let i = 0; i < refs.length; i += 1) { 2374 const ref = refs[i]; 2375 if (ref == null) { 2376 continue; 2377 } 2378 switch (typeof ref) { 2379 case "function": { 2380 const cleanupCallback = cleanupCallbacks[i]; 2381 if (typeof cleanupCallback === "function") { 2382 cleanupCallback(); 2383 } else { 2384 void ref(null); 2385 } 2386 break; 2387 } 2388 case "object": { 2389 ref.current = null; 2390 break; 2391 } 2392 default: 2393 } 2394 } 2395 }; 2396 } 2397 }; 2398 } 2399 2400 // node_modules/@base-ui/utils/getReactElementRef.mjs 2401 var React8 = __toESM(require_react(), 1); 2402 2403 // node_modules/@base-ui/utils/reactVersion.mjs 2404 var React7 = __toESM(require_react(), 1); 2405 var majorVersion = parseInt(React7.version, 10); 2406 function isReactVersionAtLeast(reactVersionToCheck) { 2407 return majorVersion >= reactVersionToCheck; 2408 } 2409 2410 // node_modules/@base-ui/utils/getReactElementRef.mjs 2411 function getReactElementRef(element) { 2412 if (!/* @__PURE__ */ React8.isValidElement(element)) { 2413 return null; 2414 } 2415 const reactElement = element; 2416 const propsWithRef = reactElement.props; 2417 return (isReactVersionAtLeast(19) ? propsWithRef?.ref : reactElement.ref) ?? null; 2418 } 2419 2420 // node_modules/@base-ui/utils/mergeObjects.mjs 2421 function mergeObjects(a, b) { 2422 if (a && !b) { 2423 return a; 2424 } 2425 if (!a && b) { 2426 return b; 2427 } 2428 if (a || b) { 2429 return { 2430 ...a, 2431 ...b 2432 }; 2433 } 2434 return void 0; 2435 } 2436 2437 // node_modules/@base-ui/react/internals/getStateAttributesProps.mjs 2438 function getStateAttributesProps(state, customMapping) { 2439 const props = {}; 2440 for (const key in state) { 2441 const value = state[key]; 2442 if (customMapping?.hasOwnProperty(key)) { 2443 const customProps = customMapping[key](value); 2444 if (customProps != null) { 2445 Object.assign(props, customProps); 2446 } 2447 continue; 2448 } 2449 if (value === true) { 2450 props[`data-$key.toLowerCase()}`] = ""; 2451 } else if (value) { 2452 props[`data-$key.toLowerCase()}`] = value.toString(); 2453 } 2454 } 2455 return props; 2456 } 2457 2458 // node_modules/@base-ui/react/utils/resolveClassName.mjs 2459 function resolveClassName(className, state) { 2460 return typeof className === "function" ? className(state) : className; 2461 } 2462 2463 // node_modules/@base-ui/react/utils/resolveStyle.mjs 2464 function resolveStyle(style, state) { 2465 return typeof style === "function" ? style(state) : style; 2466 } 2467 2468 // node_modules/@base-ui/react/merge-props/mergeProps.mjs 2469 var EMPTY_PROPS = {}; 2470 function mergeProps(a, b, c2, d, e) { 2471 if (!c2 && !d && !e && !a) { 2472 return createInitialMergedProps(b); 2473 } 2474 let merged = createInitialMergedProps(a); 2475 if (b) { 2476 merged = mergeInto(merged, b); 2477 } 2478 if (c2) { 2479 merged = mergeInto(merged, c2); 2480 } 2481 if (d) { 2482 merged = mergeInto(merged, d); 2483 } 2484 if (e) { 2485 merged = mergeInto(merged, e); 2486 } 2487 return merged; 2488 } 2489 function mergePropsN(props) { 2490 if (props.length === 0) { 2491 return EMPTY_PROPS; 2492 } 2493 if (props.length === 1) { 2494 return createInitialMergedProps(props[0]); 2495 } 2496 let merged = createInitialMergedProps(props[0]); 2497 for (let i = 1; i < props.length; i += 1) { 2498 merged = mergeInto(merged, props[i]); 2499 } 2500 return merged; 2501 } 2502 function createInitialMergedProps(inputProps) { 2503 if (isPropsGetter(inputProps)) { 2504 return { 2505 ...resolvePropsGetter(inputProps, EMPTY_PROPS) 2506 }; 2507 } 2508 return copyInitialProps(inputProps); 2509 } 2510 function mergeInto(merged, inputProps) { 2511 if (isPropsGetter(inputProps)) { 2512 return resolvePropsGetter(inputProps, merged); 2513 } 2514 return mutablyMergeInto(merged, inputProps); 2515 } 2516 function copyInitialProps(inputProps) { 2517 const copiedProps = { 2518 ...inputProps 2519 }; 2520 for (const propName in copiedProps) { 2521 const propValue = copiedProps[propName]; 2522 if (isEventHandler(propName, propValue)) { 2523 copiedProps[propName] = wrapEventHandler(propValue); 2524 } 2525 } 2526 return copiedProps; 2527 } 2528 function mutablyMergeInto(mergedProps, externalProps) { 2529 if (!externalProps) { 2530 return mergedProps; 2531 } 2532 for (const propName in externalProps) { 2533 const externalPropValue = externalProps[propName]; 2534 switch (propName) { 2535 case "style": { 2536 mergedProps[propName] = mergeObjects(mergedProps.style, externalPropValue); 2537 break; 2538 } 2539 case "className": { 2540 mergedProps[propName] = mergeClassNames(mergedProps.className, externalPropValue); 2541 break; 2542 } 2543 default: { 2544 if (isEventHandler(propName, externalPropValue)) { 2545 mergedProps[propName] = mergeEventHandlers(mergedProps[propName], externalPropValue); 2546 } else { 2547 mergedProps[propName] = externalPropValue; 2548 } 2549 } 2550 } 2551 } 2552 return mergedProps; 2553 } 2554 function isEventHandler(key, value) { 2555 const code0 = key.charCodeAt(0); 2556 const code1 = key.charCodeAt(1); 2557 const code2 = key.charCodeAt(2); 2558 return code0 === 111 && code1 === 110 && code2 >= 65 && code2 <= 90 && (typeof value === "function" || typeof value === "undefined"); 2559 } 2560 function isPropsGetter(inputProps) { 2561 return typeof inputProps === "function"; 2562 } 2563 function resolvePropsGetter(inputProps, previousProps) { 2564 if (isPropsGetter(inputProps)) { 2565 return inputProps(previousProps); 2566 } 2567 return inputProps ?? EMPTY_PROPS; 2568 } 2569 function mergeEventHandlers(ourHandler, theirHandler) { 2570 if (!theirHandler) { 2571 return ourHandler; 2572 } 2573 if (!ourHandler) { 2574 return wrapEventHandler(theirHandler); 2575 } 2576 return (...args) => { 2577 const event = args[0]; 2578 if (isSyntheticEvent(event)) { 2579 const baseUIEvent = event; 2580 makeEventPreventable(baseUIEvent); 2581 const result2 = theirHandler(...args); 2582 if (!baseUIEvent.baseUIHandlerPrevented) { 2583 ourHandler?.(...args); 2584 } 2585 return result2; 2586 } 2587 const result = theirHandler(...args); 2588 ourHandler?.(...args); 2589 return result; 2590 }; 2591 } 2592 function wrapEventHandler(handler) { 2593 if (!handler) { 2594 return handler; 2595 } 2596 return (...args) => { 2597 const event = args[0]; 2598 if (isSyntheticEvent(event)) { 2599 makeEventPreventable(event); 2600 } 2601 return handler(...args); 2602 }; 2603 } 2604 function makeEventPreventable(event) { 2605 event.preventBaseUIHandler = () => { 2606 event.baseUIHandlerPrevented = true; 2607 }; 2608 return event; 2609 } 2610 function mergeClassNames(ourClassName, theirClassName) { 2611 if (theirClassName) { 2612 if (ourClassName) { 2613 return theirClassName + " " + ourClassName; 2614 } 2615 return theirClassName; 2616 } 2617 return ourClassName; 2618 } 2619 function isSyntheticEvent(event) { 2620 return event != null && typeof event === "object" && "nativeEvent" in event; 2621 } 2622 2623 // node_modules/@base-ui/react/internals/useRenderElement.mjs 2624 var import_react = __toESM(require_react(), 1); 2625 function useRenderElement(element, componentProps, params = {}) { 2626 let renderProp = componentProps.render; 2627 if (params.enabled !== false) { 2628 renderProp = unwrapLazyRenderProp(renderProp); 2629 } 2630 const outProps = useRenderElementProps(componentProps, params, renderProp); 2631 if (params.enabled === false) { 2632 return null; 2633 } 2634 const state = params.state ?? EMPTY_OBJECT; 2635 return evaluateRenderProp(element, renderProp, outProps, state); 2636 } 2637 function useRenderElementProps(componentProps, params, renderProp) { 2638 const { 2639 className: classNameProp, 2640 style: styleProp 2641 } = componentProps; 2642 const { 2643 state = EMPTY_OBJECT, 2644 ref, 2645 props, 2646 stateAttributesMapping: stateAttributesMapping2, 2647 enabled = true 2648 } = params; 2649 const className = enabled ? resolveClassName(classNameProp, state) : void 0; 2650 const style = enabled ? resolveStyle(styleProp, state) : void 0; 2651 const stateProps = enabled ? getStateAttributesProps(state, stateAttributesMapping2) : EMPTY_OBJECT; 2652 const resolvedProps = enabled && props ? resolveRenderFunctionProps(props) : void 0; 2653 const outProps = enabled ? mergeObjects(stateProps, resolvedProps) ?? {} : EMPTY_OBJECT; 2654 if (typeof document !== "undefined") { 2655 if (!enabled) { 2656 void useMergedRefs(null, null); 2657 } else if (Array.isArray(ref)) { 2658 outProps.ref = useMergedRefsN([outProps.ref, getReactElementRef(renderProp), ...ref]); 2659 } else { 2660 outProps.ref = useMergedRefs(outProps.ref, getReactElementRef(renderProp), ref); 2661 } 2662 } 2663 if (!enabled) { 2664 return EMPTY_OBJECT; 2665 } 2666 if (className !== void 0) { 2667 outProps.className = mergeClassNames(outProps.className, className); 2668 } 2669 if (style !== void 0) { 2670 outProps.style = mergeObjects(outProps.style, style); 2671 } 2672 return outProps; 2673 } 2674 function resolveRenderFunctionProps(props) { 2675 if (Array.isArray(props)) { 2676 return mergePropsN(props); 2677 } 2678 return mergeProps(void 0, props); 2679 } 2680 var REACT_LAZY_TYPE = /* @__PURE__ */ Symbol.for("react.lazy"); 2681 var COMPONENT_IDENTIFIER_PATTERN = /^[A-Z][A-Za-z0-9$]*$/; 2682 var LOWERCASE_CHARACTER_PATTERN = /[a-z]/; 2683 function unwrapLazyRenderProp(render4) { 2684 if (render4?.$$typeof !== REACT_LAZY_TYPE) { 2685 return render4; 2686 } 2687 const unwrapped = React9.Children.toArray(render4)[0]; 2688 return /* @__PURE__ */ React9.isValidElement(unwrapped) ? unwrapped : render4; 2689 } 2690 function evaluateRenderProp(element, render4, props, state) { 2691 if (render4) { 2692 if (typeof render4 === "function") { 2693 if (true) { 2694 warnIfRenderPropLooksLikeComponent(render4); 2695 } 2696 return render4(props, state); 2697 } 2698 const mergedProps = mergeProps(props, render4.props); 2699 mergedProps.ref = props.ref; 2700 if (true) { 2701 if (!/* @__PURE__ */ React9.isValidElement(render4)) { 2702 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")); 2703 } 2704 } 2705 return /* @__PURE__ */ React9.cloneElement(render4, mergedProps); 2706 } 2707 if (element) { 2708 if (typeof element === "string") { 2709 return renderTag(element, props); 2710 } 2711 } 2712 throw new Error(true ? "Base UI: Render element or function are not defined." : formatErrorMessage_default(8)); 2713 } 2714 function warnIfRenderPropLooksLikeComponent(renderFn) { 2715 const functionName = renderFn.name; 2716 if (functionName.length === 0) { 2717 return; 2718 } 2719 if (!COMPONENT_IDENTIFIER_PATTERN.test(functionName)) { 2720 return; 2721 } 2722 if (!LOWERCASE_CHARACTER_PATTERN.test(functionName)) { 2723 return; 2724 } 2725 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"); 2726 } 2727 function renderTag(Tag, props) { 2728 if (Tag === "button") { 2729 return /* @__PURE__ */ (0, import_react.createElement)("button", { 2730 type: "button", 2731 ...props, 2732 key: props.key 2733 }); 2734 } 2735 if (Tag === "img") { 2736 return /* @__PURE__ */ (0, import_react.createElement)("img", { 2737 alt: "", 2738 ...props, 2739 key: props.key 2740 }); 2741 } 2742 return /* @__PURE__ */ React9.createElement(Tag, props); 2743 } 2744 2745 // node_modules/@base-ui/utils/useId.mjs 2746 var React10 = __toESM(require_react(), 1); 2747 var globalId = 0; 2748 function useGlobalId(idOverride, prefix = "mui") { 2749 const [defaultId, setDefaultId] = React10.useState(idOverride); 2750 const id = idOverride || defaultId; 2751 React10.useEffect(() => { 2752 if (defaultId == null) { 2753 globalId += 1; 2754 setDefaultId(`$prefix}-$globalId}`); 2755 } 2756 }, [defaultId, prefix]); 2757 return id; 2758 } 2759 var maybeReactUseId = SafeReact.useId; 2760 function useId(idOverride, prefix) { 2761 if (maybeReactUseId !== void 0) { 2762 const reactId = maybeReactUseId(); 2763 return idOverride ?? (prefix ? `$prefix}-$reactId}` : reactId); 2764 } 2765 return useGlobalId(idOverride, prefix); 2766 } 2767 2768 // node_modules/@base-ui/react/internals/useBaseUiId.mjs 2769 function useBaseUiId(idOverride) { 2770 return useId(idOverride, "base-ui"); 2771 } 2772 2773 // node_modules/@base-ui/react/internals/reason-parts.mjs 2774 var reason_parts_exports = {}; 2775 __export(reason_parts_exports, { 2776 cancelOpen: () => cancelOpen, 2777 chipRemovePress: () => chipRemovePress, 2778 clearPress: () => clearPress, 2779 closePress: () => closePress, 2780 closeWatcher: () => closeWatcher, 2781 decrementPress: () => decrementPress, 2782 disabled: () => disabled, 2783 drag: () => drag, 2784 escapeKey: () => escapeKey, 2785 focusOut: () => focusOut, 2786 imperativeAction: () => imperativeAction, 2787 incrementPress: () => incrementPress, 2788 initial: () => initial, 2789 inputBlur: () => inputBlur, 2790 inputChange: () => inputChange, 2791 inputClear: () => inputClear, 2792 inputPaste: () => inputPaste, 2793 inputPress: () => inputPress, 2794 itemPress: () => itemPress, 2795 keyboard: () => keyboard, 2796 linkPress: () => linkPress, 2797 listNavigation: () => listNavigation, 2798 missing: () => missing, 2799 none: () => none, 2800 outsidePress: () => outsidePress, 2801 pointer: () => pointer, 2802 scrub: () => scrub, 2803 siblingOpen: () => siblingOpen, 2804 swipe: () => swipe, 2805 trackPress: () => trackPress, 2806 triggerFocus: () => triggerFocus, 2807 triggerHover: () => triggerHover, 2808 triggerPress: () => triggerPress, 2809 wheel: () => wheel, 2810 windowResize: () => windowResize 2811 }); 2812 var none = "none"; 2813 var triggerPress = "trigger-press"; 2814 var triggerHover = "trigger-hover"; 2815 var triggerFocus = "trigger-focus"; 2816 var outsidePress = "outside-press"; 2817 var itemPress = "item-press"; 2818 var closePress = "close-press"; 2819 var linkPress = "link-press"; 2820 var clearPress = "clear-press"; 2821 var chipRemovePress = "chip-remove-press"; 2822 var trackPress = "track-press"; 2823 var incrementPress = "increment-press"; 2824 var decrementPress = "decrement-press"; 2825 var inputChange = "input-change"; 2826 var inputClear = "input-clear"; 2827 var inputBlur = "input-blur"; 2828 var inputPaste = "input-paste"; 2829 var inputPress = "input-press"; 2830 var focusOut = "focus-out"; 2831 var escapeKey = "escape-key"; 2832 var closeWatcher = "close-watcher"; 2833 var listNavigation = "list-navigation"; 2834 var keyboard = "keyboard"; 2835 var pointer = "pointer"; 2836 var drag = "drag"; 2837 var wheel = "wheel"; 2838 var scrub = "scrub"; 2839 var cancelOpen = "cancel-open"; 2840 var siblingOpen = "sibling-open"; 2841 var disabled = "disabled"; 2842 var missing = "missing"; 2843 var initial = "initial"; 2844 var imperativeAction = "imperative-action"; 2845 var swipe = "swipe"; 2846 var windowResize = "window-resize"; 2847 2848 // node_modules/@base-ui/react/internals/createBaseUIEventDetails.mjs 2849 function createChangeEventDetails(reason, event, trigger, customProperties) { 2850 let canceled = false; 2851 let allowPropagation = false; 2852 const custom = customProperties ?? EMPTY_OBJECT; 2853 const details = { 2854 reason, 2855 event: event ?? new Event("base-ui"), 2856 cancel() { 2857 canceled = true; 2858 }, 2859 allowPropagation() { 2860 allowPropagation = true; 2861 }, 2862 get isCanceled() { 2863 return canceled; 2864 }, 2865 get isPropagationAllowed() { 2866 return allowPropagation; 2867 }, 2868 trigger, 2869 ...custom 2870 }; 2871 return details; 2872 } 2873 2874 // node_modules/@base-ui/react/internals/useTransitionStatus.mjs 2875 var React12 = __toESM(require_react(), 1); 2876 2877 // node_modules/@base-ui/utils/useOnMount.mjs 2878 var React11 = __toESM(require_react(), 1); 2879 function useOnMount(fn) { 2880 React11.useEffect(fn, EMPTY_ARRAY); 2881 } 2882 2883 // node_modules/@base-ui/utils/useAnimationFrame.mjs 2884 var EMPTY = null; 2885 var LAST_RAF = globalThis.requestAnimationFrame; 2886 var Scheduler = class { 2887 /* This implementation uses an array as a backing data-structure for frame callbacks. 2888 * It allows `O(1)` callback cancelling by inserting a `null` in the array, though it 2889 * never calls the native `cancelAnimationFrame` if there are no frames left. This can 2890 * be much more efficient if there is a call pattern that alterns as 2891 * "request-cancel-request-cancel-…". 2892 * But in the case of "request-request-…-cancel-cancel-…", it leaves the final animation 2893 * frame to run anyway. We turn that frame into a `O(1)` no-op via `callbacksCount`. */ 2894 callbacks = []; 2895 callbacksCount = 0; 2896 nextId = 1; 2897 startId = 1; 2898 isScheduled = false; 2899 tick = (timestamp) => { 2900 this.isScheduled = false; 2901 const currentCallbacks = this.callbacks; 2902 const currentCallbacksCount = this.callbacksCount; 2903 this.callbacks = []; 2904 this.callbacksCount = 0; 2905 this.startId = this.nextId; 2906 if (currentCallbacksCount > 0) { 2907 for (let i = 0; i < currentCallbacks.length; i += 1) { 2908 currentCallbacks[i]?.(timestamp); 2909 } 2910 } 2911 }; 2912 request(fn) { 2913 const id = this.nextId; 2914 this.nextId += 1; 2915 this.callbacks.push(fn); 2916 this.callbacksCount += 1; 2917 const didRAFChange = LAST_RAF !== requestAnimationFrame && (LAST_RAF = requestAnimationFrame, true); 2918 if (!this.isScheduled || didRAFChange) { 2919 requestAnimationFrame(this.tick); 2920 this.isScheduled = true; 2921 } 2922 return id; 2923 } 2924 cancel(id) { 2925 const index2 = id - this.startId; 2926 if (index2 < 0 || index2 >= this.callbacks.length) { 2927 return; 2928 } 2929 if (this.callbacks[index2] === null) { 2930 return; 2931 } 2932 this.callbacks[index2] = null; 2933 this.callbacksCount -= 1; 2934 } 2935 }; 2936 var scheduler = new Scheduler(); 2937 var AnimationFrame = class _AnimationFrame { 2938 static create() { 2939 return new _AnimationFrame(); 2940 } 2941 static request(fn) { 2942 return scheduler.request(fn); 2943 } 2944 static cancel(id) { 2945 return scheduler.cancel(id); 2946 } 2947 currentId = EMPTY; 2948 /** 2949 * Executes `fn` after `delay`, clearing any previously scheduled call. 2950 */ 2951 request(fn) { 2952 this.cancel(); 2953 this.currentId = scheduler.request(() => { 2954 this.currentId = EMPTY; 2955 fn(); 2956 }); 2957 } 2958 cancel = () => { 2959 if (this.currentId !== EMPTY) { 2960 scheduler.cancel(this.currentId); 2961 this.currentId = EMPTY; 2962 } 2963 }; 2964 disposeEffect = () => { 2965 return this.cancel; 2966 }; 2967 }; 2968 function useAnimationFrame() { 2969 const timeout = useRefWithInit(AnimationFrame.create).current; 2970 useOnMount(timeout.disposeEffect); 2971 return timeout; 2972 } 2973 2974 // node_modules/@base-ui/react/internals/useTransitionStatus.mjs 2975 function useTransitionStatus(open2, enableIdleState = false, deferEndingState = false, animateInitialOpen = false) { 2976 const [transitionStatus, setTransitionStatus] = React12.useState(open2 && enableIdleState ? "idle" : void 0); 2977 const [mounted, setMounted] = React12.useState(open2 && !animateInitialOpen); 2978 if (open2 && !mounted) { 2979 setMounted(true); 2980 setTransitionStatus("starting"); 2981 } 2982 if (!open2 && mounted && transitionStatus !== "ending" && !deferEndingState) { 2983 setTransitionStatus("ending"); 2984 } 2985 if (!open2 && !mounted && transitionStatus === "ending") { 2986 setTransitionStatus(void 0); 2987 } 2988 useIsoLayoutEffect(() => { 2989 if (!open2 && mounted && transitionStatus !== "ending" && deferEndingState) { 2990 const frame = AnimationFrame.request(() => { 2991 setTransitionStatus("ending"); 2992 }); 2993 return () => { 2994 AnimationFrame.cancel(frame); 2995 }; 2996 } 2997 return void 0; 2998 }, [open2, mounted, transitionStatus, deferEndingState]); 2999 useIsoLayoutEffect(() => { 3000 if (!open2 || enableIdleState) { 3001 return void 0; 3002 } 3003 const frame = AnimationFrame.request(() => { 3004 setTransitionStatus(void 0); 3005 }); 3006 return () => { 3007 AnimationFrame.cancel(frame); 3008 }; 3009 }, [enableIdleState, open2]); 3010 useIsoLayoutEffect(() => { 3011 if (!open2 || !enableIdleState) { 3012 return void 0; 3013 } 3014 if (open2 && mounted && transitionStatus !== "idle") { 3015 setTransitionStatus("starting"); 3016 } 3017 const frame = AnimationFrame.request(() => { 3018 setTransitionStatus("idle"); 3019 }); 3020 return () => { 3021 AnimationFrame.cancel(frame); 3022 }; 3023 }, [enableIdleState, open2, mounted, transitionStatus]); 3024 return { 3025 mounted, 3026 setMounted, 3027 transitionStatus 3028 }; 3029 } 3030 3031 // node_modules/@base-ui/react/internals/composite/list/useCompositeListItem.mjs 3032 var React13 = __toESM(require_react(), 1); 3033 function useCompositeListItem(params = {}) { 3034 const { 3035 guess, 3036 label, 3037 metadata, 3038 textRef, 3039 index: externalIndex 3040 } = params; 3041 const { 3042 register: register2, 3043 unregister, 3044 subscribeMapChange, 3045 nextIndexRef 3046 } = useCompositeListContext(); 3047 const indexRef = React13.useRef(-1); 3048 const [internalIndex, setInternalIndex] = React13.useState(externalIndex == null && guess ? () => { 3049 if (indexRef.current === -1) { 3050 const newIndex = nextIndexRef.current; 3051 nextIndexRef.current += 1; 3052 indexRef.current = newIndex; 3053 } 3054 return indexRef.current; 3055 } : -1); 3056 const index2 = externalIndex ?? internalIndex; 3057 const componentRef = React13.useRef(null); 3058 const ref = React13.useCallback((node) => { 3059 const previousNode = componentRef.current; 3060 if (previousNode) { 3061 unregister(previousNode); 3062 } 3063 componentRef.current = node; 3064 if (node) { 3065 register2(node, { 3066 metadata: metadata ?? null, 3067 index: externalIndex ?? null, 3068 label, 3069 textRef 3070 }); 3071 } 3072 }, [externalIndex, register2, unregister, metadata, label, textRef]); 3073 useIsoLayoutEffect(() => { 3074 if (externalIndex != null) { 3075 return void 0; 3076 } 3077 return subscribeMapChange((map) => { 3078 const i = componentRef.current ? map.get(componentRef.current)?.index : null; 3079 if (i != null) { 3080 setInternalIndex(i); 3081 } 3082 }); 3083 }, [externalIndex, subscribeMapChange]); 3084 return { 3085 ref, 3086 index: index2 3087 }; 3088 } 3089 3090 // node_modules/@base-ui/react/internals/TransitionStatusDataAttributes.mjs 3091 var startingStyle = "data-starting-style"; 3092 var endingStyle = "data-ending-style"; 3093 3094 // node_modules/@base-ui/react/internals/stateAttributesMapping.mjs 3095 var STARTING_HOOK = { 3096 [startingStyle]: "" 3097 }; 3098 var ENDING_HOOK = { 3099 [endingStyle]: "" 3100 }; 3101 var transitionStatusMapping = { 3102 transitionStatus(value) { 3103 if (value === "starting") { 3104 return STARTING_HOOK; 3105 } 3106 if (value === "ending") { 3107 return ENDING_HOOK; 3108 } 3109 return null; 3110 } 3111 }; 3112 3113 // node_modules/@base-ui/react/internals/use-button/useButton.mjs 3114 var React16 = __toESM(require_react(), 1); 3115 3116 // node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.mjs 3117 function hasWindow() { 3118 return typeof window !== "undefined"; 3119 } 3120 function getNodeName(node) { 3121 if (isNode(node)) { 3122 return (node.nodeName || "").toLowerCase(); 3123 } 3124 return "#document"; 3125 } 3126 function getWindow(node) { 3127 var _node$ownerDocument; 3128 return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window; 3129 } 3130 function getDocumentElement(node) { 3131 var _ref; 3132 return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement; 3133 } 3134 function isNode(value) { 3135 if (!hasWindow()) { 3136 return false; 3137 } 3138 return value instanceof Node || value instanceof getWindow(value).Node; 3139 } 3140 function isElement(value) { 3141 if (!hasWindow()) { 3142 return false; 3143 } 3144 return value instanceof Element || value instanceof getWindow(value).Element; 3145 } 3146 function isHTMLElement(value) { 3147 if (!hasWindow()) { 3148 return false; 3149 } 3150 return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement; 3151 } 3152 function isShadowRoot(value) { 3153 if (!hasWindow() || typeof ShadowRoot === "undefined") { 3154 return false; 3155 } 3156 return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot; 3157 } 3158 function isOverflowElement(element) { 3159 const { 3160 overflow, 3161 overflowX, 3162 overflowY, 3163 display 3164 } = getComputedStyle2(element); 3165 return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && display !== "inline" && display !== "contents"; 3166 } 3167 function isTableElement(element) { 3168 return /^(table|td|th)$/.test(getNodeName(element)); 3169 } 3170 function isTopLayer(element) { 3171 try { 3172 if (element.matches(":popover-open")) { 3173 return true; 3174 } 3175 } catch (_e) { 3176 } 3177 try { 3178 return element.matches(":modal"); 3179 } catch (_e) { 3180 return false; 3181 } 3182 } 3183 var willChangeRe = /transform|translate|scale|rotate|perspective|filter/; 3184 var containRe = /paint|layout|strict|content/; 3185 var isNotNone = (value) => !!value && value !== "none"; 3186 var isWebKitValue; 3187 function isContainingBlock(elementOrCss) { 3188 const css = isElement(elementOrCss) ? getComputedStyle2(elementOrCss) : elementOrCss; 3189 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 || ""); 3190 } 3191 function getContainingBlock(element) { 3192 let currentNode = getParentNode(element); 3193 while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) { 3194 if (isContainingBlock(currentNode)) { 3195 return currentNode; 3196 } else if (isTopLayer(currentNode)) { 3197 return null; 3198 } 3199 currentNode = getParentNode(currentNode); 3200 } 3201 return null; 3202 } 3203 function isWebKit() { 3204 if (isWebKitValue == null) { 3205 isWebKitValue = typeof CSS !== "undefined" && CSS.supports && CSS.supports("-webkit-backdrop-filter", "none"); 3206 } 3207 return isWebKitValue; 3208 } 3209 function isLastTraversableNode(node) { 3210 return /^(html|body|#document)$/.test(getNodeName(node)); 3211 } 3212 function getComputedStyle2(element) { 3213 return getWindow(element).getComputedStyle(element); 3214 } 3215 function getNodeScroll(element) { 3216 if (isElement(element)) { 3217 return { 3218 scrollLeft: element.scrollLeft, 3219 scrollTop: element.scrollTop 3220 }; 3221 } 3222 return { 3223 scrollLeft: element.scrollX, 3224 scrollTop: element.scrollY 3225 }; 3226 } 3227 function getParentNode(node) { 3228 if (getNodeName(node) === "html") { 3229 return node; 3230 } 3231 const result = ( 3232 // Step into the shadow DOM of the parent of a slotted node. 3233 node.assignedSlot || // DOM Element detected. 3234 node.parentNode || // ShadowRoot detected. 3235 isShadowRoot(node) && node.host || // Fallback. 3236 getDocumentElement(node) 3237 ); 3238 return isShadowRoot(result) ? result.host : result; 3239 } 3240 function getNearestOverflowAncestor(node) { 3241 const parentNode = getParentNode(node); 3242 if (isLastTraversableNode(parentNode)) { 3243 return (node.ownerDocument || node).body; 3244 } 3245 if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) { 3246 return parentNode; 3247 } 3248 return getNearestOverflowAncestor(parentNode); 3249 } 3250 function getOverflowAncestors(node, list, traverseIframes) { 3251 var _node$ownerDocument2; 3252 if (list === void 0) { 3253 list = []; 3254 } 3255 if (traverseIframes === void 0) { 3256 traverseIframes = true; 3257 } 3258 const scrollableAncestor = getNearestOverflowAncestor(node); 3259 const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body); 3260 const win = getWindow(scrollableAncestor); 3261 if (isBody) { 3262 const frameElement = getFrameElement(win); 3263 return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], frameElement && traverseIframes ? getOverflowAncestors(frameElement) : []); 3264 } else { 3265 return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes)); 3266 } 3267 } 3268 function getFrameElement(win) { 3269 return win.parent && Object.getPrototypeOf(win.parent) ? win.frameElement : null; 3270 } 3271 3272 // node_modules/@base-ui/react/internals/composite/root/CompositeRootContext.mjs 3273 var React14 = __toESM(require_react(), 1); 3274 var CompositeRootContext = /* @__PURE__ */ React14.createContext(void 0); 3275 if (true) CompositeRootContext.displayName = "CompositeRootContext"; 3276 function useCompositeRootContext(optional = false) { 3277 const context = React14.useContext(CompositeRootContext); 3278 if (context === void 0 && !optional) { 3279 throw new Error(true ? "Base UI: CompositeRootContext is missing. Composite parts must be placed within <Composite.Root>." : formatErrorMessage_default(16)); 3280 } 3281 return context; 3282 } 3283 3284 // node_modules/@base-ui/react/utils/useFocusableWhenDisabled.mjs 3285 var React15 = __toESM(require_react(), 1); 3286 function useFocusableWhenDisabled(parameters) { 3287 const { 3288 focusableWhenDisabled, 3289 disabled: disabled2, 3290 composite = false, 3291 tabIndex: tabIndexProp = 0, 3292 isNativeButton 3293 } = parameters; 3294 const isFocusableComposite = composite && focusableWhenDisabled !== false; 3295 const isNonFocusableComposite = composite && focusableWhenDisabled === false; 3296 const props = React15.useMemo(() => { 3297 const additionalProps = { 3298 // allow Tabbing away from focusableWhenDisabled elements 3299 onKeyDown(event) { 3300 if (disabled2 && focusableWhenDisabled && event.key !== "Tab") { 3301 event.preventDefault(); 3302 } 3303 } 3304 }; 3305 if (!composite) { 3306 additionalProps.tabIndex = tabIndexProp; 3307 if (!isNativeButton && disabled2) { 3308 additionalProps.tabIndex = focusableWhenDisabled ? tabIndexProp : -1; 3309 } 3310 } 3311 if (isNativeButton && (focusableWhenDisabled || isFocusableComposite) || !isNativeButton && disabled2) { 3312 additionalProps["aria-disabled"] = disabled2; 3313 } 3314 if (isNativeButton && (!focusableWhenDisabled || isNonFocusableComposite)) { 3315 additionalProps.disabled = disabled2; 3316 } 3317 return additionalProps; 3318 }, [composite, disabled2, focusableWhenDisabled, isFocusableComposite, isNonFocusableComposite, isNativeButton, tabIndexProp]); 3319 return { 3320 props 3321 }; 3322 } 3323 3324 // node_modules/@base-ui/utils/owner.mjs 3325 function ownerDocument(node) { 3326 return node?.ownerDocument || document; 3327 } 3328 3329 // node_modules/@base-ui/react/utils/dispatchClickWithModifiers.mjs 3330 function dispatchClickWithModifiers(target, sourceEvent, { 3331 detail = 0 3332 } = {}) { 3333 target.dispatchEvent(new (getWindow(target)).PointerEvent("click", { 3334 bubbles: true, 3335 cancelable: true, 3336 composed: true, 3337 detail, 3338 shiftKey: sourceEvent.shiftKey, 3339 ctrlKey: sourceEvent.ctrlKey, 3340 altKey: sourceEvent.altKey, 3341 metaKey: sourceEvent.metaKey 3342 })); 3343 } 3344 3345 // node_modules/@base-ui/react/internals/use-button/useButton.mjs 3346 function useButton(parameters = {}) { 3347 const { 3348 disabled: disabled2 = false, 3349 focusableWhenDisabled, 3350 tabIndex = 0, 3351 native: isNativeButton = true, 3352 composite: compositeProp 3353 } = parameters; 3354 const elementRef = React16.useRef(null); 3355 const compositeRootContext = useCompositeRootContext(true); 3356 const isCompositeItem = compositeProp ?? compositeRootContext !== void 0; 3357 const { 3358 props: focusableWhenDisabledProps 3359 } = useFocusableWhenDisabled({ 3360 focusableWhenDisabled, 3361 disabled: disabled2, 3362 composite: isCompositeItem, 3363 tabIndex, 3364 isNativeButton 3365 }); 3366 if (true) { 3367 React16.useEffect(() => { 3368 if (!elementRef.current) { 3369 return; 3370 } 3371 const isButtonTag = isButtonElement(elementRef.current); 3372 if (isNativeButton) { 3373 if (!isButtonTag) { 3374 const ownerStackMessage = SafeReact.captureOwnerStack?.() || ""; 3375 const message2 = "A component that acts as a button expected a native <button> because the `nativeButton` prop is true. Rendering a non-<button> removes native button semantics, which can impact forms and accessibility. Use a real <button> in the `render` prop, or set `nativeButton` to `false`."; 3376 error(`$message2}$ownerStackMessage}`); 3377 } 3378 } else if (isButtonTag) { 3379 const ownerStackMessage = SafeReact.captureOwnerStack?.() || ""; 3380 const message2 = "A component that acts as a button expected a non-<button> because the `nativeButton` prop is false. Rendering a <button> keeps native behavior while Base UI applies non-native attributes and handlers, which can add unintended extra attributes (such as `role` or `aria-disabled`). Use a non-<button> in the `render` prop, or set `nativeButton` to `true`."; 3381 error(`$message2}$ownerStackMessage}`); 3382 } 3383 }, [isNativeButton]); 3384 } 3385 const updateDisabled = React16.useCallback(() => { 3386 const element = elementRef.current; 3387 if (!isButtonElement(element)) { 3388 return; 3389 } 3390 if (isCompositeItem && disabled2 && focusableWhenDisabledProps.disabled === void 0 && element.disabled) { 3391 element.disabled = false; 3392 } 3393 }, [disabled2, focusableWhenDisabledProps.disabled, isCompositeItem]); 3394 useIsoLayoutEffect(updateDisabled, [updateDisabled]); 3395 const getButtonProps = React16.useCallback((externalProps = {}) => { 3396 const { 3397 onClick: externalOnClick, 3398 onMouseDown: externalOnMouseDown, 3399 onKeyUp: externalOnKeyUp, 3400 onKeyDown: externalOnKeyDown, 3401 onPointerDown: externalOnPointerDown, 3402 ...otherExternalProps 3403 } = externalProps; 3404 return mergeProps({ 3405 onClick(event) { 3406 if (disabled2) { 3407 event.preventDefault(); 3408 return; 3409 } 3410 externalOnClick?.(event); 3411 }, 3412 onMouseDown(event) { 3413 if (!disabled2) { 3414 externalOnMouseDown?.(event); 3415 } 3416 }, 3417 onKeyDown(event) { 3418 if (disabled2) { 3419 return; 3420 } 3421 makeEventPreventable(event); 3422 externalOnKeyDown?.(event); 3423 if (event.baseUIHandlerPrevented) { 3424 return; 3425 } 3426 const isCurrentTarget = event.target === event.currentTarget; 3427 const currentTarget = event.currentTarget; 3428 const isButton2 = isButtonElement(currentTarget); 3429 const isLink = !isNativeButton && isValidLinkElement(currentTarget); 3430 const shouldClick = isCurrentTarget && (isNativeButton ? isButton2 : !isLink); 3431 const isEnterKey = event.key === "Enter"; 3432 const isSpaceKey = event.key === " "; 3433 const role = currentTarget.getAttribute("role"); 3434 const isTextNavigationRole = role?.startsWith("menuitem") || role === "option" || role === "gridcell"; 3435 if (isCurrentTarget && isCompositeItem && isSpaceKey) { 3436 if (event.defaultPrevented && isTextNavigationRole) { 3437 return; 3438 } 3439 event.preventDefault(); 3440 if (!isNativeButton || isButton2) { 3441 event.preventBaseUIHandler(); 3442 dispatchClickWithModifiers(currentTarget, event); 3443 } 3444 return; 3445 } 3446 if (!shouldClick || isNativeButton || !isSpaceKey && !isEnterKey) { 3447 if (isCurrentTarget && isLink && isSpaceKey) { 3448 event.preventDefault(); 3449 } 3450 return; 3451 } 3452 if (event.defaultPrevented) { 3453 return; 3454 } 3455 event.preventDefault(); 3456 if (isEnterKey) { 3457 event.preventBaseUIHandler(); 3458 dispatchClickWithModifiers(currentTarget, event); 3459 } 3460 }, 3461 onKeyUp(event) { 3462 if (disabled2) { 3463 return; 3464 } 3465 makeEventPreventable(event); 3466 externalOnKeyUp?.(event); 3467 if (event.target === event.currentTarget && isNativeButton && isCompositeItem && isButtonElement(event.currentTarget) && event.key === " ") { 3468 event.preventDefault(); 3469 return; 3470 } 3471 if (event.baseUIHandlerPrevented) { 3472 return; 3473 } 3474 if (event.target === event.currentTarget && !isNativeButton && !isCompositeItem && !event.defaultPrevented && event.key === " ") { 3475 event.preventBaseUIHandler(); 3476 dispatchClickWithModifiers(event.currentTarget, event); 3477 } 3478 }, 3479 onPointerDown(event) { 3480 if (disabled2) { 3481 event.preventDefault(); 3482 return; 3483 } 3484 externalOnPointerDown?.(event); 3485 } 3486 }, isNativeButton ? { 3487 type: "button" 3488 } : { 3489 role: "button" 3490 }, focusableWhenDisabledProps, otherExternalProps); 3491 }, [disabled2, focusableWhenDisabledProps, isCompositeItem, isNativeButton]); 3492 const buttonRef = useStableCallback((element) => { 3493 elementRef.current = element; 3494 updateDisabled(); 3495 }); 3496 return { 3497 getButtonProps, 3498 buttonRef 3499 }; 3500 } 3501 function isButtonElement(elem) { 3502 return isHTMLElement(elem) && elem.tagName === "BUTTON"; 3503 } 3504 function isValidLinkElement(elem) { 3505 return isHTMLElement(elem) && elem.tagName === "A" && Boolean(elem.href); 3506 } 3507 3508 // node_modules/@base-ui/utils/addEventListener.mjs 3509 function addEventListener(target, type, listener, options) { 3510 target.addEventListener(type, listener, options); 3511 return () => { 3512 target.removeEventListener(type, listener, options); 3513 }; 3514 } 3515 3516 // node_modules/@base-ui/utils/useValueAsRef.mjs 3517 function useValueAsRef(value) { 3518 const latest = useRefWithInit(createLatestRef, value).current; 3519 latest.next = value; 3520 useIsoLayoutEffect(latest.effect); 3521 return latest; 3522 } 3523 function createLatestRef(value) { 3524 const latest = { 3525 current: value, 3526 next: value, 3527 effect: () => { 3528 latest.current = latest.next; 3529 } 3530 }; 3531 return latest; 3532 } 3533 3534 // node_modules/@base-ui/react/internals/useOpenChangeComplete.mjs 3535 var React17 = __toESM(require_react(), 1); 3536 3537 // node_modules/@base-ui/react/internals/useAnimationsFinished.mjs 3538 var ReactDOM = __toESM(require_react_dom(), 1); 3539 3540 // node_modules/@base-ui/react/utils/resolveRef.mjs 3541 function resolveRef(maybeRef) { 3542 if (maybeRef == null) { 3543 return maybeRef; 3544 } 3545 return "current" in maybeRef ? maybeRef.current : maybeRef; 3546 } 3547 3548 // node_modules/@base-ui/react/internals/useAnimationsFinished.mjs 3549 var pendingCallbacks = null; 3550 function flushBeforePaint(fn) { 3551 if (!pendingCallbacks) { 3552 const callbacks = []; 3553 pendingCallbacks = callbacks; 3554 queueMicrotask(() => { 3555 pendingCallbacks = null; 3556 ReactDOM.flushSync(() => { 3557 for (const callback of callbacks) { 3558 callback(); 3559 } 3560 }); 3561 }); 3562 } 3563 pendingCallbacks.push(fn); 3564 } 3565 function useAnimationsFinished(elementOrRef, waitForStartingStyleRemoved = false, batch2 = false) { 3566 const frame = useAnimationFrame(); 3567 return useStableCallback((fnToExecute, signal = null) => { 3568 frame.cancel(); 3569 const element = resolveRef(elementOrRef); 3570 if (element == null) { 3571 return; 3572 } 3573 const resolvedElement = element; 3574 const done = () => { 3575 if (!batch2) { 3576 ReactDOM.flushSync(fnToExecute); 3577 return; 3578 } 3579 flushBeforePaint(() => { 3580 if (!signal?.aborted) { 3581 fnToExecute(); 3582 } 3583 }); 3584 }; 3585 if (typeof resolvedElement.getAnimations !== "function" || globalThis.BASE_UI_ANIMATIONS_DISABLED) { 3586 fnToExecute(); 3587 return; 3588 } 3589 function exec() { 3590 Promise.all(resolvedElement.getAnimations().map((animation) => animation.finished)).then(() => { 3591 if (!signal?.aborted) { 3592 done(); 3593 } 3594 }, () => { 3595 if (signal?.aborted) { 3596 return; 3597 } 3598 const currentAnimations = resolvedElement.getAnimations(); 3599 if (currentAnimations.some((animation) => animation.pending || animation.playState !== "finished")) { 3600 exec(); 3601 return; 3602 } 3603 done(); 3604 }); 3605 } 3606 if (waitForStartingStyleRemoved) { 3607 const startingStyleAttribute = startingStyle; 3608 if (!resolvedElement.hasAttribute(startingStyleAttribute)) { 3609 frame.request(exec); 3610 return; 3611 } 3612 const attributeObserver = new MutationObserver(() => { 3613 if (!resolvedElement.hasAttribute(startingStyleAttribute)) { 3614 attributeObserver.disconnect(); 3615 exec(); 3616 } 3617 }); 3618 attributeObserver.observe(resolvedElement, { 3619 attributes: true, 3620 attributeFilter: [startingStyleAttribute] 3621 }); 3622 signal?.addEventListener("abort", () => attributeObserver.disconnect(), { 3623 once: true 3624 }); 3625 return; 3626 } 3627 frame.request(exec); 3628 }); 3629 } 3630 3631 // node_modules/@base-ui/react/internals/useOpenChangeComplete.mjs 3632 function useOpenChangeComplete(parameters) { 3633 const { 3634 enabled = true, 3635 open: open2, 3636 ref, 3637 batch: batch2 = false, 3638 onComplete: onCompleteParam 3639 } = parameters; 3640 const onComplete = useStableCallback(onCompleteParam); 3641 const runOnceAnimationsFinish = useAnimationsFinished(ref, open2, batch2); 3642 React17.useEffect(() => { 3643 if (!enabled) { 3644 return void 0; 3645 } 3646 const abortController = new AbortController(); 3647 runOnceAnimationsFinish(onComplete, abortController.signal); 3648 return () => { 3649 abortController.abort(); 3650 }; 3651 }, [enabled, open2, onComplete, runOnceAnimationsFinish]); 3652 } 3653 3654 // node_modules/@base-ui/utils/platform/parts.mjs 3655 var parts_exports = {}; 3656 __export(parts_exports, { 3657 engine: () => engine_exports, 3658 env: () => env_exports, 3659 mediaQuery: () => media_query_exports, 3660 os: () => os_exports, 3661 screenReader: () => screen_reader_exports 3662 }); 3663 3664 // node_modules/@base-ui/utils/platform/os.mjs 3665 var os_exports = {}; 3666 __export(os_exports, { 3667 android: () => android, 3668 apple: () => apple, 3669 ios: () => ios, 3670 linux: () => linux, 3671 mac: () => mac, 3672 windows: () => windows 3673 }); 3674 3675 // node_modules/@base-ui/utils/platform/shared.mjs 3676 function readRawData() { 3677 if (typeof navigator === "undefined") { 3678 return { 3679 userAgent: "", 3680 platform: "", 3681 maxTouchPoints: 0 3682 }; 3683 } 3684 if (true) { 3685 const uaData = navigator.userAgentData; 3686 if (uaData && Array.isArray(uaData.brands)) { 3687 return { 3688 userAgent: uaData.brands.map(({ 3689 brand, 3690 version: version2 3691 }) => `$brand}/$version2}`).join(" "), 3692 platform: uaData.platform ?? navigator.platform ?? "", 3693 maxTouchPoints: navigator.maxTouchPoints ?? 0 3694 }; 3695 } 3696 } 3697 return { 3698 userAgent: navigator.userAgent, 3699 platform: navigator.platform ?? "", 3700 maxTouchPoints: navigator.maxTouchPoints ?? 0 3701 }; 3702 } 3703 var { 3704 userAgent, 3705 platform, 3706 maxTouchPoints 3707 } = readRawData(); 3708 var lowerUserAgent = userAgent.toLowerCase(); 3709 var lowerPlatform = platform.toLowerCase(); 3710 3711 // node_modules/@base-ui/utils/platform/os.mjs 3712 var ios = /^i(os$|p)/.test(lowerPlatform) || lowerPlatform === "macintel" && maxTouchPoints > 1; 3713 var ANDROID_STRING = "android"; 3714 var android = lowerPlatform === ANDROID_STRING || lowerUserAgent.includes(ANDROID_STRING); 3715 var mac = !ios && lowerPlatform.startsWith("mac"); 3716 var windows = lowerPlatform.startsWith("win"); 3717 var linux = !android && /^(linux|chrome os)/.test(lowerPlatform); 3718 var apple = mac || ios; 3719 3720 // node_modules/@base-ui/utils/platform/engine.mjs 3721 var engine_exports = {}; 3722 __export(engine_exports, { 3723 blink: () => blink, 3724 gecko: () => gecko, 3725 webkit: () => webkit 3726 }); 3727 var webkit = typeof CSS !== "undefined" && !!CSS.supports?.("-webkit-backdrop-filter:none"); 3728 var gecko = !webkit && lowerUserAgent.includes("firefox"); 3729 var blink = !webkit && lowerUserAgent.includes("chrom"); 3730 3731 // node_modules/@base-ui/utils/platform/screen-reader.mjs 3732 var screen_reader_exports = {}; 3733 __export(screen_reader_exports, { 3734 voiceOver: () => voiceOver 3735 }); 3736 var voiceOver = apple; 3737 3738 // node_modules/@base-ui/utils/platform/env.mjs 3739 var env_exports = {}; 3740 __export(env_exports, { 3741 jsdom: () => jsdom 3742 }); 3743 var jsdom = /jsdom|happydom/.test(lowerUserAgent); 3744 3745 // node_modules/@base-ui/utils/platform/media-query.mjs 3746 var media_query_exports = {}; 3747 __export(media_query_exports, { 3748 iOS: () => iOS 3749 }); 3750 var iOS = "@supports (-webkit-touch-callout: none)"; 3751 3752 // node_modules/@base-ui/utils/useTimeout.mjs 3753 var EMPTY2 = 0; 3754 var Timeout = class _Timeout { 3755 static create() { 3756 return new _Timeout(); 3757 } 3758 currentId = EMPTY2; 3759 /** 3760 * Executes `fn` after `delay`, clearing any previously scheduled call. 3761 */ 3762 start(delay, fn) { 3763 this.clear(); 3764 this.currentId = setTimeout(() => { 3765 this.currentId = EMPTY2; 3766 fn(); 3767 }, delay); 3768 } 3769 isStarted() { 3770 return this.currentId !== EMPTY2; 3771 } 3772 clear = () => { 3773 if (this.currentId !== EMPTY2) { 3774 clearTimeout(this.currentId); 3775 this.currentId = EMPTY2; 3776 } 3777 }; 3778 disposeEffect = () => { 3779 return this.clear; 3780 }; 3781 }; 3782 function useTimeout() { 3783 const timeout = useRefWithInit(Timeout.create).current; 3784 useOnMount(timeout.disposeEffect); 3785 return timeout; 3786 } 3787 3788 // node_modules/@base-ui/utils/useScrollLock.mjs 3789 var originalHtmlStyles = {}; 3790 var originalBodyStyles = {}; 3791 var originalHtmlScrollBehavior = ""; 3792 function getViewportScroller(html, body) { 3793 return isOverflowElement(html) ? html : body; 3794 } 3795 function isPageScrollLocked(win, html, body) { 3796 return /hidden|clip/.test(win.getComputedStyle(getViewportScroller(html, body)).overflowY); 3797 } 3798 function hasInsetScrollbars(referenceElement) { 3799 if (typeof document === "undefined") { 3800 return false; 3801 } 3802 const doc = ownerDocument(referenceElement); 3803 const win = getWindow(doc); 3804 return win.innerWidth - doc.documentElement.clientWidth > 0; 3805 } 3806 function supportsStableScrollbarGutter(referenceElement) { 3807 const supported = typeof CSS !== "undefined" && CSS.supports && CSS.supports("scrollbar-gutter", "stable"); 3808 if (!supported || typeof document === "undefined") { 3809 return false; 3810 } 3811 const doc = ownerDocument(referenceElement); 3812 const html = doc.documentElement; 3813 const body = doc.body; 3814 const scrollContainer = getViewportScroller(html, body); 3815 const originalScrollContainerOverflowY = scrollContainer.style.overflowY; 3816 const originalHtmlStyleGutter = html.style.scrollbarGutter; 3817 html.style.scrollbarGutter = "stable"; 3818 scrollContainer.style.overflowY = "scroll"; 3819 const before = scrollContainer.offsetWidth; 3820 scrollContainer.style.overflowY = "hidden"; 3821 const after = scrollContainer.offsetWidth; 3822 scrollContainer.style.overflowY = originalScrollContainerOverflowY; 3823 html.style.scrollbarGutter = originalHtmlStyleGutter; 3824 return before === after; 3825 } 3826 function preventScrollOverlayScrollbars(referenceElement) { 3827 const doc = ownerDocument(referenceElement); 3828 const html = doc.documentElement; 3829 const body = doc.body; 3830 const elementToLock = getViewportScroller(html, body); 3831 const originalElementToLockStyles = { 3832 overflowY: elementToLock.style.overflowY, 3833 overflowX: elementToLock.style.overflowX 3834 }; 3835 Object.assign(elementToLock.style, { 3836 overflowY: "hidden", 3837 overflowX: "hidden" 3838 }); 3839 return () => { 3840 Object.assign(elementToLock.style, originalElementToLockStyles); 3841 }; 3842 } 3843 function preventScrollInsetScrollbars(referenceElement) { 3844 const doc = ownerDocument(referenceElement); 3845 const html = doc.documentElement; 3846 const body = doc.body; 3847 const win = getWindow(html); 3848 let scrollTop = 0; 3849 let scrollLeft = 0; 3850 let updateGutterOnly = false; 3851 const resizeFrame = AnimationFrame.create(); 3852 if (parts_exports.engine.webkit && (win.visualViewport?.scale ?? 1) !== 1) { 3853 return () => { 3854 }; 3855 } 3856 function lockScroll() { 3857 const htmlStyles = win.getComputedStyle(html); 3858 const bodyStyles = win.getComputedStyle(body); 3859 const htmlScrollbarGutterValue = htmlStyles.scrollbarGutter || ""; 3860 const hasBothEdges = htmlScrollbarGutterValue.includes("both-edges"); 3861 const scrollbarGutterValue = hasBothEdges ? "stable both-edges" : "stable"; 3862 scrollTop = html.scrollTop; 3863 scrollLeft = html.scrollLeft; 3864 originalHtmlStyles = { 3865 scrollbarGutter: html.style.scrollbarGutter, 3866 overflowY: html.style.overflowY, 3867 overflowX: html.style.overflowX 3868 }; 3869 originalHtmlScrollBehavior = html.style.scrollBehavior; 3870 originalBodyStyles = { 3871 position: body.style.position, 3872 height: body.style.height, 3873 width: body.style.width, 3874 boxSizing: body.style.boxSizing, 3875 overflowY: body.style.overflowY, 3876 overflowX: body.style.overflowX, 3877 scrollBehavior: body.style.scrollBehavior 3878 }; 3879 const isScrollableY = html.scrollHeight > html.clientHeight; 3880 const isScrollableX = html.scrollWidth > html.clientWidth; 3881 const hasConstantOverflowY = htmlStyles.overflowY === "scroll" || bodyStyles.overflowY === "scroll"; 3882 const hasConstantOverflowX = htmlStyles.overflowX === "scroll" || bodyStyles.overflowX === "scroll"; 3883 const scrollbarWidth = Math.max(0, win.innerWidth - body.clientWidth); 3884 const scrollbarHeight = Math.max(0, win.innerHeight - body.clientHeight); 3885 const marginY = parseFloat(bodyStyles.marginTop) + parseFloat(bodyStyles.marginBottom); 3886 const marginX = parseFloat(bodyStyles.marginLeft) + parseFloat(bodyStyles.marginRight); 3887 const elementToLock = getViewportScroller(html, body); 3888 updateGutterOnly = supportsStableScrollbarGutter(referenceElement); 3889 if (updateGutterOnly) { 3890 html.style.scrollbarGutter = scrollbarGutterValue; 3891 elementToLock.style.overflowY = "hidden"; 3892 elementToLock.style.overflowX = "hidden"; 3893 return; 3894 } 3895 Object.assign(html.style, { 3896 scrollbarGutter: scrollbarGutterValue, 3897 overflowY: "hidden", 3898 overflowX: "hidden" 3899 }); 3900 if (isScrollableY || hasConstantOverflowY) { 3901 html.style.overflowY = "scroll"; 3902 } 3903 if (isScrollableX || hasConstantOverflowX) { 3904 html.style.overflowX = "scroll"; 3905 } 3906 Object.assign(body.style, { 3907 position: "relative", 3908 height: marginY || scrollbarHeight ? `calc(100dvh - $marginY + scrollbarHeight}px)` : "100dvh", 3909 width: marginX || scrollbarWidth ? `calc(100vw - $marginX + scrollbarWidth}px)` : "100vw", 3910 boxSizing: "border-box", 3911 // Assign the longhands that `cleanup` restores, so nothing is left behind. 3912 overflowY: "hidden", 3913 overflowX: "hidden", 3914 scrollBehavior: "unset" 3915 }); 3916 body.scrollTop = scrollTop; 3917 body.scrollLeft = scrollLeft; 3918 html.setAttribute("data-base-ui-scroll-locked", ""); 3919 html.style.scrollBehavior = "unset"; 3920 } 3921 function cleanup() { 3922 Object.assign(html.style, originalHtmlStyles); 3923 Object.assign(body.style, originalBodyStyles); 3924 if (!updateGutterOnly) { 3925 html.scrollTop = scrollTop; 3926 html.scrollLeft = scrollLeft; 3927 html.removeAttribute("data-base-ui-scroll-locked"); 3928 html.style.scrollBehavior = originalHtmlScrollBehavior; 3929 } 3930 } 3931 function handleResize() { 3932 cleanup(); 3933 resizeFrame.request(lockScroll); 3934 } 3935 lockScroll(); 3936 const unsubscribeResize = addEventListener(win, "resize", handleResize); 3937 return () => { 3938 resizeFrame.cancel(); 3939 cleanup(); 3940 if (typeof win.removeEventListener === "function") { 3941 unsubscribeResize(); 3942 } 3943 }; 3944 } 3945 var ScrollLocker = class { 3946 lockCount = 0; 3947 restore = null; 3948 timeoutLock = Timeout.create(); 3949 timeoutUnlock = Timeout.create(); 3950 acquire(referenceElement) { 3951 this.lockCount += 1; 3952 if (this.lockCount === 1 && this.restore === null) { 3953 this.timeoutLock.start(0, () => this.lock(referenceElement)); 3954 } 3955 return this.release; 3956 } 3957 release = () => { 3958 this.lockCount -= 1; 3959 if (this.lockCount === 0 && this.restore) { 3960 this.timeoutUnlock.start(0, this.unlock); 3961 } 3962 }; 3963 unlock = () => { 3964 if (this.lockCount === 0 && this.restore) { 3965 this.restore?.(); 3966 this.restore = null; 3967 } 3968 }; 3969 lock(referenceElement) { 3970 if (this.lockCount === 0 || this.restore !== null) { 3971 return; 3972 } 3973 const doc = ownerDocument(referenceElement); 3974 const html = doc.documentElement; 3975 const body = doc.body; 3976 const win = getWindow(html); 3977 if (isPageScrollLocked(win, html, body)) { 3978 const observer = new win.MutationObserver(() => { 3979 if (isPageScrollLocked(win, html, body)) { 3980 return; 3981 } 3982 observer.disconnect(); 3983 this.restore = null; 3984 this.lock(referenceElement); 3985 }); 3986 const options = { 3987 attributes: true 3988 }; 3989 observer.observe(html, options); 3990 observer.observe(body, options); 3991 this.restore = () => observer.disconnect(); 3992 return; 3993 } 3994 const hasOverlayScrollbars = parts_exports.os.ios || !hasInsetScrollbars(referenceElement); 3995 this.restore = hasOverlayScrollbars ? preventScrollOverlayScrollbars(referenceElement) : preventScrollInsetScrollbars(referenceElement); 3996 } 3997 }; 3998 var SCROLL_LOCKER = new ScrollLocker(); 3999 function useScrollLock(enabled = true, referenceElement = null) { 4000 useIsoLayoutEffect(() => { 4001 if (!enabled) { 4002 return void 0; 4003 } 4004 return SCROLL_LOCKER.acquire(referenceElement); 4005 }, [enabled, referenceElement]); 4006 } 4007 4008 // node_modules/@base-ui/react/floating-ui-react/components/FloatingDelayGroup.mjs 4009 var React18 = __toESM(require_react(), 1); 4010 4011 // node_modules/@base-ui/react/floating-ui-react/utils/event.mjs 4012 function stopEvent(event) { 4013 event.preventDefault(); 4014 event.stopPropagation(); 4015 } 4016 function isReactEvent(event) { 4017 return "nativeEvent" in event; 4018 } 4019 function isVirtualClick(event) { 4020 if (event.pointerType === "" && event.isTrusted) { 4021 return true; 4022 } 4023 if (parts_exports.os.android && event.pointerType) { 4024 return event.type === "click" && event.buttons === 1; 4025 } 4026 return event.detail === 0 && !event.pointerType; 4027 } 4028 function isVirtualPointerEvent(event) { 4029 if (parts_exports.env.jsdom) { 4030 return false; 4031 } 4032 return !parts_exports.os.android && event.width === 0 && event.height === 0 || parts_exports.os.android && event.width === 1 && event.height === 1 && event.pressure === 0 && event.detail === 0 && event.pointerType === "mouse" || // iOS VoiceOver returns 0.333• for width/height. 4033 event.width < 1 && event.height < 1 && event.pressure === 0 && event.detail === 0 && event.pointerType === "touch"; 4034 } 4035 function isMouseLikePointerType(pointerType, strict) { 4036 const values = ["mouse", "pen"]; 4037 if (!strict) { 4038 values.push("", void 0); 4039 } 4040 return values.includes(pointerType); 4041 } 4042 function isClickLikeEvent(event) { 4043 const type = event.type; 4044 return type === "click" || type === "mousedown" || type === "keydown" || type === "keyup"; 4045 } 4046 4047 // node_modules/@base-ui/utils/shadowDom.mjs 4048 function activeElement(doc) { 4049 let element = doc.activeElement; 4050 while (element?.shadowRoot?.activeElement != null) { 4051 element = element.shadowRoot.activeElement; 4052 } 4053 return element; 4054 } 4055 function contains(parent, child) { 4056 if (!parent || !child) { 4057 return false; 4058 } 4059 const rootNode = child.getRootNode?.(); 4060 if (parent.contains(child)) { 4061 return true; 4062 } 4063 if (rootNode && isShadowRoot(rootNode)) { 4064 let next = child; 4065 while (next) { 4066 if (parent === next) { 4067 return true; 4068 } 4069 next = next.parentNode || next.host; 4070 } 4071 } 4072 return false; 4073 } 4074 function getTarget(event) { 4075 if ("composedPath" in event) { 4076 return event.composedPath()[0] ?? event.target; 4077 } 4078 return event.target; 4079 } 4080 4081 // node_modules/@base-ui/react/floating-ui-react/utils/constants.mjs 4082 var FOCUSABLE_ATTRIBUTE = "data-base-ui-focusable"; 4083 var TYPEABLE_SELECTOR = "input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])"; 4084 var ARROW_LEFT = "ArrowLeft"; 4085 var ARROW_RIGHT = "ArrowRight"; 4086 var ARROW_UP = "ArrowUp"; 4087 var ARROW_DOWN = "ArrowDown"; 4088 4089 // node_modules/@base-ui/react/utils/CommonPopupDataAttributes.mjs 4090 var open = "data-open"; 4091 var closed = "data-closed"; 4092 var anchorHidden = "data-anchor-hidden"; 4093 4094 // node_modules/@base-ui/react/utils/CommonTriggerDataAttributes.mjs 4095 var CommonTriggerDataAttributes_exports = {}; 4096 __export(CommonTriggerDataAttributes_exports, { 4097 popupOpen: () => popupOpen, 4098 pressed: () => pressed 4099 }); 4100 var popupOpen = "data-popup-open"; 4101 var pressed = "data-pressed"; 4102 4103 // node_modules/@base-ui/react/utils/popupStateMapping.mjs 4104 var TRIGGER_HOOK = { 4105 [popupOpen]: "" 4106 }; 4107 var PRESSABLE_TRIGGER_HOOK = { 4108 [popupOpen]: "", 4109 [pressed]: "" 4110 }; 4111 var POPUP_OPEN_HOOK = { 4112 [open]: "" 4113 }; 4114 var POPUP_CLOSED_HOOK = { 4115 [closed]: "" 4116 }; 4117 var ANCHOR_HIDDEN_HOOK = { 4118 [anchorHidden]: "" 4119 }; 4120 var triggerOpenStateMapping = { 4121 open(value) { 4122 if (value) { 4123 return TRIGGER_HOOK; 4124 } 4125 return null; 4126 } 4127 }; 4128 var pressableTriggerOpenStateMapping = { 4129 open(value) { 4130 if (value) { 4131 return PRESSABLE_TRIGGER_HOOK; 4132 } 4133 return null; 4134 } 4135 }; 4136 var popupStateMapping = { 4137 open(value) { 4138 if (value) { 4139 return POPUP_OPEN_HOOK; 4140 } 4141 return POPUP_CLOSED_HOOK; 4142 }, 4143 anchorHidden(value) { 4144 if (value) { 4145 return ANCHOR_HIDDEN_HOOK; 4146 } 4147 return null; 4148 } 4149 }; 4150 var popupTransitionStateMapping = { 4151 ...popupStateMapping, 4152 ...transitionStatusMapping 4153 }; 4154 4155 // node_modules/@base-ui/react/tooltip/trigger/TooltipTriggerDataAttributes.mjs 4156 var popupOpen2 = CommonTriggerDataAttributes_exports.popupOpen; 4157 var triggerDisabled = "data-trigger-disabled"; 4158 4159 // node_modules/@base-ui/react/floating-ui-react/utils/element.mjs 4160 function isTargetInsideEnabledTrigger(target, triggerElements) { 4161 if (!isElement(target)) { 4162 return false; 4163 } 4164 const targetElement = target; 4165 if (triggerElements.hasElement(targetElement)) { 4166 return !targetElement.hasAttribute(triggerDisabled); 4167 } 4168 for (const [, trigger] of triggerElements.entries()) { 4169 if (contains(trigger, targetElement)) { 4170 return !trigger.hasAttribute(triggerDisabled); 4171 } 4172 } 4173 return false; 4174 } 4175 function isEventTargetWithin(event, node) { 4176 if (node == null) { 4177 return false; 4178 } 4179 if ("composedPath" in event) { 4180 return event.composedPath().includes(node); 4181 } 4182 const eventAgain = event; 4183 return eventAgain.target != null && node.contains(eventAgain.target); 4184 } 4185 function isRootElement(element) { 4186 return element.matches("html,body"); 4187 } 4188 function isTypeableElement(element) { 4189 return isHTMLElement(element) && element.matches(TYPEABLE_SELECTOR); 4190 } 4191 function isInteractiveElement(element) { 4192 return element?.closest(`button,a[href],[role="button"],select,[tabindex]:not([tabindex="-1"]),$TYPEABLE_SELECTOR}`) != null; 4193 } 4194 function isTypeableCombobox(element) { 4195 if (!element) { 4196 return false; 4197 } 4198 return element.getAttribute("role") === "combobox" && isTypeableElement(element); 4199 } 4200 function matchesFocusVisible(element) { 4201 if (!element || parts_exports.env.jsdom) { 4202 return true; 4203 } 4204 try { 4205 return element.matches(":focus-visible"); 4206 } catch (_e) { 4207 return true; 4208 } 4209 } 4210 function getFloatingFocusElement(floatingElement) { 4211 if (!floatingElement) { 4212 return null; 4213 } 4214 return floatingElement.hasAttribute(FOCUSABLE_ATTRIBUTE) ? floatingElement : floatingElement.querySelector(`[$FOCUSABLE_ATTRIBUTE}]`) || floatingElement; 4215 } 4216 4217 // node_modules/@base-ui/react/floating-ui-react/hooks/useHoverShared.mjs 4218 function resolveValue(value, pointerType) { 4219 if (pointerType != null && !isMouseLikePointerType(pointerType)) { 4220 return 0; 4221 } 4222 if (typeof value === "function") { 4223 return value(); 4224 } 4225 return value; 4226 } 4227 function getDelay(value, prop, pointerType) { 4228 const result = resolveValue(value, pointerType); 4229 if (typeof result === "number") { 4230 return result; 4231 } 4232 return result?.[prop]; 4233 } 4234 function getRestMs(value) { 4235 if (typeof value === "function") { 4236 return value(); 4237 } 4238 return value; 4239 } 4240 function isClickLikeOpenEvent(openEventType, interactedInside) { 4241 return interactedInside || openEventType === "click" || openEventType === "mousedown"; 4242 } 4243 function isHoverOpenEvent(openEventType) { 4244 return openEventType?.includes("mouse") && openEventType !== "mousedown"; 4245 } 4246 4247 // node_modules/@base-ui/react/floating-ui-react/components/FloatingDelayGroup.mjs 4248 var import_jsx_runtime36 = __toESM(require_jsx_runtime(), 1); 4249 var FloatingDelayGroupContext = /* @__PURE__ */ React18.createContext({ 4250 hasProvider: false, 4251 timeoutMs: 0, 4252 delayRef: { 4253 current: 0 4254 }, 4255 initialDelayRef: { 4256 current: 0 4257 }, 4258 timeout: new Timeout(), 4259 currentIdRef: { 4260 current: null 4261 }, 4262 currentContextRef: { 4263 current: null 4264 } 4265 }); 4266 if (true) FloatingDelayGroupContext.displayName = "FloatingDelayGroupContext"; 4267 function resetDelayRef(delayRef, initialDelayRef) { 4268 delayRef.current = initialDelayRef.current; 4269 } 4270 function FloatingDelayGroup(props) { 4271 const { 4272 children, 4273 delay, 4274 timeoutMs = 0 4275 } = props; 4276 const delayRef = React18.useRef(delay); 4277 const initialDelayRef = React18.useRef(delay); 4278 const currentIdRef = React18.useRef(null); 4279 const currentContextRef = React18.useRef(null); 4280 const timeout = useTimeout(); 4281 useIsoLayoutEffect(() => { 4282 initialDelayRef.current = delay; 4283 if (!currentIdRef.current) { 4284 delayRef.current = delay; 4285 return; 4286 } 4287 delayRef.current = { 4288 open: getDelay(delayRef.current, "open"), 4289 close: getDelay(delay, "close") 4290 }; 4291 }, [delay, currentIdRef, delayRef, initialDelayRef]); 4292 return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(FloatingDelayGroupContext.Provider, { 4293 value: React18.useMemo(() => ({ 4294 hasProvider: true, 4295 delayRef, 4296 initialDelayRef, 4297 currentIdRef, 4298 timeoutMs, 4299 currentContextRef, 4300 timeout 4301 }), [timeoutMs, timeout]), 4302 children 4303 }); 4304 } 4305 function useDelayGroup(context, options = { 4306 open: false 4307 }) { 4308 const { 4309 open: open2 4310 } = options; 4311 const store = "rootStore" in context ? context.rootStore : context; 4312 const floatingId = store.useState("floatingId"); 4313 const groupContext = React18.useContext(FloatingDelayGroupContext); 4314 const { 4315 currentIdRef, 4316 delayRef, 4317 timeoutMs, 4318 initialDelayRef, 4319 currentContextRef, 4320 hasProvider, 4321 timeout 4322 } = groupContext; 4323 const [isInstantPhase, setIsInstantPhase] = React18.useState(false); 4324 const openRef = React18.useRef(open2); 4325 useIsoLayoutEffect(() => { 4326 openRef.current = open2; 4327 }, [open2]); 4328 useIsoLayoutEffect(() => { 4329 function unset() { 4330 currentContextRef.current?.setIsInstantPhase(false); 4331 currentIdRef.current = null; 4332 currentContextRef.current = null; 4333 delayRef.current = initialDelayRef.current; 4334 timeout.clear(); 4335 } 4336 if (!currentIdRef.current) { 4337 return void 0; 4338 } 4339 if (!open2 && currentIdRef.current === floatingId) { 4340 setIsInstantPhase(false); 4341 if (timeoutMs) { 4342 const closingId = floatingId; 4343 timeout.start(timeoutMs, () => { 4344 if (store.select("open") || currentIdRef.current && currentIdRef.current !== closingId) { 4345 return; 4346 } 4347 unset(); 4348 }); 4349 return () => { 4350 if (openRef.current || currentIdRef.current !== closingId) { 4351 timeout.clear(); 4352 } 4353 }; 4354 } 4355 unset(); 4356 } 4357 return void 0; 4358 }, [open2, floatingId, currentIdRef, delayRef, timeoutMs, initialDelayRef, currentContextRef, timeout, store]); 4359 useIsoLayoutEffect(() => { 4360 if (!open2) { 4361 return; 4362 } 4363 const prevContext = currentContextRef.current; 4364 const prevId = currentIdRef.current; 4365 timeout.clear(); 4366 currentContextRef.current = { 4367 onOpenChange: store.setOpen, 4368 setIsInstantPhase 4369 }; 4370 currentIdRef.current = floatingId; 4371 delayRef.current = { 4372 open: 0, 4373 close: getDelay(initialDelayRef.current, "close") 4374 }; 4375 if (prevId !== null && prevId !== floatingId) { 4376 setIsInstantPhase(true); 4377 prevContext?.setIsInstantPhase(true); 4378 prevContext?.onOpenChange(false, createChangeEventDetails(reason_parts_exports.none)); 4379 } else { 4380 setIsInstantPhase(false); 4381 prevContext?.setIsInstantPhase(false); 4382 } 4383 }, [open2, floatingId, store, currentIdRef, delayRef, initialDelayRef, currentContextRef, timeout]); 4384 useIsoLayoutEffect(() => { 4385 return () => { 4386 if (currentIdRef.current === floatingId) { 4387 currentContextRef.current = null; 4388 if (!openRef.current) { 4389 return; 4390 } 4391 currentIdRef.current = null; 4392 resetDelayRef(delayRef, initialDelayRef); 4393 timeout.clear(); 4394 } 4395 }; 4396 }, [currentContextRef, currentIdRef, delayRef, floatingId, initialDelayRef, timeout]); 4397 return React18.useMemo(() => ({ 4398 activeIdRef: currentIdRef, 4399 hasProvider, 4400 delayRef, 4401 isInstantPhase 4402 }), [currentIdRef, hasProvider, delayRef, isInstantPhase]); 4403 } 4404 4405 // node_modules/@base-ui/react/floating-ui-react/components/FloatingFocusManager.mjs 4406 var React22 = __toESM(require_react(), 1); 4407 4408 // node_modules/@base-ui/utils/mergeCleanups.mjs 4409 function mergeCleanups(...cleanups) { 4410 return () => { 4411 for (let i = 0; i < cleanups.length; i += 1) { 4412 const cleanup = cleanups[i]; 4413 if (cleanup) { 4414 cleanup(); 4415 } 4416 } 4417 }; 4418 } 4419 4420 // node_modules/@base-ui/react/utils/FocusGuard.mjs 4421 var React19 = __toESM(require_react(), 1); 4422 4423 // node_modules/@base-ui/utils/visuallyHidden.mjs 4424 var visuallyHiddenBase = { 4425 clipPath: "inset(50%)", 4426 overflow: "hidden", 4427 whiteSpace: "nowrap", 4428 border: 0, 4429 padding: 0, 4430 width: 1, 4431 height: 1, 4432 margin: -1 4433 }; 4434 var visuallyHidden = { 4435 ...visuallyHiddenBase, 4436 position: "fixed", 4437 top: 0, 4438 left: 0 4439 }; 4440 var visuallyHiddenInput = { 4441 ...visuallyHiddenBase, 4442 position: "absolute" 4443 }; 4444 4445 // node_modules/@base-ui/react/utils/FocusGuard.mjs 4446 var import_jsx_runtime37 = __toESM(require_jsx_runtime(), 1); 4447 var FocusGuard = /* @__PURE__ */ React19.forwardRef(function FocusGuard2(props, ref) { 4448 const [role, setRole] = React19.useState(); 4449 useIsoLayoutEffect(() => { 4450 if (parts_exports.screenReader.voiceOver && parts_exports.engine.webkit) { 4451 setRole("button"); 4452 } 4453 }, []); 4454 const restProps = { 4455 tabIndex: 0, 4456 // Role is only for VoiceOver 4457 role 4458 }; 4459 return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { 4460 ...props, 4461 ref, 4462 style: visuallyHidden, 4463 "aria-hidden": role ? void 0 : true, 4464 ...restProps, 4465 "data-base-ui-focus-guard": "" 4466 }); 4467 }); 4468 if (true) FocusGuard.displayName = "FocusGuard"; 4469 4470 // node_modules/@floating-ui/utils/dist/floating-ui.utils.mjs 4471 var min = Math.min; 4472 var max = Math.max; 4473 var round = Math.round; 4474 var floor = Math.floor; 4475 var createCoords = (v2) => ({ 4476 x: v2, 4477 y: v2 4478 }); 4479 var oppositeSideMap = { 4480 left: "right", 4481 right: "left", 4482 bottom: "top", 4483 top: "bottom" 4484 }; 4485 function clamp(start, value, end) { 4486 return max(start, min(value, end)); 4487 } 4488 function evaluate(value, param) { 4489 return typeof value === "function" ? value(param) : value; 4490 } 4491 function getSide(placement) { 4492 return placement.split("-")[0]; 4493 } 4494 function getAlignment(placement) { 4495 return placement.split("-")[1]; 4496 } 4497 function getOppositeAxis(axis) { 4498 return axis === "x" ? "y" : "x"; 4499 } 4500 function getAxisLength(axis) { 4501 return axis === "y" ? "height" : "width"; 4502 } 4503 function getSideAxis(placement) { 4504 const firstChar = placement[0]; 4505 return firstChar === "t" || firstChar === "b" ? "y" : "x"; 4506 } 4507 function getAlignmentAxis(placement) { 4508 return getOppositeAxis(getSideAxis(placement)); 4509 } 4510 function getAlignmentSides(placement, rects, rtl) { 4511 if (rtl === void 0) { 4512 rtl = false; 4513 } 4514 const alignment = getAlignment(placement); 4515 const alignmentAxis = getAlignmentAxis(placement); 4516 const length = getAxisLength(alignmentAxis); 4517 let mainAlignmentSide = alignmentAxis === "x" ? alignment === (rtl ? "end" : "start") ? "right" : "left" : alignment === "start" ? "bottom" : "top"; 4518 if (rects.reference[length] > rects.floating[length]) { 4519 mainAlignmentSide = getOppositePlacement(mainAlignmentSide); 4520 } 4521 return [mainAlignmentSide, getOppositePlacement(mainAlignmentSide)]; 4522 } 4523 function getExpandedPlacements(placement) { 4524 const oppositePlacement = getOppositePlacement(placement); 4525 return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)]; 4526 } 4527 function getOppositeAlignmentPlacement(placement) { 4528 return placement.includes("start") ? placement.replace("start", "end") : placement.replace("end", "start"); 4529 } 4530 var lrPlacement = ["left", "right"]; 4531 var rlPlacement = ["right", "left"]; 4532 var tbPlacement = ["top", "bottom"]; 4533 var btPlacement = ["bottom", "top"]; 4534 function getSideList(side, isStart, rtl) { 4535 switch (side) { 4536 case "top": 4537 case "bottom": 4538 if (rtl) return isStart ? rlPlacement : lrPlacement; 4539 return isStart ? lrPlacement : rlPlacement; 4540 case "left": 4541 case "right": 4542 return isStart ? tbPlacement : btPlacement; 4543 default: 4544 return []; 4545 } 4546 } 4547 function getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) { 4548 const alignment = getAlignment(placement); 4549 let list = getSideList(getSide(placement), direction === "start", rtl); 4550 if (alignment) { 4551 list = list.map((side) => side + "-" + alignment); 4552 if (flipAlignment) { 4553 list = list.concat(list.map(getOppositeAlignmentPlacement)); 4554 } 4555 } 4556 return list; 4557 } 4558 function getOppositePlacement(placement) { 4559 const side = getSide(placement); 4560 return oppositeSideMap[side] + placement.slice(side.length); 4561 } 4562 function expandPaddingObject(padding) { 4563 var _padding$top, _padding$right, _padding$bottom, _padding$left; 4564 return { 4565 top: (_padding$top = padding.top) != null ? _padding$top : 0, 4566 right: (_padding$right = padding.right) != null ? _padding$right : 0, 4567 bottom: (_padding$bottom = padding.bottom) != null ? _padding$bottom : 0, 4568 left: (_padding$left = padding.left) != null ? _padding$left : 0 4569 }; 4570 } 4571 function getPaddingObject(padding) { 4572 return typeof padding !== "number" ? expandPaddingObject(padding) : { 4573 top: padding, 4574 right: padding, 4575 bottom: padding, 4576 left: padding 4577 }; 4578 } 4579 function rectToClientRect(rect) { 4580 const { 4581 x: x2, 4582 y: y2, 4583 width, 4584 height 4585 } = rect; 4586 return { 4587 width, 4588 height, 4589 top: y2, 4590 left: x2, 4591 right: x2 + width, 4592 bottom: y2 + height, 4593 x: x2, 4594 y: y2 4595 }; 4596 } 4597 4598 // node_modules/@base-ui/react/floating-ui-react/utils/composite.mjs 4599 function isIndexOutOfListBounds(list, index2) { 4600 return index2 < 0 || index2 >= list.length; 4601 } 4602 function getMinListIndex(listRef, disabledIndices) { 4603 return findNonDisabledListIndex(listRef.current, { 4604 disabledIndices 4605 }); 4606 } 4607 function getMaxListIndex(listRef, disabledIndices) { 4608 return findNonDisabledListIndex(listRef.current, { 4609 decrement: true, 4610 startingIndex: listRef.current.length, 4611 disabledIndices 4612 }); 4613 } 4614 function findNonDisabledListIndex(list, { 4615 startingIndex = -1, 4616 decrement = false, 4617 disabledIndices, 4618 amount = 1 4619 } = {}) { 4620 let index2 = startingIndex; 4621 do { 4622 index2 += decrement ? -amount : amount; 4623 } while (index2 >= 0 && index2 <= list.length - 1 && isListIndexDisabled(list, index2, disabledIndices)); 4624 return index2; 4625 } 4626 function isListIndexDisabled(list, index2, disabledIndices) { 4627 const isExplicitlyDisabled = typeof disabledIndices === "function" ? disabledIndices(index2) : disabledIndices?.includes(index2) ?? false; 4628 if (isExplicitlyDisabled) { 4629 return true; 4630 } 4631 const element = list[index2]; 4632 if (!element) { 4633 return false; 4634 } 4635 if (!isElementVisible(element)) { 4636 return true; 4637 } 4638 if (element.matches(":disabled")) { 4639 return true; 4640 } 4641 return !disabledIndices && (element.hasAttribute("disabled") || element.getAttribute("aria-disabled") === "true"); 4642 } 4643 function isHiddenByStyles(styles) { 4644 return styles.visibility === "hidden" || styles.visibility === "collapse"; 4645 } 4646 function isElementVisible(element, styles = element ? getComputedStyle2(element) : null) { 4647 if (!element || !element.isConnected || !styles || isHiddenByStyles(styles)) { 4648 return false; 4649 } 4650 if (typeof element.checkVisibility === "function") { 4651 return element.checkVisibility(); 4652 } 4653 return styles.display !== "none" && styles.display !== "contents"; 4654 } 4655 4656 // node_modules/@base-ui/react/floating-ui-react/utils/tabbable.mjs 4657 var CANDIDATE_SELECTOR = 'a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable="false"]),audio[controls],video[controls]'; 4658 function getParentElement(element) { 4659 const assignedSlot = element.assignedSlot; 4660 if (assignedSlot) { 4661 return assignedSlot; 4662 } 4663 if (element.parentElement) { 4664 return element.parentElement; 4665 } 4666 const rootNode = element.getRootNode(); 4667 return isShadowRoot(rootNode) ? rootNode.host : null; 4668 } 4669 function getDetailsSummary(details) { 4670 for (const child of Array.from(details.children)) { 4671 if (getNodeName(child) === "summary") { 4672 return child; 4673 } 4674 } 4675 return null; 4676 } 4677 function isWithinOpenDetailsSummary(element, details) { 4678 const summary = getDetailsSummary(details); 4679 return !!summary && (element === summary || contains(summary, element)); 4680 } 4681 function isFocusableCandidate(element) { 4682 const nodeName = element ? getNodeName(element) : ""; 4683 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"); 4684 } 4685 function isFocusableElement(element) { 4686 if (!isFocusableCandidate(element) || !element.isConnected || element.matches(":disabled")) { 4687 return false; 4688 } 4689 for (let current = element; current; current = getParentElement(current)) { 4690 const isAncestor = current !== element; 4691 const isSlot = getNodeName(current) === "slot"; 4692 if (current.hasAttribute("inert")) { 4693 return false; 4694 } 4695 if (isAncestor && getNodeName(current) === "details" && !current.open && !isWithinOpenDetailsSummary(element, current) || current.hasAttribute("hidden") || !isSlot && !isVisibleInTabbableTree(current, isAncestor)) { 4696 return false; 4697 } 4698 } 4699 return true; 4700 } 4701 function isVisibleInTabbableTree(element, isAncestor) { 4702 const styles = getComputedStyle2(element); 4703 if (!isAncestor) { 4704 return isElementVisible(element, styles); 4705 } 4706 return styles.display !== "none"; 4707 } 4708 function getTabIndex(element) { 4709 const tabIndex = element.tabIndex; 4710 if (tabIndex < 0) { 4711 const nodeName = getNodeName(element); 4712 if (nodeName === "details" || nodeName === "audio" || nodeName === "video" || isHTMLElement(element) && element.isContentEditable) { 4713 return 0; 4714 } 4715 } 4716 return tabIndex; 4717 } 4718 function getNamedRadioInput(element) { 4719 if (getNodeName(element) !== "input") { 4720 return null; 4721 } 4722 const input = element; 4723 return input.type === "radio" && input.name !== "" ? input : null; 4724 } 4725 function isTabbableRadio(element, candidates) { 4726 const input = getNamedRadioInput(element); 4727 if (!input) { 4728 return true; 4729 } 4730 const checkedRadio = candidates.find((candidate) => { 4731 const radio = getNamedRadioInput(candidate); 4732 return radio?.name === input.name && radio.form === input.form && radio.checked; 4733 }); 4734 if (checkedRadio) { 4735 return checkedRadio === input; 4736 } 4737 return candidates.find((candidate) => { 4738 const radio = getNamedRadioInput(candidate); 4739 return radio?.name === input.name && radio.form === input.form; 4740 }) === input; 4741 } 4742 function getComposedChildren(container) { 4743 if (isHTMLElement(container) && getNodeName(container) === "slot") { 4744 const assignedElements = container.assignedElements({ 4745 flatten: true 4746 }); 4747 if (assignedElements.length > 0) { 4748 return assignedElements; 4749 } 4750 } 4751 if (isHTMLElement(container) && container.shadowRoot) { 4752 return Array.from(container.shadowRoot.children); 4753 } 4754 return Array.from(container.children); 4755 } 4756 function appendCandidates(container, list) { 4757 getComposedChildren(container).forEach((child) => { 4758 if (isFocusableCandidate(child)) { 4759 list.push(child); 4760 } 4761 appendCandidates(child, list); 4762 }); 4763 } 4764 function appendMatchingElements(container, selector2, list) { 4765 getComposedChildren(container).forEach((child) => { 4766 if (isHTMLElement(child) && child.matches(selector2)) { 4767 list.push(child); 4768 } 4769 appendMatchingElements(child, selector2, list); 4770 }); 4771 } 4772 function isTabbable(element) { 4773 return isFocusableElement(element) && getTabIndex(element) >= 0; 4774 } 4775 function focusable(container) { 4776 const candidates = []; 4777 appendCandidates(container, candidates); 4778 return candidates.filter(isFocusableElement); 4779 } 4780 function tabbable(container) { 4781 const candidates = focusable(container); 4782 return candidates.filter((element) => getTabIndex(element) >= 0 && isTabbableRadio(element, candidates)); 4783 } 4784 function getTabbableIn(container, dir) { 4785 const list = tabbable(container); 4786 const len = list.length; 4787 if (len === 0) { 4788 return void 0; 4789 } 4790 const active = activeElement(ownerDocument(container)); 4791 const index2 = list.indexOf(active); 4792 const nextIndex = index2 === -1 ? dir === 1 ? 0 : len - 1 : index2 + dir; 4793 return list[nextIndex]; 4794 } 4795 function getNextTabbable(referenceElement) { 4796 return getTabbableIn(ownerDocument(referenceElement).body, 1) || referenceElement; 4797 } 4798 function getPreviousTabbable(referenceElement) { 4799 return getTabbableIn(ownerDocument(referenceElement).body, -1) || referenceElement; 4800 } 4801 function getTabbableNearElement(referenceElement, dir) { 4802 if (!referenceElement) { 4803 return null; 4804 } 4805 const list = tabbable(ownerDocument(referenceElement).body); 4806 const elementCount = list.length; 4807 if (elementCount === 0) { 4808 return null; 4809 } 4810 const index2 = list.indexOf(referenceElement); 4811 if (index2 === -1) { 4812 return null; 4813 } 4814 const nextIndex = (index2 + dir + elementCount) % elementCount; 4815 return list[nextIndex]; 4816 } 4817 function getTabbableAfterElement(referenceElement) { 4818 return getTabbableNearElement(referenceElement, 1); 4819 } 4820 function getTabbableBeforeElement(referenceElement) { 4821 return getTabbableNearElement(referenceElement, -1); 4822 } 4823 function isOutsideEvent(event, container) { 4824 const containerElement = container || event.currentTarget; 4825 const relatedTarget = event.relatedTarget; 4826 return !relatedTarget || !contains(containerElement, relatedTarget); 4827 } 4828 function disableFocusInside(container) { 4829 const tabbableElements = tabbable(container); 4830 tabbableElements.forEach((element) => { 4831 element.dataset.tabindex = element.getAttribute("tabindex") || ""; 4832 element.setAttribute("tabindex", "-1"); 4833 }); 4834 } 4835 function enableFocusInside(container) { 4836 const elements = []; 4837 appendMatchingElements(container, "[data-tabindex]", elements); 4838 elements.forEach((element) => { 4839 const tabindex = element.dataset.tabindex; 4840 delete element.dataset.tabindex; 4841 if (tabindex) { 4842 element.setAttribute("tabindex", tabindex); 4843 } else { 4844 element.removeAttribute("tabindex"); 4845 } 4846 }); 4847 } 4848 4849 // node_modules/@base-ui/react/floating-ui-react/utils/nodes.mjs 4850 function getNodeChildren(nodes, id, onlyOpenChildren = true) { 4851 const directChildren = nodes.filter((node) => node.parentId === id); 4852 return directChildren.flatMap((child) => [...!onlyOpenChildren || child.context?.open ? [child] : [], ...getNodeChildren(nodes, child.id, onlyOpenChildren)]); 4853 } 4854 function getNodeAncestors(nodes, id) { 4855 let allAncestors = []; 4856 let currentParentId = nodes.find((node) => node.id === id)?.parentId; 4857 while (currentParentId) { 4858 const currentNode = nodes.find((node) => node.id === currentParentId); 4859 currentParentId = currentNode?.parentId; 4860 if (currentNode) { 4861 allAncestors = allAncestors.concat(currentNode); 4862 } 4863 } 4864 return allAncestors; 4865 } 4866 4867 // node_modules/@base-ui/react/floating-ui-react/utils/createAttribute.mjs 4868 function createAttribute(name) { 4869 return `data-base-ui-$name}`; 4870 } 4871 4872 // node_modules/@base-ui/react/floating-ui-react/utils/enqueueFocus.mjs 4873 var rafId = 0; 4874 function enqueueFocus(el, options = {}) { 4875 const { 4876 preventScroll = false, 4877 sync: sync2 = false, 4878 shouldFocus 4879 } = options; 4880 cancelAnimationFrame(rafId); 4881 function exec() { 4882 if (shouldFocus && !shouldFocus()) { 4883 return; 4884 } 4885 el?.focus({ 4886 preventScroll 4887 }); 4888 } 4889 if (sync2) { 4890 exec(); 4891 return NOOP; 4892 } 4893 const currentRafId = requestAnimationFrame(exec); 4894 rafId = currentRafId; 4895 return () => { 4896 if (rafId === currentRafId) { 4897 cancelAnimationFrame(currentRafId); 4898 rafId = 0; 4899 } 4900 }; 4901 } 4902 4903 // node_modules/@base-ui/react/floating-ui-react/utils/markOthers.mjs 4904 var counters = { 4905 inert: /* @__PURE__ */ new WeakMap(), 4906 "aria-hidden": /* @__PURE__ */ new WeakMap() 4907 }; 4908 var markerName = "data-base-ui-inert"; 4909 var uncontrolledElementsSets = { 4910 inert: /* @__PURE__ */ new WeakSet(), 4911 "aria-hidden": /* @__PURE__ */ new WeakSet() 4912 }; 4913 var markerCounterMap = /* @__PURE__ */ new WeakMap(); 4914 var lockCount = 0; 4915 function getUncontrolledElementsSet(controlAttribute) { 4916 return uncontrolledElementsSets[controlAttribute]; 4917 } 4918 function unwrapHost(node) { 4919 if (!node) { 4920 return null; 4921 } 4922 return isShadowRoot(node) ? node.host : unwrapHost(node.parentNode); 4923 } 4924 var correctElements = (parent, targets) => targets.map((target) => { 4925 if (parent.contains(target)) { 4926 return target; 4927 } 4928 const correctedTarget = unwrapHost(target); 4929 if (parent.contains(correctedTarget)) { 4930 return correctedTarget; 4931 } 4932 return null; 4933 }).filter((x2) => x2 != null); 4934 var buildKeepSet = (targets) => { 4935 const keep = /* @__PURE__ */ new Set(); 4936 targets.forEach((target) => { 4937 let node = target; 4938 while (node && !keep.has(node)) { 4939 keep.add(node); 4940 node = node.parentNode; 4941 } 4942 }); 4943 return keep; 4944 }; 4945 var collectOutsideElements = (root, keepElements, stopElements) => { 4946 const outside = []; 4947 const walk = (parent) => { 4948 if (!parent || stopElements.has(parent)) { 4949 return; 4950 } 4951 Array.from(parent.children).forEach((node) => { 4952 if (getNodeName(node) === "script") { 4953 return; 4954 } 4955 if (keepElements.has(node)) { 4956 walk(node); 4957 } else { 4958 outside.push(node); 4959 } 4960 }); 4961 }; 4962 walk(root); 4963 return outside; 4964 }; 4965 function applyAttributeToOthers(uncorrectedAvoidElements, body, ariaHidden, inert, { 4966 mark = true 4967 }) { 4968 let controlAttribute = null; 4969 if (inert) { 4970 controlAttribute = "inert"; 4971 } else if (ariaHidden) { 4972 controlAttribute = "aria-hidden"; 4973 } 4974 let counterMap = null; 4975 let uncontrolledElementsSet = null; 4976 const avoidElements = correctElements(body, uncorrectedAvoidElements); 4977 const markerTargets = mark ? collectOutsideElements(body, buildKeepSet(avoidElements), new Set(avoidElements)) : []; 4978 const hiddenElements = []; 4979 const markedElements = []; 4980 if (controlAttribute) { 4981 const map = counters[controlAttribute]; 4982 const currentUncontrolledElementsSet = getUncontrolledElementsSet(controlAttribute); 4983 uncontrolledElementsSet = currentUncontrolledElementsSet; 4984 counterMap = map; 4985 const ariaLiveElements = correctElements(body, Array.from(body.querySelectorAll("[aria-live]"))); 4986 const controlElements = avoidElements.concat(ariaLiveElements); 4987 const controlTargets = collectOutsideElements(body, buildKeepSet(controlElements), new Set(controlElements)); 4988 controlTargets.forEach((node) => { 4989 const attr2 = node.getAttribute(controlAttribute); 4990 const alreadyHidden = attr2 !== null && attr2 !== "false"; 4991 const counterValue = (map.get(node) || 0) + 1; 4992 map.set(node, counterValue); 4993 hiddenElements.push(node); 4994 if (counterValue === 1 && alreadyHidden) { 4995 currentUncontrolledElementsSet.add(node); 4996 } 4997 if (!alreadyHidden) { 4998 node.setAttribute(controlAttribute, controlAttribute === "inert" ? "" : "true"); 4999 } 5000 }); 5001 } 5002 if (mark) { 5003 markerTargets.forEach((node) => { 5004 const markerValue = (markerCounterMap.get(node) || 0) + 1; 5005 markerCounterMap.set(node, markerValue); 5006 markedElements.push(node); 5007 if (markerValue === 1) { 5008 node.setAttribute(markerName, ""); 5009 } 5010 }); 5011 } 5012 lockCount += 1; 5013 return () => { 5014 if (counterMap) { 5015 hiddenElements.forEach((element) => { 5016 const currentCounterValue = counterMap.get(element) || 0; 5017 const counterValue = currentCounterValue - 1; 5018 counterMap.set(element, counterValue); 5019 if (!counterValue) { 5020 if (!uncontrolledElementsSet?.has(element) && controlAttribute) { 5021 element.removeAttribute(controlAttribute); 5022 } 5023 uncontrolledElementsSet?.delete(element); 5024 } 5025 }); 5026 } 5027 if (mark) { 5028 markedElements.forEach((element) => { 5029 const markerValue = (markerCounterMap.get(element) || 0) - 1; 5030 markerCounterMap.set(element, markerValue); 5031 if (!markerValue) { 5032 element.removeAttribute(markerName); 5033 } 5034 }); 5035 } 5036 lockCount -= 1; 5037 if (!lockCount) { 5038 counters.inert = /* @__PURE__ */ new WeakMap(); 5039 counters["aria-hidden"] = /* @__PURE__ */ new WeakMap(); 5040 uncontrolledElementsSets.inert = /* @__PURE__ */ new WeakSet(); 5041 uncontrolledElementsSets["aria-hidden"] = /* @__PURE__ */ new WeakSet(); 5042 markerCounterMap = /* @__PURE__ */ new WeakMap(); 5043 } 5044 }; 5045 } 5046 function markOthers(avoidElements, options = {}) { 5047 const { 5048 ariaHidden = false, 5049 inert = false, 5050 mark = true 5051 } = options; 5052 const body = ownerDocument(avoidElements[0]).body; 5053 return applyAttributeToOthers(avoidElements, body, ariaHidden, inert, { 5054 mark 5055 }); 5056 } 5057 5058 // node_modules/@base-ui/react/floating-ui-react/components/FloatingPortal.mjs 5059 var React20 = __toESM(require_react(), 1); 5060 var ReactDOM2 = __toESM(require_react_dom(), 1); 5061 5062 // node_modules/@base-ui/react/internals/constants.mjs 5063 var TYPEAHEAD_RESET_MS = 500; 5064 var PATIENT_CLICK_THRESHOLD = 500; 5065 var DISABLED_TRANSITIONS_STYLE = { 5066 style: { 5067 transition: "none" 5068 } 5069 }; 5070 var CLICK_TRIGGER_IDENTIFIER = "data-base-ui-click-trigger"; 5071 var BASE_UI_SWIPE_IGNORE_ATTRIBUTE = "data-base-ui-swipe-ignore"; 5072 var LEGACY_SWIPE_IGNORE_ATTRIBUTE = "data-swipe-ignore"; 5073 var BASE_UI_SWIPE_IGNORE_SELECTOR = `[$BASE_UI_SWIPE_IGNORE_ATTRIBUTE}]`; 5074 var LEGACY_SWIPE_IGNORE_SELECTOR = `[$LEGACY_SWIPE_IGNORE_ATTRIBUTE}]`; 5075 var DROPDOWN_COLLISION_AVOIDANCE = { 5076 fallbackAxisSide: "none" 5077 }; 5078 var POPUP_COLLISION_AVOIDANCE = { 5079 fallbackAxisSide: "end" 5080 }; 5081 var ownerVisuallyHidden = { 5082 clipPath: "inset(50%)", 5083 position: "fixed", 5084 top: 0, 5085 left: 0 5086 }; 5087 5088 // node_modules/@base-ui/react/floating-ui-react/components/FloatingPortal.mjs 5089 var import_jsx_runtime38 = __toESM(require_jsx_runtime(), 1); 5090 var PortalContext = /* @__PURE__ */ React20.createContext(null); 5091 if (true) PortalContext.displayName = "PortalContext"; 5092 var usePortalContext = () => React20.useContext(PortalContext); 5093 var attr = createAttribute("portal"); 5094 function useFloatingPortalNode(props = {}) { 5095 const { 5096 ref, 5097 container: containerProp, 5098 componentProps = EMPTY_OBJECT, 5099 elementProps 5100 } = props; 5101 const uniqueId = useId(); 5102 const portalContext = usePortalContext(); 5103 const parentPortalNode = portalContext?.portalNode; 5104 const [containerElement, setContainerElement] = React20.useState(null); 5105 const [portalNode, setPortalNode] = React20.useState(null); 5106 const setPortalNodeRef = useStableCallback((node) => { 5107 if (node !== null) { 5108 setPortalNode(node); 5109 } 5110 }); 5111 const containerRef = React20.useRef(null); 5112 useIsoLayoutEffect(() => { 5113 if (containerProp === null) { 5114 if (containerRef.current) { 5115 containerRef.current = null; 5116 setPortalNode(null); 5117 setContainerElement(null); 5118 } 5119 return; 5120 } 5121 const resolvedContainer = (containerProp && (isNode(containerProp) ? containerProp : containerProp.current)) ?? parentPortalNode ?? document.body; 5122 if (resolvedContainer == null) { 5123 if (containerRef.current) { 5124 containerRef.current = null; 5125 setPortalNode(null); 5126 setContainerElement(null); 5127 } 5128 return; 5129 } 5130 if (containerRef.current !== resolvedContainer) { 5131 containerRef.current = resolvedContainer; 5132 setPortalNode(null); 5133 setContainerElement(resolvedContainer); 5134 } 5135 }, [containerProp, parentPortalNode]); 5136 const portalElement = useRenderElement("div", componentProps, { 5137 ref: [ref, setPortalNodeRef], 5138 props: [{ 5139 id: uniqueId, 5140 [attr]: "" 5141 }, elementProps] 5142 }); 5143 const portalSubtree = containerElement && portalElement ? /* @__PURE__ */ ReactDOM2.createPortal(portalElement, containerElement) : null; 5144 return { 5145 node: portalNode, 5146 // `id` and `render` props can override or remove the generated ID. Use the exact 5147 // rendered value so `aria-owns` never points at an ID absent from the DOM. 5148 nodeId: /* @__PURE__ */ React20.isValidElement(portalElement) ? portalElement.props.id : void 0, 5149 subtree: portalSubtree 5150 }; 5151 } 5152 var FloatingPortal = /* @__PURE__ */ React20.forwardRef(function FloatingPortal2(componentProps, forwardedRef) { 5153 const { 5154 render: render4, 5155 className, 5156 style, 5157 children, 5158 container, 5159 portalOwnerRole, 5160 ...elementProps 5161 } = componentProps; 5162 const { 5163 node: portalNode, 5164 nodeId: portalNodeId, 5165 subtree: portalSubtree 5166 } = useFloatingPortalNode({ 5167 container, 5168 ref: forwardedRef, 5169 componentProps, 5170 elementProps 5171 }); 5172 const beforeOutsideRef = React20.useRef(null); 5173 const afterOutsideRef = React20.useRef(null); 5174 const beforeInsideRef = React20.useRef(null); 5175 const afterInsideRef = React20.useRef(null); 5176 const [focusManagerState, setFocusManagerState] = React20.useState(null); 5177 const focusInsideDisabledRef = React20.useRef(false); 5178 const modal = focusManagerState?.modal; 5179 const open2 = focusManagerState?.open; 5180 const shouldRenderGuards = !!focusManagerState && !focusManagerState.modal && focusManagerState.open && !!portalNode; 5181 React20.useEffect(() => { 5182 if (!portalNode || modal) { 5183 return void 0; 5184 } 5185 function onFocus(event) { 5186 if (portalNode && event.relatedTarget && isOutsideEvent(event)) { 5187 if (event.type === "focusin") { 5188 if (focusInsideDisabledRef.current) { 5189 enableFocusInside(portalNode); 5190 focusInsideDisabledRef.current = false; 5191 } 5192 } else { 5193 disableFocusInside(portalNode); 5194 focusInsideDisabledRef.current = true; 5195 } 5196 } 5197 } 5198 return mergeCleanups(addEventListener(portalNode, "focusin", onFocus, true), addEventListener(portalNode, "focusout", onFocus, true)); 5199 }, [portalNode, modal]); 5200 useIsoLayoutEffect(() => { 5201 if (!portalNode || open2 !== true || !focusInsideDisabledRef.current) { 5202 return; 5203 } 5204 enableFocusInside(portalNode); 5205 focusInsideDisabledRef.current = false; 5206 }, [open2, portalNode]); 5207 const portalContextValue = React20.useMemo(() => ({ 5208 beforeOutsideRef, 5209 afterOutsideRef, 5210 beforeInsideRef, 5211 afterInsideRef, 5212 portalNode, 5213 setFocusManagerState 5214 }), [portalNode]); 5215 return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(React20.Fragment, { 5216 children: [portalSubtree, /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(PortalContext.Provider, { 5217 value: portalContextValue, 5218 children: [shouldRenderGuards && portalNode && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(FocusGuard, { 5219 "data-type": "outside", 5220 ref: beforeOutsideRef, 5221 onFocus: (event) => { 5222 if (isOutsideEvent(event, portalNode)) { 5223 beforeInsideRef.current?.focus(); 5224 } else { 5225 const domReference = focusManagerState ? focusManagerState.domReference : null; 5226 const prevTabbable = getPreviousTabbable(domReference); 5227 prevTabbable?.focus(); 5228 } 5229 } 5230 }), shouldRenderGuards && portalNode && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { 5231 role: portalOwnerRole, 5232 "aria-owns": portalNodeId, 5233 style: ownerVisuallyHidden 5234 }), portalNode && /* @__PURE__ */ ReactDOM2.createPortal(children, portalNode), shouldRenderGuards && portalNode && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(FocusGuard, { 5235 "data-type": "outside", 5236 ref: afterOutsideRef, 5237 onFocus: (event) => { 5238 if (isOutsideEvent(event, portalNode)) { 5239 afterInsideRef.current?.focus(); 5240 } else { 5241 const domReference = focusManagerState ? focusManagerState.domReference : null; 5242 const nextTabbable = getNextTabbable(domReference); 5243 nextTabbable?.focus(); 5244 if (focusManagerState?.closeOnFocusOut) { 5245 focusManagerState?.onOpenChange(false, createChangeEventDetails(reason_parts_exports.focusOut, event.nativeEvent)); 5246 } 5247 } 5248 } 5249 })] 5250 })] 5251 }); 5252 }); 5253 if (true) FloatingPortal.displayName = "FloatingPortal"; 5254 5255 // node_modules/@base-ui/react/floating-ui-react/components/FloatingTree.mjs 5256 var React21 = __toESM(require_react(), 1); 5257 5258 // node_modules/@base-ui/react/floating-ui-react/utils/createEventEmitter.mjs 5259 function createEventEmitter() { 5260 const map = /* @__PURE__ */ new Map(); 5261 return { 5262 emit(event, data) { 5263 map.get(event)?.forEach((listener) => listener(data)); 5264 }, 5265 on(event, listener) { 5266 if (!map.has(event)) { 5267 map.set(event, /* @__PURE__ */ new Set()); 5268 } 5269 map.get(event).add(listener); 5270 }, 5271 off(event, listener) { 5272 map.get(event)?.delete(listener); 5273 } 5274 }; 5275 } 5276 5277 // node_modules/@base-ui/react/floating-ui-react/components/FloatingTreeStore.mjs 5278 var FloatingTreeStore = class { 5279 nodesRef = { 5280 current: [] 5281 }; 5282 events = createEventEmitter(); 5283 addNode(node) { 5284 this.nodesRef.current.push(node); 5285 } 5286 removeNode(node) { 5287 const index2 = this.nodesRef.current.findIndex((n) => n === node); 5288 if (index2 !== -1) { 5289 this.nodesRef.current.splice(index2, 1); 5290 } 5291 } 5292 }; 5293 5294 // node_modules/@base-ui/react/floating-ui-react/components/FloatingTree.mjs 5295 var import_jsx_runtime39 = __toESM(require_jsx_runtime(), 1); 5296 var FloatingNodeContext = /* @__PURE__ */ React21.createContext(null); 5297 if (true) FloatingNodeContext.displayName = "FloatingNodeContext"; 5298 var FloatingTreeContext = /* @__PURE__ */ React21.createContext(null); 5299 if (true) FloatingTreeContext.displayName = "FloatingTreeContext"; 5300 var useFloatingParentNodeId = () => React21.useContext(FloatingNodeContext)?.id || null; 5301 var useFloatingTree = (externalTree) => { 5302 const contextTree = React21.useContext(FloatingTreeContext); 5303 return externalTree ?? contextTree; 5304 }; 5305 function useFloatingNodeId(externalTree) { 5306 const id = useId(); 5307 const tree = useFloatingTree(externalTree); 5308 const parentId = useFloatingParentNodeId(); 5309 useIsoLayoutEffect(() => { 5310 if (!id) { 5311 return void 0; 5312 } 5313 const node = { 5314 id, 5315 parentId 5316 }; 5317 tree?.addNode(node); 5318 return () => { 5319 tree?.removeNode(node); 5320 }; 5321 }, [tree, id, parentId]); 5322 return id; 5323 } 5324 function FloatingNode(props) { 5325 const { 5326 children, 5327 id 5328 } = props; 5329 const parentId = useFloatingParentNodeId(); 5330 return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(FloatingNodeContext.Provider, { 5331 value: React21.useMemo(() => ({ 5332 id, 5333 parentId 5334 }), [id, parentId]), 5335 children 5336 }); 5337 } 5338 function FloatingTree(props) { 5339 const { 5340 children, 5341 externalTree 5342 } = props; 5343 const tree = useRefWithInit(() => externalTree ?? new FloatingTreeStore()).current; 5344 return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(FloatingTreeContext.Provider, { 5345 value: tree, 5346 children 5347 }); 5348 } 5349 5350 // node_modules/@base-ui/react/floating-ui-react/components/FloatingFocusManager.mjs 5351 var import_jsx_runtime40 = __toESM(require_jsx_runtime(), 1); 5352 function getEventType(event, lastInteractionType) { 5353 const win = getWindow(getTarget(event)); 5354 if (event instanceof win.KeyboardEvent) { 5355 return "keyboard"; 5356 } 5357 if (event instanceof win.FocusEvent) { 5358 return lastInteractionType || "keyboard"; 5359 } 5360 if ("pointerType" in event) { 5361 return event.pointerType || "keyboard"; 5362 } 5363 if ("touches" in event) { 5364 return "touch"; 5365 } 5366 if (event instanceof win.MouseEvent) { 5367 return lastInteractionType || (event.detail === 0 ? "keyboard" : "mouse"); 5368 } 5369 return ""; 5370 } 5371 var LIST_LIMIT = 20; 5372 var previouslyFocusedElements = []; 5373 function clearDisconnectedPreviouslyFocusedElements() { 5374 previouslyFocusedElements = previouslyFocusedElements.filter((entry) => { 5375 return entry.deref()?.isConnected; 5376 }); 5377 } 5378 function addPreviouslyFocusedElement(element) { 5379 clearDisconnectedPreviouslyFocusedElements(); 5380 if (element && getNodeName(element) !== "body") { 5381 previouslyFocusedElements.push(new WeakRef(element)); 5382 if (previouslyFocusedElements.length > LIST_LIMIT) { 5383 previouslyFocusedElements = previouslyFocusedElements.slice(-LIST_LIMIT); 5384 } 5385 } 5386 } 5387 function getPreviouslyFocusedElement() { 5388 clearDisconnectedPreviouslyFocusedElements(); 5389 return previouslyFocusedElements[previouslyFocusedElements.length - 1]?.deref(); 5390 } 5391 function getFirstTabbableElement(container) { 5392 if (!container) { 5393 return null; 5394 } 5395 if (isTabbable(container)) { 5396 return container; 5397 } 5398 return tabbable(container)[0] || container; 5399 } 5400 function handleTabIndex(floatingFocusElement) { 5401 if (floatingFocusElement.hasAttribute("tabindex") && !floatingFocusElement.hasAttribute("data-tabindex")) { 5402 return; 5403 } 5404 if (!floatingFocusElement.getAttribute("role")?.includes("dialog")) { 5405 return; 5406 } 5407 const focusableElements = focusable(floatingFocusElement); 5408 const tabbableContent = focusableElements.filter((element) => { 5409 const dataTabIndex = element.getAttribute("data-tabindex") || ""; 5410 return isTabbable(element) || element.hasAttribute("data-tabindex") && !dataTabIndex.startsWith("-"); 5411 }); 5412 const tabIndex = floatingFocusElement.getAttribute("tabindex"); 5413 if (tabbableContent.length === 0) { 5414 if (tabIndex !== "0") { 5415 floatingFocusElement.setAttribute("tabindex", "0"); 5416 floatingFocusElement.setAttribute("data-tabindex", "0"); 5417 } 5418 } else if (tabIndex !== "-1" || floatingFocusElement.hasAttribute("data-tabindex") && floatingFocusElement.getAttribute("data-tabindex") !== "-1") { 5419 floatingFocusElement.setAttribute("tabindex", "-1"); 5420 floatingFocusElement.setAttribute("data-tabindex", "-1"); 5421 } 5422 } 5423 function FloatingFocusManager(props) { 5424 const { 5425 context, 5426 children, 5427 disabled: disabled2 = false, 5428 initialFocus = true, 5429 returnFocus = true, 5430 restoreFocus = false, 5431 modal = true, 5432 closeOnFocusOut = true, 5433 openInteractionType = "", 5434 nextFocusableElement, 5435 previousFocusableElement, 5436 beforeContentFocusGuardRef, 5437 externalTree, 5438 getInsideElements 5439 } = props; 5440 const store = "rootStore" in context ? context.rootStore : context; 5441 const open2 = store.useState("open"); 5442 const domReference = store.useState("domReferenceElement"); 5443 const floating = store.useState("floatingElement"); 5444 const { 5445 events, 5446 dataRef 5447 } = store.context; 5448 const getNodeId = useStableCallback(() => dataRef.current.floatingContext?.nodeId); 5449 const ignoreInitialFocus = initialFocus === false; 5450 const isUntrappedTypeableCombobox = isTypeableCombobox(domReference) && ignoreInitialFocus; 5451 const initialFocusRef = useValueAsRef(initialFocus); 5452 const returnFocusRef = useValueAsRef(returnFocus); 5453 const openInteractionTypeRef = useValueAsRef(openInteractionType); 5454 const openRef = useValueAsRef(open2); 5455 const tree = useFloatingTree(externalTree); 5456 const portalContext = usePortalContext(); 5457 const preventReturnFocusRef = React22.useRef(false); 5458 const isPointerDownRef = React22.useRef(false); 5459 const pointerDownOutsideRef = React22.useRef(false); 5460 const lastFocusedTabbableRef = React22.useRef(null); 5461 const closeTypeRef = React22.useRef(""); 5462 const lastInteractionTypeRef = React22.useRef(""); 5463 const beforeGuardRef = React22.useRef(null); 5464 const afterGuardRef = React22.useRef(null); 5465 const mergedBeforeGuardRef = useMergedRefs(beforeGuardRef, beforeContentFocusGuardRef, portalContext?.beforeInsideRef); 5466 const mergedAfterGuardRef = useMergedRefs(afterGuardRef, portalContext?.afterInsideRef); 5467 const blurTimeout = useTimeout(); 5468 const pointerDownTimeout = useTimeout(); 5469 const restoreFocusFrame = useAnimationFrame(); 5470 const isInsidePortal = portalContext != null; 5471 const floatingFocusElement = getFloatingFocusElement(floating); 5472 const getTabbableContent = useStableCallback((container = floatingFocusElement) => { 5473 return container ? tabbable(container) : []; 5474 }); 5475 const getResolvedInsideElements = useStableCallback(() => getInsideElements?.().filter((element) => element != null) ?? []); 5476 React22.useEffect(() => { 5477 if (disabled2 || !modal) { 5478 return void 0; 5479 } 5480 function onKeyDown(event) { 5481 if (event.key === "Tab") { 5482 if (contains(floatingFocusElement, activeElement(ownerDocument(floatingFocusElement))) && getTabbableContent().length === 0 && !isUntrappedTypeableCombobox) { 5483 stopEvent(event); 5484 } 5485 } 5486 } 5487 const doc = ownerDocument(floatingFocusElement); 5488 return addEventListener(doc, "keydown", onKeyDown); 5489 }, [disabled2, floatingFocusElement, modal, isUntrappedTypeableCombobox, getTabbableContent]); 5490 React22.useEffect(() => { 5491 if (disabled2 || !open2) { 5492 return void 0; 5493 } 5494 const doc = ownerDocument(floatingFocusElement); 5495 function clearPointerDownOutside() { 5496 pointerDownOutsideRef.current = false; 5497 } 5498 function onPointerDown(event) { 5499 const target = getTarget(event); 5500 const insideElements = getResolvedInsideElements(); 5501 const pointerTargetInside = contains(floating, target) || contains(domReference, target) || contains(portalContext?.portalNode, target) || insideElements.some((element) => element === target || contains(element, target)); 5502 pointerDownOutsideRef.current = !pointerTargetInside; 5503 lastInteractionTypeRef.current = event.pointerType || "keyboard"; 5504 if (target?.closest(`[$CLICK_TRIGGER_IDENTIFIER}]`)) { 5505 isPointerDownRef.current = true; 5506 pointerDownTimeout.start(0, () => { 5507 isPointerDownRef.current = false; 5508 }); 5509 } 5510 } 5511 function onKeyDown() { 5512 lastInteractionTypeRef.current = "keyboard"; 5513 } 5514 return mergeCleanups( 5515 addEventListener(doc, "pointerdown", onPointerDown, true), 5516 addEventListener(doc, "pointerup", clearPointerDownOutside, true), 5517 addEventListener(doc, "pointercancel", clearPointerDownOutside, true), 5518 addEventListener(doc, "keydown", onKeyDown, true), 5519 // Avoid a stale `true` leaking into the next open (e.g. keep-mounted popups) 5520 // if the popup dismissed between pointerdown and pointerup. 5521 clearPointerDownOutside 5522 ); 5523 }, [disabled2, floating, domReference, floatingFocusElement, open2, portalContext, pointerDownTimeout, getResolvedInsideElements]); 5524 React22.useEffect(() => { 5525 if (disabled2 || !closeOnFocusOut) { 5526 return void 0; 5527 } 5528 const doc = ownerDocument(floatingFocusElement); 5529 function handlePointerDown() { 5530 isPointerDownRef.current = true; 5531 pointerDownTimeout.start(0, () => { 5532 isPointerDownRef.current = false; 5533 }); 5534 } 5535 function handleFocusIn(event) { 5536 const target = getTarget(event); 5537 if (isTabbable(target)) { 5538 lastFocusedTabbableRef.current = target; 5539 } 5540 } 5541 function handleFocusOutside(event) { 5542 const relatedTarget = event.relatedTarget; 5543 const currentTarget = event.currentTarget; 5544 const target = getTarget(event); 5545 if (modal && relatedTarget == null && target != null && contains(floating, target)) { 5546 addPreviouslyFocusedElement(target); 5547 } 5548 queueMicrotask(() => { 5549 const nodeId = getNodeId(); 5550 const triggers = store.context.triggerElements; 5551 const insideElements = getResolvedInsideElements(); 5552 const isRelatedFocusGuard = relatedTarget?.hasAttribute(createAttribute("focus-guard")) && [beforeGuardRef.current, afterGuardRef.current, portalContext?.beforeInsideRef.current, portalContext?.afterInsideRef.current, portalContext?.beforeOutsideRef.current, portalContext?.afterOutsideRef.current, resolveRef(previousFocusableElement), resolveRef(nextFocusableElement)].includes(relatedTarget); 5553 const movedToUnrelatedNode = !(contains(domReference, relatedTarget) || contains(floating, relatedTarget) || contains(relatedTarget, floating) || contains(portalContext?.portalNode, relatedTarget) || insideElements.some((element) => element === relatedTarget || contains(element, relatedTarget)) || triggers.hasMatchingElement((trigger) => contains(trigger, relatedTarget)) || isRelatedFocusGuard || tree && (getNodeChildren(tree.nodesRef.current, nodeId).find((node) => contains(node.context?.elements.floating, relatedTarget) || contains(node.context?.elements.domReference, relatedTarget)) || getNodeAncestors(tree.nodesRef.current, nodeId).find((node) => [node.context?.elements.floating, getFloatingFocusElement(node.context?.elements.floating)].includes(relatedTarget) || node.context?.elements.domReference === relatedTarget))); 5554 if (currentTarget === domReference && floatingFocusElement) { 5555 handleTabIndex(floatingFocusElement); 5556 } 5557 if (restoreFocus && currentTarget !== domReference && !isElementVisible(target) && activeElement(doc) === doc.body) { 5558 if (isHTMLElement(floatingFocusElement)) { 5559 floatingFocusElement.focus(); 5560 if (restoreFocus === "popup") { 5561 restoreFocusFrame.request(() => { 5562 floatingFocusElement.focus(); 5563 }); 5564 return; 5565 } 5566 } 5567 const tabbableContent = getTabbableContent(); 5568 const prevTabbable = lastFocusedTabbableRef.current; 5569 const nodeToFocus = (prevTabbable && tabbableContent.includes(prevTabbable) ? prevTabbable : null) || tabbableContent[tabbableContent.length - 1] || floatingFocusElement; 5570 if (isHTMLElement(nodeToFocus)) { 5571 nodeToFocus.focus(); 5572 } 5573 } 5574 if (dataRef.current.insideReactTree) { 5575 dataRef.current.insideReactTree = false; 5576 return; 5577 } 5578 if ((isUntrappedTypeableCombobox ? true : !modal) && relatedTarget && movedToUnrelatedNode && !isPointerDownRef.current && // Fix React 18 Strict Mode returnFocus due to double rendering. 5579 // For an "untrapped" typeable combobox (input role=combobox with 5580 // initialFocus=false), re-opening the popup and tabbing out should still close it even 5581 // when the previously focused element (e.g. the next tabbable outside the popup) is 5582 // focused again. Otherwise, the popup remains open on the second Tab sequence: 5583 // click input -> Tab (closes) -> click input -> Tab. 5584 // Allow closing when `isUntrappedTypeableCombobox` regardless of the previously focused element. 5585 (isUntrappedTypeableCombobox || relatedTarget !== getPreviouslyFocusedElement())) { 5586 preventReturnFocusRef.current = true; 5587 store.setOpen(false, createChangeEventDetails(reason_parts_exports.focusOut, event)); 5588 } 5589 }); 5590 } 5591 function markInsideReactTree() { 5592 if (pointerDownOutsideRef.current) { 5593 return; 5594 } 5595 dataRef.current.insideReactTree = true; 5596 blurTimeout.start(0, () => { 5597 dataRef.current.insideReactTree = false; 5598 }); 5599 } 5600 const domReferenceElement = isHTMLElement(domReference) ? domReference : null; 5601 if (!floating && !domReferenceElement) { 5602 return void 0; 5603 } 5604 return mergeCleanups(domReferenceElement && addEventListener(domReferenceElement, "focusout", handleFocusOutside), domReferenceElement && addEventListener(domReferenceElement, "pointerdown", handlePointerDown), floating && addEventListener(floating, "focusin", handleFocusIn), floating && addEventListener(floating, "focusout", handleFocusOutside), floating && portalContext && addEventListener(floating, "focusout", markInsideReactTree, true)); 5605 }, [disabled2, domReference, floating, floatingFocusElement, modal, tree, portalContext, store, closeOnFocusOut, restoreFocus, getTabbableContent, isUntrappedTypeableCombobox, getNodeId, dataRef, blurTimeout, pointerDownTimeout, restoreFocusFrame, nextFocusableElement, previousFocusableElement, getResolvedInsideElements]); 5606 React22.useEffect(() => { 5607 if (disabled2 || !floating || !open2) { 5608 return void 0; 5609 } 5610 const portalNodes = Array.from(portalContext?.portalNode?.querySelectorAll(`[$createAttribute("portal")}]`) || []); 5611 const ancestors = tree ? getNodeAncestors(tree.nodesRef.current, getNodeId()) : []; 5612 const rootAncestorComboboxDomReference = ancestors.find((node) => isTypeableCombobox(node.context?.elements.domReference || null))?.context?.elements.domReference; 5613 const controlInsideElements = [floating, ...portalNodes, beforeGuardRef.current, afterGuardRef.current, portalContext?.beforeOutsideRef.current, portalContext?.afterOutsideRef.current, ...getResolvedInsideElements()]; 5614 const insideElements = [...controlInsideElements, rootAncestorComboboxDomReference, resolveRef(previousFocusableElement), resolveRef(nextFocusableElement), isUntrappedTypeableCombobox ? domReference : null].filter((x2) => x2 != null); 5615 const ariaHiddenCleanup = markOthers(insideElements, { 5616 ariaHidden: modal || isUntrappedTypeableCombobox, 5617 mark: false 5618 }); 5619 const markerInsideElements = [floating, ...portalNodes].filter((x2) => x2 != null); 5620 const markerCleanup = markOthers(markerInsideElements); 5621 return () => { 5622 markerCleanup(); 5623 ariaHiddenCleanup(); 5624 }; 5625 }, [open2, disabled2, domReference, floating, modal, portalContext, isUntrappedTypeableCombobox, tree, getNodeId, nextFocusableElement, previousFocusableElement, getResolvedInsideElements]); 5626 useIsoLayoutEffect(() => { 5627 if (!open2 || disabled2 || !isHTMLElement(floatingFocusElement)) { 5628 return; 5629 } 5630 closeTypeRef.current = ""; 5631 lastInteractionTypeRef.current = ""; 5632 const doc = ownerDocument(floatingFocusElement); 5633 const previouslyFocusedElement = activeElement(doc); 5634 queueMicrotask(() => { 5635 const initialFocusValueOrFn = initialFocusRef.current; 5636 const resolvedInitialFocus = typeof initialFocusValueOrFn === "function" ? initialFocusValueOrFn(openInteractionTypeRef.current || "") : initialFocusValueOrFn; 5637 if (resolvedInitialFocus === void 0 || resolvedInitialFocus === false) { 5638 return; 5639 } 5640 const focusAlreadyInsideFloatingEl = contains(floatingFocusElement, previouslyFocusedElement); 5641 if (focusAlreadyInsideFloatingEl) { 5642 return; 5643 } 5644 let focusableElements = null; 5645 const getDefaultFocusElement = () => { 5646 if (focusableElements == null) { 5647 focusableElements = getTabbableContent(floatingFocusElement); 5648 } 5649 return focusableElements[0] || floatingFocusElement; 5650 }; 5651 let elToFocus; 5652 if (resolvedInitialFocus === true || resolvedInitialFocus === null) { 5653 elToFocus = getDefaultFocusElement(); 5654 } else { 5655 elToFocus = resolveRef(resolvedInitialFocus); 5656 } 5657 elToFocus = elToFocus || getDefaultFocusElement(); 5658 const hadFocusInside = contains(floatingFocusElement, activeElement(doc)); 5659 void enqueueFocus(elToFocus, { 5660 preventScroll: elToFocus === floatingFocusElement, 5661 shouldFocus() { 5662 if (!openRef.current) { 5663 return false; 5664 } 5665 if (hadFocusInside) { 5666 return true; 5667 } 5668 const currentActiveElement = activeElement(doc); 5669 const focusMovedInside = currentActiveElement !== elToFocus && contains(floatingFocusElement, currentActiveElement); 5670 return !focusMovedInside; 5671 } 5672 }); 5673 }); 5674 }, [disabled2, open2, floatingFocusElement, getTabbableContent, initialFocusRef, openInteractionTypeRef, openRef]); 5675 useIsoLayoutEffect(() => { 5676 if (disabled2 || !floatingFocusElement) { 5677 return void 0; 5678 } 5679 const doc = ownerDocument(floatingFocusElement); 5680 const elementFocusedBeforeOpen = activeElement(doc); 5681 const preferPreviousFocus = openInteractionTypeRef.current == null; 5682 addPreviouslyFocusedElement(elementFocusedBeforeOpen); 5683 function onOpenChangeLocal(details) { 5684 if (!details.open) { 5685 closeTypeRef.current = getEventType(details.nativeEvent, lastInteractionTypeRef.current); 5686 } 5687 if (details.reason === reason_parts_exports.triggerHover && details.nativeEvent.type === "mouseleave") { 5688 preventReturnFocusRef.current = true; 5689 } 5690 if (details.reason !== reason_parts_exports.outsidePress) { 5691 return; 5692 } 5693 if (details.nested) { 5694 preventReturnFocusRef.current = false; 5695 } else if (isVirtualClick(details.nativeEvent) || isVirtualPointerEvent(details.nativeEvent)) { 5696 preventReturnFocusRef.current = false; 5697 } else { 5698 let isPreventScrollSupported = false; 5699 ownerDocument(floatingFocusElement).createElement("div").focus({ 5700 get preventScroll() { 5701 isPreventScrollSupported = true; 5702 return false; 5703 } 5704 }); 5705 if (isPreventScrollSupported) { 5706 preventReturnFocusRef.current = false; 5707 } else { 5708 preventReturnFocusRef.current = true; 5709 } 5710 } 5711 } 5712 events.on("openchange", onOpenChangeLocal); 5713 function getReturnElement(closeType) { 5714 const returnFocusValueOrFn = returnFocusRef.current; 5715 let resolvedReturnFocusValue = typeof returnFocusValueOrFn === "function" ? returnFocusValueOrFn(closeType) : returnFocusValueOrFn; 5716 if (resolvedReturnFocusValue === void 0 || resolvedReturnFocusValue === false) { 5717 return null; 5718 } 5719 if (resolvedReturnFocusValue === null) { 5720 resolvedReturnFocusValue = true; 5721 } 5722 const referenceReturnElement = domReference?.isConnected ? domReference : null; 5723 const previousReturnElement = elementFocusedBeforeOpen?.isConnected && getNodeName(elementFocusedBeforeOpen) !== "body" ? elementFocusedBeforeOpen : null; 5724 let defaultReturnElement = preferPreviousFocus ? previousReturnElement || referenceReturnElement : referenceReturnElement || previousReturnElement; 5725 if (!defaultReturnElement) { 5726 defaultReturnElement = getPreviouslyFocusedElement() || null; 5727 } 5728 if (typeof resolvedReturnFocusValue === "boolean") { 5729 return defaultReturnElement; 5730 } 5731 return resolveRef(resolvedReturnFocusValue) || defaultReturnElement || null; 5732 } 5733 return () => { 5734 events.off("openchange", onOpenChangeLocal); 5735 const activeEl = activeElement(doc); 5736 const insideElements = getResolvedInsideElements(); 5737 const isFocusInsideFloatingTree = contains(floating, activeEl) || insideElements.some((element) => element === activeEl || contains(element, activeEl)) || tree && getNodeChildren(tree.nodesRef.current, getNodeId(), false).some((node) => contains(node.context?.elements.floating, activeEl)); 5738 const returnFocusValueOrFn = returnFocusRef.current; 5739 const closeType = closeTypeRef.current; 5740 const returnElement = getReturnElement(closeType); 5741 queueMicrotask(() => { 5742 const tabbableReturnElement = getFirstTabbableElement(returnElement); 5743 const hasExplicitReturnFocus = typeof returnFocusValueOrFn !== "boolean"; 5744 if (returnFocusValueOrFn && !preventReturnFocusRef.current && isHTMLElement(tabbableReturnElement) && // If the focus moved somewhere else after mount, avoid returning focus 5745 // since it likely entered a different element which should be 5746 // respected: https://github.com/floating-ui/floating-ui/issues/2607 5747 (!hasExplicitReturnFocus && tabbableReturnElement !== activeEl && activeEl !== doc.body ? isFocusInsideFloatingTree : true)) { 5748 const focusOptions = { 5749 preventScroll: true 5750 }; 5751 if (closeType === "keyboard") { 5752 focusOptions.focusVisible = true; 5753 } 5754 tabbableReturnElement.focus(focusOptions); 5755 } 5756 preventReturnFocusRef.current = false; 5757 }); 5758 }; 5759 }, [disabled2, floating, floatingFocusElement, returnFocusRef, openInteractionTypeRef, events, tree, domReference, getNodeId, getResolvedInsideElements]); 5760 useIsoLayoutEffect(() => { 5761 if (!parts_exports.engine.webkit || open2 || !floating) { 5762 return; 5763 } 5764 const activeEl = activeElement(ownerDocument(floating)); 5765 if (!isHTMLElement(activeEl) || !isTypeableElement(activeEl)) { 5766 return; 5767 } 5768 if (contains(floating, activeEl)) { 5769 activeEl.blur(); 5770 } 5771 }, [open2, floating]); 5772 useIsoLayoutEffect(() => { 5773 if (disabled2 || !portalContext) { 5774 return void 0; 5775 } 5776 portalContext.setFocusManagerState({ 5777 modal, 5778 closeOnFocusOut, 5779 open: open2, 5780 onOpenChange: store.setOpen, 5781 domReference 5782 }); 5783 return () => { 5784 portalContext.setFocusManagerState(null); 5785 }; 5786 }, [disabled2, portalContext, modal, open2, store, closeOnFocusOut, domReference]); 5787 useIsoLayoutEffect(() => { 5788 if (disabled2 || !floatingFocusElement) { 5789 return void 0; 5790 } 5791 handleTabIndex(floatingFocusElement); 5792 return () => { 5793 queueMicrotask(clearDisconnectedPreviouslyFocusedElements); 5794 }; 5795 }, [disabled2, floatingFocusElement]); 5796 const shouldRenderGuards = !disabled2 && (modal ? !isUntrappedTypeableCombobox : true) && (isInsidePortal || modal); 5797 return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(React22.Fragment, { 5798 children: [shouldRenderGuards && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(FocusGuard, { 5799 "data-type": "inside", 5800 ref: mergedBeforeGuardRef, 5801 onFocus: (event) => { 5802 if (modal) { 5803 const els = getTabbableContent(); 5804 void enqueueFocus(els[els.length - 1]); 5805 } else if (portalContext?.portalNode) { 5806 preventReturnFocusRef.current = false; 5807 if (isOutsideEvent(event, portalContext.portalNode)) { 5808 const nextTabbable = getNextTabbable(domReference); 5809 nextTabbable?.focus(); 5810 } else { 5811 resolveRef(previousFocusableElement ?? portalContext.beforeOutsideRef)?.focus(); 5812 } 5813 } 5814 } 5815 }), children, shouldRenderGuards && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(FocusGuard, { 5816 "data-type": "inside", 5817 ref: mergedAfterGuardRef, 5818 onFocus: (event) => { 5819 if (modal) { 5820 void enqueueFocus(getTabbableContent()[0]); 5821 } else if (portalContext?.portalNode) { 5822 if (closeOnFocusOut) { 5823 preventReturnFocusRef.current = true; 5824 } 5825 if (isOutsideEvent(event, portalContext.portalNode)) { 5826 const prevTabbable = getPreviousTabbable(domReference); 5827 prevTabbable?.focus(); 5828 } else { 5829 resolveRef(nextFocusableElement ?? portalContext.afterOutsideRef)?.focus(); 5830 } 5831 } 5832 } 5833 })] 5834 }); 5835 } 5836 5837 // node_modules/@base-ui/react/floating-ui-react/hooks/useClick.mjs 5838 var React23 = __toESM(require_react(), 1); 5839 function useClick(context, props = {}) { 5840 const { 5841 enabled = true, 5842 event: eventOption = "click", 5843 toggle = true, 5844 ignoreMouse = false, 5845 stickIfOpen = true, 5846 touchOpenDelay = 0, 5847 reason = reason_parts_exports.triggerPress 5848 } = props; 5849 const store = "rootStore" in context ? context.rootStore : context; 5850 const dataRef = store.context.dataRef; 5851 const pointerTypeRef = React23.useRef(void 0); 5852 const frame = useAnimationFrame(); 5853 const touchOpenTimeout = useTimeout(); 5854 const reference = React23.useMemo(() => { 5855 function setOpenWithTouchDelay(nextOpen, nativeEvent, target, pointerType) { 5856 const details = createChangeEventDetails(reason, nativeEvent, target); 5857 if (nextOpen && pointerType === "touch" && touchOpenDelay > 0) { 5858 touchOpenTimeout.start(touchOpenDelay, () => { 5859 store.setOpen(true, details); 5860 }); 5861 } else { 5862 store.setOpen(nextOpen, details); 5863 } 5864 } 5865 function getNextOpen(open2, currentTarget, isClickLikeOpenEvent2) { 5866 const openEvent = dataRef.current.openEvent; 5867 const hasClickedOnInactiveTrigger = store.select("domReferenceElement") !== currentTarget; 5868 if (open2 && hasClickedOnInactiveTrigger) { 5869 return true; 5870 } 5871 if (!open2) { 5872 return true; 5873 } 5874 if (!toggle) { 5875 return true; 5876 } 5877 if (openEvent && stickIfOpen) { 5878 return !isClickLikeOpenEvent2(openEvent.type); 5879 } 5880 return false; 5881 } 5882 return { 5883 onPointerDown(event) { 5884 pointerTypeRef.current = isMouseLikePointerType(event.pointerType, true) && isVirtualPointerEvent(event.nativeEvent) ? "virtual" : event.pointerType; 5885 }, 5886 onMouseDown(event) { 5887 const pointerType = pointerTypeRef.current; 5888 const nativeEvent = event.nativeEvent; 5889 const open2 = store.select("open"); 5890 if (event.button !== 0 || eventOption === "click" || isMouseLikePointerType(pointerType, true) && ignoreMouse) { 5891 return; 5892 } 5893 const nextOpen = getNextOpen(open2, event.currentTarget, (openEventType) => openEventType === "click" || openEventType === "mousedown"); 5894 const target = getTarget(nativeEvent); 5895 if (isTypeableElement(target)) { 5896 setOpenWithTouchDelay(nextOpen, nativeEvent, target, pointerType); 5897 return; 5898 } 5899 const eventCurrentTarget = event.currentTarget; 5900 frame.request(() => { 5901 setOpenWithTouchDelay(nextOpen, nativeEvent, eventCurrentTarget, pointerType); 5902 }); 5903 }, 5904 onClick(event) { 5905 if (eventOption === "mousedown-only") { 5906 return; 5907 } 5908 const pointerType = pointerTypeRef.current; 5909 if (eventOption === "mousedown" && pointerType) { 5910 pointerTypeRef.current = void 0; 5911 return; 5912 } 5913 if (isMouseLikePointerType(pointerType, true) && ignoreMouse) { 5914 return; 5915 } 5916 const open2 = store.select("open"); 5917 const nextOpen = getNextOpen(open2, event.currentTarget, (openEventType) => openEventType === "click" || openEventType === "mousedown" || openEventType === "keydown" || openEventType === "keyup"); 5918 setOpenWithTouchDelay(nextOpen, event.nativeEvent, event.currentTarget, pointerType); 5919 }, 5920 onKeyDown() { 5921 pointerTypeRef.current = void 0; 5922 } 5923 }; 5924 }, [dataRef, eventOption, ignoreMouse, reason, store, stickIfOpen, toggle, frame, touchOpenTimeout, touchOpenDelay]); 5925 return React23.useMemo(() => enabled ? { 5926 reference 5927 } : EMPTY_OBJECT, [enabled, reference]); 5928 } 5929 5930 // node_modules/@base-ui/react/floating-ui-react/hooks/useClientPoint.mjs 5931 var React24 = __toESM(require_react(), 1); 5932 function createVirtualElement(domElement, data) { 5933 let offsetX = null; 5934 let offsetY = null; 5935 let isAutoUpdateEvent = false; 5936 return { 5937 contextElement: domElement || void 0, 5938 getBoundingClientRect() { 5939 const domRect = domElement?.getBoundingClientRect() || { 5940 width: 0, 5941 height: 0, 5942 x: 0, 5943 y: 0 5944 }; 5945 const isXAxis = data.axis === "x" || data.axis === "both"; 5946 const isYAxis = data.axis === "y" || data.axis === "both"; 5947 const canTrackCursorOnAutoUpdate = ["mouseenter", "mousemove"].includes(data.dataRef.current.openEvent?.type || "") && data.pointerType !== "touch"; 5948 let width = domRect.width; 5949 let height = domRect.height; 5950 let x2 = domRect.x; 5951 let y2 = domRect.y; 5952 if (offsetX == null && data.x && isXAxis) { 5953 offsetX = domRect.x - data.x; 5954 } 5955 if (offsetY == null && data.y && isYAxis) { 5956 offsetY = domRect.y - data.y; 5957 } 5958 x2 -= offsetX || 0; 5959 y2 -= offsetY || 0; 5960 width = 0; 5961 height = 0; 5962 if (!isAutoUpdateEvent || canTrackCursorOnAutoUpdate) { 5963 width = data.axis === "y" ? domRect.width : 0; 5964 height = data.axis === "x" ? domRect.height : 0; 5965 x2 = isXAxis && data.x != null ? data.x : x2; 5966 y2 = isYAxis && data.y != null ? data.y : y2; 5967 } else if (isAutoUpdateEvent && !canTrackCursorOnAutoUpdate) { 5968 height = data.axis === "x" ? domRect.height : height; 5969 width = data.axis === "y" ? domRect.width : width; 5970 } 5971 isAutoUpdateEvent = true; 5972 return { 5973 width, 5974 height, 5975 x: x2, 5976 y: y2, 5977 top: y2, 5978 right: x2 + width, 5979 bottom: y2 + height, 5980 left: x2 5981 }; 5982 } 5983 }; 5984 } 5985 function isMouseBasedEvent(event) { 5986 return event != null && event.clientX != null; 5987 } 5988 function useClientPoint(context, props = {}) { 5989 const { 5990 enabled = true, 5991 axis = "both" 5992 } = props; 5993 const store = "rootStore" in context ? context.rootStore : context; 5994 const open2 = store.useState("open"); 5995 const floating = store.useState("floatingElement"); 5996 const domReference = store.useState("domReferenceElement"); 5997 const dataRef = store.context.dataRef; 5998 const initialRef = React24.useRef(false); 5999 const cleanupListenerRef = React24.useRef(null); 6000 const [pointerType, setPointerType] = React24.useState(); 6001 const [reactive, setReactive] = React24.useState([]); 6002 const resetReference = useStableCallback((reference2) => { 6003 store.set("positionReference", reference2); 6004 }); 6005 const setReference = useStableCallback((newX, newY, referenceElement) => { 6006 if (initialRef.current) { 6007 return; 6008 } 6009 if (dataRef.current.openEvent && !isMouseBasedEvent(dataRef.current.openEvent)) { 6010 return; 6011 } 6012 store.set("positionReference", createVirtualElement(referenceElement ?? domReference, { 6013 x: newX, 6014 y: newY, 6015 axis, 6016 dataRef, 6017 pointerType 6018 })); 6019 }); 6020 const handleReferenceEnterOrMove = useStableCallback((event) => { 6021 if (!open2) { 6022 setReference(event.clientX, event.clientY, event.currentTarget); 6023 } else if (!cleanupListenerRef.current) { 6024 setReference(event.clientX, event.clientY, event.currentTarget); 6025 setReactive([]); 6026 } 6027 }); 6028 const openCheck = isMouseLikePointerType(pointerType) ? floating : open2; 6029 React24.useEffect(() => { 6030 if (!enabled) { 6031 resetReference(domReference); 6032 return void 0; 6033 } 6034 if (!openCheck) { 6035 return void 0; 6036 } 6037 function cleanupListener() { 6038 cleanupListenerRef.current?.(); 6039 cleanupListenerRef.current = null; 6040 } 6041 const win = getWindow(floating); 6042 function handleMouseMove(event) { 6043 const target = getTarget(event); 6044 if (!contains(floating, target)) { 6045 setReference(event.clientX, event.clientY); 6046 } else { 6047 cleanupListener(); 6048 } 6049 } 6050 if (!dataRef.current.openEvent || isMouseBasedEvent(dataRef.current.openEvent)) { 6051 cleanupListenerRef.current = addEventListener(win, "mousemove", handleMouseMove); 6052 } else { 6053 resetReference(domReference); 6054 } 6055 return cleanupListener; 6056 }, [openCheck, enabled, floating, dataRef, domReference, store, setReference, resetReference, reactive]); 6057 React24.useEffect(() => () => { 6058 store.set("positionReference", null); 6059 }, [store]); 6060 React24.useEffect(() => { 6061 if (enabled && !floating) { 6062 initialRef.current = false; 6063 } 6064 }, [enabled, floating]); 6065 React24.useEffect(() => { 6066 if (!enabled && open2) { 6067 initialRef.current = true; 6068 } 6069 }, [enabled, open2]); 6070 const reference = React24.useMemo(() => { 6071 function setPointerTypeRef(event) { 6072 setPointerType(event.pointerType); 6073 } 6074 return { 6075 onPointerDown: setPointerTypeRef, 6076 onPointerEnter: setPointerTypeRef, 6077 onMouseMove: handleReferenceEnterOrMove, 6078 onMouseEnter: handleReferenceEnterOrMove 6079 }; 6080 }, [handleReferenceEnterOrMove]); 6081 return React24.useMemo(() => enabled ? { 6082 reference, 6083 trigger: reference 6084 } : {}, [enabled, reference]); 6085 } 6086 6087 // node_modules/@base-ui/react/floating-ui-react/hooks/useDismiss.mjs 6088 var React25 = __toESM(require_react(), 1); 6089 function alwaysFalse() { 6090 return false; 6091 } 6092 function normalizeProp(normalizable) { 6093 return { 6094 escapeKey: typeof normalizable === "boolean" ? normalizable : normalizable?.escapeKey ?? false, 6095 outsidePress: typeof normalizable === "boolean" ? normalizable : normalizable?.outsidePress ?? true 6096 }; 6097 } 6098 function useDismiss(context, props = {}) { 6099 const { 6100 enabled = true, 6101 escapeKey: escapeKey2 = true, 6102 outsidePress: outsidePressProp = true, 6103 outsidePressEvent = "sloppy", 6104 referencePress = alwaysFalse, 6105 bubbles, 6106 externalTree 6107 } = props; 6108 const store = "rootStore" in context ? context.rootStore : context; 6109 const open2 = store.useState("open"); 6110 const floatingElement = store.useState("floatingElement"); 6111 const { 6112 dataRef, 6113 events 6114 } = store.context; 6115 const tree = useFloatingTree(externalTree); 6116 const outsidePressFn = useStableCallback(typeof outsidePressProp === "function" ? outsidePressProp : () => false); 6117 const outsidePress2 = typeof outsidePressProp === "function" ? outsidePressFn : outsidePressProp; 6118 const outsidePressEnabled = outsidePress2 !== false; 6119 const getOutsidePressEventProp = useStableCallback(() => outsidePressEvent); 6120 const { 6121 escapeKey: escapeKeyBubbles, 6122 outsidePress: outsidePressBubbles 6123 } = normalizeProp(bubbles); 6124 const pressStartedInsideRef = React25.useRef(false); 6125 const pressStartPreventedRef = React25.useRef(false); 6126 const suppressNextOutsideClickRef = React25.useRef(false); 6127 const sawPressWhileOpenRef = React25.useRef(false); 6128 const isComposingRef = React25.useRef(false); 6129 const currentPointerTypeRef = React25.useRef(""); 6130 const touchStateRef = React25.useRef(null); 6131 const cancelDismissOnEndTimeout = useTimeout(); 6132 const clearInsideReactTreeTimeout = useTimeout(); 6133 const clearInsideReactTree = useStableCallback(() => { 6134 clearInsideReactTreeTimeout.clear(); 6135 dataRef.current.insideReactTree = false; 6136 }); 6137 const hasBlockingChild = useStableCallback((bubbleKey) => { 6138 const nodeId = dataRef.current.floatingContext?.nodeId; 6139 const children = tree ? getNodeChildren(tree.nodesRef.current, nodeId) : []; 6140 return children.some((child) => child.context?.open && !child.context.dataRef.current[bubbleKey]); 6141 }); 6142 const isEventWithinOwnElements = useStableCallback((event) => { 6143 return isEventTargetWithin(event, store.select("floatingElement")) || isEventTargetWithin(event, store.select("domReferenceElement")); 6144 }); 6145 const closeOnReferencePress = useStableCallback((event) => { 6146 if (!referencePress()) { 6147 return; 6148 } 6149 store.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerPress, event.nativeEvent)); 6150 }); 6151 const closeOnEscapeKeyDown = useStableCallback((event) => { 6152 if (!open2 || !enabled || !escapeKey2 || event.key !== "Escape") { 6153 return; 6154 } 6155 if (isComposingRef.current) { 6156 return; 6157 } 6158 if (!escapeKeyBubbles && hasBlockingChild("__escapeKeyBubbles")) { 6159 return; 6160 } 6161 const native = isReactEvent(event) ? event.nativeEvent : event; 6162 const eventDetails = createChangeEventDetails(reason_parts_exports.escapeKey, native); 6163 store.setOpen(false, eventDetails); 6164 if (!eventDetails.isCanceled) { 6165 event.preventDefault(); 6166 } 6167 if (!escapeKeyBubbles && !eventDetails.isPropagationAllowed) { 6168 event.stopPropagation(); 6169 } 6170 }); 6171 const markInsideReactTree = useStableCallback(() => { 6172 dataRef.current.insideReactTree = true; 6173 clearInsideReactTreeTimeout.start(0, clearInsideReactTree); 6174 }); 6175 const markPressStartedInsideReactTree = useStableCallback((event) => { 6176 if (!open2 || !enabled || event.button !== 0) { 6177 return; 6178 } 6179 const target = getTarget(event.nativeEvent); 6180 if (!contains(store.select("floatingElement"), target)) { 6181 return; 6182 } 6183 if (!pressStartedInsideRef.current) { 6184 pressStartedInsideRef.current = true; 6185 pressStartPreventedRef.current = false; 6186 } 6187 }); 6188 const markInsidePressStartPrevented = useStableCallback((event) => { 6189 if (!open2 || !enabled) { 6190 return; 6191 } 6192 if (!(event.defaultPrevented || event.nativeEvent.defaultPrevented)) { 6193 return; 6194 } 6195 if (pressStartedInsideRef.current) { 6196 pressStartPreventedRef.current = true; 6197 } 6198 }); 6199 React25.useEffect(() => { 6200 function handleOpenChange(details) { 6201 if (!details.open) { 6202 sawPressWhileOpenRef.current = false; 6203 } 6204 } 6205 events.on("openchange", handleOpenChange); 6206 return () => { 6207 events.off("openchange", handleOpenChange); 6208 }; 6209 }, [events]); 6210 React25.useEffect(() => { 6211 if (!open2 || !enabled) { 6212 if (!open2) { 6213 sawPressWhileOpenRef.current = false; 6214 } 6215 return clearInsideReactTree; 6216 } 6217 dataRef.current.__escapeKeyBubbles = escapeKeyBubbles; 6218 dataRef.current.__outsidePressBubbles = outsidePressBubbles; 6219 const compositionTimeout = new Timeout(); 6220 const preventedPressSuppressionTimeout = new Timeout(); 6221 const doc = ownerDocument(floatingElement); 6222 function handleCompositionStart() { 6223 compositionTimeout.clear(); 6224 isComposingRef.current = true; 6225 } 6226 function handleCompositionEnd() { 6227 compositionTimeout.start( 6228 // 0ms or 1ms don't work in Safari. 5ms appears to consistently work. 6229 // Only apply to WebKit for the test to remain 0ms. 6230 parts_exports.engine.webkit ? 5 : 0, 6231 () => { 6232 isComposingRef.current = false; 6233 } 6234 ); 6235 } 6236 function suppressImmediateOutsideClickAfterPreventedStart() { 6237 suppressNextOutsideClickRef.current = true; 6238 preventedPressSuppressionTimeout.start(0, () => { 6239 suppressNextOutsideClickRef.current = false; 6240 }); 6241 } 6242 function resetPressStartState() { 6243 pressStartedInsideRef.current = false; 6244 pressStartPreventedRef.current = false; 6245 } 6246 function getOutsidePressEvent() { 6247 const type = currentPointerTypeRef.current; 6248 const computedType = type === "pen" || !type ? "mouse" : type; 6249 const outsidePressEventValue = getOutsidePressEventProp(); 6250 const resolved = typeof outsidePressEventValue === "function" ? outsidePressEventValue() : outsidePressEventValue; 6251 if (typeof resolved === "string") { 6252 return resolved; 6253 } 6254 return resolved[computedType]; 6255 } 6256 function shouldIgnoreEvent(event) { 6257 const computedOutsidePressEvent = getOutsidePressEvent(); 6258 return computedOutsidePressEvent === "intentional" && event.type !== "click" || computedOutsidePressEvent === "sloppy" && event.type === "click"; 6259 } 6260 function isEventWithinFloatingTree(event) { 6261 const nodeId = dataRef.current.floatingContext?.nodeId; 6262 const targetIsInsideChildren = tree && getNodeChildren(tree.nodesRef.current, nodeId).some((node) => isEventTargetWithin(event, node.context?.elements.floating)); 6263 return isEventWithinOwnElements(event) || targetIsInsideChildren; 6264 } 6265 function closeOnPressOutside(event) { 6266 if (shouldIgnoreEvent(event)) { 6267 if (event.type !== "click" && !isEventWithinOwnElements(event)) { 6268 preventedPressSuppressionTimeout.clear(); 6269 suppressNextOutsideClickRef.current = false; 6270 } 6271 clearInsideReactTree(); 6272 return; 6273 } 6274 if (dataRef.current.insideReactTree) { 6275 clearInsideReactTree(); 6276 return; 6277 } 6278 const target = getTarget(event); 6279 const inertSelector = `[$createAttribute("inert")}]`; 6280 const targetRoot = isElement(target) ? target.getRootNode() : null; 6281 const markers = Array.from((isShadowRoot(targetRoot) ? targetRoot : ownerDocument(store.select("floatingElement"))).querySelectorAll(inertSelector)); 6282 const triggers = store.context.triggerElements; 6283 if (target && (triggers.hasElement(target) || triggers.hasMatchingElement((trigger) => contains(trigger, target)))) { 6284 return; 6285 } 6286 let targetRootAncestor = isElement(target) ? target : null; 6287 while (targetRootAncestor && !isLastTraversableNode(targetRootAncestor)) { 6288 const nextParent = getParentNode(targetRootAncestor); 6289 if (isLastTraversableNode(nextParent) || !isElement(nextParent)) { 6290 break; 6291 } 6292 targetRootAncestor = nextParent; 6293 } 6294 if (markers.length && isElement(target) && !isRootElement(target) && // Clicked on a direct ancestor (e.g. FloatingOverlay). 6295 !contains(target, store.select("floatingElement")) && // If the target root element contains none of the markers, then the 6296 // element was injected after the floating element rendered. 6297 markers.every((marker) => !contains(targetRootAncestor, marker))) { 6298 return; 6299 } 6300 if (isHTMLElement(target) && !("touches" in event)) { 6301 const lastTraversableNode = isLastTraversableNode(target); 6302 const style = getComputedStyle2(target); 6303 const scrollRe = /auto|scroll/; 6304 const isScrollableX = lastTraversableNode || scrollRe.test(style.overflowX); 6305 const isScrollableY = lastTraversableNode || scrollRe.test(style.overflowY); 6306 const canScrollX = isScrollableX && target.clientWidth > 0 && target.scrollWidth > target.clientWidth; 6307 const canScrollY = isScrollableY && target.clientHeight > 0 && target.scrollHeight > target.clientHeight; 6308 const isRTL11 = style.direction === "rtl"; 6309 const pressedVerticalScrollbar = canScrollY && (isRTL11 ? event.offsetX <= target.offsetWidth - target.clientWidth : event.offsetX > target.clientWidth); 6310 const pressedHorizontalScrollbar = canScrollX && event.offsetY > target.clientHeight; 6311 if (pressedVerticalScrollbar || pressedHorizontalScrollbar) { 6312 return; 6313 } 6314 } 6315 if (isEventWithinFloatingTree(event)) { 6316 return; 6317 } 6318 if (getOutsidePressEvent() === "intentional") { 6319 if (event.detail !== 0 && !isVirtualClick(event) && !sawPressWhileOpenRef.current) { 6320 return; 6321 } 6322 if (suppressNextOutsideClickRef.current) { 6323 preventedPressSuppressionTimeout.clear(); 6324 suppressNextOutsideClickRef.current = false; 6325 return; 6326 } 6327 } 6328 if (typeof outsidePress2 === "function" && !outsidePress2(event)) { 6329 return; 6330 } 6331 if (hasBlockingChild("__outsidePressBubbles")) { 6332 return; 6333 } 6334 store.setOpen(false, createChangeEventDetails(reason_parts_exports.outsidePress, event)); 6335 clearInsideReactTree(); 6336 } 6337 function handlePointerDown(event) { 6338 if (getOutsidePressEvent() !== "sloppy" || event.pointerType === "touch" || !store.select("open") || !enabled || isEventWithinOwnElements(event)) { 6339 return; 6340 } 6341 closeOnPressOutside(event); 6342 } 6343 function handleTouchStart(event) { 6344 if (getOutsidePressEvent() !== "sloppy" || !store.select("open") || !enabled || isEventWithinOwnElements(event)) { 6345 return; 6346 } 6347 const touch = event.touches[0]; 6348 if (touch) { 6349 touchStateRef.current = { 6350 startTime: Date.now(), 6351 startX: touch.clientX, 6352 startY: touch.clientY, 6353 dismissOnTouchEnd: false, 6354 dismissOnMouseDown: true 6355 }; 6356 cancelDismissOnEndTimeout.start(1e3, () => { 6357 if (touchStateRef.current) { 6358 touchStateRef.current.dismissOnTouchEnd = false; 6359 touchStateRef.current.dismissOnMouseDown = false; 6360 } 6361 }); 6362 } 6363 } 6364 function addTargetEventListenerOnce(event, listener) { 6365 const target = getTarget(event); 6366 if (!target) { 6367 return; 6368 } 6369 const unsubscribe2 = addEventListener(target, event.type, () => { 6370 listener(event); 6371 unsubscribe2(); 6372 }); 6373 } 6374 function handleTouchStartCapture(event) { 6375 currentPointerTypeRef.current = "touch"; 6376 addTargetEventListenerOnce(event, handleTouchStart); 6377 } 6378 function closeOnPressOutsideCapture(event) { 6379 cancelDismissOnEndTimeout.clear(); 6380 if (event.type === "pointerdown") { 6381 if (event.button === 0) { 6382 sawPressWhileOpenRef.current = true; 6383 } 6384 currentPointerTypeRef.current = event.pointerType; 6385 } 6386 if (event.type === "mousedown" && touchStateRef.current && !touchStateRef.current.dismissOnMouseDown) { 6387 return; 6388 } 6389 addTargetEventListenerOnce(event, (targetEvent) => { 6390 if (targetEvent.type === "pointerdown") { 6391 handlePointerDown(targetEvent); 6392 } else { 6393 closeOnPressOutside(targetEvent); 6394 } 6395 }); 6396 } 6397 function handlePressEndCapture(event) { 6398 if (event.type === "pointercancel") { 6399 sawPressWhileOpenRef.current = false; 6400 } 6401 if (!pressStartedInsideRef.current) { 6402 return; 6403 } 6404 const pressStartedInsideDefaultPrevented = pressStartPreventedRef.current; 6405 resetPressStartState(); 6406 if (getOutsidePressEvent() !== "intentional") { 6407 return; 6408 } 6409 if (event.type === "pointercancel") { 6410 if (pressStartedInsideDefaultPrevented) { 6411 suppressImmediateOutsideClickAfterPreventedStart(); 6412 } 6413 return; 6414 } 6415 if (isEventWithinFloatingTree(event)) { 6416 return; 6417 } 6418 if (pressStartedInsideDefaultPrevented) { 6419 suppressImmediateOutsideClickAfterPreventedStart(); 6420 return; 6421 } 6422 if (typeof outsidePress2 === "function" && !outsidePress2(event)) { 6423 return; 6424 } 6425 preventedPressSuppressionTimeout.clear(); 6426 suppressNextOutsideClickRef.current = true; 6427 clearInsideReactTree(); 6428 } 6429 function handleTouchMove(event) { 6430 if (getOutsidePressEvent() !== "sloppy" || !touchStateRef.current || isEventWithinOwnElements(event)) { 6431 return; 6432 } 6433 const touch = event.touches[0]; 6434 if (!touch) { 6435 return; 6436 } 6437 const deltaX = Math.abs(touch.clientX - touchStateRef.current.startX); 6438 const deltaY = Math.abs(touch.clientY - touchStateRef.current.startY); 6439 const distance = Math.sqrt(deltaX * deltaX + deltaY * deltaY); 6440 if (distance > 5) { 6441 touchStateRef.current.dismissOnTouchEnd = true; 6442 } 6443 if (distance > 10) { 6444 closeOnPressOutside(event); 6445 cancelDismissOnEndTimeout.clear(); 6446 touchStateRef.current = null; 6447 } 6448 } 6449 function handleTouchMoveCapture(event) { 6450 addTargetEventListenerOnce(event, handleTouchMove); 6451 } 6452 function handleTouchEnd(event) { 6453 if (getOutsidePressEvent() !== "sloppy" || !touchStateRef.current || isEventWithinOwnElements(event)) { 6454 return; 6455 } 6456 if (touchStateRef.current.dismissOnTouchEnd) { 6457 closeOnPressOutside(event); 6458 } 6459 cancelDismissOnEndTimeout.clear(); 6460 touchStateRef.current = null; 6461 } 6462 function handleTouchEndCapture(event) { 6463 addTargetEventListenerOnce(event, handleTouchEnd); 6464 } 6465 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, { 6466 capture: true, 6467 passive: true 6468 }), addEventListener(doc, "touchmove", handleTouchMoveCapture, { 6469 capture: true, 6470 passive: true 6471 }), addEventListener(doc, "touchend", handleTouchEndCapture, { 6472 capture: true, 6473 passive: true 6474 }))); 6475 return () => { 6476 unsubscribe(); 6477 compositionTimeout.clear(); 6478 preventedPressSuppressionTimeout.clear(); 6479 resetPressStartState(); 6480 suppressNextOutsideClickRef.current = false; 6481 clearInsideReactTree(); 6482 }; 6483 }, [dataRef, floatingElement, escapeKey2, outsidePressEnabled, outsidePress2, open2, enabled, escapeKeyBubbles, outsidePressBubbles, closeOnEscapeKeyDown, clearInsideReactTree, getOutsidePressEventProp, hasBlockingChild, isEventWithinOwnElements, tree, store, cancelDismissOnEndTimeout]); 6484 const reference = React25.useMemo(() => ({ 6485 onKeyDown: closeOnEscapeKeyDown, 6486 onPointerDown: closeOnReferencePress, 6487 onClick: closeOnReferencePress 6488 }), [closeOnEscapeKeyDown, closeOnReferencePress]); 6489 const floating = React25.useMemo(() => ({ 6490 onKeyDown: closeOnEscapeKeyDown, 6491 // `onMouseDown` may be blocked if `event.preventDefault()` is called in 6492 // `onPointerDown`, such as with <NumberField.ScrubArea>. 6493 // See https://github.com/mui/base-ui/pull/3379 6494 onPointerDown: markInsidePressStartPrevented, 6495 onMouseDown: markInsidePressStartPrevented, 6496 onClickCapture: markInsideReactTree, 6497 onMouseDownCapture(event) { 6498 markInsideReactTree(); 6499 markPressStartedInsideReactTree(event); 6500 }, 6501 onPointerDownCapture(event) { 6502 markInsideReactTree(); 6503 markPressStartedInsideReactTree(event); 6504 }, 6505 onMouseUpCapture: markInsideReactTree, 6506 onTouchEndCapture: markInsideReactTree, 6507 onTouchMoveCapture: markInsideReactTree 6508 }), [closeOnEscapeKeyDown, markInsideReactTree, markPressStartedInsideReactTree, markInsidePressStartPrevented]); 6509 return React25.useMemo(() => enabled ? { 6510 reference, 6511 floating, 6512 trigger: reference 6513 } : {}, [enabled, reference, floating]); 6514 } 6515 6516 // node_modules/@base-ui/react/floating-ui-react/hooks/useFloating.mjs 6517 var React33 = __toESM(require_react(), 1); 6518 6519 // node_modules/@floating-ui/core/dist/floating-ui.core.mjs 6520 function computeCoordsFromPlacement(_ref, placement, rtl) { 6521 let { 6522 reference, 6523 floating 6524 } = _ref; 6525 const sideAxis = getSideAxis(placement); 6526 const alignmentAxis = getAlignmentAxis(placement); 6527 const alignLength = getAxisLength(alignmentAxis); 6528 const side = getSide(placement); 6529 const isVertical = sideAxis === "y"; 6530 const commonX = reference.x + reference.width / 2 - floating.width / 2; 6531 const commonY = reference.y + reference.height / 2 - floating.height / 2; 6532 const commonAlign = reference[alignLength] / 2 - floating[alignLength] / 2; 6533 let coords; 6534 switch (side) { 6535 case "top": 6536 coords = { 6537 x: commonX, 6538 y: reference.y - floating.height 6539 }; 6540 break; 6541 case "bottom": 6542 coords = { 6543 x: commonX, 6544 y: reference.y + reference.height 6545 }; 6546 break; 6547 case "right": 6548 coords = { 6549 x: reference.x + reference.width, 6550 y: commonY 6551 }; 6552 break; 6553 case "left": 6554 coords = { 6555 x: reference.x - floating.width, 6556 y: commonY 6557 }; 6558 break; 6559 default: 6560 coords = { 6561 x: reference.x, 6562 y: reference.y 6563 }; 6564 } 6565 const alignment = getAlignment(placement); 6566 if (alignment) { 6567 coords[alignmentAxis] += commonAlign * (alignment === "end" ? 1 : -1) * (rtl && isVertical ? -1 : 1); 6568 } 6569 return coords; 6570 } 6571 async function detectOverflow(state, options) { 6572 var _await$platform$isEle; 6573 if (options === void 0) { 6574 options = {}; 6575 } 6576 const { 6577 x: x2, 6578 y: y2, 6579 platform: platform3, 6580 rects, 6581 elements, 6582 strategy 6583 } = state; 6584 const { 6585 boundary = "clippingAncestors", 6586 rootBoundary = "viewport", 6587 elementContext = "floating", 6588 altBoundary = false, 6589 padding = 0 6590 } = evaluate(options, state); 6591 const paddingObject = getPaddingObject(padding); 6592 const altContext = elementContext === "floating" ? "reference" : "floating"; 6593 const element = elements[altBoundary ? altContext : elementContext]; 6594 const clippingClientRect = rectToClientRect(await platform3.getClippingRect({ 6595 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)), 6596 boundary, 6597 rootBoundary, 6598 strategy 6599 })); 6600 const rect = elementContext === "floating" ? { 6601 x: x2, 6602 y: y2, 6603 width: rects.floating.width, 6604 height: rects.floating.height 6605 } : rects.reference; 6606 const offsetParent = await (platform3.getOffsetParent == null ? void 0 : platform3.getOffsetParent(elements.floating)); 6607 const offsetScale = await (platform3.isElement == null ? void 0 : platform3.isElement(offsetParent)) && await (platform3.getScale == null ? void 0 : platform3.getScale(offsetParent)) || { 6608 x: 1, 6609 y: 1 6610 }; 6611 const elementClientRect = rectToClientRect(platform3.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform3.convertOffsetParentRelativeRectToViewportRelativeRect({ 6612 elements, 6613 rect, 6614 offsetParent, 6615 strategy 6616 }) : rect); 6617 return { 6618 top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y, 6619 bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y, 6620 left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x, 6621 right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x 6622 }; 6623 } 6624 var MAX_RESET_COUNT = 50; 6625 var computePosition = async (reference, floating, config) => { 6626 const { 6627 placement = "bottom", 6628 strategy = "absolute", 6629 middleware = [], 6630 platform: platform3 6631 } = config; 6632 const platformWithDetectOverflow = platform3.detectOverflow ? platform3 : { 6633 ...platform3, 6634 detectOverflow 6635 }; 6636 const rtl = await (platform3.isRTL == null ? void 0 : platform3.isRTL(floating)); 6637 let rects = await platform3.getElementRects({ 6638 reference, 6639 floating, 6640 strategy 6641 }); 6642 let { 6643 x: x2, 6644 y: y2 6645 } = computeCoordsFromPlacement(rects, placement, rtl); 6646 let statefulPlacement = placement; 6647 let resetCount = 0; 6648 const middlewareData = {}; 6649 for (let i = 0; i < middleware.length; i++) { 6650 const currentMiddleware = middleware[i]; 6651 if (!currentMiddleware) { 6652 continue; 6653 } 6654 const { 6655 name, 6656 fn 6657 } = currentMiddleware; 6658 const { 6659 x: nextX, 6660 y: nextY, 6661 data, 6662 reset 6663 } = await fn({ 6664 x: x2, 6665 y: y2, 6666 initialPlacement: placement, 6667 placement: statefulPlacement, 6668 strategy, 6669 middlewareData, 6670 rects, 6671 platform: platformWithDetectOverflow, 6672 elements: { 6673 reference, 6674 floating 6675 } 6676 }); 6677 x2 = nextX != null ? nextX : x2; 6678 y2 = nextY != null ? nextY : y2; 6679 middlewareData[name] = { 6680 ...middlewareData[name], 6681 ...data 6682 }; 6683 if (reset && resetCount < MAX_RESET_COUNT) { 6684 resetCount++; 6685 if (typeof reset === "object") { 6686 if (reset.placement) { 6687 statefulPlacement = reset.placement; 6688 } 6689 if (reset.rects) { 6690 rects = reset.rects === true ? await platform3.getElementRects({ 6691 reference, 6692 floating, 6693 strategy 6694 }) : reset.rects; 6695 } 6696 ({ 6697 x: x2, 6698 y: y2 6699 } = computeCoordsFromPlacement(rects, statefulPlacement, rtl)); 6700 } 6701 i = -1; 6702 } 6703 } 6704 return { 6705 x: x2, 6706 y: y2, 6707 placement: statefulPlacement, 6708 strategy, 6709 middlewareData 6710 }; 6711 }; 6712 var flip = function(options) { 6713 if (options === void 0) { 6714 options = {}; 6715 } 6716 return { 6717 name: "flip", 6718 options, 6719 async fn(state) { 6720 var _middlewareData$arrow, _middlewareData$flip; 6721 const { 6722 placement, 6723 middlewareData, 6724 rects, 6725 initialPlacement, 6726 platform: platform3, 6727 elements 6728 } = state; 6729 const { 6730 mainAxis: checkMainAxis = true, 6731 crossAxis: checkCrossAxis = true, 6732 fallbackPlacements: specifiedFallbackPlacements, 6733 fallbackStrategy = "bestFit", 6734 fallbackAxisSideDirection = "none", 6735 flipAlignment = true, 6736 ...detectOverflowOptions 6737 } = evaluate(options, state); 6738 if ((_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) { 6739 return {}; 6740 } 6741 const side = getSide(placement); 6742 const initialSideAxis = getSideAxis(initialPlacement); 6743 const isBasePlacement = getSide(initialPlacement) === initialPlacement; 6744 const rtl = await (platform3.isRTL == null ? void 0 : platform3.isRTL(elements.floating)); 6745 const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement)); 6746 const hasFallbackAxisSideDirection = fallbackAxisSideDirection !== "none"; 6747 if (!specifiedFallbackPlacements && hasFallbackAxisSideDirection) { 6748 fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl)); 6749 } 6750 const placements2 = [initialPlacement, ...fallbackPlacements]; 6751 const overflow = await platform3.detectOverflow(state, detectOverflowOptions); 6752 const overflows = []; 6753 let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || []; 6754 if (checkMainAxis) { 6755 overflows.push(overflow[side]); 6756 } 6757 if (checkCrossAxis) { 6758 const sides2 = getAlignmentSides(placement, rects, rtl); 6759 overflows.push(overflow[sides2[0]], overflow[sides2[1]]); 6760 } 6761 overflowsData = [...overflowsData, { 6762 placement, 6763 overflows 6764 }]; 6765 if (!overflows.every((side2) => side2 <= 0)) { 6766 var _middlewareData$flip2, _overflowsData$filter; 6767 const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1; 6768 const nextPlacement = placements2[nextIndex]; 6769 if (nextPlacement) { 6770 const ignoreCrossAxisOverflow = checkCrossAxis === "alignment" ? initialSideAxis !== getSideAxis(nextPlacement) : false; 6771 if (!ignoreCrossAxisOverflow || // We leave the current main axis only if every placement on that axis 6772 // overflows the main axis. 6773 overflowsData.every((d) => getSideAxis(d.placement) === initialSideAxis ? d.overflows[0] > 0 : true)) { 6774 return { 6775 data: { 6776 index: nextIndex, 6777 overflows: overflowsData 6778 }, 6779 reset: { 6780 placement: nextPlacement 6781 } 6782 }; 6783 } 6784 } 6785 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; 6786 if (!resetPlacement) { 6787 switch (fallbackStrategy) { 6788 case "bestFit": { 6789 var _overflowsData$filter2; 6790 const placement2 = (_overflowsData$filter2 = overflowsData.filter((d) => { 6791 if (hasFallbackAxisSideDirection) { 6792 const currentSideAxis = getSideAxis(d.placement); 6793 return currentSideAxis === initialSideAxis || // Create a bias to the `y` side axis due to horizontal 6794 // reading directions favoring greater width. 6795 currentSideAxis === "y"; 6796 } 6797 return true; 6798 }).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]; 6799 if (placement2) { 6800 resetPlacement = placement2; 6801 } 6802 break; 6803 } 6804 case "initialPlacement": 6805 resetPlacement = initialPlacement; 6806 break; 6807 } 6808 } 6809 if (placement !== resetPlacement) { 6810 return { 6811 reset: { 6812 placement: resetPlacement 6813 } 6814 }; 6815 } 6816 } 6817 return {}; 6818 } 6819 }; 6820 }; 6821 var originSides = /* @__PURE__ */ new Set(["left", "top"]); 6822 async function convertValueToCoords(state, options) { 6823 const { 6824 placement, 6825 platform: platform3, 6826 elements 6827 } = state; 6828 const rtl = await (platform3.isRTL == null ? void 0 : platform3.isRTL(elements.floating)); 6829 const side = getSide(placement); 6830 const alignment = getAlignment(placement); 6831 const isVertical = getSideAxis(placement) === "y"; 6832 const mainAxisMulti = originSides.has(side) ? -1 : 1; 6833 const crossAxisMulti = rtl && isVertical ? -1 : 1; 6834 const rawValue = evaluate(options, state); 6835 let { 6836 mainAxis, 6837 crossAxis, 6838 alignmentAxis 6839 } = typeof rawValue === "number" ? { 6840 mainAxis: rawValue, 6841 crossAxis: 0, 6842 alignmentAxis: null 6843 } : { 6844 mainAxis: rawValue.mainAxis || 0, 6845 crossAxis: rawValue.crossAxis || 0, 6846 alignmentAxis: rawValue.alignmentAxis 6847 }; 6848 if (alignment && typeof alignmentAxis === "number") { 6849 crossAxis = alignment === "end" ? alignmentAxis * -1 : alignmentAxis; 6850 } 6851 return isVertical ? { 6852 x: crossAxis * crossAxisMulti, 6853 y: mainAxis * mainAxisMulti 6854 } : { 6855 x: mainAxis * mainAxisMulti, 6856 y: crossAxis * crossAxisMulti 6857 }; 6858 } 6859 var offset = function(options) { 6860 if (options === void 0) { 6861 options = 0; 6862 } 6863 return { 6864 name: "offset", 6865 options, 6866 async fn(state) { 6867 var _middlewareData$offse, _middlewareData$arrow; 6868 const { 6869 x: x2, 6870 y: y2, 6871 placement, 6872 middlewareData 6873 } = state; 6874 const diffCoords = await convertValueToCoords(state, options); 6875 if (placement === ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse.placement) && (_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) { 6876 return {}; 6877 } 6878 return { 6879 x: x2 + diffCoords.x, 6880 y: y2 + diffCoords.y, 6881 data: { 6882 ...diffCoords, 6883 placement 6884 } 6885 }; 6886 } 6887 }; 6888 }; 6889 var shift = function(options) { 6890 if (options === void 0) { 6891 options = {}; 6892 } 6893 return { 6894 name: "shift", 6895 options, 6896 async fn(state) { 6897 const { 6898 x: x2, 6899 y: y2, 6900 placement, 6901 platform: platform3 6902 } = state; 6903 const { 6904 mainAxis: checkMainAxis = true, 6905 crossAxis: checkCrossAxis = false, 6906 limiter = { 6907 fn: (_ref) => { 6908 let { 6909 x: x3, 6910 y: y3 6911 } = _ref; 6912 return { 6913 x: x3, 6914 y: y3 6915 }; 6916 } 6917 }, 6918 ...detectOverflowOptions 6919 } = evaluate(options, state); 6920 const coords = { 6921 x: x2, 6922 y: y2 6923 }; 6924 const overflow = await platform3.detectOverflow(state, detectOverflowOptions); 6925 const crossAxis = getSideAxis(placement); 6926 const mainAxis = getOppositeAxis(crossAxis); 6927 let mainAxisCoord = coords[mainAxis]; 6928 let crossAxisCoord = coords[crossAxis]; 6929 const clampCoord = (axis, coord) => clamp(coord + overflow[axis === "y" ? "top" : "left"], coord, coord - overflow[axis === "y" ? "bottom" : "right"]); 6930 if (checkMainAxis) { 6931 mainAxisCoord = clampCoord(mainAxis, mainAxisCoord); 6932 } 6933 if (checkCrossAxis) { 6934 crossAxisCoord = clampCoord(crossAxis, crossAxisCoord); 6935 } 6936 const limitedCoords = limiter.fn({ 6937 ...state, 6938 [mainAxis]: mainAxisCoord, 6939 [crossAxis]: crossAxisCoord 6940 }); 6941 return { 6942 ...limitedCoords, 6943 data: { 6944 x: limitedCoords.x - x2, 6945 y: limitedCoords.y - y2, 6946 enabled: { 6947 [mainAxis]: checkMainAxis, 6948 [crossAxis]: checkCrossAxis 6949 } 6950 } 6951 }; 6952 } 6953 }; 6954 }; 6955 var limitShift = function(options) { 6956 if (options === void 0) { 6957 options = {}; 6958 } 6959 return { 6960 options, 6961 fn(state) { 6962 var _rawOffset$mainAxis, _rawOffset$crossAxis; 6963 const { 6964 x: x2, 6965 y: y2, 6966 placement, 6967 rects, 6968 middlewareData 6969 } = state; 6970 const { 6971 offset: offset4 = 0, 6972 mainAxis: checkMainAxis = true, 6973 crossAxis: checkCrossAxis = true 6974 } = evaluate(options, state); 6975 const coords = { 6976 x: x2, 6977 y: y2 6978 }; 6979 const crossAxis = getSideAxis(placement); 6980 const mainAxis = getOppositeAxis(crossAxis); 6981 let mainAxisCoord = coords[mainAxis]; 6982 let crossAxisCoord = coords[crossAxis]; 6983 const rawOffset = evaluate(offset4, state); 6984 const computedOffset = typeof rawOffset === "number" ? { 6985 mainAxis: rawOffset, 6986 crossAxis: 0 6987 } : { 6988 mainAxis: (_rawOffset$mainAxis = rawOffset.mainAxis) != null ? _rawOffset$mainAxis : 0, 6989 crossAxis: (_rawOffset$crossAxis = rawOffset.crossAxis) != null ? _rawOffset$crossAxis : 0 6990 }; 6991 if (checkMainAxis) { 6992 const len = mainAxis === "y" ? "height" : "width"; 6993 const limitMin = rects.reference[mainAxis] - rects.floating[len] + computedOffset.mainAxis; 6994 const limitMax = rects.reference[mainAxis] + rects.reference[len] - computedOffset.mainAxis; 6995 if (mainAxisCoord < limitMin) { 6996 mainAxisCoord = limitMin; 6997 } else if (mainAxisCoord > limitMax) { 6998 mainAxisCoord = limitMax; 6999 } 7000 } 7001 if (checkCrossAxis) { 7002 var _middlewareData$offse, _middlewareData$offse2; 7003 const len = mainAxis === "y" ? "width" : "height"; 7004 const isOriginSide = originSides.has(getSide(placement)); 7005 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); 7006 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); 7007 if (crossAxisCoord < limitMin) { 7008 crossAxisCoord = limitMin; 7009 } else if (crossAxisCoord > limitMax) { 7010 crossAxisCoord = limitMax; 7011 } 7012 } 7013 return { 7014 [mainAxis]: mainAxisCoord, 7015 [crossAxis]: crossAxisCoord 7016 }; 7017 } 7018 }; 7019 }; 7020 var size = function(options) { 7021 if (options === void 0) { 7022 options = {}; 7023 } 7024 return { 7025 name: "size", 7026 options, 7027 async fn(state) { 7028 const { 7029 placement, 7030 rects, 7031 platform: platform3, 7032 elements 7033 } = state; 7034 const { 7035 apply = () => { 7036 }, 7037 ...detectOverflowOptions 7038 } = evaluate(options, state); 7039 const overflow = await platform3.detectOverflow(state, detectOverflowOptions); 7040 const side = getSide(placement); 7041 const alignment = getAlignment(placement); 7042 const isYAxis = getSideAxis(placement) === "y"; 7043 const { 7044 width, 7045 height 7046 } = rects.floating; 7047 let heightSide; 7048 let widthSide; 7049 if (side === "top" || side === "bottom") { 7050 heightSide = side; 7051 widthSide = alignment === (await (platform3.isRTL == null ? void 0 : platform3.isRTL(elements.floating)) ? "start" : "end") ? "left" : "right"; 7052 } else { 7053 widthSide = side; 7054 heightSide = alignment === "end" ? "top" : "bottom"; 7055 } 7056 const maximumClippingHeight = height - overflow.top - overflow.bottom; 7057 const maximumClippingWidth = width - overflow.left - overflow.right; 7058 const overflowAvailableHeight = min(height - overflow[heightSide], maximumClippingHeight); 7059 const overflowAvailableWidth = min(width - overflow[widthSide], maximumClippingWidth); 7060 const shiftData = state.middlewareData.shift; 7061 const noShift = !shiftData; 7062 let availableHeight2 = overflowAvailableHeight; 7063 let availableWidth2 = overflowAvailableWidth; 7064 if (shiftData != null && shiftData.enabled.x) { 7065 availableWidth2 = maximumClippingWidth; 7066 } 7067 if (shiftData != null && shiftData.enabled.y) { 7068 availableHeight2 = maximumClippingHeight; 7069 } 7070 if (noShift && !alignment) { 7071 if (isYAxis) { 7072 availableWidth2 = width - 2 * max(overflow.left, overflow.right); 7073 } else { 7074 availableHeight2 = height - 2 * max(overflow.top, overflow.bottom); 7075 } 7076 } 7077 await apply({ 7078 ...state, 7079 availableWidth: availableWidth2, 7080 availableHeight: availableHeight2 7081 }); 7082 const nextDimensions = await platform3.getDimensions(elements.floating); 7083 if (width !== nextDimensions.width || height !== nextDimensions.height) { 7084 return { 7085 reset: { 7086 rects: true 7087 } 7088 }; 7089 } 7090 return {}; 7091 } 7092 }; 7093 }; 7094 7095 // node_modules/@floating-ui/dom/dist/floating-ui.dom.mjs 7096 function getCssDimensions(element) { 7097 const css = getComputedStyle2(element); 7098 let width = parseFloat(css.width) || 0; 7099 let height = parseFloat(css.height) || 0; 7100 const hasOffset = isHTMLElement(element); 7101 const offsetWidth = hasOffset ? element.offsetWidth : width; 7102 const offsetHeight = hasOffset ? element.offsetHeight : height; 7103 const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight; 7104 if (shouldFallback) { 7105 width = offsetWidth; 7106 height = offsetHeight; 7107 } 7108 return { 7109 width, 7110 height, 7111 $: shouldFallback 7112 }; 7113 } 7114 function unwrapElement(element) { 7115 return !isElement(element) ? element.contextElement : element; 7116 } 7117 function getScale(element) { 7118 const domElement = unwrapElement(element); 7119 if (!isHTMLElement(domElement)) { 7120 return createCoords(1); 7121 } 7122 const rect = domElement.getBoundingClientRect(); 7123 const { 7124 width, 7125 height, 7126 $: $2 7127 } = getCssDimensions(domElement); 7128 let x2 = ($2 ? round(rect.width) : rect.width) / width; 7129 let y2 = ($2 ? round(rect.height) : rect.height) / height; 7130 if (!x2 || !Number.isFinite(x2)) { 7131 x2 = 1; 7132 } 7133 if (!y2 || !Number.isFinite(y2)) { 7134 y2 = 1; 7135 } 7136 return { 7137 x: x2, 7138 y: y2 7139 }; 7140 } 7141 var noOffsets = /* @__PURE__ */ createCoords(0); 7142 function getVisualOffsets(element) { 7143 const win = getWindow(element); 7144 if (!isWebKit() || !win.visualViewport) { 7145 return noOffsets; 7146 } 7147 return { 7148 x: win.visualViewport.offsetLeft, 7149 y: win.visualViewport.offsetTop 7150 }; 7151 } 7152 function shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) { 7153 if (isFixed === void 0) { 7154 isFixed = false; 7155 } 7156 return !!floatingOffsetParent && isFixed && floatingOffsetParent === getWindow(element); 7157 } 7158 function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) { 7159 if (includeScale === void 0) { 7160 includeScale = false; 7161 } 7162 if (isFixedStrategy === void 0) { 7163 isFixedStrategy = false; 7164 } 7165 const clientRect = element.getBoundingClientRect(); 7166 const domElement = unwrapElement(element); 7167 let scale = createCoords(1); 7168 if (includeScale) { 7169 if (offsetParent) { 7170 if (isElement(offsetParent)) { 7171 scale = getScale(offsetParent); 7172 } 7173 } else { 7174 scale = getScale(element); 7175 } 7176 } 7177 const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : createCoords(0); 7178 let x2 = (clientRect.left + visualOffsets.x) / scale.x; 7179 let y2 = (clientRect.top + visualOffsets.y) / scale.y; 7180 let width = clientRect.width / scale.x; 7181 let height = clientRect.height / scale.y; 7182 if (domElement && offsetParent) { 7183 const win = getWindow(domElement); 7184 const offsetWin = isElement(offsetParent) ? getWindow(offsetParent) : offsetParent; 7185 let currentWin = win; 7186 let currentIFrame = getFrameElement(currentWin); 7187 while (currentIFrame && offsetWin !== currentWin) { 7188 const iframeScale = getScale(currentIFrame); 7189 const iframeRect = currentIFrame.getBoundingClientRect(); 7190 const css = getComputedStyle2(currentIFrame); 7191 const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x; 7192 const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y; 7193 x2 *= iframeScale.x; 7194 y2 *= iframeScale.y; 7195 width *= iframeScale.x; 7196 height *= iframeScale.y; 7197 x2 += left; 7198 y2 += top; 7199 currentWin = getWindow(currentIFrame); 7200 currentIFrame = getFrameElement(currentWin); 7201 } 7202 } 7203 return rectToClientRect({ 7204 width, 7205 height, 7206 x: x2, 7207 y: y2 7208 }); 7209 } 7210 function getWindowScrollBarX(element, rect) { 7211 const leftScroll = getNodeScroll(element).scrollLeft; 7212 if (!rect) { 7213 return getBoundingClientRect(getDocumentElement(element)).left + leftScroll; 7214 } 7215 return rect.left + leftScroll; 7216 } 7217 function getHTMLOffset(documentElement, scroll) { 7218 const htmlRect = documentElement.getBoundingClientRect(); 7219 const x2 = htmlRect.left + scroll.scrollLeft - getWindowScrollBarX(documentElement, htmlRect); 7220 const y2 = htmlRect.top + scroll.scrollTop; 7221 return { 7222 x: x2, 7223 y: y2 7224 }; 7225 } 7226 function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) { 7227 let { 7228 elements, 7229 rect, 7230 offsetParent, 7231 strategy 7232 } = _ref; 7233 const isFixed = strategy === "fixed"; 7234 const documentElement = getDocumentElement(offsetParent); 7235 const topLayer = elements ? isTopLayer(elements.floating) : false; 7236 if (offsetParent === documentElement || topLayer && isFixed) { 7237 return rect; 7238 } 7239 let scroll = { 7240 scrollLeft: 0, 7241 scrollTop: 0 7242 }; 7243 let scale = createCoords(1); 7244 const offsets = createCoords(0); 7245 const isOffsetParentAnElement = isHTMLElement(offsetParent); 7246 if (isOffsetParentAnElement || !isFixed) { 7247 if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) { 7248 scroll = getNodeScroll(offsetParent); 7249 } 7250 if (isOffsetParentAnElement) { 7251 const offsetRect = getBoundingClientRect(offsetParent); 7252 scale = getScale(offsetParent); 7253 offsets.x = offsetRect.x + offsetParent.clientLeft; 7254 offsets.y = offsetRect.y + offsetParent.clientTop; 7255 } 7256 } 7257 const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0); 7258 return { 7259 width: rect.width * scale.x, 7260 height: rect.height * scale.y, 7261 x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x + htmlOffset.x, 7262 y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y + htmlOffset.y 7263 }; 7264 } 7265 function getClientRects(element) { 7266 return element.getClientRects ? Array.from(element.getClientRects()) : []; 7267 } 7268 function getDocumentRect(html) { 7269 const scroll = getNodeScroll(html); 7270 const body = html.ownerDocument.body; 7271 const width = max(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth); 7272 const height = max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight); 7273 let x2 = -scroll.scrollLeft + getWindowScrollBarX(html); 7274 const y2 = -scroll.scrollTop; 7275 if (getComputedStyle2(body).direction === "rtl") { 7276 x2 += max(html.clientWidth, body.clientWidth) - width; 7277 } 7278 return { 7279 width, 7280 height, 7281 x: x2, 7282 y: y2 7283 }; 7284 } 7285 var SCROLLBAR_MAX = 25; 7286 function getViewportRect(element, strategy, rootBoundary) { 7287 if (rootBoundary === void 0) { 7288 rootBoundary = "viewport"; 7289 } 7290 const isLayoutViewport = rootBoundary === "layoutViewport"; 7291 const win = getWindow(element); 7292 const html = getDocumentElement(element); 7293 const visualViewport = win.visualViewport; 7294 let width = html.clientWidth; 7295 let height = html.clientHeight; 7296 let x2 = 0; 7297 let y2 = 0; 7298 if (visualViewport) { 7299 const layoutRelativeClientCoords = !isWebKit() || strategy === "fixed"; 7300 if (isLayoutViewport) { 7301 if (!layoutRelativeClientCoords) { 7302 x2 = -visualViewport.offsetLeft; 7303 y2 = -visualViewport.offsetTop; 7304 } 7305 } else { 7306 width = visualViewport.width; 7307 height = visualViewport.height; 7308 if (layoutRelativeClientCoords) { 7309 x2 = visualViewport.offsetLeft; 7310 y2 = visualViewport.offsetTop; 7311 } 7312 } 7313 } 7314 const windowScrollbarX = getWindowScrollBarX(html); 7315 if (windowScrollbarX <= 0) { 7316 const doc = html.ownerDocument; 7317 const body = doc.body; 7318 const bodyStyles = getComputedStyle(body); 7319 const bodyMarginInline = doc.compatMode === "CSS1Compat" ? parseFloat(bodyStyles.marginLeft) + parseFloat(bodyStyles.marginRight) || 0 : 0; 7320 const reservedWidth = Math.abs(html.clientWidth - body.clientWidth - bodyMarginInline); 7321 const gutter = getComputedStyle(html).scrollbarGutter === "stable both-edges" ? reservedWidth / 2 : reservedWidth; 7322 if (gutter <= SCROLLBAR_MAX) { 7323 width -= gutter; 7324 } 7325 } 7326 return { 7327 width, 7328 height, 7329 x: x2, 7330 y: y2 7331 }; 7332 } 7333 function getInnerBoundingClientRect(element, strategy) { 7334 const clientRect = getBoundingClientRect(element, true, strategy === "fixed"); 7335 const top = clientRect.top + element.clientTop; 7336 const left = clientRect.left + element.clientLeft; 7337 const scale = getScale(element); 7338 const width = element.clientWidth * scale.x; 7339 const height = element.clientHeight * scale.y; 7340 const x2 = left * scale.x; 7341 const y2 = top * scale.y; 7342 return { 7343 width, 7344 height, 7345 x: x2, 7346 y: y2 7347 }; 7348 } 7349 function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) { 7350 let rect; 7351 if (clippingAncestor === "viewport" || clippingAncestor === "layoutViewport") { 7352 rect = getViewportRect(element, strategy, clippingAncestor); 7353 } else if (clippingAncestor === "document") { 7354 rect = getDocumentRect(getDocumentElement(element)); 7355 } else if (isElement(clippingAncestor)) { 7356 rect = getInnerBoundingClientRect(clippingAncestor, strategy); 7357 } else { 7358 const visualOffsets = getVisualOffsets(element); 7359 rect = { 7360 x: clippingAncestor.x - visualOffsets.x, 7361 y: clippingAncestor.y - visualOffsets.y, 7362 width: clippingAncestor.width, 7363 height: clippingAncestor.height 7364 }; 7365 } 7366 return rectToClientRect(rect); 7367 } 7368 function getClippingElementAncestors(element, cache) { 7369 const cachedResult = cache.get(element); 7370 if (cachedResult) { 7371 return cachedResult; 7372 } 7373 let result = getOverflowAncestors(element, [], false).filter((el) => isElement(el) && getNodeName(el) !== "body"); 7374 let lastKeptComputedStyle = null; 7375 const elementIsFixed = getComputedStyle2(element).position === "fixed"; 7376 let currentNode = elementIsFixed ? getParentNode(element) : element; 7377 while (isElement(currentNode) && !isLastTraversableNode(currentNode)) { 7378 const computedStyle = getComputedStyle2(currentNode); 7379 const currentNodeIsContaining = isContainingBlock(currentNode); 7380 const lastPosition = lastKeptComputedStyle ? lastKeptComputedStyle.position : elementIsFixed ? "fixed" : ""; 7381 const shouldDropCurrentNode = !currentNodeIsContaining && (lastPosition === "fixed" || lastPosition === "absolute" && computedStyle.position === "static"); 7382 if (shouldDropCurrentNode) { 7383 result = result.filter((ancestor) => ancestor !== currentNode); 7384 } else { 7385 lastKeptComputedStyle = computedStyle; 7386 } 7387 currentNode = getParentNode(currentNode); 7388 } 7389 cache.set(element, result); 7390 return result; 7391 } 7392 function getClippingRect(_ref) { 7393 let { 7394 element, 7395 boundary, 7396 rootBoundary, 7397 strategy 7398 } = _ref; 7399 const elementClippingAncestors = boundary === "clippingAncestors" ? isTopLayer(element) ? [] : getClippingElementAncestors(element, this._c) : [].concat(boundary); 7400 const clippingAncestors = [...elementClippingAncestors, rootBoundary]; 7401 const firstRect = getClientRectFromClippingAncestor(element, clippingAncestors[0], strategy); 7402 let top = firstRect.top; 7403 let right = firstRect.right; 7404 let bottom = firstRect.bottom; 7405 let left = firstRect.left; 7406 for (let i = 1; i < clippingAncestors.length; i++) { 7407 const rect = getClientRectFromClippingAncestor(element, clippingAncestors[i], strategy); 7408 top = max(rect.top, top); 7409 right = min(rect.right, right); 7410 bottom = min(rect.bottom, bottom); 7411 left = max(rect.left, left); 7412 } 7413 return { 7414 width: right - left, 7415 height: bottom - top, 7416 x: left, 7417 y: top 7418 }; 7419 } 7420 function getDimensions(element) { 7421 const { 7422 width, 7423 height 7424 } = getCssDimensions(element); 7425 return { 7426 width, 7427 height 7428 }; 7429 } 7430 function getRectRelativeToOffsetParent(element, offsetParent, strategy) { 7431 const isOffsetParentAnElement = isHTMLElement(offsetParent); 7432 const documentElement = getDocumentElement(offsetParent); 7433 const isFixed = strategy === "fixed"; 7434 const rect = getBoundingClientRect(element, true, isFixed, offsetParent); 7435 let scroll = { 7436 scrollLeft: 0, 7437 scrollTop: 0 7438 }; 7439 const offsets = createCoords(0); 7440 if (isOffsetParentAnElement || !isFixed) { 7441 if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) { 7442 scroll = getNodeScroll(offsetParent); 7443 } 7444 if (isOffsetParentAnElement) { 7445 const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent); 7446 offsets.x = offsetRect.x + offsetParent.clientLeft; 7447 offsets.y = offsetRect.y + offsetParent.clientTop; 7448 } 7449 } 7450 if (!isOffsetParentAnElement && documentElement) { 7451 offsets.x = getWindowScrollBarX(documentElement); 7452 } 7453 const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0); 7454 const x2 = rect.left + scroll.scrollLeft - offsets.x - htmlOffset.x; 7455 const y2 = rect.top + scroll.scrollTop - offsets.y - htmlOffset.y; 7456 return { 7457 x: x2, 7458 y: y2, 7459 width: rect.width, 7460 height: rect.height 7461 }; 7462 } 7463 function isStaticPositioned(element) { 7464 return getComputedStyle2(element).position === "static"; 7465 } 7466 function getTrueOffsetParent(element, polyfill) { 7467 if (!isHTMLElement(element) || getComputedStyle2(element).position === "fixed") { 7468 return null; 7469 } 7470 if (polyfill) { 7471 return polyfill(element); 7472 } 7473 let rawOffsetParent = element.offsetParent; 7474 if (getDocumentElement(element) === rawOffsetParent) { 7475 rawOffsetParent = rawOffsetParent.ownerDocument.body; 7476 } 7477 return rawOffsetParent; 7478 } 7479 function getOffsetParent(element, polyfill) { 7480 const win = getWindow(element); 7481 if (isTopLayer(element)) { 7482 return win; 7483 } 7484 if (!isHTMLElement(element)) { 7485 let svgOffsetParent = getParentNode(element); 7486 while (svgOffsetParent && !isLastTraversableNode(svgOffsetParent)) { 7487 if (isElement(svgOffsetParent) && !isStaticPositioned(svgOffsetParent)) { 7488 return svgOffsetParent; 7489 } 7490 svgOffsetParent = getParentNode(svgOffsetParent); 7491 } 7492 return win; 7493 } 7494 let offsetParent = getTrueOffsetParent(element, polyfill); 7495 while (offsetParent && isTableElement(offsetParent) && isStaticPositioned(offsetParent)) { 7496 offsetParent = getTrueOffsetParent(offsetParent, polyfill); 7497 } 7498 if (offsetParent && isLastTraversableNode(offsetParent) && isStaticPositioned(offsetParent) && !isContainingBlock(offsetParent)) { 7499 return win; 7500 } 7501 return offsetParent || getContainingBlock(element) || win; 7502 } 7503 var getElementRects = async function(data) { 7504 const getOffsetParentFn = this.getOffsetParent || getOffsetParent; 7505 const getDimensionsFn = this.getDimensions; 7506 const floatingDimensions = await getDimensionsFn(data.floating); 7507 return { 7508 reference: getRectRelativeToOffsetParent(data.reference, await getOffsetParentFn(data.floating), data.strategy), 7509 floating: { 7510 x: 0, 7511 y: 0, 7512 width: floatingDimensions.width, 7513 height: floatingDimensions.height 7514 } 7515 }; 7516 }; 7517 function isRTL(element) { 7518 return getComputedStyle2(element).direction === "rtl"; 7519 } 7520 var platform2 = { 7521 convertOffsetParentRelativeRectToViewportRelativeRect, 7522 getDocumentElement, 7523 getClippingRect, 7524 getOffsetParent, 7525 getElementRects, 7526 getClientRects, 7527 getDimensions, 7528 getScale, 7529 isElement, 7530 isRTL 7531 }; 7532 function rectsAreEqual(a, b) { 7533 return a.x === b.x && a.y === b.y && a.width === b.width && a.height === b.height; 7534 } 7535 function observeMove(element, onMove, ancestorResize) { 7536 let io = null; 7537 let timeoutId; 7538 const root = getDocumentElement(element); 7539 function cleanup() { 7540 var _io; 7541 clearTimeout(timeoutId); 7542 (_io = io) == null || _io.disconnect(); 7543 io = null; 7544 } 7545 function refresh(skip, threshold) { 7546 if (skip === void 0) { 7547 skip = false; 7548 } 7549 if (threshold === void 0) { 7550 threshold = 1; 7551 } 7552 cleanup(); 7553 const elementRectForRootMargin = element.getBoundingClientRect(); 7554 const { 7555 left, 7556 top, 7557 width, 7558 height 7559 } = elementRectForRootMargin; 7560 if (!skip) { 7561 onMove(); 7562 } 7563 if (!width || !height) { 7564 return; 7565 } 7566 const insetTop = floor(top); 7567 const insetRight = floor(root.clientWidth - (left + width)); 7568 const insetBottom = floor(root.clientHeight - (top + height)); 7569 const insetLeft = floor(left); 7570 const rootMargin = -insetTop + "px " + -insetRight + "px " + -insetBottom + "px " + -insetLeft + "px"; 7571 const options = { 7572 rootMargin, 7573 threshold: max(0, min(1, threshold)) || 1 7574 }; 7575 let isFirstUpdate = true; 7576 function handleObserve(entries) { 7577 const ratio = entries[0].intersectionRatio; 7578 if (!rectsAreEqual(elementRectForRootMargin, element.getBoundingClientRect())) { 7579 return refresh(); 7580 } 7581 if (ratio !== threshold) { 7582 if (!isFirstUpdate) { 7583 return refresh(); 7584 } 7585 if (!ratio) { 7586 timeoutId = setTimeout(() => { 7587 refresh(false, 1e-7); 7588 }, 1e3); 7589 } else { 7590 refresh(false, ratio); 7591 } 7592 } 7593 isFirstUpdate = false; 7594 } 7595 try { 7596 io = new IntersectionObserver(handleObserve, { 7597 ...options, 7598 // Handle <iframe>s 7599 root: root.ownerDocument 7600 }); 7601 } catch (_e) { 7602 io = new IntersectionObserver(handleObserve, options); 7603 } 7604 io.observe(element); 7605 } 7606 const win = getWindow(element); 7607 const handleResize = () => refresh(ancestorResize); 7608 win.addEventListener("resize", handleResize); 7609 refresh(true); 7610 return () => { 7611 win.removeEventListener("resize", handleResize); 7612 cleanup(); 7613 }; 7614 } 7615 function autoUpdate(reference, floating, update2, options) { 7616 if (options === void 0) { 7617 options = {}; 7618 } 7619 const { 7620 ancestorScroll = true, 7621 ancestorResize = true, 7622 elementResize = typeof ResizeObserver === "function", 7623 layoutShift = typeof IntersectionObserver === "function", 7624 animationFrame = false 7625 } = options; 7626 const referenceEl = unwrapElement(reference); 7627 const ancestors = ancestorScroll || ancestorResize ? [...referenceEl ? getOverflowAncestors(referenceEl) : [], ...floating ? getOverflowAncestors(floating) : []] : []; 7628 ancestors.forEach((ancestor) => { 7629 ancestorScroll && ancestor.addEventListener("scroll", update2); 7630 ancestorResize && ancestor.addEventListener("resize", update2); 7631 }); 7632 const cleanupIo = referenceEl && layoutShift ? observeMove(referenceEl, update2, ancestorResize) : null; 7633 let reobserveFrame = -1; 7634 let resizeObserver = null; 7635 if (elementResize) { 7636 resizeObserver = new ResizeObserver((_ref) => { 7637 let [firstEntry] = _ref; 7638 if (firstEntry && firstEntry.target === referenceEl && resizeObserver && floating) { 7639 resizeObserver.unobserve(floating); 7640 cancelAnimationFrame(reobserveFrame); 7641 reobserveFrame = requestAnimationFrame(() => { 7642 var _resizeObserver; 7643 (_resizeObserver = resizeObserver) == null || _resizeObserver.observe(floating); 7644 }); 7645 } 7646 update2(); 7647 }); 7648 if (referenceEl && !animationFrame) { 7649 resizeObserver.observe(referenceEl); 7650 } 7651 if (floating) { 7652 resizeObserver.observe(floating); 7653 } 7654 } 7655 let frameId; 7656 let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null; 7657 if (animationFrame) { 7658 frameLoop(); 7659 } 7660 function frameLoop() { 7661 const nextRefRect = getBoundingClientRect(reference); 7662 if (prevRefRect && !rectsAreEqual(prevRefRect, nextRefRect)) { 7663 update2(); 7664 } 7665 prevRefRect = nextRefRect; 7666 frameId = requestAnimationFrame(frameLoop); 7667 } 7668 update2(); 7669 return () => { 7670 var _resizeObserver2; 7671 ancestors.forEach((ancestor) => { 7672 ancestorScroll && ancestor.removeEventListener("scroll", update2); 7673 ancestorResize && ancestor.removeEventListener("resize", update2); 7674 }); 7675 cleanupIo == null || cleanupIo(); 7676 (_resizeObserver2 = resizeObserver) == null || _resizeObserver2.disconnect(); 7677 resizeObserver = null; 7678 if (animationFrame) { 7679 cancelAnimationFrame(frameId); 7680 } 7681 }; 7682 } 7683 var offset2 = offset; 7684 var shift2 = shift; 7685 var flip2 = flip; 7686 var size2 = size; 7687 var limitShift2 = limitShift; 7688 var computePosition2 = (reference, floating, options) => { 7689 const cache = /* @__PURE__ */ new Map(); 7690 const mergedOptions = options != null ? options : {}; 7691 const platformWithCache = { 7692 ...platform2, 7693 ...mergedOptions.platform, 7694 _c: cache 7695 }; 7696 return computePosition(reference, floating, { 7697 ...mergedOptions, 7698 platform: platformWithCache 7699 }); 7700 }; 7701 7702 // node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.mjs 7703 var React26 = __toESM(require_react(), 1); 7704 var import_react2 = __toESM(require_react(), 1); 7705 var ReactDOM3 = __toESM(require_react_dom(), 1); 7706 var isClient = typeof document !== "undefined"; 7707 var noop3 = function noop4() { 7708 }; 7709 var index = isClient ? import_react2.useLayoutEffect : noop3; 7710 function deepEqual(a, b) { 7711 if (a === b) { 7712 return true; 7713 } 7714 if (typeof a !== typeof b) { 7715 return false; 7716 } 7717 if (typeof a === "function" && a.toString() === b.toString()) { 7718 return true; 7719 } 7720 let length; 7721 let i; 7722 let keys; 7723 if (a && b && typeof a === "object") { 7724 if (Array.isArray(a)) { 7725 length = a.length; 7726 if (length !== b.length) return false; 7727 for (i = length; i-- !== 0; ) { 7728 if (!deepEqual(a[i], b[i])) { 7729 return false; 7730 } 7731 } 7732 return true; 7733 } 7734 keys = Object.keys(a); 7735 length = keys.length; 7736 if (length !== Object.keys(b).length) { 7737 return false; 7738 } 7739 for (i = length; i-- !== 0; ) { 7740 if (!{}.hasOwnProperty.call(b, keys[i])) { 7741 return false; 7742 } 7743 } 7744 for (i = length; i-- !== 0; ) { 7745 const key = keys[i]; 7746 if (key === "_owner" && a.$$typeof) { 7747 continue; 7748 } 7749 if (!deepEqual(a[key], b[key])) { 7750 return false; 7751 } 7752 } 7753 return true; 7754 } 7755 return a !== a && b !== b; 7756 } 7757 function getDPR(element) { 7758 if (typeof window === "undefined") { 7759 return 1; 7760 } 7761 const win = element.ownerDocument.defaultView || window; 7762 return win.devicePixelRatio || 1; 7763 } 7764 function roundByDPR(element, value) { 7765 const dpr = getDPR(element); 7766 return Math.round(value * dpr) / dpr; 7767 } 7768 function useLatestRef(value) { 7769 const ref = React26.useRef(value); 7770 index(() => { 7771 ref.current = value; 7772 }); 7773 return ref; 7774 } 7775 function useFloating(options) { 7776 if (options === void 0) { 7777 options = {}; 7778 } 7779 const { 7780 placement = "bottom", 7781 strategy = "absolute", 7782 middleware = [], 7783 platform: platform3, 7784 elements: { 7785 reference: externalReference, 7786 floating: externalFloating 7787 } = {}, 7788 transform = true, 7789 whileElementsMounted, 7790 open: open2 7791 } = options; 7792 const [data, setData] = React26.useState({ 7793 x: 0, 7794 y: 0, 7795 strategy, 7796 placement, 7797 middlewareData: {}, 7798 isPositioned: false 7799 }); 7800 const [latestMiddleware, setLatestMiddleware] = React26.useState(middleware); 7801 if (!deepEqual(latestMiddleware, middleware)) { 7802 setLatestMiddleware(middleware); 7803 } 7804 const [_reference, _setReference] = React26.useState(null); 7805 const [_floating, _setFloating] = React26.useState(null); 7806 const setReference = React26.useCallback((node) => { 7807 if (node !== referenceRef.current) { 7808 referenceRef.current = node; 7809 _setReference(node); 7810 } 7811 }, []); 7812 const setFloating = React26.useCallback((node) => { 7813 if (node !== floatingRef.current) { 7814 floatingRef.current = node; 7815 _setFloating(node); 7816 } 7817 }, []); 7818 const referenceEl = externalReference || _reference; 7819 const floatingEl = externalFloating || _floating; 7820 const referenceRef = React26.useRef(null); 7821 const floatingRef = React26.useRef(null); 7822 const dataRef = React26.useRef(data); 7823 const hasWhileElementsMounted = whileElementsMounted != null; 7824 const whileElementsMountedRef = useLatestRef(whileElementsMounted); 7825 const platformRef = useLatestRef(platform3); 7826 const openRef = useLatestRef(open2); 7827 const update2 = React26.useCallback(() => { 7828 if (!referenceRef.current || !floatingRef.current) { 7829 return; 7830 } 7831 const config = { 7832 placement, 7833 strategy, 7834 middleware: latestMiddleware 7835 }; 7836 if (platformRef.current) { 7837 config.platform = platformRef.current; 7838 } 7839 computePosition2(referenceRef.current, floatingRef.current, config).then((data2) => { 7840 const fullData = { 7841 ...data2, 7842 // The floating element's position may be recomputed while it's closed 7843 // but still mounted (such as when transitioning out). To ensure 7844 // `isPositioned` will be `false` initially on the next open, avoid 7845 // setting it to `true` when `open === false` (must be specified). 7846 isPositioned: openRef.current !== false 7847 }; 7848 if (isMountedRef.current && !deepEqual(dataRef.current, fullData)) { 7849 dataRef.current = fullData; 7850 ReactDOM3.flushSync(() => { 7851 setData(fullData); 7852 }); 7853 } 7854 }); 7855 }, [latestMiddleware, placement, strategy, platformRef, openRef]); 7856 index(() => { 7857 if (open2 === false && dataRef.current.isPositioned) { 7858 dataRef.current.isPositioned = false; 7859 setData((data2) => ({ 7860 ...data2, 7861 isPositioned: false 7862 })); 7863 } 7864 }, [open2]); 7865 const isMountedRef = React26.useRef(false); 7866 index(() => { 7867 isMountedRef.current = true; 7868 return () => { 7869 isMountedRef.current = false; 7870 }; 7871 }, []); 7872 index(() => { 7873 if (referenceEl) referenceRef.current = referenceEl; 7874 if (floatingEl) floatingRef.current = floatingEl; 7875 if (referenceEl && floatingEl) { 7876 if (whileElementsMountedRef.current) { 7877 return whileElementsMountedRef.current(referenceEl, floatingEl, update2); 7878 } 7879 update2(); 7880 } 7881 }, [referenceEl, floatingEl, update2, whileElementsMountedRef, hasWhileElementsMounted]); 7882 const refs = React26.useMemo(() => ({ 7883 reference: referenceRef, 7884 floating: floatingRef, 7885 setReference, 7886 setFloating 7887 }), [setReference, setFloating]); 7888 const elements = React26.useMemo(() => ({ 7889 reference: referenceEl, 7890 floating: floatingEl 7891 }), [referenceEl, floatingEl]); 7892 const floatingStyles = React26.useMemo(() => { 7893 const initialStyles = { 7894 position: strategy, 7895 left: 0, 7896 top: 0 7897 }; 7898 if (!elements.floating) { 7899 return initialStyles; 7900 } 7901 const x2 = roundByDPR(elements.floating, data.x); 7902 const y2 = roundByDPR(elements.floating, data.y); 7903 if (transform) { 7904 return { 7905 ...initialStyles, 7906 transform: "translate(" + x2 + "px, " + y2 + "px)", 7907 ...getDPR(elements.floating) >= 1.5 && { 7908 willChange: "transform" 7909 } 7910 }; 7911 } 7912 return { 7913 position: strategy, 7914 left: x2, 7915 top: y2 7916 }; 7917 }, [strategy, transform, elements.floating, data.x, data.y]); 7918 return React26.useMemo(() => ({ 7919 ...data, 7920 update: update2, 7921 refs, 7922 elements, 7923 floatingStyles 7924 }), [data, update2, refs, elements, floatingStyles]); 7925 } 7926 var offset3 = (options, deps) => { 7927 const result = offset2(options); 7928 return { 7929 name: result.name, 7930 fn: result.fn, 7931 options: [options, deps] 7932 }; 7933 }; 7934 var shift3 = (options, deps) => { 7935 const result = shift2(options); 7936 return { 7937 name: result.name, 7938 fn: result.fn, 7939 options: [options, deps] 7940 }; 7941 }; 7942 var limitShift3 = (options, deps) => { 7943 const result = limitShift2(options); 7944 return { 7945 fn: result.fn, 7946 options: [options, deps] 7947 }; 7948 }; 7949 var flip3 = (options, deps) => { 7950 const result = flip2(options); 7951 return { 7952 name: result.name, 7953 fn: result.fn, 7954 options: [options, deps] 7955 }; 7956 }; 7957 var size3 = (options, deps) => { 7958 const result = size2(options); 7959 return { 7960 name: result.name, 7961 fn: result.fn, 7962 options: [options, deps] 7963 }; 7964 }; 7965 7966 // node_modules/@base-ui/react/utils/popups/popupHandle.mjs 7967 var BasePopupHandle = class { 7968 /** 7969 * Stores of every root currently using this handle, in attach order. A handle is meant to be used 7970 * by a single mounted root, but roots can transiently overlap (e.g. during an animated route 7971 * transition), so this stack lets `attachStore`'s cleanup restore the previous root instead of 7972 * leaving a still-mounted root uncontrollable when a newer overlapping root detaches first. 7973 */ 7974 attachedStores = []; 7975 /** 7976 * Store of the root that currently controls the handle: the most recently attached one still 7977 * mounted, or `null` when no root is attached. Imperative methods are no-ops while this is `null`. 7978 */ 7979 attachedStoreValue = null; 7980 /** 7981 * Listeners notified when `attachedStore` changes, so detached triggers can follow the store pointer. 7982 */ 7983 storeListeners = /* @__PURE__ */ new Set(); 7984 /** 7985 * Creates a handle backed by the store used while no root is attached. 7986 * 7987 * @param fallbackStore Inert, closed store handed to detached triggers while no root is attached, 7988 * so they can render and register without a mounted root. Triggers register into whichever store 7989 * `store` currently resolves to, so while detached they live in this store's trigger map and 7990 * migrate themselves to the root's store (and back) as it attaches/detaches. 7991 * @param componentName Component name used to prefix dev warnings, e.g. `'Menu'` produces 7992 * `MenuHandle.open()` in warning text. 7993 * @param throwOnMissingTrigger Whether `open(triggerId)` throws when no trigger with that id is 7994 * registered. Anchored popups (Menu, Popover, Tooltip, PreviewCard) need a trigger to anchor to, 7995 * so they throw; Dialog is not anchored and instead opens unassociated with a dev warning. 7996 */ 7997 constructor(fallbackStore, componentName, throwOnMissingTrigger = true) { 7998 this.fallbackStore = fallbackStore; 7999 this.componentName = componentName; 8000 this.throwOnMissingTrigger = throwOnMissingTrigger; 8001 } 8002 get attachedStore() { 8003 return this.attachedStoreValue; 8004 } 8005 /** 8006 * Store that detached triggers read from: the attached root's store, or an inert fallback store 8007 * used while no root is attached. 8008 * @internal 8009 */ 8010 get store() { 8011 return this.attachedStoreValue ?? this.fallbackStore; 8012 } 8013 /** 8014 * Stable fallback store used for server rendering and hydration. Root stores cannot be recorded on 8015 * the handle during render because a handle can be shared by concurrent server-rendered requests. 8016 * @internal 8017 */ 8018 get serverStore() { 8019 return this.fallbackStore; 8020 } 8021 /** 8022 * Subscribes to changes of the attached store pointer so detached triggers re-render and re-bind 8023 * when a root attaches or detaches. Returns a function that removes the listener. 8024 * @internal 8025 */ 8026 subscribeStore(listener) { 8027 this.storeListeners.add(listener); 8028 return () => { 8029 this.storeListeners.delete(listener); 8030 }; 8031 } 8032 /** 8033 * Points the handle at a root's store and notifies subscribers so detached triggers re-render and 8034 * re-register into it (their registration effect migrates them when the store pointer changes). 8035 * Returns a cleanup function that detaches the store again. 8036 * @internal 8037 */ 8038 attachStore(newStore) { 8039 this.attachedStores.push(newStore); 8040 this.setActiveStore(newStore); 8041 if (true) { 8042 if (this.attachedStores.length > 1) { 8043 const dev = this; 8044 (dev.overlapWarningFrame ??= AnimationFrame.create()).request(() => { 8045 if (this.attachedStores.length > 1) { 8046 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."); 8047 } 8048 }); 8049 } 8050 } 8051 return () => { 8052 const index2 = this.attachedStores.lastIndexOf(newStore); 8053 if (index2 !== -1) { 8054 this.attachedStores.splice(index2, 1); 8055 } 8056 this.setActiveStore(this.attachedStores[this.attachedStores.length - 1] ?? null); 8057 }; 8058 } 8059 /** 8060 * Sets the store that currently controls the handle and notifies subscribers when it changes, so 8061 * detached triggers re-render and migrate their registration to the new store. 8062 */ 8063 setActiveStore(store) { 8064 if (this.attachedStoreValue !== store) { 8065 this.attachedStoreValue = store; 8066 this.storeListeners.forEach((listener) => { 8067 listener(); 8068 }); 8069 } 8070 } 8071 /** 8072 * Opens the attached root's store and associates it with the trigger with the given id, or a 8073 * no-op (with a dev warning) while no root is attached. Shared by every concrete handle's public 8074 * `open()` method, which only narrows the parameter type. 8075 * 8076 * When a trigger id is given but no matching trigger is registered, anchored popups throw (see 8077 * `throwOnMissingTrigger`); Dialog opens unassociated with a dev warning instead. 8078 * 8079 * This method should only be called in an event handler or an effect (not during rendering). 8080 * 8081 * @param triggerId ID of the trigger to associate with the popup, or `null`/`undefined` to open 8082 * without associating any trigger. 8083 */ 8084 openByTrigger(triggerId) { 8085 const attachedStore = this.attachedStore; 8086 if (attachedStore === null) { 8087 if (true) { 8088 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.`); 8089 } 8090 return; 8091 } 8092 let triggerElement; 8093 if (triggerId) { 8094 for (let i = this.attachedStores.length - 1; i >= 0 && !triggerElement; i -= 1) { 8095 triggerElement = this.attachedStores[i].context.triggerElements.getById(triggerId); 8096 } 8097 triggerElement ??= this.fallbackStore.context.triggerElements.getById(triggerId); 8098 } 8099 if (triggerId && !triggerElement) { 8100 if (this.throwOnMissingTrigger) { 8101 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)); 8102 } 8103 if (true) { 8104 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.`); 8105 } 8106 } 8107 attachedStore.setOpen(true, createChangeEventDetails(reason_parts_exports.imperativeAction, void 0, triggerElement)); 8108 } 8109 /** 8110 * Closes the popup by setting the attached root's store to closed, or a no-op (with a dev warning) 8111 * while no root is attached. Shared by every concrete handle's public `close()` method. 8112 * 8113 * This method should only be called in an event handler or an effect (not during rendering). 8114 */ 8115 closePopup() { 8116 const attachedStore = this.attachedStore; 8117 if (attachedStore === null) { 8118 if (true) { 8119 console.warn(`Base UI: $this.componentName}Handle.close() was called while no root using this handle is mounted. The call was ignored.`); 8120 } 8121 return; 8122 } 8123 attachedStore.setOpen(false, createChangeEventDetails(reason_parts_exports.imperativeAction)); 8124 } 8125 }; 8126 8127 // node_modules/@base-ui/react/utils/popups/popupStoreUtils.mjs 8128 var React31 = __toESM(require_react(), 1); 8129 var ReactDOM4 = __toESM(require_react_dom(), 1); 8130 8131 // node_modules/@base-ui/react/floating-ui-react/hooks/useSyncedFloatingRootContext.mjs 8132 var React30 = __toESM(require_react(), 1); 8133 8134 // node_modules/@base-ui/utils/store/useStore.mjs 8135 var React28 = __toESM(require_react(), 1); 8136 var import_shim = __toESM(require_shim(), 1); 8137 var import_with_selector = __toESM(require_with_selector(), 1); 8138 8139 // node_modules/@base-ui/utils/fastHooks.mjs 8140 var React27 = __toESM(require_react(), 1); 8141 var hooks = []; 8142 var currentInstance = void 0; 8143 function getInstance() { 8144 return currentInstance; 8145 } 8146 function register(hook) { 8147 hooks.push(hook); 8148 } 8149 function fastComponent(fn) { 8150 const FastComponent = (props, forwardedRef) => { 8151 const instance = useRefWithInit(createInstance).current; 8152 let result; 8153 try { 8154 currentInstance = instance; 8155 for (const hook of hooks) { 8156 hook.before(instance); 8157 } 8158 result = fn(props, forwardedRef); 8159 for (const hook of hooks) { 8160 hook.after(instance); 8161 } 8162 instance.didInitialize = true; 8163 } finally { 8164 currentInstance = void 0; 8165 } 8166 return result; 8167 }; 8168 FastComponent.displayName = fn.displayName || fn.name; 8169 return FastComponent; 8170 } 8171 function fastComponentRef(fn) { 8172 return /* @__PURE__ */ React27.forwardRef(fastComponent(fn)); 8173 } 8174 function createInstance() { 8175 return { 8176 didInitialize: false 8177 }; 8178 } 8179 8180 // node_modules/@base-ui/utils/store/useStore.mjs 8181 var canUseRawUseSyncExternalStore = isReactVersionAtLeast(19); 8182 var useStoreImplementation = canUseRawUseSyncExternalStore ? useStoreFast : useStoreLegacy; 8183 function useStore(store, selector2, a1, a2, a3) { 8184 return useStoreImplementation(store, selector2, a1, a2, a3); 8185 } 8186 function useStoreR19(store, selector2, a1, a2, a3) { 8187 const getSelection = React28.useCallback(() => selector2(store.getSnapshot(), a1, a2, a3), [store, selector2, a1, a2, a3]); 8188 return (0, import_shim.useSyncExternalStore)(store.subscribe, getSelection, getSelection); 8189 } 8190 register({ 8191 before(instance) { 8192 instance.syncIndex = 0; 8193 if (!instance.didInitialize) { 8194 instance.syncTick = 1; 8195 instance.syncHooks = []; 8196 instance.didChangeStore = true; 8197 instance.getSnapshot = () => { 8198 let didChange2 = false; 8199 for (let i = 0; i < instance.syncHooks.length; i += 1) { 8200 const hook = instance.syncHooks[i]; 8201 const value = hook.selector(hook.store.state, hook.a1, hook.a2, hook.a3); 8202 if (!Object.is(hook.value, value)) { 8203 didChange2 = true; 8204 hook.value = value; 8205 } 8206 } 8207 if (didChange2) { 8208 instance.syncTick += 1; 8209 } 8210 return instance.syncTick; 8211 }; 8212 } 8213 }, 8214 after(instance) { 8215 if (instance.syncHooks.length > 0) { 8216 if (instance.didChangeStore) { 8217 instance.didChangeStore = false; 8218 instance.subscribe = (onStoreChange) => { 8219 const stores = /* @__PURE__ */ new Set(); 8220 for (const hook of instance.syncHooks) { 8221 stores.add(hook.store); 8222 } 8223 const unsubscribes = []; 8224 for (const store of stores) { 8225 unsubscribes.push(store.subscribe(onStoreChange)); 8226 } 8227 return () => { 8228 for (const unsubscribe of unsubscribes) { 8229 unsubscribe(); 8230 } 8231 }; 8232 }; 8233 } 8234 (0, import_shim.useSyncExternalStore)(instance.subscribe, instance.getSnapshot, instance.getSnapshot); 8235 } 8236 } 8237 }); 8238 function useStoreFast(store, selector2, a1, a2, a3) { 8239 const instance = getInstance(); 8240 if (!instance) { 8241 return useStoreR19(store, selector2, a1, a2, a3); 8242 } 8243 const index2 = instance.syncIndex; 8244 instance.syncIndex += 1; 8245 let hook; 8246 if (!instance.didInitialize) { 8247 hook = { 8248 store, 8249 selector: selector2, 8250 a1, 8251 a2, 8252 a3, 8253 value: selector2(store.getSnapshot(), a1, a2, a3) 8254 }; 8255 instance.syncHooks.push(hook); 8256 } else { 8257 hook = instance.syncHooks[index2]; 8258 if (hook.store !== store || hook.selector !== selector2 || !Object.is(hook.a1, a1) || !Object.is(hook.a2, a2) || !Object.is(hook.a3, a3)) { 8259 if (hook.store !== store) { 8260 instance.didChangeStore = true; 8261 } 8262 hook.store = store; 8263 hook.selector = selector2; 8264 hook.a1 = a1; 8265 hook.a2 = a2; 8266 hook.a3 = a3; 8267 hook.value = selector2(store.getSnapshot(), a1, a2, a3); 8268 } 8269 } 8270 return hook.value; 8271 } 8272 function useStoreLegacy(store, selector2, a1, a2, a3) { 8273 return (0, import_with_selector.useSyncExternalStoreWithSelector)(store.subscribe, store.getSnapshot, store.getSnapshot, (state) => selector2(state, a1, a2, a3)); 8274 } 8275 8276 // node_modules/@base-ui/utils/store/Store.mjs 8277 var Store = class { 8278 /** 8279 * Creates a store with the given initial state, constructing the class it is called on. 8280 * Calling it on a generic base class (e.g. `ReactStore.create(...)`) constructs that 8281 * class but degrades the inferred instance type to `Store`; use `new` there instead. 8282 */ 8283 static create(state) { 8284 return new this(state); 8285 } 8286 /** 8287 * The current state of the store. 8288 * This property is updated immediately when the state changes as a result of calling {@link setState}, {@link update}, or {@link set}. 8289 * 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). 8290 * The values can be used directly (to avoid subscribing to the store) in effects or event handlers. 8291 * 8292 * Do not modify properties in state directly. Instead, use the provided methods to ensure proper state management and listener notification. 8293 */ 8294 // Internal state to handle recursive `setState()` calls 8295 constructor(state) { 8296 this.state = state; 8297 this.listeners = /* @__PURE__ */ new Set(); 8298 this.updateTick = 0; 8299 } 8300 /** 8301 * Registers a listener that will be called whenever the store's state changes. 8302 * 8303 * @param fn The listener function to be called on state changes. 8304 * @returns A function to unsubscribe the listener. 8305 */ 8306 subscribe = (fn) => { 8307 this.listeners.add(fn); 8308 return () => { 8309 this.listeners.delete(fn); 8310 }; 8311 }; 8312 /** 8313 * Returns the current state of the store. 8314 */ 8315 getSnapshot = () => { 8316 return this.state; 8317 }; 8318 /** 8319 * Updates the entire store's state and notifies all registered listeners. 8320 * 8321 * @param newState The new state to set for the store. 8322 */ 8323 setState(newState) { 8324 if (this.state === newState) { 8325 return; 8326 } 8327 this.state = newState; 8328 this.updateTick += 1; 8329 const currentTick = this.updateTick; 8330 for (const listener of this.listeners) { 8331 if (currentTick !== this.updateTick) { 8332 return; 8333 } 8334 listener(newState); 8335 } 8336 } 8337 /** 8338 * Merges the provided changes into the current state and notifies listeners if there are changes. 8339 * Each value must match its state key. Pass an exact known subset rather than a broad 8340 * `Partial<State>`, which may contain `undefined` for required state fields. 8341 * 8342 * @param changes An object containing the changes to apply to the current state. 8343 */ 8344 update(changes) { 8345 for (const key in changes) { 8346 if (!Object.is(this.state[key], changes[key])) { 8347 this.setState({ 8348 ...this.state, 8349 ...changes 8350 }); 8351 return; 8352 } 8353 } 8354 } 8355 /** 8356 * Sets a specific key in the store's state to a new value and notifies listeners if the value has changed. 8357 * 8358 * @param key The key in the store's state to update. 8359 * @param value The new value to set for the specified key. 8360 */ 8361 set(key, value) { 8362 if (!Object.is(this.state[key], value)) { 8363 this.setState({ 8364 ...this.state, 8365 [key]: value 8366 }); 8367 } 8368 } 8369 /** 8370 * Gives the state a new reference and updates all registered listeners. 8371 */ 8372 notifyAll() { 8373 const newState = { 8374 ...this.state 8375 }; 8376 this.setState(newState); 8377 } 8378 use(selector2, a1, a2, a3) { 8379 return useStore(this, selector2, a1, a2, a3); 8380 } 8381 }; 8382 8383 // node_modules/@base-ui/utils/store/ReactStore.mjs 8384 var React29 = __toESM(require_react(), 1); 8385 var ReactStore = class extends Store { 8386 /** 8387 * Creates a new ReactStore instance. 8388 * 8389 * @param state Initial state of the store. 8390 * @param context Non-reactive context values. 8391 * @param selectors Optional selectors for use with `useState`. 8392 */ 8393 constructor(state, context = {}, selectors4) { 8394 super(state); 8395 this.context = context; 8396 this.selectors = selectors4; 8397 } 8398 /** 8399 * Non-reactive values such as refs, callbacks, etc. 8400 */ 8401 /** 8402 * Synchronizes a single external value into the store. 8403 * 8404 * Note that the while the value in `state` is updated immediately, the value returned 8405 * by `useState` is updated before the next render (similarly to React's `useState`). 8406 */ 8407 useSyncedValue(key, value) { 8408 React29.useDebugValue(key); 8409 const store = this; 8410 useIsoLayoutEffect(() => { 8411 if (store.state[key] !== value) { 8412 store.set(key, value); 8413 } 8414 }, [store, key, value]); 8415 } 8416 /** 8417 * Synchronizes a single external value into the store and 8418 * cleans it up (sets to `undefined`) on unmount. 8419 * 8420 * Note that the while the value in `state` is updated immediately, the value returned 8421 * by `useState` is updated before the next render (similarly to React's `useState`). 8422 */ 8423 useSyncedValueWithCleanup(key, value) { 8424 const store = this; 8425 useIsoLayoutEffect(() => { 8426 if (store.state[key] !== value) { 8427 store.set(key, value); 8428 } 8429 return () => { 8430 store.set(key, void 0); 8431 }; 8432 }, [store, key, value]); 8433 } 8434 /** 8435 * Synchronizes multiple external values into the store. 8436 * Each value must match its state key. Pass an exact known subset rather than a broad 8437 * `Partial<State>`, which may contain `undefined` for required state fields. 8438 * 8439 * Note that the while the values in `state` are updated immediately, the values returned 8440 * by `useState` are updated before the next render (similarly to React's `useState`). 8441 * 8442 * @param statePart An exact subset of state fields to synchronize. Unknown keys are not accepted. 8443 */ 8444 useSyncedValues(statePart) { 8445 const store = this; 8446 if (true) { 8447 React29.useDebugValue(statePart, (p2) => Object.keys(p2)); 8448 const keys = React29.useRef(Object.keys(statePart)).current; 8449 const nextKeys = Object.keys(statePart); 8450 if (keys.length !== nextKeys.length || keys.some((key, index2) => key !== nextKeys[index2])) { 8451 console.error("ReactStore.useSyncedValues expects the same prop keys on every render. Keys should be stable."); 8452 } 8453 } 8454 const dependencies = Object.values(statePart); 8455 useIsoLayoutEffect(() => { 8456 store.update(statePart); 8457 }, [store, ...dependencies]); 8458 } 8459 /** 8460 * Registers a controllable prop pair (`controlled`, `defaultValue`) for a specific key. If `controlled` 8461 * is non-undefined, the store's state at `key` is updated to match `controlled`. 8462 */ 8463 useControlledProp(key, controlled) { 8464 React29.useDebugValue(key); 8465 const store = this; 8466 const isControlled = controlled !== void 0; 8467 useIsoLayoutEffect(() => { 8468 if (isControlled && !Object.is(store.state[key], controlled)) { 8469 store.setState({ 8470 ...store.state, 8471 [key]: controlled 8472 }); 8473 } 8474 }, [store, key, controlled, isControlled]); 8475 if (true) { 8476 const cache = this.controlledValues ??= /* @__PURE__ */ new Map(); 8477 if (!cache.has(key)) { 8478 cache.set(key, isControlled); 8479 } 8480 const previouslyControlled = cache.get(key); 8481 if (previouslyControlled !== void 0 && previouslyControlled !== isControlled) { 8482 console.error(`A component is changing the $isControlled ? "" : "un"}controlled state of $key.toString()} to be $isControlled ? "un" : ""}controlled. Elements should not switch from uncontrolled to controlled (or vice versa).`); 8483 } 8484 } 8485 } 8486 /** Gets the current value from the store using a selector with the provided key. 8487 * 8488 * @param key Key of the selector to use. 8489 */ 8490 select(key, a1, a2, a3) { 8491 const selector2 = this.selectors[key]; 8492 return selector2(this.state, a1, a2, a3); 8493 } 8494 /** 8495 * Returns a value from the store's state using a selector function. 8496 * Used to subscribe to specific parts of the state. 8497 * This methods causes a rerender whenever the selected state changes. 8498 * 8499 * @param key Key of the selector to use. 8500 */ 8501 useState(key, a1, a2, a3) { 8502 React29.useDebugValue(key); 8503 return useStore(this, this.selectors[key], a1, a2, a3); 8504 } 8505 /** 8506 * Wraps a function with `useStableCallback` to ensure it has a stable reference 8507 * and assigns it to the context. 8508 * 8509 * @param key Key of the event callback. Must be a function in the context. 8510 * @param fn Function to assign. 8511 */ 8512 useContextCallback(key, fn) { 8513 React29.useDebugValue(key); 8514 const stableFunction = useStableCallback(fn ?? NOOP); 8515 this.context[key] = stableFunction; 8516 } 8517 /** 8518 * Returns a stable setter function for a specific key in the store's state. 8519 * It's commonly used to pass as a ref callback to React elements. 8520 * 8521 * @param key Key of the state to set. 8522 */ 8523 useStateSetter(key) { 8524 const ref = React29.useRef(void 0); 8525 if (ref.current === void 0) { 8526 ref.current = (value) => { 8527 this.set(key, value); 8528 }; 8529 } 8530 return ref.current; 8531 } 8532 /** 8533 * Observes changes derived from the store's selectors and calls the listener when the selected value changes. 8534 * 8535 * @param key Key of the selector to observe. 8536 * @param listener Listener function called when the selector result changes. 8537 */ 8538 observe(selector2, listener) { 8539 let selectFn; 8540 if (typeof selector2 === "function") { 8541 selectFn = selector2; 8542 } else { 8543 selectFn = this.selectors[selector2]; 8544 } 8545 let prevValue = selectFn(this.state); 8546 listener(prevValue, prevValue, this); 8547 return this.subscribe((nextState) => { 8548 const nextValue = selectFn(nextState); 8549 if (!Object.is(prevValue, nextValue)) { 8550 const oldValue = prevValue; 8551 prevValue = nextValue; 8552 listener(nextValue, oldValue, this); 8553 } 8554 }); 8555 } 8556 }; 8557 8558 // node_modules/@base-ui/react/floating-ui-react/components/FloatingRootStore.mjs 8559 var selectors = { 8560 open: (state) => state.open, 8561 transitionStatus: (state) => state.transitionStatus, 8562 domReferenceElement: (state) => state.domReferenceElement, 8563 referenceElement: (state) => state.positionReference ?? state.referenceElement, 8564 floatingElement: (state) => state.floatingElement, 8565 floatingId: (state) => state.floatingId 8566 }; 8567 var FloatingRootStore = class extends ReactStore { 8568 constructor(options) { 8569 const { 8570 syncOnly, 8571 nested, 8572 onOpenChange, 8573 triggerElements, 8574 ...initialState 8575 } = options; 8576 super({ 8577 ...initialState, 8578 positionReference: initialState.referenceElement, 8579 domReferenceElement: initialState.referenceElement 8580 }, { 8581 onOpenChange, 8582 dataRef: { 8583 current: {} 8584 }, 8585 events: createEventEmitter(), 8586 nested, 8587 triggerElements 8588 }, selectors); 8589 this.syncOnly = syncOnly; 8590 } 8591 /** 8592 * Syncs the event used by hover logic to distinguish hover-open from click-like interaction. 8593 */ 8594 syncOpenEvent = (newOpen, event) => { 8595 if (!newOpen || !this.state.open || // Prevent a pending hover-open from overwriting a click-open event, while allowing 8596 // click events to upgrade a hover-open. 8597 event != null && isClickLikeEvent(event)) { 8598 this.context.dataRef.current.openEvent = newOpen ? event : void 0; 8599 } 8600 }; 8601 /** 8602 * Runs the root-owned side effects for an open state change. 8603 */ 8604 dispatchOpenChange = (newOpen, eventDetails) => { 8605 this.syncOpenEvent(newOpen, eventDetails.event); 8606 const details = { 8607 open: newOpen, 8608 reason: eventDetails.reason, 8609 nativeEvent: eventDetails.event, 8610 nested: this.context.nested, 8611 triggerElement: eventDetails.trigger 8612 }; 8613 this.context.events.emit("openchange", details); 8614 }; 8615 /** 8616 * Emits the `openchange` event through the internal event emitter and calls the `onOpenChange` handler with the provided arguments. 8617 * 8618 * @param newOpen The new open state. 8619 * @param eventDetails Details about the event that triggered the open state change. 8620 */ 8621 setOpen = (newOpen, eventDetails) => { 8622 if (this.syncOnly) { 8623 this.context.onOpenChange?.(newOpen, eventDetails); 8624 return; 8625 } 8626 this.dispatchOpenChange(newOpen, eventDetails); 8627 this.context.onOpenChange?.(newOpen, eventDetails); 8628 }; 8629 }; 8630 8631 // node_modules/@base-ui/react/floating-ui-react/hooks/useSyncedFloatingRootContext.mjs 8632 function useSyncedFloatingRootContext(options) { 8633 const { 8634 popupStore, 8635 treatPopupAsFloatingElement = false, 8636 floatingRootContext: floatingRootContextProp, 8637 floatingId, 8638 nested, 8639 onOpenChange 8640 } = options; 8641 const open2 = popupStore.useState("open"); 8642 const referenceElement = popupStore.useState("activeTriggerElement"); 8643 const floatingElement = popupStore.useState(treatPopupAsFloatingElement ? "popupElement" : "positionerElement"); 8644 const triggerElements = popupStore.context.triggerElements; 8645 const handleOpenChange = onOpenChange; 8646 const internalStoreRef = React30.useRef(null); 8647 if (floatingRootContextProp === void 0 && internalStoreRef.current === null) { 8648 internalStoreRef.current = new FloatingRootStore({ 8649 open: open2, 8650 transitionStatus: void 0, 8651 referenceElement, 8652 floatingElement, 8653 triggerElements, 8654 onOpenChange: handleOpenChange, 8655 floatingId, 8656 syncOnly: true, 8657 nested 8658 }); 8659 } 8660 const store = floatingRootContextProp ?? internalStoreRef.current; 8661 popupStore.useSyncedValue("floatingId", floatingId); 8662 useIsoLayoutEffect(() => { 8663 const valuesToSync = { 8664 open: open2, 8665 floatingId, 8666 referenceElement, 8667 floatingElement 8668 }; 8669 if (isElement(referenceElement)) { 8670 valuesToSync.domReferenceElement = referenceElement; 8671 } 8672 if (store.state.positionReference === store.state.referenceElement) { 8673 valuesToSync.positionReference = referenceElement; 8674 } 8675 store.update(valuesToSync); 8676 }, [open2, floatingId, referenceElement, floatingElement, store]); 8677 store.context.onOpenChange = handleOpenChange; 8678 store.context.nested = nested; 8679 return store; 8680 } 8681 8682 // node_modules/@base-ui/react/utils/popups/popupStoreUtils.mjs 8683 var FOCUSABLE_POPUP_PROPS = { 8684 tabIndex: -1, 8685 [FOCUSABLE_ATTRIBUTE]: "" 8686 }; 8687 function usePopupRootStore(createStore2, treatPopupAsFloatingElement = false) { 8688 const floatingId = useId(); 8689 const nested = useFloatingParentNodeId() != null; 8690 const store = useRefWithInit(() => createStore2(floatingId, nested)).current; 8691 useSyncedFloatingRootContext({ 8692 popupStore: store, 8693 treatPopupAsFloatingElement, 8694 floatingRootContext: store.state.floatingRootContext, 8695 floatingId, 8696 nested, 8697 onOpenChange: store.setOpen 8698 }); 8699 return store; 8700 } 8701 function PopupHandleAttachment({ 8702 handle, 8703 store 8704 }) { 8705 useIsoLayoutEffect(() => { 8706 return handle.attachStore(store); 8707 }, [handle, store]); 8708 return null; 8709 } 8710 function syncTriggerCount(store) { 8711 const triggerCount = store.context.triggerElements.size; 8712 if (store.select("open") && store.state.triggerCount !== triggerCount) { 8713 store.set("triggerCount", triggerCount); 8714 } 8715 } 8716 function useTriggerRegistration(id, store) { 8717 const registrationRef = React31.useRef(null); 8718 return useStableCallback((element) => { 8719 const registration = registrationRef.current; 8720 if (registration !== null) { 8721 if (registration.element === element && registration.store === store && registration.id === id) { 8722 return; 8723 } 8724 registrationRef.current = null; 8725 const registeredStore = registration.store; 8726 if (registeredStore.context.triggerElements.getById(registration.id) === registration.element) { 8727 registeredStore.context.triggerElements.delete(registration.id); 8728 syncTriggerCount(registeredStore); 8729 } 8730 } 8731 if (element !== null && id !== void 0) { 8732 registrationRef.current = { 8733 store, 8734 id, 8735 element 8736 }; 8737 store.context.triggerElements.add(id, element); 8738 syncTriggerCount(store); 8739 } 8740 }); 8741 } 8742 function createPopupOpenState(state, open2, trigger, preventUnmountOnClose = false) { 8743 let preventUnmountingOnClose = state.preventUnmountingOnClose; 8744 if (open2) { 8745 preventUnmountingOnClose = false; 8746 } else if (preventUnmountOnClose) { 8747 preventUnmountingOnClose = true; 8748 } 8749 const triggerId = trigger?.id ?? null; 8750 let activeTriggerId = state.activeTriggerId; 8751 let activeTriggerElement = state.activeTriggerElement; 8752 if (triggerId || open2) { 8753 activeTriggerId = triggerId; 8754 activeTriggerElement = trigger ?? null; 8755 } 8756 return { 8757 open: open2, 8758 preventUnmountingOnClose, 8759 activeTriggerId, 8760 activeTriggerElement 8761 }; 8762 } 8763 function attachPreventUnmountOnClose(eventDetails) { 8764 let preventUnmountOnClose = false; 8765 eventDetails.preventUnmountOnClose = () => { 8766 preventUnmountOnClose = true; 8767 }; 8768 return () => preventUnmountOnClose; 8769 } 8770 function applyPopupOpenChange(store, nextOpen, eventDetails, options = {}) { 8771 const reason = eventDetails.reason; 8772 const isHover = reason === reason_parts_exports.triggerHover; 8773 const isFocusOpen = nextOpen && reason === reason_parts_exports.triggerFocus; 8774 const isDismissClose = !nextOpen && (reason === reason_parts_exports.triggerPress || reason === reason_parts_exports.escapeKey); 8775 const shouldPreventUnmountOnClose = attachPreventUnmountOnClose(eventDetails); 8776 store.context.onOpenChange?.(nextOpen, eventDetails); 8777 if (eventDetails.isCanceled) { 8778 return; 8779 } 8780 options.onBeforeDispatch?.(); 8781 store.state.floatingRootContext.dispatchOpenChange(nextOpen, eventDetails); 8782 const changeState = () => { 8783 const popupOpenState = createPopupOpenState(store.state, nextOpen, eventDetails.trigger, shouldPreventUnmountOnClose()); 8784 const updatedState = { 8785 ...options.extraState, 8786 ...popupOpenState 8787 }; 8788 if (isFocusOpen) { 8789 updatedState.instantType = "focus"; 8790 } else if (isDismissClose) { 8791 updatedState.instantType = "dismiss"; 8792 } else if (isHover) { 8793 updatedState.instantType = void 0; 8794 } 8795 store.update(updatedState); 8796 }; 8797 if (isHover) { 8798 ReactDOM4.flushSync(changeState); 8799 } else { 8800 changeState(); 8801 } 8802 } 8803 function useTriggerDataForwarding(triggerId, triggerElementRef, store, stateUpdates) { 8804 const isMountedByThisTrigger = store.useState("isMountedByTrigger", triggerId); 8805 const baseRegisterTrigger = useTriggerRegistration(triggerId, store); 8806 const applyTriggerData = useStableCallback((element) => { 8807 const open2 = store.select("open"); 8808 const activeTriggerId = store.select("activeTriggerId"); 8809 if (activeTriggerId === triggerId) { 8810 const changes = { 8811 activeTriggerElement: element, 8812 ...open2 ? stateUpdates : null 8813 }; 8814 store.update(changes); 8815 return; 8816 } 8817 if (activeTriggerId == null && open2) { 8818 const changes = { 8819 activeTriggerId: triggerId ?? null, 8820 activeTriggerElement: element, 8821 ...stateUpdates 8822 }; 8823 store.update(changes); 8824 } 8825 }); 8826 const registerTrigger = useStableCallback((element) => { 8827 baseRegisterTrigger(element); 8828 if (element) { 8829 applyTriggerData(element); 8830 } 8831 }); 8832 useIsoLayoutEffect(() => { 8833 registerTrigger(triggerElementRef.current); 8834 return () => registerTrigger(null); 8835 }, [registerTrigger, triggerElementRef, store, triggerId]); 8836 useIsoLayoutEffect(() => { 8837 if (isMountedByThisTrigger) { 8838 const changes = { 8839 activeTriggerElement: triggerElementRef.current, 8840 ...stateUpdates 8841 }; 8842 store.update(changes); 8843 } 8844 }, [isMountedByThisTrigger, store, triggerElementRef, ...Object.values(stateUpdates)]); 8845 return { 8846 registerTrigger, 8847 isMountedByThisTrigger 8848 }; 8849 } 8850 function useImplicitActiveTrigger(store, options = {}) { 8851 const { 8852 closeOnActiveTriggerUnmount = false 8853 } = options; 8854 const resolvedActiveTriggerIdRef = React31.useRef(null); 8855 const open2 = store.useState("open"); 8856 const reactiveTriggerCount = store.useState("triggerCount"); 8857 const activeTriggerId = store.useState("activeTriggerId"); 8858 const reactiveActiveTriggerElement = store.useState("activeTriggerElement"); 8859 useIsoLayoutEffect(() => { 8860 if (!open2) { 8861 resolvedActiveTriggerIdRef.current = null; 8862 if (store.state.triggerCount !== 0) { 8863 store.set("triggerCount", 0); 8864 } 8865 return; 8866 } 8867 const triggerCount = store.context.triggerElements.size; 8868 const stateUpdates = {}; 8869 if (store.state.triggerCount !== triggerCount) { 8870 stateUpdates.triggerCount = triggerCount; 8871 } 8872 const currentActiveTriggerId = store.select("activeTriggerId"); 8873 let lostActiveTriggerId = null; 8874 if (currentActiveTriggerId) { 8875 const activeTriggerElement = store.context.triggerElements.getById(currentActiveTriggerId); 8876 if (!activeTriggerElement) { 8877 for (const [triggerId, triggerElement] of store.context.triggerElements.entries()) { 8878 if (triggerElement === store.state.activeTriggerElement) { 8879 stateUpdates.activeTriggerId = triggerId; 8880 stateUpdates.activeTriggerElement = triggerElement; 8881 resolvedActiveTriggerIdRef.current = triggerId; 8882 break; 8883 } 8884 } 8885 if (stateUpdates.activeTriggerId === void 0) { 8886 if (resolvedActiveTriggerIdRef.current === currentActiveTriggerId) { 8887 lostActiveTriggerId = currentActiveTriggerId; 8888 } else { 8889 resolvedActiveTriggerIdRef.current = null; 8890 } 8891 } 8892 } else { 8893 resolvedActiveTriggerIdRef.current = currentActiveTriggerId; 8894 if (activeTriggerElement !== store.state.activeTriggerElement) { 8895 stateUpdates.activeTriggerElement = activeTriggerElement; 8896 } 8897 } 8898 } else { 8899 resolvedActiveTriggerIdRef.current = null; 8900 } 8901 if (!lostActiveTriggerId && !currentActiveTriggerId && triggerCount === 1) { 8902 const iteratorResult = store.context.triggerElements.entries().next(); 8903 if (!iteratorResult.done) { 8904 const [implicitTriggerId, implicitTriggerElement] = iteratorResult.value; 8905 stateUpdates.activeTriggerId = implicitTriggerId; 8906 stateUpdates.activeTriggerElement = implicitTriggerElement; 8907 resolvedActiveTriggerIdRef.current = implicitTriggerId; 8908 } 8909 } 8910 if (stateUpdates.triggerCount !== void 0 || stateUpdates.activeTriggerId !== void 0 || stateUpdates.activeTriggerElement !== void 0) { 8911 store.update(stateUpdates); 8912 } 8913 if (lostActiveTriggerId) { 8914 if (closeOnActiveTriggerUnmount) { 8915 queueMicrotask(() => { 8916 if (store.select("open") && store.select("activeTriggerId") === lostActiveTriggerId && !store.context.triggerElements.getById(lostActiveTriggerId)) { 8917 const eventDetails = createChangeEventDetails(reason_parts_exports.none); 8918 store.setOpen(false, eventDetails); 8919 if (!eventDetails.isCanceled) { 8920 store.update({ 8921 activeTriggerId: null, 8922 activeTriggerElement: null 8923 }); 8924 } 8925 } 8926 }); 8927 } 8928 } 8929 }, [open2, store, reactiveTriggerCount, activeTriggerId, reactiveActiveTriggerElement, closeOnActiveTriggerUnmount]); 8930 } 8931 function useOpenStateTransitions(open2, store, onUnmount, animateInitialOpen) { 8932 const { 8933 mounted, 8934 setMounted, 8935 transitionStatus 8936 } = useTransitionStatus(open2, false, false, animateInitialOpen); 8937 const preventUnmountingOnClose = store.useState("preventUnmountingOnClose"); 8938 const syncedPreventUnmountingOnClose = open2 ? false : preventUnmountingOnClose; 8939 store.useSyncedValues({ 8940 mounted, 8941 transitionStatus, 8942 preventUnmountingOnClose: syncedPreventUnmountingOnClose 8943 }); 8944 const forceUnmount = useStableCallback(() => { 8945 setMounted(false); 8946 store.update({ 8947 activeTriggerId: null, 8948 activeTriggerElement: null, 8949 mounted: false, 8950 preventUnmountingOnClose: false 8951 }); 8952 onUnmount?.(); 8953 store.context.onOpenChangeComplete?.(false); 8954 }); 8955 useOpenChangeComplete({ 8956 enabled: mounted && !open2 && !syncedPreventUnmountingOnClose, 8957 open: open2, 8958 ref: store.context.popupRef, 8959 onComplete() { 8960 if (!open2) { 8961 forceUnmount(); 8962 } 8963 } 8964 }); 8965 return { 8966 forceUnmount, 8967 transitionStatus 8968 }; 8969 } 8970 function usePopupInteractionProps(store, statePart) { 8971 store.useSyncedValues(statePart); 8972 useIsoLayoutEffect(() => () => { 8973 store.update({ 8974 activeTriggerProps: EMPTY_OBJECT, 8975 inactiveTriggerProps: EMPTY_OBJECT, 8976 popupProps: EMPTY_OBJECT 8977 }); 8978 }, [store]); 8979 } 8980 8981 // node_modules/@base-ui/react/utils/popups/popupTriggerMap.mjs 8982 var devElementIdsByMap; 8983 function getDevElementIds(map) { 8984 devElementIdsByMap ??= /* @__PURE__ */ new WeakMap(); 8985 let elementIds = devElementIdsByMap.get(map); 8986 if (!elementIds) { 8987 elementIds = /* @__PURE__ */ new WeakMap(); 8988 devElementIdsByMap.set(map, elementIds); 8989 } 8990 return elementIds; 8991 } 8992 var PopupTriggerMap = class { 8993 constructor() { 8994 this.idMap = /* @__PURE__ */ new Map(); 8995 } 8996 /** 8997 * Adds a trigger element with the given ID. 8998 * 8999 * Note: The provided element is assumed to not be registered under multiple IDs. 9000 */ 9001 add(id, element) { 9002 if (true) { 9003 const elementIds = getDevElementIds(this); 9004 const existingId = elementIds.get(element); 9005 if (existingId !== void 0 && existingId !== id) { 9006 throw new Error("Base UI: A trigger element cannot be registered under multiple IDs in PopupTriggerMap."); 9007 } 9008 const previousElement = this.idMap.get(id); 9009 if (previousElement !== void 0 && previousElement !== element) { 9010 elementIds.delete(previousElement); 9011 } 9012 elementIds.set(element, id); 9013 } 9014 this.idMap.set(id, element); 9015 } 9016 /** 9017 * Removes the trigger element with the given ID. 9018 */ 9019 delete(id) { 9020 if (true) { 9021 const element = this.idMap.get(id); 9022 if (element !== void 0) { 9023 devElementIdsByMap?.get(this)?.delete(element); 9024 } 9025 } 9026 this.idMap.delete(id); 9027 } 9028 /** 9029 * Whether the given element is registered as a trigger. 9030 */ 9031 hasElement(element) { 9032 for (const registered of this.idMap.values()) { 9033 if (registered === element) { 9034 return true; 9035 } 9036 } 9037 return false; 9038 } 9039 /** 9040 * Whether there is a registered trigger element matching the given predicate. 9041 */ 9042 hasMatchingElement(predicate) { 9043 for (const element of this.idMap.values()) { 9044 if (predicate(element)) { 9045 return true; 9046 } 9047 } 9048 return false; 9049 } 9050 /** 9051 * Returns the trigger element associated with the given ID, or undefined if no such element exists. 9052 */ 9053 getById(id) { 9054 return this.idMap.get(id); 9055 } 9056 /** 9057 * Returns an iterable of all registered trigger entries, where each entry is a tuple of [id, element]. 9058 */ 9059 entries() { 9060 return this.idMap.entries(); 9061 } 9062 /** 9063 * Returns an iterable of all registered trigger elements. 9064 */ 9065 elements() { 9066 return this.idMap.values(); 9067 } 9068 /** 9069 * Returns the number of registered trigger elements. 9070 */ 9071 get size() { 9072 return this.idMap.size; 9073 } 9074 }; 9075 9076 // node_modules/@base-ui/react/utils/popups/store.mjs 9077 function createInitialPopupStoreState(triggerElements, floatingId, nested = false) { 9078 return { 9079 open: false, 9080 openProp: void 0, 9081 mounted: false, 9082 transitionStatus: void 0, 9083 floatingRootContext: new FloatingRootStore({ 9084 open: false, 9085 transitionStatus: void 0, 9086 floatingElement: null, 9087 referenceElement: null, 9088 triggerElements, 9089 floatingId, 9090 syncOnly: true, 9091 nested, 9092 onOpenChange: void 0 9093 }), 9094 floatingId, 9095 triggerCount: 0, 9096 preventUnmountingOnClose: false, 9097 payload: void 0, 9098 activeTriggerId: null, 9099 activeTriggerElement: null, 9100 triggerIdProp: void 0, 9101 popupElement: null, 9102 positionerElement: null, 9103 activeTriggerProps: EMPTY_OBJECT, 9104 inactiveTriggerProps: EMPTY_OBJECT, 9105 popupProps: EMPTY_OBJECT 9106 }; 9107 } 9108 var activeTriggerIdSelector = (state) => state.triggerIdProp ?? state.activeTriggerId; 9109 var openSelector = (state) => state.openProp ?? state.open; 9110 var popupIdSelector = (state) => { 9111 const popupId = state.popupElement?.id ?? state.floatingId; 9112 return popupId || void 0; 9113 }; 9114 function triggerOwnsOpenPopup(state, triggerId) { 9115 return triggerId !== void 0 && openSelector(state) && activeTriggerIdSelector(state) === triggerId; 9116 } 9117 function triggerOwnsOpenPopupOrIsOnlyTrigger(state, triggerId) { 9118 if (triggerOwnsOpenPopup(state, triggerId)) { 9119 return true; 9120 } 9121 return triggerId !== void 0 && openSelector(state) && activeTriggerIdSelector(state) == null && state.triggerCount === 1; 9122 } 9123 var popupStoreSelectors = { 9124 open: openSelector, 9125 mounted: (state) => state.mounted, 9126 transitionStatus: (state) => state.transitionStatus, 9127 floatingRootContext: (state) => state.floatingRootContext, 9128 triggerCount: (state) => state.triggerCount, 9129 preventUnmountingOnClose: (state) => state.preventUnmountingOnClose, 9130 payload: (state) => state.payload, 9131 activeTriggerId: activeTriggerIdSelector, 9132 activeTriggerElement: (state) => state.mounted ? state.activeTriggerElement : null, 9133 popupId: popupIdSelector, 9134 /** 9135 * Whether the trigger with the given ID was used to open the popup. 9136 */ 9137 isTriggerActive: (state, triggerId) => triggerId !== void 0 && activeTriggerIdSelector(state) === triggerId, 9138 /** 9139 * Whether the popup is open and was activated by a trigger with the given ID. 9140 */ 9141 isOpenedByTrigger: (state, triggerId) => triggerOwnsOpenPopup(state, triggerId), 9142 /** 9143 * Whether the popup is mounted and was activated by a trigger with the given ID. 9144 */ 9145 isMountedByTrigger: (state, triggerId) => triggerId !== void 0 && activeTriggerIdSelector(state) === triggerId && state.mounted, 9146 triggerProps: (state, isActive) => isActive ? state.activeTriggerProps : state.inactiveTriggerProps, 9147 /** 9148 * Popup id for the trigger that currently owns the open popup. 9149 */ 9150 triggerPopupId: (state, triggerId) => triggerOwnsOpenPopupOrIsOnlyTrigger(state, triggerId) ? popupIdSelector(state) : void 0, 9151 popupProps: (state) => state.popupProps, 9152 popupElement: (state) => state.popupElement, 9153 positionerElement: (state) => state.positionerElement 9154 }; 9155 9156 // node_modules/@base-ui/react/utils/popups/usePopupHandleStore.mjs 9157 var React32 = __toESM(require_react(), 1); 9158 var import_shim2 = __toESM(require_shim(), 1); 9159 function usePopupHandleStore(handle) { 9160 const subscribe2 = React32.useCallback((listener) => { 9161 if (handle === void 0) { 9162 return NOOP; 9163 } 9164 return handle.subscribeStore(listener); 9165 }, [handle]); 9166 const getSnapshot = React32.useCallback(() => { 9167 return handle === void 0 ? void 0 : handle.store; 9168 }, [handle]); 9169 return (0, import_shim2.useSyncExternalStore)(subscribe2, getSnapshot, () => handle?.serverStore); 9170 } 9171 9172 // node_modules/@base-ui/react/floating-ui-react/hooks/useFloating.mjs 9173 function useBaseUIFloating(options) { 9174 return useFloatingWithStore(options, options.rootContext); 9175 } 9176 function useFloatingWithStore(options, store) { 9177 const { 9178 nodeId, 9179 externalTree 9180 } = options; 9181 const referenceElement = store.useState("referenceElement"); 9182 const floatingElement = store.useState("floatingElement"); 9183 const domReferenceElement = store.useState("domReferenceElement"); 9184 const open2 = store.useState("open"); 9185 const floatingId = store.useState("floatingId"); 9186 const [positionReference, setPositionReferenceRaw] = React33.useState(null); 9187 const [localDomReference, setLocalDomReference] = React33.useState(void 0); 9188 const [localFloatingElement, setLocalFloatingElement] = React33.useState(void 0); 9189 const domReferenceRef = React33.useRef(null); 9190 const tree = useFloatingTree(externalTree); 9191 const storeElements = React33.useMemo(() => ({ 9192 reference: referenceElement, 9193 floating: floatingElement, 9194 domReference: domReferenceElement 9195 }), [referenceElement, floatingElement, domReferenceElement]); 9196 const position = useFloating({ 9197 ...options, 9198 elements: { 9199 ...storeElements, 9200 ...positionReference && { 9201 reference: positionReference 9202 } 9203 } 9204 }); 9205 const localDomReferenceElement = isElement(localDomReference) ? localDomReference : null; 9206 const syncedFloatingElement = localFloatingElement === void 0 ? store.state.floatingElement : localFloatingElement; 9207 store.useSyncedValue("referenceElement", localDomReference ?? null); 9208 store.useSyncedValue("domReferenceElement", localDomReference === void 0 ? domReferenceElement : localDomReferenceElement); 9209 store.useSyncedValue("floatingElement", syncedFloatingElement); 9210 const setPositionReference = React33.useCallback((node) => { 9211 const computedPositionReference = isElement(node) ? { 9212 getBoundingClientRect: () => node.getBoundingClientRect(), 9213 getClientRects: () => node.getClientRects(), 9214 contextElement: node 9215 } : node; 9216 setPositionReferenceRaw(computedPositionReference); 9217 position.refs.setReference(computedPositionReference); 9218 }, [position.refs]); 9219 const setReference = React33.useCallback((node) => { 9220 if (isElement(node) || node === null) { 9221 domReferenceRef.current = node; 9222 setLocalDomReference(node); 9223 } 9224 if (isElement(position.refs.reference.current) || position.refs.reference.current === null || // Don't allow setting virtual elements using the old technique back to 9225 // `null` to support `positionReference` + an unstable `reference` 9226 // callback ref. 9227 node !== null && !isElement(node)) { 9228 position.refs.setReference(node); 9229 } 9230 }, [position.refs, setLocalDomReference]); 9231 const setFloating = React33.useCallback((node) => { 9232 setLocalFloatingElement(node); 9233 position.refs.setFloating(node); 9234 }, [position.refs]); 9235 const refs = React33.useMemo(() => ({ 9236 ...position.refs, 9237 setReference, 9238 setFloating, 9239 setPositionReference, 9240 domReference: domReferenceRef 9241 }), [position.refs, setReference, setFloating, setPositionReference]); 9242 const elements = React33.useMemo(() => ({ 9243 ...position.elements, 9244 domReference: domReferenceElement 9245 }), [position.elements, domReferenceElement]); 9246 const context = React33.useMemo(() => ({ 9247 ...position, 9248 dataRef: store.context.dataRef, 9249 open: open2, 9250 onOpenChange: store.setOpen, 9251 events: store.context.events, 9252 floatingId, 9253 refs, 9254 elements, 9255 nodeId, 9256 rootStore: store 9257 }), [position, refs, elements, nodeId, store, open2, floatingId]); 9258 useIsoLayoutEffect(() => { 9259 if (domReferenceElement) { 9260 domReferenceRef.current = domReferenceElement; 9261 } 9262 }, [domReferenceElement]); 9263 useIsoLayoutEffect(() => { 9264 store.context.dataRef.current.floatingContext = context; 9265 const node = tree?.nodesRef.current.find((n) => n.id === nodeId); 9266 if (node) { 9267 node.context = context; 9268 } 9269 }); 9270 return React33.useMemo(() => ({ 9271 ...position, 9272 context, 9273 refs, 9274 elements, 9275 rootStore: store 9276 }), [position, refs, elements, context, store]); 9277 } 9278 9279 // node_modules/@base-ui/react/floating-ui-react/hooks/useFocus.mjs 9280 var React34 = __toESM(require_react(), 1); 9281 var isMacSafari = parts_exports.os.mac && parts_exports.engine.webkit; 9282 function useFocus(context, props = {}) { 9283 const { 9284 enabled = true, 9285 delay 9286 } = props; 9287 const store = "rootStore" in context ? context.rootStore : context; 9288 const { 9289 events, 9290 dataRef 9291 } = store.context; 9292 const blockFocusRef = React34.useRef(false); 9293 const blockedReferenceRef = React34.useRef(null); 9294 const keyboardModalityRef = React34.useRef(true); 9295 const timeout = useTimeout(); 9296 React34.useEffect(() => { 9297 const domReference = store.select("domReferenceElement"); 9298 if (!enabled) { 9299 return void 0; 9300 } 9301 const win = getWindow(domReference); 9302 function onBlur() { 9303 const currentDomReference = store.select("domReferenceElement"); 9304 if (!store.select("open") && isHTMLElement(currentDomReference) && currentDomReference === activeElement(ownerDocument(currentDomReference))) { 9305 blockFocusRef.current = true; 9306 blockedReferenceRef.current = currentDomReference; 9307 } 9308 } 9309 function onKeyDown() { 9310 keyboardModalityRef.current = true; 9311 } 9312 function onPointerDown() { 9313 keyboardModalityRef.current = false; 9314 } 9315 return mergeCleanups(addEventListener(win, "blur", onBlur), isMacSafari && addEventListener(win, "keydown", onKeyDown, true), isMacSafari && addEventListener(win, "pointerdown", onPointerDown, true)); 9316 }, [store, enabled]); 9317 React34.useEffect(() => { 9318 if (!enabled) { 9319 return void 0; 9320 } 9321 function onOpenChangeLocal(details) { 9322 if (details.reason === reason_parts_exports.triggerPress || details.reason === reason_parts_exports.escapeKey) { 9323 const referenceElement = store.select("domReferenceElement"); 9324 if (isElement(referenceElement)) { 9325 blockedReferenceRef.current = referenceElement; 9326 blockFocusRef.current = true; 9327 } 9328 } 9329 } 9330 events.on("openchange", onOpenChangeLocal); 9331 return () => { 9332 events.off("openchange", onOpenChangeLocal); 9333 }; 9334 }, [events, enabled, store]); 9335 const reference = React34.useMemo(() => { 9336 function resetBlockedFocus() { 9337 blockFocusRef.current = false; 9338 blockedReferenceRef.current = null; 9339 } 9340 return { 9341 onMouseLeave() { 9342 resetBlockedFocus(); 9343 }, 9344 onFocus(event) { 9345 const focusTarget = event.currentTarget; 9346 if (blockFocusRef.current) { 9347 if (blockedReferenceRef.current === focusTarget) { 9348 return; 9349 } 9350 resetBlockedFocus(); 9351 } 9352 const target = getTarget(event.nativeEvent); 9353 if (isElement(target)) { 9354 if (isMacSafari && !event.relatedTarget) { 9355 if (!keyboardModalityRef.current && !isTypeableElement(target)) { 9356 return; 9357 } 9358 } else if (!matchesFocusVisible(target)) { 9359 return; 9360 } 9361 } 9362 const movedFromOtherEnabledTrigger = isTargetInsideEnabledTrigger(event.relatedTarget, store.context.triggerElements); 9363 const { 9364 nativeEvent, 9365 currentTarget 9366 } = event; 9367 const delayValue = typeof delay === "function" ? delay() : delay; 9368 if (store.select("open") && movedFromOtherEnabledTrigger || delayValue === 0 || delayValue === void 0) { 9369 store.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerFocus, nativeEvent, currentTarget)); 9370 return; 9371 } 9372 timeout.start(delayValue, () => { 9373 if (blockFocusRef.current) { 9374 return; 9375 } 9376 store.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerFocus, nativeEvent, currentTarget)); 9377 }); 9378 }, 9379 onBlur(event) { 9380 resetBlockedFocus(); 9381 const relatedTarget = event.relatedTarget; 9382 const nativeEvent = event.nativeEvent; 9383 const movedToFocusGuard = isElement(relatedTarget) && relatedTarget.hasAttribute(createAttribute("focus-guard")) && relatedTarget.getAttribute("data-type") === "outside"; 9384 timeout.start(0, () => { 9385 const domReference = store.select("domReferenceElement"); 9386 const activeEl = activeElement(ownerDocument(domReference)); 9387 if (!relatedTarget && activeEl === domReference) { 9388 return; 9389 } 9390 if (contains(dataRef.current.floatingContext?.refs.floating.current, activeEl) || contains(domReference, activeEl) || movedToFocusGuard) { 9391 return; 9392 } 9393 const nextFocusedElement = relatedTarget ?? activeEl; 9394 if (isTargetInsideEnabledTrigger(nextFocusedElement, store.context.triggerElements)) { 9395 return; 9396 } 9397 store.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerFocus, nativeEvent)); 9398 }); 9399 } 9400 }; 9401 }, [dataRef, delay, store, timeout]); 9402 return React34.useMemo(() => enabled ? { 9403 reference, 9404 trigger: reference 9405 } : {}, [enabled, reference]); 9406 } 9407 9408 // node_modules/@base-ui/react/floating-ui-react/hooks/useHoverFloatingInteraction.mjs 9409 var React35 = __toESM(require_react(), 1); 9410 9411 // node_modules/@base-ui/react/floating-ui-react/hooks/useHoverInteractionSharedState.mjs 9412 var HoverInteraction = class _HoverInteraction { 9413 constructor() { 9414 this.pointerType = void 0; 9415 this.interactedInside = false; 9416 this.handler = void 0; 9417 this.blockMouseMove = true; 9418 this.performedPointerEventsMutation = false; 9419 this.pointerEventsScopeElement = null; 9420 this.pointerEventsReferenceElement = null; 9421 this.pointerEventsFloatingElement = null; 9422 this.restTimeoutPending = false; 9423 this.openChangeTimeout = new Timeout(); 9424 this.restTimeout = new Timeout(); 9425 this.handleCloseOptions = void 0; 9426 } 9427 static create() { 9428 return new _HoverInteraction(); 9429 } 9430 dispose = () => { 9431 this.openChangeTimeout.clear(); 9432 this.restTimeout.clear(); 9433 }; 9434 disposeEffect = () => { 9435 return this.dispose; 9436 }; 9437 }; 9438 var pointerEventsMutationOwnerByScopeElement = /* @__PURE__ */ new WeakMap(); 9439 function clearSafePolygonPointerEventsMutation(instance) { 9440 if (!instance.performedPointerEventsMutation) { 9441 return; 9442 } 9443 const scopeElement = instance.pointerEventsScopeElement; 9444 if (scopeElement && pointerEventsMutationOwnerByScopeElement.get(scopeElement) === instance) { 9445 instance.pointerEventsScopeElement?.style.removeProperty("pointer-events"); 9446 instance.pointerEventsReferenceElement?.style.removeProperty("pointer-events"); 9447 instance.pointerEventsFloatingElement?.style.removeProperty("pointer-events"); 9448 pointerEventsMutationOwnerByScopeElement.delete(scopeElement); 9449 } 9450 instance.performedPointerEventsMutation = false; 9451 instance.pointerEventsScopeElement = null; 9452 instance.pointerEventsReferenceElement = null; 9453 instance.pointerEventsFloatingElement = null; 9454 } 9455 function applySafePolygonPointerEventsMutation(instance, options) { 9456 const { 9457 scopeElement, 9458 referenceElement, 9459 floatingElement 9460 } = options; 9461 const existingOwner = pointerEventsMutationOwnerByScopeElement.get(scopeElement); 9462 if (existingOwner && existingOwner !== instance) { 9463 clearSafePolygonPointerEventsMutation(existingOwner); 9464 } 9465 clearSafePolygonPointerEventsMutation(instance); 9466 instance.performedPointerEventsMutation = true; 9467 instance.pointerEventsScopeElement = scopeElement; 9468 instance.pointerEventsReferenceElement = referenceElement; 9469 instance.pointerEventsFloatingElement = floatingElement; 9470 pointerEventsMutationOwnerByScopeElement.set(scopeElement, instance); 9471 scopeElement.style.pointerEvents = "none"; 9472 referenceElement.style.pointerEvents = "auto"; 9473 floatingElement.style.pointerEvents = "auto"; 9474 } 9475 function useHoverInteractionSharedState(store) { 9476 const data = store.context.dataRef.current; 9477 const instance = useRefWithInit(() => data.hoverInteractionState ?? HoverInteraction.create()).current; 9478 if (!data.hoverInteractionState) { 9479 data.hoverInteractionState = instance; 9480 } 9481 useOnMount(data.hoverInteractionState.disposeEffect); 9482 return data.hoverInteractionState; 9483 } 9484 9485 // node_modules/@base-ui/react/floating-ui-react/hooks/useHoverFloatingInteraction.mjs 9486 function useHoverFloatingInteraction(context, parameters = {}) { 9487 const { 9488 enabled = true, 9489 closeDelay: closeDelayProp = 0, 9490 nodeId: nodeIdProp 9491 } = parameters; 9492 const store = "rootStore" in context ? context.rootStore : context; 9493 const open2 = store.useState("open"); 9494 const floatingElement = store.useState("floatingElement"); 9495 const domReferenceElement = store.useState("domReferenceElement"); 9496 const { 9497 dataRef 9498 } = store.context; 9499 const tree = useFloatingTree(); 9500 const parentId = useFloatingParentNodeId(); 9501 const instance = useHoverInteractionSharedState(store); 9502 const childClosedTimeout = useTimeout(); 9503 const isClickLikeOpenEvent2 = useStableCallback(() => { 9504 return isClickLikeOpenEvent(dataRef.current.openEvent?.type, instance.interactedInside); 9505 }); 9506 const isHoverOpen = useStableCallback(() => { 9507 return isHoverOpenEvent(dataRef.current.openEvent?.type); 9508 }); 9509 const clearPointerEvents = useStableCallback(() => { 9510 clearSafePolygonPointerEventsMutation(instance); 9511 }); 9512 useIsoLayoutEffect(() => { 9513 if (!open2) { 9514 instance.pointerType = void 0; 9515 instance.restTimeoutPending = false; 9516 instance.interactedInside = false; 9517 clearPointerEvents(); 9518 } 9519 }, [open2, instance, clearPointerEvents]); 9520 React35.useEffect(() => { 9521 return clearPointerEvents; 9522 }, [clearPointerEvents]); 9523 useIsoLayoutEffect(() => { 9524 if (!enabled) { 9525 return void 0; 9526 } 9527 if (open2 && instance.handleCloseOptions?.blockPointerEvents && isHoverOpen() && isElement(domReferenceElement) && floatingElement) { 9528 const ref = domReferenceElement; 9529 const floatingEl = floatingElement; 9530 const doc = ownerDocument(floatingElement); 9531 const parentFloating = tree?.nodesRef.current.find((node) => node.id === parentId)?.context?.elements.floating; 9532 if (parentFloating) { 9533 parentFloating.style.pointerEvents = ""; 9534 } 9535 const cachedScopeElement = instance.pointerEventsScopeElement !== floatingEl ? instance.pointerEventsScopeElement : null; 9536 const parentScopeElement = parentFloating !== floatingEl ? parentFloating : null; 9537 const scopeElement = instance.handleCloseOptions?.getScope?.() ?? cachedScopeElement ?? parentScopeElement ?? ref.closest("[data-rootownerid]") ?? doc.body; 9538 applySafePolygonPointerEventsMutation(instance, { 9539 scopeElement, 9540 referenceElement: ref, 9541 floatingElement: floatingEl 9542 }); 9543 return () => { 9544 clearPointerEvents(); 9545 }; 9546 } 9547 return void 0; 9548 }, [enabled, open2, domReferenceElement, floatingElement, instance, isHoverOpen, tree, parentId, clearPointerEvents]); 9549 React35.useEffect(() => { 9550 if (!enabled) { 9551 return void 0; 9552 } 9553 function hasParentChildren() { 9554 return !!(tree && parentId && getNodeChildren(tree.nodesRef.current, parentId).length > 0); 9555 } 9556 function closeWithDelay(event) { 9557 const closeDelay = getDelay(closeDelayProp, "close", instance.pointerType); 9558 const close = () => { 9559 store.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerHover, event)); 9560 tree?.events.emit("floating.closed", event); 9561 }; 9562 if (closeDelay) { 9563 instance.openChangeTimeout.start(closeDelay, close); 9564 } else { 9565 instance.openChangeTimeout.clear(); 9566 close(); 9567 } 9568 } 9569 function handleInteractInside(event) { 9570 const target = getTarget(event); 9571 if (!isInteractiveElement(target)) { 9572 instance.interactedInside = false; 9573 return; 9574 } 9575 instance.interactedInside = target?.closest("[aria-haspopup]") != null; 9576 } 9577 function onFloatingMouseEnter() { 9578 instance.openChangeTimeout.clear(); 9579 childClosedTimeout.clear(); 9580 tree?.events.off("floating.closed", onNodeClosed); 9581 clearPointerEvents(); 9582 } 9583 function onFloatingMouseLeave(event) { 9584 if (hasParentChildren() && tree) { 9585 tree.events.on("floating.closed", onNodeClosed); 9586 return; 9587 } 9588 if (isTargetInsideEnabledTrigger(event.relatedTarget, store.context.triggerElements)) { 9589 return; 9590 } 9591 const currentNodeId = dataRef.current.floatingContext?.nodeId ?? nodeIdProp; 9592 const relatedTarget = event.relatedTarget; 9593 const isMovingIntoDescendantFloating = tree && currentNodeId && isElement(relatedTarget) && getNodeChildren(tree.nodesRef.current, currentNodeId, false).some((node) => contains(node.context?.elements.floating, relatedTarget)); 9594 if (isMovingIntoDescendantFloating) { 9595 return; 9596 } 9597 if (instance.handler) { 9598 instance.handler(event); 9599 return; 9600 } 9601 clearPointerEvents(); 9602 if (isHoverOpen() && !isClickLikeOpenEvent2()) { 9603 closeWithDelay(event); 9604 } 9605 } 9606 function onNodeClosed(event) { 9607 if (!tree || !parentId || hasParentChildren()) { 9608 return; 9609 } 9610 childClosedTimeout.start(0, () => { 9611 tree.events.off("floating.closed", onNodeClosed); 9612 store.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerHover, event)); 9613 tree.events.emit("floating.closed", event); 9614 }); 9615 } 9616 const floating = floatingElement; 9617 return mergeCleanups(floating && addEventListener(floating, "mouseenter", onFloatingMouseEnter), floating && addEventListener(floating, "mouseleave", onFloatingMouseLeave), floating && addEventListener(floating, "pointerdown", handleInteractInside, true), () => { 9618 tree?.events.off("floating.closed", onNodeClosed); 9619 }); 9620 }, [enabled, floatingElement, store, dataRef, closeDelayProp, nodeIdProp, isHoverOpen, isClickLikeOpenEvent2, clearPointerEvents, instance, tree, parentId, childClosedTimeout]); 9621 } 9622 9623 // node_modules/@base-ui/react/floating-ui-react/hooks/useHoverReferenceInteraction.mjs 9624 var React36 = __toESM(require_react(), 1); 9625 var ReactDOM5 = __toESM(require_react_dom(), 1); 9626 var EMPTY_REF = { 9627 current: null 9628 }; 9629 function useHoverReferenceInteraction(context, props = {}) { 9630 const { 9631 enabled = true, 9632 delay = 0, 9633 handleClose = null, 9634 mouseOnly = false, 9635 restMs = 0, 9636 move = true, 9637 triggerElementRef = EMPTY_REF, 9638 externalTree, 9639 isActiveTrigger = true, 9640 getHandleCloseContext, 9641 isClosing, 9642 shouldOpen: shouldOpenProp, 9643 guardStaleOpen = false 9644 } = props; 9645 const store = "rootStore" in context ? context.rootStore : context; 9646 const { 9647 dataRef, 9648 events 9649 } = store.context; 9650 const tree = useFloatingTree(externalTree); 9651 const instance = useHoverInteractionSharedState(store); 9652 const isHoverCloseActiveRef = React36.useRef(false); 9653 const handleCloseRef = useValueAsRef(handleClose); 9654 const delayRef = useValueAsRef(delay); 9655 const restMsRef = useValueAsRef(restMs); 9656 const enabledRef = useValueAsRef(enabled); 9657 const shouldOpenRef = useValueAsRef(shouldOpenProp); 9658 const isClosingRef = useValueAsRef(isClosing); 9659 const isClickLikeOpenEvent2 = useStableCallback(() => { 9660 return isClickLikeOpenEvent(dataRef.current.openEvent?.type, instance.interactedInside); 9661 }); 9662 const checkShouldOpen = useStableCallback(() => { 9663 return shouldOpenRef.current?.() !== false; 9664 }); 9665 const isOverInactiveTrigger = useStableCallback((currentDomReference, currentTarget, target) => { 9666 const allTriggers = store.context.triggerElements; 9667 if (allTriggers.hasElement(currentTarget)) { 9668 return !currentDomReference || !contains(currentDomReference, currentTarget); 9669 } 9670 if (!isElement(target)) { 9671 return false; 9672 } 9673 const targetElement = target; 9674 return allTriggers.hasMatchingElement((trigger) => contains(trigger, targetElement)) && (!currentDomReference || !contains(currentDomReference, targetElement)); 9675 }); 9676 const cleanupMouseMoveHandler = useStableCallback(() => { 9677 if (!instance.handler) { 9678 return; 9679 } 9680 const doc = ownerDocument(store.select("domReferenceElement")); 9681 doc.removeEventListener("mousemove", instance.handler); 9682 instance.handler = void 0; 9683 }); 9684 const clearPointerEvents = useStableCallback(() => { 9685 clearSafePolygonPointerEventsMutation(instance); 9686 }); 9687 if (isActiveTrigger) { 9688 instance.handleCloseOptions = handleClose?.__options; 9689 } 9690 React36.useEffect(() => cleanupMouseMoveHandler, [cleanupMouseMoveHandler]); 9691 React36.useEffect(() => { 9692 if (!enabled) { 9693 return void 0; 9694 } 9695 function onOpenChangeLocal(details) { 9696 if (!details.open) { 9697 isHoverCloseActiveRef.current = details.reason === reason_parts_exports.triggerHover; 9698 cleanupMouseMoveHandler(); 9699 instance.openChangeTimeout.clear(); 9700 instance.restTimeout.clear(); 9701 instance.blockMouseMove = true; 9702 instance.restTimeoutPending = false; 9703 } else { 9704 isHoverCloseActiveRef.current = false; 9705 } 9706 } 9707 events.on("openchange", onOpenChangeLocal); 9708 return () => { 9709 events.off("openchange", onOpenChangeLocal); 9710 }; 9711 }, [enabled, events, instance, cleanupMouseMoveHandler]); 9712 React36.useEffect(() => { 9713 if (!enabled) { 9714 return void 0; 9715 } 9716 function closeWithDelay(event, runElseBranch = true) { 9717 const closeDelay = getDelay(delayRef.current, "close", instance.pointerType); 9718 if (closeDelay) { 9719 instance.openChangeTimeout.start(closeDelay, () => { 9720 store.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerHover, event)); 9721 tree?.events.emit("floating.closed", event); 9722 }); 9723 } else if (runElseBranch) { 9724 instance.openChangeTimeout.clear(); 9725 store.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerHover, event)); 9726 tree?.events.emit("floating.closed", event); 9727 } 9728 } 9729 const trigger = triggerElementRef.current ?? (isActiveTrigger ? store.select("domReferenceElement") : null); 9730 if (!isElement(trigger)) { 9731 return void 0; 9732 } 9733 function onMouseEnter(event) { 9734 instance.openChangeTimeout.clear(); 9735 instance.blockMouseMove = false; 9736 if (mouseOnly && !isMouseLikePointerType(instance.pointerType)) { 9737 return; 9738 } 9739 const restMsValue = getRestMs(restMsRef.current); 9740 const openDelay = getDelay(delayRef.current, "open", instance.pointerType); 9741 const eventTarget = getTarget(event); 9742 const currentTarget = event.currentTarget ?? null; 9743 const currentDomReference = store.select("domReferenceElement"); 9744 let triggerNode = currentTarget; 9745 if (isElement(eventTarget) && !store.context.triggerElements.hasElement(eventTarget)) { 9746 for (const triggerElement of store.context.triggerElements.elements()) { 9747 if (contains(triggerElement, eventTarget)) { 9748 triggerNode = triggerElement; 9749 break; 9750 } 9751 } 9752 } 9753 if (isElement(currentTarget) && isElement(currentDomReference) && !store.context.triggerElements.hasElement(currentTarget) && contains(currentTarget, currentDomReference)) { 9754 triggerNode = currentDomReference; 9755 } 9756 const isOverInactive = triggerNode == null ? false : isOverInactiveTrigger(currentDomReference, triggerNode, eventTarget); 9757 const isOpen = store.select("open"); 9758 const isInClosingTransition = isClosingRef.current?.() ?? store.select("transitionStatus") === "ending"; 9759 const isHoverCloseTransition = !isOpen && isInClosingTransition && isHoverCloseActiveRef.current; 9760 const isReenteringSameTriggerDuringCloseTransition = !isOverInactive && isElement(triggerNode) && isElement(currentDomReference) && contains(currentDomReference, triggerNode) && isHoverCloseTransition; 9761 const isRestOnlyDelay = restMsValue > 0 && !openDelay; 9762 const shouldOpenImmediately = isOverInactive && (isOpen || isHoverCloseTransition) || isReenteringSameTriggerDuringCloseTransition; 9763 const shouldOpen = !isOpen || isOverInactive; 9764 if (shouldOpenImmediately) { 9765 if (checkShouldOpen()) { 9766 store.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerHover, event, triggerNode)); 9767 } 9768 return; 9769 } 9770 if (isRestOnlyDelay) { 9771 return; 9772 } 9773 if (openDelay) { 9774 instance.openChangeTimeout.start(openDelay, () => { 9775 if (shouldOpen && checkShouldOpen()) { 9776 store.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerHover, event, triggerNode)); 9777 } 9778 }); 9779 } else if (shouldOpen) { 9780 if (checkShouldOpen()) { 9781 store.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerHover, event, triggerNode)); 9782 } 9783 } 9784 } 9785 function onMouseLeave(event) { 9786 if (isClickLikeOpenEvent2()) { 9787 clearPointerEvents(); 9788 return; 9789 } 9790 cleanupMouseMoveHandler(); 9791 const domReferenceElement = store.select("domReferenceElement"); 9792 const doc = ownerDocument(domReferenceElement); 9793 instance.restTimeout.clear(); 9794 instance.restTimeoutPending = false; 9795 const handleCloseContextBase = dataRef.current.floatingContext ?? getHandleCloseContext?.(); 9796 if (isTargetInsideEnabledTrigger(event.relatedTarget, store.context.triggerElements)) { 9797 return; 9798 } 9799 if (handleCloseRef.current && handleCloseContextBase) { 9800 if (!store.select("open")) { 9801 instance.openChangeTimeout.clear(); 9802 } 9803 const currentTrigger = triggerElementRef.current; 9804 instance.handler = handleCloseRef.current({ 9805 ...handleCloseContextBase, 9806 tree, 9807 x: event.clientX, 9808 y: event.clientY, 9809 onClose() { 9810 clearPointerEvents(); 9811 cleanupMouseMoveHandler(); 9812 if (enabledRef.current && !isClickLikeOpenEvent2() && currentTrigger === store.select("domReferenceElement")) { 9813 closeWithDelay(event, true); 9814 } 9815 } 9816 }); 9817 doc.addEventListener("mousemove", instance.handler); 9818 instance.handler(event); 9819 return; 9820 } 9821 const shouldClose = instance.pointerType === "touch" ? !contains(store.select("floatingElement"), event.relatedTarget) : true; 9822 if (shouldClose) { 9823 closeWithDelay(event); 9824 } 9825 } 9826 function onMouseOut(event) { 9827 if (contains(trigger, event.relatedTarget)) { 9828 return; 9829 } 9830 instance.openChangeTimeout.clear(); 9831 instance.restTimeout.clear(); 9832 instance.restTimeoutPending = false; 9833 } 9834 const staleOpenGuard = guardStaleOpen ? addEventListener(trigger, "mouseout", onMouseOut) : void 0; 9835 if (move) { 9836 return mergeCleanups(addEventListener(trigger, "mousemove", onMouseEnter, { 9837 once: true 9838 }), addEventListener(trigger, "mouseenter", onMouseEnter), addEventListener(trigger, "mouseleave", onMouseLeave), staleOpenGuard); 9839 } 9840 return mergeCleanups(addEventListener(trigger, "mouseenter", onMouseEnter), addEventListener(trigger, "mouseleave", onMouseLeave), staleOpenGuard); 9841 }, [cleanupMouseMoveHandler, clearPointerEvents, dataRef, delayRef, store, enabled, handleCloseRef, instance, isActiveTrigger, isOverInactiveTrigger, isClickLikeOpenEvent2, mouseOnly, move, restMsRef, triggerElementRef, tree, enabledRef, getHandleCloseContext, isClosingRef, checkShouldOpen, guardStaleOpen]); 9842 return React36.useMemo(() => { 9843 if (!enabled) { 9844 return void 0; 9845 } 9846 function setPointerRef(event) { 9847 instance.pointerType = event.pointerType; 9848 } 9849 return { 9850 onPointerDown: setPointerRef, 9851 onPointerEnter: setPointerRef, 9852 onMouseMove(event) { 9853 const { 9854 nativeEvent 9855 } = event; 9856 const trigger = event.currentTarget; 9857 const currentDomReference = store.select("domReferenceElement"); 9858 const currentOpen = store.select("open"); 9859 const isOverInactive = isOverInactiveTrigger(currentDomReference, trigger, event.target); 9860 if (mouseOnly && !isMouseLikePointerType(instance.pointerType)) { 9861 return; 9862 } 9863 if (currentOpen && isOverInactive && instance.handleCloseOptions?.blockPointerEvents) { 9864 const floatingElement = store.select("floatingElement"); 9865 if (floatingElement) { 9866 const scopeElement = instance.handleCloseOptions?.getScope?.() ?? trigger.ownerDocument.body; 9867 applySafePolygonPointerEventsMutation(instance, { 9868 scopeElement, 9869 referenceElement: trigger, 9870 floatingElement 9871 }); 9872 } 9873 } 9874 const restMsValue = getRestMs(restMsRef.current); 9875 if (currentOpen && !isOverInactive || restMsValue === 0) { 9876 return; 9877 } 9878 if (!isOverInactive && instance.restTimeoutPending && event.movementX ** 2 + event.movementY ** 2 < 2) { 9879 return; 9880 } 9881 instance.restTimeout.clear(); 9882 function handleMouseMove() { 9883 instance.restTimeoutPending = false; 9884 if (isClickLikeOpenEvent2()) { 9885 return; 9886 } 9887 const latestOpen = store.select("open"); 9888 if (!instance.blockMouseMove && (!latestOpen || isOverInactive) && checkShouldOpen()) { 9889 store.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerHover, nativeEvent, trigger)); 9890 } 9891 } 9892 if (instance.pointerType === "touch") { 9893 ReactDOM5.flushSync(() => { 9894 handleMouseMove(); 9895 }); 9896 } else if (isOverInactive && currentOpen) { 9897 handleMouseMove(); 9898 } else { 9899 instance.restTimeoutPending = true; 9900 instance.restTimeout.start(restMsValue, handleMouseMove); 9901 } 9902 } 9903 }; 9904 }, [enabled, instance, isClickLikeOpenEvent2, isOverInactiveTrigger, mouseOnly, store, restMsRef, checkShouldOpen]); 9905 } 9906 9907 // node_modules/@base-ui/react/floating-ui-react/hooks/useListNavigation.mjs 9908 var React37 = __toESM(require_react(), 1); 9909 var ESCAPE = "Escape"; 9910 function isStationaryWebKitPointer(event) { 9911 return parts_exports.engine.webkit && event.movementX === 0 && event.movementY === 0; 9912 } 9913 function doSwitch(orientation, vertical, horizontal) { 9914 switch (orientation) { 9915 case "vertical": 9916 return vertical; 9917 case "horizontal": 9918 return horizontal; 9919 default: 9920 return vertical || horizontal; 9921 } 9922 } 9923 function isMainOrientationKey(key, orientation) { 9924 const vertical = key === ARROW_UP || key === ARROW_DOWN; 9925 const horizontal = key === ARROW_LEFT || key === ARROW_RIGHT; 9926 return doSwitch(orientation, vertical, horizontal); 9927 } 9928 function isMainOrientationToEndKey(key, orientation, rtl) { 9929 const vertical = key === ARROW_DOWN; 9930 const horizontal = rtl ? key === ARROW_LEFT : key === ARROW_RIGHT; 9931 return doSwitch(orientation, vertical, horizontal) || key === "Enter" || key === " " || key === ""; 9932 } 9933 function isCrossOrientationOpenKey(key, orientation, rtl) { 9934 const vertical = rtl ? key === ARROW_LEFT : key === ARROW_RIGHT; 9935 const horizontal = key === ARROW_DOWN; 9936 return doSwitch(orientation, vertical, horizontal); 9937 } 9938 function isCrossOrientationCloseKey(key, orientation, rtl, grid) { 9939 const vertical = rtl ? key === ARROW_RIGHT : key === ARROW_LEFT; 9940 const horizontal = key === ARROW_UP; 9941 if (orientation === "both" || orientation === "horizontal" && grid) { 9942 return key === ESCAPE; 9943 } 9944 return doSwitch(orientation, vertical, horizontal); 9945 } 9946 function useListNavigation(context, props) { 9947 const { 9948 listRef, 9949 activeIndex, 9950 onNavigate: onNavigateProp = () => { 9951 }, 9952 enabled = true, 9953 selectedIndex = null, 9954 allowEscape = false, 9955 loopFocus = false, 9956 nested = false, 9957 rtl = false, 9958 virtual = false, 9959 focusItemOnOpen = "auto", 9960 focusItemOnHover = true, 9961 openOnArrowKeyDown = true, 9962 disabledIndices = void 0, 9963 orientation = "vertical", 9964 parentOrientation, 9965 id, 9966 resetOnPointerLeave = true, 9967 externalTree, 9968 grid: navigateGrid 9969 } = props; 9970 const isGrid2 = navigateGrid != null; 9971 if (true) { 9972 if (allowEscape) { 9973 if (!loopFocus) { 9974 console.warn("`useListNavigation` looping must be enabled to allow escaping."); 9975 } 9976 if (!virtual) { 9977 console.warn("`useListNavigation` must be virtual to allow escaping."); 9978 } 9979 } 9980 if (orientation === "vertical" && isGrid2) { 9981 console.warn("In grid list navigation mode, the `orientation` should", 'be either "horizontal" or "both".'); 9982 } 9983 } 9984 const store = "rootStore" in context ? context.rootStore : context; 9985 const open2 = store.useState("open"); 9986 const floatingElement = store.useState("floatingElement"); 9987 const domReferenceElement = store.useState("domReferenceElement"); 9988 const dataRef = store.context.dataRef; 9989 const floatingFocusElement = getFloatingFocusElement(floatingElement); 9990 const typeableComboboxReference = isTypeableCombobox(domReferenceElement); 9991 const floatingFocusElementRef = useValueAsRef(floatingFocusElement); 9992 const parentId = useFloatingParentNodeId(); 9993 const tree = useFloatingTree(externalTree); 9994 const focusItemOnOpenRef = React37.useRef(focusItemOnOpen); 9995 const indexRef = React37.useRef(selectedIndex ?? -1); 9996 const keyRef = React37.useRef(null); 9997 const isPointerModalityRef = React37.useRef(true); 9998 const onNavigate = useStableCallback((event) => { 9999 onNavigateProp(indexRef.current === -1 ? null : indexRef.current, event); 10000 }); 10001 const previousMountedRef = React37.useRef(!!floatingElement); 10002 const previousOpenRef = React37.useRef(open2); 10003 const forceSyncFocusRef = React37.useRef(false); 10004 const forceScrollIntoViewRef = React37.useRef(false); 10005 const cancelQueuedFocusRef = React37.useRef(null); 10006 const disabledIndicesRef = useValueAsRef(disabledIndices); 10007 const latestOpenRef = useValueAsRef(open2); 10008 const selectedIndexRef = useValueAsRef(selectedIndex); 10009 const resetOnPointerLeaveRef = useValueAsRef(resetOnPointerLeave); 10010 const focusFrame = useAnimationFrame(); 10011 const waitForListPopulatedFrame = useAnimationFrame(); 10012 const focusItem = useStableCallback(() => { 10013 function runFocus(item2) { 10014 if (virtual) { 10015 tree?.events.emit("virtualfocus", item2); 10016 } else { 10017 cancelQueuedFocusRef.current = enqueueFocus(item2, { 10018 sync: forceSyncFocusRef.current, 10019 preventScroll: true 10020 }); 10021 } 10022 } 10023 const initialItem = listRef.current[indexRef.current]; 10024 const forceScrollIntoView = forceScrollIntoViewRef.current; 10025 if (initialItem) { 10026 runFocus(initialItem); 10027 } 10028 const scheduler2 = forceSyncFocusRef.current ? (callback) => callback() : (callback) => focusFrame.request(callback); 10029 scheduler2(() => { 10030 const waitedItem = listRef.current[indexRef.current] || initialItem; 10031 if (!waitedItem) { 10032 return; 10033 } 10034 if (!initialItem) { 10035 runFocus(waitedItem); 10036 } 10037 const shouldScrollIntoView = ( 10038 // eslint-disable-next-line @typescript-eslint/no-use-before-define 10039 item && (forceScrollIntoView || !isPointerModalityRef.current) 10040 ); 10041 if (shouldScrollIntoView) { 10042 waitedItem.scrollIntoView?.({ 10043 block: "nearest", 10044 inline: "nearest" 10045 }); 10046 } 10047 }); 10048 }); 10049 useIsoLayoutEffect(() => { 10050 dataRef.current.orientation = orientation; 10051 }, [dataRef, orientation]); 10052 useIsoLayoutEffect(() => { 10053 if (!enabled) { 10054 return; 10055 } 10056 if (open2 && floatingElement) { 10057 indexRef.current = selectedIndex ?? -1; 10058 if (focusItemOnOpenRef.current && selectedIndex != null) { 10059 forceScrollIntoViewRef.current = true; 10060 onNavigate(); 10061 } 10062 } else if (previousMountedRef.current) { 10063 indexRef.current = -1; 10064 onNavigate(); 10065 } 10066 }, [enabled, open2, floatingElement, selectedIndex, onNavigate]); 10067 useIsoLayoutEffect(() => { 10068 if (!enabled) { 10069 return; 10070 } 10071 if (!open2) { 10072 forceSyncFocusRef.current = false; 10073 return; 10074 } 10075 if (!floatingElement) { 10076 return; 10077 } 10078 if (activeIndex == null) { 10079 forceSyncFocusRef.current = false; 10080 if (selectedIndexRef.current != null) { 10081 return; 10082 } 10083 if (previousMountedRef.current) { 10084 indexRef.current = -1; 10085 focusItem(); 10086 } 10087 if ((!previousOpenRef.current || !previousMountedRef.current) && focusItemOnOpenRef.current && (keyRef.current != null || focusItemOnOpenRef.current === true && keyRef.current == null)) { 10088 let runs = 0; 10089 const waitForListPopulated = () => { 10090 if (listRef.current[0] == null) { 10091 if (runs < 2) { 10092 const scheduler2 = runs ? (callback) => waitForListPopulatedFrame.request(callback) : queueMicrotask; 10093 scheduler2(waitForListPopulated); 10094 } 10095 runs += 1; 10096 } else { 10097 indexRef.current = keyRef.current == null || isMainOrientationToEndKey(keyRef.current, orientation, rtl) || nested ? getMinListIndex(listRef) : getMaxListIndex(listRef); 10098 keyRef.current = null; 10099 onNavigate(); 10100 } 10101 }; 10102 waitForListPopulated(); 10103 } 10104 } else if (!isIndexOutOfListBounds(listRef.current, activeIndex)) { 10105 indexRef.current = activeIndex; 10106 focusItem(); 10107 forceScrollIntoViewRef.current = false; 10108 } 10109 }, [enabled, open2, floatingElement, activeIndex, selectedIndexRef, nested, listRef, orientation, rtl, onNavigate, focusItem, waitForListPopulatedFrame]); 10110 useIsoLayoutEffect(() => { 10111 if (!enabled || floatingElement || !tree || virtual || !previousMountedRef.current) { 10112 return; 10113 } 10114 const nodes = tree.nodesRef.current; 10115 const parent = nodes.find((node) => node.id === parentId)?.context?.elements.floating; 10116 const activeEl = activeElement(ownerDocument(domReferenceElement ?? parent ?? null)); 10117 const treeContainsActiveEl = nodes.some((node) => node.context && contains(node.context.elements.floating, activeEl)); 10118 if (parent && !treeContainsActiveEl && isPointerModalityRef.current) { 10119 parent.focus({ 10120 preventScroll: true 10121 }); 10122 } 10123 }, [enabled, floatingElement, domReferenceElement, tree, parentId, virtual]); 10124 useIsoLayoutEffect(() => { 10125 previousOpenRef.current = open2; 10126 previousMountedRef.current = !!floatingElement; 10127 }); 10128 useIsoLayoutEffect(() => { 10129 if (!open2) { 10130 keyRef.current = null; 10131 focusItemOnOpenRef.current = focusItemOnOpen; 10132 } 10133 }, [open2, focusItemOnOpen]); 10134 const hasActiveIndex = activeIndex != null; 10135 const syncCurrentTarget = useStableCallback((event) => { 10136 if (!latestOpenRef.current) { 10137 return; 10138 } 10139 const index2 = listRef.current.indexOf(event.currentTarget); 10140 if (index2 !== -1 && (indexRef.current !== index2 || activeIndex !== index2)) { 10141 indexRef.current = index2; 10142 onNavigate(event); 10143 } 10144 }); 10145 const getParentOrientation = useStableCallback(() => { 10146 return parentOrientation ?? tree?.nodesRef.current.find((node) => node.id === parentId)?.context?.dataRef?.current.orientation; 10147 }); 10148 const getMinEnabledIndex = useStableCallback(() => { 10149 return getMinListIndex(listRef, disabledIndicesRef.current); 10150 }); 10151 const commonOnKeyDown = useStableCallback((event) => { 10152 isPointerModalityRef.current = false; 10153 forceSyncFocusRef.current = true; 10154 if (event.which === 229) { 10155 return; 10156 } 10157 if (!latestOpenRef.current && event.currentTarget === floatingFocusElementRef.current) { 10158 return; 10159 } 10160 if (nested && isCrossOrientationCloseKey(event.key, orientation, rtl, isGrid2)) { 10161 if (!isMainOrientationKey(event.key, getParentOrientation())) { 10162 stopEvent(event); 10163 } 10164 store.setOpen(false, createChangeEventDetails(reason_parts_exports.listNavigation, event.nativeEvent)); 10165 if (isHTMLElement(domReferenceElement)) { 10166 if (virtual) { 10167 tree?.events.emit("virtualfocus", domReferenceElement); 10168 } else { 10169 domReferenceElement.focus(); 10170 } 10171 } 10172 return; 10173 } 10174 const currentIndex = indexRef.current; 10175 const minIndex = getMinListIndex(listRef, disabledIndices); 10176 const maxIndex = getMaxListIndex(listRef, disabledIndices); 10177 if (!typeableComboboxReference) { 10178 if (event.key === "Home") { 10179 stopEvent(event); 10180 indexRef.current = minIndex; 10181 onNavigate(event); 10182 } 10183 if (event.key === "End") { 10184 stopEvent(event); 10185 indexRef.current = maxIndex; 10186 onNavigate(event); 10187 } 10188 } 10189 if (navigateGrid != null) { 10190 const index2 = navigateGrid(event, indexRef.current, listRef, orientation, loopFocus, rtl, disabledIndices, minIndex, maxIndex); 10191 if (index2 != null) { 10192 indexRef.current = index2; 10193 onNavigate(event); 10194 } 10195 if (orientation === "both") { 10196 return; 10197 } 10198 } 10199 if (isMainOrientationKey(event.key, orientation)) { 10200 stopEvent(event); 10201 if (open2 && !virtual && activeElement(event.currentTarget.ownerDocument) === event.currentTarget) { 10202 indexRef.current = isMainOrientationToEndKey(event.key, orientation, rtl) ? minIndex : maxIndex; 10203 onNavigate(event); 10204 return; 10205 } 10206 if (isMainOrientationToEndKey(event.key, orientation, rtl)) { 10207 if (loopFocus) { 10208 if (currentIndex >= maxIndex) { 10209 if (allowEscape && currentIndex !== listRef.current.length) { 10210 indexRef.current = -1; 10211 } else { 10212 forceSyncFocusRef.current = false; 10213 indexRef.current = minIndex; 10214 } 10215 } else { 10216 indexRef.current = findNonDisabledListIndex(listRef.current, { 10217 startingIndex: currentIndex, 10218 disabledIndices 10219 }); 10220 } 10221 } else { 10222 indexRef.current = Math.min(maxIndex, findNonDisabledListIndex(listRef.current, { 10223 startingIndex: currentIndex, 10224 disabledIndices 10225 })); 10226 } 10227 } else if (loopFocus) { 10228 if (currentIndex <= minIndex) { 10229 if (allowEscape && currentIndex !== -1) { 10230 indexRef.current = listRef.current.length; 10231 } else { 10232 forceSyncFocusRef.current = false; 10233 indexRef.current = maxIndex; 10234 } 10235 } else { 10236 indexRef.current = findNonDisabledListIndex(listRef.current, { 10237 startingIndex: currentIndex, 10238 decrement: true, 10239 disabledIndices 10240 }); 10241 } 10242 } else { 10243 indexRef.current = Math.max(minIndex, findNonDisabledListIndex(listRef.current, { 10244 startingIndex: currentIndex, 10245 decrement: true, 10246 disabledIndices 10247 })); 10248 } 10249 if (isIndexOutOfListBounds(listRef.current, indexRef.current)) { 10250 indexRef.current = -1; 10251 } 10252 onNavigate(event); 10253 } 10254 }); 10255 const item = React37.useMemo(() => { 10256 const itemProps = { 10257 onFocus(event) { 10258 forceSyncFocusRef.current = true; 10259 syncCurrentTarget(event); 10260 }, 10261 onClick: ({ 10262 currentTarget 10263 }) => currentTarget.focus({ 10264 preventScroll: true 10265 }), 10266 // Safari 10267 onMouseMove(event) { 10268 if (isStationaryWebKitPointer(event)) { 10269 return; 10270 } 10271 forceSyncFocusRef.current = true; 10272 forceScrollIntoViewRef.current = false; 10273 if (focusItemOnHover) { 10274 syncCurrentTarget(event); 10275 } 10276 }, 10277 onPointerLeave(event) { 10278 if (!latestOpenRef.current || !isPointerModalityRef.current || event.pointerType === "touch") { 10279 return; 10280 } 10281 forceSyncFocusRef.current = true; 10282 const relatedTarget = event.relatedTarget; 10283 if (!focusItemOnHover || listRef.current.includes(relatedTarget)) { 10284 return; 10285 } 10286 if (!resetOnPointerLeaveRef.current) { 10287 return; 10288 } 10289 cancelQueuedFocusRef.current?.(); 10290 cancelQueuedFocusRef.current = null; 10291 indexRef.current = -1; 10292 onNavigate(event); 10293 if (!virtual) { 10294 const floatingFocusEl = floatingFocusElementRef.current; 10295 const activeEl = activeElement(ownerDocument(floatingFocusEl)); 10296 if (floatingFocusEl && contains(floatingFocusEl, activeEl)) { 10297 floatingFocusEl.focus({ 10298 preventScroll: true 10299 }); 10300 } 10301 } 10302 } 10303 }; 10304 return itemProps; 10305 }, [syncCurrentTarget, latestOpenRef, floatingFocusElementRef, focusItemOnHover, listRef, onNavigate, resetOnPointerLeaveRef, virtual]); 10306 const ariaActiveDescendantProp = React37.useMemo(() => { 10307 return virtual && open2 && hasActiveIndex && { 10308 "aria-activedescendant": `$id}-$activeIndex}` 10309 }; 10310 }, [virtual, open2, hasActiveIndex, id, activeIndex]); 10311 const floating = React37.useMemo(() => { 10312 return { 10313 ...!typeableComboboxReference ? ariaActiveDescendantProp : {}, 10314 onKeyDown(event) { 10315 if (event.key === "Tab" && event.shiftKey && open2 && !virtual) { 10316 const target = getTarget(event.nativeEvent); 10317 if (target && !contains(floatingFocusElementRef.current, target)) { 10318 return; 10319 } 10320 stopEvent(event); 10321 store.setOpen(false, createChangeEventDetails(reason_parts_exports.focusOut, event.nativeEvent)); 10322 if (isHTMLElement(domReferenceElement)) { 10323 domReferenceElement.focus(); 10324 } 10325 return; 10326 } 10327 commonOnKeyDown(event); 10328 }, 10329 onPointerMove(event) { 10330 if (isStationaryWebKitPointer(event)) { 10331 return; 10332 } 10333 isPointerModalityRef.current = true; 10334 } 10335 }; 10336 }, [ariaActiveDescendantProp, commonOnKeyDown, floatingFocusElementRef, typeableComboboxReference, store, open2, virtual, domReferenceElement]); 10337 const trigger = React37.useMemo(() => { 10338 function openOnNavigationKeyDown(event) { 10339 store.setOpen(true, createChangeEventDetails(reason_parts_exports.listNavigation, event.nativeEvent, event.currentTarget)); 10340 } 10341 function checkVirtualMouse(event) { 10342 if (focusItemOnOpen === "auto" && isVirtualClick(event.nativeEvent)) { 10343 focusItemOnOpenRef.current = !virtual; 10344 } 10345 } 10346 function checkVirtualPointer(event) { 10347 focusItemOnOpenRef.current = focusItemOnOpen; 10348 if (focusItemOnOpen === "auto" && isVirtualPointerEvent(event.nativeEvent)) { 10349 focusItemOnOpenRef.current = true; 10350 } 10351 } 10352 return { 10353 onKeyDown(event) { 10354 const currentOpen = store.select("open"); 10355 isPointerModalityRef.current = false; 10356 const isArrowKey = event.key.startsWith("Arrow"); 10357 const isParentCrossOpenKey = isCrossOrientationOpenKey(event.key, getParentOrientation(), rtl); 10358 const isMainKey = isMainOrientationKey(event.key, orientation); 10359 const isNavigationKey = (nested ? isParentCrossOpenKey : isMainKey) || event.key === "Enter" || event.key.trim() === ""; 10360 if (virtual && currentOpen) { 10361 return commonOnKeyDown(event); 10362 } 10363 if (!currentOpen && !openOnArrowKeyDown && isArrowKey) { 10364 return void 0; 10365 } 10366 if (isNavigationKey) { 10367 const isParentMainKey = isMainOrientationKey(event.key, getParentOrientation()); 10368 keyRef.current = nested && isParentMainKey ? null : event.key; 10369 } 10370 if (nested) { 10371 if (isParentCrossOpenKey) { 10372 stopEvent(event); 10373 if (currentOpen) { 10374 indexRef.current = getMinEnabledIndex(); 10375 onNavigate(event); 10376 } else { 10377 openOnNavigationKeyDown(event); 10378 } 10379 } 10380 return void 0; 10381 } 10382 if (isMainKey) { 10383 if (selectedIndexRef.current != null) { 10384 indexRef.current = selectedIndexRef.current; 10385 } 10386 stopEvent(event); 10387 if (!currentOpen && openOnArrowKeyDown) { 10388 openOnNavigationKeyDown(event); 10389 } else { 10390 commonOnKeyDown(event); 10391 } 10392 if (currentOpen) { 10393 onNavigate(event); 10394 } 10395 } 10396 return void 0; 10397 }, 10398 onFocus(event) { 10399 if (store.select("open") && !virtual) { 10400 indexRef.current = -1; 10401 onNavigate(event); 10402 } 10403 }, 10404 onPointerDown: checkVirtualPointer, 10405 onPointerEnter: checkVirtualPointer, 10406 onMouseDown: checkVirtualMouse, 10407 onClick: checkVirtualMouse 10408 }; 10409 }, [commonOnKeyDown, focusItemOnOpen, getMinEnabledIndex, nested, onNavigate, store, openOnArrowKeyDown, orientation, getParentOrientation, rtl, selectedIndexRef, virtual]); 10410 const reference = React37.useMemo(() => { 10411 return { 10412 ...ariaActiveDescendantProp, 10413 ...trigger 10414 }; 10415 }, [ariaActiveDescendantProp, trigger]); 10416 return React37.useMemo(() => enabled ? { 10417 reference, 10418 floating, 10419 item, 10420 trigger 10421 } : {}, [enabled, reference, floating, trigger, item]); 10422 } 10423 10424 // node_modules/@base-ui/react/floating-ui-react/hooks/useTypeahead.mjs 10425 var React38 = __toESM(require_react(), 1); 10426 function useTypeahead(context, props) { 10427 const { 10428 listRef, 10429 elementsRef, 10430 activeIndex, 10431 onMatch: onMatchProp, 10432 disabledIndices, 10433 onTyping, 10434 enabled = true, 10435 resetMs = 750, 10436 selectedIndex = null 10437 } = props; 10438 const store = "rootStore" in context ? context.rootStore : context; 10439 const open2 = store.useState("open"); 10440 const timeout = useTimeout(); 10441 const stringRef = React38.useRef(""); 10442 const prevIndexRef = React38.useRef(selectedIndex ?? activeIndex ?? -1); 10443 const matchIndexRef = React38.useRef(null); 10444 const onKeyDown = useStableCallback((event) => { 10445 function getElement(index3) { 10446 return elementsRef?.current[index3]; 10447 } 10448 function isItemAvailable(index3) { 10449 const element = getElement(index3); 10450 if (element && !isElementVisible(element) || element?.matches(":disabled")) { 10451 return false; 10452 } 10453 return disabledIndices == null || !isListIndexDisabled(EMPTY_ARRAY, index3, disabledIndices); 10454 } 10455 function getMatchingIndex(list, string, startIndex2 = 0) { 10456 if (list.length === 0) { 10457 return -1; 10458 } 10459 const normalizedStartIndex = (startIndex2 % list.length + list.length) % list.length; 10460 const lowerString = string.toLowerCase(); 10461 for (let offset4 = 0; offset4 < list.length; offset4 += 1) { 10462 const index3 = (normalizedStartIndex + offset4) % list.length; 10463 const text = list[index3]; 10464 if (!text?.toLowerCase().startsWith(lowerString) || !isItemAvailable(index3)) { 10465 continue; 10466 } 10467 return index3; 10468 } 10469 return -1; 10470 } 10471 const listContent = listRef.current; 10472 if (stringRef.current.length > 0 && event.key === " ") { 10473 stopEvent(event); 10474 onTyping?.(true); 10475 } 10476 if (stringRef.current.length > 0 && stringRef.current[0] !== " ") { 10477 if (getMatchingIndex(listContent, stringRef.current) === -1 && event.key !== " ") { 10478 onTyping?.(false); 10479 } 10480 } 10481 if (listContent == null || // Character key. 10482 event.key.length !== 1 || // Modifier key. 10483 event.ctrlKey || event.metaKey || event.altKey) { 10484 return; 10485 } 10486 if (open2 && event.key !== " ") { 10487 stopEvent(event); 10488 onTyping?.(true); 10489 } 10490 const isNewSession = stringRef.current === ""; 10491 if (isNewSession) { 10492 prevIndexRef.current = selectedIndex ?? activeIndex ?? -1; 10493 } 10494 const allowRapidSuccessionOfFirstLetter = listContent.every((text, index3) => text && isItemAvailable(index3) ? text[0]?.toLowerCase() !== text[1]?.toLowerCase() : true); 10495 if (allowRapidSuccessionOfFirstLetter && stringRef.current === event.key) { 10496 stringRef.current = ""; 10497 prevIndexRef.current = matchIndexRef.current; 10498 } 10499 stringRef.current += event.key; 10500 timeout.start(resetMs, () => { 10501 stringRef.current = ""; 10502 prevIndexRef.current = matchIndexRef.current; 10503 onTyping?.(false); 10504 }); 10505 const prevIndex = isNewSession ? selectedIndex ?? activeIndex ?? -1 : prevIndexRef.current; 10506 const startIndex = (prevIndex ?? 0) + 1; 10507 const index2 = getMatchingIndex(listContent, stringRef.current, startIndex); 10508 if (index2 !== -1) { 10509 onMatchProp?.(index2); 10510 matchIndexRef.current = index2; 10511 } else if (event.key !== " ") { 10512 stringRef.current = ""; 10513 onTyping?.(false); 10514 } 10515 }); 10516 const onBlur = useStableCallback((event) => { 10517 const next = event.relatedTarget; 10518 const currentDomReferenceElement = store.select("domReferenceElement"); 10519 const currentFloatingElement = store.select("floatingElement"); 10520 const withinComposite = contains(currentDomReferenceElement, next) || contains(currentFloatingElement, next); 10521 if (withinComposite) { 10522 return; 10523 } 10524 timeout.clear(); 10525 stringRef.current = ""; 10526 prevIndexRef.current = matchIndexRef.current; 10527 onTyping?.(false); 10528 }); 10529 useIsoLayoutEffect(() => { 10530 if (!open2 && selectedIndex !== null) { 10531 return; 10532 } 10533 timeout.clear(); 10534 matchIndexRef.current = null; 10535 if (stringRef.current !== "") { 10536 stringRef.current = ""; 10537 } 10538 }, [open2, selectedIndex, timeout]); 10539 const sharedProps = React38.useMemo(() => ({ 10540 onKeyDown, 10541 onBlur 10542 }), [onKeyDown, onBlur]); 10543 return React38.useMemo(() => enabled ? { 10544 reference: sharedProps, 10545 floating: sharedProps 10546 } : {}, [enabled, sharedProps]); 10547 } 10548 10549 // node_modules/@base-ui/react/floating-ui-react/safePolygon.mjs 10550 var CURSOR_SPEED_THRESHOLD = 0.1; 10551 var CURSOR_SPEED_THRESHOLD_SQUARED = CURSOR_SPEED_THRESHOLD * CURSOR_SPEED_THRESHOLD; 10552 var POLYGON_BUFFER = 0.5; 10553 function hasIntersectingEdge(pointX, pointY, xi, yi, xj, yj) { 10554 return yi >= pointY !== yj >= pointY && pointX <= (xj - xi) * (pointY - yi) / (yj - yi) + xi; 10555 } 10556 function isPointInQuadrilateral(pointX, pointY, x1, y1, x2, y2, x3, y3, x4, y4) { 10557 let isInsideValue = false; 10558 if (hasIntersectingEdge(pointX, pointY, x1, y1, x2, y2)) { 10559 isInsideValue = !isInsideValue; 10560 } 10561 if (hasIntersectingEdge(pointX, pointY, x2, y2, x3, y3)) { 10562 isInsideValue = !isInsideValue; 10563 } 10564 if (hasIntersectingEdge(pointX, pointY, x3, y3, x4, y4)) { 10565 isInsideValue = !isInsideValue; 10566 } 10567 if (hasIntersectingEdge(pointX, pointY, x4, y4, x1, y1)) { 10568 isInsideValue = !isInsideValue; 10569 } 10570 return isInsideValue; 10571 } 10572 function isInsideRect(pointX, pointY, rect) { 10573 return pointX >= rect.x && pointX <= rect.x + rect.width && pointY >= rect.y && pointY <= rect.y + rect.height; 10574 } 10575 function isInsideAxisAlignedRect(pointX, pointY, x1, y1, x2, y2) { 10576 const minX = Math.min(x1, x2); 10577 const maxX = Math.max(x1, x2); 10578 const minY = Math.min(y1, y2); 10579 const maxY = Math.max(y1, y2); 10580 return pointX >= minX && pointX <= maxX && pointY >= minY && pointY <= maxY; 10581 } 10582 function safePolygon(options = {}) { 10583 const { 10584 blockPointerEvents = false 10585 } = options; 10586 const timeout = new Timeout(); 10587 const fn = ({ 10588 x: x2, 10589 y: y2, 10590 placement, 10591 elements, 10592 onClose, 10593 nodeId, 10594 tree 10595 }) => { 10596 const side = placement?.split("-")[0]; 10597 let hasLanded = false; 10598 let lastX = null; 10599 let lastY = null; 10600 let lastCursorTime = typeof performance !== "undefined" ? performance.now() : 0; 10601 function isCursorMovingSlowly(nextX, nextY) { 10602 const currentTime = performance.now(); 10603 const elapsedTime = currentTime - lastCursorTime; 10604 if (lastX === null || lastY === null || elapsedTime === 0) { 10605 lastX = nextX; 10606 lastY = nextY; 10607 lastCursorTime = currentTime; 10608 return false; 10609 } 10610 const deltaX = nextX - lastX; 10611 const deltaY = nextY - lastY; 10612 const distanceSquared = deltaX * deltaX + deltaY * deltaY; 10613 const thresholdSquared = elapsedTime * elapsedTime * CURSOR_SPEED_THRESHOLD_SQUARED; 10614 lastX = nextX; 10615 lastY = nextY; 10616 lastCursorTime = currentTime; 10617 return distanceSquared < thresholdSquared; 10618 } 10619 function close() { 10620 timeout.clear(); 10621 onClose(); 10622 } 10623 return function onMouseMove(event) { 10624 timeout.clear(); 10625 const domReference = elements.domReference; 10626 const floating = elements.floating; 10627 if (!domReference || !floating || side == null || x2 == null || y2 == null) { 10628 return void 0; 10629 } 10630 const { 10631 clientX, 10632 clientY 10633 } = event; 10634 const target = getTarget(event); 10635 const isLeave = event.type === "mouseleave"; 10636 const isOverFloatingEl = contains(floating, target); 10637 const isOverReferenceEl = contains(domReference, target); 10638 if (isOverFloatingEl) { 10639 hasLanded = true; 10640 if (!isLeave) { 10641 return void 0; 10642 } 10643 } 10644 if (isOverReferenceEl) { 10645 hasLanded = false; 10646 if (!isLeave) { 10647 hasLanded = true; 10648 return void 0; 10649 } 10650 } 10651 if (isLeave && isElement(event.relatedTarget) && contains(floating, event.relatedTarget)) { 10652 return void 0; 10653 } 10654 function hasOpenChildNode() { 10655 return Boolean(tree && getNodeChildren(tree.nodesRef.current, nodeId).length > 0); 10656 } 10657 function closeIfNoOpenChild() { 10658 if (!hasOpenChildNode()) { 10659 close(); 10660 } 10661 } 10662 if (hasOpenChildNode()) { 10663 return void 0; 10664 } 10665 const refRect = domReference.getBoundingClientRect(); 10666 const rect = floating.getBoundingClientRect(); 10667 const cursorLeaveFromRight = x2 > rect.right - rect.width / 2; 10668 const cursorLeaveFromBottom = y2 > rect.bottom - rect.height / 2; 10669 const isFloatingWider = rect.width > refRect.width; 10670 const isFloatingTaller = rect.height > refRect.height; 10671 const left = (isFloatingWider ? refRect : rect).left; 10672 const right = (isFloatingWider ? refRect : rect).right; 10673 const top = (isFloatingTaller ? refRect : rect).top; 10674 const bottom = (isFloatingTaller ? refRect : rect).bottom; 10675 if (side === "top" && y2 >= refRect.bottom - 1 || side === "bottom" && y2 <= refRect.top + 1 || side === "left" && x2 >= refRect.right - 1 || side === "right" && x2 <= refRect.left + 1) { 10676 closeIfNoOpenChild(); 10677 return void 0; 10678 } 10679 let isInsideTroughRect = false; 10680 switch (side) { 10681 case "top": 10682 isInsideTroughRect = isInsideAxisAlignedRect(clientX, clientY, left, refRect.top + 1, right, rect.bottom - 1); 10683 break; 10684 case "bottom": 10685 isInsideTroughRect = isInsideAxisAlignedRect(clientX, clientY, left, rect.top + 1, right, refRect.bottom - 1); 10686 break; 10687 case "left": 10688 isInsideTroughRect = isInsideAxisAlignedRect(clientX, clientY, rect.right - 1, bottom, refRect.left + 1, top); 10689 break; 10690 case "right": 10691 isInsideTroughRect = isInsideAxisAlignedRect(clientX, clientY, refRect.right - 1, bottom, rect.left + 1, top); 10692 break; 10693 default: 10694 } 10695 if (isInsideTroughRect) { 10696 return void 0; 10697 } 10698 if (hasLanded && !isInsideRect(clientX, clientY, refRect)) { 10699 closeIfNoOpenChild(); 10700 return void 0; 10701 } 10702 if (!isLeave && isCursorMovingSlowly(clientX, clientY)) { 10703 closeIfNoOpenChild(); 10704 return void 0; 10705 } 10706 let isInsidePolygon = false; 10707 switch (side) { 10708 case "top": { 10709 const cursorXOffset = isFloatingWider ? POLYGON_BUFFER / 2 : POLYGON_BUFFER * 4; 10710 const cursorPointOneX = isFloatingWider ? x2 + cursorXOffset : cursorLeaveFromRight ? x2 + cursorXOffset : x2 - cursorXOffset; 10711 const cursorPointTwoX = isFloatingWider ? x2 - cursorXOffset : cursorLeaveFromRight ? x2 + cursorXOffset : x2 - cursorXOffset; 10712 const cursorPointY = y2 + POLYGON_BUFFER + 1; 10713 const commonYLeft = cursorLeaveFromRight ? rect.bottom - POLYGON_BUFFER : isFloatingWider ? rect.bottom - POLYGON_BUFFER : rect.top; 10714 const commonYRight = cursorLeaveFromRight ? isFloatingWider ? rect.bottom - POLYGON_BUFFER : rect.top : rect.bottom - POLYGON_BUFFER; 10715 isInsidePolygon = isPointInQuadrilateral(clientX, clientY, cursorPointOneX, cursorPointY, cursorPointTwoX, cursorPointY, rect.left, commonYLeft, rect.right, commonYRight); 10716 break; 10717 } 10718 case "bottom": { 10719 const cursorXOffset = isFloatingWider ? POLYGON_BUFFER / 2 : POLYGON_BUFFER * 4; 10720 const cursorPointOneX = isFloatingWider ? x2 + cursorXOffset : cursorLeaveFromRight ? x2 + cursorXOffset : x2 - cursorXOffset; 10721 const cursorPointTwoX = isFloatingWider ? x2 - cursorXOffset : cursorLeaveFromRight ? x2 + cursorXOffset : x2 - cursorXOffset; 10722 const cursorPointY = y2 - POLYGON_BUFFER; 10723 const commonYLeft = cursorLeaveFromRight ? rect.top + POLYGON_BUFFER : isFloatingWider ? rect.top + POLYGON_BUFFER : rect.bottom; 10724 const commonYRight = cursorLeaveFromRight ? isFloatingWider ? rect.top + POLYGON_BUFFER : rect.bottom : rect.top + POLYGON_BUFFER; 10725 isInsidePolygon = isPointInQuadrilateral(clientX, clientY, cursorPointOneX, cursorPointY, cursorPointTwoX, cursorPointY, rect.left, commonYLeft, rect.right, commonYRight); 10726 break; 10727 } 10728 case "left": { 10729 const cursorYOffset = isFloatingTaller ? POLYGON_BUFFER / 2 : POLYGON_BUFFER * 4; 10730 const cursorPointOneY = isFloatingTaller ? y2 + cursorYOffset : cursorLeaveFromBottom ? y2 + cursorYOffset : y2 - cursorYOffset; 10731 const cursorPointTwoY = isFloatingTaller ? y2 - cursorYOffset : cursorLeaveFromBottom ? y2 + cursorYOffset : y2 - cursorYOffset; 10732 const cursorPointX = x2 + POLYGON_BUFFER + 1; 10733 const commonXTop = cursorLeaveFromBottom ? rect.right - POLYGON_BUFFER : isFloatingTaller ? rect.right - POLYGON_BUFFER : rect.left; 10734 const commonXBottom = cursorLeaveFromBottom ? isFloatingTaller ? rect.right - POLYGON_BUFFER : rect.left : rect.right - POLYGON_BUFFER; 10735 isInsidePolygon = isPointInQuadrilateral(clientX, clientY, commonXTop, rect.top, commonXBottom, rect.bottom, cursorPointX, cursorPointOneY, cursorPointX, cursorPointTwoY); 10736 break; 10737 } 10738 case "right": { 10739 const cursorYOffset = isFloatingTaller ? POLYGON_BUFFER / 2 : POLYGON_BUFFER * 4; 10740 const cursorPointOneY = isFloatingTaller ? y2 + cursorYOffset : cursorLeaveFromBottom ? y2 + cursorYOffset : y2 - cursorYOffset; 10741 const cursorPointTwoY = isFloatingTaller ? y2 - cursorYOffset : cursorLeaveFromBottom ? y2 + cursorYOffset : y2 - cursorYOffset; 10742 const cursorPointX = x2 - POLYGON_BUFFER; 10743 const commonXTop = cursorLeaveFromBottom ? rect.left + POLYGON_BUFFER : isFloatingTaller ? rect.left + POLYGON_BUFFER : rect.right; 10744 const commonXBottom = cursorLeaveFromBottom ? isFloatingTaller ? rect.left + POLYGON_BUFFER : rect.right : rect.left + POLYGON_BUFFER; 10745 isInsidePolygon = isPointInQuadrilateral(clientX, clientY, cursorPointX, cursorPointOneY, cursorPointX, cursorPointTwoY, commonXTop, rect.top, commonXBottom, rect.bottom); 10746 break; 10747 } 10748 default: 10749 } 10750 if (!isInsidePolygon) { 10751 closeIfNoOpenChild(); 10752 } else if (!hasLanded) { 10753 timeout.start(40, closeIfNoOpenChild); 10754 } 10755 return void 0; 10756 }; 10757 }; 10758 fn.__options = { 10759 ...options, 10760 blockPointerEvents 10761 }; 10762 return fn; 10763 } 10764 10765 // node_modules/@base-ui/react/utils/NullStore.mjs 10766 var NullStore = class extends ReactStore { 10767 // `update`/`set`/`notifyAll` funnel through `setState` in the base `Store`, so overriding 10768 // `setState` alone would neutralize them today. They are overridden explicitly so the store stays 10769 // inert even if a future base-class change stops routing a mutator through `setState`. 10770 setState(_newState) { 10771 } 10772 update(_changes) { 10773 } 10774 set(_key, _value) { 10775 } 10776 notifyAll() { 10777 } 10778 }; 10779 10780 // node_modules/@base-ui/react/internals/composite/composite.mjs 10781 var ARROW_UP2 = "ArrowUp"; 10782 var ARROW_DOWN2 = "ArrowDown"; 10783 var ARROW_LEFT2 = "ArrowLeft"; 10784 var ARROW_RIGHT2 = "ArrowRight"; 10785 var HOME = "Home"; 10786 var END = "End"; 10787 var COMPOSITE_KEYS = /* @__PURE__ */ new Set([ARROW_UP2, ARROW_DOWN2, ARROW_LEFT2, ARROW_RIGHT2, HOME, END]); 10788 10789 // node_modules/@base-ui/utils/inertValue.mjs 10790 function inertValue(value) { 10791 if (isReactVersionAtLeast(19)) { 10792 return value; 10793 } 10794 return value ? "true" : void 0; 10795 } 10796 10797 // node_modules/@base-ui/react/utils/InternalBackdrop.mjs 10798 var React39 = __toESM(require_react(), 1); 10799 var import_jsx_runtime41 = __toESM(require_jsx_runtime(), 1); 10800 var InternalBackdrop = /* @__PURE__ */ React39.forwardRef(function InternalBackdrop2(props, ref) { 10801 const { 10802 cutout, 10803 ...otherProps 10804 } = props; 10805 let clipPath; 10806 if (cutout) { 10807 const rect = cutout.getBoundingClientRect(); 10808 clipPath = `polygon(0% 0%,100% 0%,100% 100%,0% 100%,0% 0%,$rect.left}px $rect.top}px,$rect.left}px $rect.bottom}px,$rect.right}px $rect.bottom}px,$rect.right}px $rect.top}px,$rect.left}px $rect.top}px)`; 10809 } 10810 return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { 10811 ref, 10812 role: "presentation", 10813 "data-base-ui-inert": "", 10814 ...otherProps, 10815 style: { 10816 position: "fixed", 10817 inset: 0, 10818 userSelect: "none", 10819 WebkitUserSelect: "none", 10820 clipPath 10821 } 10822 }); 10823 }); 10824 if (true) InternalBackdrop.displayName = "InternalBackdrop"; 10825 10826 // node_modules/@base-ui/react/utils/useOpenInteractionType.mjs 10827 var React42 = __toESM(require_react(), 1); 10828 10829 // node_modules/@base-ui/utils/useEnhancedClickHandler.mjs 10830 var React40 = __toESM(require_react(), 1); 10831 function useEnhancedClickHandler(handler) { 10832 const lastClickInteractionTypeRef = React40.useRef(""); 10833 const handlePointerDown = React40.useCallback((event) => { 10834 if (event.defaultPrevented) { 10835 return; 10836 } 10837 lastClickInteractionTypeRef.current = event.pointerType; 10838 handler(event, event.pointerType); 10839 }, [handler]); 10840 const handleClick = React40.useCallback((event) => { 10841 if (event.detail === 0) { 10842 handler(event, "keyboard"); 10843 return; 10844 } 10845 if ("pointerType" in event) { 10846 handler(event, event.pointerType); 10847 } else { 10848 handler(event, lastClickInteractionTypeRef.current); 10849 } 10850 lastClickInteractionTypeRef.current = ""; 10851 }, [handler]); 10852 return { 10853 onClick: handleClick, 10854 onPointerDown: handlePointerDown 10855 }; 10856 } 10857 10858 // node_modules/@base-ui/react/internals/useValueChanged.mjs 10859 var React41 = __toESM(require_react(), 1); 10860 function useValueChanged(value, onChange) { 10861 const valueRef = React41.useRef(value); 10862 const onChangeCallback = useStableCallback(onChange); 10863 useIsoLayoutEffect(() => { 10864 if (valueRef.current !== value) { 10865 onChangeCallback(valueRef.current); 10866 } 10867 valueRef.current = value; 10868 }, [value, onChangeCallback]); 10869 } 10870 10871 // node_modules/@base-ui/react/utils/useOpenInteractionType.mjs 10872 function useOpenMethodTriggerProps(open2, setOpenMethod) { 10873 const handleTriggerClick = useStableCallback((_, interactionType) => { 10874 const isOpen = typeof open2 === "function" ? open2() : open2; 10875 if (!isOpen) { 10876 setOpenMethod(interactionType || // On iOS Safari, the hitslop around touch targets means tapping outside an element's 10877 // bounds does not fire `pointerdown` but does fire `mousedown`. The `interactionType` 10878 // will be "" in that case. 10879 (parts_exports.os.ios ? "touch" : "")); 10880 } 10881 }); 10882 const { 10883 onClick, 10884 onPointerDown 10885 } = useEnhancedClickHandler(handleTriggerClick); 10886 return React42.useMemo(() => ({ 10887 onClick, 10888 onPointerDown 10889 }), [onClick, onPointerDown]); 10890 } 10891 function useOpenInteractionType(open2) { 10892 const [openMethod, setOpenMethod] = React42.useState(null); 10893 const triggerProps = useOpenMethodTriggerProps(open2, setOpenMethod); 10894 useValueChanged(open2, (previousOpen) => { 10895 if (previousOpen && !open2) { 10896 setOpenMethod(null); 10897 } 10898 }); 10899 return React42.useMemo(() => ({ 10900 openMethod, 10901 triggerProps 10902 }), [openMethod, triggerProps]); 10903 } 10904 10905 // node_modules/@base-ui/react/internals/field-root-context/FieldRootContext.mjs 10906 var React43 = __toESM(require_react(), 1); 10907 10908 // node_modules/@base-ui/react/field/control/FieldControlDataAttributes.mjs 10909 var valid = "data-valid"; 10910 var invalid = "data-invalid"; 10911 10912 // node_modules/@base-ui/react/internals/field-constants/constants.mjs 10913 var DEFAULT_VALIDITY_STATE = { 10914 badInput: false, 10915 customError: false, 10916 patternMismatch: false, 10917 rangeOverflow: false, 10918 rangeUnderflow: false, 10919 stepMismatch: false, 10920 tooLong: false, 10921 tooShort: false, 10922 typeMismatch: false, 10923 valid: null, 10924 valueMissing: false 10925 }; 10926 var DEFAULT_FIELD_STATE_ATTRIBUTES = { 10927 valid: null, 10928 touched: false, 10929 dirty: false, 10930 filled: false, 10931 focused: false 10932 }; 10933 var DEFAULT_FIELD_ROOT_STATE = { 10934 disabled: false, 10935 ...DEFAULT_FIELD_STATE_ATTRIBUTES 10936 }; 10937 var fieldValidityMapping = { 10938 valid(value) { 10939 if (value === null) { 10940 return null; 10941 } 10942 if (value) { 10943 return { 10944 [valid]: "" 10945 }; 10946 } 10947 return { 10948 [invalid]: "" 10949 }; 10950 } 10951 }; 10952 10953 // node_modules/@base-ui/react/internals/field-root-context/FieldRootContext.mjs 10954 var DEFAULT_FIELD_ROOT_CONTEXT = { 10955 invalid: void 0, 10956 name: void 0, 10957 validityData: { 10958 state: DEFAULT_VALIDITY_STATE, 10959 errors: [], 10960 error: "", 10961 value: "", 10962 initialValue: null 10963 }, 10964 setValidityData: NOOP, 10965 disabled: void 0, 10966 setTouched: NOOP, 10967 setDirty: NOOP, 10968 setFilled: NOOP, 10969 setFocused: NOOP, 10970 validationMode: "onSubmit", 10971 shouldValidateOnChange: () => false, 10972 state: DEFAULT_FIELD_ROOT_STATE, 10973 registerFieldControl: NOOP, 10974 validation: { 10975 getValidationProps: (_disabled, props = EMPTY_OBJECT) => props, 10976 inputRef: { 10977 current: null 10978 }, 10979 registeredInputs: /* @__PURE__ */ new Map(), 10980 registerInput: NOOP, 10981 getInputControl: () => null, 10982 commit: async () => { 10983 }, 10984 change: NOOP 10985 } 10986 }; 10987 var FieldRootContext = /* @__PURE__ */ React43.createContext(DEFAULT_FIELD_ROOT_CONTEXT); 10988 if (true) FieldRootContext.displayName = "FieldRootContext"; 10989 function useFieldRootContext(optional = true) { 10990 const context = React43.useContext(FieldRootContext); 10991 if (context.setValidityData === NOOP && !optional) { 10992 throw new Error(true ? "Base UI: FieldRootContext is missing. Field parts must be placed within <Field.Root>." : formatErrorMessage_default(28)); 10993 } 10994 return context; 10995 } 10996 10997 // node_modules/@base-ui/react/internals/field-register-control/useRegisterFieldControl.mjs 10998 function useRegisterFieldControl(controlRef, id, value, getFormValueOverride, enabled = true, name) { 10999 const { 11000 registerFieldControl 11001 } = useFieldRootContext(); 11002 const sourceRef = useRefWithInit(() => /* @__PURE__ */ Symbol()); 11003 useIsoLayoutEffect(() => { 11004 const source = sourceRef.current; 11005 if (!enabled) { 11006 registerFieldControl(source, void 0); 11007 return; 11008 } 11009 const registration = { 11010 controlRef, 11011 getValue: getFormValueOverride, 11012 id, 11013 name, 11014 value 11015 }; 11016 registerFieldControl(source, registration); 11017 }, [controlRef, enabled, getFormValueOverride, id, name, registerFieldControl, sourceRef, value]); 11018 useIsoLayoutEffect(() => { 11019 const source = sourceRef.current; 11020 return () => { 11021 registerFieldControl(source, void 0); 11022 }; 11023 }, [registerFieldControl, sourceRef]); 11024 } 11025 11026 // node_modules/@base-ui/react/internals/form-context/FormContext.mjs 11027 var React44 = __toESM(require_react(), 1); 11028 var FormContext = /* @__PURE__ */ React44.createContext({ 11029 elementRef: { 11030 current: null 11031 }, 11032 formRef: { 11033 current: { 11034 fields: /* @__PURE__ */ new Map() 11035 } 11036 }, 11037 errors: {}, 11038 clearErrors: NOOP, 11039 validationMode: "onSubmit", 11040 submitCountRef: { 11041 current: 0 11042 } 11043 }); 11044 if (true) FormContext.displayName = "FormContext"; 11045 function useFormContext() { 11046 return React44.useContext(FormContext); 11047 } 11048 11049 // node_modules/@base-ui/react/internals/labelable-provider/useLabelableId.mjs 11050 var React46 = __toESM(require_react(), 1); 11051 11052 // node_modules/@base-ui/react/internals/labelable-provider/LabelableContext.mjs 11053 var React45 = __toESM(require_react(), 1); 11054 var LabelableContext = /* @__PURE__ */ React45.createContext({ 11055 controlId: void 0, 11056 registerControlId: NOOP, 11057 resetControlId: NOOP, 11058 labelId: void 0, 11059 setLabelId: NOOP, 11060 messageIds: [], 11061 setMessageIds: NOOP, 11062 getDescriptionProps: (externalProps) => externalProps 11063 }); 11064 if (true) LabelableContext.displayName = "LabelableContext"; 11065 function useLabelableContext() { 11066 return React45.useContext(LabelableContext); 11067 } 11068 11069 // node_modules/@base-ui/react/internals/labelable-provider/useLabelableId.mjs 11070 function useLabelableId(params = {}) { 11071 const { 11072 id, 11073 enabled = true 11074 } = params; 11075 const { 11076 controlId, 11077 registerControlId, 11078 resetControlId 11079 } = useLabelableContext(); 11080 const defaultId = useBaseUiId(); 11081 const controlSourceRef = useRefWithInit(() => /* @__PURE__ */ Symbol()); 11082 const hasRegisteredRef = React46.useRef(false); 11083 const hadExplicitIdRef = React46.useRef(false); 11084 const unregisterControlId = useStableCallback(() => { 11085 if (!hasRegisteredRef.current || registerControlId === NOOP) { 11086 return; 11087 } 11088 hasRegisteredRef.current = false; 11089 registerControlId(controlSourceRef.current, void 0); 11090 }); 11091 useIsoLayoutEffect(() => { 11092 if (!enabled || registerControlId === NOOP) { 11093 unregisterControlId(); 11094 return void 0; 11095 } 11096 let nextId; 11097 if (id !== void 0) { 11098 hadExplicitIdRef.current = true; 11099 nextId = id; 11100 } else if (hadExplicitIdRef.current) { 11101 nextId = defaultId; 11102 } else { 11103 resetControlId(); 11104 return void 0; 11105 } 11106 if (nextId === void 0) { 11107 unregisterControlId(); 11108 return void 0; 11109 } 11110 hasRegisteredRef.current = true; 11111 registerControlId(controlSourceRef.current, nextId); 11112 return void 0; 11113 }, [id, enabled, registerControlId, resetControlId, defaultId, controlSourceRef, unregisterControlId]); 11114 useIsoLayoutEffect(() => { 11115 return unregisterControlId; 11116 }, [unregisterControlId]); 11117 return (enabled ? controlId : void 0) ?? id ?? defaultId; 11118 } 11119 11120 // node_modules/@base-ui/react/internals/direction-context/DirectionContext.mjs 11121 var React47 = __toESM(require_react(), 1); 11122 var DirectionContext = /* @__PURE__ */ React47.createContext(void 0); 11123 if (true) DirectionContext.displayName = "DirectionContext"; 11124 function useDirection() { 11125 const context = React47.useContext(DirectionContext); 11126 return context?.direction ?? "ltr"; 11127 } 11128 11129 // node_modules/@base-ui/react/utils/getPseudoElementBounds.mjs 11130 var BOUNDARY_OFFSET = 5; 11131 function isMouseWithinBounds(event, element) { 11132 const bounds = getPseudoElementBounds(element); 11133 return event.clientX >= bounds.left - BOUNDARY_OFFSET && event.clientX <= bounds.right + BOUNDARY_OFFSET && event.clientY >= bounds.top - BOUNDARY_OFFSET && event.clientY <= bounds.bottom + BOUNDARY_OFFSET; 11134 } 11135 function getPseudoElementBounds(element) { 11136 const elementRect = element.getBoundingClientRect(); 11137 const win = getWindow(element); 11138 if (parts_exports.env.jsdom) { 11139 return elementRect; 11140 } 11141 const beforeStyles = win.getComputedStyle(element, "::before"); 11142 const afterStyles = win.getComputedStyle(element, "::after"); 11143 const hasPseudoElements = beforeStyles.content !== "none" || afterStyles.content !== "none"; 11144 if (!hasPseudoElements) { 11145 return elementRect; 11146 } 11147 const beforeWidth = parseFloat(beforeStyles.width) || 0; 11148 const beforeHeight = parseFloat(beforeStyles.height) || 0; 11149 const afterWidth = parseFloat(afterStyles.width) || 0; 11150 const afterHeight = parseFloat(afterStyles.height) || 0; 11151 const totalWidth = Math.max(elementRect.width, beforeWidth, afterWidth); 11152 const totalHeight = Math.max(elementRect.height, beforeHeight, afterHeight); 11153 const widthDiff = totalWidth - elementRect.width; 11154 const heightDiff = totalHeight - elementRect.height; 11155 return { 11156 left: elementRect.left - widthDiff / 2, 11157 right: elementRect.right + widthDiff / 2, 11158 top: elementRect.top - heightDiff / 2, 11159 bottom: elementRect.bottom + heightDiff / 2 11160 }; 11161 } 11162 11163 // node_modules/@base-ui/react/internals/useAnchorPositioning.mjs 11164 var React48 = __toESM(require_react(), 1); 11165 11166 // node_modules/@base-ui/react/floating-ui-react/middleware/arrow.mjs 11167 var baseArrow = (options) => ({ 11168 name: "arrow", 11169 options, 11170 async fn(state) { 11171 const { 11172 x: x2, 11173 y: y2, 11174 placement, 11175 rects, 11176 platform: platform3, 11177 elements, 11178 middlewareData 11179 } = state; 11180 const { 11181 element, 11182 padding = 0, 11183 offsetParent = "real" 11184 } = evaluate(options, state) || {}; 11185 if (element == null) { 11186 return {}; 11187 } 11188 const paddingObject = getPaddingObject(padding); 11189 const coords = { 11190 x: x2, 11191 y: y2 11192 }; 11193 const axis = getAlignmentAxis(placement); 11194 const length = getAxisLength(axis); 11195 const arrowDimensions = await platform3.getDimensions(element); 11196 const isYAxis = axis === "y"; 11197 const minProp = isYAxis ? "top" : "left"; 11198 const maxProp = isYAxis ? "bottom" : "right"; 11199 const clientProp = isYAxis ? "clientHeight" : "clientWidth"; 11200 const endDiff = rects.reference[length] + rects.reference[axis] - coords[axis] - rects.floating[length]; 11201 const startDiff = coords[axis] - rects.reference[axis]; 11202 const arrowOffsetParent = offsetParent === "real" ? await platform3.getOffsetParent?.(element) : elements.floating; 11203 let clientSize = elements.floating[clientProp] || rects.floating[length]; 11204 if (!clientSize || !await platform3.isElement?.(arrowOffsetParent)) { 11205 clientSize = elements.floating[clientProp] || rects.floating[length]; 11206 } 11207 const centerToReference = endDiff / 2 - startDiff / 2; 11208 const largestPossiblePadding = clientSize / 2 - arrowDimensions[length] / 2 - 1; 11209 const minPadding = Math.min(paddingObject[minProp], largestPossiblePadding); 11210 const maxPadding = Math.min(paddingObject[maxProp], largestPossiblePadding); 11211 const min3 = minPadding; 11212 const max3 = clientSize - arrowDimensions[length] - maxPadding; 11213 const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference; 11214 const offset4 = clamp(min3, center, max3); 11215 const shouldAddOffset = !middlewareData.arrow && getAlignment(placement) != null && center !== offset4 && rects.reference[length] / 2 - (center < min3 ? minPadding : maxPadding) - arrowDimensions[length] / 2 < 0; 11216 const alignmentOffset = shouldAddOffset ? center < min3 ? center - min3 : center - max3 : 0; 11217 return { 11218 [axis]: coords[axis] + alignmentOffset, 11219 data: { 11220 [axis]: offset4, 11221 centerOffset: center - offset4 - alignmentOffset, 11222 ...shouldAddOffset && { 11223 alignmentOffset 11224 } 11225 }, 11226 reset: shouldAddOffset 11227 }; 11228 } 11229 }); 11230 var arrow4 = (options, deps) => { 11231 const { 11232 name, 11233 fn 11234 } = baseArrow(options); 11235 return { 11236 name, 11237 fn, 11238 options: [options, deps] 11239 }; 11240 }; 11241 11242 // node_modules/@base-ui/react/utils/hideMiddleware.mjs 11243 var hide4 = { 11244 name: "hide", 11245 async fn(state) { 11246 const { 11247 width, 11248 height, 11249 x: x2, 11250 y: y2 11251 } = state.rects.reference; 11252 const anchorHidden2 = width === 0 && height === 0 && x2 === 0 && y2 === 0; 11253 const overflow = await state.platform.detectOverflow(state, { 11254 elementContext: "reference" 11255 }); 11256 const referenceHidden = overflow.top - height >= 0 || overflow.right - width >= 0 || overflow.bottom - height >= 0 || overflow.left - width >= 0; 11257 return { 11258 data: { 11259 referenceHidden: referenceHidden || anchorHidden2 11260 } 11261 }; 11262 } 11263 }; 11264 11265 // node_modules/@base-ui/react/utils/adaptiveOriginConstants.mjs 11266 var DEFAULT_SIDES = { 11267 sideX: "left", 11268 sideY: "top" 11269 }; 11270 11271 // node_modules/@base-ui/react/utils/CommonPositionerCssVars.mjs 11272 var availableWidth = "--available-width"; 11273 var availableHeight = "--available-height"; 11274 var anchorWidth = "--anchor-width"; 11275 var anchorHeight = "--anchor-height"; 11276 var transformOrigin = "--transform-origin"; 11277 var positionerWidth = "--positioner-width"; 11278 var positionerHeight = "--positioner-height"; 11279 11280 // node_modules/@base-ui/react/internals/useAnchorPositioning.mjs 11281 var AVAILABLE_WIDTH_VAR = availableWidth; 11282 var AVAILABLE_HEIGHT_VAR = availableHeight; 11283 function getLogicalSide(sideParam, renderedSide, isRtl) { 11284 const isLogicalSideParam = sideParam === "inline-start" || sideParam === "inline-end"; 11285 const logicalRight = isRtl ? "inline-start" : "inline-end"; 11286 const logicalLeft = isRtl ? "inline-end" : "inline-start"; 11287 return { 11288 top: "top", 11289 right: isLogicalSideParam ? logicalRight : "right", 11290 bottom: "bottom", 11291 left: isLogicalSideParam ? logicalLeft : "left" 11292 }[renderedSide]; 11293 } 11294 function getOffsetData(state, sideParam, isRtl) { 11295 const { 11296 rects, 11297 placement 11298 } = state; 11299 const data = { 11300 side: getLogicalSide(sideParam, getSide(placement), isRtl), 11301 align: getAlignment(placement) || "center", 11302 anchor: { 11303 width: rects.reference.width, 11304 height: rects.reference.height 11305 }, 11306 positioner: { 11307 width: rects.floating.width, 11308 height: rects.floating.height 11309 } 11310 }; 11311 return data; 11312 } 11313 function useAnchorPositioning(params) { 11314 return useAnchorPositioningWithHook(params, useBaseUIFloating); 11315 } 11316 function useAnchorPositioningWithHook(params, useFloatingHook) { 11317 const { 11318 // Public parameters 11319 anchor, 11320 positionMethod = "absolute", 11321 side: sideParam = "bottom", 11322 sideOffset = 0, 11323 align = "center", 11324 alignOffset = 0, 11325 collisionBoundary, 11326 collisionPadding: collisionPaddingParam = 5, 11327 sticky = false, 11328 arrowPadding = 5, 11329 disableAnchorTracking = false, 11330 inline: inlineMiddleware, 11331 // Private parameters 11332 keepMounted = false, 11333 floatingRootContext, 11334 mounted, 11335 collisionAvoidance, 11336 shift: shift4, 11337 nodeId, 11338 adaptiveOrigin: adaptiveOrigin2, 11339 lazyFlip = false, 11340 externalTree 11341 } = params; 11342 const [mountSide, setMountSide] = React48.useState(null); 11343 if (!mounted && mountSide !== null) { 11344 setMountSide(null); 11345 } 11346 const collisionAvoidanceSide = collisionAvoidance.side || "flip"; 11347 const collisionAvoidanceAlign = collisionAvoidance.align || "flip"; 11348 const collisionAvoidanceFallbackAxisSide = collisionAvoidance.fallbackAxisSide || "end"; 11349 const shiftCrossAxis = shift4?.crossAxis ?? false; 11350 const shiftRootBoundary = shift4?.rootBoundary; 11351 const anchorFn = typeof anchor === "function" ? anchor : void 0; 11352 const anchorFnCallback = useStableCallback(anchorFn); 11353 const anchorDep = anchorFn ? anchorFnCallback : anchor; 11354 const anchorValueRef = useValueAsRef(anchor); 11355 const mountedRef = useValueAsRef(mounted); 11356 const direction = useDirection(); 11357 const isRtl = direction === "rtl"; 11358 const side = mountSide || { 11359 top: "top", 11360 right: "right", 11361 bottom: "bottom", 11362 left: "left", 11363 "inline-end": isRtl ? "left" : "right", 11364 "inline-start": isRtl ? "right" : "left" 11365 }[sideParam]; 11366 const placement = align === "center" ? side : `$side}-$align}`; 11367 let collisionPadding = collisionPaddingParam; 11368 if (typeof collisionPadding === "number") { 11369 collisionPadding = { 11370 top: collisionPadding, 11371 right: collisionPadding, 11372 bottom: collisionPadding, 11373 left: collisionPadding 11374 }; 11375 } else if (collisionPadding) { 11376 collisionPadding = { 11377 top: collisionPadding.top || 0, 11378 right: collisionPadding.right || 0, 11379 bottom: collisionPadding.bottom || 0, 11380 left: collisionPadding.left || 0 11381 }; 11382 } 11383 const bias = 1; 11384 const biasTop = sideParam === "bottom" ? bias : 0; 11385 const biasBottom = sideParam === "top" ? bias : 0; 11386 const biasLeft = sideParam === "right" ? bias : 0; 11387 const biasRight = sideParam === "left" ? bias : 0; 11388 const commonCollisionProps = { 11389 boundary: collisionBoundary === "clipping-ancestors" ? "clippingAncestors" : collisionBoundary, 11390 padding: collisionPadding 11391 }; 11392 const arrowRef = React48.useRef(null); 11393 const sideOffsetRef = useValueAsRef(sideOffset); 11394 const alignOffsetRef = useValueAsRef(alignOffset); 11395 const sideOffsetDep = typeof sideOffset !== "function" ? sideOffset : 0; 11396 const alignOffsetDep = typeof alignOffset !== "function" ? alignOffset : 0; 11397 const middleware = []; 11398 if (inlineMiddleware) { 11399 middleware.push(inlineMiddleware); 11400 } 11401 middleware.push(offset3((state) => { 11402 const data = getOffsetData(state, sideParam, isRtl); 11403 const sideAxis = typeof sideOffsetRef.current === "function" ? sideOffsetRef.current(data) : sideOffsetRef.current; 11404 const alignAxis = typeof alignOffsetRef.current === "function" ? alignOffsetRef.current(data) : alignOffsetRef.current; 11405 return { 11406 mainAxis: sideAxis, 11407 crossAxis: alignAxis, 11408 alignmentAxis: alignAxis 11409 }; 11410 }, [sideOffsetDep, alignOffsetDep, isRtl, sideParam])); 11411 const shiftDisabled = collisionAvoidanceAlign === "none" && collisionAvoidanceSide !== "shift"; 11412 const crossAxisShiftEnabled = !shiftDisabled && (sticky || shiftCrossAxis || collisionAvoidanceSide === "shift"); 11413 const flipMiddleware = collisionAvoidanceSide === "none" ? null : flip3({ 11414 ...commonCollisionProps, 11415 // Ensure the popup flips if it's been limited by its --available-height and it resizes. 11416 // Since the size() padding is smaller than the flip() padding, flip() will take precedence. 11417 padding: { 11418 top: collisionPadding.top + bias + biasTop, 11419 right: collisionPadding.right + bias + biasRight, 11420 bottom: collisionPadding.bottom + bias + biasBottom, 11421 left: collisionPadding.left + bias + biasLeft 11422 }, 11423 mainAxis: !shiftCrossAxis && collisionAvoidanceSide === "flip", 11424 crossAxis: collisionAvoidanceAlign === "flip" ? "alignment" : false, 11425 fallbackAxisSideDirection: collisionAvoidanceFallbackAxisSide 11426 }); 11427 const shiftMiddleware = shiftDisabled ? null : shift3({ 11428 ...commonCollisionProps, 11429 // Use the Layout Viewport to avoid shifting around when pinch-zooming. 11430 rootBoundary: shiftRootBoundary, 11431 mainAxis: collisionAvoidanceAlign !== "none", 11432 crossAxis: crossAxisShiftEnabled, 11433 limiter: sticky || shiftCrossAxis ? void 0 : limitShift3((limitData) => { 11434 if (!arrowRef.current) { 11435 return {}; 11436 } 11437 const { 11438 width, 11439 height 11440 } = arrowRef.current.getBoundingClientRect(); 11441 const sideAxis = getSideAxis(getSide(limitData.placement)); 11442 const arrowSize = sideAxis === "y" ? width : height; 11443 const offsetAmount = sideAxis === "y" ? collisionPadding.left + collisionPadding.right : collisionPadding.top + collisionPadding.bottom; 11444 return { 11445 offset: arrowSize / 2 + offsetAmount / 2 11446 }; 11447 }) 11448 }, [commonCollisionProps, sticky, shiftCrossAxis, shiftRootBoundary, collisionPadding, collisionAvoidanceAlign]); 11449 if (collisionAvoidanceSide === "shift" || collisionAvoidanceAlign === "shift" || align === "center") { 11450 middleware.push(shiftMiddleware, flipMiddleware); 11451 } else { 11452 middleware.push(flipMiddleware, shiftMiddleware); 11453 } 11454 middleware.push(size3({ 11455 ...commonCollisionProps, 11456 apply({ 11457 elements: { 11458 floating 11459 }, 11460 availableWidth: availableWidth2, 11461 availableHeight: availableHeight2, 11462 rects 11463 }) { 11464 if (!mountedRef.current) { 11465 return; 11466 } 11467 const floatingStyle = floating.style; 11468 floatingStyle.setProperty(AVAILABLE_WIDTH_VAR, `$availableWidth2}px`); 11469 floatingStyle.setProperty(AVAILABLE_HEIGHT_VAR, `$availableHeight2}px`); 11470 const dpr = getWindow(floating).devicePixelRatio || 1; 11471 const { 11472 x: x3, 11473 y: y3, 11474 width, 11475 height 11476 } = rects.reference; 11477 const anchorWidth2 = (Math.round((x3 + width) * dpr) - Math.round(x3 * dpr)) / dpr; 11478 const anchorHeight2 = (Math.round((y3 + height) * dpr) - Math.round(y3 * dpr)) / dpr; 11479 floatingStyle.setProperty(anchorWidth, `$anchorWidth2}px`); 11480 floatingStyle.setProperty(anchorHeight, `$anchorHeight2}px`); 11481 } 11482 }), arrow4((state) => ({ 11483 // `transform-origin` calculations rely on an element existing. If the arrow hasn't been set, 11484 // we'll create a fake element. 11485 element: arrowRef.current || ownerDocument(state.elements.floating).createElement("div"), 11486 // No padding for the fake arrow: it would displace aligned popups on narrow anchors. 11487 padding: arrowRef.current ? arrowPadding : 0, 11488 offsetParent: "floating" 11489 }), [arrowPadding]), { 11490 name: "transformOrigin", 11491 fn(state) { 11492 const { 11493 elements: { 11494 floating 11495 }, 11496 middlewareData: middlewareData2, 11497 placement: renderedPlacement2, 11498 platform: platform3, 11499 rects, 11500 y: y3 11501 } = state; 11502 const renderedSide2 = getSide(renderedPlacement2); 11503 const renderedAlign2 = getAlignment(renderedPlacement2); 11504 const isVertical = getSideAxis(renderedSide2) === "y"; 11505 const arrowEl = arrowRef.current; 11506 const sideOffsetValue = typeof sideOffset === "function" ? sideOffset(getOffsetData(state, sideParam, isRtl)) : sideOffset; 11507 let crossOrigin; 11508 if (!arrowEl && renderedAlign2 && Math.abs(isVertical ? middlewareData2.shift?.x || 0 : middlewareData2.shift?.y || 0) <= 1) { 11509 crossOrigin = renderedAlign2 === "start" === (isVertical && platform3.isRTL?.(floating) === true) ? "100%" : "0%"; 11510 } else { 11511 const arrowOffset = isVertical ? middlewareData2.arrow?.x || 0 : middlewareData2.arrow?.y || 0; 11512 const arrowSize = isVertical ? arrowEl?.clientWidth || 0 : arrowEl?.clientHeight || 0; 11513 crossOrigin = `$arrowOffset + arrowSize / 2}px`; 11514 } 11515 let sideOrigin = renderedSide2 === "top" || renderedSide2 === "left" ? `calc(100% + $sideOffsetValue}px)` : `${-sideOffsetValue}px`; 11516 if (crossAxisShiftEnabled && isVertical && Math.abs(middlewareData2.shift?.y || 0) > sideOffsetValue) { 11517 sideOrigin = `$rects.reference.y + rects.reference.height / 2 - y3}px`; 11518 } 11519 floating.style.setProperty(transformOrigin, isVertical ? `$crossOrigin} $sideOrigin}` : `$sideOrigin} $crossOrigin}`); 11520 return {}; 11521 } 11522 }, hide4, adaptiveOrigin2); 11523 useIsoLayoutEffect(() => { 11524 if (!mounted && floatingRootContext) { 11525 floatingRootContext.update({ 11526 referenceElement: null, 11527 floatingElement: null, 11528 domReferenceElement: null, 11529 positionReference: null 11530 }); 11531 } 11532 }, [mounted, floatingRootContext]); 11533 const autoUpdateOptions = React48.useMemo(() => ({ 11534 ancestorScroll: !disableAnchorTracking, 11535 elementResize: !disableAnchorTracking && typeof ResizeObserver !== "undefined", 11536 layoutShift: !disableAnchorTracking && typeof IntersectionObserver !== "undefined" 11537 }), [disableAnchorTracking]); 11538 const { 11539 refs, 11540 elements, 11541 x: x2, 11542 y: y2, 11543 middlewareData, 11544 update: update2, 11545 placement: renderedPlacement, 11546 context, 11547 isPositioned, 11548 floatingStyles: originalFloatingStyles 11549 } = useFloatingHook({ 11550 rootContext: floatingRootContext, 11551 open: keepMounted ? mounted : void 0, 11552 placement, 11553 middleware, 11554 strategy: positionMethod, 11555 whileElementsMounted: keepMounted ? void 0 : (...args) => autoUpdate(...args, autoUpdateOptions), 11556 nodeId, 11557 externalTree 11558 }); 11559 const { 11560 sideX, 11561 sideY 11562 } = middlewareData.adaptiveOrigin || DEFAULT_SIDES; 11563 const resolvedPosition = isPositioned ? positionMethod : "fixed"; 11564 const floatingStyles = React48.useMemo(() => { 11565 let base; 11566 if (!isPositioned) { 11567 base = { 11568 position: resolvedPosition, 11569 top: 0, 11570 left: 0 11571 }; 11572 } else if (adaptiveOrigin2) { 11573 base = { 11574 position: resolvedPosition, 11575 [sideX]: x2, 11576 [sideY]: y2 11577 }; 11578 } else { 11579 base = { 11580 ...originalFloatingStyles, 11581 position: resolvedPosition 11582 }; 11583 } 11584 base[AVAILABLE_WIDTH_VAR] = "100vw"; 11585 base[AVAILABLE_HEIGHT_VAR] = "100vh"; 11586 if (!isPositioned) { 11587 base.opacity = 0; 11588 } 11589 return base; 11590 }, [adaptiveOrigin2, resolvedPosition, sideX, x2, sideY, y2, originalFloatingStyles, isPositioned]); 11591 const registeredPositionReferenceRef = React48.useRef(null); 11592 useIsoLayoutEffect(() => { 11593 if (!mounted) { 11594 return; 11595 } 11596 const anchorValue = anchorValueRef.current; 11597 const resolvedAnchor = typeof anchorValue === "function" ? anchorValue() : anchorValue; 11598 const unwrappedElement = (isRef(resolvedAnchor) ? resolvedAnchor.current : resolvedAnchor) || null; 11599 const finalAnchor = unwrappedElement || null; 11600 if (finalAnchor !== registeredPositionReferenceRef.current) { 11601 refs.setPositionReference(finalAnchor); 11602 registeredPositionReferenceRef.current = finalAnchor; 11603 } 11604 }, [mounted, refs, anchorDep, anchorValueRef]); 11605 React48.useEffect(() => { 11606 if (!mounted) { 11607 return; 11608 } 11609 const anchorValue = anchorValueRef.current; 11610 if (typeof anchorValue === "function") { 11611 return; 11612 } 11613 if (isRef(anchorValue) && anchorValue.current !== registeredPositionReferenceRef.current) { 11614 refs.setPositionReference(anchorValue.current); 11615 registeredPositionReferenceRef.current = anchorValue.current; 11616 } 11617 }, [mounted, refs, anchorDep, anchorValueRef]); 11618 React48.useEffect(() => { 11619 if (keepMounted && mounted && elements.reference && elements.floating) { 11620 return autoUpdate(elements.reference, elements.floating, update2, autoUpdateOptions); 11621 } 11622 return void 0; 11623 }, [keepMounted, mounted, elements, update2, autoUpdateOptions]); 11624 const renderedSide = getSide(renderedPlacement); 11625 const logicalRenderedSide = getLogicalSide(sideParam, renderedSide, isRtl); 11626 const renderedAlign = getAlignment(renderedPlacement) || "center"; 11627 const anchorHidden2 = Boolean(middlewareData.hide?.referenceHidden); 11628 useIsoLayoutEffect(() => { 11629 if (lazyFlip && mounted && isPositioned && renderedSide !== side) { 11630 setMountSide(renderedSide); 11631 } 11632 }, [lazyFlip, mounted, isPositioned, renderedSide, side]); 11633 const arrowStyles = React48.useMemo(() => ({ 11634 position: "absolute", 11635 top: middlewareData.arrow?.y, 11636 left: middlewareData.arrow?.x 11637 }), [middlewareData.arrow]); 11638 const arrowUncentered = middlewareData.arrow?.centerOffset !== 0; 11639 return React48.useMemo(() => ({ 11640 positionerStyles: floatingStyles, 11641 arrowStyles, 11642 arrowRef, 11643 arrowUncentered, 11644 side: logicalRenderedSide, 11645 align: renderedAlign, 11646 physicalSide: renderedSide, 11647 anchorHidden: anchorHidden2, 11648 refs, 11649 context, 11650 isPositioned, 11651 update: update2 11652 }), [floatingStyles, arrowStyles, arrowRef, arrowUncentered, logicalRenderedSide, renderedAlign, renderedSide, anchorHidden2, refs, context, isPositioned, update2]); 11653 } 11654 function isRef(param) { 11655 return param != null && "current" in param; 11656 } 11657 11658 // node_modules/@base-ui/react/internals/getDisabledMountTransitionStyles.mjs 11659 function getDisabledMountTransitionStyles(transitionStatus) { 11660 return transitionStatus === "starting" ? DISABLED_TRANSITIONS_STYLE : EMPTY_OBJECT; 11661 } 11662 11663 // node_modules/@base-ui/react/utils/usePositioner.mjs 11664 function usePositioner(componentProps, state, { 11665 styles, 11666 transitionStatus, 11667 props, 11668 refs, 11669 hidden, 11670 inert = false 11671 }) { 11672 const style = { 11673 ...styles 11674 }; 11675 if (inert) { 11676 style.pointerEvents = "none"; 11677 } 11678 return useRenderElement("div", componentProps, { 11679 state, 11680 ref: refs, 11681 props: [{ 11682 role: "presentation", 11683 hidden, 11684 style 11685 }, getDisabledMountTransitionStyles(transitionStatus), props], 11686 stateAttributesMapping: popupStateMapping 11687 }); 11688 } 11689 11690 // node_modules/@base-ui/react/utils/useAnchoredPopupScrollLock.mjs 11691 var React49 = __toESM(require_react(), 1); 11692 var VIEWPORT_WIDTH_TOLERANCE_PX = 20; 11693 function useAnchoredPopupScrollLock(enabled, touchOpen, positionerElement, referenceElement) { 11694 const [touchOpenShouldLockScroll, setTouchOpenShouldLockScroll] = React49.useState(false); 11695 useIsoLayoutEffect(() => { 11696 if (!enabled || !touchOpen || positionerElement == null) { 11697 setTouchOpenShouldLockScroll(false); 11698 return; 11699 } 11700 const viewportWidth = ownerDocument(positionerElement).documentElement.clientWidth; 11701 const popupWidth2 = positionerElement.offsetWidth; 11702 setTouchOpenShouldLockScroll(viewportWidth > 0 && popupWidth2 > 0 && popupWidth2 >= viewportWidth - VIEWPORT_WIDTH_TOLERANCE_PX); 11703 }, [enabled, touchOpen, positionerElement]); 11704 useScrollLock(enabled && (!touchOpen || touchOpenShouldLockScroll), referenceElement); 11705 } 11706 11707 // node_modules/@base-ui/react/button/Button.mjs 11708 var React50 = __toESM(require_react(), 1); 11709 var Button = /* @__PURE__ */ React50.forwardRef(function Button2(componentProps, forwardedRef) { 11710 const { 11711 render: render4, 11712 className, 11713 disabled: disabled2 = false, 11714 focusableWhenDisabled = false, 11715 nativeButton = true, 11716 style, 11717 ...elementProps 11718 } = componentProps; 11719 const { 11720 getButtonProps, 11721 buttonRef 11722 } = useButton({ 11723 disabled: disabled2, 11724 focusableWhenDisabled, 11725 native: nativeButton 11726 }); 11727 const state = { 11728 disabled: disabled2 11729 }; 11730 return useRenderElement("button", componentProps, { 11731 state, 11732 ref: [forwardedRef, buttonRef], 11733 props: [elementProps, getButtonProps] 11734 }); 11735 }); 11736 if (true) Button.displayName = "Button"; 11737 11738 // node_modules/@base-ui/react/field/item/FieldItemContext.mjs 11739 var React51 = __toESM(require_react(), 1); 11740 var FieldItemContext = /* @__PURE__ */ React51.createContext({ 11741 disabled: false 11742 }); 11743 if (true) FieldItemContext.displayName = "FieldItemContext"; 11744 function useFieldItemContext() { 11745 const context = React51.useContext(FieldItemContext); 11746 return context; 11747 } 11748 11749 // node_modules/@base-ui/react/field/root/useFieldValidation.mjs 11750 var React52 = __toESM(require_react(), 1); 11751 11752 // node_modules/@base-ui/react/field/utils/getCombinedFieldValidityData.mjs 11753 function getCombinedFieldValidityData(validityData, invalid2) { 11754 return { 11755 ...validityData, 11756 state: { 11757 ...validityData.state, 11758 valid: !invalid2 && validityData.state.valid 11759 } 11760 }; 11761 } 11762 11763 // node_modules/@base-ui/react/field/root/useFieldValidation.mjs 11764 var validityKeys = Object.keys(DEFAULT_VALIDITY_STATE); 11765 function isEligibleInput(input, formElement) { 11766 if (input.matches(":disabled")) { 11767 return false; 11768 } 11769 if (!formElement || input.form === formElement) { 11770 return true; 11771 } 11772 return input.form === null && !input.hasAttribute("form"); 11773 } 11774 function findRepresentativeInput(inputs, formElement) { 11775 let fallback = null; 11776 for (const input of inputs.keys()) { 11777 if (!isEligibleInput(input, formElement)) { 11778 continue; 11779 } 11780 if (!input.validity.valid) { 11781 return input; 11782 } 11783 fallback ??= input; 11784 } 11785 return fallback; 11786 } 11787 function makeState(customError) { 11788 return { 11789 ...DEFAULT_VALIDITY_STATE, 11790 valid: !customError, 11791 customError 11792 }; 11793 } 11794 function getNativeErrors(element) { 11795 return element && element.validationMessage ? [element.validationMessage] : []; 11796 } 11797 function useFieldValidation(params) { 11798 const { 11799 elementRef, 11800 formRef 11801 } = useFormContext(); 11802 const { 11803 setValidityData, 11804 validate, 11805 validityData, 11806 validationDebounceTime, 11807 invalid: invalid2, 11808 markedDirtyRef, 11809 state, 11810 shouldValidateOnChange, 11811 validationMode, 11812 registeredFieldIdRef 11813 } = params; 11814 const { 11815 controlId, 11816 getDescriptionProps 11817 } = useLabelableContext(); 11818 const timeout = useTimeout(); 11819 const inputRef = React52.useRef(null); 11820 const registeredInputs = useRefWithInit(() => /* @__PURE__ */ new Map()).current; 11821 const validationCommitIdRef = React52.useRef(0); 11822 const customValidityRef = React52.useRef(null); 11823 const registerInput = React52.useCallback((element, registration) => { 11824 registeredInputs.set(element, registration); 11825 return () => { 11826 registeredInputs.delete(element); 11827 }; 11828 }, [registeredInputs]); 11829 const getInputControl = useStableCallback(() => { 11830 const element = findRepresentativeInput(registeredInputs, elementRef.current); 11831 return element && registeredInputs.get(element)?.controlRef.current || null; 11832 }); 11833 const commit = useStableCallback(async (value, revalidate = false) => { 11834 validationCommitIdRef.current += 1; 11835 const validationCommitId = validationCommitIdRef.current; 11836 function updateRegisteredFieldValidity(nextValidityData, externalInvalid = invalid2) { 11837 const fieldId = registeredFieldIdRef.current ?? controlId; 11838 if (fieldId == null) { 11839 return; 11840 } 11841 const currentFieldData = formRef.current.fields.get(fieldId); 11842 if (!currentFieldData) { 11843 return; 11844 } 11845 const validityDataWithFormErrors = getCombinedFieldValidityData(nextValidityData, externalInvalid); 11846 formRef.current.fields.set(fieldId, { 11847 ...currentFieldData, 11848 validityData: validityDataWithFormErrors 11849 }); 11850 } 11851 function makeValidityData(validityState, errorMessages) { 11852 const errors = validityState.valid === false ? errorMessages : []; 11853 return { 11854 value, 11855 state: validityState, 11856 error: errors[0] ?? "", 11857 errors, 11858 initialValue: validityData.initialValue 11859 }; 11860 } 11861 function setCustomValidity(element2, message2) { 11862 const displaced = element2.validity.customError ? element2.validationMessage : ""; 11863 const ownedMessage = message2.replace(/\r\n?/g, "\n"); 11864 element2.setCustomValidity(ownedMessage); 11865 customValidityRef.current = [element2, ownedMessage, displaced]; 11866 } 11867 function clearCustomValidity() { 11868 const record = customValidityRef.current; 11869 customValidityRef.current = null; 11870 if (record && (!record[0].willValidate || record[0].validationMessage === record[1])) { 11871 record[0].setCustomValidity(record[2]); 11872 } 11873 } 11874 function publish(validityState, errorMessages, externalInvalid) { 11875 const nextValidityData = makeValidityData(validityState, errorMessages); 11876 updateRegisteredFieldValidity(nextValidityData, externalInvalid); 11877 setValidityData(nextValidityData); 11878 } 11879 function getState(el) { 11880 const computedState = validityKeys.reduce((acc, key) => { 11881 acc[key] = el.validity[key]; 11882 return acc; 11883 }, {}); 11884 let hasOnlyValueMissingError = false; 11885 for (const key of validityKeys) { 11886 if (key === "valid") { 11887 continue; 11888 } 11889 if (key === "valueMissing" && computedState[key]) { 11890 hasOnlyValueMissingError = true; 11891 } else if (computedState[key]) { 11892 return computedState; 11893 } 11894 } 11895 if (hasOnlyValueMissingError && !markedDirtyRef.current) { 11896 computedState.valid = true; 11897 computedState.valueMissing = false; 11898 } 11899 return computedState; 11900 } 11901 function resolveRepresentativeInput() { 11902 return registeredInputs.size > 0 ? findRepresentativeInput(registeredInputs, elementRef.current) : inputRef.current; 11903 } 11904 let element = resolveRepresentativeInput(); 11905 function refreshState() { 11906 element = resolveRepresentativeInput(); 11907 return element?.willValidate ? getState(element) : makeState(false); 11908 } 11909 if (revalidate) { 11910 if (state.valid !== false || !element) { 11911 return; 11912 } 11913 if (!element.validity.valueMissing) { 11914 clearCustomValidity(); 11915 const currentElement = resolveRepresentativeInput(); 11916 const foreign = currentElement?.validity.customError ? getNativeErrors(currentElement) : []; 11917 publish(makeState(foreign.length > 0), foreign, false); 11918 return; 11919 } 11920 for (const key of validityKeys) { 11921 if (key !== "valid" && key !== "valueMissing" && key !== "customError" && element.validity[key]) { 11922 return; 11923 } 11924 } 11925 } 11926 timeout.clear(); 11927 clearCustomValidity(); 11928 let nextState = refreshState(); 11929 let validationErrors = getNativeErrors(element); 11930 const isValidatingOnChange = shouldValidateOnChange(); 11931 if (validationErrors.length === 0 || isValidatingOnChange) { 11932 const formValues = Array.from(formRef.current.fields.values()).reduce((acc, field) => { 11933 if (field.name) { 11934 acc[field.name] = field.getValue(); 11935 } 11936 return acc; 11937 }, {}); 11938 const resultOrPromise = validate(value, formValues); 11939 let result; 11940 if (typeof resultOrPromise === "object" && resultOrPromise !== null && "then" in resultOrPromise) { 11941 if (nextState.valid === false) { 11942 publish(nextState, validationErrors); 11943 } else if (validationMode === "onSubmit" || !validityData.state.customError) { 11944 nextState.valid = null; 11945 publish(nextState, validationErrors); 11946 } 11947 result = await resultOrPromise; 11948 if (validationCommitId !== validationCommitIdRef.current) { 11949 return; 11950 } 11951 nextState = refreshState(); 11952 } else { 11953 result = resultOrPromise; 11954 } 11955 validationErrors = result ? [].concat(result).filter(Boolean) : []; 11956 if (validationErrors.length > 0) { 11957 nextState.valid = false; 11958 nextState.customError = true; 11959 if (element?.willValidate) { 11960 setCustomValidity(element, validationErrors.join("\n")); 11961 } 11962 } else { 11963 validationErrors = getNativeErrors(element); 11964 } 11965 } 11966 publish(nextState, validationErrors); 11967 }); 11968 const change = useStableCallback((value, cancelPending = false) => { 11969 timeout.clear(); 11970 validationCommitIdRef.current += 1; 11971 if (cancelPending) { 11972 return; 11973 } 11974 const validateOnChange = shouldValidateOnChange(); 11975 if (validateOnChange && value !== "" && validationDebounceTime) { 11976 timeout.start(validationDebounceTime, () => { 11977 commit(value); 11978 }); 11979 } else { 11980 commit(value, !validateOnChange); 11981 } 11982 }); 11983 const getValidationProps = React52.useCallback((disabled2, externalProps = {}) => mergeProps(getDescriptionProps(externalProps), state.valid === false && !state.disabled && !disabled2 ? { 11984 "aria-invalid": true 11985 } : EMPTY_OBJECT), [getDescriptionProps, state.disabled, state.valid]); 11986 return React52.useMemo(() => ({ 11987 getValidationProps, 11988 inputRef, 11989 registeredInputs, 11990 registerInput, 11991 getInputControl, 11992 commit, 11993 change 11994 }), [getValidationProps, registeredInputs, registerInput, getInputControl, commit, change]); 11995 } 11996 11997 // node_modules/@base-ui/react/utils/useRegisteredLabelId.mjs 11998 function useRegisteredLabelId(idProp, setLabelId) { 11999 const id = useBaseUiId(idProp); 12000 useIsoLayoutEffect(() => { 12001 setLabelId(id); 12002 return () => { 12003 setLabelId((currentId) => currentId === id ? void 0 : currentId); 12004 }; 12005 }, [id, setLabelId]); 12006 return id; 12007 } 12008 12009 // node_modules/@base-ui/react/internals/labelable-provider/useLabel.mjs 12010 function useLabel(params = {}) { 12011 const { 12012 id: idProp, 12013 fallbackControlId, 12014 native = false, 12015 setLabelId: setLabelIdProp, 12016 focusControl: focusControlProp 12017 } = params; 12018 const { 12019 controlId: contextControlId, 12020 setLabelId: setContextLabelId 12021 } = useLabelableContext(); 12022 const syncLabelId = useStableCallback((nextLabelId) => { 12023 setContextLabelId(nextLabelId); 12024 setLabelIdProp?.(nextLabelId); 12025 }); 12026 const id = useRegisteredLabelId(idProp, syncLabelId); 12027 const resolvedControlId = contextControlId ?? fallbackControlId; 12028 function focusControl(event) { 12029 if (focusControlProp) { 12030 focusControlProp(event, resolvedControlId); 12031 return; 12032 } 12033 if (!resolvedControlId) { 12034 return; 12035 } 12036 const controlElement = ownerDocument(event.currentTarget).getElementById(resolvedControlId); 12037 if (isHTMLElement(controlElement)) { 12038 focusElementWithVisible(controlElement); 12039 } 12040 } 12041 function handleInteraction(event) { 12042 const target = getTarget(event.nativeEvent); 12043 if (target?.closest("button,input,select,textarea")) { 12044 return; 12045 } 12046 if (!event.defaultPrevented && event.detail > 1) { 12047 event.preventDefault(); 12048 } 12049 if (native) { 12050 return; 12051 } 12052 focusControl(event); 12053 } 12054 return native ? { 12055 id, 12056 htmlFor: resolvedControlId, 12057 onMouseDown: handleInteraction 12058 } : { 12059 id, 12060 onClick: handleInteraction, 12061 onPointerDown(event) { 12062 event.preventDefault(); 12063 } 12064 }; 12065 } 12066 function focusElementWithVisible(element) { 12067 element.focus({ 12068 // Available from Chrome 144+ (January 2026). 12069 // Safari and Firefox already support it. 12070 focusVisible: true 12071 }); 12072 } 12073 12074 // node_modules/@base-ui/react/context-menu/root/ContextMenuRootContext.mjs 12075 var React53 = __toESM(require_react(), 1); 12076 var ContextMenuRootContext = /* @__PURE__ */ React53.createContext(void 0); 12077 if (true) ContextMenuRootContext.displayName = "ContextMenuRootContext"; 12078 function useContextMenuRootContext(optional = true) { 12079 const context = React53.useContext(ContextMenuRootContext); 12080 if (context === void 0 && !optional) { 12081 throw new Error(true ? "Base UI: ContextMenuRootContext is missing. ContextMenu parts must be placed within <ContextMenu.Root>." : formatErrorMessage_default(25)); 12082 } 12083 return context; 12084 } 12085 12086 // node_modules/@base-ui/react/menu/index.parts.mjs 12087 var index_parts_exports = {}; 12088 __export(index_parts_exports, { 12089 Arrow: () => MenuArrow, 12090 Backdrop: () => MenuBackdrop, 12091 CheckboxItem: () => MenuCheckboxItem, 12092 CheckboxItemIndicator: () => MenuCheckboxItemIndicator, 12093 Group: () => MenuGroup, 12094 GroupLabel: () => MenuGroupLabel, 12095 Handle: () => MenuHandle, 12096 Item: () => MenuItem, 12097 LinkItem: () => MenuLinkItem, 12098 Popup: () => MenuPopup, 12099 Portal: () => MenuPortal, 12100 Positioner: () => MenuPositioner, 12101 RadioGroup: () => MenuRadioGroup, 12102 RadioItem: () => MenuRadioItem, 12103 RadioItemIndicator: () => MenuRadioItemIndicator, 12104 Root: () => MenuRoot, 12105 Separator: () => Separator, 12106 SubmenuRoot: () => MenuSubmenuRoot, 12107 SubmenuTrigger: () => MenuSubmenuTrigger, 12108 Trigger: () => MenuTrigger, 12109 Viewport: () => MenuViewport, 12110 createHandle: () => createMenuHandle 12111 }); 12112 12113 // node_modules/@base-ui/react/menu/arrow/MenuArrow.mjs 12114 var React56 = __toESM(require_react(), 1); 12115 12116 // node_modules/@base-ui/react/menu/positioner/MenuPositionerContext.mjs 12117 var React54 = __toESM(require_react(), 1); 12118 var MenuPositionerContext = /* @__PURE__ */ React54.createContext(void 0); 12119 if (true) MenuPositionerContext.displayName = "MenuPositionerContext"; 12120 function useMenuPositionerContext(optional) { 12121 const context = React54.useContext(MenuPositionerContext); 12122 if (context === void 0 && !optional) { 12123 throw new Error(true ? "Base UI: MenuPositionerContext is missing. MenuPositioner parts must be placed within <Menu.Positioner>." : formatErrorMessage_default(33)); 12124 } 12125 return context; 12126 } 12127 12128 // node_modules/@base-ui/react/menu/root/MenuRootContext.mjs 12129 var React55 = __toESM(require_react(), 1); 12130 var MenuRootContext = /* @__PURE__ */ React55.createContext(void 0); 12131 if (true) MenuRootContext.displayName = "MenuRootContext"; 12132 function useMenuRootContext(optional) { 12133 const context = React55.useContext(MenuRootContext); 12134 if (context === void 0 && !optional) { 12135 throw new Error(true ? "Base UI: MenuRootContext is missing. Menu parts must be placed within <Menu.Root>." : formatErrorMessage_default(36)); 12136 } 12137 return context; 12138 } 12139 12140 // node_modules/@base-ui/react/menu/arrow/MenuArrow.mjs 12141 var MenuArrow = /* @__PURE__ */ React56.forwardRef(function MenuArrow2(componentProps, forwardedRef) { 12142 const { 12143 render: render4, 12144 className, 12145 style, 12146 ...elementProps 12147 } = componentProps; 12148 const { 12149 store 12150 } = useMenuRootContext(); 12151 const { 12152 arrowRef, 12153 side, 12154 align, 12155 arrowUncentered, 12156 arrowStyles 12157 } = useMenuPositionerContext(); 12158 const open2 = store.useState("open"); 12159 const state = { 12160 open: open2, 12161 side, 12162 align, 12163 uncentered: arrowUncentered 12164 }; 12165 return useRenderElement("div", componentProps, { 12166 ref: [arrowRef, forwardedRef], 12167 stateAttributesMapping: popupStateMapping, 12168 state, 12169 props: { 12170 style: arrowStyles, 12171 "aria-hidden": true, 12172 ...elementProps 12173 } 12174 }); 12175 }); 12176 if (true) MenuArrow.displayName = "MenuArrow"; 12177 12178 // node_modules/@base-ui/react/menu/backdrop/MenuBackdrop.mjs 12179 var React57 = __toESM(require_react(), 1); 12180 var MenuBackdrop = /* @__PURE__ */ React57.forwardRef(function MenuBackdrop2(componentProps, forwardedRef) { 12181 const { 12182 render: render4, 12183 className, 12184 style, 12185 ...elementProps 12186 } = componentProps; 12187 const { 12188 store 12189 } = useMenuRootContext(); 12190 const open2 = store.useState("open"); 12191 const mounted = store.useState("mounted"); 12192 const transitionStatus = store.useState("transitionStatus"); 12193 const lastOpenChangeReason = store.useState("lastOpenChangeReason"); 12194 const contextMenuContext = useContextMenuRootContext(); 12195 const state = { 12196 open: open2, 12197 transitionStatus 12198 }; 12199 return useRenderElement("div", componentProps, { 12200 ref: contextMenuContext?.backdropRef ? [forwardedRef, contextMenuContext.backdropRef] : forwardedRef, 12201 state, 12202 stateAttributesMapping: popupTransitionStateMapping, 12203 props: [{ 12204 role: "presentation", 12205 hidden: !mounted, 12206 style: { 12207 pointerEvents: lastOpenChangeReason === reason_parts_exports.triggerHover ? "none" : void 0, 12208 userSelect: "none", 12209 WebkitUserSelect: "none" 12210 } 12211 }, elementProps] 12212 }); 12213 }); 12214 if (true) MenuBackdrop.displayName = "MenuBackdrop"; 12215 12216 // node_modules/@base-ui/react/menu/checkbox-item/MenuCheckboxItem.mjs 12217 var React61 = __toESM(require_react(), 1); 12218 12219 // node_modules/@base-ui/react/menu/checkbox-item/MenuCheckboxItemContext.mjs 12220 var React58 = __toESM(require_react(), 1); 12221 var MenuCheckboxItemContext = /* @__PURE__ */ React58.createContext(void 0); 12222 if (true) MenuCheckboxItemContext.displayName = "MenuCheckboxItemContext"; 12223 function useMenuCheckboxItemContext() { 12224 const context = React58.useContext(MenuCheckboxItemContext); 12225 if (context === void 0) { 12226 throw new Error(true ? "Base UI: MenuCheckboxItemContext is missing. MenuCheckboxItem parts must be placed within <Menu.CheckboxItem>." : formatErrorMessage_default(30)); 12227 } 12228 return context; 12229 } 12230 12231 // node_modules/@base-ui/react/menu/item/useMenuItem.mjs 12232 var React60 = __toESM(require_react(), 1); 12233 12234 // node_modules/@base-ui/react/menu/item/useMenuItemCommonProps.mjs 12235 var React59 = __toESM(require_react(), 1); 12236 function useMenuItemCommonProps(params) { 12237 const { 12238 closeOnClick, 12239 highlighted, 12240 id, 12241 nodeId, 12242 store, 12243 typingRef, 12244 itemRef, 12245 itemMetadata 12246 } = params; 12247 const { 12248 events: menuEvents 12249 } = store.useState("floatingTreeRoot"); 12250 const open2 = store.useState("open"); 12251 const contextMenuContext = useContextMenuRootContext(true); 12252 const isContextMenu = contextMenuContext !== void 0; 12253 return React59.useMemo(() => ({ 12254 id, 12255 role: "menuitem", 12256 tabIndex: open2 && highlighted ? 0 : -1, 12257 onKeyDown(event) { 12258 if (event.key === " " && typingRef?.current) { 12259 event.preventDefault(); 12260 } 12261 }, 12262 onMouseMove(event) { 12263 if (!nodeId) { 12264 return; 12265 } 12266 menuEvents.emit("itemhover", { 12267 nodeId, 12268 target: event.currentTarget 12269 }); 12270 }, 12271 onClick(event) { 12272 if (closeOnClick) { 12273 menuEvents.emit("close", { 12274 domEvent: event, 12275 reason: reason_parts_exports.itemPress 12276 }); 12277 } 12278 }, 12279 onMouseUp(event) { 12280 if (contextMenuContext) { 12281 const initialCursorPoint = contextMenuContext.initialCursorPointRef.current; 12282 contextMenuContext.initialCursorPointRef.current = null; 12283 if (isContextMenu && initialCursorPoint && Math.abs(event.clientX - initialCursorPoint.x) <= 1 && Math.abs(event.clientY - initialCursorPoint.y) <= 1) { 12284 return; 12285 } 12286 if (isContextMenu && !parts_exports.os.mac && event.button === 2) { 12287 return; 12288 } 12289 } 12290 if (itemRef.current && store.context.allowMouseUpTriggerRef.current && (!isContextMenu || event.button === 2)) { 12291 if (itemMetadata.type === "regular-item") { 12292 dispatchClickWithModifiers(itemRef.current, event, { 12293 detail: 1 12294 }); 12295 } 12296 } 12297 } 12298 }), [closeOnClick, highlighted, id, menuEvents, nodeId, open2, store, typingRef, itemRef, contextMenuContext, isContextMenu, itemMetadata]); 12299 } 12300 12301 // node_modules/@base-ui/react/menu/item/useMenuItem.mjs 12302 var REGULAR_ITEM = { 12303 type: "regular-item" 12304 }; 12305 function useMenuItem(params) { 12306 const { 12307 closeOnClick, 12308 disabled: disabled2, 12309 highlighted, 12310 id, 12311 store, 12312 typingRef = store.context.typingRef, 12313 nativeButton, 12314 itemMetadata, 12315 nodeId 12316 } = params; 12317 const itemRef = React60.useRef(null); 12318 const { 12319 getButtonProps, 12320 buttonRef 12321 } = useButton({ 12322 disabled: disabled2, 12323 focusableWhenDisabled: true, 12324 native: nativeButton, 12325 composite: true 12326 }); 12327 const commonProps = useMenuItemCommonProps({ 12328 closeOnClick, 12329 highlighted, 12330 id, 12331 nodeId, 12332 store, 12333 typingRef, 12334 itemRef, 12335 itemMetadata 12336 }); 12337 const getItemProps = React60.useCallback((externalProps) => { 12338 return mergeProps(commonProps, { 12339 onMouseEnter() { 12340 if (itemMetadata.type !== "submenu-trigger") { 12341 return; 12342 } 12343 itemMetadata.setActive(); 12344 } 12345 }, externalProps, getButtonProps); 12346 }, [commonProps, getButtonProps, itemMetadata]); 12347 const mergedRef = useMergedRefs(itemRef, buttonRef); 12348 return React60.useMemo(() => ({ 12349 getItemProps, 12350 itemRef: mergedRef 12351 }), [getItemProps, mergedRef]); 12352 } 12353 12354 // node_modules/@base-ui/react/menu/checkbox-item/MenuCheckboxItemDataAttributes.mjs 12355 var checked = "data-checked"; 12356 var unchecked = "data-unchecked"; 12357 12358 // node_modules/@base-ui/react/menu/utils/stateAttributesMapping.mjs 12359 var itemMapping = { 12360 checked(value) { 12361 if (value) { 12362 return { 12363 [checked]: "" 12364 }; 12365 } 12366 return { 12367 [unchecked]: "" 12368 }; 12369 }, 12370 ...transitionStatusMapping 12371 }; 12372 12373 // node_modules/@base-ui/react/menu/checkbox-item/MenuCheckboxItem.mjs 12374 var import_jsx_runtime42 = __toESM(require_jsx_runtime(), 1); 12375 var MenuCheckboxItem = /* @__PURE__ */ React61.forwardRef(function MenuCheckboxItem2(componentProps, forwardedRef) { 12376 const { 12377 render: render4, 12378 className, 12379 id: idProp, 12380 label, 12381 nativeButton = false, 12382 disabled: disabledProp = false, 12383 closeOnClick = false, 12384 checked: checkedProp, 12385 defaultChecked, 12386 onCheckedChange, 12387 style, 12388 ...elementProps 12389 } = componentProps; 12390 const listItem = useCompositeListItem({ 12391 guess: true, 12392 label 12393 }); 12394 const menuPositionerContext = useMenuPositionerContext(true); 12395 const id = useBaseUiId(idProp); 12396 const { 12397 store 12398 } = useMenuRootContext(); 12399 const rootDisabled = store.useState("disabled"); 12400 const disabled2 = disabledProp || rootDisabled; 12401 const highlighted = store.useState("isActive", listItem.index); 12402 const itemProps = store.useState("itemProps"); 12403 const [checked2, setChecked] = useControlled({ 12404 controlled: checkedProp, 12405 default: defaultChecked ?? false, 12406 name: "MenuCheckboxItem", 12407 state: "checked" 12408 }); 12409 const { 12410 getItemProps, 12411 itemRef 12412 } = useMenuItem({ 12413 closeOnClick, 12414 disabled: disabled2, 12415 highlighted, 12416 id, 12417 store, 12418 nativeButton, 12419 nodeId: menuPositionerContext?.context.nodeId, 12420 itemMetadata: REGULAR_ITEM 12421 }); 12422 const state = React61.useMemo(() => ({ 12423 disabled: disabled2, 12424 highlighted, 12425 checked: checked2 12426 }), [disabled2, highlighted, checked2]); 12427 function handleClick(event) { 12428 const details = createChangeEventDetails(reason_parts_exports.itemPress, event.nativeEvent, void 0, { 12429 preventUnmountOnClose: NOOP 12430 }); 12431 onCheckedChange?.(!checked2, details); 12432 if (details.isCanceled) { 12433 return; 12434 } 12435 setChecked((currentlyChecked) => !currentlyChecked); 12436 } 12437 const element = useRenderElement("div", componentProps, { 12438 state, 12439 stateAttributesMapping: itemMapping, 12440 props: [itemProps, { 12441 role: "menuitemcheckbox", 12442 "aria-checked": checked2, 12443 onClick: handleClick 12444 }, elementProps, getItemProps], 12445 ref: [itemRef, forwardedRef, listItem.ref] 12446 }); 12447 return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(MenuCheckboxItemContext.Provider, { 12448 value: state, 12449 children: element 12450 }); 12451 }); 12452 if (true) MenuCheckboxItem.displayName = "MenuCheckboxItem"; 12453 12454 // node_modules/@base-ui/react/menu/checkbox-item-indicator/MenuCheckboxItemIndicator.mjs 12455 var React62 = __toESM(require_react(), 1); 12456 var MenuCheckboxItemIndicator = /* @__PURE__ */ React62.forwardRef(function MenuCheckboxItemIndicator2(componentProps, forwardedRef) { 12457 const { 12458 render: render4, 12459 className, 12460 style, 12461 keepMounted = false, 12462 ...elementProps 12463 } = componentProps; 12464 const item = useMenuCheckboxItemContext(); 12465 const indicatorRef = React62.useRef(null); 12466 const { 12467 transitionStatus, 12468 mounted, 12469 setMounted 12470 } = useTransitionStatus(item.checked); 12471 useOpenChangeComplete({ 12472 batch: true, 12473 enabled: !item.checked, 12474 open: item.checked, 12475 ref: indicatorRef, 12476 onComplete() { 12477 if (!item.checked) { 12478 setMounted(false); 12479 } 12480 } 12481 }); 12482 const state = { 12483 checked: item.checked, 12484 disabled: item.disabled, 12485 highlighted: item.highlighted, 12486 transitionStatus 12487 }; 12488 const element = useRenderElement("span", componentProps, { 12489 state, 12490 ref: [forwardedRef, indicatorRef], 12491 stateAttributesMapping: itemMapping, 12492 props: { 12493 "aria-hidden": true, 12494 ...elementProps 12495 }, 12496 enabled: keepMounted || mounted 12497 }); 12498 return element; 12499 }); 12500 if (true) MenuCheckboxItemIndicator.displayName = "MenuCheckboxItemIndicator"; 12501 12502 // node_modules/@base-ui/react/menu/group/MenuGroup.mjs 12503 var React64 = __toESM(require_react(), 1); 12504 12505 // node_modules/@base-ui/react/menu/group/MenuGroupContext.mjs 12506 var React63 = __toESM(require_react(), 1); 12507 var MenuGroupContext = /* @__PURE__ */ React63.createContext(void 0); 12508 if (true) MenuGroupContext.displayName = "MenuGroupContext"; 12509 function useMenuGroupRootContext() { 12510 const context = React63.useContext(MenuGroupContext); 12511 if (context === void 0) { 12512 throw new Error(true ? "Base UI: MenuGroupContext is missing. Menu group parts must be used within <Menu.Group> or <Menu.RadioGroup>." : formatErrorMessage_default(31)); 12513 } 12514 return context; 12515 } 12516 12517 // node_modules/@base-ui/react/menu/group/MenuGroup.mjs 12518 var import_jsx_runtime43 = __toESM(require_jsx_runtime(), 1); 12519 var MenuGroup = /* @__PURE__ */ React64.forwardRef(function MenuGroup2(componentProps, forwardedRef) { 12520 const { 12521 render: render4, 12522 className, 12523 style, 12524 ...elementProps 12525 } = componentProps; 12526 const [labelId, setLabelId] = React64.useState(void 0); 12527 const element = useRenderElement("div", componentProps, { 12528 ref: forwardedRef, 12529 props: { 12530 role: "group", 12531 "aria-labelledby": labelId, 12532 ...elementProps 12533 } 12534 }); 12535 return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(MenuGroupContext.Provider, { 12536 value: setLabelId, 12537 children: element 12538 }); 12539 }); 12540 if (true) MenuGroup.displayName = "MenuGroup"; 12541 12542 // node_modules/@base-ui/react/menu/group-label/MenuGroupLabel.mjs 12543 var React65 = __toESM(require_react(), 1); 12544 var MenuGroupLabel = /* @__PURE__ */ React65.forwardRef(function MenuGroupLabel2(componentProps, forwardedRef) { 12545 const { 12546 render: render4, 12547 className, 12548 style, 12549 id: idProp, 12550 ...elementProps 12551 } = componentProps; 12552 const id = useBaseUiId(idProp); 12553 const setLabelId = useMenuGroupRootContext(); 12554 useIsoLayoutEffect(() => { 12555 setLabelId(id); 12556 return () => { 12557 setLabelId((currentId) => currentId === id ? void 0 : currentId); 12558 }; 12559 }, [setLabelId, id]); 12560 return useRenderElement("div", componentProps, { 12561 ref: forwardedRef, 12562 props: { 12563 id, 12564 "aria-hidden": true, 12565 ...elementProps 12566 } 12567 }); 12568 }); 12569 if (true) MenuGroupLabel.displayName = "MenuGroupLabel"; 12570 12571 // node_modules/@base-ui/react/menu/item/MenuItem.mjs 12572 var React66 = __toESM(require_react(), 1); 12573 var MenuItem = /* @__PURE__ */ React66.forwardRef(function MenuItem2(componentProps, forwardedRef) { 12574 const { 12575 render: render4, 12576 className, 12577 id: idProp, 12578 label, 12579 nativeButton = false, 12580 disabled: disabledProp = false, 12581 closeOnClick = true, 12582 style, 12583 ...elementProps 12584 } = componentProps; 12585 const listItem = useCompositeListItem({ 12586 guess: true, 12587 label 12588 }); 12589 const menuPositionerContext = useMenuPositionerContext(true); 12590 const id = useBaseUiId(idProp); 12591 const { 12592 store 12593 } = useMenuRootContext(); 12594 const rootDisabled = store.useState("disabled"); 12595 const disabled2 = disabledProp || rootDisabled; 12596 const highlighted = store.useState("isActive", listItem.index); 12597 const itemProps = store.useState("itemProps"); 12598 const { 12599 getItemProps, 12600 itemRef 12601 } = useMenuItem({ 12602 closeOnClick, 12603 disabled: disabled2, 12604 highlighted, 12605 id, 12606 store, 12607 nativeButton, 12608 nodeId: menuPositionerContext?.context.nodeId, 12609 itemMetadata: REGULAR_ITEM 12610 }); 12611 const state = { 12612 disabled: disabled2, 12613 highlighted 12614 }; 12615 return useRenderElement("div", componentProps, { 12616 state, 12617 props: [itemProps, elementProps, getItemProps], 12618 ref: [itemRef, forwardedRef, listItem.ref] 12619 }); 12620 }); 12621 if (true) MenuItem.displayName = "MenuItem"; 12622 12623 // node_modules/@base-ui/react/menu/link-item/MenuLinkItem.mjs 12624 var React67 = __toESM(require_react(), 1); 12625 var MenuLinkItem = /* @__PURE__ */ React67.forwardRef(function MenuLinkItem2(componentProps, forwardedRef) { 12626 const { 12627 render: render4, 12628 className, 12629 id: idProp, 12630 label, 12631 closeOnClick = false, 12632 style, 12633 ...elementProps 12634 } = componentProps; 12635 const linkRef = React67.useRef(null); 12636 const listItem = useCompositeListItem({ 12637 guess: true, 12638 label 12639 }); 12640 const menuPositionerContext = useMenuPositionerContext(true); 12641 const nodeId = menuPositionerContext?.context.nodeId; 12642 const id = useBaseUiId(idProp); 12643 const { 12644 store 12645 } = useMenuRootContext(); 12646 const highlighted = store.useState("isActive", listItem.index); 12647 const itemProps = store.useState("itemProps"); 12648 const typingRef = store.context.typingRef; 12649 const { 12650 getButtonProps, 12651 buttonRef 12652 } = useButton({ 12653 native: false, 12654 composite: true 12655 }); 12656 const commonProps = useMenuItemCommonProps({ 12657 closeOnClick, 12658 highlighted, 12659 id, 12660 nodeId, 12661 store, 12662 typingRef, 12663 itemRef: linkRef, 12664 itemMetadata: REGULAR_ITEM 12665 }); 12666 function getItemProps(externalProps) { 12667 return mergeProps(commonProps, externalProps, getButtonProps); 12668 } 12669 const state = { 12670 highlighted 12671 }; 12672 return useRenderElement("a", componentProps, { 12673 state, 12674 props: [itemProps, elementProps, getItemProps], 12675 ref: [linkRef, buttonRef, forwardedRef, listItem.ref] 12676 }); 12677 }); 12678 if (true) MenuLinkItem.displayName = "MenuLinkItem"; 12679 12680 // node_modules/@base-ui/react/menu/popup/MenuPopup.mjs 12681 var React69 = __toESM(require_react(), 1); 12682 12683 // node_modules/@base-ui/react/toolbar/root/ToolbarRootContext.mjs 12684 var React68 = __toESM(require_react(), 1); 12685 var ToolbarRootContext = /* @__PURE__ */ React68.createContext(void 0); 12686 if (true) ToolbarRootContext.displayName = "ToolbarRootContext"; 12687 function useToolbarRootContext(optional) { 12688 const context = React68.useContext(ToolbarRootContext); 12689 if (context === void 0 && !optional) { 12690 throw new Error(true ? "Base UI: ToolbarRootContext is missing. Toolbar parts must be placed within <Toolbar.Root>." : formatErrorMessage_default(69)); 12691 } 12692 return context; 12693 } 12694 12695 // node_modules/@base-ui/react/menu/popup/MenuPopup.mjs 12696 var import_jsx_runtime44 = __toESM(require_jsx_runtime(), 1); 12697 var MenuPopup = /* @__PURE__ */ React69.forwardRef(function MenuPopup2(componentProps, forwardedRef) { 12698 const { 12699 render: render4, 12700 className, 12701 style, 12702 finalFocus, 12703 ...elementProps 12704 } = componentProps; 12705 const { 12706 store 12707 } = useMenuRootContext(); 12708 const { 12709 side, 12710 align 12711 } = useMenuPositionerContext(); 12712 const insideToolbar = useToolbarRootContext(true) != null; 12713 const open2 = store.useState("open"); 12714 const transitionStatus = store.useState("transitionStatus"); 12715 const popupProps = store.useState("popupProps"); 12716 const mounted = store.useState("mounted"); 12717 const instantType = store.useState("instantType"); 12718 const activeTriggerElement = store.useState("activeTriggerElement"); 12719 const parent = store.useState("parent"); 12720 const lastOpenChangeReason = store.useState("lastOpenChangeReason"); 12721 const rootId = store.useState("rootId"); 12722 const floatingContext = store.useState("floatingRootContext"); 12723 const floatingTreeRoot = store.useState("floatingTreeRoot"); 12724 const closeDelay = store.useState("closeDelay"); 12725 const hoverEnabled = store.useState("hoverEnabled"); 12726 const disabled2 = store.useState("disabled"); 12727 const openMethod = store.useState("openMethod"); 12728 const isContextMenu = parent.type === "context-menu"; 12729 useOpenChangeComplete({ 12730 open: open2, 12731 ref: store.context.popupRef, 12732 onComplete() { 12733 if (open2) { 12734 store.context.onOpenChangeComplete?.(true); 12735 } 12736 } 12737 }); 12738 React69.useEffect(() => { 12739 function handleClose(event) { 12740 store.setOpen(false, createChangeEventDetails(event.reason, event.domEvent)); 12741 } 12742 floatingTreeRoot.events.on("close", handleClose); 12743 return () => { 12744 floatingTreeRoot.events.off("close", handleClose); 12745 }; 12746 }, [floatingTreeRoot.events, store]); 12747 useHoverFloatingInteraction(floatingContext, { 12748 enabled: hoverEnabled && !disabled2 && !isContextMenu && parent.type !== "menubar", 12749 closeDelay 12750 }); 12751 const setPopupElement = store.useStateSetter("popupElement"); 12752 const state = { 12753 transitionStatus, 12754 side, 12755 align, 12756 open: open2, 12757 nested: parent.type === "menu", 12758 instant: instantType 12759 }; 12760 const element = useRenderElement("div", componentProps, { 12761 state, 12762 ref: [forwardedRef, store.context.popupRef, setPopupElement], 12763 stateAttributesMapping: popupTransitionStateMapping, 12764 props: [popupProps, { 12765 onKeyDown(event) { 12766 if (insideToolbar && COMPOSITE_KEYS.has(event.key)) { 12767 event.stopPropagation(); 12768 } 12769 } 12770 }, getDisabledMountTransitionStyles(transitionStatus), elementProps, { 12771 "data-rootownerid": rootId 12772 }] 12773 }); 12774 let returnFocus = parent.type === void 0 || isContextMenu; 12775 if (activeTriggerElement || parent.type === "menubar" && lastOpenChangeReason !== reason_parts_exports.outsidePress) { 12776 returnFocus = true; 12777 } 12778 return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(FloatingFocusManager, { 12779 context: floatingContext, 12780 openInteractionType: openMethod, 12781 modal: isContextMenu, 12782 disabled: !mounted, 12783 returnFocus: finalFocus === void 0 ? returnFocus : finalFocus, 12784 initialFocus: parent.type !== "menu", 12785 restoreFocus: true, 12786 externalTree: parent.type !== "menubar" ? floatingTreeRoot : void 0, 12787 previousFocusableElement: activeTriggerElement, 12788 nextFocusableElement: parent.type === void 0 ? store.context.triggerFocusTargetRef : void 0, 12789 beforeContentFocusGuardRef: parent.type === void 0 ? store.context.beforeContentFocusGuardRef : void 0, 12790 children: element 12791 }); 12792 }); 12793 if (true) MenuPopup.displayName = "MenuPopup"; 12794 12795 // node_modules/@base-ui/react/menu/portal/MenuPortal.mjs 12796 var React71 = __toESM(require_react(), 1); 12797 12798 // node_modules/@base-ui/react/menu/portal/MenuPortalContext.mjs 12799 var React70 = __toESM(require_react(), 1); 12800 var MenuPortalContext = /* @__PURE__ */ React70.createContext(void 0); 12801 if (true) MenuPortalContext.displayName = "MenuPortalContext"; 12802 function useMenuPortalContext() { 12803 const value = React70.useContext(MenuPortalContext); 12804 if (value === void 0) { 12805 throw new Error(true ? "Base UI: <Menu.Portal> is missing." : formatErrorMessage_default(32)); 12806 } 12807 return value; 12808 } 12809 12810 // node_modules/@base-ui/react/menu/portal/MenuPortal.mjs 12811 var import_jsx_runtime45 = __toESM(require_jsx_runtime(), 1); 12812 var MenuPortal = /* @__PURE__ */ React71.forwardRef(function MenuPortal2(props, forwardedRef) { 12813 const { 12814 keepMounted = false, 12815 ...portalProps 12816 } = props; 12817 const { 12818 store, 12819 parent 12820 } = useMenuRootContext(); 12821 const mounted = store.useState("mounted"); 12822 const shouldRender = mounted || keepMounted; 12823 if (!shouldRender) { 12824 return null; 12825 } 12826 const portalOwnerRole = parent.type === "menu" || parent.type === "menubar" ? "group" : void 0; 12827 return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(MenuPortalContext.Provider, { 12828 value: keepMounted, 12829 children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(FloatingPortal, { 12830 ref: forwardedRef, 12831 ...portalProps, 12832 portalOwnerRole 12833 }) 12834 }); 12835 }); 12836 if (true) MenuPortal.displayName = "MenuPortal"; 12837 12838 // node_modules/@base-ui/react/menu/positioner/MenuPositioner.mjs 12839 var React72 = __toESM(require_react(), 1); 12840 var import_jsx_runtime46 = __toESM(require_jsx_runtime(), 1); 12841 var MenuPositioner = /* @__PURE__ */ React72.forwardRef(function MenuPositioner2(componentProps, forwardedRef) { 12842 const { 12843 anchor: anchorProp, 12844 positionMethod: positionMethodProp = "absolute", 12845 className, 12846 render: render4, 12847 side, 12848 align: alignProp, 12849 sideOffset: sideOffsetProp = 0, 12850 alignOffset: alignOffsetProp = 0, 12851 collisionBoundary = "clipping-ancestors", 12852 collisionPadding = 5, 12853 arrowPadding = 5, 12854 sticky = false, 12855 disableAnchorTracking = false, 12856 collisionAvoidance: collisionAvoidanceProp = DROPDOWN_COLLISION_AVOIDANCE, 12857 style, 12858 ...elementProps 12859 } = componentProps; 12860 const { 12861 store 12862 } = useMenuRootContext(); 12863 const keepMounted = useMenuPortalContext(); 12864 const contextMenuContext = useContextMenuRootContext(true); 12865 const parent = store.useState("parent"); 12866 const floatingRootContext = store.useState("floatingRootContext"); 12867 const floatingTreeRoot = store.useState("floatingTreeRoot"); 12868 const mounted = store.useState("mounted"); 12869 const open2 = store.useState("open"); 12870 const modal = store.useState("modal"); 12871 const openMethod = store.useState("openMethod"); 12872 const triggerElement = store.useState("activeTriggerElement"); 12873 const transitionStatus = store.useState("transitionStatus"); 12874 const positionerElement = store.useState("positionerElement"); 12875 const instantType = store.useState("instantType"); 12876 const adaptiveOrigin2 = store.useState("adaptiveOrigin"); 12877 const lastOpenChangeReason = store.useState("lastOpenChangeReason"); 12878 const floatingNodeId = store.useState("floatingNodeId"); 12879 const floatingParentNodeId = store.useState("floatingParentNodeId"); 12880 const domReference = floatingRootContext.useState("domReferenceElement"); 12881 const previousTriggerRef = React72.useRef(null); 12882 const runOnceAnimationsFinish = useAnimationsFinished(positionerElement); 12883 let anchor = anchorProp; 12884 let sideOffset = sideOffsetProp; 12885 let alignOffset = alignOffsetProp; 12886 let align = alignProp; 12887 let collisionAvoidance = collisionAvoidanceProp; 12888 if (parent.type === "context-menu") { 12889 anchor = anchorProp ?? parent.context?.anchor; 12890 align = align ?? "start"; 12891 if (!side && align !== "center") { 12892 alignOffset = componentProps.alignOffset ?? 2; 12893 sideOffset = componentProps.sideOffset ?? -5; 12894 } 12895 } 12896 let computedSide = side; 12897 let computedAlign = align; 12898 if (parent.type === "menu") { 12899 computedSide = computedSide ?? "inline-end"; 12900 computedAlign = computedAlign ?? "start"; 12901 collisionAvoidance = componentProps.collisionAvoidance ?? POPUP_COLLISION_AVOIDANCE; 12902 } else if (parent.type === "menubar") { 12903 computedSide = computedSide ?? (parent.context.orientation === "vertical" ? "inline-end" : "bottom"); 12904 computedAlign = computedAlign ?? "start"; 12905 } 12906 const contextMenu = parent.type === "context-menu"; 12907 const positioner = useAnchorPositioning({ 12908 anchor, 12909 floatingRootContext, 12910 positionMethod: contextMenuContext ? "fixed" : positionMethodProp, 12911 mounted, 12912 side: computedSide, 12913 sideOffset, 12914 align: computedAlign, 12915 alignOffset, 12916 arrowPadding: contextMenu ? 0 : arrowPadding, 12917 collisionBoundary, 12918 collisionPadding, 12919 sticky, 12920 nodeId: floatingNodeId, 12921 keepMounted, 12922 disableAnchorTracking, 12923 collisionAvoidance, 12924 shift: contextMenu ? { 12925 crossAxis: !("side" in collisionAvoidance && collisionAvoidance.side === "flip"), 12926 rootBoundary: "layoutViewport" 12927 } : void 0, 12928 externalTree: floatingTreeRoot, 12929 adaptiveOrigin: adaptiveOrigin2 12930 }); 12931 React72.useEffect(() => { 12932 function onMenuOpenChange(details) { 12933 if (details.open) { 12934 if (details.parentNodeId === floatingNodeId) { 12935 store.set("hoverEnabled", false); 12936 } 12937 if (details.nodeId !== floatingNodeId && details.parentNodeId === store.select("floatingParentNodeId")) { 12938 store.setOpen(false, createChangeEventDetails(reason_parts_exports.siblingOpen)); 12939 } 12940 } 12941 } 12942 floatingTreeRoot.events.on("menuopenchange", onMenuOpenChange); 12943 return () => { 12944 floatingTreeRoot.events.off("menuopenchange", onMenuOpenChange); 12945 }; 12946 }, [store, floatingTreeRoot.events, floatingNodeId]); 12947 React72.useEffect(() => { 12948 if (store.select("floatingParentNodeId") == null) { 12949 return void 0; 12950 } 12951 function onParentClose(details) { 12952 if (details.open || details.nodeId !== store.select("floatingParentNodeId")) { 12953 return; 12954 } 12955 const reason = details.reason ?? reason_parts_exports.siblingOpen; 12956 store.setOpen(false, createChangeEventDetails(reason)); 12957 } 12958 floatingTreeRoot.events.on("menuopenchange", onParentClose); 12959 return () => { 12960 floatingTreeRoot.events.off("menuopenchange", onParentClose); 12961 }; 12962 }, [floatingTreeRoot.events, store]); 12963 const closeTimeout = useTimeout(); 12964 React72.useEffect(() => { 12965 if (!open2) { 12966 closeTimeout.clear(); 12967 } 12968 }, [open2, closeTimeout]); 12969 React72.useEffect(() => { 12970 function onItemHover(event) { 12971 if (!open2 || event.nodeId !== store.select("floatingParentNodeId")) { 12972 return; 12973 } 12974 if (event.target && triggerElement && triggerElement !== event.target) { 12975 const delay = store.select("closeDelay"); 12976 if (delay > 0) { 12977 if (!closeTimeout.isStarted()) { 12978 closeTimeout.start(delay, () => { 12979 store.setOpen(false, createChangeEventDetails(reason_parts_exports.siblingOpen)); 12980 }); 12981 } 12982 } else { 12983 store.setOpen(false, createChangeEventDetails(reason_parts_exports.siblingOpen)); 12984 } 12985 } else { 12986 closeTimeout.clear(); 12987 } 12988 } 12989 floatingTreeRoot.events.on("itemhover", onItemHover); 12990 return () => { 12991 floatingTreeRoot.events.off("itemhover", onItemHover); 12992 }; 12993 }, [floatingTreeRoot.events, open2, triggerElement, store, closeTimeout]); 12994 React72.useEffect(() => { 12995 const eventDetails = { 12996 open: open2, 12997 nodeId: floatingNodeId, 12998 parentNodeId: floatingParentNodeId, 12999 reason: store.select("lastOpenChangeReason") 13000 }; 13001 floatingTreeRoot.events.emit("menuopenchange", eventDetails); 13002 }, [floatingTreeRoot.events, open2, store, floatingNodeId, floatingParentNodeId]); 13003 useIsoLayoutEffect(() => { 13004 const currentTrigger = domReference; 13005 const previousTrigger = previousTriggerRef.current; 13006 if (currentTrigger) { 13007 previousTriggerRef.current = currentTrigger; 13008 } 13009 if (previousTrigger && currentTrigger && currentTrigger !== previousTrigger) { 13010 store.set("instantType", void 0); 13011 const abortController = new AbortController(); 13012 runOnceAnimationsFinish(() => { 13013 store.set("instantType", "trigger-change"); 13014 }, abortController.signal); 13015 return () => { 13016 abortController.abort(); 13017 }; 13018 } 13019 return void 0; 13020 }, [domReference, runOnceAnimationsFinish, store]); 13021 const state = { 13022 open: open2, 13023 side: positioner.side, 13024 align: positioner.align, 13025 anchorHidden: positioner.anchorHidden, 13026 nested: parent.type === "menu", 13027 instant: instantType 13028 }; 13029 const menubarModal = parent.type === "menubar" && parent.context.modal; 13030 const popupModal = modal && lastOpenChangeReason !== reason_parts_exports.triggerHover; 13031 useAnchoredPopupScrollLock(open2 && (menubarModal || popupModal), openMethod === "touch", positionerElement, triggerElement); 13032 const element = usePositioner(componentProps, state, { 13033 styles: positioner.positionerStyles, 13034 transitionStatus, 13035 props: elementProps, 13036 refs: [forwardedRef, store.useStateSetter("positionerElement")], 13037 hidden: !mounted, 13038 inert: !open2 13039 }); 13040 const shouldRenderBackdrop = mounted && parent.type !== "menu" && (parent.type !== "menubar" && modal && lastOpenChangeReason !== reason_parts_exports.triggerHover || parent.type === "menubar" && parent.context.modal); 13041 let backdropCutout = null; 13042 if (parent.type === "menubar") { 13043 backdropCutout = parent.context.contentElement; 13044 } else if (parent.type === void 0) { 13045 backdropCutout = triggerElement; 13046 } 13047 return /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(MenuPositionerContext.Provider, { 13048 value: positioner, 13049 children: [shouldRenderBackdrop && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(InternalBackdrop, { 13050 ref: parent.type === "context-menu" || parent.type === "nested-context-menu" ? parent.context.internalBackdropRef : null, 13051 inert: inertValue(!open2), 13052 cutout: backdropCutout 13053 }), /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(FloatingNode, { 13054 id: floatingNodeId, 13055 children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(CompositeList, { 13056 elementsRef: store.context.itemDomElements, 13057 labelsRef: store.context.itemLabels, 13058 children: element 13059 }) 13060 })] 13061 }); 13062 }); 13063 if (true) MenuPositioner.displayName = "MenuPositioner"; 13064 13065 // node_modules/@base-ui/react/menu/radio-group/MenuRadioGroup.mjs 13066 var React74 = __toESM(require_react(), 1); 13067 13068 // node_modules/@base-ui/react/menu/radio-group/MenuRadioGroupContext.mjs 13069 var React73 = __toESM(require_react(), 1); 13070 var MenuRadioGroupContext = /* @__PURE__ */ React73.createContext(void 0); 13071 if (true) MenuRadioGroupContext.displayName = "MenuRadioGroupContext"; 13072 function useMenuRadioGroupContext() { 13073 const context = React73.useContext(MenuRadioGroupContext); 13074 if (context === void 0) { 13075 throw new Error(true ? "Base UI: MenuRadioGroupContext is missing. MenuRadioGroup parts must be placed within <Menu.RadioGroup>." : formatErrorMessage_default(34)); 13076 } 13077 return context; 13078 } 13079 13080 // node_modules/@base-ui/react/menu/radio-group/MenuRadioGroup.mjs 13081 var import_jsx_runtime47 = __toESM(require_jsx_runtime(), 1); 13082 var MenuRadioGroup = /* @__PURE__ */ React74.memo(/* @__PURE__ */ React74.forwardRef(function MenuRadioGroup2(componentProps, forwardedRef) { 13083 const { 13084 render: render4, 13085 className, 13086 value: valueProp, 13087 defaultValue: defaultValue2, 13088 onValueChange: onValueChangeProp, 13089 disabled: disabled2 = false, 13090 style, 13091 "aria-labelledby": ariaLabelledByProp, 13092 ...elementProps 13093 } = componentProps; 13094 const [labelId, setLabelId] = React74.useState(void 0); 13095 const [value, setValueUnwrapped] = useControlled({ 13096 controlled: valueProp, 13097 default: defaultValue2, 13098 name: "MenuRadioGroup" 13099 }); 13100 const setValue = useStableCallback((newValue, eventDetails) => { 13101 onValueChangeProp?.(newValue, eventDetails); 13102 if (eventDetails.isCanceled) { 13103 return; 13104 } 13105 setValueUnwrapped(newValue); 13106 }); 13107 const state = { 13108 disabled: disabled2 13109 }; 13110 const element = useRenderElement("div", componentProps, { 13111 state, 13112 ref: forwardedRef, 13113 props: { 13114 role: "group", 13115 "aria-labelledby": ariaLabelledByProp ?? labelId, 13116 "aria-disabled": disabled2 || void 0, 13117 ...elementProps 13118 } 13119 }); 13120 const context = React74.useMemo(() => ({ 13121 value, 13122 setValue, 13123 disabled: disabled2 13124 }), [value, setValue, disabled2]); 13125 return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(MenuGroupContext.Provider, { 13126 value: setLabelId, 13127 children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(MenuRadioGroupContext.Provider, { 13128 value: context, 13129 children: element 13130 }) 13131 }); 13132 })); 13133 if (true) MenuRadioGroup.displayName = "MenuRadioGroup"; 13134 13135 // node_modules/@base-ui/react/menu/radio-item/MenuRadioItem.mjs 13136 var React76 = __toESM(require_react(), 1); 13137 13138 // node_modules/@base-ui/react/menu/radio-item/MenuRadioItemContext.mjs 13139 var React75 = __toESM(require_react(), 1); 13140 var MenuRadioItemContext = /* @__PURE__ */ React75.createContext(void 0); 13141 if (true) MenuRadioItemContext.displayName = "MenuRadioItemContext"; 13142 function useMenuRadioItemContext() { 13143 const context = React75.useContext(MenuRadioItemContext); 13144 if (context === void 0) { 13145 throw new Error(true ? "Base UI: MenuRadioItemContext is missing. MenuRadioItem parts must be placed within <Menu.RadioItem>." : formatErrorMessage_default(35)); 13146 } 13147 return context; 13148 } 13149 13150 // node_modules/@base-ui/react/menu/radio-item/MenuRadioItem.mjs 13151 var import_jsx_runtime48 = __toESM(require_jsx_runtime(), 1); 13152 var MenuRadioItem = /* @__PURE__ */ React76.forwardRef(function MenuRadioItem2(componentProps, forwardedRef) { 13153 const { 13154 render: render4, 13155 className, 13156 id: idProp, 13157 label, 13158 nativeButton = false, 13159 disabled: disabledProp = false, 13160 closeOnClick = false, 13161 value, 13162 style, 13163 ...elementProps 13164 } = componentProps; 13165 const listItem = useCompositeListItem({ 13166 guess: true, 13167 label 13168 }); 13169 const menuPositionerContext = useMenuPositionerContext(true); 13170 const id = useBaseUiId(idProp); 13171 const { 13172 store 13173 } = useMenuRootContext(); 13174 const highlighted = store.useState("isActive", listItem.index); 13175 const itemProps = store.useState("itemProps"); 13176 const { 13177 value: selectedValue, 13178 setValue: setSelectedValue, 13179 disabled: groupDisabled 13180 } = useMenuRadioGroupContext(); 13181 const rootDisabled = store.useState("disabled"); 13182 const disabled2 = disabledProp || groupDisabled || rootDisabled; 13183 const checked2 = selectedValue === value; 13184 const { 13185 getItemProps, 13186 itemRef 13187 } = useMenuItem({ 13188 closeOnClick, 13189 disabled: disabled2, 13190 highlighted, 13191 id, 13192 store, 13193 nativeButton, 13194 nodeId: menuPositionerContext?.context.nodeId, 13195 itemMetadata: REGULAR_ITEM 13196 }); 13197 const state = React76.useMemo(() => ({ 13198 disabled: disabled2, 13199 highlighted, 13200 checked: checked2 13201 }), [disabled2, highlighted, checked2]); 13202 function handleClick(event) { 13203 const details = createChangeEventDetails(reason_parts_exports.itemPress, event.nativeEvent, void 0, { 13204 preventUnmountOnClose: NOOP 13205 }); 13206 setSelectedValue(value, details); 13207 } 13208 const element = useRenderElement("div", componentProps, { 13209 state, 13210 stateAttributesMapping: itemMapping, 13211 props: [itemProps, { 13212 role: "menuitemradio", 13213 "aria-checked": checked2, 13214 onClick: handleClick 13215 }, elementProps, getItemProps], 13216 ref: [itemRef, forwardedRef, listItem.ref] 13217 }); 13218 return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(MenuRadioItemContext.Provider, { 13219 value: state, 13220 children: element 13221 }); 13222 }); 13223 if (true) MenuRadioItem.displayName = "MenuRadioItem"; 13224 13225 // node_modules/@base-ui/react/menu/radio-item-indicator/MenuRadioItemIndicator.mjs 13226 var React77 = __toESM(require_react(), 1); 13227 var MenuRadioItemIndicator = /* @__PURE__ */ React77.forwardRef(function MenuRadioItemIndicator2(componentProps, forwardedRef) { 13228 const { 13229 render: render4, 13230 className, 13231 style, 13232 keepMounted = false, 13233 ...elementProps 13234 } = componentProps; 13235 const item = useMenuRadioItemContext(); 13236 const indicatorRef = React77.useRef(null); 13237 const { 13238 transitionStatus, 13239 mounted, 13240 setMounted 13241 } = useTransitionStatus(item.checked); 13242 useOpenChangeComplete({ 13243 batch: true, 13244 enabled: !item.checked, 13245 open: item.checked, 13246 ref: indicatorRef, 13247 onComplete() { 13248 if (!item.checked) { 13249 setMounted(false); 13250 } 13251 } 13252 }); 13253 const state = { 13254 checked: item.checked, 13255 disabled: item.disabled, 13256 highlighted: item.highlighted, 13257 transitionStatus 13258 }; 13259 const element = useRenderElement("span", componentProps, { 13260 state, 13261 stateAttributesMapping: itemMapping, 13262 ref: [forwardedRef, indicatorRef], 13263 props: { 13264 "aria-hidden": true, 13265 ...elementProps 13266 }, 13267 enabled: keepMounted || mounted 13268 }); 13269 return element; 13270 }); 13271 if (true) MenuRadioItemIndicator.displayName = "MenuRadioItemIndicator"; 13272 13273 // node_modules/@base-ui/react/menu/root/MenuRoot.mjs 13274 var React81 = __toESM(require_react(), 1); 13275 13276 // node_modules/@base-ui/react/menubar/MenubarContext.mjs 13277 var React78 = __toESM(require_react(), 1); 13278 var MenubarContext = /* @__PURE__ */ React78.createContext(null); 13279 if (true) MenubarContext.displayName = "MenubarContext"; 13280 function useMenubarContext(optional) { 13281 const context = React78.useContext(MenubarContext); 13282 if (context === null && !optional) { 13283 throw new Error(true ? "Base UI: MenubarContext is missing. Menubar parts must be placed within <Menubar>." : formatErrorMessage_default(5)); 13284 } 13285 return context; 13286 } 13287 13288 // node_modules/@base-ui/react/menu/store/MenuStore.mjs 13289 var React79 = __toESM(require_react(), 1); 13290 var selectors2 = { 13291 ...popupStoreSelectors, 13292 disabled: (state) => state.parent.type === "menubar" ? state.parent.context.disabled || state.disabled : state.disabled, 13293 modal: (state) => (state.parent.type === void 0 || state.parent.type === "context-menu") && (state.modal ?? true), 13294 openMethod: (state) => state.openMethod, 13295 allowMouseEnter: (state) => state.allowMouseEnter, 13296 highlightItemOnHover: (state) => state.highlightItemOnHover, 13297 parent: (state) => state.parent, 13298 rootId: (state) => { 13299 if (state.parent.type === "menu") { 13300 return state.parent.store.select("rootId"); 13301 } 13302 return state.parent.type !== void 0 ? state.parent.context.rootId : state.rootId; 13303 }, 13304 activeIndex: (state) => state.activeIndex, 13305 isActive: (state, itemIndex) => state.activeIndex === itemIndex, 13306 hoverEnabled: (state) => state.hoverEnabled, 13307 instantType: (state) => state.instantType, 13308 lastOpenChangeReason: (state) => state.openChangeReason, 13309 floatingTreeRoot: (state) => { 13310 if (state.parent.type === "menu") { 13311 return state.parent.store.select("floatingTreeRoot"); 13312 } 13313 return state.floatingTreeRoot; 13314 }, 13315 floatingNodeId: (state) => state.floatingNodeId, 13316 floatingParentNodeId: (state) => state.floatingParentNodeId, 13317 itemProps: (state) => state.itemProps, 13318 closeDelay: (state) => state.closeDelay, 13319 adaptiveOrigin: (state) => state.adaptiveOrigin, 13320 keyboardEventRelay: (state) => { 13321 if (state.keyboardEventRelay) { 13322 return state.keyboardEventRelay; 13323 } 13324 if (state.parent.type === "menu") { 13325 return state.parent.store.select("keyboardEventRelay"); 13326 } 13327 return void 0; 13328 } 13329 }; 13330 var MenuStore = class extends ReactStore { 13331 constructor(initialState, floatingId, nested = false) { 13332 const triggerElements = new PopupTriggerMap(); 13333 const state = createInitialState(triggerElements, floatingId, nested, initialState); 13334 super(state, createInitialContext(triggerElements), selectors2); 13335 this.unsubscribeParentListener = this.observe("parent", (parent) => { 13336 this.unsubscribeParentListener?.(); 13337 if (parent.type === "menu") { 13338 let rootId = parent.store.select("rootId"); 13339 let floatingTreeRoot = parent.store.select("floatingTreeRoot"); 13340 let keyboardEventRelay = parent.store.select("keyboardEventRelay"); 13341 this.unsubscribeParentListener = parent.store.subscribe(() => { 13342 const nextRootId = parent.store.select("rootId"); 13343 const nextFloatingTreeRoot = parent.store.select("floatingTreeRoot"); 13344 const nextKeyboardEventRelay = parent.store.select("keyboardEventRelay"); 13345 if (rootId === nextRootId && floatingTreeRoot === nextFloatingTreeRoot && keyboardEventRelay === nextKeyboardEventRelay) { 13346 return; 13347 } 13348 rootId = nextRootId; 13349 floatingTreeRoot = nextFloatingTreeRoot; 13350 keyboardEventRelay = nextKeyboardEventRelay; 13351 this.notifyAll(); 13352 }); 13353 this.context.allowMouseUpTriggerRef = parent.store.context.allowMouseUpTriggerRef; 13354 return; 13355 } 13356 if (parent.type !== void 0) { 13357 this.context.allowMouseUpTriggerRef = parent.context.allowMouseUpTriggerRef; 13358 } 13359 this.unsubscribeParentListener = null; 13360 }); 13361 } 13362 setOpen(open2, eventDetails) { 13363 this.state.floatingRootContext.context.events.emit("setOpen", { 13364 open: open2, 13365 eventDetails 13366 }); 13367 } 13368 unsubscribeParentListener = null; 13369 }; 13370 function createNullMenuStore() { 13371 const triggerElements = new PopupTriggerMap(); 13372 const store = new NullStore(Object.freeze(createInitialState(triggerElements)), Object.freeze(createInitialContext(triggerElements)), selectors2); 13373 return Object.assign(store, { 13374 setOpen: NOOP 13375 }); 13376 } 13377 function createInitialContext(triggerElements) { 13378 return { 13379 positionerRef: /* @__PURE__ */ React79.createRef(), 13380 popupRef: /* @__PURE__ */ React79.createRef(), 13381 typingRef: { 13382 current: false 13383 }, 13384 itemDomElements: { 13385 current: [] 13386 }, 13387 itemLabels: { 13388 current: [] 13389 }, 13390 allowMouseUpTriggerRef: { 13391 current: false 13392 }, 13393 triggerFocusTargetRef: /* @__PURE__ */ React79.createRef(), 13394 beforeContentFocusGuardRef: /* @__PURE__ */ React79.createRef(), 13395 onOpenChangeComplete: void 0, 13396 triggerElements 13397 }; 13398 } 13399 function createInitialState(triggerElements, floatingId, nested = false, initialState) { 13400 return { 13401 ...createInitialPopupStoreState(triggerElements, floatingId, nested), 13402 disabled: false, 13403 modal: true, 13404 openMethod: null, 13405 allowMouseEnter: false, 13406 highlightItemOnHover: true, 13407 parent: { 13408 type: void 0 13409 }, 13410 rootId: void 0, 13411 activeIndex: null, 13412 hoverEnabled: true, 13413 instantType: void 0, 13414 openChangeReason: null, 13415 floatingTreeRoot: new FloatingTreeStore(), 13416 floatingNodeId: void 0, 13417 floatingParentNodeId: null, 13418 itemProps: EMPTY_OBJECT, 13419 keyboardEventRelay: void 0, 13420 closeDelay: 0, 13421 adaptiveOrigin: void 0, 13422 ...initialState 13423 }; 13424 } 13425 13426 // node_modules/@base-ui/react/menu/submenu-root/MenuSubmenuRootContext.mjs 13427 var React80 = __toESM(require_react(), 1); 13428 var MenuSubmenuRootContext = /* @__PURE__ */ React80.createContext(void 0); 13429 if (true) MenuSubmenuRootContext.displayName = "MenuSubmenuRootContext"; 13430 function useMenuSubmenuRootContext() { 13431 return React80.useContext(MenuSubmenuRootContext); 13432 } 13433 13434 // node_modules/@base-ui/react/menu/root/MenuRoot.mjs 13435 var import_jsx_runtime49 = __toESM(require_jsx_runtime(), 1); 13436 var MenuRoot = fastComponent(function MenuRoot2(props) { 13437 const { 13438 children, 13439 open: openProp, 13440 onOpenChange, 13441 onOpenChangeComplete, 13442 defaultOpen = false, 13443 disabled: disabledProp = false, 13444 modal: modalProp, 13445 loopFocus = true, 13446 orientation = "vertical", 13447 actionsRef, 13448 closeParentOnEsc = false, 13449 handle, 13450 triggerId: triggerIdProp, 13451 defaultTriggerId: defaultTriggerIdProp = null, 13452 highlightItemOnHover = true 13453 } = props; 13454 const contextMenuContext = useContextMenuRootContext(true); 13455 const parentMenuRootContext = useMenuRootContext(true); 13456 const menubarContext = useMenubarContext(true); 13457 const isSubmenu = useMenuSubmenuRootContext(); 13458 const parentFromContext = React81.useMemo(() => { 13459 if (isSubmenu && parentMenuRootContext) { 13460 return { 13461 type: "menu", 13462 store: parentMenuRootContext.store 13463 }; 13464 } 13465 if (menubarContext) { 13466 return { 13467 type: "menubar", 13468 context: menubarContext 13469 }; 13470 } 13471 if (contextMenuContext && !parentMenuRootContext) { 13472 return { 13473 type: "context-menu", 13474 context: contextMenuContext 13475 }; 13476 } 13477 return { 13478 type: void 0 13479 }; 13480 }, [contextMenuContext, parentMenuRootContext, menubarContext, isSubmenu]); 13481 const rootId = useId(); 13482 const floatingId = useId(); 13483 const floatingParentNodeIdFromContext = useFloatingParentNodeId(); 13484 const parentMenuStore = parentFromContext.type === "menu" ? parentFromContext.store : void 0; 13485 const animateInitialOpen = (openProp ?? defaultOpen) && parentMenuStore?.state.transitionStatus === "starting"; 13486 const seededInstantType = useRefWithInit(() => animateInitialOpen ? parentMenuStore?.state.instantType : void 0).current; 13487 const store = useMenuRootStore({ 13488 open: defaultOpen, 13489 openProp, 13490 activeTriggerId: defaultTriggerIdProp, 13491 triggerIdProp, 13492 parent: parentFromContext, 13493 disabled: disabledProp, 13494 highlightItemOnHover, 13495 modal: parentFromContext.type === void 0 ? modalProp : void 0, 13496 rootId, 13497 instantType: seededInstantType 13498 }, floatingId, floatingParentNodeIdFromContext != null); 13499 store.useControlledProp("openProp", openProp); 13500 store.useControlledProp("triggerIdProp", triggerIdProp); 13501 store.useContextCallback("onOpenChangeComplete", onOpenChangeComplete); 13502 const floatingTreeRoot = store.useState("floatingTreeRoot"); 13503 const floatingNodeIdFromContext = useFloatingNodeId(floatingTreeRoot); 13504 const open2 = store.useState("open"); 13505 const activeTriggerElement = store.useState("activeTriggerElement"); 13506 const positionerElement = store.useState("positionerElement"); 13507 const hoverEnabled = store.useState("hoverEnabled"); 13508 const disabled2 = store.useState("disabled"); 13509 const lastOpenChangeReason = store.useState("lastOpenChangeReason"); 13510 const parent = store.useState("parent"); 13511 const activeIndex = store.useState("activeIndex"); 13512 const payload = store.useState("payload"); 13513 const floatingParentNodeId = store.useState("floatingParentNodeId"); 13514 const openEventRef = React81.useRef(null); 13515 const allowOutsidePressDismissalRef = React81.useRef(parent.type !== "context-menu"); 13516 const allowOutsidePressDismissalTimeout = useTimeout(); 13517 const allowTouchToCloseRef = React81.useRef(true); 13518 const allowTouchToCloseTimeout = useTimeout(); 13519 const nested = floatingParentNodeId != null; 13520 if (true) { 13521 if (parent.type !== void 0 && modalProp !== void 0) { 13522 console.warn("Base UI: The `modal` prop is not supported on nested menus. It will be ignored."); 13523 } 13524 } 13525 const { 13526 openMethod, 13527 triggerProps: interactionTypeProps 13528 } = useOpenInteractionType(open2); 13529 store.useSyncedValues({ 13530 disabled: disabledProp, 13531 highlightItemOnHover, 13532 modal: parent.type === void 0 ? modalProp : void 0, 13533 openMethod, 13534 rootId 13535 }); 13536 useImplicitActiveTrigger(store); 13537 const { 13538 forceUnmount, 13539 transitionStatus 13540 } = useOpenStateTransitions(open2, store, () => { 13541 store.set("allowMouseEnter", false); 13542 }, animateInitialOpen); 13543 const runOnceAnimationsFinish = useAnimationsFinished(store.context.popupRef); 13544 React81.useEffect(() => { 13545 if (seededInstantType === void 0) { 13546 return void 0; 13547 } 13548 const clearSeededInstantType = () => { 13549 if (store.state.instantType === seededInstantType) { 13550 store.set("instantType", void 0); 13551 } 13552 }; 13553 if (!open2) { 13554 clearSeededInstantType(); 13555 return void 0; 13556 } 13557 if (transitionStatus !== void 0) { 13558 return void 0; 13559 } 13560 if (store.context.popupRef.current == null) { 13561 clearSeededInstantType(); 13562 return void 0; 13563 } 13564 const abortController = new AbortController(); 13565 runOnceAnimationsFinish(clearSeededInstantType, abortController.signal); 13566 return () => { 13567 abortController.abort(); 13568 }; 13569 }, [seededInstantType, open2, transitionStatus, runOnceAnimationsFinish, store]); 13570 useIsoLayoutEffect(() => { 13571 if (contextMenuContext && !parentMenuRootContext) { 13572 store.update({ 13573 parent: { 13574 type: "context-menu", 13575 context: contextMenuContext 13576 }, 13577 floatingNodeId: floatingNodeIdFromContext, 13578 floatingParentNodeId: floatingParentNodeIdFromContext 13579 }); 13580 } else if (parentMenuRootContext) { 13581 store.update({ 13582 floatingNodeId: floatingNodeIdFromContext, 13583 floatingParentNodeId: floatingParentNodeIdFromContext 13584 }); 13585 } 13586 }, [contextMenuContext, parentMenuRootContext, floatingNodeIdFromContext, floatingParentNodeIdFromContext, store]); 13587 React81.useEffect(() => { 13588 if (!open2) { 13589 openEventRef.current = null; 13590 } 13591 if (parent.type !== "context-menu") { 13592 return; 13593 } 13594 if (!open2) { 13595 allowOutsidePressDismissalTimeout.clear(); 13596 allowOutsidePressDismissalRef.current = false; 13597 return; 13598 } 13599 allowOutsidePressDismissalTimeout.start(500, () => { 13600 allowOutsidePressDismissalRef.current = true; 13601 }); 13602 }, [allowOutsidePressDismissalTimeout, open2, parent.type]); 13603 useIsoLayoutEffect(() => { 13604 if (!open2 && !hoverEnabled) { 13605 store.set("hoverEnabled", true); 13606 } 13607 }, [open2, hoverEnabled, store]); 13608 const setOpen = useStableCallback((nextOpen, eventDetails) => { 13609 const reason = eventDetails.reason; 13610 if (!nextOpen && !store.select("open")) { 13611 return; 13612 } 13613 if (open2 === nextOpen && eventDetails.trigger === activeTriggerElement && lastOpenChangeReason === reason) { 13614 return; 13615 } 13616 const shouldPreventUnmountOnClose = attachPreventUnmountOnClose(eventDetails); 13617 if (!nextOpen && eventDetails.trigger == null) { 13618 eventDetails.trigger = activeTriggerElement ?? void 0; 13619 } 13620 onOpenChange?.(nextOpen, eventDetails); 13621 if (eventDetails.isCanceled) { 13622 return; 13623 } 13624 store.state.floatingRootContext.dispatchOpenChange(nextOpen, eventDetails); 13625 const nativeEvent = eventDetails.event; 13626 if (nextOpen === false && nativeEvent?.type === "click" && nativeEvent.pointerType === "touch" && !allowTouchToCloseRef.current) { 13627 return; 13628 } 13629 if (nextOpen && reason === reason_parts_exports.triggerFocus) { 13630 allowTouchToCloseRef.current = false; 13631 allowTouchToCloseTimeout.start(300, () => { 13632 allowTouchToCloseRef.current = true; 13633 }); 13634 } else { 13635 allowTouchToCloseRef.current = true; 13636 allowTouchToCloseTimeout.clear(); 13637 } 13638 const isKeyboardClick = (reason === reason_parts_exports.triggerPress || reason === reason_parts_exports.itemPress) && nativeEvent.detail === 0; 13639 const isDismissClose = !nextOpen && (reason === reason_parts_exports.escapeKey || reason == null); 13640 openEventRef.current = eventDetails.event; 13641 const popupOpenState = createPopupOpenState(store.state, nextOpen, eventDetails.trigger, shouldPreventUnmountOnClose()); 13642 popupOpenState.openChangeReason = reason; 13643 if (parent.type === "menubar" && (reason === reason_parts_exports.triggerFocus || reason === reason_parts_exports.focusOut || reason === reason_parts_exports.triggerHover || reason === reason_parts_exports.listNavigation || reason === reason_parts_exports.siblingOpen)) { 13644 popupOpenState.instantType = "group"; 13645 } else if (isKeyboardClick || isDismissClose) { 13646 popupOpenState.instantType = isKeyboardClick ? "click" : "dismiss"; 13647 } else { 13648 popupOpenState.instantType = void 0; 13649 } 13650 store.update(popupOpenState); 13651 }); 13652 const floatingRootContext = useSyncedFloatingRootContext({ 13653 popupStore: store, 13654 floatingRootContext: store.state.floatingRootContext, 13655 floatingId, 13656 nested: floatingParentNodeIdFromContext != null, 13657 onOpenChange: setOpen 13658 }); 13659 const floatingEvents = floatingRootContext.context.events; 13660 useIsoLayoutEffect(() => { 13661 const handleSetOpenEvent = ({ 13662 open: nextOpen, 13663 eventDetails 13664 }) => setOpen(nextOpen, eventDetails); 13665 floatingEvents.on("setOpen", handleSetOpenEvent); 13666 return () => { 13667 floatingEvents?.off("setOpen", handleSetOpenEvent); 13668 }; 13669 }, [floatingEvents, setOpen]); 13670 const handleImperativeClose = React81.useCallback(() => { 13671 store.setOpen(false, createChangeEventDetails(reason_parts_exports.imperativeAction)); 13672 }, [store]); 13673 React81.useImperativeHandle(actionsRef, () => ({ 13674 unmount: forceUnmount, 13675 close: handleImperativeClose 13676 }), [forceUnmount, handleImperativeClose]); 13677 let ctx8; 13678 if (parent.type === "context-menu") { 13679 ctx8 = parent.context; 13680 } 13681 React81.useImperativeHandle(ctx8?.positionerRef, () => positionerElement, [positionerElement]); 13682 React81.useImperativeHandle(ctx8?.actionsRef, () => ({ 13683 setOpen 13684 }), [setOpen]); 13685 const dismiss = useDismiss(floatingRootContext, { 13686 enabled: !disabled2, 13687 bubbles: { 13688 escapeKey: closeParentOnEsc && parent.type === "menu" 13689 }, 13690 outsidePress() { 13691 if (parent.type !== "context-menu" || openEventRef.current?.type === "contextmenu") { 13692 return true; 13693 } 13694 return allowOutsidePressDismissalRef.current; 13695 }, 13696 externalTree: nested ? floatingTreeRoot : void 0 13697 }); 13698 const direction = useDirection(); 13699 const setActiveIndex = React81.useCallback((index2) => { 13700 if (store.select("activeIndex") === index2) { 13701 return; 13702 } 13703 store.set("activeIndex", index2); 13704 }, [store]); 13705 const listNavigation2 = useListNavigation(floatingRootContext, { 13706 enabled: !disabled2, 13707 listRef: store.context.itemDomElements, 13708 activeIndex, 13709 nested: parent.type !== void 0, 13710 loopFocus, 13711 orientation, 13712 parentOrientation: parent.type === "menubar" ? parent.context.orientation : void 0, 13713 rtl: direction === "rtl", 13714 disabledIndices: EMPTY_ARRAY, 13715 onNavigate: setActiveIndex, 13716 openOnArrowKeyDown: parent.type !== "context-menu", 13717 externalTree: nested ? floatingTreeRoot : void 0, 13718 focusItemOnHover: highlightItemOnHover 13719 }); 13720 const onTyping = React81.useCallback((nextTyping) => { 13721 store.context.typingRef.current = nextTyping; 13722 }, [store]); 13723 const typeahead = useTypeahead(floatingRootContext, { 13724 enabled: !disabled2, 13725 listRef: store.context.itemLabels, 13726 elementsRef: store.context.itemDomElements, 13727 activeIndex, 13728 resetMs: TYPEAHEAD_RESET_MS, 13729 onMatch: (index2) => { 13730 if (open2 && index2 !== activeIndex) { 13731 store.set("activeIndex", index2); 13732 } 13733 }, 13734 onTyping 13735 }); 13736 const activeTriggerProps = React81.useMemo(() => { 13737 const mergedProps = mergeProps(typeahead.reference, listNavigation2.reference, dismiss.reference, { 13738 onMouseMove() { 13739 store.set("allowMouseEnter", true); 13740 } 13741 }, interactionTypeProps); 13742 mergedProps["aria-haspopup"] = "menu"; 13743 mergedProps["aria-expanded"] = open2; 13744 return mergedProps; 13745 }, [store, typeahead.reference, listNavigation2.reference, dismiss.reference, interactionTypeProps, open2]); 13746 const inactiveTriggerProps = React81.useMemo(() => { 13747 const mergedProps = mergeProps(listNavigation2.trigger, dismiss.trigger, interactionTypeProps); 13748 mergedProps["aria-haspopup"] = "menu"; 13749 mergedProps["aria-expanded"] = false; 13750 return mergedProps; 13751 }, [listNavigation2.trigger, dismiss.trigger, interactionTypeProps]); 13752 useRefWithInit(() => { 13753 store.update({ 13754 inactiveTriggerProps 13755 }); 13756 return null; 13757 }); 13758 const popupProps = React81.useMemo(() => mergeProps(FOCUSABLE_POPUP_PROPS, { 13759 id: floatingId, 13760 role: "menu", 13761 // `menu` is implicitly vertical, so only the non-default value needs to be rendered. 13762 "aria-orientation": orientation === "horizontal" ? "horizontal" : void 0, 13763 "aria-labelledby": activeTriggerElement?.id, 13764 onMouseMove() { 13765 store.set("allowMouseEnter", true); 13766 if (parent.type === "menu") { 13767 store.set("hoverEnabled", false); 13768 } 13769 }, 13770 onClick() { 13771 if (store.select("hoverEnabled")) { 13772 store.set("hoverEnabled", false); 13773 } 13774 }, 13775 onKeyDown(event) { 13776 const relay = store.select("keyboardEventRelay"); 13777 if (relay && !event.isPropagationStopped()) { 13778 relay(event); 13779 } 13780 } 13781 }, typeahead.floating, listNavigation2.floating, dismiss.floating), [activeTriggerElement, floatingId, orientation, parent.type, store, typeahead.floating, listNavigation2.floating, dismiss.floating]); 13782 const itemProps = listNavigation2.item ?? EMPTY_OBJECT; 13783 usePopupInteractionProps(store, { 13784 floatingRootContext, 13785 activeTriggerProps, 13786 inactiveTriggerProps, 13787 popupProps, 13788 itemProps 13789 }); 13790 const context = React81.useMemo(() => ({ 13791 store, 13792 parent: parentFromContext 13793 }), [store, parentFromContext]); 13794 const content = /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(MenuRootContext.Provider, { 13795 value: context, 13796 children: [handle && /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(PopupHandleAttachment, { 13797 handle, 13798 store 13799 }), typeof children === "function" ? children({ 13800 payload 13801 }) : children] 13802 }); 13803 if (parent.type === void 0 || parent.type === "context-menu") { 13804 return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(FloatingTree, { 13805 externalTree: floatingTreeRoot, 13806 children: content 13807 }); 13808 } 13809 return content; 13810 }); 13811 if (true) MenuRoot.displayName = "MenuRoot"; 13812 function useMenuRootStore(initialState, floatingId, nested) { 13813 const store = useRefWithInit(() => new MenuStore(initialState, floatingId, nested)).current; 13814 return store; 13815 } 13816 13817 // node_modules/@base-ui/react/menu/submenu-root/MenuSubmenuRoot.mjs 13818 var React82 = __toESM(require_react(), 1); 13819 var import_jsx_runtime50 = __toESM(require_jsx_runtime(), 1); 13820 function MenuSubmenuRoot(props) { 13821 const parentMenu = useMenuRootContext().store; 13822 const contextValue = React82.useMemo(() => ({ 13823 parentMenu 13824 }), [parentMenu]); 13825 return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(MenuSubmenuRootContext.Provider, { 13826 value: contextValue, 13827 children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(MenuRoot, { 13828 ...props 13829 }) 13830 }); 13831 } 13832 13833 // node_modules/@base-ui/react/menu/trigger/MenuTrigger.mjs 13834 var React86 = __toESM(require_react(), 1); 13835 13836 // node_modules/@base-ui/react/internals/composite/item/useCompositeItem.mjs 13837 var React83 = __toESM(require_react(), 1); 13838 function useCompositeItem(params = {}) { 13839 const { 13840 highlightItemOnHover, 13841 highlightedIndex, 13842 onHighlightedIndexChange 13843 } = useCompositeRootContext(); 13844 const { 13845 ref, 13846 index: index2 13847 } = useCompositeListItem(params); 13848 const isHighlighted = highlightedIndex === index2; 13849 const itemRef = React83.useRef(null); 13850 const mergedRef = useMergedRefs(ref, itemRef); 13851 const compositeProps = { 13852 tabIndex: isHighlighted ? 0 : -1, 13853 onFocus() { 13854 onHighlightedIndexChange(index2); 13855 }, 13856 onMouseMove() { 13857 const item = itemRef.current; 13858 if (!highlightItemOnHover || !item) { 13859 return; 13860 } 13861 const disabled2 = item.hasAttribute("disabled") || item.ariaDisabled === "true"; 13862 if (!isHighlighted && !disabled2) { 13863 item.focus(); 13864 } 13865 } 13866 }; 13867 return { 13868 compositeProps, 13869 compositeRef: mergedRef, 13870 index: index2 13871 }; 13872 } 13873 13874 // node_modules/@base-ui/react/internals/composite/item/CompositeItem.mjs 13875 function CompositeItem(componentProps) { 13876 const { 13877 render: render4, 13878 className, 13879 style, 13880 state = EMPTY_OBJECT, 13881 props = EMPTY_ARRAY, 13882 refs = EMPTY_ARRAY, 13883 metadata, 13884 stateAttributesMapping: stateAttributesMapping2, 13885 tag = "div", 13886 ...elementProps 13887 } = componentProps; 13888 const { 13889 compositeProps, 13890 compositeRef 13891 } = useCompositeItem({ 13892 metadata 13893 }); 13894 return useRenderElement(tag, componentProps, { 13895 state, 13896 // The composite ref attaches first so an outer item wins when nested items share a DOM node. 13897 ref: [compositeRef, ...refs], 13898 props: [compositeProps, ...props, elementProps], 13899 stateAttributesMapping: stateAttributesMapping2 13900 }); 13901 } 13902 13903 // node_modules/@base-ui/react/menu/utils/findRootOwnerId.mjs 13904 function findRootOwnerId(node) { 13905 if (isHTMLElement(node) && node.hasAttribute("data-rootownerid")) { 13906 return node.getAttribute("data-rootownerid"); 13907 } 13908 if (isLastTraversableNode(node)) { 13909 return void 0; 13910 } 13911 return findRootOwnerId(getParentNode(node)); 13912 } 13913 13914 // node_modules/@base-ui/react/utils/popups/useTriggerFocusGuards.mjs 13915 var React84 = __toESM(require_react(), 1); 13916 var ReactDOM6 = __toESM(require_react_dom(), 1); 13917 function useTriggerFocusGuards(store, triggerElementRef) { 13918 const preFocusGuardRef = React84.useRef(null); 13919 function handlePreFocusGuardFocus(event) { 13920 ReactDOM6.flushSync(() => { 13921 store.setOpen(false, createChangeEventDetails(reason_parts_exports.focusOut, event.nativeEvent, event.currentTarget)); 13922 }); 13923 const previousTabbable = getTabbableBeforeElement(preFocusGuardRef.current); 13924 previousTabbable?.focus(); 13925 } 13926 function handleFocusTargetFocus(event) { 13927 const positionerElement = store.select("positionerElement"); 13928 if (positionerElement && isOutsideEvent(event, positionerElement)) { 13929 store.context.beforeContentFocusGuardRef.current?.focus(); 13930 } else { 13931 ReactDOM6.flushSync(() => { 13932 store.setOpen(false, createChangeEventDetails(reason_parts_exports.focusOut, event.nativeEvent, event.currentTarget)); 13933 }); 13934 let nextTabbable = getTabbableAfterElement(store.context.triggerFocusTargetRef.current || triggerElementRef.current); 13935 while (nextTabbable !== null && contains(positionerElement, nextTabbable)) { 13936 const prevTabbable = nextTabbable; 13937 nextTabbable = getNextTabbable(nextTabbable); 13938 if (nextTabbable === prevTabbable) { 13939 break; 13940 } 13941 } 13942 nextTabbable?.focus(); 13943 } 13944 } 13945 return { 13946 preFocusGuardRef, 13947 handlePreFocusGuardFocus, 13948 handleFocusTargetFocus 13949 }; 13950 } 13951 13952 // node_modules/@base-ui/react/utils/useMixedToggleClickHandler.mjs 13953 var React85 = __toESM(require_react(), 1); 13954 function useMixedToggleClickHandler(params) { 13955 const { 13956 enabled = true, 13957 mouseDownAction, 13958 open: open2 13959 } = params; 13960 const ignoreClickRef = React85.useRef(false); 13961 return React85.useMemo(() => { 13962 if (!enabled) { 13963 return EMPTY_OBJECT; 13964 } 13965 return { 13966 onMouseDown: (event) => { 13967 if (mouseDownAction === "open" && !open2 || mouseDownAction === "close" && open2) { 13968 ignoreClickRef.current = true; 13969 ownerDocument(event.currentTarget).addEventListener("click", () => { 13970 ignoreClickRef.current = false; 13971 }, { 13972 once: true 13973 }); 13974 } 13975 }, 13976 onClick: (event) => { 13977 if (ignoreClickRef.current) { 13978 ignoreClickRef.current = false; 13979 event.preventBaseUIHandler(); 13980 } 13981 } 13982 }; 13983 }, [enabled, mouseDownAction, open2]); 13984 } 13985 13986 // node_modules/@base-ui/react/menu/trigger/MenuTrigger.mjs 13987 var import_jsx_runtime51 = __toESM(require_jsx_runtime(), 1); 13988 var MenuTrigger = fastComponentRef(function MenuTrigger2(componentProps, forwardedRef) { 13989 const { 13990 render: render4, 13991 className, 13992 style, 13993 disabled: disabledProp = false, 13994 nativeButton = true, 13995 id: idProp, 13996 openOnHover: openOnHoverProp, 13997 delay = 100, 13998 closeDelay = 0, 13999 handle, 14000 payload, 14001 ...elementProps 14002 } = componentProps; 14003 const rootContext = useMenuRootContext(true); 14004 const handleStore = usePopupHandleStore(handle); 14005 const store = handleStore ?? rootContext?.store; 14006 if (!store) { 14007 throw new Error(true ? "Base UI: <Menu.Trigger> must be either used within a <Menu.Root> component or provided with a handle." : formatErrorMessage_default(85)); 14008 } 14009 const thisTriggerId = useBaseUiId(idProp); 14010 const isTriggerActive = store.useState("isTriggerActive", thisTriggerId); 14011 const floatingRootContext = store.useState("floatingRootContext"); 14012 const isOpenedByThisTrigger = store.useState("isOpenedByTrigger", thisTriggerId); 14013 const popupId = store.useState("triggerPopupId", thisTriggerId); 14014 const triggerElementRef = React86.useRef(null); 14015 const parent = useMenuParent(); 14016 const compositeRootContext = useCompositeRootContext(true); 14017 const floatingTreeRootFromContext = useFloatingTree(); 14018 const floatingTreeRoot = React86.useMemo(() => { 14019 return floatingTreeRootFromContext ?? new FloatingTreeStore(); 14020 }, [floatingTreeRootFromContext]); 14021 const floatingNodeId = useFloatingNodeId(floatingTreeRoot); 14022 const floatingParentNodeId = useFloatingParentNodeId(); 14023 const { 14024 registerTrigger, 14025 isMountedByThisTrigger 14026 } = useTriggerDataForwarding(thisTriggerId, triggerElementRef, store, { 14027 payload, 14028 closeDelay, 14029 parent, 14030 floatingTreeRoot, 14031 floatingNodeId, 14032 floatingParentNodeId, 14033 keyboardEventRelay: compositeRootContext?.relayKeyboardEvent 14034 }); 14035 const isInMenubar = parent.type === "menubar"; 14036 const rootDisabled = store.useState("disabled"); 14037 const disabled2 = disabledProp || rootDisabled || isInMenubar && parent.context.disabled; 14038 const { 14039 getButtonProps, 14040 buttonRef 14041 } = useButton({ 14042 disabled: disabled2, 14043 native: nativeButton 14044 }); 14045 React86.useEffect(() => { 14046 if (!isOpenedByThisTrigger && parent.type === void 0) { 14047 store.context.allowMouseUpTriggerRef.current = false; 14048 } 14049 }, [store, isOpenedByThisTrigger, parent.type]); 14050 const triggerRef = React86.useRef(null); 14051 const allowMouseUpTriggerTimeout = useTimeout(); 14052 const handleDocumentMouseUp = useStableCallback((mouseEvent) => { 14053 if (!triggerRef.current) { 14054 return; 14055 } 14056 allowMouseUpTriggerTimeout.clear(); 14057 store.context.allowMouseUpTriggerRef.current = false; 14058 const mouseUpTarget = mouseEvent.target; 14059 if (contains(triggerRef.current, mouseUpTarget) || contains(store.select("positionerElement"), mouseUpTarget) || mouseUpTarget === triggerRef.current) { 14060 return; 14061 } 14062 if (mouseUpTarget != null && findRootOwnerId(mouseUpTarget) === store.select("rootId")) { 14063 return; 14064 } 14065 if (isMouseWithinBounds(mouseEvent, triggerRef.current)) { 14066 return; 14067 } 14068 floatingTreeRoot.events.emit("close", { 14069 domEvent: mouseEvent, 14070 reason: reason_parts_exports.cancelOpen 14071 }); 14072 }); 14073 React86.useEffect(() => { 14074 if (isOpenedByThisTrigger && store.select("lastOpenChangeReason") === reason_parts_exports.triggerHover) { 14075 const doc = ownerDocument(triggerRef.current); 14076 doc.addEventListener("mouseup", handleDocumentMouseUp, { 14077 once: true 14078 }); 14079 } 14080 }, [isOpenedByThisTrigger, handleDocumentMouseUp, store]); 14081 const parentMenubarHasSubmenuOpen = isInMenubar && parent.context.hasSubmenuOpen; 14082 const openOnHover = openOnHoverProp ?? parentMenubarHasSubmenuOpen; 14083 const hoverProps = useHoverReferenceInteraction(floatingRootContext, { 14084 enabled: openOnHover && !disabled2 && (!isInMenubar || parentMenubarHasSubmenuOpen && !isMountedByThisTrigger), 14085 handleClose: safePolygon({ 14086 blockPointerEvents: !isInMenubar 14087 }), 14088 mouseOnly: true, 14089 move: false, 14090 restMs: parent.type === void 0 ? delay : void 0, 14091 delay: { 14092 close: closeDelay 14093 }, 14094 triggerElementRef, 14095 externalTree: floatingTreeRoot, 14096 isActiveTrigger: isTriggerActive, 14097 isClosing: () => store.select("transitionStatus") === "ending" 14098 }); 14099 const stickIfOpen = useStickIfOpen(isOpenedByThisTrigger, store.select("lastOpenChangeReason")); 14100 const click = useClick(floatingRootContext, { 14101 enabled: !disabled2, 14102 event: isOpenedByThisTrigger && isInMenubar ? "click" : "mousedown", 14103 toggle: true, 14104 ignoreMouse: false, 14105 stickIfOpen: parent.type === void 0 ? stickIfOpen : false 14106 }); 14107 const focus = useFocus(floatingRootContext, { 14108 enabled: !disabled2 && parentMenubarHasSubmenuOpen 14109 }); 14110 const mixedToggleHandlers = useMixedToggleClickHandler({ 14111 open: isOpenedByThisTrigger, 14112 enabled: isInMenubar, 14113 mouseDownAction: "open" 14114 }); 14115 const localInteractionProps = React86.useMemo(() => mergeProps(focus.reference, click.reference), [focus.reference, click.reference]); 14116 const rootTriggerProps = store.useState("triggerProps", isMountedByThisTrigger); 14117 const { 14118 preFocusGuardRef, 14119 handlePreFocusGuardFocus, 14120 handleFocusTargetFocus 14121 } = useTriggerFocusGuards(store, triggerElementRef); 14122 const state = { 14123 disabled: disabled2, 14124 open: isOpenedByThisTrigger 14125 }; 14126 const ref = [triggerRef, forwardedRef, buttonRef, registerTrigger, triggerElementRef]; 14127 const props = [localInteractionProps, hoverProps ?? EMPTY_OBJECT, rootTriggerProps, { 14128 "aria-haspopup": "menu", 14129 "aria-controls": popupId, 14130 id: thisTriggerId, 14131 onMouseDown: (event) => { 14132 if (store.select("open")) { 14133 return; 14134 } 14135 allowMouseUpTriggerTimeout.start(200, () => { 14136 store.context.allowMouseUpTriggerRef.current = true; 14137 }); 14138 const doc = ownerDocument(event.currentTarget); 14139 doc.addEventListener("mouseup", handleDocumentMouseUp, { 14140 once: true 14141 }); 14142 } 14143 }, isInMenubar ? { 14144 role: "menuitem" 14145 } : {}, mixedToggleHandlers, elementProps, getButtonProps]; 14146 const element = useRenderElement("button", componentProps, { 14147 enabled: !isInMenubar, 14148 stateAttributesMapping: pressableTriggerOpenStateMapping, 14149 state, 14150 ref, 14151 props 14152 }); 14153 if (isInMenubar) { 14154 return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(CompositeItem, { 14155 tag: "button", 14156 render: render4, 14157 className, 14158 style, 14159 state, 14160 refs: ref, 14161 props, 14162 stateAttributesMapping: pressableTriggerOpenStateMapping 14163 }); 14164 } 14165 if (isOpenedByThisTrigger) { 14166 return /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(React86.Fragment, { 14167 children: [/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(FocusGuard, { 14168 ref: preFocusGuardRef, 14169 onFocus: handlePreFocusGuardFocus 14170 }, `$thisTriggerId}-pre-focus-guard`), /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(React86.Fragment, { 14171 children: element 14172 }, thisTriggerId), /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(FocusGuard, { 14173 ref: store.context.triggerFocusTargetRef, 14174 onFocus: handleFocusTargetFocus 14175 }, `$thisTriggerId}-post-focus-guard`)] 14176 }); 14177 } 14178 return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(React86.Fragment, { 14179 children: element 14180 }, thisTriggerId); 14181 }); 14182 if (true) MenuTrigger.displayName = "MenuTrigger"; 14183 function useStickIfOpen(open2, openReason) { 14184 const stickIfOpenTimeout = useTimeout(); 14185 const [stickIfOpen, setStickIfOpen] = React86.useState(false); 14186 useIsoLayoutEffect(() => { 14187 if (open2 && openReason === reason_parts_exports.triggerHover) { 14188 setStickIfOpen(true); 14189 stickIfOpenTimeout.start(PATIENT_CLICK_THRESHOLD, () => { 14190 setStickIfOpen(false); 14191 }); 14192 } else if (!open2) { 14193 stickIfOpenTimeout.clear(); 14194 setStickIfOpen(false); 14195 } 14196 }, [open2, openReason, stickIfOpenTimeout]); 14197 return stickIfOpen; 14198 } 14199 function useMenuParent() { 14200 const menubarContext = useMenubarContext(true); 14201 const parent = React86.useMemo(() => { 14202 if (menubarContext) { 14203 return { 14204 type: "menubar", 14205 context: menubarContext 14206 }; 14207 } 14208 return { 14209 type: void 0 14210 }; 14211 }, [menubarContext]); 14212 return parent; 14213 } 14214 14215 // node_modules/@base-ui/react/menu/viewport/MenuViewport.mjs 14216 var React91 = __toESM(require_react(), 1); 14217 14218 // node_modules/@base-ui/react/utils/usePopupViewport.mjs 14219 var React90 = __toESM(require_react(), 1); 14220 var ReactDOM7 = __toESM(require_react_dom(), 1); 14221 14222 // node_modules/@base-ui/utils/usePreviousValue.mjs 14223 var React87 = __toESM(require_react(), 1); 14224 function usePreviousValue(value) { 14225 const [state, setState] = React87.useState({ 14226 current: value, 14227 previous: null 14228 }); 14229 if (!Object.is(value, state.current)) { 14230 setState({ 14231 current: value, 14232 previous: state.current 14233 }); 14234 } 14235 return state.previous; 14236 } 14237 14238 // node_modules/@base-ui/react/utils/usePopupAutoResize.mjs 14239 var React88 = __toESM(require_react(), 1); 14240 14241 // node_modules/@base-ui/react/utils/getCssDimensions.mjs 14242 function getCssDimensions2(element) { 14243 const css = getComputedStyle2(element); 14244 let width = parseFloat(css.width) || 0; 14245 let height = parseFloat(css.height) || 0; 14246 const hasOffset = isHTMLElement(element); 14247 const offsetWidth = hasOffset ? element.offsetWidth : width; 14248 const offsetHeight = hasOffset ? element.offsetHeight : height; 14249 const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight; 14250 if (shouldFallback) { 14251 width = offsetWidth; 14252 height = offsetHeight; 14253 } 14254 return { 14255 width, 14256 height 14257 }; 14258 } 14259 14260 // node_modules/@base-ui/react/utils/CommonPopupCssVars.mjs 14261 var popupWidth = "--popup-width"; 14262 var popupHeight = "--popup-height"; 14263 14264 // node_modules/@base-ui/react/utils/usePopupAutoResize.mjs 14265 function usePopupAutoResize(parameters) { 14266 const { 14267 popupElement, 14268 positionerElement, 14269 content, 14270 mounted, 14271 onMeasureLayout: onMeasureLayoutParam, 14272 onMeasureLayoutComplete: onMeasureLayoutCompleteParam, 14273 side, 14274 direction 14275 } = parameters; 14276 const runOnceAnimationsFinish = useAnimationsFinished(popupElement, true); 14277 const animationFrame = useAnimationFrame(); 14278 const committedDimensionsRef = React88.useRef(null); 14279 const isInitialRenderRef = React88.useRef(true); 14280 const restoreAnchoringStylesRef = React88.useRef(NOOP); 14281 const onMeasureLayout = useStableCallback(onMeasureLayoutParam); 14282 const onMeasureLayoutComplete = useStableCallback(onMeasureLayoutCompleteParam); 14283 const anchoringStyles = React88.useMemo(() => getPopupAnchoringStyles(side, direction), [side, direction]); 14284 useIsoLayoutEffect(() => { 14285 if (!mounted) { 14286 restoreAnchoringStylesRef.current = NOOP; 14287 isInitialRenderRef.current = true; 14288 committedDimensionsRef.current = null; 14289 return void 0; 14290 } 14291 if (!popupElement || !positionerElement) { 14292 return void 0; 14293 } 14294 restoreAnchoringStylesRef.current = applyElementStyles(popupElement, anchoringStyles); 14295 setPopupCssSize(popupElement, "auto"); 14296 const restorePopupPosition = overrideElementStyle(popupElement, "position", "static"); 14297 const restorePopupTransform = overrideElementStyle(popupElement, "transform", "none"); 14298 const restorePopupScale = overrideElementStyle(popupElement, "scale", "1"); 14299 const restorePositionerAvailableSize = applyElementStyles(positionerElement, { 14300 [availableWidth]: "max-content", 14301 [availableHeight]: "max-content" 14302 }); 14303 function restoreMeasurementOverrides() { 14304 restorePopupPosition(); 14305 restorePopupTransform(); 14306 restorePositionerAvailableSize(); 14307 } 14308 function restoreMeasurementOverridesIncludingScale() { 14309 restoreMeasurementOverrides(); 14310 restorePopupScale(); 14311 } 14312 onMeasureLayout?.(); 14313 if (isInitialRenderRef.current || committedDimensionsRef.current === null) { 14314 setPositionerCssSize(positionerElement, "max-content"); 14315 const dimensions = getCssDimensions2(popupElement); 14316 committedDimensionsRef.current = dimensions; 14317 setPositionerCssSize(positionerElement, dimensions); 14318 restoreMeasurementOverridesIncludingScale(); 14319 onMeasureLayoutComplete?.(null, dimensions); 14320 isInitialRenderRef.current = false; 14321 return () => { 14322 restoreAnchoringStylesRef.current(); 14323 restoreAnchoringStylesRef.current = NOOP; 14324 }; 14325 } 14326 setPositionerCssSize(positionerElement, "max-content"); 14327 const previousDimensions = committedDimensionsRef.current; 14328 const newDimensions = getCssDimensions2(popupElement); 14329 committedDimensionsRef.current = newDimensions; 14330 setPopupCssSize(popupElement, previousDimensions); 14331 restoreMeasurementOverridesIncludingScale(); 14332 onMeasureLayoutComplete?.(previousDimensions, newDimensions); 14333 setPositionerCssSize(positionerElement, newDimensions); 14334 const abortController = new AbortController(); 14335 animationFrame.request(() => { 14336 setPopupCssSize(popupElement, newDimensions); 14337 runOnceAnimationsFinish(() => { 14338 popupElement.style.setProperty(popupWidth, "auto"); 14339 popupElement.style.setProperty(popupHeight, "auto"); 14340 }, abortController.signal); 14341 }); 14342 return () => { 14343 abortController.abort(); 14344 animationFrame.cancel(); 14345 restoreAnchoringStylesRef.current(); 14346 restoreAnchoringStylesRef.current = NOOP; 14347 }; 14348 }, [content, popupElement, positionerElement, runOnceAnimationsFinish, animationFrame, mounted, onMeasureLayout, onMeasureLayoutComplete, anchoringStyles]); 14349 } 14350 function getPopupAnchoringStyles(side, direction) { 14351 const isPhysicalTop = side === "top"; 14352 const isPhysicalLeft = side === "left" || side === (direction === "rtl" ? "inline-end" : "inline-start"); 14353 if (!isPhysicalTop && !isPhysicalLeft) { 14354 return EMPTY_OBJECT; 14355 } 14356 return { 14357 position: "absolute", 14358 [isPhysicalTop ? "bottom" : "top"]: "0", 14359 [isPhysicalLeft ? "right" : "left"]: "0" 14360 }; 14361 } 14362 function overrideElementStyle(element, property, value) { 14363 const originalValue = element.style.getPropertyValue(property); 14364 element.style.setProperty(property, value); 14365 return () => { 14366 element.style.setProperty(property, originalValue); 14367 }; 14368 } 14369 function applyElementStyles(element, styles) { 14370 const restorers = []; 14371 for (const [key, value] of Object.entries(styles)) { 14372 restorers.push(overrideElementStyle(element, key, value)); 14373 } 14374 return restorers.length ? () => { 14375 restorers.forEach((restore) => restore()); 14376 } : NOOP; 14377 } 14378 function setPopupCssSize(popupElement, size4) { 14379 const width = size4 === "auto" ? "auto" : `$size4.width}px`; 14380 const height = size4 === "auto" ? "auto" : `$size4.height}px`; 14381 popupElement.style.setProperty(popupWidth, width); 14382 popupElement.style.setProperty(popupHeight, height); 14383 } 14384 function setPositionerCssSize(positionerElement, size4) { 14385 const width = size4 === "max-content" ? "max-content" : `$size4.width}px`; 14386 const height = size4 === "max-content" ? "max-content" : `$size4.height}px`; 14387 positionerElement.style.setProperty(positionerWidth, width); 14388 positionerElement.style.setProperty(positionerHeight, height); 14389 } 14390 14391 // node_modules/@base-ui/react/direction-provider/DirectionProvider.mjs 14392 var React89 = __toESM(require_react(), 1); 14393 var import_jsx_runtime52 = __toESM(require_jsx_runtime(), 1); 14394 var DirectionProvider = function DirectionProvider2(props) { 14395 const { 14396 direction = "ltr" 14397 } = props; 14398 const contextValue = React89.useMemo(() => ({ 14399 direction 14400 }), [direction]); 14401 return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(DirectionContext.Provider, { 14402 value: contextValue, 14403 children: props.children 14404 }); 14405 }; 14406 if (true) DirectionProvider.displayName = "DirectionProvider"; 14407 14408 // node_modules/@base-ui/react/utils/adaptiveOriginMiddleware.mjs 14409 var adaptiveOrigin = { 14410 name: "adaptiveOrigin", 14411 async fn(state) { 14412 const { 14413 x: rawX, 14414 y: rawY, 14415 rects: { 14416 floating: floatRect 14417 }, 14418 elements: { 14419 floating 14420 }, 14421 platform: platform3, 14422 strategy, 14423 placement 14424 } = state; 14425 const win = getWindow(floating); 14426 const styles = win.getComputedStyle(floating); 14427 const hasTransition = styles.transitionDuration !== "0s" && styles.transitionDuration !== ""; 14428 if (!hasTransition) { 14429 return { 14430 x: rawX, 14431 y: rawY, 14432 data: DEFAULT_SIDES 14433 }; 14434 } 14435 const offsetParent = await platform3.getOffsetParent?.(floating); 14436 let offsetDimensions = { 14437 width: 0, 14438 height: 0 14439 }; 14440 if (strategy === "fixed" && win?.visualViewport) { 14441 offsetDimensions = { 14442 width: win.visualViewport.width, 14443 height: win.visualViewport.height 14444 }; 14445 } else if (offsetParent === win) { 14446 const doc = ownerDocument(floating); 14447 offsetDimensions = { 14448 width: doc.documentElement.clientWidth, 14449 height: doc.documentElement.clientHeight 14450 }; 14451 } else if (await platform3.isElement?.(offsetParent)) { 14452 offsetDimensions = await platform3.getDimensions(offsetParent); 14453 } 14454 const currentSide = getSide(placement); 14455 let x2 = rawX; 14456 let y2 = rawY; 14457 if (currentSide === "left") { 14458 x2 = offsetDimensions.width - (rawX + floatRect.width); 14459 } 14460 if (currentSide === "top") { 14461 y2 = offsetDimensions.height - (rawY + floatRect.height); 14462 } 14463 const sideX = currentSide === "left" ? "right" : DEFAULT_SIDES.sideX; 14464 const sideY = currentSide === "top" ? "bottom" : DEFAULT_SIDES.sideY; 14465 return { 14466 x: x2, 14467 y: y2, 14468 data: { 14469 sideX, 14470 sideY 14471 } 14472 }; 14473 } 14474 }; 14475 14476 // node_modules/@base-ui/react/utils/CommonViewportDataAttributes.mjs 14477 var activationDirection = "data-activation-direction"; 14478 14479 // node_modules/@base-ui/react/utils/usePopupViewport.mjs 14480 var import_jsx_runtime53 = __toESM(require_jsx_runtime(), 1); 14481 var popupViewportStateMapping = { 14482 activationDirection: (value) => value ? { 14483 [activationDirection]: value 14484 } : null 14485 }; 14486 function usePopupViewport(parameters) { 14487 const { 14488 store, 14489 side, 14490 children 14491 } = parameters; 14492 const direction = useDirection(); 14493 const activeTrigger = store.useState("activeTriggerElement"); 14494 const activeTriggerId = store.useState("activeTriggerId"); 14495 const open2 = store.useState("open"); 14496 const payload = store.useState("payload"); 14497 const mounted = store.useState("mounted"); 14498 const popupElement = store.useState("popupElement"); 14499 const positionerElement = store.useState("positionerElement"); 14500 const previousActiveTrigger = usePreviousValue(open2 ? activeTrigger : null); 14501 const currentContentKey = usePopupContentKey(activeTriggerId, payload); 14502 const capturedNodeRef = React90.useRef(null); 14503 const [previousContentNode, setPreviousContentNode] = React90.useState(null); 14504 const [newTriggerOffset, setNewTriggerOffset] = React90.useState(null); 14505 const currentContainerRef = React90.useRef(null); 14506 const previousContainerRef = React90.useRef(null); 14507 const onAnimationsFinished = useAnimationsFinished(currentContainerRef, true); 14508 const cleanupFrame = useAnimationFrame(); 14509 const cleanupControllerRef = React90.useRef(null); 14510 const [previousContentDimensions, setPreviousContentDimensions] = React90.useState(null); 14511 const [showStartingStyleAttribute, setShowStartingStyleAttribute] = React90.useState(false); 14512 useIsoLayoutEffect(() => { 14513 store.set("adaptiveOrigin", adaptiveOrigin); 14514 return () => { 14515 store.set("adaptiveOrigin", void 0); 14516 }; 14517 }, [store]); 14518 const handleMeasureLayout = useStableCallback(() => { 14519 currentContainerRef.current?.style.setProperty("animation", "none"); 14520 currentContainerRef.current?.style.setProperty("transition", "none"); 14521 previousContainerRef.current?.style.setProperty("display", "none"); 14522 }); 14523 const handleMeasureLayoutComplete = useStableCallback((previousDimensions) => { 14524 currentContainerRef.current?.style.removeProperty("animation"); 14525 currentContainerRef.current?.style.removeProperty("transition"); 14526 previousContainerRef.current?.style.removeProperty("display"); 14527 if (previousDimensions) { 14528 setPreviousContentDimensions(previousDimensions); 14529 } 14530 }); 14531 const armViewportCleanup = useStableCallback(() => { 14532 cleanupControllerRef.current?.abort(); 14533 const controller = new AbortController(); 14534 cleanupControllerRef.current = controller; 14535 onAnimationsFinished(() => { 14536 setPreviousContentNode(null); 14537 setPreviousContentDimensions(null); 14538 capturedNodeRef.current = null; 14539 }, controller.signal); 14540 }); 14541 const lastHandledTriggerRef = React90.useRef(null); 14542 useIsoLayoutEffect(() => { 14543 if (!open2 || !mounted) { 14544 lastHandledTriggerRef.current = null; 14545 } 14546 }, [open2, mounted]); 14547 useIsoLayoutEffect(() => { 14548 if (activeTrigger && previousActiveTrigger && activeTrigger !== previousActiveTrigger && lastHandledTriggerRef.current !== activeTrigger && capturedNodeRef.current) { 14549 setPreviousContentNode(capturedNodeRef.current); 14550 setShowStartingStyleAttribute(true); 14551 const offset4 = calculateRelativePosition(previousActiveTrigger, activeTrigger); 14552 setNewTriggerOffset(offset4); 14553 lastHandledTriggerRef.current = activeTrigger; 14554 } 14555 }, [activeTrigger, previousActiveTrigger]); 14556 useIsoLayoutEffect(() => { 14557 if (previousContentNode == null) { 14558 return; 14559 } 14560 cleanupControllerRef.current?.abort(); 14561 setShowStartingStyleAttribute(true); 14562 cleanupFrame.request(() => { 14563 ReactDOM7.flushSync(() => { 14564 setShowStartingStyleAttribute(false); 14565 }); 14566 armViewportCleanup(); 14567 }); 14568 }, [currentContentKey, previousContentNode, armViewportCleanup, cleanupFrame]); 14569 useIsoLayoutEffect(() => { 14570 const source = currentContainerRef.current; 14571 if (!source) { 14572 return; 14573 } 14574 const wrapper = ownerDocument(source).createElement("div"); 14575 for (const child of Array.from(source.childNodes)) { 14576 wrapper.appendChild(child.cloneNode(true)); 14577 } 14578 capturedNodeRef.current = wrapper; 14579 }); 14580 const isTransitioning = previousContentNode != null; 14581 let childrenToRender; 14582 if (!isTransitioning) { 14583 childrenToRender = /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("div", { 14584 "data-current": true, 14585 ref: currentContainerRef, 14586 children 14587 }, currentContentKey); 14588 } else { 14589 childrenToRender = /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(React90.Fragment, { 14590 children: [/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("div", { 14591 "data-previous": true, 14592 inert: inertValue(true), 14593 ref: previousContainerRef, 14594 style: { 14595 ...previousContentDimensions ? { 14596 [popupWidth]: `$previousContentDimensions.width}px`, 14597 [popupHeight]: `$previousContentDimensions.height}px` 14598 } : null, 14599 position: "absolute" 14600 }, 14601 "data-ending-style": showStartingStyleAttribute ? void 0 : "" 14602 }, "previous"), /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("div", { 14603 "data-current": true, 14604 ref: currentContainerRef, 14605 "data-starting-style": showStartingStyleAttribute ? "" : void 0, 14606 children 14607 }, currentContentKey)] 14608 }); 14609 } 14610 useIsoLayoutEffect(() => { 14611 const container = previousContainerRef.current; 14612 if (!container || !previousContentNode) { 14613 return; 14614 } 14615 container.replaceChildren(...Array.from(previousContentNode.childNodes)); 14616 }, [previousContentNode]); 14617 usePopupAutoResize({ 14618 popupElement, 14619 positionerElement, 14620 mounted, 14621 content: payload, 14622 onMeasureLayout: handleMeasureLayout, 14623 onMeasureLayoutComplete: handleMeasureLayoutComplete, 14624 side, 14625 direction 14626 }); 14627 const state = { 14628 activationDirection: getActivationDirection(newTriggerOffset), 14629 transitioning: isTransitioning 14630 }; 14631 return { 14632 children: childrenToRender, 14633 state 14634 }; 14635 } 14636 function getActivationDirection(offset4) { 14637 if (!offset4) { 14638 return void 0; 14639 } 14640 return `$getValueWithTolerance(offset4.horizontal, 5, "right", "left")} $getValueWithTolerance(offset4.vertical, 5, "down", "up")}`; 14641 } 14642 function getValueWithTolerance(value, tolerance, positiveLabel, negativeLabel) { 14643 if (value > tolerance) { 14644 return positiveLabel; 14645 } 14646 if (value < -tolerance) { 14647 return negativeLabel; 14648 } 14649 return ""; 14650 } 14651 function calculateRelativePosition(from, to) { 14652 const fromRect = from.getBoundingClientRect(); 14653 const toRect = to.getBoundingClientRect(); 14654 const fromCenter = { 14655 x: fromRect.left + fromRect.width / 2, 14656 y: fromRect.top + fromRect.height / 2 14657 }; 14658 const toCenter = { 14659 x: toRect.left + toRect.width / 2, 14660 y: toRect.top + toRect.height / 2 14661 }; 14662 return { 14663 horizontal: toCenter.x - fromCenter.x, 14664 vertical: toCenter.y - fromCenter.y 14665 }; 14666 } 14667 function usePopupContentKey(activeTriggerId, payload) { 14668 const [contentKey, setContentKey] = React90.useState(0); 14669 const previousActiveTriggerIdRef = React90.useRef(activeTriggerId); 14670 const previousPayloadRef = React90.useRef(payload); 14671 const pendingPayloadUpdateRef = React90.useRef(false); 14672 useIsoLayoutEffect(() => { 14673 const previousActiveTriggerId = previousActiveTriggerIdRef.current; 14674 const previousPayload = previousPayloadRef.current; 14675 const triggerIdChanged = activeTriggerId !== previousActiveTriggerId; 14676 const payloadChanged = payload !== previousPayload; 14677 if (triggerIdChanged) { 14678 setContentKey((value) => value + 1); 14679 pendingPayloadUpdateRef.current = !payloadChanged; 14680 } else if (pendingPayloadUpdateRef.current && payloadChanged) { 14681 setContentKey((value) => value + 1); 14682 pendingPayloadUpdateRef.current = false; 14683 } 14684 previousActiveTriggerIdRef.current = activeTriggerId; 14685 previousPayloadRef.current = payload; 14686 }, [activeTriggerId, payload]); 14687 return `$activeTriggerId ?? "current"}-$contentKey}`; 14688 } 14689 14690 // node_modules/@base-ui/react/menu/viewport/MenuViewport.mjs 14691 var MenuViewport = /* @__PURE__ */ React91.forwardRef(function MenuViewport2(componentProps, forwardedRef) { 14692 const { 14693 render: render4, 14694 className, 14695 style, 14696 children, 14697 ...elementProps 14698 } = componentProps; 14699 const { 14700 store 14701 } = useMenuRootContext(); 14702 const { 14703 side 14704 } = useMenuPositionerContext(); 14705 const instantType = store.useState("instantType"); 14706 const { 14707 children: childrenToRender, 14708 state: viewportState 14709 } = usePopupViewport({ 14710 store, 14711 side, 14712 children 14713 }); 14714 const state = { 14715 activationDirection: viewportState.activationDirection, 14716 transitioning: viewportState.transitioning, 14717 instant: instantType 14718 }; 14719 return useRenderElement("div", componentProps, { 14720 state, 14721 ref: forwardedRef, 14722 props: [elementProps, { 14723 children: childrenToRender 14724 }], 14725 stateAttributesMapping: popupViewportStateMapping 14726 }); 14727 }); 14728 if (true) MenuViewport.displayName = "MenuViewport"; 14729 14730 // node_modules/@base-ui/react/separator/Separator.mjs 14731 var React92 = __toESM(require_react(), 1); 14732 var Separator = /* @__PURE__ */ React92.forwardRef(function SeparatorComponent(componentProps, forwardedRef) { 14733 const { 14734 className, 14735 render: render4, 14736 orientation = "horizontal", 14737 style, 14738 ...elementProps 14739 } = componentProps; 14740 const state = { 14741 orientation 14742 }; 14743 const element = useRenderElement("div", componentProps, { 14744 state, 14745 ref: forwardedRef, 14746 props: [{ 14747 role: "separator", 14748 "aria-orientation": orientation 14749 }, elementProps] 14750 }); 14751 return element; 14752 }); 14753 if (true) Separator.displayName = "Separator"; 14754 14755 // node_modules/@base-ui/react/menu/submenu-trigger/MenuSubmenuTrigger.mjs 14756 var React93 = __toESM(require_react(), 1); 14757 14758 // node_modules/@base-ui/utils/isElementDisabled.mjs 14759 function isElementDisabled(element) { 14760 return element == null || element.hasAttribute("disabled") || element.getAttribute("aria-disabled") === "true"; 14761 } 14762 14763 // node_modules/@base-ui/react/menu/submenu-trigger/MenuSubmenuTrigger.mjs 14764 var VOICE_OVER_EXPANDED_PROPS = { 14765 "aria-expanded": void 0 14766 }; 14767 var MenuSubmenuTrigger = /* @__PURE__ */ React93.forwardRef(function MenuSubmenuTrigger2(componentProps, forwardedRef) { 14768 const { 14769 render: render4, 14770 className, 14771 style, 14772 label, 14773 id: idProp, 14774 nativeButton = false, 14775 openOnHover = true, 14776 delay = 100, 14777 closeDelay = 0, 14778 disabled: disabledProp = false, 14779 ...elementProps 14780 } = componentProps; 14781 const submenuRootContext = useMenuSubmenuRootContext(); 14782 if (!submenuRootContext?.parentMenu) { 14783 throw new Error(true ? "Base UI: <Menu.SubmenuTrigger> must be placed in <Menu.SubmenuRoot>." : formatErrorMessage_default(37)); 14784 } 14785 const listItem = useCompositeListItem({ 14786 guess: true, 14787 label 14788 }); 14789 const menuPositionerContext = useMenuPositionerContext(); 14790 const { 14791 store 14792 } = useMenuRootContext(); 14793 const thisTriggerId = useBaseUiId(idProp); 14794 const open2 = store.useState("open"); 14795 const floatingRootContext = store.useState("floatingRootContext"); 14796 const floatingTreeRoot = store.useState("floatingTreeRoot"); 14797 const popupId = store.useState("triggerPopupId", thisTriggerId); 14798 const baseRegisterTrigger = useTriggerRegistration(thisTriggerId, store); 14799 const registerTrigger = useStableCallback((element2) => { 14800 baseRegisterTrigger(element2); 14801 if (element2 !== null && store.select("open") && store.select("activeTriggerId") == null) { 14802 store.update({ 14803 activeTriggerId: thisTriggerId ?? null, 14804 activeTriggerElement: element2, 14805 closeDelay 14806 }); 14807 } 14808 }); 14809 const triggerElementRef = React93.useRef(null); 14810 const handleTriggerElementRef = React93.useCallback((el) => { 14811 triggerElementRef.current = el; 14812 store.set("activeTriggerElement", el); 14813 }, [store]); 14814 useIsoLayoutEffect(() => { 14815 registerTrigger(triggerElementRef.current); 14816 return () => registerTrigger(null); 14817 }, [registerTrigger, thisTriggerId, store]); 14818 store.useSyncedValue("closeDelay", closeDelay); 14819 const parentMenuStore = submenuRootContext.parentMenu; 14820 const rootDisabled = store.useState("disabled"); 14821 const parentDisabled = parentMenuStore.useState("disabled"); 14822 const disabled2 = disabledProp || rootDisabled || parentDisabled; 14823 if (true) { 14824 React93.useEffect(() => { 14825 const element2 = triggerElementRef.current; 14826 if (element2 && isElementDisabled(element2) && !disabled2) { 14827 const ownerStackMessage = SafeReact.captureOwnerStack?.() || ""; 14828 warn(`A disabled element was detected on <Menu.SubmenuTrigger>. To properly disable the trigger, use the \`disabled\` prop on the component instead of setting it on the rendered element.$ownerStackMessage}`); 14829 } 14830 }); 14831 } 14832 const itemProps = parentMenuStore.useState("itemProps"); 14833 const highlighted = parentMenuStore.useState("isActive", listItem.index); 14834 const itemMetadata = React93.useMemo(() => ({ 14835 type: "submenu-trigger", 14836 setActive() { 14837 if (parentMenuStore.select("highlightItemOnHover")) { 14838 parentMenuStore.set("activeIndex", listItem.index); 14839 } 14840 } 14841 }), [parentMenuStore, listItem.index]); 14842 const { 14843 getItemProps, 14844 itemRef 14845 } = useMenuItem({ 14846 closeOnClick: false, 14847 disabled: disabled2, 14848 highlighted, 14849 id: thisTriggerId, 14850 store, 14851 typingRef: parentMenuStore.context.typingRef, 14852 nativeButton, 14853 itemMetadata, 14854 nodeId: menuPositionerContext?.context.nodeId 14855 }); 14856 const hoverEnabled = store.useState("hoverEnabled"); 14857 const hoverProps = useHoverReferenceInteraction(floatingRootContext, { 14858 enabled: hoverEnabled && openOnHover && !disabled2, 14859 handleClose: safePolygon({ 14860 blockPointerEvents: true 14861 }), 14862 mouseOnly: true, 14863 move: true, 14864 restMs: delay, 14865 delay: { 14866 open: delay, 14867 close: closeDelay 14868 }, 14869 shouldOpen: delay > 0 ? () => parentMenuStore.select("allowMouseEnter") : void 0, 14870 triggerElementRef, 14871 externalTree: floatingTreeRoot, 14872 isClosing: () => store.select("transitionStatus") === "ending", 14873 // Chrome can drop the trigger's `mouseleave` during a fast pointer sweep, 14874 // leaving a stale submenu open (see #5152) — cancel from `mouseout` too. 14875 guardStaleOpen: true 14876 }); 14877 const click = useClick(floatingRootContext, { 14878 enabled: !disabled2, 14879 event: "mousedown", 14880 toggle: !openOnHover, 14881 ignoreMouse: openOnHover, 14882 stickIfOpen: false 14883 }); 14884 const localInteractionProps = click.reference ?? EMPTY_OBJECT; 14885 const rootTriggerProps = store.useState("triggerProps", true); 14886 delete rootTriggerProps.id; 14887 const state = { 14888 disabled: disabled2, 14889 highlighted, 14890 open: open2 14891 }; 14892 const openMethod = store.useState("openMethod"); 14893 const lastOpenChangeReason = store.useState("lastOpenChangeReason"); 14894 const openedByKeyboard = lastOpenChangeReason === reason_parts_exports.listNavigation || openMethod === "keyboard"; 14895 const shouldOmitExpanded = open2 && openedByKeyboard && parts_exports.screenReader.voiceOver; 14896 const element = useRenderElement("div", componentProps, { 14897 state, 14898 stateAttributesMapping: triggerOpenStateMapping, 14899 props: [ 14900 localInteractionProps, 14901 hoverProps, 14902 rootTriggerProps, 14903 itemProps, 14904 // Opening a submenu changes the trigger's expanded state while the trigger still holds 14905 // focus, and VoiceOver announces that state change instead of the submenu item that focus 14906 // moves to a moment later, so the first item is never announced. Dropping the state while 14907 // the submenu is open avoids the announcement without claiming the submenu is collapsed; 14908 // `aria-haspopup` still conveys that the item opens a submenu. 14909 shouldOmitExpanded ? VOICE_OVER_EXPANDED_PROPS : void 0, 14910 { 14911 "aria-controls": popupId, 14912 tabIndex: open2 || highlighted ? 0 : -1, 14913 onBlur() { 14914 if (highlighted) { 14915 parentMenuStore.set("activeIndex", null); 14916 } 14917 } 14918 }, 14919 elementProps, 14920 getItemProps 14921 ], 14922 ref: [forwardedRef, listItem.ref, itemRef, registerTrigger, handleTriggerElementRef] 14923 }); 14924 return element; 14925 }); 14926 if (true) MenuSubmenuTrigger.displayName = "MenuSubmenuTrigger"; 14927 14928 // node_modules/@base-ui/react/menu/store/MenuHandle.mjs 14929 var MenuHandle = class extends BasePopupHandle { 14930 constructor() { 14931 super(createNullMenuStore(), "Menu"); 14932 } 14933 /** 14934 * Opens the menu and associates it with the trigger with the given id. 14935 * 14936 * This method should only be called in an event handler or an effect (not during rendering). 14937 * 14938 * @param triggerId ID of the trigger to associate with the menu. The trigger must be a matching 14939 * `Menu.Trigger` with this handle passed as a prop. 14940 */ 14941 open(triggerId) { 14942 this.openByTrigger(triggerId); 14943 } 14944 /** 14945 * Closes the menu. 14946 * 14947 * This method should only be called in an event handler or an effect (not during rendering). 14948 */ 14949 close() { 14950 this.closePopup(); 14951 } 14952 /** 14953 * Whether the menu is currently open. Returns `false` while no root is attached to the handle. 14954 */ 14955 get isOpen() { 14956 return this.attachedStore?.select("open") ?? false; 14957 } 14958 }; 14959 function createMenuHandle() { 14960 return new MenuHandle(); 14961 } 14962 14963 // node_modules/@base-ui/react/field/index.parts.mjs 14964 var index_parts_exports2 = {}; 14965 __export(index_parts_exports2, { 14966 Control: () => FieldControl, 14967 Description: () => FieldDescription, 14968 Error: () => FieldError, 14969 Item: () => FieldItem, 14970 Label: () => FieldLabel, 14971 Root: () => FieldRoot, 14972 Validity: () => FieldValidity 14973 }); 14974 14975 // node_modules/@base-ui/react/field/root/FieldRoot.mjs 14976 var React97 = __toESM(require_react(), 1); 14977 14978 // node_modules/@base-ui/react/fieldset/root/FieldsetRootContext.mjs 14979 var React94 = __toESM(require_react(), 1); 14980 var FieldsetRootContext = /* @__PURE__ */ React94.createContext(void 0); 14981 if (true) FieldsetRootContext.displayName = "FieldsetRootContext"; 14982 function useFieldsetRootContext(optional = false) { 14983 const context = React94.useContext(FieldsetRootContext); 14984 if (!context && !optional) { 14985 throw new Error(true ? "Base UI: FieldsetRootContext is missing. Fieldset parts must be placed within <Fieldset.Root>." : formatErrorMessage_default(86)); 14986 } 14987 return context; 14988 } 14989 14990 // node_modules/@base-ui/react/internals/labelable-provider/LabelableProvider.mjs 14991 var React95 = __toESM(require_react(), 1); 14992 var import_jsx_runtime54 = __toESM(require_jsx_runtime(), 1); 14993 var LabelableProvider = function LabelableProvider2(props) { 14994 const defaultId = useBaseUiId(); 14995 const [controlIdState, setControlIdState] = React95.useState(defaultId); 14996 const [labelId, setLabelId] = React95.useState(); 14997 const [messageIds, setMessageIds] = React95.useState([]); 14998 const controlId = controlIdState === void 0 ? defaultId : controlIdState; 14999 const registrationsRef = useRefWithInit(() => /* @__PURE__ */ new Map()); 15000 const { 15001 messageIds: parentMessageIds 15002 } = useLabelableContext(); 15003 const registerControlId = useStableCallback((source, nextId) => { 15004 const registrations = registrationsRef.current; 15005 if (nextId === void 0) { 15006 registrations.delete(source); 15007 } else { 15008 registrations.set(source, nextId); 15009 } 15010 setControlIdState((prev) => { 15011 if (registrations.size === 0) { 15012 return prev; 15013 } 15014 let nextControlId; 15015 for (const id of registrations.values()) { 15016 if (id === prev) { 15017 return prev; 15018 } 15019 if (nextControlId === void 0) { 15020 nextControlId = id; 15021 } 15022 } 15023 return nextControlId; 15024 }); 15025 }); 15026 const resetControlId = useStableCallback(() => { 15027 if (registrationsRef.current.size === 0) { 15028 setControlIdState(defaultId); 15029 } 15030 }); 15031 const getDescriptionProps = React95.useCallback((externalProps) => { 15032 const ids = externalProps["aria-describedby"] ? externalProps["aria-describedby"].split(" ") : []; 15033 ids.push(...parentMessageIds, ...messageIds); 15034 return { 15035 ...externalProps, 15036 "aria-describedby": Array.from(new Set(ids)).join(" ") || void 0 15037 }; 15038 }, [parentMessageIds, messageIds]); 15039 const contextValue = React95.useMemo(() => ({ 15040 controlId, 15041 registerControlId, 15042 resetControlId, 15043 labelId, 15044 setLabelId, 15045 messageIds, 15046 setMessageIds, 15047 getDescriptionProps 15048 }), [controlId, registerControlId, resetControlId, labelId, setLabelId, messageIds, setMessageIds, getDescriptionProps]); 15049 return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(LabelableContext.Provider, { 15050 value: contextValue, 15051 children: props.children 15052 }); 15053 }; 15054 if (true) LabelableProvider.displayName = "LabelableProvider"; 15055 15056 // node_modules/@base-ui/react/internals/field-register-control/useFieldControlRegistration.mjs 15057 var React96 = __toESM(require_react(), 1); 15058 function useFieldControlRegistration(params) { 15059 const { 15060 change, 15061 commit, 15062 invalid: invalid2, 15063 markedDirtyRef, 15064 name, 15065 setRegisteredFieldName, 15066 registeredFieldIdRef, 15067 setValidityData, 15068 validityData 15069 } = params; 15070 const { 15071 formRef 15072 } = useFormContext(); 15073 const activeFieldControlSourceRef = React96.useRef(null); 15074 const registrationRef = React96.useRef(null); 15075 const initialValueCapturedRef = React96.useRef(false); 15076 const getValueForForm = useStableCallback(() => { 15077 const registration = registrationRef.current; 15078 if (!registration) { 15079 return void 0; 15080 } 15081 if (registration.getValue) { 15082 return registration.getValue(); 15083 } 15084 return registration.value; 15085 }); 15086 function getRegistrationValue(registration) { 15087 return registration.value === void 0 ? getValueForForm() : registration.value; 15088 } 15089 const validate = useStableCallback(() => { 15090 const registration = registrationRef.current; 15091 markedDirtyRef.current = true; 15092 if (!registration) { 15093 commit(validityData.value); 15094 return; 15095 } 15096 commit(getRegistrationValue(registration)); 15097 }); 15098 function refreshRegistration() { 15099 const registration = registrationRef.current; 15100 if (!registration || !registration.id) { 15101 return; 15102 } 15103 formRef.current.fields.set(registration.id, { 15104 getValue: getValueForForm, 15105 name: name ?? registration.name, 15106 controlRef: registration.controlRef, 15107 validityData: getCombinedFieldValidityData(validityData, invalid2), 15108 validate 15109 }); 15110 } 15111 function deleteRegistration(id = registrationRef.current?.id) { 15112 if (id) { 15113 formRef.current.fields.delete(id); 15114 } 15115 } 15116 function captureInitialValue(registration) { 15117 if (initialValueCapturedRef.current) { 15118 return; 15119 } 15120 initialValueCapturedRef.current = true; 15121 const initialValue = getRegistrationValue(registration); 15122 setValidityData((prev) => prev.initialValue === initialValue ? prev : { 15123 ...prev, 15124 initialValue 15125 }); 15126 } 15127 useIsoLayoutEffect(() => { 15128 const registration = registrationRef.current; 15129 if (!registration || !registration.id) { 15130 return; 15131 } 15132 setRegisteredFieldName(name ? void 0 : registration.name); 15133 formRef.current.fields.set(registration.id, { 15134 getValue: getValueForForm, 15135 name: name ?? registration.name, 15136 controlRef: registration.controlRef, 15137 validityData: getCombinedFieldValidityData(validityData, invalid2), 15138 validate 15139 }); 15140 }, [formRef, getValueForForm, invalid2, name, setRegisteredFieldName, validate, validityData]); 15141 useIsoLayoutEffect(() => { 15142 const fields = formRef.current.fields; 15143 return () => { 15144 const id = registrationRef.current?.id; 15145 if (id) { 15146 fields.delete(id); 15147 } 15148 }; 15149 }, [formRef]); 15150 const register2 = useStableCallback((source, registration) => { 15151 if (!registration) { 15152 if (activeFieldControlSourceRef.current === source) { 15153 activeFieldControlSourceRef.current = null; 15154 change(void 0, true); 15155 deleteRegistration(); 15156 registrationRef.current = null; 15157 setRegisteredFieldName(void 0); 15158 registeredFieldIdRef.current = void 0; 15159 } 15160 return; 15161 } 15162 const previousId = registrationRef.current?.id; 15163 const previousSource = activeFieldControlSourceRef.current; 15164 if (previousSource && previousSource !== source) { 15165 change(void 0, true); 15166 } 15167 activeFieldControlSourceRef.current = source; 15168 registrationRef.current = registration; 15169 if (!name) { 15170 setRegisteredFieldName(registration.name); 15171 } 15172 registeredFieldIdRef.current = registration.id; 15173 if (previousId && previousId !== registration.id) { 15174 deleteRegistration(previousId); 15175 } 15176 captureInitialValue(registration); 15177 refreshRegistration(); 15178 }); 15179 return [validate, register2]; 15180 } 15181 15182 // node_modules/@base-ui/react/field/root/FieldRoot.mjs 15183 var import_jsx_runtime55 = __toESM(require_jsx_runtime(), 1); 15184 var FieldRootInner = /* @__PURE__ */ React97.forwardRef(function FieldRootInner2(componentProps, forwardedRef) { 15185 const { 15186 errors, 15187 validationMode: formValidationMode, 15188 submitCountRef 15189 } = useFormContext(); 15190 const { 15191 render: render4, 15192 className, 15193 validate: validateProp, 15194 validationDebounceTime = 0, 15195 validationMode = formValidationMode, 15196 name, 15197 disabled: disabledProp = false, 15198 invalid: invalidProp, 15199 dirty: dirtyProp, 15200 touched: touchedProp, 15201 actionsRef, 15202 style, 15203 ...elementProps 15204 } = componentProps; 15205 const disabledFieldset = useFieldsetRootContext(true)?.disabled; 15206 const validate = useStableCallback(validateProp || (() => null)); 15207 const disabled2 = disabledFieldset || disabledProp; 15208 const [touchedState, setTouchedUnwrapped] = React97.useState(false); 15209 const [dirtyState, setDirtyUnwrapped] = React97.useState(false); 15210 const [filled, setFilled] = React97.useState(false); 15211 const [focused, setFocused] = React97.useState(false); 15212 const dirty = dirtyProp ?? dirtyState; 15213 const touched = touchedProp ?? touchedState; 15214 const markedDirtyRef = React97.useRef(dirty); 15215 const registeredFieldIdRef = React97.useRef(void 0); 15216 const [registeredFieldName, setRegisteredFieldName] = React97.useState(); 15217 const effectiveName = name ?? registeredFieldName; 15218 useIsoLayoutEffect(() => { 15219 if (dirtyProp !== void 0) { 15220 markedDirtyRef.current = dirtyProp; 15221 } 15222 }, [dirtyProp]); 15223 const setDirty = useStableCallback((value) => { 15224 if (dirtyProp !== void 0) { 15225 return; 15226 } 15227 if (value) { 15228 markedDirtyRef.current = true; 15229 } 15230 setDirtyUnwrapped(value); 15231 }); 15232 const setTouched = useStableCallback((value) => { 15233 if (touchedProp !== void 0) { 15234 return; 15235 } 15236 setTouchedUnwrapped(value); 15237 }); 15238 const shouldValidateOnChange = useStableCallback(() => validationMode === "onChange" || validationMode === "onSubmit" && submitCountRef.current > 0); 15239 const formError = effectiveName && Object.hasOwn(errors, effectiveName) ? errors[effectiveName] : null; 15240 const hasFormError = !!(Array.isArray(formError) ? formError.length : formError); 15241 const invalid2 = invalidProp === true || hasFormError; 15242 const [validityData, setValidityData] = React97.useState({ 15243 state: DEFAULT_VALIDITY_STATE, 15244 error: "", 15245 errors: [], 15246 value: null, 15247 initialValue: null 15248 }); 15249 const valid2 = !invalid2 && (disabled2 ? null : validityData.state.valid); 15250 const state = React97.useMemo(() => ({ 15251 disabled: disabled2, 15252 touched, 15253 dirty, 15254 valid: valid2, 15255 filled, 15256 focused 15257 }), [disabled2, touched, dirty, valid2, filled, focused]); 15258 const validation = useFieldValidation({ 15259 setValidityData, 15260 validate, 15261 validityData, 15262 validationDebounceTime, 15263 invalid: invalid2, 15264 markedDirtyRef, 15265 state, 15266 shouldValidateOnChange, 15267 validationMode, 15268 registeredFieldIdRef 15269 }); 15270 const [validateFieldControl, registerFieldControl] = useFieldControlRegistration({ 15271 change: validation.change, 15272 commit: validation.commit, 15273 invalid: invalid2, 15274 markedDirtyRef, 15275 name, 15276 setRegisteredFieldName, 15277 registeredFieldIdRef, 15278 setValidityData, 15279 validityData 15280 }); 15281 React97.useImperativeHandle(actionsRef, () => ({ 15282 validate: validateFieldControl 15283 }), [validateFieldControl]); 15284 const contextValue = React97.useMemo(() => ({ 15285 invalid: invalid2, 15286 name: effectiveName, 15287 validityData, 15288 setValidityData, 15289 disabled: disabled2, 15290 setTouched, 15291 setDirty, 15292 setFilled, 15293 setFocused, 15294 validationMode, 15295 shouldValidateOnChange, 15296 state, 15297 registerFieldControl, 15298 validation 15299 }), [invalid2, effectiveName, validityData, disabled2, setTouched, setDirty, setFilled, setFocused, validationMode, shouldValidateOnChange, state, registerFieldControl, validation]); 15300 const element = useRenderElement("div", componentProps, { 15301 ref: forwardedRef, 15302 state, 15303 props: elementProps, 15304 stateAttributesMapping: fieldValidityMapping 15305 }); 15306 return /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(FieldRootContext.Provider, { 15307 value: contextValue, 15308 children: element 15309 }); 15310 }); 15311 if (true) FieldRootInner.displayName = "FieldRootInner"; 15312 var FieldRoot = /* @__PURE__ */ React97.forwardRef(function FieldRoot2(componentProps, forwardedRef) { 15313 return /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(LabelableProvider, { 15314 children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(FieldRootInner, { 15315 ...componentProps, 15316 ref: forwardedRef 15317 }) 15318 }); 15319 }); 15320 if (true) FieldRoot.displayName = "FieldRoot"; 15321 15322 // node_modules/@base-ui/react/field/label/FieldLabel.mjs 15323 var React98 = __toESM(require_react(), 1); 15324 var FieldLabel = /* @__PURE__ */ React98.forwardRef(function FieldLabel2(componentProps, forwardedRef) { 15325 const { 15326 render: render4, 15327 className, 15328 style, 15329 id: idProp, 15330 nativeLabel = true, 15331 ...elementProps 15332 } = componentProps; 15333 const fieldRootContext = useFieldRootContext(false); 15334 const fieldItemContext = useFieldItemContext(); 15335 const { 15336 labelId 15337 } = useLabelableContext(); 15338 const state = { 15339 ...fieldRootContext.state, 15340 disabled: fieldRootContext.disabled || fieldItemContext.disabled 15341 }; 15342 const labelRef = React98.useRef(null); 15343 const labelProps = useLabel({ 15344 id: labelId ?? idProp, 15345 native: nativeLabel 15346 }); 15347 if (true) { 15348 React98.useEffect(() => { 15349 if (!labelRef.current) { 15350 return; 15351 } 15352 const isLabelTag = labelRef.current.tagName === "LABEL"; 15353 if (nativeLabel) { 15354 if (!isLabelTag) { 15355 const ownerStackMessage = SafeReact.captureOwnerStack?.() || ""; 15356 const message2 = "<Field.Label> expected a <label> element because the `nativeLabel` prop is true. Rendering a non-<label> disables native label association, so `htmlFor` will not work. Use a real <label> in the `render` prop, or set `nativeLabel` to `false`."; 15357 error(`$message2}$ownerStackMessage}`); 15358 } 15359 } else if (isLabelTag) { 15360 const ownerStackMessage = SafeReact.captureOwnerStack?.() || ""; 15361 const message2 = "<Field.Label> expected a non-<label> element because the `nativeLabel` prop is false. Rendering a <label> assumes native label behavior while Base UI treats it as non-native, which can cause unexpected pointer behavior. Use a non-<label> in the `render` prop, or set `nativeLabel` to `true`."; 15362 error(`$message2}$ownerStackMessage}`); 15363 } 15364 }, [nativeLabel]); 15365 } 15366 const element = useRenderElement("label", componentProps, { 15367 ref: [forwardedRef, labelRef], 15368 state, 15369 props: [labelProps, elementProps], 15370 stateAttributesMapping: fieldValidityMapping 15371 }); 15372 return element; 15373 }); 15374 if (true) FieldLabel.displayName = "FieldLabel"; 15375 15376 // node_modules/@base-ui/react/field/error/FieldError.mjs 15377 var React99 = __toESM(require_react(), 1); 15378 var import_jsx_runtime56 = __toESM(require_jsx_runtime(), 1); 15379 var stateAttributesMapping = { 15380 ...fieldValidityMapping, 15381 ...transitionStatusMapping 15382 }; 15383 var FieldError = /* @__PURE__ */ React99.forwardRef(function FieldError2(componentProps, forwardedRef) { 15384 const { 15385 render: render4, 15386 id: idProp, 15387 className, 15388 match: match2, 15389 style, 15390 ...elementProps 15391 } = componentProps; 15392 const id = useBaseUiId(idProp); 15393 const { 15394 validityData, 15395 state: fieldState, 15396 name 15397 } = useFieldRootContext(false); 15398 const { 15399 setMessageIds 15400 } = useLabelableContext(); 15401 const { 15402 errors 15403 } = useFormContext(); 15404 const formError = name && Object.hasOwn(errors, name) ? errors[name] : null; 15405 const hasFormError = !!(Array.isArray(formError) ? formError.length : formError); 15406 const hasSpecificMatch = typeof match2 === "string"; 15407 let rendered = false; 15408 if (match2 === true) { 15409 rendered = true; 15410 } else if (fieldState.disabled) { 15411 rendered = false; 15412 } else if (hasSpecificMatch) { 15413 rendered = Boolean(validityData.state[match2]); 15414 } else { 15415 rendered = hasFormError || validityData.state.valid === false; 15416 } 15417 const { 15418 mounted, 15419 transitionStatus, 15420 setMounted 15421 } = useTransitionStatus(rendered); 15422 useIsoLayoutEffect(() => { 15423 if (!rendered || !id) { 15424 return void 0; 15425 } 15426 setMessageIds((v2) => v2.concat(id)); 15427 return () => { 15428 setMessageIds((v2) => v2.filter((item) => item !== id)); 15429 }; 15430 }, [rendered, id, setMessageIds]); 15431 const errorRef = React99.useRef(null); 15432 const [lastRenderedMessage, setLastRenderedMessage] = React99.useState(null); 15433 const [lastRenderedMessageKey, setLastRenderedMessageKey] = React99.useState(null); 15434 let error2 = validityData.error; 15435 if (!hasSpecificMatch && hasFormError) { 15436 error2 = formError; 15437 } else if (validityData.errors.length > 1) { 15438 error2 = validityData.errors; 15439 } 15440 let errorMessage = error2; 15441 if (Array.isArray(error2)) { 15442 errorMessage = error2.length > 1 ? /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("ul", { 15443 children: error2.map((message2) => /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("li", { 15444 children: message2 15445 }, message2)) 15446 }) : error2[0]; 15447 } 15448 const errorKey = Array.isArray(error2) ? JSON.stringify(error2) : error2; 15449 if (rendered && errorKey !== lastRenderedMessageKey) { 15450 setLastRenderedMessageKey(errorKey); 15451 setLastRenderedMessage(errorMessage); 15452 } 15453 useOpenChangeComplete({ 15454 open: rendered, 15455 ref: errorRef, 15456 onComplete() { 15457 if (!rendered) { 15458 setMounted(false); 15459 } 15460 } 15461 }); 15462 const state = { 15463 ...fieldState, 15464 transitionStatus 15465 }; 15466 const element = useRenderElement("div", componentProps, { 15467 ref: [forwardedRef, errorRef], 15468 state, 15469 props: [{ 15470 id, 15471 children: rendered ? errorMessage : lastRenderedMessage 15472 }, elementProps], 15473 stateAttributesMapping, 15474 enabled: mounted 15475 }); 15476 if (!mounted) { 15477 return null; 15478 } 15479 return element; 15480 }); 15481 if (true) FieldError.displayName = "FieldError"; 15482 15483 // node_modules/@base-ui/react/field/description/FieldDescription.mjs 15484 var React100 = __toESM(require_react(), 1); 15485 var FieldDescription = /* @__PURE__ */ React100.forwardRef(function FieldDescription2(componentProps, forwardedRef) { 15486 const { 15487 render: render4, 15488 id: idProp, 15489 className, 15490 style, 15491 ...elementProps 15492 } = componentProps; 15493 const id = useBaseUiId(idProp); 15494 const fieldRootContext = useFieldRootContext(false); 15495 const fieldItemContext = useFieldItemContext(); 15496 const { 15497 setMessageIds 15498 } = useLabelableContext(); 15499 const state = { 15500 ...fieldRootContext.state, 15501 disabled: fieldRootContext.disabled || fieldItemContext.disabled 15502 }; 15503 useIsoLayoutEffect(() => { 15504 if (!id) { 15505 return void 0; 15506 } 15507 setMessageIds((v2) => v2.concat(id)); 15508 return () => { 15509 setMessageIds((v2) => v2.filter((item) => item !== id)); 15510 }; 15511 }, [id, setMessageIds]); 15512 const element = useRenderElement("p", componentProps, { 15513 ref: forwardedRef, 15514 state, 15515 props: [{ 15516 id 15517 }, elementProps], 15518 stateAttributesMapping: fieldValidityMapping 15519 }); 15520 return element; 15521 }); 15522 if (true) FieldDescription.displayName = "FieldDescription"; 15523 15524 // node_modules/@base-ui/react/field/control/FieldControl.mjs 15525 var React101 = __toESM(require_react(), 1); 15526 var FieldControl = /* @__PURE__ */ React101.forwardRef(function FieldControl2(componentProps, forwardedRef) { 15527 const { 15528 render: render4, 15529 className, 15530 id: idProp, 15531 name: nameProp, 15532 value: valueProp, 15533 disabled: disabledProp = false, 15534 onValueChange, 15535 defaultValue: defaultValue2, 15536 autoFocus = false, 15537 style, 15538 ...elementProps 15539 } = componentProps; 15540 const { 15541 state: fieldState, 15542 name: fieldName, 15543 disabled: fieldDisabled, 15544 setTouched, 15545 setDirty, 15546 validityData, 15547 setFocused, 15548 setFilled, 15549 validationMode, 15550 validation 15551 } = useFieldRootContext(); 15552 const { 15553 clearErrors, 15554 elementRef: formElementRef, 15555 submitCountRef 15556 } = useFormContext(); 15557 const disabled2 = fieldDisabled || disabledProp; 15558 const name = fieldName ?? nameProp; 15559 const state = { 15560 ...fieldState, 15561 disabled: disabled2 15562 }; 15563 const { 15564 labelId 15565 } = useLabelableContext(); 15566 const id = useLabelableId({ 15567 id: idProp 15568 }); 15569 const [valueUnwrapped] = useControlled({ 15570 controlled: valueProp, 15571 default: defaultValue2, 15572 name: "FieldControl", 15573 state: "value" 15574 }); 15575 const isControlled = valueProp !== void 0; 15576 const value = isControlled ? valueUnwrapped : void 0; 15577 const serializedValue = value == null ? void 0 : String(value); 15578 const getValueFromInput = useStableCallback(() => validation.inputRef.current?.value); 15579 useRegisterFieldControl(validation.inputRef, id, serializedValue, getValueFromInput, !disabled2, nameProp); 15580 useIsoLayoutEffect(() => { 15581 const currentValue = serializedValue ?? validation.inputRef.current?.value; 15582 if (currentValue !== void 0) { 15583 setFilled(currentValue !== ""); 15584 } 15585 }, [serializedValue, validation.inputRef, setFilled]); 15586 useValueChanged(serializedValue, () => { 15587 if (serializedValue === void 0) { 15588 return; 15589 } 15590 clearErrors(name); 15591 setDirty(serializedValue !== (validityData.initialValue ?? "")); 15592 validation.change(serializedValue); 15593 }); 15594 const inputRef = React101.useRef(null); 15595 const enterValidationTimeout = useTimeout(); 15596 useIsoLayoutEffect(() => { 15597 if (autoFocus && inputRef.current === activeElement(ownerDocument(inputRef.current))) { 15598 setFocused(true); 15599 } 15600 }, [autoFocus, setFocused]); 15601 const element = useRenderElement("input", componentProps, { 15602 ref: [forwardedRef, inputRef], 15603 state, 15604 props: [{ 15605 id, 15606 disabled: disabled2, 15607 name, 15608 ref: validation.inputRef, 15609 "aria-labelledby": labelId, 15610 autoFocus, 15611 ...isControlled ? { 15612 value 15613 } : { 15614 defaultValue: defaultValue2 15615 }, 15616 onChange(event) { 15617 const inputValue = event.currentTarget.value; 15618 const details = createChangeEventDetails(reason_parts_exports.none, event.nativeEvent); 15619 onValueChange?.(inputValue, details); 15620 if (isControlled) { 15621 return; 15622 } 15623 setDirty(inputValue !== (validityData.initialValue ?? "")); 15624 setFilled(inputValue !== ""); 15625 if (!event.nativeEvent.defaultPrevented && !details.isCanceled) { 15626 clearErrors(name); 15627 validation.change(inputValue); 15628 } 15629 }, 15630 onFocus() { 15631 setFocused(true); 15632 }, 15633 onBlur(event) { 15634 setTouched(true); 15635 setFocused(false); 15636 if (validationMode === "onBlur") { 15637 const inputValue = event.currentTarget.value; 15638 validation.commit(inputValue); 15639 if (isControlled) { 15640 queueMicrotask(() => { 15641 const nextValue = validation.inputRef.current?.value; 15642 if (nextValue !== void 0 && nextValue !== inputValue && nextValue !== (validityData.initialValue ?? "")) { 15643 validation.commit(nextValue); 15644 } 15645 }); 15646 } 15647 } 15648 }, 15649 onKeyDown(event) { 15650 if (event.currentTarget.tagName === "INPUT" && event.key === "Enter") { 15651 setTouched(true); 15652 const value2 = event.currentTarget.value; 15653 const form = event.currentTarget.form; 15654 if (form && form === formElementRef.current && !event.defaultPrevented) { 15655 const input = event.currentTarget; 15656 const submitCount = submitCountRef.current; 15657 enterValidationTimeout.start(0, () => { 15658 if (submitCountRef.current === submitCount) { 15659 validation.commit(input.value); 15660 } 15661 }); 15662 } else { 15663 validation.commit(value2); 15664 } 15665 } 15666 } 15667 }, elementProps, (props) => validation.getValidationProps(disabled2, props)], 15668 stateAttributesMapping: fieldValidityMapping 15669 }); 15670 return element; 15671 }); 15672 if (true) FieldControl.displayName = "FieldControl"; 15673 15674 // node_modules/@base-ui/react/field/validity/FieldValidity.mjs 15675 var React102 = __toESM(require_react(), 1); 15676 var import_jsx_runtime57 = __toESM(require_jsx_runtime(), 1); 15677 var FieldValidity = function FieldValidity2(props) { 15678 const { 15679 children 15680 } = props; 15681 const { 15682 validityData, 15683 invalid: invalid2 15684 } = useFieldRootContext(false); 15685 const combinedFieldValidityData = React102.useMemo(() => getCombinedFieldValidityData(validityData, invalid2), [validityData, invalid2]); 15686 const isInvalid = combinedFieldValidityData.state.valid === false; 15687 const { 15688 transitionStatus 15689 } = useTransitionStatus(isInvalid); 15690 const fieldValidityState = React102.useMemo(() => { 15691 return { 15692 ...combinedFieldValidityData, 15693 validity: combinedFieldValidityData.state, 15694 transitionStatus 15695 }; 15696 }, [combinedFieldValidityData, transitionStatus]); 15697 return /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(React102.Fragment, { 15698 children: children(fieldValidityState) 15699 }); 15700 }; 15701 if (true) FieldValidity.displayName = "FieldValidity"; 15702 15703 // node_modules/@base-ui/react/field/item/FieldItem.mjs 15704 var React103 = __toESM(require_react(), 1); 15705 var import_jsx_runtime58 = __toESM(require_jsx_runtime(), 1); 15706 var FieldItem = /* @__PURE__ */ React103.forwardRef(function FieldItem2(componentProps, forwardedRef) { 15707 const { 15708 render: render4, 15709 className, 15710 style, 15711 disabled: disabledProp = false, 15712 ...elementProps 15713 } = componentProps; 15714 const { 15715 state: fieldState, 15716 disabled: rootDisabled 15717 } = useFieldRootContext(false); 15718 const disabled2 = rootDisabled || disabledProp; 15719 const state = { 15720 ...fieldState, 15721 disabled: disabled2 15722 }; 15723 const fieldItemContext = React103.useMemo(() => ({ 15724 disabled: disabled2 15725 }), [disabled2]); 15726 const element = useRenderElement("div", componentProps, { 15727 ref: forwardedRef, 15728 state, 15729 props: elementProps, 15730 stateAttributesMapping: fieldValidityMapping 15731 }); 15732 return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(LabelableProvider, { 15733 children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(FieldItemContext.Provider, { 15734 value: fieldItemContext, 15735 children: element 15736 }) 15737 }); 15738 }); 15739 if (true) FieldItem.displayName = "FieldItem"; 15740 15741 // node_modules/@base-ui/react/input/Input.mjs 15742 var React104 = __toESM(require_react(), 1); 15743 var import_jsx_runtime59 = __toESM(require_jsx_runtime(), 1); 15744 var Input = /* @__PURE__ */ React104.forwardRef(function Input2(props, forwardedRef) { 15745 return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(index_parts_exports2.Control, { 15746 ref: forwardedRef, 15747 ...props 15748 }); 15749 }); 15750 if (true) Input.displayName = "Input"; 15751 15752 // node_modules/@base-ui/react/utils/FloatingPortalLite.mjs 15753 var React105 = __toESM(require_react(), 1); 15754 var ReactDOM8 = __toESM(require_react_dom(), 1); 15755 var import_jsx_runtime60 = __toESM(require_jsx_runtime(), 1); 15756 var FloatingPortalLite = /* @__PURE__ */ React105.forwardRef(function FloatingPortalLite2(componentProps, forwardedRef) { 15757 const { 15758 children, 15759 container, 15760 className, 15761 render: render4, 15762 style, 15763 ...elementProps 15764 } = componentProps; 15765 const { 15766 node: portalNode, 15767 subtree: portalSubtree 15768 } = useFloatingPortalNode({ 15769 container, 15770 ref: forwardedRef, 15771 componentProps, 15772 elementProps 15773 }); 15774 if (!portalSubtree && !portalNode) { 15775 return null; 15776 } 15777 return /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(React105.Fragment, { 15778 children: [portalSubtree, portalNode && /* @__PURE__ */ ReactDOM8.createPortal(children, portalNode)] 15779 }); 15780 }); 15781 if (true) FloatingPortalLite.displayName = "FloatingPortalLite"; 15782 15783 // node_modules/@base-ui/react/tooltip/index.parts.mjs 15784 var index_parts_exports3 = {}; 15785 __export(index_parts_exports3, { 15786 Arrow: () => TooltipArrow, 15787 Handle: () => TooltipHandle, 15788 Popup: () => TooltipPopup, 15789 Portal: () => TooltipPortal, 15790 Positioner: () => TooltipPositioner, 15791 Provider: () => TooltipProvider, 15792 Root: () => TooltipRoot, 15793 Trigger: () => TooltipTrigger, 15794 Viewport: () => TooltipViewport, 15795 createHandle: () => createTooltipHandle 15796 }); 15797 15798 // node_modules/@base-ui/react/tooltip/root/TooltipRoot.mjs 15799 var React108 = __toESM(require_react(), 1); 15800 15801 // node_modules/@base-ui/react/tooltip/root/TooltipRootContext.mjs 15802 var React106 = __toESM(require_react(), 1); 15803 var TooltipRootContext = /* @__PURE__ */ React106.createContext(void 0); 15804 if (true) TooltipRootContext.displayName = "TooltipRootContext"; 15805 function useTooltipRootContext(optional) { 15806 const context = React106.useContext(TooltipRootContext); 15807 if (context === void 0 && !optional) { 15808 throw new Error(true ? "Base UI: TooltipRootContext is missing. Tooltip parts must be placed within <Tooltip.Root>." : formatErrorMessage_default(72)); 15809 } 15810 return context; 15811 } 15812 15813 // node_modules/@base-ui/react/tooltip/store/TooltipStore.mjs 15814 var React107 = __toESM(require_react(), 1); 15815 var selectors3 = { 15816 ...popupStoreSelectors, 15817 disabled: (state) => state.disabled, 15818 instantType: (state) => state.instantType, 15819 isInstantPhase: (state) => state.isInstantPhase, 15820 trackCursorAxis: (state) => state.trackCursorAxis, 15821 disableHoverablePopup: (state) => state.disableHoverablePopup, 15822 lastOpenChangeReason: (state) => state.openChangeReason, 15823 closeOnClick: (state) => state.closeOnClick, 15824 closeDelay: (state) => state.closeDelay, 15825 adaptiveOrigin: (state) => state.adaptiveOrigin 15826 }; 15827 var TooltipStore = class extends ReactStore { 15828 constructor(initialState, floatingId, nested) { 15829 const triggerElements = new PopupTriggerMap(); 15830 super(createInitialState2(initialState, triggerElements, floatingId, nested), createInitialContext2(triggerElements), selectors3); 15831 } 15832 setOpen = (nextOpen, eventDetails) => { 15833 applyPopupOpenChange(this, nextOpen, eventDetails, { 15834 extraState: { 15835 openChangeReason: eventDetails.reason 15836 } 15837 }); 15838 }; 15839 // Used by trigger clicks to clear a delayed hover open without reporting a public open-state change. 15840 cancelPendingOpen(event) { 15841 this.state.floatingRootContext.dispatchOpenChange(false, createChangeEventDetails(reason_parts_exports.triggerPress, event)); 15842 } 15843 }; 15844 function createNullTooltipStore() { 15845 const triggerElements = new PopupTriggerMap(); 15846 const store = new NullStore(Object.freeze(createInitialState2(void 0, triggerElements)), Object.freeze(createInitialContext2(triggerElements)), selectors3); 15847 return Object.assign(store, { 15848 setOpen: NOOP, 15849 cancelPendingOpen: NOOP 15850 }); 15851 } 15852 function createInitialState2(initialState, triggerElements, floatingId, nested = false) { 15853 const state = { 15854 ...createInitialPopupStoreState(triggerElements, floatingId, nested), 15855 disabled: false, 15856 instantType: void 0, 15857 isInstantPhase: false, 15858 trackCursorAxis: "none", 15859 disableHoverablePopup: false, 15860 openChangeReason: null, 15861 closeOnClick: true, 15862 closeDelay: 0, 15863 adaptiveOrigin: void 0, 15864 ...initialState 15865 }; 15866 return state; 15867 } 15868 function createInitialContext2(triggerElements) { 15869 return { 15870 popupRef: /* @__PURE__ */ React107.createRef(), 15871 onOpenChange: void 0, 15872 onOpenChangeComplete: void 0, 15873 triggerElements 15874 }; 15875 } 15876 15877 // node_modules/@base-ui/react/tooltip/root/TooltipRoot.mjs 15878 var import_jsx_runtime61 = __toESM(require_jsx_runtime(), 1); 15879 var TooltipRoot = fastComponent(function TooltipRoot2(props) { 15880 const { 15881 disabled: disabled2 = false, 15882 defaultOpen = false, 15883 open: openProp, 15884 disableHoverablePopup = false, 15885 trackCursorAxis = "none", 15886 actionsRef, 15887 onOpenChange, 15888 onOpenChangeComplete, 15889 handle, 15890 triggerId: triggerIdProp, 15891 defaultTriggerId: defaultTriggerIdProp = null, 15892 children 15893 } = props; 15894 const store = usePopupRootStore((floatingId, nested) => new TooltipStore({ 15895 open: defaultOpen, 15896 openProp, 15897 activeTriggerId: defaultTriggerIdProp, 15898 triggerIdProp 15899 }, floatingId, nested)); 15900 store.useControlledProp("openProp", openProp); 15901 store.useControlledProp("triggerIdProp", triggerIdProp); 15902 store.useContextCallback("onOpenChange", onOpenChange); 15903 store.useContextCallback("onOpenChangeComplete", onOpenChangeComplete); 15904 const openState = store.useState("open"); 15905 const open2 = !disabled2 && openState; 15906 const activeTriggerId = store.useState("activeTriggerId"); 15907 const mounted = store.useState("mounted"); 15908 const payload = store.useState("payload"); 15909 store.useSyncedValues({ 15910 trackCursorAxis, 15911 disableHoverablePopup, 15912 disabled: disabled2 15913 }); 15914 useImplicitActiveTrigger(store, { 15915 closeOnActiveTriggerUnmount: true 15916 }); 15917 const { 15918 forceUnmount, 15919 transitionStatus 15920 } = useOpenStateTransitions(open2, store); 15921 const isInstantPhase = store.useState("isInstantPhase"); 15922 const instantType = store.useState("instantType"); 15923 const lastOpenChangeReason = store.useState("lastOpenChangeReason"); 15924 const previousInstantTypeRef = React108.useRef(null); 15925 useIsoLayoutEffect(() => { 15926 if (openState && disabled2) { 15927 store.setOpen(false, createChangeEventDetails(reason_parts_exports.disabled)); 15928 } 15929 }, [openState, disabled2, store]); 15930 useIsoLayoutEffect(() => { 15931 if (transitionStatus === "ending" && lastOpenChangeReason === reason_parts_exports.none || transitionStatus !== "ending" && isInstantPhase) { 15932 if (instantType !== "delay") { 15933 previousInstantTypeRef.current = instantType; 15934 } 15935 store.set("instantType", "delay"); 15936 } else if (previousInstantTypeRef.current !== null) { 15937 store.set("instantType", previousInstantTypeRef.current); 15938 previousInstantTypeRef.current = null; 15939 } 15940 }, [transitionStatus, isInstantPhase, lastOpenChangeReason, instantType, store]); 15941 useIsoLayoutEffect(() => { 15942 if (open2) { 15943 if (activeTriggerId == null) { 15944 store.set("payload", void 0); 15945 } 15946 } 15947 }, [store, activeTriggerId, open2]); 15948 React108.useImperativeHandle(actionsRef, () => ({ 15949 unmount: forceUnmount, 15950 close: () => store.setOpen(false, createChangeEventDetails(reason_parts_exports.imperativeAction)) 15951 }), [forceUnmount, store]); 15952 const shouldRenderInteractions = open2 || mounted || !disabled2 && trackCursorAxis !== "none"; 15953 return /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)(TooltipRootContext.Provider, { 15954 value: store, 15955 children: [handle && /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(PopupHandleAttachment, { 15956 handle, 15957 store 15958 }), shouldRenderInteractions && /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(TooltipInteractions, { 15959 store, 15960 disabled: disabled2, 15961 trackCursorAxis 15962 }), typeof children === "function" ? children({ 15963 payload 15964 }) : children] 15965 }); 15966 }); 15967 if (true) TooltipRoot.displayName = "TooltipRoot"; 15968 function TooltipInteractions({ 15969 store, 15970 disabled: disabled2, 15971 trackCursorAxis 15972 }) { 15973 const floatingRootContext = store.useState("floatingRootContext"); 15974 const dismiss = useDismiss(floatingRootContext, { 15975 enabled: !disabled2, 15976 referencePress: () => store.select("closeOnClick") 15977 }); 15978 const clientPoint = useClientPoint(floatingRootContext, { 15979 enabled: !disabled2 && trackCursorAxis !== "none", 15980 axis: trackCursorAxis === "none" ? void 0 : trackCursorAxis 15981 }); 15982 const triggerProps = React108.useMemo(() => mergeProps(clientPoint.reference, dismiss.reference), [clientPoint.reference, dismiss.reference]); 15983 usePopupInteractionProps(store, { 15984 activeTriggerProps: triggerProps, 15985 inactiveTriggerProps: triggerProps, 15986 popupProps: dismiss.floating ?? EMPTY_OBJECT 15987 }); 15988 return null; 15989 } 15990 15991 // node_modules/@base-ui/react/tooltip/trigger/TooltipTrigger.mjs 15992 var React110 = __toESM(require_react(), 1); 15993 15994 // node_modules/@base-ui/react/tooltip/provider/TooltipProviderContext.mjs 15995 var React109 = __toESM(require_react(), 1); 15996 var TooltipProviderContext = /* @__PURE__ */ React109.createContext(void 0); 15997 if (true) TooltipProviderContext.displayName = "TooltipProviderContext"; 15998 function useTooltipProviderContext() { 15999 return React109.useContext(TooltipProviderContext); 16000 } 16001 16002 // node_modules/@base-ui/react/tooltip/utils/constants.mjs 16003 var OPEN_DELAY = 600; 16004 16005 // node_modules/@base-ui/react/tooltip/trigger/TooltipTrigger.mjs 16006 var TOOLTIP_TRIGGER_IDENTIFIER = "data-base-ui-tooltip-trigger"; 16007 function getTargetElement(event) { 16008 if ("composedPath" in event) { 16009 const path = event.composedPath(); 16010 for (let i = 0; i < path.length; i += 1) { 16011 const element = path[i]; 16012 if (isElement(element)) { 16013 return element; 16014 } 16015 } 16016 } 16017 const target = event.target; 16018 if (isElement(target)) { 16019 return target; 16020 } 16021 return null; 16022 } 16023 function closestEnabledTooltipTrigger(element) { 16024 let current = element; 16025 while (current) { 16026 const trigger = current.closest(`[$TOOLTIP_TRIGGER_IDENTIFIER}]`); 16027 if (trigger) { 16028 return trigger; 16029 } 16030 const root = current.getRootNode(); 16031 current = "host" in root && isElement(root.host) ? root.host : null; 16032 } 16033 return null; 16034 } 16035 var TooltipTrigger = fastComponentRef(function TooltipTrigger2(componentProps, forwardedRef) { 16036 const { 16037 render: render4, 16038 className, 16039 style, 16040 handle, 16041 payload, 16042 disabled: disabledProp, 16043 delay, 16044 closeOnClick = true, 16045 closeDelay, 16046 id: idProp, 16047 ...elementProps 16048 } = componentProps; 16049 const rootContext = useTooltipRootContext(true); 16050 const handleStore = usePopupHandleStore(handle); 16051 const store = handleStore ?? rootContext; 16052 if (!store) { 16053 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)); 16054 } 16055 const thisTriggerId = useBaseUiId(idProp); 16056 const isTriggerActive = store.useState("isTriggerActive", thisTriggerId); 16057 const isOpenedByThisTrigger = store.useState("isOpenedByTrigger", thisTriggerId); 16058 const floatingRootContext = store.useState("floatingRootContext"); 16059 const triggerElementRef = React110.useRef(null); 16060 const closeDelayWithDefault = closeDelay ?? 0; 16061 const { 16062 registerTrigger, 16063 isMountedByThisTrigger 16064 } = useTriggerDataForwarding(thisTriggerId, triggerElementRef, store, { 16065 payload, 16066 closeOnClick, 16067 closeDelay: closeDelayWithDefault 16068 }); 16069 const providerDelay = useTooltipProviderContext(); 16070 const { 16071 activeIdRef, 16072 delayRef, 16073 isInstantPhase, 16074 hasProvider 16075 } = useDelayGroup(floatingRootContext, { 16076 open: isOpenedByThisTrigger 16077 }); 16078 const hoverInteraction = useHoverInteractionSharedState(floatingRootContext); 16079 store.useSyncedValue("isInstantPhase", isInstantPhase); 16080 const rootDisabled = store.useState("disabled"); 16081 const disabled2 = disabledProp ?? rootDisabled; 16082 const disabledRef = useValueAsRef(disabled2); 16083 const trackCursorAxis = store.useState("trackCursorAxis"); 16084 const disableHoverablePopup = store.useState("disableHoverablePopup"); 16085 const isNestedTriggerHoveredRef = React110.useRef(false); 16086 const nestedTriggerOpenTimeout = useTimeout(); 16087 const pointerTypeRef = React110.useRef(void 0); 16088 function getOpenDelay() { 16089 if (hasProvider && activeIdRef.current != null) { 16090 return 0; 16091 } 16092 return delay ?? providerDelay ?? OPEN_DELAY; 16093 } 16094 function isEnabledNestedTriggerTarget(target) { 16095 const triggerEl = triggerElementRef.current; 16096 if (!triggerEl || !target) { 16097 return false; 16098 } 16099 const nearestTrigger = closestEnabledTooltipTrigger(target); 16100 return nearestTrigger !== null && nearestTrigger !== triggerEl && contains(triggerEl, nearestTrigger); 16101 } 16102 function detectNestedTriggerHover(target) { 16103 const nestedTriggerHovered = isEnabledNestedTriggerTarget(target); 16104 isNestedTriggerHoveredRef.current = nestedTriggerHovered; 16105 if (nestedTriggerHovered) { 16106 hoverInteraction.openChangeTimeout.clear(); 16107 hoverInteraction.restTimeout.clear(); 16108 hoverInteraction.restTimeoutPending = false; 16109 nestedTriggerOpenTimeout.clear(); 16110 } 16111 return nestedTriggerHovered; 16112 } 16113 const hoverProps = useHoverReferenceInteraction(floatingRootContext, { 16114 enabled: !disabled2, 16115 mouseOnly: true, 16116 move: false, 16117 handleClose: !disableHoverablePopup && trackCursorAxis !== "both" ? safePolygon() : null, 16118 restMs: getOpenDelay, 16119 delay() { 16120 if (closeDelay == null && hasProvider) { 16121 return { 16122 close: getDelay(delayRef.current, "close") 16123 }; 16124 } 16125 return { 16126 close: closeDelayWithDefault 16127 }; 16128 }, 16129 triggerElementRef, 16130 isActiveTrigger: isTriggerActive, 16131 isClosing: () => store.select("transitionStatus") === "ending", 16132 shouldOpen() { 16133 return !isNestedTriggerHoveredRef.current; 16134 } 16135 }); 16136 const focusProps = useFocus(floatingRootContext, { 16137 enabled: !disabled2 16138 }).reference; 16139 const handleNestedTriggerHover = (event) => { 16140 const wasNestedTriggerHovered = isNestedTriggerHoveredRef.current; 16141 const target = getTargetElement(event); 16142 const nestedTriggerHovered = detectNestedTriggerHover(target); 16143 const triggerEl = triggerElementRef.current; 16144 const targetInsideTrigger = triggerEl && target && contains(triggerEl, target); 16145 if (nestedTriggerHovered && store.select("open") && store.select("lastOpenChangeReason") === reason_parts_exports.triggerHover) { 16146 store.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerHover, event)); 16147 return; 16148 } 16149 if (wasNestedTriggerHovered && !nestedTriggerHovered && targetInsideTrigger && !disabledRef.current && !store.select("open") && triggerEl && // Match the hover hook's non-strict mouse fallback for mouse-only event sequences. 16150 isMouseLikePointerType(pointerTypeRef.current)) { 16151 const open2 = () => { 16152 if (!isNestedTriggerHoveredRef.current && !disabledRef.current && !store.select("open")) { 16153 store.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerHover, event, triggerEl)); 16154 } 16155 }; 16156 const openDelay = getOpenDelay(); 16157 if (openDelay === 0) { 16158 nestedTriggerOpenTimeout.clear(); 16159 open2(); 16160 } else { 16161 nestedTriggerOpenTimeout.start(openDelay, open2); 16162 } 16163 } 16164 }; 16165 const rootTriggerProps = store.useState("triggerProps", isMountedByThisTrigger); 16166 const shouldApplyRootTriggerProps = isMountedByThisTrigger || trackCursorAxis !== "none"; 16167 const state = { 16168 open: isOpenedByThisTrigger 16169 }; 16170 const element = useRenderElement("button", componentProps, { 16171 state, 16172 ref: [forwardedRef, registerTrigger, triggerElementRef], 16173 props: [hoverProps, focusProps, shouldApplyRootTriggerProps ? rootTriggerProps : void 0, { 16174 onMouseOver(event) { 16175 handleNestedTriggerHover(event.nativeEvent); 16176 }, 16177 onFocus(event) { 16178 if (isEnabledNestedTriggerTarget(getTargetElement(event.nativeEvent))) { 16179 event.preventBaseUIHandler(); 16180 } 16181 }, 16182 onMouseLeave() { 16183 isNestedTriggerHoveredRef.current = false; 16184 nestedTriggerOpenTimeout.clear(); 16185 pointerTypeRef.current = void 0; 16186 }, 16187 onPointerEnter(event) { 16188 pointerTypeRef.current = event.pointerType; 16189 }, 16190 onPointerDown(event) { 16191 pointerTypeRef.current = event.pointerType; 16192 store.set("closeOnClick", closeOnClick); 16193 if (closeOnClick && !store.select("open")) { 16194 store.cancelPendingOpen(event.nativeEvent); 16195 } 16196 }, 16197 onClick(event) { 16198 if (closeOnClick && !store.select("open")) { 16199 store.cancelPendingOpen(event.nativeEvent); 16200 } 16201 }, 16202 id: thisTriggerId, 16203 [triggerDisabled]: disabled2 ? "" : void 0, 16204 [TOOLTIP_TRIGGER_IDENTIFIER]: disabled2 ? void 0 : "" 16205 }, elementProps], 16206 stateAttributesMapping: triggerOpenStateMapping 16207 }); 16208 return element; 16209 }); 16210 if (true) TooltipTrigger.displayName = "TooltipTrigger"; 16211 16212 // node_modules/@base-ui/react/tooltip/portal/TooltipPortal.mjs 16213 var React112 = __toESM(require_react(), 1); 16214 16215 // node_modules/@base-ui/react/tooltip/portal/TooltipPortalContext.mjs 16216 var React111 = __toESM(require_react(), 1); 16217 var TooltipPortalContext = /* @__PURE__ */ React111.createContext(void 0); 16218 if (true) TooltipPortalContext.displayName = "TooltipPortalContext"; 16219 function useTooltipPortalContext() { 16220 const value = React111.useContext(TooltipPortalContext); 16221 if (value === void 0) { 16222 throw new Error(true ? "Base UI: <Tooltip.Portal> is missing." : formatErrorMessage_default(70)); 16223 } 16224 return value; 16225 } 16226 16227 // node_modules/@base-ui/react/tooltip/portal/TooltipPortal.mjs 16228 var import_jsx_runtime62 = __toESM(require_jsx_runtime(), 1); 16229 var TooltipPortal = /* @__PURE__ */ React112.forwardRef(function TooltipPortal2(props, forwardedRef) { 16230 const { 16231 keepMounted = false, 16232 ...portalProps 16233 } = props; 16234 const store = useTooltipRootContext(); 16235 const mounted = store.useState("mounted"); 16236 const shouldRender = mounted || keepMounted; 16237 if (!shouldRender) { 16238 return null; 16239 } 16240 return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(TooltipPortalContext.Provider, { 16241 value: keepMounted, 16242 children: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(FloatingPortalLite, { 16243 ref: forwardedRef, 16244 ...portalProps 16245 }) 16246 }); 16247 }); 16248 if (true) TooltipPortal.displayName = "TooltipPortal"; 16249 16250 // node_modules/@base-ui/react/tooltip/positioner/TooltipPositioner.mjs 16251 var React114 = __toESM(require_react(), 1); 16252 16253 // node_modules/@base-ui/react/tooltip/positioner/TooltipPositionerContext.mjs 16254 var React113 = __toESM(require_react(), 1); 16255 var TooltipPositionerContext = /* @__PURE__ */ React113.createContext(void 0); 16256 if (true) TooltipPositionerContext.displayName = "TooltipPositionerContext"; 16257 function useTooltipPositionerContext() { 16258 const context = React113.useContext(TooltipPositionerContext); 16259 if (context === void 0) { 16260 throw new Error(true ? "Base UI: TooltipPositionerContext is missing. TooltipPositioner parts must be placed within <Tooltip.Positioner>." : formatErrorMessage_default(71)); 16261 } 16262 return context; 16263 } 16264 16265 // node_modules/@base-ui/react/tooltip/positioner/TooltipPositioner.mjs 16266 var import_jsx_runtime63 = __toESM(require_jsx_runtime(), 1); 16267 var TooltipPositioner = /* @__PURE__ */ React114.forwardRef(function TooltipPositioner2(componentProps, forwardedRef) { 16268 const { 16269 render: render4, 16270 className, 16271 anchor, 16272 positionMethod = "absolute", 16273 side = "top", 16274 align = "center", 16275 sideOffset = 0, 16276 alignOffset = 0, 16277 collisionBoundary = "clipping-ancestors", 16278 collisionPadding = 5, 16279 arrowPadding = 5, 16280 sticky = false, 16281 disableAnchorTracking = false, 16282 collisionAvoidance = POPUP_COLLISION_AVOIDANCE, 16283 style, 16284 ...elementProps 16285 } = componentProps; 16286 const store = useTooltipRootContext(); 16287 const keepMounted = useTooltipPortalContext(); 16288 const open2 = store.useState("open"); 16289 const mounted = store.useState("mounted"); 16290 const trackCursorAxis = store.useState("trackCursorAxis"); 16291 const disableHoverablePopup = store.useState("disableHoverablePopup"); 16292 const floatingRootContext = store.useState("floatingRootContext"); 16293 const instantType = store.useState("instantType"); 16294 const transitionStatus = store.useState("transitionStatus"); 16295 const adaptiveOrigin2 = store.useState("adaptiveOrigin"); 16296 const positioning = useAnchorPositioning({ 16297 anchor, 16298 positionMethod, 16299 floatingRootContext, 16300 mounted, 16301 side, 16302 sideOffset, 16303 align, 16304 alignOffset, 16305 collisionBoundary, 16306 collisionPadding, 16307 sticky, 16308 arrowPadding, 16309 disableAnchorTracking, 16310 keepMounted, 16311 collisionAvoidance, 16312 adaptiveOrigin: adaptiveOrigin2 16313 }); 16314 const state = React114.useMemo(() => ({ 16315 open: open2, 16316 side: positioning.side, 16317 align: positioning.align, 16318 anchorHidden: positioning.anchorHidden, 16319 instant: trackCursorAxis !== "none" ? "tracking-cursor" : instantType 16320 }), [open2, positioning.side, positioning.align, positioning.anchorHidden, trackCursorAxis, instantType]); 16321 const element = usePositioner(componentProps, state, { 16322 styles: positioning.positionerStyles, 16323 transitionStatus, 16324 props: elementProps, 16325 refs: [forwardedRef, store.useStateSetter("positionerElement")], 16326 hidden: !mounted, 16327 inert: !open2 || trackCursorAxis === "both" || disableHoverablePopup 16328 }); 16329 return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(TooltipPositionerContext.Provider, { 16330 value: positioning, 16331 children: element 16332 }); 16333 }); 16334 if (true) TooltipPositioner.displayName = "TooltipPositioner"; 16335 16336 // node_modules/@base-ui/react/tooltip/popup/TooltipPopup.mjs 16337 var React115 = __toESM(require_react(), 1); 16338 var TooltipPopup = /* @__PURE__ */ React115.forwardRef(function TooltipPopup2(componentProps, forwardedRef) { 16339 const { 16340 render: render4, 16341 className, 16342 style, 16343 ...elementProps 16344 } = componentProps; 16345 const store = useTooltipRootContext(); 16346 const { 16347 side, 16348 align 16349 } = useTooltipPositionerContext(); 16350 const open2 = store.useState("open"); 16351 const instantType = store.useState("instantType"); 16352 const transitionStatus = store.useState("transitionStatus"); 16353 const popupProps = store.useState("popupProps"); 16354 const floatingContext = store.useState("floatingRootContext"); 16355 const disabled2 = store.useState("disabled"); 16356 const closeDelay = store.useState("closeDelay"); 16357 useOpenChangeComplete({ 16358 open: open2, 16359 ref: store.context.popupRef, 16360 onComplete() { 16361 if (open2) { 16362 store.context.onOpenChangeComplete?.(true); 16363 } 16364 } 16365 }); 16366 useHoverFloatingInteraction(floatingContext, { 16367 enabled: !disabled2, 16368 closeDelay 16369 }); 16370 const setPopupElement = store.useStateSetter("popupElement"); 16371 const state = { 16372 open: open2, 16373 side, 16374 align, 16375 instant: instantType, 16376 transitionStatus 16377 }; 16378 const element = useRenderElement("div", componentProps, { 16379 state, 16380 ref: [forwardedRef, store.context.popupRef, setPopupElement], 16381 props: [FOCUSABLE_POPUP_PROPS, popupProps, getDisabledMountTransitionStyles(transitionStatus), elementProps], 16382 stateAttributesMapping: popupTransitionStateMapping 16383 }); 16384 return element; 16385 }); 16386 if (true) TooltipPopup.displayName = "TooltipPopup"; 16387 16388 // node_modules/@base-ui/react/tooltip/arrow/TooltipArrow.mjs 16389 var React116 = __toESM(require_react(), 1); 16390 var TooltipArrow = /* @__PURE__ */ React116.forwardRef(function TooltipArrow2(componentProps, forwardedRef) { 16391 const { 16392 render: render4, 16393 className, 16394 style, 16395 ...elementProps 16396 } = componentProps; 16397 const store = useTooltipRootContext(); 16398 const { 16399 arrowRef, 16400 side, 16401 align, 16402 arrowUncentered, 16403 arrowStyles 16404 } = useTooltipPositionerContext(); 16405 const open2 = store.useState("open"); 16406 const instantType = store.useState("instantType"); 16407 const state = { 16408 open: open2, 16409 side, 16410 align, 16411 uncentered: arrowUncentered, 16412 instant: instantType 16413 }; 16414 const element = useRenderElement("div", componentProps, { 16415 state, 16416 ref: [forwardedRef, arrowRef], 16417 props: [{ 16418 style: arrowStyles, 16419 "aria-hidden": true 16420 }, elementProps], 16421 stateAttributesMapping: popupStateMapping 16422 }); 16423 return element; 16424 }); 16425 if (true) TooltipArrow.displayName = "TooltipArrow"; 16426 16427 // node_modules/@base-ui/react/tooltip/provider/TooltipProvider.mjs 16428 var React117 = __toESM(require_react(), 1); 16429 var import_jsx_runtime64 = __toESM(require_jsx_runtime(), 1); 16430 var TooltipProvider = function TooltipProvider2(props) { 16431 const { 16432 delay, 16433 closeDelay, 16434 timeout = 400 16435 } = props; 16436 const delayValue = React117.useMemo(() => ({ 16437 open: delay, 16438 close: closeDelay 16439 }), [delay, closeDelay]); 16440 return /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(TooltipProviderContext.Provider, { 16441 value: delay, 16442 children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(FloatingDelayGroup, { 16443 delay: delayValue, 16444 timeoutMs: timeout, 16445 children: props.children 16446 }) 16447 }); 16448 }; 16449 if (true) TooltipProvider.displayName = "TooltipProvider"; 16450 16451 // node_modules/@base-ui/react/tooltip/viewport/TooltipViewport.mjs 16452 var React118 = __toESM(require_react(), 1); 16453 var TooltipViewport = /* @__PURE__ */ React118.forwardRef(function TooltipViewport2(componentProps, forwardedRef) { 16454 const { 16455 render: render4, 16456 className, 16457 style, 16458 children, 16459 ...elementProps 16460 } = componentProps; 16461 const store = useTooltipRootContext(); 16462 const positioner = useTooltipPositionerContext(); 16463 const instantType = store.useState("instantType"); 16464 const { 16465 children: childrenToRender, 16466 state: viewportState 16467 } = usePopupViewport({ 16468 store, 16469 side: positioner.side, 16470 children 16471 }); 16472 const state = { 16473 activationDirection: viewportState.activationDirection, 16474 transitioning: viewportState.transitioning, 16475 instant: instantType 16476 }; 16477 return useRenderElement("div", componentProps, { 16478 state, 16479 ref: forwardedRef, 16480 props: [elementProps, { 16481 children: childrenToRender 16482 }], 16483 stateAttributesMapping: popupViewportStateMapping 16484 }); 16485 }); 16486 if (true) TooltipViewport.displayName = "TooltipViewport"; 16487 16488 // node_modules/@base-ui/react/tooltip/store/TooltipHandle.mjs 16489 var TooltipHandle = class extends BasePopupHandle { 16490 constructor() { 16491 super(createNullTooltipStore(), "Tooltip"); 16492 } 16493 /** 16494 * Opens the tooltip and associates it with the trigger with the given id. 16495 * 16496 * This method should only be called in an event handler or an effect (not during rendering). 16497 * 16498 * @param triggerId ID of the trigger to associate with the tooltip. The trigger must be a matching 16499 * `Tooltip.Trigger` with this handle passed as a prop. 16500 */ 16501 open(triggerId) { 16502 this.openByTrigger(triggerId); 16503 } 16504 /** 16505 * Closes the tooltip. 16506 * 16507 * This method should only be called in an event handler or an effect (not during rendering). 16508 */ 16509 close() { 16510 this.closePopup(); 16511 } 16512 /** 16513 * Whether the tooltip is currently open. Returns `false` while no root is attached to the handle. 16514 */ 16515 get isOpen() { 16516 return this.attachedStore?.select("open") ?? false; 16517 } 16518 }; 16519 function createTooltipHandle() { 16520 return new TooltipHandle(); 16521 } 16522 16523 // node_modules/@base-ui/react/use-render/useRender.mjs 16524 function useRender(params) { 16525 return useRenderElement(params.defaultTagName ?? "div", params, params); 16526 } 16527 16528 // packages/ui/build-module/text/text.mjs 16529 var import_element15 = __toESM(require_element(), 1); 16530 var STYLE_HASH_ATTRIBUTE = "data-wp-hash"; 16531 function getRuntime() { 16532 const globalScope = globalThis; 16533 if (globalScope.__wpStyleRuntime) { 16534 return globalScope.__wpStyleRuntime; 16535 } 16536 globalScope.__wpStyleRuntime = { 16537 documents: /* @__PURE__ */ new Map(), 16538 styles: /* @__PURE__ */ new Map(), 16539 injectedStyles: /* @__PURE__ */ new WeakMap() 16540 }; 16541 if (typeof document !== "undefined") { 16542 registerDocument(document); 16543 } 16544 return globalScope.__wpStyleRuntime; 16545 } 16546 function documentContainsStyleHash(targetDocument, hash) { 16547 if (!targetDocument.head) { 16548 return false; 16549 } 16550 for (const style of targetDocument.head.querySelectorAll( 16551 `style[$STYLE_HASH_ATTRIBUTE}]` 16552 )) { 16553 if (style.getAttribute(STYLE_HASH_ATTRIBUTE) === hash) { 16554 return true; 16555 } 16556 } 16557 return false; 16558 } 16559 function injectStyle(targetDocument, hash, css) { 16560 if (!targetDocument.head) { 16561 return; 16562 } 16563 const runtime = getRuntime(); 16564 let injectedStyles = runtime.injectedStyles.get(targetDocument); 16565 if (!injectedStyles) { 16566 injectedStyles = /* @__PURE__ */ new Set(); 16567 runtime.injectedStyles.set(targetDocument, injectedStyles); 16568 } 16569 if (injectedStyles.has(hash)) { 16570 return; 16571 } 16572 if (documentContainsStyleHash(targetDocument, hash)) { 16573 injectedStyles.add(hash); 16574 return; 16575 } 16576 const style = targetDocument.createElement("style"); 16577 style.setAttribute(STYLE_HASH_ATTRIBUTE, hash); 16578 style.appendChild(targetDocument.createTextNode(css)); 16579 targetDocument.head.appendChild(style); 16580 injectedStyles.add(hash); 16581 } 16582 function registerDocument(targetDocument) { 16583 const runtime = getRuntime(); 16584 runtime.documents.set( 16585 targetDocument, 16586 (runtime.documents.get(targetDocument) ?? 0) + 1 16587 ); 16588 for (const [hash, css] of runtime.styles) { 16589 injectStyle(targetDocument, hash, css); 16590 } 16591 return () => { 16592 const count = runtime.documents.get(targetDocument); 16593 if (count === void 0) { 16594 return; 16595 } 16596 if (count <= 1) { 16597 runtime.documents.delete(targetDocument); 16598 return; 16599 } 16600 runtime.documents.set(targetDocument, count - 1); 16601 }; 16602 } 16603 function registerStyle(hash, css) { 16604 const runtime = getRuntime(); 16605 runtime.styles.set(hash, css); 16606 for (const targetDocument of runtime.documents.keys()) { 16607 injectStyle(targetDocument, hash, css); 16608 } 16609 } 16610 if (typeof process === "undefined" || true) { 16611 registerStyle("3167e7d116", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._83ed8a8da5dd50ea__text{text-wrap:pretty;margin:0}._14437cfb77831647__heading-2xl{--_gcd-heading-font-size:var(--wpds-typography-font-size-2xl,32px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-emphasis,600);--_gcd-p-font-size:var(--wpds-typography-font-size-2xl,32px);--_gcd-p-line-height:var(--wpds-typography-line-height-2xl,40px);font-size:var(--wpds-typography-font-size-2xl,32px);line-height:var(--wpds-typography-line-height-2xl,40px)}._14437cfb77831647__heading-2xl,._3c78b7fa9b4072dd__heading-xl{font-family:var(--wpds-typography-font-family-heading,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-weight:var(--wpds-typography-font-weight-emphasis,600)}._3c78b7fa9b4072dd__heading-xl{--_gcd-heading-font-size:var(--wpds-typography-font-size-xl,20px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-emphasis,600);--_gcd-p-font-size:var(--wpds-typography-font-size-xl,20px);--_gcd-p-line-height:var(--wpds-typography-line-height-md,24px);font-size:var(--wpds-typography-font-size-xl,20px);line-height:var(--wpds-typography-line-height-md,24px)}.aa58f227716bcde2__heading-lg{--_gcd-heading-font-size:var(--wpds-typography-font-size-lg,15px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-emphasis,600);--_gcd-p-font-size:var(--wpds-typography-font-size-lg,15px);--_gcd-p-line-height:var(--wpds-typography-line-height-sm,20px);font-size:var(--wpds-typography-font-size-lg,15px)}.aa58f227716bcde2__heading-lg,.fc4da56d8dfe52c4__heading-md{font-family:var(--wpds-typography-font-family-heading,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-weight:var(--wpds-typography-font-weight-emphasis,600);line-height:var(--wpds-typography-line-height-sm,20px)}.fc4da56d8dfe52c4__heading-md{--_gcd-heading-font-size:var(--wpds-typography-font-size-md,13px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-emphasis,600);--_gcd-p-font-size:var(--wpds-typography-font-size-md,13px);--_gcd-p-line-height:var(--wpds-typography-line-height-sm,20px);font-size:var(--wpds-typography-font-size-md,13px)}.a9b78c7c82e8dff7__heading-sm{--_gcd-heading-font-size:var(--wpds-typography-font-size-xs,11px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-emphasis,600);--_gcd-p-font-size:var(--wpds-typography-font-size-xs,11px);--_gcd-p-line-height:var(--wpds-typography-line-height-xs,16px);font-family:var(--wpds-typography-font-family-heading,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wpds-typography-font-size-xs,11px);font-weight:var(--wpds-typography-font-weight-emphasis,600);line-height:var(--wpds-typography-line-height-xs,16px);text-transform:uppercase}._305ff559e52180d5__body-xl{--_gcd-heading-font-size:var(--wpds-typography-font-size-xl,20px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-default,400);--_gcd-p-font-size:var(--wpds-typography-font-size-xl,20px);--_gcd-p-line-height:var(--wpds-typography-line-height-xl,32px);font-size:var(--wpds-typography-font-size-xl,20px);line-height:var(--wpds-typography-line-height-xl,32px)}._305ff559e52180d5__body-xl,.ca1aa3fc2029e958__body-lg{font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-weight:var(--wpds-typography-font-weight-default,400)}.ca1aa3fc2029e958__body-lg{--_gcd-heading-font-size:var(--wpds-typography-font-size-lg,15px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-default,400);--_gcd-p-font-size:var(--wpds-typography-font-size-lg,15px);--_gcd-p-line-height:var(--wpds-typography-line-height-md,24px);font-size:var(--wpds-typography-font-size-lg,15px);line-height:var(--wpds-typography-line-height-md,24px)}._131101940be12424__body-md{--_gcd-heading-font-size:var(--wpds-typography-font-size-md,13px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-default,400);--_gcd-p-font-size:var(--wpds-typography-font-size-md,13px);--_gcd-p-line-height:var(--wpds-typography-line-height-sm,20px);font-size:var(--wpds-typography-font-size-md,13px);line-height:var(--wpds-typography-line-height-sm,20px)}._0e8d87a42c1f75fa__body-sm,._131101940be12424__body-md{font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-weight:var(--wpds-typography-font-weight-default,400)}._0e8d87a42c1f75fa__body-sm{--_gcd-heading-font-size:var(--wpds-typography-font-size-sm,12px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-default,400);--_gcd-p-font-size:var(--wpds-typography-font-size-sm,12px);--_gcd-p-line-height:var(--wpds-typography-line-height-xs,16px);font-size:var(--wpds-typography-font-size-sm,12px);line-height:var(--wpds-typography-line-height-xs,16px)}}}'); 16612 } 16613 var style_default = { "text": "_83ed8a8da5dd50ea__text", "heading-2xl": "_14437cfb77831647__heading-2xl", "heading-xl": "_3c78b7fa9b4072dd__heading-xl", "heading-lg": "aa58f227716bcde2__heading-lg", "heading-md": "fc4da56d8dfe52c4__heading-md", "heading-sm": "a9b78c7c82e8dff7__heading-sm", "body-xl": "_305ff559e52180d5__body-xl", "body-lg": "ca1aa3fc2029e958__body-lg", "body-md": "_131101940be12424__body-md", "body-sm": "_0e8d87a42c1f75fa__body-sm" }; 16614 if (typeof process === "undefined" || true) { 16615 registerStyle("e8e31009f5", "._6defc79820e382c6__button{box-sizing:var(--_gcd-button-box-sizing,border-box);font-family:var(--_gcd-button-font-family,inherit);font-size:var(--_gcd-button-font-size,inherit);font-weight:var(--_gcd-button-font-weight,inherit)}.d2cff2e5dea83bd1__input{box-sizing:var(--_gcd-input-box-sizing,border-box);font-family:var(--_gcd-input-font-family,inherit);font-size:var(--_gcd-input-font-size,inherit);font-weight:var(--_gcd-input-font-weight,inherit);margin:var(--_gcd-input-margin,0);&::placeholder{color:var(--_gcd-input-placeholder-color,var(--wpds-color-foreground-interactive-neutral-weak,#707070))}&:is(textarea,[type=text],[type=password],[type=color],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){background-color:var(--_gcd-input-background-color,transparent);border:var(--_gcd-input-border,none);border-radius:var(--_gcd-input-border-radius,0);box-shadow:var(--_gcd-input-box-shadow,0 0 0 transparent);color:var(--_gcd-input-color,var(--wpds-color-foreground-interactive-neutral,#1e1e1e));&:focus{border-color:var(--_gcd-input-border-color-focus,var(--wp-admin-theme-color));box-shadow:var(--_gcd-input-box-shadow-focus,none);outline:var(--_gcd-input-outline-focus,none)}&:disabled{background:var(--_gcd-input-background-disabled,transparent);border-color:var(--_gcd-input-border-color-disabled,transparent);box-shadow:var(--_gcd-input-box-shadow-disabled,none);color:var(--_gcd-input-color-disabled,var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d))}}&:is(textarea,[type=text],[type=password],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){line-height:var(--_gcd-input-line-height,inherit);min-height:var(--_gcd-input-min-height,auto);padding:var(--_gcd-input-padding,0)}}._547d86373d02e108__textarea{box-sizing:var(--_gcd-textarea-box-sizing,border-box);overflow:var(--_gcd-textarea-overflow,auto);resize:var(--_gcd-textarea-resize,block)}._8c15fd0ed9f28ba4__div{outline:var(--_gcd-div-outline,0 solid transparent)}p._43cec3e1eec1066d__p{font-size:var(--_gcd-p-font-size,13px);line-height:var(--_gcd-p-line-height,1.5);margin:var(--_gcd-p-margin,0)}:is(h1,h2,h3,h4,h5,h6).e97669c6d9a38497__heading{color:var(--_gcd-heading-color,var(--wpds-color-foreground-content-neutral,#1e1e1e));font-size:var(--_gcd-heading-font-size,inherit);font-weight:var(--_gcd-heading-font-weight,var(--wpds-typography-font-weight-emphasis,600));margin:var(--_gcd-heading-margin,0)}._2c0831b0499dbd6e__a,._2c0831b0499dbd6e__a:is(:hover,:focus,:active){border-radius:var(--_gcd-a-border-radius,0);box-shadow:var(--_gcd-a-box-shadow,none);color:var(--_gcd-a-color,inherit);outline:var(--_gcd-a-outline,0 solid transparent);transition:var(--_gcd-a-transition,none)}.c59a0ebebd71fa4a__ol{list-style:var(--_gcd-ol-list-style,none);margin:var(--_gcd-ol-margin,0);padding-block:var(--_gcd-ol-padding-block,0);padding-inline:var(--_gcd-ol-padding-inline,0)}._46b5cb0c8e24e8c9__li{margin:var(--_gcd-li-margin,0)}"); 16616 } 16617 var global_css_defense_default = { "button": "_6defc79820e382c6__button", "input": "d2cff2e5dea83bd1__input", "textarea": "_547d86373d02e108__textarea", "div": "_8c15fd0ed9f28ba4__div", "p": "_43cec3e1eec1066d__p", "heading": "e97669c6d9a38497__heading", "a": "_2c0831b0499dbd6e__a", "ol": "c59a0ebebd71fa4a__ol", "li": "_46b5cb0c8e24e8c9__li" }; 16618 var Text = (0, import_element15.forwardRef)(function Text2({ variant = "body-md", render: render4, className, ...props }, ref) { 16619 const element = useRender({ 16620 render: render4, 16621 defaultTagName: "span", 16622 ref, 16623 props: mergeProps(props, { 16624 className: clsx_default( 16625 style_default.text, 16626 global_css_defense_default.heading, 16627 global_css_defense_default.p, 16628 style_default[variant], 16629 className 16630 ) 16631 }) 16632 }); 16633 return element; 16634 }); 16635 16636 // packages/ui/build-module/badge/badge.mjs 16637 var import_jsx_runtime65 = __toESM(require_jsx_runtime(), 1); 16638 var STYLE_HASH_ATTRIBUTE2 = "data-wp-hash"; 16639 function getRuntime2() { 16640 const globalScope = globalThis; 16641 if (globalScope.__wpStyleRuntime) { 16642 return globalScope.__wpStyleRuntime; 16643 } 16644 globalScope.__wpStyleRuntime = { 16645 documents: /* @__PURE__ */ new Map(), 16646 styles: /* @__PURE__ */ new Map(), 16647 injectedStyles: /* @__PURE__ */ new WeakMap() 16648 }; 16649 if (typeof document !== "undefined") { 16650 registerDocument2(document); 16651 } 16652 return globalScope.__wpStyleRuntime; 16653 } 16654 function documentContainsStyleHash2(targetDocument, hash) { 16655 if (!targetDocument.head) { 16656 return false; 16657 } 16658 for (const style of targetDocument.head.querySelectorAll( 16659 `style[$STYLE_HASH_ATTRIBUTE2}]` 16660 )) { 16661 if (style.getAttribute(STYLE_HASH_ATTRIBUTE2) === hash) { 16662 return true; 16663 } 16664 } 16665 return false; 16666 } 16667 function injectStyle2(targetDocument, hash, css) { 16668 if (!targetDocument.head) { 16669 return; 16670 } 16671 const runtime = getRuntime2(); 16672 let injectedStyles = runtime.injectedStyles.get(targetDocument); 16673 if (!injectedStyles) { 16674 injectedStyles = /* @__PURE__ */ new Set(); 16675 runtime.injectedStyles.set(targetDocument, injectedStyles); 16676 } 16677 if (injectedStyles.has(hash)) { 16678 return; 16679 } 16680 if (documentContainsStyleHash2(targetDocument, hash)) { 16681 injectedStyles.add(hash); 16682 return; 16683 } 16684 const style = targetDocument.createElement("style"); 16685 style.setAttribute(STYLE_HASH_ATTRIBUTE2, hash); 16686 style.appendChild(targetDocument.createTextNode(css)); 16687 targetDocument.head.appendChild(style); 16688 injectedStyles.add(hash); 16689 } 16690 function registerDocument2(targetDocument) { 16691 const runtime = getRuntime2(); 16692 runtime.documents.set( 16693 targetDocument, 16694 (runtime.documents.get(targetDocument) ?? 0) + 1 16695 ); 16696 for (const [hash, css] of runtime.styles) { 16697 injectStyle2(targetDocument, hash, css); 16698 } 16699 return () => { 16700 const count = runtime.documents.get(targetDocument); 16701 if (count === void 0) { 16702 return; 16703 } 16704 if (count <= 1) { 16705 runtime.documents.delete(targetDocument); 16706 return; 16707 } 16708 runtime.documents.set(targetDocument, count - 1); 16709 }; 16710 } 16711 function registerStyle2(hash, css) { 16712 const runtime = getRuntime2(); 16713 runtime.styles.set(hash, css); 16714 for (const targetDocument of runtime.documents.keys()) { 16715 injectStyle2(targetDocument, hash, css); 16716 } 16717 } 16718 if (typeof process === "undefined" || true) { 16719 registerStyle2("40ea4a6382", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._96e6251aad1a6136__badge{border-radius:var(--wpds-border-radius-lg,8px);padding-block:var(--wpds-dimension-padding-xs,4px);padding-inline:var(--wpds-dimension-padding-sm,8px)}._99f7158cb520f750__is-high-intent{background-color:var(--wpds-color-background-surface-error,#fae5e1);color:var(--wpds-color-foreground-content-error,#470000)}.c20ebef2365bc8b7__is-medium-intent{background-color:var(--wpds-color-background-surface-warning,#fde6be);color:var(--wpds-color-foreground-content-warning,#2e1900)}._365e1626c6202e52__is-low-intent{background-color:var(--wpds-color-background-surface-caution,#fee995);color:var(--wpds-color-foreground-content-caution,#281d00)}._33f8198127ddf4ef__is-stable-intent{background-color:var(--wpds-color-background-surface-success,#c2f8ca);color:var(--wpds-color-foreground-content-success,#002900)}._04c1aca8fc449412__is-informational-intent{background-color:var(--wpds-color-background-surface-info,#deebfa);color:var(--wpds-color-foreground-content-info,#001b4f)}._90726e69d495ec19__is-draft-intent{background-color:var(--wpds-color-background-surface-neutral-weak,#f4f4f4);color:var(--wpds-color-foreground-content-neutral,#1e1e1e)}._898f4a544993bd39__is-none-intent{background-color:var(--wpds-color-background-surface-neutral-strong,#fff);border:var(--wpds-border-width-xs,1px) solid var(--wpds-color-stroke-surface-neutral,#dbdbdb);color:var(--wpds-color-foreground-content-neutral,#1e1e1e);padding-block:calc(var(--wpds-dimension-padding-xs, 4px) - var(--wpds-border-width-xs, 1px));padding-inline:calc(var(--wpds-dimension-padding-sm, 8px) - var(--wpds-border-width-xs, 1px))}}}"); 16720 } 16721 var style_default2 = { "badge": "_96e6251aad1a6136__badge", "is-high-intent": "_99f7158cb520f750__is-high-intent", "is-medium-intent": "c20ebef2365bc8b7__is-medium-intent", "is-low-intent": "_365e1626c6202e52__is-low-intent", "is-stable-intent": "_33f8198127ddf4ef__is-stable-intent", "is-informational-intent": "_04c1aca8fc449412__is-informational-intent", "is-draft-intent": "_90726e69d495ec19__is-draft-intent", "is-none-intent": "_898f4a544993bd39__is-none-intent" }; 16722 var Badge = (0, import_element16.forwardRef)(function Badge2({ intent = "none", className, ...props }, ref) { 16723 return /* @__PURE__ */ (0, import_jsx_runtime65.jsx)( 16724 Text, 16725 { 16726 ref, 16727 className: clsx_default( 16728 style_default2.badge, 16729 style_default2[`is-$intent}-intent`], 16730 className 16731 ), 16732 ...props, 16733 variant: "body-sm" 16734 } 16735 ); 16736 }); 16737 16738 // packages/ui/build-module/tooltip/index.mjs 16739 var tooltip_exports = {}; 16740 __export(tooltip_exports, { 16741 Popup: () => Popup, 16742 Portal: () => Portal, 16743 Positioner: () => Positioner, 16744 Provider: () => Provider, 16745 Root: () => Root, 16746 Trigger: () => Trigger 16747 }); 16748 16749 // packages/ui/build-module/tooltip/popup.mjs 16750 var import_element20 = __toESM(require_element(), 1); 16751 16752 // packages/ui/build-module/tooltip/portal.mjs 16753 var import_element17 = __toESM(require_element(), 1); 16754 16755 // packages/ui/build-module/utils/wp-compat-overlay-slot.mjs 16756 var STYLE_HASH_ATTRIBUTE3 = "data-wp-hash"; 16757 function getRuntime3() { 16758 const globalScope = globalThis; 16759 if (globalScope.__wpStyleRuntime) { 16760 return globalScope.__wpStyleRuntime; 16761 } 16762 globalScope.__wpStyleRuntime = { 16763 documents: /* @__PURE__ */ new Map(), 16764 styles: /* @__PURE__ */ new Map(), 16765 injectedStyles: /* @__PURE__ */ new WeakMap() 16766 }; 16767 if (typeof document !== "undefined") { 16768 registerDocument3(document); 16769 } 16770 return globalScope.__wpStyleRuntime; 16771 } 16772 function documentContainsStyleHash3(targetDocument, hash) { 16773 if (!targetDocument.head) { 16774 return false; 16775 } 16776 for (const style of targetDocument.head.querySelectorAll( 16777 `style[$STYLE_HASH_ATTRIBUTE3}]` 16778 )) { 16779 if (style.getAttribute(STYLE_HASH_ATTRIBUTE3) === hash) { 16780 return true; 16781 } 16782 } 16783 return false; 16784 } 16785 function injectStyle3(targetDocument, hash, css) { 16786 if (!targetDocument.head) { 16787 return; 16788 } 16789 const runtime = getRuntime3(); 16790 let injectedStyles = runtime.injectedStyles.get(targetDocument); 16791 if (!injectedStyles) { 16792 injectedStyles = /* @__PURE__ */ new Set(); 16793 runtime.injectedStyles.set(targetDocument, injectedStyles); 16794 } 16795 if (injectedStyles.has(hash)) { 16796 return; 16797 } 16798 if (documentContainsStyleHash3(targetDocument, hash)) { 16799 injectedStyles.add(hash); 16800 return; 16801 } 16802 const style = targetDocument.createElement("style"); 16803 style.setAttribute(STYLE_HASH_ATTRIBUTE3, hash); 16804 style.appendChild(targetDocument.createTextNode(css)); 16805 targetDocument.head.appendChild(style); 16806 injectedStyles.add(hash); 16807 } 16808 function registerDocument3(targetDocument) { 16809 const runtime = getRuntime3(); 16810 runtime.documents.set( 16811 targetDocument, 16812 (runtime.documents.get(targetDocument) ?? 0) + 1 16813 ); 16814 for (const [hash, css] of runtime.styles) { 16815 injectStyle3(targetDocument, hash, css); 16816 } 16817 return () => { 16818 const count = runtime.documents.get(targetDocument); 16819 if (count === void 0) { 16820 return; 16821 } 16822 if (count <= 1) { 16823 runtime.documents.delete(targetDocument); 16824 return; 16825 } 16826 runtime.documents.set(targetDocument, count - 1); 16827 }; 16828 } 16829 function registerStyle3(hash, css) { 16830 const runtime = getRuntime3(); 16831 runtime.styles.set(hash, css); 16832 for (const targetDocument of runtime.documents.keys()) { 16833 injectStyle3(targetDocument, hash, css); 16834 } 16835 } 16836 if (typeof process === "undefined" || true) { 16837 registerStyle3("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}}}"); 16838 } 16839 var wp_compat_overlay_slot_default = { "slot": "_11fc52b637ff8a7e__slot" }; 16840 var WP_COMPAT_OVERLAY_SLOT_ATTRIBUTE = "data-wp-compat-overlay-slot"; 16841 function resolveOwnerDocument() { 16842 return typeof document === "undefined" ? null : document; 16843 } 16844 function isInWordPressEnvironment() { 16845 let topWp; 16846 try { 16847 topWp = window.top?.wp; 16848 } catch { 16849 } 16850 const wp = topWp ?? window.wp; 16851 return typeof wp?.components === "object" && wp.components !== null; 16852 } 16853 var cachedSlot = null; 16854 function ensureSlotIsAccessible(element) { 16855 element.setAttribute("aria-hidden", "false"); 16856 return element; 16857 } 16858 function createSlot(ownerDocument2) { 16859 const element = ownerDocument2.createElement("div"); 16860 element.setAttribute(WP_COMPAT_OVERLAY_SLOT_ATTRIBUTE, ""); 16861 if (wp_compat_overlay_slot_default.slot) { 16862 element.classList.add(wp_compat_overlay_slot_default.slot); 16863 } 16864 ownerDocument2.body.appendChild(element); 16865 return element; 16866 } 16867 function getWpCompatOverlaySlot() { 16868 if (typeof window === "undefined") { 16869 return void 0; 16870 } 16871 if (!isInWordPressEnvironment() && window.__wpUiCompatOverlaySlotEnabled !== true) { 16872 return void 0; 16873 } 16874 const ownerDocument2 = resolveOwnerDocument(); 16875 if (!ownerDocument2 || !ownerDocument2.body) { 16876 return void 0; 16877 } 16878 if (cachedSlot && cachedSlot.ownerDocument === ownerDocument2 && cachedSlot.isConnected) { 16879 return ensureSlotIsAccessible(cachedSlot); 16880 } 16881 const existing = ownerDocument2.querySelector( 16882 `[$WP_COMPAT_OVERLAY_SLOT_ATTRIBUTE}]` 16883 ); 16884 if (existing instanceof HTMLDivElement) { 16885 cachedSlot = ensureSlotIsAccessible(existing); 16886 return cachedSlot; 16887 } 16888 if (cachedSlot?.isConnected) { 16889 cachedSlot.remove(); 16890 } 16891 cachedSlot = ensureSlotIsAccessible(createSlot(ownerDocument2)); 16892 return cachedSlot; 16893 } 16894 16895 // packages/ui/build-module/tooltip/portal.mjs 16896 var import_jsx_runtime66 = __toESM(require_jsx_runtime(), 1); 16897 var Portal = (0, import_element17.forwardRef)( 16898 function TooltipPortal3({ container, ...restProps }, ref) { 16899 return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)( 16900 index_parts_exports3.Portal, 16901 { 16902 container: container ?? getWpCompatOverlaySlot(), 16903 ...restProps, 16904 ref 16905 } 16906 ); 16907 } 16908 ); 16909 16910 // packages/ui/build-module/tooltip/positioner.mjs 16911 var import_element18 = __toESM(require_element(), 1); 16912 var import_jsx_runtime67 = __toESM(require_jsx_runtime(), 1); 16913 var STYLE_HASH_ATTRIBUTE4 = "data-wp-hash"; 16914 function getRuntime4() { 16915 const globalScope = globalThis; 16916 if (globalScope.__wpStyleRuntime) { 16917 return globalScope.__wpStyleRuntime; 16918 } 16919 globalScope.__wpStyleRuntime = { 16920 documents: /* @__PURE__ */ new Map(), 16921 styles: /* @__PURE__ */ new Map(), 16922 injectedStyles: /* @__PURE__ */ new WeakMap() 16923 }; 16924 if (typeof document !== "undefined") { 16925 registerDocument4(document); 16926 } 16927 return globalScope.__wpStyleRuntime; 16928 } 16929 function documentContainsStyleHash4(targetDocument, hash) { 16930 if (!targetDocument.head) { 16931 return false; 16932 } 16933 for (const style of targetDocument.head.querySelectorAll( 16934 `style[$STYLE_HASH_ATTRIBUTE4}]` 16935 )) { 16936 if (style.getAttribute(STYLE_HASH_ATTRIBUTE4) === hash) { 16937 return true; 16938 } 16939 } 16940 return false; 16941 } 16942 function injectStyle4(targetDocument, hash, css) { 16943 if (!targetDocument.head) { 16944 return; 16945 } 16946 const runtime = getRuntime4(); 16947 let injectedStyles = runtime.injectedStyles.get(targetDocument); 16948 if (!injectedStyles) { 16949 injectedStyles = /* @__PURE__ */ new Set(); 16950 runtime.injectedStyles.set(targetDocument, injectedStyles); 16951 } 16952 if (injectedStyles.has(hash)) { 16953 return; 16954 } 16955 if (documentContainsStyleHash4(targetDocument, hash)) { 16956 injectedStyles.add(hash); 16957 return; 16958 } 16959 const style = targetDocument.createElement("style"); 16960 style.setAttribute(STYLE_HASH_ATTRIBUTE4, hash); 16961 style.appendChild(targetDocument.createTextNode(css)); 16962 targetDocument.head.appendChild(style); 16963 injectedStyles.add(hash); 16964 } 16965 function registerDocument4(targetDocument) { 16966 const runtime = getRuntime4(); 16967 runtime.documents.set( 16968 targetDocument, 16969 (runtime.documents.get(targetDocument) ?? 0) + 1 16970 ); 16971 for (const [hash, css] of runtime.styles) { 16972 injectStyle4(targetDocument, hash, css); 16973 } 16974 return () => { 16975 const count = runtime.documents.get(targetDocument); 16976 if (count === void 0) { 16977 return; 16978 } 16979 if (count <= 1) { 16980 runtime.documents.delete(targetDocument); 16981 return; 16982 } 16983 runtime.documents.set(targetDocument, count - 1); 16984 }; 16985 } 16986 function registerStyle4(hash, css) { 16987 const runtime = getRuntime4(); 16988 runtime.styles.set(hash, css); 16989 for (const targetDocument of runtime.documents.keys()) { 16990 injectStyle4(targetDocument, hash, css); 16991 } 16992 } 16993 if (typeof process === "undefined" || true) { 16994 registerStyle4("10f3806643", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._336cd3e4e743482f__box-sizing{box-sizing:border-box;*,:after,:before{box-sizing:inherit}}}}"); 16995 } 16996 var resets_default = { "box-sizing": "_336cd3e4e743482f__box-sizing" }; 16997 if (typeof process === "undefined" || true) { 16998 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}}}}'); 16999 } 17000 var style_default3 = { "positioner": "_480b748dd3510e64__positioner", "popup": "_50096b232db7709d__popup" }; 17001 var Positioner = (0, import_element18.forwardRef)( 17002 function TooltipPositioner3({ align = "center", className, side = "top", sideOffset = 4, ...props }, ref) { 17003 return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)( 17004 index_parts_exports3.Positioner, 17005 { 17006 ref, 17007 align, 17008 side, 17009 sideOffset, 17010 ...props, 17011 className: clsx_default( 17012 resets_default["box-sizing"], 17013 style_default3.positioner, 17014 className 17015 ) 17016 } 17017 ); 17018 } 17019 ); 17020 17021 // packages/ui/build-module/utils/render-slot-with-children.mjs 17022 var import_element19 = __toESM(require_element(), 1); 17023 function renderSlotWithChildren(slot, defaultSlot, children) { 17024 return (0, import_element19.cloneElement)(slot ?? defaultSlot, { children }); 17025 } 17026 17027 // packages/ui/build-module/utils/theme-provider.mjs 17028 var theme = __toESM(require_theme(), 1); 17029 17030 // packages/ui/build-module/lock-unlock.mjs 17031 var import_private_apis = __toESM(require_private_apis(), 1); 17032 var { lock, unlock } = (0, import_private_apis.__dangerousOptInToUnstableAPIsOnlyForCoreModules)( 17033 "I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.", 17034 "@wordpress/ui" 17035 ); 17036 17037 // packages/ui/build-module/utils/theme-provider.mjs 17038 function getThemeProvider() { 17039 const themePackage = theme; 17040 if (themePackage.ThemeProvider) { 17041 return themePackage.ThemeProvider; 17042 } 17043 if (!themePackage.privateApis) { 17044 throw new Error( 17045 "@wordpress/ui: @wordpress/theme must expose `ThemeProvider` or `privateApis.ThemeProvider`." 17046 ); 17047 } 17048 return unlock( 17049 themePackage.privateApis 17050 ).ThemeProvider; 17051 } 17052 var ThemeProvider = getThemeProvider(); 17053 17054 // packages/ui/build-module/tooltip/popup.mjs 17055 var import_jsx_runtime68 = __toESM(require_jsx_runtime(), 1); 17056 var STYLE_HASH_ATTRIBUTE5 = "data-wp-hash"; 17057 function getRuntime5() { 17058 const globalScope = globalThis; 17059 if (globalScope.__wpStyleRuntime) { 17060 return globalScope.__wpStyleRuntime; 17061 } 17062 globalScope.__wpStyleRuntime = { 17063 documents: /* @__PURE__ */ new Map(), 17064 styles: /* @__PURE__ */ new Map(), 17065 injectedStyles: /* @__PURE__ */ new WeakMap() 17066 }; 17067 if (typeof document !== "undefined") { 17068 registerDocument5(document); 17069 } 17070 return globalScope.__wpStyleRuntime; 17071 } 17072 function documentContainsStyleHash5(targetDocument, hash) { 17073 if (!targetDocument.head) { 17074 return false; 17075 } 17076 for (const style of targetDocument.head.querySelectorAll( 17077 `style[$STYLE_HASH_ATTRIBUTE5}]` 17078 )) { 17079 if (style.getAttribute(STYLE_HASH_ATTRIBUTE5) === hash) { 17080 return true; 17081 } 17082 } 17083 return false; 17084 } 17085 function injectStyle5(targetDocument, hash, css) { 17086 if (!targetDocument.head) { 17087 return; 17088 } 17089 const runtime = getRuntime5(); 17090 let injectedStyles = runtime.injectedStyles.get(targetDocument); 17091 if (!injectedStyles) { 17092 injectedStyles = /* @__PURE__ */ new Set(); 17093 runtime.injectedStyles.set(targetDocument, injectedStyles); 17094 } 17095 if (injectedStyles.has(hash)) { 17096 return; 17097 } 17098 if (documentContainsStyleHash5(targetDocument, hash)) { 17099 injectedStyles.add(hash); 17100 return; 17101 } 17102 const style = targetDocument.createElement("style"); 17103 style.setAttribute(STYLE_HASH_ATTRIBUTE5, hash); 17104 style.appendChild(targetDocument.createTextNode(css)); 17105 targetDocument.head.appendChild(style); 17106 injectedStyles.add(hash); 17107 } 17108 function registerDocument5(targetDocument) { 17109 const runtime = getRuntime5(); 17110 runtime.documents.set( 17111 targetDocument, 17112 (runtime.documents.get(targetDocument) ?? 0) + 1 17113 ); 17114 for (const [hash, css] of runtime.styles) { 17115 injectStyle5(targetDocument, hash, css); 17116 } 17117 return () => { 17118 const count = runtime.documents.get(targetDocument); 17119 if (count === void 0) { 17120 return; 17121 } 17122 if (count <= 1) { 17123 runtime.documents.delete(targetDocument); 17124 return; 17125 } 17126 runtime.documents.set(targetDocument, count - 1); 17127 }; 17128 } 17129 function registerStyle5(hash, css) { 17130 const runtime = getRuntime5(); 17131 runtime.styles.set(hash, css); 17132 for (const targetDocument of runtime.documents.keys()) { 17133 injectStyle5(targetDocument, hash, css); 17134 } 17135 } 17136 if (typeof process === "undefined" || true) { 17137 registerStyle5("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}}}}'); 17138 } 17139 var style_default4 = { "positioner": "_480b748dd3510e64__positioner", "popup": "_50096b232db7709d__popup" }; 17140 var POPUP_COLOR = { background: "#1e1e1e" }; 17141 var Popup = (0, import_element20.forwardRef)(function TooltipPopup3({ portal, positioner, children, className, ...props }, ref) { 17142 const popupContent = /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(ThemeProvider, { color: POPUP_COLOR, children: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)( 17143 index_parts_exports3.Popup, 17144 { 17145 ref, 17146 className: clsx_default(style_default4.popup, className), 17147 ...props, 17148 children 17149 } 17150 ) }); 17151 const positionedPopup = renderSlotWithChildren( 17152 positioner, 17153 /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(Positioner, {}), 17154 popupContent 17155 ); 17156 return renderSlotWithChildren(portal, /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(Portal, {}), positionedPopup); 17157 }); 17158 17159 // packages/ui/build-module/tooltip/trigger.mjs 17160 var import_element21 = __toESM(require_element(), 1); 17161 var import_jsx_runtime69 = __toESM(require_jsx_runtime(), 1); 17162 var Trigger = (0, import_element21.forwardRef)( 17163 function TooltipTrigger3(props, ref) { 17164 return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(index_parts_exports3.Trigger, { ref, ...props }); 17165 } 17166 ); 17167 17168 // packages/ui/build-module/utils/direction-provider.mjs 17169 var import_i18n7 = __toESM(require_i18n(), 1); 17170 var import_jsx_runtime70 = __toESM(require_jsx_runtime(), 1); 17171 function DirectionProvider3({ children }) { 17172 return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(DirectionProvider, { direction: (0, import_i18n7.isRTL)() ? "rtl" : "ltr", children }); 17173 } 17174 17175 // packages/ui/build-module/tooltip/root.mjs 17176 var import_jsx_runtime71 = __toESM(require_jsx_runtime(), 1); 17177 function Root(props) { 17178 return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(DirectionProvider3, { children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(index_parts_exports3.Root, { ...props }) }); 17179 } 17180 17181 // packages/ui/build-module/tooltip/provider.mjs 17182 var import_jsx_runtime72 = __toESM(require_jsx_runtime(), 1); 17183 function Provider({ ...props }) { 17184 return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(index_parts_exports3.Provider, { ...props }); 17185 } 17186 17187 // packages/ui/build-module/link/link.mjs 17188 var import_element22 = __toESM(require_element(), 1); 17189 var import_i18n8 = __toESM(require_i18n(), 1); 17190 var import_jsx_runtime73 = __toESM(require_jsx_runtime(), 1); 17191 var STYLE_HASH_ATTRIBUTE6 = "data-wp-hash"; 17192 function getRuntime6() { 17193 const globalScope = globalThis; 17194 if (globalScope.__wpStyleRuntime) { 17195 return globalScope.__wpStyleRuntime; 17196 } 17197 globalScope.__wpStyleRuntime = { 17198 documents: /* @__PURE__ */ new Map(), 17199 styles: /* @__PURE__ */ new Map(), 17200 injectedStyles: /* @__PURE__ */ new WeakMap() 17201 }; 17202 if (typeof document !== "undefined") { 17203 registerDocument6(document); 17204 } 17205 return globalScope.__wpStyleRuntime; 17206 } 17207 function documentContainsStyleHash6(targetDocument, hash) { 17208 if (!targetDocument.head) { 17209 return false; 17210 } 17211 for (const style of targetDocument.head.querySelectorAll( 17212 `style[$STYLE_HASH_ATTRIBUTE6}]` 17213 )) { 17214 if (style.getAttribute(STYLE_HASH_ATTRIBUTE6) === hash) { 17215 return true; 17216 } 17217 } 17218 return false; 17219 } 17220 function injectStyle6(targetDocument, hash, css) { 17221 if (!targetDocument.head) { 17222 return; 17223 } 17224 const runtime = getRuntime6(); 17225 let injectedStyles = runtime.injectedStyles.get(targetDocument); 17226 if (!injectedStyles) { 17227 injectedStyles = /* @__PURE__ */ new Set(); 17228 runtime.injectedStyles.set(targetDocument, injectedStyles); 17229 } 17230 if (injectedStyles.has(hash)) { 17231 return; 17232 } 17233 if (documentContainsStyleHash6(targetDocument, hash)) { 17234 injectedStyles.add(hash); 17235 return; 17236 } 17237 const style = targetDocument.createElement("style"); 17238 style.setAttribute(STYLE_HASH_ATTRIBUTE6, hash); 17239 style.appendChild(targetDocument.createTextNode(css)); 17240 targetDocument.head.appendChild(style); 17241 injectedStyles.add(hash); 17242 } 17243 function registerDocument6(targetDocument) { 17244 const runtime = getRuntime6(); 17245 runtime.documents.set( 17246 targetDocument, 17247 (runtime.documents.get(targetDocument) ?? 0) + 1 17248 ); 17249 for (const [hash, css] of runtime.styles) { 17250 injectStyle6(targetDocument, hash, css); 17251 } 17252 return () => { 17253 const count = runtime.documents.get(targetDocument); 17254 if (count === void 0) { 17255 return; 17256 } 17257 if (count <= 1) { 17258 runtime.documents.delete(targetDocument); 17259 return; 17260 } 17261 runtime.documents.set(targetDocument, count - 1); 17262 }; 17263 } 17264 function registerStyle6(hash, css) { 17265 const runtime = getRuntime6(); 17266 runtime.styles.set(hash, css); 17267 for (const targetDocument of runtime.documents.keys()) { 17268 injectStyle6(targetDocument, hash, css); 17269 } 17270 } 17271 if (typeof process === "undefined" || true) { 17272 registerStyle6("10f3806643", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._336cd3e4e743482f__box-sizing{box-sizing:border-box;*,:after,:before{box-sizing:inherit}}}}"); 17273 } 17274 var resets_default2 = { "box-sizing": "_336cd3e4e743482f__box-sizing" }; 17275 if (typeof process === "undefined" || true) { 17276 registerStyle6("08122b3d53", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{.af79fb116edb0dd7__outset-ring--focus:focus,.dfcfdc28396e5d98__outset-ring--focus-visible:focus-visible,.e5cd9ee879f6403a__outset-ring--focus-within:focus-within,:focus-visible ._81935a08e952f267__outset-ring--focus-parent-visible{--_gcd-a-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));--_gcd-div-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));outline-offset:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px))}._3c9f5ee9fc9c136d__outset-ring--focus-within-except-active:focus-within,.abc777e9713fa711__outset-ring--focus-except-active:focus{outline:none}._3c9f5ee9fc9c136d__outset-ring--focus-within-except-active:focus-within:not(:has(:active)),.abc777e9713fa711__outset-ring--focus-except-active:focus:not(:active){--_gcd-a-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));--_gcd-div-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));outline-offset:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px))}}}"); 17277 } 17278 var focus_module_default = { "outset-ring--focus": "af79fb116edb0dd7__outset-ring--focus", "outset-ring--focus-visible": "dfcfdc28396e5d98__outset-ring--focus-visible", "outset-ring--focus-within": "e5cd9ee879f6403a__outset-ring--focus-within", "outset-ring--focus-parent-visible": "_81935a08e952f267__outset-ring--focus-parent-visible", "outset-ring--focus-except-active": "abc777e9713fa711__outset-ring--focus-except-active", "outset-ring--focus-within-except-active": "_3c9f5ee9fc9c136d__outset-ring--focus-within-except-active" }; 17279 if (typeof process === "undefined" || true) { 17280 registerStyle6("e8e6a9be37", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{.d4250949359b05ce__link{text-decoration-thickness:from-font;text-underline-offset:.2em}.c6055659b8e2cd2c__is-brand,.c6055659b8e2cd2c__is-brand:visited{--_gcd-a-color:var(--wpds-color-foreground-interactive-brand,var(--wp-admin-theme-color,#3858e9));color:var(--wpds-color-foreground-interactive-brand,var(--wp-admin-theme-color,#3858e9))}.c6055659b8e2cd2c__is-brand:active,.c6055659b8e2cd2c__is-brand:hover{--_gcd-a-color:var(--wpds-color-foreground-interactive-brand-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 52%,#000));color:var(--wpds-color-foreground-interactive-brand-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 52%,#000))}._92e0dfcaeee15b88__is-neutral,._92e0dfcaeee15b88__is-neutral:visited{--_gcd-a-color:var(--wpds-color-foreground-interactive-neutral,#1e1e1e);color:var(--wpds-color-foreground-interactive-neutral,#1e1e1e);text-decoration-color:var(--wpds-color-stroke-interactive-neutral,#8d8d8d)}._92e0dfcaeee15b88__is-neutral:active,._92e0dfcaeee15b88__is-neutral:hover{--_gcd-a-color:var(--wpds-color-foreground-interactive-neutral-active,#1e1e1e);color:var(--wpds-color-foreground-interactive-neutral-active,#1e1e1e)}.cf122a9bf1035d42__is-unstyled{--_gcd-a-color:inherit;color:inherit;text-decoration:none}._0cb411afac4c86c7__link-icon{display:inline-block;font-weight:var(--wpds-typography-font-weight-default,400);line-height:1;margin-inline-start:var(--wpds-dimension-padding-xs,4px);text-decoration:none}._0cb411afac4c86c7__link-icon:after{content:"\\2197"}._0cb411afac4c86c7__link-icon:dir(rtl):after{content:"\\2196"}}}'); 17281 } 17282 var style_default5 = { "link": "d4250949359b05ce__link", "is-brand": "c6055659b8e2cd2c__is-brand", "is-neutral": "_92e0dfcaeee15b88__is-neutral", "is-unstyled": "cf122a9bf1035d42__is-unstyled", "link-icon": "_0cb411afac4c86c7__link-icon" }; 17283 if (typeof process === "undefined" || true) { 17284 registerStyle6("e8e31009f5", "._6defc79820e382c6__button{box-sizing:var(--_gcd-button-box-sizing,border-box);font-family:var(--_gcd-button-font-family,inherit);font-size:var(--_gcd-button-font-size,inherit);font-weight:var(--_gcd-button-font-weight,inherit)}.d2cff2e5dea83bd1__input{box-sizing:var(--_gcd-input-box-sizing,border-box);font-family:var(--_gcd-input-font-family,inherit);font-size:var(--_gcd-input-font-size,inherit);font-weight:var(--_gcd-input-font-weight,inherit);margin:var(--_gcd-input-margin,0);&::placeholder{color:var(--_gcd-input-placeholder-color,var(--wpds-color-foreground-interactive-neutral-weak,#707070))}&:is(textarea,[type=text],[type=password],[type=color],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){background-color:var(--_gcd-input-background-color,transparent);border:var(--_gcd-input-border,none);border-radius:var(--_gcd-input-border-radius,0);box-shadow:var(--_gcd-input-box-shadow,0 0 0 transparent);color:var(--_gcd-input-color,var(--wpds-color-foreground-interactive-neutral,#1e1e1e));&:focus{border-color:var(--_gcd-input-border-color-focus,var(--wp-admin-theme-color));box-shadow:var(--_gcd-input-box-shadow-focus,none);outline:var(--_gcd-input-outline-focus,none)}&:disabled{background:var(--_gcd-input-background-disabled,transparent);border-color:var(--_gcd-input-border-color-disabled,transparent);box-shadow:var(--_gcd-input-box-shadow-disabled,none);color:var(--_gcd-input-color-disabled,var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d))}}&:is(textarea,[type=text],[type=password],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){line-height:var(--_gcd-input-line-height,inherit);min-height:var(--_gcd-input-min-height,auto);padding:var(--_gcd-input-padding,0)}}._547d86373d02e108__textarea{box-sizing:var(--_gcd-textarea-box-sizing,border-box);overflow:var(--_gcd-textarea-overflow,auto);resize:var(--_gcd-textarea-resize,block)}._8c15fd0ed9f28ba4__div{outline:var(--_gcd-div-outline,0 solid transparent)}p._43cec3e1eec1066d__p{font-size:var(--_gcd-p-font-size,13px);line-height:var(--_gcd-p-line-height,1.5);margin:var(--_gcd-p-margin,0)}:is(h1,h2,h3,h4,h5,h6).e97669c6d9a38497__heading{color:var(--_gcd-heading-color,var(--wpds-color-foreground-content-neutral,#1e1e1e));font-size:var(--_gcd-heading-font-size,inherit);font-weight:var(--_gcd-heading-font-weight,var(--wpds-typography-font-weight-emphasis,600));margin:var(--_gcd-heading-margin,0)}._2c0831b0499dbd6e__a,._2c0831b0499dbd6e__a:is(:hover,:focus,:active){border-radius:var(--_gcd-a-border-radius,0);box-shadow:var(--_gcd-a-box-shadow,none);color:var(--_gcd-a-color,inherit);outline:var(--_gcd-a-outline,0 solid transparent);transition:var(--_gcd-a-transition,none)}.c59a0ebebd71fa4a__ol{list-style:var(--_gcd-ol-list-style,none);margin:var(--_gcd-ol-margin,0);padding-block:var(--_gcd-ol-padding-block,0);padding-inline:var(--_gcd-ol-padding-inline,0)}._46b5cb0c8e24e8c9__li{margin:var(--_gcd-li-margin,0)}"); 17285 } 17286 var global_css_defense_default2 = { "button": "_6defc79820e382c6__button", "input": "d2cff2e5dea83bd1__input", "textarea": "_547d86373d02e108__textarea", "div": "_8c15fd0ed9f28ba4__div", "p": "_43cec3e1eec1066d__p", "heading": "e97669c6d9a38497__heading", "a": "_2c0831b0499dbd6e__a", "ol": "c59a0ebebd71fa4a__ol", "li": "_46b5cb0c8e24e8c9__li" }; 17287 var Link = (0, import_element22.forwardRef)(function Link2({ 17288 children, 17289 variant = "default", 17290 tone = "brand", 17291 openInNewTab = false, 17292 target, 17293 render: render4, 17294 className, 17295 ...props 17296 }, ref) { 17297 const shouldShowNewTabIndicator = openInNewTab || /^_blank$/i.test(target ?? ""); 17298 const element = useRender({ 17299 render: render4, 17300 defaultTagName: "a", 17301 ref, 17302 props: mergeProps(props, { 17303 className: clsx_default( 17304 global_css_defense_default2.a, 17305 resets_default2["box-sizing"], 17306 focus_module_default["outset-ring--focus-except-active"], 17307 variant !== "unstyled" && style_default5.link, 17308 variant !== "unstyled" && style_default5[`is-$tone}`], 17309 variant === "unstyled" && style_default5["is-unstyled"], 17310 className 17311 ), 17312 target: target ?? (openInNewTab ? "_blank" : void 0), 17313 children: /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)(import_jsx_runtime73.Fragment, { children: [ 17314 children, 17315 shouldShowNewTabIndicator && /* @__PURE__ */ (0, import_jsx_runtime73.jsx)( 17316 "span", 17317 { 17318 className: style_default5["link-icon"], 17319 role: "img", 17320 "aria-label": ( 17321 /* translators: accessibility text appended to link text */ 17322 (0, import_i18n8.__)("(opens in a new tab)") 17323 ) 17324 } 17325 ) 17326 ] }) 17327 }) 17328 }); 17329 return element; 17330 }); 17331 17332 // packages/ui/build-module/menu/index.mjs 17333 var menu_exports = {}; 17334 __export(menu_exports, { 17335 CheckboxItem: () => CheckboxItem, 17336 Group: () => Group, 17337 GroupLabel: () => GroupLabel, 17338 Item: () => Item, 17339 ItemDescription: () => ItemDescription, 17340 ItemLabel: () => ItemLabel, 17341 LinkItem: () => LinkItem, 17342 Popup: () => Popup2, 17343 Portal: () => Portal2, 17344 Positioner: () => Positioner2, 17345 PrefixIcon: () => PrefixIcon, 17346 RadioGroup: () => RadioGroup, 17347 RadioItem: () => RadioItem, 17348 Root: () => Root2, 17349 Separator: () => Separator2, 17350 SubmenuRoot: () => SubmenuRoot, 17351 SubmenuTrigger: () => SubmenuTrigger, 17352 Trigger: () => Trigger2 17353 }); 17354 17355 // packages/ui/build-module/menu/checkbox-item.mjs 17356 var import_element31 = __toESM(require_element(), 1); 17357 17358 // packages/ui/build-module/icon/icon.mjs 17359 var import_element23 = __toESM(require_element(), 1); 17360 var import_primitives35 = __toESM(require_primitives(), 1); 17361 var import_jsx_runtime74 = __toESM(require_jsx_runtime(), 1); 17362 var Icon = (0, import_element23.forwardRef)(function Icon2({ icon, size: size4 = 24, style, ...restProps }, ref) { 17363 const mergedStyle = icon.props.style || style ? { ...icon.props.style, ...style } : void 0; 17364 return /* @__PURE__ */ (0, import_jsx_runtime74.jsx)( 17365 import_primitives35.SVG, 17366 { 17367 ref, 17368 ...icon.props, 17369 ...restProps, 17370 ...mergedStyle ? { style: mergedStyle } : {}, 17371 width: size4, 17372 height: size4 17373 } 17374 ); 17375 }); 17376 17377 // packages/ui/build-module/menu/context.mjs 17378 var import_element24 = __toESM(require_element(), 1); 17379 var MenuContext = (0, import_element24.createContext)({ 17380 isSubmenu: false 17381 }); 17382 var useMenuContext = () => (0, import_element24.useContext)(MenuContext); 17383 var MenuItemContentContext = (0, import_element24.createContext)(null); 17384 var useMenuItemContentContext = () => (0, import_element24.useContext)(MenuItemContentContext); 17385 17386 // packages/ui/build-module/menu/item.mjs 17387 var import_element30 = __toESM(require_element(), 1); 17388 17389 // packages/ui/build-module/utils/keyboard-shortcut.mjs 17390 var import_element26 = __toESM(require_element(), 1); 17391 var import_i18n9 = __toESM(require_i18n(), 1); 17392 17393 // packages/ui/build-module/visually-hidden/visually-hidden.mjs 17394 var import_element25 = __toESM(require_element(), 1); 17395 var STYLE_HASH_ATTRIBUTE7 = "data-wp-hash"; 17396 function getRuntime7() { 17397 const globalScope = globalThis; 17398 if (globalScope.__wpStyleRuntime) { 17399 return globalScope.__wpStyleRuntime; 17400 } 17401 globalScope.__wpStyleRuntime = { 17402 documents: /* @__PURE__ */ new Map(), 17403 styles: /* @__PURE__ */ new Map(), 17404 injectedStyles: /* @__PURE__ */ new WeakMap() 17405 }; 17406 if (typeof document !== "undefined") { 17407 registerDocument7(document); 17408 } 17409 return globalScope.__wpStyleRuntime; 17410 } 17411 function documentContainsStyleHash7(targetDocument, hash) { 17412 if (!targetDocument.head) { 17413 return false; 17414 } 17415 for (const style of targetDocument.head.querySelectorAll( 17416 `style[$STYLE_HASH_ATTRIBUTE7}]` 17417 )) { 17418 if (style.getAttribute(STYLE_HASH_ATTRIBUTE7) === hash) { 17419 return true; 17420 } 17421 } 17422 return false; 17423 } 17424 function injectStyle7(targetDocument, hash, css) { 17425 if (!targetDocument.head) { 17426 return; 17427 } 17428 const runtime = getRuntime7(); 17429 let injectedStyles = runtime.injectedStyles.get(targetDocument); 17430 if (!injectedStyles) { 17431 injectedStyles = /* @__PURE__ */ new Set(); 17432 runtime.injectedStyles.set(targetDocument, injectedStyles); 17433 } 17434 if (injectedStyles.has(hash)) { 17435 return; 17436 } 17437 if (documentContainsStyleHash7(targetDocument, hash)) { 17438 injectedStyles.add(hash); 17439 return; 17440 } 17441 const style = targetDocument.createElement("style"); 17442 style.setAttribute(STYLE_HASH_ATTRIBUTE7, hash); 17443 style.appendChild(targetDocument.createTextNode(css)); 17444 targetDocument.head.appendChild(style); 17445 injectedStyles.add(hash); 17446 } 17447 function registerDocument7(targetDocument) { 17448 const runtime = getRuntime7(); 17449 runtime.documents.set( 17450 targetDocument, 17451 (runtime.documents.get(targetDocument) ?? 0) + 1 17452 ); 17453 for (const [hash, css] of runtime.styles) { 17454 injectStyle7(targetDocument, hash, css); 17455 } 17456 return () => { 17457 const count = runtime.documents.get(targetDocument); 17458 if (count === void 0) { 17459 return; 17460 } 17461 if (count <= 1) { 17462 runtime.documents.delete(targetDocument); 17463 return; 17464 } 17465 runtime.documents.set(targetDocument, count - 1); 17466 }; 17467 } 17468 function registerStyle7(hash, css) { 17469 const runtime = getRuntime7(); 17470 runtime.styles.set(hash, css); 17471 for (const targetDocument of runtime.documents.keys()) { 17472 injectStyle7(targetDocument, hash, css); 17473 } 17474 } 17475 if (typeof process === "undefined" || true) { 17476 registerStyle7("f4df7461e9", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{.f37b9e2e191ebd66__visually-hidden{border:0;clip-path:inset(50%);height:1px;margin:-1px;overflow:hidden;overflow-wrap:normal;padding:0;position:absolute;width:1px;word-break:normal}}}"); 17477 } 17478 var style_default6 = { "visually-hidden": "f37b9e2e191ebd66__visually-hidden" }; 17479 var VisuallyHidden = (0, import_element25.forwardRef)( 17480 function VisuallyHidden2({ render: render4, ...restProps }, ref) { 17481 const element = useRender({ 17482 render: render4, 17483 ref, 17484 props: mergeProps( 17485 { className: style_default6["visually-hidden"] }, 17486 restProps, 17487 { 17488 // @ts-expect-error Arbitrary data-* attributes aren't indexable on the typed div props. Kept hardcoded so consumers can't change or remove it. 17489 "data-visually-hidden": "" 17490 } 17491 ) 17492 }); 17493 return element; 17494 } 17495 ); 17496 17497 // packages/ui/build-module/utils/keyboard-shortcut.mjs 17498 var import_jsx_runtime75 = __toESM(require_jsx_runtime(), 1); 17499 function useKeyboardShortcutProps({ 17500 "aria-describedby": ariaDescribedBy, 17501 "aria-keyshortcuts": ariaKeyShortcuts, 17502 shortcut 17503 }) { 17504 const generatedDescriptionId = (0, import_element26.useId)(); 17505 const descriptionId = shortcut ? generatedDescriptionId : void 0; 17506 const describedBy = [ariaDescribedBy, descriptionId].filter(Boolean).join(" "); 17507 return { 17508 descriptionId, 17509 targetProps: { 17510 "aria-describedby": describedBy || void 0, 17511 "aria-keyshortcuts": shortcut?.ariaKeyShortcut ?? ariaKeyShortcuts 17512 } 17513 }; 17514 } 17515 var KeyboardShortcutDescription = (0, import_element26.forwardRef)(function KeyboardShortcutDescription2({ descriptionId, shortcut }, ref) { 17516 return /* @__PURE__ */ (0, import_jsx_runtime75.jsx)( 17517 VisuallyHidden, 17518 { 17519 id: descriptionId, 17520 "aria-hidden": "true", 17521 render: /* @__PURE__ */ (0, import_jsx_runtime75.jsx)("span", { ref }), 17522 children: (0, import_i18n9.sprintf)( 17523 /* translators: %s: keyboard shortcut. */ 17524 (0, import_i18n9.__)("Keyboard shortcut: %s"), 17525 shortcut.label ?? shortcut.ariaKeyShortcut 17526 ) 17527 } 17528 ); 17529 }); 17530 var KeyboardShortcutDisplay = (0, import_element26.forwardRef)(function KeyboardShortcutDisplay2({ className, shortcut }, ref) { 17531 return /* @__PURE__ */ (0, import_jsx_runtime75.jsx)("span", { ref, "aria-hidden": "true", className, dir: "ltr", children: shortcut.displayShortcut }); 17532 }); 17533 17534 // packages/ui/build-module/utils/item-popup/item-content.mjs 17535 var import_element27 = __toESM(require_element(), 1); 17536 var VALIDATION_ENABLED = true; 17537 function parseItemContent(children, { Label: Label3, Description: Description3, validationMessage }) { 17538 const childArray = import_element27.Children.toArray(children); 17539 const [label, ...descriptions] = childArray; 17540 const hasLabel = (0, import_element27.isValidElement)(label) && label.type === Label3; 17541 const descriptionElements = descriptions.filter( 17542 (description) => (0, import_element27.isValidElement)(description) && description.type === Description3 17543 ); 17544 if (VALIDATION_ENABLED && (!hasLabel || descriptionElements.length !== descriptions.length)) { 17545 throw new Error(validationMessage); 17546 } 17547 return { 17548 descriptionIds: descriptionElements.map( 17549 (description) => description.props.id 17550 ), 17551 hasLabel, 17552 labelId: hasLabel ? label.props.id : void 0 17553 }; 17554 } 17555 function useItemContent(children, components, { 17556 "aria-describedby": ariaDescribedBy, 17557 "aria-label": ariaLabel, 17558 "aria-labelledby": ariaLabelledBy 17559 } = {}) { 17560 const generatedLabelId = (0, import_element27.useId)(); 17561 const generatedDescriptionId = (0, import_element27.useId)(); 17562 const { descriptionIds, hasLabel, labelId } = parseItemContent( 17563 children, 17564 components 17565 ); 17566 const resolvedLabelId = hasLabel ? labelId ?? generatedLabelId : void 0; 17567 const resolvedDescriptionIds = descriptionIds.map( 17568 (descriptionId, index2) => descriptionId ?? `$generatedDescriptionId}-$index2}` 17569 ); 17570 const itemDescribedBy = Array.from( 17571 /* @__PURE__ */ new Set([ 17572 ...ariaDescribedBy?.split(/\s+/).filter(Boolean) ?? [], 17573 ...resolvedDescriptionIds 17574 ]) 17575 ).join(" "); 17576 let descriptionIndex = 0; 17577 const { Label: Label3, Description: Description3, descriptionValidationToken } = components; 17578 const contentChildren = import_element27.Children.map(children, (child) => { 17579 if (!(0, import_element27.isValidElement)(child)) { 17580 return child; 17581 } 17582 if (child.type === Label3) { 17583 return child.props.id === resolvedLabelId ? child : (0, import_element27.cloneElement)(child, { id: resolvedLabelId }); 17584 } 17585 if (child.type !== Description3) { 17586 return child; 17587 } 17588 const descriptionId = resolvedDescriptionIds[descriptionIndex++]; 17589 if (!descriptionValidationToken && child.props.id === descriptionId) { 17590 return child; 17591 } 17592 return (0, import_element27.cloneElement)(child, { 17593 id: descriptionId, 17594 ...descriptionValidationToken && { 17595 validationToken: descriptionValidationToken 17596 } 17597 }); 17598 }); 17599 const labelledBy = ariaLabelledBy ?? (ariaLabel ? void 0 : resolvedLabelId); 17600 return { 17601 contentChildren, 17602 resolvedLabelId, 17603 itemAriaProps: { 17604 "aria-describedby": itemDescribedBy || void 0, 17605 "aria-label": ariaLabel, 17606 "aria-labelledby": labelledBy 17607 } 17608 }; 17609 } 17610 17611 // packages/ui/build-module/menu/item-description.mjs 17612 var import_element28 = __toESM(require_element(), 1); 17613 var import_jsx_runtime76 = __toESM(require_jsx_runtime(), 1); 17614 var STYLE_HASH_ATTRIBUTE8 = "data-wp-hash"; 17615 function getRuntime8() { 17616 const globalScope = globalThis; 17617 if (globalScope.__wpStyleRuntime) { 17618 return globalScope.__wpStyleRuntime; 17619 } 17620 globalScope.__wpStyleRuntime = { 17621 documents: /* @__PURE__ */ new Map(), 17622 styles: /* @__PURE__ */ new Map(), 17623 injectedStyles: /* @__PURE__ */ new WeakMap() 17624 }; 17625 if (typeof document !== "undefined") { 17626 registerDocument8(document); 17627 } 17628 return globalScope.__wpStyleRuntime; 17629 } 17630 function documentContainsStyleHash8(targetDocument, hash) { 17631 if (!targetDocument.head) { 17632 return false; 17633 } 17634 for (const style of targetDocument.head.querySelectorAll( 17635 `style[$STYLE_HASH_ATTRIBUTE8}]` 17636 )) { 17637 if (style.getAttribute(STYLE_HASH_ATTRIBUTE8) === hash) { 17638 return true; 17639 } 17640 } 17641 return false; 17642 } 17643 function injectStyle8(targetDocument, hash, css) { 17644 if (!targetDocument.head) { 17645 return; 17646 } 17647 const runtime = getRuntime8(); 17648 let injectedStyles = runtime.injectedStyles.get(targetDocument); 17649 if (!injectedStyles) { 17650 injectedStyles = /* @__PURE__ */ new Set(); 17651 runtime.injectedStyles.set(targetDocument, injectedStyles); 17652 } 17653 if (injectedStyles.has(hash)) { 17654 return; 17655 } 17656 if (documentContainsStyleHash8(targetDocument, hash)) { 17657 injectedStyles.add(hash); 17658 return; 17659 } 17660 const style = targetDocument.createElement("style"); 17661 style.setAttribute(STYLE_HASH_ATTRIBUTE8, hash); 17662 style.appendChild(targetDocument.createTextNode(css)); 17663 targetDocument.head.appendChild(style); 17664 injectedStyles.add(hash); 17665 } 17666 function registerDocument8(targetDocument) { 17667 const runtime = getRuntime8(); 17668 runtime.documents.set( 17669 targetDocument, 17670 (runtime.documents.get(targetDocument) ?? 0) + 1 17671 ); 17672 for (const [hash, css] of runtime.styles) { 17673 injectStyle8(targetDocument, hash, css); 17674 } 17675 return () => { 17676 const count = runtime.documents.get(targetDocument); 17677 if (count === void 0) { 17678 return; 17679 } 17680 if (count <= 1) { 17681 runtime.documents.delete(targetDocument); 17682 return; 17683 } 17684 runtime.documents.set(targetDocument, count - 1); 17685 }; 17686 } 17687 function registerStyle8(hash, css) { 17688 const runtime = getRuntime8(); 17689 runtime.styles.set(hash, css); 17690 for (const targetDocument of runtime.documents.keys()) { 17691 injectStyle8(targetDocument, hash, css); 17692 } 17693 } 17694 if (typeof process === "undefined" || true) { 17695 registerStyle8("3be1f8dffe", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._380b81b8f79fb10f__dropdown-motion,._7f344b94e270e039__dropdown-motion--fade-only{--wp-ui-dropdown-slide-distance:4px;--wp-ui-dropdown-slide-duration:var(--wpds-motion-duration-md,200ms);--wp-ui-dropdown-slide-easing:var(--wpds-motion-easing-expressive,cubic-bezier(0.25,0,0,1));--wp-ui-dropdown-fade-duration:var(--wpds-motion-duration-sm,100ms);--wp-ui-dropdown-fade-easing:linear;@media not (prefers-reduced-motion){transition-duration:var(--wp-ui-dropdown-slide-duration),var(--wp-ui-dropdown-fade-duration);transition-property:transform,opacity;transition-timing-function:var(--wp-ui-dropdown-slide-easing),var(--wp-ui-dropdown-fade-easing);will-change:transform,opacity}opacity:1;&[data-instant]{transition:none}&[data-ending-style],&[data-starting-style]{opacity:0}}._380b81b8f79fb10f__dropdown-motion{transform:translate(0);&[data-side=bottom][data-ending-style],&[data-side=bottom][data-starting-style]{transform:translateY(calc(var(--wp-ui-dropdown-slide-distance)*-1))}&[data-side=top][data-ending-style],&[data-side=top][data-starting-style]{transform:translateY(var(--wp-ui-dropdown-slide-distance))}&[data-side=left][data-ending-style],&[data-side=left][data-starting-style]{transform:translateX(var(--wp-ui-dropdown-slide-distance))}&[data-side=right][data-ending-style],&[data-side=right][data-starting-style]{transform:translateX(calc(var(--wp-ui-dropdown-slide-distance)*-1))}&[data-side=inline-start][data-ending-style],&[data-side=inline-start][data-starting-style]{transform:translateX(var(--wp-ui-dropdown-slide-distance))}&[data-side=inline-end][data-ending-style],&[data-side=inline-end][data-starting-style]{transform:translateX(calc(var(--wp-ui-dropdown-slide-distance)*-1))}&:dir(rtl)[data-side=inline-start][data-ending-style],&:dir(rtl)[data-side=inline-start][data-starting-style]{transform:translateX(calc(var(--wp-ui-dropdown-slide-distance)*-1))}&:dir(rtl)[data-side=inline-end][data-ending-style],&:dir(rtl)[data-side=inline-end][data-starting-style]{transform:translateX(var(--wp-ui-dropdown-slide-distance))}}}}@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{.d61e2d85c0ee0699__positioner{z-index:var(--wp-ui-menu-z-index,initial)}._34e81249f419a5a5__popup{--wp-ui-menu-popup-padding:var(--wpds-dimension-padding-xs,4px);--wp-ui-menu-min-width:160px;--wp-ui-menu-max-width:var(--wpds-dimension-surface-width-md,400px);--wp-ui-menu-item-padding-inline:var(--wpds-dimension-padding-md,12px);--wp-ui-menu-group-head-padding-inline:var(--wpds-dimension-padding-md,12px);--wp-ui-menu-selection-indicator-track-size:0px;--wp-ui-menu-selection-indicator-size:var(--wpds-dimension-size-sm,24px);--wp-ui-menu-selection-indicator-gap:0px;--_wp-ui-menu-elevation-md:0px 2px 3px 0px #0000000d,0px 4px 5px 0px #0000000a,0px 12px 12px 0px #00000008,0px 16px 16px 0px #00000005;background-color:var(--wpds-color-background-surface-neutral-strong,#fff);border:var(--wpds-border-width-xs,1px) solid var(--wpds-color-stroke-surface-neutral,#dbdbdb);border-radius:var(--wpds-border-radius-md,4px);box-shadow:var(--_wp-ui-menu-elevation-md);max-height:min(var(--available-height),480px,60dvh);max-width:min(var(--available-width),var(--wp-ui-menu-max-width));min-width:min(var(--available-width),var(--wp-ui-menu-min-width));outline:none;overflow-block:auto;overscroll-behavior:none;padding:var(--wp-ui-menu-popup-padding);scroll-padding:var(--wp-ui-menu-popup-padding);&:has(._42313b48c5459be3__item-selection-indicator){--wp-ui-menu-item-padding-inline:var(--wpds-dimension-padding-sm,8px);--wp-ui-menu-selection-indicator-track-size:var(--wpds-dimension-size-2xs,16px);--wp-ui-menu-selection-indicator-gap:var(--wpds-dimension-gap-sm,8px)}}._33f07ab17005471d__list{--_wp-ui-menu-item-label-line-height:var(--wpds-typography-line-height-sm,20px);color:var(--wpds-color-foreground-interactive-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-md,13px);line-height:var(--_wp-ui-menu-item-label-line-height)}._33f07ab17005471d__list,.e05914e1005d7c2e__radio-group,.f11085533c0056b0__group{--wp-ui-menu-group-prefix-gap:0px;display:grid;grid-template-columns:[item-padding-start] var(--wp-ui-menu-item-padding-inline) [selection-start] var(--wp-ui-menu-selection-indicator-track-size) [selection-end] var(--wp-ui-menu-selection-indicator-gap) [prefix-start] max-content [prefix-end] var(--wp-ui-menu-group-prefix-gap) [content-start] minmax(0,1fr) [content-end] var(--wp-ui-menu-item-padding-inline) [item-padding-end];min-width:0}.e05914e1005d7c2e__radio-group,.f11085533c0056b0__group{grid-column:1/-1}._33f07ab17005471d__list:has(>._5c913bce0d8bb0d6__item>._64924ecabf65a5d6__item-prefix),.e05914e1005d7c2e__radio-group:has(>._5c913bce0d8bb0d6__item>._64924ecabf65a5d6__item-prefix),.f11085533c0056b0__group:has(>._5c913bce0d8bb0d6__item>._64924ecabf65a5d6__item-prefix){--wp-ui-menu-group-prefix-gap:var(--wpds-dimension-gap-xs,4px)}._4a0fd085d76fd23c__group-label{align-items:center;color:var(--wpds-color-foreground-content-neutral-weak,#707070);display:flex;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-xs,11px);font-weight:var(--wpds-typography-font-weight-emphasis,600);grid-column:1/-1;line-height:var(--wpds-typography-line-height-xs,16px);min-height:var(--wpds-dimension-size-md,32px);padding-block:var(--wpds-dimension-padding-xs,4px);padding-inline:var(--wp-ui-menu-group-head-padding-inline);text-transform:uppercase}.bfc11368eadf3b39__separator{background-color:var(--wpds-color-stroke-surface-neutral-weak,#f0f0f0);grid-column:1/-1;height:var(--wpds-border-width-xs,1px);margin-block:var(--wpds-dimension-gap-xs,4px);margin-inline:var(--wp-ui-menu-group-head-padding-inline);@media (forced-colors:active){background-color:CanvasText}}._5c913bce0d8bb0d6__item{--wp-ui-menu-item-height:var(--wpds-dimension-size-md,32px);--wp-ui-menu-item-padding-block:var(--wpds-dimension-padding-xs,4px);--_gcd-a-border-radius:var(--wpds-border-radius-sm,2px);align-content:center;align-items:start;border-radius:var(--wpds-border-radius-sm,2px);display:grid;gap:0;grid-column:1/-1;grid-template-columns:[item-padding-start] var(--wp-ui-menu-item-padding-inline) [selection-start] var(--wp-ui-menu-selection-indicator-track-size) [selection-end] var(--wp-ui-menu-selection-indicator-gap) [prefix-start] max-content [prefix-end] var(--wp-ui-menu-group-prefix-gap) [content-start] minmax(0,1fr) [content-end] var(--wp-ui-menu-item-padding-inline) [item-padding-end];justify-content:stretch;min-height:var(--wp-ui-menu-item-height);min-width:0;padding-block:var(--wp-ui-menu-item-padding-block);scroll-margin:var(--wp-ui-menu-popup-padding);text-decoration:none;user-select:none;&:not([data-disabled]){cursor:var(--wpds-cursor-control,pointer)}&[href]{cursor:pointer}@supports (grid-template-columns:subgrid){grid-template-columns:subgrid}&[data-highlighted]:not([aria-disabled=true]){background-color:var(--wpds-color-background-interactive-brand-weak-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 12%,#fff));color:var(--wpds-color-foreground-interactive-neutral,#1e1e1e);outline:none;@media (forced-colors:active){--_gcd-div-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid Highlight;--_gcd-a-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid Highlight}}&[aria-disabled=true]{background-color:var(--wpds-color-background-interactive-brand-weak-disabled,#0000);color:var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d);@media (forced-colors:active){color:GrayText}}}._42313b48c5459be3__item-selection-indicator,._64924ecabf65a5d6__item-prefix,.af879698ede76757__item-content{grid-row:1}._42313b48c5459be3__item-selection-indicator{align-items:center;color:var(--wpds-color-foreground-content-neutral-weak,#707070);display:flex;grid-column:selection-start/selection-end;height:var(--_wp-ui-menu-item-label-line-height);justify-content:center;justify-self:center;pointer-events:none;width:var(--wp-ui-menu-selection-indicator-size);&[data-unchecked]{opacity:0}}._99c5bd141cbf516f__checkbox-selection-icon{translate:0 1px}._59aa9b3b3a651148__radio-selection-icon{fill:currentColor;height:var(--wpds-dimension-size-xs,20px);width:var(--wpds-dimension-size-xs,20px)}._64924ecabf65a5d6__item-prefix{align-items:center;color:var(--wpds-color-foreground-content-neutral-weak,#707070);display:flex;gap:var(--wpds-dimension-gap-xs,4px);grid-column:prefix-start/prefix-end;justify-content:center;min-width:0}.a836378335a4cbf1__prefix-icon{align-self:flex-start;flex-shrink:0;margin-block-start:calc((var(--_wp-ui-menu-item-label-line-height) - var(--_wp-ui-menu-prefix-icon-size))/2)}.af879698ede76757__item-content{align-items:center;align-self:stretch;box-sizing:border-box;display:grid;grid-column:content-start/content-end;grid-template-columns:[label-start] minmax(0,1fr) [label-end suffix-start] auto [suffix-end shortcut-start] auto [shortcut-end trailing-start] auto [trailing-end];min-width:0;pointer-events:none}._943a932d9f81c78c__item-children{display:inline-flex;flex-direction:column;gap:2px;grid-column:label-start/label-end;min-width:0}._5ed41da4abcf8958__item-label{--_gcd-heading-color:currentColor;--_gcd-p-line-height:var(--_wp-ui-menu-item-label-line-height);color:inherit;line-height:var(--_wp-ui-menu-item-label-line-height);min-width:0;overflow-wrap:anywhere}.fa88c9f1a96a4c5a__item-description{--_gcd-heading-color:var(--wpds-color-foreground-content-neutral-weak,#707070);color:var(--wpds-color-foreground-content-neutral-weak,#707070);overflow-wrap:anywhere;padding-block-end:var(--wpds-dimension-padding-xs,4px)}._091406749ed93e6e__item-suffix{align-items:center;display:flex;gap:var(--wpds-dimension-gap-xs,4px);grid-column:suffix-start/suffix-end}._091406749ed93e6e__item-suffix,._23630f40071a29ff__item-shortcut{color:var(--wpds-color-foreground-content-neutral-weak,#707070);margin-inline-start:var(--wpds-dimension-gap-md,12px)}._23630f40071a29ff__item-shortcut{grid-column:shortcut-start/shortcut-end}._06be17a91bf434a0__item-trailing{align-items:center;color:var(--wpds-color-foreground-content-neutral-weak,#707070);display:flex;grid-column:trailing-start/trailing-end;margin-inline-start:var(--wpds-dimension-gap-md,12px)}._943a932d9f81c78c__item-children+:is(._091406749ed93e6e__item-suffix,._23630f40071a29ff__item-shortcut,._06be17a91bf434a0__item-trailing){margin-inline-start:var(--wpds-dimension-gap-xl,24px)}._23630f40071a29ff__item-shortcut+._06be17a91bf434a0__item-trailing{margin-inline-start:var(--wpds-dimension-gap-xs,4px)}.b78aec79bf93eba0__submenu-chevron{margin-inline-end:calc(var(--wpds-dimension-gap-sm, 8px)*-1)}.b78aec79bf93eba0__submenu-chevron:dir(rtl){transform:rotate(180deg)}._60da3b6f9718cf76__external-link-indicator{display:inline-block;font-weight:var(--wpds-typography-font-weight-default,400);line-height:1;margin-inline-start:var(--wpds-dimension-gap-xs,4px);text-decoration:none}._60da3b6f9718cf76__external-link-indicator:after{content:"\\2197"}._60da3b6f9718cf76__external-link-indicator:dir(rtl):after{content:"\\2196"}._5c913bce0d8bb0d6__item[aria-disabled=true] ._06be17a91bf434a0__item-trailing,._5c913bce0d8bb0d6__item[aria-disabled=true] ._091406749ed93e6e__item-suffix,._5c913bce0d8bb0d6__item[aria-disabled=true] ._23630f40071a29ff__item-shortcut,._5c913bce0d8bb0d6__item[aria-disabled=true] ._42313b48c5459be3__item-selection-indicator,._5c913bce0d8bb0d6__item[aria-disabled=true] ._64924ecabf65a5d6__item-prefix,._5c913bce0d8bb0d6__item[aria-disabled=true] .fa88c9f1a96a4c5a__item-description,._5c913bce0d8bb0d6__item[data-highlighted]:not([aria-disabled=true]) ._06be17a91bf434a0__item-trailing,._5c913bce0d8bb0d6__item[data-highlighted]:not([aria-disabled=true]) ._091406749ed93e6e__item-suffix,._5c913bce0d8bb0d6__item[data-highlighted]:not([aria-disabled=true]) ._23630f40071a29ff__item-shortcut,._5c913bce0d8bb0d6__item[data-highlighted]:not([aria-disabled=true]) ._42313b48c5459be3__item-selection-indicator,._5c913bce0d8bb0d6__item[data-highlighted]:not([aria-disabled=true]) ._64924ecabf65a5d6__item-prefix,._5c913bce0d8bb0d6__item[data-highlighted]:not([aria-disabled=true]) .fa88c9f1a96a4c5a__item-description{--_gcd-heading-color:currentColor;color:inherit}}}'); 17696 } 17697 var style_default7 = { "positioner": "d61e2d85c0ee0699__positioner", "popup": "_34e81249f419a5a5__popup", "item-selection-indicator": "_42313b48c5459be3__item-selection-indicator", "is-root": "_087a537b24fee6a1__is-root _380b81b8f79fb10f__dropdown-motion", "is-submenu": "_6d3b567f6289bdc2__is-submenu _7f344b94e270e039__dropdown-motion--fade-only", "list": "_33f07ab17005471d__list", "group": "f11085533c0056b0__group", "radio-group": "e05914e1005d7c2e__radio-group", "item": "_5c913bce0d8bb0d6__item", "item-prefix": "_64924ecabf65a5d6__item-prefix", "group-label": "_4a0fd085d76fd23c__group-label", "separator": "bfc11368eadf3b39__separator", "item-content": "af879698ede76757__item-content", "checkbox-selection-icon": "_99c5bd141cbf516f__checkbox-selection-icon", "radio-selection-icon": "_59aa9b3b3a651148__radio-selection-icon", "prefix-icon": "a836378335a4cbf1__prefix-icon", "item-children": "_943a932d9f81c78c__item-children", "item-label": "_5ed41da4abcf8958__item-label", "item-description": "fa88c9f1a96a4c5a__item-description", "item-suffix": "_091406749ed93e6e__item-suffix", "item-shortcut": "_23630f40071a29ff__item-shortcut", "item-trailing": "_06be17a91bf434a0__item-trailing", "submenu-chevron": "b78aec79bf93eba0__submenu-chevron", "external-link-indicator": "_60da3b6f9718cf76__external-link-indicator" }; 17698 var ITEM_DESCRIPTION_DIRECT_CHILD = /* @__PURE__ */ Symbol(); 17699 var ItemDescription = (0, import_element28.forwardRef)( 17700 function MenuItemDescription(props, ref) { 17701 const { className, id, validationToken, ...restProps } = props; 17702 if (validationToken !== ITEM_DESCRIPTION_DIRECT_CHILD) { 17703 throw new Error( 17704 "Menu.ItemDescription: Missing direct menu item parent. Render <Menu.ItemDescription> as a direct child of a menu item." 17705 ); 17706 } 17707 return /* @__PURE__ */ (0, import_jsx_runtime76.jsx)( 17708 Text, 17709 { 17710 ref, 17711 variant: "body-sm", 17712 ...restProps, 17713 id, 17714 className: clsx_default(style_default7["item-description"], className) 17715 } 17716 ); 17717 } 17718 ); 17719 17720 // packages/ui/build-module/menu/item-label.mjs 17721 var import_element29 = __toESM(require_element(), 1); 17722 var import_jsx_runtime77 = __toESM(require_jsx_runtime(), 1); 17723 var STYLE_HASH_ATTRIBUTE9 = "data-wp-hash"; 17724 function getRuntime9() { 17725 const globalScope = globalThis; 17726 if (globalScope.__wpStyleRuntime) { 17727 return globalScope.__wpStyleRuntime; 17728 } 17729 globalScope.__wpStyleRuntime = { 17730 documents: /* @__PURE__ */ new Map(), 17731 styles: /* @__PURE__ */ new Map(), 17732 injectedStyles: /* @__PURE__ */ new WeakMap() 17733 }; 17734 if (typeof document !== "undefined") { 17735 registerDocument9(document); 17736 } 17737 return globalScope.__wpStyleRuntime; 17738 } 17739 function documentContainsStyleHash9(targetDocument, hash) { 17740 if (!targetDocument.head) { 17741 return false; 17742 } 17743 for (const style of targetDocument.head.querySelectorAll( 17744 `style[$STYLE_HASH_ATTRIBUTE9}]` 17745 )) { 17746 if (style.getAttribute(STYLE_HASH_ATTRIBUTE9) === hash) { 17747 return true; 17748 } 17749 } 17750 return false; 17751 } 17752 function injectStyle9(targetDocument, hash, css) { 17753 if (!targetDocument.head) { 17754 return; 17755 } 17756 const runtime = getRuntime9(); 17757 let injectedStyles = runtime.injectedStyles.get(targetDocument); 17758 if (!injectedStyles) { 17759 injectedStyles = /* @__PURE__ */ new Set(); 17760 runtime.injectedStyles.set(targetDocument, injectedStyles); 17761 } 17762 if (injectedStyles.has(hash)) { 17763 return; 17764 } 17765 if (documentContainsStyleHash9(targetDocument, hash)) { 17766 injectedStyles.add(hash); 17767 return; 17768 } 17769 const style = targetDocument.createElement("style"); 17770 style.setAttribute(STYLE_HASH_ATTRIBUTE9, hash); 17771 style.appendChild(targetDocument.createTextNode(css)); 17772 targetDocument.head.appendChild(style); 17773 injectedStyles.add(hash); 17774 } 17775 function registerDocument9(targetDocument) { 17776 const runtime = getRuntime9(); 17777 runtime.documents.set( 17778 targetDocument, 17779 (runtime.documents.get(targetDocument) ?? 0) + 1 17780 ); 17781 for (const [hash, css] of runtime.styles) { 17782 injectStyle9(targetDocument, hash, css); 17783 } 17784 return () => { 17785 const count = runtime.documents.get(targetDocument); 17786 if (count === void 0) { 17787 return; 17788 } 17789 if (count <= 1) { 17790 runtime.documents.delete(targetDocument); 17791 return; 17792 } 17793 runtime.documents.set(targetDocument, count - 1); 17794 }; 17795 } 17796 function registerStyle9(hash, css) { 17797 const runtime = getRuntime9(); 17798 runtime.styles.set(hash, css); 17799 for (const targetDocument of runtime.documents.keys()) { 17800 injectStyle9(targetDocument, hash, css); 17801 } 17802 } 17803 if (typeof process === "undefined" || true) { 17804 registerStyle9("3be1f8dffe", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._380b81b8f79fb10f__dropdown-motion,._7f344b94e270e039__dropdown-motion--fade-only{--wp-ui-dropdown-slide-distance:4px;--wp-ui-dropdown-slide-duration:var(--wpds-motion-duration-md,200ms);--wp-ui-dropdown-slide-easing:var(--wpds-motion-easing-expressive,cubic-bezier(0.25,0,0,1));--wp-ui-dropdown-fade-duration:var(--wpds-motion-duration-sm,100ms);--wp-ui-dropdown-fade-easing:linear;@media not (prefers-reduced-motion){transition-duration:var(--wp-ui-dropdown-slide-duration),var(--wp-ui-dropdown-fade-duration);transition-property:transform,opacity;transition-timing-function:var(--wp-ui-dropdown-slide-easing),var(--wp-ui-dropdown-fade-easing);will-change:transform,opacity}opacity:1;&[data-instant]{transition:none}&[data-ending-style],&[data-starting-style]{opacity:0}}._380b81b8f79fb10f__dropdown-motion{transform:translate(0);&[data-side=bottom][data-ending-style],&[data-side=bottom][data-starting-style]{transform:translateY(calc(var(--wp-ui-dropdown-slide-distance)*-1))}&[data-side=top][data-ending-style],&[data-side=top][data-starting-style]{transform:translateY(var(--wp-ui-dropdown-slide-distance))}&[data-side=left][data-ending-style],&[data-side=left][data-starting-style]{transform:translateX(var(--wp-ui-dropdown-slide-distance))}&[data-side=right][data-ending-style],&[data-side=right][data-starting-style]{transform:translateX(calc(var(--wp-ui-dropdown-slide-distance)*-1))}&[data-side=inline-start][data-ending-style],&[data-side=inline-start][data-starting-style]{transform:translateX(var(--wp-ui-dropdown-slide-distance))}&[data-side=inline-end][data-ending-style],&[data-side=inline-end][data-starting-style]{transform:translateX(calc(var(--wp-ui-dropdown-slide-distance)*-1))}&:dir(rtl)[data-side=inline-start][data-ending-style],&:dir(rtl)[data-side=inline-start][data-starting-style]{transform:translateX(calc(var(--wp-ui-dropdown-slide-distance)*-1))}&:dir(rtl)[data-side=inline-end][data-ending-style],&:dir(rtl)[data-side=inline-end][data-starting-style]{transform:translateX(var(--wp-ui-dropdown-slide-distance))}}}}@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{.d61e2d85c0ee0699__positioner{z-index:var(--wp-ui-menu-z-index,initial)}._34e81249f419a5a5__popup{--wp-ui-menu-popup-padding:var(--wpds-dimension-padding-xs,4px);--wp-ui-menu-min-width:160px;--wp-ui-menu-max-width:var(--wpds-dimension-surface-width-md,400px);--wp-ui-menu-item-padding-inline:var(--wpds-dimension-padding-md,12px);--wp-ui-menu-group-head-padding-inline:var(--wpds-dimension-padding-md,12px);--wp-ui-menu-selection-indicator-track-size:0px;--wp-ui-menu-selection-indicator-size:var(--wpds-dimension-size-sm,24px);--wp-ui-menu-selection-indicator-gap:0px;--_wp-ui-menu-elevation-md:0px 2px 3px 0px #0000000d,0px 4px 5px 0px #0000000a,0px 12px 12px 0px #00000008,0px 16px 16px 0px #00000005;background-color:var(--wpds-color-background-surface-neutral-strong,#fff);border:var(--wpds-border-width-xs,1px) solid var(--wpds-color-stroke-surface-neutral,#dbdbdb);border-radius:var(--wpds-border-radius-md,4px);box-shadow:var(--_wp-ui-menu-elevation-md);max-height:min(var(--available-height),480px,60dvh);max-width:min(var(--available-width),var(--wp-ui-menu-max-width));min-width:min(var(--available-width),var(--wp-ui-menu-min-width));outline:none;overflow-block:auto;overscroll-behavior:none;padding:var(--wp-ui-menu-popup-padding);scroll-padding:var(--wp-ui-menu-popup-padding);&:has(._42313b48c5459be3__item-selection-indicator){--wp-ui-menu-item-padding-inline:var(--wpds-dimension-padding-sm,8px);--wp-ui-menu-selection-indicator-track-size:var(--wpds-dimension-size-2xs,16px);--wp-ui-menu-selection-indicator-gap:var(--wpds-dimension-gap-sm,8px)}}._33f07ab17005471d__list{--_wp-ui-menu-item-label-line-height:var(--wpds-typography-line-height-sm,20px);color:var(--wpds-color-foreground-interactive-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-md,13px);line-height:var(--_wp-ui-menu-item-label-line-height)}._33f07ab17005471d__list,.e05914e1005d7c2e__radio-group,.f11085533c0056b0__group{--wp-ui-menu-group-prefix-gap:0px;display:grid;grid-template-columns:[item-padding-start] var(--wp-ui-menu-item-padding-inline) [selection-start] var(--wp-ui-menu-selection-indicator-track-size) [selection-end] var(--wp-ui-menu-selection-indicator-gap) [prefix-start] max-content [prefix-end] var(--wp-ui-menu-group-prefix-gap) [content-start] minmax(0,1fr) [content-end] var(--wp-ui-menu-item-padding-inline) [item-padding-end];min-width:0}.e05914e1005d7c2e__radio-group,.f11085533c0056b0__group{grid-column:1/-1}._33f07ab17005471d__list:has(>._5c913bce0d8bb0d6__item>._64924ecabf65a5d6__item-prefix),.e05914e1005d7c2e__radio-group:has(>._5c913bce0d8bb0d6__item>._64924ecabf65a5d6__item-prefix),.f11085533c0056b0__group:has(>._5c913bce0d8bb0d6__item>._64924ecabf65a5d6__item-prefix){--wp-ui-menu-group-prefix-gap:var(--wpds-dimension-gap-xs,4px)}._4a0fd085d76fd23c__group-label{align-items:center;color:var(--wpds-color-foreground-content-neutral-weak,#707070);display:flex;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-xs,11px);font-weight:var(--wpds-typography-font-weight-emphasis,600);grid-column:1/-1;line-height:var(--wpds-typography-line-height-xs,16px);min-height:var(--wpds-dimension-size-md,32px);padding-block:var(--wpds-dimension-padding-xs,4px);padding-inline:var(--wp-ui-menu-group-head-padding-inline);text-transform:uppercase}.bfc11368eadf3b39__separator{background-color:var(--wpds-color-stroke-surface-neutral-weak,#f0f0f0);grid-column:1/-1;height:var(--wpds-border-width-xs,1px);margin-block:var(--wpds-dimension-gap-xs,4px);margin-inline:var(--wp-ui-menu-group-head-padding-inline);@media (forced-colors:active){background-color:CanvasText}}._5c913bce0d8bb0d6__item{--wp-ui-menu-item-height:var(--wpds-dimension-size-md,32px);--wp-ui-menu-item-padding-block:var(--wpds-dimension-padding-xs,4px);--_gcd-a-border-radius:var(--wpds-border-radius-sm,2px);align-content:center;align-items:start;border-radius:var(--wpds-border-radius-sm,2px);display:grid;gap:0;grid-column:1/-1;grid-template-columns:[item-padding-start] var(--wp-ui-menu-item-padding-inline) [selection-start] var(--wp-ui-menu-selection-indicator-track-size) [selection-end] var(--wp-ui-menu-selection-indicator-gap) [prefix-start] max-content [prefix-end] var(--wp-ui-menu-group-prefix-gap) [content-start] minmax(0,1fr) [content-end] var(--wp-ui-menu-item-padding-inline) [item-padding-end];justify-content:stretch;min-height:var(--wp-ui-menu-item-height);min-width:0;padding-block:var(--wp-ui-menu-item-padding-block);scroll-margin:var(--wp-ui-menu-popup-padding);text-decoration:none;user-select:none;&:not([data-disabled]){cursor:var(--wpds-cursor-control,pointer)}&[href]{cursor:pointer}@supports (grid-template-columns:subgrid){grid-template-columns:subgrid}&[data-highlighted]:not([aria-disabled=true]){background-color:var(--wpds-color-background-interactive-brand-weak-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 12%,#fff));color:var(--wpds-color-foreground-interactive-neutral,#1e1e1e);outline:none;@media (forced-colors:active){--_gcd-div-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid Highlight;--_gcd-a-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid Highlight}}&[aria-disabled=true]{background-color:var(--wpds-color-background-interactive-brand-weak-disabled,#0000);color:var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d);@media (forced-colors:active){color:GrayText}}}._42313b48c5459be3__item-selection-indicator,._64924ecabf65a5d6__item-prefix,.af879698ede76757__item-content{grid-row:1}._42313b48c5459be3__item-selection-indicator{align-items:center;color:var(--wpds-color-foreground-content-neutral-weak,#707070);display:flex;grid-column:selection-start/selection-end;height:var(--_wp-ui-menu-item-label-line-height);justify-content:center;justify-self:center;pointer-events:none;width:var(--wp-ui-menu-selection-indicator-size);&[data-unchecked]{opacity:0}}._99c5bd141cbf516f__checkbox-selection-icon{translate:0 1px}._59aa9b3b3a651148__radio-selection-icon{fill:currentColor;height:var(--wpds-dimension-size-xs,20px);width:var(--wpds-dimension-size-xs,20px)}._64924ecabf65a5d6__item-prefix{align-items:center;color:var(--wpds-color-foreground-content-neutral-weak,#707070);display:flex;gap:var(--wpds-dimension-gap-xs,4px);grid-column:prefix-start/prefix-end;justify-content:center;min-width:0}.a836378335a4cbf1__prefix-icon{align-self:flex-start;flex-shrink:0;margin-block-start:calc((var(--_wp-ui-menu-item-label-line-height) - var(--_wp-ui-menu-prefix-icon-size))/2)}.af879698ede76757__item-content{align-items:center;align-self:stretch;box-sizing:border-box;display:grid;grid-column:content-start/content-end;grid-template-columns:[label-start] minmax(0,1fr) [label-end suffix-start] auto [suffix-end shortcut-start] auto [shortcut-end trailing-start] auto [trailing-end];min-width:0;pointer-events:none}._943a932d9f81c78c__item-children{display:inline-flex;flex-direction:column;gap:2px;grid-column:label-start/label-end;min-width:0}._5ed41da4abcf8958__item-label{--_gcd-heading-color:currentColor;--_gcd-p-line-height:var(--_wp-ui-menu-item-label-line-height);color:inherit;line-height:var(--_wp-ui-menu-item-label-line-height);min-width:0;overflow-wrap:anywhere}.fa88c9f1a96a4c5a__item-description{--_gcd-heading-color:var(--wpds-color-foreground-content-neutral-weak,#707070);color:var(--wpds-color-foreground-content-neutral-weak,#707070);overflow-wrap:anywhere;padding-block-end:var(--wpds-dimension-padding-xs,4px)}._091406749ed93e6e__item-suffix{align-items:center;display:flex;gap:var(--wpds-dimension-gap-xs,4px);grid-column:suffix-start/suffix-end}._091406749ed93e6e__item-suffix,._23630f40071a29ff__item-shortcut{color:var(--wpds-color-foreground-content-neutral-weak,#707070);margin-inline-start:var(--wpds-dimension-gap-md,12px)}._23630f40071a29ff__item-shortcut{grid-column:shortcut-start/shortcut-end}._06be17a91bf434a0__item-trailing{align-items:center;color:var(--wpds-color-foreground-content-neutral-weak,#707070);display:flex;grid-column:trailing-start/trailing-end;margin-inline-start:var(--wpds-dimension-gap-md,12px)}._943a932d9f81c78c__item-children+:is(._091406749ed93e6e__item-suffix,._23630f40071a29ff__item-shortcut,._06be17a91bf434a0__item-trailing){margin-inline-start:var(--wpds-dimension-gap-xl,24px)}._23630f40071a29ff__item-shortcut+._06be17a91bf434a0__item-trailing{margin-inline-start:var(--wpds-dimension-gap-xs,4px)}.b78aec79bf93eba0__submenu-chevron{margin-inline-end:calc(var(--wpds-dimension-gap-sm, 8px)*-1)}.b78aec79bf93eba0__submenu-chevron:dir(rtl){transform:rotate(180deg)}._60da3b6f9718cf76__external-link-indicator{display:inline-block;font-weight:var(--wpds-typography-font-weight-default,400);line-height:1;margin-inline-start:var(--wpds-dimension-gap-xs,4px);text-decoration:none}._60da3b6f9718cf76__external-link-indicator:after{content:"\\2197"}._60da3b6f9718cf76__external-link-indicator:dir(rtl):after{content:"\\2196"}._5c913bce0d8bb0d6__item[aria-disabled=true] ._06be17a91bf434a0__item-trailing,._5c913bce0d8bb0d6__item[aria-disabled=true] ._091406749ed93e6e__item-suffix,._5c913bce0d8bb0d6__item[aria-disabled=true] ._23630f40071a29ff__item-shortcut,._5c913bce0d8bb0d6__item[aria-disabled=true] ._42313b48c5459be3__item-selection-indicator,._5c913bce0d8bb0d6__item[aria-disabled=true] ._64924ecabf65a5d6__item-prefix,._5c913bce0d8bb0d6__item[aria-disabled=true] .fa88c9f1a96a4c5a__item-description,._5c913bce0d8bb0d6__item[data-highlighted]:not([aria-disabled=true]) ._06be17a91bf434a0__item-trailing,._5c913bce0d8bb0d6__item[data-highlighted]:not([aria-disabled=true]) ._091406749ed93e6e__item-suffix,._5c913bce0d8bb0d6__item[data-highlighted]:not([aria-disabled=true]) ._23630f40071a29ff__item-shortcut,._5c913bce0d8bb0d6__item[data-highlighted]:not([aria-disabled=true]) ._42313b48c5459be3__item-selection-indicator,._5c913bce0d8bb0d6__item[data-highlighted]:not([aria-disabled=true]) ._64924ecabf65a5d6__item-prefix,._5c913bce0d8bb0d6__item[data-highlighted]:not([aria-disabled=true]) .fa88c9f1a96a4c5a__item-description{--_gcd-heading-color:currentColor;color:inherit}}}'); 17805 } 17806 var style_default8 = { "positioner": "d61e2d85c0ee0699__positioner", "popup": "_34e81249f419a5a5__popup", "item-selection-indicator": "_42313b48c5459be3__item-selection-indicator", "is-root": "_087a537b24fee6a1__is-root _380b81b8f79fb10f__dropdown-motion", "is-submenu": "_6d3b567f6289bdc2__is-submenu _7f344b94e270e039__dropdown-motion--fade-only", "list": "_33f07ab17005471d__list", "group": "f11085533c0056b0__group", "radio-group": "e05914e1005d7c2e__radio-group", "item": "_5c913bce0d8bb0d6__item", "item-prefix": "_64924ecabf65a5d6__item-prefix", "group-label": "_4a0fd085d76fd23c__group-label", "separator": "bfc11368eadf3b39__separator", "item-content": "af879698ede76757__item-content", "checkbox-selection-icon": "_99c5bd141cbf516f__checkbox-selection-icon", "radio-selection-icon": "_59aa9b3b3a651148__radio-selection-icon", "prefix-icon": "a836378335a4cbf1__prefix-icon", "item-children": "_943a932d9f81c78c__item-children", "item-label": "_5ed41da4abcf8958__item-label", "item-description": "fa88c9f1a96a4c5a__item-description", "item-suffix": "_091406749ed93e6e__item-suffix", "item-shortcut": "_23630f40071a29ff__item-shortcut", "item-trailing": "_06be17a91bf434a0__item-trailing", "submenu-chevron": "b78aec79bf93eba0__submenu-chevron", "external-link-indicator": "_60da3b6f9718cf76__external-link-indicator" }; 17807 var ItemLabel = (0, import_element29.forwardRef)( 17808 function MenuItemLabel({ children, className, id, ...props }, ref) { 17809 const itemContentContext = useMenuItemContentContext(); 17810 return /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)( 17811 Text, 17812 { 17813 ref, 17814 variant: "body-md", 17815 ...props, 17816 id: id ?? itemContentContext?.labelId, 17817 className: clsx_default(style_default8["item-label"], className), 17818 children: [ 17819 children, 17820 itemContentContext?.labelTrailing 17821 ] 17822 } 17823 ); 17824 } 17825 ); 17826 17827 // packages/ui/build-module/menu/item.mjs 17828 var import_jsx_runtime78 = __toESM(require_jsx_runtime(), 1); 17829 var STYLE_HASH_ATTRIBUTE10 = "data-wp-hash"; 17830 function getRuntime10() { 17831 const globalScope = globalThis; 17832 if (globalScope.__wpStyleRuntime) { 17833 return globalScope.__wpStyleRuntime; 17834 } 17835 globalScope.__wpStyleRuntime = { 17836 documents: /* @__PURE__ */ new Map(), 17837 styles: /* @__PURE__ */ new Map(), 17838 injectedStyles: /* @__PURE__ */ new WeakMap() 17839 }; 17840 if (typeof document !== "undefined") { 17841 registerDocument10(document); 17842 } 17843 return globalScope.__wpStyleRuntime; 17844 } 17845 function documentContainsStyleHash10(targetDocument, hash) { 17846 if (!targetDocument.head) { 17847 return false; 17848 } 17849 for (const style of targetDocument.head.querySelectorAll( 17850 `style[$STYLE_HASH_ATTRIBUTE10}]` 17851 )) { 17852 if (style.getAttribute(STYLE_HASH_ATTRIBUTE10) === hash) { 17853 return true; 17854 } 17855 } 17856 return false; 17857 } 17858 function injectStyle10(targetDocument, hash, css) { 17859 if (!targetDocument.head) { 17860 return; 17861 } 17862 const runtime = getRuntime10(); 17863 let injectedStyles = runtime.injectedStyles.get(targetDocument); 17864 if (!injectedStyles) { 17865 injectedStyles = /* @__PURE__ */ new Set(); 17866 runtime.injectedStyles.set(targetDocument, injectedStyles); 17867 } 17868 if (injectedStyles.has(hash)) { 17869 return; 17870 } 17871 if (documentContainsStyleHash10(targetDocument, hash)) { 17872 injectedStyles.add(hash); 17873 return; 17874 } 17875 const style = targetDocument.createElement("style"); 17876 style.setAttribute(STYLE_HASH_ATTRIBUTE10, hash); 17877 style.appendChild(targetDocument.createTextNode(css)); 17878 targetDocument.head.appendChild(style); 17879 injectedStyles.add(hash); 17880 } 17881 function registerDocument10(targetDocument) { 17882 const runtime = getRuntime10(); 17883 runtime.documents.set( 17884 targetDocument, 17885 (runtime.documents.get(targetDocument) ?? 0) + 1 17886 ); 17887 for (const [hash, css] of runtime.styles) { 17888 injectStyle10(targetDocument, hash, css); 17889 } 17890 return () => { 17891 const count = runtime.documents.get(targetDocument); 17892 if (count === void 0) { 17893 return; 17894 } 17895 if (count <= 1) { 17896 runtime.documents.delete(targetDocument); 17897 return; 17898 } 17899 runtime.documents.set(targetDocument, count - 1); 17900 }; 17901 } 17902 function registerStyle10(hash, css) { 17903 const runtime = getRuntime10(); 17904 runtime.styles.set(hash, css); 17905 for (const targetDocument of runtime.documents.keys()) { 17906 injectStyle10(targetDocument, hash, css); 17907 } 17908 } 17909 if (typeof process === "undefined" || true) { 17910 registerStyle10("e8e31009f5", "._6defc79820e382c6__button{box-sizing:var(--_gcd-button-box-sizing,border-box);font-family:var(--_gcd-button-font-family,inherit);font-size:var(--_gcd-button-font-size,inherit);font-weight:var(--_gcd-button-font-weight,inherit)}.d2cff2e5dea83bd1__input{box-sizing:var(--_gcd-input-box-sizing,border-box);font-family:var(--_gcd-input-font-family,inherit);font-size:var(--_gcd-input-font-size,inherit);font-weight:var(--_gcd-input-font-weight,inherit);margin:var(--_gcd-input-margin,0);&::placeholder{color:var(--_gcd-input-placeholder-color,var(--wpds-color-foreground-interactive-neutral-weak,#707070))}&:is(textarea,[type=text],[type=password],[type=color],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){background-color:var(--_gcd-input-background-color,transparent);border:var(--_gcd-input-border,none);border-radius:var(--_gcd-input-border-radius,0);box-shadow:var(--_gcd-input-box-shadow,0 0 0 transparent);color:var(--_gcd-input-color,var(--wpds-color-foreground-interactive-neutral,#1e1e1e));&:focus{border-color:var(--_gcd-input-border-color-focus,var(--wp-admin-theme-color));box-shadow:var(--_gcd-input-box-shadow-focus,none);outline:var(--_gcd-input-outline-focus,none)}&:disabled{background:var(--_gcd-input-background-disabled,transparent);border-color:var(--_gcd-input-border-color-disabled,transparent);box-shadow:var(--_gcd-input-box-shadow-disabled,none);color:var(--_gcd-input-color-disabled,var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d))}}&:is(textarea,[type=text],[type=password],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){line-height:var(--_gcd-input-line-height,inherit);min-height:var(--_gcd-input-min-height,auto);padding:var(--_gcd-input-padding,0)}}._547d86373d02e108__textarea{box-sizing:var(--_gcd-textarea-box-sizing,border-box);overflow:var(--_gcd-textarea-overflow,auto);resize:var(--_gcd-textarea-resize,block)}._8c15fd0ed9f28ba4__div{outline:var(--_gcd-div-outline,0 solid transparent)}p._43cec3e1eec1066d__p{font-size:var(--_gcd-p-font-size,13px);line-height:var(--_gcd-p-line-height,1.5);margin:var(--_gcd-p-margin,0)}:is(h1,h2,h3,h4,h5,h6).e97669c6d9a38497__heading{color:var(--_gcd-heading-color,var(--wpds-color-foreground-content-neutral,#1e1e1e));font-size:var(--_gcd-heading-font-size,inherit);font-weight:var(--_gcd-heading-font-weight,var(--wpds-typography-font-weight-emphasis,600));margin:var(--_gcd-heading-margin,0)}._2c0831b0499dbd6e__a,._2c0831b0499dbd6e__a:is(:hover,:focus,:active){border-radius:var(--_gcd-a-border-radius,0);box-shadow:var(--_gcd-a-box-shadow,none);color:var(--_gcd-a-color,inherit);outline:var(--_gcd-a-outline,0 solid transparent);transition:var(--_gcd-a-transition,none)}.c59a0ebebd71fa4a__ol{list-style:var(--_gcd-ol-list-style,none);margin:var(--_gcd-ol-margin,0);padding-block:var(--_gcd-ol-padding-block,0);padding-inline:var(--_gcd-ol-padding-inline,0)}._46b5cb0c8e24e8c9__li{margin:var(--_gcd-li-margin,0)}"); 17911 } 17912 var global_css_defense_default3 = { "button": "_6defc79820e382c6__button", "input": "d2cff2e5dea83bd1__input", "textarea": "_547d86373d02e108__textarea", "div": "_8c15fd0ed9f28ba4__div", "p": "_43cec3e1eec1066d__p", "heading": "e97669c6d9a38497__heading", "a": "_2c0831b0499dbd6e__a", "ol": "c59a0ebebd71fa4a__ol", "li": "_46b5cb0c8e24e8c9__li" }; 17913 if (typeof process === "undefined" || true) { 17914 registerStyle10("10f3806643", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._336cd3e4e743482f__box-sizing{box-sizing:border-box;*,:after,:before{box-sizing:inherit}}}}"); 17915 } 17916 var resets_default3 = { "box-sizing": "_336cd3e4e743482f__box-sizing" }; 17917 if (typeof process === "undefined" || true) { 17918 registerStyle10("3be1f8dffe", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._380b81b8f79fb10f__dropdown-motion,._7f344b94e270e039__dropdown-motion--fade-only{--wp-ui-dropdown-slide-distance:4px;--wp-ui-dropdown-slide-duration:var(--wpds-motion-duration-md,200ms);--wp-ui-dropdown-slide-easing:var(--wpds-motion-easing-expressive,cubic-bezier(0.25,0,0,1));--wp-ui-dropdown-fade-duration:var(--wpds-motion-duration-sm,100ms);--wp-ui-dropdown-fade-easing:linear;@media not (prefers-reduced-motion){transition-duration:var(--wp-ui-dropdown-slide-duration),var(--wp-ui-dropdown-fade-duration);transition-property:transform,opacity;transition-timing-function:var(--wp-ui-dropdown-slide-easing),var(--wp-ui-dropdown-fade-easing);will-change:transform,opacity}opacity:1;&[data-instant]{transition:none}&[data-ending-style],&[data-starting-style]{opacity:0}}._380b81b8f79fb10f__dropdown-motion{transform:translate(0);&[data-side=bottom][data-ending-style],&[data-side=bottom][data-starting-style]{transform:translateY(calc(var(--wp-ui-dropdown-slide-distance)*-1))}&[data-side=top][data-ending-style],&[data-side=top][data-starting-style]{transform:translateY(var(--wp-ui-dropdown-slide-distance))}&[data-side=left][data-ending-style],&[data-side=left][data-starting-style]{transform:translateX(var(--wp-ui-dropdown-slide-distance))}&[data-side=right][data-ending-style],&[data-side=right][data-starting-style]{transform:translateX(calc(var(--wp-ui-dropdown-slide-distance)*-1))}&[data-side=inline-start][data-ending-style],&[data-side=inline-start][data-starting-style]{transform:translateX(var(--wp-ui-dropdown-slide-distance))}&[data-side=inline-end][data-ending-style],&[data-side=inline-end][data-starting-style]{transform:translateX(calc(var(--wp-ui-dropdown-slide-distance)*-1))}&:dir(rtl)[data-side=inline-start][data-ending-style],&:dir(rtl)[data-side=inline-start][data-starting-style]{transform:translateX(calc(var(--wp-ui-dropdown-slide-distance)*-1))}&:dir(rtl)[data-side=inline-end][data-ending-style],&:dir(rtl)[data-side=inline-end][data-starting-style]{transform:translateX(var(--wp-ui-dropdown-slide-distance))}}}}@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{.d61e2d85c0ee0699__positioner{z-index:var(--wp-ui-menu-z-index,initial)}._34e81249f419a5a5__popup{--wp-ui-menu-popup-padding:var(--wpds-dimension-padding-xs,4px);--wp-ui-menu-min-width:160px;--wp-ui-menu-max-width:var(--wpds-dimension-surface-width-md,400px);--wp-ui-menu-item-padding-inline:var(--wpds-dimension-padding-md,12px);--wp-ui-menu-group-head-padding-inline:var(--wpds-dimension-padding-md,12px);--wp-ui-menu-selection-indicator-track-size:0px;--wp-ui-menu-selection-indicator-size:var(--wpds-dimension-size-sm,24px);--wp-ui-menu-selection-indicator-gap:0px;--_wp-ui-menu-elevation-md:0px 2px 3px 0px #0000000d,0px 4px 5px 0px #0000000a,0px 12px 12px 0px #00000008,0px 16px 16px 0px #00000005;background-color:var(--wpds-color-background-surface-neutral-strong,#fff);border:var(--wpds-border-width-xs,1px) solid var(--wpds-color-stroke-surface-neutral,#dbdbdb);border-radius:var(--wpds-border-radius-md,4px);box-shadow:var(--_wp-ui-menu-elevation-md);max-height:min(var(--available-height),480px,60dvh);max-width:min(var(--available-width),var(--wp-ui-menu-max-width));min-width:min(var(--available-width),var(--wp-ui-menu-min-width));outline:none;overflow-block:auto;overscroll-behavior:none;padding:var(--wp-ui-menu-popup-padding);scroll-padding:var(--wp-ui-menu-popup-padding);&:has(._42313b48c5459be3__item-selection-indicator){--wp-ui-menu-item-padding-inline:var(--wpds-dimension-padding-sm,8px);--wp-ui-menu-selection-indicator-track-size:var(--wpds-dimension-size-2xs,16px);--wp-ui-menu-selection-indicator-gap:var(--wpds-dimension-gap-sm,8px)}}._33f07ab17005471d__list{--_wp-ui-menu-item-label-line-height:var(--wpds-typography-line-height-sm,20px);color:var(--wpds-color-foreground-interactive-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-md,13px);line-height:var(--_wp-ui-menu-item-label-line-height)}._33f07ab17005471d__list,.e05914e1005d7c2e__radio-group,.f11085533c0056b0__group{--wp-ui-menu-group-prefix-gap:0px;display:grid;grid-template-columns:[item-padding-start] var(--wp-ui-menu-item-padding-inline) [selection-start] var(--wp-ui-menu-selection-indicator-track-size) [selection-end] var(--wp-ui-menu-selection-indicator-gap) [prefix-start] max-content [prefix-end] var(--wp-ui-menu-group-prefix-gap) [content-start] minmax(0,1fr) [content-end] var(--wp-ui-menu-item-padding-inline) [item-padding-end];min-width:0}.e05914e1005d7c2e__radio-group,.f11085533c0056b0__group{grid-column:1/-1}._33f07ab17005471d__list:has(>._5c913bce0d8bb0d6__item>._64924ecabf65a5d6__item-prefix),.e05914e1005d7c2e__radio-group:has(>._5c913bce0d8bb0d6__item>._64924ecabf65a5d6__item-prefix),.f11085533c0056b0__group:has(>._5c913bce0d8bb0d6__item>._64924ecabf65a5d6__item-prefix){--wp-ui-menu-group-prefix-gap:var(--wpds-dimension-gap-xs,4px)}._4a0fd085d76fd23c__group-label{align-items:center;color:var(--wpds-color-foreground-content-neutral-weak,#707070);display:flex;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-xs,11px);font-weight:var(--wpds-typography-font-weight-emphasis,600);grid-column:1/-1;line-height:var(--wpds-typography-line-height-xs,16px);min-height:var(--wpds-dimension-size-md,32px);padding-block:var(--wpds-dimension-padding-xs,4px);padding-inline:var(--wp-ui-menu-group-head-padding-inline);text-transform:uppercase}.bfc11368eadf3b39__separator{background-color:var(--wpds-color-stroke-surface-neutral-weak,#f0f0f0);grid-column:1/-1;height:var(--wpds-border-width-xs,1px);margin-block:var(--wpds-dimension-gap-xs,4px);margin-inline:var(--wp-ui-menu-group-head-padding-inline);@media (forced-colors:active){background-color:CanvasText}}._5c913bce0d8bb0d6__item{--wp-ui-menu-item-height:var(--wpds-dimension-size-md,32px);--wp-ui-menu-item-padding-block:var(--wpds-dimension-padding-xs,4px);--_gcd-a-border-radius:var(--wpds-border-radius-sm,2px);align-content:center;align-items:start;border-radius:var(--wpds-border-radius-sm,2px);display:grid;gap:0;grid-column:1/-1;grid-template-columns:[item-padding-start] var(--wp-ui-menu-item-padding-inline) [selection-start] var(--wp-ui-menu-selection-indicator-track-size) [selection-end] var(--wp-ui-menu-selection-indicator-gap) [prefix-start] max-content [prefix-end] var(--wp-ui-menu-group-prefix-gap) [content-start] minmax(0,1fr) [content-end] var(--wp-ui-menu-item-padding-inline) [item-padding-end];justify-content:stretch;min-height:var(--wp-ui-menu-item-height);min-width:0;padding-block:var(--wp-ui-menu-item-padding-block);scroll-margin:var(--wp-ui-menu-popup-padding);text-decoration:none;user-select:none;&:not([data-disabled]){cursor:var(--wpds-cursor-control,pointer)}&[href]{cursor:pointer}@supports (grid-template-columns:subgrid){grid-template-columns:subgrid}&[data-highlighted]:not([aria-disabled=true]){background-color:var(--wpds-color-background-interactive-brand-weak-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 12%,#fff));color:var(--wpds-color-foreground-interactive-neutral,#1e1e1e);outline:none;@media (forced-colors:active){--_gcd-div-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid Highlight;--_gcd-a-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid Highlight}}&[aria-disabled=true]{background-color:var(--wpds-color-background-interactive-brand-weak-disabled,#0000);color:var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d);@media (forced-colors:active){color:GrayText}}}._42313b48c5459be3__item-selection-indicator,._64924ecabf65a5d6__item-prefix,.af879698ede76757__item-content{grid-row:1}._42313b48c5459be3__item-selection-indicator{align-items:center;color:var(--wpds-color-foreground-content-neutral-weak,#707070);display:flex;grid-column:selection-start/selection-end;height:var(--_wp-ui-menu-item-label-line-height);justify-content:center;justify-self:center;pointer-events:none;width:var(--wp-ui-menu-selection-indicator-size);&[data-unchecked]{opacity:0}}._99c5bd141cbf516f__checkbox-selection-icon{translate:0 1px}._59aa9b3b3a651148__radio-selection-icon{fill:currentColor;height:var(--wpds-dimension-size-xs,20px);width:var(--wpds-dimension-size-xs,20px)}._64924ecabf65a5d6__item-prefix{align-items:center;color:var(--wpds-color-foreground-content-neutral-weak,#707070);display:flex;gap:var(--wpds-dimension-gap-xs,4px);grid-column:prefix-start/prefix-end;justify-content:center;min-width:0}.a836378335a4cbf1__prefix-icon{align-self:flex-start;flex-shrink:0;margin-block-start:calc((var(--_wp-ui-menu-item-label-line-height) - var(--_wp-ui-menu-prefix-icon-size))/2)}.af879698ede76757__item-content{align-items:center;align-self:stretch;box-sizing:border-box;display:grid;grid-column:content-start/content-end;grid-template-columns:[label-start] minmax(0,1fr) [label-end suffix-start] auto [suffix-end shortcut-start] auto [shortcut-end trailing-start] auto [trailing-end];min-width:0;pointer-events:none}._943a932d9f81c78c__item-children{display:inline-flex;flex-direction:column;gap:2px;grid-column:label-start/label-end;min-width:0}._5ed41da4abcf8958__item-label{--_gcd-heading-color:currentColor;--_gcd-p-line-height:var(--_wp-ui-menu-item-label-line-height);color:inherit;line-height:var(--_wp-ui-menu-item-label-line-height);min-width:0;overflow-wrap:anywhere}.fa88c9f1a96a4c5a__item-description{--_gcd-heading-color:var(--wpds-color-foreground-content-neutral-weak,#707070);color:var(--wpds-color-foreground-content-neutral-weak,#707070);overflow-wrap:anywhere;padding-block-end:var(--wpds-dimension-padding-xs,4px)}._091406749ed93e6e__item-suffix{align-items:center;display:flex;gap:var(--wpds-dimension-gap-xs,4px);grid-column:suffix-start/suffix-end}._091406749ed93e6e__item-suffix,._23630f40071a29ff__item-shortcut{color:var(--wpds-color-foreground-content-neutral-weak,#707070);margin-inline-start:var(--wpds-dimension-gap-md,12px)}._23630f40071a29ff__item-shortcut{grid-column:shortcut-start/shortcut-end}._06be17a91bf434a0__item-trailing{align-items:center;color:var(--wpds-color-foreground-content-neutral-weak,#707070);display:flex;grid-column:trailing-start/trailing-end;margin-inline-start:var(--wpds-dimension-gap-md,12px)}._943a932d9f81c78c__item-children+:is(._091406749ed93e6e__item-suffix,._23630f40071a29ff__item-shortcut,._06be17a91bf434a0__item-trailing){margin-inline-start:var(--wpds-dimension-gap-xl,24px)}._23630f40071a29ff__item-shortcut+._06be17a91bf434a0__item-trailing{margin-inline-start:var(--wpds-dimension-gap-xs,4px)}.b78aec79bf93eba0__submenu-chevron{margin-inline-end:calc(var(--wpds-dimension-gap-sm, 8px)*-1)}.b78aec79bf93eba0__submenu-chevron:dir(rtl){transform:rotate(180deg)}._60da3b6f9718cf76__external-link-indicator{display:inline-block;font-weight:var(--wpds-typography-font-weight-default,400);line-height:1;margin-inline-start:var(--wpds-dimension-gap-xs,4px);text-decoration:none}._60da3b6f9718cf76__external-link-indicator:after{content:"\\2197"}._60da3b6f9718cf76__external-link-indicator:dir(rtl):after{content:"\\2196"}._5c913bce0d8bb0d6__item[aria-disabled=true] ._06be17a91bf434a0__item-trailing,._5c913bce0d8bb0d6__item[aria-disabled=true] ._091406749ed93e6e__item-suffix,._5c913bce0d8bb0d6__item[aria-disabled=true] ._23630f40071a29ff__item-shortcut,._5c913bce0d8bb0d6__item[aria-disabled=true] ._42313b48c5459be3__item-selection-indicator,._5c913bce0d8bb0d6__item[aria-disabled=true] ._64924ecabf65a5d6__item-prefix,._5c913bce0d8bb0d6__item[aria-disabled=true] .fa88c9f1a96a4c5a__item-description,._5c913bce0d8bb0d6__item[data-highlighted]:not([aria-disabled=true]) ._06be17a91bf434a0__item-trailing,._5c913bce0d8bb0d6__item[data-highlighted]:not([aria-disabled=true]) ._091406749ed93e6e__item-suffix,._5c913bce0d8bb0d6__item[data-highlighted]:not([aria-disabled=true]) ._23630f40071a29ff__item-shortcut,._5c913bce0d8bb0d6__item[data-highlighted]:not([aria-disabled=true]) ._42313b48c5459be3__item-selection-indicator,._5c913bce0d8bb0d6__item[data-highlighted]:not([aria-disabled=true]) ._64924ecabf65a5d6__item-prefix,._5c913bce0d8bb0d6__item[data-highlighted]:not([aria-disabled=true]) .fa88c9f1a96a4c5a__item-description{--_gcd-heading-color:currentColor;color:inherit}}}'); 17919 } 17920 var style_default9 = { "positioner": "d61e2d85c0ee0699__positioner", "popup": "_34e81249f419a5a5__popup", "item-selection-indicator": "_42313b48c5459be3__item-selection-indicator", "is-root": "_087a537b24fee6a1__is-root _380b81b8f79fb10f__dropdown-motion", "is-submenu": "_6d3b567f6289bdc2__is-submenu _7f344b94e270e039__dropdown-motion--fade-only", "list": "_33f07ab17005471d__list", "group": "f11085533c0056b0__group", "radio-group": "e05914e1005d7c2e__radio-group", "item": "_5c913bce0d8bb0d6__item", "item-prefix": "_64924ecabf65a5d6__item-prefix", "group-label": "_4a0fd085d76fd23c__group-label", "separator": "bfc11368eadf3b39__separator", "item-content": "af879698ede76757__item-content", "checkbox-selection-icon": "_99c5bd141cbf516f__checkbox-selection-icon", "radio-selection-icon": "_59aa9b3b3a651148__radio-selection-icon", "prefix-icon": "a836378335a4cbf1__prefix-icon", "item-children": "_943a932d9f81c78c__item-children", "item-label": "_5ed41da4abcf8958__item-label", "item-description": "fa88c9f1a96a4c5a__item-description", "item-suffix": "_091406749ed93e6e__item-suffix", "item-shortcut": "_23630f40071a29ff__item-shortcut", "item-trailing": "_06be17a91bf434a0__item-trailing", "submenu-chevron": "b78aec79bf93eba0__submenu-chevron", "external-link-indicator": "_60da3b6f9718cf76__external-link-indicator" }; 17921 var ITEM_CONTENT_COMPONENTS = { 17922 Label: ItemLabel, 17923 Description: ItemDescription, 17924 validationMessage: "Menu.ItemLabel must be the first direct child of every menu item, followed only by Menu.ItemDescription components.", 17925 descriptionValidationToken: ITEM_DESCRIPTION_DIRECT_CHILD 17926 }; 17927 function useItemContent2(children, { 17928 "aria-describedby": ariaDescribedBy, 17929 "aria-keyshortcuts": ariaKeyShortcuts, 17930 "aria-label": ariaLabel, 17931 "aria-labelledby": ariaLabelledBy, 17932 labelTrailing, 17933 shortcut 17934 }) { 17935 const { contentChildren, resolvedLabelId, itemAriaProps } = useItemContent(children, ITEM_CONTENT_COMPONENTS, { 17936 "aria-describedby": ariaDescribedBy, 17937 "aria-label": ariaLabel, 17938 "aria-labelledby": ariaLabelledBy 17939 }); 17940 const { 17941 descriptionId: shortcutDescriptionId, 17942 targetProps: shortcutAriaProps 17943 } = useKeyboardShortcutProps({ 17944 "aria-describedby": itemAriaProps["aria-describedby"], 17945 "aria-keyshortcuts": ariaKeyShortcuts, 17946 shortcut 17947 }); 17948 return { 17949 // React widens the tuple while mapping; validation preserves the item-child 17950 // contract and cloning changes only generated description IDs. 17951 contentChildren, 17952 contentContextValue: { 17953 labelId: resolvedLabelId, 17954 labelTrailing 17955 }, 17956 itemAriaProps: { 17957 ...shortcutAriaProps, 17958 "aria-label": itemAriaProps["aria-label"], 17959 "aria-labelledby": itemAriaProps["aria-labelledby"] 17960 }, 17961 shortcutDescriptionId 17962 }; 17963 } 17964 function ItemContent({ 17965 children, 17966 prefix, 17967 shortcut, 17968 shortcutDescriptionId, 17969 suffix, 17970 trailing 17971 }) { 17972 const hasPrefix = import_element30.Children.toArray(prefix).some( 17973 (child) => child !== "" 17974 ); 17975 const hasSuffix = import_element30.Children.toArray(suffix).some( 17976 (child) => child !== "" 17977 ); 17978 const hasTrailing = import_element30.Children.toArray(trailing).some( 17979 (child) => child !== "" 17980 ); 17981 return /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)(import_jsx_runtime78.Fragment, { children: [ 17982 /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)("span", { className: style_default9["item-content"], children: [ 17983 /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("span", { className: style_default9["item-children"], children }), 17984 hasSuffix && /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("span", { className: style_default9["item-suffix"], children: suffix }), 17985 shortcut && /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("span", { className: style_default9["item-shortcut"], children: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(KeyboardShortcutDisplay, { shortcut }) }), 17986 hasTrailing && /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("span", { className: style_default9["item-trailing"], children: trailing }) 17987 ] }), 17988 hasPrefix && /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("span", { "aria-hidden": "true", className: style_default9["item-prefix"], children: prefix }), 17989 shortcut && shortcutDescriptionId && /* @__PURE__ */ (0, import_jsx_runtime78.jsx)( 17990 KeyboardShortcutDescription, 17991 { 17992 descriptionId: shortcutDescriptionId, 17993 shortcut 17994 } 17995 ) 17996 ] }); 17997 } 17998 var Item = (0, import_element30.forwardRef)(function MenuItem3({ 17999 children, 18000 className, 18001 prefix, 18002 shortcut, 18003 suffix, 18004 "aria-describedby": ariaDescribedBy, 18005 "aria-keyshortcuts": ariaKeyShortcuts, 18006 "aria-label": ariaLabel, 18007 "aria-labelledby": ariaLabelledBy, 18008 ...props 18009 }, ref) { 18010 const { 18011 contentChildren, 18012 contentContextValue, 18013 itemAriaProps, 18014 shortcutDescriptionId 18015 } = useItemContent2(children, { 18016 "aria-describedby": ariaDescribedBy, 18017 "aria-keyshortcuts": ariaKeyShortcuts, 18018 "aria-label": ariaLabel, 18019 "aria-labelledby": ariaLabelledBy, 18020 shortcut 18021 }); 18022 return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)( 18023 index_parts_exports.Item, 18024 { 18025 ref, 18026 ...itemAriaProps, 18027 className: clsx_default( 18028 global_css_defense_default3.div, 18029 resets_default3["box-sizing"], 18030 style_default9.item, 18031 className 18032 ), 18033 ...props, 18034 children: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(MenuItemContentContext.Provider, { value: contentContextValue, children: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)( 18035 ItemContent, 18036 { 18037 prefix, 18038 shortcut, 18039 shortcutDescriptionId, 18040 suffix, 18041 children: contentChildren 18042 } 18043 ) }) 18044 } 18045 ); 18046 }); 18047 18048 // packages/ui/build-module/menu/checkbox-item.mjs 18049 var import_jsx_runtime79 = __toESM(require_jsx_runtime(), 1); 18050 var STYLE_HASH_ATTRIBUTE11 = "data-wp-hash"; 18051 function getRuntime11() { 18052 const globalScope = globalThis; 18053 if (globalScope.__wpStyleRuntime) { 18054 return globalScope.__wpStyleRuntime; 18055 } 18056 globalScope.__wpStyleRuntime = { 18057 documents: /* @__PURE__ */ new Map(), 18058 styles: /* @__PURE__ */ new Map(), 18059 injectedStyles: /* @__PURE__ */ new WeakMap() 18060 }; 18061 if (typeof document !== "undefined") { 18062 registerDocument11(document); 18063 } 18064 return globalScope.__wpStyleRuntime; 18065 } 18066 function documentContainsStyleHash11(targetDocument, hash) { 18067 if (!targetDocument.head) { 18068 return false; 18069 } 18070 for (const style of targetDocument.head.querySelectorAll( 18071 `style[$STYLE_HASH_ATTRIBUTE11}]` 18072 )) { 18073 if (style.getAttribute(STYLE_HASH_ATTRIBUTE11) === hash) { 18074 return true; 18075 } 18076 } 18077 return false; 18078 } 18079 function injectStyle11(targetDocument, hash, css) { 18080 if (!targetDocument.head) { 18081 return; 18082 } 18083 const runtime = getRuntime11(); 18084 let injectedStyles = runtime.injectedStyles.get(targetDocument); 18085 if (!injectedStyles) { 18086 injectedStyles = /* @__PURE__ */ new Set(); 18087 runtime.injectedStyles.set(targetDocument, injectedStyles); 18088 } 18089 if (injectedStyles.has(hash)) { 18090 return; 18091 } 18092 if (documentContainsStyleHash11(targetDocument, hash)) { 18093 injectedStyles.add(hash); 18094 return; 18095 } 18096 const style = targetDocument.createElement("style"); 18097 style.setAttribute(STYLE_HASH_ATTRIBUTE11, hash); 18098 style.appendChild(targetDocument.createTextNode(css)); 18099 targetDocument.head.appendChild(style); 18100 injectedStyles.add(hash); 18101 } 18102 function registerDocument11(targetDocument) { 18103 const runtime = getRuntime11(); 18104 runtime.documents.set( 18105 targetDocument, 18106 (runtime.documents.get(targetDocument) ?? 0) + 1 18107 ); 18108 for (const [hash, css] of runtime.styles) { 18109 injectStyle11(targetDocument, hash, css); 18110 } 18111 return () => { 18112 const count = runtime.documents.get(targetDocument); 18113 if (count === void 0) { 18114 return; 18115 } 18116 if (count <= 1) { 18117 runtime.documents.delete(targetDocument); 18118 return; 18119 } 18120 runtime.documents.set(targetDocument, count - 1); 18121 }; 18122 } 18123 function registerStyle11(hash, css) { 18124 const runtime = getRuntime11(); 18125 runtime.styles.set(hash, css); 18126 for (const targetDocument of runtime.documents.keys()) { 18127 injectStyle11(targetDocument, hash, css); 18128 } 18129 } 18130 if (typeof process === "undefined" || true) { 18131 registerStyle11("e8e31009f5", "._6defc79820e382c6__button{box-sizing:var(--_gcd-button-box-sizing,border-box);font-family:var(--_gcd-button-font-family,inherit);font-size:var(--_gcd-button-font-size,inherit);font-weight:var(--_gcd-button-font-weight,inherit)}.d2cff2e5dea83bd1__input{box-sizing:var(--_gcd-input-box-sizing,border-box);font-family:var(--_gcd-input-font-family,inherit);font-size:var(--_gcd-input-font-size,inherit);font-weight:var(--_gcd-input-font-weight,inherit);margin:var(--_gcd-input-margin,0);&::placeholder{color:var(--_gcd-input-placeholder-color,var(--wpds-color-foreground-interactive-neutral-weak,#707070))}&:is(textarea,[type=text],[type=password],[type=color],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){background-color:var(--_gcd-input-background-color,transparent);border:var(--_gcd-input-border,none);border-radius:var(--_gcd-input-border-radius,0);box-shadow:var(--_gcd-input-box-shadow,0 0 0 transparent);color:var(--_gcd-input-color,var(--wpds-color-foreground-interactive-neutral,#1e1e1e));&:focus{border-color:var(--_gcd-input-border-color-focus,var(--wp-admin-theme-color));box-shadow:var(--_gcd-input-box-shadow-focus,none);outline:var(--_gcd-input-outline-focus,none)}&:disabled{background:var(--_gcd-input-background-disabled,transparent);border-color:var(--_gcd-input-border-color-disabled,transparent);box-shadow:var(--_gcd-input-box-shadow-disabled,none);color:var(--_gcd-input-color-disabled,var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d))}}&:is(textarea,[type=text],[type=password],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){line-height:var(--_gcd-input-line-height,inherit);min-height:var(--_gcd-input-min-height,auto);padding:var(--_gcd-input-padding,0)}}._547d86373d02e108__textarea{box-sizing:var(--_gcd-textarea-box-sizing,border-box);overflow:var(--_gcd-textarea-overflow,auto);resize:var(--_gcd-textarea-resize,block)}._8c15fd0ed9f28ba4__div{outline:var(--_gcd-div-outline,0 solid transparent)}p._43cec3e1eec1066d__p{font-size:var(--_gcd-p-font-size,13px);line-height:var(--_gcd-p-line-height,1.5);margin:var(--_gcd-p-margin,0)}:is(h1,h2,h3,h4,h5,h6).e97669c6d9a38497__heading{color:var(--_gcd-heading-color,var(--wpds-color-foreground-content-neutral,#1e1e1e));font-size:var(--_gcd-heading-font-size,inherit);font-weight:var(--_gcd-heading-font-weight,var(--wpds-typography-font-weight-emphasis,600));margin:var(--_gcd-heading-margin,0)}._2c0831b0499dbd6e__a,._2c0831b0499dbd6e__a:is(:hover,:focus,:active){border-radius:var(--_gcd-a-border-radius,0);box-shadow:var(--_gcd-a-box-shadow,none);color:var(--_gcd-a-color,inherit);outline:var(--_gcd-a-outline,0 solid transparent);transition:var(--_gcd-a-transition,none)}.c59a0ebebd71fa4a__ol{list-style:var(--_gcd-ol-list-style,none);margin:var(--_gcd-ol-margin,0);padding-block:var(--_gcd-ol-padding-block,0);padding-inline:var(--_gcd-ol-padding-inline,0)}._46b5cb0c8e24e8c9__li{margin:var(--_gcd-li-margin,0)}"); 18132 } 18133 var global_css_defense_default4 = { "button": "_6defc79820e382c6__button", "input": "d2cff2e5dea83bd1__input", "textarea": "_547d86373d02e108__textarea", "div": "_8c15fd0ed9f28ba4__div", "p": "_43cec3e1eec1066d__p", "heading": "e97669c6d9a38497__heading", "a": "_2c0831b0499dbd6e__a", "ol": "c59a0ebebd71fa4a__ol", "li": "_46b5cb0c8e24e8c9__li" }; 18134 if (typeof process === "undefined" || true) { 18135 registerStyle11("10f3806643", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._336cd3e4e743482f__box-sizing{box-sizing:border-box;*,:after,:before{box-sizing:inherit}}}}"); 18136 } 18137 var resets_default4 = { "box-sizing": "_336cd3e4e743482f__box-sizing" }; 18138 if (typeof process === "undefined" || true) { 18139 registerStyle11("3be1f8dffe", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._380b81b8f79fb10f__dropdown-motion,._7f344b94e270e039__dropdown-motion--fade-only{--wp-ui-dropdown-slide-distance:4px;--wp-ui-dropdown-slide-duration:var(--wpds-motion-duration-md,200ms);--wp-ui-dropdown-slide-easing:var(--wpds-motion-easing-expressive,cubic-bezier(0.25,0,0,1));--wp-ui-dropdown-fade-duration:var(--wpds-motion-duration-sm,100ms);--wp-ui-dropdown-fade-easing:linear;@media not (prefers-reduced-motion){transition-duration:var(--wp-ui-dropdown-slide-duration),var(--wp-ui-dropdown-fade-duration);transition-property:transform,opacity;transition-timing-function:var(--wp-ui-dropdown-slide-easing),var(--wp-ui-dropdown-fade-easing);will-change:transform,opacity}opacity:1;&[data-instant]{transition:none}&[data-ending-style],&[data-starting-style]{opacity:0}}._380b81b8f79fb10f__dropdown-motion{transform:translate(0);&[data-side=bottom][data-ending-style],&[data-side=bottom][data-starting-style]{transform:translateY(calc(var(--wp-ui-dropdown-slide-distance)*-1))}&[data-side=top][data-ending-style],&[data-side=top][data-starting-style]{transform:translateY(var(--wp-ui-dropdown-slide-distance))}&[data-side=left][data-ending-style],&[data-side=left][data-starting-style]{transform:translateX(var(--wp-ui-dropdown-slide-distance))}&[data-side=right][data-ending-style],&[data-side=right][data-starting-style]{transform:translateX(calc(var(--wp-ui-dropdown-slide-distance)*-1))}&[data-side=inline-start][data-ending-style],&[data-side=inline-start][data-starting-style]{transform:translateX(var(--wp-ui-dropdown-slide-distance))}&[data-side=inline-end][data-ending-style],&[data-side=inline-end][data-starting-style]{transform:translateX(calc(var(--wp-ui-dropdown-slide-distance)*-1))}&:dir(rtl)[data-side=inline-start][data-ending-style],&:dir(rtl)[data-side=inline-start][data-starting-style]{transform:translateX(calc(var(--wp-ui-dropdown-slide-distance)*-1))}&:dir(rtl)[data-side=inline-end][data-ending-style],&:dir(rtl)[data-side=inline-end][data-starting-style]{transform:translateX(var(--wp-ui-dropdown-slide-distance))}}}}@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{.d61e2d85c0ee0699__positioner{z-index:var(--wp-ui-menu-z-index,initial)}._34e81249f419a5a5__popup{--wp-ui-menu-popup-padding:var(--wpds-dimension-padding-xs,4px);--wp-ui-menu-min-width:160px;--wp-ui-menu-max-width:var(--wpds-dimension-surface-width-md,400px);--wp-ui-menu-item-padding-inline:var(--wpds-dimension-padding-md,12px);--wp-ui-menu-group-head-padding-inline:var(--wpds-dimension-padding-md,12px);--wp-ui-menu-selection-indicator-track-size:0px;--wp-ui-menu-selection-indicator-size:var(--wpds-dimension-size-sm,24px);--wp-ui-menu-selection-indicator-gap:0px;--_wp-ui-menu-elevation-md:0px 2px 3px 0px #0000000d,0px 4px 5px 0px #0000000a,0px 12px 12px 0px #00000008,0px 16px 16px 0px #00000005;background-color:var(--wpds-color-background-surface-neutral-strong,#fff);border:var(--wpds-border-width-xs,1px) solid var(--wpds-color-stroke-surface-neutral,#dbdbdb);border-radius:var(--wpds-border-radius-md,4px);box-shadow:var(--_wp-ui-menu-elevation-md);max-height:min(var(--available-height),480px,60dvh);max-width:min(var(--available-width),var(--wp-ui-menu-max-width));min-width:min(var(--available-width),var(--wp-ui-menu-min-width));outline:none;overflow-block:auto;overscroll-behavior:none;padding:var(--wp-ui-menu-popup-padding);scroll-padding:var(--wp-ui-menu-popup-padding);&:has(._42313b48c5459be3__item-selection-indicator){--wp-ui-menu-item-padding-inline:var(--wpds-dimension-padding-sm,8px);--wp-ui-menu-selection-indicator-track-size:var(--wpds-dimension-size-2xs,16px);--wp-ui-menu-selection-indicator-gap:var(--wpds-dimension-gap-sm,8px)}}._33f07ab17005471d__list{--_wp-ui-menu-item-label-line-height:var(--wpds-typography-line-height-sm,20px);color:var(--wpds-color-foreground-interactive-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-md,13px);line-height:var(--_wp-ui-menu-item-label-line-height)}._33f07ab17005471d__list,.e05914e1005d7c2e__radio-group,.f11085533c0056b0__group{--wp-ui-menu-group-prefix-gap:0px;display:grid;grid-template-columns:[item-padding-start] var(--wp-ui-menu-item-padding-inline) [selection-start] var(--wp-ui-menu-selection-indicator-track-size) [selection-end] var(--wp-ui-menu-selection-indicator-gap) [prefix-start] max-content [prefix-end] var(--wp-ui-menu-group-prefix-gap) [content-start] minmax(0,1fr) [content-end] var(--wp-ui-menu-item-padding-inline) [item-padding-end];min-width:0}.e05914e1005d7c2e__radio-group,.f11085533c0056b0__group{grid-column:1/-1}._33f07ab17005471d__list:has(>._5c913bce0d8bb0d6__item>._64924ecabf65a5d6__item-prefix),.e05914e1005d7c2e__radio-group:has(>._5c913bce0d8bb0d6__item>._64924ecabf65a5d6__item-prefix),.f11085533c0056b0__group:has(>._5c913bce0d8bb0d6__item>._64924ecabf65a5d6__item-prefix){--wp-ui-menu-group-prefix-gap:var(--wpds-dimension-gap-xs,4px)}._4a0fd085d76fd23c__group-label{align-items:center;color:var(--wpds-color-foreground-content-neutral-weak,#707070);display:flex;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-xs,11px);font-weight:var(--wpds-typography-font-weight-emphasis,600);grid-column:1/-1;line-height:var(--wpds-typography-line-height-xs,16px);min-height:var(--wpds-dimension-size-md,32px);padding-block:var(--wpds-dimension-padding-xs,4px);padding-inline:var(--wp-ui-menu-group-head-padding-inline);text-transform:uppercase}.bfc11368eadf3b39__separator{background-color:var(--wpds-color-stroke-surface-neutral-weak,#f0f0f0);grid-column:1/-1;height:var(--wpds-border-width-xs,1px);margin-block:var(--wpds-dimension-gap-xs,4px);margin-inline:var(--wp-ui-menu-group-head-padding-inline);@media (forced-colors:active){background-color:CanvasText}}._5c913bce0d8bb0d6__item{--wp-ui-menu-item-height:var(--wpds-dimension-size-md,32px);--wp-ui-menu-item-padding-block:var(--wpds-dimension-padding-xs,4px);--_gcd-a-border-radius:var(--wpds-border-radius-sm,2px);align-content:center;align-items:start;border-radius:var(--wpds-border-radius-sm,2px);display:grid;gap:0;grid-column:1/-1;grid-template-columns:[item-padding-start] var(--wp-ui-menu-item-padding-inline) [selection-start] var(--wp-ui-menu-selection-indicator-track-size) [selection-end] var(--wp-ui-menu-selection-indicator-gap) [prefix-start] max-content [prefix-end] var(--wp-ui-menu-group-prefix-gap) [content-start] minmax(0,1fr) [content-end] var(--wp-ui-menu-item-padding-inline) [item-padding-end];justify-content:stretch;min-height:var(--wp-ui-menu-item-height);min-width:0;padding-block:var(--wp-ui-menu-item-padding-block);scroll-margin:var(--wp-ui-menu-popup-padding);text-decoration:none;user-select:none;&:not([data-disabled]){cursor:var(--wpds-cursor-control,pointer)}&[href]{cursor:pointer}@supports (grid-template-columns:subgrid){grid-template-columns:subgrid}&[data-highlighted]:not([aria-disabled=true]){background-color:var(--wpds-color-background-interactive-brand-weak-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 12%,#fff));color:var(--wpds-color-foreground-interactive-neutral,#1e1e1e);outline:none;@media (forced-colors:active){--_gcd-div-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid Highlight;--_gcd-a-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid Highlight}}&[aria-disabled=true]{background-color:var(--wpds-color-background-interactive-brand-weak-disabled,#0000);color:var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d);@media (forced-colors:active){color:GrayText}}}._42313b48c5459be3__item-selection-indicator,._64924ecabf65a5d6__item-prefix,.af879698ede76757__item-content{grid-row:1}._42313b48c5459be3__item-selection-indicator{align-items:center;color:var(--wpds-color-foreground-content-neutral-weak,#707070);display:flex;grid-column:selection-start/selection-end;height:var(--_wp-ui-menu-item-label-line-height);justify-content:center;justify-self:center;pointer-events:none;width:var(--wp-ui-menu-selection-indicator-size);&[data-unchecked]{opacity:0}}._99c5bd141cbf516f__checkbox-selection-icon{translate:0 1px}._59aa9b3b3a651148__radio-selection-icon{fill:currentColor;height:var(--wpds-dimension-size-xs,20px);width:var(--wpds-dimension-size-xs,20px)}._64924ecabf65a5d6__item-prefix{align-items:center;color:var(--wpds-color-foreground-content-neutral-weak,#707070);display:flex;gap:var(--wpds-dimension-gap-xs,4px);grid-column:prefix-start/prefix-end;justify-content:center;min-width:0}.a836378335a4cbf1__prefix-icon{align-self:flex-start;flex-shrink:0;margin-block-start:calc((var(--_wp-ui-menu-item-label-line-height) - var(--_wp-ui-menu-prefix-icon-size))/2)}.af879698ede76757__item-content{align-items:center;align-self:stretch;box-sizing:border-box;display:grid;grid-column:content-start/content-end;grid-template-columns:[label-start] minmax(0,1fr) [label-end suffix-start] auto [suffix-end shortcut-start] auto [shortcut-end trailing-start] auto [trailing-end];min-width:0;pointer-events:none}._943a932d9f81c78c__item-children{display:inline-flex;flex-direction:column;gap:2px;grid-column:label-start/label-end;min-width:0}._5ed41da4abcf8958__item-label{--_gcd-heading-color:currentColor;--_gcd-p-line-height:var(--_wp-ui-menu-item-label-line-height);color:inherit;line-height:var(--_wp-ui-menu-item-label-line-height);min-width:0;overflow-wrap:anywhere}.fa88c9f1a96a4c5a__item-description{--_gcd-heading-color:var(--wpds-color-foreground-content-neutral-weak,#707070);color:var(--wpds-color-foreground-content-neutral-weak,#707070);overflow-wrap:anywhere;padding-block-end:var(--wpds-dimension-padding-xs,4px)}._091406749ed93e6e__item-suffix{align-items:center;display:flex;gap:var(--wpds-dimension-gap-xs,4px);grid-column:suffix-start/suffix-end}._091406749ed93e6e__item-suffix,._23630f40071a29ff__item-shortcut{color:var(--wpds-color-foreground-content-neutral-weak,#707070);margin-inline-start:var(--wpds-dimension-gap-md,12px)}._23630f40071a29ff__item-shortcut{grid-column:shortcut-start/shortcut-end}._06be17a91bf434a0__item-trailing{align-items:center;color:var(--wpds-color-foreground-content-neutral-weak,#707070);display:flex;grid-column:trailing-start/trailing-end;margin-inline-start:var(--wpds-dimension-gap-md,12px)}._943a932d9f81c78c__item-children+:is(._091406749ed93e6e__item-suffix,._23630f40071a29ff__item-shortcut,._06be17a91bf434a0__item-trailing){margin-inline-start:var(--wpds-dimension-gap-xl,24px)}._23630f40071a29ff__item-shortcut+._06be17a91bf434a0__item-trailing{margin-inline-start:var(--wpds-dimension-gap-xs,4px)}.b78aec79bf93eba0__submenu-chevron{margin-inline-end:calc(var(--wpds-dimension-gap-sm, 8px)*-1)}.b78aec79bf93eba0__submenu-chevron:dir(rtl){transform:rotate(180deg)}._60da3b6f9718cf76__external-link-indicator{display:inline-block;font-weight:var(--wpds-typography-font-weight-default,400);line-height:1;margin-inline-start:var(--wpds-dimension-gap-xs,4px);text-decoration:none}._60da3b6f9718cf76__external-link-indicator:after{content:"\\2197"}._60da3b6f9718cf76__external-link-indicator:dir(rtl):after{content:"\\2196"}._5c913bce0d8bb0d6__item[aria-disabled=true] ._06be17a91bf434a0__item-trailing,._5c913bce0d8bb0d6__item[aria-disabled=true] ._091406749ed93e6e__item-suffix,._5c913bce0d8bb0d6__item[aria-disabled=true] ._23630f40071a29ff__item-shortcut,._5c913bce0d8bb0d6__item[aria-disabled=true] ._42313b48c5459be3__item-selection-indicator,._5c913bce0d8bb0d6__item[aria-disabled=true] ._64924ecabf65a5d6__item-prefix,._5c913bce0d8bb0d6__item[aria-disabled=true] .fa88c9f1a96a4c5a__item-description,._5c913bce0d8bb0d6__item[data-highlighted]:not([aria-disabled=true]) ._06be17a91bf434a0__item-trailing,._5c913bce0d8bb0d6__item[data-highlighted]:not([aria-disabled=true]) ._091406749ed93e6e__item-suffix,._5c913bce0d8bb0d6__item[data-highlighted]:not([aria-disabled=true]) ._23630f40071a29ff__item-shortcut,._5c913bce0d8bb0d6__item[data-highlighted]:not([aria-disabled=true]) ._42313b48c5459be3__item-selection-indicator,._5c913bce0d8bb0d6__item[data-highlighted]:not([aria-disabled=true]) ._64924ecabf65a5d6__item-prefix,._5c913bce0d8bb0d6__item[data-highlighted]:not([aria-disabled=true]) .fa88c9f1a96a4c5a__item-description{--_gcd-heading-color:currentColor;color:inherit}}}'); 18140 } 18141 var style_default10 = { "positioner": "d61e2d85c0ee0699__positioner", "popup": "_34e81249f419a5a5__popup", "item-selection-indicator": "_42313b48c5459be3__item-selection-indicator", "is-root": "_087a537b24fee6a1__is-root _380b81b8f79fb10f__dropdown-motion", "is-submenu": "_6d3b567f6289bdc2__is-submenu _7f344b94e270e039__dropdown-motion--fade-only", "list": "_33f07ab17005471d__list", "group": "f11085533c0056b0__group", "radio-group": "e05914e1005d7c2e__radio-group", "item": "_5c913bce0d8bb0d6__item", "item-prefix": "_64924ecabf65a5d6__item-prefix", "group-label": "_4a0fd085d76fd23c__group-label", "separator": "bfc11368eadf3b39__separator", "item-content": "af879698ede76757__item-content", "checkbox-selection-icon": "_99c5bd141cbf516f__checkbox-selection-icon", "radio-selection-icon": "_59aa9b3b3a651148__radio-selection-icon", "prefix-icon": "a836378335a4cbf1__prefix-icon", "item-children": "_943a932d9f81c78c__item-children", "item-label": "_5ed41da4abcf8958__item-label", "item-description": "fa88c9f1a96a4c5a__item-description", "item-suffix": "_091406749ed93e6e__item-suffix", "item-shortcut": "_23630f40071a29ff__item-shortcut", "item-trailing": "_06be17a91bf434a0__item-trailing", "submenu-chevron": "b78aec79bf93eba0__submenu-chevron", "external-link-indicator": "_60da3b6f9718cf76__external-link-indicator" }; 18142 var CheckboxItem = (0, import_element31.forwardRef)( 18143 function MenuCheckboxItem3({ 18144 children, 18145 className, 18146 prefix, 18147 shortcut, 18148 suffix, 18149 "aria-describedby": ariaDescribedBy, 18150 "aria-keyshortcuts": ariaKeyShortcuts, 18151 "aria-label": ariaLabel, 18152 "aria-labelledby": ariaLabelledBy, 18153 ...props 18154 }, ref) { 18155 const { 18156 contentChildren, 18157 contentContextValue, 18158 itemAriaProps, 18159 shortcutDescriptionId 18160 } = useItemContent2(children, { 18161 "aria-describedby": ariaDescribedBy, 18162 "aria-keyshortcuts": ariaKeyShortcuts, 18163 "aria-label": ariaLabel, 18164 "aria-labelledby": ariaLabelledBy, 18165 shortcut 18166 }); 18167 return /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)( 18168 index_parts_exports.CheckboxItem, 18169 { 18170 ref, 18171 ...itemAriaProps, 18172 className: clsx_default( 18173 global_css_defense_default4.div, 18174 resets_default4["box-sizing"], 18175 style_default10.item, 18176 className 18177 ), 18178 ...props, 18179 children: [ 18180 /* @__PURE__ */ (0, import_jsx_runtime79.jsx)( 18181 index_parts_exports.CheckboxItemIndicator, 18182 { 18183 keepMounted: true, 18184 className: style_default10["item-selection-indicator"], 18185 children: /* @__PURE__ */ (0, import_jsx_runtime79.jsx)( 18186 Icon, 18187 { 18188 icon: check_default, 18189 size: 24, 18190 className: style_default10["checkbox-selection-icon"], 18191 "aria-hidden": "true" 18192 } 18193 ) 18194 } 18195 ), 18196 /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(MenuItemContentContext.Provider, { value: contentContextValue, children: /* @__PURE__ */ (0, import_jsx_runtime79.jsx)( 18197 ItemContent, 18198 { 18199 prefix, 18200 shortcut, 18201 shortcutDescriptionId, 18202 suffix, 18203 children: contentChildren 18204 } 18205 ) }) 18206 ] 18207 } 18208 ); 18209 } 18210 ); 18211 18212 // packages/ui/build-module/menu/group.mjs 18213 var import_element32 = __toESM(require_element(), 1); 18214 var import_jsx_runtime80 = __toESM(require_jsx_runtime(), 1); 18215 var STYLE_HASH_ATTRIBUTE12 = "data-wp-hash"; 18216 function getRuntime12() { 18217 const globalScope = globalThis; 18218 if (globalScope.__wpStyleRuntime) { 18219 return globalScope.__wpStyleRuntime; 18220 } 18221 globalScope.__wpStyleRuntime = { 18222 documents: /* @__PURE__ */ new Map(), 18223 styles: /* @__PURE__ */ new Map(), 18224 injectedStyles: /* @__PURE__ */ new WeakMap() 18225 }; 18226 if (typeof document !== "undefined") { 18227 registerDocument12(document); 18228 } 18229 return globalScope.__wpStyleRuntime; 18230 } 18231 function documentContainsStyleHash12(targetDocument, hash) { 18232 if (!targetDocument.head) { 18233 return false; 18234 } 18235 for (const style of targetDocument.head.querySelectorAll( 18236 `style[$STYLE_HASH_ATTRIBUTE12}]` 18237 )) { 18238 if (style.getAttribute(STYLE_HASH_ATTRIBUTE12) === hash) { 18239 return true; 18240 } 18241 } 18242 return false; 18243 } 18244 function injectStyle12(targetDocument, hash, css) { 18245 if (!targetDocument.head) { 18246 return; 18247 } 18248 const runtime = getRuntime12(); 18249 let injectedStyles = runtime.injectedStyles.get(targetDocument); 18250 if (!injectedStyles) { 18251 injectedStyles = /* @__PURE__ */ new Set(); 18252 runtime.injectedStyles.set(targetDocument, injectedStyles); 18253 } 18254 if (injectedStyles.has(hash)) { 18255 return; 18256 } 18257 if (documentContainsStyleHash12(targetDocument, hash)) { 18258 injectedStyles.add(hash); 18259 return; 18260 } 18261 const style = targetDocument.createElement("style"); 18262 style.setAttribute(STYLE_HASH_ATTRIBUTE12, hash); 18263 style.appendChild(targetDocument.createTextNode(css)); 18264 targetDocument.head.appendChild(style); 18265 injectedStyles.add(hash); 18266 } 18267 function registerDocument12(targetDocument) { 18268 const runtime = getRuntime12(); 18269 runtime.documents.set( 18270 targetDocument, 18271 (runtime.documents.get(targetDocument) ?? 0) + 1 18272 ); 18273 for (const [hash, css] of runtime.styles) { 18274 injectStyle12(targetDocument, hash, css); 18275 } 18276 return () => { 18277 const count = runtime.documents.get(targetDocument); 18278 if (count === void 0) { 18279 return; 18280 } 18281 if (count <= 1) { 18282 runtime.documents.delete(targetDocument); 18283 return; 18284 } 18285 runtime.documents.set(targetDocument, count - 1); 18286 }; 18287 } 18288 function registerStyle12(hash, css) { 18289 const runtime = getRuntime12(); 18290 runtime.styles.set(hash, css); 18291 for (const targetDocument of runtime.documents.keys()) { 18292 injectStyle12(targetDocument, hash, css); 18293 } 18294 } 18295 if (typeof process === "undefined" || true) { 18296 registerStyle12("3be1f8dffe", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._380b81b8f79fb10f__dropdown-motion,._7f344b94e270e039__dropdown-motion--fade-only{--wp-ui-dropdown-slide-distance:4px;--wp-ui-dropdown-slide-duration:var(--wpds-motion-duration-md,200ms);--wp-ui-dropdown-slide-easing:var(--wpds-motion-easing-expressive,cubic-bezier(0.25,0,0,1));--wp-ui-dropdown-fade-duration:var(--wpds-motion-duration-sm,100ms);--wp-ui-dropdown-fade-easing:linear;@media not (prefers-reduced-motion){transition-duration:var(--wp-ui-dropdown-slide-duration),var(--wp-ui-dropdown-fade-duration);transition-property:transform,opacity;transition-timing-function:var(--wp-ui-dropdown-slide-easing),var(--wp-ui-dropdown-fade-easing);will-change:transform,opacity}opacity:1;&[data-instant]{transition:none}&[data-ending-style],&[data-starting-style]{opacity:0}}._380b81b8f79fb10f__dropdown-motion{transform:translate(0);&[data-side=bottom][data-ending-style],&[data-side=bottom][data-starting-style]{transform:translateY(calc(var(--wp-ui-dropdown-slide-distance)*-1))}&[data-side=top][data-ending-style],&[data-side=top][data-starting-style]{transform:translateY(var(--wp-ui-dropdown-slide-distance))}&[data-side=left][data-ending-style],&[data-side=left][data-starting-style]{transform:translateX(var(--wp-ui-dropdown-slide-distance))}&[data-side=right][data-ending-style],&[data-side=right][data-starting-style]{transform:translateX(calc(var(--wp-ui-dropdown-slide-distance)*-1))}&[data-side=inline-start][data-ending-style],&[data-side=inline-start][data-starting-style]{transform:translateX(var(--wp-ui-dropdown-slide-distance))}&[data-side=inline-end][data-ending-style],&[data-side=inline-end][data-starting-style]{transform:translateX(calc(var(--wp-ui-dropdown-slide-distance)*-1))}&:dir(rtl)[data-side=inline-start][data-ending-style],&:dir(rtl)[data-side=inline-start][data-starting-style]{transform:translateX(calc(var(--wp-ui-dropdown-slide-distance)*-1))}&:dir(rtl)[data-side=inline-end][data-ending-style],&:dir(rtl)[data-side=inline-end][data-starting-style]{transform:translateX(var(--wp-ui-dropdown-slide-distance))}}}}@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{.d61e2d85c0ee0699__positioner{z-index:var(--wp-ui-menu-z-index,initial)}._34e81249f419a5a5__popup{--wp-ui-menu-popup-padding:var(--wpds-dimension-padding-xs,4px);--wp-ui-menu-min-width:160px;--wp-ui-menu-max-width:var(--wpds-dimension-surface-width-md,400px);--wp-ui-menu-item-padding-inline:var(--wpds-dimension-padding-md,12px);--wp-ui-menu-group-head-padding-inline:var(--wpds-dimension-padding-md,12px);--wp-ui-menu-selection-indicator-track-size:0px;--wp-ui-menu-selection-indicator-size:var(--wpds-dimension-size-sm,24px);--wp-ui-menu-selection-indicator-gap:0px;--_wp-ui-menu-elevation-md:0px 2px 3px 0px #0000000d,0px 4px 5px 0px #0000000a,0px 12px 12px 0px #00000008,0px 16px 16px 0px #00000005;background-color:var(--wpds-color-background-surface-neutral-strong,#fff);border:var(--wpds-border-width-xs,1px) solid var(--wpds-color-stroke-surface-neutral,#dbdbdb);border-radius:var(--wpds-border-radius-md,4px);box-shadow:var(--_wp-ui-menu-elevation-md);max-height:min(var(--available-height),480px,60dvh);max-width:min(var(--available-width),var(--wp-ui-menu-max-width));min-width:min(var(--available-width),var(--wp-ui-menu-min-width));outline:none;overflow-block:auto;overscroll-behavior:none;padding:var(--wp-ui-menu-popup-padding);scroll-padding:var(--wp-ui-menu-popup-padding);&:has(._42313b48c5459be3__item-selection-indicator){--wp-ui-menu-item-padding-inline:var(--wpds-dimension-padding-sm,8px);--wp-ui-menu-selection-indicator-track-size:var(--wpds-dimension-size-2xs,16px);--wp-ui-menu-selection-indicator-gap:var(--wpds-dimension-gap-sm,8px)}}._33f07ab17005471d__list{--_wp-ui-menu-item-label-line-height:var(--wpds-typography-line-height-sm,20px);color:var(--wpds-color-foreground-interactive-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-md,13px);line-height:var(--_wp-ui-menu-item-label-line-height)}._33f07ab17005471d__list,.e05914e1005d7c2e__radio-group,.f11085533c0056b0__group{--wp-ui-menu-group-prefix-gap:0px;display:grid;grid-template-columns:[item-padding-start] var(--wp-ui-menu-item-padding-inline) [selection-start] var(--wp-ui-menu-selection-indicator-track-size) [selection-end] var(--wp-ui-menu-selection-indicator-gap) [prefix-start] max-content [prefix-end] var(--wp-ui-menu-group-prefix-gap) [content-start] minmax(0,1fr) [content-end] var(--wp-ui-menu-item-padding-inline) [item-padding-end];min-width:0}.e05914e1005d7c2e__radio-group,.f11085533c0056b0__group{grid-column:1/-1}._33f07ab17005471d__list:has(>._5c913bce0d8bb0d6__item>._64924ecabf65a5d6__item-prefix),.e05914e1005d7c2e__radio-group:has(>._5c913bce0d8bb0d6__item>._64924ecabf65a5d6__item-prefix),.f11085533c0056b0__group:has(>._5c913bce0d8bb0d6__item>._64924ecabf65a5d6__item-prefix){--wp-ui-menu-group-prefix-gap:var(--wpds-dimension-gap-xs,4px)}._4a0fd085d76fd23c__group-label{align-items:center;color:var(--wpds-color-foreground-content-neutral-weak,#707070);display:flex;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-xs,11px);font-weight:var(--wpds-typography-font-weight-emphasis,600);grid-column:1/-1;line-height:var(--wpds-typography-line-height-xs,16px);min-height:var(--wpds-dimension-size-md,32px);padding-block:var(--wpds-dimension-padding-xs,4px);padding-inline:var(--wp-ui-menu-group-head-padding-inline);text-transform:uppercase}.bfc11368eadf3b39__separator{background-color:var(--wpds-color-stroke-surface-neutral-weak,#f0f0f0);grid-column:1/-1;height:var(--wpds-border-width-xs,1px);margin-block:var(--wpds-dimension-gap-xs,4px);margin-inline:var(--wp-ui-menu-group-head-padding-inline);@media (forced-colors:active){background-color:CanvasText}}._5c913bce0d8bb0d6__item{--wp-ui-menu-item-height:var(--wpds-dimension-size-md,32px);--wp-ui-menu-item-padding-block:var(--wpds-dimension-padding-xs,4px);--_gcd-a-border-radius:var(--wpds-border-radius-sm,2px);align-content:center;align-items:start;border-radius:var(--wpds-border-radius-sm,2px);display:grid;gap:0;grid-column:1/-1;grid-template-columns:[item-padding-start] var(--wp-ui-menu-item-padding-inline) [selection-start] var(--wp-ui-menu-selection-indicator-track-size) [selection-end] var(--wp-ui-menu-selection-indicator-gap) [prefix-start] max-content [prefix-end] var(--wp-ui-menu-group-prefix-gap) [content-start] minmax(0,1fr) [content-end] var(--wp-ui-menu-item-padding-inline) [item-padding-end];justify-content:stretch;min-height:var(--wp-ui-menu-item-height);min-width:0;padding-block:var(--wp-ui-menu-item-padding-block);scroll-margin:var(--wp-ui-menu-popup-padding);text-decoration:none;user-select:none;&:not([data-disabled]){cursor:var(--wpds-cursor-control,pointer)}&[href]{cursor:pointer}@supports (grid-template-columns:subgrid){grid-template-columns:subgrid}&[data-highlighted]:not([aria-disabled=true]){background-color:var(--wpds-color-background-interactive-brand-weak-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 12%,#fff));color:var(--wpds-color-foreground-interactive-neutral,#1e1e1e);outline:none;@media (forced-colors:active){--_gcd-div-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid Highlight;--_gcd-a-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid Highlight}}&[aria-disabled=true]{background-color:var(--wpds-color-background-interactive-brand-weak-disabled,#0000);color:var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d);@media (forced-colors:active){color:GrayText}}}._42313b48c5459be3__item-selection-indicator,._64924ecabf65a5d6__item-prefix,.af879698ede76757__item-content{grid-row:1}._42313b48c5459be3__item-selection-indicator{align-items:center;color:var(--wpds-color-foreground-content-neutral-weak,#707070);display:flex;grid-column:selection-start/selection-end;height:var(--_wp-ui-menu-item-label-line-height);justify-content:center;justify-self:center;pointer-events:none;width:var(--wp-ui-menu-selection-indicator-size);&[data-unchecked]{opacity:0}}._99c5bd141cbf516f__checkbox-selection-icon{translate:0 1px}._59aa9b3b3a651148__radio-selection-icon{fill:currentColor;height:var(--wpds-dimension-size-xs,20px);width:var(--wpds-dimension-size-xs,20px)}._64924ecabf65a5d6__item-prefix{align-items:center;color:var(--wpds-color-foreground-content-neutral-weak,#707070);display:flex;gap:var(--wpds-dimension-gap-xs,4px);grid-column:prefix-start/prefix-end;justify-content:center;min-width:0}.a836378335a4cbf1__prefix-icon{align-self:flex-start;flex-shrink:0;margin-block-start:calc((var(--_wp-ui-menu-item-label-line-height) - var(--_wp-ui-menu-prefix-icon-size))/2)}.af879698ede76757__item-content{align-items:center;align-self:stretch;box-sizing:border-box;display:grid;grid-column:content-start/content-end;grid-template-columns:[label-start] minmax(0,1fr) [label-end suffix-start] auto [suffix-end shortcut-start] auto [shortcut-end trailing-start] auto [trailing-end];min-width:0;pointer-events:none}._943a932d9f81c78c__item-children{display:inline-flex;flex-direction:column;gap:2px;grid-column:label-start/label-end;min-width:0}._5ed41da4abcf8958__item-label{--_gcd-heading-color:currentColor;--_gcd-p-line-height:var(--_wp-ui-menu-item-label-line-height);color:inherit;line-height:var(--_wp-ui-menu-item-label-line-height);min-width:0;overflow-wrap:anywhere}.fa88c9f1a96a4c5a__item-description{--_gcd-heading-color:var(--wpds-color-foreground-content-neutral-weak,#707070);color:var(--wpds-color-foreground-content-neutral-weak,#707070);overflow-wrap:anywhere;padding-block-end:var(--wpds-dimension-padding-xs,4px)}._091406749ed93e6e__item-suffix{align-items:center;display:flex;gap:var(--wpds-dimension-gap-xs,4px);grid-column:suffix-start/suffix-end}._091406749ed93e6e__item-suffix,._23630f40071a29ff__item-shortcut{color:var(--wpds-color-foreground-content-neutral-weak,#707070);margin-inline-start:var(--wpds-dimension-gap-md,12px)}._23630f40071a29ff__item-shortcut{grid-column:shortcut-start/shortcut-end}._06be17a91bf434a0__item-trailing{align-items:center;color:var(--wpds-color-foreground-content-neutral-weak,#707070);display:flex;grid-column:trailing-start/trailing-end;margin-inline-start:var(--wpds-dimension-gap-md,12px)}._943a932d9f81c78c__item-children+:is(._091406749ed93e6e__item-suffix,._23630f40071a29ff__item-shortcut,._06be17a91bf434a0__item-trailing){margin-inline-start:var(--wpds-dimension-gap-xl,24px)}._23630f40071a29ff__item-shortcut+._06be17a91bf434a0__item-trailing{margin-inline-start:var(--wpds-dimension-gap-xs,4px)}.b78aec79bf93eba0__submenu-chevron{margin-inline-end:calc(var(--wpds-dimension-gap-sm, 8px)*-1)}.b78aec79bf93eba0__submenu-chevron:dir(rtl){transform:rotate(180deg)}._60da3b6f9718cf76__external-link-indicator{display:inline-block;font-weight:var(--wpds-typography-font-weight-default,400);line-height:1;margin-inline-start:var(--wpds-dimension-gap-xs,4px);text-decoration:none}._60da3b6f9718cf76__external-link-indicator:after{content:"\\2197"}._60da3b6f9718cf76__external-link-indicator:dir(rtl):after{content:"\\2196"}._5c913bce0d8bb0d6__item[aria-disabled=true] ._06be17a91bf434a0__item-trailing,._5c913bce0d8bb0d6__item[aria-disabled=true] ._091406749ed93e6e__item-suffix,._5c913bce0d8bb0d6__item[aria-disabled=true] ._23630f40071a29ff__item-shortcut,._5c913bce0d8bb0d6__item[aria-disabled=true] ._42313b48c5459be3__item-selection-indicator,._5c913bce0d8bb0d6__item[aria-disabled=true] ._64924ecabf65a5d6__item-prefix,._5c913bce0d8bb0d6__item[aria-disabled=true] .fa88c9f1a96a4c5a__item-description,._5c913bce0d8bb0d6__item[data-highlighted]:not([aria-disabled=true]) ._06be17a91bf434a0__item-trailing,._5c913bce0d8bb0d6__item[data-highlighted]:not([aria-disabled=true]) ._091406749ed93e6e__item-suffix,._5c913bce0d8bb0d6__item[data-highlighted]:not([aria-disabled=true]) ._23630f40071a29ff__item-shortcut,._5c913bce0d8bb0d6__item[data-highlighted]:not([aria-disabled=true]) ._42313b48c5459be3__item-selection-indicator,._5c913bce0d8bb0d6__item[data-highlighted]:not([aria-disabled=true]) ._64924ecabf65a5d6__item-prefix,._5c913bce0d8bb0d6__item[data-highlighted]:not([aria-disabled=true]) .fa88c9f1a96a4c5a__item-description{--_gcd-heading-color:currentColor;color:inherit}}}'); 18297 } 18298 var style_default11 = { "positioner": "d61e2d85c0ee0699__positioner", "popup": "_34e81249f419a5a5__popup", "item-selection-indicator": "_42313b48c5459be3__item-selection-indicator", "is-root": "_087a537b24fee6a1__is-root _380b81b8f79fb10f__dropdown-motion", "is-submenu": "_6d3b567f6289bdc2__is-submenu _7f344b94e270e039__dropdown-motion--fade-only", "list": "_33f07ab17005471d__list", "group": "f11085533c0056b0__group", "radio-group": "e05914e1005d7c2e__radio-group", "item": "_5c913bce0d8bb0d6__item", "item-prefix": "_64924ecabf65a5d6__item-prefix", "group-label": "_4a0fd085d76fd23c__group-label", "separator": "bfc11368eadf3b39__separator", "item-content": "af879698ede76757__item-content", "checkbox-selection-icon": "_99c5bd141cbf516f__checkbox-selection-icon", "radio-selection-icon": "_59aa9b3b3a651148__radio-selection-icon", "prefix-icon": "a836378335a4cbf1__prefix-icon", "item-children": "_943a932d9f81c78c__item-children", "item-label": "_5ed41da4abcf8958__item-label", "item-description": "fa88c9f1a96a4c5a__item-description", "item-suffix": "_091406749ed93e6e__item-suffix", "item-shortcut": "_23630f40071a29ff__item-shortcut", "item-trailing": "_06be17a91bf434a0__item-trailing", "submenu-chevron": "b78aec79bf93eba0__submenu-chevron", "external-link-indicator": "_60da3b6f9718cf76__external-link-indicator" }; 18299 var Group = (0, import_element32.forwardRef)(function MenuGroup3({ className, ...props }, ref) { 18300 return /* @__PURE__ */ (0, import_jsx_runtime80.jsx)( 18301 index_parts_exports.Group, 18302 { 18303 ref, 18304 className: clsx_default(style_default11.group, className), 18305 ...props 18306 } 18307 ); 18308 }); 18309 18310 // packages/ui/build-module/menu/group-label.mjs 18311 var import_element33 = __toESM(require_element(), 1); 18312 var import_jsx_runtime81 = __toESM(require_jsx_runtime(), 1); 18313 var STYLE_HASH_ATTRIBUTE13 = "data-wp-hash"; 18314 function getRuntime13() { 18315 const globalScope = globalThis; 18316 if (globalScope.__wpStyleRuntime) { 18317 return globalScope.__wpStyleRuntime; 18318 } 18319 globalScope.__wpStyleRuntime = { 18320 documents: /* @__PURE__ */ new Map(), 18321 styles: /* @__PURE__ */ new Map(), 18322 injectedStyles: /* @__PURE__ */ new WeakMap() 18323 }; 18324 if (typeof document !== "undefined") { 18325 registerDocument13(document); 18326 } 18327 return globalScope.__wpStyleRuntime; 18328 } 18329 function documentContainsStyleHash13(targetDocument, hash) { 18330 if (!targetDocument.head) { 18331 return false; 18332 } 18333 for (const style of targetDocument.head.querySelectorAll( 18334 `style[$STYLE_HASH_ATTRIBUTE13}]` 18335 )) { 18336 if (style.getAttribute(STYLE_HASH_ATTRIBUTE13) === hash) { 18337 return true; 18338 } 18339 } 18340 return false; 18341 } 18342 function injectStyle13(targetDocument, hash, css) { 18343 if (!targetDocument.head) { 18344 return; 18345 } 18346 const runtime = getRuntime13(); 18347 let injectedStyles = runtime.injectedStyles.get(targetDocument); 18348 if (!injectedStyles) { 18349 injectedStyles = /* @__PURE__ */ new Set(); 18350 runtime.injectedStyles.set(targetDocument, injectedStyles); 18351 } 18352 if (injectedStyles.has(hash)) { 18353 return; 18354 } 18355 if (documentContainsStyleHash13(targetDocument, hash)) { 18356 injectedStyles.add(hash); 18357 return; 18358 } 18359 const style = targetDocument.createElement("style"); 18360 style.setAttribute(STYLE_HASH_ATTRIBUTE13, hash); 18361 style.appendChild(targetDocument.createTextNode(css)); 18362 targetDocument.head.appendChild(style); 18363 injectedStyles.add(hash); 18364 } 18365 function registerDocument13(targetDocument) { 18366 const runtime = getRuntime13(); 18367 runtime.documents.set( 18368 targetDocument, 18369 (runtime.documents.get(targetDocument) ?? 0) + 1 18370 ); 18371 for (const [hash, css] of runtime.styles) { 18372 injectStyle13(targetDocument, hash, css); 18373 } 18374 return () => { 18375 const count = runtime.documents.get(targetDocument); 18376 if (count === void 0) { 18377 return; 18378 } 18379 if (count <= 1) { 18380 runtime.documents.delete(targetDocument); 18381 return; 18382 } 18383 runtime.documents.set(targetDocument, count - 1); 18384 }; 18385 } 18386 function registerStyle13(hash, css) { 18387 const runtime = getRuntime13(); 18388 runtime.styles.set(hash, css); 18389 for (const targetDocument of runtime.documents.keys()) { 18390 injectStyle13(targetDocument, hash, css); 18391 } 18392 } 18393 if (typeof process === "undefined" || true) { 18394 registerStyle13("3be1f8dffe", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._380b81b8f79fb10f__dropdown-motion,._7f344b94e270e039__dropdown-motion--fade-only{--wp-ui-dropdown-slide-distance:4px;--wp-ui-dropdown-slide-duration:var(--wpds-motion-duration-md,200ms);--wp-ui-dropdown-slide-easing:var(--wpds-motion-easing-expressive,cubic-bezier(0.25,0,0,1));--wp-ui-dropdown-fade-duration:var(--wpds-motion-duration-sm,100ms);--wp-ui-dropdown-fade-easing:linear;@media not (prefers-reduced-motion){transition-duration:var(--wp-ui-dropdown-slide-duration),var(--wp-ui-dropdown-fade-duration);transition-property:transform,opacity;transition-timing-function:var(--wp-ui-dropdown-slide-easing),var(--wp-ui-dropdown-fade-easing);will-change:transform,opacity}opacity:1;&[data-instant]{transition:none}&[data-ending-style],&[data-starting-style]{opacity:0}}._380b81b8f79fb10f__dropdown-motion{transform:translate(0);&[data-side=bottom][data-ending-style],&[data-side=bottom][data-starting-style]{transform:translateY(calc(var(--wp-ui-dropdown-slide-distance)*-1))}&[data-side=top][data-ending-style],&[data-side=top][data-starting-style]{transform:translateY(var(--wp-ui-dropdown-slide-distance))}&[data-side=left][data-ending-style],&[data-side=left][data-starting-style]{transform:translateX(var(--wp-ui-dropdown-slide-distance))}&[data-side=right][data-ending-style],&[data-side=right][data-starting-style]{transform:translateX(calc(var(--wp-ui-dropdown-slide-distance)*-1))}&[data-side=inline-start][data-ending-style],&[data-side=inline-start][data-starting-style]{transform:translateX(var(--wp-ui-dropdown-slide-distance))}&[data-side=inline-end][data-ending-style],&[data-side=inline-end][data-starting-style]{transform:translateX(calc(var(--wp-ui-dropdown-slide-distance)*-1))}&:dir(rtl)[data-side=inline-start][data-ending-style],&:dir(rtl)[data-side=inline-start][data-starting-style]{transform:translateX(calc(var(--wp-ui-dropdown-slide-distance)*-1))}&:dir(rtl)[data-side=inline-end][data-ending-style],&:dir(rtl)[data-side=inline-end][data-starting-style]{transform:translateX(var(--wp-ui-dropdown-slide-distance))}}}}@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{.d61e2d85c0ee0699__positioner{z-index:var(--wp-ui-menu-z-index,initial)}._34e81249f419a5a5__popup{--wp-ui-menu-popup-padding:var(--wpds-dimension-padding-xs,4px);--wp-ui-menu-min-width:160px;--wp-ui-menu-max-width:var(--wpds-dimension-surface-width-md,400px);--wp-ui-menu-item-padding-inline:var(--wpds-dimension-padding-md,12px);--wp-ui-menu-group-head-padding-inline:var(--wpds-dimension-padding-md,12px);--wp-ui-menu-selection-indicator-track-size:0px;--wp-ui-menu-selection-indicator-size:var(--wpds-dimension-size-sm,24px);--wp-ui-menu-selection-indicator-gap:0px;--_wp-ui-menu-elevation-md:0px 2px 3px 0px #0000000d,0px 4px 5px 0px #0000000a,0px 12px 12px 0px #00000008,0px 16px 16px 0px #00000005;background-color:var(--wpds-color-background-surface-neutral-strong,#fff);border:var(--wpds-border-width-xs,1px) solid var(--wpds-color-stroke-surface-neutral,#dbdbdb);border-radius:var(--wpds-border-radius-md,4px);box-shadow:var(--_wp-ui-menu-elevation-md);max-height:min(var(--available-height),480px,60dvh);max-width:min(var(--available-width),var(--wp-ui-menu-max-width));min-width:min(var(--available-width),var(--wp-ui-menu-min-width));outline:none;overflow-block:auto;overscroll-behavior:none;padding:var(--wp-ui-menu-popup-padding);scroll-padding:var(--wp-ui-menu-popup-padding);&:has(._42313b48c5459be3__item-selection-indicator){--wp-ui-menu-item-padding-inline:var(--wpds-dimension-padding-sm,8px);--wp-ui-menu-selection-indicator-track-size:var(--wpds-dimension-size-2xs,16px);--wp-ui-menu-selection-indicator-gap:var(--wpds-dimension-gap-sm,8px)}}._33f07ab17005471d__list{--_wp-ui-menu-item-label-line-height:var(--wpds-typography-line-height-sm,20px);color:var(--wpds-color-foreground-interactive-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-md,13px);line-height:var(--_wp-ui-menu-item-label-line-height)}._33f07ab17005471d__list,.e05914e1005d7c2e__radio-group,.f11085533c0056b0__group{--wp-ui-menu-group-prefix-gap:0px;display:grid;grid-template-columns:[item-padding-start] var(--wp-ui-menu-item-padding-inline) [selection-start] var(--wp-ui-menu-selection-indicator-track-size) [selection-end] var(--wp-ui-menu-selection-indicator-gap) [prefix-start] max-content [prefix-end] var(--wp-ui-menu-group-prefix-gap) [content-start] minmax(0,1fr) [content-end] var(--wp-ui-menu-item-padding-inline) [item-padding-end];min-width:0}.e05914e1005d7c2e__radio-group,.f11085533c0056b0__group{grid-column:1/-1}._33f07ab17005471d__list:has(>._5c913bce0d8bb0d6__item>._64924ecabf65a5d6__item-prefix),.e05914e1005d7c2e__radio-group:has(>._5c913bce0d8bb0d6__item>._64924ecabf65a5d6__item-prefix),.f11085533c0056b0__group:has(>._5c913bce0d8bb0d6__item>._64924ecabf65a5d6__item-prefix){--wp-ui-menu-group-prefix-gap:var(--wpds-dimension-gap-xs,4px)}._4a0fd085d76fd23c__group-label{align-items:center;color:var(--wpds-color-foreground-content-neutral-weak,#707070);display:flex;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-xs,11px);font-weight:var(--wpds-typography-font-weight-emphasis,600);grid-column:1/-1;line-height:var(--wpds-typography-line-height-xs,16px);min-height:var(--wpds-dimension-size-md,32px);padding-block:var(--wpds-dimension-padding-xs,4px);padding-inline:var(--wp-ui-menu-group-head-padding-inline);text-transform:uppercase}.bfc11368eadf3b39__separator{background-color:var(--wpds-color-stroke-surface-neutral-weak,#f0f0f0);grid-column:1/-1;height:var(--wpds-border-width-xs,1px);margin-block:var(--wpds-dimension-gap-xs,4px);margin-inline:var(--wp-ui-menu-group-head-padding-inline);@media (forced-colors:active){background-color:CanvasText}}._5c913bce0d8bb0d6__item{--wp-ui-menu-item-height:var(--wpds-dimension-size-md,32px);--wp-ui-menu-item-padding-block:var(--wpds-dimension-padding-xs,4px);--_gcd-a-border-radius:var(--wpds-border-radius-sm,2px);align-content:center;align-items:start;border-radius:var(--wpds-border-radius-sm,2px);display:grid;gap:0;grid-column:1/-1;grid-template-columns:[item-padding-start] var(--wp-ui-menu-item-padding-inline) [selection-start] var(--wp-ui-menu-selection-indicator-track-size) [selection-end] var(--wp-ui-menu-selection-indicator-gap) [prefix-start] max-content [prefix-end] var(--wp-ui-menu-group-prefix-gap) [content-start] minmax(0,1fr) [content-end] var(--wp-ui-menu-item-padding-inline) [item-padding-end];justify-content:stretch;min-height:var(--wp-ui-menu-item-height);min-width:0;padding-block:var(--wp-ui-menu-item-padding-block);scroll-margin:var(--wp-ui-menu-popup-padding);text-decoration:none;user-select:none;&:not([data-disabled]){cursor:var(--wpds-cursor-control,pointer)}&[href]{cursor:pointer}@supports (grid-template-columns:subgrid){grid-template-columns:subgrid}&[data-highlighted]:not([aria-disabled=true]){background-color:var(--wpds-color-background-interactive-brand-weak-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 12%,#fff));color:var(--wpds-color-foreground-interactive-neutral,#1e1e1e);outline:none;@media (forced-colors:active){--_gcd-div-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid Highlight;--_gcd-a-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid Highlight}}&[aria-disabled=true]{background-color:var(--wpds-color-background-interactive-brand-weak-disabled,#0000);color:var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d);@media (forced-colors:active){color:GrayText}}}._42313b48c5459be3__item-selection-indicator,._64924ecabf65a5d6__item-prefix,.af879698ede76757__item-content{grid-row:1}._42313b48c5459be3__item-selection-indicator{align-items:center;color:var(--wpds-color-foreground-content-neutral-weak,#707070);display:flex;grid-column:selection-start/selection-end;height:var(--_wp-ui-menu-item-label-line-height);justify-content:center;justify-self:center;pointer-events:none;width:var(--wp-ui-menu-selection-indicator-size);&[data-unchecked]{opacity:0}}._99c5bd141cbf516f__checkbox-selection-icon{translate:0 1px}._59aa9b3b3a651148__radio-selection-icon{fill:currentColor;height:var(--wpds-dimension-size-xs,20px);width:var(--wpds-dimension-size-xs,20px)}._64924ecabf65a5d6__item-prefix{align-items:center;color:var(--wpds-color-foreground-content-neutral-weak,#707070);display:flex;gap:var(--wpds-dimension-gap-xs,4px);grid-column:prefix-start/prefix-end;justify-content:center;min-width:0}.a836378335a4cbf1__prefix-icon{align-self:flex-start;flex-shrink:0;margin-block-start:calc((var(--_wp-ui-menu-item-label-line-height) - var(--_wp-ui-menu-prefix-icon-size))/2)}.af879698ede76757__item-content{align-items:center;align-self:stretch;box-sizing:border-box;display:grid;grid-column:content-start/content-end;grid-template-columns:[label-start] minmax(0,1fr) [label-end suffix-start] auto [suffix-end shortcut-start] auto [shortcut-end trailing-start] auto [trailing-end];min-width:0;pointer-events:none}._943a932d9f81c78c__item-children{display:inline-flex;flex-direction:column;gap:2px;grid-column:label-start/label-end;min-width:0}._5ed41da4abcf8958__item-label{--_gcd-heading-color:currentColor;--_gcd-p-line-height:var(--_wp-ui-menu-item-label-line-height);color:inherit;line-height:var(--_wp-ui-menu-item-label-line-height);min-width:0;overflow-wrap:anywhere}.fa88c9f1a96a4c5a__item-description{--_gcd-heading-color:var(--wpds-color-foreground-content-neutral-weak,#707070);color:var(--wpds-color-foreground-content-neutral-weak,#707070);overflow-wrap:anywhere;padding-block-end:var(--wpds-dimension-padding-xs,4px)}._091406749ed93e6e__item-suffix{align-items:center;display:flex;gap:var(--wpds-dimension-gap-xs,4px);grid-column:suffix-start/suffix-end}._091406749ed93e6e__item-suffix,._23630f40071a29ff__item-shortcut{color:var(--wpds-color-foreground-content-neutral-weak,#707070);margin-inline-start:var(--wpds-dimension-gap-md,12px)}._23630f40071a29ff__item-shortcut{grid-column:shortcut-start/shortcut-end}._06be17a91bf434a0__item-trailing{align-items:center;color:var(--wpds-color-foreground-content-neutral-weak,#707070);display:flex;grid-column:trailing-start/trailing-end;margin-inline-start:var(--wpds-dimension-gap-md,12px)}._943a932d9f81c78c__item-children+:is(._091406749ed93e6e__item-suffix,._23630f40071a29ff__item-shortcut,._06be17a91bf434a0__item-trailing){margin-inline-start:var(--wpds-dimension-gap-xl,24px)}._23630f40071a29ff__item-shortcut+._06be17a91bf434a0__item-trailing{margin-inline-start:var(--wpds-dimension-gap-xs,4px)}.b78aec79bf93eba0__submenu-chevron{margin-inline-end:calc(var(--wpds-dimension-gap-sm, 8px)*-1)}.b78aec79bf93eba0__submenu-chevron:dir(rtl){transform:rotate(180deg)}._60da3b6f9718cf76__external-link-indicator{display:inline-block;font-weight:var(--wpds-typography-font-weight-default,400);line-height:1;margin-inline-start:var(--wpds-dimension-gap-xs,4px);text-decoration:none}._60da3b6f9718cf76__external-link-indicator:after{content:"\\2197"}._60da3b6f9718cf76__external-link-indicator:dir(rtl):after{content:"\\2196"}._5c913bce0d8bb0d6__item[aria-disabled=true] ._06be17a91bf434a0__item-trailing,._5c913bce0d8bb0d6__item[aria-disabled=true] ._091406749ed93e6e__item-suffix,._5c913bce0d8bb0d6__item[aria-disabled=true] ._23630f40071a29ff__item-shortcut,._5c913bce0d8bb0d6__item[aria-disabled=true] ._42313b48c5459be3__item-selection-indicator,._5c913bce0d8bb0d6__item[aria-disabled=true] ._64924ecabf65a5d6__item-prefix,._5c913bce0d8bb0d6__item[aria-disabled=true] .fa88c9f1a96a4c5a__item-description,._5c913bce0d8bb0d6__item[data-highlighted]:not([aria-disabled=true]) ._06be17a91bf434a0__item-trailing,._5c913bce0d8bb0d6__item[data-highlighted]:not([aria-disabled=true]) ._091406749ed93e6e__item-suffix,._5c913bce0d8bb0d6__item[data-highlighted]:not([aria-disabled=true]) ._23630f40071a29ff__item-shortcut,._5c913bce0d8bb0d6__item[data-highlighted]:not([aria-disabled=true]) ._42313b48c5459be3__item-selection-indicator,._5c913bce0d8bb0d6__item[data-highlighted]:not([aria-disabled=true]) ._64924ecabf65a5d6__item-prefix,._5c913bce0d8bb0d6__item[data-highlighted]:not([aria-disabled=true]) .fa88c9f1a96a4c5a__item-description{--_gcd-heading-color:currentColor;color:inherit}}}'); 18395 } 18396 var style_default12 = { "positioner": "d61e2d85c0ee0699__positioner", "popup": "_34e81249f419a5a5__popup", "item-selection-indicator": "_42313b48c5459be3__item-selection-indicator", "is-root": "_087a537b24fee6a1__is-root _380b81b8f79fb10f__dropdown-motion", "is-submenu": "_6d3b567f6289bdc2__is-submenu _7f344b94e270e039__dropdown-motion--fade-only", "list": "_33f07ab17005471d__list", "group": "f11085533c0056b0__group", "radio-group": "e05914e1005d7c2e__radio-group", "item": "_5c913bce0d8bb0d6__item", "item-prefix": "_64924ecabf65a5d6__item-prefix", "group-label": "_4a0fd085d76fd23c__group-label", "separator": "bfc11368eadf3b39__separator", "item-content": "af879698ede76757__item-content", "checkbox-selection-icon": "_99c5bd141cbf516f__checkbox-selection-icon", "radio-selection-icon": "_59aa9b3b3a651148__radio-selection-icon", "prefix-icon": "a836378335a4cbf1__prefix-icon", "item-children": "_943a932d9f81c78c__item-children", "item-label": "_5ed41da4abcf8958__item-label", "item-description": "fa88c9f1a96a4c5a__item-description", "item-suffix": "_091406749ed93e6e__item-suffix", "item-shortcut": "_23630f40071a29ff__item-shortcut", "item-trailing": "_06be17a91bf434a0__item-trailing", "submenu-chevron": "b78aec79bf93eba0__submenu-chevron", "external-link-indicator": "_60da3b6f9718cf76__external-link-indicator" }; 18397 var GroupLabel = (0, import_element33.forwardRef)( 18398 function MenuGroupLabel3({ className, ...props }, ref) { 18399 return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)( 18400 index_parts_exports.GroupLabel, 18401 { 18402 ref, 18403 className: clsx_default(style_default12["group-label"], className), 18404 ...props 18405 } 18406 ); 18407 } 18408 ); 18409 18410 // packages/ui/build-module/menu/link-item.mjs 18411 var import_element34 = __toESM(require_element(), 1); 18412 var import_i18n10 = __toESM(require_i18n(), 1); 18413 var import_jsx_runtime82 = __toESM(require_jsx_runtime(), 1); 18414 var STYLE_HASH_ATTRIBUTE14 = "data-wp-hash"; 18415 function getRuntime14() { 18416 const globalScope = globalThis; 18417 if (globalScope.__wpStyleRuntime) { 18418 return globalScope.__wpStyleRuntime; 18419 } 18420 globalScope.__wpStyleRuntime = { 18421 documents: /* @__PURE__ */ new Map(), 18422 styles: /* @__PURE__ */ new Map(), 18423 injectedStyles: /* @__PURE__ */ new WeakMap() 18424 }; 18425 if (typeof document !== "undefined") { 18426 registerDocument14(document); 18427 } 18428 return globalScope.__wpStyleRuntime; 18429 } 18430 function documentContainsStyleHash14(targetDocument, hash) { 18431 if (!targetDocument.head) { 18432 return false; 18433 } 18434 for (const style of targetDocument.head.querySelectorAll( 18435 `style[$STYLE_HASH_ATTRIBUTE14}]` 18436 )) { 18437 if (style.getAttribute(STYLE_HASH_ATTRIBUTE14) === hash) { 18438 return true; 18439 } 18440 } 18441 return false; 18442 } 18443 function injectStyle14(targetDocument, hash, css) { 18444 if (!targetDocument.head) { 18445 return; 18446 } 18447 const runtime = getRuntime14(); 18448 let injectedStyles = runtime.injectedStyles.get(targetDocument); 18449 if (!injectedStyles) { 18450 injectedStyles = /* @__PURE__ */ new Set(); 18451 runtime.injectedStyles.set(targetDocument, injectedStyles); 18452 } 18453 if (injectedStyles.has(hash)) { 18454 return; 18455 } 18456 if (documentContainsStyleHash14(targetDocument, hash)) { 18457 injectedStyles.add(hash); 18458 return; 18459 } 18460 const style = targetDocument.createElement("style"); 18461 style.setAttribute(STYLE_HASH_ATTRIBUTE14, hash); 18462 style.appendChild(targetDocument.createTextNode(css)); 18463 targetDocument.head.appendChild(style); 18464 injectedStyles.add(hash); 18465 } 18466 function registerDocument14(targetDocument) { 18467 const runtime = getRuntime14(); 18468 runtime.documents.set( 18469 targetDocument, 18470 (runtime.documents.get(targetDocument) ?? 0) + 1 18471 ); 18472 for (const [hash, css] of runtime.styles) { 18473 injectStyle14(targetDocument, hash, css); 18474 } 18475 return () => { 18476 const count = runtime.documents.get(targetDocument); 18477 if (count === void 0) { 18478 return; 18479 } 18480 if (count <= 1) { 18481 runtime.documents.delete(targetDocument); 18482 return; 18483 } 18484 runtime.documents.set(targetDocument, count - 1); 18485 }; 18486 } 18487 function registerStyle14(hash, css) { 18488 const runtime = getRuntime14(); 18489 runtime.styles.set(hash, css); 18490 for (const targetDocument of runtime.documents.keys()) { 18491 injectStyle14(targetDocument, hash, css); 18492 } 18493 } 18494 if (typeof process === "undefined" || true) { 18495 registerStyle14("e8e31009f5", "._6defc79820e382c6__button{box-sizing:var(--_gcd-button-box-sizing,border-box);font-family:var(--_gcd-button-font-family,inherit);font-size:var(--_gcd-button-font-size,inherit);font-weight:var(--_gcd-button-font-weight,inherit)}.d2cff2e5dea83bd1__input{box-sizing:var(--_gcd-input-box-sizing,border-box);font-family:var(--_gcd-input-font-family,inherit);font-size:var(--_gcd-input-font-size,inherit);font-weight:var(--_gcd-input-font-weight,inherit);margin:var(--_gcd-input-margin,0);&::placeholder{color:var(--_gcd-input-placeholder-color,var(--wpds-color-foreground-interactive-neutral-weak,#707070))}&:is(textarea,[type=text],[type=password],[type=color],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){background-color:var(--_gcd-input-background-color,transparent);border:var(--_gcd-input-border,none);border-radius:var(--_gcd-input-border-radius,0);box-shadow:var(--_gcd-input-box-shadow,0 0 0 transparent);color:var(--_gcd-input-color,var(--wpds-color-foreground-interactive-neutral,#1e1e1e));&:focus{border-color:var(--_gcd-input-border-color-focus,var(--wp-admin-theme-color));box-shadow:var(--_gcd-input-box-shadow-focus,none);outline:var(--_gcd-input-outline-focus,none)}&:disabled{background:var(--_gcd-input-background-disabled,transparent);border-color:var(--_gcd-input-border-color-disabled,transparent);box-shadow:var(--_gcd-input-box-shadow-disabled,none);color:var(--_gcd-input-color-disabled,var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d))}}&:is(textarea,[type=text],[type=password],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){line-height:var(--_gcd-input-line-height,inherit);min-height:var(--_gcd-input-min-height,auto);padding:var(--_gcd-input-padding,0)}}._547d86373d02e108__textarea{box-sizing:var(--_gcd-textarea-box-sizing,border-box);overflow:var(--_gcd-textarea-overflow,auto);resize:var(--_gcd-textarea-resize,block)}._8c15fd0ed9f28ba4__div{outline:var(--_gcd-div-outline,0 solid transparent)}p._43cec3e1eec1066d__p{font-size:var(--_gcd-p-font-size,13px);line-height:var(--_gcd-p-line-height,1.5);margin:var(--_gcd-p-margin,0)}:is(h1,h2,h3,h4,h5,h6).e97669c6d9a38497__heading{color:var(--_gcd-heading-color,var(--wpds-color-foreground-content-neutral,#1e1e1e));font-size:var(--_gcd-heading-font-size,inherit);font-weight:var(--_gcd-heading-font-weight,var(--wpds-typography-font-weight-emphasis,600));margin:var(--_gcd-heading-margin,0)}._2c0831b0499dbd6e__a,._2c0831b0499dbd6e__a:is(:hover,:focus,:active){border-radius:var(--_gcd-a-border-radius,0);box-shadow:var(--_gcd-a-box-shadow,none);color:var(--_gcd-a-color,inherit);outline:var(--_gcd-a-outline,0 solid transparent);transition:var(--_gcd-a-transition,none)}.c59a0ebebd71fa4a__ol{list-style:var(--_gcd-ol-list-style,none);margin:var(--_gcd-ol-margin,0);padding-block:var(--_gcd-ol-padding-block,0);padding-inline:var(--_gcd-ol-padding-inline,0)}._46b5cb0c8e24e8c9__li{margin:var(--_gcd-li-margin,0)}"); 18496 } 18497 var global_css_defense_default5 = { "button": "_6defc79820e382c6__button", "input": "d2cff2e5dea83bd1__input", "textarea": "_547d86373d02e108__textarea", "div": "_8c15fd0ed9f28ba4__div", "p": "_43cec3e1eec1066d__p", "heading": "e97669c6d9a38497__heading", "a": "_2c0831b0499dbd6e__a", "ol": "c59a0ebebd71fa4a__ol", "li": "_46b5cb0c8e24e8c9__li" }; 18498 if (typeof process === "undefined" || true) { 18499 registerStyle14("10f3806643", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._336cd3e4e743482f__box-sizing{box-sizing:border-box;*,:after,:before{box-sizing:inherit}}}}"); 18500 } 18501 var resets_default5 = { "box-sizing": "_336cd3e4e743482f__box-sizing" }; 18502 if (typeof process === "undefined" || true) { 18503 registerStyle14("3be1f8dffe", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._380b81b8f79fb10f__dropdown-motion,._7f344b94e270e039__dropdown-motion--fade-only{--wp-ui-dropdown-slide-distance:4px;--wp-ui-dropdown-slide-duration:var(--wpds-motion-duration-md,200ms);--wp-ui-dropdown-slide-easing:var(--wpds-motion-easing-expressive,cubic-bezier(0.25,0,0,1));--wp-ui-dropdown-fade-duration:var(--wpds-motion-duration-sm,100ms);--wp-ui-dropdown-fade-easing:linear;@media not (prefers-reduced-motion){transition-duration:var(--wp-ui-dropdown-slide-duration),var(--wp-ui-dropdown-fade-duration);transition-property:transform,opacity;transition-timing-function:var(--wp-ui-dropdown-slide-easing),var(--wp-ui-dropdown-fade-easing);will-change:transform,opacity}opacity:1;&[data-instant]{transition:none}&[data-ending-style],&[data-starting-style]{opacity:0}}._380b81b8f79fb10f__dropdown-motion{transform:translate(0);&[data-side=bottom][data-ending-style],&[data-side=bottom][data-starting-style]{transform:translateY(calc(var(--wp-ui-dropdown-slide-distance)*-1))}&[data-side=top][data-ending-style],&[data-side=top][data-starting-style]{transform:translateY(var(--wp-ui-dropdown-slide-distance))}&[data-side=left][data-ending-style],&[data-side=left][data-starting-style]{transform:translateX(var(--wp-ui-dropdown-slide-distance))}&[data-side=right][data-ending-style],&[data-side=right][data-starting-style]{transform:translateX(calc(var(--wp-ui-dropdown-slide-distance)*-1))}&[data-side=inline-start][data-ending-style],&[data-side=inline-start][data-starting-style]{transform:translateX(var(--wp-ui-dropdown-slide-distance))}&[data-side=inline-end][data-ending-style],&[data-side=inline-end][data-starting-style]{transform:translateX(calc(var(--wp-ui-dropdown-slide-distance)*-1))}&:dir(rtl)[data-side=inline-start][data-ending-style],&:dir(rtl)[data-side=inline-start][data-starting-style]{transform:translateX(calc(var(--wp-ui-dropdown-slide-distance)*-1))}&:dir(rtl)[data-side=inline-end][data-ending-style],&:dir(rtl)[data-side=inline-end][data-starting-style]{transform:translateX(var(--wp-ui-dropdown-slide-distance))}}}}@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{.d61e2d85c0ee0699__positioner{z-index:var(--wp-ui-menu-z-index,initial)}._34e81249f419a5a5__popup{--wp-ui-menu-popup-padding:var(--wpds-dimension-padding-xs,4px);--wp-ui-menu-min-width:160px;--wp-ui-menu-max-width:var(--wpds-dimension-surface-width-md,400px);--wp-ui-menu-item-padding-inline:var(--wpds-dimension-padding-md,12px);--wp-ui-menu-group-head-padding-inline:var(--wpds-dimension-padding-md,12px);--wp-ui-menu-selection-indicator-track-size:0px;--wp-ui-menu-selection-indicator-size:var(--wpds-dimension-size-sm,24px);--wp-ui-menu-selection-indicator-gap:0px;--_wp-ui-menu-elevation-md:0px 2px 3px 0px #0000000d,0px 4px 5px 0px #0000000a,0px 12px 12px 0px #00000008,0px 16px 16px 0px #00000005;background-color:var(--wpds-color-background-surface-neutral-strong,#fff);border:var(--wpds-border-width-xs,1px) solid var(--wpds-color-stroke-surface-neutral,#dbdbdb);border-radius:var(--wpds-border-radius-md,4px);box-shadow:var(--_wp-ui-menu-elevation-md);max-height:min(var(--available-height),480px,60dvh);max-width:min(var(--available-width),var(--wp-ui-menu-max-width));min-width:min(var(--available-width),var(--wp-ui-menu-min-width));outline:none;overflow-block:auto;overscroll-behavior:none;padding:var(--wp-ui-menu-popup-padding);scroll-padding:var(--wp-ui-menu-popup-padding);&:has(._42313b48c5459be3__item-selection-indicator){--wp-ui-menu-item-padding-inline:var(--wpds-dimension-padding-sm,8px);--wp-ui-menu-selection-indicator-track-size:var(--wpds-dimension-size-2xs,16px);--wp-ui-menu-selection-indicator-gap:var(--wpds-dimension-gap-sm,8px)}}._33f07ab17005471d__list{--_wp-ui-menu-item-label-line-height:var(--wpds-typography-line-height-sm,20px);color:var(--wpds-color-foreground-interactive-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-md,13px);line-height:var(--_wp-ui-menu-item-label-line-height)}._33f07ab17005471d__list,.e05914e1005d7c2e__radio-group,.f11085533c0056b0__group{--wp-ui-menu-group-prefix-gap:0px;display:grid;grid-template-columns:[item-padding-start] var(--wp-ui-menu-item-padding-inline) [selection-start] var(--wp-ui-menu-selection-indicator-track-size) [selection-end] var(--wp-ui-menu-selection-indicator-gap) [prefix-start] max-content [prefix-end] var(--wp-ui-menu-group-prefix-gap) [content-start] minmax(0,1fr) [content-end] var(--wp-ui-menu-item-padding-inline) [item-padding-end];min-width:0}.e05914e1005d7c2e__radio-group,.f11085533c0056b0__group{grid-column:1/-1}._33f07ab17005471d__list:has(>._5c913bce0d8bb0d6__item>._64924ecabf65a5d6__item-prefix),.e05914e1005d7c2e__radio-group:has(>._5c913bce0d8bb0d6__item>._64924ecabf65a5d6__item-prefix),.f11085533c0056b0__group:has(>._5c913bce0d8bb0d6__item>._64924ecabf65a5d6__item-prefix){--wp-ui-menu-group-prefix-gap:var(--wpds-dimension-gap-xs,4px)}._4a0fd085d76fd23c__group-label{align-items:center;color:var(--wpds-color-foreground-content-neutral-weak,#707070);display:flex;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-xs,11px);font-weight:var(--wpds-typography-font-weight-emphasis,600);grid-column:1/-1;line-height:var(--wpds-typography-line-height-xs,16px);min-height:var(--wpds-dimension-size-md,32px);padding-block:var(--wpds-dimension-padding-xs,4px);padding-inline:var(--wp-ui-menu-group-head-padding-inline);text-transform:uppercase}.bfc11368eadf3b39__separator{background-color:var(--wpds-color-stroke-surface-neutral-weak,#f0f0f0);grid-column:1/-1;height:var(--wpds-border-width-xs,1px);margin-block:var(--wpds-dimension-gap-xs,4px);margin-inline:var(--wp-ui-menu-group-head-padding-inline);@media (forced-colors:active){background-color:CanvasText}}._5c913bce0d8bb0d6__item{--wp-ui-menu-item-height:var(--wpds-dimension-size-md,32px);--wp-ui-menu-item-padding-block:var(--wpds-dimension-padding-xs,4px);--_gcd-a-border-radius:var(--wpds-border-radius-sm,2px);align-content:center;align-items:start;border-radius:var(--wpds-border-radius-sm,2px);display:grid;gap:0;grid-column:1/-1;grid-template-columns:[item-padding-start] var(--wp-ui-menu-item-padding-inline) [selection-start] var(--wp-ui-menu-selection-indicator-track-size) [selection-end] var(--wp-ui-menu-selection-indicator-gap) [prefix-start] max-content [prefix-end] var(--wp-ui-menu-group-prefix-gap) [content-start] minmax(0,1fr) [content-end] var(--wp-ui-menu-item-padding-inline) [item-padding-end];justify-content:stretch;min-height:var(--wp-ui-menu-item-height);min-width:0;padding-block:var(--wp-ui-menu-item-padding-block);scroll-margin:var(--wp-ui-menu-popup-padding);text-decoration:none;user-select:none;&:not([data-disabled]){cursor:var(--wpds-cursor-control,pointer)}&[href]{cursor:pointer}@supports (grid-template-columns:subgrid){grid-template-columns:subgrid}&[data-highlighted]:not([aria-disabled=true]){background-color:var(--wpds-color-background-interactive-brand-weak-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 12%,#fff));color:var(--wpds-color-foreground-interactive-neutral,#1e1e1e);outline:none;@media (forced-colors:active){--_gcd-div-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid Highlight;--_gcd-a-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid Highlight}}&[aria-disabled=true]{background-color:var(--wpds-color-background-interactive-brand-weak-disabled,#0000);color:var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d);@media (forced-colors:active){color:GrayText}}}._42313b48c5459be3__item-selection-indicator,._64924ecabf65a5d6__item-prefix,.af879698ede76757__item-content{grid-row:1}._42313b48c5459be3__item-selection-indicator{align-items:center;color:var(--wpds-color-foreground-content-neutral-weak,#707070);display:flex;grid-column:selection-start/selection-end;height:var(--_wp-ui-menu-item-label-line-height);justify-content:center;justify-self:center;pointer-events:none;width:var(--wp-ui-menu-selection-indicator-size);&[data-unchecked]{opacity:0}}._99c5bd141cbf516f__checkbox-selection-icon{translate:0 1px}._59aa9b3b3a651148__radio-selection-icon{fill:currentColor;height:var(--wpds-dimension-size-xs,20px);width:var(--wpds-dimension-size-xs,20px)}._64924ecabf65a5d6__item-prefix{align-items:center;color:var(--wpds-color-foreground-content-neutral-weak,#707070);display:flex;gap:var(--wpds-dimension-gap-xs,4px);grid-column:prefix-start/prefix-end;justify-content:center;min-width:0}.a836378335a4cbf1__prefix-icon{align-self:flex-start;flex-shrink:0;margin-block-start:calc((var(--_wp-ui-menu-item-label-line-height) - var(--_wp-ui-menu-prefix-icon-size))/2)}.af879698ede76757__item-content{align-items:center;align-self:stretch;box-sizing:border-box;display:grid;grid-column:content-start/content-end;grid-template-columns:[label-start] minmax(0,1fr) [label-end suffix-start] auto [suffix-end shortcut-start] auto [shortcut-end trailing-start] auto [trailing-end];min-width:0;pointer-events:none}._943a932d9f81c78c__item-children{display:inline-flex;flex-direction:column;gap:2px;grid-column:label-start/label-end;min-width:0}._5ed41da4abcf8958__item-label{--_gcd-heading-color:currentColor;--_gcd-p-line-height:var(--_wp-ui-menu-item-label-line-height);color:inherit;line-height:var(--_wp-ui-menu-item-label-line-height);min-width:0;overflow-wrap:anywhere}.fa88c9f1a96a4c5a__item-description{--_gcd-heading-color:var(--wpds-color-foreground-content-neutral-weak,#707070);color:var(--wpds-color-foreground-content-neutral-weak,#707070);overflow-wrap:anywhere;padding-block-end:var(--wpds-dimension-padding-xs,4px)}._091406749ed93e6e__item-suffix{align-items:center;display:flex;gap:var(--wpds-dimension-gap-xs,4px);grid-column:suffix-start/suffix-end}._091406749ed93e6e__item-suffix,._23630f40071a29ff__item-shortcut{color:var(--wpds-color-foreground-content-neutral-weak,#707070);margin-inline-start:var(--wpds-dimension-gap-md,12px)}._23630f40071a29ff__item-shortcut{grid-column:shortcut-start/shortcut-end}._06be17a91bf434a0__item-trailing{align-items:center;color:var(--wpds-color-foreground-content-neutral-weak,#707070);display:flex;grid-column:trailing-start/trailing-end;margin-inline-start:var(--wpds-dimension-gap-md,12px)}._943a932d9f81c78c__item-children+:is(._091406749ed93e6e__item-suffix,._23630f40071a29ff__item-shortcut,._06be17a91bf434a0__item-trailing){margin-inline-start:var(--wpds-dimension-gap-xl,24px)}._23630f40071a29ff__item-shortcut+._06be17a91bf434a0__item-trailing{margin-inline-start:var(--wpds-dimension-gap-xs,4px)}.b78aec79bf93eba0__submenu-chevron{margin-inline-end:calc(var(--wpds-dimension-gap-sm, 8px)*-1)}.b78aec79bf93eba0__submenu-chevron:dir(rtl){transform:rotate(180deg)}._60da3b6f9718cf76__external-link-indicator{display:inline-block;font-weight:var(--wpds-typography-font-weight-default,400);line-height:1;margin-inline-start:var(--wpds-dimension-gap-xs,4px);text-decoration:none}._60da3b6f9718cf76__external-link-indicator:after{content:"\\2197"}._60da3b6f9718cf76__external-link-indicator:dir(rtl):after{content:"\\2196"}._5c913bce0d8bb0d6__item[aria-disabled=true] ._06be17a91bf434a0__item-trailing,._5c913bce0d8bb0d6__item[aria-disabled=true] ._091406749ed93e6e__item-suffix,._5c913bce0d8bb0d6__item[aria-disabled=true] ._23630f40071a29ff__item-shortcut,._5c913bce0d8bb0d6__item[aria-disabled=true] ._42313b48c5459be3__item-selection-indicator,._5c913bce0d8bb0d6__item[aria-disabled=true] ._64924ecabf65a5d6__item-prefix,._5c913bce0d8bb0d6__item[aria-disabled=true] .fa88c9f1a96a4c5a__item-description,._5c913bce0d8bb0d6__item[data-highlighted]:not([aria-disabled=true]) ._06be17a91bf434a0__item-trailing,._5c913bce0d8bb0d6__item[data-highlighted]:not([aria-disabled=true]) ._091406749ed93e6e__item-suffix,._5c913bce0d8bb0d6__item[data-highlighted]:not([aria-disabled=true]) ._23630f40071a29ff__item-shortcut,._5c913bce0d8bb0d6__item[data-highlighted]:not([aria-disabled=true]) ._42313b48c5459be3__item-selection-indicator,._5c913bce0d8bb0d6__item[data-highlighted]:not([aria-disabled=true]) ._64924ecabf65a5d6__item-prefix,._5c913bce0d8bb0d6__item[data-highlighted]:not([aria-disabled=true]) .fa88c9f1a96a4c5a__item-description{--_gcd-heading-color:currentColor;color:inherit}}}'); 18504 } 18505 var style_default13 = { "positioner": "d61e2d85c0ee0699__positioner", "popup": "_34e81249f419a5a5__popup", "item-selection-indicator": "_42313b48c5459be3__item-selection-indicator", "is-root": "_087a537b24fee6a1__is-root _380b81b8f79fb10f__dropdown-motion", "is-submenu": "_6d3b567f6289bdc2__is-submenu _7f344b94e270e039__dropdown-motion--fade-only", "list": "_33f07ab17005471d__list", "group": "f11085533c0056b0__group", "radio-group": "e05914e1005d7c2e__radio-group", "item": "_5c913bce0d8bb0d6__item", "item-prefix": "_64924ecabf65a5d6__item-prefix", "group-label": "_4a0fd085d76fd23c__group-label", "separator": "bfc11368eadf3b39__separator", "item-content": "af879698ede76757__item-content", "checkbox-selection-icon": "_99c5bd141cbf516f__checkbox-selection-icon", "radio-selection-icon": "_59aa9b3b3a651148__radio-selection-icon", "prefix-icon": "a836378335a4cbf1__prefix-icon", "item-children": "_943a932d9f81c78c__item-children", "item-label": "_5ed41da4abcf8958__item-label", "item-description": "fa88c9f1a96a4c5a__item-description", "item-suffix": "_091406749ed93e6e__item-suffix", "item-shortcut": "_23630f40071a29ff__item-shortcut", "item-trailing": "_06be17a91bf434a0__item-trailing", "submenu-chevron": "b78aec79bf93eba0__submenu-chevron", "external-link-indicator": "_60da3b6f9718cf76__external-link-indicator" }; 18506 var LinkItem = (0, import_element34.forwardRef)(function MenuLinkItem3({ 18507 children, 18508 className, 18509 openInNewTab = false, 18510 target, 18511 prefix, 18512 shortcut, 18513 suffix, 18514 "aria-describedby": ariaDescribedBy, 18515 "aria-keyshortcuts": ariaKeyShortcuts, 18516 "aria-label": ariaLabel, 18517 "aria-labelledby": ariaLabelledBy, 18518 rel, 18519 ...props 18520 }, ref) { 18521 const shouldShowNewTabIndicator = openInNewTab || /^_blank$/i.test(target ?? ""); 18522 const externalLinkIndicator = shouldShowNewTabIndicator ? /* @__PURE__ */ (0, import_jsx_runtime82.jsx)( 18523 "span", 18524 { 18525 className: style_default13["external-link-indicator"], 18526 role: "img", 18527 "aria-label": ( 18528 /* translators: accessibility text appended to link text */ 18529 (0, import_i18n10.__)("(opens in a new tab)") 18530 ) 18531 } 18532 ) : null; 18533 const { 18534 contentChildren, 18535 contentContextValue, 18536 itemAriaProps, 18537 shortcutDescriptionId 18538 } = useItemContent2(children, { 18539 "aria-describedby": ariaDescribedBy, 18540 "aria-keyshortcuts": ariaKeyShortcuts, 18541 "aria-label": ariaLabel, 18542 "aria-labelledby": ariaLabelledBy, 18543 labelTrailing: externalLinkIndicator, 18544 shortcut 18545 }); 18546 return /* @__PURE__ */ (0, import_jsx_runtime82.jsx)( 18547 index_parts_exports.LinkItem, 18548 { 18549 ref, 18550 ...props, 18551 ...itemAriaProps, 18552 rel, 18553 target: target ?? (openInNewTab ? "_blank" : void 0), 18554 className: clsx_default( 18555 global_css_defense_default5.a, 18556 resets_default5["box-sizing"], 18557 style_default13.item, 18558 className 18559 ), 18560 children: /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(MenuItemContentContext.Provider, { value: contentContextValue, children: /* @__PURE__ */ (0, import_jsx_runtime82.jsx)( 18561 ItemContent, 18562 { 18563 prefix, 18564 shortcut, 18565 shortcutDescriptionId, 18566 suffix, 18567 children: contentChildren 18568 } 18569 ) }) 18570 } 18571 ); 18572 }); 18573 18574 // packages/ui/build-module/menu/popup.mjs 18575 var import_element37 = __toESM(require_element(), 1); 18576 18577 // packages/ui/build-module/menu/portal.mjs 18578 var import_element35 = __toESM(require_element(), 1); 18579 var import_jsx_runtime83 = __toESM(require_jsx_runtime(), 1); 18580 var Portal2 = (0, import_element35.forwardRef)(function MenuPortal3({ container, ...props }, ref) { 18581 return /* @__PURE__ */ (0, import_jsx_runtime83.jsx)( 18582 index_parts_exports.Portal, 18583 { 18584 ref, 18585 container: container ?? getWpCompatOverlaySlot(), 18586 ...props 18587 } 18588 ); 18589 }); 18590 18591 // packages/ui/build-module/menu/positioner.mjs 18592 var import_element36 = __toESM(require_element(), 1); 18593 18594 // packages/ui/build-module/form/primitives/constants.mjs 18595 var ITEM_POPUP_POSITIONER_PROPS = { 18596 align: "start", 18597 sideOffset: 8, 18598 collisionPadding: 12 18599 }; 18600 18601 // packages/ui/build-module/menu/positioner.mjs 18602 var import_jsx_runtime84 = __toESM(require_jsx_runtime(), 1); 18603 var STYLE_HASH_ATTRIBUTE15 = "data-wp-hash"; 18604 function getRuntime15() { 18605 const globalScope = globalThis; 18606 if (globalScope.__wpStyleRuntime) { 18607 return globalScope.__wpStyleRuntime; 18608 } 18609 globalScope.__wpStyleRuntime = { 18610 documents: /* @__PURE__ */ new Map(), 18611 styles: /* @__PURE__ */ new Map(), 18612 injectedStyles: /* @__PURE__ */ new WeakMap() 18613 }; 18614 if (typeof document !== "undefined") { 18615 registerDocument15(document); 18616 } 18617 return globalScope.__wpStyleRuntime; 18618 } 18619 function documentContainsStyleHash15(targetDocument, hash) { 18620 if (!targetDocument.head) { 18621 return false; 18622 } 18623 for (const style of targetDocument.head.querySelectorAll( 18624 `style[$STYLE_HASH_ATTRIBUTE15}]` 18625 )) { 18626 if (style.getAttribute(STYLE_HASH_ATTRIBUTE15) === hash) { 18627 return true; 18628 } 18629 } 18630 return false; 18631 } 18632 function injectStyle15(targetDocument, hash, css) { 18633 if (!targetDocument.head) { 18634 return; 18635 } 18636 const runtime = getRuntime15(); 18637 let injectedStyles = runtime.injectedStyles.get(targetDocument); 18638 if (!injectedStyles) { 18639 injectedStyles = /* @__PURE__ */ new Set(); 18640 runtime.injectedStyles.set(targetDocument, injectedStyles); 18641 } 18642 if (injectedStyles.has(hash)) { 18643 return; 18644 } 18645 if (documentContainsStyleHash15(targetDocument, hash)) { 18646 injectedStyles.add(hash); 18647 return; 18648 } 18649 const style = targetDocument.createElement("style"); 18650 style.setAttribute(STYLE_HASH_ATTRIBUTE15, hash); 18651 style.appendChild(targetDocument.createTextNode(css)); 18652 targetDocument.head.appendChild(style); 18653 injectedStyles.add(hash); 18654 } 18655 function registerDocument15(targetDocument) { 18656 const runtime = getRuntime15(); 18657 runtime.documents.set( 18658 targetDocument, 18659 (runtime.documents.get(targetDocument) ?? 0) + 1 18660 ); 18661 for (const [hash, css] of runtime.styles) { 18662 injectStyle15(targetDocument, hash, css); 18663 } 18664 return () => { 18665 const count = runtime.documents.get(targetDocument); 18666 if (count === void 0) { 18667 return; 18668 } 18669 if (count <= 1) { 18670 runtime.documents.delete(targetDocument); 18671 return; 18672 } 18673 runtime.documents.set(targetDocument, count - 1); 18674 }; 18675 } 18676 function registerStyle15(hash, css) { 18677 const runtime = getRuntime15(); 18678 runtime.styles.set(hash, css); 18679 for (const targetDocument of runtime.documents.keys()) { 18680 injectStyle15(targetDocument, hash, css); 18681 } 18682 } 18683 if (typeof process === "undefined" || true) { 18684 registerStyle15("10f3806643", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._336cd3e4e743482f__box-sizing{box-sizing:border-box;*,:after,:before{box-sizing:inherit}}}}"); 18685 } 18686 var resets_default6 = { "box-sizing": "_336cd3e4e743482f__box-sizing" }; 18687 if (typeof process === "undefined" || true) { 18688 registerStyle15("3be1f8dffe", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._380b81b8f79fb10f__dropdown-motion,._7f344b94e270e039__dropdown-motion--fade-only{--wp-ui-dropdown-slide-distance:4px;--wp-ui-dropdown-slide-duration:var(--wpds-motion-duration-md,200ms);--wp-ui-dropdown-slide-easing:var(--wpds-motion-easing-expressive,cubic-bezier(0.25,0,0,1));--wp-ui-dropdown-fade-duration:var(--wpds-motion-duration-sm,100ms);--wp-ui-dropdown-fade-easing:linear;@media not (prefers-reduced-motion){transition-duration:var(--wp-ui-dropdown-slide-duration),var(--wp-ui-dropdown-fade-duration);transition-property:transform,opacity;transition-timing-function:var(--wp-ui-dropdown-slide-easing),var(--wp-ui-dropdown-fade-easing);will-change:transform,opacity}opacity:1;&[data-instant]{transition:none}&[data-ending-style],&[data-starting-style]{opacity:0}}._380b81b8f79fb10f__dropdown-motion{transform:translate(0);&[data-side=bottom][data-ending-style],&[data-side=bottom][data-starting-style]{transform:translateY(calc(var(--wp-ui-dropdown-slide-distance)*-1))}&[data-side=top][data-ending-style],&[data-side=top][data-starting-style]{transform:translateY(var(--wp-ui-dropdown-slide-distance))}&[data-side=left][data-ending-style],&[data-side=left][data-starting-style]{transform:translateX(var(--wp-ui-dropdown-slide-distance))}&[data-side=right][data-ending-style],&[data-side=right][data-starting-style]{transform:translateX(calc(var(--wp-ui-dropdown-slide-distance)*-1))}&[data-side=inline-start][data-ending-style],&[data-side=inline-start][data-starting-style]{transform:translateX(var(--wp-ui-dropdown-slide-distance))}&[data-side=inline-end][data-ending-style],&[data-side=inline-end][data-starting-style]{transform:translateX(calc(var(--wp-ui-dropdown-slide-distance)*-1))}&:dir(rtl)[data-side=inline-start][data-ending-style],&:dir(rtl)[data-side=inline-start][data-starting-style]{transform:translateX(calc(var(--wp-ui-dropdown-slide-distance)*-1))}&:dir(rtl)[data-side=inline-end][data-ending-style],&:dir(rtl)[data-side=inline-end][data-starting-style]{transform:translateX(var(--wp-ui-dropdown-slide-distance))}}}}@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{.d61e2d85c0ee0699__positioner{z-index:var(--wp-ui-menu-z-index,initial)}._34e81249f419a5a5__popup{--wp-ui-menu-popup-padding:var(--wpds-dimension-padding-xs,4px);--wp-ui-menu-min-width:160px;--wp-ui-menu-max-width:var(--wpds-dimension-surface-width-md,400px);--wp-ui-menu-item-padding-inline:var(--wpds-dimension-padding-md,12px);--wp-ui-menu-group-head-padding-inline:var(--wpds-dimension-padding-md,12px);--wp-ui-menu-selection-indicator-track-size:0px;--wp-ui-menu-selection-indicator-size:var(--wpds-dimension-size-sm,24px);--wp-ui-menu-selection-indicator-gap:0px;--_wp-ui-menu-elevation-md:0px 2px 3px 0px #0000000d,0px 4px 5px 0px #0000000a,0px 12px 12px 0px #00000008,0px 16px 16px 0px #00000005;background-color:var(--wpds-color-background-surface-neutral-strong,#fff);border:var(--wpds-border-width-xs,1px) solid var(--wpds-color-stroke-surface-neutral,#dbdbdb);border-radius:var(--wpds-border-radius-md,4px);box-shadow:var(--_wp-ui-menu-elevation-md);max-height:min(var(--available-height),480px,60dvh);max-width:min(var(--available-width),var(--wp-ui-menu-max-width));min-width:min(var(--available-width),var(--wp-ui-menu-min-width));outline:none;overflow-block:auto;overscroll-behavior:none;padding:var(--wp-ui-menu-popup-padding);scroll-padding:var(--wp-ui-menu-popup-padding);&:has(._42313b48c5459be3__item-selection-indicator){--wp-ui-menu-item-padding-inline:var(--wpds-dimension-padding-sm,8px);--wp-ui-menu-selection-indicator-track-size:var(--wpds-dimension-size-2xs,16px);--wp-ui-menu-selection-indicator-gap:var(--wpds-dimension-gap-sm,8px)}}._33f07ab17005471d__list{--_wp-ui-menu-item-label-line-height:var(--wpds-typography-line-height-sm,20px);color:var(--wpds-color-foreground-interactive-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-md,13px);line-height:var(--_wp-ui-menu-item-label-line-height)}._33f07ab17005471d__list,.e05914e1005d7c2e__radio-group,.f11085533c0056b0__group{--wp-ui-menu-group-prefix-gap:0px;display:grid;grid-template-columns:[item-padding-start] var(--wp-ui-menu-item-padding-inline) [selection-start] var(--wp-ui-menu-selection-indicator-track-size) [selection-end] var(--wp-ui-menu-selection-indicator-gap) [prefix-start] max-content [prefix-end] var(--wp-ui-menu-group-prefix-gap) [content-start] minmax(0,1fr) [content-end] var(--wp-ui-menu-item-padding-inline) [item-padding-end];min-width:0}.e05914e1005d7c2e__radio-group,.f11085533c0056b0__group{grid-column:1/-1}._33f07ab17005471d__list:has(>._5c913bce0d8bb0d6__item>._64924ecabf65a5d6__item-prefix),.e05914e1005d7c2e__radio-group:has(>._5c913bce0d8bb0d6__item>._64924ecabf65a5d6__item-prefix),.f11085533c0056b0__group:has(>._5c913bce0d8bb0d6__item>._64924ecabf65a5d6__item-prefix){--wp-ui-menu-group-prefix-gap:var(--wpds-dimension-gap-xs,4px)}._4a0fd085d76fd23c__group-label{align-items:center;color:var(--wpds-color-foreground-content-neutral-weak,#707070);display:flex;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-xs,11px);font-weight:var(--wpds-typography-font-weight-emphasis,600);grid-column:1/-1;line-height:var(--wpds-typography-line-height-xs,16px);min-height:var(--wpds-dimension-size-md,32px);padding-block:var(--wpds-dimension-padding-xs,4px);padding-inline:var(--wp-ui-menu-group-head-padding-inline);text-transform:uppercase}.bfc11368eadf3b39__separator{background-color:var(--wpds-color-stroke-surface-neutral-weak,#f0f0f0);grid-column:1/-1;height:var(--wpds-border-width-xs,1px);margin-block:var(--wpds-dimension-gap-xs,4px);margin-inline:var(--wp-ui-menu-group-head-padding-inline);@media (forced-colors:active){background-color:CanvasText}}._5c913bce0d8bb0d6__item{--wp-ui-menu-item-height:var(--wpds-dimension-size-md,32px);--wp-ui-menu-item-padding-block:var(--wpds-dimension-padding-xs,4px);--_gcd-a-border-radius:var(--wpds-border-radius-sm,2px);align-content:center;align-items:start;border-radius:var(--wpds-border-radius-sm,2px);display:grid;gap:0;grid-column:1/-1;grid-template-columns:[item-padding-start] var(--wp-ui-menu-item-padding-inline) [selection-start] var(--wp-ui-menu-selection-indicator-track-size) [selection-end] var(--wp-ui-menu-selection-indicator-gap) [prefix-start] max-content [prefix-end] var(--wp-ui-menu-group-prefix-gap) [content-start] minmax(0,1fr) [content-end] var(--wp-ui-menu-item-padding-inline) [item-padding-end];justify-content:stretch;min-height:var(--wp-ui-menu-item-height);min-width:0;padding-block:var(--wp-ui-menu-item-padding-block);scroll-margin:var(--wp-ui-menu-popup-padding);text-decoration:none;user-select:none;&:not([data-disabled]){cursor:var(--wpds-cursor-control,pointer)}&[href]{cursor:pointer}@supports (grid-template-columns:subgrid){grid-template-columns:subgrid}&[data-highlighted]:not([aria-disabled=true]){background-color:var(--wpds-color-background-interactive-brand-weak-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 12%,#fff));color:var(--wpds-color-foreground-interactive-neutral,#1e1e1e);outline:none;@media (forced-colors:active){--_gcd-div-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid Highlight;--_gcd-a-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid Highlight}}&[aria-disabled=true]{background-color:var(--wpds-color-background-interactive-brand-weak-disabled,#0000);color:var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d);@media (forced-colors:active){color:GrayText}}}._42313b48c5459be3__item-selection-indicator,._64924ecabf65a5d6__item-prefix,.af879698ede76757__item-content{grid-row:1}._42313b48c5459be3__item-selection-indicator{align-items:center;color:var(--wpds-color-foreground-content-neutral-weak,#707070);display:flex;grid-column:selection-start/selection-end;height:var(--_wp-ui-menu-item-label-line-height);justify-content:center;justify-self:center;pointer-events:none;width:var(--wp-ui-menu-selection-indicator-size);&[data-unchecked]{opacity:0}}._99c5bd141cbf516f__checkbox-selection-icon{translate:0 1px}._59aa9b3b3a651148__radio-selection-icon{fill:currentColor;height:var(--wpds-dimension-size-xs,20px);width:var(--wpds-dimension-size-xs,20px)}._64924ecabf65a5d6__item-prefix{align-items:center;color:var(--wpds-color-foreground-content-neutral-weak,#707070);display:flex;gap:var(--wpds-dimension-gap-xs,4px);grid-column:prefix-start/prefix-end;justify-content:center;min-width:0}.a836378335a4cbf1__prefix-icon{align-self:flex-start;flex-shrink:0;margin-block-start:calc((var(--_wp-ui-menu-item-label-line-height) - var(--_wp-ui-menu-prefix-icon-size))/2)}.af879698ede76757__item-content{align-items:center;align-self:stretch;box-sizing:border-box;display:grid;grid-column:content-start/content-end;grid-template-columns:[label-start] minmax(0,1fr) [label-end suffix-start] auto [suffix-end shortcut-start] auto [shortcut-end trailing-start] auto [trailing-end];min-width:0;pointer-events:none}._943a932d9f81c78c__item-children{display:inline-flex;flex-direction:column;gap:2px;grid-column:label-start/label-end;min-width:0}._5ed41da4abcf8958__item-label{--_gcd-heading-color:currentColor;--_gcd-p-line-height:var(--_wp-ui-menu-item-label-line-height);color:inherit;line-height:var(--_wp-ui-menu-item-label-line-height);min-width:0;overflow-wrap:anywhere}.fa88c9f1a96a4c5a__item-description{--_gcd-heading-color:var(--wpds-color-foreground-content-neutral-weak,#707070);color:var(--wpds-color-foreground-content-neutral-weak,#707070);overflow-wrap:anywhere;padding-block-end:var(--wpds-dimension-padding-xs,4px)}._091406749ed93e6e__item-suffix{align-items:center;display:flex;gap:var(--wpds-dimension-gap-xs,4px);grid-column:suffix-start/suffix-end}._091406749ed93e6e__item-suffix,._23630f40071a29ff__item-shortcut{color:var(--wpds-color-foreground-content-neutral-weak,#707070);margin-inline-start:var(--wpds-dimension-gap-md,12px)}._23630f40071a29ff__item-shortcut{grid-column:shortcut-start/shortcut-end}._06be17a91bf434a0__item-trailing{align-items:center;color:var(--wpds-color-foreground-content-neutral-weak,#707070);display:flex;grid-column:trailing-start/trailing-end;margin-inline-start:var(--wpds-dimension-gap-md,12px)}._943a932d9f81c78c__item-children+:is(._091406749ed93e6e__item-suffix,._23630f40071a29ff__item-shortcut,._06be17a91bf434a0__item-trailing){margin-inline-start:var(--wpds-dimension-gap-xl,24px)}._23630f40071a29ff__item-shortcut+._06be17a91bf434a0__item-trailing{margin-inline-start:var(--wpds-dimension-gap-xs,4px)}.b78aec79bf93eba0__submenu-chevron{margin-inline-end:calc(var(--wpds-dimension-gap-sm, 8px)*-1)}.b78aec79bf93eba0__submenu-chevron:dir(rtl){transform:rotate(180deg)}._60da3b6f9718cf76__external-link-indicator{display:inline-block;font-weight:var(--wpds-typography-font-weight-default,400);line-height:1;margin-inline-start:var(--wpds-dimension-gap-xs,4px);text-decoration:none}._60da3b6f9718cf76__external-link-indicator:after{content:"\\2197"}._60da3b6f9718cf76__external-link-indicator:dir(rtl):after{content:"\\2196"}._5c913bce0d8bb0d6__item[aria-disabled=true] ._06be17a91bf434a0__item-trailing,._5c913bce0d8bb0d6__item[aria-disabled=true] ._091406749ed93e6e__item-suffix,._5c913bce0d8bb0d6__item[aria-disabled=true] ._23630f40071a29ff__item-shortcut,._5c913bce0d8bb0d6__item[aria-disabled=true] ._42313b48c5459be3__item-selection-indicator,._5c913bce0d8bb0d6__item[aria-disabled=true] ._64924ecabf65a5d6__item-prefix,._5c913bce0d8bb0d6__item[aria-disabled=true] .fa88c9f1a96a4c5a__item-description,._5c913bce0d8bb0d6__item[data-highlighted]:not([aria-disabled=true]) ._06be17a91bf434a0__item-trailing,._5c913bce0d8bb0d6__item[data-highlighted]:not([aria-disabled=true]) ._091406749ed93e6e__item-suffix,._5c913bce0d8bb0d6__item[data-highlighted]:not([aria-disabled=true]) ._23630f40071a29ff__item-shortcut,._5c913bce0d8bb0d6__item[data-highlighted]:not([aria-disabled=true]) ._42313b48c5459be3__item-selection-indicator,._5c913bce0d8bb0d6__item[data-highlighted]:not([aria-disabled=true]) ._64924ecabf65a5d6__item-prefix,._5c913bce0d8bb0d6__item[data-highlighted]:not([aria-disabled=true]) .fa88c9f1a96a4c5a__item-description{--_gcd-heading-color:currentColor;color:inherit}}}'); 18689 } 18690 var style_default14 = { "positioner": "d61e2d85c0ee0699__positioner", "popup": "_34e81249f419a5a5__popup", "item-selection-indicator": "_42313b48c5459be3__item-selection-indicator", "is-root": "_087a537b24fee6a1__is-root _380b81b8f79fb10f__dropdown-motion", "is-submenu": "_6d3b567f6289bdc2__is-submenu _7f344b94e270e039__dropdown-motion--fade-only", "list": "_33f07ab17005471d__list", "group": "f11085533c0056b0__group", "radio-group": "e05914e1005d7c2e__radio-group", "item": "_5c913bce0d8bb0d6__item", "item-prefix": "_64924ecabf65a5d6__item-prefix", "group-label": "_4a0fd085d76fd23c__group-label", "separator": "bfc11368eadf3b39__separator", "item-content": "af879698ede76757__item-content", "checkbox-selection-icon": "_99c5bd141cbf516f__checkbox-selection-icon", "radio-selection-icon": "_59aa9b3b3a651148__radio-selection-icon", "prefix-icon": "a836378335a4cbf1__prefix-icon", "item-children": "_943a932d9f81c78c__item-children", "item-label": "_5ed41da4abcf8958__item-label", "item-description": "fa88c9f1a96a4c5a__item-description", "item-suffix": "_091406749ed93e6e__item-suffix", "item-shortcut": "_23630f40071a29ff__item-shortcut", "item-trailing": "_06be17a91bf434a0__item-trailing", "submenu-chevron": "b78aec79bf93eba0__submenu-chevron", "external-link-indicator": "_60da3b6f9718cf76__external-link-indicator" }; 18691 var MENU_SUBMENU_POPUP_POSITIONER_PROPS = { 18692 side: "inline-end", 18693 align: "start", 18694 sideOffset: -4, 18695 collisionPadding: 12 18696 }; 18697 var Positioner2 = (0, import_element36.forwardRef)( 18698 function MenuPositioner3({ className, ...props }, ref) { 18699 const { isSubmenu } = useMenuContext(); 18700 const defaultProps = isSubmenu ? MENU_SUBMENU_POPUP_POSITIONER_PROPS : ITEM_POPUP_POSITIONER_PROPS; 18701 return /* @__PURE__ */ (0, import_jsx_runtime84.jsx)( 18702 index_parts_exports.Positioner, 18703 { 18704 ...defaultProps, 18705 ...props, 18706 ref, 18707 className: clsx_default( 18708 resets_default6["box-sizing"], 18709 style_default14.positioner, 18710 className 18711 ) 18712 } 18713 ); 18714 } 18715 ); 18716 18717 // packages/ui/build-module/menu/popup.mjs 18718 var import_jsx_runtime85 = __toESM(require_jsx_runtime(), 1); 18719 var STYLE_HASH_ATTRIBUTE16 = "data-wp-hash"; 18720 function getRuntime16() { 18721 const globalScope = globalThis; 18722 if (globalScope.__wpStyleRuntime) { 18723 return globalScope.__wpStyleRuntime; 18724 } 18725 globalScope.__wpStyleRuntime = { 18726 documents: /* @__PURE__ */ new Map(), 18727 styles: /* @__PURE__ */ new Map(), 18728 injectedStyles: /* @__PURE__ */ new WeakMap() 18729 }; 18730 if (typeof document !== "undefined") { 18731 registerDocument16(document); 18732 } 18733 return globalScope.__wpStyleRuntime; 18734 } 18735 function documentContainsStyleHash16(targetDocument, hash) { 18736 if (!targetDocument.head) { 18737 return false; 18738 } 18739 for (const style of targetDocument.head.querySelectorAll( 18740 `style[$STYLE_HASH_ATTRIBUTE16}]` 18741 )) { 18742 if (style.getAttribute(STYLE_HASH_ATTRIBUTE16) === hash) { 18743 return true; 18744 } 18745 } 18746 return false; 18747 } 18748 function injectStyle16(targetDocument, hash, css) { 18749 if (!targetDocument.head) { 18750 return; 18751 } 18752 const runtime = getRuntime16(); 18753 let injectedStyles = runtime.injectedStyles.get(targetDocument); 18754 if (!injectedStyles) { 18755 injectedStyles = /* @__PURE__ */ new Set(); 18756 runtime.injectedStyles.set(targetDocument, injectedStyles); 18757 } 18758 if (injectedStyles.has(hash)) { 18759 return; 18760 } 18761 if (documentContainsStyleHash16(targetDocument, hash)) { 18762 injectedStyles.add(hash); 18763 return; 18764 } 18765 const style = targetDocument.createElement("style"); 18766 style.setAttribute(STYLE_HASH_ATTRIBUTE16, hash); 18767 style.appendChild(targetDocument.createTextNode(css)); 18768 targetDocument.head.appendChild(style); 18769 injectedStyles.add(hash); 18770 } 18771 function registerDocument16(targetDocument) { 18772 const runtime = getRuntime16(); 18773 runtime.documents.set( 18774 targetDocument, 18775 (runtime.documents.get(targetDocument) ?? 0) + 1 18776 ); 18777 for (const [hash, css] of runtime.styles) { 18778 injectStyle16(targetDocument, hash, css); 18779 } 18780 return () => { 18781 const count = runtime.documents.get(targetDocument); 18782 if (count === void 0) { 18783 return; 18784 } 18785 if (count <= 1) { 18786 runtime.documents.delete(targetDocument); 18787 return; 18788 } 18789 runtime.documents.set(targetDocument, count - 1); 18790 }; 18791 } 18792 function registerStyle16(hash, css) { 18793 const runtime = getRuntime16(); 18794 runtime.styles.set(hash, css); 18795 for (const targetDocument of runtime.documents.keys()) { 18796 injectStyle16(targetDocument, hash, css); 18797 } 18798 } 18799 if (typeof process === "undefined" || true) { 18800 registerStyle16("3be1f8dffe", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._380b81b8f79fb10f__dropdown-motion,._7f344b94e270e039__dropdown-motion--fade-only{--wp-ui-dropdown-slide-distance:4px;--wp-ui-dropdown-slide-duration:var(--wpds-motion-duration-md,200ms);--wp-ui-dropdown-slide-easing:var(--wpds-motion-easing-expressive,cubic-bezier(0.25,0,0,1));--wp-ui-dropdown-fade-duration:var(--wpds-motion-duration-sm,100ms);--wp-ui-dropdown-fade-easing:linear;@media not (prefers-reduced-motion){transition-duration:var(--wp-ui-dropdown-slide-duration),var(--wp-ui-dropdown-fade-duration);transition-property:transform,opacity;transition-timing-function:var(--wp-ui-dropdown-slide-easing),var(--wp-ui-dropdown-fade-easing);will-change:transform,opacity}opacity:1;&[data-instant]{transition:none}&[data-ending-style],&[data-starting-style]{opacity:0}}._380b81b8f79fb10f__dropdown-motion{transform:translate(0);&[data-side=bottom][data-ending-style],&[data-side=bottom][data-starting-style]{transform:translateY(calc(var(--wp-ui-dropdown-slide-distance)*-1))}&[data-side=top][data-ending-style],&[data-side=top][data-starting-style]{transform:translateY(var(--wp-ui-dropdown-slide-distance))}&[data-side=left][data-ending-style],&[data-side=left][data-starting-style]{transform:translateX(var(--wp-ui-dropdown-slide-distance))}&[data-side=right][data-ending-style],&[data-side=right][data-starting-style]{transform:translateX(calc(var(--wp-ui-dropdown-slide-distance)*-1))}&[data-side=inline-start][data-ending-style],&[data-side=inline-start][data-starting-style]{transform:translateX(var(--wp-ui-dropdown-slide-distance))}&[data-side=inline-end][data-ending-style],&[data-side=inline-end][data-starting-style]{transform:translateX(calc(var(--wp-ui-dropdown-slide-distance)*-1))}&:dir(rtl)[data-side=inline-start][data-ending-style],&:dir(rtl)[data-side=inline-start][data-starting-style]{transform:translateX(calc(var(--wp-ui-dropdown-slide-distance)*-1))}&:dir(rtl)[data-side=inline-end][data-ending-style],&:dir(rtl)[data-side=inline-end][data-starting-style]{transform:translateX(var(--wp-ui-dropdown-slide-distance))}}}}@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{.d61e2d85c0ee0699__positioner{z-index:var(--wp-ui-menu-z-index,initial)}._34e81249f419a5a5__popup{--wp-ui-menu-popup-padding:var(--wpds-dimension-padding-xs,4px);--wp-ui-menu-min-width:160px;--wp-ui-menu-max-width:var(--wpds-dimension-surface-width-md,400px);--wp-ui-menu-item-padding-inline:var(--wpds-dimension-padding-md,12px);--wp-ui-menu-group-head-padding-inline:var(--wpds-dimension-padding-md,12px);--wp-ui-menu-selection-indicator-track-size:0px;--wp-ui-menu-selection-indicator-size:var(--wpds-dimension-size-sm,24px);--wp-ui-menu-selection-indicator-gap:0px;--_wp-ui-menu-elevation-md:0px 2px 3px 0px #0000000d,0px 4px 5px 0px #0000000a,0px 12px 12px 0px #00000008,0px 16px 16px 0px #00000005;background-color:var(--wpds-color-background-surface-neutral-strong,#fff);border:var(--wpds-border-width-xs,1px) solid var(--wpds-color-stroke-surface-neutral,#dbdbdb);border-radius:var(--wpds-border-radius-md,4px);box-shadow:var(--_wp-ui-menu-elevation-md);max-height:min(var(--available-height),480px,60dvh);max-width:min(var(--available-width),var(--wp-ui-menu-max-width));min-width:min(var(--available-width),var(--wp-ui-menu-min-width));outline:none;overflow-block:auto;overscroll-behavior:none;padding:var(--wp-ui-menu-popup-padding);scroll-padding:var(--wp-ui-menu-popup-padding);&:has(._42313b48c5459be3__item-selection-indicator){--wp-ui-menu-item-padding-inline:var(--wpds-dimension-padding-sm,8px);--wp-ui-menu-selection-indicator-track-size:var(--wpds-dimension-size-2xs,16px);--wp-ui-menu-selection-indicator-gap:var(--wpds-dimension-gap-sm,8px)}}._33f07ab17005471d__list{--_wp-ui-menu-item-label-line-height:var(--wpds-typography-line-height-sm,20px);color:var(--wpds-color-foreground-interactive-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-md,13px);line-height:var(--_wp-ui-menu-item-label-line-height)}._33f07ab17005471d__list,.e05914e1005d7c2e__radio-group,.f11085533c0056b0__group{--wp-ui-menu-group-prefix-gap:0px;display:grid;grid-template-columns:[item-padding-start] var(--wp-ui-menu-item-padding-inline) [selection-start] var(--wp-ui-menu-selection-indicator-track-size) [selection-end] var(--wp-ui-menu-selection-indicator-gap) [prefix-start] max-content [prefix-end] var(--wp-ui-menu-group-prefix-gap) [content-start] minmax(0,1fr) [content-end] var(--wp-ui-menu-item-padding-inline) [item-padding-end];min-width:0}.e05914e1005d7c2e__radio-group,.f11085533c0056b0__group{grid-column:1/-1}._33f07ab17005471d__list:has(>._5c913bce0d8bb0d6__item>._64924ecabf65a5d6__item-prefix),.e05914e1005d7c2e__radio-group:has(>._5c913bce0d8bb0d6__item>._64924ecabf65a5d6__item-prefix),.f11085533c0056b0__group:has(>._5c913bce0d8bb0d6__item>._64924ecabf65a5d6__item-prefix){--wp-ui-menu-group-prefix-gap:var(--wpds-dimension-gap-xs,4px)}._4a0fd085d76fd23c__group-label{align-items:center;color:var(--wpds-color-foreground-content-neutral-weak,#707070);display:flex;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-xs,11px);font-weight:var(--wpds-typography-font-weight-emphasis,600);grid-column:1/-1;line-height:var(--wpds-typography-line-height-xs,16px);min-height:var(--wpds-dimension-size-md,32px);padding-block:var(--wpds-dimension-padding-xs,4px);padding-inline:var(--wp-ui-menu-group-head-padding-inline);text-transform:uppercase}.bfc11368eadf3b39__separator{background-color:var(--wpds-color-stroke-surface-neutral-weak,#f0f0f0);grid-column:1/-1;height:var(--wpds-border-width-xs,1px);margin-block:var(--wpds-dimension-gap-xs,4px);margin-inline:var(--wp-ui-menu-group-head-padding-inline);@media (forced-colors:active){background-color:CanvasText}}._5c913bce0d8bb0d6__item{--wp-ui-menu-item-height:var(--wpds-dimension-size-md,32px);--wp-ui-menu-item-padding-block:var(--wpds-dimension-padding-xs,4px);--_gcd-a-border-radius:var(--wpds-border-radius-sm,2px);align-content:center;align-items:start;border-radius:var(--wpds-border-radius-sm,2px);display:grid;gap:0;grid-column:1/-1;grid-template-columns:[item-padding-start] var(--wp-ui-menu-item-padding-inline) [selection-start] var(--wp-ui-menu-selection-indicator-track-size) [selection-end] var(--wp-ui-menu-selection-indicator-gap) [prefix-start] max-content [prefix-end] var(--wp-ui-menu-group-prefix-gap) [content-start] minmax(0,1fr) [content-end] var(--wp-ui-menu-item-padding-inline) [item-padding-end];justify-content:stretch;min-height:var(--wp-ui-menu-item-height);min-width:0;padding-block:var(--wp-ui-menu-item-padding-block);scroll-margin:var(--wp-ui-menu-popup-padding);text-decoration:none;user-select:none;&:not([data-disabled]){cursor:var(--wpds-cursor-control,pointer)}&[href]{cursor:pointer}@supports (grid-template-columns:subgrid){grid-template-columns:subgrid}&[data-highlighted]:not([aria-disabled=true]){background-color:var(--wpds-color-background-interactive-brand-weak-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 12%,#fff));color:var(--wpds-color-foreground-interactive-neutral,#1e1e1e);outline:none;@media (forced-colors:active){--_gcd-div-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid Highlight;--_gcd-a-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid Highlight}}&[aria-disabled=true]{background-color:var(--wpds-color-background-interactive-brand-weak-disabled,#0000);color:var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d);@media (forced-colors:active){color:GrayText}}}._42313b48c5459be3__item-selection-indicator,._64924ecabf65a5d6__item-prefix,.af879698ede76757__item-content{grid-row:1}._42313b48c5459be3__item-selection-indicator{align-items:center;color:var(--wpds-color-foreground-content-neutral-weak,#707070);display:flex;grid-column:selection-start/selection-end;height:var(--_wp-ui-menu-item-label-line-height);justify-content:center;justify-self:center;pointer-events:none;width:var(--wp-ui-menu-selection-indicator-size);&[data-unchecked]{opacity:0}}._99c5bd141cbf516f__checkbox-selection-icon{translate:0 1px}._59aa9b3b3a651148__radio-selection-icon{fill:currentColor;height:var(--wpds-dimension-size-xs,20px);width:var(--wpds-dimension-size-xs,20px)}._64924ecabf65a5d6__item-prefix{align-items:center;color:var(--wpds-color-foreground-content-neutral-weak,#707070);display:flex;gap:var(--wpds-dimension-gap-xs,4px);grid-column:prefix-start/prefix-end;justify-content:center;min-width:0}.a836378335a4cbf1__prefix-icon{align-self:flex-start;flex-shrink:0;margin-block-start:calc((var(--_wp-ui-menu-item-label-line-height) - var(--_wp-ui-menu-prefix-icon-size))/2)}.af879698ede76757__item-content{align-items:center;align-self:stretch;box-sizing:border-box;display:grid;grid-column:content-start/content-end;grid-template-columns:[label-start] minmax(0,1fr) [label-end suffix-start] auto [suffix-end shortcut-start] auto [shortcut-end trailing-start] auto [trailing-end];min-width:0;pointer-events:none}._943a932d9f81c78c__item-children{display:inline-flex;flex-direction:column;gap:2px;grid-column:label-start/label-end;min-width:0}._5ed41da4abcf8958__item-label{--_gcd-heading-color:currentColor;--_gcd-p-line-height:var(--_wp-ui-menu-item-label-line-height);color:inherit;line-height:var(--_wp-ui-menu-item-label-line-height);min-width:0;overflow-wrap:anywhere}.fa88c9f1a96a4c5a__item-description{--_gcd-heading-color:var(--wpds-color-foreground-content-neutral-weak,#707070);color:var(--wpds-color-foreground-content-neutral-weak,#707070);overflow-wrap:anywhere;padding-block-end:var(--wpds-dimension-padding-xs,4px)}._091406749ed93e6e__item-suffix{align-items:center;display:flex;gap:var(--wpds-dimension-gap-xs,4px);grid-column:suffix-start/suffix-end}._091406749ed93e6e__item-suffix,._23630f40071a29ff__item-shortcut{color:var(--wpds-color-foreground-content-neutral-weak,#707070);margin-inline-start:var(--wpds-dimension-gap-md,12px)}._23630f40071a29ff__item-shortcut{grid-column:shortcut-start/shortcut-end}._06be17a91bf434a0__item-trailing{align-items:center;color:var(--wpds-color-foreground-content-neutral-weak,#707070);display:flex;grid-column:trailing-start/trailing-end;margin-inline-start:var(--wpds-dimension-gap-md,12px)}._943a932d9f81c78c__item-children+:is(._091406749ed93e6e__item-suffix,._23630f40071a29ff__item-shortcut,._06be17a91bf434a0__item-trailing){margin-inline-start:var(--wpds-dimension-gap-xl,24px)}._23630f40071a29ff__item-shortcut+._06be17a91bf434a0__item-trailing{margin-inline-start:var(--wpds-dimension-gap-xs,4px)}.b78aec79bf93eba0__submenu-chevron{margin-inline-end:calc(var(--wpds-dimension-gap-sm, 8px)*-1)}.b78aec79bf93eba0__submenu-chevron:dir(rtl){transform:rotate(180deg)}._60da3b6f9718cf76__external-link-indicator{display:inline-block;font-weight:var(--wpds-typography-font-weight-default,400);line-height:1;margin-inline-start:var(--wpds-dimension-gap-xs,4px);text-decoration:none}._60da3b6f9718cf76__external-link-indicator:after{content:"\\2197"}._60da3b6f9718cf76__external-link-indicator:dir(rtl):after{content:"\\2196"}._5c913bce0d8bb0d6__item[aria-disabled=true] ._06be17a91bf434a0__item-trailing,._5c913bce0d8bb0d6__item[aria-disabled=true] ._091406749ed93e6e__item-suffix,._5c913bce0d8bb0d6__item[aria-disabled=true] ._23630f40071a29ff__item-shortcut,._5c913bce0d8bb0d6__item[aria-disabled=true] ._42313b48c5459be3__item-selection-indicator,._5c913bce0d8bb0d6__item[aria-disabled=true] ._64924ecabf65a5d6__item-prefix,._5c913bce0d8bb0d6__item[aria-disabled=true] .fa88c9f1a96a4c5a__item-description,._5c913bce0d8bb0d6__item[data-highlighted]:not([aria-disabled=true]) ._06be17a91bf434a0__item-trailing,._5c913bce0d8bb0d6__item[data-highlighted]:not([aria-disabled=true]) ._091406749ed93e6e__item-suffix,._5c913bce0d8bb0d6__item[data-highlighted]:not([aria-disabled=true]) ._23630f40071a29ff__item-shortcut,._5c913bce0d8bb0d6__item[data-highlighted]:not([aria-disabled=true]) ._42313b48c5459be3__item-selection-indicator,._5c913bce0d8bb0d6__item[data-highlighted]:not([aria-disabled=true]) ._64924ecabf65a5d6__item-prefix,._5c913bce0d8bb0d6__item[data-highlighted]:not([aria-disabled=true]) .fa88c9f1a96a4c5a__item-description{--_gcd-heading-color:currentColor;color:inherit}}}'); 18801 } 18802 var style_default15 = { "positioner": "d61e2d85c0ee0699__positioner", "popup": "_34e81249f419a5a5__popup", "item-selection-indicator": "_42313b48c5459be3__item-selection-indicator", "is-root": "_087a537b24fee6a1__is-root _380b81b8f79fb10f__dropdown-motion", "is-submenu": "_6d3b567f6289bdc2__is-submenu _7f344b94e270e039__dropdown-motion--fade-only", "list": "_33f07ab17005471d__list", "group": "f11085533c0056b0__group", "radio-group": "e05914e1005d7c2e__radio-group", "item": "_5c913bce0d8bb0d6__item", "item-prefix": "_64924ecabf65a5d6__item-prefix", "group-label": "_4a0fd085d76fd23c__group-label", "separator": "bfc11368eadf3b39__separator", "item-content": "af879698ede76757__item-content", "checkbox-selection-icon": "_99c5bd141cbf516f__checkbox-selection-icon", "radio-selection-icon": "_59aa9b3b3a651148__radio-selection-icon", "prefix-icon": "a836378335a4cbf1__prefix-icon", "item-children": "_943a932d9f81c78c__item-children", "item-label": "_5ed41da4abcf8958__item-label", "item-description": "fa88c9f1a96a4c5a__item-description", "item-suffix": "_091406749ed93e6e__item-suffix", "item-shortcut": "_23630f40071a29ff__item-shortcut", "item-trailing": "_06be17a91bf434a0__item-trailing", "submenu-chevron": "b78aec79bf93eba0__submenu-chevron", "external-link-indicator": "_60da3b6f9718cf76__external-link-indicator" }; 18803 var Popup2 = (0, import_element37.forwardRef)(function MenuPopup3({ children, className, portal, positioner, ...props }, ref) { 18804 const { isSubmenu } = useMenuContext(); 18805 const popupContent = /* @__PURE__ */ (0, import_jsx_runtime85.jsx)( 18806 index_parts_exports.Popup, 18807 { 18808 ref, 18809 className: clsx_default( 18810 style_default15.popup, 18811 isSubmenu ? style_default15["is-submenu"] : style_default15["is-root"], 18812 className 18813 ), 18814 ...props, 18815 children: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)( 18816 "div", 18817 { 18818 className: style_default15.list, 18819 children 18820 } 18821 ) 18822 } 18823 ); 18824 const positionedPopup = renderSlotWithChildren( 18825 positioner, 18826 /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(Positioner2, {}), 18827 popupContent 18828 ); 18829 return renderSlotWithChildren(portal, /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(Portal2, {}), positionedPopup); 18830 }); 18831 18832 // packages/ui/build-module/menu/prefix-icon.mjs 18833 var import_element38 = __toESM(require_element(), 1); 18834 var import_jsx_runtime86 = __toESM(require_jsx_runtime(), 1); 18835 var STYLE_HASH_ATTRIBUTE17 = "data-wp-hash"; 18836 function getRuntime17() { 18837 const globalScope = globalThis; 18838 if (globalScope.__wpStyleRuntime) { 18839 return globalScope.__wpStyleRuntime; 18840 } 18841 globalScope.__wpStyleRuntime = { 18842 documents: /* @__PURE__ */ new Map(), 18843 styles: /* @__PURE__ */ new Map(), 18844 injectedStyles: /* @__PURE__ */ new WeakMap() 18845 }; 18846 if (typeof document !== "undefined") { 18847 registerDocument17(document); 18848 } 18849 return globalScope.__wpStyleRuntime; 18850 } 18851 function documentContainsStyleHash17(targetDocument, hash) { 18852 if (!targetDocument.head) { 18853 return false; 18854 } 18855 for (const style of targetDocument.head.querySelectorAll( 18856 `style[$STYLE_HASH_ATTRIBUTE17}]` 18857 )) { 18858 if (style.getAttribute(STYLE_HASH_ATTRIBUTE17) === hash) { 18859 return true; 18860 } 18861 } 18862 return false; 18863 } 18864 function injectStyle17(targetDocument, hash, css) { 18865 if (!targetDocument.head) { 18866 return; 18867 } 18868 const runtime = getRuntime17(); 18869 let injectedStyles = runtime.injectedStyles.get(targetDocument); 18870 if (!injectedStyles) { 18871 injectedStyles = /* @__PURE__ */ new Set(); 18872 runtime.injectedStyles.set(targetDocument, injectedStyles); 18873 } 18874 if (injectedStyles.has(hash)) { 18875 return; 18876 } 18877 if (documentContainsStyleHash17(targetDocument, hash)) { 18878 injectedStyles.add(hash); 18879 return; 18880 } 18881 const style = targetDocument.createElement("style"); 18882 style.setAttribute(STYLE_HASH_ATTRIBUTE17, hash); 18883 style.appendChild(targetDocument.createTextNode(css)); 18884 targetDocument.head.appendChild(style); 18885 injectedStyles.add(hash); 18886 } 18887 function registerDocument17(targetDocument) { 18888 const runtime = getRuntime17(); 18889 runtime.documents.set( 18890 targetDocument, 18891 (runtime.documents.get(targetDocument) ?? 0) + 1 18892 ); 18893 for (const [hash, css] of runtime.styles) { 18894 injectStyle17(targetDocument, hash, css); 18895 } 18896 return () => { 18897 const count = runtime.documents.get(targetDocument); 18898 if (count === void 0) { 18899 return; 18900 } 18901 if (count <= 1) { 18902 runtime.documents.delete(targetDocument); 18903 return; 18904 } 18905 runtime.documents.set(targetDocument, count - 1); 18906 }; 18907 } 18908 function registerStyle17(hash, css) { 18909 const runtime = getRuntime17(); 18910 runtime.styles.set(hash, css); 18911 for (const targetDocument of runtime.documents.keys()) { 18912 injectStyle17(targetDocument, hash, css); 18913 } 18914 } 18915 if (typeof process === "undefined" || true) { 18916 registerStyle17("3be1f8dffe", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._380b81b8f79fb10f__dropdown-motion,._7f344b94e270e039__dropdown-motion--fade-only{--wp-ui-dropdown-slide-distance:4px;--wp-ui-dropdown-slide-duration:var(--wpds-motion-duration-md,200ms);--wp-ui-dropdown-slide-easing:var(--wpds-motion-easing-expressive,cubic-bezier(0.25,0,0,1));--wp-ui-dropdown-fade-duration:var(--wpds-motion-duration-sm,100ms);--wp-ui-dropdown-fade-easing:linear;@media not (prefers-reduced-motion){transition-duration:var(--wp-ui-dropdown-slide-duration),var(--wp-ui-dropdown-fade-duration);transition-property:transform,opacity;transition-timing-function:var(--wp-ui-dropdown-slide-easing),var(--wp-ui-dropdown-fade-easing);will-change:transform,opacity}opacity:1;&[data-instant]{transition:none}&[data-ending-style],&[data-starting-style]{opacity:0}}._380b81b8f79fb10f__dropdown-motion{transform:translate(0);&[data-side=bottom][data-ending-style],&[data-side=bottom][data-starting-style]{transform:translateY(calc(var(--wp-ui-dropdown-slide-distance)*-1))}&[data-side=top][data-ending-style],&[data-side=top][data-starting-style]{transform:translateY(var(--wp-ui-dropdown-slide-distance))}&[data-side=left][data-ending-style],&[data-side=left][data-starting-style]{transform:translateX(var(--wp-ui-dropdown-slide-distance))}&[data-side=right][data-ending-style],&[data-side=right][data-starting-style]{transform:translateX(calc(var(--wp-ui-dropdown-slide-distance)*-1))}&[data-side=inline-start][data-ending-style],&[data-side=inline-start][data-starting-style]{transform:translateX(var(--wp-ui-dropdown-slide-distance))}&[data-side=inline-end][data-ending-style],&[data-side=inline-end][data-starting-style]{transform:translateX(calc(var(--wp-ui-dropdown-slide-distance)*-1))}&:dir(rtl)[data-side=inline-start][data-ending-style],&:dir(rtl)[data-side=inline-start][data-starting-style]{transform:translateX(calc(var(--wp-ui-dropdown-slide-distance)*-1))}&:dir(rtl)[data-side=inline-end][data-ending-style],&:dir(rtl)[data-side=inline-end][data-starting-style]{transform:translateX(var(--wp-ui-dropdown-slide-distance))}}}}@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{.d61e2d85c0ee0699__positioner{z-index:var(--wp-ui-menu-z-index,initial)}._34e81249f419a5a5__popup{--wp-ui-menu-popup-padding:var(--wpds-dimension-padding-xs,4px);--wp-ui-menu-min-width:160px;--wp-ui-menu-max-width:var(--wpds-dimension-surface-width-md,400px);--wp-ui-menu-item-padding-inline:var(--wpds-dimension-padding-md,12px);--wp-ui-menu-group-head-padding-inline:var(--wpds-dimension-padding-md,12px);--wp-ui-menu-selection-indicator-track-size:0px;--wp-ui-menu-selection-indicator-size:var(--wpds-dimension-size-sm,24px);--wp-ui-menu-selection-indicator-gap:0px;--_wp-ui-menu-elevation-md:0px 2px 3px 0px #0000000d,0px 4px 5px 0px #0000000a,0px 12px 12px 0px #00000008,0px 16px 16px 0px #00000005;background-color:var(--wpds-color-background-surface-neutral-strong,#fff);border:var(--wpds-border-width-xs,1px) solid var(--wpds-color-stroke-surface-neutral,#dbdbdb);border-radius:var(--wpds-border-radius-md,4px);box-shadow:var(--_wp-ui-menu-elevation-md);max-height:min(var(--available-height),480px,60dvh);max-width:min(var(--available-width),var(--wp-ui-menu-max-width));min-width:min(var(--available-width),var(--wp-ui-menu-min-width));outline:none;overflow-block:auto;overscroll-behavior:none;padding:var(--wp-ui-menu-popup-padding);scroll-padding:var(--wp-ui-menu-popup-padding);&:has(._42313b48c5459be3__item-selection-indicator){--wp-ui-menu-item-padding-inline:var(--wpds-dimension-padding-sm,8px);--wp-ui-menu-selection-indicator-track-size:var(--wpds-dimension-size-2xs,16px);--wp-ui-menu-selection-indicator-gap:var(--wpds-dimension-gap-sm,8px)}}._33f07ab17005471d__list{--_wp-ui-menu-item-label-line-height:var(--wpds-typography-line-height-sm,20px);color:var(--wpds-color-foreground-interactive-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-md,13px);line-height:var(--_wp-ui-menu-item-label-line-height)}._33f07ab17005471d__list,.e05914e1005d7c2e__radio-group,.f11085533c0056b0__group{--wp-ui-menu-group-prefix-gap:0px;display:grid;grid-template-columns:[item-padding-start] var(--wp-ui-menu-item-padding-inline) [selection-start] var(--wp-ui-menu-selection-indicator-track-size) [selection-end] var(--wp-ui-menu-selection-indicator-gap) [prefix-start] max-content [prefix-end] var(--wp-ui-menu-group-prefix-gap) [content-start] minmax(0,1fr) [content-end] var(--wp-ui-menu-item-padding-inline) [item-padding-end];min-width:0}.e05914e1005d7c2e__radio-group,.f11085533c0056b0__group{grid-column:1/-1}._33f07ab17005471d__list:has(>._5c913bce0d8bb0d6__item>._64924ecabf65a5d6__item-prefix),.e05914e1005d7c2e__radio-group:has(>._5c913bce0d8bb0d6__item>._64924ecabf65a5d6__item-prefix),.f11085533c0056b0__group:has(>._5c913bce0d8bb0d6__item>._64924ecabf65a5d6__item-prefix){--wp-ui-menu-group-prefix-gap:var(--wpds-dimension-gap-xs,4px)}._4a0fd085d76fd23c__group-label{align-items:center;color:var(--wpds-color-foreground-content-neutral-weak,#707070);display:flex;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-xs,11px);font-weight:var(--wpds-typography-font-weight-emphasis,600);grid-column:1/-1;line-height:var(--wpds-typography-line-height-xs,16px);min-height:var(--wpds-dimension-size-md,32px);padding-block:var(--wpds-dimension-padding-xs,4px);padding-inline:var(--wp-ui-menu-group-head-padding-inline);text-transform:uppercase}.bfc11368eadf3b39__separator{background-color:var(--wpds-color-stroke-surface-neutral-weak,#f0f0f0);grid-column:1/-1;height:var(--wpds-border-width-xs,1px);margin-block:var(--wpds-dimension-gap-xs,4px);margin-inline:var(--wp-ui-menu-group-head-padding-inline);@media (forced-colors:active){background-color:CanvasText}}._5c913bce0d8bb0d6__item{--wp-ui-menu-item-height:var(--wpds-dimension-size-md,32px);--wp-ui-menu-item-padding-block:var(--wpds-dimension-padding-xs,4px);--_gcd-a-border-radius:var(--wpds-border-radius-sm,2px);align-content:center;align-items:start;border-radius:var(--wpds-border-radius-sm,2px);display:grid;gap:0;grid-column:1/-1;grid-template-columns:[item-padding-start] var(--wp-ui-menu-item-padding-inline) [selection-start] var(--wp-ui-menu-selection-indicator-track-size) [selection-end] var(--wp-ui-menu-selection-indicator-gap) [prefix-start] max-content [prefix-end] var(--wp-ui-menu-group-prefix-gap) [content-start] minmax(0,1fr) [content-end] var(--wp-ui-menu-item-padding-inline) [item-padding-end];justify-content:stretch;min-height:var(--wp-ui-menu-item-height);min-width:0;padding-block:var(--wp-ui-menu-item-padding-block);scroll-margin:var(--wp-ui-menu-popup-padding);text-decoration:none;user-select:none;&:not([data-disabled]){cursor:var(--wpds-cursor-control,pointer)}&[href]{cursor:pointer}@supports (grid-template-columns:subgrid){grid-template-columns:subgrid}&[data-highlighted]:not([aria-disabled=true]){background-color:var(--wpds-color-background-interactive-brand-weak-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 12%,#fff));color:var(--wpds-color-foreground-interactive-neutral,#1e1e1e);outline:none;@media (forced-colors:active){--_gcd-div-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid Highlight;--_gcd-a-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid Highlight}}&[aria-disabled=true]{background-color:var(--wpds-color-background-interactive-brand-weak-disabled,#0000);color:var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d);@media (forced-colors:active){color:GrayText}}}._42313b48c5459be3__item-selection-indicator,._64924ecabf65a5d6__item-prefix,.af879698ede76757__item-content{grid-row:1}._42313b48c5459be3__item-selection-indicator{align-items:center;color:var(--wpds-color-foreground-content-neutral-weak,#707070);display:flex;grid-column:selection-start/selection-end;height:var(--_wp-ui-menu-item-label-line-height);justify-content:center;justify-self:center;pointer-events:none;width:var(--wp-ui-menu-selection-indicator-size);&[data-unchecked]{opacity:0}}._99c5bd141cbf516f__checkbox-selection-icon{translate:0 1px}._59aa9b3b3a651148__radio-selection-icon{fill:currentColor;height:var(--wpds-dimension-size-xs,20px);width:var(--wpds-dimension-size-xs,20px)}._64924ecabf65a5d6__item-prefix{align-items:center;color:var(--wpds-color-foreground-content-neutral-weak,#707070);display:flex;gap:var(--wpds-dimension-gap-xs,4px);grid-column:prefix-start/prefix-end;justify-content:center;min-width:0}.a836378335a4cbf1__prefix-icon{align-self:flex-start;flex-shrink:0;margin-block-start:calc((var(--_wp-ui-menu-item-label-line-height) - var(--_wp-ui-menu-prefix-icon-size))/2)}.af879698ede76757__item-content{align-items:center;align-self:stretch;box-sizing:border-box;display:grid;grid-column:content-start/content-end;grid-template-columns:[label-start] minmax(0,1fr) [label-end suffix-start] auto [suffix-end shortcut-start] auto [shortcut-end trailing-start] auto [trailing-end];min-width:0;pointer-events:none}._943a932d9f81c78c__item-children{display:inline-flex;flex-direction:column;gap:2px;grid-column:label-start/label-end;min-width:0}._5ed41da4abcf8958__item-label{--_gcd-heading-color:currentColor;--_gcd-p-line-height:var(--_wp-ui-menu-item-label-line-height);color:inherit;line-height:var(--_wp-ui-menu-item-label-line-height);min-width:0;overflow-wrap:anywhere}.fa88c9f1a96a4c5a__item-description{--_gcd-heading-color:var(--wpds-color-foreground-content-neutral-weak,#707070);color:var(--wpds-color-foreground-content-neutral-weak,#707070);overflow-wrap:anywhere;padding-block-end:var(--wpds-dimension-padding-xs,4px)}._091406749ed93e6e__item-suffix{align-items:center;display:flex;gap:var(--wpds-dimension-gap-xs,4px);grid-column:suffix-start/suffix-end}._091406749ed93e6e__item-suffix,._23630f40071a29ff__item-shortcut{color:var(--wpds-color-foreground-content-neutral-weak,#707070);margin-inline-start:var(--wpds-dimension-gap-md,12px)}._23630f40071a29ff__item-shortcut{grid-column:shortcut-start/shortcut-end}._06be17a91bf434a0__item-trailing{align-items:center;color:var(--wpds-color-foreground-content-neutral-weak,#707070);display:flex;grid-column:trailing-start/trailing-end;margin-inline-start:var(--wpds-dimension-gap-md,12px)}._943a932d9f81c78c__item-children+:is(._091406749ed93e6e__item-suffix,._23630f40071a29ff__item-shortcut,._06be17a91bf434a0__item-trailing){margin-inline-start:var(--wpds-dimension-gap-xl,24px)}._23630f40071a29ff__item-shortcut+._06be17a91bf434a0__item-trailing{margin-inline-start:var(--wpds-dimension-gap-xs,4px)}.b78aec79bf93eba0__submenu-chevron{margin-inline-end:calc(var(--wpds-dimension-gap-sm, 8px)*-1)}.b78aec79bf93eba0__submenu-chevron:dir(rtl){transform:rotate(180deg)}._60da3b6f9718cf76__external-link-indicator{display:inline-block;font-weight:var(--wpds-typography-font-weight-default,400);line-height:1;margin-inline-start:var(--wpds-dimension-gap-xs,4px);text-decoration:none}._60da3b6f9718cf76__external-link-indicator:after{content:"\\2197"}._60da3b6f9718cf76__external-link-indicator:dir(rtl):after{content:"\\2196"}._5c913bce0d8bb0d6__item[aria-disabled=true] ._06be17a91bf434a0__item-trailing,._5c913bce0d8bb0d6__item[aria-disabled=true] ._091406749ed93e6e__item-suffix,._5c913bce0d8bb0d6__item[aria-disabled=true] ._23630f40071a29ff__item-shortcut,._5c913bce0d8bb0d6__item[aria-disabled=true] ._42313b48c5459be3__item-selection-indicator,._5c913bce0d8bb0d6__item[aria-disabled=true] ._64924ecabf65a5d6__item-prefix,._5c913bce0d8bb0d6__item[aria-disabled=true] .fa88c9f1a96a4c5a__item-description,._5c913bce0d8bb0d6__item[data-highlighted]:not([aria-disabled=true]) ._06be17a91bf434a0__item-trailing,._5c913bce0d8bb0d6__item[data-highlighted]:not([aria-disabled=true]) ._091406749ed93e6e__item-suffix,._5c913bce0d8bb0d6__item[data-highlighted]:not([aria-disabled=true]) ._23630f40071a29ff__item-shortcut,._5c913bce0d8bb0d6__item[data-highlighted]:not([aria-disabled=true]) ._42313b48c5459be3__item-selection-indicator,._5c913bce0d8bb0d6__item[data-highlighted]:not([aria-disabled=true]) ._64924ecabf65a5d6__item-prefix,._5c913bce0d8bb0d6__item[data-highlighted]:not([aria-disabled=true]) .fa88c9f1a96a4c5a__item-description{--_gcd-heading-color:currentColor;color:inherit}}}'); 18917 } 18918 var style_default16 = { "positioner": "d61e2d85c0ee0699__positioner", "popup": "_34e81249f419a5a5__popup", "item-selection-indicator": "_42313b48c5459be3__item-selection-indicator", "is-root": "_087a537b24fee6a1__is-root _380b81b8f79fb10f__dropdown-motion", "is-submenu": "_6d3b567f6289bdc2__is-submenu _7f344b94e270e039__dropdown-motion--fade-only", "list": "_33f07ab17005471d__list", "group": "f11085533c0056b0__group", "radio-group": "e05914e1005d7c2e__radio-group", "item": "_5c913bce0d8bb0d6__item", "item-prefix": "_64924ecabf65a5d6__item-prefix", "group-label": "_4a0fd085d76fd23c__group-label", "separator": "bfc11368eadf3b39__separator", "item-content": "af879698ede76757__item-content", "checkbox-selection-icon": "_99c5bd141cbf516f__checkbox-selection-icon", "radio-selection-icon": "_59aa9b3b3a651148__radio-selection-icon", "prefix-icon": "a836378335a4cbf1__prefix-icon", "item-children": "_943a932d9f81c78c__item-children", "item-label": "_5ed41da4abcf8958__item-label", "item-description": "fa88c9f1a96a4c5a__item-description", "item-suffix": "_091406749ed93e6e__item-suffix", "item-shortcut": "_23630f40071a29ff__item-shortcut", "item-trailing": "_06be17a91bf434a0__item-trailing", "submenu-chevron": "b78aec79bf93eba0__submenu-chevron", "external-link-indicator": "_60da3b6f9718cf76__external-link-indicator" }; 18919 var PrefixIcon = (0, import_element38.forwardRef)( 18920 function MenuPrefixIcon({ className, size: size4 = 24, style, ...props }, ref) { 18921 return /* @__PURE__ */ (0, import_jsx_runtime86.jsx)( 18922 Icon, 18923 { 18924 ...props, 18925 ref, 18926 size: size4, 18927 className: clsx_default(style_default16["prefix-icon"], className), 18928 style: { 18929 ...style, 18930 "--_wp-ui-menu-prefix-icon-size": `$size4}px` 18931 } 18932 } 18933 ); 18934 } 18935 ); 18936 PrefixIcon.displayName = "Menu.PrefixIcon"; 18937 18938 // packages/ui/build-module/menu/radio-group.mjs 18939 var import_element39 = __toESM(require_element(), 1); 18940 var import_jsx_runtime87 = __toESM(require_jsx_runtime(), 1); 18941 var STYLE_HASH_ATTRIBUTE18 = "data-wp-hash"; 18942 function getRuntime18() { 18943 const globalScope = globalThis; 18944 if (globalScope.__wpStyleRuntime) { 18945 return globalScope.__wpStyleRuntime; 18946 } 18947 globalScope.__wpStyleRuntime = { 18948 documents: /* @__PURE__ */ new Map(), 18949 styles: /* @__PURE__ */ new Map(), 18950 injectedStyles: /* @__PURE__ */ new WeakMap() 18951 }; 18952 if (typeof document !== "undefined") { 18953 registerDocument18(document); 18954 } 18955 return globalScope.__wpStyleRuntime; 18956 } 18957 function documentContainsStyleHash18(targetDocument, hash) { 18958 if (!targetDocument.head) { 18959 return false; 18960 } 18961 for (const style of targetDocument.head.querySelectorAll( 18962 `style[$STYLE_HASH_ATTRIBUTE18}]` 18963 )) { 18964 if (style.getAttribute(STYLE_HASH_ATTRIBUTE18) === hash) { 18965 return true; 18966 } 18967 } 18968 return false; 18969 } 18970 function injectStyle18(targetDocument, hash, css) { 18971 if (!targetDocument.head) { 18972 return; 18973 } 18974 const runtime = getRuntime18(); 18975 let injectedStyles = runtime.injectedStyles.get(targetDocument); 18976 if (!injectedStyles) { 18977 injectedStyles = /* @__PURE__ */ new Set(); 18978 runtime.injectedStyles.set(targetDocument, injectedStyles); 18979 } 18980 if (injectedStyles.has(hash)) { 18981 return; 18982 } 18983 if (documentContainsStyleHash18(targetDocument, hash)) { 18984 injectedStyles.add(hash); 18985 return; 18986 } 18987 const style = targetDocument.createElement("style"); 18988 style.setAttribute(STYLE_HASH_ATTRIBUTE18, hash); 18989 style.appendChild(targetDocument.createTextNode(css)); 18990 targetDocument.head.appendChild(style); 18991 injectedStyles.add(hash); 18992 } 18993 function registerDocument18(targetDocument) { 18994 const runtime = getRuntime18(); 18995 runtime.documents.set( 18996 targetDocument, 18997 (runtime.documents.get(targetDocument) ?? 0) + 1 18998 ); 18999 for (const [hash, css] of runtime.styles) { 19000 injectStyle18(targetDocument, hash, css); 19001 } 19002 return () => { 19003 const count = runtime.documents.get(targetDocument); 19004 if (count === void 0) { 19005 return; 19006 } 19007 if (count <= 1) { 19008 runtime.documents.delete(targetDocument); 19009 return; 19010 } 19011 runtime.documents.set(targetDocument, count - 1); 19012 }; 19013 } 19014 function registerStyle18(hash, css) { 19015 const runtime = getRuntime18(); 19016 runtime.styles.set(hash, css); 19017 for (const targetDocument of runtime.documents.keys()) { 19018 injectStyle18(targetDocument, hash, css); 19019 } 19020 } 19021 if (typeof process === "undefined" || true) { 19022 registerStyle18("3be1f8dffe", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._380b81b8f79fb10f__dropdown-motion,._7f344b94e270e039__dropdown-motion--fade-only{--wp-ui-dropdown-slide-distance:4px;--wp-ui-dropdown-slide-duration:var(--wpds-motion-duration-md,200ms);--wp-ui-dropdown-slide-easing:var(--wpds-motion-easing-expressive,cubic-bezier(0.25,0,0,1));--wp-ui-dropdown-fade-duration:var(--wpds-motion-duration-sm,100ms);--wp-ui-dropdown-fade-easing:linear;@media not (prefers-reduced-motion){transition-duration:var(--wp-ui-dropdown-slide-duration),var(--wp-ui-dropdown-fade-duration);transition-property:transform,opacity;transition-timing-function:var(--wp-ui-dropdown-slide-easing),var(--wp-ui-dropdown-fade-easing);will-change:transform,opacity}opacity:1;&[data-instant]{transition:none}&[data-ending-style],&[data-starting-style]{opacity:0}}._380b81b8f79fb10f__dropdown-motion{transform:translate(0);&[data-side=bottom][data-ending-style],&[data-side=bottom][data-starting-style]{transform:translateY(calc(var(--wp-ui-dropdown-slide-distance)*-1))}&[data-side=top][data-ending-style],&[data-side=top][data-starting-style]{transform:translateY(var(--wp-ui-dropdown-slide-distance))}&[data-side=left][data-ending-style],&[data-side=left][data-starting-style]{transform:translateX(var(--wp-ui-dropdown-slide-distance))}&[data-side=right][data-ending-style],&[data-side=right][data-starting-style]{transform:translateX(calc(var(--wp-ui-dropdown-slide-distance)*-1))}&[data-side=inline-start][data-ending-style],&[data-side=inline-start][data-starting-style]{transform:translateX(var(--wp-ui-dropdown-slide-distance))}&[data-side=inline-end][data-ending-style],&[data-side=inline-end][data-starting-style]{transform:translateX(calc(var(--wp-ui-dropdown-slide-distance)*-1))}&:dir(rtl)[data-side=inline-start][data-ending-style],&:dir(rtl)[data-side=inline-start][data-starting-style]{transform:translateX(calc(var(--wp-ui-dropdown-slide-distance)*-1))}&:dir(rtl)[data-side=inline-end][data-ending-style],&:dir(rtl)[data-side=inline-end][data-starting-style]{transform:translateX(var(--wp-ui-dropdown-slide-distance))}}}}@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{.d61e2d85c0ee0699__positioner{z-index:var(--wp-ui-menu-z-index,initial)}._34e81249f419a5a5__popup{--wp-ui-menu-popup-padding:var(--wpds-dimension-padding-xs,4px);--wp-ui-menu-min-width:160px;--wp-ui-menu-max-width:var(--wpds-dimension-surface-width-md,400px);--wp-ui-menu-item-padding-inline:var(--wpds-dimension-padding-md,12px);--wp-ui-menu-group-head-padding-inline:var(--wpds-dimension-padding-md,12px);--wp-ui-menu-selection-indicator-track-size:0px;--wp-ui-menu-selection-indicator-size:var(--wpds-dimension-size-sm,24px);--wp-ui-menu-selection-indicator-gap:0px;--_wp-ui-menu-elevation-md:0px 2px 3px 0px #0000000d,0px 4px 5px 0px #0000000a,0px 12px 12px 0px #00000008,0px 16px 16px 0px #00000005;background-color:var(--wpds-color-background-surface-neutral-strong,#fff);border:var(--wpds-border-width-xs,1px) solid var(--wpds-color-stroke-surface-neutral,#dbdbdb);border-radius:var(--wpds-border-radius-md,4px);box-shadow:var(--_wp-ui-menu-elevation-md);max-height:min(var(--available-height),480px,60dvh);max-width:min(var(--available-width),var(--wp-ui-menu-max-width));min-width:min(var(--available-width),var(--wp-ui-menu-min-width));outline:none;overflow-block:auto;overscroll-behavior:none;padding:var(--wp-ui-menu-popup-padding);scroll-padding:var(--wp-ui-menu-popup-padding);&:has(._42313b48c5459be3__item-selection-indicator){--wp-ui-menu-item-padding-inline:var(--wpds-dimension-padding-sm,8px);--wp-ui-menu-selection-indicator-track-size:var(--wpds-dimension-size-2xs,16px);--wp-ui-menu-selection-indicator-gap:var(--wpds-dimension-gap-sm,8px)}}._33f07ab17005471d__list{--_wp-ui-menu-item-label-line-height:var(--wpds-typography-line-height-sm,20px);color:var(--wpds-color-foreground-interactive-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-md,13px);line-height:var(--_wp-ui-menu-item-label-line-height)}._33f07ab17005471d__list,.e05914e1005d7c2e__radio-group,.f11085533c0056b0__group{--wp-ui-menu-group-prefix-gap:0px;display:grid;grid-template-columns:[item-padding-start] var(--wp-ui-menu-item-padding-inline) [selection-start] var(--wp-ui-menu-selection-indicator-track-size) [selection-end] var(--wp-ui-menu-selection-indicator-gap) [prefix-start] max-content [prefix-end] var(--wp-ui-menu-group-prefix-gap) [content-start] minmax(0,1fr) [content-end] var(--wp-ui-menu-item-padding-inline) [item-padding-end];min-width:0}.e05914e1005d7c2e__radio-group,.f11085533c0056b0__group{grid-column:1/-1}._33f07ab17005471d__list:has(>._5c913bce0d8bb0d6__item>._64924ecabf65a5d6__item-prefix),.e05914e1005d7c2e__radio-group:has(>._5c913bce0d8bb0d6__item>._64924ecabf65a5d6__item-prefix),.f11085533c0056b0__group:has(>._5c913bce0d8bb0d6__item>._64924ecabf65a5d6__item-prefix){--wp-ui-menu-group-prefix-gap:var(--wpds-dimension-gap-xs,4px)}._4a0fd085d76fd23c__group-label{align-items:center;color:var(--wpds-color-foreground-content-neutral-weak,#707070);display:flex;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-xs,11px);font-weight:var(--wpds-typography-font-weight-emphasis,600);grid-column:1/-1;line-height:var(--wpds-typography-line-height-xs,16px);min-height:var(--wpds-dimension-size-md,32px);padding-block:var(--wpds-dimension-padding-xs,4px);padding-inline:var(--wp-ui-menu-group-head-padding-inline);text-transform:uppercase}.bfc11368eadf3b39__separator{background-color:var(--wpds-color-stroke-surface-neutral-weak,#f0f0f0);grid-column:1/-1;height:var(--wpds-border-width-xs,1px);margin-block:var(--wpds-dimension-gap-xs,4px);margin-inline:var(--wp-ui-menu-group-head-padding-inline);@media (forced-colors:active){background-color:CanvasText}}._5c913bce0d8bb0d6__item{--wp-ui-menu-item-height:var(--wpds-dimension-size-md,32px);--wp-ui-menu-item-padding-block:var(--wpds-dimension-padding-xs,4px);--_gcd-a-border-radius:var(--wpds-border-radius-sm,2px);align-content:center;align-items:start;border-radius:var(--wpds-border-radius-sm,2px);display:grid;gap:0;grid-column:1/-1;grid-template-columns:[item-padding-start] var(--wp-ui-menu-item-padding-inline) [selection-start] var(--wp-ui-menu-selection-indicator-track-size) [selection-end] var(--wp-ui-menu-selection-indicator-gap) [prefix-start] max-content [prefix-end] var(--wp-ui-menu-group-prefix-gap) [content-start] minmax(0,1fr) [content-end] var(--wp-ui-menu-item-padding-inline) [item-padding-end];justify-content:stretch;min-height:var(--wp-ui-menu-item-height);min-width:0;padding-block:var(--wp-ui-menu-item-padding-block);scroll-margin:var(--wp-ui-menu-popup-padding);text-decoration:none;user-select:none;&:not([data-disabled]){cursor:var(--wpds-cursor-control,pointer)}&[href]{cursor:pointer}@supports (grid-template-columns:subgrid){grid-template-columns:subgrid}&[data-highlighted]:not([aria-disabled=true]){background-color:var(--wpds-color-background-interactive-brand-weak-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 12%,#fff));color:var(--wpds-color-foreground-interactive-neutral,#1e1e1e);outline:none;@media (forced-colors:active){--_gcd-div-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid Highlight;--_gcd-a-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid Highlight}}&[aria-disabled=true]{background-color:var(--wpds-color-background-interactive-brand-weak-disabled,#0000);color:var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d);@media (forced-colors:active){color:GrayText}}}._42313b48c5459be3__item-selection-indicator,._64924ecabf65a5d6__item-prefix,.af879698ede76757__item-content{grid-row:1}._42313b48c5459be3__item-selection-indicator{align-items:center;color:var(--wpds-color-foreground-content-neutral-weak,#707070);display:flex;grid-column:selection-start/selection-end;height:var(--_wp-ui-menu-item-label-line-height);justify-content:center;justify-self:center;pointer-events:none;width:var(--wp-ui-menu-selection-indicator-size);&[data-unchecked]{opacity:0}}._99c5bd141cbf516f__checkbox-selection-icon{translate:0 1px}._59aa9b3b3a651148__radio-selection-icon{fill:currentColor;height:var(--wpds-dimension-size-xs,20px);width:var(--wpds-dimension-size-xs,20px)}._64924ecabf65a5d6__item-prefix{align-items:center;color:var(--wpds-color-foreground-content-neutral-weak,#707070);display:flex;gap:var(--wpds-dimension-gap-xs,4px);grid-column:prefix-start/prefix-end;justify-content:center;min-width:0}.a836378335a4cbf1__prefix-icon{align-self:flex-start;flex-shrink:0;margin-block-start:calc((var(--_wp-ui-menu-item-label-line-height) - var(--_wp-ui-menu-prefix-icon-size))/2)}.af879698ede76757__item-content{align-items:center;align-self:stretch;box-sizing:border-box;display:grid;grid-column:content-start/content-end;grid-template-columns:[label-start] minmax(0,1fr) [label-end suffix-start] auto [suffix-end shortcut-start] auto [shortcut-end trailing-start] auto [trailing-end];min-width:0;pointer-events:none}._943a932d9f81c78c__item-children{display:inline-flex;flex-direction:column;gap:2px;grid-column:label-start/label-end;min-width:0}._5ed41da4abcf8958__item-label{--_gcd-heading-color:currentColor;--_gcd-p-line-height:var(--_wp-ui-menu-item-label-line-height);color:inherit;line-height:var(--_wp-ui-menu-item-label-line-height);min-width:0;overflow-wrap:anywhere}.fa88c9f1a96a4c5a__item-description{--_gcd-heading-color:var(--wpds-color-foreground-content-neutral-weak,#707070);color:var(--wpds-color-foreground-content-neutral-weak,#707070);overflow-wrap:anywhere;padding-block-end:var(--wpds-dimension-padding-xs,4px)}._091406749ed93e6e__item-suffix{align-items:center;display:flex;gap:var(--wpds-dimension-gap-xs,4px);grid-column:suffix-start/suffix-end}._091406749ed93e6e__item-suffix,._23630f40071a29ff__item-shortcut{color:var(--wpds-color-foreground-content-neutral-weak,#707070);margin-inline-start:var(--wpds-dimension-gap-md,12px)}._23630f40071a29ff__item-shortcut{grid-column:shortcut-start/shortcut-end}._06be17a91bf434a0__item-trailing{align-items:center;color:var(--wpds-color-foreground-content-neutral-weak,#707070);display:flex;grid-column:trailing-start/trailing-end;margin-inline-start:var(--wpds-dimension-gap-md,12px)}._943a932d9f81c78c__item-children+:is(._091406749ed93e6e__item-suffix,._23630f40071a29ff__item-shortcut,._06be17a91bf434a0__item-trailing){margin-inline-start:var(--wpds-dimension-gap-xl,24px)}._23630f40071a29ff__item-shortcut+._06be17a91bf434a0__item-trailing{margin-inline-start:var(--wpds-dimension-gap-xs,4px)}.b78aec79bf93eba0__submenu-chevron{margin-inline-end:calc(var(--wpds-dimension-gap-sm, 8px)*-1)}.b78aec79bf93eba0__submenu-chevron:dir(rtl){transform:rotate(180deg)}._60da3b6f9718cf76__external-link-indicator{display:inline-block;font-weight:var(--wpds-typography-font-weight-default,400);line-height:1;margin-inline-start:var(--wpds-dimension-gap-xs,4px);text-decoration:none}._60da3b6f9718cf76__external-link-indicator:after{content:"\\2197"}._60da3b6f9718cf76__external-link-indicator:dir(rtl):after{content:"\\2196"}._5c913bce0d8bb0d6__item[aria-disabled=true] ._06be17a91bf434a0__item-trailing,._5c913bce0d8bb0d6__item[aria-disabled=true] ._091406749ed93e6e__item-suffix,._5c913bce0d8bb0d6__item[aria-disabled=true] ._23630f40071a29ff__item-shortcut,._5c913bce0d8bb0d6__item[aria-disabled=true] ._42313b48c5459be3__item-selection-indicator,._5c913bce0d8bb0d6__item[aria-disabled=true] ._64924ecabf65a5d6__item-prefix,._5c913bce0d8bb0d6__item[aria-disabled=true] .fa88c9f1a96a4c5a__item-description,._5c913bce0d8bb0d6__item[data-highlighted]:not([aria-disabled=true]) ._06be17a91bf434a0__item-trailing,._5c913bce0d8bb0d6__item[data-highlighted]:not([aria-disabled=true]) ._091406749ed93e6e__item-suffix,._5c913bce0d8bb0d6__item[data-highlighted]:not([aria-disabled=true]) ._23630f40071a29ff__item-shortcut,._5c913bce0d8bb0d6__item[data-highlighted]:not([aria-disabled=true]) ._42313b48c5459be3__item-selection-indicator,._5c913bce0d8bb0d6__item[data-highlighted]:not([aria-disabled=true]) ._64924ecabf65a5d6__item-prefix,._5c913bce0d8bb0d6__item[data-highlighted]:not([aria-disabled=true]) .fa88c9f1a96a4c5a__item-description{--_gcd-heading-color:currentColor;color:inherit}}}'); 19023 } 19024 var style_default17 = { "positioner": "d61e2d85c0ee0699__positioner", "popup": "_34e81249f419a5a5__popup", "item-selection-indicator": "_42313b48c5459be3__item-selection-indicator", "is-root": "_087a537b24fee6a1__is-root _380b81b8f79fb10f__dropdown-motion", "is-submenu": "_6d3b567f6289bdc2__is-submenu _7f344b94e270e039__dropdown-motion--fade-only", "list": "_33f07ab17005471d__list", "group": "f11085533c0056b0__group", "radio-group": "e05914e1005d7c2e__radio-group", "item": "_5c913bce0d8bb0d6__item", "item-prefix": "_64924ecabf65a5d6__item-prefix", "group-label": "_4a0fd085d76fd23c__group-label", "separator": "bfc11368eadf3b39__separator", "item-content": "af879698ede76757__item-content", "checkbox-selection-icon": "_99c5bd141cbf516f__checkbox-selection-icon", "radio-selection-icon": "_59aa9b3b3a651148__radio-selection-icon", "prefix-icon": "a836378335a4cbf1__prefix-icon", "item-children": "_943a932d9f81c78c__item-children", "item-label": "_5ed41da4abcf8958__item-label", "item-description": "fa88c9f1a96a4c5a__item-description", "item-suffix": "_091406749ed93e6e__item-suffix", "item-shortcut": "_23630f40071a29ff__item-shortcut", "item-trailing": "_06be17a91bf434a0__item-trailing", "submenu-chevron": "b78aec79bf93eba0__submenu-chevron", "external-link-indicator": "_60da3b6f9718cf76__external-link-indicator" }; 19025 var RadioGroup = (0, import_element39.forwardRef)( 19026 function MenuRadioGroup3({ className, ...props }, ref) { 19027 return /* @__PURE__ */ (0, import_jsx_runtime87.jsx)( 19028 index_parts_exports.RadioGroup, 19029 { 19030 ref, 19031 className: clsx_default(style_default17["radio-group"], className), 19032 ...props 19033 } 19034 ); 19035 } 19036 ); 19037 19038 // packages/ui/build-module/menu/radio-item.mjs 19039 var import_element40 = __toESM(require_element(), 1); 19040 var import_primitives36 = __toESM(require_primitives(), 1); 19041 var import_jsx_runtime88 = __toESM(require_jsx_runtime(), 1); 19042 var STYLE_HASH_ATTRIBUTE19 = "data-wp-hash"; 19043 function getRuntime19() { 19044 const globalScope = globalThis; 19045 if (globalScope.__wpStyleRuntime) { 19046 return globalScope.__wpStyleRuntime; 19047 } 19048 globalScope.__wpStyleRuntime = { 19049 documents: /* @__PURE__ */ new Map(), 19050 styles: /* @__PURE__ */ new Map(), 19051 injectedStyles: /* @__PURE__ */ new WeakMap() 19052 }; 19053 if (typeof document !== "undefined") { 19054 registerDocument19(document); 19055 } 19056 return globalScope.__wpStyleRuntime; 19057 } 19058 function documentContainsStyleHash19(targetDocument, hash) { 19059 if (!targetDocument.head) { 19060 return false; 19061 } 19062 for (const style of targetDocument.head.querySelectorAll( 19063 `style[$STYLE_HASH_ATTRIBUTE19}]` 19064 )) { 19065 if (style.getAttribute(STYLE_HASH_ATTRIBUTE19) === hash) { 19066 return true; 19067 } 19068 } 19069 return false; 19070 } 19071 function injectStyle19(targetDocument, hash, css) { 19072 if (!targetDocument.head) { 19073 return; 19074 } 19075 const runtime = getRuntime19(); 19076 let injectedStyles = runtime.injectedStyles.get(targetDocument); 19077 if (!injectedStyles) { 19078 injectedStyles = /* @__PURE__ */ new Set(); 19079 runtime.injectedStyles.set(targetDocument, injectedStyles); 19080 } 19081 if (injectedStyles.has(hash)) { 19082 return; 19083 } 19084 if (documentContainsStyleHash19(targetDocument, hash)) { 19085 injectedStyles.add(hash); 19086 return; 19087 } 19088 const style = targetDocument.createElement("style"); 19089 style.setAttribute(STYLE_HASH_ATTRIBUTE19, hash); 19090 style.appendChild(targetDocument.createTextNode(css)); 19091 targetDocument.head.appendChild(style); 19092 injectedStyles.add(hash); 19093 } 19094 function registerDocument19(targetDocument) { 19095 const runtime = getRuntime19(); 19096 runtime.documents.set( 19097 targetDocument, 19098 (runtime.documents.get(targetDocument) ?? 0) + 1 19099 ); 19100 for (const [hash, css] of runtime.styles) { 19101 injectStyle19(targetDocument, hash, css); 19102 } 19103 return () => { 19104 const count = runtime.documents.get(targetDocument); 19105 if (count === void 0) { 19106 return; 19107 } 19108 if (count <= 1) { 19109 runtime.documents.delete(targetDocument); 19110 return; 19111 } 19112 runtime.documents.set(targetDocument, count - 1); 19113 }; 19114 } 19115 function registerStyle19(hash, css) { 19116 const runtime = getRuntime19(); 19117 runtime.styles.set(hash, css); 19118 for (const targetDocument of runtime.documents.keys()) { 19119 injectStyle19(targetDocument, hash, css); 19120 } 19121 } 19122 if (typeof process === "undefined" || true) { 19123 registerStyle19("e8e31009f5", "._6defc79820e382c6__button{box-sizing:var(--_gcd-button-box-sizing,border-box);font-family:var(--_gcd-button-font-family,inherit);font-size:var(--_gcd-button-font-size,inherit);font-weight:var(--_gcd-button-font-weight,inherit)}.d2cff2e5dea83bd1__input{box-sizing:var(--_gcd-input-box-sizing,border-box);font-family:var(--_gcd-input-font-family,inherit);font-size:var(--_gcd-input-font-size,inherit);font-weight:var(--_gcd-input-font-weight,inherit);margin:var(--_gcd-input-margin,0);&::placeholder{color:var(--_gcd-input-placeholder-color,var(--wpds-color-foreground-interactive-neutral-weak,#707070))}&:is(textarea,[type=text],[type=password],[type=color],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){background-color:var(--_gcd-input-background-color,transparent);border:var(--_gcd-input-border,none);border-radius:var(--_gcd-input-border-radius,0);box-shadow:var(--_gcd-input-box-shadow,0 0 0 transparent);color:var(--_gcd-input-color,var(--wpds-color-foreground-interactive-neutral,#1e1e1e));&:focus{border-color:var(--_gcd-input-border-color-focus,var(--wp-admin-theme-color));box-shadow:var(--_gcd-input-box-shadow-focus,none);outline:var(--_gcd-input-outline-focus,none)}&:disabled{background:var(--_gcd-input-background-disabled,transparent);border-color:var(--_gcd-input-border-color-disabled,transparent);box-shadow:var(--_gcd-input-box-shadow-disabled,none);color:var(--_gcd-input-color-disabled,var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d))}}&:is(textarea,[type=text],[type=password],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){line-height:var(--_gcd-input-line-height,inherit);min-height:var(--_gcd-input-min-height,auto);padding:var(--_gcd-input-padding,0)}}._547d86373d02e108__textarea{box-sizing:var(--_gcd-textarea-box-sizing,border-box);overflow:var(--_gcd-textarea-overflow,auto);resize:var(--_gcd-textarea-resize,block)}._8c15fd0ed9f28ba4__div{outline:var(--_gcd-div-outline,0 solid transparent)}p._43cec3e1eec1066d__p{font-size:var(--_gcd-p-font-size,13px);line-height:var(--_gcd-p-line-height,1.5);margin:var(--_gcd-p-margin,0)}:is(h1,h2,h3,h4,h5,h6).e97669c6d9a38497__heading{color:var(--_gcd-heading-color,var(--wpds-color-foreground-content-neutral,#1e1e1e));font-size:var(--_gcd-heading-font-size,inherit);font-weight:var(--_gcd-heading-font-weight,var(--wpds-typography-font-weight-emphasis,600));margin:var(--_gcd-heading-margin,0)}._2c0831b0499dbd6e__a,._2c0831b0499dbd6e__a:is(:hover,:focus,:active){border-radius:var(--_gcd-a-border-radius,0);box-shadow:var(--_gcd-a-box-shadow,none);color:var(--_gcd-a-color,inherit);outline:var(--_gcd-a-outline,0 solid transparent);transition:var(--_gcd-a-transition,none)}.c59a0ebebd71fa4a__ol{list-style:var(--_gcd-ol-list-style,none);margin:var(--_gcd-ol-margin,0);padding-block:var(--_gcd-ol-padding-block,0);padding-inline:var(--_gcd-ol-padding-inline,0)}._46b5cb0c8e24e8c9__li{margin:var(--_gcd-li-margin,0)}"); 19124 } 19125 var global_css_defense_default6 = { "button": "_6defc79820e382c6__button", "input": "d2cff2e5dea83bd1__input", "textarea": "_547d86373d02e108__textarea", "div": "_8c15fd0ed9f28ba4__div", "p": "_43cec3e1eec1066d__p", "heading": "e97669c6d9a38497__heading", "a": "_2c0831b0499dbd6e__a", "ol": "c59a0ebebd71fa4a__ol", "li": "_46b5cb0c8e24e8c9__li" }; 19126 if (typeof process === "undefined" || true) { 19127 registerStyle19("10f3806643", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._336cd3e4e743482f__box-sizing{box-sizing:border-box;*,:after,:before{box-sizing:inherit}}}}"); 19128 } 19129 var resets_default7 = { "box-sizing": "_336cd3e4e743482f__box-sizing" }; 19130 if (typeof process === "undefined" || true) { 19131 registerStyle19("3be1f8dffe", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._380b81b8f79fb10f__dropdown-motion,._7f344b94e270e039__dropdown-motion--fade-only{--wp-ui-dropdown-slide-distance:4px;--wp-ui-dropdown-slide-duration:var(--wpds-motion-duration-md,200ms);--wp-ui-dropdown-slide-easing:var(--wpds-motion-easing-expressive,cubic-bezier(0.25,0,0,1));--wp-ui-dropdown-fade-duration:var(--wpds-motion-duration-sm,100ms);--wp-ui-dropdown-fade-easing:linear;@media not (prefers-reduced-motion){transition-duration:var(--wp-ui-dropdown-slide-duration),var(--wp-ui-dropdown-fade-duration);transition-property:transform,opacity;transition-timing-function:var(--wp-ui-dropdown-slide-easing),var(--wp-ui-dropdown-fade-easing);will-change:transform,opacity}opacity:1;&[data-instant]{transition:none}&[data-ending-style],&[data-starting-style]{opacity:0}}._380b81b8f79fb10f__dropdown-motion{transform:translate(0);&[data-side=bottom][data-ending-style],&[data-side=bottom][data-starting-style]{transform:translateY(calc(var(--wp-ui-dropdown-slide-distance)*-1))}&[data-side=top][data-ending-style],&[data-side=top][data-starting-style]{transform:translateY(var(--wp-ui-dropdown-slide-distance))}&[data-side=left][data-ending-style],&[data-side=left][data-starting-style]{transform:translateX(var(--wp-ui-dropdown-slide-distance))}&[data-side=right][data-ending-style],&[data-side=right][data-starting-style]{transform:translateX(calc(var(--wp-ui-dropdown-slide-distance)*-1))}&[data-side=inline-start][data-ending-style],&[data-side=inline-start][data-starting-style]{transform:translateX(var(--wp-ui-dropdown-slide-distance))}&[data-side=inline-end][data-ending-style],&[data-side=inline-end][data-starting-style]{transform:translateX(calc(var(--wp-ui-dropdown-slide-distance)*-1))}&:dir(rtl)[data-side=inline-start][data-ending-style],&:dir(rtl)[data-side=inline-start][data-starting-style]{transform:translateX(calc(var(--wp-ui-dropdown-slide-distance)*-1))}&:dir(rtl)[data-side=inline-end][data-ending-style],&:dir(rtl)[data-side=inline-end][data-starting-style]{transform:translateX(var(--wp-ui-dropdown-slide-distance))}}}}@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{.d61e2d85c0ee0699__positioner{z-index:var(--wp-ui-menu-z-index,initial)}._34e81249f419a5a5__popup{--wp-ui-menu-popup-padding:var(--wpds-dimension-padding-xs,4px);--wp-ui-menu-min-width:160px;--wp-ui-menu-max-width:var(--wpds-dimension-surface-width-md,400px);--wp-ui-menu-item-padding-inline:var(--wpds-dimension-padding-md,12px);--wp-ui-menu-group-head-padding-inline:var(--wpds-dimension-padding-md,12px);--wp-ui-menu-selection-indicator-track-size:0px;--wp-ui-menu-selection-indicator-size:var(--wpds-dimension-size-sm,24px);--wp-ui-menu-selection-indicator-gap:0px;--_wp-ui-menu-elevation-md:0px 2px 3px 0px #0000000d,0px 4px 5px 0px #0000000a,0px 12px 12px 0px #00000008,0px 16px 16px 0px #00000005;background-color:var(--wpds-color-background-surface-neutral-strong,#fff);border:var(--wpds-border-width-xs,1px) solid var(--wpds-color-stroke-surface-neutral,#dbdbdb);border-radius:var(--wpds-border-radius-md,4px);box-shadow:var(--_wp-ui-menu-elevation-md);max-height:min(var(--available-height),480px,60dvh);max-width:min(var(--available-width),var(--wp-ui-menu-max-width));min-width:min(var(--available-width),var(--wp-ui-menu-min-width));outline:none;overflow-block:auto;overscroll-behavior:none;padding:var(--wp-ui-menu-popup-padding);scroll-padding:var(--wp-ui-menu-popup-padding);&:has(._42313b48c5459be3__item-selection-indicator){--wp-ui-menu-item-padding-inline:var(--wpds-dimension-padding-sm,8px);--wp-ui-menu-selection-indicator-track-size:var(--wpds-dimension-size-2xs,16px);--wp-ui-menu-selection-indicator-gap:var(--wpds-dimension-gap-sm,8px)}}._33f07ab17005471d__list{--_wp-ui-menu-item-label-line-height:var(--wpds-typography-line-height-sm,20px);color:var(--wpds-color-foreground-interactive-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-md,13px);line-height:var(--_wp-ui-menu-item-label-line-height)}._33f07ab17005471d__list,.e05914e1005d7c2e__radio-group,.f11085533c0056b0__group{--wp-ui-menu-group-prefix-gap:0px;display:grid;grid-template-columns:[item-padding-start] var(--wp-ui-menu-item-padding-inline) [selection-start] var(--wp-ui-menu-selection-indicator-track-size) [selection-end] var(--wp-ui-menu-selection-indicator-gap) [prefix-start] max-content [prefix-end] var(--wp-ui-menu-group-prefix-gap) [content-start] minmax(0,1fr) [content-end] var(--wp-ui-menu-item-padding-inline) [item-padding-end];min-width:0}.e05914e1005d7c2e__radio-group,.f11085533c0056b0__group{grid-column:1/-1}._33f07ab17005471d__list:has(>._5c913bce0d8bb0d6__item>._64924ecabf65a5d6__item-prefix),.e05914e1005d7c2e__radio-group:has(>._5c913bce0d8bb0d6__item>._64924ecabf65a5d6__item-prefix),.f11085533c0056b0__group:has(>._5c913bce0d8bb0d6__item>._64924ecabf65a5d6__item-prefix){--wp-ui-menu-group-prefix-gap:var(--wpds-dimension-gap-xs,4px)}._4a0fd085d76fd23c__group-label{align-items:center;color:var(--wpds-color-foreground-content-neutral-weak,#707070);display:flex;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-xs,11px);font-weight:var(--wpds-typography-font-weight-emphasis,600);grid-column:1/-1;line-height:var(--wpds-typography-line-height-xs,16px);min-height:var(--wpds-dimension-size-md,32px);padding-block:var(--wpds-dimension-padding-xs,4px);padding-inline:var(--wp-ui-menu-group-head-padding-inline);text-transform:uppercase}.bfc11368eadf3b39__separator{background-color:var(--wpds-color-stroke-surface-neutral-weak,#f0f0f0);grid-column:1/-1;height:var(--wpds-border-width-xs,1px);margin-block:var(--wpds-dimension-gap-xs,4px);margin-inline:var(--wp-ui-menu-group-head-padding-inline);@media (forced-colors:active){background-color:CanvasText}}._5c913bce0d8bb0d6__item{--wp-ui-menu-item-height:var(--wpds-dimension-size-md,32px);--wp-ui-menu-item-padding-block:var(--wpds-dimension-padding-xs,4px);--_gcd-a-border-radius:var(--wpds-border-radius-sm,2px);align-content:center;align-items:start;border-radius:var(--wpds-border-radius-sm,2px);display:grid;gap:0;grid-column:1/-1;grid-template-columns:[item-padding-start] var(--wp-ui-menu-item-padding-inline) [selection-start] var(--wp-ui-menu-selection-indicator-track-size) [selection-end] var(--wp-ui-menu-selection-indicator-gap) [prefix-start] max-content [prefix-end] var(--wp-ui-menu-group-prefix-gap) [content-start] minmax(0,1fr) [content-end] var(--wp-ui-menu-item-padding-inline) [item-padding-end];justify-content:stretch;min-height:var(--wp-ui-menu-item-height);min-width:0;padding-block:var(--wp-ui-menu-item-padding-block);scroll-margin:var(--wp-ui-menu-popup-padding);text-decoration:none;user-select:none;&:not([data-disabled]){cursor:var(--wpds-cursor-control,pointer)}&[href]{cursor:pointer}@supports (grid-template-columns:subgrid){grid-template-columns:subgrid}&[data-highlighted]:not([aria-disabled=true]){background-color:var(--wpds-color-background-interactive-brand-weak-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 12%,#fff));color:var(--wpds-color-foreground-interactive-neutral,#1e1e1e);outline:none;@media (forced-colors:active){--_gcd-div-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid Highlight;--_gcd-a-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid Highlight}}&[aria-disabled=true]{background-color:var(--wpds-color-background-interactive-brand-weak-disabled,#0000);color:var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d);@media (forced-colors:active){color:GrayText}}}._42313b48c5459be3__item-selection-indicator,._64924ecabf65a5d6__item-prefix,.af879698ede76757__item-content{grid-row:1}._42313b48c5459be3__item-selection-indicator{align-items:center;color:var(--wpds-color-foreground-content-neutral-weak,#707070);display:flex;grid-column:selection-start/selection-end;height:var(--_wp-ui-menu-item-label-line-height);justify-content:center;justify-self:center;pointer-events:none;width:var(--wp-ui-menu-selection-indicator-size);&[data-unchecked]{opacity:0}}._99c5bd141cbf516f__checkbox-selection-icon{translate:0 1px}._59aa9b3b3a651148__radio-selection-icon{fill:currentColor;height:var(--wpds-dimension-size-xs,20px);width:var(--wpds-dimension-size-xs,20px)}._64924ecabf65a5d6__item-prefix{align-items:center;color:var(--wpds-color-foreground-content-neutral-weak,#707070);display:flex;gap:var(--wpds-dimension-gap-xs,4px);grid-column:prefix-start/prefix-end;justify-content:center;min-width:0}.a836378335a4cbf1__prefix-icon{align-self:flex-start;flex-shrink:0;margin-block-start:calc((var(--_wp-ui-menu-item-label-line-height) - var(--_wp-ui-menu-prefix-icon-size))/2)}.af879698ede76757__item-content{align-items:center;align-self:stretch;box-sizing:border-box;display:grid;grid-column:content-start/content-end;grid-template-columns:[label-start] minmax(0,1fr) [label-end suffix-start] auto [suffix-end shortcut-start] auto [shortcut-end trailing-start] auto [trailing-end];min-width:0;pointer-events:none}._943a932d9f81c78c__item-children{display:inline-flex;flex-direction:column;gap:2px;grid-column:label-start/label-end;min-width:0}._5ed41da4abcf8958__item-label{--_gcd-heading-color:currentColor;--_gcd-p-line-height:var(--_wp-ui-menu-item-label-line-height);color:inherit;line-height:var(--_wp-ui-menu-item-label-line-height);min-width:0;overflow-wrap:anywhere}.fa88c9f1a96a4c5a__item-description{--_gcd-heading-color:var(--wpds-color-foreground-content-neutral-weak,#707070);color:var(--wpds-color-foreground-content-neutral-weak,#707070);overflow-wrap:anywhere;padding-block-end:var(--wpds-dimension-padding-xs,4px)}._091406749ed93e6e__item-suffix{align-items:center;display:flex;gap:var(--wpds-dimension-gap-xs,4px);grid-column:suffix-start/suffix-end}._091406749ed93e6e__item-suffix,._23630f40071a29ff__item-shortcut{color:var(--wpds-color-foreground-content-neutral-weak,#707070);margin-inline-start:var(--wpds-dimension-gap-md,12px)}._23630f40071a29ff__item-shortcut{grid-column:shortcut-start/shortcut-end}._06be17a91bf434a0__item-trailing{align-items:center;color:var(--wpds-color-foreground-content-neutral-weak,#707070);display:flex;grid-column:trailing-start/trailing-end;margin-inline-start:var(--wpds-dimension-gap-md,12px)}._943a932d9f81c78c__item-children+:is(._091406749ed93e6e__item-suffix,._23630f40071a29ff__item-shortcut,._06be17a91bf434a0__item-trailing){margin-inline-start:var(--wpds-dimension-gap-xl,24px)}._23630f40071a29ff__item-shortcut+._06be17a91bf434a0__item-trailing{margin-inline-start:var(--wpds-dimension-gap-xs,4px)}.b78aec79bf93eba0__submenu-chevron{margin-inline-end:calc(var(--wpds-dimension-gap-sm, 8px)*-1)}.b78aec79bf93eba0__submenu-chevron:dir(rtl){transform:rotate(180deg)}._60da3b6f9718cf76__external-link-indicator{display:inline-block;font-weight:var(--wpds-typography-font-weight-default,400);line-height:1;margin-inline-start:var(--wpds-dimension-gap-xs,4px);text-decoration:none}._60da3b6f9718cf76__external-link-indicator:after{content:"\\2197"}._60da3b6f9718cf76__external-link-indicator:dir(rtl):after{content:"\\2196"}._5c913bce0d8bb0d6__item[aria-disabled=true] ._06be17a91bf434a0__item-trailing,._5c913bce0d8bb0d6__item[aria-disabled=true] ._091406749ed93e6e__item-suffix,._5c913bce0d8bb0d6__item[aria-disabled=true] ._23630f40071a29ff__item-shortcut,._5c913bce0d8bb0d6__item[aria-disabled=true] ._42313b48c5459be3__item-selection-indicator,._5c913bce0d8bb0d6__item[aria-disabled=true] ._64924ecabf65a5d6__item-prefix,._5c913bce0d8bb0d6__item[aria-disabled=true] .fa88c9f1a96a4c5a__item-description,._5c913bce0d8bb0d6__item[data-highlighted]:not([aria-disabled=true]) ._06be17a91bf434a0__item-trailing,._5c913bce0d8bb0d6__item[data-highlighted]:not([aria-disabled=true]) ._091406749ed93e6e__item-suffix,._5c913bce0d8bb0d6__item[data-highlighted]:not([aria-disabled=true]) ._23630f40071a29ff__item-shortcut,._5c913bce0d8bb0d6__item[data-highlighted]:not([aria-disabled=true]) ._42313b48c5459be3__item-selection-indicator,._5c913bce0d8bb0d6__item[data-highlighted]:not([aria-disabled=true]) ._64924ecabf65a5d6__item-prefix,._5c913bce0d8bb0d6__item[data-highlighted]:not([aria-disabled=true]) .fa88c9f1a96a4c5a__item-description{--_gcd-heading-color:currentColor;color:inherit}}}'); 19132 } 19133 var style_default18 = { "positioner": "d61e2d85c0ee0699__positioner", "popup": "_34e81249f419a5a5__popup", "item-selection-indicator": "_42313b48c5459be3__item-selection-indicator", "is-root": "_087a537b24fee6a1__is-root _380b81b8f79fb10f__dropdown-motion", "is-submenu": "_6d3b567f6289bdc2__is-submenu _7f344b94e270e039__dropdown-motion--fade-only", "list": "_33f07ab17005471d__list", "group": "f11085533c0056b0__group", "radio-group": "e05914e1005d7c2e__radio-group", "item": "_5c913bce0d8bb0d6__item", "item-prefix": "_64924ecabf65a5d6__item-prefix", "group-label": "_4a0fd085d76fd23c__group-label", "separator": "bfc11368eadf3b39__separator", "item-content": "af879698ede76757__item-content", "checkbox-selection-icon": "_99c5bd141cbf516f__checkbox-selection-icon", "radio-selection-icon": "_59aa9b3b3a651148__radio-selection-icon", "prefix-icon": "a836378335a4cbf1__prefix-icon", "item-children": "_943a932d9f81c78c__item-children", "item-label": "_5ed41da4abcf8958__item-label", "item-description": "fa88c9f1a96a4c5a__item-description", "item-suffix": "_091406749ed93e6e__item-suffix", "item-shortcut": "_23630f40071a29ff__item-shortcut", "item-trailing": "_06be17a91bf434a0__item-trailing", "submenu-chevron": "b78aec79bf93eba0__submenu-chevron", "external-link-indicator": "_60da3b6f9718cf76__external-link-indicator" }; 19134 var radioCheck = /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(import_primitives36.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(import_primitives36.Circle, { cx: 12, cy: 12, r: 3 }) }); 19135 var RadioItem = (0, import_element40.forwardRef)( 19136 function MenuRadioItem3({ 19137 children, 19138 className, 19139 prefix, 19140 shortcut, 19141 suffix, 19142 "aria-describedby": ariaDescribedBy, 19143 "aria-keyshortcuts": ariaKeyShortcuts, 19144 "aria-label": ariaLabel, 19145 "aria-labelledby": ariaLabelledBy, 19146 ...props 19147 }, ref) { 19148 const { 19149 contentChildren, 19150 contentContextValue, 19151 itemAriaProps, 19152 shortcutDescriptionId 19153 } = useItemContent2(children, { 19154 "aria-describedby": ariaDescribedBy, 19155 "aria-keyshortcuts": ariaKeyShortcuts, 19156 "aria-label": ariaLabel, 19157 "aria-labelledby": ariaLabelledBy, 19158 shortcut 19159 }); 19160 return /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)( 19161 index_parts_exports.RadioItem, 19162 { 19163 ref, 19164 ...itemAriaProps, 19165 className: clsx_default( 19166 global_css_defense_default6.div, 19167 resets_default7["box-sizing"], 19168 style_default18.item, 19169 className 19170 ), 19171 ...props, 19172 children: [ 19173 /* @__PURE__ */ (0, import_jsx_runtime88.jsx)( 19174 index_parts_exports.RadioItemIndicator, 19175 { 19176 keepMounted: true, 19177 className: style_default18["item-selection-indicator"], 19178 children: /* @__PURE__ */ (0, import_jsx_runtime88.jsx)( 19179 Icon, 19180 { 19181 icon: radioCheck, 19182 className: style_default18["radio-selection-icon"], 19183 "aria-hidden": "true" 19184 } 19185 ) 19186 } 19187 ), 19188 /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(MenuItemContentContext.Provider, { value: contentContextValue, children: /* @__PURE__ */ (0, import_jsx_runtime88.jsx)( 19189 ItemContent, 19190 { 19191 prefix, 19192 shortcut, 19193 shortcutDescriptionId, 19194 suffix, 19195 children: contentChildren 19196 } 19197 ) }) 19198 ] 19199 } 19200 ); 19201 } 19202 ); 19203 19204 // packages/ui/build-module/menu/use-iframe-dismissal-bridge.mjs 19205 var import_element41 = __toESM(require_element(), 1); 19206 function getIframeDocument(iframe) { 19207 try { 19208 return iframe.contentDocument; 19209 } catch { 19210 return null; 19211 } 19212 } 19213 function forEachIframe(node, callback) { 19214 if (node.nodeType !== Node.ELEMENT_NODE) { 19215 return; 19216 } 19217 const element = node; 19218 if (element.tagName === "IFRAME") { 19219 callback(element); 19220 } 19221 element.querySelectorAll("iframe").forEach(callback); 19222 } 19223 function isInsideCurrentMenu(event, trigger) { 19224 const target = event.target; 19225 const targetElement = target?.nodeType === Node.ELEMENT_NODE ? target : target?.parentElement; 19226 const popupId = trigger.getAttribute("aria-controls"); 19227 if (!targetElement || !popupId) { 19228 return false; 19229 } 19230 const popup = targetElement.ownerDocument.getElementById(popupId); 19231 if (!popup) { 19232 return false; 19233 } 19234 const rootOwnerId = popup.getAttribute("data-rootownerid"); 19235 if (!rootOwnerId) { 19236 return popup.contains(targetElement); 19237 } 19238 return targetElement.closest("[data-rootownerid]")?.getAttribute("data-rootownerid") === rootOwnerId; 19239 } 19240 function useCloseOnIframePointerDown({ 19241 enabled, 19242 onPointerDown, 19243 ownerDocument: ownerDocument2 19244 }) { 19245 (0, import_element41.useEffect)(() => { 19246 if (!enabled || !ownerDocument2) { 19247 return; 19248 } 19249 const observeDocument = (document2, listenForPointerDown) => { 19250 if (listenForPointerDown) { 19251 document2.addEventListener("pointerdown", onPointerDown, true); 19252 } 19253 const iframeCleanups = /* @__PURE__ */ new Map(); 19254 const addIframe = (iframe) => { 19255 if (iframeCleanups.has(iframe)) { 19256 return; 19257 } 19258 let iframeDocument = null; 19259 let iframeDocumentCleanup; 19260 const updateIframeDocument = () => { 19261 const nextIframeDocument = getIframeDocument(iframe); 19262 if (nextIframeDocument === iframeDocument) { 19263 return; 19264 } 19265 iframeDocumentCleanup?.(); 19266 iframeDocument = nextIframeDocument; 19267 iframeDocumentCleanup = iframeDocument ? observeDocument(iframeDocument, true) : void 0; 19268 }; 19269 iframe.addEventListener("load", updateIframeDocument); 19270 updateIframeDocument(); 19271 iframeCleanups.set(iframe, () => { 19272 iframe.removeEventListener("load", updateIframeDocument); 19273 iframeDocumentCleanup?.(); 19274 }); 19275 }; 19276 const removeIframe = (iframe) => { 19277 iframeCleanups.get(iframe)?.(); 19278 iframeCleanups.delete(iframe); 19279 }; 19280 document2.querySelectorAll("iframe").forEach(addIframe); 19281 const MutationObserverConstructor = document2.defaultView?.MutationObserver; 19282 const observer = MutationObserverConstructor ? new MutationObserverConstructor((records) => { 19283 records.forEach((record) => { 19284 record.removedNodes.forEach( 19285 (node) => forEachIframe(node, removeIframe) 19286 ); 19287 record.addedNodes.forEach( 19288 (node) => forEachIframe(node, addIframe) 19289 ); 19290 }); 19291 }) : null; 19292 observer?.observe(document2.documentElement, { 19293 childList: true, 19294 subtree: true 19295 }); 19296 return () => { 19297 observer?.disconnect(); 19298 iframeCleanups.forEach((cleanup) => cleanup()); 19299 if (listenForPointerDown) { 19300 document2.removeEventListener( 19301 "pointerdown", 19302 onPointerDown, 19303 true 19304 ); 19305 } 19306 }; 19307 }; 19308 return observeDocument(ownerDocument2, false); 19309 }, [enabled, onPointerDown, ownerDocument2]); 19310 } 19311 function useIframeDismissalBridge({ 19312 actionsRef, 19313 defaultOpen, 19314 disabled: disabled2, 19315 modal, 19316 onOpenChange, 19317 open: openProp 19318 }) { 19319 const fallbackActionsRef = (0, import_element41.useRef)(null); 19320 const resolvedActionsRef = actionsRef ?? fallbackActionsRef; 19321 const [uncontrolledOpen, setUncontrolledOpen] = (0, import_element41.useState)( 19322 defaultOpen ?? false 19323 ); 19324 const [trigger, setTrigger] = (0, import_element41.useState)(null); 19325 const open2 = openProp ?? uncontrolledOpen; 19326 const handleIframePointerDown = (0, import_element41.useCallback)( 19327 (event) => { 19328 if (trigger && !isInsideCurrentMenu(event, trigger)) { 19329 resolvedActionsRef.current?.close(); 19330 } 19331 }, 19332 [resolvedActionsRef, trigger] 19333 ); 19334 useCloseOnIframePointerDown({ 19335 enabled: open2 && modal === false && !disabled2 && trigger !== null, 19336 onPointerDown: handleIframePointerDown, 19337 ownerDocument: trigger?.ownerDocument ?? null 19338 }); 19339 const handleOpenChange = (nextOpen, eventDetails) => { 19340 onOpenChange(nextOpen, eventDetails); 19341 if (eventDetails.isCanceled) { 19342 return; 19343 } 19344 setUncontrolledOpen(nextOpen); 19345 setTrigger(nextOpen ? eventDetails.trigger ?? null : null); 19346 }; 19347 return { 19348 actionsRef: resolvedActionsRef, 19349 onOpenChange: handleOpenChange 19350 }; 19351 } 19352 19353 // packages/ui/build-module/menu/root.mjs 19354 var import_jsx_runtime89 = __toESM(require_jsx_runtime(), 1); 19355 function Root2(props) { 19356 const { onOpenChange } = props; 19357 const handleOpenChange = (nextOpen, eventDetails) => { 19358 const trigger = eventDetails.trigger; 19359 const TriggerElement = trigger?.ownerDocument.defaultView?.HTMLElement; 19360 const EventTargetElement = trigger?.ownerDocument.defaultView?.Element; 19361 const activeElementBeforeOpenChange = trigger?.ownerDocument.activeElement; 19362 const eventTarget = eventDetails.event.target; 19363 const menuElement = EventTargetElement && eventTarget instanceof EventTargetElement ? eventTarget.closest('[role="menu"]') : null; 19364 onOpenChange?.(nextOpen, eventDetails); 19365 if (!nextOpen && eventDetails.reason === "item-press" && !eventDetails.isCanceled && TriggerElement && trigger instanceof TriggerElement && menuElement?.contains(activeElementBeforeOpenChange ?? null) && trigger.ownerDocument.activeElement === activeElementBeforeOpenChange) { 19366 trigger.focus(); 19367 } 19368 }; 19369 const iframeDismissalProps = useIframeDismissalBridge({ 19370 actionsRef: props.actionsRef, 19371 defaultOpen: props.defaultOpen, 19372 disabled: props.disabled, 19373 modal: props.modal, 19374 onOpenChange: handleOpenChange, 19375 open: props.open 19376 }); 19377 return /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(DirectionProvider3, { children: /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(MenuContext.Provider, { value: { isSubmenu: false }, children: /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(index_parts_exports.Root, { ...props, ...iframeDismissalProps }) }) }); 19378 } 19379 19380 // packages/ui/build-module/menu/separator.mjs 19381 var import_element42 = __toESM(require_element(), 1); 19382 var import_jsx_runtime90 = __toESM(require_jsx_runtime(), 1); 19383 var STYLE_HASH_ATTRIBUTE20 = "data-wp-hash"; 19384 function getRuntime20() { 19385 const globalScope = globalThis; 19386 if (globalScope.__wpStyleRuntime) { 19387 return globalScope.__wpStyleRuntime; 19388 } 19389 globalScope.__wpStyleRuntime = { 19390 documents: /* @__PURE__ */ new Map(), 19391 styles: /* @__PURE__ */ new Map(), 19392 injectedStyles: /* @__PURE__ */ new WeakMap() 19393 }; 19394 if (typeof document !== "undefined") { 19395 registerDocument20(document); 19396 } 19397 return globalScope.__wpStyleRuntime; 19398 } 19399 function documentContainsStyleHash20(targetDocument, hash) { 19400 if (!targetDocument.head) { 19401 return false; 19402 } 19403 for (const style of targetDocument.head.querySelectorAll( 19404 `style[$STYLE_HASH_ATTRIBUTE20}]` 19405 )) { 19406 if (style.getAttribute(STYLE_HASH_ATTRIBUTE20) === hash) { 19407 return true; 19408 } 19409 } 19410 return false; 19411 } 19412 function injectStyle20(targetDocument, hash, css) { 19413 if (!targetDocument.head) { 19414 return; 19415 } 19416 const runtime = getRuntime20(); 19417 let injectedStyles = runtime.injectedStyles.get(targetDocument); 19418 if (!injectedStyles) { 19419 injectedStyles = /* @__PURE__ */ new Set(); 19420 runtime.injectedStyles.set(targetDocument, injectedStyles); 19421 } 19422 if (injectedStyles.has(hash)) { 19423 return; 19424 } 19425 if (documentContainsStyleHash20(targetDocument, hash)) { 19426 injectedStyles.add(hash); 19427 return; 19428 } 19429 const style = targetDocument.createElement("style"); 19430 style.setAttribute(STYLE_HASH_ATTRIBUTE20, hash); 19431 style.appendChild(targetDocument.createTextNode(css)); 19432 targetDocument.head.appendChild(style); 19433 injectedStyles.add(hash); 19434 } 19435 function registerDocument20(targetDocument) { 19436 const runtime = getRuntime20(); 19437 runtime.documents.set( 19438 targetDocument, 19439 (runtime.documents.get(targetDocument) ?? 0) + 1 19440 ); 19441 for (const [hash, css] of runtime.styles) { 19442 injectStyle20(targetDocument, hash, css); 19443 } 19444 return () => { 19445 const count = runtime.documents.get(targetDocument); 19446 if (count === void 0) { 19447 return; 19448 } 19449 if (count <= 1) { 19450 runtime.documents.delete(targetDocument); 19451 return; 19452 } 19453 runtime.documents.set(targetDocument, count - 1); 19454 }; 19455 } 19456 function registerStyle20(hash, css) { 19457 const runtime = getRuntime20(); 19458 runtime.styles.set(hash, css); 19459 for (const targetDocument of runtime.documents.keys()) { 19460 injectStyle20(targetDocument, hash, css); 19461 } 19462 } 19463 if (typeof process === "undefined" || true) { 19464 registerStyle20("3be1f8dffe", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._380b81b8f79fb10f__dropdown-motion,._7f344b94e270e039__dropdown-motion--fade-only{--wp-ui-dropdown-slide-distance:4px;--wp-ui-dropdown-slide-duration:var(--wpds-motion-duration-md,200ms);--wp-ui-dropdown-slide-easing:var(--wpds-motion-easing-expressive,cubic-bezier(0.25,0,0,1));--wp-ui-dropdown-fade-duration:var(--wpds-motion-duration-sm,100ms);--wp-ui-dropdown-fade-easing:linear;@media not (prefers-reduced-motion){transition-duration:var(--wp-ui-dropdown-slide-duration),var(--wp-ui-dropdown-fade-duration);transition-property:transform,opacity;transition-timing-function:var(--wp-ui-dropdown-slide-easing),var(--wp-ui-dropdown-fade-easing);will-change:transform,opacity}opacity:1;&[data-instant]{transition:none}&[data-ending-style],&[data-starting-style]{opacity:0}}._380b81b8f79fb10f__dropdown-motion{transform:translate(0);&[data-side=bottom][data-ending-style],&[data-side=bottom][data-starting-style]{transform:translateY(calc(var(--wp-ui-dropdown-slide-distance)*-1))}&[data-side=top][data-ending-style],&[data-side=top][data-starting-style]{transform:translateY(var(--wp-ui-dropdown-slide-distance))}&[data-side=left][data-ending-style],&[data-side=left][data-starting-style]{transform:translateX(var(--wp-ui-dropdown-slide-distance))}&[data-side=right][data-ending-style],&[data-side=right][data-starting-style]{transform:translateX(calc(var(--wp-ui-dropdown-slide-distance)*-1))}&[data-side=inline-start][data-ending-style],&[data-side=inline-start][data-starting-style]{transform:translateX(var(--wp-ui-dropdown-slide-distance))}&[data-side=inline-end][data-ending-style],&[data-side=inline-end][data-starting-style]{transform:translateX(calc(var(--wp-ui-dropdown-slide-distance)*-1))}&:dir(rtl)[data-side=inline-start][data-ending-style],&:dir(rtl)[data-side=inline-start][data-starting-style]{transform:translateX(calc(var(--wp-ui-dropdown-slide-distance)*-1))}&:dir(rtl)[data-side=inline-end][data-ending-style],&:dir(rtl)[data-side=inline-end][data-starting-style]{transform:translateX(var(--wp-ui-dropdown-slide-distance))}}}}@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{.d61e2d85c0ee0699__positioner{z-index:var(--wp-ui-menu-z-index,initial)}._34e81249f419a5a5__popup{--wp-ui-menu-popup-padding:var(--wpds-dimension-padding-xs,4px);--wp-ui-menu-min-width:160px;--wp-ui-menu-max-width:var(--wpds-dimension-surface-width-md,400px);--wp-ui-menu-item-padding-inline:var(--wpds-dimension-padding-md,12px);--wp-ui-menu-group-head-padding-inline:var(--wpds-dimension-padding-md,12px);--wp-ui-menu-selection-indicator-track-size:0px;--wp-ui-menu-selection-indicator-size:var(--wpds-dimension-size-sm,24px);--wp-ui-menu-selection-indicator-gap:0px;--_wp-ui-menu-elevation-md:0px 2px 3px 0px #0000000d,0px 4px 5px 0px #0000000a,0px 12px 12px 0px #00000008,0px 16px 16px 0px #00000005;background-color:var(--wpds-color-background-surface-neutral-strong,#fff);border:var(--wpds-border-width-xs,1px) solid var(--wpds-color-stroke-surface-neutral,#dbdbdb);border-radius:var(--wpds-border-radius-md,4px);box-shadow:var(--_wp-ui-menu-elevation-md);max-height:min(var(--available-height),480px,60dvh);max-width:min(var(--available-width),var(--wp-ui-menu-max-width));min-width:min(var(--available-width),var(--wp-ui-menu-min-width));outline:none;overflow-block:auto;overscroll-behavior:none;padding:var(--wp-ui-menu-popup-padding);scroll-padding:var(--wp-ui-menu-popup-padding);&:has(._42313b48c5459be3__item-selection-indicator){--wp-ui-menu-item-padding-inline:var(--wpds-dimension-padding-sm,8px);--wp-ui-menu-selection-indicator-track-size:var(--wpds-dimension-size-2xs,16px);--wp-ui-menu-selection-indicator-gap:var(--wpds-dimension-gap-sm,8px)}}._33f07ab17005471d__list{--_wp-ui-menu-item-label-line-height:var(--wpds-typography-line-height-sm,20px);color:var(--wpds-color-foreground-interactive-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-md,13px);line-height:var(--_wp-ui-menu-item-label-line-height)}._33f07ab17005471d__list,.e05914e1005d7c2e__radio-group,.f11085533c0056b0__group{--wp-ui-menu-group-prefix-gap:0px;display:grid;grid-template-columns:[item-padding-start] var(--wp-ui-menu-item-padding-inline) [selection-start] var(--wp-ui-menu-selection-indicator-track-size) [selection-end] var(--wp-ui-menu-selection-indicator-gap) [prefix-start] max-content [prefix-end] var(--wp-ui-menu-group-prefix-gap) [content-start] minmax(0,1fr) [content-end] var(--wp-ui-menu-item-padding-inline) [item-padding-end];min-width:0}.e05914e1005d7c2e__radio-group,.f11085533c0056b0__group{grid-column:1/-1}._33f07ab17005471d__list:has(>._5c913bce0d8bb0d6__item>._64924ecabf65a5d6__item-prefix),.e05914e1005d7c2e__radio-group:has(>._5c913bce0d8bb0d6__item>._64924ecabf65a5d6__item-prefix),.f11085533c0056b0__group:has(>._5c913bce0d8bb0d6__item>._64924ecabf65a5d6__item-prefix){--wp-ui-menu-group-prefix-gap:var(--wpds-dimension-gap-xs,4px)}._4a0fd085d76fd23c__group-label{align-items:center;color:var(--wpds-color-foreground-content-neutral-weak,#707070);display:flex;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-xs,11px);font-weight:var(--wpds-typography-font-weight-emphasis,600);grid-column:1/-1;line-height:var(--wpds-typography-line-height-xs,16px);min-height:var(--wpds-dimension-size-md,32px);padding-block:var(--wpds-dimension-padding-xs,4px);padding-inline:var(--wp-ui-menu-group-head-padding-inline);text-transform:uppercase}.bfc11368eadf3b39__separator{background-color:var(--wpds-color-stroke-surface-neutral-weak,#f0f0f0);grid-column:1/-1;height:var(--wpds-border-width-xs,1px);margin-block:var(--wpds-dimension-gap-xs,4px);margin-inline:var(--wp-ui-menu-group-head-padding-inline);@media (forced-colors:active){background-color:CanvasText}}._5c913bce0d8bb0d6__item{--wp-ui-menu-item-height:var(--wpds-dimension-size-md,32px);--wp-ui-menu-item-padding-block:var(--wpds-dimension-padding-xs,4px);--_gcd-a-border-radius:var(--wpds-border-radius-sm,2px);align-content:center;align-items:start;border-radius:var(--wpds-border-radius-sm,2px);display:grid;gap:0;grid-column:1/-1;grid-template-columns:[item-padding-start] var(--wp-ui-menu-item-padding-inline) [selection-start] var(--wp-ui-menu-selection-indicator-track-size) [selection-end] var(--wp-ui-menu-selection-indicator-gap) [prefix-start] max-content [prefix-end] var(--wp-ui-menu-group-prefix-gap) [content-start] minmax(0,1fr) [content-end] var(--wp-ui-menu-item-padding-inline) [item-padding-end];justify-content:stretch;min-height:var(--wp-ui-menu-item-height);min-width:0;padding-block:var(--wp-ui-menu-item-padding-block);scroll-margin:var(--wp-ui-menu-popup-padding);text-decoration:none;user-select:none;&:not([data-disabled]){cursor:var(--wpds-cursor-control,pointer)}&[href]{cursor:pointer}@supports (grid-template-columns:subgrid){grid-template-columns:subgrid}&[data-highlighted]:not([aria-disabled=true]){background-color:var(--wpds-color-background-interactive-brand-weak-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 12%,#fff));color:var(--wpds-color-foreground-interactive-neutral,#1e1e1e);outline:none;@media (forced-colors:active){--_gcd-div-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid Highlight;--_gcd-a-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid Highlight}}&[aria-disabled=true]{background-color:var(--wpds-color-background-interactive-brand-weak-disabled,#0000);color:var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d);@media (forced-colors:active){color:GrayText}}}._42313b48c5459be3__item-selection-indicator,._64924ecabf65a5d6__item-prefix,.af879698ede76757__item-content{grid-row:1}._42313b48c5459be3__item-selection-indicator{align-items:center;color:var(--wpds-color-foreground-content-neutral-weak,#707070);display:flex;grid-column:selection-start/selection-end;height:var(--_wp-ui-menu-item-label-line-height);justify-content:center;justify-self:center;pointer-events:none;width:var(--wp-ui-menu-selection-indicator-size);&[data-unchecked]{opacity:0}}._99c5bd141cbf516f__checkbox-selection-icon{translate:0 1px}._59aa9b3b3a651148__radio-selection-icon{fill:currentColor;height:var(--wpds-dimension-size-xs,20px);width:var(--wpds-dimension-size-xs,20px)}._64924ecabf65a5d6__item-prefix{align-items:center;color:var(--wpds-color-foreground-content-neutral-weak,#707070);display:flex;gap:var(--wpds-dimension-gap-xs,4px);grid-column:prefix-start/prefix-end;justify-content:center;min-width:0}.a836378335a4cbf1__prefix-icon{align-self:flex-start;flex-shrink:0;margin-block-start:calc((var(--_wp-ui-menu-item-label-line-height) - var(--_wp-ui-menu-prefix-icon-size))/2)}.af879698ede76757__item-content{align-items:center;align-self:stretch;box-sizing:border-box;display:grid;grid-column:content-start/content-end;grid-template-columns:[label-start] minmax(0,1fr) [label-end suffix-start] auto [suffix-end shortcut-start] auto [shortcut-end trailing-start] auto [trailing-end];min-width:0;pointer-events:none}._943a932d9f81c78c__item-children{display:inline-flex;flex-direction:column;gap:2px;grid-column:label-start/label-end;min-width:0}._5ed41da4abcf8958__item-label{--_gcd-heading-color:currentColor;--_gcd-p-line-height:var(--_wp-ui-menu-item-label-line-height);color:inherit;line-height:var(--_wp-ui-menu-item-label-line-height);min-width:0;overflow-wrap:anywhere}.fa88c9f1a96a4c5a__item-description{--_gcd-heading-color:var(--wpds-color-foreground-content-neutral-weak,#707070);color:var(--wpds-color-foreground-content-neutral-weak,#707070);overflow-wrap:anywhere;padding-block-end:var(--wpds-dimension-padding-xs,4px)}._091406749ed93e6e__item-suffix{align-items:center;display:flex;gap:var(--wpds-dimension-gap-xs,4px);grid-column:suffix-start/suffix-end}._091406749ed93e6e__item-suffix,._23630f40071a29ff__item-shortcut{color:var(--wpds-color-foreground-content-neutral-weak,#707070);margin-inline-start:var(--wpds-dimension-gap-md,12px)}._23630f40071a29ff__item-shortcut{grid-column:shortcut-start/shortcut-end}._06be17a91bf434a0__item-trailing{align-items:center;color:var(--wpds-color-foreground-content-neutral-weak,#707070);display:flex;grid-column:trailing-start/trailing-end;margin-inline-start:var(--wpds-dimension-gap-md,12px)}._943a932d9f81c78c__item-children+:is(._091406749ed93e6e__item-suffix,._23630f40071a29ff__item-shortcut,._06be17a91bf434a0__item-trailing){margin-inline-start:var(--wpds-dimension-gap-xl,24px)}._23630f40071a29ff__item-shortcut+._06be17a91bf434a0__item-trailing{margin-inline-start:var(--wpds-dimension-gap-xs,4px)}.b78aec79bf93eba0__submenu-chevron{margin-inline-end:calc(var(--wpds-dimension-gap-sm, 8px)*-1)}.b78aec79bf93eba0__submenu-chevron:dir(rtl){transform:rotate(180deg)}._60da3b6f9718cf76__external-link-indicator{display:inline-block;font-weight:var(--wpds-typography-font-weight-default,400);line-height:1;margin-inline-start:var(--wpds-dimension-gap-xs,4px);text-decoration:none}._60da3b6f9718cf76__external-link-indicator:after{content:"\\2197"}._60da3b6f9718cf76__external-link-indicator:dir(rtl):after{content:"\\2196"}._5c913bce0d8bb0d6__item[aria-disabled=true] ._06be17a91bf434a0__item-trailing,._5c913bce0d8bb0d6__item[aria-disabled=true] ._091406749ed93e6e__item-suffix,._5c913bce0d8bb0d6__item[aria-disabled=true] ._23630f40071a29ff__item-shortcut,._5c913bce0d8bb0d6__item[aria-disabled=true] ._42313b48c5459be3__item-selection-indicator,._5c913bce0d8bb0d6__item[aria-disabled=true] ._64924ecabf65a5d6__item-prefix,._5c913bce0d8bb0d6__item[aria-disabled=true] .fa88c9f1a96a4c5a__item-description,._5c913bce0d8bb0d6__item[data-highlighted]:not([aria-disabled=true]) ._06be17a91bf434a0__item-trailing,._5c913bce0d8bb0d6__item[data-highlighted]:not([aria-disabled=true]) ._091406749ed93e6e__item-suffix,._5c913bce0d8bb0d6__item[data-highlighted]:not([aria-disabled=true]) ._23630f40071a29ff__item-shortcut,._5c913bce0d8bb0d6__item[data-highlighted]:not([aria-disabled=true]) ._42313b48c5459be3__item-selection-indicator,._5c913bce0d8bb0d6__item[data-highlighted]:not([aria-disabled=true]) ._64924ecabf65a5d6__item-prefix,._5c913bce0d8bb0d6__item[data-highlighted]:not([aria-disabled=true]) .fa88c9f1a96a4c5a__item-description{--_gcd-heading-color:currentColor;color:inherit}}}'); 19465 } 19466 var style_default19 = { "positioner": "d61e2d85c0ee0699__positioner", "popup": "_34e81249f419a5a5__popup", "item-selection-indicator": "_42313b48c5459be3__item-selection-indicator", "is-root": "_087a537b24fee6a1__is-root _380b81b8f79fb10f__dropdown-motion", "is-submenu": "_6d3b567f6289bdc2__is-submenu _7f344b94e270e039__dropdown-motion--fade-only", "list": "_33f07ab17005471d__list", "group": "f11085533c0056b0__group", "radio-group": "e05914e1005d7c2e__radio-group", "item": "_5c913bce0d8bb0d6__item", "item-prefix": "_64924ecabf65a5d6__item-prefix", "group-label": "_4a0fd085d76fd23c__group-label", "separator": "bfc11368eadf3b39__separator", "item-content": "af879698ede76757__item-content", "checkbox-selection-icon": "_99c5bd141cbf516f__checkbox-selection-icon", "radio-selection-icon": "_59aa9b3b3a651148__radio-selection-icon", "prefix-icon": "a836378335a4cbf1__prefix-icon", "item-children": "_943a932d9f81c78c__item-children", "item-label": "_5ed41da4abcf8958__item-label", "item-description": "fa88c9f1a96a4c5a__item-description", "item-suffix": "_091406749ed93e6e__item-suffix", "item-shortcut": "_23630f40071a29ff__item-shortcut", "item-trailing": "_06be17a91bf434a0__item-trailing", "submenu-chevron": "b78aec79bf93eba0__submenu-chevron", "external-link-indicator": "_60da3b6f9718cf76__external-link-indicator" }; 19467 var Separator2 = (0, import_element42.forwardRef)( 19468 function MenuSeparator({ className, ...props }, ref) { 19469 return /* @__PURE__ */ (0, import_jsx_runtime90.jsx)( 19470 index_parts_exports.Separator, 19471 { 19472 ref, 19473 className: clsx_default(style_default19.separator, className), 19474 ...props 19475 } 19476 ); 19477 } 19478 ); 19479 19480 // packages/ui/build-module/menu/submenu-root.mjs 19481 var import_jsx_runtime91 = __toESM(require_jsx_runtime(), 1); 19482 function SubmenuRoot(props) { 19483 return /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(MenuContext.Provider, { value: { isSubmenu: true }, children: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(index_parts_exports.SubmenuRoot, { ...props }) }); 19484 } 19485 19486 // packages/ui/build-module/menu/submenu-trigger.mjs 19487 var import_element43 = __toESM(require_element(), 1); 19488 var import_jsx_runtime92 = __toESM(require_jsx_runtime(), 1); 19489 var STYLE_HASH_ATTRIBUTE21 = "data-wp-hash"; 19490 function getRuntime21() { 19491 const globalScope = globalThis; 19492 if (globalScope.__wpStyleRuntime) { 19493 return globalScope.__wpStyleRuntime; 19494 } 19495 globalScope.__wpStyleRuntime = { 19496 documents: /* @__PURE__ */ new Map(), 19497 styles: /* @__PURE__ */ new Map(), 19498 injectedStyles: /* @__PURE__ */ new WeakMap() 19499 }; 19500 if (typeof document !== "undefined") { 19501 registerDocument21(document); 19502 } 19503 return globalScope.__wpStyleRuntime; 19504 } 19505 function documentContainsStyleHash21(targetDocument, hash) { 19506 if (!targetDocument.head) { 19507 return false; 19508 } 19509 for (const style of targetDocument.head.querySelectorAll( 19510 `style[$STYLE_HASH_ATTRIBUTE21}]` 19511 )) { 19512 if (style.getAttribute(STYLE_HASH_ATTRIBUTE21) === hash) { 19513 return true; 19514 } 19515 } 19516 return false; 19517 } 19518 function injectStyle21(targetDocument, hash, css) { 19519 if (!targetDocument.head) { 19520 return; 19521 } 19522 const runtime = getRuntime21(); 19523 let injectedStyles = runtime.injectedStyles.get(targetDocument); 19524 if (!injectedStyles) { 19525 injectedStyles = /* @__PURE__ */ new Set(); 19526 runtime.injectedStyles.set(targetDocument, injectedStyles); 19527 } 19528 if (injectedStyles.has(hash)) { 19529 return; 19530 } 19531 if (documentContainsStyleHash21(targetDocument, hash)) { 19532 injectedStyles.add(hash); 19533 return; 19534 } 19535 const style = targetDocument.createElement("style"); 19536 style.setAttribute(STYLE_HASH_ATTRIBUTE21, hash); 19537 style.appendChild(targetDocument.createTextNode(css)); 19538 targetDocument.head.appendChild(style); 19539 injectedStyles.add(hash); 19540 } 19541 function registerDocument21(targetDocument) { 19542 const runtime = getRuntime21(); 19543 runtime.documents.set( 19544 targetDocument, 19545 (runtime.documents.get(targetDocument) ?? 0) + 1 19546 ); 19547 for (const [hash, css] of runtime.styles) { 19548 injectStyle21(targetDocument, hash, css); 19549 } 19550 return () => { 19551 const count = runtime.documents.get(targetDocument); 19552 if (count === void 0) { 19553 return; 19554 } 19555 if (count <= 1) { 19556 runtime.documents.delete(targetDocument); 19557 return; 19558 } 19559 runtime.documents.set(targetDocument, count - 1); 19560 }; 19561 } 19562 function registerStyle21(hash, css) { 19563 const runtime = getRuntime21(); 19564 runtime.styles.set(hash, css); 19565 for (const targetDocument of runtime.documents.keys()) { 19566 injectStyle21(targetDocument, hash, css); 19567 } 19568 } 19569 if (typeof process === "undefined" || true) { 19570 registerStyle21("e8e31009f5", "._6defc79820e382c6__button{box-sizing:var(--_gcd-button-box-sizing,border-box);font-family:var(--_gcd-button-font-family,inherit);font-size:var(--_gcd-button-font-size,inherit);font-weight:var(--_gcd-button-font-weight,inherit)}.d2cff2e5dea83bd1__input{box-sizing:var(--_gcd-input-box-sizing,border-box);font-family:var(--_gcd-input-font-family,inherit);font-size:var(--_gcd-input-font-size,inherit);font-weight:var(--_gcd-input-font-weight,inherit);margin:var(--_gcd-input-margin,0);&::placeholder{color:var(--_gcd-input-placeholder-color,var(--wpds-color-foreground-interactive-neutral-weak,#707070))}&:is(textarea,[type=text],[type=password],[type=color],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){background-color:var(--_gcd-input-background-color,transparent);border:var(--_gcd-input-border,none);border-radius:var(--_gcd-input-border-radius,0);box-shadow:var(--_gcd-input-box-shadow,0 0 0 transparent);color:var(--_gcd-input-color,var(--wpds-color-foreground-interactive-neutral,#1e1e1e));&:focus{border-color:var(--_gcd-input-border-color-focus,var(--wp-admin-theme-color));box-shadow:var(--_gcd-input-box-shadow-focus,none);outline:var(--_gcd-input-outline-focus,none)}&:disabled{background:var(--_gcd-input-background-disabled,transparent);border-color:var(--_gcd-input-border-color-disabled,transparent);box-shadow:var(--_gcd-input-box-shadow-disabled,none);color:var(--_gcd-input-color-disabled,var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d))}}&:is(textarea,[type=text],[type=password],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){line-height:var(--_gcd-input-line-height,inherit);min-height:var(--_gcd-input-min-height,auto);padding:var(--_gcd-input-padding,0)}}._547d86373d02e108__textarea{box-sizing:var(--_gcd-textarea-box-sizing,border-box);overflow:var(--_gcd-textarea-overflow,auto);resize:var(--_gcd-textarea-resize,block)}._8c15fd0ed9f28ba4__div{outline:var(--_gcd-div-outline,0 solid transparent)}p._43cec3e1eec1066d__p{font-size:var(--_gcd-p-font-size,13px);line-height:var(--_gcd-p-line-height,1.5);margin:var(--_gcd-p-margin,0)}:is(h1,h2,h3,h4,h5,h6).e97669c6d9a38497__heading{color:var(--_gcd-heading-color,var(--wpds-color-foreground-content-neutral,#1e1e1e));font-size:var(--_gcd-heading-font-size,inherit);font-weight:var(--_gcd-heading-font-weight,var(--wpds-typography-font-weight-emphasis,600));margin:var(--_gcd-heading-margin,0)}._2c0831b0499dbd6e__a,._2c0831b0499dbd6e__a:is(:hover,:focus,:active){border-radius:var(--_gcd-a-border-radius,0);box-shadow:var(--_gcd-a-box-shadow,none);color:var(--_gcd-a-color,inherit);outline:var(--_gcd-a-outline,0 solid transparent);transition:var(--_gcd-a-transition,none)}.c59a0ebebd71fa4a__ol{list-style:var(--_gcd-ol-list-style,none);margin:var(--_gcd-ol-margin,0);padding-block:var(--_gcd-ol-padding-block,0);padding-inline:var(--_gcd-ol-padding-inline,0)}._46b5cb0c8e24e8c9__li{margin:var(--_gcd-li-margin,0)}"); 19571 } 19572 var global_css_defense_default7 = { "button": "_6defc79820e382c6__button", "input": "d2cff2e5dea83bd1__input", "textarea": "_547d86373d02e108__textarea", "div": "_8c15fd0ed9f28ba4__div", "p": "_43cec3e1eec1066d__p", "heading": "e97669c6d9a38497__heading", "a": "_2c0831b0499dbd6e__a", "ol": "c59a0ebebd71fa4a__ol", "li": "_46b5cb0c8e24e8c9__li" }; 19573 if (typeof process === "undefined" || true) { 19574 registerStyle21("10f3806643", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._336cd3e4e743482f__box-sizing{box-sizing:border-box;*,:after,:before{box-sizing:inherit}}}}"); 19575 } 19576 var resets_default8 = { "box-sizing": "_336cd3e4e743482f__box-sizing" }; 19577 if (typeof process === "undefined" || true) { 19578 registerStyle21("3be1f8dffe", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._380b81b8f79fb10f__dropdown-motion,._7f344b94e270e039__dropdown-motion--fade-only{--wp-ui-dropdown-slide-distance:4px;--wp-ui-dropdown-slide-duration:var(--wpds-motion-duration-md,200ms);--wp-ui-dropdown-slide-easing:var(--wpds-motion-easing-expressive,cubic-bezier(0.25,0,0,1));--wp-ui-dropdown-fade-duration:var(--wpds-motion-duration-sm,100ms);--wp-ui-dropdown-fade-easing:linear;@media not (prefers-reduced-motion){transition-duration:var(--wp-ui-dropdown-slide-duration),var(--wp-ui-dropdown-fade-duration);transition-property:transform,opacity;transition-timing-function:var(--wp-ui-dropdown-slide-easing),var(--wp-ui-dropdown-fade-easing);will-change:transform,opacity}opacity:1;&[data-instant]{transition:none}&[data-ending-style],&[data-starting-style]{opacity:0}}._380b81b8f79fb10f__dropdown-motion{transform:translate(0);&[data-side=bottom][data-ending-style],&[data-side=bottom][data-starting-style]{transform:translateY(calc(var(--wp-ui-dropdown-slide-distance)*-1))}&[data-side=top][data-ending-style],&[data-side=top][data-starting-style]{transform:translateY(var(--wp-ui-dropdown-slide-distance))}&[data-side=left][data-ending-style],&[data-side=left][data-starting-style]{transform:translateX(var(--wp-ui-dropdown-slide-distance))}&[data-side=right][data-ending-style],&[data-side=right][data-starting-style]{transform:translateX(calc(var(--wp-ui-dropdown-slide-distance)*-1))}&[data-side=inline-start][data-ending-style],&[data-side=inline-start][data-starting-style]{transform:translateX(var(--wp-ui-dropdown-slide-distance))}&[data-side=inline-end][data-ending-style],&[data-side=inline-end][data-starting-style]{transform:translateX(calc(var(--wp-ui-dropdown-slide-distance)*-1))}&:dir(rtl)[data-side=inline-start][data-ending-style],&:dir(rtl)[data-side=inline-start][data-starting-style]{transform:translateX(calc(var(--wp-ui-dropdown-slide-distance)*-1))}&:dir(rtl)[data-side=inline-end][data-ending-style],&:dir(rtl)[data-side=inline-end][data-starting-style]{transform:translateX(var(--wp-ui-dropdown-slide-distance))}}}}@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{.d61e2d85c0ee0699__positioner{z-index:var(--wp-ui-menu-z-index,initial)}._34e81249f419a5a5__popup{--wp-ui-menu-popup-padding:var(--wpds-dimension-padding-xs,4px);--wp-ui-menu-min-width:160px;--wp-ui-menu-max-width:var(--wpds-dimension-surface-width-md,400px);--wp-ui-menu-item-padding-inline:var(--wpds-dimension-padding-md,12px);--wp-ui-menu-group-head-padding-inline:var(--wpds-dimension-padding-md,12px);--wp-ui-menu-selection-indicator-track-size:0px;--wp-ui-menu-selection-indicator-size:var(--wpds-dimension-size-sm,24px);--wp-ui-menu-selection-indicator-gap:0px;--_wp-ui-menu-elevation-md:0px 2px 3px 0px #0000000d,0px 4px 5px 0px #0000000a,0px 12px 12px 0px #00000008,0px 16px 16px 0px #00000005;background-color:var(--wpds-color-background-surface-neutral-strong,#fff);border:var(--wpds-border-width-xs,1px) solid var(--wpds-color-stroke-surface-neutral,#dbdbdb);border-radius:var(--wpds-border-radius-md,4px);box-shadow:var(--_wp-ui-menu-elevation-md);max-height:min(var(--available-height),480px,60dvh);max-width:min(var(--available-width),var(--wp-ui-menu-max-width));min-width:min(var(--available-width),var(--wp-ui-menu-min-width));outline:none;overflow-block:auto;overscroll-behavior:none;padding:var(--wp-ui-menu-popup-padding);scroll-padding:var(--wp-ui-menu-popup-padding);&:has(._42313b48c5459be3__item-selection-indicator){--wp-ui-menu-item-padding-inline:var(--wpds-dimension-padding-sm,8px);--wp-ui-menu-selection-indicator-track-size:var(--wpds-dimension-size-2xs,16px);--wp-ui-menu-selection-indicator-gap:var(--wpds-dimension-gap-sm,8px)}}._33f07ab17005471d__list{--_wp-ui-menu-item-label-line-height:var(--wpds-typography-line-height-sm,20px);color:var(--wpds-color-foreground-interactive-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-md,13px);line-height:var(--_wp-ui-menu-item-label-line-height)}._33f07ab17005471d__list,.e05914e1005d7c2e__radio-group,.f11085533c0056b0__group{--wp-ui-menu-group-prefix-gap:0px;display:grid;grid-template-columns:[item-padding-start] var(--wp-ui-menu-item-padding-inline) [selection-start] var(--wp-ui-menu-selection-indicator-track-size) [selection-end] var(--wp-ui-menu-selection-indicator-gap) [prefix-start] max-content [prefix-end] var(--wp-ui-menu-group-prefix-gap) [content-start] minmax(0,1fr) [content-end] var(--wp-ui-menu-item-padding-inline) [item-padding-end];min-width:0}.e05914e1005d7c2e__radio-group,.f11085533c0056b0__group{grid-column:1/-1}._33f07ab17005471d__list:has(>._5c913bce0d8bb0d6__item>._64924ecabf65a5d6__item-prefix),.e05914e1005d7c2e__radio-group:has(>._5c913bce0d8bb0d6__item>._64924ecabf65a5d6__item-prefix),.f11085533c0056b0__group:has(>._5c913bce0d8bb0d6__item>._64924ecabf65a5d6__item-prefix){--wp-ui-menu-group-prefix-gap:var(--wpds-dimension-gap-xs,4px)}._4a0fd085d76fd23c__group-label{align-items:center;color:var(--wpds-color-foreground-content-neutral-weak,#707070);display:flex;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-xs,11px);font-weight:var(--wpds-typography-font-weight-emphasis,600);grid-column:1/-1;line-height:var(--wpds-typography-line-height-xs,16px);min-height:var(--wpds-dimension-size-md,32px);padding-block:var(--wpds-dimension-padding-xs,4px);padding-inline:var(--wp-ui-menu-group-head-padding-inline);text-transform:uppercase}.bfc11368eadf3b39__separator{background-color:var(--wpds-color-stroke-surface-neutral-weak,#f0f0f0);grid-column:1/-1;height:var(--wpds-border-width-xs,1px);margin-block:var(--wpds-dimension-gap-xs,4px);margin-inline:var(--wp-ui-menu-group-head-padding-inline);@media (forced-colors:active){background-color:CanvasText}}._5c913bce0d8bb0d6__item{--wp-ui-menu-item-height:var(--wpds-dimension-size-md,32px);--wp-ui-menu-item-padding-block:var(--wpds-dimension-padding-xs,4px);--_gcd-a-border-radius:var(--wpds-border-radius-sm,2px);align-content:center;align-items:start;border-radius:var(--wpds-border-radius-sm,2px);display:grid;gap:0;grid-column:1/-1;grid-template-columns:[item-padding-start] var(--wp-ui-menu-item-padding-inline) [selection-start] var(--wp-ui-menu-selection-indicator-track-size) [selection-end] var(--wp-ui-menu-selection-indicator-gap) [prefix-start] max-content [prefix-end] var(--wp-ui-menu-group-prefix-gap) [content-start] minmax(0,1fr) [content-end] var(--wp-ui-menu-item-padding-inline) [item-padding-end];justify-content:stretch;min-height:var(--wp-ui-menu-item-height);min-width:0;padding-block:var(--wp-ui-menu-item-padding-block);scroll-margin:var(--wp-ui-menu-popup-padding);text-decoration:none;user-select:none;&:not([data-disabled]){cursor:var(--wpds-cursor-control,pointer)}&[href]{cursor:pointer}@supports (grid-template-columns:subgrid){grid-template-columns:subgrid}&[data-highlighted]:not([aria-disabled=true]){background-color:var(--wpds-color-background-interactive-brand-weak-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 12%,#fff));color:var(--wpds-color-foreground-interactive-neutral,#1e1e1e);outline:none;@media (forced-colors:active){--_gcd-div-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid Highlight;--_gcd-a-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid Highlight}}&[aria-disabled=true]{background-color:var(--wpds-color-background-interactive-brand-weak-disabled,#0000);color:var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d);@media (forced-colors:active){color:GrayText}}}._42313b48c5459be3__item-selection-indicator,._64924ecabf65a5d6__item-prefix,.af879698ede76757__item-content{grid-row:1}._42313b48c5459be3__item-selection-indicator{align-items:center;color:var(--wpds-color-foreground-content-neutral-weak,#707070);display:flex;grid-column:selection-start/selection-end;height:var(--_wp-ui-menu-item-label-line-height);justify-content:center;justify-self:center;pointer-events:none;width:var(--wp-ui-menu-selection-indicator-size);&[data-unchecked]{opacity:0}}._99c5bd141cbf516f__checkbox-selection-icon{translate:0 1px}._59aa9b3b3a651148__radio-selection-icon{fill:currentColor;height:var(--wpds-dimension-size-xs,20px);width:var(--wpds-dimension-size-xs,20px)}._64924ecabf65a5d6__item-prefix{align-items:center;color:var(--wpds-color-foreground-content-neutral-weak,#707070);display:flex;gap:var(--wpds-dimension-gap-xs,4px);grid-column:prefix-start/prefix-end;justify-content:center;min-width:0}.a836378335a4cbf1__prefix-icon{align-self:flex-start;flex-shrink:0;margin-block-start:calc((var(--_wp-ui-menu-item-label-line-height) - var(--_wp-ui-menu-prefix-icon-size))/2)}.af879698ede76757__item-content{align-items:center;align-self:stretch;box-sizing:border-box;display:grid;grid-column:content-start/content-end;grid-template-columns:[label-start] minmax(0,1fr) [label-end suffix-start] auto [suffix-end shortcut-start] auto [shortcut-end trailing-start] auto [trailing-end];min-width:0;pointer-events:none}._943a932d9f81c78c__item-children{display:inline-flex;flex-direction:column;gap:2px;grid-column:label-start/label-end;min-width:0}._5ed41da4abcf8958__item-label{--_gcd-heading-color:currentColor;--_gcd-p-line-height:var(--_wp-ui-menu-item-label-line-height);color:inherit;line-height:var(--_wp-ui-menu-item-label-line-height);min-width:0;overflow-wrap:anywhere}.fa88c9f1a96a4c5a__item-description{--_gcd-heading-color:var(--wpds-color-foreground-content-neutral-weak,#707070);color:var(--wpds-color-foreground-content-neutral-weak,#707070);overflow-wrap:anywhere;padding-block-end:var(--wpds-dimension-padding-xs,4px)}._091406749ed93e6e__item-suffix{align-items:center;display:flex;gap:var(--wpds-dimension-gap-xs,4px);grid-column:suffix-start/suffix-end}._091406749ed93e6e__item-suffix,._23630f40071a29ff__item-shortcut{color:var(--wpds-color-foreground-content-neutral-weak,#707070);margin-inline-start:var(--wpds-dimension-gap-md,12px)}._23630f40071a29ff__item-shortcut{grid-column:shortcut-start/shortcut-end}._06be17a91bf434a0__item-trailing{align-items:center;color:var(--wpds-color-foreground-content-neutral-weak,#707070);display:flex;grid-column:trailing-start/trailing-end;margin-inline-start:var(--wpds-dimension-gap-md,12px)}._943a932d9f81c78c__item-children+:is(._091406749ed93e6e__item-suffix,._23630f40071a29ff__item-shortcut,._06be17a91bf434a0__item-trailing){margin-inline-start:var(--wpds-dimension-gap-xl,24px)}._23630f40071a29ff__item-shortcut+._06be17a91bf434a0__item-trailing{margin-inline-start:var(--wpds-dimension-gap-xs,4px)}.b78aec79bf93eba0__submenu-chevron{margin-inline-end:calc(var(--wpds-dimension-gap-sm, 8px)*-1)}.b78aec79bf93eba0__submenu-chevron:dir(rtl){transform:rotate(180deg)}._60da3b6f9718cf76__external-link-indicator{display:inline-block;font-weight:var(--wpds-typography-font-weight-default,400);line-height:1;margin-inline-start:var(--wpds-dimension-gap-xs,4px);text-decoration:none}._60da3b6f9718cf76__external-link-indicator:after{content:"\\2197"}._60da3b6f9718cf76__external-link-indicator:dir(rtl):after{content:"\\2196"}._5c913bce0d8bb0d6__item[aria-disabled=true] ._06be17a91bf434a0__item-trailing,._5c913bce0d8bb0d6__item[aria-disabled=true] ._091406749ed93e6e__item-suffix,._5c913bce0d8bb0d6__item[aria-disabled=true] ._23630f40071a29ff__item-shortcut,._5c913bce0d8bb0d6__item[aria-disabled=true] ._42313b48c5459be3__item-selection-indicator,._5c913bce0d8bb0d6__item[aria-disabled=true] ._64924ecabf65a5d6__item-prefix,._5c913bce0d8bb0d6__item[aria-disabled=true] .fa88c9f1a96a4c5a__item-description,._5c913bce0d8bb0d6__item[data-highlighted]:not([aria-disabled=true]) ._06be17a91bf434a0__item-trailing,._5c913bce0d8bb0d6__item[data-highlighted]:not([aria-disabled=true]) ._091406749ed93e6e__item-suffix,._5c913bce0d8bb0d6__item[data-highlighted]:not([aria-disabled=true]) ._23630f40071a29ff__item-shortcut,._5c913bce0d8bb0d6__item[data-highlighted]:not([aria-disabled=true]) ._42313b48c5459be3__item-selection-indicator,._5c913bce0d8bb0d6__item[data-highlighted]:not([aria-disabled=true]) ._64924ecabf65a5d6__item-prefix,._5c913bce0d8bb0d6__item[data-highlighted]:not([aria-disabled=true]) .fa88c9f1a96a4c5a__item-description{--_gcd-heading-color:currentColor;color:inherit}}}'); 19579 } 19580 var style_default20 = { "positioner": "d61e2d85c0ee0699__positioner", "popup": "_34e81249f419a5a5__popup", "item-selection-indicator": "_42313b48c5459be3__item-selection-indicator", "is-root": "_087a537b24fee6a1__is-root _380b81b8f79fb10f__dropdown-motion", "is-submenu": "_6d3b567f6289bdc2__is-submenu _7f344b94e270e039__dropdown-motion--fade-only", "list": "_33f07ab17005471d__list", "group": "f11085533c0056b0__group", "radio-group": "e05914e1005d7c2e__radio-group", "item": "_5c913bce0d8bb0d6__item", "item-prefix": "_64924ecabf65a5d6__item-prefix", "group-label": "_4a0fd085d76fd23c__group-label", "separator": "bfc11368eadf3b39__separator", "item-content": "af879698ede76757__item-content", "checkbox-selection-icon": "_99c5bd141cbf516f__checkbox-selection-icon", "radio-selection-icon": "_59aa9b3b3a651148__radio-selection-icon", "prefix-icon": "a836378335a4cbf1__prefix-icon", "item-children": "_943a932d9f81c78c__item-children", "item-label": "_5ed41da4abcf8958__item-label", "item-description": "fa88c9f1a96a4c5a__item-description", "item-suffix": "_091406749ed93e6e__item-suffix", "item-shortcut": "_23630f40071a29ff__item-shortcut", "item-trailing": "_06be17a91bf434a0__item-trailing", "submenu-chevron": "b78aec79bf93eba0__submenu-chevron", "external-link-indicator": "_60da3b6f9718cf76__external-link-indicator" }; 19581 var SubmenuTrigger = (0, import_element43.forwardRef)( 19582 function MenuSubmenuTrigger3({ 19583 children, 19584 className, 19585 prefix, 19586 shortcut, 19587 suffix, 19588 "aria-describedby": ariaDescribedBy, 19589 "aria-keyshortcuts": ariaKeyShortcuts, 19590 "aria-label": ariaLabel, 19591 "aria-labelledby": ariaLabelledBy, 19592 ...props 19593 }, ref) { 19594 const { 19595 contentChildren, 19596 contentContextValue, 19597 itemAriaProps, 19598 shortcutDescriptionId 19599 } = useItemContent2(children, { 19600 "aria-describedby": ariaDescribedBy, 19601 "aria-keyshortcuts": ariaKeyShortcuts, 19602 "aria-label": ariaLabel, 19603 "aria-labelledby": ariaLabelledBy, 19604 shortcut 19605 }); 19606 return /* @__PURE__ */ (0, import_jsx_runtime92.jsx)( 19607 index_parts_exports.SubmenuTrigger, 19608 { 19609 ref, 19610 ...itemAriaProps, 19611 className: clsx_default( 19612 global_css_defense_default7.div, 19613 resets_default8["box-sizing"], 19614 style_default20.item, 19615 className 19616 ), 19617 ...props, 19618 children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(MenuItemContentContext.Provider, { value: contentContextValue, children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)( 19619 ItemContent, 19620 { 19621 prefix, 19622 shortcut, 19623 shortcutDescriptionId, 19624 suffix, 19625 trailing: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)( 19626 Icon, 19627 { 19628 className: style_default20["submenu-chevron"], 19629 icon: chevron_right_small_default, 19630 size: 24, 19631 "aria-hidden": "true" 19632 } 19633 ), 19634 children: contentChildren 19635 } 19636 ) }) 19637 } 19638 ); 19639 } 19640 ); 19641 19642 // packages/ui/build-module/menu/trigger.mjs 19643 var import_element44 = __toESM(require_element(), 1); 19644 var import_jsx_runtime93 = __toESM(require_jsx_runtime(), 1); 19645 var Trigger2 = (0, import_element44.forwardRef)( 19646 function MenuTrigger3(props, ref) { 19647 return /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(index_parts_exports.Trigger, { ref, ...props }); 19648 } 19649 ); 19650 19651 // packages/ui/build-module/button/button.mjs 19652 var import_a11y = __toESM(require_a11y(), 1); 19653 var import_element45 = __toESM(require_element(), 1); 19654 var import_i18n11 = __toESM(require_i18n(), 1); 19655 var import_jsx_runtime94 = __toESM(require_jsx_runtime(), 1); 19656 var STYLE_HASH_ATTRIBUTE22 = "data-wp-hash"; 19657 function getRuntime22() { 19658 const globalScope = globalThis; 19659 if (globalScope.__wpStyleRuntime) { 19660 return globalScope.__wpStyleRuntime; 19661 } 19662 globalScope.__wpStyleRuntime = { 19663 documents: /* @__PURE__ */ new Map(), 19664 styles: /* @__PURE__ */ new Map(), 19665 injectedStyles: /* @__PURE__ */ new WeakMap() 19666 }; 19667 if (typeof document !== "undefined") { 19668 registerDocument22(document); 19669 } 19670 return globalScope.__wpStyleRuntime; 19671 } 19672 function documentContainsStyleHash22(targetDocument, hash) { 19673 if (!targetDocument.head) { 19674 return false; 19675 } 19676 for (const style of targetDocument.head.querySelectorAll( 19677 `style[$STYLE_HASH_ATTRIBUTE22}]` 19678 )) { 19679 if (style.getAttribute(STYLE_HASH_ATTRIBUTE22) === hash) { 19680 return true; 19681 } 19682 } 19683 return false; 19684 } 19685 function injectStyle22(targetDocument, hash, css) { 19686 if (!targetDocument.head) { 19687 return; 19688 } 19689 const runtime = getRuntime22(); 19690 let injectedStyles = runtime.injectedStyles.get(targetDocument); 19691 if (!injectedStyles) { 19692 injectedStyles = /* @__PURE__ */ new Set(); 19693 runtime.injectedStyles.set(targetDocument, injectedStyles); 19694 } 19695 if (injectedStyles.has(hash)) { 19696 return; 19697 } 19698 if (documentContainsStyleHash22(targetDocument, hash)) { 19699 injectedStyles.add(hash); 19700 return; 19701 } 19702 const style = targetDocument.createElement("style"); 19703 style.setAttribute(STYLE_HASH_ATTRIBUTE22, hash); 19704 style.appendChild(targetDocument.createTextNode(css)); 19705 targetDocument.head.appendChild(style); 19706 injectedStyles.add(hash); 19707 } 19708 function registerDocument22(targetDocument) { 19709 const runtime = getRuntime22(); 19710 runtime.documents.set( 19711 targetDocument, 19712 (runtime.documents.get(targetDocument) ?? 0) + 1 19713 ); 19714 for (const [hash, css] of runtime.styles) { 19715 injectStyle22(targetDocument, hash, css); 19716 } 19717 return () => { 19718 const count = runtime.documents.get(targetDocument); 19719 if (count === void 0) { 19720 return; 19721 } 19722 if (count <= 1) { 19723 runtime.documents.delete(targetDocument); 19724 return; 19725 } 19726 runtime.documents.set(targetDocument, count - 1); 19727 }; 19728 } 19729 function registerStyle22(hash, css) { 19730 const runtime = getRuntime22(); 19731 runtime.styles.set(hash, css); 19732 for (const targetDocument of runtime.documents.keys()) { 19733 injectStyle22(targetDocument, hash, css); 19734 } 19735 } 19736 if (typeof process === "undefined" || true) { 19737 registerStyle22("effc4e3032", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._97b0fc33c028be1a__button,.abbb272e2ce49bd6__is-unstyled{appearance:none;padding:0}._97b0fc33c028be1a__button{--wp-ui-button-font-weight:var(--wpds-typography-font-weight-emphasis,600);--wp-ui-button-background-color:var(--wpds-color-background-interactive-brand-strong,var(--wp-admin-theme-color,#3858e9));--wp-ui-button-background-color-active:var(--wpds-color-background-interactive-brand-strong-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 93%,#000));--wp-ui-button-background-color-disabled:var(--wpds-color-background-interactive-brand-strong-disabled,#e6e6e6);--wp-ui-button-foreground-color:var(--wpds-color-foreground-interactive-brand-strong,#fff);--wp-ui-button-foreground-color-active:var(--wpds-color-foreground-interactive-brand-strong-active,#fff);--wp-ui-button-foreground-color-disabled:var(--wpds-color-foreground-interactive-brand-strong-disabled,#8d8d8d);--wp-ui-button-padding-block:var(--wpds-dimension-padding-xs,4px);--wp-ui-button-padding-inline:var(--wpds-dimension-padding-md,12px);--wp-ui-button-height:var(--wpds-dimension-size-lg,40px);--wp-ui-button-aspect-ratio:auto;--wp-ui-button-font-size:var(--wpds-typography-font-size-md,13px);--wp-ui-button-min-width:calc(4ch + var(--wp-ui-button-padding-inline)*2);--wp-ui-button-icon-margin:calc((var(--wpds-dimension-size-2xs, 16px) - var(--wpds-dimension-size-sm, 24px))/2);--wp-ui-button-border-color:var(--wp-ui-button-background-color);--wp-ui-button-border-color-active:var(--wp-ui-button-background-color-active);--wp-ui-button-border-color-disabled:var(--wp-ui-button-background-color-disabled);--_gcd-button-font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);--_gcd-button-font-size:var(--wp-ui-button-font-size);--_gcd-button-font-weight:var(--wp-ui-button-font-weight);align-items:center;aspect-ratio:var(--wp-ui-button-aspect-ratio);background-clip:border-box;background-color:var(--wp-ui-button-background-color);border-color:var(--wp-ui-button-border-color);border-radius:var(--wpds-border-radius-sm,2px);border-style:solid;border-width:1px;color:var(--wp-ui-button-foreground-color);display:inline-flex;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(--wp-ui-button-font-size);font-weight:var(--wp-ui-button-font-weight);gap:var(--wpds-dimension-gap-sm,8px);justify-content:center;line-height:var(--wpds-typography-line-height-sm,20px);max-width:100%;min-height:var(--wp-ui-button-height);min-width:var(--wp-ui-button-min-width);overflow-wrap:anywhere;padding-block:var(--wp-ui-button-padding-block);padding-inline:var(--wp-ui-button-padding-inline);position:relative;text-align:center;text-decoration:none;&:not([data-disabled]){cursor:var(--wpds-cursor-control,pointer)}@media not (prefers-reduced-motion){transition:color .1s ease-out;*{transition:opacity .1s ease-out}}&[href]{cursor:pointer}[href]{color:inherit;text-decoration:inherit}&:not([data-disabled]):is(:hover,:active,:focus){background-color:var(--wp-ui-button-background-color-active);border-color:var(--wp-ui-button-border-color-active);color:var(--wp-ui-button-foreground-color-active)}&[data-disabled]:not(._914b42f315c0e580__is-loading){background-color:var(--wp-ui-button-background-color-disabled);border-color:var(--wp-ui-button-border-color-disabled);color:var(--wp-ui-button-foreground-color-disabled);@media (forced-colors:active){border-bottom-color:GrayText;border-left-color:GrayText;border-right-color:GrayText;border-top-color:GrayText;color:GrayText}}&:before{aspect-ratio:1;border:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid;border-block-end-color:transparent;border-block-start-color:var(--wp-ui-button-foreground-color);border-inline-end-color:var(--wp-ui-button-foreground-color);border-inline-start-color:transparent;border-radius:50%;box-sizing:border-box;content:"";display:block;height:var(--wp-ui-button-font-size);left:50%;opacity:0;pointer-events:none;position:absolute;top:50%;transform:translate(-50%,-50%);@media not (prefers-reduced-motion){transition:opacity .1s ease-out}@media (forced-colors:active){border-block-end-style:none;border-bottom-color:ButtonText;border-inline-start-style:none;border-left-color:ButtonText;border-right-color:ButtonText;border-top-color:ButtonText}}}._908205475f9f2a92__is-small{--wp-ui-button-padding-block:0px;--wp-ui-button-padding-inline:var(--wpds-dimension-padding-sm,8px);--wp-ui-button-height:var(--wpds-dimension-size-sm,24px)}._9f6fc6553aeb36fe__icon{margin:var(--wp-ui-button-icon-margin)}.dd460c965226cc77__is-brand{&._62d5a778b7b258ee__is-outline,&.ad0619a3217c6a5b__is-minimal{--wp-ui-button-foreground-color:var(--wpds-color-foreground-interactive-brand,var(--wp-admin-theme-color,#3858e9));--wp-ui-button-foreground-color-active:var(--wpds-color-foreground-interactive-brand-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 52%,#000));--wp-ui-button-foreground-color-disabled:var(--wpds-color-foreground-interactive-brand-disabled,#8d8d8d)}&._62d5a778b7b258ee__is-outline{--wp-ui-button-background-color:var(--wpds-color-background-interactive-brand-weak,#0000);--wp-ui-button-background-color-active:var(--wpds-color-background-interactive-brand-weak-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 12%,#fff));--wp-ui-button-background-color-disabled:var(--wpds-color-background-interactive-brand-weak-disabled,#0000);--wp-ui-button-border-color:var(--wpds-color-stroke-interactive-brand,var(--wp-admin-theme-color,#3858e9));--wp-ui-button-border-color-active:var(--wpds-color-stroke-interactive-brand-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 85%,#000));--wp-ui-button-border-color-disabled:var(--wpds-color-stroke-interactive-brand-disabled,#dbdbdb)}&.ad0619a3217c6a5b__is-minimal{--wp-ui-button-background-color:var(--wpds-color-background-interactive-brand-weak,#0000);--wp-ui-button-background-color-active:var(--wpds-color-background-interactive-brand-weak-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 12%,#fff));--wp-ui-button-background-color-disabled:var(--wpds-color-background-interactive-brand-weak-disabled,#0000)}}.e722a8f96726aa99__is-neutral{&.ad0619a3217c6a5b__is-minimal[aria-pressed=true],&.b50b3358c5fb4d0b__is-solid{--wp-ui-button-background-color:var(--wpds-color-background-interactive-neutral-strong,#2d2d2d);--wp-ui-button-background-color-active:var(--wpds-color-background-interactive-neutral-strong-active,#1e1e1e);--wp-ui-button-background-color-disabled:var(--wpds-color-background-interactive-neutral-strong-disabled,#e6e6e6);--wp-ui-button-foreground-color:var(--wpds-color-foreground-interactive-neutral-strong,#f0f0f0);--wp-ui-button-foreground-color-active:var(--wpds-color-foreground-interactive-neutral-strong-active,#f0f0f0);--wp-ui-button-foreground-color-disabled:var(--wpds-color-foreground-interactive-neutral-strong-disabled,#8d8d8d)}&._62d5a778b7b258ee__is-outline,&.ad0619a3217c6a5b__is-minimal:not([aria-pressed=true]){--wp-ui-button-foreground-color:var(--wpds-color-foreground-interactive-neutral,#1e1e1e);--wp-ui-button-foreground-color-active:var(--wpds-color-foreground-interactive-neutral-active,#1e1e1e);--wp-ui-button-foreground-color-disabled:var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d)}&._62d5a778b7b258ee__is-outline{--wp-ui-button-background-color:var(--wpds-color-background-interactive-neutral-weak,#0000);--wp-ui-button-background-color-active:var(--wpds-color-background-interactive-neutral-weak-active,#ededed);--wp-ui-button-background-color-disabled:var(--wpds-color-background-interactive-neutral-weak-disabled,#0000);--wp-ui-button-border-color:var(--wpds-color-stroke-interactive-neutral,#8d8d8d);--wp-ui-button-border-color-active:var(--wpds-color-stroke-interactive-neutral-active,#6e6e6e);--wp-ui-button-border-color-disabled:var(--wpds-color-stroke-interactive-neutral-disabled,#dbdbdb)}&.ad0619a3217c6a5b__is-minimal:not([aria-pressed=true]){--wp-ui-button-background-color:var(--wpds-color-background-interactive-neutral-weak,#0000);--wp-ui-button-background-color-active:var(--wpds-color-background-interactive-neutral-weak-active,#ededed);--wp-ui-button-background-color-disabled:var(--wpds-color-background-interactive-neutral-weak-disabled,#0000)}}.abbb272e2ce49bd6__is-unstyled{background:none;border:none;min-width:unset}.cf59cf1b69629838__is-compact{--wp-ui-button-height:var(--wpds-dimension-size-md,32px)}._914b42f315c0e580__is-loading:not(.abbb272e2ce49bd6__is-unstyled){color:transparent;&:not([data-disabled]):is(:hover,:active,:focus){color:transparent}@media (forced-colors:active){color:ButtonFace}*{opacity:0}&:before{opacity:1;transition-delay:.05s;@media not (prefers-reduced-motion){animation:_5a1d53da6f830c8d__loading-animation 1s linear infinite}}}}@keyframes _5a1d53da6f830c8d__loading-animation{0%{transform:translate(-50%,-50%) rotate(0deg)}to{transform:translate(-50%,-50%) rotate(1turn)}}}'); 19738 } 19739 var style_default21 = { "button": "_97b0fc33c028be1a__button", "is-unstyled": "abbb272e2ce49bd6__is-unstyled", "is-loading": "_914b42f315c0e580__is-loading", "is-small": "_908205475f9f2a92__is-small", "icon": "_9f6fc6553aeb36fe__icon", "is-brand": "dd460c965226cc77__is-brand", "is-outline": "_62d5a778b7b258ee__is-outline", "is-minimal": "ad0619a3217c6a5b__is-minimal", "is-neutral": "e722a8f96726aa99__is-neutral", "is-solid": "b50b3358c5fb4d0b__is-solid", "is-compact": "cf59cf1b69629838__is-compact", "loading-animation": "_5a1d53da6f830c8d__loading-animation" }; 19740 if (typeof process === "undefined" || true) { 19741 registerStyle22("10f3806643", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._336cd3e4e743482f__box-sizing{box-sizing:border-box;*,:after,:before{box-sizing:inherit}}}}"); 19742 } 19743 var resets_default9 = { "box-sizing": "_336cd3e4e743482f__box-sizing" }; 19744 if (typeof process === "undefined" || true) { 19745 registerStyle22("08122b3d53", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{.af79fb116edb0dd7__outset-ring--focus:focus,.dfcfdc28396e5d98__outset-ring--focus-visible:focus-visible,.e5cd9ee879f6403a__outset-ring--focus-within:focus-within,:focus-visible ._81935a08e952f267__outset-ring--focus-parent-visible{--_gcd-a-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));--_gcd-div-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));outline-offset:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px))}._3c9f5ee9fc9c136d__outset-ring--focus-within-except-active:focus-within,.abc777e9713fa711__outset-ring--focus-except-active:focus{outline:none}._3c9f5ee9fc9c136d__outset-ring--focus-within-except-active:focus-within:not(:has(:active)),.abc777e9713fa711__outset-ring--focus-except-active:focus:not(:active){--_gcd-a-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));--_gcd-div-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));outline-offset:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px))}}}"); 19746 } 19747 var focus_module_default2 = { "outset-ring--focus": "af79fb116edb0dd7__outset-ring--focus", "outset-ring--focus-visible": "dfcfdc28396e5d98__outset-ring--focus-visible", "outset-ring--focus-within": "e5cd9ee879f6403a__outset-ring--focus-within", "outset-ring--focus-parent-visible": "_81935a08e952f267__outset-ring--focus-parent-visible", "outset-ring--focus-except-active": "abc777e9713fa711__outset-ring--focus-except-active", "outset-ring--focus-within-except-active": "_3c9f5ee9fc9c136d__outset-ring--focus-within-except-active" }; 19748 if (typeof process === "undefined" || true) { 19749 registerStyle22("e8e31009f5", "._6defc79820e382c6__button{box-sizing:var(--_gcd-button-box-sizing,border-box);font-family:var(--_gcd-button-font-family,inherit);font-size:var(--_gcd-button-font-size,inherit);font-weight:var(--_gcd-button-font-weight,inherit)}.d2cff2e5dea83bd1__input{box-sizing:var(--_gcd-input-box-sizing,border-box);font-family:var(--_gcd-input-font-family,inherit);font-size:var(--_gcd-input-font-size,inherit);font-weight:var(--_gcd-input-font-weight,inherit);margin:var(--_gcd-input-margin,0);&::placeholder{color:var(--_gcd-input-placeholder-color,var(--wpds-color-foreground-interactive-neutral-weak,#707070))}&:is(textarea,[type=text],[type=password],[type=color],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){background-color:var(--_gcd-input-background-color,transparent);border:var(--_gcd-input-border,none);border-radius:var(--_gcd-input-border-radius,0);box-shadow:var(--_gcd-input-box-shadow,0 0 0 transparent);color:var(--_gcd-input-color,var(--wpds-color-foreground-interactive-neutral,#1e1e1e));&:focus{border-color:var(--_gcd-input-border-color-focus,var(--wp-admin-theme-color));box-shadow:var(--_gcd-input-box-shadow-focus,none);outline:var(--_gcd-input-outline-focus,none)}&:disabled{background:var(--_gcd-input-background-disabled,transparent);border-color:var(--_gcd-input-border-color-disabled,transparent);box-shadow:var(--_gcd-input-box-shadow-disabled,none);color:var(--_gcd-input-color-disabled,var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d))}}&:is(textarea,[type=text],[type=password],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){line-height:var(--_gcd-input-line-height,inherit);min-height:var(--_gcd-input-min-height,auto);padding:var(--_gcd-input-padding,0)}}._547d86373d02e108__textarea{box-sizing:var(--_gcd-textarea-box-sizing,border-box);overflow:var(--_gcd-textarea-overflow,auto);resize:var(--_gcd-textarea-resize,block)}._8c15fd0ed9f28ba4__div{outline:var(--_gcd-div-outline,0 solid transparent)}p._43cec3e1eec1066d__p{font-size:var(--_gcd-p-font-size,13px);line-height:var(--_gcd-p-line-height,1.5);margin:var(--_gcd-p-margin,0)}:is(h1,h2,h3,h4,h5,h6).e97669c6d9a38497__heading{color:var(--_gcd-heading-color,var(--wpds-color-foreground-content-neutral,#1e1e1e));font-size:var(--_gcd-heading-font-size,inherit);font-weight:var(--_gcd-heading-font-weight,var(--wpds-typography-font-weight-emphasis,600));margin:var(--_gcd-heading-margin,0)}._2c0831b0499dbd6e__a,._2c0831b0499dbd6e__a:is(:hover,:focus,:active){border-radius:var(--_gcd-a-border-radius,0);box-shadow:var(--_gcd-a-box-shadow,none);color:var(--_gcd-a-color,inherit);outline:var(--_gcd-a-outline,0 solid transparent);transition:var(--_gcd-a-transition,none)}.c59a0ebebd71fa4a__ol{list-style:var(--_gcd-ol-list-style,none);margin:var(--_gcd-ol-margin,0);padding-block:var(--_gcd-ol-padding-block,0);padding-inline:var(--_gcd-ol-padding-inline,0)}._46b5cb0c8e24e8c9__li{margin:var(--_gcd-li-margin,0)}"); 19750 } 19751 var global_css_defense_default8 = { "button": "_6defc79820e382c6__button", "input": "d2cff2e5dea83bd1__input", "textarea": "_547d86373d02e108__textarea", "div": "_8c15fd0ed9f28ba4__div", "p": "_43cec3e1eec1066d__p", "heading": "e97669c6d9a38497__heading", "a": "_2c0831b0499dbd6e__a", "ol": "c59a0ebebd71fa4a__ol", "li": "_46b5cb0c8e24e8c9__li" }; 19752 var Button3 = (0, import_element45.forwardRef)( 19753 function Button22({ 19754 tone = "brand", 19755 variant = "solid", 19756 size: size4 = "default", 19757 className, 19758 focusableWhenDisabled = true, 19759 disabled: disabled2, 19760 loading, 19761 loadingAnnouncement = (0, import_i18n11.__)("Loading"), 19762 children, 19763 ...props 19764 }, ref) { 19765 const mergedClassName = clsx_default( 19766 global_css_defense_default8.button, 19767 resets_default9["box-sizing"], 19768 focus_module_default2["outset-ring--focus-except-active"], 19769 variant !== "unstyled" && style_default21.button, 19770 style_default21[`is-$tone}`], 19771 style_default21[`is-$variant}`], 19772 style_default21[`is-$size4}`], 19773 loading && style_default21["is-loading"], 19774 className 19775 ); 19776 (0, import_element45.useEffect)(() => { 19777 if (loading && loadingAnnouncement) { 19778 (0, import_a11y.speak)(loadingAnnouncement); 19779 } 19780 }, [loading, loadingAnnouncement]); 19781 return /* @__PURE__ */ (0, import_jsx_runtime94.jsx)( 19782 Button, 19783 { 19784 ref, 19785 className: mergedClassName, 19786 focusableWhenDisabled, 19787 disabled: disabled2 ?? loading, 19788 ...props, 19789 children 19790 } 19791 ); 19792 } 19793 ); 19794 19795 // packages/ui/build-module/button/icon.mjs 19796 var import_element46 = __toESM(require_element(), 1); 19797 var import_jsx_runtime95 = __toESM(require_jsx_runtime(), 1); 19798 var STYLE_HASH_ATTRIBUTE23 = "data-wp-hash"; 19799 function getRuntime23() { 19800 const globalScope = globalThis; 19801 if (globalScope.__wpStyleRuntime) { 19802 return globalScope.__wpStyleRuntime; 19803 } 19804 globalScope.__wpStyleRuntime = { 19805 documents: /* @__PURE__ */ new Map(), 19806 styles: /* @__PURE__ */ new Map(), 19807 injectedStyles: /* @__PURE__ */ new WeakMap() 19808 }; 19809 if (typeof document !== "undefined") { 19810 registerDocument23(document); 19811 } 19812 return globalScope.__wpStyleRuntime; 19813 } 19814 function documentContainsStyleHash23(targetDocument, hash) { 19815 if (!targetDocument.head) { 19816 return false; 19817 } 19818 for (const style of targetDocument.head.querySelectorAll( 19819 `style[$STYLE_HASH_ATTRIBUTE23}]` 19820 )) { 19821 if (style.getAttribute(STYLE_HASH_ATTRIBUTE23) === hash) { 19822 return true; 19823 } 19824 } 19825 return false; 19826 } 19827 function injectStyle23(targetDocument, hash, css) { 19828 if (!targetDocument.head) { 19829 return; 19830 } 19831 const runtime = getRuntime23(); 19832 let injectedStyles = runtime.injectedStyles.get(targetDocument); 19833 if (!injectedStyles) { 19834 injectedStyles = /* @__PURE__ */ new Set(); 19835 runtime.injectedStyles.set(targetDocument, injectedStyles); 19836 } 19837 if (injectedStyles.has(hash)) { 19838 return; 19839 } 19840 if (documentContainsStyleHash23(targetDocument, hash)) { 19841 injectedStyles.add(hash); 19842 return; 19843 } 19844 const style = targetDocument.createElement("style"); 19845 style.setAttribute(STYLE_HASH_ATTRIBUTE23, hash); 19846 style.appendChild(targetDocument.createTextNode(css)); 19847 targetDocument.head.appendChild(style); 19848 injectedStyles.add(hash); 19849 } 19850 function registerDocument23(targetDocument) { 19851 const runtime = getRuntime23(); 19852 runtime.documents.set( 19853 targetDocument, 19854 (runtime.documents.get(targetDocument) ?? 0) + 1 19855 ); 19856 for (const [hash, css] of runtime.styles) { 19857 injectStyle23(targetDocument, hash, css); 19858 } 19859 return () => { 19860 const count = runtime.documents.get(targetDocument); 19861 if (count === void 0) { 19862 return; 19863 } 19864 if (count <= 1) { 19865 runtime.documents.delete(targetDocument); 19866 return; 19867 } 19868 runtime.documents.set(targetDocument, count - 1); 19869 }; 19870 } 19871 function registerStyle23(hash, css) { 19872 const runtime = getRuntime23(); 19873 runtime.styles.set(hash, css); 19874 for (const targetDocument of runtime.documents.keys()) { 19875 injectStyle23(targetDocument, hash, css); 19876 } 19877 } 19878 if (typeof process === "undefined" || true) { 19879 registerStyle23("effc4e3032", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._97b0fc33c028be1a__button,.abbb272e2ce49bd6__is-unstyled{appearance:none;padding:0}._97b0fc33c028be1a__button{--wp-ui-button-font-weight:var(--wpds-typography-font-weight-emphasis,600);--wp-ui-button-background-color:var(--wpds-color-background-interactive-brand-strong,var(--wp-admin-theme-color,#3858e9));--wp-ui-button-background-color-active:var(--wpds-color-background-interactive-brand-strong-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 93%,#000));--wp-ui-button-background-color-disabled:var(--wpds-color-background-interactive-brand-strong-disabled,#e6e6e6);--wp-ui-button-foreground-color:var(--wpds-color-foreground-interactive-brand-strong,#fff);--wp-ui-button-foreground-color-active:var(--wpds-color-foreground-interactive-brand-strong-active,#fff);--wp-ui-button-foreground-color-disabled:var(--wpds-color-foreground-interactive-brand-strong-disabled,#8d8d8d);--wp-ui-button-padding-block:var(--wpds-dimension-padding-xs,4px);--wp-ui-button-padding-inline:var(--wpds-dimension-padding-md,12px);--wp-ui-button-height:var(--wpds-dimension-size-lg,40px);--wp-ui-button-aspect-ratio:auto;--wp-ui-button-font-size:var(--wpds-typography-font-size-md,13px);--wp-ui-button-min-width:calc(4ch + var(--wp-ui-button-padding-inline)*2);--wp-ui-button-icon-margin:calc((var(--wpds-dimension-size-2xs, 16px) - var(--wpds-dimension-size-sm, 24px))/2);--wp-ui-button-border-color:var(--wp-ui-button-background-color);--wp-ui-button-border-color-active:var(--wp-ui-button-background-color-active);--wp-ui-button-border-color-disabled:var(--wp-ui-button-background-color-disabled);--_gcd-button-font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);--_gcd-button-font-size:var(--wp-ui-button-font-size);--_gcd-button-font-weight:var(--wp-ui-button-font-weight);align-items:center;aspect-ratio:var(--wp-ui-button-aspect-ratio);background-clip:border-box;background-color:var(--wp-ui-button-background-color);border-color:var(--wp-ui-button-border-color);border-radius:var(--wpds-border-radius-sm,2px);border-style:solid;border-width:1px;color:var(--wp-ui-button-foreground-color);display:inline-flex;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(--wp-ui-button-font-size);font-weight:var(--wp-ui-button-font-weight);gap:var(--wpds-dimension-gap-sm,8px);justify-content:center;line-height:var(--wpds-typography-line-height-sm,20px);max-width:100%;min-height:var(--wp-ui-button-height);min-width:var(--wp-ui-button-min-width);overflow-wrap:anywhere;padding-block:var(--wp-ui-button-padding-block);padding-inline:var(--wp-ui-button-padding-inline);position:relative;text-align:center;text-decoration:none;&:not([data-disabled]){cursor:var(--wpds-cursor-control,pointer)}@media not (prefers-reduced-motion){transition:color .1s ease-out;*{transition:opacity .1s ease-out}}&[href]{cursor:pointer}[href]{color:inherit;text-decoration:inherit}&:not([data-disabled]):is(:hover,:active,:focus){background-color:var(--wp-ui-button-background-color-active);border-color:var(--wp-ui-button-border-color-active);color:var(--wp-ui-button-foreground-color-active)}&[data-disabled]:not(._914b42f315c0e580__is-loading){background-color:var(--wp-ui-button-background-color-disabled);border-color:var(--wp-ui-button-border-color-disabled);color:var(--wp-ui-button-foreground-color-disabled);@media (forced-colors:active){border-bottom-color:GrayText;border-left-color:GrayText;border-right-color:GrayText;border-top-color:GrayText;color:GrayText}}&:before{aspect-ratio:1;border:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid;border-block-end-color:transparent;border-block-start-color:var(--wp-ui-button-foreground-color);border-inline-end-color:var(--wp-ui-button-foreground-color);border-inline-start-color:transparent;border-radius:50%;box-sizing:border-box;content:"";display:block;height:var(--wp-ui-button-font-size);left:50%;opacity:0;pointer-events:none;position:absolute;top:50%;transform:translate(-50%,-50%);@media not (prefers-reduced-motion){transition:opacity .1s ease-out}@media (forced-colors:active){border-block-end-style:none;border-bottom-color:ButtonText;border-inline-start-style:none;border-left-color:ButtonText;border-right-color:ButtonText;border-top-color:ButtonText}}}._908205475f9f2a92__is-small{--wp-ui-button-padding-block:0px;--wp-ui-button-padding-inline:var(--wpds-dimension-padding-sm,8px);--wp-ui-button-height:var(--wpds-dimension-size-sm,24px)}._9f6fc6553aeb36fe__icon{margin:var(--wp-ui-button-icon-margin)}.dd460c965226cc77__is-brand{&._62d5a778b7b258ee__is-outline,&.ad0619a3217c6a5b__is-minimal{--wp-ui-button-foreground-color:var(--wpds-color-foreground-interactive-brand,var(--wp-admin-theme-color,#3858e9));--wp-ui-button-foreground-color-active:var(--wpds-color-foreground-interactive-brand-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 52%,#000));--wp-ui-button-foreground-color-disabled:var(--wpds-color-foreground-interactive-brand-disabled,#8d8d8d)}&._62d5a778b7b258ee__is-outline{--wp-ui-button-background-color:var(--wpds-color-background-interactive-brand-weak,#0000);--wp-ui-button-background-color-active:var(--wpds-color-background-interactive-brand-weak-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 12%,#fff));--wp-ui-button-background-color-disabled:var(--wpds-color-background-interactive-brand-weak-disabled,#0000);--wp-ui-button-border-color:var(--wpds-color-stroke-interactive-brand,var(--wp-admin-theme-color,#3858e9));--wp-ui-button-border-color-active:var(--wpds-color-stroke-interactive-brand-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 85%,#000));--wp-ui-button-border-color-disabled:var(--wpds-color-stroke-interactive-brand-disabled,#dbdbdb)}&.ad0619a3217c6a5b__is-minimal{--wp-ui-button-background-color:var(--wpds-color-background-interactive-brand-weak,#0000);--wp-ui-button-background-color-active:var(--wpds-color-background-interactive-brand-weak-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 12%,#fff));--wp-ui-button-background-color-disabled:var(--wpds-color-background-interactive-brand-weak-disabled,#0000)}}.e722a8f96726aa99__is-neutral{&.ad0619a3217c6a5b__is-minimal[aria-pressed=true],&.b50b3358c5fb4d0b__is-solid{--wp-ui-button-background-color:var(--wpds-color-background-interactive-neutral-strong,#2d2d2d);--wp-ui-button-background-color-active:var(--wpds-color-background-interactive-neutral-strong-active,#1e1e1e);--wp-ui-button-background-color-disabled:var(--wpds-color-background-interactive-neutral-strong-disabled,#e6e6e6);--wp-ui-button-foreground-color:var(--wpds-color-foreground-interactive-neutral-strong,#f0f0f0);--wp-ui-button-foreground-color-active:var(--wpds-color-foreground-interactive-neutral-strong-active,#f0f0f0);--wp-ui-button-foreground-color-disabled:var(--wpds-color-foreground-interactive-neutral-strong-disabled,#8d8d8d)}&._62d5a778b7b258ee__is-outline,&.ad0619a3217c6a5b__is-minimal:not([aria-pressed=true]){--wp-ui-button-foreground-color:var(--wpds-color-foreground-interactive-neutral,#1e1e1e);--wp-ui-button-foreground-color-active:var(--wpds-color-foreground-interactive-neutral-active,#1e1e1e);--wp-ui-button-foreground-color-disabled:var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d)}&._62d5a778b7b258ee__is-outline{--wp-ui-button-background-color:var(--wpds-color-background-interactive-neutral-weak,#0000);--wp-ui-button-background-color-active:var(--wpds-color-background-interactive-neutral-weak-active,#ededed);--wp-ui-button-background-color-disabled:var(--wpds-color-background-interactive-neutral-weak-disabled,#0000);--wp-ui-button-border-color:var(--wpds-color-stroke-interactive-neutral,#8d8d8d);--wp-ui-button-border-color-active:var(--wpds-color-stroke-interactive-neutral-active,#6e6e6e);--wp-ui-button-border-color-disabled:var(--wpds-color-stroke-interactive-neutral-disabled,#dbdbdb)}&.ad0619a3217c6a5b__is-minimal:not([aria-pressed=true]){--wp-ui-button-background-color:var(--wpds-color-background-interactive-neutral-weak,#0000);--wp-ui-button-background-color-active:var(--wpds-color-background-interactive-neutral-weak-active,#ededed);--wp-ui-button-background-color-disabled:var(--wpds-color-background-interactive-neutral-weak-disabled,#0000)}}.abbb272e2ce49bd6__is-unstyled{background:none;border:none;min-width:unset}.cf59cf1b69629838__is-compact{--wp-ui-button-height:var(--wpds-dimension-size-md,32px)}._914b42f315c0e580__is-loading:not(.abbb272e2ce49bd6__is-unstyled){color:transparent;&:not([data-disabled]):is(:hover,:active,:focus){color:transparent}@media (forced-colors:active){color:ButtonFace}*{opacity:0}&:before{opacity:1;transition-delay:.05s;@media not (prefers-reduced-motion){animation:_5a1d53da6f830c8d__loading-animation 1s linear infinite}}}}@keyframes _5a1d53da6f830c8d__loading-animation{0%{transform:translate(-50%,-50%) rotate(0deg)}to{transform:translate(-50%,-50%) rotate(1turn)}}}'); 19880 } 19881 var style_default22 = { "button": "_97b0fc33c028be1a__button", "is-unstyled": "abbb272e2ce49bd6__is-unstyled", "is-loading": "_914b42f315c0e580__is-loading", "is-small": "_908205475f9f2a92__is-small", "icon": "_9f6fc6553aeb36fe__icon", "is-brand": "dd460c965226cc77__is-brand", "is-outline": "_62d5a778b7b258ee__is-outline", "is-minimal": "ad0619a3217c6a5b__is-minimal", "is-neutral": "e722a8f96726aa99__is-neutral", "is-solid": "b50b3358c5fb4d0b__is-solid", "is-compact": "cf59cf1b69629838__is-compact", "loading-animation": "_5a1d53da6f830c8d__loading-animation" }; 19882 var ButtonIcon = (0, import_element46.forwardRef)( 19883 function ButtonIcon2({ className, icon, ...props }, ref) { 19884 return /* @__PURE__ */ (0, import_jsx_runtime95.jsx)( 19885 Icon, 19886 { 19887 ref, 19888 icon, 19889 className: clsx_default(style_default22.icon, className), 19890 size: 24, 19891 ...props 19892 } 19893 ); 19894 } 19895 ); 19896 19897 // packages/ui/build-module/button/index.mjs 19898 ButtonIcon.displayName = "Button.Icon"; 19899 var Button4 = Object.assign(Button3, { 19900 /** 19901 * An icon component specifically designed to work well when rendered inside 19902 * a `Button` component. 19903 */ 19904 Icon: ButtonIcon 19905 }); 19906 19907 // node_modules/@date-fns/tz/tzName/index.js 19908 function tzName(timeZone, date, format7 = "long") { 19909 return new Intl.DateTimeFormat("en-US", { 19910 // Enforces engine to render the time. Without the option JavaScriptCore omits it. 19911 hour: "numeric", 19912 timeZone, 19913 timeZoneName: format7 19914 }).format(date).split(/\s/g).slice(2).join(" "); 19915 } 19916 19917 // node_modules/@date-fns/tz/tzOffset/index.js 19918 var offsetFormatCache = {}; 19919 var offsetCache = {}; 19920 function tzOffset(timeZone, date) { 19921 try { 19922 const format7 = offsetFormatCache[timeZone] ||= new Intl.DateTimeFormat("en-US", { 19923 timeZone, 19924 timeZoneName: "longOffset" 19925 }).format; 19926 const offsetStr = format7(date).split("GMT")[1]; 19927 if (offsetStr in offsetCache) return offsetCache[offsetStr]; 19928 return calcOffset(offsetStr, offsetStr.split(":")); 19929 } catch { 19930 if (timeZone in offsetCache) return offsetCache[timeZone]; 19931 const captures = timeZone?.match(offsetRe); 19932 if (captures) return calcOffset(timeZone, captures.slice(1)); 19933 return NaN; 19934 } 19935 } 19936 var offsetRe = /([+-]\d\d):?(\d\d)?/; 19937 function calcOffset(cacheStr, values) { 19938 const hours = +(values[0] || 0); 19939 const minutes = +(values[1] || 0); 19940 const seconds = +(values[2] || 0) / 60; 19941 return offsetCache[cacheStr] = hours * 60 + minutes > 0 ? hours * 60 + minutes + seconds : hours * 60 - minutes - seconds; 19942 } 19943 19944 // node_modules/@date-fns/tz/date/mini.js 19945 var TZDateMini = class _TZDateMini extends Date { 19946 //#region static 19947 constructor(...args) { 19948 super(); 19949 if (args.length > 1 && typeof args[args.length - 1] === "string") { 19950 this.timeZone = args.pop(); 19951 } 19952 this.internal = /* @__PURE__ */ new Date(); 19953 if (isNaN(tzOffset(this.timeZone, this))) { 19954 this.setTime(NaN); 19955 } else { 19956 if (!args.length) { 19957 this.setTime(Date.now()); 19958 } else if (typeof args[0] === "number" && (args.length === 1 || args.length === 2 && typeof args[1] !== "number")) { 19959 this.setTime(args[0]); 19960 } else if (typeof args[0] === "string") { 19961 this.setTime(+new Date(args[0])); 19962 } else if (args[0] instanceof Date) { 19963 this.setTime(+args[0]); 19964 } else { 19965 this.setTime(+new Date(...args)); 19966 adjustToSystemTZ(this, args); 19967 } 19968 } 19969 } 19970 static tz(tz, ...args) { 19971 return args.length ? new _TZDateMini(...args, tz) : new _TZDateMini(Date.now(), tz); 19972 } 19973 //#endregion 19974 //#region time zone 19975 withTimeZone(timeZone) { 19976 return new _TZDateMini(+this, timeZone); 19977 } 19978 getTimezoneOffset() { 19979 const offset4 = -tzOffset(this.timeZone, this); 19980 return offset4 > 0 ? Math.floor(offset4) : Math.ceil(offset4); 19981 } 19982 //#endregion 19983 //#region time 19984 setTime(_time) { 19985 Date.prototype.setTime.apply(this, arguments); 19986 syncToInternal(this); 19987 return +this; 19988 } 19989 //#endregion 19990 //#region date-fns integration 19991 [/* @__PURE__ */ Symbol.for("constructDateFrom")](date) { 19992 return new _TZDateMini(+new Date(date), this.timeZone); 19993 } 19994 //#endregion 19995 }; 19996 var re = /^(get|set)(?!UTC)/; 19997 Object.getOwnPropertyNames(Date.prototype).forEach((method) => { 19998 if (!re.test(method)) return; 19999 const utcMethod = method.replace(re, "$1UTC"); 20000 if (!TZDateMini.prototype[utcMethod]) return; 20001 if (method.startsWith("get")) { 20002 TZDateMini.prototype[method] = function() { 20003 return this.internal[utcMethod](); 20004 }; 20005 } else { 20006 TZDateMini.prototype[method] = function() { 20007 Date.prototype[utcMethod].apply(this.internal, arguments); 20008 syncFromInternal(this); 20009 return +this; 20010 }; 20011 TZDateMini.prototype[utcMethod] = function() { 20012 Date.prototype[utcMethod].apply(this, arguments); 20013 syncToInternal(this); 20014 return +this; 20015 }; 20016 } 20017 }); 20018 function syncToInternal(date) { 20019 date.internal.setTime(+date); 20020 date.internal.setUTCSeconds(date.internal.getUTCSeconds() - // Round after converting minutes to seconds to avoid fractional offset 20021 // precision errors from historical offsets. 20022 Math.round(-tzOffset(date.timeZone, date) * 60)); 20023 } 20024 function syncFromInternal(date) { 20025 Date.prototype.setFullYear.call(date, date.internal.getUTCFullYear(), date.internal.getUTCMonth(), date.internal.getUTCDate()); 20026 Date.prototype.setHours.call(date, date.internal.getUTCHours(), date.internal.getUTCMinutes(), date.internal.getUTCSeconds(), date.internal.getUTCMilliseconds()); 20027 adjustToSystemTZ(date); 20028 } 20029 function adjustToSystemTZ(date, constructorArgs) { 20030 const expectedInternalTime = Array.isArray(constructorArgs) ? constructorArgsToInternalTime(constructorArgs) : +date.internal; 20031 const offsetWithSeconds = tzOffset(date.timeZone, date); 20032 const offset4 = offsetWithSeconds > 0 ? Math.floor(offsetWithSeconds) : Math.ceil(offsetWithSeconds); 20033 const prevHour = /* @__PURE__ */ new Date(+date); 20034 prevHour.setUTCHours(prevHour.getUTCHours() - 1); 20035 const systemOffset = -(/* @__PURE__ */ new Date(+date)).getTimezoneOffset(); 20036 const prevHourSystemOffset = -(/* @__PURE__ */ new Date(+prevHour)).getTimezoneOffset(); 20037 const systemDSTChange = systemOffset - prevHourSystemOffset; 20038 let systemOffsetForDiff = systemOffset; 20039 if (systemDSTChange && systemOffset !== offset4) { 20040 const systemHour = Date.prototype.getHours.apply(date); 20041 const expectedHour = Array.isArray(constructorArgs) ? constructorArgs[3] || 0 : date.internal.getUTCHours(); 20042 if (systemHour !== expectedHour) { 20043 const testDate = /* @__PURE__ */ new Date(+date); 20044 const testOffsetDiff = systemOffset - offset4; 20045 if (testOffsetDiff) testDate.setUTCMinutes(testDate.getUTCMinutes() + testOffsetDiff); 20046 const testOffsetWithSeconds = tzOffset(date.timeZone, testDate); 20047 const testOffset = testOffsetWithSeconds > 0 ? Math.floor(testOffsetWithSeconds) : Math.ceil(testOffsetWithSeconds); 20048 if (testOffset === offset4) systemOffsetForDiff = prevHourSystemOffset; 20049 } 20050 } 20051 const offsetDiff = systemOffsetForDiff - offset4; 20052 if (offsetDiff) 20053 Date.prototype.setUTCMinutes.call(date, Date.prototype.getUTCMinutes.call(date) + offsetDiff); 20054 const systemDate = /* @__PURE__ */ new Date(+date); 20055 systemDate.setUTCSeconds(0); 20056 const systemSecondsOffset = systemOffset > 0 ? systemDate.getSeconds() : (systemDate.getSeconds() - 60) % 60; 20057 const secondsOffset = Math.round(-(tzOffset(date.timeZone, date) * 60)) % 60; 20058 if (secondsOffset || systemSecondsOffset) 20059 Date.prototype.setUTCSeconds.call(date, Date.prototype.getUTCSeconds.call(date) + secondsOffset + systemSecondsOffset); 20060 const postOffsetWithSeconds = tzOffset(date.timeZone, date); 20061 const postOffset = postOffsetWithSeconds > 0 ? Math.floor(postOffsetWithSeconds) : Math.ceil(postOffsetWithSeconds); 20062 const postSystemOffset = -(/* @__PURE__ */ new Date(+date)).getTimezoneOffset(); 20063 const postOffsetDiff = postSystemOffset - postOffset; 20064 const offsetChanged = postOffset !== offset4; 20065 const postDiff = postOffsetDiff - offsetDiff; 20066 const targetDSTShift = postOffset - offset4; 20067 const postOffsetCandidate = expectedInternalTime - postOffset * 60 * 1e3; 20068 const normalizedTargetDSTGap = targetDSTShift > 0 && targetInternalTime(date) - expectedInternalTime === targetDSTShift * 60 * 1e3 && targetInternalTime(date, postOffsetCandidate) !== expectedInternalTime; 20069 if (offsetChanged && postDiff && !normalizedTargetDSTGap) { 20070 Date.prototype.setUTCMinutes.call(date, Date.prototype.getUTCMinutes.call(date) + postDiff); 20071 const newOffsetWithSeconds = tzOffset(date.timeZone, date); 20072 const newOffset = newOffsetWithSeconds > 0 ? Math.floor(newOffsetWithSeconds) : Math.ceil(newOffsetWithSeconds); 20073 const offsetChange = postOffset - newOffset; 20074 if (offsetChange && postDiff < 0) { 20075 Date.prototype.setUTCMinutes.call(date, Date.prototype.getUTCMinutes.call(date) + offsetChange); 20076 } 20077 } 20078 syncToInternal(date); 20079 const expectedTime = constructorArgs ? expectedInternalTime : expectedInternalTime + secondsOffset * 1e3; 20080 const drift = expectedTime - +date.internal; 20081 if (drift && Math.abs(drift) < 30 * 60 * 1e3) { 20082 Date.prototype.setTime.call(date, +date + drift); 20083 syncToInternal(date); 20084 } 20085 } 20086 function constructorArgsToInternalTime(args) { 20087 return Date.UTC(args[0], args.length > 1 ? args[1] : 0, args.length > 2 ? args[2] : 1, ...args.slice(3)); 20088 } 20089 function targetInternalTime(date, time) { 20090 const internal = new Date(time ?? +date); 20091 internal.setUTCSeconds(internal.getUTCSeconds() - Math.round(-tzOffset(date.timeZone, internal) * 60)); 20092 return +internal; 20093 } 20094 20095 // node_modules/@date-fns/tz/date/index.js 20096 var TZDate = class _TZDate extends TZDateMini { 20097 //#region static 20098 static tz(tz, ...args) { 20099 return args.length ? new _TZDate(...args, tz) : new _TZDate(Date.now(), tz); 20100 } 20101 //#endregion 20102 //#region representation 20103 toISOString() { 20104 const [sign, hours, minutes] = this.tzComponents(); 20105 const tz = `$sign}$hours}:$minutes}`; 20106 return this.internal.toISOString().slice(0, -1) + tz; 20107 } 20108 toString() { 20109 return `$this.toDateString()} $this.toTimeString()}`; 20110 } 20111 toDateString() { 20112 const [day, date, month, year] = this.internal.toUTCString().split(" "); 20113 return `$day?.slice(0, -1)} $month} $date} $year}`; 20114 } 20115 toTimeString() { 20116 const time = this.internal.toUTCString().split(" ")[4]; 20117 const [sign, hours, minutes] = this.tzComponents(); 20118 return `$time} GMT$sign}$hours}$minutes} ($tzName(this.timeZone, this)})`; 20119 } 20120 toLocaleString(locales, options) { 20121 return Date.prototype.toLocaleString.call(this, locales, { 20122 ...options, 20123 timeZone: options?.timeZone || this.timeZone 20124 }); 20125 } 20126 toLocaleDateString(locales, options) { 20127 return Date.prototype.toLocaleDateString.call(this, locales, { 20128 ...options, 20129 timeZone: options?.timeZone || this.timeZone 20130 }); 20131 } 20132 toLocaleTimeString(locales, options) { 20133 return Date.prototype.toLocaleTimeString.call(this, locales, { 20134 ...options, 20135 timeZone: options?.timeZone || this.timeZone 20136 }); 20137 } 20138 //#endregion 20139 //#region private 20140 tzComponents() { 20141 const offset4 = this.getTimezoneOffset(); 20142 const sign = offset4 > 0 ? "-" : "+"; 20143 const hours = String(Math.floor(Math.abs(offset4) / 60)).padStart(2, "0"); 20144 const minutes = String(Math.abs(offset4) % 60).padStart(2, "0"); 20145 return [sign, hours, minutes]; 20146 } 20147 //#endregion 20148 withTimeZone(timeZone) { 20149 return new _TZDate(+this, timeZone); 20150 } 20151 //#region date-fns integration 20152 [/* @__PURE__ */ Symbol.for("constructDateFrom")](date) { 20153 return new _TZDate(+new Date(date), this.timeZone); 20154 } 20155 //#endregion 20156 }; 20157 20158 // node_modules/date-fns/constants.js 20159 var daysInYear = 365.2425; 20160 var maxTime = Math.pow(10, 8) * 24 * 60 * 60 * 1e3; 20161 var minTime = -maxTime; 20162 var millisecondsInWeek = 6048e5; 20163 var millisecondsInDay = 864e5; 20164 var millisecondsInMinute = 6e4; 20165 var millisecondsInHour = 36e5; 20166 var millisecondsInSecond = 1e3; 20167 var secondsInHour = 3600; 20168 var secondsInDay = secondsInHour * 24; 20169 var secondsInWeek = secondsInDay * 7; 20170 var secondsInYear = secondsInDay * daysInYear; 20171 var secondsInMonth = secondsInYear / 12; 20172 var secondsInQuarter = secondsInMonth * 3; 20173 var constructFromSymbol = /* @__PURE__ */ Symbol.for("constructDateFrom"); 20174 20175 // node_modules/date-fns/constructFrom.js 20176 function constructFrom(date, value) { 20177 if (typeof date === "function") return date(value); 20178 if (date && typeof date === "object" && constructFromSymbol in date) 20179 return date[constructFromSymbol](value); 20180 if (date instanceof Date) return new date.constructor(value); 20181 return new Date(value); 20182 } 20183 20184 // node_modules/date-fns/toDate.js 20185 function toDate(argument, context) { 20186 return constructFrom(context || argument, argument); 20187 } 20188 20189 // node_modules/date-fns/addDays.js 20190 function addDays(date, amount, options) { 20191 const _date = toDate(date, options?.in); 20192 if (isNaN(amount)) return constructFrom(options?.in || date, NaN); 20193 if (!amount) return _date; 20194 _date.setDate(_date.getDate() + amount); 20195 return _date; 20196 } 20197 20198 // node_modules/date-fns/addMonths.js 20199 function addMonths(date, amount, options) { 20200 const _date = toDate(date, options?.in); 20201 if (isNaN(amount)) return constructFrom(options?.in || date, NaN); 20202 if (!amount) { 20203 return _date; 20204 } 20205 const dayOfMonth = _date.getDate(); 20206 const endOfDesiredMonth = constructFrom(options?.in || date, _date.getTime()); 20207 endOfDesiredMonth.setMonth(_date.getMonth() + amount + 1, 0); 20208 const daysInMonth = endOfDesiredMonth.getDate(); 20209 if (dayOfMonth >= daysInMonth) { 20210 return endOfDesiredMonth; 20211 } else { 20212 _date.setFullYear( 20213 endOfDesiredMonth.getFullYear(), 20214 endOfDesiredMonth.getMonth(), 20215 dayOfMonth 20216 ); 20217 return _date; 20218 } 20219 } 20220 20221 // node_modules/date-fns/_lib/defaultOptions.js 20222 var defaultOptions = {}; 20223 function getDefaultOptions() { 20224 return defaultOptions; 20225 } 20226 20227 // node_modules/date-fns/startOfWeek.js 20228 function startOfWeek(date, options) { 20229 const defaultOptions2 = getDefaultOptions(); 20230 const weekStartsOn = options?.weekStartsOn ?? options?.locale?.options?.weekStartsOn ?? defaultOptions2.weekStartsOn ?? defaultOptions2.locale?.options?.weekStartsOn ?? 0; 20231 const _date = toDate(date, options?.in); 20232 const day = _date.getDay(); 20233 const diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn; 20234 _date.setDate(_date.getDate() - diff); 20235 _date.setHours(0, 0, 0, 0); 20236 return _date; 20237 } 20238 20239 // node_modules/date-fns/startOfISOWeek.js 20240 function startOfISOWeek(date, options) { 20241 return startOfWeek(date, { ...options, weekStartsOn: 1 }); 20242 } 20243 20244 // node_modules/date-fns/getISOWeekYear.js 20245 function getISOWeekYear(date, options) { 20246 const _date = toDate(date, options?.in); 20247 const year = _date.getFullYear(); 20248 const fourthOfJanuaryOfNextYear = constructFrom(_date, 0); 20249 fourthOfJanuaryOfNextYear.setFullYear(year + 1, 0, 4); 20250 fourthOfJanuaryOfNextYear.setHours(0, 0, 0, 0); 20251 const startOfNextYear = startOfISOWeek(fourthOfJanuaryOfNextYear); 20252 const fourthOfJanuaryOfThisYear = constructFrom(_date, 0); 20253 fourthOfJanuaryOfThisYear.setFullYear(year, 0, 4); 20254 fourthOfJanuaryOfThisYear.setHours(0, 0, 0, 0); 20255 const startOfThisYear = startOfISOWeek(fourthOfJanuaryOfThisYear); 20256 if (_date.getTime() >= startOfNextYear.getTime()) { 20257 return year + 1; 20258 } else if (_date.getTime() >= startOfThisYear.getTime()) { 20259 return year; 20260 } else { 20261 return year - 1; 20262 } 20263 } 20264 20265 // node_modules/date-fns/_lib/getTimezoneOffsetInMilliseconds.js 20266 function getTimezoneOffsetInMilliseconds(date) { 20267 const _date = toDate(date); 20268 const utcDate = new Date( 20269 Date.UTC( 20270 _date.getFullYear(), 20271 _date.getMonth(), 20272 _date.getDate(), 20273 _date.getHours(), 20274 _date.getMinutes(), 20275 _date.getSeconds(), 20276 _date.getMilliseconds() 20277 ) 20278 ); 20279 utcDate.setUTCFullYear(_date.getFullYear()); 20280 return +date - +utcDate; 20281 } 20282 20283 // node_modules/date-fns/_lib/normalizeDates.js 20284 function normalizeDates(context, ...dates) { 20285 const normalize = constructFrom.bind( 20286 null, 20287 context || dates.find((date) => typeof date === "object") 20288 ); 20289 return dates.map(normalize); 20290 } 20291 20292 // node_modules/date-fns/startOfDay.js 20293 function startOfDay(date, options) { 20294 const _date = toDate(date, options?.in); 20295 _date.setHours(0, 0, 0, 0); 20296 return _date; 20297 } 20298 20299 // node_modules/date-fns/differenceInCalendarDays.js 20300 function differenceInCalendarDays(laterDate, earlierDate, options) { 20301 const [laterDate_, earlierDate_] = normalizeDates( 20302 options?.in, 20303 laterDate, 20304 earlierDate 20305 ); 20306 const laterStartOfDay = startOfDay(laterDate_); 20307 const earlierStartOfDay = startOfDay(earlierDate_); 20308 const laterTimestamp = +laterStartOfDay - getTimezoneOffsetInMilliseconds(laterStartOfDay); 20309 const earlierTimestamp = +earlierStartOfDay - getTimezoneOffsetInMilliseconds(earlierStartOfDay); 20310 return Math.round((laterTimestamp - earlierTimestamp) / millisecondsInDay); 20311 } 20312 20313 // node_modules/date-fns/startOfISOWeekYear.js 20314 function startOfISOWeekYear(date, options) { 20315 const year = getISOWeekYear(date, options); 20316 const fourthOfJanuary = constructFrom(options?.in || date, 0); 20317 fourthOfJanuary.setFullYear(year, 0, 4); 20318 fourthOfJanuary.setHours(0, 0, 0, 0); 20319 return startOfISOWeek(fourthOfJanuary); 20320 } 20321 20322 // node_modules/date-fns/addWeeks.js 20323 function addWeeks(date, amount, options) { 20324 return addDays(date, amount * 7, options); 20325 } 20326 20327 // node_modules/date-fns/addYears.js 20328 function addYears(date, amount, options) { 20329 return addMonths(date, amount * 12, options); 20330 } 20331 20332 // node_modules/date-fns/areIntervalsOverlapping.js 20333 function areIntervalsOverlapping(intervalLeft, intervalRight, options) { 20334 const [leftStartTime, leftEndTime] = [ 20335 +toDate(intervalLeft.start, options?.in), 20336 +toDate(intervalLeft.end, options?.in) 20337 ].sort((a, b) => a - b); 20338 const [rightStartTime, rightEndTime] = [ 20339 +toDate(intervalRight.start, options?.in), 20340 +toDate(intervalRight.end, options?.in) 20341 ].sort((a, b) => a - b); 20342 if (options?.inclusive) 20343 return leftStartTime <= rightEndTime && rightStartTime <= leftEndTime; 20344 return leftStartTime < rightEndTime && rightStartTime < leftEndTime; 20345 } 20346 20347 // node_modules/date-fns/max.js 20348 function max2(dates, options) { 20349 let result; 20350 let context = options?.in; 20351 dates.forEach((date) => { 20352 if (!context && typeof date === "object") 20353 context = constructFrom.bind(null, date); 20354 const date_ = toDate(date, context); 20355 if (!result || result < date_ || isNaN(+date_)) result = date_; 20356 }); 20357 return constructFrom(context, result || NaN); 20358 } 20359 20360 // node_modules/date-fns/min.js 20361 function min2(dates, options) { 20362 let result; 20363 let context = options?.in; 20364 dates.forEach((date) => { 20365 if (!context && typeof date === "object") 20366 context = constructFrom.bind(null, date); 20367 const date_ = toDate(date, context); 20368 if (!result || result > date_ || isNaN(+date_)) result = date_; 20369 }); 20370 return constructFrom(context, result || NaN); 20371 } 20372 20373 // node_modules/date-fns/isSameDay.js 20374 function isSameDay(laterDate, earlierDate, options) { 20375 const [dateLeft_, dateRight_] = normalizeDates( 20376 options?.in, 20377 laterDate, 20378 earlierDate 20379 ); 20380 return +startOfDay(dateLeft_) === +startOfDay(dateRight_); 20381 } 20382 20383 // node_modules/date-fns/isDate.js 20384 function isDate(value) { 20385 return value instanceof Date || typeof value === "object" && Object.prototype.toString.call(value) === "[object Date]"; 20386 } 20387 20388 // node_modules/date-fns/isValid.js 20389 function isValid(date) { 20390 return !(!isDate(date) && typeof date !== "number" || isNaN(+toDate(date))); 20391 } 20392 20393 // node_modules/date-fns/differenceInCalendarMonths.js 20394 function differenceInCalendarMonths(laterDate, earlierDate, options) { 20395 const [laterDate_, earlierDate_] = normalizeDates( 20396 options?.in, 20397 laterDate, 20398 earlierDate 20399 ); 20400 const yearsDiff = laterDate_.getFullYear() - earlierDate_.getFullYear(); 20401 const monthsDiff = laterDate_.getMonth() - earlierDate_.getMonth(); 20402 return yearsDiff * 12 + monthsDiff; 20403 } 20404 20405 // node_modules/date-fns/endOfMonth.js 20406 function endOfMonth(date, options) { 20407 const _date = toDate(date, options?.in); 20408 const month = _date.getMonth(); 20409 _date.setFullYear(_date.getFullYear(), month + 1, 0); 20410 _date.setHours(23, 59, 59, 999); 20411 return _date; 20412 } 20413 20414 // node_modules/date-fns/_lib/normalizeInterval.js 20415 function normalizeInterval(context, interval) { 20416 const [start, end] = normalizeDates(context, interval.start, interval.end); 20417 return { start, end }; 20418 } 20419 20420 // node_modules/date-fns/eachMonthOfInterval.js 20421 function eachMonthOfInterval(interval, options) { 20422 const { start, end } = normalizeInterval(options?.in, interval); 20423 let reversed = +start > +end; 20424 const endTime = reversed ? +start : +end; 20425 const date = reversed ? end : start; 20426 date.setHours(0, 0, 0, 0); 20427 date.setDate(1); 20428 let step = options?.step ?? 1; 20429 if (!step) return []; 20430 if (step < 0) { 20431 step = -step; 20432 reversed = !reversed; 20433 } 20434 const dates = []; 20435 while (+date <= endTime) { 20436 dates.push(constructFrom(start, date)); 20437 date.setMonth(date.getMonth() + step); 20438 } 20439 return reversed ? dates.reverse() : dates; 20440 } 20441 20442 // node_modules/date-fns/startOfMonth.js 20443 function startOfMonth(date, options) { 20444 const _date = toDate(date, options?.in); 20445 _date.setDate(1); 20446 _date.setHours(0, 0, 0, 0); 20447 return _date; 20448 } 20449 20450 // node_modules/date-fns/endOfYear.js 20451 function endOfYear(date, options) { 20452 const _date = toDate(date, options?.in); 20453 const year = _date.getFullYear(); 20454 _date.setFullYear(year + 1, 0, 0); 20455 _date.setHours(23, 59, 59, 999); 20456 return _date; 20457 } 20458 20459 // node_modules/date-fns/startOfYear.js 20460 function startOfYear(date, options) { 20461 const date_ = toDate(date, options?.in); 20462 date_.setFullYear(date_.getFullYear(), 0, 1); 20463 date_.setHours(0, 0, 0, 0); 20464 return date_; 20465 } 20466 20467 // node_modules/date-fns/eachYearOfInterval.js 20468 function eachYearOfInterval(interval, options) { 20469 const { start, end } = normalizeInterval(options?.in, interval); 20470 let reversed = +start > +end; 20471 const endTime = reversed ? +start : +end; 20472 const date = reversed ? end : start; 20473 date.setHours(0, 0, 0, 0); 20474 date.setMonth(0, 1); 20475 let step = options?.step ?? 1; 20476 if (!step) return []; 20477 if (step < 0) { 20478 step = -step; 20479 reversed = !reversed; 20480 } 20481 const dates = []; 20482 while (+date <= endTime) { 20483 dates.push(constructFrom(start, date)); 20484 date.setFullYear(date.getFullYear() + step); 20485 } 20486 return reversed ? dates.reverse() : dates; 20487 } 20488 20489 // node_modules/date-fns/endOfWeek.js 20490 function endOfWeek(date, options) { 20491 const defaultOptions2 = getDefaultOptions(); 20492 const weekStartsOn = options?.weekStartsOn ?? options?.locale?.options?.weekStartsOn ?? defaultOptions2.weekStartsOn ?? defaultOptions2.locale?.options?.weekStartsOn ?? 0; 20493 const _date = toDate(date, options?.in); 20494 const day = _date.getDay(); 20495 const diff = (day < weekStartsOn ? -7 : 0) + 6 - (day - weekStartsOn); 20496 _date.setDate(_date.getDate() + diff); 20497 _date.setHours(23, 59, 59, 999); 20498 return _date; 20499 } 20500 20501 // node_modules/date-fns/endOfISOWeek.js 20502 function endOfISOWeek(date, options) { 20503 return endOfWeek(date, { ...options, weekStartsOn: 1 }); 20504 } 20505 20506 // node_modules/date-fns/locale/en-US/_lib/formatDistance.js 20507 var formatDistanceLocale = { 20508 lessThanXSeconds: { 20509 one: "less than a second", 20510 other: "less than {{count}} seconds" 20511 }, 20512 xSeconds: { 20513 one: "1 second", 20514 other: "{{count}} seconds" 20515 }, 20516 halfAMinute: "half a minute", 20517 lessThanXMinutes: { 20518 one: "less than a minute", 20519 other: "less than {{count}} minutes" 20520 }, 20521 xMinutes: { 20522 one: "1 minute", 20523 other: "{{count}} minutes" 20524 }, 20525 aboutXHours: { 20526 one: "about 1 hour", 20527 other: "about {{count}} hours" 20528 }, 20529 xHours: { 20530 one: "1 hour", 20531 other: "{{count}} hours" 20532 }, 20533 xDays: { 20534 one: "1 day", 20535 other: "{{count}} days" 20536 }, 20537 aboutXWeeks: { 20538 one: "about 1 week", 20539 other: "about {{count}} weeks" 20540 }, 20541 xWeeks: { 20542 one: "1 week", 20543 other: "{{count}} weeks" 20544 }, 20545 aboutXMonths: { 20546 one: "about 1 month", 20547 other: "about {{count}} months" 20548 }, 20549 xMonths: { 20550 one: "1 month", 20551 other: "{{count}} months" 20552 }, 20553 aboutXYears: { 20554 one: "about 1 year", 20555 other: "about {{count}} years" 20556 }, 20557 xYears: { 20558 one: "1 year", 20559 other: "{{count}} years" 20560 }, 20561 overXYears: { 20562 one: "over 1 year", 20563 other: "over {{count}} years" 20564 }, 20565 almostXYears: { 20566 one: "almost 1 year", 20567 other: "almost {{count}} years" 20568 } 20569 }; 20570 var formatDistance = (token, count, options) => { 20571 let result; 20572 const tokenValue = formatDistanceLocale[token]; 20573 if (typeof tokenValue === "string") { 20574 result = tokenValue; 20575 } else if (count === 1) { 20576 result = tokenValue.one; 20577 } else { 20578 result = tokenValue.other.replace("{{count}}", count.toString()); 20579 } 20580 if (options?.addSuffix) { 20581 if (options.comparison && options.comparison > 0) { 20582 return "in " + result; 20583 } else { 20584 return result + " ago"; 20585 } 20586 } 20587 return result; 20588 }; 20589 20590 // node_modules/date-fns/locale/_lib/buildFormatLongFn.js 20591 function buildFormatLongFn(args) { 20592 return (options = {}) => { 20593 const width = options.width ? String(options.width) : args.defaultWidth; 20594 const format7 = args.formats[width] || args.formats[args.defaultWidth]; 20595 return format7; 20596 }; 20597 } 20598 20599 // node_modules/date-fns/locale/en-US/_lib/formatLong.js 20600 var dateFormats = { 20601 full: "EEEE, MMMM do, y", 20602 long: "MMMM do, y", 20603 medium: "MMM d, y", 20604 short: "MM/dd/yyyy" 20605 }; 20606 var timeFormats = { 20607 full: "h:mm:ss a zzzz", 20608 long: "h:mm:ss a z", 20609 medium: "h:mm:ss a", 20610 short: "h:mm a" 20611 }; 20612 var dateTimeFormats = { 20613 full: "{{date}} 'at' {{time}}", 20614 long: "{{date}} 'at' {{time}}", 20615 medium: "{{date}}, {{time}}", 20616 short: "{{date}}, {{time}}" 20617 }; 20618 var formatLong = { 20619 date: buildFormatLongFn({ 20620 formats: dateFormats, 20621 defaultWidth: "full" 20622 }), 20623 time: buildFormatLongFn({ 20624 formats: timeFormats, 20625 defaultWidth: "full" 20626 }), 20627 dateTime: buildFormatLongFn({ 20628 formats: dateTimeFormats, 20629 defaultWidth: "full" 20630 }) 20631 }; 20632 20633 // node_modules/date-fns/locale/en-US/_lib/formatRelative.js 20634 var formatRelativeLocale = { 20635 lastWeek: "'last' eeee 'at' p", 20636 yesterday: "'yesterday at' p", 20637 today: "'today at' p", 20638 tomorrow: "'tomorrow at' p", 20639 nextWeek: "eeee 'at' p", 20640 other: "P" 20641 }; 20642 var formatRelative = (token, _date, _baseDate, _options) => formatRelativeLocale[token]; 20643 20644 // node_modules/date-fns/locale/_lib/buildLocalizeFn.js 20645 function buildLocalizeFn(args) { 20646 return (value, options) => { 20647 const context = options?.context ? String(options.context) : "standalone"; 20648 let valuesArray; 20649 if (context === "formatting" && args.formattingValues) { 20650 const defaultWidth = args.defaultFormattingWidth || args.defaultWidth; 20651 const width = options?.width ? String(options.width) : defaultWidth; 20652 valuesArray = args.formattingValues[width] || args.formattingValues[defaultWidth]; 20653 } else { 20654 const defaultWidth = args.defaultWidth; 20655 const width = options?.width ? String(options.width) : args.defaultWidth; 20656 valuesArray = args.values[width] || args.values[defaultWidth]; 20657 } 20658 const index2 = args.argumentCallback ? args.argumentCallback(value) : value; 20659 return valuesArray[index2]; 20660 }; 20661 } 20662 20663 // node_modules/date-fns/locale/en-US/_lib/localize.js 20664 var eraValues = { 20665 narrow: ["B", "A"], 20666 abbreviated: ["BC", "AD"], 20667 wide: ["Before Christ", "Anno Domini"] 20668 }; 20669 var quarterValues = { 20670 narrow: ["1", "2", "3", "4"], 20671 abbreviated: ["Q1", "Q2", "Q3", "Q4"], 20672 wide: ["1st quarter", "2nd quarter", "3rd quarter", "4th quarter"] 20673 }; 20674 var monthValues = { 20675 narrow: ["J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"], 20676 abbreviated: [ 20677 "Jan", 20678 "Feb", 20679 "Mar", 20680 "Apr", 20681 "May", 20682 "Jun", 20683 "Jul", 20684 "Aug", 20685 "Sep", 20686 "Oct", 20687 "Nov", 20688 "Dec" 20689 ], 20690 wide: [ 20691 "January", 20692 "February", 20693 "March", 20694 "April", 20695 "May", 20696 "June", 20697 "July", 20698 "August", 20699 "September", 20700 "October", 20701 "November", 20702 "December" 20703 ] 20704 }; 20705 var dayValues = { 20706 narrow: ["S", "M", "T", "W", "T", "F", "S"], 20707 short: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"], 20708 abbreviated: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], 20709 wide: [ 20710 "Sunday", 20711 "Monday", 20712 "Tuesday", 20713 "Wednesday", 20714 "Thursday", 20715 "Friday", 20716 "Saturday" 20717 ] 20718 }; 20719 var dayPeriodValues = { 20720 narrow: { 20721 am: "a", 20722 pm: "p", 20723 midnight: "mi", 20724 noon: "n", 20725 morning: "morning", 20726 afternoon: "afternoon", 20727 evening: "evening", 20728 night: "night" 20729 }, 20730 abbreviated: { 20731 am: "AM", 20732 pm: "PM", 20733 midnight: "midnight", 20734 noon: "noon", 20735 morning: "morning", 20736 afternoon: "afternoon", 20737 evening: "evening", 20738 night: "night" 20739 }, 20740 wide: { 20741 am: "a.m.", 20742 pm: "p.m.", 20743 midnight: "midnight", 20744 noon: "noon", 20745 morning: "morning", 20746 afternoon: "afternoon", 20747 evening: "evening", 20748 night: "night" 20749 } 20750 }; 20751 var formattingDayPeriodValues = { 20752 narrow: { 20753 am: "a", 20754 pm: "p", 20755 midnight: "mi", 20756 noon: "n", 20757 morning: "in the morning", 20758 afternoon: "in the afternoon", 20759 evening: "in the evening", 20760 night: "at night" 20761 }, 20762 abbreviated: { 20763 am: "AM", 20764 pm: "PM", 20765 midnight: "midnight", 20766 noon: "noon", 20767 morning: "in the morning", 20768 afternoon: "in the afternoon", 20769 evening: "in the evening", 20770 night: "at night" 20771 }, 20772 wide: { 20773 am: "a.m.", 20774 pm: "p.m.", 20775 midnight: "midnight", 20776 noon: "noon", 20777 morning: "in the morning", 20778 afternoon: "in the afternoon", 20779 evening: "in the evening", 20780 night: "at night" 20781 } 20782 }; 20783 var ordinalNumber = (dirtyNumber, _options) => { 20784 const number = Number(dirtyNumber); 20785 const rem100 = number % 100; 20786 if (rem100 > 20 || rem100 < 10) { 20787 switch (rem100 % 10) { 20788 case 1: 20789 return number + "st"; 20790 case 2: 20791 return number + "nd"; 20792 case 3: 20793 return number + "rd"; 20794 } 20795 } 20796 return number + "th"; 20797 }; 20798 var localize = { 20799 ordinalNumber, 20800 era: buildLocalizeFn({ 20801 values: eraValues, 20802 defaultWidth: "wide" 20803 }), 20804 quarter: buildLocalizeFn({ 20805 values: quarterValues, 20806 defaultWidth: "wide", 20807 argumentCallback: (quarter) => quarter - 1 20808 }), 20809 month: buildLocalizeFn({ 20810 values: monthValues, 20811 defaultWidth: "wide" 20812 }), 20813 day: buildLocalizeFn({ 20814 values: dayValues, 20815 defaultWidth: "wide" 20816 }), 20817 dayPeriod: buildLocalizeFn({ 20818 values: dayPeriodValues, 20819 defaultWidth: "wide", 20820 formattingValues: formattingDayPeriodValues, 20821 defaultFormattingWidth: "wide" 20822 }) 20823 }; 20824 20825 // node_modules/date-fns/locale/_lib/buildMatchFn.js 20826 function buildMatchFn(args) { 20827 return (string, options = {}) => { 20828 const width = options.width; 20829 const matchPattern = width && args.matchPatterns[width] || args.matchPatterns[args.defaultMatchWidth]; 20830 const matchResult = string.match(matchPattern); 20831 if (!matchResult) { 20832 return null; 20833 } 20834 const matchedString = matchResult[0]; 20835 const parsePatterns = width && args.parsePatterns[width] || args.parsePatterns[args.defaultParseWidth]; 20836 const key = Array.isArray(parsePatterns) ? findIndex(parsePatterns, (pattern) => pattern.test(matchedString)) : ( 20837 // [TODO] -- I challenge you to fix the type 20838 findKey(parsePatterns, (pattern) => pattern.test(matchedString)) 20839 ); 20840 let value; 20841 value = args.valueCallback ? args.valueCallback(key) : key; 20842 value = options.valueCallback ? ( 20843 // [TODO] -- I challenge you to fix the type 20844 options.valueCallback(value) 20845 ) : value; 20846 const rest = string.slice(matchedString.length); 20847 return { value, rest }; 20848 }; 20849 } 20850 function findKey(object, predicate) { 20851 for (const key in object) { 20852 if (Object.prototype.hasOwnProperty.call(object, key) && predicate(object[key])) { 20853 return key; 20854 } 20855 } 20856 return void 0; 20857 } 20858 function findIndex(array, predicate) { 20859 for (let key = 0; key < array.length; key++) { 20860 if (predicate(array[key])) { 20861 return key; 20862 } 20863 } 20864 return void 0; 20865 } 20866 20867 // node_modules/date-fns/locale/_lib/buildMatchPatternFn.js 20868 function buildMatchPatternFn(args) { 20869 return (string, options = {}) => { 20870 const matchResult = string.match(args.matchPattern); 20871 if (!matchResult) return null; 20872 const matchedString = matchResult[0]; 20873 const parseResult = string.match(args.parsePattern); 20874 if (!parseResult) return null; 20875 let value = args.valueCallback ? args.valueCallback(parseResult[0]) : parseResult[0]; 20876 value = options.valueCallback ? options.valueCallback(value) : value; 20877 const rest = string.slice(matchedString.length); 20878 return { value, rest }; 20879 }; 20880 } 20881 20882 // node_modules/date-fns/locale/en-US/_lib/match.js 20883 var matchOrdinalNumberPattern = /^(\d+)(th|st|nd|rd)?/i; 20884 var parseOrdinalNumberPattern = /\d+/i; 20885 var matchEraPatterns = { 20886 narrow: /^(b|a)/i, 20887 abbreviated: /^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i, 20888 wide: /^(before christ|before common era|anno domini|common era)/i 20889 }; 20890 var parseEraPatterns = { 20891 any: [/^b/i, /^(a|c)/i] 20892 }; 20893 var matchQuarterPatterns = { 20894 narrow: /^[1234]/i, 20895 abbreviated: /^q[1234]/i, 20896 wide: /^[1234](th|st|nd|rd)? quarter/i 20897 }; 20898 var parseQuarterPatterns = { 20899 any: [/1/i, /2/i, /3/i, /4/i] 20900 }; 20901 var matchMonthPatterns = { 20902 narrow: /^[jfmasond]/i, 20903 abbreviated: /^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i, 20904 wide: /^(january|february|march|april|may|june|july|august|september|october|november|december)/i 20905 }; 20906 var parseMonthPatterns = { 20907 narrow: [ 20908 /^j/i, 20909 /^f/i, 20910 /^m/i, 20911 /^a/i, 20912 /^m/i, 20913 /^j/i, 20914 /^j/i, 20915 /^a/i, 20916 /^s/i, 20917 /^o/i, 20918 /^n/i, 20919 /^d/i 20920 ], 20921 any: [ 20922 /^ja/i, 20923 /^f/i, 20924 /^mar/i, 20925 /^ap/i, 20926 /^may/i, 20927 /^jun/i, 20928 /^jul/i, 20929 /^au/i, 20930 /^s/i, 20931 /^o/i, 20932 /^n/i, 20933 /^d/i 20934 ] 20935 }; 20936 var matchDayPatterns = { 20937 narrow: /^[smtwf]/i, 20938 short: /^(su|mo|tu|we|th|fr|sa)/i, 20939 abbreviated: /^(sun|mon|tue|wed|thu|fri|sat)/i, 20940 wide: /^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i 20941 }; 20942 var parseDayPatterns = { 20943 narrow: [/^s/i, /^m/i, /^t/i, /^w/i, /^t/i, /^f/i, /^s/i], 20944 any: [/^su/i, /^m/i, /^tu/i, /^w/i, /^th/i, /^f/i, /^sa/i] 20945 }; 20946 var matchDayPeriodPatterns = { 20947 narrow: /^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i, 20948 any: /^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i 20949 }; 20950 var parseDayPeriodPatterns = { 20951 any: { 20952 am: /^a/i, 20953 pm: /^p/i, 20954 midnight: /^mi/i, 20955 noon: /^no/i, 20956 morning: /morning/i, 20957 afternoon: /afternoon/i, 20958 evening: /evening/i, 20959 night: /night/i 20960 } 20961 }; 20962 var match = { 20963 ordinalNumber: buildMatchPatternFn({ 20964 matchPattern: matchOrdinalNumberPattern, 20965 parsePattern: parseOrdinalNumberPattern, 20966 valueCallback: (value) => parseInt(value, 10) 20967 }), 20968 era: buildMatchFn({ 20969 matchPatterns: matchEraPatterns, 20970 defaultMatchWidth: "wide", 20971 parsePatterns: parseEraPatterns, 20972 defaultParseWidth: "any" 20973 }), 20974 quarter: buildMatchFn({ 20975 matchPatterns: matchQuarterPatterns, 20976 defaultMatchWidth: "wide", 20977 parsePatterns: parseQuarterPatterns, 20978 defaultParseWidth: "any", 20979 valueCallback: (index2) => index2 + 1 20980 }), 20981 month: buildMatchFn({ 20982 matchPatterns: matchMonthPatterns, 20983 defaultMatchWidth: "wide", 20984 parsePatterns: parseMonthPatterns, 20985 defaultParseWidth: "any" 20986 }), 20987 day: buildMatchFn({ 20988 matchPatterns: matchDayPatterns, 20989 defaultMatchWidth: "wide", 20990 parsePatterns: parseDayPatterns, 20991 defaultParseWidth: "any" 20992 }), 20993 dayPeriod: buildMatchFn({ 20994 matchPatterns: matchDayPeriodPatterns, 20995 defaultMatchWidth: "any", 20996 parsePatterns: parseDayPeriodPatterns, 20997 defaultParseWidth: "any" 20998 }) 20999 }; 21000 21001 // node_modules/date-fns/locale/en-US.js 21002 var enUS = { 21003 code: "en-US", 21004 formatDistance, 21005 formatLong, 21006 formatRelative, 21007 localize, 21008 match, 21009 options: { 21010 weekStartsOn: 0, 21011 firstWeekContainsDate: 1 21012 } 21013 }; 21014 21015 // node_modules/date-fns/getDayOfYear.js 21016 function getDayOfYear(date, options) { 21017 const _date = toDate(date, options?.in); 21018 const diff = differenceInCalendarDays(_date, startOfYear(_date)); 21019 const dayOfYear = diff + 1; 21020 return dayOfYear; 21021 } 21022 21023 // node_modules/date-fns/getISOWeek.js 21024 function getISOWeek(date, options) { 21025 const _date = toDate(date, options?.in); 21026 const diff = +startOfISOWeek(_date) - +startOfISOWeekYear(_date); 21027 return Math.round(diff / millisecondsInWeek) + 1; 21028 } 21029 21030 // node_modules/date-fns/getWeekYear.js 21031 function getWeekYear(date, options) { 21032 const _date = toDate(date, options?.in); 21033 const year = _date.getFullYear(); 21034 const defaultOptions2 = getDefaultOptions(); 21035 const firstWeekContainsDate = options?.firstWeekContainsDate ?? options?.locale?.options?.firstWeekContainsDate ?? defaultOptions2.firstWeekContainsDate ?? defaultOptions2.locale?.options?.firstWeekContainsDate ?? 1; 21036 const firstWeekOfNextYear = constructFrom(options?.in || date, 0); 21037 firstWeekOfNextYear.setFullYear(year + 1, 0, firstWeekContainsDate); 21038 firstWeekOfNextYear.setHours(0, 0, 0, 0); 21039 const startOfNextYear = startOfWeek(firstWeekOfNextYear, options); 21040 const firstWeekOfThisYear = constructFrom(options?.in || date, 0); 21041 firstWeekOfThisYear.setFullYear(year, 0, firstWeekContainsDate); 21042 firstWeekOfThisYear.setHours(0, 0, 0, 0); 21043 const startOfThisYear = startOfWeek(firstWeekOfThisYear, options); 21044 if (+_date >= +startOfNextYear) { 21045 return year + 1; 21046 } else if (+_date >= +startOfThisYear) { 21047 return year; 21048 } else { 21049 return year - 1; 21050 } 21051 } 21052 21053 // node_modules/date-fns/startOfWeekYear.js 21054 function startOfWeekYear(date, options) { 21055 const defaultOptions2 = getDefaultOptions(); 21056 const firstWeekContainsDate = options?.firstWeekContainsDate ?? options?.locale?.options?.firstWeekContainsDate ?? defaultOptions2.firstWeekContainsDate ?? defaultOptions2.locale?.options?.firstWeekContainsDate ?? 1; 21057 const year = getWeekYear(date, options); 21058 const firstWeek = constructFrom(options?.in || date, 0); 21059 firstWeek.setFullYear(year, 0, firstWeekContainsDate); 21060 firstWeek.setHours(0, 0, 0, 0); 21061 const _date = startOfWeek(firstWeek, options); 21062 return _date; 21063 } 21064 21065 // node_modules/date-fns/getWeek.js 21066 function getWeek(date, options) { 21067 const _date = toDate(date, options?.in); 21068 const diff = +startOfWeek(_date, options) - +startOfWeekYear(_date, options); 21069 return Math.round(diff / millisecondsInWeek) + 1; 21070 } 21071 21072 // node_modules/date-fns/_lib/addLeadingZeros.js 21073 function addLeadingZeros(number, targetLength) { 21074 const sign = number < 0 ? "-" : ""; 21075 const output = Math.abs(number).toString().padStart(targetLength, "0"); 21076 return sign + output; 21077 } 21078 21079 // node_modules/date-fns/_lib/format/lightFormatters.js 21080 var lightFormatters = { 21081 // Year 21082 y(date, token) { 21083 const signedYear = date.getFullYear(); 21084 const year = signedYear > 0 ? signedYear : 1 - signedYear; 21085 return addLeadingZeros(token === "yy" ? year % 100 : year, token.length); 21086 }, 21087 // Month 21088 M(date, token) { 21089 const month = date.getMonth(); 21090 return token === "M" ? String(month + 1) : addLeadingZeros(month + 1, 2); 21091 }, 21092 // Day of the month 21093 d(date, token) { 21094 return addLeadingZeros(date.getDate(), token.length); 21095 }, 21096 // AM or PM 21097 a(date, token) { 21098 const dayPeriodEnumValue = date.getHours() / 12 >= 1 ? "pm" : "am"; 21099 switch (token) { 21100 case "a": 21101 case "aa": 21102 return dayPeriodEnumValue.toUpperCase(); 21103 case "aaa": 21104 return dayPeriodEnumValue; 21105 case "aaaaa": 21106 return dayPeriodEnumValue[0]; 21107 case "aaaa": 21108 default: 21109 return dayPeriodEnumValue === "am" ? "a.m." : "p.m."; 21110 } 21111 }, 21112 // Hour [1-12] 21113 h(date, token) { 21114 return addLeadingZeros(date.getHours() % 12 || 12, token.length); 21115 }, 21116 // Hour [0-23] 21117 H(date, token) { 21118 return addLeadingZeros(date.getHours(), token.length); 21119 }, 21120 // Minute 21121 m(date, token) { 21122 return addLeadingZeros(date.getMinutes(), token.length); 21123 }, 21124 // Second 21125 s(date, token) { 21126 return addLeadingZeros(date.getSeconds(), token.length); 21127 }, 21128 // Fraction of second 21129 S(date, token) { 21130 const numberOfDigits = token.length; 21131 const milliseconds = date.getMilliseconds(); 21132 const fractionalSeconds = Math.trunc( 21133 milliseconds * Math.pow(10, numberOfDigits - 3) 21134 ); 21135 return addLeadingZeros(fractionalSeconds, token.length); 21136 } 21137 }; 21138 21139 // node_modules/date-fns/_lib/format/formatters.js 21140 var dayPeriodEnum = { 21141 am: "am", 21142 pm: "pm", 21143 midnight: "midnight", 21144 noon: "noon", 21145 morning: "morning", 21146 afternoon: "afternoon", 21147 evening: "evening", 21148 night: "night" 21149 }; 21150 var formatters = { 21151 // Era 21152 G: function(date, token, localize2) { 21153 const era = date.getFullYear() > 0 ? 1 : 0; 21154 switch (token) { 21155 // AD, BC 21156 case "G": 21157 case "GG": 21158 case "GGG": 21159 return localize2.era(era, { width: "abbreviated" }); 21160 // A, B 21161 case "GGGGG": 21162 return localize2.era(era, { width: "narrow" }); 21163 // Anno Domini, Before Christ 21164 case "GGGG": 21165 default: 21166 return localize2.era(era, { width: "wide" }); 21167 } 21168 }, 21169 // Year 21170 y: function(date, token, localize2) { 21171 if (token === "yo") { 21172 const signedYear = date.getFullYear(); 21173 const year = signedYear > 0 ? signedYear : 1 - signedYear; 21174 return localize2.ordinalNumber(year, { unit: "year" }); 21175 } 21176 return lightFormatters.y(date, token); 21177 }, 21178 // Local week-numbering year 21179 Y: function(date, token, localize2, options) { 21180 const signedWeekYear = getWeekYear(date, options); 21181 const weekYear = signedWeekYear > 0 ? signedWeekYear : 1 - signedWeekYear; 21182 if (token === "YY") { 21183 const twoDigitYear = weekYear % 100; 21184 return addLeadingZeros(twoDigitYear, 2); 21185 } 21186 if (token === "Yo") { 21187 return localize2.ordinalNumber(weekYear, { unit: "year" }); 21188 } 21189 return addLeadingZeros(weekYear, token.length); 21190 }, 21191 // ISO week-numbering year 21192 R: function(date, token) { 21193 const isoWeekYear = getISOWeekYear(date); 21194 return addLeadingZeros(isoWeekYear, token.length); 21195 }, 21196 // Extended year. This is a single number designating the year of this calendar system. 21197 // The main difference between `y` and `u` localizers are B.C. years: 21198 // | Year | `y` | `u` | 21199 // |------|-----|-----| 21200 // | AC 1 | 1 | 1 | 21201 // | BC 1 | 1 | 0 | 21202 // | BC 2 | 2 | -1 | 21203 // Also `yy` always returns the last two digits of a year, 21204 // while `uu` pads single digit years to 2 characters and returns other years unchanged. 21205 u: function(date, token) { 21206 const year = date.getFullYear(); 21207 return addLeadingZeros(year, token.length); 21208 }, 21209 // Quarter 21210 Q: function(date, token, localize2) { 21211 const quarter = Math.ceil((date.getMonth() + 1) / 3); 21212 switch (token) { 21213 // 1, 2, 3, 4 21214 case "Q": 21215 return String(quarter); 21216 // 01, 02, 03, 04 21217 case "QQ": 21218 return addLeadingZeros(quarter, 2); 21219 // 1st, 2nd, 3rd, 4th 21220 case "Qo": 21221 return localize2.ordinalNumber(quarter, { unit: "quarter" }); 21222 // Q1, Q2, Q3, Q4 21223 case "QQQ": 21224 return localize2.quarter(quarter, { 21225 width: "abbreviated", 21226 context: "formatting" 21227 }); 21228 // 1, 2, 3, 4 (narrow quarter; could be not numerical) 21229 case "QQQQQ": 21230 return localize2.quarter(quarter, { 21231 width: "narrow", 21232 context: "formatting" 21233 }); 21234 // 1st quarter, 2nd quarter, ... 21235 case "QQQQ": 21236 default: 21237 return localize2.quarter(quarter, { 21238 width: "wide", 21239 context: "formatting" 21240 }); 21241 } 21242 }, 21243 // Stand-alone quarter 21244 q: function(date, token, localize2) { 21245 const quarter = Math.ceil((date.getMonth() + 1) / 3); 21246 switch (token) { 21247 // 1, 2, 3, 4 21248 case "q": 21249 return String(quarter); 21250 // 01, 02, 03, 04 21251 case "qq": 21252 return addLeadingZeros(quarter, 2); 21253 // 1st, 2nd, 3rd, 4th 21254 case "qo": 21255 return localize2.ordinalNumber(quarter, { unit: "quarter" }); 21256 // Q1, Q2, Q3, Q4 21257 case "qqq": 21258 return localize2.quarter(quarter, { 21259 width: "abbreviated", 21260 context: "standalone" 21261 }); 21262 // 1, 2, 3, 4 (narrow quarter; could be not numerical) 21263 case "qqqqq": 21264 return localize2.quarter(quarter, { 21265 width: "narrow", 21266 context: "standalone" 21267 }); 21268 // 1st quarter, 2nd quarter, ... 21269 case "qqqq": 21270 default: 21271 return localize2.quarter(quarter, { 21272 width: "wide", 21273 context: "standalone" 21274 }); 21275 } 21276 }, 21277 // Month 21278 M: function(date, token, localize2) { 21279 const month = date.getMonth(); 21280 switch (token) { 21281 case "M": 21282 case "MM": 21283 return lightFormatters.M(date, token); 21284 // 1st, 2nd, ..., 12th 21285 case "Mo": 21286 return localize2.ordinalNumber(month + 1, { unit: "month" }); 21287 // Jan, Feb, ..., Dec 21288 case "MMM": 21289 return localize2.month(month, { 21290 width: "abbreviated", 21291 context: "formatting" 21292 }); 21293 // J, F, ..., D 21294 case "MMMMM": 21295 return localize2.month(month, { 21296 width: "narrow", 21297 context: "formatting" 21298 }); 21299 // January, February, ..., December 21300 case "MMMM": 21301 default: 21302 return localize2.month(month, { width: "wide", context: "formatting" }); 21303 } 21304 }, 21305 // Stand-alone month 21306 L: function(date, token, localize2) { 21307 const month = date.getMonth(); 21308 switch (token) { 21309 // 1, 2, ..., 12 21310 case "L": 21311 return String(month + 1); 21312 // 01, 02, ..., 12 21313 case "LL": 21314 return addLeadingZeros(month + 1, 2); 21315 // 1st, 2nd, ..., 12th 21316 case "Lo": 21317 return localize2.ordinalNumber(month + 1, { unit: "month" }); 21318 // Jan, Feb, ..., Dec 21319 case "LLL": 21320 return localize2.month(month, { 21321 width: "abbreviated", 21322 context: "standalone" 21323 }); 21324 // J, F, ..., D 21325 case "LLLLL": 21326 return localize2.month(month, { 21327 width: "narrow", 21328 context: "standalone" 21329 }); 21330 // January, February, ..., December 21331 case "LLLL": 21332 default: 21333 return localize2.month(month, { width: "wide", context: "standalone" }); 21334 } 21335 }, 21336 // Local week of year 21337 w: function(date, token, localize2, options) { 21338 const week = getWeek(date, options); 21339 if (token === "wo") { 21340 return localize2.ordinalNumber(week, { unit: "week" }); 21341 } 21342 return addLeadingZeros(week, token.length); 21343 }, 21344 // ISO week of year 21345 I: function(date, token, localize2) { 21346 const isoWeek = getISOWeek(date); 21347 if (token === "Io") { 21348 return localize2.ordinalNumber(isoWeek, { unit: "week" }); 21349 } 21350 return addLeadingZeros(isoWeek, token.length); 21351 }, 21352 // Day of the month 21353 d: function(date, token, localize2) { 21354 if (token === "do") { 21355 return localize2.ordinalNumber(date.getDate(), { unit: "date" }); 21356 } 21357 return lightFormatters.d(date, token); 21358 }, 21359 // Day of year 21360 D: function(date, token, localize2) { 21361 const dayOfYear = getDayOfYear(date); 21362 if (token === "Do") { 21363 return localize2.ordinalNumber(dayOfYear, { unit: "dayOfYear" }); 21364 } 21365 return addLeadingZeros(dayOfYear, token.length); 21366 }, 21367 // Day of week 21368 E: function(date, token, localize2) { 21369 const dayOfWeek = date.getDay(); 21370 switch (token) { 21371 // Tue 21372 case "E": 21373 case "EE": 21374 case "EEE": 21375 return localize2.day(dayOfWeek, { 21376 width: "abbreviated", 21377 context: "formatting" 21378 }); 21379 // T 21380 case "EEEEE": 21381 return localize2.day(dayOfWeek, { 21382 width: "narrow", 21383 context: "formatting" 21384 }); 21385 // Tu 21386 case "EEEEEE": 21387 return localize2.day(dayOfWeek, { 21388 width: "short", 21389 context: "formatting" 21390 }); 21391 // Tuesday 21392 case "EEEE": 21393 default: 21394 return localize2.day(dayOfWeek, { 21395 width: "wide", 21396 context: "formatting" 21397 }); 21398 } 21399 }, 21400 // Local day of week 21401 e: function(date, token, localize2, options) { 21402 const dayOfWeek = date.getDay(); 21403 const localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7; 21404 switch (token) { 21405 // Numerical value (Nth day of week with current locale or weekStartsOn) 21406 case "e": 21407 return String(localDayOfWeek); 21408 // Padded numerical value 21409 case "ee": 21410 return addLeadingZeros(localDayOfWeek, 2); 21411 // 1st, 2nd, ..., 7th 21412 case "eo": 21413 return localize2.ordinalNumber(localDayOfWeek, { unit: "day" }); 21414 case "eee": 21415 return localize2.day(dayOfWeek, { 21416 width: "abbreviated", 21417 context: "formatting" 21418 }); 21419 // T 21420 case "eeeee": 21421 return localize2.day(dayOfWeek, { 21422 width: "narrow", 21423 context: "formatting" 21424 }); 21425 // Tu 21426 case "eeeeee": 21427 return localize2.day(dayOfWeek, { 21428 width: "short", 21429 context: "formatting" 21430 }); 21431 // Tuesday 21432 case "eeee": 21433 default: 21434 return localize2.day(dayOfWeek, { 21435 width: "wide", 21436 context: "formatting" 21437 }); 21438 } 21439 }, 21440 // Stand-alone local day of week 21441 c: function(date, token, localize2, options) { 21442 const dayOfWeek = date.getDay(); 21443 const localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7; 21444 switch (token) { 21445 // Numerical value (same as in `e`) 21446 case "c": 21447 return String(localDayOfWeek); 21448 // Padded numerical value 21449 case "cc": 21450 return addLeadingZeros(localDayOfWeek, token.length); 21451 // 1st, 2nd, ..., 7th 21452 case "co": 21453 return localize2.ordinalNumber(localDayOfWeek, { unit: "day" }); 21454 case "ccc": 21455 return localize2.day(dayOfWeek, { 21456 width: "abbreviated", 21457 context: "standalone" 21458 }); 21459 // T 21460 case "ccccc": 21461 return localize2.day(dayOfWeek, { 21462 width: "narrow", 21463 context: "standalone" 21464 }); 21465 // Tu 21466 case "cccccc": 21467 return localize2.day(dayOfWeek, { 21468 width: "short", 21469 context: "standalone" 21470 }); 21471 // Tuesday 21472 case "cccc": 21473 default: 21474 return localize2.day(dayOfWeek, { 21475 width: "wide", 21476 context: "standalone" 21477 }); 21478 } 21479 }, 21480 // ISO day of week 21481 i: function(date, token, localize2) { 21482 const dayOfWeek = date.getDay(); 21483 const isoDayOfWeek = dayOfWeek === 0 ? 7 : dayOfWeek; 21484 switch (token) { 21485 // 2 21486 case "i": 21487 return String(isoDayOfWeek); 21488 // 02 21489 case "ii": 21490 return addLeadingZeros(isoDayOfWeek, token.length); 21491 // 2nd 21492 case "io": 21493 return localize2.ordinalNumber(isoDayOfWeek, { unit: "day" }); 21494 // Tue 21495 case "iii": 21496 return localize2.day(dayOfWeek, { 21497 width: "abbreviated", 21498 context: "formatting" 21499 }); 21500 // T 21501 case "iiiii": 21502 return localize2.day(dayOfWeek, { 21503 width: "narrow", 21504 context: "formatting" 21505 }); 21506 // Tu 21507 case "iiiiii": 21508 return localize2.day(dayOfWeek, { 21509 width: "short", 21510 context: "formatting" 21511 }); 21512 // Tuesday 21513 case "iiii": 21514 default: 21515 return localize2.day(dayOfWeek, { 21516 width: "wide", 21517 context: "formatting" 21518 }); 21519 } 21520 }, 21521 // AM or PM 21522 a: function(date, token, localize2) { 21523 const hours = date.getHours(); 21524 const dayPeriodEnumValue = hours / 12 >= 1 ? "pm" : "am"; 21525 switch (token) { 21526 case "a": 21527 case "aa": 21528 return localize2.dayPeriod(dayPeriodEnumValue, { 21529 width: "abbreviated", 21530 context: "formatting" 21531 }); 21532 case "aaa": 21533 return localize2.dayPeriod(dayPeriodEnumValue, { 21534 width: "abbreviated", 21535 context: "formatting" 21536 }).toLowerCase(); 21537 case "aaaaa": 21538 return localize2.dayPeriod(dayPeriodEnumValue, { 21539 width: "narrow", 21540 context: "formatting" 21541 }); 21542 case "aaaa": 21543 default: 21544 return localize2.dayPeriod(dayPeriodEnumValue, { 21545 width: "wide", 21546 context: "formatting" 21547 }); 21548 } 21549 }, 21550 // AM, PM, midnight, noon 21551 b: function(date, token, localize2) { 21552 const hours = date.getHours(); 21553 let dayPeriodEnumValue; 21554 if (hours === 12) { 21555 dayPeriodEnumValue = dayPeriodEnum.noon; 21556 } else if (hours === 0) { 21557 dayPeriodEnumValue = dayPeriodEnum.midnight; 21558 } else { 21559 dayPeriodEnumValue = hours / 12 >= 1 ? "pm" : "am"; 21560 } 21561 switch (token) { 21562 case "b": 21563 case "bb": 21564 return localize2.dayPeriod(dayPeriodEnumValue, { 21565 width: "abbreviated", 21566 context: "formatting" 21567 }); 21568 case "bbb": 21569 return localize2.dayPeriod(dayPeriodEnumValue, { 21570 width: "abbreviated", 21571 context: "formatting" 21572 }).toLowerCase(); 21573 case "bbbbb": 21574 return localize2.dayPeriod(dayPeriodEnumValue, { 21575 width: "narrow", 21576 context: "formatting" 21577 }); 21578 case "bbbb": 21579 default: 21580 return localize2.dayPeriod(dayPeriodEnumValue, { 21581 width: "wide", 21582 context: "formatting" 21583 }); 21584 } 21585 }, 21586 // in the morning, in the afternoon, in the evening, at night 21587 B: function(date, token, localize2) { 21588 const hours = date.getHours(); 21589 let dayPeriodEnumValue; 21590 if (hours >= 17) { 21591 dayPeriodEnumValue = dayPeriodEnum.evening; 21592 } else if (hours >= 12) { 21593 dayPeriodEnumValue = dayPeriodEnum.afternoon; 21594 } else if (hours >= 4) { 21595 dayPeriodEnumValue = dayPeriodEnum.morning; 21596 } else { 21597 dayPeriodEnumValue = dayPeriodEnum.night; 21598 } 21599 switch (token) { 21600 case "B": 21601 case "BB": 21602 case "BBB": 21603 return localize2.dayPeriod(dayPeriodEnumValue, { 21604 width: "abbreviated", 21605 context: "formatting" 21606 }); 21607 case "BBBBB": 21608 return localize2.dayPeriod(dayPeriodEnumValue, { 21609 width: "narrow", 21610 context: "formatting" 21611 }); 21612 case "BBBB": 21613 default: 21614 return localize2.dayPeriod(dayPeriodEnumValue, { 21615 width: "wide", 21616 context: "formatting" 21617 }); 21618 } 21619 }, 21620 // Hour [1-12] 21621 h: function(date, token, localize2) { 21622 if (token === "ho") { 21623 let hours = date.getHours() % 12; 21624 if (hours === 0) hours = 12; 21625 return localize2.ordinalNumber(hours, { unit: "hour" }); 21626 } 21627 return lightFormatters.h(date, token); 21628 }, 21629 // Hour [0-23] 21630 H: function(date, token, localize2) { 21631 if (token === "Ho") { 21632 return localize2.ordinalNumber(date.getHours(), { unit: "hour" }); 21633 } 21634 return lightFormatters.H(date, token); 21635 }, 21636 // Hour [0-11] 21637 K: function(date, token, localize2) { 21638 const hours = date.getHours() % 12; 21639 if (token === "Ko") { 21640 return localize2.ordinalNumber(hours, { unit: "hour" }); 21641 } 21642 return addLeadingZeros(hours, token.length); 21643 }, 21644 // Hour [1-24] 21645 k: function(date, token, localize2) { 21646 let hours = date.getHours(); 21647 if (hours === 0) hours = 24; 21648 if (token === "ko") { 21649 return localize2.ordinalNumber(hours, { unit: "hour" }); 21650 } 21651 return addLeadingZeros(hours, token.length); 21652 }, 21653 // Minute 21654 m: function(date, token, localize2) { 21655 if (token === "mo") { 21656 return localize2.ordinalNumber(date.getMinutes(), { unit: "minute" }); 21657 } 21658 return lightFormatters.m(date, token); 21659 }, 21660 // Second 21661 s: function(date, token, localize2) { 21662 if (token === "so") { 21663 return localize2.ordinalNumber(date.getSeconds(), { unit: "second" }); 21664 } 21665 return lightFormatters.s(date, token); 21666 }, 21667 // Fraction of second 21668 S: function(date, token) { 21669 return lightFormatters.S(date, token); 21670 }, 21671 // Timezone (ISO-8601. If offset is 0, output is always `'Z'`) 21672 X: function(date, token, _localize) { 21673 const timezoneOffset = date.getTimezoneOffset(); 21674 if (timezoneOffset === 0) { 21675 return "Z"; 21676 } 21677 switch (token) { 21678 // Hours and optional minutes 21679 case "X": 21680 return formatTimezoneWithOptionalMinutes(timezoneOffset); 21681 // Hours, minutes and optional seconds without `:` delimiter 21682 // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets 21683 // so this token always has the same output as `XX` 21684 case "XXXX": 21685 case "XX": 21686 return formatTimezone(timezoneOffset); 21687 // Hours, minutes and optional seconds with `:` delimiter 21688 // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets 21689 // so this token always has the same output as `XXX` 21690 case "XXXXX": 21691 case "XXX": 21692 // Hours and minutes with `:` delimiter 21693 default: 21694 return formatTimezone(timezoneOffset, ":"); 21695 } 21696 }, 21697 // Timezone (ISO-8601. If offset is 0, output is `'+00:00'` or equivalent) 21698 x: function(date, token, _localize) { 21699 const timezoneOffset = date.getTimezoneOffset(); 21700 switch (token) { 21701 // Hours and optional minutes 21702 case "x": 21703 return formatTimezoneWithOptionalMinutes(timezoneOffset); 21704 // Hours, minutes and optional seconds without `:` delimiter 21705 // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets 21706 // so this token always has the same output as `xx` 21707 case "xxxx": 21708 case "xx": 21709 return formatTimezone(timezoneOffset); 21710 // Hours, minutes and optional seconds with `:` delimiter 21711 // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets 21712 // so this token always has the same output as `xxx` 21713 case "xxxxx": 21714 case "xxx": 21715 // Hours and minutes with `:` delimiter 21716 default: 21717 return formatTimezone(timezoneOffset, ":"); 21718 } 21719 }, 21720 // Timezone (GMT) 21721 O: function(date, token, _localize) { 21722 const timezoneOffset = date.getTimezoneOffset(); 21723 switch (token) { 21724 // Short 21725 case "O": 21726 case "OO": 21727 case "OOO": 21728 return "GMT" + formatTimezoneShort(timezoneOffset, ":"); 21729 // Long 21730 case "OOOO": 21731 default: 21732 return "GMT" + formatTimezone(timezoneOffset, ":"); 21733 } 21734 }, 21735 // Timezone (specific non-location) 21736 z: function(date, token, _localize) { 21737 const timezoneOffset = date.getTimezoneOffset(); 21738 switch (token) { 21739 // Short 21740 case "z": 21741 case "zz": 21742 case "zzz": 21743 return "GMT" + formatTimezoneShort(timezoneOffset, ":"); 21744 // Long 21745 case "zzzz": 21746 default: 21747 return "GMT" + formatTimezone(timezoneOffset, ":"); 21748 } 21749 }, 21750 // Seconds timestamp 21751 t: function(date, token, _localize) { 21752 const timestamp = Math.trunc(+date / 1e3); 21753 return addLeadingZeros(timestamp, token.length); 21754 }, 21755 // Milliseconds timestamp 21756 T: function(date, token, _localize) { 21757 return addLeadingZeros(+date, token.length); 21758 } 21759 }; 21760 function formatTimezoneShort(offset4, delimiter = "") { 21761 const sign = offset4 > 0 ? "-" : "+"; 21762 const absOffset = Math.abs(offset4); 21763 const hours = Math.trunc(absOffset / 60); 21764 const minutes = absOffset % 60; 21765 if (minutes === 0) { 21766 return sign + String(hours); 21767 } 21768 return sign + String(hours) + delimiter + addLeadingZeros(minutes, 2); 21769 } 21770 function formatTimezoneWithOptionalMinutes(offset4, delimiter) { 21771 if (offset4 % 60 === 0) { 21772 const sign = offset4 > 0 ? "-" : "+"; 21773 return sign + addLeadingZeros(Math.abs(offset4) / 60, 2); 21774 } 21775 return formatTimezone(offset4, delimiter); 21776 } 21777 function formatTimezone(offset4, delimiter = "") { 21778 const sign = offset4 > 0 ? "-" : "+"; 21779 const absOffset = Math.abs(offset4); 21780 const hours = addLeadingZeros(Math.trunc(absOffset / 60), 2); 21781 const minutes = addLeadingZeros(absOffset % 60, 2); 21782 return sign + hours + delimiter + minutes; 21783 } 21784 21785 // node_modules/date-fns/_lib/format/longFormatters.js 21786 var dateLongFormatter = (pattern, formatLong2) => { 21787 switch (pattern) { 21788 case "P": 21789 return formatLong2.date({ width: "short" }); 21790 case "PP": 21791 return formatLong2.date({ width: "medium" }); 21792 case "PPP": 21793 return formatLong2.date({ width: "long" }); 21794 case "PPPP": 21795 default: 21796 return formatLong2.date({ width: "full" }); 21797 } 21798 }; 21799 var timeLongFormatter = (pattern, formatLong2) => { 21800 switch (pattern) { 21801 case "p": 21802 return formatLong2.time({ width: "short" }); 21803 case "pp": 21804 return formatLong2.time({ width: "medium" }); 21805 case "ppp": 21806 return formatLong2.time({ width: "long" }); 21807 case "pppp": 21808 default: 21809 return formatLong2.time({ width: "full" }); 21810 } 21811 }; 21812 var dateTimeLongFormatter = (pattern, formatLong2) => { 21813 const matchResult = pattern.match(/(P+)(p+)?/) || []; 21814 const datePattern = matchResult[1]; 21815 const timePattern = matchResult[2]; 21816 if (!timePattern) { 21817 return dateLongFormatter(pattern, formatLong2); 21818 } 21819 let dateTimeFormat; 21820 switch (datePattern) { 21821 case "P": 21822 dateTimeFormat = formatLong2.dateTime({ width: "short" }); 21823 break; 21824 case "PP": 21825 dateTimeFormat = formatLong2.dateTime({ width: "medium" }); 21826 break; 21827 case "PPP": 21828 dateTimeFormat = formatLong2.dateTime({ width: "long" }); 21829 break; 21830 case "PPPP": 21831 default: 21832 dateTimeFormat = formatLong2.dateTime({ width: "full" }); 21833 break; 21834 } 21835 return dateTimeFormat.replace("{{date}}", dateLongFormatter(datePattern, formatLong2)).replace("{{time}}", timeLongFormatter(timePattern, formatLong2)); 21836 }; 21837 var longFormatters = { 21838 p: timeLongFormatter, 21839 P: dateTimeLongFormatter 21840 }; 21841 21842 // node_modules/date-fns/_lib/protectedTokens.js 21843 var dayOfYearTokenRE = /^D+$/; 21844 var weekYearTokenRE = /^Y+$/; 21845 var throwTokens = ["D", "DD", "YY", "YYYY"]; 21846 function isProtectedDayOfYearToken(token) { 21847 return dayOfYearTokenRE.test(token); 21848 } 21849 function isProtectedWeekYearToken(token) { 21850 return weekYearTokenRE.test(token); 21851 } 21852 function warnOrThrowProtectedError(token, format7, input) { 21853 const _message = message(token, format7, input); 21854 console.warn(_message); 21855 if (throwTokens.includes(token)) throw new RangeError(_message); 21856 } 21857 function message(token, format7, input) { 21858 const subject = token[0] === "Y" ? "years" : "days of the month"; 21859 return `Use \`$token.toLowerCase()}\` instead of \`$token}\` (in \`$format7}\`) for formatting $subject} to the input \`$input}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`; 21860 } 21861 21862 // node_modules/date-fns/format.js 21863 var formattingTokensRegExp = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g; 21864 var longFormattingTokensRegExp = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g; 21865 var escapedStringRegExp = /^'([^]*?)'?$/; 21866 var doubleQuoteRegExp = /''/g; 21867 var unescapedLatinCharacterRegExp = /[a-zA-Z]/; 21868 function format(date, formatStr, options) { 21869 const defaultOptions2 = getDefaultOptions(); 21870 const locale = options?.locale ?? defaultOptions2.locale ?? enUS; 21871 const firstWeekContainsDate = options?.firstWeekContainsDate ?? options?.locale?.options?.firstWeekContainsDate ?? defaultOptions2.firstWeekContainsDate ?? defaultOptions2.locale?.options?.firstWeekContainsDate ?? 1; 21872 const weekStartsOn = options?.weekStartsOn ?? options?.locale?.options?.weekStartsOn ?? defaultOptions2.weekStartsOn ?? defaultOptions2.locale?.options?.weekStartsOn ?? 0; 21873 const originalDate = toDate(date, options?.in); 21874 if (!isValid(originalDate)) { 21875 throw new RangeError("Invalid time value"); 21876 } 21877 let parts = formatStr.match(longFormattingTokensRegExp).map((substring) => { 21878 const firstCharacter = substring[0]; 21879 if (firstCharacter === "p" || firstCharacter === "P") { 21880 const longFormatter = longFormatters[firstCharacter]; 21881 return longFormatter(substring, locale.formatLong); 21882 } 21883 return substring; 21884 }).join("").match(formattingTokensRegExp).map((substring) => { 21885 if (substring === "''") { 21886 return { isToken: false, value: "'" }; 21887 } 21888 const firstCharacter = substring[0]; 21889 if (firstCharacter === "'") { 21890 return { isToken: false, value: cleanEscapedString(substring) }; 21891 } 21892 if (formatters[firstCharacter]) { 21893 return { isToken: true, value: substring }; 21894 } 21895 if (firstCharacter.match(unescapedLatinCharacterRegExp)) { 21896 throw new RangeError( 21897 "Format string contains an unescaped latin alphabet character `" + firstCharacter + "`" 21898 ); 21899 } 21900 return { isToken: false, value: substring }; 21901 }); 21902 if (locale.localize.preprocessor) { 21903 parts = locale.localize.preprocessor(originalDate, parts); 21904 } 21905 const formatterOptions = { 21906 firstWeekContainsDate, 21907 weekStartsOn, 21908 locale 21909 }; 21910 return parts.map((part) => { 21911 if (!part.isToken) return part.value; 21912 const token = part.value; 21913 if (!options?.useAdditionalWeekYearTokens && isProtectedWeekYearToken(token) || !options?.useAdditionalDayOfYearTokens && isProtectedDayOfYearToken(token)) { 21914 warnOrThrowProtectedError(token, formatStr, String(date)); 21915 } 21916 const formatter = formatters[token[0]]; 21917 return formatter(originalDate, token, locale.localize, formatterOptions); 21918 }).join(""); 21919 } 21920 function cleanEscapedString(input) { 21921 const matched = input.match(escapedStringRegExp); 21922 if (!matched) { 21923 return input; 21924 } 21925 return matched[1].replace(doubleQuoteRegExp, "'"); 21926 } 21927 21928 // node_modules/date-fns/getDaysInMonth.js 21929 function getDaysInMonth(date, options) { 21930 const _date = toDate(date, options?.in); 21931 const year = _date.getFullYear(); 21932 const monthIndex = _date.getMonth(); 21933 const lastDayOfMonth = constructFrom(_date, 0); 21934 lastDayOfMonth.setFullYear(year, monthIndex + 1, 0); 21935 lastDayOfMonth.setHours(0, 0, 0, 0); 21936 return lastDayOfMonth.getDate(); 21937 } 21938 21939 // node_modules/date-fns/getDefaultOptions.js 21940 function getDefaultOptions2() { 21941 return Object.assign({}, getDefaultOptions()); 21942 } 21943 21944 // node_modules/date-fns/getISODay.js 21945 function getISODay(date, options) { 21946 const day = toDate(date, options?.in).getDay(); 21947 return day === 0 ? 7 : day; 21948 } 21949 21950 // node_modules/date-fns/getMonth.js 21951 function getMonth(date, options) { 21952 return toDate(date, options?.in).getMonth(); 21953 } 21954 21955 // node_modules/date-fns/getYear.js 21956 function getYear(date, options) { 21957 return toDate(date, options?.in).getFullYear(); 21958 } 21959 21960 // node_modules/date-fns/isAfter.js 21961 function isAfter(date, dateToCompare) { 21962 return +toDate(date) > +toDate(dateToCompare); 21963 } 21964 21965 // node_modules/date-fns/isBefore.js 21966 function isBefore(date, dateToCompare) { 21967 return +toDate(date) < +toDate(dateToCompare); 21968 } 21969 21970 // node_modules/date-fns/transpose.js 21971 function transpose(date, constructor) { 21972 const date_ = isConstructor(constructor) ? new constructor(0) : constructFrom(constructor, 0); 21973 date_.setFullYear(date.getFullYear(), date.getMonth(), date.getDate()); 21974 date_.setHours( 21975 date.getHours(), 21976 date.getMinutes(), 21977 date.getSeconds(), 21978 date.getMilliseconds() 21979 ); 21980 return date_; 21981 } 21982 function isConstructor(constructor) { 21983 return typeof constructor === "function" && constructor.prototype?.constructor === constructor; 21984 } 21985 21986 // node_modules/date-fns/parse/_lib/Setter.js 21987 var TIMEZONE_UNIT_PRIORITY = 10; 21988 var Setter = class { 21989 subPriority = 0; 21990 validate(_utcDate, _options) { 21991 return true; 21992 } 21993 }; 21994 var ValueSetter = class extends Setter { 21995 constructor(value, validateValue, setValue, priority, subPriority) { 21996 super(); 21997 this.value = value; 21998 this.validateValue = validateValue; 21999 this.setValue = setValue; 22000 this.priority = priority; 22001 if (subPriority) { 22002 this.subPriority = subPriority; 22003 } 22004 } 22005 validate(date, options) { 22006 return this.validateValue(date, this.value, options); 22007 } 22008 set(date, flags, options) { 22009 return this.setValue(date, flags, this.value, options); 22010 } 22011 }; 22012 var DateTimezoneSetter = class extends Setter { 22013 priority = TIMEZONE_UNIT_PRIORITY; 22014 subPriority = -1; 22015 constructor(context, reference) { 22016 super(); 22017 this.context = context || ((date) => constructFrom(reference, date)); 22018 } 22019 set(date, flags) { 22020 if (flags.timestampIsSet) return date; 22021 return constructFrom(date, transpose(date, this.context)); 22022 } 22023 }; 22024 22025 // node_modules/date-fns/parse/_lib/Parser.js 22026 var Parser = class { 22027 run(dateString, token, match2, options) { 22028 const result = this.parse(dateString, token, match2, options); 22029 if (!result) { 22030 return null; 22031 } 22032 return { 22033 setter: new ValueSetter( 22034 result.value, 22035 this.validate, 22036 this.set, 22037 this.priority, 22038 this.subPriority 22039 ), 22040 rest: result.rest 22041 }; 22042 } 22043 validate(_utcDate, _value, _options) { 22044 return true; 22045 } 22046 }; 22047 22048 // node_modules/date-fns/parse/_lib/parsers/EraParser.js 22049 var EraParser = class extends Parser { 22050 priority = 140; 22051 parse(dateString, token, match2) { 22052 switch (token) { 22053 // AD, BC 22054 case "G": 22055 case "GG": 22056 case "GGG": 22057 return match2.era(dateString, { width: "abbreviated" }) || match2.era(dateString, { width: "narrow" }); 22058 // A, B 22059 case "GGGGG": 22060 return match2.era(dateString, { width: "narrow" }); 22061 // Anno Domini, Before Christ 22062 case "GGGG": 22063 default: 22064 return match2.era(dateString, { width: "wide" }) || match2.era(dateString, { width: "abbreviated" }) || match2.era(dateString, { width: "narrow" }); 22065 } 22066 } 22067 set(date, flags, value) { 22068 flags.era = value; 22069 date.setFullYear(value, 0, 1); 22070 date.setHours(0, 0, 0, 0); 22071 return date; 22072 } 22073 incompatibleTokens = ["R", "u", "t", "T"]; 22074 }; 22075 22076 // node_modules/date-fns/parse/_lib/constants.js 22077 var numericPatterns = { 22078 month: /^(1[0-2]|0?\d)/, 22079 // 0 to 12 22080 date: /^(3[0-1]|[0-2]?\d)/, 22081 // 0 to 31 22082 dayOfYear: /^(36[0-6]|3[0-5]\d|[0-2]?\d?\d)/, 22083 // 0 to 366 22084 week: /^(5[0-3]|[0-4]?\d)/, 22085 // 0 to 53 22086 hour23h: /^(2[0-3]|[0-1]?\d)/, 22087 // 0 to 23 22088 hour24h: /^(2[0-4]|[0-1]?\d)/, 22089 // 0 to 24 22090 hour11h: /^(1[0-1]|0?\d)/, 22091 // 0 to 11 22092 hour12h: /^(1[0-2]|0?\d)/, 22093 // 0 to 12 22094 minute: /^[0-5]?\d/, 22095 // 0 to 59 22096 second: /^[0-5]?\d/, 22097 // 0 to 59 22098 singleDigit: /^\d/, 22099 // 0 to 9 22100 twoDigits: /^\d{1,2}/, 22101 // 0 to 99 22102 threeDigits: /^\d{1,3}/, 22103 // 0 to 999 22104 fourDigits: /^\d{1,4}/, 22105 // 0 to 9999 22106 anyDigitsSigned: /^-?\d+/, 22107 singleDigitSigned: /^-?\d/, 22108 // 0 to 9, -0 to -9 22109 twoDigitsSigned: /^-?\d{1,2}/, 22110 // 0 to 99, -0 to -99 22111 threeDigitsSigned: /^-?\d{1,3}/, 22112 // 0 to 999, -0 to -999 22113 fourDigitsSigned: /^-?\d{1,4}/ 22114 // 0 to 9999, -0 to -9999 22115 }; 22116 var timezonePatterns = { 22117 basicOptionalMinutes: /^([+-])(\d{2})(\d{2})?|Z/, 22118 basic: /^([+-])(\d{2})(\d{2})|Z/, 22119 basicOptionalSeconds: /^([+-])(\d{2})(\d{2})((\d{2}))?|Z/, 22120 extended: /^([+-])(\d{2}):(\d{2})|Z/, 22121 extendedOptionalSeconds: /^([+-])(\d{2}):(\d{2})(:(\d{2}))?|Z/ 22122 }; 22123 22124 // node_modules/date-fns/parse/_lib/utils.js 22125 function mapValue(parseFnResult, mapFn) { 22126 if (!parseFnResult) { 22127 return parseFnResult; 22128 } 22129 return { 22130 value: mapFn(parseFnResult.value), 22131 rest: parseFnResult.rest 22132 }; 22133 } 22134 function parseNumericPattern(pattern, dateString) { 22135 const matchResult = dateString.match(pattern); 22136 if (!matchResult) { 22137 return null; 22138 } 22139 return { 22140 value: parseInt(matchResult[0], 10), 22141 rest: dateString.slice(matchResult[0].length) 22142 }; 22143 } 22144 function parseTimezonePattern(pattern, dateString) { 22145 const matchResult = dateString.match(pattern); 22146 if (!matchResult) { 22147 return null; 22148 } 22149 if (matchResult[0] === "Z") { 22150 return { 22151 value: 0, 22152 rest: dateString.slice(1) 22153 }; 22154 } 22155 const sign = matchResult[1] === "+" ? 1 : -1; 22156 const hours = matchResult[2] ? parseInt(matchResult[2], 10) : 0; 22157 const minutes = matchResult[3] ? parseInt(matchResult[3], 10) : 0; 22158 const seconds = matchResult[5] ? parseInt(matchResult[5], 10) : 0; 22159 return { 22160 value: sign * (hours * millisecondsInHour + minutes * millisecondsInMinute + seconds * millisecondsInSecond), 22161 rest: dateString.slice(matchResult[0].length) 22162 }; 22163 } 22164 function parseAnyDigitsSigned(dateString) { 22165 return parseNumericPattern(numericPatterns.anyDigitsSigned, dateString); 22166 } 22167 function parseNDigits(n, dateString) { 22168 switch (n) { 22169 case 1: 22170 return parseNumericPattern(numericPatterns.singleDigit, dateString); 22171 case 2: 22172 return parseNumericPattern(numericPatterns.twoDigits, dateString); 22173 case 3: 22174 return parseNumericPattern(numericPatterns.threeDigits, dateString); 22175 case 4: 22176 return parseNumericPattern(numericPatterns.fourDigits, dateString); 22177 default: 22178 return parseNumericPattern(new RegExp("^\\d{1," + n + "}"), dateString); 22179 } 22180 } 22181 function parseNDigitsSigned(n, dateString) { 22182 switch (n) { 22183 case 1: 22184 return parseNumericPattern(numericPatterns.singleDigitSigned, dateString); 22185 case 2: 22186 return parseNumericPattern(numericPatterns.twoDigitsSigned, dateString); 22187 case 3: 22188 return parseNumericPattern(numericPatterns.threeDigitsSigned, dateString); 22189 case 4: 22190 return parseNumericPattern(numericPatterns.fourDigitsSigned, dateString); 22191 default: 22192 return parseNumericPattern(new RegExp("^-?\\d{1," + n + "}"), dateString); 22193 } 22194 } 22195 function dayPeriodEnumToHours(dayPeriod) { 22196 switch (dayPeriod) { 22197 case "morning": 22198 return 4; 22199 case "evening": 22200 return 17; 22201 case "pm": 22202 case "noon": 22203 case "afternoon": 22204 return 12; 22205 case "am": 22206 case "midnight": 22207 case "night": 22208 default: 22209 return 0; 22210 } 22211 } 22212 function normalizeTwoDigitYear(twoDigitYear, currentYear) { 22213 const isCommonEra = currentYear > 0; 22214 const absCurrentYear = isCommonEra ? currentYear : 1 - currentYear; 22215 let result; 22216 if (absCurrentYear <= 50) { 22217 result = twoDigitYear || 100; 22218 } else { 22219 const rangeEnd = absCurrentYear + 50; 22220 const rangeEndCentury = Math.trunc(rangeEnd / 100) * 100; 22221 const isPreviousCentury = twoDigitYear >= rangeEnd % 100; 22222 result = twoDigitYear + rangeEndCentury - (isPreviousCentury ? 100 : 0); 22223 } 22224 return isCommonEra ? result : 1 - result; 22225 } 22226 function isLeapYearIndex(year) { 22227 return year % 400 === 0 || year % 4 === 0 && year % 100 !== 0; 22228 } 22229 22230 // node_modules/date-fns/parse/_lib/parsers/YearParser.js 22231 var YearParser = class extends Parser { 22232 priority = 130; 22233 incompatibleTokens = ["Y", "R", "u", "w", "I", "i", "e", "c", "t", "T"]; 22234 parse(dateString, token, match2) { 22235 const valueCallback = (year) => ({ 22236 year, 22237 isTwoDigitYear: token === "yy" 22238 }); 22239 switch (token) { 22240 case "y": 22241 return mapValue(parseNDigits(4, dateString), valueCallback); 22242 case "yo": 22243 return mapValue( 22244 match2.ordinalNumber(dateString, { 22245 unit: "year" 22246 }), 22247 valueCallback 22248 ); 22249 default: 22250 return mapValue(parseNDigits(token.length, dateString), valueCallback); 22251 } 22252 } 22253 validate(_date, value) { 22254 return value.isTwoDigitYear || value.year > 0; 22255 } 22256 set(date, flags, value) { 22257 const currentYear = date.getFullYear(); 22258 if (value.isTwoDigitYear) { 22259 const normalizedTwoDigitYear = normalizeTwoDigitYear( 22260 value.year, 22261 currentYear 22262 ); 22263 date.setFullYear(normalizedTwoDigitYear, 0, 1); 22264 date.setHours(0, 0, 0, 0); 22265 return date; 22266 } 22267 const year = !("era" in flags) || flags.era === 1 ? value.year : 1 - value.year; 22268 date.setFullYear(year, 0, 1); 22269 date.setHours(0, 0, 0, 0); 22270 return date; 22271 } 22272 }; 22273 22274 // node_modules/date-fns/parse/_lib/parsers/LocalWeekYearParser.js 22275 var LocalWeekYearParser = class extends Parser { 22276 priority = 130; 22277 parse(dateString, token, match2) { 22278 const valueCallback = (year) => ({ 22279 year, 22280 isTwoDigitYear: token === "YY" 22281 }); 22282 switch (token) { 22283 case "Y": 22284 return mapValue(parseNDigits(4, dateString), valueCallback); 22285 case "Yo": 22286 return mapValue( 22287 match2.ordinalNumber(dateString, { 22288 unit: "year" 22289 }), 22290 valueCallback 22291 ); 22292 default: 22293 return mapValue(parseNDigits(token.length, dateString), valueCallback); 22294 } 22295 } 22296 validate(_date, value) { 22297 return value.isTwoDigitYear || value.year > 0; 22298 } 22299 set(date, flags, value, options) { 22300 const currentYear = getWeekYear(date, options); 22301 if (value.isTwoDigitYear) { 22302 const normalizedTwoDigitYear = normalizeTwoDigitYear( 22303 value.year, 22304 currentYear 22305 ); 22306 date.setFullYear( 22307 normalizedTwoDigitYear, 22308 0, 22309 options.firstWeekContainsDate 22310 ); 22311 date.setHours(0, 0, 0, 0); 22312 return startOfWeek(date, options); 22313 } 22314 const year = !("era" in flags) || flags.era === 1 ? value.year : 1 - value.year; 22315 date.setFullYear(year, 0, options.firstWeekContainsDate); 22316 date.setHours(0, 0, 0, 0); 22317 return startOfWeek(date, options); 22318 } 22319 incompatibleTokens = [ 22320 "y", 22321 "R", 22322 "u", 22323 "Q", 22324 "q", 22325 "M", 22326 "L", 22327 "I", 22328 "d", 22329 "D", 22330 "i", 22331 "t", 22332 "T" 22333 ]; 22334 }; 22335 22336 // node_modules/date-fns/parse/_lib/parsers/ISOWeekYearParser.js 22337 var ISOWeekYearParser = class extends Parser { 22338 priority = 130; 22339 parse(dateString, token) { 22340 if (token === "R") { 22341 return parseNDigitsSigned(4, dateString); 22342 } 22343 return parseNDigitsSigned(token.length, dateString); 22344 } 22345 set(date, _flags, value) { 22346 const firstWeekOfYear = constructFrom(date, 0); 22347 firstWeekOfYear.setFullYear(value, 0, 4); 22348 firstWeekOfYear.setHours(0, 0, 0, 0); 22349 return startOfISOWeek(firstWeekOfYear); 22350 } 22351 incompatibleTokens = [ 22352 "G", 22353 "y", 22354 "Y", 22355 "u", 22356 "Q", 22357 "q", 22358 "M", 22359 "L", 22360 "w", 22361 "d", 22362 "D", 22363 "e", 22364 "c", 22365 "t", 22366 "T" 22367 ]; 22368 }; 22369 22370 // node_modules/date-fns/parse/_lib/parsers/ExtendedYearParser.js 22371 var ExtendedYearParser = class extends Parser { 22372 priority = 130; 22373 parse(dateString, token) { 22374 if (token === "u") { 22375 return parseNDigitsSigned(4, dateString); 22376 } 22377 return parseNDigitsSigned(token.length, dateString); 22378 } 22379 set(date, _flags, value) { 22380 date.setFullYear(value, 0, 1); 22381 date.setHours(0, 0, 0, 0); 22382 return date; 22383 } 22384 incompatibleTokens = ["G", "y", "Y", "R", "w", "I", "i", "e", "c", "t", "T"]; 22385 }; 22386 22387 // node_modules/date-fns/parse/_lib/parsers/QuarterParser.js 22388 var QuarterParser = class extends Parser { 22389 priority = 120; 22390 parse(dateString, token, match2) { 22391 switch (token) { 22392 // 1, 2, 3, 4 22393 case "Q": 22394 case "QQ": 22395 return parseNDigits(token.length, dateString); 22396 // 1st, 2nd, 3rd, 4th 22397 case "Qo": 22398 return match2.ordinalNumber(dateString, { unit: "quarter" }); 22399 // Q1, Q2, Q3, Q4 22400 case "QQQ": 22401 return match2.quarter(dateString, { 22402 width: "abbreviated", 22403 context: "formatting" 22404 }) || match2.quarter(dateString, { 22405 width: "narrow", 22406 context: "formatting" 22407 }); 22408 // 1, 2, 3, 4 (narrow quarter; could be not numerical) 22409 case "QQQQQ": 22410 return match2.quarter(dateString, { 22411 width: "narrow", 22412 context: "formatting" 22413 }); 22414 // 1st quarter, 2nd quarter, ... 22415 case "QQQQ": 22416 default: 22417 return match2.quarter(dateString, { 22418 width: "wide", 22419 context: "formatting" 22420 }) || match2.quarter(dateString, { 22421 width: "abbreviated", 22422 context: "formatting" 22423 }) || match2.quarter(dateString, { 22424 width: "narrow", 22425 context: "formatting" 22426 }); 22427 } 22428 } 22429 validate(_date, value) { 22430 return value >= 1 && value <= 4; 22431 } 22432 set(date, _flags, value) { 22433 date.setMonth((value - 1) * 3, 1); 22434 date.setHours(0, 0, 0, 0); 22435 return date; 22436 } 22437 incompatibleTokens = [ 22438 "Y", 22439 "R", 22440 "q", 22441 "M", 22442 "L", 22443 "w", 22444 "I", 22445 "d", 22446 "D", 22447 "i", 22448 "e", 22449 "c", 22450 "t", 22451 "T" 22452 ]; 22453 }; 22454 22455 // node_modules/date-fns/parse/_lib/parsers/StandAloneQuarterParser.js 22456 var StandAloneQuarterParser = class extends Parser { 22457 priority = 120; 22458 parse(dateString, token, match2) { 22459 switch (token) { 22460 // 1, 2, 3, 4 22461 case "q": 22462 case "qq": 22463 return parseNDigits(token.length, dateString); 22464 // 1st, 2nd, 3rd, 4th 22465 case "qo": 22466 return match2.ordinalNumber(dateString, { unit: "quarter" }); 22467 // Q1, Q2, Q3, Q4 22468 case "qqq": 22469 return match2.quarter(dateString, { 22470 width: "abbreviated", 22471 context: "standalone" 22472 }) || match2.quarter(dateString, { 22473 width: "narrow", 22474 context: "standalone" 22475 }); 22476 // 1, 2, 3, 4 (narrow quarter; could be not numerical) 22477 case "qqqqq": 22478 return match2.quarter(dateString, { 22479 width: "narrow", 22480 context: "standalone" 22481 }); 22482 // 1st quarter, 2nd quarter, ... 22483 case "qqqq": 22484 default: 22485 return match2.quarter(dateString, { 22486 width: "wide", 22487 context: "standalone" 22488 }) || match2.quarter(dateString, { 22489 width: "abbreviated", 22490 context: "standalone" 22491 }) || match2.quarter(dateString, { 22492 width: "narrow", 22493 context: "standalone" 22494 }); 22495 } 22496 } 22497 validate(_date, value) { 22498 return value >= 1 && value <= 4; 22499 } 22500 set(date, _flags, value) { 22501 date.setMonth((value - 1) * 3, 1); 22502 date.setHours(0, 0, 0, 0); 22503 return date; 22504 } 22505 incompatibleTokens = [ 22506 "Y", 22507 "R", 22508 "Q", 22509 "M", 22510 "L", 22511 "w", 22512 "I", 22513 "d", 22514 "D", 22515 "i", 22516 "e", 22517 "c", 22518 "t", 22519 "T" 22520 ]; 22521 }; 22522 22523 // node_modules/date-fns/parse/_lib/parsers/MonthParser.js 22524 var MonthParser = class extends Parser { 22525 incompatibleTokens = [ 22526 "Y", 22527 "R", 22528 "q", 22529 "Q", 22530 "L", 22531 "w", 22532 "I", 22533 "D", 22534 "i", 22535 "e", 22536 "c", 22537 "t", 22538 "T" 22539 ]; 22540 priority = 110; 22541 parse(dateString, token, match2) { 22542 const valueCallback = (value) => value - 1; 22543 switch (token) { 22544 // 1, 2, ..., 12 22545 case "M": 22546 return mapValue( 22547 parseNumericPattern(numericPatterns.month, dateString), 22548 valueCallback 22549 ); 22550 // 01, 02, ..., 12 22551 case "MM": 22552 return mapValue(parseNDigits(2, dateString), valueCallback); 22553 // 1st, 2nd, ..., 12th 22554 case "Mo": 22555 return mapValue( 22556 match2.ordinalNumber(dateString, { 22557 unit: "month" 22558 }), 22559 valueCallback 22560 ); 22561 // Jan, Feb, ..., Dec 22562 case "MMM": 22563 return match2.month(dateString, { 22564 width: "abbreviated", 22565 context: "formatting" 22566 }) || match2.month(dateString, { width: "narrow", context: "formatting" }); 22567 // J, F, ..., D 22568 case "MMMMM": 22569 return match2.month(dateString, { 22570 width: "narrow", 22571 context: "formatting" 22572 }); 22573 // January, February, ..., December 22574 case "MMMM": 22575 default: 22576 return match2.month(dateString, { width: "wide", context: "formatting" }) || match2.month(dateString, { 22577 width: "abbreviated", 22578 context: "formatting" 22579 }) || match2.month(dateString, { width: "narrow", context: "formatting" }); 22580 } 22581 } 22582 validate(_date, value) { 22583 return value >= 0 && value <= 11; 22584 } 22585 set(date, _flags, value) { 22586 date.setMonth(value, 1); 22587 date.setHours(0, 0, 0, 0); 22588 return date; 22589 } 22590 }; 22591 22592 // node_modules/date-fns/parse/_lib/parsers/StandAloneMonthParser.js 22593 var StandAloneMonthParser = class extends Parser { 22594 priority = 110; 22595 parse(dateString, token, match2) { 22596 const valueCallback = (value) => value - 1; 22597 switch (token) { 22598 // 1, 2, ..., 12 22599 case "L": 22600 return mapValue( 22601 parseNumericPattern(numericPatterns.month, dateString), 22602 valueCallback 22603 ); 22604 // 01, 02, ..., 12 22605 case "LL": 22606 return mapValue(parseNDigits(2, dateString), valueCallback); 22607 // 1st, 2nd, ..., 12th 22608 case "Lo": 22609 return mapValue( 22610 match2.ordinalNumber(dateString, { 22611 unit: "month" 22612 }), 22613 valueCallback 22614 ); 22615 // Jan, Feb, ..., Dec 22616 case "LLL": 22617 return match2.month(dateString, { 22618 width: "abbreviated", 22619 context: "standalone" 22620 }) || match2.month(dateString, { width: "narrow", context: "standalone" }); 22621 // J, F, ..., D 22622 case "LLLLL": 22623 return match2.month(dateString, { 22624 width: "narrow", 22625 context: "standalone" 22626 }); 22627 // January, February, ..., December 22628 case "LLLL": 22629 default: 22630 return match2.month(dateString, { width: "wide", context: "standalone" }) || match2.month(dateString, { 22631 width: "abbreviated", 22632 context: "standalone" 22633 }) || match2.month(dateString, { width: "narrow", context: "standalone" }); 22634 } 22635 } 22636 validate(_date, value) { 22637 return value >= 0 && value <= 11; 22638 } 22639 set(date, _flags, value) { 22640 date.setMonth(value, 1); 22641 date.setHours(0, 0, 0, 0); 22642 return date; 22643 } 22644 incompatibleTokens = [ 22645 "Y", 22646 "R", 22647 "q", 22648 "Q", 22649 "M", 22650 "w", 22651 "I", 22652 "D", 22653 "i", 22654 "e", 22655 "c", 22656 "t", 22657 "T" 22658 ]; 22659 }; 22660 22661 // node_modules/date-fns/setWeek.js 22662 function setWeek(date, week, options) { 22663 const date_ = toDate(date, options?.in); 22664 const diff = getWeek(date_, options) - week; 22665 date_.setDate(date_.getDate() - diff * 7); 22666 return toDate(date_, options?.in); 22667 } 22668 22669 // node_modules/date-fns/parse/_lib/parsers/LocalWeekParser.js 22670 var LocalWeekParser = class extends Parser { 22671 priority = 100; 22672 parse(dateString, token, match2) { 22673 switch (token) { 22674 case "w": 22675 return parseNumericPattern(numericPatterns.week, dateString); 22676 case "wo": 22677 return match2.ordinalNumber(dateString, { unit: "week" }); 22678 default: 22679 return parseNDigits(token.length, dateString); 22680 } 22681 } 22682 validate(_date, value) { 22683 return value >= 1 && value <= 53; 22684 } 22685 set(date, _flags, value, options) { 22686 return startOfWeek(setWeek(date, value, options), options); 22687 } 22688 incompatibleTokens = [ 22689 "y", 22690 "R", 22691 "u", 22692 "q", 22693 "Q", 22694 "M", 22695 "L", 22696 "I", 22697 "d", 22698 "D", 22699 "i", 22700 "t", 22701 "T" 22702 ]; 22703 }; 22704 22705 // node_modules/date-fns/setISOWeek.js 22706 function setISOWeek(date, week, options) { 22707 const _date = toDate(date, options?.in); 22708 const diff = getISOWeek(_date, options) - week; 22709 _date.setDate(_date.getDate() - diff * 7); 22710 return _date; 22711 } 22712 22713 // node_modules/date-fns/parse/_lib/parsers/ISOWeekParser.js 22714 var ISOWeekParser = class extends Parser { 22715 priority = 100; 22716 parse(dateString, token, match2) { 22717 switch (token) { 22718 case "I": 22719 return parseNumericPattern(numericPatterns.week, dateString); 22720 case "Io": 22721 return match2.ordinalNumber(dateString, { unit: "week" }); 22722 default: 22723 return parseNDigits(token.length, dateString); 22724 } 22725 } 22726 validate(_date, value) { 22727 return value >= 1 && value <= 53; 22728 } 22729 set(date, _flags, value) { 22730 return startOfISOWeek(setISOWeek(date, value)); 22731 } 22732 incompatibleTokens = [ 22733 "y", 22734 "Y", 22735 "u", 22736 "q", 22737 "Q", 22738 "M", 22739 "L", 22740 "w", 22741 "d", 22742 "D", 22743 "e", 22744 "c", 22745 "t", 22746 "T" 22747 ]; 22748 }; 22749 22750 // node_modules/date-fns/parse/_lib/parsers/DateParser.js 22751 var DAYS_IN_MONTH = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]; 22752 var DAYS_IN_MONTH_LEAP_YEAR = [ 22753 31, 22754 29, 22755 31, 22756 30, 22757 31, 22758 30, 22759 31, 22760 31, 22761 30, 22762 31, 22763 30, 22764 31 22765 ]; 22766 var DateParser = class extends Parser { 22767 priority = 90; 22768 subPriority = 1; 22769 parse(dateString, token, match2) { 22770 switch (token) { 22771 case "d": 22772 return parseNumericPattern(numericPatterns.date, dateString); 22773 case "do": 22774 return match2.ordinalNumber(dateString, { unit: "date" }); 22775 default: 22776 return parseNDigits(token.length, dateString); 22777 } 22778 } 22779 validate(date, value) { 22780 const year = date.getFullYear(); 22781 const isLeapYear = isLeapYearIndex(year); 22782 const month = date.getMonth(); 22783 if (isLeapYear) { 22784 return value >= 1 && value <= DAYS_IN_MONTH_LEAP_YEAR[month]; 22785 } else { 22786 return value >= 1 && value <= DAYS_IN_MONTH[month]; 22787 } 22788 } 22789 set(date, _flags, value) { 22790 date.setDate(value); 22791 date.setHours(0, 0, 0, 0); 22792 return date; 22793 } 22794 incompatibleTokens = [ 22795 "Y", 22796 "R", 22797 "q", 22798 "Q", 22799 "w", 22800 "I", 22801 "D", 22802 "i", 22803 "e", 22804 "c", 22805 "t", 22806 "T" 22807 ]; 22808 }; 22809 22810 // node_modules/date-fns/parse/_lib/parsers/DayOfYearParser.js 22811 var DayOfYearParser = class extends Parser { 22812 priority = 90; 22813 subpriority = 1; 22814 parse(dateString, token, match2) { 22815 switch (token) { 22816 case "D": 22817 case "DD": 22818 return parseNumericPattern(numericPatterns.dayOfYear, dateString); 22819 case "Do": 22820 return match2.ordinalNumber(dateString, { unit: "date" }); 22821 default: 22822 return parseNDigits(token.length, dateString); 22823 } 22824 } 22825 validate(date, value) { 22826 const year = date.getFullYear(); 22827 const isLeapYear = isLeapYearIndex(year); 22828 if (isLeapYear) { 22829 return value >= 1 && value <= 366; 22830 } else { 22831 return value >= 1 && value <= 365; 22832 } 22833 } 22834 set(date, _flags, value) { 22835 date.setMonth(0, value); 22836 date.setHours(0, 0, 0, 0); 22837 return date; 22838 } 22839 incompatibleTokens = [ 22840 "Y", 22841 "R", 22842 "q", 22843 "Q", 22844 "M", 22845 "L", 22846 "w", 22847 "I", 22848 "d", 22849 "E", 22850 "i", 22851 "e", 22852 "c", 22853 "t", 22854 "T" 22855 ]; 22856 }; 22857 22858 // node_modules/date-fns/setDay.js 22859 function setDay(date, day, options) { 22860 const defaultOptions2 = getDefaultOptions(); 22861 const weekStartsOn = options?.weekStartsOn ?? options?.locale?.options?.weekStartsOn ?? defaultOptions2.weekStartsOn ?? defaultOptions2.locale?.options?.weekStartsOn ?? 0; 22862 const date_ = toDate(date, options?.in); 22863 const currentDay = date_.getDay(); 22864 const remainder = day % 7; 22865 const dayIndex = (remainder + 7) % 7; 22866 const delta = 7 - weekStartsOn; 22867 const diff = day < 0 || day > 6 ? day - (currentDay + delta) % 7 : (dayIndex + delta) % 7 - (currentDay + delta) % 7; 22868 return addDays(date_, diff, options); 22869 } 22870 22871 // node_modules/date-fns/parse/_lib/parsers/DayParser.js 22872 var DayParser = class extends Parser { 22873 priority = 90; 22874 parse(dateString, token, match2) { 22875 switch (token) { 22876 // Tue 22877 case "E": 22878 case "EE": 22879 case "EEE": 22880 return match2.day(dateString, { 22881 width: "abbreviated", 22882 context: "formatting" 22883 }) || match2.day(dateString, { width: "short", context: "formatting" }) || match2.day(dateString, { width: "narrow", context: "formatting" }); 22884 // T 22885 case "EEEEE": 22886 return match2.day(dateString, { 22887 width: "narrow", 22888 context: "formatting" 22889 }); 22890 // Tu 22891 case "EEEEEE": 22892 return match2.day(dateString, { width: "short", context: "formatting" }) || match2.day(dateString, { width: "narrow", context: "formatting" }); 22893 // Tuesday 22894 case "EEEE": 22895 default: 22896 return match2.day(dateString, { width: "wide", context: "formatting" }) || match2.day(dateString, { 22897 width: "abbreviated", 22898 context: "formatting" 22899 }) || match2.day(dateString, { width: "short", context: "formatting" }) || match2.day(dateString, { width: "narrow", context: "formatting" }); 22900 } 22901 } 22902 validate(_date, value) { 22903 return value >= 0 && value <= 6; 22904 } 22905 set(date, _flags, value, options) { 22906 date = setDay(date, value, options); 22907 date.setHours(0, 0, 0, 0); 22908 return date; 22909 } 22910 incompatibleTokens = ["D", "i", "e", "c", "t", "T"]; 22911 }; 22912 22913 // node_modules/date-fns/parse/_lib/parsers/LocalDayParser.js 22914 var LocalDayParser = class extends Parser { 22915 priority = 90; 22916 parse(dateString, token, match2, options) { 22917 const valueCallback = (value) => { 22918 const wholeWeekDays = Math.floor((value - 1) / 7) * 7; 22919 return (value + options.weekStartsOn + 6) % 7 + wholeWeekDays; 22920 }; 22921 switch (token) { 22922 // 3 22923 case "e": 22924 case "ee": 22925 return mapValue(parseNDigits(token.length, dateString), valueCallback); 22926 // 3rd 22927 case "eo": 22928 return mapValue( 22929 match2.ordinalNumber(dateString, { 22930 unit: "day" 22931 }), 22932 valueCallback 22933 ); 22934 // Tue 22935 case "eee": 22936 return match2.day(dateString, { 22937 width: "abbreviated", 22938 context: "formatting" 22939 }) || match2.day(dateString, { width: "short", context: "formatting" }) || match2.day(dateString, { width: "narrow", context: "formatting" }); 22940 // T 22941 case "eeeee": 22942 return match2.day(dateString, { 22943 width: "narrow", 22944 context: "formatting" 22945 }); 22946 // Tu 22947 case "eeeeee": 22948 return match2.day(dateString, { width: "short", context: "formatting" }) || match2.day(dateString, { width: "narrow", context: "formatting" }); 22949 // Tuesday 22950 case "eeee": 22951 default: 22952 return match2.day(dateString, { width: "wide", context: "formatting" }) || match2.day(dateString, { 22953 width: "abbreviated", 22954 context: "formatting" 22955 }) || match2.day(dateString, { width: "short", context: "formatting" }) || match2.day(dateString, { width: "narrow", context: "formatting" }); 22956 } 22957 } 22958 validate(_date, value) { 22959 return value >= 0 && value <= 6; 22960 } 22961 set(date, _flags, value, options) { 22962 date = setDay(date, value, options); 22963 date.setHours(0, 0, 0, 0); 22964 return date; 22965 } 22966 incompatibleTokens = [ 22967 "y", 22968 "R", 22969 "u", 22970 "q", 22971 "Q", 22972 "M", 22973 "L", 22974 "I", 22975 "d", 22976 "D", 22977 "E", 22978 "i", 22979 "c", 22980 "t", 22981 "T" 22982 ]; 22983 }; 22984 22985 // node_modules/date-fns/parse/_lib/parsers/StandAloneLocalDayParser.js 22986 var StandAloneLocalDayParser = class extends Parser { 22987 priority = 90; 22988 parse(dateString, token, match2, options) { 22989 const valueCallback = (value) => { 22990 const wholeWeekDays = Math.floor((value - 1) / 7) * 7; 22991 return (value + options.weekStartsOn + 6) % 7 + wholeWeekDays; 22992 }; 22993 switch (token) { 22994 // 3 22995 case "c": 22996 case "cc": 22997 return mapValue(parseNDigits(token.length, dateString), valueCallback); 22998 // 3rd 22999 case "co": 23000 return mapValue( 23001 match2.ordinalNumber(dateString, { 23002 unit: "day" 23003 }), 23004 valueCallback 23005 ); 23006 // Tue 23007 case "ccc": 23008 return match2.day(dateString, { 23009 width: "abbreviated", 23010 context: "standalone" 23011 }) || match2.day(dateString, { width: "short", context: "standalone" }) || match2.day(dateString, { width: "narrow", context: "standalone" }); 23012 // T 23013 case "ccccc": 23014 return match2.day(dateString, { 23015 width: "narrow", 23016 context: "standalone" 23017 }); 23018 // Tu 23019 case "cccccc": 23020 return match2.day(dateString, { width: "short", context: "standalone" }) || match2.day(dateString, { width: "narrow", context: "standalone" }); 23021 // Tuesday 23022 case "cccc": 23023 default: 23024 return match2.day(dateString, { width: "wide", context: "standalone" }) || match2.day(dateString, { 23025 width: "abbreviated", 23026 context: "standalone" 23027 }) || match2.day(dateString, { width: "short", context: "standalone" }) || match2.day(dateString, { width: "narrow", context: "standalone" }); 23028 } 23029 } 23030 validate(_date, value) { 23031 return value >= 0 && value <= 6; 23032 } 23033 set(date, _flags, value, options) { 23034 date = setDay(date, value, options); 23035 date.setHours(0, 0, 0, 0); 23036 return date; 23037 } 23038 incompatibleTokens = [ 23039 "y", 23040 "R", 23041 "u", 23042 "q", 23043 "Q", 23044 "M", 23045 "L", 23046 "I", 23047 "d", 23048 "D", 23049 "E", 23050 "i", 23051 "e", 23052 "t", 23053 "T" 23054 ]; 23055 }; 23056 23057 // node_modules/date-fns/setISODay.js 23058 function setISODay(date, day, options) { 23059 const date_ = toDate(date, options?.in); 23060 const currentDay = getISODay(date_, options); 23061 const diff = day - currentDay; 23062 return addDays(date_, diff, options); 23063 } 23064 23065 // node_modules/date-fns/parse/_lib/parsers/ISODayParser.js 23066 var ISODayParser = class extends Parser { 23067 priority = 90; 23068 parse(dateString, token, match2) { 23069 const valueCallback = (value) => { 23070 if (value === 0) { 23071 return 7; 23072 } 23073 return value; 23074 }; 23075 switch (token) { 23076 // 2 23077 case "i": 23078 case "ii": 23079 return parseNDigits(token.length, dateString); 23080 // 2nd 23081 case "io": 23082 return match2.ordinalNumber(dateString, { unit: "day" }); 23083 // Tue 23084 case "iii": 23085 return mapValue( 23086 match2.day(dateString, { 23087 width: "abbreviated", 23088 context: "formatting" 23089 }) || match2.day(dateString, { 23090 width: "short", 23091 context: "formatting" 23092 }) || match2.day(dateString, { 23093 width: "narrow", 23094 context: "formatting" 23095 }), 23096 valueCallback 23097 ); 23098 // T 23099 case "iiiii": 23100 return mapValue( 23101 match2.day(dateString, { 23102 width: "narrow", 23103 context: "formatting" 23104 }), 23105 valueCallback 23106 ); 23107 // Tu 23108 case "iiiiii": 23109 return mapValue( 23110 match2.day(dateString, { 23111 width: "short", 23112 context: "formatting" 23113 }) || match2.day(dateString, { 23114 width: "narrow", 23115 context: "formatting" 23116 }), 23117 valueCallback 23118 ); 23119 // Tuesday 23120 case "iiii": 23121 default: 23122 return mapValue( 23123 match2.day(dateString, { 23124 width: "wide", 23125 context: "formatting" 23126 }) || match2.day(dateString, { 23127 width: "abbreviated", 23128 context: "formatting" 23129 }) || match2.day(dateString, { 23130 width: "short", 23131 context: "formatting" 23132 }) || match2.day(dateString, { 23133 width: "narrow", 23134 context: "formatting" 23135 }), 23136 valueCallback 23137 ); 23138 } 23139 } 23140 validate(_date, value) { 23141 return value >= 1 && value <= 7; 23142 } 23143 set(date, _flags, value) { 23144 date = setISODay(date, value); 23145 date.setHours(0, 0, 0, 0); 23146 return date; 23147 } 23148 incompatibleTokens = [ 23149 "y", 23150 "Y", 23151 "u", 23152 "q", 23153 "Q", 23154 "M", 23155 "L", 23156 "w", 23157 "d", 23158 "D", 23159 "E", 23160 "e", 23161 "c", 23162 "t", 23163 "T" 23164 ]; 23165 }; 23166 23167 // node_modules/date-fns/parse/_lib/parsers/AMPMParser.js 23168 var AMPMParser = class extends Parser { 23169 priority = 80; 23170 parse(dateString, token, match2) { 23171 switch (token) { 23172 case "a": 23173 case "aa": 23174 case "aaa": 23175 return match2.dayPeriod(dateString, { 23176 width: "abbreviated", 23177 context: "formatting" 23178 }) || match2.dayPeriod(dateString, { 23179 width: "narrow", 23180 context: "formatting" 23181 }); 23182 case "aaaaa": 23183 return match2.dayPeriod(dateString, { 23184 width: "narrow", 23185 context: "formatting" 23186 }); 23187 case "aaaa": 23188 default: 23189 return match2.dayPeriod(dateString, { 23190 width: "wide", 23191 context: "formatting" 23192 }) || match2.dayPeriod(dateString, { 23193 width: "abbreviated", 23194 context: "formatting" 23195 }) || match2.dayPeriod(dateString, { 23196 width: "narrow", 23197 context: "formatting" 23198 }); 23199 } 23200 } 23201 set(date, _flags, value) { 23202 date.setHours(dayPeriodEnumToHours(value), 0, 0, 0); 23203 return date; 23204 } 23205 incompatibleTokens = ["b", "B", "H", "k", "t", "T"]; 23206 }; 23207 23208 // node_modules/date-fns/parse/_lib/parsers/AMPMMidnightParser.js 23209 var AMPMMidnightParser = class extends Parser { 23210 priority = 80; 23211 parse(dateString, token, match2) { 23212 switch (token) { 23213 case "b": 23214 case "bb": 23215 case "bbb": 23216 return match2.dayPeriod(dateString, { 23217 width: "abbreviated", 23218 context: "formatting" 23219 }) || match2.dayPeriod(dateString, { 23220 width: "narrow", 23221 context: "formatting" 23222 }); 23223 case "bbbbb": 23224 return match2.dayPeriod(dateString, { 23225 width: "narrow", 23226 context: "formatting" 23227 }); 23228 case "bbbb": 23229 default: 23230 return match2.dayPeriod(dateString, { 23231 width: "wide", 23232 context: "formatting" 23233 }) || match2.dayPeriod(dateString, { 23234 width: "abbreviated", 23235 context: "formatting" 23236 }) || match2.dayPeriod(dateString, { 23237 width: "narrow", 23238 context: "formatting" 23239 }); 23240 } 23241 } 23242 set(date, _flags, value) { 23243 date.setHours(dayPeriodEnumToHours(value), 0, 0, 0); 23244 return date; 23245 } 23246 incompatibleTokens = ["a", "B", "H", "k", "t", "T"]; 23247 }; 23248 23249 // node_modules/date-fns/parse/_lib/parsers/DayPeriodParser.js 23250 var DayPeriodParser = class extends Parser { 23251 priority = 80; 23252 parse(dateString, token, match2) { 23253 switch (token) { 23254 case "B": 23255 case "BB": 23256 case "BBB": 23257 return match2.dayPeriod(dateString, { 23258 width: "abbreviated", 23259 context: "formatting" 23260 }) || match2.dayPeriod(dateString, { 23261 width: "narrow", 23262 context: "formatting" 23263 }); 23264 case "BBBBB": 23265 return match2.dayPeriod(dateString, { 23266 width: "narrow", 23267 context: "formatting" 23268 }); 23269 case "BBBB": 23270 default: 23271 return match2.dayPeriod(dateString, { 23272 width: "wide", 23273 context: "formatting" 23274 }) || match2.dayPeriod(dateString, { 23275 width: "abbreviated", 23276 context: "formatting" 23277 }) || match2.dayPeriod(dateString, { 23278 width: "narrow", 23279 context: "formatting" 23280 }); 23281 } 23282 } 23283 set(date, _flags, value) { 23284 date.setHours(dayPeriodEnumToHours(value), 0, 0, 0); 23285 return date; 23286 } 23287 incompatibleTokens = ["a", "b", "t", "T"]; 23288 }; 23289 23290 // node_modules/date-fns/parse/_lib/parsers/Hour1to12Parser.js 23291 var Hour1to12Parser = class extends Parser { 23292 priority = 70; 23293 parse(dateString, token, match2) { 23294 switch (token) { 23295 case "h": 23296 return parseNumericPattern(numericPatterns.hour12h, dateString); 23297 case "ho": 23298 return match2.ordinalNumber(dateString, { unit: "hour" }); 23299 default: 23300 return parseNDigits(token.length, dateString); 23301 } 23302 } 23303 validate(_date, value) { 23304 return value >= 1 && value <= 12; 23305 } 23306 set(date, _flags, value) { 23307 const isPM = date.getHours() >= 12; 23308 if (isPM && value < 12) { 23309 date.setHours(value + 12, 0, 0, 0); 23310 } else if (!isPM && value === 12) { 23311 date.setHours(0, 0, 0, 0); 23312 } else { 23313 date.setHours(value, 0, 0, 0); 23314 } 23315 return date; 23316 } 23317 incompatibleTokens = ["H", "K", "k", "t", "T"]; 23318 }; 23319 23320 // node_modules/date-fns/parse/_lib/parsers/Hour0to23Parser.js 23321 var Hour0to23Parser = class extends Parser { 23322 priority = 70; 23323 parse(dateString, token, match2) { 23324 switch (token) { 23325 case "H": 23326 return parseNumericPattern(numericPatterns.hour23h, dateString); 23327 case "Ho": 23328 return match2.ordinalNumber(dateString, { unit: "hour" }); 23329 default: 23330 return parseNDigits(token.length, dateString); 23331 } 23332 } 23333 validate(_date, value) { 23334 return value >= 0 && value <= 23; 23335 } 23336 set(date, _flags, value) { 23337 date.setHours(value, 0, 0, 0); 23338 return date; 23339 } 23340 incompatibleTokens = ["a", "b", "h", "K", "k", "t", "T"]; 23341 }; 23342 23343 // node_modules/date-fns/parse/_lib/parsers/Hour0To11Parser.js 23344 var Hour0To11Parser = class extends Parser { 23345 priority = 70; 23346 parse(dateString, token, match2) { 23347 switch (token) { 23348 case "K": 23349 return parseNumericPattern(numericPatterns.hour11h, dateString); 23350 case "Ko": 23351 return match2.ordinalNumber(dateString, { unit: "hour" }); 23352 default: 23353 return parseNDigits(token.length, dateString); 23354 } 23355 } 23356 validate(_date, value) { 23357 return value >= 0 && value <= 11; 23358 } 23359 set(date, _flags, value) { 23360 const isPM = date.getHours() >= 12; 23361 if (isPM && value < 12) { 23362 date.setHours(value + 12, 0, 0, 0); 23363 } else { 23364 date.setHours(value, 0, 0, 0); 23365 } 23366 return date; 23367 } 23368 incompatibleTokens = ["h", "H", "k", "t", "T"]; 23369 }; 23370 23371 // node_modules/date-fns/parse/_lib/parsers/Hour1To24Parser.js 23372 var Hour1To24Parser = class extends Parser { 23373 priority = 70; 23374 parse(dateString, token, match2) { 23375 switch (token) { 23376 case "k": 23377 return parseNumericPattern(numericPatterns.hour24h, dateString); 23378 case "ko": 23379 return match2.ordinalNumber(dateString, { unit: "hour" }); 23380 default: 23381 return parseNDigits(token.length, dateString); 23382 } 23383 } 23384 validate(_date, value) { 23385 return value >= 1 && value <= 24; 23386 } 23387 set(date, _flags, value) { 23388 const hours = value <= 24 ? value % 24 : value; 23389 date.setHours(hours, 0, 0, 0); 23390 return date; 23391 } 23392 incompatibleTokens = ["a", "b", "h", "H", "K", "t", "T"]; 23393 }; 23394 23395 // node_modules/date-fns/parse/_lib/parsers/MinuteParser.js 23396 var MinuteParser = class extends Parser { 23397 priority = 60; 23398 parse(dateString, token, match2) { 23399 switch (token) { 23400 case "m": 23401 return parseNumericPattern(numericPatterns.minute, dateString); 23402 case "mo": 23403 return match2.ordinalNumber(dateString, { unit: "minute" }); 23404 default: 23405 return parseNDigits(token.length, dateString); 23406 } 23407 } 23408 validate(_date, value) { 23409 return value >= 0 && value <= 59; 23410 } 23411 set(date, _flags, value) { 23412 date.setMinutes(value, 0, 0); 23413 return date; 23414 } 23415 incompatibleTokens = ["t", "T"]; 23416 }; 23417 23418 // node_modules/date-fns/parse/_lib/parsers/SecondParser.js 23419 var SecondParser = class extends Parser { 23420 priority = 50; 23421 parse(dateString, token, match2) { 23422 switch (token) { 23423 case "s": 23424 return parseNumericPattern(numericPatterns.second, dateString); 23425 case "so": 23426 return match2.ordinalNumber(dateString, { unit: "second" }); 23427 default: 23428 return parseNDigits(token.length, dateString); 23429 } 23430 } 23431 validate(_date, value) { 23432 return value >= 0 && value <= 59; 23433 } 23434 set(date, _flags, value) { 23435 date.setSeconds(value, 0); 23436 return date; 23437 } 23438 incompatibleTokens = ["t", "T"]; 23439 }; 23440 23441 // node_modules/date-fns/parse/_lib/parsers/FractionOfSecondParser.js 23442 var FractionOfSecondParser = class extends Parser { 23443 priority = 30; 23444 parse(dateString, token) { 23445 const valueCallback = (value) => Math.trunc(value * Math.pow(10, -token.length + 3)); 23446 return mapValue(parseNDigits(token.length, dateString), valueCallback); 23447 } 23448 set(date, _flags, value) { 23449 date.setMilliseconds(value); 23450 return date; 23451 } 23452 incompatibleTokens = ["t", "T"]; 23453 }; 23454 23455 // node_modules/date-fns/parse/_lib/parsers/ISOTimezoneWithZParser.js 23456 var ISOTimezoneWithZParser = class extends Parser { 23457 priority = 10; 23458 parse(dateString, token) { 23459 switch (token) { 23460 case "X": 23461 return parseTimezonePattern( 23462 timezonePatterns.basicOptionalMinutes, 23463 dateString 23464 ); 23465 case "XX": 23466 return parseTimezonePattern(timezonePatterns.basic, dateString); 23467 case "XXXX": 23468 return parseTimezonePattern( 23469 timezonePatterns.basicOptionalSeconds, 23470 dateString 23471 ); 23472 case "XXXXX": 23473 return parseTimezonePattern( 23474 timezonePatterns.extendedOptionalSeconds, 23475 dateString 23476 ); 23477 case "XXX": 23478 default: 23479 return parseTimezonePattern(timezonePatterns.extended, dateString); 23480 } 23481 } 23482 set(date, flags, value) { 23483 if (flags.timestampIsSet) return date; 23484 return constructFrom( 23485 date, 23486 date.getTime() - getTimezoneOffsetInMilliseconds(date) - value 23487 ); 23488 } 23489 incompatibleTokens = ["t", "T", "x"]; 23490 }; 23491 23492 // node_modules/date-fns/parse/_lib/parsers/ISOTimezoneParser.js 23493 var ISOTimezoneParser = class extends Parser { 23494 priority = 10; 23495 parse(dateString, token) { 23496 switch (token) { 23497 case "x": 23498 return parseTimezonePattern( 23499 timezonePatterns.basicOptionalMinutes, 23500 dateString 23501 ); 23502 case "xx": 23503 return parseTimezonePattern(timezonePatterns.basic, dateString); 23504 case "xxxx": 23505 return parseTimezonePattern( 23506 timezonePatterns.basicOptionalSeconds, 23507 dateString 23508 ); 23509 case "xxxxx": 23510 return parseTimezonePattern( 23511 timezonePatterns.extendedOptionalSeconds, 23512 dateString 23513 ); 23514 case "xxx": 23515 default: 23516 return parseTimezonePattern(timezonePatterns.extended, dateString); 23517 } 23518 } 23519 set(date, flags, value) { 23520 if (flags.timestampIsSet) return date; 23521 return constructFrom( 23522 date, 23523 date.getTime() - getTimezoneOffsetInMilliseconds(date) - value 23524 ); 23525 } 23526 incompatibleTokens = ["t", "T", "X"]; 23527 }; 23528 23529 // node_modules/date-fns/parse/_lib/parsers/TimestampSecondsParser.js 23530 var TimestampSecondsParser = class extends Parser { 23531 priority = 40; 23532 parse(dateString) { 23533 return parseAnyDigitsSigned(dateString); 23534 } 23535 set(date, _flags, value) { 23536 return [constructFrom(date, value * 1e3), { timestampIsSet: true }]; 23537 } 23538 incompatibleTokens = "*"; 23539 }; 23540 23541 // node_modules/date-fns/parse/_lib/parsers/TimestampMillisecondsParser.js 23542 var TimestampMillisecondsParser = class extends Parser { 23543 priority = 20; 23544 parse(dateString) { 23545 return parseAnyDigitsSigned(dateString); 23546 } 23547 set(date, _flags, value) { 23548 return [constructFrom(date, value), { timestampIsSet: true }]; 23549 } 23550 incompatibleTokens = "*"; 23551 }; 23552 23553 // node_modules/date-fns/parse/_lib/parsers.js 23554 var parsers = { 23555 G: new EraParser(), 23556 y: new YearParser(), 23557 Y: new LocalWeekYearParser(), 23558 R: new ISOWeekYearParser(), 23559 u: new ExtendedYearParser(), 23560 Q: new QuarterParser(), 23561 q: new StandAloneQuarterParser(), 23562 M: new MonthParser(), 23563 L: new StandAloneMonthParser(), 23564 w: new LocalWeekParser(), 23565 I: new ISOWeekParser(), 23566 d: new DateParser(), 23567 D: new DayOfYearParser(), 23568 E: new DayParser(), 23569 e: new LocalDayParser(), 23570 c: new StandAloneLocalDayParser(), 23571 i: new ISODayParser(), 23572 a: new AMPMParser(), 23573 b: new AMPMMidnightParser(), 23574 B: new DayPeriodParser(), 23575 h: new Hour1to12Parser(), 23576 H: new Hour0to23Parser(), 23577 K: new Hour0To11Parser(), 23578 k: new Hour1To24Parser(), 23579 m: new MinuteParser(), 23580 s: new SecondParser(), 23581 S: new FractionOfSecondParser(), 23582 X: new ISOTimezoneWithZParser(), 23583 x: new ISOTimezoneParser(), 23584 t: new TimestampSecondsParser(), 23585 T: new TimestampMillisecondsParser() 23586 }; 23587 23588 // node_modules/date-fns/parse.js 23589 var formattingTokensRegExp2 = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g; 23590 var longFormattingTokensRegExp2 = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g; 23591 var escapedStringRegExp2 = /^'([^]*?)'?$/; 23592 var doubleQuoteRegExp2 = /''/g; 23593 var notWhitespaceRegExp = /\S/; 23594 var unescapedLatinCharacterRegExp2 = /[a-zA-Z]/; 23595 function parse(dateStr, formatStr, referenceDate, options) { 23596 const invalidDate = () => constructFrom(options?.in || referenceDate, NaN); 23597 const defaultOptions2 = getDefaultOptions2(); 23598 const locale = options?.locale ?? defaultOptions2.locale ?? enUS; 23599 const firstWeekContainsDate = options?.firstWeekContainsDate ?? options?.locale?.options?.firstWeekContainsDate ?? defaultOptions2.firstWeekContainsDate ?? defaultOptions2.locale?.options?.firstWeekContainsDate ?? 1; 23600 const weekStartsOn = options?.weekStartsOn ?? options?.locale?.options?.weekStartsOn ?? defaultOptions2.weekStartsOn ?? defaultOptions2.locale?.options?.weekStartsOn ?? 0; 23601 if (!formatStr) 23602 return dateStr ? invalidDate() : toDate(referenceDate, options?.in); 23603 const subFnOptions = { 23604 firstWeekContainsDate, 23605 weekStartsOn, 23606 locale 23607 }; 23608 const setters = [new DateTimezoneSetter(options?.in, referenceDate)]; 23609 const tokens = formatStr.match(longFormattingTokensRegExp2).map((substring) => { 23610 const firstCharacter = substring[0]; 23611 if (firstCharacter in longFormatters) { 23612 const longFormatter = longFormatters[firstCharacter]; 23613 return longFormatter(substring, locale.formatLong); 23614 } 23615 return substring; 23616 }).join("").match(formattingTokensRegExp2); 23617 const usedTokens = []; 23618 for (let token of tokens) { 23619 if (!options?.useAdditionalWeekYearTokens && isProtectedWeekYearToken(token)) { 23620 warnOrThrowProtectedError(token, formatStr, dateStr); 23621 } 23622 if (!options?.useAdditionalDayOfYearTokens && isProtectedDayOfYearToken(token)) { 23623 warnOrThrowProtectedError(token, formatStr, dateStr); 23624 } 23625 const firstCharacter = token[0]; 23626 const parser = parsers[firstCharacter]; 23627 if (parser) { 23628 const { incompatibleTokens } = parser; 23629 if (Array.isArray(incompatibleTokens)) { 23630 const incompatibleToken = usedTokens.find( 23631 (usedToken) => incompatibleTokens.includes(usedToken.token) || usedToken.token === firstCharacter 23632 ); 23633 if (incompatibleToken) { 23634 throw new RangeError( 23635 `The format string mustn't contain \`$incompatibleToken.fullToken}\` and \`$token}\` at the same time` 23636 ); 23637 } 23638 } else if (parser.incompatibleTokens === "*" && usedTokens.length > 0) { 23639 throw new RangeError( 23640 `The format string mustn't contain \`$token}\` and any other token at the same time` 23641 ); 23642 } 23643 usedTokens.push({ token: firstCharacter, fullToken: token }); 23644 const parseResult = parser.run( 23645 dateStr, 23646 token, 23647 locale.match, 23648 subFnOptions 23649 ); 23650 if (!parseResult) { 23651 return invalidDate(); 23652 } 23653 setters.push(parseResult.setter); 23654 dateStr = parseResult.rest; 23655 } else { 23656 if (firstCharacter.match(unescapedLatinCharacterRegExp2)) { 23657 throw new RangeError( 23658 "Format string contains an unescaped latin alphabet character `" + firstCharacter + "`" 23659 ); 23660 } 23661 if (token === "''") { 23662 token = "'"; 23663 } else if (firstCharacter === "'") { 23664 token = cleanEscapedString2(token); 23665 } 23666 if (dateStr.indexOf(token) === 0) { 23667 dateStr = dateStr.slice(token.length); 23668 } else { 23669 return invalidDate(); 23670 } 23671 } 23672 } 23673 if (dateStr.length > 0 && notWhitespaceRegExp.test(dateStr)) { 23674 return invalidDate(); 23675 } 23676 const uniquePrioritySetters = setters.map((setter) => setter.priority).sort((a, b) => b - a).filter((priority, index2, array) => array.indexOf(priority) === index2).map( 23677 (priority) => setters.filter((setter) => setter.priority === priority).sort((a, b) => b.subPriority - a.subPriority) 23678 ).map((setterArray) => setterArray[0]); 23679 let date = toDate(referenceDate, options?.in); 23680 if (isNaN(+date)) return invalidDate(); 23681 const flags = {}; 23682 for (const setter of uniquePrioritySetters) { 23683 if (!setter.validate(date, subFnOptions)) { 23684 return invalidDate(); 23685 } 23686 const result = setter.set(date, flags, subFnOptions); 23687 if (Array.isArray(result)) { 23688 date = result[0]; 23689 Object.assign(flags, result[1]); 23690 } else { 23691 date = result; 23692 } 23693 } 23694 return date; 23695 } 23696 function cleanEscapedString2(input) { 23697 return input.match(escapedStringRegExp2)[1].replace(doubleQuoteRegExp2, "'"); 23698 } 23699 23700 // node_modules/date-fns/isSameMonth.js 23701 function isSameMonth(laterDate, earlierDate, options) { 23702 const [laterDate_, earlierDate_] = normalizeDates( 23703 options?.in, 23704 laterDate, 23705 earlierDate 23706 ); 23707 return laterDate_.getFullYear() === earlierDate_.getFullYear() && laterDate_.getMonth() === earlierDate_.getMonth(); 23708 } 23709 23710 // node_modules/date-fns/isSameYear.js 23711 function isSameYear(laterDate, earlierDate, options) { 23712 const [laterDate_, earlierDate_] = normalizeDates( 23713 options?.in, 23714 laterDate, 23715 earlierDate 23716 ); 23717 return laterDate_.getFullYear() === earlierDate_.getFullYear(); 23718 } 23719 23720 // node_modules/date-fns/subDays.js 23721 function subDays(date, amount, options) { 23722 return addDays(date, -amount, options); 23723 } 23724 23725 // node_modules/date-fns/parseISO.js 23726 function parseISO(argument, options) { 23727 const invalidDate = () => constructFrom(options?.in, NaN); 23728 const additionalDigits = options?.additionalDigits ?? 2; 23729 const dateStrings = splitDateString(argument); 23730 let date; 23731 if (dateStrings.date) { 23732 const parseYearResult = parseYear(dateStrings.date, additionalDigits); 23733 date = parseDate(parseYearResult.restDateString, parseYearResult.year); 23734 } 23735 if (!date || isNaN(+date)) return invalidDate(); 23736 const timestamp = +date; 23737 let time = 0; 23738 let offset4; 23739 if (dateStrings.time) { 23740 time = parseTime(dateStrings.time); 23741 if (isNaN(time)) return invalidDate(); 23742 } 23743 if (dateStrings.timezone) { 23744 offset4 = parseTimezone(dateStrings.timezone); 23745 if (isNaN(offset4)) return invalidDate(); 23746 } else { 23747 const tmpDate = new Date(timestamp + time); 23748 const result = toDate(0, options?.in); 23749 result.setFullYear( 23750 tmpDate.getUTCFullYear(), 23751 tmpDate.getUTCMonth(), 23752 tmpDate.getUTCDate() 23753 ); 23754 result.setHours( 23755 tmpDate.getUTCHours(), 23756 tmpDate.getUTCMinutes(), 23757 tmpDate.getUTCSeconds(), 23758 tmpDate.getUTCMilliseconds() 23759 ); 23760 return result; 23761 } 23762 return toDate(timestamp + time + offset4, options?.in); 23763 } 23764 var patterns = { 23765 dateTimeDelimiter: /[T ]/, 23766 timeZoneDelimiter: /[Z ]/i, 23767 timezone: /([Z+-].*)$/ 23768 }; 23769 var dateRegex = /^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/; 23770 var timeRegex = /^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/; 23771 var timezoneRegex = /^([+-])(\d{2})(?::?(\d{2}))?$/; 23772 function splitDateString(dateString) { 23773 const dateStrings = {}; 23774 const array = dateString.split(patterns.dateTimeDelimiter); 23775 let timeString; 23776 if (array.length > 2) { 23777 return dateStrings; 23778 } 23779 if (/:/.test(array[0])) { 23780 timeString = array[0]; 23781 } else { 23782 dateStrings.date = array[0]; 23783 timeString = array[1]; 23784 if (patterns.timeZoneDelimiter.test(dateStrings.date)) { 23785 dateStrings.date = dateString.split(patterns.timeZoneDelimiter)[0]; 23786 timeString = dateString.substr( 23787 dateStrings.date.length, 23788 dateString.length 23789 ); 23790 } 23791 } 23792 if (timeString) { 23793 const token = patterns.timezone.exec(timeString); 23794 if (token) { 23795 dateStrings.time = timeString.replace(token[1], ""); 23796 dateStrings.timezone = token[1]; 23797 } else { 23798 dateStrings.time = timeString; 23799 } 23800 } 23801 return dateStrings; 23802 } 23803 function parseYear(dateString, additionalDigits) { 23804 const regex = new RegExp( 23805 "^(?:(\\d{4}|[+-]\\d{" + (4 + additionalDigits) + "})|(\\d{2}|[+-]\\d{" + (2 + additionalDigits) + "})$)" 23806 ); 23807 const captures = dateString.match(regex); 23808 if (!captures) return { year: NaN, restDateString: "" }; 23809 const year = captures[1] ? parseInt(captures[1]) : null; 23810 const century = captures[2] ? parseInt(captures[2]) : null; 23811 return { 23812 year: century === null ? year : century * 100, 23813 restDateString: dateString.slice((captures[1] || captures[2]).length) 23814 }; 23815 } 23816 function parseDate(dateString, year) { 23817 if (year === null) return /* @__PURE__ */ new Date(NaN); 23818 const captures = dateString.match(dateRegex); 23819 if (!captures) return /* @__PURE__ */ new Date(NaN); 23820 const isWeekDate = !!captures[4]; 23821 const dayOfYear = parseDateUnit(captures[1]); 23822 const month = parseDateUnit(captures[2]) - 1; 23823 const day = parseDateUnit(captures[3]); 23824 const week = parseDateUnit(captures[4]); 23825 const dayOfWeek = parseDateUnit(captures[5]) - 1; 23826 if (isWeekDate) { 23827 if (!validateWeekDate(year, week, dayOfWeek)) { 23828 return /* @__PURE__ */ new Date(NaN); 23829 } 23830 return dayOfISOWeekYear(year, week, dayOfWeek); 23831 } else { 23832 const date = /* @__PURE__ */ new Date(0); 23833 if (!validateDate(year, month, day) || !validateDayOfYearDate(year, dayOfYear)) { 23834 return /* @__PURE__ */ new Date(NaN); 23835 } 23836 date.setUTCFullYear(year, month, Math.max(dayOfYear, day)); 23837 return date; 23838 } 23839 } 23840 function parseDateUnit(value) { 23841 return value ? parseInt(value) : 1; 23842 } 23843 function parseTime(timeString) { 23844 const captures = timeString.match(timeRegex); 23845 if (!captures) return NaN; 23846 const hours = parseTimeUnit(captures[1]); 23847 const minutes = parseTimeUnit(captures[2]); 23848 const seconds = parseTimeUnit(captures[3]); 23849 if (!validateTime(hours, minutes, seconds)) { 23850 return NaN; 23851 } 23852 return hours * millisecondsInHour + minutes * millisecondsInMinute + seconds * 1e3; 23853 } 23854 function parseTimeUnit(value) { 23855 return value && parseFloat(value.replace(",", ".")) || 0; 23856 } 23857 function parseTimezone(timezoneString) { 23858 if (timezoneString === "Z") return 0; 23859 const captures = timezoneString.match(timezoneRegex); 23860 if (!captures) return 0; 23861 const sign = captures[1] === "+" ? -1 : 1; 23862 const hours = parseInt(captures[2]); 23863 const minutes = captures[3] && parseInt(captures[3]) || 0; 23864 if (!validateTimezone(hours, minutes)) { 23865 return NaN; 23866 } 23867 return sign * (hours * millisecondsInHour + minutes * millisecondsInMinute); 23868 } 23869 function dayOfISOWeekYear(isoWeekYear, week, day) { 23870 const date = /* @__PURE__ */ new Date(0); 23871 date.setUTCFullYear(isoWeekYear, 0, 4); 23872 const fourthOfJanuaryDay = date.getUTCDay() || 7; 23873 const diff = (week - 1) * 7 + day + 1 - fourthOfJanuaryDay; 23874 date.setUTCDate(date.getUTCDate() + diff); 23875 return date; 23876 } 23877 var daysInMonths = [31, null, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]; 23878 function isLeapYearIndex2(year) { 23879 return year % 400 === 0 || year % 4 === 0 && year % 100 !== 0; 23880 } 23881 function validateDate(year, month, date) { 23882 return month >= 0 && month <= 11 && date >= 1 && date <= (daysInMonths[month] || (isLeapYearIndex2(year) ? 29 : 28)); 23883 } 23884 function validateDayOfYearDate(year, dayOfYear) { 23885 return dayOfYear >= 1 && dayOfYear <= (isLeapYearIndex2(year) ? 366 : 365); 23886 } 23887 function validateWeekDate(_year, week, day) { 23888 return week >= 1 && week <= 53 && day >= 0 && day <= 6; 23889 } 23890 function validateTime(hours, minutes, seconds) { 23891 if (hours === 24) { 23892 return minutes === 0 && seconds === 0; 23893 } 23894 return seconds >= 0 && seconds < 60 && minutes >= 0 && minutes < 60 && hours >= 0 && hours < 25; 23895 } 23896 function validateTimezone(_hours, minutes) { 23897 return minutes >= 0 && minutes <= 59; 23898 } 23899 23900 // node_modules/date-fns/setMonth.js 23901 function setMonth(date, month, options) { 23902 const _date = toDate(date, options?.in); 23903 const year = _date.getFullYear(); 23904 const day = _date.getDate(); 23905 const midMonth = constructFrom(options?.in || date, 0); 23906 midMonth.setFullYear(year, month, 15); 23907 midMonth.setHours(0, 0, 0, 0); 23908 const daysInMonth = getDaysInMonth(midMonth); 23909 _date.setMonth(month, Math.min(day, daysInMonth)); 23910 return _date; 23911 } 23912 23913 // node_modules/date-fns/setYear.js 23914 function setYear(date, year, options) { 23915 const date_ = toDate(date, options?.in); 23916 if (isNaN(+date_)) return constructFrom(options?.in || date, NaN); 23917 date_.setFullYear(year); 23918 return date_; 23919 } 23920 23921 // node_modules/date-fns/subMonths.js 23922 function subMonths(date, amount, options) { 23923 return addMonths(date, -amount, options); 23924 } 23925 23926 // node_modules/date-fns/subWeeks.js 23927 function subWeeks(date, amount, options) { 23928 return addWeeks(date, -amount, options); 23929 } 23930 23931 // node_modules/date-fns/subYears.js 23932 function subYears(date, amount, options) { 23933 return addYears(date, -amount, options); 23934 } 23935 23936 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/helpers/getBroadcastWeeksInMonth.js 23937 var FIVE_WEEKS = 5; 23938 var FOUR_WEEKS = 4; 23939 function getBroadcastWeeksInMonth(month, dateLib) { 23940 const firstDayOfMonth = dateLib.startOfMonth(month); 23941 const firstDayOfWeek = firstDayOfMonth.getDay() > 0 ? firstDayOfMonth.getDay() : 7; 23942 const broadcastStartDate = dateLib.addDays(month, -firstDayOfWeek + 1); 23943 const lastDateOfLastWeek = dateLib.addDays(broadcastStartDate, FIVE_WEEKS * 7 - 1); 23944 const numberOfWeeks = dateLib.getMonth(month) === dateLib.getMonth(lastDateOfLastWeek) ? FIVE_WEEKS : FOUR_WEEKS; 23945 return numberOfWeeks; 23946 } 23947 23948 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/helpers/startOfBroadcastWeek.js 23949 function startOfBroadcastWeek(date, dateLib) { 23950 const firstOfMonth = dateLib.startOfMonth(date); 23951 const dayOfWeek = firstOfMonth.getDay(); 23952 if (dayOfWeek === 1) { 23953 return firstOfMonth; 23954 } else if (dayOfWeek === 0) { 23955 return dateLib.addDays(firstOfMonth, -1 * 6); 23956 } else { 23957 return dateLib.addDays(firstOfMonth, -1 * (dayOfWeek - 1)); 23958 } 23959 } 23960 23961 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/helpers/endOfBroadcastWeek.js 23962 function endOfBroadcastWeek(date, dateLib) { 23963 const startDate = startOfBroadcastWeek(date, dateLib); 23964 const numberOfWeeks = getBroadcastWeeksInMonth(date, dateLib); 23965 const endDate = dateLib.addDays(startDate, numberOfWeeks * 7 - 1); 23966 return endDate; 23967 } 23968 23969 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/locale/en-US.js 23970 var enUS2 = { 23971 ...enUS, 23972 labels: { 23973 labelDayButton: (date, modifiers, options, dateLib) => { 23974 let formatDate2; 23975 if (dateLib && typeof dateLib.format === "function") { 23976 formatDate2 = dateLib.format.bind(dateLib); 23977 } else { 23978 formatDate2 = (d, pattern) => format(d, pattern, { locale: enUS, ...options }); 23979 } 23980 let label = formatDate2(date, "PPPP"); 23981 if (modifiers.today) 23982 label = `Today, $label}`; 23983 if (modifiers.selected) 23984 label = `$label}, selected`; 23985 return label; 23986 }, 23987 labelMonthDropdown: "Choose the Month", 23988 labelNext: "Go to the Next Month", 23989 labelPrevious: "Go to the Previous Month", 23990 labelWeekNumber: (weekNumber) => `Week $weekNumber}`, 23991 labelYearDropdown: "Choose the Year", 23992 labelGrid: (date, options, dateLib) => { 23993 let formatDate2; 23994 if (dateLib && typeof dateLib.format === "function") { 23995 formatDate2 = dateLib.format.bind(dateLib); 23996 } else { 23997 formatDate2 = (d, pattern) => format(d, pattern, { locale: enUS, ...options }); 23998 } 23999 return formatDate2(date, "LLLL yyyy"); 24000 }, 24001 labelGridcell: (date, modifiers, options, dateLib) => { 24002 let formatDate2; 24003 if (dateLib && typeof dateLib.format === "function") { 24004 formatDate2 = dateLib.format.bind(dateLib); 24005 } else { 24006 formatDate2 = (d, pattern) => format(d, pattern, { locale: enUS, ...options }); 24007 } 24008 let label = formatDate2(date, "PPPP"); 24009 if (modifiers?.today) { 24010 label = `Today, $label}`; 24011 } 24012 return label; 24013 }, 24014 labelNav: "Navigation bar", 24015 labelWeekNumberHeader: "Week Number", 24016 labelWeekday: (date, options, dateLib) => { 24017 let formatDate2; 24018 if (dateLib && typeof dateLib.format === "function") { 24019 formatDate2 = dateLib.format.bind(dateLib); 24020 } else { 24021 formatDate2 = (d, pattern) => format(d, pattern, { locale: enUS, ...options }); 24022 } 24023 return formatDate2(date, "cccc"); 24024 } 24025 } 24026 }; 24027 24028 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/classes/DateLib.js 24029 var DateLib = class _DateLib { 24030 /** 24031 * Creates an instance of `DateLib`. 24032 * 24033 * @param options Configuration options for the date library. 24034 * @param overrides Custom overrides for the date library functions. 24035 */ 24036 constructor(options, overrides) { 24037 this.today = () => { 24038 if (this.overrides?.today) { 24039 return this.overrides.today(); 24040 } 24041 if (this.options.timeZone) { 24042 return TZDate.tz(this.options.timeZone); 24043 } 24044 const DateCtor = this.options.Date ?? Date; 24045 return new DateCtor(); 24046 }; 24047 this.newDate = (year, monthIndex, date) => { 24048 if (this.overrides?.newDate) { 24049 return this.overrides.newDate(year, monthIndex, date); 24050 } 24051 if (this.options.timeZone) { 24052 return new TZDate(year, monthIndex, date, this.options.timeZone); 24053 } 24054 return new Date(year, monthIndex, date); 24055 }; 24056 this.addDays = (date, amount) => { 24057 return this.overrides?.addDays ? this.overrides.addDays(date, amount) : addDays(date, amount); 24058 }; 24059 this.addMonths = (date, amount) => { 24060 return this.overrides?.addMonths ? this.overrides.addMonths(date, amount) : addMonths(date, amount); 24061 }; 24062 this.addWeeks = (date, amount) => { 24063 return this.overrides?.addWeeks ? this.overrides.addWeeks(date, amount) : addWeeks(date, amount); 24064 }; 24065 this.addYears = (date, amount) => { 24066 return this.overrides?.addYears ? this.overrides.addYears(date, amount) : addYears(date, amount); 24067 }; 24068 this.differenceInCalendarDays = (dateLeft, dateRight) => { 24069 return this.overrides?.differenceInCalendarDays ? this.overrides.differenceInCalendarDays(dateLeft, dateRight) : differenceInCalendarDays(dateLeft, dateRight); 24070 }; 24071 this.differenceInCalendarMonths = (dateLeft, dateRight) => { 24072 return this.overrides?.differenceInCalendarMonths ? this.overrides.differenceInCalendarMonths(dateLeft, dateRight) : differenceInCalendarMonths(dateLeft, dateRight); 24073 }; 24074 this.eachMonthOfInterval = (interval) => { 24075 return this.overrides?.eachMonthOfInterval ? this.overrides.eachMonthOfInterval(interval) : eachMonthOfInterval(interval); 24076 }; 24077 this.eachYearOfInterval = (interval) => { 24078 const years = this.overrides?.eachYearOfInterval ? this.overrides.eachYearOfInterval(interval) : eachYearOfInterval(interval); 24079 const uniqueYears = new Set(years.map((d) => this.getYear(d))); 24080 if (uniqueYears.size === years.length) { 24081 return years; 24082 } 24083 const yearsArray = []; 24084 uniqueYears.forEach((y2) => { 24085 yearsArray.push(new Date(y2, 0, 1)); 24086 }); 24087 return yearsArray; 24088 }; 24089 this.endOfBroadcastWeek = (date) => { 24090 return this.overrides?.endOfBroadcastWeek ? this.overrides.endOfBroadcastWeek(date) : endOfBroadcastWeek(date, this); 24091 }; 24092 this.endOfISOWeek = (date) => { 24093 return this.overrides?.endOfISOWeek ? this.overrides.endOfISOWeek(date) : endOfISOWeek(date); 24094 }; 24095 this.endOfMonth = (date) => { 24096 return this.overrides?.endOfMonth ? this.overrides.endOfMonth(date) : endOfMonth(date); 24097 }; 24098 this.endOfWeek = (date, options2) => { 24099 return this.overrides?.endOfWeek ? this.overrides.endOfWeek(date, options2) : endOfWeek(date, this.options); 24100 }; 24101 this.endOfYear = (date) => { 24102 return this.overrides?.endOfYear ? this.overrides.endOfYear(date) : endOfYear(date); 24103 }; 24104 this.format = (date, formatStr, _options) => { 24105 const formatted = this.overrides?.format ? this.overrides.format(date, formatStr, this.options) : format(date, formatStr, this.options); 24106 if (this.options.numerals && this.options.numerals !== "latn") { 24107 return this.replaceDigits(formatted); 24108 } 24109 return formatted; 24110 }; 24111 this.getISOWeek = (date) => { 24112 return this.overrides?.getISOWeek ? this.overrides.getISOWeek(date) : getISOWeek(date); 24113 }; 24114 this.getMonth = (date, _options) => { 24115 return this.overrides?.getMonth ? this.overrides.getMonth(date, this.options) : getMonth(date, this.options); 24116 }; 24117 this.getYear = (date, _options) => { 24118 return this.overrides?.getYear ? this.overrides.getYear(date, this.options) : getYear(date, this.options); 24119 }; 24120 this.getWeek = (date, _options) => { 24121 return this.overrides?.getWeek ? this.overrides.getWeek(date, this.options) : getWeek(date, this.options); 24122 }; 24123 this.isAfter = (date, dateToCompare) => { 24124 return this.overrides?.isAfter ? this.overrides.isAfter(date, dateToCompare) : isAfter(date, dateToCompare); 24125 }; 24126 this.isBefore = (date, dateToCompare) => { 24127 return this.overrides?.isBefore ? this.overrides.isBefore(date, dateToCompare) : isBefore(date, dateToCompare); 24128 }; 24129 this.isDate = (value) => { 24130 return this.overrides?.isDate ? this.overrides.isDate(value) : isDate(value); 24131 }; 24132 this.isSameDay = (dateLeft, dateRight) => { 24133 return this.overrides?.isSameDay ? this.overrides.isSameDay(dateLeft, dateRight) : isSameDay(dateLeft, dateRight); 24134 }; 24135 this.isSameMonth = (dateLeft, dateRight) => { 24136 return this.overrides?.isSameMonth ? this.overrides.isSameMonth(dateLeft, dateRight) : isSameMonth(dateLeft, dateRight); 24137 }; 24138 this.isSameYear = (dateLeft, dateRight) => { 24139 return this.overrides?.isSameYear ? this.overrides.isSameYear(dateLeft, dateRight) : isSameYear(dateLeft, dateRight); 24140 }; 24141 this.max = (dates) => { 24142 return this.overrides?.max ? this.overrides.max(dates) : max2(dates); 24143 }; 24144 this.min = (dates) => { 24145 return this.overrides?.min ? this.overrides.min(dates) : min2(dates); 24146 }; 24147 this.setMonth = (date, month) => { 24148 return this.overrides?.setMonth ? this.overrides.setMonth(date, month) : setMonth(date, month); 24149 }; 24150 this.setYear = (date, year) => { 24151 return this.overrides?.setYear ? this.overrides.setYear(date, year) : setYear(date, year); 24152 }; 24153 this.startOfBroadcastWeek = (date, _dateLib) => { 24154 return this.overrides?.startOfBroadcastWeek ? this.overrides.startOfBroadcastWeek(date, this) : startOfBroadcastWeek(date, this); 24155 }; 24156 this.startOfDay = (date) => { 24157 return this.overrides?.startOfDay ? this.overrides.startOfDay(date) : startOfDay(date); 24158 }; 24159 this.startOfISOWeek = (date) => { 24160 return this.overrides?.startOfISOWeek ? this.overrides.startOfISOWeek(date) : startOfISOWeek(date); 24161 }; 24162 this.startOfMonth = (date) => { 24163 return this.overrides?.startOfMonth ? this.overrides.startOfMonth(date) : startOfMonth(date); 24164 }; 24165 this.startOfWeek = (date, _options) => { 24166 return this.overrides?.startOfWeek ? this.overrides.startOfWeek(date, this.options) : startOfWeek(date, this.options); 24167 }; 24168 this.startOfYear = (date) => { 24169 return this.overrides?.startOfYear ? this.overrides.startOfYear(date) : startOfYear(date); 24170 }; 24171 this.options = { locale: enUS2, ...options }; 24172 this.overrides = overrides; 24173 } 24174 /** 24175 * Generates a mapping of Arabic digits (0-9) to the target numbering system 24176 * digits. 24177 * 24178 * @since 9.5.0 24179 * @returns A record mapping Arabic digits to the target numerals. 24180 */ 24181 getDigitMap() { 24182 const { numerals = "latn" } = this.options; 24183 const formatter = new Intl.NumberFormat("en-US", { 24184 numberingSystem: numerals 24185 }); 24186 const digitMap = {}; 24187 for (let i = 0; i < 10; i++) { 24188 digitMap[i.toString()] = formatter.format(i); 24189 } 24190 return digitMap; 24191 } 24192 /** 24193 * Replaces Arabic digits in a string with the target numbering system digits. 24194 * 24195 * @since 9.5.0 24196 * @param input The string containing Arabic digits. 24197 * @returns The string with digits replaced. 24198 */ 24199 replaceDigits(input) { 24200 const digitMap = this.getDigitMap(); 24201 return input.replace(/\d/g, (digit) => digitMap[digit] || digit); 24202 } 24203 /** 24204 * Formats a number using the configured numbering system. 24205 * 24206 * @since 9.5.0 24207 * @param value The number to format. 24208 * @returns The formatted number as a string. 24209 */ 24210 formatNumber(value) { 24211 return this.replaceDigits(value.toString()); 24212 } 24213 /** 24214 * Returns the preferred ordering for month and year labels for the current 24215 * locale. 24216 */ 24217 getMonthYearOrder() { 24218 const code = this.options.locale?.code; 24219 if (!code) { 24220 return "month-first"; 24221 } 24222 return _DateLib.yearFirstLocales.has(code) ? "year-first" : "month-first"; 24223 } 24224 /** 24225 * Formats the month/year pair respecting locale conventions. 24226 * 24227 * @since 9.11.0 24228 */ 24229 formatMonthYear(date) { 24230 const { locale, timeZone, numerals } = this.options; 24231 const localeCode = locale?.code; 24232 if (localeCode && _DateLib.yearFirstLocales.has(localeCode)) { 24233 try { 24234 const intl = new Intl.DateTimeFormat(localeCode, { 24235 month: "long", 24236 year: "numeric", 24237 timeZone, 24238 numberingSystem: numerals 24239 }); 24240 const formatted = intl.format(date); 24241 return formatted; 24242 } catch { 24243 } 24244 } 24245 const pattern = this.getMonthYearOrder() === "year-first" ? "y LLLL" : "LLLL y"; 24246 return this.format(date, pattern); 24247 } 24248 }; 24249 DateLib.yearFirstLocales = /* @__PURE__ */ new Set([ 24250 "eu", 24251 "hu", 24252 "ja", 24253 "ja-Hira", 24254 "ja-JP", 24255 "ko", 24256 "ko-KR", 24257 "lt", 24258 "lt-LT", 24259 "lv", 24260 "lv-LV", 24261 "mn", 24262 "mn-MN", 24263 "zh", 24264 "zh-CN", 24265 "zh-HK", 24266 "zh-TW" 24267 ]); 24268 var defaultDateLib = new DateLib(); 24269 24270 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/classes/CalendarDay.js 24271 var CalendarDay = class { 24272 constructor(date, displayMonth, dateLib = defaultDateLib) { 24273 this.date = date; 24274 this.displayMonth = displayMonth; 24275 this.outside = Boolean(displayMonth && !dateLib.isSameMonth(date, displayMonth)); 24276 this.dateLib = dateLib; 24277 this.isoDate = dateLib.format(date, "yyyy-MM-dd"); 24278 this.displayMonthId = dateLib.format(displayMonth, "yyyy-MM"); 24279 this.dateMonthId = dateLib.format(date, "yyyy-MM"); 24280 } 24281 /** 24282 * Checks if this day is equal to another `CalendarDay`, considering both the 24283 * date and the displayed month. 24284 * 24285 * @param day The `CalendarDay` to compare with. 24286 * @returns `true` if the days are equal, otherwise `false`. 24287 */ 24288 isEqualTo(day) { 24289 return this.dateLib.isSameDay(day.date, this.date) && this.dateLib.isSameMonth(day.displayMonth, this.displayMonth); 24290 } 24291 }; 24292 24293 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/classes/CalendarMonth.js 24294 var CalendarMonth = class { 24295 constructor(month, weeks) { 24296 this.date = month; 24297 this.weeks = weeks; 24298 } 24299 }; 24300 24301 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/classes/CalendarWeek.js 24302 var CalendarWeek = class { 24303 constructor(weekNumber, days) { 24304 this.days = days; 24305 this.weekNumber = weekNumber; 24306 } 24307 }; 24308 24309 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/components/custom-components.js 24310 var custom_components_exports = {}; 24311 __export(custom_components_exports, { 24312 CaptionLabel: () => CaptionLabel, 24313 Chevron: () => Chevron, 24314 Day: () => Day, 24315 DayButton: () => DayButton, 24316 Dropdown: () => Dropdown, 24317 DropdownNav: () => DropdownNav, 24318 Footer: () => Footer, 24319 Month: () => Month, 24320 MonthCaption: () => MonthCaption, 24321 MonthGrid: () => MonthGrid, 24322 Months: () => Months, 24323 MonthsDropdown: () => MonthsDropdown, 24324 Nav: () => Nav, 24325 NextMonthButton: () => NextMonthButton, 24326 Option: () => Option, 24327 PreviousMonthButton: () => PreviousMonthButton, 24328 Root: () => Root3, 24329 Select: () => Select, 24330 Week: () => Week, 24331 WeekNumber: () => WeekNumber, 24332 WeekNumberHeader: () => WeekNumberHeader, 24333 Weekday: () => Weekday, 24334 Weekdays: () => Weekdays, 24335 Weeks: () => Weeks, 24336 YearsDropdown: () => YearsDropdown 24337 }); 24338 24339 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/components/CaptionLabel.js 24340 var import_react6 = __toESM(require_react(), 1); 24341 function CaptionLabel(props) { 24342 return import_react6.default.createElement("span", { ...props }); 24343 } 24344 24345 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/components/Chevron.js 24346 var import_react7 = __toESM(require_react(), 1); 24347 function Chevron(props) { 24348 const { size: size4 = 24, orientation = "left", className, style } = props; 24349 return import_react7.default.createElement( 24350 "svg", 24351 { className, style, width: size4, height: size4, viewBox: "0 0 24 24" }, 24352 orientation === "up" && import_react7.default.createElement("polygon", { points: "6.77 17 12.5 11.43 18.24 17 20 15.28 12.5 8 5 15.28" }), 24353 orientation === "down" && import_react7.default.createElement("polygon", { points: "6.77 8 12.5 13.57 18.24 8 20 9.72 12.5 17 5 9.72" }), 24354 orientation === "left" && import_react7.default.createElement("polygon", { points: "16 18.112 9.81111111 12 16 5.87733333 14.0888889 4 6 12 14.0888889 20" }), 24355 orientation === "right" && import_react7.default.createElement("polygon", { points: "8 18.112 14.18888889 12 8 5.87733333 9.91111111 4 18 12 9.91111111 20" }) 24356 ); 24357 } 24358 24359 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/components/Day.js 24360 var import_react8 = __toESM(require_react(), 1); 24361 function Day(props) { 24362 const { day, modifiers, ...tdProps } = props; 24363 return import_react8.default.createElement("td", { ...tdProps }); 24364 } 24365 24366 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/components/DayButton.js 24367 var import_react9 = __toESM(require_react(), 1); 24368 function DayButton(props) { 24369 const { day, modifiers, ...buttonProps } = props; 24370 const ref = import_react9.default.useRef(null); 24371 import_react9.default.useEffect(() => { 24372 if (modifiers.focused) 24373 ref.current?.focus(); 24374 }, [modifiers.focused]); 24375 return import_react9.default.createElement("button", { ref, ...buttonProps }); 24376 } 24377 24378 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/components/Dropdown.js 24379 var import_react11 = __toESM(require_react(), 1); 24380 24381 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/UI.js 24382 var UI; 24383 (function(UI2) { 24384 UI2["Root"] = "root"; 24385 UI2["Chevron"] = "chevron"; 24386 UI2["Day"] = "day"; 24387 UI2["DayButton"] = "day_button"; 24388 UI2["CaptionLabel"] = "caption_label"; 24389 UI2["Dropdowns"] = "dropdowns"; 24390 UI2["Dropdown"] = "dropdown"; 24391 UI2["DropdownRoot"] = "dropdown_root"; 24392 UI2["Footer"] = "footer"; 24393 UI2["MonthGrid"] = "month_grid"; 24394 UI2["MonthCaption"] = "month_caption"; 24395 UI2["MonthsDropdown"] = "months_dropdown"; 24396 UI2["Month"] = "month"; 24397 UI2["Months"] = "months"; 24398 UI2["Nav"] = "nav"; 24399 UI2["NextMonthButton"] = "button_next"; 24400 UI2["PreviousMonthButton"] = "button_previous"; 24401 UI2["Week"] = "week"; 24402 UI2["Weeks"] = "weeks"; 24403 UI2["Weekday"] = "weekday"; 24404 UI2["Weekdays"] = "weekdays"; 24405 UI2["WeekNumber"] = "week_number"; 24406 UI2["WeekNumberHeader"] = "week_number_header"; 24407 UI2["YearsDropdown"] = "years_dropdown"; 24408 })(UI || (UI = {})); 24409 var DayFlag; 24410 (function(DayFlag2) { 24411 DayFlag2["disabled"] = "disabled"; 24412 DayFlag2["hidden"] = "hidden"; 24413 DayFlag2["outside"] = "outside"; 24414 DayFlag2["focused"] = "focused"; 24415 DayFlag2["today"] = "today"; 24416 })(DayFlag || (DayFlag = {})); 24417 var SelectionState; 24418 (function(SelectionState2) { 24419 SelectionState2["range_end"] = "range_end"; 24420 SelectionState2["range_middle"] = "range_middle"; 24421 SelectionState2["range_start"] = "range_start"; 24422 SelectionState2["selected"] = "selected"; 24423 })(SelectionState || (SelectionState = {})); 24424 var Animation; 24425 (function(Animation2) { 24426 Animation2["weeks_before_enter"] = "weeks_before_enter"; 24427 Animation2["weeks_before_exit"] = "weeks_before_exit"; 24428 Animation2["weeks_after_enter"] = "weeks_after_enter"; 24429 Animation2["weeks_after_exit"] = "weeks_after_exit"; 24430 Animation2["caption_after_enter"] = "caption_after_enter"; 24431 Animation2["caption_after_exit"] = "caption_after_exit"; 24432 Animation2["caption_before_enter"] = "caption_before_enter"; 24433 Animation2["caption_before_exit"] = "caption_before_exit"; 24434 })(Animation || (Animation = {})); 24435 24436 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/useDayPicker.js 24437 var import_react10 = __toESM(require_react(), 1); 24438 var dayPickerContext = (0, import_react10.createContext)(void 0); 24439 function useDayPicker() { 24440 const context = (0, import_react10.useContext)(dayPickerContext); 24441 if (context === void 0) { 24442 throw new Error("useDayPicker() must be used within a custom component."); 24443 } 24444 return context; 24445 } 24446 24447 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/components/Dropdown.js 24448 function Dropdown(props) { 24449 const { options, className, ...selectProps } = props; 24450 const { classNames, components, styles } = useDayPicker(); 24451 const cssClassSelect = [classNames[UI.Dropdown], className].join(" "); 24452 const selectedOption = options?.find(({ value }) => value === selectProps.value); 24453 return import_react11.default.createElement( 24454 "span", 24455 { "data-disabled": selectProps.disabled, className: classNames[UI.DropdownRoot], style: styles?.[UI.DropdownRoot] }, 24456 import_react11.default.createElement(components.Select, { className: cssClassSelect, ...selectProps }, options?.map(({ value, label, disabled: disabled2 }) => import_react11.default.createElement(components.Option, { key: value, value, disabled: disabled2 }, label))), 24457 import_react11.default.createElement( 24458 "span", 24459 { className: classNames[UI.CaptionLabel], style: styles?.[UI.CaptionLabel], "aria-hidden": true }, 24460 selectedOption?.label, 24461 import_react11.default.createElement(components.Chevron, { orientation: "down", size: 18, className: classNames[UI.Chevron], style: styles?.[UI.Chevron] }) 24462 ) 24463 ); 24464 } 24465 24466 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/components/DropdownNav.js 24467 var import_react12 = __toESM(require_react(), 1); 24468 function DropdownNav(props) { 24469 return import_react12.default.createElement("div", { ...props }); 24470 } 24471 24472 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/components/Footer.js 24473 var import_react13 = __toESM(require_react(), 1); 24474 function Footer(props) { 24475 return import_react13.default.createElement("div", { ...props }); 24476 } 24477 24478 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/components/Month.js 24479 var import_react14 = __toESM(require_react(), 1); 24480 function Month(props) { 24481 const { calendarMonth, displayIndex, ...divProps } = props; 24482 return import_react14.default.createElement("div", { ...divProps }, props.children); 24483 } 24484 24485 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/components/MonthCaption.js 24486 var import_react15 = __toESM(require_react(), 1); 24487 function MonthCaption(props) { 24488 const { calendarMonth, displayIndex, ...divProps } = props; 24489 return import_react15.default.createElement("div", { ...divProps }); 24490 } 24491 24492 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/components/MonthGrid.js 24493 var import_react16 = __toESM(require_react(), 1); 24494 function MonthGrid(props) { 24495 return import_react16.default.createElement("table", { ...props }); 24496 } 24497 24498 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/components/Months.js 24499 var import_react17 = __toESM(require_react(), 1); 24500 function Months(props) { 24501 return import_react17.default.createElement("div", { ...props }); 24502 } 24503 24504 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/components/MonthsDropdown.js 24505 var import_react18 = __toESM(require_react(), 1); 24506 function MonthsDropdown(props) { 24507 const { components } = useDayPicker(); 24508 return import_react18.default.createElement(components.Dropdown, { ...props }); 24509 } 24510 24511 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/components/Nav.js 24512 var import_react19 = __toESM(require_react(), 1); 24513 function Nav(props) { 24514 const { onPreviousClick, onNextClick, previousMonth, nextMonth, ...navProps } = props; 24515 const { components, classNames, styles, labels: { labelPrevious: labelPrevious2, labelNext: labelNext2 } } = useDayPicker(); 24516 const handleNextClick = (0, import_react19.useCallback)((e) => { 24517 if (nextMonth) { 24518 onNextClick?.(e); 24519 } 24520 }, [nextMonth, onNextClick]); 24521 const handlePreviousClick = (0, import_react19.useCallback)((e) => { 24522 if (previousMonth) { 24523 onPreviousClick?.(e); 24524 } 24525 }, [previousMonth, onPreviousClick]); 24526 return import_react19.default.createElement( 24527 "nav", 24528 { ...navProps }, 24529 import_react19.default.createElement( 24530 components.PreviousMonthButton, 24531 { type: "button", className: classNames[UI.PreviousMonthButton], style: styles?.[UI.PreviousMonthButton], tabIndex: previousMonth ? void 0 : -1, "aria-disabled": previousMonth ? void 0 : true, "aria-label": labelPrevious2(previousMonth), onClick: handlePreviousClick }, 24532 import_react19.default.createElement(components.Chevron, { disabled: previousMonth ? void 0 : true, className: classNames[UI.Chevron], style: styles?.[UI.Chevron], orientation: "left" }) 24533 ), 24534 import_react19.default.createElement( 24535 components.NextMonthButton, 24536 { type: "button", className: classNames[UI.NextMonthButton], style: styles?.[UI.NextMonthButton], tabIndex: nextMonth ? void 0 : -1, "aria-disabled": nextMonth ? void 0 : true, "aria-label": labelNext2(nextMonth), onClick: handleNextClick }, 24537 import_react19.default.createElement(components.Chevron, { disabled: nextMonth ? void 0 : true, orientation: "right", className: classNames[UI.Chevron], style: styles?.[UI.Chevron] }) 24538 ) 24539 ); 24540 } 24541 24542 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/components/NextMonthButton.js 24543 var import_react20 = __toESM(require_react(), 1); 24544 function NextMonthButton(props) { 24545 return import_react20.default.createElement("button", { ...props }); 24546 } 24547 24548 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/components/Option.js 24549 var import_react21 = __toESM(require_react(), 1); 24550 function Option(props) { 24551 return import_react21.default.createElement("option", { ...props }); 24552 } 24553 24554 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/components/PreviousMonthButton.js 24555 var import_react22 = __toESM(require_react(), 1); 24556 function PreviousMonthButton(props) { 24557 return import_react22.default.createElement("button", { ...props }); 24558 } 24559 24560 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/components/Root.js 24561 var import_react23 = __toESM(require_react(), 1); 24562 function Root3(props) { 24563 const { rootRef, ...rest } = props; 24564 return import_react23.default.createElement("div", { ...rest, ref: rootRef }); 24565 } 24566 24567 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/components/Select.js 24568 var import_react24 = __toESM(require_react(), 1); 24569 function Select(props) { 24570 return import_react24.default.createElement("select", { ...props }); 24571 } 24572 24573 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/components/Week.js 24574 var import_react25 = __toESM(require_react(), 1); 24575 function Week(props) { 24576 const { week, ...trProps } = props; 24577 return import_react25.default.createElement("tr", { ...trProps }); 24578 } 24579 24580 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/components/Weekday.js 24581 var import_react26 = __toESM(require_react(), 1); 24582 function Weekday(props) { 24583 return import_react26.default.createElement("th", { ...props }); 24584 } 24585 24586 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/components/Weekdays.js 24587 var import_react27 = __toESM(require_react(), 1); 24588 function Weekdays(props) { 24589 return import_react27.default.createElement( 24590 "thead", 24591 { "aria-hidden": true }, 24592 import_react27.default.createElement("tr", { ...props }) 24593 ); 24594 } 24595 24596 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/components/WeekNumber.js 24597 var import_react28 = __toESM(require_react(), 1); 24598 function WeekNumber(props) { 24599 const { week, ...thProps } = props; 24600 return import_react28.default.createElement("th", { ...thProps }); 24601 } 24602 24603 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/components/WeekNumberHeader.js 24604 var import_react29 = __toESM(require_react(), 1); 24605 function WeekNumberHeader(props) { 24606 return import_react29.default.createElement("th", { ...props }); 24607 } 24608 24609 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/components/Weeks.js 24610 var import_react30 = __toESM(require_react(), 1); 24611 function Weeks(props) { 24612 return import_react30.default.createElement("tbody", { ...props }); 24613 } 24614 24615 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/components/YearsDropdown.js 24616 var import_react31 = __toESM(require_react(), 1); 24617 function YearsDropdown(props) { 24618 const { components } = useDayPicker(); 24619 return import_react31.default.createElement(components.Dropdown, { ...props }); 24620 } 24621 24622 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/DayPicker.js 24623 var import_react36 = __toESM(require_react(), 1); 24624 24625 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/utils/rangeIncludesDate.js 24626 function rangeIncludesDate(range, date, excludeEnds = false, dateLib = defaultDateLib) { 24627 let { from, to } = range; 24628 const { differenceInCalendarDays: differenceInCalendarDays2, isSameDay: isSameDay2 } = dateLib; 24629 if (from && to) { 24630 const isRangeInverted = differenceInCalendarDays2(to, from) < 0; 24631 if (isRangeInverted) { 24632 [from, to] = [to, from]; 24633 } 24634 const isInRange = differenceInCalendarDays2(date, from) >= (excludeEnds ? 1 : 0) && differenceInCalendarDays2(to, date) >= (excludeEnds ? 1 : 0); 24635 return isInRange; 24636 } 24637 if (!excludeEnds && to) { 24638 return isSameDay2(to, date); 24639 } 24640 if (!excludeEnds && from) { 24641 return isSameDay2(from, date); 24642 } 24643 return false; 24644 } 24645 24646 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/utils/typeguards.js 24647 function isDateInterval(matcher) { 24648 return Boolean(matcher && typeof matcher === "object" && "before" in matcher && "after" in matcher); 24649 } 24650 function isDateRange(value) { 24651 return Boolean(value && typeof value === "object" && "from" in value); 24652 } 24653 function isDateAfterType(value) { 24654 return Boolean(value && typeof value === "object" && "after" in value); 24655 } 24656 function isDateBeforeType(value) { 24657 return Boolean(value && typeof value === "object" && "before" in value); 24658 } 24659 function isDayOfWeekType(value) { 24660 return Boolean(value && typeof value === "object" && "dayOfWeek" in value); 24661 } 24662 function isDatesArray(value, dateLib) { 24663 return Array.isArray(value) && value.every(dateLib.isDate); 24664 } 24665 24666 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/utils/dateMatchModifiers.js 24667 function dateMatchModifiers(date, matchers, dateLib = defaultDateLib) { 24668 const matchersArr = !Array.isArray(matchers) ? [matchers] : matchers; 24669 const { isSameDay: isSameDay2, differenceInCalendarDays: differenceInCalendarDays2, isAfter: isAfter2 } = dateLib; 24670 return matchersArr.some((matcher) => { 24671 if (typeof matcher === "boolean") { 24672 return matcher; 24673 } 24674 if (dateLib.isDate(matcher)) { 24675 return isSameDay2(date, matcher); 24676 } 24677 if (isDatesArray(matcher, dateLib)) { 24678 return matcher.some((matcherDate) => isSameDay2(date, matcherDate)); 24679 } 24680 if (isDateRange(matcher)) { 24681 return rangeIncludesDate(matcher, date, false, dateLib); 24682 } 24683 if (isDayOfWeekType(matcher)) { 24684 if (!Array.isArray(matcher.dayOfWeek)) { 24685 return matcher.dayOfWeek === date.getDay(); 24686 } 24687 return matcher.dayOfWeek.includes(date.getDay()); 24688 } 24689 if (isDateInterval(matcher)) { 24690 const diffBefore = differenceInCalendarDays2(matcher.before, date); 24691 const diffAfter = differenceInCalendarDays2(matcher.after, date); 24692 const isDayBefore = diffBefore > 0; 24693 const isDayAfter = diffAfter < 0; 24694 const isClosedInterval = isAfter2(matcher.before, matcher.after); 24695 if (isClosedInterval) { 24696 return isDayAfter && isDayBefore; 24697 } else { 24698 return isDayBefore || isDayAfter; 24699 } 24700 } 24701 if (isDateAfterType(matcher)) { 24702 return differenceInCalendarDays2(date, matcher.after) > 0; 24703 } 24704 if (isDateBeforeType(matcher)) { 24705 return differenceInCalendarDays2(matcher.before, date) > 0; 24706 } 24707 if (typeof matcher === "function") { 24708 return matcher(date); 24709 } 24710 return false; 24711 }); 24712 } 24713 24714 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/helpers/createGetModifiers.js 24715 function createGetModifiers(days, props, navStart, navEnd, dateLib) { 24716 const { disabled: disabled2, hidden, modifiers, showOutsideDays, broadcastCalendar, today = dateLib.today() } = props; 24717 const { isSameDay: isSameDay2, isSameMonth: isSameMonth2, startOfMonth: startOfMonth2, isBefore: isBefore2, endOfMonth: endOfMonth2, isAfter: isAfter2 } = dateLib; 24718 const computedNavStart = navStart && startOfMonth2(navStart); 24719 const computedNavEnd = navEnd && endOfMonth2(navEnd); 24720 const internalModifiersMap = { 24721 [DayFlag.focused]: [], 24722 [DayFlag.outside]: [], 24723 [DayFlag.disabled]: [], 24724 [DayFlag.hidden]: [], 24725 [DayFlag.today]: [] 24726 }; 24727 const customModifiersMap = {}; 24728 for (const day of days) { 24729 const { date, displayMonth } = day; 24730 const isOutside = Boolean(displayMonth && !isSameMonth2(date, displayMonth)); 24731 const isBeforeNavStart = Boolean(computedNavStart && isBefore2(date, computedNavStart)); 24732 const isAfterNavEnd = Boolean(computedNavEnd && isAfter2(date, computedNavEnd)); 24733 const isDisabled = Boolean(disabled2 && dateMatchModifiers(date, disabled2, dateLib)); 24734 const isHidden2 = Boolean(hidden && dateMatchModifiers(date, hidden, dateLib)) || isBeforeNavStart || isAfterNavEnd || // Broadcast calendar will show outside days as default 24735 !broadcastCalendar && !showOutsideDays && isOutside || broadcastCalendar && showOutsideDays === false && isOutside; 24736 const isToday = isSameDay2(date, today); 24737 if (isOutside) 24738 internalModifiersMap.outside.push(day); 24739 if (isDisabled) 24740 internalModifiersMap.disabled.push(day); 24741 if (isHidden2) 24742 internalModifiersMap.hidden.push(day); 24743 if (isToday) 24744 internalModifiersMap.today.push(day); 24745 if (modifiers) { 24746 Object.keys(modifiers).forEach((name) => { 24747 const modifierValue = modifiers?.[name]; 24748 const isMatch = modifierValue ? dateMatchModifiers(date, modifierValue, dateLib) : false; 24749 if (!isMatch) 24750 return; 24751 if (customModifiersMap[name]) { 24752 customModifiersMap[name].push(day); 24753 } else { 24754 customModifiersMap[name] = [day]; 24755 } 24756 }); 24757 } 24758 } 24759 return (day) => { 24760 const dayFlags = { 24761 [DayFlag.focused]: false, 24762 [DayFlag.disabled]: false, 24763 [DayFlag.hidden]: false, 24764 [DayFlag.outside]: false, 24765 [DayFlag.today]: false 24766 }; 24767 const customModifiers = {}; 24768 for (const name in internalModifiersMap) { 24769 const days2 = internalModifiersMap[name]; 24770 dayFlags[name] = days2.some((d) => d === day); 24771 } 24772 for (const name in customModifiersMap) { 24773 customModifiers[name] = customModifiersMap[name].some((d) => d === day); 24774 } 24775 return { 24776 ...dayFlags, 24777 // custom modifiers should override all the previous ones 24778 ...customModifiers 24779 }; 24780 }; 24781 } 24782 24783 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/helpers/getClassNamesForModifiers.js 24784 function getClassNamesForModifiers(modifiers, classNames, modifiersClassNames = {}) { 24785 const modifierClassNames = Object.entries(modifiers).filter(([, active]) => active === true).reduce((previousValue, [key]) => { 24786 if (modifiersClassNames[key]) { 24787 previousValue.push(modifiersClassNames[key]); 24788 } else if (classNames[DayFlag[key]]) { 24789 previousValue.push(classNames[DayFlag[key]]); 24790 } else if (classNames[SelectionState[key]]) { 24791 previousValue.push(classNames[SelectionState[key]]); 24792 } 24793 return previousValue; 24794 }, [classNames[UI.Day]]); 24795 return modifierClassNames; 24796 } 24797 24798 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/helpers/getComponents.js 24799 function getComponents(customComponents) { 24800 return { 24801 ...custom_components_exports, 24802 ...customComponents 24803 }; 24804 } 24805 24806 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/helpers/getDataAttributes.js 24807 function getDataAttributes(props) { 24808 const dataAttributes = { 24809 "data-mode": props.mode ?? void 0, 24810 "data-required": "required" in props ? props.required : void 0, 24811 "data-multiple-months": props.numberOfMonths && props.numberOfMonths > 1 || void 0, 24812 "data-week-numbers": props.showWeekNumber || void 0, 24813 "data-broadcast-calendar": props.broadcastCalendar || void 0, 24814 "data-nav-layout": props.navLayout || void 0 24815 }; 24816 Object.entries(props).forEach(([key, val]) => { 24817 if (key.startsWith("data-")) { 24818 dataAttributes[key] = val; 24819 } 24820 }); 24821 return dataAttributes; 24822 } 24823 24824 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/helpers/getDefaultClassNames.js 24825 function getDefaultClassNames() { 24826 const classNames = {}; 24827 for (const key in UI) { 24828 classNames[UI[key]] = `rdp-$UI[key]}`; 24829 } 24830 for (const key in DayFlag) { 24831 classNames[DayFlag[key]] = `rdp-$DayFlag[key]}`; 24832 } 24833 for (const key in SelectionState) { 24834 classNames[SelectionState[key]] = `rdp-$SelectionState[key]}`; 24835 } 24836 for (const key in Animation) { 24837 classNames[Animation[key]] = `rdp-$Animation[key]}`; 24838 } 24839 return classNames; 24840 } 24841 24842 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/formatters/index.js 24843 var formatters_exports = {}; 24844 __export(formatters_exports, { 24845 formatCaption: () => formatCaption, 24846 formatDay: () => formatDay, 24847 formatMonthDropdown: () => formatMonthDropdown, 24848 formatWeekNumber: () => formatWeekNumber, 24849 formatWeekNumberHeader: () => formatWeekNumberHeader, 24850 formatWeekdayName: () => formatWeekdayName, 24851 formatYearDropdown: () => formatYearDropdown 24852 }); 24853 24854 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/formatters/formatCaption.js 24855 function formatCaption(month, options, dateLib) { 24856 const lib = dateLib ?? new DateLib(options); 24857 return lib.formatMonthYear(month); 24858 } 24859 24860 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/formatters/formatDay.js 24861 function formatDay(date, options, dateLib) { 24862 return (dateLib ?? new DateLib(options)).format(date, "d"); 24863 } 24864 24865 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/formatters/formatMonthDropdown.js 24866 function formatMonthDropdown(month, dateLib = defaultDateLib) { 24867 return dateLib.format(month, "LLLL"); 24868 } 24869 24870 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/formatters/formatWeekdayName.js 24871 function formatWeekdayName(weekday, options, dateLib) { 24872 return (dateLib ?? new DateLib(options)).format(weekday, "cccccc"); 24873 } 24874 24875 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/formatters/formatWeekNumber.js 24876 function formatWeekNumber(weekNumber, dateLib = defaultDateLib) { 24877 if (weekNumber < 10) { 24878 return dateLib.formatNumber(`0$weekNumber.toLocaleString()}`); 24879 } 24880 return dateLib.formatNumber(`$weekNumber.toLocaleString()}`); 24881 } 24882 24883 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/formatters/formatWeekNumberHeader.js 24884 function formatWeekNumberHeader() { 24885 return ``; 24886 } 24887 24888 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/formatters/formatYearDropdown.js 24889 function formatYearDropdown(year, dateLib = defaultDateLib) { 24890 return dateLib.format(year, "yyyy"); 24891 } 24892 24893 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/helpers/getFormatters.js 24894 function getFormatters(customFormatters) { 24895 return { 24896 ...formatters_exports, 24897 ...customFormatters 24898 }; 24899 } 24900 24901 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/labels/index.js 24902 var labels_exports = {}; 24903 __export(labels_exports, { 24904 labelDayButton: () => labelDayButton, 24905 labelGrid: () => labelGrid, 24906 labelGridcell: () => labelGridcell, 24907 labelMonthDropdown: () => labelMonthDropdown, 24908 labelNav: () => labelNav, 24909 labelNext: () => labelNext, 24910 labelPrevious: () => labelPrevious, 24911 labelWeekNumber: () => labelWeekNumber, 24912 labelWeekNumberHeader: () => labelWeekNumberHeader, 24913 labelWeekday: () => labelWeekday, 24914 labelYearDropdown: () => labelYearDropdown 24915 }); 24916 24917 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/labels/labelDayButton.js 24918 function labelDayButton(date, modifiers, options, dateLib) { 24919 let label = (dateLib ?? new DateLib(options)).format(date, "PPPP"); 24920 if (modifiers.today) 24921 label = `Today, $label}`; 24922 if (modifiers.selected) 24923 label = `$label}, selected`; 24924 return label; 24925 } 24926 24927 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/labels/labelGrid.js 24928 function labelGrid(date, options, dateLib) { 24929 const lib = dateLib ?? new DateLib(options); 24930 return lib.formatMonthYear(date); 24931 } 24932 24933 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/labels/labelGridcell.js 24934 function labelGridcell(date, modifiers, options, dateLib) { 24935 let label = (dateLib ?? new DateLib(options)).format(date, "PPPP"); 24936 if (modifiers?.today) { 24937 label = `Today, $label}`; 24938 } 24939 return label; 24940 } 24941 24942 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/labels/labelMonthDropdown.js 24943 function labelMonthDropdown(_options) { 24944 return "Choose the Month"; 24945 } 24946 24947 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/labels/labelNav.js 24948 function labelNav() { 24949 return ""; 24950 } 24951 24952 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/labels/labelNext.js 24953 var defaultLabel = "Go to the Next Month"; 24954 function labelNext(_month, _options) { 24955 return defaultLabel; 24956 } 24957 24958 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/labels/labelPrevious.js 24959 function labelPrevious(_month) { 24960 return "Go to the Previous Month"; 24961 } 24962 24963 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/labels/labelWeekday.js 24964 function labelWeekday(date, options, dateLib) { 24965 return (dateLib ?? new DateLib(options)).format(date, "cccc"); 24966 } 24967 24968 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/labels/labelWeekNumber.js 24969 function labelWeekNumber(weekNumber, _options) { 24970 return `Week $weekNumber}`; 24971 } 24972 24973 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/labels/labelWeekNumberHeader.js 24974 function labelWeekNumberHeader(_options) { 24975 return "Week Number"; 24976 } 24977 24978 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/labels/labelYearDropdown.js 24979 function labelYearDropdown(_options) { 24980 return "Choose the Year"; 24981 } 24982 24983 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/helpers/getLabels.js 24984 var resolveLabel = (defaultLabel2, customLabel, localeLabel) => { 24985 if (customLabel) 24986 return customLabel; 24987 if (localeLabel) { 24988 return typeof localeLabel === "function" ? localeLabel : (..._args) => localeLabel; 24989 } 24990 return defaultLabel2; 24991 }; 24992 function getLabels(customLabels, options) { 24993 const localeLabels = options.locale?.labels ?? {}; 24994 return { 24995 ...labels_exports, 24996 ...customLabels ?? {}, 24997 labelDayButton: resolveLabel(labelDayButton, customLabels?.labelDayButton, localeLabels.labelDayButton), 24998 labelMonthDropdown: resolveLabel(labelMonthDropdown, customLabels?.labelMonthDropdown, localeLabels.labelMonthDropdown), 24999 labelNext: resolveLabel(labelNext, customLabels?.labelNext, localeLabels.labelNext), 25000 labelPrevious: resolveLabel(labelPrevious, customLabels?.labelPrevious, localeLabels.labelPrevious), 25001 labelWeekNumber: resolveLabel(labelWeekNumber, customLabels?.labelWeekNumber, localeLabels.labelWeekNumber), 25002 labelYearDropdown: resolveLabel(labelYearDropdown, customLabels?.labelYearDropdown, localeLabels.labelYearDropdown), 25003 labelGrid: resolveLabel(labelGrid, customLabels?.labelGrid, localeLabels.labelGrid), 25004 labelGridcell: resolveLabel(labelGridcell, customLabels?.labelGridcell, localeLabels.labelGridcell), 25005 labelNav: resolveLabel(labelNav, customLabels?.labelNav, localeLabels.labelNav), 25006 labelWeekNumberHeader: resolveLabel(labelWeekNumberHeader, customLabels?.labelWeekNumberHeader, localeLabels.labelWeekNumberHeader), 25007 labelWeekday: resolveLabel(labelWeekday, customLabels?.labelWeekday, localeLabels.labelWeekday) 25008 }; 25009 } 25010 25011 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/helpers/getMonthOptions.js 25012 function getMonthOptions(displayMonth, navStart, navEnd, formatters2, dateLib) { 25013 const { startOfMonth: startOfMonth2, startOfYear: startOfYear2, endOfYear: endOfYear2, eachMonthOfInterval: eachMonthOfInterval2, getMonth: getMonth2 } = dateLib; 25014 const months = eachMonthOfInterval2({ 25015 start: startOfYear2(displayMonth), 25016 end: endOfYear2(displayMonth) 25017 }); 25018 const options = months.map((month) => { 25019 const label = formatters2.formatMonthDropdown(month, dateLib); 25020 const value = getMonth2(month); 25021 const disabled2 = navStart && month < startOfMonth2(navStart) || navEnd && month > startOfMonth2(navEnd) || false; 25022 return { value, label, disabled: disabled2 }; 25023 }); 25024 return options; 25025 } 25026 25027 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/helpers/getStyleForModifiers.js 25028 function getStyleForModifiers(dayModifiers, styles = {}, modifiersStyles = {}) { 25029 let style = { ...styles?.[UI.Day] }; 25030 Object.entries(dayModifiers).filter(([, active]) => active === true).forEach(([modifier]) => { 25031 style = { 25032 ...style, 25033 ...modifiersStyles?.[modifier] 25034 }; 25035 }); 25036 return style; 25037 } 25038 25039 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/helpers/getWeekdays.js 25040 function getWeekdays(dateLib, ISOWeek, broadcastCalendar, today) { 25041 const referenceToday = today ?? dateLib.today(); 25042 const start = broadcastCalendar ? dateLib.startOfBroadcastWeek(referenceToday, dateLib) : ISOWeek ? dateLib.startOfISOWeek(referenceToday) : dateLib.startOfWeek(referenceToday); 25043 const days = []; 25044 for (let i = 0; i < 7; i++) { 25045 const day = dateLib.addDays(start, i); 25046 days.push(day); 25047 } 25048 return days; 25049 } 25050 25051 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/helpers/getYearOptions.js 25052 function getYearOptions(navStart, navEnd, formatters2, dateLib, reverse = false) { 25053 if (!navStart) 25054 return void 0; 25055 if (!navEnd) 25056 return void 0; 25057 const { startOfYear: startOfYear2, endOfYear: endOfYear2, eachYearOfInterval: eachYearOfInterval2, getYear: getYear2 } = dateLib; 25058 const firstNavYear = startOfYear2(navStart); 25059 const lastNavYear = endOfYear2(navEnd); 25060 const years = eachYearOfInterval2({ start: firstNavYear, end: lastNavYear }); 25061 if (reverse) 25062 years.reverse(); 25063 return years.map((year) => { 25064 const label = formatters2.formatYearDropdown(year, dateLib); 25065 return { 25066 value: getYear2(year), 25067 label, 25068 disabled: false 25069 }; 25070 }); 25071 } 25072 25073 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/noonDateLib.js 25074 function createNoonOverrides(timeZone, options = {}) { 25075 const { weekStartsOn, locale } = options; 25076 const fallbackWeekStartsOn = weekStartsOn ?? locale?.options?.weekStartsOn ?? 0; 25077 const toNoonTZDate = (date) => { 25078 const normalizedDate = typeof date === "number" || typeof date === "string" ? new Date(date) : date; 25079 return new TZDate(normalizedDate.getFullYear(), normalizedDate.getMonth(), normalizedDate.getDate(), 12, 0, 0, timeZone); 25080 }; 25081 const toCalendarDate2 = (date) => { 25082 const zoned = toNoonTZDate(date); 25083 return new Date(zoned.getFullYear(), zoned.getMonth(), zoned.getDate(), 0, 0, 0, 0); 25084 }; 25085 return { 25086 today: () => { 25087 return toNoonTZDate(TZDate.tz(timeZone)); 25088 }, 25089 newDate: (year, monthIndex, date) => { 25090 return new TZDate(year, monthIndex, date, 12, 0, 0, timeZone); 25091 }, 25092 startOfDay: (date) => { 25093 return toNoonTZDate(date); 25094 }, 25095 startOfWeek: (date, options2) => { 25096 const base = toNoonTZDate(date); 25097 const weekStartsOnValue = options2?.weekStartsOn ?? fallbackWeekStartsOn; 25098 const diff = (base.getDay() - weekStartsOnValue + 7) % 7; 25099 base.setDate(base.getDate() - diff); 25100 return base; 25101 }, 25102 startOfISOWeek: (date) => { 25103 const base = toNoonTZDate(date); 25104 const diff = (base.getDay() - 1 + 7) % 7; 25105 base.setDate(base.getDate() - diff); 25106 return base; 25107 }, 25108 startOfMonth: (date) => { 25109 const base = toNoonTZDate(date); 25110 base.setDate(1); 25111 return base; 25112 }, 25113 startOfYear: (date) => { 25114 const base = toNoonTZDate(date); 25115 base.setMonth(0, 1); 25116 return base; 25117 }, 25118 endOfWeek: (date, options2) => { 25119 const base = toNoonTZDate(date); 25120 const weekStartsOnValue = options2?.weekStartsOn ?? fallbackWeekStartsOn; 25121 const endDow = (weekStartsOnValue + 6) % 7; 25122 const diff = (endDow - base.getDay() + 7) % 7; 25123 base.setDate(base.getDate() + diff); 25124 return base; 25125 }, 25126 endOfISOWeek: (date) => { 25127 const base = toNoonTZDate(date); 25128 const diff = (7 - base.getDay()) % 7; 25129 base.setDate(base.getDate() + diff); 25130 return base; 25131 }, 25132 endOfMonth: (date) => { 25133 const base = toNoonTZDate(date); 25134 base.setMonth(base.getMonth() + 1, 0); 25135 return base; 25136 }, 25137 endOfYear: (date) => { 25138 const base = toNoonTZDate(date); 25139 base.setMonth(11, 31); 25140 return base; 25141 }, 25142 eachMonthOfInterval: (interval) => { 25143 const start = toNoonTZDate(interval.start); 25144 const end = toNoonTZDate(interval.end); 25145 const result = []; 25146 const cursor = new TZDate(start.getFullYear(), start.getMonth(), 1, 12, 0, 0, timeZone); 25147 const endKey = end.getFullYear() * 12 + end.getMonth(); 25148 while (cursor.getFullYear() * 12 + cursor.getMonth() <= endKey) { 25149 result.push(new TZDate(cursor, timeZone)); 25150 cursor.setMonth(cursor.getMonth() + 1, 1); 25151 } 25152 return result; 25153 }, 25154 // Normalize to noon once before arithmetic (avoid DST/midnight edge cases), 25155 // mutate the same TZDate, and return it. 25156 addDays: (date, amount) => { 25157 const base = toNoonTZDate(date); 25158 base.setDate(base.getDate() + amount); 25159 return base; 25160 }, 25161 addWeeks: (date, amount) => { 25162 const base = toNoonTZDate(date); 25163 base.setDate(base.getDate() + amount * 7); 25164 return base; 25165 }, 25166 addMonths: (date, amount) => { 25167 const base = toNoonTZDate(date); 25168 base.setMonth(base.getMonth() + amount); 25169 return base; 25170 }, 25171 addYears: (date, amount) => { 25172 const base = toNoonTZDate(date); 25173 base.setFullYear(base.getFullYear() + amount); 25174 return base; 25175 }, 25176 eachYearOfInterval: (interval) => { 25177 const start = toNoonTZDate(interval.start); 25178 const end = toNoonTZDate(interval.end); 25179 const years = []; 25180 const cursor = new TZDate(start.getFullYear(), 0, 1, 12, 0, 0, timeZone); 25181 while (cursor.getFullYear() <= end.getFullYear()) { 25182 years.push(new TZDate(cursor, timeZone)); 25183 cursor.setFullYear(cursor.getFullYear() + 1, 0, 1); 25184 } 25185 return years; 25186 }, 25187 getWeek: (date, options2) => { 25188 const base = toCalendarDate2(date); 25189 return getWeek(base, { 25190 weekStartsOn: options2?.weekStartsOn ?? fallbackWeekStartsOn, 25191 firstWeekContainsDate: options2?.firstWeekContainsDate ?? locale?.options?.firstWeekContainsDate ?? 1 25192 }); 25193 }, 25194 getISOWeek: (date) => { 25195 const base = toCalendarDate2(date); 25196 return getISOWeek(base); 25197 }, 25198 differenceInCalendarDays: (dateLeft, dateRight) => { 25199 const left = toCalendarDate2(dateLeft); 25200 const right = toCalendarDate2(dateRight); 25201 return differenceInCalendarDays(left, right); 25202 }, 25203 differenceInCalendarMonths: (dateLeft, dateRight) => { 25204 const left = toCalendarDate2(dateLeft); 25205 const right = toCalendarDate2(dateRight); 25206 return differenceInCalendarMonths(left, right); 25207 } 25208 }; 25209 } 25210 25211 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/useAnimation.js 25212 var import_react32 = __toESM(require_react(), 1); 25213 var asHtmlElement = (element) => { 25214 if (element instanceof HTMLElement) 25215 return element; 25216 return null; 25217 }; 25218 var queryMonthEls = (element) => [ 25219 ...element.querySelectorAll("[data-animated-month]") ?? [] 25220 ]; 25221 var queryMonthEl = (element) => asHtmlElement(element.querySelector("[data-animated-month]")); 25222 var queryCaptionEl = (element) => asHtmlElement(element.querySelector("[data-animated-caption]")); 25223 var queryWeeksEl = (element) => asHtmlElement(element.querySelector("[data-animated-weeks]")); 25224 var queryNavEl = (element) => asHtmlElement(element.querySelector("[data-animated-nav]")); 25225 var queryWeekdaysEl = (element) => asHtmlElement(element.querySelector("[data-animated-weekdays]")); 25226 function useAnimation(rootElRef, enabled, { classNames, months, focused, dateLib }) { 25227 const previousRootElSnapshotRef = (0, import_react32.useRef)(null); 25228 const previousMonthsRef = (0, import_react32.useRef)(months); 25229 const animatingRef = (0, import_react32.useRef)(false); 25230 (0, import_react32.useLayoutEffect)(() => { 25231 const previousMonths = previousMonthsRef.current; 25232 previousMonthsRef.current = months; 25233 if (!enabled || !rootElRef.current || // safety check because the ref can be set to anything by consumers 25234 !(rootElRef.current instanceof HTMLElement) || // validation required for the animation to work as expected 25235 months.length === 0 || previousMonths.length === 0 || months.length !== previousMonths.length) { 25236 return; 25237 } 25238 const isSameMonth2 = dateLib.isSameMonth(months[0].date, previousMonths[0].date); 25239 const isAfterPreviousMonth = dateLib.isAfter(months[0].date, previousMonths[0].date); 25240 const captionAnimationClass = isAfterPreviousMonth ? classNames[Animation.caption_after_enter] : classNames[Animation.caption_before_enter]; 25241 const weeksAnimationClass = isAfterPreviousMonth ? classNames[Animation.weeks_after_enter] : classNames[Animation.weeks_before_enter]; 25242 const previousRootElSnapshot = previousRootElSnapshotRef.current; 25243 const rootElSnapshot = rootElRef.current.cloneNode(true); 25244 if (rootElSnapshot instanceof HTMLElement) { 25245 const currentMonthElsSnapshot = queryMonthEls(rootElSnapshot); 25246 currentMonthElsSnapshot.forEach((currentMonthElSnapshot) => { 25247 if (!(currentMonthElSnapshot instanceof HTMLElement)) 25248 return; 25249 const previousMonthElSnapshot = queryMonthEl(currentMonthElSnapshot); 25250 if (previousMonthElSnapshot && currentMonthElSnapshot.contains(previousMonthElSnapshot)) { 25251 currentMonthElSnapshot.removeChild(previousMonthElSnapshot); 25252 } 25253 const captionEl = queryCaptionEl(currentMonthElSnapshot); 25254 if (captionEl) { 25255 captionEl.classList.remove(captionAnimationClass); 25256 } 25257 const weeksEl = queryWeeksEl(currentMonthElSnapshot); 25258 if (weeksEl) { 25259 weeksEl.classList.remove(weeksAnimationClass); 25260 } 25261 }); 25262 previousRootElSnapshotRef.current = rootElSnapshot; 25263 } else { 25264 previousRootElSnapshotRef.current = null; 25265 } 25266 if (animatingRef.current || isSameMonth2 || // skip animation if a day is focused because it can cause issues to the animation and is better for a11y 25267 focused) { 25268 return; 25269 } 25270 const previousMonthEls = previousRootElSnapshot instanceof HTMLElement ? queryMonthEls(previousRootElSnapshot) : []; 25271 const currentMonthEls = queryMonthEls(rootElRef.current); 25272 if (currentMonthEls?.every((el) => el instanceof HTMLElement) && previousMonthEls?.every((el) => el instanceof HTMLElement)) { 25273 animatingRef.current = true; 25274 const cleanUpFunctions = []; 25275 rootElRef.current.style.isolation = "isolate"; 25276 const navEl = queryNavEl(rootElRef.current); 25277 if (navEl) { 25278 navEl.style.zIndex = "1"; 25279 } 25280 currentMonthEls.forEach((currentMonthEl, index2) => { 25281 const previousMonthEl = previousMonthEls[index2]; 25282 if (!previousMonthEl) { 25283 return; 25284 } 25285 currentMonthEl.style.position = "relative"; 25286 currentMonthEl.style.overflow = "hidden"; 25287 const captionEl = queryCaptionEl(currentMonthEl); 25288 if (captionEl) { 25289 captionEl.classList.add(captionAnimationClass); 25290 } 25291 const weeksEl = queryWeeksEl(currentMonthEl); 25292 if (weeksEl) { 25293 weeksEl.classList.add(weeksAnimationClass); 25294 } 25295 const cleanUp = () => { 25296 animatingRef.current = false; 25297 if (rootElRef.current) { 25298 rootElRef.current.style.isolation = ""; 25299 } 25300 if (navEl) { 25301 navEl.style.zIndex = ""; 25302 } 25303 if (captionEl) { 25304 captionEl.classList.remove(captionAnimationClass); 25305 } 25306 if (weeksEl) { 25307 weeksEl.classList.remove(weeksAnimationClass); 25308 } 25309 currentMonthEl.style.position = ""; 25310 currentMonthEl.style.overflow = ""; 25311 if (currentMonthEl.contains(previousMonthEl)) { 25312 currentMonthEl.removeChild(previousMonthEl); 25313 } 25314 }; 25315 cleanUpFunctions.push(cleanUp); 25316 previousMonthEl.style.pointerEvents = "none"; 25317 previousMonthEl.style.position = "absolute"; 25318 previousMonthEl.style.overflow = "hidden"; 25319 previousMonthEl.setAttribute("aria-hidden", "true"); 25320 const previousWeekdaysEl = queryWeekdaysEl(previousMonthEl); 25321 if (previousWeekdaysEl) { 25322 previousWeekdaysEl.style.opacity = "0"; 25323 } 25324 const previousCaptionEl = queryCaptionEl(previousMonthEl); 25325 if (previousCaptionEl) { 25326 previousCaptionEl.classList.add(isAfterPreviousMonth ? classNames[Animation.caption_before_exit] : classNames[Animation.caption_after_exit]); 25327 previousCaptionEl.addEventListener("animationend", cleanUp); 25328 } 25329 const previousWeeksEl = queryWeeksEl(previousMonthEl); 25330 if (previousWeeksEl) { 25331 previousWeeksEl.classList.add(isAfterPreviousMonth ? classNames[Animation.weeks_before_exit] : classNames[Animation.weeks_after_exit]); 25332 } 25333 currentMonthEl.insertBefore(previousMonthEl, currentMonthEl.firstChild); 25334 }); 25335 } 25336 }); 25337 } 25338 25339 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/useCalendar.js 25340 var import_react34 = __toESM(require_react(), 1); 25341 25342 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/helpers/getDates.js 25343 function getDates(displayMonths, maxDate, props, dateLib) { 25344 const firstMonth = displayMonths[0]; 25345 const lastMonth = displayMonths[displayMonths.length - 1]; 25346 const { ISOWeek, fixedWeeks, broadcastCalendar } = props ?? {}; 25347 const { addDays: addDays2, differenceInCalendarDays: differenceInCalendarDays2, differenceInCalendarMonths: differenceInCalendarMonths2, endOfBroadcastWeek: endOfBroadcastWeek2, endOfISOWeek: endOfISOWeek2, endOfMonth: endOfMonth2, endOfWeek: endOfWeek2, isAfter: isAfter2, startOfBroadcastWeek: startOfBroadcastWeek2, startOfISOWeek: startOfISOWeek2, startOfWeek: startOfWeek2 } = dateLib; 25348 const startWeekFirstDate = broadcastCalendar ? startOfBroadcastWeek2(firstMonth, dateLib) : ISOWeek ? startOfISOWeek2(firstMonth) : startOfWeek2(firstMonth); 25349 const displayMonthsWeekEnd = broadcastCalendar ? endOfBroadcastWeek2(lastMonth) : ISOWeek ? endOfISOWeek2(endOfMonth2(lastMonth)) : endOfWeek2(endOfMonth2(lastMonth)); 25350 const constraintWeekEnd = maxDate && (broadcastCalendar ? endOfBroadcastWeek2(maxDate) : ISOWeek ? endOfISOWeek2(maxDate) : endOfWeek2(maxDate)); 25351 const gridEndDate = constraintWeekEnd && isAfter2(displayMonthsWeekEnd, constraintWeekEnd) ? constraintWeekEnd : displayMonthsWeekEnd; 25352 const nOfDays = differenceInCalendarDays2(gridEndDate, startWeekFirstDate); 25353 const nOfMonths = differenceInCalendarMonths2(lastMonth, firstMonth) + 1; 25354 const dates = []; 25355 for (let i = 0; i <= nOfDays; i++) { 25356 const date = addDays2(startWeekFirstDate, i); 25357 dates.push(date); 25358 } 25359 const nrOfDaysWithFixedWeeks = broadcastCalendar ? 35 : 42; 25360 const extraDates = nrOfDaysWithFixedWeeks * nOfMonths; 25361 if (fixedWeeks && dates.length < extraDates) { 25362 const daysToAdd = extraDates - dates.length; 25363 for (let i = 0; i < daysToAdd; i++) { 25364 const date = addDays2(dates[dates.length - 1], 1); 25365 dates.push(date); 25366 } 25367 } 25368 return dates; 25369 } 25370 25371 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/helpers/getDays.js 25372 function getDays(calendarMonths) { 25373 const initialDays = []; 25374 return calendarMonths.reduce((days, month) => { 25375 const weekDays = month.weeks.reduce((weekDays2, week) => { 25376 return weekDays2.concat(week.days.slice()); 25377 }, initialDays.slice()); 25378 return days.concat(weekDays.slice()); 25379 }, initialDays.slice()); 25380 } 25381 25382 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/helpers/getDisplayMonths.js 25383 function getDisplayMonths(firstDisplayedMonth, calendarEndMonth, props, dateLib) { 25384 const { numberOfMonths = 1 } = props; 25385 const months = []; 25386 for (let i = 0; i < numberOfMonths; i++) { 25387 const month = dateLib.addMonths(firstDisplayedMonth, i); 25388 if (calendarEndMonth && month > calendarEndMonth) { 25389 break; 25390 } 25391 months.push(month); 25392 } 25393 return months; 25394 } 25395 25396 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/helpers/getInitialMonth.js 25397 function getInitialMonth(props, navStart, navEnd, dateLib) { 25398 const { month, defaultMonth, today = dateLib.today(), numberOfMonths = 1 } = props; 25399 let initialMonth = month || defaultMonth || today; 25400 const { differenceInCalendarMonths: differenceInCalendarMonths2, addMonths: addMonths2, startOfMonth: startOfMonth2 } = dateLib; 25401 if (navEnd && differenceInCalendarMonths2(navEnd, initialMonth) < numberOfMonths - 1) { 25402 const offset4 = -1 * (numberOfMonths - 1); 25403 initialMonth = addMonths2(navEnd, offset4); 25404 } 25405 if (navStart && differenceInCalendarMonths2(initialMonth, navStart) < 0) { 25406 initialMonth = navStart; 25407 } 25408 return startOfMonth2(initialMonth); 25409 } 25410 25411 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/helpers/getMonths.js 25412 function getMonths(displayMonths, dates, props, dateLib) { 25413 const { addDays: addDays2, endOfBroadcastWeek: endOfBroadcastWeek2, endOfISOWeek: endOfISOWeek2, endOfMonth: endOfMonth2, endOfWeek: endOfWeek2, getISOWeek: getISOWeek2, getWeek: getWeek2, startOfBroadcastWeek: startOfBroadcastWeek2, startOfISOWeek: startOfISOWeek2, startOfWeek: startOfWeek2 } = dateLib; 25414 const dayPickerMonths = displayMonths.reduce((months, month) => { 25415 const firstDateOfFirstWeek = props.broadcastCalendar ? startOfBroadcastWeek2(month, dateLib) : props.ISOWeek ? startOfISOWeek2(month) : startOfWeek2(month); 25416 const lastDateOfLastWeek = props.broadcastCalendar ? endOfBroadcastWeek2(month) : props.ISOWeek ? endOfISOWeek2(endOfMonth2(month)) : endOfWeek2(endOfMonth2(month)); 25417 const monthDates = dates.filter((date) => { 25418 return date >= firstDateOfFirstWeek && date <= lastDateOfLastWeek; 25419 }); 25420 const nrOfDaysWithFixedWeeks = props.broadcastCalendar ? 35 : 42; 25421 if (props.fixedWeeks && monthDates.length < nrOfDaysWithFixedWeeks) { 25422 const extraDates = dates.filter((date) => { 25423 const daysToAdd = nrOfDaysWithFixedWeeks - monthDates.length; 25424 return date > lastDateOfLastWeek && date <= addDays2(lastDateOfLastWeek, daysToAdd); 25425 }); 25426 monthDates.push(...extraDates); 25427 } 25428 const weeks = monthDates.reduce((weeks2, date) => { 25429 const weekNumber = props.ISOWeek ? getISOWeek2(date) : getWeek2(date); 25430 const week = weeks2.find((week2) => week2.weekNumber === weekNumber); 25431 const day = new CalendarDay(date, month, dateLib); 25432 if (!week) { 25433 weeks2.push(new CalendarWeek(weekNumber, [day])); 25434 } else { 25435 week.days.push(day); 25436 } 25437 return weeks2; 25438 }, []); 25439 const dayPickerMonth = new CalendarMonth(month, weeks); 25440 months.push(dayPickerMonth); 25441 return months; 25442 }, []); 25443 if (!props.reverseMonths) { 25444 return dayPickerMonths; 25445 } else { 25446 return dayPickerMonths.reverse(); 25447 } 25448 } 25449 25450 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/helpers/getNavMonth.js 25451 function getNavMonths(props, dateLib) { 25452 let { startMonth, endMonth } = props; 25453 const { startOfYear: startOfYear2, startOfDay: startOfDay2, startOfMonth: startOfMonth2, endOfMonth: endOfMonth2, addYears: addYears2, endOfYear: endOfYear2, today } = dateLib; 25454 const hasYearDropdown = props.captionLayout === "dropdown" || props.captionLayout === "dropdown-years"; 25455 if (startMonth) { 25456 startMonth = startOfMonth2(startMonth); 25457 } else if (!startMonth && hasYearDropdown) { 25458 startMonth = startOfYear2(addYears2(props.today ?? today(), -100)); 25459 } 25460 if (endMonth) { 25461 endMonth = endOfMonth2(endMonth); 25462 } else if (!endMonth && hasYearDropdown) { 25463 endMonth = endOfYear2(props.today ?? today()); 25464 } 25465 return [ 25466 startMonth ? startOfDay2(startMonth) : startMonth, 25467 endMonth ? startOfDay2(endMonth) : endMonth 25468 ]; 25469 } 25470 25471 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/helpers/getNextMonth.js 25472 function getNextMonth(firstDisplayedMonth, calendarEndMonth, options, dateLib) { 25473 if (options.disableNavigation) { 25474 return void 0; 25475 } 25476 const { pagedNavigation, numberOfMonths = 1 } = options; 25477 const { startOfMonth: startOfMonth2, addMonths: addMonths2, differenceInCalendarMonths: differenceInCalendarMonths2 } = dateLib; 25478 const offset4 = pagedNavigation ? numberOfMonths : 1; 25479 const month = startOfMonth2(firstDisplayedMonth); 25480 if (!calendarEndMonth) { 25481 return addMonths2(month, offset4); 25482 } 25483 const monthsDiff = differenceInCalendarMonths2(calendarEndMonth, firstDisplayedMonth); 25484 if (monthsDiff < numberOfMonths) { 25485 return void 0; 25486 } 25487 return addMonths2(month, offset4); 25488 } 25489 25490 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/helpers/getPreviousMonth.js 25491 function getPreviousMonth(firstDisplayedMonth, calendarStartMonth, options, dateLib) { 25492 if (options.disableNavigation) { 25493 return void 0; 25494 } 25495 const { pagedNavigation, numberOfMonths } = options; 25496 const { startOfMonth: startOfMonth2, addMonths: addMonths2, differenceInCalendarMonths: differenceInCalendarMonths2 } = dateLib; 25497 const offset4 = pagedNavigation ? numberOfMonths ?? 1 : 1; 25498 const month = startOfMonth2(firstDisplayedMonth); 25499 if (!calendarStartMonth) { 25500 return addMonths2(month, -offset4); 25501 } 25502 const monthsDiff = differenceInCalendarMonths2(month, calendarStartMonth); 25503 if (monthsDiff <= 0) { 25504 return void 0; 25505 } 25506 return addMonths2(month, -offset4); 25507 } 25508 25509 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/helpers/getWeeks.js 25510 function getWeeks(months) { 25511 const initialWeeks = []; 25512 return months.reduce((weeks, month) => { 25513 return weeks.concat(month.weeks.slice()); 25514 }, initialWeeks.slice()); 25515 } 25516 25517 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/helpers/useControlledValue.js 25518 var import_react33 = __toESM(require_react(), 1); 25519 function useControlledValue(defaultValue2, controlledValue) { 25520 const [uncontrolledValue, setValue] = (0, import_react33.useState)(defaultValue2); 25521 const value = controlledValue === void 0 ? uncontrolledValue : controlledValue; 25522 return [value, setValue]; 25523 } 25524 25525 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/useCalendar.js 25526 function useCalendar(props, dateLib) { 25527 const [navStart, navEnd] = getNavMonths(props, dateLib); 25528 const { startOfMonth: startOfMonth2, endOfMonth: endOfMonth2 } = dateLib; 25529 const initialMonth = getInitialMonth(props, navStart, navEnd, dateLib); 25530 const [firstMonth, setFirstMonth] = useControlledValue( 25531 initialMonth, 25532 // initialMonth is always computed from props.month if provided 25533 props.month ? initialMonth : void 0 25534 ); 25535 (0, import_react34.useEffect)(() => { 25536 const newInitialMonth = getInitialMonth(props, navStart, navEnd, dateLib); 25537 setFirstMonth(newInitialMonth); 25538 }, [props.timeZone]); 25539 const { months, weeks, days, previousMonth, nextMonth } = (0, import_react34.useMemo)(() => { 25540 const displayMonths = getDisplayMonths(firstMonth, navEnd, { numberOfMonths: props.numberOfMonths }, dateLib); 25541 const dates = getDates(displayMonths, props.endMonth ? endOfMonth2(props.endMonth) : void 0, { 25542 ISOWeek: props.ISOWeek, 25543 fixedWeeks: props.fixedWeeks, 25544 broadcastCalendar: props.broadcastCalendar 25545 }, dateLib); 25546 const months2 = getMonths(displayMonths, dates, { 25547 broadcastCalendar: props.broadcastCalendar, 25548 fixedWeeks: props.fixedWeeks, 25549 ISOWeek: props.ISOWeek, 25550 reverseMonths: props.reverseMonths 25551 }, dateLib); 25552 const weeks2 = getWeeks(months2); 25553 const days2 = getDays(months2); 25554 const previousMonth2 = getPreviousMonth(firstMonth, navStart, props, dateLib); 25555 const nextMonth2 = getNextMonth(firstMonth, navEnd, props, dateLib); 25556 return { 25557 months: months2, 25558 weeks: weeks2, 25559 days: days2, 25560 previousMonth: previousMonth2, 25561 nextMonth: nextMonth2 25562 }; 25563 }, [ 25564 dateLib, 25565 firstMonth.getTime(), 25566 navEnd?.getTime(), 25567 navStart?.getTime(), 25568 props.disableNavigation, 25569 props.broadcastCalendar, 25570 props.endMonth?.getTime(), 25571 props.fixedWeeks, 25572 props.ISOWeek, 25573 props.numberOfMonths, 25574 props.pagedNavigation, 25575 props.reverseMonths 25576 ]); 25577 const { disableNavigation, onMonthChange } = props; 25578 const isDayInCalendar = (day) => weeks.some((week) => week.days.some((d) => d.isEqualTo(day))); 25579 const goToMonth = (date) => { 25580 if (disableNavigation) { 25581 return; 25582 } 25583 let newMonth = startOfMonth2(date); 25584 if (navStart && newMonth < startOfMonth2(navStart)) { 25585 newMonth = startOfMonth2(navStart); 25586 } 25587 if (navEnd && newMonth > startOfMonth2(navEnd)) { 25588 newMonth = startOfMonth2(navEnd); 25589 } 25590 setFirstMonth(newMonth); 25591 onMonthChange?.(newMonth); 25592 }; 25593 const goToDay = (day) => { 25594 if (isDayInCalendar(day)) { 25595 return; 25596 } 25597 goToMonth(day.date); 25598 }; 25599 const calendar = { 25600 months, 25601 weeks, 25602 days, 25603 navStart, 25604 navEnd, 25605 previousMonth, 25606 nextMonth, 25607 goToMonth, 25608 goToDay 25609 }; 25610 return calendar; 25611 } 25612 25613 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/useFocus.js 25614 var import_react35 = __toESM(require_react(), 1); 25615 25616 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/helpers/calculateFocusTarget.js 25617 var FocusTargetPriority; 25618 (function(FocusTargetPriority2) { 25619 FocusTargetPriority2[FocusTargetPriority2["Today"] = 0] = "Today"; 25620 FocusTargetPriority2[FocusTargetPriority2["Selected"] = 1] = "Selected"; 25621 FocusTargetPriority2[FocusTargetPriority2["LastFocused"] = 2] = "LastFocused"; 25622 FocusTargetPriority2[FocusTargetPriority2["FocusedModifier"] = 3] = "FocusedModifier"; 25623 })(FocusTargetPriority || (FocusTargetPriority = {})); 25624 function isFocusableDay(modifiers) { 25625 return !modifiers[DayFlag.disabled] && !modifiers[DayFlag.hidden] && !modifiers[DayFlag.outside]; 25626 } 25627 function calculateFocusTarget(days, getModifiers, isSelected2, lastFocused) { 25628 let focusTarget; 25629 let foundFocusTargetPriority = -1; 25630 for (const day of days) { 25631 const modifiers = getModifiers(day); 25632 if (isFocusableDay(modifiers)) { 25633 if (modifiers[DayFlag.focused] && foundFocusTargetPriority < FocusTargetPriority.FocusedModifier) { 25634 focusTarget = day; 25635 foundFocusTargetPriority = FocusTargetPriority.FocusedModifier; 25636 } else if (lastFocused?.isEqualTo(day) && foundFocusTargetPriority < FocusTargetPriority.LastFocused) { 25637 focusTarget = day; 25638 foundFocusTargetPriority = FocusTargetPriority.LastFocused; 25639 } else if (isSelected2(day.date) && foundFocusTargetPriority < FocusTargetPriority.Selected) { 25640 focusTarget = day; 25641 foundFocusTargetPriority = FocusTargetPriority.Selected; 25642 } else if (modifiers[DayFlag.today] && foundFocusTargetPriority < FocusTargetPriority.Today) { 25643 focusTarget = day; 25644 foundFocusTargetPriority = FocusTargetPriority.Today; 25645 } 25646 } 25647 } 25648 if (!focusTarget) { 25649 focusTarget = days.find((day) => isFocusableDay(getModifiers(day))); 25650 } 25651 return focusTarget; 25652 } 25653 25654 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/helpers/getFocusableDate.js 25655 function getFocusableDate(moveBy, moveDir, refDate, navStart, navEnd, props, dateLib) { 25656 const { ISOWeek, broadcastCalendar } = props; 25657 const { addDays: addDays2, addMonths: addMonths2, addWeeks: addWeeks2, addYears: addYears2, endOfBroadcastWeek: endOfBroadcastWeek2, endOfISOWeek: endOfISOWeek2, endOfWeek: endOfWeek2, max: max3, min: min3, startOfBroadcastWeek: startOfBroadcastWeek2, startOfISOWeek: startOfISOWeek2, startOfWeek: startOfWeek2 } = dateLib; 25658 const moveFns = { 25659 day: addDays2, 25660 week: addWeeks2, 25661 month: addMonths2, 25662 year: addYears2, 25663 startOfWeek: (date) => broadcastCalendar ? startOfBroadcastWeek2(date, dateLib) : ISOWeek ? startOfISOWeek2(date) : startOfWeek2(date), 25664 endOfWeek: (date) => broadcastCalendar ? endOfBroadcastWeek2(date) : ISOWeek ? endOfISOWeek2(date) : endOfWeek2(date) 25665 }; 25666 let focusableDate = moveFns[moveBy](refDate, moveDir === "after" ? 1 : -1); 25667 if (moveDir === "before" && navStart) { 25668 focusableDate = max3([navStart, focusableDate]); 25669 } else if (moveDir === "after" && navEnd) { 25670 focusableDate = min3([navEnd, focusableDate]); 25671 } 25672 return focusableDate; 25673 } 25674 25675 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/helpers/getNextFocus.js 25676 function getNextFocus(moveBy, moveDir, refDay, calendarStartMonth, calendarEndMonth, props, dateLib, attempt = 0) { 25677 if (attempt > 365) { 25678 return void 0; 25679 } 25680 const focusableDate = getFocusableDate(moveBy, moveDir, refDay.date, calendarStartMonth, calendarEndMonth, props, dateLib); 25681 const isDisabled = Boolean(props.disabled && dateMatchModifiers(focusableDate, props.disabled, dateLib)); 25682 const isHidden2 = Boolean(props.hidden && dateMatchModifiers(focusableDate, props.hidden, dateLib)); 25683 const targetMonth = focusableDate; 25684 const focusDay = new CalendarDay(focusableDate, targetMonth, dateLib); 25685 if (!isDisabled && !isHidden2) { 25686 return focusDay; 25687 } 25688 return getNextFocus(moveBy, moveDir, focusDay, calendarStartMonth, calendarEndMonth, props, dateLib, attempt + 1); 25689 } 25690 25691 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/useFocus.js 25692 function useFocus2(props, calendar, getModifiers, isSelected2, dateLib) { 25693 const { autoFocus } = props; 25694 const [lastFocused, setLastFocused] = (0, import_react35.useState)(); 25695 const focusTarget = calculateFocusTarget(calendar.days, getModifiers, isSelected2 || (() => false), lastFocused); 25696 const [focusedDay, setFocused] = (0, import_react35.useState)(autoFocus ? focusTarget : void 0); 25697 const blur = () => { 25698 setLastFocused(focusedDay); 25699 setFocused(void 0); 25700 }; 25701 const moveFocus = (moveBy, moveDir) => { 25702 if (!focusedDay) 25703 return; 25704 const nextFocus = getNextFocus(moveBy, moveDir, focusedDay, calendar.navStart, calendar.navEnd, props, dateLib); 25705 if (!nextFocus) 25706 return; 25707 if (props.disableNavigation) { 25708 const isNextInCalendar = calendar.days.some((day) => day.isEqualTo(nextFocus)); 25709 if (!isNextInCalendar) { 25710 return; 25711 } 25712 } 25713 calendar.goToDay(nextFocus); 25714 setFocused(nextFocus); 25715 }; 25716 const isFocusTarget = (day) => { 25717 return Boolean(focusTarget?.isEqualTo(day)); 25718 }; 25719 const useFocus3 = { 25720 isFocusTarget, 25721 setFocused, 25722 focused: focusedDay, 25723 blur, 25724 moveFocus 25725 }; 25726 return useFocus3; 25727 } 25728 25729 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/selection/useMulti.js 25730 function useMulti(props, dateLib) { 25731 const { selected: initiallySelected, required, onSelect } = props; 25732 const [internallySelected, setSelected] = useControlledValue(initiallySelected, onSelect ? initiallySelected : void 0); 25733 const selected = !onSelect ? internallySelected : initiallySelected; 25734 const { isSameDay: isSameDay2 } = dateLib; 25735 const isSelected2 = (date) => { 25736 return selected?.some((d) => isSameDay2(d, date)) ?? false; 25737 }; 25738 const { min: min3, max: max3 } = props; 25739 const select3 = (triggerDate, modifiers, e) => { 25740 let newDates = [...selected ?? []]; 25741 if (isSelected2(triggerDate)) { 25742 if (selected?.length === min3) { 25743 return; 25744 } 25745 if (required && selected?.length === 1) { 25746 return; 25747 } 25748 newDates = selected?.filter((d) => !isSameDay2(d, triggerDate)); 25749 } else { 25750 if (selected?.length === max3) { 25751 newDates = [triggerDate]; 25752 } else { 25753 newDates = [...newDates, triggerDate]; 25754 } 25755 } 25756 if (!onSelect) { 25757 setSelected(newDates); 25758 } 25759 onSelect?.(newDates, triggerDate, modifiers, e); 25760 return newDates; 25761 }; 25762 return { 25763 selected, 25764 select: select3, 25765 isSelected: isSelected2 25766 }; 25767 } 25768 25769 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/utils/addToRange.js 25770 function addToRange(date, initialRange, min3 = 0, max3 = 0, required = false, dateLib = defaultDateLib) { 25771 const { from, to } = initialRange || {}; 25772 const { isSameDay: isSameDay2, isAfter: isAfter2, isBefore: isBefore2 } = dateLib; 25773 let range; 25774 if (!from && !to) { 25775 range = { from: date, to: min3 > 0 ? void 0 : date }; 25776 } else if (from && !to) { 25777 if (isSameDay2(from, date)) { 25778 if (min3 === 0) { 25779 range = { from, to: date }; 25780 } else if (required) { 25781 range = { from, to: void 0 }; 25782 } else { 25783 range = void 0; 25784 } 25785 } else if (isBefore2(date, from)) { 25786 range = { from: date, to: from }; 25787 } else { 25788 range = { from, to: date }; 25789 } 25790 } else if (from && to) { 25791 if (isSameDay2(from, date) && isSameDay2(to, date)) { 25792 if (required) { 25793 range = { from, to }; 25794 } else { 25795 range = void 0; 25796 } 25797 } else if (isSameDay2(from, date)) { 25798 range = { from, to: min3 > 0 ? void 0 : date }; 25799 } else if (isSameDay2(to, date)) { 25800 range = { from: date, to: min3 > 0 ? void 0 : date }; 25801 } else if (isBefore2(date, from)) { 25802 range = { from: date, to }; 25803 } else if (isAfter2(date, from)) { 25804 range = { from, to: date }; 25805 } else if (isAfter2(date, to)) { 25806 range = { from, to: date }; 25807 } else { 25808 throw new Error("Invalid range"); 25809 } 25810 } 25811 if (range?.from && range?.to) { 25812 const diff = dateLib.differenceInCalendarDays(range.to, range.from); 25813 if (max3 > 0 && diff > max3) { 25814 range = { from: date, to: void 0 }; 25815 } else if (min3 > 1 && diff < min3) { 25816 range = { from: date, to: void 0 }; 25817 } 25818 } 25819 return range; 25820 } 25821 25822 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/utils/rangeContainsDayOfWeek.js 25823 function rangeContainsDayOfWeek(range, dayOfWeek, dateLib = defaultDateLib) { 25824 const dayOfWeekArr = !Array.isArray(dayOfWeek) ? [dayOfWeek] : dayOfWeek; 25825 let date = range.from; 25826 const totalDays = dateLib.differenceInCalendarDays(range.to, range.from); 25827 const totalDaysLimit = Math.min(totalDays, 6); 25828 for (let i = 0; i <= totalDaysLimit; i++) { 25829 if (dayOfWeekArr.includes(date.getDay())) { 25830 return true; 25831 } 25832 date = dateLib.addDays(date, 1); 25833 } 25834 return false; 25835 } 25836 25837 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/utils/rangeOverlaps.js 25838 function rangeOverlaps(rangeLeft, rangeRight, dateLib = defaultDateLib) { 25839 return rangeIncludesDate(rangeLeft, rangeRight.from, false, dateLib) || rangeIncludesDate(rangeLeft, rangeRight.to, false, dateLib) || rangeIncludesDate(rangeRight, rangeLeft.from, false, dateLib) || rangeIncludesDate(rangeRight, rangeLeft.to, false, dateLib); 25840 } 25841 25842 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/utils/rangeContainsModifiers.js 25843 function rangeContainsModifiers(range, modifiers, dateLib = defaultDateLib) { 25844 const matchers = Array.isArray(modifiers) ? modifiers : [modifiers]; 25845 const nonFunctionMatchers = matchers.filter((matcher) => typeof matcher !== "function"); 25846 const nonFunctionMatchersResult = nonFunctionMatchers.some((matcher) => { 25847 if (typeof matcher === "boolean") 25848 return matcher; 25849 if (dateLib.isDate(matcher)) { 25850 return rangeIncludesDate(range, matcher, false, dateLib); 25851 } 25852 if (isDatesArray(matcher, dateLib)) { 25853 return matcher.some((date) => rangeIncludesDate(range, date, false, dateLib)); 25854 } 25855 if (isDateRange(matcher)) { 25856 if (matcher.from && matcher.to) { 25857 return rangeOverlaps(range, { from: matcher.from, to: matcher.to }, dateLib); 25858 } 25859 return false; 25860 } 25861 if (isDayOfWeekType(matcher)) { 25862 return rangeContainsDayOfWeek(range, matcher.dayOfWeek, dateLib); 25863 } 25864 if (isDateInterval(matcher)) { 25865 const isClosedInterval = dateLib.isAfter(matcher.before, matcher.after); 25866 if (isClosedInterval) { 25867 return rangeOverlaps(range, { 25868 from: dateLib.addDays(matcher.after, 1), 25869 to: dateLib.addDays(matcher.before, -1) 25870 }, dateLib); 25871 } 25872 return dateMatchModifiers(range.from, matcher, dateLib) || dateMatchModifiers(range.to, matcher, dateLib); 25873 } 25874 if (isDateAfterType(matcher) || isDateBeforeType(matcher)) { 25875 return dateMatchModifiers(range.from, matcher, dateLib) || dateMatchModifiers(range.to, matcher, dateLib); 25876 } 25877 return false; 25878 }); 25879 if (nonFunctionMatchersResult) { 25880 return true; 25881 } 25882 const functionMatchers = matchers.filter((matcher) => typeof matcher === "function"); 25883 if (functionMatchers.length) { 25884 let date = range.from; 25885 const totalDays = dateLib.differenceInCalendarDays(range.to, range.from); 25886 for (let i = 0; i <= totalDays; i++) { 25887 if (functionMatchers.some((matcher) => matcher(date))) { 25888 return true; 25889 } 25890 date = dateLib.addDays(date, 1); 25891 } 25892 } 25893 return false; 25894 } 25895 25896 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/selection/useRange.js 25897 function useRange(props, dateLib) { 25898 const { disabled: disabled2, excludeDisabled, resetOnSelect, selected: initiallySelected, required, onSelect } = props; 25899 const [internallySelected, setSelected] = useControlledValue(initiallySelected, onSelect ? initiallySelected : void 0); 25900 const selected = !onSelect ? internallySelected : initiallySelected; 25901 const isSelected2 = (date) => selected && rangeIncludesDate(selected, date, false, dateLib); 25902 const select3 = (triggerDate, modifiers, e) => { 25903 const { min: min3, max: max3 } = props; 25904 let newRange; 25905 if (triggerDate) { 25906 const selectedFrom = selected?.from; 25907 const selectedTo = selected?.to; 25908 const hasFullRange = !!selectedFrom && !!selectedTo; 25909 const isClickingSingleDayRange = !!selectedFrom && !!selectedTo && dateLib.isSameDay(selectedFrom, selectedTo) && dateLib.isSameDay(triggerDate, selectedFrom); 25910 if (resetOnSelect && (hasFullRange || !selected?.from)) { 25911 if (!required && isClickingSingleDayRange) { 25912 newRange = void 0; 25913 } else { 25914 newRange = { from: triggerDate, to: void 0 }; 25915 } 25916 } else { 25917 newRange = addToRange(triggerDate, selected, min3, max3, required, dateLib); 25918 } 25919 } 25920 if (excludeDisabled && disabled2 && newRange?.from && newRange.to) { 25921 if (rangeContainsModifiers({ from: newRange.from, to: newRange.to }, disabled2, dateLib)) { 25922 newRange.from = triggerDate; 25923 newRange.to = void 0; 25924 } 25925 } 25926 if (!onSelect) { 25927 setSelected(newRange); 25928 } 25929 onSelect?.(newRange, triggerDate, modifiers, e); 25930 return newRange; 25931 }; 25932 return { 25933 selected, 25934 select: select3, 25935 isSelected: isSelected2 25936 }; 25937 } 25938 25939 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/selection/useSingle.js 25940 function useSingle(props, dateLib) { 25941 const { selected: initiallySelected, required, onSelect } = props; 25942 const [internallySelected, setSelected] = useControlledValue(initiallySelected, onSelect ? initiallySelected : void 0); 25943 const selected = !onSelect ? internallySelected : initiallySelected; 25944 const { isSameDay: isSameDay2 } = dateLib; 25945 const isSelected2 = (compareDate) => { 25946 return selected ? isSameDay2(selected, compareDate) : false; 25947 }; 25948 const select3 = (triggerDate, modifiers, e) => { 25949 let newDate = triggerDate; 25950 if (!required && selected && selected && isSameDay2(triggerDate, selected)) { 25951 newDate = void 0; 25952 } 25953 if (!onSelect) { 25954 setSelected(newDate); 25955 } 25956 if (required) { 25957 onSelect?.(newDate, triggerDate, modifiers, e); 25958 } else { 25959 onSelect?.(newDate, triggerDate, modifiers, e); 25960 } 25961 return newDate; 25962 }; 25963 return { 25964 selected, 25965 select: select3, 25966 isSelected: isSelected2 25967 }; 25968 } 25969 25970 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/useSelection.js 25971 function useSelection(props, dateLib) { 25972 const single = useSingle(props, dateLib); 25973 const multi = useMulti(props, dateLib); 25974 const range = useRange(props, dateLib); 25975 switch (props.mode) { 25976 case "single": 25977 return single; 25978 case "multiple": 25979 return multi; 25980 case "range": 25981 return range; 25982 default: 25983 return void 0; 25984 } 25985 } 25986 25987 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/utils/toTimeZone.js 25988 function toTimeZone(date, timeZone) { 25989 if (date instanceof TZDate && date.timeZone === timeZone) { 25990 return date; 25991 } 25992 return new TZDate(date, timeZone); 25993 } 25994 25995 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/utils/convertMatchersToTimeZone.js 25996 function toZoneNoon(date, timeZone, noonSafe) { 25997 if (!noonSafe) 25998 return toTimeZone(date, timeZone); 25999 const zoned = toTimeZone(date, timeZone); 26000 const noonZoned = new TZDate(zoned.getFullYear(), zoned.getMonth(), zoned.getDate(), 12, 0, 0, timeZone); 26001 return new Date(noonZoned.getTime()); 26002 } 26003 function convertMatcher(matcher, timeZone, noonSafe) { 26004 if (typeof matcher === "boolean" || typeof matcher === "function") { 26005 return matcher; 26006 } 26007 if (matcher instanceof Date) { 26008 return toZoneNoon(matcher, timeZone, noonSafe); 26009 } 26010 if (Array.isArray(matcher)) { 26011 return matcher.map((value) => value instanceof Date ? toZoneNoon(value, timeZone, noonSafe) : value); 26012 } 26013 if (isDateRange(matcher)) { 26014 return { 26015 ...matcher, 26016 from: matcher.from ? toTimeZone(matcher.from, timeZone) : matcher.from, 26017 to: matcher.to ? toTimeZone(matcher.to, timeZone) : matcher.to 26018 }; 26019 } 26020 if (isDateInterval(matcher)) { 26021 return { 26022 before: toZoneNoon(matcher.before, timeZone, noonSafe), 26023 after: toZoneNoon(matcher.after, timeZone, noonSafe) 26024 }; 26025 } 26026 if (isDateAfterType(matcher)) { 26027 return { 26028 after: toZoneNoon(matcher.after, timeZone, noonSafe) 26029 }; 26030 } 26031 if (isDateBeforeType(matcher)) { 26032 return { 26033 before: toZoneNoon(matcher.before, timeZone, noonSafe) 26034 }; 26035 } 26036 return matcher; 26037 } 26038 function convertMatchersToTimeZone(matchers, timeZone, noonSafe) { 26039 if (!matchers) { 26040 return matchers; 26041 } 26042 if (Array.isArray(matchers)) { 26043 return matchers.map((matcher) => convertMatcher(matcher, timeZone, noonSafe)); 26044 } 26045 return convertMatcher(matchers, timeZone, noonSafe); 26046 } 26047 26048 // node_modules/@daypicker/react/node_modules/react-day-picker/dist/esm/DayPicker.js 26049 function DayPicker(initialProps) { 26050 let props = initialProps; 26051 const timeZone = props.timeZone; 26052 if (timeZone) { 26053 props = { 26054 ...initialProps, 26055 timeZone 26056 }; 26057 if (props.today) { 26058 props.today = toTimeZone(props.today, timeZone); 26059 } 26060 if (props.month) { 26061 props.month = toTimeZone(props.month, timeZone); 26062 } 26063 if (props.defaultMonth) { 26064 props.defaultMonth = toTimeZone(props.defaultMonth, timeZone); 26065 } 26066 if (props.startMonth) { 26067 props.startMonth = toTimeZone(props.startMonth, timeZone); 26068 } 26069 if (props.endMonth) { 26070 props.endMonth = toTimeZone(props.endMonth, timeZone); 26071 } 26072 if (props.mode === "single" && props.selected) { 26073 props.selected = toTimeZone(props.selected, timeZone); 26074 } else if (props.mode === "multiple" && props.selected) { 26075 props.selected = props.selected?.map((date) => toTimeZone(date, timeZone)); 26076 } else if (props.mode === "range" && props.selected) { 26077 props.selected = { 26078 from: props.selected.from ? toTimeZone(props.selected.from, timeZone) : props.selected.from, 26079 to: props.selected.to ? toTimeZone(props.selected.to, timeZone) : props.selected.to 26080 }; 26081 } 26082 if (props.disabled !== void 0) { 26083 props.disabled = convertMatchersToTimeZone(props.disabled, timeZone); 26084 } 26085 if (props.hidden !== void 0) { 26086 props.hidden = convertMatchersToTimeZone(props.hidden, timeZone); 26087 } 26088 if (props.modifiers) { 26089 const nextModifiers = {}; 26090 Object.keys(props.modifiers).forEach((key) => { 26091 nextModifiers[key] = convertMatchersToTimeZone(props.modifiers?.[key], timeZone); 26092 }); 26093 props.modifiers = nextModifiers; 26094 } 26095 } 26096 const { components, formatters: formatters2, labels, dateLib, locale, classNames } = (0, import_react36.useMemo)(() => { 26097 const locale2 = { ...enUS2, ...props.locale }; 26098 const weekStartsOn = props.broadcastCalendar ? 1 : props.weekStartsOn; 26099 const noonOverrides = props.noonSafe && props.timeZone ? createNoonOverrides(props.timeZone, { 26100 weekStartsOn, 26101 locale: locale2 26102 }) : void 0; 26103 const overrides = props.dateLib && noonOverrides ? { ...noonOverrides, ...props.dateLib } : props.dateLib ?? noonOverrides; 26104 const dateLib2 = new DateLib({ 26105 locale: locale2, 26106 weekStartsOn, 26107 firstWeekContainsDate: props.firstWeekContainsDate, 26108 useAdditionalWeekYearTokens: props.useAdditionalWeekYearTokens, 26109 useAdditionalDayOfYearTokens: props.useAdditionalDayOfYearTokens, 26110 timeZone: props.timeZone, 26111 numerals: props.numerals 26112 }, overrides); 26113 return { 26114 dateLib: dateLib2, 26115 components: getComponents(props.components), 26116 formatters: getFormatters(props.formatters), 26117 labels: getLabels(props.labels, dateLib2.options), 26118 locale: locale2, 26119 classNames: { ...getDefaultClassNames(), ...props.classNames } 26120 }; 26121 }, [ 26122 props.locale, 26123 props.broadcastCalendar, 26124 props.weekStartsOn, 26125 props.firstWeekContainsDate, 26126 props.useAdditionalWeekYearTokens, 26127 props.useAdditionalDayOfYearTokens, 26128 props.timeZone, 26129 props.numerals, 26130 props.dateLib, 26131 props.noonSafe, 26132 props.components, 26133 props.formatters, 26134 props.labels, 26135 props.classNames 26136 ]); 26137 if (!props.today) { 26138 props = { ...props, today: dateLib.today() }; 26139 } 26140 const { captionLayout, mode, navLayout, numberOfMonths = 1, onDayBlur, onDayClick, onDayFocus, onDayKeyDown, onDayMouseEnter, onDayMouseLeave, onNextClick, onPrevClick, showWeekNumber, styles } = props; 26141 const { formatCaption: formatCaption2, formatDay: formatDay2, formatMonthDropdown: formatMonthDropdown2, formatWeekNumber: formatWeekNumber2, formatWeekNumberHeader: formatWeekNumberHeader2, formatWeekdayName: formatWeekdayName2, formatYearDropdown: formatYearDropdown2 } = formatters2; 26142 const calendar = useCalendar(props, dateLib); 26143 const { days, months, navStart, navEnd, previousMonth, nextMonth, goToMonth } = calendar; 26144 const getModifiers = createGetModifiers(days, props, navStart, navEnd, dateLib); 26145 const { isSelected: isSelected2, select: select3, selected: selectedValue } = useSelection(props, dateLib) ?? {}; 26146 const { blur, focused, isFocusTarget, moveFocus, setFocused } = useFocus2(props, calendar, getModifiers, isSelected2 ?? (() => false), dateLib); 26147 const { labelDayButton: labelDayButton2, labelGridcell: labelGridcell2, labelGrid: labelGrid2, labelMonthDropdown: labelMonthDropdown2, labelNav: labelNav2, labelPrevious: labelPrevious2, labelNext: labelNext2, labelWeekday: labelWeekday2, labelWeekNumber: labelWeekNumber2, labelWeekNumberHeader: labelWeekNumberHeader2, labelYearDropdown: labelYearDropdown2 } = labels; 26148 const weekdays = (0, import_react36.useMemo)(() => getWeekdays(dateLib, props.ISOWeek, props.broadcastCalendar, props.today), [dateLib, props.ISOWeek, props.broadcastCalendar, props.today]); 26149 const isInteractive = mode !== void 0 || onDayClick !== void 0; 26150 const handlePreviousClick = (0, import_react36.useCallback)(() => { 26151 if (!previousMonth) 26152 return; 26153 goToMonth(previousMonth); 26154 onPrevClick?.(previousMonth); 26155 }, [previousMonth, goToMonth, onPrevClick]); 26156 const handleNextClick = (0, import_react36.useCallback)(() => { 26157 if (!nextMonth) 26158 return; 26159 goToMonth(nextMonth); 26160 onNextClick?.(nextMonth); 26161 }, [goToMonth, nextMonth, onNextClick]); 26162 const handleDayClick = (0, import_react36.useCallback)((day, m2) => (e) => { 26163 e.preventDefault(); 26164 e.stopPropagation(); 26165 setFocused(day); 26166 if (m2.disabled) { 26167 return; 26168 } 26169 select3?.(day.date, m2, e); 26170 onDayClick?.(day.date, m2, e); 26171 }, [select3, onDayClick, setFocused]); 26172 const handleDayFocus = (0, import_react36.useCallback)((day, m2) => (e) => { 26173 setFocused(day); 26174 onDayFocus?.(day.date, m2, e); 26175 }, [onDayFocus, setFocused]); 26176 const handleDayBlur = (0, import_react36.useCallback)((day, m2) => (e) => { 26177 blur(); 26178 onDayBlur?.(day.date, m2, e); 26179 }, [blur, onDayBlur]); 26180 const handleDayKeyDown = (0, import_react36.useCallback)((day, modifiers) => (e) => { 26181 const keyMap = { 26182 ArrowLeft: [ 26183 e.shiftKey ? "month" : "day", 26184 props.dir === "rtl" ? "after" : "before" 26185 ], 26186 ArrowRight: [ 26187 e.shiftKey ? "month" : "day", 26188 props.dir === "rtl" ? "before" : "after" 26189 ], 26190 ArrowDown: [e.shiftKey ? "year" : "week", "after"], 26191 ArrowUp: [e.shiftKey ? "year" : "week", "before"], 26192 PageUp: [e.shiftKey ? "year" : "month", "before"], 26193 PageDown: [e.shiftKey ? "year" : "month", "after"], 26194 Home: ["startOfWeek", "before"], 26195 End: ["endOfWeek", "after"] 26196 }; 26197 if (keyMap[e.key]) { 26198 e.preventDefault(); 26199 e.stopPropagation(); 26200 const [moveBy, moveDir] = keyMap[e.key]; 26201 moveFocus(moveBy, moveDir); 26202 } 26203 onDayKeyDown?.(day.date, modifiers, e); 26204 }, [moveFocus, onDayKeyDown, props.dir]); 26205 const handleDayMouseEnter = (0, import_react36.useCallback)((day, modifiers) => (e) => { 26206 onDayMouseEnter?.(day.date, modifiers, e); 26207 }, [onDayMouseEnter]); 26208 const handleDayMouseLeave = (0, import_react36.useCallback)((day, modifiers) => (e) => { 26209 onDayMouseLeave?.(day.date, modifiers, e); 26210 }, [onDayMouseLeave]); 26211 const handleMonthChange = (0, import_react36.useCallback)((date, monthOffset) => (e) => { 26212 const selectedMonth = Number(e.target.value); 26213 const month = dateLib.setMonth(dateLib.startOfMonth(date), selectedMonth); 26214 goToMonth(dateLib.addMonths(month, -monthOffset)); 26215 }, [dateLib, goToMonth]); 26216 const handleYearChange = (0, import_react36.useCallback)((date, monthOffset) => (e) => { 26217 const selectedYear = Number(e.target.value); 26218 const month = dateLib.setYear(dateLib.startOfMonth(date), selectedYear); 26219 goToMonth(dateLib.addMonths(month, -monthOffset)); 26220 }, [dateLib, goToMonth]); 26221 const { className, style } = (0, import_react36.useMemo)(() => ({ 26222 className: [classNames[UI.Root], props.className].filter(Boolean).join(" "), 26223 style: { ...styles?.[UI.Root], ...props.style } 26224 }), [classNames, props.className, props.style, styles]); 26225 const dataAttributes = getDataAttributes(props); 26226 const getDropdownStyle = (dropdown) => { 26227 const dropdownStyle = styles?.[UI.Dropdown]; 26228 const specificDropdownStyle = styles?.[dropdown]; 26229 if (!dropdownStyle && !specificDropdownStyle) { 26230 return void 0; 26231 } 26232 return { 26233 ...dropdownStyle, 26234 ...specificDropdownStyle 26235 }; 26236 }; 26237 const rootElRef = (0, import_react36.useRef)(null); 26238 useAnimation(rootElRef, Boolean(props.animate), { 26239 classNames, 26240 months, 26241 focused, 26242 dateLib 26243 }); 26244 const contextValue = { 26245 dayPickerProps: props, 26246 selected: selectedValue, 26247 select: select3, 26248 isSelected: isSelected2, 26249 months, 26250 nextMonth, 26251 previousMonth, 26252 goToMonth, 26253 getModifiers, 26254 components, 26255 classNames, 26256 styles, 26257 labels, 26258 formatters: formatters2 26259 }; 26260 return import_react36.default.createElement( 26261 dayPickerContext.Provider, 26262 { value: contextValue }, 26263 import_react36.default.createElement( 26264 components.Root, 26265 { rootRef: props.animate ? rootElRef : void 0, className, style, dir: props.dir, id: props.id, lang: props.lang ?? locale.code, nonce: props.nonce, title: props.title, role: props.role, "aria-label": props["aria-label"], "aria-labelledby": props["aria-labelledby"], ...dataAttributes }, 26266 import_react36.default.createElement( 26267 components.Months, 26268 { className: classNames[UI.Months], style: styles?.[UI.Months] }, 26269 !props.hideNavigation && !navLayout && import_react36.default.createElement(components.Nav, { "data-animated-nav": props.animate ? "true" : void 0, className: classNames[UI.Nav], style: styles?.[UI.Nav], "aria-label": labelNav2(), onPreviousClick: handlePreviousClick, onNextClick: handleNextClick, previousMonth, nextMonth }), 26270 months.map((calendarMonth, displayIndex) => { 26271 const monthOffset = props.reverseMonths ? months.length - 1 - displayIndex : displayIndex; 26272 return import_react36.default.createElement( 26273 components.Month, 26274 { 26275 "data-animated-month": props.animate ? "true" : void 0, 26276 className: classNames[UI.Month], 26277 style: styles?.[UI.Month], 26278 // biome-ignore lint/suspicious/noArrayIndexKey: breaks animation 26279 key: displayIndex, 26280 displayIndex, 26281 calendarMonth 26282 }, 26283 navLayout === "around" && !props.hideNavigation && displayIndex === 0 && import_react36.default.createElement( 26284 components.PreviousMonthButton, 26285 { type: "button", className: classNames[UI.PreviousMonthButton], style: styles?.[UI.PreviousMonthButton], tabIndex: previousMonth ? void 0 : -1, "aria-disabled": previousMonth ? void 0 : true, "aria-label": labelPrevious2(previousMonth), onClick: handlePreviousClick, "data-animated-button": props.animate ? "true" : void 0 }, 26286 import_react36.default.createElement(components.Chevron, { disabled: previousMonth ? void 0 : true, className: classNames[UI.Chevron], style: styles?.[UI.Chevron], orientation: props.dir === "rtl" ? "right" : "left" }) 26287 ), 26288 import_react36.default.createElement(components.MonthCaption, { "data-animated-caption": props.animate ? "true" : void 0, className: classNames[UI.MonthCaption], style: styles?.[UI.MonthCaption], calendarMonth, displayIndex }, captionLayout?.startsWith("dropdown") ? import_react36.default.createElement( 26289 components.DropdownNav, 26290 { className: classNames[UI.Dropdowns], style: styles?.[UI.Dropdowns] }, 26291 (() => { 26292 const monthControl = captionLayout === "dropdown" || captionLayout === "dropdown-months" ? import_react36.default.createElement(components.MonthsDropdown, { key: "month", className: classNames[UI.MonthsDropdown], "aria-label": labelMonthDropdown2(), disabled: Boolean(props.disableNavigation), onChange: handleMonthChange(calendarMonth.date, monthOffset), options: getMonthOptions(calendarMonth.date, navStart, navEnd, formatters2, dateLib), style: getDropdownStyle(UI.MonthsDropdown), value: dateLib.getMonth(calendarMonth.date) }) : import_react36.default.createElement("span", { key: "month" }, formatMonthDropdown2(calendarMonth.date, dateLib)); 26293 const yearControl = captionLayout === "dropdown" || captionLayout === "dropdown-years" ? import_react36.default.createElement(components.YearsDropdown, { key: "year", className: classNames[UI.YearsDropdown], "aria-label": labelYearDropdown2(dateLib.options), disabled: Boolean(props.disableNavigation), onChange: handleYearChange(calendarMonth.date, monthOffset), options: getYearOptions(navStart, navEnd, formatters2, dateLib, Boolean(props.reverseYears)), style: getDropdownStyle(UI.YearsDropdown), value: dateLib.getYear(calendarMonth.date) }) : import_react36.default.createElement("span", { key: "year" }, formatYearDropdown2(calendarMonth.date, dateLib)); 26294 const controls = dateLib.getMonthYearOrder() === "year-first" ? [yearControl, monthControl] : [monthControl, yearControl]; 26295 return controls; 26296 })(), 26297 import_react36.default.createElement("span", { role: "status", "aria-live": "polite", style: { 26298 border: 0, 26299 clip: "rect(0 0 0 0)", 26300 height: "1px", 26301 margin: "-1px", 26302 overflow: "hidden", 26303 padding: 0, 26304 position: "absolute", 26305 width: "1px", 26306 whiteSpace: "nowrap", 26307 wordWrap: "normal" 26308 } }, formatCaption2(calendarMonth.date, dateLib.options, dateLib)) 26309 ) : import_react36.default.createElement(components.CaptionLabel, { className: classNames[UI.CaptionLabel], style: styles?.[UI.CaptionLabel], role: "status", "aria-live": "polite" }, formatCaption2(calendarMonth.date, dateLib.options, dateLib))), 26310 navLayout === "around" && !props.hideNavigation && displayIndex === numberOfMonths - 1 && import_react36.default.createElement( 26311 components.NextMonthButton, 26312 { type: "button", className: classNames[UI.NextMonthButton], style: styles?.[UI.NextMonthButton], tabIndex: nextMonth ? void 0 : -1, "aria-disabled": nextMonth ? void 0 : true, "aria-label": labelNext2(nextMonth), onClick: handleNextClick, "data-animated-button": props.animate ? "true" : void 0 }, 26313 import_react36.default.createElement(components.Chevron, { disabled: nextMonth ? void 0 : true, className: classNames[UI.Chevron], style: styles?.[UI.Chevron], orientation: props.dir === "rtl" ? "left" : "right" }) 26314 ), 26315 displayIndex === numberOfMonths - 1 && navLayout === "after" && !props.hideNavigation && import_react36.default.createElement(components.Nav, { "data-animated-nav": props.animate ? "true" : void 0, className: classNames[UI.Nav], style: styles?.[UI.Nav], "aria-label": labelNav2(), onPreviousClick: handlePreviousClick, onNextClick: handleNextClick, previousMonth, nextMonth }), 26316 import_react36.default.createElement( 26317 components.MonthGrid, 26318 { role: "grid", "aria-multiselectable": mode === "multiple" || mode === "range", "aria-label": labelGrid2(calendarMonth.date, dateLib.options, dateLib) || void 0, className: classNames[UI.MonthGrid], style: styles?.[UI.MonthGrid] }, 26319 !props.hideWeekdays && import_react36.default.createElement( 26320 components.Weekdays, 26321 { "data-animated-weekdays": props.animate ? "true" : void 0, className: classNames[UI.Weekdays], style: styles?.[UI.Weekdays] }, 26322 showWeekNumber && import_react36.default.createElement(components.WeekNumberHeader, { "aria-label": labelWeekNumberHeader2(dateLib.options), className: classNames[UI.WeekNumberHeader], style: styles?.[UI.WeekNumberHeader], scope: "col" }, formatWeekNumberHeader2()), 26323 weekdays.map((weekday) => import_react36.default.createElement(components.Weekday, { "aria-label": labelWeekday2(weekday, dateLib.options, dateLib), className: classNames[UI.Weekday], key: String(weekday), style: styles?.[UI.Weekday], scope: "col" }, formatWeekdayName2(weekday, dateLib.options, dateLib))) 26324 ), 26325 import_react36.default.createElement(components.Weeks, { "data-animated-weeks": props.animate ? "true" : void 0, className: classNames[UI.Weeks], style: styles?.[UI.Weeks] }, calendarMonth.weeks.map((week) => { 26326 return import_react36.default.createElement( 26327 components.Week, 26328 { className: classNames[UI.Week], key: week.weekNumber, style: styles?.[UI.Week], week }, 26329 showWeekNumber && import_react36.default.createElement(components.WeekNumber, { week, style: styles?.[UI.WeekNumber], "aria-label": labelWeekNumber2(week.weekNumber, { 26330 locale 26331 }), className: classNames[UI.WeekNumber], scope: "row", role: "rowheader" }, formatWeekNumber2(week.weekNumber, dateLib)), 26332 week.days.map((day) => { 26333 const { date } = day; 26334 const modifiers = getModifiers(day); 26335 modifiers[DayFlag.focused] = !modifiers.hidden && Boolean(focused?.isEqualTo(day)); 26336 modifiers[SelectionState.selected] = isSelected2?.(date) || modifiers.selected; 26337 if (isDateRange(selectedValue)) { 26338 const { from, to } = selectedValue; 26339 modifiers[SelectionState.range_start] = Boolean(from && to && dateLib.isSameDay(date, from)); 26340 modifiers[SelectionState.range_end] = Boolean(from && to && dateLib.isSameDay(date, to)); 26341 modifiers[SelectionState.range_middle] = rangeIncludesDate(selectedValue, date, true, dateLib); 26342 } 26343 const style2 = getStyleForModifiers(modifiers, styles, props.modifiersStyles); 26344 const className2 = getClassNamesForModifiers(modifiers, classNames, props.modifiersClassNames); 26345 const ariaLabel = !isInteractive && !modifiers.hidden ? labelGridcell2(date, modifiers, dateLib.options, dateLib) : void 0; 26346 return import_react36.default.createElement(components.Day, { key: `$day.isoDate}_$day.displayMonthId}`, day, modifiers, className: className2.join(" "), style: style2, role: "gridcell", "aria-selected": modifiers.selected || void 0, "aria-label": ariaLabel, "data-day": day.isoDate, "data-month": day.outside ? day.dateMonthId : void 0, "data-selected": modifiers.selected || void 0, "data-disabled": modifiers.disabled || void 0, "data-hidden": modifiers.hidden || void 0, "data-outside": day.outside || void 0, "data-focused": modifiers.focused || void 0, "data-today": modifiers.today || void 0 }, !modifiers.hidden && isInteractive ? import_react36.default.createElement(components.DayButton, { className: classNames[UI.DayButton], style: styles?.[UI.DayButton], type: "button", day, modifiers, disabled: !modifiers.focused && modifiers.disabled || void 0, "aria-disabled": modifiers.focused && modifiers.disabled || void 0, tabIndex: isFocusTarget(day) ? 0 : -1, "aria-label": labelDayButton2(date, modifiers, dateLib.options, dateLib), onClick: handleDayClick(day, modifiers), onBlur: handleDayBlur(day, modifiers), onFocus: handleDayFocus(day, modifiers), onKeyDown: handleDayKeyDown(day, modifiers), onMouseEnter: handleDayMouseEnter(day, modifiers), onMouseLeave: handleDayMouseLeave(day, modifiers) }, formatDay2(date, dateLib.options, dateLib)) : !modifiers.hidden && formatDay2(day.date, dateLib.options, dateLib)); 26347 }) 26348 ); 26349 })) 26350 ) 26351 ); 26352 }) 26353 ), 26354 props.footer && import_react36.default.createElement(components.Footer, { className: classNames[UI.Footer], style: styles?.[UI.Footer], role: "status", "aria-live": "polite" }, props.footer) 26355 ) 26356 ); 26357 } 26358 26359 // packages/ui/build-module/calendar/calendar.mjs 26360 var import_element53 = __toESM(require_element(), 1); 26361 26362 // packages/ui/build-module/calendar/utils/components.mjs 26363 var import_element49 = __toESM(require_element(), 1); 26364 var import_compose = __toESM(require_compose(), 1); 26365 var import_i18n12 = __toESM(require_i18n(), 1); 26366 26367 // packages/ui/build-module/icon-button/icon-button.mjs 26368 var import_element47 = __toESM(require_element(), 1); 26369 var import_jsx_runtime96 = __toESM(require_jsx_runtime(), 1); 26370 var STYLE_HASH_ATTRIBUTE24 = "data-wp-hash"; 26371 function getRuntime24() { 26372 const globalScope = globalThis; 26373 if (globalScope.__wpStyleRuntime) { 26374 return globalScope.__wpStyleRuntime; 26375 } 26376 globalScope.__wpStyleRuntime = { 26377 documents: /* @__PURE__ */ new Map(), 26378 styles: /* @__PURE__ */ new Map(), 26379 injectedStyles: /* @__PURE__ */ new WeakMap() 26380 }; 26381 if (typeof document !== "undefined") { 26382 registerDocument24(document); 26383 } 26384 return globalScope.__wpStyleRuntime; 26385 } 26386 function documentContainsStyleHash24(targetDocument, hash) { 26387 if (!targetDocument.head) { 26388 return false; 26389 } 26390 for (const style of targetDocument.head.querySelectorAll( 26391 `style[$STYLE_HASH_ATTRIBUTE24}]` 26392 )) { 26393 if (style.getAttribute(STYLE_HASH_ATTRIBUTE24) === hash) { 26394 return true; 26395 } 26396 } 26397 return false; 26398 } 26399 function injectStyle24(targetDocument, hash, css) { 26400 if (!targetDocument.head) { 26401 return; 26402 } 26403 const runtime = getRuntime24(); 26404 let injectedStyles = runtime.injectedStyles.get(targetDocument); 26405 if (!injectedStyles) { 26406 injectedStyles = /* @__PURE__ */ new Set(); 26407 runtime.injectedStyles.set(targetDocument, injectedStyles); 26408 } 26409 if (injectedStyles.has(hash)) { 26410 return; 26411 } 26412 if (documentContainsStyleHash24(targetDocument, hash)) { 26413 injectedStyles.add(hash); 26414 return; 26415 } 26416 const style = targetDocument.createElement("style"); 26417 style.setAttribute(STYLE_HASH_ATTRIBUTE24, hash); 26418 style.appendChild(targetDocument.createTextNode(css)); 26419 targetDocument.head.appendChild(style); 26420 injectedStyles.add(hash); 26421 } 26422 function registerDocument24(targetDocument) { 26423 const runtime = getRuntime24(); 26424 runtime.documents.set( 26425 targetDocument, 26426 (runtime.documents.get(targetDocument) ?? 0) + 1 26427 ); 26428 for (const [hash, css] of runtime.styles) { 26429 injectStyle24(targetDocument, hash, css); 26430 } 26431 return () => { 26432 const count = runtime.documents.get(targetDocument); 26433 if (count === void 0) { 26434 return; 26435 } 26436 if (count <= 1) { 26437 runtime.documents.delete(targetDocument); 26438 return; 26439 } 26440 runtime.documents.set(targetDocument, count - 1); 26441 }; 26442 } 26443 function registerStyle24(hash, css) { 26444 const runtime = getRuntime24(); 26445 runtime.styles.set(hash, css); 26446 for (const targetDocument of runtime.documents.keys()) { 26447 injectStyle24(targetDocument, hash, css); 26448 } 26449 } 26450 if (typeof process === "undefined" || true) { 26451 registerStyle24("c5cdafb1bc", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer compositions{._28cfdc260e755391__icon-button{--wp-ui-button-aspect-ratio:1;--wp-ui-button-padding-inline:0px;--wp-ui-button-min-width:unset}.f1c70d719989a85a__icon{margin:-1px}}}"); 26452 } 26453 var style_default23 = { "icon-button": "_28cfdc260e755391__icon-button", "icon": "f1c70d719989a85a__icon" }; 26454 var IconButton = (0, import_element47.forwardRef)( 26455 function IconButton2({ 26456 label, 26457 className, 26458 // Prevent accidental forwarding of `children` 26459 children: _children, 26460 disabled: disabled2, 26461 focusableWhenDisabled = true, 26462 icon, 26463 size: size4, 26464 shortcut, 26465 positioner, 26466 "aria-describedby": ariaDescribedBy, 26467 "aria-keyshortcuts": ariaKeyShortcuts, 26468 ...restProps 26469 }, ref) { 26470 const classes = clsx_default(style_default23["icon-button"], className); 26471 const { descriptionId, targetProps } = useKeyboardShortcutProps({ 26472 "aria-describedby": ariaDescribedBy, 26473 "aria-keyshortcuts": ariaKeyShortcuts, 26474 shortcut 26475 }); 26476 return /* @__PURE__ */ (0, import_jsx_runtime96.jsxs)(Root, { children: [ 26477 /* @__PURE__ */ (0, import_jsx_runtime96.jsxs)( 26478 Trigger, 26479 { 26480 ref, 26481 ...targetProps, 26482 disabled: disabled2 && !focusableWhenDisabled, 26483 render: /* @__PURE__ */ (0, import_jsx_runtime96.jsx)( 26484 Button4, 26485 { 26486 ...restProps, 26487 size: size4, 26488 "aria-label": label, 26489 disabled: disabled2, 26490 focusableWhenDisabled 26491 } 26492 ), 26493 className: classes, 26494 children: [ 26495 /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(Icon, { icon, size: 24, className: style_default23.icon }), 26496 shortcut && descriptionId && /* @__PURE__ */ (0, import_jsx_runtime96.jsx)( 26497 KeyboardShortcutDescription, 26498 { 26499 descriptionId, 26500 shortcut 26501 } 26502 ) 26503 ] 26504 } 26505 ), 26506 /* @__PURE__ */ (0, import_jsx_runtime96.jsxs)(Popup, { positioner, children: [ 26507 label, 26508 shortcut && /* @__PURE__ */ (0, import_jsx_runtime96.jsxs)(import_jsx_runtime96.Fragment, { children: [ 26509 " ", 26510 /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(KeyboardShortcutDisplay, { shortcut }) 26511 ] }) 26512 ] }) 26513 ] }); 26514 } 26515 ); 26516 26517 // packages/ui/build-module/calendar/utils/root-context.mjs 26518 var import_element48 = __toESM(require_element(), 1); 26519 var RootContext = (0, import_element48.createContext)({}); 26520 26521 // packages/ui/build-module/calendar/utils/components.mjs 26522 var import_jsx_runtime97 = __toESM(require_jsx_runtime(), 1); 26523 var PreviewDashStartAndEnd = () => { 26524 return /* @__PURE__ */ (0, import_jsx_runtime97.jsx)( 26525 "svg", 26526 { 26527 viewBox: "0 0 32 32", 26528 xmlns: "http://www.w3.org/2000/svg", 26529 fill: "none", 26530 stroke: "currentColor", 26531 strokeDasharray: "3.7677", 26532 strokeDashoffset: "3.2", 26533 strokeWidth: "1", 26534 children: /* @__PURE__ */ (0, import_jsx_runtime97.jsx)("path", { d: "M29.5,0.5 h-27 a2,2 0 0 0 -2,2 v27 a2,2 0 0 0 2,2 h27 a2,2 0 0 0 2,-2 v-27 a2,2 0 0 0 -2,-2" }) 26535 } 26536 ); 26537 }; 26538 var PreviewDashStart = () => { 26539 return /* @__PURE__ */ (0, import_jsx_runtime97.jsx)( 26540 "svg", 26541 { 26542 viewBox: "0 0 32 32", 26543 xmlns: "http://www.w3.org/2000/svg", 26544 fill: "none", 26545 stroke: "currentColor", 26546 strokeDasharray: "3.84516", 26547 strokeDashoffset: "1.9226", 26548 strokeWidth: "1", 26549 children: /* @__PURE__ */ (0, import_jsx_runtime97.jsx)("path", { d: "M32,0.5 h-29.5 a2,2 0 0 0 -2,2 v27 a2,2 0 0 0 2,2 h30" }) 26550 } 26551 ); 26552 }; 26553 var PreviewDashMiddle = () => { 26554 return /* @__PURE__ */ (0, import_jsx_runtime97.jsxs)( 26555 "svg", 26556 { 26557 viewBox: "0 0 32 32", 26558 xmlns: "http://www.w3.org/2000/svg", 26559 fill: "none", 26560 stroke: "currentColor", 26561 strokeDasharray: "3.9 4", 26562 strokeDashoffset: "2", 26563 strokeWidth: "1", 26564 children: [ 26565 /* @__PURE__ */ (0, import_jsx_runtime97.jsx)("line", { x1: "0", y1: "0.5", x2: "100", y2: "0.5" }), 26566 /* @__PURE__ */ (0, import_jsx_runtime97.jsx)("line", { x1: "0", y1: "31.5", x2: "100", y2: "31.5" }) 26567 ] 26568 } 26569 ); 26570 }; 26571 var PreviewDashEnd = () => { 26572 return /* @__PURE__ */ (0, import_jsx_runtime97.jsx)( 26573 "svg", 26574 { 26575 viewBox: "0 0 32 32", 26576 xmlns: "http://www.w3.org/2000/svg", 26577 fill: "none", 26578 stroke: "currentColor", 26579 strokeDasharray: "3.84516", 26580 strokeDashoffset: "1.9226", 26581 strokeWidth: "1", 26582 children: /* @__PURE__ */ (0, import_jsx_runtime97.jsx)("path", { d: "M0,0.5 h29.5 a2,2 0 0 1 2,2 v27 a2,2 0 0 1 -2,2 h-29.5" }) 26583 } 26584 ); 26585 }; 26586 function Day2(props) { 26587 const { day, modifiers, children, ...tdProps } = props; 26588 let PreviewDash; 26589 if (modifiers.preview_start && modifiers.preview_end) { 26590 PreviewDash = PreviewDashStartAndEnd; 26591 } else if (modifiers.preview_start) { 26592 PreviewDash = PreviewDashStart; 26593 } else if (modifiers.preview_end) { 26594 PreviewDash = PreviewDashEnd; 26595 } else if (modifiers.preview) { 26596 PreviewDash = PreviewDashMiddle; 26597 } 26598 return /* @__PURE__ */ (0, import_jsx_runtime97.jsxs)("td", { ...tdProps, children: [ 26599 PreviewDash && /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(PreviewDash, {}), 26600 children 26601 ] }); 26602 } 26603 function Root4({ rootRef, ...props }) { 26604 const { render: render4, ref, role, defaultAriaLabel } = (0, import_element49.useContext)(RootContext); 26605 const { months, labels } = useDayPicker(); 26606 const hasExplicitLabel = props["aria-label"] !== void 0 || props["aria-labelledby"] !== void 0; 26607 let ariaLabel = props["aria-label"]; 26608 if (!hasExplicitLabel && defaultAriaLabel && role === "application") { 26609 const currentMonth = months[0]; 26610 ariaLabel = currentMonth ? (0, import_i18n12.sprintf)( 26611 // translators: 1: Calendar type. 2: Current month and year. 26612 (0, import_i18n12.__)("%1$s, %2$s"), 26613 defaultAriaLabel, 26614 labels.labelGrid(currentMonth.date) 26615 ) : defaultAriaLabel; 26616 } 26617 const mergedRef = (0, import_compose.useMergeRefs)([rootRef ?? null, ref ?? null]); 26618 return useRender({ 26619 render: render4, 26620 defaultTagName: "div", 26621 ref: mergedRef, 26622 props: { ...props, role, "aria-label": ariaLabel } 26623 }); 26624 } 26625 function NavButton({ 26626 icon, 26627 className, 26628 children: _children, 26629 "aria-label": label, 26630 "aria-disabled": ariaDisabled, 26631 ...props 26632 }) { 26633 return /* @__PURE__ */ (0, import_jsx_runtime97.jsx)( 26634 IconButton, 26635 { 26636 ...props, 26637 className, 26638 label, 26639 icon, 26640 variant: "minimal", 26641 tone: "neutral", 26642 size: "compact", 26643 disabled: ariaDisabled === true || ariaDisabled === "true", 26644 focusableWhenDisabled: true 26645 } 26646 ); 26647 } 26648 function PreviousMonthButton2(props) { 26649 return /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(NavButton, { ...props, icon: chevron_left_default }); 26650 } 26651 function NextMonthButton2(props) { 26652 return /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(NavButton, { ...props, icon: chevron_right_default }); 26653 } 26654 26655 // packages/ui/build-module/calendar/utils/constants.mjs 26656 var STYLE_HASH_ATTRIBUTE25 = "data-wp-hash"; 26657 function getRuntime25() { 26658 const globalScope = globalThis; 26659 if (globalScope.__wpStyleRuntime) { 26660 return globalScope.__wpStyleRuntime; 26661 } 26662 globalScope.__wpStyleRuntime = { 26663 documents: /* @__PURE__ */ new Map(), 26664 styles: /* @__PURE__ */ new Map(), 26665 injectedStyles: /* @__PURE__ */ new WeakMap() 26666 }; 26667 if (typeof document !== "undefined") { 26668 registerDocument25(document); 26669 } 26670 return globalScope.__wpStyleRuntime; 26671 } 26672 function documentContainsStyleHash25(targetDocument, hash) { 26673 if (!targetDocument.head) { 26674 return false; 26675 } 26676 for (const style of targetDocument.head.querySelectorAll( 26677 `style[$STYLE_HASH_ATTRIBUTE25}]` 26678 )) { 26679 if (style.getAttribute(STYLE_HASH_ATTRIBUTE25) === hash) { 26680 return true; 26681 } 26682 } 26683 return false; 26684 } 26685 function injectStyle25(targetDocument, hash, css) { 26686 if (!targetDocument.head) { 26687 return; 26688 } 26689 const runtime = getRuntime25(); 26690 let injectedStyles = runtime.injectedStyles.get(targetDocument); 26691 if (!injectedStyles) { 26692 injectedStyles = /* @__PURE__ */ new Set(); 26693 runtime.injectedStyles.set(targetDocument, injectedStyles); 26694 } 26695 if (injectedStyles.has(hash)) { 26696 return; 26697 } 26698 if (documentContainsStyleHash25(targetDocument, hash)) { 26699 injectedStyles.add(hash); 26700 return; 26701 } 26702 const style = targetDocument.createElement("style"); 26703 style.setAttribute(STYLE_HASH_ATTRIBUTE25, hash); 26704 style.appendChild(targetDocument.createTextNode(css)); 26705 targetDocument.head.appendChild(style); 26706 injectedStyles.add(hash); 26707 } 26708 function registerDocument25(targetDocument) { 26709 const runtime = getRuntime25(); 26710 runtime.documents.set( 26711 targetDocument, 26712 (runtime.documents.get(targetDocument) ?? 0) + 1 26713 ); 26714 for (const [hash, css] of runtime.styles) { 26715 injectStyle25(targetDocument, hash, css); 26716 } 26717 return () => { 26718 const count = runtime.documents.get(targetDocument); 26719 if (count === void 0) { 26720 return; 26721 } 26722 if (count <= 1) { 26723 runtime.documents.delete(targetDocument); 26724 return; 26725 } 26726 runtime.documents.set(targetDocument, count - 1); 26727 }; 26728 } 26729 function registerStyle25(hash, css) { 26730 const runtime = getRuntime25(); 26731 runtime.styles.set(hash, css); 26732 for (const targetDocument of runtime.documents.keys()) { 26733 injectStyle25(targetDocument, hash, css); 26734 } 26735 } 26736 if (typeof process === "undefined" || true) { 26737 registerStyle25("9d2212290a", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._2c7ac60ba97b3411__root{--wp-ui-calendar-cell-size:var(--wpds-dimension-size-md,32px);background-color:var(--wpds-color-background-surface-neutral-strong,#fff);color:var(--wpds-color-foreground-content-neutral,#1e1e1e);display:inline-block;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-md,13px);font-weight:var(--wpds-typography-font-weight-default,400);position:relative;z-index:0}._172c492625235710__day{color:var(--wpds-color-foreground-interactive-neutral,#1e1e1e);padding:0;position:relative;&:has(._1b64226e315835f8__day-button:disabled){color:var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d)}&:has(._1b64226e315835f8__day-button:focus-visible),&:has(._1b64226e315835f8__day-button:hover:not(:disabled)){color:var(--wpds-color-foreground-interactive-neutral-active,#1e1e1e)}}._1b64226e315835f8__day-button{align-items:center;background:none;border:none;border-radius:var(--wpds-border-radius-sm,2px);color:inherit;cursor:var(--wpds-cursor-control,pointer);display:flex;font:inherit;font-variant-numeric:tabular-nums;height:var(--wp-ui-calendar-cell-size);justify-content:center;margin:0;padding:0;position:relative;width:var(--wp-ui-calendar-cell-size);&:before{background-color:var(--wpds-color-background-interactive-neutral-weak,#0000);border:none;border-radius:var(--wpds-border-radius-sm,2px);z-index:-1}&:after,&:before{content:"";inset:0;position:absolute}&:after{pointer-events:none;z-index:1}&:disabled{cursor:revert;&:before{background-color:var(--wpds-color-background-interactive-neutral-weak-disabled,#0000)}@media (forced-colors:active){text-decoration:line-through}}&:focus-visible:before,&:hover:not(:disabled):before{background-color:var(--wpds-color-background-interactive-neutral-weak-active,#ededed)}}._66b9a8120581fd4b__caption-label{align-items:center;border:0;display:inline-flex;position:relative;text-transform:capitalize;white-space:nowrap;z-index:1}._2c7ac60ba97b3411__root[dir=rtl] ._395a75bb1930f57e__nav-button{transform:rotate(180deg);transform-origin:50%}._337e5337d49b7f3d__month-caption{align-content:center;display:flex;height:var(--wp-ui-calendar-cell-size);justify-content:center;margin-bottom:var(--wpds-dimension-gap-md,12px)}._110e46230c68e498__months{display:flex;flex-wrap:wrap;gap:var(--wpds-dimension-gap-lg,16px);justify-content:center;max-width:fit-content;position:relative}._92915239fedb1fea__month-grid{border-collapse:separate;border-spacing:0 var(--wpds-dimension-gap-xs,4px)}._66b1d4a7b488b496__nav{align-items:center;display:flex;height:var(--wp-ui-calendar-cell-size);inset-block-start:0;inset-inline-end:0;inset-inline-start:0;justify-content:space-between;position:absolute}._7207199709ca5776__weekday{color:var(--wpds-color-foreground-content-neutral-weak,#707070);font-weight:var(--wpds-typography-font-weight-default,400);height:var(--wp-ui-calendar-cell-size);padding:0;text-align:center;text-transform:uppercase;width:var(--wp-ui-calendar-cell-size)}._058175f0f9c495e0__today:after{border:2px solid;border-radius:50%;content:"";height:0;inset-block-start:2px;inset-inline-end:2px;position:absolute;width:0;z-index:1}.acb642920fb0bef5__selected:not(._165d91a726feca9c__range-middle){&:has(._1b64226e315835f8__day-button,._1b64226e315835f8__day-button:hover:not(:disabled)){color:var(--wpds-color-foreground-interactive-neutral-strong,#f0f0f0)}&:has(._1b64226e315835f8__day-button:disabled){color:var(--wpds-color-foreground-interactive-neutral-strong-disabled,#8d8d8d)}._1b64226e315835f8__day-button{&:before{background-color:var(--wpds-color-background-interactive-neutral-strong,#2d2d2d);border:1px solid transparent}&:disabled:before{background-color:var(--wpds-color-background-interactive-neutral-strong-disabled,#e6e6e6)}&:hover:not(:disabled):before{background-color:var(--wpds-color-background-interactive-neutral-strong-active,#1e1e1e)}}}.c259c5c255fda10f__outside{color:var(--wpds-color-foreground-interactive-neutral-weak,#707070)}._4d8957a0ca4ec8f0__hidden{visibility:hidden}.f2523033db055ffe__range-start:not(.c04a453de7b11520__range-end) ._1b64226e315835f8__day-button{&,&:before{border-end-end-radius:0;border-start-end-radius:0}}._165d91a726feca9c__range-middle ._1b64226e315835f8__day-button{&:before{background-color:var(--wpds-color-background-interactive-neutral-weak-active,#ededed);border-color:transparent;border-radius:0;border-style:solid;border-width:1px 0}}.c04a453de7b11520__range-end:not(.f2523033db055ffe__range-start) ._1b64226e315835f8__day-button{&,&:before{border-end-start-radius:0;border-start-start-radius:0}}._81b244e7c541d95e__preview svg{color:var(--wpds-color-stroke-interactive-neutral,#8d8d8d);inset:0;pointer-events:none;position:absolute;@media (forced-colors:active){color:inherit}}._81b244e7c541d95e__preview.acb642920fb0bef5__selected:not(._165d91a726feca9c__range-middle) svg{display:none}._2c7ac60ba97b3411__root[dir=rtl] ._81b244e7c541d95e__preview svg{transform:scaleX(-1)}._81b244e7c541d95e__preview._165d91a726feca9c__range-middle ._1b64226e315835f8__day-button:before{border:none}@keyframes _255a1a462a5377db__slide-in-left{0%{transform:translateX(-100%)}to{transform:translateX(0)}}@keyframes c21e45f616d6db39__slide-in-right{0%{transform:translateX(100%)}to{transform:translateX(0)}}@keyframes aed80001de9ae226__slide-out-left{0%{transform:translateX(0)}to{transform:translateX(-100%)}}@keyframes _7d4779a7f29408f2__slide-out-right{0%{transform:translateX(0)}to{transform:translateX(100%)}}@keyframes _83ba6321b055d687__fade-in{0%{opacity:0}to{opacity:1}}@keyframes _96fbead71248d210__fade-out{0%{opacity:1}to{opacity:0}}._1563bccb09e39c30__caption-after-enter,._60ac2a7fc3208801__weeks-before-exit,._735dacf9052adecd__caption-before-exit,._7f73a6ab85101202__weeks-after-exit,._805d698b56ba4a29__weeks-after-enter,._9721326fbc23a5fb__weeks-before-enter,.c7a3082839155d29__caption-after-exit,.cb8a5ec82ad0885e__caption-before-enter{animation-duration:0s;animation-fill-mode:forwards;animation-timing-function:var(--wpds-motion-easing-balanced,cubic-bezier(.4,0,.2,1));@media not (prefers-reduced-motion){animation-duration:var(--wpds-motion-duration-lg,.3s)}}._2c7ac60ba97b3411__root[dir=rtl] ._805d698b56ba4a29__weeks-after-enter,._9721326fbc23a5fb__weeks-before-enter{animation-name:_255a1a462a5377db__slide-in-left}._2c7ac60ba97b3411__root[dir=rtl] ._7f73a6ab85101202__weeks-after-exit,._60ac2a7fc3208801__weeks-before-exit{animation-name:aed80001de9ae226__slide-out-left}._2c7ac60ba97b3411__root[dir=rtl] ._9721326fbc23a5fb__weeks-before-enter,._805d698b56ba4a29__weeks-after-enter{animation-name:c21e45f616d6db39__slide-in-right}._2c7ac60ba97b3411__root[dir=rtl] ._60ac2a7fc3208801__weeks-before-exit,._7f73a6ab85101202__weeks-after-exit{animation-name:_7d4779a7f29408f2__slide-out-right}._1563bccb09e39c30__caption-after-enter,.cb8a5ec82ad0885e__caption-before-enter{animation-name:_83ba6321b055d687__fade-in}._735dacf9052adecd__caption-before-exit,.c7a3082839155d29__caption-after-exit{animation-name:_96fbead71248d210__fade-out}}}'); 26738 } 26739 var style_default24 = { "root": "_2c7ac60ba97b3411__root", "day": "_172c492625235710__day", "day-button": "_1b64226e315835f8__day-button", "caption-label": "_66b9a8120581fd4b__caption-label", "nav-button": "_395a75bb1930f57e__nav-button", "month-caption": "_337e5337d49b7f3d__month-caption", "months": "_110e46230c68e498__months", "month-grid": "_92915239fedb1fea__month-grid", "nav": "_66b1d4a7b488b496__nav", "weekday": "_7207199709ca5776__weekday", "today": "_058175f0f9c495e0__today", "selected": "acb642920fb0bef5__selected", "range-middle": "_165d91a726feca9c__range-middle", "outside": "c259c5c255fda10f__outside", "hidden": "_4d8957a0ca4ec8f0__hidden", "range-start": "f2523033db055ffe__range-start", "range-end": "c04a453de7b11520__range-end", "preview": "_81b244e7c541d95e__preview", "weeks-before-enter": "_9721326fbc23a5fb__weeks-before-enter", "weeks-before-exit": "_60ac2a7fc3208801__weeks-before-exit", "weeks-after-enter": "_805d698b56ba4a29__weeks-after-enter", "weeks-after-exit": "_7f73a6ab85101202__weeks-after-exit", "caption-after-enter": "_1563bccb09e39c30__caption-after-enter", "caption-after-exit": "c7a3082839155d29__caption-after-exit", "caption-before-enter": "cb8a5ec82ad0885e__caption-before-enter", "caption-before-exit": "_735dacf9052adecd__caption-before-exit", "slide-in-left": "_255a1a462a5377db__slide-in-left", "slide-out-left": "aed80001de9ae226__slide-out-left", "slide-in-right": "c21e45f616d6db39__slide-in-right", "slide-out-right": "_7d4779a7f29408f2__slide-out-right", "fade-in": "_83ba6321b055d687__fade-in", "fade-out": "_96fbead71248d210__fade-out" }; 26740 if (typeof process === "undefined" || true) { 26741 registerStyle25("10f3806643", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._336cd3e4e743482f__box-sizing{box-sizing:border-box;*,:after,:before{box-sizing:inherit}}}}"); 26742 } 26743 var resets_default10 = { "box-sizing": "_336cd3e4e743482f__box-sizing" }; 26744 if (typeof process === "undefined" || true) { 26745 registerStyle25("08122b3d53", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{.af79fb116edb0dd7__outset-ring--focus:focus,.dfcfdc28396e5d98__outset-ring--focus-visible:focus-visible,.e5cd9ee879f6403a__outset-ring--focus-within:focus-within,:focus-visible ._81935a08e952f267__outset-ring--focus-parent-visible{--_gcd-a-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));--_gcd-div-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));outline-offset:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px))}._3c9f5ee9fc9c136d__outset-ring--focus-within-except-active:focus-within,.abc777e9713fa711__outset-ring--focus-except-active:focus{outline:none}._3c9f5ee9fc9c136d__outset-ring--focus-within-except-active:focus-within:not(:has(:active)),.abc777e9713fa711__outset-ring--focus-except-active:focus:not(:active){--_gcd-a-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));--_gcd-div-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));outline-offset:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px))}}}"); 26746 } 26747 var focus_module_default3 = { "outset-ring--focus": "af79fb116edb0dd7__outset-ring--focus", "outset-ring--focus-visible": "dfcfdc28396e5d98__outset-ring--focus-visible", "outset-ring--focus-within": "e5cd9ee879f6403a__outset-ring--focus-within", "outset-ring--focus-parent-visible": "_81935a08e952f267__outset-ring--focus-parent-visible", "outset-ring--focus-except-active": "abc777e9713fa711__outset-ring--focus-except-active", "outset-ring--focus-within-except-active": "_3c9f5ee9fc9c136d__outset-ring--focus-within-except-active" }; 26748 if (typeof process === "undefined" || true) { 26749 registerStyle25("e8e31009f5", "._6defc79820e382c6__button{box-sizing:var(--_gcd-button-box-sizing,border-box);font-family:var(--_gcd-button-font-family,inherit);font-size:var(--_gcd-button-font-size,inherit);font-weight:var(--_gcd-button-font-weight,inherit)}.d2cff2e5dea83bd1__input{box-sizing:var(--_gcd-input-box-sizing,border-box);font-family:var(--_gcd-input-font-family,inherit);font-size:var(--_gcd-input-font-size,inherit);font-weight:var(--_gcd-input-font-weight,inherit);margin:var(--_gcd-input-margin,0);&::placeholder{color:var(--_gcd-input-placeholder-color,var(--wpds-color-foreground-interactive-neutral-weak,#707070))}&:is(textarea,[type=text],[type=password],[type=color],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){background-color:var(--_gcd-input-background-color,transparent);border:var(--_gcd-input-border,none);border-radius:var(--_gcd-input-border-radius,0);box-shadow:var(--_gcd-input-box-shadow,0 0 0 transparent);color:var(--_gcd-input-color,var(--wpds-color-foreground-interactive-neutral,#1e1e1e));&:focus{border-color:var(--_gcd-input-border-color-focus,var(--wp-admin-theme-color));box-shadow:var(--_gcd-input-box-shadow-focus,none);outline:var(--_gcd-input-outline-focus,none)}&:disabled{background:var(--_gcd-input-background-disabled,transparent);border-color:var(--_gcd-input-border-color-disabled,transparent);box-shadow:var(--_gcd-input-box-shadow-disabled,none);color:var(--_gcd-input-color-disabled,var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d))}}&:is(textarea,[type=text],[type=password],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){line-height:var(--_gcd-input-line-height,inherit);min-height:var(--_gcd-input-min-height,auto);padding:var(--_gcd-input-padding,0)}}._547d86373d02e108__textarea{box-sizing:var(--_gcd-textarea-box-sizing,border-box);overflow:var(--_gcd-textarea-overflow,auto);resize:var(--_gcd-textarea-resize,block)}._8c15fd0ed9f28ba4__div{outline:var(--_gcd-div-outline,0 solid transparent)}p._43cec3e1eec1066d__p{font-size:var(--_gcd-p-font-size,13px);line-height:var(--_gcd-p-line-height,1.5);margin:var(--_gcd-p-margin,0)}:is(h1,h2,h3,h4,h5,h6).e97669c6d9a38497__heading{color:var(--_gcd-heading-color,var(--wpds-color-foreground-content-neutral,#1e1e1e));font-size:var(--_gcd-heading-font-size,inherit);font-weight:var(--_gcd-heading-font-weight,var(--wpds-typography-font-weight-emphasis,600));margin:var(--_gcd-heading-margin,0)}._2c0831b0499dbd6e__a,._2c0831b0499dbd6e__a:is(:hover,:focus,:active){border-radius:var(--_gcd-a-border-radius,0);box-shadow:var(--_gcd-a-box-shadow,none);color:var(--_gcd-a-color,inherit);outline:var(--_gcd-a-outline,0 solid transparent);transition:var(--_gcd-a-transition,none)}.c59a0ebebd71fa4a__ol{list-style:var(--_gcd-ol-list-style,none);margin:var(--_gcd-ol-margin,0);padding-block:var(--_gcd-ol-padding-block,0);padding-inline:var(--_gcd-ol-padding-inline,0)}._46b5cb0c8e24e8c9__li{margin:var(--_gcd-li-margin,0)}"); 26750 } 26751 var global_css_defense_default9 = { "button": "_6defc79820e382c6__button", "input": "d2cff2e5dea83bd1__input", "textarea": "_547d86373d02e108__textarea", "div": "_8c15fd0ed9f28ba4__div", "p": "_43cec3e1eec1066d__p", "heading": "e97669c6d9a38497__heading", "a": "_2c0831b0499dbd6e__a", "ol": "c59a0ebebd71fa4a__ol", "li": "_46b5cb0c8e24e8c9__li" }; 26752 var CLASSNAMES = { 26753 root: clsx_default(style_default24.root, resets_default10["box-sizing"]), 26754 day: style_default24.day, 26755 day_button: clsx_default( 26756 style_default24["day-button"], 26757 global_css_defense_default9.button, 26758 focus_module_default3["outset-ring--focus-visible"] 26759 ), 26760 outside: style_default24.outside, 26761 caption_label: style_default24["caption-label"], 26762 button_next: style_default24["nav-button"], 26763 button_previous: style_default24["nav-button"], 26764 nav: style_default24.nav, 26765 month_caption: style_default24["month-caption"], 26766 months: style_default24.months, 26767 month_grid: style_default24["month-grid"], 26768 weekday: style_default24.weekday, 26769 today: style_default24.today, 26770 selected: style_default24.selected, 26771 /* 26772 * Disabled days are styled through `:has(.day-button:disabled)` rather than 26773 * a modifier class on the cell, because the two are not equivalent: the 26774 * focused day keeps its button enabled so it stays reachable. Mapped to 26775 * `undefined` on purpose, so `@daypicker/react` doesn't fall back to its 26776 * own `rdp-disabled` class for a modifier we don't style. 26777 */ 26778 disabled: void 0, 26779 hidden: style_default24.hidden, 26780 range_start: style_default24["range-start"], 26781 range_end: style_default24["range-end"], 26782 range_middle: style_default24["range-middle"], 26783 weeks_before_enter: style_default24["weeks-before-enter"], 26784 weeks_before_exit: style_default24["weeks-before-exit"], 26785 weeks_after_enter: style_default24["weeks-after-enter"], 26786 weeks_after_exit: style_default24["weeks-after-exit"], 26787 caption_after_enter: style_default24["caption-after-enter"], 26788 caption_after_exit: style_default24["caption-after-exit"], 26789 caption_before_enter: style_default24["caption-before-enter"], 26790 caption_before_exit: style_default24["caption-before-exit"] 26791 }; 26792 var MODIFIER_CLASSNAMES = { 26793 preview: style_default24.preview 26794 }; 26795 var COMMON_PROPS = { 26796 animate: true, 26797 // Only show days in the current month 26798 showOutsideDays: false, 26799 // Hide week number column 26800 showWeekNumber: false, 26801 // Show weekdays row 26802 hideWeekdays: false, 26803 // Month and year caption are not interactive 26804 captionLayout: "label", 26805 // Show a variable number of weeks depending on the month 26806 fixedWeeks: false, 26807 // Show navigation buttons 26808 hideNavigation: false, 26809 // Class names 26810 classNames: CLASSNAMES, 26811 components: { 26812 Day: Day2, 26813 Root: Root4, 26814 PreviousMonthButton: PreviousMonthButton2, 26815 NextMonthButton: NextMonthButton2 26816 } 26817 }; 26818 26819 // packages/ui/build-module/calendar/utils/misc.mjs 26820 function clampNumberOfMonths(numberOfMonths) { 26821 return Math.min(3, Math.max(1, numberOfMonths)); 26822 } 26823 26824 // packages/ui/build-module/calendar/utils/use-controlled-value.mjs 26825 var import_element50 = __toESM(require_element(), 1); 26826 function useControlledValue2({ 26827 defaultValue: defaultValue2, 26828 onChange, 26829 value: valueProp 26830 }) { 26831 const hasValue = typeof valueProp !== "undefined"; 26832 const initialValue = hasValue ? valueProp : defaultValue2; 26833 const [state, setState] = (0, import_element50.useState)(initialValue); 26834 const value = hasValue ? valueProp : state; 26835 const uncontrolledSetValue = (0, import_element50.useCallback)( 26836 (nextValue, ...args) => { 26837 setState(nextValue); 26838 onChange?.(nextValue, ...args); 26839 }, 26840 [onChange] 26841 ); 26842 let setValue; 26843 if (hasValue && typeof onChange === "function") { 26844 setValue = onChange; 26845 } else if (!hasValue && typeof onChange === "function") { 26846 setValue = uncontrolledSetValue; 26847 } else { 26848 setValue = setState; 26849 } 26850 return [value, setValue]; 26851 } 26852 26853 // packages/ui/build-module/calendar/utils/use-localization-props.mjs 26854 var import_i18n13 = __toESM(require_i18n(), 1); 26855 var import_element51 = __toESM(require_element(), 1); 26856 function isLocaleRTL(locale) { 26857 const direction = (locale.getTextInfo?.() ?? locale.textInfo)?.direction; 26858 if (direction) { 26859 return direction === "rtl"; 26860 } 26861 return [ 26862 "ar", 26863 // Arabic 26864 "he", 26865 // Hebrew 26866 "fa", 26867 // Persian (Farsi) 26868 "ur", 26869 // Urdu 26870 "ps", 26871 // Pashto 26872 "syr", 26873 // Syriac 26874 "dv", 26875 // Divehi 26876 "ku", 26877 // Kurdish (Sorani) 26878 "ckb", 26879 // Central Kurdish (Sorani) 26880 "ug", 26881 // Uyghur 26882 "yi" 26883 // Yiddish 26884 ].includes(locale.language); 26885 } 26886 function getSupportedLocaleCode(localeCode) { 26887 if (!localeCode) { 26888 return; 26889 } 26890 let supportedLocaleCode; 26891 try { 26892 supportedLocaleCode = Intl.DateTimeFormat.supportedLocalesOf([ 26893 localeCode 26894 ])[0]; 26895 } catch { 26896 } 26897 return supportedLocaleCode; 26898 } 26899 function getWeekStartsOn(locale) { 26900 const firstDay = (locale.getWeekInfo?.() ?? locale.weekInfo)?.firstDay; 26901 if (firstDay === void 0 || firstDay < 1 || firstDay > 7) { 26902 return; 26903 } 26904 return firstDay % 7; 26905 } 26906 var useLocalizationProps = ({ 26907 locale, 26908 timeZone, 26909 mode 26910 }) => { 26911 return (0, import_element51.useMemo)(() => { 26912 const isLocaleString = typeof locale === "string"; 26913 const dateFnsLocale = isLocaleString || locale === void 0 ? enUS : locale; 26914 const supportedLocaleCode = getSupportedLocaleCode( 26915 isLocaleString ? locale : locale?.code 26916 ); 26917 const localeCode = supportedLocaleCode ?? "en-US"; 26918 const intlLocale = new Intl.Locale(localeCode); 26919 const isRightToLeft = supportedLocaleCode !== void 0 ? isLocaleRTL(intlLocale) : (0, import_i18n13.isRTL)(); 26920 const weekStartsOn = isLocaleString || supportedLocaleCode !== void 0 ? getWeekStartsOn(intlLocale) : void 0; 26921 const monthNameFormatter = new Intl.DateTimeFormat(localeCode, { 26922 calendar: "gregory", 26923 year: "numeric", 26924 month: "long", 26925 timeZone 26926 }); 26927 const weekdayNarrowFormatter = new Intl.DateTimeFormat(localeCode, { 26928 calendar: "gregory", 26929 weekday: "narrow", 26930 timeZone 26931 }); 26932 const weekdayLongFormatter = new Intl.DateTimeFormat(localeCode, { 26933 calendar: "gregory", 26934 weekday: "long", 26935 timeZone 26936 }); 26937 const fullDateFormatter = new Intl.DateTimeFormat(localeCode, { 26938 calendar: "gregory", 26939 weekday: "long", 26940 year: "numeric", 26941 month: "long", 26942 day: "numeric", 26943 timeZone 26944 }); 26945 const dayNumberFormatter = new Intl.DateTimeFormat(localeCode, { 26946 calendar: "gregory", 26947 day: "numeric", 26948 timeZone 26949 }); 26950 return { 26951 "aria-label": mode === "single" ? (0, import_i18n13.__)("Date calendar") : (0, import_i18n13.__)("Date range calendar"), 26952 labels: { 26953 /** The label for the navigation toolbar. */ 26954 labelNav: () => (0, import_i18n13.__)("Navigation bar"), 26955 /** 26956 * The label for the month grid. 26957 * @param date 26958 */ 26959 labelGrid: monthNameFormatter.format, 26960 /** 26961 * The label for the gridcell, when the calendar is not interactive. 26962 * @param date 26963 * @param modifiers 26964 */ 26965 labelGridcell: (date, modifiers) => { 26966 const formattedDate = fullDateFormatter.format(date); 26967 let label = formattedDate; 26968 if (modifiers?.today) { 26969 label = (0, import_i18n13.sprintf)( 26970 // translators: %s is the full date (e.g. "Monday, April 29, 2025") 26971 (0, import_i18n13.__)("Today, %s"), 26972 formattedDate 26973 ); 26974 } 26975 return label; 26976 }, 26977 /** The label for the "next month" button. */ 26978 labelNext: () => (0, import_i18n13.__)("Next month"), 26979 /** The label for the "previous month" button. */ 26980 labelPrevious: () => (0, import_i18n13.__)("Previous month"), 26981 /** 26982 * The label for the day button. 26983 * @param date 26984 * @param modifiers 26985 */ 26986 labelDayButton: (date, modifiers) => { 26987 const formattedDate = fullDateFormatter.format(date); 26988 let label = formattedDate; 26989 if (modifiers?.today && modifiers?.selected) { 26990 return (0, import_i18n13.sprintf)( 26991 // translators: %s is the full date (e.g. "Monday, April 29, 2025") 26992 (0, import_i18n13.__)("Today, %s, selected"), 26993 formattedDate 26994 ); 26995 } 26996 if (modifiers?.today) { 26997 label = (0, import_i18n13.sprintf)( 26998 // translators: %s is the full date (e.g. "Monday, April 29, 2025") 26999 (0, import_i18n13.__)("Today, %s"), 27000 formattedDate 27001 ); 27002 } 27003 if (modifiers?.selected) { 27004 label = (0, import_i18n13.sprintf)( 27005 // translators: %s is the full date (e.g. "Monday, April 29, 2025") 27006 (0, import_i18n13.__)("%s, selected"), 27007 formattedDate 27008 ); 27009 } 27010 return label; 27011 }, 27012 /** 27013 * The label for the weekday. 27014 * @param date 27015 */ 27016 labelWeekday: weekdayLongFormatter.format 27017 }, 27018 locale: dateFnsLocale, 27019 lang: localeCode, 27020 dir: isRightToLeft ? "rtl" : "ltr", 27021 ...weekStartsOn === void 0 ? {} : { weekStartsOn }, 27022 formatters: { 27023 formatDay: dayNumberFormatter.format, 27024 formatWeekdayName: weekdayNarrowFormatter.format, 27025 formatCaption: monthNameFormatter.format 27026 }, 27027 timeZone 27028 }; 27029 }, [locale, timeZone, mode]); 27030 }; 27031 27032 // packages/ui/build-module/calendar/utils/use-preserve-day-focus.mjs 27033 var import_compose2 = __toESM(require_compose(), 1); 27034 var import_element52 = __toESM(require_element(), 1); 27035 function usePreserveDayFocus(forwardedRef, month) { 27036 const rootRef = (0, import_element52.useRef)(null); 27037 const hadDayFocusRef = (0, import_element52.useRef)(false); 27038 const mergedRef = (0, import_compose2.useMergeRefs)([rootRef, forwardedRef]); 27039 const monthIndex = month ? month.getFullYear() * 12 + month.getMonth() : void 0; 27040 const onDayFocus = (0, import_element52.useCallback)(() => { 27041 hadDayFocusRef.current = true; 27042 }, []); 27043 const onDayBlur = (0, import_element52.useCallback)(() => { 27044 hadDayFocusRef.current = false; 27045 }, []); 27046 (0, import_element52.useEffect)(() => { 27047 if (!hadDayFocusRef.current) { 27048 return; 27049 } 27050 const root = rootRef.current; 27051 if (!root) { 27052 return; 27053 } 27054 const { activeElement: activeElement2, body } = root.ownerDocument; 27055 if (activeElement2 !== body) { 27056 const grid = activeElement2?.closest('[role="grid"]'); 27057 hadDayFocusRef.current = !!grid && root.contains(grid); 27058 return; 27059 } 27060 hadDayFocusRef.current = false; 27061 const focusTarget = root.querySelector( 27062 '[role="grid"] button[tabindex="0"]:not(:disabled)' 27063 ); 27064 const enabledControl = root.querySelector( 27065 'button:not(:disabled):not([aria-disabled="true"])' 27066 ); 27067 const focusableControl = root.querySelector( 27068 "button:not(:disabled)" 27069 ); 27070 (focusTarget ?? enabledControl ?? focusableControl)?.focus(); 27071 }, [monthIndex]); 27072 return { ref: mergedRef, onDayFocus, onDayBlur }; 27073 } 27074 27075 // packages/ui/build-module/calendar/calendar.mjs 27076 var import_jsx_runtime98 = __toESM(require_jsx_runtime(), 1); 27077 var Calendar = (0, import_element53.forwardRef)( 27078 function Calendar2({ 27079 defaultValue: defaultValue2, 27080 value: valueProp, 27081 onValueChange, 27082 numberOfMonths = 1, 27083 locale, 27084 timeZone, 27085 month, 27086 render: render4, 27087 role = "application", 27088 "aria-label": ariaLabel, 27089 labels: customLabels, 27090 ...props 27091 }, ref) { 27092 const { "aria-label": defaultAriaLabel, ...localizationProps } = useLocalizationProps({ 27093 locale, 27094 timeZone, 27095 mode: "single" 27096 }); 27097 const labels = (0, import_element53.useMemo)( 27098 () => customLabels ? { ...localizationProps.labels, ...customLabels } : localizationProps.labels, 27099 [localizationProps.labels, customLabels] 27100 ); 27101 const onChange = (0, import_element53.useCallback)( 27102 (selected2, triggerDate, modifiers, e) => { 27103 onValueChange?.( 27104 selected2 ?? null, 27105 triggerDate, 27106 modifiers, 27107 e 27108 ); 27109 }, 27110 [onValueChange] 27111 ); 27112 const [selected, setSelected] = useControlledValue2({ 27113 defaultValue: defaultValue2, 27114 value: valueProp, 27115 onChange 27116 }); 27117 const dayFocusProps = usePreserveDayFocus(ref, month); 27118 const rootContextValue = (0, import_element53.useMemo)( 27119 () => ({ 27120 render: render4, 27121 ref: dayFocusProps.ref, 27122 role, 27123 defaultAriaLabel 27124 }), 27125 [render4, dayFocusProps.ref, role, defaultAriaLabel] 27126 ); 27127 return /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(RootContext.Provider, { value: rootContextValue, children: /* @__PURE__ */ (0, import_jsx_runtime98.jsx)( 27128 DayPicker, 27129 { 27130 ...COMMON_PROPS, 27131 ...localizationProps, 27132 ...props, 27133 "aria-label": ariaLabel, 27134 mode: "single", 27135 month, 27136 numberOfMonths: clampNumberOfMonths(numberOfMonths), 27137 labels, 27138 selected: selected ?? void 0, 27139 onSelect: setSelected, 27140 onDayFocus: dayFocusProps.onDayFocus, 27141 onDayBlur: dayFocusProps.onDayBlur 27142 } 27143 ) }); 27144 } 27145 ); 27146 27147 // packages/ui/build-module/calendar/range-calendar.mjs 27148 var import_element54 = __toESM(require_element(), 1); 27149 var import_jsx_runtime99 = __toESM(require_jsx_runtime(), 1); 27150 function usePreviewRange({ 27151 value, 27152 hoveredDate, 27153 excludeDisabled, 27154 resetOnSelect, 27155 min: min3, 27156 max: max3, 27157 disabled: disabled2 27158 }) { 27159 return (0, import_element54.useMemo)(() => { 27160 if (!hoveredDate || !value?.from) { 27161 return; 27162 } 27163 if (resetOnSelect && value.to) { 27164 return { 27165 from: hoveredDate, 27166 to: hoveredDate 27167 }; 27168 } 27169 let previewHighlight; 27170 let potentialNewRange; 27171 if (hoveredDate < value.from) { 27172 previewHighlight = { 27173 from: hoveredDate, 27174 to: value.from 27175 }; 27176 potentialNewRange = { 27177 from: hoveredDate, 27178 to: value.to ?? value.from 27179 }; 27180 } else if (value.to && hoveredDate > value.from && hoveredDate < value.to) { 27181 previewHighlight = { 27182 from: value.from, 27183 to: hoveredDate 27184 }; 27185 potentialNewRange = { 27186 from: value.from, 27187 to: hoveredDate 27188 }; 27189 } else if (hoveredDate > value.from) { 27190 previewHighlight = { 27191 from: value.to ?? value.from, 27192 to: hoveredDate 27193 }; 27194 potentialNewRange = { 27195 from: value.from, 27196 to: hoveredDate 27197 }; 27198 } 27199 if (min3 !== void 0 && min3 > 0 && potentialNewRange && differenceInCalendarDays( 27200 potentialNewRange.to, 27201 potentialNewRange.from 27202 ) < min3) { 27203 previewHighlight = { 27204 from: hoveredDate, 27205 to: hoveredDate 27206 }; 27207 } 27208 if (max3 !== void 0 && max3 > 0 && potentialNewRange && differenceInCalendarDays( 27209 potentialNewRange.to, 27210 potentialNewRange.from 27211 ) > max3) { 27212 previewHighlight = { 27213 from: hoveredDate, 27214 to: hoveredDate 27215 }; 27216 } 27217 if (excludeDisabled && disabled2 && potentialNewRange && rangeContainsModifiers(potentialNewRange, disabled2)) { 27218 previewHighlight = { 27219 from: hoveredDate, 27220 to: hoveredDate 27221 }; 27222 } 27223 return previewHighlight; 27224 }, [ 27225 value, 27226 hoveredDate, 27227 excludeDisabled, 27228 resetOnSelect, 27229 min3, 27230 max3, 27231 disabled2 27232 ]); 27233 } 27234 var RangeCalendar = (0, import_element54.forwardRef)( 27235 function RangeCalendar2({ 27236 defaultValue: defaultValue2, 27237 value: valueProp, 27238 onValueChange, 27239 numberOfMonths = 1, 27240 excludeDisabled, 27241 resetOnSelect = true, 27242 min: min3, 27243 max: max3, 27244 disabled: disabled2, 27245 locale, 27246 timeZone, 27247 month, 27248 render: render4, 27249 role = "application", 27250 "aria-label": ariaLabel, 27251 labels: customLabels, 27252 ...props 27253 }, ref) { 27254 const { "aria-label": defaultAriaLabel, ...localizationProps } = useLocalizationProps({ 27255 locale, 27256 timeZone, 27257 mode: "range" 27258 }); 27259 const labels = (0, import_element54.useMemo)( 27260 () => customLabels ? { ...localizationProps.labels, ...customLabels } : localizationProps.labels, 27261 [localizationProps.labels, customLabels] 27262 ); 27263 const onChange = (0, import_element54.useCallback)( 27264 (selected2, triggerDate, modifiers2, e) => { 27265 onValueChange?.( 27266 selected2 ?? null, 27267 triggerDate, 27268 modifiers2, 27269 e 27270 ); 27271 }, 27272 [onValueChange] 27273 ); 27274 const [selected, setSelected] = useControlledValue2({ 27275 defaultValue: defaultValue2, 27276 value: valueProp, 27277 onChange 27278 }); 27279 const dayFocusProps = usePreserveDayFocus(ref, month); 27280 const [hoveredDate, setHoveredDate] = (0, import_element54.useState)( 27281 void 0 27282 ); 27283 const previewRange = usePreviewRange({ 27284 value: selected, 27285 hoveredDate, 27286 excludeDisabled, 27287 resetOnSelect, 27288 min: min3, 27289 max: max3, 27290 disabled: disabled2 27291 }); 27292 const modifiers = (0, import_element54.useMemo)(() => { 27293 return { 27294 preview: previewRange, 27295 preview_start: previewRange?.from, 27296 preview_end: previewRange?.to 27297 }; 27298 }, [previewRange]); 27299 const rootContextValue = (0, import_element54.useMemo)( 27300 () => ({ 27301 render: render4, 27302 ref: dayFocusProps.ref, 27303 role, 27304 defaultAriaLabel 27305 }), 27306 [render4, dayFocusProps.ref, role, defaultAriaLabel] 27307 ); 27308 return /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(RootContext.Provider, { value: rootContextValue, children: /* @__PURE__ */ (0, import_jsx_runtime99.jsx)( 27309 DayPicker, 27310 { 27311 ...COMMON_PROPS, 27312 ...localizationProps, 27313 ...props, 27314 "aria-label": ariaLabel, 27315 mode: "range", 27316 month, 27317 numberOfMonths: clampNumberOfMonths(numberOfMonths), 27318 disabled: disabled2, 27319 excludeDisabled, 27320 resetOnSelect, 27321 min: min3, 27322 max: max3, 27323 labels, 27324 selected: selected ?? void 0, 27325 onSelect: setSelected, 27326 onDayFocus: dayFocusProps.onDayFocus, 27327 onDayBlur: dayFocusProps.onDayBlur, 27328 onDayMouseEnter: (date) => setHoveredDate(date), 27329 onDayMouseLeave: () => setHoveredDate(void 0), 27330 modifiers, 27331 modifiersClassNames: MODIFIER_CLASSNAMES 27332 } 27333 ) }); 27334 } 27335 ); 27336 27337 // packages/ui/build-module/stack/stack.mjs 27338 var import_element55 = __toESM(require_element(), 1); 27339 var STYLE_HASH_ATTRIBUTE26 = "data-wp-hash"; 27340 function getRuntime26() { 27341 const globalScope = globalThis; 27342 if (globalScope.__wpStyleRuntime) { 27343 return globalScope.__wpStyleRuntime; 27344 } 27345 globalScope.__wpStyleRuntime = { 27346 documents: /* @__PURE__ */ new Map(), 27347 styles: /* @__PURE__ */ new Map(), 27348 injectedStyles: /* @__PURE__ */ new WeakMap() 27349 }; 27350 if (typeof document !== "undefined") { 27351 registerDocument26(document); 27352 } 27353 return globalScope.__wpStyleRuntime; 27354 } 27355 function documentContainsStyleHash26(targetDocument, hash) { 27356 if (!targetDocument.head) { 27357 return false; 27358 } 27359 for (const style of targetDocument.head.querySelectorAll( 27360 `style[$STYLE_HASH_ATTRIBUTE26}]` 27361 )) { 27362 if (style.getAttribute(STYLE_HASH_ATTRIBUTE26) === hash) { 27363 return true; 27364 } 27365 } 27366 return false; 27367 } 27368 function injectStyle26(targetDocument, hash, css) { 27369 if (!targetDocument.head) { 27370 return; 27371 } 27372 const runtime = getRuntime26(); 27373 let injectedStyles = runtime.injectedStyles.get(targetDocument); 27374 if (!injectedStyles) { 27375 injectedStyles = /* @__PURE__ */ new Set(); 27376 runtime.injectedStyles.set(targetDocument, injectedStyles); 27377 } 27378 if (injectedStyles.has(hash)) { 27379 return; 27380 } 27381 if (documentContainsStyleHash26(targetDocument, hash)) { 27382 injectedStyles.add(hash); 27383 return; 27384 } 27385 const style = targetDocument.createElement("style"); 27386 style.setAttribute(STYLE_HASH_ATTRIBUTE26, hash); 27387 style.appendChild(targetDocument.createTextNode(css)); 27388 targetDocument.head.appendChild(style); 27389 injectedStyles.add(hash); 27390 } 27391 function registerDocument26(targetDocument) { 27392 const runtime = getRuntime26(); 27393 runtime.documents.set( 27394 targetDocument, 27395 (runtime.documents.get(targetDocument) ?? 0) + 1 27396 ); 27397 for (const [hash, css] of runtime.styles) { 27398 injectStyle26(targetDocument, hash, css); 27399 } 27400 return () => { 27401 const count = runtime.documents.get(targetDocument); 27402 if (count === void 0) { 27403 return; 27404 } 27405 if (count <= 1) { 27406 runtime.documents.delete(targetDocument); 27407 return; 27408 } 27409 runtime.documents.set(targetDocument, count - 1); 27410 }; 27411 } 27412 function registerStyle26(hash, css) { 27413 const runtime = getRuntime26(); 27414 runtime.styles.set(hash, css); 27415 for (const targetDocument of runtime.documents.keys()) { 27416 injectStyle26(targetDocument, hash, css); 27417 } 27418 } 27419 if (typeof process === "undefined" || true) { 27420 registerStyle26("32aba35fe1", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._19ce0419607e1896__stack{display:flex}}}"); 27421 } 27422 var style_default25 = { "stack": "_19ce0419607e1896__stack" }; 27423 var gapTokens = { 27424 xs: "var(--wpds-dimension-gap-xs, 4px)", 27425 sm: "var(--wpds-dimension-gap-sm, 8px)", 27426 md: "var(--wpds-dimension-gap-md, 12px)", 27427 lg: "var(--wpds-dimension-gap-lg, 16px)", 27428 xl: "var(--wpds-dimension-gap-xl, 24px)", 27429 "2xl": "var(--wpds-dimension-gap-2xl, 32px)", 27430 "3xl": "var(--wpds-dimension-gap-3xl, 40px)" 27431 }; 27432 var Stack = (0, import_element55.forwardRef)(function Stack2({ direction, gap, align, justify, wrap, render: render4, ...props }, ref) { 27433 const style = { 27434 gap: gap && gapTokens[gap], 27435 alignItems: align, 27436 justifyContent: justify, 27437 flexDirection: direction, 27438 flexWrap: wrap 27439 }; 27440 const element = useRender({ 27441 render: render4, 27442 ref, 27443 props: mergeProps(props, { style, className: style_default25.stack }) 27444 }); 27445 return element; 27446 }); 27447 27448 // packages/ui/build-module/form/primitives/input/input.mjs 27449 var import_element58 = __toESM(require_element(), 1); 27450 27451 // packages/ui/build-module/form/primitives/input-layout/input-layout.mjs 27452 var import_element56 = __toESM(require_element(), 1); 27453 var import_jsx_runtime100 = __toESM(require_jsx_runtime(), 1); 27454 var STYLE_HASH_ATTRIBUTE27 = "data-wp-hash"; 27455 function getRuntime27() { 27456 const globalScope = globalThis; 27457 if (globalScope.__wpStyleRuntime) { 27458 return globalScope.__wpStyleRuntime; 27459 } 27460 globalScope.__wpStyleRuntime = { 27461 documents: /* @__PURE__ */ new Map(), 27462 styles: /* @__PURE__ */ new Map(), 27463 injectedStyles: /* @__PURE__ */ new WeakMap() 27464 }; 27465 if (typeof document !== "undefined") { 27466 registerDocument27(document); 27467 } 27468 return globalScope.__wpStyleRuntime; 27469 } 27470 function documentContainsStyleHash27(targetDocument, hash) { 27471 if (!targetDocument.head) { 27472 return false; 27473 } 27474 for (const style of targetDocument.head.querySelectorAll( 27475 `style[$STYLE_HASH_ATTRIBUTE27}]` 27476 )) { 27477 if (style.getAttribute(STYLE_HASH_ATTRIBUTE27) === hash) { 27478 return true; 27479 } 27480 } 27481 return false; 27482 } 27483 function injectStyle27(targetDocument, hash, css) { 27484 if (!targetDocument.head) { 27485 return; 27486 } 27487 const runtime = getRuntime27(); 27488 let injectedStyles = runtime.injectedStyles.get(targetDocument); 27489 if (!injectedStyles) { 27490 injectedStyles = /* @__PURE__ */ new Set(); 27491 runtime.injectedStyles.set(targetDocument, injectedStyles); 27492 } 27493 if (injectedStyles.has(hash)) { 27494 return; 27495 } 27496 if (documentContainsStyleHash27(targetDocument, hash)) { 27497 injectedStyles.add(hash); 27498 return; 27499 } 27500 const style = targetDocument.createElement("style"); 27501 style.setAttribute(STYLE_HASH_ATTRIBUTE27, hash); 27502 style.appendChild(targetDocument.createTextNode(css)); 27503 targetDocument.head.appendChild(style); 27504 injectedStyles.add(hash); 27505 } 27506 function registerDocument27(targetDocument) { 27507 const runtime = getRuntime27(); 27508 runtime.documents.set( 27509 targetDocument, 27510 (runtime.documents.get(targetDocument) ?? 0) + 1 27511 ); 27512 for (const [hash, css] of runtime.styles) { 27513 injectStyle27(targetDocument, hash, css); 27514 } 27515 return () => { 27516 const count = runtime.documents.get(targetDocument); 27517 if (count === void 0) { 27518 return; 27519 } 27520 if (count <= 1) { 27521 runtime.documents.delete(targetDocument); 27522 return; 27523 } 27524 runtime.documents.set(targetDocument, count - 1); 27525 }; 27526 } 27527 function registerStyle27(hash, css) { 27528 const runtime = getRuntime27(); 27529 runtime.styles.set(hash, css); 27530 for (const targetDocument of runtime.documents.keys()) { 27531 injectStyle27(targetDocument, hash, css); 27532 } 27533 } 27534 if (typeof process === "undefined" || true) { 27535 registerStyle27("e8e31009f5", "._6defc79820e382c6__button{box-sizing:var(--_gcd-button-box-sizing,border-box);font-family:var(--_gcd-button-font-family,inherit);font-size:var(--_gcd-button-font-size,inherit);font-weight:var(--_gcd-button-font-weight,inherit)}.d2cff2e5dea83bd1__input{box-sizing:var(--_gcd-input-box-sizing,border-box);font-family:var(--_gcd-input-font-family,inherit);font-size:var(--_gcd-input-font-size,inherit);font-weight:var(--_gcd-input-font-weight,inherit);margin:var(--_gcd-input-margin,0);&::placeholder{color:var(--_gcd-input-placeholder-color,var(--wpds-color-foreground-interactive-neutral-weak,#707070))}&:is(textarea,[type=text],[type=password],[type=color],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){background-color:var(--_gcd-input-background-color,transparent);border:var(--_gcd-input-border,none);border-radius:var(--_gcd-input-border-radius,0);box-shadow:var(--_gcd-input-box-shadow,0 0 0 transparent);color:var(--_gcd-input-color,var(--wpds-color-foreground-interactive-neutral,#1e1e1e));&:focus{border-color:var(--_gcd-input-border-color-focus,var(--wp-admin-theme-color));box-shadow:var(--_gcd-input-box-shadow-focus,none);outline:var(--_gcd-input-outline-focus,none)}&:disabled{background:var(--_gcd-input-background-disabled,transparent);border-color:var(--_gcd-input-border-color-disabled,transparent);box-shadow:var(--_gcd-input-box-shadow-disabled,none);color:var(--_gcd-input-color-disabled,var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d))}}&:is(textarea,[type=text],[type=password],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){line-height:var(--_gcd-input-line-height,inherit);min-height:var(--_gcd-input-min-height,auto);padding:var(--_gcd-input-padding,0)}}._547d86373d02e108__textarea{box-sizing:var(--_gcd-textarea-box-sizing,border-box);overflow:var(--_gcd-textarea-overflow,auto);resize:var(--_gcd-textarea-resize,block)}._8c15fd0ed9f28ba4__div{outline:var(--_gcd-div-outline,0 solid transparent)}p._43cec3e1eec1066d__p{font-size:var(--_gcd-p-font-size,13px);line-height:var(--_gcd-p-line-height,1.5);margin:var(--_gcd-p-margin,0)}:is(h1,h2,h3,h4,h5,h6).e97669c6d9a38497__heading{color:var(--_gcd-heading-color,var(--wpds-color-foreground-content-neutral,#1e1e1e));font-size:var(--_gcd-heading-font-size,inherit);font-weight:var(--_gcd-heading-font-weight,var(--wpds-typography-font-weight-emphasis,600));margin:var(--_gcd-heading-margin,0)}._2c0831b0499dbd6e__a,._2c0831b0499dbd6e__a:is(:hover,:focus,:active){border-radius:var(--_gcd-a-border-radius,0);box-shadow:var(--_gcd-a-box-shadow,none);color:var(--_gcd-a-color,inherit);outline:var(--_gcd-a-outline,0 solid transparent);transition:var(--_gcd-a-transition,none)}.c59a0ebebd71fa4a__ol{list-style:var(--_gcd-ol-list-style,none);margin:var(--_gcd-ol-margin,0);padding-block:var(--_gcd-ol-padding-block,0);padding-inline:var(--_gcd-ol-padding-inline,0)}._46b5cb0c8e24e8c9__li{margin:var(--_gcd-li-margin,0)}"); 27536 } 27537 var global_css_defense_default10 = { "button": "_6defc79820e382c6__button", "input": "d2cff2e5dea83bd1__input", "textarea": "_547d86373d02e108__textarea", "div": "_8c15fd0ed9f28ba4__div", "p": "_43cec3e1eec1066d__p", "heading": "e97669c6d9a38497__heading", "a": "_2c0831b0499dbd6e__a", "ol": "c59a0ebebd71fa4a__ol", "li": "_46b5cb0c8e24e8c9__li" }; 27538 if (typeof process === "undefined" || true) { 27539 registerStyle27("10f3806643", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._336cd3e4e743482f__box-sizing{box-sizing:border-box;*,:after,:before{box-sizing:inherit}}}}"); 27540 } 27541 var resets_default11 = { "box-sizing": "_336cd3e4e743482f__box-sizing" }; 27542 if (typeof process === "undefined" || true) { 27543 registerStyle27("e4f4f9600b", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{.cb2baafdc08746bb__input-layout{--wp-ui-input-layout-padding-inline:var(--wpds-dimension-padding-md,12px);background-color:var(--wpds-color-background-interactive-neutral,var(--wpds-color-background-surface-neutral-strong,#fff));border-color:var(--wpds-color-stroke-interactive-neutral,#8d8d8d);border-radius:var(--wpds-border-radius-sm,2px);border-style:solid;border-width:var(--wpds-border-width-xs,1px);color:var(--wpds-color-foreground-interactive-neutral,#1e1e1e);display:flex;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:max(var(--wpds-typography-font-size-md,13px),16px);height:var(--wpds-dimension-size-lg,40px);line-height:1;@media (min-width:600px){font-size:var(--wpds-typography-font-size-md,13px)}&._0c807a84cbb94e0c__is-size-compact{height:var(--wpds-dimension-size-md,32px)}&._0c807a84cbb94e0c__is-size-compact,&.ed67cda122dc1e7b__is-size-small{--wp-ui-input-layout-padding-inline:var(--wpds-dimension-padding-sm,8px)}&.ed67cda122dc1e7b__is-size-small{height:var(--wpds-dimension-size-sm,24px)}&._6fb7104732387680__is-disabled,&:has([data-can-disable-input-layout][data-disabled]){color:var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d);@media (forced-colors:active){color:GrayText}&:not(._8097270636ca6100__is-borderless){background-color:var(--wpds-color-background-interactive-neutral-disabled,var(--wpds-color-background-surface-neutral-strong,#fff));border-color:var(--wpds-color-stroke-interactive-neutral-disabled,#dbdbdb);@media (forced-colors:active){border-bottom-color:GrayText;border-left-color:GrayText;border-right-color:GrayText;border-top-color:GrayText}}}&._8097270636ca6100__is-borderless{background-color:var(--wpds-color-background-interactive-neutral-weak,#0000);border-color:transparent}&:has(._0d7afad74a057888__input-layout-slot:focus-within){--_gcd-div-outline:none;outline:none}&:hover:not(._6fb7104732387680__is-disabled,:has([data-can-disable-input-layout][data-disabled]),._8097270636ca6100__is-borderless){background-color:var(--wpds-color-background-interactive-neutral-active,var(--wpds-color-background-surface-neutral-strong,#fff));border-color:var(--wpds-color-stroke-interactive-neutral-active,#6e6e6e)}&:has(:invalid[data-validity-visible]){--focus-color:var(--wpds-color-stroke-interactive-error,#cc1818);border-color:var(--wpds-color-stroke-interactive-error,#cc1818);&:hover{border-color:var(--wpds-color-stroke-interactive-error-active,#9d0000)}}}.c192b41a12b4387b__slot-wrapper{display:contents}._0d7afad74a057888__input-layout-slot{align-items:center;display:flex;&._0c952682762ca288__is-padding-minimal{--wp-ui-input-layout-prefix-padding-start:calc(var(--wp-ui-input-layout-padding-inline) - var(--wpds-dimension-padding-xs, 4px));--wp-ui-input-layout-suffix-padding-end:calc(var(--wp-ui-input-layout-padding-inline) - var(--wpds-dimension-padding-xs, 4px))}[data-slot-type=prefix] &{padding-inline-start:var(--wp-ui-input-layout-prefix-padding-start,var(--wp-ui-input-layout-padding-inline))}[data-slot-type=suffix] &{padding-inline-end:var(--wp-ui-input-layout-suffix-padding-end,var(--wp-ui-input-layout-padding-inline))}}}}'); 27544 } 27545 var style_default26 = { "input-layout": "cb2baafdc08746bb__input-layout", "is-size-compact": "_0c807a84cbb94e0c__is-size-compact", "is-size-small": "ed67cda122dc1e7b__is-size-small", "is-disabled": "_6fb7104732387680__is-disabled", "is-borderless": "_8097270636ca6100__is-borderless", "input-layout-slot": "_0d7afad74a057888__input-layout-slot", "slot-wrapper": "c192b41a12b4387b__slot-wrapper", "is-padding-minimal": "_0c952682762ca288__is-padding-minimal" }; 27546 var InputLayout = (0, import_element56.forwardRef)( 27547 function InputLayout2({ 27548 className, 27549 children, 27550 visuallyDisabled, 27551 size: size4 = "default", 27552 isBorderless, 27553 prefix, 27554 suffix, 27555 ...restProps 27556 }, ref) { 27557 return /* @__PURE__ */ (0, import_jsx_runtime100.jsxs)( 27558 "div", 27559 { 27560 ref, 27561 className: clsx_default( 27562 global_css_defense_default10.div, 27563 resets_default11["box-sizing"], 27564 style_default26["input-layout"], 27565 style_default26[`is-size-$size4}`], 27566 visuallyDisabled && style_default26["is-disabled"], 27567 isBorderless && style_default26["is-borderless"], 27568 className 27569 ), 27570 ...restProps, 27571 children: [ 27572 import_element56.Children.count(prefix) > 0 && /* @__PURE__ */ (0, import_jsx_runtime100.jsx)( 27573 "div", 27574 { 27575 className: style_default26["slot-wrapper"], 27576 "data-slot-type": "prefix", 27577 children: prefix 27578 } 27579 ), 27580 children, 27581 import_element56.Children.count(suffix) > 0 && /* @__PURE__ */ (0, import_jsx_runtime100.jsx)( 27582 "div", 27583 { 27584 className: style_default26["slot-wrapper"], 27585 "data-slot-type": "suffix", 27586 children: suffix 27587 } 27588 ) 27589 ] 27590 } 27591 ); 27592 } 27593 ); 27594 27595 // packages/ui/build-module/form/primitives/input-layout/slot.mjs 27596 var import_element57 = __toESM(require_element(), 1); 27597 var import_jsx_runtime101 = __toESM(require_jsx_runtime(), 1); 27598 var STYLE_HASH_ATTRIBUTE28 = "data-wp-hash"; 27599 function getRuntime28() { 27600 const globalScope = globalThis; 27601 if (globalScope.__wpStyleRuntime) { 27602 return globalScope.__wpStyleRuntime; 27603 } 27604 globalScope.__wpStyleRuntime = { 27605 documents: /* @__PURE__ */ new Map(), 27606 styles: /* @__PURE__ */ new Map(), 27607 injectedStyles: /* @__PURE__ */ new WeakMap() 27608 }; 27609 if (typeof document !== "undefined") { 27610 registerDocument28(document); 27611 } 27612 return globalScope.__wpStyleRuntime; 27613 } 27614 function documentContainsStyleHash28(targetDocument, hash) { 27615 if (!targetDocument.head) { 27616 return false; 27617 } 27618 for (const style of targetDocument.head.querySelectorAll( 27619 `style[$STYLE_HASH_ATTRIBUTE28}]` 27620 )) { 27621 if (style.getAttribute(STYLE_HASH_ATTRIBUTE28) === hash) { 27622 return true; 27623 } 27624 } 27625 return false; 27626 } 27627 function injectStyle28(targetDocument, hash, css) { 27628 if (!targetDocument.head) { 27629 return; 27630 } 27631 const runtime = getRuntime28(); 27632 let injectedStyles = runtime.injectedStyles.get(targetDocument); 27633 if (!injectedStyles) { 27634 injectedStyles = /* @__PURE__ */ new Set(); 27635 runtime.injectedStyles.set(targetDocument, injectedStyles); 27636 } 27637 if (injectedStyles.has(hash)) { 27638 return; 27639 } 27640 if (documentContainsStyleHash28(targetDocument, hash)) { 27641 injectedStyles.add(hash); 27642 return; 27643 } 27644 const style = targetDocument.createElement("style"); 27645 style.setAttribute(STYLE_HASH_ATTRIBUTE28, hash); 27646 style.appendChild(targetDocument.createTextNode(css)); 27647 targetDocument.head.appendChild(style); 27648 injectedStyles.add(hash); 27649 } 27650 function registerDocument28(targetDocument) { 27651 const runtime = getRuntime28(); 27652 runtime.documents.set( 27653 targetDocument, 27654 (runtime.documents.get(targetDocument) ?? 0) + 1 27655 ); 27656 for (const [hash, css] of runtime.styles) { 27657 injectStyle28(targetDocument, hash, css); 27658 } 27659 return () => { 27660 const count = runtime.documents.get(targetDocument); 27661 if (count === void 0) { 27662 return; 27663 } 27664 if (count <= 1) { 27665 runtime.documents.delete(targetDocument); 27666 return; 27667 } 27668 runtime.documents.set(targetDocument, count - 1); 27669 }; 27670 } 27671 function registerStyle28(hash, css) { 27672 const runtime = getRuntime28(); 27673 runtime.styles.set(hash, css); 27674 for (const targetDocument of runtime.documents.keys()) { 27675 injectStyle28(targetDocument, hash, css); 27676 } 27677 } 27678 if (typeof process === "undefined" || true) { 27679 registerStyle28("e4f4f9600b", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{.cb2baafdc08746bb__input-layout{--wp-ui-input-layout-padding-inline:var(--wpds-dimension-padding-md,12px);background-color:var(--wpds-color-background-interactive-neutral,var(--wpds-color-background-surface-neutral-strong,#fff));border-color:var(--wpds-color-stroke-interactive-neutral,#8d8d8d);border-radius:var(--wpds-border-radius-sm,2px);border-style:solid;border-width:var(--wpds-border-width-xs,1px);color:var(--wpds-color-foreground-interactive-neutral,#1e1e1e);display:flex;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:max(var(--wpds-typography-font-size-md,13px),16px);height:var(--wpds-dimension-size-lg,40px);line-height:1;@media (min-width:600px){font-size:var(--wpds-typography-font-size-md,13px)}&._0c807a84cbb94e0c__is-size-compact{height:var(--wpds-dimension-size-md,32px)}&._0c807a84cbb94e0c__is-size-compact,&.ed67cda122dc1e7b__is-size-small{--wp-ui-input-layout-padding-inline:var(--wpds-dimension-padding-sm,8px)}&.ed67cda122dc1e7b__is-size-small{height:var(--wpds-dimension-size-sm,24px)}&._6fb7104732387680__is-disabled,&:has([data-can-disable-input-layout][data-disabled]){color:var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d);@media (forced-colors:active){color:GrayText}&:not(._8097270636ca6100__is-borderless){background-color:var(--wpds-color-background-interactive-neutral-disabled,var(--wpds-color-background-surface-neutral-strong,#fff));border-color:var(--wpds-color-stroke-interactive-neutral-disabled,#dbdbdb);@media (forced-colors:active){border-bottom-color:GrayText;border-left-color:GrayText;border-right-color:GrayText;border-top-color:GrayText}}}&._8097270636ca6100__is-borderless{background-color:var(--wpds-color-background-interactive-neutral-weak,#0000);border-color:transparent}&:has(._0d7afad74a057888__input-layout-slot:focus-within){--_gcd-div-outline:none;outline:none}&:hover:not(._6fb7104732387680__is-disabled,:has([data-can-disable-input-layout][data-disabled]),._8097270636ca6100__is-borderless){background-color:var(--wpds-color-background-interactive-neutral-active,var(--wpds-color-background-surface-neutral-strong,#fff));border-color:var(--wpds-color-stroke-interactive-neutral-active,#6e6e6e)}&:has(:invalid[data-validity-visible]){--focus-color:var(--wpds-color-stroke-interactive-error,#cc1818);border-color:var(--wpds-color-stroke-interactive-error,#cc1818);&:hover{border-color:var(--wpds-color-stroke-interactive-error-active,#9d0000)}}}.c192b41a12b4387b__slot-wrapper{display:contents}._0d7afad74a057888__input-layout-slot{align-items:center;display:flex;&._0c952682762ca288__is-padding-minimal{--wp-ui-input-layout-prefix-padding-start:calc(var(--wp-ui-input-layout-padding-inline) - var(--wpds-dimension-padding-xs, 4px));--wp-ui-input-layout-suffix-padding-end:calc(var(--wp-ui-input-layout-padding-inline) - var(--wpds-dimension-padding-xs, 4px))}[data-slot-type=prefix] &{padding-inline-start:var(--wp-ui-input-layout-prefix-padding-start,var(--wp-ui-input-layout-padding-inline))}[data-slot-type=suffix] &{padding-inline-end:var(--wp-ui-input-layout-suffix-padding-end,var(--wp-ui-input-layout-padding-inline))}}}}'); 27680 } 27681 var style_default27 = { "input-layout": "cb2baafdc08746bb__input-layout", "is-size-compact": "_0c807a84cbb94e0c__is-size-compact", "is-size-small": "ed67cda122dc1e7b__is-size-small", "is-disabled": "_6fb7104732387680__is-disabled", "is-borderless": "_8097270636ca6100__is-borderless", "input-layout-slot": "_0d7afad74a057888__input-layout-slot", "slot-wrapper": "c192b41a12b4387b__slot-wrapper", "is-padding-minimal": "_0c952682762ca288__is-padding-minimal" }; 27682 var InputLayoutSlot = (0, import_element57.forwardRef)(function InputLayoutSlot2({ padding = "default", className, ...restProps }, ref) { 27683 return /* @__PURE__ */ (0, import_jsx_runtime101.jsx)( 27684 "div", 27685 { 27686 ref, 27687 className: clsx_default( 27688 style_default27["input-layout-slot"], 27689 style_default27[`is-padding-$padding}`], 27690 className 27691 ), 27692 ...restProps 27693 } 27694 ); 27695 }); 27696 InputLayoutSlot.displayName = "InputLayout.Slot"; 27697 27698 // packages/ui/build-module/form/primitives/input-layout/index.mjs 27699 var InputLayout3 = Object.assign(InputLayout, { 27700 Slot: InputLayoutSlot 27701 }); 27702 27703 // packages/ui/build-module/form/primitives/input/input.mjs 27704 var import_jsx_runtime102 = __toESM(require_jsx_runtime(), 1); 27705 var STYLE_HASH_ATTRIBUTE29 = "data-wp-hash"; 27706 function getRuntime29() { 27707 const globalScope = globalThis; 27708 if (globalScope.__wpStyleRuntime) { 27709 return globalScope.__wpStyleRuntime; 27710 } 27711 globalScope.__wpStyleRuntime = { 27712 documents: /* @__PURE__ */ new Map(), 27713 styles: /* @__PURE__ */ new Map(), 27714 injectedStyles: /* @__PURE__ */ new WeakMap() 27715 }; 27716 if (typeof document !== "undefined") { 27717 registerDocument29(document); 27718 } 27719 return globalScope.__wpStyleRuntime; 27720 } 27721 function documentContainsStyleHash29(targetDocument, hash) { 27722 if (!targetDocument.head) { 27723 return false; 27724 } 27725 for (const style of targetDocument.head.querySelectorAll( 27726 `style[$STYLE_HASH_ATTRIBUTE29}]` 27727 )) { 27728 if (style.getAttribute(STYLE_HASH_ATTRIBUTE29) === hash) { 27729 return true; 27730 } 27731 } 27732 return false; 27733 } 27734 function injectStyle29(targetDocument, hash, css) { 27735 if (!targetDocument.head) { 27736 return; 27737 } 27738 const runtime = getRuntime29(); 27739 let injectedStyles = runtime.injectedStyles.get(targetDocument); 27740 if (!injectedStyles) { 27741 injectedStyles = /* @__PURE__ */ new Set(); 27742 runtime.injectedStyles.set(targetDocument, injectedStyles); 27743 } 27744 if (injectedStyles.has(hash)) { 27745 return; 27746 } 27747 if (documentContainsStyleHash29(targetDocument, hash)) { 27748 injectedStyles.add(hash); 27749 return; 27750 } 27751 const style = targetDocument.createElement("style"); 27752 style.setAttribute(STYLE_HASH_ATTRIBUTE29, hash); 27753 style.appendChild(targetDocument.createTextNode(css)); 27754 targetDocument.head.appendChild(style); 27755 injectedStyles.add(hash); 27756 } 27757 function registerDocument29(targetDocument) { 27758 const runtime = getRuntime29(); 27759 runtime.documents.set( 27760 targetDocument, 27761 (runtime.documents.get(targetDocument) ?? 0) + 1 27762 ); 27763 for (const [hash, css] of runtime.styles) { 27764 injectStyle29(targetDocument, hash, css); 27765 } 27766 return () => { 27767 const count = runtime.documents.get(targetDocument); 27768 if (count === void 0) { 27769 return; 27770 } 27771 if (count <= 1) { 27772 runtime.documents.delete(targetDocument); 27773 return; 27774 } 27775 runtime.documents.set(targetDocument, count - 1); 27776 }; 27777 } 27778 function registerStyle29(hash, css) { 27779 const runtime = getRuntime29(); 27780 runtime.styles.set(hash, css); 27781 for (const targetDocument of runtime.documents.keys()) { 27782 injectStyle29(targetDocument, hash, css); 27783 } 27784 } 27785 if (typeof process === "undefined" || true) { 27786 registerStyle29("e8e31009f5", "._6defc79820e382c6__button{box-sizing:var(--_gcd-button-box-sizing,border-box);font-family:var(--_gcd-button-font-family,inherit);font-size:var(--_gcd-button-font-size,inherit);font-weight:var(--_gcd-button-font-weight,inherit)}.d2cff2e5dea83bd1__input{box-sizing:var(--_gcd-input-box-sizing,border-box);font-family:var(--_gcd-input-font-family,inherit);font-size:var(--_gcd-input-font-size,inherit);font-weight:var(--_gcd-input-font-weight,inherit);margin:var(--_gcd-input-margin,0);&::placeholder{color:var(--_gcd-input-placeholder-color,var(--wpds-color-foreground-interactive-neutral-weak,#707070))}&:is(textarea,[type=text],[type=password],[type=color],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){background-color:var(--_gcd-input-background-color,transparent);border:var(--_gcd-input-border,none);border-radius:var(--_gcd-input-border-radius,0);box-shadow:var(--_gcd-input-box-shadow,0 0 0 transparent);color:var(--_gcd-input-color,var(--wpds-color-foreground-interactive-neutral,#1e1e1e));&:focus{border-color:var(--_gcd-input-border-color-focus,var(--wp-admin-theme-color));box-shadow:var(--_gcd-input-box-shadow-focus,none);outline:var(--_gcd-input-outline-focus,none)}&:disabled{background:var(--_gcd-input-background-disabled,transparent);border-color:var(--_gcd-input-border-color-disabled,transparent);box-shadow:var(--_gcd-input-box-shadow-disabled,none);color:var(--_gcd-input-color-disabled,var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d))}}&:is(textarea,[type=text],[type=password],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){line-height:var(--_gcd-input-line-height,inherit);min-height:var(--_gcd-input-min-height,auto);padding:var(--_gcd-input-padding,0)}}._547d86373d02e108__textarea{box-sizing:var(--_gcd-textarea-box-sizing,border-box);overflow:var(--_gcd-textarea-overflow,auto);resize:var(--_gcd-textarea-resize,block)}._8c15fd0ed9f28ba4__div{outline:var(--_gcd-div-outline,0 solid transparent)}p._43cec3e1eec1066d__p{font-size:var(--_gcd-p-font-size,13px);line-height:var(--_gcd-p-line-height,1.5);margin:var(--_gcd-p-margin,0)}:is(h1,h2,h3,h4,h5,h6).e97669c6d9a38497__heading{color:var(--_gcd-heading-color,var(--wpds-color-foreground-content-neutral,#1e1e1e));font-size:var(--_gcd-heading-font-size,inherit);font-weight:var(--_gcd-heading-font-weight,var(--wpds-typography-font-weight-emphasis,600));margin:var(--_gcd-heading-margin,0)}._2c0831b0499dbd6e__a,._2c0831b0499dbd6e__a:is(:hover,:focus,:active){border-radius:var(--_gcd-a-border-radius,0);box-shadow:var(--_gcd-a-box-shadow,none);color:var(--_gcd-a-color,inherit);outline:var(--_gcd-a-outline,0 solid transparent);transition:var(--_gcd-a-transition,none)}.c59a0ebebd71fa4a__ol{list-style:var(--_gcd-ol-list-style,none);margin:var(--_gcd-ol-margin,0);padding-block:var(--_gcd-ol-padding-block,0);padding-inline:var(--_gcd-ol-padding-inline,0)}._46b5cb0c8e24e8c9__li{margin:var(--_gcd-li-margin,0)}"); 27787 } 27788 var global_css_defense_default11 = { "button": "_6defc79820e382c6__button", "input": "d2cff2e5dea83bd1__input", "textarea": "_547d86373d02e108__textarea", "div": "_8c15fd0ed9f28ba4__div", "p": "_43cec3e1eec1066d__p", "heading": "e97669c6d9a38497__heading", "a": "_2c0831b0499dbd6e__a", "ol": "c59a0ebebd71fa4a__ol", "li": "_46b5cb0c8e24e8c9__li" }; 27789 if (typeof process === "undefined" || true) { 27790 registerStyle29("08122b3d53", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{.af79fb116edb0dd7__outset-ring--focus:focus,.dfcfdc28396e5d98__outset-ring--focus-visible:focus-visible,.e5cd9ee879f6403a__outset-ring--focus-within:focus-within,:focus-visible ._81935a08e952f267__outset-ring--focus-parent-visible{--_gcd-a-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));--_gcd-div-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));outline-offset:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px))}._3c9f5ee9fc9c136d__outset-ring--focus-within-except-active:focus-within,.abc777e9713fa711__outset-ring--focus-except-active:focus{outline:none}._3c9f5ee9fc9c136d__outset-ring--focus-within-except-active:focus-within:not(:has(:active)),.abc777e9713fa711__outset-ring--focus-except-active:focus:not(:active){--_gcd-a-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));--_gcd-div-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));outline-offset:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px))}}}"); 27791 } 27792 var focus_module_default4 = { "outset-ring--focus": "af79fb116edb0dd7__outset-ring--focus", "outset-ring--focus-visible": "dfcfdc28396e5d98__outset-ring--focus-visible", "outset-ring--focus-within": "e5cd9ee879f6403a__outset-ring--focus-within", "outset-ring--focus-parent-visible": "_81935a08e952f267__outset-ring--focus-parent-visible", "outset-ring--focus-except-active": "abc777e9713fa711__outset-ring--focus-except-active", "outset-ring--focus-within-except-active": "_3c9f5ee9fc9c136d__outset-ring--focus-within-except-active" }; 27793 if (typeof process === "undefined" || true) { 27794 registerStyle29("1a25f6a232", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._2ae7be2fc1bb17a3__input{--_gcd-input-padding:var(--wp-ui-input-padding-block,0px) var(--wp-ui-input-layout-padding-inline,0px);background:transparent;border:none;color:var(--wpds-color-foreground-interactive-neutral,#1e1e1e);font-family:inherit;font-size:inherit;line-height:inherit;outline:none;padding-block:var(--wp-ui-input-padding-block,0);padding-inline:var(--wp-ui-input-layout-padding-inline,0);width:100%;&::placeholder{color:var(--wpds-color-foreground-interactive-neutral-weak,#707070)}&:disabled,&[aria-disabled=true]{--_gcd-input-placeholder-color:var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d);color:var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d);&::placeholder{color:var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d)}@media (forced-colors:active){color:GrayText}}&[type=email],&[type=url]{direction:ltr}&[type=number]{appearance:textfield;&::-webkit-inner-spin-button,&::-webkit-outer-spin-button{appearance:none;margin:0}}}}}"); 27795 } 27796 var style_default28 = { "input": "_2ae7be2fc1bb17a3__input" }; 27797 var Input3 = (0, import_element58.forwardRef)(function Input22({ className, size: size4 = "default", prefix, suffix, style, ...restProps }, ref) { 27798 return /* @__PURE__ */ (0, import_jsx_runtime102.jsx)( 27799 InputLayout3, 27800 { 27801 className: clsx_default( 27802 focus_module_default4["outset-ring--focus-within"], 27803 className 27804 ), 27805 style, 27806 size: size4, 27807 visuallyDisabled: restProps.disabled, 27808 prefix, 27809 suffix, 27810 children: /* @__PURE__ */ (0, import_jsx_runtime102.jsx)( 27811 Input, 27812 { 27813 ref, 27814 className: clsx_default(global_css_defense_default11.input, style_default28.input), 27815 ...restProps 27816 } 27817 ) 27818 } 27819 ); 27820 }); 27821 27822 // packages/ui/build-module/form/primitives/control-with-error/control-with-error.mjs 27823 var import_i18n14 = __toESM(require_i18n(), 1); 27824 var import_element60 = __toESM(require_element(), 1); 27825 27826 // packages/ui/build-module/spinner/spinner.mjs 27827 var import_element59 = __toESM(require_element(), 1); 27828 var import_jsx_runtime103 = __toESM(require_jsx_runtime(), 1); 27829 var STYLE_HASH_ATTRIBUTE30 = "data-wp-hash"; 27830 function getRuntime30() { 27831 const globalScope = globalThis; 27832 if (globalScope.__wpStyleRuntime) { 27833 return globalScope.__wpStyleRuntime; 27834 } 27835 globalScope.__wpStyleRuntime = { 27836 documents: /* @__PURE__ */ new Map(), 27837 styles: /* @__PURE__ */ new Map(), 27838 injectedStyles: /* @__PURE__ */ new WeakMap() 27839 }; 27840 if (typeof document !== "undefined") { 27841 registerDocument30(document); 27842 } 27843 return globalScope.__wpStyleRuntime; 27844 } 27845 function documentContainsStyleHash30(targetDocument, hash) { 27846 if (!targetDocument.head) { 27847 return false; 27848 } 27849 for (const style of targetDocument.head.querySelectorAll( 27850 `style[$STYLE_HASH_ATTRIBUTE30}]` 27851 )) { 27852 if (style.getAttribute(STYLE_HASH_ATTRIBUTE30) === hash) { 27853 return true; 27854 } 27855 } 27856 return false; 27857 } 27858 function injectStyle30(targetDocument, hash, css) { 27859 if (!targetDocument.head) { 27860 return; 27861 } 27862 const runtime = getRuntime30(); 27863 let injectedStyles = runtime.injectedStyles.get(targetDocument); 27864 if (!injectedStyles) { 27865 injectedStyles = /* @__PURE__ */ new Set(); 27866 runtime.injectedStyles.set(targetDocument, injectedStyles); 27867 } 27868 if (injectedStyles.has(hash)) { 27869 return; 27870 } 27871 if (documentContainsStyleHash30(targetDocument, hash)) { 27872 injectedStyles.add(hash); 27873 return; 27874 } 27875 const style = targetDocument.createElement("style"); 27876 style.setAttribute(STYLE_HASH_ATTRIBUTE30, hash); 27877 style.appendChild(targetDocument.createTextNode(css)); 27878 targetDocument.head.appendChild(style); 27879 injectedStyles.add(hash); 27880 } 27881 function registerDocument30(targetDocument) { 27882 const runtime = getRuntime30(); 27883 runtime.documents.set( 27884 targetDocument, 27885 (runtime.documents.get(targetDocument) ?? 0) + 1 27886 ); 27887 for (const [hash, css] of runtime.styles) { 27888 injectStyle30(targetDocument, hash, css); 27889 } 27890 return () => { 27891 const count = runtime.documents.get(targetDocument); 27892 if (count === void 0) { 27893 return; 27894 } 27895 if (count <= 1) { 27896 runtime.documents.delete(targetDocument); 27897 return; 27898 } 27899 runtime.documents.set(targetDocument, count - 1); 27900 }; 27901 } 27902 function registerStyle30(hash, css) { 27903 const runtime = getRuntime30(); 27904 runtime.styles.set(hash, css); 27905 for (const targetDocument of runtime.documents.keys()) { 27906 injectStyle30(targetDocument, hash, css); 27907 } 27908 } 27909 if (typeof process === "undefined" || true) { 27910 registerStyle30("bbbecfe373", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{.ab4d64c07c0ba587__spinner{background-color:transparent;display:inline-block;height:var(--wpds-dimension-size-2xs,16px);opacity:1;overflow:visible;position:relative;width:var(--wpds-dimension-size-2xs,16px)}.a7654e10245bb7d2__indicator,.dc51f80c84b35fe2__track{fill:transparent;stroke-width:1.5px}.dc51f80c84b35fe2__track{stroke:var(--wpds-color-background-track-neutral,#dbdbdb)}.a7654e10245bb7d2__indicator{stroke:var(--wpds-color-background-thumb-brand,var(--wp-admin-theme-color,#3858e9));stroke-linecap:round;animation:_02322d973909703c__spinner-spin 1.4s linear infinite both;transform-origin:50% 50%}@keyframes _02322d973909703c__spinner-spin{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}}}"); 27911 } 27912 var style_default29 = { "spinner": "ab4d64c07c0ba587__spinner", "track": "dc51f80c84b35fe2__track", "indicator": "a7654e10245bb7d2__indicator", "spinner-spin": "_02322d973909703c__spinner-spin" }; 27913 var Spinner = (0, import_element59.forwardRef)( 27914 function Spinner2({ className, ...props }, ref) { 27915 return /* @__PURE__ */ (0, import_jsx_runtime103.jsxs)( 27916 "svg", 27917 { 27918 className: clsx_default(style_default29.spinner, className), 27919 viewBox: "0 0 100 100", 27920 xmlns: "http://www.w3.org/2000/svg", 27921 role: "presentation", 27922 focusable: "false", 27923 ...props, 27924 ref, 27925 children: [ 27926 /* @__PURE__ */ (0, import_jsx_runtime103.jsx)( 27927 "circle", 27928 { 27929 className: style_default29.track, 27930 cx: "50", 27931 cy: "50", 27932 r: "50", 27933 vectorEffect: "non-scaling-stroke" 27934 } 27935 ), 27936 /* @__PURE__ */ (0, import_jsx_runtime103.jsx)( 27937 "path", 27938 { 27939 className: style_default29.indicator, 27940 d: "m 50 0 a 50 50 0 0 1 50 50", 27941 vectorEffect: "non-scaling-stroke" 27942 } 27943 ) 27944 ] 27945 } 27946 ); 27947 } 27948 ); 27949 27950 // packages/ui/build-module/form/primitives/validity-indicator/validity-indicator.mjs 27951 var import_jsx_runtime104 = __toESM(require_jsx_runtime(), 1); 27952 var STYLE_HASH_ATTRIBUTE31 = "data-wp-hash"; 27953 function getRuntime31() { 27954 const globalScope = globalThis; 27955 if (globalScope.__wpStyleRuntime) { 27956 return globalScope.__wpStyleRuntime; 27957 } 27958 globalScope.__wpStyleRuntime = { 27959 documents: /* @__PURE__ */ new Map(), 27960 styles: /* @__PURE__ */ new Map(), 27961 injectedStyles: /* @__PURE__ */ new WeakMap() 27962 }; 27963 if (typeof document !== "undefined") { 27964 registerDocument31(document); 27965 } 27966 return globalScope.__wpStyleRuntime; 27967 } 27968 function documentContainsStyleHash31(targetDocument, hash) { 27969 if (!targetDocument.head) { 27970 return false; 27971 } 27972 for (const style of targetDocument.head.querySelectorAll( 27973 `style[$STYLE_HASH_ATTRIBUTE31}]` 27974 )) { 27975 if (style.getAttribute(STYLE_HASH_ATTRIBUTE31) === hash) { 27976 return true; 27977 } 27978 } 27979 return false; 27980 } 27981 function injectStyle31(targetDocument, hash, css) { 27982 if (!targetDocument.head) { 27983 return; 27984 } 27985 const runtime = getRuntime31(); 27986 let injectedStyles = runtime.injectedStyles.get(targetDocument); 27987 if (!injectedStyles) { 27988 injectedStyles = /* @__PURE__ */ new Set(); 27989 runtime.injectedStyles.set(targetDocument, injectedStyles); 27990 } 27991 if (injectedStyles.has(hash)) { 27992 return; 27993 } 27994 if (documentContainsStyleHash31(targetDocument, hash)) { 27995 injectedStyles.add(hash); 27996 return; 27997 } 27998 const style = targetDocument.createElement("style"); 27999 style.setAttribute(STYLE_HASH_ATTRIBUTE31, hash); 28000 style.appendChild(targetDocument.createTextNode(css)); 28001 targetDocument.head.appendChild(style); 28002 injectedStyles.add(hash); 28003 } 28004 function registerDocument31(targetDocument) { 28005 const runtime = getRuntime31(); 28006 runtime.documents.set( 28007 targetDocument, 28008 (runtime.documents.get(targetDocument) ?? 0) + 1 28009 ); 28010 for (const [hash, css] of runtime.styles) { 28011 injectStyle31(targetDocument, hash, css); 28012 } 28013 return () => { 28014 const count = runtime.documents.get(targetDocument); 28015 if (count === void 0) { 28016 return; 28017 } 28018 if (count <= 1) { 28019 runtime.documents.delete(targetDocument); 28020 return; 28021 } 28022 runtime.documents.set(targetDocument, count - 1); 28023 }; 28024 } 28025 function registerStyle31(hash, css) { 28026 const runtime = getRuntime31(); 28027 runtime.styles.set(hash, css); 28028 for (const targetDocument of runtime.documents.keys()) { 28029 injectStyle31(targetDocument, hash, css); 28030 } 28031 } 28032 if (typeof process === "undefined" || true) { 28033 registerStyle31("e8e31009f5", "._6defc79820e382c6__button{box-sizing:var(--_gcd-button-box-sizing,border-box);font-family:var(--_gcd-button-font-family,inherit);font-size:var(--_gcd-button-font-size,inherit);font-weight:var(--_gcd-button-font-weight,inherit)}.d2cff2e5dea83bd1__input{box-sizing:var(--_gcd-input-box-sizing,border-box);font-family:var(--_gcd-input-font-family,inherit);font-size:var(--_gcd-input-font-size,inherit);font-weight:var(--_gcd-input-font-weight,inherit);margin:var(--_gcd-input-margin,0);&::placeholder{color:var(--_gcd-input-placeholder-color,var(--wpds-color-foreground-interactive-neutral-weak,#707070))}&:is(textarea,[type=text],[type=password],[type=color],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){background-color:var(--_gcd-input-background-color,transparent);border:var(--_gcd-input-border,none);border-radius:var(--_gcd-input-border-radius,0);box-shadow:var(--_gcd-input-box-shadow,0 0 0 transparent);color:var(--_gcd-input-color,var(--wpds-color-foreground-interactive-neutral,#1e1e1e));&:focus{border-color:var(--_gcd-input-border-color-focus,var(--wp-admin-theme-color));box-shadow:var(--_gcd-input-box-shadow-focus,none);outline:var(--_gcd-input-outline-focus,none)}&:disabled{background:var(--_gcd-input-background-disabled,transparent);border-color:var(--_gcd-input-border-color-disabled,transparent);box-shadow:var(--_gcd-input-box-shadow-disabled,none);color:var(--_gcd-input-color-disabled,var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d))}}&:is(textarea,[type=text],[type=password],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){line-height:var(--_gcd-input-line-height,inherit);min-height:var(--_gcd-input-min-height,auto);padding:var(--_gcd-input-padding,0)}}._547d86373d02e108__textarea{box-sizing:var(--_gcd-textarea-box-sizing,border-box);overflow:var(--_gcd-textarea-overflow,auto);resize:var(--_gcd-textarea-resize,block)}._8c15fd0ed9f28ba4__div{outline:var(--_gcd-div-outline,0 solid transparent)}p._43cec3e1eec1066d__p{font-size:var(--_gcd-p-font-size,13px);line-height:var(--_gcd-p-line-height,1.5);margin:var(--_gcd-p-margin,0)}:is(h1,h2,h3,h4,h5,h6).e97669c6d9a38497__heading{color:var(--_gcd-heading-color,var(--wpds-color-foreground-content-neutral,#1e1e1e));font-size:var(--_gcd-heading-font-size,inherit);font-weight:var(--_gcd-heading-font-weight,var(--wpds-typography-font-weight-emphasis,600));margin:var(--_gcd-heading-margin,0)}._2c0831b0499dbd6e__a,._2c0831b0499dbd6e__a:is(:hover,:focus,:active){border-radius:var(--_gcd-a-border-radius,0);box-shadow:var(--_gcd-a-box-shadow,none);color:var(--_gcd-a-color,inherit);outline:var(--_gcd-a-outline,0 solid transparent);transition:var(--_gcd-a-transition,none)}.c59a0ebebd71fa4a__ol{list-style:var(--_gcd-ol-list-style,none);margin:var(--_gcd-ol-margin,0);padding-block:var(--_gcd-ol-padding-block,0);padding-inline:var(--_gcd-ol-padding-inline,0)}._46b5cb0c8e24e8c9__li{margin:var(--_gcd-li-margin,0)}"); 28034 } 28035 var global_css_defense_default12 = { "button": "_6defc79820e382c6__button", "input": "d2cff2e5dea83bd1__input", "textarea": "_547d86373d02e108__textarea", "div": "_8c15fd0ed9f28ba4__div", "p": "_43cec3e1eec1066d__p", "heading": "e97669c6d9a38497__heading", "a": "_2c0831b0499dbd6e__a", "ol": "c59a0ebebd71fa4a__ol", "li": "_46b5cb0c8e24e8c9__li" }; 28036 if (typeof process === "undefined" || true) { 28037 registerStyle31("d11816833c", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._7a7ac88e306348e7__indicator{--_gcd-p-font-size:var(--wpds-typography-font-size-sm,12px);--_gcd-p-line-height:var(--wpds-typography-line-height-xs,16px);align-items:flex-start;color:var(--wpds-color-foreground-content-neutral-weak,#707070);display:flex;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);gap:var(--wpds-dimension-gap-xs,4px);line-height:var(--wpds-typography-line-height-xs,16px);@media not (prefers-reduced-motion){animation:_48722cc5dd090ce4__indicator-jump var(--wpds-motion-duration-md,.2s) cubic-bezier(.68,-.55,.27,1.55)}}._57a3bbbfbe38a5c6__is-invalid{color:var(--wpds-color-foreground-content-error-weak,#cc1818)}._9e944dc198aac10b__is-valid{color:var(--wpds-color-foreground-content-success-weak,#008030)}.e482806667437c6a__indicator-icon{flex-shrink:0}._6e46434cc23019d2__indicator-spinner{height:var(--wpds-dimension-size-3xs,12px);margin:2px;width:var(--wpds-dimension-size-3xs,12px)}@keyframes _48722cc5dd090ce4__indicator-jump{0%{opacity:0;transform:translateY(-4px)}to{opacity:1;transform:translateY(0)}}}}'); 28038 } 28039 var style_default30 = { "indicator": "_7a7ac88e306348e7__indicator", "indicator-jump": "_48722cc5dd090ce4__indicator-jump", "is-invalid": "_57a3bbbfbe38a5c6__is-invalid", "is-valid": "_9e944dc198aac10b__is-valid", "indicator-icon": "e482806667437c6a__indicator-icon", "indicator-spinner": "_6e46434cc23019d2__indicator-spinner" }; 28040 var ICON = { 28041 valid: published_default, 28042 invalid: error_default 28043 }; 28044 function ValidityIndicator({ 28045 id, 28046 type, 28047 message: message2 28048 }) { 28049 return /* @__PURE__ */ (0, import_jsx_runtime104.jsxs)( 28050 "p", 28051 { 28052 id, 28053 className: clsx_default( 28054 global_css_defense_default12.p, 28055 style_default30.indicator, 28056 style_default30[`is-$type}`] 28057 ), 28058 children: [ 28059 type === "validating" ? /* @__PURE__ */ (0, import_jsx_runtime104.jsx)(Spinner, { className: style_default30["indicator-spinner"] }) : /* @__PURE__ */ (0, import_jsx_runtime104.jsx)( 28060 Icon, 28061 { 28062 className: style_default30["indicator-icon"], 28063 icon: ICON[type], 28064 size: 16, 28065 fill: "currentColor" 28066 } 28067 ), 28068 message2 28069 ] 28070 } 28071 ); 28072 } 28073 28074 // packages/ui/build-module/form/primitives/control-with-error/control-with-error.mjs 28075 var import_jsx_runtime105 = __toESM(require_jsx_runtime(), 1); 28076 var DEFAULT_RENDER = (props) => /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(Stack, { ...props, direction: "column", gap: "sm" }); 28077 function appendRequiredIndicator(label, required, markWhenOptional) { 28078 let suffix; 28079 if (required && !markWhenOptional) { 28080 suffix = `(${(0, import_i18n14.__)("Required")})`; 28081 } else if (!required && markWhenOptional) { 28082 suffix = `(${(0, import_i18n14.__)("Optional")})`; 28083 } 28084 if (!suffix) { 28085 return label; 28086 } 28087 if (typeof label === "string") { 28088 return `$label} $suffix}`; 28089 } 28090 return /* @__PURE__ */ (0, import_jsx_runtime105.jsxs)(import_jsx_runtime105.Fragment, { children: [ 28091 label, 28092 " ", 28093 suffix 28094 ] }); 28095 } 28096 var VALIDITY_VISIBLE_ATTRIBUTE = "data-validity-visible"; 28097 var ControlWithError = (0, import_element60.forwardRef)(function ControlWithError2({ 28098 required, 28099 markWhenOptional, 28100 customValidity, 28101 getValidityTarget, 28102 children, 28103 render: render4 = DEFAULT_RENDER, 28104 ...restProps 28105 }, forwardedRef) { 28106 const [errorMessage, setErrorMessage] = (0, import_element60.useState)(); 28107 const [statusMessage, setStatusMessage] = (0, import_element60.useState)(); 28108 const [showMessage, setShowMessage] = (0, import_element60.useState)(false); 28109 const [isTouched, setIsTouched] = (0, import_element60.useState)(false); 28110 const wrapperRef = (0, import_element60.useRef)(null); 28111 (0, import_element60.useEffect)(() => { 28112 const validityTarget = getValidityTarget(); 28113 const handler = () => { 28114 if (customValidity?.type !== "validating") { 28115 setErrorMessage(validityTarget?.validationMessage); 28116 } 28117 setShowMessage(true); 28118 validityTarget?.setAttribute(VALIDITY_VISIBLE_ATTRIBUTE, ""); 28119 }; 28120 validityTarget?.addEventListener("invalid", handler); 28121 return () => validityTarget?.removeEventListener("invalid", handler); 28122 }, [customValidity?.type, getValidityTarget]); 28123 (0, import_element60.useEffect)(() => { 28124 const validityTarget = getValidityTarget(); 28125 const suppressNativePopover = (event) => { 28126 event.preventDefault(); 28127 if (!event.isTrusted) { 28128 return; 28129 } 28130 const target = event.target; 28131 const firstErrorInForm = Array.from( 28132 target.form?.elements ?? [] 28133 ).find((el) => !el.validity.valid); 28134 if (!target.form || firstErrorInForm === target) { 28135 target.focus(); 28136 } 28137 }; 28138 const radioSiblings = validityTarget?.type === "radio" && validityTarget?.name ? Array.from( 28139 wrapperRef.current?.querySelectorAll( 28140 `input[type="radio"][name="$validityTarget?.name}"]` 28141 ) ?? [] 28142 ).filter((sibling) => sibling !== validityTarget) : []; 28143 validityTarget?.addEventListener("invalid", suppressNativePopover); 28144 radioSiblings.forEach( 28145 (sibling) => sibling.addEventListener("invalid", suppressNativePopover) 28146 ); 28147 return () => { 28148 validityTarget?.removeEventListener( 28149 "invalid", 28150 suppressNativePopover 28151 ); 28152 radioSiblings.forEach( 28153 (sibling) => sibling.removeEventListener("invalid", suppressNativePopover) 28154 ); 28155 }; 28156 }, [getValidityTarget]); 28157 (0, import_element60.useEffect)(() => { 28158 const validityTarget = getValidityTarget(); 28159 if (!customValidity?.type) { 28160 validityTarget?.setCustomValidity(""); 28161 setErrorMessage(validityTarget?.validationMessage); 28162 setStatusMessage(void 0); 28163 return; 28164 } 28165 switch (customValidity.type) { 28166 case "validating": { 28167 validityTarget?.setCustomValidity(""); 28168 setErrorMessage(void 0); 28169 setStatusMessage({ 28170 type: "validating", 28171 message: customValidity.message 28172 }); 28173 break; 28174 } 28175 case "valid": { 28176 validityTarget?.setCustomValidity(""); 28177 setErrorMessage(validityTarget?.validationMessage); 28178 setStatusMessage({ 28179 type: "valid", 28180 message: customValidity.message 28181 }); 28182 break; 28183 } 28184 case "invalid": { 28185 validityTarget?.setCustomValidity( 28186 customValidity.message ?? "" 28187 ); 28188 setErrorMessage(validityTarget?.validationMessage); 28189 setStatusMessage(void 0); 28190 break; 28191 } 28192 } 28193 }, [customValidity, getValidityTarget]); 28194 (0, import_element60.useEffect)(() => { 28195 if (!isTouched || showMessage) { 28196 return; 28197 } 28198 if (customValidity?.type === "validating") { 28199 const timer = setTimeout(() => { 28200 setShowMessage(true); 28201 }, 1e3); 28202 return () => clearTimeout(timer); 28203 } 28204 setShowMessage(true); 28205 }, [isTouched, customValidity?.type, showMessage]); 28206 const onBlur = (event) => { 28207 if (event.relatedTarget && event.currentTarget.contains(event.relatedTarget)) { 28208 return; 28209 } 28210 if (!isTouched) { 28211 setIsTouched(true); 28212 getValidityTarget()?.setAttribute(VALIDITY_VISIBLE_ATTRIBUTE, ""); 28213 } 28214 const validityTarget = getValidityTarget(); 28215 const isValidating = customValidity?.type === "validating"; 28216 window.queueMicrotask(() => { 28217 if (!isValidating) { 28218 setErrorMessage(validityTarget?.validationMessage); 28219 } 28220 }); 28221 }; 28222 const messageId = (0, import_element60.useId)(); 28223 const message2 = (() => { 28224 if (errorMessage) { 28225 return /* @__PURE__ */ (0, import_jsx_runtime105.jsx)( 28226 ValidityIndicator, 28227 { 28228 id: messageId, 28229 type: "invalid", 28230 message: errorMessage 28231 } 28232 ); 28233 } 28234 if (statusMessage?.type) { 28235 return /* @__PURE__ */ (0, import_jsx_runtime105.jsx)( 28236 ValidityIndicator, 28237 { 28238 id: messageId, 28239 type: statusMessage.type, 28240 message: statusMessage.message 28241 } 28242 ); 28243 } 28244 return null; 28245 })(); 28246 const visibleMessage = showMessage ? message2 : null; 28247 (0, import_element60.useEffect)(() => { 28248 const target = getValidityTarget(); 28249 if (!target) { 28250 return; 28251 } 28252 function setDescribedBy(el, shouldAdd) { 28253 const ids = (el.getAttribute("aria-describedby") ?? "").split(" ").filter((id) => id && id !== messageId); 28254 if (shouldAdd) { 28255 ids.push(messageId); 28256 } 28257 if (ids.length) { 28258 el.setAttribute("aria-describedby", ids.join(" ")); 28259 } else { 28260 el.removeAttribute("aria-describedby"); 28261 } 28262 } 28263 setDescribedBy(target, !!visibleMessage); 28264 return () => setDescribedBy(target, false); 28265 }, [visibleMessage, messageId, getValidityTarget]); 28266 return useRender({ 28267 render: render4, 28268 ref: [forwardedRef, wrapperRef], 28269 props: mergeProps(restProps, { 28270 onBlur, 28271 children: /* @__PURE__ */ (0, import_jsx_runtime105.jsxs)(import_jsx_runtime105.Fragment, { children: [ 28272 (0, import_element60.cloneElement)(children, { 28273 label: appendRequiredIndicator( 28274 children.props.label, 28275 required, 28276 markWhenOptional 28277 ), 28278 required 28279 }), 28280 visibleMessage 28281 ] }) 28282 }) 28283 }); 28284 }); 28285 28286 // packages/ui/build-module/form/primitives/field/index.mjs 28287 var field_exports = {}; 28288 __export(field_exports, { 28289 Control: () => Control, 28290 Description: () => Description, 28291 Details: () => Details, 28292 Item: () => Item2, 28293 Label: () => Label, 28294 Root: () => Root5, 28295 VisualLabel: () => VisualLabel 28296 }); 28297 28298 // packages/ui/build-module/form/primitives/field/root.mjs 28299 var import_element61 = __toESM(require_element(), 1); 28300 var import_jsx_runtime106 = __toESM(require_jsx_runtime(), 1); 28301 var STYLE_HASH_ATTRIBUTE32 = "data-wp-hash"; 28302 function getRuntime32() { 28303 const globalScope = globalThis; 28304 if (globalScope.__wpStyleRuntime) { 28305 return globalScope.__wpStyleRuntime; 28306 } 28307 globalScope.__wpStyleRuntime = { 28308 documents: /* @__PURE__ */ new Map(), 28309 styles: /* @__PURE__ */ new Map(), 28310 injectedStyles: /* @__PURE__ */ new WeakMap() 28311 }; 28312 if (typeof document !== "undefined") { 28313 registerDocument32(document); 28314 } 28315 return globalScope.__wpStyleRuntime; 28316 } 28317 function documentContainsStyleHash32(targetDocument, hash) { 28318 if (!targetDocument.head) { 28319 return false; 28320 } 28321 for (const style of targetDocument.head.querySelectorAll( 28322 `style[$STYLE_HASH_ATTRIBUTE32}]` 28323 )) { 28324 if (style.getAttribute(STYLE_HASH_ATTRIBUTE32) === hash) { 28325 return true; 28326 } 28327 } 28328 return false; 28329 } 28330 function injectStyle32(targetDocument, hash, css) { 28331 if (!targetDocument.head) { 28332 return; 28333 } 28334 const runtime = getRuntime32(); 28335 let injectedStyles = runtime.injectedStyles.get(targetDocument); 28336 if (!injectedStyles) { 28337 injectedStyles = /* @__PURE__ */ new Set(); 28338 runtime.injectedStyles.set(targetDocument, injectedStyles); 28339 } 28340 if (injectedStyles.has(hash)) { 28341 return; 28342 } 28343 if (documentContainsStyleHash32(targetDocument, hash)) { 28344 injectedStyles.add(hash); 28345 return; 28346 } 28347 const style = targetDocument.createElement("style"); 28348 style.setAttribute(STYLE_HASH_ATTRIBUTE32, hash); 28349 style.appendChild(targetDocument.createTextNode(css)); 28350 targetDocument.head.appendChild(style); 28351 injectedStyles.add(hash); 28352 } 28353 function registerDocument32(targetDocument) { 28354 const runtime = getRuntime32(); 28355 runtime.documents.set( 28356 targetDocument, 28357 (runtime.documents.get(targetDocument) ?? 0) + 1 28358 ); 28359 for (const [hash, css] of runtime.styles) { 28360 injectStyle32(targetDocument, hash, css); 28361 } 28362 return () => { 28363 const count = runtime.documents.get(targetDocument); 28364 if (count === void 0) { 28365 return; 28366 } 28367 if (count <= 1) { 28368 runtime.documents.delete(targetDocument); 28369 return; 28370 } 28371 runtime.documents.set(targetDocument, count - 1); 28372 }; 28373 } 28374 function registerStyle32(hash, css) { 28375 const runtime = getRuntime32(); 28376 runtime.styles.set(hash, css); 28377 for (const targetDocument of runtime.documents.keys()) { 28378 injectStyle32(targetDocument, hash, css); 28379 } 28380 } 28381 if (typeof process === "undefined" || true) { 28382 registerStyle32("10f3806643", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._336cd3e4e743482f__box-sizing{box-sizing:border-box;*,:after,:before{box-sizing:inherit}}}}"); 28383 } 28384 var resets_default12 = { "box-sizing": "_336cd3e4e743482f__box-sizing" }; 28385 var DEFAULT_RENDER2 = (props) => /* @__PURE__ */ (0, import_jsx_runtime106.jsx)(Stack, { ...props, direction: "column", gap: "sm" }); 28386 var Root5 = (0, import_element61.forwardRef)(function Root22({ className, render: render4 = DEFAULT_RENDER2, ...restProps }, ref) { 28387 return /* @__PURE__ */ (0, import_jsx_runtime106.jsx)( 28388 index_parts_exports2.Root, 28389 { 28390 ref, 28391 className: clsx_default(resets_default12["box-sizing"], className), 28392 render: render4, 28393 ...restProps 28394 } 28395 ); 28396 }); 28397 28398 // packages/ui/build-module/form/primitives/field/item.mjs 28399 var import_element62 = __toESM(require_element(), 1); 28400 var import_jsx_runtime107 = __toESM(require_jsx_runtime(), 1); 28401 var Item2 = (0, import_element62.forwardRef)(function Item22(props, ref) { 28402 return /* @__PURE__ */ (0, import_jsx_runtime107.jsx)(index_parts_exports2.Item, { ref, ...props }); 28403 }); 28404 28405 // packages/ui/build-module/form/primitives/field/label.mjs 28406 var import_element63 = __toESM(require_element(), 1); 28407 var import_jsx_runtime108 = __toESM(require_jsx_runtime(), 1); 28408 var STYLE_HASH_ATTRIBUTE33 = "data-wp-hash"; 28409 function getRuntime33() { 28410 const globalScope = globalThis; 28411 if (globalScope.__wpStyleRuntime) { 28412 return globalScope.__wpStyleRuntime; 28413 } 28414 globalScope.__wpStyleRuntime = { 28415 documents: /* @__PURE__ */ new Map(), 28416 styles: /* @__PURE__ */ new Map(), 28417 injectedStyles: /* @__PURE__ */ new WeakMap() 28418 }; 28419 if (typeof document !== "undefined") { 28420 registerDocument33(document); 28421 } 28422 return globalScope.__wpStyleRuntime; 28423 } 28424 function documentContainsStyleHash33(targetDocument, hash) { 28425 if (!targetDocument.head) { 28426 return false; 28427 } 28428 for (const style of targetDocument.head.querySelectorAll( 28429 `style[$STYLE_HASH_ATTRIBUTE33}]` 28430 )) { 28431 if (style.getAttribute(STYLE_HASH_ATTRIBUTE33) === hash) { 28432 return true; 28433 } 28434 } 28435 return false; 28436 } 28437 function injectStyle33(targetDocument, hash, css) { 28438 if (!targetDocument.head) { 28439 return; 28440 } 28441 const runtime = getRuntime33(); 28442 let injectedStyles = runtime.injectedStyles.get(targetDocument); 28443 if (!injectedStyles) { 28444 injectedStyles = /* @__PURE__ */ new Set(); 28445 runtime.injectedStyles.set(targetDocument, injectedStyles); 28446 } 28447 if (injectedStyles.has(hash)) { 28448 return; 28449 } 28450 if (documentContainsStyleHash33(targetDocument, hash)) { 28451 injectedStyles.add(hash); 28452 return; 28453 } 28454 const style = targetDocument.createElement("style"); 28455 style.setAttribute(STYLE_HASH_ATTRIBUTE33, hash); 28456 style.appendChild(targetDocument.createTextNode(css)); 28457 targetDocument.head.appendChild(style); 28458 injectedStyles.add(hash); 28459 } 28460 function registerDocument33(targetDocument) { 28461 const runtime = getRuntime33(); 28462 runtime.documents.set( 28463 targetDocument, 28464 (runtime.documents.get(targetDocument) ?? 0) + 1 28465 ); 28466 for (const [hash, css] of runtime.styles) { 28467 injectStyle33(targetDocument, hash, css); 28468 } 28469 return () => { 28470 const count = runtime.documents.get(targetDocument); 28471 if (count === void 0) { 28472 return; 28473 } 28474 if (count <= 1) { 28475 runtime.documents.delete(targetDocument); 28476 return; 28477 } 28478 runtime.documents.set(targetDocument, count - 1); 28479 }; 28480 } 28481 function registerStyle33(hash, css) { 28482 const runtime = getRuntime33(); 28483 runtime.styles.set(hash, css); 28484 for (const targetDocument of runtime.documents.keys()) { 28485 injectStyle33(targetDocument, hash, css); 28486 } 28487 } 28488 if (typeof process === "undefined" || true) { 28489 registerStyle33("df33c48b2d", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._2d5ad850b2f90964__label{--wp-ui-field-label-line-height:var(--wpds-typography-line-height-xs,16px);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-xs,11px);font-weight:var(--wpds-typography-font-weight-emphasis,600);line-height:var(--wp-ui-field-label-line-height);text-transform:uppercase;&._17c4214649230bea__is-plain{font-size:var(--wpds-typography-font-size-md,13px);font-weight:var(--wpds-typography-font-weight-default,400);text-transform:none}}._08a3750500e0233f__description{--_gcd-p-font-size:var(--wpds-typography-font-size-sm,12px);--_gcd-p-line-height:var(--wpds-typography-line-height-xs,16px);--_gcd-p-margin:0;text-wrap:pretty;color:var(--wpds-color-foreground-content-neutral-weak,#707070);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:var(--wpds-typography-line-height-xs,16px)}}}'); 28490 } 28491 var field_default = { "label": "_2d5ad850b2f90964__label", "is-plain": "_17c4214649230bea__is-plain", "description": "_08a3750500e0233f__description" }; 28492 var Label = (0, import_element63.forwardRef)( 28493 function Label2({ className, hideFromVision, variant, ...restProps }, ref) { 28494 const label = /* @__PURE__ */ (0, import_jsx_runtime108.jsx)( 28495 index_parts_exports2.Label, 28496 { 28497 ref, 28498 className: clsx_default( 28499 field_default.label, 28500 variant && field_default[`is-$variant}`], 28501 className 28502 ), 28503 ...restProps 28504 } 28505 ); 28506 if (hideFromVision) { 28507 return /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(VisuallyHidden, { render: label }); 28508 } 28509 return label; 28510 } 28511 ); 28512 28513 // packages/ui/build-module/form/primitives/field/description.mjs 28514 var import_element64 = __toESM(require_element(), 1); 28515 var import_jsx_runtime109 = __toESM(require_jsx_runtime(), 1); 28516 var STYLE_HASH_ATTRIBUTE34 = "data-wp-hash"; 28517 function getRuntime34() { 28518 const globalScope = globalThis; 28519 if (globalScope.__wpStyleRuntime) { 28520 return globalScope.__wpStyleRuntime; 28521 } 28522 globalScope.__wpStyleRuntime = { 28523 documents: /* @__PURE__ */ new Map(), 28524 styles: /* @__PURE__ */ new Map(), 28525 injectedStyles: /* @__PURE__ */ new WeakMap() 28526 }; 28527 if (typeof document !== "undefined") { 28528 registerDocument34(document); 28529 } 28530 return globalScope.__wpStyleRuntime; 28531 } 28532 function documentContainsStyleHash34(targetDocument, hash) { 28533 if (!targetDocument.head) { 28534 return false; 28535 } 28536 for (const style of targetDocument.head.querySelectorAll( 28537 `style[$STYLE_HASH_ATTRIBUTE34}]` 28538 )) { 28539 if (style.getAttribute(STYLE_HASH_ATTRIBUTE34) === hash) { 28540 return true; 28541 } 28542 } 28543 return false; 28544 } 28545 function injectStyle34(targetDocument, hash, css) { 28546 if (!targetDocument.head) { 28547 return; 28548 } 28549 const runtime = getRuntime34(); 28550 let injectedStyles = runtime.injectedStyles.get(targetDocument); 28551 if (!injectedStyles) { 28552 injectedStyles = /* @__PURE__ */ new Set(); 28553 runtime.injectedStyles.set(targetDocument, injectedStyles); 28554 } 28555 if (injectedStyles.has(hash)) { 28556 return; 28557 } 28558 if (documentContainsStyleHash34(targetDocument, hash)) { 28559 injectedStyles.add(hash); 28560 return; 28561 } 28562 const style = targetDocument.createElement("style"); 28563 style.setAttribute(STYLE_HASH_ATTRIBUTE34, hash); 28564 style.appendChild(targetDocument.createTextNode(css)); 28565 targetDocument.head.appendChild(style); 28566 injectedStyles.add(hash); 28567 } 28568 function registerDocument34(targetDocument) { 28569 const runtime = getRuntime34(); 28570 runtime.documents.set( 28571 targetDocument, 28572 (runtime.documents.get(targetDocument) ?? 0) + 1 28573 ); 28574 for (const [hash, css] of runtime.styles) { 28575 injectStyle34(targetDocument, hash, css); 28576 } 28577 return () => { 28578 const count = runtime.documents.get(targetDocument); 28579 if (count === void 0) { 28580 return; 28581 } 28582 if (count <= 1) { 28583 runtime.documents.delete(targetDocument); 28584 return; 28585 } 28586 runtime.documents.set(targetDocument, count - 1); 28587 }; 28588 } 28589 function registerStyle34(hash, css) { 28590 const runtime = getRuntime34(); 28591 runtime.styles.set(hash, css); 28592 for (const targetDocument of runtime.documents.keys()) { 28593 injectStyle34(targetDocument, hash, css); 28594 } 28595 } 28596 if (typeof process === "undefined" || true) { 28597 registerStyle34("e8e31009f5", "._6defc79820e382c6__button{box-sizing:var(--_gcd-button-box-sizing,border-box);font-family:var(--_gcd-button-font-family,inherit);font-size:var(--_gcd-button-font-size,inherit);font-weight:var(--_gcd-button-font-weight,inherit)}.d2cff2e5dea83bd1__input{box-sizing:var(--_gcd-input-box-sizing,border-box);font-family:var(--_gcd-input-font-family,inherit);font-size:var(--_gcd-input-font-size,inherit);font-weight:var(--_gcd-input-font-weight,inherit);margin:var(--_gcd-input-margin,0);&::placeholder{color:var(--_gcd-input-placeholder-color,var(--wpds-color-foreground-interactive-neutral-weak,#707070))}&:is(textarea,[type=text],[type=password],[type=color],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){background-color:var(--_gcd-input-background-color,transparent);border:var(--_gcd-input-border,none);border-radius:var(--_gcd-input-border-radius,0);box-shadow:var(--_gcd-input-box-shadow,0 0 0 transparent);color:var(--_gcd-input-color,var(--wpds-color-foreground-interactive-neutral,#1e1e1e));&:focus{border-color:var(--_gcd-input-border-color-focus,var(--wp-admin-theme-color));box-shadow:var(--_gcd-input-box-shadow-focus,none);outline:var(--_gcd-input-outline-focus,none)}&:disabled{background:var(--_gcd-input-background-disabled,transparent);border-color:var(--_gcd-input-border-color-disabled,transparent);box-shadow:var(--_gcd-input-box-shadow-disabled,none);color:var(--_gcd-input-color-disabled,var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d))}}&:is(textarea,[type=text],[type=password],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){line-height:var(--_gcd-input-line-height,inherit);min-height:var(--_gcd-input-min-height,auto);padding:var(--_gcd-input-padding,0)}}._547d86373d02e108__textarea{box-sizing:var(--_gcd-textarea-box-sizing,border-box);overflow:var(--_gcd-textarea-overflow,auto);resize:var(--_gcd-textarea-resize,block)}._8c15fd0ed9f28ba4__div{outline:var(--_gcd-div-outline,0 solid transparent)}p._43cec3e1eec1066d__p{font-size:var(--_gcd-p-font-size,13px);line-height:var(--_gcd-p-line-height,1.5);margin:var(--_gcd-p-margin,0)}:is(h1,h2,h3,h4,h5,h6).e97669c6d9a38497__heading{color:var(--_gcd-heading-color,var(--wpds-color-foreground-content-neutral,#1e1e1e));font-size:var(--_gcd-heading-font-size,inherit);font-weight:var(--_gcd-heading-font-weight,var(--wpds-typography-font-weight-emphasis,600));margin:var(--_gcd-heading-margin,0)}._2c0831b0499dbd6e__a,._2c0831b0499dbd6e__a:is(:hover,:focus,:active){border-radius:var(--_gcd-a-border-radius,0);box-shadow:var(--_gcd-a-box-shadow,none);color:var(--_gcd-a-color,inherit);outline:var(--_gcd-a-outline,0 solid transparent);transition:var(--_gcd-a-transition,none)}.c59a0ebebd71fa4a__ol{list-style:var(--_gcd-ol-list-style,none);margin:var(--_gcd-ol-margin,0);padding-block:var(--_gcd-ol-padding-block,0);padding-inline:var(--_gcd-ol-padding-inline,0)}._46b5cb0c8e24e8c9__li{margin:var(--_gcd-li-margin,0)}"); 28598 } 28599 var global_css_defense_default13 = { "button": "_6defc79820e382c6__button", "input": "d2cff2e5dea83bd1__input", "textarea": "_547d86373d02e108__textarea", "div": "_8c15fd0ed9f28ba4__div", "p": "_43cec3e1eec1066d__p", "heading": "e97669c6d9a38497__heading", "a": "_2c0831b0499dbd6e__a", "ol": "c59a0ebebd71fa4a__ol", "li": "_46b5cb0c8e24e8c9__li" }; 28600 if (typeof process === "undefined" || true) { 28601 registerStyle34("df33c48b2d", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._2d5ad850b2f90964__label{--wp-ui-field-label-line-height:var(--wpds-typography-line-height-xs,16px);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-xs,11px);font-weight:var(--wpds-typography-font-weight-emphasis,600);line-height:var(--wp-ui-field-label-line-height);text-transform:uppercase;&._17c4214649230bea__is-plain{font-size:var(--wpds-typography-font-size-md,13px);font-weight:var(--wpds-typography-font-weight-default,400);text-transform:none}}._08a3750500e0233f__description{--_gcd-p-font-size:var(--wpds-typography-font-size-sm,12px);--_gcd-p-line-height:var(--wpds-typography-line-height-xs,16px);--_gcd-p-margin:0;text-wrap:pretty;color:var(--wpds-color-foreground-content-neutral-weak,#707070);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:var(--wpds-typography-line-height-xs,16px)}}}'); 28602 } 28603 var field_default2 = { "label": "_2d5ad850b2f90964__label", "is-plain": "_17c4214649230bea__is-plain", "description": "_08a3750500e0233f__description" }; 28604 var Description = (0, import_element64.forwardRef)(function Description2({ className, ...restProps }, ref) { 28605 return /* @__PURE__ */ (0, import_jsx_runtime109.jsx)( 28606 index_parts_exports2.Description, 28607 { 28608 ref, 28609 className: clsx_default( 28610 global_css_defense_default13.p, 28611 field_default2.description, 28612 className 28613 ), 28614 ...restProps 28615 } 28616 ); 28617 }); 28618 28619 // packages/ui/build-module/form/primitives/field/details.mjs 28620 var import_element65 = __toESM(require_element(), 1); 28621 var import_i18n15 = __toESM(require_i18n(), 1); 28622 var import_jsx_runtime110 = __toESM(require_jsx_runtime(), 1); 28623 var STYLE_HASH_ATTRIBUTE35 = "data-wp-hash"; 28624 function getRuntime35() { 28625 const globalScope = globalThis; 28626 if (globalScope.__wpStyleRuntime) { 28627 return globalScope.__wpStyleRuntime; 28628 } 28629 globalScope.__wpStyleRuntime = { 28630 documents: /* @__PURE__ */ new Map(), 28631 styles: /* @__PURE__ */ new Map(), 28632 injectedStyles: /* @__PURE__ */ new WeakMap() 28633 }; 28634 if (typeof document !== "undefined") { 28635 registerDocument35(document); 28636 } 28637 return globalScope.__wpStyleRuntime; 28638 } 28639 function documentContainsStyleHash35(targetDocument, hash) { 28640 if (!targetDocument.head) { 28641 return false; 28642 } 28643 for (const style of targetDocument.head.querySelectorAll( 28644 `style[$STYLE_HASH_ATTRIBUTE35}]` 28645 )) { 28646 if (style.getAttribute(STYLE_HASH_ATTRIBUTE35) === hash) { 28647 return true; 28648 } 28649 } 28650 return false; 28651 } 28652 function injectStyle35(targetDocument, hash, css) { 28653 if (!targetDocument.head) { 28654 return; 28655 } 28656 const runtime = getRuntime35(); 28657 let injectedStyles = runtime.injectedStyles.get(targetDocument); 28658 if (!injectedStyles) { 28659 injectedStyles = /* @__PURE__ */ new Set(); 28660 runtime.injectedStyles.set(targetDocument, injectedStyles); 28661 } 28662 if (injectedStyles.has(hash)) { 28663 return; 28664 } 28665 if (documentContainsStyleHash35(targetDocument, hash)) { 28666 injectedStyles.add(hash); 28667 return; 28668 } 28669 const style = targetDocument.createElement("style"); 28670 style.setAttribute(STYLE_HASH_ATTRIBUTE35, hash); 28671 style.appendChild(targetDocument.createTextNode(css)); 28672 targetDocument.head.appendChild(style); 28673 injectedStyles.add(hash); 28674 } 28675 function registerDocument35(targetDocument) { 28676 const runtime = getRuntime35(); 28677 runtime.documents.set( 28678 targetDocument, 28679 (runtime.documents.get(targetDocument) ?? 0) + 1 28680 ); 28681 for (const [hash, css] of runtime.styles) { 28682 injectStyle35(targetDocument, hash, css); 28683 } 28684 return () => { 28685 const count = runtime.documents.get(targetDocument); 28686 if (count === void 0) { 28687 return; 28688 } 28689 if (count <= 1) { 28690 runtime.documents.delete(targetDocument); 28691 return; 28692 } 28693 runtime.documents.set(targetDocument, count - 1); 28694 }; 28695 } 28696 function registerStyle35(hash, css) { 28697 const runtime = getRuntime35(); 28698 runtime.styles.set(hash, css); 28699 for (const targetDocument of runtime.documents.keys()) { 28700 injectStyle35(targetDocument, hash, css); 28701 } 28702 } 28703 if (typeof process === "undefined" || true) { 28704 registerStyle35("df33c48b2d", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._2d5ad850b2f90964__label{--wp-ui-field-label-line-height:var(--wpds-typography-line-height-xs,16px);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-xs,11px);font-weight:var(--wpds-typography-font-weight-emphasis,600);line-height:var(--wp-ui-field-label-line-height);text-transform:uppercase;&._17c4214649230bea__is-plain{font-size:var(--wpds-typography-font-size-md,13px);font-weight:var(--wpds-typography-font-weight-default,400);text-transform:none}}._08a3750500e0233f__description{--_gcd-p-font-size:var(--wpds-typography-font-size-sm,12px);--_gcd-p-line-height:var(--wpds-typography-line-height-xs,16px);--_gcd-p-margin:0;text-wrap:pretty;color:var(--wpds-color-foreground-content-neutral-weak,#707070);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:var(--wpds-typography-line-height-xs,16px)}}}'); 28705 } 28706 var field_default3 = { "label": "_2d5ad850b2f90964__label", "is-plain": "_17c4214649230bea__is-plain", "description": "_08a3750500e0233f__description" }; 28707 var Details = (0, import_element65.forwardRef)( 28708 function Details2({ className, ...restProps }, ref) { 28709 return /* @__PURE__ */ (0, import_jsx_runtime110.jsxs)(import_jsx_runtime110.Fragment, { children: [ 28710 /* @__PURE__ */ (0, import_jsx_runtime110.jsx)(VisuallyHidden, { render: /* @__PURE__ */ (0, import_jsx_runtime110.jsx)(index_parts_exports2.Description, {}), children: (0, import_i18n15.__)("More details follow the field.") }), 28711 /* @__PURE__ */ (0, import_jsx_runtime110.jsx)( 28712 "div", 28713 { 28714 ref, 28715 className: clsx_default(field_default3.description, className), 28716 ...restProps 28717 } 28718 ) 28719 ] }); 28720 } 28721 ); 28722 28723 // packages/ui/build-module/form/primitives/field/control.mjs 28724 var import_element66 = __toESM(require_element(), 1); 28725 var import_jsx_runtime111 = __toESM(require_jsx_runtime(), 1); 28726 var Control = (0, import_element66.forwardRef)( 28727 function Control2(props, ref) { 28728 return /* @__PURE__ */ (0, import_jsx_runtime111.jsx)(index_parts_exports2.Control, { ref, ...props }); 28729 } 28730 ); 28731 28732 // packages/ui/build-module/form/primitives/field/visual-label.mjs 28733 var import_element67 = __toESM(require_element(), 1); 28734 var STYLE_HASH_ATTRIBUTE36 = "data-wp-hash"; 28735 function getRuntime36() { 28736 const globalScope = globalThis; 28737 if (globalScope.__wpStyleRuntime) { 28738 return globalScope.__wpStyleRuntime; 28739 } 28740 globalScope.__wpStyleRuntime = { 28741 documents: /* @__PURE__ */ new Map(), 28742 styles: /* @__PURE__ */ new Map(), 28743 injectedStyles: /* @__PURE__ */ new WeakMap() 28744 }; 28745 if (typeof document !== "undefined") { 28746 registerDocument36(document); 28747 } 28748 return globalScope.__wpStyleRuntime; 28749 } 28750 function documentContainsStyleHash36(targetDocument, hash) { 28751 if (!targetDocument.head) { 28752 return false; 28753 } 28754 for (const style of targetDocument.head.querySelectorAll( 28755 `style[$STYLE_HASH_ATTRIBUTE36}]` 28756 )) { 28757 if (style.getAttribute(STYLE_HASH_ATTRIBUTE36) === hash) { 28758 return true; 28759 } 28760 } 28761 return false; 28762 } 28763 function injectStyle36(targetDocument, hash, css) { 28764 if (!targetDocument.head) { 28765 return; 28766 } 28767 const runtime = getRuntime36(); 28768 let injectedStyles = runtime.injectedStyles.get(targetDocument); 28769 if (!injectedStyles) { 28770 injectedStyles = /* @__PURE__ */ new Set(); 28771 runtime.injectedStyles.set(targetDocument, injectedStyles); 28772 } 28773 if (injectedStyles.has(hash)) { 28774 return; 28775 } 28776 if (documentContainsStyleHash36(targetDocument, hash)) { 28777 injectedStyles.add(hash); 28778 return; 28779 } 28780 const style = targetDocument.createElement("style"); 28781 style.setAttribute(STYLE_HASH_ATTRIBUTE36, hash); 28782 style.appendChild(targetDocument.createTextNode(css)); 28783 targetDocument.head.appendChild(style); 28784 injectedStyles.add(hash); 28785 } 28786 function registerDocument36(targetDocument) { 28787 const runtime = getRuntime36(); 28788 runtime.documents.set( 28789 targetDocument, 28790 (runtime.documents.get(targetDocument) ?? 0) + 1 28791 ); 28792 for (const [hash, css] of runtime.styles) { 28793 injectStyle36(targetDocument, hash, css); 28794 } 28795 return () => { 28796 const count = runtime.documents.get(targetDocument); 28797 if (count === void 0) { 28798 return; 28799 } 28800 if (count <= 1) { 28801 runtime.documents.delete(targetDocument); 28802 return; 28803 } 28804 runtime.documents.set(targetDocument, count - 1); 28805 }; 28806 } 28807 function registerStyle36(hash, css) { 28808 const runtime = getRuntime36(); 28809 runtime.styles.set(hash, css); 28810 for (const targetDocument of runtime.documents.keys()) { 28811 injectStyle36(targetDocument, hash, css); 28812 } 28813 } 28814 if (typeof process === "undefined" || true) { 28815 registerStyle36("df33c48b2d", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._2d5ad850b2f90964__label{--wp-ui-field-label-line-height:var(--wpds-typography-line-height-xs,16px);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-xs,11px);font-weight:var(--wpds-typography-font-weight-emphasis,600);line-height:var(--wp-ui-field-label-line-height);text-transform:uppercase;&._17c4214649230bea__is-plain{font-size:var(--wpds-typography-font-size-md,13px);font-weight:var(--wpds-typography-font-weight-default,400);text-transform:none}}._08a3750500e0233f__description{--_gcd-p-font-size:var(--wpds-typography-font-size-sm,12px);--_gcd-p-line-height:var(--wpds-typography-line-height-xs,16px);--_gcd-p-margin:0;text-wrap:pretty;color:var(--wpds-color-foreground-content-neutral-weak,#707070);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:var(--wpds-typography-line-height-xs,16px)}}}'); 28816 } 28817 var field_default4 = { "label": "_2d5ad850b2f90964__label", "is-plain": "_17c4214649230bea__is-plain", "description": "_08a3750500e0233f__description" }; 28818 var VisualLabel = (0, import_element67.forwardRef)( 28819 function VisualLabel2({ className, render: render4, variant, ...restProps }, ref) { 28820 return useRender({ 28821 defaultTagName: "span", 28822 render: render4, 28823 ref, 28824 props: mergeProps(restProps, { 28825 className: clsx_default( 28826 field_default4.label, 28827 variant && field_default4[`is-$variant}`], 28828 className 28829 ) 28830 }) 28831 }); 28832 } 28833 ); 28834 VisualLabel.displayName = "Field.VisualLabel"; 28835 28836 // packages/ui/build-module/form/primitives/textarea/textarea.mjs 28837 var import_element68 = __toESM(require_element(), 1); 28838 var import_jsx_runtime112 = __toESM(require_jsx_runtime(), 1); 28839 var STYLE_HASH_ATTRIBUTE37 = "data-wp-hash"; 28840 function getRuntime37() { 28841 const globalScope = globalThis; 28842 if (globalScope.__wpStyleRuntime) { 28843 return globalScope.__wpStyleRuntime; 28844 } 28845 globalScope.__wpStyleRuntime = { 28846 documents: /* @__PURE__ */ new Map(), 28847 styles: /* @__PURE__ */ new Map(), 28848 injectedStyles: /* @__PURE__ */ new WeakMap() 28849 }; 28850 if (typeof document !== "undefined") { 28851 registerDocument37(document); 28852 } 28853 return globalScope.__wpStyleRuntime; 28854 } 28855 function documentContainsStyleHash37(targetDocument, hash) { 28856 if (!targetDocument.head) { 28857 return false; 28858 } 28859 for (const style of targetDocument.head.querySelectorAll( 28860 `style[$STYLE_HASH_ATTRIBUTE37}]` 28861 )) { 28862 if (style.getAttribute(STYLE_HASH_ATTRIBUTE37) === hash) { 28863 return true; 28864 } 28865 } 28866 return false; 28867 } 28868 function injectStyle37(targetDocument, hash, css) { 28869 if (!targetDocument.head) { 28870 return; 28871 } 28872 const runtime = getRuntime37(); 28873 let injectedStyles = runtime.injectedStyles.get(targetDocument); 28874 if (!injectedStyles) { 28875 injectedStyles = /* @__PURE__ */ new Set(); 28876 runtime.injectedStyles.set(targetDocument, injectedStyles); 28877 } 28878 if (injectedStyles.has(hash)) { 28879 return; 28880 } 28881 if (documentContainsStyleHash37(targetDocument, hash)) { 28882 injectedStyles.add(hash); 28883 return; 28884 } 28885 const style = targetDocument.createElement("style"); 28886 style.setAttribute(STYLE_HASH_ATTRIBUTE37, hash); 28887 style.appendChild(targetDocument.createTextNode(css)); 28888 targetDocument.head.appendChild(style); 28889 injectedStyles.add(hash); 28890 } 28891 function registerDocument37(targetDocument) { 28892 const runtime = getRuntime37(); 28893 runtime.documents.set( 28894 targetDocument, 28895 (runtime.documents.get(targetDocument) ?? 0) + 1 28896 ); 28897 for (const [hash, css] of runtime.styles) { 28898 injectStyle37(targetDocument, hash, css); 28899 } 28900 return () => { 28901 const count = runtime.documents.get(targetDocument); 28902 if (count === void 0) { 28903 return; 28904 } 28905 if (count <= 1) { 28906 runtime.documents.delete(targetDocument); 28907 return; 28908 } 28909 runtime.documents.set(targetDocument, count - 1); 28910 }; 28911 } 28912 function registerStyle37(hash, css) { 28913 const runtime = getRuntime37(); 28914 runtime.styles.set(hash, css); 28915 for (const targetDocument of runtime.documents.keys()) { 28916 injectStyle37(targetDocument, hash, css); 28917 } 28918 } 28919 if (typeof process === "undefined" || true) { 28920 registerStyle37("1540cbc709", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._1e441c22c9dc5d28__wrapper{--wp-ui-textarea-min-height:var(--wpds-dimension-size-lg,40px)}._414844876c32ecee__textarea{min-height:calc(var(--wp-ui-textarea-min-height) - 2px);resize:block}}@layer compositions{._1e441c22c9dc5d28__wrapper{--wp-ui-input-padding-block:9.9px;height:auto;line-height:1.4}}}"); 28921 } 28922 var style_default31 = { "wrapper": "_1e441c22c9dc5d28__wrapper", "textarea": "_414844876c32ecee__textarea" }; 28923 if (typeof process === "undefined" || true) { 28924 registerStyle37("e8e31009f5", "._6defc79820e382c6__button{box-sizing:var(--_gcd-button-box-sizing,border-box);font-family:var(--_gcd-button-font-family,inherit);font-size:var(--_gcd-button-font-size,inherit);font-weight:var(--_gcd-button-font-weight,inherit)}.d2cff2e5dea83bd1__input{box-sizing:var(--_gcd-input-box-sizing,border-box);font-family:var(--_gcd-input-font-family,inherit);font-size:var(--_gcd-input-font-size,inherit);font-weight:var(--_gcd-input-font-weight,inherit);margin:var(--_gcd-input-margin,0);&::placeholder{color:var(--_gcd-input-placeholder-color,var(--wpds-color-foreground-interactive-neutral-weak,#707070))}&:is(textarea,[type=text],[type=password],[type=color],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){background-color:var(--_gcd-input-background-color,transparent);border:var(--_gcd-input-border,none);border-radius:var(--_gcd-input-border-radius,0);box-shadow:var(--_gcd-input-box-shadow,0 0 0 transparent);color:var(--_gcd-input-color,var(--wpds-color-foreground-interactive-neutral,#1e1e1e));&:focus{border-color:var(--_gcd-input-border-color-focus,var(--wp-admin-theme-color));box-shadow:var(--_gcd-input-box-shadow-focus,none);outline:var(--_gcd-input-outline-focus,none)}&:disabled{background:var(--_gcd-input-background-disabled,transparent);border-color:var(--_gcd-input-border-color-disabled,transparent);box-shadow:var(--_gcd-input-box-shadow-disabled,none);color:var(--_gcd-input-color-disabled,var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d))}}&:is(textarea,[type=text],[type=password],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){line-height:var(--_gcd-input-line-height,inherit);min-height:var(--_gcd-input-min-height,auto);padding:var(--_gcd-input-padding,0)}}._547d86373d02e108__textarea{box-sizing:var(--_gcd-textarea-box-sizing,border-box);overflow:var(--_gcd-textarea-overflow,auto);resize:var(--_gcd-textarea-resize,block)}._8c15fd0ed9f28ba4__div{outline:var(--_gcd-div-outline,0 solid transparent)}p._43cec3e1eec1066d__p{font-size:var(--_gcd-p-font-size,13px);line-height:var(--_gcd-p-line-height,1.5);margin:var(--_gcd-p-margin,0)}:is(h1,h2,h3,h4,h5,h6).e97669c6d9a38497__heading{color:var(--_gcd-heading-color,var(--wpds-color-foreground-content-neutral,#1e1e1e));font-size:var(--_gcd-heading-font-size,inherit);font-weight:var(--_gcd-heading-font-weight,var(--wpds-typography-font-weight-emphasis,600));margin:var(--_gcd-heading-margin,0)}._2c0831b0499dbd6e__a,._2c0831b0499dbd6e__a:is(:hover,:focus,:active){border-radius:var(--_gcd-a-border-radius,0);box-shadow:var(--_gcd-a-box-shadow,none);color:var(--_gcd-a-color,inherit);outline:var(--_gcd-a-outline,0 solid transparent);transition:var(--_gcd-a-transition,none)}.c59a0ebebd71fa4a__ol{list-style:var(--_gcd-ol-list-style,none);margin:var(--_gcd-ol-margin,0);padding-block:var(--_gcd-ol-padding-block,0);padding-inline:var(--_gcd-ol-padding-inline,0)}._46b5cb0c8e24e8c9__li{margin:var(--_gcd-li-margin,0)}"); 28925 } 28926 var global_css_defense_default14 = { "button": "_6defc79820e382c6__button", "input": "d2cff2e5dea83bd1__input", "textarea": "_547d86373d02e108__textarea", "div": "_8c15fd0ed9f28ba4__div", "p": "_43cec3e1eec1066d__p", "heading": "e97669c6d9a38497__heading", "a": "_2c0831b0499dbd6e__a", "ol": "c59a0ebebd71fa4a__ol", "li": "_46b5cb0c8e24e8c9__li" }; 28927 var wrappedRender = (render4, restProps) => { 28928 return function textareaRender(props) { 28929 return typeof render4 === "function" ? render4(mergeProps(props, restProps)) : (0, import_element68.cloneElement)(render4, mergeProps(props, restProps)); 28930 }; 28931 }; 28932 var Textarea = (0, import_element68.forwardRef)( 28933 function Textarea2({ 28934 className, 28935 defaultValue: defaultValue2, 28936 disabled: disabled2, 28937 onValueChange, 28938 render: render4, 28939 rows = 4, 28940 style, 28941 value, 28942 ...restProps 28943 }, ref) { 28944 return /* @__PURE__ */ (0, import_jsx_runtime112.jsx)( 28945 Input3, 28946 { 28947 className: clsx_default(style_default31.wrapper, className), 28948 style, 28949 render: wrappedRender( 28950 render4 || ((props) => /* @__PURE__ */ (0, import_jsx_runtime112.jsx)("textarea", { ...props })), 28951 { 28952 className: clsx_default( 28953 global_css_defense_default14.textarea, 28954 style_default31.textarea 28955 ), 28956 ref, 28957 rows, 28958 ...restProps 28959 } 28960 ), 28961 value, 28962 defaultValue: defaultValue2, 28963 onValueChange, 28964 disabled: disabled2 28965 } 28966 ); 28967 } 28968 ); 28969 28970 // packages/ui/build-module/form/input-control/input-control.mjs 28971 var import_element69 = __toESM(require_element(), 1); 28972 var import_jsx_runtime113 = __toESM(require_jsx_runtime(), 1); 28973 var STYLE_HASH_ATTRIBUTE38 = "data-wp-hash"; 28974 function getRuntime38() { 28975 const globalScope = globalThis; 28976 if (globalScope.__wpStyleRuntime) { 28977 return globalScope.__wpStyleRuntime; 28978 } 28979 globalScope.__wpStyleRuntime = { 28980 documents: /* @__PURE__ */ new Map(), 28981 styles: /* @__PURE__ */ new Map(), 28982 injectedStyles: /* @__PURE__ */ new WeakMap() 28983 }; 28984 if (typeof document !== "undefined") { 28985 registerDocument38(document); 28986 } 28987 return globalScope.__wpStyleRuntime; 28988 } 28989 function documentContainsStyleHash38(targetDocument, hash) { 28990 if (!targetDocument.head) { 28991 return false; 28992 } 28993 for (const style of targetDocument.head.querySelectorAll( 28994 `style[$STYLE_HASH_ATTRIBUTE38}]` 28995 )) { 28996 if (style.getAttribute(STYLE_HASH_ATTRIBUTE38) === hash) { 28997 return true; 28998 } 28999 } 29000 return false; 29001 } 29002 function injectStyle38(targetDocument, hash, css) { 29003 if (!targetDocument.head) { 29004 return; 29005 } 29006 const runtime = getRuntime38(); 29007 let injectedStyles = runtime.injectedStyles.get(targetDocument); 29008 if (!injectedStyles) { 29009 injectedStyles = /* @__PURE__ */ new Set(); 29010 runtime.injectedStyles.set(targetDocument, injectedStyles); 29011 } 29012 if (injectedStyles.has(hash)) { 29013 return; 29014 } 29015 if (documentContainsStyleHash38(targetDocument, hash)) { 29016 injectedStyles.add(hash); 29017 return; 29018 } 29019 const style = targetDocument.createElement("style"); 29020 style.setAttribute(STYLE_HASH_ATTRIBUTE38, hash); 29021 style.appendChild(targetDocument.createTextNode(css)); 29022 targetDocument.head.appendChild(style); 29023 injectedStyles.add(hash); 29024 } 29025 function registerDocument38(targetDocument) { 29026 const runtime = getRuntime38(); 29027 runtime.documents.set( 29028 targetDocument, 29029 (runtime.documents.get(targetDocument) ?? 0) + 1 29030 ); 29031 for (const [hash, css] of runtime.styles) { 29032 injectStyle38(targetDocument, hash, css); 29033 } 29034 return () => { 29035 const count = runtime.documents.get(targetDocument); 29036 if (count === void 0) { 29037 return; 29038 } 29039 if (count <= 1) { 29040 runtime.documents.delete(targetDocument); 29041 return; 29042 } 29043 runtime.documents.set(targetDocument, count - 1); 29044 }; 29045 } 29046 function registerStyle38(hash, css) { 29047 const runtime = getRuntime38(); 29048 runtime.styles.set(hash, css); 29049 for (const targetDocument of runtime.documents.keys()) { 29050 injectStyle38(targetDocument, hash, css); 29051 } 29052 } 29053 if (typeof process === "undefined" || true) { 29054 registerStyle38("0c752c3d08", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer compositions{@supports (-webkit-hyphens:none) and (not (-moz-appearance:none)){.a9211a7e6af24bed__root input[type=date]:not([data-filled]):not(:focus),.a9211a7e6af24bed__root input[type=datetime-local]:not([data-filled]):not(:focus),.a9211a7e6af24bed__root input[type=time]:not([data-filled]):not(:focus){--_gcd-input-color:transparent;--_gcd-input-color-disabled:transparent;color:transparent;&:disabled::-webkit-datetime-edit-text{color:transparent}}}}}"); 29055 } 29056 var style_default32 = { "root": "a9211a7e6af24bed__root" }; 29057 var InputControl = (0, import_element69.forwardRef)( 29058 function InputControl2({ 29059 className, 29060 label, 29061 description, 29062 details, 29063 hideLabelFromVision, 29064 ...restProps 29065 }, ref) { 29066 return /* @__PURE__ */ (0, import_jsx_runtime113.jsxs)(field_exports.Root, { className: clsx_default(style_default32.root, className), children: [ 29067 /* @__PURE__ */ (0, import_jsx_runtime113.jsx)(field_exports.Label, { hideFromVision: hideLabelFromVision, children: label }), 29068 /* @__PURE__ */ (0, import_jsx_runtime113.jsx)(Input3, { ref, ...restProps }), 29069 description && /* @__PURE__ */ (0, import_jsx_runtime113.jsx)(field_exports.Description, { children: description }), 29070 details && /* @__PURE__ */ (0, import_jsx_runtime113.jsx)(field_exports.Details, { children: details }) 29071 ] }); 29072 } 29073 ); 29074 29075 // packages/ui/build-module/form/textarea-control/textarea-control.mjs 29076 var import_element70 = __toESM(require_element(), 1); 29077 var import_jsx_runtime114 = __toESM(require_jsx_runtime(), 1); 29078 var TextareaControl = (0, import_element70.forwardRef)(function TextareaControl2({ 29079 className, 29080 label, 29081 description, 29082 details, 29083 hideLabelFromVision, 29084 ...restProps 29085 }, ref) { 29086 return /* @__PURE__ */ (0, import_jsx_runtime114.jsxs)(field_exports.Root, { className, children: [ 29087 /* @__PURE__ */ (0, import_jsx_runtime114.jsx)(field_exports.Label, { hideFromVision: hideLabelFromVision, children: label }), 29088 /* @__PURE__ */ (0, import_jsx_runtime114.jsx)(Textarea, { ref, ...restProps }), 29089 description && /* @__PURE__ */ (0, import_jsx_runtime114.jsx)(field_exports.Description, { children: description }), 29090 details && /* @__PURE__ */ (0, import_jsx_runtime114.jsx)(field_exports.Details, { children: details }) 29091 ] }); 29092 }); 29093 29094 // packages/ui/build-module/form/with-validation/validated-input-control/validated-input-control.mjs 29095 var import_element71 = __toESM(require_element(), 1); 29096 var import_compose3 = __toESM(require_compose(), 1); 29097 var import_jsx_runtime115 = __toESM(require_jsx_runtime(), 1); 29098 var ValidatedInputControl = (0, import_element71.forwardRef)(function ValidatedInputControl2({ required, markWhenOptional, customValidity, ...restProps }, forwardedRef) { 29099 const validityTargetRef = (0, import_element71.useRef)(null); 29100 const mergedRefs = (0, import_compose3.useMergeRefs)([forwardedRef, validityTargetRef]); 29101 return /* @__PURE__ */ (0, import_jsx_runtime115.jsx)( 29102 ControlWithError, 29103 { 29104 required, 29105 markWhenOptional, 29106 customValidity, 29107 getValidityTarget: () => validityTargetRef.current, 29108 children: /* @__PURE__ */ (0, import_jsx_runtime115.jsx)(InputControl, { ref: mergedRefs, ...restProps }) 29109 } 29110 ); 29111 }); 29112 29113 // packages/ui/build-module/form/with-validation/validated-textarea-control/validated-textarea-control.mjs 29114 var import_element72 = __toESM(require_element(), 1); 29115 var import_compose4 = __toESM(require_compose(), 1); 29116 var import_jsx_runtime116 = __toESM(require_jsx_runtime(), 1); 29117 var ValidatedTextareaControl = (0, import_element72.forwardRef)(function ValidatedTextareaControl2({ required, markWhenOptional, customValidity, ...restProps }, forwardedRef) { 29118 const validityTargetRef = (0, import_element72.useRef)(null); 29119 const mergedRefs = (0, import_compose4.useMergeRefs)([forwardedRef, validityTargetRef]); 29120 return /* @__PURE__ */ (0, import_jsx_runtime116.jsx)( 29121 ControlWithError, 29122 { 29123 required, 29124 markWhenOptional, 29125 customValidity, 29126 getValidityTarget: () => validityTargetRef.current, 29127 children: /* @__PURE__ */ (0, import_jsx_runtime116.jsx)(TextareaControl, { ref: mergedRefs, ...restProps }) 29128 } 29129 ); 29130 }); 29131 29132 // packages/dataviews/build-module/components/dataviews-context/index.mjs 29133 var import_element73 = __toESM(require_element(), 1); 29134 29135 // packages/dataviews/build-module/constants.mjs 29136 var import_i18n16 = __toESM(require_i18n(), 1); 29137 var OPERATOR_IS_ANY = "isAny"; 29138 var OPERATOR_IS_NONE = "isNone"; 29139 var OPERATOR_IS_ALL = "isAll"; 29140 var OPERATOR_IS_NOT_ALL = "isNotAll"; 29141 var OPERATOR_BETWEEN = "between"; 29142 var OPERATOR_IN_THE_PAST = "inThePast"; 29143 var OPERATOR_OVER = "over"; 29144 var OPERATOR_IS = "is"; 29145 var OPERATOR_IS_NOT = "isNot"; 29146 var OPERATOR_LESS_THAN = "lessThan"; 29147 var OPERATOR_GREATER_THAN = "greaterThan"; 29148 var OPERATOR_LESS_THAN_OR_EQUAL = "lessThanOrEqual"; 29149 var OPERATOR_GREATER_THAN_OR_EQUAL = "greaterThanOrEqual"; 29150 var OPERATOR_BEFORE = "before"; 29151 var OPERATOR_AFTER = "after"; 29152 var OPERATOR_BEFORE_INC = "beforeInc"; 29153 var OPERATOR_AFTER_INC = "afterInc"; 29154 var OPERATOR_CONTAINS = "contains"; 29155 var OPERATOR_NOT_CONTAINS = "notContains"; 29156 var OPERATOR_STARTS_WITH = "startsWith"; 29157 var OPERATOR_ON = "on"; 29158 var OPERATOR_NOT_ON = "notOn"; 29159 var SORTING_DIRECTIONS = ["asc", "desc"]; 29160 var sortArrows = { asc: "\u2191", desc: "\u2193" }; 29161 var sortValues = { asc: "ascending", desc: "descending" }; 29162 var sortLabels = { 29163 asc: (0, import_i18n16.__)("Sort ascending"), 29164 desc: (0, import_i18n16.__)("Sort descending") 29165 }; 29166 var sortIcons = { 29167 asc: arrow_up_default, 29168 desc: arrow_down_default 29169 }; 29170 var LAYOUT_TABLE = "table"; 29171 var LAYOUT_GRID = "grid"; 29172 var LAYOUT_LIST = "list"; 29173 var LAYOUT_ACTIVITY = "activity"; 29174 var LAYOUT_PICKER_GRID = "pickerGrid"; 29175 var LAYOUT_PICKER_TABLE = "pickerTable"; 29176 var LAYOUT_PICKER_ACTIVITY = "pickerActivity"; 29177 var MEDIA_ASPECT_RATIOS = [ 29178 "1/1", 29179 "4/3", 29180 "3/4", 29181 "3/2", 29182 "2/3", 29183 "16/9", 29184 "9/16" 29185 ]; 29186 29187 // packages/dataviews/build-module/components/dataviews-context/index.mjs 29188 var DataViewsContext = (0, import_element73.createContext)({ 29189 view: { type: LAYOUT_TABLE }, 29190 onChangeView: () => { 29191 }, 29192 fields: [], 29193 data: [], 29194 paginationInfo: { 29195 totalItems: 0, 29196 totalPages: 0 29197 }, 29198 selection: [], 29199 onChangeSelection: () => { 29200 }, 29201 setOpenedFilter: () => { 29202 }, 29203 openedFilter: null, 29204 getItemId: (item) => item.id, 29205 isItemClickable: () => true, 29206 renderItemLink: void 0, 29207 containerWidth: 0, 29208 containerRef: (0, import_element73.createRef)(), 29209 resizeObserverRef: () => { 29210 }, 29211 defaultLayouts: { list: {}, grid: {}, table: {} }, 29212 filters: [], 29213 isShowingFilter: false, 29214 setIsShowingFilter: () => { 29215 }, 29216 hasInitiallyLoaded: false, 29217 config: { 29218 perPageSizes: [] 29219 }, 29220 intersectionObserver: null 29221 }); 29222 DataViewsContext.displayName = "DataViewsContext"; 29223 var dataviews_context_default = DataViewsContext; 29224 29225 // packages/dataviews/build-module/components/dataviews-layouts/index.mjs 29226 var import_i18n38 = __toESM(require_i18n(), 1); 29227 29228 // packages/dataviews/build-module/components/dataviews-layouts/table/index.mjs 29229 var import_i18n24 = __toESM(require_i18n(), 1); 29230 var import_components7 = __toESM(require_components(), 1); 29231 var import_element82 = __toESM(require_element(), 1); 29232 var import_keycodes2 = __toESM(require_keycodes(), 1); 29233 29234 // packages/dataviews/build-module/components/dataviews-selection-checkbox/index.mjs 29235 var import_components2 = __toESM(require_components(), 1); 29236 var import_i18n17 = __toESM(require_i18n(), 1); 29237 var import_jsx_runtime117 = __toESM(require_jsx_runtime(), 1); 29238 var SELECTION_CHECKBOX_CLASS = "dataviews-selection-checkbox"; 29239 function DataViewsSelectionCheckbox({ 29240 selection, 29241 onChangeSelection, 29242 item, 29243 getItemId, 29244 titleField, 29245 disabled: disabled2, 29246 ...extraProps 29247 }) { 29248 const id = getItemId(item); 29249 const isInSelectionArray = selection.includes(id); 29250 const checked2 = !disabled2 && isInSelectionArray; 29251 const selectionLabel = titleField?.getValue?.({ item }) || (0, import_i18n17.__)("(no title)"); 29252 return /* @__PURE__ */ (0, import_jsx_runtime117.jsx)( 29253 import_components2.CheckboxControl, 29254 { 29255 className: SELECTION_CHECKBOX_CLASS, 29256 "aria-label": selectionLabel, 29257 "aria-disabled": disabled2, 29258 checked: checked2, 29259 onChange: () => { 29260 if (disabled2) { 29261 return; 29262 } 29263 onChangeSelection( 29264 isInSelectionArray ? selection.filter((itemId) => id !== itemId) : [...selection, id] 29265 ); 29266 }, 29267 ...extraProps 29268 } 29269 ); 29270 } 29271 29272 // packages/dataviews/build-module/components/dataviews-item-actions/index.mjs 29273 var import_components3 = __toESM(require_components(), 1); 29274 var import_i18n18 = __toESM(require_i18n(), 1); 29275 var import_element74 = __toESM(require_element(), 1); 29276 var import_data2 = __toESM(require_data(), 1); 29277 var import_compose5 = __toESM(require_compose(), 1); 29278 29279 // node_modules/tslib/tslib.es6.mjs 29280 var __assign = function() { 29281 __assign = Object.assign || function __assign2(t) { 29282 for (var s, i = 1, n = arguments.length; i < n; i++) { 29283 s = arguments[i]; 29284 for (var p2 in s) if (Object.prototype.hasOwnProperty.call(s, p2)) t[p2] = s[p2]; 29285 } 29286 return t; 29287 }; 29288 return __assign.apply(this, arguments); 29289 }; 29290 29291 // node_modules/lower-case/dist.es2015/index.js 29292 function lowerCase(str) { 29293 return str.toLowerCase(); 29294 } 29295 29296 // node_modules/no-case/dist.es2015/index.js 29297 var DEFAULT_SPLIT_REGEXP = [/([a-z0-9])([A-Z])/g, /([A-Z])([A-Z][a-z])/g]; 29298 var DEFAULT_STRIP_REGEXP = /[^A-Z0-9]+/gi; 29299 function noCase(input, options) { 29300 if (options === void 0) { 29301 options = {}; 29302 } 29303 var _a = options.splitRegexp, splitRegexp = _a === void 0 ? DEFAULT_SPLIT_REGEXP : _a, _b = options.stripRegexp, stripRegexp = _b === void 0 ? DEFAULT_STRIP_REGEXP : _b, _c = options.transform, transform = _c === void 0 ? lowerCase : _c, _d = options.delimiter, delimiter = _d === void 0 ? " " : _d; 29304 var result = replace(replace(input, splitRegexp, "$1\0$2"), stripRegexp, "\0"); 29305 var start = 0; 29306 var end = result.length; 29307 while (result.charAt(start) === "\0") 29308 start++; 29309 while (result.charAt(end - 1) === "\0") 29310 end--; 29311 return result.slice(start, end).split("\0").map(transform).join(delimiter); 29312 } 29313 function replace(input, re2, value) { 29314 if (re2 instanceof RegExp) 29315 return input.replace(re2, value); 29316 return re2.reduce(function(input2, re3) { 29317 return input2.replace(re3, value); 29318 }, input); 29319 } 29320 29321 // node_modules/dot-case/dist.es2015/index.js 29322 function dotCase(input, options) { 29323 if (options === void 0) { 29324 options = {}; 29325 } 29326 return noCase(input, __assign({ delimiter: "." }, options)); 29327 } 29328 29329 // node_modules/param-case/dist.es2015/index.js 29330 function paramCase(input, options) { 29331 if (options === void 0) { 29332 options = {}; 29333 } 29334 return dotCase(input, __assign({ delimiter: "-" }, options)); 29335 } 29336 29337 // packages/kebab-case/build-module/index.mjs 29338 function kebabCase(str) { 29339 let input = str?.toString?.() ?? ""; 29340 input = input.replace(/['\u2019]/, ""); 29341 return paramCase(input, { 29342 splitRegexp: [ 29343 /(?!(?:1ST|2ND|3RD|[4-9]TH)(?![a-z]))([a-z0-9])([A-Z])/g, 29344 // fooBar => foo-bar, 3Bar => 3-bar 29345 /(?!(?:1st|2nd|3rd|[4-9]th)(?![a-z]))([0-9])([a-z])/g, 29346 // 3bar => 3-bar 29347 /([A-Za-z])([0-9])/g, 29348 // Foo3 => foo-3, foo3 => foo-3 29349 /([A-Z])([A-Z][a-z])/g 29350 // FOOBar => foo-bar 29351 ] 29352 }); 29353 } 29354 29355 // packages/dataviews/build-module/components/dataviews-item-actions/index.mjs 29356 var import_jsx_runtime118 = __toESM(require_jsx_runtime(), 1); 29357 function ButtonTrigger({ 29358 action, 29359 onClick, 29360 items, 29361 variant 29362 }) { 29363 const label = typeof action.label === "string" ? action.label : action.label(items); 29364 return /* @__PURE__ */ (0, import_jsx_runtime118.jsx)( 29365 import_components3.Button, 29366 { 29367 disabled: !!action.disabled, 29368 accessibleWhenDisabled: true, 29369 size: "compact", 29370 variant, 29371 onClick, 29372 children: label 29373 } 29374 ); 29375 } 29376 function MenuItemTrigger({ 29377 action, 29378 onClick, 29379 items 29380 }) { 29381 const label = typeof action.label === "string" ? action.label : action.label(items); 29382 return /* @__PURE__ */ (0, import_jsx_runtime118.jsx)(menu_exports.Item, { disabled: action.disabled, onClick, children: /* @__PURE__ */ (0, import_jsx_runtime118.jsx)(menu_exports.ItemLabel, { children: label }) }); 29383 } 29384 function ActionModal({ 29385 action, 29386 items, 29387 closeModal 29388 }) { 29389 const label = typeof action.label === "string" ? action.label : action.label(items); 29390 const modalHeader = typeof action.modalHeader === "function" ? action.modalHeader(items) : action.modalHeader; 29391 return /* @__PURE__ */ (0, import_jsx_runtime118.jsx)( 29392 import_components3.Modal, 29393 { 29394 title: modalHeader || label, 29395 __experimentalHideHeader: !!action.hideModalHeader, 29396 onRequestClose: closeModal, 29397 focusOnMount: action.modalFocusOnMount ?? true, 29398 size: action.modalSize || "medium", 29399 overlayClassName: `dataviews-action-modal dataviews-action-modal__$kebabCase( 29400 action.id 29401 )}`, 29402 children: /* @__PURE__ */ (0, import_jsx_runtime118.jsx)(action.RenderModal, { items, closeModal }) 29403 } 29404 ); 29405 } 29406 function ActionsMenuGroup({ 29407 actions, 29408 item, 29409 registry, 29410 setActiveModalAction 29411 }) { 29412 const { primaryActions, regularActions } = (0, import_element74.useMemo)(() => { 29413 return actions.reduce( 29414 (acc, action) => { 29415 (action.isPrimary ? acc.primaryActions : acc.regularActions).push(action); 29416 return acc; 29417 }, 29418 { 29419 primaryActions: [], 29420 regularActions: [] 29421 } 29422 ); 29423 }, [actions]); 29424 const renderActionGroup = (actionList) => actionList.map((action) => /* @__PURE__ */ (0, import_jsx_runtime118.jsx)( 29425 MenuItemTrigger, 29426 { 29427 action, 29428 onClick: () => { 29429 if ("RenderModal" in action) { 29430 setActiveModalAction(action); 29431 return; 29432 } 29433 action.callback([item], { registry }); 29434 }, 29435 items: [item] 29436 }, 29437 action.id 29438 )); 29439 return /* @__PURE__ */ (0, import_jsx_runtime118.jsxs)(menu_exports.Group, { children: [ 29440 renderActionGroup(primaryActions), 29441 renderActionGroup(regularActions) 29442 ] }); 29443 } 29444 function ItemActions({ 29445 item, 29446 actions, 29447 isCompact 29448 }) { 29449 const registry = (0, import_data2.useRegistry)(); 29450 const { primaryActions, eligibleActions } = (0, import_element74.useMemo)(() => { 29451 const _eligibleActions = actions.filter( 29452 (action) => !action.isEligible || action.isEligible(item) 29453 ); 29454 const _primaryActions = _eligibleActions.filter( 29455 (action) => action.isPrimary 29456 ); 29457 return { 29458 primaryActions: _primaryActions, 29459 eligibleActions: _eligibleActions 29460 }; 29461 }, [actions, item]); 29462 const isMobileViewport = (0, import_compose5.useViewportMatch)("medium", "<"); 29463 if (isCompact) { 29464 return /* @__PURE__ */ (0, import_jsx_runtime118.jsx)( 29465 CompactItemActions, 29466 { 29467 item, 29468 actions: eligibleActions, 29469 isSmall: true, 29470 registry 29471 } 29472 ); 29473 } 29474 return /* @__PURE__ */ (0, import_jsx_runtime118.jsxs)( 29475 Stack, 29476 { 29477 direction: "row", 29478 justify: "flex-end", 29479 className: "dataviews-item-actions", 29480 style: { 29481 flexShrink: 0, 29482 width: "auto" 29483 }, 29484 children: [ 29485 /* @__PURE__ */ (0, import_jsx_runtime118.jsx)( 29486 PrimaryActions, 29487 { 29488 item, 29489 actions: primaryActions, 29490 registry 29491 } 29492 ), 29493 (primaryActions.length < eligibleActions.length || // Since we hide primary actions on mobile, we need to show the menu 29494 // there if there are any actions at all. 29495 isMobileViewport) && /* @__PURE__ */ (0, import_jsx_runtime118.jsx)( 29496 CompactItemActions, 29497 { 29498 item, 29499 actions: eligibleActions, 29500 registry 29501 } 29502 ) 29503 ] 29504 } 29505 ); 29506 } 29507 function CompactItemActions({ 29508 item, 29509 actions, 29510 isSmall, 29511 registry 29512 }) { 29513 const [activeModalAction, setActiveModalAction] = (0, import_element74.useState)( 29514 null 29515 ); 29516 return /* @__PURE__ */ (0, import_jsx_runtime118.jsxs)(import_jsx_runtime118.Fragment, { children: [ 29517 /* @__PURE__ */ (0, import_jsx_runtime118.jsxs)(menu_exports.Root, { disabled: !actions.length, children: [ 29518 /* @__PURE__ */ (0, import_jsx_runtime118.jsx)( 29519 menu_exports.Trigger, 29520 { 29521 render: /* @__PURE__ */ (0, import_jsx_runtime118.jsx)( 29522 import_components3.Button, 29523 { 29524 size: isSmall ? "small" : "compact", 29525 icon: more_vertical_default, 29526 label: (0, import_i18n18.__)("Actions"), 29527 accessibleWhenDisabled: true, 29528 disabled: !actions.length, 29529 className: "dataviews-all-actions-button" 29530 } 29531 ) 29532 } 29533 ), 29534 /* @__PURE__ */ (0, import_jsx_runtime118.jsx)(menu_exports.Popup, { positioner: /* @__PURE__ */ (0, import_jsx_runtime118.jsx)(menu_exports.Positioner, { align: "end" }), children: /* @__PURE__ */ (0, import_jsx_runtime118.jsx)( 29535 ActionsMenuGroup, 29536 { 29537 actions, 29538 item, 29539 registry, 29540 setActiveModalAction 29541 } 29542 ) }) 29543 ] }), 29544 !!activeModalAction && /* @__PURE__ */ (0, import_jsx_runtime118.jsx)( 29545 ActionModal, 29546 { 29547 action: activeModalAction, 29548 items: [item], 29549 closeModal: () => setActiveModalAction(null) 29550 } 29551 ) 29552 ] }); 29553 } 29554 function PrimaryActions({ 29555 item, 29556 actions, 29557 registry, 29558 buttonVariant 29559 }) { 29560 const [activeModalAction, setActiveModalAction] = (0, import_element74.useState)(null); 29561 const isMobileViewport = (0, import_compose5.useViewportMatch)("medium", "<"); 29562 if (isMobileViewport) { 29563 return null; 29564 } 29565 if (!Array.isArray(actions) || actions.length === 0) { 29566 return null; 29567 } 29568 return /* @__PURE__ */ (0, import_jsx_runtime118.jsxs)(import_jsx_runtime118.Fragment, { children: [ 29569 actions.map((action) => /* @__PURE__ */ (0, import_jsx_runtime118.jsx)( 29570 ButtonTrigger, 29571 { 29572 action, 29573 onClick: () => { 29574 if ("RenderModal" in action) { 29575 setActiveModalAction(action); 29576 return; 29577 } 29578 action.callback([item], { registry }); 29579 }, 29580 items: [item], 29581 variant: buttonVariant 29582 }, 29583 action.id 29584 )), 29585 !!activeModalAction && /* @__PURE__ */ (0, import_jsx_runtime118.jsx)( 29586 ActionModal, 29587 { 29588 action: activeModalAction, 29589 items: [item], 29590 closeModal: () => setActiveModalAction(null) 29591 } 29592 ) 29593 ] }); 29594 } 29595 29596 // packages/dataviews/build-module/components/dataviews-bulk-actions/index.mjs 29597 var import_components4 = __toESM(require_components(), 1); 29598 var import_i18n20 = __toESM(require_i18n(), 1); 29599 var import_element75 = __toESM(require_element(), 1); 29600 var import_data3 = __toESM(require_data(), 1); 29601 var import_compose6 = __toESM(require_compose(), 1); 29602 29603 // packages/dataviews/build-module/utils/get-footer-message.mjs 29604 var import_i18n19 = __toESM(require_i18n(), 1); 29605 function getFooterMessage(selectionCount, itemsCount, totalItems, onlyTotalCount = false) { 29606 if (selectionCount > 0) { 29607 return (0, import_i18n19.sprintf)( 29608 /* translators: %d: number of items. */ 29609 (0, import_i18n19._n)("%d Item selected", "%d Items selected", selectionCount), 29610 selectionCount 29611 ); 29612 } 29613 if (onlyTotalCount || totalItems <= itemsCount) { 29614 return (0, import_i18n19.sprintf)( 29615 /* translators: %d: number of items. */ 29616 (0, import_i18n19._n)("%d Item", "%d Items", totalItems), 29617 totalItems 29618 ); 29619 } 29620 return (0, import_i18n19.sprintf)( 29621 /* translators: %1$d: number of items. %2$d: total number of items. */ 29622 (0, import_i18n19._n)("%1$d of %2$d Item", "%1$d of %2$d Items", totalItems), 29623 itemsCount, 29624 totalItems 29625 ); 29626 } 29627 29628 // packages/dataviews/build-module/components/dataviews-bulk-actions/index.mjs 29629 var import_jsx_runtime119 = __toESM(require_jsx_runtime(), 1); 29630 function hasAPossibleBulkAction(actions, item) { 29631 return actions.some( 29632 (action) => action.supportsBulk && (!action.isEligible || action.isEligible(item)) 29633 ); 29634 } 29635 function useHasAPossibleBulkAction(actions, item) { 29636 return (0, import_element75.useMemo)( 29637 () => hasAPossibleBulkAction(actions, item), 29638 [actions, item] 29639 ); 29640 } 29641 function useSomeItemHasAPossibleBulkAction(actions, data) { 29642 return (0, import_element75.useMemo)( 29643 () => data.some((item) => hasAPossibleBulkAction(actions, item)), 29644 [actions, data] 29645 ); 29646 } 29647 function BulkSelectionCheckbox({ 29648 selection, 29649 onChangeSelection, 29650 data, 29651 actions, 29652 getItemId, 29653 disableSelectAll = false 29654 }) { 29655 const selectableItems = (0, import_element75.useMemo)(() => { 29656 return data.filter((item) => { 29657 return actions.some( 29658 (action) => action.supportsBulk && (!action.isEligible || action.isEligible(item)) 29659 ); 29660 }); 29661 }, [data, actions]); 29662 const selectedItems = data.filter( 29663 (item) => selection.includes(getItemId(item)) && selectableItems.includes(item) 29664 ); 29665 const hasSelection = selection.length > 0; 29666 const areAllSelected = selectedItems.length === selectableItems.length; 29667 if (disableSelectAll) { 29668 return /* @__PURE__ */ (0, import_jsx_runtime119.jsx)( 29669 import_components4.CheckboxControl, 29670 { 29671 className: "dataviews-view-table-selection-checkbox", 29672 checked: hasSelection, 29673 disabled: !hasSelection, 29674 onChange: () => { 29675 onChangeSelection([]); 29676 }, 29677 "aria-label": (0, import_i18n20.__)("Deselect all") 29678 } 29679 ); 29680 } 29681 return /* @__PURE__ */ (0, import_jsx_runtime119.jsx)( 29682 import_components4.CheckboxControl, 29683 { 29684 className: "dataviews-view-table-selection-checkbox", 29685 checked: areAllSelected, 29686 indeterminate: !areAllSelected && !!selectedItems.length, 29687 onChange: () => { 29688 if (areAllSelected) { 29689 onChangeSelection([]); 29690 } else { 29691 onChangeSelection( 29692 selectableItems.map((item) => getItemId(item)) 29693 ); 29694 } 29695 }, 29696 "aria-label": areAllSelected ? (0, import_i18n20.__)("Deselect all") : (0, import_i18n20.__)("Select all") 29697 } 29698 ); 29699 } 29700 29701 // packages/dataviews/build-module/components/dataviews-layouts/table/column-header-menu.mjs 29702 var import_i18n21 = __toESM(require_i18n(), 1); 29703 var import_components5 = __toESM(require_components(), 1); 29704 var import_element76 = __toESM(require_element(), 1); 29705 29706 // packages/dataviews/build-module/utils/get-hideable-fields.mjs 29707 function getHideableFields(view, fields) { 29708 const togglableFields = [ 29709 view?.titleField, 29710 view?.mediaField, 29711 view?.descriptionField 29712 ].filter(Boolean); 29713 return fields.filter( 29714 (f) => !togglableFields.includes(f.id) && f.type !== "media" && f.enableHiding !== false 29715 ); 29716 } 29717 29718 // packages/dataviews/build-module/components/dataviews-layouts/utils/get-table-columns.mjs 29719 function getTableColumns(view, fields) { 29720 return (view.fields ?? []).filter( 29721 (fieldId) => fields.some((field) => field.id === fieldId) 29722 ); 29723 } 29724 29725 // packages/dataviews/build-module/components/dataviews-layouts/table/column-header-menu.mjs 29726 var import_jsx_runtime120 = __toESM(require_jsx_runtime(), 1); 29727 function WithMenuSeparators({ children }) { 29728 return import_element76.Children.toArray(children).filter(Boolean).map((child, i) => /* @__PURE__ */ (0, import_jsx_runtime120.jsxs)(import_element76.Fragment, { children: [ 29729 i > 0 && /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(menu_exports.Separator, {}), 29730 child 29731 ] }, i)); 29732 } 29733 var _HeaderMenu = (0, import_element76.forwardRef)(function HeaderMenu({ 29734 fieldId, 29735 view, 29736 fields, 29737 onChangeView, 29738 onHide, 29739 setOpenedFilter, 29740 canMove = true, 29741 canInsertLeft = true, 29742 canInsertRight = true 29743 }, ref) { 29744 const isSorted = view.sort?.field === fieldId; 29745 let isHidable = false; 29746 let isSortable = false; 29747 let canAddFilter = false; 29748 let operators = []; 29749 const field = fields.find((f) => f.id === fieldId); 29750 const { setIsShowingFilter } = (0, import_element76.useContext)(dataviews_context_default); 29751 if (!field) { 29752 return null; 29753 } 29754 isHidable = field.enableHiding !== false; 29755 isSortable = field.enableSorting !== false; 29756 const header = field.header; 29757 operators = !!field.filterBy && field.filterBy?.operators || []; 29758 canAddFilter = !view.filters?.some((_filter) => fieldId === _filter.field) && !!(field.hasElements || field.Edit) && field.filterBy !== false && !field.filterBy?.isPrimary; 29759 if (!isSortable && !canMove && !isHidable && !canAddFilter) { 29760 return header; 29761 } 29762 const visibleFieldIds = getTableColumns(view, fields); 29763 const index2 = visibleFieldIds.indexOf(fieldId); 29764 const hiddenFields = getHideableFields(view, fields).filter( 29765 (f) => !visibleFieldIds.includes(f.id) 29766 ); 29767 const canInsert = (canInsertLeft || canInsertRight) && !!hiddenFields.length; 29768 const isRtl = (0, import_i18n21.isRTL)(); 29769 return /* @__PURE__ */ (0, import_jsx_runtime120.jsxs)(menu_exports.Root, { children: [ 29770 /* @__PURE__ */ (0, import_jsx_runtime120.jsxs)( 29771 menu_exports.Trigger, 29772 { 29773 render: /* @__PURE__ */ (0, import_jsx_runtime120.jsx)( 29774 import_components5.Button, 29775 { 29776 size: "compact", 29777 className: "dataviews-view-table-header-button", 29778 ref, 29779 variant: "tertiary" 29780 } 29781 ), 29782 children: [ 29783 header, 29784 view.sort && isSorted && /* @__PURE__ */ (0, import_jsx_runtime120.jsx)("span", { "aria-hidden": "true", children: sortArrows[view.sort.direction] }) 29785 ] 29786 } 29787 ), 29788 /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(menu_exports.Popup, { style: { minWidth: "240px" }, children: /* @__PURE__ */ (0, import_jsx_runtime120.jsxs)(WithMenuSeparators, { children: [ 29789 isSortable && /* @__PURE__ */ (0, import_jsx_runtime120.jsx)( 29790 menu_exports.RadioGroup, 29791 { 29792 value: isSorted && view.sort ? view.sort.direction : null, 29793 onValueChange: (direction) => { 29794 onChangeView({ 29795 ...view, 29796 sort: { 29797 field: fieldId, 29798 direction 29799 }, 29800 showLevels: false 29801 }); 29802 }, 29803 children: SORTING_DIRECTIONS.map( 29804 (direction) => /* @__PURE__ */ (0, import_jsx_runtime120.jsx)( 29805 menu_exports.RadioItem, 29806 { 29807 value: direction, 29808 children: /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(menu_exports.ItemLabel, { children: sortLabels[direction] }) 29809 }, 29810 direction 29811 ) 29812 ) 29813 } 29814 ), 29815 canAddFilter && /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(menu_exports.Group, { children: /* @__PURE__ */ (0, import_jsx_runtime120.jsx)( 29816 menu_exports.Item, 29817 { 29818 prefix: /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(menu_exports.PrefixIcon, { icon: funnel_default }), 29819 onClick: () => { 29820 setOpenedFilter(fieldId); 29821 setIsShowingFilter(true); 29822 onChangeView({ 29823 ...view, 29824 page: 1, 29825 filters: [ 29826 ...view.filters || [], 29827 { 29828 field: fieldId, 29829 value: void 0, 29830 operator: operators[0] 29831 } 29832 ] 29833 }); 29834 }, 29835 children: /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(menu_exports.ItemLabel, { children: (0, import_i18n21.__)("Add filter") }) 29836 } 29837 ) }), 29838 (canMove || isHidable || canInsert) && field && /* @__PURE__ */ (0, import_jsx_runtime120.jsxs)(menu_exports.Group, { children: [ 29839 canMove && /* @__PURE__ */ (0, import_jsx_runtime120.jsx)( 29840 menu_exports.Item, 29841 { 29842 prefix: /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(menu_exports.PrefixIcon, { icon: arrow_left_default }), 29843 disabled: isRtl ? index2 >= visibleFieldIds.length - 1 : index2 < 1, 29844 onClick: () => { 29845 const targetIndex = isRtl ? index2 + 1 : index2 - 1; 29846 const newFields = [ 29847 ...visibleFieldIds 29848 ]; 29849 newFields.splice(index2, 1); 29850 newFields.splice( 29851 targetIndex, 29852 0, 29853 fieldId 29854 ); 29855 onChangeView({ 29856 ...view, 29857 fields: newFields 29858 }); 29859 }, 29860 children: /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(menu_exports.ItemLabel, { children: (0, import_i18n21.__)("Move left") }) 29861 } 29862 ), 29863 canMove && /* @__PURE__ */ (0, import_jsx_runtime120.jsx)( 29864 menu_exports.Item, 29865 { 29866 prefix: /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(menu_exports.PrefixIcon, { icon: arrow_right_default }), 29867 disabled: isRtl ? index2 < 1 : index2 >= visibleFieldIds.length - 1, 29868 onClick: () => { 29869 const targetIndex = isRtl ? index2 - 1 : index2 + 1; 29870 const newFields = [ 29871 ...visibleFieldIds 29872 ]; 29873 newFields.splice(index2, 1); 29874 newFields.splice( 29875 targetIndex, 29876 0, 29877 fieldId 29878 ); 29879 onChangeView({ 29880 ...view, 29881 fields: newFields 29882 }); 29883 }, 29884 children: /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(menu_exports.ItemLabel, { children: (0, import_i18n21.__)("Move right") }) 29885 } 29886 ), 29887 canInsertLeft && !!hiddenFields.length && /* @__PURE__ */ (0, import_jsx_runtime120.jsxs)(menu_exports.SubmenuRoot, { children: [ 29888 /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(menu_exports.SubmenuTrigger, { children: /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(menu_exports.ItemLabel, { children: (0, import_i18n21.__)("Insert left") }) }), 29889 /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(menu_exports.Popup, { children: hiddenFields.map((hiddenField) => { 29890 const insertIndex = isRtl ? index2 + 1 : index2; 29891 return /* @__PURE__ */ (0, import_jsx_runtime120.jsx)( 29892 menu_exports.Item, 29893 { 29894 onClick: () => { 29895 onChangeView({ 29896 ...view, 29897 fields: [ 29898 ...visibleFieldIds.slice( 29899 0, 29900 insertIndex 29901 ), 29902 hiddenField.id, 29903 ...visibleFieldIds.slice( 29904 insertIndex 29905 ) 29906 ] 29907 }); 29908 }, 29909 children: /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(menu_exports.ItemLabel, { children: hiddenField.label }) 29910 }, 29911 hiddenField.id 29912 ); 29913 }) }) 29914 ] }), 29915 canInsertRight && !!hiddenFields.length && /* @__PURE__ */ (0, import_jsx_runtime120.jsxs)(menu_exports.SubmenuRoot, { children: [ 29916 /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(menu_exports.SubmenuTrigger, { children: /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(menu_exports.ItemLabel, { children: (0, import_i18n21.__)("Insert right") }) }), 29917 /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(menu_exports.Popup, { children: hiddenFields.map((hiddenField) => { 29918 const insertIndex = isRtl ? index2 : index2 + 1; 29919 return /* @__PURE__ */ (0, import_jsx_runtime120.jsx)( 29920 menu_exports.Item, 29921 { 29922 onClick: () => { 29923 onChangeView({ 29924 ...view, 29925 fields: [ 29926 ...visibleFieldIds.slice( 29927 0, 29928 insertIndex 29929 ), 29930 hiddenField.id, 29931 ...visibleFieldIds.slice( 29932 insertIndex 29933 ) 29934 ] 29935 }); 29936 }, 29937 children: /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(menu_exports.ItemLabel, { children: hiddenField.label }) 29938 }, 29939 hiddenField.id 29940 ); 29941 }) }) 29942 ] }), 29943 isHidable && field && /* @__PURE__ */ (0, import_jsx_runtime120.jsx)( 29944 menu_exports.Item, 29945 { 29946 prefix: /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(menu_exports.PrefixIcon, { icon: unseen_default }), 29947 onClick: () => { 29948 onHide(field); 29949 onChangeView({ 29950 ...view, 29951 fields: visibleFieldIds.filter( 29952 (id) => id !== fieldId 29953 ) 29954 }); 29955 }, 29956 children: /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(menu_exports.ItemLabel, { children: (0, import_i18n21.__)("Hide column") }) 29957 } 29958 ) 29959 ] }) 29960 ] }) }) 29961 ] }); 29962 }); 29963 var ColumnHeaderMenu = _HeaderMenu; 29964 var column_header_menu_default = ColumnHeaderMenu; 29965 29966 // packages/dataviews/build-module/components/dataviews-layouts/utils/item-click-wrapper.mjs 29967 var import_element77 = __toESM(require_element(), 1); 29968 var import_jsx_runtime121 = __toESM(require_jsx_runtime(), 1); 29969 function getClickableItemProps({ 29970 item, 29971 isItemClickable: isItemClickable2, 29972 onClickItem, 29973 className 29974 }) { 29975 if (!isItemClickable2(item) || !onClickItem) { 29976 return { className }; 29977 } 29978 return { 29979 className: className ? `$className} $className}--clickable` : void 0, 29980 role: "button", 29981 tabIndex: 0, 29982 onClick: (event) => { 29983 event.stopPropagation(); 29984 onClickItem(item); 29985 }, 29986 onKeyDown: (event) => { 29987 if (event.key === "Enter" || event.key === "" || event.key === " ") { 29988 event.stopPropagation(); 29989 onClickItem(item); 29990 } 29991 } 29992 }; 29993 } 29994 function ItemClickWrapper({ 29995 item, 29996 isItemClickable: isItemClickable2, 29997 onClickItem, 29998 renderItemLink, 29999 className, 30000 children, 30001 ...extraProps 30002 }) { 30003 if (!isItemClickable2(item)) { 30004 return /* @__PURE__ */ (0, import_jsx_runtime121.jsx)("div", { className, ...extraProps, children }); 30005 } 30006 if (renderItemLink) { 30007 const renderedElement = renderItemLink({ 30008 item, 30009 className: `$className} $className}--clickable`, 30010 ...extraProps, 30011 children 30012 }); 30013 return (0, import_element77.cloneElement)(renderedElement, { 30014 onClick: (event) => { 30015 event.stopPropagation(); 30016 if (renderedElement.props.onClick) { 30017 renderedElement.props.onClick(event); 30018 } 30019 }, 30020 onKeyDown: (event) => { 30021 if (event.key === "Enter" || event.key === "" || event.key === " ") { 30022 event.stopPropagation(); 30023 if (renderedElement.props.onKeyDown) { 30024 renderedElement.props.onKeyDown(event); 30025 } 30026 } 30027 } 30028 }); 30029 } 30030 const clickProps = getClickableItemProps({ 30031 item, 30032 isItemClickable: isItemClickable2, 30033 onClickItem, 30034 className 30035 }); 30036 return /* @__PURE__ */ (0, import_jsx_runtime121.jsx)("div", { ...clickProps, ...extraProps, children }); 30037 } 30038 30039 // packages/dataviews/build-module/components/dataviews-layouts/table/column-primary.mjs 30040 var import_jsx_runtime122 = __toESM(require_jsx_runtime(), 1); 30041 function ColumnPrimary({ 30042 item, 30043 level, 30044 titleField, 30045 mediaField, 30046 mediaAspectRatio, 30047 descriptionField: descriptionField2, 30048 onClickItem, 30049 renderItemLink, 30050 isItemClickable: isItemClickable2 30051 }) { 30052 let mediaSizes = "32px"; 30053 if (mediaAspectRatio) { 30054 const [ratioWidth, ratioHeight] = mediaAspectRatio.split("/").map(Number); 30055 mediaSizes = `$Math.min( 30056 60, 30057 Math.round(32 * ratioWidth / ratioHeight) 30058 )}px`; 30059 } 30060 return /* @__PURE__ */ (0, import_jsx_runtime122.jsxs)(Stack, { direction: "row", gap: "md", align: "flex-start", justify: "flex-start", children: [ 30061 mediaField && /* @__PURE__ */ (0, import_jsx_runtime122.jsx)( 30062 ItemClickWrapper, 30063 { 30064 item, 30065 isItemClickable: isItemClickable2, 30066 onClickItem, 30067 renderItemLink, 30068 className: "dataviews-view-table__cell-content-wrapper dataviews-column-primary__media", 30069 "aria-label": isItemClickable2(item) && (!!onClickItem || !!renderItemLink) && !!titleField ? titleField.getValue?.({ item }) : void 0, 30070 children: /* @__PURE__ */ (0, import_jsx_runtime122.jsx)( 30071 mediaField.render, 30072 { 30073 item, 30074 field: mediaField, 30075 config: { sizes: mediaSizes } 30076 } 30077 ) 30078 } 30079 ), 30080 /* @__PURE__ */ (0, import_jsx_runtime122.jsxs)( 30081 Stack, 30082 { 30083 direction: "column", 30084 align: "flex-start", 30085 className: "dataviews-view-table__primary-column-content", 30086 children: [ 30087 titleField && /* @__PURE__ */ (0, import_jsx_runtime122.jsxs)( 30088 ItemClickWrapper, 30089 { 30090 item, 30091 isItemClickable: isItemClickable2, 30092 onClickItem, 30093 renderItemLink, 30094 className: "dataviews-view-table__cell-content-wrapper dataviews-title-field", 30095 children: [ 30096 level !== void 0 && level > 0 && /* @__PURE__ */ (0, import_jsx_runtime122.jsxs)("span", { className: "dataviews-view-table__level", children: [ 30097 Array(level).fill("\u2014").join(" "), 30098 "\xA0" 30099 ] }), 30100 /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(titleField.render, { item, field: titleField }) 30101 ] 30102 } 30103 ), 30104 descriptionField2 && /* @__PURE__ */ (0, import_jsx_runtime122.jsx)( 30105 descriptionField2.render, 30106 { 30107 item, 30108 field: descriptionField2 30109 } 30110 ) 30111 ] 30112 } 30113 ) 30114 ] }); 30115 } 30116 var column_primary_default = ColumnPrimary; 30117 30118 // packages/dataviews/build-module/components/dataviews-layouts/table/use-scroll-state.mjs 30119 var import_element78 = __toESM(require_element(), 1); 30120 var import_i18n22 = __toESM(require_i18n(), 1); 30121 var isScrolledToEnd = (element) => { 30122 if ((0, import_i18n22.isRTL)()) { 30123 const scrollLeft = Math.abs(element.scrollLeft); 30124 return scrollLeft <= 1; 30125 } 30126 return element.scrollLeft + element.clientWidth >= element.scrollWidth - 1; 30127 }; 30128 function useScrollState({ 30129 scrollContainerRef, 30130 enabledHorizontal = false 30131 }) { 30132 const [isHorizontalScrollEnd, setIsHorizontalScrollEnd] = (0, import_element78.useState)(false); 30133 const [isVerticallyScrolled, setIsVerticallyScrolled] = (0, import_element78.useState)(false); 30134 const handleScroll = (0, import_element78.useCallback)(() => { 30135 const scrollContainer = scrollContainerRef.current; 30136 if (!scrollContainer) { 30137 return; 30138 } 30139 if (enabledHorizontal) { 30140 setIsHorizontalScrollEnd(isScrolledToEnd(scrollContainer)); 30141 } 30142 setIsVerticallyScrolled(scrollContainer.scrollTop > 0); 30143 }, [scrollContainerRef, enabledHorizontal]); 30144 (0, import_element78.useEffect)(() => { 30145 if (typeof window === "undefined" || !scrollContainerRef.current) { 30146 return () => { 30147 }; 30148 } 30149 const scrollContainer = scrollContainerRef.current; 30150 handleScroll(); 30151 scrollContainer.addEventListener("scroll", handleScroll); 30152 window.addEventListener("resize", handleScroll); 30153 return () => { 30154 scrollContainer.removeEventListener("scroll", handleScroll); 30155 window.removeEventListener("resize", handleScroll); 30156 }; 30157 }, [scrollContainerRef, enabledHorizontal, handleScroll]); 30158 return { isHorizontalScrollEnd, isVerticallyScrolled }; 30159 } 30160 30161 // packages/dataviews/build-module/components/dataviews-layouts/utils/get-data-by-group.mjs 30162 function getDataByGroup(data, groupByField) { 30163 return data.reduce((groups, item) => { 30164 const groupName = groupByField.getValue({ item }); 30165 if (!groups.has(groupName)) { 30166 groups.set(groupName, []); 30167 } 30168 groups.get(groupName)?.push(item); 30169 return groups; 30170 }, /* @__PURE__ */ new Map()); 30171 } 30172 30173 // packages/dataviews/build-module/components/dataviews-layouts/utils/use-selection-props.mjs 30174 var import_element79 = __toESM(require_element(), 1); 30175 var import_keycodes = __toESM(require_keycodes(), 1); 30176 function getRange(orderedIds, fromIndex, toIndex) { 30177 return orderedIds.slice( 30178 Math.min(fromIndex, toIndex), 30179 Math.max(fromIndex, toIndex) + 1 30180 ); 30181 } 30182 function getRangeSelection({ 30183 anchorId, 30184 targetId, 30185 lastTargetId, 30186 orderedIds, 30187 selection 30188 }) { 30189 const targetIndex = orderedIds.indexOf(targetId); 30190 if (targetIndex === -1) { 30191 return selection; 30192 } 30193 const anchorIndex = anchorId === null ? -1 : orderedIds.indexOf(anchorId); 30194 const hasAnchor = anchorIndex !== -1; 30195 const rangeStart = hasAnchor ? anchorIndex : targetIndex; 30196 const lastTargetIndex = hasAnchor && lastTargetId !== null ? orderedIds.indexOf(lastTargetId) : -1; 30197 const lastRange = lastTargetIndex === -1 ? [] : getRange(orderedIds, rangeStart, lastTargetIndex); 30198 const base = selection.filter((id) => !lastRange.includes(id)); 30199 return [ 30200 .../* @__PURE__ */ new Set([ 30201 ...base, 30202 ...getRange(orderedIds, rangeStart, targetIndex) 30203 ]) 30204 ]; 30205 } 30206 function getClosestSelectedId({ 30207 targetId, 30208 orderedIds, 30209 selection 30210 }) { 30211 const targetIndex = orderedIds.indexOf(targetId); 30212 if (targetIndex === -1) { 30213 return null; 30214 } 30215 const selectedIds = new Set(selection); 30216 let closestId = null; 30217 let closestDistance = Infinity; 30218 orderedIds.forEach((id, index2) => { 30219 if (!selectedIds.has(id)) { 30220 return; 30221 } 30222 const distance = Math.abs(index2 - targetIndex); 30223 if (distance < closestDistance) { 30224 closestDistance = distance; 30225 closestId = id; 30226 } 30227 }); 30228 return closestId; 30229 } 30230 function useSelectionProps({ 30231 data, 30232 getItemId, 30233 isItemSelectable, 30234 selection, 30235 onChangeSelection, 30236 selectionMode, 30237 shouldSelectOnClick 30238 }) { 30239 const isMultiselect = selectionMode === "multi"; 30240 const allowDeselect = selectionMode !== "single-required"; 30241 const gestureRef = (0, import_element79.useRef)(null); 30242 const anchorTo = (id) => { 30243 gestureRef.current = { anchorId: id, lastTargetId: null }; 30244 }; 30245 const isTouchDeviceRef = (0, import_element79.useRef)(false); 30246 (0, import_element79.useEffect)(() => { 30247 const markTouchDevice = () => { 30248 isTouchDeviceRef.current = true; 30249 }; 30250 document.addEventListener("touchstart", markTouchDevice, { 30251 once: true 30252 }); 30253 return () => document.removeEventListener("touchstart", markTouchDevice); 30254 }, []); 30255 const selectableIds = data.filter(isItemSelectable).map(getItemId); 30256 const selectableIdSet = new Set(selectableIds); 30257 const hasSelectableItems = selectableIds.length > 0; 30258 const hasRangeGesture = hasSelectableItems && isMultiselect; 30259 const getSelectionProps = (id) => { 30260 const isSelectable = selectableIdSet.has(id); 30261 return { 30262 // When a plain click selects, that click is also what anchors the 30263 // range a following Shift+Click extends from. Modifier clicks never 30264 // reach here: `onClickCapture` stops them. 30265 ...shouldSelectOnClick && { 30266 onClick: () => { 30267 if (allowDeselect && selection.includes(id)) { 30268 onChangeSelection( 30269 selection.filter((itemId) => id !== itemId) 30270 ); 30271 } else { 30272 onChangeSelection( 30273 isMultiselect ? [...selection, id] : [id] 30274 ); 30275 } 30276 anchorTo(id); 30277 } 30278 }, 30279 onMouseDown: (event) => { 30280 if (event.button === 0 && event.shiftKey && hasRangeGesture) { 30281 event.preventDefault(); 30282 } 30283 }, 30284 onClickCapture: (event) => { 30285 if (!hasRangeGesture) { 30286 return; 30287 } 30288 const isModifierKeyPressed = (0, import_keycodes.isAppleOS)() ? event.metaKey : event.ctrlKey; 30289 const isSelectionCheckboxClick = event.target instanceof Element && !!event.target.closest(`.$SELECTION_CHECKBOX_CLASS}`); 30290 if (!isModifierKeyPressed && !event.shiftKey) { 30291 if (isSelectable && isSelectionCheckboxClick) { 30292 anchorTo(id); 30293 } 30294 return; 30295 } 30296 if (isTouchDeviceRef.current || document.getSelection()?.type === "Range") { 30297 return; 30298 } 30299 event.stopPropagation(); 30300 if (!isSelectionCheckboxClick) { 30301 event.preventDefault(); 30302 } 30303 if (!isSelectable) { 30304 return; 30305 } 30306 if (event.shiftKey) { 30307 let gesture = gestureRef.current; 30308 if (!gesture || !selectableIdSet.has(gesture.anchorId)) { 30309 gesture = { 30310 anchorId: getClosestSelectedId({ 30311 targetId: id, 30312 orderedIds: selectableIds, 30313 selection 30314 }) ?? id, 30315 lastTargetId: null 30316 }; 30317 } 30318 onChangeSelection( 30319 getRangeSelection({ 30320 anchorId: gesture.anchorId, 30321 targetId: id, 30322 lastTargetId: gesture.lastTargetId, 30323 orderedIds: selectableIds, 30324 selection 30325 }) 30326 ); 30327 gestureRef.current = { 30328 anchorId: gesture.anchorId, 30329 lastTargetId: id 30330 }; 30331 } else { 30332 onChangeSelection( 30333 selection.includes(id) ? selection.filter((itemId) => id !== itemId) : [...selection, id] 30334 ); 30335 anchorTo(id); 30336 } 30337 } 30338 }; 30339 }; 30340 return { getSelectionProps }; 30341 } 30342 30343 // packages/dataviews/build-module/components/dataviews-view-config/properties-section.mjs 30344 var import_components6 = __toESM(require_components(), 1); 30345 var import_i18n23 = __toESM(require_i18n(), 1); 30346 var import_element80 = __toESM(require_element(), 1); 30347 var import_jsx_runtime123 = __toESM(require_jsx_runtime(), 1); 30348 function FieldItem3({ 30349 field, 30350 isVisible: isVisible2, 30351 onToggleVisibility 30352 }) { 30353 return /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(import_components6.__experimentalItem, { onClick: field.enableHiding ? onToggleVisibility : void 0, children: /* @__PURE__ */ (0, import_jsx_runtime123.jsxs)(Stack, { direction: "row", gap: "sm", justify: "flex-start", align: "center", children: [ 30354 /* @__PURE__ */ (0, import_jsx_runtime123.jsx)("div", { style: { height: 24, width: 24 }, children: isVisible2 && /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(import_components6.Icon, { icon: check_default }) }), 30355 /* @__PURE__ */ (0, import_jsx_runtime123.jsx)("span", { className: "dataviews-view-config__label", children: field.label }) 30356 ] }) }); 30357 } 30358 function isDefined(item) { 30359 return !!item; 30360 } 30361 function PropertiesSection({ 30362 showLabel = true 30363 }) { 30364 const { view, fields, onChangeView } = (0, import_element80.useContext)(dataviews_context_default); 30365 const regularFields = getHideableFields(view, fields); 30366 if (!regularFields?.length) { 30367 return null; 30368 } 30369 const titleField = fields.find((f) => f.id === view.titleField); 30370 const previewField = fields.find((f) => f.id === view.mediaField); 30371 const descriptionField2 = fields.find( 30372 (f) => f.id === view.descriptionField 30373 ); 30374 const lockedFields = [ 30375 { 30376 field: titleField, 30377 isVisibleFlag: "showTitle" 30378 }, 30379 { 30380 field: previewField, 30381 isVisibleFlag: "showMedia" 30382 }, 30383 { 30384 field: descriptionField2, 30385 isVisibleFlag: "showDescription" 30386 } 30387 ].filter(({ field }) => isDefined(field)); 30388 const visibleFieldIds = view.fields ?? []; 30389 const visibleRegularFieldsCount = regularFields.filter( 30390 (f) => visibleFieldIds.includes(f.id) 30391 ).length; 30392 const visibleLockedFields = lockedFields.filter( 30393 ({ isVisibleFlag }) => view[isVisibleFlag] ?? true 30394 ); 30395 const totalVisibleFields = visibleLockedFields.length + visibleRegularFieldsCount; 30396 const isSingleVisibleLockedField = totalVisibleFields === 1 && visibleLockedFields.length === 1; 30397 return /* @__PURE__ */ (0, import_jsx_runtime123.jsxs)(Stack, { direction: "column", className: "dataviews-field-control", children: [ 30398 showLabel && /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(import_components6.BaseControl.VisualLabel, { children: (0, import_i18n23.__)("Properties") }), 30399 /* @__PURE__ */ (0, import_jsx_runtime123.jsx)( 30400 Stack, 30401 { 30402 direction: "column", 30403 className: "dataviews-view-config__properties", 30404 children: /* @__PURE__ */ (0, import_jsx_runtime123.jsxs)(import_components6.__experimentalItemGroup, { isBordered: true, isSeparated: true, size: "medium", children: [ 30405 lockedFields.map(({ field, isVisibleFlag }) => { 30406 const isVisible2 = view[isVisibleFlag] ?? true; 30407 const fieldToRender = isSingleVisibleLockedField && isVisible2 ? { ...field, enableHiding: false } : field; 30408 return /* @__PURE__ */ (0, import_jsx_runtime123.jsx)( 30409 FieldItem3, 30410 { 30411 field: fieldToRender, 30412 isVisible: isVisible2, 30413 onToggleVisibility: () => { 30414 onChangeView({ 30415 ...view, 30416 [isVisibleFlag]: !isVisible2 30417 }); 30418 } 30419 }, 30420 field.id 30421 ); 30422 }), 30423 regularFields.map((field) => { 30424 const isVisible2 = visibleFieldIds.includes(field.id); 30425 const fieldToRender = totalVisibleFields === 1 && isVisible2 ? { ...field, enableHiding: false } : field; 30426 return /* @__PURE__ */ (0, import_jsx_runtime123.jsx)( 30427 FieldItem3, 30428 { 30429 field: fieldToRender, 30430 isVisible: isVisible2, 30431 onToggleVisibility: () => { 30432 onChangeView({ 30433 ...view, 30434 fields: isVisible2 ? visibleFieldIds.filter( 30435 (fieldId) => fieldId !== field.id 30436 ) : [...visibleFieldIds, field.id] 30437 }); 30438 } 30439 }, 30440 field.id 30441 ); 30442 }) 30443 ] }) 30444 } 30445 ) 30446 ] }); 30447 } 30448 30449 // packages/dataviews/build-module/hooks/use-delayed-loading.mjs 30450 var import_element81 = __toESM(require_element(), 1); 30451 function useDelayedLoading(isLoading, options = { delay: 400 }) { 30452 const [showLoader, setShowLoader] = (0, import_element81.useState)(false); 30453 (0, import_element81.useEffect)(() => { 30454 if (!isLoading) { 30455 return; 30456 } 30457 const timeout = setTimeout(() => { 30458 setShowLoader(true); 30459 }, options.delay); 30460 return () => { 30461 clearTimeout(timeout); 30462 setShowLoader(false); 30463 }; 30464 }, [isLoading, options.delay]); 30465 return showLoader; 30466 } 30467 30468 // packages/dataviews/build-module/components/dataviews-layouts/table/index.mjs 30469 var import_jsx_runtime124 = __toESM(require_jsx_runtime(), 1); 30470 function getEffectiveAlign(explicitAlign, fieldType) { 30471 if (explicitAlign) { 30472 return explicitAlign; 30473 } 30474 if (fieldType === "integer" || fieldType === "number") { 30475 return "end"; 30476 } 30477 return void 0; 30478 } 30479 function TableColumnField({ 30480 item, 30481 fields, 30482 column, 30483 align 30484 }) { 30485 const field = fields.find((f) => f.id === column); 30486 if (!field) { 30487 return null; 30488 } 30489 const className = clsx_default("dataviews-view-table__cell-content-wrapper", { 30490 "dataviews-view-table__cell-align-end": align === "end", 30491 "dataviews-view-table__cell-align-center": align === "center" 30492 }); 30493 return /* @__PURE__ */ (0, import_jsx_runtime124.jsx)("div", { className, children: /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(field.render, { item, field }) }); 30494 } 30495 function TableRow({ 30496 hasBulkActions, 30497 item, 30498 level, 30499 actions, 30500 fields, 30501 id, 30502 view, 30503 titleField, 30504 mediaField, 30505 mediaAspectRatio, 30506 descriptionField: descriptionField2, 30507 selection, 30508 getItemId, 30509 isItemClickable: isItemClickable2, 30510 onClickItem, 30511 renderItemLink, 30512 onChangeSelection, 30513 onMouseDown, 30514 onClickCapture, 30515 isActionsColumnSticky, 30516 posinset 30517 }) { 30518 const { paginationInfo } = (0, import_element82.useContext)(dataviews_context_default); 30519 const hasPossibleBulkAction = useHasAPossibleBulkAction(actions, item); 30520 const isSelected2 = hasPossibleBulkAction && selection.includes(id); 30521 const { 30522 showTitle = true, 30523 showMedia = true, 30524 showDescription = true, 30525 infiniteScrollEnabled 30526 } = view; 30527 const columns = getTableColumns(view, fields); 30528 const hasPrimaryColumn = titleField && showTitle || mediaField && showMedia || descriptionField2 && showDescription; 30529 return /* @__PURE__ */ (0, import_jsx_runtime124.jsxs)( 30530 "tr", 30531 { 30532 className: clsx_default("dataviews-view-table__row", { 30533 "is-selected": hasPossibleBulkAction && isSelected2, 30534 "has-bulk-actions": hasPossibleBulkAction 30535 }), 30536 "aria-setsize": infiniteScrollEnabled ? paginationInfo.totalItems : void 0, 30537 "aria-posinset": posinset, 30538 role: infiniteScrollEnabled ? "article" : void 0, 30539 onClickCapture, 30540 onMouseDown: (event) => { 30541 const isMetaClick = (0, import_keycodes2.isAppleOS)() ? event.metaKey : event.ctrlKey; 30542 if (event.button === 0 && isMetaClick && window.navigator.userAgent.toLowerCase().includes("firefox")) { 30543 event.preventDefault(); 30544 } 30545 onMouseDown(event); 30546 }, 30547 children: [ 30548 hasBulkActions && /* @__PURE__ */ (0, import_jsx_runtime124.jsx)("td", { className: "dataviews-view-table__checkbox-column", children: /* @__PURE__ */ (0, import_jsx_runtime124.jsx)("div", { className: "dataviews-view-table__cell-content-wrapper", children: /* @__PURE__ */ (0, import_jsx_runtime124.jsx)( 30549 DataViewsSelectionCheckbox, 30550 { 30551 item, 30552 selection, 30553 onChangeSelection, 30554 getItemId, 30555 titleField, 30556 disabled: !hasPossibleBulkAction 30557 } 30558 ) }) }), 30559 hasPrimaryColumn && /* @__PURE__ */ (0, import_jsx_runtime124.jsx)("td", { children: /* @__PURE__ */ (0, import_jsx_runtime124.jsx)( 30560 column_primary_default, 30561 { 30562 item, 30563 level, 30564 titleField: showTitle ? titleField : void 0, 30565 mediaField: showMedia ? mediaField : void 0, 30566 mediaAspectRatio, 30567 descriptionField: showDescription ? descriptionField2 : void 0, 30568 isItemClickable: isItemClickable2, 30569 onClickItem, 30570 renderItemLink 30571 } 30572 ) }), 30573 columns.map((column) => { 30574 const { width, maxWidth, minWidth, align } = view.layout?.styles?.[column] ?? {}; 30575 const field = fields.find((f) => f.id === column); 30576 const effectiveAlign = getEffectiveAlign(align, field?.type); 30577 return /* @__PURE__ */ (0, import_jsx_runtime124.jsx)( 30578 "td", 30579 { 30580 style: { 30581 width, 30582 maxWidth, 30583 minWidth 30584 }, 30585 children: /* @__PURE__ */ (0, import_jsx_runtime124.jsx)( 30586 TableColumnField, 30587 { 30588 fields, 30589 item, 30590 column, 30591 align: effectiveAlign 30592 } 30593 ) 30594 }, 30595 column 30596 ); 30597 }), 30598 !!actions?.length && // Disable reason: we are not making the element interactive, 30599 // but preventing any click events from bubbling up to the 30600 // table row. This allows us to add a click handler to the row 30601 // itself (to toggle row selection) without erroneously 30602 // intercepting click events from ItemActions. 30603 /* @__PURE__ */ (0, import_jsx_runtime124.jsx)( 30604 "td", 30605 { 30606 className: clsx_default("dataviews-view-table__actions-column", { 30607 "dataviews-view-table__actions-column--sticky": true, 30608 "dataviews-view-table__actions-column--stuck": isActionsColumnSticky 30609 }), 30610 onClick: (e) => e.stopPropagation(), 30611 children: /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(ItemActions, { item, actions }) 30612 } 30613 ) 30614 ] 30615 } 30616 ); 30617 } 30618 function ViewTable({ 30619 actions, 30620 data, 30621 fields, 30622 getItemId, 30623 getItemLevel, 30624 isLoading = false, 30625 onChangeView, 30626 onChangeSelection, 30627 selection, 30628 setOpenedFilter, 30629 onClickItem, 30630 isItemClickable: isItemClickable2, 30631 renderItemLink, 30632 view, 30633 className, 30634 empty 30635 }) { 30636 const { containerRef } = (0, import_element82.useContext)(dataviews_context_default); 30637 const isDelayedLoading = useDelayedLoading(isLoading); 30638 const groupField = view.groupBy?.field ? fields.find((f) => f.id === view.groupBy?.field) : null; 30639 const dataByGroup = groupField ? getDataByGroup(data, groupField) : null; 30640 const orderedData = dataByGroup ? Array.from(dataByGroup.values()).flat() : data; 30641 const { getSelectionProps } = useSelectionProps({ 30642 data: orderedData, 30643 getItemId, 30644 isItemSelectable: (item) => hasAPossibleBulkAction(actions, item), 30645 selection, 30646 onChangeSelection, 30647 selectionMode: "multi", 30648 shouldSelectOnClick: false 30649 }); 30650 const headerMenuRefs = (0, import_element82.useRef)(/* @__PURE__ */ new Map()); 30651 const headerMenuToFocusRef = (0, import_element82.useRef)(void 0); 30652 const [nextHeaderMenuToFocus, setNextHeaderMenuToFocus] = (0, import_element82.useState)(); 30653 const [contextMenuAnchor, setContextMenuAnchor] = (0, import_element82.useState)(null); 30654 (0, import_element82.useEffect)(() => { 30655 if (headerMenuToFocusRef.current) { 30656 headerMenuToFocusRef.current.focus(); 30657 headerMenuToFocusRef.current = void 0; 30658 } 30659 }); 30660 const tableNoticeId = (0, import_element82.useId)(); 30661 const { isHorizontalScrollEnd, isVerticallyScrolled } = useScrollState({ 30662 scrollContainerRef: containerRef, 30663 enabledHorizontal: !!actions?.length 30664 }); 30665 const hasBulkActions = useSomeItemHasAPossibleBulkAction(actions, data); 30666 if (nextHeaderMenuToFocus) { 30667 headerMenuToFocusRef.current = nextHeaderMenuToFocus; 30668 setNextHeaderMenuToFocus(void 0); 30669 return; 30670 } 30671 const onHide = (field) => { 30672 const hidden = headerMenuRefs.current.get(field.id); 30673 const fallback = hidden ? headerMenuRefs.current.get(hidden.fallback) : void 0; 30674 setNextHeaderMenuToFocus(fallback?.node); 30675 }; 30676 const handleHeaderContextMenu = (event) => { 30677 event.preventDefault(); 30678 event.stopPropagation(); 30679 const virtualAnchor = { 30680 getBoundingClientRect: () => ({ 30681 x: event.clientX, 30682 y: event.clientY, 30683 top: event.clientY, 30684 left: event.clientX, 30685 right: event.clientX, 30686 bottom: event.clientY, 30687 width: 0, 30688 height: 0, 30689 toJSON: () => ({}) 30690 }) 30691 }; 30692 window.requestAnimationFrame(() => { 30693 setContextMenuAnchor(virtualAnchor); 30694 }); 30695 }; 30696 const hasData = !!data?.length; 30697 const titleField = fields.find((field) => field.id === view.titleField); 30698 const mediaField = fields.find((field) => field.id === view.mediaField); 30699 const descriptionField2 = fields.find( 30700 (field) => field.id === view.descriptionField 30701 ); 30702 const { showTitle = true, showMedia = true, showDescription = true } = view; 30703 const hasPrimaryColumn = titleField && showTitle || mediaField && showMedia || descriptionField2 && showDescription; 30704 const columns = getTableColumns(view, fields); 30705 const headerMenuRef = (column, index2) => (node) => { 30706 if (node) { 30707 headerMenuRefs.current.set(column, { 30708 node, 30709 fallback: columns[index2 > 0 ? index2 - 1 : 1] 30710 }); 30711 } else { 30712 headerMenuRefs.current.delete(column); 30713 } 30714 }; 30715 const isInfiniteScroll = view.infiniteScrollEnabled && !dataByGroup; 30716 const isRtl = (0, import_i18n24.isRTL)(); 30717 const mediaAspectRatio = view.layout?.aspectRatio && MEDIA_ASPECT_RATIOS.includes(view.layout.aspectRatio) ? view.layout.aspectRatio : void 0; 30718 const tableStyle = { 30719 "--wp-dataviews-media-aspect-ratio": mediaAspectRatio ?? "1/1" 30720 }; 30721 if (!hasData) { 30722 return /* @__PURE__ */ (0, import_jsx_runtime124.jsx)( 30723 "div", 30724 { 30725 className: clsx_default("dataviews-no-results", { 30726 "is-refreshing": isDelayedLoading 30727 }), 30728 id: tableNoticeId, 30729 children: empty 30730 } 30731 ); 30732 } 30733 return /* @__PURE__ */ (0, import_jsx_runtime124.jsxs)(import_jsx_runtime124.Fragment, { children: [ 30734 /* @__PURE__ */ (0, import_jsx_runtime124.jsxs)( 30735 "table", 30736 { 30737 className: clsx_default("dataviews-view-table", className, { 30738 [`has-$view.layout?.density}-density`]: view.layout?.density && ["compact", "comfortable"].includes( 30739 view.layout.density 30740 ), 30741 "has-bulk-actions": hasBulkActions, 30742 "is-refreshing": !isInfiniteScroll && isDelayedLoading, 30743 "has-media-aspect-ratio": !!mediaAspectRatio 30744 }), 30745 style: tableStyle, 30746 "aria-busy": isLoading, 30747 "aria-describedby": tableNoticeId, 30748 role: isInfiniteScroll ? "feed" : void 0, 30749 inert: !isInfiniteScroll && isLoading ? "true" : void 0, 30750 children: [ 30751 /* @__PURE__ */ (0, import_jsx_runtime124.jsxs)("colgroup", { children: [ 30752 hasBulkActions && /* @__PURE__ */ (0, import_jsx_runtime124.jsx)("col", { className: "dataviews-view-table__col-checkbox" }), 30753 hasPrimaryColumn && /* @__PURE__ */ (0, import_jsx_runtime124.jsx)("col", { className: "dataviews-view-table__col-first-data" }), 30754 columns.map((column, index2) => /* @__PURE__ */ (0, import_jsx_runtime124.jsx)( 30755 "col", 30756 { 30757 className: clsx_default( 30758 `dataviews-view-table__col-$column}`, 30759 { 30760 "dataviews-view-table__col-expand": !hasPrimaryColumn && index2 === columns.length - 1 30761 } 30762 ) 30763 }, 30764 `col-$column}` 30765 )), 30766 !!actions?.length && /* @__PURE__ */ (0, import_jsx_runtime124.jsx)("col", { className: "dataviews-view-table__col-actions" }) 30767 ] }), 30768 contextMenuAnchor && /* @__PURE__ */ (0, import_jsx_runtime124.jsx)( 30769 import_components7.Popover, 30770 { 30771 anchor: contextMenuAnchor, 30772 onClose: () => setContextMenuAnchor(null), 30773 placement: "bottom-start", 30774 children: /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(PropertiesSection, { showLabel: false }) 30775 } 30776 ), 30777 /* @__PURE__ */ (0, import_jsx_runtime124.jsx)( 30778 "thead", 30779 { 30780 className: clsx_default({ 30781 "dataviews-view-table__thead--stuck": isVerticallyScrolled 30782 }), 30783 onContextMenu: handleHeaderContextMenu, 30784 children: /* @__PURE__ */ (0, import_jsx_runtime124.jsxs)("tr", { className: "dataviews-view-table__row", children: [ 30785 hasBulkActions && /* @__PURE__ */ (0, import_jsx_runtime124.jsx)( 30786 "th", 30787 { 30788 className: "dataviews-view-table__checkbox-column", 30789 scope: "col", 30790 onContextMenu: handleHeaderContextMenu, 30791 children: /* @__PURE__ */ (0, import_jsx_runtime124.jsx)( 30792 BulkSelectionCheckbox, 30793 { 30794 selection, 30795 onChangeSelection, 30796 data, 30797 actions, 30798 getItemId 30799 } 30800 ) 30801 } 30802 ), 30803 hasPrimaryColumn && /* @__PURE__ */ (0, import_jsx_runtime124.jsx)("th", { scope: "col", children: titleField && /* @__PURE__ */ (0, import_jsx_runtime124.jsx)( 30804 column_header_menu_default, 30805 { 30806 ref: headerMenuRef( 30807 titleField.id, 30808 0 30809 ), 30810 fieldId: titleField.id, 30811 view, 30812 fields, 30813 onChangeView, 30814 onHide, 30815 setOpenedFilter, 30816 canMove: false, 30817 canInsertLeft: isRtl ? view.layout?.enableMoving ?? true : false, 30818 canInsertRight: isRtl ? false : view.layout?.enableMoving ?? true 30819 } 30820 ) }), 30821 columns.map((column, index2) => { 30822 const { width, maxWidth, minWidth, align } = view.layout?.styles?.[column] ?? {}; 30823 const field = fields.find( 30824 (f) => f.id === column 30825 ); 30826 const effectiveAlign = getEffectiveAlign( 30827 align, 30828 field?.type 30829 ); 30830 const canInsertOrMove = view.layout?.enableMoving ?? true; 30831 return /* @__PURE__ */ (0, import_jsx_runtime124.jsx)( 30832 "th", 30833 { 30834 style: { 30835 width, 30836 maxWidth, 30837 minWidth, 30838 textAlign: effectiveAlign 30839 }, 30840 "aria-sort": view.sort?.direction && view.sort?.field === column ? sortValues[view.sort.direction] : void 0, 30841 scope: "col", 30842 children: /* @__PURE__ */ (0, import_jsx_runtime124.jsx)( 30843 column_header_menu_default, 30844 { 30845 ref: headerMenuRef(column, index2), 30846 fieldId: column, 30847 view, 30848 fields, 30849 onChangeView, 30850 onHide, 30851 setOpenedFilter, 30852 canMove: canInsertOrMove, 30853 canInsertLeft: canInsertOrMove, 30854 canInsertRight: canInsertOrMove 30855 } 30856 ) 30857 }, 30858 column 30859 ); 30860 }), 30861 !!actions?.length && /* @__PURE__ */ (0, import_jsx_runtime124.jsx)( 30862 "th", 30863 { 30864 className: clsx_default( 30865 "dataviews-view-table__actions-column", 30866 { 30867 "dataviews-view-table__actions-column--sticky": true, 30868 "dataviews-view-table__actions-column--stuck": !isHorizontalScrollEnd 30869 } 30870 ), 30871 children: /* @__PURE__ */ (0, import_jsx_runtime124.jsx)("span", { className: "dataviews-view-table-header", children: (0, import_i18n24.__)("Actions") }) 30872 } 30873 ) 30874 ] }) 30875 } 30876 ), 30877 hasData && groupField && dataByGroup ? Array.from(dataByGroup.entries()).map( 30878 ([groupName, groupItems]) => /* @__PURE__ */ (0, import_jsx_runtime124.jsxs)("tbody", { children: [ 30879 /* @__PURE__ */ (0, import_jsx_runtime124.jsx)("tr", { className: "dataviews-view-table__group-header-row", children: /* @__PURE__ */ (0, import_jsx_runtime124.jsx)( 30880 "td", 30881 { 30882 colSpan: columns.length + (hasPrimaryColumn ? 1 : 0) + (hasBulkActions ? 1 : 0) + (actions?.length ? 1 : 0), 30883 className: "dataviews-view-table__group-header-cell", 30884 children: view.groupBy?.showLabel === false ? groupName : (0, import_i18n24.sprintf)( 30885 // translators: 1: The label of the field e.g. "Date". 2: The value of the field, e.g.: "May 2022". 30886 (0, import_i18n24.__)("%1$s: %2$s"), 30887 groupField.label, 30888 groupName 30889 ) 30890 } 30891 ) }), 30892 groupItems.map((item, index2) => { 30893 const id = getItemId(item) || index2.toString(); 30894 return /* @__PURE__ */ (0, import_jsx_runtime124.jsx)( 30895 TableRow, 30896 { 30897 item, 30898 level: view.showLevels && typeof getItemLevel === "function" ? getItemLevel(item) : void 0, 30899 hasBulkActions, 30900 actions, 30901 fields, 30902 id, 30903 view, 30904 titleField, 30905 mediaField, 30906 mediaAspectRatio, 30907 descriptionField: descriptionField2, 30908 selection, 30909 getItemId, 30910 onChangeSelection, 30911 ...getSelectionProps(id), 30912 onClickItem, 30913 renderItemLink, 30914 isItemClickable: isItemClickable2, 30915 isActionsColumnSticky: !isHorizontalScrollEnd 30916 }, 30917 getItemId(item) 30918 ); 30919 }) 30920 ] }, `group-$groupName}`) 30921 ) : /* @__PURE__ */ (0, import_jsx_runtime124.jsx)("tbody", { children: hasData && data.map((item, index2) => { 30922 const id = getItemId(item) || index2.toString(); 30923 return /* @__PURE__ */ (0, import_jsx_runtime124.jsx)( 30924 TableRow, 30925 { 30926 item, 30927 level: view.showLevels && typeof getItemLevel === "function" ? getItemLevel(item) : void 0, 30928 hasBulkActions, 30929 actions, 30930 fields, 30931 id, 30932 view, 30933 titleField, 30934 mediaField, 30935 mediaAspectRatio, 30936 descriptionField: descriptionField2, 30937 selection, 30938 getItemId, 30939 onChangeSelection, 30940 ...getSelectionProps(id), 30941 onClickItem, 30942 renderItemLink, 30943 isItemClickable: isItemClickable2, 30944 isActionsColumnSticky: !isHorizontalScrollEnd, 30945 posinset: isInfiniteScroll ? index2 + 1 : void 0 30946 }, 30947 getItemId(item) 30948 ); 30949 }) }) 30950 ] 30951 } 30952 ), 30953 isInfiniteScroll && isLoading && /* @__PURE__ */ (0, import_jsx_runtime124.jsx)("div", { className: "dataviews-loading", id: tableNoticeId, children: /* @__PURE__ */ (0, import_jsx_runtime124.jsx)("p", { className: "dataviews-loading-more", children: /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(import_components7.Spinner, {}) }) }) 30954 ] }); 30955 } 30956 var table_default = ViewTable; 30957 30958 // packages/dataviews/build-module/components/dataviews-layouts/grid/index.mjs 30959 var import_components10 = __toESM(require_components(), 1); 30960 var import_i18n27 = __toESM(require_i18n(), 1); 30961 30962 // packages/dataviews/build-module/components/dataviews-layouts/grid/composite-grid.mjs 30963 var import_components9 = __toESM(require_components(), 1); 30964 var import_i18n26 = __toESM(require_i18n(), 1); 30965 var import_compose7 = __toESM(require_compose(), 1); 30966 var import_element86 = __toESM(require_element(), 1); 30967 30968 // packages/dataviews/build-module/components/dataviews-layouts/grid/preview-size-picker.mjs 30969 var import_components8 = __toESM(require_components(), 1); 30970 var import_i18n25 = __toESM(require_i18n(), 1); 30971 var import_element83 = __toESM(require_element(), 1); 30972 var import_jsx_runtime125 = __toESM(require_jsx_runtime(), 1); 30973 var imageSizes = [ 30974 { 30975 value: 120, 30976 breakpoint: 1 30977 }, 30978 { 30979 value: 170, 30980 breakpoint: 1 30981 }, 30982 { 30983 value: 230, 30984 breakpoint: 1 30985 }, 30986 { 30987 value: 290, 30988 breakpoint: 1112 30989 // at minimum image width, 4 images display at this container size 30990 }, 30991 { 30992 value: 350, 30993 breakpoint: 1636 30994 // at minimum image width, 6 images display at this container size 30995 }, 30996 { 30997 value: 430, 30998 breakpoint: 588 30999 // at minimum image width, 2 images display at this container size 31000 } 31001 ]; 31002 var DEFAULT_PREVIEW_SIZE = imageSizes[2].value; 31003 function useGridColumns() { 31004 const context = (0, import_element83.useContext)(dataviews_context_default); 31005 const view = context.view; 31006 return (0, import_element83.useMemo)(() => { 31007 const containerWidth = context.containerWidth; 31008 const gap = 32; 31009 const previewSize = view.layout?.previewSize ?? DEFAULT_PREVIEW_SIZE; 31010 const columns = Math.floor( 31011 (containerWidth + gap) / (previewSize + gap) 31012 ); 31013 return Math.max(1, columns); 31014 }, [context.containerWidth, view.layout?.previewSize]); 31015 } 31016 31017 // packages/dataviews/build-module/components/dataviews-layouts/utils/grid-items.mjs 31018 var import_element84 = __toESM(require_element(), 1); 31019 var import_jsx_runtime126 = __toESM(require_jsx_runtime(), 1); 31020 var GridItems = (0, import_element84.forwardRef)(({ className, previewSize, style, ...props }, ref) => { 31021 return /* @__PURE__ */ (0, import_jsx_runtime126.jsx)( 31022 "div", 31023 { 31024 ref, 31025 className: clsx_default("dataviews-view-grid-items", className), 31026 style: { 31027 gridTemplateColumns: previewSize && `repeat(auto-fill, minmax($previewSize}px, 1fr))`, 31028 ...style 31029 }, 31030 ...props 31031 } 31032 ); 31033 }); 31034 31035 // packages/dataviews/build-module/components/dataviews-layouts/utils/use-infinite-scroll.mjs 31036 var import_element85 = __toESM(require_element(), 1); 31037 function useIntersectionObserver(elementRef, posinset) { 31038 const { intersectionObserver } = (0, import_element85.useContext)(dataviews_context_default); 31039 (0, import_element85.useEffect)(() => { 31040 const element = elementRef.current; 31041 if (!element || posinset === void 0 || !intersectionObserver) { 31042 return; 31043 } 31044 intersectionObserver.observe(element); 31045 return () => { 31046 intersectionObserver.unobserve(element); 31047 }; 31048 }, [elementRef, intersectionObserver, posinset]); 31049 } 31050 function usePlaceholdersNeeded(data, isInfiniteScroll, gridColumns) { 31051 const hasData = !!data?.length; 31052 const firstItemPosition = hasData && isInfiniteScroll ? data[0].position : void 0; 31053 return firstItemPosition && gridColumns ? (firstItemPosition - 1) % gridColumns : 0; 31054 } 31055 31056 // packages/dataviews/build-module/components/dataviews-layouts/grid/composite-grid.mjs 31057 var import_jsx_runtime127 = __toESM(require_jsx_runtime(), 1); 31058 function chunk(array, size4) { 31059 const chunks = []; 31060 for (let i = 0, j2 = array.length; i < j2; i += size4) { 31061 chunks.push(array.slice(i, i + size4)); 31062 } 31063 return chunks; 31064 } 31065 var GridItem = (0, import_element86.forwardRef)( 31066 function GridItem2({ 31067 view, 31068 selection, 31069 onChangeSelection, 31070 onClickItem, 31071 isItemClickable: isItemClickable2, 31072 renderItemLink, 31073 getItemId, 31074 item, 31075 actions, 31076 mediaField, 31077 titleField, 31078 descriptionField: descriptionField2, 31079 regularFields, 31080 badgeFields, 31081 hasBulkActions, 31082 config, 31083 posinset, 31084 setsize, 31085 ...props 31086 }, forwardedRef) { 31087 const { 31088 showTitle = true, 31089 showMedia = true, 31090 showDescription = true 31091 } = view; 31092 const hasBulkAction = useHasAPossibleBulkAction(actions, item); 31093 const id = getItemId(item); 31094 const elementRef = (0, import_element86.useRef)(null); 31095 const setRefs = (0, import_element86.useCallback)( 31096 (node) => { 31097 elementRef.current = node; 31098 if (typeof forwardedRef === "function") { 31099 forwardedRef(node); 31100 } else if (forwardedRef) { 31101 forwardedRef.current = node; 31102 } 31103 }, 31104 [forwardedRef] 31105 ); 31106 useIntersectionObserver(elementRef, posinset); 31107 const instanceId = (0, import_compose7.useInstanceId)(GridItem2); 31108 const isSelected2 = selection.includes(id); 31109 const mediaPlaceholder = /* @__PURE__ */ (0, import_jsx_runtime127.jsx)("span", { className: "dataviews-view-grid__media-placeholder" }); 31110 const rendersMediaField = showMedia && mediaField?.render; 31111 const renderedMediaField = rendersMediaField ? /* @__PURE__ */ (0, import_jsx_runtime127.jsx)( 31112 mediaField.render, 31113 { 31114 item, 31115 field: mediaField, 31116 config 31117 } 31118 ) : mediaPlaceholder; 31119 const renderedTitleField = showTitle && titleField?.render ? /* @__PURE__ */ (0, import_jsx_runtime127.jsx)(titleField.render, { item, field: titleField }) : null; 31120 let mediaA11yProps; 31121 let titleA11yProps; 31122 if (isItemClickable2(item) && onClickItem) { 31123 if (renderedTitleField) { 31124 mediaA11yProps = { 31125 "aria-labelledby": `dataviews-view-grid__title-field-$instanceId}` 31126 }; 31127 titleA11yProps = { 31128 id: `dataviews-view-grid__title-field-$instanceId}` 31129 }; 31130 } else { 31131 mediaA11yProps = { 31132 "aria-label": titleField?.getValueFormatted({ 31133 item, 31134 field: titleField 31135 }) || (0, import_i18n26.__)("Navigate to item") 31136 }; 31137 } 31138 } 31139 return /* @__PURE__ */ (0, import_jsx_runtime127.jsxs)( 31140 Stack, 31141 { 31142 direction: "column", 31143 ...props, 31144 ref: setRefs, 31145 "aria-setsize": setsize, 31146 "aria-posinset": posinset, 31147 className: clsx_default( 31148 props.className, 31149 "dataviews-view-grid__row__gridcell", 31150 "dataviews-view-grid__card", 31151 { 31152 "is-selected": hasBulkAction && isSelected2 31153 } 31154 ), 31155 children: [ 31156 /* @__PURE__ */ (0, import_jsx_runtime127.jsx)( 31157 ItemClickWrapper, 31158 { 31159 item, 31160 isItemClickable: isItemClickable2, 31161 onClickItem, 31162 renderItemLink, 31163 className: clsx_default("dataviews-view-grid__media", { 31164 "dataviews-view-grid__media--placeholder": !rendersMediaField 31165 }), 31166 ...mediaA11yProps, 31167 children: renderedMediaField 31168 } 31169 ), 31170 hasBulkActions && /* @__PURE__ */ (0, import_jsx_runtime127.jsx)( 31171 DataViewsSelectionCheckbox, 31172 { 31173 item, 31174 selection, 31175 onChangeSelection, 31176 getItemId, 31177 titleField, 31178 disabled: !hasBulkAction 31179 } 31180 ), 31181 !!actions?.length && /* @__PURE__ */ (0, import_jsx_runtime127.jsx)("div", { className: "dataviews-view-grid__media-actions", children: /* @__PURE__ */ (0, import_jsx_runtime127.jsx)( 31182 ItemActions, 31183 { 31184 item, 31185 actions, 31186 isCompact: true 31187 } 31188 ) }), 31189 showTitle && /* @__PURE__ */ (0, import_jsx_runtime127.jsx)("div", { className: "dataviews-view-grid__title-actions", children: /* @__PURE__ */ (0, import_jsx_runtime127.jsx)( 31190 ItemClickWrapper, 31191 { 31192 item, 31193 isItemClickable: isItemClickable2, 31194 onClickItem, 31195 renderItemLink, 31196 className: "dataviews-view-grid__title-field dataviews-title-field", 31197 ...titleA11yProps, 31198 title: titleField?.getValueFormatted({ 31199 item, 31200 field: titleField 31201 }) || void 0, 31202 children: renderedTitleField 31203 } 31204 ) }), 31205 /* @__PURE__ */ (0, import_jsx_runtime127.jsxs)(Stack, { direction: "column", gap: "xs", children: [ 31206 showDescription && descriptionField2?.render && /* @__PURE__ */ (0, import_jsx_runtime127.jsx)( 31207 descriptionField2.render, 31208 { 31209 item, 31210 field: descriptionField2 31211 } 31212 ), 31213 !!badgeFields?.length && /* @__PURE__ */ (0, import_jsx_runtime127.jsx)( 31214 Stack, 31215 { 31216 direction: "row", 31217 className: "dataviews-view-grid__badge-fields", 31218 gap: "sm", 31219 wrap: "wrap", 31220 align: "top", 31221 justify: "flex-start", 31222 children: badgeFields.map((field) => { 31223 return ( 31224 /* @ts-expect-error `Badge` is text-only, but a badge field renders whatever its `render` returns. */ 31225 /* @__PURE__ */ (0, import_jsx_runtime127.jsx)( 31226 Badge, 31227 { 31228 className: "dataviews-view-grid__field-value", 31229 children: /* @__PURE__ */ (0, import_jsx_runtime127.jsx)( 31230 field.render, 31231 { 31232 item, 31233 field 31234 } 31235 ) 31236 }, 31237 field.id 31238 ) 31239 ); 31240 }) 31241 } 31242 ), 31243 !!regularFields?.length && /* @__PURE__ */ (0, import_jsx_runtime127.jsx)( 31244 Stack, 31245 { 31246 direction: "column", 31247 className: "dataviews-view-grid__fields", 31248 gap: "xs", 31249 children: regularFields.map((field) => { 31250 return /* @__PURE__ */ (0, import_jsx_runtime127.jsx)( 31251 import_components9.Flex, 31252 { 31253 className: "dataviews-view-grid__field", 31254 gap: 1, 31255 justify: "flex-start", 31256 expanded: true, 31257 style: { height: "auto" }, 31258 direction: "row", 31259 children: /* @__PURE__ */ (0, import_jsx_runtime127.jsxs)(import_jsx_runtime127.Fragment, { children: [ 31260 /* @__PURE__ */ (0, import_jsx_runtime127.jsxs)(tooltip_exports.Root, { children: [ 31261 /* @__PURE__ */ (0, import_jsx_runtime127.jsx)( 31262 tooltip_exports.Trigger, 31263 { 31264 render: /* @__PURE__ */ (0, import_jsx_runtime127.jsx)(import_components9.FlexItem, { className: "dataviews-view-grid__field-name", children: field.header }) 31265 } 31266 ), 31267 /* @__PURE__ */ (0, import_jsx_runtime127.jsx)(tooltip_exports.Popup, { children: field.label }) 31268 ] }), 31269 /* @__PURE__ */ (0, import_jsx_runtime127.jsx)( 31270 import_components9.FlexItem, 31271 { 31272 className: "dataviews-view-grid__field-value", 31273 style: { maxHeight: "none" }, 31274 children: /* @__PURE__ */ (0, import_jsx_runtime127.jsx)( 31275 field.render, 31276 { 31277 item, 31278 field 31279 } 31280 ) 31281 } 31282 ) 31283 ] }) 31284 }, 31285 field.id 31286 ); 31287 }) 31288 } 31289 ) 31290 ] }) 31291 ] 31292 } 31293 ); 31294 } 31295 ); 31296 function CompositeGrid({ 31297 data, 31298 isInfiniteScroll, 31299 className, 31300 inert, 31301 isLoading, 31302 view, 31303 fields, 31304 selection, 31305 onChangeSelection, 31306 onClickItem, 31307 isItemClickable: isItemClickable2, 31308 renderItemLink, 31309 getItemId, 31310 actions, 31311 getSelectionProps 31312 }) { 31313 const { paginationInfo, resizeObserverRef } = (0, import_element86.useContext)(dataviews_context_default); 31314 const gridColumns = useGridColumns(); 31315 const gridStyle = { 31316 "--wp-dataviews-media-aspect-ratio": view.layout?.aspectRatio && MEDIA_ASPECT_RATIOS.includes(view.layout.aspectRatio) ? view.layout.aspectRatio : "1/1" 31317 }; 31318 const isMediaContain = view.layout?.mediaFit === "contain"; 31319 const hasBulkActions = useSomeItemHasAPossibleBulkAction(actions, data); 31320 const titleField = fields.find( 31321 (field) => field.id === view?.titleField 31322 ); 31323 const mediaField = fields.find( 31324 (field) => field.id === view?.mediaField 31325 ); 31326 const descriptionField2 = fields.find( 31327 (field) => field.id === view?.descriptionField 31328 ); 31329 const otherFields = view.fields ?? []; 31330 const { regularFields, badgeFields } = otherFields.reduce( 31331 (accumulator, fieldId) => { 31332 const field = fields.find((f) => f.id === fieldId); 31333 if (!field) { 31334 return accumulator; 31335 } 31336 const key = view.layout?.badgeFields?.includes(fieldId) ? "badgeFields" : "regularFields"; 31337 accumulator[key].push(field); 31338 return accumulator; 31339 }, 31340 { regularFields: [], badgeFields: [] } 31341 ); 31342 const size4 = "900px"; 31343 const totalRows = Math.ceil(data.length / gridColumns); 31344 const placeholdersNeeded = usePlaceholdersNeeded( 31345 data, 31346 isInfiniteScroll, 31347 gridColumns 31348 ); 31349 return /* @__PURE__ */ (0, import_jsx_runtime127.jsxs)(import_jsx_runtime127.Fragment, { 31350 // Render infinite scroll layout (no rows, feed semantics) 31351 children: [ 31352 isInfiniteScroll && /* @__PURE__ */ (0, import_jsx_runtime127.jsxs)( 31353 import_components9.Composite, 31354 { 31355 render: /* @__PURE__ */ (0, import_jsx_runtime127.jsx)( 31356 GridItems, 31357 { 31358 className: clsx_default( 31359 "dataviews-view-grid-infinite-scroll", 31360 className, 31361 { 31362 [`has-$view.layout?.density}-density`]: view.layout?.density && [ 31363 "compact", 31364 "comfortable" 31365 ].includes(view.layout.density), 31366 "has-media-fit-contain": isMediaContain 31367 } 31368 ), 31369 previewSize: view.layout?.previewSize, 31370 style: gridStyle, 31371 "aria-busy": isLoading, 31372 ref: resizeObserverRef 31373 } 31374 ), 31375 role: "feed", 31376 focusWrap: true, 31377 inert, 31378 children: [ 31379 Array.from({ length: placeholdersNeeded }).map( 31380 (_, index2) => /* @__PURE__ */ (0, import_jsx_runtime127.jsx)( 31381 import_components9.Composite.Item, 31382 { 31383 render: (props) => /* @__PURE__ */ (0, import_jsx_runtime127.jsx)( 31384 Stack, 31385 { 31386 ...props, 31387 direction: "column", 31388 role: "article", 31389 className: "dataviews-view-grid__row__gridcell dataviews-view-grid__card dataviews-view-grid__placeholder" 31390 } 31391 ), 31392 "aria-hidden": true, 31393 tabIndex: -1 31394 }, 31395 `placeholder-$index2}` 31396 ) 31397 ), 31398 data.map((item) => { 31399 const itemId = getItemId(item); 31400 const selectionProps = getSelectionProps(itemId); 31401 const stablePosition = item.position; 31402 return /* @__PURE__ */ (0, import_jsx_runtime127.jsx)( 31403 import_components9.Composite.Item, 31404 { 31405 render: (props) => /* @__PURE__ */ (0, import_jsx_runtime127.jsx)( 31406 GridItem, 31407 { 31408 ...props, 31409 id: itemId, 31410 role: "article", 31411 view, 31412 selection, 31413 onChangeSelection, 31414 onClickItem, 31415 isItemClickable: isItemClickable2, 31416 renderItemLink, 31417 getItemId, 31418 item, 31419 actions, 31420 onMouseDown: (event) => { 31421 props.onMouseDown?.(event); 31422 selectionProps.onMouseDown( 31423 event 31424 ); 31425 }, 31426 onClickCapture: (event) => { 31427 props.onClickCapture?.(event); 31428 selectionProps.onClickCapture( 31429 event 31430 ); 31431 }, 31432 mediaField, 31433 titleField, 31434 descriptionField: descriptionField2, 31435 regularFields, 31436 badgeFields, 31437 hasBulkActions, 31438 posinset: stablePosition, 31439 setsize: paginationInfo.totalItems, 31440 config: { 31441 sizes: size4 31442 } 31443 } 31444 ) 31445 }, 31446 itemId 31447 ); 31448 }) 31449 ] 31450 } 31451 ), 31452 // Render standard grid layout (with rows, grid semantics) 31453 !isInfiniteScroll && /* @__PURE__ */ (0, import_jsx_runtime127.jsx)( 31454 import_components9.Composite, 31455 { 31456 role: "grid", 31457 style: gridStyle, 31458 className: clsx_default("dataviews-view-grid", className, { 31459 [`has-$view.layout?.density}-density`]: view.layout?.density && ["compact", "comfortable"].includes( 31460 view.layout.density 31461 ), 31462 "has-media-fit-contain": isMediaContain 31463 }), 31464 focusWrap: true, 31465 "aria-busy": isLoading, 31466 "aria-rowcount": totalRows, 31467 ref: resizeObserverRef, 31468 inert, 31469 children: chunk(data, gridColumns).map((row, i) => /* @__PURE__ */ (0, import_jsx_runtime127.jsx)( 31470 import_components9.Composite.Row, 31471 { 31472 render: /* @__PURE__ */ (0, import_jsx_runtime127.jsx)( 31473 "div", 31474 { 31475 role: "row", 31476 "aria-rowindex": i + 1, 31477 "aria-label": (0, import_i18n26.sprintf)( 31478 /* translators: %d: The row number in the grid */ 31479 (0, import_i18n26.__)("Row %d"), 31480 i + 1 31481 ), 31482 className: "dataviews-view-grid__row", 31483 style: { 31484 gridTemplateColumns: `repeat( $gridColumns}, minmax(0, 1fr) )` 31485 } 31486 } 31487 ), 31488 children: row.map((item) => { 31489 const itemId = getItemId(item); 31490 const selectionProps = getSelectionProps(itemId); 31491 return /* @__PURE__ */ (0, import_jsx_runtime127.jsx)( 31492 import_components9.Composite.Item, 31493 { 31494 render: (props) => /* @__PURE__ */ (0, import_jsx_runtime127.jsx)( 31495 GridItem, 31496 { 31497 ...props, 31498 id: itemId, 31499 role: "gridcell", 31500 view, 31501 selection, 31502 onChangeSelection, 31503 onClickItem, 31504 isItemClickable: isItemClickable2, 31505 renderItemLink, 31506 getItemId, 31507 item, 31508 actions, 31509 onMouseDown: (event) => { 31510 props.onMouseDown?.( 31511 event 31512 ); 31513 selectionProps.onMouseDown( 31514 event 31515 ); 31516 }, 31517 onClickCapture: (event) => { 31518 props.onClickCapture?.( 31519 event 31520 ); 31521 selectionProps.onClickCapture( 31522 event 31523 ); 31524 }, 31525 mediaField, 31526 titleField, 31527 descriptionField: descriptionField2, 31528 regularFields, 31529 badgeFields, 31530 hasBulkActions, 31531 config: { 31532 sizes: size4 31533 } 31534 } 31535 ) 31536 }, 31537 itemId 31538 ); 31539 }) 31540 }, 31541 i 31542 )) 31543 } 31544 ) 31545 ] 31546 }); 31547 } 31548 31549 // packages/dataviews/build-module/components/dataviews-layouts/grid/index.mjs 31550 var import_jsx_runtime128 = __toESM(require_jsx_runtime(), 1); 31551 function ViewGrid({ 31552 actions, 31553 data, 31554 fields, 31555 getItemId, 31556 isLoading, 31557 onChangeSelection, 31558 onClickItem, 31559 isItemClickable: isItemClickable2, 31560 renderItemLink, 31561 selection, 31562 view, 31563 className, 31564 empty 31565 }) { 31566 const isDelayedLoading = useDelayedLoading(!!isLoading); 31567 const hasData = !!data?.length; 31568 const groupField = view.groupBy?.field ? fields.find((f) => f.id === view.groupBy?.field) : null; 31569 const dataByGroup = groupField ? getDataByGroup(data, groupField) : null; 31570 const isInfiniteScroll = view.infiniteScrollEnabled && !dataByGroup; 31571 const orderedData = dataByGroup ? Array.from(dataByGroup.values()).flat() : data; 31572 const { getSelectionProps } = useSelectionProps({ 31573 data: orderedData, 31574 getItemId, 31575 isItemSelectable: (item) => hasAPossibleBulkAction(actions, item), 31576 selection, 31577 onChangeSelection, 31578 selectionMode: "multi", 31579 shouldSelectOnClick: false 31580 }); 31581 if (!hasData) { 31582 return /* @__PURE__ */ (0, import_jsx_runtime128.jsx)( 31583 "div", 31584 { 31585 className: clsx_default("dataviews-no-results", { 31586 "is-refreshing": isDelayedLoading 31587 }), 31588 children: empty 31589 } 31590 ); 31591 } 31592 const gridProps = { 31593 className: clsx_default(className, { 31594 "is-refreshing": !isInfiniteScroll && isDelayedLoading 31595 }), 31596 inert: !isInfiniteScroll && !!isLoading ? "true" : void 0, 31597 isLoading, 31598 view, 31599 fields, 31600 selection, 31601 onChangeSelection, 31602 onClickItem, 31603 isItemClickable: isItemClickable2, 31604 renderItemLink, 31605 getItemId, 31606 actions, 31607 getSelectionProps 31608 }; 31609 return /* @__PURE__ */ (0, import_jsx_runtime128.jsxs)(import_jsx_runtime128.Fragment, { 31610 // Render multiple groups. 31611 children: [ 31612 hasData && groupField && dataByGroup && /* @__PURE__ */ (0, import_jsx_runtime128.jsx)(Stack, { direction: "column", gap: "lg", children: Array.from(dataByGroup.entries()).map( 31613 ([groupName, groupItems]) => /* @__PURE__ */ (0, import_jsx_runtime128.jsxs)( 31614 Stack, 31615 { 31616 direction: "column", 31617 gap: "sm", 31618 children: [ 31619 /* @__PURE__ */ (0, import_jsx_runtime128.jsx)("h3", { className: "dataviews-view-grid__group-header", children: view.groupBy?.showLabel === false ? groupName : (0, import_i18n27.sprintf)( 31620 // translators: 1: The label of the field e.g. "Date". 2: The value of the field, e.g.: "May 2022". 31621 (0, import_i18n27.__)("%1$s: %2$s"), 31622 groupField.label, 31623 groupName 31624 ) }), 31625 /* @__PURE__ */ (0, import_jsx_runtime128.jsx)( 31626 CompositeGrid, 31627 { 31628 ...gridProps, 31629 data: groupItems, 31630 isInfiniteScroll: false 31631 } 31632 ) 31633 ] 31634 }, 31635 groupName 31636 ) 31637 ) }), 31638 // Render a single grid with all data. 31639 !dataByGroup && /* @__PURE__ */ (0, import_jsx_runtime128.jsx)( 31640 CompositeGrid, 31641 { 31642 ...gridProps, 31643 data, 31644 isInfiniteScroll: !!isInfiniteScroll 31645 } 31646 ), 31647 isInfiniteScroll && isLoading && /* @__PURE__ */ (0, import_jsx_runtime128.jsx)("p", { className: "dataviews-loading-more", children: /* @__PURE__ */ (0, import_jsx_runtime128.jsx)(import_components10.Spinner, {}) }) 31648 ] 31649 }); 31650 } 31651 var grid_default = ViewGrid; 31652 31653 // packages/dataviews/build-module/components/dataviews-layouts/list/index.mjs 31654 var import_compose8 = __toESM(require_compose(), 1); 31655 var import_components11 = __toESM(require_components(), 1); 31656 var import_element87 = __toESM(require_element(), 1); 31657 var import_i18n28 = __toESM(require_i18n(), 1); 31658 var import_data4 = __toESM(require_data(), 1); 31659 var import_jsx_runtime129 = __toESM(require_jsx_runtime(), 1); 31660 function generateItemWrapperCompositeId(idPrefix) { 31661 return `$idPrefix}-item-wrapper`; 31662 } 31663 function generatePrimaryActionCompositeId(idPrefix, primaryActionId) { 31664 return `$idPrefix}-primary-action-$primaryActionId}`; 31665 } 31666 function generateDropdownTriggerCompositeId(idPrefix) { 31667 return `$idPrefix}-dropdown`; 31668 } 31669 function PrimaryActionGridCell({ 31670 idPrefix, 31671 primaryAction, 31672 item 31673 }) { 31674 const registry = (0, import_data4.useRegistry)(); 31675 const [isModalOpen, setIsModalOpen] = (0, import_element87.useState)(false); 31676 const compositeItemId = generatePrimaryActionCompositeId( 31677 idPrefix, 31678 primaryAction.id 31679 ); 31680 const label = typeof primaryAction.label === "string" ? primaryAction.label : primaryAction.label([item]); 31681 return "RenderModal" in primaryAction ? /* @__PURE__ */ (0, import_jsx_runtime129.jsx)("div", { role: "gridcell", children: /* @__PURE__ */ (0, import_jsx_runtime129.jsx)( 31682 import_components11.Composite.Item, 31683 { 31684 id: compositeItemId, 31685 render: /* @__PURE__ */ (0, import_jsx_runtime129.jsx)( 31686 import_components11.Button, 31687 { 31688 disabled: !!primaryAction.disabled, 31689 accessibleWhenDisabled: true, 31690 text: label, 31691 size: "small", 31692 onClick: () => setIsModalOpen(true) 31693 } 31694 ), 31695 children: isModalOpen && /* @__PURE__ */ (0, import_jsx_runtime129.jsx)( 31696 ActionModal, 31697 { 31698 action: primaryAction, 31699 items: [item], 31700 closeModal: () => setIsModalOpen(false) 31701 } 31702 ) 31703 } 31704 ) }, primaryAction.id) : /* @__PURE__ */ (0, import_jsx_runtime129.jsx)("div", { role: "gridcell", children: /* @__PURE__ */ (0, import_jsx_runtime129.jsx)( 31705 import_components11.Composite.Item, 31706 { 31707 id: compositeItemId, 31708 render: /* @__PURE__ */ (0, import_jsx_runtime129.jsx)( 31709 import_components11.Button, 31710 { 31711 disabled: !!primaryAction.disabled, 31712 accessibleWhenDisabled: true, 31713 size: "small", 31714 onClick: () => { 31715 primaryAction.callback([item], { registry }); 31716 }, 31717 children: label 31718 } 31719 ) 31720 } 31721 ) }, primaryAction.id); 31722 } 31723 function ListItem({ 31724 view, 31725 actions, 31726 idPrefix, 31727 isSelected: isSelected2, 31728 item, 31729 titleField, 31730 mediaField, 31731 descriptionField: descriptionField2, 31732 selectionProps, 31733 otherFields, 31734 onDropdownTriggerKeyDown, 31735 posinset 31736 }) { 31737 const { 31738 showTitle = true, 31739 showMedia = true, 31740 showDescription = true, 31741 infiniteScrollEnabled 31742 } = view; 31743 const itemRef = (0, import_element87.useRef)(null); 31744 const labelId = `$idPrefix}-label`; 31745 const descriptionId = `$idPrefix}-description`; 31746 const registry = (0, import_data4.useRegistry)(); 31747 const [isHovered, setIsHovered] = (0, import_element87.useState)(false); 31748 const [activeModalAction, setActiveModalAction] = (0, import_element87.useState)( 31749 null 31750 ); 31751 const handleHover = ({ type }) => { 31752 const isHover = type === "mouseenter"; 31753 setIsHovered(isHover); 31754 }; 31755 const { paginationInfo } = (0, import_element87.useContext)(dataviews_context_default); 31756 (0, import_element87.useEffect)(() => { 31757 if (isSelected2) { 31758 itemRef.current?.scrollIntoView({ 31759 behavior: "auto", 31760 block: "nearest", 31761 inline: "nearest" 31762 }); 31763 } 31764 }, [isSelected2]); 31765 const { primaryAction, eligibleActions } = (0, import_element87.useMemo)(() => { 31766 const _eligibleActions = actions.filter( 31767 (action) => !action.isEligible || action.isEligible(item) 31768 ); 31769 const _primaryActions = _eligibleActions.filter( 31770 (action) => action.isPrimary 31771 ); 31772 return { 31773 primaryAction: _primaryActions[0], 31774 eligibleActions: _eligibleActions 31775 }; 31776 }, [actions, item]); 31777 const hasOnlyOnePrimaryAction = primaryAction && actions.length === 1; 31778 const renderedMediaField = showMedia && mediaField?.render ? /* @__PURE__ */ (0, import_jsx_runtime129.jsx)("div", { className: "dataviews-view-list__media-wrapper", children: /* @__PURE__ */ (0, import_jsx_runtime129.jsx)( 31779 mediaField.render, 31780 { 31781 item, 31782 field: mediaField, 31783 config: { sizes: "52px" } 31784 } 31785 ) }) : null; 31786 const renderedTitleField = showTitle && titleField?.render ? /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(titleField.render, { item, field: titleField }) : null; 31787 const renderDescription = showDescription && descriptionField2?.render; 31788 const hasOnlyMediaAndTitle = !!renderedMediaField && !renderDescription && !otherFields.length; 31789 const usedActions = eligibleActions?.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime129.jsxs)( 31790 Stack, 31791 { 31792 direction: "row", 31793 gap: "md", 31794 className: "dataviews-view-list__item-actions", 31795 children: [ 31796 primaryAction && /* @__PURE__ */ (0, import_jsx_runtime129.jsx)( 31797 PrimaryActionGridCell, 31798 { 31799 idPrefix, 31800 primaryAction, 31801 item 31802 } 31803 ), 31804 !hasOnlyOnePrimaryAction && /* @__PURE__ */ (0, import_jsx_runtime129.jsxs)("div", { role: "gridcell", children: [ 31805 /* @__PURE__ */ (0, import_jsx_runtime129.jsxs)(menu_exports.Root, { disabled: !actions.length, children: [ 31806 /* @__PURE__ */ (0, import_jsx_runtime129.jsx)( 31807 menu_exports.Trigger, 31808 { 31809 render: /* @__PURE__ */ (0, import_jsx_runtime129.jsx)( 31810 import_components11.Composite.Item, 31811 { 31812 id: generateDropdownTriggerCompositeId( 31813 idPrefix 31814 ), 31815 accessibleWhenDisabled: true, 31816 render: /* @__PURE__ */ (0, import_jsx_runtime129.jsx)( 31817 import_components11.Button, 31818 { 31819 size: "small", 31820 icon: more_vertical_default, 31821 label: (0, import_i18n28.__)("Actions"), 31822 accessibleWhenDisabled: true, 31823 disabled: !actions.length, 31824 onKeyDownCapture: onDropdownTriggerKeyDown 31825 } 31826 ) 31827 } 31828 ) 31829 } 31830 ), 31831 /* @__PURE__ */ (0, import_jsx_runtime129.jsx)( 31832 menu_exports.Popup, 31833 { 31834 positioner: /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(menu_exports.Positioner, { align: "end" }), 31835 children: /* @__PURE__ */ (0, import_jsx_runtime129.jsx)( 31836 ActionsMenuGroup, 31837 { 31838 actions: eligibleActions, 31839 item, 31840 registry, 31841 setActiveModalAction 31842 } 31843 ) 31844 } 31845 ) 31846 ] }), 31847 !!activeModalAction && /* @__PURE__ */ (0, import_jsx_runtime129.jsx)( 31848 ActionModal, 31849 { 31850 action: activeModalAction, 31851 items: [item], 31852 closeModal: () => setActiveModalAction(null) 31853 } 31854 ) 31855 ] }) 31856 ] 31857 } 31858 ); 31859 return /* @__PURE__ */ (0, import_jsx_runtime129.jsx)( 31860 import_components11.Composite.Row, 31861 { 31862 ref: itemRef, 31863 render: ( 31864 /* aria-posinset breaks Composite.Row if passed to it directly. */ 31865 /* @__PURE__ */ (0, import_jsx_runtime129.jsx)( 31866 "div", 31867 { 31868 "aria-posinset": posinset, 31869 "aria-setsize": infiniteScrollEnabled ? paginationInfo.totalItems : void 0 31870 } 31871 ) 31872 ), 31873 role: infiniteScrollEnabled ? "article" : "row", 31874 className: clsx_default({ 31875 "is-selected": isSelected2, 31876 "is-hovered": isHovered 31877 }), 31878 onMouseEnter: handleHover, 31879 onMouseLeave: handleHover, 31880 children: /* @__PURE__ */ (0, import_jsx_runtime129.jsxs)( 31881 Stack, 31882 { 31883 direction: "row", 31884 className: "dataviews-view-list__item-wrapper", 31885 children: [ 31886 /* @__PURE__ */ (0, import_jsx_runtime129.jsx)("div", { role: "gridcell", children: /* @__PURE__ */ (0, import_jsx_runtime129.jsx)( 31887 import_components11.Composite.Item, 31888 { 31889 id: generateItemWrapperCompositeId(idPrefix), 31890 "aria-pressed": isSelected2, 31891 "aria-labelledby": labelId, 31892 "aria-describedby": descriptionId, 31893 className: "dataviews-view-list__item", 31894 ...selectionProps 31895 } 31896 ) }), 31897 /* @__PURE__ */ (0, import_jsx_runtime129.jsxs)( 31898 Stack, 31899 { 31900 direction: "row", 31901 gap: "md", 31902 justify: "start", 31903 align: hasOnlyMediaAndTitle ? "center" : "flex-start", 31904 style: { flex: 1, minWidth: 0 }, 31905 children: [ 31906 renderedMediaField, 31907 /* @__PURE__ */ (0, import_jsx_runtime129.jsxs)( 31908 Stack, 31909 { 31910 direction: "column", 31911 gap: "xs", 31912 className: "dataviews-view-list__field-wrapper", 31913 children: [ 31914 /* @__PURE__ */ (0, import_jsx_runtime129.jsxs)(Stack, { direction: "row", align: "center", children: [ 31915 /* @__PURE__ */ (0, import_jsx_runtime129.jsx)( 31916 "div", 31917 { 31918 className: "dataviews-title-field dataviews-view-list__title-field", 31919 id: labelId, 31920 children: renderedTitleField 31921 } 31922 ), 31923 usedActions 31924 ] }), 31925 renderDescription && /* @__PURE__ */ (0, import_jsx_runtime129.jsx)("div", { className: "dataviews-view-list__field", children: /* @__PURE__ */ (0, import_jsx_runtime129.jsx)( 31926 descriptionField2.render, 31927 { 31928 item, 31929 field: descriptionField2 31930 } 31931 ) }), 31932 /* @__PURE__ */ (0, import_jsx_runtime129.jsx)( 31933 "div", 31934 { 31935 className: "dataviews-view-list__fields", 31936 id: descriptionId, 31937 children: otherFields.map((field) => /* @__PURE__ */ (0, import_jsx_runtime129.jsxs)( 31938 "div", 31939 { 31940 className: "dataviews-view-list__field", 31941 children: [ 31942 /* @__PURE__ */ (0, import_jsx_runtime129.jsx)( 31943 VisuallyHidden, 31944 { 31945 className: "dataviews-view-list__field-label", 31946 render: /* @__PURE__ */ (0, import_jsx_runtime129.jsx)("span", {}), 31947 children: field.label 31948 } 31949 ), 31950 /* @__PURE__ */ (0, import_jsx_runtime129.jsx)("span", { className: "dataviews-view-list__field-value", children: /* @__PURE__ */ (0, import_jsx_runtime129.jsx)( 31951 field.render, 31952 { 31953 item, 31954 field 31955 } 31956 ) }) 31957 ] 31958 }, 31959 field.id 31960 )) 31961 } 31962 ) 31963 ] 31964 } 31965 ) 31966 ] 31967 } 31968 ) 31969 ] 31970 } 31971 ) 31972 } 31973 ); 31974 } 31975 function isDefined2(item) { 31976 return !!item; 31977 } 31978 function ViewList(props) { 31979 const { 31980 actions, 31981 data, 31982 fields, 31983 getItemId, 31984 isLoading, 31985 onChangeSelection, 31986 selection, 31987 view, 31988 className, 31989 empty 31990 } = props; 31991 const baseId = (0, import_compose8.useInstanceId)(ViewList, "view-list"); 31992 const isDelayedLoading = useDelayedLoading(!!isLoading); 31993 const { paginationInfo } = (0, import_element87.useContext)(dataviews_context_default); 31994 const selectedItem = data?.findLast( 31995 (item) => selection.includes(getItemId(item)) 31996 ); 31997 const titleField = fields.find((field) => field.id === view.titleField); 31998 const mediaField = fields.find((field) => field.id === view.mediaField); 31999 const descriptionField2 = fields.find( 32000 (field) => field.id === view.descriptionField 32001 ); 32002 const otherFields = (view?.fields ?? []).map((fieldId) => fields.find((f) => fieldId === f.id)).filter(isDefined2); 32003 const { getSelectionProps } = useSelectionProps({ 32004 data, 32005 getItemId, 32006 isItemSelectable: () => true, 32007 selection, 32008 onChangeSelection, 32009 selectionMode: "single-required", 32010 shouldSelectOnClick: true 32011 }); 32012 const generateCompositeItemIdPrefix = (0, import_element87.useCallback)( 32013 (item) => `$baseId}-$getItemId(item)}`, 32014 [baseId, getItemId] 32015 ); 32016 const isActiveCompositeItem = (0, import_element87.useCallback)( 32017 (item, idToCheck) => { 32018 return idToCheck.startsWith( 32019 generateCompositeItemIdPrefix(item) 32020 ); 32021 }, 32022 [generateCompositeItemIdPrefix] 32023 ); 32024 const [activeCompositeId, setActiveCompositeId] = (0, import_element87.useState)(void 0); 32025 const compositeRef = (0, import_element87.useRef)(null); 32026 (0, import_element87.useEffect)(() => { 32027 if (selectedItem) { 32028 setActiveCompositeId( 32029 generateItemWrapperCompositeId( 32030 generateCompositeItemIdPrefix(selectedItem) 32031 ) 32032 ); 32033 } 32034 }, [selectedItem, generateCompositeItemIdPrefix]); 32035 const activeItemIndex = data.findIndex( 32036 (item) => isActiveCompositeItem(item, activeCompositeId ?? "") 32037 ); 32038 const previousActiveItemIndex = (0, import_compose8.usePrevious)(activeItemIndex); 32039 const isActiveIdInList = activeItemIndex !== -1; 32040 const selectCompositeItem = (0, import_element87.useCallback)( 32041 (targetIndex, generateCompositeId) => { 32042 const clampedIndex = Math.min( 32043 data.length - 1, 32044 Math.max(0, targetIndex) 32045 ); 32046 if (!data[clampedIndex]) { 32047 return; 32048 } 32049 const itemIdPrefix = generateCompositeItemIdPrefix( 32050 data[clampedIndex] 32051 ); 32052 const targetCompositeItemId = generateCompositeId(itemIdPrefix); 32053 setActiveCompositeId(targetCompositeItemId); 32054 if (compositeRef.current?.contains( 32055 compositeRef.current.ownerDocument.activeElement 32056 )) { 32057 document.getElementById(targetCompositeItemId)?.focus(); 32058 } 32059 }, 32060 [data, generateCompositeItemIdPrefix] 32061 ); 32062 (0, import_element87.useEffect)(() => { 32063 const wasActiveIdInList = previousActiveItemIndex !== void 0 && previousActiveItemIndex !== -1; 32064 if (!isActiveIdInList && wasActiveIdInList) { 32065 selectCompositeItem( 32066 previousActiveItemIndex, 32067 generateItemWrapperCompositeId 32068 ); 32069 } 32070 }, [isActiveIdInList, selectCompositeItem, previousActiveItemIndex]); 32071 const onDropdownTriggerKeyDown = (0, import_element87.useCallback)( 32072 (event) => { 32073 if (event.key === "ArrowDown") { 32074 event.preventDefault(); 32075 event.stopPropagation(); 32076 selectCompositeItem( 32077 activeItemIndex + 1, 32078 generateDropdownTriggerCompositeId 32079 ); 32080 } 32081 if (event.key === "ArrowUp") { 32082 event.preventDefault(); 32083 event.stopPropagation(); 32084 selectCompositeItem( 32085 activeItemIndex - 1, 32086 generateDropdownTriggerCompositeId 32087 ); 32088 } 32089 }, 32090 [selectCompositeItem, activeItemIndex] 32091 ); 32092 const hasData = !!data?.length; 32093 const groupField = view.groupBy?.field ? fields.find((field) => field.id === view.groupBy?.field) : null; 32094 const dataByGroup = hasData && groupField ? getDataByGroup(data, groupField) : null; 32095 const isInfiniteScroll = view.infiniteScrollEnabled && !dataByGroup; 32096 const hasMoreItems = isInfiniteScroll && (view.startPosition ?? 1) + (view.perPage ?? 0) < paginationInfo.totalItems; 32097 const listClassName = clsx_default("dataviews-view-list", className, { 32098 [`has-$view.layout?.density}-density`]: view.layout?.density && ["compact", "comfortable"].includes(view.layout.density), 32099 "is-refreshing": !isInfiniteScroll && isDelayedLoading 32100 }); 32101 const compositeProps = { 32102 ref: compositeRef, 32103 id: baseId, 32104 render: /* @__PURE__ */ (0, import_jsx_runtime129.jsx)("div", {}), 32105 activeId: activeCompositeId, 32106 setActiveId: setActiveCompositeId, 32107 inert: !isInfiniteScroll && !!isLoading ? "true" : void 0 32108 }; 32109 if (!hasData) { 32110 return /* @__PURE__ */ (0, import_jsx_runtime129.jsx)( 32111 "div", 32112 { 32113 className: clsx_default("dataviews-no-results", { 32114 "is-refreshing": isDelayedLoading 32115 }), 32116 children: empty 32117 } 32118 ); 32119 } 32120 if (hasData && groupField && dataByGroup) { 32121 return /* @__PURE__ */ (0, import_jsx_runtime129.jsx)( 32122 import_components11.Composite, 32123 { 32124 ...compositeProps, 32125 className: "dataviews-view-list__group", 32126 role: "grid", 32127 children: /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(Stack, { direction: "column", gap: "lg", className: listClassName, children: Array.from(dataByGroup.entries()).map( 32128 ([groupName, groupItems]) => /* @__PURE__ */ (0, import_jsx_runtime129.jsxs)(Stack, { direction: "column", children: [ 32129 /* @__PURE__ */ (0, import_jsx_runtime129.jsx)("h3", { className: "dataviews-view-list__group-header", children: view.groupBy?.showLabel === false ? groupName : (0, import_i18n28.sprintf)( 32130 // translators: 1: The label of the field e.g. "Date". 2: The value of the field, e.g.: "May 2022". 32131 (0, import_i18n28.__)("%1$s: %2$s"), 32132 groupField.label, 32133 groupName 32134 ) }), 32135 groupItems.map((item) => { 32136 const id = generateCompositeItemIdPrefix(item); 32137 return /* @__PURE__ */ (0, import_jsx_runtime129.jsx)( 32138 ListItem, 32139 { 32140 view, 32141 idPrefix: id, 32142 actions, 32143 item, 32144 isSelected: item === selectedItem, 32145 selectionProps: getSelectionProps( 32146 getItemId(item) 32147 ), 32148 mediaField, 32149 titleField, 32150 descriptionField: descriptionField2, 32151 otherFields, 32152 onDropdownTriggerKeyDown 32153 }, 32154 id 32155 ); 32156 }) 32157 ] }, groupName) 32158 ) }) 32159 } 32160 ); 32161 } 32162 return /* @__PURE__ */ (0, import_jsx_runtime129.jsxs)(import_jsx_runtime129.Fragment, { children: [ 32163 /* @__PURE__ */ (0, import_jsx_runtime129.jsx)( 32164 import_components11.Composite, 32165 { 32166 ...compositeProps, 32167 className: listClassName, 32168 role: view.infiniteScrollEnabled ? "feed" : "grid", 32169 children: data.map((item, index2) => { 32170 const id = generateCompositeItemIdPrefix(item); 32171 return /* @__PURE__ */ (0, import_jsx_runtime129.jsx)( 32172 ListItem, 32173 { 32174 view, 32175 idPrefix: id, 32176 actions, 32177 item, 32178 isSelected: item === selectedItem, 32179 selectionProps: getSelectionProps( 32180 getItemId(item) 32181 ), 32182 mediaField, 32183 titleField, 32184 descriptionField: descriptionField2, 32185 otherFields, 32186 onDropdownTriggerKeyDown, 32187 posinset: view.infiniteScrollEnabled ? index2 + 1 : void 0 32188 }, 32189 id 32190 ); 32191 }) 32192 } 32193 ), 32194 (hasMoreItems || isInfiniteScroll && isLoading) && // Keep the spinner's height reserved while loading more so the 32195 // scroll position doesn't bounce. Hidden, and silent to a11y, 32196 // while idle. 32197 /* @__PURE__ */ (0, import_jsx_runtime129.jsx)( 32198 "p", 32199 { 32200 className: "dataviews-loading-more", 32201 "aria-hidden": !isLoading, 32202 children: /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(import_components11.Spinner, {}) 32203 } 32204 ) 32205 ] }); 32206 } 32207 32208 // packages/dataviews/build-module/components/dataviews-layouts/activity/index.mjs 32209 var import_components12 = __toESM(require_components(), 1); 32210 32211 // packages/dataviews/build-module/components/dataviews-layouts/activity/activity-group.mjs 32212 var import_i18n29 = __toESM(require_i18n(), 1); 32213 var import_element88 = __toESM(require_element(), 1); 32214 var import_jsx_runtime130 = __toESM(require_jsx_runtime(), 1); 32215 function ActivityGroup({ 32216 groupName, 32217 groupData, 32218 groupField, 32219 showLabel = true, 32220 children 32221 }) { 32222 const groupHeader = showLabel ? (0, import_element88.createInterpolateElement)( 32223 // translators: %s: The label of the field e.g. "Status". 32224 (0, import_i18n29.sprintf)((0, import_i18n29.__)("%s: <groupName />"), groupField.label).trim(), 32225 { 32226 groupName: /* @__PURE__ */ (0, import_jsx_runtime130.jsx)( 32227 groupField.render, 32228 { 32229 item: groupData[0], 32230 field: groupField 32231 } 32232 ) 32233 } 32234 ) : /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(groupField.render, { item: groupData[0], field: groupField }); 32235 return /* @__PURE__ */ (0, import_jsx_runtime130.jsxs)( 32236 Stack, 32237 { 32238 direction: "column", 32239 className: "dataviews-view-activity__group", 32240 children: [ 32241 /* @__PURE__ */ (0, import_jsx_runtime130.jsx)("h3", { className: "dataviews-view-activity__group-header", children: groupHeader }), 32242 children 32243 ] 32244 }, 32245 groupName 32246 ); 32247 } 32248 32249 // packages/dataviews/build-module/components/dataviews-layouts/activity/activity-item.mjs 32250 var import_element89 = __toESM(require_element(), 1); 32251 var import_data5 = __toESM(require_data(), 1); 32252 var import_compose9 = __toESM(require_compose(), 1); 32253 var import_jsx_runtime131 = __toESM(require_jsx_runtime(), 1); 32254 function ActivityItem(props) { 32255 const { 32256 view, 32257 actions, 32258 item, 32259 titleField, 32260 mediaField, 32261 descriptionField: descriptionField2, 32262 otherFields, 32263 posinset, 32264 onClickItem, 32265 renderItemLink, 32266 isItemClickable: isItemClickable2 32267 } = props; 32268 const { 32269 showTitle = true, 32270 showMedia = true, 32271 showDescription = true, 32272 infiniteScrollEnabled 32273 } = view; 32274 const itemRef = (0, import_element89.useRef)(null); 32275 const registry = (0, import_data5.useRegistry)(); 32276 const { paginationInfo } = (0, import_element89.useContext)(dataviews_context_default); 32277 const { primaryActions, eligibleActions } = (0, import_element89.useMemo)(() => { 32278 const _eligibleActions = actions.filter( 32279 (action) => !action.isEligible || action.isEligible(item) 32280 ); 32281 const _primaryActions = _eligibleActions.filter( 32282 (action) => action.isPrimary 32283 ); 32284 return { 32285 primaryActions: _primaryActions, 32286 eligibleActions: _eligibleActions 32287 }; 32288 }, [actions, item]); 32289 const isMobileViewport = (0, import_compose9.useViewportMatch)("medium", "<"); 32290 const density = view.layout?.density ?? "balanced"; 32291 const mediaContent = showMedia && density !== "compact" && mediaField?.render ? /* @__PURE__ */ (0, import_jsx_runtime131.jsx)( 32292 mediaField.render, 32293 { 32294 item, 32295 field: mediaField, 32296 config: { 32297 sizes: density === "comfortable" ? "32px" : "24px" 32298 } 32299 } 32300 ) : null; 32301 const renderedMediaField = /* @__PURE__ */ (0, import_jsx_runtime131.jsx)("div", { className: "dataviews-view-activity__item-type-icon", children: mediaContent || /* @__PURE__ */ (0, import_jsx_runtime131.jsx)( 32302 "span", 32303 { 32304 className: "dataviews-view-activity__item-bullet", 32305 "aria-hidden": "true" 32306 } 32307 ) }); 32308 const renderedTitleField = showTitle && titleField?.render ? /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(titleField.render, { item, field: titleField }) : null; 32309 const verticalGap = (0, import_element89.useMemo)(() => { 32310 switch (density) { 32311 case "comfortable": 32312 return "md"; 32313 default: 32314 return "sm"; 32315 } 32316 }, [density]); 32317 return /* @__PURE__ */ (0, import_jsx_runtime131.jsx)( 32318 "div", 32319 { 32320 ref: itemRef, 32321 role: infiniteScrollEnabled ? "article" : void 0, 32322 "aria-posinset": posinset, 32323 "aria-setsize": infiniteScrollEnabled ? paginationInfo.totalItems : void 0, 32324 className: clsx_default( 32325 "dataviews-view-activity__item", 32326 density === "compact" && "is-compact", 32327 density === "balanced" && "is-balanced", 32328 density === "comfortable" && "is-comfortable" 32329 ), 32330 children: /* @__PURE__ */ (0, import_jsx_runtime131.jsxs)(Stack, { direction: "row", gap: "lg", justify: "start", align: "flex-start", children: [ 32331 /* @__PURE__ */ (0, import_jsx_runtime131.jsx)( 32332 Stack, 32333 { 32334 direction: "column", 32335 gap: "xs", 32336 align: "center", 32337 className: "dataviews-view-activity__item-type", 32338 children: renderedMediaField 32339 } 32340 ), 32341 /* @__PURE__ */ (0, import_jsx_runtime131.jsxs)( 32342 Stack, 32343 { 32344 direction: "column", 32345 gap: verticalGap, 32346 align: "flex-start", 32347 className: "dataviews-view-activity__item-content", 32348 children: [ 32349 renderedTitleField && /* @__PURE__ */ (0, import_jsx_runtime131.jsx)( 32350 ItemClickWrapper, 32351 { 32352 item, 32353 isItemClickable: isItemClickable2, 32354 onClickItem, 32355 renderItemLink, 32356 className: "dataviews-view-activity__item-title", 32357 children: renderedTitleField 32358 } 32359 ), 32360 showDescription && descriptionField2 && /* @__PURE__ */ (0, import_jsx_runtime131.jsx)("div", { className: "dataviews-view-activity__item-description", children: /* @__PURE__ */ (0, import_jsx_runtime131.jsx)( 32361 descriptionField2.render, 32362 { 32363 item, 32364 field: descriptionField2 32365 } 32366 ) }), 32367 /* @__PURE__ */ (0, import_jsx_runtime131.jsx)("div", { className: "dataviews-view-activity__item-fields", children: otherFields.map((field) => /* @__PURE__ */ (0, import_jsx_runtime131.jsxs)( 32368 "div", 32369 { 32370 className: "dataviews-view-activity__item-field", 32371 children: [ 32372 /* @__PURE__ */ (0, import_jsx_runtime131.jsx)( 32373 VisuallyHidden, 32374 { 32375 className: "dataviews-view-activity__item-field-label", 32376 render: /* @__PURE__ */ (0, import_jsx_runtime131.jsx)("span", {}), 32377 children: field.label 32378 } 32379 ), 32380 /* @__PURE__ */ (0, import_jsx_runtime131.jsx)("span", { className: "dataviews-view-activity__item-field-value", children: /* @__PURE__ */ (0, import_jsx_runtime131.jsx)( 32381 field.render, 32382 { 32383 item, 32384 field 32385 } 32386 ) }) 32387 ] 32388 }, 32389 field.id 32390 )) }), 32391 !!primaryActions?.length && /* @__PURE__ */ (0, import_jsx_runtime131.jsx)( 32392 PrimaryActions, 32393 { 32394 item, 32395 actions: primaryActions, 32396 registry, 32397 buttonVariant: "secondary" 32398 } 32399 ) 32400 ] 32401 } 32402 ), 32403 (primaryActions.length < eligibleActions.length || // Since we hide primary actions on mobile, we need to show the menu 32404 // there if there are any actions at all. 32405 isMobileViewport && // At the same time, only show the menu if there are actions to show. 32406 eligibleActions.length > 0) && /* @__PURE__ */ (0, import_jsx_runtime131.jsx)("div", { className: "dataviews-view-activity__item-actions", children: /* @__PURE__ */ (0, import_jsx_runtime131.jsx)( 32407 ItemActions, 32408 { 32409 item, 32410 actions: eligibleActions, 32411 isCompact: true 32412 } 32413 ) }) 32414 ] }) 32415 } 32416 ); 32417 } 32418 var activity_item_default = ActivityItem; 32419 32420 // packages/dataviews/build-module/components/dataviews-layouts/activity/activity-items.mjs 32421 var import_react45 = __toESM(require_react(), 1); 32422 function isDefined3(item) { 32423 return !!item; 32424 } 32425 function ActivityItems(props) { 32426 const { data, fields, getItemId, view } = props; 32427 const titleField = fields.find((field) => field.id === view.titleField); 32428 const mediaField = fields.find((field) => field.id === view.mediaField); 32429 const descriptionField2 = fields.find( 32430 (field) => field.id === view.descriptionField 32431 ); 32432 const otherFields = (view?.fields ?? []).map((fieldId) => fields.find((f) => fieldId === f.id)).filter(isDefined3); 32433 return data.map((item, index2) => { 32434 return /* @__PURE__ */ (0, import_react45.createElement)( 32435 activity_item_default, 32436 { 32437 ...props, 32438 key: getItemId(item), 32439 item, 32440 mediaField, 32441 titleField, 32442 descriptionField: descriptionField2, 32443 otherFields, 32444 posinset: view.infiniteScrollEnabled ? index2 + 1 : void 0 32445 } 32446 ); 32447 }); 32448 } 32449 32450 // packages/dataviews/build-module/components/dataviews-layouts/activity/index.mjs 32451 var import_jsx_runtime132 = __toESM(require_jsx_runtime(), 1); 32452 function ViewActivity(props) { 32453 const { empty, data, fields, isLoading, view, className } = props; 32454 const isDelayedLoading = useDelayedLoading(!!isLoading); 32455 const hasData = !!data?.length; 32456 const groupField = view.groupBy?.field ? fields.find((field) => field.id === view.groupBy?.field) : null; 32457 const dataByGroup = hasData && groupField ? getDataByGroup(data, groupField) : null; 32458 const isInfiniteScroll = view.infiniteScrollEnabled && !dataByGroup; 32459 if (!hasData) { 32460 return /* @__PURE__ */ (0, import_jsx_runtime132.jsx)( 32461 "div", 32462 { 32463 className: clsx_default("dataviews-no-results", { 32464 "is-refreshing": isDelayedLoading 32465 }), 32466 children: empty 32467 } 32468 ); 32469 } 32470 const isInert = !isInfiniteScroll && !!isLoading; 32471 const wrapperClassName = clsx_default("dataviews-view-activity", className, { 32472 "is-refreshing": !isInfiniteScroll && isDelayedLoading 32473 }); 32474 const groupedEntries = dataByGroup ? Array.from(dataByGroup.entries()) : []; 32475 if (hasData && groupField && dataByGroup) { 32476 return /* @__PURE__ */ (0, import_jsx_runtime132.jsx)( 32477 Stack, 32478 { 32479 direction: "column", 32480 gap: "sm", 32481 className: wrapperClassName, 32482 inert: isInert ? "true" : void 0, 32483 children: groupedEntries.map( 32484 ([groupName, groupData]) => /* @__PURE__ */ (0, import_jsx_runtime132.jsx)( 32485 ActivityGroup, 32486 { 32487 groupName, 32488 groupData, 32489 groupField, 32490 showLabel: view.groupBy?.showLabel !== false, 32491 children: /* @__PURE__ */ (0, import_jsx_runtime132.jsx)( 32492 ActivityItems, 32493 { 32494 ...props, 32495 data: groupData 32496 } 32497 ) 32498 }, 32499 groupName 32500 ) 32501 ) 32502 } 32503 ); 32504 } 32505 return /* @__PURE__ */ (0, import_jsx_runtime132.jsxs)(import_jsx_runtime132.Fragment, { children: [ 32506 /* @__PURE__ */ (0, import_jsx_runtime132.jsx)( 32507 "div", 32508 { 32509 className: wrapperClassName, 32510 role: view.infiniteScrollEnabled ? "feed" : void 0, 32511 inert: isInert ? "true" : void 0, 32512 children: /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(ActivityItems, { ...props }) 32513 } 32514 ), 32515 isInfiniteScroll && isLoading && /* @__PURE__ */ (0, import_jsx_runtime132.jsx)("p", { className: "dataviews-loading-more", children: /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(import_components12.Spinner, {}) }) 32516 ] }); 32517 } 32518 32519 // packages/dataviews/build-module/components/dataviews-layouts/picker-grid/index.mjs 32520 var import_components15 = __toESM(require_components(), 1); 32521 var import_i18n32 = __toESM(require_i18n(), 1); 32522 var import_compose10 = __toESM(require_compose(), 1); 32523 var import_element92 = __toESM(require_element(), 1); 32524 32525 // packages/dataviews/build-module/components/dataviews-picker-footer/index.mjs 32526 var import_components14 = __toESM(require_components(), 1); 32527 var import_data6 = __toESM(require_data(), 1); 32528 var import_element91 = __toESM(require_element(), 1); 32529 var import_i18n31 = __toESM(require_i18n(), 1); 32530 32531 // packages/dataviews/build-module/components/dataviews-pagination/index.mjs 32532 var import_components13 = __toESM(require_components(), 1); 32533 var import_element90 = __toESM(require_element(), 1); 32534 var import_i18n30 = __toESM(require_i18n(), 1); 32535 var import_jsx_runtime133 = __toESM(require_jsx_runtime(), 1); 32536 function hasPaginationControls(view, paginationInfo) { 32537 return !view.infiniteScrollEnabled && paginationInfo.totalItems > 0 && paginationInfo.totalPages > 1; 32538 } 32539 function DataViewsPageSelect({ className }) { 32540 const { view, onChangeView, paginationInfo } = (0, import_element90.useContext)(dataviews_context_default); 32541 if (!hasPaginationControls(view, paginationInfo)) { 32542 return null; 32543 } 32544 const { totalPages } = paginationInfo; 32545 const currentPage = view.page ?? 1; 32546 const pageSelectOptions = Array.from(Array(totalPages)).map( 32547 (_, i) => { 32548 const page = i + 1; 32549 return { 32550 value: page.toString(), 32551 label: page.toString(), 32552 "aria-label": currentPage === page ? (0, import_i18n30.sprintf)( 32553 // translators: 1: current page number. 2: total number of pages. 32554 (0, import_i18n30.__)("Page %1$d of %2$d"), 32555 currentPage, 32556 totalPages 32557 ) : page.toString() 32558 }; 32559 } 32560 ); 32561 return /* @__PURE__ */ (0, import_jsx_runtime133.jsx)( 32562 Stack, 32563 { 32564 direction: "row", 32565 justify: "flex-start", 32566 align: "center", 32567 gap: "xs", 32568 className: clsx_default("dataviews-pagination__page-select", className), 32569 children: (0, import_element90.createInterpolateElement)( 32570 (0, import_i18n30.sprintf)( 32571 // translators: 1: Current page number, 2: Total number of pages. 32572 (0, import_i18n30._x)("<div>Page</div>%1$s<div>of %2$d</div>", "paging"), 32573 "<CurrentPage />", 32574 totalPages 32575 ), 32576 { 32577 div: /* @__PURE__ */ (0, import_jsx_runtime133.jsx)("div", { "aria-hidden": true }), 32578 // @ts-expect-error — Tag injected via sprintf argument, not visible in format string. 32579 CurrentPage: /* @__PURE__ */ (0, import_jsx_runtime133.jsx)( 32580 import_components13.SelectControl, 32581 { 32582 "aria-label": (0, import_i18n30.__)("Current page"), 32583 value: currentPage.toString(), 32584 options: pageSelectOptions, 32585 onChange: (newValue) => { 32586 onChangeView({ 32587 ...view, 32588 page: +newValue 32589 }); 32590 }, 32591 size: "small", 32592 variant: "minimal" 32593 } 32594 ) 32595 } 32596 ) 32597 } 32598 ); 32599 } 32600 function DataViewsPageNavigation({ 32601 className 32602 }) { 32603 const { view, onChangeView, paginationInfo } = (0, import_element90.useContext)(dataviews_context_default); 32604 if (!hasPaginationControls(view, paginationInfo)) { 32605 return null; 32606 } 32607 const { totalPages } = paginationInfo; 32608 const currentPage = view.page ?? 1; 32609 return /* @__PURE__ */ (0, import_jsx_runtime133.jsxs)( 32610 Stack, 32611 { 32612 direction: "row", 32613 gap: "xs", 32614 align: "center", 32615 className: clsx_default( 32616 "dataviews-pagination__page-navigation", 32617 className 32618 ), 32619 children: [ 32620 /* @__PURE__ */ (0, import_jsx_runtime133.jsx)( 32621 import_components13.Button, 32622 { 32623 onClick: () => onChangeView({ 32624 ...view, 32625 page: currentPage - 1 32626 }), 32627 disabled: currentPage === 1, 32628 accessibleWhenDisabled: true, 32629 label: (0, import_i18n30.__)("Previous page"), 32630 icon: (0, import_i18n30.isRTL)() ? next_default : previous_default, 32631 showTooltip: true, 32632 size: "compact", 32633 tooltipPosition: "top" 32634 } 32635 ), 32636 /* @__PURE__ */ (0, import_jsx_runtime133.jsx)( 32637 import_components13.Button, 32638 { 32639 onClick: () => onChangeView({ ...view, page: currentPage + 1 }), 32640 disabled: currentPage >= totalPages, 32641 accessibleWhenDisabled: true, 32642 label: (0, import_i18n30.__)("Next page"), 32643 icon: (0, import_i18n30.isRTL)() ? previous_default : next_default, 32644 showTooltip: true, 32645 size: "compact", 32646 tooltipPosition: "top" 32647 } 32648 ) 32649 ] 32650 } 32651 ); 32652 } 32653 function DataViewsPagination({ 32654 children, 32655 className 32656 }) { 32657 const { view, paginationInfo } = (0, import_element90.useContext)(dataviews_context_default); 32658 if (!hasPaginationControls(view, paginationInfo)) { 32659 return null; 32660 } 32661 return /* @__PURE__ */ (0, import_jsx_runtime133.jsx)( 32662 Stack, 32663 { 32664 direction: "row", 32665 className: clsx_default("dataviews-pagination", className), 32666 justify: "end", 32667 align: "center", 32668 gap: "xl", 32669 children: children ?? /* @__PURE__ */ (0, import_jsx_runtime133.jsxs)(import_jsx_runtime133.Fragment, { children: [ 32670 /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(DataViewsPageSelect, {}), 32671 /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(DataViewsPageNavigation, {}) 32672 ] }) 32673 } 32674 ); 32675 } 32676 var dataviews_pagination_default = (0, import_element90.memo)(DataViewsPagination); 32677 32678 // packages/dataviews/build-module/components/dataviews-picker-footer/index.mjs 32679 var import_jsx_runtime134 = __toESM(require_jsx_runtime(), 1); 32680 var EMPTY_ARRAY2 = []; 32681 function useIsMultiselectPicker(actions) { 32682 return (0, import_element91.useMemo)(() => { 32683 return !!actions?.length && actions?.every((action) => action.supportsBulk); 32684 }, [actions]); 32685 } 32686 function BulkSelectionCheckbox2({ 32687 selection, 32688 selectedItems, 32689 onChangeSelection, 32690 data, 32691 getItemId, 32692 disableSelectAll = false 32693 }) { 32694 const hasSelection = selection.length > 0; 32695 const areAllSelected = selectedItems.length === data.length; 32696 if (disableSelectAll) { 32697 return /* @__PURE__ */ (0, import_jsx_runtime134.jsx)( 32698 import_components14.CheckboxControl, 32699 { 32700 className: "dataviews-view-table-selection-checkbox", 32701 checked: hasSelection, 32702 disabled: !hasSelection, 32703 onChange: () => { 32704 onChangeSelection([]); 32705 }, 32706 "aria-label": (0, import_i18n31.__)("Deselect all") 32707 } 32708 ); 32709 } 32710 return /* @__PURE__ */ (0, import_jsx_runtime134.jsx)( 32711 import_components14.CheckboxControl, 32712 { 32713 className: "dataviews-view-table-selection-checkbox", 32714 checked: areAllSelected, 32715 indeterminate: !areAllSelected && !!selectedItems.length, 32716 onChange: () => { 32717 if (areAllSelected) { 32718 onChangeSelection( 32719 selection.filter( 32720 (id) => !data.some( 32721 (item) => id === getItemId(item) 32722 ) 32723 ) 32724 ); 32725 } else { 32726 const selectionSet = /* @__PURE__ */ new Set([ 32727 ...selection, 32728 ...data.map((item) => getItemId(item)) 32729 ]); 32730 onChangeSelection(Array.from(selectionSet)); 32731 } 32732 }, 32733 "aria-label": areAllSelected ? (0, import_i18n31.__)("Deselect all") : (0, import_i18n31.__)("Select all") 32734 } 32735 ); 32736 } 32737 function ActionButtons({ 32738 actions, 32739 items, 32740 selection 32741 }) { 32742 const registry = (0, import_data6.useRegistry)(); 32743 const [actionInProgress, setActionInProgress] = (0, import_element91.useState)( 32744 null 32745 ); 32746 return /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(Stack, { direction: "row", gap: "xs", children: actions.map((action) => { 32747 if (!("callback" in action)) { 32748 return null; 32749 } 32750 const { id, label, icon, isPrimary, isEligible, callback } = action; 32751 const eligibleItems = isEligible ? items.filter((item) => isEligible(item)) : items; 32752 const _label = typeof label === "string" ? label : label(items); 32753 const variant = isPrimary ? "primary" : "tertiary"; 32754 const isInProgress = id === actionInProgress; 32755 return /* @__PURE__ */ (0, import_jsx_runtime134.jsx)( 32756 import_components14.Button, 32757 { 32758 accessibleWhenDisabled: true, 32759 icon, 32760 disabled: isInProgress || !selection?.length || !!isEligible && !eligibleItems.length, 32761 isBusy: isInProgress, 32762 onClick: async () => { 32763 setActionInProgress(id); 32764 await callback(eligibleItems, { 32765 registry 32766 }); 32767 setActionInProgress(null); 32768 }, 32769 size: "compact", 32770 variant, 32771 children: _label 32772 }, 32773 id 32774 ); 32775 }) }); 32776 } 32777 function PickerBulkSelectionInfo() { 32778 const { 32779 data, 32780 selection, 32781 onChangeSelection, 32782 getItemId, 32783 actions = EMPTY_ARRAY2, 32784 paginationInfo, 32785 view 32786 } = (0, import_element91.useContext)(dataviews_context_default); 32787 const isMultiselect = useIsMultiselectPicker(actions); 32788 const selectedItems = (0, import_element91.useMemo)( 32789 () => data.filter((item) => selection.includes(getItemId(item))), 32790 [selection, getItemId, data] 32791 ); 32792 if (!actions.length) { 32793 return null; 32794 } 32795 const message2 = getFooterMessage( 32796 selection.length, 32797 data.length, 32798 paginationInfo.totalItems, 32799 !!view.infiniteScrollEnabled 32800 ); 32801 return /* @__PURE__ */ (0, import_jsx_runtime134.jsxs)( 32802 Stack, 32803 { 32804 direction: "row", 32805 className: "dataviews-picker-footer__bulk-selection", 32806 gap: "md", 32807 align: "center", 32808 children: [ 32809 isMultiselect && /* @__PURE__ */ (0, import_jsx_runtime134.jsx)( 32810 BulkSelectionCheckbox2, 32811 { 32812 selection, 32813 selectedItems, 32814 onChangeSelection, 32815 data, 32816 getItemId, 32817 disableSelectAll: !!view.infiniteScrollEnabled 32818 } 32819 ), 32820 /* @__PURE__ */ (0, import_jsx_runtime134.jsx)("span", { className: "dataviews-bulk-actions-footer__item-count", children: message2 }) 32821 ] 32822 } 32823 ); 32824 } 32825 function PickerActions({ className }) { 32826 const { 32827 data, 32828 selection, 32829 getItemId, 32830 actions = EMPTY_ARRAY2 32831 } = (0, import_element91.useContext)(dataviews_context_default); 32832 const selectedItems = (0, import_element91.useMemo)( 32833 () => data.filter((item) => selection.includes(getItemId(item))), 32834 [selection, getItemId, data] 32835 ); 32836 if (!actions.length) { 32837 return null; 32838 } 32839 return /* @__PURE__ */ (0, import_jsx_runtime134.jsx)( 32840 "div", 32841 { 32842 className: clsx_default("dataviews-picker-footer__actions", className), 32843 children: /* @__PURE__ */ (0, import_jsx_runtime134.jsx)( 32844 ActionButtons, 32845 { 32846 actions, 32847 items: selectedItems, 32848 selection 32849 } 32850 ) 32851 } 32852 ); 32853 } 32854 function DataViewsPickerBulkActionToolbar({ 32855 className 32856 }) { 32857 return /* @__PURE__ */ (0, import_jsx_runtime134.jsxs)(Stack, { direction: "row", gap: "md", align: "center", className, children: [ 32858 /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(PickerBulkSelectionInfo, {}), 32859 /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(PickerActions, {}) 32860 ] }); 32861 } 32862 function DataViewsPickerFooter({ 32863 children, 32864 className 32865 }) { 32866 const { 32867 actions = EMPTY_ARRAY2, 32868 paginationInfo, 32869 view 32870 } = (0, import_element91.useContext)(dataviews_context_default); 32871 const hasPagination = !view.infiniteScrollEnabled && !!paginationInfo.totalItems && paginationInfo.totalPages > 1; 32872 const rendersDefaultContents = children === void 0 || children === null; 32873 if (rendersDefaultContents && !actions.length && !hasPagination) { 32874 return null; 32875 } 32876 return /* @__PURE__ */ (0, import_jsx_runtime134.jsx)( 32877 Stack, 32878 { 32879 direction: "row", 32880 justify: "space-between", 32881 align: "center", 32882 className: clsx_default("dataviews-footer", className), 32883 gap: "sm", 32884 children: children ?? /* @__PURE__ */ (0, import_jsx_runtime134.jsxs)(import_jsx_runtime134.Fragment, { children: [ 32885 /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(PickerBulkSelectionInfo, {}), 32886 /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(dataviews_pagination_default, {}), 32887 /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(PickerActions, {}) 32888 ] }) 32889 } 32890 ); 32891 } 32892 32893 // packages/dataviews/build-module/components/dataviews-layouts/picker-grid/index.mjs 32894 var import_jsx_runtime135 = __toESM(require_jsx_runtime(), 1); 32895 function GridItem3({ 32896 view, 32897 selection, 32898 onChangeSelection, 32899 selectionProps, 32900 getItemId, 32901 item, 32902 mediaField, 32903 titleField, 32904 descriptionField: descriptionField2, 32905 regularFields, 32906 badgeFields, 32907 config, 32908 posinset, 32909 setsize 32910 }) { 32911 const { showTitle = true, showMedia = true, showDescription = true } = view; 32912 const id = getItemId(item); 32913 const elementRef = (0, import_element92.useRef)(null); 32914 const isSelected2 = selection.includes(id); 32915 useIntersectionObserver(elementRef, posinset); 32916 const renderedMediaField = mediaField?.render ? /* @__PURE__ */ (0, import_jsx_runtime135.jsx)( 32917 mediaField.render, 32918 { 32919 item, 32920 field: mediaField, 32921 config 32922 } 32923 ) : null; 32924 const renderedTitleField = showTitle && titleField?.render ? /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(titleField.render, { item, field: titleField }) : null; 32925 return /* @__PURE__ */ (0, import_jsx_runtime135.jsxs)( 32926 import_components15.Composite.Item, 32927 { 32928 ref: elementRef, 32929 "aria-label": titleField ? titleField.getValue({ item }) || (0, import_i18n32.__)("(no title)") : void 0, 32930 render: ({ children, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(Stack, { direction: "column", children, ...props }), 32931 role: "option", 32932 "aria-posinset": posinset, 32933 "aria-setsize": setsize, 32934 className: clsx_default("dataviews-view-picker-grid__card", { 32935 "is-selected": isSelected2 32936 }), 32937 "aria-selected": isSelected2, 32938 ...selectionProps, 32939 children: [ 32940 showMedia && renderedMediaField && /* @__PURE__ */ (0, import_jsx_runtime135.jsx)("div", { className: "dataviews-view-picker-grid__media", children: renderedMediaField }), 32941 showMedia && renderedMediaField && /* @__PURE__ */ (0, import_jsx_runtime135.jsx)( 32942 DataViewsSelectionCheckbox, 32943 { 32944 item, 32945 selection, 32946 onChangeSelection, 32947 getItemId, 32948 titleField, 32949 disabled: false, 32950 "aria-hidden": true, 32951 tabIndex: -1 32952 } 32953 ), 32954 showTitle && /* @__PURE__ */ (0, import_jsx_runtime135.jsx)( 32955 Stack, 32956 { 32957 direction: "row", 32958 justify: "space-between", 32959 className: "dataviews-view-picker-grid__title-actions", 32960 children: /* @__PURE__ */ (0, import_jsx_runtime135.jsx)("div", { className: "dataviews-view-picker-grid__title-field dataviews-title-field", children: renderedTitleField }) 32961 } 32962 ), 32963 /* @__PURE__ */ (0, import_jsx_runtime135.jsxs)(Stack, { direction: "column", gap: "xs", children: [ 32964 showDescription && descriptionField2?.render && /* @__PURE__ */ (0, import_jsx_runtime135.jsx)( 32965 descriptionField2.render, 32966 { 32967 item, 32968 field: descriptionField2 32969 } 32970 ), 32971 !!badgeFields?.length && /* @__PURE__ */ (0, import_jsx_runtime135.jsx)( 32972 Stack, 32973 { 32974 direction: "row", 32975 className: "dataviews-view-picker-grid__badge-fields", 32976 gap: "sm", 32977 wrap: "wrap", 32978 align: "top", 32979 justify: "flex-start", 32980 children: badgeFields.map((field) => { 32981 return ( 32982 /* @ts-expect-error `Badge` is text-only, but a badge field renders whatever its `render` returns. */ 32983 /* @__PURE__ */ (0, import_jsx_runtime135.jsx)( 32984 Badge, 32985 { 32986 className: "dataviews-view-picker-grid__field-value", 32987 children: /* @__PURE__ */ (0, import_jsx_runtime135.jsx)( 32988 field.render, 32989 { 32990 item, 32991 field 32992 } 32993 ) 32994 }, 32995 field.id 32996 ) 32997 ); 32998 }) 32999 } 33000 ), 33001 !!regularFields?.length && /* @__PURE__ */ (0, import_jsx_runtime135.jsx)( 33002 Stack, 33003 { 33004 direction: "column", 33005 className: "dataviews-view-picker-grid__fields", 33006 gap: "xs", 33007 children: regularFields.map((field) => { 33008 return /* @__PURE__ */ (0, import_jsx_runtime135.jsx)( 33009 import_components15.Flex, 33010 { 33011 className: "dataviews-view-picker-grid__field", 33012 gap: 1, 33013 justify: "flex-start", 33014 expanded: true, 33015 style: { height: "auto" }, 33016 direction: "row", 33017 children: /* @__PURE__ */ (0, import_jsx_runtime135.jsxs)(import_jsx_runtime135.Fragment, { children: [ 33018 /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(import_components15.FlexItem, { className: "dataviews-view-picker-grid__field-name", children: field.header }), 33019 /* @__PURE__ */ (0, import_jsx_runtime135.jsx)( 33020 import_components15.FlexItem, 33021 { 33022 className: "dataviews-view-picker-grid__field-value", 33023 style: { maxHeight: "none" }, 33024 children: /* @__PURE__ */ (0, import_jsx_runtime135.jsx)( 33025 field.render, 33026 { 33027 item, 33028 field 33029 } 33030 ) 33031 } 33032 ) 33033 ] }) 33034 }, 33035 field.id 33036 ); 33037 }) 33038 } 33039 ) 33040 ] }) 33041 ] 33042 }, 33043 id 33044 ); 33045 } 33046 function GridGroup({ 33047 groupName, 33048 groupField, 33049 showLabel = true, 33050 children 33051 }) { 33052 const headerId = (0, import_compose10.useInstanceId)( 33053 GridGroup, 33054 "dataviews-view-picker-grid-group__header" 33055 ); 33056 return /* @__PURE__ */ (0, import_jsx_runtime135.jsxs)( 33057 Stack, 33058 { 33059 direction: "column", 33060 gap: "sm", 33061 role: "group", 33062 "aria-labelledby": headerId, 33063 children: [ 33064 /* @__PURE__ */ (0, import_jsx_runtime135.jsx)( 33065 "h3", 33066 { 33067 className: "dataviews-view-picker-grid-group__header", 33068 id: headerId, 33069 children: showLabel ? (0, import_i18n32.sprintf)( 33070 // translators: 1: The label of the field e.g. "Date". 2: The value of the field, e.g.: "May 2022". 33071 (0, import_i18n32.__)("%1$s: %2$s"), 33072 groupField.label, 33073 groupName 33074 ) : groupName 33075 } 33076 ), 33077 children 33078 ] 33079 }, 33080 groupName 33081 ); 33082 } 33083 function ViewPickerGrid({ 33084 actions, 33085 data, 33086 fields, 33087 getItemId, 33088 isLoading, 33089 onChangeSelection, 33090 selection, 33091 view, 33092 className, 33093 empty 33094 }) { 33095 const { resizeObserverRef, paginationInfo, itemListLabel } = (0, import_element92.useContext)(dataviews_context_default); 33096 const titleField = fields.find( 33097 (field) => field.id === view?.titleField 33098 ); 33099 const mediaField = fields.find( 33100 (field) => field.id === view?.mediaField 33101 ); 33102 const descriptionField2 = fields.find( 33103 (field) => field.id === view?.descriptionField 33104 ); 33105 const otherFields = view.fields ?? []; 33106 const { regularFields, badgeFields } = otherFields.reduce( 33107 (accumulator, fieldId) => { 33108 const field = fields.find((f) => f.id === fieldId); 33109 if (!field) { 33110 return accumulator; 33111 } 33112 const key = view.layout?.badgeFields?.includes(fieldId) ? "badgeFields" : "regularFields"; 33113 accumulator[key].push(field); 33114 return accumulator; 33115 }, 33116 { regularFields: [], badgeFields: [] } 33117 ); 33118 const hasData = !!data?.length; 33119 const usedPreviewSize = view.layout?.previewSize; 33120 const isMultiselect = useIsMultiselectPicker(actions); 33121 const size4 = "900px"; 33122 const groupField = view.groupBy?.field ? fields.find((f) => f.id === view.groupBy?.field) : null; 33123 const dataByGroup = groupField ? getDataByGroup(data, groupField) : null; 33124 const isInfiniteScroll = (view.infiniteScrollEnabled && !dataByGroup) ?? false; 33125 const orderedData = dataByGroup ? Array.from(dataByGroup.values()).flat() : data; 33126 const { getSelectionProps } = useSelectionProps({ 33127 data: orderedData, 33128 getItemId, 33129 isItemSelectable: () => true, 33130 selection, 33131 onChangeSelection, 33132 selectionMode: isMultiselect ? "multi" : "single-clearable", 33133 shouldSelectOnClick: true 33134 }); 33135 const currentPage = view?.page ?? 1; 33136 const perPage = view?.perPage ?? 0; 33137 const setSize = isInfiniteScroll ? paginationInfo?.totalItems : void 0; 33138 const isMediaContain = view.layout?.mediaFit === "contain"; 33139 const gridColumns = useGridColumns(); 33140 const placeholdersNeeded = usePlaceholdersNeeded( 33141 data, 33142 isInfiniteScroll, 33143 gridColumns 33144 ); 33145 return /* @__PURE__ */ (0, import_jsx_runtime135.jsxs)(import_jsx_runtime135.Fragment, { 33146 // Render multiple groups. 33147 children: [ 33148 hasData && groupField && dataByGroup && /* @__PURE__ */ (0, import_jsx_runtime135.jsx)( 33149 import_components15.Composite, 33150 { 33151 virtualFocus: true, 33152 orientation: "horizontal", 33153 role: "listbox", 33154 "aria-multiselectable": isMultiselect, 33155 className: clsx_default( 33156 "dataviews-view-picker-grid", 33157 className, 33158 { 33159 [`has-$view.layout?.density}-density`]: view.layout?.density && ["compact", "comfortable"].includes( 33160 view.layout.density 33161 ), 33162 "has-media-fit-contain": isMediaContain 33163 } 33164 ), 33165 "aria-label": itemListLabel, 33166 render: ({ children, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime135.jsx)( 33167 Stack, 33168 { 33169 direction: "column", 33170 gap: "lg", 33171 children, 33172 ...props 33173 } 33174 ), 33175 children: Array.from(dataByGroup.entries()).map( 33176 ([groupName, groupItems]) => /* @__PURE__ */ (0, import_jsx_runtime135.jsx)( 33177 GridGroup, 33178 { 33179 groupName, 33180 groupField, 33181 showLabel: view.groupBy?.showLabel !== false, 33182 children: /* @__PURE__ */ (0, import_jsx_runtime135.jsx)( 33183 GridItems, 33184 { 33185 previewSize: usedPreviewSize, 33186 "aria-busy": isLoading, 33187 ref: resizeObserverRef, 33188 children: groupItems.map((item) => { 33189 const posInSet = item.position ?? (currentPage - 1) * perPage + data.indexOf(item) + 1; 33190 return /* @__PURE__ */ (0, import_jsx_runtime135.jsx)( 33191 GridItem3, 33192 { 33193 view, 33194 selection, 33195 onChangeSelection, 33196 selectionProps: getSelectionProps( 33197 getItemId(item) 33198 ), 33199 getItemId, 33200 item, 33201 mediaField, 33202 titleField, 33203 descriptionField: descriptionField2, 33204 regularFields, 33205 badgeFields, 33206 config: { 33207 sizes: size4 33208 }, 33209 posinset: posInSet, 33210 setsize: setSize 33211 }, 33212 getItemId(item) 33213 ); 33214 }) 33215 } 33216 ) 33217 }, 33218 groupName 33219 ) 33220 ) 33221 } 33222 ), 33223 // Render a single grid with all data. 33224 hasData && !dataByGroup && /* @__PURE__ */ (0, import_jsx_runtime135.jsxs)( 33225 import_components15.Composite, 33226 { 33227 render: /* @__PURE__ */ (0, import_jsx_runtime135.jsx)( 33228 GridItems, 33229 { 33230 className: clsx_default( 33231 "dataviews-view-picker-grid", 33232 className, 33233 { 33234 [`has-$view.layout?.density}-density`]: view.layout?.density && [ 33235 "compact", 33236 "comfortable" 33237 ].includes(view.layout.density), 33238 "has-media-fit-contain": isMediaContain 33239 } 33240 ), 33241 previewSize: usedPreviewSize, 33242 "aria-busy": isLoading, 33243 ref: resizeObserverRef 33244 } 33245 ), 33246 virtualFocus: true, 33247 orientation: "horizontal", 33248 role: "listbox", 33249 "aria-multiselectable": isMultiselect, 33250 "aria-label": itemListLabel, 33251 children: [ 33252 Array.from({ length: placeholdersNeeded }).map( 33253 (_, index2) => /* @__PURE__ */ (0, import_jsx_runtime135.jsx)( 33254 import_components15.Composite.Item, 33255 { 33256 render: ({ children, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime135.jsx)( 33257 Stack, 33258 { 33259 direction: "column", 33260 children, 33261 ...props 33262 } 33263 ), 33264 role: "option", 33265 "aria-hidden": true, 33266 tabIndex: -1, 33267 className: "dataviews-view-picker-grid__card dataviews-view-picker-grid__placeholder" 33268 }, 33269 `placeholder-$index2}` 33270 ) 33271 ), 33272 data.map((item) => { 33273 const posinset = item.position; 33274 return /* @__PURE__ */ (0, import_jsx_runtime135.jsx)( 33275 GridItem3, 33276 { 33277 view, 33278 selection, 33279 onChangeSelection, 33280 selectionProps: getSelectionProps( 33281 getItemId(item) 33282 ), 33283 getItemId, 33284 item, 33285 mediaField, 33286 titleField, 33287 descriptionField: descriptionField2, 33288 regularFields, 33289 badgeFields, 33290 config: { 33291 sizes: size4 33292 }, 33293 posinset, 33294 setsize: setSize 33295 }, 33296 getItemId(item) 33297 ); 33298 }) 33299 ] 33300 } 33301 ), 33302 // Render empty state. 33303 !hasData && /* @__PURE__ */ (0, import_jsx_runtime135.jsx)( 33304 "div", 33305 { 33306 className: clsx_default({ 33307 "dataviews-loading": isLoading, 33308 "dataviews-no-results": !isLoading 33309 }), 33310 children: isLoading ? /* @__PURE__ */ (0, import_jsx_runtime135.jsx)("p", { children: /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(import_components15.Spinner, {}) }) : empty 33311 } 33312 ), 33313 hasData && isLoading && /* @__PURE__ */ (0, import_jsx_runtime135.jsx)("p", { className: "dataviews-loading-more", children: /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(import_components15.Spinner, {}) }) 33314 ] 33315 }); 33316 } 33317 var picker_grid_default = ViewPickerGrid; 33318 33319 // packages/dataviews/build-module/components/dataviews-layouts/picker-table/index.mjs 33320 var import_i18n33 = __toESM(require_i18n(), 1); 33321 var import_components16 = __toESM(require_components(), 1); 33322 var import_element93 = __toESM(require_element(), 1); 33323 var import_jsx_runtime136 = __toESM(require_jsx_runtime(), 1); 33324 function TableColumnField2({ 33325 item, 33326 fields, 33327 column, 33328 align 33329 }) { 33330 const field = fields.find((f) => f.id === column); 33331 if (!field) { 33332 return null; 33333 } 33334 const className = clsx_default("dataviews-view-table__cell-content-wrapper", { 33335 "dataviews-view-table__cell-align-end": align === "end", 33336 "dataviews-view-table__cell-align-center": align === "center" 33337 }); 33338 return /* @__PURE__ */ (0, import_jsx_runtime136.jsx)("div", { className, children: /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(field.render, { item, field }) }); 33339 } 33340 function TableRow2({ 33341 item, 33342 fields, 33343 id, 33344 view, 33345 titleField, 33346 mediaField, 33347 descriptionField: descriptionField2, 33348 selection, 33349 getItemId, 33350 onChangeSelection, 33351 selectionProps, 33352 posinset 33353 }) { 33354 const { paginationInfo } = (0, import_element93.useContext)(dataviews_context_default); 33355 const isSelected2 = selection.includes(id); 33356 const [isHovered, setIsHovered] = (0, import_element93.useState)(false); 33357 const elementRef = (0, import_element93.useRef)(null); 33358 useIntersectionObserver(elementRef, posinset); 33359 const { 33360 showTitle = true, 33361 showMedia = true, 33362 showDescription = true, 33363 infiniteScrollEnabled 33364 } = view; 33365 const handleMouseEnter = () => { 33366 setIsHovered(true); 33367 }; 33368 const handleMouseLeave = () => { 33369 setIsHovered(false); 33370 }; 33371 const columns = getTableColumns(view, fields); 33372 const hasPrimaryColumn = titleField && showTitle || mediaField && showMedia || descriptionField2 && showDescription; 33373 return /* @__PURE__ */ (0, import_jsx_runtime136.jsxs)( 33374 import_components16.Composite.Item, 33375 { 33376 ref: elementRef, 33377 render: ({ children, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime136.jsx)( 33378 "tr", 33379 { 33380 className: clsx_default("dataviews-view-table__row", { 33381 "is-selected": isSelected2, 33382 "is-hovered": isHovered 33383 }), 33384 onMouseEnter: handleMouseEnter, 33385 onMouseLeave: handleMouseLeave, 33386 children, 33387 ...props 33388 } 33389 ), 33390 "aria-selected": isSelected2, 33391 "aria-setsize": paginationInfo.totalItems || void 0, 33392 "aria-posinset": posinset, 33393 role: infiniteScrollEnabled ? "article" : "option", 33394 onClickCapture: selectionProps.onClickCapture, 33395 onClick: selectionProps.onClick, 33396 onMouseDown: (event) => { 33397 if (event.button !== 0) { 33398 return; 33399 } 33400 event.currentTarget.parentElement?.focus({ 33401 preventScroll: true 33402 }); 33403 selectionProps.onMouseDown(event); 33404 }, 33405 children: [ 33406 /* @__PURE__ */ (0, import_jsx_runtime136.jsx)( 33407 "td", 33408 { 33409 className: "dataviews-view-table__checkbox-column", 33410 role: "presentation", 33411 children: /* @__PURE__ */ (0, import_jsx_runtime136.jsx)("div", { className: "dataviews-view-table__cell-content-wrapper", children: /* @__PURE__ */ (0, import_jsx_runtime136.jsx)( 33412 DataViewsSelectionCheckbox, 33413 { 33414 item, 33415 selection, 33416 onChangeSelection, 33417 getItemId, 33418 titleField, 33419 disabled: false, 33420 "aria-hidden": true, 33421 tabIndex: -1 33422 } 33423 ) }) 33424 } 33425 ), 33426 hasPrimaryColumn && /* @__PURE__ */ (0, import_jsx_runtime136.jsx)( 33427 "td", 33428 { 33429 role: "presentation", 33430 children: /* @__PURE__ */ (0, import_jsx_runtime136.jsx)( 33431 column_primary_default, 33432 { 33433 item, 33434 titleField: showTitle ? titleField : void 0, 33435 mediaField: showMedia ? mediaField : void 0, 33436 descriptionField: showDescription ? descriptionField2 : void 0, 33437 isItemClickable: () => false 33438 } 33439 ) 33440 } 33441 ), 33442 columns.map((column) => { 33443 const { width, maxWidth, minWidth, align } = view.layout?.styles?.[column] ?? {}; 33444 return /* @__PURE__ */ (0, import_jsx_runtime136.jsx)( 33445 "td", 33446 { 33447 style: { 33448 width, 33449 maxWidth, 33450 minWidth 33451 }, 33452 role: "presentation", 33453 children: /* @__PURE__ */ (0, import_jsx_runtime136.jsx)( 33454 TableColumnField2, 33455 { 33456 fields, 33457 item, 33458 column, 33459 align 33460 } 33461 ) 33462 }, 33463 column 33464 ); 33465 }) 33466 ] 33467 }, 33468 id 33469 ); 33470 } 33471 function ViewPickerTable({ 33472 actions, 33473 data, 33474 fields, 33475 getItemId, 33476 isLoading = false, 33477 onChangeView, 33478 onChangeSelection, 33479 selection, 33480 setOpenedFilter, 33481 view, 33482 className, 33483 empty 33484 }) { 33485 const headerMenuRefs = (0, import_element93.useRef)(/* @__PURE__ */ new Map()); 33486 const headerMenuToFocusRef = (0, import_element93.useRef)(void 0); 33487 const [nextHeaderMenuToFocus, setNextHeaderMenuToFocus] = (0, import_element93.useState)(); 33488 const isMultiselect = useIsMultiselectPicker(actions) ?? false; 33489 (0, import_element93.useEffect)(() => { 33490 if (headerMenuToFocusRef.current) { 33491 headerMenuToFocusRef.current.focus(); 33492 headerMenuToFocusRef.current = void 0; 33493 } 33494 }); 33495 const groupField = view.groupBy?.field ? fields.find((f) => f.id === view.groupBy?.field) : null; 33496 const dataByGroup = groupField ? getDataByGroup(data, groupField) : null; 33497 const isInfiniteScroll = view.infiniteScrollEnabled && !dataByGroup; 33498 const orderedData = dataByGroup ? Array.from(dataByGroup.values()).flat() : data; 33499 const { getSelectionProps } = useSelectionProps({ 33500 data: orderedData, 33501 getItemId, 33502 isItemSelectable: () => true, 33503 selection, 33504 onChangeSelection, 33505 selectionMode: isMultiselect ? "multi" : "single-clearable", 33506 shouldSelectOnClick: true 33507 }); 33508 const tableNoticeId = (0, import_element93.useId)(); 33509 if (nextHeaderMenuToFocus) { 33510 headerMenuToFocusRef.current = nextHeaderMenuToFocus; 33511 setNextHeaderMenuToFocus(void 0); 33512 return; 33513 } 33514 const onHide = (field) => { 33515 const hidden = headerMenuRefs.current.get(field.id); 33516 const fallback = hidden ? headerMenuRefs.current.get(hidden.fallback) : void 0; 33517 setNextHeaderMenuToFocus(fallback?.node); 33518 }; 33519 const hasData = !!data?.length; 33520 const titleField = fields.find((field) => field.id === view.titleField); 33521 const mediaField = fields.find((field) => field.id === view.mediaField); 33522 const descriptionField2 = fields.find( 33523 (field) => field.id === view.descriptionField 33524 ); 33525 const { showTitle = true, showMedia = true, showDescription = true } = view; 33526 const hasPrimaryColumn = titleField && showTitle || mediaField && showMedia || descriptionField2 && showDescription; 33527 const columns = getTableColumns(view, fields); 33528 const headerMenuRef = (column, index2) => (node) => { 33529 if (node) { 33530 headerMenuRefs.current.set(column, { 33531 node, 33532 fallback: columns[index2 > 0 ? index2 - 1 : 1] 33533 }); 33534 } else { 33535 headerMenuRefs.current.delete(column); 33536 } 33537 }; 33538 return /* @__PURE__ */ (0, import_jsx_runtime136.jsxs)(import_jsx_runtime136.Fragment, { children: [ 33539 /* @__PURE__ */ (0, import_jsx_runtime136.jsxs)( 33540 "table", 33541 { 33542 className: clsx_default( 33543 "dataviews-view-table", 33544 "dataviews-view-picker-table", 33545 className, 33546 { 33547 [`has-$view.layout?.density}-density`]: view.layout?.density && ["compact", "comfortable"].includes( 33548 view.layout.density 33549 ) 33550 } 33551 ), 33552 "aria-busy": isLoading, 33553 "aria-describedby": tableNoticeId, 33554 role: isInfiniteScroll ? "feed" : "listbox", 33555 children: [ 33556 /* @__PURE__ */ (0, import_jsx_runtime136.jsx)("thead", { role: "presentation", children: /* @__PURE__ */ (0, import_jsx_runtime136.jsxs)( 33557 "tr", 33558 { 33559 className: "dataviews-view-table__row", 33560 role: "presentation", 33561 children: [ 33562 /* @__PURE__ */ (0, import_jsx_runtime136.jsx)("th", { className: "dataviews-view-table__checkbox-column", children: isMultiselect && /* @__PURE__ */ (0, import_jsx_runtime136.jsx)( 33563 BulkSelectionCheckbox, 33564 { 33565 selection, 33566 onChangeSelection, 33567 data, 33568 actions, 33569 getItemId, 33570 disableSelectAll: isInfiniteScroll 33571 } 33572 ) }), 33573 hasPrimaryColumn && /* @__PURE__ */ (0, import_jsx_runtime136.jsx)("th", { children: titleField && /* @__PURE__ */ (0, import_jsx_runtime136.jsx)( 33574 column_header_menu_default, 33575 { 33576 ref: headerMenuRef( 33577 titleField.id, 33578 0 33579 ), 33580 fieldId: titleField.id, 33581 view, 33582 fields, 33583 onChangeView, 33584 onHide, 33585 setOpenedFilter, 33586 canMove: false 33587 } 33588 ) }), 33589 columns.map((column, index2) => { 33590 const { width, maxWidth, minWidth, align } = view.layout?.styles?.[column] ?? {}; 33591 return /* @__PURE__ */ (0, import_jsx_runtime136.jsx)( 33592 "th", 33593 { 33594 style: { 33595 width, 33596 maxWidth, 33597 minWidth, 33598 textAlign: align 33599 }, 33600 "aria-sort": view.sort?.direction && view.sort?.field === column ? sortValues[view.sort.direction] : void 0, 33601 scope: "col", 33602 children: /* @__PURE__ */ (0, import_jsx_runtime136.jsx)( 33603 column_header_menu_default, 33604 { 33605 ref: headerMenuRef(column, index2), 33606 fieldId: column, 33607 view, 33608 fields, 33609 onChangeView, 33610 onHide, 33611 setOpenedFilter, 33612 canMove: view.layout?.enableMoving ?? true 33613 } 33614 ) 33615 }, 33616 column 33617 ); 33618 }) 33619 ] 33620 } 33621 ) }), 33622 hasData && groupField && dataByGroup ? Array.from(dataByGroup.entries()).map( 33623 ([groupName, groupItems]) => /* @__PURE__ */ (0, import_jsx_runtime136.jsxs)( 33624 import_components16.Composite, 33625 { 33626 virtualFocus: true, 33627 orientation: "vertical", 33628 render: /* @__PURE__ */ (0, import_jsx_runtime136.jsx)("tbody", { role: "group" }), 33629 children: [ 33630 /* @__PURE__ */ (0, import_jsx_runtime136.jsx)( 33631 "tr", 33632 { 33633 className: "dataviews-view-table__group-header-row", 33634 role: "presentation", 33635 children: /* @__PURE__ */ (0, import_jsx_runtime136.jsx)( 33636 "td", 33637 { 33638 colSpan: columns.length + (hasPrimaryColumn ? 1 : 0) + 1, 33639 className: "dataviews-view-table__group-header-cell", 33640 role: "presentation", 33641 children: view.groupBy?.showLabel === false ? groupName : (0, import_i18n33.sprintf)( 33642 // translators: 1: The label of the field e.g. "Date". 2: The value of the field, e.g.: "May 2022". 33643 (0, import_i18n33.__)("%1$s: %2$s"), 33644 groupField.label, 33645 groupName 33646 ) 33647 } 33648 ) 33649 } 33650 ), 33651 groupItems.map((item, index2) => { 33652 const id = getItemId(item) || index2.toString(); 33653 return /* @__PURE__ */ (0, import_jsx_runtime136.jsx)( 33654 TableRow2, 33655 { 33656 item, 33657 fields, 33658 id, 33659 view, 33660 titleField, 33661 mediaField, 33662 descriptionField: descriptionField2, 33663 selection, 33664 getItemId, 33665 onChangeSelection, 33666 selectionProps: getSelectionProps( 33667 id 33668 ) 33669 }, 33670 getItemId(item) 33671 ); 33672 }) 33673 ] 33674 }, 33675 `group-$groupName}` 33676 ) 33677 ) : /* @__PURE__ */ (0, import_jsx_runtime136.jsx)( 33678 import_components16.Composite, 33679 { 33680 render: /* @__PURE__ */ (0, import_jsx_runtime136.jsx)("tbody", { role: "presentation" }), 33681 virtualFocus: true, 33682 orientation: "vertical", 33683 children: hasData && data.map((item, index2) => { 33684 const itemId = getItemId(item); 33685 const id = itemId || index2.toString(); 33686 const posinset = item.position; 33687 return /* @__PURE__ */ (0, import_jsx_runtime136.jsx)( 33688 TableRow2, 33689 { 33690 item, 33691 fields, 33692 id, 33693 view, 33694 titleField, 33695 mediaField, 33696 descriptionField: descriptionField2, 33697 selection, 33698 getItemId, 33699 onChangeSelection, 33700 selectionProps: getSelectionProps( 33701 id 33702 ), 33703 posinset 33704 }, 33705 itemId 33706 ); 33707 }) 33708 } 33709 ) 33710 ] 33711 } 33712 ), 33713 /* @__PURE__ */ (0, import_jsx_runtime136.jsxs)( 33714 "div", 33715 { 33716 className: clsx_default({ 33717 "dataviews-loading": isLoading, 33718 "dataviews-no-results": !hasData && !isLoading 33719 }), 33720 id: tableNoticeId, 33721 children: [ 33722 !hasData && (isLoading ? /* @__PURE__ */ (0, import_jsx_runtime136.jsx)("p", { children: /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(import_components16.Spinner, {}) }) : empty), 33723 hasData && isLoading && /* @__PURE__ */ (0, import_jsx_runtime136.jsx)("p", { className: "dataviews-loading-more", children: /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(import_components16.Spinner, {}) }) 33724 ] 33725 } 33726 ) 33727 ] }); 33728 } 33729 var picker_table_default = ViewPickerTable; 33730 33731 // packages/dataviews/build-module/components/dataviews-layouts/picker-activity/index.mjs 33732 var import_components17 = __toESM(require_components(), 1); 33733 var import_element94 = __toESM(require_element(), 1); 33734 var import_compose11 = __toESM(require_compose(), 1); 33735 var import_i18n34 = __toESM(require_i18n(), 1); 33736 var import_jsx_runtime137 = __toESM(require_jsx_runtime(), 1); 33737 function isDefined4(item) { 33738 return !!item; 33739 } 33740 function PickerActivityItem({ 33741 view, 33742 selection, 33743 selectionProps, 33744 getItemId, 33745 item, 33746 titleField, 33747 mediaField, 33748 descriptionField: descriptionField2, 33749 otherFields, 33750 posinset, 33751 setsize 33752 }) { 33753 const elementRef = (0, import_element94.useRef)(null); 33754 useIntersectionObserver(elementRef, posinset); 33755 const { showTitle = true, showMedia = true, showDescription = true } = view; 33756 const id = getItemId(item); 33757 const isSelected2 = selection.includes(id); 33758 const density = view.layout?.density ?? "balanced"; 33759 const mediaContent = showMedia && density !== "compact" && mediaField?.render ? /* @__PURE__ */ (0, import_jsx_runtime137.jsx)( 33760 mediaField.render, 33761 { 33762 item, 33763 field: mediaField, 33764 config: { 33765 sizes: density === "comfortable" ? "32px" : "24px" 33766 } 33767 } 33768 ) : null; 33769 const renderedMediaField = /* @__PURE__ */ (0, import_jsx_runtime137.jsx)("div", { className: "dataviews-view-picker-activity__item-type-icon", children: mediaContent || /* @__PURE__ */ (0, import_jsx_runtime137.jsx)( 33770 "span", 33771 { 33772 className: "dataviews-view-picker-activity__item-bullet", 33773 "aria-hidden": "true" 33774 } 33775 ) }); 33776 const renderedTitleField = showTitle && titleField?.render ? /* @__PURE__ */ (0, import_jsx_runtime137.jsx)(titleField.render, { item, field: titleField }) : null; 33777 const renderedDescriptionField = showDescription && descriptionField2?.render ? /* @__PURE__ */ (0, import_jsx_runtime137.jsx)(descriptionField2.render, { item, field: descriptionField2 }) : null; 33778 const verticalGap = (0, import_element94.useMemo)(() => { 33779 switch (density) { 33780 case "comfortable": 33781 return "md"; 33782 default: 33783 return "sm"; 33784 } 33785 }, [density]); 33786 return /* @__PURE__ */ (0, import_jsx_runtime137.jsx)( 33787 import_components17.Composite.Item, 33788 { 33789 ref: elementRef, 33790 role: "option", 33791 "aria-label": titleField ? titleField.getValue({ item }) || void 0 : void 0, 33792 "aria-posinset": posinset, 33793 "aria-setsize": setsize, 33794 "aria-selected": isSelected2, 33795 className: clsx_default( 33796 "dataviews-view-picker-activity__item", 33797 density === "compact" && "is-compact", 33798 density === "balanced" && "is-balanced", 33799 density === "comfortable" && "is-comfortable", 33800 isSelected2 && "is-selected" 33801 ), 33802 ...selectionProps, 33803 render: /* @__PURE__ */ (0, import_jsx_runtime137.jsx)("div", {}), 33804 children: /* @__PURE__ */ (0, import_jsx_runtime137.jsxs)(Stack, { direction: "row", gap: "lg", justify: "start", align: "flex-start", children: [ 33805 /* @__PURE__ */ (0, import_jsx_runtime137.jsx)( 33806 Stack, 33807 { 33808 direction: "column", 33809 gap: "xs", 33810 align: "center", 33811 className: "dataviews-view-picker-activity__item-type", 33812 children: renderedMediaField 33813 } 33814 ), 33815 /* @__PURE__ */ (0, import_jsx_runtime137.jsxs)( 33816 Stack, 33817 { 33818 direction: "column", 33819 gap: verticalGap, 33820 align: "flex-start", 33821 className: "dataviews-view-picker-activity__item-content", 33822 children: [ 33823 renderedTitleField && /* @__PURE__ */ (0, import_jsx_runtime137.jsx)("div", { className: "dataviews-view-picker-activity__item-title", children: renderedTitleField }), 33824 renderedDescriptionField && /* @__PURE__ */ (0, import_jsx_runtime137.jsx)("div", { className: "dataviews-view-picker-activity__item-description", children: renderedDescriptionField }), 33825 /* @__PURE__ */ (0, import_jsx_runtime137.jsx)("div", { className: "dataviews-view-picker-activity__item-fields", children: otherFields.map((field) => /* @__PURE__ */ (0, import_jsx_runtime137.jsxs)( 33826 "div", 33827 { 33828 className: "dataviews-view-picker-activity__item-field", 33829 children: [ 33830 /* @__PURE__ */ (0, import_jsx_runtime137.jsx)( 33831 VisuallyHidden, 33832 { 33833 render: /* @__PURE__ */ (0, import_jsx_runtime137.jsx)("span", {}), 33834 className: "dataviews-view-picker-activity__item-field-label", 33835 children: field.label 33836 } 33837 ), 33838 /* @__PURE__ */ (0, import_jsx_runtime137.jsx)("span", { className: "dataviews-view-picker-activity__item-field-value", children: /* @__PURE__ */ (0, import_jsx_runtime137.jsx)( 33839 field.render, 33840 { 33841 item, 33842 field 33843 } 33844 ) }) 33845 ] 33846 }, 33847 field.id 33848 )) }) 33849 ] 33850 } 33851 ) 33852 ] }) 33853 } 33854 ); 33855 } 33856 function PickerActivityGroup({ 33857 groupName, 33858 groupField, 33859 showLabel = true, 33860 children 33861 }) { 33862 const headerId = (0, import_compose11.useInstanceId)( 33863 PickerActivityGroup, 33864 "dataviews-view-picker-activity-group__header" 33865 ); 33866 return /* @__PURE__ */ (0, import_jsx_runtime137.jsxs)( 33867 Stack, 33868 { 33869 direction: "column", 33870 role: "group", 33871 "aria-labelledby": headerId, 33872 className: "dataviews-view-picker-activity-group", 33873 children: [ 33874 /* @__PURE__ */ (0, import_jsx_runtime137.jsx)( 33875 "h3", 33876 { 33877 className: "dataviews-view-picker-activity-group__header", 33878 id: headerId, 33879 children: showLabel ? (0, import_i18n34.sprintf)( 33880 // translators: 1: The label of the field e.g. "Date". 2: The value of the field, e.g.: "May 2022". 33881 (0, import_i18n34.__)("%1$s: %2$s"), 33882 groupField.label, 33883 groupName 33884 ) : groupName 33885 } 33886 ), 33887 children 33888 ] 33889 } 33890 ); 33891 } 33892 function ViewPickerActivity({ 33893 data, 33894 fields, 33895 getItemId, 33896 isLoading, 33897 onChangeSelection, 33898 selection, 33899 view, 33900 actions, 33901 className, 33902 empty 33903 }) { 33904 const { itemListLabel, paginationInfo } = (0, import_element94.useContext)(dataviews_context_default); 33905 const isMultiselect = useIsMultiselectPicker(actions); 33906 const titleField = fields.find( 33907 (field) => field.id === view?.titleField 33908 ); 33909 const mediaField = fields.find( 33910 (field) => field.id === view?.mediaField 33911 ); 33912 const descriptionField2 = fields.find( 33913 (field) => field.id === view?.descriptionField 33914 ); 33915 const otherFields = (view?.fields ?? []).map((fieldId) => fields.find((f) => fieldId === f.id)).filter(isDefined4); 33916 const groupField = view.groupBy?.field ? fields.find((f) => f.id === view.groupBy?.field) : null; 33917 const dataByGroup = groupField ? getDataByGroup(data, groupField) : null; 33918 const isInfiniteScroll = (view.infiniteScrollEnabled && !dataByGroup) ?? false; 33919 const setsize = isInfiniteScroll ? paginationInfo?.totalItems : void 0; 33920 const hasData = !!data?.length; 33921 const isGrouped = !!(groupField && dataByGroup); 33922 const orderedData = dataByGroup ? Array.from(dataByGroup.values()).flat() : data; 33923 const { getSelectionProps } = useSelectionProps({ 33924 data: orderedData, 33925 getItemId, 33926 isItemSelectable: () => true, 33927 selection, 33928 onChangeSelection, 33929 selectionMode: isMultiselect ? "multi" : "single-clearable", 33930 shouldSelectOnClick: true 33931 }); 33932 const renderItem = (item) => /* @__PURE__ */ (0, import_jsx_runtime137.jsx)( 33933 PickerActivityItem, 33934 { 33935 view, 33936 selection, 33937 selectionProps: getSelectionProps(getItemId(item)), 33938 getItemId, 33939 item, 33940 titleField, 33941 mediaField, 33942 descriptionField: descriptionField2, 33943 otherFields, 33944 posinset: item.position, 33945 setsize 33946 }, 33947 getItemId(item) 33948 ); 33949 if (!hasData) { 33950 return /* @__PURE__ */ (0, import_jsx_runtime137.jsx)( 33951 "div", 33952 { 33953 className: clsx_default({ 33954 "dataviews-loading": isLoading, 33955 "dataviews-no-results": !isLoading 33956 }), 33957 children: isLoading ? /* @__PURE__ */ (0, import_jsx_runtime137.jsx)("p", { children: /* @__PURE__ */ (0, import_jsx_runtime137.jsx)(import_components17.Spinner, {}) }) : empty 33958 } 33959 ); 33960 } 33961 return /* @__PURE__ */ (0, import_jsx_runtime137.jsxs)(import_jsx_runtime137.Fragment, { children: [ 33962 /* @__PURE__ */ (0, import_jsx_runtime137.jsx)( 33963 import_components17.Composite, 33964 { 33965 virtualFocus: true, 33966 orientation: "vertical", 33967 role: "listbox", 33968 "aria-multiselectable": isMultiselect, 33969 "aria-label": itemListLabel, 33970 "aria-busy": isLoading, 33971 render: isGrouped ? /* @__PURE__ */ (0, import_jsx_runtime137.jsx)(Stack, { direction: "column", gap: "sm" }) : void 0, 33972 className: clsx_default( 33973 "dataviews-view-picker-activity", 33974 className 33975 ), 33976 children: isGrouped && dataByGroup ? Array.from(dataByGroup.entries()).map( 33977 ([groupName, groupItems]) => /* @__PURE__ */ (0, import_jsx_runtime137.jsx)( 33978 PickerActivityGroup, 33979 { 33980 groupName, 33981 groupField, 33982 showLabel: view.groupBy?.showLabel !== false, 33983 children: groupItems.map(renderItem) 33984 }, 33985 groupName 33986 ) 33987 ) : data.map(renderItem) 33988 } 33989 ), 33990 isLoading && /* @__PURE__ */ (0, import_jsx_runtime137.jsx)("p", { className: "dataviews-loading-more", children: /* @__PURE__ */ (0, import_jsx_runtime137.jsx)(import_components17.Spinner, {}) }) 33991 ] }); 33992 } 33993 33994 // packages/dataviews/build-module/components/dataviews-layouts/utils/density-picker.mjs 33995 var import_components18 = __toESM(require_components(), 1); 33996 var import_i18n35 = __toESM(require_i18n(), 1); 33997 var import_element95 = __toESM(require_element(), 1); 33998 var import_jsx_runtime138 = __toESM(require_jsx_runtime(), 1); 33999 function DensityPicker() { 34000 const context = (0, import_element95.useContext)(dataviews_context_default); 34001 const view = context.view; 34002 return /* @__PURE__ */ (0, import_jsx_runtime138.jsxs)( 34003 import_components18.__experimentalToggleGroupControl, 34004 { 34005 label: (0, import_i18n35.__)("Density"), 34006 value: view.layout?.density || "balanced", 34007 onChange: (value) => { 34008 context.onChangeView({ 34009 ...view, 34010 layout: { 34011 ...view.layout, 34012 density: value 34013 } 34014 }); 34015 }, 34016 isBlock: true, 34017 children: [ 34018 /* @__PURE__ */ (0, import_jsx_runtime138.jsx)( 34019 import_components18.__experimentalToggleGroupControlOption, 34020 { 34021 value: "comfortable", 34022 label: (0, import_i18n35._x)( 34023 "Comfortable", 34024 "Density option for DataView layout" 34025 ) 34026 }, 34027 "comfortable" 34028 ), 34029 /* @__PURE__ */ (0, import_jsx_runtime138.jsx)( 34030 import_components18.__experimentalToggleGroupControlOption, 34031 { 34032 value: "balanced", 34033 label: (0, import_i18n35._x)("Balanced", "Density option for DataView layout") 34034 }, 34035 "balanced" 34036 ), 34037 /* @__PURE__ */ (0, import_jsx_runtime138.jsx)( 34038 import_components18.__experimentalToggleGroupControlOption, 34039 { 34040 value: "compact", 34041 label: (0, import_i18n35._x)("Compact", "Density option for DataView layout") 34042 }, 34043 "compact" 34044 ) 34045 ] 34046 } 34047 ); 34048 } 34049 34050 // packages/dataviews/build-module/components/dataviews-layouts/utils/media-fit-control.mjs 34051 var import_components19 = __toESM(require_components(), 1); 34052 var import_i18n36 = __toESM(require_i18n(), 1); 34053 var import_element96 = __toESM(require_element(), 1); 34054 var import_jsx_runtime139 = __toESM(require_jsx_runtime(), 1); 34055 function MediaFitControl() { 34056 const context = (0, import_element96.useContext)(dataviews_context_default); 34057 const view = context.view; 34058 if (!context.config?.mediaFitControl) { 34059 return null; 34060 } 34061 const hasMediaField = view.showMedia !== false && context.fields.some((field) => field.id === view.mediaField); 34062 if (!hasMediaField) { 34063 return null; 34064 } 34065 return /* @__PURE__ */ (0, import_jsx_runtime139.jsx)( 34066 import_components19.ToggleControl, 34067 { 34068 label: (0, import_i18n36.__)("Original aspect ratio"), 34069 checked: view.layout?.mediaFit === "contain", 34070 onChange: (isChecked) => { 34071 context.onChangeView({ 34072 ...view, 34073 layout: { 34074 ...view.layout, 34075 mediaFit: isChecked ? "contain" : "cover" 34076 } 34077 }); 34078 } 34079 } 34080 ); 34081 } 34082 34083 // packages/dataviews/build-module/components/dataviews-layouts/utils/preview-size-picker.mjs 34084 var import_components20 = __toESM(require_components(), 1); 34085 var import_i18n37 = __toESM(require_i18n(), 1); 34086 var import_element97 = __toESM(require_element(), 1); 34087 var import_jsx_runtime140 = __toESM(require_jsx_runtime(), 1); 34088 var imageSizes2 = [ 34089 { 34090 value: 120, 34091 breakpoint: 1 34092 }, 34093 { 34094 value: 170, 34095 breakpoint: 1 34096 }, 34097 { 34098 value: 230, 34099 breakpoint: 1 34100 }, 34101 { 34102 value: 290, 34103 breakpoint: 1112 34104 // at minimum image width, 4 images display at this container size 34105 }, 34106 { 34107 value: 350, 34108 breakpoint: 1636 34109 // at minimum image width, 6 images display at this container size 34110 }, 34111 { 34112 value: 430, 34113 breakpoint: 588 34114 // at minimum image width, 2 images display at this container size 34115 } 34116 ]; 34117 function PreviewSizePicker() { 34118 const context = (0, import_element97.useContext)(dataviews_context_default); 34119 const view = context.view; 34120 const breakValues = imageSizes2.filter((size4) => { 34121 return context.containerWidth >= size4.breakpoint; 34122 }); 34123 const layoutPreviewSize = view.layout?.previewSize ?? 230; 34124 const previewSizeToUse = breakValues.map((size4, index2) => ({ ...size4, index: index2 })).filter((size4) => size4.value <= layoutPreviewSize).sort((a, b) => b.value - a.value)[0]?.index ?? 0; 34125 const marks = breakValues.map((size4, index2) => { 34126 return { 34127 value: index2 34128 }; 34129 }); 34130 return /* @__PURE__ */ (0, import_jsx_runtime140.jsx)( 34131 import_components20.RangeControl, 34132 { 34133 showTooltip: false, 34134 label: (0, import_i18n37.__)("Preview size"), 34135 value: previewSizeToUse, 34136 min: 0, 34137 max: breakValues.length - 1, 34138 withInputField: false, 34139 onChange: (value = 0) => { 34140 context.onChangeView({ 34141 ...view, 34142 layout: { 34143 ...view.layout, 34144 previewSize: breakValues[value].value 34145 } 34146 }); 34147 }, 34148 step: 1, 34149 marks 34150 } 34151 ); 34152 } 34153 34154 // packages/dataviews/build-module/components/dataviews-layouts/utils/grid-config-options.mjs 34155 var import_jsx_runtime141 = __toESM(require_jsx_runtime(), 1); 34156 function GridConfigOptions() { 34157 return /* @__PURE__ */ (0, import_jsx_runtime141.jsxs)(import_jsx_runtime141.Fragment, { children: [ 34158 /* @__PURE__ */ (0, import_jsx_runtime141.jsx)(DensityPicker, {}), 34159 /* @__PURE__ */ (0, import_jsx_runtime141.jsx)(MediaFitControl, {}), 34160 /* @__PURE__ */ (0, import_jsx_runtime141.jsx)(PreviewSizePicker, {}) 34161 ] }); 34162 } 34163 34164 // packages/dataviews/build-module/components/dataviews-layouts/index.mjs 34165 var VIEW_LAYOUTS = [ 34166 { 34167 type: LAYOUT_TABLE, 34168 label: (0, import_i18n38.__)("Table"), 34169 component: table_default, 34170 icon: block_table_default, 34171 viewConfigOptions: DensityPicker 34172 }, 34173 { 34174 type: LAYOUT_GRID, 34175 label: (0, import_i18n38.__)("Grid"), 34176 component: grid_default, 34177 icon: category_default, 34178 viewConfigOptions: GridConfigOptions 34179 }, 34180 { 34181 type: LAYOUT_LIST, 34182 label: (0, import_i18n38.__)("List"), 34183 component: ViewList, 34184 icon: (0, import_i18n38.isRTL)() ? format_list_bullets_rtl_default : format_list_bullets_default, 34185 viewConfigOptions: DensityPicker 34186 }, 34187 { 34188 type: LAYOUT_ACTIVITY, 34189 label: (0, import_i18n38.__)("Activity"), 34190 component: ViewActivity, 34191 icon: scheduled_default, 34192 viewConfigOptions: DensityPicker 34193 }, 34194 { 34195 type: LAYOUT_PICKER_GRID, 34196 label: (0, import_i18n38.__)("Grid"), 34197 component: picker_grid_default, 34198 icon: category_default, 34199 viewConfigOptions: GridConfigOptions, 34200 isPicker: true 34201 }, 34202 { 34203 type: LAYOUT_PICKER_TABLE, 34204 label: (0, import_i18n38.__)("Table"), 34205 component: picker_table_default, 34206 icon: block_table_default, 34207 viewConfigOptions: DensityPicker, 34208 isPicker: true 34209 }, 34210 { 34211 type: LAYOUT_PICKER_ACTIVITY, 34212 label: (0, import_i18n38.__)("Activity"), 34213 component: ViewPickerActivity, 34214 icon: scheduled_default, 34215 viewConfigOptions: DensityPicker, 34216 isPicker: true 34217 } 34218 ]; 34219 34220 // packages/dataviews/build-module/components/dataviews-filters/filters.mjs 34221 var import_element105 = __toESM(require_element(), 1); 34222 34223 // packages/dataviews/build-module/components/dataviews-filters/filter.mjs 34224 var import_components23 = __toESM(require_components(), 1); 34225 var import_i18n41 = __toESM(require_i18n(), 1); 34226 var import_element102 = __toESM(require_element(), 1); 34227 34228 // node_modules/@ariakit/react-components/dist/button/utils.js 34229 function withDefaultButtonType(props) { 34230 const { render: render4, type } = props; 34231 if (render4 || type !== void 0) return props; 34232 return { 34233 ...props, 34234 type: "button" 34235 }; 34236 } 34237 34238 // node_modules/@ariakit/react-components/dist/focusable/focusable-context.js 34239 var import_react46 = __toESM(require_react(), 1); 34240 var FocusableContext = (0, import_react46.createContext)(true); 34241 34242 // node_modules/@ariakit/utils/dist/index.js 34243 function toArray(arg) { 34244 if (Array.isArray(arg)) return arg; 34245 return typeof arg !== "undefined" ? [arg] : []; 34246 } 34247 function flatten2DArray(array) { 34248 const flattened = []; 34249 for (const row of array) flattened.push(...row); 34250 return flattened; 34251 } 34252 function reverseArray(array) { 34253 return array.slice().reverse(); 34254 } 34255 function noop5(..._) { 34256 } 34257 function applyState(argument, currentValue) { 34258 if (isUpdater(argument)) return argument(isLazyValue(currentValue) ? currentValue() : currentValue); 34259 return argument; 34260 } 34261 function isUpdater(argument) { 34262 return typeof argument === "function"; 34263 } 34264 function isLazyValue(value) { 34265 return typeof value === "function"; 34266 } 34267 function hasOwnProperty(object, prop) { 34268 if (typeof Object.hasOwn === "function") return Object.hasOwn(object, prop); 34269 return Object.prototype.hasOwnProperty.call(object, prop); 34270 } 34271 function chain(...fns) { 34272 return (...args) => { 34273 for (const fn of fns) if (typeof fn === "function") fn(...args); 34274 }; 34275 } 34276 function normalizeString(str) { 34277 return str.normalize("NFD").replace(/[\u0300-\u036f]/g, ""); 34278 } 34279 function omit(object, keys) { 34280 const result = { ...object }; 34281 for (const key of keys) if (hasOwnProperty(result, key)) delete result[key]; 34282 return result; 34283 } 34284 function pick(object, paths) { 34285 const result = {}; 34286 for (const key of paths) if (hasOwnProperty(object, key)) result[key] = object[key]; 34287 return result; 34288 } 34289 function identity(value) { 34290 return value; 34291 } 34292 function afterPaint(cb = noop5) { 34293 let raf = requestAnimationFrame(() => { 34294 raf = requestAnimationFrame(cb); 34295 }); 34296 return () => cancelAnimationFrame(raf); 34297 } 34298 var defaultWarnOnceKey = {}; 34299 var warningMessages = /* @__PURE__ */ new WeakMap(); 34300 function warnOnce(message2, key) { 34301 const warningKey = key || defaultWarnOnceKey; 34302 let messages = warningMessages.get(warningKey); 34303 if (!messages) { 34304 messages = /* @__PURE__ */ new Set(); 34305 warningMessages.set(warningKey, messages); 34306 } 34307 if (messages.has(message2)) return; 34308 messages.add(message2); 34309 console.warn(message2); 34310 } 34311 function invariant(condition, message2) { 34312 if (condition) return; 34313 if (typeof message2 !== "string") throw new Error("Invariant failed"); 34314 throw new Error(message2); 34315 } 34316 function getKeys(obj) { 34317 return Object.keys(obj); 34318 } 34319 function isFalsyBooleanCallback(booleanOrCallback, ...args) { 34320 const result = typeof booleanOrCallback === "function" ? booleanOrCallback(...args) : booleanOrCallback; 34321 if (result == null) return false; 34322 return !result; 34323 } 34324 function disabledFromProps(props) { 34325 return props.disabled || props["aria-disabled"] === true || props["aria-disabled"] === "true"; 34326 } 34327 function removeUndefinedValues(obj) { 34328 const result = {}; 34329 for (const key in obj) { 34330 if (!hasOwnProperty(obj, key)) continue; 34331 if (key === "__proto__") continue; 34332 if (obj[key] !== void 0) result[key] = obj[key]; 34333 } 34334 return result; 34335 } 34336 function defaultValue(...values) { 34337 for (const value of values) if (value !== void 0) return value; 34338 } 34339 var canUseDOM = checkIsBrowser(); 34340 function checkIsBrowser() { 34341 return typeof window !== "undefined" && !!window.document?.createElement; 34342 } 34343 function lookupGetter(prototype, name) { 34344 let target = prototype; 34345 while (target) { 34346 const descriptor = Object.getOwnPropertyDescriptor(target, name); 34347 if (descriptor?.get) return descriptor.get; 34348 target = Object.getPrototypeOf(target); 34349 } 34350 } 34351 var nodeTypeGetter = canUseDOM ? lookupGetter(Object.getPrototypeOf(window.document), "nodeType") : void 0; 34352 var activeElementGetter = canUseDOM ? lookupGetter(Object.getPrototypeOf(window.document), "activeElement") : void 0; 34353 function isWindow(value) { 34354 if (!value) return false; 34355 return value.window === value; 34356 } 34357 function isDocument(value) { 34358 if (!value) return false; 34359 if (!nodeTypeGetter) return value.nodeType === 9; 34360 try { 34361 return nodeTypeGetter.call(value) === 9; 34362 } catch { 34363 return false; 34364 } 34365 } 34366 function ownsDocument(view, ownerDocument2) { 34367 try { 34368 return view.document === ownerDocument2; 34369 } catch { 34370 return false; 34371 } 34372 } 34373 function getDocument(node) { 34374 if (!node) return document; 34375 if (isDocument(node)) return node; 34376 if (isWindow(node)) return node.document; 34377 const nodeDocument = node.ownerDocument; 34378 if (isDocument(nodeDocument)) return nodeDocument; 34379 return document; 34380 } 34381 function getWindow2(node) { 34382 if (!node) return self; 34383 if (isWindow(node)) return node; 34384 const nodeDocument = getDocument(node); 34385 const { defaultView: defaultView2 } = nodeDocument; 34386 if (isWindow(defaultView2) && ownsDocument(defaultView2, nodeDocument)) return defaultView2; 34387 return window; 34388 } 34389 function getActiveElement(node, { frame = true, activeDescendant = false } = {}) { 34390 const ownerDocument2 = getDocument(node); 34391 const activeElement2 = activeElementGetter ? activeElementGetter.call(ownerDocument2) : ownerDocument2.activeElement; 34392 if (!activeElement2?.nodeName) return null; 34393 if (frame && isFrame(activeElement2) && activeElement2.contentDocument?.body) return getActiveElement(activeElement2.contentDocument.body, { 34394 frame, 34395 activeDescendant 34396 }); 34397 if (activeDescendant) { 34398 const id = activeElement2.getAttribute("aria-activedescendant"); 34399 if (id) { 34400 const element = getDocument(activeElement2).getElementById(id); 34401 if (element) return element; 34402 } 34403 } 34404 return activeElement2; 34405 } 34406 function contains2(parent, child) { 34407 return parent === child || parent.contains(child); 34408 } 34409 function isElement2(target) { 34410 return target?.nodeType === 1; 34411 } 34412 function isNode2(target) { 34413 return typeof target?.nodeType === "number"; 34414 } 34415 function isFrame(element) { 34416 return element.tagName === "IFRAME"; 34417 } 34418 function isButton(element) { 34419 const tagName = element.tagName.toLowerCase(); 34420 if (tagName === "button") return true; 34421 if (tagName === "input" && element.type) return buttonInputTypes.indexOf(element.type) !== -1; 34422 return false; 34423 } 34424 var buttonInputTypes = [ 34425 "button", 34426 "color", 34427 "file", 34428 "image", 34429 "reset", 34430 "submit" 34431 ]; 34432 function isVisible(element) { 34433 if (typeof element.checkVisibility === "function") return element.checkVisibility(); 34434 const htmlElement = element; 34435 return htmlElement.offsetWidth > 0 || htmlElement.offsetHeight > 0 || element.getClientRects().length > 0; 34436 } 34437 function isTextField(element) { 34438 try { 34439 if (element.tagName === "TEXTAREA") return true; 34440 if (element.tagName !== "INPUT") return false; 34441 return element.selectionStart !== null; 34442 } catch (_error) { 34443 return false; 34444 } 34445 } 34446 function isTextbox(element) { 34447 return element.isContentEditable || isTextField(element); 34448 } 34449 function getTextboxValue(element) { 34450 if (isTextField(element)) return element.value; 34451 if (element.isContentEditable) { 34452 const range = getDocument(element).createRange(); 34453 range.selectNodeContents(element); 34454 return range.toString(); 34455 } 34456 return ""; 34457 } 34458 function getTextboxSelection(element) { 34459 let start = 0; 34460 let end = 0; 34461 if (isTextField(element)) { 34462 start = element.selectionStart || 0; 34463 end = element.selectionEnd || 0; 34464 } else if (element.isContentEditable) { 34465 const selection = getDocument(element).getSelection(); 34466 if (selection?.rangeCount && selection.anchorNode && contains2(element, selection.anchorNode) && selection.focusNode && contains2(element, selection.focusNode)) { 34467 const range = selection.getRangeAt(0); 34468 const nextRange = range.cloneRange(); 34469 nextRange.selectNodeContents(element); 34470 nextRange.setEnd(range.startContainer, range.startOffset); 34471 start = nextRange.toString().length; 34472 nextRange.setEnd(range.endContainer, range.endOffset); 34473 end = nextRange.toString().length; 34474 } 34475 } 34476 return { 34477 start, 34478 end 34479 }; 34480 } 34481 var allowedPopupRoles = [ 34482 "dialog", 34483 "menu", 34484 "listbox", 34485 "tree", 34486 "grid" 34487 ]; 34488 var itemRoleByPopupRole = { 34489 menu: "menuitem", 34490 listbox: "option", 34491 tree: "treeitem" 34492 }; 34493 function getPopupRole(element, fallback) { 34494 const role = element?.getAttribute("role"); 34495 if (role && allowedPopupRoles.indexOf(role) !== -1) return role; 34496 return fallback; 34497 } 34498 function getItemRoleByPopupRole(popupRole) { 34499 if (popupRole == null) return; 34500 if (!hasOwnProperty(itemRoleByPopupRole, popupRole)) return; 34501 return itemRoleByPopupRole[popupRole]; 34502 } 34503 function getScrollingElement(element) { 34504 if (!element) return null; 34505 const isScrollableOverflow = (overflow) => { 34506 if (overflow === "auto") return true; 34507 if (overflow === "scroll") return true; 34508 return false; 34509 }; 34510 if (element.clientHeight && element.scrollHeight > element.clientHeight) { 34511 const { overflowY } = getComputedStyle(element); 34512 if (isScrollableOverflow(overflowY)) return element; 34513 } else if (element.clientWidth && element.scrollWidth > element.clientWidth) { 34514 const { overflowX } = getComputedStyle(element); 34515 if (isScrollableOverflow(overflowX)) return element; 34516 } 34517 const doc = getDocument(element); 34518 return getScrollingElement(element.parentElement) || doc.scrollingElement || doc.body; 34519 } 34520 function setSelectionRange(element, ...args) { 34521 if (/text|search|password|tel|url/i.test(element.type)) element.setSelectionRange(...args); 34522 } 34523 function sortBasedOnDOMPosition(items, getElement) { 34524 const pairs = items.map((item, index2) => [index2, item]); 34525 let isOrderDifferent = false; 34526 pairs.sort(([indexA, a], [indexB, b]) => { 34527 const elementA = getElement(a); 34528 const elementB = getElement(b); 34529 if (elementA === elementB) return 0; 34530 if (!elementA || !elementB) return 0; 34531 if (isElementPreceding(elementA, elementB)) { 34532 if (indexA > indexB) isOrderDifferent = true; 34533 return -1; 34534 } 34535 if (indexA < indexB) isOrderDifferent = true; 34536 return 1; 34537 }); 34538 if (isOrderDifferent) return pairs.map(([_, item]) => item); 34539 return items; 34540 } 34541 function isElementPreceding(a, b) { 34542 return Boolean(b.compareDocumentPosition(a) & Node.DOCUMENT_POSITION_PRECEDING); 34543 } 34544 function isTouchDevice() { 34545 return canUseDOM && !!navigator.maxTouchPoints; 34546 } 34547 function isApple() { 34548 if (!canUseDOM) return false; 34549 return /mac|iphone|ipad|ipod/i.test(navigator.platform); 34550 } 34551 function isSafari() { 34552 return canUseDOM && isApple() && /apple/i.test(navigator.vendor); 34553 } 34554 function isFirefox() { 34555 return canUseDOM && /firefox\//i.test(navigator.userAgent); 34556 } 34557 function isPortalEvent(event) { 34558 const { currentTarget, target } = event; 34559 if (!currentTarget) return false; 34560 if (!isNode2(target)) return true; 34561 return !contains2(currentTarget, target); 34562 } 34563 function isSelfTarget(event) { 34564 return event.target === event.currentTarget; 34565 } 34566 function isActivatableNavigationTarget(element) { 34567 if (!isElement2(element)) return false; 34568 const target = element; 34569 const tagName = target.tagName.toLowerCase(); 34570 if (tagName === "a") return true; 34571 if (tagName === "button" && target.type === "submit") return true; 34572 if (tagName === "input" && target.type === "submit") return true; 34573 return false; 34574 } 34575 function isOpeningInNewTab(event) { 34576 const isAppleDevice = isApple(); 34577 if (isAppleDevice && !event.metaKey) return false; 34578 if (!isAppleDevice && !event.ctrlKey) return false; 34579 return isActivatableNavigationTarget(event.currentTarget); 34580 } 34581 function isDownloading(event) { 34582 if (!event.altKey) return false; 34583 return isActivatableNavigationTarget(event.currentTarget); 34584 } 34585 function fireBlurEvent(element, eventInit) { 34586 const { FocusEvent } = getWindow2(element); 34587 const event = new FocusEvent("blur", eventInit); 34588 const defaultAllowed = element.dispatchEvent(event); 34589 const bubbleInit = { 34590 ...eventInit, 34591 bubbles: true 34592 }; 34593 element.dispatchEvent(new FocusEvent("focusout", bubbleInit)); 34594 return defaultAllowed; 34595 } 34596 function fireKeyboardEvent(element, type, eventInit) { 34597 const { KeyboardEvent } = getWindow2(element); 34598 const event = new KeyboardEvent(type, eventInit); 34599 return element.dispatchEvent(event); 34600 } 34601 var resetAttributes = { 34602 width: true, 34603 height: true, 34604 pressure: true, 34605 tangentialPressure: true, 34606 tiltX: true, 34607 tiltY: true, 34608 twist: true, 34609 altitudeAngle: true, 34610 azimuthAngle: true, 34611 isPrimary: true, 34612 coalescedEvents: true, 34613 predictedEvents: true, 34614 persistentDeviceId: true 34615 }; 34616 function getClickEventInit(view, eventInit) { 34617 const init2 = eventInit ?? {}; 34618 return new Proxy({}, { get(_target, key) { 34619 if (key === "view") return view; 34620 if (key === "composed") return true; 34621 if (key === "pointerId") return init2.pointerId ?? -1; 34622 if (key === "pointerType") return init2.pointerType ?? ""; 34623 if (hasOwnProperty(resetAttributes, key)) return void 0; 34624 return Reflect.get(init2, key); 34625 } }); 34626 } 34627 function fireClickEvent(element, eventInit) { 34628 const view = getWindow2(element); 34629 const event = new (view.PointerEvent ?? view.MouseEvent)("click", getClickEventInit(view, eventInit)); 34630 return element.dispatchEvent(event); 34631 } 34632 function isFocusEventOutside(event, container) { 34633 const containerElement = container || event.currentTarget; 34634 const relatedTarget = event.relatedTarget; 34635 return !isNode2(relatedTarget) || !contains2(containerElement, relatedTarget); 34636 } 34637 function isInputEvent(event) { 34638 return event.type === "input"; 34639 } 34640 function queueBeforeEvent(element, type, callback, timeout) { 34641 const createTimer = (callback2) => { 34642 if (timeout) { 34643 const timerId2 = setTimeout(callback2, timeout); 34644 return () => clearTimeout(timerId2); 34645 } 34646 const timerId = requestAnimationFrame(callback2); 34647 return () => cancelAnimationFrame(timerId); 34648 }; 34649 const cancelTimer = createTimer(() => { 34650 element.removeEventListener(type, callSync, true); 34651 callback(); 34652 }); 34653 const callSync = () => { 34654 cancelTimer(); 34655 callback(); 34656 }; 34657 element.addEventListener(type, callSync, { 34658 once: true, 34659 capture: true 34660 }); 34661 return () => { 34662 cancelTimer(); 34663 element.removeEventListener(type, callSync, true); 34664 }; 34665 } 34666 function addGlobalEventListener(type, listener, options, scope = window) { 34667 const children = []; 34668 try { 34669 scope.document.addEventListener(type, listener, options); 34670 for (const frame of Array.from(scope.frames)) children.push(addGlobalEventListener(type, listener, options, frame)); 34671 } catch { 34672 } 34673 const removeEventListener = () => { 34674 try { 34675 scope.document.removeEventListener(type, listener, options); 34676 } catch { 34677 } 34678 for (const remove of children) remove(); 34679 }; 34680 return removeEventListener; 34681 } 34682 var selector = "input:not([type='hidden']):not([disabled]), select:not([disabled]), textarea:not([disabled]), a[href], button:not([disabled]), [tabindex], summary, iframe, object, embed, area[href], audio[controls], video[controls], [contenteditable]:not([contenteditable='false'])"; 34683 function isFocusable(element) { 34684 if (!element.matches(selector)) return false; 34685 if (!isVisible(element)) return false; 34686 if (element.closest("[inert]")) return false; 34687 return true; 34688 } 34689 function hasFocus(element) { 34690 const activeElement2 = getActiveElement(element); 34691 if (!activeElement2) return false; 34692 if (activeElement2 === element) return true; 34693 const activeDescendant = activeElement2.getAttribute("aria-activedescendant"); 34694 if (!activeDescendant) return false; 34695 return activeDescendant === element.id; 34696 } 34697 function hasFocusWithin(element) { 34698 const activeElement2 = getActiveElement(element); 34699 if (!activeElement2) return false; 34700 if (contains2(element, activeElement2)) return true; 34701 const activeDescendant = activeElement2.getAttribute("aria-activedescendant"); 34702 if (!activeDescendant) return false; 34703 if (!("id" in element)) return false; 34704 if (activeDescendant === element.id) return true; 34705 return !!element.querySelector(`#$CSS.escape(activeDescendant)}`); 34706 } 34707 function createUndoCallback(callback) { 34708 return async () => { 34709 const redo = await callback?.(); 34710 return createUndoCallback(async () => { 34711 await redo?.(); 34712 return callback; 34713 }); 34714 }; 34715 } 34716 var UndoManager = createUndoManager(); 34717 function createUndoManager({ limit = 100 } = {}) { 34718 const undoStack = []; 34719 let redoStack = []; 34720 let currentGroup = null; 34721 const canUndo = () => undoStack.length > 0; 34722 const canRedo = () => redoStack.length > 0; 34723 const undo = async () => { 34724 if (!canUndo()) return; 34725 currentGroup = null; 34726 redoStack.push(await undoStack.pop()?.()); 34727 }; 34728 const redo = async () => { 34729 if (!canRedo()) return; 34730 currentGroup = null; 34731 undoStack.push(await redoStack.pop()?.()); 34732 }; 34733 const execute = async (callback, group) => { 34734 if (!callback) return; 34735 const sameGroup = group === currentGroup; 34736 currentGroup = group ?? null; 34737 const nextIndex = sameGroup ? Math.max(0, undoStack.length - 1) : undoStack.length; 34738 const undoCallback = await callback(); 34739 if (!undoCallback) return; 34740 redoStack = []; 34741 const currentUndo = undoStack[nextIndex]; 34742 undoStack[nextIndex] = createUndoCallback(async () => { 34743 await undoCallback?.(); 34744 const currentRedo = await currentUndo?.(); 34745 return async () => { 34746 await currentRedo?.(); 34747 await callback?.(); 34748 }; 34749 }); 34750 while (undoStack.length > limit) undoStack.shift(); 34751 }; 34752 return { 34753 canUndo, 34754 canRedo, 34755 undo, 34756 redo, 34757 execute 34758 }; 34759 } 34760 34761 // node_modules/@ariakit/react-utils/dist/index.js 34762 var React145 = __toESM(require_react(), 1); 34763 var import_react47 = __toESM(require_react(), 1); 34764 var import_jsx_runtime142 = __toESM(require_jsx_runtime(), 1); 34765 function setRef(ref, value) { 34766 if (typeof ref === "function") { 34767 const cleanup = ref(value); 34768 if (typeof cleanup === "function") return cleanup; 34769 } else if (ref) ref.current = value; 34770 } 34771 function isValidElementWithRef(element) { 34772 if (!element) return false; 34773 if (!(0, import_react47.isValidElement)(element)) return false; 34774 if ("ref" in element.props) return true; 34775 if ("ref" in element) return true; 34776 return false; 34777 } 34778 function getRefProperty(element) { 34779 if (!isValidElementWithRef(element)) return null; 34780 return { ...element.props }.ref || element.ref; 34781 } 34782 function mergeProps2(base, overrides) { 34783 const props = { ...base }; 34784 for (const key in overrides) { 34785 if (!hasOwnProperty(overrides, key)) continue; 34786 if (key === "__proto__") continue; 34787 if (key === "className") { 34788 const prop = "className"; 34789 const baseClass = base[prop]; 34790 const overrideClass = overrides[prop]; 34791 if (baseClass && overrideClass) props[prop] = `$baseClass} $overrideClass}`; 34792 else props[prop] = overrideClass || baseClass; 34793 continue; 34794 } 34795 if (key === "style") { 34796 const prop = "style"; 34797 props[prop] = base[prop] ? { 34798 ...base[prop], 34799 ...overrides[prop] 34800 } : overrides[prop]; 34801 continue; 34802 } 34803 const overrideValue = overrides[key]; 34804 if (overrideValue === void 0) continue; 34805 if (key.startsWith("on")) { 34806 if (typeof overrideValue !== "function") continue; 34807 const baseValue = base[key]; 34808 if (typeof baseValue === "function") { 34809 props[key] = (...args) => { 34810 overrideValue(...args); 34811 baseValue(...args); 34812 }; 34813 continue; 34814 } 34815 } 34816 props[key] = overrideValue; 34817 } 34818 return props; 34819 } 34820 var _React = { ...React145 }; 34821 var useReactId = _React.useId; 34822 var useReactDeferredValue = _React.useDeferredValue; 34823 var useEventUpdate = _React.useInsertionEffect ?? ((callback) => callback()); 34824 var useSafeLayoutEffect = canUseDOM ? import_react47.useLayoutEffect : import_react47.useEffect; 34825 function useInitialValue(value) { 34826 const [initialValue] = (0, import_react47.useState)(value); 34827 return initialValue; 34828 } 34829 function useLiveRef(value) { 34830 const ref = (0, import_react47.useRef)(value); 34831 useSafeLayoutEffect(() => { 34832 ref.current = value; 34833 }); 34834 return ref; 34835 } 34836 function useEvent(callback) { 34837 const ref = (0, import_react47.useRef)(() => { 34838 throw new Error("Cannot call an event handler while rendering."); 34839 }); 34840 useEventUpdate(() => { 34841 ref.current = callback; 34842 }); 34843 return (0, import_react47.useCallback)((...args) => ref.current?.(...args), []); 34844 } 34845 function useTransactionState(callback) { 34846 const [state, setState] = (0, import_react47.useState)(null); 34847 useSafeLayoutEffect(() => { 34848 if (state == null) return; 34849 if (!callback) return; 34850 let prevState = null; 34851 callback((prev) => { 34852 prevState = prev; 34853 return state; 34854 }); 34855 return () => { 34856 callback(prevState); 34857 }; 34858 }, [state, callback]); 34859 return [state, setState]; 34860 } 34861 function useMergeRefs5(...refs) { 34862 return (0, import_react47.useMemo)(() => { 34863 if (!refs.some(Boolean)) return; 34864 return (value) => { 34865 const refEffects = []; 34866 for (const ref of refs) { 34867 if (!ref) continue; 34868 const cleanup = setRef(ref, value); 34869 refEffects.push({ 34870 ref, 34871 cleanup: typeof cleanup === "function" ? cleanup : void 0 34872 }); 34873 } 34874 if (!refEffects.some((effect) => effect.cleanup)) return; 34875 return () => { 34876 for (const { ref, cleanup } of refEffects) if (cleanup) cleanup(); 34877 else setRef(ref, null); 34878 }; 34879 }; 34880 }, refs); 34881 } 34882 function useIdPolyfill(defaultId) { 34883 const [id, setId] = (0, import_react47.useState)(defaultId); 34884 useSafeLayoutEffect(() => { 34885 if (defaultId || id) return; 34886 const random = Math.random().toString(36).slice(2, 8); 34887 setId(`id-$random}`); 34888 }, [defaultId, id]); 34889 return defaultId || id; 34890 } 34891 function useReactIdWithDefault(defaultId) { 34892 const id = useReactId(); 34893 return defaultId || id; 34894 } 34895 var useCompatibleId = useReactId ? useReactIdWithDefault : useIdPolyfill; 34896 function useId7(defaultId) { 34897 return useCompatibleId(defaultId); 34898 } 34899 function useAttribute(refOrElement, attributeName, defaultValue2) { 34900 const initialValue = useInitialValue(defaultValue2); 34901 const [attribute, setAttribute] = (0, import_react47.useState)(initialValue); 34902 (0, import_react47.useEffect)(() => { 34903 const element = refOrElement && "current" in refOrElement ? refOrElement.current : refOrElement; 34904 if (!element) return; 34905 const callback = () => { 34906 const value = element.getAttribute(attributeName); 34907 setAttribute(value == null ? initialValue : value); 34908 }; 34909 const observer = new MutationObserver(callback); 34910 observer.observe(element, { attributeFilter: [attributeName] }); 34911 callback(); 34912 return () => observer.disconnect(); 34913 }, [ 34914 refOrElement, 34915 attributeName, 34916 initialValue 34917 ]); 34918 return attribute; 34919 } 34920 function useUpdateEffect(effect, deps) { 34921 const mounted = (0, import_react47.useRef)(false); 34922 (0, import_react47.useEffect)(() => { 34923 if (mounted.current) return effect(); 34924 mounted.current = true; 34925 }, deps); 34926 (0, import_react47.useEffect)(() => () => { 34927 mounted.current = false; 34928 }, []); 34929 } 34930 function useUpdateLayoutEffect(effect, deps) { 34931 const mounted = (0, import_react47.useRef)(false); 34932 useSafeLayoutEffect(() => { 34933 if (mounted.current) return effect(); 34934 mounted.current = true; 34935 }, deps); 34936 useSafeLayoutEffect(() => () => { 34937 mounted.current = false; 34938 }, []); 34939 } 34940 function useForceUpdate() { 34941 return (0, import_react47.useReducer)(() => [], []); 34942 } 34943 function useBooleanEvent(booleanOrCallback) { 34944 return useEvent(typeof booleanOrCallback === "function" ? booleanOrCallback : () => booleanOrCallback); 34945 } 34946 function useWrapElement(props, callback, deps = []) { 34947 const wrapElement = (0, import_react47.useCallback)((element) => { 34948 if (props.wrapElement) element = props.wrapElement(element); 34949 return callback(element); 34950 }, [...deps, props.wrapElement]); 34951 return { 34952 ...props, 34953 wrapElement 34954 }; 34955 } 34956 function useMetadataProps(props, key, value) { 34957 const parent = props.onLoadedMetadataCapture; 34958 const onLoadedMetadataCapture = (0, import_react47.useMemo)(() => { 34959 return Object.assign(() => { 34960 }, parent, ...value !== void 0 ? [{ [key]: value }] : []); 34961 }, [ 34962 parent, 34963 key, 34964 value 34965 ]); 34966 return [parent?.[key], { onLoadedMetadataCapture }]; 34967 } 34968 var hasInstalledGlobalEventListeners = false; 34969 function useIsMouseMoving() { 34970 (0, import_react47.useEffect)(() => { 34971 if (hasInstalledGlobalEventListeners) return; 34972 addGlobalEventListener("mousemove", setMouseMoving, true); 34973 addGlobalEventListener("mousedown", resetMouseMoving, true); 34974 addGlobalEventListener("mouseup", resetMouseMoving, true); 34975 addGlobalEventListener("keydown", resetMouseMoving, true); 34976 addGlobalEventListener("scroll", resetMouseMoving, true); 34977 hasInstalledGlobalEventListeners = true; 34978 }, []); 34979 return useEvent(() => mouseMoving); 34980 } 34981 var mouseMoving = false; 34982 var previousScreenX = 0; 34983 var previousScreenY = 0; 34984 function hasMouseMovement(event) { 34985 const movementX = event.movementX || event.screenX - previousScreenX; 34986 const movementY = event.movementY || event.screenY - previousScreenY; 34987 previousScreenX = event.screenX; 34988 previousScreenY = event.screenY; 34989 return movementX || movementY || false; 34990 } 34991 function setMouseMoving(event) { 34992 if (!hasMouseMovement(event)) return; 34993 mouseMoving = true; 34994 } 34995 function resetMouseMoving() { 34996 mouseMoving = false; 34997 } 34998 function forwardRef89(render4) { 34999 const Role = React145.forwardRef((props, ref) => render4(removeUndefinedValues({ 35000 ...props, 35001 ref 35002 }))); 35003 Role.displayName = render4.displayName || render4.name; 35004 return Role; 35005 } 35006 function memo4(Component2, propsAreEqual) { 35007 return React145.memo(Component2, propsAreEqual); 35008 } 35009 function createElement3(Type, props) { 35010 const { wrapElement, render: render4, ...rest } = props; 35011 const mergedRef = useMergeRefs5(props.ref, getRefProperty(render4)); 35012 let element; 35013 if (React145.isValidElement(render4)) { 35014 const renderProps = { 35015 ...render4.props, 35016 ref: mergedRef 35017 }; 35018 element = React145.cloneElement(render4, mergeProps2(rest, renderProps)); 35019 } else if (render4) element = render4(rest); 35020 else element = /* @__PURE__ */ (0, import_jsx_runtime142.jsx)(Type, { ...rest }); 35021 if (wrapElement) return wrapElement(element); 35022 return element; 35023 } 35024 function createHook(useProps) { 35025 const useRole = (props = {}) => { 35026 return useProps(props); 35027 }; 35028 useRole.displayName = useProps.name; 35029 return useRole; 35030 } 35031 function createStoreContext(providers = [], scopedProviders = []) { 35032 const context = React145.createContext(void 0); 35033 const scopedContext = React145.createContext(void 0); 35034 const useContext60 = () => React145.useContext(context); 35035 const useScopedContext = (onlyScoped = false) => { 35036 const scoped = React145.useContext(scopedContext); 35037 const store = useContext60(); 35038 if (onlyScoped) return scoped; 35039 return scoped || store; 35040 }; 35041 const useProviderContext = () => { 35042 const scoped = React145.useContext(scopedContext); 35043 const store = useContext60(); 35044 if (scoped && scoped === store) return; 35045 return store; 35046 }; 35047 const ContextProvider = (props) => { 35048 return providers.reduceRight((children, Provider2) => /* @__PURE__ */ (0, import_jsx_runtime142.jsx)(Provider2, { 35049 ...props, 35050 children 35051 }), /* @__PURE__ */ (0, import_jsx_runtime142.jsx)(context.Provider, { ...props })); 35052 }; 35053 const ScopedContextProvider = (props) => { 35054 return /* @__PURE__ */ (0, import_jsx_runtime142.jsx)(ContextProvider, { 35055 ...props, 35056 children: scopedProviders.reduceRight((children, Provider2) => /* @__PURE__ */ (0, import_jsx_runtime142.jsx)(Provider2, { 35057 ...props, 35058 children 35059 }), /* @__PURE__ */ (0, import_jsx_runtime142.jsx)(scopedContext.Provider, { ...props })) 35060 }); 35061 }; 35062 return { 35063 context, 35064 scopedContext, 35065 useContext: useContext60, 35066 useScopedContext, 35067 useProviderContext, 35068 ContextProvider, 35069 ScopedContextProvider 35070 }; 35071 } 35072 35073 // node_modules/@ariakit/react-components/dist/__chunks/CcVRFmzE.js 35074 var import_react48 = __toESM(require_react(), 1); 35075 var accessibleWhenDisabledSymbol = /* @__PURE__ */ Symbol("accessibleWhenDisabled"); 35076 function accessibleWhenDisabledFromProps(props) { 35077 return props.accessibleWhenDisabled ?? props.onLoadedMetadataCapture?.[accessibleWhenDisabledSymbol]; 35078 } 35079 var trulyDisabledAttribute = "data-truly-disabled"; 35080 function resolvedTrulyDisabledFromElement(element) { 35081 const value = element.getAttribute(trulyDisabledAttribute); 35082 if (value === "true") return true; 35083 if (value === "false") return false; 35084 } 35085 function isCompositeMoveKey(key) { 35086 return key === "ArrowUp" || key === "ArrowRight" || key === "ArrowDown" || key === "ArrowLeft" || key === "Home" || key === "End" || key === "PageUp" || key === "PageDown"; 35087 } 35088 var TagName = "div"; 35089 var isSafariBrowser = isSafari(); 35090 var nativeTabbableMask = 1; 35091 var supportsDisabledMask = 2; 35092 var defaultElementCapabilities = 3; 35093 var alwaysFocusVisibleInputTypes = [ 35094 "text", 35095 "search", 35096 "url", 35097 "tel", 35098 "email", 35099 "password", 35100 "number", 35101 "date", 35102 "month", 35103 "week", 35104 "time", 35105 "datetime", 35106 "datetime-local" 35107 ]; 35108 function isAlwaysFocusVisible(element) { 35109 const { tagName, readOnly, type } = element; 35110 if (tagName === "TEXTAREA" && !readOnly) return true; 35111 if (tagName === "SELECT" && !readOnly) return true; 35112 if (tagName === "INPUT" && !readOnly) return alwaysFocusVisibleInputTypes.includes(type); 35113 if (element.isContentEditable) return true; 35114 if (element.getAttribute("role") === "combobox" && element.dataset.name) return true; 35115 return false; 35116 } 35117 function isNativeTabbable(tagName) { 35118 if (!tagName) return true; 35119 return tagName === "button" || tagName === "summary" || tagName === "input" || tagName === "select" || tagName === "textarea" || tagName === "a"; 35120 } 35121 function supportsDisabledAttribute(tagName) { 35122 if (!tagName) return true; 35123 return tagName === "button" || tagName === "input" || tagName === "select" || tagName === "textarea"; 35124 } 35125 function getElementCapabilities(tagName) { 35126 let capabilities = 0; 35127 if (isNativeTabbable(tagName)) capabilities |= nativeTabbableMask; 35128 if (supportsDisabledAttribute(tagName)) capabilities |= supportsDisabledMask; 35129 return capabilities; 35130 } 35131 function isNativeSubmitControl(element) { 35132 if (element.tagName === "BUTTON") { 35133 const { type } = element; 35134 return type === "submit"; 35135 } 35136 if (element.tagName === "INPUT") { 35137 const { type } = element; 35138 return type === "submit" || type === "image"; 35139 } 35140 return false; 35141 } 35142 function getTabIndex2({ focusable: focusable2, trulyDisabled, nativeTabbable, supportsDisabled, safariTabIndex, tabIndexProp }) { 35143 if (!focusable2) return tabIndexProp; 35144 if (trulyDisabled) { 35145 if (nativeTabbable && !supportsDisabled) return -1; 35146 return; 35147 } 35148 if (nativeTabbable) { 35149 if (safariTabIndex && tabIndexProp == null) return 0; 35150 return tabIndexProp; 35151 } 35152 return tabIndexProp ?? 0; 35153 } 35154 function useDisableEvent(onEvent, disabled2) { 35155 return useEvent((event) => { 35156 onEvent?.(event); 35157 if (event.defaultPrevented) return; 35158 if (disabled2) { 35159 event.stopPropagation(); 35160 event.preventDefault(); 35161 } 35162 }); 35163 } 35164 var hasInstalledGlobalEventListeners2 = false; 35165 var isKeyboardModality = true; 35166 function onGlobalMouseDown(event) { 35167 const target = event.target; 35168 if (isElement2(target) && !target.hasAttribute("data-focus-visible")) isKeyboardModality = false; 35169 } 35170 function onGlobalKeyDown(event) { 35171 if (isCompositeMoveKey(event.key)) { 35172 isKeyboardModality = true; 35173 return; 35174 } 35175 if (event.metaKey) return; 35176 if (event.ctrlKey) return; 35177 if (event.altKey) { 35178 if (!isSafariBrowser) return; 35179 if (event.key !== "Tab") return; 35180 } 35181 isKeyboardModality = true; 35182 } 35183 var useFocusable = createHook(function useFocusable2({ focusable: focusable2 = true, accessibleWhenDisabled, autoFocus, onFocusVisible, ...props }) { 35184 const ref = (0, import_react48.useRef)(null); 35185 const [parentAccessibleWhenDisabled, metadataProps] = useMetadataProps(props, accessibleWhenDisabledSymbol, accessibleWhenDisabled); 35186 accessibleWhenDisabled ??= parentAccessibleWhenDisabled; 35187 (0, import_react48.useEffect)(() => { 35188 if (!focusable2) return; 35189 if (hasInstalledGlobalEventListeners2) return; 35190 addGlobalEventListener("mousedown", onGlobalMouseDown, true); 35191 addGlobalEventListener("keydown", onGlobalKeyDown, true); 35192 hasInstalledGlobalEventListeners2 = true; 35193 }, [focusable2]); 35194 const disabled2 = focusable2 && disabledFromProps(props); 35195 const trulyDisabled = disabled2 && !accessibleWhenDisabled; 35196 const [focusVisible, setFocusVisible] = (0, import_react48.useState)(false); 35197 const focusVisibleRef = (0, import_react48.useRef)(false); 35198 const nativeSubmitObserverCleanupRef = (0, import_react48.useRef)(null); 35199 const cleanupFocusVisible = useEvent((element) => { 35200 nativeSubmitObserverCleanupRef.current?.(); 35201 nativeSubmitObserverCleanupRef.current = null; 35202 focusVisibleRef.current = false; 35203 element?.removeAttribute("data-focus-visible"); 35204 }); 35205 (0, import_react48.useEffect)(() => { 35206 if (focusable2 && !trulyDisabled) return; 35207 cleanupFocusVisible(ref.current); 35208 if (focusVisible) setFocusVisible(false); 35209 }, [ 35210 focusable2, 35211 trulyDisabled, 35212 focusVisible, 35213 cleanupFocusVisible 35214 ]); 35215 (0, import_react48.useEffect)(() => { 35216 if (!focusable2) return; 35217 if (!focusVisible) return; 35218 const element = ref.current; 35219 if (!element) return; 35220 if (typeof IntersectionObserver === "undefined") return; 35221 const observer = new IntersectionObserver(() => { 35222 if (!isFocusable(element)) { 35223 focusVisibleRef.current = false; 35224 setFocusVisible(false); 35225 } 35226 }); 35227 observer.observe(element); 35228 return () => observer.disconnect(); 35229 }, [focusable2, focusVisible]); 35230 (0, import_react48.useEffect)(() => { 35231 return () => nativeSubmitObserverCleanupRef.current?.(); 35232 }, []); 35233 const onKeyPressCapture = useDisableEvent(props.onKeyPressCapture, disabled2); 35234 const onMouseDownCapture = useDisableEvent(props.onMouseDownCapture, disabled2); 35235 const onClickCapture = useDisableEvent(props.onClickCapture, disabled2); 35236 const onAuxClickCapture = useDisableEvent(props.onAuxClickCapture, disabled2); 35237 const handleFocusVisible = (event, currentTarget) => { 35238 if (currentTarget) event.currentTarget = currentTarget; 35239 if (!focusable2) return; 35240 const element = event.currentTarget; 35241 if (!element) return; 35242 if (!hasFocus(element)) return; 35243 onFocusVisible?.(event); 35244 if (event.defaultPrevented) return; 35245 element.dataset.focusVisible = "true"; 35246 focusVisibleRef.current = true; 35247 if (isNativeSubmitControl(element)) { 35248 nativeSubmitObserverCleanupRef.current?.(); 35249 nativeSubmitObserverCleanupRef.current = null; 35250 if (typeof IntersectionObserver !== "undefined") { 35251 const observer = new IntersectionObserver(() => { 35252 if (isFocusable(element)) return; 35253 cleanupFocusVisible(element); 35254 }); 35255 observer.observe(element); 35256 nativeSubmitObserverCleanupRef.current = () => observer.disconnect(); 35257 } 35258 return; 35259 } 35260 setFocusVisible(true); 35261 }; 35262 const onKeyDownCaptureProp = props.onKeyDownCapture; 35263 const onKeyDownCapture = useEvent((event) => { 35264 onKeyDownCaptureProp?.(event); 35265 if (event.defaultPrevented) return; 35266 if (!focusable2) return; 35267 if (focusVisible) return; 35268 if (focusVisibleRef.current) return; 35269 if ((event.metaKey || event.altKey || event.ctrlKey) && !isCompositeMoveKey(event.key)) return; 35270 if (!isSelfTarget(event)) return; 35271 const element = event.currentTarget; 35272 const applyFocusVisible = () => handleFocusVisible(event, element); 35273 queueBeforeEvent(element, "focusout", applyFocusVisible); 35274 }); 35275 const onFocusCaptureProp = props.onFocusCapture; 35276 const onFocusCapture = useEvent((event) => { 35277 onFocusCaptureProp?.(event); 35278 if (event.defaultPrevented) return; 35279 if (!focusable2) return; 35280 if (!isSelfTarget(event)) { 35281 setFocusVisible(false); 35282 return; 35283 } 35284 const element = event.currentTarget; 35285 const applyFocusVisible = () => handleFocusVisible(event, element); 35286 if (isKeyboardModality || isAlwaysFocusVisible(event.target)) queueBeforeEvent(event.target, "focusout", applyFocusVisible); 35287 else setFocusVisible(false); 35288 }); 35289 const onBlurProp = props.onBlur; 35290 const onBlur = useEvent((event) => { 35291 onBlurProp?.(event); 35292 if (!focusable2) return; 35293 if (!isFocusEventOutside(event)) return; 35294 cleanupFocusVisible(event.currentTarget); 35295 setFocusVisible(false); 35296 }); 35297 const autoFocusOnShow = (0, import_react48.useContext)(FocusableContext); 35298 const autoFocusRef = useEvent((element) => { 35299 if (!focusable2) return; 35300 if (!autoFocus) return; 35301 if (!element) return; 35302 if (!autoFocusOnShow) return; 35303 queueMicrotask(() => { 35304 if (hasFocus(element)) return; 35305 if (!isFocusable(element)) return; 35306 element.focus(); 35307 }); 35308 }); 35309 const [elementCapabilities, setElementCapabilities] = (0, import_react48.useState)(defaultElementCapabilities); 35310 useSafeLayoutEffect(() => { 35311 const element = ref.current; 35312 if (!element) return; 35313 const nextCapabilities = getElementCapabilities(element.tagName.toLowerCase()); 35314 if (nextCapabilities === defaultElementCapabilities) return; 35315 setElementCapabilities(nextCapabilities); 35316 }, []); 35317 const nativeTabbable = focusable2 && !!(elementCapabilities & nativeTabbableMask); 35318 const supportsDisabled = focusable2 && !!(elementCapabilities & supportsDisabledMask); 35319 const [safariTabIndex, setSafariTabIndex] = (0, import_react48.useState)(false); 35320 if (isSafariBrowser) (0, import_react48.useEffect)(() => { 35321 if (!focusable2) return; 35322 const element = ref.current; 35323 if (!element) return; 35324 const { type } = element; 35325 const isNativeCheckboxOrRadio = element.tagName === "INPUT" && (type === "checkbox" || type === "radio"); 35326 setSafariTabIndex(isButton(element) || isNativeCheckboxOrRadio); 35327 }, [focusable2]); 35328 const styleProp = props.style; 35329 const style = (0, import_react48.useMemo)(() => { 35330 if (trulyDisabled) return { 35331 pointerEvents: "none", 35332 ...styleProp 35333 }; 35334 return styleProp; 35335 }, [trulyDisabled, styleProp]); 35336 props = { 35337 "data-focus-visible": focusable2 && focusVisible || void 0, 35338 "data-autofocus": autoFocus || void 0, 35339 "aria-disabled": disabled2 || void 0, 35340 ...props, 35341 ...metadataProps, 35342 ref: useMergeRefs5(ref, autoFocusRef, props.ref), 35343 style, 35344 tabIndex: getTabIndex2({ 35345 focusable: focusable2, 35346 trulyDisabled, 35347 nativeTabbable, 35348 supportsDisabled, 35349 safariTabIndex, 35350 tabIndexProp: props.tabIndex 35351 }), 35352 disabled: supportsDisabled && trulyDisabled ? true : void 0, 35353 [trulyDisabledAttribute]: disabled2 ? trulyDisabled : void 0, 35354 contentEditable: disabled2 ? void 0 : props.contentEditable, 35355 onKeyPressCapture, 35356 onClickCapture, 35357 onAuxClickCapture, 35358 onMouseDownCapture, 35359 onKeyDownCapture, 35360 onFocusCapture, 35361 onBlur 35362 }; 35363 return removeUndefinedValues(props); 35364 }); 35365 var Focusable = forwardRef89(function Focusable2(props) { 35366 const htmlProps = useFocusable(props); 35367 return createElement3(TagName, htmlProps); 35368 }); 35369 35370 // node_modules/@ariakit/react-components/dist/command/command.js 35371 var import_react49 = __toESM(require_react(), 1); 35372 var TagName2 = "button"; 35373 function isNativeClick(event) { 35374 if (!event.isTrusted) return false; 35375 const element = event.currentTarget; 35376 if (event.key === "Enter") return isButton(element) || element.tagName === "SUMMARY" || element.tagName === "A"; 35377 if (event.key === " ") return isButton(element) || element.tagName === "SUMMARY" || element.tagName === "INPUT" || element.tagName === "SELECT"; 35378 return false; 35379 } 35380 var symbol = /* @__PURE__ */ Symbol("command"); 35381 var useCommand = createHook(function useCommand2({ clickOnEnter = true, clickOnSpace = true, ...props }) { 35382 const ref = (0, import_react49.useRef)(null); 35383 const [isNativeButton, setIsNativeButton] = (0, import_react49.useState)(false); 35384 const type = props.type; 35385 (0, import_react49.useEffect)(() => { 35386 const element = ref.current; 35387 if (!element) return; 35388 const nativeButton = isButton(element); 35389 if (type !== void 0 && nativeButton && element.type === "button") return; 35390 setIsNativeButton(nativeButton); 35391 }, [type]); 35392 const [active, setActive] = (0, import_react49.useState)(false); 35393 const activeRef = (0, import_react49.useRef)(false); 35394 const disabled2 = disabledFromProps(props); 35395 const [isDuplicate, metadataProps] = useMetadataProps(props, symbol, true); 35396 useSafeLayoutEffect(() => { 35397 if (!disabled2) return; 35398 activeRef.current = false; 35399 setActive(false); 35400 }, [disabled2]); 35401 const onKeyDownProp = props.onKeyDown; 35402 const onKeyDown = useEvent((event) => { 35403 onKeyDownProp?.(event); 35404 const element = event.currentTarget; 35405 if (event.defaultPrevented) return; 35406 if (isDuplicate) return; 35407 if (disabled2) return; 35408 if (!isSelfTarget(event)) return; 35409 if (isTextField(element)) return; 35410 if (element.isContentEditable) return; 35411 const isEnter = clickOnEnter && event.key === "Enter"; 35412 const isSpace = clickOnSpace && event.key === " "; 35413 const shouldPreventEnter = event.key === "Enter" && !clickOnEnter; 35414 const shouldPreventSpace = event.key === " " && !clickOnSpace; 35415 if (shouldPreventEnter || shouldPreventSpace) { 35416 event.preventDefault(); 35417 return; 35418 } 35419 if (isEnter || isSpace) { 35420 const nativeClick = isNativeClick(event); 35421 if (isEnter) { 35422 if (!nativeClick) { 35423 event.preventDefault(); 35424 const { view, ...eventInit } = event; 35425 const click = () => fireClickEvent(element, eventInit); 35426 if (isFirefox()) queueBeforeEvent(element, "keyup", click); 35427 else queueMicrotask(click); 35428 } 35429 } else if (isSpace) { 35430 activeRef.current = true; 35431 if (!nativeClick) { 35432 event.preventDefault(); 35433 setActive(true); 35434 } 35435 } 35436 } 35437 }); 35438 const onKeyUpProp = props.onKeyUp; 35439 const onKeyUp = useEvent((event) => { 35440 onKeyUpProp?.(event); 35441 if (isDuplicate) return; 35442 const isSpace = clickOnSpace && event.key === " "; 35443 if (!activeRef.current || !isSpace) return; 35444 const nativeClick = isNativeClick(event); 35445 activeRef.current = false; 35446 if (!nativeClick) setActive(false); 35447 if (event.defaultPrevented) return; 35448 if (!isSelfTarget(event)) return; 35449 if (disabled2) return; 35450 if (event.metaKey) return; 35451 if (nativeClick) return; 35452 event.preventDefault(); 35453 const element = event.currentTarget; 35454 const { view, ...eventInit } = event; 35455 queueMicrotask(() => fireClickEvent(element, eventInit)); 35456 }); 35457 const onBlurProp = props.onBlur; 35458 const onBlur = useEvent((event) => { 35459 onBlurProp?.(event); 35460 if (!activeRef.current) return; 35461 activeRef.current = false; 35462 setActive(false); 35463 }); 35464 props = { 35465 "data-active": active || void 0, 35466 type: isNativeButton ? "button" : void 0, 35467 ...metadataProps, 35468 ...props, 35469 ref: useMergeRefs5(ref, props.ref), 35470 onKeyDown, 35471 onKeyUp, 35472 onBlur 35473 }; 35474 props = useFocusable(props); 35475 return props; 35476 }); 35477 var Command = forwardRef89(function Command2(props) { 35478 const htmlProps = useCommand(withDefaultButtonType(props)); 35479 return createElement3(TagName2, htmlProps); 35480 }); 35481 35482 // node_modules/@ariakit/react-components/dist/collection/collection-context.js 35483 var ctx = createStoreContext(); 35484 var useCollectionContext = ctx.useContext; 35485 var useCollectionScopedContext = ctx.useScopedContext; 35486 var useCollectionProviderContext = ctx.useProviderContext; 35487 var CollectionContextProvider = ctx.ContextProvider; 35488 var CollectionScopedContextProvider = ctx.ScopedContextProvider; 35489 35490 // node_modules/@ariakit/react-components/dist/collection/collection-item.js 35491 var import_react50 = __toESM(require_react(), 1); 35492 var TagName3 = "div"; 35493 var useCollectionItem = createHook(function useCollectionItem2({ store, shouldRegisterItem = true, getItem = identity, element, ...props }) { 35494 const context = useCollectionContext(); 35495 store = store || context; 35496 const id = useId7(props.id); 35497 const ref = (0, import_react50.useRef)(element); 35498 (0, import_react50.useEffect)(() => { 35499 const element2 = ref.current; 35500 if (!id) return; 35501 if (!element2) return; 35502 if (!shouldRegisterItem) return; 35503 const item = getItem({ 35504 id, 35505 element: element2 35506 }); 35507 return store?.renderItem(item); 35508 }, [ 35509 id, 35510 shouldRegisterItem, 35511 getItem, 35512 store 35513 ]); 35514 props = { 35515 ...props, 35516 ref: useMergeRefs5(ref, props.ref) 35517 }; 35518 return props; 35519 }); 35520 var CollectionItem = forwardRef89(function CollectionItem2(props) { 35521 const htmlProps = useCollectionItem(props); 35522 return createElement3(TagName3, htmlProps); 35523 }); 35524 35525 // node_modules/@ariakit/react-components/dist/composite/composite-context.js 35526 var import_react51 = __toESM(require_react(), 1); 35527 var ctx2 = createStoreContext([CollectionContextProvider], [CollectionScopedContextProvider]); 35528 var useCompositeContext = ctx2.useContext; 35529 var useCompositeScopedContext = ctx2.useScopedContext; 35530 var useCompositeProviderContext = ctx2.useProviderContext; 35531 var CompositeContextProvider = ctx2.ContextProvider; 35532 var CompositeScopedContextProvider = ctx2.ScopedContextProvider; 35533 var CompositeItemContext = (0, import_react51.createContext)(void 0); 35534 var CompositeRowContext = (0, import_react51.createContext)(void 0); 35535 35536 // node_modules/@ariakit/react-components/dist/composite/utils.js 35537 var import_react52 = __toESM(require_react(), 1); 35538 35539 // node_modules/@ariakit/store/dist/index.js 35540 function getInternal(store, key) { 35541 const internals = store.__unstableInternals; 35542 invariant(internals, "Invalid store"); 35543 return internals[key]; 35544 } 35545 function hasUpdatedKey(keys, updatedKey) { 35546 if (!keys) return true; 35547 for (const currentKey of keys) if (updatedKey instanceof Set) { 35548 if (updatedKey.has(currentKey)) return true; 35549 } else if (isSameValue(currentKey, updatedKey)) return true; 35550 return false; 35551 } 35552 function isSameValue(value, other) { 35553 return value === other || value !== value && other !== other; 35554 } 35555 function getCleanupPrevState(prevState, state, stateBeforeCleanup, updatedKey) { 35556 let cleanupPrevState; 35557 for (const key of getKeys(state)) { 35558 if (isSameValue(state[key], stateBeforeCleanup[key])) continue; 35559 if (updatedKey !== void 0 && hasUpdatedKey([key], updatedKey)) continue; 35560 cleanupPrevState ??= { ...prevState }; 35561 cleanupPrevState[key] = state[key]; 35562 } 35563 return cleanupPrevState; 35564 } 35565 var MAX_REPAIR_PASSES = 100; 35566 function addKeyedListener(map, keys, listener) { 35567 if (!keys) return; 35568 for (const key of keys) { 35569 let listeners = map.get(key); 35570 if (!listeners) { 35571 listeners = /* @__PURE__ */ new Set(); 35572 map.set(key, listeners); 35573 } 35574 listeners.add(listener); 35575 } 35576 } 35577 function deleteKeyedListener(map, keys, listener) { 35578 if (!map) return; 35579 if (!keys) return; 35580 for (const key of keys) { 35581 const listeners = map.get(key); 35582 if (!listeners) continue; 35583 listeners.delete(listener); 35584 if (!listeners.size) map.delete(key); 35585 } 35586 } 35587 function getFastPathNotifiedListeners(frame) { 35588 const notifiedListeners = /* @__PURE__ */ new Set(); 35589 const currentListener = frame.currentListener; 35590 if (!currentListener) return notifiedListeners; 35591 for (const listener of frame.keyedListeners) { 35592 notifiedListeners.add(listener); 35593 if (listener === currentListener) return notifiedListeners; 35594 } 35595 notifiedListeners.clear(); 35596 notifiedListeners.add(currentListener); 35597 return notifiedListeners; 35598 } 35599 function preserveFastPathNotifiedListeners(frame) { 35600 frame.notifiedListeners ??= getFastPathNotifiedListeners(frame); 35601 } 35602 function hasFastPathPassedListener(frame, listener) { 35603 if (!frame.currentListener) return false; 35604 let foundCurrentKeyedListener = false; 35605 for (const currentListener of frame.keyedListeners) { 35606 if (currentListener === frame.currentListener) { 35607 foundCurrentKeyedListener = true; 35608 continue; 35609 } 35610 if (!foundCurrentKeyedListener) continue; 35611 if (currentListener === listener) return false; 35612 } 35613 let foundListener = false; 35614 for (const currentListener of frame.group.listeners) { 35615 if (currentListener === frame.currentListener) return foundListener; 35616 if (currentListener === listener) foundListener = true; 35617 } 35618 return false; 35619 } 35620 function preserveFastPathFrames(fastPathFrames, group, listener) { 35621 for (const frame of fastPathFrames) { 35622 if (frame.group !== group) continue; 35623 if (frame.recovering) continue; 35624 if (listener && !frame.keyedListeners.has(listener)) continue; 35625 preserveFastPathNotifiedListeners(frame); 35626 for (const currentListener of frame.group.listeners) { 35627 if (currentListener === frame.currentListener) break; 35628 if (!hasFastPathPassedListener(frame, currentListener)) continue; 35629 frame.notifiedListeners?.add(currentListener); 35630 } 35631 } 35632 } 35633 function preserveFastPathPassedListeners(fastPathFrames, group, listener) { 35634 for (const frame of fastPathFrames) { 35635 if (frame.group !== group) continue; 35636 if (frame.recovering) continue; 35637 if (!hasFastPathPassedListener(frame, listener)) continue; 35638 preserveFastPathNotifiedListeners(frame); 35639 frame.notifiedListeners?.add(listener); 35640 } 35641 } 35642 function preserveFastPathPassedKeyedListeners({ fastPathFrames, group, keys, listener }) { 35643 const wasRegistered = group.listeners.has(listener); 35644 for (const frame of fastPathFrames) { 35645 if (frame.group !== group) continue; 35646 if (frame.recovering) continue; 35647 if (!keys.includes(frame.updatedKey)) continue; 35648 if (hasFastPathPassedListener(frame, listener)) { 35649 preserveFastPathNotifiedListeners(frame); 35650 frame.notifiedListeners?.add(listener); 35651 } else if (wasRegistered) { 35652 preserveFastPathNotifiedListeners(frame); 35653 frame.recoverToLive = true; 35654 } 35655 } 35656 } 35657 function clearFastPathNotifiedListener(fastPathFrames, group, listener) { 35658 for (const frame of fastPathFrames) { 35659 if (frame.group !== group) continue; 35660 frame.notifiedListeners?.delete(listener); 35661 } 35662 } 35663 function addFastPathKeyedListener({ fastPathFrames, group, keys, listener }) { 35664 for (const frame of fastPathFrames) { 35665 if (frame.group !== group) continue; 35666 if (frame.recovering) continue; 35667 if (!keys.includes(frame.updatedKey)) continue; 35668 frame.keyedListeners.add(listener); 35669 } 35670 } 35671 function runPendingCleanup(group, listener) { 35672 if (!group.disposables.size) return; 35673 const cleanup = group.disposables.get(listener); 35674 if (!cleanup) return; 35675 group.disposables.delete(listener); 35676 cleanup(); 35677 } 35678 function setListenerCleanup(group, listener, cleanup) { 35679 const currentCleanup = group.disposables.get(listener); 35680 if (!currentCleanup) { 35681 group.disposables.set(listener, cleanup); 35682 return; 35683 } 35684 group.disposables.set(listener, () => { 35685 currentCleanup(); 35686 cleanup(); 35687 }); 35688 } 35689 function notifyStoreListener(group, listener, state, prevState, getState, updatedKey) { 35690 if (group.suspendCounts?.has(listener)) return; 35691 const { disposables } = group; 35692 const cleanup = disposables.size ? disposables.get(listener) : void 0; 35693 if (cleanup) { 35694 disposables.delete(listener); 35695 const stateBeforeCleanup = state; 35696 cleanup(); 35697 state = getState?.() ?? state; 35698 if (state !== stateBeforeCleanup) prevState = getCleanupPrevState(prevState, state, stateBeforeCleanup, updatedKey) ?? prevState; 35699 } 35700 const result = listener(state, prevState); 35701 if (result) setListenerCleanup(group, listener, result); 35702 } 35703 function runLiveListeners({ group, getState, prevState, updatedKey, notifiedListeners }) { 35704 const allKeysListeners = group.allKeysListeners; 35705 for (const listener of group.listeners) { 35706 if (notifiedListeners?.has(listener)) continue; 35707 if (!allKeysListeners?.has(listener)) { 35708 if (!hasUpdatedKey(group.listenerKeys.get(listener), updatedKey)) continue; 35709 } 35710 notifiedListeners?.add(listener); 35711 notifyStoreListener(group, listener, getState(), prevState, getState, updatedKey); 35712 } 35713 } 35714 function createStore(initialState, ...stores) { 35715 let state = initialState; 35716 let prevStateBatch = state; 35717 let destroy = noop5; 35718 let batchPending = false; 35719 let inDispatch = false; 35720 let updatedKeys = /* @__PURE__ */ new Set(); 35721 const instances = /* @__PURE__ */ new Set(); 35722 const setups = /* @__PURE__ */ new Set(); 35723 const syncListenerGroup = { 35724 listeners: /* @__PURE__ */ new Set(), 35725 disposables: /* @__PURE__ */ new Map(), 35726 listenerKeys: /* @__PURE__ */ new WeakMap() 35727 }; 35728 const batchListenerGroup = { 35729 listeners: /* @__PURE__ */ new Set(), 35730 disposables: /* @__PURE__ */ new Map(), 35731 listenerKeys: /* @__PURE__ */ new WeakMap() 35732 }; 35733 const storeSetup = (callback) => { 35734 setups.add(callback); 35735 return () => setups.delete(callback); 35736 }; 35737 const storeInit = () => { 35738 const initializedInstances = instances.size; 35739 const instance = /* @__PURE__ */ Symbol(); 35740 instances.add(instance); 35741 const maybeDestroy = () => { 35742 if (!instances.delete(instance)) return; 35743 if (instances.size) return; 35744 destroy(); 35745 }; 35746 if (initializedInstances) return maybeDestroy; 35747 const stateKeys = getKeys(state); 35748 const desyncs = []; 35749 for (const store of stores) { 35750 const storeState = store?.getState?.(); 35751 if (!storeState) continue; 35752 const keys = stateKeys.filter((key) => hasOwnProperty(storeState, key)); 35753 if (!keys.length) continue; 35754 if (stores.length === 1 || keys.length === stateKeys.length) { 35755 for (const key of keys) desyncs.push(sync(store, [key], (state2) => { 35756 setState(key, state2[key], true); 35757 })); 35758 continue; 35759 } 35760 desyncs.push(subscribe(store, keys, (state2, prevState) => { 35761 for (const key of keys) { 35762 if (state2[key] === prevState[key]) continue; 35763 setState(key, state2[key], true); 35764 } 35765 })); 35766 for (const key of keys) { 35767 const liveState = store?.getState?.(); 35768 if (!liveState) continue; 35769 setState(key, liveState[key], true); 35770 } 35771 } 35772 const teardowns = []; 35773 for (const setup2 of setups) teardowns.push(setup2()); 35774 const cleanups = stores.map(init); 35775 destroy = chain(...desyncs, ...teardowns, ...cleanups); 35776 return maybeDestroy; 35777 }; 35778 const deleteListenerIndexes = (group, listener, keys) => { 35779 if (keys === void 0) return; 35780 if (keys) deleteKeyedListener(group.listenersByKey, keys, listener); 35781 else group.allKeysListeners?.delete(listener); 35782 }; 35783 const fastPathFrames = []; 35784 const registerListener = (keys, listener, group = syncListenerGroup) => { 35785 const listenerKeysValue = keys ? [...keys] : null; 35786 const wasRegistered = group.listeners.has(listener); 35787 if (!wasRegistered) clearFastPathNotifiedListener(fastPathFrames, group, listener); 35788 if (!listenerKeysValue) { 35789 if (wasRegistered) preserveFastPathFrames(fastPathFrames, group); 35790 preserveFastPathPassedListeners(fastPathFrames, group, listener); 35791 } else preserveFastPathPassedKeyedListeners({ 35792 fastPathFrames, 35793 group, 35794 keys: listenerKeysValue, 35795 listener 35796 }); 35797 if (wasRegistered) { 35798 preserveFastPathFrames(fastPathFrames, group, listener); 35799 deleteListenerIndexes(group, listener, group.listenerKeys.get(listener)); 35800 } 35801 group.listeners.add(listener); 35802 if (listenerKeysValue) { 35803 group.listenersByKey ??= /* @__PURE__ */ new Map(); 35804 addKeyedListener(group.listenersByKey, listenerKeysValue, listener); 35805 addFastPathKeyedListener({ 35806 fastPathFrames, 35807 group, 35808 keys: listenerKeysValue, 35809 listener 35810 }); 35811 } else { 35812 group.allKeysListeners ??= /* @__PURE__ */ new Set(); 35813 group.allKeysListeners.add(listener); 35814 } 35815 group.listenerKeys.set(listener, listenerKeysValue); 35816 return () => { 35817 const cleanup = group.disposables.get(listener); 35818 group.disposables.delete(listener); 35819 preserveFastPathFrames(fastPathFrames, group, listener); 35820 const currentKeys = group.listenerKeys.get(listener); 35821 deleteListenerIndexes(group, listener, listenerKeysValue); 35822 if (currentKeys !== listenerKeysValue) deleteListenerIndexes(group, listener, currentKeys); 35823 group.listenerKeys.delete(listener); 35824 group.listeners.delete(listener); 35825 cleanup?.(); 35826 }; 35827 }; 35828 const storeSubscribe = (keys, listener) => registerListener(keys, listener); 35829 const runInitialListener = (group, listener, prevState) => { 35830 const shouldSuspend = group.listeners.has(listener); 35831 if (shouldSuspend) { 35832 group.suspendCounts ??= /* @__PURE__ */ new Map(); 35833 const count = group.suspendCounts.get(listener) ?? 0; 35834 group.suspendCounts.set(listener, count + 1); 35835 } 35836 let cleanupPrevState; 35837 try { 35838 const stateBeforeCleanups = state; 35839 runPendingCleanup(group, listener); 35840 if (state !== stateBeforeCleanups) cleanupPrevState = getCleanupPrevState(prevState, state, stateBeforeCleanups); 35841 const cleanup = listener(state, cleanupPrevState ?? prevState); 35842 if (cleanup) setListenerCleanup(group, listener, cleanup); 35843 } finally { 35844 if (shouldSuspend) { 35845 const suspendCounts = group.suspendCounts; 35846 const count = suspendCounts?.get(listener); 35847 if (count && count > 1) suspendCounts?.set(listener, count - 1); 35848 else suspendCounts?.delete(listener); 35849 if (!suspendCounts?.size) delete group.suspendCounts; 35850 } 35851 } 35852 }; 35853 const storeSync = (keys, listener) => { 35854 runInitialListener(syncListenerGroup, listener, state); 35855 return registerListener(keys, listener); 35856 }; 35857 const storeBatch = (keys, listener) => { 35858 if (!batchListenerGroup.listeners.size && !inDispatch) prevStateBatch = state; 35859 runInitialListener(batchListenerGroup, listener, prevStateBatch); 35860 return registerListener(keys, listener, batchListenerGroup); 35861 }; 35862 const storePick = (keys) => createStore(pick(state, keys), finalStore); 35863 const storeOmit = (keys) => createStore(omit(state, keys), finalStore); 35864 const getState = () => state; 35865 const runListeners = (group, prevState, updatedKey) => { 35866 if (!(updatedKey instanceof Set) && !group.allKeysListeners?.size) { 35867 const keyedListeners = group.listenersByKey?.get(updatedKey); 35868 if (!keyedListeners) return; 35869 const frame = { 35870 group, 35871 keyedListeners, 35872 updatedKey, 35873 currentListener: null 35874 }; 35875 fastPathFrames.push(frame); 35876 try { 35877 for (const listener of keyedListeners) { 35878 if (frame.notifiedListeners?.has(listener)) continue; 35879 frame.currentListener = listener; 35880 frame.notifiedListeners?.add(listener); 35881 notifyStoreListener(group, listener, state, prevState, getState, updatedKey); 35882 if (!group.allKeysListeners?.size && !frame.recoverToLive) continue; 35883 const notifiedListeners = frame.notifiedListeners ?? getFastPathNotifiedListeners(frame); 35884 frame.notifiedListeners = notifiedListeners; 35885 frame.recovering = true; 35886 runLiveListeners({ 35887 group, 35888 getState, 35889 prevState, 35890 updatedKey, 35891 notifiedListeners 35892 }); 35893 return; 35894 } 35895 } finally { 35896 fastPathFrames.pop(); 35897 } 35898 return; 35899 } 35900 runLiveListeners({ 35901 group, 35902 getState, 35903 prevState, 35904 updatedKey 35905 }); 35906 }; 35907 const setState = (key, value, fromStores = false) => { 35908 if (!hasOwnProperty(state, key)) return; 35909 const currentValue = state[key]; 35910 const nextValue = applyState(value, () => currentValue); 35911 if (isSameValue(nextValue, currentValue)) return; 35912 const wasInDispatch = inDispatch; 35913 inDispatch = true; 35914 const prevState = state; 35915 const nextState = { 35916 ...state, 35917 [key]: nextValue 35918 }; 35919 state = nextState; 35920 let superseded = false; 35921 try { 35922 if (!fromStores && stores.length) { 35923 for (const store of stores) { 35924 store?.setState?.(key, nextValue); 35925 if (isSameValue(state[key], nextValue)) continue; 35926 superseded = true; 35927 break; 35928 } 35929 if (superseded) { 35930 let pass = 0; 35931 for (; pass < MAX_REPAIR_PASSES; pass += 1) { 35932 let changed = false; 35933 for (const store of stores) { 35934 const previousValue = state[key]; 35935 store?.setState?.(key, previousValue); 35936 if (!isSameValue(state[key], previousValue)) changed = true; 35937 } 35938 if (!changed) break; 35939 } 35940 if (pass === MAX_REPAIR_PASSES) console.warn("Parent stores did not converge after a superseded fan-out; a parent listener may be rewriting this key in a cycle."); 35941 } 35942 } 35943 if (!superseded) { 35944 const listenerPrevState = state === nextState ? prevState : { 35945 ...state, 35946 [key]: prevState[key] 35947 }; 35948 runListeners(syncListenerGroup, listenerPrevState, key); 35949 } 35950 } finally { 35951 inDispatch = wasInDispatch; 35952 } 35953 if (!batchListenerGroup.listeners.size) { 35954 if (!inDispatch) prevStateBatch = state; 35955 return; 35956 } 35957 updatedKeys.add(key); 35958 if (batchPending) return; 35959 batchPending = true; 35960 queueMicrotask(() => { 35961 batchPending = false; 35962 const snapshot = state; 35963 const updatedKeysSnapshot = updatedKeys; 35964 updatedKeys = /* @__PURE__ */ new Set(); 35965 const prevStateBatchBefore = prevStateBatch; 35966 runListeners(batchListenerGroup, prevStateBatchBefore, updatedKeysSnapshot); 35967 if (prevStateBatch === prevStateBatchBefore) prevStateBatch = snapshot; 35968 }); 35969 }; 35970 const finalStore = { 35971 getState, 35972 setState, 35973 __unstableInternals: { 35974 setup: storeSetup, 35975 init: storeInit, 35976 subscribe: storeSubscribe, 35977 sync: storeSync, 35978 batch: storeBatch, 35979 pick: storePick, 35980 omit: storeOmit 35981 } 35982 }; 35983 return finalStore; 35984 } 35985 function setup(store, ...args) { 35986 if (!store) return; 35987 return getInternal(store, "setup")(...args); 35988 } 35989 function init(store, ...args) { 35990 if (!store) return; 35991 return getInternal(store, "init")(...args); 35992 } 35993 function subscribe(store, ...args) { 35994 if (!store) return; 35995 return getInternal(store, "subscribe")(...args); 35996 } 35997 function sync(store, ...args) { 35998 if (!store) return; 35999 return getInternal(store, "sync")(...args); 36000 } 36001 function batch(store, ...args) { 36002 if (!store) return; 36003 return getInternal(store, "batch")(...args); 36004 } 36005 function omit2(store, ...args) { 36006 if (!store) return; 36007 return getInternal(store, "omit")(...args); 36008 } 36009 function pick2(store, ...args) { 36010 if (!store) return; 36011 return getInternal(store, "pick")(...args); 36012 } 36013 function mergeStore(...stores) { 36014 const initialState = {}; 36015 for (const store2 of stores) { 36016 const nextState = store2?.getState?.(); 36017 if (nextState) Object.assign(initialState, nextState); 36018 } 36019 const store = createStore(initialState, ...stores); 36020 return Object.assign({}, ...stores, store); 36021 } 36022 function throwOnConflictingProps(props, store) { 36023 if (false) return; 36024 if (!store) return; 36025 const defaultKeys = Object.entries(props).filter(([key, value]) => key.startsWith("default") && value !== void 0).map(([key]) => { 36026 const stateKey = key.replace("default", ""); 36027 return `$stateKey[0]?.toLowerCase() || ""}$stateKey.slice(1)}`; 36028 }); 36029 if (!defaultKeys.length) return; 36030 const storeState = store.getState(); 36031 if (!defaultKeys.filter((key) => hasOwnProperty(storeState, key)).length) return; 36032 throw new Error(`Passing a store prop in conjunction with a default state is not supported. 36033 36034 const store = useSelectStore(); 36035 <SelectProvider store={store} defaultValue="Apple" /> 36036 ^ ^ 36037 36038 Instead, pass the default state to the topmost store: 36039 36040 const store = useSelectStore({ defaultValue: "Apple" }); 36041 <SelectProvider store={store} /> 36042 36043 See https://github.com/ariakit/ariakit/pull/2745 for more details. 36044 36045 If there's a particular need for this, please submit a feature request at https://github.com/ariakit/ariakit 36046 `); 36047 } 36048 36049 // node_modules/@ariakit/components/dist/collection/collection-store.js 36050 function getCommonParent(items) { 36051 const firstItem = items.find((item) => !!item.element); 36052 const lastElement = [...items].reverse().find((item) => !!item.element)?.element; 36053 let parentElement = firstItem?.element?.parentElement; 36054 if (!lastElement) return getDocument(parentElement).body; 36055 while (parentElement) { 36056 if (parentElement.contains(lastElement)) return parentElement; 36057 parentElement = parentElement.parentElement; 36058 } 36059 return getDocument(parentElement).body; 36060 } 36061 function getPrivateStore(store) { 36062 return store?.__unstablePrivateStore; 36063 } 36064 var itemIdCacheThreshold = 64; 36065 function getCachedItemIds(items, cache) { 36066 if (items.length < itemIdCacheThreshold) { 36067 if (cache.ids) { 36068 cache.items = void 0; 36069 cache.ids = void 0; 36070 } 36071 return; 36072 } 36073 if (cache.items === items) return cache.ids; 36074 const ids = /* @__PURE__ */ new Set(); 36075 for (const item of items) ids.add(item.id); 36076 cache.items = items; 36077 cache.ids = ids; 36078 return ids; 36079 } 36080 function setCachedItemIds(items, cache, ids) { 36081 if (items.length < itemIdCacheThreshold) { 36082 if (cache.ids) { 36083 cache.items = void 0; 36084 cache.ids = void 0; 36085 } 36086 return; 36087 } 36088 if (!ids) { 36089 ids = /* @__PURE__ */ new Set(); 36090 for (const item of items) ids.add(item.id); 36091 } 36092 cache.items = items; 36093 cache.ids = ids; 36094 } 36095 function createCollectionStore(props = {}) { 36096 throwOnConflictingProps(props, props.store); 36097 const syncState = props.store?.getState(); 36098 const items = defaultValue(props.items, syncState?.items, props.defaultItems, []); 36099 const syncPrivateStore = getPrivateStore(props.store); 36100 const collectionLookup = syncPrivateStore?.__unstableCollectionLookup ?? { 36101 controlledItems: new Map(items.map((item) => [item.id, item])), 36102 registeredItems: /* @__PURE__ */ new Map(), 36103 controlledItemsSource: items, 36104 propagatedItems: items 36105 }; 36106 const { controlledItems, registeredItems } = collectionLookup; 36107 const itemIdCache = {}; 36108 const renderedItemIdCache = {}; 36109 const initialState = { 36110 items, 36111 renderedItems: defaultValue(syncState?.renderedItems, []) 36112 }; 36113 const collection = createStore(initialState, props.store); 36114 const privateStore = Object.assign(createStore({ 36115 items, 36116 renderedItems: initialState.renderedItems 36117 }, syncPrivateStore), { __unstableCollectionLookup: collectionLookup }); 36118 const sortItems = (renderedItems) => { 36119 const sortedItems = sortBasedOnDOMPosition(renderedItems, (i) => i.element); 36120 privateStore.setState("renderedItems", sortedItems); 36121 collection.setState("renderedItems", sortedItems); 36122 }; 36123 const indexControlledItems = (items2) => { 36124 if (items2 === collectionLookup.controlledItemsSource) return; 36125 collectionLookup.controlledItemsSource = items2; 36126 controlledItems.clear(); 36127 for (const item of items2) controlledItems.set(item.id, item); 36128 }; 36129 const setState = (key, value) => { 36130 if (key !== "items") { 36131 collection.setState(key, value); 36132 return; 36133 } 36134 collection.setState("items", (items2) => { 36135 const nextItems = applyState(value, items2); 36136 if (nextItems === items2) return items2; 36137 collectionLookup.propagatedItems = nextItems; 36138 indexControlledItems(nextItems); 36139 return nextItems; 36140 }); 36141 }; 36142 setup(collection, () => init(privateStore)); 36143 if (!syncPrivateStore) { 36144 subscribe(collection, ["items"], ({ items: items2 }) => { 36145 if (items2 === collectionLookup.propagatedItems) return; 36146 collectionLookup.propagatedItems = items2; 36147 indexControlledItems(items2); 36148 }); 36149 setup(privateStore, () => { 36150 return batch(privateStore, ["items"], ({ items: items2 }) => { 36151 collectionLookup.propagatedItems = items2; 36152 collection.setState("items", items2); 36153 }); 36154 }); 36155 } 36156 setup(privateStore, () => { 36157 return batch(privateStore, ["renderedItems"], (state) => { 36158 if (state.renderedItems !== collection.getState().renderedItems) sortItems(state.renderedItems); 36159 if (typeof IntersectionObserver !== "function") return; 36160 let firstRun = true; 36161 let raf = 0; 36162 const ioCallback = () => { 36163 if (firstRun) { 36164 firstRun = false; 36165 return; 36166 } 36167 cancelAnimationFrame(raf); 36168 raf = requestAnimationFrame(() => sortItems(state.renderedItems)); 36169 }; 36170 const root = getCommonParent(state.renderedItems); 36171 const observer = new IntersectionObserver(ioCallback, { root }); 36172 for (const item of state.renderedItems) { 36173 if (!item.element) continue; 36174 observer.observe(item.element); 36175 } 36176 return () => { 36177 cancelAnimationFrame(raf); 36178 observer.disconnect(); 36179 }; 36180 }); 36181 }); 36182 const createMergeItem = (key, cache, lookup) => { 36183 const registeredItems2 = lookup?.registeredItems; 36184 const controlledItems2 = lookup?.controlledItems; 36185 return (item) => { 36186 const previousRegisteredItem = registeredItems2?.get(item.id); 36187 const wasKnown = !!previousRegisteredItem || !!controlledItems2?.has(item.id); 36188 let prevItem; 36189 privateStore.setState(key, (items2) => { 36190 const ids = !!cache.ids || items2.length >= itemIdCacheThreshold && !wasKnown ? getCachedItemIds(items2, cache) : void 0; 36191 const index2 = ids && !ids.has(item.id) ? -1 : items2.findIndex(({ id }) => id === item.id); 36192 const nextItems = items2.slice(); 36193 if (index2 !== -1) { 36194 prevItem = items2[index2]; 36195 const nextItem = { 36196 ...prevItem, 36197 ...item 36198 }; 36199 nextItems[index2] = nextItem; 36200 registeredItems2?.set(item.id, nextItem); 36201 } else { 36202 nextItems.push(item); 36203 registeredItems2?.set(item.id, item); 36204 ids?.add(item.id); 36205 } 36206 if (cache.ids || index2 === -1 && nextItems.length >= itemIdCacheThreshold) setCachedItemIds(nextItems, cache, ids); 36207 return nextItems; 36208 }); 36209 const unmergeItem = () => { 36210 if (registeredItems2) { 36211 if (previousRegisteredItem) registeredItems2.set(item.id, previousRegisteredItem); 36212 else registeredItems2.delete(item.id); 36213 } 36214 privateStore.setState(key, (items2) => { 36215 const ids = cache.ids ? getCachedItemIds(items2, cache) : void 0; 36216 if (!prevItem) { 36217 const nextItems2 = items2.filter(({ id }) => id !== item.id); 36218 ids?.delete(item.id); 36219 if (cache.ids) setCachedItemIds(nextItems2, cache, ids); 36220 return nextItems2; 36221 } 36222 const index2 = items2.findIndex(({ id }) => id === item.id); 36223 if (index2 === -1) return items2; 36224 const nextItems = items2.slice(); 36225 nextItems[index2] = prevItem; 36226 if (cache.ids) setCachedItemIds(nextItems, cache, ids); 36227 return nextItems; 36228 }); 36229 }; 36230 return unmergeItem; 36231 }; 36232 }; 36233 const registerItem = createMergeItem("items", itemIdCache, collectionLookup); 36234 const mergeRenderedItem = createMergeItem("renderedItems", renderedItemIdCache); 36235 return { 36236 ...collection, 36237 setState, 36238 registerItem, 36239 renderItem: (item) => chain(registerItem(item), mergeRenderedItem(item)), 36240 item: (id) => { 36241 if (!id) return null; 36242 if (!registeredItems.size) return controlledItems.get(id) ?? null; 36243 return registeredItems.get(id) ?? controlledItems.get(id) ?? null; 36244 }, 36245 __unstablePrivateStore: privateStore 36246 }; 36247 } 36248 36249 // node_modules/@ariakit/components/dist/composite/composite-store.js 36250 var NULL_ITEM = { id: null }; 36251 function findFirstEnabledItem(items, excludeId) { 36252 return items.find((item) => { 36253 if (excludeId) return !item.disabled && item.id !== excludeId; 36254 return !item.disabled; 36255 }); 36256 } 36257 function findLastEnabledItem(items) { 36258 for (let i = items.length - 1; i >= 0; i -= 1) { 36259 const item = items[i]; 36260 if (!item) continue; 36261 if (item.disabled) continue; 36262 return item; 36263 } 36264 } 36265 function getEnabledItems(items, excludeId) { 36266 return items.filter((item) => { 36267 if (excludeId) return !item.disabled && item.id !== excludeId; 36268 return !item.disabled; 36269 }); 36270 } 36271 function getItemsInRow(items, rowId) { 36272 return items.filter((item) => item.rowId === rowId); 36273 } 36274 function findEnabledItemId({ items, fromIndex, step, rowId, excludeId }) { 36275 for (let i = fromIndex; i >= 0 && i < items.length; i += step) { 36276 const item = items[i]; 36277 if (!item) continue; 36278 if (item.rowId !== rowId) continue; 36279 if (item.disabled) continue; 36280 const itemId = item.id; 36281 if (excludeId != null && itemId === excludeId) continue; 36282 return itemId; 36283 } 36284 } 36285 function flipItems(items, activeId, shouldInsertNullItem = false) { 36286 const index2 = items.findIndex((item) => item.id === activeId); 36287 return [ 36288 ...items.slice(index2 + 1), 36289 ...shouldInsertNullItem ? [NULL_ITEM] : [], 36290 ...items.slice(0, index2) 36291 ]; 36292 } 36293 var rowMapItemThreshold = 48; 36294 var rowMapRowThreshold = 4; 36295 function groupSmallItemsByRows(items) { 36296 const rows = []; 36297 let previousRow; 36298 let previousRowId; 36299 for (const item of items) { 36300 const rowId = item.rowId; 36301 if (previousRow && previousRowId === rowId) { 36302 previousRow.push(item); 36303 continue; 36304 } 36305 const row = rows.find((currentRow) => currentRow[0]?.rowId === rowId); 36306 if (row) { 36307 row.push(item); 36308 previousRow = row; 36309 } else { 36310 previousRow = [item]; 36311 rows.push(previousRow); 36312 } 36313 previousRowId = rowId; 36314 } 36315 return rows; 36316 } 36317 function groupLargeItemsByRows(items) { 36318 const firstItem = items[0]; 36319 if (!firstItem) return []; 36320 let itemIndex = 1; 36321 while (itemIndex < items.length && items[itemIndex]?.rowId === firstItem.rowId) itemIndex += 1; 36322 const firstRow = items.slice(0, itemIndex); 36323 if (itemIndex === items.length) return [firstRow]; 36324 const rows = [firstRow]; 36325 let rowsById; 36326 for (; itemIndex < items.length; itemIndex += 1) { 36327 const item = items[itemIndex]; 36328 if (!item) continue; 36329 const row = rowsById ? rowsById.get(item.rowId) : rows.find((currentRow) => currentRow[0]?.rowId === item.rowId); 36330 if (row) { 36331 row.push(item); 36332 continue; 36333 } 36334 const newRow = [item]; 36335 rows.push(newRow); 36336 if (rowsById) rowsById.set(item.rowId, newRow); 36337 else if (rows.length === rowMapRowThreshold) rowsById = new Map(rows.map((currentRow) => [currentRow[0]?.rowId, currentRow])); 36338 } 36339 return rows; 36340 } 36341 function groupItemsByRows(items) { 36342 if (items.length >= rowMapItemThreshold) return groupLargeItemsByRows(items); 36343 return groupSmallItemsByRows(items); 36344 } 36345 function getMaxRowLength(array) { 36346 let maxLength = 0; 36347 for (const { length } of array) if (length > maxLength) maxLength = length; 36348 return maxLength; 36349 } 36350 function createEmptyItem(rowId) { 36351 return { 36352 id: "__EMPTY_ITEM__", 36353 disabled: true, 36354 rowId 36355 }; 36356 } 36357 function normalizeRows(rows, activeId, focusShift) { 36358 const maxLength = getMaxRowLength(rows); 36359 for (const row of rows) for (let i = 0; i < maxLength; i += 1) { 36360 const item = row[i]; 36361 if (!item || focusShift && item.disabled) { 36362 const previousItem = i === 0 && focusShift ? findFirstEnabledItem(row) : row[i - 1]; 36363 row[i] = previousItem && activeId !== previousItem.id && focusShift ? previousItem : createEmptyItem(previousItem?.rowId); 36364 } 36365 } 36366 return rows; 36367 } 36368 function verticalizeItems(items) { 36369 const rows = groupItemsByRows(items); 36370 const maxLength = getMaxRowLength(rows); 36371 const verticalized = []; 36372 for (let i = 0; i < maxLength; i += 1) for (const row of rows) { 36373 const item = row[i]; 36374 if (item) verticalized.push({ 36375 ...item, 36376 rowId: item.rowId ? `$i}` : void 0 36377 }); 36378 } 36379 return verticalized; 36380 } 36381 function createCompositeStore(props = {}) { 36382 const syncState = props.store?.getState(); 36383 const collection = createCollectionStore(props); 36384 const activeId = defaultValue(props.activeId, syncState?.activeId, props.defaultActiveId); 36385 const compositeElement = defaultValue(syncState?.compositeElement, syncState?.baseElement, null); 36386 const compositeElementInFocusOrder = defaultValue(props.compositeElementInFocusOrder, props.includesBaseElement, syncState?.compositeElementInFocusOrder, syncState?.includesBaseElement, activeId === null); 36387 const initialState = { 36388 ...collection.getState(), 36389 id: defaultValue(props.id, syncState?.id) ?? `id-$Math.random().toString(36).slice(2, 8)}`, 36390 activeId, 36391 compositeElement, 36392 baseElement: compositeElement, 36393 compositeElementInFocusOrder, 36394 includesBaseElement: compositeElementInFocusOrder, 36395 moves: defaultValue(syncState?.moves, 0), 36396 orientation: defaultValue(props.orientation, syncState?.orientation, "both"), 36397 rtl: defaultValue(props.rtl, syncState?.rtl, false), 36398 virtualFocus: defaultValue(props.virtualFocus, syncState?.virtualFocus, false), 36399 focusLoop: defaultValue(props.focusLoop, syncState?.focusLoop, false), 36400 focusWrap: defaultValue(props.focusWrap, syncState?.focusWrap, false), 36401 focusShift: defaultValue(props.focusShift, syncState?.focusShift, false) 36402 }; 36403 const composite = createStore(initialState, collection, props.store); 36404 setup(composite, () => chain(sync(composite, ["compositeElement"], (state) => { 36405 composite.setState("baseElement", state.compositeElement); 36406 }), sync(composite, ["baseElement"], (state) => { 36407 composite.setState("compositeElement", state.baseElement); 36408 }), sync(composite, ["compositeElementInFocusOrder"], (state) => { 36409 composite.setState("includesBaseElement", state.compositeElementInFocusOrder); 36410 }), sync(composite, ["includesBaseElement"], (state) => { 36411 composite.setState("compositeElementInFocusOrder", state.includesBaseElement); 36412 }))); 36413 setup(composite, () => sync(composite, ["renderedItems", "activeId"], (state) => { 36414 composite.setState("activeId", (activeId2) => { 36415 if (activeId2 !== void 0) return activeId2; 36416 return findFirstEnabledItem(state.renderedItems)?.id; 36417 }); 36418 })); 36419 const getNextId = (direction = "next", options = {}) => { 36420 const defaultState = composite.getState(); 36421 const compositeElementInFocusOrder2 = defaultValue(options.compositeElementInFocusOrder, options.includesBaseElement, defaultState.compositeElementInFocusOrder); 36422 const { skip = 0, activeId: activeId2 = defaultState.activeId, focusShift = defaultState.focusShift, focusLoop = defaultState.focusLoop, focusWrap = defaultState.focusWrap, renderedItems = defaultState.renderedItems, rtl = defaultState.rtl } = options; 36423 const isVerticalDirection = direction === "up" || direction === "down"; 36424 const isNextDirection = direction === "next" || direction === "down"; 36425 const canReverse = isNextDirection ? rtl && !isVerticalDirection : !rtl || isVerticalDirection; 36426 const canShift = focusShift && !skip; 36427 if (!skip && !focusWrap && !compositeElementInFocusOrder2 && activeId2 != null) { 36428 if (!isVerticalDirection ? true : !canShift && !renderedItems.some((item) => item.rowId != null)) { 36429 let activeIndex2 = -1; 36430 if (renderedItems === defaultState.renderedItems) { 36431 const firstItem = renderedItems[0]; 36432 if (firstItem && collection.item(firstItem.id) === firstItem) { 36433 const registeredItem = collection.item(activeId2); 36434 if (registeredItem?.id === activeId2) activeIndex2 = renderedItems.indexOf(registeredItem); 36435 } 36436 } 36437 if (activeIndex2 === -1) activeIndex2 = renderedItems.findIndex((item) => item.id === activeId2); 36438 const activeItem2 = renderedItems[activeIndex2]; 36439 if (activeItem2) { 36440 const step = canReverse ? -1 : 1; 36441 const nextId = findEnabledItemId({ 36442 items: renderedItems, 36443 fromIndex: activeIndex2 + step, 36444 step, 36445 rowId: activeItem2.rowId, 36446 excludeId: activeId2 36447 }); 36448 if (nextId !== void 0) return nextId; 36449 if (!(focusLoop && (isVerticalDirection ? focusLoop !== "horizontal" : focusLoop !== "vertical"))) return void 0; 36450 return findEnabledItemId({ 36451 items: renderedItems, 36452 fromIndex: step === 1 ? 0 : renderedItems.length - 1, 36453 step, 36454 rowId: activeItem2.rowId, 36455 excludeId: activeId2 36456 }); 36457 } 36458 } 36459 } 36460 let items = !isVerticalDirection ? renderedItems : flatten2DArray(normalizeRows(groupItemsByRows(renderedItems), activeId2, canShift)); 36461 items = canReverse ? reverseArray(items) : items; 36462 items = isVerticalDirection ? verticalizeItems(items) : items; 36463 if (activeId2 == null) return findFirstEnabledItem(items)?.id; 36464 const activeItem = items.find((item) => item.id === activeId2); 36465 if (!activeItem) return findFirstEnabledItem(items)?.id; 36466 const isGrid2 = items.some((item) => item.rowId); 36467 const activeIndex = items.indexOf(activeItem); 36468 const nextItems = items.slice(activeIndex + 1); 36469 const nextItemsInRow = getItemsInRow(nextItems, activeItem.rowId); 36470 if (skip) { 36471 const nextEnabledItemsInRow = getEnabledItems(nextItemsInRow, activeId2); 36472 return (nextEnabledItemsInRow.slice(skip)[0] || nextEnabledItemsInRow[nextEnabledItemsInRow.length - 1])?.id; 36473 } 36474 const canLoop = focusLoop && (isVerticalDirection ? focusLoop !== "horizontal" : focusLoop !== "vertical"); 36475 const canWrap = isGrid2 && focusWrap && (isVerticalDirection ? focusWrap !== "horizontal" : focusWrap !== "vertical"); 36476 const hasNullItem = isNextDirection ? (!isGrid2 || isVerticalDirection) && canLoop && compositeElementInFocusOrder2 : isVerticalDirection ? compositeElementInFocusOrder2 : false; 36477 if (canLoop) return findFirstEnabledItem(flipItems(canWrap && !hasNullItem ? items : getItemsInRow(items, activeItem.rowId), activeId2, hasNullItem), activeId2)?.id; 36478 if (canWrap) { 36479 const nextItem2 = findFirstEnabledItem(hasNullItem ? nextItemsInRow : nextItems, activeId2); 36480 return hasNullItem ? nextItem2?.id || null : nextItem2?.id; 36481 } 36482 const nextItem = findFirstEnabledItem(nextItemsInRow, activeId2); 36483 if (!nextItem && hasNullItem) return null; 36484 return nextItem?.id; 36485 }; 36486 const getNextIdFromOptions = (direction, options) => { 36487 if (typeof options === "number") return getNextId(direction, { skip: options }); 36488 return getNextId(direction, options); 36489 }; 36490 return { 36491 ...collection, 36492 ...composite, 36493 setCompositeElement: (element) => composite.setState("compositeElement", element), 36494 setBaseElement: (element) => composite.setState("compositeElement", element), 36495 setActiveId: (id) => composite.setState("activeId", id), 36496 move: (id) => { 36497 if (id === void 0) return; 36498 composite.setState("activeId", id); 36499 composite.setState("moves", (moves) => moves + 1); 36500 }, 36501 first: () => findFirstEnabledItem(composite.getState().renderedItems)?.id, 36502 last: () => findLastEnabledItem(composite.getState().renderedItems)?.id, 36503 next: (options) => getNextIdFromOptions("next", options), 36504 previous: (options) => getNextIdFromOptions("previous", options), 36505 down: (options) => getNextIdFromOptions("down", options), 36506 up: (options) => getNextIdFromOptions("up", options) 36507 }; 36508 } 36509 36510 // node_modules/@ariakit/react-components/dist/composite/utils.js 36511 var findFirstEnabledItem2 = findFirstEnabledItem; 36512 var groupItemsByRows2 = groupItemsByRows; 36513 var unmountingItems = /* @__PURE__ */ new WeakSet(); 36514 function markItemUnmounting(element) { 36515 if (getActiveElement(element) !== element) return; 36516 unmountingItems.add(element); 36517 queueMicrotask(() => unmountingItems.delete(element)); 36518 } 36519 function markItemMounted(element) { 36520 unmountingItems.delete(element); 36521 } 36522 function withCompositeScrollPreserved(store, callback) { 36523 const { virtualFocus, compositeElement } = store.getState(); 36524 if (!virtualFocus || !compositeElement || !isTextField(compositeElement)) { 36525 callback(); 36526 return; 36527 } 36528 const savedScrollLeft = compositeElement.scrollLeft; 36529 const savedScrollTop = compositeElement.scrollTop; 36530 callback(); 36531 compositeElement.scrollLeft = savedScrollLeft; 36532 compositeElement.scrollTop = savedScrollTop; 36533 } 36534 function getPopupElement(store) { 36535 const state = store.getState(); 36536 if (!("contentElement" in state)) return null; 36537 return state.contentElement; 36538 } 36539 function ownsFocus(store) { 36540 const { compositeElement } = store.getState(); 36541 const activeElement2 = getActiveElement(compositeElement); 36542 if (!activeElement2) return false; 36543 if (compositeElement?.contains(activeElement2)) return true; 36544 if (isItem(store, activeElement2)) return true; 36545 return !!getPopupElement(store)?.contains(activeElement2); 36546 } 36547 function presentItem({ store, id, focus, markedOnly, requireFocus, scrollIntoView, onConsume }) { 36548 let element = null; 36549 let resolvedId; 36550 let focused = false; 36551 let focusLeftElement = false; 36552 let done = false; 36553 let wasMounted = false; 36554 let wasOpen = false; 36555 const compositeAtStart = store.getState().compositeElement; 36556 const activeAtStart = getActiveElement(compositeAtStart); 36557 const owner = requireFocus ? activeAtStart : null; 36558 const startedOnComposite = !!compositeAtStart?.contains(activeAtStart); 36559 const stillOwnsFocus = (target) => { 36560 if (!owner) return true; 36561 const activeElement2 = getActiveElement(owner); 36562 if (activeElement2 === owner) return true; 36563 if (activeElement2 === target) return true; 36564 return ownsFocus(store); 36565 }; 36566 const abandonedByState = (state) => { 36567 if ("mounted" in state) { 36568 if (state.mounted) wasMounted = true; 36569 else if (wasMounted) return true; 36570 } 36571 if ("open" in state) { 36572 if (state.open) wasOpen = true; 36573 else if (wasOpen) return true; 36574 } 36575 return id != null && state.activeId != null && state.activeId !== id; 36576 }; 36577 const entersClosedPopup = (state, target) => { 36578 if (!("open" in state)) return false; 36579 if (state.open) return false; 36580 const popup = getPopupElement(store); 36581 if (!popup?.contains(target)) return false; 36582 const { compositeElement } = state; 36583 if (!compositeElement) return false; 36584 if (popup.contains(compositeElement)) return false; 36585 return isVisible(target); 36586 }; 36587 const resolveElement = (state) => { 36588 const item = getEnabledItem(store, resolvedId ?? (id === void 0 ? state.activeId : id)); 36589 if (!item?.element?.isConnected) return null; 36590 resolvedId = item.id; 36591 return item.element; 36592 }; 36593 let removeFocusListeners; 36594 let unsubscribe; 36595 const cancel = () => { 36596 done = true; 36597 removeFocusListeners?.(); 36598 unsubscribe?.(); 36599 }; 36600 let consumed = false; 36601 const consume = () => { 36602 if (consumed) return; 36603 consumed = true; 36604 onConsume?.(); 36605 }; 36606 const settle = () => { 36607 if (done) return; 36608 consume(); 36609 return cancel(); 36610 }; 36611 const present = () => { 36612 if (done) return; 36613 const state = store.getState(); 36614 if (abandonedByState(state)) return settle(); 36615 let restoreFocus = false; 36616 if (!element) { 36617 element = resolveElement(state); 36618 if (!element) return; 36619 } else if (!element.isConnected) { 36620 restoreFocus = focused && !focusLeftElement && getActiveElement(element) === getDocument(element).body; 36621 element = resolveElement(state); 36622 if (!element) return settle(); 36623 } 36624 if (restoreFocus) focused = false; 36625 else if (!stillOwnsFocus(element)) return settle(); 36626 const focusWithheld = focus && startedOnComposite && entersClosedPopup(state, element); 36627 if (focusWithheld) { 36628 const { activeId } = state; 36629 if (activeId != null && activeId !== resolvedId) return settle(); 36630 } 36631 if (focus && !focused && !focusWithheld) { 36632 focused = true; 36633 consume(); 36634 focusLeftElement = false; 36635 const itemElement = element; 36636 removeFocusListeners?.(); 36637 const onBlur = () => { 36638 focusLeftElement = !unmountingItems.has(itemElement); 36639 }; 36640 const onFocus = () => { 36641 focusLeftElement = false; 36642 }; 36643 itemElement.addEventListener("blur", onBlur); 36644 itemElement.addEventListener("focus", onFocus); 36645 removeFocusListeners = () => { 36646 itemElement.removeEventListener("blur", onBlur); 36647 itemElement.removeEventListener("focus", onFocus); 36648 }; 36649 withCompositeScrollPreserved(store, () => { 36650 itemElement.focus({ preventScroll: true }); 36651 }); 36652 if (done) return; 36653 } 36654 if (markedOnly && !element.hasAttribute("data-autofocus")) { 36655 if (focusWithheld) return; 36656 return settle(); 36657 } 36658 if (!isVisible(element)) return; 36659 if ("unstable_placing" in state && state.unstable_placing) return; 36660 if (!focusWithheld) settle(); 36661 if (scrollIntoView) { 36662 scrollIntoView(element); 36663 return; 36664 } 36665 element.scrollIntoView({ 36666 block: "nearest", 36667 inline: "nearest" 36668 }); 36669 }; 36670 unsubscribe = subscribe(store, [ 36671 "activeId", 36672 "items", 36673 "mounted", 36674 "open", 36675 "unstable_placing" 36676 ], present); 36677 present(); 36678 return Object.assign(cancel, { settle }); 36679 } 36680 function usePresentItem(store) { 36681 const cancelRef = (0, import_react52.useRef)(null); 36682 const ownerRef = (0, import_react52.useRef)(store); 36683 const cancel = (0, import_react52.useCallback)(() => { 36684 cancelRef.current?.(); 36685 cancelRef.current = null; 36686 }, []); 36687 const present = (0, import_react52.useCallback)((params) => { 36688 if (!store) return; 36689 if (ownerRef.current !== store) return; 36690 cancelRef.current?.settle(); 36691 cancelRef.current = null; 36692 const cancelCurrent = presentItem({ 36693 store, 36694 ...params 36695 }); 36696 cancelRef.current = cancelCurrent; 36697 return cancelCurrent; 36698 }, [store]); 36699 useSafeLayoutEffect(() => { 36700 ownerRef.current = store; 36701 return () => { 36702 ownerRef.current = void 0; 36703 cancel(); 36704 }; 36705 }, [store, cancel]); 36706 return present; 36707 } 36708 function getEnabledItem(store, id) { 36709 if (!id) return null; 36710 return store.item(id) || null; 36711 } 36712 function selectTextField(element, collapseToEnd = false) { 36713 if (isTextField(element)) element.setSelectionRange(collapseToEnd ? element.value.length : 0, element.value.length); 36714 else if (element.isContentEditable) { 36715 const selection = getDocument(element).getSelection(); 36716 selection?.selectAllChildren(element); 36717 if (collapseToEnd) selection?.collapseToEnd(); 36718 } 36719 } 36720 var FOCUS_SILENTLY = /* @__PURE__ */ Symbol("FOCUS_SILENTLY"); 36721 function focusSilently(element) { 36722 element[FOCUS_SILENTLY] = true; 36723 element.focus({ preventScroll: true }); 36724 } 36725 function silentlyFocused(element) { 36726 const isSilentlyFocused = element[FOCUS_SILENTLY]; 36727 delete element[FOCUS_SILENTLY]; 36728 return isSilentlyFocused; 36729 } 36730 function isItem(store, element, exclude) { 36731 if (!element) return false; 36732 if (element === exclude) return false; 36733 const item = store.item(element.id); 36734 if (!item) return false; 36735 if (exclude && item.element === exclude) return false; 36736 return true; 36737 } 36738 36739 // node_modules/@ariakit/react-components/dist/composite/composite-item.js 36740 var import_react53 = __toESM(require_react(), 1); 36741 var import_jsx_runtime143 = __toESM(require_jsx_runtime(), 1); 36742 36743 // node_modules/@ariakit/react-store/dist/index.js 36744 var React146 = __toESM(require_react(), 1); 36745 var import_shim3 = __toESM(require_shim(), 1); 36746 var noopSubscribe = () => () => { 36747 }; 36748 function isStoreKeyArray(value) { 36749 return Array.isArray(value); 36750 } 36751 function isSameValue2(value, other) { 36752 return value === other || value !== value && other !== other; 36753 } 36754 function hasSameStoreKeys(keys, otherKeys) { 36755 if (keys?.length !== otherKeys.length) return false; 36756 for (let index2 = 0; index2 < keys.length; index2 += 1) { 36757 const key = keys[index2]; 36758 if (isSameValue2(key, otherKeys[index2])) continue; 36759 return false; 36760 } 36761 return true; 36762 } 36763 function useStableStoreKeys(keys) { 36764 const [stableKeys, setStableKeys] = React146.useState(() => keys === null ? null : [...keys]); 36765 if (keys === null) { 36766 if (stableKeys !== null) setStableKeys(null); 36767 return null; 36768 } 36769 if (hasSameStoreKeys(stableKeys, keys)) return stableKeys; 36770 const nextKeys = [...keys]; 36771 setStableKeys(nextKeys); 36772 return nextKeys; 36773 } 36774 function useStoreState(store, keyOrKeysOrSelector = identity, selector2) { 36775 const subscriptionKeys = useStableStoreKeys(isStoreKeyArray(keyOrKeysOrSelector) ? keyOrKeysOrSelector : typeof keyOrKeysOrSelector === "function" ? null : [keyOrKeysOrSelector]); 36776 const storeSubscribe = React146.useCallback((callback) => { 36777 if (!store) return noopSubscribe(); 36778 if (subscriptionKeys?.length === 0) return noopSubscribe(); 36779 return subscribe(store, subscriptionKeys, callback); 36780 }, [store, subscriptionKeys]); 36781 const getSnapshot = () => { 36782 const state = store?.getState(); 36783 if (isStoreKeyArray(keyOrKeysOrSelector)) return selector2?.(state); 36784 if (typeof keyOrKeysOrSelector === "function") return keyOrKeysOrSelector(state); 36785 if (!state) return; 36786 if (!hasOwnProperty(state, keyOrKeysOrSelector)) return; 36787 return state[keyOrKeysOrSelector]; 36788 }; 36789 return (0, import_shim3.useSyncExternalStore)(storeSubscribe, getSnapshot, getSnapshot); 36790 } 36791 function getStoreStateObjectKeys(object, selectorKeys) { 36792 const keys = []; 36793 let hasSelector = false; 36794 for (const prop in object) { 36795 const keyOrSelector = object[prop]; 36796 if (keyOrSelector === void 0) continue; 36797 if (typeof keyOrSelector === "function") { 36798 hasSelector = true; 36799 continue; 36800 } 36801 if (keys.includes(keyOrSelector)) continue; 36802 keys.push(keyOrSelector); 36803 } 36804 if (!hasSelector) return keys; 36805 if (!selectorKeys) return null; 36806 for (const key of selectorKeys) { 36807 if (keys.includes(key)) continue; 36808 keys.push(key); 36809 } 36810 return keys; 36811 } 36812 function useStoreStateObject(store, objectOrKeys, object) { 36813 const stateObject = isStoreKeyArray(objectOrKeys) ? object ?? {} : objectOrKeys; 36814 const selectorKeys = isStoreKeyArray(objectOrKeys) ? objectOrKeys : void 0; 36815 const objRef = React146.useRef({}); 36816 const subscriptionKeys = useStableStoreKeys(getStoreStateObjectKeys(stateObject, selectorKeys)); 36817 const storeSubscribe = React146.useCallback((callback) => { 36818 if (!store) return noopSubscribe(); 36819 if (subscriptionKeys?.length === 0) return noopSubscribe(); 36820 return subscribe(store, subscriptionKeys, callback); 36821 }, [store, subscriptionKeys]); 36822 const getSnapshot = () => { 36823 const state = store?.getState(); 36824 let updated = false; 36825 const obj = objRef.current; 36826 for (const prop in stateObject) { 36827 const keyOrSelector = stateObject[prop]; 36828 if (keyOrSelector === void 0) continue; 36829 if (typeof keyOrSelector === "function") { 36830 const value2 = keyOrSelector(state); 36831 if (!Object.is(value2, obj[prop])) { 36832 obj[prop] = value2; 36833 updated = true; 36834 } 36835 } 36836 if (typeof keyOrSelector === "function") continue; 36837 const value = state && hasOwnProperty(state, keyOrSelector) ? state[keyOrSelector] : void 0; 36838 if (!Object.is(value, obj[prop])) { 36839 obj[prop] = value; 36840 updated = true; 36841 } 36842 } 36843 if (updated) objRef.current = { ...obj }; 36844 return objRef.current; 36845 }; 36846 return (0, import_shim3.useSyncExternalStore)(storeSubscribe, getSnapshot, getSnapshot); 36847 } 36848 function useStoreProps(store, props, key, setKey) { 36849 const value = hasOwnProperty(props, key) ? props[key] : void 0; 36850 const setValue = setKey ? props[setKey] : void 0; 36851 const hasSetValue = !!setValue; 36852 const propsRef = useLiveRef({ 36853 value, 36854 setValue 36855 }); 36856 useSafeLayoutEffect(() => { 36857 if (!hasSetValue) return; 36858 return subscribe(store, [key], (state, prev) => { 36859 const { value: value2, setValue: setValue2 } = propsRef.current; 36860 if (!setValue2) return; 36861 if (isSameValue2(state[key], prev[key])) return; 36862 if (isSameValue2(state[key], value2)) return; 36863 setValue2(state[key]); 36864 }); 36865 }, [ 36866 store, 36867 key, 36868 hasSetValue, 36869 propsRef 36870 ]); 36871 useSafeLayoutEffect(() => { 36872 if (value === void 0) return; 36873 store.setState(key, value); 36874 return batch(store, [key], () => { 36875 if (value === void 0) return; 36876 store.setState(key, value); 36877 }); 36878 }); 36879 } 36880 function useStore2(createStore2, props) { 36881 const [store, setStore] = React146.useState(() => createStore2(props)); 36882 useSafeLayoutEffect(() => init(store), [store]); 36883 const useState58 = React146.useCallback((keyOrSelector) => useStoreState(store, keyOrSelector), [store]); 36884 return [React146.useMemo(() => ({ 36885 ...store, 36886 useState: useState58 36887 }), [store, useState58]), useEvent(() => { 36888 setStore((store2) => createStore2({ 36889 ...props, 36890 ...store2.getState() 36891 })); 36892 })]; 36893 } 36894 36895 // node_modules/@ariakit/react-components/dist/composite/composite-item.js 36896 var TagName4 = "button"; 36897 function isEditableElement(element) { 36898 if (isTextbox(element)) return true; 36899 return element.tagName === "INPUT" && !isButton(element); 36900 } 36901 function getNextPageOffset(scrollingElement, pageUp = false) { 36902 const height = scrollingElement.clientHeight; 36903 const { top } = scrollingElement.getBoundingClientRect(); 36904 const pageSize = Math.max(height * 0.875, height - 40) * 1.5; 36905 const pageOffset = pageUp ? height - pageSize + top : pageSize + top; 36906 if (scrollingElement.tagName === "HTML") return pageOffset + scrollingElement.scrollTop; 36907 return pageOffset; 36908 } 36909 function getItemOffset(itemElement, pageUp = false) { 36910 const { top } = itemElement.getBoundingClientRect(); 36911 if (pageUp) return top + itemElement.clientHeight; 36912 return top; 36913 } 36914 function findNextPageItemId(element, store, next, pageUp = false) { 36915 if (!store) return; 36916 if (!next) return; 36917 const { renderedItems } = store.getState(); 36918 const scrollingElement = getScrollingElement(element); 36919 if (!scrollingElement) return; 36920 const nextPageOffset = getNextPageOffset(scrollingElement, pageUp); 36921 let id; 36922 let prevDifference; 36923 for (let i = 0; i < renderedItems.length; i += 1) { 36924 const previousId = id; 36925 id = next(i); 36926 if (!id) break; 36927 if (id === previousId) continue; 36928 const itemElement = getEnabledItem(store, id)?.element; 36929 if (!itemElement) continue; 36930 const difference = getItemOffset(itemElement, pageUp) - nextPageOffset; 36931 const absDifference = Math.abs(difference); 36932 if (pageUp && difference <= 0 || !pageUp && difference >= 0) { 36933 if (prevDifference !== void 0 && prevDifference < absDifference) id = previousId; 36934 break; 36935 } 36936 prevDifference = absDifference; 36937 } 36938 return id; 36939 } 36940 function targetIsAnotherItem(event, store) { 36941 if (isSelfTarget(event)) return false; 36942 return isItem(store, event.target); 36943 } 36944 var useCompositeItem2 = createHook(function useCompositeItem3({ store, rowId: rowIdProp, preventScrollOnKeyDown = false, moveOnKeyPress = true, tabbable: tabbable2 = false, getItem: getItemProp, typeaheadText, "aria-setsize": ariaSetSizeProp, "aria-posinset": ariaPosInSetProp, unstable_scrollIntoView: scrollIntoView, ...props }) { 36945 const context = useCompositeScopedContext(); 36946 store = store || context; 36947 const accessibleWhenDisabled = accessibleWhenDisabledFromProps(props); 36948 const id = useId7(props.id); 36949 const ref = (0, import_react53.useRef)(null); 36950 const mountedElementRef = (0, import_react53.useRef)(null); 36951 const markUnmountingRef = (0, import_react53.useCallback)((element) => { 36952 const mountedElement = mountedElementRef.current; 36953 if (!element && mountedElement) markItemUnmounting(mountedElement); 36954 if (element) markItemMounted(element); 36955 mountedElementRef.current = element; 36956 }, []); 36957 const row = (0, import_react53.useContext)(CompositeRowContext); 36958 const disabled2 = disabledFromProps(props); 36959 const trulyDisabled = disabled2 && !accessibleWhenDisabled; 36960 const inactiveDisabled = disabled2 && props.focusable === false; 36961 const shouldRegisterItem = props.shouldRegisterItem; 36962 const getRowId = (state) => { 36963 if (rowIdProp) return rowIdProp; 36964 if (!state) return; 36965 if (!row?.compositeElement) return; 36966 if (row.compositeElement !== state.compositeElement) return; 36967 return row.id; 36968 }; 36969 const { rowId, compositeElement, ariaSetSize, ariaPosInSet } = useStoreStateObject(store, ["compositeElement", "renderedItems"], { 36970 rowId: getRowId, 36971 compositeElement(state) { 36972 return state?.compositeElement || void 0; 36973 }, 36974 ariaSetSize(state) { 36975 if (ariaSetSizeProp != null) return ariaSetSizeProp; 36976 if (!state) return; 36977 if (!row?.ariaSetSize) return; 36978 if (row.compositeElement !== state.compositeElement) return; 36979 return row.ariaSetSize; 36980 }, 36981 ariaPosInSet(state) { 36982 if (ariaPosInSetProp != null) return ariaPosInSetProp; 36983 if (!state) return; 36984 if (!row?.ariaPosInSet) return; 36985 if (row.compositeElement !== state.compositeElement) return; 36986 const rowId2 = getRowId(state); 36987 const itemsInRow = state.renderedItems.filter((item) => item.rowId === rowId2); 36988 return row.ariaPosInSet + itemsInRow.findIndex((item) => item.id === id); 36989 } 36990 }); 36991 const { isActiveItem, isTabbable: isTabbable2 } = useStoreStateObject(store, [ 36992 "activeId", 36993 "compositeElement", 36994 "renderedItems", 36995 "virtualFocus", 36996 "items" 36997 ], { 36998 isActiveItem(state) { 36999 return !!state && state.activeId === id; 37000 }, 37001 isTabbable(state) { 37002 if (!state) return true; 37003 if (!state.compositeElement && !state.renderedItems.length) return true; 37004 if (state.virtualFocus) return false; 37005 if (!state.renderedItems.length) return true; 37006 if (tabbable2) return true; 37007 if (state.activeId === null) return false; 37008 const item = store?.item(state.activeId); 37009 if (item?.disabled) return true; 37010 if (!item?.element) return true; 37011 return state.activeId === id; 37012 } 37013 }); 37014 const getItem = (0, import_react53.useCallback)((item) => { 37015 const itemDisabled = (item.element ? resolvedTrulyDisabledFromElement(item.element) : void 0) ?? (inactiveDisabled || trulyDisabled); 37016 const nextItem = { 37017 ...item, 37018 id: id || item.id, 37019 rowId, 37020 disabled: itemDisabled, 37021 children: item.element?.textContent, 37022 typeaheadText 37023 }; 37024 if (getItemProp) return getItemProp(nextItem); 37025 return nextItem; 37026 }, [ 37027 id, 37028 rowId, 37029 inactiveDisabled, 37030 trulyDisabled, 37031 typeaheadText, 37032 getItemProp 37033 ]); 37034 const onFocusProp = props.onFocus; 37035 const hasFocusedComposite = (0, import_react53.useRef)(false); 37036 const cancelScheduledFocusRedirectRef = (0, import_react53.useRef)(null); 37037 const present = usePresentItem(store); 37038 const onFocus = useEvent((event) => { 37039 onFocusProp?.(event); 37040 if (event.defaultPrevented) return; 37041 if (isPortalEvent(event)) return; 37042 if (!id) return; 37043 if (!store) return; 37044 if (targetIsAnotherItem(event, store)) return; 37045 const { virtualFocus, compositeElement: compositeElement2 } = store.getState(); 37046 store.setActiveId(id); 37047 if (isTextbox(event.currentTarget)) selectTextField(event.currentTarget); 37048 if (!virtualFocus) { 37049 if (isSelfTarget(event) && store.item(id)) present({ 37050 id, 37051 markedOnly: true, 37052 requireFocus: true, 37053 scrollIntoView 37054 }); 37055 return; 37056 } 37057 if (!isSelfTarget(event)) return; 37058 if (isEditableElement(event.currentTarget)) return; 37059 const redirectFocusToCompositeElement = (relatedTarget2, compositeElement3) => { 37060 if (!isFocusable(compositeElement3)) { 37061 if (true) warnOnce("A composite widget with `virtualFocus` enabled requires a focusable composite element. Set the `focusable` prop to `true` or the `virtualFocus` option to `false`.", compositeElement3); 37062 return; 37063 } 37064 const fromComposite = relatedTarget2 === compositeElement3 || isItem(store, relatedTarget2); 37065 if (store.item(id)) present({ 37066 id, 37067 markedOnly: true, 37068 requireFocus: true, 37069 scrollIntoView 37070 }); 37071 hasFocusedComposite.current = true; 37072 if (fromComposite) focusSilently(compositeElement3); 37073 else compositeElement3.focus({ preventScroll: true }); 37074 }; 37075 if (compositeElement2?.isConnected) { 37076 redirectFocusToCompositeElement(event.relatedTarget, compositeElement2); 37077 return; 37078 } 37079 if (shouldRegisterItem === false) return; 37080 const { currentTarget, relatedTarget } = event; 37081 const cancelScheduledFocusRedirect = () => { 37082 cancelScheduledFocusRedirectRef.current?.(); 37083 cancelScheduledFocusRedirectRef.current = null; 37084 }; 37085 cancelScheduledFocusRedirect(); 37086 cancelScheduledFocusRedirectRef.current = subscribe(store, null, () => { 37087 if (getActiveElement(currentTarget) !== currentTarget) { 37088 cancelScheduledFocusRedirect(); 37089 return; 37090 } 37091 const state = store.getState(); 37092 const nextCompositeElement = state.compositeElement; 37093 if (!nextCompositeElement?.isConnected) return; 37094 cancelScheduledFocusRedirect(); 37095 if (!state.virtualFocus) return; 37096 redirectFocusToCompositeElement(relatedTarget, nextCompositeElement); 37097 }); 37098 }); 37099 const onBlurCaptureProp = props.onBlurCapture; 37100 const onBlurCapture = useEvent((event) => { 37101 onBlurCaptureProp?.(event); 37102 if (event.defaultPrevented) return; 37103 if (store?.getState()?.virtualFocus && hasFocusedComposite.current) { 37104 hasFocusedComposite.current = false; 37105 event.preventDefault(); 37106 event.stopPropagation(); 37107 } 37108 }); 37109 const onKeyDownProp = props.onKeyDown; 37110 const preventScrollOnKeyDownProp = useBooleanEvent(preventScrollOnKeyDown); 37111 const moveOnKeyPressProp = useBooleanEvent(moveOnKeyPress); 37112 const onKeyDown = useEvent((event) => { 37113 onKeyDownProp?.(event); 37114 if (event.defaultPrevented) return; 37115 if (!isSelfTarget(event)) return; 37116 if (!store) return; 37117 const { currentTarget } = event; 37118 const state = store.getState(); 37119 const isGrid2 = !!store.item(id)?.rowId; 37120 const isVertical = state.orientation !== "horizontal"; 37121 const isHorizontal = state.orientation !== "vertical"; 37122 const canHomeEnd = () => { 37123 if (isGrid2) return true; 37124 if (isHorizontal) return true; 37125 if (!state.compositeElement) return true; 37126 if (!isTextField(state.compositeElement)) return true; 37127 return false; 37128 }; 37129 const action = { 37130 ArrowUp: (isGrid2 || isVertical) && store.up, 37131 ArrowRight: (isGrid2 || isHorizontal) && store.next, 37132 ArrowDown: (isGrid2 || isVertical) && store.down, 37133 ArrowLeft: (isGrid2 || isHorizontal) && store.previous, 37134 Home: () => { 37135 if (!canHomeEnd()) return; 37136 if (!isGrid2 || event.ctrlKey) return store?.first(); 37137 return store?.previous(-1); 37138 }, 37139 End: () => { 37140 if (!canHomeEnd()) return; 37141 if (!isGrid2 || event.ctrlKey) return store?.last(); 37142 return store?.next(-1); 37143 }, 37144 PageUp: () => { 37145 return findNextPageItemId(currentTarget, store, store?.up, true); 37146 }, 37147 PageDown: () => { 37148 return findNextPageItemId(currentTarget, store, store?.down); 37149 } 37150 }[event.key]; 37151 if (action) { 37152 if (isTextbox(currentTarget)) { 37153 const selection = getTextboxSelection(currentTarget); 37154 const isLeft = isHorizontal && event.key === "ArrowLeft"; 37155 const isRight = isHorizontal && event.key === "ArrowRight"; 37156 const isUp = isVertical && event.key === "ArrowUp"; 37157 const isDown = isVertical && event.key === "ArrowDown"; 37158 if (isRight || isDown) { 37159 const { length: valueLength } = getTextboxValue(currentTarget); 37160 if (selection.end !== valueLength) return; 37161 } else if ((isLeft || isUp) && selection.start !== 0) return; 37162 } 37163 const nextId = action(); 37164 if (preventScrollOnKeyDownProp(event) || nextId !== void 0) { 37165 if (!moveOnKeyPressProp(event)) return; 37166 event.preventDefault(); 37167 store.move(nextId); 37168 } 37169 } 37170 }); 37171 const providerValue = (0, import_react53.useMemo)(() => ({ 37172 id, 37173 compositeElement 37174 }), [id, compositeElement]); 37175 props = useWrapElement(props, (element) => /* @__PURE__ */ (0, import_jsx_runtime143.jsx)(CompositeItemContext.Provider, { 37176 value: providerValue, 37177 children: element 37178 }), [providerValue]); 37179 props = { 37180 "data-active-item": isActiveItem || void 0, 37181 ...props, 37182 id, 37183 ref: useMergeRefs5(ref, markUnmountingRef, props.ref), 37184 tabIndex: isTabbable2 ? props.tabIndex : -1, 37185 onFocus, 37186 onBlurCapture, 37187 onKeyDown 37188 }; 37189 props = useCommand(props); 37190 props = useCollectionItem({ 37191 store, 37192 ...props, 37193 getItem, 37194 shouldRegisterItem: id ? shouldRegisterItem : false 37195 }); 37196 return { 37197 ...props, 37198 "aria-setsize": ariaSetSize, 37199 "aria-posinset": ariaPosInSet 37200 }; 37201 }); 37202 var CompositeItem2 = memo4(forwardRef89(function CompositeItem3(props) { 37203 const htmlProps = useCompositeItem2(withDefaultButtonType(props)); 37204 return createElement3(TagName4, htmlProps); 37205 })); 37206 37207 // node_modules/@ariakit/react-components/dist/__chunks/C5dZ32Pk.js 37208 var cancelled = /* @__PURE__ */ Symbol("cancelled"); 37209 var moveRequests = /* @__PURE__ */ new WeakMap(); 37210 function getMoveRequest(store) { 37211 const key = store.item; 37212 const cached = moveRequests.get(key); 37213 if (cached) return cached; 37214 const request = { 37215 consumedBy: null, 37216 targetId: store.getState().activeId 37217 }; 37218 moveRequests.set(key, request); 37219 sync(store, ["moves", "activeId"], (state, prevState) => { 37220 if (state.moves !== prevState.moves) { 37221 request.consumedBy = null; 37222 request.targetId = state.activeId; 37223 return; 37224 } 37225 if (state.activeId !== prevState.activeId) request.targetId = cancelled; 37226 }); 37227 return request; 37228 } 37229 37230 // node_modules/@ariakit/react-components/dist/composite/composite.js 37231 var import_react54 = __toESM(require_react(), 1); 37232 var import_jsx_runtime144 = __toESM(require_jsx_runtime(), 1); 37233 var TagName5 = "div"; 37234 function isGrid(items) { 37235 return items.some((item) => !!item.rowId); 37236 } 37237 function isPrintableKey(event) { 37238 const target = event.target; 37239 if (target && !isTextField(target)) return false; 37240 return event.key.length === 1 && !event.ctrlKey && !event.metaKey; 37241 } 37242 function isModifierKey(event) { 37243 return event.key === "Shift" || event.key === "Control" || event.key === "Alt" || event.key === "Meta"; 37244 } 37245 function useKeyboardEventProxy(store, onKeyboardEvent, previousElementRef) { 37246 return useEvent((event) => { 37247 onKeyboardEvent?.(event); 37248 if (event.defaultPrevented) return; 37249 if (event.isPropagationStopped()) return; 37250 if (!isSelfTarget(event)) return; 37251 if (isModifierKey(event)) return; 37252 if (isPrintableKey(event)) return; 37253 const state = store.getState(); 37254 const activeElement2 = getEnabledItem(store, state.activeId)?.element; 37255 if (!activeElement2) return; 37256 const { view, ...eventInit } = event; 37257 if (activeElement2 !== previousElementRef?.current) activeElement2.focus({ preventScroll: true }); 37258 if (!fireKeyboardEvent(activeElement2, event.type, eventInit)) event.preventDefault(); 37259 if (event.currentTarget.contains(activeElement2)) event.stopPropagation(); 37260 }); 37261 } 37262 function findFirstEnabledItemInTheLastRow(items) { 37263 return findFirstEnabledItem2(flatten2DArray(reverseArray(groupItemsByRows2(items)))); 37264 } 37265 function mayActOnMove(store, instance) { 37266 const { consumedBy } = getMoveRequest(store); 37267 return !consumedBy || consumedBy === instance; 37268 } 37269 function consumeMove(store, instance, moves) { 37270 if (store.getState().moves !== moves) return; 37271 getMoveRequest(store).consumedBy = instance; 37272 } 37273 var CompositeFocusOnMove = memo4(function CompositeFocusOnMove2({ store, focusOnMove, previousElementRef, present, scrollIntoView }) { 37274 const moves = useStoreState(store, "moves"); 37275 const compositeElement = useStoreState(store, "compositeElement"); 37276 const instanceRef = (0, import_react54.useRef)({}); 37277 (0, import_react54.useEffect)(() => { 37278 const moveRequest = getMoveRequest(store); 37279 if (!moves) return; 37280 if (!focusOnMove) return; 37281 const instance = instanceRef.current; 37282 if (!mayActOnMove(store, instance)) return; 37283 const { activeId } = store.getState(); 37284 if (activeId == null) return; 37285 if (activeId !== moveRequest.targetId) return; 37286 return present({ 37287 id: activeId, 37288 requireFocus: ownsFocus(store), 37289 focus: true, 37290 scrollIntoView, 37291 onConsume: () => consumeMove(store, instance, moves) 37292 }); 37293 }, [ 37294 store, 37295 moves, 37296 focusOnMove, 37297 compositeElement, 37298 present, 37299 scrollIntoView 37300 ]); 37301 useSafeLayoutEffect(() => { 37302 const moveRequest = getMoveRequest(store); 37303 if (!moves) return; 37304 if (!compositeElement) return; 37305 const instance = instanceRef.current; 37306 if (!mayActOnMove(store, instance)) return; 37307 const { activeId } = store.getState(); 37308 if (!(activeId === null)) return; 37309 if (activeId !== moveRequest.targetId) return; 37310 consumeMove(store, instance, moves); 37311 const previousElement = previousElementRef.current; 37312 previousElementRef.current = null; 37313 if (previousElement) fireBlurEvent(previousElement, { relatedTarget: compositeElement }); 37314 if (!hasFocus(compositeElement)) { 37315 if (isFocusable(compositeElement)) compositeElement.scrollIntoView({ 37316 block: "nearest", 37317 inline: "nearest" 37318 }); 37319 compositeElement.focus({ preventScroll: true }); 37320 } 37321 }, [ 37322 store, 37323 moves, 37324 compositeElement, 37325 previousElementRef 37326 ]); 37327 return null; 37328 }); 37329 var useComposite = createHook(function useComposite2({ store, composite = true, focusOnMove = composite, moveOnKeyPress = true, unstable_scrollIntoView: scrollIntoView, ...props }) { 37330 const context = useCompositeProviderContext(); 37331 store = store || context; 37332 invariant(store, "Composite must receive a `store` prop or be wrapped in a CompositeProvider component."); 37333 const ref = (0, import_react54.useRef)(null); 37334 const previousElementRef = (0, import_react54.useRef)(null); 37335 const present = usePresentItem(store); 37336 const [, setCompositeElement] = useTransactionState(composite ? store.setCompositeElement : null); 37337 const virtualFocus = useStoreState(store, "virtualFocus"); 37338 const activeId = useStoreState(store, composite && virtualFocus ? ["activeId"] : [], (state) => composite && virtualFocus ? state.activeId : null); 37339 useSafeLayoutEffect(() => { 37340 if (!store) return; 37341 if (!composite) return; 37342 if (!virtualFocus) return; 37343 const previousElement = previousElementRef.current; 37344 previousElementRef.current = null; 37345 if (!previousElement) return; 37346 const relatedTarget = getEnabledItem(store, activeId)?.element || getActiveElement(previousElement); 37347 if (relatedTarget === previousElement) return; 37348 fireBlurEvent(previousElement, { relatedTarget }); 37349 }, [ 37350 store, 37351 activeId, 37352 virtualFocus, 37353 composite 37354 ]); 37355 const onKeyDownCapture = useKeyboardEventProxy(store, props.onKeyDownCapture, previousElementRef); 37356 const onKeyUpCapture = useKeyboardEventProxy(store, props.onKeyUpCapture, previousElementRef); 37357 const onFocusCaptureProp = props.onFocusCapture; 37358 const onFocusCapture = useEvent((event) => { 37359 onFocusCaptureProp?.(event); 37360 if (event.defaultPrevented) return; 37361 if (!store) return; 37362 const { virtualFocus: virtualFocus2 } = store.getState(); 37363 if (!virtualFocus2) return; 37364 const previousActiveElement = event.relatedTarget; 37365 const isSilentlyFocused = silentlyFocused(event.currentTarget); 37366 if (isSelfTarget(event) && isSilentlyFocused) { 37367 event.stopPropagation(); 37368 previousElementRef.current = previousActiveElement; 37369 } 37370 }); 37371 const onFocusProp = props.onFocus; 37372 const onFocus = useEvent((event) => { 37373 onFocusProp?.(event); 37374 if (event.defaultPrevented) return; 37375 if (!composite) return; 37376 if (!store) return; 37377 const { relatedTarget } = event; 37378 const { virtualFocus: virtualFocus2 } = store.getState(); 37379 if (virtualFocus2) { 37380 if (isSelfTarget(event) && !isItem(store, relatedTarget)) queueMicrotask(() => present({ 37381 focus: true, 37382 markedOnly: true, 37383 requireFocus: true, 37384 scrollIntoView 37385 })); 37386 } else if (isSelfTarget(event)) { 37387 if (!isItem(store, relatedTarget)) { 37388 const { activeId: activeId2 } = store.getState(); 37389 if (activeId2 != null) present({ 37390 id: activeId2, 37391 markedOnly: true, 37392 requireFocus: true, 37393 scrollIntoView 37394 }); 37395 } 37396 store.setActiveId(null); 37397 } 37398 }); 37399 const onBlurCaptureProp = props.onBlurCapture; 37400 const onBlurCapture = useEvent((event) => { 37401 onBlurCaptureProp?.(event); 37402 if (event.defaultPrevented) return; 37403 if (!store) return; 37404 const { virtualFocus: virtualFocus2, activeId: activeId2, compositeElement } = store.getState(); 37405 if (!virtualFocus2) return; 37406 if (event.currentTarget !== compositeElement) return; 37407 const activeElement2 = getEnabledItem(store, activeId2)?.element; 37408 const nextActiveElement = event.relatedTarget; 37409 const nextActiveElementIsItem = isItem(store, nextActiveElement); 37410 const previousElement = previousElementRef.current; 37411 previousElementRef.current = null; 37412 if (isSelfTarget(event) && nextActiveElementIsItem) { 37413 if (nextActiveElement === activeElement2) { 37414 if (previousElement && previousElement !== nextActiveElement) fireBlurEvent(previousElement, event); 37415 } else if (activeElement2) fireBlurEvent(activeElement2, event); 37416 else if (previousElement) fireBlurEvent(previousElement, event); 37417 event.stopPropagation(); 37418 } else if (!isItem(store, event.target) && activeElement2) fireBlurEvent(activeElement2, event); 37419 }); 37420 const onKeyDownProp = props.onKeyDown; 37421 const moveOnKeyPressProp = useBooleanEvent(moveOnKeyPress); 37422 const onKeyDown = useEvent((event) => { 37423 onKeyDownProp?.(event); 37424 if (event.nativeEvent.isComposing) return; 37425 if (event.defaultPrevented) return; 37426 if (!store) return; 37427 if (!isSelfTarget(event)) return; 37428 const { orientation, items, renderedItems, activeId: activeId2, rtl } = store.getState(); 37429 const activeItem = getEnabledItem(store, activeId2); 37430 if (activeItem?.element?.isConnected) return; 37431 const elementlessActiveItem = activeItem && activeId2 != null; 37432 const movementItems = elementlessActiveItem ? items : renderedItems; 37433 const isVertical = orientation !== "horizontal"; 37434 const isHorizontal = orientation !== "vertical"; 37435 const grid = isGrid(movementItems); 37436 if ((event.key === "ArrowLeft" || event.key === "ArrowRight" || event.key === "Home" || event.key === "End") && isTextField(event.currentTarget)) return; 37437 const up = () => { 37438 if (elementlessActiveItem) return store.up({ 37439 activeId: activeId2, 37440 renderedItems: movementItems 37441 }); 37442 if (grid) return findFirstEnabledItemInTheLastRow(renderedItems)?.id; 37443 return store?.last(); 37444 }; 37445 const right = () => { 37446 if (elementlessActiveItem) return store.next({ 37447 activeId: activeId2, 37448 renderedItems: movementItems 37449 }); 37450 return rtl ? store.last() : store.first(); 37451 }; 37452 const down = () => { 37453 if (elementlessActiveItem) return store.down({ 37454 activeId: activeId2, 37455 renderedItems: movementItems 37456 }); 37457 return store.first(); 37458 }; 37459 const left = () => { 37460 if (elementlessActiveItem) return store.previous({ 37461 activeId: activeId2, 37462 renderedItems: movementItems 37463 }); 37464 return rtl ? store.first() : store.last(); 37465 }; 37466 const action = { 37467 ArrowUp: (grid || isVertical) && up, 37468 ArrowRight: (grid || isHorizontal) && right, 37469 ArrowDown: (grid || isVertical) && down, 37470 ArrowLeft: (grid || isHorizontal) && left, 37471 Home: store.first, 37472 End: store.last, 37473 PageUp: store.first, 37474 PageDown: store.last 37475 }[event.key]; 37476 if (action) { 37477 const id = action(); 37478 if (id !== void 0) { 37479 if (!moveOnKeyPressProp(event)) return; 37480 event.preventDefault(); 37481 store.move(id); 37482 } 37483 } 37484 }); 37485 props = useWrapElement(props, (element) => /* @__PURE__ */ (0, import_jsx_runtime144.jsxs)(CompositeScopedContextProvider, { 37486 value: store, 37487 children: [element, composite && /* @__PURE__ */ (0, import_jsx_runtime144.jsx)(CompositeFocusOnMove, { 37488 store, 37489 focusOnMove, 37490 previousElementRef, 37491 present, 37492 scrollIntoView 37493 })] 37494 }), [ 37495 store, 37496 composite, 37497 focusOnMove, 37498 present 37499 ]); 37500 props = { 37501 "aria-activedescendant": useStoreState(store, composite && virtualFocus ? ["items"] : [], () => { 37502 if (!store) return; 37503 if (!composite) return; 37504 if (!virtualFocus) return; 37505 return getEnabledItem(store, activeId)?.id; 37506 }), 37507 ...props, 37508 ref: useMergeRefs5(ref, setCompositeElement, props.ref), 37509 onKeyDownCapture, 37510 onKeyUpCapture, 37511 onFocusCapture, 37512 onFocus, 37513 onBlurCapture, 37514 onKeyDown 37515 }; 37516 const focusable2 = useStoreState(store, composite && !virtualFocus ? ["activeId"] : [], (state) => composite && (virtualFocus || state.activeId === null)); 37517 props = useFocusable({ 37518 focusable: focusable2, 37519 ...props 37520 }); 37521 return props; 37522 }); 37523 var Composite6 = forwardRef89(function Composite7(props) { 37524 const htmlProps = useComposite(props); 37525 return createElement3(TagName5, htmlProps); 37526 }); 37527 37528 // node_modules/@ariakit/react-components/dist/disclosure/disclosure-context.js 37529 var ctx3 = createStoreContext(); 37530 var useDisclosureContext = ctx3.useContext; 37531 var useDisclosureScopedContext = ctx3.useScopedContext; 37532 var useDisclosureProviderContext = ctx3.useProviderContext; 37533 var DisclosureContextProvider = ctx3.ContextProvider; 37534 var DisclosureScopedContextProvider = ctx3.ScopedContextProvider; 37535 37536 // node_modules/@ariakit/react-components/dist/dialog/dialog-context.js 37537 var import_react55 = __toESM(require_react(), 1); 37538 var ctx4 = createStoreContext([DisclosureContextProvider], [DisclosureScopedContextProvider]); 37539 var useDialogContext = ctx4.useContext; 37540 var useDialogScopedContext = ctx4.useScopedContext; 37541 var useDialogProviderContext = ctx4.useProviderContext; 37542 var DialogContextProvider = ctx4.ContextProvider; 37543 var DialogScopedContextProvider = ctx4.ScopedContextProvider; 37544 var DialogHeadingContext = (0, import_react55.createContext)(void 0); 37545 var DialogDescriptionContext = (0, import_react55.createContext)(void 0); 37546 37547 // node_modules/@ariakit/react-components/dist/disclosure/disclosure-content.js 37548 var import_react56 = __toESM(require_react(), 1); 37549 var import_jsx_runtime145 = __toESM(require_jsx_runtime(), 1); 37550 var import_react_dom3 = __toESM(require_react_dom(), 1); 37551 var TagName6 = "div"; 37552 function afterTimeout(timeoutMs, cb) { 37553 const timeoutId = setTimeout(cb, timeoutMs); 37554 return () => clearTimeout(timeoutId); 37555 } 37556 function parseCSSTime(time) { 37557 const value = time?.trim() || "0s"; 37558 const multiplier = value.endsWith("ms") ? 1 : 1e3; 37559 const parsed = Number.parseFloat(value) * multiplier; 37560 return Number.isNaN(parsed) ? 0 : parsed; 37561 } 37562 function getEndTime(names, delays, durations) { 37563 const nameList = names.split(","); 37564 const delayList = delays.split(","); 37565 const durationList = durations.split(","); 37566 let endTime = 0; 37567 for (const [index2, name] of nameList.entries()) { 37568 if (name.trim() === "none") continue; 37569 const delay = parseCSSTime(delayList[index2 % delayList.length]); 37570 const duration = parseCSSTime(durationList[index2 % durationList.length]); 37571 endTime = Math.max(endTime, delay + duration); 37572 } 37573 return endTime; 37574 } 37575 function getElementEndTime(element) { 37576 const { transitionProperty, transitionDuration, transitionDelay, animationName, animationDuration, animationDelay } = getComputedStyle(element); 37577 return Math.max(getEndTime(transitionProperty, transitionDelay, transitionDuration), getEndTime(animationName, animationDelay, animationDuration)); 37578 } 37579 function isHidden(mounted, hidden, alwaysVisible) { 37580 return !alwaysVisible && hidden !== false && (!mounted || !!hidden); 37581 } 37582 var useDisclosureContent = createHook(function useDisclosureContent2({ store, alwaysVisible, unstable_otherElementRef: otherElementRef, ...props }) { 37583 const context = useDisclosureProviderContext(); 37584 store = store || context; 37585 invariant(store, "DisclosureContent must receive a `store` prop or be wrapped in a DisclosureProvider component."); 37586 const ref = (0, import_react56.useRef)(null); 37587 const id = useId7(props.id); 37588 const [transition, setTransition] = (0, import_react56.useState)(null); 37589 const { open: open2, mounted, animated, contentElement } = useStoreStateObject(store, { 37590 open: "open", 37591 mounted: "mounted", 37592 animated: "animated", 37593 contentElement: "contentElement" 37594 }); 37595 const otherElement = useStoreState(store.disclosure, "contentElement"); 37596 const hasClosedRef = (0, import_react56.useRef)(false); 37597 useSafeLayoutEffect(() => { 37598 if (!ref.current) return; 37599 store?.setContentElement(ref.current); 37600 }, [store]); 37601 useSafeLayoutEffect(() => { 37602 let previousAnimated; 37603 store?.setState("animated", (animated2) => { 37604 previousAnimated = animated2; 37605 return true; 37606 }); 37607 return () => { 37608 if (previousAnimated === void 0) return; 37609 store?.setState("animated", previousAnimated); 37610 }; 37611 }, [store]); 37612 useSafeLayoutEffect(() => { 37613 if (!animated) { 37614 if (!open2) { 37615 hasClosedRef.current = true; 37616 setTransition(null); 37617 } else if (hasClosedRef.current) { 37618 hasClosedRef.current = false; 37619 setTransition("enter"); 37620 } 37621 return; 37622 } 37623 if (!contentElement?.isConnected) { 37624 setTransition(null); 37625 return; 37626 } 37627 return afterPaint(() => { 37628 setTransition(open2 ? "enter" : mounted ? "leave" : null); 37629 }); 37630 }, [ 37631 animated, 37632 contentElement, 37633 open2, 37634 mounted 37635 ]); 37636 useSafeLayoutEffect(() => { 37637 if (!store) return; 37638 if (!animated) return; 37639 if (!transition) return; 37640 if (!contentElement) return; 37641 const stopAnimation = () => store?.setState("animating", false); 37642 const stopAnimationSync = () => (0, import_react_dom3.flushSync)(stopAnimation); 37643 if (transition === "leave" && open2) return; 37644 if (transition === "enter" && !open2) return; 37645 if (typeof animated === "number") return afterTimeout(animated, stopAnimationSync); 37646 const elements = [contentElement]; 37647 if (otherElement) elements.push(otherElement); 37648 const relatedElement = otherElementRef?.current; 37649 if (relatedElement) elements.push(relatedElement); 37650 const timeout = Math.max(...elements.map(getElementEndTime)); 37651 if (!timeout) { 37652 if (transition === "enter") store.setState("animated", false); 37653 stopAnimation(); 37654 return; 37655 } 37656 return afterTimeout(Math.max(timeout - 1e3 / 60, 0), stopAnimationSync); 37657 }, [ 37658 store, 37659 animated, 37660 contentElement, 37661 otherElement, 37662 otherElementRef, 37663 open2, 37664 transition 37665 ]); 37666 props = useWrapElement(props, (element) => /* @__PURE__ */ (0, import_jsx_runtime145.jsx)(DialogScopedContextProvider, { 37667 value: store, 37668 children: element 37669 }), [store]); 37670 const hidden = isHidden(mounted, props.hidden, alwaysVisible); 37671 const styleProp = props.style; 37672 const style = (0, import_react56.useMemo)(() => { 37673 if (hidden) return { 37674 ...styleProp, 37675 display: "none" 37676 }; 37677 return styleProp; 37678 }, [hidden, styleProp]); 37679 props = { 37680 "data-open": open2 || void 0, 37681 "data-enter": transition === "enter" || void 0, 37682 "data-leave": transition === "leave" || void 0, 37683 hidden, 37684 ...props, 37685 id, 37686 ref: useMergeRefs5(id ? store.setContentElement : null, ref, props.ref), 37687 style 37688 }; 37689 return removeUndefinedValues(props); 37690 }); 37691 var DisclosureContentImpl = forwardRef89(function DisclosureContentImpl2(props) { 37692 const htmlProps = useDisclosureContent(props); 37693 return createElement3(TagName6, htmlProps); 37694 }); 37695 var DisclosureContent = forwardRef89(function DisclosureContent2({ unmountOnHide, ...props }) { 37696 const context = useDisclosureProviderContext(); 37697 const store = props.store || context; 37698 if (useStoreState(store, ["mounted"], (state) => !unmountOnHide || state?.mounted) === false) return null; 37699 return /* @__PURE__ */ (0, import_jsx_runtime145.jsx)(DisclosureContentImpl, { ...props }); 37700 }); 37701 37702 // node_modules/@ariakit/components/dist/disclosure/disclosure-store.js 37703 function createDisclosureStore(props = {}) { 37704 const store = props.store || props.disclosure ? mergeStore(props.store, omit2(props.disclosure, ["contentElement", "disclosureElement"])) : void 0; 37705 throwOnConflictingProps(props, store); 37706 const syncState = store?.getState(); 37707 const open2 = defaultValue(props.open, syncState?.open, props.defaultOpen, false); 37708 const animated = defaultValue(props.animated, syncState?.animated, false); 37709 const initialState = { 37710 open: open2, 37711 animated, 37712 animating: !!animated && open2, 37713 mounted: open2, 37714 contentElement: defaultValue(syncState?.contentElement, null), 37715 disclosureElement: defaultValue(syncState?.disclosureElement, null) 37716 }; 37717 const disclosure = store ? createStore(initialState, store) : createStore(initialState); 37718 setup(disclosure, () => sync(disclosure, ["animated", "animating"], (state) => { 37719 if (state.animated) return; 37720 disclosure.setState("animating", false); 37721 })); 37722 setup(disclosure, () => subscribe(disclosure, ["open"], () => { 37723 if (!disclosure.getState().animated) return; 37724 disclosure.setState("animating", true); 37725 })); 37726 setup(disclosure, () => sync(disclosure, ["open", "animating"], (state) => { 37727 disclosure.setState("mounted", state.open || state.animating); 37728 })); 37729 return { 37730 ...disclosure, 37731 disclosure: props.disclosure, 37732 setOpen: (value) => disclosure.setState("open", value), 37733 show: () => disclosure.setState("open", true), 37734 hide: () => disclosure.setState("open", false), 37735 toggle: () => disclosure.setState("open", (open3) => !open3), 37736 stopAnimation: () => disclosure.setState("animating", false), 37737 setContentElement: (value) => disclosure.setState("contentElement", value), 37738 setDisclosureElement: (value) => disclosure.setState("disclosureElement", value) 37739 }; 37740 } 37741 37742 // node_modules/@ariakit/react-components/dist/disclosure/disclosure-store.js 37743 function useDisclosureStoreProps(store, update2, props) { 37744 useUpdateEffect(update2, [ 37745 props.store, 37746 props.disclosure, 37747 update2 37748 ]); 37749 useStoreProps(store, props, "open", "setOpen"); 37750 useStoreProps(store, props, "mounted", "setMounted"); 37751 useStoreProps(store, props, "animated"); 37752 return Object.assign(store, { disclosure: props.disclosure }); 37753 } 37754 37755 // node_modules/@ariakit/react-components/dist/popover/popover-context.js 37756 var ctx5 = createStoreContext([DialogContextProvider], [DialogScopedContextProvider]); 37757 var usePopoverContext = ctx5.useContext; 37758 var usePopoverScopedContext = ctx5.useScopedContext; 37759 var usePopoverProviderContext = ctx5.useProviderContext; 37760 var PopoverContextProvider = ctx5.ContextProvider; 37761 var PopoverScopedContextProvider = ctx5.ScopedContextProvider; 37762 37763 // node_modules/@ariakit/react-components/dist/combobox/combobox-context.js 37764 var import_react57 = __toESM(require_react(), 1); 37765 var ComboboxListRoleContext = (0, import_react57.createContext)(null); 37766 var ctx6 = createStoreContext([PopoverContextProvider, CompositeContextProvider], [PopoverScopedContextProvider, CompositeScopedContextProvider]); 37767 var useComboboxContext = ctx6.useContext; 37768 var useComboboxScopedContext = ctx6.useScopedContext; 37769 var useComboboxProviderContext = ctx6.useProviderContext; 37770 var ComboboxContextProvider = ctx6.ContextProvider; 37771 var ComboboxScopedContextProvider = ctx6.ScopedContextProvider; 37772 var ComboboxItemValueContext = (0, import_react57.createContext)(void 0); 37773 var ComboboxItemCheckedContext = (0, import_react57.createContext)(false); 37774 var ComboboxHeadingContext = (0, import_react57.createContext)(null); 37775 37776 // node_modules/@ariakit/react-components/dist/collection/collection-store.js 37777 function useCollectionStoreProps(store, update2, props) { 37778 useUpdateEffect(update2, [props.store, update2]); 37779 useStoreProps(store, props, "items", "setItems"); 37780 return store; 37781 } 37782 37783 // node_modules/@ariakit/react-components/dist/composite/composite-store.js 37784 function useCompositeStoreOptions(props) { 37785 return { 37786 id: useId7(props.id), 37787 ...props 37788 }; 37789 } 37790 function useCompositeStoreProps(store, update2, props) { 37791 store = useCollectionStoreProps(store, update2, props); 37792 getMoveRequest(store); 37793 useStoreProps(store, props, "activeId", "setActiveId"); 37794 const focusOrderProps = { compositeElementInFocusOrder: props.compositeElementInFocusOrder ?? props.includesBaseElement }; 37795 useStoreProps(store, focusOrderProps, "compositeElementInFocusOrder"); 37796 useStoreProps(store, props, "virtualFocus"); 37797 useStoreProps(store, props, "orientation"); 37798 useStoreProps(store, props, "rtl"); 37799 useStoreProps(store, props, "focusLoop"); 37800 useStoreProps(store, props, "focusWrap"); 37801 useStoreProps(store, props, "focusShift"); 37802 return store; 37803 } 37804 37805 // node_modules/@ariakit/components/dist/dialog/dialog-store.js 37806 function createDialogStore(props = {}) { 37807 return createDisclosureStore(props); 37808 } 37809 37810 // node_modules/@ariakit/react-components/dist/dialog/dialog-store.js 37811 function useDialogStoreProps(store, update2, props) { 37812 return useDisclosureStoreProps(store, update2, props); 37813 } 37814 37815 // node_modules/@ariakit/components/dist/popover/popover-store.js 37816 function createPopoverStore({ popover: otherPopover, ...props } = {}) { 37817 const store = mergeStore(props.store, omit2(otherPopover, [ 37818 "arrowElement", 37819 "anchorElement", 37820 "contentElement", 37821 "popoverElement", 37822 "disclosureElement", 37823 "unstable_placing" 37824 ])); 37825 throwOnConflictingProps(props, store); 37826 const syncState = store?.getState(); 37827 const dialog = createDialogStore({ 37828 ...props, 37829 store 37830 }); 37831 const placement = defaultValue(props.placement, syncState?.placement, "bottom"); 37832 const initialState = { 37833 ...dialog.getState(), 37834 placement, 37835 currentPlacement: placement, 37836 anchorElement: defaultValue(syncState?.anchorElement, null), 37837 popoverElement: defaultValue(syncState?.popoverElement, null), 37838 arrowElement: defaultValue(syncState?.arrowElement, null), 37839 rendered: /* @__PURE__ */ Symbol("rendered"), 37840 unstable_placing: false 37841 }; 37842 const popover = createStore(initialState, dialog, store); 37843 let syncedAnchorElement = initialState.anchorElement === initialState.disclosureElement ? initialState.anchorElement : null; 37844 setup(popover, () => sync(popover, ["anchorElement", "disclosureElement"], (state) => { 37845 if (state.anchorElement && state.anchorElement !== syncedAnchorElement) { 37846 syncedAnchorElement = null; 37847 return; 37848 } 37849 syncedAnchorElement = state.disclosureElement; 37850 popover.setState("anchorElement", syncedAnchorElement); 37851 })); 37852 return { 37853 ...dialog, 37854 ...popover, 37855 setAnchorElement: (element) => popover.setState("anchorElement", element), 37856 setPopoverElement: (element) => popover.setState("popoverElement", element), 37857 setArrowElement: (element) => popover.setState("arrowElement", element), 37858 render: () => popover.setState("rendered", /* @__PURE__ */ Symbol("rendered")) 37859 }; 37860 } 37861 37862 // node_modules/@ariakit/react-components/dist/popover/popover-store.js 37863 function usePopoverStoreProps(store, update2, props) { 37864 useUpdateEffect(update2, [props.popover, update2]); 37865 useStoreProps(store, props, "placement"); 37866 return useDialogStoreProps(store, update2, props); 37867 } 37868 37869 // node_modules/@ariakit/react-components/dist/composite/composite-hover.js 37870 var import_react58 = __toESM(require_react(), 1); 37871 var TagName7 = "div"; 37872 function hoveringInside(event) { 37873 const nextElement = event.relatedTarget; 37874 if (!isElement2(nextElement)) return false; 37875 return contains2(event.currentTarget, nextElement); 37876 } 37877 var symbol2 = /* @__PURE__ */ Symbol("composite-hover"); 37878 function movingToAnotherItem(event) { 37879 const { relatedTarget } = event; 37880 if (!isElement2(relatedTarget)) return false; 37881 let dest = relatedTarget; 37882 do { 37883 if (hasOwnProperty(dest, symbol2) && dest[symbol2]) return true; 37884 dest = dest.parentElement; 37885 } while (dest); 37886 return false; 37887 } 37888 var useCompositeHover = createHook(function useCompositeHover2({ store, focusOnHover = true, blurOnHoverEnd = !!focusOnHover, ...props }) { 37889 const context = useCompositeScopedContext(); 37890 store = store || context; 37891 invariant(store, "CompositeHover must be wrapped in a Composite component."); 37892 const isMouseMoving = useIsMouseMoving(); 37893 const onMouseMoveProp = props.onMouseMove; 37894 const focusOnHoverProp = useBooleanEvent(focusOnHover); 37895 const onMouseMove = useEvent((event) => { 37896 onMouseMoveProp?.(event); 37897 if (event.defaultPrevented) return; 37898 if (!isMouseMoving()) return; 37899 if (!focusOnHoverProp(event)) return; 37900 if (!hasFocusWithin(event.currentTarget)) { 37901 const compositeElement = store?.getState().compositeElement; 37902 if (compositeElement && !hasFocus(compositeElement)) compositeElement.focus({ preventScroll: true }); 37903 } 37904 store?.setActiveId(event.currentTarget.id); 37905 }); 37906 const onMouseLeaveProp = props.onMouseLeave; 37907 const blurOnHoverEndProp = useBooleanEvent(blurOnHoverEnd); 37908 const onMouseLeave = useEvent((event) => { 37909 onMouseLeaveProp?.(event); 37910 if (event.defaultPrevented) return; 37911 if (!isMouseMoving()) return; 37912 if (hoveringInside(event)) return; 37913 if (movingToAnotherItem(event)) return; 37914 if (!focusOnHoverProp(event)) return; 37915 if (!blurOnHoverEndProp(event)) return; 37916 store?.setActiveId(null); 37917 store?.getState().compositeElement?.focus({ preventScroll: true }); 37918 }); 37919 const ref = (0, import_react58.useCallback)((element) => { 37920 if (!element) return; 37921 element[symbol2] = true; 37922 }, []); 37923 props = { 37924 ...props, 37925 ref: useMergeRefs5(ref, props.ref), 37926 onMouseMove, 37927 onMouseLeave 37928 }; 37929 return props; 37930 }); 37931 var CompositeHover = memo4(forwardRef89(function CompositeHover2(props) { 37932 const htmlProps = useCompositeHover(props); 37933 return createElement3(TagName7, htmlProps); 37934 })); 37935 37936 // node_modules/@ariakit/react-components/dist/__chunks/DAieEu03.js 37937 var openingMovesByStore = /* @__PURE__ */ new WeakMap(); 37938 var scrollItemIntoViewByStore = /* @__PURE__ */ new WeakMap(); 37939 function scrollIntoViewNearest(element) { 37940 element.scrollIntoView({ 37941 block: "nearest", 37942 inline: "nearest" 37943 }); 37944 } 37945 function getSingleVerticalScrollport(element, popup) { 37946 const view = getWindow2(element); 37947 if (!view.getComputedStyle(popup).writingMode.startsWith("horizontal")) return null; 37948 let scrollport = null; 37949 let inlineScrollport = null; 37950 let current = element.parentElement; 37951 while (current && popup.contains(current)) { 37952 const style = view.getComputedStyle(current); 37953 if (style.overflowY !== "visible" && style.overflowY !== "clip" && current.scrollHeight > current.clientHeight) { 37954 if (scrollport) return null; 37955 scrollport = current; 37956 } 37957 if (style.overflowX !== "visible" && style.overflowX !== "clip" && current.scrollWidth > current.clientWidth) { 37958 if (inlineScrollport) return null; 37959 inlineScrollport = current; 37960 } 37961 if (current === popup) break; 37962 current = current.parentElement; 37963 } 37964 if (inlineScrollport && inlineScrollport !== scrollport) return null; 37965 return scrollport; 37966 } 37967 function centerItemInScrollport(element, scrollport) { 37968 const elementRect = element.getBoundingClientRect(); 37969 const scrollportRect = scrollport.getBoundingClientRect(); 37970 const scaleX = scrollportRect.width / scrollport.offsetWidth || 1; 37971 const scrollportLeft = scrollportRect.left + scrollport.clientLeft * scaleX; 37972 const scrollportRight = scrollportLeft + scrollport.clientWidth * scaleX; 37973 const scrollportWidth = scrollport.clientWidth * scaleX; 37974 const elementLeftOutside = elementRect.left < scrollportLeft; 37975 const elementRightOutside = elementRect.right > scrollportRight; 37976 const alignLeft = elementLeftOutside && !elementRightOutside && elementRect.width < scrollportWidth || elementRightOutside && !elementLeftOutside && elementRect.width > scrollportWidth; 37977 const alignRight = elementLeftOutside && !elementRightOutside && elementRect.width > scrollportWidth || elementRightOutside && !elementLeftOutside && elementRect.width < scrollportWidth; 37978 let left = 0; 37979 if (alignLeft) left = (elementRect.left - scrollportLeft) / scaleX; 37980 else if (alignRight) left = (elementRect.right - scrollportRight) / scaleX; 37981 const scaleY = scrollportRect.height / scrollport.offsetHeight || 1; 37982 const top = (elementRect.top + elementRect.height / 2 - (scrollportRect.top + (scrollport.clientTop + scrollport.clientHeight / 2) * scaleY)) / scaleY; 37983 scrollport.scrollBy({ 37984 left, 37985 top 37986 }); 37987 } 37988 function getScrollItemIntoView(store) { 37989 if (!store) return scrollIntoViewNearest; 37990 const cached = scrollItemIntoViewByStore.get(store); 37991 if (cached) return cached; 37992 const scrollItemIntoView = (element) => { 37993 const { contentElement, moves, selectElement } = store.getState(); 37994 if (!selectElement) return scrollIntoViewNearest(element); 37995 if (moves !== openingMovesByStore.get(store)) return scrollIntoViewNearest(element); 37996 if (!contentElement?.contains(element)) return scrollIntoViewNearest(element); 37997 const scrollport = getSingleVerticalScrollport(element, contentElement); 37998 if (!scrollport) return scrollIntoViewNearest(element); 37999 centerItemInScrollport(element, scrollport); 38000 }; 38001 scrollItemIntoViewByStore.set(store, scrollItemIntoView); 38002 return scrollItemIntoView; 38003 } 38004 38005 // node_modules/@ariakit/react-components/dist/combobox/combobox.js 38006 var import_react59 = __toESM(require_react(), 1); 38007 var import_jsx_runtime146 = __toESM(require_jsx_runtime(), 1); 38008 var TagName8 = "input"; 38009 function isFirstItemAutoSelected(items, activeValue, autoSelect) { 38010 if (!autoSelect) return false; 38011 return items.find((item) => !item.disabled && item.value)?.value === activeValue; 38012 } 38013 function hasCompletionString(value, activeValue) { 38014 if (!activeValue) return false; 38015 if (value == null) return false; 38016 const normalizedValue = normalizeString(value); 38017 const normalizedActiveValue = normalizeString(activeValue); 38018 if (normalizedValue.length !== value.length) return false; 38019 if (normalizedActiveValue.length !== activeValue.length) return false; 38020 return normalizedActiveValue.length > normalizedValue.length && normalizedActiveValue.toLowerCase().startsWith(normalizedValue.toLowerCase()); 38021 } 38022 function isAriaAutoCompleteValue(value) { 38023 return value === "inline" || value === "list" || value === "both" || value === "none"; 38024 } 38025 function getDefaultAutoSelectId(items) { 38026 return items.find((item) => { 38027 if (item.disabled) return false; 38028 return item.element?.getAttribute("role") !== "tab"; 38029 })?.id; 38030 } 38031 var useCombobox = createHook(function useCombobox2({ store, focusable: focusable2 = true, autoSelect: autoSelectProp = false, getAutoSelectId, setValueOnChange, showMinLength = 0, showOnChange, showOnMouseDown, showOnClick = showOnMouseDown, showOnKeyDown, showOnKeyPress = showOnKeyDown, blurActiveItemOnClick, setValueOnClick = true, moveOnKeyPress = true, autoComplete = "list", name, form, disabled: disabled2, ...props }) { 38032 const scopedContext = useComboboxScopedContext(true); 38033 const context = useComboboxProviderContext(); 38034 store = store || context || scopedContext; 38035 invariant(store, "Combobox must receive a `store` prop or be wrapped in a ComboboxProvider component."); 38036 const ref = (0, import_react59.useRef)(null); 38037 const [valueUpdated, forceValueUpdate] = useForceUpdate(); 38038 const canAutoSelectRef = (0, import_react59.useRef)(false); 38039 const composingRef = (0, import_react59.useRef)(false); 38040 const compositionEndFrameRef = (0, import_react59.useRef)(null); 38041 const cancelCompositionEndFrame = () => { 38042 const frame = compositionEndFrameRef.current; 38043 if (frame == null) return; 38044 cancelAnimationFrame(frame); 38045 compositionEndFrameRef.current = null; 38046 }; 38047 const autoSelect = useStoreState(store, ["virtualFocus"], (state) => state.virtualFocus && autoSelectProp); 38048 const inline4 = autoComplete === "inline" || autoComplete === "both"; 38049 const [canInline, setCanInline] = (0, import_react59.useState)(inline4); 38050 useUpdateLayoutEffect(() => { 38051 if (!inline4) return; 38052 setCanInline(true); 38053 }, [inline4]); 38054 const storeInputValue = useStoreState(store, "inputValue"); 38055 const selectedValue = useStoreState(store, ["selectedValue"], (state) => { 38056 if (!name) return; 38057 if (!Array.isArray(state.selectedValue)) return; 38058 return state.selectedValue; 38059 }); 38060 const multiSelectable = Array.isArray(selectedValue); 38061 const prevSelectedValueRef = (0, import_react59.useRef)(void 0); 38062 (0, import_react59.useEffect)(() => { 38063 return sync(store, ["selectedValue", "activeId"], (_, prev) => { 38064 prevSelectedValueRef.current = prev.selectedValue; 38065 }); 38066 }, [store]); 38067 const inlineActiveValue = useStoreState(store, [ 38068 "activeValue", 38069 "selectedValue", 38070 "activeId" 38071 ], (state) => { 38072 if (!inline4) return; 38073 if (!canInline) return; 38074 if (state.activeValue && Array.isArray(state.selectedValue)) { 38075 if (state.selectedValue.includes(state.activeValue)) return; 38076 if (prevSelectedValueRef.current?.includes(state.activeValue)) return; 38077 } 38078 return state.activeValue; 38079 }); 38080 const items = useStoreState(store, "renderedItems"); 38081 const open2 = useStoreState(store, "open"); 38082 const contentElement = useStoreState(store, "contentElement"); 38083 const placing = useStoreState(store, "unstable_placing"); 38084 const firstItemAutoSelected = isFirstItemAutoSelected(items, inlineActiveValue, autoSelect); 38085 const inputValue = (0, import_react59.useMemo)(() => { 38086 if (!inline4) return storeInputValue; 38087 if (!canInline) return storeInputValue; 38088 if (firstItemAutoSelected) { 38089 if (hasCompletionString(storeInputValue, inlineActiveValue)) { 38090 const slice = inlineActiveValue?.slice(storeInputValue.length) || ""; 38091 return storeInputValue + slice; 38092 } 38093 return storeInputValue; 38094 } 38095 return inlineActiveValue || storeInputValue; 38096 }, [ 38097 inline4, 38098 canInline, 38099 firstItemAutoSelected, 38100 inlineActiveValue, 38101 storeInputValue 38102 ]); 38103 (0, import_react59.useEffect)(() => { 38104 const element = ref.current; 38105 if (!element) return; 38106 const onCompositeItemMove = () => setCanInline(true); 38107 element.addEventListener("combobox-item-move", onCompositeItemMove); 38108 return () => { 38109 element.removeEventListener("combobox-item-move", onCompositeItemMove); 38110 }; 38111 }, []); 38112 (0, import_react59.useEffect)(() => { 38113 if (!inline4) return; 38114 if (!canInline) return; 38115 if (!inlineActiveValue) return; 38116 if (!firstItemAutoSelected) return; 38117 if (!hasCompletionString(storeInputValue, inlineActiveValue)) return; 38118 let cleanup = noop5; 38119 queueMicrotask(() => { 38120 const element = ref.current; 38121 if (!element) return; 38122 const { start: prevStart, end: prevEnd } = getTextboxSelection(element); 38123 const nextStart = storeInputValue.length; 38124 const nextEnd = inlineActiveValue.length; 38125 setSelectionRange(element, nextStart, nextEnd); 38126 cleanup = () => { 38127 if (!hasFocus(element)) return; 38128 const { start, end } = getTextboxSelection(element); 38129 if (start !== nextStart) return; 38130 if (end !== nextEnd) return; 38131 setSelectionRange(element, prevStart, prevEnd); 38132 }; 38133 }); 38134 return () => cleanup(); 38135 }, [ 38136 valueUpdated, 38137 inline4, 38138 canInline, 38139 inlineActiveValue, 38140 firstItemAutoSelected, 38141 storeInputValue 38142 ]); 38143 const getAutoSelectIdProp = useEvent(getAutoSelectId); 38144 const autoSelectIdRef = (0, import_react59.useRef)(null); 38145 const autoSelectMovedRef = (0, import_react59.useRef)(void 0); 38146 const userScrolledRef = (0, import_react59.useRef)(false); 38147 const isAutoScrollingRef = (0, import_react59.useRef)(false); 38148 (0, import_react59.useEffect)(() => { 38149 if (!open2) return; 38150 if (!contentElement) return; 38151 const scrollingElement = getScrollingElement(contentElement); 38152 if (!scrollingElement) return; 38153 const onUserScroll = () => { 38154 canAutoSelectRef.current = false; 38155 userScrolledRef.current = true; 38156 }; 38157 const onScroll = () => { 38158 if (!isAutoScrollingRef.current) userScrolledRef.current = true; 38159 if (!store) return; 38160 if (!canAutoSelectRef.current) return; 38161 const { activeId } = store.getState(); 38162 if (activeId === null) return; 38163 if (activeId === autoSelectIdRef.current) return; 38164 canAutoSelectRef.current = false; 38165 }; 38166 const options = { 38167 passive: true, 38168 capture: true 38169 }; 38170 scrollingElement.addEventListener("wheel", onUserScroll, options); 38171 scrollingElement.addEventListener("touchmove", onUserScroll, options); 38172 scrollingElement.addEventListener("scroll", onScroll, options); 38173 return () => { 38174 scrollingElement.removeEventListener("wheel", onUserScroll, true); 38175 scrollingElement.removeEventListener("touchmove", onUserScroll, true); 38176 scrollingElement.removeEventListener("scroll", onScroll, true); 38177 }; 38178 }, [ 38179 open2, 38180 contentElement, 38181 store 38182 ]); 38183 useSafeLayoutEffect(() => { 38184 userScrolledRef.current = false; 38185 if (!storeInputValue) return; 38186 if (composingRef.current) return; 38187 canAutoSelectRef.current = true; 38188 }, [storeInputValue]); 38189 useSafeLayoutEffect(() => { 38190 if (autoSelect !== "always" && open2) return; 38191 canAutoSelectRef.current = open2; 38192 }, [autoSelect, open2]); 38193 useSafeLayoutEffect(() => { 38194 if (open2) return; 38195 autoSelectMovedRef.current = void 0; 38196 }, [open2]); 38197 const resetValueOnSelect = useStoreState(store, "resetValueOnSelect"); 38198 useUpdateEffect(() => { 38199 const canAutoSelect = canAutoSelectRef.current; 38200 if (!store) return; 38201 if (!open2) return; 38202 if (composingRef.current) return; 38203 if (!canAutoSelect && (!resetValueOnSelect || userScrolledRef.current)) return; 38204 const state = store.getState(); 38205 const { compositeElement: compositeElement2, activeId, selectElement, selectedValue: selectedValue2 } = state; 38206 if (compositeElement2 && !hasFocus(compositeElement2)) return; 38207 if (state.unstable_placing) return; 38208 const activeValue = store.item(activeId)?.value; 38209 const activeValueSelected = activeValue != null && (Array.isArray(selectedValue2) ? selectedValue2.includes(activeValue) : selectedValue2 === activeValue); 38210 if (autoSelect && canAutoSelect && !(!!selectElement && !storeInputValue && activeValueSelected)) { 38211 const userAutoSelectId = getAutoSelectIdProp(items); 38212 const autoSelectId = userAutoSelectId !== void 0 ? userAutoSelectId : getDefaultAutoSelectId(items) ?? store.first(); 38213 autoSelectIdRef.current = autoSelectId; 38214 const nextActiveId = autoSelectId ?? null; 38215 const nextActiveValue = store.item(nextActiveId)?.value; 38216 const moved = autoSelectMovedRef.current; 38217 if (nextActiveId !== activeId || moved?.id !== nextActiveId || moved?.value !== nextActiveValue) { 38218 autoSelectMovedRef.current = { 38219 id: nextActiveId, 38220 value: nextActiveValue 38221 }; 38222 store.move(nextActiveId); 38223 } else store.setState("activeValue", nextActiveValue); 38224 } else { 38225 const element = store.item(activeId || store.first())?.element; 38226 if (element && "scrollIntoView" in element) { 38227 isAutoScrollingRef.current = true; 38228 element.scrollIntoView({ 38229 block: "nearest", 38230 inline: "nearest" 38231 }); 38232 requestAnimationFrame(() => { 38233 isAutoScrollingRef.current = false; 38234 }); 38235 } 38236 } 38237 }, [ 38238 store, 38239 open2, 38240 placing, 38241 valueUpdated, 38242 storeInputValue, 38243 autoSelect, 38244 resetValueOnSelect, 38245 getAutoSelectIdProp, 38246 items 38247 ]); 38248 (0, import_react59.useEffect)(() => { 38249 if (!inline4) return; 38250 const combobox = ref.current; 38251 if (!combobox) return; 38252 const elements = [combobox, contentElement].filter((value) => !!value); 38253 const onBlur2 = (event) => { 38254 if (elements.every((el) => isFocusEventOutside(event, el))) store?.setInputValue(inputValue); 38255 }; 38256 for (const element of elements) element.addEventListener("focusout", onBlur2); 38257 return () => { 38258 for (const element of elements) element.removeEventListener("focusout", onBlur2); 38259 }; 38260 }, [ 38261 inline4, 38262 contentElement, 38263 store, 38264 inputValue 38265 ]); 38266 const canShow = (event) => { 38267 return event.currentTarget.value.length >= showMinLength; 38268 }; 38269 const onChangeProp = props.onChange; 38270 const showOnChangeProp = useBooleanEvent(showOnChange ?? canShow); 38271 const setValueOnChangeProp = useBooleanEvent(setValueOnChange ?? !store.tag); 38272 const onChange = useEvent((event) => { 38273 onChangeProp?.(event); 38274 if (event.defaultPrevented) return; 38275 if (!store) return; 38276 const currentTarget = event.currentTarget; 38277 const { value, selectionStart, selectionEnd } = currentTarget; 38278 const nativeEvent = event.nativeEvent; 38279 canAutoSelectRef.current = true; 38280 if (isInputEvent(nativeEvent)) { 38281 if (nativeEvent.isComposing) { 38282 canAutoSelectRef.current = false; 38283 composingRef.current = true; 38284 } 38285 if (inline4) { 38286 const textInserted = nativeEvent.inputType === "insertText" || nativeEvent.inputType === "insertCompositionText"; 38287 const caretAtEnd = selectionStart === value.length; 38288 setCanInline(textInserted && caretAtEnd); 38289 } 38290 } 38291 if (setValueOnChangeProp(event)) { 38292 const isSameValue3 = value === store.getState().inputValue; 38293 store.setInputValue(value); 38294 queueMicrotask(() => { 38295 setSelectionRange(currentTarget, selectionStart, selectionEnd); 38296 }); 38297 if (inline4 && autoSelect && isSameValue3) forceValueUpdate(); 38298 } 38299 if (showOnChangeProp(event)) store.show(); 38300 if (!autoSelect || !canAutoSelectRef.current) store.setActiveId(null); 38301 }); 38302 (0, import_react59.useEffect)(() => cancelCompositionEndFrame, []); 38303 const onCompositionStartProp = props.onCompositionStart; 38304 const onCompositionStart = useEvent((event) => { 38305 cancelCompositionEndFrame(); 38306 canAutoSelectRef.current = false; 38307 composingRef.current = true; 38308 onCompositionStartProp?.(event); 38309 }); 38310 const onCompositionEndProp = props.onCompositionEnd; 38311 const onCompositionEnd = useEvent((event) => { 38312 canAutoSelectRef.current = true; 38313 composingRef.current = false; 38314 onCompositionEndProp?.(event); 38315 if (event.defaultPrevented) return; 38316 if (!autoSelect) return; 38317 cancelCompositionEndFrame(); 38318 compositionEndFrameRef.current = requestAnimationFrame(() => { 38319 compositionEndFrameRef.current = null; 38320 if (composingRef.current) return; 38321 forceValueUpdate(); 38322 }); 38323 }); 38324 const onMouseDownProp = props.onMouseDown; 38325 const blurActiveItemOnClickProp = useBooleanEvent(blurActiveItemOnClick ?? (() => store.getState().compositeElementInFocusOrder)); 38326 const setValueOnClickProp = useBooleanEvent(setValueOnClick); 38327 const showOnClickProp = useBooleanEvent(showOnClick ?? canShow); 38328 const onMouseDown = useEvent((event) => { 38329 onMouseDownProp?.(event); 38330 if (event.defaultPrevented) return; 38331 if (event.button) return; 38332 if (event.ctrlKey) return; 38333 if (!store) return; 38334 if (blurActiveItemOnClickProp(event)) store.setActiveId(null); 38335 if (setValueOnClickProp(event)) store.setInputValue(inputValue); 38336 if (showOnClickProp(event)) queueBeforeEvent(event.currentTarget, "mouseup", store.show); 38337 }); 38338 const onKeyDownProp = props.onKeyDown; 38339 const showOnKeyPressProp = useBooleanEvent(showOnKeyPress ?? canShow); 38340 const onKeyDown = useEvent((event) => { 38341 onKeyDownProp?.(event); 38342 if (!event.repeat) canAutoSelectRef.current = false; 38343 if (event.defaultPrevented) return; 38344 if (!store) return; 38345 const { open: open3 } = store.getState(); 38346 if (open3 && event.key === "Enter") { 38347 event.preventDefault(); 38348 return; 38349 } 38350 if (event.ctrlKey) return; 38351 if (event.altKey) return; 38352 if (event.shiftKey) return; 38353 if (event.metaKey) return; 38354 if (open3) return; 38355 if (event.key === "ArrowUp" || event.key === "ArrowDown") { 38356 if (showOnKeyPressProp(event)) { 38357 event.preventDefault(); 38358 store.show(); 38359 } 38360 } 38361 }); 38362 const onBlurProp = props.onBlur; 38363 const onBlur = useEvent((event) => { 38364 canAutoSelectRef.current = false; 38365 onBlurProp?.(event); 38366 }); 38367 const id = useId7(props.id); 38368 const ariaAutoComplete = isAriaAutoCompleteValue(autoComplete) ? autoComplete : void 0; 38369 const isActiveItem = useStoreState(store, ["activeId"], (state) => state.activeId === null); 38370 const formDisabled = disabledFromProps({ 38371 disabled: disabled2, 38372 "aria-disabled": props["aria-disabled"] 38373 }); 38374 const composite = props.composite !== false; 38375 const [, setCompositeElement] = useTransactionState(composite ? null : store.setCompositeElement); 38376 const compositeElement = useStoreState(store, multiSelectable ? ["compositeElement"] : [], (state) => multiSelectable ? state.compositeElement : null); 38377 props = useWrapElement(props, (element) => { 38378 if (!name) return element; 38379 if (!Array.isArray(selectedValue)) return element; 38380 if (composite && !compositeElement) return element; 38381 return /* @__PURE__ */ (0, import_jsx_runtime146.jsxs)(import_jsx_runtime146.Fragment, { children: [element, selectedValue.map((value, index2) => /* @__PURE__ */ (0, import_jsx_runtime146.jsx)("input", { 38382 type: "hidden", 38383 name, 38384 form, 38385 disabled: formDisabled, 38386 value 38387 }, index2))] }); 38388 }, [ 38389 name, 38390 form, 38391 formDisabled, 38392 composite, 38393 compositeElement, 38394 selectedValue 38395 ]); 38396 props = { 38397 role: "combobox", 38398 "aria-autocomplete": ariaAutoComplete, 38399 "aria-haspopup": getPopupRole(contentElement, "listbox"), 38400 "aria-expanded": open2, 38401 "aria-controls": contentElement?.id, 38402 "data-active-item": isActiveItem || void 0, 38403 value: inputValue, 38404 ...props, 38405 id, 38406 name: multiSelectable ? void 0 : name, 38407 form, 38408 disabled: disabled2, 38409 ref: useMergeRefs5(ref, store.setInputElement, composite ? void 0 : setCompositeElement, props.ref), 38410 onChange, 38411 onCompositionStart, 38412 onCompositionEnd, 38413 onMouseDown, 38414 onKeyDown, 38415 onBlur 38416 }; 38417 const scrollItemIntoView = getScrollItemIntoView(store); 38418 props = useComposite({ 38419 store, 38420 unstable_scrollIntoView: scrollItemIntoView, 38421 focusable: focusable2, 38422 ...props, 38423 moveOnKeyPress: (event) => { 38424 if (isFalsyBooleanCallback(moveOnKeyPress, event)) return false; 38425 if (inline4) setCanInline(true); 38426 return true; 38427 } 38428 }); 38429 return { 38430 autoComplete: "off", 38431 ...props 38432 }; 38433 }); 38434 var Combobox = forwardRef89(function Combobox2(props) { 38435 const htmlProps = useCombobox(props); 38436 return createElement3(TagName8, htmlProps); 38437 }); 38438 38439 // node_modules/@ariakit/react-components/dist/combobox/combobox-item.js 38440 var import_react60 = __toESM(require_react(), 1); 38441 var import_jsx_runtime147 = __toESM(require_jsx_runtime(), 1); 38442 var TagName9 = "div"; 38443 function isSelected(storeValue, itemValue) { 38444 if (itemValue == null) return; 38445 if (storeValue == null) return false; 38446 if (Array.isArray(storeValue)) return storeValue.includes(itemValue); 38447 return storeValue === itemValue; 38448 } 38449 function getItemRole(popupRole) { 38450 return getItemRoleByPopupRole(popupRole) ?? "option"; 38451 } 38452 var useComboboxItem = createHook(function useComboboxItem2({ store, value, hideOnClick, setValueOnClick, selectValueOnClick = true, resetValueOnSelect, focusOnHover, moveOnKeyPress = true, preventScrollOnKeyDown, getItem: getItemProp, ...props }) { 38453 const context = useComboboxScopedContext(); 38454 store = store || context; 38455 invariant(store, "ComboboxItem must be wrapped in a ComboboxList or ComboboxPopover component."); 38456 const id = useId7(props.id); 38457 const listRole = (0, import_react60.useContext)(ComboboxListRoleContext); 38458 const listRoleMatchesStore = listRole?.store === store; 38459 const { resetValueOnSelectState, multiSelectable, selected, autoFocusSelected, selectElement, contentElement } = useStoreStateObject(store, ["selectedValue"], { 38460 resetValueOnSelectState: "resetValueOnSelect", 38461 multiSelectable(state) { 38462 return Array.isArray(state.selectedValue); 38463 }, 38464 selected(state) { 38465 return isSelected(state.selectedValue, value); 38466 }, 38467 autoFocusSelected(state) { 38468 if (value == null) return false; 38469 if (!Array.isArray(state.selectedValue)) return state.selectedValue === value; 38470 return state.selectedValue[state.selectedValue.length - 1] === value; 38471 }, 38472 selectElement: "selectElement", 38473 contentElement: "contentElement" 38474 }); 38475 const autoFocusSelectedItem = !!selectElement; 38476 const selectMode = !!selectElement; 38477 const disabled2 = disabledFromProps(props); 38478 const getItem = (0, import_react60.useCallback)((item) => { 38479 const nextItem = { 38480 ...item, 38481 value: selectMode && disabled2 ? void 0 : value 38482 }; 38483 if (getItemProp) return getItemProp(nextItem); 38484 return nextItem; 38485 }, [ 38486 selectMode, 38487 disabled2, 38488 value, 38489 getItemProp 38490 ]); 38491 setValueOnClick = setValueOnClick ?? (!selectMode && !multiSelectable); 38492 hideOnClick = hideOnClick ?? (value != null && !multiSelectable); 38493 preventScrollOnKeyDown = preventScrollOnKeyDown ?? selectMode; 38494 const popupRole = listRoleMatchesStore ? listRole?.role : getPopupRole(contentElement); 38495 const role = getItemRole(typeof popupRole === "string" ? popupRole : void 0); 38496 const onClickProp = props.onClick; 38497 const setValueOnClickProp = useBooleanEvent(setValueOnClick); 38498 const selectValueOnClickProp = useBooleanEvent(selectValueOnClick); 38499 const resetValueOnSelectProp = useBooleanEvent(resetValueOnSelect ?? resetValueOnSelectState); 38500 const hideOnClickProp = useBooleanEvent(hideOnClick); 38501 const onClick = useEvent((event) => { 38502 onClickProp?.(event); 38503 if (event.defaultPrevented) return; 38504 if (isDownloading(event)) return; 38505 if (isOpeningInNewTab(event)) return; 38506 if (value != null) { 38507 if (selectValueOnClickProp(event)) { 38508 if (resetValueOnSelectProp(event)) store?.resetInputValue(); 38509 store?.setSelectedValue((prevValue) => { 38510 if (!Array.isArray(prevValue)) return value; 38511 if (prevValue.includes(value)) return prevValue.filter((v2) => v2 !== value); 38512 return [...prevValue, value]; 38513 }); 38514 } 38515 if (setValueOnClickProp(event)) store?.setInputValue(value); 38516 } 38517 if (hideOnClickProp(event)) store?.hide(); 38518 }); 38519 const onKeyDownProp = props.onKeyDown; 38520 const onKeyDown = useEvent((event) => { 38521 onKeyDownProp?.(event); 38522 if (event.defaultPrevented) return; 38523 const compositeElement = store?.getState().compositeElement; 38524 if (!compositeElement) return; 38525 if (hasFocus(compositeElement)) return; 38526 const printable = event.key.length === 1 && !event.ctrlKey && !event.metaKey; 38527 const paste = (!isApple() ? event.ctrlKey : event.metaKey) && event.key.toLowerCase() === "v"; 38528 const deleteKey = event.key === "Backspace" || event.key === "Delete"; 38529 if (printable || paste || deleteKey) { 38530 if (compositeElement === selectElement) return; 38531 if (isTextField(compositeElement)) { 38532 queueMicrotask(() => compositeElement.focus()); 38533 store?.setInputValue(compositeElement.value); 38534 return; 38535 } 38536 compositeElement.focus(); 38537 if ("value" in compositeElement && typeof compositeElement.value === "string") store?.setInputValue(compositeElement.value); 38538 } 38539 }); 38540 if ((selectMode || multiSelectable) && selected != null) props = { 38541 "aria-selected": selected, 38542 ...props 38543 }; 38544 props = useWrapElement(props, (element) => /* @__PURE__ */ (0, import_jsx_runtime147.jsx)(ComboboxItemValueContext.Provider, { 38545 value, 38546 children: /* @__PURE__ */ (0, import_jsx_runtime147.jsx)(ComboboxItemCheckedContext.Provider, { 38547 value: selected ?? false, 38548 children: element 38549 }) 38550 }), [value, selected]); 38551 const defaultAutoFocus = autoFocusSelectedItem ? autoFocusSelected : void 0; 38552 props = { 38553 role, 38554 children: value, 38555 ...props, 38556 id, 38557 onClick, 38558 onKeyDown 38559 }; 38560 if (props.autoFocus === void 0 && defaultAutoFocus !== void 0) { 38561 props.autoFocus = false; 38562 props["data-autofocus"] = defaultAutoFocus || void 0; 38563 } 38564 const moveOnKeyPressProp = useBooleanEvent(moveOnKeyPress); 38565 const scrollItemIntoView = getScrollItemIntoView(store); 38566 props = useCompositeItem2({ 38567 store, 38568 unstable_scrollIntoView: scrollItemIntoView, 38569 ...props, 38570 getItem, 38571 preventScrollOnKeyDown, 38572 moveOnKeyPress: (event) => { 38573 if (!moveOnKeyPressProp(event)) return false; 38574 const moveEvent = new Event("combobox-item-move"); 38575 store?.getState().compositeElement?.dispatchEvent(moveEvent); 38576 return true; 38577 } 38578 }); 38579 const focusOnHoverProp = useBooleanEvent(focusOnHover ?? selectMode); 38580 props = useCompositeHover({ 38581 store, 38582 ...props, 38583 focusOnHover(event) { 38584 if (!store.getState().open) return false; 38585 if (!focusOnHoverProp(event)) return false; 38586 return store.getState().open; 38587 } 38588 }); 38589 return props; 38590 }); 38591 var ComboboxItem = memo4(forwardRef89(function ComboboxItem2(props) { 38592 const htmlProps = useComboboxItem(props); 38593 return createElement3(TagName9, htmlProps); 38594 })); 38595 38596 // node_modules/@ariakit/react-components/dist/combobox/combobox-item-value.js 38597 var import_react61 = __toESM(require_react(), 1); 38598 var import_jsx_runtime148 = __toESM(require_jsx_runtime(), 1); 38599 var TagName10 = "span"; 38600 function normalizeValue(value) { 38601 return normalizeString(value).toLowerCase(); 38602 } 38603 function getOffsets(string, values) { 38604 const offsets = []; 38605 for (const value of values) { 38606 if (!value) continue; 38607 let pos = 0; 38608 const length = value.length; 38609 let index2 = string.indexOf(value, pos); 38610 while (index2 !== -1) { 38611 offsets.push([index2, length]); 38612 pos = index2 + 1; 38613 index2 = string.indexOf(value, pos); 38614 } 38615 } 38616 return offsets; 38617 } 38618 function mergeOverlappingOffsets(offsets) { 38619 offsets.sort(([a], [b]) => a - b); 38620 const merged = []; 38621 for (const [offset4, length] of offsets) { 38622 const last = merged[merged.length - 1]; 38623 if (last && offset4 < last[0] + last[1]) last[1] = Math.max(last[1], offset4 + length - last[0]); 38624 else merged.push([offset4, length]); 38625 } 38626 return merged; 38627 } 38628 function getNormalizedIndexes(itemValue) { 38629 const starts = []; 38630 const ends = []; 38631 let index2 = 0; 38632 for (const char of itemValue) { 38633 const normalizedLength = normalizeValue(char).length; 38634 for (let i = 0; i < normalizedLength; i += 1) { 38635 starts.push(i === 0 ? index2 : -1); 38636 ends.push(index2); 38637 } 38638 index2 += char.length; 38639 } 38640 starts.push(itemValue.length); 38641 ends.push(itemValue.length); 38642 let nextBoundary = itemValue.length; 38643 for (let i = starts.length - 1; i >= 0; i -= 1) { 38644 const start = starts[i]; 38645 if (start == null) continue; 38646 if (start === -1) starts[i] = nextBoundary; 38647 else nextBoundary = start; 38648 } 38649 return { 38650 starts, 38651 ends 38652 }; 38653 } 38654 function toOriginalOffsets(itemValue, normalizedOffsets) { 38655 if (!normalizedOffsets.length) return normalizedOffsets; 38656 const { starts, ends } = getNormalizedIndexes(itemValue); 38657 const offsets = []; 38658 for (const [normalizedOffset, normalizedLength] of normalizedOffsets) { 38659 const start = starts[normalizedOffset]; 38660 const end = ends[normalizedOffset + normalizedLength]; 38661 if (start == null || end == null) continue; 38662 if (end <= start) continue; 38663 offsets.push([start, end - start]); 38664 } 38665 return offsets; 38666 } 38667 function splitValue(itemValue, userValue) { 38668 if (!itemValue) return itemValue; 38669 if (!userValue) return itemValue; 38670 const userValues = toArray(userValue).map(normalizeValue); 38671 const parts = []; 38672 const span = (value, autocomplete = false) => /* @__PURE__ */ (0, import_jsx_runtime148.jsx)("span", { 38673 "data-autocomplete-value": autocomplete ? "" : void 0, 38674 "data-user-value": autocomplete ? void 0 : "", 38675 children: value 38676 }, parts.length); 38677 const offsets = toOriginalOffsets(itemValue, mergeOverlappingOffsets(getOffsets(normalizeValue(itemValue), new Set(userValues)))); 38678 const firstEntry = offsets[0]; 38679 if (!firstEntry) { 38680 parts.push(span(itemValue, true)); 38681 return parts; 38682 } 38683 const [firstOffset] = firstEntry; 38684 [itemValue.slice(0, firstOffset), ...offsets.flatMap(([offset4, length], i) => { 38685 const value = itemValue.slice(offset4, offset4 + length); 38686 const nextOffset = offsets[i + 1]?.[0]; 38687 return [value, itemValue.slice(offset4 + length, nextOffset)]; 38688 })].forEach((value, i) => { 38689 if (!value) return; 38690 parts.push(span(value, i % 2 === 0)); 38691 }); 38692 return parts; 38693 } 38694 var useComboboxItemValue = createHook(function useComboboxItemValue2({ store, value, userValue, ...props }) { 38695 const context = useComboboxScopedContext(); 38696 store = store || context; 38697 const itemContext = (0, import_react61.useContext)(ComboboxItemValueContext); 38698 const itemValue = value ?? itemContext; 38699 const inputValue = useStoreState(store, ["inputValue"], (state) => userValue ?? state?.inputValue); 38700 props = { 38701 children: (0, import_react61.useMemo)(() => { 38702 if (!itemValue) return; 38703 if (!inputValue) return itemValue; 38704 return splitValue(itemValue, inputValue); 38705 }, [itemValue, inputValue]), 38706 ...props 38707 }; 38708 return props; 38709 }); 38710 var ComboboxItemValue = forwardRef89(function ComboboxItemValue2(props) { 38711 const htmlProps = useComboboxItemValue(props); 38712 return createElement3(TagName10, htmlProps); 38713 }); 38714 38715 // node_modules/@ariakit/react-components/dist/combobox/combobox-label.js 38716 var TagName11 = "label"; 38717 var useComboboxLabel = createHook(function useComboboxLabel2({ store, ...props }) { 38718 const scopedContext = useComboboxScopedContext(true); 38719 const context = useComboboxProviderContext(); 38720 store = store || context || scopedContext; 38721 invariant(store, "ComboboxLabel must receive a `store` prop or be wrapped in a ComboboxProvider component."); 38722 const inputElement = useStoreState(store, "inputElement"); 38723 useAttribute(inputElement, "id"); 38724 const comboboxId = inputElement?.id; 38725 const id = useId7(props.id); 38726 props = { 38727 htmlFor: comboboxId, 38728 ...props, 38729 id, 38730 ref: useMergeRefs5(store.setLabelElement, props.ref) 38731 }; 38732 return props; 38733 }); 38734 var ComboboxLabel = memo4(forwardRef89(function ComboboxLabel2(props) { 38735 const htmlProps = useComboboxLabel(props); 38736 return createElement3(TagName11, htmlProps); 38737 })); 38738 38739 // node_modules/@ariakit/react-components/dist/combobox/combobox-list.js 38740 var import_react62 = __toESM(require_react(), 1); 38741 var import_jsx_runtime149 = __toESM(require_jsx_runtime(), 1); 38742 var TagName12 = "div"; 38743 var useComboboxList = createHook(function useComboboxList2({ store, alwaysVisible, ...props }) { 38744 const scopedContext = useComboboxScopedContext(true); 38745 const context = useComboboxContext(); 38746 store = store || context; 38747 const scopedContextSameStore = !!store && store === scopedContext; 38748 invariant(store, "ComboboxList must receive a `store` prop or be wrapped in a ComboboxProvider component."); 38749 const onFocusProp = props.onFocus; 38750 const onFocus = useEvent((event) => { 38751 onFocusProp?.(event); 38752 if (event.defaultPrevented) return; 38753 if (!isSelfTarget(event)) return; 38754 const compositeElement = store.getState().compositeElement; 38755 if (!compositeElement) return; 38756 if (!isFocusable(compositeElement)) return; 38757 const list = event.currentTarget; 38758 queueMicrotask(() => { 38759 if (getActiveElement(list) !== list) return; 38760 compositeElement.focus(); 38761 }); 38762 }); 38763 const ref = (0, import_react62.useRef)(null); 38764 const id = useId7(props.id); 38765 const mounted = useStoreState(store, "mounted"); 38766 const hidden = isHidden(mounted, props.hidden, alwaysVisible); 38767 const style = hidden ? { 38768 ...props.style, 38769 display: "none" 38770 } : props.style; 38771 const multiSelectable = useStoreState(store, ["selectedValue"], (state) => Array.isArray(state.selectedValue)); 38772 const role = useAttribute(ref, "role", props.role); 38773 const listRole = (0, import_react62.useMemo)(() => ({ 38774 store, 38775 role 38776 }), [store, role]); 38777 const ariaMultiSelectable = role === "listbox" || role === "tree" || role === "grid" ? multiSelectable || void 0 : void 0; 38778 const [hasNestedList, setHasNestedList] = (0, import_react62.useState)(false); 38779 const contentElement = useStoreState(store, "contentElement"); 38780 const parentHeadingContext = (0, import_react62.useContext)(ComboboxHeadingContext); 38781 const headingState = (0, import_react62.useState)(); 38782 const [headingId, setHeadingId] = parentHeadingContext || headingState; 38783 const headingContext = (0, import_react62.useMemo)(() => [headingId, setHeadingId], [headingId, setHeadingId]); 38784 useSafeLayoutEffect(() => { 38785 if (!mounted) return; 38786 const element = ref.current; 38787 if (!element) return; 38788 if (contentElement !== element) return; 38789 const update2 = () => { 38790 setHasNestedList(!!element.querySelector("[data-combobox-list]")); 38791 }; 38792 const observer = new MutationObserver(update2); 38793 observer.observe(element, { 38794 subtree: true, 38795 childList: true 38796 }); 38797 update2(); 38798 return () => observer.disconnect(); 38799 }, [mounted, contentElement]); 38800 if (!hasNestedList) props = { 38801 role: "listbox", 38802 "aria-multiselectable": ariaMultiSelectable, 38803 ...props 38804 }; 38805 props = useWrapElement(props, (element) => /* @__PURE__ */ (0, import_jsx_runtime149.jsx)(ComboboxScopedContextProvider, { 38806 value: store, 38807 children: /* @__PURE__ */ (0, import_jsx_runtime149.jsx)(ComboboxHeadingContext.Provider, { 38808 value: headingContext, 38809 children: /* @__PURE__ */ (0, import_jsx_runtime149.jsx)(DialogHeadingContext.Provider, { 38810 value: setHeadingId, 38811 children: /* @__PURE__ */ (0, import_jsx_runtime149.jsx)(ComboboxListRoleContext.Provider, { 38812 value: listRole, 38813 children: element 38814 }) 38815 }) 38816 }) 38817 }), [ 38818 store, 38819 listRole, 38820 headingContext 38821 ]); 38822 const setContentElement = id && (!scopedContext || !scopedContextSameStore) ? store.setContentElement : null; 38823 const labelElement = useStoreState(store, ["labelElement", "selectLabelElement"], (state) => { 38824 if (headingId) return null; 38825 return state.selectLabelElement || state.labelElement; 38826 }); 38827 useAttribute(labelElement, "id"); 38828 const labelId = headingId || labelElement?.id; 38829 props = { 38830 "data-combobox-list": "", 38831 "aria-labelledby": props["aria-label"] != null ? void 0 : labelId, 38832 hidden, 38833 ...props, 38834 id, 38835 onFocus, 38836 ref: useMergeRefs5(setContentElement, ref, props.ref), 38837 style, 38838 tabIndex: -1 38839 }; 38840 return props; 38841 }); 38842 var ComboboxList = forwardRef89(function ComboboxList2(props) { 38843 const htmlProps = useComboboxList(props); 38844 return createElement3(TagName12, htmlProps); 38845 }); 38846 38847 // node_modules/@ariakit/react-components/dist/tag/tag-context.js 38848 var import_react63 = __toESM(require_react(), 1); 38849 var TagValueContext = (0, import_react63.createContext)(null); 38850 var TagRemoveIdContext = (0, import_react63.createContext)(null); 38851 var ctx7 = createStoreContext([CompositeContextProvider], [CompositeScopedContextProvider]); 38852 var useTagContext = ctx7.useContext; 38853 var useTagScopedContext = ctx7.useScopedContext; 38854 var useTagProviderContext = ctx7.useProviderContext; 38855 var TagContextProvider = ctx7.ContextProvider; 38856 var TagScopedContextProvider = ctx7.ScopedContextProvider; 38857 38858 // node_modules/@ariakit/components/dist/combobox/combobox-store.js 38859 var isTouchSafari = isSafari() && isTouchDevice(); 38860 function createComboboxStore({ tag, ...props } = {}) { 38861 const store = mergeStore(props.store, pick2(tag, ["value", "rtl"])); 38862 const defaultInputValue = defaultValue(props.defaultInputValue, props.defaultValue); 38863 throwOnConflictingProps({ 38864 ...props, 38865 defaultInputValue, 38866 defaultValue: defaultInputValue 38867 }, store); 38868 const tagState = tag?.getState(); 38869 const syncState = store?.getState(); 38870 const activeId = defaultValue(props.activeId, syncState?.activeId, props.defaultActiveId, null); 38871 const composite = createCompositeStore({ 38872 ...props, 38873 activeId, 38874 compositeElementInFocusOrder: defaultValue(props.compositeElementInFocusOrder, props.includesBaseElement, syncState?.compositeElementInFocusOrder, syncState?.includesBaseElement, true), 38875 orientation: defaultValue(props.orientation, syncState?.orientation, "vertical"), 38876 focusLoop: defaultValue(props.focusLoop, syncState?.focusLoop, true), 38877 focusWrap: defaultValue(props.focusWrap, syncState?.focusWrap, true), 38878 virtualFocus: defaultValue(props.virtualFocus, syncState?.virtualFocus, true) 38879 }); 38880 const popover = createPopoverStore({ 38881 ...props, 38882 placement: defaultValue(props.placement, syncState?.placement, "bottom-start") 38883 }); 38884 const inputValue = defaultValue(props.inputValue, props.value, syncState?.inputValue, syncState?.value, defaultInputValue, ""); 38885 const selectedValue = defaultValue(props.selectedValue, syncState?.selectedValue, tagState?.values, props.defaultSelectedValue, ""); 38886 let shouldSetDefaultSelectedValue = props.selectedValue === void 0 && syncState?.selectedValue === void 0 && tagState?.values === void 0 && props.defaultSelectedValue === void 0; 38887 const multiSelectable = Array.isArray(selectedValue); 38888 const initialState = { 38889 ...composite.getState(), 38890 ...popover.getState(), 38891 inputValue, 38892 value: inputValue, 38893 selectedValue, 38894 resetValueOnSelect: defaultValue(props.resetValueOnSelect, syncState?.resetValueOnSelect, multiSelectable), 38895 resetValueOnHide: defaultValue(props.resetValueOnHide, syncState?.resetValueOnHide, multiSelectable && !tag), 38896 selectOnMove: defaultValue(props.selectOnMove, syncState?.selectOnMove, false), 38897 activeValue: syncState?.activeValue, 38898 inputElement: defaultValue(syncState?.inputElement, null), 38899 labelElement: defaultValue(syncState?.labelElement, null), 38900 selectElement: defaultValue(syncState?.selectElement, null), 38901 selectLabelElement: defaultValue(syncState?.selectLabelElement, null) 38902 }; 38903 const combobox = createStore(initialState, composite, popover, store); 38904 setup(combobox, () => chain(sync(combobox, ["inputValue"], (state) => { 38905 combobox.setState("value", state.inputValue); 38906 }), sync(combobox, ["value"], (state) => { 38907 combobox.setState("inputValue", state.value); 38908 }))); 38909 let resolveSelectedItemOnOpen = false; 38910 const selectDefaultOptions = /* @__PURE__ */ new Set(); 38911 if (props.focusLoop === void 0 && syncState?.focusLoop === void 0) selectDefaultOptions.add("focusLoop"); 38912 if (props.focusWrap === void 0 && syncState?.focusWrap === void 0) selectDefaultOptions.add("focusWrap"); 38913 if (props.compositeElementInFocusOrder === void 0 && props.includesBaseElement === void 0 && syncState?.compositeElementInFocusOrder === void 0 && syncState?.includesBaseElement === void 0) selectDefaultOptions.add("compositeElementInFocusOrder"); 38914 if (props.resetValueOnSelect === void 0 && syncState?.resetValueOnSelect === void 0) selectDefaultOptions.add("resetValueOnSelect"); 38915 let syncedSelectElement = initialState.compositeElement === initialState.selectElement ? initialState.selectElement : null; 38916 const initialFallback = initialState.selectElement || initialState.compositeElement || initialState.disclosureElement; 38917 let syncedAnchorElement = initialState.anchorElement === initialFallback ? initialState.anchorElement : null; 38918 setup(combobox, () => sync(combobox, ["compositeElement", "selectElement"], (state) => { 38919 if (!state.selectElement && !syncedSelectElement) return; 38920 if (state.compositeElement && state.compositeElement === state.selectElement) { 38921 syncedSelectElement = state.selectElement; 38922 return; 38923 } 38924 if (state.compositeElement && state.compositeElement !== syncedSelectElement) { 38925 syncedSelectElement = null; 38926 return; 38927 } 38928 syncedSelectElement = state.selectElement; 38929 combobox.setState("compositeElement", syncedSelectElement); 38930 })); 38931 setup(combobox, () => sync(combobox, ["selectElement"], (state) => { 38932 if (!state.selectElement) return; 38933 const { focusLoop, focusWrap, compositeElementInFocusOrder, resetValueOnSelect } = combobox.getState(); 38934 if (selectDefaultOptions.has("focusLoop")) composite.setState("focusLoop", false); 38935 if (selectDefaultOptions.has("focusWrap")) composite.setState("focusWrap", false); 38936 if (selectDefaultOptions.has("compositeElementInFocusOrder")) composite.setState("compositeElementInFocusOrder", false); 38937 if (selectDefaultOptions.has("resetValueOnSelect")) combobox.setState("resetValueOnSelect", true); 38938 return () => { 38939 const current = combobox.getState(); 38940 if (selectDefaultOptions.has("focusLoop") && !current.focusLoop) composite.setState("focusLoop", focusLoop); 38941 if (selectDefaultOptions.has("focusWrap") && !current.focusWrap) composite.setState("focusWrap", focusWrap); 38942 if (selectDefaultOptions.has("compositeElementInFocusOrder") && !current.compositeElementInFocusOrder) composite.setState("compositeElementInFocusOrder", compositeElementInFocusOrder); 38943 if (selectDefaultOptions.has("resetValueOnSelect") && current.resetValueOnSelect) combobox.setState("resetValueOnSelect", resetValueOnSelect); 38944 }; 38945 })); 38946 setup(combobox, () => sync(combobox, [ 38947 "anchorElement", 38948 "compositeElement", 38949 "disclosureElement", 38950 "selectElement" 38951 ], (state) => { 38952 if (state.anchorElement && state.anchorElement !== syncedAnchorElement) { 38953 syncedAnchorElement = null; 38954 return; 38955 } 38956 syncedAnchorElement = state.selectElement || state.compositeElement || state.disclosureElement; 38957 combobox.setState("anchorElement", syncedAnchorElement); 38958 })); 38959 setup(combobox, () => sync(combobox, [ 38960 "items", 38961 "selectedValue", 38962 "selectElement" 38963 ], (state, prevState) => { 38964 if (!shouldSetDefaultSelectedValue) return; 38965 if (state.selectedValue !== prevState.selectedValue) { 38966 shouldSetDefaultSelectedValue = false; 38967 return; 38968 } 38969 if (!state.selectElement) return; 38970 queueMicrotask(() => { 38971 if (!shouldSetDefaultSelectedValue) return; 38972 const state2 = combobox.getState(); 38973 if (!state2.selectElement) return; 38974 const item = state2.items.find((item2) => !item2.disabled && item2.value != null); 38975 if (item?.value == null) return; 38976 shouldSetDefaultSelectedValue = false; 38977 combobox.setState("selectedValue", item.value); 38978 }); 38979 })); 38980 if (isTouchSafari) setup(combobox, () => sync(combobox, ["virtualFocus"], () => { 38981 combobox.setState("virtualFocus", false); 38982 })); 38983 setup(combobox, () => { 38984 if (!tag) return; 38985 return chain(sync(combobox, ["selectedValue"], (state) => { 38986 if (!Array.isArray(state.selectedValue)) return; 38987 tag.setValues(state.selectedValue); 38988 }), sync(tag, ["values"], (state) => { 38989 combobox.setState("selectedValue", state.values); 38990 })); 38991 }); 38992 setup(combobox, () => sync(combobox, ["resetValueOnHide", "mounted"], (state) => { 38993 if (!state.resetValueOnHide) return; 38994 if (state.mounted) return; 38995 combobox.setState("inputValue", inputValue); 38996 })); 38997 setup(combobox, () => sync(combobox, ["open"], (state) => { 38998 if (state.open) { 38999 resolveSelectedItemOnOpen = true; 39000 return; 39001 } 39002 resolveSelectedItemOnOpen = false; 39003 combobox.setState("activeId", activeId); 39004 combobox.setState("moves", 0); 39005 })); 39006 setup(combobox, () => sync(combobox, ["moves", "activeId"], (state, prevState) => { 39007 if (state.moves !== prevState.moves) resolveSelectedItemOnOpen = false; 39008 if (state.activeId !== prevState.activeId) resolveSelectedItemOnOpen = false; 39009 if (state.moves === prevState.moves) combobox.setState("activeValue", void 0); 39010 })); 39011 setup(combobox, () => batch(combobox, ["moves", "renderedItems"], (state, prev) => { 39012 if (state.moves === prev.moves) return; 39013 const { activeId: activeId2 } = combobox.getState(); 39014 const activeItem = composite.item(activeId2); 39015 combobox.setState("activeValue", activeItem?.value); 39016 })); 39017 setup(combobox, () => sync(combobox, [ 39018 "items", 39019 "mounted", 39020 "open", 39021 "selectedValue", 39022 "selectElement" 39023 ], (state) => { 39024 if (!state.selectElement) return; 39025 if (state.mounted && !resolveSelectedItemOnOpen) return; 39026 const values = Array.isArray(state.selectedValue) ? state.selectedValue : [state.selectedValue]; 39027 const lastValue = values[values.length - 1]; 39028 if (lastValue == null) return; 39029 const item = state.items.find((item2) => !item2.disabled && item2.value === lastValue); 39030 if (!item) return; 39031 resolveSelectedItemOnOpen = false; 39032 combobox.setState("activeId", item.id); 39033 })); 39034 setup(combobox, () => batch(combobox, ["selectOnMove", "moves"], (state) => { 39035 const { activeId: activeId2, open: open2, selectedValue: selectedValue2, selectElement } = combobox.getState(); 39036 if (!selectElement) return; 39037 if (!state.selectOnMove && open2) return; 39038 if (Array.isArray(selectedValue2)) return; 39039 if (!state.moves) return; 39040 if (!activeId2) return; 39041 const item = composite.item(activeId2); 39042 if (!item || item.disabled || item.value == null) return; 39043 combobox.setState("selectedValue", item.value); 39044 })); 39045 const setInputValue = (value) => { 39046 combobox.setState("inputValue", value); 39047 }; 39048 const resetInputValue = () => setInputValue(initialState.inputValue); 39049 const setState = (key, value) => { 39050 selectDefaultOptions.delete(key); 39051 if (key === "includesBaseElement") selectDefaultOptions.delete("compositeElementInFocusOrder"); 39052 if (key === "selectedValue") shouldSetDefaultSelectedValue = false; 39053 combobox.setState(key, value); 39054 }; 39055 return { 39056 ...popover, 39057 ...composite, 39058 ...combobox, 39059 setState, 39060 tag, 39061 setInputValue, 39062 resetInputValue, 39063 setValue: setInputValue, 39064 resetValue: resetInputValue, 39065 setSelectedValue: (selectedValue2) => setState("selectedValue", selectedValue2), 39066 setInputElement: (element) => combobox.setState("inputElement", element), 39067 setLabelElement: (element) => combobox.setState("labelElement", element), 39068 setSelectElement: (element) => combobox.setState("selectElement", element), 39069 setSelectLabelElement: (element) => combobox.setState("selectLabelElement", element) 39070 }; 39071 } 39072 39073 // node_modules/@ariakit/react-components/dist/combobox/combobox-store.js 39074 function useComboboxStoreOptions(props) { 39075 const tag = useTagContext(); 39076 props = { 39077 ...props, 39078 tag: props.tag !== void 0 ? props.tag : tag 39079 }; 39080 return useCompositeStoreOptions(props); 39081 } 39082 function useComboboxStoreProps(store, update2, props) { 39083 useUpdateEffect(update2, [props.tag, update2]); 39084 const inputValueProps = { 39085 inputValue: props.inputValue ?? props.value, 39086 setInputValue: props.setInputValue ?? props.setValue 39087 }; 39088 useStoreProps(store, inputValueProps, "inputValue", "setInputValue"); 39089 useStoreProps(store, props, "selectedValue", "setSelectedValue"); 39090 useStoreProps(store, props, "selectOnMove"); 39091 useStoreProps(store, props, "resetValueOnHide"); 39092 useStoreProps(store, props, "resetValueOnSelect"); 39093 return Object.assign(useCompositeStoreProps(usePopoverStoreProps(store, update2, props), update2, props), { tag: props.tag }); 39094 } 39095 function useComboboxStore(props = {}) { 39096 props = useComboboxStoreOptions(props); 39097 const [store, update2] = useStore2(createComboboxStore, props); 39098 return useComboboxStoreProps(store, update2, props); 39099 } 39100 39101 // node_modules/@ariakit/react-components/dist/combobox/combobox-provider.js 39102 var import_jsx_runtime150 = __toESM(require_jsx_runtime(), 1); 39103 function ComboboxProvider(props = {}) { 39104 const store = useComboboxStore(props); 39105 return /* @__PURE__ */ (0, import_jsx_runtime150.jsx)(ComboboxContextProvider, { 39106 value: store, 39107 children: props.children 39108 }); 39109 } 39110 39111 // packages/dataviews/build-module/components/dataviews-filters/search-widget.mjs 39112 var import_remove_accents = __toESM(require_remove_accents(), 1); 39113 var import_compose12 = __toESM(require_compose(), 1); 39114 var import_i18n39 = __toESM(require_i18n(), 1); 39115 var import_element99 = __toESM(require_element(), 1); 39116 var import_components21 = __toESM(require_components(), 1); 39117 39118 // packages/dataviews/build-module/components/dataviews-filters/utils.mjs 39119 var EMPTY_ARRAY3 = []; 39120 var getCurrentValue = (filterDefinition, currentFilter) => { 39121 if (filterDefinition.singleSelection) { 39122 return currentFilter?.value; 39123 } 39124 if (Array.isArray(currentFilter?.value)) { 39125 return currentFilter.value; 39126 } 39127 if (!Array.isArray(currentFilter?.value) && !!currentFilter?.value) { 39128 return [currentFilter.value]; 39129 } 39130 return EMPTY_ARRAY3; 39131 }; 39132 39133 // packages/dataviews/build-module/hooks/use-elements.mjs 39134 var import_element98 = __toESM(require_element(), 1); 39135 var EMPTY_ARRAY4 = []; 39136 function useElements({ 39137 elements, 39138 getElements 39139 }) { 39140 const staticElements = Array.isArray(elements) && elements.length > 0 ? elements : EMPTY_ARRAY4; 39141 const [records, setRecords] = (0, import_element98.useState)(staticElements); 39142 const [isLoading, setIsLoading] = (0, import_element98.useState)(false); 39143 (0, import_element98.useEffect)(() => { 39144 if (!getElements) { 39145 setRecords(staticElements); 39146 return; 39147 } 39148 let cancelled2 = false; 39149 setIsLoading(true); 39150 getElements().then((fetchedElements) => { 39151 if (!cancelled2) { 39152 const dynamicElements = Array.isArray(fetchedElements) && fetchedElements.length > 0 ? fetchedElements : staticElements; 39153 setRecords(dynamicElements); 39154 } 39155 }).catch(() => { 39156 if (!cancelled2) { 39157 setRecords(staticElements); 39158 } 39159 }).finally(() => { 39160 if (!cancelled2) { 39161 setIsLoading(false); 39162 } 39163 }); 39164 return () => { 39165 cancelled2 = true; 39166 }; 39167 }, [getElements, staticElements]); 39168 return { 39169 elements: records, 39170 isLoading 39171 }; 39172 } 39173 39174 // packages/dataviews/build-module/components/dataviews-filters/search-widget.mjs 39175 var import_jsx_runtime151 = __toESM(require_jsx_runtime(), 1); 39176 function normalizeSearchInput(input = "") { 39177 return (0, import_remove_accents.default)(input.trim().toLowerCase()); 39178 } 39179 var getNewValue = (filterDefinition, currentFilter, value) => { 39180 if (filterDefinition.singleSelection) { 39181 return value; 39182 } 39183 if (Array.isArray(currentFilter?.value)) { 39184 return currentFilter.value.includes(value) ? currentFilter.value.filter((v2) => v2 !== value) : [...currentFilter.value, value]; 39185 } 39186 return [value]; 39187 }; 39188 function generateFilterElementCompositeItemId(prefix, filterElementValue) { 39189 return `$prefix}-$filterElementValue}`; 39190 } 39191 var MultiSelectionOption = ({ selected }) => { 39192 return /* @__PURE__ */ (0, import_jsx_runtime151.jsx)( 39193 "span", 39194 { 39195 className: clsx_default( 39196 "dataviews-filters__search-widget-listitem-multi-selection", 39197 { "is-selected": selected } 39198 ), 39199 children: selected && /* @__PURE__ */ (0, import_jsx_runtime151.jsx)(import_components21.Icon, { icon: check_default }) 39200 } 39201 ); 39202 }; 39203 var SingleSelectionOption = ({ selected }) => { 39204 return /* @__PURE__ */ (0, import_jsx_runtime151.jsx)( 39205 "span", 39206 { 39207 className: clsx_default( 39208 "dataviews-filters__search-widget-listitem-single-selection", 39209 { "is-selected": selected } 39210 ) 39211 } 39212 ); 39213 }; 39214 function ListBox({ view, filter, onChangeView }) { 39215 const baseId = (0, import_compose12.useInstanceId)(ListBox, "dataviews-filter-list-box"); 39216 const [activeCompositeId, setActiveCompositeId] = (0, import_element99.useState)( 39217 // When there are one or less operators, the first item is set as active 39218 // (by setting the initial `activeId` to `undefined`). 39219 // With 2 or more operators, the focus is moved on the operators control 39220 // (by setting the initial `activeId` to `null`), meaning that there won't 39221 // be an active item initially. Focus is then managed via the 39222 // `onFocusVisible` callback. 39223 filter.operators?.length === 1 ? void 0 : null 39224 ); 39225 const currentFilter = view.filters?.find( 39226 (f) => f.field === filter.field 39227 ); 39228 const currentValue = getCurrentValue(filter, currentFilter); 39229 return /* @__PURE__ */ (0, import_jsx_runtime151.jsx)( 39230 import_components21.Composite, 39231 { 39232 virtualFocus: true, 39233 focusLoop: true, 39234 activeId: activeCompositeId, 39235 setActiveId: setActiveCompositeId, 39236 role: "listbox", 39237 className: "dataviews-filters__search-widget-listbox", 39238 "aria-label": (0, import_i18n39.sprintf)( 39239 /* translators: List of items for a filter. 1: Filter name. e.g.: "List of: Author". */ 39240 (0, import_i18n39.__)("List of: %1$s"), 39241 filter.name 39242 ), 39243 onFocusVisible: () => { 39244 if (!activeCompositeId && filter.elements.length) { 39245 setActiveCompositeId( 39246 generateFilterElementCompositeItemId( 39247 baseId, 39248 filter.elements[0].value 39249 ) 39250 ); 39251 } 39252 }, 39253 render: /* @__PURE__ */ (0, import_jsx_runtime151.jsx)(import_components21.Composite.Typeahead, {}), 39254 children: filter.elements.map((element) => /* @__PURE__ */ (0, import_jsx_runtime151.jsxs)( 39255 import_components21.Composite.Hover, 39256 { 39257 render: /* @__PURE__ */ (0, import_jsx_runtime151.jsx)( 39258 import_components21.Composite.Item, 39259 { 39260 id: generateFilterElementCompositeItemId( 39261 baseId, 39262 element.value 39263 ), 39264 render: /* @__PURE__ */ (0, import_jsx_runtime151.jsx)( 39265 "div", 39266 { 39267 "aria-label": element.label, 39268 role: "option", 39269 className: "dataviews-filters__search-widget-listitem" 39270 } 39271 ), 39272 onClick: () => { 39273 const newFilters = currentFilter ? [ 39274 ...(view.filters ?? []).map( 39275 (_filter) => { 39276 if (_filter.field === filter.field) { 39277 return { 39278 ..._filter, 39279 operator: currentFilter.operator || filter.operators[0], 39280 value: getNewValue( 39281 filter, 39282 currentFilter, 39283 element.value 39284 ) 39285 }; 39286 } 39287 return _filter; 39288 } 39289 ) 39290 ] : [ 39291 ...view.filters ?? [], 39292 { 39293 field: filter.field, 39294 operator: filter.operators[0], 39295 value: getNewValue( 39296 filter, 39297 currentFilter, 39298 element.value 39299 ) 39300 } 39301 ]; 39302 onChangeView({ 39303 ...view, 39304 page: 1, 39305 filters: newFilters 39306 }); 39307 } 39308 } 39309 ), 39310 children: [ 39311 filter.singleSelection && /* @__PURE__ */ (0, import_jsx_runtime151.jsx)( 39312 SingleSelectionOption, 39313 { 39314 selected: currentValue === element.value 39315 } 39316 ), 39317 !filter.singleSelection && /* @__PURE__ */ (0, import_jsx_runtime151.jsx)( 39318 MultiSelectionOption, 39319 { 39320 selected: currentValue.includes(element.value) 39321 } 39322 ), 39323 /* @__PURE__ */ (0, import_jsx_runtime151.jsx)( 39324 "span", 39325 { 39326 className: "dataviews-filters__search-widget-listitem-value", 39327 title: element.label, 39328 children: element.label 39329 } 39330 ) 39331 ] 39332 }, 39333 element.value 39334 )) 39335 } 39336 ); 39337 } 39338 function ComboboxList22({ view, filter, onChangeView }) { 39339 const [searchValue, setSearchValue] = (0, import_element99.useState)(""); 39340 const deferredSearchValue = (0, import_element99.useDeferredValue)(searchValue); 39341 const currentFilter = view.filters?.find( 39342 (_filter) => _filter.field === filter.field 39343 ); 39344 const currentValue = getCurrentValue(filter, currentFilter); 39345 const matches = (0, import_element99.useMemo)(() => { 39346 const normalizedSearch = normalizeSearchInput(deferredSearchValue); 39347 return filter.elements.filter( 39348 (item) => normalizeSearchInput(item.label).includes(normalizedSearch) 39349 ); 39350 }, [filter.elements, deferredSearchValue]); 39351 return /* @__PURE__ */ (0, import_jsx_runtime151.jsxs)( 39352 ComboboxProvider, 39353 { 39354 selectedValue: currentValue, 39355 setSelectedValue: (value) => { 39356 const newFilters = currentFilter ? [ 39357 ...(view.filters ?? []).map((_filter) => { 39358 if (_filter.field === filter.field) { 39359 return { 39360 ..._filter, 39361 operator: currentFilter.operator || filter.operators[0], 39362 value 39363 }; 39364 } 39365 return _filter; 39366 }) 39367 ] : [ 39368 ...view.filters ?? [], 39369 { 39370 field: filter.field, 39371 operator: filter.operators[0], 39372 value 39373 } 39374 ]; 39375 onChangeView({ 39376 ...view, 39377 page: 1, 39378 filters: newFilters 39379 }); 39380 }, 39381 setValue: setSearchValue, 39382 children: [ 39383 /* @__PURE__ */ (0, import_jsx_runtime151.jsxs)("div", { className: "dataviews-filters__search-widget-filter-combobox__wrapper", children: [ 39384 /* @__PURE__ */ (0, import_jsx_runtime151.jsx)(VisuallyHidden, { render: /* @__PURE__ */ (0, import_jsx_runtime151.jsx)(ComboboxLabel, {}), children: (0, import_i18n39.__)("Search items") }), 39385 /* @__PURE__ */ (0, import_jsx_runtime151.jsx)( 39386 Combobox, 39387 { 39388 autoSelect: "always", 39389 placeholder: (0, import_i18n39.__)("Search"), 39390 className: "dataviews-filters__search-widget-filter-combobox__input" 39391 } 39392 ), 39393 /* @__PURE__ */ (0, import_jsx_runtime151.jsx)("div", { className: "dataviews-filters__search-widget-filter-combobox__icon", children: /* @__PURE__ */ (0, import_jsx_runtime151.jsx)(import_components21.Icon, { icon: search_default }) }) 39394 ] }), 39395 /* @__PURE__ */ (0, import_jsx_runtime151.jsxs)( 39396 ComboboxList, 39397 { 39398 className: "dataviews-filters__search-widget-filter-combobox-list", 39399 alwaysVisible: true, 39400 children: [ 39401 matches.map((element) => { 39402 return /* @__PURE__ */ (0, import_jsx_runtime151.jsxs)( 39403 ComboboxItem, 39404 { 39405 resetValueOnSelect: false, 39406 value: element.value, 39407 className: "dataviews-filters__search-widget-listitem", 39408 hideOnClick: false, 39409 setValueOnClick: false, 39410 focusOnHover: true, 39411 children: [ 39412 filter.singleSelection && /* @__PURE__ */ (0, import_jsx_runtime151.jsx)( 39413 SingleSelectionOption, 39414 { 39415 selected: currentValue === element.value 39416 } 39417 ), 39418 !filter.singleSelection && /* @__PURE__ */ (0, import_jsx_runtime151.jsx)( 39419 MultiSelectionOption, 39420 { 39421 selected: currentValue.includes( 39422 element.value 39423 ) 39424 } 39425 ), 39426 /* @__PURE__ */ (0, import_jsx_runtime151.jsxs)( 39427 "span", 39428 { 39429 className: "dataviews-filters__search-widget-listitem-value", 39430 title: element.label, 39431 children: [ 39432 /* @__PURE__ */ (0, import_jsx_runtime151.jsx)( 39433 ComboboxItemValue, 39434 { 39435 className: "dataviews-filters__search-widget-filter-combobox-item-value", 39436 value: element.label 39437 } 39438 ), 39439 !!element.description && /* @__PURE__ */ (0, import_jsx_runtime151.jsx)("span", { className: "dataviews-filters__search-widget-listitem-description", children: element.description }) 39440 ] 39441 } 39442 ) 39443 ] 39444 }, 39445 element.value 39446 ); 39447 }), 39448 !matches.length && /* @__PURE__ */ (0, import_jsx_runtime151.jsx)("p", { children: (0, import_i18n39.__)("No results found") }) 39449 ] 39450 } 39451 ) 39452 ] 39453 } 39454 ); 39455 } 39456 function SearchWidget(props) { 39457 const { elements, isLoading } = useElements({ 39458 elements: props.filter.elements, 39459 getElements: props.filter.getElements 39460 }); 39461 if (isLoading) { 39462 return /* @__PURE__ */ (0, import_jsx_runtime151.jsx)("div", { className: "dataviews-filters__search-widget-no-elements", children: /* @__PURE__ */ (0, import_jsx_runtime151.jsx)(import_components21.Spinner, {}) }); 39463 } 39464 if (elements.length === 0) { 39465 return /* @__PURE__ */ (0, import_jsx_runtime151.jsx)("div", { className: "dataviews-filters__search-widget-no-elements", children: (0, import_i18n39.__)("No elements found") }); 39466 } 39467 const Widget = elements.length > 10 ? ComboboxList22 : ListBox; 39468 return /* @__PURE__ */ (0, import_jsx_runtime151.jsx)(Widget, { ...props, filter: { ...props.filter, elements } }); 39469 } 39470 39471 // packages/dataviews/build-module/components/dataviews-filters/input-widget.mjs 39472 var import_es6 = __toESM(require_es6(), 1); 39473 var import_compose13 = __toESM(require_compose(), 1); 39474 var import_element100 = __toESM(require_element(), 1); 39475 var import_components22 = __toESM(require_components(), 1); 39476 var import_jsx_runtime152 = __toESM(require_jsx_runtime(), 1); 39477 function InputWidget({ 39478 filter, 39479 view, 39480 onChangeView, 39481 fields 39482 }) { 39483 const currentFilter = view.filters?.find( 39484 (f) => f.field === filter.field 39485 ); 39486 const currentValue = getCurrentValue(filter, currentFilter); 39487 const field = (0, import_element100.useMemo)(() => { 39488 const currentField = fields.find((f) => f.id === filter.field); 39489 if (currentField) { 39490 return { 39491 ...currentField, 39492 // Deactivate validation for filters. 39493 isValid: {}, 39494 // Filter controls are always enabled. 39495 isDisabled: () => false, 39496 // Filter controls are always visible. 39497 isVisible: () => true, 39498 // Configure getValue/setValue as if Item was a plain object. 39499 getValue: ({ item }) => item[currentField.id], 39500 setValue: ({ value }) => ({ 39501 [currentField.id]: value 39502 }) 39503 }; 39504 } 39505 return currentField; 39506 }, [fields, filter.field]); 39507 const data = (0, import_element100.useMemo)(() => { 39508 return (view.filters ?? []).reduce( 39509 (acc, activeFilter) => { 39510 acc[activeFilter.field] = activeFilter.value; 39511 return acc; 39512 }, 39513 {} 39514 ); 39515 }, [view.filters]); 39516 const handleChange = (0, import_compose13.useEvent)((updatedData) => { 39517 if (!field || !currentFilter) { 39518 return; 39519 } 39520 const nextValue = field.getValue({ item: updatedData }); 39521 if ((0, import_es6.default)(nextValue, currentValue)) { 39522 return; 39523 } 39524 onChangeView({ 39525 ...view, 39526 filters: (view.filters ?? []).map( 39527 (_filter) => _filter.field === filter.field ? { 39528 ..._filter, 39529 operator: currentFilter.operator || filter.operators[0], 39530 // Consider empty strings as undefined: 39531 // 39532 // - undefined as value means the filter is unset: the filter widget displays no value and the search returns all records 39533 // - empty string as value means "search empty string": returns only the records that have an empty string as value 39534 // 39535 // In practice, this means the filter will not be able to find an empty string as the value. 39536 value: nextValue === "" ? void 0 : nextValue 39537 } : _filter 39538 ) 39539 }); 39540 }); 39541 if (!field || !field.Edit || !currentFilter) { 39542 return null; 39543 } 39544 return /* @__PURE__ */ (0, import_jsx_runtime152.jsx)( 39545 import_components22.Flex, 39546 { 39547 className: "dataviews-filters__user-input-widget", 39548 gap: 2.5, 39549 direction: "column", 39550 children: /* @__PURE__ */ (0, import_jsx_runtime152.jsx)( 39551 field.Edit, 39552 { 39553 hideLabelFromVision: true, 39554 data, 39555 field, 39556 operator: currentFilter.operator, 39557 onChange: handleChange 39558 } 39559 ) 39560 } 39561 ); 39562 } 39563 39564 // packages/dataviews/build-module/utils/operators.mjs 39565 var import_i18n40 = __toESM(require_i18n(), 1); 39566 var import_element101 = __toESM(require_element(), 1); 39567 var import_date2 = __toESM(require_date(), 1); 39568 39569 // packages/dataviews/build-module/field-types/utils/parse-time.mjs 39570 var ZONE_DESIGNATOR = /(?:[Zz]|[+-](?:[01]\d|2[0-3]):?[0-5]\d)$/; 39571 var TIME_FORMATS = ["HH:mm", "HH:mm:ss"]; 39572 var REFERENCE_DATE = new Date(2e3, 0, 1); 39573 function parseTime2(value) { 39574 if (typeof value !== "string") { 39575 return null; 39576 } 39577 const time = value.trim().replace(ZONE_DESIGNATOR, ""); 39578 for (const timeFormat of TIME_FORMATS) { 39579 const parsed = parse(time, timeFormat, REFERENCE_DATE); 39580 if (isValid(parsed)) { 39581 return parsed.getHours() * 3600 + parsed.getMinutes() * 60 + parsed.getSeconds(); 39582 } 39583 } 39584 return null; 39585 } 39586 39587 // packages/dataviews/build-module/utils/operators.mjs 39588 var import_jsx_runtime153 = __toESM(require_jsx_runtime(), 1); 39589 var filterTextWrappers = { 39590 Name: /* @__PURE__ */ (0, import_jsx_runtime153.jsx)("span", { className: "dataviews-filters__summary-filter-text-name" }), 39591 Value: /* @__PURE__ */ (0, import_jsx_runtime153.jsx)("span", { className: "dataviews-filters__summary-filter-text-value" }) 39592 }; 39593 function toComparableTemporals(fieldValue, filterValue) { 39594 const filterTime = parseTime2(filterValue); 39595 if (filterTime !== null) { 39596 return [parseTime2(fieldValue) ?? NaN, filterTime]; 39597 } 39598 return [ 39599 (0, import_date2.getDate)(fieldValue).getTime(), 39600 (0, import_date2.getDate)(filterValue).getTime() 39601 ]; 39602 } 39603 function getRelativeDate(value, unit) { 39604 switch (unit) { 39605 case "days": 39606 return subDays(/* @__PURE__ */ new Date(), value); 39607 case "weeks": 39608 return subWeeks(/* @__PURE__ */ new Date(), value); 39609 case "months": 39610 return subMonths(/* @__PURE__ */ new Date(), value); 39611 case "years": 39612 return subYears(/* @__PURE__ */ new Date(), value); 39613 default: 39614 return /* @__PURE__ */ new Date(); 39615 } 39616 } 39617 var isNoneOperatorDefinition = { 39618 /* translators: DataViews operator name */ 39619 label: (0, import_i18n40.__)("Is none of"), 39620 filterText: (filter, activeElements) => (0, import_element101.createInterpolateElement)( 39621 (0, import_i18n40.sprintf)( 39622 /* translators: 1: Filter name (e.g. "Author"). 2: Filter value (e.g. "Admin"): "Author is none of: Admin, Editor". */ 39623 (0, import_i18n40.__)("<Name>%1$s is none of: </Name><Value>%2$s</Value>"), 39624 filter.name, 39625 activeElements.map((element) => element.label).join(", ") 39626 ), 39627 filterTextWrappers 39628 ), 39629 filter: ((item, field, filterValue) => { 39630 if (!filterValue?.length) { 39631 return true; 39632 } 39633 const fieldValue = field.getValue({ item }); 39634 if (Array.isArray(fieldValue)) { 39635 return !filterValue.some( 39636 (fv) => fieldValue.includes(fv) 39637 ); 39638 } else if (typeof fieldValue === "string" || typeof fieldValue === "number") { 39639 return !filterValue.includes(fieldValue); 39640 } 39641 return false; 39642 }), 39643 selection: "multi" 39644 }; 39645 var OPERATORS = [ 39646 { 39647 name: OPERATOR_IS_ANY, 39648 /* translators: DataViews operator name */ 39649 label: (0, import_i18n40.__)("Includes"), 39650 filterText: (filter, activeElements) => (0, import_element101.createInterpolateElement)( 39651 (0, import_i18n40.sprintf)( 39652 /* translators: 1: Filter name (e.g. "Author"). 2: Filter value (e.g. "Admin"): "Author is any: Admin, Editor". */ 39653 (0, import_i18n40.__)("<Name>%1$s includes: </Name><Value>%2$s</Value>"), 39654 filter.name, 39655 activeElements.map((element) => element.label).join(", ") 39656 ), 39657 filterTextWrappers 39658 ), 39659 filter(item, field, filterValue) { 39660 if (!filterValue?.length) { 39661 return true; 39662 } 39663 const fieldValue = field.getValue({ item }); 39664 if (Array.isArray(fieldValue)) { 39665 return filterValue.some( 39666 (fv) => fieldValue.includes(fv) 39667 ); 39668 } else if (typeof fieldValue === "string" || typeof fieldValue === "number") { 39669 return filterValue.includes(fieldValue); 39670 } 39671 return false; 39672 }, 39673 selection: "multi" 39674 }, 39675 { 39676 name: OPERATOR_IS_NONE, 39677 ...isNoneOperatorDefinition 39678 }, 39679 { 39680 name: OPERATOR_IS_ALL, 39681 /* translators: DataViews operator name */ 39682 label: (0, import_i18n40.__)("Includes all"), 39683 filterText: (filter, activeElements) => (0, import_element101.createInterpolateElement)( 39684 (0, import_i18n40.sprintf)( 39685 /* translators: 1: Filter name (e.g. "Author"). 2: Filter value (e.g. "Admin"): "Author includes all: Admin, Editor". */ 39686 (0, import_i18n40.__)("<Name>%1$s includes all: </Name><Value>%2$s</Value>"), 39687 filter.name, 39688 activeElements.map((element) => element.label).join(", ") 39689 ), 39690 filterTextWrappers 39691 ), 39692 filter(item, field, filterValue) { 39693 if (!filterValue?.length) { 39694 return true; 39695 } 39696 const fieldValue = field.getValue({ item }); 39697 if (!Array.isArray(fieldValue)) { 39698 return false; 39699 } 39700 return filterValue.every( 39701 (value) => fieldValue.includes(value) 39702 ); 39703 }, 39704 selection: "multi" 39705 }, 39706 { 39707 name: OPERATOR_IS_NOT_ALL, 39708 ...isNoneOperatorDefinition 39709 }, 39710 { 39711 name: OPERATOR_BETWEEN, 39712 /* translators: DataViews operator name */ 39713 label: (0, import_i18n40.__)("Between (inc)"), 39714 filterText: (filter, activeElements) => (0, import_element101.createInterpolateElement)( 39715 (0, import_i18n40.sprintf)( 39716 /* translators: 1: Filter name (e.g. "Item count"). 2: Filter value min. 3: Filter value max. e.g.: "Item count between (inc): 10 and 180". */ 39717 (0, import_i18n40.__)( 39718 "<Name>%1$s between (inc): </Name><Value>%2$s and %3$s</Value>" 39719 ), 39720 filter.name, 39721 activeElements[0].label[0], 39722 activeElements[0].label[1] 39723 ), 39724 filterTextWrappers 39725 ), 39726 filter(item, field, filterValue) { 39727 if (!Array.isArray(filterValue) || filterValue.length !== 2 || // An unfilled bound is `undefined` from the controls, `''` 39728 // when it arrives from a persisted view, or `null` once 39729 // `undefined` round-trips through JSON persistence. 39730 filterValue.includes(void 0) || filterValue.includes("") || filterValue.includes(null)) { 39731 return true; 39732 } 39733 const fieldValue = field.getValue({ item }); 39734 const [min3, max3] = filterValue.map(parseTime2); 39735 if (min3 !== null && max3 !== null) { 39736 const value = parseTime2(fieldValue); 39737 return value !== null && value >= min3 && value <= max3; 39738 } 39739 if (typeof fieldValue === "number" || fieldValue instanceof Date || typeof fieldValue === "string") { 39740 return fieldValue >= filterValue[0] && fieldValue <= filterValue[1]; 39741 } 39742 return false; 39743 }, 39744 selection: "custom" 39745 }, 39746 { 39747 name: OPERATOR_IN_THE_PAST, 39748 /* translators: DataViews operator name */ 39749 label: (0, import_i18n40.__)("In the past"), 39750 filterText: (filter, activeElements) => (0, import_element101.createInterpolateElement)( 39751 (0, import_i18n40.sprintf)( 39752 /* translators: 1: Filter name (e.g. "Date"). 2: Filter value (e.g. "7 days"): "Date is in the past: 7 days". */ 39753 (0, import_i18n40.__)( 39754 "<Name>%1$s is in the past: </Name><Value>%2$s</Value>" 39755 ), 39756 filter.name, 39757 `$activeElements[0].value.value} $activeElements[0].value.unit}` 39758 ), 39759 filterTextWrappers 39760 ), 39761 filter(item, field, filterValue) { 39762 if (filterValue?.value === void 0 || filterValue?.unit === void 0) { 39763 return true; 39764 } 39765 const targetDate = getRelativeDate( 39766 filterValue.value, 39767 filterValue.unit 39768 ); 39769 const fieldValue = (0, import_date2.getDate)(field.getValue({ item })); 39770 return fieldValue >= targetDate && fieldValue <= /* @__PURE__ */ new Date(); 39771 }, 39772 selection: "custom" 39773 }, 39774 { 39775 name: OPERATOR_OVER, 39776 /* translators: DataViews operator name */ 39777 label: (0, import_i18n40.__)("Over"), 39778 filterText: (filter, activeElements) => (0, import_element101.createInterpolateElement)( 39779 (0, import_i18n40.sprintf)( 39780 /* translators: 1: Filter name (e.g. "Date"). 2: Filter value (e.g. "7 days"): "Date is over: 7 days". */ 39781 (0, import_i18n40.__)("<Name>%1$s is over: </Name><Value>%2$s</Value>"), 39782 filter.name, 39783 `$activeElements[0].value.value} $activeElements[0].value.unit}` 39784 ), 39785 filterTextWrappers 39786 ), 39787 filter(item, field, filterValue) { 39788 if (filterValue?.value === void 0 || filterValue?.unit === void 0) { 39789 return true; 39790 } 39791 const targetDate = getRelativeDate( 39792 filterValue.value, 39793 filterValue.unit 39794 ); 39795 const fieldValue = (0, import_date2.getDate)(field.getValue({ item })); 39796 return fieldValue < targetDate; 39797 }, 39798 selection: "custom" 39799 }, 39800 { 39801 name: OPERATOR_IS, 39802 /* translators: DataViews operator name */ 39803 label: (0, import_i18n40.__)("Is"), 39804 filterText: (filter, activeElements) => (0, import_element101.createInterpolateElement)( 39805 (0, import_i18n40.sprintf)( 39806 /* translators: 1: Filter name (e.g. "Author"). 2: Filter value (e.g. "Admin"): "Author is: Admin". */ 39807 (0, import_i18n40.__)("<Name>%1$s is: </Name><Value>%2$s</Value>"), 39808 filter.name, 39809 activeElements[0].label 39810 ), 39811 filterTextWrappers 39812 ), 39813 filter(item, field, filterValue) { 39814 return filterValue === field.getValue({ item }) || filterValue === void 0; 39815 }, 39816 selection: "single" 39817 }, 39818 { 39819 name: OPERATOR_IS_NOT, 39820 /* translators: DataViews operator name */ 39821 label: (0, import_i18n40.__)("Is not"), 39822 filterText: (filter, activeElements) => (0, import_element101.createInterpolateElement)( 39823 (0, import_i18n40.sprintf)( 39824 /* translators: 1: Filter name (e.g. "Author"). 2: Filter value (e.g. "Admin"): "Author is not: Admin". */ 39825 (0, import_i18n40.__)("<Name>%1$s is not: </Name><Value>%2$s</Value>"), 39826 filter.name, 39827 activeElements[0].label 39828 ), 39829 filterTextWrappers 39830 ), 39831 filter(item, field, filterValue) { 39832 return filterValue !== field.getValue({ item }); 39833 }, 39834 selection: "single" 39835 }, 39836 { 39837 name: OPERATOR_LESS_THAN, 39838 /* translators: DataViews operator name */ 39839 label: (0, import_i18n40.__)("Less than"), 39840 filterText: (filter, activeElements) => (0, import_element101.createInterpolateElement)( 39841 (0, import_i18n40.sprintf)( 39842 /* translators: 1: Filter name (e.g. "Count"). 2: Filter value (e.g. "10"): "Count is less than: 10". */ 39843 (0, import_i18n40.__)("<Name>%1$s is less than: </Name><Value>%2$s</Value>"), 39844 filter.name, 39845 activeElements[0].label 39846 ), 39847 filterTextWrappers 39848 ), 39849 filter(item, field, filterValue) { 39850 if (filterValue === void 0) { 39851 return true; 39852 } 39853 const fieldValue = field.getValue({ item }); 39854 return fieldValue < filterValue; 39855 }, 39856 selection: "single" 39857 }, 39858 { 39859 name: OPERATOR_GREATER_THAN, 39860 /* translators: DataViews operator name */ 39861 label: (0, import_i18n40.__)("Greater than"), 39862 filterText: (filter, activeElements) => (0, import_element101.createInterpolateElement)( 39863 (0, import_i18n40.sprintf)( 39864 /* translators: 1: Filter name (e.g. "Count"). 2: Filter value (e.g. "10"): "Count is greater than: 10". */ 39865 (0, import_i18n40.__)( 39866 "<Name>%1$s is greater than: </Name><Value>%2$s</Value>" 39867 ), 39868 filter.name, 39869 activeElements[0].label 39870 ), 39871 filterTextWrappers 39872 ), 39873 filter(item, field, filterValue) { 39874 if (filterValue === void 0) { 39875 return true; 39876 } 39877 const fieldValue = field.getValue({ item }); 39878 return fieldValue > filterValue; 39879 }, 39880 selection: "single" 39881 }, 39882 { 39883 name: OPERATOR_LESS_THAN_OR_EQUAL, 39884 /* translators: DataViews operator name */ 39885 label: (0, import_i18n40.__)("Less than or equal"), 39886 filterText: (filter, activeElements) => (0, import_element101.createInterpolateElement)( 39887 (0, import_i18n40.sprintf)( 39888 /* translators: 1: Filter name (e.g. "Count"). 2: Filter value (e.g. "10"): "Count is less than or equal to: 10". */ 39889 (0, import_i18n40.__)( 39890 "<Name>%1$s is less than or equal to: </Name><Value>%2$s</Value>" 39891 ), 39892 filter.name, 39893 activeElements[0].label 39894 ), 39895 filterTextWrappers 39896 ), 39897 filter(item, field, filterValue) { 39898 if (filterValue === void 0) { 39899 return true; 39900 } 39901 const fieldValue = field.getValue({ item }); 39902 return fieldValue <= filterValue; 39903 }, 39904 selection: "single" 39905 }, 39906 { 39907 name: OPERATOR_GREATER_THAN_OR_EQUAL, 39908 /* translators: DataViews operator name */ 39909 label: (0, import_i18n40.__)("Greater than or equal"), 39910 filterText: (filter, activeElements) => (0, import_element101.createInterpolateElement)( 39911 (0, import_i18n40.sprintf)( 39912 /* translators: 1: Filter name (e.g. "Count"). 2: Filter value (e.g. "10"): "Count is greater than or equal to: 10". */ 39913 (0, import_i18n40.__)( 39914 "<Name>%1$s is greater than or equal to: </Name><Value>%2$s</Value>" 39915 ), 39916 filter.name, 39917 activeElements[0].label 39918 ), 39919 filterTextWrappers 39920 ), 39921 filter(item, field, filterValue) { 39922 if (filterValue === void 0) { 39923 return true; 39924 } 39925 const fieldValue = field.getValue({ item }); 39926 return fieldValue >= filterValue; 39927 }, 39928 selection: "single" 39929 }, 39930 { 39931 name: OPERATOR_BEFORE, 39932 /* translators: DataViews operator name */ 39933 label: (0, import_i18n40.__)("Before"), 39934 filterText: (filter, activeElements) => (0, import_element101.createInterpolateElement)( 39935 (0, import_i18n40.sprintf)( 39936 /* translators: 1: Filter name (e.g. "Date"). 2: Filter value (e.g. "2024-01-01"): "Date is before: 2024-01-01". */ 39937 (0, import_i18n40.__)("<Name>%1$s is before: </Name><Value>%2$s</Value>"), 39938 filter.name, 39939 activeElements[0].label 39940 ), 39941 filterTextWrappers 39942 ), 39943 filter(item, field, filterValue) { 39944 if (filterValue === void 0) { 39945 return true; 39946 } 39947 const [fieldTemporal, filterTemporal] = toComparableTemporals( 39948 field.getValue({ item }), 39949 filterValue 39950 ); 39951 return fieldTemporal < filterTemporal; 39952 }, 39953 selection: "single" 39954 }, 39955 { 39956 name: OPERATOR_AFTER, 39957 /* translators: DataViews operator name */ 39958 label: (0, import_i18n40.__)("After"), 39959 filterText: (filter, activeElements) => (0, import_element101.createInterpolateElement)( 39960 (0, import_i18n40.sprintf)( 39961 /* translators: 1: Filter name (e.g. "Date"). 2: Filter value (e.g. "2024-01-01"): "Date is after: 2024-01-01". */ 39962 (0, import_i18n40.__)("<Name>%1$s is after: </Name><Value>%2$s</Value>"), 39963 filter.name, 39964 activeElements[0].label 39965 ), 39966 filterTextWrappers 39967 ), 39968 filter(item, field, filterValue) { 39969 if (filterValue === void 0) { 39970 return true; 39971 } 39972 const [fieldTemporal, filterTemporal] = toComparableTemporals( 39973 field.getValue({ item }), 39974 filterValue 39975 ); 39976 return fieldTemporal > filterTemporal; 39977 }, 39978 selection: "single" 39979 }, 39980 { 39981 name: OPERATOR_BEFORE_INC, 39982 /* translators: DataViews operator name */ 39983 label: (0, import_i18n40.__)("Before (inc)"), 39984 filterText: (filter, activeElements) => (0, import_element101.createInterpolateElement)( 39985 (0, import_i18n40.sprintf)( 39986 /* translators: 1: Filter name (e.g. "Date"). 2: Filter value (e.g. "2024-01-01"): "Date is on or before: 2024-01-01". */ 39987 (0, import_i18n40.__)( 39988 "<Name>%1$s is on or before: </Name><Value>%2$s</Value>" 39989 ), 39990 filter.name, 39991 activeElements[0].label 39992 ), 39993 filterTextWrappers 39994 ), 39995 filter(item, field, filterValue) { 39996 if (filterValue === void 0) { 39997 return true; 39998 } 39999 const [fieldTemporal, filterTemporal] = toComparableTemporals( 40000 field.getValue({ item }), 40001 filterValue 40002 ); 40003 return fieldTemporal <= filterTemporal; 40004 }, 40005 selection: "single" 40006 }, 40007 { 40008 name: OPERATOR_AFTER_INC, 40009 /* translators: DataViews operator name */ 40010 label: (0, import_i18n40.__)("After (inc)"), 40011 filterText: (filter, activeElements) => (0, import_element101.createInterpolateElement)( 40012 (0, import_i18n40.sprintf)( 40013 /* translators: 1: Filter name (e.g. "Date"). 2: Filter value (e.g. "2024-01-01"): "Date is on or after: 2024-01-01". */ 40014 (0, import_i18n40.__)( 40015 "<Name>%1$s is on or after: </Name><Value>%2$s</Value>" 40016 ), 40017 filter.name, 40018 activeElements[0].label 40019 ), 40020 filterTextWrappers 40021 ), 40022 filter(item, field, filterValue) { 40023 if (filterValue === void 0) { 40024 return true; 40025 } 40026 const [fieldTemporal, filterTemporal] = toComparableTemporals( 40027 field.getValue({ item }), 40028 filterValue 40029 ); 40030 return fieldTemporal >= filterTemporal; 40031 }, 40032 selection: "single" 40033 }, 40034 { 40035 name: OPERATOR_CONTAINS, 40036 /* translators: DataViews operator name */ 40037 label: (0, import_i18n40.__)("Contains"), 40038 filterText: (filter, activeElements) => (0, import_element101.createInterpolateElement)( 40039 (0, import_i18n40.sprintf)( 40040 /* translators: 1: Filter name (e.g. "Title"). 2: Filter value (e.g. "Hello"): "Title contains: Hello". */ 40041 (0, import_i18n40.__)("<Name>%1$s contains: </Name><Value>%2$s</Value>"), 40042 filter.name, 40043 activeElements[0].label 40044 ), 40045 filterTextWrappers 40046 ), 40047 filter(item, field, filterValue) { 40048 if (filterValue === void 0) { 40049 return true; 40050 } 40051 const fieldValue = field.getValue({ item }); 40052 return typeof fieldValue === "string" && filterValue && fieldValue.toLowerCase().includes(String(filterValue).toLowerCase()); 40053 }, 40054 selection: "single" 40055 }, 40056 { 40057 name: OPERATOR_NOT_CONTAINS, 40058 /* translators: DataViews operator name */ 40059 label: (0, import_i18n40.__)("Doesn't contain"), 40060 filterText: (filter, activeElements) => (0, import_element101.createInterpolateElement)( 40061 (0, import_i18n40.sprintf)( 40062 /* translators: 1: Filter name (e.g. "Title"). 2: Filter value (e.g. "Hello"): "Title doesn't contain: Hello". */ 40063 (0, import_i18n40.__)( 40064 "<Name>%1$s doesn't contain: </Name><Value>%2$s</Value>" 40065 ), 40066 filter.name, 40067 activeElements[0].label 40068 ), 40069 filterTextWrappers 40070 ), 40071 filter(item, field, filterValue) { 40072 if (filterValue === void 0) { 40073 return true; 40074 } 40075 const fieldValue = field.getValue({ item }); 40076 return typeof fieldValue === "string" && filterValue && !fieldValue.toLowerCase().includes(String(filterValue).toLowerCase()); 40077 }, 40078 selection: "single" 40079 }, 40080 { 40081 name: OPERATOR_STARTS_WITH, 40082 /* translators: DataViews operator name */ 40083 label: (0, import_i18n40.__)("Starts with"), 40084 filterText: (filter, activeElements) => (0, import_element101.createInterpolateElement)( 40085 (0, import_i18n40.sprintf)( 40086 /* translators: 1: Filter name (e.g. "Title"). 2: Filter value (e.g. "Hello"): "Title starts with: Hello". */ 40087 (0, import_i18n40.__)("<Name>%1$s starts with: </Name><Value>%2$s</Value>"), 40088 filter.name, 40089 activeElements[0].label 40090 ), 40091 filterTextWrappers 40092 ), 40093 filter(item, field, filterValue) { 40094 if (filterValue === void 0) { 40095 return true; 40096 } 40097 const fieldValue = field.getValue({ item }); 40098 return typeof fieldValue === "string" && filterValue && fieldValue.toLowerCase().startsWith(String(filterValue).toLowerCase()); 40099 }, 40100 selection: "single" 40101 }, 40102 { 40103 name: OPERATOR_ON, 40104 /* translators: DataViews operator name */ 40105 label: (0, import_i18n40.__)("On"), 40106 filterText: (filter, activeElements) => (0, import_element101.createInterpolateElement)( 40107 (0, import_i18n40.sprintf)( 40108 /* translators: 1: Filter name (e.g. "Date"). 2: Filter value (e.g. "2024-01-01"): "Date is: 2024-01-01". */ 40109 (0, import_i18n40.__)("<Name>%1$s is: </Name><Value>%2$s</Value>"), 40110 filter.name, 40111 activeElements[0].label 40112 ), 40113 filterTextWrappers 40114 ), 40115 filter(item, field, filterValue) { 40116 if (filterValue === void 0) { 40117 return true; 40118 } 40119 const [fieldTemporal, filterTemporal] = toComparableTemporals( 40120 field.getValue({ item }), 40121 filterValue 40122 ); 40123 return fieldTemporal === filterTemporal; 40124 }, 40125 selection: "single" 40126 }, 40127 { 40128 name: OPERATOR_NOT_ON, 40129 /* translators: DataViews operator name */ 40130 label: (0, import_i18n40.__)("Not on"), 40131 filterText: (filter, activeElements) => (0, import_element101.createInterpolateElement)( 40132 (0, import_i18n40.sprintf)( 40133 /* translators: 1: Filter name (e.g. "Date"). 2: Filter value (e.g. "2024-01-01"): "Date is not: 2024-01-01". */ 40134 (0, import_i18n40.__)("<Name>%1$s is not: </Name><Value>%2$s</Value>"), 40135 filter.name, 40136 activeElements[0].label 40137 ), 40138 filterTextWrappers 40139 ), 40140 filter(item, field, filterValue) { 40141 if (filterValue === void 0) { 40142 return true; 40143 } 40144 const [fieldTemporal, filterTemporal] = toComparableTemporals( 40145 field.getValue({ item }), 40146 filterValue 40147 ); 40148 return fieldTemporal !== filterTemporal; 40149 }, 40150 selection: "single" 40151 } 40152 ]; 40153 var getOperatorByName = (name) => OPERATORS.find((op) => op.name === name); 40154 var getAllOperatorNames = () => OPERATORS.map((op) => op.name); 40155 var isSingleSelectionOperator = (name) => OPERATORS.filter((op) => op.selection === "single").some( 40156 (op) => op.name === name 40157 ); 40158 var isRegisteredOperator = (name) => OPERATORS.some((op) => op.name === name); 40159 40160 // packages/dataviews/build-module/components/dataviews-filters/filter.mjs 40161 var import_jsx_runtime154 = __toESM(require_jsx_runtime(), 1); 40162 var ENTER = "Enter"; 40163 var SPACE = " "; 40164 var FilterText = ({ 40165 activeElements, 40166 filterInView, 40167 filter 40168 }) => { 40169 if (activeElements === void 0 || activeElements.length === 0) { 40170 return filter.name; 40171 } 40172 const operator = getOperatorByName(filterInView?.operator); 40173 if (operator !== void 0) { 40174 return operator.filterText(filter, activeElements); 40175 } 40176 return (0, import_i18n41.sprintf)( 40177 /* translators: 1: Filter name e.g.: "Unknown status for Author". */ 40178 (0, import_i18n41.__)("Unknown status for %1$s"), 40179 filter.name 40180 ); 40181 }; 40182 function OperatorSelector({ 40183 filter, 40184 view, 40185 onChangeView 40186 }) { 40187 const operatorOptions = filter.operators?.map((operator) => ({ 40188 value: operator, 40189 label: getOperatorByName(operator)?.label || operator 40190 })); 40191 const currentFilter = view.filters?.find( 40192 (_filter) => _filter.field === filter.field 40193 ); 40194 const value = currentFilter?.operator || filter.operators[0]; 40195 return operatorOptions.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime154.jsxs)( 40196 Stack, 40197 { 40198 direction: "row", 40199 gap: "sm", 40200 justify: "flex-start", 40201 className: "dataviews-filters__summary-operators-container", 40202 align: "center", 40203 children: [ 40204 /* @__PURE__ */ (0, import_jsx_runtime154.jsx)(import_components23.FlexItem, { className: "dataviews-filters__summary-operators-filter-name", children: filter.name }), 40205 /* @__PURE__ */ (0, import_jsx_runtime154.jsx)( 40206 import_components23.SelectControl, 40207 { 40208 className: "dataviews-filters__summary-operators-filter-select", 40209 label: (0, import_i18n41.__)("Conditions"), 40210 value, 40211 options: operatorOptions, 40212 onChange: (newValue) => { 40213 const newOperator = newValue; 40214 const currentOperator = currentFilter?.operator; 40215 const newFilters = currentFilter ? [ 40216 ...(view.filters ?? []).map( 40217 (_filter) => { 40218 if (_filter.field === filter.field) { 40219 const currentOpSelectionModel = getOperatorByName( 40220 currentOperator 40221 )?.selection; 40222 const newOpSelectionModel = getOperatorByName( 40223 newOperator 40224 )?.selection; 40225 const shouldResetValue = currentOpSelectionModel !== newOpSelectionModel || [ 40226 currentOpSelectionModel, 40227 newOpSelectionModel 40228 ].includes("custom"); 40229 return { 40230 ..._filter, 40231 value: shouldResetValue ? void 0 : _filter.value, 40232 operator: newOperator 40233 }; 40234 } 40235 return _filter; 40236 } 40237 ) 40238 ] : [ 40239 ...view.filters ?? [], 40240 { 40241 field: filter.field, 40242 operator: newOperator, 40243 value: void 0 40244 } 40245 ]; 40246 onChangeView({ 40247 ...view, 40248 page: 1, 40249 filters: newFilters 40250 }); 40251 }, 40252 size: "small", 40253 variant: "minimal", 40254 hideLabelFromVision: true 40255 } 40256 ) 40257 ] 40258 } 40259 ); 40260 } 40261 function Filter({ 40262 addFilterRef, 40263 openedFilter, 40264 fields, 40265 ...commonProps 40266 }) { 40267 const toggleRef = (0, import_element102.useRef)(null); 40268 const { filter, view, onChangeView } = commonProps; 40269 const filterInView = view.filters?.find( 40270 (f) => f.field === filter.field 40271 ); 40272 let activeElements = []; 40273 const field = (0, import_element102.useMemo)(() => { 40274 const currentField = fields.find((f) => f.id === filter.field); 40275 if (currentField) { 40276 return { 40277 ...currentField, 40278 // Configure getValue as if Item was a plain object. 40279 // See related input-widget.tsx 40280 getValue: ({ item }) => item[currentField.id] 40281 }; 40282 } 40283 return currentField; 40284 }, [fields, filter.field]); 40285 const { elements } = useElements({ 40286 elements: filter.elements, 40287 getElements: filter.getElements 40288 }); 40289 if (elements.length > 0) { 40290 activeElements = elements.filter((element) => { 40291 if (filter.singleSelection) { 40292 return element.value === filterInView?.value; 40293 } 40294 return filterInView?.value?.includes(element.value); 40295 }); 40296 } else if (Array.isArray(filterInView?.value)) { 40297 const isComplete = !filterInView.value.some( 40298 (v2) => v2 === void 0 || v2 === null || v2 === "" 40299 ); 40300 if (isComplete) { 40301 const label = filterInView.value.map((v2) => { 40302 const formattedValue = field?.getValueFormatted({ 40303 item: { [field.id]: v2 }, 40304 field 40305 }); 40306 return formattedValue || String(v2); 40307 }); 40308 activeElements = [ 40309 { 40310 value: filterInView.value, 40311 // @ts-expect-error `label` is a `string[]` here, but the element type expects a `string`. 40312 label 40313 } 40314 ]; 40315 } 40316 } else if (typeof filterInView?.value === "object") { 40317 activeElements = [ 40318 { value: filterInView.value, label: filterInView.value } 40319 ]; 40320 } else if (filterInView?.value !== void 0) { 40321 const label = field !== void 0 ? field.getValueFormatted({ 40322 item: { [field.id]: filterInView.value }, 40323 field 40324 }) : String(filterInView.value); 40325 activeElements = [ 40326 { 40327 value: filterInView.value, 40328 label 40329 } 40330 ]; 40331 } 40332 const isPrimary = filter.isPrimary; 40333 const isLocked = filterInView?.isLocked; 40334 const hasValues = !isLocked && filterInView?.value !== void 0; 40335 const canResetOrRemove = !isLocked && (!isPrimary || hasValues); 40336 const resetOrRemoveLabel = isPrimary ? (0, import_i18n41.__)("Reset") : (0, import_i18n41.__)("Remove"); 40337 return /* @__PURE__ */ (0, import_jsx_runtime154.jsx)( 40338 import_components23.Dropdown, 40339 { 40340 defaultOpen: openedFilter === filter.field, 40341 contentClassName: "dataviews-filters__summary-popover", 40342 popoverProps: { placement: "bottom-start", role: "dialog" }, 40343 onClose: () => { 40344 toggleRef.current?.focus(); 40345 }, 40346 renderToggle: ({ isOpen, onToggle }) => /* @__PURE__ */ (0, import_jsx_runtime154.jsxs)("div", { className: "dataviews-filters__summary-chip-container", children: [ 40347 /* @__PURE__ */ (0, import_jsx_runtime154.jsxs)(tooltip_exports.Root, { children: [ 40348 /* @__PURE__ */ (0, import_jsx_runtime154.jsx)( 40349 tooltip_exports.Trigger, 40350 { 40351 render: /* @__PURE__ */ (0, import_jsx_runtime154.jsx)( 40352 "div", 40353 { 40354 className: clsx_default( 40355 "dataviews-filters__summary-chip", 40356 { 40357 "has-reset": canResetOrRemove, 40358 "has-values": hasValues, 40359 "is-not-clickable": isLocked 40360 } 40361 ), 40362 role: "button", 40363 tabIndex: isLocked ? -1 : 0, 40364 onClick: () => { 40365 if (!isLocked) { 40366 onToggle(); 40367 } 40368 }, 40369 onKeyDown: (event) => { 40370 if (!isLocked && [ENTER, SPACE].includes( 40371 event.key 40372 )) { 40373 onToggle(); 40374 event.preventDefault(); 40375 } 40376 }, 40377 "aria-disabled": isLocked, 40378 "aria-pressed": isOpen, 40379 "aria-expanded": isOpen, 40380 ref: toggleRef, 40381 children: /* @__PURE__ */ (0, import_jsx_runtime154.jsx)( 40382 FilterText, 40383 { 40384 activeElements, 40385 filterInView, 40386 filter 40387 } 40388 ) 40389 } 40390 ) 40391 } 40392 ), 40393 /* @__PURE__ */ (0, import_jsx_runtime154.jsx)(tooltip_exports.Popup, { children: (0, import_i18n41.sprintf)( 40394 /* translators: 1: Filter name. */ 40395 (0, import_i18n41.__)("Filter by: %1$s"), 40396 filter.name.toLowerCase() 40397 ) }) 40398 ] }), 40399 canResetOrRemove && /* @__PURE__ */ (0, import_jsx_runtime154.jsxs)(tooltip_exports.Root, { children: [ 40400 /* @__PURE__ */ (0, import_jsx_runtime154.jsx)( 40401 tooltip_exports.Trigger, 40402 { 40403 render: /* @__PURE__ */ (0, import_jsx_runtime154.jsx)( 40404 "button", 40405 { 40406 className: clsx_default( 40407 "dataviews-filters__summary-chip-remove", 40408 { "has-values": hasValues } 40409 ), 40410 "aria-label": resetOrRemoveLabel, 40411 onClick: () => { 40412 onChangeView({ 40413 ...view, 40414 page: 1, 40415 filters: view.filters?.filter( 40416 (_filter) => _filter.field !== filter.field 40417 ) 40418 }); 40419 if (!isPrimary) { 40420 addFilterRef.current?.focus(); 40421 } else { 40422 toggleRef.current?.focus(); 40423 } 40424 }, 40425 children: /* @__PURE__ */ (0, import_jsx_runtime154.jsx)(import_components23.Icon, { icon: close_small_default }) 40426 } 40427 ) 40428 } 40429 ), 40430 /* @__PURE__ */ (0, import_jsx_runtime154.jsx)(tooltip_exports.Popup, { children: resetOrRemoveLabel }) 40431 ] }) 40432 ] }), 40433 renderContent: () => { 40434 return /* @__PURE__ */ (0, import_jsx_runtime154.jsxs)(Stack, { direction: "column", justify: "flex-start", children: [ 40435 /* @__PURE__ */ (0, import_jsx_runtime154.jsx)(OperatorSelector, { ...commonProps }), 40436 commonProps.filter.hasElements ? /* @__PURE__ */ (0, import_jsx_runtime154.jsx)( 40437 SearchWidget, 40438 { 40439 ...commonProps, 40440 filter: { 40441 ...commonProps.filter, 40442 elements 40443 } 40444 } 40445 ) : /* @__PURE__ */ (0, import_jsx_runtime154.jsx)(InputWidget, { ...commonProps, fields }) 40446 ] }); 40447 } 40448 } 40449 ); 40450 } 40451 40452 // packages/dataviews/build-module/components/dataviews-filters/add-filter.mjs 40453 var import_components24 = __toESM(require_components(), 1); 40454 var import_i18n42 = __toESM(require_i18n(), 1); 40455 var import_element103 = __toESM(require_element(), 1); 40456 var import_jsx_runtime155 = __toESM(require_jsx_runtime(), 1); 40457 function AddFilterMenu({ 40458 filters, 40459 view, 40460 onChangeView, 40461 setOpenedFilter, 40462 triggerProps 40463 }) { 40464 const inactiveFilters = filters.filter((filter) => !filter.isVisible); 40465 return ( 40466 // The `disabled` prop on `Menu.Root` (rather than on the trigger) 40467 // keeps the menu from opening while letting the trigger button stay 40468 // focusable via its own `accessibleWhenDisabled`. 40469 /* @__PURE__ */ (0, import_jsx_runtime155.jsxs)(menu_exports.Root, { disabled: !inactiveFilters.length, children: [ 40470 /* @__PURE__ */ (0, import_jsx_runtime155.jsx)(menu_exports.Trigger, { ...triggerProps }), 40471 /* @__PURE__ */ (0, import_jsx_runtime155.jsx)(menu_exports.Popup, { children: inactiveFilters.map((filter) => { 40472 return /* @__PURE__ */ (0, import_jsx_runtime155.jsx)( 40473 menu_exports.Item, 40474 { 40475 onClick: () => { 40476 setOpenedFilter(filter.field); 40477 onChangeView({ 40478 ...view, 40479 page: 1, 40480 filters: [ 40481 ...view.filters || [], 40482 { 40483 field: filter.field, 40484 value: void 0, 40485 operator: filter.operators[0] 40486 } 40487 ] 40488 }); 40489 }, 40490 children: /* @__PURE__ */ (0, import_jsx_runtime155.jsx)(menu_exports.ItemLabel, { children: filter.name }) 40491 }, 40492 filter.field 40493 ); 40494 }) }) 40495 ] }) 40496 ); 40497 } 40498 function AddFilter({ filters, view, onChangeView, setOpenedFilter }, ref) { 40499 if (!filters.length || filters.every(({ isPrimary }) => isPrimary)) { 40500 return null; 40501 } 40502 const inactiveFilters = filters.filter((filter) => !filter.isVisible); 40503 return /* @__PURE__ */ (0, import_jsx_runtime155.jsx)( 40504 AddFilterMenu, 40505 { 40506 triggerProps: { 40507 render: /* @__PURE__ */ (0, import_jsx_runtime155.jsx)( 40508 import_components24.Button, 40509 { 40510 accessibleWhenDisabled: true, 40511 size: "compact", 40512 className: "dataviews-filters-button", 40513 variant: "tertiary", 40514 disabled: !inactiveFilters.length, 40515 ref 40516 } 40517 ), 40518 children: (0, import_i18n42.__)("Add filter") 40519 }, 40520 ...{ filters, view, onChangeView, setOpenedFilter } 40521 } 40522 ); 40523 } 40524 var add_filter_default = (0, import_element103.forwardRef)(AddFilter); 40525 40526 // packages/dataviews/build-module/components/dataviews-filters/reset-filters.mjs 40527 var import_components25 = __toESM(require_components(), 1); 40528 var import_i18n43 = __toESM(require_i18n(), 1); 40529 var import_jsx_runtime156 = __toESM(require_jsx_runtime(), 1); 40530 function ResetFilter({ 40531 filters, 40532 view, 40533 onChangeView 40534 }) { 40535 const isPrimary = (field) => filters.some( 40536 (_filter) => _filter.field === field && _filter.isPrimary 40537 ); 40538 const isDisabled = !view.search && !view.filters?.some( 40539 (_filter) => !_filter.isLocked && (_filter.value !== void 0 || !isPrimary(_filter.field)) 40540 ); 40541 return /* @__PURE__ */ (0, import_jsx_runtime156.jsx)( 40542 import_components25.Button, 40543 { 40544 disabled: isDisabled, 40545 accessibleWhenDisabled: true, 40546 size: "compact", 40547 variant: "tertiary", 40548 className: "dataviews-filters__reset-button", 40549 onClick: () => { 40550 onChangeView({ 40551 ...view, 40552 page: 1, 40553 search: "", 40554 filters: view.filters?.filter((f) => !!f.isLocked) || [] 40555 }); 40556 }, 40557 children: (0, import_i18n43.__)("Reset") 40558 } 40559 ); 40560 } 40561 40562 // packages/dataviews/build-module/components/dataviews-filters/use-filters.mjs 40563 var import_element104 = __toESM(require_element(), 1); 40564 function useFilters(fields, view) { 40565 return (0, import_element104.useMemo)(() => { 40566 const filters = []; 40567 fields.forEach((field) => { 40568 if (field.filterBy === false || !field.hasElements && !field.Edit) { 40569 return; 40570 } 40571 const operators = field.filterBy.operators; 40572 const isPrimary = !!field.filterBy?.isPrimary; 40573 const isLocked = view.filters?.some( 40574 (f) => f.field === field.id && !!f.isLocked 40575 ) ?? false; 40576 filters.push({ 40577 field: field.id, 40578 name: field.label, 40579 elements: field.elements, 40580 getElements: field.getElements, 40581 hasElements: field.hasElements, 40582 singleSelection: operators.some( 40583 (op) => isSingleSelectionOperator(op) 40584 ), 40585 operators, 40586 isVisible: isLocked || isPrimary || !!view.filters?.some( 40587 (f) => f.field === field.id && isRegisteredOperator(f.operator) 40588 ), 40589 isPrimary, 40590 isLocked 40591 }); 40592 }); 40593 filters.sort((a, b) => { 40594 if (a.isLocked && !b.isLocked) { 40595 return -1; 40596 } 40597 if (!a.isLocked && b.isLocked) { 40598 return 1; 40599 } 40600 if (a.isPrimary && !b.isPrimary) { 40601 return -1; 40602 } 40603 if (!a.isPrimary && b.isPrimary) { 40604 return 1; 40605 } 40606 return a.name.localeCompare(b.name); 40607 }); 40608 return filters; 40609 }, [fields, view]); 40610 } 40611 var use_filters_default = useFilters; 40612 40613 // packages/dataviews/build-module/components/dataviews-filters/filters.mjs 40614 var import_jsx_runtime157 = __toESM(require_jsx_runtime(), 1); 40615 function Filters({ className }) { 40616 const { fields, view, onChangeView, openedFilter, setOpenedFilter } = (0, import_element105.useContext)(dataviews_context_default); 40617 const addFilterRef = (0, import_element105.useRef)(null); 40618 const filters = use_filters_default(fields, view); 40619 const addFilter = /* @__PURE__ */ (0, import_jsx_runtime157.jsx)( 40620 add_filter_default, 40621 { 40622 filters, 40623 view, 40624 onChangeView, 40625 ref: addFilterRef, 40626 setOpenedFilter 40627 }, 40628 "add-filter" 40629 ); 40630 const visibleFilters = filters.filter((filter) => filter.isVisible); 40631 if (visibleFilters.length === 0) { 40632 return null; 40633 } 40634 const filterComponents = [ 40635 ...visibleFilters.map((filter) => { 40636 return /* @__PURE__ */ (0, import_jsx_runtime157.jsx)( 40637 Filter, 40638 { 40639 filter, 40640 view, 40641 fields, 40642 onChangeView, 40643 addFilterRef, 40644 openedFilter 40645 }, 40646 filter.field 40647 ); 40648 }), 40649 addFilter 40650 ]; 40651 filterComponents.push( 40652 /* @__PURE__ */ (0, import_jsx_runtime157.jsx)( 40653 ResetFilter, 40654 { 40655 filters, 40656 view, 40657 onChangeView 40658 }, 40659 "reset-filters" 40660 ) 40661 ); 40662 return /* @__PURE__ */ (0, import_jsx_runtime157.jsx)( 40663 Stack, 40664 { 40665 direction: "row", 40666 justify: "flex-start", 40667 gap: "sm", 40668 style: { width: "fit-content" }, 40669 wrap: "wrap", 40670 className, 40671 children: filterComponents 40672 } 40673 ); 40674 } 40675 var filters_default = (0, import_element105.memo)(Filters); 40676 40677 // packages/dataviews/build-module/components/dataviews-filters/toggle.mjs 40678 var import_element106 = __toESM(require_element(), 1); 40679 var import_components26 = __toESM(require_components(), 1); 40680 var import_i18n44 = __toESM(require_i18n(), 1); 40681 var import_jsx_runtime158 = __toESM(require_jsx_runtime(), 1); 40682 function FiltersToggle() { 40683 const { 40684 filters, 40685 view, 40686 onChangeView, 40687 setOpenedFilter, 40688 isShowingFilter, 40689 setIsShowingFilter 40690 } = (0, import_element106.useContext)(dataviews_context_default); 40691 const buttonRef = (0, import_element106.useRef)(null); 40692 const onChangeViewWithFilterVisibility = (0, import_element106.useCallback)( 40693 (_view) => { 40694 onChangeView(_view); 40695 setIsShowingFilter(true); 40696 }, 40697 [onChangeView, setIsShowingFilter] 40698 ); 40699 if (filters.length === 0) { 40700 return null; 40701 } 40702 const hasVisibleFilters = filters.some((filter) => filter.isVisible); 40703 const addFilterButtonProps = { 40704 label: (0, import_i18n44.__)("Add filter"), 40705 "aria-expanded": false, 40706 isPressed: false 40707 }; 40708 const toggleFiltersButtonProps = { 40709 label: (0, import_i18n44._x)("Filter", "verb"), 40710 "aria-expanded": isShowingFilter, 40711 isPressed: isShowingFilter, 40712 onClick: () => { 40713 if (!isShowingFilter) { 40714 setOpenedFilter(null); 40715 } 40716 setIsShowingFilter(!isShowingFilter); 40717 } 40718 }; 40719 const hasPrimaryOrLockedFilters = filters.some( 40720 (filter) => filter.isPrimary || filter.isLocked 40721 ); 40722 const buttonComponent = /* @__PURE__ */ (0, import_jsx_runtime158.jsx)( 40723 import_components26.Button, 40724 { 40725 ref: buttonRef, 40726 className: "dataviews-filters__visibility-toggle", 40727 size: "compact", 40728 icon: funnel_default, 40729 disabled: hasPrimaryOrLockedFilters, 40730 accessibleWhenDisabled: true, 40731 ...hasVisibleFilters ? toggleFiltersButtonProps : addFilterButtonProps 40732 } 40733 ); 40734 return /* @__PURE__ */ (0, import_jsx_runtime158.jsx)("div", { className: "dataviews-filters__container-visibility-toggle", children: !hasVisibleFilters ? /* @__PURE__ */ (0, import_jsx_runtime158.jsx)( 40735 AddFilterMenu, 40736 { 40737 filters, 40738 view, 40739 onChangeView: onChangeViewWithFilterVisibility, 40740 setOpenedFilter, 40741 triggerProps: { render: buttonComponent } 40742 } 40743 ) : /* @__PURE__ */ (0, import_jsx_runtime158.jsx)( 40744 FilterVisibilityToggle, 40745 { 40746 buttonRef, 40747 filtersCount: view.filters?.length, 40748 children: buttonComponent 40749 } 40750 ) }); 40751 } 40752 function FilterVisibilityToggle({ 40753 buttonRef, 40754 filtersCount, 40755 children 40756 }) { 40757 (0, import_element106.useEffect)( 40758 () => () => { 40759 buttonRef.current?.focus(); 40760 }, 40761 [buttonRef] 40762 ); 40763 return /* @__PURE__ */ (0, import_jsx_runtime158.jsxs)(import_jsx_runtime158.Fragment, { children: [ 40764 children, 40765 !!filtersCount && /* @__PURE__ */ (0, import_jsx_runtime158.jsx)("span", { className: "dataviews-filters-toggle__count", children: filtersCount }) 40766 ] }); 40767 } 40768 var toggle_default = FiltersToggle; 40769 40770 // packages/dataviews/build-module/components/dataviews-filters/filters-toggled.mjs 40771 var import_element107 = __toESM(require_element(), 1); 40772 var import_jsx_runtime159 = __toESM(require_jsx_runtime(), 1); 40773 function FiltersToggled(props) { 40774 const { isShowingFilter } = (0, import_element107.useContext)(dataviews_context_default); 40775 if (!isShowingFilter) { 40776 return null; 40777 } 40778 return /* @__PURE__ */ (0, import_jsx_runtime159.jsx)(filters_default, { ...props }); 40779 } 40780 var filters_toggled_default = FiltersToggled; 40781 40782 // packages/dataviews/build-module/components/dataviews-layout/index.mjs 40783 var import_element108 = __toESM(require_element(), 1); 40784 var import_components27 = __toESM(require_components(), 1); 40785 var import_i18n45 = __toESM(require_i18n(), 1); 40786 var import_jsx_runtime160 = __toESM(require_jsx_runtime(), 1); 40787 function DataViewsLayout({ className }) { 40788 const { 40789 actions = [], 40790 data, 40791 fields, 40792 getItemId, 40793 getItemLevel, 40794 hasInitiallyLoaded, 40795 isLoading, 40796 view, 40797 onChangeView, 40798 selection, 40799 onChangeSelection, 40800 setOpenedFilter, 40801 onClickItem, 40802 isItemClickable: isItemClickable2, 40803 renderItemLink, 40804 defaultLayouts: defaultLayouts2, 40805 containerRef, 40806 empty = /* @__PURE__ */ (0, import_jsx_runtime160.jsx)("p", { children: (0, import_i18n45.__)("No results") }) 40807 } = (0, import_element108.useContext)(dataviews_context_default); 40808 const isDelayedInitialLoading = useDelayedLoading(!hasInitiallyLoaded, { 40809 delay: 200 40810 }); 40811 if (!hasInitiallyLoaded) { 40812 if (!isDelayedInitialLoading) { 40813 return null; 40814 } 40815 return /* @__PURE__ */ (0, import_jsx_runtime160.jsx)("div", { className: "dataviews-loading", children: /* @__PURE__ */ (0, import_jsx_runtime160.jsx)("p", { children: /* @__PURE__ */ (0, import_jsx_runtime160.jsx)(import_components27.Spinner, {}) }) }); 40816 } 40817 const ViewComponent = VIEW_LAYOUTS.find( 40818 (v2) => v2.type === view.type && defaultLayouts2[v2.type] 40819 )?.component; 40820 return /* @__PURE__ */ (0, import_jsx_runtime160.jsx)("div", { className: "dataviews-layout__container", ref: containerRef, children: /* @__PURE__ */ (0, import_jsx_runtime160.jsx)( 40821 ViewComponent, 40822 { 40823 className, 40824 actions, 40825 data, 40826 fields, 40827 getItemId, 40828 getItemLevel, 40829 isLoading, 40830 onChangeView, 40831 onChangeSelection, 40832 selection, 40833 setOpenedFilter, 40834 onClickItem, 40835 renderItemLink, 40836 isItemClickable: isItemClickable2, 40837 view, 40838 empty 40839 } 40840 ) }); 40841 } 40842 40843 // packages/dataviews/build-module/components/dataviews-search/index.mjs 40844 var import_i18n46 = __toESM(require_i18n(), 1); 40845 var import_element109 = __toESM(require_element(), 1); 40846 var import_components28 = __toESM(require_components(), 1); 40847 var import_compose14 = __toESM(require_compose(), 1); 40848 var import_jsx_runtime161 = __toESM(require_jsx_runtime(), 1); 40849 var DataViewsSearch = (0, import_element109.memo)(function Search({ label }) { 40850 const { view, onChangeView } = (0, import_element109.useContext)(dataviews_context_default); 40851 const [search, setSearch, debouncedSearch] = (0, import_compose14.useDebouncedInput)( 40852 view.search 40853 ); 40854 (0, import_element109.useEffect)(() => { 40855 if (view.search !== debouncedSearch) { 40856 setSearch(view.search ?? ""); 40857 } 40858 }, [view.search, setSearch]); 40859 const onChangeViewRef = (0, import_element109.useRef)(onChangeView); 40860 const viewRef = (0, import_element109.useRef)(view); 40861 (0, import_element109.useEffect)(() => { 40862 onChangeViewRef.current = onChangeView; 40863 viewRef.current = view; 40864 }, [onChangeView, view]); 40865 (0, import_element109.useEffect)(() => { 40866 if (debouncedSearch !== viewRef.current?.search) { 40867 onChangeViewRef.current({ 40868 ...viewRef.current, 40869 page: view.page ? 1 : void 0, 40870 startPosition: view.startPosition ? 1 : void 0, 40871 search: debouncedSearch 40872 }); 40873 } 40874 }, [debouncedSearch]); 40875 const searchLabel = label || (0, import_i18n46.__)("Search"); 40876 return /* @__PURE__ */ (0, import_jsx_runtime161.jsx)( 40877 import_components28.SearchControl, 40878 { 40879 className: "dataviews-search", 40880 onChange: setSearch, 40881 value: search, 40882 label: searchLabel, 40883 placeholder: searchLabel, 40884 size: "compact" 40885 } 40886 ); 40887 }); 40888 var dataviews_search_default = DataViewsSearch; 40889 40890 // packages/dataviews/build-module/components/dataviews-view-config/index.mjs 40891 var import_components29 = __toESM(require_components(), 1); 40892 var import_i18n47 = __toESM(require_i18n(), 1); 40893 var import_element110 = __toESM(require_element(), 1); 40894 var import_warning = __toESM(require_warning(), 1); 40895 var import_compose15 = __toESM(require_compose(), 1); 40896 var import_jsx_runtime162 = __toESM(require_jsx_runtime(), 1); 40897 var DATAVIEWS_CONFIG_POPOVER_PROPS = { 40898 className: "dataviews-config__popover", 40899 placement: "bottom-end", 40900 offset: 9 40901 }; 40902 function ViewTypeMenu() { 40903 const { view, onChangeView, defaultLayouts: defaultLayouts2 } = (0, import_element110.useContext)(dataviews_context_default); 40904 const availableLayouts = Object.keys(defaultLayouts2); 40905 if (availableLayouts.length <= 1) { 40906 return null; 40907 } 40908 const activeView = VIEW_LAYOUTS.find((v2) => view.type === v2.type); 40909 return /* @__PURE__ */ (0, import_jsx_runtime162.jsxs)(menu_exports.Root, { children: [ 40910 /* @__PURE__ */ (0, import_jsx_runtime162.jsx)( 40911 menu_exports.Trigger, 40912 { 40913 render: /* @__PURE__ */ (0, import_jsx_runtime162.jsx)( 40914 import_components29.Button, 40915 { 40916 size: "compact", 40917 icon: activeView?.icon, 40918 label: (0, import_i18n47.__)("Layout") 40919 } 40920 ) 40921 } 40922 ), 40923 /* @__PURE__ */ (0, import_jsx_runtime162.jsx)(menu_exports.Popup, { children: /* @__PURE__ */ (0, import_jsx_runtime162.jsx)( 40924 menu_exports.RadioGroup, 40925 { 40926 value: view.type, 40927 onValueChange: (value) => { 40928 switch (value) { 40929 case "list": 40930 case "grid": 40931 case "table": 40932 case "pickerGrid": 40933 case "pickerTable": 40934 case "pickerActivity": 40935 case "activity": 40936 const viewWithoutLayout = { ...view }; 40937 if ("layout" in viewWithoutLayout) { 40938 delete viewWithoutLayout.layout; 40939 } 40940 return onChangeView({ 40941 ...viewWithoutLayout, 40942 type: value, 40943 ...defaultLayouts2[value] 40944 }); 40945 } 40946 (0, import_warning.default)("Invalid dataview"); 40947 }, 40948 children: availableLayouts.map((layout) => { 40949 const config = VIEW_LAYOUTS.find( 40950 (v2) => v2.type === layout 40951 ); 40952 if (!config) { 40953 return null; 40954 } 40955 return /* @__PURE__ */ (0, import_jsx_runtime162.jsx)( 40956 menu_exports.RadioItem, 40957 { 40958 value: layout, 40959 closeOnClick: true, 40960 children: /* @__PURE__ */ (0, import_jsx_runtime162.jsx)(menu_exports.ItemLabel, { children: config.label }) 40961 }, 40962 layout 40963 ); 40964 }) 40965 } 40966 ) }) 40967 ] }); 40968 } 40969 function SortFieldControl() { 40970 const { view, fields, onChangeView } = (0, import_element110.useContext)(dataviews_context_default); 40971 const orderOptions = (0, import_element110.useMemo)(() => { 40972 const sortableFields = fields.filter( 40973 (field) => field.enableSorting !== false 40974 ); 40975 return sortableFields.map((field) => { 40976 return { 40977 label: field.label, 40978 value: field.id 40979 }; 40980 }); 40981 }, [fields]); 40982 return /* @__PURE__ */ (0, import_jsx_runtime162.jsx)( 40983 import_components29.SelectControl, 40984 { 40985 label: (0, import_i18n47.__)("Sort by"), 40986 value: view.sort?.field, 40987 options: orderOptions, 40988 onChange: (value) => { 40989 onChangeView({ 40990 ...view, 40991 sort: { 40992 direction: view?.sort?.direction || "desc", 40993 field: value 40994 }, 40995 showLevels: false 40996 }); 40997 } 40998 } 40999 ); 41000 } 41001 function SortDirectionControl() { 41002 const { view, fields, onChangeView } = (0, import_element110.useContext)(dataviews_context_default); 41003 const sortableFields = fields.filter( 41004 (field) => field.enableSorting !== false 41005 ); 41006 if (sortableFields.length === 0) { 41007 return null; 41008 } 41009 let value = view.sort?.direction; 41010 if (!value && view.sort?.field) { 41011 value = "desc"; 41012 } 41013 return /* @__PURE__ */ (0, import_jsx_runtime162.jsx)( 41014 import_components29.__experimentalToggleGroupControl, 41015 { 41016 className: "dataviews-view-config__sort-direction", 41017 isBlock: true, 41018 label: (0, import_i18n47.__)("Order"), 41019 value, 41020 onChange: (newDirection) => { 41021 if (newDirection === "asc" || newDirection === "desc") { 41022 onChangeView({ 41023 ...view, 41024 sort: { 41025 direction: newDirection, 41026 field: view.sort?.field || // If there is no field assigned as the sorting field assign the first sortable field. 41027 fields.find( 41028 (field) => field.enableSorting !== false 41029 )?.id || "" 41030 }, 41031 showLevels: false 41032 }); 41033 return; 41034 } 41035 (0, import_warning.default)("Invalid direction"); 41036 }, 41037 children: SORTING_DIRECTIONS.map((direction) => { 41038 return /* @__PURE__ */ (0, import_jsx_runtime162.jsx)( 41039 import_components29.__experimentalToggleGroupControlOptionIcon, 41040 { 41041 value: direction, 41042 icon: sortIcons[direction], 41043 label: sortLabels[direction] 41044 }, 41045 direction 41046 ); 41047 }) 41048 } 41049 ); 41050 } 41051 function ItemsPerPageControl() { 41052 const { view, config, onChangeView } = (0, import_element110.useContext)(dataviews_context_default); 41053 const { infiniteScrollEnabled } = view; 41054 if (!config || !config.perPageSizes || config.perPageSizes.length < 2 || config.perPageSizes.length > 6 || infiniteScrollEnabled) { 41055 return null; 41056 } 41057 return /* @__PURE__ */ (0, import_jsx_runtime162.jsx)( 41058 import_components29.__experimentalToggleGroupControl, 41059 { 41060 isBlock: true, 41061 label: (0, import_i18n47.__)("Items per page"), 41062 value: view.perPage || 10, 41063 disabled: !view?.sort?.field, 41064 onChange: (newItemsPerPage) => { 41065 const newItemsPerPageNumber = typeof newItemsPerPage === "number" || newItemsPerPage === void 0 ? newItemsPerPage : parseInt(newItemsPerPage, 10); 41066 onChangeView({ 41067 ...view, 41068 perPage: newItemsPerPageNumber, 41069 page: 1 41070 }); 41071 }, 41072 children: config.perPageSizes.map((value) => { 41073 return /* @__PURE__ */ (0, import_jsx_runtime162.jsx)( 41074 import_components29.__experimentalToggleGroupControlOption, 41075 { 41076 value, 41077 label: value.toString() 41078 }, 41079 value 41080 ); 41081 }) 41082 } 41083 ); 41084 } 41085 function ResetViewButton() { 41086 const { onReset } = (0, import_element110.useContext)(dataviews_context_default); 41087 if (onReset === void 0) { 41088 return null; 41089 } 41090 const isDisabled = onReset === false; 41091 return /* @__PURE__ */ (0, import_jsx_runtime162.jsx)( 41092 import_components29.Button, 41093 { 41094 variant: "tertiary", 41095 size: "compact", 41096 disabled: isDisabled, 41097 accessibleWhenDisabled: true, 41098 className: "dataviews-view-config__reset-button", 41099 onClick: () => { 41100 if (typeof onReset === "function") { 41101 onReset(); 41102 } 41103 }, 41104 children: (0, import_i18n47.__)("Reset view") 41105 } 41106 ); 41107 } 41108 function DataviewsViewConfigDropdown() { 41109 const { view, onReset } = (0, import_element110.useContext)(dataviews_context_default); 41110 const popoverId = (0, import_compose15.useInstanceId)( 41111 _DataViewsViewConfig, 41112 "dataviews-view-config-dropdown" 41113 ); 41114 const activeLayout = VIEW_LAYOUTS.find( 41115 (layout) => layout.type === view.type 41116 ); 41117 const isModified = typeof onReset === "function"; 41118 return /* @__PURE__ */ (0, import_jsx_runtime162.jsx)( 41119 import_components29.Dropdown, 41120 { 41121 expandOnMobile: true, 41122 popoverProps: { 41123 ...DATAVIEWS_CONFIG_POPOVER_PROPS, 41124 id: popoverId 41125 }, 41126 renderToggle: ({ onToggle, isOpen }) => { 41127 return /* @__PURE__ */ (0, import_jsx_runtime162.jsxs)("div", { className: "dataviews-view-config__toggle-wrapper", children: [ 41128 /* @__PURE__ */ (0, import_jsx_runtime162.jsx)( 41129 import_components29.Button, 41130 { 41131 size: "compact", 41132 icon: cog_default, 41133 label: (0, import_i18n47._x)( 41134 "View options", 41135 "View is used as a noun" 41136 ), 41137 onClick: onToggle, 41138 "aria-expanded": isOpen ? "true" : "false", 41139 "aria-controls": popoverId 41140 } 41141 ), 41142 isModified && /* @__PURE__ */ (0, import_jsx_runtime162.jsx)("span", { className: "dataviews-view-config__modified-indicator" }) 41143 ] }); 41144 }, 41145 renderContent: () => /* @__PURE__ */ (0, import_jsx_runtime162.jsx)( 41146 import_components29.__experimentalDropdownContentWrapper, 41147 { 41148 paddingSize: "medium", 41149 className: "dataviews-config__popover-content-wrapper", 41150 children: /* @__PURE__ */ (0, import_jsx_runtime162.jsxs)( 41151 Stack, 41152 { 41153 direction: "column", 41154 className: "dataviews-view-config", 41155 gap: "xl", 41156 children: [ 41157 /* @__PURE__ */ (0, import_jsx_runtime162.jsxs)( 41158 Stack, 41159 { 41160 direction: "row", 41161 justify: "space-between", 41162 align: "center", 41163 className: "dataviews-view-config__header", 41164 children: [ 41165 /* @__PURE__ */ (0, import_jsx_runtime162.jsx)( 41166 import_components29.__experimentalHeading, 41167 { 41168 level: 2, 41169 className: "dataviews-settings-section__title", 41170 children: (0, import_i18n47.__)("Appearance") 41171 } 41172 ), 41173 /* @__PURE__ */ (0, import_jsx_runtime162.jsx)(ResetViewButton, {}) 41174 ] 41175 } 41176 ), 41177 /* @__PURE__ */ (0, import_jsx_runtime162.jsxs)(Stack, { direction: "column", gap: "lg", children: [ 41178 /* @__PURE__ */ (0, import_jsx_runtime162.jsxs)( 41179 Stack, 41180 { 41181 direction: "row", 41182 gap: "sm", 41183 className: "dataviews-view-config__sort-controls", 41184 children: [ 41185 /* @__PURE__ */ (0, import_jsx_runtime162.jsx)(SortFieldControl, {}), 41186 /* @__PURE__ */ (0, import_jsx_runtime162.jsx)(SortDirectionControl, {}) 41187 ] 41188 } 41189 ), 41190 !!activeLayout?.viewConfigOptions && /* @__PURE__ */ (0, import_jsx_runtime162.jsx)(activeLayout.viewConfigOptions, {}), 41191 /* @__PURE__ */ (0, import_jsx_runtime162.jsx)(ItemsPerPageControl, {}), 41192 /* @__PURE__ */ (0, import_jsx_runtime162.jsx)(PropertiesSection, {}) 41193 ] }) 41194 ] 41195 } 41196 ) 41197 } 41198 ) 41199 } 41200 ); 41201 } 41202 function _DataViewsViewConfig() { 41203 return /* @__PURE__ */ (0, import_jsx_runtime162.jsxs)(import_jsx_runtime162.Fragment, { children: [ 41204 /* @__PURE__ */ (0, import_jsx_runtime162.jsx)(ViewTypeMenu, {}), 41205 /* @__PURE__ */ (0, import_jsx_runtime162.jsx)(DataviewsViewConfigDropdown, {}) 41206 ] }); 41207 } 41208 var DataViewsViewConfig = (0, import_element110.memo)(_DataViewsViewConfig); 41209 var dataviews_view_config_default = DataViewsViewConfig; 41210 41211 // packages/dataviews/build-module/components/dataform-controls/checkbox.mjs 41212 var import_element119 = __toESM(require_element(), 1); 41213 41214 // packages/dataviews/build-module/components/validated-form-controls/checkbox-control.mjs 41215 var import_element111 = __toESM(require_element(), 1); 41216 var import_compose16 = __toESM(require_compose(), 1); 41217 var import_components30 = __toESM(require_components(), 1); 41218 var import_jsx_runtime163 = __toESM(require_jsx_runtime(), 1); 41219 var UnforwardedValidatedCheckboxControl = ({ 41220 required, 41221 customValidity, 41222 markWhenOptional, 41223 ...restProps 41224 }, forwardedRef) => { 41225 const validityTargetRef = (0, import_element111.useRef)(null); 41226 const mergedRefs = (0, import_compose16.useMergeRefs)([forwardedRef, validityTargetRef]); 41227 return /* @__PURE__ */ (0, import_jsx_runtime163.jsx)( 41228 ControlWithError, 41229 { 41230 className: "dataviews-validated-control", 41231 required, 41232 markWhenOptional, 41233 ref: mergedRefs, 41234 customValidity, 41235 getValidityTarget: () => validityTargetRef.current?.querySelector( 41236 'input[type="checkbox"]' 41237 ), 41238 children: /* @__PURE__ */ (0, import_jsx_runtime163.jsx)( 41239 import_components30.CheckboxControl, 41240 { 41241 ...restProps 41242 } 41243 ) 41244 } 41245 ); 41246 }; 41247 var ValidatedCheckboxControl = (0, import_element111.forwardRef)(UnforwardedValidatedCheckboxControl); 41248 ValidatedCheckboxControl.displayName = "ValidatedCheckboxControl"; 41249 41250 // packages/dataviews/build-module/components/validated-form-controls/combobox-control.mjs 41251 var import_element112 = __toESM(require_element(), 1); 41252 var import_compose17 = __toESM(require_compose(), 1); 41253 var import_components31 = __toESM(require_components(), 1); 41254 var import_jsx_runtime164 = __toESM(require_jsx_runtime(), 1); 41255 var UnforwardedValidatedComboboxControl = ({ 41256 required, 41257 customValidity, 41258 markWhenOptional, 41259 ...restProps 41260 }, forwardedRef) => { 41261 const validityTargetRef = (0, import_element112.useRef)(null); 41262 const mergedRefs = (0, import_compose17.useMergeRefs)([forwardedRef, validityTargetRef]); 41263 (0, import_element112.useEffect)(() => { 41264 const input = validityTargetRef.current?.querySelector( 41265 'input[role="combobox"]' 41266 ); 41267 if (input) { 41268 input.required = required ?? false; 41269 } 41270 }, [required]); 41271 return ( 41272 // TODO: Bug - Missing value error is not cleared immediately on change, waits for blur. 41273 /* @__PURE__ */ (0, import_jsx_runtime164.jsx)( 41274 ControlWithError, 41275 { 41276 className: "dataviews-validated-control", 41277 required, 41278 markWhenOptional, 41279 ref: mergedRefs, 41280 customValidity, 41281 getValidityTarget: () => validityTargetRef.current?.querySelector( 41282 'input[role="combobox"]' 41283 ), 41284 children: /* @__PURE__ */ (0, import_jsx_runtime164.jsx)(import_components31.ComboboxControl, { ...restProps }) 41285 } 41286 ) 41287 ); 41288 }; 41289 var ValidatedComboboxControl = (0, import_element112.forwardRef)(UnforwardedValidatedComboboxControl); 41290 ValidatedComboboxControl.displayName = "ValidatedComboboxControl"; 41291 41292 // packages/dataviews/build-module/components/validated-form-controls/form-token-field.mjs 41293 var import_element113 = __toESM(require_element(), 1); 41294 var import_components32 = __toESM(require_components(), 1); 41295 var import_jsx_runtime165 = __toESM(require_jsx_runtime(), 1); 41296 var UnforwardedValidatedFormTokenField = ({ 41297 required, 41298 customValidity, 41299 markWhenOptional, 41300 ...restProps 41301 }, forwardedRef) => { 41302 const validityTargetRef = (0, import_element113.useRef)(null); 41303 return /* @__PURE__ */ (0, import_jsx_runtime165.jsxs)( 41304 "div", 41305 { 41306 className: "dataviews-validated-control__wrapper-with-error-delegate", 41307 ref: forwardedRef, 41308 children: [ 41309 /* @__PURE__ */ (0, import_jsx_runtime165.jsx)( 41310 ControlWithError, 41311 { 41312 className: "dataviews-validated-control", 41313 required, 41314 markWhenOptional, 41315 customValidity, 41316 getValidityTarget: () => validityTargetRef.current, 41317 children: /* @__PURE__ */ (0, import_jsx_runtime165.jsx)(import_components32.FormTokenField, { ...restProps }) 41318 } 41319 ), 41320 /* @__PURE__ */ (0, import_jsx_runtime165.jsx)( 41321 "input", 41322 { 41323 className: "dataviews-validated-control__error-delegate", 41324 type: "text", 41325 ref: validityTargetRef, 41326 required, 41327 value: restProps.value && restProps.value.length > 0 ? "hasvalue" : "", 41328 tabIndex: -1, 41329 onChange: () => { 41330 }, 41331 onFocus: (e) => { 41332 e.target.previousElementSibling?.querySelector( 41333 'input[type="text"]' 41334 )?.focus(); 41335 } 41336 } 41337 ) 41338 ] 41339 } 41340 ); 41341 }; 41342 var ValidatedFormTokenField = (0, import_element113.forwardRef)(UnforwardedValidatedFormTokenField); 41343 ValidatedFormTokenField.displayName = "ValidatedFormTokenField"; 41344 41345 // packages/dataviews/build-module/components/validated-form-controls/number-control.mjs 41346 var import_element114 = __toESM(require_element(), 1); 41347 var import_compose18 = __toESM(require_compose(), 1); 41348 var import_components33 = __toESM(require_components(), 1); 41349 var import_jsx_runtime166 = __toESM(require_jsx_runtime(), 1); 41350 var UnforwardedValidatedNumberControl = ({ 41351 required, 41352 customValidity, 41353 markWhenOptional, 41354 ...restProps 41355 }, forwardedRef) => { 41356 const validityTargetRef = (0, import_element114.useRef)(null); 41357 const mergedRefs = (0, import_compose18.useMergeRefs)([forwardedRef, validityTargetRef]); 41358 return /* @__PURE__ */ (0, import_jsx_runtime166.jsx)( 41359 ControlWithError, 41360 { 41361 className: "dataviews-validated-control", 41362 required, 41363 markWhenOptional, 41364 customValidity, 41365 getValidityTarget: () => validityTargetRef.current, 41366 children: /* @__PURE__ */ (0, import_jsx_runtime166.jsx)(import_components33.__experimentalNumberControl, { ref: mergedRefs, ...restProps }) 41367 } 41368 ); 41369 }; 41370 var ValidatedNumberControl = (0, import_element114.forwardRef)(UnforwardedValidatedNumberControl); 41371 ValidatedNumberControl.displayName = "ValidatedNumberControl"; 41372 41373 // packages/dataviews/build-module/components/validated-form-controls/radio-control.mjs 41374 var import_element115 = __toESM(require_element(), 1); 41375 var import_compose19 = __toESM(require_compose(), 1); 41376 var import_components34 = __toESM(require_components(), 1); 41377 var import_jsx_runtime167 = __toESM(require_jsx_runtime(), 1); 41378 var UnforwardedValidatedRadioControl = ({ 41379 required, 41380 customValidity, 41381 markWhenOptional, 41382 ...restProps 41383 }, forwardedRef) => { 41384 const validityTargetRef = (0, import_element115.useRef)(null); 41385 const mergedRefs = (0, import_compose19.useMergeRefs)([forwardedRef, validityTargetRef]); 41386 return /* @__PURE__ */ (0, import_jsx_runtime167.jsx)( 41387 ControlWithError, 41388 { 41389 className: "dataviews-validated-control", 41390 required, 41391 markWhenOptional, 41392 ref: mergedRefs, 41393 customValidity, 41394 getValidityTarget: () => validityTargetRef.current?.querySelector( 41395 'input[type="radio"]' 41396 ), 41397 children: /* @__PURE__ */ (0, import_jsx_runtime167.jsx)(import_components34.RadioControl, { ...restProps }) 41398 } 41399 ); 41400 }; 41401 var ValidatedRadioControl = (0, import_element115.forwardRef)(UnforwardedValidatedRadioControl); 41402 ValidatedRadioControl.displayName = "ValidatedRadioControl"; 41403 41404 // packages/dataviews/build-module/components/validated-form-controls/select-control.mjs 41405 var import_element116 = __toESM(require_element(), 1); 41406 var import_compose20 = __toESM(require_compose(), 1); 41407 var import_components35 = __toESM(require_components(), 1); 41408 var import_jsx_runtime168 = __toESM(require_jsx_runtime(), 1); 41409 var UnforwardedValidatedSelectControl = ({ 41410 required, 41411 customValidity, 41412 markWhenOptional, 41413 ...restProps 41414 }, forwardedRef) => { 41415 const validityTargetRef = (0, import_element116.useRef)(null); 41416 const mergedRefs = (0, import_compose20.useMergeRefs)([forwardedRef, validityTargetRef]); 41417 return /* @__PURE__ */ (0, import_jsx_runtime168.jsx)( 41418 ControlWithError, 41419 { 41420 className: "dataviews-validated-control", 41421 required, 41422 markWhenOptional, 41423 customValidity, 41424 getValidityTarget: () => validityTargetRef.current, 41425 children: /* @__PURE__ */ (0, import_jsx_runtime168.jsx)( 41426 import_components35.SelectControl, 41427 { 41428 ref: mergedRefs, 41429 // A runtime boolean cannot statically discriminate 41430 // SelectControl's single/multiple props union. 41431 ...restProps 41432 } 41433 ) 41434 } 41435 ); 41436 }; 41437 var ValidatedSelectControl = (0, import_element116.forwardRef)(UnforwardedValidatedSelectControl); 41438 ValidatedSelectControl.displayName = "ValidatedSelectControl"; 41439 41440 // packages/dataviews/build-module/components/validated-form-controls/toggle-control.mjs 41441 var import_element117 = __toESM(require_element(), 1); 41442 var import_compose21 = __toESM(require_compose(), 1); 41443 var import_components36 = __toESM(require_components(), 1); 41444 var import_jsx_runtime169 = __toESM(require_jsx_runtime(), 1); 41445 var UnforwardedValidatedToggleControl = ({ 41446 required, 41447 customValidity, 41448 markWhenOptional, 41449 ...restProps 41450 }, forwardedRef) => { 41451 const validityTargetRef = (0, import_element117.useRef)(null); 41452 const mergedRefs = (0, import_compose21.useMergeRefs)([forwardedRef, validityTargetRef]); 41453 return /* @__PURE__ */ (0, import_jsx_runtime169.jsx)( 41454 ControlWithError, 41455 { 41456 className: "dataviews-validated-control", 41457 required, 41458 markWhenOptional, 41459 customValidity, 41460 getValidityTarget: () => validityTargetRef.current, 41461 children: /* @__PURE__ */ (0, import_jsx_runtime169.jsx)( 41462 import_components36.ToggleControl, 41463 { 41464 ref: mergedRefs, 41465 required, 41466 ...restProps 41467 } 41468 ) 41469 } 41470 ); 41471 }; 41472 var ValidatedToggleControl = (0, import_element117.forwardRef)(UnforwardedValidatedToggleControl); 41473 ValidatedToggleControl.displayName = "ValidatedToggleControl"; 41474 41475 // packages/dataviews/build-module/components/validated-form-controls/toggle-group-control.mjs 41476 var import_element118 = __toESM(require_element(), 1); 41477 var import_components37 = __toESM(require_components(), 1); 41478 var import_jsx_runtime170 = __toESM(require_jsx_runtime(), 1); 41479 var UnforwardedValidatedToggleGroupControl = ({ 41480 required, 41481 customValidity, 41482 markWhenOptional, 41483 ...restProps 41484 }, forwardedRef) => { 41485 const validityTargetRef = (0, import_element118.useRef)(null); 41486 const nameAttr = (0, import_element118.useId)(); 41487 return /* @__PURE__ */ (0, import_jsx_runtime170.jsxs)("div", { className: "dataviews-validated-control__wrapper-with-error-delegate", children: [ 41488 /* @__PURE__ */ (0, import_jsx_runtime170.jsx)( 41489 ControlWithError, 41490 { 41491 className: "dataviews-validated-control", 41492 required, 41493 markWhenOptional, 41494 customValidity, 41495 getValidityTarget: () => validityTargetRef.current, 41496 children: /* @__PURE__ */ (0, import_jsx_runtime170.jsx)(import_components37.__experimentalToggleGroupControl, { ref: forwardedRef, ...restProps }) 41497 } 41498 ), 41499 /* @__PURE__ */ (0, import_jsx_runtime170.jsx)( 41500 "input", 41501 { 41502 className: "dataviews-validated-control__error-delegate", 41503 type: "radio", 41504 ref: validityTargetRef, 41505 required, 41506 checked: restProps.value !== void 0, 41507 tabIndex: -1, 41508 name: nameAttr, 41509 onChange: () => { 41510 }, 41511 onFocus: (e) => { 41512 e.target.previousElementSibling?.querySelector( 41513 '[data-active-item="true"]' 41514 )?.focus(); 41515 } 41516 } 41517 ) 41518 ] }); 41519 }; 41520 var ValidatedToggleGroupControl = (0, import_element118.forwardRef)(UnforwardedValidatedToggleGroupControl); 41521 ValidatedToggleGroupControl.displayName = "ValidatedToggleGroupControl"; 41522 41523 // packages/dataviews/build-module/components/dataform-controls/utils/get-custom-validity.mjs 41524 function getCustomValidity(isValid2, validity) { 41525 let customValidity; 41526 if (isValid2?.required && validity?.required) { 41527 customValidity = validity.required.message ? { 41528 type: validity.required.type, 41529 message: validity.required.message 41530 } : void 0; 41531 } else if (isValid2?.pattern && validity?.pattern) { 41532 customValidity = validity.pattern; 41533 } else if (isValid2?.min && validity?.min) { 41534 customValidity = validity.min; 41535 } else if (isValid2?.max && validity?.max) { 41536 customValidity = validity.max; 41537 } else if (isValid2?.minLength && validity?.minLength) { 41538 customValidity = validity.minLength; 41539 } else if (isValid2?.maxLength && validity?.maxLength) { 41540 customValidity = validity.maxLength; 41541 } else if (isValid2?.elements && validity?.elements) { 41542 customValidity = validity.elements; 41543 } else if (validity?.custom) { 41544 customValidity = validity.custom; 41545 } 41546 return customValidity; 41547 } 41548 41549 // packages/dataviews/build-module/components/dataform-controls/checkbox.mjs 41550 var import_jsx_runtime171 = __toESM(require_jsx_runtime(), 1); 41551 function Checkbox({ 41552 field, 41553 onChange, 41554 data, 41555 hideLabelFromVision, 41556 markWhenOptional, 41557 validity 41558 }) { 41559 const { getValue, setValue, label, description, isValid: isValid2 } = field; 41560 const disabled2 = field.isDisabled({ item: data, field }); 41561 const onChangeControl = (0, import_element119.useCallback)(() => { 41562 onChange( 41563 setValue({ item: data, value: !getValue({ item: data }) }) 41564 ); 41565 }, [data, getValue, onChange, setValue]); 41566 return /* @__PURE__ */ (0, import_jsx_runtime171.jsx)( 41567 ValidatedCheckboxControl, 41568 { 41569 required: !!field.isValid?.required, 41570 markWhenOptional, 41571 customValidity: getCustomValidity(isValid2, validity), 41572 hidden: hideLabelFromVision, 41573 label, 41574 help: description, 41575 checked: getValue({ item: data }), 41576 onChange: onChangeControl, 41577 disabled: disabled2 41578 } 41579 ); 41580 } 41581 41582 // packages/dataviews/build-module/components/dataform-controls/combobox.mjs 41583 var import_components38 = __toESM(require_components(), 1); 41584 var import_element120 = __toESM(require_element(), 1); 41585 var import_jsx_runtime172 = __toESM(require_jsx_runtime(), 1); 41586 function Combobox3({ 41587 data, 41588 field, 41589 onChange, 41590 hideLabelFromVision, 41591 validity 41592 }) { 41593 const { label, description, placeholder, getValue, setValue, isValid: isValid2 } = field; 41594 const value = getValue({ item: data }) ?? ""; 41595 const onChangeControl = (0, import_element120.useCallback)( 41596 (newValue) => onChange(setValue({ item: data, value: newValue ?? "" })), 41597 [data, onChange, setValue] 41598 ); 41599 const { elements, isLoading } = useElements({ 41600 elements: field.elements, 41601 getElements: field.getElements 41602 }); 41603 if (isLoading) { 41604 return /* @__PURE__ */ (0, import_jsx_runtime172.jsx)(import_components38.Spinner, {}); 41605 } 41606 return /* @__PURE__ */ (0, import_jsx_runtime172.jsx)( 41607 ValidatedComboboxControl, 41608 { 41609 required: !!field.isValid?.required, 41610 customValidity: getCustomValidity(isValid2, validity), 41611 label, 41612 value, 41613 help: description, 41614 placeholder, 41615 options: elements, 41616 onChange: onChangeControl, 41617 hideLabelFromVision, 41618 allowReset: true, 41619 expandOnFocus: true 41620 } 41621 ); 41622 } 41623 41624 // packages/dataviews/build-module/components/dataform-controls/datetime.mjs 41625 var import_components40 = __toESM(require_components(), 1); 41626 var import_element123 = __toESM(require_element(), 1); 41627 var import_i18n50 = __toESM(require_i18n(), 1); 41628 var import_a11y2 = __toESM(require_a11y(), 1); 41629 var import_date5 = __toESM(require_date(), 1); 41630 41631 // packages/dataviews/build-module/components/dataform-controls/utils/relative-date-control.mjs 41632 var import_components39 = __toESM(require_components(), 1); 41633 var import_element121 = __toESM(require_element(), 1); 41634 var import_i18n48 = __toESM(require_i18n(), 1); 41635 var import_jsx_runtime173 = __toESM(require_jsx_runtime(), 1); 41636 var TIME_UNITS_OPTIONS = { 41637 [OPERATOR_IN_THE_PAST]: [ 41638 { value: "days", label: (0, import_i18n48.__)("Days") }, 41639 { value: "weeks", label: (0, import_i18n48.__)("Weeks") }, 41640 { value: "months", label: (0, import_i18n48.__)("Months") }, 41641 { value: "years", label: (0, import_i18n48.__)("Years") } 41642 ], 41643 [OPERATOR_OVER]: [ 41644 { value: "days", label: (0, import_i18n48.__)("Days ago") }, 41645 { value: "weeks", label: (0, import_i18n48.__)("Weeks ago") }, 41646 { value: "months", label: (0, import_i18n48.__)("Months ago") }, 41647 { value: "years", label: (0, import_i18n48.__)("Years ago") } 41648 ] 41649 }; 41650 function RelativeDateControl({ 41651 className, 41652 data, 41653 field, 41654 onChange, 41655 hideLabelFromVision, 41656 operator 41657 }) { 41658 const options = TIME_UNITS_OPTIONS[operator === OPERATOR_IN_THE_PAST ? "inThePast" : "over"]; 41659 const { id, label, description, getValue, setValue } = field; 41660 const disabled2 = field.isDisabled({ item: data, field }); 41661 const fieldValue = getValue({ item: data }); 41662 const { value: relValue = "", unit = options[0].value } = fieldValue && typeof fieldValue === "object" ? fieldValue : {}; 41663 const onChangeValue = (0, import_element121.useCallback)( 41664 (newValue) => onChange( 41665 setValue({ 41666 item: data, 41667 value: { value: Number(newValue), unit } 41668 }) 41669 ), 41670 [onChange, setValue, data, unit] 41671 ); 41672 const onChangeUnit = (0, import_element121.useCallback)( 41673 (newUnit) => onChange( 41674 setValue({ 41675 item: data, 41676 value: { value: relValue, unit: newUnit } 41677 }) 41678 ), 41679 [onChange, setValue, data, relValue] 41680 ); 41681 return /* @__PURE__ */ (0, import_jsx_runtime173.jsx)( 41682 import_components39.BaseControl, 41683 { 41684 id, 41685 className: clsx_default(className, "dataviews-controls__relative-date"), 41686 label, 41687 hideLabelFromVision, 41688 help: description, 41689 children: /* @__PURE__ */ (0, import_jsx_runtime173.jsxs)(Stack, { direction: "row", gap: "sm", children: [ 41690 /* @__PURE__ */ (0, import_jsx_runtime173.jsx)( 41691 import_components39.__experimentalNumberControl, 41692 { 41693 className: "dataviews-controls__relative-date-number", 41694 spinControls: "none", 41695 min: 1, 41696 step: 1, 41697 value: relValue, 41698 onChange: onChangeValue, 41699 disabled: disabled2 41700 } 41701 ), 41702 /* @__PURE__ */ (0, import_jsx_runtime173.jsx)( 41703 import_components39.SelectControl, 41704 { 41705 className: "dataviews-controls__relative-date-unit", 41706 label: (0, import_i18n48.__)("Unit"), 41707 value: unit, 41708 options, 41709 onChange: onChangeUnit, 41710 hideLabelFromVision: true, 41711 disabled: disabled2 41712 } 41713 ) 41714 ] }) 41715 } 41716 ); 41717 } 41718 41719 // packages/dataviews/build-module/components/dataform-controls/utils/to-calendar-date.mjs 41720 function toCalendarDate(date, timeZone) { 41721 return timeZone ? new TZDate(date, timeZone) : date; 41722 } 41723 41724 // packages/dataviews/build-module/components/dataform-controls/utils/use-disabled-date-matchers.mjs 41725 var import_element122 = __toESM(require_element(), 1); 41726 function useDisabledDateMatchers(isValid2, parseDateFn) { 41727 const minConstraint = typeof isValid2.min?.constraint === "string" ? isValid2.min.constraint : void 0; 41728 const maxConstraint = typeof isValid2.max?.constraint === "string" ? isValid2.max.constraint : void 0; 41729 const disabledMatchers = (0, import_element122.useMemo)(() => { 41730 const matchers = []; 41731 if (minConstraint) { 41732 const minDate = parseDateFn(minConstraint); 41733 if (minDate) { 41734 matchers.push({ before: minDate }); 41735 } 41736 } 41737 if (maxConstraint) { 41738 const maxDate = parseDateFn(maxConstraint); 41739 if (maxDate) { 41740 matchers.push({ after: maxDate }); 41741 } 41742 } 41743 return matchers.length > 0 ? matchers : void 0; 41744 }, [minConstraint, maxConstraint, parseDateFn]); 41745 return { minConstraint, maxConstraint, disabledMatchers }; 41746 } 41747 41748 // packages/dataviews/build-module/components/dataform-controls/utils/get-calendar-locale.mjs 41749 var LANGUAGE_ALIASES = { 41750 ary: "ar-MA", 41751 // Moroccan Arabic. 41752 haz: "fa" 41753 // Hazaragi, a variety of Persian. 41754 }; 41755 function getCalendarLocale(wpLocale) { 41756 const subtags = wpLocale?.trim().split(/[_-]/) ?? []; 41757 const language = subtags.shift()?.toLowerCase(); 41758 if (!language) { 41759 return void 0; 41760 } 41761 const normalized = [LANGUAGE_ALIASES[language] ?? language]; 41762 for (const subtag of subtags) { 41763 if (/^[a-z]{4}$/i.test(subtag) || /^([a-z]{2}|\d{3})$/i.test(subtag)) { 41764 normalized.push(subtag); 41765 } 41766 } 41767 return normalized.join("-"); 41768 } 41769 41770 // packages/dataviews/build-module/components/dataform-controls/utils/get-timezone-description.mjs 41771 var import_date3 = __toESM(require_date(), 1); 41772 var import_i18n49 = __toESM(require_i18n(), 1); 41773 function getTimezoneDescription() { 41774 const { timezone } = (0, import_date3.getSettings)(); 41775 const userTimezoneOffset = -1 * ((/* @__PURE__ */ new Date()).getTimezoneOffset() / 60); 41776 if (Number(timezone.offset) === userTimezoneOffset) { 41777 return void 0; 41778 } 41779 const offsetSymbol = Number(timezone.offset) >= 0 ? "+" : ""; 41780 const zoneAbbr = "" !== timezone.abbr && isNaN(Number(timezone.abbr)) ? timezone.abbr : `UTC$offsetSymbol}$timezone.offsetFormatted}`; 41781 const prettyTimezoneString = timezone.string.replaceAll("_", " "); 41782 let timezoneDetail = zoneAbbr; 41783 if ("UTC" === timezone.string) { 41784 timezoneDetail = (0, import_i18n49.__)("Coordinated Universal Time"); 41785 } else if (prettyTimezoneString.trim().length > 0) { 41786 timezoneDetail = `($zoneAbbr}) $prettyTimezoneString}`; 41787 } 41788 return (0, import_i18n49.sprintf)( 41789 /* translators: %s: timezone detail, e.g. "(CEST) Europe/Madrid" or "UTC+3". */ 41790 (0, import_i18n49.__)("Timezone: %s"), 41791 timezoneDetail 41792 ); 41793 } 41794 41795 // packages/dataviews/build-module/field-types/utils/parse-date-time.mjs 41796 var import_date4 = __toESM(require_date(), 1); 41797 function parseDateTime(dateTimeString) { 41798 if (!dateTimeString) { 41799 return null; 41800 } 41801 const parsed = (0, import_date4.getDate)(dateTimeString); 41802 return parsed && isValid(parsed) ? parsed : null; 41803 } 41804 41805 // packages/dataviews/build-module/components/dataform-controls/datetime.mjs 41806 var import_jsx_runtime174 = __toESM(require_jsx_runtime(), 1); 41807 var formatDateTime = (value) => { 41808 if (!value) { 41809 return ""; 41810 } 41811 return (0, import_date5.dateI18n)("Y-m-d\\TH:i", (0, import_date5.getDate)(value)); 41812 }; 41813 function CalendarDateTimeControl({ 41814 data, 41815 field, 41816 onChange, 41817 hideLabelFromVision, 41818 markWhenOptional, 41819 validity, 41820 config 41821 }) { 41822 const { compact } = config || {}; 41823 const { id, label, description, setValue, getValue, isValid: isValid2 } = field; 41824 const disabled2 = field.isDisabled({ item: data, field }); 41825 const fieldValue = getValue({ item: data }); 41826 const value = typeof fieldValue === "string" ? fieldValue : void 0; 41827 const { timezone } = (0, import_date5.getSettings)(); 41828 const timeZone = timezone.string || (0, import_date5.dateI18n)("P"); 41829 const [calendarMonth, setCalendarMonth] = (0, import_element123.useState)(() => { 41830 const parsedDate = parseDateTime(value); 41831 return toCalendarDate(parsedDate || /* @__PURE__ */ new Date(), timeZone); 41832 }); 41833 (0, import_element123.useEffect)(() => { 41834 const parsedDate = parseDateTime(value); 41835 if (parsedDate) { 41836 const targetMonth = toCalendarDate(parsedDate, timeZone); 41837 setCalendarMonth( 41838 (currentMonth) => isSameMonth( 41839 targetMonth, 41840 toCalendarDate(currentMonth, timeZone) 41841 ) ? currentMonth : targetMonth 41842 ); 41843 } 41844 }, [timeZone, value]); 41845 const inputControlRef = (0, import_element123.useRef)(null); 41846 const validationTimeoutRef = (0, import_element123.useRef)(void 0); 41847 const { minConstraint, maxConstraint, disabledMatchers } = useDisabledDateMatchers(isValid2, parseDateTime); 41848 const onChangeCallback = (0, import_element123.useCallback)( 41849 (newValue) => onChange(setValue({ item: data, value: newValue })), 41850 [data, onChange, setValue] 41851 ); 41852 (0, import_element123.useEffect)(() => { 41853 return () => clearTimeout(validationTimeoutRef.current); 41854 }, []); 41855 const onSelectDate = (0, import_element123.useCallback)( 41856 (newDate) => { 41857 if (newDate) { 41858 const wpDate = (0, import_date5.dateI18n)("Y-m-d", newDate); 41859 const wpTime = value ? (0, import_date5.dateI18n)("H:i", (0, import_date5.getDate)(value)) : "00:00"; 41860 const finalDateTime = (0, import_date5.getDate)(`$wpDate}T$wpTime}`); 41861 onChangeCallback(finalDateTime.toISOString()); 41862 } else { 41863 onChangeCallback(void 0); 41864 } 41865 clearTimeout(validationTimeoutRef.current); 41866 validationTimeoutRef.current = setTimeout(() => { 41867 const input = inputControlRef.current; 41868 if (!input) { 41869 return; 41870 } 41871 input.dispatchEvent( 41872 new Event("invalid", { cancelable: true }) 41873 ); 41874 if (input.validationMessage) { 41875 (0, import_a11y2.speak)(input.validationMessage); 41876 } 41877 }, 0); 41878 }, 41879 [onChangeCallback, value] 41880 ); 41881 const handleManualDateTimeChange = (0, import_element123.useCallback)( 41882 (newValue) => { 41883 if (newValue) { 41884 const dateTime = (0, import_date5.getDate)(newValue); 41885 onChangeCallback(dateTime.toISOString()); 41886 const parsedDate = parseDateTime(dateTime.toISOString()); 41887 if (parsedDate) { 41888 setCalendarMonth(toCalendarDate(parsedDate, timeZone)); 41889 } 41890 } else { 41891 onChangeCallback(void 0); 41892 } 41893 }, 41894 [onChangeCallback, timeZone] 41895 ); 41896 const { format: fieldFormat } = field; 41897 const weekStartsOn = fieldFormat.weekStartsOn ?? (0, import_date5.getSettings)().l10n.startOfWeek; 41898 const locale = getCalendarLocale((0, import_date5.getSettings)().l10n.locale); 41899 let displayLabel = label; 41900 if (isValid2?.required && !markWhenOptional && !hideLabelFromVision) { 41901 displayLabel = `$label} (${(0, import_i18n50.__)("Required")})`; 41902 } else if (!isValid2?.required && markWhenOptional && !hideLabelFromVision) { 41903 displayLabel = `$label} (${(0, import_i18n50.__)("Optional")})`; 41904 } 41905 return /* @__PURE__ */ (0, import_jsx_runtime174.jsx)( 41906 import_components40.BaseControl, 41907 { 41908 id, 41909 label: displayLabel, 41910 help: description, 41911 hideLabelFromVision, 41912 children: /* @__PURE__ */ (0, import_jsx_runtime174.jsxs)(Stack, { direction: "column", gap: "lg", children: [ 41913 /* @__PURE__ */ (0, import_jsx_runtime174.jsx)( 41914 ValidatedInputControl, 41915 { 41916 ref: inputControlRef, 41917 required: !!isValid2?.required, 41918 customValidity: getCustomValidity(isValid2, validity), 41919 type: "datetime-local", 41920 label: (0, import_i18n50.__)("Date time"), 41921 hideLabelFromVision: true, 41922 value: formatDateTime(value), 41923 onValueChange: handleManualDateTimeChange, 41924 disabled: disabled2, 41925 description: getTimezoneDescription(), 41926 min: minConstraint ? formatDateTime(minConstraint) : void 0, 41927 max: maxConstraint ? formatDateTime(maxConstraint) : void 0 41928 } 41929 ), 41930 !compact && /* @__PURE__ */ (0, import_jsx_runtime174.jsx)( 41931 Calendar, 41932 { 41933 style: { width: "100%" }, 41934 value: value ? parseDateTime(value) : null, 41935 onValueChange: onSelectDate, 41936 month: calendarMonth, 41937 onMonthChange: setCalendarMonth, 41938 timeZone, 41939 locale, 41940 dir: (0, import_i18n50.isRTL)() ? "rtl" : "ltr", 41941 weekStartsOn, 41942 disabled: disabled2 || disabledMatchers 41943 } 41944 ) 41945 ] }) 41946 } 41947 ); 41948 } 41949 function DateTime({ 41950 data, 41951 field, 41952 onChange, 41953 hideLabelFromVision, 41954 markWhenOptional, 41955 operator, 41956 validity, 41957 config 41958 }) { 41959 if (operator === OPERATOR_IN_THE_PAST || operator === OPERATOR_OVER) { 41960 return /* @__PURE__ */ (0, import_jsx_runtime174.jsx)( 41961 RelativeDateControl, 41962 { 41963 className: "dataviews-controls__datetime", 41964 data, 41965 field, 41966 onChange, 41967 hideLabelFromVision, 41968 operator 41969 } 41970 ); 41971 } 41972 return /* @__PURE__ */ (0, import_jsx_runtime174.jsx)( 41973 CalendarDateTimeControl, 41974 { 41975 data, 41976 field, 41977 onChange, 41978 hideLabelFromVision, 41979 markWhenOptional, 41980 validity, 41981 config 41982 } 41983 ); 41984 } 41985 41986 // packages/dataviews/build-module/components/dataform-controls/date.mjs 41987 var import_components41 = __toESM(require_components(), 1); 41988 var import_a11y3 = __toESM(require_a11y(), 1); 41989 var import_element124 = __toESM(require_element(), 1); 41990 var import_i18n51 = __toESM(require_i18n(), 1); 41991 var import_date6 = __toESM(require_date(), 1); 41992 var import_jsx_runtime175 = __toESM(require_jsx_runtime(), 1); 41993 var DATE_PRESETS = [ 41994 { 41995 id: "today", 41996 label: (0, import_i18n51.__)("Today"), 41997 getValue: () => (0, import_date6.getDate)(null) 41998 }, 41999 { 42000 id: "yesterday", 42001 label: (0, import_i18n51.__)("Yesterday"), 42002 getValue: () => { 42003 const today = (0, import_date6.getDate)(null); 42004 return subDays(today, 1); 42005 } 42006 }, 42007 { 42008 id: "past-week", 42009 label: (0, import_i18n51.__)("Past week"), 42010 getValue: () => { 42011 const today = (0, import_date6.getDate)(null); 42012 return subDays(today, 7); 42013 } 42014 }, 42015 { 42016 id: "past-month", 42017 label: (0, import_i18n51.__)("Past month"), 42018 getValue: () => { 42019 const today = (0, import_date6.getDate)(null); 42020 return subMonths(today, 1); 42021 } 42022 } 42023 ]; 42024 var DATE_RANGE_PRESETS = [ 42025 { 42026 id: "last-7-days", 42027 label: (0, import_i18n51.__)("Last 7 days"), 42028 getValue: () => { 42029 const today = (0, import_date6.getDate)(null); 42030 return [subDays(today, 7), today]; 42031 } 42032 }, 42033 { 42034 id: "last-30-days", 42035 label: (0, import_i18n51.__)("Last 30 days"), 42036 getValue: () => { 42037 const today = (0, import_date6.getDate)(null); 42038 return [subDays(today, 30), today]; 42039 } 42040 }, 42041 { 42042 id: "month-to-date", 42043 label: (0, import_i18n51.__)("Month to date"), 42044 getValue: () => { 42045 const today = (0, import_date6.getDate)(null); 42046 return [startOfMonth(today), today]; 42047 } 42048 }, 42049 { 42050 id: "last-year", 42051 label: (0, import_i18n51.__)("Last year"), 42052 getValue: () => { 42053 const today = (0, import_date6.getDate)(null); 42054 return [subYears(today, 1), today]; 42055 } 42056 }, 42057 { 42058 id: "year-to-date", 42059 label: (0, import_i18n51.__)("Year to date"), 42060 getValue: () => { 42061 const today = (0, import_date6.getDate)(null); 42062 return [startOfYear(today), today]; 42063 } 42064 } 42065 ]; 42066 var parseDate2 = (dateString) => { 42067 if (!dateString) { 42068 return null; 42069 } 42070 const parsed = parseISO(dateString); 42071 return isValid(parsed) ? parsed : null; 42072 }; 42073 var formatDate = (date) => { 42074 if (!date) { 42075 return ""; 42076 } 42077 return typeof date === "string" ? date : format(date, "yyyy-MM-dd"); 42078 }; 42079 function ValidatedDateControl({ 42080 field, 42081 validity, 42082 inputRefs, 42083 isTouched, 42084 setIsTouched, 42085 children 42086 }) { 42087 const { isValid: isValid2 } = field; 42088 const [customValidity, setCustomValidity] = (0, import_element124.useState)(void 0); 42089 const validateRefs = (0, import_element124.useCallback)(() => { 42090 const refs = Array.isArray(inputRefs) ? inputRefs : [inputRefs]; 42091 for (const ref of refs) { 42092 const input = ref.current; 42093 if (input && !input.validity.valid) { 42094 setCustomValidity({ 42095 type: "invalid", 42096 message: input.validationMessage 42097 }); 42098 return; 42099 } 42100 } 42101 setCustomValidity(void 0); 42102 }, [inputRefs]); 42103 (0, import_element124.useEffect)(() => { 42104 const refs = Array.isArray(inputRefs) ? inputRefs : [inputRefs]; 42105 const result = validity ? getCustomValidity(isValid2, validity) : void 0; 42106 for (const ref of refs) { 42107 const input = ref.current; 42108 if (input) { 42109 input.setCustomValidity( 42110 result?.type === "invalid" && result.message ? result.message : "" 42111 ); 42112 } 42113 } 42114 }, [inputRefs, isValid2, validity]); 42115 (0, import_element124.useEffect)(() => { 42116 const refs = Array.isArray(inputRefs) ? inputRefs : [inputRefs]; 42117 const handleInvalid = (event) => { 42118 event.preventDefault(); 42119 setIsTouched(true); 42120 }; 42121 for (const ref of refs) { 42122 ref.current?.addEventListener("invalid", handleInvalid); 42123 } 42124 return () => { 42125 for (const ref of refs) { 42126 ref.current?.removeEventListener("invalid", handleInvalid); 42127 } 42128 }; 42129 }, [inputRefs, setIsTouched]); 42130 (0, import_element124.useEffect)(() => { 42131 if (!isTouched) { 42132 return; 42133 } 42134 const result = validity ? getCustomValidity(isValid2, validity) : void 0; 42135 if (result) { 42136 setCustomValidity(result); 42137 } else { 42138 validateRefs(); 42139 } 42140 }, [isTouched, isValid2, validity, validateRefs]); 42141 (0, import_element124.useEffect)(() => { 42142 if (isTouched && customValidity?.message) { 42143 (0, import_a11y3.speak)(customValidity.message); 42144 } 42145 }, [isTouched, customValidity?.message]); 42146 const onBlur = (event) => { 42147 if (isTouched) { 42148 return; 42149 } 42150 if (!event.relatedTarget || !event.currentTarget.contains(event.relatedTarget)) { 42151 setIsTouched(true); 42152 } 42153 }; 42154 return /* @__PURE__ */ (0, import_jsx_runtime175.jsxs)(Stack, { direction: "column", gap: "sm", onBlur, children: [ 42155 children, 42156 customValidity && /* @__PURE__ */ (0, import_jsx_runtime175.jsx)( 42157 ValidityIndicator, 42158 { 42159 type: customValidity.type, 42160 message: customValidity.message 42161 } 42162 ) 42163 ] }); 42164 } 42165 function CalendarDateControl({ 42166 data, 42167 field, 42168 onChange, 42169 hideLabelFromVision, 42170 markWhenOptional, 42171 validity 42172 }) { 42173 const { 42174 id, 42175 label, 42176 description, 42177 setValue, 42178 getValue, 42179 isValid: isValid2, 42180 format: fieldFormat 42181 } = field; 42182 const disabled2 = field.isDisabled({ item: data, field }); 42183 const [selectedPresetId, setSelectedPresetId] = (0, import_element124.useState)( 42184 null 42185 ); 42186 const weekStartsOn = fieldFormat.weekStartsOn ?? (0, import_date6.getSettings)().l10n.startOfWeek; 42187 const locale = getCalendarLocale((0, import_date6.getSettings)().l10n.locale); 42188 const fieldValue = getValue({ item: data }); 42189 const value = typeof fieldValue === "string" ? fieldValue : void 0; 42190 const [calendarMonth, setCalendarMonth] = (0, import_element124.useState)(() => { 42191 const parsedDate = parseDate2(value); 42192 return parsedDate || /* @__PURE__ */ new Date(); 42193 }); 42194 (0, import_element124.useEffect)(() => { 42195 const parsedDate = parseDate2(value); 42196 if (parsedDate) { 42197 setCalendarMonth( 42198 (currentMonth) => isSameMonth(parsedDate, currentMonth) ? currentMonth : parsedDate 42199 ); 42200 } 42201 }, [value]); 42202 const [isTouched, setIsTouched] = (0, import_element124.useState)(false); 42203 const validityTargetRef = (0, import_element124.useRef)(null); 42204 const { minConstraint, maxConstraint, disabledMatchers } = useDisabledDateMatchers(isValid2, parseDate2); 42205 const onChangeCallback = (0, import_element124.useCallback)( 42206 (newValue) => onChange(setValue({ item: data, value: newValue })), 42207 [data, onChange, setValue] 42208 ); 42209 const onSelectDate = (0, import_element124.useCallback)( 42210 (newDate) => { 42211 const dateValue = newDate ? formatDate(newDate) : void 0; 42212 onChangeCallback(dateValue); 42213 setSelectedPresetId(null); 42214 setIsTouched(true); 42215 }, 42216 [onChangeCallback] 42217 ); 42218 const handlePresetClick = (0, import_element124.useCallback)( 42219 (preset) => { 42220 const presetDate = preset.getValue(); 42221 const dateValue = formatDate(presetDate); 42222 setCalendarMonth(presetDate); 42223 onChangeCallback(dateValue); 42224 setSelectedPresetId(preset.id); 42225 setIsTouched(true); 42226 }, 42227 [onChangeCallback] 42228 ); 42229 const handleManualDateChange = (0, import_element124.useCallback)( 42230 (newValue) => { 42231 onChangeCallback(newValue); 42232 if (newValue) { 42233 const parsedDate = parseDate2(newValue); 42234 if (parsedDate) { 42235 setCalendarMonth(parsedDate); 42236 } 42237 } 42238 setSelectedPresetId(null); 42239 setIsTouched(true); 42240 }, 42241 [onChangeCallback] 42242 ); 42243 let displayLabel = label; 42244 if (isValid2?.required && !markWhenOptional) { 42245 displayLabel = `$label} (${(0, import_i18n51.__)("Required")})`; 42246 } else if (!isValid2?.required && markWhenOptional) { 42247 displayLabel = `$label} (${(0, import_i18n51.__)("Optional")})`; 42248 } 42249 return /* @__PURE__ */ (0, import_jsx_runtime175.jsx)( 42250 ValidatedDateControl, 42251 { 42252 field, 42253 validity, 42254 inputRefs: validityTargetRef, 42255 isTouched, 42256 setIsTouched, 42257 children: /* @__PURE__ */ (0, import_jsx_runtime175.jsx)( 42258 import_components41.BaseControl, 42259 { 42260 id, 42261 className: "dataviews-controls__date", 42262 label: displayLabel, 42263 help: description, 42264 hideLabelFromVision, 42265 children: /* @__PURE__ */ (0, import_jsx_runtime175.jsxs)(Stack, { direction: "column", gap: "lg", children: [ 42266 /* @__PURE__ */ (0, import_jsx_runtime175.jsxs)( 42267 Stack, 42268 { 42269 direction: "row", 42270 gap: "sm", 42271 wrap: "wrap", 42272 justify: "flex-start", 42273 children: [ 42274 DATE_PRESETS.map((preset) => { 42275 const isSelected2 = selectedPresetId === preset.id; 42276 return /* @__PURE__ */ (0, import_jsx_runtime175.jsx)( 42277 import_components41.Button, 42278 { 42279 className: "dataviews-controls__date-preset", 42280 variant: "tertiary", 42281 isPressed: isSelected2, 42282 size: "small", 42283 disabled: disabled2, 42284 accessibleWhenDisabled: true, 42285 onClick: () => handlePresetClick(preset), 42286 children: preset.label 42287 }, 42288 preset.id 42289 ); 42290 }), 42291 /* @__PURE__ */ (0, import_jsx_runtime175.jsx)( 42292 import_components41.Button, 42293 { 42294 className: "dataviews-controls__date-preset", 42295 variant: "tertiary", 42296 isPressed: !selectedPresetId, 42297 size: "small", 42298 disabled: !!selectedPresetId || disabled2, 42299 accessibleWhenDisabled: true, 42300 children: (0, import_i18n51.__)("Custom") 42301 } 42302 ) 42303 ] 42304 } 42305 ), 42306 /* @__PURE__ */ (0, import_jsx_runtime175.jsx)( 42307 import_components41.__experimentalInputControl, 42308 { 42309 ref: validityTargetRef, 42310 type: "date", 42311 label: (0, import_i18n51.__)("Date"), 42312 hideLabelFromVision: true, 42313 value, 42314 onChange: handleManualDateChange, 42315 required: !!field.isValid?.required, 42316 disabled: disabled2, 42317 min: minConstraint, 42318 max: maxConstraint 42319 } 42320 ), 42321 /* @__PURE__ */ (0, import_jsx_runtime175.jsx)( 42322 Calendar, 42323 { 42324 style: { width: "100%" }, 42325 value: value ? parseDate2(value) : null, 42326 onValueChange: onSelectDate, 42327 month: calendarMonth, 42328 onMonthChange: setCalendarMonth, 42329 locale, 42330 dir: (0, import_i18n51.isRTL)() ? "rtl" : "ltr", 42331 weekStartsOn, 42332 disabled: disabled2 || disabledMatchers, 42333 disableNavigation: disabled2 42334 } 42335 ) 42336 ] }) 42337 } 42338 ) 42339 } 42340 ); 42341 } 42342 function CalendarDateRangeControl({ 42343 data, 42344 field, 42345 onChange, 42346 hideLabelFromVision, 42347 markWhenOptional, 42348 validity 42349 }) { 42350 const { 42351 id, 42352 label, 42353 description, 42354 getValue, 42355 setValue, 42356 isValid: isValid2, 42357 format: fieldFormat 42358 } = field; 42359 const disabled2 = field.isDisabled({ item: data, field }); 42360 let value; 42361 const fieldValue = getValue({ item: data }); 42362 if (Array.isArray(fieldValue) && fieldValue.length === 2 && fieldValue.every((date) => typeof date === "string")) { 42363 value = fieldValue; 42364 } 42365 const weekStartsOn = fieldFormat.weekStartsOn ?? (0, import_date6.getSettings)().l10n.startOfWeek; 42366 const locale = getCalendarLocale((0, import_date6.getSettings)().l10n.locale); 42367 const { minConstraint, maxConstraint, disabledMatchers } = useDisabledDateMatchers(isValid2, parseDate2); 42368 const onChangeCallback = (0, import_element124.useCallback)( 42369 (newValue) => { 42370 onChange( 42371 setValue({ 42372 item: data, 42373 value: newValue 42374 }) 42375 ); 42376 }, 42377 [data, onChange, setValue] 42378 ); 42379 const [selectedPresetId, setSelectedPresetId] = (0, import_element124.useState)( 42380 null 42381 ); 42382 const selectedRange = (0, import_element124.useMemo)(() => { 42383 if (!value) { 42384 return null; 42385 } 42386 const [from, to] = value; 42387 return { 42388 from: parseDate2(from) || void 0, 42389 to: parseDate2(to) || void 0 42390 }; 42391 }, [value]); 42392 const [calendarMonth, setCalendarMonth] = (0, import_element124.useState)(() => { 42393 return selectedRange?.from || /* @__PURE__ */ new Date(); 42394 }); 42395 const [fromValue, toValue] = value ?? []; 42396 (0, import_element124.useEffect)(() => { 42397 setCalendarMonth((currentMonth) => { 42398 const from = parseDate2(fromValue); 42399 const to = parseDate2(toValue); 42400 const targetMonth = from ?? to; 42401 const isRangeVisible = from && to ? areIntervalsOverlapping( 42402 { start: from, end: to }, 42403 { 42404 start: startOfMonth(currentMonth), 42405 end: endOfMonth(currentMonth) 42406 }, 42407 { inclusive: true } 42408 ) : [from, to].some( 42409 (date) => date && isSameMonth(date, currentMonth) 42410 ); 42411 return targetMonth && !isRangeVisible ? targetMonth : currentMonth; 42412 }); 42413 }, [fromValue, toValue]); 42414 const [isTouched, setIsTouched] = (0, import_element124.useState)(false); 42415 const fromInputRef = (0, import_element124.useRef)(null); 42416 const toInputRef = (0, import_element124.useRef)(null); 42417 const updateDateRange = (0, import_element124.useCallback)( 42418 (fromDate, toDate2) => { 42419 if (!fromDate && !toDate2) { 42420 onChangeCallback(void 0); 42421 return; 42422 } 42423 onChangeCallback([ 42424 formatDate(fromDate), 42425 formatDate(toDate2) 42426 ]); 42427 }, 42428 [onChangeCallback] 42429 ); 42430 const onSelectCalendarRange = (0, import_element124.useCallback)( 42431 (newRange) => { 42432 updateDateRange(newRange?.from, newRange?.to); 42433 setSelectedPresetId(null); 42434 setIsTouched(true); 42435 }, 42436 [updateDateRange] 42437 ); 42438 const handlePresetClick = (0, import_element124.useCallback)( 42439 (preset) => { 42440 const [startDate, endDate] = preset.getValue(); 42441 setCalendarMonth(startDate); 42442 updateDateRange(startDate, endDate); 42443 setSelectedPresetId(preset.id); 42444 setIsTouched(true); 42445 }, 42446 [updateDateRange] 42447 ); 42448 const handleManualDateChange = (0, import_element124.useCallback)( 42449 (fromOrTo, newValue) => { 42450 const [currentFrom, currentTo] = value || [ 42451 void 0, 42452 void 0 42453 ]; 42454 const updatedFrom = fromOrTo === "from" ? newValue : currentFrom; 42455 const updatedTo = fromOrTo === "to" ? newValue : currentTo; 42456 updateDateRange(updatedFrom, updatedTo); 42457 if (newValue) { 42458 const parsedDate = parseDate2(newValue); 42459 if (parsedDate) { 42460 setCalendarMonth(parsedDate); 42461 } 42462 } 42463 setSelectedPresetId(null); 42464 setIsTouched(true); 42465 }, 42466 [value, updateDateRange] 42467 ); 42468 let displayLabel = label; 42469 if (field.isValid?.required && !markWhenOptional) { 42470 displayLabel = `$label} (${(0, import_i18n51.__)("Required")})`; 42471 } else if (!field.isValid?.required && markWhenOptional) { 42472 displayLabel = `$label} (${(0, import_i18n51.__)("Optional")})`; 42473 } 42474 return /* @__PURE__ */ (0, import_jsx_runtime175.jsx)( 42475 ValidatedDateControl, 42476 { 42477 field, 42478 validity, 42479 inputRefs: [fromInputRef, toInputRef], 42480 isTouched, 42481 setIsTouched, 42482 children: /* @__PURE__ */ (0, import_jsx_runtime175.jsx)( 42483 import_components41.BaseControl, 42484 { 42485 id, 42486 className: "dataviews-controls__date", 42487 label: displayLabel, 42488 help: description, 42489 hideLabelFromVision, 42490 children: /* @__PURE__ */ (0, import_jsx_runtime175.jsxs)(Stack, { direction: "column", gap: "lg", children: [ 42491 /* @__PURE__ */ (0, import_jsx_runtime175.jsxs)( 42492 Stack, 42493 { 42494 direction: "row", 42495 gap: "sm", 42496 wrap: "wrap", 42497 justify: "flex-start", 42498 children: [ 42499 DATE_RANGE_PRESETS.map((preset) => { 42500 const isSelected2 = selectedPresetId === preset.id; 42501 return /* @__PURE__ */ (0, import_jsx_runtime175.jsx)( 42502 import_components41.Button, 42503 { 42504 className: "dataviews-controls__date-preset", 42505 variant: "tertiary", 42506 isPressed: isSelected2, 42507 size: "small", 42508 disabled: disabled2, 42509 accessibleWhenDisabled: true, 42510 onClick: () => handlePresetClick(preset), 42511 children: preset.label 42512 }, 42513 preset.id 42514 ); 42515 }), 42516 /* @__PURE__ */ (0, import_jsx_runtime175.jsx)( 42517 import_components41.Button, 42518 { 42519 className: "dataviews-controls__date-preset", 42520 variant: "tertiary", 42521 isPressed: !selectedPresetId, 42522 size: "small", 42523 accessibleWhenDisabled: true, 42524 disabled: !!selectedPresetId || disabled2, 42525 children: (0, import_i18n51.__)("Custom") 42526 } 42527 ) 42528 ] 42529 } 42530 ), 42531 /* @__PURE__ */ (0, import_jsx_runtime175.jsxs)( 42532 Stack, 42533 { 42534 direction: "row", 42535 gap: "sm", 42536 justify: "space-between", 42537 className: "dataviews-controls__date-range-inputs", 42538 children: [ 42539 /* @__PURE__ */ (0, import_jsx_runtime175.jsx)( 42540 import_components41.__experimentalInputControl, 42541 { 42542 ref: fromInputRef, 42543 type: "date", 42544 label: (0, import_i18n51.__)("From"), 42545 hideLabelFromVision: true, 42546 value: value?.[0], 42547 onChange: (newValue) => handleManualDateChange("from", newValue), 42548 required: !!field.isValid?.required, 42549 disabled: disabled2, 42550 min: minConstraint, 42551 max: maxConstraint 42552 } 42553 ), 42554 /* @__PURE__ */ (0, import_jsx_runtime175.jsx)( 42555 import_components41.__experimentalInputControl, 42556 { 42557 ref: toInputRef, 42558 type: "date", 42559 label: (0, import_i18n51.__)("To"), 42560 hideLabelFromVision: true, 42561 value: value?.[1], 42562 onChange: (newValue) => handleManualDateChange("to", newValue), 42563 required: !!field.isValid?.required, 42564 disabled: disabled2, 42565 min: minConstraint, 42566 max: maxConstraint 42567 } 42568 ) 42569 ] 42570 } 42571 ), 42572 /* @__PURE__ */ (0, import_jsx_runtime175.jsx)( 42573 RangeCalendar, 42574 { 42575 style: { width: "100%" }, 42576 value: selectedRange, 42577 onValueChange: onSelectCalendarRange, 42578 month: calendarMonth, 42579 onMonthChange: setCalendarMonth, 42580 locale, 42581 dir: (0, import_i18n51.isRTL)() ? "rtl" : "ltr", 42582 weekStartsOn, 42583 disabled: disabled2 || disabledMatchers 42584 } 42585 ) 42586 ] }) 42587 } 42588 ) 42589 } 42590 ); 42591 } 42592 function DateControl({ 42593 data, 42594 field, 42595 onChange, 42596 hideLabelFromVision, 42597 markWhenOptional, 42598 operator, 42599 validity 42600 }) { 42601 if (operator === OPERATOR_IN_THE_PAST || operator === OPERATOR_OVER) { 42602 return /* @__PURE__ */ (0, import_jsx_runtime175.jsx)( 42603 RelativeDateControl, 42604 { 42605 className: "dataviews-controls__date", 42606 data, 42607 field, 42608 onChange, 42609 hideLabelFromVision, 42610 operator 42611 } 42612 ); 42613 } 42614 if (operator === OPERATOR_BETWEEN) { 42615 return /* @__PURE__ */ (0, import_jsx_runtime175.jsx)( 42616 CalendarDateRangeControl, 42617 { 42618 data, 42619 field, 42620 onChange, 42621 hideLabelFromVision, 42622 markWhenOptional, 42623 validity 42624 } 42625 ); 42626 } 42627 return /* @__PURE__ */ (0, import_jsx_runtime175.jsx)( 42628 CalendarDateControl, 42629 { 42630 data, 42631 field, 42632 onChange, 42633 hideLabelFromVision, 42634 markWhenOptional, 42635 validity 42636 } 42637 ); 42638 } 42639 42640 // packages/dataviews/build-module/components/dataform-controls/select.mjs 42641 var import_components42 = __toESM(require_components(), 1); 42642 var import_element125 = __toESM(require_element(), 1); 42643 var import_jsx_runtime176 = __toESM(require_jsx_runtime(), 1); 42644 function Select2({ 42645 data, 42646 field, 42647 onChange, 42648 hideLabelFromVision, 42649 markWhenOptional, 42650 validity 42651 }) { 42652 const { type, label, description, getValue, setValue, isValid: isValid2 } = field; 42653 const disabled2 = field.isDisabled({ item: data, field }); 42654 const isMultiple = type === "array"; 42655 const value = getValue({ item: data }) ?? (isMultiple ? [] : ""); 42656 const onChangeControl = (0, import_element125.useCallback)( 42657 (newValue) => onChange(setValue({ item: data, value: newValue })), 42658 [data, onChange, setValue] 42659 ); 42660 const { elements, isLoading } = useElements({ 42661 elements: field.elements, 42662 getElements: field.getElements 42663 }); 42664 if (isLoading) { 42665 return /* @__PURE__ */ (0, import_jsx_runtime176.jsx)(import_components42.Spinner, {}); 42666 } 42667 return /* @__PURE__ */ (0, import_jsx_runtime176.jsx)( 42668 ValidatedSelectControl, 42669 { 42670 required: !!field.isValid?.required, 42671 markWhenOptional, 42672 customValidity: getCustomValidity(isValid2, validity), 42673 label, 42674 value, 42675 help: description, 42676 options: elements, 42677 onChange: onChangeControl, 42678 hideLabelFromVision, 42679 multiple: isMultiple, 42680 disabled: disabled2 42681 } 42682 ); 42683 } 42684 42685 // packages/dataviews/build-module/components/dataform-controls/adaptive-select.mjs 42686 var import_jsx_runtime177 = __toESM(require_jsx_runtime(), 1); 42687 var ELEMENTS_THRESHOLD = 10; 42688 function AdaptiveSelect(props) { 42689 const { field } = props; 42690 const { elements } = useElements({ 42691 elements: field.elements, 42692 getElements: field.getElements 42693 }); 42694 if (elements.length >= ELEMENTS_THRESHOLD) { 42695 return /* @__PURE__ */ (0, import_jsx_runtime177.jsx)(Combobox3, { ...props }); 42696 } 42697 return /* @__PURE__ */ (0, import_jsx_runtime177.jsx)(Select2, { ...props }); 42698 } 42699 42700 // packages/dataviews/build-module/components/dataform-controls/utils/validated-input.mjs 42701 var import_element126 = __toESM(require_element(), 1); 42702 var import_jsx_runtime178 = __toESM(require_jsx_runtime(), 1); 42703 function ValidatedText({ 42704 data, 42705 field, 42706 onChange, 42707 hideLabelFromVision, 42708 markWhenOptional, 42709 type, 42710 prefix, 42711 suffix, 42712 validity 42713 }) { 42714 const { label, placeholder, description, getValue, setValue, isValid: isValid2 } = field; 42715 const value = getValue({ item: data }); 42716 const disabled2 = field.isDisabled({ item: data, field }); 42717 const onValueChangeControl = (0, import_element126.useCallback)( 42718 (newValue) => onChange( 42719 setValue({ 42720 item: data, 42721 value: newValue 42722 }) 42723 ), 42724 [data, setValue, onChange] 42725 ); 42726 return /* @__PURE__ */ (0, import_jsx_runtime178.jsx)( 42727 ValidatedInputControl, 42728 { 42729 required: !!isValid2.required, 42730 markWhenOptional, 42731 customValidity: getCustomValidity(isValid2, validity), 42732 label, 42733 placeholder, 42734 value: value ?? "", 42735 description: typeof description === "string" ? description : void 0, 42736 details: typeof description === "string" ? void 0 : description, 42737 onValueChange: onValueChangeControl, 42738 hideLabelFromVision, 42739 type, 42740 prefix, 42741 suffix, 42742 disabled: disabled2, 42743 pattern: isValid2.pattern ? isValid2.pattern.constraint : void 0, 42744 minLength: isValid2.minLength ? isValid2.minLength.constraint : void 0, 42745 maxLength: isValid2.maxLength ? isValid2.maxLength.constraint : void 0 42746 } 42747 ); 42748 } 42749 42750 // packages/dataviews/build-module/components/dataform-controls/email.mjs 42751 var import_jsx_runtime179 = __toESM(require_jsx_runtime(), 1); 42752 function Email({ 42753 data, 42754 field, 42755 onChange, 42756 hideLabelFromVision, 42757 markWhenOptional, 42758 validity 42759 }) { 42760 return /* @__PURE__ */ (0, import_jsx_runtime179.jsx)( 42761 ValidatedText, 42762 { 42763 ...{ 42764 data, 42765 field, 42766 onChange, 42767 hideLabelFromVision, 42768 markWhenOptional, 42769 validity, 42770 type: "email", 42771 prefix: /* @__PURE__ */ (0, import_jsx_runtime179.jsx)(InputLayout3.Slot, { padding: "minimal", children: /* @__PURE__ */ (0, import_jsx_runtime179.jsx)(Icon, { icon: envelope_default }) }) 42772 } 42773 } 42774 ); 42775 } 42776 42777 // packages/dataviews/build-module/components/dataform-controls/telephone.mjs 42778 var import_jsx_runtime180 = __toESM(require_jsx_runtime(), 1); 42779 function Telephone({ 42780 data, 42781 field, 42782 onChange, 42783 hideLabelFromVision, 42784 markWhenOptional, 42785 validity 42786 }) { 42787 return /* @__PURE__ */ (0, import_jsx_runtime180.jsx)( 42788 ValidatedText, 42789 { 42790 ...{ 42791 data, 42792 field, 42793 onChange, 42794 hideLabelFromVision, 42795 markWhenOptional, 42796 validity, 42797 type: "tel", 42798 prefix: /* @__PURE__ */ (0, import_jsx_runtime180.jsx)(InputLayout3.Slot, { padding: "minimal", children: /* @__PURE__ */ (0, import_jsx_runtime180.jsx)(Icon, { icon: mobile_default }) }) 42799 } 42800 } 42801 ); 42802 } 42803 42804 // packages/dataviews/build-module/components/dataform-controls/url.mjs 42805 var import_jsx_runtime181 = __toESM(require_jsx_runtime(), 1); 42806 function Url({ 42807 data, 42808 field, 42809 onChange, 42810 hideLabelFromVision, 42811 markWhenOptional, 42812 validity 42813 }) { 42814 return /* @__PURE__ */ (0, import_jsx_runtime181.jsx)( 42815 ValidatedText, 42816 { 42817 ...{ 42818 data, 42819 field, 42820 onChange, 42821 hideLabelFromVision, 42822 markWhenOptional, 42823 validity, 42824 type: "url", 42825 prefix: /* @__PURE__ */ (0, import_jsx_runtime181.jsx)(InputLayout3.Slot, { padding: "minimal", children: /* @__PURE__ */ (0, import_jsx_runtime181.jsx)(Icon, { icon: link_default }) }) 42826 } 42827 } 42828 ); 42829 } 42830 42831 // packages/dataviews/build-module/components/dataform-controls/utils/validated-number.mjs 42832 var import_components43 = __toESM(require_components(), 1); 42833 var import_element127 = __toESM(require_element(), 1); 42834 var import_i18n52 = __toESM(require_i18n(), 1); 42835 var import_jsx_runtime182 = __toESM(require_jsx_runtime(), 1); 42836 function toNumberOrEmpty(value) { 42837 if (value === "" || value === void 0) { 42838 return ""; 42839 } 42840 const number = Number(value); 42841 return Number.isFinite(number) ? number : ""; 42842 } 42843 function BetweenControls({ 42844 value, 42845 onChange, 42846 hideLabelFromVision, 42847 step 42848 }) { 42849 const [min3 = "", max3 = ""] = value; 42850 const onChangeMin = (0, import_element127.useCallback)( 42851 (newValue) => onChange([toNumberOrEmpty(newValue), max3]), 42852 [onChange, max3] 42853 ); 42854 const onChangeMax = (0, import_element127.useCallback)( 42855 (newValue) => onChange([min3, toNumberOrEmpty(newValue)]), 42856 [onChange, min3] 42857 ); 42858 return /* @__PURE__ */ (0, import_jsx_runtime182.jsx)( 42859 import_components43.BaseControl, 42860 { 42861 help: (0, import_i18n52.__)("The max. value must be greater than the min. value."), 42862 children: /* @__PURE__ */ (0, import_jsx_runtime182.jsxs)(import_components43.Flex, { direction: "row", gap: 4, children: [ 42863 /* @__PURE__ */ (0, import_jsx_runtime182.jsx)( 42864 import_components43.__experimentalNumberControl, 42865 { 42866 label: (0, import_i18n52.__)("Min."), 42867 value: min3, 42868 max: max3 ? Number(max3) - step : void 0, 42869 onChange: onChangeMin, 42870 hideLabelFromVision, 42871 step 42872 } 42873 ), 42874 /* @__PURE__ */ (0, import_jsx_runtime182.jsx)( 42875 import_components43.__experimentalNumberControl, 42876 { 42877 label: (0, import_i18n52.__)("Max."), 42878 value: max3, 42879 min: min3 ? Number(min3) + step : void 0, 42880 onChange: onChangeMax, 42881 hideLabelFromVision, 42882 step 42883 } 42884 ) 42885 ] }) 42886 } 42887 ); 42888 } 42889 function ValidatedNumber({ 42890 data, 42891 field, 42892 onChange, 42893 hideLabelFromVision, 42894 markWhenOptional, 42895 operator, 42896 validity 42897 }) { 42898 const decimals = field.format?.decimals ?? 0; 42899 const step = Math.pow(10, Math.abs(decimals) * -1); 42900 const { label, description, getValue, setValue, isValid: isValid2 } = field; 42901 const value = getValue({ item: data }) ?? ""; 42902 const disabled2 = field.isDisabled({ item: data, field }); 42903 const onChangeControl = (0, import_element127.useCallback)( 42904 (newValue) => { 42905 onChange( 42906 setValue({ 42907 item: data, 42908 // Do not convert an empty string or undefined to a number, 42909 // otherwise there's a mismatch between the UI control (empty) 42910 // and the data relied by onChange (0). 42911 value: ["", void 0].includes(newValue) ? void 0 : Number(newValue) 42912 }) 42913 ); 42914 }, 42915 [data, onChange, setValue] 42916 ); 42917 const onChangeBetweenControls = (0, import_element127.useCallback)( 42918 (newValue) => { 42919 onChange( 42920 setValue({ 42921 item: data, 42922 value: newValue 42923 }) 42924 ); 42925 }, 42926 [data, onChange, setValue] 42927 ); 42928 if (operator === OPERATOR_BETWEEN) { 42929 let valueBetween = ["", ""]; 42930 if (Array.isArray(value) && value.length === 2 && value.every( 42931 (element) => typeof element === "number" || element === "" 42932 )) { 42933 valueBetween = value; 42934 } 42935 return /* @__PURE__ */ (0, import_jsx_runtime182.jsx)( 42936 BetweenControls, 42937 { 42938 value: valueBetween, 42939 onChange: onChangeBetweenControls, 42940 hideLabelFromVision, 42941 step 42942 } 42943 ); 42944 } 42945 return /* @__PURE__ */ (0, import_jsx_runtime182.jsx)( 42946 ValidatedNumberControl, 42947 { 42948 required: !!isValid2.required, 42949 markWhenOptional, 42950 customValidity: getCustomValidity(isValid2, validity), 42951 label, 42952 help: description, 42953 value, 42954 onChange: onChangeControl, 42955 hideLabelFromVision, 42956 step, 42957 min: typeof isValid2.min?.constraint === "number" ? isValid2.min.constraint : void 0, 42958 max: typeof isValid2.max?.constraint === "number" ? isValid2.max.constraint : void 0, 42959 disabled: disabled2 42960 } 42961 ); 42962 } 42963 42964 // packages/dataviews/build-module/components/dataform-controls/integer.mjs 42965 var import_jsx_runtime183 = __toESM(require_jsx_runtime(), 1); 42966 function Integer(props) { 42967 return /* @__PURE__ */ (0, import_jsx_runtime183.jsx)(ValidatedNumber, { ...props }); 42968 } 42969 42970 // packages/dataviews/build-module/components/dataform-controls/number.mjs 42971 var import_jsx_runtime184 = __toESM(require_jsx_runtime(), 1); 42972 function Number2(props) { 42973 return /* @__PURE__ */ (0, import_jsx_runtime184.jsx)(ValidatedNumber, { ...props }); 42974 } 42975 42976 // packages/dataviews/build-module/components/dataform-controls/radio.mjs 42977 var import_components44 = __toESM(require_components(), 1); 42978 var import_element128 = __toESM(require_element(), 1); 42979 var import_jsx_runtime185 = __toESM(require_jsx_runtime(), 1); 42980 function Radio({ 42981 data, 42982 field, 42983 onChange, 42984 hideLabelFromVision, 42985 markWhenOptional, 42986 validity 42987 }) { 42988 const { label, description, getValue, setValue, isValid: isValid2 } = field; 42989 const disabled2 = field.isDisabled({ item: data, field }); 42990 const { elements, isLoading } = useElements({ 42991 elements: field.elements, 42992 getElements: field.getElements 42993 }); 42994 const value = getValue({ item: data }); 42995 const onChangeControl = (0, import_element128.useCallback)( 42996 (newValue) => onChange(setValue({ item: data, value: newValue })), 42997 [data, onChange, setValue] 42998 ); 42999 if (isLoading) { 43000 return /* @__PURE__ */ (0, import_jsx_runtime185.jsx)(import_components44.Spinner, {}); 43001 } 43002 return /* @__PURE__ */ (0, import_jsx_runtime185.jsx)( 43003 ValidatedRadioControl, 43004 { 43005 required: !!field.isValid?.required, 43006 markWhenOptional, 43007 customValidity: getCustomValidity(isValid2, validity), 43008 label, 43009 help: description, 43010 onChange: onChangeControl, 43011 options: elements, 43012 selected: value, 43013 hideLabelFromVision, 43014 disabled: disabled2 43015 } 43016 ); 43017 } 43018 43019 // packages/dataviews/build-module/components/dataform-controls/text.mjs 43020 var import_element129 = __toESM(require_element(), 1); 43021 var import_jsx_runtime186 = __toESM(require_jsx_runtime(), 1); 43022 function Text3({ 43023 data, 43024 field, 43025 onChange, 43026 hideLabelFromVision, 43027 markWhenOptional, 43028 config, 43029 validity 43030 }) { 43031 const { prefix, suffix } = config || {}; 43032 return /* @__PURE__ */ (0, import_jsx_runtime186.jsx)( 43033 ValidatedText, 43034 { 43035 ...{ 43036 data, 43037 field, 43038 onChange, 43039 hideLabelFromVision, 43040 markWhenOptional, 43041 validity, 43042 prefix: prefix ? (0, import_element129.createElement)(prefix) : void 0, 43043 suffix: suffix ? (0, import_element129.createElement)(suffix) : void 0 43044 } 43045 } 43046 ); 43047 } 43048 43049 // packages/dataviews/build-module/components/dataform-controls/time.mjs 43050 var import_components45 = __toESM(require_components(), 1); 43051 var import_element130 = __toESM(require_element(), 1); 43052 var import_i18n53 = __toESM(require_i18n(), 1); 43053 var import_jsx_runtime187 = __toESM(require_jsx_runtime(), 1); 43054 function getStep(timeFormat, values) { 43055 const tokens = (timeFormat ?? "").replace(/\\./g, ""); 43056 const hasSeconds = tokens.includes("s") || values.some((value) => (parseTime2(value) ?? 0) % 60 !== 0); 43057 return hasSeconds ? 1 : void 0; 43058 } 43059 function toInputValue(value) { 43060 const seconds = parseTime2(value); 43061 if (seconds === null) { 43062 return ""; 43063 } 43064 const parts = [ 43065 Math.floor(seconds / 3600), 43066 Math.floor(seconds % 3600 / 60) 43067 ]; 43068 if (seconds % 60 !== 0) { 43069 parts.push(seconds % 60); 43070 } 43071 return parts.map((part) => String(part).padStart(2, "0")).join(":"); 43072 } 43073 function BetweenControls2({ 43074 value, 43075 onChange, 43076 hideLabelFromVision, 43077 disabled: disabled2, 43078 step, 43079 min: min3, 43080 max: max3 43081 }) { 43082 const [from = "", to = ""] = value; 43083 const onChangeFrom = (0, import_element130.useCallback)( 43084 (newValue) => onChange([newValue ?? "", to]), 43085 [onChange, to] 43086 ); 43087 const onChangeTo = (0, import_element130.useCallback)( 43088 (newValue) => onChange([from, newValue ?? ""]), 43089 [onChange, from] 43090 ); 43091 return /* @__PURE__ */ (0, import_jsx_runtime187.jsx)( 43092 import_components45.BaseControl, 43093 { 43094 help: (0, import_i18n53.__)("The end time must be later than the start time."), 43095 children: /* @__PURE__ */ (0, import_jsx_runtime187.jsxs)(Stack, { direction: "row", gap: "sm", justify: "space-between", children: [ 43096 /* @__PURE__ */ (0, import_jsx_runtime187.jsx)( 43097 ValidatedInputControl, 43098 { 43099 type: "time", 43100 label: (0, import_i18n53.__)("From"), 43101 value: from, 43102 onValueChange: onChangeFrom, 43103 hideLabelFromVision, 43104 disabled: disabled2, 43105 step, 43106 min: min3, 43107 max: to || max3 43108 } 43109 ), 43110 /* @__PURE__ */ (0, import_jsx_runtime187.jsx)( 43111 ValidatedInputControl, 43112 { 43113 type: "time", 43114 label: (0, import_i18n53.__)("To"), 43115 value: to, 43116 onValueChange: onChangeTo, 43117 hideLabelFromVision, 43118 disabled: disabled2, 43119 step, 43120 min: from || min3, 43121 max: max3 43122 } 43123 ) 43124 ] }) 43125 } 43126 ); 43127 } 43128 function Time({ 43129 data, 43130 field, 43131 onChange, 43132 hideLabelFromVision, 43133 markWhenOptional, 43134 operator, 43135 validity 43136 }) { 43137 const { label, placeholder, description, getValue, setValue, isValid: isValid2 } = field; 43138 const value = getValue({ item: data }); 43139 const disabled2 = field.isDisabled({ item: data, field }); 43140 const timeFormat = field.format?.time; 43141 const min3 = typeof isValid2.min?.constraint === "string" ? isValid2.min.constraint : void 0; 43142 const max3 = typeof isValid2.max?.constraint === "string" ? isValid2.max.constraint : void 0; 43143 const onChangeControl = (0, import_element130.useCallback)( 43144 (newValue) => onChange( 43145 setValue({ 43146 item: data, 43147 value: newValue === "" ? void 0 : newValue 43148 }) 43149 ), 43150 [data, onChange, setValue] 43151 ); 43152 const onChangeBetweenControls = (0, import_element130.useCallback)( 43153 ([from, to]) => onChange( 43154 setValue({ 43155 item: data, 43156 // An unfilled bound is stored as `undefined`, which the 43157 // `between` operator reads as "do not apply the filter". 43158 value: [from || void 0, to || void 0] 43159 }) 43160 ), 43161 [data, onChange, setValue] 43162 ); 43163 if (operator === OPERATOR_BETWEEN) { 43164 let valueBetween = ["", ""]; 43165 if (Array.isArray(value) && value.length === 2) { 43166 valueBetween = [ 43167 toInputValue(value[0]), 43168 toInputValue(value[1]) 43169 ]; 43170 } 43171 return /* @__PURE__ */ (0, import_jsx_runtime187.jsx)( 43172 BetweenControls2, 43173 { 43174 value: valueBetween, 43175 onChange: onChangeBetweenControls, 43176 hideLabelFromVision, 43177 disabled: disabled2, 43178 step: getStep(timeFormat, valueBetween), 43179 min: min3, 43180 max: max3 43181 } 43182 ); 43183 } 43184 return /* @__PURE__ */ (0, import_jsx_runtime187.jsx)( 43185 ValidatedInputControl, 43186 { 43187 required: !!isValid2.required, 43188 markWhenOptional, 43189 customValidity: getCustomValidity(isValid2, validity), 43190 type: "time", 43191 label, 43192 placeholder, 43193 description: typeof description === "string" ? description : void 0, 43194 details: typeof description === "string" ? void 0 : description, 43195 value: toInputValue(value), 43196 onValueChange: onChangeControl, 43197 hideLabelFromVision, 43198 disabled: disabled2, 43199 step: getStep(timeFormat, [value]), 43200 min: min3, 43201 max: max3 43202 } 43203 ); 43204 } 43205 43206 // packages/dataviews/build-module/components/dataform-controls/toggle.mjs 43207 var import_element131 = __toESM(require_element(), 1); 43208 var import_jsx_runtime188 = __toESM(require_jsx_runtime(), 1); 43209 function Toggle({ 43210 field, 43211 onChange, 43212 data, 43213 hideLabelFromVision, 43214 markWhenOptional, 43215 validity 43216 }) { 43217 const { label, description, getValue, setValue, isValid: isValid2 } = field; 43218 const disabled2 = field.isDisabled({ item: data, field }); 43219 const onChangeControl = (0, import_element131.useCallback)(() => { 43220 onChange( 43221 setValue({ item: data, value: !getValue({ item: data }) }) 43222 ); 43223 }, [onChange, setValue, data, getValue]); 43224 return /* @__PURE__ */ (0, import_jsx_runtime188.jsx)( 43225 ValidatedToggleControl, 43226 { 43227 required: !!isValid2.required, 43228 markWhenOptional, 43229 customValidity: getCustomValidity(isValid2, validity), 43230 hidden: hideLabelFromVision, 43231 label, 43232 help: description, 43233 checked: getValue({ item: data }), 43234 onChange: onChangeControl, 43235 disabled: disabled2 43236 } 43237 ); 43238 } 43239 43240 // packages/dataviews/build-module/components/dataform-controls/textarea.mjs 43241 var import_element132 = __toESM(require_element(), 1); 43242 var import_jsx_runtime189 = __toESM(require_jsx_runtime(), 1); 43243 function Textarea3({ 43244 data, 43245 field, 43246 onChange, 43247 hideLabelFromVision, 43248 markWhenOptional, 43249 config, 43250 validity 43251 }) { 43252 const { rows = 4 } = config || {}; 43253 const disabled2 = field.isDisabled({ item: data, field }); 43254 const { label, placeholder, description, setValue, isValid: isValid2 } = field; 43255 const value = field.getValue({ item: data }); 43256 const onValueChangeControl = (0, import_element132.useCallback)( 43257 (newValue) => onChange(setValue({ item: data, value: newValue })), 43258 [data, onChange, setValue] 43259 ); 43260 return /* @__PURE__ */ (0, import_jsx_runtime189.jsx)( 43261 ValidatedTextareaControl, 43262 { 43263 required: !!isValid2.required, 43264 markWhenOptional, 43265 customValidity: getCustomValidity(isValid2, validity), 43266 label, 43267 placeholder, 43268 value: value ?? "", 43269 description: typeof description === "string" ? description : void 0, 43270 details: typeof description === "string" ? void 0 : description, 43271 onValueChange: onValueChangeControl, 43272 rows, 43273 disabled: disabled2, 43274 minLength: isValid2.minLength ? isValid2.minLength.constraint : void 0, 43275 maxLength: isValid2.maxLength ? isValid2.maxLength.constraint : void 0, 43276 hideLabelFromVision 43277 } 43278 ); 43279 } 43280 43281 // packages/dataviews/build-module/components/dataform-controls/toggle-group.mjs 43282 var import_components46 = __toESM(require_components(), 1); 43283 var import_element133 = __toESM(require_element(), 1); 43284 var import_jsx_runtime190 = __toESM(require_jsx_runtime(), 1); 43285 function ToggleGroup({ 43286 data, 43287 field, 43288 onChange, 43289 hideLabelFromVision, 43290 markWhenOptional, 43291 validity 43292 }) { 43293 const { getValue, setValue, isValid: isValid2 } = field; 43294 const disabled2 = field.isDisabled({ item: data, field }); 43295 const value = getValue({ item: data }); 43296 const onChangeControl = (0, import_element133.useCallback)( 43297 (newValue) => onChange(setValue({ item: data, value: newValue })), 43298 [data, onChange, setValue] 43299 ); 43300 const { elements, isLoading } = useElements({ 43301 elements: field.elements, 43302 getElements: field.getElements 43303 }); 43304 if (isLoading) { 43305 return /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(import_components46.Spinner, {}); 43306 } 43307 if (elements.length === 0) { 43308 return null; 43309 } 43310 const selectedOption = elements.find((el) => el.value === value); 43311 return /* @__PURE__ */ (0, import_jsx_runtime190.jsx)( 43312 ValidatedToggleGroupControl, 43313 { 43314 required: !!field.isValid?.required, 43315 markWhenOptional, 43316 customValidity: getCustomValidity(isValid2, validity), 43317 isBlock: true, 43318 label: field.label, 43319 help: selectedOption?.description || field.description, 43320 onChange: onChangeControl, 43321 value, 43322 hideLabelFromVision, 43323 children: elements.map((el) => /* @__PURE__ */ (0, import_jsx_runtime190.jsx)( 43324 import_components46.__experimentalToggleGroupControlOption, 43325 { 43326 label: el.label, 43327 value: el.value, 43328 disabled: disabled2 43329 }, 43330 el.value 43331 )) 43332 } 43333 ); 43334 } 43335 43336 // packages/dataviews/build-module/components/dataform-controls/array.mjs 43337 var import_components47 = __toESM(require_components(), 1); 43338 var import_element134 = __toESM(require_element(), 1); 43339 var import_jsx_runtime191 = __toESM(require_jsx_runtime(), 1); 43340 function ArrayControl({ 43341 data, 43342 field, 43343 onChange, 43344 hideLabelFromVision, 43345 markWhenOptional, 43346 validity 43347 }) { 43348 const { label, placeholder, description, getValue, setValue, isValid: isValid2 } = field; 43349 const value = getValue({ item: data }); 43350 const disabled2 = field.isDisabled({ item: data, field }); 43351 const { elements, isLoading } = useElements({ 43352 elements: field.elements, 43353 getElements: field.getElements 43354 }); 43355 const arrayValueAsElements = (0, import_element134.useMemo)( 43356 () => Array.isArray(value) ? value.map((token) => { 43357 const element = elements?.find( 43358 (suggestion) => suggestion.value === token 43359 ); 43360 return element || { value: token, label: token }; 43361 }) : [], 43362 [value, elements] 43363 ); 43364 const onChangeControl = (0, import_element134.useCallback)( 43365 (tokens) => { 43366 const valueTokens = tokens.map((token) => { 43367 if (typeof token === "object" && "value" in token) { 43368 return token.value; 43369 } 43370 return token; 43371 }); 43372 onChange(setValue({ item: data, value: valueTokens })); 43373 }, 43374 [onChange, setValue, data] 43375 ); 43376 if (isLoading) { 43377 return /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(import_components47.Spinner, {}); 43378 } 43379 return /* @__PURE__ */ (0, import_jsx_runtime191.jsx)( 43380 ValidatedFormTokenField, 43381 { 43382 required: !!isValid2?.required, 43383 markWhenOptional, 43384 customValidity: getCustomValidity(isValid2, validity), 43385 label: hideLabelFromVision ? void 0 : label, 43386 value: arrayValueAsElements, 43387 onChange: onChangeControl, 43388 placeholder, 43389 suggestions: elements?.map((element) => element.value), 43390 disabled: disabled2, 43391 __experimentalValidateInput: (token) => { 43392 if (field.isValid?.elements && elements) { 43393 return elements.some( 43394 (element) => element.value === token || element.label === token 43395 ); 43396 } 43397 return true; 43398 }, 43399 __experimentalExpandOnFocus: elements && elements.length > 0, 43400 help: description ?? (field.isValid?.elements ? "" : void 0), 43401 displayTransform: (token) => { 43402 if (typeof token === "object" && "label" in token) { 43403 return token.label; 43404 } 43405 if (typeof token === "string" && elements) { 43406 const element = elements.find( 43407 (el) => el.value === token 43408 ); 43409 return element?.label || token; 43410 } 43411 return token; 43412 }, 43413 __experimentalRenderItem: ({ item }) => { 43414 if (typeof item === "string" && elements) { 43415 const element = elements.find( 43416 (el) => el.value === item 43417 ); 43418 return /* @__PURE__ */ (0, import_jsx_runtime191.jsx)("span", { children: element?.label || item }); 43419 } 43420 return /* @__PURE__ */ (0, import_jsx_runtime191.jsx)("span", { children: item }); 43421 } 43422 } 43423 ); 43424 } 43425 43426 // node_modules/colord/index.mjs 43427 for (r2 = { grad: 0.9, turn: 360, rad: 360 / (2 * Math.PI) }, t = function(r3) { 43428 return "string" == typeof r3 ? r3.length > 0 : "number" == typeof r3; 43429 }, n = function(r3, t2, n2) { 43430 return void 0 === t2 && (t2 = 0), void 0 === n2 && (n2 = Math.pow(10, t2)), Math.round(n2 * r3) / n2 + 0; 43431 }, u = function(r3, t2, n2) { 43432 return void 0 === t2 && (t2 = 0), void 0 === n2 && (n2 = 1), r3 > n2 ? n2 : r3 > t2 ? r3 : t2; 43433 }, e = function(r3) { 43434 return (r3 = isFinite(r3) ? r3 % 360 : 0) < 0 ? r3 + 360 : r3; 43435 }, o = function(r3, t2) { 43436 return void 0 === t2 && (t2 = 0), n(r3, t2) % 360; 43437 }, a = function(r3) { 43438 return { r: u(r3.r, 0, 255), g: u(r3.g, 0, 255), b: u(r3.b, 0, 255), a: u(r3.a) }; 43439 }, i = function(r3) { 43440 return { r: n(r3.r), g: n(r3.g), b: n(r3.b), a: n(r3.a, 3) }; 43441 }, s = /^#([0-9a-f]{3,8})$/i, d = function(r3, t2) { 43442 var n2 = r3.charCodeAt(t2); 43443 return (15 & n2) + 9 * (n2 >> 6); 43444 }, h = function(r3, t2) { 43445 return d(r3, t2) << 4 | d(r3, t2 + 1); 43446 }, b = [], f = 0; f < 256; f++) b.push((f < 16 ? "0" : "") + f.toString(16)); 43447 var r2; 43448 var t; 43449 var n; 43450 var u; 43451 var e; 43452 var o; 43453 var a; 43454 var i; 43455 var s; 43456 var d; 43457 var h; 43458 var b; 43459 var f; 43460 var g = function(r2) { 43461 return b[u(r2, 0, 255)]; 43462 }; 43463 var c = function(r2) { 43464 var t = r2.r, n = r2.g, u = r2.b, e = r2.a, o = Math.max(t, n, u), a = o - Math.min(t, n, u), i = a ? o === t ? (n - u) / a : o === n ? 2 + (u - t) / a : 4 + (t - n) / a : 0; 43465 return { h: 60 * (i < 0 ? i + 6 : i), s: o ? a / o * 100 : 0, v: o / 255 * 100, a: e }; 43466 }; 43467 var v = function(r2) { 43468 var t = r2.h, n = r2.s, u = r2.v, e = r2.a; 43469 t = t / 360 * 6, n /= 100, u /= 100; 43470 var o = Math.floor(t), a = u * (1 - n), i = u * (1 - (t - o) * n), s = u * (1 - (1 - t + o) * n), d = o % 6; 43471 return { r: 255 * [u, i, a, a, s, u][d], g: 255 * [s, u, u, i, a, a][d], b: 255 * [a, a, s, u, u, i][d], a: e }; 43472 }; 43473 var l = function(r2) { 43474 return { h: e(r2.h), s: u(r2.s, 0, 100), l: u(r2.l, 0, 100), a: u(r2.a) }; 43475 }; 43476 var p = function(r2) { 43477 return { h: o(r2.h), s: n(r2.s), l: n(r2.l), a: n(r2.a, 3) }; 43478 }; 43479 var m = function(r2) { 43480 return v((n = (t = r2).s, { h: t.h, s: (n *= ((u = t.l) < 50 ? u : 100 - u) / 100) > 0 ? 2 * n / (u + n) * 100 : 0, v: u + n, a: t.a })); 43481 var t, n, u; 43482 }; 43483 var y = function(r2) { 43484 return { h: (t = c(r2)).h, s: (e = (200 - (n = t.s)) * (u = t.v) / 100) > 0 && e < 200 ? n * u / 100 / (e <= 100 ? e : 200 - e) * 100 : 0, l: e / 2, a: t.a }; 43485 var t, n, u, e; 43486 }; 43487 var N = /^hsla?\(\s*([+-]?(?:\d*\.\d+|\d+))(deg|rad|grad|turn)?\s*,\s*([+-]?(?:\d*\.\d+|\d+))%\s*,\s*([+-]?(?:\d*\.\d+|\d+))%\s*(?:,\s*([+-]?(?:\d*\.\d+|\d+))(%)?\s*)?\)$/i; 43488 var x = /^hsla?\(\s*([+-]?(?:\d*\.\d+|\d+))(deg|rad|grad|turn)?\s+([+-]?(?:\d*\.\d+|\d+))%\s+([+-]?(?:\d*\.\d+|\d+))%\s*(?:\/\s*([+-]?(?:\d*\.\d+|\d+))(%)?\s*)?\)$/i; 43489 var M = /^rgba?\(\s*([+-]?(?:\d*\.\d+|\d+))(%)?\s*,\s*([+-]?(?:\d*\.\d+|\d+))(%)?\s*,\s*([+-]?(?:\d*\.\d+|\d+))(%)?\s*(?:,\s*([+-]?(?:\d*\.\d+|\d+))(%)?\s*)?\)$/i; 43490 var H = /^rgba?\(\s*([+-]?(?:\d*\.\d+|\d+))(%)?\s+([+-]?(?:\d*\.\d+|\d+))(%)?\s+([+-]?(?:\d*\.\d+|\d+))(%)?\s*(?:\/\s*([+-]?(?:\d*\.\d+|\d+))(%)?\s*)?\)$/i; 43491 var $ = { string: [[function(r2) { 43492 if (!s.test(r2)) return null; 43493 var t = r2.length; 43494 return t <= 5 ? { r: 17 * d(r2, 1), g: 17 * d(r2, 2), b: 17 * d(r2, 3), a: 5 === t ? n(17 * d(r2, 4) / 255, 2) : 1 } : 7 === t || 9 === t ? { r: h(r2, 1), g: h(r2, 3), b: h(r2, 5), a: 9 === t ? n(h(r2, 7) / 255, 2) : 1 } : null; 43495 }, "hex"], [function(r2) { 43496 var t = M.exec(r2) || H.exec(r2); 43497 return t ? t[2] !== t[4] || t[4] !== t[6] ? null : a({ r: Number(t[1]) / (t[2] ? 100 / 255 : 1), g: Number(t[3]) / (t[4] ? 100 / 255 : 1), b: Number(t[5]) / (t[6] ? 100 / 255 : 1), a: void 0 === t[7] ? 1 : Number(t[7]) / (t[8] ? 100 : 1) }) : null; 43498 }, "rgb"], [function(t) { 43499 var n = N.exec(t) || x.exec(t); 43500 if (!n) return null; 43501 var u, e, o = l({ h: (u = n[1], e = n[2], void 0 === e && (e = "deg"), Number(u) * (r2[e] || 1)), s: Number(n[3]), l: Number(n[4]), a: void 0 === n[5] ? 1 : Number(n[5]) / (n[6] ? 100 : 1) }); 43502 return m(o); 43503 }, "hsl"]], object: [[function(r2) { 43504 var n = r2.r, u = r2.g, e = r2.b, o = r2.a, i = void 0 === o ? 1 : o; 43505 return t(n) && t(u) && t(e) ? a({ r: Number(n), g: Number(u), b: Number(e), a: Number(i) }) : null; 43506 }, "rgb"], [function(r2) { 43507 var n = r2.h, u = r2.s, e = r2.l, o = r2.a, a = void 0 === o ? 1 : o; 43508 if (!t(n) || !t(u) || !t(e)) return null; 43509 var i = l({ h: Number(n), s: Number(u), l: Number(e), a: Number(a) }); 43510 return m(i); 43511 }, "hsl"], [function(r2) { 43512 var n = r2.h, o = r2.s, a = r2.v, i = r2.a, s = void 0 === i ? 1 : i; 43513 if (!t(n) || !t(o) || !t(a)) return null; 43514 var d = (function(r3) { 43515 return { h: e(r3.h), s: u(r3.s, 0, 100), v: u(r3.v, 0, 100), a: u(r3.a) }; 43516 })({ h: Number(n), s: Number(o), v: Number(a), a: Number(s) }); 43517 return v(d); 43518 }, "hsv"]] }; 43519 var j = function(r2, t) { 43520 for (var n = 0; n < t.length; n++) { 43521 var u = t[n][0](r2); 43522 if (u) return [u, t[n][1]]; 43523 } 43524 return [null, void 0]; 43525 }; 43526 var w = function(r2) { 43527 return "string" == typeof r2 ? j(r2.trim(), $.string) : "object" == typeof r2 && null !== r2 ? j(r2, $.object) : [null, void 0]; 43528 }; 43529 var k = function(r2, t) { 43530 var n = y(r2); 43531 return { h: n.h, s: u(n.s + 100 * t, 0, 100), l: n.l, a: n.a }; 43532 }; 43533 var E = function(r2) { 43534 return (299 * r2.r + 587 * r2.g + 114 * r2.b) / 1e3 / 255; 43535 }; 43536 var R = function(r2, t) { 43537 var n = y(r2); 43538 return { h: n.h, s: n.s, l: u(n.l + 100 * t, 0, 100), a: n.a }; 43539 }; 43540 var q = (function() { 43541 function r2(r3) { 43542 this.parsed = w(r3)[0], this.rgba = this.parsed || { r: 0, g: 0, b: 0, a: 1 }; 43543 } 43544 return r2.prototype.isValid = function() { 43545 return null !== this.parsed; 43546 }, r2.prototype.brightness = function() { 43547 return n(E(this.rgba), 2); 43548 }, r2.prototype.isDark = function() { 43549 return E(this.rgba) < 0.5; 43550 }, r2.prototype.isLight = function() { 43551 return E(this.rgba) >= 0.5; 43552 }, r2.prototype.toHex = function() { 43553 return r3 = i(this.rgba), t = r3.r, u = r3.g, e = r3.b, a = (o = r3.a) < 1 ? g(n(255 * o)) : "", "#" + g(t) + g(u) + g(e) + a; 43554 var r3, t, u, e, o, a; 43555 }, r2.prototype.toRgb = function() { 43556 return i(this.rgba); 43557 }, r2.prototype.toRgbString = function() { 43558 return r3 = i(this.rgba), t = r3.r, n = r3.g, u = r3.b, (e = r3.a) < 1 ? "rgba(" + t + ", " + n + ", " + u + ", " + e + ")" : "rgb(" + t + ", " + n + ", " + u + ")"; 43559 var r3, t, n, u, e; 43560 }, r2.prototype.toHsl = function() { 43561 return p(y(this.rgba)); 43562 }, r2.prototype.toHslString = function() { 43563 return r3 = p(y(this.rgba)), t = r3.h, n = r3.s, u = r3.l, (e = r3.a) < 1 ? "hsla(" + t + ", " + n + "%, " + u + "%, " + e + ")" : "hsl(" + t + ", " + n + "%, " + u + "%)"; 43564 var r3, t, n, u, e; 43565 }, r2.prototype.toHsv = function() { 43566 return r3 = c(this.rgba), { h: o(r3.h), s: n(r3.s), v: n(r3.v), a: n(r3.a, 3) }; 43567 var r3; 43568 }, r2.prototype.invert = function() { 43569 return A({ r: 255 - (r3 = this.rgba).r, g: 255 - r3.g, b: 255 - r3.b, a: r3.a }); 43570 var r3; 43571 }, r2.prototype.saturate = function(r3) { 43572 return void 0 === r3 && (r3 = 0.1), A(k(this.rgba, r3)); 43573 }, r2.prototype.desaturate = function(r3) { 43574 return void 0 === r3 && (r3 = 0.1), A(k(this.rgba, -r3)); 43575 }, r2.prototype.grayscale = function() { 43576 return A(k(this.rgba, -1)); 43577 }, r2.prototype.lighten = function(r3) { 43578 return void 0 === r3 && (r3 = 0.1), A(R(this.rgba, r3)); 43579 }, r2.prototype.darken = function(r3) { 43580 return void 0 === r3 && (r3 = 0.1), A(R(this.rgba, -r3)); 43581 }, r2.prototype.rotate = function(r3) { 43582 return void 0 === r3 && (r3 = 15), this.hue(y(this.rgba).h + r3); 43583 }, r2.prototype.alpha = function(r3) { 43584 return "number" == typeof r3 ? A({ r: (t = this.rgba).r, g: t.g, b: t.b, a: r3 }) : n(this.rgba.a, 3); 43585 var t; 43586 }, r2.prototype.hue = function(r3) { 43587 var t = y(this.rgba); 43588 return "number" == typeof r3 ? A({ h: r3, s: t.s, l: t.l, a: t.a }) : o(t.h); 43589 }, r2.prototype.isEqual = function(r3) { 43590 return this.toHex() === A(r3).toHex(); 43591 }, r2; 43592 })(); 43593 var A = function(r2) { 43594 return r2 instanceof q ? r2 : new q(r2); 43595 }; 43596 43597 // packages/dataviews/build-module/components/dataform-controls/color.mjs 43598 var import_components48 = __toESM(require_components(), 1); 43599 var import_element135 = __toESM(require_element(), 1); 43600 var import_i18n54 = __toESM(require_i18n(), 1); 43601 var import_jsx_runtime192 = __toESM(require_jsx_runtime(), 1); 43602 var ColorPickerDropdown = ({ 43603 color, 43604 onColorChange, 43605 disabled: disabled2 43606 }) => { 43607 const validColor = color && A(color).isValid() ? color : "#ffffff"; 43608 return /* @__PURE__ */ (0, import_jsx_runtime192.jsx)( 43609 import_components48.Dropdown, 43610 { 43611 className: "dataviews-controls__color-picker-dropdown", 43612 popoverProps: { resize: false }, 43613 renderToggle: ({ onToggle }) => /* @__PURE__ */ (0, import_jsx_runtime192.jsx)( 43614 import_components48.Button, 43615 { 43616 onClick: onToggle, 43617 "aria-label": (0, import_i18n54.__)("Open color picker"), 43618 size: "small", 43619 disabled: disabled2, 43620 accessibleWhenDisabled: true, 43621 icon: () => /* @__PURE__ */ (0, import_jsx_runtime192.jsx)(import_components48.ColorIndicator, { colorValue: validColor }) 43622 } 43623 ), 43624 renderContent: () => /* @__PURE__ */ (0, import_jsx_runtime192.jsx)(import_components48.__experimentalDropdownContentWrapper, { paddingSize: "none", children: /* @__PURE__ */ (0, import_jsx_runtime192.jsx)( 43625 import_components48.ColorPicker, 43626 { 43627 color: validColor, 43628 onChange: onColorChange, 43629 enableAlpha: true 43630 } 43631 ) }) 43632 } 43633 ); 43634 }; 43635 function Color({ 43636 data, 43637 field, 43638 onChange, 43639 hideLabelFromVision, 43640 markWhenOptional, 43641 validity 43642 }) { 43643 const { label, placeholder, description, setValue, isValid: isValid2 } = field; 43644 const disabled2 = field.isDisabled({ item: data, field }); 43645 const value = field.getValue({ item: data }) || ""; 43646 const handleColorChange = (0, import_element135.useCallback)( 43647 (newColor) => { 43648 onChange(setValue({ item: data, value: newColor })); 43649 }, 43650 [data, onChange, setValue] 43651 ); 43652 const handleInputChange = (0, import_element135.useCallback)( 43653 (newValue) => { 43654 onChange(setValue({ item: data, value: newValue || "" })); 43655 }, 43656 [data, onChange, setValue] 43657 ); 43658 return /* @__PURE__ */ (0, import_jsx_runtime192.jsx)( 43659 ValidatedInputControl, 43660 { 43661 required: !!field.isValid?.required, 43662 markWhenOptional, 43663 customValidity: getCustomValidity(isValid2, validity), 43664 label, 43665 placeholder, 43666 value, 43667 description: typeof description === "string" ? description : void 0, 43668 details: typeof description === "string" ? void 0 : description, 43669 onValueChange: handleInputChange, 43670 hideLabelFromVision, 43671 type: "text", 43672 disabled: disabled2, 43673 prefix: /* @__PURE__ */ (0, import_jsx_runtime192.jsx)(InputLayout3.Slot, { padding: "minimal", children: /* @__PURE__ */ (0, import_jsx_runtime192.jsx)( 43674 ColorPickerDropdown, 43675 { 43676 color: value, 43677 onColorChange: handleColorChange, 43678 disabled: disabled2 43679 } 43680 ) }) 43681 } 43682 ); 43683 } 43684 43685 // packages/dataviews/build-module/components/dataform-controls/password.mjs 43686 var import_components49 = __toESM(require_components(), 1); 43687 var import_element136 = __toESM(require_element(), 1); 43688 var import_i18n55 = __toESM(require_i18n(), 1); 43689 var import_jsx_runtime193 = __toESM(require_jsx_runtime(), 1); 43690 function Password({ 43691 data, 43692 field, 43693 onChange, 43694 hideLabelFromVision, 43695 markWhenOptional, 43696 validity 43697 }) { 43698 const [isVisible2, setIsVisible] = (0, import_element136.useState)(false); 43699 const disabled2 = field.isDisabled({ item: data, field }); 43700 const toggleVisibility = (0, import_element136.useCallback)(() => { 43701 setIsVisible((prev) => !prev); 43702 }, []); 43703 return /* @__PURE__ */ (0, import_jsx_runtime193.jsx)( 43704 ValidatedText, 43705 { 43706 ...{ 43707 data, 43708 field, 43709 onChange, 43710 hideLabelFromVision, 43711 markWhenOptional, 43712 validity, 43713 type: isVisible2 ? "text" : "password", 43714 suffix: /* @__PURE__ */ (0, import_jsx_runtime193.jsx)(InputLayout3.Slot, { padding: "minimal", children: /* @__PURE__ */ (0, import_jsx_runtime193.jsx)( 43715 import_components49.Button, 43716 { 43717 icon: isVisible2 ? unseen_default : seen_default, 43718 onClick: toggleVisibility, 43719 size: "small", 43720 label: isVisible2 ? (0, import_i18n55.__)("Hide password") : (0, import_i18n55.__)("Show password"), 43721 disabled: disabled2, 43722 accessibleWhenDisabled: true 43723 } 43724 ) }) 43725 } 43726 } 43727 ); 43728 } 43729 43730 // packages/dataviews/build-module/field-types/utils/has-elements.mjs 43731 function hasElements(field) { 43732 return Array.isArray(field.elements) && field.elements.length > 0 || typeof field.getElements === "function"; 43733 } 43734 43735 // packages/dataviews/build-module/components/dataform-controls/index.mjs 43736 var import_jsx_runtime194 = __toESM(require_jsx_runtime(), 1); 43737 var FORM_CONTROLS = { 43738 adaptiveSelect: AdaptiveSelect, 43739 array: ArrayControl, 43740 checkbox: Checkbox, 43741 color: Color, 43742 combobox: Combobox3, 43743 datetime: DateTime, 43744 date: DateControl, 43745 email: Email, 43746 telephone: Telephone, 43747 url: Url, 43748 integer: Integer, 43749 number: Number2, 43750 password: Password, 43751 radio: Radio, 43752 select: Select2, 43753 text: Text3, 43754 time: Time, 43755 toggle: Toggle, 43756 textarea: Textarea3, 43757 toggleGroup: ToggleGroup 43758 }; 43759 function isEditConfig(value) { 43760 return value && typeof value === "object" && typeof value.control === "string"; 43761 } 43762 function createConfiguredControl(config) { 43763 const { control, ...controlConfig } = config; 43764 const BaseControlType = getControlByType(control); 43765 if (BaseControlType === null) { 43766 return null; 43767 } 43768 return function ConfiguredControl(props) { 43769 return /* @__PURE__ */ (0, import_jsx_runtime194.jsx)(BaseControlType, { ...props, config: controlConfig }); 43770 }; 43771 } 43772 function getControl(field, fallback) { 43773 if (typeof field.Edit === "function") { 43774 return field.Edit; 43775 } 43776 if (typeof field.Edit === "string") { 43777 return getControlByType(field.Edit); 43778 } 43779 if (isEditConfig(field.Edit)) { 43780 return createConfiguredControl(field.Edit); 43781 } 43782 if (hasElements(field) && field.type !== "array") { 43783 return getControlByType("adaptiveSelect"); 43784 } 43785 if (fallback === null) { 43786 return null; 43787 } 43788 return getControlByType(fallback); 43789 } 43790 function getControlByType(type) { 43791 if (Object.keys(FORM_CONTROLS).includes(type)) { 43792 return FORM_CONTROLS[type]; 43793 } 43794 return null; 43795 } 43796 43797 // packages/dataviews/build-module/field-types/utils/get-filter-by.mjs 43798 function getFilterBy(field, defaultOperators, validOperators) { 43799 if (field.filterBy === false) { 43800 return false; 43801 } 43802 const operators = field.filterBy?.operators?.filter( 43803 (op) => validOperators.includes(op) 43804 ) ?? defaultOperators; 43805 if (operators.length === 0) { 43806 return false; 43807 } 43808 return { 43809 isPrimary: !!field.filterBy?.isPrimary, 43810 operators 43811 }; 43812 } 43813 var get_filter_by_default = getFilterBy; 43814 43815 // packages/dataviews/build-module/field-types/utils/get-value-from-id.mjs 43816 var getValueFromId = (id) => ({ item }) => { 43817 const path = id.split("."); 43818 let value = item; 43819 for (const segment of path) { 43820 if (value.hasOwnProperty(segment)) { 43821 value = value[segment]; 43822 } else { 43823 value = void 0; 43824 } 43825 } 43826 return value; 43827 }; 43828 var get_value_from_id_default = getValueFromId; 43829 43830 // packages/dataviews/build-module/field-types/utils/set-value-from-id.mjs 43831 var setValueFromId = (id) => ({ value }) => { 43832 const path = id.split("."); 43833 const result = {}; 43834 let current = result; 43835 for (const segment of path.slice(0, -1)) { 43836 current[segment] = {}; 43837 current = current[segment]; 43838 } 43839 current[path.at(-1)] = value; 43840 return result; 43841 }; 43842 var set_value_from_id_default = setValueFromId; 43843 43844 // packages/dataviews/build-module/field-types/email.mjs 43845 var import_i18n56 = __toESM(require_i18n(), 1); 43846 43847 // packages/dataviews/build-module/field-types/utils/render-from-elements.mjs 43848 function RenderFromElements({ 43849 item, 43850 field 43851 }) { 43852 const { elements, isLoading } = useElements({ 43853 elements: field.elements, 43854 getElements: field.getElements 43855 }); 43856 const value = field.getValue({ item }); 43857 if (isLoading) { 43858 return value; 43859 } 43860 if (elements.length === 0) { 43861 return value; 43862 } 43863 return elements?.find((element) => element.value === value)?.label || field.getValue({ item }); 43864 } 43865 43866 // packages/dataviews/build-module/field-types/utils/render-default.mjs 43867 var import_jsx_runtime195 = __toESM(require_jsx_runtime(), 1); 43868 function render({ 43869 item, 43870 field 43871 }) { 43872 if (field.hasElements) { 43873 return /* @__PURE__ */ (0, import_jsx_runtime195.jsx)(RenderFromElements, { item, field }); 43874 } 43875 return field.getValueFormatted({ item, field }); 43876 } 43877 43878 // packages/dataviews/build-module/field-types/utils/sort-text.mjs 43879 var sort_text_default = (a, b, direction) => { 43880 return direction === "asc" ? a.localeCompare(b) : b.localeCompare(a); 43881 }; 43882 43883 // packages/dataviews/build-module/field-types/utils/is-valid-required.mjs 43884 function isValidRequired(item, field) { 43885 const value = field.getValue({ item }); 43886 return ![void 0, "", null].includes(value); 43887 } 43888 43889 // packages/dataviews/build-module/field-types/utils/is-valid-min-length.mjs 43890 function isValidMinLength(item, field) { 43891 if (typeof field.isValid.minLength?.constraint !== "number") { 43892 return false; 43893 } 43894 const value = field.getValue({ item }); 43895 if ([void 0, "", null].includes(value)) { 43896 return true; 43897 } 43898 return String(value).length >= field.isValid.minLength.constraint; 43899 } 43900 43901 // packages/dataviews/build-module/field-types/utils/is-valid-max-length.mjs 43902 function isValidMaxLength(item, field) { 43903 if (typeof field.isValid.maxLength?.constraint !== "number") { 43904 return false; 43905 } 43906 const value = field.getValue({ item }); 43907 if ([void 0, "", null].includes(value)) { 43908 return true; 43909 } 43910 return String(value).length <= field.isValid.maxLength.constraint; 43911 } 43912 43913 // packages/dataviews/build-module/field-types/utils/is-valid-pattern.mjs 43914 function isValidPattern(item, field) { 43915 if (field.isValid.pattern?.constraint === void 0) { 43916 return true; 43917 } 43918 try { 43919 const regexp = new RegExp(field.isValid.pattern.constraint); 43920 const value = field.getValue({ item }); 43921 if ([void 0, "", null].includes(value)) { 43922 return true; 43923 } 43924 return regexp.test(String(value)); 43925 } catch { 43926 return false; 43927 } 43928 } 43929 43930 // packages/dataviews/build-module/field-types/utils/is-valid-elements.mjs 43931 function isValidElements(item, field) { 43932 const elements = field.elements ?? []; 43933 const validValues = elements.map((el) => el.value); 43934 if (validValues.length === 0) { 43935 return true; 43936 } 43937 const value = field.getValue({ item }); 43938 return [].concat(value).every((v2) => validValues.includes(v2)); 43939 } 43940 43941 // packages/dataviews/build-module/field-types/utils/get-value-formatted-default.mjs 43942 function getValueFormatted({ 43943 item, 43944 field 43945 }) { 43946 return field.getValue({ item }); 43947 } 43948 var get_value_formatted_default_default = getValueFormatted; 43949 43950 // packages/dataviews/build-module/field-types/email.mjs 43951 var emailRegex = /^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/; 43952 function isValidCustom(item, field) { 43953 const value = field.getValue({ item }); 43954 if (![void 0, "", null].includes(value) && !emailRegex.test(value)) { 43955 return (0, import_i18n56.__)("Value must be a valid email address."); 43956 } 43957 return null; 43958 } 43959 var email_default = { 43960 type: "email", 43961 render, 43962 Edit: "email", 43963 sort: sort_text_default, 43964 enableSorting: true, 43965 enableGlobalSearch: false, 43966 defaultOperators: [OPERATOR_IS_ANY, OPERATOR_IS_NONE], 43967 validOperators: [ 43968 OPERATOR_IS, 43969 OPERATOR_IS_NOT, 43970 OPERATOR_CONTAINS, 43971 OPERATOR_NOT_CONTAINS, 43972 OPERATOR_STARTS_WITH, 43973 // Multiple selection 43974 OPERATOR_IS_ANY, 43975 OPERATOR_IS_NONE, 43976 OPERATOR_IS_NOT_ALL 43977 ], 43978 format: {}, 43979 getValueFormatted: get_value_formatted_default_default, 43980 validate: { 43981 required: isValidRequired, 43982 pattern: isValidPattern, 43983 minLength: isValidMinLength, 43984 maxLength: isValidMaxLength, 43985 elements: isValidElements, 43986 custom: isValidCustom 43987 } 43988 }; 43989 43990 // packages/dataviews/build-module/field-types/integer.mjs 43991 var import_i18n57 = __toESM(require_i18n(), 1); 43992 43993 // packages/dataviews/build-module/field-types/utils/sort-number.mjs 43994 var sort_number_default = (a, b, direction) => { 43995 return direction === "asc" ? a - b : b - a; 43996 }; 43997 43998 // packages/dataviews/build-module/field-types/utils/is-valid-min.mjs 43999 function isValidMin(item, field) { 44000 if (typeof field.isValid.min?.constraint !== "number") { 44001 return false; 44002 } 44003 const value = field.getValue({ item }); 44004 if ([void 0, "", null].includes(value)) { 44005 return true; 44006 } 44007 return Number(value) >= field.isValid.min.constraint; 44008 } 44009 44010 // packages/dataviews/build-module/field-types/utils/is-valid-max.mjs 44011 function isValidMax(item, field) { 44012 if (typeof field.isValid.max?.constraint !== "number") { 44013 return false; 44014 } 44015 const value = field.getValue({ item }); 44016 if ([void 0, "", null].includes(value)) { 44017 return true; 44018 } 44019 return Number(value) <= field.isValid.max.constraint; 44020 } 44021 44022 // packages/dataviews/build-module/field-types/integer.mjs 44023 var format2 = { 44024 separatorThousand: "," 44025 }; 44026 function getValueFormatted2({ 44027 item, 44028 field 44029 }) { 44030 let value = field.getValue({ item }); 44031 if (value === null || value === void 0) { 44032 return ""; 44033 } 44034 value = Number(value); 44035 if (!Number.isFinite(value)) { 44036 return String(value); 44037 } 44038 let formatInteger; 44039 if (field.type !== "integer") { 44040 formatInteger = format2; 44041 } else { 44042 formatInteger = field.format; 44043 } 44044 const { separatorThousand } = formatInteger; 44045 const integerValue = Math.trunc(value); 44046 if (!separatorThousand) { 44047 return String(integerValue); 44048 } 44049 return String(integerValue).replace( 44050 /\B(?=(\d{3})+(?!\d))/g, 44051 separatorThousand 44052 ); 44053 } 44054 function isValidCustom2(item, field) { 44055 const value = field.getValue({ item }); 44056 if (![void 0, "", null].includes(value) && !Number.isInteger(value)) { 44057 return (0, import_i18n57.__)("Value must be an integer."); 44058 } 44059 return null; 44060 } 44061 var integer_default = { 44062 type: "integer", 44063 render, 44064 Edit: "integer", 44065 sort: sort_number_default, 44066 enableSorting: true, 44067 enableGlobalSearch: false, 44068 defaultOperators: [ 44069 OPERATOR_IS, 44070 OPERATOR_IS_NOT, 44071 OPERATOR_LESS_THAN, 44072 OPERATOR_GREATER_THAN, 44073 OPERATOR_LESS_THAN_OR_EQUAL, 44074 OPERATOR_GREATER_THAN_OR_EQUAL, 44075 OPERATOR_BETWEEN 44076 ], 44077 validOperators: [ 44078 // Single-selection 44079 OPERATOR_IS, 44080 OPERATOR_IS_NOT, 44081 OPERATOR_LESS_THAN, 44082 OPERATOR_GREATER_THAN, 44083 OPERATOR_LESS_THAN_OR_EQUAL, 44084 OPERATOR_GREATER_THAN_OR_EQUAL, 44085 OPERATOR_BETWEEN, 44086 // Multiple-selection 44087 OPERATOR_IS_ANY, 44088 OPERATOR_IS_NONE, 44089 OPERATOR_IS_NOT_ALL 44090 ], 44091 format: format2, 44092 getValueFormatted: getValueFormatted2, 44093 validate: { 44094 required: isValidRequired, 44095 min: isValidMin, 44096 max: isValidMax, 44097 elements: isValidElements, 44098 custom: isValidCustom2 44099 } 44100 }; 44101 44102 // packages/dataviews/build-module/field-types/number.mjs 44103 var import_i18n58 = __toESM(require_i18n(), 1); 44104 var format3 = { 44105 separatorThousand: ",", 44106 separatorDecimal: ".", 44107 decimals: 2 44108 }; 44109 function getValueFormatted3({ 44110 item, 44111 field 44112 }) { 44113 let value = field.getValue({ item }); 44114 if (value === null || value === void 0) { 44115 return ""; 44116 } 44117 value = Number(value); 44118 if (!Number.isFinite(value)) { 44119 return String(value); 44120 } 44121 let formatNumber; 44122 if (field.type !== "number") { 44123 formatNumber = format3; 44124 } else { 44125 formatNumber = field.format; 44126 } 44127 const { separatorThousand, separatorDecimal, decimals } = formatNumber; 44128 const fixedValue = value.toFixed(decimals); 44129 const [integerPart, decimalPart] = fixedValue.split("."); 44130 const formattedInteger = separatorThousand ? integerPart.replace(/\B(?=(\d{3})+(?!\d))/g, separatorThousand) : integerPart; 44131 return decimals === 0 ? formattedInteger : formattedInteger + separatorDecimal + decimalPart; 44132 } 44133 function isEmpty(value) { 44134 return value === "" || value === void 0 || value === null; 44135 } 44136 function isValidCustom3(item, field) { 44137 const value = field.getValue({ item }); 44138 if (!isEmpty(value) && !Number.isFinite(value)) { 44139 return (0, import_i18n58.__)("Value must be a number."); 44140 } 44141 return null; 44142 } 44143 var number_default = { 44144 type: "number", 44145 render, 44146 Edit: "number", 44147 sort: sort_number_default, 44148 enableSorting: true, 44149 enableGlobalSearch: false, 44150 defaultOperators: [ 44151 OPERATOR_IS, 44152 OPERATOR_IS_NOT, 44153 OPERATOR_LESS_THAN, 44154 OPERATOR_GREATER_THAN, 44155 OPERATOR_LESS_THAN_OR_EQUAL, 44156 OPERATOR_GREATER_THAN_OR_EQUAL, 44157 OPERATOR_BETWEEN 44158 ], 44159 validOperators: [ 44160 // Single-selection 44161 OPERATOR_IS, 44162 OPERATOR_IS_NOT, 44163 OPERATOR_LESS_THAN, 44164 OPERATOR_GREATER_THAN, 44165 OPERATOR_LESS_THAN_OR_EQUAL, 44166 OPERATOR_GREATER_THAN_OR_EQUAL, 44167 OPERATOR_BETWEEN, 44168 // Multiple-selection 44169 OPERATOR_IS_ANY, 44170 OPERATOR_IS_NONE, 44171 OPERATOR_IS_NOT_ALL 44172 ], 44173 format: format3, 44174 getValueFormatted: getValueFormatted3, 44175 validate: { 44176 required: isValidRequired, 44177 min: isValidMin, 44178 max: isValidMax, 44179 elements: isValidElements, 44180 custom: isValidCustom3 44181 } 44182 }; 44183 44184 // packages/dataviews/build-module/field-types/text.mjs 44185 var text_default = { 44186 type: "text", 44187 render, 44188 Edit: "text", 44189 sort: sort_text_default, 44190 enableSorting: true, 44191 enableGlobalSearch: false, 44192 defaultOperators: [OPERATOR_IS_ANY, OPERATOR_IS_NONE], 44193 validOperators: [ 44194 // Single selection 44195 OPERATOR_IS, 44196 OPERATOR_IS_NOT, 44197 OPERATOR_CONTAINS, 44198 OPERATOR_NOT_CONTAINS, 44199 OPERATOR_STARTS_WITH, 44200 // Multiple selection 44201 OPERATOR_IS_ANY, 44202 OPERATOR_IS_NONE, 44203 OPERATOR_IS_NOT_ALL 44204 ], 44205 format: {}, 44206 getValueFormatted: get_value_formatted_default_default, 44207 validate: { 44208 required: isValidRequired, 44209 pattern: isValidPattern, 44210 minLength: isValidMinLength, 44211 maxLength: isValidMaxLength, 44212 elements: isValidElements 44213 } 44214 }; 44215 44216 // packages/dataviews/build-module/field-types/datetime.mjs 44217 var import_date9 = __toESM(require_date(), 1); 44218 44219 // packages/dataviews/build-module/field-types/utils/is-valid-boundary.mjs 44220 var import_date8 = __toESM(require_date(), 1); 44221 function parseDateLike(value) { 44222 if (!isValid(new Date(value))) { 44223 return null; 44224 } 44225 const parsed = (0, import_date8.getDate)(value); 44226 return parsed && isValid(parsed) ? parsed.getTime() : null; 44227 } 44228 function validateBoundary(item, field, boundary, parse2) { 44229 const constraint = field.isValid[boundary]?.constraint; 44230 if (typeof constraint !== "string") { 44231 return false; 44232 } 44233 const value = field.getValue({ item }); 44234 const boundaryValue = Array.isArray(value) ? value[boundary === "min" ? 0 : value.length - 1] : value; 44235 if (boundaryValue === void 0 || boundaryValue === null || boundaryValue === "") { 44236 return true; 44237 } 44238 const parsedConstraint = parse2(constraint); 44239 const parsedValue = parse2(String(boundaryValue)); 44240 if (parsedConstraint === null || parsedValue === null) { 44241 return false; 44242 } 44243 return boundary === "min" ? parsedValue >= parsedConstraint : parsedValue <= parsedConstraint; 44244 } 44245 function isValidMinDate(item, field) { 44246 return validateBoundary(item, field, "min", parseDateLike); 44247 } 44248 function isValidMaxDate(item, field) { 44249 return validateBoundary(item, field, "max", parseDateLike); 44250 } 44251 function isValidMinTime(item, field) { 44252 return validateBoundary(item, field, "min", parseTime2); 44253 } 44254 function isValidMaxTime(item, field) { 44255 return validateBoundary(item, field, "max", parseTime2); 44256 } 44257 44258 // packages/dataviews/build-module/field-types/datetime.mjs 44259 var format4 = { 44260 datetime: (0, import_date9.getSettings)().formats.datetime, 44261 weekStartsOn: (0, import_date9.getSettings)().l10n.startOfWeek 44262 }; 44263 function getValueFormatted4({ 44264 item, 44265 field 44266 }) { 44267 const value = field.getValue({ item }); 44268 if (["", void 0, null].includes(value)) { 44269 return ""; 44270 } 44271 let formatDatetime; 44272 if (field.type !== "datetime") { 44273 formatDatetime = format4; 44274 } else { 44275 formatDatetime = field.format; 44276 } 44277 return (0, import_date9.dateI18n)(formatDatetime.datetime, (0, import_date9.getDate)(value)); 44278 } 44279 var sort = (a, b, direction) => { 44280 const timeA = new Date(a).getTime(); 44281 const timeB = new Date(b).getTime(); 44282 return direction === "asc" ? timeA - timeB : timeB - timeA; 44283 }; 44284 var datetime_default = { 44285 type: "datetime", 44286 render, 44287 Edit: "datetime", 44288 sort, 44289 enableSorting: true, 44290 enableGlobalSearch: false, 44291 defaultOperators: [ 44292 OPERATOR_ON, 44293 OPERATOR_NOT_ON, 44294 OPERATOR_BEFORE, 44295 OPERATOR_AFTER, 44296 OPERATOR_BEFORE_INC, 44297 OPERATOR_AFTER_INC, 44298 OPERATOR_IN_THE_PAST, 44299 OPERATOR_OVER 44300 ], 44301 validOperators: [ 44302 OPERATOR_ON, 44303 OPERATOR_NOT_ON, 44304 OPERATOR_BEFORE, 44305 OPERATOR_AFTER, 44306 OPERATOR_BEFORE_INC, 44307 OPERATOR_AFTER_INC, 44308 OPERATOR_IN_THE_PAST, 44309 OPERATOR_OVER 44310 ], 44311 format: format4, 44312 getValueFormatted: getValueFormatted4, 44313 validate: { 44314 required: isValidRequired, 44315 elements: isValidElements, 44316 min: isValidMinDate, 44317 max: isValidMaxDate 44318 } 44319 }; 44320 44321 // packages/dataviews/build-module/field-types/date.mjs 44322 var import_date10 = __toESM(require_date(), 1); 44323 var format5 = { 44324 date: (0, import_date10.getSettings)().formats.date, 44325 weekStartsOn: (0, import_date10.getSettings)().l10n.startOfWeek 44326 }; 44327 function getValueFormatted5({ 44328 item, 44329 field 44330 }) { 44331 const value = field.getValue({ item }); 44332 if (["", void 0, null].includes(value)) { 44333 return ""; 44334 } 44335 let formatDate2; 44336 if (field.type !== "date") { 44337 formatDate2 = format5; 44338 } else { 44339 formatDate2 = field.format; 44340 } 44341 return (0, import_date10.dateI18n)(formatDate2.date, (0, import_date10.getDate)(value)); 44342 } 44343 var sort2 = (a, b, direction) => { 44344 const timeA = new Date(a).getTime(); 44345 const timeB = new Date(b).getTime(); 44346 return direction === "asc" ? timeA - timeB : timeB - timeA; 44347 }; 44348 var date_default = { 44349 type: "date", 44350 render, 44351 Edit: "date", 44352 sort: sort2, 44353 enableSorting: true, 44354 enableGlobalSearch: false, 44355 defaultOperators: [ 44356 OPERATOR_ON, 44357 OPERATOR_NOT_ON, 44358 OPERATOR_BEFORE, 44359 OPERATOR_AFTER, 44360 OPERATOR_BEFORE_INC, 44361 OPERATOR_AFTER_INC, 44362 OPERATOR_IN_THE_PAST, 44363 OPERATOR_OVER, 44364 OPERATOR_BETWEEN 44365 ], 44366 validOperators: [ 44367 OPERATOR_ON, 44368 OPERATOR_NOT_ON, 44369 OPERATOR_BEFORE, 44370 OPERATOR_AFTER, 44371 OPERATOR_BEFORE_INC, 44372 OPERATOR_AFTER_INC, 44373 OPERATOR_IN_THE_PAST, 44374 OPERATOR_OVER, 44375 OPERATOR_BETWEEN 44376 ], 44377 format: format5, 44378 getValueFormatted: getValueFormatted5, 44379 validate: { 44380 required: isValidRequired, 44381 elements: isValidElements, 44382 min: isValidMinDate, 44383 max: isValidMaxDate 44384 } 44385 }; 44386 44387 // packages/dataviews/build-module/field-types/time.mjs 44388 var import_date11 = __toESM(require_date(), 1); 44389 var format6 = { 44390 time: (0, import_date11.getSettings)().formats.time 44391 }; 44392 var ANCHOR_DATE = "2000-01-01"; 44393 function toAnchoredDate(secondsSinceMidnight) { 44394 const hours = Math.floor(secondsSinceMidnight / 3600); 44395 const minutes = Math.floor(secondsSinceMidnight % 3600 / 60); 44396 const seconds = secondsSinceMidnight % 60; 44397 const time = [hours, minutes, seconds].map((part) => String(part).padStart(2, "0")).join(":"); 44398 return (0, import_date11.getDate)(`$ANCHOR_DATE}T$time}`); 44399 } 44400 function getValueFormatted6({ 44401 item, 44402 field 44403 }) { 44404 const secondsSinceMidnight = parseTime2(field.getValue({ item })); 44405 if (secondsSinceMidnight === null) { 44406 return ""; 44407 } 44408 let formatTime; 44409 if (field.type !== "time") { 44410 formatTime = format6; 44411 } else { 44412 formatTime = field.format; 44413 } 44414 return (0, import_date11.dateI18n)(formatTime.time, toAnchoredDate(secondsSinceMidnight)); 44415 } 44416 var sort3 = (a, b, direction) => { 44417 const timeA = parseTime2(a); 44418 const timeB = parseTime2(b); 44419 if (timeA === null || timeB === null) { 44420 if (timeA === timeB) { 44421 return 0; 44422 } 44423 return timeA === null ? 1 : -1; 44424 } 44425 return direction === "asc" ? timeA - timeB : timeB - timeA; 44426 }; 44427 var time_default = { 44428 type: "time", 44429 render, 44430 Edit: "time", 44431 sort: sort3, 44432 enableSorting: true, 44433 enableGlobalSearch: false, 44434 defaultOperators: [ 44435 OPERATOR_ON, 44436 OPERATOR_NOT_ON, 44437 OPERATOR_BEFORE, 44438 OPERATOR_AFTER, 44439 OPERATOR_BEFORE_INC, 44440 OPERATOR_AFTER_INC, 44441 OPERATOR_BETWEEN 44442 ], 44443 validOperators: [ 44444 OPERATOR_ON, 44445 OPERATOR_NOT_ON, 44446 OPERATOR_BEFORE, 44447 OPERATOR_AFTER, 44448 OPERATOR_BEFORE_INC, 44449 OPERATOR_AFTER_INC, 44450 OPERATOR_BETWEEN 44451 ], 44452 format: format6, 44453 getValueFormatted: getValueFormatted6, 44454 validate: { 44455 required: isValidRequired, 44456 elements: isValidElements, 44457 min: isValidMinTime, 44458 max: isValidMaxTime 44459 } 44460 }; 44461 44462 // packages/dataviews/build-module/field-types/boolean.mjs 44463 var import_i18n59 = __toESM(require_i18n(), 1); 44464 44465 // packages/dataviews/build-module/field-types/utils/is-valid-required-for-bool.mjs 44466 function isValidRequiredForBool(item, field) { 44467 const value = field.getValue({ item }); 44468 return value === true; 44469 } 44470 44471 // packages/dataviews/build-module/field-types/boolean.mjs 44472 function getValueFormatted7({ 44473 item, 44474 field 44475 }) { 44476 const value = field.getValue({ item }); 44477 if (value === true) { 44478 return (0, import_i18n59.__)("True"); 44479 } 44480 if (value === false) { 44481 return (0, import_i18n59.__)("False"); 44482 } 44483 return ""; 44484 } 44485 function isValidCustom4(item, field) { 44486 const value = field.getValue({ item }); 44487 if (![void 0, "", null].includes(value) && ![true, false].includes(value)) { 44488 return (0, import_i18n59.__)("Value must be true, false, or undefined"); 44489 } 44490 return null; 44491 } 44492 var sort4 = (a, b, direction) => { 44493 const boolA = Boolean(a); 44494 const boolB = Boolean(b); 44495 if (boolA === boolB) { 44496 return 0; 44497 } 44498 if (direction === "asc") { 44499 return boolA ? 1 : -1; 44500 } 44501 return boolA ? -1 : 1; 44502 }; 44503 var boolean_default = { 44504 type: "boolean", 44505 render, 44506 Edit: "checkbox", 44507 sort: sort4, 44508 validate: { 44509 required: isValidRequiredForBool, 44510 elements: isValidElements, 44511 custom: isValidCustom4 44512 }, 44513 enableSorting: true, 44514 enableGlobalSearch: false, 44515 defaultOperators: [OPERATOR_IS, OPERATOR_IS_NOT], 44516 validOperators: [OPERATOR_IS, OPERATOR_IS_NOT], 44517 format: {}, 44518 getValueFormatted: getValueFormatted7 44519 }; 44520 44521 // packages/dataviews/build-module/field-types/media.mjs 44522 var media_default = { 44523 type: "media", 44524 render: () => null, 44525 Edit: null, 44526 sort: () => 0, 44527 enableSorting: false, 44528 enableGlobalSearch: false, 44529 defaultOperators: [], 44530 validOperators: [], 44531 format: {}, 44532 getValueFormatted: get_value_formatted_default_default, 44533 // cannot validate any constraint, so 44534 // the only available validation for the field author 44535 // would be providing a custom validator. 44536 validate: {} 44537 }; 44538 44539 // packages/dataviews/build-module/field-types/array.mjs 44540 var import_i18n60 = __toESM(require_i18n(), 1); 44541 44542 // packages/dataviews/build-module/field-types/utils/is-valid-required-for-array.mjs 44543 function isValidRequiredForArray(item, field) { 44544 const value = field.getValue({ item }); 44545 return Array.isArray(value) && value.length > 0 && value.every( 44546 (element) => ![void 0, "", null].includes(element) 44547 ); 44548 } 44549 44550 // packages/dataviews/build-module/field-types/array.mjs 44551 function getValueFormatted8({ 44552 item, 44553 field 44554 }) { 44555 const value = field.getValue({ item }); 44556 const arr = Array.isArray(value) ? value : []; 44557 return arr.join(", "); 44558 } 44559 function render2({ item, field }) { 44560 return getValueFormatted8({ item, field }); 44561 } 44562 function isValidCustom5(item, field) { 44563 const value = field.getValue({ item }); 44564 if ([void 0, "", null].includes(value)) { 44565 return null; 44566 } 44567 if (!Array.isArray(value)) { 44568 return (0, import_i18n60.__)("Value must be an array."); 44569 } 44570 if (!value.every((v2) => typeof v2 === "string")) { 44571 return (0, import_i18n60.__)("Every value must be a string."); 44572 } 44573 return null; 44574 } 44575 var sort5 = (a, b, direction) => { 44576 const arrA = Array.isArray(a) ? a : []; 44577 const arrB = Array.isArray(b) ? b : []; 44578 if (arrA.length !== arrB.length) { 44579 return direction === "asc" ? arrA.length - arrB.length : arrB.length - arrA.length; 44580 } 44581 const joinedA = arrA.join(","); 44582 const joinedB = arrB.join(","); 44583 return direction === "asc" ? joinedA.localeCompare(joinedB) : joinedB.localeCompare(joinedA); 44584 }; 44585 var array_default = { 44586 type: "array", 44587 render: render2, 44588 Edit: "array", 44589 sort: sort5, 44590 enableSorting: true, 44591 enableGlobalSearch: false, 44592 defaultOperators: [OPERATOR_IS_ANY, OPERATOR_IS_NONE], 44593 validOperators: [ 44594 OPERATOR_IS_ANY, 44595 OPERATOR_IS_NONE, 44596 OPERATOR_IS_ALL, 44597 OPERATOR_IS_NOT_ALL 44598 ], 44599 format: {}, 44600 getValueFormatted: getValueFormatted8, 44601 validate: { 44602 required: isValidRequiredForArray, 44603 elements: isValidElements, 44604 custom: isValidCustom5 44605 } 44606 }; 44607 44608 // packages/dataviews/build-module/field-types/password.mjs 44609 function getValueFormatted9({ 44610 item, 44611 field 44612 }) { 44613 return field.getValue({ item }) ? "\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022" : ""; 44614 } 44615 var password_default = { 44616 type: "password", 44617 render, 44618 Edit: "password", 44619 sort: () => 0, 44620 // Passwords should not be sortable for security reasons 44621 enableSorting: false, 44622 enableGlobalSearch: false, 44623 defaultOperators: [], 44624 validOperators: [], 44625 format: {}, 44626 getValueFormatted: getValueFormatted9, 44627 validate: { 44628 required: isValidRequired, 44629 pattern: isValidPattern, 44630 minLength: isValidMinLength, 44631 maxLength: isValidMaxLength, 44632 elements: isValidElements 44633 } 44634 }; 44635 44636 // packages/dataviews/build-module/field-types/telephone.mjs 44637 var telephone_default = { 44638 type: "telephone", 44639 render, 44640 Edit: "telephone", 44641 sort: sort_text_default, 44642 enableSorting: true, 44643 enableGlobalSearch: false, 44644 defaultOperators: [OPERATOR_IS_ANY, OPERATOR_IS_NONE], 44645 validOperators: [ 44646 OPERATOR_IS, 44647 OPERATOR_IS_NOT, 44648 OPERATOR_CONTAINS, 44649 OPERATOR_NOT_CONTAINS, 44650 OPERATOR_STARTS_WITH, 44651 // Multiple selection 44652 OPERATOR_IS_ANY, 44653 OPERATOR_IS_NONE, 44654 OPERATOR_IS_NOT_ALL 44655 ], 44656 format: {}, 44657 getValueFormatted: get_value_formatted_default_default, 44658 validate: { 44659 required: isValidRequired, 44660 pattern: isValidPattern, 44661 minLength: isValidMinLength, 44662 maxLength: isValidMaxLength, 44663 elements: isValidElements 44664 } 44665 }; 44666 44667 // packages/dataviews/build-module/field-types/color.mjs 44668 var import_i18n61 = __toESM(require_i18n(), 1); 44669 var import_jsx_runtime196 = __toESM(require_jsx_runtime(), 1); 44670 function render3({ item, field }) { 44671 if (field.hasElements) { 44672 return /* @__PURE__ */ (0, import_jsx_runtime196.jsx)(RenderFromElements, { item, field }); 44673 } 44674 const value = get_value_formatted_default_default({ item, field }); 44675 if (!value || !A(value).isValid()) { 44676 return value; 44677 } 44678 return /* @__PURE__ */ (0, import_jsx_runtime196.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: "8px" }, children: [ 44679 /* @__PURE__ */ (0, import_jsx_runtime196.jsx)( 44680 "div", 44681 { 44682 style: { 44683 width: "16px", 44684 height: "16px", 44685 borderRadius: "50%", 44686 backgroundColor: value, 44687 border: "1px solid #ddd", 44688 flexShrink: 0 44689 } 44690 } 44691 ), 44692 /* @__PURE__ */ (0, import_jsx_runtime196.jsx)("span", { children: value }) 44693 ] }); 44694 } 44695 function isValidCustom6(item, field) { 44696 const value = field.getValue({ item }); 44697 if (![void 0, "", null].includes(value) && !A(value).isValid()) { 44698 return (0, import_i18n61.__)("Value must be a valid color."); 44699 } 44700 return null; 44701 } 44702 var sort6 = (a, b, direction) => { 44703 const colorA = A(a); 44704 const colorB = A(b); 44705 if (!colorA.isValid() && !colorB.isValid()) { 44706 return 0; 44707 } 44708 if (!colorA.isValid()) { 44709 return direction === "asc" ? 1 : -1; 44710 } 44711 if (!colorB.isValid()) { 44712 return direction === "asc" ? -1 : 1; 44713 } 44714 const hslA = colorA.toHsl(); 44715 const hslB = colorB.toHsl(); 44716 if (hslA.h !== hslB.h) { 44717 return direction === "asc" ? hslA.h - hslB.h : hslB.h - hslA.h; 44718 } 44719 if (hslA.s !== hslB.s) { 44720 return direction === "asc" ? hslA.s - hslB.s : hslB.s - hslA.s; 44721 } 44722 return direction === "asc" ? hslA.l - hslB.l : hslB.l - hslA.l; 44723 }; 44724 var color_default = { 44725 type: "color", 44726 render: render3, 44727 Edit: "color", 44728 sort: sort6, 44729 enableSorting: true, 44730 enableGlobalSearch: false, 44731 defaultOperators: [OPERATOR_IS_ANY, OPERATOR_IS_NONE], 44732 validOperators: [ 44733 OPERATOR_IS, 44734 OPERATOR_IS_NOT, 44735 OPERATOR_IS_ANY, 44736 OPERATOR_IS_NONE 44737 ], 44738 format: {}, 44739 getValueFormatted: get_value_formatted_default_default, 44740 validate: { 44741 required: isValidRequired, 44742 elements: isValidElements, 44743 custom: isValidCustom6 44744 } 44745 }; 44746 44747 // packages/dataviews/build-module/field-types/url.mjs 44748 var url_default = { 44749 type: "url", 44750 render, 44751 Edit: "url", 44752 sort: sort_text_default, 44753 enableSorting: true, 44754 enableGlobalSearch: false, 44755 defaultOperators: [OPERATOR_IS_ANY, OPERATOR_IS_NONE], 44756 validOperators: [ 44757 OPERATOR_IS, 44758 OPERATOR_IS_NOT, 44759 OPERATOR_CONTAINS, 44760 OPERATOR_NOT_CONTAINS, 44761 OPERATOR_STARTS_WITH, 44762 // Multiple selection 44763 OPERATOR_IS_ANY, 44764 OPERATOR_IS_NONE, 44765 OPERATOR_IS_NOT_ALL 44766 ], 44767 format: {}, 44768 getValueFormatted: get_value_formatted_default_default, 44769 validate: { 44770 required: isValidRequired, 44771 pattern: isValidPattern, 44772 minLength: isValidMinLength, 44773 maxLength: isValidMaxLength, 44774 elements: isValidElements 44775 } 44776 }; 44777 44778 // packages/dataviews/build-module/field-types/no-type.mjs 44779 var sort7 = (a, b, direction) => { 44780 if (typeof a === "number" && typeof b === "number") { 44781 return sort_number_default(a, b, direction); 44782 } 44783 return sort_text_default(a, b, direction); 44784 }; 44785 var no_type_default = { 44786 // type: no type for this one 44787 render, 44788 Edit: null, 44789 sort: sort7, 44790 enableSorting: true, 44791 enableGlobalSearch: false, 44792 defaultOperators: [OPERATOR_IS, OPERATOR_IS_NOT], 44793 validOperators: getAllOperatorNames(), 44794 format: {}, 44795 getValueFormatted: get_value_formatted_default_default, 44796 validate: { 44797 required: isValidRequired, 44798 elements: isValidElements 44799 } 44800 }; 44801 44802 // packages/dataviews/build-module/field-types/utils/get-is-valid.mjs 44803 function supportsNumericRangeConstraint(type) { 44804 return type === "integer" || type === "number"; 44805 } 44806 function supportsStringRangeConstraint(type) { 44807 return type === "date" || type === "datetime" || type === "time"; 44808 } 44809 function normalizeRangeRule(value, fieldType, key) { 44810 const validator = fieldType.validate[key]; 44811 if (validator && (typeof value === "number" && supportsNumericRangeConstraint(fieldType.type) || typeof value === "string" && supportsStringRangeConstraint(fieldType.type))) { 44812 return { constraint: value, validate: validator }; 44813 } 44814 return void 0; 44815 } 44816 function getIsValid(field, fieldType) { 44817 const rules = field.isValid; 44818 let required; 44819 if (rules?.required === true && fieldType.validate.required !== void 0) { 44820 required = { 44821 constraint: true, 44822 validate: fieldType.validate.required 44823 }; 44824 } 44825 let elements; 44826 if ((rules?.elements === true || // elements is enabled unless the field opts-out 44827 rules?.elements === void 0 && (!!field.elements || !!field.getElements)) && fieldType.validate.elements !== void 0) { 44828 elements = { 44829 constraint: true, 44830 validate: fieldType.validate.elements 44831 }; 44832 } 44833 const min3 = normalizeRangeRule(rules?.min, fieldType, "min"); 44834 const max3 = normalizeRangeRule(rules?.max, fieldType, "max"); 44835 const minLengthValue = rules?.minLength; 44836 let minLength; 44837 if (typeof minLengthValue === "number" && fieldType.validate.minLength !== void 0) { 44838 minLength = { 44839 constraint: minLengthValue, 44840 validate: fieldType.validate.minLength 44841 }; 44842 } 44843 const maxLengthValue = rules?.maxLength; 44844 let maxLength; 44845 if (typeof maxLengthValue === "number" && fieldType.validate.maxLength !== void 0) { 44846 maxLength = { 44847 constraint: maxLengthValue, 44848 validate: fieldType.validate.maxLength 44849 }; 44850 } 44851 const patternValue = rules?.pattern; 44852 let pattern; 44853 if (patternValue !== void 0 && fieldType.validate.pattern !== void 0) { 44854 pattern = { 44855 constraint: patternValue, 44856 validate: fieldType.validate.pattern 44857 }; 44858 } 44859 const custom = rules?.custom ?? fieldType.validate.custom; 44860 return { 44861 required, 44862 elements, 44863 min: min3, 44864 max: max3, 44865 minLength, 44866 maxLength, 44867 pattern, 44868 custom 44869 }; 44870 } 44871 44872 // packages/dataviews/build-module/field-types/utils/get-filter.mjs 44873 function getFilter(fieldType) { 44874 return fieldType.validOperators.reduce((accumulator, operator) => { 44875 const operatorObj = getOperatorByName(operator); 44876 if (operatorObj?.filter) { 44877 accumulator[operator] = operatorObj.filter; 44878 } 44879 return accumulator; 44880 }, {}); 44881 } 44882 44883 // packages/dataviews/build-module/field-types/utils/get-format.mjs 44884 function getFormat(field, fieldType) { 44885 return { 44886 ...fieldType.format, 44887 ...field.format 44888 }; 44889 } 44890 var get_format_default = getFormat; 44891 44892 // packages/dataviews/build-module/field-types/index.mjs 44893 function getFieldTypeByName(type) { 44894 const found = [ 44895 email_default, 44896 integer_default, 44897 number_default, 44898 text_default, 44899 datetime_default, 44900 date_default, 44901 time_default, 44902 boolean_default, 44903 media_default, 44904 array_default, 44905 password_default, 44906 telephone_default, 44907 color_default, 44908 url_default 44909 ].find((fieldType) => fieldType?.type === type); 44910 if (!!found) { 44911 return found; 44912 } 44913 return no_type_default; 44914 } 44915 function normalizeFields(fields) { 44916 return fields.map((field) => { 44917 const fieldType = getFieldTypeByName(field.type); 44918 const getValue = field.getValue || get_value_from_id_default(field.id); 44919 const sort8 = function(a, b, direction) { 44920 const aValue = getValue({ item: a }); 44921 const bValue = getValue({ item: b }); 44922 return field.sort ? field.sort(aValue, bValue, direction) : fieldType.sort(aValue, bValue, direction); 44923 }; 44924 return { 44925 id: field.id, 44926 label: field.label || field.id, 44927 header: field.header || field.label || field.id, 44928 description: field.description, 44929 placeholder: field.placeholder, 44930 getValue, 44931 setValue: field.setValue || set_value_from_id_default(field.id), 44932 elements: field.elements, 44933 getElements: field.getElements, 44934 hasElements: hasElements(field), 44935 isVisible: field.isVisible, 44936 isDisabled: typeof field.isDisabled === "function" ? field.isDisabled : () => !!field.isDisabled, 44937 enableHiding: field.enableHiding ?? true, 44938 readOnly: field.readOnly ?? false, 44939 // The type provides defaults for the following props 44940 type: fieldType.type, 44941 render: field.render ?? fieldType.render, 44942 Edit: getControl(field, fieldType.Edit), 44943 sort: sort8, 44944 enableSorting: field.enableSorting ?? fieldType.enableSorting, 44945 enableGlobalSearch: field.enableGlobalSearch ?? fieldType.enableGlobalSearch, 44946 isValid: getIsValid(field, fieldType), 44947 filterBy: get_filter_by_default( 44948 field, 44949 fieldType.defaultOperators, 44950 fieldType.validOperators 44951 ), 44952 filter: getFilter(fieldType), 44953 format: get_format_default(field, fieldType), 44954 getValueFormatted: field.getValueFormatted ?? fieldType.getValueFormatted 44955 }; 44956 }); 44957 } 44958 44959 // packages/dataviews/build-module/hooks/use-data.mjs 44960 var import_element137 = __toESM(require_element(), 1); 44961 function useData({ 44962 view, 44963 data: shownData, 44964 getItemId, 44965 isLoading, 44966 paginationInfo, 44967 selection 44968 }) { 44969 const isInfiniteScrollEnabled = view.infiniteScrollEnabled; 44970 const [hasInitiallyLoaded, setHasInitiallyLoaded] = (0, import_element137.useState)(!isLoading); 44971 (0, import_element137.useEffect)(() => { 44972 if (!isLoading) { 44973 setHasInitiallyLoaded(true); 44974 } 44975 }, [isLoading]); 44976 const previousDataRef = (0, import_element137.useRef)(shownData); 44977 const previousPaginationInfoRef = (0, import_element137.useRef)(paginationInfo); 44978 (0, import_element137.useEffect)(() => { 44979 if (!isLoading) { 44980 previousDataRef.current = shownData; 44981 previousPaginationInfoRef.current = paginationInfo; 44982 } 44983 }, [shownData, isLoading, paginationInfo]); 44984 const [visibleEntries, setVisibleEntries] = (0, import_element137.useState)([]); 44985 const positionMapRef = (0, import_element137.useRef)(/* @__PURE__ */ new Map()); 44986 const allLoadedRecordsRef = (0, import_element137.useRef)([]); 44987 const prevViewParamsRef = (0, import_element137.useRef)({ 44988 search: void 0, 44989 filters: void 0, 44990 perPage: void 0 44991 }); 44992 const scrollDirectionRef = (0, import_element137.useRef)(void 0); 44993 const prevStartPositionRef = (0, import_element137.useRef)(void 0); 44994 const hasInitializedRef = (0, import_element137.useRef)(false); 44995 const allLoadedRecords = (0, import_element137.useMemo)(() => { 44996 if (view.startPosition !== void 0 && prevStartPositionRef.current !== void 0) { 44997 if (view.startPosition < prevStartPositionRef.current) { 44998 scrollDirectionRef.current = "up"; 44999 } else if (view.startPosition > prevStartPositionRef.current) { 45000 scrollDirectionRef.current = "down"; 45001 } 45002 } 45003 prevStartPositionRef.current = view.startPosition; 45004 const currentFiltersKey = JSON.stringify(view.filters ?? []); 45005 const prevFiltersKey = prevViewParamsRef.current.filters; 45006 const shouldReset = !hasInitializedRef.current || !view.infiniteScrollEnabled || view.search !== prevViewParamsRef.current.search || currentFiltersKey !== prevFiltersKey || view.perPage !== prevViewParamsRef.current.perPage; 45007 hasInitializedRef.current = true; 45008 prevViewParamsRef.current = { 45009 search: view.search, 45010 filters: currentFiltersKey, 45011 perPage: view.perPage 45012 }; 45013 if (shouldReset) { 45014 positionMapRef.current.clear(); 45015 scrollDirectionRef.current = void 0; 45016 const startPosition = view.search ? 1 : view.startPosition ?? 1; 45017 const records = shownData.map((record, index2) => { 45018 const position = startPosition + index2; 45019 positionMapRef.current.set(getItemId(record), position); 45020 return { 45021 ...record, 45022 position 45023 }; 45024 }); 45025 allLoadedRecordsRef.current = records; 45026 return records; 45027 } 45028 const prev = allLoadedRecordsRef.current; 45029 const shownDataIds = new Set(shownData.map(getItemId)); 45030 const scrollDirection = scrollDirectionRef.current; 45031 const basePosition = view.search ? 1 : view.startPosition ?? 1; 45032 const newRecords = shownData.map((record, index2) => { 45033 const itemId = getItemId(record); 45034 const position = view.infiniteScrollEnabled ? basePosition + index2 : void 0; 45035 if (position !== void 0) { 45036 positionMapRef.current.set(itemId, position); 45037 } 45038 return { 45039 ...record, 45040 position 45041 }; 45042 }); 45043 if (newRecords.length === 0) { 45044 return prev; 45045 } 45046 const prevWithoutDuplicates = prev.filter( 45047 (record) => !shownDataIds.has(getItemId(record)) 45048 ); 45049 const allRecords = scrollDirection === "up" ? [...newRecords, ...prevWithoutDuplicates] : [...prevWithoutDuplicates, ...newRecords]; 45050 allRecords.sort((a, b) => { 45051 const posA = a.position; 45052 const posB = b.position; 45053 return posA - posB; 45054 }); 45055 let result = allRecords; 45056 if (visibleEntries.length > 0) { 45057 const visibleMin = Math.min(...visibleEntries); 45058 const visibleMax = Math.max(...visibleEntries); 45059 const buffer = 20; 45060 const recordPositions = allRecords.map( 45061 (r2) => r2.position 45062 ); 45063 const minRecordPos = Math.min(...recordPositions); 45064 const maxRecordPos = Math.max(...recordPositions); 45065 const hasOverlap = !(maxRecordPos < visibleMin - buffer || minRecordPos > visibleMax + buffer); 45066 if (hasOverlap) { 45067 result = allRecords.filter((record) => { 45068 const itemId = getItemId(record); 45069 const isSelected2 = selection?.includes(itemId); 45070 if (isSelected2) { 45071 return true; 45072 } 45073 const itemPosition = record.position; 45074 if (scrollDirection === "up") { 45075 return itemPosition <= visibleMax + buffer; 45076 } else if (scrollDirection === "down") { 45077 return itemPosition >= visibleMin - buffer; 45078 } 45079 return itemPosition >= visibleMin - buffer && itemPosition <= visibleMax + buffer; 45080 }); 45081 } 45082 } 45083 allLoadedRecordsRef.current = result; 45084 return result; 45085 }, [ 45086 shownData, 45087 view.search, 45088 view.filters, 45089 view.perPage, 45090 view.startPosition, 45091 view.infiniteScrollEnabled, 45092 visibleEntries, 45093 selection, 45094 getItemId 45095 ]); 45096 if (!isInfiniteScrollEnabled) { 45097 const dataToReturn = isLoading && previousDataRef.current?.length ? previousDataRef.current : shownData; 45098 return { 45099 data: dataToReturn.map((item) => ({ 45100 ...item, 45101 position: void 0 45102 })), 45103 paginationInfo: isLoading && previousDataRef.current?.length ? previousPaginationInfoRef.current : paginationInfo, 45104 hasInitiallyLoaded, 45105 setVisibleEntries: void 0 45106 }; 45107 } 45108 return { 45109 data: allLoadedRecords, 45110 paginationInfo, 45111 hasInitiallyLoaded, 45112 setVisibleEntries 45113 }; 45114 } 45115 45116 // packages/dataviews/build-module/hooks/use-infinite-scroll.mjs 45117 var import_element138 = __toESM(require_element(), 1); 45118 var import_compose22 = __toESM(require_compose(), 1); 45119 function captureAnchorElement(container, anchorElementRef, direction) { 45120 const containerRect = container.getBoundingClientRect(); 45121 const centerY = containerRect.top + containerRect.height / 2; 45122 const items = Array.from(container.querySelectorAll("[aria-posinset]")); 45123 if (items.length === 0) { 45124 return false; 45125 } 45126 const bestAnchor = items.reduce((best, item) => { 45127 const itemRect = item.getBoundingClientRect(); 45128 const itemCenterY = itemRect.top + itemRect.height / 2; 45129 const distance = Math.abs(itemCenterY - centerY); 45130 const bestRect = best.getBoundingClientRect(); 45131 const bestCenterY = bestRect.top + bestRect.height / 2; 45132 const bestDistance = Math.abs(bestCenterY - centerY); 45133 return distance < bestDistance ? item : best; 45134 }); 45135 const posinset = Number(bestAnchor.getAttribute("aria-posinset")); 45136 const anchorRect = bestAnchor.getBoundingClientRect(); 45137 anchorElementRef.current = { 45138 posinset, 45139 viewportOffset: anchorRect.top - containerRect.top, 45140 scrollTop: container.scrollTop, 45141 direction 45142 }; 45143 return true; 45144 } 45145 function useInfiniteScroll({ 45146 view, 45147 onChangeView, 45148 isLoading, 45149 paginationInfo, 45150 containerRef, 45151 setVisibleEntries 45152 }) { 45153 const anchorElementRef = (0, import_element138.useRef)(null); 45154 const viewRef = (0, import_element138.useRef)(view); 45155 const isLoadingRef = (0, import_element138.useRef)(isLoading); 45156 const onChangeViewRef = (0, import_element138.useRef)(onChangeView); 45157 const totalItemsRef = (0, import_element138.useRef)(paginationInfo.totalItems); 45158 (0, import_element138.useLayoutEffect)(() => { 45159 viewRef.current = view; 45160 isLoadingRef.current = isLoading; 45161 onChangeViewRef.current = onChangeView; 45162 totalItemsRef.current = paginationInfo.totalItems; 45163 }, [view, isLoading, onChangeView, paginationInfo.totalItems]); 45164 const intersectionObserverCallback = (0, import_element138.useCallback)( 45165 (entries) => { 45166 if (!setVisibleEntries) { 45167 return; 45168 } 45169 setVisibleEntries((prev) => { 45170 const newVisibleEntries = new Set(prev); 45171 let hasChanged = false; 45172 entries.forEach((entry) => { 45173 const posInSet = Number( 45174 entry.target?.attributes?.getNamedItem( 45175 "aria-posinset" 45176 )?.value 45177 ); 45178 if (isNaN(posInSet)) { 45179 return; 45180 } 45181 if (entry.isIntersecting) { 45182 if (!newVisibleEntries.has(posInSet)) { 45183 newVisibleEntries.add(posInSet); 45184 hasChanged = true; 45185 } 45186 } else if (newVisibleEntries.has(posInSet)) { 45187 newVisibleEntries.delete(posInSet); 45188 hasChanged = true; 45189 } 45190 }); 45191 return hasChanged ? Array.from(newVisibleEntries).sort() : prev; 45192 }); 45193 }, 45194 [setVisibleEntries] 45195 ); 45196 (0, import_element138.useLayoutEffect)(() => { 45197 const container = containerRef.current; 45198 const anchor = anchorElementRef.current; 45199 if (!container || !view.infiniteScrollEnabled || !anchor || isLoading) { 45200 return; 45201 } 45202 const anchorElement = container.querySelector( 45203 `[aria-posinset="$anchor.posinset}"]` 45204 ); 45205 if (anchorElement) { 45206 const containerRect = container.getBoundingClientRect(); 45207 const anchorRect = anchorElement.getBoundingClientRect(); 45208 const currentOffset = anchorRect.top - containerRect.top; 45209 const scrollAdjustment = currentOffset - anchor.viewportOffset + (container.scrollTop - anchor.scrollTop); 45210 if (Math.abs(scrollAdjustment) > 1) { 45211 container.scrollTop += scrollAdjustment; 45212 } 45213 } 45214 anchorElementRef.current = null; 45215 }, [containerRef, isLoading, view.infiniteScrollEnabled]); 45216 const intersectionObserverRef = (0, import_element138.useRef)( 45217 null 45218 ); 45219 (0, import_element138.useEffect)(() => { 45220 if (!view.infiniteScrollEnabled || !intersectionObserverCallback) { 45221 if (intersectionObserverRef.current) { 45222 intersectionObserverRef.current.disconnect(); 45223 intersectionObserverRef.current = null; 45224 } 45225 return; 45226 } 45227 intersectionObserverRef.current = new IntersectionObserver( 45228 intersectionObserverCallback, 45229 { root: null, rootMargin: "0px", threshold: 0.1 } 45230 ); 45231 return () => { 45232 if (intersectionObserverRef.current) { 45233 intersectionObserverRef.current.disconnect(); 45234 intersectionObserverRef.current = null; 45235 } 45236 }; 45237 }, [view.infiniteScrollEnabled, intersectionObserverCallback]); 45238 (0, import_element138.useEffect)(() => { 45239 if (!view.infiniteScrollEnabled || !containerRef.current) { 45240 return; 45241 } 45242 let lastScrollTop = 0; 45243 const BOTTOM_THRESHOLD = 600; 45244 const TOP_THRESHOLD = 800; 45245 const handleScroll = (0, import_compose22.throttle)((event) => { 45246 const currentView = viewRef.current; 45247 const totalItems = totalItemsRef.current; 45248 const target = event.target; 45249 const scrollTop = target.scrollTop; 45250 const scrollHeight = target.scrollHeight; 45251 const clientHeight = target.clientHeight; 45252 const scrollDirection = scrollTop > lastScrollTop ? "down" : "up"; 45253 lastScrollTop = scrollTop; 45254 if (isLoadingRef.current) { 45255 return; 45256 } 45257 const currentStartPosition = currentView.startPosition || 1; 45258 const batchSize = currentView.perPage || 10; 45259 const currentEndPosition = Math.min( 45260 currentStartPosition + batchSize, 45261 totalItems 45262 ); 45263 if (scrollDirection === "down" && scrollTop + clientHeight >= scrollHeight - BOTTOM_THRESHOLD) { 45264 if (currentEndPosition < totalItems) { 45265 const newStartPosition = currentEndPosition; 45266 captureAnchorElement(target, anchorElementRef, "down"); 45267 onChangeViewRef.current({ 45268 ...currentView, 45269 startPosition: newStartPosition 45270 }); 45271 } 45272 } 45273 if (scrollDirection === "up" && scrollTop <= TOP_THRESHOLD) { 45274 if (currentStartPosition > 1) { 45275 const calculatedStartPosition = currentStartPosition - batchSize; 45276 const newStartPosition = calculatedStartPosition < 6 ? 1 : calculatedStartPosition; 45277 captureAnchorElement(target, anchorElementRef, "up"); 45278 onChangeViewRef.current({ 45279 ...currentView, 45280 startPosition: newStartPosition 45281 }); 45282 } 45283 } 45284 }, 50); 45285 const container = containerRef.current; 45286 container.addEventListener("scroll", handleScroll); 45287 return () => { 45288 container.removeEventListener("scroll", handleScroll); 45289 handleScroll.cancel(); 45290 }; 45291 }, [containerRef, view.infiniteScrollEnabled]); 45292 return { 45293 intersectionObserver: intersectionObserverRef.current 45294 }; 45295 } 45296 45297 // packages/dataviews/build-module/hooks/use-page-clamp.mjs 45298 var import_element139 = __toESM(require_element(), 1); 45299 var import_compose23 = __toESM(require_compose(), 1); 45300 function usePageClamp({ 45301 view, 45302 onChangeView, 45303 isLoading, 45304 totalPages 45305 }) { 45306 const lastPage = typeof totalPages === "number" && Number.isFinite(totalPages) ? Math.max(totalPages, 1) : null; 45307 const page = view.page; 45308 const goToLastPage = (0, import_compose23.useEvent)(() => { 45309 if (lastPage !== null) { 45310 onChangeView({ ...view, page: lastPage }); 45311 } 45312 }); 45313 (0, import_element139.useEffect)(() => { 45314 if (isLoading || lastPage === null || !page || page <= lastPage) { 45315 return; 45316 } 45317 goToLastPage(); 45318 }, [isLoading, lastPage, page, goToLastPage]); 45319 } 45320 45321 // packages/dataviews/build-module/dataviews-picker/index.mjs 45322 var import_element140 = __toESM(require_element(), 1); 45323 var import_compose24 = __toESM(require_compose(), 1); 45324 var import_jsx_runtime197 = __toESM(require_jsx_runtime(), 1); 45325 var isItemClickable = () => false; 45326 var dataViewsPickerLayouts = VIEW_LAYOUTS.filter( 45327 (viewLayout) => viewLayout.isPicker 45328 ); 45329 var defaultGetItemId = (item) => item.id; 45330 var EMPTY_ARRAY5 = []; 45331 var DEFAULT_PICKER_LAYOUTS = { 45332 pickerGrid: true, 45333 pickerTable: true 45334 }; 45335 function DefaultUI({ 45336 search = true, 45337 searchLabel = void 0 45338 }) { 45339 const { view } = (0, import_element140.useContext)(dataviews_context_default); 45340 const isInfiniteScroll = view.infiniteScrollEnabled; 45341 return /* @__PURE__ */ (0, import_jsx_runtime197.jsxs)(import_jsx_runtime197.Fragment, { children: [ 45342 /* @__PURE__ */ (0, import_jsx_runtime197.jsxs)( 45343 Stack, 45344 { 45345 direction: "row", 45346 align: "top", 45347 justify: "space-between", 45348 className: clsx_default("dataviews__view-actions", { 45349 "dataviews__view-actions--infinite-scroll": isInfiniteScroll 45350 }), 45351 gap: "xs", 45352 children: [ 45353 /* @__PURE__ */ (0, import_jsx_runtime197.jsxs)( 45354 Stack, 45355 { 45356 direction: "row", 45357 gap: "sm", 45358 justify: "start", 45359 className: "dataviews__search", 45360 children: [ 45361 search && /* @__PURE__ */ (0, import_jsx_runtime197.jsx)(dataviews_search_default, { label: searchLabel }), 45362 /* @__PURE__ */ (0, import_jsx_runtime197.jsx)(toggle_default, {}) 45363 ] 45364 } 45365 ), 45366 /* @__PURE__ */ (0, import_jsx_runtime197.jsx)(Stack, { direction: "row", gap: "xs", style: { flexShrink: 0 }, children: /* @__PURE__ */ (0, import_jsx_runtime197.jsx)(dataviews_view_config_default, {}) }) 45367 ] 45368 } 45369 ), 45370 /* @__PURE__ */ (0, import_jsx_runtime197.jsx)(filters_toggled_default, { className: "dataviews-filters__container" }), 45371 /* @__PURE__ */ (0, import_jsx_runtime197.jsx)(DataViewsLayout, {}), 45372 /* @__PURE__ */ (0, import_jsx_runtime197.jsx)(DataViewsPickerFooter, {}) 45373 ] }); 45374 } 45375 function DataViewsPicker({ 45376 view, 45377 onChangeView, 45378 fields, 45379 search = true, 45380 searchLabel = void 0, 45381 actions = EMPTY_ARRAY5, 45382 data, 45383 getItemId = defaultGetItemId, 45384 isLoading = false, 45385 paginationInfo, 45386 defaultLayouts: defaultLayoutsProperty = DEFAULT_PICKER_LAYOUTS, 45387 selection, 45388 onChangeSelection, 45389 children, 45390 config = { perPageSizes: [10, 20, 50, 100] }, 45391 itemListLabel, 45392 empty, 45393 onReset 45394 }) { 45395 const { data: displayData, setVisibleEntries } = useData({ 45396 view, 45397 data, 45398 getItemId, 45399 selection, 45400 paginationInfo 45401 }); 45402 const containerRef = (0, import_element140.useRef)(null); 45403 const [containerWidth, setContainerWidth] = (0, import_element140.useState)(0); 45404 const resizeObserverRef = (0, import_compose24.useResizeObserver)( 45405 (resizeObserverEntries) => { 45406 setContainerWidth( 45407 resizeObserverEntries[0].borderBoxSize[0].inlineSize 45408 ); 45409 }, 45410 { box: "border-box" } 45411 ); 45412 const [openedFilter, setOpenedFilter] = (0, import_element140.useState)(null); 45413 function setSelectionWithChange(value) { 45414 const newValue = typeof value === "function" ? value(selection) : value; 45415 if (onChangeSelection) { 45416 onChangeSelection(newValue); 45417 } 45418 } 45419 const _fields = (0, import_element140.useMemo)(() => normalizeFields(fields), [fields]); 45420 const filters = use_filters_default(_fields, view); 45421 const hasPrimaryOrLockedFilters = (0, import_element140.useMemo)( 45422 () => (filters || []).some( 45423 (filter) => filter.isPrimary || filter.isLocked 45424 ), 45425 [filters] 45426 ); 45427 const [isShowingFilter, setIsShowingFilter] = (0, import_element140.useState)( 45428 hasPrimaryOrLockedFilters 45429 ); 45430 const { intersectionObserver } = useInfiniteScroll({ 45431 view, 45432 onChangeView, 45433 isLoading, 45434 paginationInfo, 45435 containerRef, 45436 setVisibleEntries 45437 }); 45438 usePageClamp({ 45439 view, 45440 onChangeView, 45441 isLoading, 45442 totalPages: paginationInfo.totalPages 45443 }); 45444 (0, import_element140.useEffect)(() => { 45445 if (hasPrimaryOrLockedFilters && !isShowingFilter) { 45446 setIsShowingFilter(true); 45447 } 45448 }, [hasPrimaryOrLockedFilters, isShowingFilter]); 45449 const defaultLayouts2 = (0, import_element140.useMemo)( 45450 () => Object.fromEntries( 45451 Object.entries(defaultLayoutsProperty).filter(([layoutType]) => { 45452 return dataViewsPickerLayouts.some( 45453 (viewLayout) => viewLayout.type === layoutType 45454 ); 45455 }).map(([key, value]) => [ 45456 key, 45457 value === true ? {} : value 45458 ]) 45459 ), 45460 [defaultLayoutsProperty] 45461 ); 45462 if (!defaultLayouts2[view.type]) { 45463 return null; 45464 } 45465 return /* @__PURE__ */ (0, import_jsx_runtime197.jsx)( 45466 dataviews_context_default.Provider, 45467 { 45468 value: { 45469 view, 45470 onChangeView, 45471 fields: _fields, 45472 actions, 45473 data: displayData, 45474 isLoading, 45475 paginationInfo, 45476 isItemClickable, 45477 selection, 45478 onChangeSelection: setSelectionWithChange, 45479 openedFilter, 45480 setOpenedFilter, 45481 getItemId, 45482 containerWidth, 45483 containerRef, 45484 resizeObserverRef, 45485 defaultLayouts: defaultLayouts2, 45486 filters, 45487 isShowingFilter, 45488 setIsShowingFilter, 45489 config, 45490 itemListLabel, 45491 empty, 45492 onReset, 45493 hasInitiallyLoaded: true, 45494 intersectionObserver 45495 }, 45496 children: /* @__PURE__ */ (0, import_jsx_runtime197.jsx)("div", { className: "dataviews-picker-wrapper", children: children ?? /* @__PURE__ */ (0, import_jsx_runtime197.jsx)(DefaultUI, { search, searchLabel }) }) 45497 } 45498 ); 45499 } 45500 var DataViewsPickerSubComponents = DataViewsPicker; 45501 DataViewsPickerSubComponents.Actions = PickerActions; 45502 DataViewsPickerSubComponents.BulkActionToolbar = DataViewsPickerBulkActionToolbar; 45503 DataViewsPickerSubComponents.Footer = DataViewsPickerFooter; 45504 DataViewsPickerSubComponents.Filters = filters_default; 45505 DataViewsPickerSubComponents.FiltersToggled = filters_toggled_default; 45506 DataViewsPickerSubComponents.FiltersToggle = toggle_default; 45507 DataViewsPickerSubComponents.Layout = DataViewsLayout; 45508 DataViewsPickerSubComponents.LayoutSwitcher = ViewTypeMenu; 45509 DataViewsPickerSubComponents.PageNavigation = DataViewsPageNavigation; 45510 DataViewsPickerSubComponents.PageSelect = DataViewsPageSelect; 45511 DataViewsPickerSubComponents.Pagination = DataViewsPagination; 45512 DataViewsPickerSubComponents.Search = dataviews_search_default; 45513 DataViewsPickerSubComponents.ViewConfig = DataviewsViewConfigDropdown; 45514 var dataviews_picker_default = DataViewsPickerSubComponents; 45515 45516 // node_modules/dequal/dist/index.mjs 45517 var has = Object.prototype.hasOwnProperty; 45518 function find(iter, tar, key) { 45519 for (key of iter.keys()) { 45520 if (dequal(key, tar)) return key; 45521 } 45522 } 45523 function dequal(foo, bar) { 45524 var ctor, len, tmp; 45525 if (foo === bar) return true; 45526 if (foo && bar && (ctor = foo.constructor) === bar.constructor) { 45527 if (ctor === Date) return foo.getTime() === bar.getTime(); 45528 if (ctor === RegExp) return foo.toString() === bar.toString(); 45529 if (ctor === Array) { 45530 if ((len = foo.length) === bar.length) { 45531 while (len-- && dequal(foo[len], bar[len])) ; 45532 } 45533 return len === -1; 45534 } 45535 if (ctor === Set) { 45536 if (foo.size !== bar.size) { 45537 return false; 45538 } 45539 for (len of foo) { 45540 tmp = len; 45541 if (tmp && typeof tmp === "object") { 45542 tmp = find(bar, tmp); 45543 if (!tmp) return false; 45544 } 45545 if (!bar.has(tmp)) return false; 45546 } 45547 return true; 45548 } 45549 if (ctor === Map) { 45550 if (foo.size !== bar.size) { 45551 return false; 45552 } 45553 for (len of foo) { 45554 tmp = len[0]; 45555 if (tmp && typeof tmp === "object") { 45556 tmp = find(bar, tmp); 45557 if (!tmp) return false; 45558 } 45559 if (!dequal(len[1], bar.get(tmp))) { 45560 return false; 45561 } 45562 } 45563 return true; 45564 } 45565 if (ctor === ArrayBuffer) { 45566 foo = new Uint8Array(foo); 45567 bar = new Uint8Array(bar); 45568 } else if (ctor === DataView) { 45569 if ((len = foo.byteLength) === bar.byteLength) { 45570 while (len-- && foo.getInt8(len) === bar.getInt8(len)) ; 45571 } 45572 return len === -1; 45573 } 45574 if (ArrayBuffer.isView(foo)) { 45575 if ((len = foo.byteLength) === bar.byteLength) { 45576 while (len-- && foo[len] === bar[len]) ; 45577 } 45578 return len === -1; 45579 } 45580 if (!ctor || typeof foo === "object") { 45581 len = 0; 45582 for (ctor in foo) { 45583 if (has.call(foo, ctor) && ++len && !has.call(bar, ctor)) return false; 45584 if (!(ctor in bar) || !dequal(foo[ctor], bar[ctor])) return false; 45585 } 45586 return Object.keys(bar).length === len; 45587 } 45588 } 45589 return foo !== foo && bar !== bar; 45590 } 45591 45592 // packages/views/build-module/use-view.mjs 45593 var import_element141 = __toESM(require_element(), 1); 45594 var import_data7 = __toESM(require_data(), 1); 45595 var import_preferences = __toESM(require_preferences(), 1); 45596 45597 // packages/views/build-module/preference-keys.mjs 45598 function generatePreferenceKey(kind, name, slug) { 45599 return `dataviews-$kind}-$name}-$slug}`; 45600 } 45601 45602 // packages/views/build-module/resolve-view.mjs 45603 var QUERY_PARAMS = ["page", "search"]; 45604 function isPlainObject2(value) { 45605 return typeof value === "object" && value !== null && !Array.isArray(value); 45606 } 45607 function withoutQueryParams(layer) { 45608 const result = isPlainObject2(layer) ? { ...layer } : {}; 45609 for (const key of QUERY_PARAMS) { 45610 delete result[key]; 45611 } 45612 return result; 45613 } 45614 function mergeLayer(lower, upper) { 45615 const result = { ...lower }; 45616 for (const key of Object.keys(upper)) { 45617 const value = upper[key]; 45618 const current = result[key]; 45619 result[key] = isPlainObject2(current) && isPlainObject2(value) ? mergeLayer(current, value) : value; 45620 } 45621 return result; 45622 } 45623 function diffLayer(value, base, persisted = {}) { 45624 const result = {}; 45625 for (const key of Object.keys(value)) { 45626 const next = value[key]; 45627 const current = base[key]; 45628 const prev = persisted[key]; 45629 if (next === void 0) { 45630 continue; 45631 } 45632 if (isPlainObject2(next) && isPlainObject2(current)) { 45633 const nested = diffLayer( 45634 next, 45635 current, 45636 isPlainObject2(prev) ? prev : {} 45637 ); 45638 if (Object.keys(nested).length > 0) { 45639 result[key] = nested; 45640 } 45641 } else if (!dequal(next, current)) { 45642 result[key] = next; 45643 } else if (prev !== void 0 && dequal(next, prev)) { 45644 result[key] = prev; 45645 } 45646 } 45647 return result; 45648 } 45649 function getLockedFilters(overrides) { 45650 return (overrides?.filters ?? []).filter((filter) => filter.isLocked); 45651 } 45652 function applyLockedFilters(view, overrides) { 45653 const locked = getLockedFilters(overrides); 45654 if (locked.length === 0) { 45655 return view; 45656 } 45657 const rest = (view.filters ?? []).filter( 45658 (filter) => !locked.some((f) => f.field === filter.field) 45659 ); 45660 return { ...view, filters: [...locked, ...rest] }; 45661 } 45662 function getApplicablePersistedView(persistedView, defaultLayouts2) { 45663 if (!persistedView || persistedView.type === void 0 || !defaultLayouts2 || defaultLayouts2[persistedView.type]) { 45664 return persistedView; 45665 } 45666 const { type, ...rest } = persistedView; 45667 return Object.keys(rest).length > 0 ? rest : void 0; 45668 } 45669 function resolveBaseView(layers, effectiveType) { 45670 const { defaultView: defaultView2, defaultLayouts: defaultLayouts2, activeViewOverrides } = layers; 45671 const layoutDefaults = defaultLayouts2?.[effectiveType]; 45672 return applyLockedFilters( 45673 [layoutDefaults, activeViewOverrides].reduce( 45674 (lower, upper) => mergeLayer(lower, withoutQueryParams(upper)), 45675 withoutQueryParams(defaultView2) 45676 ), 45677 activeViewOverrides 45678 ); 45679 } 45680 function resolveView(args) { 45681 const { defaultView: defaultView2, defaultLayouts: defaultLayouts2, activeViewOverrides, page, search } = args; 45682 const persistedView = getApplicablePersistedView( 45683 args.persistedView, 45684 defaultLayouts2 45685 ); 45686 const effectiveType = persistedView?.type ?? activeViewOverrides?.type ?? defaultView2?.type; 45687 const baseView = resolveBaseView(args, effectiveType); 45688 const view = { 45689 ...applyLockedFilters( 45690 mergeLayer(baseView, withoutQueryParams(persistedView)), 45691 activeViewOverrides 45692 ), 45693 page: Number(page ?? 1), 45694 search: search ?? "" 45695 }; 45696 return view; 45697 } 45698 function getUserModifications(newView, layers) { 45699 const { defaultLayouts: defaultLayouts2, activeViewOverrides } = layers; 45700 const persistedView = getApplicablePersistedView( 45701 layers.persistedView, 45702 defaultLayouts2 45703 ); 45704 const baseView = resolveBaseView(layers, newView.type); 45705 const modifications = diffLayer( 45706 withoutQueryParams(newView), 45707 withoutQueryParams(baseView), 45708 withoutQueryParams(persistedView) 45709 ); 45710 const locked = getLockedFilters(activeViewOverrides); 45711 if (locked.length > 0 && Array.isArray(modifications.filters)) { 45712 modifications.filters = modifications.filters.filter( 45713 (filter) => !locked.some((f) => f.field === filter.field) 45714 ); 45715 } 45716 return Object.keys(modifications).length > 0 ? modifications : void 0; 45717 } 45718 45719 // packages/views/build-module/use-view.mjs 45720 function useView(config) { 45721 const { 45722 kind, 45723 name, 45724 slug, 45725 defaultView: defaultView2, 45726 defaultLayouts: defaultLayouts2, 45727 activeViewOverrides, 45728 queryParams, 45729 onChangeQueryParams 45730 } = config; 45731 const preferenceKey = generatePreferenceKey(kind, name, slug); 45732 const persistedView = (0, import_data7.useSelect)( 45733 (select3) => { 45734 return select3(import_preferences.store).get( 45735 "core/views", 45736 preferenceKey 45737 ); 45738 }, 45739 [preferenceKey] 45740 ); 45741 const { set } = (0, import_data7.useDispatch)(import_preferences.store); 45742 const page = Number(queryParams?.page ?? 1); 45743 const search = queryParams?.search ?? ""; 45744 const view = (0, import_element141.useMemo)( 45745 () => resolveView({ 45746 defaultView: defaultView2, 45747 defaultLayouts: defaultLayouts2, 45748 activeViewOverrides, 45749 persistedView, 45750 page, 45751 search 45752 }), 45753 [ 45754 defaultView2, 45755 defaultLayouts2, 45756 activeViewOverrides, 45757 persistedView, 45758 page, 45759 search 45760 ] 45761 ); 45762 const applicablePersistedView = getApplicablePersistedView( 45763 persistedView, 45764 defaultLayouts2 45765 ); 45766 const isModified = !!applicablePersistedView && Object.keys(applicablePersistedView).length > 0; 45767 const updateView = (0, import_element141.useCallback)( 45768 (newView) => { 45769 const newQueryParams = { 45770 page: Number(newView?.page ?? 1), 45771 search: newView?.search ?? "" 45772 }; 45773 if (onChangeQueryParams && !dequal(newQueryParams, { page, search })) { 45774 onChangeQueryParams(newQueryParams); 45775 } 45776 const modifications = getUserModifications(newView, { 45777 defaultView: defaultView2, 45778 defaultLayouts: defaultLayouts2, 45779 activeViewOverrides, 45780 persistedView 45781 }); 45782 if (!dequal(modifications, persistedView)) { 45783 set("core/views", preferenceKey, modifications); 45784 } 45785 }, 45786 [ 45787 onChangeQueryParams, 45788 page, 45789 search, 45790 defaultView2, 45791 defaultLayouts2, 45792 activeViewOverrides, 45793 persistedView, 45794 set, 45795 preferenceKey 45796 ] 45797 ); 45798 const resetToDefault = (0, import_element141.useCallback)(() => { 45799 set("core/views", preferenceKey, void 0); 45800 }, [preferenceKey, set]); 45801 return { 45802 view, 45803 isModified, 45804 updateView, 45805 resetToDefault 45806 }; 45807 } 45808 45809 // packages/views/build-module/load-view.mjs 45810 var import_data8 = __toESM(require_data(), 1); 45811 var import_preferences2 = __toESM(require_preferences(), 1); 45812 45813 // packages/views/build-module/use-view-config.mjs 45814 var import_data9 = __toESM(require_data(), 1); 45815 var import_core_data2 = __toESM(require_core_data(), 1); 45816 45817 // packages/views/build-module/lock-unlock.mjs 45818 var import_private_apis2 = __toESM(require_private_apis(), 1); 45819 var { lock: lock2, unlock: unlock2 } = (0, import_private_apis2.__dangerousOptInToUnstableAPIsOnlyForCoreModules)( 45820 "I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.", 45821 "@wordpress/views" 45822 ); 45823 45824 // packages/media-fields/build-module/alt_text/index.mjs 45825 var import_i18n62 = __toESM(require_i18n(), 1); 45826 var import_jsx_runtime198 = __toESM(require_jsx_runtime(), 1); 45827 var altTextField = { 45828 id: "alt_text", 45829 type: "text", 45830 label: (0, import_i18n62.__)("Alt text"), 45831 description: /* @__PURE__ */ (0, import_jsx_runtime198.jsxs)(import_jsx_runtime198.Fragment, { children: [ 45832 /* @__PURE__ */ (0, import_jsx_runtime198.jsx)( 45833 Link, 45834 { 45835 href: ( 45836 // translators: Localized tutorial, if one exists. W3C Web Accessibility Initiative link has list of existing translations. 45837 (0, import_i18n62.__)( 45838 "https://www.w3.org/WAI/tutorials/images/decision-tree/" 45839 ) 45840 ), 45841 openInNewTab: true, 45842 children: (0, import_i18n62.__)("Describe the purpose of the image.") 45843 } 45844 ), 45845 /* @__PURE__ */ (0, import_jsx_runtime198.jsx)("br", {}), 45846 (0, import_i18n62.__)("Leave empty if decorative.") 45847 ] }), 45848 isVisible: (item) => item?.media_type === "image", 45849 render: ({ item }) => item?.alt_text || "-", 45850 Edit: { 45851 control: "textarea", 45852 rows: 2 45853 }, 45854 enableSorting: false, 45855 filterBy: false 45856 }; 45857 var alt_text_default = altTextField; 45858 45859 // packages/media-fields/build-module/attached_to/index.mjs 45860 var import_i18n65 = __toESM(require_i18n(), 1); 45861 45862 // packages/media-fields/build-module/attached_to/view.mjs 45863 var import_element142 = __toESM(require_element(), 1); 45864 var import_i18n63 = __toESM(require_i18n(), 1); 45865 45866 // packages/media-fields/build-module/utils/get-rendered-content.mjs 45867 function getRenderedContent(content) { 45868 if (!content) { 45869 return ""; 45870 } 45871 if (typeof content === "string") { 45872 return content; 45873 } 45874 if (typeof content === "object") { 45875 return content.rendered || content.raw || ""; 45876 } 45877 return ""; 45878 } 45879 45880 // packages/media-fields/build-module/attached_to/view.mjs 45881 var import_jsx_runtime199 = __toESM(require_jsx_runtime(), 1); 45882 function MediaAttachedToView({ 45883 item 45884 }) { 45885 const [attachedPostTitle, setAttachedPostTitle] = (0, import_element142.useState)(null); 45886 const parentId = item.post; 45887 const embeddedPostId = item._embedded?.["wp:attached-to"]?.[0]?.id; 45888 const embeddedPostTitle = item._embedded?.["wp:attached-to"]?.[0]?.title; 45889 (0, import_element142.useEffect)(() => { 45890 if (!!parentId && parentId === embeddedPostId) { 45891 setAttachedPostTitle( 45892 getRenderedContent(embeddedPostTitle) || (0, import_i18n63.__)("(no title)") 45893 ); 45894 } 45895 if (!parentId) { 45896 setAttachedPostTitle((0, import_i18n63.__)("(Unattached)")); 45897 } 45898 }, [parentId, embeddedPostId, embeddedPostTitle]); 45899 return /* @__PURE__ */ (0, import_jsx_runtime199.jsx)(import_jsx_runtime199.Fragment, { children: attachedPostTitle }); 45900 } 45901 45902 // packages/media-fields/build-module/attached_to/edit.mjs 45903 var import_core_data3 = __toESM(require_core_data(), 1); 45904 var import_components50 = __toESM(require_components(), 1); 45905 var import_i18n64 = __toESM(require_i18n(), 1); 45906 var import_element143 = __toESM(require_element(), 1); 45907 var import_compose25 = __toESM(require_compose(), 1); 45908 var import_data10 = __toESM(require_data(), 1); 45909 var import_jsx_runtime200 = __toESM(require_jsx_runtime(), 1); 45910 function MediaAttachedToEdit({ 45911 data, 45912 onChange 45913 }) { 45914 const defaultPost = !!data.post && !!data?._embedded?.["wp:attached-to"]?.[0] ? [ 45915 { 45916 label: getRenderedContent( 45917 data._embedded?.["wp:attached-to"]?.[0]?.title 45918 ), 45919 value: data.post.toString() 45920 } 45921 ] : []; 45922 const [options, setOptions] = (0, import_element143.useState)(defaultPost); 45923 const [searchResults, setSearchResults] = (0, import_element143.useState)( 45924 [] 45925 ); 45926 const [isLoading, setIsLoading] = (0, import_element143.useState)(false); 45927 const [value, setValue] = (0, import_element143.useState)( 45928 data?.post?.toString() ?? null 45929 ); 45930 const postTypes = (0, import_data10.useSelect)( 45931 (select3) => select3(import_core_data3.store).getPostTypes(), 45932 [] 45933 ); 45934 const handleDetach = () => { 45935 onChange({ 45936 post: 0, 45937 _embedded: { ...data?._embedded, "wp:attached-to": void 0 } 45938 }); 45939 setValue(null); 45940 }; 45941 const onValueChange = async (filterValue) => { 45942 setIsLoading(true); 45943 const results = await (0, import_core_data3.__experimentalFetchLinkSuggestions)( 45944 filterValue, 45945 /* 45946 * @TODO `fetchLinkSuggestions()` should accept `perPage` as an option argument. 45947 * `isInitialSuggestions` limits the result to 3, otherwise it's hardcoded to 20. 45948 */ 45949 { type: "post", isInitialSuggestions: true }, 45950 {} 45951 ); 45952 setSearchResults(results); 45953 const suggestions = results.map((result) => { 45954 return { 45955 label: result.title, 45956 value: result.id.toString() 45957 }; 45958 }); 45959 const includeCurrent = !filterValue && suggestions.findIndex((s) => s.value === value) === -1; 45960 setOptions(suggestions.concat(includeCurrent ? defaultPost : [])); 45961 setIsLoading(false); 45962 }; 45963 const debouncedValueChange = (0, import_compose25.useDebounce)((0, import_compose25.useEvent)(onValueChange), 300); 45964 const handleSelectOption = (selectedPostId) => { 45965 if (!selectedPostId) { 45966 handleDetach(); 45967 return; 45968 } 45969 setValue(selectedPostId); 45970 if (selectedPostId) { 45971 const selectedPost = searchResults.find( 45972 (result) => result.id === Number(selectedPostId) 45973 ); 45974 if (selectedPost && postTypes) { 45975 const postType = postTypes.find( 45976 (_postType) => _postType.slug === selectedPost?.type 45977 ); 45978 const attachedTo = { 45979 ...postType && { type: postType.slug }, 45980 id: Number(selectedPostId), 45981 title: { 45982 raw: selectedPost.title, 45983 rendered: selectedPost.title 45984 } 45985 }; 45986 onChange({ 45987 post: Number(selectedPostId), 45988 _embedded: { 45989 ...data?._embedded, 45990 "wp:attached-to": [attachedTo] 45991 } 45992 }); 45993 } 45994 } 45995 }; 45996 return /* @__PURE__ */ (0, import_jsx_runtime200.jsx)( 45997 import_components50.ComboboxControl, 45998 { 45999 className: "dataviews-media-field__attached-to", 46000 isLoading, 46001 label: (0, import_i18n64.__)("Attached to"), 46002 help: (0, import_i18n64.__)("Attach this file to a single post or page."), 46003 value, 46004 options, 46005 onFilterValueChange: (filterValue) => debouncedValueChange(filterValue), 46006 onChange: handleSelectOption, 46007 hideLabelFromVision: true, 46008 expandOnFocus: false 46009 } 46010 ); 46011 } 46012 46013 // packages/media-fields/build-module/attached_to/index.mjs 46014 var attachedToField = { 46015 id: "attached_to", 46016 type: "text", 46017 label: (0, import_i18n65.__)("Attached to"), 46018 Edit: MediaAttachedToEdit, 46019 render: MediaAttachedToView, 46020 enableSorting: false, 46021 filterBy: false 46022 }; 46023 var attached_to_default = attachedToField; 46024 46025 // packages/media-fields/build-module/author/index.mjs 46026 var import_i18n67 = __toESM(require_i18n(), 1); 46027 var import_data11 = __toESM(require_data(), 1); 46028 var import_core_data4 = __toESM(require_core_data(), 1); 46029 46030 // packages/media-fields/build-module/author/view.mjs 46031 var import_i18n66 = __toESM(require_i18n(), 1); 46032 var import_element144 = __toESM(require_element(), 1); 46033 var import_components51 = __toESM(require_components(), 1); 46034 var import_jsx_runtime201 = __toESM(require_jsx_runtime(), 1); 46035 function AuthorView({ 46036 item 46037 }) { 46038 const author = item?._embedded?.author?.[0]; 46039 const text = author?.name; 46040 const imageUrl = author?.avatar_urls?.[48]; 46041 const [loadingState, setLoadingState] = (0, import_element144.useState)("loading"); 46042 (0, import_element144.useEffect)(() => { 46043 setLoadingState("loading"); 46044 }, [imageUrl]); 46045 const imgRef = (0, import_element144.useCallback)((img) => { 46046 if (img?.complete) { 46047 setLoadingState("instant"); 46048 } 46049 }, []); 46050 const handleLoad = () => { 46051 if (loadingState === "loading") { 46052 setLoadingState("loaded"); 46053 } 46054 }; 46055 return /* @__PURE__ */ (0, import_jsx_runtime201.jsxs)(import_components51.__experimentalHStack, { alignment: "left", spacing: 0, children: [ 46056 !!imageUrl && /* @__PURE__ */ (0, import_jsx_runtime201.jsx)( 46057 "div", 46058 { 46059 className: clsx_default("media-author-field__avatar", { 46060 "is-loading": loadingState === "loading", 46061 "is-loaded": loadingState === "loaded" 46062 }), 46063 children: /* @__PURE__ */ (0, import_jsx_runtime201.jsx)( 46064 "img", 46065 { 46066 ref: imgRef, 46067 onLoad: handleLoad, 46068 alt: (0, import_i18n66.__)("Author avatar"), 46069 src: imageUrl 46070 } 46071 ) 46072 } 46073 ), 46074 !imageUrl && /* @__PURE__ */ (0, import_jsx_runtime201.jsx)("div", { className: "media-author-field__icon", children: /* @__PURE__ */ (0, import_jsx_runtime201.jsx)(import_components51.Icon, { icon: comment_author_avatar_default }) }), 46075 /* @__PURE__ */ (0, import_jsx_runtime201.jsx)("span", { className: "media-author-field__name", children: text }) 46076 ] }); 46077 } 46078 46079 // packages/media-fields/build-module/author/index.mjs 46080 var authorField = { 46081 label: (0, import_i18n67.__)("Author"), 46082 id: "author", 46083 type: "integer", 46084 getElements: async () => { 46085 const authors = await (0, import_data11.resolveSelect)(import_core_data4.store).getEntityRecords( 46086 "root", 46087 "user", 46088 { 46089 per_page: -1, 46090 who: "authors", 46091 _fields: "id,name", 46092 context: "view" 46093 } 46094 ) ?? []; 46095 return authors.map(({ id, name }) => ({ 46096 value: id, 46097 label: name 46098 })); 46099 }, 46100 render: AuthorView, 46101 filterBy: { 46102 operators: ["isAny", "isNone"] 46103 }, 46104 readOnly: true 46105 }; 46106 var author_default = authorField; 46107 46108 // packages/media-fields/build-module/caption/index.mjs 46109 var import_i18n68 = __toESM(require_i18n(), 1); 46110 46111 // packages/media-fields/build-module/utils/get-raw-content.mjs 46112 function getRawContent(content) { 46113 if (!content) { 46114 return ""; 46115 } 46116 if (typeof content === "string") { 46117 return content; 46118 } 46119 if (typeof content === "object" && "raw" in content) { 46120 return content.raw || ""; 46121 } 46122 return ""; 46123 } 46124 46125 // packages/media-fields/build-module/caption/index.mjs 46126 var captionField = { 46127 id: "caption", 46128 type: "text", 46129 label: (0, import_i18n68.__)("Caption"), 46130 getValue: ({ item }) => getRawContent(item?.caption), 46131 render: ({ item }) => getRawContent(item?.caption) || "-", 46132 Edit: { 46133 control: "textarea", 46134 rows: 2 46135 }, 46136 enableSorting: false, 46137 filterBy: false 46138 }; 46139 var caption_default = captionField; 46140 46141 // packages/media-fields/build-module/date_added/index.mjs 46142 var import_i18n69 = __toESM(require_i18n(), 1); 46143 var dateAddedField = { 46144 id: "date", 46145 type: "datetime", 46146 label: (0, import_i18n69.__)("Date added"), 46147 filterBy: { 46148 operators: ["before", "after"] 46149 }, 46150 readOnly: true 46151 }; 46152 var date_added_default = dateAddedField; 46153 46154 // packages/media-fields/build-module/date_modified/index.mjs 46155 var import_i18n70 = __toESM(require_i18n(), 1); 46156 var dateModifiedField = { 46157 id: "modified", 46158 type: "datetime", 46159 label: (0, import_i18n70.__)("Date modified"), 46160 filterBy: { 46161 operators: ["before", "after"] 46162 }, 46163 readOnly: true 46164 }; 46165 var date_modified_default = dateModifiedField; 46166 46167 // packages/media-fields/build-module/description/index.mjs 46168 var import_i18n71 = __toESM(require_i18n(), 1); 46169 var import_jsx_runtime202 = __toESM(require_jsx_runtime(), 1); 46170 var descriptionField = { 46171 id: "description", 46172 type: "text", 46173 label: (0, import_i18n71.__)("Description"), 46174 getValue: ({ item }) => getRawContent(item?.description), 46175 render: ({ item }) => /* @__PURE__ */ (0, import_jsx_runtime202.jsx)("div", { children: getRawContent(item?.description) || "-" }), 46176 Edit: { 46177 control: "textarea", 46178 rows: 5 46179 }, 46180 enableSorting: false, 46181 filterBy: false 46182 }; 46183 var description_default = descriptionField; 46184 46185 // packages/media-fields/build-module/filename/index.mjs 46186 var import_i18n72 = __toESM(require_i18n(), 1); 46187 var import_url4 = __toESM(require_url(), 1); 46188 46189 // packages/media-fields/build-module/filename/view.mjs 46190 var import_element145 = __toESM(require_element(), 1); 46191 var import_url3 = __toESM(require_url(), 1); 46192 var import_jsx_runtime203 = __toESM(require_jsx_runtime(), 1); 46193 var TRUNCATE_LENGTH = 15; 46194 function FileNameView({ 46195 item 46196 }) { 46197 const fileName = (0, import_element145.useMemo)( 46198 () => item?.source_url ? (0, import_url3.getFilename)(item.source_url) : null, 46199 [item?.source_url] 46200 ); 46201 if (!fileName) { 46202 return ""; 46203 } 46204 if (fileName.length <= TRUNCATE_LENGTH) { 46205 return /* @__PURE__ */ (0, import_jsx_runtime203.jsx)("span", { className: "dataviews-media-field__filename", children: fileName }); 46206 } 46207 return /* @__PURE__ */ (0, import_jsx_runtime203.jsxs)(tooltip_exports.Root, { children: [ 46208 /* @__PURE__ */ (0, import_jsx_runtime203.jsx)( 46209 tooltip_exports.Trigger, 46210 { 46211 render: /* @__PURE__ */ (0, import_jsx_runtime203.jsx)("span", { className: "dataviews-media-field__filename", children: fileName }) 46212 } 46213 ), 46214 /* @__PURE__ */ (0, import_jsx_runtime203.jsx)(tooltip_exports.Popup, { children: fileName }) 46215 ] }); 46216 } 46217 46218 // packages/media-fields/build-module/filename/index.mjs 46219 var filenameField = { 46220 id: "filename", 46221 type: "text", 46222 label: (0, import_i18n72.__)("File name"), 46223 getValue: ({ item }) => (0, import_url4.getFilename)(item?.source_url || ""), 46224 render: FileNameView, 46225 enableSorting: false, 46226 filterBy: false, 46227 readOnly: true 46228 }; 46229 var filename_default = filenameField; 46230 46231 // packages/media-fields/build-module/filesize/index.mjs 46232 var import_i18n73 = __toESM(require_i18n(), 1); 46233 var KB_IN_BYTES = 1024; 46234 var MB_IN_BYTES = 1024 * KB_IN_BYTES; 46235 var GB_IN_BYTES = 1024 * MB_IN_BYTES; 46236 var TB_IN_BYTES = 1024 * GB_IN_BYTES; 46237 var PB_IN_BYTES = 1024 * TB_IN_BYTES; 46238 var EB_IN_BYTES = 1024 * PB_IN_BYTES; 46239 var ZB_IN_BYTES = 1024 * EB_IN_BYTES; 46240 var YB_IN_BYTES = 1024 * ZB_IN_BYTES; 46241 function getBytesString(bytes, unitSymbol, decimals = 2) { 46242 return (0, import_i18n73.sprintf)( 46243 // translators: 1: Actual bytes of a file. 2: The unit symbol (e.g. MB). 46244 (0, import_i18n73._x)("%1$s %2$s", "file size"), 46245 bytes.toLocaleString(void 0, { 46246 minimumFractionDigits: 0, 46247 maximumFractionDigits: decimals 46248 }), 46249 unitSymbol 46250 ); 46251 } 46252 function formatFileSize(bytes, decimals = 2) { 46253 if (bytes === 0) { 46254 return getBytesString(0, (0, import_i18n73._x)("B", "unit symbol"), decimals); 46255 } 46256 const quant = { 46257 /* translators: Unit symbol for yottabyte. */ 46258 [(0, import_i18n73._x)("YB", "unit symbol")]: YB_IN_BYTES, 46259 /* translators: Unit symbol for zettabyte. */ 46260 [(0, import_i18n73._x)("ZB", "unit symbol")]: ZB_IN_BYTES, 46261 /* translators: Unit symbol for exabyte. */ 46262 [(0, import_i18n73._x)("EB", "unit symbol")]: EB_IN_BYTES, 46263 /* translators: Unit symbol for petabyte. */ 46264 [(0, import_i18n73._x)("PB", "unit symbol")]: PB_IN_BYTES, 46265 /* translators: Unit symbol for terabyte. */ 46266 [(0, import_i18n73._x)("TB", "unit symbol")]: TB_IN_BYTES, 46267 /* translators: Unit symbol for gigabyte. */ 46268 [(0, import_i18n73._x)("GB", "unit symbol")]: GB_IN_BYTES, 46269 /* translators: Unit symbol for megabyte. */ 46270 [(0, import_i18n73._x)("MB", "unit symbol")]: MB_IN_BYTES, 46271 /* translators: Unit symbol for kilobyte. */ 46272 [(0, import_i18n73._x)("KB", "unit symbol")]: KB_IN_BYTES, 46273 /* translators: Unit symbol for byte. */ 46274 [(0, import_i18n73._x)("B", "unit symbol")]: 1 46275 }; 46276 for (const [unit, mag] of Object.entries(quant)) { 46277 if (bytes >= mag) { 46278 return getBytesString(bytes / mag, unit, decimals); 46279 } 46280 } 46281 return ""; 46282 } 46283 var filesizeField = { 46284 id: "filesize", 46285 type: "text", 46286 label: (0, import_i18n73.__)("File size"), 46287 getValue: ({ item }) => item?.media_details?.filesize ? formatFileSize(item?.media_details?.filesize) : "", 46288 isVisible: (item) => { 46289 return !!item?.media_details?.filesize; 46290 }, 46291 enableSorting: false, 46292 filterBy: false, 46293 readOnly: true 46294 }; 46295 var filesize_default = filesizeField; 46296 46297 // packages/media-fields/build-module/media_dimensions/index.mjs 46298 var import_i18n74 = __toESM(require_i18n(), 1); 46299 var mediaDimensionsField = { 46300 id: "media_dimensions", 46301 type: "text", 46302 label: (0, import_i18n74.__)("Dimensions"), 46303 getValue: ({ item }) => item?.media_details?.width && item?.media_details?.height ? (0, import_i18n74.sprintf)( 46304 // translators: 1: Width. 2: Height. 46305 (0, import_i18n74._x)("%1$s \xD7 %2$s", "image dimensions"), 46306 item?.media_details?.width?.toString(), 46307 item?.media_details?.height?.toString() 46308 ) : "", 46309 isVisible: (item) => { 46310 return !!(item?.media_details?.width && item?.media_details?.height); 46311 }, 46312 enableSorting: false, 46313 filterBy: false, 46314 readOnly: true 46315 }; 46316 var media_dimensions_default = mediaDimensionsField; 46317 46318 // packages/media-fields/build-module/media_thumbnail/index.mjs 46319 var import_i18n76 = __toESM(require_i18n(), 1); 46320 46321 // packages/media-fields/build-module/media_thumbnail/view.mjs 46322 var import_data12 = __toESM(require_data(), 1); 46323 var import_core_data5 = __toESM(require_core_data(), 1); 46324 var import_components52 = __toESM(require_components(), 1); 46325 var import_element146 = __toESM(require_element(), 1); 46326 var import_url5 = __toESM(require_url(), 1); 46327 46328 // packages/media-fields/build-module/utils/get-media-type-from-mime-type.mjs 46329 var import_i18n75 = __toESM(require_i18n(), 1); 46330 function getMediaTypeFromMimeType(mimeType) { 46331 if (mimeType.startsWith("image/")) { 46332 return { 46333 type: "image", 46334 label: (0, import_i18n75.__)("Image"), 46335 icon: image_default 46336 }; 46337 } 46338 if (mimeType.startsWith("video/")) { 46339 return { 46340 type: "video", 46341 label: (0, import_i18n75.__)("Video"), 46342 icon: video_default 46343 }; 46344 } 46345 if (mimeType.startsWith("audio/")) { 46346 return { 46347 type: "audio", 46348 label: (0, import_i18n75.__)("Audio"), 46349 icon: audio_default 46350 }; 46351 } 46352 return { 46353 type: "application", 46354 label: (0, import_i18n75.__)("Application"), 46355 icon: file_default 46356 }; 46357 } 46358 46359 // packages/media-fields/build-module/media_thumbnail/view.mjs 46360 var import_jsx_runtime204 = __toESM(require_jsx_runtime(), 1); 46361 function getBestImageUrl(featuredMedia, configSizes) { 46362 const sizes = featuredMedia?.media_details?.sizes; 46363 if (!sizes) { 46364 return featuredMedia.source_url; 46365 } 46366 const sizeEntries = Object.values(sizes); 46367 if (!sizeEntries.length) { 46368 return featuredMedia.source_url; 46369 } 46370 const targetWidth = configSizes ? parseInt(configSizes, 10) : NaN; 46371 if (!Number.isNaN(targetWidth)) { 46372 const validEntries = sizeEntries.filter( 46373 (s) => typeof s.width === "number" && !Number.isNaN(s.width) 46374 ); 46375 if (!validEntries.length) { 46376 return featuredMedia.source_url; 46377 } 46378 const sorted = [...validEntries].sort( 46379 (a, b) => a.width - b.width 46380 ); 46381 const match2 = sorted.find((s) => s.width >= targetWidth); 46382 if (match2) { 46383 return match2.source_url; 46384 } 46385 return sorted[sorted.length - 1].source_url; 46386 } 46387 return featuredMedia.source_url; 46388 } 46389 function FallbackView({ 46390 item, 46391 filename 46392 }) { 46393 return /* @__PURE__ */ (0, import_jsx_runtime204.jsx)("div", { className: "dataviews-media-field__media-thumbnail", children: /* @__PURE__ */ (0, import_jsx_runtime204.jsxs)( 46394 import_components52.__experimentalVStack, 46395 { 46396 justify: "center", 46397 alignment: "center", 46398 className: "dataviews-media-field__media-thumbnail__stack", 46399 spacing: 0, 46400 children: [ 46401 /* @__PURE__ */ (0, import_jsx_runtime204.jsx)( 46402 import_components52.Icon, 46403 { 46404 className: "dataviews-media-field__media-thumbnail--icon", 46405 icon: getMediaTypeFromMimeType(item.mime_type).icon, 46406 size: 24 46407 } 46408 ), 46409 !!filename && /* @__PURE__ */ (0, import_jsx_runtime204.jsx)("div", { className: "dataviews-media-field__media-thumbnail__filename", children: /* @__PURE__ */ (0, import_jsx_runtime204.jsx)(import_components52.__experimentalTruncate, { className: "dataviews-media-field__media-thumbnail__filename__truncate", children: filename }) }) 46410 ] 46411 } 46412 ) }); 46413 } 46414 function ImageView({ 46415 item, 46416 configSizes, 46417 onError 46418 }) { 46419 const imageUrl = getBestImageUrl(item, configSizes); 46420 const imgRef = (0, import_element146.useRef)(null); 46421 const [loadingState, setLoadingState] = (0, import_element146.useState)("loading"); 46422 (0, import_element146.useLayoutEffect)(() => { 46423 if (imgRef.current?.complete) { 46424 setLoadingState("instant"); 46425 } else { 46426 setLoadingState("loading"); 46427 } 46428 }, [imageUrl]); 46429 const handleLoad = () => { 46430 if (loadingState === "loading") { 46431 setLoadingState("loaded"); 46432 } 46433 }; 46434 return /* @__PURE__ */ (0, import_jsx_runtime204.jsx)( 46435 "div", 46436 { 46437 className: clsx_default("dataviews-media-field__media-thumbnail", { 46438 "is-loading": loadingState === "loading", 46439 "is-loaded": loadingState === "loaded" 46440 }), 46441 children: /* @__PURE__ */ (0, import_jsx_runtime204.jsx)( 46442 "img", 46443 { 46444 ref: imgRef, 46445 className: "dataviews-media-field__media-thumbnail--image", 46446 src: imageUrl, 46447 alt: item.alt_text || item.title.raw, 46448 onLoad: handleLoad, 46449 onError, 46450 loading: "lazy" 46451 } 46452 ) 46453 } 46454 ); 46455 } 46456 function MediaThumbnailView({ 46457 item, 46458 config 46459 }) { 46460 const [imageError, setImageError] = (0, import_element146.useState)(false); 46461 const _featuredMedia = (0, import_data12.useSelect)( 46462 (select3) => { 46463 if (!item.featured_media) { 46464 return; 46465 } 46466 return select3(import_core_data5.store).getEntityRecord( 46467 "postType", 46468 "attachment", 46469 item.featured_media 46470 ); 46471 }, 46472 [item.featured_media] 46473 ); 46474 const featuredMedia = item.featured_media ? _featuredMedia : item; 46475 if (!featuredMedia) { 46476 return null; 46477 } 46478 const filename = (0, import_url5.getFilename)(featuredMedia.source_url || ""); 46479 if (imageError || getMediaTypeFromMimeType(featuredMedia.mime_type).type !== "image") { 46480 return /* @__PURE__ */ (0, import_jsx_runtime204.jsx)(FallbackView, { item: featuredMedia, filename: filename || "" }); 46481 } 46482 return /* @__PURE__ */ (0, import_jsx_runtime204.jsx)( 46483 ImageView, 46484 { 46485 item: featuredMedia, 46486 configSizes: config?.sizes, 46487 onError: () => setImageError(true) 46488 } 46489 ); 46490 } 46491 46492 // packages/media-fields/build-module/media_thumbnail/index.mjs 46493 var mediaThumbnailField = { 46494 id: "media_thumbnail", 46495 type: "media", 46496 label: (0, import_i18n76.__)("Thumbnail"), 46497 render: MediaThumbnailView, 46498 enableSorting: false, 46499 filterBy: false 46500 }; 46501 var media_thumbnail_default = mediaThumbnailField; 46502 46503 // packages/media-fields/build-module/mime_type/index.mjs 46504 var import_i18n77 = __toESM(require_i18n(), 1); 46505 var mimeTypeField = { 46506 id: "mime_type", 46507 type: "text", 46508 label: (0, import_i18n77.__)("File type"), 46509 getValue: ({ item }) => item?.mime_type || "", 46510 render: ({ item }) => item?.mime_type || "-", 46511 // Disable sorting until REST API support for ordering my `mime_type` is added. 46512 // See: https://core.trac.wordpress.org/ticket/64073 46513 enableSorting: false, 46514 filterBy: false, 46515 readOnly: true 46516 }; 46517 var mime_type_default = mimeTypeField; 46518 46519 // packages/media-utils/build-module/components/media-upload-modal/index.mjs 46520 var import_notices = __toESM(require_notices(), 1); 46521 46522 // packages/media-utils/build-module/lock-unlock.mjs 46523 var import_private_apis3 = __toESM(require_private_apis(), 1); 46524 var { lock: lock3, unlock: unlock3 } = (0, import_private_apis3.__dangerousOptInToUnstableAPIsOnlyForCoreModules)( 46525 "I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.", 46526 "@wordpress/media-utils" 46527 ); 46528 46529 // packages/media-utils/build-module/components/media-upload-modal/upload-status-popover.mjs 46530 var import_element147 = __toESM(require_element(), 1); 46531 var import_i18n78 = __toESM(require_i18n(), 1); 46532 var import_components53 = __toESM(require_components(), 1); 46533 var import_jsx_runtime205 = __toESM(require_jsx_runtime(), 1); 46534 function UploadStatusPopover({ 46535 uploadingFiles, 46536 onDismissError, 46537 onOpenChange 46538 }) { 46539 const [isOpen, setIsOpen] = (0, import_element147.useState)(false); 46540 const [prevHadErrors, setPrevHadErrors] = (0, import_element147.useState)(false); 46541 const triggerRef = (0, import_element147.useRef)(null); 46542 const updateIsOpen = (0, import_element147.useCallback)( 46543 (open2) => { 46544 setIsOpen(open2); 46545 onOpenChange?.(open2); 46546 }, 46547 [onOpenChange] 46548 ); 46549 const activeFiles = uploadingFiles.filter( 46550 (file) => file.status === "uploading" 46551 ); 46552 const errorFiles = uploadingFiles.filter( 46553 (file) => file.status === "error" 46554 ); 46555 const hasErrors = errorFiles.length > 0; 46556 const isUploading = activeFiles.length > 0; 46557 (0, import_element147.useEffect)(() => { 46558 if (hasErrors && !prevHadErrors) { 46559 updateIsOpen(true); 46560 } 46561 setPrevHadErrors(hasErrors); 46562 }, [hasErrors, prevHadErrors, updateIsOpen]); 46563 if (uploadingFiles.length === 0) { 46564 return null; 46565 } 46566 let buttonLabel, popoverHeading; 46567 if (isUploading) { 46568 buttonLabel = (0, import_i18n78.sprintf)( 46569 // translators: %s: number of files being uploaded 46570 (0, import_i18n78._n)("Uploading %s file", "Uploading %s files", activeFiles.length), 46571 activeFiles.length.toLocaleString() 46572 ); 46573 popoverHeading = (0, import_i18n78.__)("Uploading"); 46574 } else if (hasErrors) { 46575 buttonLabel = (0, import_i18n78.sprintf)( 46576 // translators: %s: number of upload errors 46577 (0, import_i18n78._n)("%s upload error", "%s upload errors", errorFiles.length), 46578 errorFiles.length.toLocaleString() 46579 ); 46580 popoverHeading = (0, import_i18n78.__)("Upload errors"); 46581 } else { 46582 buttonLabel = (0, import_i18n78.__)("Upload complete"); 46583 popoverHeading = (0, import_i18n78.__)("Upload complete"); 46584 } 46585 return /* @__PURE__ */ (0, import_jsx_runtime205.jsxs)("div", { className: "media-upload-modal__upload-status", children: [ 46586 isUploading && /* @__PURE__ */ (0, import_jsx_runtime205.jsx)(import_components53.Spinner, {}), 46587 /* @__PURE__ */ (0, import_jsx_runtime205.jsx)( 46588 import_components53.Button, 46589 { 46590 className: "media-upload-modal__upload-status__trigger", 46591 size: "compact", 46592 icon: chevron_down_default, 46593 iconPosition: "right", 46594 onClick: () => updateIsOpen(!isOpen), 46595 "aria-expanded": isOpen, 46596 ref: triggerRef, 46597 children: buttonLabel 46598 } 46599 ), 46600 isOpen && /* @__PURE__ */ (0, import_jsx_runtime205.jsxs)( 46601 import_components53.Popover, 46602 { 46603 className: "media-upload-modal__upload-status__popover", 46604 placement: "top-start", 46605 offset: 8, 46606 anchor: triggerRef.current, 46607 focusOnMount: true, 46608 onClose: () => { 46609 if (triggerRef.current?.contains( 46610 triggerRef.current.ownerDocument.activeElement 46611 )) { 46612 return; 46613 } 46614 updateIsOpen(false); 46615 }, 46616 children: [ 46617 /* @__PURE__ */ (0, import_jsx_runtime205.jsx)("div", { className: "media-upload-modal__upload-status__header", children: /* @__PURE__ */ (0, import_jsx_runtime205.jsx)("h3", { children: popoverHeading }) }), 46618 /* @__PURE__ */ (0, import_jsx_runtime205.jsx)("ul", { className: "media-upload-modal__upload-status__list", children: uploadingFiles.map((file) => /* @__PURE__ */ (0, import_jsx_runtime205.jsxs)( 46619 "li", 46620 { 46621 className: "media-upload-modal__upload-status__item", 46622 children: [ 46623 file.status === "uploading" && /* @__PURE__ */ (0, import_jsx_runtime205.jsx)(import_components53.Spinner, {}), 46624 file.status === "uploaded" && /* @__PURE__ */ (0, import_jsx_runtime205.jsx)(import_components53.Icon, { icon: check_default, size: 16 }), 46625 (file.status === "uploading" || file.status === "uploaded") && /* @__PURE__ */ (0, import_jsx_runtime205.jsx)( 46626 "span", 46627 { 46628 className: "media-upload-modal__upload-status__filename", 46629 title: file.name, 46630 children: file.name 46631 } 46632 ), 46633 file.status === "error" && /* @__PURE__ */ (0, import_jsx_runtime205.jsxs)( 46634 import_components53.Notice, 46635 { 46636 status: "error", 46637 isDismissible: !!onDismissError, 46638 onRemove: () => onDismissError?.(file.id), 46639 children: [ 46640 file.name, 46641 ": ", 46642 file.error 46643 ] 46644 } 46645 ) 46646 ] 46647 }, 46648 file.id 46649 )) }) 46650 ] 46651 } 46652 ) 46653 ] }); 46654 } 46655 46656 // packages/media-utils/build-module/components/media-upload-modal/use-invalidate-attachment-resolutions.mjs 46657 var import_element148 = __toESM(require_element(), 1); 46658 var import_data13 = __toESM(require_data(), 1); 46659 function useInvalidateAttachmentResolutions() { 46660 const registry = (0, import_data13.useRegistry)(); 46661 return (0, import_element148.useCallback)( 46662 () => invalidateAttachmentResolutions(registry), 46663 [registry] 46664 ); 46665 } 46666 46667 // packages/media-utils/build-module/components/media-upload-modal/use-upload-status.mjs 46668 var import_element149 = __toESM(require_element(), 1); 46669 var import_blob2 = __toESM(require_blob(), 1); 46670 var idCounter = 0; 46671 var batchIdCounter = 0; 46672 function useUploadStatus({ 46673 onBatchComplete 46674 } = {}) { 46675 const [uploadingFiles, setUploadingFiles] = (0, import_element149.useState)( 46676 [] 46677 ); 46678 const clearCompleted = (0, import_element149.useCallback)(() => { 46679 setUploadingFiles( 46680 (prev) => prev.filter((item) => item.status !== "uploaded") 46681 ); 46682 }, []); 46683 const dismissError = (0, import_element149.useCallback)((fileId) => { 46684 setUploadingFiles( 46685 (prev) => prev.filter((item) => item.id !== fileId) 46686 ); 46687 }, []); 46688 const registerBatch = (0, import_element149.useCallback)( 46689 (files) => { 46690 const batchId = String(++batchIdCounter); 46691 const batchSize = files.length; 46692 const newEntries = files.map((file) => ({ 46693 id: String(++idCounter), 46694 batchId, 46695 name: file.name, 46696 status: "uploading" 46697 })); 46698 setUploadingFiles((prev) => [...prev, ...newEntries]); 46699 let successCount = 0; 46700 let errorCount = 0; 46701 let batchDone = false; 46702 let successAttachments = []; 46703 const completeBatchIfDone = () => { 46704 if (batchDone || successCount + errorCount < batchSize) { 46705 return; 46706 } 46707 batchDone = true; 46708 setUploadingFiles( 46709 (prev) => prev.map( 46710 (item) => item.batchId === batchId && item.status === "uploading" ? { 46711 ...item, 46712 status: "uploaded" 46713 } : item 46714 ) 46715 ); 46716 onBatchComplete?.(successAttachments); 46717 }; 46718 const onFileChange = (attachments) => { 46719 if (batchDone) { 46720 return; 46721 } 46722 const allReal = attachments.every( 46723 (attachment) => attachment.id && attachment.url && !(0, import_blob2.isBlobURL)(attachment.url) 46724 ); 46725 if (!allReal) { 46726 return; 46727 } 46728 successCount = attachments.length; 46729 successAttachments = attachments; 46730 completeBatchIfDone(); 46731 }; 46732 const onError = (error2) => { 46733 const fileName = error2 instanceof UploadError ? error2.file.name : void 0; 46734 setUploadingFiles((prev) => { 46735 let matched = false; 46736 return prev.map((item) => { 46737 if (!matched && item.batchId === batchId && item.status === "uploading" && (!fileName || item.name === fileName)) { 46738 matched = true; 46739 return { 46740 ...item, 46741 status: "error", 46742 error: error2.message 46743 }; 46744 } 46745 return item; 46746 }); 46747 }); 46748 errorCount++; 46749 completeBatchIfDone(); 46750 }; 46751 return { onFileChange, onError }; 46752 }, 46753 [onBatchComplete] 46754 ); 46755 const allComplete = uploadingFiles.length > 0 && uploadingFiles.every((item) => item.status !== "uploading"); 46756 return { 46757 uploadingFiles, 46758 registerBatch, 46759 dismissError, 46760 clearCompleted, 46761 allComplete 46762 }; 46763 } 46764 46765 // packages/media-utils/build-module/components/media-upload-modal/index.mjs 46766 var import_jsx_runtime206 = __toESM(require_jsx_runtime(), 1); 46767 var { useEntityRecordsWithPermissions } = unlock3(import_core_data6.privateApis); 46768 var LAYOUT_PICKER_GRID2 = "pickerGrid"; 46769 var LAYOUT_PICKER_TABLE2 = "pickerTable"; 46770 var NOTICES_CONTEXT = "media-modal"; 46771 var NOTICE_ID_UPLOAD_PROGRESS = "media-modal-upload-progress"; 46772 var ATTACHED_TO_FIELD = "attached_to"; 46773 var defaultQueryParams = { 46774 page: 1, 46775 search: "" 46776 }; 46777 function getSelectionFromValue(value) { 46778 if (!value) { 46779 return []; 46780 } 46781 return Array.isArray(value) ? value.map(String) : [String(value)]; 46782 } 46783 var defaultView = { 46784 type: LAYOUT_PICKER_GRID2, 46785 fields: [], 46786 showTitle: false, 46787 titleField: "title", 46788 mediaField: "media_thumbnail", 46789 perPage: 50, 46790 filters: [], 46791 layout: { 46792 previewSize: 170, 46793 density: "compact", 46794 // Fit each thumbnail inside its square cell rather than cropping it, 46795 // so the media's own orientation is visible before it's inserted. 46796 // Users can switch back to cropped in the view options. 46797 mediaFit: "contain" 46798 } 46799 }; 46800 var defaultLayouts = { 46801 [LAYOUT_PICKER_GRID2]: { 46802 fields: [], 46803 showTitle: false, 46804 layout: { 46805 previewSize: 170, 46806 density: "compact", 46807 mediaFit: "contain" 46808 } 46809 }, 46810 [LAYOUT_PICKER_TABLE2]: { 46811 fields: [ 46812 "filename", 46813 "filesize", 46814 "media_dimensions", 46815 "author", 46816 "date" 46817 ], 46818 showTitle: true 46819 } 46820 }; 46821 var dataViewsConfig = { 46822 // Repeats `DataViewsPicker`'s own default, which passing `config` at all 46823 // would otherwise replace. 46824 perPageSizes: [10, 20, 50, 100], 46825 // Seeing whether a media item is portrait or landscape before inserting 46826 // it matters here, so offer the crop/fit switch in the view options. 46827 mediaFitControl: true 46828 }; 46829 function MediaUploadModal({ 46830 allowedTypes, 46831 multiple = false, 46832 value, 46833 onSelect, 46834 onClose, 46835 onUpload, 46836 title = (0, import_i18n79.__)("Select Media"), 46837 isOpen, 46838 isDismissible = true, 46839 modalClass, 46840 search = true, 46841 searchLabel = (0, import_i18n79.__)("Search media"), 46842 postId, 46843 postType 46844 }) { 46845 const attachedToPostId = Number.isInteger(postId) ? postId : void 0; 46846 const uploadedToLabel = (0, import_data14.useSelect)( 46847 (select3) => attachedToPostId && postType ? select3(import_core_data6.store).getPostType(postType)?.labels?.uploaded_to_this_item : void 0, 46848 [attachedToPostId, postType] 46849 ); 46850 const [selection, setSelection] = (0, import_element150.useState)( 46851 () => getSelectionFromValue(value) 46852 ); 46853 const { createSuccessNotice, removeAllNotices } = (0, import_data14.useDispatch)(import_notices.store); 46854 const invalidateAttachmentResolutions2 = useInvalidateAttachmentResolutions(); 46855 const [queryParams, setQueryParams] = (0, import_element150.useState)( 46856 () => defaultQueryParams 46857 ); 46858 const { 46859 view: persistedView, 46860 updateView, 46861 isModified, 46862 resetToDefault 46863 } = useView({ 46864 kind: "postType", 46865 name: "attachment", 46866 slug: "media-modal", 46867 defaultView, 46868 queryParams, 46869 onChangeQueryParams: setQueryParams 46870 }); 46871 const [attachedToFilter, setAttachedToFilter] = (0, import_element150.useState)(); 46872 const view = (0, import_element150.useMemo)(() => { 46873 const filters = (persistedView.filters ?? []).filter( 46874 ({ field }) => field !== ATTACHED_TO_FIELD 46875 ); 46876 return { 46877 ...persistedView, 46878 filters: attachedToFilter ? [...filters, attachedToFilter] : filters 46879 }; 46880 }, [persistedView, attachedToFilter]); 46881 const handleChangeView = (0, import_element150.useCallback)( 46882 (nextView) => { 46883 const normalizedView = { ...nextView }; 46884 if (normalizedView.startPosition === void 0) { 46885 delete normalizedView.startPosition; 46886 } 46887 setAttachedToFilter( 46888 normalizedView.filters?.find( 46889 ({ field }) => field === ATTACHED_TO_FIELD 46890 ) 46891 ); 46892 updateView({ 46893 ...normalizedView, 46894 filters: normalizedView.filters?.filter( 46895 ({ field }) => field !== ATTACHED_TO_FIELD 46896 ) 46897 }); 46898 }, 46899 [updateView] 46900 ); 46901 const handleReset = (0, import_element150.useCallback)(() => { 46902 setAttachedToFilter(void 0); 46903 resetToDefault(); 46904 }, [resetToDefault]); 46905 const queryArgs = (0, import_element150.useMemo)(() => { 46906 const filters = {}; 46907 view.filters?.forEach((filter) => { 46908 if (filter.field === "media_type") { 46909 filters.media_type = filter.value; 46910 } 46911 if (filter.field === "author") { 46912 if (filter.operator === "isAny") { 46913 filters.author = filter.value; 46914 } else if (filter.operator === "isNone") { 46915 filters.author_exclude = filter.value; 46916 } 46917 } 46918 if (filter.field === "date" || filter.field === "modified") { 46919 if (filter.operator === "before") { 46920 filters.before = filter.value; 46921 } else if (filter.operator === "after") { 46922 filters.after = filter.value; 46923 } 46924 } 46925 if (filter.field === "mime_type") { 46926 filters.mime_type = filter.value; 46927 } 46928 if (filter.field === ATTACHED_TO_FIELD && filter.operator === "isAny") { 46929 const parents = (Array.isArray(filter.value) ? filter.value : []).map((optionValue) => { 46930 if (optionValue === "unattached") { 46931 return 0; 46932 } 46933 return optionValue === "current" ? attachedToPostId : void 0; 46934 }).filter((parent) => parent !== void 0); 46935 if (parents.length) { 46936 filters.parent = parents; 46937 } 46938 } 46939 }); 46940 if (!filters.media_type && !filters.mime_type && allowedTypes && !allowedTypes.includes("*")) { 46941 const { mediaTypes, mimeTypes } = allowedTypes.reduce( 46942 (acc, type) => { 46943 if (type.endsWith("/*")) { 46944 acc.mediaTypes.push(type.replace("/*", "")); 46945 } else if (type.includes("/")) { 46946 acc.mimeTypes.push(type); 46947 } else { 46948 acc.mediaTypes.push(type); 46949 } 46950 return acc; 46951 }, 46952 { mediaTypes: [], mimeTypes: [] } 46953 ); 46954 if (mediaTypes.length) { 46955 filters.media_type = mediaTypes; 46956 } 46957 if (mimeTypes.length) { 46958 filters.mime_type = mimeTypes; 46959 } 46960 } 46961 return { 46962 per_page: view.perPage || 20, 46963 page: view.page || 1, 46964 status: "inherit", 46965 order: view.sort?.direction, 46966 orderby: view.sort?.field, 46967 search: view.search, 46968 _embed: "author,wp:attached-to", 46969 ...filters 46970 }; 46971 }, [view, allowedTypes, attachedToPostId]); 46972 const handleBatchComplete = (0, import_element150.useCallback)( 46973 (attachments) => { 46974 const uploadedIds = attachments.map((attachment) => String(attachment.id)).filter(Boolean); 46975 if (multiple) { 46976 setSelection((prev) => { 46977 const existing = new Set(prev); 46978 const newIds = uploadedIds.filter( 46979 (id) => !existing.has(id) 46980 ); 46981 return [...prev, ...newIds]; 46982 }); 46983 } else { 46984 setSelection(uploadedIds.slice(0, 1)); 46985 } 46986 invalidateAttachmentResolutions2(); 46987 }, 46988 [multiple, invalidateAttachmentResolutions2] 46989 ); 46990 const { 46991 uploadingFiles, 46992 registerBatch, 46993 dismissError, 46994 clearCompleted, 46995 allComplete 46996 } = useUploadStatus({ onBatchComplete: handleBatchComplete }); 46997 const isPopoverOpenRef = (0, import_element150.useRef)(false); 46998 const handlePopoverOpenChange = (0, import_element150.useCallback)( 46999 (open2) => { 47000 isPopoverOpenRef.current = open2; 47001 if (!open2) { 47002 clearCompleted(); 47003 } 47004 }, 47005 [clearCompleted] 47006 ); 47007 const { 47008 records: mediaRecords, 47009 isResolving: isLoading, 47010 totalItems, 47011 totalPages 47012 } = useEntityRecordsWithPermissions("postType", "attachment", queryArgs); 47013 const fields = (0, import_element150.useMemo)( 47014 () => [ 47015 // Media field definitions from @wordpress/media-fields 47016 // Cast is safe because RestAttachment has the same properties as Attachment 47017 { 47018 ...media_thumbnail_default, 47019 enableHiding: false 47020 // Within the modal, the thumbnail should always be shown. 47021 }, 47022 { 47023 id: "title", 47024 type: "text", 47025 label: (0, import_i18n79.__)("Title"), 47026 getValue: ({ item }) => { 47027 const titleValue = item.title.raw || item.title.rendered; 47028 return titleValue || (0, import_i18n79.__)("(no title)"); 47029 } 47030 }, 47031 alt_text_default, 47032 caption_default, 47033 description_default, 47034 date_added_default, 47035 date_modified_default, 47036 author_default, 47037 filename_default, 47038 filesize_default, 47039 media_dimensions_default, 47040 mime_type_default, 47041 { 47042 ...attached_to_default, 47043 // The shared field definition is not filterable, because the 47044 // "Uploaded to this post" option only makes sense with the modal's 47045 // post context. Values name options, and `queryArgs` above 47046 // translates them to `parent`. 47047 elements: [ 47048 ...attachedToPostId ? [ 47049 { 47050 value: "current", 47051 label: uploadedToLabel ?? (0, import_i18n79.__)("Uploaded to this item") 47052 } 47053 ] : [], 47054 { 47055 value: "unattached", 47056 label: (0, import_i18n79._x)("Unattached", "media items") 47057 } 47058 ], 47059 filterBy: { operators: ["isAny"] } 47060 } 47061 ], 47062 [attachedToPostId, uploadedToLabel] 47063 ); 47064 const actions = (0, import_element150.useMemo)( 47065 () => [ 47066 { 47067 id: "select", 47068 label: (0, import_i18n79.__)("Select"), 47069 isPrimary: true, 47070 supportsBulk: multiple, 47071 async callback() { 47072 if (selection.length === 0) { 47073 return; 47074 } 47075 const selectedPostsQuery = { 47076 include: selection, 47077 per_page: -1 47078 }; 47079 const selectedPosts = await (0, import_data14.resolveSelect)( 47080 import_core_data6.store 47081 ).getEntityRecords( 47082 "postType", 47083 "attachment", 47084 selectedPostsQuery 47085 ); 47086 const transformedPosts = (selectedPosts ?? []).map(transformAttachment).filter(Boolean); 47087 const selectedItems = multiple ? transformedPosts : transformedPosts?.[0]; 47088 removeAllNotices("snackbar", NOTICES_CONTEXT); 47089 onSelect(selectedItems); 47090 } 47091 } 47092 ], 47093 [multiple, onSelect, selection, removeAllNotices] 47094 ); 47095 const handleModalClose = (0, import_element150.useCallback)(() => { 47096 removeAllNotices("snackbar", NOTICES_CONTEXT); 47097 onClose?.(); 47098 }, [removeAllNotices, onClose]); 47099 const valueRef = (0, import_element150.useRef)(value); 47100 (0, import_element150.useEffect)(() => { 47101 valueRef.current = value; 47102 }, [value]); 47103 (0, import_element150.useEffect)(() => { 47104 if (isOpen) { 47105 setSelection(getSelectionFromValue(valueRef.current)); 47106 } else { 47107 setQueryParams(defaultQueryParams); 47108 } 47109 }, [isOpen]); 47110 const handleUpload = onUpload || uploadMedia; 47111 const prevAllCompleteRef = (0, import_element150.useRef)(false); 47112 (0, import_element150.useEffect)(() => { 47113 if (allComplete && !prevAllCompleteRef.current) { 47114 const completeCount = uploadingFiles.filter( 47115 (file) => file.status === "uploaded" 47116 ).length; 47117 if (completeCount > 0) { 47118 createSuccessNotice( 47119 (0, import_i18n79.sprintf)( 47120 // translators: %s: number of files 47121 (0, import_i18n79._n)( 47122 "Uploaded %s file", 47123 "Uploaded %s files", 47124 completeCount 47125 ), 47126 completeCount.toLocaleString() 47127 ), 47128 { 47129 type: "snackbar", 47130 context: NOTICES_CONTEXT, 47131 id: NOTICE_ID_UPLOAD_PROGRESS 47132 } 47133 ); 47134 } 47135 if (!isPopoverOpenRef.current) { 47136 clearCompleted(); 47137 } 47138 } 47139 prevAllCompleteRef.current = allComplete; 47140 }, [allComplete, uploadingFiles, createSuccessNotice, clearCompleted]); 47141 const handleFileSelect = (0, import_element150.useCallback)( 47142 (event) => { 47143 const files = event.target.files; 47144 if (files && files.length > 0) { 47145 const filesArray = Array.from(files); 47146 const { onFileChange, onError } = registerBatch(filesArray); 47147 handleUpload({ 47148 allowedTypes, 47149 filesList: filesArray, 47150 onFileChange, 47151 onError 47152 }); 47153 } 47154 }, 47155 [allowedTypes, handleUpload, registerBatch] 47156 ); 47157 const paginationInfo = (0, import_element150.useMemo)( 47158 () => ({ 47159 totalItems, 47160 totalPages 47161 }), 47162 [totalItems, totalPages] 47163 ); 47164 const acceptTypes = (0, import_element150.useMemo)(() => { 47165 if (allowedTypes?.includes("*")) { 47166 return void 0; 47167 } 47168 return allowedTypes?.join(","); 47169 }, [allowedTypes]); 47170 if (!isOpen) { 47171 return null; 47172 } 47173 return /* @__PURE__ */ (0, import_jsx_runtime206.jsxs)( 47174 import_components54.Modal, 47175 { 47176 title, 47177 onRequestClose: handleModalClose, 47178 isDismissible, 47179 className: modalClass, 47180 overlayClassName: "media-upload-modal", 47181 size: "fill", 47182 headerActions: /* @__PURE__ */ (0, import_jsx_runtime206.jsx)( 47183 import_components54.FormFileUpload, 47184 { 47185 accept: acceptTypes, 47186 multiple: true, 47187 onChange: handleFileSelect, 47188 render: ({ openFileDialog }) => /* @__PURE__ */ (0, import_jsx_runtime206.jsx)( 47189 import_components54.Button, 47190 { 47191 onClick: openFileDialog, 47192 icon: upload_default, 47193 __next40pxDefaultSize: true, 47194 children: (0, import_i18n79.__)("Upload media") 47195 } 47196 ) 47197 } 47198 ), 47199 children: [ 47200 /* @__PURE__ */ (0, import_jsx_runtime206.jsx)( 47201 import_components54.DropZone, 47202 { 47203 onFilesDrop: (files) => { 47204 let filteredFiles = files; 47205 if (allowedTypes && !allowedTypes.includes("*")) { 47206 filteredFiles = files.filter( 47207 (file) => allowedTypes.some((allowedType) => { 47208 return file.type === allowedType || file.type.startsWith( 47209 allowedType.replace("*", "") 47210 ); 47211 }) 47212 ); 47213 } 47214 if (filteredFiles.length > 0) { 47215 const { onFileChange, onError } = registerBatch(filteredFiles); 47216 handleUpload({ 47217 allowedTypes, 47218 filesList: filteredFiles, 47219 onFileChange, 47220 onError 47221 }); 47222 } 47223 }, 47224 label: (0, import_i18n79.__)("Drop files to upload") 47225 } 47226 ), 47227 /* @__PURE__ */ (0, import_jsx_runtime206.jsxs)( 47228 dataviews_picker_default, 47229 { 47230 data: mediaRecords || [], 47231 fields, 47232 view, 47233 onChangeView: handleChangeView, 47234 actions, 47235 selection, 47236 onChangeSelection: setSelection, 47237 isLoading, 47238 paginationInfo, 47239 defaultLayouts, 47240 config: dataViewsConfig, 47241 getItemId: (item) => String(item.id), 47242 itemListLabel: (0, import_i18n79.__)("Media items"), 47243 onReset: isModified || attachedToFilter ? handleReset : false, 47244 children: [ 47245 /* @__PURE__ */ (0, import_jsx_runtime206.jsxs)( 47246 Stack, 47247 { 47248 direction: "row", 47249 align: "top", 47250 justify: "space-between", 47251 className: "dataviews__view-actions", 47252 gap: "xs", 47253 children: [ 47254 /* @__PURE__ */ (0, import_jsx_runtime206.jsxs)( 47255 Stack, 47256 { 47257 direction: "row", 47258 gap: "sm", 47259 justify: "start", 47260 className: "dataviews__search", 47261 children: [ 47262 search && /* @__PURE__ */ (0, import_jsx_runtime206.jsx)(dataviews_picker_default.Search, { label: searchLabel }), 47263 /* @__PURE__ */ (0, import_jsx_runtime206.jsx)(dataviews_picker_default.FiltersToggle, {}) 47264 ] 47265 } 47266 ), 47267 /* @__PURE__ */ (0, import_jsx_runtime206.jsxs)(Stack, { direction: "row", gap: "xs", style: { flexShrink: 0 }, children: [ 47268 /* @__PURE__ */ (0, import_jsx_runtime206.jsx)(dataviews_picker_default.LayoutSwitcher, {}), 47269 /* @__PURE__ */ (0, import_jsx_runtime206.jsx)(dataviews_picker_default.ViewConfig, {}) 47270 ] }) 47271 ] 47272 } 47273 ), 47274 /* @__PURE__ */ (0, import_jsx_runtime206.jsx)(dataviews_picker_default.FiltersToggled, { className: "dataviews-filters__container" }), 47275 /* @__PURE__ */ (0, import_jsx_runtime206.jsx)(dataviews_picker_default.Layout, {}), 47276 /* @__PURE__ */ (0, import_jsx_runtime206.jsxs)( 47277 "div", 47278 { 47279 className: clsx_default("media-upload-modal__footer", { 47280 "is-uploading": uploadingFiles.length > 0 47281 }), 47282 children: [ 47283 /* @__PURE__ */ (0, import_jsx_runtime206.jsx)( 47284 UploadStatusPopover, 47285 { 47286 uploadingFiles, 47287 onDismissError: dismissError, 47288 onOpenChange: handlePopoverOpenChange 47289 } 47290 ), 47291 /* @__PURE__ */ (0, import_jsx_runtime206.jsx)(dataviews_picker_default.Footer, {}) 47292 ] 47293 } 47294 ) 47295 ] 47296 } 47297 ), 47298 (0, import_element150.createPortal)( 47299 /* @__PURE__ */ (0, import_jsx_runtime206.jsx)( 47300 import_notices.SnackbarNotices, 47301 { 47302 className: "media-upload-modal__snackbar", 47303 context: NOTICES_CONTEXT 47304 } 47305 ), 47306 document.body 47307 ) 47308 ] 47309 } 47310 ); 47311 } 47312 47313 // packages/media-utils/build-module/private-apis.mjs 47314 var privateApis = {}; 47315 lock3(privateApis, { 47316 sideloadMedia, 47317 MediaUploadModal 47318 }); 47319 return __toCommonJS(index_exports); 47320 })(); 47321 /*! Bundled license information: 47322 47323 use-sync-external-store/cjs/use-sync-external-store-shim.development.js: 47324 (** 47325 * @license React 47326 * use-sync-external-store-shim.development.js 47327 * 47328 * Copyright (c) Meta Platforms, Inc. and affiliates. 47329 * 47330 * This source code is licensed under the MIT license found in the 47331 * LICENSE file in the root directory of this source tree. 47332 *) 47333 47334 use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js: 47335 (** 47336 * @license React 47337 * use-sync-external-store-shim/with-selector.development.js 47338 * 47339 * Copyright (c) Meta Platforms, Inc. and affiliates. 47340 * 47341 * This source code is licensed under the MIT license found in the 47342 * LICENSE file in the root directory of this source tree. 47343 *) 47344 */ 47345 (window.wp ||= {}).mediaUtils = wp.mediaUtils; 47346 })();
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated : Sat Oct 10 08:20:33 2026 | Cross-referenced by PHPXref |