| [ Index ] |
PHP Cross Reference of WordPress Trunk (Updated Daily) |
[Summary view] [Print] [Text view]
1 var __create = Object.create; 2 var __defProp = Object.defineProperty; 3 var __getOwnPropDesc = Object.getOwnPropertyDescriptor; 4 var __getOwnPropNames = Object.getOwnPropertyNames; 5 var __getProtoOf = Object.getPrototypeOf; 6 var __hasOwnProp = Object.prototype.hasOwnProperty; 7 var __commonJS = (cb, mod) => function __require() { 8 return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; 9 }; 10 var __export = (target, all) => { 11 for (var name in all) 12 __defProp(target, name, { get: all[name], enumerable: true }); 13 }; 14 var __copyProps = (to, from, except, desc) => { 15 if (from && typeof from === "object" || typeof from === "function") { 16 for (let key2 of __getOwnPropNames(from)) 17 if (!__hasOwnProp.call(to, key2) && key2 !== except) 18 __defProp(to, key2, { get: () => from[key2], enumerable: !(desc = __getOwnPropDesc(from, key2)) || desc.enumerable }); 19 } 20 return to; 21 }; 22 var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( 23 // If the importer is in node compatibility mode or this is not an ESM 24 // file that has been converted to a CommonJS file using a Babel- 25 // compatible transform (i.e. "__esModule" has not been set), then set 26 // "default" to the CommonJS "module.exports" for node compatibility. 27 isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, 28 mod 29 )); 30 31 // package-external:@wordpress/i18n 32 var require_i18n = __commonJS({ 33 "package-external:@wordpress/i18n"(exports, module) { 34 module.exports = window.wp.i18n; 35 } 36 }); 37 38 // package-external:@wordpress/element 39 var require_element = __commonJS({ 40 "package-external:@wordpress/element"(exports, module) { 41 module.exports = window.wp.element; 42 } 43 }); 44 45 // vendor-external:react 46 var require_react = __commonJS({ 47 "vendor-external:react"(exports, module) { 48 module.exports = window.React; 49 } 50 }); 51 52 // vendor-external:react/jsx-runtime 53 var require_jsx_runtime = __commonJS({ 54 "vendor-external:react/jsx-runtime"(exports, module) { 55 module.exports = window.ReactJSXRuntime; 56 } 57 }); 58 59 // vendor-external:react-dom 60 var require_react_dom = __commonJS({ 61 "vendor-external:react-dom"(exports, module) { 62 module.exports = window.ReactDOM; 63 } 64 }); 65 66 // node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js 67 var require_use_sync_external_store_shim_development = __commonJS({ 68 "node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js"(exports) { 69 "use strict"; 70 (function() { 71 function is(x2, y2) { 72 return x2 === y2 && (0 !== x2 || 1 / x2 === 1 / y2) || x2 !== x2 && y2 !== y2; 73 } 74 function useSyncExternalStore$2(subscribe2, getSnapshot) { 75 didWarnOld18Alpha || void 0 === React103.startTransition || (didWarnOld18Alpha = true, console.error( 76 "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." 77 )); 78 var value = getSnapshot(); 79 if (!didWarnUncachedGetSnapshot) { 80 var cachedValue = getSnapshot(); 81 objectIs(value, cachedValue) || (console.error( 82 "The result of getSnapshot should be cached to avoid an infinite loop" 83 ), didWarnUncachedGetSnapshot = true); 84 } 85 cachedValue = useState73({ 86 inst: { value, getSnapshot } 87 }); 88 var inst = cachedValue[0].inst, forceUpdate = cachedValue[1]; 89 useLayoutEffect13( 90 function() { 91 inst.value = value; 92 inst.getSnapshot = getSnapshot; 93 checkIfSnapshotChanged(inst) && forceUpdate({ inst }); 94 }, 95 [subscribe2, value, getSnapshot] 96 ); 97 useEffect65( 98 function() { 99 checkIfSnapshotChanged(inst) && forceUpdate({ inst }); 100 return subscribe2(function() { 101 checkIfSnapshotChanged(inst) && forceUpdate({ inst }); 102 }); 103 }, 104 [subscribe2] 105 ); 106 useDebugValue2(value); 107 return value; 108 } 109 function checkIfSnapshotChanged(inst) { 110 var latestGetSnapshot = inst.getSnapshot; 111 inst = inst.value; 112 try { 113 var nextValue = latestGetSnapshot(); 114 return !objectIs(inst, nextValue); 115 } catch (error2) { 116 return true; 117 } 118 } 119 function useSyncExternalStore$1(subscribe2, getSnapshot) { 120 return getSnapshot(); 121 } 122 "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error()); 123 var React103 = require_react(), objectIs = "function" === typeof Object.is ? Object.is : is, useState73 = React103.useState, useEffect65 = React103.useEffect, useLayoutEffect13 = React103.useLayoutEffect, useDebugValue2 = React103.useDebugValue, didWarnOld18Alpha = false, didWarnUncachedGetSnapshot = false, shim = "undefined" === typeof window || "undefined" === typeof window.document || "undefined" === typeof window.document.createElement ? useSyncExternalStore$1 : useSyncExternalStore$2; 124 exports.useSyncExternalStore = void 0 !== React103.useSyncExternalStore ? React103.useSyncExternalStore : shim; 125 "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error()); 126 })(); 127 } 128 }); 129 130 // node_modules/use-sync-external-store/shim/index.js 131 var require_shim = __commonJS({ 132 "node_modules/use-sync-external-store/shim/index.js"(exports, module) { 133 "use strict"; 134 if (false) { 135 module.exports = null; 136 } else { 137 module.exports = require_use_sync_external_store_shim_development(); 138 } 139 } 140 }); 141 142 // node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js 143 var require_with_selector_development = __commonJS({ 144 "node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js"(exports) { 145 "use strict"; 146 (function() { 147 function is(x2, y2) { 148 return x2 === y2 && (0 !== x2 || 1 / x2 === 1 / y2) || x2 !== x2 && y2 !== y2; 149 } 150 "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error()); 151 var React103 = require_react(), shim = require_shim(), objectIs = "function" === typeof Object.is ? Object.is : is, useSyncExternalStore3 = shim.useSyncExternalStore, useRef82 = React103.useRef, useEffect65 = React103.useEffect, useMemo81 = React103.useMemo, useDebugValue2 = React103.useDebugValue; 152 exports.useSyncExternalStoreWithSelector = function(subscribe2, getSnapshot, getServerSnapshot, selector2, isEqual) { 153 var instRef = useRef82(null); 154 if (null === instRef.current) { 155 var inst = { hasValue: false, value: null }; 156 instRef.current = inst; 157 } else inst = instRef.current; 158 instRef = useMemo81( 159 function() { 160 function memoizedSelector(nextSnapshot) { 161 if (!hasMemo) { 162 hasMemo = true; 163 memoizedSnapshot = nextSnapshot; 164 nextSnapshot = selector2(nextSnapshot); 165 if (void 0 !== isEqual && inst.hasValue) { 166 var currentSelection = inst.value; 167 if (isEqual(currentSelection, nextSnapshot)) 168 return memoizedSelection = currentSelection; 169 } 170 return memoizedSelection = nextSnapshot; 171 } 172 currentSelection = memoizedSelection; 173 if (objectIs(memoizedSnapshot, nextSnapshot)) 174 return currentSelection; 175 var nextSelection = selector2(nextSnapshot); 176 if (void 0 !== isEqual && isEqual(currentSelection, nextSelection)) 177 return memoizedSnapshot = nextSnapshot, currentSelection; 178 memoizedSnapshot = nextSnapshot; 179 return memoizedSelection = nextSelection; 180 } 181 var hasMemo = false, memoizedSnapshot, memoizedSelection, maybeGetServerSnapshot = void 0 === getServerSnapshot ? null : getServerSnapshot; 182 return [ 183 function() { 184 return memoizedSelector(getSnapshot()); 185 }, 186 null === maybeGetServerSnapshot ? void 0 : function() { 187 return memoizedSelector(maybeGetServerSnapshot()); 188 } 189 ]; 190 }, 191 [getSnapshot, getServerSnapshot, selector2, isEqual] 192 ); 193 var value = useSyncExternalStore3(subscribe2, instRef[0], instRef[1]); 194 useEffect65( 195 function() { 196 inst.hasValue = true; 197 inst.value = value; 198 }, 199 [value] 200 ); 201 useDebugValue2(value); 202 return value; 203 }; 204 "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error()); 205 })(); 206 } 207 }); 208 209 // node_modules/use-sync-external-store/shim/with-selector.js 210 var require_with_selector = __commonJS({ 211 "node_modules/use-sync-external-store/shim/with-selector.js"(exports, module) { 212 "use strict"; 213 if (false) { 214 module.exports = null; 215 } else { 216 module.exports = require_with_selector_development(); 217 } 218 } 219 }); 220 221 // package-external:@wordpress/primitives 222 var require_primitives = __commonJS({ 223 "package-external:@wordpress/primitives"(exports, module) { 224 module.exports = window.wp.primitives; 225 } 226 }); 227 228 // package-external:@wordpress/compose 229 var require_compose = __commonJS({ 230 "package-external:@wordpress/compose"(exports, module) { 231 module.exports = window.wp.compose; 232 } 233 }); 234 235 // package-external:@wordpress/theme 236 var require_theme = __commonJS({ 237 "package-external:@wordpress/theme"(exports, module) { 238 module.exports = window.wp.theme; 239 } 240 }); 241 242 // package-external:@wordpress/private-apis 243 var require_private_apis = __commonJS({ 244 "package-external:@wordpress/private-apis"(exports, module) { 245 module.exports = window.wp.privateApis; 246 } 247 }); 248 249 // package-external:@wordpress/components 250 var require_components = __commonJS({ 251 "package-external:@wordpress/components"(exports, module) { 252 module.exports = window.wp.components; 253 } 254 }); 255 256 // package-external:@wordpress/data 257 var require_data = __commonJS({ 258 "package-external:@wordpress/data"(exports, module) { 259 module.exports = window.wp.data; 260 } 261 }); 262 263 // package-external:@wordpress/notices 264 var require_notices = __commonJS({ 265 "package-external:@wordpress/notices"(exports, module) { 266 module.exports = window.wp.notices; 267 } 268 }); 269 270 // package-external:@wordpress/viewport 271 var require_viewport = __commonJS({ 272 "package-external:@wordpress/viewport"(exports, module) { 273 module.exports = window.wp.viewport; 274 } 275 }); 276 277 // package-external:@wordpress/api-fetch 278 var require_api_fetch = __commonJS({ 279 "package-external:@wordpress/api-fetch"(exports, module) { 280 module.exports = window.wp.apiFetch; 281 } 282 }); 283 284 // package-external:@wordpress/preferences 285 var require_preferences = __commonJS({ 286 "package-external:@wordpress/preferences"(exports, module) { 287 module.exports = window.wp.preferences; 288 } 289 }); 290 291 // node_modules/fast-deep-equal/es6/index.js 292 var require_es6 = __commonJS({ 293 "node_modules/fast-deep-equal/es6/index.js"(exports, module) { 294 "use strict"; 295 module.exports = function equal(a2, b2) { 296 if (a2 === b2) return true; 297 if (a2 && b2 && typeof a2 == "object" && typeof b2 == "object") { 298 if (a2.constructor !== b2.constructor) return false; 299 var length, i2, keys; 300 if (Array.isArray(a2)) { 301 length = a2.length; 302 if (length != b2.length) return false; 303 for (i2 = length; i2-- !== 0; ) 304 if (!equal(a2[i2], b2[i2])) return false; 305 return true; 306 } 307 if (a2 instanceof Map && b2 instanceof Map) { 308 if (a2.size !== b2.size) return false; 309 for (i2 of a2.entries()) 310 if (!b2.has(i2[0])) return false; 311 for (i2 of a2.entries()) 312 if (!equal(i2[1], b2.get(i2[0]))) return false; 313 return true; 314 } 315 if (a2 instanceof Set && b2 instanceof Set) { 316 if (a2.size !== b2.size) return false; 317 for (i2 of a2.entries()) 318 if (!b2.has(i2[0])) return false; 319 return true; 320 } 321 if (ArrayBuffer.isView(a2) && ArrayBuffer.isView(b2)) { 322 length = a2.length; 323 if (length != b2.length) return false; 324 for (i2 = length; i2-- !== 0; ) 325 if (a2[i2] !== b2[i2]) return false; 326 return true; 327 } 328 if (a2.constructor === RegExp) return a2.source === b2.source && a2.flags === b2.flags; 329 if (a2.valueOf !== Object.prototype.valueOf) return a2.valueOf() === b2.valueOf(); 330 if (a2.toString !== Object.prototype.toString) return a2.toString() === b2.toString(); 331 keys = Object.keys(a2); 332 length = keys.length; 333 if (length !== Object.keys(b2).length) return false; 334 for (i2 = length; i2-- !== 0; ) 335 if (!Object.prototype.hasOwnProperty.call(b2, keys[i2])) return false; 336 for (i2 = length; i2-- !== 0; ) { 337 var key2 = keys[i2]; 338 if (!equal(a2[key2], b2[key2])) return false; 339 } 340 return true; 341 } 342 return a2 !== a2 && b2 !== b2; 343 }; 344 } 345 }); 346 347 // package-external:@wordpress/keycodes 348 var require_keycodes = __commonJS({ 349 "package-external:@wordpress/keycodes"(exports, module) { 350 module.exports = window.wp.keycodes; 351 } 352 }); 353 354 // node_modules/remove-accents/index.js 355 var require_remove_accents = __commonJS({ 356 "node_modules/remove-accents/index.js"(exports, module) { 357 var characterMap = { 358 "\xC0": "A", 359 "\xC1": "A", 360 "\xC2": "A", 361 "\xC3": "A", 362 "\xC4": "A", 363 "\xC5": "A", 364 "\u1EA4": "A", 365 "\u1EAE": "A", 366 "\u1EB2": "A", 367 "\u1EB4": "A", 368 "\u1EB6": "A", 369 "\xC6": "AE", 370 "\u1EA6": "A", 371 "\u1EB0": "A", 372 "\u0202": "A", 373 "\u1EA2": "A", 374 "\u1EA0": "A", 375 "\u1EA8": "A", 376 "\u1EAA": "A", 377 "\u1EAC": "A", 378 "\xC7": "C", 379 "\u1E08": "C", 380 "\xC8": "E", 381 "\xC9": "E", 382 "\xCA": "E", 383 "\xCB": "E", 384 "\u1EBE": "E", 385 "\u1E16": "E", 386 "\u1EC0": "E", 387 "\u1E14": "E", 388 "\u1E1C": "E", 389 "\u0206": "E", 390 "\u1EBA": "E", 391 "\u1EBC": "E", 392 "\u1EB8": "E", 393 "\u1EC2": "E", 394 "\u1EC4": "E", 395 "\u1EC6": "E", 396 "\xCC": "I", 397 "\xCD": "I", 398 "\xCE": "I", 399 "\xCF": "I", 400 "\u1E2E": "I", 401 "\u020A": "I", 402 "\u1EC8": "I", 403 "\u1ECA": "I", 404 "\xD0": "D", 405 "\xD1": "N", 406 "\xD2": "O", 407 "\xD3": "O", 408 "\xD4": "O", 409 "\xD5": "O", 410 "\xD6": "O", 411 "\xD8": "O", 412 "\u1ED0": "O", 413 "\u1E4C": "O", 414 "\u1E52": "O", 415 "\u020E": "O", 416 "\u1ECE": "O", 417 "\u1ECC": "O", 418 "\u1ED4": "O", 419 "\u1ED6": "O", 420 "\u1ED8": "O", 421 "\u1EDC": "O", 422 "\u1EDE": "O", 423 "\u1EE0": "O", 424 "\u1EDA": "O", 425 "\u1EE2": "O", 426 "\xD9": "U", 427 "\xDA": "U", 428 "\xDB": "U", 429 "\xDC": "U", 430 "\u1EE6": "U", 431 "\u1EE4": "U", 432 "\u1EEC": "U", 433 "\u1EEE": "U", 434 "\u1EF0": "U", 435 "\xDD": "Y", 436 "\xE0": "a", 437 "\xE1": "a", 438 "\xE2": "a", 439 "\xE3": "a", 440 "\xE4": "a", 441 "\xE5": "a", 442 "\u1EA5": "a", 443 "\u1EAF": "a", 444 "\u1EB3": "a", 445 "\u1EB5": "a", 446 "\u1EB7": "a", 447 "\xE6": "ae", 448 "\u1EA7": "a", 449 "\u1EB1": "a", 450 "\u0203": "a", 451 "\u1EA3": "a", 452 "\u1EA1": "a", 453 "\u1EA9": "a", 454 "\u1EAB": "a", 455 "\u1EAD": "a", 456 "\xE7": "c", 457 "\u1E09": "c", 458 "\xE8": "e", 459 "\xE9": "e", 460 "\xEA": "e", 461 "\xEB": "e", 462 "\u1EBF": "e", 463 "\u1E17": "e", 464 "\u1EC1": "e", 465 "\u1E15": "e", 466 "\u1E1D": "e", 467 "\u0207": "e", 468 "\u1EBB": "e", 469 "\u1EBD": "e", 470 "\u1EB9": "e", 471 "\u1EC3": "e", 472 "\u1EC5": "e", 473 "\u1EC7": "e", 474 "\xEC": "i", 475 "\xED": "i", 476 "\xEE": "i", 477 "\xEF": "i", 478 "\u1E2F": "i", 479 "\u020B": "i", 480 "\u1EC9": "i", 481 "\u1ECB": "i", 482 "\xF0": "d", 483 "\xF1": "n", 484 "\xF2": "o", 485 "\xF3": "o", 486 "\xF4": "o", 487 "\xF5": "o", 488 "\xF6": "o", 489 "\xF8": "o", 490 "\u1ED1": "o", 491 "\u1E4D": "o", 492 "\u1E53": "o", 493 "\u020F": "o", 494 "\u1ECF": "o", 495 "\u1ECD": "o", 496 "\u1ED5": "o", 497 "\u1ED7": "o", 498 "\u1ED9": "o", 499 "\u1EDD": "o", 500 "\u1EDF": "o", 501 "\u1EE1": "o", 502 "\u1EDB": "o", 503 "\u1EE3": "o", 504 "\xF9": "u", 505 "\xFA": "u", 506 "\xFB": "u", 507 "\xFC": "u", 508 "\u1EE7": "u", 509 "\u1EE5": "u", 510 "\u1EED": "u", 511 "\u1EEF": "u", 512 "\u1EF1": "u", 513 "\xFD": "y", 514 "\xFF": "y", 515 "\u0100": "A", 516 "\u0101": "a", 517 "\u0102": "A", 518 "\u0103": "a", 519 "\u0104": "A", 520 "\u0105": "a", 521 "\u0106": "C", 522 "\u0107": "c", 523 "\u0108": "C", 524 "\u0109": "c", 525 "\u010A": "C", 526 "\u010B": "c", 527 "\u010C": "C", 528 "\u010D": "c", 529 "C\u0306": "C", 530 "c\u0306": "c", 531 "\u010E": "D", 532 "\u010F": "d", 533 "\u0110": "D", 534 "\u0111": "d", 535 "\u0112": "E", 536 "\u0113": "e", 537 "\u0114": "E", 538 "\u0115": "e", 539 "\u0116": "E", 540 "\u0117": "e", 541 "\u0118": "E", 542 "\u0119": "e", 543 "\u011A": "E", 544 "\u011B": "e", 545 "\u011C": "G", 546 "\u01F4": "G", 547 "\u011D": "g", 548 "\u01F5": "g", 549 "\u011E": "G", 550 "\u011F": "g", 551 "\u0120": "G", 552 "\u0121": "g", 553 "\u0122": "G", 554 "\u0123": "g", 555 "\u0124": "H", 556 "\u0125": "h", 557 "\u0126": "H", 558 "\u0127": "h", 559 "\u1E2A": "H", 560 "\u1E2B": "h", 561 "\u0128": "I", 562 "\u0129": "i", 563 "\u012A": "I", 564 "\u012B": "i", 565 "\u012C": "I", 566 "\u012D": "i", 567 "\u012E": "I", 568 "\u012F": "i", 569 "\u0130": "I", 570 "\u0131": "i", 571 "\u0132": "IJ", 572 "\u0133": "ij", 573 "\u0134": "J", 574 "\u0135": "j", 575 "\u0136": "K", 576 "\u0137": "k", 577 "\u1E30": "K", 578 "\u1E31": "k", 579 "K\u0306": "K", 580 "k\u0306": "k", 581 "\u0139": "L", 582 "\u013A": "l", 583 "\u013B": "L", 584 "\u013C": "l", 585 "\u013D": "L", 586 "\u013E": "l", 587 "\u013F": "L", 588 "\u0140": "l", 589 "\u0141": "l", 590 "\u0142": "l", 591 "\u1E3E": "M", 592 "\u1E3F": "m", 593 "M\u0306": "M", 594 "m\u0306": "m", 595 "\u0143": "N", 596 "\u0144": "n", 597 "\u0145": "N", 598 "\u0146": "n", 599 "\u0147": "N", 600 "\u0148": "n", 601 "\u0149": "n", 602 "N\u0306": "N", 603 "n\u0306": "n", 604 "\u014C": "O", 605 "\u014D": "o", 606 "\u014E": "O", 607 "\u014F": "o", 608 "\u0150": "O", 609 "\u0151": "o", 610 "\u0152": "OE", 611 "\u0153": "oe", 612 "P\u0306": "P", 613 "p\u0306": "p", 614 "\u0154": "R", 615 "\u0155": "r", 616 "\u0156": "R", 617 "\u0157": "r", 618 "\u0158": "R", 619 "\u0159": "r", 620 "R\u0306": "R", 621 "r\u0306": "r", 622 "\u0212": "R", 623 "\u0213": "r", 624 "\u015A": "S", 625 "\u015B": "s", 626 "\u015C": "S", 627 "\u015D": "s", 628 "\u015E": "S", 629 "\u0218": "S", 630 "\u0219": "s", 631 "\u015F": "s", 632 "\u0160": "S", 633 "\u0161": "s", 634 "\u0162": "T", 635 "\u0163": "t", 636 "\u021B": "t", 637 "\u021A": "T", 638 "\u0164": "T", 639 "\u0165": "t", 640 "\u0166": "T", 641 "\u0167": "t", 642 "T\u0306": "T", 643 "t\u0306": "t", 644 "\u0168": "U", 645 "\u0169": "u", 646 "\u016A": "U", 647 "\u016B": "u", 648 "\u016C": "U", 649 "\u016D": "u", 650 "\u016E": "U", 651 "\u016F": "u", 652 "\u0170": "U", 653 "\u0171": "u", 654 "\u0172": "U", 655 "\u0173": "u", 656 "\u0216": "U", 657 "\u0217": "u", 658 "V\u0306": "V", 659 "v\u0306": "v", 660 "\u0174": "W", 661 "\u0175": "w", 662 "\u1E82": "W", 663 "\u1E83": "w", 664 "X\u0306": "X", 665 "x\u0306": "x", 666 "\u0176": "Y", 667 "\u0177": "y", 668 "\u0178": "Y", 669 "Y\u0306": "Y", 670 "y\u0306": "y", 671 "\u0179": "Z", 672 "\u017A": "z", 673 "\u017B": "Z", 674 "\u017C": "z", 675 "\u017D": "Z", 676 "\u017E": "z", 677 "\u017F": "s", 678 "\u0192": "f", 679 "\u01A0": "O", 680 "\u01A1": "o", 681 "\u01AF": "U", 682 "\u01B0": "u", 683 "\u01CD": "A", 684 "\u01CE": "a", 685 "\u01CF": "I", 686 "\u01D0": "i", 687 "\u01D1": "O", 688 "\u01D2": "o", 689 "\u01D3": "U", 690 "\u01D4": "u", 691 "\u01D5": "U", 692 "\u01D6": "u", 693 "\u01D7": "U", 694 "\u01D8": "u", 695 "\u01D9": "U", 696 "\u01DA": "u", 697 "\u01DB": "U", 698 "\u01DC": "u", 699 "\u1EE8": "U", 700 "\u1EE9": "u", 701 "\u1E78": "U", 702 "\u1E79": "u", 703 "\u01FA": "A", 704 "\u01FB": "a", 705 "\u01FC": "AE", 706 "\u01FD": "ae", 707 "\u01FE": "O", 708 "\u01FF": "o", 709 "\xDE": "TH", 710 "\xFE": "th", 711 "\u1E54": "P", 712 "\u1E55": "p", 713 "\u1E64": "S", 714 "\u1E65": "s", 715 "X\u0301": "X", 716 "x\u0301": "x", 717 "\u0403": "\u0413", 718 "\u0453": "\u0433", 719 "\u040C": "\u041A", 720 "\u045C": "\u043A", 721 "A\u030B": "A", 722 "a\u030B": "a", 723 "E\u030B": "E", 724 "e\u030B": "e", 725 "I\u030B": "I", 726 "i\u030B": "i", 727 "\u01F8": "N", 728 "\u01F9": "n", 729 "\u1ED2": "O", 730 "\u1ED3": "o", 731 "\u1E50": "O", 732 "\u1E51": "o", 733 "\u1EEA": "U", 734 "\u1EEB": "u", 735 "\u1E80": "W", 736 "\u1E81": "w", 737 "\u1EF2": "Y", 738 "\u1EF3": "y", 739 "\u0200": "A", 740 "\u0201": "a", 741 "\u0204": "E", 742 "\u0205": "e", 743 "\u0208": "I", 744 "\u0209": "i", 745 "\u020C": "O", 746 "\u020D": "o", 747 "\u0210": "R", 748 "\u0211": "r", 749 "\u0214": "U", 750 "\u0215": "u", 751 "B\u030C": "B", 752 "b\u030C": "b", 753 "\u010C\u0323": "C", 754 "\u010D\u0323": "c", 755 "\xCA\u030C": "E", 756 "\xEA\u030C": "e", 757 "F\u030C": "F", 758 "f\u030C": "f", 759 "\u01E6": "G", 760 "\u01E7": "g", 761 "\u021E": "H", 762 "\u021F": "h", 763 "J\u030C": "J", 764 "\u01F0": "j", 765 "\u01E8": "K", 766 "\u01E9": "k", 767 "M\u030C": "M", 768 "m\u030C": "m", 769 "P\u030C": "P", 770 "p\u030C": "p", 771 "Q\u030C": "Q", 772 "q\u030C": "q", 773 "\u0158\u0329": "R", 774 "\u0159\u0329": "r", 775 "\u1E66": "S", 776 "\u1E67": "s", 777 "V\u030C": "V", 778 "v\u030C": "v", 779 "W\u030C": "W", 780 "w\u030C": "w", 781 "X\u030C": "X", 782 "x\u030C": "x", 783 "Y\u030C": "Y", 784 "y\u030C": "y", 785 "A\u0327": "A", 786 "a\u0327": "a", 787 "B\u0327": "B", 788 "b\u0327": "b", 789 "\u1E10": "D", 790 "\u1E11": "d", 791 "\u0228": "E", 792 "\u0229": "e", 793 "\u0190\u0327": "E", 794 "\u025B\u0327": "e", 795 "\u1E28": "H", 796 "\u1E29": "h", 797 "I\u0327": "I", 798 "i\u0327": "i", 799 "\u0197\u0327": "I", 800 "\u0268\u0327": "i", 801 "M\u0327": "M", 802 "m\u0327": "m", 803 "O\u0327": "O", 804 "o\u0327": "o", 805 "Q\u0327": "Q", 806 "q\u0327": "q", 807 "U\u0327": "U", 808 "u\u0327": "u", 809 "X\u0327": "X", 810 "x\u0327": "x", 811 "Z\u0327": "Z", 812 "z\u0327": "z", 813 "\u0439": "\u0438", 814 "\u0419": "\u0418", 815 "\u0451": "\u0435", 816 "\u0401": "\u0415" 817 }; 818 var chars = Object.keys(characterMap).join("|"); 819 var allAccents = new RegExp(chars, "g"); 820 var firstAccent = new RegExp(chars, ""); 821 function matcher(match2) { 822 return characterMap[match2]; 823 } 824 var removeAccents3 = function(string) { 825 return string.replace(allAccents, matcher); 826 }; 827 var hasAccents = function(string) { 828 return !!string.match(firstAccent); 829 }; 830 module.exports = removeAccents3; 831 module.exports.has = hasAccents; 832 module.exports.remove = removeAccents3; 833 } 834 }); 835 836 // package-external:@wordpress/date 837 var require_date = __commonJS({ 838 "package-external:@wordpress/date"(exports, module) { 839 module.exports = window.wp.date; 840 } 841 }); 842 843 // package-external:@wordpress/warning 844 var require_warning = __commonJS({ 845 "package-external:@wordpress/warning"(exports, module) { 846 module.exports = window.wp.warning; 847 } 848 }); 849 850 // node_modules/deepmerge/dist/cjs.js 851 var require_cjs = __commonJS({ 852 "node_modules/deepmerge/dist/cjs.js"(exports, module) { 853 "use strict"; 854 var isMergeableObject = function isMergeableObject2(value) { 855 return isNonNullObject(value) && !isSpecial(value); 856 }; 857 function isNonNullObject(value) { 858 return !!value && typeof value === "object"; 859 } 860 function isSpecial(value) { 861 var stringValue = Object.prototype.toString.call(value); 862 return stringValue === "[object RegExp]" || stringValue === "[object Date]" || isReactElement(value); 863 } 864 var canUseSymbol = typeof Symbol === "function" && Symbol.for; 865 var REACT_ELEMENT_TYPE = canUseSymbol ? /* @__PURE__ */ Symbol.for("react.element") : 60103; 866 function isReactElement(value) { 867 return value.$$typeof === REACT_ELEMENT_TYPE; 868 } 869 function emptyTarget(val) { 870 return Array.isArray(val) ? [] : {}; 871 } 872 function cloneUnlessOtherwiseSpecified(value, options) { 873 return options.clone !== false && options.isMergeableObject(value) ? deepmerge(emptyTarget(value), value, options) : value; 874 } 875 function defaultArrayMerge(target, source, options) { 876 return target.concat(source).map(function(element) { 877 return cloneUnlessOtherwiseSpecified(element, options); 878 }); 879 } 880 function getMergeFunction(key2, options) { 881 if (!options.customMerge) { 882 return deepmerge; 883 } 884 var customMerge = options.customMerge(key2); 885 return typeof customMerge === "function" ? customMerge : deepmerge; 886 } 887 function getEnumerableOwnPropertySymbols(target) { 888 return Object.getOwnPropertySymbols ? Object.getOwnPropertySymbols(target).filter(function(symbol3) { 889 return Object.propertyIsEnumerable.call(target, symbol3); 890 }) : []; 891 } 892 function getKeys2(target) { 893 return Object.keys(target).concat(getEnumerableOwnPropertySymbols(target)); 894 } 895 function propertyIsOnObject(object, property) { 896 try { 897 return property in object; 898 } catch (_) { 899 return false; 900 } 901 } 902 function propertyIsUnsafe(target, key2) { 903 return propertyIsOnObject(target, key2) && !(Object.hasOwnProperty.call(target, key2) && Object.propertyIsEnumerable.call(target, key2)); 904 } 905 function mergeObject(target, source, options) { 906 var destination = {}; 907 if (options.isMergeableObject(target)) { 908 getKeys2(target).forEach(function(key2) { 909 destination[key2] = cloneUnlessOtherwiseSpecified(target[key2], options); 910 }); 911 } 912 getKeys2(source).forEach(function(key2) { 913 if (propertyIsUnsafe(target, key2)) { 914 return; 915 } 916 if (propertyIsOnObject(target, key2) && options.isMergeableObject(source[key2])) { 917 destination[key2] = getMergeFunction(key2, options)(target[key2], source[key2], options); 918 } else { 919 destination[key2] = cloneUnlessOtherwiseSpecified(source[key2], options); 920 } 921 }); 922 return destination; 923 } 924 function deepmerge(target, source, options) { 925 options = options || {}; 926 options.arrayMerge = options.arrayMerge || defaultArrayMerge; 927 options.isMergeableObject = options.isMergeableObject || isMergeableObject; 928 options.cloneUnlessOtherwiseSpecified = cloneUnlessOtherwiseSpecified; 929 var sourceIsArray = Array.isArray(source); 930 var targetIsArray = Array.isArray(target); 931 var sourceAndTargetTypesMatch = sourceIsArray === targetIsArray; 932 if (!sourceAndTargetTypesMatch) { 933 return cloneUnlessOtherwiseSpecified(source, options); 934 } else if (sourceIsArray) { 935 return options.arrayMerge(target, source, options); 936 } else { 937 return mergeObject(target, source, options); 938 } 939 } 940 deepmerge.all = function deepmergeAll(array, options) { 941 if (!Array.isArray(array)) { 942 throw new Error("first argument should be an array"); 943 } 944 return array.reduce(function(prev, next) { 945 return deepmerge(prev, next, options); 946 }, {}); 947 }; 948 var deepmerge_1 = deepmerge; 949 module.exports = deepmerge_1; 950 } 951 }); 952 953 // package-external:@wordpress/deprecated 954 var require_deprecated = __commonJS({ 955 "package-external:@wordpress/deprecated"(exports, module) { 956 module.exports = window.wp.deprecated; 957 } 958 }); 959 960 // package-external:@wordpress/commands 961 var require_commands = __commonJS({ 962 "package-external:@wordpress/commands"(exports, module) { 963 module.exports = window.wp.commands; 964 } 965 }); 966 967 // package-external:@wordpress/core-data 968 var require_core_data = __commonJS({ 969 "package-external:@wordpress/core-data"(exports, module) { 970 module.exports = window.wp.coreData; 971 } 972 }); 973 974 // node_modules/clsx/dist/clsx.mjs 975 function r(e2) { 976 var t2, f2, n2 = ""; 977 if ("string" == typeof e2 || "number" == typeof e2) n2 += e2; 978 else if ("object" == typeof e2) if (Array.isArray(e2)) { 979 var o2 = e2.length; 980 for (t2 = 0; t2 < o2; t2++) e2[t2] && (f2 = r(e2[t2])) && (n2 && (n2 += " "), n2 += f2); 981 } else for (f2 in e2) e2[f2] && (n2 && (n2 += " "), n2 += f2); 982 return n2; 983 } 984 function clsx() { 985 for (var e2, t2, f2 = 0, n2 = "", o2 = arguments.length; f2 < o2; f2++) (e2 = arguments[f2]) && (t2 = r(e2)) && (n2 && (n2 += " "), n2 += t2); 986 return n2; 987 } 988 var clsx_default = clsx; 989 990 // packages/ui/build-module/badge/badge.mjs 991 var import_element12 = __toESM(require_element(), 1); 992 993 // node_modules/@base-ui/utils/esm/useControlled.js 994 var React = __toESM(require_react(), 1); 995 996 // node_modules/@base-ui/utils/esm/error.js 997 var set; 998 if (true) { 999 set = /* @__PURE__ */ new Set(); 1000 } 1001 function error(...messages) { 1002 if (true) { 1003 const messageKey = messages.join(" "); 1004 if (!set.has(messageKey)) { 1005 set.add(messageKey); 1006 console.error(`Base UI: $messageKey}`); 1007 } 1008 } 1009 } 1010 1011 // node_modules/@base-ui/utils/esm/useControlled.js 1012 function useControlled({ 1013 controlled, 1014 default: defaultProp, 1015 name, 1016 state = "value" 1017 }) { 1018 const { 1019 current: isControlled 1020 } = React.useRef(controlled !== void 0); 1021 const [valueState, setValue] = React.useState(defaultProp); 1022 const value = isControlled ? controlled : valueState; 1023 if (true) { 1024 React.useEffect(() => { 1025 if (isControlled !== (controlled !== void 0)) { 1026 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")); 1027 } 1028 }, [state, name, controlled]); 1029 const { 1030 current: defaultValue3 1031 } = React.useRef(defaultProp); 1032 React.useEffect(() => { 1033 if (!isControlled && serializeToDevModeString(defaultValue3) !== serializeToDevModeString(defaultProp)) { 1034 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")); 1035 } 1036 }, [defaultProp]); 1037 } 1038 const setValueIfUncontrolled = React.useCallback((newValue) => { 1039 if (!isControlled) { 1040 setValue(newValue); 1041 } 1042 }, []); 1043 return [value, setValueIfUncontrolled]; 1044 } 1045 function serializeToDevModeString(input) { 1046 let nextId = 0; 1047 const seen = /* @__PURE__ */ new WeakMap(); 1048 try { 1049 const result = JSON.stringify(input, function replacer(key2, value) { 1050 if (key2 === "_owner" && this != null && typeof this === "object" && "$$typeof" in this) { 1051 return void 0; 1052 } 1053 if (typeof value === "bigint") { 1054 return `__bigint__:$value}`; 1055 } 1056 if (value !== null && typeof value === "object") { 1057 const id = seen.get(value); 1058 if (id !== void 0) { 1059 return `__object__:$id}`; 1060 } 1061 seen.set(value, nextId); 1062 nextId += 1; 1063 } 1064 return value; 1065 }); 1066 return result ?? `__top__:$typeof input}`; 1067 } catch { 1068 return "__unserializable__"; 1069 } 1070 } 1071 1072 // node_modules/@base-ui/utils/esm/useStableCallback.js 1073 var React3 = __toESM(require_react(), 1); 1074 1075 // node_modules/@base-ui/utils/esm/useRefWithInit.js 1076 var React2 = __toESM(require_react(), 1); 1077 var UNINITIALIZED = {}; 1078 function useRefWithInit(init2, initArg) { 1079 const ref = React2.useRef(UNINITIALIZED); 1080 if (ref.current === UNINITIALIZED) { 1081 ref.current = init2(initArg); 1082 } 1083 return ref; 1084 } 1085 1086 // node_modules/@base-ui/utils/esm/useStableCallback.js 1087 var useInsertionEffect = React3[`useInsertionEffect$Math.random().toFixed(1)}`.slice(0, -3)]; 1088 var useSafeInsertionEffect = ( 1089 // React 17 doesn't have useInsertionEffect. 1090 useInsertionEffect && // Preact replaces useInsertionEffect with useLayoutEffect and fires too late. 1091 useInsertionEffect !== React3.useLayoutEffect ? useInsertionEffect : (fn) => fn() 1092 ); 1093 function useStableCallback(callback) { 1094 const stable = useRefWithInit(createStableCallback).current; 1095 stable.next = callback; 1096 useSafeInsertionEffect(stable.effect); 1097 return stable.trampoline; 1098 } 1099 function createStableCallback() { 1100 const stable = { 1101 next: void 0, 1102 callback: assertNotCalled, 1103 trampoline: (...args) => stable.callback?.(...args), 1104 effect: () => { 1105 stable.callback = stable.next; 1106 } 1107 }; 1108 return stable; 1109 } 1110 function assertNotCalled() { 1111 if (true) { 1112 throw ( 1113 /* minify-error-disabled */ 1114 new Error("Base UI: Cannot call an event handler while rendering.") 1115 ); 1116 } 1117 } 1118 1119 // node_modules/@base-ui/utils/esm/useIsoLayoutEffect.js 1120 var React4 = __toESM(require_react(), 1); 1121 var noop = () => { 1122 }; 1123 var useIsoLayoutEffect = typeof document !== "undefined" ? React4.useLayoutEffect : noop; 1124 1125 // node_modules/@base-ui/utils/esm/warn.js 1126 var set2; 1127 if (true) { 1128 set2 = /* @__PURE__ */ new Set(); 1129 } 1130 function warn(...messages) { 1131 if (true) { 1132 const messageKey = messages.join(" "); 1133 if (!set2.has(messageKey)) { 1134 set2.add(messageKey); 1135 console.warn(`Base UI: $messageKey}`); 1136 } 1137 } 1138 } 1139 1140 // node_modules/@base-ui/react/esm/internals/direction-context/DirectionContext.js 1141 var React5 = __toESM(require_react(), 1); 1142 var DirectionContext = /* @__PURE__ */ React5.createContext(void 0); 1143 if (true) DirectionContext.displayName = "DirectionContext"; 1144 function useDirection() { 1145 const context = React5.useContext(DirectionContext); 1146 return context?.direction ?? "ltr"; 1147 } 1148 1149 // node_modules/@base-ui/react/esm/internals/useRenderElement.js 1150 var React8 = __toESM(require_react(), 1); 1151 1152 // node_modules/@base-ui/utils/esm/useMergedRefs.js 1153 function useMergedRefs(a2, b2, c2, d2) { 1154 const forkRef = useRefWithInit(createForkRef).current; 1155 if (didChange(forkRef, a2, b2, c2, d2)) { 1156 update(forkRef, [a2, b2, c2, d2]); 1157 } 1158 return forkRef.callback; 1159 } 1160 function useMergedRefsN(refs) { 1161 const forkRef = useRefWithInit(createForkRef).current; 1162 if (didChangeN(forkRef, refs)) { 1163 update(forkRef, refs); 1164 } 1165 return forkRef.callback; 1166 } 1167 function createForkRef() { 1168 return { 1169 callback: null, 1170 cleanup: null, 1171 refs: [] 1172 }; 1173 } 1174 function didChange(forkRef, a2, b2, c2, d2) { 1175 return forkRef.refs[0] !== a2 || forkRef.refs[1] !== b2 || forkRef.refs[2] !== c2 || forkRef.refs[3] !== d2; 1176 } 1177 function didChangeN(forkRef, newRefs) { 1178 return forkRef.refs.length !== newRefs.length || forkRef.refs.some((ref, index2) => ref !== newRefs[index2]); 1179 } 1180 function update(forkRef, refs) { 1181 forkRef.refs = refs; 1182 if (refs.every((ref) => ref == null)) { 1183 forkRef.callback = null; 1184 return; 1185 } 1186 forkRef.callback = (instance) => { 1187 if (forkRef.cleanup) { 1188 forkRef.cleanup(); 1189 forkRef.cleanup = null; 1190 } 1191 if (instance != null) { 1192 const cleanupCallbacks = Array(refs.length).fill(null); 1193 for (let i2 = 0; i2 < refs.length; i2 += 1) { 1194 const ref = refs[i2]; 1195 if (ref == null) { 1196 continue; 1197 } 1198 switch (typeof ref) { 1199 case "function": { 1200 const refCleanup = ref(instance); 1201 if (typeof refCleanup === "function") { 1202 cleanupCallbacks[i2] = refCleanup; 1203 } 1204 break; 1205 } 1206 case "object": { 1207 ref.current = instance; 1208 break; 1209 } 1210 default: 1211 } 1212 } 1213 forkRef.cleanup = () => { 1214 for (let i2 = 0; i2 < refs.length; i2 += 1) { 1215 const ref = refs[i2]; 1216 if (ref == null) { 1217 continue; 1218 } 1219 switch (typeof ref) { 1220 case "function": { 1221 const cleanupCallback = cleanupCallbacks[i2]; 1222 if (typeof cleanupCallback === "function") { 1223 cleanupCallback(); 1224 } else { 1225 ref(null); 1226 } 1227 break; 1228 } 1229 case "object": { 1230 ref.current = null; 1231 break; 1232 } 1233 default: 1234 } 1235 } 1236 }; 1237 } 1238 }; 1239 } 1240 1241 // node_modules/@base-ui/utils/esm/getReactElementRef.js 1242 var React7 = __toESM(require_react(), 1); 1243 1244 // node_modules/@base-ui/utils/esm/reactVersion.js 1245 var React6 = __toESM(require_react(), 1); 1246 var majorVersion = parseInt(React6.version, 10); 1247 function isReactVersionAtLeast(reactVersionToCheck) { 1248 return majorVersion >= reactVersionToCheck; 1249 } 1250 1251 // node_modules/@base-ui/utils/esm/getReactElementRef.js 1252 function getReactElementRef(element) { 1253 if (!/* @__PURE__ */ React7.isValidElement(element)) { 1254 return null; 1255 } 1256 const reactElement = element; 1257 const propsWithRef = reactElement.props; 1258 return (isReactVersionAtLeast(19) ? propsWithRef?.ref : reactElement.ref) ?? null; 1259 } 1260 1261 // node_modules/@base-ui/utils/esm/mergeObjects.js 1262 function mergeObjects(a2, b2) { 1263 if (a2 && !b2) { 1264 return a2; 1265 } 1266 if (!a2 && b2) { 1267 return b2; 1268 } 1269 if (a2 || b2) { 1270 return { 1271 ...a2, 1272 ...b2 1273 }; 1274 } 1275 return void 0; 1276 } 1277 1278 // node_modules/@base-ui/utils/esm/empty.js 1279 function NOOP() { 1280 } 1281 var EMPTY_ARRAY = Object.freeze([]); 1282 var EMPTY_OBJECT = Object.freeze({}); 1283 1284 // node_modules/@base-ui/react/esm/internals/getStateAttributesProps.js 1285 function getStateAttributesProps(state, customMapping) { 1286 const props = {}; 1287 for (const key2 in state) { 1288 const value = state[key2]; 1289 if (customMapping?.hasOwnProperty(key2)) { 1290 const customProps = customMapping[key2](value); 1291 if (customProps != null) { 1292 Object.assign(props, customProps); 1293 } 1294 continue; 1295 } 1296 if (value === true) { 1297 props[`data-$key2.toLowerCase()}`] = ""; 1298 } else if (value) { 1299 props[`data-$key2.toLowerCase()}`] = value.toString(); 1300 } 1301 } 1302 return props; 1303 } 1304 1305 // node_modules/@base-ui/react/esm/utils/resolveClassName.js 1306 function resolveClassName(className, state) { 1307 return typeof className === "function" ? className(state) : className; 1308 } 1309 1310 // node_modules/@base-ui/react/esm/utils/resolveStyle.js 1311 function resolveStyle(style, state) { 1312 return typeof style === "function" ? style(state) : style; 1313 } 1314 1315 // node_modules/@base-ui/react/esm/merge-props/mergeProps.js 1316 var EMPTY_PROPS = {}; 1317 function mergeProps(a2, b2, c2, d2, e2) { 1318 if (!c2 && !d2 && !e2 && !a2) { 1319 return createInitialMergedProps(b2); 1320 } 1321 let merged = createInitialMergedProps(a2); 1322 if (b2) { 1323 merged = mergeInto(merged, b2); 1324 } 1325 if (c2) { 1326 merged = mergeInto(merged, c2); 1327 } 1328 if (d2) { 1329 merged = mergeInto(merged, d2); 1330 } 1331 if (e2) { 1332 merged = mergeInto(merged, e2); 1333 } 1334 return merged; 1335 } 1336 function mergePropsN(props) { 1337 if (props.length === 0) { 1338 return EMPTY_PROPS; 1339 } 1340 if (props.length === 1) { 1341 return createInitialMergedProps(props[0]); 1342 } 1343 let merged = createInitialMergedProps(props[0]); 1344 for (let i2 = 1; i2 < props.length; i2 += 1) { 1345 merged = mergeInto(merged, props[i2]); 1346 } 1347 return merged; 1348 } 1349 function createInitialMergedProps(inputProps) { 1350 if (isPropsGetter(inputProps)) { 1351 return { 1352 ...resolvePropsGetter(inputProps, EMPTY_PROPS) 1353 }; 1354 } 1355 return copyInitialProps(inputProps); 1356 } 1357 function mergeInto(merged, inputProps) { 1358 if (isPropsGetter(inputProps)) { 1359 return resolvePropsGetter(inputProps, merged); 1360 } 1361 return mutablyMergeInto(merged, inputProps); 1362 } 1363 function copyInitialProps(inputProps) { 1364 const copiedProps = { 1365 ...inputProps 1366 }; 1367 for (const propName in copiedProps) { 1368 const propValue = copiedProps[propName]; 1369 if (isEventHandler(propName, propValue)) { 1370 copiedProps[propName] = wrapEventHandler(propValue); 1371 } 1372 } 1373 return copiedProps; 1374 } 1375 function mutablyMergeInto(mergedProps, externalProps) { 1376 if (!externalProps) { 1377 return mergedProps; 1378 } 1379 for (const propName in externalProps) { 1380 const externalPropValue = externalProps[propName]; 1381 switch (propName) { 1382 case "style": { 1383 mergedProps[propName] = mergeObjects(mergedProps.style, externalPropValue); 1384 break; 1385 } 1386 case "className": { 1387 mergedProps[propName] = mergeClassNames(mergedProps.className, externalPropValue); 1388 break; 1389 } 1390 default: { 1391 if (isEventHandler(propName, externalPropValue)) { 1392 mergedProps[propName] = mergeEventHandlers(mergedProps[propName], externalPropValue); 1393 } else { 1394 mergedProps[propName] = externalPropValue; 1395 } 1396 } 1397 } 1398 } 1399 return mergedProps; 1400 } 1401 function isEventHandler(key2, value) { 1402 const code0 = key2.charCodeAt(0); 1403 const code1 = key2.charCodeAt(1); 1404 const code2 = key2.charCodeAt(2); 1405 return code0 === 111 && code1 === 110 && code2 >= 65 && code2 <= 90 && (typeof value === "function" || typeof value === "undefined"); 1406 } 1407 function isPropsGetter(inputProps) { 1408 return typeof inputProps === "function"; 1409 } 1410 function resolvePropsGetter(inputProps, previousProps) { 1411 if (isPropsGetter(inputProps)) { 1412 return inputProps(previousProps); 1413 } 1414 return inputProps ?? EMPTY_PROPS; 1415 } 1416 function mergeEventHandlers(ourHandler, theirHandler) { 1417 if (!theirHandler) { 1418 return ourHandler; 1419 } 1420 if (!ourHandler) { 1421 return wrapEventHandler(theirHandler); 1422 } 1423 return (...args) => { 1424 const event = args[0]; 1425 if (isSyntheticEvent(event)) { 1426 const baseUIEvent = event; 1427 makeEventPreventable(baseUIEvent); 1428 const result2 = theirHandler(...args); 1429 if (!baseUIEvent.baseUIHandlerPrevented) { 1430 ourHandler?.(...args); 1431 } 1432 return result2; 1433 } 1434 const result = theirHandler(...args); 1435 ourHandler?.(...args); 1436 return result; 1437 }; 1438 } 1439 function wrapEventHandler(handler) { 1440 if (!handler) { 1441 return handler; 1442 } 1443 return (...args) => { 1444 const event = args[0]; 1445 if (isSyntheticEvent(event)) { 1446 makeEventPreventable(event); 1447 } 1448 return handler(...args); 1449 }; 1450 } 1451 function makeEventPreventable(event) { 1452 event.preventBaseUIHandler = () => { 1453 event.baseUIHandlerPrevented = true; 1454 }; 1455 return event; 1456 } 1457 function mergeClassNames(ourClassName, theirClassName) { 1458 if (theirClassName) { 1459 if (ourClassName) { 1460 return theirClassName + " " + ourClassName; 1461 } 1462 return theirClassName; 1463 } 1464 return ourClassName; 1465 } 1466 function isSyntheticEvent(event) { 1467 return event != null && typeof event === "object" && "nativeEvent" in event; 1468 } 1469 1470 // node_modules/@base-ui/react/esm/internals/useRenderElement.js 1471 var import_react = __toESM(require_react(), 1); 1472 function useRenderElement(element, componentProps, params = {}) { 1473 const renderProp = componentProps.render; 1474 const outProps = useRenderElementProps(componentProps, params); 1475 if (params.enabled === false) { 1476 return null; 1477 } 1478 const state = params.state ?? EMPTY_OBJECT; 1479 return evaluateRenderProp(element, renderProp, outProps, state); 1480 } 1481 function useRenderElementProps(componentProps, params = {}) { 1482 const { 1483 className: classNameProp, 1484 style: styleProp, 1485 render: renderProp 1486 } = componentProps; 1487 const { 1488 state = EMPTY_OBJECT, 1489 ref, 1490 props, 1491 stateAttributesMapping: stateAttributesMapping12, 1492 enabled = true 1493 } = params; 1494 const className = enabled ? resolveClassName(classNameProp, state) : void 0; 1495 const style = enabled ? resolveStyle(styleProp, state) : void 0; 1496 const stateProps = enabled ? getStateAttributesProps(state, stateAttributesMapping12) : EMPTY_OBJECT; 1497 const resolvedProps = enabled && props ? resolveRenderFunctionProps(props) : void 0; 1498 const outProps = enabled ? mergeObjects(stateProps, resolvedProps) ?? {} : EMPTY_OBJECT; 1499 if (typeof document !== "undefined") { 1500 if (!enabled) { 1501 useMergedRefs(null, null); 1502 } else if (Array.isArray(ref)) { 1503 outProps.ref = useMergedRefsN([outProps.ref, getReactElementRef(renderProp), ...ref]); 1504 } else { 1505 outProps.ref = useMergedRefs(outProps.ref, getReactElementRef(renderProp), ref); 1506 } 1507 } 1508 if (!enabled) { 1509 return EMPTY_OBJECT; 1510 } 1511 if (className !== void 0) { 1512 outProps.className = mergeClassNames(outProps.className, className); 1513 } 1514 if (style !== void 0) { 1515 outProps.style = mergeObjects(outProps.style, style); 1516 } 1517 return outProps; 1518 } 1519 function resolveRenderFunctionProps(props) { 1520 if (Array.isArray(props)) { 1521 return mergePropsN(props); 1522 } 1523 return mergeProps(void 0, props); 1524 } 1525 var REACT_LAZY_TYPE = /* @__PURE__ */ Symbol.for("react.lazy"); 1526 var COMPONENT_IDENTIFIER_PATTERN = /^[A-Z][A-Za-z0-9$]*$/; 1527 var LOWERCASE_CHARACTER_PATTERN = /[a-z]/; 1528 function evaluateRenderProp(element, render4, props, state) { 1529 if (render4) { 1530 if (typeof render4 === "function") { 1531 if (true) { 1532 warnIfRenderPropLooksLikeComponent(render4); 1533 } 1534 return render4(props, state); 1535 } 1536 const mergedProps = mergeProps(props, render4.props); 1537 mergedProps.ref = props.ref; 1538 let newElement = render4; 1539 if (newElement?.$$typeof === REACT_LAZY_TYPE) { 1540 const children = React8.Children.toArray(render4); 1541 newElement = children[0]; 1542 } 1543 if (true) { 1544 if (!/* @__PURE__ */ React8.isValidElement(newElement)) { 1545 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")); 1546 } 1547 } 1548 return /* @__PURE__ */ React8.cloneElement(newElement, mergedProps); 1549 } 1550 if (element) { 1551 if (typeof element === "string") { 1552 return renderTag(element, props); 1553 } 1554 } 1555 throw new Error(true ? "Base UI: Render element or function are not defined." : formatErrorMessage_default(8)); 1556 } 1557 function warnIfRenderPropLooksLikeComponent(renderFn) { 1558 const functionName = renderFn.name; 1559 if (functionName.length === 0) { 1560 return; 1561 } 1562 if (!COMPONENT_IDENTIFIER_PATTERN.test(functionName)) { 1563 return; 1564 } 1565 if (!LOWERCASE_CHARACTER_PATTERN.test(functionName)) { 1566 return; 1567 } 1568 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"); 1569 } 1570 function renderTag(Tag, props) { 1571 if (Tag === "button") { 1572 return /* @__PURE__ */ (0, import_react.createElement)("button", { 1573 type: "button", 1574 ...props, 1575 key: props.key 1576 }); 1577 } 1578 if (Tag === "img") { 1579 return /* @__PURE__ */ (0, import_react.createElement)("img", { 1580 alt: "", 1581 ...props, 1582 key: props.key 1583 }); 1584 } 1585 return /* @__PURE__ */ React8.createElement(Tag, props); 1586 } 1587 1588 // node_modules/@base-ui/react/esm/internals/reason-parts.js 1589 var reason_parts_exports = {}; 1590 __export(reason_parts_exports, { 1591 cancelOpen: () => cancelOpen, 1592 chipRemovePress: () => chipRemovePress, 1593 clearPress: () => clearPress, 1594 closePress: () => closePress, 1595 closeWatcher: () => closeWatcher, 1596 decrementPress: () => decrementPress, 1597 disabled: () => disabled, 1598 drag: () => drag, 1599 escapeKey: () => escapeKey, 1600 focusOut: () => focusOut, 1601 imperativeAction: () => imperativeAction, 1602 incrementPress: () => incrementPress, 1603 inputBlur: () => inputBlur, 1604 inputChange: () => inputChange, 1605 inputClear: () => inputClear, 1606 inputPaste: () => inputPaste, 1607 inputPress: () => inputPress, 1608 itemPress: () => itemPress, 1609 keyboard: () => keyboard, 1610 linkPress: () => linkPress, 1611 listNavigation: () => listNavigation, 1612 none: () => none, 1613 outsidePress: () => outsidePress, 1614 pointer: () => pointer, 1615 scrub: () => scrub, 1616 siblingOpen: () => siblingOpen, 1617 swipe: () => swipe, 1618 trackPress: () => trackPress, 1619 triggerFocus: () => triggerFocus, 1620 triggerHover: () => triggerHover, 1621 triggerPress: () => triggerPress, 1622 wheel: () => wheel, 1623 windowResize: () => windowResize 1624 }); 1625 var none = "none"; 1626 var triggerPress = "trigger-press"; 1627 var triggerHover = "trigger-hover"; 1628 var triggerFocus = "trigger-focus"; 1629 var outsidePress = "outside-press"; 1630 var itemPress = "item-press"; 1631 var closePress = "close-press"; 1632 var linkPress = "link-press"; 1633 var clearPress = "clear-press"; 1634 var chipRemovePress = "chip-remove-press"; 1635 var trackPress = "track-press"; 1636 var incrementPress = "increment-press"; 1637 var decrementPress = "decrement-press"; 1638 var inputChange = "input-change"; 1639 var inputClear = "input-clear"; 1640 var inputBlur = "input-blur"; 1641 var inputPaste = "input-paste"; 1642 var inputPress = "input-press"; 1643 var focusOut = "focus-out"; 1644 var escapeKey = "escape-key"; 1645 var closeWatcher = "close-watcher"; 1646 var listNavigation = "list-navigation"; 1647 var keyboard = "keyboard"; 1648 var pointer = "pointer"; 1649 var drag = "drag"; 1650 var wheel = "wheel"; 1651 var scrub = "scrub"; 1652 var cancelOpen = "cancel-open"; 1653 var siblingOpen = "sibling-open"; 1654 var disabled = "disabled"; 1655 var imperativeAction = "imperative-action"; 1656 var swipe = "swipe"; 1657 var windowResize = "window-resize"; 1658 1659 // node_modules/@base-ui/react/esm/internals/createBaseUIEventDetails.js 1660 function createChangeEventDetails(reason, event, trigger, customProperties) { 1661 let canceled = false; 1662 let allowPropagation = false; 1663 const custom = customProperties ?? EMPTY_OBJECT; 1664 const details = { 1665 reason, 1666 event: event ?? new Event("base-ui"), 1667 cancel() { 1668 canceled = true; 1669 }, 1670 allowPropagation() { 1671 allowPropagation = true; 1672 }, 1673 get isCanceled() { 1674 return canceled; 1675 }, 1676 get isPropagationAllowed() { 1677 return allowPropagation; 1678 }, 1679 trigger, 1680 ...custom 1681 }; 1682 return details; 1683 } 1684 1685 // node_modules/@base-ui/utils/esm/useId.js 1686 var React10 = __toESM(require_react(), 1); 1687 1688 // node_modules/@base-ui/utils/esm/safeReact.js 1689 var React9 = __toESM(require_react(), 1); 1690 var SafeReact = { 1691 ...React9 1692 }; 1693 1694 // node_modules/@base-ui/utils/esm/useId.js 1695 var globalId = 0; 1696 function useGlobalId(idOverride, prefix = "mui") { 1697 const [defaultId, setDefaultId] = React10.useState(idOverride); 1698 const id = idOverride || defaultId; 1699 React10.useEffect(() => { 1700 if (defaultId == null) { 1701 globalId += 1; 1702 setDefaultId(`$prefix}-$globalId}`); 1703 } 1704 }, [defaultId, prefix]); 1705 return id; 1706 } 1707 var maybeReactUseId = SafeReact.useId; 1708 function useId(idOverride, prefix) { 1709 if (maybeReactUseId !== void 0) { 1710 const reactId = maybeReactUseId(); 1711 return idOverride ?? (prefix ? `$prefix}-$reactId}` : reactId); 1712 } 1713 return useGlobalId(idOverride, prefix); 1714 } 1715 1716 // node_modules/@base-ui/react/esm/internals/useBaseUiId.js 1717 function useBaseUiId(idOverride) { 1718 return useId(idOverride, "base-ui"); 1719 } 1720 1721 // node_modules/@base-ui/react/esm/collapsible/root/useCollapsibleRoot.js 1722 var React13 = __toESM(require_react(), 1); 1723 1724 // node_modules/@base-ui/react/esm/internals/useAnimationsFinished.js 1725 var ReactDOM = __toESM(require_react_dom(), 1); 1726 1727 // node_modules/@base-ui/utils/esm/useOnMount.js 1728 var React11 = __toESM(require_react(), 1); 1729 var EMPTY = []; 1730 function useOnMount(fn) { 1731 React11.useEffect(fn, EMPTY); 1732 } 1733 1734 // node_modules/@base-ui/utils/esm/useAnimationFrame.js 1735 var EMPTY2 = null; 1736 var LAST_RAF = globalThis.requestAnimationFrame; 1737 var Scheduler = class { 1738 /* This implementation uses an array as a backing data-structure for frame callbacks. 1739 * It allows `O(1)` callback cancelling by inserting a `null` in the array, though it 1740 * never calls the native `cancelAnimationFrame` if there are no frames left. This can 1741 * be much more efficient if there is a call pattern that alterns as 1742 * "request-cancel-request-cancel-…". 1743 * But in the case of "request-request-…-cancel-cancel-…", it leaves the final animation 1744 * frame to run anyway. We turn that frame into a `O(1)` no-op via `callbacksCount`. */ 1745 callbacks = []; 1746 callbacksCount = 0; 1747 nextId = 1; 1748 startId = 1; 1749 isScheduled = false; 1750 tick = (timestamp) => { 1751 this.isScheduled = false; 1752 const currentCallbacks = this.callbacks; 1753 const currentCallbacksCount = this.callbacksCount; 1754 this.callbacks = []; 1755 this.callbacksCount = 0; 1756 this.startId = this.nextId; 1757 if (currentCallbacksCount > 0) { 1758 for (let i2 = 0; i2 < currentCallbacks.length; i2 += 1) { 1759 currentCallbacks[i2]?.(timestamp); 1760 } 1761 } 1762 }; 1763 request(fn) { 1764 const id = this.nextId; 1765 this.nextId += 1; 1766 this.callbacks.push(fn); 1767 this.callbacksCount += 1; 1768 const didRAFChange = LAST_RAF !== requestAnimationFrame && (LAST_RAF = requestAnimationFrame, true); 1769 if (!this.isScheduled || didRAFChange) { 1770 requestAnimationFrame(this.tick); 1771 this.isScheduled = true; 1772 } 1773 return id; 1774 } 1775 cancel(id) { 1776 const index2 = id - this.startId; 1777 if (index2 < 0 || index2 >= this.callbacks.length) { 1778 return; 1779 } 1780 this.callbacks[index2] = null; 1781 this.callbacksCount -= 1; 1782 } 1783 }; 1784 var scheduler = new Scheduler(); 1785 var AnimationFrame = class _AnimationFrame { 1786 static create() { 1787 return new _AnimationFrame(); 1788 } 1789 static request(fn) { 1790 return scheduler.request(fn); 1791 } 1792 static cancel(id) { 1793 return scheduler.cancel(id); 1794 } 1795 currentId = EMPTY2; 1796 /** 1797 * Executes `fn` after `delay`, clearing any previously scheduled call. 1798 */ 1799 request(fn) { 1800 this.cancel(); 1801 this.currentId = scheduler.request(() => { 1802 this.currentId = EMPTY2; 1803 fn(); 1804 }); 1805 } 1806 cancel = () => { 1807 if (this.currentId !== EMPTY2) { 1808 scheduler.cancel(this.currentId); 1809 this.currentId = EMPTY2; 1810 } 1811 }; 1812 disposeEffect = () => { 1813 return this.cancel; 1814 }; 1815 }; 1816 function useAnimationFrame() { 1817 const timeout = useRefWithInit(AnimationFrame.create).current; 1818 useOnMount(timeout.disposeEffect); 1819 return timeout; 1820 } 1821 1822 // node_modules/@base-ui/react/esm/utils/resolveRef.js 1823 function resolveRef(maybeRef) { 1824 if (maybeRef == null) { 1825 return maybeRef; 1826 } 1827 return "current" in maybeRef ? maybeRef.current : maybeRef; 1828 } 1829 1830 // node_modules/@base-ui/react/esm/internals/stateAttributesMapping.js 1831 var TransitionStatusDataAttributes = /* @__PURE__ */ (function(TransitionStatusDataAttributes2) { 1832 TransitionStatusDataAttributes2["startingStyle"] = "data-starting-style"; 1833 TransitionStatusDataAttributes2["endingStyle"] = "data-ending-style"; 1834 return TransitionStatusDataAttributes2; 1835 })({}); 1836 var STARTING_HOOK = { 1837 [TransitionStatusDataAttributes.startingStyle]: "" 1838 }; 1839 var ENDING_HOOK = { 1840 [TransitionStatusDataAttributes.endingStyle]: "" 1841 }; 1842 var transitionStatusMapping = { 1843 transitionStatus(value) { 1844 if (value === "starting") { 1845 return STARTING_HOOK; 1846 } 1847 if (value === "ending") { 1848 return ENDING_HOOK; 1849 } 1850 return null; 1851 } 1852 }; 1853 1854 // node_modules/@base-ui/react/esm/internals/useAnimationsFinished.js 1855 function useAnimationsFinished(elementOrRef, waitForStartingStyleRemoved = false, treatAbortedAsFinished = true) { 1856 const frame = useAnimationFrame(); 1857 return useStableCallback((fnToExecute, signal = null) => { 1858 frame.cancel(); 1859 const element = resolveRef(elementOrRef); 1860 if (element == null) { 1861 return; 1862 } 1863 const resolvedElement = element; 1864 const done = () => { 1865 ReactDOM.flushSync(fnToExecute); 1866 }; 1867 if (typeof resolvedElement.getAnimations !== "function" || globalThis.BASE_UI_ANIMATIONS_DISABLED) { 1868 fnToExecute(); 1869 return; 1870 } 1871 function exec() { 1872 Promise.all(resolvedElement.getAnimations().map((animation) => animation.finished)).then(() => { 1873 if (!signal?.aborted) { 1874 done(); 1875 } 1876 }).catch(() => { 1877 if (treatAbortedAsFinished) { 1878 if (!signal?.aborted) { 1879 done(); 1880 } 1881 return; 1882 } 1883 const currentAnimations = resolvedElement.getAnimations(); 1884 if (!signal?.aborted && currentAnimations.length > 0 && currentAnimations.some((animation) => animation.pending || animation.playState !== "finished")) { 1885 exec(); 1886 } 1887 }); 1888 } 1889 if (waitForStartingStyleRemoved) { 1890 const startingStyleAttribute = TransitionStatusDataAttributes.startingStyle; 1891 if (!resolvedElement.hasAttribute(startingStyleAttribute)) { 1892 frame.request(exec); 1893 return; 1894 } 1895 const attributeObserver = new MutationObserver(() => { 1896 if (!resolvedElement.hasAttribute(startingStyleAttribute)) { 1897 attributeObserver.disconnect(); 1898 exec(); 1899 } 1900 }); 1901 attributeObserver.observe(resolvedElement, { 1902 attributes: true, 1903 attributeFilter: [startingStyleAttribute] 1904 }); 1905 signal?.addEventListener("abort", () => attributeObserver.disconnect(), { 1906 once: true 1907 }); 1908 return; 1909 } 1910 frame.request(exec); 1911 }); 1912 } 1913 1914 // node_modules/@base-ui/react/esm/internals/useTransitionStatus.js 1915 var React12 = __toESM(require_react(), 1); 1916 function useTransitionStatus(open, enableIdleState = false, deferEndingState = false) { 1917 const [transitionStatus, setTransitionStatus] = React12.useState(open && enableIdleState ? "idle" : void 0); 1918 const [mounted, setMounted] = React12.useState(open); 1919 if (open && !mounted) { 1920 setMounted(true); 1921 setTransitionStatus("starting"); 1922 } 1923 if (!open && mounted && transitionStatus !== "ending" && !deferEndingState) { 1924 setTransitionStatus("ending"); 1925 } 1926 if (!open && !mounted && transitionStatus === "ending") { 1927 setTransitionStatus(void 0); 1928 } 1929 useIsoLayoutEffect(() => { 1930 if (!open && mounted && transitionStatus !== "ending" && deferEndingState) { 1931 const frame = AnimationFrame.request(() => { 1932 setTransitionStatus("ending"); 1933 }); 1934 return () => { 1935 AnimationFrame.cancel(frame); 1936 }; 1937 } 1938 return void 0; 1939 }, [open, mounted, transitionStatus, deferEndingState]); 1940 useIsoLayoutEffect(() => { 1941 if (!open || enableIdleState) { 1942 return void 0; 1943 } 1944 const frame = AnimationFrame.request(() => { 1945 setTransitionStatus(void 0); 1946 }); 1947 return () => { 1948 AnimationFrame.cancel(frame); 1949 }; 1950 }, [enableIdleState, open]); 1951 useIsoLayoutEffect(() => { 1952 if (!open || !enableIdleState) { 1953 return void 0; 1954 } 1955 if (open && mounted && transitionStatus !== "idle") { 1956 setTransitionStatus("starting"); 1957 } 1958 const frame = AnimationFrame.request(() => { 1959 setTransitionStatus("idle"); 1960 }); 1961 return () => { 1962 AnimationFrame.cancel(frame); 1963 }; 1964 }, [enableIdleState, open, mounted, transitionStatus]); 1965 return { 1966 mounted, 1967 setMounted, 1968 transitionStatus 1969 }; 1970 } 1971 1972 // node_modules/@base-ui/react/esm/collapsible/root/useCollapsibleRoot.js 1973 function useCollapsibleRoot(parameters) { 1974 const { 1975 open: openParam, 1976 defaultOpen, 1977 onOpenChange, 1978 disabled: disabled2 1979 } = parameters; 1980 const isControlled = openParam !== void 0; 1981 const [open, setOpen] = useControlled({ 1982 controlled: openParam, 1983 default: defaultOpen, 1984 name: "Collapsible", 1985 state: "open" 1986 }); 1987 const { 1988 mounted, 1989 setMounted, 1990 transitionStatus 1991 } = useTransitionStatus(open, true, true); 1992 const [visible, setVisible] = React13.useState(open); 1993 const [{ 1994 height, 1995 width 1996 }, setDimensions] = React13.useState({ 1997 height: void 0, 1998 width: void 0 1999 }); 2000 const defaultPanelId = useBaseUiId(); 2001 const [panelIdState, setPanelIdState] = React13.useState(); 2002 const panelId = panelIdState ?? defaultPanelId; 2003 const [hiddenUntilFound, setHiddenUntilFound] = React13.useState(false); 2004 const [keepMounted, setKeepMounted] = React13.useState(false); 2005 const abortControllerRef = React13.useRef(null); 2006 const animationTypeRef = React13.useRef(null); 2007 const transitionDimensionRef = React13.useRef(null); 2008 const panelRef = React13.useRef(null); 2009 const runOnceAnimationsFinish = useAnimationsFinished(panelRef, false); 2010 const handleTrigger = useStableCallback((event) => { 2011 const nextOpen = !open; 2012 const eventDetails = createChangeEventDetails(reason_parts_exports.triggerPress, event.nativeEvent); 2013 onOpenChange(nextOpen, eventDetails); 2014 if (eventDetails.isCanceled) { 2015 return; 2016 } 2017 const panel = panelRef.current; 2018 if (animationTypeRef.current === "css-animation" && panel != null) { 2019 panel.style.removeProperty("animation-name"); 2020 } 2021 if (!hiddenUntilFound && !keepMounted) { 2022 if (animationTypeRef.current != null && animationTypeRef.current !== "css-animation") { 2023 if (!mounted && nextOpen) { 2024 setMounted(true); 2025 } 2026 } 2027 if (animationTypeRef.current === "css-animation") { 2028 if (!visible && nextOpen) { 2029 setVisible(true); 2030 } 2031 if (!mounted && nextOpen) { 2032 setMounted(true); 2033 } 2034 } 2035 } 2036 setOpen(nextOpen); 2037 if (animationTypeRef.current === "none" && mounted && !nextOpen) { 2038 setMounted(false); 2039 } 2040 }); 2041 useIsoLayoutEffect(() => { 2042 if (isControlled && animationTypeRef.current === "none" && !open) { 2043 setMounted(false); 2044 } 2045 }, [isControlled, open, openParam, setMounted]); 2046 return React13.useMemo(() => ({ 2047 abortControllerRef, 2048 animationTypeRef, 2049 disabled: disabled2, 2050 handleTrigger, 2051 height, 2052 mounted, 2053 open, 2054 panelId, 2055 panelRef, 2056 runOnceAnimationsFinish, 2057 setDimensions, 2058 setHiddenUntilFound, 2059 setKeepMounted, 2060 setMounted, 2061 setOpen, 2062 setPanelIdState, 2063 setVisible, 2064 transitionDimensionRef, 2065 transitionStatus, 2066 visible, 2067 width 2068 }), [abortControllerRef, animationTypeRef, disabled2, handleTrigger, height, mounted, open, panelId, panelRef, runOnceAnimationsFinish, setDimensions, setHiddenUntilFound, setKeepMounted, setMounted, setOpen, setVisible, transitionDimensionRef, transitionStatus, visible, width]); 2069 } 2070 2071 // node_modules/@base-ui/react/esm/collapsible/root/CollapsibleRootContext.js 2072 var React14 = __toESM(require_react(), 1); 2073 var CollapsibleRootContext = /* @__PURE__ */ React14.createContext(void 0); 2074 if (true) CollapsibleRootContext.displayName = "CollapsibleRootContext"; 2075 function useCollapsibleRootContext() { 2076 const context = React14.useContext(CollapsibleRootContext); 2077 if (context === void 0) { 2078 throw new Error(true ? "Base UI: CollapsibleRootContext is missing. Collapsible parts must be placed within <Collapsible.Root>." : formatErrorMessage_default(15)); 2079 } 2080 return context; 2081 } 2082 2083 // node_modules/@base-ui/react/esm/collapsible/panel/CollapsiblePanelDataAttributes.js 2084 var CollapsiblePanelDataAttributes = (function(CollapsiblePanelDataAttributes2) { 2085 CollapsiblePanelDataAttributes2["open"] = "data-open"; 2086 CollapsiblePanelDataAttributes2["closed"] = "data-closed"; 2087 CollapsiblePanelDataAttributes2[CollapsiblePanelDataAttributes2["startingStyle"] = TransitionStatusDataAttributes.startingStyle] = "startingStyle"; 2088 CollapsiblePanelDataAttributes2[CollapsiblePanelDataAttributes2["endingStyle"] = TransitionStatusDataAttributes.endingStyle] = "endingStyle"; 2089 return CollapsiblePanelDataAttributes2; 2090 })({}); 2091 2092 // node_modules/@base-ui/react/esm/collapsible/trigger/CollapsibleTriggerDataAttributes.js 2093 var CollapsibleTriggerDataAttributes = /* @__PURE__ */ (function(CollapsibleTriggerDataAttributes2) { 2094 CollapsibleTriggerDataAttributes2["panelOpen"] = "data-panel-open"; 2095 return CollapsibleTriggerDataAttributes2; 2096 })({}); 2097 2098 // node_modules/@base-ui/react/esm/utils/collapsibleOpenStateMapping.js 2099 var PANEL_OPEN_HOOK = { 2100 [CollapsiblePanelDataAttributes.open]: "" 2101 }; 2102 var PANEL_CLOSED_HOOK = { 2103 [CollapsiblePanelDataAttributes.closed]: "" 2104 }; 2105 var triggerOpenStateMapping = { 2106 open(value) { 2107 if (value) { 2108 return { 2109 [CollapsibleTriggerDataAttributes.panelOpen]: "" 2110 }; 2111 } 2112 return null; 2113 } 2114 }; 2115 var collapsibleOpenStateMapping = { 2116 open(value) { 2117 if (value) { 2118 return PANEL_OPEN_HOOK; 2119 } 2120 return PANEL_CLOSED_HOOK; 2121 } 2122 }; 2123 2124 // node_modules/@base-ui/react/esm/internals/use-button/useButton.js 2125 var React17 = __toESM(require_react(), 1); 2126 2127 // node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.mjs 2128 function hasWindow() { 2129 return typeof window !== "undefined"; 2130 } 2131 function getNodeName(node) { 2132 if (isNode(node)) { 2133 return (node.nodeName || "").toLowerCase(); 2134 } 2135 return "#document"; 2136 } 2137 function getWindow(node) { 2138 var _node$ownerDocument; 2139 return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window; 2140 } 2141 function getDocumentElement(node) { 2142 var _ref; 2143 return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement; 2144 } 2145 function isNode(value) { 2146 if (!hasWindow()) { 2147 return false; 2148 } 2149 return value instanceof Node || value instanceof getWindow(value).Node; 2150 } 2151 function isElement(value) { 2152 if (!hasWindow()) { 2153 return false; 2154 } 2155 return value instanceof Element || value instanceof getWindow(value).Element; 2156 } 2157 function isHTMLElement(value) { 2158 if (!hasWindow()) { 2159 return false; 2160 } 2161 return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement; 2162 } 2163 function isShadowRoot(value) { 2164 if (!hasWindow() || typeof ShadowRoot === "undefined") { 2165 return false; 2166 } 2167 return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot; 2168 } 2169 function isOverflowElement(element) { 2170 const { 2171 overflow, 2172 overflowX, 2173 overflowY, 2174 display 2175 } = getComputedStyle2(element); 2176 return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && display !== "inline" && display !== "contents"; 2177 } 2178 function isTableElement(element) { 2179 return /^(table|td|th)$/.test(getNodeName(element)); 2180 } 2181 function isTopLayer(element) { 2182 try { 2183 if (element.matches(":popover-open")) { 2184 return true; 2185 } 2186 } catch (_e) { 2187 } 2188 try { 2189 return element.matches(":modal"); 2190 } catch (_e) { 2191 return false; 2192 } 2193 } 2194 var willChangeRe = /transform|translate|scale|rotate|perspective|filter/; 2195 var containRe = /paint|layout|strict|content/; 2196 var isNotNone = (value) => !!value && value !== "none"; 2197 var isWebKitValue; 2198 function isContainingBlock(elementOrCss) { 2199 const css = isElement(elementOrCss) ? getComputedStyle2(elementOrCss) : elementOrCss; 2200 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 || ""); 2201 } 2202 function getContainingBlock(element) { 2203 let currentNode = getParentNode(element); 2204 while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) { 2205 if (isContainingBlock(currentNode)) { 2206 return currentNode; 2207 } else if (isTopLayer(currentNode)) { 2208 return null; 2209 } 2210 currentNode = getParentNode(currentNode); 2211 } 2212 return null; 2213 } 2214 function isWebKit() { 2215 if (isWebKitValue == null) { 2216 isWebKitValue = typeof CSS !== "undefined" && CSS.supports && CSS.supports("-webkit-backdrop-filter", "none"); 2217 } 2218 return isWebKitValue; 2219 } 2220 function isLastTraversableNode(node) { 2221 return /^(html|body|#document)$/.test(getNodeName(node)); 2222 } 2223 function getComputedStyle2(element) { 2224 return getWindow(element).getComputedStyle(element); 2225 } 2226 function getNodeScroll(element) { 2227 if (isElement(element)) { 2228 return { 2229 scrollLeft: element.scrollLeft, 2230 scrollTop: element.scrollTop 2231 }; 2232 } 2233 return { 2234 scrollLeft: element.scrollX, 2235 scrollTop: element.scrollY 2236 }; 2237 } 2238 function getParentNode(node) { 2239 if (getNodeName(node) === "html") { 2240 return node; 2241 } 2242 const result = ( 2243 // Step into the shadow DOM of the parent of a slotted node. 2244 node.assignedSlot || // DOM Element detected. 2245 node.parentNode || // ShadowRoot detected. 2246 isShadowRoot(node) && node.host || // Fallback. 2247 getDocumentElement(node) 2248 ); 2249 return isShadowRoot(result) ? result.host : result; 2250 } 2251 function getNearestOverflowAncestor(node) { 2252 const parentNode = getParentNode(node); 2253 if (isLastTraversableNode(parentNode)) { 2254 return node.ownerDocument ? node.ownerDocument.body : node.body; 2255 } 2256 if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) { 2257 return parentNode; 2258 } 2259 return getNearestOverflowAncestor(parentNode); 2260 } 2261 function getOverflowAncestors(node, list, traverseIframes) { 2262 var _node$ownerDocument2; 2263 if (list === void 0) { 2264 list = []; 2265 } 2266 if (traverseIframes === void 0) { 2267 traverseIframes = true; 2268 } 2269 const scrollableAncestor = getNearestOverflowAncestor(node); 2270 const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body); 2271 const win = getWindow(scrollableAncestor); 2272 if (isBody) { 2273 const frameElement = getFrameElement(win); 2274 return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], frameElement && traverseIframes ? getOverflowAncestors(frameElement) : []); 2275 } else { 2276 return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes)); 2277 } 2278 } 2279 function getFrameElement(win) { 2280 return win.parent && Object.getPrototypeOf(win.parent) ? win.frameElement : null; 2281 } 2282 2283 // node_modules/@base-ui/react/esm/internals/composite/root/CompositeRootContext.js 2284 var React15 = __toESM(require_react(), 1); 2285 var CompositeRootContext = /* @__PURE__ */ React15.createContext(void 0); 2286 if (true) CompositeRootContext.displayName = "CompositeRootContext"; 2287 function useCompositeRootContext(optional = false) { 2288 const context = React15.useContext(CompositeRootContext); 2289 if (context === void 0 && !optional) { 2290 throw new Error(true ? "Base UI: CompositeRootContext is missing. Composite parts must be placed within <Composite.Root>." : formatErrorMessage_default(16)); 2291 } 2292 return context; 2293 } 2294 2295 // node_modules/@base-ui/react/esm/utils/useFocusableWhenDisabled.js 2296 var React16 = __toESM(require_react(), 1); 2297 function useFocusableWhenDisabled(parameters) { 2298 const { 2299 focusableWhenDisabled, 2300 disabled: disabled2, 2301 composite = false, 2302 tabIndex: tabIndexProp = 0, 2303 isNativeButton 2304 } = parameters; 2305 const isFocusableComposite = composite && focusableWhenDisabled !== false; 2306 const isNonFocusableComposite = composite && focusableWhenDisabled === false; 2307 const props = React16.useMemo(() => { 2308 const additionalProps = { 2309 // allow Tabbing away from focusableWhenDisabled elements 2310 onKeyDown(event) { 2311 if (disabled2 && focusableWhenDisabled && event.key !== "Tab") { 2312 event.preventDefault(); 2313 } 2314 } 2315 }; 2316 if (!composite) { 2317 additionalProps.tabIndex = tabIndexProp; 2318 if (!isNativeButton && disabled2) { 2319 additionalProps.tabIndex = focusableWhenDisabled ? tabIndexProp : -1; 2320 } 2321 } 2322 if (isNativeButton && (focusableWhenDisabled || isFocusableComposite) || !isNativeButton && disabled2) { 2323 additionalProps["aria-disabled"] = disabled2; 2324 } 2325 if (isNativeButton && (!focusableWhenDisabled || isNonFocusableComposite)) { 2326 additionalProps.disabled = disabled2; 2327 } 2328 return additionalProps; 2329 }, [composite, disabled2, focusableWhenDisabled, isFocusableComposite, isNonFocusableComposite, isNativeButton, tabIndexProp]); 2330 return { 2331 props 2332 }; 2333 } 2334 2335 // node_modules/@base-ui/react/esm/internals/use-button/useButton.js 2336 function useButton(parameters = {}) { 2337 const { 2338 disabled: disabled2 = false, 2339 focusableWhenDisabled, 2340 tabIndex = 0, 2341 native: isNativeButton = true, 2342 composite: compositeProp 2343 } = parameters; 2344 const elementRef = React17.useRef(null); 2345 const compositeRootContext = useCompositeRootContext(true); 2346 const isCompositeItem = compositeProp ?? compositeRootContext !== void 0; 2347 const { 2348 props: focusableWhenDisabledProps 2349 } = useFocusableWhenDisabled({ 2350 focusableWhenDisabled, 2351 disabled: disabled2, 2352 composite: isCompositeItem, 2353 tabIndex, 2354 isNativeButton 2355 }); 2356 if (true) { 2357 React17.useEffect(() => { 2358 if (!elementRef.current) { 2359 return; 2360 } 2361 const isButtonTag = isButtonElement(elementRef.current); 2362 if (isNativeButton) { 2363 if (!isButtonTag) { 2364 const ownerStackMessage = SafeReact.captureOwnerStack?.() || ""; 2365 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`."; 2366 error(`$message2}$ownerStackMessage}`); 2367 } 2368 } else if (isButtonTag) { 2369 const ownerStackMessage = SafeReact.captureOwnerStack?.() || ""; 2370 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`."; 2371 error(`$message2}$ownerStackMessage}`); 2372 } 2373 }, [isNativeButton]); 2374 } 2375 const updateDisabled = React17.useCallback(() => { 2376 const element = elementRef.current; 2377 if (!isButtonElement(element)) { 2378 return; 2379 } 2380 if (isCompositeItem && disabled2 && focusableWhenDisabledProps.disabled === void 0 && element.disabled) { 2381 element.disabled = false; 2382 } 2383 }, [disabled2, focusableWhenDisabledProps.disabled, isCompositeItem]); 2384 useIsoLayoutEffect(updateDisabled, [updateDisabled]); 2385 const getButtonProps = React17.useCallback((externalProps = {}) => { 2386 const { 2387 onClick: externalOnClick, 2388 onMouseDown: externalOnMouseDown, 2389 onKeyUp: externalOnKeyUp, 2390 onKeyDown: externalOnKeyDown, 2391 onPointerDown: externalOnPointerDown, 2392 ...otherExternalProps 2393 } = externalProps; 2394 const type = isNativeButton ? "button" : void 0; 2395 return mergeProps({ 2396 type, 2397 onClick(event) { 2398 if (disabled2) { 2399 event.preventDefault(); 2400 return; 2401 } 2402 externalOnClick?.(event); 2403 }, 2404 onMouseDown(event) { 2405 if (!disabled2) { 2406 externalOnMouseDown?.(event); 2407 } 2408 }, 2409 onKeyDown(event) { 2410 if (disabled2) { 2411 return; 2412 } 2413 makeEventPreventable(event); 2414 externalOnKeyDown?.(event); 2415 if (event.baseUIHandlerPrevented) { 2416 return; 2417 } 2418 const isCurrentTarget = event.target === event.currentTarget; 2419 const currentTarget = event.currentTarget; 2420 const isButton2 = isButtonElement(currentTarget); 2421 const isLink = !isNativeButton && isValidLinkElement(currentTarget); 2422 const shouldClick = isCurrentTarget && (isNativeButton ? isButton2 : !isLink); 2423 const isEnterKey = event.key === "Enter"; 2424 const isSpaceKey = event.key === " "; 2425 const role = currentTarget.getAttribute("role"); 2426 const isTextNavigationRole = role?.startsWith("menuitem") || role === "option" || role === "gridcell"; 2427 if (isCurrentTarget && isCompositeItem && isSpaceKey) { 2428 if (event.defaultPrevented && isTextNavigationRole) { 2429 return; 2430 } 2431 event.preventDefault(); 2432 if (isLink || isNativeButton && isButton2) { 2433 currentTarget.click(); 2434 event.preventBaseUIHandler(); 2435 } else if (shouldClick) { 2436 externalOnClick?.(event); 2437 event.preventBaseUIHandler(); 2438 } 2439 return; 2440 } 2441 if (shouldClick) { 2442 if (!isNativeButton && (isSpaceKey || isEnterKey)) { 2443 event.preventDefault(); 2444 } 2445 if (!isNativeButton && isEnterKey) { 2446 externalOnClick?.(event); 2447 } 2448 } 2449 }, 2450 onKeyUp(event) { 2451 if (disabled2) { 2452 return; 2453 } 2454 makeEventPreventable(event); 2455 externalOnKeyUp?.(event); 2456 if (event.target === event.currentTarget && isNativeButton && isCompositeItem && isButtonElement(event.currentTarget) && event.key === " ") { 2457 event.preventDefault(); 2458 return; 2459 } 2460 if (event.baseUIHandlerPrevented) { 2461 return; 2462 } 2463 if (event.target === event.currentTarget && !isNativeButton && !isCompositeItem && event.key === " ") { 2464 externalOnClick?.(event); 2465 } 2466 }, 2467 onPointerDown(event) { 2468 if (disabled2) { 2469 event.preventDefault(); 2470 return; 2471 } 2472 externalOnPointerDown?.(event); 2473 } 2474 }, !isNativeButton ? { 2475 role: "button" 2476 } : void 0, focusableWhenDisabledProps, otherExternalProps); 2477 }, [disabled2, focusableWhenDisabledProps, isCompositeItem, isNativeButton]); 2478 const buttonRef = useStableCallback((element) => { 2479 elementRef.current = element; 2480 updateDisabled(); 2481 }); 2482 return { 2483 getButtonProps, 2484 buttonRef 2485 }; 2486 } 2487 function isButtonElement(elem) { 2488 return isHTMLElement(elem) && elem.tagName === "BUTTON"; 2489 } 2490 function isValidLinkElement(elem) { 2491 return Boolean(elem?.tagName === "A" && elem?.href); 2492 } 2493 2494 // node_modules/@base-ui/utils/esm/detectBrowser.js 2495 var hasNavigator = typeof navigator !== "undefined"; 2496 var nav = getNavigatorData(); 2497 var platform = getPlatform(); 2498 var userAgent = getUserAgent(); 2499 var isWebKit2 = typeof CSS === "undefined" || !CSS.supports ? false : CSS.supports("-webkit-backdrop-filter:none"); 2500 var isIOS = ( 2501 // iPads can claim to be MacIntel 2502 nav.platform === "MacIntel" && nav.maxTouchPoints > 1 ? true : /iP(hone|ad|od)|iOS/.test(nav.platform) 2503 ); 2504 var isFirefox = hasNavigator && /firefox/i.test(userAgent); 2505 var isSafari = hasNavigator && /apple/i.test(navigator.vendor); 2506 var isEdge = hasNavigator && /Edg/i.test(userAgent); 2507 var isAndroid = hasNavigator && /android/i.test(platform) || /android/i.test(userAgent); 2508 var isMac = hasNavigator && platform.toLowerCase().startsWith("mac") && !navigator.maxTouchPoints; 2509 var isJSDOM = userAgent.includes("jsdom/"); 2510 function getNavigatorData() { 2511 if (!hasNavigator) { 2512 return { 2513 platform: "", 2514 maxTouchPoints: -1 2515 }; 2516 } 2517 const uaData = navigator.userAgentData; 2518 if (uaData?.platform) { 2519 return { 2520 platform: uaData.platform, 2521 maxTouchPoints: navigator.maxTouchPoints 2522 }; 2523 } 2524 return { 2525 platform: navigator.platform ?? "", 2526 maxTouchPoints: navigator.maxTouchPoints ?? -1 2527 }; 2528 } 2529 function getUserAgent() { 2530 if (!hasNavigator) { 2531 return ""; 2532 } 2533 const uaData = navigator.userAgentData; 2534 if (uaData && Array.isArray(uaData.brands)) { 2535 return uaData.brands.map(({ 2536 brand, 2537 version: version2 2538 }) => `$brand}/$version2}`).join(" "); 2539 } 2540 return navigator.userAgent; 2541 } 2542 function getPlatform() { 2543 if (!hasNavigator) { 2544 return ""; 2545 } 2546 const uaData = navigator.userAgentData; 2547 if (uaData?.platform) { 2548 return uaData.platform; 2549 } 2550 return navigator.platform ?? ""; 2551 } 2552 2553 // node_modules/@base-ui/react/esm/floating-ui-react/utils/constants.js 2554 var FOCUSABLE_ATTRIBUTE = "data-base-ui-focusable"; 2555 var ACTIVE_KEY = "active"; 2556 var SELECTED_KEY = "selected"; 2557 var TYPEABLE_SELECTOR = "input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])"; 2558 2559 // node_modules/@base-ui/react/esm/internals/shadowDom.js 2560 function activeElement(doc) { 2561 let element = doc.activeElement; 2562 while (element?.shadowRoot?.activeElement != null) { 2563 element = element.shadowRoot.activeElement; 2564 } 2565 return element; 2566 } 2567 function contains(parent, child) { 2568 if (!parent || !child) { 2569 return false; 2570 } 2571 const rootNode = child.getRootNode?.(); 2572 if (parent.contains(child)) { 2573 return true; 2574 } 2575 if (rootNode && isShadowRoot(rootNode)) { 2576 let next = child; 2577 while (next) { 2578 if (parent === next) { 2579 return true; 2580 } 2581 next = next.parentNode || next.host; 2582 } 2583 } 2584 return false; 2585 } 2586 function getTarget(event) { 2587 if ("composedPath" in event) { 2588 return event.composedPath()[0]; 2589 } 2590 return event.target; 2591 } 2592 2593 // node_modules/@base-ui/react/esm/floating-ui-react/utils/element.js 2594 function isTargetInsideEnabledTrigger(target, triggerElements) { 2595 if (!isElement(target)) { 2596 return false; 2597 } 2598 const targetElement = target; 2599 if (triggerElements.hasElement(targetElement)) { 2600 return !targetElement.hasAttribute("data-trigger-disabled"); 2601 } 2602 for (const [, trigger] of triggerElements.entries()) { 2603 if (contains(trigger, targetElement)) { 2604 return !trigger.hasAttribute("data-trigger-disabled"); 2605 } 2606 } 2607 return false; 2608 } 2609 function isEventTargetWithin(event, node) { 2610 if (node == null) { 2611 return false; 2612 } 2613 if ("composedPath" in event) { 2614 return event.composedPath().includes(node); 2615 } 2616 const eventAgain = event; 2617 return eventAgain.target != null && node.contains(eventAgain.target); 2618 } 2619 function isRootElement(element) { 2620 return element.matches("html,body"); 2621 } 2622 function isTypeableElement(element) { 2623 return isHTMLElement(element) && element.matches(TYPEABLE_SELECTOR); 2624 } 2625 function isInteractiveElement(element) { 2626 return element?.closest(`button,a[href],[role="button"],select,[tabindex]:not([tabindex="-1"]),$TYPEABLE_SELECTOR}`) != null; 2627 } 2628 function isTypeableCombobox(element) { 2629 if (!element) { 2630 return false; 2631 } 2632 return element.getAttribute("role") === "combobox" && isTypeableElement(element); 2633 } 2634 function matchesFocusVisible(element) { 2635 if (!element || isJSDOM) { 2636 return true; 2637 } 2638 try { 2639 return element.matches(":focus-visible"); 2640 } catch (_e) { 2641 return true; 2642 } 2643 } 2644 function getFloatingFocusElement(floatingElement) { 2645 if (!floatingElement) { 2646 return null; 2647 } 2648 return floatingElement.hasAttribute(FOCUSABLE_ATTRIBUTE) ? floatingElement : floatingElement.querySelector(`[$FOCUSABLE_ATTRIBUTE}]`) || floatingElement; 2649 } 2650 2651 // node_modules/@base-ui/react/esm/floating-ui-react/utils/nodes.js 2652 function getNodeChildren(nodes, id, onlyOpenChildren = true) { 2653 const directChildren = nodes.filter((node) => node.parentId === id); 2654 return directChildren.flatMap((child) => [...!onlyOpenChildren || child.context?.open ? [child] : [], ...getNodeChildren(nodes, child.id, onlyOpenChildren)]); 2655 } 2656 function getNodeAncestors(nodes, id) { 2657 let allAncestors = []; 2658 let currentParentId = nodes.find((node) => node.id === id)?.parentId; 2659 while (currentParentId) { 2660 const currentNode = nodes.find((node) => node.id === currentParentId); 2661 currentParentId = currentNode?.parentId; 2662 if (currentNode) { 2663 allAncestors = allAncestors.concat(currentNode); 2664 } 2665 } 2666 return allAncestors; 2667 } 2668 2669 // node_modules/@base-ui/react/esm/floating-ui-react/utils/event.js 2670 function stopEvent(event) { 2671 event.preventDefault(); 2672 event.stopPropagation(); 2673 } 2674 function isReactEvent(event) { 2675 return "nativeEvent" in event; 2676 } 2677 function isVirtualClick(event) { 2678 if (event.pointerType === "" && event.isTrusted) { 2679 return true; 2680 } 2681 if (isAndroid && event.pointerType) { 2682 return event.type === "click" && event.buttons === 1; 2683 } 2684 return event.detail === 0 && !event.pointerType; 2685 } 2686 function isVirtualPointerEvent(event) { 2687 if (isJSDOM) { 2688 return false; 2689 } 2690 return !isAndroid && event.width === 0 && event.height === 0 || isAndroid && event.width === 1 && event.height === 1 && event.pressure === 0 && event.detail === 0 && event.pointerType === "mouse" || // iOS VoiceOver returns 0.333• for width/height. 2691 event.width < 1 && event.height < 1 && event.pressure === 0 && event.detail === 0 && event.pointerType === "touch"; 2692 } 2693 function isMouseLikePointerType(pointerType, strict) { 2694 const values = ["mouse", "pen"]; 2695 if (!strict) { 2696 values.push("", void 0); 2697 } 2698 return values.includes(pointerType); 2699 } 2700 function isClickLikeEvent(event) { 2701 const type = event.type; 2702 return type === "click" || type === "mousedown" || type === "keydown" || type === "keyup"; 2703 } 2704 2705 // node_modules/@floating-ui/utils/dist/floating-ui.utils.mjs 2706 var sides = ["top", "right", "bottom", "left"]; 2707 var min = Math.min; 2708 var max = Math.max; 2709 var round = Math.round; 2710 var floor = Math.floor; 2711 var createCoords = (v2) => ({ 2712 x: v2, 2713 y: v2 2714 }); 2715 var oppositeSideMap = { 2716 left: "right", 2717 right: "left", 2718 bottom: "top", 2719 top: "bottom" 2720 }; 2721 function clamp(start, value, end) { 2722 return max(start, min(value, end)); 2723 } 2724 function evaluate(value, param) { 2725 return typeof value === "function" ? value(param) : value; 2726 } 2727 function getSide(placement) { 2728 return placement.split("-")[0]; 2729 } 2730 function getAlignment(placement) { 2731 return placement.split("-")[1]; 2732 } 2733 function getOppositeAxis(axis) { 2734 return axis === "x" ? "y" : "x"; 2735 } 2736 function getAxisLength(axis) { 2737 return axis === "y" ? "height" : "width"; 2738 } 2739 function getSideAxis(placement) { 2740 const firstChar = placement[0]; 2741 return firstChar === "t" || firstChar === "b" ? "y" : "x"; 2742 } 2743 function getAlignmentAxis(placement) { 2744 return getOppositeAxis(getSideAxis(placement)); 2745 } 2746 function getAlignmentSides(placement, rects, rtl) { 2747 if (rtl === void 0) { 2748 rtl = false; 2749 } 2750 const alignment = getAlignment(placement); 2751 const alignmentAxis = getAlignmentAxis(placement); 2752 const length = getAxisLength(alignmentAxis); 2753 let mainAlignmentSide = alignmentAxis === "x" ? alignment === (rtl ? "end" : "start") ? "right" : "left" : alignment === "start" ? "bottom" : "top"; 2754 if (rects.reference[length] > rects.floating[length]) { 2755 mainAlignmentSide = getOppositePlacement(mainAlignmentSide); 2756 } 2757 return [mainAlignmentSide, getOppositePlacement(mainAlignmentSide)]; 2758 } 2759 function getExpandedPlacements(placement) { 2760 const oppositePlacement = getOppositePlacement(placement); 2761 return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)]; 2762 } 2763 function getOppositeAlignmentPlacement(placement) { 2764 return placement.includes("start") ? placement.replace("start", "end") : placement.replace("end", "start"); 2765 } 2766 var lrPlacement = ["left", "right"]; 2767 var rlPlacement = ["right", "left"]; 2768 var tbPlacement = ["top", "bottom"]; 2769 var btPlacement = ["bottom", "top"]; 2770 function getSideList(side, isStart, rtl) { 2771 switch (side) { 2772 case "top": 2773 case "bottom": 2774 if (rtl) return isStart ? rlPlacement : lrPlacement; 2775 return isStart ? lrPlacement : rlPlacement; 2776 case "left": 2777 case "right": 2778 return isStart ? tbPlacement : btPlacement; 2779 default: 2780 return []; 2781 } 2782 } 2783 function getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) { 2784 const alignment = getAlignment(placement); 2785 let list = getSideList(getSide(placement), direction === "start", rtl); 2786 if (alignment) { 2787 list = list.map((side) => side + "-" + alignment); 2788 if (flipAlignment) { 2789 list = list.concat(list.map(getOppositeAlignmentPlacement)); 2790 } 2791 } 2792 return list; 2793 } 2794 function getOppositePlacement(placement) { 2795 const side = getSide(placement); 2796 return oppositeSideMap[side] + placement.slice(side.length); 2797 } 2798 function expandPaddingObject(padding) { 2799 return { 2800 top: 0, 2801 right: 0, 2802 bottom: 0, 2803 left: 0, 2804 ...padding 2805 }; 2806 } 2807 function getPaddingObject(padding) { 2808 return typeof padding !== "number" ? expandPaddingObject(padding) : { 2809 top: padding, 2810 right: padding, 2811 bottom: padding, 2812 left: padding 2813 }; 2814 } 2815 function rectToClientRect(rect) { 2816 const { 2817 x: x2, 2818 y: y2, 2819 width, 2820 height 2821 } = rect; 2822 return { 2823 width, 2824 height, 2825 top: y2, 2826 left: x2, 2827 right: x2 + width, 2828 bottom: y2 + height, 2829 x: x2, 2830 y: y2 2831 }; 2832 } 2833 2834 // node_modules/@base-ui/react/esm/floating-ui-react/utils/composite.js 2835 function isHiddenByStyles(styles) { 2836 return styles.visibility === "hidden" || styles.visibility === "collapse"; 2837 } 2838 function isElementVisible(element, styles = element ? getComputedStyle2(element) : null) { 2839 if (!element || !element.isConnected || !styles || isHiddenByStyles(styles)) { 2840 return false; 2841 } 2842 if (typeof element.checkVisibility === "function") { 2843 return element.checkVisibility(); 2844 } 2845 return styles.display !== "none" && styles.display !== "contents"; 2846 } 2847 2848 // node_modules/@base-ui/utils/esm/owner.js 2849 function ownerDocument(node) { 2850 return node?.ownerDocument || document; 2851 } 2852 2853 // node_modules/@base-ui/react/esm/floating-ui-react/utils/tabbable.js 2854 var CANDIDATE_SELECTOR = 'a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable="false"]),audio[controls],video[controls]'; 2855 function getParentElement(element) { 2856 const assignedSlot = element.assignedSlot; 2857 if (assignedSlot) { 2858 return assignedSlot; 2859 } 2860 if (element.parentElement) { 2861 return element.parentElement; 2862 } 2863 const rootNode = element.getRootNode(); 2864 return isShadowRoot(rootNode) ? rootNode.host : null; 2865 } 2866 function getDetailsSummary(details) { 2867 for (const child of Array.from(details.children)) { 2868 if (getNodeName(child) === "summary") { 2869 return child; 2870 } 2871 } 2872 return null; 2873 } 2874 function isWithinOpenDetailsSummary(element, details) { 2875 const summary = getDetailsSummary(details); 2876 return !!summary && (element === summary || contains(summary, element)); 2877 } 2878 function isFocusableCandidate(element) { 2879 const nodeName = element ? getNodeName(element) : ""; 2880 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"); 2881 } 2882 function isFocusableElement(element) { 2883 if (!isFocusableCandidate(element) || !element.isConnected || element.matches(":disabled")) { 2884 return false; 2885 } 2886 for (let current = element; current; current = getParentElement(current)) { 2887 const isAncestor = current !== element; 2888 const isSlot = getNodeName(current) === "slot"; 2889 if (current.hasAttribute("inert")) { 2890 return false; 2891 } 2892 if (isAncestor && getNodeName(current) === "details" && !current.open && !isWithinOpenDetailsSummary(element, current) || current.hasAttribute("hidden") || !isSlot && !isVisibleInTabbableTree(current, isAncestor)) { 2893 return false; 2894 } 2895 } 2896 return true; 2897 } 2898 function isVisibleInTabbableTree(element, isAncestor) { 2899 const styles = getComputedStyle2(element); 2900 if (!isAncestor) { 2901 return isElementVisible(element, styles); 2902 } 2903 return styles.display !== "none"; 2904 } 2905 function getTabIndex(element) { 2906 const tabIndex = element.tabIndex; 2907 if (tabIndex < 0) { 2908 const nodeName = getNodeName(element); 2909 if (nodeName === "details" || nodeName === "audio" || nodeName === "video" || isHTMLElement(element) && element.isContentEditable) { 2910 return 0; 2911 } 2912 } 2913 return tabIndex; 2914 } 2915 function getNamedRadioInput(element) { 2916 if (getNodeName(element) !== "input") { 2917 return null; 2918 } 2919 const input = element; 2920 return input.type === "radio" && input.name !== "" ? input : null; 2921 } 2922 function isTabbableRadio(element, candidates) { 2923 const input = getNamedRadioInput(element); 2924 if (!input) { 2925 return true; 2926 } 2927 const checkedRadio = candidates.find((candidate) => { 2928 const radio = getNamedRadioInput(candidate); 2929 return radio?.name === input.name && radio.form === input.form && radio.checked; 2930 }); 2931 if (checkedRadio) { 2932 return checkedRadio === input; 2933 } 2934 return candidates.find((candidate) => { 2935 const radio = getNamedRadioInput(candidate); 2936 return radio?.name === input.name && radio.form === input.form; 2937 }) === input; 2938 } 2939 function getComposedChildren(container) { 2940 if (isHTMLElement(container) && getNodeName(container) === "slot") { 2941 const assignedElements = container.assignedElements({ 2942 flatten: true 2943 }); 2944 if (assignedElements.length > 0) { 2945 return assignedElements; 2946 } 2947 } 2948 if (isHTMLElement(container) && container.shadowRoot) { 2949 return Array.from(container.shadowRoot.children); 2950 } 2951 return Array.from(container.children); 2952 } 2953 function appendCandidates(container, list) { 2954 getComposedChildren(container).forEach((child) => { 2955 if (isFocusableCandidate(child)) { 2956 list.push(child); 2957 } 2958 appendCandidates(child, list); 2959 }); 2960 } 2961 function appendMatchingElements(container, selector2, list) { 2962 getComposedChildren(container).forEach((child) => { 2963 if (isHTMLElement(child) && child.matches(selector2)) { 2964 list.push(child); 2965 } 2966 appendMatchingElements(child, selector2, list); 2967 }); 2968 } 2969 function isTabbable(element) { 2970 return isFocusableElement(element) && getTabIndex(element) >= 0; 2971 } 2972 function focusable(container) { 2973 const candidates = []; 2974 appendCandidates(container, candidates); 2975 return candidates.filter(isFocusableElement); 2976 } 2977 function tabbable(container) { 2978 const candidates = focusable(container); 2979 return candidates.filter((element) => getTabIndex(element) >= 0 && isTabbableRadio(element, candidates)); 2980 } 2981 function getTabbableIn(container, dir) { 2982 const list = tabbable(container); 2983 const len = list.length; 2984 if (len === 0) { 2985 return void 0; 2986 } 2987 const active = activeElement(ownerDocument(container)); 2988 const index2 = list.indexOf(active); 2989 const nextIndex = index2 === -1 ? dir === 1 ? 0 : len - 1 : index2 + dir; 2990 return list[nextIndex]; 2991 } 2992 function getNextTabbable(referenceElement) { 2993 return getTabbableIn(ownerDocument(referenceElement).body, 1) || referenceElement; 2994 } 2995 function getPreviousTabbable(referenceElement) { 2996 return getTabbableIn(ownerDocument(referenceElement).body, -1) || referenceElement; 2997 } 2998 function isOutsideEvent(event, container) { 2999 const containerElement = container || event.currentTarget; 3000 const relatedTarget = event.relatedTarget; 3001 return !relatedTarget || !contains(containerElement, relatedTarget); 3002 } 3003 function disableFocusInside(container) { 3004 const tabbableElements = tabbable(container); 3005 tabbableElements.forEach((element) => { 3006 element.dataset.tabindex = element.getAttribute("tabindex") || ""; 3007 element.setAttribute("tabindex", "-1"); 3008 }); 3009 } 3010 function enableFocusInside(container) { 3011 const elements = []; 3012 appendMatchingElements(container, "[data-tabindex]", elements); 3013 elements.forEach((element) => { 3014 const tabindex = element.dataset.tabindex; 3015 delete element.dataset.tabindex; 3016 if (tabindex) { 3017 element.setAttribute("tabindex", tabindex); 3018 } else { 3019 element.removeAttribute("tabindex"); 3020 } 3021 }); 3022 } 3023 3024 // node_modules/@base-ui/react/esm/internals/composite/composite.js 3025 var ARROW_UP = "ArrowUp"; 3026 var ARROW_DOWN = "ArrowDown"; 3027 var ARROW_LEFT = "ArrowLeft"; 3028 var ARROW_RIGHT = "ArrowRight"; 3029 var HOME = "Home"; 3030 var END = "End"; 3031 var HORIZONTAL_KEYS = /* @__PURE__ */ new Set([ARROW_LEFT, ARROW_RIGHT]); 3032 var VERTICAL_KEYS = /* @__PURE__ */ new Set([ARROW_UP, ARROW_DOWN]); 3033 var ARROW_KEYS = /* @__PURE__ */ new Set([...HORIZONTAL_KEYS, ...VERTICAL_KEYS]); 3034 var ALL_KEYS = /* @__PURE__ */ new Set([...ARROW_KEYS, HOME, END]); 3035 var COMPOSITE_KEYS = /* @__PURE__ */ new Set([ARROW_UP, ARROW_DOWN, ARROW_LEFT, ARROW_RIGHT, HOME, END]); 3036 3037 // node_modules/@base-ui/react/esm/collapsible/panel/useCollapsiblePanel.js 3038 var React18 = __toESM(require_react(), 1); 3039 3040 // node_modules/@base-ui/utils/esm/addEventListener.js 3041 function addEventListener(target, type, listener, options) { 3042 target.addEventListener(type, listener, options); 3043 return () => { 3044 target.removeEventListener(type, listener, options); 3045 }; 3046 } 3047 3048 // node_modules/@base-ui/react/esm/accordion/root/AccordionRootDataAttributes.js 3049 var AccordionRootDataAttributes = /* @__PURE__ */ (function(AccordionRootDataAttributes2) { 3050 AccordionRootDataAttributes2["disabled"] = "data-disabled"; 3051 AccordionRootDataAttributes2["orientation"] = "data-orientation"; 3052 return AccordionRootDataAttributes2; 3053 })({}); 3054 3055 // node_modules/@base-ui/react/esm/collapsible/panel/useCollapsiblePanel.js 3056 function useCollapsiblePanel(parameters) { 3057 const { 3058 abortControllerRef, 3059 animationTypeRef, 3060 externalRef, 3061 height, 3062 hiddenUntilFound, 3063 keepMounted, 3064 id: idParam, 3065 mounted, 3066 onOpenChange, 3067 open, 3068 panelRef, 3069 runOnceAnimationsFinish, 3070 setDimensions, 3071 setMounted, 3072 setOpen, 3073 setVisible, 3074 transitionDimensionRef, 3075 visible, 3076 width 3077 } = parameters; 3078 const isBeforeMatchRef = React18.useRef(false); 3079 const latestAnimationNameRef = React18.useRef(null); 3080 const shouldCancelInitialOpenAnimationRef = React18.useRef(open); 3081 const shouldCancelInitialOpenTransitionRef = React18.useRef(open); 3082 const endingStyleFrame = useAnimationFrame(); 3083 const hidden = React18.useMemo(() => { 3084 if (animationTypeRef.current === "css-animation") { 3085 return !visible; 3086 } 3087 return !open && !mounted; 3088 }, [open, mounted, visible, animationTypeRef]); 3089 const handlePanelRef = useStableCallback((element) => { 3090 if (!element) { 3091 return void 0; 3092 } 3093 if (animationTypeRef.current == null || transitionDimensionRef.current == null) { 3094 const panelStyles = getComputedStyle(element); 3095 const hasAnimation = panelStyles.animationName !== "none" && panelStyles.animationName !== ""; 3096 const hasTransition = panelStyles.transitionDuration !== "0s" && panelStyles.transitionDuration !== ""; 3097 if (hasAnimation && hasTransition) { 3098 if (true) { 3099 warn("CSS transitions and CSS animations both detected on Collapsible or Accordion panel.", "Only one of either animation type should be used."); 3100 } 3101 } else if (panelStyles.animationName === "none" && panelStyles.transitionDuration !== "0s") { 3102 animationTypeRef.current = "css-transition"; 3103 } else if (panelStyles.animationName !== "none" && panelStyles.transitionDuration === "0s") { 3104 animationTypeRef.current = "css-animation"; 3105 } else { 3106 animationTypeRef.current = "none"; 3107 } 3108 if (element.getAttribute(AccordionRootDataAttributes.orientation) === "horizontal" || panelStyles.transitionProperty.indexOf("width") > -1) { 3109 transitionDimensionRef.current = "width"; 3110 } else { 3111 transitionDimensionRef.current = "height"; 3112 } 3113 } 3114 if (animationTypeRef.current !== "css-transition") { 3115 return void 0; 3116 } 3117 if (height === void 0 || width === void 0) { 3118 setDimensions({ 3119 height: element.scrollHeight, 3120 width: element.scrollWidth 3121 }); 3122 if (shouldCancelInitialOpenTransitionRef.current) { 3123 element.style.setProperty("transition-duration", "0s"); 3124 } 3125 } 3126 let frame = -1; 3127 let nextFrame = -1; 3128 frame = AnimationFrame.request(() => { 3129 shouldCancelInitialOpenTransitionRef.current = false; 3130 nextFrame = AnimationFrame.request(() => { 3131 setTimeout(() => { 3132 element.style.removeProperty("transition-duration"); 3133 }); 3134 }); 3135 }); 3136 return () => { 3137 AnimationFrame.cancel(frame); 3138 AnimationFrame.cancel(nextFrame); 3139 }; 3140 }); 3141 const mergedPanelRef = useMergedRefs(externalRef, panelRef, handlePanelRef); 3142 useIsoLayoutEffect(() => { 3143 if (animationTypeRef.current !== "css-transition") { 3144 return void 0; 3145 } 3146 const panel = panelRef.current; 3147 if (!panel) { 3148 return void 0; 3149 } 3150 let resizeFrame = -1; 3151 if (abortControllerRef.current != null) { 3152 abortControllerRef.current.abort(); 3153 abortControllerRef.current = null; 3154 } 3155 if (open) { 3156 const originalLayoutStyles = { 3157 "justify-content": panel.style.justifyContent, 3158 "align-items": panel.style.alignItems, 3159 "align-content": panel.style.alignContent, 3160 "justify-items": panel.style.justifyItems 3161 }; 3162 Object.keys(originalLayoutStyles).forEach((key2) => { 3163 panel.style.setProperty(key2, "initial", "important"); 3164 }); 3165 if (!shouldCancelInitialOpenTransitionRef.current && !keepMounted) { 3166 panel.setAttribute(CollapsiblePanelDataAttributes.startingStyle, ""); 3167 } 3168 setDimensions({ 3169 height: panel.scrollHeight, 3170 width: panel.scrollWidth 3171 }); 3172 resizeFrame = AnimationFrame.request(() => { 3173 Object.entries(originalLayoutStyles).forEach(([key2, value]) => { 3174 if (value === "") { 3175 panel.style.removeProperty(key2); 3176 } else { 3177 panel.style.setProperty(key2, value); 3178 } 3179 }); 3180 }); 3181 } else { 3182 if (panel.scrollHeight === 0 && panel.scrollWidth === 0) { 3183 return void 0; 3184 } 3185 setDimensions({ 3186 height: panel.scrollHeight, 3187 width: panel.scrollWidth 3188 }); 3189 const abortController = new AbortController(); 3190 abortControllerRef.current = abortController; 3191 const signal = abortController.signal; 3192 let attributeObserver = null; 3193 const endingStyleAttribute = CollapsiblePanelDataAttributes.endingStyle; 3194 attributeObserver = new MutationObserver((mutationList) => { 3195 const hasEndingStyle = mutationList.some((mutation) => mutation.type === "attributes" && mutation.attributeName === endingStyleAttribute); 3196 if (hasEndingStyle) { 3197 attributeObserver?.disconnect(); 3198 attributeObserver = null; 3199 runOnceAnimationsFinish(() => { 3200 setDimensions({ 3201 height: 0, 3202 width: 0 3203 }); 3204 panel.style.removeProperty("content-visibility"); 3205 setMounted(false); 3206 if (abortControllerRef.current === abortController) { 3207 abortControllerRef.current = null; 3208 } 3209 }, signal); 3210 } 3211 }); 3212 attributeObserver.observe(panel, { 3213 attributes: true, 3214 attributeFilter: [endingStyleAttribute] 3215 }); 3216 return () => { 3217 attributeObserver?.disconnect(); 3218 endingStyleFrame.cancel(); 3219 if (abortControllerRef.current === abortController) { 3220 abortController.abort(); 3221 abortControllerRef.current = null; 3222 } 3223 }; 3224 } 3225 return () => { 3226 AnimationFrame.cancel(resizeFrame); 3227 }; 3228 }, [abortControllerRef, animationTypeRef, endingStyleFrame, hiddenUntilFound, keepMounted, mounted, open, panelRef, runOnceAnimationsFinish, setDimensions, setMounted]); 3229 useIsoLayoutEffect(() => { 3230 if (animationTypeRef.current !== "css-animation") { 3231 return; 3232 } 3233 const panel = panelRef.current; 3234 if (!panel) { 3235 return; 3236 } 3237 latestAnimationNameRef.current = panel.style.animationName || latestAnimationNameRef.current; 3238 panel.style.setProperty("animation-name", "none"); 3239 setDimensions({ 3240 height: panel.scrollHeight, 3241 width: panel.scrollWidth 3242 }); 3243 if (!shouldCancelInitialOpenAnimationRef.current && !isBeforeMatchRef.current) { 3244 panel.style.removeProperty("animation-name"); 3245 } 3246 if (open) { 3247 if (abortControllerRef.current != null) { 3248 abortControllerRef.current.abort(); 3249 abortControllerRef.current = null; 3250 } 3251 setMounted(true); 3252 setVisible(true); 3253 } else { 3254 abortControllerRef.current = new AbortController(); 3255 runOnceAnimationsFinish(() => { 3256 setMounted(false); 3257 setVisible(false); 3258 abortControllerRef.current = null; 3259 }, abortControllerRef.current.signal); 3260 } 3261 }, [abortControllerRef, animationTypeRef, open, panelRef, runOnceAnimationsFinish, setDimensions, setMounted, setVisible, visible]); 3262 useOnMount(() => { 3263 const frame = AnimationFrame.request(() => { 3264 shouldCancelInitialOpenAnimationRef.current = false; 3265 }); 3266 return () => AnimationFrame.cancel(frame); 3267 }); 3268 useIsoLayoutEffect(() => { 3269 if (!hiddenUntilFound) { 3270 return void 0; 3271 } 3272 const panel = panelRef.current; 3273 if (!panel) { 3274 return void 0; 3275 } 3276 let frame = -1; 3277 let nextFrame = -1; 3278 if (open && isBeforeMatchRef.current) { 3279 panel.style.transitionDuration = "0s"; 3280 setDimensions({ 3281 height: panel.scrollHeight, 3282 width: panel.scrollWidth 3283 }); 3284 frame = AnimationFrame.request(() => { 3285 isBeforeMatchRef.current = false; 3286 nextFrame = AnimationFrame.request(() => { 3287 setTimeout(() => { 3288 panel.style.removeProperty("transition-duration"); 3289 }); 3290 }); 3291 }); 3292 } 3293 return () => { 3294 AnimationFrame.cancel(frame); 3295 AnimationFrame.cancel(nextFrame); 3296 }; 3297 }, [hiddenUntilFound, open, panelRef, setDimensions]); 3298 useIsoLayoutEffect(() => { 3299 const panel = panelRef.current; 3300 if (panel && hiddenUntilFound && hidden) { 3301 panel.setAttribute("hidden", "until-found"); 3302 if (animationTypeRef.current === "css-transition") { 3303 panel.setAttribute(CollapsiblePanelDataAttributes.startingStyle, ""); 3304 } 3305 } 3306 }, [hiddenUntilFound, hidden, animationTypeRef, panelRef]); 3307 React18.useEffect(function registerBeforeMatchListener() { 3308 const panel = panelRef.current; 3309 if (!panel) { 3310 return void 0; 3311 } 3312 function handleBeforeMatch(event) { 3313 isBeforeMatchRef.current = true; 3314 setOpen(true); 3315 onOpenChange(true, createChangeEventDetails(reason_parts_exports.none, event)); 3316 } 3317 return addEventListener(panel, "beforematch", handleBeforeMatch); 3318 }, [onOpenChange, panelRef, setOpen]); 3319 return React18.useMemo(() => ({ 3320 props: { 3321 hidden, 3322 id: idParam, 3323 ref: mergedPanelRef 3324 } 3325 }), [hidden, idParam, mergedPanelRef]); 3326 } 3327 3328 // node_modules/@base-ui/react/esm/internals/useOpenChangeComplete.js 3329 var React19 = __toESM(require_react(), 1); 3330 function useOpenChangeComplete(parameters) { 3331 const { 3332 enabled = true, 3333 open, 3334 ref, 3335 onComplete: onCompleteParam 3336 } = parameters; 3337 const onComplete = useStableCallback(onCompleteParam); 3338 const runOnceAnimationsFinish = useAnimationsFinished(ref, open, false); 3339 React19.useEffect(() => { 3340 if (!enabled) { 3341 return void 0; 3342 } 3343 const abortController = new AbortController(); 3344 runOnceAnimationsFinish(onComplete, abortController.signal); 3345 return () => { 3346 abortController.abort(); 3347 }; 3348 }, [enabled, open, onComplete, runOnceAnimationsFinish]); 3349 } 3350 3351 // node_modules/@base-ui/react/esm/alert-dialog/index.parts.js 3352 var index_parts_exports = {}; 3353 __export(index_parts_exports, { 3354 Backdrop: () => DialogBackdrop, 3355 Close: () => DialogClose, 3356 Description: () => DialogDescription, 3357 Handle: () => DialogHandle, 3358 Popup: () => DialogPopup, 3359 Portal: () => DialogPortal, 3360 Root: () => AlertDialogRoot, 3361 Title: () => DialogTitle, 3362 Trigger: () => DialogTrigger, 3363 Viewport: () => DialogViewport, 3364 createHandle: () => createAlertDialogHandle 3365 }); 3366 3367 // node_modules/@base-ui/react/esm/alert-dialog/root/AlertDialogRoot.js 3368 var React47 = __toESM(require_react(), 1); 3369 3370 // node_modules/@base-ui/react/esm/dialog/root/DialogRoot.js 3371 var React46 = __toESM(require_react(), 1); 3372 3373 // node_modules/@base-ui/utils/esm/useOnFirstRender.js 3374 var React20 = __toESM(require_react(), 1); 3375 function useOnFirstRender(fn) { 3376 const ref = React20.useRef(true); 3377 if (ref.current) { 3378 ref.current = false; 3379 fn(); 3380 } 3381 } 3382 3383 // node_modules/@base-ui/react/esm/dialog/root/useDialogRoot.js 3384 var React43 = __toESM(require_react(), 1); 3385 3386 // node_modules/@base-ui/utils/esm/useTimeout.js 3387 var EMPTY3 = 0; 3388 var Timeout = class _Timeout { 3389 static create() { 3390 return new _Timeout(); 3391 } 3392 currentId = EMPTY3; 3393 /** 3394 * Executes `fn` after `delay`, clearing any previously scheduled call. 3395 */ 3396 start(delay, fn) { 3397 this.clear(); 3398 this.currentId = setTimeout(() => { 3399 this.currentId = EMPTY3; 3400 fn(); 3401 }, delay); 3402 } 3403 isStarted() { 3404 return this.currentId !== EMPTY3; 3405 } 3406 clear = () => { 3407 if (this.currentId !== EMPTY3) { 3408 clearTimeout(this.currentId); 3409 this.currentId = EMPTY3; 3410 } 3411 }; 3412 disposeEffect = () => { 3413 return this.clear; 3414 }; 3415 }; 3416 function useTimeout() { 3417 const timeout = useRefWithInit(Timeout.create).current; 3418 useOnMount(timeout.disposeEffect); 3419 return timeout; 3420 } 3421 3422 // node_modules/@base-ui/utils/esm/useScrollLock.js 3423 var originalHtmlStyles = {}; 3424 var originalBodyStyles = {}; 3425 var originalHtmlScrollBehavior = ""; 3426 function hasInsetScrollbars(referenceElement) { 3427 if (typeof document === "undefined") { 3428 return false; 3429 } 3430 const doc = ownerDocument(referenceElement); 3431 const win = getWindow(doc); 3432 return win.innerWidth - doc.documentElement.clientWidth > 0; 3433 } 3434 function supportsStableScrollbarGutter(referenceElement) { 3435 const supported = typeof CSS !== "undefined" && CSS.supports && CSS.supports("scrollbar-gutter", "stable"); 3436 if (!supported || typeof document === "undefined") { 3437 return false; 3438 } 3439 const doc = ownerDocument(referenceElement); 3440 const html = doc.documentElement; 3441 const body = doc.body; 3442 const scrollContainer = isOverflowElement(html) ? html : body; 3443 const originalScrollContainerOverflowY = scrollContainer.style.overflowY; 3444 const originalHtmlStyleGutter = html.style.scrollbarGutter; 3445 html.style.scrollbarGutter = "stable"; 3446 scrollContainer.style.overflowY = "scroll"; 3447 const before = scrollContainer.offsetWidth; 3448 scrollContainer.style.overflowY = "hidden"; 3449 const after = scrollContainer.offsetWidth; 3450 scrollContainer.style.overflowY = originalScrollContainerOverflowY; 3451 html.style.scrollbarGutter = originalHtmlStyleGutter; 3452 return before === after; 3453 } 3454 function preventScrollOverlayScrollbars(referenceElement) { 3455 const doc = ownerDocument(referenceElement); 3456 const html = doc.documentElement; 3457 const body = doc.body; 3458 const elementToLock = isOverflowElement(html) ? html : body; 3459 const originalElementToLockStyles = { 3460 overflowY: elementToLock.style.overflowY, 3461 overflowX: elementToLock.style.overflowX 3462 }; 3463 Object.assign(elementToLock.style, { 3464 overflowY: "hidden", 3465 overflowX: "hidden" 3466 }); 3467 return () => { 3468 Object.assign(elementToLock.style, originalElementToLockStyles); 3469 }; 3470 } 3471 function preventScrollInsetScrollbars(referenceElement) { 3472 const doc = ownerDocument(referenceElement); 3473 const html = doc.documentElement; 3474 const body = doc.body; 3475 const win = getWindow(html); 3476 let scrollTop = 0; 3477 let scrollLeft = 0; 3478 let updateGutterOnly = false; 3479 const resizeFrame = AnimationFrame.create(); 3480 if (isWebKit2 && (win.visualViewport?.scale ?? 1) !== 1) { 3481 return () => { 3482 }; 3483 } 3484 function lockScroll() { 3485 const htmlStyles = win.getComputedStyle(html); 3486 const bodyStyles = win.getComputedStyle(body); 3487 const htmlScrollbarGutterValue = htmlStyles.scrollbarGutter || ""; 3488 const hasBothEdges = htmlScrollbarGutterValue.includes("both-edges"); 3489 const scrollbarGutterValue = hasBothEdges ? "stable both-edges" : "stable"; 3490 scrollTop = html.scrollTop; 3491 scrollLeft = html.scrollLeft; 3492 originalHtmlStyles = { 3493 scrollbarGutter: html.style.scrollbarGutter, 3494 overflowY: html.style.overflowY, 3495 overflowX: html.style.overflowX 3496 }; 3497 originalHtmlScrollBehavior = html.style.scrollBehavior; 3498 originalBodyStyles = { 3499 position: body.style.position, 3500 height: body.style.height, 3501 width: body.style.width, 3502 boxSizing: body.style.boxSizing, 3503 overflowY: body.style.overflowY, 3504 overflowX: body.style.overflowX, 3505 scrollBehavior: body.style.scrollBehavior 3506 }; 3507 const isScrollableY = html.scrollHeight > html.clientHeight; 3508 const isScrollableX = html.scrollWidth > html.clientWidth; 3509 const hasConstantOverflowY = htmlStyles.overflowY === "scroll" || bodyStyles.overflowY === "scroll"; 3510 const hasConstantOverflowX = htmlStyles.overflowX === "scroll" || bodyStyles.overflowX === "scroll"; 3511 const scrollbarWidth = Math.max(0, win.innerWidth - body.clientWidth); 3512 const scrollbarHeight = Math.max(0, win.innerHeight - body.clientHeight); 3513 const marginY = parseFloat(bodyStyles.marginTop) + parseFloat(bodyStyles.marginBottom); 3514 const marginX = parseFloat(bodyStyles.marginLeft) + parseFloat(bodyStyles.marginRight); 3515 const elementToLock = isOverflowElement(html) ? html : body; 3516 updateGutterOnly = supportsStableScrollbarGutter(referenceElement); 3517 if (updateGutterOnly) { 3518 html.style.scrollbarGutter = scrollbarGutterValue; 3519 elementToLock.style.overflowY = "hidden"; 3520 elementToLock.style.overflowX = "hidden"; 3521 return; 3522 } 3523 Object.assign(html.style, { 3524 scrollbarGutter: scrollbarGutterValue, 3525 overflowY: "hidden", 3526 overflowX: "hidden" 3527 }); 3528 if (isScrollableY || hasConstantOverflowY) { 3529 html.style.overflowY = "scroll"; 3530 } 3531 if (isScrollableX || hasConstantOverflowX) { 3532 html.style.overflowX = "scroll"; 3533 } 3534 Object.assign(body.style, { 3535 position: "relative", 3536 height: marginY || scrollbarHeight ? `calc(100dvh - $marginY + scrollbarHeight}px)` : "100dvh", 3537 width: marginX || scrollbarWidth ? `calc(100vw - $marginX + scrollbarWidth}px)` : "100vw", 3538 boxSizing: "border-box", 3539 overflow: "hidden", 3540 scrollBehavior: "unset" 3541 }); 3542 body.scrollTop = scrollTop; 3543 body.scrollLeft = scrollLeft; 3544 html.setAttribute("data-base-ui-scroll-locked", ""); 3545 html.style.scrollBehavior = "unset"; 3546 } 3547 function cleanup() { 3548 Object.assign(html.style, originalHtmlStyles); 3549 Object.assign(body.style, originalBodyStyles); 3550 if (!updateGutterOnly) { 3551 html.scrollTop = scrollTop; 3552 html.scrollLeft = scrollLeft; 3553 html.removeAttribute("data-base-ui-scroll-locked"); 3554 html.style.scrollBehavior = originalHtmlScrollBehavior; 3555 } 3556 } 3557 function handleResize() { 3558 cleanup(); 3559 resizeFrame.request(lockScroll); 3560 } 3561 lockScroll(); 3562 const unsubscribeResize = addEventListener(win, "resize", handleResize); 3563 return () => { 3564 resizeFrame.cancel(); 3565 cleanup(); 3566 if (typeof win.removeEventListener === "function") { 3567 unsubscribeResize(); 3568 } 3569 }; 3570 } 3571 var ScrollLocker = class { 3572 lockCount = 0; 3573 restore = null; 3574 timeoutLock = Timeout.create(); 3575 timeoutUnlock = Timeout.create(); 3576 acquire(referenceElement) { 3577 this.lockCount += 1; 3578 if (this.lockCount === 1 && this.restore === null) { 3579 this.timeoutLock.start(0, () => this.lock(referenceElement)); 3580 } 3581 return this.release; 3582 } 3583 release = () => { 3584 this.lockCount -= 1; 3585 if (this.lockCount === 0 && this.restore) { 3586 this.timeoutUnlock.start(0, this.unlock); 3587 } 3588 }; 3589 unlock = () => { 3590 if (this.lockCount === 0 && this.restore) { 3591 this.restore?.(); 3592 this.restore = null; 3593 } 3594 }; 3595 lock(referenceElement) { 3596 if (this.lockCount === 0 || this.restore !== null) { 3597 return; 3598 } 3599 const doc = ownerDocument(referenceElement); 3600 const html = doc.documentElement; 3601 const htmlOverflowY = getWindow(html).getComputedStyle(html).overflowY; 3602 if (htmlOverflowY === "hidden" || htmlOverflowY === "clip") { 3603 this.restore = NOOP; 3604 return; 3605 } 3606 const hasOverlayScrollbars = isIOS || !hasInsetScrollbars(referenceElement); 3607 this.restore = hasOverlayScrollbars ? preventScrollOverlayScrollbars(referenceElement) : preventScrollInsetScrollbars(referenceElement); 3608 } 3609 }; 3610 var SCROLL_LOCKER = new ScrollLocker(); 3611 function useScrollLock(enabled = true, referenceElement = null) { 3612 useIsoLayoutEffect(() => { 3613 if (!enabled) { 3614 return void 0; 3615 } 3616 return SCROLL_LOCKER.acquire(referenceElement); 3617 }, [enabled, referenceElement]); 3618 } 3619 3620 // node_modules/@base-ui/react/esm/floating-ui-react/components/FloatingDelayGroup.js 3621 var React21 = __toESM(require_react(), 1); 3622 3623 // node_modules/@base-ui/react/esm/floating-ui-react/hooks/useHoverShared.js 3624 function resolveValue(value, pointerType) { 3625 if (pointerType != null && !isMouseLikePointerType(pointerType)) { 3626 return 0; 3627 } 3628 if (typeof value === "function") { 3629 return value(); 3630 } 3631 return value; 3632 } 3633 function getDelay(value, prop, pointerType) { 3634 const result = resolveValue(value, pointerType); 3635 if (typeof result === "number") { 3636 return result; 3637 } 3638 return result?.[prop]; 3639 } 3640 function getRestMs(value) { 3641 if (typeof value === "function") { 3642 return value(); 3643 } 3644 return value; 3645 } 3646 function isClickLikeOpenEvent(openEventType, interactedInside) { 3647 return interactedInside || openEventType === "click" || openEventType === "mousedown"; 3648 } 3649 3650 // node_modules/@base-ui/react/esm/floating-ui-react/components/FloatingDelayGroup.js 3651 var import_jsx_runtime = __toESM(require_jsx_runtime(), 1); 3652 var FloatingDelayGroupContext = /* @__PURE__ */ React21.createContext({ 3653 hasProvider: false, 3654 timeoutMs: 0, 3655 delayRef: { 3656 current: 0 3657 }, 3658 initialDelayRef: { 3659 current: 0 3660 }, 3661 timeout: new Timeout(), 3662 currentIdRef: { 3663 current: null 3664 }, 3665 currentContextRef: { 3666 current: null 3667 } 3668 }); 3669 if (true) FloatingDelayGroupContext.displayName = "FloatingDelayGroupContext"; 3670 function FloatingDelayGroup(props) { 3671 const { 3672 children, 3673 delay, 3674 timeoutMs = 0 3675 } = props; 3676 const delayRef = React21.useRef(delay); 3677 const initialDelayRef = React21.useRef(delay); 3678 const currentIdRef = React21.useRef(null); 3679 const currentContextRef = React21.useRef(null); 3680 const timeout = useTimeout(); 3681 return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FloatingDelayGroupContext.Provider, { 3682 value: React21.useMemo(() => ({ 3683 hasProvider: true, 3684 delayRef, 3685 initialDelayRef, 3686 currentIdRef, 3687 timeoutMs, 3688 currentContextRef, 3689 timeout 3690 }), [timeoutMs, timeout]), 3691 children 3692 }); 3693 } 3694 function useDelayGroup(context, options = { 3695 open: false 3696 }) { 3697 const store = "rootStore" in context ? context.rootStore : context; 3698 const floatingId = store.useState("floatingId"); 3699 const { 3700 open 3701 } = options; 3702 const groupContext = React21.useContext(FloatingDelayGroupContext); 3703 const { 3704 currentIdRef, 3705 delayRef, 3706 timeoutMs, 3707 initialDelayRef, 3708 currentContextRef, 3709 hasProvider, 3710 timeout 3711 } = groupContext; 3712 const [isInstantPhase, setIsInstantPhase] = React21.useState(false); 3713 useIsoLayoutEffect(() => { 3714 function unset() { 3715 setIsInstantPhase(false); 3716 currentContextRef.current?.setIsInstantPhase(false); 3717 currentIdRef.current = null; 3718 currentContextRef.current = null; 3719 delayRef.current = initialDelayRef.current; 3720 } 3721 if (!currentIdRef.current) { 3722 return void 0; 3723 } 3724 if (!open && currentIdRef.current === floatingId) { 3725 setIsInstantPhase(false); 3726 if (timeoutMs) { 3727 const closingId = floatingId; 3728 timeout.start(timeoutMs, () => { 3729 if (store.select("open") || currentIdRef.current && currentIdRef.current !== closingId) { 3730 return; 3731 } 3732 unset(); 3733 }); 3734 return () => { 3735 timeout.clear(); 3736 }; 3737 } 3738 unset(); 3739 } 3740 return void 0; 3741 }, [open, floatingId, currentIdRef, delayRef, timeoutMs, initialDelayRef, currentContextRef, timeout, store]); 3742 useIsoLayoutEffect(() => { 3743 if (!open) { 3744 return; 3745 } 3746 const prevContext = currentContextRef.current; 3747 const prevId = currentIdRef.current; 3748 timeout.clear(); 3749 currentContextRef.current = { 3750 onOpenChange: store.setOpen, 3751 setIsInstantPhase 3752 }; 3753 currentIdRef.current = floatingId; 3754 delayRef.current = { 3755 open: 0, 3756 close: getDelay(initialDelayRef.current, "close") 3757 }; 3758 if (prevId !== null && prevId !== floatingId) { 3759 setIsInstantPhase(true); 3760 prevContext?.setIsInstantPhase(true); 3761 prevContext?.onOpenChange(false, createChangeEventDetails(reason_parts_exports.none)); 3762 } else { 3763 setIsInstantPhase(false); 3764 prevContext?.setIsInstantPhase(false); 3765 } 3766 }, [open, floatingId, store, currentIdRef, delayRef, timeoutMs, initialDelayRef, currentContextRef, timeout]); 3767 useIsoLayoutEffect(() => { 3768 return () => { 3769 currentContextRef.current = null; 3770 }; 3771 }, [currentContextRef]); 3772 return React21.useMemo(() => ({ 3773 hasProvider, 3774 delayRef, 3775 isInstantPhase 3776 }), [hasProvider, delayRef, isInstantPhase]); 3777 } 3778 3779 // node_modules/@base-ui/react/esm/floating-ui-react/components/FloatingFocusManager.js 3780 var React25 = __toESM(require_react(), 1); 3781 3782 // node_modules/@base-ui/utils/esm/mergeCleanups.js 3783 function mergeCleanups(...cleanups) { 3784 return () => { 3785 for (let i2 = 0; i2 < cleanups.length; i2 += 1) { 3786 const cleanup = cleanups[i2]; 3787 if (cleanup) { 3788 cleanup(); 3789 } 3790 } 3791 }; 3792 } 3793 3794 // node_modules/@base-ui/utils/esm/useValueAsRef.js 3795 function useValueAsRef(value) { 3796 const latest = useRefWithInit(createLatestRef, value).current; 3797 latest.next = value; 3798 useIsoLayoutEffect(latest.effect); 3799 return latest; 3800 } 3801 function createLatestRef(value) { 3802 const latest = { 3803 current: value, 3804 next: value, 3805 effect: () => { 3806 latest.current = latest.next; 3807 } 3808 }; 3809 return latest; 3810 } 3811 3812 // node_modules/@base-ui/react/esm/utils/FocusGuard.js 3813 var React22 = __toESM(require_react(), 1); 3814 3815 // node_modules/@base-ui/utils/esm/visuallyHidden.js 3816 var visuallyHiddenBase = { 3817 clipPath: "inset(50%)", 3818 overflow: "hidden", 3819 whiteSpace: "nowrap", 3820 border: 0, 3821 padding: 0, 3822 width: 1, 3823 height: 1, 3824 margin: -1 3825 }; 3826 var visuallyHidden = { 3827 ...visuallyHiddenBase, 3828 position: "fixed", 3829 top: 0, 3830 left: 0 3831 }; 3832 var visuallyHiddenInput = { 3833 ...visuallyHiddenBase, 3834 position: "absolute" 3835 }; 3836 3837 // node_modules/@base-ui/react/esm/utils/FocusGuard.js 3838 var import_jsx_runtime2 = __toESM(require_jsx_runtime(), 1); 3839 var FocusGuard = /* @__PURE__ */ React22.forwardRef(function FocusGuard2(props, ref) { 3840 const [role, setRole] = React22.useState(); 3841 useIsoLayoutEffect(() => { 3842 if (isSafari) { 3843 setRole("button"); 3844 } 3845 }, []); 3846 const restProps = { 3847 tabIndex: 0, 3848 // Role is only for VoiceOver 3849 role 3850 }; 3851 return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { 3852 ...props, 3853 ref, 3854 style: visuallyHidden, 3855 "aria-hidden": role ? void 0 : true, 3856 ...restProps, 3857 "data-base-ui-focus-guard": "" 3858 }); 3859 }); 3860 if (true) FocusGuard.displayName = "FocusGuard"; 3861 3862 // node_modules/@base-ui/react/esm/floating-ui-react/utils/createAttribute.js 3863 function createAttribute(name) { 3864 return `data-base-ui-$name}`; 3865 } 3866 3867 // node_modules/@base-ui/react/esm/floating-ui-react/utils/enqueueFocus.js 3868 var rafId = 0; 3869 function enqueueFocus(el, options = {}) { 3870 const { 3871 preventScroll = false, 3872 cancelPrevious = true, 3873 sync: sync2 = false 3874 } = options; 3875 if (cancelPrevious) { 3876 cancelAnimationFrame(rafId); 3877 } 3878 const exec = () => el?.focus({ 3879 preventScroll 3880 }); 3881 if (sync2) { 3882 exec(); 3883 return NOOP; 3884 } 3885 const currentRafId = requestAnimationFrame(exec); 3886 rafId = currentRafId; 3887 return () => { 3888 if (rafId === currentRafId) { 3889 cancelAnimationFrame(currentRafId); 3890 rafId = 0; 3891 } 3892 }; 3893 } 3894 3895 // node_modules/@base-ui/react/esm/floating-ui-react/utils/markOthers.js 3896 var counters = { 3897 inert: /* @__PURE__ */ new WeakMap(), 3898 "aria-hidden": /* @__PURE__ */ new WeakMap() 3899 }; 3900 var markerName = "data-base-ui-inert"; 3901 var uncontrolledElementsSets = { 3902 inert: /* @__PURE__ */ new WeakSet(), 3903 "aria-hidden": /* @__PURE__ */ new WeakSet() 3904 }; 3905 var markerCounterMap = /* @__PURE__ */ new WeakMap(); 3906 var lockCount = 0; 3907 function getUncontrolledElementsSet(controlAttribute) { 3908 return uncontrolledElementsSets[controlAttribute]; 3909 } 3910 function unwrapHost(node) { 3911 if (!node) { 3912 return null; 3913 } 3914 return isShadowRoot(node) ? node.host : unwrapHost(node.parentNode); 3915 } 3916 var correctElements = (parent, targets) => targets.map((target) => { 3917 if (parent.contains(target)) { 3918 return target; 3919 } 3920 const correctedTarget = unwrapHost(target); 3921 if (parent.contains(correctedTarget)) { 3922 return correctedTarget; 3923 } 3924 return null; 3925 }).filter((x2) => x2 != null); 3926 var buildKeepSet = (targets) => { 3927 const keep = /* @__PURE__ */ new Set(); 3928 targets.forEach((target) => { 3929 let node = target; 3930 while (node && !keep.has(node)) { 3931 keep.add(node); 3932 node = node.parentNode; 3933 } 3934 }); 3935 return keep; 3936 }; 3937 var collectOutsideElements = (root, keepElements, stopElements) => { 3938 const outside = []; 3939 const walk = (parent) => { 3940 if (!parent || stopElements.has(parent)) { 3941 return; 3942 } 3943 Array.from(parent.children).forEach((node) => { 3944 if (getNodeName(node) === "script") { 3945 return; 3946 } 3947 if (keepElements.has(node)) { 3948 walk(node); 3949 } else { 3950 outside.push(node); 3951 } 3952 }); 3953 }; 3954 walk(root); 3955 return outside; 3956 }; 3957 function applyAttributeToOthers(uncorrectedAvoidElements, body, ariaHidden, inert, { 3958 mark = true, 3959 markerIgnoreElements = [] 3960 }) { 3961 const controlAttribute = inert ? "inert" : ariaHidden ? "aria-hidden" : null; 3962 let counterMap = null; 3963 let uncontrolledElementsSet = null; 3964 const avoidElements = correctElements(body, uncorrectedAvoidElements); 3965 const markerIgnoreTargets = mark ? correctElements(body, markerIgnoreElements) : []; 3966 const markerIgnoreSet = new Set(markerIgnoreTargets); 3967 const markerTargets = mark ? collectOutsideElements(body, buildKeepSet(avoidElements), new Set(avoidElements)).filter((target) => !markerIgnoreSet.has(target)) : []; 3968 const hiddenElements = []; 3969 const markedElements = []; 3970 if (controlAttribute) { 3971 const map = counters[controlAttribute]; 3972 const currentUncontrolledElementsSet = getUncontrolledElementsSet(controlAttribute); 3973 uncontrolledElementsSet = currentUncontrolledElementsSet; 3974 counterMap = map; 3975 const ariaLiveElements = correctElements(body, Array.from(body.querySelectorAll("[aria-live]"))); 3976 const controlElements = avoidElements.concat(ariaLiveElements); 3977 const controlTargets = collectOutsideElements(body, buildKeepSet(controlElements), new Set(controlElements)); 3978 controlTargets.forEach((node) => { 3979 const attr2 = node.getAttribute(controlAttribute); 3980 const alreadyHidden = attr2 !== null && attr2 !== "false"; 3981 const counterValue = (map.get(node) || 0) + 1; 3982 map.set(node, counterValue); 3983 hiddenElements.push(node); 3984 if (counterValue === 1 && alreadyHidden) { 3985 currentUncontrolledElementsSet.add(node); 3986 } 3987 if (!alreadyHidden) { 3988 node.setAttribute(controlAttribute, controlAttribute === "inert" ? "" : "true"); 3989 } 3990 }); 3991 } 3992 if (mark) { 3993 markerTargets.forEach((node) => { 3994 const markerValue = (markerCounterMap.get(node) || 0) + 1; 3995 markerCounterMap.set(node, markerValue); 3996 markedElements.push(node); 3997 if (markerValue === 1) { 3998 node.setAttribute(markerName, ""); 3999 } 4000 }); 4001 } 4002 lockCount += 1; 4003 return () => { 4004 if (counterMap) { 4005 hiddenElements.forEach((element) => { 4006 const currentCounterValue = counterMap.get(element) || 0; 4007 const counterValue = currentCounterValue - 1; 4008 counterMap.set(element, counterValue); 4009 if (!counterValue) { 4010 if (!uncontrolledElementsSet?.has(element) && controlAttribute) { 4011 element.removeAttribute(controlAttribute); 4012 } 4013 uncontrolledElementsSet?.delete(element); 4014 } 4015 }); 4016 } 4017 if (mark) { 4018 markedElements.forEach((element) => { 4019 const markerValue = (markerCounterMap.get(element) || 0) - 1; 4020 markerCounterMap.set(element, markerValue); 4021 if (!markerValue) { 4022 element.removeAttribute(markerName); 4023 } 4024 }); 4025 } 4026 lockCount -= 1; 4027 if (!lockCount) { 4028 counters.inert = /* @__PURE__ */ new WeakMap(); 4029 counters["aria-hidden"] = /* @__PURE__ */ new WeakMap(); 4030 uncontrolledElementsSets.inert = /* @__PURE__ */ new WeakSet(); 4031 uncontrolledElementsSets["aria-hidden"] = /* @__PURE__ */ new WeakSet(); 4032 markerCounterMap = /* @__PURE__ */ new WeakMap(); 4033 } 4034 }; 4035 } 4036 function markOthers(avoidElements, options = {}) { 4037 const { 4038 ariaHidden = false, 4039 inert = false, 4040 mark = true, 4041 markerIgnoreElements = [] 4042 } = options; 4043 const body = ownerDocument(avoidElements[0]).body; 4044 return applyAttributeToOthers(avoidElements, body, ariaHidden, inert, { 4045 mark, 4046 markerIgnoreElements 4047 }); 4048 } 4049 4050 // node_modules/@base-ui/react/esm/floating-ui-react/components/FloatingPortal.js 4051 var React23 = __toESM(require_react(), 1); 4052 var ReactDOM2 = __toESM(require_react_dom(), 1); 4053 4054 // node_modules/@base-ui/react/esm/internals/constants.js 4055 var DISABLED_TRANSITIONS_STYLE = { 4056 style: { 4057 transition: "none" 4058 } 4059 }; 4060 var CLICK_TRIGGER_IDENTIFIER = "data-base-ui-click-trigger"; 4061 var BASE_UI_SWIPE_IGNORE_ATTRIBUTE = "data-base-ui-swipe-ignore"; 4062 var LEGACY_SWIPE_IGNORE_ATTRIBUTE = "data-swipe-ignore"; 4063 var BASE_UI_SWIPE_IGNORE_SELECTOR = `[$BASE_UI_SWIPE_IGNORE_ATTRIBUTE}]`; 4064 var LEGACY_SWIPE_IGNORE_SELECTOR = `[$LEGACY_SWIPE_IGNORE_ATTRIBUTE}]`; 4065 var POPUP_COLLISION_AVOIDANCE = { 4066 fallbackAxisSide: "end" 4067 }; 4068 var ownerVisuallyHidden = { 4069 clipPath: "inset(50%)", 4070 position: "fixed", 4071 top: 0, 4072 left: 0 4073 }; 4074 4075 // node_modules/@base-ui/react/esm/floating-ui-react/components/FloatingPortal.js 4076 var import_jsx_runtime3 = __toESM(require_jsx_runtime(), 1); 4077 var PortalContext = /* @__PURE__ */ React23.createContext(null); 4078 if (true) PortalContext.displayName = "PortalContext"; 4079 var usePortalContext = () => React23.useContext(PortalContext); 4080 var attr = createAttribute("portal"); 4081 function useFloatingPortalNode(props = {}) { 4082 const { 4083 ref, 4084 container: containerProp, 4085 componentProps = EMPTY_OBJECT, 4086 elementProps 4087 } = props; 4088 const uniqueId = useId(); 4089 const portalContext = usePortalContext(); 4090 const parentPortalNode = portalContext?.portalNode; 4091 const [containerElement, setContainerElement] = React23.useState(null); 4092 const [portalNode, setPortalNode] = React23.useState(null); 4093 const setPortalNodeRef = useStableCallback((node) => { 4094 if (node !== null) { 4095 setPortalNode(node); 4096 } 4097 }); 4098 const containerRef = React23.useRef(null); 4099 useIsoLayoutEffect(() => { 4100 if (containerProp === null) { 4101 if (containerRef.current) { 4102 containerRef.current = null; 4103 setPortalNode(null); 4104 setContainerElement(null); 4105 } 4106 return; 4107 } 4108 if (uniqueId == null) { 4109 return; 4110 } 4111 const resolvedContainer = (containerProp && (isNode(containerProp) ? containerProp : containerProp.current)) ?? parentPortalNode ?? document.body; 4112 if (resolvedContainer == null) { 4113 if (containerRef.current) { 4114 containerRef.current = null; 4115 setPortalNode(null); 4116 setContainerElement(null); 4117 } 4118 return; 4119 } 4120 if (containerRef.current !== resolvedContainer) { 4121 containerRef.current = resolvedContainer; 4122 setPortalNode(null); 4123 setContainerElement(resolvedContainer); 4124 } 4125 }, [containerProp, parentPortalNode, uniqueId]); 4126 const portalElement = useRenderElement("div", componentProps, { 4127 ref: [ref, setPortalNodeRef], 4128 props: [{ 4129 id: uniqueId, 4130 [attr]: "" 4131 }, elementProps] 4132 }); 4133 const portalSubtree = containerElement && portalElement ? /* @__PURE__ */ ReactDOM2.createPortal(portalElement, containerElement) : null; 4134 return { 4135 portalNode, 4136 portalSubtree 4137 }; 4138 } 4139 var FloatingPortal = /* @__PURE__ */ React23.forwardRef(function FloatingPortal2(componentProps, forwardedRef) { 4140 const { 4141 children, 4142 container, 4143 className, 4144 render: render4, 4145 renderGuards, 4146 style, 4147 ...elementProps 4148 } = componentProps; 4149 const { 4150 portalNode, 4151 portalSubtree 4152 } = useFloatingPortalNode({ 4153 container, 4154 ref: forwardedRef, 4155 componentProps, 4156 elementProps 4157 }); 4158 const beforeOutsideRef = React23.useRef(null); 4159 const afterOutsideRef = React23.useRef(null); 4160 const beforeInsideRef = React23.useRef(null); 4161 const afterInsideRef = React23.useRef(null); 4162 const [focusManagerState, setFocusManagerState] = React23.useState(null); 4163 const focusInsideDisabledRef = React23.useRef(false); 4164 const modal = focusManagerState?.modal; 4165 const open = focusManagerState?.open; 4166 const shouldRenderGuards = typeof renderGuards === "boolean" ? renderGuards : !!focusManagerState && !focusManagerState.modal && focusManagerState.open && !!portalNode; 4167 React23.useEffect(() => { 4168 if (!portalNode || modal) { 4169 return void 0; 4170 } 4171 function onFocus(event) { 4172 if (portalNode && event.relatedTarget && isOutsideEvent(event)) { 4173 if (event.type === "focusin") { 4174 if (focusInsideDisabledRef.current) { 4175 enableFocusInside(portalNode); 4176 focusInsideDisabledRef.current = false; 4177 } 4178 } else { 4179 disableFocusInside(portalNode); 4180 focusInsideDisabledRef.current = true; 4181 } 4182 } 4183 } 4184 return mergeCleanups(addEventListener(portalNode, "focusin", onFocus, true), addEventListener(portalNode, "focusout", onFocus, true)); 4185 }, [portalNode, modal]); 4186 React23.useEffect(() => { 4187 if (!portalNode || open !== false) { 4188 return; 4189 } 4190 enableFocusInside(portalNode); 4191 focusInsideDisabledRef.current = false; 4192 }, [open, portalNode]); 4193 const portalContextValue = React23.useMemo(() => ({ 4194 beforeOutsideRef, 4195 afterOutsideRef, 4196 beforeInsideRef, 4197 afterInsideRef, 4198 portalNode, 4199 setFocusManagerState 4200 }), [portalNode]); 4201 return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(React23.Fragment, { 4202 children: [portalSubtree, /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(PortalContext.Provider, { 4203 value: portalContextValue, 4204 children: [shouldRenderGuards && portalNode && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(FocusGuard, { 4205 "data-type": "outside", 4206 ref: beforeOutsideRef, 4207 onFocus: (event) => { 4208 if (isOutsideEvent(event, portalNode)) { 4209 beforeInsideRef.current?.focus(); 4210 } else { 4211 const domReference = focusManagerState ? focusManagerState.domReference : null; 4212 const prevTabbable = getPreviousTabbable(domReference); 4213 prevTabbable?.focus(); 4214 } 4215 } 4216 }), shouldRenderGuards && portalNode && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { 4217 "aria-owns": portalNode.id, 4218 style: ownerVisuallyHidden 4219 }), portalNode && /* @__PURE__ */ ReactDOM2.createPortal(children, portalNode), shouldRenderGuards && portalNode && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(FocusGuard, { 4220 "data-type": "outside", 4221 ref: afterOutsideRef, 4222 onFocus: (event) => { 4223 if (isOutsideEvent(event, portalNode)) { 4224 afterInsideRef.current?.focus(); 4225 } else { 4226 const domReference = focusManagerState ? focusManagerState.domReference : null; 4227 const nextTabbable = getNextTabbable(domReference); 4228 nextTabbable?.focus(); 4229 if (focusManagerState?.closeOnFocusOut) { 4230 focusManagerState?.onOpenChange(false, createChangeEventDetails(reason_parts_exports.focusOut, event.nativeEvent)); 4231 } 4232 } 4233 } 4234 })] 4235 })] 4236 }); 4237 }); 4238 if (true) FloatingPortal.displayName = "FloatingPortal"; 4239 4240 // node_modules/@base-ui/react/esm/floating-ui-react/components/FloatingTree.js 4241 var React24 = __toESM(require_react(), 1); 4242 4243 // node_modules/@base-ui/react/esm/floating-ui-react/utils/createEventEmitter.js 4244 function createEventEmitter() { 4245 const map = /* @__PURE__ */ new Map(); 4246 return { 4247 emit(event, data) { 4248 map.get(event)?.forEach((listener) => listener(data)); 4249 }, 4250 on(event, listener) { 4251 if (!map.has(event)) { 4252 map.set(event, /* @__PURE__ */ new Set()); 4253 } 4254 map.get(event).add(listener); 4255 }, 4256 off(event, listener) { 4257 map.get(event)?.delete(listener); 4258 } 4259 }; 4260 } 4261 4262 // node_modules/@base-ui/react/esm/floating-ui-react/components/FloatingTree.js 4263 var import_jsx_runtime4 = __toESM(require_jsx_runtime(), 1); 4264 var FloatingNodeContext = /* @__PURE__ */ React24.createContext(null); 4265 if (true) FloatingNodeContext.displayName = "FloatingNodeContext"; 4266 var FloatingTreeContext = /* @__PURE__ */ React24.createContext(null); 4267 if (true) FloatingTreeContext.displayName = "FloatingTreeContext"; 4268 var useFloatingParentNodeId = () => React24.useContext(FloatingNodeContext)?.id || null; 4269 var useFloatingTree = (externalTree) => { 4270 const contextTree = React24.useContext(FloatingTreeContext); 4271 return externalTree ?? contextTree; 4272 }; 4273 4274 // node_modules/@base-ui/react/esm/floating-ui-react/components/FloatingFocusManager.js 4275 var import_jsx_runtime5 = __toESM(require_jsx_runtime(), 1); 4276 function getEventType(event, lastInteractionType) { 4277 const win = getWindow(getTarget(event)); 4278 if (event instanceof win.KeyboardEvent) { 4279 return "keyboard"; 4280 } 4281 if (event instanceof win.FocusEvent) { 4282 return lastInteractionType || "keyboard"; 4283 } 4284 if ("pointerType" in event) { 4285 return event.pointerType || "keyboard"; 4286 } 4287 if ("touches" in event) { 4288 return "touch"; 4289 } 4290 if (event instanceof win.MouseEvent) { 4291 return lastInteractionType || (event.detail === 0 ? "keyboard" : "mouse"); 4292 } 4293 return ""; 4294 } 4295 var LIST_LIMIT = 20; 4296 var previouslyFocusedElements = []; 4297 function clearDisconnectedPreviouslyFocusedElements() { 4298 previouslyFocusedElements = previouslyFocusedElements.filter((entry) => { 4299 return entry.deref()?.isConnected; 4300 }); 4301 } 4302 function addPreviouslyFocusedElement(element) { 4303 clearDisconnectedPreviouslyFocusedElements(); 4304 if (element && getNodeName(element) !== "body") { 4305 previouslyFocusedElements.push(new WeakRef(element)); 4306 if (previouslyFocusedElements.length > LIST_LIMIT) { 4307 previouslyFocusedElements = previouslyFocusedElements.slice(-LIST_LIMIT); 4308 } 4309 } 4310 } 4311 function getPreviouslyFocusedElement() { 4312 clearDisconnectedPreviouslyFocusedElements(); 4313 return previouslyFocusedElements[previouslyFocusedElements.length - 1]?.deref(); 4314 } 4315 function getFirstTabbableElement(container) { 4316 if (!container) { 4317 return null; 4318 } 4319 if (isTabbable(container)) { 4320 return container; 4321 } 4322 return tabbable(container)[0] || container; 4323 } 4324 function handleTabIndex(floatingFocusElement, orderRef) { 4325 if (floatingFocusElement.hasAttribute("tabindex") && !floatingFocusElement.hasAttribute("data-tabindex")) { 4326 return; 4327 } 4328 if (!orderRef.current.includes("floating") && !floatingFocusElement.getAttribute("role")?.includes("dialog")) { 4329 return; 4330 } 4331 const focusableElements = focusable(floatingFocusElement); 4332 const tabbableContent = focusableElements.filter((element) => { 4333 const dataTabIndex = element.getAttribute("data-tabindex") || ""; 4334 return isTabbable(element) || element.hasAttribute("data-tabindex") && !dataTabIndex.startsWith("-"); 4335 }); 4336 const tabIndex = floatingFocusElement.getAttribute("tabindex"); 4337 if (orderRef.current.includes("floating") || tabbableContent.length === 0) { 4338 if (tabIndex !== "0") { 4339 floatingFocusElement.setAttribute("tabindex", "0"); 4340 } 4341 } else if (tabIndex !== "-1" || floatingFocusElement.hasAttribute("data-tabindex") && floatingFocusElement.getAttribute("data-tabindex") !== "-1") { 4342 floatingFocusElement.setAttribute("tabindex", "-1"); 4343 floatingFocusElement.setAttribute("data-tabindex", "-1"); 4344 } 4345 } 4346 function FloatingFocusManager(props) { 4347 const { 4348 context, 4349 children, 4350 disabled: disabled2 = false, 4351 initialFocus = true, 4352 returnFocus = true, 4353 restoreFocus = false, 4354 modal = true, 4355 closeOnFocusOut = true, 4356 openInteractionType = "", 4357 nextFocusableElement, 4358 previousFocusableElement, 4359 beforeContentFocusGuardRef, 4360 externalTree, 4361 getInsideElements 4362 } = props; 4363 const store = "rootStore" in context ? context.rootStore : context; 4364 const open = store.useState("open"); 4365 const domReference = store.useState("domReferenceElement"); 4366 const floating = store.useState("floatingElement"); 4367 const { 4368 events: events2, 4369 dataRef 4370 } = store.context; 4371 const getNodeId = useStableCallback(() => dataRef.current.floatingContext?.nodeId); 4372 const ignoreInitialFocus = initialFocus === false; 4373 const isUntrappedTypeableCombobox = isTypeableCombobox(domReference) && ignoreInitialFocus; 4374 const orderRef = React25.useRef(["content"]); 4375 const initialFocusRef = useValueAsRef(initialFocus); 4376 const returnFocusRef = useValueAsRef(returnFocus); 4377 const openInteractionTypeRef = useValueAsRef(openInteractionType); 4378 const tree = useFloatingTree(externalTree); 4379 const portalContext = usePortalContext(); 4380 const preventReturnFocusRef = React25.useRef(false); 4381 const isPointerDownRef = React25.useRef(false); 4382 const pointerDownOutsideRef = React25.useRef(false); 4383 const lastFocusedTabbableRef = React25.useRef(null); 4384 const closeTypeRef = React25.useRef(""); 4385 const lastInteractionTypeRef = React25.useRef(""); 4386 const beforeGuardRef = React25.useRef(null); 4387 const afterGuardRef = React25.useRef(null); 4388 const mergedBeforeGuardRef = useMergedRefs(beforeGuardRef, beforeContentFocusGuardRef, portalContext?.beforeInsideRef); 4389 const mergedAfterGuardRef = useMergedRefs(afterGuardRef, portalContext?.afterInsideRef); 4390 const blurTimeout = useTimeout(); 4391 const pointerDownTimeout = useTimeout(); 4392 const restoreFocusFrame = useAnimationFrame(); 4393 const isInsidePortal = portalContext != null; 4394 const floatingFocusElement = getFloatingFocusElement(floating); 4395 const getTabbableContent = useStableCallback((container = floatingFocusElement) => { 4396 return container ? tabbable(container) : []; 4397 }); 4398 const getResolvedInsideElements = useStableCallback(() => getInsideElements?.().filter((element) => element != null) ?? []); 4399 React25.useEffect(() => { 4400 if (disabled2 || !modal) { 4401 return void 0; 4402 } 4403 function onKeyDown(event) { 4404 if (event.key === "Tab") { 4405 if (contains(floatingFocusElement, activeElement(ownerDocument(floatingFocusElement))) && getTabbableContent().length === 0 && !isUntrappedTypeableCombobox) { 4406 stopEvent(event); 4407 } 4408 } 4409 } 4410 const doc = ownerDocument(floatingFocusElement); 4411 return addEventListener(doc, "keydown", onKeyDown); 4412 }, [disabled2, domReference, floatingFocusElement, modal, orderRef, isUntrappedTypeableCombobox, getTabbableContent]); 4413 React25.useEffect(() => { 4414 if (disabled2 || !open) { 4415 return void 0; 4416 } 4417 const doc = ownerDocument(floatingFocusElement); 4418 function clearPointerDownOutside() { 4419 pointerDownOutsideRef.current = false; 4420 } 4421 function onPointerDown(event) { 4422 const target = getTarget(event); 4423 const insideElements = getResolvedInsideElements(); 4424 const pointerTargetInside = contains(floating, target) || contains(domReference, target) || contains(portalContext?.portalNode, target) || insideElements.some((element) => element === target || contains(element, target)); 4425 pointerDownOutsideRef.current = !pointerTargetInside; 4426 lastInteractionTypeRef.current = event.pointerType || "keyboard"; 4427 if (target?.closest(`[$CLICK_TRIGGER_IDENTIFIER}]`)) { 4428 isPointerDownRef.current = true; 4429 } 4430 } 4431 function onKeyDown() { 4432 lastInteractionTypeRef.current = "keyboard"; 4433 } 4434 return mergeCleanups(addEventListener(doc, "pointerdown", onPointerDown, true), addEventListener(doc, "pointerup", clearPointerDownOutside, true), addEventListener(doc, "pointercancel", clearPointerDownOutside, true), addEventListener(doc, "keydown", onKeyDown, true)); 4435 }, [disabled2, floating, domReference, floatingFocusElement, open, portalContext, getResolvedInsideElements]); 4436 React25.useEffect(() => { 4437 if (disabled2 || !closeOnFocusOut) { 4438 return void 0; 4439 } 4440 const doc = ownerDocument(floatingFocusElement); 4441 function handlePointerDown() { 4442 isPointerDownRef.current = true; 4443 pointerDownTimeout.start(0, () => { 4444 isPointerDownRef.current = false; 4445 }); 4446 } 4447 function handleFocusIn(event) { 4448 const target = getTarget(event); 4449 if (isTabbable(target)) { 4450 lastFocusedTabbableRef.current = target; 4451 } 4452 } 4453 function handleFocusOutside(event) { 4454 const relatedTarget = event.relatedTarget; 4455 const currentTarget = event.currentTarget; 4456 const target = getTarget(event); 4457 queueMicrotask(() => { 4458 const nodeId = getNodeId(); 4459 const triggers = store.context.triggerElements; 4460 const insideElements = getResolvedInsideElements(); 4461 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); 4462 const movedToUnrelatedNode = !(contains(domReference, relatedTarget) || contains(floating, relatedTarget) || contains(relatedTarget, floating) || contains(portalContext?.portalNode, relatedTarget) || insideElements.some((element) => element === relatedTarget || contains(element, relatedTarget)) || relatedTarget != null && triggers.hasElement(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))); 4463 if (currentTarget === domReference && floatingFocusElement) { 4464 handleTabIndex(floatingFocusElement, orderRef); 4465 } 4466 if (restoreFocus && currentTarget !== domReference && !isElementVisible(target) && activeElement(doc) === doc.body) { 4467 if (isHTMLElement(floatingFocusElement)) { 4468 floatingFocusElement.focus(); 4469 if (restoreFocus === "popup") { 4470 restoreFocusFrame.request(() => { 4471 floatingFocusElement.focus(); 4472 }); 4473 return; 4474 } 4475 } 4476 const tabbableContent = getTabbableContent(); 4477 const prevTabbable = lastFocusedTabbableRef.current; 4478 const nodeToFocus = (prevTabbable && tabbableContent.includes(prevTabbable) ? prevTabbable : null) || tabbableContent[tabbableContent.length - 1] || floatingFocusElement; 4479 if (isHTMLElement(nodeToFocus)) { 4480 nodeToFocus.focus(); 4481 } 4482 } 4483 if (dataRef.current.insideReactTree) { 4484 dataRef.current.insideReactTree = false; 4485 return; 4486 } 4487 if ((isUntrappedTypeableCombobox ? true : !modal) && relatedTarget && movedToUnrelatedNode && !isPointerDownRef.current && // Fix React 18 Strict Mode returnFocus due to double rendering. 4488 // For an "untrapped" typeable combobox (input role=combobox with 4489 // initialFocus=false), re-opening the popup and tabbing out should still close it even 4490 // when the previously focused element (e.g. the next tabbable outside the popup) is 4491 // focused again. Otherwise, the popup remains open on the second Tab sequence: 4492 // click input -> Tab (closes) -> click input -> Tab. 4493 // Allow closing when `isUntrappedTypeableCombobox` regardless of the previously focused element. 4494 (isUntrappedTypeableCombobox || relatedTarget !== getPreviouslyFocusedElement())) { 4495 preventReturnFocusRef.current = true; 4496 store.setOpen(false, createChangeEventDetails(reason_parts_exports.focusOut, event)); 4497 } 4498 }); 4499 } 4500 function markInsideReactTree() { 4501 if (pointerDownOutsideRef.current) { 4502 return; 4503 } 4504 dataRef.current.insideReactTree = true; 4505 blurTimeout.start(0, () => { 4506 dataRef.current.insideReactTree = false; 4507 }); 4508 } 4509 const domReferenceElement = isHTMLElement(domReference) ? domReference : null; 4510 if (!floating && !domReferenceElement) { 4511 return void 0; 4512 } 4513 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)); 4514 }, [disabled2, domReference, floating, floatingFocusElement, modal, tree, portalContext, store, closeOnFocusOut, restoreFocus, getTabbableContent, isUntrappedTypeableCombobox, getNodeId, orderRef, dataRef, blurTimeout, pointerDownTimeout, restoreFocusFrame, nextFocusableElement, previousFocusableElement, getResolvedInsideElements]); 4515 React25.useEffect(() => { 4516 if (disabled2 || !floating || !open) { 4517 return void 0; 4518 } 4519 const portalNodes = Array.from(portalContext?.portalNode?.querySelectorAll(`[$createAttribute("portal")}]`) || []); 4520 const ancestors = tree ? getNodeAncestors(tree.nodesRef.current, getNodeId()) : []; 4521 const rootAncestorComboboxDomReference = ancestors.find((node) => isTypeableCombobox(node.context?.elements.domReference || null))?.context?.elements.domReference; 4522 const controlInsideElements = [floating, ...portalNodes, beforeGuardRef.current, afterGuardRef.current, portalContext?.beforeOutsideRef.current, portalContext?.afterOutsideRef.current, ...getResolvedInsideElements()]; 4523 const insideElements = [...controlInsideElements, rootAncestorComboboxDomReference, resolveRef(previousFocusableElement), resolveRef(nextFocusableElement), isUntrappedTypeableCombobox ? domReference : null].filter((x2) => x2 != null); 4524 const ariaHiddenCleanup = markOthers(insideElements, { 4525 ariaHidden: modal || isUntrappedTypeableCombobox, 4526 mark: false 4527 }); 4528 const markerInsideElements = [floating, ...portalNodes].filter((x2) => x2 != null); 4529 const markerCleanup = markOthers(markerInsideElements); 4530 return () => { 4531 markerCleanup(); 4532 ariaHiddenCleanup(); 4533 }; 4534 }, [open, disabled2, domReference, floating, modal, orderRef, portalContext, isUntrappedTypeableCombobox, tree, getNodeId, nextFocusableElement, previousFocusableElement, getResolvedInsideElements]); 4535 useIsoLayoutEffect(() => { 4536 if (!open || disabled2 || !isHTMLElement(floatingFocusElement)) { 4537 return; 4538 } 4539 const doc = ownerDocument(floatingFocusElement); 4540 const previouslyFocusedElement = activeElement(doc); 4541 queueMicrotask(() => { 4542 const initialFocusValueOrFn = initialFocusRef.current; 4543 const resolvedInitialFocus = typeof initialFocusValueOrFn === "function" ? initialFocusValueOrFn(openInteractionTypeRef.current || "") : initialFocusValueOrFn; 4544 if (resolvedInitialFocus === void 0 || resolvedInitialFocus === false) { 4545 return; 4546 } 4547 const focusAlreadyInsideFloatingEl = contains(floatingFocusElement, previouslyFocusedElement); 4548 if (focusAlreadyInsideFloatingEl) { 4549 return; 4550 } 4551 let focusableElements = null; 4552 const getDefaultFocusElement = () => { 4553 if (focusableElements == null) { 4554 focusableElements = getTabbableContent(floatingFocusElement); 4555 } 4556 return focusableElements[0] || floatingFocusElement; 4557 }; 4558 let elToFocus; 4559 if (resolvedInitialFocus === true || resolvedInitialFocus === null) { 4560 elToFocus = getDefaultFocusElement(); 4561 } else { 4562 elToFocus = resolveRef(resolvedInitialFocus); 4563 } 4564 elToFocus = elToFocus || getDefaultFocusElement(); 4565 enqueueFocus(elToFocus, { 4566 preventScroll: elToFocus === floatingFocusElement 4567 }); 4568 }); 4569 }, [disabled2, open, floatingFocusElement, ignoreInitialFocus, getTabbableContent, initialFocusRef, openInteractionTypeRef]); 4570 useIsoLayoutEffect(() => { 4571 if (disabled2 || !floatingFocusElement) { 4572 return void 0; 4573 } 4574 const doc = ownerDocument(floatingFocusElement); 4575 const previouslyFocusedElement = activeElement(doc); 4576 addPreviouslyFocusedElement(previouslyFocusedElement); 4577 function onOpenChangeLocal(details) { 4578 if (!details.open) { 4579 closeTypeRef.current = getEventType(details.nativeEvent, lastInteractionTypeRef.current); 4580 } 4581 if (details.reason === reason_parts_exports.triggerHover && details.nativeEvent.type === "mouseleave") { 4582 preventReturnFocusRef.current = true; 4583 } 4584 if (details.reason !== reason_parts_exports.outsidePress) { 4585 return; 4586 } 4587 if (details.nested) { 4588 preventReturnFocusRef.current = false; 4589 } else if (isVirtualClick(details.nativeEvent) || isVirtualPointerEvent(details.nativeEvent)) { 4590 preventReturnFocusRef.current = false; 4591 } else { 4592 let isPreventScrollSupported = false; 4593 ownerDocument(floatingFocusElement).createElement("div").focus({ 4594 get preventScroll() { 4595 isPreventScrollSupported = true; 4596 return false; 4597 } 4598 }); 4599 if (isPreventScrollSupported) { 4600 preventReturnFocusRef.current = false; 4601 } else { 4602 preventReturnFocusRef.current = true; 4603 } 4604 } 4605 } 4606 events2.on("openchange", onOpenChangeLocal); 4607 function getReturnElement() { 4608 const returnFocusValueOrFn = returnFocusRef.current; 4609 let resolvedReturnFocusValue = typeof returnFocusValueOrFn === "function" ? returnFocusValueOrFn(closeTypeRef.current) : returnFocusValueOrFn; 4610 if (resolvedReturnFocusValue === void 0 || resolvedReturnFocusValue === false) { 4611 return null; 4612 } 4613 if (resolvedReturnFocusValue === null) { 4614 resolvedReturnFocusValue = true; 4615 } 4616 if (typeof resolvedReturnFocusValue === "boolean") { 4617 const el = domReference || getPreviouslyFocusedElement(); 4618 return el && el.isConnected ? el : null; 4619 } 4620 const fallback = domReference || getPreviouslyFocusedElement(); 4621 return resolveRef(resolvedReturnFocusValue) || fallback || null; 4622 } 4623 return () => { 4624 events2.off("openchange", onOpenChangeLocal); 4625 const activeEl = activeElement(doc); 4626 const insideElements = getResolvedInsideElements(); 4627 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)); 4628 const returnFocusValueOrFn = returnFocusRef.current; 4629 const returnElement = getReturnElement(); 4630 queueMicrotask(() => { 4631 const tabbableReturnElement = getFirstTabbableElement(returnElement); 4632 const hasExplicitReturnFocus = typeof returnFocusValueOrFn !== "boolean"; 4633 if (returnFocusValueOrFn && !preventReturnFocusRef.current && isHTMLElement(tabbableReturnElement) && // If the focus moved somewhere else after mount, avoid returning focus 4634 // since it likely entered a different element which should be 4635 // respected: https://github.com/floating-ui/floating-ui/issues/2607 4636 (!hasExplicitReturnFocus && tabbableReturnElement !== activeEl && activeEl !== doc.body ? isFocusInsideFloatingTree : true)) { 4637 tabbableReturnElement.focus({ 4638 preventScroll: true 4639 }); 4640 } 4641 preventReturnFocusRef.current = false; 4642 }); 4643 }; 4644 }, [disabled2, floating, floatingFocusElement, returnFocusRef, dataRef, events2, tree, domReference, getNodeId, getResolvedInsideElements]); 4645 useIsoLayoutEffect(() => { 4646 if (!isWebKit2 || open || !floating) { 4647 return; 4648 } 4649 const activeEl = activeElement(ownerDocument(floating)); 4650 if (!isHTMLElement(activeEl) || !isTypeableElement(activeEl)) { 4651 return; 4652 } 4653 if (contains(floating, activeEl)) { 4654 activeEl.blur(); 4655 } 4656 }, [open, floating]); 4657 useIsoLayoutEffect(() => { 4658 if (disabled2 || !portalContext) { 4659 return void 0; 4660 } 4661 portalContext.setFocusManagerState({ 4662 modal, 4663 closeOnFocusOut, 4664 open, 4665 onOpenChange: store.setOpen, 4666 domReference 4667 }); 4668 return () => { 4669 portalContext.setFocusManagerState(null); 4670 }; 4671 }, [disabled2, portalContext, modal, open, store, closeOnFocusOut, domReference]); 4672 useIsoLayoutEffect(() => { 4673 if (disabled2 || !floatingFocusElement) { 4674 return void 0; 4675 } 4676 handleTabIndex(floatingFocusElement, orderRef); 4677 return () => { 4678 queueMicrotask(clearDisconnectedPreviouslyFocusedElements); 4679 }; 4680 }, [disabled2, floatingFocusElement, orderRef]); 4681 const shouldRenderGuards = !disabled2 && (modal ? !isUntrappedTypeableCombobox : true) && (isInsidePortal || modal); 4682 return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(React25.Fragment, { 4683 children: [shouldRenderGuards && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(FocusGuard, { 4684 "data-type": "inside", 4685 ref: mergedBeforeGuardRef, 4686 onFocus: (event) => { 4687 if (modal) { 4688 const els = getTabbableContent(); 4689 enqueueFocus(els[els.length - 1]); 4690 } else if (portalContext?.portalNode) { 4691 preventReturnFocusRef.current = false; 4692 if (isOutsideEvent(event, portalContext.portalNode)) { 4693 const nextTabbable = getNextTabbable(domReference); 4694 nextTabbable?.focus(); 4695 } else { 4696 resolveRef(previousFocusableElement ?? portalContext.beforeOutsideRef)?.focus(); 4697 } 4698 } 4699 } 4700 }), children, shouldRenderGuards && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(FocusGuard, { 4701 "data-type": "inside", 4702 ref: mergedAfterGuardRef, 4703 onFocus: (event) => { 4704 if (modal) { 4705 enqueueFocus(getTabbableContent()[0]); 4706 } else if (portalContext?.portalNode) { 4707 if (closeOnFocusOut) { 4708 preventReturnFocusRef.current = true; 4709 } 4710 if (isOutsideEvent(event, portalContext.portalNode)) { 4711 const prevTabbable = getPreviousTabbable(domReference); 4712 prevTabbable?.focus(); 4713 } else { 4714 resolveRef(nextFocusableElement ?? portalContext.afterOutsideRef)?.focus(); 4715 } 4716 } 4717 } 4718 })] 4719 }); 4720 } 4721 4722 // node_modules/@base-ui/react/esm/floating-ui-react/hooks/useClick.js 4723 var React26 = __toESM(require_react(), 1); 4724 function useClick(context, props = {}) { 4725 const store = "rootStore" in context ? context.rootStore : context; 4726 const dataRef = store.context.dataRef; 4727 const { 4728 enabled = true, 4729 event: eventOption = "click", 4730 toggle = true, 4731 ignoreMouse = false, 4732 stickIfOpen = true, 4733 touchOpenDelay = 0, 4734 reason = reason_parts_exports.triggerPress 4735 } = props; 4736 const pointerTypeRef = React26.useRef(void 0); 4737 const frame = useAnimationFrame(); 4738 const touchOpenTimeout = useTimeout(); 4739 const reference = React26.useMemo(() => ({ 4740 onPointerDown(event) { 4741 pointerTypeRef.current = event.pointerType; 4742 }, 4743 onMouseDown(event) { 4744 const pointerType = pointerTypeRef.current; 4745 const nativeEvent = event.nativeEvent; 4746 const open = store.select("open"); 4747 if (event.button !== 0 || eventOption === "click" || isMouseLikePointerType(pointerType, true) && ignoreMouse) { 4748 return; 4749 } 4750 const openEvent = dataRef.current.openEvent; 4751 const openEventType = openEvent?.type; 4752 const hasClickedOnInactiveTrigger = store.select("domReferenceElement") !== event.currentTarget; 4753 const nextOpen = open && hasClickedOnInactiveTrigger || !(open && toggle && (openEvent && stickIfOpen ? openEventType === "click" || openEventType === "mousedown" : true)); 4754 const target = getTarget(nativeEvent); 4755 if (isTypeableElement(target)) { 4756 const details = createChangeEventDetails(reason, nativeEvent, target); 4757 if (nextOpen && pointerType === "touch" && touchOpenDelay > 0) { 4758 touchOpenTimeout.start(touchOpenDelay, () => { 4759 store.setOpen(true, details); 4760 }); 4761 } else { 4762 store.setOpen(nextOpen, details); 4763 } 4764 return; 4765 } 4766 const eventCurrentTarget = event.currentTarget; 4767 frame.request(() => { 4768 const details = createChangeEventDetails(reason, nativeEvent, eventCurrentTarget); 4769 if (nextOpen && pointerType === "touch" && touchOpenDelay > 0) { 4770 touchOpenTimeout.start(touchOpenDelay, () => { 4771 store.setOpen(true, details); 4772 }); 4773 } else { 4774 store.setOpen(nextOpen, details); 4775 } 4776 }); 4777 }, 4778 onClick(event) { 4779 if (eventOption === "mousedown-only") { 4780 return; 4781 } 4782 const pointerType = pointerTypeRef.current; 4783 if (eventOption === "mousedown" && pointerType) { 4784 pointerTypeRef.current = void 0; 4785 return; 4786 } 4787 if (isMouseLikePointerType(pointerType, true) && ignoreMouse) { 4788 return; 4789 } 4790 const open = store.select("open"); 4791 const openEvent = dataRef.current.openEvent; 4792 const hasClickedOnInactiveTrigger = store.select("domReferenceElement") !== event.currentTarget; 4793 const nextOpen = open && hasClickedOnInactiveTrigger || !(open && toggle && (openEvent && stickIfOpen ? isClickLikeEvent(openEvent) : true)); 4794 const details = createChangeEventDetails(reason, event.nativeEvent, event.currentTarget); 4795 if (nextOpen && pointerType === "touch" && touchOpenDelay > 0) { 4796 touchOpenTimeout.start(touchOpenDelay, () => { 4797 store.setOpen(true, details); 4798 }); 4799 } else { 4800 store.setOpen(nextOpen, details); 4801 } 4802 }, 4803 onKeyDown() { 4804 pointerTypeRef.current = void 0; 4805 } 4806 }), [dataRef, eventOption, ignoreMouse, store, stickIfOpen, toggle, frame, touchOpenTimeout, touchOpenDelay, reason]); 4807 return React26.useMemo(() => enabled ? { 4808 reference 4809 } : EMPTY_OBJECT, [enabled, reference]); 4810 } 4811 4812 // node_modules/@base-ui/react/esm/floating-ui-react/hooks/useClientPoint.js 4813 var React27 = __toESM(require_react(), 1); 4814 function createVirtualElement(domElement, data) { 4815 let offsetX = null; 4816 let offsetY = null; 4817 let isAutoUpdateEvent = false; 4818 return { 4819 contextElement: domElement || void 0, 4820 getBoundingClientRect() { 4821 const domRect = domElement?.getBoundingClientRect() || { 4822 width: 0, 4823 height: 0, 4824 x: 0, 4825 y: 0 4826 }; 4827 const isXAxis = data.axis === "x" || data.axis === "both"; 4828 const isYAxis = data.axis === "y" || data.axis === "both"; 4829 const canTrackCursorOnAutoUpdate = ["mouseenter", "mousemove"].includes(data.dataRef.current.openEvent?.type || "") && data.pointerType !== "touch"; 4830 let width = domRect.width; 4831 let height = domRect.height; 4832 let x2 = domRect.x; 4833 let y2 = domRect.y; 4834 if (offsetX == null && data.x && isXAxis) { 4835 offsetX = domRect.x - data.x; 4836 } 4837 if (offsetY == null && data.y && isYAxis) { 4838 offsetY = domRect.y - data.y; 4839 } 4840 x2 -= offsetX || 0; 4841 y2 -= offsetY || 0; 4842 width = 0; 4843 height = 0; 4844 if (!isAutoUpdateEvent || canTrackCursorOnAutoUpdate) { 4845 width = data.axis === "y" ? domRect.width : 0; 4846 height = data.axis === "x" ? domRect.height : 0; 4847 x2 = isXAxis && data.x != null ? data.x : x2; 4848 y2 = isYAxis && data.y != null ? data.y : y2; 4849 } else if (isAutoUpdateEvent && !canTrackCursorOnAutoUpdate) { 4850 height = data.axis === "x" ? domRect.height : height; 4851 width = data.axis === "y" ? domRect.width : width; 4852 } 4853 isAutoUpdateEvent = true; 4854 return { 4855 width, 4856 height, 4857 x: x2, 4858 y: y2, 4859 top: y2, 4860 right: x2 + width, 4861 bottom: y2 + height, 4862 left: x2 4863 }; 4864 } 4865 }; 4866 } 4867 function isMouseBasedEvent(event) { 4868 return event != null && event.clientX != null; 4869 } 4870 function useClientPoint(context, props = {}) { 4871 const store = "rootStore" in context ? context.rootStore : context; 4872 const open = store.useState("open"); 4873 const floating = store.useState("floatingElement"); 4874 const domReference = store.useState("domReferenceElement"); 4875 const dataRef = store.context.dataRef; 4876 const { 4877 enabled = true, 4878 axis = "both" 4879 } = props; 4880 const initialRef = React27.useRef(false); 4881 const cleanupListenerRef = React27.useRef(null); 4882 const [pointerType, setPointerType] = React27.useState(); 4883 const [reactive, setReactive] = React27.useState([]); 4884 const setReference = useStableCallback((newX, newY, referenceElement) => { 4885 if (initialRef.current) { 4886 return; 4887 } 4888 if (dataRef.current.openEvent && !isMouseBasedEvent(dataRef.current.openEvent)) { 4889 return; 4890 } 4891 store.set("positionReference", createVirtualElement(referenceElement ?? domReference, { 4892 x: newX, 4893 y: newY, 4894 axis, 4895 dataRef, 4896 pointerType 4897 })); 4898 }); 4899 const handleReferenceEnterOrMove = useStableCallback((event) => { 4900 if (!open) { 4901 setReference(event.clientX, event.clientY, event.currentTarget); 4902 } else if (!cleanupListenerRef.current) { 4903 setReactive([]); 4904 } 4905 }); 4906 const openCheck = isMouseLikePointerType(pointerType) ? floating : open; 4907 const addListener = React27.useCallback(() => { 4908 if (!openCheck || !enabled) { 4909 return void 0; 4910 } 4911 const win = getWindow(floating); 4912 function handleMouseMove(event) { 4913 const target = getTarget(event); 4914 if (!contains(floating, target)) { 4915 setReference(event.clientX, event.clientY); 4916 } else { 4917 cleanupListenerRef.current?.(); 4918 cleanupListenerRef.current = null; 4919 } 4920 } 4921 if (!dataRef.current.openEvent || isMouseBasedEvent(dataRef.current.openEvent)) { 4922 const cleanup = () => { 4923 cleanupListenerRef.current?.(); 4924 cleanupListenerRef.current = null; 4925 }; 4926 cleanupListenerRef.current = addEventListener(win, "mousemove", handleMouseMove); 4927 return cleanup; 4928 } 4929 store.set("positionReference", domReference); 4930 return void 0; 4931 }, [openCheck, enabled, floating, dataRef, domReference, store, setReference]); 4932 React27.useEffect(() => { 4933 return addListener(); 4934 }, [addListener, reactive]); 4935 React27.useEffect(() => { 4936 if (enabled && !floating) { 4937 initialRef.current = false; 4938 } 4939 }, [enabled, floating]); 4940 React27.useEffect(() => { 4941 if (!enabled && open) { 4942 initialRef.current = true; 4943 } 4944 }, [enabled, open]); 4945 const reference = React27.useMemo(() => { 4946 function setPointerTypeRef(event) { 4947 setPointerType(event.pointerType); 4948 } 4949 return { 4950 onPointerDown: setPointerTypeRef, 4951 onPointerEnter: setPointerTypeRef, 4952 onMouseMove: handleReferenceEnterOrMove, 4953 onMouseEnter: handleReferenceEnterOrMove 4954 }; 4955 }, [handleReferenceEnterOrMove]); 4956 return React27.useMemo(() => enabled ? { 4957 reference, 4958 trigger: reference 4959 } : {}, [enabled, reference]); 4960 } 4961 4962 // node_modules/@base-ui/react/esm/floating-ui-react/hooks/useDismiss.js 4963 var React28 = __toESM(require_react(), 1); 4964 var bubbleHandlerKeys = { 4965 intentional: "onClick", 4966 sloppy: "onPointerDown" 4967 }; 4968 function alwaysFalse() { 4969 return false; 4970 } 4971 function normalizeProp(normalizable) { 4972 return { 4973 escapeKey: typeof normalizable === "boolean" ? normalizable : normalizable?.escapeKey ?? false, 4974 outsidePress: typeof normalizable === "boolean" ? normalizable : normalizable?.outsidePress ?? true 4975 }; 4976 } 4977 function useDismiss(context, props = {}) { 4978 const store = "rootStore" in context ? context.rootStore : context; 4979 const open = store.useState("open"); 4980 const floatingElement = store.useState("floatingElement"); 4981 const { 4982 dataRef 4983 } = store.context; 4984 const { 4985 enabled = true, 4986 escapeKey: escapeKey2 = true, 4987 outsidePress: outsidePressProp = true, 4988 outsidePressEvent = "sloppy", 4989 referencePress = alwaysFalse, 4990 referencePressEvent = "sloppy", 4991 bubbles, 4992 externalTree 4993 } = props; 4994 const tree = useFloatingTree(externalTree); 4995 const outsidePressFn = useStableCallback(typeof outsidePressProp === "function" ? outsidePressProp : () => false); 4996 const outsidePress2 = typeof outsidePressProp === "function" ? outsidePressFn : outsidePressProp; 4997 const outsidePressEnabled = outsidePress2 !== false; 4998 const getOutsidePressEventProp = useStableCallback(() => outsidePressEvent); 4999 const pressStartedInsideRef = React28.useRef(false); 5000 const pressStartPreventedRef = React28.useRef(false); 5001 const suppressNextOutsideClickRef = React28.useRef(false); 5002 const { 5003 escapeKey: escapeKeyBubbles, 5004 outsidePress: outsidePressBubbles 5005 } = normalizeProp(bubbles); 5006 const touchStateRef = React28.useRef(null); 5007 const cancelDismissOnEndTimeout = useTimeout(); 5008 const clearInsideReactTreeTimeout = useTimeout(); 5009 const clearInsideReactTree = useStableCallback(() => { 5010 clearInsideReactTreeTimeout.clear(); 5011 dataRef.current.insideReactTree = false; 5012 }); 5013 const isComposingRef = React28.useRef(false); 5014 const currentPointerTypeRef = React28.useRef(""); 5015 const isReferencePressEnabled = useStableCallback(referencePress); 5016 const closeOnEscapeKeyDown = useStableCallback((event) => { 5017 if (!open || !enabled || !escapeKey2 || event.key !== "Escape") { 5018 return; 5019 } 5020 if (isComposingRef.current) { 5021 return; 5022 } 5023 const nodeId = dataRef.current.floatingContext?.nodeId; 5024 const children = tree ? getNodeChildren(tree.nodesRef.current, nodeId) : []; 5025 if (!escapeKeyBubbles) { 5026 if (children.length > 0) { 5027 let shouldDismiss = true; 5028 children.forEach((child) => { 5029 if (child.context?.open && !child.context.dataRef.current.__escapeKeyBubbles) { 5030 shouldDismiss = false; 5031 } 5032 }); 5033 if (!shouldDismiss) { 5034 return; 5035 } 5036 } 5037 } 5038 const native = isReactEvent(event) ? event.nativeEvent : event; 5039 const eventDetails = createChangeEventDetails(reason_parts_exports.escapeKey, native); 5040 store.setOpen(false, eventDetails); 5041 if (!escapeKeyBubbles && !eventDetails.isPropagationAllowed) { 5042 event.stopPropagation(); 5043 } 5044 }); 5045 const markInsideReactTree = useStableCallback(() => { 5046 dataRef.current.insideReactTree = true; 5047 clearInsideReactTreeTimeout.start(0, clearInsideReactTree); 5048 }); 5049 React28.useEffect(() => { 5050 if (!open || !enabled) { 5051 return void 0; 5052 } 5053 dataRef.current.__escapeKeyBubbles = escapeKeyBubbles; 5054 dataRef.current.__outsidePressBubbles = outsidePressBubbles; 5055 const compositionTimeout = new Timeout(); 5056 const preventedPressSuppressionTimeout = new Timeout(); 5057 function handleCompositionStart() { 5058 compositionTimeout.clear(); 5059 isComposingRef.current = true; 5060 } 5061 function handleCompositionEnd() { 5062 compositionTimeout.start( 5063 // 0ms or 1ms don't work in Safari. 5ms appears to consistently work. 5064 // Only apply to WebKit for the test to remain 0ms. 5065 isWebKit() ? 5 : 0, 5066 () => { 5067 isComposingRef.current = false; 5068 } 5069 ); 5070 } 5071 function suppressImmediateOutsideClickAfterPreventedStart() { 5072 suppressNextOutsideClickRef.current = true; 5073 preventedPressSuppressionTimeout.start(0, () => { 5074 suppressNextOutsideClickRef.current = false; 5075 }); 5076 } 5077 function resetPressStartState() { 5078 pressStartedInsideRef.current = false; 5079 pressStartPreventedRef.current = false; 5080 } 5081 function getOutsidePressEvent() { 5082 const type = currentPointerTypeRef.current; 5083 const computedType = type === "pen" || !type ? "mouse" : type; 5084 const outsidePressEventValue = getOutsidePressEventProp(); 5085 const resolved = typeof outsidePressEventValue === "function" ? outsidePressEventValue() : outsidePressEventValue; 5086 if (typeof resolved === "string") { 5087 return resolved; 5088 } 5089 return resolved[computedType]; 5090 } 5091 function shouldIgnoreEvent(event) { 5092 const computedOutsidePressEvent = getOutsidePressEvent(); 5093 return computedOutsidePressEvent === "intentional" && event.type !== "click" || computedOutsidePressEvent === "sloppy" && event.type === "click"; 5094 } 5095 function isEventWithinFloatingTree(event) { 5096 const nodeId = dataRef.current.floatingContext?.nodeId; 5097 const targetIsInsideChildren = tree && getNodeChildren(tree.nodesRef.current, nodeId).some((node) => isEventTargetWithin(event, node.context?.elements.floating)); 5098 return isEventTargetWithin(event, store.select("floatingElement")) || isEventTargetWithin(event, store.select("domReferenceElement")) || targetIsInsideChildren; 5099 } 5100 function closeOnPressOutside(event) { 5101 if (shouldIgnoreEvent(event)) { 5102 clearInsideReactTree(); 5103 return; 5104 } 5105 if (dataRef.current.insideReactTree) { 5106 clearInsideReactTree(); 5107 return; 5108 } 5109 const target = getTarget(event); 5110 const inertSelector = `[$createAttribute("inert")}]`; 5111 const targetRoot = isElement(target) ? target.getRootNode() : null; 5112 const markers = Array.from((isShadowRoot(targetRoot) ? targetRoot : ownerDocument(store.select("floatingElement"))).querySelectorAll(inertSelector)); 5113 const triggers = store.context.triggerElements; 5114 if (target && (triggers.hasElement(target) || triggers.hasMatchingElement((trigger) => contains(trigger, target)))) { 5115 return; 5116 } 5117 let targetRootAncestor = isElement(target) ? target : null; 5118 while (targetRootAncestor && !isLastTraversableNode(targetRootAncestor)) { 5119 const nextParent = getParentNode(targetRootAncestor); 5120 if (isLastTraversableNode(nextParent) || !isElement(nextParent)) { 5121 break; 5122 } 5123 targetRootAncestor = nextParent; 5124 } 5125 if (markers.length && isElement(target) && !isRootElement(target) && // Clicked on a direct ancestor (e.g. FloatingOverlay). 5126 !contains(target, store.select("floatingElement")) && // If the target root element contains none of the markers, then the 5127 // element was injected after the floating element rendered. 5128 markers.every((marker) => !contains(targetRootAncestor, marker))) { 5129 return; 5130 } 5131 if (isHTMLElement(target) && !("touches" in event)) { 5132 const lastTraversableNode = isLastTraversableNode(target); 5133 const style = getComputedStyle2(target); 5134 const scrollRe = /auto|scroll/; 5135 const isScrollableX = lastTraversableNode || scrollRe.test(style.overflowX); 5136 const isScrollableY = lastTraversableNode || scrollRe.test(style.overflowY); 5137 const canScrollX = isScrollableX && target.clientWidth > 0 && target.scrollWidth > target.clientWidth; 5138 const canScrollY = isScrollableY && target.clientHeight > 0 && target.scrollHeight > target.clientHeight; 5139 const isRTL7 = style.direction === "rtl"; 5140 const pressedVerticalScrollbar = canScrollY && (isRTL7 ? event.offsetX <= target.offsetWidth - target.clientWidth : event.offsetX > target.clientWidth); 5141 const pressedHorizontalScrollbar = canScrollX && event.offsetY > target.clientHeight; 5142 if (pressedVerticalScrollbar || pressedHorizontalScrollbar) { 5143 return; 5144 } 5145 } 5146 if (isEventWithinFloatingTree(event)) { 5147 return; 5148 } 5149 if (getOutsidePressEvent() === "intentional" && suppressNextOutsideClickRef.current) { 5150 preventedPressSuppressionTimeout.clear(); 5151 suppressNextOutsideClickRef.current = false; 5152 return; 5153 } 5154 if (typeof outsidePress2 === "function" && !outsidePress2(event)) { 5155 return; 5156 } 5157 const nodeId = dataRef.current.floatingContext?.nodeId; 5158 const children = tree ? getNodeChildren(tree.nodesRef.current, nodeId) : []; 5159 if (children.length > 0) { 5160 let shouldDismiss = true; 5161 children.forEach((child) => { 5162 if (child.context?.open && !child.context.dataRef.current.__outsidePressBubbles) { 5163 shouldDismiss = false; 5164 } 5165 }); 5166 if (!shouldDismiss) { 5167 return; 5168 } 5169 } 5170 store.setOpen(false, createChangeEventDetails(reason_parts_exports.outsidePress, event)); 5171 clearInsideReactTree(); 5172 } 5173 function handlePointerDown(event) { 5174 if (getOutsidePressEvent() !== "sloppy" || event.pointerType === "touch" || !store.select("open") || !enabled || isEventTargetWithin(event, store.select("floatingElement")) || isEventTargetWithin(event, store.select("domReferenceElement"))) { 5175 return; 5176 } 5177 closeOnPressOutside(event); 5178 } 5179 function handleTouchStart(event) { 5180 if (getOutsidePressEvent() !== "sloppy" || !store.select("open") || !enabled || isEventTargetWithin(event, store.select("floatingElement")) || isEventTargetWithin(event, store.select("domReferenceElement"))) { 5181 return; 5182 } 5183 const touch = event.touches[0]; 5184 if (touch) { 5185 touchStateRef.current = { 5186 startTime: Date.now(), 5187 startX: touch.clientX, 5188 startY: touch.clientY, 5189 dismissOnTouchEnd: false, 5190 dismissOnMouseDown: true 5191 }; 5192 cancelDismissOnEndTimeout.start(1e3, () => { 5193 if (touchStateRef.current) { 5194 touchStateRef.current.dismissOnTouchEnd = false; 5195 touchStateRef.current.dismissOnMouseDown = false; 5196 } 5197 }); 5198 } 5199 } 5200 function addTargetEventListenerOnce(event, listener) { 5201 const target = getTarget(event); 5202 if (!target) { 5203 return; 5204 } 5205 const unsubscribe2 = addEventListener(target, event.type, () => { 5206 listener(event); 5207 unsubscribe2(); 5208 }); 5209 } 5210 function handleTouchStartCapture(event) { 5211 currentPointerTypeRef.current = "touch"; 5212 addTargetEventListenerOnce(event, handleTouchStart); 5213 } 5214 function closeOnPressOutsideCapture(event) { 5215 cancelDismissOnEndTimeout.clear(); 5216 if (event.type === "pointerdown") { 5217 currentPointerTypeRef.current = event.pointerType; 5218 } 5219 if (event.type === "mousedown" && touchStateRef.current && !touchStateRef.current.dismissOnMouseDown) { 5220 return; 5221 } 5222 addTargetEventListenerOnce(event, (targetEvent) => { 5223 if (targetEvent.type === "pointerdown") { 5224 handlePointerDown(targetEvent); 5225 } else { 5226 closeOnPressOutside(targetEvent); 5227 } 5228 }); 5229 } 5230 function handlePressEndCapture(event) { 5231 if (!pressStartedInsideRef.current) { 5232 return; 5233 } 5234 const pressStartedInsideDefaultPrevented = pressStartPreventedRef.current; 5235 resetPressStartState(); 5236 if (getOutsidePressEvent() !== "intentional") { 5237 return; 5238 } 5239 if (event.type === "pointercancel") { 5240 if (pressStartedInsideDefaultPrevented) { 5241 suppressImmediateOutsideClickAfterPreventedStart(); 5242 } 5243 return; 5244 } 5245 if (isEventWithinFloatingTree(event)) { 5246 return; 5247 } 5248 if (pressStartedInsideDefaultPrevented) { 5249 suppressImmediateOutsideClickAfterPreventedStart(); 5250 return; 5251 } 5252 if (typeof outsidePress2 === "function" && !outsidePress2(event)) { 5253 return; 5254 } 5255 preventedPressSuppressionTimeout.clear(); 5256 suppressNextOutsideClickRef.current = true; 5257 clearInsideReactTree(); 5258 } 5259 function handleTouchMove(event) { 5260 if (getOutsidePressEvent() !== "sloppy" || !touchStateRef.current || isEventTargetWithin(event, store.select("floatingElement")) || isEventTargetWithin(event, store.select("domReferenceElement"))) { 5261 return; 5262 } 5263 const touch = event.touches[0]; 5264 if (!touch) { 5265 return; 5266 } 5267 const deltaX = Math.abs(touch.clientX - touchStateRef.current.startX); 5268 const deltaY = Math.abs(touch.clientY - touchStateRef.current.startY); 5269 const distance = Math.sqrt(deltaX * deltaX + deltaY * deltaY); 5270 if (distance > 5) { 5271 touchStateRef.current.dismissOnTouchEnd = true; 5272 } 5273 if (distance > 10) { 5274 closeOnPressOutside(event); 5275 cancelDismissOnEndTimeout.clear(); 5276 touchStateRef.current = null; 5277 } 5278 } 5279 function handleTouchMoveCapture(event) { 5280 addTargetEventListenerOnce(event, handleTouchMove); 5281 } 5282 function handleTouchEnd(event) { 5283 if (getOutsidePressEvent() !== "sloppy" || !touchStateRef.current || isEventTargetWithin(event, store.select("floatingElement")) || isEventTargetWithin(event, store.select("domReferenceElement"))) { 5284 return; 5285 } 5286 if (touchStateRef.current.dismissOnTouchEnd) { 5287 closeOnPressOutside(event); 5288 } 5289 cancelDismissOnEndTimeout.clear(); 5290 touchStateRef.current = null; 5291 } 5292 function handleTouchEndCapture(event) { 5293 addTargetEventListenerOnce(event, handleTouchEnd); 5294 } 5295 const doc = ownerDocument(floatingElement); 5296 const unsubscribe = mergeCleanups(escapeKey2 && mergeCleanups(addEventListener(doc, "keydown", closeOnEscapeKeyDown), addEventListener(doc, "compositionstart", handleCompositionStart), addEventListener(doc, "compositionend", handleCompositionEnd)), outsidePressEnabled && mergeCleanups(addEventListener(doc, "click", closeOnPressOutsideCapture, true), addEventListener(doc, "pointerdown", closeOnPressOutsideCapture, true), addEventListener(doc, "pointerup", handlePressEndCapture, true), addEventListener(doc, "pointercancel", handlePressEndCapture, true), addEventListener(doc, "mousedown", closeOnPressOutsideCapture, true), addEventListener(doc, "mouseup", handlePressEndCapture, true), addEventListener(doc, "touchstart", handleTouchStartCapture, true), addEventListener(doc, "touchmove", handleTouchMoveCapture, true), addEventListener(doc, "touchend", handleTouchEndCapture, true))); 5297 return () => { 5298 unsubscribe(); 5299 compositionTimeout.clear(); 5300 preventedPressSuppressionTimeout.clear(); 5301 resetPressStartState(); 5302 suppressNextOutsideClickRef.current = false; 5303 }; 5304 }, [dataRef, floatingElement, escapeKey2, outsidePressEnabled, outsidePress2, open, enabled, escapeKeyBubbles, outsidePressBubbles, closeOnEscapeKeyDown, clearInsideReactTree, getOutsidePressEventProp, tree, store, cancelDismissOnEndTimeout]); 5305 React28.useEffect(clearInsideReactTree, [outsidePress2, clearInsideReactTree]); 5306 const reference = React28.useMemo(() => ({ 5307 onKeyDown: closeOnEscapeKeyDown, 5308 [bubbleHandlerKeys[referencePressEvent]]: (event) => { 5309 if (!isReferencePressEnabled()) { 5310 return; 5311 } 5312 store.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerPress, event.nativeEvent)); 5313 }, 5314 ...referencePressEvent !== "intentional" && { 5315 onClick(event) { 5316 if (!isReferencePressEnabled()) { 5317 return; 5318 } 5319 store.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerPress, event.nativeEvent)); 5320 } 5321 } 5322 }), [closeOnEscapeKeyDown, store, referencePressEvent, isReferencePressEnabled]); 5323 const markPressStartedInsideReactTree = useStableCallback((event) => { 5324 if (!open || !enabled || event.button !== 0) { 5325 return; 5326 } 5327 const target = getTarget(event.nativeEvent); 5328 if (!contains(store.select("floatingElement"), target)) { 5329 return; 5330 } 5331 if (!pressStartedInsideRef.current) { 5332 pressStartedInsideRef.current = true; 5333 pressStartPreventedRef.current = false; 5334 } 5335 }); 5336 const markInsidePressStartPrevented = useStableCallback((event) => { 5337 if (!open || !enabled) { 5338 return; 5339 } 5340 if (!(event.defaultPrevented || event.nativeEvent.defaultPrevented)) { 5341 return; 5342 } 5343 if (pressStartedInsideRef.current) { 5344 pressStartPreventedRef.current = true; 5345 } 5346 }); 5347 const floating = React28.useMemo(() => ({ 5348 onKeyDown: closeOnEscapeKeyDown, 5349 // `onMouseDown` may be blocked if `event.preventDefault()` is called in 5350 // `onPointerDown`, such as with <NumberField.ScrubArea>. 5351 // See https://github.com/mui/base-ui/pull/3379 5352 onPointerDown: markInsidePressStartPrevented, 5353 onMouseDown: markInsidePressStartPrevented, 5354 onClickCapture: markInsideReactTree, 5355 onMouseDownCapture(event) { 5356 markInsideReactTree(); 5357 markPressStartedInsideReactTree(event); 5358 }, 5359 onPointerDownCapture(event) { 5360 markInsideReactTree(); 5361 markPressStartedInsideReactTree(event); 5362 }, 5363 onMouseUpCapture: markInsideReactTree, 5364 onTouchEndCapture: markInsideReactTree, 5365 onTouchMoveCapture: markInsideReactTree 5366 }), [closeOnEscapeKeyDown, markInsideReactTree, markPressStartedInsideReactTree, markInsidePressStartPrevented]); 5367 return React28.useMemo(() => enabled ? { 5368 reference, 5369 floating, 5370 trigger: reference 5371 } : {}, [enabled, reference, floating]); 5372 } 5373 5374 // node_modules/@base-ui/react/esm/floating-ui-react/hooks/useFloating.js 5375 var React34 = __toESM(require_react(), 1); 5376 5377 // node_modules/@floating-ui/core/dist/floating-ui.core.mjs 5378 function computeCoordsFromPlacement(_ref, placement, rtl) { 5379 let { 5380 reference, 5381 floating 5382 } = _ref; 5383 const sideAxis = getSideAxis(placement); 5384 const alignmentAxis = getAlignmentAxis(placement); 5385 const alignLength = getAxisLength(alignmentAxis); 5386 const side = getSide(placement); 5387 const isVertical = sideAxis === "y"; 5388 const commonX = reference.x + reference.width / 2 - floating.width / 2; 5389 const commonY = reference.y + reference.height / 2 - floating.height / 2; 5390 const commonAlign = reference[alignLength] / 2 - floating[alignLength] / 2; 5391 let coords; 5392 switch (side) { 5393 case "top": 5394 coords = { 5395 x: commonX, 5396 y: reference.y - floating.height 5397 }; 5398 break; 5399 case "bottom": 5400 coords = { 5401 x: commonX, 5402 y: reference.y + reference.height 5403 }; 5404 break; 5405 case "right": 5406 coords = { 5407 x: reference.x + reference.width, 5408 y: commonY 5409 }; 5410 break; 5411 case "left": 5412 coords = { 5413 x: reference.x - floating.width, 5414 y: commonY 5415 }; 5416 break; 5417 default: 5418 coords = { 5419 x: reference.x, 5420 y: reference.y 5421 }; 5422 } 5423 switch (getAlignment(placement)) { 5424 case "start": 5425 coords[alignmentAxis] -= commonAlign * (rtl && isVertical ? -1 : 1); 5426 break; 5427 case "end": 5428 coords[alignmentAxis] += commonAlign * (rtl && isVertical ? -1 : 1); 5429 break; 5430 } 5431 return coords; 5432 } 5433 async function detectOverflow(state, options) { 5434 var _await$platform$isEle; 5435 if (options === void 0) { 5436 options = {}; 5437 } 5438 const { 5439 x: x2, 5440 y: y2, 5441 platform: platform3, 5442 rects, 5443 elements, 5444 strategy 5445 } = state; 5446 const { 5447 boundary = "clippingAncestors", 5448 rootBoundary = "viewport", 5449 elementContext = "floating", 5450 altBoundary = false, 5451 padding = 0 5452 } = evaluate(options, state); 5453 const paddingObject = getPaddingObject(padding); 5454 const altContext = elementContext === "floating" ? "reference" : "floating"; 5455 const element = elements[altBoundary ? altContext : elementContext]; 5456 const clippingClientRect = rectToClientRect(await platform3.getClippingRect({ 5457 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)), 5458 boundary, 5459 rootBoundary, 5460 strategy 5461 })); 5462 const rect = elementContext === "floating" ? { 5463 x: x2, 5464 y: y2, 5465 width: rects.floating.width, 5466 height: rects.floating.height 5467 } : rects.reference; 5468 const offsetParent = await (platform3.getOffsetParent == null ? void 0 : platform3.getOffsetParent(elements.floating)); 5469 const offsetScale = await (platform3.isElement == null ? void 0 : platform3.isElement(offsetParent)) ? await (platform3.getScale == null ? void 0 : platform3.getScale(offsetParent)) || { 5470 x: 1, 5471 y: 1 5472 } : { 5473 x: 1, 5474 y: 1 5475 }; 5476 const elementClientRect = rectToClientRect(platform3.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform3.convertOffsetParentRelativeRectToViewportRelativeRect({ 5477 elements, 5478 rect, 5479 offsetParent, 5480 strategy 5481 }) : rect); 5482 return { 5483 top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y, 5484 bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y, 5485 left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x, 5486 right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x 5487 }; 5488 } 5489 var MAX_RESET_COUNT = 50; 5490 var computePosition = async (reference, floating, config) => { 5491 const { 5492 placement = "bottom", 5493 strategy = "absolute", 5494 middleware = [], 5495 platform: platform3 5496 } = config; 5497 const platformWithDetectOverflow = platform3.detectOverflow ? platform3 : { 5498 ...platform3, 5499 detectOverflow 5500 }; 5501 const rtl = await (platform3.isRTL == null ? void 0 : platform3.isRTL(floating)); 5502 let rects = await platform3.getElementRects({ 5503 reference, 5504 floating, 5505 strategy 5506 }); 5507 let { 5508 x: x2, 5509 y: y2 5510 } = computeCoordsFromPlacement(rects, placement, rtl); 5511 let statefulPlacement = placement; 5512 let resetCount = 0; 5513 const middlewareData = {}; 5514 for (let i2 = 0; i2 < middleware.length; i2++) { 5515 const currentMiddleware = middleware[i2]; 5516 if (!currentMiddleware) { 5517 continue; 5518 } 5519 const { 5520 name, 5521 fn 5522 } = currentMiddleware; 5523 const { 5524 x: nextX, 5525 y: nextY, 5526 data, 5527 reset 5528 } = await fn({ 5529 x: x2, 5530 y: y2, 5531 initialPlacement: placement, 5532 placement: statefulPlacement, 5533 strategy, 5534 middlewareData, 5535 rects, 5536 platform: platformWithDetectOverflow, 5537 elements: { 5538 reference, 5539 floating 5540 } 5541 }); 5542 x2 = nextX != null ? nextX : x2; 5543 y2 = nextY != null ? nextY : y2; 5544 middlewareData[name] = { 5545 ...middlewareData[name], 5546 ...data 5547 }; 5548 if (reset && resetCount < MAX_RESET_COUNT) { 5549 resetCount++; 5550 if (typeof reset === "object") { 5551 if (reset.placement) { 5552 statefulPlacement = reset.placement; 5553 } 5554 if (reset.rects) { 5555 rects = reset.rects === true ? await platform3.getElementRects({ 5556 reference, 5557 floating, 5558 strategy 5559 }) : reset.rects; 5560 } 5561 ({ 5562 x: x2, 5563 y: y2 5564 } = computeCoordsFromPlacement(rects, statefulPlacement, rtl)); 5565 } 5566 i2 = -1; 5567 } 5568 } 5569 return { 5570 x: x2, 5571 y: y2, 5572 placement: statefulPlacement, 5573 strategy, 5574 middlewareData 5575 }; 5576 }; 5577 var flip = function(options) { 5578 if (options === void 0) { 5579 options = {}; 5580 } 5581 return { 5582 name: "flip", 5583 options, 5584 async fn(state) { 5585 var _middlewareData$arrow, _middlewareData$flip; 5586 const { 5587 placement, 5588 middlewareData, 5589 rects, 5590 initialPlacement, 5591 platform: platform3, 5592 elements 5593 } = state; 5594 const { 5595 mainAxis: checkMainAxis = true, 5596 crossAxis: checkCrossAxis = true, 5597 fallbackPlacements: specifiedFallbackPlacements, 5598 fallbackStrategy = "bestFit", 5599 fallbackAxisSideDirection = "none", 5600 flipAlignment = true, 5601 ...detectOverflowOptions 5602 } = evaluate(options, state); 5603 if ((_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) { 5604 return {}; 5605 } 5606 const side = getSide(placement); 5607 const initialSideAxis = getSideAxis(initialPlacement); 5608 const isBasePlacement = getSide(initialPlacement) === initialPlacement; 5609 const rtl = await (platform3.isRTL == null ? void 0 : platform3.isRTL(elements.floating)); 5610 const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement)); 5611 const hasFallbackAxisSideDirection = fallbackAxisSideDirection !== "none"; 5612 if (!specifiedFallbackPlacements && hasFallbackAxisSideDirection) { 5613 fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl)); 5614 } 5615 const placements2 = [initialPlacement, ...fallbackPlacements]; 5616 const overflow = await platform3.detectOverflow(state, detectOverflowOptions); 5617 const overflows = []; 5618 let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || []; 5619 if (checkMainAxis) { 5620 overflows.push(overflow[side]); 5621 } 5622 if (checkCrossAxis) { 5623 const sides2 = getAlignmentSides(placement, rects, rtl); 5624 overflows.push(overflow[sides2[0]], overflow[sides2[1]]); 5625 } 5626 overflowsData = [...overflowsData, { 5627 placement, 5628 overflows 5629 }]; 5630 if (!overflows.every((side2) => side2 <= 0)) { 5631 var _middlewareData$flip2, _overflowsData$filter; 5632 const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1; 5633 const nextPlacement = placements2[nextIndex]; 5634 if (nextPlacement) { 5635 const ignoreCrossAxisOverflow = checkCrossAxis === "alignment" ? initialSideAxis !== getSideAxis(nextPlacement) : false; 5636 if (!ignoreCrossAxisOverflow || // We leave the current main axis only if every placement on that axis 5637 // overflows the main axis. 5638 overflowsData.every((d2) => getSideAxis(d2.placement) === initialSideAxis ? d2.overflows[0] > 0 : true)) { 5639 return { 5640 data: { 5641 index: nextIndex, 5642 overflows: overflowsData 5643 }, 5644 reset: { 5645 placement: nextPlacement 5646 } 5647 }; 5648 } 5649 } 5650 let resetPlacement = (_overflowsData$filter = overflowsData.filter((d2) => d2.overflows[0] <= 0).sort((a2, b2) => a2.overflows[1] - b2.overflows[1])[0]) == null ? void 0 : _overflowsData$filter.placement; 5651 if (!resetPlacement) { 5652 switch (fallbackStrategy) { 5653 case "bestFit": { 5654 var _overflowsData$filter2; 5655 const placement2 = (_overflowsData$filter2 = overflowsData.filter((d2) => { 5656 if (hasFallbackAxisSideDirection) { 5657 const currentSideAxis = getSideAxis(d2.placement); 5658 return currentSideAxis === initialSideAxis || // Create a bias to the `y` side axis due to horizontal 5659 // reading directions favoring greater width. 5660 currentSideAxis === "y"; 5661 } 5662 return true; 5663 }).map((d2) => [d2.placement, d2.overflows.filter((overflow2) => overflow2 > 0).reduce((acc, overflow2) => acc + overflow2, 0)]).sort((a2, b2) => a2[1] - b2[1])[0]) == null ? void 0 : _overflowsData$filter2[0]; 5664 if (placement2) { 5665 resetPlacement = placement2; 5666 } 5667 break; 5668 } 5669 case "initialPlacement": 5670 resetPlacement = initialPlacement; 5671 break; 5672 } 5673 } 5674 if (placement !== resetPlacement) { 5675 return { 5676 reset: { 5677 placement: resetPlacement 5678 } 5679 }; 5680 } 5681 } 5682 return {}; 5683 } 5684 }; 5685 }; 5686 function getSideOffsets(overflow, rect) { 5687 return { 5688 top: overflow.top - rect.height, 5689 right: overflow.right - rect.width, 5690 bottom: overflow.bottom - rect.height, 5691 left: overflow.left - rect.width 5692 }; 5693 } 5694 function isAnySideFullyClipped(overflow) { 5695 return sides.some((side) => overflow[side] >= 0); 5696 } 5697 var hide = function(options) { 5698 if (options === void 0) { 5699 options = {}; 5700 } 5701 return { 5702 name: "hide", 5703 options, 5704 async fn(state) { 5705 const { 5706 rects, 5707 platform: platform3 5708 } = state; 5709 const { 5710 strategy = "referenceHidden", 5711 ...detectOverflowOptions 5712 } = evaluate(options, state); 5713 switch (strategy) { 5714 case "referenceHidden": { 5715 const overflow = await platform3.detectOverflow(state, { 5716 ...detectOverflowOptions, 5717 elementContext: "reference" 5718 }); 5719 const offsets = getSideOffsets(overflow, rects.reference); 5720 return { 5721 data: { 5722 referenceHiddenOffsets: offsets, 5723 referenceHidden: isAnySideFullyClipped(offsets) 5724 } 5725 }; 5726 } 5727 case "escaped": { 5728 const overflow = await platform3.detectOverflow(state, { 5729 ...detectOverflowOptions, 5730 altBoundary: true 5731 }); 5732 const offsets = getSideOffsets(overflow, rects.floating); 5733 return { 5734 data: { 5735 escapedOffsets: offsets, 5736 escaped: isAnySideFullyClipped(offsets) 5737 } 5738 }; 5739 } 5740 default: { 5741 return {}; 5742 } 5743 } 5744 } 5745 }; 5746 }; 5747 var originSides = /* @__PURE__ */ new Set(["left", "top"]); 5748 async function convertValueToCoords(state, options) { 5749 const { 5750 placement, 5751 platform: platform3, 5752 elements 5753 } = state; 5754 const rtl = await (platform3.isRTL == null ? void 0 : platform3.isRTL(elements.floating)); 5755 const side = getSide(placement); 5756 const alignment = getAlignment(placement); 5757 const isVertical = getSideAxis(placement) === "y"; 5758 const mainAxisMulti = originSides.has(side) ? -1 : 1; 5759 const crossAxisMulti = rtl && isVertical ? -1 : 1; 5760 const rawValue = evaluate(options, state); 5761 let { 5762 mainAxis, 5763 crossAxis, 5764 alignmentAxis 5765 } = typeof rawValue === "number" ? { 5766 mainAxis: rawValue, 5767 crossAxis: 0, 5768 alignmentAxis: null 5769 } : { 5770 mainAxis: rawValue.mainAxis || 0, 5771 crossAxis: rawValue.crossAxis || 0, 5772 alignmentAxis: rawValue.alignmentAxis 5773 }; 5774 if (alignment && typeof alignmentAxis === "number") { 5775 crossAxis = alignment === "end" ? alignmentAxis * -1 : alignmentAxis; 5776 } 5777 return isVertical ? { 5778 x: crossAxis * crossAxisMulti, 5779 y: mainAxis * mainAxisMulti 5780 } : { 5781 x: mainAxis * mainAxisMulti, 5782 y: crossAxis * crossAxisMulti 5783 }; 5784 } 5785 var offset = function(options) { 5786 if (options === void 0) { 5787 options = 0; 5788 } 5789 return { 5790 name: "offset", 5791 options, 5792 async fn(state) { 5793 var _middlewareData$offse, _middlewareData$arrow; 5794 const { 5795 x: x2, 5796 y: y2, 5797 placement, 5798 middlewareData 5799 } = state; 5800 const diffCoords = await convertValueToCoords(state, options); 5801 if (placement === ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse.placement) && (_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) { 5802 return {}; 5803 } 5804 return { 5805 x: x2 + diffCoords.x, 5806 y: y2 + diffCoords.y, 5807 data: { 5808 ...diffCoords, 5809 placement 5810 } 5811 }; 5812 } 5813 }; 5814 }; 5815 var shift = function(options) { 5816 if (options === void 0) { 5817 options = {}; 5818 } 5819 return { 5820 name: "shift", 5821 options, 5822 async fn(state) { 5823 const { 5824 x: x2, 5825 y: y2, 5826 placement, 5827 platform: platform3 5828 } = state; 5829 const { 5830 mainAxis: checkMainAxis = true, 5831 crossAxis: checkCrossAxis = false, 5832 limiter = { 5833 fn: (_ref) => { 5834 let { 5835 x: x3, 5836 y: y3 5837 } = _ref; 5838 return { 5839 x: x3, 5840 y: y3 5841 }; 5842 } 5843 }, 5844 ...detectOverflowOptions 5845 } = evaluate(options, state); 5846 const coords = { 5847 x: x2, 5848 y: y2 5849 }; 5850 const overflow = await platform3.detectOverflow(state, detectOverflowOptions); 5851 const crossAxis = getSideAxis(getSide(placement)); 5852 const mainAxis = getOppositeAxis(crossAxis); 5853 let mainAxisCoord = coords[mainAxis]; 5854 let crossAxisCoord = coords[crossAxis]; 5855 if (checkMainAxis) { 5856 const minSide = mainAxis === "y" ? "top" : "left"; 5857 const maxSide = mainAxis === "y" ? "bottom" : "right"; 5858 const min2 = mainAxisCoord + overflow[minSide]; 5859 const max2 = mainAxisCoord - overflow[maxSide]; 5860 mainAxisCoord = clamp(min2, mainAxisCoord, max2); 5861 } 5862 if (checkCrossAxis) { 5863 const minSide = crossAxis === "y" ? "top" : "left"; 5864 const maxSide = crossAxis === "y" ? "bottom" : "right"; 5865 const min2 = crossAxisCoord + overflow[minSide]; 5866 const max2 = crossAxisCoord - overflow[maxSide]; 5867 crossAxisCoord = clamp(min2, crossAxisCoord, max2); 5868 } 5869 const limitedCoords = limiter.fn({ 5870 ...state, 5871 [mainAxis]: mainAxisCoord, 5872 [crossAxis]: crossAxisCoord 5873 }); 5874 return { 5875 ...limitedCoords, 5876 data: { 5877 x: limitedCoords.x - x2, 5878 y: limitedCoords.y - y2, 5879 enabled: { 5880 [mainAxis]: checkMainAxis, 5881 [crossAxis]: checkCrossAxis 5882 } 5883 } 5884 }; 5885 } 5886 }; 5887 }; 5888 var limitShift = function(options) { 5889 if (options === void 0) { 5890 options = {}; 5891 } 5892 return { 5893 options, 5894 fn(state) { 5895 const { 5896 x: x2, 5897 y: y2, 5898 placement, 5899 rects, 5900 middlewareData 5901 } = state; 5902 const { 5903 offset: offset4 = 0, 5904 mainAxis: checkMainAxis = true, 5905 crossAxis: checkCrossAxis = true 5906 } = evaluate(options, state); 5907 const coords = { 5908 x: x2, 5909 y: y2 5910 }; 5911 const crossAxis = getSideAxis(placement); 5912 const mainAxis = getOppositeAxis(crossAxis); 5913 let mainAxisCoord = coords[mainAxis]; 5914 let crossAxisCoord = coords[crossAxis]; 5915 const rawOffset = evaluate(offset4, state); 5916 const computedOffset = typeof rawOffset === "number" ? { 5917 mainAxis: rawOffset, 5918 crossAxis: 0 5919 } : { 5920 mainAxis: 0, 5921 crossAxis: 0, 5922 ...rawOffset 5923 }; 5924 if (checkMainAxis) { 5925 const len = mainAxis === "y" ? "height" : "width"; 5926 const limitMin = rects.reference[mainAxis] - rects.floating[len] + computedOffset.mainAxis; 5927 const limitMax = rects.reference[mainAxis] + rects.reference[len] - computedOffset.mainAxis; 5928 if (mainAxisCoord < limitMin) { 5929 mainAxisCoord = limitMin; 5930 } else if (mainAxisCoord > limitMax) { 5931 mainAxisCoord = limitMax; 5932 } 5933 } 5934 if (checkCrossAxis) { 5935 var _middlewareData$offse, _middlewareData$offse2; 5936 const len = mainAxis === "y" ? "width" : "height"; 5937 const isOriginSide = originSides.has(getSide(placement)); 5938 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); 5939 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); 5940 if (crossAxisCoord < limitMin) { 5941 crossAxisCoord = limitMin; 5942 } else if (crossAxisCoord > limitMax) { 5943 crossAxisCoord = limitMax; 5944 } 5945 } 5946 return { 5947 [mainAxis]: mainAxisCoord, 5948 [crossAxis]: crossAxisCoord 5949 }; 5950 } 5951 }; 5952 }; 5953 var size = function(options) { 5954 if (options === void 0) { 5955 options = {}; 5956 } 5957 return { 5958 name: "size", 5959 options, 5960 async fn(state) { 5961 var _state$middlewareData, _state$middlewareData2; 5962 const { 5963 placement, 5964 rects, 5965 platform: platform3, 5966 elements 5967 } = state; 5968 const { 5969 apply = () => { 5970 }, 5971 ...detectOverflowOptions 5972 } = evaluate(options, state); 5973 const overflow = await platform3.detectOverflow(state, detectOverflowOptions); 5974 const side = getSide(placement); 5975 const alignment = getAlignment(placement); 5976 const isYAxis = getSideAxis(placement) === "y"; 5977 const { 5978 width, 5979 height 5980 } = rects.floating; 5981 let heightSide; 5982 let widthSide; 5983 if (side === "top" || side === "bottom") { 5984 heightSide = side; 5985 widthSide = alignment === (await (platform3.isRTL == null ? void 0 : platform3.isRTL(elements.floating)) ? "start" : "end") ? "left" : "right"; 5986 } else { 5987 widthSide = side; 5988 heightSide = alignment === "end" ? "top" : "bottom"; 5989 } 5990 const maximumClippingHeight = height - overflow.top - overflow.bottom; 5991 const maximumClippingWidth = width - overflow.left - overflow.right; 5992 const overflowAvailableHeight = min(height - overflow[heightSide], maximumClippingHeight); 5993 const overflowAvailableWidth = min(width - overflow[widthSide], maximumClippingWidth); 5994 const noShift = !state.middlewareData.shift; 5995 let availableHeight = overflowAvailableHeight; 5996 let availableWidth = overflowAvailableWidth; 5997 if ((_state$middlewareData = state.middlewareData.shift) != null && _state$middlewareData.enabled.x) { 5998 availableWidth = maximumClippingWidth; 5999 } 6000 if ((_state$middlewareData2 = state.middlewareData.shift) != null && _state$middlewareData2.enabled.y) { 6001 availableHeight = maximumClippingHeight; 6002 } 6003 if (noShift && !alignment) { 6004 const xMin = max(overflow.left, 0); 6005 const xMax = max(overflow.right, 0); 6006 const yMin = max(overflow.top, 0); 6007 const yMax = max(overflow.bottom, 0); 6008 if (isYAxis) { 6009 availableWidth = width - 2 * (xMin !== 0 || xMax !== 0 ? xMin + xMax : max(overflow.left, overflow.right)); 6010 } else { 6011 availableHeight = height - 2 * (yMin !== 0 || yMax !== 0 ? yMin + yMax : max(overflow.top, overflow.bottom)); 6012 } 6013 } 6014 await apply({ 6015 ...state, 6016 availableWidth, 6017 availableHeight 6018 }); 6019 const nextDimensions = await platform3.getDimensions(elements.floating); 6020 if (width !== nextDimensions.width || height !== nextDimensions.height) { 6021 return { 6022 reset: { 6023 rects: true 6024 } 6025 }; 6026 } 6027 return {}; 6028 } 6029 }; 6030 }; 6031 6032 // node_modules/@floating-ui/dom/dist/floating-ui.dom.mjs 6033 function getCssDimensions(element) { 6034 const css = getComputedStyle2(element); 6035 let width = parseFloat(css.width) || 0; 6036 let height = parseFloat(css.height) || 0; 6037 const hasOffset = isHTMLElement(element); 6038 const offsetWidth = hasOffset ? element.offsetWidth : width; 6039 const offsetHeight = hasOffset ? element.offsetHeight : height; 6040 const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight; 6041 if (shouldFallback) { 6042 width = offsetWidth; 6043 height = offsetHeight; 6044 } 6045 return { 6046 width, 6047 height, 6048 $: shouldFallback 6049 }; 6050 } 6051 function unwrapElement(element) { 6052 return !isElement(element) ? element.contextElement : element; 6053 } 6054 function getScale(element) { 6055 const domElement = unwrapElement(element); 6056 if (!isHTMLElement(domElement)) { 6057 return createCoords(1); 6058 } 6059 const rect = domElement.getBoundingClientRect(); 6060 const { 6061 width, 6062 height, 6063 $: $2 6064 } = getCssDimensions(domElement); 6065 let x2 = ($2 ? round(rect.width) : rect.width) / width; 6066 let y2 = ($2 ? round(rect.height) : rect.height) / height; 6067 if (!x2 || !Number.isFinite(x2)) { 6068 x2 = 1; 6069 } 6070 if (!y2 || !Number.isFinite(y2)) { 6071 y2 = 1; 6072 } 6073 return { 6074 x: x2, 6075 y: y2 6076 }; 6077 } 6078 var noOffsets = /* @__PURE__ */ createCoords(0); 6079 function getVisualOffsets(element) { 6080 const win = getWindow(element); 6081 if (!isWebKit() || !win.visualViewport) { 6082 return noOffsets; 6083 } 6084 return { 6085 x: win.visualViewport.offsetLeft, 6086 y: win.visualViewport.offsetTop 6087 }; 6088 } 6089 function shouldAddVisualOffsets(element, isFixed2, floatingOffsetParent) { 6090 if (isFixed2 === void 0) { 6091 isFixed2 = false; 6092 } 6093 if (!floatingOffsetParent || isFixed2 && floatingOffsetParent !== getWindow(element)) { 6094 return false; 6095 } 6096 return isFixed2; 6097 } 6098 function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) { 6099 if (includeScale === void 0) { 6100 includeScale = false; 6101 } 6102 if (isFixedStrategy === void 0) { 6103 isFixedStrategy = false; 6104 } 6105 const clientRect = element.getBoundingClientRect(); 6106 const domElement = unwrapElement(element); 6107 let scale = createCoords(1); 6108 if (includeScale) { 6109 if (offsetParent) { 6110 if (isElement(offsetParent)) { 6111 scale = getScale(offsetParent); 6112 } 6113 } else { 6114 scale = getScale(element); 6115 } 6116 } 6117 const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : createCoords(0); 6118 let x2 = (clientRect.left + visualOffsets.x) / scale.x; 6119 let y2 = (clientRect.top + visualOffsets.y) / scale.y; 6120 let width = clientRect.width / scale.x; 6121 let height = clientRect.height / scale.y; 6122 if (domElement) { 6123 const win = getWindow(domElement); 6124 const offsetWin = offsetParent && isElement(offsetParent) ? getWindow(offsetParent) : offsetParent; 6125 let currentWin = win; 6126 let currentIFrame = getFrameElement(currentWin); 6127 while (currentIFrame && offsetParent && offsetWin !== currentWin) { 6128 const iframeScale = getScale(currentIFrame); 6129 const iframeRect = currentIFrame.getBoundingClientRect(); 6130 const css = getComputedStyle2(currentIFrame); 6131 const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x; 6132 const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y; 6133 x2 *= iframeScale.x; 6134 y2 *= iframeScale.y; 6135 width *= iframeScale.x; 6136 height *= iframeScale.y; 6137 x2 += left; 6138 y2 += top; 6139 currentWin = getWindow(currentIFrame); 6140 currentIFrame = getFrameElement(currentWin); 6141 } 6142 } 6143 return rectToClientRect({ 6144 width, 6145 height, 6146 x: x2, 6147 y: y2 6148 }); 6149 } 6150 function getWindowScrollBarX(element, rect) { 6151 const leftScroll = getNodeScroll(element).scrollLeft; 6152 if (!rect) { 6153 return getBoundingClientRect(getDocumentElement(element)).left + leftScroll; 6154 } 6155 return rect.left + leftScroll; 6156 } 6157 function getHTMLOffset(documentElement, scroll) { 6158 const htmlRect = documentElement.getBoundingClientRect(); 6159 const x2 = htmlRect.left + scroll.scrollLeft - getWindowScrollBarX(documentElement, htmlRect); 6160 const y2 = htmlRect.top + scroll.scrollTop; 6161 return { 6162 x: x2, 6163 y: y2 6164 }; 6165 } 6166 function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) { 6167 let { 6168 elements, 6169 rect, 6170 offsetParent, 6171 strategy 6172 } = _ref; 6173 const isFixed2 = strategy === "fixed"; 6174 const documentElement = getDocumentElement(offsetParent); 6175 const topLayer = elements ? isTopLayer(elements.floating) : false; 6176 if (offsetParent === documentElement || topLayer && isFixed2) { 6177 return rect; 6178 } 6179 let scroll = { 6180 scrollLeft: 0, 6181 scrollTop: 0 6182 }; 6183 let scale = createCoords(1); 6184 const offsets = createCoords(0); 6185 const isOffsetParentAnElement = isHTMLElement(offsetParent); 6186 if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed2) { 6187 if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) { 6188 scroll = getNodeScroll(offsetParent); 6189 } 6190 if (isOffsetParentAnElement) { 6191 const offsetRect = getBoundingClientRect(offsetParent); 6192 scale = getScale(offsetParent); 6193 offsets.x = offsetRect.x + offsetParent.clientLeft; 6194 offsets.y = offsetRect.y + offsetParent.clientTop; 6195 } 6196 } 6197 const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed2 ? getHTMLOffset(documentElement, scroll) : createCoords(0); 6198 return { 6199 width: rect.width * scale.x, 6200 height: rect.height * scale.y, 6201 x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x + htmlOffset.x, 6202 y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y + htmlOffset.y 6203 }; 6204 } 6205 function getClientRects(element) { 6206 return Array.from(element.getClientRects()); 6207 } 6208 function getDocumentRect(element) { 6209 const html = getDocumentElement(element); 6210 const scroll = getNodeScroll(element); 6211 const body = element.ownerDocument.body; 6212 const width = max(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth); 6213 const height = max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight); 6214 let x2 = -scroll.scrollLeft + getWindowScrollBarX(element); 6215 const y2 = -scroll.scrollTop; 6216 if (getComputedStyle2(body).direction === "rtl") { 6217 x2 += max(html.clientWidth, body.clientWidth) - width; 6218 } 6219 return { 6220 width, 6221 height, 6222 x: x2, 6223 y: y2 6224 }; 6225 } 6226 var SCROLLBAR_MAX = 25; 6227 function getViewportRect(element, strategy) { 6228 const win = getWindow(element); 6229 const html = getDocumentElement(element); 6230 const visualViewport = win.visualViewport; 6231 let width = html.clientWidth; 6232 let height = html.clientHeight; 6233 let x2 = 0; 6234 let y2 = 0; 6235 if (visualViewport) { 6236 width = visualViewport.width; 6237 height = visualViewport.height; 6238 const visualViewportBased = isWebKit(); 6239 if (!visualViewportBased || visualViewportBased && strategy === "fixed") { 6240 x2 = visualViewport.offsetLeft; 6241 y2 = visualViewport.offsetTop; 6242 } 6243 } 6244 const windowScrollbarX = getWindowScrollBarX(html); 6245 if (windowScrollbarX <= 0) { 6246 const doc = html.ownerDocument; 6247 const body = doc.body; 6248 const bodyStyles = getComputedStyle(body); 6249 const bodyMarginInline = doc.compatMode === "CSS1Compat" ? parseFloat(bodyStyles.marginLeft) + parseFloat(bodyStyles.marginRight) || 0 : 0; 6250 const clippingStableScrollbarWidth = Math.abs(html.clientWidth - body.clientWidth - bodyMarginInline); 6251 if (clippingStableScrollbarWidth <= SCROLLBAR_MAX) { 6252 width -= clippingStableScrollbarWidth; 6253 } 6254 } else if (windowScrollbarX <= SCROLLBAR_MAX) { 6255 width += windowScrollbarX; 6256 } 6257 return { 6258 width, 6259 height, 6260 x: x2, 6261 y: y2 6262 }; 6263 } 6264 function getInnerBoundingClientRect(element, strategy) { 6265 const clientRect = getBoundingClientRect(element, true, strategy === "fixed"); 6266 const top = clientRect.top + element.clientTop; 6267 const left = clientRect.left + element.clientLeft; 6268 const scale = isHTMLElement(element) ? getScale(element) : createCoords(1); 6269 const width = element.clientWidth * scale.x; 6270 const height = element.clientHeight * scale.y; 6271 const x2 = left * scale.x; 6272 const y2 = top * scale.y; 6273 return { 6274 width, 6275 height, 6276 x: x2, 6277 y: y2 6278 }; 6279 } 6280 function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) { 6281 let rect; 6282 if (clippingAncestor === "viewport") { 6283 rect = getViewportRect(element, strategy); 6284 } else if (clippingAncestor === "document") { 6285 rect = getDocumentRect(getDocumentElement(element)); 6286 } else if (isElement(clippingAncestor)) { 6287 rect = getInnerBoundingClientRect(clippingAncestor, strategy); 6288 } else { 6289 const visualOffsets = getVisualOffsets(element); 6290 rect = { 6291 x: clippingAncestor.x - visualOffsets.x, 6292 y: clippingAncestor.y - visualOffsets.y, 6293 width: clippingAncestor.width, 6294 height: clippingAncestor.height 6295 }; 6296 } 6297 return rectToClientRect(rect); 6298 } 6299 function hasFixedPositionAncestor(element, stopNode) { 6300 const parentNode = getParentNode(element); 6301 if (parentNode === stopNode || !isElement(parentNode) || isLastTraversableNode(parentNode)) { 6302 return false; 6303 } 6304 return getComputedStyle2(parentNode).position === "fixed" || hasFixedPositionAncestor(parentNode, stopNode); 6305 } 6306 function getClippingElementAncestors(element, cache) { 6307 const cachedResult = cache.get(element); 6308 if (cachedResult) { 6309 return cachedResult; 6310 } 6311 let result = getOverflowAncestors(element, [], false).filter((el) => isElement(el) && getNodeName(el) !== "body"); 6312 let currentContainingBlockComputedStyle = null; 6313 const elementIsFixed = getComputedStyle2(element).position === "fixed"; 6314 let currentNode = elementIsFixed ? getParentNode(element) : element; 6315 while (isElement(currentNode) && !isLastTraversableNode(currentNode)) { 6316 const computedStyle = getComputedStyle2(currentNode); 6317 const currentNodeIsContaining = isContainingBlock(currentNode); 6318 if (!currentNodeIsContaining && computedStyle.position === "fixed") { 6319 currentContainingBlockComputedStyle = null; 6320 } 6321 const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === "static" && !!currentContainingBlockComputedStyle && (currentContainingBlockComputedStyle.position === "absolute" || currentContainingBlockComputedStyle.position === "fixed") || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode); 6322 if (shouldDropCurrentNode) { 6323 result = result.filter((ancestor) => ancestor !== currentNode); 6324 } else { 6325 currentContainingBlockComputedStyle = computedStyle; 6326 } 6327 currentNode = getParentNode(currentNode); 6328 } 6329 cache.set(element, result); 6330 return result; 6331 } 6332 function getClippingRect(_ref) { 6333 let { 6334 element, 6335 boundary, 6336 rootBoundary, 6337 strategy 6338 } = _ref; 6339 const elementClippingAncestors = boundary === "clippingAncestors" ? isTopLayer(element) ? [] : getClippingElementAncestors(element, this._c) : [].concat(boundary); 6340 const clippingAncestors = [...elementClippingAncestors, rootBoundary]; 6341 const firstRect = getClientRectFromClippingAncestor(element, clippingAncestors[0], strategy); 6342 let top = firstRect.top; 6343 let right = firstRect.right; 6344 let bottom = firstRect.bottom; 6345 let left = firstRect.left; 6346 for (let i2 = 1; i2 < clippingAncestors.length; i2++) { 6347 const rect = getClientRectFromClippingAncestor(element, clippingAncestors[i2], strategy); 6348 top = max(rect.top, top); 6349 right = min(rect.right, right); 6350 bottom = min(rect.bottom, bottom); 6351 left = max(rect.left, left); 6352 } 6353 return { 6354 width: right - left, 6355 height: bottom - top, 6356 x: left, 6357 y: top 6358 }; 6359 } 6360 function getDimensions(element) { 6361 const { 6362 width, 6363 height 6364 } = getCssDimensions(element); 6365 return { 6366 width, 6367 height 6368 }; 6369 } 6370 function getRectRelativeToOffsetParent(element, offsetParent, strategy) { 6371 const isOffsetParentAnElement = isHTMLElement(offsetParent); 6372 const documentElement = getDocumentElement(offsetParent); 6373 const isFixed2 = strategy === "fixed"; 6374 const rect = getBoundingClientRect(element, true, isFixed2, offsetParent); 6375 let scroll = { 6376 scrollLeft: 0, 6377 scrollTop: 0 6378 }; 6379 const offsets = createCoords(0); 6380 function setLeftRTLScrollbarOffset() { 6381 offsets.x = getWindowScrollBarX(documentElement); 6382 } 6383 if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed2) { 6384 if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) { 6385 scroll = getNodeScroll(offsetParent); 6386 } 6387 if (isOffsetParentAnElement) { 6388 const offsetRect = getBoundingClientRect(offsetParent, true, isFixed2, offsetParent); 6389 offsets.x = offsetRect.x + offsetParent.clientLeft; 6390 offsets.y = offsetRect.y + offsetParent.clientTop; 6391 } else if (documentElement) { 6392 setLeftRTLScrollbarOffset(); 6393 } 6394 } 6395 if (isFixed2 && !isOffsetParentAnElement && documentElement) { 6396 setLeftRTLScrollbarOffset(); 6397 } 6398 const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed2 ? getHTMLOffset(documentElement, scroll) : createCoords(0); 6399 const x2 = rect.left + scroll.scrollLeft - offsets.x - htmlOffset.x; 6400 const y2 = rect.top + scroll.scrollTop - offsets.y - htmlOffset.y; 6401 return { 6402 x: x2, 6403 y: y2, 6404 width: rect.width, 6405 height: rect.height 6406 }; 6407 } 6408 function isStaticPositioned(element) { 6409 return getComputedStyle2(element).position === "static"; 6410 } 6411 function getTrueOffsetParent(element, polyfill) { 6412 if (!isHTMLElement(element) || getComputedStyle2(element).position === "fixed") { 6413 return null; 6414 } 6415 if (polyfill) { 6416 return polyfill(element); 6417 } 6418 let rawOffsetParent = element.offsetParent; 6419 if (getDocumentElement(element) === rawOffsetParent) { 6420 rawOffsetParent = rawOffsetParent.ownerDocument.body; 6421 } 6422 return rawOffsetParent; 6423 } 6424 function getOffsetParent(element, polyfill) { 6425 const win = getWindow(element); 6426 if (isTopLayer(element)) { 6427 return win; 6428 } 6429 if (!isHTMLElement(element)) { 6430 let svgOffsetParent = getParentNode(element); 6431 while (svgOffsetParent && !isLastTraversableNode(svgOffsetParent)) { 6432 if (isElement(svgOffsetParent) && !isStaticPositioned(svgOffsetParent)) { 6433 return svgOffsetParent; 6434 } 6435 svgOffsetParent = getParentNode(svgOffsetParent); 6436 } 6437 return win; 6438 } 6439 let offsetParent = getTrueOffsetParent(element, polyfill); 6440 while (offsetParent && isTableElement(offsetParent) && isStaticPositioned(offsetParent)) { 6441 offsetParent = getTrueOffsetParent(offsetParent, polyfill); 6442 } 6443 if (offsetParent && isLastTraversableNode(offsetParent) && isStaticPositioned(offsetParent) && !isContainingBlock(offsetParent)) { 6444 return win; 6445 } 6446 return offsetParent || getContainingBlock(element) || win; 6447 } 6448 var getElementRects = async function(data) { 6449 const getOffsetParentFn = this.getOffsetParent || getOffsetParent; 6450 const getDimensionsFn = this.getDimensions; 6451 const floatingDimensions = await getDimensionsFn(data.floating); 6452 return { 6453 reference: getRectRelativeToOffsetParent(data.reference, await getOffsetParentFn(data.floating), data.strategy), 6454 floating: { 6455 x: 0, 6456 y: 0, 6457 width: floatingDimensions.width, 6458 height: floatingDimensions.height 6459 } 6460 }; 6461 }; 6462 function isRTL(element) { 6463 return getComputedStyle2(element).direction === "rtl"; 6464 } 6465 var platform2 = { 6466 convertOffsetParentRelativeRectToViewportRelativeRect, 6467 getDocumentElement, 6468 getClippingRect, 6469 getOffsetParent, 6470 getElementRects, 6471 getClientRects, 6472 getDimensions, 6473 getScale, 6474 isElement, 6475 isRTL 6476 }; 6477 function rectsAreEqual(a2, b2) { 6478 return a2.x === b2.x && a2.y === b2.y && a2.width === b2.width && a2.height === b2.height; 6479 } 6480 function observeMove(element, onMove) { 6481 let io = null; 6482 let timeoutId; 6483 const root = getDocumentElement(element); 6484 function cleanup() { 6485 var _io; 6486 clearTimeout(timeoutId); 6487 (_io = io) == null || _io.disconnect(); 6488 io = null; 6489 } 6490 function refresh(skip, threshold) { 6491 if (skip === void 0) { 6492 skip = false; 6493 } 6494 if (threshold === void 0) { 6495 threshold = 1; 6496 } 6497 cleanup(); 6498 const elementRectForRootMargin = element.getBoundingClientRect(); 6499 const { 6500 left, 6501 top, 6502 width, 6503 height 6504 } = elementRectForRootMargin; 6505 if (!skip) { 6506 onMove(); 6507 } 6508 if (!width || !height) { 6509 return; 6510 } 6511 const insetTop = floor(top); 6512 const insetRight = floor(root.clientWidth - (left + width)); 6513 const insetBottom = floor(root.clientHeight - (top + height)); 6514 const insetLeft = floor(left); 6515 const rootMargin = -insetTop + "px " + -insetRight + "px " + -insetBottom + "px " + -insetLeft + "px"; 6516 const options = { 6517 rootMargin, 6518 threshold: max(0, min(1, threshold)) || 1 6519 }; 6520 let isFirstUpdate = true; 6521 function handleObserve(entries) { 6522 const ratio = entries[0].intersectionRatio; 6523 if (ratio !== threshold) { 6524 if (!isFirstUpdate) { 6525 return refresh(); 6526 } 6527 if (!ratio) { 6528 timeoutId = setTimeout(() => { 6529 refresh(false, 1e-7); 6530 }, 1e3); 6531 } else { 6532 refresh(false, ratio); 6533 } 6534 } 6535 if (ratio === 1 && !rectsAreEqual(elementRectForRootMargin, element.getBoundingClientRect())) { 6536 refresh(); 6537 } 6538 isFirstUpdate = false; 6539 } 6540 try { 6541 io = new IntersectionObserver(handleObserve, { 6542 ...options, 6543 // Handle <iframe>s 6544 root: root.ownerDocument 6545 }); 6546 } catch (_e) { 6547 io = new IntersectionObserver(handleObserve, options); 6548 } 6549 io.observe(element); 6550 } 6551 refresh(true); 6552 return cleanup; 6553 } 6554 function autoUpdate(reference, floating, update2, options) { 6555 if (options === void 0) { 6556 options = {}; 6557 } 6558 const { 6559 ancestorScroll = true, 6560 ancestorResize = true, 6561 elementResize = typeof ResizeObserver === "function", 6562 layoutShift = typeof IntersectionObserver === "function", 6563 animationFrame = false 6564 } = options; 6565 const referenceEl = unwrapElement(reference); 6566 const ancestors = ancestorScroll || ancestorResize ? [...referenceEl ? getOverflowAncestors(referenceEl) : [], ...floating ? getOverflowAncestors(floating) : []] : []; 6567 ancestors.forEach((ancestor) => { 6568 ancestorScroll && ancestor.addEventListener("scroll", update2, { 6569 passive: true 6570 }); 6571 ancestorResize && ancestor.addEventListener("resize", update2); 6572 }); 6573 const cleanupIo = referenceEl && layoutShift ? observeMove(referenceEl, update2) : null; 6574 let reobserveFrame = -1; 6575 let resizeObserver = null; 6576 if (elementResize) { 6577 resizeObserver = new ResizeObserver((_ref) => { 6578 let [firstEntry] = _ref; 6579 if (firstEntry && firstEntry.target === referenceEl && resizeObserver && floating) { 6580 resizeObserver.unobserve(floating); 6581 cancelAnimationFrame(reobserveFrame); 6582 reobserveFrame = requestAnimationFrame(() => { 6583 var _resizeObserver; 6584 (_resizeObserver = resizeObserver) == null || _resizeObserver.observe(floating); 6585 }); 6586 } 6587 update2(); 6588 }); 6589 if (referenceEl && !animationFrame) { 6590 resizeObserver.observe(referenceEl); 6591 } 6592 if (floating) { 6593 resizeObserver.observe(floating); 6594 } 6595 } 6596 let frameId; 6597 let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null; 6598 if (animationFrame) { 6599 frameLoop(); 6600 } 6601 function frameLoop() { 6602 const nextRefRect = getBoundingClientRect(reference); 6603 if (prevRefRect && !rectsAreEqual(prevRefRect, nextRefRect)) { 6604 update2(); 6605 } 6606 prevRefRect = nextRefRect; 6607 frameId = requestAnimationFrame(frameLoop); 6608 } 6609 update2(); 6610 return () => { 6611 var _resizeObserver2; 6612 ancestors.forEach((ancestor) => { 6613 ancestorScroll && ancestor.removeEventListener("scroll", update2); 6614 ancestorResize && ancestor.removeEventListener("resize", update2); 6615 }); 6616 cleanupIo == null || cleanupIo(); 6617 (_resizeObserver2 = resizeObserver) == null || _resizeObserver2.disconnect(); 6618 resizeObserver = null; 6619 if (animationFrame) { 6620 cancelAnimationFrame(frameId); 6621 } 6622 }; 6623 } 6624 var offset2 = offset; 6625 var shift2 = shift; 6626 var flip2 = flip; 6627 var size2 = size; 6628 var hide2 = hide; 6629 var limitShift2 = limitShift; 6630 var computePosition2 = (reference, floating, options) => { 6631 const cache = /* @__PURE__ */ new Map(); 6632 const mergedOptions = { 6633 platform: platform2, 6634 ...options 6635 }; 6636 const platformWithCache = { 6637 ...mergedOptions.platform, 6638 _c: cache 6639 }; 6640 return computePosition(reference, floating, { 6641 ...mergedOptions, 6642 platform: platformWithCache 6643 }); 6644 }; 6645 6646 // node_modules/@base-ui/react/node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.mjs 6647 var React29 = __toESM(require_react(), 1); 6648 var import_react2 = __toESM(require_react(), 1); 6649 var ReactDOM3 = __toESM(require_react_dom(), 1); 6650 var isClient = typeof document !== "undefined"; 6651 var noop2 = function noop3() { 6652 }; 6653 var index = isClient ? import_react2.useLayoutEffect : noop2; 6654 function deepEqual(a2, b2) { 6655 if (a2 === b2) { 6656 return true; 6657 } 6658 if (typeof a2 !== typeof b2) { 6659 return false; 6660 } 6661 if (typeof a2 === "function" && a2.toString() === b2.toString()) { 6662 return true; 6663 } 6664 let length; 6665 let i2; 6666 let keys; 6667 if (a2 && b2 && typeof a2 === "object") { 6668 if (Array.isArray(a2)) { 6669 length = a2.length; 6670 if (length !== b2.length) return false; 6671 for (i2 = length; i2-- !== 0; ) { 6672 if (!deepEqual(a2[i2], b2[i2])) { 6673 return false; 6674 } 6675 } 6676 return true; 6677 } 6678 keys = Object.keys(a2); 6679 length = keys.length; 6680 if (length !== Object.keys(b2).length) { 6681 return false; 6682 } 6683 for (i2 = length; i2-- !== 0; ) { 6684 if (!{}.hasOwnProperty.call(b2, keys[i2])) { 6685 return false; 6686 } 6687 } 6688 for (i2 = length; i2-- !== 0; ) { 6689 const key2 = keys[i2]; 6690 if (key2 === "_owner" && a2.$$typeof) { 6691 continue; 6692 } 6693 if (!deepEqual(a2[key2], b2[key2])) { 6694 return false; 6695 } 6696 } 6697 return true; 6698 } 6699 return a2 !== a2 && b2 !== b2; 6700 } 6701 function getDPR(element) { 6702 if (typeof window === "undefined") { 6703 return 1; 6704 } 6705 const win = element.ownerDocument.defaultView || window; 6706 return win.devicePixelRatio || 1; 6707 } 6708 function roundByDPR(element, value) { 6709 const dpr = getDPR(element); 6710 return Math.round(value * dpr) / dpr; 6711 } 6712 function useLatestRef(value) { 6713 const ref = React29.useRef(value); 6714 index(() => { 6715 ref.current = value; 6716 }); 6717 return ref; 6718 } 6719 function useFloating(options) { 6720 if (options === void 0) { 6721 options = {}; 6722 } 6723 const { 6724 placement = "bottom", 6725 strategy = "absolute", 6726 middleware = [], 6727 platform: platform3, 6728 elements: { 6729 reference: externalReference, 6730 floating: externalFloating 6731 } = {}, 6732 transform = true, 6733 whileElementsMounted, 6734 open 6735 } = options; 6736 const [data, setData] = React29.useState({ 6737 x: 0, 6738 y: 0, 6739 strategy, 6740 placement, 6741 middlewareData: {}, 6742 isPositioned: false 6743 }); 6744 const [latestMiddleware, setLatestMiddleware] = React29.useState(middleware); 6745 if (!deepEqual(latestMiddleware, middleware)) { 6746 setLatestMiddleware(middleware); 6747 } 6748 const [_reference, _setReference] = React29.useState(null); 6749 const [_floating, _setFloating] = React29.useState(null); 6750 const setReference = React29.useCallback((node) => { 6751 if (node !== referenceRef.current) { 6752 referenceRef.current = node; 6753 _setReference(node); 6754 } 6755 }, []); 6756 const setFloating = React29.useCallback((node) => { 6757 if (node !== floatingRef.current) { 6758 floatingRef.current = node; 6759 _setFloating(node); 6760 } 6761 }, []); 6762 const referenceEl = externalReference || _reference; 6763 const floatingEl = externalFloating || _floating; 6764 const referenceRef = React29.useRef(null); 6765 const floatingRef = React29.useRef(null); 6766 const dataRef = React29.useRef(data); 6767 const hasWhileElementsMounted = whileElementsMounted != null; 6768 const whileElementsMountedRef = useLatestRef(whileElementsMounted); 6769 const platformRef = useLatestRef(platform3); 6770 const openRef = useLatestRef(open); 6771 const update2 = React29.useCallback(() => { 6772 if (!referenceRef.current || !floatingRef.current) { 6773 return; 6774 } 6775 const config = { 6776 placement, 6777 strategy, 6778 middleware: latestMiddleware 6779 }; 6780 if (platformRef.current) { 6781 config.platform = platformRef.current; 6782 } 6783 computePosition2(referenceRef.current, floatingRef.current, config).then((data2) => { 6784 const fullData = { 6785 ...data2, 6786 // The floating element's position may be recomputed while it's closed 6787 // but still mounted (such as when transitioning out). To ensure 6788 // `isPositioned` will be `false` initially on the next open, avoid 6789 // setting it to `true` when `open === false` (must be specified). 6790 isPositioned: openRef.current !== false 6791 }; 6792 if (isMountedRef.current && !deepEqual(dataRef.current, fullData)) { 6793 dataRef.current = fullData; 6794 ReactDOM3.flushSync(() => { 6795 setData(fullData); 6796 }); 6797 } 6798 }); 6799 }, [latestMiddleware, placement, strategy, platformRef, openRef]); 6800 index(() => { 6801 if (open === false && dataRef.current.isPositioned) { 6802 dataRef.current.isPositioned = false; 6803 setData((data2) => ({ 6804 ...data2, 6805 isPositioned: false 6806 })); 6807 } 6808 }, [open]); 6809 const isMountedRef = React29.useRef(false); 6810 index(() => { 6811 isMountedRef.current = true; 6812 return () => { 6813 isMountedRef.current = false; 6814 }; 6815 }, []); 6816 index(() => { 6817 if (referenceEl) referenceRef.current = referenceEl; 6818 if (floatingEl) floatingRef.current = floatingEl; 6819 if (referenceEl && floatingEl) { 6820 if (whileElementsMountedRef.current) { 6821 return whileElementsMountedRef.current(referenceEl, floatingEl, update2); 6822 } 6823 update2(); 6824 } 6825 }, [referenceEl, floatingEl, update2, whileElementsMountedRef, hasWhileElementsMounted]); 6826 const refs = React29.useMemo(() => ({ 6827 reference: referenceRef, 6828 floating: floatingRef, 6829 setReference, 6830 setFloating 6831 }), [setReference, setFloating]); 6832 const elements = React29.useMemo(() => ({ 6833 reference: referenceEl, 6834 floating: floatingEl 6835 }), [referenceEl, floatingEl]); 6836 const floatingStyles = React29.useMemo(() => { 6837 const initialStyles = { 6838 position: strategy, 6839 left: 0, 6840 top: 0 6841 }; 6842 if (!elements.floating) { 6843 return initialStyles; 6844 } 6845 const x2 = roundByDPR(elements.floating, data.x); 6846 const y2 = roundByDPR(elements.floating, data.y); 6847 if (transform) { 6848 return { 6849 ...initialStyles, 6850 transform: "translate(" + x2 + "px, " + y2 + "px)", 6851 ...getDPR(elements.floating) >= 1.5 && { 6852 willChange: "transform" 6853 } 6854 }; 6855 } 6856 return { 6857 position: strategy, 6858 left: x2, 6859 top: y2 6860 }; 6861 }, [strategy, transform, elements.floating, data.x, data.y]); 6862 return React29.useMemo(() => ({ 6863 ...data, 6864 update: update2, 6865 refs, 6866 elements, 6867 floatingStyles 6868 }), [data, update2, refs, elements, floatingStyles]); 6869 } 6870 var offset3 = (options, deps) => { 6871 const result = offset2(options); 6872 return { 6873 name: result.name, 6874 fn: result.fn, 6875 options: [options, deps] 6876 }; 6877 }; 6878 var shift3 = (options, deps) => { 6879 const result = shift2(options); 6880 return { 6881 name: result.name, 6882 fn: result.fn, 6883 options: [options, deps] 6884 }; 6885 }; 6886 var limitShift3 = (options, deps) => { 6887 const result = limitShift2(options); 6888 return { 6889 fn: result.fn, 6890 options: [options, deps] 6891 }; 6892 }; 6893 var flip3 = (options, deps) => { 6894 const result = flip2(options); 6895 return { 6896 name: result.name, 6897 fn: result.fn, 6898 options: [options, deps] 6899 }; 6900 }; 6901 var size3 = (options, deps) => { 6902 const result = size2(options); 6903 return { 6904 name: result.name, 6905 fn: result.fn, 6906 options: [options, deps] 6907 }; 6908 }; 6909 var hide3 = (options, deps) => { 6910 const result = hide2(options); 6911 return { 6912 name: result.name, 6913 fn: result.fn, 6914 options: [options, deps] 6915 }; 6916 }; 6917 6918 // node_modules/@base-ui/utils/esm/store/createSelector.js 6919 var createSelector = (a2, b2, c2, d2, e2, f2, ...other) => { 6920 if (other.length > 0) { 6921 throw new Error(true ? "Unsupported number of selectors" : formatErrorMessage_default(1)); 6922 } 6923 let selector2; 6924 if (a2 && b2 && c2 && d2 && e2 && f2) { 6925 selector2 = (state, a1, a22, a3) => { 6926 const va = a2(state, a1, a22, a3); 6927 const vb = b2(state, a1, a22, a3); 6928 const vc = c2(state, a1, a22, a3); 6929 const vd = d2(state, a1, a22, a3); 6930 const ve = e2(state, a1, a22, a3); 6931 return f2(va, vb, vc, vd, ve, a1, a22, a3); 6932 }; 6933 } else if (a2 && b2 && c2 && d2 && e2) { 6934 selector2 = (state, a1, a22, a3) => { 6935 const va = a2(state, a1, a22, a3); 6936 const vb = b2(state, a1, a22, a3); 6937 const vc = c2(state, a1, a22, a3); 6938 const vd = d2(state, a1, a22, a3); 6939 return e2(va, vb, vc, vd, a1, a22, a3); 6940 }; 6941 } else if (a2 && b2 && c2 && d2) { 6942 selector2 = (state, a1, a22, a3) => { 6943 const va = a2(state, a1, a22, a3); 6944 const vb = b2(state, a1, a22, a3); 6945 const vc = c2(state, a1, a22, a3); 6946 return d2(va, vb, vc, a1, a22, a3); 6947 }; 6948 } else if (a2 && b2 && c2) { 6949 selector2 = (state, a1, a22, a3) => { 6950 const va = a2(state, a1, a22, a3); 6951 const vb = b2(state, a1, a22, a3); 6952 return c2(va, vb, a1, a22, a3); 6953 }; 6954 } else if (a2 && b2) { 6955 selector2 = (state, a1, a22, a3) => { 6956 const va = a2(state, a1, a22, a3); 6957 return b2(va, a1, a22, a3); 6958 }; 6959 } else if (a2) { 6960 selector2 = a2; 6961 } else { 6962 throw ( 6963 /* minify-error-disabled */ 6964 new Error("Missing arguments") 6965 ); 6966 } 6967 return selector2; 6968 }; 6969 6970 // node_modules/@base-ui/utils/esm/store/useStore.js 6971 var React31 = __toESM(require_react(), 1); 6972 var import_shim = __toESM(require_shim(), 1); 6973 var import_with_selector = __toESM(require_with_selector(), 1); 6974 6975 // node_modules/@base-ui/utils/esm/fastHooks.js 6976 var React30 = __toESM(require_react(), 1); 6977 var hooks = []; 6978 var currentInstance = void 0; 6979 function getInstance() { 6980 return currentInstance; 6981 } 6982 function register(hook) { 6983 hooks.push(hook); 6984 } 6985 function fastComponent(fn) { 6986 const FastComponent = (props, forwardedRef) => { 6987 const instance = useRefWithInit(createInstance).current; 6988 let result; 6989 try { 6990 currentInstance = instance; 6991 for (const hook of hooks) { 6992 hook.before(instance); 6993 } 6994 result = fn(props, forwardedRef); 6995 for (const hook of hooks) { 6996 hook.after(instance); 6997 } 6998 instance.didInitialize = true; 6999 } finally { 7000 currentInstance = void 0; 7001 } 7002 return result; 7003 }; 7004 FastComponent.displayName = fn.displayName || fn.name; 7005 return FastComponent; 7006 } 7007 function fastComponentRef(fn) { 7008 return /* @__PURE__ */ React30.forwardRef(fastComponent(fn)); 7009 } 7010 function createInstance() { 7011 return { 7012 didInitialize: false 7013 }; 7014 } 7015 7016 // node_modules/@base-ui/utils/esm/store/useStore.js 7017 var canUseRawUseSyncExternalStore = isReactVersionAtLeast(19); 7018 var useStoreImplementation = canUseRawUseSyncExternalStore ? useStoreFast : useStoreLegacy; 7019 function useStore(store, selector2, a1, a2, a3) { 7020 return useStoreImplementation(store, selector2, a1, a2, a3); 7021 } 7022 function useStoreR19(store, selector2, a1, a2, a3) { 7023 const getSelection = React31.useCallback(() => selector2(store.getSnapshot(), a1, a2, a3), [store, selector2, a1, a2, a3]); 7024 return (0, import_shim.useSyncExternalStore)(store.subscribe, getSelection, getSelection); 7025 } 7026 register({ 7027 before(instance) { 7028 instance.syncIndex = 0; 7029 if (!instance.didInitialize) { 7030 instance.syncTick = 1; 7031 instance.syncHooks = []; 7032 instance.didChangeStore = true; 7033 instance.getSnapshot = () => { 7034 let didChange2 = false; 7035 for (let i2 = 0; i2 < instance.syncHooks.length; i2 += 1) { 7036 const hook = instance.syncHooks[i2]; 7037 const value = hook.selector(hook.store.state, hook.a1, hook.a2, hook.a3); 7038 if (hook.didChange || !Object.is(hook.value, value)) { 7039 didChange2 = true; 7040 hook.value = value; 7041 hook.didChange = false; 7042 } 7043 } 7044 if (didChange2) { 7045 instance.syncTick += 1; 7046 } 7047 return instance.syncTick; 7048 }; 7049 } 7050 }, 7051 after(instance) { 7052 if (instance.syncHooks.length > 0) { 7053 if (instance.didChangeStore) { 7054 instance.didChangeStore = false; 7055 instance.subscribe = (onStoreChange) => { 7056 const stores = /* @__PURE__ */ new Set(); 7057 for (const hook of instance.syncHooks) { 7058 stores.add(hook.store); 7059 } 7060 const unsubscribes = []; 7061 for (const store of stores) { 7062 unsubscribes.push(store.subscribe(onStoreChange)); 7063 } 7064 return () => { 7065 for (const unsubscribe of unsubscribes) { 7066 unsubscribe(); 7067 } 7068 }; 7069 }; 7070 } 7071 (0, import_shim.useSyncExternalStore)(instance.subscribe, instance.getSnapshot, instance.getSnapshot); 7072 } 7073 } 7074 }); 7075 function useStoreFast(store, selector2, a1, a2, a3) { 7076 const instance = getInstance(); 7077 if (!instance) { 7078 return useStoreR19(store, selector2, a1, a2, a3); 7079 } 7080 const index2 = instance.syncIndex; 7081 instance.syncIndex += 1; 7082 let hook; 7083 if (!instance.didInitialize) { 7084 hook = { 7085 store, 7086 selector: selector2, 7087 a1, 7088 a2, 7089 a3, 7090 value: selector2(store.getSnapshot(), a1, a2, a3), 7091 didChange: false 7092 }; 7093 instance.syncHooks.push(hook); 7094 } else { 7095 hook = instance.syncHooks[index2]; 7096 if (hook.store !== store || hook.selector !== selector2 || !Object.is(hook.a1, a1) || !Object.is(hook.a2, a2) || !Object.is(hook.a3, a3)) { 7097 if (hook.store !== store) { 7098 instance.didChangeStore = true; 7099 } 7100 hook.store = store; 7101 hook.selector = selector2; 7102 hook.a1 = a1; 7103 hook.a2 = a2; 7104 hook.a3 = a3; 7105 hook.didChange = true; 7106 } 7107 } 7108 return hook.value; 7109 } 7110 function useStoreLegacy(store, selector2, a1, a2, a3) { 7111 return (0, import_with_selector.useSyncExternalStoreWithSelector)(store.subscribe, store.getSnapshot, store.getSnapshot, (state) => selector2(state, a1, a2, a3)); 7112 } 7113 7114 // node_modules/@base-ui/utils/esm/store/Store.js 7115 var Store = class { 7116 /** 7117 * The current state of the store. 7118 * This property is updated immediately when the state changes as a result of calling {@link setState}, {@link update}, or {@link set}. 7119 * 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). 7120 * The values can be used directly (to avoid subscribing to the store) in effects or event handlers. 7121 * 7122 * Do not modify properties in state directly. Instead, use the provided methods to ensure proper state management and listener notification. 7123 */ 7124 // Internal state to handle recursive `setState()` calls 7125 constructor(state) { 7126 this.state = state; 7127 this.listeners = /* @__PURE__ */ new Set(); 7128 this.updateTick = 0; 7129 } 7130 /** 7131 * Registers a listener that will be called whenever the store's state changes. 7132 * 7133 * @param fn The listener function to be called on state changes. 7134 * @returns A function to unsubscribe the listener. 7135 */ 7136 subscribe = (fn) => { 7137 this.listeners.add(fn); 7138 return () => { 7139 this.listeners.delete(fn); 7140 }; 7141 }; 7142 /** 7143 * Returns the current state of the store. 7144 */ 7145 getSnapshot = () => { 7146 return this.state; 7147 }; 7148 /** 7149 * Updates the entire store's state and notifies all registered listeners. 7150 * 7151 * @param newState The new state to set for the store. 7152 */ 7153 setState(newState) { 7154 if (this.state === newState) { 7155 return; 7156 } 7157 this.state = newState; 7158 this.updateTick += 1; 7159 const currentTick = this.updateTick; 7160 for (const listener of this.listeners) { 7161 if (currentTick !== this.updateTick) { 7162 return; 7163 } 7164 listener(newState); 7165 } 7166 } 7167 /** 7168 * Merges the provided changes into the current state and notifies listeners if there are changes. 7169 * 7170 * @param changes An object containing the changes to apply to the current state. 7171 */ 7172 update(changes) { 7173 for (const key2 in changes) { 7174 if (!Object.is(this.state[key2], changes[key2])) { 7175 this.setState({ 7176 ...this.state, 7177 ...changes 7178 }); 7179 return; 7180 } 7181 } 7182 } 7183 /** 7184 * Sets a specific key in the store's state to a new value and notifies listeners if the value has changed. 7185 * 7186 * @param key The key in the store's state to update. 7187 * @param value The new value to set for the specified key. 7188 */ 7189 set(key2, value) { 7190 if (!Object.is(this.state[key2], value)) { 7191 this.setState({ 7192 ...this.state, 7193 [key2]: value 7194 }); 7195 } 7196 } 7197 /** 7198 * Gives the state a new reference and updates all registered listeners. 7199 */ 7200 notifyAll() { 7201 const newState = { 7202 ...this.state 7203 }; 7204 this.setState(newState); 7205 } 7206 use(selector2, a1, a2, a3) { 7207 return useStore(this, selector2, a1, a2, a3); 7208 } 7209 }; 7210 7211 // node_modules/@base-ui/utils/esm/store/ReactStore.js 7212 var React32 = __toESM(require_react(), 1); 7213 var ReactStore = class extends Store { 7214 /** 7215 * Creates a new ReactStore instance. 7216 * 7217 * @param state Initial state of the store. 7218 * @param context Non-reactive context values. 7219 * @param selectors Optional selectors for use with `useState`. 7220 */ 7221 constructor(state, context = {}, selectors4) { 7222 super(state); 7223 this.context = context; 7224 this.selectors = selectors4; 7225 } 7226 /** 7227 * Non-reactive values such as refs, callbacks, etc. 7228 */ 7229 /** 7230 * Synchronizes a single external value into the store. 7231 * 7232 * Note that the while the value in `state` is updated immediately, the value returned 7233 * by `useState` is updated before the next render (similarly to React's `useState`). 7234 */ 7235 useSyncedValue(key2, value) { 7236 React32.useDebugValue(key2); 7237 useIsoLayoutEffect(() => { 7238 if (this.state[key2] !== value) { 7239 this.set(key2, value); 7240 } 7241 }, [key2, value]); 7242 } 7243 /** 7244 * Synchronizes a single external value into the store and 7245 * cleans it up (sets to `undefined`) on unmount. 7246 * 7247 * Note that the while the value in `state` is updated immediately, the value returned 7248 * by `useState` is updated before the next render (similarly to React's `useState`). 7249 */ 7250 useSyncedValueWithCleanup(key2, value) { 7251 const store = this; 7252 useIsoLayoutEffect(() => { 7253 if (store.state[key2] !== value) { 7254 store.set(key2, value); 7255 } 7256 return () => { 7257 store.set(key2, void 0); 7258 }; 7259 }, [store, key2, value]); 7260 } 7261 /** 7262 * Synchronizes multiple external values into the store. 7263 * 7264 * Note that the while the values in `state` are updated immediately, the values returned 7265 * by `useState` are updated before the next render (similarly to React's `useState`). 7266 */ 7267 useSyncedValues(statePart) { 7268 const store = this; 7269 if (true) { 7270 React32.useDebugValue(statePart, (p2) => Object.keys(p2)); 7271 const keys = React32.useRef(Object.keys(statePart)).current; 7272 const nextKeys = Object.keys(statePart); 7273 if (keys.length !== nextKeys.length || keys.some((key2, index2) => key2 !== nextKeys[index2])) { 7274 console.error("ReactStore.useSyncedValues expects the same prop keys on every render. Keys should be stable."); 7275 } 7276 } 7277 const dependencies = Object.values(statePart); 7278 useIsoLayoutEffect(() => { 7279 store.update(statePart); 7280 }, [store, ...dependencies]); 7281 } 7282 /** 7283 * Registers a controllable prop pair (`controlled`, `defaultValue`) for a specific key. If `controlled` 7284 * is non-undefined, the store's state at `key` is updated to match `controlled`. 7285 */ 7286 useControlledProp(key2, controlled) { 7287 React32.useDebugValue(key2); 7288 const isControlled = controlled !== void 0; 7289 useIsoLayoutEffect(() => { 7290 if (isControlled && !Object.is(this.state[key2], controlled)) { 7291 super.setState({ 7292 ...this.state, 7293 [key2]: controlled 7294 }); 7295 } 7296 }, [key2, controlled, isControlled]); 7297 if (true) { 7298 const cache = this.controlledValues ??= /* @__PURE__ */ new Map(); 7299 if (!cache.has(key2)) { 7300 cache.set(key2, isControlled); 7301 } 7302 const previouslyControlled = cache.get(key2); 7303 if (previouslyControlled !== void 0 && previouslyControlled !== isControlled) { 7304 console.error(`A component is changing the $isControlled ? "" : "un"}controlled state of $key2.toString()} to be $isControlled ? "un" : ""}controlled. Elements should not switch from uncontrolled to controlled (or vice versa).`); 7305 } 7306 } 7307 } 7308 /** Gets the current value from the store using a selector with the provided key. 7309 * 7310 * @param key Key of the selector to use. 7311 */ 7312 select(key2, a1, a2, a3) { 7313 const selector2 = this.selectors[key2]; 7314 return selector2(this.state, a1, a2, a3); 7315 } 7316 /** 7317 * Returns a value from the store's state using a selector function. 7318 * Used to subscribe to specific parts of the state. 7319 * This methods causes a rerender whenever the selected state changes. 7320 * 7321 * @param key Key of the selector to use. 7322 */ 7323 useState(key2, a1, a2, a3) { 7324 React32.useDebugValue(key2); 7325 return useStore(this, this.selectors[key2], a1, a2, a3); 7326 } 7327 /** 7328 * Wraps a function with `useStableCallback` to ensure it has a stable reference 7329 * and assigns it to the context. 7330 * 7331 * @param key Key of the event callback. Must be a function in the context. 7332 * @param fn Function to assign. 7333 */ 7334 useContextCallback(key2, fn) { 7335 React32.useDebugValue(key2); 7336 const stableFunction = useStableCallback(fn ?? NOOP); 7337 this.context[key2] = stableFunction; 7338 } 7339 /** 7340 * Returns a stable setter function for a specific key in the store's state. 7341 * It's commonly used to pass as a ref callback to React elements. 7342 * 7343 * @param key Key of the state to set. 7344 */ 7345 useStateSetter(key2) { 7346 const ref = React32.useRef(void 0); 7347 if (ref.current === void 0) { 7348 ref.current = (value) => { 7349 this.set(key2, value); 7350 }; 7351 } 7352 return ref.current; 7353 } 7354 /** 7355 * Observes changes derived from the store's selectors and calls the listener when the selected value changes. 7356 * 7357 * @param key Key of the selector to observe. 7358 * @param listener Listener function called when the selector result changes. 7359 */ 7360 observe(selector2, listener) { 7361 let selectFn; 7362 if (typeof selector2 === "function") { 7363 selectFn = selector2; 7364 } else { 7365 selectFn = this.selectors[selector2]; 7366 } 7367 let prevValue = selectFn(this.state); 7368 listener(prevValue, prevValue, this); 7369 return this.subscribe((nextState) => { 7370 const nextValue = selectFn(nextState); 7371 if (!Object.is(prevValue, nextValue)) { 7372 const oldValue = prevValue; 7373 prevValue = nextValue; 7374 listener(nextValue, oldValue, this); 7375 } 7376 }); 7377 } 7378 }; 7379 7380 // node_modules/@base-ui/react/esm/floating-ui-react/components/FloatingRootStore.js 7381 var selectors = { 7382 open: createSelector((state) => state.open), 7383 transitionStatus: createSelector((state) => state.transitionStatus), 7384 domReferenceElement: createSelector((state) => state.domReferenceElement), 7385 referenceElement: createSelector((state) => state.positionReference ?? state.referenceElement), 7386 floatingElement: createSelector((state) => state.floatingElement), 7387 floatingId: createSelector((state) => state.floatingId) 7388 }; 7389 var FloatingRootStore = class extends ReactStore { 7390 constructor(options) { 7391 const { 7392 syncOnly, 7393 nested, 7394 onOpenChange, 7395 triggerElements, 7396 ...initialState 7397 } = options; 7398 super({ 7399 ...initialState, 7400 positionReference: initialState.referenceElement, 7401 domReferenceElement: initialState.referenceElement 7402 }, { 7403 onOpenChange, 7404 dataRef: { 7405 current: {} 7406 }, 7407 events: createEventEmitter(), 7408 nested, 7409 triggerElements 7410 }, selectors); 7411 this.syncOnly = syncOnly; 7412 } 7413 /** 7414 * Syncs the event used by hover logic to distinguish hover-open from click-like interaction. 7415 */ 7416 syncOpenEvent = (newOpen, event) => { 7417 if (!newOpen || !this.state.open || // Prevent a pending hover-open from overwriting a click-open event, while allowing 7418 // click events to upgrade a hover-open. 7419 event != null && isClickLikeEvent(event)) { 7420 this.context.dataRef.current.openEvent = newOpen ? event : void 0; 7421 } 7422 }; 7423 /** 7424 * Runs the root-owned side effects for an open state change. 7425 */ 7426 dispatchOpenChange = (newOpen, eventDetails) => { 7427 this.syncOpenEvent(newOpen, eventDetails.event); 7428 const details = { 7429 open: newOpen, 7430 reason: eventDetails.reason, 7431 nativeEvent: eventDetails.event, 7432 nested: this.context.nested, 7433 triggerElement: eventDetails.trigger 7434 }; 7435 this.context.events.emit("openchange", details); 7436 }; 7437 /** 7438 * Emits the `openchange` event through the internal event emitter and calls the `onOpenChange` handler with the provided arguments. 7439 * 7440 * @param newOpen The new open state. 7441 * @param eventDetails Details about the event that triggered the open state change. 7442 */ 7443 setOpen = (newOpen, eventDetails) => { 7444 if (this.syncOnly) { 7445 this.context.onOpenChange?.(newOpen, eventDetails); 7446 return; 7447 } 7448 this.dispatchOpenChange(newOpen, eventDetails); 7449 this.context.onOpenChange?.(newOpen, eventDetails); 7450 }; 7451 }; 7452 7453 // node_modules/@base-ui/react/esm/utils/popups/popupStoreUtils.js 7454 var React33 = __toESM(require_react(), 1); 7455 function useTriggerRegistration(id, store) { 7456 const registeredElementIdRef = React33.useRef(null); 7457 const registeredElementRef = React33.useRef(null); 7458 return React33.useCallback((element) => { 7459 if (id === void 0) { 7460 return; 7461 } 7462 if (registeredElementIdRef.current !== null) { 7463 const registeredId = registeredElementIdRef.current; 7464 const registeredElement = registeredElementRef.current; 7465 const currentElement = store.context.triggerElements.getById(registeredId); 7466 if (registeredElement && currentElement === registeredElement) { 7467 store.context.triggerElements.delete(registeredId); 7468 } 7469 registeredElementIdRef.current = null; 7470 registeredElementRef.current = null; 7471 } 7472 if (element !== null) { 7473 registeredElementIdRef.current = id; 7474 registeredElementRef.current = element; 7475 store.context.triggerElements.add(id, element); 7476 } 7477 }, [store, id]); 7478 } 7479 function useTriggerDataForwarding(triggerId, triggerElementRef, store, stateUpdates) { 7480 const isMountedByThisTrigger = store.useState("isMountedByTrigger", triggerId); 7481 const baseRegisterTrigger = useTriggerRegistration(triggerId, store); 7482 const registerTrigger = useStableCallback((element) => { 7483 baseRegisterTrigger(element); 7484 if (!element || !store.select("open")) { 7485 return; 7486 } 7487 const activeTriggerId = store.select("activeTriggerId"); 7488 if (activeTriggerId === triggerId) { 7489 store.update({ 7490 activeTriggerElement: element, 7491 ...stateUpdates 7492 }); 7493 return; 7494 } 7495 if (activeTriggerId == null) { 7496 store.update({ 7497 activeTriggerId: triggerId, 7498 activeTriggerElement: element, 7499 ...stateUpdates 7500 }); 7501 } 7502 }); 7503 useIsoLayoutEffect(() => { 7504 if (isMountedByThisTrigger) { 7505 store.update({ 7506 activeTriggerElement: triggerElementRef.current, 7507 ...stateUpdates 7508 }); 7509 } 7510 }, [isMountedByThisTrigger, store, triggerElementRef, ...Object.values(stateUpdates)]); 7511 return { 7512 registerTrigger, 7513 isMountedByThisTrigger 7514 }; 7515 } 7516 function useImplicitActiveTrigger(store) { 7517 const open = store.useState("open"); 7518 useIsoLayoutEffect(() => { 7519 if (open && !store.select("activeTriggerId") && store.context.triggerElements.size === 1) { 7520 const iteratorResult = store.context.triggerElements.entries().next(); 7521 if (!iteratorResult.done) { 7522 const [implicitTriggerId, implicitTriggerElement] = iteratorResult.value; 7523 store.update({ 7524 activeTriggerId: implicitTriggerId, 7525 activeTriggerElement: implicitTriggerElement 7526 }); 7527 } 7528 } 7529 }, [open, store]); 7530 } 7531 function useOpenStateTransitions(open, store, onUnmount) { 7532 const { 7533 mounted, 7534 setMounted, 7535 transitionStatus 7536 } = useTransitionStatus(open); 7537 store.useSyncedValues({ 7538 mounted, 7539 transitionStatus 7540 }); 7541 const forceUnmount = useStableCallback(() => { 7542 setMounted(false); 7543 store.update({ 7544 activeTriggerId: null, 7545 activeTriggerElement: null, 7546 mounted: false 7547 }); 7548 onUnmount?.(); 7549 store.context.onOpenChangeComplete?.(false); 7550 }); 7551 const preventUnmountingOnClose = store.useState("preventUnmountingOnClose"); 7552 useOpenChangeComplete({ 7553 enabled: !preventUnmountingOnClose, 7554 open, 7555 ref: store.context.popupRef, 7556 onComplete() { 7557 if (!open) { 7558 forceUnmount(); 7559 } 7560 } 7561 }); 7562 return { 7563 forceUnmount, 7564 transitionStatus 7565 }; 7566 } 7567 7568 // node_modules/@base-ui/react/esm/utils/popups/popupTriggerMap.js 7569 var PopupTriggerMap = class { 7570 constructor() { 7571 this.elementsSet = /* @__PURE__ */ new Set(); 7572 this.idMap = /* @__PURE__ */ new Map(); 7573 } 7574 /** 7575 * Adds a trigger element with the given ID. 7576 * 7577 * Note: The provided element is assumed to not be registered under multiple IDs. 7578 */ 7579 add(id, element) { 7580 const existingElement = this.idMap.get(id); 7581 if (existingElement === element) { 7582 return; 7583 } 7584 if (existingElement !== void 0) { 7585 this.elementsSet.delete(existingElement); 7586 } 7587 this.elementsSet.add(element); 7588 this.idMap.set(id, element); 7589 if (true) { 7590 if (this.elementsSet.size !== this.idMap.size) { 7591 throw new Error("Base UI: A trigger element cannot be registered under multiple IDs in PopupTriggerMap."); 7592 } 7593 } 7594 } 7595 /** 7596 * Removes the trigger element with the given ID. 7597 */ 7598 delete(id) { 7599 const element = this.idMap.get(id); 7600 if (element) { 7601 this.elementsSet.delete(element); 7602 this.idMap.delete(id); 7603 } 7604 } 7605 /** 7606 * Whether the given element is registered as a trigger. 7607 */ 7608 hasElement(element) { 7609 return this.elementsSet.has(element); 7610 } 7611 /** 7612 * Whether there is a registered trigger element matching the given predicate. 7613 */ 7614 hasMatchingElement(predicate) { 7615 for (const element of this.elementsSet) { 7616 if (predicate(element)) { 7617 return true; 7618 } 7619 } 7620 return false; 7621 } 7622 /** 7623 * Returns the trigger element associated with the given ID, or undefined if no such element exists. 7624 */ 7625 getById(id) { 7626 return this.idMap.get(id); 7627 } 7628 /** 7629 * Returns an iterable of all registered trigger entries, where each entry is a tuple of [id, element]. 7630 */ 7631 entries() { 7632 return this.idMap.entries(); 7633 } 7634 /** 7635 * Returns an iterable of all registered trigger elements. 7636 */ 7637 elements() { 7638 return this.elementsSet.values(); 7639 } 7640 /** 7641 * Returns the number of registered trigger elements. 7642 */ 7643 get size() { 7644 return this.idMap.size; 7645 } 7646 }; 7647 7648 // node_modules/@base-ui/react/esm/floating-ui-react/utils/getEmptyRootContext.js 7649 function getEmptyRootContext() { 7650 return new FloatingRootStore({ 7651 open: false, 7652 transitionStatus: void 0, 7653 floatingElement: null, 7654 referenceElement: null, 7655 triggerElements: new PopupTriggerMap(), 7656 floatingId: "", 7657 syncOnly: false, 7658 nested: false, 7659 onOpenChange: void 0 7660 }); 7661 } 7662 7663 // node_modules/@base-ui/react/esm/utils/popups/store.js 7664 function createInitialPopupStoreState() { 7665 return { 7666 open: false, 7667 openProp: void 0, 7668 mounted: false, 7669 transitionStatus: void 0, 7670 floatingRootContext: getEmptyRootContext(), 7671 preventUnmountingOnClose: false, 7672 payload: void 0, 7673 activeTriggerId: null, 7674 activeTriggerElement: null, 7675 triggerIdProp: void 0, 7676 popupElement: null, 7677 positionerElement: null, 7678 activeTriggerProps: EMPTY_OBJECT, 7679 inactiveTriggerProps: EMPTY_OBJECT, 7680 popupProps: EMPTY_OBJECT 7681 }; 7682 } 7683 var activeTriggerIdSelector = createSelector((state) => state.triggerIdProp ?? state.activeTriggerId); 7684 var popupStoreSelectors = { 7685 open: createSelector((state) => state.openProp ?? state.open), 7686 mounted: createSelector((state) => state.mounted), 7687 transitionStatus: createSelector((state) => state.transitionStatus), 7688 floatingRootContext: createSelector((state) => state.floatingRootContext), 7689 preventUnmountingOnClose: createSelector((state) => state.preventUnmountingOnClose), 7690 payload: createSelector((state) => state.payload), 7691 activeTriggerId: activeTriggerIdSelector, 7692 activeTriggerElement: createSelector((state) => state.mounted ? state.activeTriggerElement : null), 7693 /** 7694 * Whether the trigger with the given ID was used to open the popup. 7695 */ 7696 isTriggerActive: createSelector((state, triggerId) => triggerId !== void 0 && activeTriggerIdSelector(state) === triggerId), 7697 /** 7698 * Whether the popup is open and was activated by a trigger with the given ID. 7699 */ 7700 isOpenedByTrigger: createSelector((state, triggerId) => triggerId !== void 0 && activeTriggerIdSelector(state) === triggerId && state.open), 7701 /** 7702 * Whether the popup is mounted and was activated by a trigger with the given ID. 7703 */ 7704 isMountedByTrigger: createSelector((state, triggerId) => triggerId !== void 0 && activeTriggerIdSelector(state) === triggerId && state.mounted), 7705 triggerProps: createSelector((state, isActive) => isActive ? state.activeTriggerProps : state.inactiveTriggerProps), 7706 popupProps: createSelector((state) => state.popupProps), 7707 popupElement: createSelector((state) => state.popupElement), 7708 positionerElement: createSelector((state) => state.positionerElement) 7709 }; 7710 7711 // node_modules/@base-ui/react/esm/floating-ui-react/hooks/useFloatingRootContext.js 7712 function useFloatingRootContext(options) { 7713 const { 7714 open = false, 7715 onOpenChange, 7716 elements = {} 7717 } = options; 7718 const floatingId = useId(); 7719 const nested = useFloatingParentNodeId() != null; 7720 if (true) { 7721 const optionDomReference = elements.reference; 7722 if (optionDomReference && !isElement(optionDomReference)) { 7723 console.error("Cannot pass a virtual element to the `elements.reference` option,", "as it must be a real DOM element. Use `context.setPositionReference()`", "instead."); 7724 } 7725 } 7726 const store = useRefWithInit(() => new FloatingRootStore({ 7727 open, 7728 transitionStatus: void 0, 7729 onOpenChange, 7730 referenceElement: elements.reference ?? null, 7731 floatingElement: elements.floating ?? null, 7732 triggerElements: new PopupTriggerMap(), 7733 floatingId, 7734 syncOnly: false, 7735 nested 7736 })).current; 7737 useIsoLayoutEffect(() => { 7738 const valuesToSync = { 7739 open, 7740 floatingId 7741 }; 7742 if (elements.reference !== void 0) { 7743 valuesToSync.referenceElement = elements.reference; 7744 valuesToSync.domReferenceElement = isElement(elements.reference) ? elements.reference : null; 7745 } 7746 if (elements.floating !== void 0) { 7747 valuesToSync.floatingElement = elements.floating; 7748 } 7749 store.update(valuesToSync); 7750 }, [open, floatingId, elements.reference, elements.floating, store]); 7751 store.context.onOpenChange = onOpenChange; 7752 store.context.nested = nested; 7753 return store; 7754 } 7755 7756 // node_modules/@base-ui/react/esm/floating-ui-react/hooks/useFloating.js 7757 function useFloating2(options = {}) { 7758 const { 7759 nodeId, 7760 externalTree 7761 } = options; 7762 const internalRootStore = useFloatingRootContext(options); 7763 const rootContext = options.rootContext || internalRootStore; 7764 const rootContextElements = { 7765 reference: rootContext.useState("referenceElement"), 7766 floating: rootContext.useState("floatingElement"), 7767 domReference: rootContext.useState("domReferenceElement") 7768 }; 7769 const [positionReference, setPositionReferenceRaw] = React34.useState(null); 7770 const domReferenceRef = React34.useRef(null); 7771 const tree = useFloatingTree(externalTree); 7772 useIsoLayoutEffect(() => { 7773 if (rootContextElements.domReference) { 7774 domReferenceRef.current = rootContextElements.domReference; 7775 } 7776 }, [rootContextElements.domReference]); 7777 const position = useFloating({ 7778 ...options, 7779 elements: { 7780 ...rootContextElements, 7781 ...positionReference && { 7782 reference: positionReference 7783 } 7784 } 7785 }); 7786 const setPositionReference = React34.useCallback((node) => { 7787 const computedPositionReference = isElement(node) ? { 7788 getBoundingClientRect: () => node.getBoundingClientRect(), 7789 getClientRects: () => node.getClientRects(), 7790 contextElement: node 7791 } : node; 7792 setPositionReferenceRaw(computedPositionReference); 7793 position.refs.setReference(computedPositionReference); 7794 }, [position.refs]); 7795 const [localDomReference, setLocalDomReference] = React34.useState(void 0); 7796 const [localFloatingElement, setLocalFloatingElement] = React34.useState(null); 7797 rootContext.useSyncedValue("referenceElement", localDomReference ?? null); 7798 const localDomReferenceElement = isElement(localDomReference) ? localDomReference : null; 7799 rootContext.useSyncedValue("domReferenceElement", localDomReference === void 0 ? rootContextElements.domReference : localDomReferenceElement); 7800 rootContext.useSyncedValue("floatingElement", localFloatingElement); 7801 const setReference = React34.useCallback((node) => { 7802 if (isElement(node) || node === null) { 7803 domReferenceRef.current = node; 7804 setLocalDomReference(node); 7805 } 7806 if (isElement(position.refs.reference.current) || position.refs.reference.current === null || // Don't allow setting virtual elements using the old technique back to 7807 // `null` to support `positionReference` + an unstable `reference` 7808 // callback ref. 7809 node !== null && !isElement(node)) { 7810 position.refs.setReference(node); 7811 } 7812 }, [position.refs, setLocalDomReference]); 7813 const setFloating = React34.useCallback((node) => { 7814 setLocalFloatingElement(node); 7815 position.refs.setFloating(node); 7816 }, [position.refs]); 7817 const refs = React34.useMemo(() => ({ 7818 ...position.refs, 7819 setReference, 7820 setFloating, 7821 setPositionReference, 7822 domReference: domReferenceRef 7823 }), [position.refs, setReference, setFloating, setPositionReference]); 7824 const elements = React34.useMemo(() => ({ 7825 ...position.elements, 7826 domReference: rootContextElements.domReference 7827 }), [position.elements, rootContextElements.domReference]); 7828 const open = rootContext.useState("open"); 7829 const floatingId = rootContext.useState("floatingId"); 7830 const context = React34.useMemo(() => ({ 7831 ...position, 7832 dataRef: rootContext.context.dataRef, 7833 open, 7834 onOpenChange: rootContext.setOpen, 7835 events: rootContext.context.events, 7836 floatingId, 7837 refs, 7838 elements, 7839 nodeId, 7840 rootStore: rootContext 7841 }), [position, refs, elements, nodeId, rootContext, open, floatingId]); 7842 useIsoLayoutEffect(() => { 7843 rootContext.context.dataRef.current.floatingContext = context; 7844 const node = tree?.nodesRef.current.find((n2) => n2.id === nodeId); 7845 if (node) { 7846 node.context = context; 7847 } 7848 }); 7849 return React34.useMemo(() => ({ 7850 ...position, 7851 context, 7852 refs, 7853 elements, 7854 rootStore: rootContext 7855 }), [position, refs, elements, context, rootContext]); 7856 } 7857 7858 // node_modules/@base-ui/react/esm/floating-ui-react/hooks/useSyncedFloatingRootContext.js 7859 function useSyncedFloatingRootContext(options) { 7860 const { 7861 popupStore, 7862 treatPopupAsFloatingElement = false, 7863 onOpenChange 7864 } = options; 7865 const floatingId = useId(); 7866 const nested = useFloatingParentNodeId() != null; 7867 const open = popupStore.useState("open"); 7868 const referenceElement = popupStore.useState("activeTriggerElement"); 7869 const floatingElement = popupStore.useState(treatPopupAsFloatingElement ? "popupElement" : "positionerElement"); 7870 const triggerElements = popupStore.context.triggerElements; 7871 const store = useRefWithInit(() => new FloatingRootStore({ 7872 open, 7873 transitionStatus: void 0, 7874 referenceElement, 7875 floatingElement, 7876 triggerElements, 7877 onOpenChange, 7878 floatingId, 7879 syncOnly: true, 7880 nested 7881 })).current; 7882 useIsoLayoutEffect(() => { 7883 const valuesToSync = { 7884 open, 7885 floatingId, 7886 referenceElement, 7887 floatingElement 7888 }; 7889 if (isElement(referenceElement)) { 7890 valuesToSync.domReferenceElement = referenceElement; 7891 } 7892 if (store.state.positionReference === store.state.referenceElement) { 7893 valuesToSync.positionReference = referenceElement; 7894 } 7895 store.update(valuesToSync); 7896 }, [open, floatingId, referenceElement, floatingElement, store]); 7897 store.context.onOpenChange = onOpenChange; 7898 store.context.nested = nested; 7899 return store; 7900 } 7901 7902 // node_modules/@base-ui/react/esm/floating-ui-react/hooks/useFocus.js 7903 var React35 = __toESM(require_react(), 1); 7904 var isMacSafari = isMac && isSafari; 7905 function useFocus(context, props = {}) { 7906 const store = "rootStore" in context ? context.rootStore : context; 7907 const { 7908 events: events2, 7909 dataRef 7910 } = store.context; 7911 const { 7912 enabled = true, 7913 delay 7914 } = props; 7915 const blockFocusRef = React35.useRef(false); 7916 const blockedReferenceRef = React35.useRef(null); 7917 const timeout = useTimeout(); 7918 const keyboardModalityRef = React35.useRef(true); 7919 React35.useEffect(() => { 7920 const domReference = store.select("domReferenceElement"); 7921 if (!enabled) { 7922 return void 0; 7923 } 7924 const win = getWindow(domReference); 7925 function onBlur() { 7926 const currentDomReference = store.select("domReferenceElement"); 7927 if (!store.select("open") && isHTMLElement(currentDomReference) && currentDomReference === activeElement(ownerDocument(currentDomReference))) { 7928 blockFocusRef.current = true; 7929 } 7930 } 7931 function onKeyDown() { 7932 keyboardModalityRef.current = true; 7933 } 7934 function onPointerDown() { 7935 keyboardModalityRef.current = false; 7936 } 7937 return mergeCleanups(addEventListener(win, "blur", onBlur), isMacSafari && addEventListener(win, "keydown", onKeyDown, true), isMacSafari && addEventListener(win, "pointerdown", onPointerDown, true)); 7938 }, [store, enabled]); 7939 React35.useEffect(() => { 7940 if (!enabled) { 7941 return void 0; 7942 } 7943 function onOpenChangeLocal(details) { 7944 if (details.reason === reason_parts_exports.triggerPress || details.reason === reason_parts_exports.escapeKey) { 7945 const referenceElement = store.select("domReferenceElement"); 7946 if (isElement(referenceElement)) { 7947 blockedReferenceRef.current = referenceElement; 7948 blockFocusRef.current = true; 7949 } 7950 } 7951 } 7952 events2.on("openchange", onOpenChangeLocal); 7953 return () => { 7954 events2.off("openchange", onOpenChangeLocal); 7955 }; 7956 }, [events2, enabled, store]); 7957 const reference = React35.useMemo(() => ({ 7958 onMouseLeave() { 7959 blockFocusRef.current = false; 7960 blockedReferenceRef.current = null; 7961 }, 7962 onFocus(event) { 7963 const focusTarget = event.currentTarget; 7964 if (blockFocusRef.current) { 7965 if (blockedReferenceRef.current === focusTarget) { 7966 return; 7967 } 7968 blockFocusRef.current = false; 7969 blockedReferenceRef.current = null; 7970 } 7971 const target = getTarget(event.nativeEvent); 7972 if (isElement(target)) { 7973 if (isMacSafari && !event.relatedTarget) { 7974 if (!keyboardModalityRef.current && !isTypeableElement(target)) { 7975 return; 7976 } 7977 } else if (!matchesFocusVisible(target)) { 7978 return; 7979 } 7980 } 7981 const movedFromOtherEnabledTrigger = isTargetInsideEnabledTrigger(event.relatedTarget, store.context.triggerElements); 7982 const { 7983 nativeEvent, 7984 currentTarget 7985 } = event; 7986 const delayValue = typeof delay === "function" ? delay() : delay; 7987 if (store.select("open") && movedFromOtherEnabledTrigger || delayValue === 0 || delayValue === void 0) { 7988 store.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerFocus, nativeEvent, currentTarget)); 7989 return; 7990 } 7991 timeout.start(delayValue, () => { 7992 if (blockFocusRef.current) { 7993 return; 7994 } 7995 store.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerFocus, nativeEvent, currentTarget)); 7996 }); 7997 }, 7998 onBlur(event) { 7999 blockFocusRef.current = false; 8000 blockedReferenceRef.current = null; 8001 const relatedTarget = event.relatedTarget; 8002 const nativeEvent = event.nativeEvent; 8003 const movedToFocusGuard = isElement(relatedTarget) && relatedTarget.hasAttribute(createAttribute("focus-guard")) && relatedTarget.getAttribute("data-type") === "outside"; 8004 timeout.start(0, () => { 8005 const domReference = store.select("domReferenceElement"); 8006 const activeEl = activeElement(ownerDocument(domReference)); 8007 if (!relatedTarget && activeEl === domReference) { 8008 return; 8009 } 8010 if (contains(dataRef.current.floatingContext?.refs.floating.current, activeEl) || contains(domReference, activeEl) || movedToFocusGuard) { 8011 return; 8012 } 8013 const nextFocusedElement = relatedTarget ?? activeEl; 8014 if (isTargetInsideEnabledTrigger(nextFocusedElement, store.context.triggerElements)) { 8015 return; 8016 } 8017 store.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerFocus, nativeEvent)); 8018 }); 8019 } 8020 }), [dataRef, store, timeout, delay]); 8021 return React35.useMemo(() => enabled ? { 8022 reference, 8023 trigger: reference 8024 } : {}, [enabled, reference]); 8025 } 8026 8027 // node_modules/@base-ui/react/esm/floating-ui-react/hooks/useHoverFloatingInteraction.js 8028 var React36 = __toESM(require_react(), 1); 8029 8030 // node_modules/@base-ui/react/esm/floating-ui-react/hooks/useHoverInteractionSharedState.js 8031 var HoverInteraction = class _HoverInteraction { 8032 constructor() { 8033 this.pointerType = void 0; 8034 this.interactedInside = false; 8035 this.handler = void 0; 8036 this.blockMouseMove = true; 8037 this.performedPointerEventsMutation = false; 8038 this.pointerEventsScopeElement = null; 8039 this.pointerEventsReferenceElement = null; 8040 this.pointerEventsFloatingElement = null; 8041 this.restTimeoutPending = false; 8042 this.openChangeTimeout = new Timeout(); 8043 this.restTimeout = new Timeout(); 8044 this.handleCloseOptions = void 0; 8045 } 8046 static create() { 8047 return new _HoverInteraction(); 8048 } 8049 dispose = () => { 8050 this.openChangeTimeout.clear(); 8051 this.restTimeout.clear(); 8052 }; 8053 disposeEffect = () => { 8054 return this.dispose; 8055 }; 8056 }; 8057 var pointerEventsMutationOwnerByScopeElement = /* @__PURE__ */ new WeakMap(); 8058 function clearSafePolygonPointerEventsMutation(instance) { 8059 if (!instance.performedPointerEventsMutation) { 8060 return; 8061 } 8062 const scopeElement = instance.pointerEventsScopeElement; 8063 if (scopeElement && pointerEventsMutationOwnerByScopeElement.get(scopeElement) === instance) { 8064 instance.pointerEventsScopeElement?.style.removeProperty("pointer-events"); 8065 instance.pointerEventsReferenceElement?.style.removeProperty("pointer-events"); 8066 instance.pointerEventsFloatingElement?.style.removeProperty("pointer-events"); 8067 pointerEventsMutationOwnerByScopeElement.delete(scopeElement); 8068 } 8069 instance.performedPointerEventsMutation = false; 8070 instance.pointerEventsScopeElement = null; 8071 instance.pointerEventsReferenceElement = null; 8072 instance.pointerEventsFloatingElement = null; 8073 } 8074 function applySafePolygonPointerEventsMutation(instance, options) { 8075 const { 8076 scopeElement, 8077 referenceElement, 8078 floatingElement 8079 } = options; 8080 const existingOwner = pointerEventsMutationOwnerByScopeElement.get(scopeElement); 8081 if (existingOwner && existingOwner !== instance) { 8082 clearSafePolygonPointerEventsMutation(existingOwner); 8083 } 8084 clearSafePolygonPointerEventsMutation(instance); 8085 instance.performedPointerEventsMutation = true; 8086 instance.pointerEventsScopeElement = scopeElement; 8087 instance.pointerEventsReferenceElement = referenceElement; 8088 instance.pointerEventsFloatingElement = floatingElement; 8089 pointerEventsMutationOwnerByScopeElement.set(scopeElement, instance); 8090 scopeElement.style.pointerEvents = "none"; 8091 referenceElement.style.pointerEvents = "auto"; 8092 floatingElement.style.pointerEvents = "auto"; 8093 } 8094 function useHoverInteractionSharedState(store) { 8095 const instance = useRefWithInit(HoverInteraction.create).current; 8096 const data = store.context.dataRef.current; 8097 if (!data.hoverInteractionState) { 8098 data.hoverInteractionState = instance; 8099 } 8100 useOnMount(data.hoverInteractionState.disposeEffect); 8101 return data.hoverInteractionState; 8102 } 8103 8104 // node_modules/@base-ui/react/esm/floating-ui-react/hooks/useHoverFloatingInteraction.js 8105 function useHoverFloatingInteraction(context, parameters = {}) { 8106 const store = "rootStore" in context ? context.rootStore : context; 8107 const open = store.useState("open"); 8108 const floatingElement = store.useState("floatingElement"); 8109 const domReferenceElement = store.useState("domReferenceElement"); 8110 const { 8111 dataRef 8112 } = store.context; 8113 const { 8114 enabled = true, 8115 closeDelay: closeDelayProp = 0, 8116 nodeId: nodeIdProp 8117 } = parameters; 8118 const instance = useHoverInteractionSharedState(store); 8119 const tree = useFloatingTree(); 8120 const parentId = useFloatingParentNodeId(); 8121 const isClickLikeOpenEvent2 = useStableCallback(() => { 8122 return isClickLikeOpenEvent(dataRef.current.openEvent?.type, instance.interactedInside); 8123 }); 8124 const isHoverOpen = useStableCallback(() => { 8125 const type = dataRef.current.openEvent?.type; 8126 return type?.includes("mouse") && type !== "mousedown"; 8127 }); 8128 const isRelatedTargetInsideEnabledTrigger = useStableCallback((target) => { 8129 return isTargetInsideEnabledTrigger(target, store.context.triggerElements); 8130 }); 8131 const closeWithDelay = React36.useCallback((event) => { 8132 const closeDelay = getDelay(closeDelayProp, "close", instance.pointerType); 8133 const close = () => { 8134 store.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerHover, event)); 8135 tree?.events.emit("floating.closed", event); 8136 }; 8137 if (closeDelay) { 8138 instance.openChangeTimeout.start(closeDelay, close); 8139 } else { 8140 instance.openChangeTimeout.clear(); 8141 close(); 8142 } 8143 }, [closeDelayProp, store, instance, tree]); 8144 const clearPointerEvents = useStableCallback(() => { 8145 clearSafePolygonPointerEventsMutation(instance); 8146 }); 8147 const handleInteractInside = useStableCallback((event) => { 8148 const target = getTarget(event); 8149 if (!isInteractiveElement(target)) { 8150 instance.interactedInside = false; 8151 return; 8152 } 8153 instance.interactedInside = target?.closest("[aria-haspopup]") != null; 8154 }); 8155 useIsoLayoutEffect(() => { 8156 if (!open) { 8157 instance.pointerType = void 0; 8158 instance.restTimeoutPending = false; 8159 instance.interactedInside = false; 8160 clearPointerEvents(); 8161 } 8162 }, [open, instance, clearPointerEvents]); 8163 React36.useEffect(() => { 8164 return clearPointerEvents; 8165 }, [clearPointerEvents]); 8166 useIsoLayoutEffect(() => { 8167 if (!enabled) { 8168 return void 0; 8169 } 8170 if (open && instance.handleCloseOptions?.blockPointerEvents && isHoverOpen() && isElement(domReferenceElement) && floatingElement) { 8171 const ref = domReferenceElement; 8172 const floatingEl = floatingElement; 8173 const doc = ownerDocument(floatingElement); 8174 const parentFloating = tree?.nodesRef.current.find((node) => node.id === parentId)?.context?.elements.floating; 8175 if (parentFloating) { 8176 parentFloating.style.pointerEvents = ""; 8177 } 8178 const scopeElement = instance.handleCloseOptions?.getScope?.() ?? instance.pointerEventsScopeElement ?? parentFloating ?? ref.closest("[data-rootownerid]") ?? doc.body; 8179 applySafePolygonPointerEventsMutation(instance, { 8180 scopeElement, 8181 referenceElement: ref, 8182 floatingElement: floatingEl 8183 }); 8184 return () => { 8185 clearPointerEvents(); 8186 }; 8187 } 8188 return void 0; 8189 }, [enabled, open, domReferenceElement, floatingElement, instance, isHoverOpen, tree, parentId, clearPointerEvents]); 8190 const childClosedTimeout = useTimeout(); 8191 React36.useEffect(() => { 8192 if (!enabled) { 8193 return void 0; 8194 } 8195 function onFloatingMouseEnter() { 8196 instance.openChangeTimeout.clear(); 8197 childClosedTimeout.clear(); 8198 tree?.events.off("floating.closed", onNodeClosed); 8199 clearPointerEvents(); 8200 } 8201 function onFloatingMouseLeave(event) { 8202 if (tree && parentId && getNodeChildren(tree.nodesRef.current, parentId).length > 0) { 8203 tree.events.on("floating.closed", onNodeClosed); 8204 return; 8205 } 8206 if (isRelatedTargetInsideEnabledTrigger(event.relatedTarget)) { 8207 return; 8208 } 8209 const currentNodeId = dataRef.current.floatingContext?.nodeId ?? nodeIdProp; 8210 const relatedTarget = event.relatedTarget; 8211 const isMovingIntoDescendantFloating = tree && currentNodeId && isElement(relatedTarget) && getNodeChildren(tree.nodesRef.current, currentNodeId, false).some((node) => contains(node.context?.elements.floating, relatedTarget)); 8212 if (isMovingIntoDescendantFloating) { 8213 return; 8214 } 8215 if (instance.handler) { 8216 instance.handler(event); 8217 return; 8218 } 8219 clearPointerEvents(); 8220 if (!isClickLikeOpenEvent2()) { 8221 closeWithDelay(event); 8222 } 8223 } 8224 function onNodeClosed(event) { 8225 if (!tree || !parentId || getNodeChildren(tree.nodesRef.current, parentId).length > 0) { 8226 return; 8227 } 8228 childClosedTimeout.start(0, () => { 8229 tree.events.off("floating.closed", onNodeClosed); 8230 store.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerHover, event)); 8231 tree.events.emit("floating.closed", event); 8232 }); 8233 } 8234 const floating = floatingElement; 8235 return mergeCleanups(floating && addEventListener(floating, "mouseenter", onFloatingMouseEnter), floating && addEventListener(floating, "mouseleave", onFloatingMouseLeave), floating && addEventListener(floating, "pointerdown", handleInteractInside, true), () => { 8236 tree?.events.off("floating.closed", onNodeClosed); 8237 }); 8238 }, [enabled, floatingElement, store, dataRef, nodeIdProp, isClickLikeOpenEvent2, isRelatedTargetInsideEnabledTrigger, closeWithDelay, clearPointerEvents, handleInteractInside, instance, tree, parentId, childClosedTimeout]); 8239 } 8240 8241 // node_modules/@base-ui/react/esm/floating-ui-react/hooks/useHoverReferenceInteraction.js 8242 var React37 = __toESM(require_react(), 1); 8243 var ReactDOM4 = __toESM(require_react_dom(), 1); 8244 var EMPTY_REF = { 8245 current: null 8246 }; 8247 function useHoverReferenceInteraction(context, props = {}) { 8248 const store = "rootStore" in context ? context.rootStore : context; 8249 const { 8250 dataRef, 8251 events: events2 8252 } = store.context; 8253 const { 8254 enabled = true, 8255 delay = 0, 8256 handleClose = null, 8257 mouseOnly = false, 8258 restMs = 0, 8259 move = true, 8260 triggerElementRef = EMPTY_REF, 8261 externalTree, 8262 isActiveTrigger = true, 8263 getHandleCloseContext, 8264 isClosing 8265 } = props; 8266 const tree = useFloatingTree(externalTree); 8267 const instance = useHoverInteractionSharedState(store); 8268 const isHoverCloseActiveRef = React37.useRef(false); 8269 const handleCloseRef = useValueAsRef(handleClose); 8270 const delayRef = useValueAsRef(delay); 8271 const restMsRef = useValueAsRef(restMs); 8272 const enabledRef = useValueAsRef(enabled); 8273 const isClosingRef = useValueAsRef(isClosing); 8274 if (isActiveTrigger) { 8275 instance.handleCloseOptions = handleCloseRef.current?.__options; 8276 } 8277 const isClickLikeOpenEvent2 = useStableCallback(() => { 8278 return isClickLikeOpenEvent(dataRef.current.openEvent?.type, instance.interactedInside); 8279 }); 8280 const isRelatedTargetInsideEnabledTrigger = useStableCallback((target) => { 8281 return isTargetInsideEnabledTrigger(target, store.context.triggerElements); 8282 }); 8283 const isOverInactiveTrigger = useStableCallback((currentDomReference, currentTarget, target) => { 8284 const allTriggers = store.context.triggerElements; 8285 if (allTriggers.hasElement(currentTarget)) { 8286 return !currentDomReference || !contains(currentDomReference, currentTarget); 8287 } 8288 if (!isElement(target)) { 8289 return false; 8290 } 8291 const targetElement = target; 8292 return allTriggers.hasMatchingElement((trigger) => contains(trigger, targetElement)) && (!currentDomReference || !contains(currentDomReference, targetElement)); 8293 }); 8294 const closeWithDelay = useStableCallback((event, runElseBranch = true) => { 8295 const closeDelay = getDelay(delayRef.current, "close", instance.pointerType); 8296 if (closeDelay) { 8297 instance.openChangeTimeout.start(closeDelay, () => { 8298 store.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerHover, event)); 8299 tree?.events.emit("floating.closed", event); 8300 }); 8301 } else if (runElseBranch) { 8302 instance.openChangeTimeout.clear(); 8303 store.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerHover, event)); 8304 tree?.events.emit("floating.closed", event); 8305 } 8306 }); 8307 const cleanupMouseMoveHandler = useStableCallback(() => { 8308 if (!instance.handler) { 8309 return; 8310 } 8311 const doc = ownerDocument(store.select("domReferenceElement")); 8312 doc.removeEventListener("mousemove", instance.handler); 8313 instance.handler = void 0; 8314 }); 8315 const clearPointerEvents = useStableCallback(() => { 8316 clearSafePolygonPointerEventsMutation(instance); 8317 }); 8318 React37.useEffect(() => cleanupMouseMoveHandler, [cleanupMouseMoveHandler]); 8319 React37.useEffect(() => { 8320 if (!enabled) { 8321 return void 0; 8322 } 8323 function onOpenChangeLocal(details) { 8324 if (!details.open) { 8325 isHoverCloseActiveRef.current = details.reason === reason_parts_exports.triggerHover; 8326 cleanupMouseMoveHandler(); 8327 instance.openChangeTimeout.clear(); 8328 instance.restTimeout.clear(); 8329 instance.blockMouseMove = true; 8330 instance.restTimeoutPending = false; 8331 } else { 8332 isHoverCloseActiveRef.current = false; 8333 } 8334 } 8335 events2.on("openchange", onOpenChangeLocal); 8336 return () => { 8337 events2.off("openchange", onOpenChangeLocal); 8338 }; 8339 }, [enabled, events2, instance, cleanupMouseMoveHandler]); 8340 React37.useEffect(() => { 8341 if (!enabled) { 8342 return void 0; 8343 } 8344 const trigger = triggerElementRef.current ?? (isActiveTrigger ? store.select("domReferenceElement") : null); 8345 if (!isElement(trigger)) { 8346 return void 0; 8347 } 8348 function onMouseEnter(event) { 8349 instance.openChangeTimeout.clear(); 8350 instance.blockMouseMove = false; 8351 if (mouseOnly && !isMouseLikePointerType(instance.pointerType)) { 8352 return; 8353 } 8354 const restMsValue = getRestMs(restMsRef.current); 8355 const openDelay = getDelay(delayRef.current, "open", instance.pointerType); 8356 const eventTarget = getTarget(event); 8357 const currentTarget = event.currentTarget ?? null; 8358 const currentDomReference = store.select("domReferenceElement"); 8359 let triggerNode = currentTarget; 8360 if (isElement(eventTarget) && !store.context.triggerElements.hasElement(eventTarget)) { 8361 for (const triggerElement of store.context.triggerElements.elements()) { 8362 if (contains(triggerElement, eventTarget)) { 8363 triggerNode = triggerElement; 8364 break; 8365 } 8366 } 8367 } 8368 if (isElement(currentTarget) && isElement(currentDomReference) && !store.context.triggerElements.hasElement(currentTarget) && contains(currentTarget, currentDomReference)) { 8369 triggerNode = currentDomReference; 8370 } 8371 const isOverInactive = triggerNode == null ? false : isOverInactiveTrigger(currentDomReference, triggerNode, eventTarget); 8372 const isOpen = store.select("open"); 8373 const isInClosingTransition = isClosingRef.current?.() ?? store.select("transitionStatus") === "ending"; 8374 const isHoverCloseTransition = !isOpen && isInClosingTransition && isHoverCloseActiveRef.current; 8375 const isReenteringSameTriggerDuringCloseTransition = !isOverInactive && isElement(triggerNode) && isElement(currentDomReference) && contains(currentDomReference, triggerNode) && isHoverCloseTransition; 8376 const isRestOnlyDelay = restMsValue > 0 && !openDelay; 8377 const shouldOpenImmediately = isOverInactive && (isOpen || isHoverCloseTransition) || isReenteringSameTriggerDuringCloseTransition; 8378 const shouldOpen = !isOpen || isOverInactive; 8379 if (shouldOpenImmediately) { 8380 store.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerHover, event, triggerNode)); 8381 return; 8382 } 8383 if (isRestOnlyDelay) { 8384 return; 8385 } 8386 if (openDelay) { 8387 instance.openChangeTimeout.start(openDelay, () => { 8388 if (shouldOpen) { 8389 store.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerHover, event, triggerNode)); 8390 } 8391 }); 8392 } else if (shouldOpen) { 8393 store.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerHover, event, triggerNode)); 8394 } 8395 } 8396 function onMouseLeave(event) { 8397 if (isClickLikeOpenEvent2()) { 8398 clearPointerEvents(); 8399 return; 8400 } 8401 cleanupMouseMoveHandler(); 8402 const domReferenceElement = store.select("domReferenceElement"); 8403 const doc = ownerDocument(domReferenceElement); 8404 instance.restTimeout.clear(); 8405 instance.restTimeoutPending = false; 8406 const handleCloseContextBase = dataRef.current.floatingContext ?? getHandleCloseContext?.(); 8407 const ignoreRelatedTargetTrigger = isRelatedTargetInsideEnabledTrigger(event.relatedTarget); 8408 if (ignoreRelatedTargetTrigger) { 8409 return; 8410 } 8411 if (handleCloseRef.current && handleCloseContextBase) { 8412 if (!store.select("open")) { 8413 instance.openChangeTimeout.clear(); 8414 } 8415 const currentTrigger = triggerElementRef.current; 8416 instance.handler = handleCloseRef.current({ 8417 ...handleCloseContextBase, 8418 tree, 8419 x: event.clientX, 8420 y: event.clientY, 8421 onClose() { 8422 clearPointerEvents(); 8423 cleanupMouseMoveHandler(); 8424 if (enabledRef.current && !isClickLikeOpenEvent2() && currentTrigger === store.select("domReferenceElement")) { 8425 closeWithDelay(event, true); 8426 } 8427 } 8428 }); 8429 doc.addEventListener("mousemove", instance.handler); 8430 instance.handler(event); 8431 return; 8432 } 8433 const shouldClose = instance.pointerType === "touch" ? !contains(store.select("floatingElement"), event.relatedTarget) : true; 8434 if (shouldClose) { 8435 closeWithDelay(event); 8436 } 8437 } 8438 if (move) { 8439 return mergeCleanups(addEventListener(trigger, "mousemove", onMouseEnter, { 8440 once: true 8441 }), addEventListener(trigger, "mouseenter", onMouseEnter), addEventListener(trigger, "mouseleave", onMouseLeave)); 8442 } 8443 return mergeCleanups(addEventListener(trigger, "mouseenter", onMouseEnter), addEventListener(trigger, "mouseleave", onMouseLeave)); 8444 }, [cleanupMouseMoveHandler, clearPointerEvents, dataRef, delayRef, closeWithDelay, store, enabled, handleCloseRef, instance, isActiveTrigger, isOverInactiveTrigger, isClickLikeOpenEvent2, isRelatedTargetInsideEnabledTrigger, mouseOnly, move, restMsRef, triggerElementRef, tree, enabledRef, getHandleCloseContext, isClosingRef]); 8445 return React37.useMemo(() => { 8446 if (!enabled) { 8447 return void 0; 8448 } 8449 function setPointerRef(event) { 8450 instance.pointerType = event.pointerType; 8451 } 8452 return { 8453 onPointerDown: setPointerRef, 8454 onPointerEnter: setPointerRef, 8455 onMouseMove(event) { 8456 const { 8457 nativeEvent 8458 } = event; 8459 const trigger = event.currentTarget; 8460 const currentDomReference = store.select("domReferenceElement"); 8461 const currentOpen = store.select("open"); 8462 const isOverInactive = isOverInactiveTrigger(currentDomReference, trigger, event.target); 8463 if (mouseOnly && !isMouseLikePointerType(instance.pointerType)) { 8464 return; 8465 } 8466 if (currentOpen && isOverInactive && instance.handleCloseOptions?.blockPointerEvents) { 8467 const floatingElement = store.select("floatingElement"); 8468 if (floatingElement) { 8469 const scopeElement = instance.handleCloseOptions?.getScope?.() ?? trigger.ownerDocument.body; 8470 applySafePolygonPointerEventsMutation(instance, { 8471 scopeElement, 8472 referenceElement: trigger, 8473 floatingElement 8474 }); 8475 } 8476 } 8477 const restMsValue = getRestMs(restMsRef.current); 8478 if (currentOpen && !isOverInactive || restMsValue === 0) { 8479 return; 8480 } 8481 if (!isOverInactive && instance.restTimeoutPending && event.movementX ** 2 + event.movementY ** 2 < 2) { 8482 return; 8483 } 8484 instance.restTimeout.clear(); 8485 function handleMouseMove() { 8486 instance.restTimeoutPending = false; 8487 if (isClickLikeOpenEvent2()) { 8488 return; 8489 } 8490 const latestOpen = store.select("open"); 8491 if (!instance.blockMouseMove && (!latestOpen || isOverInactive)) { 8492 store.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerHover, nativeEvent, trigger)); 8493 } 8494 } 8495 if (instance.pointerType === "touch") { 8496 ReactDOM4.flushSync(() => { 8497 handleMouseMove(); 8498 }); 8499 } else if (isOverInactive && currentOpen) { 8500 handleMouseMove(); 8501 } else { 8502 instance.restTimeoutPending = true; 8503 instance.restTimeout.start(restMsValue, handleMouseMove); 8504 } 8505 } 8506 }; 8507 }, [enabled, instance, isClickLikeOpenEvent2, isOverInactiveTrigger, mouseOnly, store, restMsRef]); 8508 } 8509 8510 // node_modules/@base-ui/react/esm/floating-ui-react/hooks/useInteractions.js 8511 var React38 = __toESM(require_react(), 1); 8512 function useInteractions(propsList = []) { 8513 const referenceDeps = propsList.map((key2) => key2?.reference); 8514 const floatingDeps = propsList.map((key2) => key2?.floating); 8515 const itemDeps = propsList.map((key2) => key2?.item); 8516 const triggerDeps = propsList.map((key2) => key2?.trigger); 8517 const getReferenceProps = React38.useCallback( 8518 (userProps) => mergeProps2(userProps, propsList, "reference"), 8519 // eslint-disable-next-line react-hooks/exhaustive-deps 8520 referenceDeps 8521 ); 8522 const getFloatingProps = React38.useCallback( 8523 (userProps) => mergeProps2(userProps, propsList, "floating"), 8524 // eslint-disable-next-line react-hooks/exhaustive-deps 8525 floatingDeps 8526 ); 8527 const getItemProps = React38.useCallback( 8528 (userProps) => mergeProps2(userProps, propsList, "item"), 8529 // eslint-disable-next-line react-hooks/exhaustive-deps 8530 itemDeps 8531 ); 8532 const getTriggerProps = React38.useCallback( 8533 (userProps) => mergeProps2(userProps, propsList, "trigger"), 8534 // eslint-disable-next-line react-hooks/exhaustive-deps 8535 triggerDeps 8536 ); 8537 return React38.useMemo(() => ({ 8538 getReferenceProps, 8539 getFloatingProps, 8540 getItemProps, 8541 getTriggerProps 8542 }), [getReferenceProps, getFloatingProps, getItemProps, getTriggerProps]); 8543 } 8544 function mergeProps2(userProps, propsList, elementKey) { 8545 const eventHandlers = /* @__PURE__ */ new Map(); 8546 const isItem2 = elementKey === "item"; 8547 const outputProps = {}; 8548 if (elementKey === "floating") { 8549 outputProps.tabIndex = -1; 8550 outputProps[FOCUSABLE_ATTRIBUTE] = ""; 8551 } 8552 for (const key2 in userProps) { 8553 if (isItem2 && userProps) { 8554 if (key2 === ACTIVE_KEY || key2 === SELECTED_KEY) { 8555 continue; 8556 } 8557 } 8558 outputProps[key2] = userProps[key2]; 8559 } 8560 for (let i2 = 0; i2 < propsList.length; i2 += 1) { 8561 let props; 8562 const propsOrGetProps = propsList[i2]?.[elementKey]; 8563 if (typeof propsOrGetProps === "function") { 8564 props = userProps ? propsOrGetProps(userProps) : null; 8565 } else { 8566 props = propsOrGetProps; 8567 } 8568 if (!props) { 8569 continue; 8570 } 8571 mutablyMergeProps(outputProps, props, isItem2, eventHandlers); 8572 } 8573 mutablyMergeProps(outputProps, userProps, isItem2, eventHandlers); 8574 return outputProps; 8575 } 8576 function mutablyMergeProps(outputProps, props, isItem2, eventHandlers) { 8577 for (const key2 in props) { 8578 const value = props[key2]; 8579 if (isItem2 && (key2 === ACTIVE_KEY || key2 === SELECTED_KEY)) { 8580 continue; 8581 } 8582 if (!key2.startsWith("on")) { 8583 outputProps[key2] = value; 8584 } else { 8585 if (!eventHandlers.has(key2)) { 8586 eventHandlers.set(key2, []); 8587 } 8588 if (typeof value === "function") { 8589 eventHandlers.get(key2)?.push(value); 8590 outputProps[key2] = (...args) => { 8591 return eventHandlers.get(key2)?.map((fn) => fn(...args)).find((val) => val !== void 0); 8592 }; 8593 } 8594 } 8595 } 8596 } 8597 8598 // node_modules/@base-ui/react/esm/floating-ui-react/hooks/useRole.js 8599 var React39 = __toESM(require_react(), 1); 8600 var componentRoleToAriaRoleMap = /* @__PURE__ */ new Map([["select", "listbox"], ["combobox", "listbox"], ["label", false]]); 8601 function useRole(context, props = {}) { 8602 const store = "rootStore" in context ? context.rootStore : context; 8603 const open = store.useState("open"); 8604 const defaultFloatingId = store.useState("floatingId"); 8605 const domReference = store.useState("domReferenceElement"); 8606 const floatingElement = store.useState("floatingElement"); 8607 const { 8608 role = "dialog" 8609 } = props; 8610 const defaultReferenceId = useId(); 8611 const referenceId = domReference?.id || defaultReferenceId; 8612 const floatingId = React39.useMemo(() => getFloatingFocusElement(floatingElement)?.id || defaultFloatingId, [floatingElement, defaultFloatingId]); 8613 const ariaRole = componentRoleToAriaRoleMap.get(role) ?? role; 8614 const parentId = useFloatingParentNodeId(); 8615 const isNested = parentId != null; 8616 const trigger = React39.useMemo(() => { 8617 if (ariaRole === "tooltip" || role === "label") { 8618 return EMPTY_OBJECT; 8619 } 8620 return { 8621 "aria-haspopup": ariaRole === "alertdialog" ? "dialog" : ariaRole, 8622 "aria-expanded": "false", 8623 ...ariaRole === "listbox" && { 8624 role: "combobox" 8625 }, 8626 ...ariaRole === "menu" && isNested && { 8627 role: "menuitem" 8628 }, 8629 ...role === "select" && { 8630 "aria-autocomplete": "none" 8631 }, 8632 ...role === "combobox" && { 8633 "aria-autocomplete": "list" 8634 } 8635 }; 8636 }, [ariaRole, isNested, role]); 8637 const reference = React39.useMemo(() => { 8638 if (ariaRole === "tooltip" || role === "label") { 8639 return { 8640 [`aria-$role === "label" ? "labelledby" : "describedby"}`]: open ? floatingId : void 0 8641 }; 8642 } 8643 const triggerProps = trigger; 8644 return { 8645 ...triggerProps, 8646 "aria-expanded": open ? "true" : "false", 8647 "aria-controls": open ? floatingId : void 0, 8648 ...ariaRole === "menu" && { 8649 id: referenceId 8650 } 8651 }; 8652 }, [ariaRole, floatingId, open, referenceId, role, trigger]); 8653 const floating = React39.useMemo(() => { 8654 const floatingProps = { 8655 id: floatingId, 8656 ...ariaRole && { 8657 role: ariaRole 8658 } 8659 }; 8660 if (ariaRole === "tooltip" || role === "label") { 8661 return floatingProps; 8662 } 8663 return { 8664 ...floatingProps, 8665 ...ariaRole === "menu" && { 8666 "aria-labelledby": referenceId 8667 } 8668 }; 8669 }, [ariaRole, floatingId, referenceId, role]); 8670 const item = React39.useCallback(({ 8671 active, 8672 selected 8673 }) => { 8674 const commonProps = { 8675 role: "option", 8676 ...active && { 8677 id: `$floatingId}-fui-option` 8678 } 8679 }; 8680 switch (role) { 8681 case "select": 8682 case "combobox": 8683 return { 8684 ...commonProps, 8685 "aria-selected": selected 8686 }; 8687 default: 8688 } 8689 return {}; 8690 }, [floatingId, role]); 8691 return React39.useMemo(() => ({ 8692 reference, 8693 floating, 8694 item, 8695 trigger 8696 }), [reference, floating, trigger, item]); 8697 } 8698 8699 // node_modules/@base-ui/react/esm/floating-ui-react/safePolygon.js 8700 var CURSOR_SPEED_THRESHOLD = 0.1; 8701 var CURSOR_SPEED_THRESHOLD_SQUARED = CURSOR_SPEED_THRESHOLD * CURSOR_SPEED_THRESHOLD; 8702 var POLYGON_BUFFER = 0.5; 8703 function hasIntersectingEdge(pointX, pointY, xi, yi, xj, yj) { 8704 return yi >= pointY !== yj >= pointY && pointX <= (xj - xi) * (pointY - yi) / (yj - yi) + xi; 8705 } 8706 function isPointInQuadrilateral(pointX, pointY, x1, y1, x2, y2, x3, y3, x4, y4) { 8707 let isInsideValue = false; 8708 if (hasIntersectingEdge(pointX, pointY, x1, y1, x2, y2)) { 8709 isInsideValue = !isInsideValue; 8710 } 8711 if (hasIntersectingEdge(pointX, pointY, x2, y2, x3, y3)) { 8712 isInsideValue = !isInsideValue; 8713 } 8714 if (hasIntersectingEdge(pointX, pointY, x3, y3, x4, y4)) { 8715 isInsideValue = !isInsideValue; 8716 } 8717 if (hasIntersectingEdge(pointX, pointY, x4, y4, x1, y1)) { 8718 isInsideValue = !isInsideValue; 8719 } 8720 return isInsideValue; 8721 } 8722 function isInsideRect(pointX, pointY, rect) { 8723 return pointX >= rect.x && pointX <= rect.x + rect.width && pointY >= rect.y && pointY <= rect.y + rect.height; 8724 } 8725 function isInsideAxisAlignedRect(pointX, pointY, x1, y1, x2, y2) { 8726 const minX = Math.min(x1, x2); 8727 const maxX = Math.max(x1, x2); 8728 const minY = Math.min(y1, y2); 8729 const maxY = Math.max(y1, y2); 8730 return pointX >= minX && pointX <= maxX && pointY >= minY && pointY <= maxY; 8731 } 8732 function safePolygon(options = {}) { 8733 const { 8734 blockPointerEvents = false 8735 } = options; 8736 const timeout = new Timeout(); 8737 const fn = ({ 8738 x: x2, 8739 y: y2, 8740 placement, 8741 elements, 8742 onClose, 8743 nodeId, 8744 tree 8745 }) => { 8746 const side = placement?.split("-")[0]; 8747 let hasLanded = false; 8748 let lastX = null; 8749 let lastY = null; 8750 let lastCursorTime = typeof performance !== "undefined" ? performance.now() : 0; 8751 function isCursorMovingSlowly(nextX, nextY) { 8752 const currentTime = performance.now(); 8753 const elapsedTime = currentTime - lastCursorTime; 8754 if (lastX === null || lastY === null || elapsedTime === 0) { 8755 lastX = nextX; 8756 lastY = nextY; 8757 lastCursorTime = currentTime; 8758 return false; 8759 } 8760 const deltaX = nextX - lastX; 8761 const deltaY = nextY - lastY; 8762 const distanceSquared = deltaX * deltaX + deltaY * deltaY; 8763 const thresholdSquared = elapsedTime * elapsedTime * CURSOR_SPEED_THRESHOLD_SQUARED; 8764 lastX = nextX; 8765 lastY = nextY; 8766 lastCursorTime = currentTime; 8767 return distanceSquared < thresholdSquared; 8768 } 8769 function close() { 8770 timeout.clear(); 8771 onClose(); 8772 } 8773 return function onMouseMove(event) { 8774 timeout.clear(); 8775 const domReference = elements.domReference; 8776 const floating = elements.floating; 8777 if (!domReference || !floating || side == null || x2 == null || y2 == null) { 8778 return void 0; 8779 } 8780 const { 8781 clientX, 8782 clientY 8783 } = event; 8784 const target = getTarget(event); 8785 const isLeave = event.type === "mouseleave"; 8786 const isOverFloatingEl = contains(floating, target); 8787 const isOverReferenceEl = contains(domReference, target); 8788 if (isOverFloatingEl) { 8789 hasLanded = true; 8790 if (!isLeave) { 8791 return void 0; 8792 } 8793 } 8794 if (isOverReferenceEl) { 8795 hasLanded = false; 8796 if (!isLeave) { 8797 hasLanded = true; 8798 return void 0; 8799 } 8800 } 8801 if (isLeave && isElement(event.relatedTarget) && contains(floating, event.relatedTarget)) { 8802 return void 0; 8803 } 8804 function hasOpenChildNode() { 8805 return Boolean(tree && getNodeChildren(tree.nodesRef.current, nodeId).length > 0); 8806 } 8807 function closeIfNoOpenChild() { 8808 if (!hasOpenChildNode()) { 8809 close(); 8810 } 8811 } 8812 if (hasOpenChildNode()) { 8813 return void 0; 8814 } 8815 const refRect = domReference.getBoundingClientRect(); 8816 const rect = floating.getBoundingClientRect(); 8817 const cursorLeaveFromRight = x2 > rect.right - rect.width / 2; 8818 const cursorLeaveFromBottom = y2 > rect.bottom - rect.height / 2; 8819 const isFloatingWider = rect.width > refRect.width; 8820 const isFloatingTaller = rect.height > refRect.height; 8821 const left = (isFloatingWider ? refRect : rect).left; 8822 const right = (isFloatingWider ? refRect : rect).right; 8823 const top = (isFloatingTaller ? refRect : rect).top; 8824 const bottom = (isFloatingTaller ? refRect : rect).bottom; 8825 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) { 8826 closeIfNoOpenChild(); 8827 return void 0; 8828 } 8829 let isInsideTroughRect = false; 8830 switch (side) { 8831 case "top": 8832 isInsideTroughRect = isInsideAxisAlignedRect(clientX, clientY, left, refRect.top + 1, right, rect.bottom - 1); 8833 break; 8834 case "bottom": 8835 isInsideTroughRect = isInsideAxisAlignedRect(clientX, clientY, left, rect.top + 1, right, refRect.bottom - 1); 8836 break; 8837 case "left": 8838 isInsideTroughRect = isInsideAxisAlignedRect(clientX, clientY, rect.right - 1, bottom, refRect.left + 1, top); 8839 break; 8840 case "right": 8841 isInsideTroughRect = isInsideAxisAlignedRect(clientX, clientY, refRect.right - 1, bottom, rect.left + 1, top); 8842 break; 8843 default: 8844 } 8845 if (isInsideTroughRect) { 8846 return void 0; 8847 } 8848 if (hasLanded && !isInsideRect(clientX, clientY, refRect)) { 8849 closeIfNoOpenChild(); 8850 return void 0; 8851 } 8852 if (!isLeave && isCursorMovingSlowly(clientX, clientY)) { 8853 closeIfNoOpenChild(); 8854 return void 0; 8855 } 8856 let isInsidePolygon = false; 8857 switch (side) { 8858 case "top": { 8859 const cursorXOffset = isFloatingWider ? POLYGON_BUFFER / 2 : POLYGON_BUFFER * 4; 8860 const cursorPointOneX = isFloatingWider ? x2 + cursorXOffset : cursorLeaveFromRight ? x2 + cursorXOffset : x2 - cursorXOffset; 8861 const cursorPointTwoX = isFloatingWider ? x2 - cursorXOffset : cursorLeaveFromRight ? x2 + cursorXOffset : x2 - cursorXOffset; 8862 const cursorPointY = y2 + POLYGON_BUFFER + 1; 8863 const commonYLeft = cursorLeaveFromRight ? rect.bottom - POLYGON_BUFFER : isFloatingWider ? rect.bottom - POLYGON_BUFFER : rect.top; 8864 const commonYRight = cursorLeaveFromRight ? isFloatingWider ? rect.bottom - POLYGON_BUFFER : rect.top : rect.bottom - POLYGON_BUFFER; 8865 isInsidePolygon = isPointInQuadrilateral(clientX, clientY, cursorPointOneX, cursorPointY, cursorPointTwoX, cursorPointY, rect.left, commonYLeft, rect.right, commonYRight); 8866 break; 8867 } 8868 case "bottom": { 8869 const cursorXOffset = isFloatingWider ? POLYGON_BUFFER / 2 : POLYGON_BUFFER * 4; 8870 const cursorPointOneX = isFloatingWider ? x2 + cursorXOffset : cursorLeaveFromRight ? x2 + cursorXOffset : x2 - cursorXOffset; 8871 const cursorPointTwoX = isFloatingWider ? x2 - cursorXOffset : cursorLeaveFromRight ? x2 + cursorXOffset : x2 - cursorXOffset; 8872 const cursorPointY = y2 - POLYGON_BUFFER; 8873 const commonYLeft = cursorLeaveFromRight ? rect.top + POLYGON_BUFFER : isFloatingWider ? rect.top + POLYGON_BUFFER : rect.bottom; 8874 const commonYRight = cursorLeaveFromRight ? isFloatingWider ? rect.top + POLYGON_BUFFER : rect.bottom : rect.top + POLYGON_BUFFER; 8875 isInsidePolygon = isPointInQuadrilateral(clientX, clientY, cursorPointOneX, cursorPointY, cursorPointTwoX, cursorPointY, rect.left, commonYLeft, rect.right, commonYRight); 8876 break; 8877 } 8878 case "left": { 8879 const cursorYOffset = isFloatingTaller ? POLYGON_BUFFER / 2 : POLYGON_BUFFER * 4; 8880 const cursorPointOneY = isFloatingTaller ? y2 + cursorYOffset : cursorLeaveFromBottom ? y2 + cursorYOffset : y2 - cursorYOffset; 8881 const cursorPointTwoY = isFloatingTaller ? y2 - cursorYOffset : cursorLeaveFromBottom ? y2 + cursorYOffset : y2 - cursorYOffset; 8882 const cursorPointX = x2 + POLYGON_BUFFER + 1; 8883 const commonXTop = cursorLeaveFromBottom ? rect.right - POLYGON_BUFFER : isFloatingTaller ? rect.right - POLYGON_BUFFER : rect.left; 8884 const commonXBottom = cursorLeaveFromBottom ? isFloatingTaller ? rect.right - POLYGON_BUFFER : rect.left : rect.right - POLYGON_BUFFER; 8885 isInsidePolygon = isPointInQuadrilateral(clientX, clientY, commonXTop, rect.top, commonXBottom, rect.bottom, cursorPointX, cursorPointOneY, cursorPointX, cursorPointTwoY); 8886 break; 8887 } 8888 case "right": { 8889 const cursorYOffset = isFloatingTaller ? POLYGON_BUFFER / 2 : POLYGON_BUFFER * 4; 8890 const cursorPointOneY = isFloatingTaller ? y2 + cursorYOffset : cursorLeaveFromBottom ? y2 + cursorYOffset : y2 - cursorYOffset; 8891 const cursorPointTwoY = isFloatingTaller ? y2 - cursorYOffset : cursorLeaveFromBottom ? y2 + cursorYOffset : y2 - cursorYOffset; 8892 const cursorPointX = x2 - POLYGON_BUFFER; 8893 const commonXTop = cursorLeaveFromBottom ? rect.left + POLYGON_BUFFER : isFloatingTaller ? rect.left + POLYGON_BUFFER : rect.right; 8894 const commonXBottom = cursorLeaveFromBottom ? isFloatingTaller ? rect.left + POLYGON_BUFFER : rect.right : rect.left + POLYGON_BUFFER; 8895 isInsidePolygon = isPointInQuadrilateral(clientX, clientY, cursorPointX, cursorPointOneY, cursorPointX, cursorPointTwoY, commonXTop, rect.top, commonXBottom, rect.bottom); 8896 break; 8897 } 8898 default: 8899 } 8900 if (!isInsidePolygon) { 8901 closeIfNoOpenChild(); 8902 } else if (!hasLanded) { 8903 timeout.start(40, closeIfNoOpenChild); 8904 } 8905 return void 0; 8906 }; 8907 }; 8908 fn.__options = { 8909 ...options, 8910 blockPointerEvents 8911 }; 8912 return fn; 8913 } 8914 8915 // node_modules/@base-ui/react/esm/utils/useOpenInteractionType.js 8916 var React42 = __toESM(require_react(), 1); 8917 8918 // node_modules/@base-ui/utils/esm/useEnhancedClickHandler.js 8919 var React40 = __toESM(require_react(), 1); 8920 function useEnhancedClickHandler(handler) { 8921 const lastClickInteractionTypeRef = React40.useRef(""); 8922 const handlePointerDown = React40.useCallback((event) => { 8923 if (event.defaultPrevented) { 8924 return; 8925 } 8926 lastClickInteractionTypeRef.current = event.pointerType; 8927 handler(event, event.pointerType); 8928 }, [handler]); 8929 const handleClick = React40.useCallback((event) => { 8930 if (event.detail === 0) { 8931 handler(event, "keyboard"); 8932 return; 8933 } 8934 if ("pointerType" in event) { 8935 handler(event, event.pointerType); 8936 } else { 8937 handler(event, lastClickInteractionTypeRef.current); 8938 } 8939 lastClickInteractionTypeRef.current = ""; 8940 }, [handler]); 8941 return { 8942 onClick: handleClick, 8943 onPointerDown: handlePointerDown 8944 }; 8945 } 8946 8947 // node_modules/@base-ui/react/esm/internals/useValueChanged.js 8948 var React41 = __toESM(require_react(), 1); 8949 function useValueChanged(value, onChange) { 8950 const valueRef = React41.useRef(value); 8951 const onChangeCallback = useStableCallback(onChange); 8952 useIsoLayoutEffect(() => { 8953 if (valueRef.current === value) { 8954 return; 8955 } 8956 onChangeCallback(valueRef.current); 8957 }, [value, onChangeCallback]); 8958 useIsoLayoutEffect(() => { 8959 valueRef.current = value; 8960 }, [value]); 8961 } 8962 8963 // node_modules/@base-ui/react/esm/utils/useOpenInteractionType.js 8964 function useOpenInteractionType(open) { 8965 const [openMethod, setOpenMethod] = React42.useState(null); 8966 const handleTriggerClick = useStableCallback((_, interactionType) => { 8967 if (!open) { 8968 setOpenMethod(interactionType || // On iOS Safari, the hitslop around touch targets means tapping outside an element's 8969 // bounds does not fire `pointerdown` but does fire `mousedown`. The `interactionType` 8970 // will be "" in that case. 8971 (isIOS ? "touch" : "")); 8972 } 8973 }); 8974 useValueChanged(open, (previousOpen) => { 8975 if (previousOpen && !open) { 8976 setOpenMethod(null); 8977 } 8978 }); 8979 const { 8980 onClick, 8981 onPointerDown 8982 } = useEnhancedClickHandler(handleTriggerClick); 8983 return React42.useMemo(() => ({ 8984 openMethod, 8985 triggerProps: { 8986 onClick, 8987 onPointerDown 8988 } 8989 }), [openMethod, onClick, onPointerDown]); 8990 } 8991 8992 // node_modules/@base-ui/react/esm/dialog/root/useDialogRoot.js 8993 function useDialogRoot(params) { 8994 const { 8995 store, 8996 parentContext, 8997 actionsRef, 8998 isDrawer 8999 } = params; 9000 const open = store.useState("open"); 9001 const disablePointerDismissal = store.useState("disablePointerDismissal"); 9002 const modal = store.useState("modal"); 9003 const popupElement = store.useState("popupElement"); 9004 const { 9005 openMethod, 9006 triggerProps 9007 } = useOpenInteractionType(open); 9008 useImplicitActiveTrigger(store); 9009 const { 9010 forceUnmount 9011 } = useOpenStateTransitions(open, store); 9012 const handleImperativeClose = React43.useCallback(() => { 9013 store.setOpen(false, createChangeEventDetails(reason_parts_exports.imperativeAction)); 9014 }, [store]); 9015 React43.useImperativeHandle(actionsRef, () => ({ 9016 unmount: forceUnmount, 9017 close: handleImperativeClose 9018 }), [forceUnmount, handleImperativeClose]); 9019 const floatingRootContext = useSyncedFloatingRootContext({ 9020 popupStore: store, 9021 onOpenChange: store.setOpen, 9022 treatPopupAsFloatingElement: true 9023 }); 9024 const [ownNestedOpenDialogs, setOwnNestedOpenDialogs] = React43.useState(0); 9025 const [ownNestedOpenDrawers, setOwnNestedOpenDrawers] = React43.useState(0); 9026 const isTopmost = ownNestedOpenDialogs === 0; 9027 const role = useRole(floatingRootContext); 9028 const dismiss = useDismiss(floatingRootContext, { 9029 outsidePressEvent() { 9030 if (store.context.internalBackdropRef.current || store.context.backdropRef.current) { 9031 return "intentional"; 9032 } 9033 return { 9034 mouse: modal === "trap-focus" ? "sloppy" : "intentional", 9035 touch: "sloppy" 9036 }; 9037 }, 9038 outsidePress(event) { 9039 if (!store.context.outsidePressEnabledRef.current) { 9040 return false; 9041 } 9042 if ("button" in event && event.button !== 0) { 9043 return false; 9044 } 9045 if ("touches" in event && event.touches.length !== 1) { 9046 return false; 9047 } 9048 const target = getTarget(event); 9049 if (isTopmost && !disablePointerDismissal) { 9050 const eventTarget = target; 9051 if (modal) { 9052 return store.context.internalBackdropRef.current || store.context.backdropRef.current ? store.context.internalBackdropRef.current === eventTarget || store.context.backdropRef.current === eventTarget || contains(eventTarget, popupElement) && !eventTarget?.hasAttribute("data-base-ui-portal") : true; 9053 } 9054 return true; 9055 } 9056 return false; 9057 }, 9058 escapeKey: isTopmost 9059 }); 9060 useScrollLock(open && modal === true, popupElement); 9061 const { 9062 getReferenceProps, 9063 getFloatingProps, 9064 getTriggerProps 9065 } = useInteractions([role, dismiss]); 9066 store.useContextCallback("onNestedDialogOpen", (dialogCount, drawerCount) => { 9067 setOwnNestedOpenDialogs(dialogCount); 9068 setOwnNestedOpenDrawers(drawerCount); 9069 }); 9070 store.useContextCallback("onNestedDialogClose", () => { 9071 setOwnNestedOpenDialogs(0); 9072 setOwnNestedOpenDrawers(0); 9073 }); 9074 React43.useEffect(() => { 9075 if (parentContext?.onNestedDialogOpen && open) { 9076 parentContext.onNestedDialogOpen(ownNestedOpenDialogs + 1, ownNestedOpenDrawers + (isDrawer ? 1 : 0)); 9077 } 9078 if (parentContext?.onNestedDialogClose && !open) { 9079 parentContext.onNestedDialogClose(); 9080 } 9081 return () => { 9082 if (parentContext?.onNestedDialogClose && open) { 9083 parentContext.onNestedDialogClose(); 9084 } 9085 }; 9086 }, [isDrawer, open, ownNestedOpenDialogs, ownNestedOpenDrawers, parentContext]); 9087 const activeTriggerProps = React43.useMemo(() => getReferenceProps(triggerProps), [getReferenceProps, triggerProps]); 9088 const inactiveTriggerProps = React43.useMemo(() => getTriggerProps(triggerProps), [getTriggerProps, triggerProps]); 9089 const popupProps = React43.useMemo(() => getFloatingProps(), [getFloatingProps]); 9090 store.useSyncedValues({ 9091 openMethod, 9092 activeTriggerProps, 9093 inactiveTriggerProps, 9094 popupProps, 9095 floatingRootContext, 9096 nestedOpenDialogCount: ownNestedOpenDialogs, 9097 nestedOpenDrawerCount: ownNestedOpenDrawers 9098 }); 9099 } 9100 9101 // node_modules/@base-ui/react/esm/dialog/root/DialogRootContext.js 9102 var React44 = __toESM(require_react(), 1); 9103 var DialogRootContext = /* @__PURE__ */ React44.createContext(void 0); 9104 if (true) DialogRootContext.displayName = "DialogRootContext"; 9105 function useDialogRootContext(optional) { 9106 const dialogRootContext = React44.useContext(DialogRootContext); 9107 if (optional === false && dialogRootContext === void 0) { 9108 throw new Error(true ? "Base UI: DialogRootContext is missing. Dialog parts must be placed within <Dialog.Root>." : formatErrorMessage_default(27)); 9109 } 9110 return dialogRootContext; 9111 } 9112 9113 // node_modules/@base-ui/react/esm/dialog/store/DialogStore.js 9114 var React45 = __toESM(require_react(), 1); 9115 var selectors2 = { 9116 ...popupStoreSelectors, 9117 modal: createSelector((state) => state.modal), 9118 nested: createSelector((state) => state.nested), 9119 nestedOpenDialogCount: createSelector((state) => state.nestedOpenDialogCount), 9120 nestedOpenDrawerCount: createSelector((state) => state.nestedOpenDrawerCount), 9121 disablePointerDismissal: createSelector((state) => state.disablePointerDismissal), 9122 openMethod: createSelector((state) => state.openMethod), 9123 descriptionElementId: createSelector((state) => state.descriptionElementId), 9124 titleElementId: createSelector((state) => state.titleElementId), 9125 viewportElement: createSelector((state) => state.viewportElement), 9126 role: createSelector((state) => state.role) 9127 }; 9128 var DialogStore = class _DialogStore extends ReactStore { 9129 constructor(initialState) { 9130 super(createInitialState(initialState), { 9131 popupRef: /* @__PURE__ */ React45.createRef(), 9132 backdropRef: /* @__PURE__ */ React45.createRef(), 9133 internalBackdropRef: /* @__PURE__ */ React45.createRef(), 9134 outsidePressEnabledRef: { 9135 current: true 9136 }, 9137 triggerElements: new PopupTriggerMap(), 9138 onOpenChange: void 0, 9139 onOpenChangeComplete: void 0 9140 }, selectors2); 9141 } 9142 setOpen = (nextOpen, eventDetails) => { 9143 eventDetails.preventUnmountOnClose = () => { 9144 this.set("preventUnmountingOnClose", true); 9145 }; 9146 if (!nextOpen && eventDetails.trigger == null && this.state.activeTriggerId != null) { 9147 eventDetails.trigger = this.state.activeTriggerElement ?? void 0; 9148 } 9149 this.context.onOpenChange?.(nextOpen, eventDetails); 9150 if (eventDetails.isCanceled) { 9151 return; 9152 } 9153 this.state.floatingRootContext.dispatchOpenChange(nextOpen, eventDetails); 9154 const updatedState = { 9155 open: nextOpen 9156 }; 9157 const newTriggerId = eventDetails.trigger?.id ?? null; 9158 if (newTriggerId || nextOpen) { 9159 updatedState.activeTriggerId = newTriggerId; 9160 updatedState.activeTriggerElement = eventDetails.trigger ?? null; 9161 } 9162 this.update(updatedState); 9163 }; 9164 static useStore(externalStore, initialState) { 9165 const internalStore = useRefWithInit(() => { 9166 return new _DialogStore(initialState); 9167 }).current; 9168 return externalStore ?? internalStore; 9169 } 9170 }; 9171 function createInitialState(initialState = {}) { 9172 return { 9173 ...createInitialPopupStoreState(), 9174 modal: true, 9175 disablePointerDismissal: false, 9176 popupElement: null, 9177 viewportElement: null, 9178 descriptionElementId: void 0, 9179 titleElementId: void 0, 9180 openMethod: null, 9181 nested: false, 9182 nestedOpenDialogCount: 0, 9183 nestedOpenDrawerCount: 0, 9184 role: "dialog", 9185 ...initialState 9186 }; 9187 } 9188 9189 // node_modules/@base-ui/react/esm/dialog/root/DialogRoot.js 9190 var import_jsx_runtime6 = __toESM(require_jsx_runtime(), 1); 9191 var IsDrawerContext = /* @__PURE__ */ React46.createContext(false); 9192 if (true) IsDrawerContext.displayName = "IsDrawerContext"; 9193 function DialogRoot(props) { 9194 const { 9195 children, 9196 open: openProp, 9197 defaultOpen = false, 9198 onOpenChange, 9199 onOpenChangeComplete, 9200 disablePointerDismissal = false, 9201 modal = true, 9202 actionsRef, 9203 handle, 9204 triggerId: triggerIdProp, 9205 defaultTriggerId: defaultTriggerIdProp = null 9206 } = props; 9207 const parentDialogRootContext = useDialogRootContext(true); 9208 const isDrawer = React46.useContext(IsDrawerContext); 9209 const nested = Boolean(parentDialogRootContext); 9210 const store = DialogStore.useStore(handle?.store, { 9211 open: defaultOpen, 9212 openProp, 9213 activeTriggerId: defaultTriggerIdProp, 9214 triggerIdProp, 9215 modal, 9216 disablePointerDismissal, 9217 nested 9218 }); 9219 useOnFirstRender(() => { 9220 if (openProp === void 0 && store.state.open === false && defaultOpen === true) { 9221 store.update({ 9222 open: true, 9223 activeTriggerId: defaultTriggerIdProp 9224 }); 9225 } 9226 }); 9227 store.useControlledProp("openProp", openProp); 9228 store.useControlledProp("triggerIdProp", triggerIdProp); 9229 store.useSyncedValues({ 9230 disablePointerDismissal, 9231 nested, 9232 modal 9233 }); 9234 store.useContextCallback("onOpenChange", onOpenChange); 9235 store.useContextCallback("onOpenChangeComplete", onOpenChangeComplete); 9236 const payload = store.useState("payload"); 9237 useDialogRoot({ 9238 store, 9239 actionsRef, 9240 parentContext: parentDialogRootContext?.store.context, 9241 isDrawer, 9242 onOpenChange, 9243 triggerIdProp 9244 }); 9245 const contextValue = React46.useMemo(() => ({ 9246 store 9247 }), [store]); 9248 return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(IsDrawerContext.Provider, { 9249 value: false, 9250 children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(DialogRootContext.Provider, { 9251 value: contextValue, 9252 children: typeof children === "function" ? children({ 9253 payload 9254 }) : children 9255 }) 9256 }); 9257 } 9258 9259 // node_modules/@base-ui/react/esm/alert-dialog/root/AlertDialogRoot.js 9260 var import_jsx_runtime7 = __toESM(require_jsx_runtime(), 1); 9261 function AlertDialogRoot(props) { 9262 const { 9263 children, 9264 open: openProp, 9265 defaultOpen = false, 9266 onOpenChange, 9267 onOpenChangeComplete, 9268 actionsRef, 9269 handle, 9270 triggerId: triggerIdProp, 9271 defaultTriggerId: defaultTriggerIdProp = null 9272 } = props; 9273 const parentDialogRootContext = useDialogRootContext(true); 9274 const nested = Boolean(parentDialogRootContext); 9275 const store = DialogStore.useStore(handle?.store, { 9276 open: defaultOpen, 9277 openProp, 9278 activeTriggerId: defaultTriggerIdProp, 9279 triggerIdProp, 9280 modal: true, 9281 disablePointerDismissal: true, 9282 nested, 9283 role: "alertdialog" 9284 }); 9285 store.useControlledProp("openProp", openProp); 9286 store.useControlledProp("triggerIdProp", triggerIdProp); 9287 store.useSyncedValue("nested", nested); 9288 store.useContextCallback("onOpenChange", onOpenChange); 9289 store.useContextCallback("onOpenChangeComplete", onOpenChangeComplete); 9290 const payload = store.useState("payload"); 9291 useDialogRoot({ 9292 store, 9293 actionsRef, 9294 parentContext: parentDialogRootContext?.store.context, 9295 isDrawer: false, 9296 onOpenChange, 9297 triggerIdProp 9298 }); 9299 const contextValue = React47.useMemo(() => ({ 9300 store 9301 }), [store]); 9302 return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(IsDrawerContext.Provider, { 9303 value: false, 9304 children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(DialogRootContext.Provider, { 9305 value: contextValue, 9306 children: typeof children === "function" ? children({ 9307 payload 9308 }) : children 9309 }) 9310 }); 9311 } 9312 9313 // node_modules/@base-ui/react/esm/dialog/backdrop/DialogBackdrop.js 9314 var React48 = __toESM(require_react(), 1); 9315 9316 // node_modules/@base-ui/react/esm/utils/popupStateMapping.js 9317 var CommonPopupDataAttributes = (function(CommonPopupDataAttributes2) { 9318 CommonPopupDataAttributes2["open"] = "data-open"; 9319 CommonPopupDataAttributes2["closed"] = "data-closed"; 9320 CommonPopupDataAttributes2[CommonPopupDataAttributes2["startingStyle"] = TransitionStatusDataAttributes.startingStyle] = "startingStyle"; 9321 CommonPopupDataAttributes2[CommonPopupDataAttributes2["endingStyle"] = TransitionStatusDataAttributes.endingStyle] = "endingStyle"; 9322 CommonPopupDataAttributes2["anchorHidden"] = "data-anchor-hidden"; 9323 CommonPopupDataAttributes2["side"] = "data-side"; 9324 CommonPopupDataAttributes2["align"] = "data-align"; 9325 return CommonPopupDataAttributes2; 9326 })({}); 9327 var CommonTriggerDataAttributes = /* @__PURE__ */ (function(CommonTriggerDataAttributes2) { 9328 CommonTriggerDataAttributes2["popupOpen"] = "data-popup-open"; 9329 CommonTriggerDataAttributes2["pressed"] = "data-pressed"; 9330 return CommonTriggerDataAttributes2; 9331 })({}); 9332 var TRIGGER_HOOK = { 9333 [CommonTriggerDataAttributes.popupOpen]: "" 9334 }; 9335 var PRESSABLE_TRIGGER_HOOK = { 9336 [CommonTriggerDataAttributes.popupOpen]: "", 9337 [CommonTriggerDataAttributes.pressed]: "" 9338 }; 9339 var POPUP_OPEN_HOOK = { 9340 [CommonPopupDataAttributes.open]: "" 9341 }; 9342 var POPUP_CLOSED_HOOK = { 9343 [CommonPopupDataAttributes.closed]: "" 9344 }; 9345 var ANCHOR_HIDDEN_HOOK = { 9346 [CommonPopupDataAttributes.anchorHidden]: "" 9347 }; 9348 var triggerOpenStateMapping2 = { 9349 open(value) { 9350 if (value) { 9351 return TRIGGER_HOOK; 9352 } 9353 return null; 9354 } 9355 }; 9356 var popupStateMapping = { 9357 open(value) { 9358 if (value) { 9359 return POPUP_OPEN_HOOK; 9360 } 9361 return POPUP_CLOSED_HOOK; 9362 }, 9363 anchorHidden(value) { 9364 if (value) { 9365 return ANCHOR_HIDDEN_HOOK; 9366 } 9367 return null; 9368 } 9369 }; 9370 9371 // node_modules/@base-ui/react/esm/dialog/backdrop/DialogBackdrop.js 9372 var stateAttributesMapping = { 9373 ...popupStateMapping, 9374 ...transitionStatusMapping 9375 }; 9376 var DialogBackdrop = /* @__PURE__ */ React48.forwardRef(function DialogBackdrop2(componentProps, forwardedRef) { 9377 const { 9378 render: render4, 9379 className, 9380 style, 9381 forceRender = false, 9382 ...elementProps 9383 } = componentProps; 9384 const { 9385 store 9386 } = useDialogRootContext(); 9387 const open = store.useState("open"); 9388 const nested = store.useState("nested"); 9389 const mounted = store.useState("mounted"); 9390 const transitionStatus = store.useState("transitionStatus"); 9391 const state = { 9392 open, 9393 transitionStatus 9394 }; 9395 return useRenderElement("div", componentProps, { 9396 state, 9397 ref: [store.context.backdropRef, forwardedRef], 9398 stateAttributesMapping, 9399 props: [{ 9400 role: "presentation", 9401 hidden: !mounted, 9402 style: { 9403 userSelect: "none", 9404 WebkitUserSelect: "none" 9405 } 9406 }, elementProps], 9407 enabled: forceRender || !nested 9408 }); 9409 }); 9410 if (true) DialogBackdrop.displayName = "DialogBackdrop"; 9411 9412 // node_modules/@base-ui/react/esm/dialog/close/DialogClose.js 9413 var React49 = __toESM(require_react(), 1); 9414 var DialogClose = /* @__PURE__ */ React49.forwardRef(function DialogClose2(componentProps, forwardedRef) { 9415 const { 9416 render: render4, 9417 className, 9418 disabled: disabled2 = false, 9419 nativeButton = true, 9420 style, 9421 ...elementProps 9422 } = componentProps; 9423 const { 9424 store 9425 } = useDialogRootContext(); 9426 const open = store.useState("open"); 9427 function handleClick(event) { 9428 if (open) { 9429 store.setOpen(false, createChangeEventDetails(reason_parts_exports.closePress, event.nativeEvent)); 9430 } 9431 } 9432 const { 9433 getButtonProps, 9434 buttonRef 9435 } = useButton({ 9436 disabled: disabled2, 9437 native: nativeButton 9438 }); 9439 const state = { 9440 disabled: disabled2 9441 }; 9442 return useRenderElement("button", componentProps, { 9443 state, 9444 ref: [forwardedRef, buttonRef], 9445 props: [{ 9446 onClick: handleClick 9447 }, elementProps, getButtonProps] 9448 }); 9449 }); 9450 if (true) DialogClose.displayName = "DialogClose"; 9451 9452 // node_modules/@base-ui/react/esm/dialog/description/DialogDescription.js 9453 var React50 = __toESM(require_react(), 1); 9454 var DialogDescription = /* @__PURE__ */ React50.forwardRef(function DialogDescription2(componentProps, forwardedRef) { 9455 const { 9456 render: render4, 9457 className, 9458 style, 9459 id: idProp, 9460 ...elementProps 9461 } = componentProps; 9462 const { 9463 store 9464 } = useDialogRootContext(); 9465 const id = useBaseUiId(idProp); 9466 store.useSyncedValueWithCleanup("descriptionElementId", id); 9467 return useRenderElement("p", componentProps, { 9468 ref: forwardedRef, 9469 props: [{ 9470 id 9471 }, elementProps] 9472 }); 9473 }); 9474 if (true) DialogDescription.displayName = "DialogDescription"; 9475 9476 // node_modules/@base-ui/react/esm/dialog/popup/DialogPopup.js 9477 var React52 = __toESM(require_react(), 1); 9478 9479 // node_modules/@base-ui/react/esm/dialog/popup/DialogPopupCssVars.js 9480 var DialogPopupCssVars = /* @__PURE__ */ (function(DialogPopupCssVars2) { 9481 DialogPopupCssVars2["nestedDialogs"] = "--nested-dialogs"; 9482 return DialogPopupCssVars2; 9483 })({}); 9484 9485 // node_modules/@base-ui/react/esm/dialog/popup/DialogPopupDataAttributes.js 9486 var DialogPopupDataAttributes = (function(DialogPopupDataAttributes2) { 9487 DialogPopupDataAttributes2[DialogPopupDataAttributes2["open"] = CommonPopupDataAttributes.open] = "open"; 9488 DialogPopupDataAttributes2[DialogPopupDataAttributes2["closed"] = CommonPopupDataAttributes.closed] = "closed"; 9489 DialogPopupDataAttributes2[DialogPopupDataAttributes2["startingStyle"] = CommonPopupDataAttributes.startingStyle] = "startingStyle"; 9490 DialogPopupDataAttributes2[DialogPopupDataAttributes2["endingStyle"] = CommonPopupDataAttributes.endingStyle] = "endingStyle"; 9491 DialogPopupDataAttributes2["nested"] = "data-nested"; 9492 DialogPopupDataAttributes2["nestedDialogOpen"] = "data-nested-dialog-open"; 9493 return DialogPopupDataAttributes2; 9494 })({}); 9495 9496 // node_modules/@base-ui/react/esm/dialog/portal/DialogPortalContext.js 9497 var React51 = __toESM(require_react(), 1); 9498 var DialogPortalContext = /* @__PURE__ */ React51.createContext(void 0); 9499 if (true) DialogPortalContext.displayName = "DialogPortalContext"; 9500 function useDialogPortalContext() { 9501 const value = React51.useContext(DialogPortalContext); 9502 if (value === void 0) { 9503 throw new Error(true ? "Base UI: <Dialog.Portal> is missing." : formatErrorMessage_default(26)); 9504 } 9505 return value; 9506 } 9507 9508 // node_modules/@base-ui/react/esm/dialog/popup/DialogPopup.js 9509 var import_jsx_runtime8 = __toESM(require_jsx_runtime(), 1); 9510 var stateAttributesMapping2 = { 9511 ...popupStateMapping, 9512 ...transitionStatusMapping, 9513 nestedDialogOpen(value) { 9514 return value ? { 9515 [DialogPopupDataAttributes.nestedDialogOpen]: "" 9516 } : null; 9517 } 9518 }; 9519 var DialogPopup = /* @__PURE__ */ React52.forwardRef(function DialogPopup2(componentProps, forwardedRef) { 9520 const { 9521 className, 9522 finalFocus, 9523 initialFocus, 9524 render: render4, 9525 style, 9526 ...elementProps 9527 } = componentProps; 9528 const { 9529 store 9530 } = useDialogRootContext(); 9531 const descriptionElementId = store.useState("descriptionElementId"); 9532 const disablePointerDismissal = store.useState("disablePointerDismissal"); 9533 const floatingRootContext = store.useState("floatingRootContext"); 9534 const rootPopupProps = store.useState("popupProps"); 9535 const modal = store.useState("modal"); 9536 const mounted = store.useState("mounted"); 9537 const nested = store.useState("nested"); 9538 const nestedOpenDialogCount = store.useState("nestedOpenDialogCount"); 9539 const open = store.useState("open"); 9540 const openMethod = store.useState("openMethod"); 9541 const titleElementId = store.useState("titleElementId"); 9542 const transitionStatus = store.useState("transitionStatus"); 9543 const role = store.useState("role"); 9544 useDialogPortalContext(); 9545 useOpenChangeComplete({ 9546 open, 9547 ref: store.context.popupRef, 9548 onComplete() { 9549 if (open) { 9550 store.context.onOpenChangeComplete?.(true); 9551 } 9552 } 9553 }); 9554 function defaultInitialFocus(interactionType) { 9555 if (interactionType === "touch") { 9556 return store.context.popupRef.current; 9557 } 9558 return true; 9559 } 9560 const resolvedInitialFocus = initialFocus === void 0 ? defaultInitialFocus : initialFocus; 9561 const nestedDialogOpen = nestedOpenDialogCount > 0; 9562 const state = { 9563 open, 9564 nested, 9565 transitionStatus, 9566 nestedDialogOpen 9567 }; 9568 const element = useRenderElement("div", componentProps, { 9569 state, 9570 props: [rootPopupProps, { 9571 "aria-labelledby": titleElementId ?? void 0, 9572 "aria-describedby": descriptionElementId ?? void 0, 9573 role, 9574 tabIndex: -1, 9575 hidden: !mounted, 9576 onKeyDown(event) { 9577 if (COMPOSITE_KEYS.has(event.key)) { 9578 event.stopPropagation(); 9579 } 9580 }, 9581 style: { 9582 [DialogPopupCssVars.nestedDialogs]: nestedOpenDialogCount 9583 } 9584 }, elementProps], 9585 ref: [forwardedRef, store.context.popupRef, store.useStateSetter("popupElement")], 9586 stateAttributesMapping: stateAttributesMapping2 9587 }); 9588 return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(FloatingFocusManager, { 9589 context: floatingRootContext, 9590 openInteractionType: openMethod, 9591 disabled: !mounted, 9592 closeOnFocusOut: !disablePointerDismissal, 9593 initialFocus: resolvedInitialFocus, 9594 returnFocus: finalFocus, 9595 modal: modal !== false, 9596 restoreFocus: "popup", 9597 children: element 9598 }); 9599 }); 9600 if (true) DialogPopup.displayName = "DialogPopup"; 9601 9602 // node_modules/@base-ui/react/esm/dialog/portal/DialogPortal.js 9603 var React54 = __toESM(require_react(), 1); 9604 9605 // node_modules/@base-ui/utils/esm/inertValue.js 9606 function inertValue(value) { 9607 if (isReactVersionAtLeast(19)) { 9608 return value; 9609 } 9610 return value ? "true" : void 0; 9611 } 9612 9613 // node_modules/@base-ui/react/esm/utils/InternalBackdrop.js 9614 var React53 = __toESM(require_react(), 1); 9615 var import_jsx_runtime9 = __toESM(require_jsx_runtime(), 1); 9616 var InternalBackdrop = /* @__PURE__ */ React53.forwardRef(function InternalBackdrop2(props, ref) { 9617 const { 9618 cutout, 9619 ...otherProps 9620 } = props; 9621 let clipPath; 9622 if (cutout) { 9623 const rect = cutout.getBoundingClientRect(); 9624 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)`; 9625 } 9626 return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { 9627 ref, 9628 role: "presentation", 9629 "data-base-ui-inert": "", 9630 ...otherProps, 9631 style: { 9632 position: "fixed", 9633 inset: 0, 9634 userSelect: "none", 9635 WebkitUserSelect: "none", 9636 clipPath 9637 } 9638 }); 9639 }); 9640 if (true) InternalBackdrop.displayName = "InternalBackdrop"; 9641 9642 // node_modules/@base-ui/react/esm/dialog/portal/DialogPortal.js 9643 var import_jsx_runtime10 = __toESM(require_jsx_runtime(), 1); 9644 var DialogPortal = /* @__PURE__ */ React54.forwardRef(function DialogPortal2(props, forwardedRef) { 9645 const { 9646 keepMounted = false, 9647 ...portalProps 9648 } = props; 9649 const { 9650 store 9651 } = useDialogRootContext(); 9652 const mounted = store.useState("mounted"); 9653 const modal = store.useState("modal"); 9654 const open = store.useState("open"); 9655 const shouldRender = mounted || keepMounted; 9656 if (!shouldRender) { 9657 return null; 9658 } 9659 return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(DialogPortalContext.Provider, { 9660 value: keepMounted, 9661 children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(FloatingPortal, { 9662 ref: forwardedRef, 9663 ...portalProps, 9664 children: [mounted && modal === true && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(InternalBackdrop, { 9665 ref: store.context.internalBackdropRef, 9666 inert: inertValue(!open) 9667 }), props.children] 9668 }) 9669 }); 9670 }); 9671 if (true) DialogPortal.displayName = "DialogPortal"; 9672 9673 // node_modules/@base-ui/react/esm/dialog/title/DialogTitle.js 9674 var React55 = __toESM(require_react(), 1); 9675 var DialogTitle = /* @__PURE__ */ React55.forwardRef(function DialogTitle2(componentProps, forwardedRef) { 9676 const { 9677 render: render4, 9678 className, 9679 style, 9680 id: idProp, 9681 ...elementProps 9682 } = componentProps; 9683 const { 9684 store 9685 } = useDialogRootContext(); 9686 const id = useBaseUiId(idProp); 9687 store.useSyncedValueWithCleanup("titleElementId", id); 9688 return useRenderElement("h2", componentProps, { 9689 ref: forwardedRef, 9690 props: [{ 9691 id 9692 }, elementProps] 9693 }); 9694 }); 9695 if (true) DialogTitle.displayName = "DialogTitle"; 9696 9697 // node_modules/@base-ui/react/esm/dialog/trigger/DialogTrigger.js 9698 var React56 = __toESM(require_react(), 1); 9699 var DialogTrigger = /* @__PURE__ */ React56.forwardRef(function DialogTrigger2(componentProps, forwardedRef) { 9700 const { 9701 render: render4, 9702 className, 9703 disabled: disabled2 = false, 9704 nativeButton = true, 9705 id: idProp, 9706 payload, 9707 handle, 9708 style, 9709 ...elementProps 9710 } = componentProps; 9711 const dialogRootContext = useDialogRootContext(true); 9712 const store = handle?.store ?? dialogRootContext?.store; 9713 if (!store) { 9714 throw new Error(true ? "Base UI: <Dialog.Trigger> must be used within <Dialog.Root> or provided with a handle." : formatErrorMessage_default(79)); 9715 } 9716 const thisTriggerId = useBaseUiId(idProp); 9717 const floatingContext = store.useState("floatingRootContext"); 9718 const isOpenedByThisTrigger = store.useState("isOpenedByTrigger", thisTriggerId); 9719 const triggerElementRef = React56.useRef(null); 9720 const { 9721 registerTrigger, 9722 isMountedByThisTrigger 9723 } = useTriggerDataForwarding(thisTriggerId, triggerElementRef, store, { 9724 payload 9725 }); 9726 const { 9727 getButtonProps, 9728 buttonRef 9729 } = useButton({ 9730 disabled: disabled2, 9731 native: nativeButton 9732 }); 9733 const click = useClick(floatingContext, { 9734 enabled: floatingContext != null 9735 }); 9736 const localInteractionProps = useInteractions([click]); 9737 const state = { 9738 disabled: disabled2, 9739 open: isOpenedByThisTrigger 9740 }; 9741 const rootTriggerProps = store.useState("triggerProps", isMountedByThisTrigger); 9742 return useRenderElement("button", componentProps, { 9743 state, 9744 ref: [buttonRef, forwardedRef, registerTrigger, triggerElementRef], 9745 props: [localInteractionProps.getReferenceProps(), rootTriggerProps, { 9746 [CLICK_TRIGGER_IDENTIFIER]: "", 9747 id: thisTriggerId 9748 }, elementProps, getButtonProps], 9749 stateAttributesMapping: triggerOpenStateMapping2 9750 }); 9751 }); 9752 if (true) DialogTrigger.displayName = "DialogTrigger"; 9753 9754 // node_modules/@base-ui/react/esm/dialog/viewport/DialogViewport.js 9755 var React57 = __toESM(require_react(), 1); 9756 9757 // node_modules/@base-ui/react/esm/dialog/viewport/DialogViewportDataAttributes.js 9758 var DialogViewportDataAttributes = (function(DialogViewportDataAttributes2) { 9759 DialogViewportDataAttributes2[DialogViewportDataAttributes2["open"] = CommonPopupDataAttributes.open] = "open"; 9760 DialogViewportDataAttributes2[DialogViewportDataAttributes2["closed"] = CommonPopupDataAttributes.closed] = "closed"; 9761 DialogViewportDataAttributes2[DialogViewportDataAttributes2["startingStyle"] = CommonPopupDataAttributes.startingStyle] = "startingStyle"; 9762 DialogViewportDataAttributes2[DialogViewportDataAttributes2["endingStyle"] = CommonPopupDataAttributes.endingStyle] = "endingStyle"; 9763 DialogViewportDataAttributes2["nested"] = "data-nested"; 9764 DialogViewportDataAttributes2["nestedDialogOpen"] = "data-nested-dialog-open"; 9765 return DialogViewportDataAttributes2; 9766 })({}); 9767 9768 // node_modules/@base-ui/react/esm/dialog/viewport/DialogViewport.js 9769 var stateAttributesMapping3 = { 9770 ...popupStateMapping, 9771 ...transitionStatusMapping, 9772 nested(value) { 9773 return value ? { 9774 [DialogViewportDataAttributes.nested]: "" 9775 } : null; 9776 }, 9777 nestedDialogOpen(value) { 9778 return value ? { 9779 [DialogViewportDataAttributes.nestedDialogOpen]: "" 9780 } : null; 9781 } 9782 }; 9783 var DialogViewport = /* @__PURE__ */ React57.forwardRef(function DialogViewport2(componentProps, forwardedRef) { 9784 const { 9785 className, 9786 render: render4, 9787 children, 9788 style, 9789 ...elementProps 9790 } = componentProps; 9791 const keepMounted = useDialogPortalContext(); 9792 const { 9793 store 9794 } = useDialogRootContext(); 9795 const open = store.useState("open"); 9796 const nested = store.useState("nested"); 9797 const transitionStatus = store.useState("transitionStatus"); 9798 const nestedOpenDialogCount = store.useState("nestedOpenDialogCount"); 9799 const mounted = store.useState("mounted"); 9800 const nestedDialogOpen = nestedOpenDialogCount > 0; 9801 const state = { 9802 open, 9803 nested, 9804 transitionStatus, 9805 nestedDialogOpen 9806 }; 9807 const shouldRender = keepMounted || mounted; 9808 return useRenderElement("div", componentProps, { 9809 enabled: shouldRender, 9810 state, 9811 ref: [forwardedRef, store.useStateSetter("viewportElement")], 9812 stateAttributesMapping: stateAttributesMapping3, 9813 props: [{ 9814 role: "presentation", 9815 hidden: !mounted, 9816 style: { 9817 pointerEvents: !open ? "none" : void 0 9818 }, 9819 children 9820 }, elementProps] 9821 }); 9822 }); 9823 if (true) DialogViewport.displayName = "DialogViewport"; 9824 9825 // node_modules/@base-ui/react/esm/dialog/store/DialogHandle.js 9826 var DialogHandle = class { 9827 /** 9828 * Internal store holding the dialog state. 9829 * @internal 9830 */ 9831 constructor(store) { 9832 this.store = store ?? new DialogStore(); 9833 } 9834 /** 9835 * Opens the dialog and associates it with the trigger with the given id. 9836 * The trigger, if provided, must be a Dialog.Trigger component with this handle passed as a prop. 9837 * 9838 * This method should only be called in an event handler or an effect (not during rendering). 9839 * 9840 * @param triggerId ID of the trigger to associate with the dialog. If null, the dialog will open without a trigger association. 9841 */ 9842 open(triggerId) { 9843 const triggerElement = triggerId ? this.store.context.triggerElements.getById(triggerId) : void 0; 9844 if (true) { 9845 if (triggerId && !triggerElement) { 9846 console.warn(`Base UI: DialogHandle.open: No trigger found with id "$triggerId}". The dialog will open, but the trigger will not be associated with the dialog.`); 9847 } 9848 } 9849 this.store.setOpen(true, createChangeEventDetails(reason_parts_exports.imperativeAction, void 0, triggerElement)); 9850 } 9851 /** 9852 * Opens the dialog and sets the payload. 9853 * Does not associate the dialog with any trigger. 9854 * 9855 * @param payload Payload to set when opening the dialog. 9856 */ 9857 openWithPayload(payload) { 9858 this.store.set("payload", payload); 9859 this.store.setOpen(true, createChangeEventDetails(reason_parts_exports.imperativeAction, void 0, void 0)); 9860 } 9861 /** 9862 * Closes the dialog. 9863 */ 9864 close() { 9865 this.store.setOpen(false, createChangeEventDetails(reason_parts_exports.imperativeAction, void 0, void 0)); 9866 } 9867 /** 9868 * Indicates whether the dialog is currently open. 9869 */ 9870 get isOpen() { 9871 return this.store.state.open; 9872 } 9873 }; 9874 function createDialogHandle() { 9875 return new DialogHandle(); 9876 } 9877 9878 // node_modules/@base-ui/react/esm/alert-dialog/handle.js 9879 function createAlertDialogHandle() { 9880 return new DialogHandle(new DialogStore({ 9881 modal: true, 9882 disablePointerDismissal: true, 9883 role: "alertdialog" 9884 })); 9885 } 9886 9887 // node_modules/@base-ui/react/esm/utils/useAnchorPositioning.js 9888 var React58 = __toESM(require_react(), 1); 9889 9890 // node_modules/@base-ui/react/esm/floating-ui-react/middleware/arrow.js 9891 var baseArrow = (options) => ({ 9892 name: "arrow", 9893 options, 9894 async fn(state) { 9895 const { 9896 x: x2, 9897 y: y2, 9898 placement, 9899 rects, 9900 platform: platform3, 9901 elements, 9902 middlewareData 9903 } = state; 9904 const { 9905 element, 9906 padding = 0, 9907 offsetParent = "real" 9908 } = evaluate(options, state) || {}; 9909 if (element == null) { 9910 return {}; 9911 } 9912 const paddingObject = getPaddingObject(padding); 9913 const coords = { 9914 x: x2, 9915 y: y2 9916 }; 9917 const axis = getAlignmentAxis(placement); 9918 const length = getAxisLength(axis); 9919 const arrowDimensions = await platform3.getDimensions(element); 9920 const isYAxis = axis === "y"; 9921 const minProp = isYAxis ? "top" : "left"; 9922 const maxProp = isYAxis ? "bottom" : "right"; 9923 const clientProp = isYAxis ? "clientHeight" : "clientWidth"; 9924 const endDiff = rects.reference[length] + rects.reference[axis] - coords[axis] - rects.floating[length]; 9925 const startDiff = coords[axis] - rects.reference[axis]; 9926 const arrowOffsetParent = offsetParent === "real" ? await platform3.getOffsetParent?.(element) : elements.floating; 9927 let clientSize = elements.floating[clientProp] || rects.floating[length]; 9928 if (!clientSize || !await platform3.isElement?.(arrowOffsetParent)) { 9929 clientSize = elements.floating[clientProp] || rects.floating[length]; 9930 } 9931 const centerToReference = endDiff / 2 - startDiff / 2; 9932 const largestPossiblePadding = clientSize / 2 - arrowDimensions[length] / 2 - 1; 9933 const minPadding = Math.min(paddingObject[minProp], largestPossiblePadding); 9934 const maxPadding = Math.min(paddingObject[maxProp], largestPossiblePadding); 9935 const min2 = minPadding; 9936 const max2 = clientSize - arrowDimensions[length] - maxPadding; 9937 const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference; 9938 const offset4 = clamp(min2, center, max2); 9939 const shouldAddOffset = !middlewareData.arrow && getAlignment(placement) != null && center !== offset4 && rects.reference[length] / 2 - (center < min2 ? minPadding : maxPadding) - arrowDimensions[length] / 2 < 0; 9940 const alignmentOffset = shouldAddOffset ? center < min2 ? center - min2 : center - max2 : 0; 9941 return { 9942 [axis]: coords[axis] + alignmentOffset, 9943 data: { 9944 [axis]: offset4, 9945 centerOffset: center - offset4 - alignmentOffset, 9946 ...shouldAddOffset && { 9947 alignmentOffset 9948 } 9949 }, 9950 reset: shouldAddOffset 9951 }; 9952 } 9953 }); 9954 var arrow4 = (options, deps) => ({ 9955 ...baseArrow(options), 9956 options: [options, deps] 9957 }); 9958 9959 // node_modules/@base-ui/react/esm/utils/hideMiddleware.js 9960 var hide4 = { 9961 name: "hide", 9962 async fn(state) { 9963 const { 9964 width, 9965 height, 9966 x: x2, 9967 y: y2 9968 } = state.rects.reference; 9969 const anchorHidden = width === 0 && height === 0 && x2 === 0 && y2 === 0; 9970 const nativeHideResult = await hide3().fn(state); 9971 return { 9972 data: { 9973 referenceHidden: nativeHideResult.data?.referenceHidden || anchorHidden 9974 } 9975 }; 9976 } 9977 }; 9978 9979 // node_modules/@base-ui/react/esm/utils/adaptiveOriginMiddleware.js 9980 var DEFAULT_SIDES = { 9981 sideX: "left", 9982 sideY: "top" 9983 }; 9984 var adaptiveOrigin = { 9985 name: "adaptiveOrigin", 9986 async fn(state) { 9987 const { 9988 x: rawX, 9989 y: rawY, 9990 rects: { 9991 floating: floatRect 9992 }, 9993 elements: { 9994 floating 9995 }, 9996 platform: platform3, 9997 strategy, 9998 placement 9999 } = state; 10000 const win = getWindow(floating); 10001 const styles = win.getComputedStyle(floating); 10002 const hasTransition = styles.transitionDuration !== "0s" && styles.transitionDuration !== ""; 10003 if (!hasTransition) { 10004 return { 10005 x: rawX, 10006 y: rawY, 10007 data: DEFAULT_SIDES 10008 }; 10009 } 10010 const offsetParent = await platform3.getOffsetParent?.(floating); 10011 let offsetDimensions = { 10012 width: 0, 10013 height: 0 10014 }; 10015 if (strategy === "fixed" && win?.visualViewport) { 10016 offsetDimensions = { 10017 width: win.visualViewport.width, 10018 height: win.visualViewport.height 10019 }; 10020 } else if (offsetParent === win) { 10021 const doc = ownerDocument(floating); 10022 offsetDimensions = { 10023 width: doc.documentElement.clientWidth, 10024 height: doc.documentElement.clientHeight 10025 }; 10026 } else if (await platform3.isElement?.(offsetParent)) { 10027 offsetDimensions = await platform3.getDimensions(offsetParent); 10028 } 10029 const currentSide = getSide(placement); 10030 let x2 = rawX; 10031 let y2 = rawY; 10032 if (currentSide === "left") { 10033 x2 = offsetDimensions.width - (rawX + floatRect.width); 10034 } 10035 if (currentSide === "top") { 10036 y2 = offsetDimensions.height - (rawY + floatRect.height); 10037 } 10038 const sideX = currentSide === "left" ? "right" : DEFAULT_SIDES.sideX; 10039 const sideY = currentSide === "top" ? "bottom" : DEFAULT_SIDES.sideY; 10040 return { 10041 x: x2, 10042 y: y2, 10043 data: { 10044 sideX, 10045 sideY 10046 } 10047 }; 10048 } 10049 }; 10050 10051 // node_modules/@base-ui/react/esm/utils/useAnchorPositioning.js 10052 function getLogicalSide(sideParam, renderedSide, isRtl) { 10053 const isLogicalSideParam = sideParam === "inline-start" || sideParam === "inline-end"; 10054 const logicalRight = isRtl ? "inline-start" : "inline-end"; 10055 const logicalLeft = isRtl ? "inline-end" : "inline-start"; 10056 return { 10057 top: "top", 10058 right: isLogicalSideParam ? logicalRight : "right", 10059 bottom: "bottom", 10060 left: isLogicalSideParam ? logicalLeft : "left" 10061 }[renderedSide]; 10062 } 10063 function getOffsetData(state, sideParam, isRtl) { 10064 const { 10065 rects, 10066 placement 10067 } = state; 10068 const data = { 10069 side: getLogicalSide(sideParam, getSide(placement), isRtl), 10070 align: getAlignment(placement) || "center", 10071 anchor: { 10072 width: rects.reference.width, 10073 height: rects.reference.height 10074 }, 10075 positioner: { 10076 width: rects.floating.width, 10077 height: rects.floating.height 10078 } 10079 }; 10080 return data; 10081 } 10082 function useAnchorPositioning(params) { 10083 const { 10084 // Public parameters 10085 anchor, 10086 positionMethod = "absolute", 10087 side: sideParam = "bottom", 10088 sideOffset = 0, 10089 align = "center", 10090 alignOffset = 0, 10091 collisionBoundary, 10092 collisionPadding: collisionPaddingParam = 5, 10093 sticky = false, 10094 arrowPadding = 5, 10095 disableAnchorTracking = false, 10096 // Private parameters 10097 keepMounted = false, 10098 floatingRootContext, 10099 mounted, 10100 collisionAvoidance, 10101 shiftCrossAxis = false, 10102 nodeId, 10103 adaptiveOrigin: adaptiveOrigin2, 10104 lazyFlip = false, 10105 externalTree 10106 } = params; 10107 const [mountSide, setMountSide] = React58.useState(null); 10108 if (!mounted && mountSide !== null) { 10109 setMountSide(null); 10110 } 10111 const collisionAvoidanceSide = collisionAvoidance.side || "flip"; 10112 const collisionAvoidanceAlign = collisionAvoidance.align || "flip"; 10113 const collisionAvoidanceFallbackAxisSide = collisionAvoidance.fallbackAxisSide || "end"; 10114 const anchorFn = typeof anchor === "function" ? anchor : void 0; 10115 const anchorFnCallback = useStableCallback(anchorFn); 10116 const anchorDep = anchorFn ? anchorFnCallback : anchor; 10117 const anchorValueRef = useValueAsRef(anchor); 10118 const mountedRef = useValueAsRef(mounted); 10119 const direction = useDirection(); 10120 const isRtl = direction === "rtl"; 10121 const side = mountSide || { 10122 top: "top", 10123 right: "right", 10124 bottom: "bottom", 10125 left: "left", 10126 "inline-end": isRtl ? "left" : "right", 10127 "inline-start": isRtl ? "right" : "left" 10128 }[sideParam]; 10129 const placement = align === "center" ? side : `$side}-$align}`; 10130 let collisionPadding = collisionPaddingParam; 10131 const bias = 1; 10132 const biasTop = sideParam === "bottom" ? bias : 0; 10133 const biasBottom = sideParam === "top" ? bias : 0; 10134 const biasLeft = sideParam === "right" ? bias : 0; 10135 const biasRight = sideParam === "left" ? bias : 0; 10136 if (typeof collisionPadding === "number") { 10137 collisionPadding = { 10138 top: collisionPadding + biasTop, 10139 right: collisionPadding + biasRight, 10140 bottom: collisionPadding + biasBottom, 10141 left: collisionPadding + biasLeft 10142 }; 10143 } else if (collisionPadding) { 10144 collisionPadding = { 10145 top: (collisionPadding.top || 0) + biasTop, 10146 right: (collisionPadding.right || 0) + biasRight, 10147 bottom: (collisionPadding.bottom || 0) + biasBottom, 10148 left: (collisionPadding.left || 0) + biasLeft 10149 }; 10150 } 10151 const commonCollisionProps = { 10152 boundary: collisionBoundary === "clipping-ancestors" ? "clippingAncestors" : collisionBoundary, 10153 padding: collisionPadding 10154 }; 10155 const arrowRef = React58.useRef(null); 10156 const sideOffsetRef = useValueAsRef(sideOffset); 10157 const alignOffsetRef = useValueAsRef(alignOffset); 10158 const sideOffsetDep = typeof sideOffset !== "function" ? sideOffset : 0; 10159 const alignOffsetDep = typeof alignOffset !== "function" ? alignOffset : 0; 10160 const middleware = [offset3((state) => { 10161 const data = getOffsetData(state, sideParam, isRtl); 10162 const sideAxis = typeof sideOffsetRef.current === "function" ? sideOffsetRef.current(data) : sideOffsetRef.current; 10163 const alignAxis = typeof alignOffsetRef.current === "function" ? alignOffsetRef.current(data) : alignOffsetRef.current; 10164 return { 10165 mainAxis: sideAxis, 10166 crossAxis: alignAxis, 10167 alignmentAxis: alignAxis 10168 }; 10169 }, [sideOffsetDep, alignOffsetDep, isRtl, sideParam])]; 10170 const shiftDisabled = collisionAvoidanceAlign === "none" && collisionAvoidanceSide !== "shift"; 10171 const crossAxisShiftEnabled = !shiftDisabled && (sticky || shiftCrossAxis || collisionAvoidanceSide === "shift"); 10172 const flipMiddleware = collisionAvoidanceSide === "none" ? null : flip3({ 10173 ...commonCollisionProps, 10174 // Ensure the popup flips if it's been limited by its --available-height and it resizes. 10175 // Since the size() padding is smaller than the flip() padding, flip() will take precedence. 10176 padding: { 10177 top: collisionPadding.top + bias, 10178 right: collisionPadding.right + bias, 10179 bottom: collisionPadding.bottom + bias, 10180 left: collisionPadding.left + bias 10181 }, 10182 mainAxis: !shiftCrossAxis && collisionAvoidanceSide === "flip", 10183 crossAxis: collisionAvoidanceAlign === "flip" ? "alignment" : false, 10184 fallbackAxisSideDirection: collisionAvoidanceFallbackAxisSide 10185 }); 10186 const shiftMiddleware = shiftDisabled ? null : shift3((data) => { 10187 const html = ownerDocument(data.elements.floating).documentElement; 10188 return { 10189 ...commonCollisionProps, 10190 // Use the Layout Viewport to avoid shifting around when pinch-zooming 10191 // for context menus. 10192 rootBoundary: shiftCrossAxis ? { 10193 x: 0, 10194 y: 0, 10195 width: html.clientWidth, 10196 height: html.clientHeight 10197 } : void 0, 10198 mainAxis: collisionAvoidanceAlign !== "none", 10199 crossAxis: crossAxisShiftEnabled, 10200 limiter: sticky || shiftCrossAxis ? void 0 : limitShift3((limitData) => { 10201 if (!arrowRef.current) { 10202 return {}; 10203 } 10204 const { 10205 width, 10206 height 10207 } = arrowRef.current.getBoundingClientRect(); 10208 const sideAxis = getSideAxis(getSide(limitData.placement)); 10209 const arrowSize = sideAxis === "y" ? width : height; 10210 const offsetAmount = sideAxis === "y" ? collisionPadding.left + collisionPadding.right : collisionPadding.top + collisionPadding.bottom; 10211 return { 10212 offset: arrowSize / 2 + offsetAmount / 2 10213 }; 10214 }) 10215 }; 10216 }, [commonCollisionProps, sticky, shiftCrossAxis, collisionPadding, collisionAvoidanceAlign]); 10217 if (collisionAvoidanceSide === "shift" || collisionAvoidanceAlign === "shift" || align === "center") { 10218 middleware.push(shiftMiddleware, flipMiddleware); 10219 } else { 10220 middleware.push(flipMiddleware, shiftMiddleware); 10221 } 10222 middleware.push(size3({ 10223 ...commonCollisionProps, 10224 apply({ 10225 elements: { 10226 floating 10227 }, 10228 availableWidth, 10229 availableHeight, 10230 rects 10231 }) { 10232 if (!mountedRef.current) { 10233 return; 10234 } 10235 const floatingStyle = floating.style; 10236 floatingStyle.setProperty("--available-width", `$availableWidth}px`); 10237 floatingStyle.setProperty("--available-height", `$availableHeight}px`); 10238 const dpr = getWindow(floating).devicePixelRatio || 1; 10239 const { 10240 x: x3, 10241 y: y3, 10242 width, 10243 height 10244 } = rects.reference; 10245 const anchorWidth = (Math.round((x3 + width) * dpr) - Math.round(x3 * dpr)) / dpr; 10246 const anchorHeight = (Math.round((y3 + height) * dpr) - Math.round(y3 * dpr)) / dpr; 10247 floatingStyle.setProperty("--anchor-width", `$anchorWidth}px`); 10248 floatingStyle.setProperty("--anchor-height", `$anchorHeight}px`); 10249 } 10250 }), arrow4(() => ({ 10251 // `transform-origin` calculations rely on an element existing. If the arrow hasn't been set, 10252 // we'll create a fake element. 10253 element: arrowRef.current || ownerDocument(arrowRef.current).createElement("div"), 10254 padding: arrowPadding, 10255 offsetParent: "floating" 10256 }), [arrowPadding]), { 10257 name: "transformOrigin", 10258 fn(state) { 10259 const { 10260 elements: elements2, 10261 middlewareData: middlewareData2, 10262 placement: renderedPlacement2, 10263 rects, 10264 y: y3 10265 } = state; 10266 const currentRenderedSide = getSide(renderedPlacement2); 10267 const currentRenderedAxis = getSideAxis(currentRenderedSide); 10268 const arrowEl = arrowRef.current; 10269 const arrowX = middlewareData2.arrow?.x || 0; 10270 const arrowY = middlewareData2.arrow?.y || 0; 10271 const arrowWidth = arrowEl?.clientWidth || 0; 10272 const arrowHeight = arrowEl?.clientHeight || 0; 10273 const transformX = arrowX + arrowWidth / 2; 10274 const transformY = arrowY + arrowHeight / 2; 10275 const shiftY = Math.abs(middlewareData2.shift?.y || 0); 10276 const halfAnchorHeight = rects.reference.height / 2; 10277 const sideOffsetValue = typeof sideOffset === "function" ? sideOffset(getOffsetData(state, sideParam, isRtl)) : sideOffset; 10278 const isOverlappingAnchor = shiftY > sideOffsetValue; 10279 const adjacentTransformOrigin = { 10280 top: `$transformX}px calc(100% + $sideOffsetValue}px)`, 10281 bottom: `$transformX}px ${-sideOffsetValue}px`, 10282 left: `calc(100% + $sideOffsetValue}px) $transformY}px`, 10283 right: `${-sideOffsetValue}px $transformY}px` 10284 }[currentRenderedSide]; 10285 const overlapTransformOrigin = `$transformX}px $rects.reference.y + halfAnchorHeight - y3}px`; 10286 elements2.floating.style.setProperty("--transform-origin", crossAxisShiftEnabled && currentRenderedAxis === "y" && isOverlappingAnchor ? overlapTransformOrigin : adjacentTransformOrigin); 10287 return {}; 10288 } 10289 }, hide4, adaptiveOrigin2); 10290 useIsoLayoutEffect(() => { 10291 if (!mounted && floatingRootContext) { 10292 floatingRootContext.update({ 10293 referenceElement: null, 10294 floatingElement: null, 10295 domReferenceElement: null, 10296 positionReference: null 10297 }); 10298 } 10299 }, [mounted, floatingRootContext]); 10300 const autoUpdateOptions = React58.useMemo(() => ({ 10301 elementResize: !disableAnchorTracking && typeof ResizeObserver !== "undefined", 10302 layoutShift: !disableAnchorTracking && typeof IntersectionObserver !== "undefined" 10303 }), [disableAnchorTracking]); 10304 const { 10305 refs, 10306 elements, 10307 x: x2, 10308 y: y2, 10309 middlewareData, 10310 update: update2, 10311 placement: renderedPlacement, 10312 context, 10313 isPositioned, 10314 floatingStyles: originalFloatingStyles 10315 } = useFloating2({ 10316 rootContext: floatingRootContext, 10317 open: keepMounted ? mounted : void 0, 10318 placement, 10319 middleware, 10320 strategy: positionMethod, 10321 whileElementsMounted: keepMounted ? void 0 : (...args) => autoUpdate(...args, autoUpdateOptions), 10322 nodeId, 10323 externalTree 10324 }); 10325 const { 10326 sideX, 10327 sideY 10328 } = middlewareData.adaptiveOrigin || DEFAULT_SIDES; 10329 const resolvedPosition = isPositioned ? positionMethod : "fixed"; 10330 const floatingStyles = React58.useMemo(() => { 10331 const base = adaptiveOrigin2 ? { 10332 position: resolvedPosition, 10333 [sideX]: x2, 10334 [sideY]: y2 10335 } : { 10336 position: resolvedPosition, 10337 ...originalFloatingStyles 10338 }; 10339 if (!isPositioned) { 10340 base.opacity = 0; 10341 } 10342 return base; 10343 }, [adaptiveOrigin2, resolvedPosition, sideX, x2, sideY, y2, originalFloatingStyles, isPositioned]); 10344 const registeredPositionReferenceRef = React58.useRef(null); 10345 useIsoLayoutEffect(() => { 10346 if (!mounted) { 10347 return; 10348 } 10349 const anchorValue = anchorValueRef.current; 10350 const resolvedAnchor = typeof anchorValue === "function" ? anchorValue() : anchorValue; 10351 const unwrappedElement = (isRef(resolvedAnchor) ? resolvedAnchor.current : resolvedAnchor) || null; 10352 const finalAnchor = unwrappedElement || null; 10353 if (finalAnchor !== registeredPositionReferenceRef.current) { 10354 refs.setPositionReference(finalAnchor); 10355 registeredPositionReferenceRef.current = finalAnchor; 10356 } 10357 }, [mounted, refs, anchorDep, anchorValueRef]); 10358 React58.useEffect(() => { 10359 if (!mounted) { 10360 return; 10361 } 10362 const anchorValue = anchorValueRef.current; 10363 if (typeof anchorValue === "function") { 10364 return; 10365 } 10366 if (isRef(anchorValue) && anchorValue.current !== registeredPositionReferenceRef.current) { 10367 refs.setPositionReference(anchorValue.current); 10368 registeredPositionReferenceRef.current = anchorValue.current; 10369 } 10370 }, [mounted, refs, anchorDep, anchorValueRef]); 10371 React58.useEffect(() => { 10372 if (keepMounted && mounted && elements.domReference && elements.floating) { 10373 return autoUpdate(elements.domReference, elements.floating, update2, autoUpdateOptions); 10374 } 10375 return void 0; 10376 }, [keepMounted, mounted, elements, update2, autoUpdateOptions]); 10377 const renderedSide = getSide(renderedPlacement); 10378 const logicalRenderedSide = getLogicalSide(sideParam, renderedSide, isRtl); 10379 const renderedAlign = getAlignment(renderedPlacement) || "center"; 10380 const anchorHidden = Boolean(middlewareData.hide?.referenceHidden); 10381 useIsoLayoutEffect(() => { 10382 if (lazyFlip && mounted && isPositioned) { 10383 setMountSide(renderedSide); 10384 } 10385 }, [lazyFlip, mounted, isPositioned, renderedSide]); 10386 const arrowStyles = React58.useMemo(() => ({ 10387 position: "absolute", 10388 top: middlewareData.arrow?.y, 10389 left: middlewareData.arrow?.x 10390 }), [middlewareData.arrow]); 10391 const arrowUncentered = middlewareData.arrow?.centerOffset !== 0; 10392 return React58.useMemo(() => ({ 10393 positionerStyles: floatingStyles, 10394 arrowStyles, 10395 arrowRef, 10396 arrowUncentered, 10397 side: logicalRenderedSide, 10398 align: renderedAlign, 10399 physicalSide: renderedSide, 10400 anchorHidden, 10401 refs, 10402 context, 10403 isPositioned, 10404 update: update2 10405 }), [floatingStyles, arrowStyles, arrowRef, arrowUncentered, logicalRenderedSide, renderedAlign, renderedSide, anchorHidden, refs, context, isPositioned, update2]); 10406 } 10407 function isRef(param) { 10408 return param != null && "current" in param; 10409 } 10410 10411 // node_modules/@base-ui/react/esm/utils/getDisabledMountTransitionStyles.js 10412 function getDisabledMountTransitionStyles(transitionStatus) { 10413 return transitionStatus === "starting" ? DISABLED_TRANSITIONS_STYLE : EMPTY_OBJECT; 10414 } 10415 10416 // node_modules/@base-ui/react/esm/utils/usePositioner.js 10417 function usePositioner(componentProps, state, { 10418 styles, 10419 transitionStatus, 10420 props, 10421 refs, 10422 hidden, 10423 inert = false 10424 }) { 10425 const style = { 10426 ...styles 10427 }; 10428 if (inert) { 10429 style.pointerEvents = "none"; 10430 } 10431 return useRenderElement("div", componentProps, { 10432 state, 10433 ref: refs, 10434 props: [{ 10435 role: "presentation", 10436 hidden, 10437 style 10438 }, getDisabledMountTransitionStyles(transitionStatus), props], 10439 stateAttributesMapping: popupStateMapping 10440 }); 10441 } 10442 10443 // node_modules/@base-ui/react/esm/button/Button.js 10444 var React59 = __toESM(require_react(), 1); 10445 var Button = /* @__PURE__ */ React59.forwardRef(function Button2(componentProps, forwardedRef) { 10446 const { 10447 render: render4, 10448 className, 10449 disabled: disabled2 = false, 10450 focusableWhenDisabled = false, 10451 nativeButton = true, 10452 style, 10453 ...elementProps 10454 } = componentProps; 10455 const { 10456 getButtonProps, 10457 buttonRef 10458 } = useButton({ 10459 disabled: disabled2, 10460 focusableWhenDisabled, 10461 native: nativeButton 10462 }); 10463 const state = { 10464 disabled: disabled2 10465 }; 10466 return useRenderElement("button", componentProps, { 10467 state, 10468 ref: [forwardedRef, buttonRef], 10469 props: [elementProps, getButtonProps] 10470 }); 10471 }); 10472 if (true) Button.displayName = "Button"; 10473 10474 // node_modules/@base-ui/react/esm/collapsible/index.parts.js 10475 var index_parts_exports2 = {}; 10476 __export(index_parts_exports2, { 10477 Panel: () => CollapsiblePanel, 10478 Root: () => CollapsibleRoot, 10479 Trigger: () => CollapsibleTrigger 10480 }); 10481 10482 // node_modules/@base-ui/react/esm/collapsible/root/CollapsibleRoot.js 10483 var React60 = __toESM(require_react(), 1); 10484 10485 // node_modules/@base-ui/react/esm/collapsible/root/stateAttributesMapping.js 10486 var collapsibleStateAttributesMapping = { 10487 ...collapsibleOpenStateMapping, 10488 ...transitionStatusMapping 10489 }; 10490 10491 // node_modules/@base-ui/react/esm/collapsible/root/CollapsibleRoot.js 10492 var import_jsx_runtime11 = __toESM(require_jsx_runtime(), 1); 10493 var CollapsibleRoot = /* @__PURE__ */ React60.forwardRef(function CollapsibleRoot2(componentProps, forwardedRef) { 10494 const { 10495 render: render4, 10496 className, 10497 defaultOpen = false, 10498 disabled: disabled2 = false, 10499 onOpenChange: onOpenChangeProp, 10500 open, 10501 style, 10502 ...elementProps 10503 } = componentProps; 10504 const onOpenChange = useStableCallback(onOpenChangeProp); 10505 const collapsible = useCollapsibleRoot({ 10506 open, 10507 defaultOpen, 10508 onOpenChange, 10509 disabled: disabled2 10510 }); 10511 const state = React60.useMemo(() => ({ 10512 open: collapsible.open, 10513 disabled: collapsible.disabled, 10514 transitionStatus: collapsible.transitionStatus 10515 }), [collapsible.open, collapsible.disabled, collapsible.transitionStatus]); 10516 const contextValue = React60.useMemo(() => ({ 10517 ...collapsible, 10518 onOpenChange, 10519 state 10520 }), [collapsible, onOpenChange, state]); 10521 const element = useRenderElement("div", componentProps, { 10522 state, 10523 ref: forwardedRef, 10524 props: elementProps, 10525 stateAttributesMapping: collapsibleStateAttributesMapping 10526 }); 10527 return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(CollapsibleRootContext.Provider, { 10528 value: contextValue, 10529 children: element 10530 }); 10531 }); 10532 if (true) CollapsibleRoot.displayName = "CollapsibleRoot"; 10533 10534 // node_modules/@base-ui/react/esm/collapsible/trigger/CollapsibleTrigger.js 10535 var React61 = __toESM(require_react(), 1); 10536 var stateAttributesMapping4 = { 10537 ...triggerOpenStateMapping, 10538 ...transitionStatusMapping 10539 }; 10540 var CollapsibleTrigger = /* @__PURE__ */ React61.forwardRef(function CollapsibleTrigger2(componentProps, forwardedRef) { 10541 const { 10542 panelId, 10543 open, 10544 handleTrigger, 10545 state, 10546 disabled: contextDisabled 10547 } = useCollapsibleRootContext(); 10548 const { 10549 className, 10550 disabled: disabled2 = contextDisabled, 10551 id, 10552 render: render4, 10553 nativeButton = true, 10554 style, 10555 ...elementProps 10556 } = componentProps; 10557 const { 10558 getButtonProps, 10559 buttonRef 10560 } = useButton({ 10561 disabled: disabled2, 10562 focusableWhenDisabled: true, 10563 native: nativeButton 10564 }); 10565 const props = React61.useMemo(() => ({ 10566 "aria-controls": open ? panelId : void 0, 10567 "aria-expanded": open, 10568 onClick: handleTrigger 10569 }), [panelId, open, handleTrigger]); 10570 const element = useRenderElement("button", componentProps, { 10571 state, 10572 ref: [forwardedRef, buttonRef], 10573 props: [props, elementProps, getButtonProps], 10574 stateAttributesMapping: stateAttributesMapping4 10575 }); 10576 return element; 10577 }); 10578 if (true) CollapsibleTrigger.displayName = "CollapsibleTrigger"; 10579 10580 // node_modules/@base-ui/react/esm/collapsible/panel/CollapsiblePanel.js 10581 var React62 = __toESM(require_react(), 1); 10582 10583 // node_modules/@base-ui/react/esm/collapsible/panel/CollapsiblePanelCssVars.js 10584 var CollapsiblePanelCssVars = /* @__PURE__ */ (function(CollapsiblePanelCssVars2) { 10585 CollapsiblePanelCssVars2["collapsiblePanelHeight"] = "--collapsible-panel-height"; 10586 CollapsiblePanelCssVars2["collapsiblePanelWidth"] = "--collapsible-panel-width"; 10587 return CollapsiblePanelCssVars2; 10588 })({}); 10589 10590 // node_modules/@base-ui/react/esm/collapsible/panel/CollapsiblePanel.js 10591 var CollapsiblePanel = /* @__PURE__ */ React62.forwardRef(function CollapsiblePanel2(componentProps, forwardedRef) { 10592 const { 10593 className, 10594 hiddenUntilFound: hiddenUntilFoundProp, 10595 keepMounted: keepMountedProp, 10596 render: render4, 10597 id: idProp, 10598 style, 10599 ...elementProps 10600 } = componentProps; 10601 if (true) { 10602 useIsoLayoutEffect(() => { 10603 if (hiddenUntilFoundProp && keepMountedProp === false) { 10604 warn("The `keepMounted={false}` prop on a Collapsible will be ignored when using `hiddenUntilFound` since it requires the Panel to remain mounted even when closed."); 10605 } 10606 }, [hiddenUntilFoundProp, keepMountedProp]); 10607 } 10608 const { 10609 abortControllerRef, 10610 animationTypeRef, 10611 height, 10612 mounted, 10613 onOpenChange, 10614 open, 10615 panelId, 10616 panelRef, 10617 runOnceAnimationsFinish, 10618 setDimensions, 10619 setHiddenUntilFound, 10620 setKeepMounted, 10621 setMounted, 10622 setPanelIdState, 10623 setOpen, 10624 setVisible, 10625 state, 10626 transitionDimensionRef, 10627 visible, 10628 width, 10629 transitionStatus 10630 } = useCollapsibleRootContext(); 10631 const hiddenUntilFound = hiddenUntilFoundProp ?? false; 10632 const keepMounted = keepMountedProp ?? false; 10633 useIsoLayoutEffect(() => { 10634 if (idProp) { 10635 setPanelIdState(idProp); 10636 return () => { 10637 setPanelIdState(void 0); 10638 }; 10639 } 10640 return void 0; 10641 }, [idProp, setPanelIdState]); 10642 useIsoLayoutEffect(() => { 10643 setHiddenUntilFound(hiddenUntilFound); 10644 }, [setHiddenUntilFound, hiddenUntilFound]); 10645 useIsoLayoutEffect(() => { 10646 setKeepMounted(keepMounted); 10647 }, [setKeepMounted, keepMounted]); 10648 const { 10649 props 10650 } = useCollapsiblePanel({ 10651 abortControllerRef, 10652 animationTypeRef, 10653 externalRef: forwardedRef, 10654 height, 10655 hiddenUntilFound, 10656 id: panelId, 10657 keepMounted, 10658 mounted, 10659 onOpenChange, 10660 open, 10661 panelRef, 10662 runOnceAnimationsFinish, 10663 setDimensions, 10664 setMounted, 10665 setOpen, 10666 setVisible, 10667 transitionDimensionRef, 10668 visible, 10669 width 10670 }); 10671 useOpenChangeComplete({ 10672 open: open && transitionStatus === "idle", 10673 ref: panelRef, 10674 onComplete() { 10675 if (!open) { 10676 return; 10677 } 10678 setDimensions({ 10679 height: void 0, 10680 width: void 0 10681 }); 10682 } 10683 }); 10684 const panelState = React62.useMemo(() => ({ 10685 ...state, 10686 transitionStatus 10687 }), [state, transitionStatus]); 10688 const element = useRenderElement("div", componentProps, { 10689 state: panelState, 10690 ref: [forwardedRef, panelRef], 10691 props: [props, { 10692 style: { 10693 [CollapsiblePanelCssVars.collapsiblePanelHeight]: height === void 0 ? "auto" : `$height}px`, 10694 [CollapsiblePanelCssVars.collapsiblePanelWidth]: width === void 0 ? "auto" : `$width}px` 10695 } 10696 }, elementProps], 10697 stateAttributesMapping: collapsibleStateAttributesMapping 10698 }); 10699 const shouldRender = keepMounted || hiddenUntilFound || mounted; 10700 if (!shouldRender) { 10701 return null; 10702 } 10703 return element; 10704 }); 10705 if (true) CollapsiblePanel.displayName = "CollapsiblePanel"; 10706 10707 // node_modules/@base-ui/react/esm/utils/usePopupViewport.js 10708 var React65 = __toESM(require_react(), 1); 10709 var ReactDOM5 = __toESM(require_react_dom(), 1); 10710 10711 // node_modules/@base-ui/utils/esm/usePreviousValue.js 10712 var React63 = __toESM(require_react(), 1); 10713 function usePreviousValue(value) { 10714 const [state, setState] = React63.useState({ 10715 current: value, 10716 previous: null 10717 }); 10718 if (value !== state.current) { 10719 setState({ 10720 current: value, 10721 previous: state.current 10722 }); 10723 } 10724 return state.previous; 10725 } 10726 10727 // node_modules/@base-ui/react/esm/utils/usePopupAutoResize.js 10728 var React64 = __toESM(require_react(), 1); 10729 10730 // node_modules/@base-ui/react/esm/utils/getCssDimensions.js 10731 function getCssDimensions2(element) { 10732 const css = getComputedStyle2(element); 10733 let width = parseFloat(css.width) || 0; 10734 let height = parseFloat(css.height) || 0; 10735 const hasOffset = isHTMLElement(element); 10736 const offsetWidth = hasOffset ? element.offsetWidth : width; 10737 const offsetHeight = hasOffset ? element.offsetHeight : height; 10738 const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight; 10739 if (shouldFallback) { 10740 width = offsetWidth; 10741 height = offsetHeight; 10742 } 10743 return { 10744 width, 10745 height 10746 }; 10747 } 10748 10749 // node_modules/@base-ui/react/esm/utils/usePopupAutoResize.js 10750 var DEFAULT_ENABLED = () => true; 10751 function usePopupAutoResize(parameters) { 10752 const { 10753 popupElement, 10754 positionerElement, 10755 content, 10756 mounted, 10757 enabled = DEFAULT_ENABLED, 10758 onMeasureLayout: onMeasureLayoutParam, 10759 onMeasureLayoutComplete: onMeasureLayoutCompleteParam, 10760 side, 10761 direction 10762 } = parameters; 10763 const runOnceAnimationsFinish = useAnimationsFinished(popupElement, true, false); 10764 const animationFrame = useAnimationFrame(); 10765 const committedDimensionsRef = React64.useRef(null); 10766 const liveDimensionsRef = React64.useRef(null); 10767 const isInitialRenderRef = React64.useRef(true); 10768 const restoreAnchoringStylesRef = React64.useRef(NOOP); 10769 const onMeasureLayout = useStableCallback(onMeasureLayoutParam); 10770 const onMeasureLayoutComplete = useStableCallback(onMeasureLayoutCompleteParam); 10771 const anchoringStyles = React64.useMemo(() => { 10772 let isOriginSide = side === "top"; 10773 let isPhysicalLeft = side === "left"; 10774 if (direction === "rtl") { 10775 isOriginSide = isOriginSide || side === "inline-end"; 10776 isPhysicalLeft = isPhysicalLeft || side === "inline-end"; 10777 } else { 10778 isOriginSide = isOriginSide || side === "inline-start"; 10779 isPhysicalLeft = isPhysicalLeft || side === "inline-start"; 10780 } 10781 return isOriginSide ? { 10782 position: "absolute", 10783 [side === "top" ? "bottom" : "top"]: "0", 10784 [isPhysicalLeft ? "right" : "left"]: "0" 10785 } : EMPTY_OBJECT; 10786 }, [side, direction]); 10787 useIsoLayoutEffect(() => { 10788 if (!mounted || !enabled() || typeof ResizeObserver !== "function") { 10789 restoreAnchoringStylesRef.current = NOOP; 10790 isInitialRenderRef.current = true; 10791 committedDimensionsRef.current = null; 10792 liveDimensionsRef.current = null; 10793 return void 0; 10794 } 10795 if (!popupElement || !positionerElement) { 10796 return void 0; 10797 } 10798 restoreAnchoringStylesRef.current = applyElementStyles(popupElement, anchoringStyles); 10799 const observer = new ResizeObserver((entries) => { 10800 const entry = entries[0]; 10801 if (entry) { 10802 liveDimensionsRef.current = { 10803 width: Math.ceil(entry.borderBoxSize[0].inlineSize), 10804 height: Math.ceil(entry.borderBoxSize[0].blockSize) 10805 }; 10806 } 10807 }); 10808 observer.observe(popupElement); 10809 setPopupCssSize(popupElement, "auto"); 10810 const restorePopupPosition = overrideElementStyle(popupElement, "position", "static"); 10811 const restorePopupTransform = overrideElementStyle(popupElement, "transform", "none"); 10812 const restorePopupScale = overrideElementStyle(popupElement, "scale", "1"); 10813 const restorePositionerAvailableSize = applyElementStyles(positionerElement, { 10814 "--available-width": "max-content", 10815 "--available-height": "max-content" 10816 }); 10817 function restoreMeasurementOverrides() { 10818 restorePopupPosition(); 10819 restorePopupTransform(); 10820 restorePositionerAvailableSize(); 10821 } 10822 function restoreMeasurementOverridesIncludingScale() { 10823 restoreMeasurementOverrides(); 10824 restorePopupScale(); 10825 } 10826 onMeasureLayout?.(); 10827 if (isInitialRenderRef.current || committedDimensionsRef.current === null) { 10828 setPositionerCssSize(positionerElement, "max-content"); 10829 const dimensions = getCssDimensions2(popupElement); 10830 committedDimensionsRef.current = dimensions; 10831 setPositionerCssSize(positionerElement, dimensions); 10832 restoreMeasurementOverridesIncludingScale(); 10833 onMeasureLayoutComplete?.(null, dimensions); 10834 isInitialRenderRef.current = false; 10835 return () => { 10836 observer.disconnect(); 10837 restoreAnchoringStylesRef.current(); 10838 restoreAnchoringStylesRef.current = NOOP; 10839 }; 10840 } 10841 setPopupCssSize(popupElement, "auto"); 10842 setPositionerCssSize(positionerElement, "max-content"); 10843 const previousDimensions = committedDimensionsRef.current ?? liveDimensionsRef.current; 10844 const newDimensions = getCssDimensions2(popupElement); 10845 committedDimensionsRef.current = newDimensions; 10846 if (!previousDimensions) { 10847 setPositionerCssSize(positionerElement, newDimensions); 10848 restoreMeasurementOverridesIncludingScale(); 10849 onMeasureLayoutComplete?.(null, newDimensions); 10850 return () => { 10851 observer.disconnect(); 10852 animationFrame.cancel(); 10853 restoreAnchoringStylesRef.current(); 10854 restoreAnchoringStylesRef.current = NOOP; 10855 }; 10856 } 10857 setPopupCssSize(popupElement, previousDimensions); 10858 restoreMeasurementOverridesIncludingScale(); 10859 onMeasureLayoutComplete?.(previousDimensions, newDimensions); 10860 setPositionerCssSize(positionerElement, newDimensions); 10861 const abortController = new AbortController(); 10862 animationFrame.request(() => { 10863 setPopupCssSize(popupElement, newDimensions); 10864 runOnceAnimationsFinish(() => { 10865 popupElement.style.setProperty("--popup-width", "auto"); 10866 popupElement.style.setProperty("--popup-height", "auto"); 10867 }, abortController.signal); 10868 }); 10869 return () => { 10870 observer.disconnect(); 10871 abortController.abort(); 10872 animationFrame.cancel(); 10873 restoreAnchoringStylesRef.current(); 10874 restoreAnchoringStylesRef.current = NOOP; 10875 }; 10876 }, [content, popupElement, positionerElement, runOnceAnimationsFinish, animationFrame, enabled, mounted, onMeasureLayout, onMeasureLayoutComplete, anchoringStyles]); 10877 } 10878 function overrideElementStyle(element, property, value) { 10879 const originalValue = element.style.getPropertyValue(property); 10880 element.style.setProperty(property, value); 10881 return () => { 10882 element.style.setProperty(property, originalValue); 10883 }; 10884 } 10885 function applyElementStyles(element, styles) { 10886 const restorers = []; 10887 for (const [key2, value] of Object.entries(styles)) { 10888 restorers.push(overrideElementStyle(element, key2, value)); 10889 } 10890 return restorers.length ? () => { 10891 restorers.forEach((restore) => restore()); 10892 } : NOOP; 10893 } 10894 function setPopupCssSize(popupElement, size4) { 10895 const width = size4 === "auto" ? "auto" : `$size4.width}px`; 10896 const height = size4 === "auto" ? "auto" : `$size4.height}px`; 10897 popupElement.style.setProperty("--popup-width", width); 10898 popupElement.style.setProperty("--popup-height", height); 10899 } 10900 function setPositionerCssSize(positionerElement, size4) { 10901 const width = size4 === "max-content" ? "max-content" : `$size4.width}px`; 10902 const height = size4 === "max-content" ? "max-content" : `$size4.height}px`; 10903 positionerElement.style.setProperty("--positioner-width", width); 10904 positionerElement.style.setProperty("--positioner-height", height); 10905 } 10906 10907 // node_modules/@base-ui/react/esm/utils/usePopupViewport.js 10908 var import_jsx_runtime12 = __toESM(require_jsx_runtime(), 1); 10909 function usePopupViewport(parameters) { 10910 const { 10911 store, 10912 side, 10913 cssVars, 10914 children 10915 } = parameters; 10916 const direction = useDirection(); 10917 const activeTrigger = store.useState("activeTriggerElement"); 10918 const activeTriggerId = store.useState("activeTriggerId"); 10919 const open = store.useState("open"); 10920 const payload = store.useState("payload"); 10921 const mounted = store.useState("mounted"); 10922 const popupElement = store.useState("popupElement"); 10923 const positionerElement = store.useState("positionerElement"); 10924 const previousActiveTrigger = usePreviousValue(open ? activeTrigger : null); 10925 const currentContentKey = usePopupContentKey(activeTriggerId, payload); 10926 const capturedNodeRef = React65.useRef(null); 10927 const [previousContentNode, setPreviousContentNode] = React65.useState(null); 10928 const [newTriggerOffset, setNewTriggerOffset] = React65.useState(null); 10929 const currentContainerRef = React65.useRef(null); 10930 const previousContainerRef = React65.useRef(null); 10931 const onAnimationsFinished = useAnimationsFinished(currentContainerRef, true, false); 10932 const cleanupFrame = useAnimationFrame(); 10933 const [previousContentDimensions, setPreviousContentDimensions] = React65.useState(null); 10934 const [showStartingStyleAttribute, setShowStartingStyleAttribute] = React65.useState(false); 10935 useIsoLayoutEffect(() => { 10936 store.set("hasViewport", true); 10937 return () => { 10938 store.set("hasViewport", false); 10939 }; 10940 }, [store]); 10941 const handleMeasureLayout = useStableCallback(() => { 10942 currentContainerRef.current?.style.setProperty("animation", "none"); 10943 currentContainerRef.current?.style.setProperty("transition", "none"); 10944 previousContainerRef.current?.style.setProperty("display", "none"); 10945 }); 10946 const handleMeasureLayoutComplete = useStableCallback((previousDimensions) => { 10947 currentContainerRef.current?.style.removeProperty("animation"); 10948 currentContainerRef.current?.style.removeProperty("transition"); 10949 previousContainerRef.current?.style.removeProperty("display"); 10950 if (previousDimensions) { 10951 setPreviousContentDimensions(previousDimensions); 10952 } 10953 }); 10954 const lastHandledTriggerRef = React65.useRef(null); 10955 useIsoLayoutEffect(() => { 10956 if (activeTrigger && previousActiveTrigger && activeTrigger !== previousActiveTrigger && lastHandledTriggerRef.current !== activeTrigger && capturedNodeRef.current) { 10957 setPreviousContentNode(capturedNodeRef.current); 10958 setShowStartingStyleAttribute(true); 10959 const offset4 = calculateRelativePosition(previousActiveTrigger, activeTrigger); 10960 setNewTriggerOffset(offset4); 10961 cleanupFrame.request(() => { 10962 ReactDOM5.flushSync(() => { 10963 setShowStartingStyleAttribute(false); 10964 }); 10965 onAnimationsFinished(() => { 10966 setPreviousContentNode(null); 10967 setPreviousContentDimensions(null); 10968 capturedNodeRef.current = null; 10969 }); 10970 }); 10971 lastHandledTriggerRef.current = activeTrigger; 10972 } 10973 }, [activeTrigger, previousActiveTrigger, previousContentNode, onAnimationsFinished, cleanupFrame]); 10974 useIsoLayoutEffect(() => { 10975 const source = currentContainerRef.current; 10976 if (!source) { 10977 return; 10978 } 10979 const wrapper = ownerDocument(source).createElement("div"); 10980 for (const child of Array.from(source.childNodes)) { 10981 wrapper.appendChild(child.cloneNode(true)); 10982 } 10983 capturedNodeRef.current = wrapper; 10984 }); 10985 const isTransitioning = previousContentNode != null; 10986 let childrenToRender; 10987 if (!isTransitioning) { 10988 childrenToRender = /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { 10989 "data-current": true, 10990 ref: currentContainerRef, 10991 children 10992 }, currentContentKey); 10993 } else { 10994 childrenToRender = /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(React65.Fragment, { 10995 children: [/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { 10996 "data-previous": true, 10997 inert: inertValue(true), 10998 ref: previousContainerRef, 10999 style: { 11000 ...previousContentDimensions ? { 11001 [cssVars.popupWidth]: `$previousContentDimensions.width}px`, 11002 [cssVars.popupHeight]: `$previousContentDimensions.height}px` 11003 } : null, 11004 position: "absolute" 11005 }, 11006 "data-ending-style": showStartingStyleAttribute ? void 0 : "" 11007 }, "previous"), /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { 11008 "data-current": true, 11009 ref: currentContainerRef, 11010 "data-starting-style": showStartingStyleAttribute ? "" : void 0, 11011 children 11012 }, currentContentKey)] 11013 }); 11014 } 11015 useIsoLayoutEffect(() => { 11016 const container = previousContainerRef.current; 11017 if (!container || !previousContentNode) { 11018 return; 11019 } 11020 container.replaceChildren(...Array.from(previousContentNode.childNodes)); 11021 }, [previousContentNode]); 11022 usePopupAutoResize({ 11023 popupElement, 11024 positionerElement, 11025 mounted, 11026 content: payload, 11027 onMeasureLayout: handleMeasureLayout, 11028 onMeasureLayoutComplete: handleMeasureLayoutComplete, 11029 side, 11030 direction 11031 }); 11032 const state = { 11033 activationDirection: getActivationDirection(newTriggerOffset), 11034 transitioning: isTransitioning 11035 }; 11036 return { 11037 children: childrenToRender, 11038 state 11039 }; 11040 } 11041 function getActivationDirection(offset4) { 11042 if (!offset4) { 11043 return void 0; 11044 } 11045 return `$getValueWithTolerance(offset4.horizontal, 5, "right", "left")} $getValueWithTolerance(offset4.vertical, 5, "down", "up")}`; 11046 } 11047 function getValueWithTolerance(value, tolerance, positiveLabel, negativeLabel) { 11048 if (value > tolerance) { 11049 return positiveLabel; 11050 } 11051 if (value < -tolerance) { 11052 return negativeLabel; 11053 } 11054 return ""; 11055 } 11056 function calculateRelativePosition(from, to) { 11057 const fromRect = from.getBoundingClientRect(); 11058 const toRect = to.getBoundingClientRect(); 11059 const fromCenter = { 11060 x: fromRect.left + fromRect.width / 2, 11061 y: fromRect.top + fromRect.height / 2 11062 }; 11063 const toCenter = { 11064 x: toRect.left + toRect.width / 2, 11065 y: toRect.top + toRect.height / 2 11066 }; 11067 return { 11068 horizontal: toCenter.x - fromCenter.x, 11069 vertical: toCenter.y - fromCenter.y 11070 }; 11071 } 11072 function usePopupContentKey(activeTriggerId, payload) { 11073 const [contentKey, setContentKey] = React65.useState(0); 11074 const previousActiveTriggerIdRef = React65.useRef(activeTriggerId); 11075 const previousPayloadRef = React65.useRef(payload); 11076 const pendingPayloadUpdateRef = React65.useRef(false); 11077 useIsoLayoutEffect(() => { 11078 const previousActiveTriggerId = previousActiveTriggerIdRef.current; 11079 const previousPayload = previousPayloadRef.current; 11080 const triggerIdChanged = activeTriggerId !== previousActiveTriggerId; 11081 const payloadChanged = payload !== previousPayload; 11082 if (triggerIdChanged) { 11083 setContentKey((value) => value + 1); 11084 pendingPayloadUpdateRef.current = !payloadChanged; 11085 } else if (pendingPayloadUpdateRef.current && payloadChanged) { 11086 setContentKey((value) => value + 1); 11087 pendingPayloadUpdateRef.current = false; 11088 } 11089 previousActiveTriggerIdRef.current = activeTriggerId; 11090 previousPayloadRef.current = payload; 11091 }, [activeTriggerId, payload]); 11092 return `$activeTriggerId ?? "current"}-$contentKey}`; 11093 } 11094 11095 // node_modules/@base-ui/react/esm/dialog/index.parts.js 11096 var index_parts_exports3 = {}; 11097 __export(index_parts_exports3, { 11098 Backdrop: () => DialogBackdrop, 11099 Close: () => DialogClose, 11100 Description: () => DialogDescription, 11101 Handle: () => DialogHandle, 11102 Popup: () => DialogPopup, 11103 Portal: () => DialogPortal, 11104 Root: () => DialogRoot, 11105 Title: () => DialogTitle, 11106 Trigger: () => DialogTrigger, 11107 Viewport: () => DialogViewport, 11108 createHandle: () => createDialogHandle 11109 }); 11110 11111 // node_modules/@base-ui/react/esm/drawer/index.parts.js 11112 var index_parts_exports4 = {}; 11113 __export(index_parts_exports4, { 11114 Backdrop: () => DrawerBackdrop, 11115 Close: () => DrawerClose, 11116 Content: () => DrawerContent, 11117 Description: () => DrawerDescription, 11118 Handle: () => DialogHandle, 11119 Indent: () => DrawerIndent, 11120 IndentBackground: () => DrawerIndentBackground, 11121 Popup: () => DrawerPopup, 11122 Portal: () => DrawerPortal, 11123 Provider: () => DrawerProvider, 11124 Root: () => DrawerRoot, 11125 SwipeArea: () => DrawerSwipeArea, 11126 Title: () => DrawerTitle, 11127 Trigger: () => DrawerTrigger, 11128 Viewport: () => DrawerViewport, 11129 createHandle: () => createDialogHandle 11130 }); 11131 11132 // node_modules/@base-ui/react/esm/drawer/backdrop/DrawerBackdrop.js 11133 var React66 = __toESM(require_react(), 1); 11134 11135 // node_modules/@base-ui/react/esm/drawer/popup/DrawerPopupCssVars.js 11136 var DrawerPopupCssVars = /* @__PURE__ */ (function(DrawerPopupCssVars2) { 11137 DrawerPopupCssVars2["nestedDrawers"] = "--nested-drawers"; 11138 DrawerPopupCssVars2["height"] = "--drawer-height"; 11139 DrawerPopupCssVars2["frontmostHeight"] = "--drawer-frontmost-height"; 11140 DrawerPopupCssVars2["swipeMovementX"] = "--drawer-swipe-movement-x"; 11141 DrawerPopupCssVars2["swipeMovementY"] = "--drawer-swipe-movement-y"; 11142 DrawerPopupCssVars2["snapPointOffset"] = "--drawer-snap-point-offset"; 11143 DrawerPopupCssVars2["swipeStrength"] = "--drawer-swipe-strength"; 11144 return DrawerPopupCssVars2; 11145 })({}); 11146 11147 // node_modules/@base-ui/react/esm/drawer/backdrop/DrawerBackdropCssVars.js 11148 var DrawerBackdropCssVars = /* @__PURE__ */ (function(DrawerBackdropCssVars2) { 11149 DrawerBackdropCssVars2["swipeProgress"] = "--drawer-swipe-progress"; 11150 return DrawerBackdropCssVars2; 11151 })({}); 11152 11153 // node_modules/@base-ui/react/esm/drawer/backdrop/DrawerBackdrop.js 11154 var stateAttributesMapping5 = { 11155 ...popupStateMapping, 11156 ...transitionStatusMapping 11157 }; 11158 var DrawerBackdrop = /* @__PURE__ */ React66.forwardRef(function DrawerBackdrop2(componentProps, forwardedRef) { 11159 const { 11160 render: render4, 11161 className, 11162 style, 11163 forceRender = false, 11164 ...elementProps 11165 } = componentProps; 11166 const { 11167 store 11168 } = useDialogRootContext(); 11169 const open = store.useState("open"); 11170 const nested = store.useState("nested"); 11171 const mounted = store.useState("mounted"); 11172 const transitionStatus = store.useState("transitionStatus"); 11173 const state = { 11174 open, 11175 transitionStatus 11176 }; 11177 return useRenderElement("div", componentProps, { 11178 state, 11179 ref: [store.context.backdropRef, forwardedRef], 11180 stateAttributesMapping: stateAttributesMapping5, 11181 props: [{ 11182 role: "presentation", 11183 hidden: !mounted, 11184 style: { 11185 pointerEvents: !open ? "none" : void 0, 11186 userSelect: "none", 11187 WebkitUserSelect: "none", 11188 [DrawerBackdropCssVars.swipeProgress]: "0", 11189 [DrawerPopupCssVars.swipeStrength]: "1" 11190 } 11191 }, elementProps], 11192 enabled: forceRender || !nested 11193 }); 11194 }); 11195 if (true) DrawerBackdrop.displayName = "DrawerBackdrop"; 11196 11197 // node_modules/@base-ui/react/esm/drawer/close/DrawerClose.js 11198 var DrawerClose = DialogClose; 11199 11200 // node_modules/@base-ui/react/esm/drawer/content/DrawerContent.js 11201 var React67 = __toESM(require_react(), 1); 11202 11203 // node_modules/@base-ui/react/esm/drawer/content/DrawerContentDataAttributes.js 11204 var DRAWER_CONTENT_ATTRIBUTE = "data-drawer-content"; 11205 11206 // node_modules/@base-ui/react/esm/drawer/content/DrawerContent.js 11207 var DrawerContent = /* @__PURE__ */ React67.forwardRef(function DrawerContent2(componentProps, forwardedRef) { 11208 const { 11209 render: render4, 11210 className, 11211 style, 11212 ...elementProps 11213 } = componentProps; 11214 useDialogRootContext(); 11215 return useRenderElement("div", componentProps, { 11216 ref: forwardedRef, 11217 props: [{ 11218 [DRAWER_CONTENT_ATTRIBUTE]: "" 11219 }, elementProps] 11220 }); 11221 }); 11222 if (true) DrawerContent.displayName = "DrawerContent"; 11223 11224 // node_modules/@base-ui/react/esm/drawer/description/DrawerDescription.js 11225 var DrawerDescription = DialogDescription; 11226 11227 // node_modules/@base-ui/react/esm/drawer/indent/DrawerIndent.js 11228 var React69 = __toESM(require_react(), 1); 11229 11230 // node_modules/@base-ui/react/esm/drawer/provider/DrawerProviderContext.js 11231 var React68 = __toESM(require_react(), 1); 11232 var DrawerProviderContext = /* @__PURE__ */ React68.createContext(void 0); 11233 if (true) DrawerProviderContext.displayName = "DrawerProviderContext"; 11234 function useDrawerProviderContext(optional) { 11235 const context = React68.useContext(DrawerProviderContext); 11236 if (optional === false && context === void 0) { 11237 throw new Error(true ? "Base UI: DrawerProviderContext is missing. Use <Drawer.Provider>." : formatErrorMessage_default(91)); 11238 } 11239 return context; 11240 } 11241 11242 // node_modules/@base-ui/react/esm/drawer/indent/DrawerIndent.js 11243 var stateAttributesMapping6 = { 11244 active(value) { 11245 if (value) { 11246 return { 11247 "data-active": "" 11248 }; 11249 } 11250 return { 11251 "data-inactive": "" 11252 }; 11253 } 11254 }; 11255 var DrawerIndent = /* @__PURE__ */ React69.forwardRef(function DrawerIndent2(componentProps, forwardedRef) { 11256 const { 11257 render: render4, 11258 className, 11259 style, 11260 ...elementProps 11261 } = componentProps; 11262 const providerContext = useDrawerProviderContext(true); 11263 const active = providerContext?.active ?? false; 11264 const visualStateStore = providerContext?.visualStateStore; 11265 const indentRef = React69.useRef(null); 11266 useIsoLayoutEffect(() => { 11267 const element = indentRef.current; 11268 if (!element || !visualStateStore) { 11269 return void 0; 11270 } 11271 const syncVisualState = () => { 11272 const { 11273 swipeProgress, 11274 frontmostHeight 11275 } = visualStateStore.getSnapshot(); 11276 if (swipeProgress <= 0) { 11277 element.style.setProperty(DrawerBackdropCssVars.swipeProgress, "0"); 11278 } else { 11279 element.style.setProperty(DrawerBackdropCssVars.swipeProgress, `$swipeProgress}`); 11280 } 11281 if (frontmostHeight <= 0) { 11282 element.style.removeProperty(DrawerPopupCssVars.height); 11283 } else { 11284 element.style.setProperty(DrawerPopupCssVars.height, `$frontmostHeight}px`); 11285 } 11286 }; 11287 syncVisualState(); 11288 const unsubscribe = visualStateStore.subscribe(syncVisualState); 11289 return () => { 11290 unsubscribe(); 11291 element.style.setProperty(DrawerBackdropCssVars.swipeProgress, "0"); 11292 element.style.removeProperty(DrawerPopupCssVars.height); 11293 }; 11294 }, [visualStateStore]); 11295 const state = { 11296 active 11297 }; 11298 return useRenderElement("div", componentProps, { 11299 ref: [forwardedRef, indentRef], 11300 state, 11301 props: [{ 11302 style: { 11303 [DrawerBackdropCssVars.swipeProgress]: "0" 11304 } 11305 }, elementProps], 11306 stateAttributesMapping: stateAttributesMapping6 11307 }); 11308 }); 11309 if (true) DrawerIndent.displayName = "DrawerIndent"; 11310 11311 // node_modules/@base-ui/react/esm/drawer/indent-background/DrawerIndentBackground.js 11312 var React70 = __toESM(require_react(), 1); 11313 var stateAttributesMapping7 = { 11314 active(value) { 11315 if (value) { 11316 return { 11317 "data-active": "" 11318 }; 11319 } 11320 return { 11321 "data-inactive": "" 11322 }; 11323 } 11324 }; 11325 var DrawerIndentBackground = /* @__PURE__ */ React70.forwardRef(function DrawerIndentBackground2(componentProps, forwardedRef) { 11326 const { 11327 render: render4, 11328 className, 11329 style, 11330 ...elementProps 11331 } = componentProps; 11332 const providerContext = useDrawerProviderContext(true); 11333 const active = providerContext?.active ?? false; 11334 const state = { 11335 active 11336 }; 11337 return useRenderElement("div", componentProps, { 11338 ref: forwardedRef, 11339 state, 11340 props: elementProps, 11341 stateAttributesMapping: stateAttributesMapping7 11342 }); 11343 }); 11344 if (true) DrawerIndentBackground.displayName = "DrawerIndentBackground"; 11345 11346 // node_modules/@base-ui/react/esm/drawer/popup/DrawerPopup.js 11347 var React74 = __toESM(require_react(), 1); 11348 11349 // node_modules/@base-ui/react/esm/drawer/popup/DrawerPopupDataAttributes.js 11350 var DrawerPopupDataAttributes = (function(DrawerPopupDataAttributes2) { 11351 DrawerPopupDataAttributes2[DrawerPopupDataAttributes2["open"] = CommonPopupDataAttributes.open] = "open"; 11352 DrawerPopupDataAttributes2[DrawerPopupDataAttributes2["closed"] = CommonPopupDataAttributes.closed] = "closed"; 11353 DrawerPopupDataAttributes2[DrawerPopupDataAttributes2["startingStyle"] = CommonPopupDataAttributes.startingStyle] = "startingStyle"; 11354 DrawerPopupDataAttributes2[DrawerPopupDataAttributes2["endingStyle"] = CommonPopupDataAttributes.endingStyle] = "endingStyle"; 11355 DrawerPopupDataAttributes2["expanded"] = "data-expanded"; 11356 DrawerPopupDataAttributes2["nestedDrawerOpen"] = "data-nested-drawer-open"; 11357 DrawerPopupDataAttributes2["nestedDrawerSwiping"] = "data-nested-drawer-swiping"; 11358 DrawerPopupDataAttributes2["swipeDismiss"] = "data-swipe-dismiss"; 11359 DrawerPopupDataAttributes2["swipeDirection"] = "data-swipe-direction"; 11360 DrawerPopupDataAttributes2["swiping"] = "data-swiping"; 11361 return DrawerPopupDataAttributes2; 11362 })({}); 11363 11364 // node_modules/@base-ui/react/esm/drawer/root/DrawerRootContext.js 11365 var React71 = __toESM(require_react(), 1); 11366 var DrawerRootContext = /* @__PURE__ */ React71.createContext(void 0); 11367 if (true) DrawerRootContext.displayName = "DrawerRootContext"; 11368 function useDrawerRootContext(optional) { 11369 const drawerRootContext = React71.useContext(DrawerRootContext); 11370 if (optional === false && drawerRootContext === void 0) { 11371 throw new Error(true ? "Base UI: DrawerRootContext is missing. Drawer parts must be placed within <Drawer.Root>." : formatErrorMessage_default(90)); 11372 } 11373 return drawerRootContext; 11374 } 11375 11376 // node_modules/@base-ui/react/esm/drawer/root/useDrawerSnapPoints.js 11377 var React72 = __toESM(require_react(), 1); 11378 11379 // node_modules/@base-ui/react/esm/internals/clamp.js 11380 function clamp2(val, min2 = Number.MIN_SAFE_INTEGER, max2 = Number.MAX_SAFE_INTEGER) { 11381 return Math.max(min2, Math.min(val, max2)); 11382 } 11383 11384 // node_modules/@base-ui/react/esm/drawer/root/useDrawerSnapPoints.js 11385 function resolveSnapPointValue(snapPoint, viewportHeight, rootFontSize) { 11386 if (!Number.isFinite(viewportHeight) || viewportHeight <= 0) { 11387 return null; 11388 } 11389 if (typeof snapPoint === "number") { 11390 if (!Number.isFinite(snapPoint)) { 11391 return null; 11392 } 11393 if (snapPoint <= 1) { 11394 return clamp2(snapPoint, 0, 1) * viewportHeight; 11395 } 11396 return snapPoint; 11397 } 11398 const trimmed = snapPoint.trim(); 11399 if (trimmed.endsWith("px")) { 11400 const value = Number.parseFloat(trimmed); 11401 return Number.isFinite(value) ? value : null; 11402 } 11403 if (trimmed.endsWith("rem")) { 11404 const value = Number.parseFloat(trimmed); 11405 return Number.isFinite(value) ? value * rootFontSize : null; 11406 } 11407 return null; 11408 } 11409 function findClosestSnapPoint(height, points) { 11410 let closest = null; 11411 let closestDistance = Infinity; 11412 for (const point of points) { 11413 const distance = Math.abs(point.height - height); 11414 if (distance < closestDistance) { 11415 closestDistance = distance; 11416 closest = point; 11417 } 11418 } 11419 return closest; 11420 } 11421 function useDrawerSnapPoints() { 11422 const { 11423 store 11424 } = useDialogRootContext(); 11425 const { 11426 snapPoints, 11427 activeSnapPoint, 11428 setActiveSnapPoint, 11429 popupHeight 11430 } = useDrawerRootContext(); 11431 const viewportElement = store.useState("viewportElement"); 11432 const [viewportHeight, setViewportHeight] = React72.useState(0); 11433 const [rootFontSize, setRootFontSize] = React72.useState(16); 11434 const measureViewportHeight = useStableCallback(() => { 11435 const doc = ownerDocument(viewportElement); 11436 const html = doc.documentElement; 11437 if (viewportElement) { 11438 setViewportHeight(viewportElement.offsetHeight); 11439 } 11440 if (!viewportElement) { 11441 setViewportHeight(html.clientHeight); 11442 } 11443 const fontSize = parseFloat(getComputedStyle(html).fontSize); 11444 if (Number.isFinite(fontSize)) { 11445 setRootFontSize(fontSize); 11446 } 11447 }); 11448 useIsoLayoutEffect(() => { 11449 measureViewportHeight(); 11450 if (!viewportElement || typeof ResizeObserver !== "function") { 11451 return void 0; 11452 } 11453 const resizeObserver = new ResizeObserver(measureViewportHeight); 11454 resizeObserver.observe(viewportElement); 11455 return () => { 11456 resizeObserver.disconnect(); 11457 }; 11458 }, [measureViewportHeight, viewportElement]); 11459 const resolvedSnapPoints = React72.useMemo(() => { 11460 if (!snapPoints || snapPoints.length === 0 || viewportHeight <= 0 || popupHeight <= 0) { 11461 return []; 11462 } 11463 const maxHeight = Math.min(popupHeight, viewportHeight); 11464 if (!Number.isFinite(maxHeight) || maxHeight <= 0) { 11465 return []; 11466 } 11467 const resolved = snapPoints.map((value) => { 11468 const resolvedHeight = resolveSnapPointValue(value, viewportHeight, rootFontSize); 11469 if (resolvedHeight === null || !Number.isFinite(resolvedHeight)) { 11470 return null; 11471 } 11472 const clampedHeight = clamp2(resolvedHeight, 0, maxHeight); 11473 return { 11474 value, 11475 height: clampedHeight, 11476 offset: Math.max(0, popupHeight - clampedHeight) 11477 }; 11478 }).filter((point) => Boolean(point)); 11479 if (resolved.length <= 1) { 11480 return resolved; 11481 } 11482 const deduped = []; 11483 const seenHeights = []; 11484 for (let index2 = resolved.length - 1; index2 >= 0; index2 -= 1) { 11485 const point = resolved[index2]; 11486 const isDuplicate = seenHeights.some((height) => Math.abs(height - point.height) <= 1); 11487 if (isDuplicate) { 11488 continue; 11489 } 11490 seenHeights.push(point.height); 11491 deduped.push(point); 11492 } 11493 deduped.reverse(); 11494 return deduped; 11495 }, [popupHeight, rootFontSize, snapPoints, viewportHeight]); 11496 const resolvedActiveSnapPoint = React72.useMemo(() => { 11497 if (activeSnapPoint === void 0) { 11498 return resolvedSnapPoints[0]; 11499 } 11500 if (activeSnapPoint === null) { 11501 return void 0; 11502 } 11503 const exactMatch = resolvedSnapPoints.find((point) => Object.is(point.value, activeSnapPoint)); 11504 if (exactMatch) { 11505 return exactMatch; 11506 } 11507 const maxHeight = Math.min(popupHeight, viewportHeight); 11508 const resolvedHeight = resolveSnapPointValue(activeSnapPoint, viewportHeight, rootFontSize); 11509 if (resolvedHeight === null || !Number.isFinite(resolvedHeight)) { 11510 return void 0; 11511 } 11512 const clampedHeight = clamp2(resolvedHeight, 0, maxHeight); 11513 return findClosestSnapPoint(clampedHeight, resolvedSnapPoints) ?? void 0; 11514 }, [activeSnapPoint, popupHeight, resolvedSnapPoints, rootFontSize, viewportHeight]); 11515 return { 11516 snapPoints, 11517 activeSnapPoint, 11518 setActiveSnapPoint, 11519 popupHeight, 11520 viewportHeight, 11521 resolvedSnapPoints, 11522 activeSnapPointOffset: resolvedActiveSnapPoint?.offset ?? null 11523 }; 11524 } 11525 11526 // node_modules/@base-ui/react/esm/drawer/viewport/DrawerViewportContext.js 11527 var React73 = __toESM(require_react(), 1); 11528 var DrawerViewportContext = /* @__PURE__ */ React73.createContext(null); 11529 if (true) DrawerViewportContext.displayName = "DrawerViewportContext"; 11530 function useDrawerViewportContext(optional) { 11531 const context = React73.useContext(DrawerViewportContext); 11532 if (optional === false && context === null) { 11533 throw new Error(true ? "Base UI: DrawerViewportContext is missing. Drawer parts must be placed within <Drawer.Viewport>." : formatErrorMessage_default(92)); 11534 } 11535 return context; 11536 } 11537 11538 // node_modules/@base-ui/react/esm/drawer/popup/DrawerPopup.js 11539 var import_jsx_runtime13 = __toESM(require_jsx_runtime(), 1); 11540 var drawerSwipeVarsRegistered = false; 11541 function removeCSSVariableInheritance() { 11542 if (drawerSwipeVarsRegistered) { 11543 return; 11544 } 11545 if (typeof CSS !== "undefined" && "registerProperty" in CSS) { 11546 [DrawerPopupCssVars.swipeMovementX, DrawerPopupCssVars.swipeMovementY, DrawerPopupCssVars.snapPointOffset].forEach((name) => { 11547 try { 11548 CSS.registerProperty({ 11549 name, 11550 syntax: "<length>", 11551 inherits: false, 11552 initialValue: "0px" 11553 }); 11554 } catch { 11555 } 11556 }); 11557 [{ 11558 name: DrawerBackdropCssVars.swipeProgress, 11559 initialValue: "0" 11560 }, { 11561 name: DrawerPopupCssVars.swipeStrength, 11562 initialValue: "1" 11563 }].forEach(({ 11564 name, 11565 initialValue 11566 }) => { 11567 try { 11568 CSS.registerProperty({ 11569 name, 11570 syntax: "<number>", 11571 inherits: false, 11572 initialValue 11573 }); 11574 } catch { 11575 } 11576 }); 11577 } 11578 drawerSwipeVarsRegistered = true; 11579 } 11580 var stateAttributesMapping8 = { 11581 ...popupStateMapping, 11582 ...transitionStatusMapping, 11583 expanded(value) { 11584 return value ? { 11585 [DrawerPopupDataAttributes.expanded]: "" 11586 } : null; 11587 }, 11588 nestedDrawerOpen(value) { 11589 return value ? { 11590 [DrawerPopupDataAttributes.nestedDrawerOpen]: "" 11591 } : null; 11592 }, 11593 nestedDrawerSwiping(value) { 11594 return value ? { 11595 [DrawerPopupDataAttributes.nestedDrawerSwiping]: "" 11596 } : null; 11597 }, 11598 swipeDirection(value) { 11599 return value ? { 11600 [DrawerPopupDataAttributes.swipeDirection]: value 11601 } : null; 11602 }, 11603 swiping(value) { 11604 return value ? { 11605 [DrawerPopupDataAttributes.swiping]: "" 11606 } : null; 11607 } 11608 }; 11609 var DrawerPopup = /* @__PURE__ */ React74.forwardRef(function DrawerPopup2(componentProps, forwardedRef) { 11610 const { 11611 className, 11612 finalFocus, 11613 initialFocus, 11614 render: render4, 11615 style, 11616 ...elementProps 11617 } = componentProps; 11618 const { 11619 store 11620 } = useDialogRootContext(); 11621 const { 11622 swipeDirection, 11623 frontmostHeight, 11624 hasNestedDrawer, 11625 nestedSwiping, 11626 nestedSwipeProgressStore, 11627 onPopupHeightChange, 11628 notifyParentFrontmostHeight, 11629 notifyParentHasNestedDrawer 11630 } = useDrawerRootContext(); 11631 const descriptionElementId = store.useState("descriptionElementId"); 11632 const disablePointerDismissal = store.useState("disablePointerDismissal"); 11633 const floatingRootContext = store.useState("floatingRootContext"); 11634 const rootPopupProps = store.useState("popupProps"); 11635 const modal = store.useState("modal"); 11636 const mounted = store.useState("mounted"); 11637 const nested = store.useState("nested"); 11638 const nestedOpenDrawerCount = store.useState("nestedOpenDrawerCount"); 11639 const transitionStatus = store.useState("transitionStatus"); 11640 const open = store.useState("open"); 11641 const openMethod = store.useState("openMethod"); 11642 const titleElementId = store.useState("titleElementId"); 11643 const role = store.useState("role"); 11644 const nestedDrawerOpen = nestedOpenDrawerCount > 0; 11645 const swipe2 = useDrawerViewportContext(true); 11646 const swiping = swipe2?.swiping ?? false; 11647 const swipeStrength = swipe2?.swipeStrength ?? null; 11648 const { 11649 snapPoints, 11650 activeSnapPoint, 11651 activeSnapPointOffset 11652 } = useDrawerSnapPoints(); 11653 useDialogPortalContext(); 11654 const [popupHeight, setPopupHeight] = React74.useState(0); 11655 const popupHeightRef = React74.useRef(0); 11656 if (true) { 11657 React74.useEffect(() => { 11658 if (swipe2) { 11659 return; 11660 } 11661 const ownerStackMessage = SafeReact.captureOwnerStack?.() || ""; 11662 const message2 = "<Drawer.Popup> expected to be rendered within <Drawer.Viewport>. Omitting the viewport disables drawer swipe handling and touch scroll locking. Wrap <Drawer.Popup> in <Drawer.Viewport>."; 11663 error(`$message2}$ownerStackMessage}`); 11664 }, [swipe2]); 11665 } 11666 const measureHeight = useStableCallback(() => { 11667 const popupElement = store.context.popupRef.current; 11668 if (!popupElement) { 11669 return; 11670 } 11671 const offsetHeight = popupElement.offsetHeight; 11672 if (popupHeightRef.current > 0 && frontmostHeight > popupHeightRef.current && offsetHeight > popupHeightRef.current) { 11673 return; 11674 } 11675 const keepHeightWhileNested = popupHeightRef.current > 0 && hasNestedDrawer; 11676 if (keepHeightWhileNested) { 11677 const oldHeight = popupHeightRef.current; 11678 setPopupHeight(oldHeight); 11679 onPopupHeightChange(oldHeight); 11680 return; 11681 } 11682 const nextHeight = offsetHeight; 11683 if (nextHeight === popupHeightRef.current) { 11684 return; 11685 } 11686 popupHeightRef.current = nextHeight; 11687 setPopupHeight(nextHeight); 11688 onPopupHeightChange(nextHeight); 11689 }); 11690 useIsoLayoutEffect(() => { 11691 if (!mounted) { 11692 popupHeightRef.current = 0; 11693 setPopupHeight(0); 11694 onPopupHeightChange(0); 11695 return void 0; 11696 } 11697 const popupElement = store.context.popupRef.current; 11698 if (!popupElement) { 11699 return void 0; 11700 } 11701 removeCSSVariableInheritance(); 11702 measureHeight(); 11703 if (typeof ResizeObserver !== "function") { 11704 return void 0; 11705 } 11706 const resizeObserver = new ResizeObserver(measureHeight); 11707 resizeObserver.observe(popupElement); 11708 return () => { 11709 resizeObserver.disconnect(); 11710 }; 11711 }, [measureHeight, mounted, nestedDrawerOpen, onPopupHeightChange, store.context.popupRef]); 11712 useIsoLayoutEffect(() => { 11713 const popupRef = store.context.popupRef; 11714 const syncNestedSwipeProgress = () => { 11715 const popupElement = popupRef.current; 11716 if (!popupElement) { 11717 return; 11718 } 11719 const progress = nestedSwipeProgressStore.getSnapshot(); 11720 if (progress > 0) { 11721 popupElement.style.setProperty(DrawerBackdropCssVars.swipeProgress, `$progress}`); 11722 } else { 11723 popupElement.style.setProperty(DrawerBackdropCssVars.swipeProgress, "0"); 11724 } 11725 }; 11726 syncNestedSwipeProgress(); 11727 const unsubscribe = nestedSwipeProgressStore.subscribe(syncNestedSwipeProgress); 11728 return () => { 11729 unsubscribe(); 11730 const popupElement = popupRef.current; 11731 if (popupElement) { 11732 popupElement.style.setProperty(DrawerBackdropCssVars.swipeProgress, "0"); 11733 } 11734 }; 11735 }, [nestedSwipeProgressStore, store.context.popupRef]); 11736 React74.useEffect(() => { 11737 if (!open) { 11738 return void 0; 11739 } 11740 notifyParentFrontmostHeight?.(frontmostHeight); 11741 return () => { 11742 notifyParentFrontmostHeight?.(0); 11743 }; 11744 }, [frontmostHeight, open, notifyParentFrontmostHeight]); 11745 React74.useEffect(() => { 11746 if (!notifyParentHasNestedDrawer) { 11747 return void 0; 11748 } 11749 const present = open || transitionStatus === "ending"; 11750 notifyParentHasNestedDrawer(present); 11751 return () => { 11752 notifyParentHasNestedDrawer(false); 11753 }; 11754 }, [notifyParentHasNestedDrawer, open, transitionStatus]); 11755 useOpenChangeComplete({ 11756 open, 11757 ref: store.context.popupRef, 11758 onComplete() { 11759 if (open) { 11760 store.context.onOpenChangeComplete?.(true); 11761 } 11762 } 11763 }); 11764 const resolvedInitialFocus = initialFocus === void 0 ? store.context.popupRef : initialFocus; 11765 const state = { 11766 open, 11767 nested, 11768 transitionStatus, 11769 expanded: activeSnapPoint === 1, 11770 nestedDrawerOpen, 11771 nestedDrawerSwiping: nestedSwiping, 11772 swipeDirection, 11773 swiping 11774 }; 11775 let popupHeightCssVarValue; 11776 const shouldUseAutoHeight = !hasNestedDrawer && transitionStatus !== "ending"; 11777 if (popupHeight && !shouldUseAutoHeight) { 11778 popupHeightCssVarValue = `$popupHeight}px`; 11779 } 11780 const shouldApplySnapPoints = snapPoints && snapPoints.length > 0 && (swipeDirection === "down" || swipeDirection === "up"); 11781 let snapPointOffsetValue = null; 11782 if (shouldApplySnapPoints && activeSnapPointOffset !== null) { 11783 snapPointOffsetValue = swipeDirection === "up" ? -activeSnapPointOffset : activeSnapPointOffset; 11784 } 11785 let dragStyles = swipe2 ? swipe2.getDragStyles() : EMPTY_OBJECT; 11786 if (shouldApplySnapPoints && swipeDirection === "down") { 11787 const baseOffset = activeSnapPointOffset ?? 0; 11788 const movementValue = Number.parseFloat(String(dragStyles[DrawerPopupCssVars.swipeMovementY] ?? 0)); 11789 const nextOffset = Number.isFinite(movementValue) ? baseOffset + movementValue : baseOffset; 11790 const shouldDamp = nextOffset < 0; 11791 if (swiping && shouldDamp && Number.isFinite(movementValue)) { 11792 const overshoot = Math.abs(nextOffset); 11793 const dampedOffset = -Math.sqrt(overshoot); 11794 const dampedMovement = dampedOffset - baseOffset; 11795 dragStyles = { 11796 ...dragStyles, 11797 transform: void 0, 11798 [DrawerPopupCssVars.swipeMovementY]: `$dampedMovement}px` 11799 }; 11800 } else { 11801 dragStyles = { 11802 ...dragStyles, 11803 transform: void 0 11804 }; 11805 } 11806 } 11807 const element = useRenderElement("div", componentProps, { 11808 state, 11809 props: [rootPopupProps, { 11810 "aria-labelledby": titleElementId, 11811 "aria-describedby": descriptionElementId, 11812 role, 11813 tabIndex: -1, 11814 hidden: !mounted, 11815 onKeyDown(event) { 11816 if (COMPOSITE_KEYS.has(event.key)) { 11817 event.stopPropagation(); 11818 } 11819 }, 11820 style: { 11821 ...dragStyles, 11822 [DrawerBackdropCssVars.swipeProgress]: "0", 11823 [DrawerPopupCssVars.nestedDrawers]: nestedOpenDrawerCount, 11824 [DrawerPopupCssVars.height]: popupHeightCssVarValue, 11825 [DrawerPopupCssVars.snapPointOffset]: typeof snapPointOffsetValue === "number" ? `$snapPointOffsetValue}px` : "0px", 11826 [DrawerPopupCssVars.frontmostHeight]: frontmostHeight ? `$frontmostHeight}px` : void 0, 11827 [DrawerPopupCssVars.swipeStrength]: typeof swipeStrength === "number" && Number.isFinite(swipeStrength) && swipeStrength > 0 ? `$swipeStrength}` : "1" 11828 } 11829 }, elementProps], 11830 ref: [forwardedRef, store.context.popupRef, store.useStateSetter("popupElement")], 11831 stateAttributesMapping: stateAttributesMapping8 11832 }); 11833 return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(FloatingFocusManager, { 11834 context: floatingRootContext, 11835 openInteractionType: openMethod, 11836 disabled: !mounted, 11837 closeOnFocusOut: !disablePointerDismissal, 11838 initialFocus: resolvedInitialFocus, 11839 returnFocus: finalFocus, 11840 modal: modal !== false, 11841 restoreFocus: "popup", 11842 children: element 11843 }); 11844 }); 11845 if (true) DrawerPopup.displayName = "DrawerPopup"; 11846 11847 // node_modules/@base-ui/react/esm/drawer/portal/DrawerPortal.js 11848 var DrawerPortal = DialogPortal; 11849 11850 // node_modules/@base-ui/react/esm/drawer/provider/DrawerProvider.js 11851 var React75 = __toESM(require_react(), 1); 11852 var import_jsx_runtime14 = __toESM(require_jsx_runtime(), 1); 11853 function DrawerProvider(props) { 11854 const { 11855 children 11856 } = props; 11857 const [openById, setOpenById] = React75.useState(() => /* @__PURE__ */ new Map()); 11858 const [visualStateStore] = React75.useState(createVisualStateStore); 11859 const setDrawerOpen = useStableCallback((drawerId, open) => { 11860 setOpenById((prev) => { 11861 const prevOpen = prev.get(drawerId); 11862 if (prevOpen === open) { 11863 return prev; 11864 } 11865 const next = new Map(prev); 11866 next.set(drawerId, open); 11867 return next; 11868 }); 11869 }); 11870 const removeDrawer = useStableCallback((drawerId) => { 11871 setOpenById((prev) => { 11872 if (!prev.has(drawerId)) { 11873 return prev; 11874 } 11875 const next = new Map(prev); 11876 next.delete(drawerId); 11877 return next; 11878 }); 11879 }); 11880 const active = React75.useMemo(() => { 11881 for (const open of openById.values()) { 11882 if (open) { 11883 return true; 11884 } 11885 } 11886 return false; 11887 }, [openById]); 11888 const contextValue = React75.useMemo(() => ({ 11889 setDrawerOpen, 11890 removeDrawer, 11891 active, 11892 visualStateStore 11893 }), [active, removeDrawer, setDrawerOpen, visualStateStore]); 11894 return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(DrawerProviderContext.Provider, { 11895 value: contextValue, 11896 children 11897 }); 11898 } 11899 function createVisualStateStore() { 11900 let state = { 11901 swipeProgress: 0, 11902 frontmostHeight: 0 11903 }; 11904 const listeners = /* @__PURE__ */ new Set(); 11905 return { 11906 getSnapshot: () => state, 11907 set(nextState) { 11908 let nextSwipeProgress = state.swipeProgress; 11909 if (nextState.swipeProgress !== void 0) { 11910 nextSwipeProgress = Number.isFinite(nextState.swipeProgress) ? nextState.swipeProgress : 0; 11911 } 11912 let nextFrontmostHeight = state.frontmostHeight; 11913 if (nextState.frontmostHeight !== void 0) { 11914 nextFrontmostHeight = Number.isFinite(nextState.frontmostHeight) ? nextState.frontmostHeight : 0; 11915 } 11916 if (nextSwipeProgress === state.swipeProgress && nextFrontmostHeight === state.frontmostHeight) { 11917 return; 11918 } 11919 state = { 11920 swipeProgress: nextSwipeProgress, 11921 frontmostHeight: nextFrontmostHeight 11922 }; 11923 listeners.forEach((listener) => { 11924 listener(); 11925 }); 11926 }, 11927 subscribe(listener) { 11928 listeners.add(listener); 11929 return () => { 11930 listeners.delete(listener); 11931 }; 11932 } 11933 }; 11934 } 11935 11936 // node_modules/@base-ui/react/esm/drawer/root/DrawerRoot.js 11937 var React76 = __toESM(require_react(), 1); 11938 var import_jsx_runtime15 = __toESM(require_jsx_runtime(), 1); 11939 var _DrawerProviderReport; 11940 var _DrawerProviderReport2; 11941 function DrawerRoot(props) { 11942 const { 11943 children, 11944 open: openProp, 11945 defaultOpen = false, 11946 onOpenChange, 11947 onOpenChangeComplete, 11948 disablePointerDismissal = false, 11949 modal = true, 11950 actionsRef, 11951 handle, 11952 triggerId: triggerIdProp, 11953 defaultTriggerId: defaultTriggerIdProp = null, 11954 swipeDirection = "down", 11955 snapToSequentialPoints = false, 11956 snapPoints, 11957 snapPoint: snapPointProp, 11958 defaultSnapPoint, 11959 onSnapPointChange: onSnapPointChangeProp 11960 } = props; 11961 const onSnapPointChange = useStableCallback(onSnapPointChangeProp); 11962 const parentDrawerRootContext = useDrawerRootContext(true); 11963 const notifyParentSwipeProgressChange = parentDrawerRootContext?.onNestedSwipeProgressChange; 11964 const notifyParentFrontmostHeight = parentDrawerRootContext?.onNestedFrontmostHeightChange; 11965 const notifyParentSwipingChange = parentDrawerRootContext?.onNestedSwipingChange; 11966 const notifyParentHasNestedDrawer = parentDrawerRootContext?.onNestedDrawerPresenceChange; 11967 const [popupHeight, setPopupHeight] = React76.useState(0); 11968 const [frontmostHeight, setFrontmostHeight] = React76.useState(0); 11969 const [hasNestedDrawer, setHasNestedDrawer] = React76.useState(false); 11970 const [nestedSwiping, setNestedSwiping] = React76.useState(false); 11971 const [nestedSwipeProgressStore] = React76.useState(createNestedSwipeProgressStore); 11972 const resolvedDefaultSnapPoint = defaultSnapPoint !== void 0 ? defaultSnapPoint : snapPoints?.[0] ?? null; 11973 const isSnapPointControlled = snapPointProp !== void 0; 11974 const [activeSnapPoint, setActiveSnapPointUnwrapped] = useControlled({ 11975 controlled: snapPointProp, 11976 default: resolvedDefaultSnapPoint, 11977 name: "Drawer", 11978 state: "snapPoint" 11979 }); 11980 const isNestedDrawerOpenRef = React76.useRef(false); 11981 const setActiveSnapPoint = useStableCallback((nextSnapPoint, eventDetails) => { 11982 const resolvedEventDetails = eventDetails ?? createChangeEventDetails(reason_parts_exports.none); 11983 onSnapPointChange?.(nextSnapPoint, resolvedEventDetails); 11984 if (resolvedEventDetails.isCanceled) { 11985 return; 11986 } 11987 setActiveSnapPointUnwrapped(nextSnapPoint); 11988 }); 11989 const resolvedActiveSnapPoint = React76.useMemo(() => { 11990 if (isSnapPointControlled) { 11991 return activeSnapPoint; 11992 } 11993 if (!snapPoints || snapPoints.length === 0) { 11994 return activeSnapPoint; 11995 } 11996 if (activeSnapPoint === null || !snapPoints.some((snapPoint) => Object.is(snapPoint, activeSnapPoint))) { 11997 return resolvedDefaultSnapPoint; 11998 } 11999 return activeSnapPoint; 12000 }, [activeSnapPoint, isSnapPointControlled, resolvedDefaultSnapPoint, snapPoints]); 12001 const onPopupHeightChange = useStableCallback((height) => { 12002 setPopupHeight(height); 12003 if (!isNestedDrawerOpenRef.current && height > 0) { 12004 setFrontmostHeight(height); 12005 } 12006 }); 12007 const onNestedFrontmostHeightChange = useStableCallback((height) => { 12008 if (height > 0) { 12009 isNestedDrawerOpenRef.current = true; 12010 setFrontmostHeight(height); 12011 return; 12012 } 12013 isNestedDrawerOpenRef.current = false; 12014 if (popupHeight > 0) { 12015 setFrontmostHeight(popupHeight); 12016 } 12017 }); 12018 const onNestedDrawerPresenceChange = useStableCallback((present) => { 12019 setHasNestedDrawer(present); 12020 }); 12021 const onNestedSwipeProgressChange = useStableCallback((progress) => { 12022 nestedSwipeProgressStore.set(progress); 12023 notifyParentSwipeProgressChange?.(progress); 12024 }); 12025 const onNestedSwipingChange = useStableCallback((swiping) => { 12026 setNestedSwiping(swiping); 12027 notifyParentSwipingChange?.(swiping); 12028 }); 12029 const handleOpenChange = useStableCallback((nextOpen, eventDetails) => { 12030 onOpenChange?.(nextOpen, eventDetails); 12031 if (eventDetails.isCanceled) { 12032 return; 12033 } 12034 if (!nextOpen && snapPoints && snapPoints.length > 0) { 12035 setActiveSnapPoint(resolvedDefaultSnapPoint, createChangeEventDetails(eventDetails.reason, eventDetails.event, eventDetails.trigger)); 12036 } 12037 }); 12038 const contextValue = React76.useMemo(() => ({ 12039 swipeDirection, 12040 snapToSequentialPoints, 12041 snapPoints, 12042 activeSnapPoint: resolvedActiveSnapPoint, 12043 setActiveSnapPoint, 12044 frontmostHeight, 12045 popupHeight, 12046 hasNestedDrawer, 12047 nestedSwiping, 12048 nestedSwipeProgressStore, 12049 onNestedDrawerPresenceChange, 12050 onPopupHeightChange, 12051 onNestedFrontmostHeightChange, 12052 onNestedSwipingChange, 12053 onNestedSwipeProgressChange, 12054 notifyParentFrontmostHeight, 12055 notifyParentSwipingChange, 12056 notifyParentSwipeProgressChange, 12057 notifyParentHasNestedDrawer 12058 }), [resolvedActiveSnapPoint, frontmostHeight, hasNestedDrawer, nestedSwiping, nestedSwipeProgressStore, notifyParentHasNestedDrawer, notifyParentSwipeProgressChange, notifyParentSwipingChange, notifyParentFrontmostHeight, onNestedDrawerPresenceChange, onNestedFrontmostHeightChange, onNestedSwipeProgressChange, onNestedSwipingChange, onPopupHeightChange, popupHeight, setActiveSnapPoint, snapPoints, snapToSequentialPoints, swipeDirection]); 12059 const resolvedChildren = typeof children === "function" ? (payload) => /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(React76.Fragment, { 12060 children: [_DrawerProviderReport || (_DrawerProviderReport = /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(DrawerProviderReporter, {})), children(payload)] 12061 }) : /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(React76.Fragment, { 12062 children: [_DrawerProviderReport2 || (_DrawerProviderReport2 = /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(DrawerProviderReporter, {})), children] 12063 }); 12064 return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(DrawerRootContext.Provider, { 12065 value: contextValue, 12066 children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(IsDrawerContext.Provider, { 12067 value: true, 12068 children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(index_parts_exports3.Root, { 12069 open: openProp, 12070 defaultOpen, 12071 onOpenChange: handleOpenChange, 12072 onOpenChangeComplete, 12073 disablePointerDismissal, 12074 modal, 12075 actionsRef, 12076 handle, 12077 triggerId: triggerIdProp, 12078 defaultTriggerId: defaultTriggerIdProp, 12079 children: resolvedChildren 12080 }) 12081 }) 12082 }); 12083 } 12084 function createNestedSwipeProgressStore() { 12085 let progress = 0; 12086 const listeners = /* @__PURE__ */ new Set(); 12087 return { 12088 getSnapshot: () => progress, 12089 set(nextProgress) { 12090 const resolved = Number.isFinite(nextProgress) ? nextProgress : 0; 12091 if (resolved === progress) { 12092 return; 12093 } 12094 progress = resolved; 12095 listeners.forEach((listener) => { 12096 listener(); 12097 }); 12098 }, 12099 subscribe(listener) { 12100 listeners.add(listener); 12101 return () => { 12102 listeners.delete(listener); 12103 }; 12104 } 12105 }; 12106 } 12107 function DrawerProviderReporter() { 12108 const drawerId = useId(); 12109 const providerContext = useDrawerProviderContext(true); 12110 const dialogRootContext = useDialogRootContext(false); 12111 const open = dialogRootContext.store.useState("open"); 12112 const nestedOpenDialogCount = dialogRootContext.store.useState("nestedOpenDialogCount"); 12113 const popupElement = dialogRootContext.store.useState("popupElement"); 12114 const isTopmost = nestedOpenDialogCount === 0; 12115 React76.useEffect(() => { 12116 if (!providerContext || drawerId == null) { 12117 return void 0; 12118 } 12119 return () => { 12120 providerContext.removeDrawer(drawerId); 12121 }; 12122 }, [drawerId, providerContext]); 12123 React76.useEffect(() => { 12124 if (drawerId == null) { 12125 return; 12126 } 12127 providerContext?.setDrawerOpen(drawerId, open); 12128 }, [drawerId, open, providerContext]); 12129 React76.useEffect(() => { 12130 if (!open || !isTopmost || !isAndroid) { 12131 return void 0; 12132 } 12133 const win = getWindow(popupElement); 12134 const CloseWatcherCtor = win.CloseWatcher; 12135 if (!CloseWatcherCtor) { 12136 return void 0; 12137 } 12138 function handleCloseWatcher(event) { 12139 if (!dialogRootContext.store.select("open")) { 12140 return; 12141 } 12142 dialogRootContext.store.setOpen(false, createChangeEventDetails(reason_parts_exports.closeWatcher, event)); 12143 } 12144 const closeWatcher2 = new CloseWatcherCtor(); 12145 const unsubscribe = addEventListener(closeWatcher2, "close", handleCloseWatcher); 12146 return () => { 12147 unsubscribe(); 12148 closeWatcher2.destroy(); 12149 }; 12150 }, [dialogRootContext.store, isTopmost, open, popupElement]); 12151 return null; 12152 } 12153 12154 // node_modules/@base-ui/react/esm/drawer/swipe-area/DrawerSwipeArea.js 12155 var React78 = __toESM(require_react(), 1); 12156 12157 // node_modules/@base-ui/react/esm/utils/useSwipeDismiss.js 12158 var React77 = __toESM(require_react(), 1); 12159 12160 // node_modules/@base-ui/react/esm/utils/scrollable.js 12161 function isScrollable(element, axis) { 12162 const style = getComputedStyle2(element); 12163 if (axis === "vertical") { 12164 const overflowY = style.overflowY; 12165 return (overflowY === "auto" || overflowY === "scroll") && element.scrollHeight > element.clientHeight; 12166 } 12167 const overflowX = style.overflowX; 12168 return (overflowX === "auto" || overflowX === "scroll") && element.scrollWidth > element.clientWidth; 12169 } 12170 function hasScrollableAncestor(target, root, axes) { 12171 let node = target; 12172 while (node && node !== root) { 12173 for (const axis of axes) { 12174 if (isScrollable(node, axis)) { 12175 return true; 12176 } 12177 } 12178 node = node.parentElement; 12179 } 12180 return false; 12181 } 12182 function findScrollableTouchTarget(target, root, axis = "vertical") { 12183 let node = isHTMLElement(target) ? target : null; 12184 while (node && node !== root) { 12185 if (isScrollable(node, axis)) { 12186 return node; 12187 } 12188 node = node.parentElement; 12189 } 12190 return isScrollable(root, axis) ? root : null; 12191 } 12192 12193 // node_modules/@base-ui/react/esm/utils/getElementAtPoint.js 12194 function getElementAtPoint(doc, x2, y2) { 12195 return typeof doc?.elementFromPoint === "function" ? doc.elementFromPoint(x2, y2) : null; 12196 } 12197 12198 // node_modules/@base-ui/react/esm/utils/useSwipeDismiss.js 12199 var DEFAULT_SWIPE_THRESHOLD = 40; 12200 var REVERSE_CANCEL_THRESHOLD = 10; 12201 var MIN_DRAG_THRESHOLD = 1; 12202 var MIN_VELOCITY_DURATION_MS = 50; 12203 var MIN_RELEASE_VELOCITY_DURATION_MS = 16; 12204 var MAX_RELEASE_VELOCITY_AGE_MS = 80; 12205 var DEFAULT_IGNORE_SELECTOR = 'button,a,input,select,textarea,label,[role="button"]'; 12206 function getDisplacement(direction, deltaX, deltaY) { 12207 switch (direction) { 12208 case "up": 12209 return -deltaY; 12210 case "down": 12211 return deltaY; 12212 case "left": 12213 return -deltaX; 12214 case "right": 12215 return deltaX; 12216 default: 12217 return 0; 12218 } 12219 } 12220 function getElementTransform(element) { 12221 const computedStyle = getWindow(element).getComputedStyle(element); 12222 const transform = computedStyle.transform; 12223 let translateX = 0; 12224 let translateY = 0; 12225 let scale = 1; 12226 if (transform && transform !== "none") { 12227 const matrix = transform.match(/matrix(?:3d)?\(([^)]+)\)/); 12228 if (matrix) { 12229 const values = matrix[1].split(", ").map(parseFloat); 12230 if (values.length === 6) { 12231 translateX = values[4]; 12232 translateY = values[5]; 12233 scale = Math.sqrt(values[0] * values[0] + values[1] * values[1]); 12234 } else if (values.length === 16) { 12235 translateX = values[12]; 12236 translateY = values[13]; 12237 scale = values[0]; 12238 } 12239 } 12240 } 12241 return { 12242 x: translateX, 12243 y: translateY, 12244 scale 12245 }; 12246 } 12247 function getValidTimeStamp(timeStamp) { 12248 return Number.isFinite(timeStamp) && timeStamp > 0 ? timeStamp : null; 12249 } 12250 function hasPrimaryMouseButton(buttons) { 12251 return buttons % 2 === 1; 12252 } 12253 function safelyChangePointerCapture(element, pointerId, method) { 12254 const pointerCaptureMethod = element[method]; 12255 if (typeof pointerCaptureMethod !== "function") { 12256 return; 12257 } 12258 try { 12259 pointerCaptureMethod.call(element, pointerId); 12260 } catch (error2) { 12261 if (error2 && typeof error2 === "object" && "name" in error2 && error2.name === "NotFoundError") { 12262 return; 12263 } 12264 throw error2; 12265 } 12266 } 12267 function useSwipeDismiss(options) { 12268 const { 12269 enabled, 12270 directions: directions2, 12271 elementRef, 12272 movementCssVars, 12273 canStart, 12274 ignoreSelectorWhenTouch = true, 12275 ignoreScrollableAncestors = false, 12276 swipeThreshold: swipeThresholdProp, 12277 onDismiss, 12278 onProgress, 12279 onCancel, 12280 onSwipeStart, 12281 onRelease, 12282 onSwipingChange, 12283 trackDrag = true 12284 } = options; 12285 const ignoreSelector = DEFAULT_IGNORE_SELECTOR; 12286 const primaryDirection = directions2.length === 1 ? directions2[0] : void 0; 12287 const swipeThresholdDefault = Math.max(0, typeof swipeThresholdProp === "number" ? swipeThresholdProp : DEFAULT_SWIPE_THRESHOLD); 12288 const allowLeft = directions2.includes("left"); 12289 const allowRight = directions2.includes("right"); 12290 const allowUp = directions2.includes("up"); 12291 const allowDown = directions2.includes("down"); 12292 const hasHorizontal = allowLeft || allowRight; 12293 const hasVertical = allowUp || allowDown; 12294 const scrollAxes = React77.useMemo(() => { 12295 const axes = []; 12296 if (hasVertical) { 12297 axes.push("vertical"); 12298 } 12299 if (hasHorizontal) { 12300 axes.push("horizontal"); 12301 } 12302 return axes; 12303 }, [hasHorizontal, hasVertical]); 12304 const [currentSwipeDirection, setCurrentSwipeDirection] = React77.useState(void 0); 12305 const [isSwiping, setIsSwiping] = React77.useState(false); 12306 const [isRealSwipe, setIsRealSwipe] = React77.useState(false); 12307 const [dragDismissed, setDragDismissed] = React77.useState(false); 12308 const [dragOffset, setDragOffset] = React77.useState({ 12309 x: 0, 12310 y: 0 12311 }); 12312 const [initialTransform, setInitialTransform] = React77.useState({ 12313 x: 0, 12314 y: 0, 12315 scale: 1 12316 }); 12317 const [lockedDirection, setLockedDirection] = React77.useState(null); 12318 const dragStartPosRef = React77.useRef({ 12319 x: 0, 12320 y: 0 12321 }); 12322 const dragOffsetRef = React77.useRef({ 12323 x: 0, 12324 y: 0 12325 }); 12326 const lastMovePosRef = React77.useRef(null); 12327 const initialTransformRef = React77.useRef({ 12328 x: 0, 12329 y: 0, 12330 scale: 1 12331 }); 12332 const intendedSwipeDirectionRef = React77.useRef(void 0); 12333 const maxSwipeDisplacementRef = React77.useRef(0); 12334 const cancelledSwipeRef = React77.useRef(false); 12335 const swipeCancelBaselineRef = React77.useRef({ 12336 x: 0, 12337 y: 0 12338 }); 12339 const isFirstPointerMoveRef = React77.useRef(false); 12340 const pendingSwipeRef = React77.useRef(false); 12341 const pendingSwipeStartPosRef = React77.useRef(null); 12342 const swipeFromScrollableRef = React77.useRef(false); 12343 const sawPrimaryButtonsOnMoveRef = React77.useRef(false); 12344 const elementSizeRef = React77.useRef({ 12345 width: 0, 12346 height: 0 12347 }); 12348 const swipeProgressRef = React77.useRef(0); 12349 const swipeThresholdRef = React77.useRef(swipeThresholdDefault); 12350 const swipeStartTimeRef = React77.useRef(null); 12351 const lastDragSampleRef = React77.useRef(null); 12352 const lastDragVelocityRef = React77.useRef({ 12353 x: 0, 12354 y: 0 12355 }); 12356 const lastProgressDetailsRef = React77.useRef(null); 12357 const isSwipingRef = React77.useRef(false); 12358 const setSwiping = useStableCallback((nextSwiping) => { 12359 if (isSwipingRef.current === nextSwiping) { 12360 return; 12361 } 12362 isSwipingRef.current = nextSwiping; 12363 setIsSwiping(nextSwiping); 12364 onSwipingChange?.(nextSwiping); 12365 }); 12366 function resolveSwipeThreshold(direction) { 12367 if (!direction) { 12368 return; 12369 } 12370 if (typeof swipeThresholdProp !== "function") { 12371 swipeThresholdRef.current = swipeThresholdDefault; 12372 return; 12373 } 12374 const element = elementRef.current; 12375 if (!element) { 12376 return; 12377 } 12378 const value = swipeThresholdProp({ 12379 element, 12380 direction 12381 }); 12382 swipeThresholdRef.current = Math.max(0, value); 12383 } 12384 const updateSwipeProgress = useStableCallback((progress, details) => { 12385 const nextProgress = Number.isFinite(progress) ? clamp2(progress, 0, 1) : 0; 12386 const progressChanged = nextProgress !== swipeProgressRef.current; 12387 let detailsChanged = false; 12388 if (details) { 12389 const lastDetails = lastProgressDetailsRef.current; 12390 detailsChanged = !lastDetails || lastDetails.deltaX !== details.deltaX || lastDetails.deltaY !== details.deltaY || lastDetails.direction !== details.direction; 12391 } 12392 if (!progressChanged && !detailsChanged) { 12393 return; 12394 } 12395 swipeProgressRef.current = nextProgress; 12396 if (details) { 12397 lastProgressDetailsRef.current = details; 12398 } else if (progressChanged) { 12399 lastProgressDetailsRef.current = null; 12400 } 12401 onProgress?.(nextProgress, details); 12402 }); 12403 function recordDragSample(offset4, timeStamp) { 12404 if (timeStamp === null) { 12405 return; 12406 } 12407 const lastSample = lastDragSampleRef.current; 12408 if (lastSample && timeStamp > lastSample.time) { 12409 const durationMs = Math.max(timeStamp - lastSample.time, MIN_RELEASE_VELOCITY_DURATION_MS); 12410 lastDragVelocityRef.current = { 12411 x: (offset4.x - lastSample.x) / durationMs, 12412 y: (offset4.y - lastSample.y) / durationMs 12413 }; 12414 } 12415 lastDragSampleRef.current = { 12416 x: offset4.x, 12417 y: offset4.y, 12418 time: timeStamp 12419 }; 12420 } 12421 const reset = React77.useCallback(() => { 12422 setCurrentSwipeDirection(void 0); 12423 setSwiping(false); 12424 setIsRealSwipe(false); 12425 setDragDismissed(false); 12426 setDragOffset({ 12427 x: 0, 12428 y: 0 12429 }); 12430 setInitialTransform({ 12431 x: 0, 12432 y: 0, 12433 scale: 1 12434 }); 12435 setLockedDirection(null); 12436 updateSwipeProgress(0); 12437 swipeThresholdRef.current = swipeThresholdDefault; 12438 dragStartPosRef.current = { 12439 x: 0, 12440 y: 0 12441 }; 12442 dragOffsetRef.current = { 12443 x: 0, 12444 y: 0 12445 }; 12446 initialTransformRef.current = { 12447 x: 0, 12448 y: 0, 12449 scale: 1 12450 }; 12451 intendedSwipeDirectionRef.current = void 0; 12452 maxSwipeDisplacementRef.current = 0; 12453 cancelledSwipeRef.current = false; 12454 swipeCancelBaselineRef.current = { 12455 x: 0, 12456 y: 0 12457 }; 12458 isFirstPointerMoveRef.current = false; 12459 lastMovePosRef.current = null; 12460 pendingSwipeRef.current = false; 12461 pendingSwipeStartPosRef.current = null; 12462 swipeFromScrollableRef.current = false; 12463 sawPrimaryButtonsOnMoveRef.current = false; 12464 elementSizeRef.current = { 12465 width: 0, 12466 height: 0 12467 }; 12468 swipeStartTimeRef.current = null; 12469 lastDragSampleRef.current = null; 12470 lastDragVelocityRef.current = { 12471 x: 0, 12472 y: 0 12473 }; 12474 lastProgressDetailsRef.current = null; 12475 }, [setSwiping, swipeThresholdDefault, updateSwipeProgress]); 12476 React77.useEffect(() => { 12477 if (typeof swipeThresholdProp !== "function") { 12478 swipeThresholdRef.current = swipeThresholdDefault; 12479 } 12480 }, [swipeThresholdDefault, swipeThresholdProp]); 12481 function getPrimaryPointerPosition(event) { 12482 if ("touches" in event) { 12483 const touch = event.touches[0]; 12484 return touch ? { 12485 x: touch.clientX, 12486 y: touch.clientY 12487 } : null; 12488 } 12489 return { 12490 x: event.clientX, 12491 y: event.clientY 12492 }; 12493 } 12494 function isTouchLikeEvent(event) { 12495 if ("touches" in event) { 12496 return true; 12497 } 12498 return event.pointerType === "touch"; 12499 } 12500 function getTargetAtPoint(position, nativeEvent) { 12501 const doc = ownerDocument(elementRef.current); 12502 const elementAtPoint = getElementAtPoint(doc, position.x, position.y); 12503 const target = elementAtPoint ?? getTarget(nativeEvent); 12504 return target; 12505 } 12506 function findGestureScrollableTouchTarget(target, root) { 12507 if (hasHorizontal && !hasVertical) { 12508 return findScrollableTouchTarget(target, root, "horizontal"); 12509 } 12510 if (hasVertical && !hasHorizontal) { 12511 return findScrollableTouchTarget(target, root, "vertical"); 12512 } 12513 return findScrollableTouchTarget(target, root, "vertical") ?? findScrollableTouchTarget(target, root, "horizontal"); 12514 } 12515 function startSwipeAtPosition(event, position, startOptions) { 12516 swipeFromScrollableRef.current = false; 12517 const touchLike = isTouchLikeEvent(event); 12518 const target = getTargetAtPoint(position, event.nativeEvent); 12519 const doc = ownerDocument(elementRef.current); 12520 const body = doc.body; 12521 const scrollableTarget = touchLike && body ? findGestureScrollableTouchTarget(target, body) : null; 12522 const ignoreScrollableTarget = startOptions?.ignoreScrollableTarget ?? false; 12523 if (scrollableTarget && !ignoreScrollableTarget) { 12524 return false; 12525 } 12526 swipeFromScrollableRef.current = Boolean(scrollableTarget && ignoreScrollableTarget); 12527 const isInteractiveElement2 = target ? target.closest(ignoreSelector) : false; 12528 if (isInteractiveElement2 && (!touchLike || ignoreSelectorWhenTouch)) { 12529 return false; 12530 } 12531 const element = elementRef.current; 12532 if (ignoreScrollableAncestors && element && target && scrollAxes.length > 0) { 12533 const ignoreAncestors = startOptions?.ignoreScrollableAncestors ?? false; 12534 if (!ignoreAncestors && hasScrollableAncestor(target, element, scrollAxes)) { 12535 return false; 12536 } 12537 } 12538 cancelledSwipeRef.current = false; 12539 intendedSwipeDirectionRef.current = void 0; 12540 maxSwipeDisplacementRef.current = 0; 12541 dragStartPosRef.current = position; 12542 swipeStartTimeRef.current = getValidTimeStamp(event.timeStamp); 12543 swipeCancelBaselineRef.current = position; 12544 lastMovePosRef.current = position; 12545 if (element) { 12546 elementSizeRef.current = { 12547 width: element.offsetWidth, 12548 height: element.offsetHeight 12549 }; 12550 resolveSwipeThreshold(primaryDirection); 12551 const transform = getElementTransform(element); 12552 initialTransformRef.current = transform; 12553 dragOffsetRef.current = { 12554 x: transform.x, 12555 y: transform.y 12556 }; 12557 setInitialTransform(transform); 12558 setDragOffset({ 12559 x: transform.x, 12560 y: transform.y 12561 }); 12562 recordDragSample({ 12563 x: transform.x, 12564 y: transform.y 12565 }, swipeStartTimeRef.current); 12566 if (!("touches" in event)) { 12567 safelyChangePointerCapture(element, event.pointerId, "setPointerCapture"); 12568 } 12569 } 12570 onSwipeStart?.(event.nativeEvent); 12571 setSwiping(true); 12572 setIsRealSwipe(false); 12573 setLockedDirection(null); 12574 isFirstPointerMoveRef.current = true; 12575 updateSwipeProgress(0); 12576 return true; 12577 } 12578 function resetPendingSwipeState() { 12579 clearPendingSwipeStartState(); 12580 swipeFromScrollableRef.current = false; 12581 lastMovePosRef.current = null; 12582 } 12583 function clearPendingSwipeStartState() { 12584 pendingSwipeRef.current = false; 12585 pendingSwipeStartPosRef.current = null; 12586 } 12587 function cancelSwipeInteraction(event) { 12588 resetPendingSwipeState(); 12589 if (!isSwipingRef.current) { 12590 return; 12591 } 12592 setSwiping(false); 12593 setIsRealSwipe(false); 12594 setLockedDirection(null); 12595 const resolvedInitialTransform = trackDrag ? initialTransform : initialTransformRef.current; 12596 dragOffsetRef.current = { 12597 x: resolvedInitialTransform.x, 12598 y: resolvedInitialTransform.y 12599 }; 12600 setDragOffset({ 12601 x: resolvedInitialTransform.x, 12602 y: resolvedInitialTransform.y 12603 }); 12604 setCurrentSwipeDirection(void 0); 12605 sawPrimaryButtonsOnMoveRef.current = false; 12606 const element = elementRef.current; 12607 if (element) { 12608 safelyChangePointerCapture(element, event.pointerId, "releasePointerCapture"); 12609 } 12610 updateSwipeProgress(0, { 12611 deltaX: 0, 12612 deltaY: 0, 12613 direction: void 0 12614 }); 12615 onCancel?.(event.nativeEvent); 12616 } 12617 function applyDirectionalDamping(deltaX, deltaY) { 12618 const exponent = (value) => value >= 0 ? value ** 0.5 : -(Math.abs(value) ** 0.5); 12619 const dampAxis = (delta, allowNegative, allowPositive) => { 12620 if (!allowNegative && delta < 0) { 12621 return exponent(delta); 12622 } 12623 if (!allowPositive && delta > 0) { 12624 return exponent(delta); 12625 } 12626 return delta; 12627 }; 12628 const newDeltaX = hasHorizontal ? dampAxis(deltaX, allowLeft, allowRight) : exponent(deltaX); 12629 const newDeltaY = hasVertical ? dampAxis(deltaY, allowUp, allowDown) : exponent(deltaY); 12630 return { 12631 x: newDeltaX, 12632 y: newDeltaY 12633 }; 12634 } 12635 function canSwipeFromScrollEdgeOnPendingMove(scrollTarget, deltaX, deltaY) { 12636 const absDeltaX = Math.abs(deltaX); 12637 const absDeltaY = Math.abs(deltaY); 12638 const useVerticalAxis = hasVertical && deltaY !== 0 && (!hasHorizontal || absDeltaY >= absDeltaX); 12639 if (useVerticalAxis) { 12640 const maxScrollTop = Math.max(0, scrollTarget.scrollHeight - scrollTarget.clientHeight); 12641 const atTop = scrollTarget.scrollTop <= 0; 12642 const atBottom = scrollTarget.scrollTop >= maxScrollTop; 12643 const movingDown = deltaY > 0; 12644 const movingUp = deltaY < 0; 12645 const canSwipeDown = movingDown && atTop && allowDown; 12646 const canSwipeUp = movingUp && atBottom && allowUp; 12647 return canSwipeDown || canSwipeUp; 12648 } 12649 const useHorizontalAxis = hasHorizontal && deltaX !== 0 && (!hasVertical || absDeltaX > absDeltaY); 12650 if (useHorizontalAxis) { 12651 const maxScrollLeft = Math.max(0, scrollTarget.scrollWidth - scrollTarget.clientWidth); 12652 const atLeft = scrollTarget.scrollLeft <= 0; 12653 const atRight = scrollTarget.scrollLeft >= maxScrollLeft; 12654 const movingRight = deltaX > 0; 12655 const movingLeft = deltaX < 0; 12656 const canSwipeRight = movingRight && atLeft && allowRight; 12657 const canSwipeLeft = movingLeft && atRight && allowLeft; 12658 return canSwipeRight || canSwipeLeft; 12659 } 12660 return null; 12661 } 12662 const handleStart = useStableCallback((event) => { 12663 if (!enabled) { 12664 return; 12665 } 12666 if (event.defaultPrevented || event.nativeEvent.defaultPrevented) { 12667 return; 12668 } 12669 if (!("touches" in event) && event.button !== 0) { 12670 return; 12671 } 12672 const startPos = getPrimaryPointerPosition(event); 12673 if (!startPos) { 12674 return; 12675 } 12676 pendingSwipeRef.current = true; 12677 pendingSwipeStartPosRef.current = startPos; 12678 swipeFromScrollableRef.current = false; 12679 sawPrimaryButtonsOnMoveRef.current = false; 12680 const allowedToStart = canStart ? canStart(startPos, { 12681 nativeEvent: event.nativeEvent, 12682 direction: primaryDirection 12683 }) : true; 12684 if (!allowedToStart) { 12685 return; 12686 } 12687 if (startSwipeAtPosition(event, startPos)) { 12688 clearPendingSwipeStartState(); 12689 } 12690 }); 12691 function handleMoveCore(event, position, movement) { 12692 if (!enabled || !isSwipingRef.current) { 12693 return; 12694 } 12695 const target = getTarget(event.nativeEvent); 12696 if (isTouchLikeEvent(event) && !swipeFromScrollableRef.current) { 12697 const boundaryElement = event.currentTarget; 12698 if (findGestureScrollableTouchTarget(target, boundaryElement)) { 12699 return; 12700 } 12701 } 12702 if (!("touches" in event)) { 12703 event.preventDefault(); 12704 } 12705 if (isFirstPointerMoveRef.current) { 12706 dragStartPosRef.current = position; 12707 const moveTime = getValidTimeStamp(event.timeStamp); 12708 if (moveTime !== null) { 12709 swipeStartTimeRef.current = moveTime; 12710 } 12711 isFirstPointerMoveRef.current = false; 12712 } 12713 const clientX = position.x; 12714 const clientY = position.y; 12715 const movementX = movement.x; 12716 const movementY = movement.y; 12717 if (movementY < 0 && clientY > swipeCancelBaselineRef.current.y || movementY > 0 && clientY < swipeCancelBaselineRef.current.y) { 12718 swipeCancelBaselineRef.current = { 12719 x: swipeCancelBaselineRef.current.x, 12720 y: clientY 12721 }; 12722 } 12723 if (movementX < 0 && clientX > swipeCancelBaselineRef.current.x || movementX > 0 && clientX < swipeCancelBaselineRef.current.x) { 12724 swipeCancelBaselineRef.current = { 12725 x: clientX, 12726 y: swipeCancelBaselineRef.current.y 12727 }; 12728 } 12729 const deltaX = clientX - dragStartPosRef.current.x; 12730 const deltaY = clientY - dragStartPosRef.current.y; 12731 const cancelDeltaY = clientY - swipeCancelBaselineRef.current.y; 12732 const cancelDeltaX = clientX - swipeCancelBaselineRef.current.x; 12733 if (!isRealSwipe) { 12734 const movementDistance = Math.sqrt(deltaX * deltaX + deltaY * deltaY); 12735 if (movementDistance >= MIN_DRAG_THRESHOLD) { 12736 setIsRealSwipe(true); 12737 if (lockedDirection === null) { 12738 if (hasHorizontal && hasVertical) { 12739 const absX = Math.abs(deltaX); 12740 const absY = Math.abs(deltaY); 12741 setLockedDirection(absX > absY ? "horizontal" : "vertical"); 12742 } 12743 } 12744 } 12745 } 12746 let candidate; 12747 if (!intendedSwipeDirectionRef.current) { 12748 if (lockedDirection === "vertical") { 12749 if (deltaY > 0) { 12750 candidate = "down"; 12751 } else if (deltaY < 0) { 12752 candidate = "up"; 12753 } 12754 } else if (lockedDirection === "horizontal") { 12755 if (deltaX > 0) { 12756 candidate = "right"; 12757 } else if (deltaX < 0) { 12758 candidate = "left"; 12759 } 12760 } else if (Math.abs(deltaX) >= Math.abs(deltaY)) { 12761 candidate = deltaX > 0 ? "right" : "left"; 12762 } else { 12763 candidate = deltaY > 0 ? "down" : "up"; 12764 } 12765 if (candidate) { 12766 const isAllowed = candidate === "left" && allowLeft || candidate === "right" && allowRight || candidate === "up" && allowUp || candidate === "down" && allowDown; 12767 if (isAllowed) { 12768 intendedSwipeDirectionRef.current = candidate; 12769 maxSwipeDisplacementRef.current = getDisplacement(candidate, deltaX, deltaY); 12770 setCurrentSwipeDirection(candidate); 12771 resolveSwipeThreshold(candidate); 12772 } 12773 } 12774 } else { 12775 const direction = intendedSwipeDirectionRef.current; 12776 const currentDisplacement = getDisplacement(direction, cancelDeltaX, cancelDeltaY); 12777 if (currentDisplacement > swipeThresholdRef.current) { 12778 cancelledSwipeRef.current = false; 12779 setCurrentSwipeDirection(direction); 12780 } else if (!(allowLeft && allowRight) && !(allowUp && allowDown) && maxSwipeDisplacementRef.current - currentDisplacement >= REVERSE_CANCEL_THRESHOLD) { 12781 cancelledSwipeRef.current = true; 12782 } 12783 } 12784 const dampedDelta = applyDirectionalDamping(deltaX, deltaY); 12785 let newOffsetX = initialTransformRef.current.x; 12786 let newOffsetY = initialTransformRef.current.y; 12787 if (lockedDirection === "horizontal") { 12788 if (hasHorizontal) { 12789 newOffsetX += dampedDelta.x; 12790 } 12791 } else if (lockedDirection === "vertical") { 12792 if (hasVertical) { 12793 newOffsetY += dampedDelta.y; 12794 } 12795 } else { 12796 if (hasHorizontal) { 12797 newOffsetX += dampedDelta.x; 12798 } 12799 if (hasVertical) { 12800 newOffsetY += dampedDelta.y; 12801 } 12802 } 12803 dragOffsetRef.current = { 12804 x: newOffsetX, 12805 y: newOffsetY 12806 }; 12807 if (trackDrag) { 12808 setDragOffset({ 12809 x: newOffsetX, 12810 y: newOffsetY 12811 }); 12812 } 12813 recordDragSample({ 12814 x: newOffsetX, 12815 y: newOffsetY 12816 }, getValidTimeStamp(event.timeStamp)); 12817 const dragDeltaX = newOffsetX - initialTransformRef.current.x; 12818 const dragDeltaY = newOffsetY - initialTransformRef.current.y; 12819 const swipeDirectionDetails = intendedSwipeDirectionRef.current; 12820 const progressDirection = primaryDirection ?? intendedSwipeDirectionRef.current; 12821 if (!progressDirection) { 12822 updateSwipeProgress(0, { 12823 deltaX: dragDeltaX, 12824 deltaY: dragDeltaY, 12825 direction: swipeDirectionDetails 12826 }); 12827 return; 12828 } 12829 const size4 = progressDirection === "left" || progressDirection === "right" ? elementSizeRef.current.width : elementSizeRef.current.height; 12830 const scale = initialTransformRef.current.scale || 1; 12831 if (size4 <= 0 || scale <= 0) { 12832 updateSwipeProgress(0, { 12833 deltaX: dragDeltaX, 12834 deltaY: dragDeltaY, 12835 direction: swipeDirectionDetails 12836 }); 12837 return; 12838 } 12839 const progressDisplacement = getDisplacement(progressDirection, newOffsetX - initialTransformRef.current.x, newOffsetY - initialTransformRef.current.y); 12840 if (progressDisplacement <= 0) { 12841 updateSwipeProgress(0, { 12842 deltaX: dragDeltaX, 12843 deltaY: dragDeltaY, 12844 direction: swipeDirectionDetails 12845 }); 12846 return; 12847 } 12848 updateSwipeProgress(progressDisplacement / (size4 * scale), { 12849 deltaX: dragDeltaX, 12850 deltaY: dragDeltaY, 12851 direction: swipeDirectionDetails 12852 }); 12853 } 12854 const handleMove = useStableCallback((event) => { 12855 const currentPos = getPrimaryPointerPosition(event); 12856 if (!currentPos) { 12857 return; 12858 } 12859 if (!("touches" in event)) { 12860 const hasPrimaryButton = hasPrimaryMouseButton(event.buttons); 12861 if (hasPrimaryButton) { 12862 sawPrimaryButtonsOnMoveRef.current = true; 12863 } 12864 const lostPrimaryButtonDuringSwipe = event.buttons === 0 && sawPrimaryButtonsOnMoveRef.current; 12865 if (event.buttons !== 0 && !hasPrimaryButton || lostPrimaryButtonDuringSwipe) { 12866 cancelSwipeInteraction(event); 12867 return; 12868 } 12869 } 12870 if (!isSwiping && pendingSwipeRef.current) { 12871 if (!isTouchLikeEvent(event) && (event.defaultPrevented || event.nativeEvent.defaultPrevented)) { 12872 resetPendingSwipeState(); 12873 return; 12874 } 12875 const allowedToStart = canStart ? canStart(currentPos, { 12876 nativeEvent: event.nativeEvent, 12877 direction: primaryDirection 12878 }) : true; 12879 if (allowedToStart) { 12880 const pendingStartPos = pendingSwipeStartPosRef.current; 12881 let ignoreScrollableOnStart = false; 12882 if (isTouchLikeEvent(event)) { 12883 const element = elementRef.current; 12884 if (pendingStartPos && element) { 12885 const target = getTargetAtPoint(currentPos, event.nativeEvent); 12886 const doc = ownerDocument(element); 12887 const body = doc.body; 12888 const scrollTarget = body ? findGestureScrollableTouchTarget(target, body) : null; 12889 if (scrollTarget && (contains(element, scrollTarget) || contains(scrollTarget, element))) { 12890 const deltaX = currentPos.x - pendingStartPos.x; 12891 const deltaY = currentPos.y - pendingStartPos.y; 12892 const canSwipeFromEdge = canSwipeFromScrollEdgeOnPendingMove(scrollTarget, deltaX, deltaY); 12893 if (canSwipeFromEdge === false) { 12894 return; 12895 } 12896 if (canSwipeFromEdge === true) { 12897 ignoreScrollableOnStart = true; 12898 } 12899 } 12900 } 12901 } 12902 const started = startSwipeAtPosition(event, currentPos, { 12903 ignoreScrollableTarget: ignoreScrollableOnStart, 12904 ignoreScrollableAncestors: ignoreScrollableOnStart 12905 }); 12906 if (started) { 12907 if (pendingStartPos && ignoreScrollableOnStart) { 12908 clearPendingSwipeStartState(); 12909 dragStartPosRef.current = pendingStartPos; 12910 swipeCancelBaselineRef.current = pendingStartPos; 12911 lastMovePosRef.current = pendingStartPos; 12912 isFirstPointerMoveRef.current = false; 12913 } else { 12914 clearPendingSwipeStartState(); 12915 swipeFromScrollableRef.current = false; 12916 } 12917 } 12918 } 12919 } 12920 const previousPos = lastMovePosRef.current; 12921 const movement = previousPos === null ? { 12922 x: 0, 12923 y: 0 12924 } : { 12925 x: currentPos.x - previousPos.x, 12926 y: currentPos.y - previousPos.y 12927 }; 12928 lastMovePosRef.current = currentPos; 12929 handleMoveCore(event, currentPos, movement); 12930 }); 12931 const handleEnd = useStableCallback((event) => { 12932 if (!enabled) { 12933 return; 12934 } 12935 const resolvedDragOffset = dragOffsetRef.current; 12936 const resolvedInitialTransform = initialTransformRef.current; 12937 const releaseDeltaX = resolvedDragOffset.x - resolvedInitialTransform.x; 12938 const releaseDeltaY = resolvedDragOffset.y - resolvedInitialTransform.y; 12939 const progressDetails = { 12940 deltaX: releaseDeltaX, 12941 deltaY: releaseDeltaY, 12942 direction: currentSwipeDirection ?? intendedSwipeDirectionRef.current 12943 }; 12944 if (!isSwipingRef.current) { 12945 resetPendingSwipeState(); 12946 updateSwipeProgress(0, progressDetails); 12947 return; 12948 } 12949 setSwiping(false); 12950 setIsRealSwipe(false); 12951 setLockedDirection(null); 12952 resetPendingSwipeState(); 12953 sawPrimaryButtonsOnMoveRef.current = false; 12954 const element = elementRef.current; 12955 if (element) { 12956 if (!("touches" in event)) { 12957 safelyChangePointerCapture(element, event.pointerId, "releasePointerCapture"); 12958 } 12959 } 12960 const deltaX = releaseDeltaX; 12961 const deltaY = releaseDeltaY; 12962 const startTime = swipeStartTimeRef.current; 12963 const endTime = getValidTimeStamp(event.timeStamp); 12964 const durationMs = startTime !== null && endTime !== null && endTime > startTime ? endTime - startTime : 0; 12965 const velocityDurationMs = durationMs > 0 ? Math.max(durationMs, MIN_VELOCITY_DURATION_MS) : 0; 12966 const velocityX = velocityDurationMs > 0 ? deltaX / velocityDurationMs : 0; 12967 const velocityY = velocityDurationMs > 0 ? deltaY / velocityDurationMs : 0; 12968 let releaseVelocityX = lastDragVelocityRef.current.x; 12969 let releaseVelocityY = lastDragVelocityRef.current.y; 12970 const lastSample = lastDragSampleRef.current; 12971 if (lastSample && endTime !== null && endTime >= lastSample.time) { 12972 const ageMs = endTime - lastSample.time; 12973 if (ageMs <= MAX_RELEASE_VELOCITY_AGE_MS) { 12974 const sampleDurationMs = Math.max(ageMs, MIN_RELEASE_VELOCITY_DURATION_MS); 12975 const deltaFromLastSampleX = resolvedDragOffset.x - lastSample.x; 12976 const deltaFromLastSampleY = resolvedDragOffset.y - lastSample.y; 12977 const sampleVelocityX = deltaFromLastSampleX / sampleDurationMs; 12978 const sampleVelocityY = deltaFromLastSampleY / sampleDurationMs; 12979 if (sampleVelocityX !== 0) { 12980 releaseVelocityX = sampleVelocityX; 12981 } 12982 if (sampleVelocityY !== 0) { 12983 releaseVelocityY = sampleVelocityY; 12984 } 12985 } else { 12986 releaseVelocityX = 0; 12987 releaseVelocityY = 0; 12988 } 12989 } 12990 const releaseDecision = onRelease?.({ 12991 event: event.nativeEvent, 12992 direction: currentSwipeDirection ?? intendedSwipeDirectionRef.current, 12993 deltaX, 12994 deltaY, 12995 velocityX, 12996 velocityY, 12997 releaseVelocityX, 12998 releaseVelocityY 12999 }); 13000 const hasReleaseDecision = typeof releaseDecision === "boolean"; 13001 if (cancelledSwipeRef.current && !hasReleaseDecision) { 13002 dragOffsetRef.current = { 13003 x: resolvedInitialTransform.x, 13004 y: resolvedInitialTransform.y 13005 }; 13006 setDragOffset({ 13007 x: resolvedInitialTransform.x, 13008 y: resolvedInitialTransform.y 13009 }); 13010 setCurrentSwipeDirection(void 0); 13011 updateSwipeProgress(0, progressDetails); 13012 return; 13013 } 13014 let shouldClose = false; 13015 let dismissDirection; 13016 if (hasReleaseDecision) { 13017 shouldClose = releaseDecision; 13018 dismissDirection = currentSwipeDirection ?? intendedSwipeDirectionRef.current ?? primaryDirection; 13019 } else { 13020 for (const direction of directions2) { 13021 switch (direction) { 13022 case "right": 13023 if (deltaX > swipeThresholdRef.current) { 13024 shouldClose = true; 13025 dismissDirection = "right"; 13026 } 13027 break; 13028 case "left": 13029 if (deltaX < -swipeThresholdRef.current) { 13030 shouldClose = true; 13031 dismissDirection = "left"; 13032 } 13033 break; 13034 case "down": 13035 if (deltaY > swipeThresholdRef.current) { 13036 shouldClose = true; 13037 dismissDirection = "down"; 13038 } 13039 break; 13040 case "up": 13041 if (deltaY < -swipeThresholdRef.current) { 13042 shouldClose = true; 13043 dismissDirection = "up"; 13044 } 13045 break; 13046 default: 13047 break; 13048 } 13049 if (shouldClose) { 13050 break; 13051 } 13052 } 13053 } 13054 if (shouldClose && dismissDirection) { 13055 setCurrentSwipeDirection(dismissDirection); 13056 setDragDismissed(true); 13057 onDismiss?.(event.nativeEvent, { 13058 direction: dismissDirection 13059 }); 13060 } else { 13061 dragOffsetRef.current = { 13062 x: resolvedInitialTransform.x, 13063 y: resolvedInitialTransform.y 13064 }; 13065 setDragOffset({ 13066 x: resolvedInitialTransform.x, 13067 y: resolvedInitialTransform.y 13068 }); 13069 setCurrentSwipeDirection(void 0); 13070 updateSwipeProgress(0, progressDetails); 13071 } 13072 }); 13073 const getDragStyles = React77.useCallback(() => { 13074 const resolvedDragOffset = trackDrag ? dragOffset : dragOffsetRef.current; 13075 const resolvedInitialTransform = trackDrag ? initialTransform : initialTransformRef.current; 13076 if (!isSwiping && resolvedDragOffset.x === resolvedInitialTransform.x && resolvedDragOffset.y === resolvedInitialTransform.y && !dragDismissed) { 13077 return { 13078 [movementCssVars.x]: "0px", 13079 [movementCssVars.y]: "0px" 13080 }; 13081 } 13082 const deltaX = resolvedDragOffset.x - resolvedInitialTransform.x; 13083 const deltaY = resolvedDragOffset.y - resolvedInitialTransform.y; 13084 return { 13085 transition: isSwiping ? "none" : void 0, 13086 // While swiping, freeze the element at its current visual transform so it doesn't snap to the 13087 // end position. 13088 transform: isSwiping ? `translateX($resolvedDragOffset.x}px) translateY($resolvedDragOffset.y}px) scale($resolvedInitialTransform.scale})` : void 0, 13089 [movementCssVars.x]: `$deltaX}px`, 13090 [movementCssVars.y]: `$deltaY}px` 13091 }; 13092 }, [dragDismissed, dragOffset, initialTransform, isSwiping, movementCssVars, trackDrag]); 13093 const getPointerProps = React77.useCallback(() => { 13094 if (!enabled) { 13095 return {}; 13096 } 13097 return { 13098 onPointerDown: handleStart, 13099 onPointerMove: handleMove, 13100 onPointerUp: handleEnd, 13101 onPointerCancel: handleEnd 13102 }; 13103 }, [enabled, handleEnd, handleMove, handleStart]); 13104 const getTouchProps = React77.useCallback(() => { 13105 if (!enabled) { 13106 return {}; 13107 } 13108 return { 13109 onTouchStart: handleStart, 13110 onTouchMove: handleMove, 13111 onTouchEnd: handleEnd, 13112 onTouchCancel: handleEnd 13113 }; 13114 }, [enabled, handleEnd, handleMove, handleStart]); 13115 return { 13116 swiping: isSwiping, 13117 swipeDirection: currentSwipeDirection, 13118 dragDismissed, 13119 getPointerProps, 13120 getTouchProps, 13121 getDragStyles, 13122 reset 13123 }; 13124 } 13125 13126 // node_modules/@base-ui/react/esm/drawer/swipe-area/DrawerSwipeAreaDataAttributes.js 13127 var DrawerSwipeAreaDataAttributes = (function(DrawerSwipeAreaDataAttributes2) { 13128 DrawerSwipeAreaDataAttributes2[DrawerSwipeAreaDataAttributes2["open"] = CommonPopupDataAttributes.open] = "open"; 13129 DrawerSwipeAreaDataAttributes2[DrawerSwipeAreaDataAttributes2["closed"] = CommonPopupDataAttributes.closed] = "closed"; 13130 DrawerSwipeAreaDataAttributes2["disabled"] = "data-disabled"; 13131 DrawerSwipeAreaDataAttributes2["swipeDirection"] = "data-swipe-direction"; 13132 DrawerSwipeAreaDataAttributes2["swiping"] = "data-swiping"; 13133 return DrawerSwipeAreaDataAttributes2; 13134 })({}); 13135 13136 // node_modules/@base-ui/react/esm/drawer/swipe-area/DrawerSwipeArea.js 13137 var DEFAULT_SWIPE_OPEN_RATIO = 0.5; 13138 var MIN_SWIPE_START_DISTANCE = 1; 13139 var VELOCITY_THRESHOLD = 0.1; 13140 var FALLBACK_SWIPE_OPEN_THRESHOLD = 40; 13141 var SWIPE_AREA_OPEN_HOOK = { 13142 [DrawerSwipeAreaDataAttributes.open]: "" 13143 }; 13144 var SWIPE_AREA_CLOSED_HOOK = { 13145 [DrawerSwipeAreaDataAttributes.closed]: "" 13146 }; 13147 var SWIPE_AREA_SWIPING_HOOK = { 13148 [DrawerSwipeAreaDataAttributes.swiping]: "" 13149 }; 13150 var SWIPE_AREA_DISABLED_HOOK = { 13151 [DrawerSwipeAreaDataAttributes.disabled]: "" 13152 }; 13153 var stateAttributesMapping9 = { 13154 open(value) { 13155 return value ? SWIPE_AREA_OPEN_HOOK : SWIPE_AREA_CLOSED_HOOK; 13156 }, 13157 swiping(value) { 13158 return value ? SWIPE_AREA_SWIPING_HOOK : null; 13159 }, 13160 swipeDirection(value) { 13161 return value ? { 13162 [DrawerSwipeAreaDataAttributes.swipeDirection]: value 13163 } : null; 13164 }, 13165 disabled(value) { 13166 return value ? SWIPE_AREA_DISABLED_HOOK : null; 13167 } 13168 }; 13169 var oppositeSwipeDirection = { 13170 up: "down", 13171 down: "up", 13172 left: "right", 13173 right: "left" 13174 }; 13175 function resolveTouchAction(direction) { 13176 return direction === "left" || direction === "right" ? "pan-y" : "pan-x"; 13177 } 13178 var DrawerSwipeArea = /* @__PURE__ */ React78.forwardRef(function DrawerSwipeArea2(componentProps, forwardedRef) { 13179 const { 13180 className, 13181 render: render4, 13182 disabled: disabled2 = false, 13183 swipeDirection: swipeDirectionProp, 13184 style, 13185 ...elementProps 13186 } = componentProps; 13187 const { 13188 store 13189 } = useDialogRootContext(); 13190 const { 13191 swipeDirection, 13192 frontmostHeight 13193 } = useDrawerRootContext(); 13194 const providerContext = useDrawerProviderContext(true); 13195 const [swipeActive, setSwipeActive] = React78.useState(false); 13196 const releaseDismissTimeout = useTimeout(); 13197 const swipeAreaRef = React78.useRef(null); 13198 const swipeStartEventRef = React78.useRef(null); 13199 const openedBySwipeRef = React78.useRef(false); 13200 const dragDeltaRef = React78.useRef({ 13201 x: 0, 13202 y: 0 13203 }); 13204 const closedOffsetRef = React78.useRef(null); 13205 const appliedSwipeStylesRef = React78.useRef(false); 13206 const popupTransitionRef = React78.useRef(null); 13207 const swipeAreaId = useBaseUiId(componentProps.id); 13208 const registerTrigger = useTriggerRegistration(swipeAreaId, store); 13209 const open = store.useState("open"); 13210 const resolvedSwipeDirection = swipeDirectionProp ?? oppositeSwipeDirection[swipeDirection]; 13211 const dismissDirection = oppositeSwipeDirection[resolvedSwipeDirection]; 13212 const enabled = !disabled2 && (!open || swipeActive); 13213 const resetDragDelta = useStableCallback(() => { 13214 dragDeltaRef.current.x = 0; 13215 dragDeltaRef.current.y = 0; 13216 }); 13217 function disableDismissForSwipe() { 13218 releaseDismissTimeout.clear(); 13219 store.context.outsidePressEnabledRef.current = false; 13220 } 13221 function enableDismissAfterRelease() { 13222 releaseDismissTimeout.start(0, () => { 13223 store.context.outsidePressEnabledRef.current = true; 13224 }); 13225 } 13226 function resolvePopupSize() { 13227 const popupElement = store.context.popupRef.current; 13228 if (!popupElement) { 13229 return null; 13230 } 13231 const isHorizontal = dismissDirection === "left" || dismissDirection === "right"; 13232 const size4 = isHorizontal ? popupElement.offsetWidth : popupElement.offsetHeight; 13233 if (size4 <= 0) { 13234 return null; 13235 } 13236 return size4; 13237 } 13238 function resolveClosedOffset() { 13239 const offset4 = resolvePopupSize(); 13240 if (offset4 == null) { 13241 return null; 13242 } 13243 const popupElement = store.context.popupRef.current; 13244 if (!popupElement) { 13245 return offset4; 13246 } 13247 const isHorizontal = dismissDirection === "left" || dismissDirection === "right"; 13248 const transform = getElementTransform(popupElement); 13249 const transformOffset = isHorizontal ? transform.x : transform.y; 13250 if (Number.isFinite(transformOffset) && Math.abs(transformOffset) > 0.5) { 13251 return Math.min(offset4, Math.abs(transformOffset)); 13252 } 13253 return offset4; 13254 } 13255 function resolveSwipeOpenThreshold() { 13256 const popupSize = resolvePopupSize(); 13257 if (popupSize == null) { 13258 return FALLBACK_SWIPE_OPEN_THRESHOLD; 13259 } 13260 return popupSize * DEFAULT_SWIPE_OPEN_RATIO; 13261 } 13262 function applySwipeMovement() { 13263 if (!swipeActive) { 13264 return; 13265 } 13266 const popupElement = store.context.popupRef.current; 13267 if (!popupElement) { 13268 return; 13269 } 13270 if (!store.select("open") || !store.select("mounted")) { 13271 return; 13272 } 13273 if (closedOffsetRef.current == null) { 13274 closedOffsetRef.current = resolveClosedOffset(); 13275 } 13276 const closedOffset = closedOffsetRef.current; 13277 if (!closedOffset || !Number.isFinite(closedOffset) || closedOffset <= 0) { 13278 return; 13279 } 13280 const { 13281 x: x2, 13282 y: y2 13283 } = dragDeltaRef.current; 13284 const displacement = getDisplacement(resolvedSwipeDirection, x2, y2); 13285 const clampedDisplacement = Math.max(0, displacement); 13286 const dampedDisplacement = clampedDisplacement > closedOffset ? closedOffset + Math.sqrt(clampedDisplacement - closedOffset) : clampedDisplacement; 13287 const remaining = closedOffset - dampedDisplacement; 13288 const directionSign = dismissDirection === "left" || dismissDirection === "up" ? -1 : 1; 13289 const movement = remaining * directionSign; 13290 const isHorizontal = dismissDirection === "left" || dismissDirection === "right"; 13291 const movementX = isHorizontal ? movement : 0; 13292 const movementY = isHorizontal ? 0 : movement; 13293 const openProgress = Math.max(0, Math.min(1, clampedDisplacement / closedOffset)); 13294 const backdropProgress = Math.max(0, Math.min(1, 1 - openProgress)); 13295 popupElement.style.setProperty(DrawerPopupCssVars.swipeMovementX, `$movementX}px`); 13296 popupElement.style.setProperty(DrawerPopupCssVars.swipeMovementY, `$movementY}px`); 13297 popupElement.setAttribute(DrawerPopupDataAttributes.swiping, ""); 13298 if (popupTransitionRef.current === null) { 13299 popupTransitionRef.current = popupElement.style.transition; 13300 } 13301 popupElement.style.transition = "none"; 13302 const backdropElement = store.context.backdropRef.current; 13303 if (backdropElement) { 13304 backdropElement.setAttribute(DrawerPopupDataAttributes.swiping, ""); 13305 backdropElement.style.setProperty(DrawerBackdropCssVars.swipeProgress, `$backdropProgress}`); 13306 if (openProgress > 0 && frontmostHeight > 0) { 13307 backdropElement.style.setProperty(DrawerPopupCssVars.height, `$frontmostHeight}px`); 13308 } else { 13309 backdropElement.style.removeProperty(DrawerPopupCssVars.height); 13310 } 13311 } 13312 providerContext?.visualStateStore.set({ 13313 swipeProgress: openProgress, 13314 frontmostHeight: openProgress > 0 ? frontmostHeight : 0 13315 }); 13316 appliedSwipeStylesRef.current = true; 13317 } 13318 const clearSwipeStyles = useStableCallback(() => { 13319 const popupElement = store.context.popupRef.current; 13320 if (popupElement && appliedSwipeStylesRef.current) { 13321 popupElement.style.removeProperty(DrawerPopupCssVars.swipeMovementX); 13322 popupElement.style.removeProperty(DrawerPopupCssVars.swipeMovementY); 13323 popupElement.removeAttribute(DrawerPopupDataAttributes.swiping); 13324 } 13325 if (popupElement && popupTransitionRef.current !== null) { 13326 popupElement.style.transition = popupTransitionRef.current; 13327 popupTransitionRef.current = null; 13328 } 13329 const backdropElement = store.context.backdropRef.current; 13330 if (backdropElement) { 13331 backdropElement.removeAttribute(DrawerPopupDataAttributes.swiping); 13332 backdropElement.style.setProperty(DrawerBackdropCssVars.swipeProgress, "0"); 13333 backdropElement.style.removeProperty(DrawerPopupCssVars.height); 13334 } 13335 providerContext?.visualStateStore.set({ 13336 swipeProgress: 0, 13337 frontmostHeight: 0 13338 }); 13339 appliedSwipeStylesRef.current = false; 13340 }); 13341 function openDrawer(event) { 13342 if (store.select("open")) { 13343 return; 13344 } 13345 openedBySwipeRef.current = true; 13346 store.setOpen(true, createChangeEventDetails(reason_parts_exports.swipe, event, swipeAreaRef.current ?? void 0)); 13347 } 13348 function closeDrawer(event) { 13349 if (!store.select("open")) { 13350 return; 13351 } 13352 store.setOpen(false, createChangeEventDetails(reason_parts_exports.swipe, event, swipeAreaRef.current ?? void 0)); 13353 } 13354 function resetSwipeInteractionState() { 13355 swipeStartEventRef.current = null; 13356 openedBySwipeRef.current = false; 13357 closedOffsetRef.current = null; 13358 setSwipeActive(false); 13359 } 13360 function finishSwipeInteraction() { 13361 resetSwipeInteractionState(); 13362 enableDismissAfterRelease(); 13363 resetDragDelta(); 13364 clearSwipeStyles(); 13365 } 13366 const swipe2 = useSwipeDismiss({ 13367 enabled, 13368 directions: [resolvedSwipeDirection], 13369 elementRef: swipeAreaRef, 13370 trackDrag: false, 13371 movementCssVars: { 13372 x: DrawerPopupCssVars.swipeMovementX, 13373 y: DrawerPopupCssVars.swipeMovementY 13374 }, 13375 onSwipeStart(event) { 13376 disableDismissForSwipe(); 13377 swipeStartEventRef.current = event; 13378 openedBySwipeRef.current = false; 13379 setSwipeActive(true); 13380 resetDragDelta(); 13381 }, 13382 onProgress(_progress, details) { 13383 if (!details) { 13384 return; 13385 } 13386 if (!swipeStartEventRef.current) { 13387 return; 13388 } 13389 dragDeltaRef.current.x = details.deltaX; 13390 dragDeltaRef.current.y = details.deltaY; 13391 if (details.direction !== resolvedSwipeDirection) { 13392 return; 13393 } 13394 const displacement = getDisplacement(resolvedSwipeDirection, details.deltaX, details.deltaY); 13395 if (displacement < MIN_SWIPE_START_DISTANCE && !openedBySwipeRef.current) { 13396 return; 13397 } 13398 if (!openedBySwipeRef.current) { 13399 openDrawer(swipeStartEventRef.current); 13400 } 13401 applySwipeMovement(); 13402 }, 13403 onRelease({ 13404 event, 13405 direction, 13406 deltaX, 13407 deltaY, 13408 releaseVelocityX, 13409 releaseVelocityY 13410 }) { 13411 const displacement = getDisplacement(resolvedSwipeDirection, deltaX, deltaY); 13412 const releaseVelocity = getDisplacement(resolvedSwipeDirection, releaseVelocityX, releaseVelocityY); 13413 const threshold = resolveSwipeOpenThreshold(); 13414 const hasEnoughDistance = threshold != null && displacement >= threshold; 13415 const hasEnoughVelocity = releaseVelocity >= VELOCITY_THRESHOLD; 13416 const shouldOpen = threshold != null && direction === resolvedSwipeDirection && (hasEnoughDistance || hasEnoughVelocity) && !disabled2; 13417 if (shouldOpen) { 13418 if (!store.select("open")) { 13419 openDrawer(event); 13420 } 13421 } else if (openedBySwipeRef.current) { 13422 closeDrawer(event); 13423 } 13424 finishSwipeInteraction(); 13425 return false; 13426 }, 13427 onCancel: finishSwipeInteraction 13428 }); 13429 const swipePointerProps = swipe2.getPointerProps(); 13430 const swipeTouchProps = swipe2.getTouchProps(); 13431 const resetSwipe = swipe2.reset; 13432 React78.useEffect(() => { 13433 if (!enabled) { 13434 resetSwipe(); 13435 resetDragDelta(); 13436 clearSwipeStyles(); 13437 resetSwipeInteractionState(); 13438 } 13439 }, [clearSwipeStyles, enabled, resetDragDelta, resetSwipe]); 13440 React78.useEffect(() => { 13441 return () => { 13442 store.context.outsidePressEnabledRef.current = true; 13443 }; 13444 }, [store]); 13445 const state = { 13446 open, 13447 swiping: swipe2.swiping, 13448 swipeDirection: resolvedSwipeDirection, 13449 disabled: disabled2 13450 }; 13451 return useRenderElement("div", componentProps, { 13452 state, 13453 ref: [forwardedRef, swipeAreaRef, registerTrigger], 13454 stateAttributesMapping: stateAttributesMapping9, 13455 props: [{ 13456 role: "presentation", 13457 "aria-hidden": true, 13458 style: { 13459 pointerEvents: !enabled ? "none" : void 0, 13460 touchAction: resolveTouchAction(resolvedSwipeDirection) 13461 }, 13462 onPointerDown(event) { 13463 if (event.pointerType === "touch") { 13464 return; 13465 } 13466 swipePointerProps.onPointerDown?.(event); 13467 if (event.cancelable) { 13468 event.preventDefault(); 13469 } 13470 }, 13471 onPointerMove(event) { 13472 if (event.pointerType === "touch") { 13473 return; 13474 } 13475 swipePointerProps.onPointerMove?.(event); 13476 }, 13477 onPointerUp(event) { 13478 if (event.pointerType === "touch") { 13479 return; 13480 } 13481 swipePointerProps.onPointerUp?.(event); 13482 }, 13483 onPointerCancel(event) { 13484 if (event.pointerType === "touch") { 13485 return; 13486 } 13487 swipePointerProps.onPointerCancel?.(event); 13488 } 13489 }, swipeTouchProps, swipeAreaId ? { 13490 id: swipeAreaId 13491 } : void 0, elementProps] 13492 }); 13493 }); 13494 if (true) DrawerSwipeArea.displayName = "DrawerSwipeArea"; 13495 13496 // node_modules/@base-ui/react/esm/drawer/title/DrawerTitle.js 13497 var DrawerTitle = DialogTitle; 13498 13499 // node_modules/@base-ui/react/esm/drawer/trigger/DrawerTrigger.js 13500 var DrawerTrigger = DialogTrigger; 13501 13502 // node_modules/@base-ui/react/esm/drawer/viewport/DrawerViewport.js 13503 var React79 = __toESM(require_react(), 1); 13504 var ReactDOM6 = __toESM(require_react_dom(), 1); 13505 var import_jsx_runtime16 = __toESM(require_jsx_runtime(), 1); 13506 var MIN_SWIPE_THRESHOLD = 10; 13507 var FAST_SWIPE_VELOCITY = 0.5; 13508 var SNAP_VELOCITY_THRESHOLD = 0.5; 13509 var SNAP_VELOCITY_MULTIPLIER = 300; 13510 var MAX_SNAP_VELOCITY = 4; 13511 var MIN_SWIPE_RELEASE_VELOCITY = 0.2; 13512 var MAX_SWIPE_RELEASE_VELOCITY = 4; 13513 var MIN_SWIPE_RELEASE_DURATION_MS = 80; 13514 var MAX_SWIPE_RELEASE_DURATION_MS = 360; 13515 var MIN_SWIPE_RELEASE_SCALAR = 0.1; 13516 var MAX_SWIPE_RELEASE_SCALAR = 1; 13517 var DRAWER_CONTENT_SELECTOR = `[$DRAWER_CONTENT_ATTRIBUTE}]`; 13518 var DrawerViewport = /* @__PURE__ */ React79.forwardRef(function DrawerViewport2(props, forwardedRef) { 13519 const { 13520 className, 13521 render: render4, 13522 style, 13523 children, 13524 ...elementProps 13525 } = props; 13526 const { 13527 store 13528 } = useDialogRootContext(); 13529 const { 13530 swipeDirection, 13531 notifyParentSwipingChange, 13532 notifyParentSwipeProgressChange, 13533 frontmostHeight, 13534 snapToSequentialPoints 13535 } = useDrawerRootContext(); 13536 const providerContext = useDrawerProviderContext(true); 13537 const visualStateStore = providerContext?.visualStateStore; 13538 const open = store.useState("open"); 13539 const mounted = store.useState("mounted"); 13540 const nested = store.useState("nested"); 13541 const nestedOpenDrawerCount = store.useState("nestedOpenDrawerCount"); 13542 const viewportElement = store.useState("viewportElement"); 13543 const popupElementState = store.useState("popupElement"); 13544 const nestedDrawerOpen = nestedOpenDrawerCount > 0; 13545 const scrollAxis = swipeDirection === "left" || swipeDirection === "right" ? "horizontal" : "vertical"; 13546 const isVerticalScrollAxis = scrollAxis === "vertical"; 13547 const crossScrollAxis = isVerticalScrollAxis ? "horizontal" : "vertical"; 13548 const { 13549 snapPoints, 13550 resolvedSnapPoints, 13551 activeSnapPoint, 13552 activeSnapPointOffset, 13553 setActiveSnapPoint, 13554 popupHeight 13555 } = useDrawerSnapPoints(); 13556 const [swipeRelease, setSwipeRelease] = React79.useState(null); 13557 const pendingSwipeCloseSnapPointRef = React79.useRef(void 0); 13558 const resetSwipeRef = React79.useRef(null); 13559 const controlledDismissFrame = useAnimationFrame(); 13560 const nestedSwipeActiveRef = React79.useRef(false); 13561 const lastPointerTypeRef = React79.useRef(""); 13562 const ignoreNextTouchStartFromPenRef = React79.useRef(false); 13563 const ignoreTouchSwipeRef = React79.useRef(false); 13564 const touchScrollStateRef = React79.useRef(null); 13565 const snapPointRange = React79.useMemo(() => { 13566 if (!snapPoints || snapPoints.length < 2) { 13567 return null; 13568 } 13569 if (swipeDirection !== "down" && swipeDirection !== "up") { 13570 return null; 13571 } 13572 if (resolvedSnapPoints.length < 2) { 13573 return null; 13574 } 13575 const offsets = resolvedSnapPoints.map((point) => point.offset).filter((offset4) => Number.isFinite(offset4)).sort((a2, b2) => a2 - b2); 13576 if (offsets.length < 2) { 13577 return null; 13578 } 13579 const minOffset = offsets[0]; 13580 const nextOffset = offsets[1]; 13581 const maxOffset = offsets[offsets.length - 1]; 13582 let range = nextOffset - minOffset; 13583 if (!Number.isFinite(range) || range <= 0) { 13584 const fallbackRange = maxOffset - minOffset; 13585 if (!Number.isFinite(fallbackRange) || fallbackRange <= 0) { 13586 return null; 13587 } 13588 range = fallbackRange; 13589 } 13590 return { 13591 minOffset, 13592 range 13593 }; 13594 }, [resolvedSnapPoints, snapPoints, swipeDirection]); 13595 const snapPointProgress = React79.useMemo(() => { 13596 if (!snapPointRange || activeSnapPointOffset === null) { 13597 return null; 13598 } 13599 return clamp2((activeSnapPointOffset - snapPointRange.minOffset) / snapPointRange.range, 0, 1); 13600 }, [activeSnapPointOffset, snapPointRange]); 13601 const swipeDirections = React79.useMemo(() => { 13602 if (snapPoints && snapPoints.length > 0 && (swipeDirection === "down" || swipeDirection === "up")) { 13603 return swipeDirection === "down" ? ["down", "up"] : ["up", "down"]; 13604 } 13605 return [swipeDirection]; 13606 }, [snapPoints, swipeDirection]); 13607 const setSwipeDismissed = useStableCallback((dismissed) => { 13608 setSwipeDismissedElements(store.context.popupRef.current, store.context.backdropRef.current, dismissed); 13609 }); 13610 const clearSwipeRelease = useStableCallback(() => { 13611 setSwipeDismissed(false); 13612 store.context.popupRef.current?.removeAttribute(TransitionStatusDataAttributes.endingStyle); 13613 setSwipeRelease(null); 13614 }); 13615 const finishNestedSwipe = useStableCallback(() => { 13616 if (!nestedSwipeActiveRef.current) { 13617 return; 13618 } 13619 nestedSwipeActiveRef.current = false; 13620 notifyParentSwipingChange?.(false); 13621 }); 13622 const applySwipeProgress = useStableCallback(({ 13623 resolvedProgress, 13624 shouldTrackProgress, 13625 notifyParent 13626 }) => { 13627 const isActive = open && !nested && shouldTrackProgress; 13628 const swipeProgress = isActive ? resolvedProgress : 0; 13629 const nestedSwipeProgress = open && shouldTrackProgress ? resolvedProgress : 0; 13630 if (notifyParent && notifyParentSwipeProgressChange) { 13631 notifyParentSwipeProgressChange(nestedSwipeProgress); 13632 if (nestedSwipeProgress <= 0) { 13633 finishNestedSwipe(); 13634 } 13635 } 13636 visualStateStore?.set({ 13637 swipeProgress, 13638 frontmostHeight: swipeProgress > 0 ? frontmostHeight : 0 13639 }); 13640 const backdropElement = store.context.backdropRef.current; 13641 if (!backdropElement) { 13642 return; 13643 } 13644 if (!isActive || swipeProgress <= 0) { 13645 backdropElement.style.setProperty(DrawerBackdropCssVars.swipeProgress, "0"); 13646 backdropElement.style.removeProperty(DrawerPopupCssVars.height); 13647 return; 13648 } 13649 backdropElement.style.setProperty(DrawerBackdropCssVars.swipeProgress, `$swipeProgress}`); 13650 if (frontmostHeight > 0) { 13651 backdropElement.style.setProperty(DrawerPopupCssVars.height, `$frontmostHeight}px`); 13652 } else { 13653 backdropElement.style.removeProperty(DrawerPopupCssVars.height); 13654 } 13655 }); 13656 function resolveSwipeRelease({ 13657 direction, 13658 deltaX, 13659 deltaY, 13660 velocityX, 13661 velocityY, 13662 releaseVelocityX, 13663 releaseVelocityY 13664 }) { 13665 if (!direction) { 13666 return null; 13667 } 13668 const popupElement = store.context.popupRef.current; 13669 if (!popupElement) { 13670 return null; 13671 } 13672 const size4 = direction === "left" || direction === "right" ? popupElement.offsetWidth : popupElement.offsetHeight; 13673 if (!Number.isFinite(size4) || size4 <= 0) { 13674 return null; 13675 } 13676 const axisDelta = direction === "left" || direction === "right" ? deltaX : deltaY; 13677 const snapPointBaseOffset = snapPoints && snapPoints.length > 0 ? activeSnapPointOffset ?? 0 : 0; 13678 let baseOffset = 0; 13679 if (direction === "down") { 13680 baseOffset = snapPointBaseOffset; 13681 } else if (direction === "up") { 13682 baseOffset = -snapPointBaseOffset; 13683 } 13684 const translation = baseOffset + axisDelta; 13685 const translationAlongDirection = direction === "left" || direction === "up" ? -translation : translation; 13686 const remainingDistance = Math.max(0, size4 - translationAlongDirection); 13687 if (!Number.isFinite(remainingDistance) || remainingDistance <= 0) { 13688 return null; 13689 } 13690 const axisVelocity = direction === "left" || direction === "right" ? releaseVelocityX : releaseVelocityY; 13691 const fallbackVelocity = direction === "left" || direction === "right" ? velocityX : velocityY; 13692 const resolvedVelocity = Math.abs(axisVelocity) > 0 && Number.isFinite(axisVelocity) ? axisVelocity : fallbackVelocity; 13693 const directionalVelocity = direction === "left" || direction === "up" ? -resolvedVelocity : resolvedVelocity; 13694 if (!Number.isFinite(directionalVelocity) || directionalVelocity <= MIN_SWIPE_RELEASE_VELOCITY) { 13695 return null; 13696 } 13697 const clampedVelocity = clamp2(directionalVelocity, MIN_SWIPE_RELEASE_VELOCITY, MAX_SWIPE_RELEASE_VELOCITY); 13698 const durationMs = clamp2(remainingDistance / clampedVelocity, MIN_SWIPE_RELEASE_DURATION_MS, MAX_SWIPE_RELEASE_DURATION_MS); 13699 if (!Number.isFinite(durationMs)) { 13700 return null; 13701 } 13702 const normalizedDuration = (durationMs - MIN_SWIPE_RELEASE_DURATION_MS) / (MAX_SWIPE_RELEASE_DURATION_MS - MIN_SWIPE_RELEASE_DURATION_MS); 13703 const durationScalar = clamp2(MIN_SWIPE_RELEASE_SCALAR + normalizedDuration * (MAX_SWIPE_RELEASE_SCALAR - MIN_SWIPE_RELEASE_SCALAR), MIN_SWIPE_RELEASE_SCALAR, MAX_SWIPE_RELEASE_SCALAR); 13704 if (!Number.isFinite(durationScalar) || durationScalar <= 0) { 13705 return null; 13706 } 13707 return durationScalar; 13708 } 13709 function updateNestedSwipeActive(details) { 13710 if (nestedSwipeActiveRef.current || !details) { 13711 return; 13712 } 13713 const direction = details.direction ?? swipeDirection; 13714 const delta = direction === "left" || direction === "right" ? details.deltaX : details.deltaY; 13715 if (!Number.isFinite(delta) || Math.abs(delta) < MIN_SWIPE_THRESHOLD) { 13716 return; 13717 } 13718 nestedSwipeActiveRef.current = true; 13719 notifyParentSwipingChange?.(true); 13720 } 13721 const swipe2 = useSwipeDismiss({ 13722 enabled: mounted && !nestedDrawerOpen, 13723 directions: swipeDirections, 13724 elementRef: store.context.popupRef, 13725 ignoreSelectorWhenTouch: false, 13726 ignoreScrollableAncestors: true, 13727 movementCssVars: { 13728 x: DrawerPopupCssVars.swipeMovementX, 13729 y: DrawerPopupCssVars.swipeMovementY 13730 }, 13731 onSwipeStart(event) { 13732 if ("touches" in event || "pointerType" in event && event.pointerType === "touch") { 13733 return; 13734 } 13735 const popupElement = store.context.popupRef.current; 13736 if (!popupElement) { 13737 return; 13738 } 13739 const doc = ownerDocument(popupElement); 13740 const selection = doc.getSelection?.(); 13741 if (!selection || selection.isCollapsed) { 13742 return; 13743 } 13744 const anchorElement = isElement(selection.anchorNode) ? selection.anchorNode : selection.anchorNode?.parentElement; 13745 const focusElement = isElement(selection.focusNode) ? selection.focusNode : selection.focusNode?.parentElement; 13746 if (!contains(popupElement, anchorElement) && !contains(popupElement, focusElement)) { 13747 return; 13748 } 13749 selection.removeAllRanges(); 13750 }, 13751 onSwipingChange(swiping) { 13752 setBackdropSwipingAttribute(store.context.backdropRef.current, swiping); 13753 if (!swiping && !notifyParentSwipeProgressChange) { 13754 finishNestedSwipe(); 13755 } 13756 }, 13757 swipeThreshold({ 13758 element, 13759 direction 13760 }) { 13761 return getBaseSwipeThreshold(element, direction); 13762 }, 13763 canStart(position, details) { 13764 const popupElement = store.context.popupRef.current; 13765 if (!popupElement) { 13766 return false; 13767 } 13768 const doc = popupElement.ownerDocument; 13769 const elementAtPoint = getElementAtPoint(doc, position.x, position.y); 13770 if (!elementAtPoint || !contains(popupElement, elementAtPoint)) { 13771 return false; 13772 } 13773 const nativeEvent = details.nativeEvent; 13774 const touchLike = "touches" in nativeEvent || "pointerType" in nativeEvent && nativeEvent.pointerType === "touch"; 13775 if (touchLike && shouldIgnoreSwipeForTextSelection(doc, popupElement)) { 13776 return false; 13777 } 13778 if (nativeEvent.type === "touchstart" && isSwipeIgnoredTarget(elementAtPoint)) { 13779 return false; 13780 } 13781 return true; 13782 }, 13783 onProgress(progress, details) { 13784 updateNestedSwipeActive(details); 13785 const currentDirection = details?.direction ?? swipe2.swipeDirection; 13786 const isDismissSwipe = currentDirection === void 0 || currentDirection === swipeDirection; 13787 const hasSnapPoints = Boolean(snapPoints && snapPoints.length > 0); 13788 const isVerticalSwipe = swipeDirection === "down" || swipeDirection === "up"; 13789 const shouldTrackProgress = hasSnapPoints && isVerticalSwipe || !hasSnapPoints || swipeDirection === "left" || swipeDirection === "right" || isDismissSwipe; 13790 let resolvedProgress = progress; 13791 if (snapPointRange && popupHeight > 0) { 13792 if (details && Number.isFinite(details.deltaY)) { 13793 const baseOffset = activeSnapPointOffset ?? snapPointRange.minOffset; 13794 const nextOffset = clamp2(baseOffset + details.deltaY, 0, popupHeight); 13795 resolvedProgress = clamp2((nextOffset - snapPointRange.minOffset) / snapPointRange.range, 0, 1); 13796 } else if (snapPointProgress !== null) { 13797 resolvedProgress = snapPointProgress; 13798 } else if (currentDirection === "down" || currentDirection === "up") { 13799 const displacement = progress * popupHeight; 13800 const baseOffset = activeSnapPointOffset ?? snapPointRange.minOffset; 13801 const nextOffset = currentDirection === "down" ? baseOffset + displacement : baseOffset - displacement; 13802 resolvedProgress = clamp2((nextOffset - snapPointRange.minOffset) / snapPointRange.range, 0, 1); 13803 } 13804 } 13805 applySwipeProgress({ 13806 resolvedProgress, 13807 shouldTrackProgress, 13808 notifyParent: true 13809 }); 13810 }, 13811 onRelease({ 13812 event, 13813 deltaX, 13814 deltaY, 13815 direction, 13816 velocityX, 13817 velocityY, 13818 releaseVelocityX, 13819 releaseVelocityY 13820 }) { 13821 const swipeReleasePayload = { 13822 deltaX, 13823 deltaY, 13824 velocityX, 13825 velocityY, 13826 releaseVelocityX, 13827 releaseVelocityY 13828 }; 13829 function startSwipeRelease(resolvedDirection) { 13830 const popupElement = store.context.popupRef.current; 13831 if (!popupElement) { 13832 return; 13833 } 13834 finishNestedSwipe(); 13835 setSwipeDismissed(true); 13836 popupElement.style.removeProperty("transition"); 13837 popupElement.setAttribute(TransitionStatusDataAttributes.endingStyle, ""); 13838 ReactDOM6.flushSync(() => { 13839 setSwipeRelease(resolveSwipeRelease({ 13840 direction: resolvedDirection, 13841 ...swipeReleasePayload 13842 })); 13843 }); 13844 } 13845 if (!snapPoints || snapPoints.length === 0) { 13846 if (!direction) { 13847 clearSwipeRelease(); 13848 return void 0; 13849 } 13850 const element = store.context.popupRef.current; 13851 if (!element) { 13852 clearSwipeRelease(); 13853 return void 0; 13854 } 13855 const baseThreshold = getBaseSwipeThreshold(element, direction); 13856 const delta = direction === "left" || direction === "right" ? deltaX : deltaY; 13857 if (!Number.isFinite(delta)) { 13858 clearSwipeRelease(); 13859 return void 0; 13860 } 13861 const directionalDelta = direction === "left" || direction === "up" ? -delta : delta; 13862 if (directionalDelta <= 0) { 13863 clearSwipeRelease(); 13864 return false; 13865 } 13866 const velocity = direction === "left" || direction === "right" ? velocityX : velocityY; 13867 const directionalVelocity = direction === "left" || direction === "up" ? -velocity : velocity; 13868 if (directionalVelocity >= FAST_SWIPE_VELOCITY && directionalDelta > 0) { 13869 startSwipeRelease(direction); 13870 return true; 13871 } 13872 const shouldClose = directionalDelta > baseThreshold; 13873 if (shouldClose) { 13874 startSwipeRelease(direction); 13875 } else { 13876 clearSwipeRelease(); 13877 } 13878 return shouldClose; 13879 } 13880 if (swipeDirection !== "down" && swipeDirection !== "up") { 13881 clearSwipeRelease(); 13882 return void 0; 13883 } 13884 if (!popupHeight || resolvedSnapPoints.length === 0) { 13885 clearSwipeRelease(); 13886 return void 0; 13887 } 13888 const dragDelta = swipeDirection === "down" ? deltaY : -deltaY; 13889 if (!Number.isFinite(dragDelta)) { 13890 clearSwipeRelease(); 13891 return void 0; 13892 } 13893 const dragDirection = Math.sign(dragDelta); 13894 const releaseDirectionalVelocity = swipeDirection === "down" ? releaseVelocityY : -releaseVelocityY; 13895 const fallbackDirectionalVelocity = swipeDirection === "down" ? velocityY : -velocityY; 13896 let resolvedDirectionalVelocity = Number.isFinite(releaseDirectionalVelocity) ? releaseDirectionalVelocity : fallbackDirectionalVelocity; 13897 if (dragDirection !== 0 && Math.abs(dragDelta) >= MIN_SWIPE_THRESHOLD && Number.isFinite(resolvedDirectionalVelocity)) { 13898 const velocityDirection = Math.sign(resolvedDirectionalVelocity); 13899 if (velocityDirection !== 0 && velocityDirection !== dragDirection) { 13900 resolvedDirectionalVelocity = fallbackDirectionalVelocity; 13901 } 13902 } 13903 const currentOffset = activeSnapPointOffset ?? 0; 13904 const dragTargetOffset = clamp2(currentOffset + dragDelta, 0, popupHeight); 13905 const velocityOffset = Number.isFinite(resolvedDirectionalVelocity) && Math.abs(resolvedDirectionalVelocity) >= SNAP_VELOCITY_THRESHOLD ? clamp2(resolvedDirectionalVelocity, -MAX_SNAP_VELOCITY, MAX_SNAP_VELOCITY) * SNAP_VELOCITY_MULTIPLIER : 0; 13906 const targetOffset = snapToSequentialPoints ? dragTargetOffset : clamp2(dragTargetOffset + velocityOffset, 0, popupHeight); 13907 const snapPointEventDetails = createChangeEventDetails(reason_parts_exports.swipe, event); 13908 const closeFromSnapPoints = () => { 13909 pendingSwipeCloseSnapPointRef.current = activeSnapPoint; 13910 setActiveSnapPoint?.(null, snapPointEventDetails); 13911 startSwipeRelease(swipeDirection); 13912 return true; 13913 }; 13914 if (snapToSequentialPoints) { 13915 const orderedSnapPoints = [...resolvedSnapPoints].sort((first, second) => first.offset - second.offset); 13916 if (orderedSnapPoints.length === 0) { 13917 clearSwipeRelease(); 13918 return false; 13919 } 13920 let currentIndex = 0; 13921 let closestDistance2 = Math.abs(currentOffset - orderedSnapPoints[0].offset); 13922 for (let index2 = 1; index2 < orderedSnapPoints.length; index2 += 1) { 13923 const distance = Math.abs(currentOffset - orderedSnapPoints[index2].offset); 13924 if (distance < closestDistance2) { 13925 closestDistance2 = distance; 13926 currentIndex = index2; 13927 } 13928 } 13929 let targetSnapPoint = orderedSnapPoints[0]; 13930 closestDistance2 = Math.abs(targetOffset - targetSnapPoint.offset); 13931 for (const snapPoint of orderedSnapPoints) { 13932 const distance = Math.abs(targetOffset - snapPoint.offset); 13933 if (distance < closestDistance2) { 13934 closestDistance2 = distance; 13935 targetSnapPoint = snapPoint; 13936 } 13937 } 13938 const velocityDirection = Math.sign(resolvedDirectionalVelocity); 13939 const shouldAdvance = dragDirection !== 0 && velocityDirection !== 0 && velocityDirection === dragDirection && Math.abs(resolvedDirectionalVelocity) >= SNAP_VELOCITY_THRESHOLD; 13940 let effectiveTargetOffset = targetOffset; 13941 if (shouldAdvance) { 13942 const adjacentIndex = clamp2(currentIndex + dragDirection, 0, orderedSnapPoints.length - 1); 13943 if (adjacentIndex !== currentIndex) { 13944 const adjacentPoint = orderedSnapPoints[adjacentIndex]; 13945 const shouldForceAdjacent = dragDirection > 0 ? targetOffset < adjacentPoint.offset : targetOffset > adjacentPoint.offset; 13946 if (shouldForceAdjacent) { 13947 targetSnapPoint = adjacentPoint; 13948 effectiveTargetOffset = adjacentPoint.offset; 13949 } 13950 } else if (dragDirection > 0) { 13951 return closeFromSnapPoints(); 13952 } 13953 } 13954 const closeOffset2 = popupHeight; 13955 const closeDistance2 = Math.abs(effectiveTargetOffset - closeOffset2); 13956 const snapDistance = Math.abs(effectiveTargetOffset - targetSnapPoint.offset); 13957 if (closeDistance2 < snapDistance) { 13958 return closeFromSnapPoints(); 13959 } 13960 setActiveSnapPoint?.(targetSnapPoint.value, snapPointEventDetails); 13961 clearSwipeRelease(); 13962 return false; 13963 } 13964 if (resolvedDirectionalVelocity >= FAST_SWIPE_VELOCITY && dragDelta > 0) { 13965 return closeFromSnapPoints(); 13966 } 13967 let closestSnapPoint = resolvedSnapPoints[0]; 13968 let closestDistance = Math.abs(targetOffset - closestSnapPoint.offset); 13969 for (const snapPoint of resolvedSnapPoints) { 13970 const distance = Math.abs(targetOffset - snapPoint.offset); 13971 if (distance < closestDistance) { 13972 closestDistance = distance; 13973 closestSnapPoint = snapPoint; 13974 } 13975 } 13976 const closeOffset = popupHeight; 13977 const closeDistance = Math.abs(targetOffset - closeOffset); 13978 if (closeDistance < closestDistance) { 13979 return closeFromSnapPoints(); 13980 } 13981 setActiveSnapPoint?.(closestSnapPoint.value, snapPointEventDetails); 13982 clearSwipeRelease(); 13983 return false; 13984 }, 13985 onDismiss(event) { 13986 visualStateStore?.set({ 13987 swipeProgress: 0, 13988 frontmostHeight: 0 13989 }); 13990 const backdropElement = store.context.backdropRef.current; 13991 if (backdropElement) { 13992 backdropElement.style.setProperty(DrawerBackdropCssVars.swipeProgress, "0"); 13993 backdropElement.style.removeProperty(DrawerPopupCssVars.height); 13994 } 13995 const dismissEventDetails = createChangeEventDetails(reason_parts_exports.swipe, event); 13996 store.setOpen(false, dismissEventDetails); 13997 if (dismissEventDetails.isCanceled) { 13998 const pendingSnapPoint = pendingSwipeCloseSnapPointRef.current; 13999 if (pendingSnapPoint !== void 0) { 14000 setActiveSnapPoint?.(pendingSnapPoint, createChangeEventDetails(reason_parts_exports.swipe, event)); 14001 } 14002 pendingSwipeCloseSnapPointRef.current = void 0; 14003 resetSwipeRef.current?.(); 14004 clearSwipeRelease(); 14005 return; 14006 } 14007 if (store.select("open")) { 14008 const savedEvent = event; 14009 controlledDismissFrame.request(() => { 14010 if (store.select("open")) { 14011 const pendingSnapPoint = pendingSwipeCloseSnapPointRef.current; 14012 if (pendingSnapPoint !== void 0) { 14013 setActiveSnapPoint?.(pendingSnapPoint, createChangeEventDetails(reason_parts_exports.swipe, savedEvent)); 14014 } 14015 pendingSwipeCloseSnapPointRef.current = void 0; 14016 clearSwipeRelease(); 14017 resetSwipeRef.current?.(); 14018 } else { 14019 pendingSwipeCloseSnapPointRef.current = void 0; 14020 } 14021 }); 14022 return; 14023 } 14024 pendingSwipeCloseSnapPointRef.current = void 0; 14025 setSwipeDismissed(true); 14026 } 14027 }); 14028 const swipePointerProps = swipe2.getPointerProps(); 14029 const swipeTouchProps = swipe2.getTouchProps(); 14030 const resetSwipe = swipe2.reset; 14031 resetSwipeRef.current = resetSwipe; 14032 React79.useEffect(() => { 14033 const rootElement = viewportElement ?? popupElementState; 14034 if (!rootElement) { 14035 return void 0; 14036 } 14037 const resolvedRootElement = rootElement; 14038 const doc = ownerDocument(resolvedRootElement); 14039 const win = getWindow(doc); 14040 function handleNativeTouchMove(event) { 14041 if (ignoreTouchSwipeRef.current) { 14042 return; 14043 } 14044 const touchState = touchScrollStateRef.current; 14045 const touch = event.touches[0]; 14046 if (!touch || !touchState) { 14047 return; 14048 } 14049 const drawerAxisDelta = isVerticalScrollAxis ? touch.clientY - touchState.lastY : touch.clientX - touchState.lastX; 14050 if (isEventOnRangeInput(event, win)) { 14051 touchState.allowSwipe = false; 14052 updateTouchScrollPosition(touchState, touch); 14053 return; 14054 } 14055 if (event.touches.length === 2) { 14056 updateTouchScrollPosition(touchState, touch); 14057 return; 14058 } 14059 const allowTouchMove = shouldIgnoreSwipeForTextSelection(doc, resolvedRootElement); 14060 if (allowTouchMove || !open || !mounted || nestedDrawerOpen) { 14061 updateTouchScrollPosition(touchState, touch); 14062 return; 14063 } 14064 if (preserveNativeCrossAxisScrollOnMove(touchState, touch, isVerticalScrollAxis)) { 14065 updateTouchScrollPosition(touchState, touch); 14066 return; 14067 } 14068 const scrollTarget = touchState.scrollTarget; 14069 if (!scrollTarget || scrollTarget === doc.documentElement || scrollTarget === doc.body) { 14070 if (event.cancelable) { 14071 event.preventDefault(); 14072 } 14073 updateTouchScrollPosition(touchState, touch); 14074 return; 14075 } 14076 const hasScrollableContent = hasScrollableContentOnAxis(scrollTarget, scrollAxis); 14077 if (!hasScrollableContent) { 14078 if (event.cancelable) { 14079 event.preventDefault(); 14080 } 14081 updateTouchScrollPosition(touchState, touch); 14082 return; 14083 } 14084 const delta = drawerAxisDelta; 14085 if (delta !== 0) { 14086 const canSwipeFromScrollEdge = canSwipeFromScrollEdgeOnMove(scrollTarget, scrollAxis, swipeDirection, delta); 14087 if (!touchState.allowSwipe) { 14088 if (!event.cancelable) { 14089 touchState.allowSwipe = false; 14090 } else if (canSwipeFromScrollEdge) { 14091 touchState.allowSwipe = true; 14092 event.preventDefault(); 14093 } else { 14094 touchState.allowSwipe = false; 14095 } 14096 } else if (event.cancelable) { 14097 event.preventDefault(); 14098 } 14099 } 14100 updateTouchScrollPosition(touchState, touch); 14101 } 14102 return addEventListener(doc, "touchmove", handleNativeTouchMove, { 14103 passive: false, 14104 capture: true 14105 }); 14106 }, [mounted, nestedDrawerOpen, open, popupElementState, isVerticalScrollAxis, scrollAxis, swipeDirection, viewportElement]); 14107 React79.useEffect(() => { 14108 if (!snapPointRange || swipe2.swiping) { 14109 return; 14110 } 14111 const resolvedProgress = !open || nested ? 0 : snapPointProgress ?? 0; 14112 applySwipeProgress({ 14113 resolvedProgress, 14114 shouldTrackProgress: true, 14115 notifyParent: false 14116 }); 14117 }, [applySwipeProgress, frontmostHeight, nested, notifyParentSwipeProgressChange, open, snapPointProgress, snapPointRange, swipe2.swiping, store, visualStateStore]); 14118 React79.useEffect(() => { 14119 if (!notifyParentSwipeProgressChange) { 14120 return void 0; 14121 } 14122 if (!open) { 14123 notifyParentSwipeProgressChange(0); 14124 } 14125 return () => { 14126 notifyParentSwipeProgressChange(0); 14127 }; 14128 }, [notifyParentSwipeProgressChange, open]); 14129 React79.useEffect(() => { 14130 if (open) { 14131 resetSwipe(); 14132 clearSwipeRelease(); 14133 } 14134 }, [clearSwipeRelease, open, resetSwipe]); 14135 React79.useEffect(() => { 14136 return () => { 14137 visualStateStore?.set({ 14138 swipeProgress: 0, 14139 frontmostHeight: 0 14140 }); 14141 setBackdropSwipingAttribute(store.context.backdropRef.current, false); 14142 finishNestedSwipe(); 14143 }; 14144 }, [finishNestedSwipe, store, visualStateStore]); 14145 const swipeProviderValue = React79.useMemo(() => ({ 14146 swiping: swipe2.swiping, 14147 getDragStyles: swipe2.getDragStyles, 14148 swipeStrength: swipeRelease ?? null, 14149 setSwipeDismissed(dismissed) { 14150 setSwipeDismissedElements(store.context.popupRef.current, store.context.backdropRef.current, dismissed); 14151 } 14152 }), [store, swipe2.getDragStyles, swipe2.swiping, swipeRelease]); 14153 function resetTouchTrackingState() { 14154 ignoreTouchSwipeRef.current = false; 14155 touchScrollStateRef.current = null; 14156 lastPointerTypeRef.current = ""; 14157 ignoreNextTouchStartFromPenRef.current = false; 14158 } 14159 return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(DialogViewport, { 14160 ref: forwardedRef, 14161 className, 14162 render: render4, 14163 ...mergeProps(elementProps, { 14164 onPointerDown(event) { 14165 lastPointerTypeRef.current = event.pointerType; 14166 ignoreNextTouchStartFromPenRef.current = event.pointerType === "pen"; 14167 if (!open || !mounted || nestedDrawerOpen) { 14168 return; 14169 } 14170 const doc = ownerDocument(event.currentTarget); 14171 const elementAtPoint = getElementAtPoint(doc, event.clientX, event.clientY); 14172 if (isSwipeIgnoredTarget(elementAtPoint) || isDrawerContentTarget(elementAtPoint)) { 14173 return; 14174 } 14175 if (event.pointerType === "touch") { 14176 return; 14177 } 14178 swipePointerProps.onPointerDown?.(event); 14179 }, 14180 onPointerMove(event) { 14181 if (event.pointerType === "touch") { 14182 return; 14183 } 14184 swipePointerProps.onPointerMove?.(event); 14185 }, 14186 onPointerUp(event) { 14187 if (lastPointerTypeRef.current === event.pointerType) { 14188 lastPointerTypeRef.current = ""; 14189 } 14190 if (event.pointerType === "touch") { 14191 return; 14192 } 14193 swipePointerProps.onPointerUp?.(event); 14194 }, 14195 onPointerCancel(event) { 14196 if (lastPointerTypeRef.current === event.pointerType) { 14197 lastPointerTypeRef.current = ""; 14198 } 14199 if (event.pointerType === "touch") { 14200 return; 14201 } 14202 swipePointerProps.onPointerCancel?.(event); 14203 }, 14204 onTouchStart(event) { 14205 const startedFromPenPointerDown = lastPointerTypeRef.current === "pen" && ignoreNextTouchStartFromPenRef.current; 14206 if (startedFromPenPointerDown) { 14207 ignoreNextTouchStartFromPenRef.current = false; 14208 ignoreTouchSwipeRef.current = false; 14209 touchScrollStateRef.current = null; 14210 return; 14211 } 14212 if (!open || !mounted || nestedDrawerOpen) { 14213 ignoreTouchSwipeRef.current = false; 14214 touchScrollStateRef.current = null; 14215 return; 14216 } 14217 const touch = event.touches[0]; 14218 if (!touch) { 14219 return; 14220 } 14221 if (isReactTouchEventOnRangeInput(event)) { 14222 ignoreTouchSwipeRef.current = false; 14223 touchScrollStateRef.current = null; 14224 return; 14225 } 14226 const doc = ownerDocument(event.currentTarget); 14227 const elementAtPoint = getElementAtPoint(doc, touch.clientX, touch.clientY); 14228 ignoreTouchSwipeRef.current = isSwipeIgnoredTarget(elementAtPoint); 14229 if (ignoreTouchSwipeRef.current) { 14230 touchScrollStateRef.current = null; 14231 return; 14232 } 14233 const rootElement = viewportElement ?? popupElementState; 14234 const eventTarget = getTarget(event.nativeEvent); 14235 const target = isElement(eventTarget) ? eventTarget : null; 14236 if (rootElement && target && !contains(rootElement, target)) { 14237 ignoreTouchSwipeRef.current = true; 14238 touchScrollStateRef.current = null; 14239 return; 14240 } 14241 let scrollTarget = null; 14242 let hasCrossAxisScrollableContent = false; 14243 if (rootElement && target) { 14244 scrollTarget = findScrollableTouchTarget(target, rootElement, scrollAxis); 14245 hasCrossAxisScrollableContent = findScrollableTouchTarget(target, rootElement, crossScrollAxis) != null; 14246 } 14247 let allowSwipe = null; 14248 if (scrollTarget) { 14249 const canSwipeFromEdge = isAtSwipeStartEdge(scrollTarget, scrollAxis, swipeDirection); 14250 allowSwipe = canSwipeFromEdge ? null : false; 14251 } 14252 touchScrollStateRef.current = { 14253 startX: touch.clientX, 14254 startY: touch.clientY, 14255 lastX: touch.clientX, 14256 lastY: touch.clientY, 14257 scrollTarget, 14258 hasCrossAxisScrollableContent, 14259 allowSwipe, 14260 preserveNativeCrossAxisScroll: false 14261 }; 14262 swipeTouchProps.onTouchStart?.(event); 14263 }, 14264 onTouchMove(event) { 14265 if (ignoreTouchSwipeRef.current) { 14266 return; 14267 } 14268 if (isReactTouchEventOnRangeInput(event)) { 14269 return; 14270 } 14271 const touchState = touchScrollStateRef.current; 14272 if (touchState?.preserveNativeCrossAxisScroll) { 14273 return; 14274 } 14275 if (touchState?.allowSwipe === false || touchState?.scrollTarget != null && !touchState.allowSwipe) { 14276 return; 14277 } 14278 swipeTouchProps.onTouchMove?.(event); 14279 }, 14280 onTouchEnd(event) { 14281 resetTouchTrackingState(); 14282 swipeTouchProps.onTouchEnd?.(event); 14283 }, 14284 onTouchCancel(event) { 14285 resetTouchTrackingState(); 14286 swipeTouchProps.onTouchCancel?.(event); 14287 }, 14288 // Drawer popups use drawer-specific nested state attributes. 14289 // Suppress DialogViewport's generic nested dialog attribute. 14290 ["data-nested-dialog-open"]: void 0 14291 }), 14292 children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(DrawerViewportContext.Provider, { 14293 value: swipeProviderValue, 14294 children 14295 }) 14296 }); 14297 }); 14298 if (true) DrawerViewport.displayName = "DrawerViewport"; 14299 function setSwipeDismissedElements(popupElement, backdropElement, dismissed) { 14300 if (dismissed) { 14301 popupElement?.setAttribute(DrawerPopupDataAttributes.swipeDismiss, ""); 14302 backdropElement?.setAttribute(DrawerPopupDataAttributes.swipeDismiss, ""); 14303 return; 14304 } 14305 popupElement?.removeAttribute(DrawerPopupDataAttributes.swipeDismiss); 14306 backdropElement?.removeAttribute(DrawerPopupDataAttributes.swipeDismiss); 14307 } 14308 function setBackdropSwipingAttribute(backdropElement, swiping) { 14309 if (!backdropElement) { 14310 return; 14311 } 14312 if (swiping) { 14313 backdropElement.setAttribute(DrawerPopupDataAttributes.swiping, ""); 14314 return; 14315 } 14316 backdropElement.removeAttribute(DrawerPopupDataAttributes.swiping); 14317 } 14318 function isSwipeIgnoredTarget(target) { 14319 return Boolean(target?.closest(BASE_UI_SWIPE_IGNORE_SELECTOR)); 14320 } 14321 function isDrawerContentTarget(target) { 14322 return Boolean(target?.closest(DRAWER_CONTENT_SELECTOR)); 14323 } 14324 function getBaseSwipeThreshold(element, direction) { 14325 const size4 = direction === "left" || direction === "right" ? element.offsetWidth : element.offsetHeight; 14326 return Math.max(size4 * 0.5, MIN_SWIPE_THRESHOLD); 14327 } 14328 function isRangeInput(target, win) { 14329 return target instanceof win.HTMLInputElement && target.type === "range"; 14330 } 14331 function isTextSelectionControl(target) { 14332 if (!isElement(target)) { 14333 return false; 14334 } 14335 return target.tagName === "INPUT" || target.tagName === "TEXTAREA"; 14336 } 14337 function hasExpandedSelectionWithinTarget(selection, target) { 14338 const anchorElement = isElement(selection.anchorNode) ? selection.anchorNode : selection.anchorNode?.parentElement; 14339 const focusElement = isElement(selection.focusNode) ? selection.focusNode : selection.focusNode?.parentElement; 14340 return selection.containsNode(target, true) || contains(target, anchorElement) || contains(target, focusElement); 14341 } 14342 function shouldIgnoreSwipeForTextSelection(doc, rootElement) { 14343 const activeEl = activeElement(doc); 14344 const activeElementWithinRoot = Boolean(activeEl && contains(rootElement, activeEl)); 14345 if (activeElementWithinRoot && isTextSelectionControl(activeEl)) { 14346 const { 14347 selectionStart, 14348 selectionEnd 14349 } = activeEl; 14350 if (selectionStart != null && selectionEnd != null && selectionStart < selectionEnd) { 14351 return true; 14352 } 14353 } 14354 const selection = doc.getSelection?.(); 14355 if (!selection || selection.isCollapsed) { 14356 return false; 14357 } 14358 return hasExpandedSelectionWithinTarget(selection, rootElement); 14359 } 14360 function isEventOnRangeInput(event, win) { 14361 const composedPath = event.composedPath(); 14362 if (composedPath) { 14363 return composedPath.some((pathTarget) => isRangeInput(pathTarget, win)); 14364 } 14365 return isRangeInput(getTarget(event), win); 14366 } 14367 function isReactTouchEventOnRangeInput(event) { 14368 return isEventOnRangeInput(event.nativeEvent, getWindow(event.currentTarget)); 14369 } 14370 function updateTouchScrollPosition(touchState, touch) { 14371 touchState.lastX = touch.clientX; 14372 touchState.lastY = touch.clientY; 14373 } 14374 function preserveNativeCrossAxisScrollOnMove(touchState, touch, isVerticalScrollAxis) { 14375 if (touchState.preserveNativeCrossAxisScroll) { 14376 return true; 14377 } 14378 if (touchState.allowSwipe === true || !touchState.hasCrossAxisScrollableContent) { 14379 return false; 14380 } 14381 const drawerAxisGestureDelta = isVerticalScrollAxis ? touch.clientY - touchState.startY : touch.clientX - touchState.startX; 14382 const crossAxisGestureDelta = isVerticalScrollAxis ? touch.clientX - touchState.startX : touch.clientY - touchState.startY; 14383 const absDrawerAxisGestureDelta = Math.abs(drawerAxisGestureDelta); 14384 const absCrossAxisGestureDelta = Math.abs(crossAxisGestureDelta); 14385 if (absCrossAxisGestureDelta < 6 || absCrossAxisGestureDelta <= absDrawerAxisGestureDelta + 2) { 14386 return false; 14387 } 14388 touchState.preserveNativeCrossAxisScroll = true; 14389 return true; 14390 } 14391 function hasScrollableContentOnAxis(scrollTarget, axis) { 14392 return axis === "vertical" ? scrollTarget.scrollHeight > scrollTarget.clientHeight : scrollTarget.scrollWidth > scrollTarget.clientWidth; 14393 } 14394 function getScrollMetrics(scrollTarget, axis) { 14395 if (axis === "vertical") { 14396 const max3 = Math.max(0, scrollTarget.scrollHeight - scrollTarget.clientHeight); 14397 return { 14398 offset: scrollTarget.scrollTop, 14399 max: max3 14400 }; 14401 } 14402 const max2 = Math.max(0, scrollTarget.scrollWidth - scrollTarget.clientWidth); 14403 return { 14404 offset: scrollTarget.scrollLeft, 14405 max: max2 14406 }; 14407 } 14408 function isAtSwipeStartEdge(scrollTarget, axis, direction) { 14409 const { 14410 offset: offset4, 14411 max: max2 14412 } = getScrollMetrics(scrollTarget, axis); 14413 const dismissFromStartEdge = shouldDismissFromStartEdge(direction, axis); 14414 if (dismissFromStartEdge === null) { 14415 return false; 14416 } 14417 return dismissFromStartEdge ? offset4 <= 0 : offset4 >= max2; 14418 } 14419 function canSwipeFromScrollEdgeOnMove(scrollTarget, axis, direction, delta) { 14420 const { 14421 offset: offset4, 14422 max: max2 14423 } = getScrollMetrics(scrollTarget, axis); 14424 const dismissFromStartEdge = shouldDismissFromStartEdge(direction, axis); 14425 if (dismissFromStartEdge === null) { 14426 return false; 14427 } 14428 const movingTowardDismiss = dismissFromStartEdge ? delta > 0 : delta < 0; 14429 if (!movingTowardDismiss) { 14430 return false; 14431 } 14432 return dismissFromStartEdge ? offset4 <= 0 : offset4 >= max2; 14433 } 14434 function shouldDismissFromStartEdge(direction, axis) { 14435 if (axis === "vertical") { 14436 if (direction === "down") { 14437 return true; 14438 } 14439 if (direction === "up") { 14440 return false; 14441 } 14442 return null; 14443 } 14444 if (direction === "right") { 14445 return true; 14446 } 14447 if (direction === "left") { 14448 return false; 14449 } 14450 return null; 14451 } 14452 14453 // node_modules/@base-ui/react/esm/fieldset/root/FieldsetRootContext.js 14454 var React80 = __toESM(require_react(), 1); 14455 var FieldsetRootContext = /* @__PURE__ */ React80.createContext({ 14456 legendId: void 0, 14457 setLegendId: () => { 14458 }, 14459 disabled: void 0 14460 }); 14461 if (true) FieldsetRootContext.displayName = "FieldsetRootContext"; 14462 function useFieldsetRootContext(optional = false) { 14463 const context = React80.useContext(FieldsetRootContext); 14464 if (!context && !optional) { 14465 throw new Error(true ? "Base UI: FieldsetRootContext is missing. Fieldset parts must be placed within <Fieldset.Root>." : formatErrorMessage_default(86)); 14466 } 14467 return context; 14468 } 14469 14470 // node_modules/@base-ui/react/esm/fieldset/index.parts.js 14471 var index_parts_exports5 = {}; 14472 __export(index_parts_exports5, { 14473 Legend: () => FieldsetLegend, 14474 Root: () => FieldsetRoot 14475 }); 14476 14477 // node_modules/@base-ui/react/esm/fieldset/root/FieldsetRoot.js 14478 var React81 = __toESM(require_react(), 1); 14479 var import_jsx_runtime17 = __toESM(require_jsx_runtime(), 1); 14480 var FieldsetRoot = /* @__PURE__ */ React81.forwardRef(function FieldsetRoot2(componentProps, forwardedRef) { 14481 const { 14482 render: render4, 14483 className, 14484 style, 14485 disabled: disabled2 = false, 14486 ...elementProps 14487 } = componentProps; 14488 const [legendId, setLegendId] = React81.useState(void 0); 14489 const state = { 14490 disabled: disabled2 14491 }; 14492 const element = useRenderElement("fieldset", componentProps, { 14493 ref: forwardedRef, 14494 state, 14495 props: [{ 14496 "aria-labelledby": legendId 14497 }, elementProps] 14498 }); 14499 const contextValue = React81.useMemo(() => ({ 14500 legendId, 14501 setLegendId, 14502 disabled: disabled2 14503 }), [legendId, setLegendId, disabled2]); 14504 return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(FieldsetRootContext.Provider, { 14505 value: contextValue, 14506 children: element 14507 }); 14508 }); 14509 if (true) FieldsetRoot.displayName = "FieldsetRoot"; 14510 14511 // node_modules/@base-ui/react/esm/fieldset/legend/FieldsetLegend.js 14512 var React82 = __toESM(require_react(), 1); 14513 var FieldsetLegend = /* @__PURE__ */ React82.forwardRef(function FieldsetLegend2(componentProps, forwardedRef) { 14514 const { 14515 render: render4, 14516 className, 14517 style, 14518 id: idProp, 14519 ...elementProps 14520 } = componentProps; 14521 const { 14522 disabled: disabled2, 14523 setLegendId 14524 } = useFieldsetRootContext(); 14525 const id = useBaseUiId(idProp); 14526 useIsoLayoutEffect(() => { 14527 setLegendId(id); 14528 return () => { 14529 setLegendId(void 0); 14530 }; 14531 }, [setLegendId, id]); 14532 const state = { 14533 disabled: disabled2 ?? false 14534 }; 14535 const element = useRenderElement("div", componentProps, { 14536 state, 14537 ref: forwardedRef, 14538 props: [{ 14539 id 14540 }, elementProps] 14541 }); 14542 return element; 14543 }); 14544 if (true) FieldsetLegend.displayName = "FieldsetLegend"; 14545 14546 // node_modules/@base-ui/react/esm/utils/FloatingPortalLite.js 14547 var React83 = __toESM(require_react(), 1); 14548 var ReactDOM7 = __toESM(require_react_dom(), 1); 14549 var import_jsx_runtime18 = __toESM(require_jsx_runtime(), 1); 14550 var FloatingPortalLite = /* @__PURE__ */ React83.forwardRef(function FloatingPortalLite2(componentProps, forwardedRef) { 14551 const { 14552 children, 14553 container, 14554 className, 14555 render: render4, 14556 style, 14557 ...elementProps 14558 } = componentProps; 14559 const { 14560 portalNode, 14561 portalSubtree 14562 } = useFloatingPortalNode({ 14563 container, 14564 ref: forwardedRef, 14565 componentProps, 14566 elementProps 14567 }); 14568 if (!portalSubtree && !portalNode) { 14569 return null; 14570 } 14571 return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(React83.Fragment, { 14572 children: [portalSubtree, portalNode && /* @__PURE__ */ ReactDOM7.createPortal(children, portalNode)] 14573 }); 14574 }); 14575 if (true) FloatingPortalLite.displayName = "FloatingPortalLite"; 14576 14577 // node_modules/@base-ui/react/esm/tooltip/index.parts.js 14578 var index_parts_exports6 = {}; 14579 __export(index_parts_exports6, { 14580 Arrow: () => TooltipArrow, 14581 Handle: () => TooltipHandle, 14582 Popup: () => TooltipPopup, 14583 Portal: () => TooltipPortal, 14584 Positioner: () => TooltipPositioner, 14585 Provider: () => TooltipProvider, 14586 Root: () => TooltipRoot, 14587 Trigger: () => TooltipTrigger, 14588 Viewport: () => TooltipViewport, 14589 createHandle: () => createTooltipHandle 14590 }); 14591 14592 // node_modules/@base-ui/react/esm/tooltip/root/TooltipRoot.js 14593 var React86 = __toESM(require_react(), 1); 14594 14595 // node_modules/@base-ui/react/esm/tooltip/root/TooltipRootContext.js 14596 var React84 = __toESM(require_react(), 1); 14597 var TooltipRootContext = /* @__PURE__ */ React84.createContext(void 0); 14598 if (true) TooltipRootContext.displayName = "TooltipRootContext"; 14599 function useTooltipRootContext(optional) { 14600 const context = React84.useContext(TooltipRootContext); 14601 if (context === void 0 && !optional) { 14602 throw new Error(true ? "Base UI: TooltipRootContext is missing. Tooltip parts must be placed within <Tooltip.Root>." : formatErrorMessage_default(72)); 14603 } 14604 return context; 14605 } 14606 14607 // node_modules/@base-ui/react/esm/tooltip/store/TooltipStore.js 14608 var React85 = __toESM(require_react(), 1); 14609 var ReactDOM8 = __toESM(require_react_dom(), 1); 14610 var selectors3 = { 14611 ...popupStoreSelectors, 14612 disabled: createSelector((state) => state.disabled), 14613 instantType: createSelector((state) => state.instantType), 14614 isInstantPhase: createSelector((state) => state.isInstantPhase), 14615 trackCursorAxis: createSelector((state) => state.trackCursorAxis), 14616 disableHoverablePopup: createSelector((state) => state.disableHoverablePopup), 14617 lastOpenChangeReason: createSelector((state) => state.openChangeReason), 14618 closeOnClick: createSelector((state) => state.closeOnClick), 14619 closeDelay: createSelector((state) => state.closeDelay), 14620 hasViewport: createSelector((state) => state.hasViewport) 14621 }; 14622 var TooltipStore = class _TooltipStore extends ReactStore { 14623 constructor(initialState) { 14624 super({ 14625 ...createInitialState2(), 14626 ...initialState 14627 }, { 14628 popupRef: /* @__PURE__ */ React85.createRef(), 14629 onOpenChange: void 0, 14630 onOpenChangeComplete: void 0, 14631 triggerElements: new PopupTriggerMap() 14632 }, selectors3); 14633 } 14634 setOpen = (nextOpen, eventDetails) => { 14635 const reason = eventDetails.reason; 14636 const isHover = reason === reason_parts_exports.triggerHover; 14637 const isFocusOpen = nextOpen && reason === reason_parts_exports.triggerFocus; 14638 const isDismissClose = !nextOpen && (reason === reason_parts_exports.triggerPress || reason === reason_parts_exports.escapeKey); 14639 eventDetails.preventUnmountOnClose = () => { 14640 this.set("preventUnmountingOnClose", true); 14641 }; 14642 this.context.onOpenChange?.(nextOpen, eventDetails); 14643 if (eventDetails.isCanceled) { 14644 return; 14645 } 14646 this.state.floatingRootContext.dispatchOpenChange(nextOpen, eventDetails); 14647 const changeState = () => { 14648 const updatedState = { 14649 open: nextOpen, 14650 openChangeReason: reason 14651 }; 14652 if (isFocusOpen) { 14653 updatedState.instantType = "focus"; 14654 } else if (isDismissClose) { 14655 updatedState.instantType = "dismiss"; 14656 } else if (reason === reason_parts_exports.triggerHover) { 14657 updatedState.instantType = void 0; 14658 } 14659 const newTriggerId = eventDetails.trigger?.id ?? null; 14660 if (newTriggerId || nextOpen) { 14661 updatedState.activeTriggerId = newTriggerId; 14662 updatedState.activeTriggerElement = eventDetails.trigger ?? null; 14663 } 14664 this.update(updatedState); 14665 }; 14666 if (isHover) { 14667 ReactDOM8.flushSync(changeState); 14668 } else { 14669 changeState(); 14670 } 14671 }; 14672 static useStore(externalStore, initialState) { 14673 const internalStore = useRefWithInit(() => { 14674 return new _TooltipStore(initialState); 14675 }).current; 14676 const store = externalStore ?? internalStore; 14677 const floatingRootContext = useSyncedFloatingRootContext({ 14678 popupStore: store, 14679 onOpenChange: store.setOpen 14680 }); 14681 store.state.floatingRootContext = floatingRootContext; 14682 return store; 14683 } 14684 }; 14685 function createInitialState2() { 14686 return { 14687 ...createInitialPopupStoreState(), 14688 disabled: false, 14689 instantType: void 0, 14690 isInstantPhase: false, 14691 trackCursorAxis: "none", 14692 disableHoverablePopup: false, 14693 openChangeReason: null, 14694 closeOnClick: true, 14695 closeDelay: 0, 14696 hasViewport: false 14697 }; 14698 } 14699 14700 // node_modules/@base-ui/react/esm/tooltip/root/TooltipRoot.js 14701 var import_jsx_runtime19 = __toESM(require_jsx_runtime(), 1); 14702 var TooltipRoot = fastComponent(function TooltipRoot2(props) { 14703 const { 14704 disabled: disabled2 = false, 14705 defaultOpen = false, 14706 open: openProp, 14707 disableHoverablePopup = false, 14708 trackCursorAxis = "none", 14709 actionsRef, 14710 onOpenChange, 14711 onOpenChangeComplete, 14712 handle, 14713 triggerId: triggerIdProp, 14714 defaultTriggerId: defaultTriggerIdProp = null, 14715 children 14716 } = props; 14717 const store = TooltipStore.useStore(handle?.store, { 14718 open: defaultOpen, 14719 openProp, 14720 activeTriggerId: defaultTriggerIdProp, 14721 triggerIdProp 14722 }); 14723 useOnFirstRender(() => { 14724 if (openProp === void 0 && store.state.open === false && defaultOpen === true) { 14725 store.update({ 14726 open: true, 14727 activeTriggerId: defaultTriggerIdProp 14728 }); 14729 } 14730 }); 14731 store.useControlledProp("openProp", openProp); 14732 store.useControlledProp("triggerIdProp", triggerIdProp); 14733 store.useContextCallback("onOpenChange", onOpenChange); 14734 store.useContextCallback("onOpenChangeComplete", onOpenChangeComplete); 14735 const openState = store.useState("open"); 14736 const open = !disabled2 && openState; 14737 const activeTriggerId = store.useState("activeTriggerId"); 14738 const payload = store.useState("payload"); 14739 store.useSyncedValues({ 14740 trackCursorAxis, 14741 disableHoverablePopup 14742 }); 14743 useIsoLayoutEffect(() => { 14744 if (openState && disabled2) { 14745 store.setOpen(false, createChangeEventDetails(reason_parts_exports.disabled)); 14746 } 14747 }, [openState, disabled2, store]); 14748 store.useSyncedValue("disabled", disabled2); 14749 useImplicitActiveTrigger(store); 14750 const { 14751 forceUnmount, 14752 transitionStatus 14753 } = useOpenStateTransitions(open, store); 14754 const floatingRootContext = store.select("floatingRootContext"); 14755 const isInstantPhase = store.useState("isInstantPhase"); 14756 const instantType = store.useState("instantType"); 14757 const lastOpenChangeReason = store.useState("lastOpenChangeReason"); 14758 const previousInstantTypeRef = React86.useRef(null); 14759 useIsoLayoutEffect(() => { 14760 if (transitionStatus === "ending" && lastOpenChangeReason === reason_parts_exports.none || transitionStatus !== "ending" && isInstantPhase) { 14761 if (instantType !== "delay") { 14762 previousInstantTypeRef.current = instantType; 14763 } 14764 store.set("instantType", "delay"); 14765 } else if (previousInstantTypeRef.current !== null) { 14766 store.set("instantType", previousInstantTypeRef.current); 14767 previousInstantTypeRef.current = null; 14768 } 14769 }, [transitionStatus, isInstantPhase, lastOpenChangeReason, instantType, store]); 14770 useIsoLayoutEffect(() => { 14771 if (open) { 14772 if (activeTriggerId == null) { 14773 store.set("payload", void 0); 14774 } 14775 } 14776 }, [store, activeTriggerId, open]); 14777 const handleImperativeClose = React86.useCallback(() => { 14778 store.setOpen(false, createChangeEventDetails(reason_parts_exports.imperativeAction)); 14779 }, [store]); 14780 React86.useImperativeHandle(actionsRef, () => ({ 14781 unmount: forceUnmount, 14782 close: handleImperativeClose 14783 }), [forceUnmount, handleImperativeClose]); 14784 const dismiss = useDismiss(floatingRootContext, { 14785 enabled: !disabled2, 14786 referencePress: () => store.select("closeOnClick") 14787 }); 14788 const clientPoint = useClientPoint(floatingRootContext, { 14789 enabled: !disabled2 && trackCursorAxis !== "none", 14790 axis: trackCursorAxis === "none" ? void 0 : trackCursorAxis 14791 }); 14792 const { 14793 getReferenceProps, 14794 getFloatingProps, 14795 getTriggerProps 14796 } = useInteractions([dismiss, clientPoint]); 14797 const activeTriggerProps = React86.useMemo(() => getReferenceProps(), [getReferenceProps]); 14798 const inactiveTriggerProps = React86.useMemo(() => getTriggerProps(), [getTriggerProps]); 14799 const popupProps = React86.useMemo(() => getFloatingProps(), [getFloatingProps]); 14800 store.useSyncedValues({ 14801 activeTriggerProps, 14802 inactiveTriggerProps, 14803 popupProps 14804 }); 14805 return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(TooltipRootContext.Provider, { 14806 value: store, 14807 children: typeof children === "function" ? children({ 14808 payload 14809 }) : children 14810 }); 14811 }); 14812 if (true) TooltipRoot.displayName = "TooltipRoot"; 14813 14814 // node_modules/@base-ui/react/esm/tooltip/trigger/TooltipTrigger.js 14815 var React88 = __toESM(require_react(), 1); 14816 14817 // node_modules/@base-ui/react/esm/tooltip/provider/TooltipProviderContext.js 14818 var React87 = __toESM(require_react(), 1); 14819 var TooltipProviderContext = /* @__PURE__ */ React87.createContext(void 0); 14820 if (true) TooltipProviderContext.displayName = "TooltipProviderContext"; 14821 function useTooltipProviderContext() { 14822 return React87.useContext(TooltipProviderContext); 14823 } 14824 14825 // node_modules/@base-ui/react/esm/tooltip/trigger/TooltipTriggerDataAttributes.js 14826 var TooltipTriggerDataAttributes = (function(TooltipTriggerDataAttributes2) { 14827 TooltipTriggerDataAttributes2[TooltipTriggerDataAttributes2["popupOpen"] = CommonTriggerDataAttributes.popupOpen] = "popupOpen"; 14828 TooltipTriggerDataAttributes2["triggerDisabled"] = "data-trigger-disabled"; 14829 return TooltipTriggerDataAttributes2; 14830 })({}); 14831 14832 // node_modules/@base-ui/react/esm/tooltip/utils/constants.js 14833 var OPEN_DELAY = 600; 14834 14835 // node_modules/@base-ui/react/esm/tooltip/trigger/TooltipTrigger.js 14836 var TooltipTrigger = fastComponentRef(function TooltipTrigger2(componentProps, forwardedRef) { 14837 const { 14838 className, 14839 render: render4, 14840 handle, 14841 payload, 14842 disabled: disabledProp, 14843 delay, 14844 closeOnClick = true, 14845 closeDelay, 14846 id: idProp, 14847 style, 14848 ...elementProps 14849 } = componentProps; 14850 const rootContext = useTooltipRootContext(true); 14851 const store = handle?.store ?? rootContext; 14852 if (!store) { 14853 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)); 14854 } 14855 const thisTriggerId = useBaseUiId(idProp); 14856 const isTriggerActive = store.useState("isTriggerActive", thisTriggerId); 14857 const isOpenedByThisTrigger = store.useState("isOpenedByTrigger", thisTriggerId); 14858 const floatingRootContext = store.useState("floatingRootContext"); 14859 const triggerElementRef = React88.useRef(null); 14860 const delayWithDefault = delay ?? OPEN_DELAY; 14861 const closeDelayWithDefault = closeDelay ?? 0; 14862 const { 14863 registerTrigger, 14864 isMountedByThisTrigger 14865 } = useTriggerDataForwarding(thisTriggerId, triggerElementRef, store, { 14866 payload, 14867 closeOnClick, 14868 closeDelay: closeDelayWithDefault 14869 }); 14870 const providerContext = useTooltipProviderContext(); 14871 const { 14872 delayRef, 14873 isInstantPhase, 14874 hasProvider 14875 } = useDelayGroup(floatingRootContext, { 14876 open: isOpenedByThisTrigger 14877 }); 14878 store.useSyncedValue("isInstantPhase", isInstantPhase); 14879 const rootDisabled = store.useState("disabled"); 14880 const disabled2 = disabledProp ?? rootDisabled; 14881 const trackCursorAxis = store.useState("trackCursorAxis"); 14882 const disableHoverablePopup = store.useState("disableHoverablePopup"); 14883 const hoverProps = useHoverReferenceInteraction(floatingRootContext, { 14884 enabled: !disabled2, 14885 mouseOnly: true, 14886 move: false, 14887 handleClose: !disableHoverablePopup && trackCursorAxis !== "both" ? safePolygon() : null, 14888 restMs() { 14889 const providerDelay = providerContext?.delay; 14890 const groupOpenValue = typeof delayRef.current === "object" ? delayRef.current.open : void 0; 14891 let computedRestMs = delayWithDefault; 14892 if (hasProvider) { 14893 if (groupOpenValue !== 0) { 14894 computedRestMs = delay ?? providerDelay ?? delayWithDefault; 14895 } else { 14896 computedRestMs = 0; 14897 } 14898 } 14899 return computedRestMs; 14900 }, 14901 delay() { 14902 const closeValue = typeof delayRef.current === "object" ? delayRef.current.close : void 0; 14903 let computedCloseDelay = closeDelayWithDefault; 14904 if (closeDelay == null && hasProvider) { 14905 computedCloseDelay = closeValue; 14906 } 14907 return { 14908 close: computedCloseDelay 14909 }; 14910 }, 14911 triggerElementRef, 14912 isActiveTrigger: isTriggerActive, 14913 isClosing: () => store.select("transitionStatus") === "ending" 14914 }); 14915 const focusProps = useFocus(floatingRootContext, { 14916 enabled: !disabled2 14917 }).reference; 14918 const state = { 14919 open: isOpenedByThisTrigger 14920 }; 14921 const rootTriggerProps = store.useState("triggerProps", isMountedByThisTrigger); 14922 const element = useRenderElement("button", componentProps, { 14923 state, 14924 ref: [forwardedRef, registerTrigger, triggerElementRef], 14925 props: [hoverProps, focusProps, rootTriggerProps, { 14926 onPointerDown() { 14927 store.set("closeOnClick", closeOnClick); 14928 }, 14929 id: thisTriggerId, 14930 [TooltipTriggerDataAttributes.triggerDisabled]: disabled2 ? "" : void 0 14931 }, elementProps], 14932 stateAttributesMapping: triggerOpenStateMapping2 14933 }); 14934 return element; 14935 }); 14936 if (true) TooltipTrigger.displayName = "TooltipTrigger"; 14937 14938 // node_modules/@base-ui/react/esm/tooltip/portal/TooltipPortal.js 14939 var React90 = __toESM(require_react(), 1); 14940 14941 // node_modules/@base-ui/react/esm/tooltip/portal/TooltipPortalContext.js 14942 var React89 = __toESM(require_react(), 1); 14943 var TooltipPortalContext = /* @__PURE__ */ React89.createContext(void 0); 14944 if (true) TooltipPortalContext.displayName = "TooltipPortalContext"; 14945 function useTooltipPortalContext() { 14946 const value = React89.useContext(TooltipPortalContext); 14947 if (value === void 0) { 14948 throw new Error(true ? "Base UI: <Tooltip.Portal> is missing." : formatErrorMessage_default(70)); 14949 } 14950 return value; 14951 } 14952 14953 // node_modules/@base-ui/react/esm/tooltip/portal/TooltipPortal.js 14954 var import_jsx_runtime20 = __toESM(require_jsx_runtime(), 1); 14955 var TooltipPortal = /* @__PURE__ */ React90.forwardRef(function TooltipPortal2(props, forwardedRef) { 14956 const { 14957 keepMounted = false, 14958 ...portalProps 14959 } = props; 14960 const store = useTooltipRootContext(); 14961 const mounted = store.useState("mounted"); 14962 const shouldRender = mounted || keepMounted; 14963 if (!shouldRender) { 14964 return null; 14965 } 14966 return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(TooltipPortalContext.Provider, { 14967 value: keepMounted, 14968 children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(FloatingPortalLite, { 14969 ref: forwardedRef, 14970 ...portalProps 14971 }) 14972 }); 14973 }); 14974 if (true) TooltipPortal.displayName = "TooltipPortal"; 14975 14976 // node_modules/@base-ui/react/esm/tooltip/positioner/TooltipPositioner.js 14977 var React92 = __toESM(require_react(), 1); 14978 14979 // node_modules/@base-ui/react/esm/tooltip/positioner/TooltipPositionerContext.js 14980 var React91 = __toESM(require_react(), 1); 14981 var TooltipPositionerContext = /* @__PURE__ */ React91.createContext(void 0); 14982 if (true) TooltipPositionerContext.displayName = "TooltipPositionerContext"; 14983 function useTooltipPositionerContext() { 14984 const context = React91.useContext(TooltipPositionerContext); 14985 if (context === void 0) { 14986 throw new Error(true ? "Base UI: TooltipPositionerContext is missing. TooltipPositioner parts must be placed within <Tooltip.Positioner>." : formatErrorMessage_default(71)); 14987 } 14988 return context; 14989 } 14990 14991 // node_modules/@base-ui/react/esm/tooltip/positioner/TooltipPositioner.js 14992 var import_jsx_runtime21 = __toESM(require_jsx_runtime(), 1); 14993 var TooltipPositioner = /* @__PURE__ */ React92.forwardRef(function TooltipPositioner2(componentProps, forwardedRef) { 14994 const { 14995 render: render4, 14996 className, 14997 anchor, 14998 positionMethod = "absolute", 14999 side = "top", 15000 align = "center", 15001 sideOffset = 0, 15002 alignOffset = 0, 15003 collisionBoundary = "clipping-ancestors", 15004 collisionPadding = 5, 15005 arrowPadding = 5, 15006 sticky = false, 15007 disableAnchorTracking = false, 15008 collisionAvoidance = POPUP_COLLISION_AVOIDANCE, 15009 style, 15010 ...elementProps 15011 } = componentProps; 15012 const store = useTooltipRootContext(); 15013 const keepMounted = useTooltipPortalContext(); 15014 const open = store.useState("open"); 15015 const mounted = store.useState("mounted"); 15016 const trackCursorAxis = store.useState("trackCursorAxis"); 15017 const disableHoverablePopup = store.useState("disableHoverablePopup"); 15018 const floatingRootContext = store.useState("floatingRootContext"); 15019 const instantType = store.useState("instantType"); 15020 const transitionStatus = store.useState("transitionStatus"); 15021 const hasViewport = store.useState("hasViewport"); 15022 const positioning = useAnchorPositioning({ 15023 anchor, 15024 positionMethod, 15025 floatingRootContext, 15026 mounted, 15027 side, 15028 sideOffset, 15029 align, 15030 alignOffset, 15031 collisionBoundary, 15032 collisionPadding, 15033 sticky, 15034 arrowPadding, 15035 disableAnchorTracking, 15036 keepMounted, 15037 collisionAvoidance, 15038 adaptiveOrigin: hasViewport ? adaptiveOrigin : void 0 15039 }); 15040 const state = React92.useMemo(() => ({ 15041 open, 15042 side: positioning.side, 15043 align: positioning.align, 15044 anchorHidden: positioning.anchorHidden, 15045 instant: trackCursorAxis !== "none" ? "tracking-cursor" : instantType 15046 }), [open, positioning.side, positioning.align, positioning.anchorHidden, trackCursorAxis, instantType]); 15047 const element = usePositioner(componentProps, state, { 15048 styles: positioning.positionerStyles, 15049 transitionStatus, 15050 props: elementProps, 15051 refs: [forwardedRef, store.useStateSetter("positionerElement")], 15052 hidden: !mounted, 15053 inert: !open || trackCursorAxis === "both" || disableHoverablePopup 15054 }); 15055 return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TooltipPositionerContext.Provider, { 15056 value: positioning, 15057 children: element 15058 }); 15059 }); 15060 if (true) TooltipPositioner.displayName = "TooltipPositioner"; 15061 15062 // node_modules/@base-ui/react/esm/tooltip/popup/TooltipPopup.js 15063 var React93 = __toESM(require_react(), 1); 15064 var stateAttributesMapping10 = { 15065 ...popupStateMapping, 15066 ...transitionStatusMapping 15067 }; 15068 var TooltipPopup = /* @__PURE__ */ React93.forwardRef(function TooltipPopup2(componentProps, forwardedRef) { 15069 const { 15070 className, 15071 render: render4, 15072 style, 15073 ...elementProps 15074 } = componentProps; 15075 const store = useTooltipRootContext(); 15076 const { 15077 side, 15078 align 15079 } = useTooltipPositionerContext(); 15080 const open = store.useState("open"); 15081 const instantType = store.useState("instantType"); 15082 const transitionStatus = store.useState("transitionStatus"); 15083 const popupProps = store.useState("popupProps"); 15084 const floatingContext = store.useState("floatingRootContext"); 15085 useOpenChangeComplete({ 15086 open, 15087 ref: store.context.popupRef, 15088 onComplete() { 15089 if (open) { 15090 store.context.onOpenChangeComplete?.(true); 15091 } 15092 } 15093 }); 15094 const disabled2 = store.useState("disabled"); 15095 const closeDelay = store.useState("closeDelay"); 15096 useHoverFloatingInteraction(floatingContext, { 15097 enabled: !disabled2, 15098 closeDelay 15099 }); 15100 const state = { 15101 open, 15102 side, 15103 align, 15104 instant: instantType, 15105 transitionStatus 15106 }; 15107 const element = useRenderElement("div", componentProps, { 15108 state, 15109 ref: [forwardedRef, store.context.popupRef, store.useStateSetter("popupElement")], 15110 props: [popupProps, getDisabledMountTransitionStyles(transitionStatus), elementProps], 15111 stateAttributesMapping: stateAttributesMapping10 15112 }); 15113 return element; 15114 }); 15115 if (true) TooltipPopup.displayName = "TooltipPopup"; 15116 15117 // node_modules/@base-ui/react/esm/tooltip/arrow/TooltipArrow.js 15118 var React94 = __toESM(require_react(), 1); 15119 var TooltipArrow = /* @__PURE__ */ React94.forwardRef(function TooltipArrow2(componentProps, forwardedRef) { 15120 const { 15121 className, 15122 render: render4, 15123 style, 15124 ...elementProps 15125 } = componentProps; 15126 const store = useTooltipRootContext(); 15127 const open = store.useState("open"); 15128 const instantType = store.useState("instantType"); 15129 const { 15130 arrowRef, 15131 side, 15132 align, 15133 arrowUncentered, 15134 arrowStyles 15135 } = useTooltipPositionerContext(); 15136 const state = { 15137 open, 15138 side, 15139 align, 15140 uncentered: arrowUncentered, 15141 instant: instantType 15142 }; 15143 const element = useRenderElement("div", componentProps, { 15144 state, 15145 ref: [forwardedRef, arrowRef], 15146 props: [{ 15147 style: arrowStyles, 15148 "aria-hidden": true 15149 }, elementProps], 15150 stateAttributesMapping: popupStateMapping 15151 }); 15152 return element; 15153 }); 15154 if (true) TooltipArrow.displayName = "TooltipArrow"; 15155 15156 // node_modules/@base-ui/react/esm/tooltip/provider/TooltipProvider.js 15157 var React95 = __toESM(require_react(), 1); 15158 var import_jsx_runtime22 = __toESM(require_jsx_runtime(), 1); 15159 var TooltipProvider = function TooltipProvider2(props) { 15160 const { 15161 delay, 15162 closeDelay, 15163 timeout = 400 15164 } = props; 15165 const contextValue = React95.useMemo(() => ({ 15166 delay, 15167 closeDelay 15168 }), [delay, closeDelay]); 15169 const delayValue = React95.useMemo(() => ({ 15170 open: delay, 15171 close: closeDelay 15172 }), [delay, closeDelay]); 15173 return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TooltipProviderContext.Provider, { 15174 value: contextValue, 15175 children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(FloatingDelayGroup, { 15176 delay: delayValue, 15177 timeoutMs: timeout, 15178 children: props.children 15179 }) 15180 }); 15181 }; 15182 if (true) TooltipProvider.displayName = "TooltipProvider"; 15183 15184 // node_modules/@base-ui/react/esm/tooltip/viewport/TooltipViewport.js 15185 var React96 = __toESM(require_react(), 1); 15186 15187 // node_modules/@base-ui/react/esm/tooltip/viewport/TooltipViewportCssVars.js 15188 var TooltipViewportCssVars = /* @__PURE__ */ (function(TooltipViewportCssVars2) { 15189 TooltipViewportCssVars2["popupWidth"] = "--popup-width"; 15190 TooltipViewportCssVars2["popupHeight"] = "--popup-height"; 15191 return TooltipViewportCssVars2; 15192 })({}); 15193 15194 // node_modules/@base-ui/react/esm/tooltip/viewport/TooltipViewport.js 15195 var stateAttributesMapping11 = { 15196 activationDirection: (value) => value ? { 15197 "data-activation-direction": value 15198 } : null 15199 }; 15200 var TooltipViewport = /* @__PURE__ */ React96.forwardRef(function TooltipViewport2(componentProps, forwardedRef) { 15201 const { 15202 render: render4, 15203 className, 15204 style, 15205 children, 15206 ...elementProps 15207 } = componentProps; 15208 const store = useTooltipRootContext(); 15209 const positioner = useTooltipPositionerContext(); 15210 const instantType = store.useState("instantType"); 15211 const { 15212 children: childrenToRender, 15213 state: viewportState 15214 } = usePopupViewport({ 15215 store, 15216 side: positioner.side, 15217 cssVars: TooltipViewportCssVars, 15218 children 15219 }); 15220 const state = { 15221 activationDirection: viewportState.activationDirection, 15222 transitioning: viewportState.transitioning, 15223 instant: instantType 15224 }; 15225 return useRenderElement("div", componentProps, { 15226 state, 15227 ref: forwardedRef, 15228 props: [elementProps, { 15229 children: childrenToRender 15230 }], 15231 stateAttributesMapping: stateAttributesMapping11 15232 }); 15233 }); 15234 if (true) TooltipViewport.displayName = "TooltipViewport"; 15235 15236 // node_modules/@base-ui/react/esm/tooltip/store/TooltipHandle.js 15237 var TooltipHandle = class { 15238 /** 15239 * Internal store holding the tooltip state. 15240 * @internal 15241 */ 15242 constructor() { 15243 this.store = new TooltipStore(); 15244 } 15245 /** 15246 * Opens the tooltip and associates it with the trigger with the given ID. 15247 * The trigger must be a Tooltip.Trigger component with this handle passed as a prop. 15248 * 15249 * This method should only be called in an event handler or an effect (not during rendering). 15250 * 15251 * @param triggerId ID of the trigger to associate with the tooltip. 15252 */ 15253 open(triggerId) { 15254 const triggerElement = triggerId ? this.store.context.triggerElements.getById(triggerId) : void 0; 15255 if (triggerId && !triggerElement) { 15256 throw new Error(true ? `Base UI: TooltipHandle.open: No trigger found with id "$triggerId}".` : formatErrorMessage_default(81, triggerId)); 15257 } 15258 this.store.setOpen(true, createChangeEventDetails(reason_parts_exports.imperativeAction, void 0, triggerElement)); 15259 } 15260 /** 15261 * Closes the tooltip. 15262 */ 15263 close() { 15264 this.store.setOpen(false, createChangeEventDetails(reason_parts_exports.imperativeAction, void 0, void 0)); 15265 } 15266 /** 15267 * Indicates whether the tooltip is currently open. 15268 */ 15269 get isOpen() { 15270 return this.store.state.open; 15271 } 15272 }; 15273 function createTooltipHandle() { 15274 return new TooltipHandle(); 15275 } 15276 15277 // node_modules/@base-ui/react/esm/use-render/useRender.js 15278 function useRender(params) { 15279 return useRenderElement(params.defaultTagName ?? "div", params, params); 15280 } 15281 15282 // packages/ui/build-module/text/text.mjs 15283 var import_element11 = __toESM(require_element(), 1); 15284 var STYLE_HASH_ATTRIBUTE = "data-wp-hash"; 15285 function getRuntime() { 15286 const globalScope = globalThis; 15287 if (globalScope.__wpStyleRuntime) { 15288 return globalScope.__wpStyleRuntime; 15289 } 15290 globalScope.__wpStyleRuntime = { 15291 documents: /* @__PURE__ */ new Map(), 15292 styles: /* @__PURE__ */ new Map(), 15293 injectedStyles: /* @__PURE__ */ new WeakMap() 15294 }; 15295 if (typeof document !== "undefined") { 15296 registerDocument(document); 15297 } 15298 return globalScope.__wpStyleRuntime; 15299 } 15300 function documentContainsStyleHash(targetDocument, hash) { 15301 if (!targetDocument.head) { 15302 return false; 15303 } 15304 for (const style of targetDocument.head.querySelectorAll( 15305 `style[$STYLE_HASH_ATTRIBUTE}]` 15306 )) { 15307 if (style.getAttribute(STYLE_HASH_ATTRIBUTE) === hash) { 15308 return true; 15309 } 15310 } 15311 return false; 15312 } 15313 function injectStyle(targetDocument, hash, css) { 15314 if (!targetDocument.head) { 15315 return; 15316 } 15317 const runtime = getRuntime(); 15318 let injectedStyles = runtime.injectedStyles.get(targetDocument); 15319 if (!injectedStyles) { 15320 injectedStyles = /* @__PURE__ */ new Set(); 15321 runtime.injectedStyles.set(targetDocument, injectedStyles); 15322 } 15323 if (injectedStyles.has(hash)) { 15324 return; 15325 } 15326 if (documentContainsStyleHash(targetDocument, hash)) { 15327 injectedStyles.add(hash); 15328 return; 15329 } 15330 const style = targetDocument.createElement("style"); 15331 style.setAttribute(STYLE_HASH_ATTRIBUTE, hash); 15332 style.appendChild(targetDocument.createTextNode(css)); 15333 targetDocument.head.appendChild(style); 15334 injectedStyles.add(hash); 15335 } 15336 function registerDocument(targetDocument) { 15337 const runtime = getRuntime(); 15338 runtime.documents.set( 15339 targetDocument, 15340 (runtime.documents.get(targetDocument) ?? 0) + 1 15341 ); 15342 for (const [hash, css] of runtime.styles) { 15343 injectStyle(targetDocument, hash, css); 15344 } 15345 return () => { 15346 const count = runtime.documents.get(targetDocument); 15347 if (count === void 0) { 15348 return; 15349 } 15350 if (count <= 1) { 15351 runtime.documents.delete(targetDocument); 15352 return; 15353 } 15354 runtime.documents.set(targetDocument, count - 1); 15355 }; 15356 } 15357 function registerStyle(hash, css) { 15358 const runtime = getRuntime(); 15359 runtime.styles.set(hash, css); 15360 for (const targetDocument of runtime.documents.keys()) { 15361 injectStyle(targetDocument, hash, css); 15362 } 15363 } 15364 if (typeof process === "undefined" || true) { 15365 registerStyle("0c8601dd83", '@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;@layer wp-ui-components{._83ed8a8da5dd50ea__text{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-medium,499);--_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-medium,499)}._3c78b7fa9b4072dd__heading-xl{--_gcd-heading-font-size:var(--wpds-typography-font-size-xl,20px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-medium,499);--_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-medium,499);--_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-medium,499);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-medium,499);--_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-medium,499);--_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-medium,499);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-regular,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-regular,400)}.ca1aa3fc2029e958__body-lg{--_gcd-heading-font-size:var(--wpds-typography-font-size-lg,15px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-regular,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-regular,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-regular,400)}._0e8d87a42c1f75fa__body-sm{--_gcd-heading-font-size:var(--wpds-typography-font-size-sm,12px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-regular,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)}}'); 15366 } 15367 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" }; 15368 if (typeof process === "undefined" || true) { 15369 registerStyle("1fb29d3a3c", "._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);&: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,#0000);border:var(--_gcd-input-border,none);border-radius:var(--_gcd-input-border-radius,0);box-shadow:var(--_gcd-input-box-shadow,0 0 0 #0000);color:var(--_gcd-input-color,var(--wpds-color-fg-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,#0000);border-color:var(--_gcd-input-border-color-disabled,#0000);box-shadow:var(--_gcd-input-box-shadow-disabled,none);color:var(--_gcd-input-color-disabled,var(--wpds-color-fg-interactive-neutral-disabled,#8d8d8d))}&::placeholder{color:var(--_gcd-input-placeholder-color,var(--wpds-color-fg-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 #0000)}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-fg-content-neutral,#1e1e1e));font-size:var(--_gcd-heading-font-size,inherit);font-weight:var(--_gcd-heading-font-weight,var(--wpds-typography-font-weight-medium,499));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 #0000);transition:var(--_gcd-a-transition,none)}"); 15370 } 15371 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" }; 15372 var Text = (0, import_element11.forwardRef)(function Text2({ variant = "body-md", render: render4, className, ...props }, ref) { 15373 const element = useRender({ 15374 render: render4, 15375 defaultTagName: "span", 15376 ref, 15377 props: mergeProps(props, { 15378 className: clsx_default( 15379 style_default.text, 15380 global_css_defense_default.heading, 15381 global_css_defense_default.p, 15382 style_default[variant], 15383 className 15384 ) 15385 }) 15386 }); 15387 return element; 15388 }); 15389 15390 // packages/ui/build-module/badge/badge.mjs 15391 var import_jsx_runtime23 = __toESM(require_jsx_runtime(), 1); 15392 var STYLE_HASH_ATTRIBUTE2 = "data-wp-hash"; 15393 function getRuntime2() { 15394 const globalScope = globalThis; 15395 if (globalScope.__wpStyleRuntime) { 15396 return globalScope.__wpStyleRuntime; 15397 } 15398 globalScope.__wpStyleRuntime = { 15399 documents: /* @__PURE__ */ new Map(), 15400 styles: /* @__PURE__ */ new Map(), 15401 injectedStyles: /* @__PURE__ */ new WeakMap() 15402 }; 15403 if (typeof document !== "undefined") { 15404 registerDocument2(document); 15405 } 15406 return globalScope.__wpStyleRuntime; 15407 } 15408 function documentContainsStyleHash2(targetDocument, hash) { 15409 if (!targetDocument.head) { 15410 return false; 15411 } 15412 for (const style of targetDocument.head.querySelectorAll( 15413 `style[$STYLE_HASH_ATTRIBUTE2}]` 15414 )) { 15415 if (style.getAttribute(STYLE_HASH_ATTRIBUTE2) === hash) { 15416 return true; 15417 } 15418 } 15419 return false; 15420 } 15421 function injectStyle2(targetDocument, hash, css) { 15422 if (!targetDocument.head) { 15423 return; 15424 } 15425 const runtime = getRuntime2(); 15426 let injectedStyles = runtime.injectedStyles.get(targetDocument); 15427 if (!injectedStyles) { 15428 injectedStyles = /* @__PURE__ */ new Set(); 15429 runtime.injectedStyles.set(targetDocument, injectedStyles); 15430 } 15431 if (injectedStyles.has(hash)) { 15432 return; 15433 } 15434 if (documentContainsStyleHash2(targetDocument, hash)) { 15435 injectedStyles.add(hash); 15436 return; 15437 } 15438 const style = targetDocument.createElement("style"); 15439 style.setAttribute(STYLE_HASH_ATTRIBUTE2, hash); 15440 style.appendChild(targetDocument.createTextNode(css)); 15441 targetDocument.head.appendChild(style); 15442 injectedStyles.add(hash); 15443 } 15444 function registerDocument2(targetDocument) { 15445 const runtime = getRuntime2(); 15446 runtime.documents.set( 15447 targetDocument, 15448 (runtime.documents.get(targetDocument) ?? 0) + 1 15449 ); 15450 for (const [hash, css] of runtime.styles) { 15451 injectStyle2(targetDocument, hash, css); 15452 } 15453 return () => { 15454 const count = runtime.documents.get(targetDocument); 15455 if (count === void 0) { 15456 return; 15457 } 15458 if (count <= 1) { 15459 runtime.documents.delete(targetDocument); 15460 return; 15461 } 15462 runtime.documents.set(targetDocument, count - 1); 15463 }; 15464 } 15465 function registerStyle2(hash, css) { 15466 const runtime = getRuntime2(); 15467 runtime.styles.set(hash, css); 15468 for (const targetDocument of runtime.documents.keys()) { 15469 injectStyle2(targetDocument, hash, css); 15470 } 15471 } 15472 if (typeof process === "undefined" || true) { 15473 registerStyle2("d6a685e1aa", "@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;@layer wp-ui-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-bg-surface-error,#f6e6e3);color:var(--wpds-color-fg-content-error,#470000)}.c20ebef2365bc8b7__is-medium-intent{background-color:var(--wpds-color-bg-surface-warning,#fde6be);color:var(--wpds-color-fg-content-warning,#2e1900)}._365e1626c6202e52__is-low-intent{background-color:var(--wpds-color-bg-surface-caution,#fee995);color:var(--wpds-color-fg-content-caution,#281d00)}._33f8198127ddf4ef__is-stable-intent{background-color:var(--wpds-color-bg-surface-success,#c6f7cd);color:var(--wpds-color-fg-content-success,#002900)}._04c1aca8fc449412__is-informational-intent{background-color:var(--wpds-color-bg-surface-info,#deebfa);color:var(--wpds-color-fg-content-info,#001b4f)}._90726e69d495ec19__is-draft-intent{background-color:var(--wpds-color-bg-surface-neutral-weak,#f4f4f4);color:var(--wpds-color-fg-content-neutral,#1e1e1e)}._898f4a544993bd39__is-none-intent{background-color:var(--wpds-color-bg-surface-neutral-strong,#fff);border:var(--wpds-border-width-xs,1px) solid var(--wpds-color-stroke-surface-neutral,#dbdbdb);color:var(--wpds-color-fg-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))}}"); 15474 } 15475 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" }; 15476 var Badge = (0, import_element12.forwardRef)(function Badge2({ intent = "none", className, ...props }, ref) { 15477 return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)( 15478 Text, 15479 { 15480 ref, 15481 className: clsx_default( 15482 style_default2.badge, 15483 style_default2[`is-$intent}-intent`], 15484 className 15485 ), 15486 ...props, 15487 variant: "body-sm" 15488 } 15489 ); 15490 }); 15491 15492 // packages/ui/build-module/button/button.mjs 15493 var import_element13 = __toESM(require_element(), 1); 15494 var import_i18n = __toESM(require_i18n(), 1); 15495 var import_jsx_runtime24 = __toESM(require_jsx_runtime(), 1); 15496 import { speak } from "@wordpress/a11y"; 15497 var STYLE_HASH_ATTRIBUTE3 = "data-wp-hash"; 15498 function getRuntime3() { 15499 const globalScope = globalThis; 15500 if (globalScope.__wpStyleRuntime) { 15501 return globalScope.__wpStyleRuntime; 15502 } 15503 globalScope.__wpStyleRuntime = { 15504 documents: /* @__PURE__ */ new Map(), 15505 styles: /* @__PURE__ */ new Map(), 15506 injectedStyles: /* @__PURE__ */ new WeakMap() 15507 }; 15508 if (typeof document !== "undefined") { 15509 registerDocument3(document); 15510 } 15511 return globalScope.__wpStyleRuntime; 15512 } 15513 function documentContainsStyleHash3(targetDocument, hash) { 15514 if (!targetDocument.head) { 15515 return false; 15516 } 15517 for (const style of targetDocument.head.querySelectorAll( 15518 `style[$STYLE_HASH_ATTRIBUTE3}]` 15519 )) { 15520 if (style.getAttribute(STYLE_HASH_ATTRIBUTE3) === hash) { 15521 return true; 15522 } 15523 } 15524 return false; 15525 } 15526 function injectStyle3(targetDocument, hash, css) { 15527 if (!targetDocument.head) { 15528 return; 15529 } 15530 const runtime = getRuntime3(); 15531 let injectedStyles = runtime.injectedStyles.get(targetDocument); 15532 if (!injectedStyles) { 15533 injectedStyles = /* @__PURE__ */ new Set(); 15534 runtime.injectedStyles.set(targetDocument, injectedStyles); 15535 } 15536 if (injectedStyles.has(hash)) { 15537 return; 15538 } 15539 if (documentContainsStyleHash3(targetDocument, hash)) { 15540 injectedStyles.add(hash); 15541 return; 15542 } 15543 const style = targetDocument.createElement("style"); 15544 style.setAttribute(STYLE_HASH_ATTRIBUTE3, hash); 15545 style.appendChild(targetDocument.createTextNode(css)); 15546 targetDocument.head.appendChild(style); 15547 injectedStyles.add(hash); 15548 } 15549 function registerDocument3(targetDocument) { 15550 const runtime = getRuntime3(); 15551 runtime.documents.set( 15552 targetDocument, 15553 (runtime.documents.get(targetDocument) ?? 0) + 1 15554 ); 15555 for (const [hash, css] of runtime.styles) { 15556 injectStyle3(targetDocument, hash, css); 15557 } 15558 return () => { 15559 const count = runtime.documents.get(targetDocument); 15560 if (count === void 0) { 15561 return; 15562 } 15563 if (count <= 1) { 15564 runtime.documents.delete(targetDocument); 15565 return; 15566 } 15567 runtime.documents.set(targetDocument, count - 1); 15568 }; 15569 } 15570 function registerStyle3(hash, css) { 15571 const runtime = getRuntime3(); 15572 runtime.styles.set(hash, css); 15573 for (const targetDocument of runtime.documents.keys()) { 15574 injectStyle3(targetDocument, hash, css); 15575 } 15576 } 15577 if (typeof process === "undefined" || true) { 15578 registerStyle3("7d54255a4c", '@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;@layer wp-ui-components{._97b0fc33c028be1a__button,.abbb272e2ce49bd6__is-unstyled{appearance:none;padding:0}._97b0fc33c028be1a__button{--wp-ui-button-font-weight:499;--wp-ui-button-background-color:var(--wpds-color-bg-interactive-brand-strong,var(--wp-admin-theme-color,#3858e9));--wp-ui-button-background-color-active:var(--wpds-color-bg-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-bg-interactive-neutral-strong-disabled,#e6e6e6);--wp-ui-button-foreground-color:var(--wpds-color-fg-interactive-brand-strong,#fff);--wp-ui-button-foreground-color-active:var(--wpds-color-fg-interactive-brand-strong-active,#fff);--wp-ui-button-foreground-color-disabled:var(--wpds-color-fg-interactive-neutral-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: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-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:padding-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:#0000;border-block-start-color:var(--wp-ui-button-foreground-color);border-inline-end-color:var(--wp-ui-button-foreground-color);border-inline-start-color:#0000;border-radius:50%;box-sizing:border-box;content:"";display:block;height:var(--wp-ui-button-font-size);inset-inline-start:50%;opacity:0;pointer-events:none;position:absolute;top:50%;transform:translate(-50%,-50%);@media not (prefers-reduced-motion){transition:opacity .1s ease-out}}}._908205475f9f2a92__is-small{--wp-ui-button-padding-block:0;--wp-ui-button-padding-inline:var(--wpds-dimension-padding-sm,8px);--wp-ui-button-height:24px}.dd460c965226cc77__is-brand{&._62d5a778b7b258ee__is-outline,&.ad0619a3217c6a5b__is-minimal{--wp-ui-button-foreground-color:var(--wpds-color-fg-interactive-brand,var(--wp-admin-theme-color,#3858e9));--wp-ui-button-foreground-color-active:var(--wpds-color-fg-interactive-brand-active,var(--wp-admin-theme-color,#3858e9));--wp-ui-button-foreground-color-disabled:var(--wpds-color-fg-interactive-neutral-disabled,#8d8d8d)}&._62d5a778b7b258ee__is-outline{--wp-ui-button-background-color:var(--wpds-color-bg-interactive-brand-weak,#0000);--wp-ui-button-background-color-active:var(--wpds-color-bg-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-bg-interactive-neutral-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-neutral-disabled,#dbdbdb)}&.ad0619a3217c6a5b__is-minimal{--wp-ui-button-background-color:var(--wpds-color-bg-interactive-brand-weak,#0000);--wp-ui-button-background-color-active:var(--wpds-color-bg-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-bg-interactive-neutral-weak-disabled,#0000)}}.e722a8f96726aa99__is-neutral{&.ad0619a3217c6a5b__is-minimal[aria-pressed=true],&.b50b3358c5fb4d0b__is-solid{--wp-ui-button-background-color:var(--wpds-color-bg-interactive-neutral-strong,#2d2d2d);--wp-ui-button-background-color-active:var(--wpds-color-bg-interactive-neutral-strong-active,#1e1e1e);--wp-ui-button-background-color-disabled:var(--wpds-color-bg-interactive-neutral-strong-disabled,#e6e6e6);--wp-ui-button-foreground-color:var(--wpds-color-fg-interactive-neutral-strong,#f0f0f0);--wp-ui-button-foreground-color-active:var(--wpds-color-fg-interactive-neutral-strong-active,#f0f0f0);--wp-ui-button-foreground-color-disabled:var(--wpds-color-fg-interactive-neutral-strong-disabled,#8d8d8d)}&._62d5a778b7b258ee__is-outline,&.ad0619a3217c6a5b__is-minimal:not([aria-pressed=true]){--wp-ui-button-foreground-color:var(--wpds-color-fg-interactive-neutral,#1e1e1e);--wp-ui-button-foreground-color-active:var(--wpds-color-fg-interactive-neutral-active,#1e1e1e);--wp-ui-button-foreground-color-disabled:var(--wpds-color-fg-interactive-neutral-disabled,#8d8d8d)}&._62d5a778b7b258ee__is-outline{--wp-ui-button-background-color:var(--wpds-color-bg-interactive-neutral-weak,#0000);--wp-ui-button-background-color-active:var(--wpds-color-bg-interactive-neutral-weak-active,#ededed);--wp-ui-button-background-color-disabled:var(--wpds-color-bg-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-bg-interactive-neutral-weak,#0000);--wp-ui-button-background-color-active:var(--wpds-color-bg-interactive-neutral-weak-active,#ededed);--wp-ui-button-background-color-disabled:var(--wpds-color-bg-interactive-neutral-weak-disabled,#0000)}}.abbb272e2ce49bd6__is-unstyled{background:none;border:none;min-width:unset}.cf59cf1b69629838__is-compact{--wp-ui-button-height:32px}._914b42f315c0e580__is-loading{color:#0000;&:not([data-disabled]):is(:hover,:active,:focus){color:#0000}*{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)}}'); 15579 } 15580 var style_default3 = { "button": "_97b0fc33c028be1a__button", "is-unstyled": "abbb272e2ce49bd6__is-unstyled", "is-loading": "_914b42f315c0e580__is-loading", "is-small": "_908205475f9f2a92__is-small", "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" }; 15581 if (typeof process === "undefined" || true) { 15582 registerStyle3("e3ae230cea", "@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;@layer wp-ui-utilities{._336cd3e4e743482f__box-sizing{box-sizing:border-box;*,:after,:before{box-sizing:inherit}}}"); 15583 } 15584 var resets_default = { "box-sizing": "_336cd3e4e743482f__box-sizing" }; 15585 if (typeof process === "undefined" || true) { 15586 registerStyle3("2a5ab8f3a7", "@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;@layer wp-ui-utilities{._08e8a2e44959f892__outset-ring--focus,._970d04df7376df67__outset-ring--focus-within-except-active,.c5cb3ee4bddaa8e4__outset-ring--focus-within-visible,.cd83dfc2126a0846__outset-ring--focus-within,.d0541bc9dd9dc7b6__outset-ring--focus-visible,.e25b2bdd7aa21721__outset-ring--focus-except-active,.ecadb9e080e2dfa5__outset-ring--focus-parent-visible{@media not (prefers-reduced-motion){--_gcd-a-transition:outline 0.1s ease-out;transition:outline .1s ease-out}outline:0 solid #0000;outline-offset:1px}._08e8a2e44959f892__outset-ring--focus:focus,._970d04df7376df67__outset-ring--focus-within-except-active:focus-within:not(:has(:active)),.c5cb3ee4bddaa8e4__outset-ring--focus-within-visible:focus-within:has(:focus-visible),.cd83dfc2126a0846__outset-ring--focus-within:focus-within,.d0541bc9dd9dc7b6__outset-ring--focus-visible:focus-visible,.e25b2bdd7aa21721__outset-ring--focus-except-active:focus:not(:active),:focus-visible .ecadb9e080e2dfa5__outset-ring--focus-parent-visible{--_gcd-a-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--wpds-color-stroke-focus-brand,var(--wp-admin-theme-color,#3858e9));--_gcd-div-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--wpds-color-stroke-focus-brand,var(--wp-admin-theme-color,#3858e9));outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--wpds-color-stroke-focus-brand,var(--wp-admin-theme-color,#3858e9))}}"); 15587 } 15588 var focus_default = { "outset-ring--focus": "_08e8a2e44959f892__outset-ring--focus", "outset-ring--focus-except-active": "e25b2bdd7aa21721__outset-ring--focus-except-active", "outset-ring--focus-visible": "d0541bc9dd9dc7b6__outset-ring--focus-visible", "outset-ring--focus-within": "cd83dfc2126a0846__outset-ring--focus-within", "outset-ring--focus-within-except-active": "_970d04df7376df67__outset-ring--focus-within-except-active", "outset-ring--focus-within-visible": "c5cb3ee4bddaa8e4__outset-ring--focus-within-visible", "outset-ring--focus-parent-visible": "ecadb9e080e2dfa5__outset-ring--focus-parent-visible" }; 15589 if (typeof process === "undefined" || true) { 15590 registerStyle3("1fb29d3a3c", "._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);&: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,#0000);border:var(--_gcd-input-border,none);border-radius:var(--_gcd-input-border-radius,0);box-shadow:var(--_gcd-input-box-shadow,0 0 0 #0000);color:var(--_gcd-input-color,var(--wpds-color-fg-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,#0000);border-color:var(--_gcd-input-border-color-disabled,#0000);box-shadow:var(--_gcd-input-box-shadow-disabled,none);color:var(--_gcd-input-color-disabled,var(--wpds-color-fg-interactive-neutral-disabled,#8d8d8d))}&::placeholder{color:var(--_gcd-input-placeholder-color,var(--wpds-color-fg-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 #0000)}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-fg-content-neutral,#1e1e1e));font-size:var(--_gcd-heading-font-size,inherit);font-weight:var(--_gcd-heading-font-weight,var(--wpds-typography-font-weight-medium,499));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 #0000);transition:var(--_gcd-a-transition,none)}"); 15591 } 15592 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" }; 15593 var Button3 = (0, import_element13.forwardRef)( 15594 function Button22({ 15595 tone = "brand", 15596 variant = "solid", 15597 size: size4 = "default", 15598 className, 15599 focusableWhenDisabled = true, 15600 disabled: disabled2, 15601 loading, 15602 loadingAnnouncement = (0, import_i18n.__)("Loading"), 15603 children, 15604 ...props 15605 }, ref) { 15606 const mergedClassName = clsx_default( 15607 global_css_defense_default2.button, 15608 resets_default["box-sizing"], 15609 focus_default["outset-ring--focus-except-active"], 15610 variant !== "unstyled" && style_default3.button, 15611 style_default3[`is-$tone}`], 15612 style_default3[`is-$variant}`], 15613 style_default3[`is-$size4}`], 15614 loading && style_default3["is-loading"], 15615 className 15616 ); 15617 (0, import_element13.useEffect)(() => { 15618 if (loading && loadingAnnouncement) { 15619 speak(loadingAnnouncement); 15620 } 15621 }, [loading, loadingAnnouncement]); 15622 return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)( 15623 Button, 15624 { 15625 ref, 15626 className: mergedClassName, 15627 focusableWhenDisabled, 15628 disabled: disabled2 ?? loading, 15629 ...props, 15630 children 15631 } 15632 ); 15633 } 15634 ); 15635 15636 // packages/ui/build-module/button/icon.mjs 15637 var import_element15 = __toESM(require_element(), 1); 15638 15639 // packages/ui/build-module/icon/icon.mjs 15640 var import_element14 = __toESM(require_element(), 1); 15641 var import_primitives = __toESM(require_primitives(), 1); 15642 var import_jsx_runtime25 = __toESM(require_jsx_runtime(), 1); 15643 var Icon = (0, import_element14.forwardRef)(function Icon2({ icon, size: size4 = 24, ...restProps }, ref) { 15644 return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)( 15645 import_primitives.SVG, 15646 { 15647 ref, 15648 fill: "currentColor", 15649 ...icon.props, 15650 ...restProps, 15651 width: size4, 15652 height: size4 15653 } 15654 ); 15655 }); 15656 15657 // packages/ui/build-module/button/icon.mjs 15658 var import_jsx_runtime26 = __toESM(require_jsx_runtime(), 1); 15659 var ButtonIcon = (0, import_element15.forwardRef)( 15660 function ButtonIcon2({ icon, ...props }, ref) { 15661 return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)( 15662 Icon, 15663 { 15664 ref, 15665 icon, 15666 viewBox: "4 4 16 16", 15667 size: 16, 15668 ...props 15669 } 15670 ); 15671 } 15672 ); 15673 15674 // packages/ui/build-module/button/index.mjs 15675 ButtonIcon.displayName = "Button.Icon"; 15676 var Button4 = Object.assign(Button3, { 15677 /** 15678 * An icon component specifically designed to work well when rendered inside 15679 * a `Button` component. 15680 */ 15681 Icon: ButtonIcon 15682 }); 15683 15684 // packages/ui/build-module/card/index.mjs 15685 var card_exports = {}; 15686 __export(card_exports, { 15687 Content: () => Content, 15688 FullBleed: () => FullBleed, 15689 Header: () => Header, 15690 Root: () => Root, 15691 Title: () => Title 15692 }); 15693 15694 // packages/ui/build-module/card/root.mjs 15695 var import_element16 = __toESM(require_element(), 1); 15696 var STYLE_HASH_ATTRIBUTE4 = "data-wp-hash"; 15697 function getRuntime4() { 15698 const globalScope = globalThis; 15699 if (globalScope.__wpStyleRuntime) { 15700 return globalScope.__wpStyleRuntime; 15701 } 15702 globalScope.__wpStyleRuntime = { 15703 documents: /* @__PURE__ */ new Map(), 15704 styles: /* @__PURE__ */ new Map(), 15705 injectedStyles: /* @__PURE__ */ new WeakMap() 15706 }; 15707 if (typeof document !== "undefined") { 15708 registerDocument4(document); 15709 } 15710 return globalScope.__wpStyleRuntime; 15711 } 15712 function documentContainsStyleHash4(targetDocument, hash) { 15713 if (!targetDocument.head) { 15714 return false; 15715 } 15716 for (const style of targetDocument.head.querySelectorAll( 15717 `style[$STYLE_HASH_ATTRIBUTE4}]` 15718 )) { 15719 if (style.getAttribute(STYLE_HASH_ATTRIBUTE4) === hash) { 15720 return true; 15721 } 15722 } 15723 return false; 15724 } 15725 function injectStyle4(targetDocument, hash, css) { 15726 if (!targetDocument.head) { 15727 return; 15728 } 15729 const runtime = getRuntime4(); 15730 let injectedStyles = runtime.injectedStyles.get(targetDocument); 15731 if (!injectedStyles) { 15732 injectedStyles = /* @__PURE__ */ new Set(); 15733 runtime.injectedStyles.set(targetDocument, injectedStyles); 15734 } 15735 if (injectedStyles.has(hash)) { 15736 return; 15737 } 15738 if (documentContainsStyleHash4(targetDocument, hash)) { 15739 injectedStyles.add(hash); 15740 return; 15741 } 15742 const style = targetDocument.createElement("style"); 15743 style.setAttribute(STYLE_HASH_ATTRIBUTE4, hash); 15744 style.appendChild(targetDocument.createTextNode(css)); 15745 targetDocument.head.appendChild(style); 15746 injectedStyles.add(hash); 15747 } 15748 function registerDocument4(targetDocument) { 15749 const runtime = getRuntime4(); 15750 runtime.documents.set( 15751 targetDocument, 15752 (runtime.documents.get(targetDocument) ?? 0) + 1 15753 ); 15754 for (const [hash, css] of runtime.styles) { 15755 injectStyle4(targetDocument, hash, css); 15756 } 15757 return () => { 15758 const count = runtime.documents.get(targetDocument); 15759 if (count === void 0) { 15760 return; 15761 } 15762 if (count <= 1) { 15763 runtime.documents.delete(targetDocument); 15764 return; 15765 } 15766 runtime.documents.set(targetDocument, count - 1); 15767 }; 15768 } 15769 function registerStyle4(hash, css) { 15770 const runtime = getRuntime4(); 15771 runtime.styles.set(hash, css); 15772 for (const targetDocument of runtime.documents.keys()) { 15773 injectStyle4(targetDocument, hash, css); 15774 } 15775 } 15776 if (typeof process === "undefined" || true) { 15777 registerStyle4("e3ae230cea", "@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;@layer wp-ui-utilities{._336cd3e4e743482f__box-sizing{box-sizing:border-box;*,:after,:before{box-sizing:inherit}}}"); 15778 } 15779 var resets_default2 = { "box-sizing": "_336cd3e4e743482f__box-sizing" }; 15780 if (typeof process === "undefined" || true) { 15781 registerStyle4("7bb6e0116a", "@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;@layer wp-ui-components{._02872bf298eadc43__root{--wp-ui-card-padding:var(--wpds-dimension-padding-2xl,24px);--wp-ui-card-header-content-gap:var(--wpds-dimension-gap-xl,24px);--wp-ui-card-header-content-margin:calc(var(--wp-ui-card-header-content-gap) - var(--wp-ui-card-padding));background-color:var(--wpds-color-bg-surface-neutral-strong,#fff);border:1px solid var(--wpds-color-stroke-surface-neutral-weak,#e4e4e4);border-radius:var(--wpds-border-radius-lg,8px);color:var(--wpds-color-fg-content-neutral,#1e1e1e);display:flex;flex-direction:column;overflow:clip}._5dffdaf2a6e669ac__content,.bbccc92e6ba5662d__header{padding:var(--wp-ui-card-padding);&:not(:first-child):not(:last-child){padding-block-end:0}}.bbccc92e6ba5662d__header+._5dffdaf2a6e669ac__content{margin-block-start:var(--wp-ui-card-header-content-margin);padding-block-start:0}.c1fa192587e1b4a6__fullbleed{margin-inline:calc(var(--wp-ui-card-padding)*-1);width:calc(100% + var(--wp-ui-card-padding)*2)}._02872bf298eadc43__root>:is(.bbccc92e6ba5662d__header,._5dffdaf2a6e669ac__content):first-child>.c1fa192587e1b4a6__fullbleed:first-child{margin-block-start:calc(var(--wp-ui-card-padding)*-1)}:is(.bbccc92e6ba5662d__header,._5dffdaf2a6e669ac__content):last-child>.c1fa192587e1b4a6__fullbleed:last-child{margin-block-end:calc(var(--wp-ui-card-padding)*-1)}}"); 15782 } 15783 var style_default4 = { "root": "_02872bf298eadc43__root", "header": "bbccc92e6ba5662d__header", "content": "_5dffdaf2a6e669ac__content", "fullbleed": "c1fa192587e1b4a6__fullbleed" }; 15784 var Root = (0, import_element16.forwardRef)(function Card({ render: render4, ...restProps }, ref) { 15785 const mergedClassName = clsx_default(style_default4.root, resets_default2["box-sizing"]); 15786 const element = useRender({ 15787 defaultTagName: "div", 15788 render: render4, 15789 ref, 15790 props: mergeProps({ className: mergedClassName }, restProps) 15791 }); 15792 return element; 15793 }); 15794 15795 // packages/ui/build-module/card/header.mjs 15796 var import_element17 = __toESM(require_element(), 1); 15797 var STYLE_HASH_ATTRIBUTE5 = "data-wp-hash"; 15798 function getRuntime5() { 15799 const globalScope = globalThis; 15800 if (globalScope.__wpStyleRuntime) { 15801 return globalScope.__wpStyleRuntime; 15802 } 15803 globalScope.__wpStyleRuntime = { 15804 documents: /* @__PURE__ */ new Map(), 15805 styles: /* @__PURE__ */ new Map(), 15806 injectedStyles: /* @__PURE__ */ new WeakMap() 15807 }; 15808 if (typeof document !== "undefined") { 15809 registerDocument5(document); 15810 } 15811 return globalScope.__wpStyleRuntime; 15812 } 15813 function documentContainsStyleHash5(targetDocument, hash) { 15814 if (!targetDocument.head) { 15815 return false; 15816 } 15817 for (const style of targetDocument.head.querySelectorAll( 15818 `style[$STYLE_HASH_ATTRIBUTE5}]` 15819 )) { 15820 if (style.getAttribute(STYLE_HASH_ATTRIBUTE5) === hash) { 15821 return true; 15822 } 15823 } 15824 return false; 15825 } 15826 function injectStyle5(targetDocument, hash, css) { 15827 if (!targetDocument.head) { 15828 return; 15829 } 15830 const runtime = getRuntime5(); 15831 let injectedStyles = runtime.injectedStyles.get(targetDocument); 15832 if (!injectedStyles) { 15833 injectedStyles = /* @__PURE__ */ new Set(); 15834 runtime.injectedStyles.set(targetDocument, injectedStyles); 15835 } 15836 if (injectedStyles.has(hash)) { 15837 return; 15838 } 15839 if (documentContainsStyleHash5(targetDocument, hash)) { 15840 injectedStyles.add(hash); 15841 return; 15842 } 15843 const style = targetDocument.createElement("style"); 15844 style.setAttribute(STYLE_HASH_ATTRIBUTE5, hash); 15845 style.appendChild(targetDocument.createTextNode(css)); 15846 targetDocument.head.appendChild(style); 15847 injectedStyles.add(hash); 15848 } 15849 function registerDocument5(targetDocument) { 15850 const runtime = getRuntime5(); 15851 runtime.documents.set( 15852 targetDocument, 15853 (runtime.documents.get(targetDocument) ?? 0) + 1 15854 ); 15855 for (const [hash, css] of runtime.styles) { 15856 injectStyle5(targetDocument, hash, css); 15857 } 15858 return () => { 15859 const count = runtime.documents.get(targetDocument); 15860 if (count === void 0) { 15861 return; 15862 } 15863 if (count <= 1) { 15864 runtime.documents.delete(targetDocument); 15865 return; 15866 } 15867 runtime.documents.set(targetDocument, count - 1); 15868 }; 15869 } 15870 function registerStyle5(hash, css) { 15871 const runtime = getRuntime5(); 15872 runtime.styles.set(hash, css); 15873 for (const targetDocument of runtime.documents.keys()) { 15874 injectStyle5(targetDocument, hash, css); 15875 } 15876 } 15877 if (typeof process === "undefined" || true) { 15878 registerStyle5("7bb6e0116a", "@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;@layer wp-ui-components{._02872bf298eadc43__root{--wp-ui-card-padding:var(--wpds-dimension-padding-2xl,24px);--wp-ui-card-header-content-gap:var(--wpds-dimension-gap-xl,24px);--wp-ui-card-header-content-margin:calc(var(--wp-ui-card-header-content-gap) - var(--wp-ui-card-padding));background-color:var(--wpds-color-bg-surface-neutral-strong,#fff);border:1px solid var(--wpds-color-stroke-surface-neutral-weak,#e4e4e4);border-radius:var(--wpds-border-radius-lg,8px);color:var(--wpds-color-fg-content-neutral,#1e1e1e);display:flex;flex-direction:column;overflow:clip}._5dffdaf2a6e669ac__content,.bbccc92e6ba5662d__header{padding:var(--wp-ui-card-padding);&:not(:first-child):not(:last-child){padding-block-end:0}}.bbccc92e6ba5662d__header+._5dffdaf2a6e669ac__content{margin-block-start:var(--wp-ui-card-header-content-margin);padding-block-start:0}.c1fa192587e1b4a6__fullbleed{margin-inline:calc(var(--wp-ui-card-padding)*-1);width:calc(100% + var(--wp-ui-card-padding)*2)}._02872bf298eadc43__root>:is(.bbccc92e6ba5662d__header,._5dffdaf2a6e669ac__content):first-child>.c1fa192587e1b4a6__fullbleed:first-child{margin-block-start:calc(var(--wp-ui-card-padding)*-1)}:is(.bbccc92e6ba5662d__header,._5dffdaf2a6e669ac__content):last-child>.c1fa192587e1b4a6__fullbleed:last-child{margin-block-end:calc(var(--wp-ui-card-padding)*-1)}}"); 15879 } 15880 var style_default5 = { "root": "_02872bf298eadc43__root", "header": "bbccc92e6ba5662d__header", "content": "_5dffdaf2a6e669ac__content", "fullbleed": "c1fa192587e1b4a6__fullbleed" }; 15881 var Header = (0, import_element17.forwardRef)( 15882 function CardHeader({ render: render4, ...props }, ref) { 15883 const element = useRender({ 15884 defaultTagName: "div", 15885 render: render4, 15886 ref, 15887 props: mergeProps({ className: style_default5.header }, props) 15888 }); 15889 return element; 15890 } 15891 ); 15892 15893 // packages/ui/build-module/card/content.mjs 15894 var import_element18 = __toESM(require_element(), 1); 15895 var STYLE_HASH_ATTRIBUTE6 = "data-wp-hash"; 15896 function getRuntime6() { 15897 const globalScope = globalThis; 15898 if (globalScope.__wpStyleRuntime) { 15899 return globalScope.__wpStyleRuntime; 15900 } 15901 globalScope.__wpStyleRuntime = { 15902 documents: /* @__PURE__ */ new Map(), 15903 styles: /* @__PURE__ */ new Map(), 15904 injectedStyles: /* @__PURE__ */ new WeakMap() 15905 }; 15906 if (typeof document !== "undefined") { 15907 registerDocument6(document); 15908 } 15909 return globalScope.__wpStyleRuntime; 15910 } 15911 function documentContainsStyleHash6(targetDocument, hash) { 15912 if (!targetDocument.head) { 15913 return false; 15914 } 15915 for (const style of targetDocument.head.querySelectorAll( 15916 `style[$STYLE_HASH_ATTRIBUTE6}]` 15917 )) { 15918 if (style.getAttribute(STYLE_HASH_ATTRIBUTE6) === hash) { 15919 return true; 15920 } 15921 } 15922 return false; 15923 } 15924 function injectStyle6(targetDocument, hash, css) { 15925 if (!targetDocument.head) { 15926 return; 15927 } 15928 const runtime = getRuntime6(); 15929 let injectedStyles = runtime.injectedStyles.get(targetDocument); 15930 if (!injectedStyles) { 15931 injectedStyles = /* @__PURE__ */ new Set(); 15932 runtime.injectedStyles.set(targetDocument, injectedStyles); 15933 } 15934 if (injectedStyles.has(hash)) { 15935 return; 15936 } 15937 if (documentContainsStyleHash6(targetDocument, hash)) { 15938 injectedStyles.add(hash); 15939 return; 15940 } 15941 const style = targetDocument.createElement("style"); 15942 style.setAttribute(STYLE_HASH_ATTRIBUTE6, hash); 15943 style.appendChild(targetDocument.createTextNode(css)); 15944 targetDocument.head.appendChild(style); 15945 injectedStyles.add(hash); 15946 } 15947 function registerDocument6(targetDocument) { 15948 const runtime = getRuntime6(); 15949 runtime.documents.set( 15950 targetDocument, 15951 (runtime.documents.get(targetDocument) ?? 0) + 1 15952 ); 15953 for (const [hash, css] of runtime.styles) { 15954 injectStyle6(targetDocument, hash, css); 15955 } 15956 return () => { 15957 const count = runtime.documents.get(targetDocument); 15958 if (count === void 0) { 15959 return; 15960 } 15961 if (count <= 1) { 15962 runtime.documents.delete(targetDocument); 15963 return; 15964 } 15965 runtime.documents.set(targetDocument, count - 1); 15966 }; 15967 } 15968 function registerStyle6(hash, css) { 15969 const runtime = getRuntime6(); 15970 runtime.styles.set(hash, css); 15971 for (const targetDocument of runtime.documents.keys()) { 15972 injectStyle6(targetDocument, hash, css); 15973 } 15974 } 15975 if (typeof process === "undefined" || true) { 15976 registerStyle6("7bb6e0116a", "@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;@layer wp-ui-components{._02872bf298eadc43__root{--wp-ui-card-padding:var(--wpds-dimension-padding-2xl,24px);--wp-ui-card-header-content-gap:var(--wpds-dimension-gap-xl,24px);--wp-ui-card-header-content-margin:calc(var(--wp-ui-card-header-content-gap) - var(--wp-ui-card-padding));background-color:var(--wpds-color-bg-surface-neutral-strong,#fff);border:1px solid var(--wpds-color-stroke-surface-neutral-weak,#e4e4e4);border-radius:var(--wpds-border-radius-lg,8px);color:var(--wpds-color-fg-content-neutral,#1e1e1e);display:flex;flex-direction:column;overflow:clip}._5dffdaf2a6e669ac__content,.bbccc92e6ba5662d__header{padding:var(--wp-ui-card-padding);&:not(:first-child):not(:last-child){padding-block-end:0}}.bbccc92e6ba5662d__header+._5dffdaf2a6e669ac__content{margin-block-start:var(--wp-ui-card-header-content-margin);padding-block-start:0}.c1fa192587e1b4a6__fullbleed{margin-inline:calc(var(--wp-ui-card-padding)*-1);width:calc(100% + var(--wp-ui-card-padding)*2)}._02872bf298eadc43__root>:is(.bbccc92e6ba5662d__header,._5dffdaf2a6e669ac__content):first-child>.c1fa192587e1b4a6__fullbleed:first-child{margin-block-start:calc(var(--wp-ui-card-padding)*-1)}:is(.bbccc92e6ba5662d__header,._5dffdaf2a6e669ac__content):last-child>.c1fa192587e1b4a6__fullbleed:last-child{margin-block-end:calc(var(--wp-ui-card-padding)*-1)}}"); 15977 } 15978 var style_default6 = { "root": "_02872bf298eadc43__root", "header": "bbccc92e6ba5662d__header", "content": "_5dffdaf2a6e669ac__content", "fullbleed": "c1fa192587e1b4a6__fullbleed" }; 15979 var Content = (0, import_element18.forwardRef)( 15980 function CardContent({ render: render4, ...props }, ref) { 15981 const element = useRender({ 15982 defaultTagName: "div", 15983 render: render4, 15984 ref, 15985 props: mergeProps({ className: style_default6.content }, props) 15986 }); 15987 return element; 15988 } 15989 ); 15990 15991 // packages/ui/build-module/card/full-bleed.mjs 15992 var import_element19 = __toESM(require_element(), 1); 15993 var STYLE_HASH_ATTRIBUTE7 = "data-wp-hash"; 15994 function getRuntime7() { 15995 const globalScope = globalThis; 15996 if (globalScope.__wpStyleRuntime) { 15997 return globalScope.__wpStyleRuntime; 15998 } 15999 globalScope.__wpStyleRuntime = { 16000 documents: /* @__PURE__ */ new Map(), 16001 styles: /* @__PURE__ */ new Map(), 16002 injectedStyles: /* @__PURE__ */ new WeakMap() 16003 }; 16004 if (typeof document !== "undefined") { 16005 registerDocument7(document); 16006 } 16007 return globalScope.__wpStyleRuntime; 16008 } 16009 function documentContainsStyleHash7(targetDocument, hash) { 16010 if (!targetDocument.head) { 16011 return false; 16012 } 16013 for (const style of targetDocument.head.querySelectorAll( 16014 `style[$STYLE_HASH_ATTRIBUTE7}]` 16015 )) { 16016 if (style.getAttribute(STYLE_HASH_ATTRIBUTE7) === hash) { 16017 return true; 16018 } 16019 } 16020 return false; 16021 } 16022 function injectStyle7(targetDocument, hash, css) { 16023 if (!targetDocument.head) { 16024 return; 16025 } 16026 const runtime = getRuntime7(); 16027 let injectedStyles = runtime.injectedStyles.get(targetDocument); 16028 if (!injectedStyles) { 16029 injectedStyles = /* @__PURE__ */ new Set(); 16030 runtime.injectedStyles.set(targetDocument, injectedStyles); 16031 } 16032 if (injectedStyles.has(hash)) { 16033 return; 16034 } 16035 if (documentContainsStyleHash7(targetDocument, hash)) { 16036 injectedStyles.add(hash); 16037 return; 16038 } 16039 const style = targetDocument.createElement("style"); 16040 style.setAttribute(STYLE_HASH_ATTRIBUTE7, hash); 16041 style.appendChild(targetDocument.createTextNode(css)); 16042 targetDocument.head.appendChild(style); 16043 injectedStyles.add(hash); 16044 } 16045 function registerDocument7(targetDocument) { 16046 const runtime = getRuntime7(); 16047 runtime.documents.set( 16048 targetDocument, 16049 (runtime.documents.get(targetDocument) ?? 0) + 1 16050 ); 16051 for (const [hash, css] of runtime.styles) { 16052 injectStyle7(targetDocument, hash, css); 16053 } 16054 return () => { 16055 const count = runtime.documents.get(targetDocument); 16056 if (count === void 0) { 16057 return; 16058 } 16059 if (count <= 1) { 16060 runtime.documents.delete(targetDocument); 16061 return; 16062 } 16063 runtime.documents.set(targetDocument, count - 1); 16064 }; 16065 } 16066 function registerStyle7(hash, css) { 16067 const runtime = getRuntime7(); 16068 runtime.styles.set(hash, css); 16069 for (const targetDocument of runtime.documents.keys()) { 16070 injectStyle7(targetDocument, hash, css); 16071 } 16072 } 16073 if (typeof process === "undefined" || true) { 16074 registerStyle7("7bb6e0116a", "@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;@layer wp-ui-components{._02872bf298eadc43__root{--wp-ui-card-padding:var(--wpds-dimension-padding-2xl,24px);--wp-ui-card-header-content-gap:var(--wpds-dimension-gap-xl,24px);--wp-ui-card-header-content-margin:calc(var(--wp-ui-card-header-content-gap) - var(--wp-ui-card-padding));background-color:var(--wpds-color-bg-surface-neutral-strong,#fff);border:1px solid var(--wpds-color-stroke-surface-neutral-weak,#e4e4e4);border-radius:var(--wpds-border-radius-lg,8px);color:var(--wpds-color-fg-content-neutral,#1e1e1e);display:flex;flex-direction:column;overflow:clip}._5dffdaf2a6e669ac__content,.bbccc92e6ba5662d__header{padding:var(--wp-ui-card-padding);&:not(:first-child):not(:last-child){padding-block-end:0}}.bbccc92e6ba5662d__header+._5dffdaf2a6e669ac__content{margin-block-start:var(--wp-ui-card-header-content-margin);padding-block-start:0}.c1fa192587e1b4a6__fullbleed{margin-inline:calc(var(--wp-ui-card-padding)*-1);width:calc(100% + var(--wp-ui-card-padding)*2)}._02872bf298eadc43__root>:is(.bbccc92e6ba5662d__header,._5dffdaf2a6e669ac__content):first-child>.c1fa192587e1b4a6__fullbleed:first-child{margin-block-start:calc(var(--wp-ui-card-padding)*-1)}:is(.bbccc92e6ba5662d__header,._5dffdaf2a6e669ac__content):last-child>.c1fa192587e1b4a6__fullbleed:last-child{margin-block-end:calc(var(--wp-ui-card-padding)*-1)}}"); 16075 } 16076 var style_default7 = { "root": "_02872bf298eadc43__root", "header": "bbccc92e6ba5662d__header", "content": "_5dffdaf2a6e669ac__content", "fullbleed": "c1fa192587e1b4a6__fullbleed" }; 16077 var FullBleed = (0, import_element19.forwardRef)( 16078 function CardFullBleed({ render: render4, ...props }, ref) { 16079 const element = useRender({ 16080 defaultTagName: "div", 16081 render: render4, 16082 ref, 16083 props: mergeProps( 16084 { className: style_default7.fullbleed }, 16085 props 16086 ) 16087 }); 16088 return element; 16089 } 16090 ); 16091 16092 // packages/ui/build-module/card/title.mjs 16093 var import_element20 = __toESM(require_element(), 1); 16094 var import_jsx_runtime27 = __toESM(require_jsx_runtime(), 1); 16095 var DEFAULT_TAG = /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", {}); 16096 var Title = (0, import_element20.forwardRef)( 16097 function CardTitle({ render: render4 = DEFAULT_TAG, children, ...props }, ref) { 16098 return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)( 16099 Text, 16100 { 16101 ref, 16102 variant: "heading-lg", 16103 render: render4, 16104 ...props, 16105 children 16106 } 16107 ); 16108 } 16109 ); 16110 16111 // packages/ui/build-module/collapsible/panel.mjs 16112 var import_element21 = __toESM(require_element(), 1); 16113 var import_jsx_runtime28 = __toESM(require_jsx_runtime(), 1); 16114 var Panel = (0, import_element21.forwardRef)( 16115 function CollapsiblePanel3(props, forwardedRef) { 16116 return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(index_parts_exports2.Panel, { ref: forwardedRef, ...props }); 16117 } 16118 ); 16119 16120 // packages/ui/build-module/collapsible/root.mjs 16121 var import_element22 = __toESM(require_element(), 1); 16122 var import_jsx_runtime29 = __toESM(require_jsx_runtime(), 1); 16123 var Root2 = (0, import_element22.forwardRef)( 16124 function CollapsibleRoot3(props, forwardedRef) { 16125 return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(index_parts_exports2.Root, { ref: forwardedRef, ...props }); 16126 } 16127 ); 16128 16129 // packages/ui/build-module/collapsible/trigger.mjs 16130 var import_element23 = __toESM(require_element(), 1); 16131 var import_jsx_runtime30 = __toESM(require_jsx_runtime(), 1); 16132 var Trigger = (0, import_element23.forwardRef)( 16133 function CollapsibleTrigger3(props, forwardedRef) { 16134 return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(index_parts_exports2.Trigger, { ref: forwardedRef, ...props }); 16135 } 16136 ); 16137 16138 // packages/ui/build-module/collapsible-card/index.mjs 16139 var collapsible_card_exports = {}; 16140 __export(collapsible_card_exports, { 16141 Content: () => Content2, 16142 Header: () => Header2, 16143 HeaderDescription: () => HeaderDescription, 16144 Root: () => Root3 16145 }); 16146 16147 // packages/ui/build-module/collapsible-card/root.mjs 16148 var import_element24 = __toESM(require_element(), 1); 16149 var import_jsx_runtime31 = __toESM(require_jsx_runtime(), 1); 16150 var Root3 = (0, import_element24.forwardRef)( 16151 function CollapsibleCardRoot({ render: render4, ...restProps }, ref) { 16152 return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)( 16153 Root2, 16154 { 16155 ref, 16156 render: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Root, { render: render4 }), 16157 ...restProps 16158 } 16159 ); 16160 } 16161 ); 16162 16163 // packages/ui/build-module/collapsible-card/header.mjs 16164 var import_element26 = __toESM(require_element(), 1); 16165 16166 // packages/icons/build-module/library/arrow-down.mjs 16167 var import_primitives2 = __toESM(require_primitives(), 1); 16168 var import_jsx_runtime32 = __toESM(require_jsx_runtime(), 1); 16169 var arrow_down_default = /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_primitives2.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_primitives2.Path, { d: "m16.5 13.5-3.7 3.7V4h-1.5v13.2l-3.8-3.7-1 1 5.5 5.6 5.5-5.6z" }) }); 16170 16171 // packages/icons/build-module/library/arrow-left.mjs 16172 var import_primitives3 = __toESM(require_primitives(), 1); 16173 var import_jsx_runtime33 = __toESM(require_jsx_runtime(), 1); 16174 var arrow_left_default = /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_primitives3.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_primitives3.Path, { d: "M20 11.2H6.8l3.7-3.7-1-1L3.9 12l5.6 5.5 1-1-3.7-3.7H20z" }) }); 16175 16176 // packages/icons/build-module/library/arrow-right.mjs 16177 var import_primitives4 = __toESM(require_primitives(), 1); 16178 var import_jsx_runtime34 = __toESM(require_jsx_runtime(), 1); 16179 var arrow_right_default = /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_primitives4.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_primitives4.Path, { d: "m14.5 6.5-1 1 3.7 3.7H4v1.6h13.2l-3.7 3.7 1 1 5.6-5.5z" }) }); 16180 16181 // packages/icons/build-module/library/arrow-up.mjs 16182 var import_primitives5 = __toESM(require_primitives(), 1); 16183 var import_jsx_runtime35 = __toESM(require_jsx_runtime(), 1); 16184 var arrow_up_default = /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_primitives5.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_primitives5.Path, { d: "M12 3.9 6.5 9.5l1 1 3.8-3.7V20h1.5V6.8l3.7 3.7 1-1z" }) }); 16185 16186 // packages/icons/build-module/library/block-table.mjs 16187 var import_primitives6 = __toESM(require_primitives(), 1); 16188 var import_jsx_runtime36 = __toESM(require_jsx_runtime(), 1); 16189 var block_table_default = /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_primitives6.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_primitives6.Path, { d: "M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM5 4.5h14c.3 0 .5.2.5.5v3.5h-15V5c0-.3.2-.5.5-.5zm8 5.5h6.5v3.5H13V10zm-1.5 3.5h-7V10h7v3.5zm-7 5.5v-4h7v4.5H5c-.3 0-.5-.2-.5-.5zm14.5.5h-6V15h6.5v4c0 .3-.2.5-.5.5z" }) }); 16190 16191 // packages/icons/build-module/library/category.mjs 16192 var import_primitives7 = __toESM(require_primitives(), 1); 16193 var import_jsx_runtime37 = __toESM(require_jsx_runtime(), 1); 16194 var category_default = /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_primitives7.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_primitives7.Path, { fillRule: "evenodd", clipRule: "evenodd", d: "M6 5.5h3a.5.5 0 01.5.5v3a.5.5 0 01-.5.5H6a.5.5 0 01-.5-.5V6a.5.5 0 01.5-.5zM4 6a2 2 0 012-2h3a2 2 0 012 2v3a2 2 0 01-2 2H6a2 2 0 01-2-2V6zm11-.5h3a.5.5 0 01.5.5v3a.5.5 0 01-.5.5h-3a.5.5 0 01-.5-.5V6a.5.5 0 01.5-.5zM13 6a2 2 0 012-2h3a2 2 0 012 2v3a2 2 0 01-2 2h-3a2 2 0 01-2-2V6zm5 8.5h-3a.5.5 0 00-.5.5v3a.5.5 0 00.5.5h3a.5.5 0 00.5-.5v-3a.5.5 0 00-.5-.5zM15 13a2 2 0 00-2 2v3a2 2 0 002 2h3a2 2 0 002-2v-3a2 2 0 00-2-2h-3zm-9 1.5h3a.5.5 0 01.5.5v3a.5.5 0 01-.5.5H6a.5.5 0 01-.5-.5v-3a.5.5 0 01.5-.5zM4 15a2 2 0 012-2h3a2 2 0 012 2v3a2 2 0 01-2 2H6a2 2 0 01-2-2v-3z" }) }); 16195 16196 // packages/icons/build-module/library/caution.mjs 16197 var import_primitives8 = __toESM(require_primitives(), 1); 16198 var import_jsx_runtime38 = __toESM(require_jsx_runtime(), 1); 16199 var caution_default = /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_primitives8.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_primitives8.Path, { fillRule: "evenodd", clipRule: "evenodd", d: "M5.5 12a6.5 6.5 0 1 0 13 0 6.5 6.5 0 0 0-13 0ZM12 4a8 8 0 1 0 0 16 8 8 0 0 0 0-16Zm-.75 12v-1.5h1.5V16h-1.5Zm0-8v5h1.5V8h-1.5Z" }) }); 16200 16201 // packages/icons/build-module/library/check.mjs 16202 var import_primitives9 = __toESM(require_primitives(), 1); 16203 var import_jsx_runtime39 = __toESM(require_jsx_runtime(), 1); 16204 var check_default = /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_primitives9.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_primitives9.Path, { d: "M16.5 7.5 10 13.9l-2.5-2.4-1 1 3.5 3.6 7.5-7.6z" }) }); 16205 16206 // packages/icons/build-module/library/chevron-down.mjs 16207 var import_primitives10 = __toESM(require_primitives(), 1); 16208 var import_jsx_runtime40 = __toESM(require_jsx_runtime(), 1); 16209 var chevron_down_default = /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_primitives10.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_primitives10.Path, { d: "M17.5 11.6L12 16l-5.5-4.4.9-1.2L12 14l4.5-3.6 1 1.2z" }) }); 16210 16211 // packages/icons/build-module/library/close-small.mjs 16212 var import_primitives11 = __toESM(require_primitives(), 1); 16213 var import_jsx_runtime41 = __toESM(require_jsx_runtime(), 1); 16214 var close_small_default = /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_primitives11.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_primitives11.Path, { d: "M12 13.06l3.712 3.713 1.061-1.06L13.061 12l3.712-3.712-1.06-1.06L12 10.938 8.288 7.227l-1.061 1.06L10.939 12l-3.712 3.712 1.06 1.061L12 13.061z" }) }); 16215 16216 // packages/icons/build-module/library/close.mjs 16217 var import_primitives12 = __toESM(require_primitives(), 1); 16218 var import_jsx_runtime42 = __toESM(require_jsx_runtime(), 1); 16219 var close_default = /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_primitives12.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_primitives12.Path, { d: "m13.06 12 6.47-6.47-1.06-1.06L12 10.94 5.53 4.47 4.47 5.53 10.94 12l-6.47 6.47 1.06 1.06L12 13.06l6.47 6.47 1.06-1.06L13.06 12Z" }) }); 16220 16221 // packages/icons/build-module/library/cog.mjs 16222 var import_primitives13 = __toESM(require_primitives(), 1); 16223 var import_jsx_runtime43 = __toESM(require_jsx_runtime(), 1); 16224 var cog_default = /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_primitives13.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_primitives13.Path, { fillRule: "evenodd", clipRule: "evenodd", d: "M10.289 4.836A1 1 0 0111.275 4h1.306a1 1 0 01.987.836l.244 1.466c.787.26 1.503.679 2.108 1.218l1.393-.522a1 1 0 011.216.437l.653 1.13a1 1 0 01-.23 1.273l-1.148.944a6.025 6.025 0 010 2.435l1.149.946a1 1 0 01.23 1.272l-.653 1.13a1 1 0 01-1.216.437l-1.394-.522c-.605.54-1.32.958-2.108 1.218l-.244 1.466a1 1 0 01-.987.836h-1.306a1 1 0 01-.986-.836l-.244-1.466a5.995 5.995 0 01-2.108-1.218l-1.394.522a1 1 0 01-1.217-.436l-.653-1.131a1 1 0 01.23-1.272l1.149-.946a6.026 6.026 0 010-2.435l-1.148-.944a1 1 0 01-.23-1.272l.653-1.131a1 1 0 011.217-.437l1.393.522a5.994 5.994 0 012.108-1.218l.244-1.466zM14.929 12a3 3 0 11-6 0 3 3 0 016 0z" }) }); 16225 16226 // packages/icons/build-module/library/columns.mjs 16227 var import_primitives14 = __toESM(require_primitives(), 1); 16228 var import_jsx_runtime44 = __toESM(require_jsx_runtime(), 1); 16229 var columns_default = /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_primitives14.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_primitives14.Path, { fillRule: "evenodd", clipRule: "evenodd", d: "M15 7.5h-5v10h5v-10Zm1.5 0v10H19a.5.5 0 0 0 .5-.5V8a.5.5 0 0 0-.5-.5h-2.5ZM6 7.5h2.5v10H6a.5.5 0 0 1-.5-.5V8a.5.5 0 0 1 .5-.5ZM6 6h13a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2Z" }) }); 16230 16231 // packages/icons/build-module/library/envelope.mjs 16232 var import_primitives15 = __toESM(require_primitives(), 1); 16233 var import_jsx_runtime45 = __toESM(require_jsx_runtime(), 1); 16234 var envelope_default = /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_primitives15.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_primitives15.Path, { fillRule: "evenodd", clipRule: "evenodd", d: "M3 7c0-1.1.9-2 2-2h14a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7Zm2-.5h14c.3 0 .5.2.5.5v1L12 13.5 4.5 7.9V7c0-.3.2-.5.5-.5Zm-.5 3.3V17c0 .3.2.5.5.5h14c.3 0 .5-.2.5-.5V9.8L12 15.4 4.5 9.8Z" }) }); 16235 16236 // packages/icons/build-module/library/error.mjs 16237 var import_primitives16 = __toESM(require_primitives(), 1); 16238 var import_jsx_runtime46 = __toESM(require_jsx_runtime(), 1); 16239 var error_default = /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_primitives16.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_primitives16.Path, { fillRule: "evenodd", clipRule: "evenodd", d: "M12.218 5.377a.25.25 0 0 0-.436 0l-7.29 12.96a.25.25 0 0 0 .218.373h14.58a.25.25 0 0 0 .218-.372l-7.29-12.96Zm-1.743-.735c.669-1.19 2.381-1.19 3.05 0l7.29 12.96a1.75 1.75 0 0 1-1.525 2.608H4.71a1.75 1.75 0 0 1-1.525-2.608l7.29-12.96ZM12.75 17.46h-1.5v-1.5h1.5v1.5Zm-1.5-3h1.5v-5h-1.5v5Z" }) }); 16240 16241 // packages/icons/build-module/library/format-list-bullets-rtl.mjs 16242 var import_primitives17 = __toESM(require_primitives(), 1); 16243 var import_jsx_runtime47 = __toESM(require_jsx_runtime(), 1); 16244 var format_list_bullets_rtl_default = /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_primitives17.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_primitives17.Path, { d: "M4 8.8h8.9V7.2H4v1.6zm0 7h8.9v-1.5H4v1.5zM18 13c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0-3c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2z" }) }); 16245 16246 // packages/icons/build-module/library/format-list-bullets.mjs 16247 var import_primitives18 = __toESM(require_primitives(), 1); 16248 var import_jsx_runtime48 = __toESM(require_jsx_runtime(), 1); 16249 var format_list_bullets_default = /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_primitives18.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_primitives18.Path, { d: "M11.1 15.8H20v-1.5h-8.9v1.5zm0-8.6v1.5H20V7.2h-8.9zM6 13c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0-7c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z" }) }); 16250 16251 // packages/icons/build-module/library/funnel.mjs 16252 var import_primitives19 = __toESM(require_primitives(), 1); 16253 var import_jsx_runtime49 = __toESM(require_jsx_runtime(), 1); 16254 var funnel_default = /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_primitives19.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_primitives19.Path, { d: "M10 17.5H14V16H10V17.5ZM6 6V7.5H18V6H6ZM8 12.5H16V11H8V12.5Z" }) }); 16255 16256 // packages/icons/build-module/library/grid.mjs 16257 var import_primitives20 = __toESM(require_primitives(), 1); 16258 var import_jsx_runtime50 = __toESM(require_jsx_runtime(), 1); 16259 var grid_default = /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_primitives20.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_primitives20.Path, { fillRule: "evenodd", clipRule: "evenodd", d: "m3 5c0-1.10457.89543-2 2-2h13.5c1.1046 0 2 .89543 2 2v13.5c0 1.1046-.8954 2-2 2h-13.5c-1.10457 0-2-.8954-2-2zm2-.5h6v6.5h-6.5v-6c0-.27614.22386-.5.5-.5zm-.5 8v6c0 .2761.22386.5.5.5h6v-6.5zm8 0v6.5h6c.2761 0 .5-.2239.5-.5v-6zm0-8v6.5h6.5v-6c0-.27614-.2239-.5-.5-.5z" }) }); 16260 16261 // packages/icons/build-module/library/home.mjs 16262 var import_primitives21 = __toESM(require_primitives(), 1); 16263 var import_jsx_runtime51 = __toESM(require_jsx_runtime(), 1); 16264 var home_default = /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(import_primitives21.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(import_primitives21.Path, { d: "M12 4L4 7.9V20h16V7.9L12 4zm6.5 14.5H14V13h-4v5.5H5.5V8.8L12 5.7l6.5 3.1v9.7z" }) }); 16265 16266 // packages/icons/build-module/library/info.mjs 16267 var import_primitives22 = __toESM(require_primitives(), 1); 16268 var import_jsx_runtime52 = __toESM(require_jsx_runtime(), 1); 16269 var info_default = /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_primitives22.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_primitives22.Path, { fillRule: "evenodd", clipRule: "evenodd", d: "M5.5 12a6.5 6.5 0 1 0 13 0 6.5 6.5 0 0 0-13 0ZM12 4a8 8 0 1 0 0 16 8 8 0 0 0 0-16Zm.75 4v1.5h-1.5V8h1.5Zm0 8v-5h-1.5v5h1.5Z" }) }); 16270 16271 // packages/icons/build-module/library/layout.mjs 16272 var import_primitives23 = __toESM(require_primitives(), 1); 16273 var import_jsx_runtime53 = __toESM(require_jsx_runtime(), 1); 16274 var layout_default = /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(import_primitives23.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(import_primitives23.Path, { d: "M18 5.5H6a.5.5 0 00-.5.5v3h13V6a.5.5 0 00-.5-.5zm.5 5H10v8h8a.5.5 0 00.5-.5v-7.5zm-10 0h-3V18a.5.5 0 00.5.5h2.5v-8zM6 4h12a2 2 0 012 2v12a2 2 0 01-2 2H6a2 2 0 01-2-2V6a2 2 0 012-2z" }) }); 16275 16276 // packages/icons/build-module/library/link.mjs 16277 var import_primitives24 = __toESM(require_primitives(), 1); 16278 var import_jsx_runtime54 = __toESM(require_jsx_runtime(), 1); 16279 var link_default = /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_primitives24.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_primitives24.Path, { d: "M10 17.389H8.444A5.194 5.194 0 1 1 8.444 7H10v1.5H8.444a3.694 3.694 0 0 0 0 7.389H10v1.5ZM14 7h1.556a5.194 5.194 0 0 1 0 10.39H14v-1.5h1.556a3.694 3.694 0 0 0 0-7.39H14V7Zm-4.5 6h5v-1.5h-5V13Z" }) }); 16280 16281 // packages/icons/build-module/library/mobile.mjs 16282 var import_primitives25 = __toESM(require_primitives(), 1); 16283 var import_jsx_runtime55 = __toESM(require_jsx_runtime(), 1); 16284 var mobile_default = /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(import_primitives25.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(import_primitives25.Path, { d: "M15 4H9c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h6c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm.5 14c0 .3-.2.5-.5.5H9c-.3 0-.5-.2-.5-.5V6c0-.3.2-.5.5-.5h6c.3 0 .5.2.5.5v12zm-4.5-.5h2V16h-2v1.5z" }) }); 16285 16286 // packages/icons/build-module/library/more-vertical.mjs 16287 var import_primitives26 = __toESM(require_primitives(), 1); 16288 var import_jsx_runtime56 = __toESM(require_jsx_runtime(), 1); 16289 var more_vertical_default = /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_primitives26.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_primitives26.Path, { d: "M13 19h-2v-2h2v2zm0-6h-2v-2h2v2zm0-6h-2V5h2v2z" }) }); 16290 16291 // packages/icons/build-module/library/next.mjs 16292 var import_primitives27 = __toESM(require_primitives(), 1); 16293 var import_jsx_runtime57 = __toESM(require_jsx_runtime(), 1); 16294 var next_default = /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(import_primitives27.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(import_primitives27.Path, { d: "M6.6 6L5.4 7l4.5 5-4.5 5 1.1 1 5.5-6-5.4-6zm6 0l-1.1 1 4.5 5-4.5 5 1.1 1 5.5-6-5.5-6z" }) }); 16295 16296 // packages/icons/build-module/library/pencil.mjs 16297 var import_primitives28 = __toESM(require_primitives(), 1); 16298 var import_jsx_runtime58 = __toESM(require_jsx_runtime(), 1); 16299 var pencil_default = /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(import_primitives28.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(import_primitives28.Path, { d: "m19 7-3-3-8.5 8.5-1 4 4-1L19 7Zm-7 11.5H5V20h7v-1.5Z" }) }); 16300 16301 // packages/icons/build-module/library/plus.mjs 16302 var import_primitives29 = __toESM(require_primitives(), 1); 16303 var import_jsx_runtime59 = __toESM(require_jsx_runtime(), 1); 16304 var plus_default = /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(import_primitives29.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(import_primitives29.Path, { d: "M11 12.5V17.5H12.5V12.5H17.5V11H12.5V6H11V11H6V12.5H11Z" }) }); 16305 16306 // packages/icons/build-module/library/previous.mjs 16307 var import_primitives30 = __toESM(require_primitives(), 1); 16308 var import_jsx_runtime60 = __toESM(require_jsx_runtime(), 1); 16309 var previous_default = /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(import_primitives30.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(import_primitives30.Path, { d: "M11.6 7l-1.1-1L5 12l5.5 6 1.1-1L7 12l4.6-5zm6 0l-1.1-1-5.5 6 5.5 6 1.1-1-4.6-5 4.6-5z" }) }); 16310 16311 // packages/icons/build-module/library/published.mjs 16312 var import_primitives31 = __toESM(require_primitives(), 1); 16313 var import_jsx_runtime61 = __toESM(require_jsx_runtime(), 1); 16314 var published_default = /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(import_primitives31.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(import_primitives31.Path, { fillRule: "evenodd", clipRule: "evenodd", d: "M12 18.5a6.5 6.5 0 1 1 0-13 6.5 6.5 0 0 1 0 13ZM4 12a8 8 0 1 1 16 0 8 8 0 0 1-16 0Zm11.53-1.47-1.06-1.06L11 12.94l-1.47-1.47-1.06 1.06L11 15.06l4.53-4.53Z" }) }); 16315 16316 // packages/icons/build-module/library/scheduled.mjs 16317 var import_primitives32 = __toESM(require_primitives(), 1); 16318 var import_jsx_runtime62 = __toESM(require_jsx_runtime(), 1); 16319 var scheduled_default = /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(import_primitives32.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(import_primitives32.Path, { fillRule: "evenodd", clipRule: "evenodd", d: "M12 18.5a6.5 6.5 0 1 1 0-13 6.5 6.5 0 0 1 0 13ZM4 12a8 8 0 1 1 16 0 8 8 0 0 1-16 0Zm9 1V8h-1.5v3.5h-2V13H13Z" }) }); 16320 16321 // packages/icons/build-module/library/search.mjs 16322 var import_primitives33 = __toESM(require_primitives(), 1); 16323 var import_jsx_runtime63 = __toESM(require_jsx_runtime(), 1); 16324 var search_default = /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(import_primitives33.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(import_primitives33.Path, { d: "M13 5c-3.3 0-6 2.7-6 6 0 1.4.5 2.7 1.3 3.7l-3.8 3.8 1.1 1.1 3.8-3.8c1 .8 2.3 1.3 3.7 1.3 3.3 0 6-2.7 6-6S16.3 5 13 5zm0 10.5c-2.5 0-4.5-2-4.5-4.5s2-4.5 4.5-4.5 4.5 2 4.5 4.5-2 4.5-4.5 4.5z" }) }); 16325 16326 // packages/icons/build-module/library/seen.mjs 16327 var import_primitives34 = __toESM(require_primitives(), 1); 16328 var import_jsx_runtime64 = __toESM(require_jsx_runtime(), 1); 16329 var seen_default = /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(import_primitives34.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(import_primitives34.Path, { d: "M3.99961 13C4.67043 13.3354 4.6703 13.3357 4.67017 13.3359L4.67298 13.3305C4.67621 13.3242 4.68184 13.3135 4.68988 13.2985C4.70595 13.2686 4.7316 13.2218 4.76695 13.1608C4.8377 13.0385 4.94692 12.8592 5.09541 12.6419C5.39312 12.2062 5.84436 11.624 6.45435 11.0431C7.67308 9.88241 9.49719 8.75 11.9996 8.75C14.502 8.75 16.3261 9.88241 17.5449 11.0431C18.1549 11.624 18.6061 12.2062 18.9038 12.6419C19.0523 12.8592 19.1615 13.0385 19.2323 13.1608C19.2676 13.2218 19.2933 13.2686 19.3093 13.2985C19.3174 13.3135 19.323 13.3242 19.3262 13.3305L19.3291 13.3359C19.3289 13.3357 19.3288 13.3354 19.9996 13C20.6704 12.6646 20.6703 12.6643 20.6701 12.664L20.6697 12.6632L20.6688 12.6614L20.6662 12.6563L20.6583 12.6408C20.6517 12.6282 20.6427 12.6108 20.631 12.5892C20.6078 12.5459 20.5744 12.4852 20.5306 12.4096C20.4432 12.2584 20.3141 12.0471 20.1423 11.7956C19.7994 11.2938 19.2819 10.626 18.5794 9.9569C17.1731 8.61759 14.9972 7.25 11.9996 7.25C9.00203 7.25 6.82614 8.61759 5.41987 9.9569C4.71736 10.626 4.19984 11.2938 3.85694 11.7956C3.68511 12.0471 3.55605 12.2584 3.4686 12.4096C3.42484 12.4852 3.39142 12.5459 3.36818 12.5892C3.35656 12.6108 3.34748 12.6282 3.34092 12.6408L3.33297 12.6563L3.33041 12.6614L3.32948 12.6632L3.32911 12.664C3.32894 12.6643 3.32879 12.6646 3.99961 13ZM11.9996 16C13.9326 16 15.4996 14.433 15.4996 12.5C15.4996 10.567 13.9326 9 11.9996 9C10.0666 9 8.49961 10.567 8.49961 12.5C8.49961 14.433 10.0666 16 11.9996 16Z" }) }); 16330 16331 // packages/icons/build-module/library/trash.mjs 16332 var import_primitives35 = __toESM(require_primitives(), 1); 16333 var import_jsx_runtime65 = __toESM(require_jsx_runtime(), 1); 16334 var trash_default = /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(import_primitives35.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(import_primitives35.Path, { fillRule: "evenodd", clipRule: "evenodd", d: "M12 5.5A2.25 2.25 0 0 0 9.878 7h4.244A2.251 2.251 0 0 0 12 5.5ZM12 4a3.751 3.751 0 0 0-3.675 3H5v1.5h1.27l.818 8.997a2.75 2.75 0 0 0 2.739 2.501h4.347a2.75 2.75 0 0 0 2.738-2.5L17.73 8.5H19V7h-3.325A3.751 3.751 0 0 0 12 4Zm4.224 4.5H7.776l.806 8.861a1.25 1.25 0 0 0 1.245 1.137h4.347a1.25 1.25 0 0 0 1.245-1.137l.805-8.861Z" }) }); 16335 16336 // packages/icons/build-module/library/unseen.mjs 16337 var import_primitives36 = __toESM(require_primitives(), 1); 16338 var import_jsx_runtime66 = __toESM(require_jsx_runtime(), 1); 16339 var unseen_default = /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(import_primitives36.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(import_primitives36.Path, { d: "M20.7 12.7s0-.1-.1-.2c0-.2-.2-.4-.4-.6-.3-.5-.9-1.2-1.6-1.8-.7-.6-1.5-1.3-2.6-1.8l-.6 1.4c.9.4 1.6 1 2.1 1.5.6.6 1.1 1.2 1.4 1.6.1.2.3.4.3.5v.1l.7-.3.7-.3Zm-5.2-9.3-1.8 4c-.5-.1-1.1-.2-1.7-.2-3 0-5.2 1.4-6.6 2.7-.7.7-1.2 1.3-1.6 1.8-.2.3-.3.5-.4.6 0 0 0 .1-.1.2s0 0 .7.3l.7.3V13c0-.1.2-.3.3-.5.3-.4.7-1 1.4-1.6 1.2-1.2 3-2.3 5.5-2.3H13v.3c-.4 0-.8-.1-1.1-.1-1.9 0-3.5 1.6-3.5 3.5s.6 2.3 1.6 2.9l-2 4.4.9.4 7.6-16.2-.9-.4Zm-3 12.6c1.7-.2 3-1.7 3-3.5s-.2-1.4-.6-1.9L12.4 16Z" }) }); 16340 16341 // packages/ui/build-module/collapsible-card/context.mjs 16342 var import_element25 = __toESM(require_element(), 1); 16343 var HeaderDescriptionIdContext = (0, import_element25.createContext)({ 16344 setDescriptionId: () => { 16345 } 16346 }); 16347 16348 // packages/ui/build-module/collapsible-card/header.mjs 16349 var import_jsx_runtime67 = __toESM(require_jsx_runtime(), 1); 16350 var STYLE_HASH_ATTRIBUTE8 = "data-wp-hash"; 16351 function getRuntime8() { 16352 const globalScope = globalThis; 16353 if (globalScope.__wpStyleRuntime) { 16354 return globalScope.__wpStyleRuntime; 16355 } 16356 globalScope.__wpStyleRuntime = { 16357 documents: /* @__PURE__ */ new Map(), 16358 styles: /* @__PURE__ */ new Map(), 16359 injectedStyles: /* @__PURE__ */ new WeakMap() 16360 }; 16361 if (typeof document !== "undefined") { 16362 registerDocument8(document); 16363 } 16364 return globalScope.__wpStyleRuntime; 16365 } 16366 function documentContainsStyleHash8(targetDocument, hash) { 16367 if (!targetDocument.head) { 16368 return false; 16369 } 16370 for (const style of targetDocument.head.querySelectorAll( 16371 `style[$STYLE_HASH_ATTRIBUTE8}]` 16372 )) { 16373 if (style.getAttribute(STYLE_HASH_ATTRIBUTE8) === hash) { 16374 return true; 16375 } 16376 } 16377 return false; 16378 } 16379 function injectStyle8(targetDocument, hash, css) { 16380 if (!targetDocument.head) { 16381 return; 16382 } 16383 const runtime = getRuntime8(); 16384 let injectedStyles = runtime.injectedStyles.get(targetDocument); 16385 if (!injectedStyles) { 16386 injectedStyles = /* @__PURE__ */ new Set(); 16387 runtime.injectedStyles.set(targetDocument, injectedStyles); 16388 } 16389 if (injectedStyles.has(hash)) { 16390 return; 16391 } 16392 if (documentContainsStyleHash8(targetDocument, hash)) { 16393 injectedStyles.add(hash); 16394 return; 16395 } 16396 const style = targetDocument.createElement("style"); 16397 style.setAttribute(STYLE_HASH_ATTRIBUTE8, hash); 16398 style.appendChild(targetDocument.createTextNode(css)); 16399 targetDocument.head.appendChild(style); 16400 injectedStyles.add(hash); 16401 } 16402 function registerDocument8(targetDocument) { 16403 const runtime = getRuntime8(); 16404 runtime.documents.set( 16405 targetDocument, 16406 (runtime.documents.get(targetDocument) ?? 0) + 1 16407 ); 16408 for (const [hash, css] of runtime.styles) { 16409 injectStyle8(targetDocument, hash, css); 16410 } 16411 return () => { 16412 const count = runtime.documents.get(targetDocument); 16413 if (count === void 0) { 16414 return; 16415 } 16416 if (count <= 1) { 16417 runtime.documents.delete(targetDocument); 16418 return; 16419 } 16420 runtime.documents.set(targetDocument, count - 1); 16421 }; 16422 } 16423 function registerStyle8(hash, css) { 16424 const runtime = getRuntime8(); 16425 runtime.styles.set(hash, css); 16426 for (const targetDocument of runtime.documents.keys()) { 16427 injectStyle8(targetDocument, hash, css); 16428 } 16429 } 16430 if (typeof process === "undefined" || true) { 16431 registerStyle8("f1b9bb6252", "@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;@layer wp-ui-components{._626190151275d6d3__heading-wrapper{--_gcd-heading-color:inherit;--_gcd-heading-font-size:inherit;--_gcd-heading-font-weight:inherit;--_gcd-heading-margin:0;font-family:inherit;line-height:inherit}.cab17c7a373cb60d__header-content{flex:1;min-width:0}.dd89d27c4f15912d__header-trigger-positioner{align-self:center;flex-shrink:0;max-height:0;overflow:visible}.bcfab5f2448bafef__header-trigger-wrapper{border-radius:var(--wpds-border-radius-sm,2px);display:flex;translate:0 -50%}._3106f8d2b0330faa__header-trigger{@media not (prefers-reduced-motion){transition:rotate .15s ease-out}}._5d2dfcb4085c6d0f__header[data-panel-open] ._3106f8d2b0330faa__header-trigger{rotate:180deg}._5d2dfcb4085c6d0f__header[data-disabled] ._3106f8d2b0330faa__header-trigger{color:var(--wpds-color-fg-interactive-neutral-disabled,#8d8d8d)}.e34cf37ccd0d81e0__content{height:var(--collapsible-panel-height);margin-block-start:var(--wp-ui-card-header-content-margin);overflow:hidden;&._165c4572592944b2__overflowVisible{overflow:visible}&[hidden]:not([hidden=until-found]){display:none}&[data-ending-style],&[data-starting-style]{height:0}@media not (prefers-reduced-motion){transition:all .15s ease-out}}}@layer wp-ui-compositions{._41bfdbf7b6c087c2__content-inner{padding-block-start:0}._5d2dfcb4085c6d0f__header{align-items:stretch;display:flex;flex-direction:row;gap:var(--wpds-dimension-gap-sm,8px);outline:none;&:not([data-disabled]){cursor:var(--wpds-cursor-control,pointer)}}}"); 16432 } 16433 var style_default8 = { "heading-wrapper": "_626190151275d6d3__heading-wrapper", "header-content": "cab17c7a373cb60d__header-content", "header-trigger-positioner": "dd89d27c4f15912d__header-trigger-positioner", "header-trigger-wrapper": "bcfab5f2448bafef__header-trigger-wrapper", "header-trigger": "_3106f8d2b0330faa__header-trigger", "header": "_5d2dfcb4085c6d0f__header", "content": "e34cf37ccd0d81e0__content", "overflowVisible": "_165c4572592944b2__overflowVisible", "content-inner": "_41bfdbf7b6c087c2__content-inner" }; 16434 if (typeof process === "undefined" || true) { 16435 registerStyle8("1fb29d3a3c", "._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);&: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,#0000);border:var(--_gcd-input-border,none);border-radius:var(--_gcd-input-border-radius,0);box-shadow:var(--_gcd-input-box-shadow,0 0 0 #0000);color:var(--_gcd-input-color,var(--wpds-color-fg-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,#0000);border-color:var(--_gcd-input-border-color-disabled,#0000);box-shadow:var(--_gcd-input-box-shadow-disabled,none);color:var(--_gcd-input-color-disabled,var(--wpds-color-fg-interactive-neutral-disabled,#8d8d8d))}&::placeholder{color:var(--_gcd-input-placeholder-color,var(--wpds-color-fg-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 #0000)}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-fg-content-neutral,#1e1e1e));font-size:var(--_gcd-heading-font-size,inherit);font-weight:var(--_gcd-heading-font-weight,var(--wpds-typography-font-weight-medium,499));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 #0000);transition:var(--_gcd-a-transition,none)}"); 16436 } 16437 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" }; 16438 if (typeof process === "undefined" || true) { 16439 registerStyle8("2a5ab8f3a7", "@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;@layer wp-ui-utilities{._08e8a2e44959f892__outset-ring--focus,._970d04df7376df67__outset-ring--focus-within-except-active,.c5cb3ee4bddaa8e4__outset-ring--focus-within-visible,.cd83dfc2126a0846__outset-ring--focus-within,.d0541bc9dd9dc7b6__outset-ring--focus-visible,.e25b2bdd7aa21721__outset-ring--focus-except-active,.ecadb9e080e2dfa5__outset-ring--focus-parent-visible{@media not (prefers-reduced-motion){--_gcd-a-transition:outline 0.1s ease-out;transition:outline .1s ease-out}outline:0 solid #0000;outline-offset:1px}._08e8a2e44959f892__outset-ring--focus:focus,._970d04df7376df67__outset-ring--focus-within-except-active:focus-within:not(:has(:active)),.c5cb3ee4bddaa8e4__outset-ring--focus-within-visible:focus-within:has(:focus-visible),.cd83dfc2126a0846__outset-ring--focus-within:focus-within,.d0541bc9dd9dc7b6__outset-ring--focus-visible:focus-visible,.e25b2bdd7aa21721__outset-ring--focus-except-active:focus:not(:active),:focus-visible .ecadb9e080e2dfa5__outset-ring--focus-parent-visible{--_gcd-a-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--wpds-color-stroke-focus-brand,var(--wp-admin-theme-color,#3858e9));--_gcd-div-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--wpds-color-stroke-focus-brand,var(--wp-admin-theme-color,#3858e9));outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--wpds-color-stroke-focus-brand,var(--wp-admin-theme-color,#3858e9))}}"); 16440 } 16441 var focus_default2 = { "outset-ring--focus": "_08e8a2e44959f892__outset-ring--focus", "outset-ring--focus-except-active": "e25b2bdd7aa21721__outset-ring--focus-except-active", "outset-ring--focus-visible": "d0541bc9dd9dc7b6__outset-ring--focus-visible", "outset-ring--focus-within": "cd83dfc2126a0846__outset-ring--focus-within", "outset-ring--focus-within-except-active": "_970d04df7376df67__outset-ring--focus-within-except-active", "outset-ring--focus-within-visible": "c5cb3ee4bddaa8e4__outset-ring--focus-within-visible", "outset-ring--focus-parent-visible": "ecadb9e080e2dfa5__outset-ring--focus-parent-visible" }; 16442 var Header2 = (0, import_element26.forwardRef)( 16443 function CollapsibleCardHeader({ children, className, render: render4, ...restProps }, ref) { 16444 const [descriptionId, setDescriptionId] = (0, import_element26.useState)(); 16445 const contextValue = (0, import_element26.useMemo)( 16446 () => ({ setDescriptionId }), 16447 [setDescriptionId] 16448 ); 16449 return useRender({ 16450 defaultTagName: "div", 16451 render: render4, 16452 ref, 16453 props: mergeProps(restProps, { 16454 className: clsx_default( 16455 global_css_defense_default3.heading, 16456 style_default8["heading-wrapper"], 16457 className 16458 ), 16459 children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(HeaderDescriptionIdContext.Provider, { value: contextValue, children: /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)( 16460 Trigger, 16461 { 16462 className: style_default8.header, 16463 render: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Header, {}), 16464 nativeButton: false, 16465 "aria-describedby": descriptionId, 16466 children: [ 16467 /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("div", { className: style_default8["header-content"], children }), 16468 /* @__PURE__ */ (0, import_jsx_runtime67.jsx)( 16469 "div", 16470 { 16471 className: clsx_default( 16472 style_default8["header-trigger-positioner"] 16473 ), 16474 children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)( 16475 "div", 16476 { 16477 className: clsx_default( 16478 style_default8["header-trigger-wrapper"], 16479 global_css_defense_default3.div, 16480 // While the interactive trigger element is the whole header, 16481 // the focus ring will be displayed only on the icon to visually 16482 // emulate it being the button. 16483 focus_default2["outset-ring--focus-parent-visible"] 16484 ), 16485 children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)( 16486 Icon, 16487 { 16488 icon: chevron_down_default, 16489 className: style_default8["header-trigger"] 16490 } 16491 ) 16492 } 16493 ) 16494 } 16495 ) 16496 ] 16497 } 16498 ) }) 16499 }) 16500 }); 16501 } 16502 ); 16503 16504 // packages/ui/build-module/collapsible-card/header-description.mjs 16505 var import_element27 = __toESM(require_element(), 1); 16506 var import_jsx_runtime68 = __toESM(require_jsx_runtime(), 1); 16507 var HeaderDescription = (0, import_element27.forwardRef)(function CollapsibleCardHeaderDescription({ children, className, ...restProps }, ref) { 16508 const descriptionId = (0, import_element27.useId)(); 16509 const { setDescriptionId } = (0, import_element27.useContext)(HeaderDescriptionIdContext); 16510 (0, import_element27.useEffect)(() => { 16511 setDescriptionId(descriptionId); 16512 return () => setDescriptionId(void 0); 16513 }, [descriptionId, setDescriptionId]); 16514 return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)( 16515 "div", 16516 { 16517 ref, 16518 id: descriptionId, 16519 "aria-hidden": "true", 16520 className, 16521 ...restProps, 16522 children 16523 } 16524 ); 16525 }); 16526 16527 // packages/ui/build-module/collapsible-card/content.mjs 16528 var import_element28 = __toESM(require_element(), 1); 16529 var import_jsx_runtime69 = __toESM(require_jsx_runtime(), 1); 16530 var STYLE_HASH_ATTRIBUTE9 = "data-wp-hash"; 16531 function getRuntime9() { 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 registerDocument9(document); 16543 } 16544 return globalScope.__wpStyleRuntime; 16545 } 16546 function documentContainsStyleHash9(targetDocument, hash) { 16547 if (!targetDocument.head) { 16548 return false; 16549 } 16550 for (const style of targetDocument.head.querySelectorAll( 16551 `style[$STYLE_HASH_ATTRIBUTE9}]` 16552 )) { 16553 if (style.getAttribute(STYLE_HASH_ATTRIBUTE9) === hash) { 16554 return true; 16555 } 16556 } 16557 return false; 16558 } 16559 function injectStyle9(targetDocument, hash, css) { 16560 if (!targetDocument.head) { 16561 return; 16562 } 16563 const runtime = getRuntime9(); 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 (documentContainsStyleHash9(targetDocument, hash)) { 16573 injectedStyles.add(hash); 16574 return; 16575 } 16576 const style = targetDocument.createElement("style"); 16577 style.setAttribute(STYLE_HASH_ATTRIBUTE9, hash); 16578 style.appendChild(targetDocument.createTextNode(css)); 16579 targetDocument.head.appendChild(style); 16580 injectedStyles.add(hash); 16581 } 16582 function registerDocument9(targetDocument) { 16583 const runtime = getRuntime9(); 16584 runtime.documents.set( 16585 targetDocument, 16586 (runtime.documents.get(targetDocument) ?? 0) + 1 16587 ); 16588 for (const [hash, css] of runtime.styles) { 16589 injectStyle9(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 registerStyle9(hash, css) { 16604 const runtime = getRuntime9(); 16605 runtime.styles.set(hash, css); 16606 for (const targetDocument of runtime.documents.keys()) { 16607 injectStyle9(targetDocument, hash, css); 16608 } 16609 } 16610 if (typeof process === "undefined" || true) { 16611 registerStyle9("f1b9bb6252", "@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;@layer wp-ui-components{._626190151275d6d3__heading-wrapper{--_gcd-heading-color:inherit;--_gcd-heading-font-size:inherit;--_gcd-heading-font-weight:inherit;--_gcd-heading-margin:0;font-family:inherit;line-height:inherit}.cab17c7a373cb60d__header-content{flex:1;min-width:0}.dd89d27c4f15912d__header-trigger-positioner{align-self:center;flex-shrink:0;max-height:0;overflow:visible}.bcfab5f2448bafef__header-trigger-wrapper{border-radius:var(--wpds-border-radius-sm,2px);display:flex;translate:0 -50%}._3106f8d2b0330faa__header-trigger{@media not (prefers-reduced-motion){transition:rotate .15s ease-out}}._5d2dfcb4085c6d0f__header[data-panel-open] ._3106f8d2b0330faa__header-trigger{rotate:180deg}._5d2dfcb4085c6d0f__header[data-disabled] ._3106f8d2b0330faa__header-trigger{color:var(--wpds-color-fg-interactive-neutral-disabled,#8d8d8d)}.e34cf37ccd0d81e0__content{height:var(--collapsible-panel-height);margin-block-start:var(--wp-ui-card-header-content-margin);overflow:hidden;&._165c4572592944b2__overflowVisible{overflow:visible}&[hidden]:not([hidden=until-found]){display:none}&[data-ending-style],&[data-starting-style]{height:0}@media not (prefers-reduced-motion){transition:all .15s ease-out}}}@layer wp-ui-compositions{._41bfdbf7b6c087c2__content-inner{padding-block-start:0}._5d2dfcb4085c6d0f__header{align-items:stretch;display:flex;flex-direction:row;gap:var(--wpds-dimension-gap-sm,8px);outline:none;&:not([data-disabled]){cursor:var(--wpds-cursor-control,pointer)}}}"); 16612 } 16613 var style_default9 = { "heading-wrapper": "_626190151275d6d3__heading-wrapper", "header-content": "cab17c7a373cb60d__header-content", "header-trigger-positioner": "dd89d27c4f15912d__header-trigger-positioner", "header-trigger-wrapper": "bcfab5f2448bafef__header-trigger-wrapper", "header-trigger": "_3106f8d2b0330faa__header-trigger", "header": "_5d2dfcb4085c6d0f__header", "content": "e34cf37ccd0d81e0__content", "overflowVisible": "_165c4572592944b2__overflowVisible", "content-inner": "_41bfdbf7b6c087c2__content-inner" }; 16614 var Content2 = (0, import_element28.forwardRef)( 16615 function CollapsibleCardContent({ className, render: render4, children, hiddenUntilFound = true, ...restProps }, ref) { 16616 return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)( 16617 Panel, 16618 { 16619 ref, 16620 className: (state) => clsx_default( 16621 style_default9.content, 16622 state.open && state.transitionStatus === "idle" && style_default9.overflowVisible, 16623 className 16624 ), 16625 hiddenUntilFound, 16626 ...restProps, 16627 children: /* @__PURE__ */ (0, import_jsx_runtime69.jsx)( 16628 Content, 16629 { 16630 className: style_default9["content-inner"], 16631 render: render4, 16632 children 16633 } 16634 ) 16635 } 16636 ); 16637 } 16638 ); 16639 16640 // packages/ui/build-module/alert-dialog/index.mjs 16641 var alert_dialog_exports = {}; 16642 __export(alert_dialog_exports, { 16643 Popup: () => Popup, 16644 Portal: () => Portal, 16645 Root: () => Root4, 16646 Trigger: () => Trigger2 16647 }); 16648 16649 // packages/ui/build-module/alert-dialog/root.mjs 16650 var import_element30 = __toESM(require_element(), 1); 16651 import { speak as speak2 } from "@wordpress/a11y"; 16652 16653 // packages/ui/build-module/alert-dialog/context.mjs 16654 var import_element29 = __toESM(require_element(), 1); 16655 var noop4 = async () => { 16656 }; 16657 var AlertDialogContext = (0, import_element29.createContext)({ 16658 phase: "idle", 16659 showSpinner: false, 16660 errorMessage: void 0, 16661 confirm: noop4 16662 }); 16663 16664 // packages/ui/build-module/alert-dialog/root.mjs 16665 var import_jsx_runtime70 = __toESM(require_jsx_runtime(), 1); 16666 function isThenable(value) { 16667 return value !== null && value !== void 0 && typeof value.then === "function"; 16668 } 16669 function Root4({ 16670 children, 16671 open: openProp, 16672 onOpenChange, 16673 defaultOpen, 16674 onConfirm 16675 }) { 16676 const [internalOpen, setInternalOpen] = (0, import_element30.useState)(defaultOpen ?? false); 16677 const [phase, setPhase] = (0, import_element30.useState)("idle"); 16678 const [showSpinner, setShowSpinner] = (0, import_element30.useState)(false); 16679 const [errorMessage, setErrorMessage] = (0, import_element30.useState)(); 16680 const actionsRef = (0, import_element30.useRef)(null); 16681 const onConfirmRef = (0, import_element30.useRef)(onConfirm); 16682 onConfirmRef.current = onConfirm; 16683 const phaseRef = (0, import_element30.useRef)(phase); 16684 phaseRef.current = phase; 16685 const confirmIdRef = (0, import_element30.useRef)(0); 16686 const effectiveOpen = openProp ?? internalOpen; 16687 (0, import_element30.useEffect)(() => { 16688 if (effectiveOpen && phase === "closing") { 16689 phaseRef.current = "idle"; 16690 setPhase("idle"); 16691 setShowSpinner(false); 16692 } 16693 }, [effectiveOpen, phase]); 16694 const handleOpenChange = (0, import_element30.useCallback)( 16695 (nextOpen, eventDetails) => { 16696 if (!nextOpen && phaseRef.current === "pending") { 16697 return; 16698 } 16699 if (!nextOpen && phaseRef.current === "idle") { 16700 phaseRef.current = "closing"; 16701 setPhase("closing"); 16702 } 16703 setInternalOpen(nextOpen); 16704 onOpenChange?.(nextOpen, eventDetails); 16705 }, 16706 [onOpenChange] 16707 ); 16708 const confirm = (0, import_element30.useCallback)(async () => { 16709 if (phaseRef.current !== "idle") { 16710 return; 16711 } 16712 phaseRef.current = "pending"; 16713 setPhase("pending"); 16714 setErrorMessage(void 0); 16715 const id = ++confirmIdRef.current; 16716 try { 16717 const rawResult = onConfirmRef.current?.(); 16718 if (isThenable(rawResult)) { 16719 setShowSpinner(true); 16720 } 16721 const result = await Promise.resolve(rawResult); 16722 if (confirmIdRef.current !== id) { 16723 return; 16724 } 16725 if (result?.error) { 16726 phaseRef.current = "idle"; 16727 setPhase("idle"); 16728 setShowSpinner(false); 16729 setErrorMessage(result.error); 16730 speak2(result.error, "assertive"); 16731 return; 16732 } 16733 const shouldClose = result?.close !== false; 16734 if (shouldClose) { 16735 phaseRef.current = "closing"; 16736 setPhase("closing"); 16737 actionsRef.current?.close(); 16738 } else { 16739 phaseRef.current = "idle"; 16740 setPhase("idle"); 16741 setShowSpinner(false); 16742 } 16743 } catch (error2) { 16744 if (confirmIdRef.current !== id) { 16745 return; 16746 } 16747 phaseRef.current = "idle"; 16748 setPhase("idle"); 16749 setShowSpinner(false); 16750 console.error(error2); 16751 } 16752 }, []); 16753 const handleOpenChangeComplete = (0, import_element30.useCallback)((open) => { 16754 if (!open) { 16755 confirmIdRef.current++; 16756 phaseRef.current = "idle"; 16757 setPhase("idle"); 16758 setShowSpinner(false); 16759 setErrorMessage(void 0); 16760 } 16761 }, []); 16762 const contextValue = (0, import_element30.useMemo)( 16763 () => ({ 16764 phase, 16765 showSpinner, 16766 errorMessage, 16767 confirm 16768 }), 16769 [phase, showSpinner, errorMessage, confirm] 16770 ); 16771 return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)( 16772 index_parts_exports.Root, 16773 { 16774 open: effectiveOpen, 16775 defaultOpen, 16776 onOpenChange: handleOpenChange, 16777 onOpenChangeComplete: handleOpenChangeComplete, 16778 actionsRef, 16779 children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(AlertDialogContext.Provider, { value: contextValue, children }) 16780 } 16781 ); 16782 } 16783 16784 // packages/ui/build-module/alert-dialog/trigger.mjs 16785 var import_element31 = __toESM(require_element(), 1); 16786 var import_jsx_runtime71 = __toESM(require_jsx_runtime(), 1); 16787 var Trigger2 = (0, import_element31.forwardRef)( 16788 function AlertDialogTrigger(props, ref) { 16789 return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(index_parts_exports.Trigger, { ref, ...props }); 16790 } 16791 ); 16792 16793 // packages/ui/build-module/alert-dialog/popup.mjs 16794 var import_element37 = __toESM(require_element(), 1); 16795 var import_compose = __toESM(require_compose(), 1); 16796 var import_i18n2 = __toESM(require_i18n(), 1); 16797 var import_theme = __toESM(require_theme(), 1); 16798 16799 // packages/ui/build-module/utils/render-slot-with-children.mjs 16800 var import_element32 = __toESM(require_element(), 1); 16801 function renderSlotWithChildren(slot, defaultSlot, children) { 16802 return (0, import_element32.cloneElement)( 16803 slot ?? defaultSlot, 16804 { children } 16805 ); 16806 } 16807 16808 // packages/ui/build-module/utils/use-deprioritized-initial-focus.mjs 16809 var import_element33 = __toESM(require_element(), 1); 16810 16811 // node_modules/tabbable/dist/index.esm.js 16812 var candidateSelectors = ["input:not([inert]):not([inert] *)", "select:not([inert]):not([inert] *)", "textarea:not([inert]):not([inert] *)", "a[href]:not([inert]):not([inert] *)", "button:not([inert]):not([inert] *)", "[tabindex]:not(slot):not([inert]):not([inert] *)", "audio[controls]:not([inert]):not([inert] *)", "video[controls]:not([inert]):not([inert] *)", '[contenteditable]:not([contenteditable="false"]):not([inert]):not([inert] *)', "details>summary:first-of-type:not([inert]):not([inert] *)", "details:not([inert]):not([inert] *)"]; 16813 var candidateSelector = /* @__PURE__ */ candidateSelectors.join(","); 16814 var NoElement = typeof Element === "undefined"; 16815 var matches = NoElement ? function() { 16816 } : Element.prototype.matches || Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector; 16817 var getRootNode = !NoElement && Element.prototype.getRootNode ? function(element) { 16818 var _element$getRootNode; 16819 return element === null || element === void 0 ? void 0 : (_element$getRootNode = element.getRootNode) === null || _element$getRootNode === void 0 ? void 0 : _element$getRootNode.call(element); 16820 } : function(element) { 16821 return element === null || element === void 0 ? void 0 : element.ownerDocument; 16822 }; 16823 var _isInert = function isInert(node, lookUp) { 16824 var _node$getAttribute; 16825 if (lookUp === void 0) { 16826 lookUp = true; 16827 } 16828 var inertAtt = node === null || node === void 0 ? void 0 : (_node$getAttribute = node.getAttribute) === null || _node$getAttribute === void 0 ? void 0 : _node$getAttribute.call(node, "inert"); 16829 var inert = inertAtt === "" || inertAtt === "true"; 16830 var result = inert || lookUp && node && // closest does not exist on shadow roots, so we fall back to a manual 16831 // lookup upward, in case it is not defined. 16832 (typeof node.closest === "function" ? node.closest("[inert]") : _isInert(node.parentNode)); 16833 return result; 16834 }; 16835 var isContentEditable = function isContentEditable2(node) { 16836 var _node$getAttribute2; 16837 var attValue = node === null || node === void 0 ? void 0 : (_node$getAttribute2 = node.getAttribute) === null || _node$getAttribute2 === void 0 ? void 0 : _node$getAttribute2.call(node, "contenteditable"); 16838 return attValue === "" || attValue === "true"; 16839 }; 16840 var getCandidates = function getCandidates2(el, includeContainer, filter) { 16841 if (_isInert(el)) { 16842 return []; 16843 } 16844 var candidates = Array.prototype.slice.apply(el.querySelectorAll(candidateSelector)); 16845 if (includeContainer && matches.call(el, candidateSelector)) { 16846 candidates.unshift(el); 16847 } 16848 candidates = candidates.filter(filter); 16849 return candidates; 16850 }; 16851 var _getCandidatesIteratively = function getCandidatesIteratively(elements, includeContainer, options) { 16852 var candidates = []; 16853 var elementsToCheck = Array.from(elements); 16854 while (elementsToCheck.length) { 16855 var element = elementsToCheck.shift(); 16856 if (_isInert(element, false)) { 16857 continue; 16858 } 16859 if (element.tagName === "SLOT") { 16860 var assigned = element.assignedElements(); 16861 var content = assigned.length ? assigned : element.children; 16862 var nestedCandidates = _getCandidatesIteratively(content, true, options); 16863 if (options.flatten) { 16864 candidates.push.apply(candidates, nestedCandidates); 16865 } else { 16866 candidates.push({ 16867 scopeParent: element, 16868 candidates: nestedCandidates 16869 }); 16870 } 16871 } else { 16872 var validCandidate = matches.call(element, candidateSelector); 16873 if (validCandidate && options.filter(element) && (includeContainer || !elements.includes(element))) { 16874 candidates.push(element); 16875 } 16876 var shadowRoot = element.shadowRoot || // check for an undisclosed shadow 16877 typeof options.getShadowRoot === "function" && options.getShadowRoot(element); 16878 var validShadowRoot = !_isInert(shadowRoot, false) && (!options.shadowRootFilter || options.shadowRootFilter(element)); 16879 if (shadowRoot && validShadowRoot) { 16880 var _nestedCandidates = _getCandidatesIteratively(shadowRoot === true ? element.children : shadowRoot.children, true, options); 16881 if (options.flatten) { 16882 candidates.push.apply(candidates, _nestedCandidates); 16883 } else { 16884 candidates.push({ 16885 scopeParent: element, 16886 candidates: _nestedCandidates 16887 }); 16888 } 16889 } else { 16890 elementsToCheck.unshift.apply(elementsToCheck, element.children); 16891 } 16892 } 16893 } 16894 return candidates; 16895 }; 16896 var hasTabIndex = function hasTabIndex2(node) { 16897 return !isNaN(parseInt(node.getAttribute("tabindex"), 10)); 16898 }; 16899 var getTabIndex2 = function getTabIndex3(node) { 16900 if (!node) { 16901 throw new Error("No node provided"); 16902 } 16903 if (node.tabIndex < 0) { 16904 if ((/^(AUDIO|VIDEO|DETAILS)$/.test(node.tagName) || isContentEditable(node)) && !hasTabIndex(node)) { 16905 return 0; 16906 } 16907 } 16908 return node.tabIndex; 16909 }; 16910 var getSortOrderTabIndex = function getSortOrderTabIndex2(node, isScope) { 16911 var tabIndex = getTabIndex2(node); 16912 if (tabIndex < 0 && isScope && !hasTabIndex(node)) { 16913 return 0; 16914 } 16915 return tabIndex; 16916 }; 16917 var sortOrderedTabbables = function sortOrderedTabbables2(a2, b2) { 16918 return a2.tabIndex === b2.tabIndex ? a2.documentOrder - b2.documentOrder : a2.tabIndex - b2.tabIndex; 16919 }; 16920 var isInput = function isInput2(node) { 16921 return node.tagName === "INPUT"; 16922 }; 16923 var isHiddenInput = function isHiddenInput2(node) { 16924 return isInput(node) && node.type === "hidden"; 16925 }; 16926 var isDetailsWithSummary = function isDetailsWithSummary2(node) { 16927 var r3 = node.tagName === "DETAILS" && Array.prototype.slice.apply(node.children).some(function(child) { 16928 return child.tagName === "SUMMARY"; 16929 }); 16930 return r3; 16931 }; 16932 var getCheckedRadio = function getCheckedRadio2(nodes, form2) { 16933 for (var i2 = 0; i2 < nodes.length; i2++) { 16934 if (nodes[i2].checked && nodes[i2].form === form2) { 16935 return nodes[i2]; 16936 } 16937 } 16938 }; 16939 var isTabbableRadio2 = function isTabbableRadio3(node) { 16940 if (!node.name) { 16941 return true; 16942 } 16943 var radioScope = node.form || getRootNode(node); 16944 var queryRadios = function queryRadios2(name) { 16945 return radioScope.querySelectorAll('input[type="radio"][name="' + name + '"]'); 16946 }; 16947 var radioSet; 16948 if (typeof window !== "undefined" && typeof window.CSS !== "undefined" && typeof window.CSS.escape === "function") { 16949 radioSet = queryRadios(window.CSS.escape(node.name)); 16950 } else { 16951 try { 16952 radioSet = queryRadios(node.name); 16953 } catch (err) { 16954 console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s", err.message); 16955 return false; 16956 } 16957 } 16958 var checked = getCheckedRadio(radioSet, node.form); 16959 return !checked || checked === node; 16960 }; 16961 var isRadio = function isRadio2(node) { 16962 return isInput(node) && node.type === "radio"; 16963 }; 16964 var isNonTabbableRadio = function isNonTabbableRadio2(node) { 16965 return isRadio(node) && !isTabbableRadio2(node); 16966 }; 16967 var isNodeAttached = function isNodeAttached2(node) { 16968 var _nodeRoot; 16969 var nodeRoot = node && getRootNode(node); 16970 var nodeRootHost = (_nodeRoot = nodeRoot) === null || _nodeRoot === void 0 ? void 0 : _nodeRoot.host; 16971 var attached = false; 16972 if (nodeRoot && nodeRoot !== node) { 16973 var _nodeRootHost, _nodeRootHost$ownerDo, _node$ownerDocument; 16974 attached = !!((_nodeRootHost = nodeRootHost) !== null && _nodeRootHost !== void 0 && (_nodeRootHost$ownerDo = _nodeRootHost.ownerDocument) !== null && _nodeRootHost$ownerDo !== void 0 && _nodeRootHost$ownerDo.contains(nodeRootHost) || node !== null && node !== void 0 && (_node$ownerDocument = node.ownerDocument) !== null && _node$ownerDocument !== void 0 && _node$ownerDocument.contains(node)); 16975 while (!attached && nodeRootHost) { 16976 var _nodeRoot2, _nodeRootHost2, _nodeRootHost2$ownerD; 16977 nodeRoot = getRootNode(nodeRootHost); 16978 nodeRootHost = (_nodeRoot2 = nodeRoot) === null || _nodeRoot2 === void 0 ? void 0 : _nodeRoot2.host; 16979 attached = !!((_nodeRootHost2 = nodeRootHost) !== null && _nodeRootHost2 !== void 0 && (_nodeRootHost2$ownerD = _nodeRootHost2.ownerDocument) !== null && _nodeRootHost2$ownerD !== void 0 && _nodeRootHost2$ownerD.contains(nodeRootHost)); 16980 } 16981 } 16982 return attached; 16983 }; 16984 var isZeroArea = function isZeroArea2(node) { 16985 var _node$getBoundingClie = node.getBoundingClientRect(), width = _node$getBoundingClie.width, height = _node$getBoundingClie.height; 16986 return width === 0 && height === 0; 16987 }; 16988 var isHidden = function isHidden2(node, _ref) { 16989 var displayCheck = _ref.displayCheck, getShadowRoot = _ref.getShadowRoot; 16990 if (displayCheck === "full-native") { 16991 if ("checkVisibility" in node) { 16992 var visible = node.checkVisibility({ 16993 // Checking opacity might be desirable for some use cases, but natively, 16994 // opacity zero elements _are_ focusable and tabbable. 16995 checkOpacity: false, 16996 opacityProperty: false, 16997 contentVisibilityAuto: true, 16998 visibilityProperty: true, 16999 // This is an alias for `visibilityProperty`. Contemporary browsers 17000 // support both. However, this alias has wider browser support (Chrome 17001 // >= 105 and Firefox >= 106, vs. Chrome >= 121 and Firefox >= 122), so 17002 // we include it anyway. 17003 checkVisibilityCSS: true 17004 }); 17005 return !visible; 17006 } 17007 } 17008 if (getComputedStyle(node).visibility === "hidden") { 17009 return true; 17010 } 17011 var isDirectSummary = matches.call(node, "details>summary:first-of-type"); 17012 var nodeUnderDetails = isDirectSummary ? node.parentElement : node; 17013 if (matches.call(nodeUnderDetails, "details:not([open]) *")) { 17014 return true; 17015 } 17016 if (!displayCheck || displayCheck === "full" || // full-native can run this branch when it falls through in case 17017 // Element#checkVisibility is unsupported 17018 displayCheck === "full-native" || displayCheck === "legacy-full") { 17019 if (typeof getShadowRoot === "function") { 17020 var originalNode = node; 17021 while (node) { 17022 var parentElement = node.parentElement; 17023 var rootNode = getRootNode(node); 17024 if (parentElement && !parentElement.shadowRoot && getShadowRoot(parentElement) === true) { 17025 return isZeroArea(node); 17026 } else if (node.assignedSlot) { 17027 node = node.assignedSlot; 17028 } else if (!parentElement && rootNode !== node.ownerDocument) { 17029 node = rootNode.host; 17030 } else { 17031 node = parentElement; 17032 } 17033 } 17034 node = originalNode; 17035 } 17036 if (isNodeAttached(node)) { 17037 return !node.getClientRects().length; 17038 } 17039 if (displayCheck !== "legacy-full") { 17040 return true; 17041 } 17042 } else if (displayCheck === "non-zero-area") { 17043 return isZeroArea(node); 17044 } 17045 return false; 17046 }; 17047 var isDisabledFromFieldset = function isDisabledFromFieldset2(node) { 17048 if (/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(node.tagName)) { 17049 var parentNode = node.parentElement; 17050 while (parentNode) { 17051 if (parentNode.tagName === "FIELDSET" && parentNode.disabled) { 17052 for (var i2 = 0; i2 < parentNode.children.length; i2++) { 17053 var child = parentNode.children.item(i2); 17054 if (child.tagName === "LEGEND") { 17055 return matches.call(parentNode, "fieldset[disabled] *") ? true : !child.contains(node); 17056 } 17057 } 17058 return true; 17059 } 17060 parentNode = parentNode.parentElement; 17061 } 17062 } 17063 return false; 17064 }; 17065 var isNodeMatchingSelectorFocusable = function isNodeMatchingSelectorFocusable2(options, node) { 17066 if (node.disabled || isHiddenInput(node) || isHidden(node, options) || // For a details element with a summary, the summary element gets the focus 17067 isDetailsWithSummary(node) || isDisabledFromFieldset(node)) { 17068 return false; 17069 } 17070 return true; 17071 }; 17072 var isNodeMatchingSelectorTabbable = function isNodeMatchingSelectorTabbable2(options, node) { 17073 if (isNonTabbableRadio(node) || getTabIndex2(node) < 0 || !isNodeMatchingSelectorFocusable(options, node)) { 17074 return false; 17075 } 17076 return true; 17077 }; 17078 var isShadowRootTabbable = function isShadowRootTabbable2(shadowHostNode) { 17079 var tabIndex = parseInt(shadowHostNode.getAttribute("tabindex"), 10); 17080 if (isNaN(tabIndex) || tabIndex >= 0) { 17081 return true; 17082 } 17083 return false; 17084 }; 17085 var _sortByOrder = function sortByOrder(candidates) { 17086 var regularTabbables = []; 17087 var orderedTabbables = []; 17088 candidates.forEach(function(item, i2) { 17089 var isScope = !!item.scopeParent; 17090 var element = isScope ? item.scopeParent : item; 17091 var candidateTabindex = getSortOrderTabIndex(element, isScope); 17092 var elements = isScope ? _sortByOrder(item.candidates) : element; 17093 if (candidateTabindex === 0) { 17094 isScope ? regularTabbables.push.apply(regularTabbables, elements) : regularTabbables.push(element); 17095 } else { 17096 orderedTabbables.push({ 17097 documentOrder: i2, 17098 tabIndex: candidateTabindex, 17099 item, 17100 isScope, 17101 content: elements 17102 }); 17103 } 17104 }); 17105 return orderedTabbables.sort(sortOrderedTabbables).reduce(function(acc, sortable) { 17106 sortable.isScope ? acc.push.apply(acc, sortable.content) : acc.push(sortable.content); 17107 return acc; 17108 }, []).concat(regularTabbables); 17109 }; 17110 var tabbable2 = function tabbable3(container, options) { 17111 options = options || {}; 17112 var candidates; 17113 if (options.getShadowRoot) { 17114 candidates = _getCandidatesIteratively([container], options.includeContainer, { 17115 filter: isNodeMatchingSelectorTabbable.bind(null, options), 17116 flatten: false, 17117 getShadowRoot: options.getShadowRoot, 17118 shadowRootFilter: isShadowRootTabbable 17119 }); 17120 } else { 17121 candidates = getCandidates(container, options.includeContainer, isNodeMatchingSelectorTabbable.bind(null, options)); 17122 } 17123 return _sortByOrder(candidates); 17124 }; 17125 17126 // packages/ui/build-module/utils/use-deprioritized-initial-focus.mjs 17127 var getTabbableOptions = () => ({ 17128 getShadowRoot: true, 17129 displayCheck: typeof ResizeObserver === "function" && ResizeObserver.toString().includes("[native code]") ? "full" : "none" 17130 }); 17131 function useDeprioritizedInitialFocus({ 17132 initialFocus, 17133 deprioritizedAttributes 17134 }) { 17135 const popupRef = (0, import_element33.useRef)(null); 17136 let resolvedInitialFocus = initialFocus; 17137 if (initialFocus === void 0 || initialFocus === true) { 17138 resolvedInitialFocus = (interactionType) => { 17139 if (interactionType === "touch") { 17140 return popupRef.current ?? true; 17141 } 17142 const popup = popupRef.current; 17143 if (!popup) { 17144 return true; 17145 } 17146 const tabbables = tabbable2(popup, getTabbableOptions()); 17147 for (const el of tabbables) { 17148 if (el instanceof HTMLElement && !deprioritizedAttributes.some( 17149 (attr2) => el.hasAttribute(attr2) 17150 )) { 17151 return el; 17152 } 17153 } 17154 return true; 17155 }; 17156 } 17157 return { resolvedInitialFocus, popupRef }; 17158 } 17159 17160 // packages/ui/build-module/utils/use-overlay-scroll-state-attributes.mjs 17161 var import_element34 = __toESM(require_element(), 1); 17162 var SCROLL_CONTAINER_ATTR = "data-wp-ui-overlay-scroll-container"; 17163 var SCROLLED_FROM_TOP_ATTR = "data-wp-ui-overlay-scrolled-from-top"; 17164 var SCROLLED_FROM_BOTTOM_ATTR = "data-wp-ui-overlay-scrolled-from-bottom"; 17165 var SCROLL_TABBABLE_FLAG_ATTR = "data-wp-ui-overlay-scroll-tabbable"; 17166 var SCROLL_END_EPSILON = 1; 17167 function reconcileTabbableFlag(el) { 17168 if (el.hasAttribute(SCROLL_TABBABLE_FLAG_ATTR) && el.getAttribute("tabindex") !== "0") { 17169 el.removeAttribute(SCROLL_TABBABLE_FLAG_ATTR); 17170 } 17171 } 17172 function updateScrollAttributes(el) { 17173 const { scrollTop, clientHeight, scrollHeight } = el; 17174 const overflows = scrollHeight - clientHeight > SCROLL_END_EPSILON; 17175 el.toggleAttribute(SCROLLED_FROM_TOP_ATTR, scrollTop > 0); 17176 el.toggleAttribute( 17177 SCROLLED_FROM_BOTTOM_ATTR, 17178 scrollTop + clientHeight < scrollHeight - SCROLL_END_EPSILON 17179 ); 17180 reconcileTabbableFlag(el); 17181 if (overflows) { 17182 if (!el.hasAttribute(SCROLL_TABBABLE_FLAG_ATTR) && el.getAttribute("tabindex") === null) { 17183 el.setAttribute("tabindex", "0"); 17184 el.setAttribute(SCROLL_TABBABLE_FLAG_ATTR, ""); 17185 } 17186 } else if (el.hasAttribute(SCROLL_TABBABLE_FLAG_ATTR)) { 17187 el.removeAttribute("tabindex"); 17188 el.removeAttribute(SCROLL_TABBABLE_FLAG_ATTR); 17189 } 17190 } 17191 var HOOK_OWNED_ATTRS = [ 17192 SCROLL_CONTAINER_ATTR, 17193 SCROLLED_FROM_TOP_ATTR, 17194 SCROLLED_FROM_BOTTOM_ATTR 17195 ]; 17196 function cleanupScrollAttributes(el) { 17197 for (const attr2 of HOOK_OWNED_ATTRS) { 17198 el.removeAttribute(attr2); 17199 } 17200 reconcileTabbableFlag(el); 17201 if (el.hasAttribute(SCROLL_TABBABLE_FLAG_ATTR)) { 17202 el.removeAttribute("tabindex"); 17203 el.removeAttribute(SCROLL_TABBABLE_FLAG_ATTR); 17204 } 17205 } 17206 function useOverlayScrollStateAttributes(onScroll) { 17207 const [node, setNode] = (0, import_element34.useState)(null); 17208 const ref = (0, import_element34.useCallback)((el) => { 17209 setNode(el); 17210 }, []); 17211 (0, import_element34.useLayoutEffect)(() => { 17212 if (!node) { 17213 return; 17214 } 17215 node.setAttribute(SCROLL_CONTAINER_ATTR, ""); 17216 updateScrollAttributes(node); 17217 if (typeof ResizeObserver === "undefined") { 17218 return () => { 17219 cleanupScrollAttributes(node); 17220 }; 17221 } 17222 const resizeObserver = new ResizeObserver(() => { 17223 updateScrollAttributes(node); 17224 }); 17225 resizeObserver.observe(node); 17226 for (const child of Array.from(node.children)) { 17227 resizeObserver.observe(child); 17228 } 17229 let mutationObserver; 17230 if (typeof MutationObserver !== "undefined") { 17231 mutationObserver = new MutationObserver((records) => { 17232 for (const record of records) { 17233 if (record.target === node) { 17234 for (const added of Array.from(record.addedNodes)) { 17235 if (added instanceof Element) { 17236 resizeObserver.observe(added); 17237 } 17238 } 17239 for (const removed of Array.from( 17240 record.removedNodes 17241 )) { 17242 if (removed instanceof Element) { 17243 resizeObserver.unobserve(removed); 17244 } 17245 } 17246 } 17247 } 17248 updateScrollAttributes(node); 17249 }); 17250 mutationObserver.observe(node, { 17251 childList: true 17252 }); 17253 } 17254 return () => { 17255 resizeObserver.disconnect(); 17256 mutationObserver?.disconnect(); 17257 cleanupScrollAttributes(node); 17258 }; 17259 }, [node]); 17260 const handleScroll = (0, import_element34.useCallback)( 17261 (event) => { 17262 updateScrollAttributes(event.currentTarget); 17263 onScroll?.(event); 17264 }, 17265 [onScroll] 17266 ); 17267 return { ref, onScroll: handleScroll }; 17268 } 17269 17270 // packages/ui/build-module/lock-unlock.mjs 17271 var import_private_apis = __toESM(require_private_apis(), 1); 17272 var { lock, unlock } = (0, import_private_apis.__dangerousOptInToUnstableAPIsOnlyForCoreModules)( 17273 "I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.", 17274 "@wordpress/ui" 17275 ); 17276 17277 // packages/ui/build-module/stack/stack.mjs 17278 var import_element35 = __toESM(require_element(), 1); 17279 var STYLE_HASH_ATTRIBUTE10 = "data-wp-hash"; 17280 function getRuntime10() { 17281 const globalScope = globalThis; 17282 if (globalScope.__wpStyleRuntime) { 17283 return globalScope.__wpStyleRuntime; 17284 } 17285 globalScope.__wpStyleRuntime = { 17286 documents: /* @__PURE__ */ new Map(), 17287 styles: /* @__PURE__ */ new Map(), 17288 injectedStyles: /* @__PURE__ */ new WeakMap() 17289 }; 17290 if (typeof document !== "undefined") { 17291 registerDocument10(document); 17292 } 17293 return globalScope.__wpStyleRuntime; 17294 } 17295 function documentContainsStyleHash10(targetDocument, hash) { 17296 if (!targetDocument.head) { 17297 return false; 17298 } 17299 for (const style of targetDocument.head.querySelectorAll( 17300 `style[$STYLE_HASH_ATTRIBUTE10}]` 17301 )) { 17302 if (style.getAttribute(STYLE_HASH_ATTRIBUTE10) === hash) { 17303 return true; 17304 } 17305 } 17306 return false; 17307 } 17308 function injectStyle10(targetDocument, hash, css) { 17309 if (!targetDocument.head) { 17310 return; 17311 } 17312 const runtime = getRuntime10(); 17313 let injectedStyles = runtime.injectedStyles.get(targetDocument); 17314 if (!injectedStyles) { 17315 injectedStyles = /* @__PURE__ */ new Set(); 17316 runtime.injectedStyles.set(targetDocument, injectedStyles); 17317 } 17318 if (injectedStyles.has(hash)) { 17319 return; 17320 } 17321 if (documentContainsStyleHash10(targetDocument, hash)) { 17322 injectedStyles.add(hash); 17323 return; 17324 } 17325 const style = targetDocument.createElement("style"); 17326 style.setAttribute(STYLE_HASH_ATTRIBUTE10, hash); 17327 style.appendChild(targetDocument.createTextNode(css)); 17328 targetDocument.head.appendChild(style); 17329 injectedStyles.add(hash); 17330 } 17331 function registerDocument10(targetDocument) { 17332 const runtime = getRuntime10(); 17333 runtime.documents.set( 17334 targetDocument, 17335 (runtime.documents.get(targetDocument) ?? 0) + 1 17336 ); 17337 for (const [hash, css] of runtime.styles) { 17338 injectStyle10(targetDocument, hash, css); 17339 } 17340 return () => { 17341 const count = runtime.documents.get(targetDocument); 17342 if (count === void 0) { 17343 return; 17344 } 17345 if (count <= 1) { 17346 runtime.documents.delete(targetDocument); 17347 return; 17348 } 17349 runtime.documents.set(targetDocument, count - 1); 17350 }; 17351 } 17352 function registerStyle10(hash, css) { 17353 const runtime = getRuntime10(); 17354 runtime.styles.set(hash, css); 17355 for (const targetDocument of runtime.documents.keys()) { 17356 injectStyle10(targetDocument, hash, css); 17357 } 17358 } 17359 if (typeof process === "undefined" || true) { 17360 registerStyle10("b51ff41489", "@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;@layer wp-ui-components{._19ce0419607e1896__stack{display:flex}}"); 17361 } 17362 var style_default10 = { "stack": "_19ce0419607e1896__stack" }; 17363 var gapTokens = { 17364 xs: "var(--wpds-dimension-gap-xs, 4px)", 17365 sm: "var(--wpds-dimension-gap-sm, 8px)", 17366 md: "var(--wpds-dimension-gap-md, 12px)", 17367 lg: "var(--wpds-dimension-gap-lg, 16px)", 17368 xl: "var(--wpds-dimension-gap-xl, 24px)", 17369 "2xl": "var(--wpds-dimension-gap-2xl, 32px)", 17370 "3xl": "var(--wpds-dimension-gap-3xl, 40px)" 17371 }; 17372 var Stack = (0, import_element35.forwardRef)(function Stack2({ direction, gap, align, justify, wrap, render: render4, ...props }, ref) { 17373 const style = { 17374 gap: gap && gapTokens[gap], 17375 alignItems: align, 17376 justifyContent: justify, 17377 flexDirection: direction, 17378 flexWrap: wrap 17379 }; 17380 const element = useRender({ 17381 render: render4, 17382 ref, 17383 props: mergeProps(props, { style, className: style_default10.stack }) 17384 }); 17385 return element; 17386 }); 17387 17388 // packages/ui/build-module/alert-dialog/portal.mjs 17389 var import_element36 = __toESM(require_element(), 1); 17390 var import_jsx_runtime72 = __toESM(require_jsx_runtime(), 1); 17391 var Portal = (0, import_element36.forwardRef)( 17392 function AlertDialogPortal(props, ref) { 17393 return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(index_parts_exports.Portal, { ref, ...props }); 17394 } 17395 ); 17396 17397 // packages/ui/build-module/alert-dialog/popup.mjs 17398 var import_jsx_runtime73 = __toESM(require_jsx_runtime(), 1); 17399 var STYLE_HASH_ATTRIBUTE11 = "data-wp-hash"; 17400 function getRuntime11() { 17401 const globalScope = globalThis; 17402 if (globalScope.__wpStyleRuntime) { 17403 return globalScope.__wpStyleRuntime; 17404 } 17405 globalScope.__wpStyleRuntime = { 17406 documents: /* @__PURE__ */ new Map(), 17407 styles: /* @__PURE__ */ new Map(), 17408 injectedStyles: /* @__PURE__ */ new WeakMap() 17409 }; 17410 if (typeof document !== "undefined") { 17411 registerDocument11(document); 17412 } 17413 return globalScope.__wpStyleRuntime; 17414 } 17415 function documentContainsStyleHash11(targetDocument, hash) { 17416 if (!targetDocument.head) { 17417 return false; 17418 } 17419 for (const style of targetDocument.head.querySelectorAll( 17420 `style[$STYLE_HASH_ATTRIBUTE11}]` 17421 )) { 17422 if (style.getAttribute(STYLE_HASH_ATTRIBUTE11) === hash) { 17423 return true; 17424 } 17425 } 17426 return false; 17427 } 17428 function injectStyle11(targetDocument, hash, css) { 17429 if (!targetDocument.head) { 17430 return; 17431 } 17432 const runtime = getRuntime11(); 17433 let injectedStyles = runtime.injectedStyles.get(targetDocument); 17434 if (!injectedStyles) { 17435 injectedStyles = /* @__PURE__ */ new Set(); 17436 runtime.injectedStyles.set(targetDocument, injectedStyles); 17437 } 17438 if (injectedStyles.has(hash)) { 17439 return; 17440 } 17441 if (documentContainsStyleHash11(targetDocument, hash)) { 17442 injectedStyles.add(hash); 17443 return; 17444 } 17445 const style = targetDocument.createElement("style"); 17446 style.setAttribute(STYLE_HASH_ATTRIBUTE11, hash); 17447 style.appendChild(targetDocument.createTextNode(css)); 17448 targetDocument.head.appendChild(style); 17449 injectedStyles.add(hash); 17450 } 17451 function registerDocument11(targetDocument) { 17452 const runtime = getRuntime11(); 17453 runtime.documents.set( 17454 targetDocument, 17455 (runtime.documents.get(targetDocument) ?? 0) + 1 17456 ); 17457 for (const [hash, css] of runtime.styles) { 17458 injectStyle11(targetDocument, hash, css); 17459 } 17460 return () => { 17461 const count = runtime.documents.get(targetDocument); 17462 if (count === void 0) { 17463 return; 17464 } 17465 if (count <= 1) { 17466 runtime.documents.delete(targetDocument); 17467 return; 17468 } 17469 runtime.documents.set(targetDocument, count - 1); 17470 }; 17471 } 17472 function registerStyle11(hash, css) { 17473 const runtime = getRuntime11(); 17474 runtime.styles.set(hash, css); 17475 for (const targetDocument of runtime.documents.keys()) { 17476 injectStyle11(targetDocument, hash, css); 17477 } 17478 } 17479 if (typeof process === "undefined" || true) { 17480 registerStyle11("a400076f01", '@layer wp-ui-components{.f1c50237c4787636__header{min-height:32px;padding-block:var(--wpds-dimension-padding-2xl,24px) var(--wpds-dimension-gap-lg,16px)}._579f95efdec92a66__footer,.f1c50237c4787636__header{align-items:center;display:flex;gap:var(--wpds-dimension-gap-sm,8px);padding-inline:var(--wpds-dimension-padding-2xl,24px)}._579f95efdec92a66__footer{justify-content:flex-end;padding-block:var(--wpds-dimension-gap-lg,16px) var(--wpds-dimension-padding-2xl,24px)}._5371cc08aad82574__title{--_gcd-heading-color:var(--wpds-color-fg-content-neutral,#1e1e1e);--_gcd-heading-margin:0 auto 0 0;color:var(--wpds-color-fg-content-neutral,#1e1e1e);margin-inline-end:auto;&:dir(rtl){--_gcd-heading-margin:0 0 0 auto}}._766d9011d37ce2d9__content{flex:1 1 auto;min-block-size:0;overflow-block:auto;overflow-inline:hidden;padding:var(--wpds-dimension-padding-2xl,24px);&:focus-visible{outline-offset:calc(var(--wpds-border-width-focus, var(--wp-admin-border-width-focus, 2px))*-1)}}.f1c50237c4787636__header:has(~._766d9011d37ce2d9__content){border-block-end:1px solid #0000;padding-block-end:calc(var(--wpds-dimension-gap-lg, 16px) - 1px)}.f1c50237c4787636__header~._766d9011d37ce2d9__content{padding-block-start:0}._766d9011d37ce2d9__content~._579f95efdec92a66__footer{border-block-start:1px solid #0000;padding-block-start:calc(var(--wpds-dimension-gap-lg, 16px) - 1px)}._766d9011d37ce2d9__content:has(~._579f95efdec92a66__footer){padding-block-end:0}._766d9011d37ce2d9__content>.f1c50237c4787636__header,._766d9011d37ce2d9__content>[data-drawer-content]>.f1c50237c4787636__header{padding-inline:0}._766d9011d37ce2d9__content>.f1c50237c4787636__header:first-child,._766d9011d37ce2d9__content>[data-drawer-content]>.f1c50237c4787636__header:first-child{padding-block-start:0}._766d9011d37ce2d9__content>._579f95efdec92a66__footer,._766d9011d37ce2d9__content>[data-drawer-content]>._579f95efdec92a66__footer{padding-inline:0}._766d9011d37ce2d9__content>._579f95efdec92a66__footer:last-child,._766d9011d37ce2d9__content>[data-drawer-content]>._579f95efdec92a66__footer:last-child{padding-block-end:0}.f1c50237c4787636__header:has(~[data-wp-ui-overlay-scroll-container][data-wp-ui-overlay-scrolled-from-top]){border-block-end-color:var(--wpds-color-stroke-surface-neutral,#dbdbdb)}[data-wp-ui-overlay-scroll-container][data-wp-ui-overlay-scrolled-from-bottom]~._579f95efdec92a66__footer{border-block-start-color:var(--wpds-color-stroke-surface-neutral,#dbdbdb)}[data-wp-ui-overlay-modal] [data-wp-ui-overlay-scroll-container]{overscroll-behavior:contain}}@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;@layer wp-ui-components{._074affe4c56b4f2f__backdrop{background-color:#00000059;inset:0;position:fixed;z-index:var(--wp-ui-dialog-z-index,initial);&[data-ending-style],&[data-starting-style]{opacity:0}&[data-open]{opacity:1}@media not (prefers-reduced-motion){transition:opacity var(--wpds-motion-duration-md,.2s) var(--wpds-motion-easing-subtle,cubic-bezier(.15,0,.15,1))}}._8acaa98861620d4d__popup{--viewport-inset:var(--wpds-dimension-padding-2xl,24px);background-color:var(--wpds-color-bg-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-lg,8px);box-shadow:var(--wpds-elevation-lg,0 5px 15px 0 #00000014,0 15px 27px 0 #00000012,0 30px 36px 0 #0000000a,0 50px 43px 0 #00000005);box-sizing:border-box;color:var(--wpds-color-fg-content-neutral,#1e1e1e);display:flex;flex-direction:column;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);left:50%;line-height:var(--wpds-typography-line-height-md,24px);max-height:calc(100dvh - var(--viewport-inset)*2);min-width:var(--wpds-dimension-surface-width-sm,320px);overflow:hidden;position:fixed;top:50%;transform:translate(-50%,-50%);width:calc(100vw - var(--viewport-inset)*2);z-index:var(--wp-ui-dialog-z-index,initial);&[data-ending-style],&[data-starting-style]{opacity:0;transform:translate(-50%,-50%) scale(.9)}@media not (prefers-reduced-motion){transition:opacity var(--wpds-motion-duration-md,.2s) var(--wpds-motion-easing-expressive,cubic-bezier(.25,0,0,1)),transform var(--wpds-motion-duration-md,.2s) var(--wpds-motion-easing-expressive,cubic-bezier(.25,0,0,1))}@media (min-width:480px){min-width:var(--wpds-dimension-surface-width-md,400px)}&._7acfa67ebf092988__is-small{max-width:var(--wpds-dimension-surface-width-md,400px)}&._1eeeed880cb5769d__is-medium{max-width:var(--wpds-dimension-surface-width-lg,560px)}&._99f900b2267e22d0__is-large{max-width:var(--wpds-dimension-surface-width-2xl,960px)}&.b49f7ff9c06fe387__is-stretch{max-width:none}&.dcd4c2f5036cbf1a__is-full{height:100dvh}}._074affe4c56b4f2f__backdrop~* ._8acaa98861620d4d__popup{border-color:#0000}@media (forced-colors:active){._074affe4c56b4f2f__backdrop~* ._8acaa98861620d4d__popup,._8acaa98861620d4d__popup{border-color:CanvasText}}._76fb3b28fcbd45fc__header [data-wp-ui-dialog-close-icon]{margin-inline-start:auto}.d9d6da914ef0a77c__description{margin-bottom:var(--wpds-dimension-gap-lg,16px)}}'); 17481 } 17482 var style_default11 = { "backdrop": "_074affe4c56b4f2f__backdrop", "popup": "_8acaa98861620d4d__popup", "is-small": "_7acfa67ebf092988__is-small", "is-medium": "_1eeeed880cb5769d__is-medium", "is-large": "_99f900b2267e22d0__is-large", "is-stretch": "b49f7ff9c06fe387__is-stretch", "is-full": "dcd4c2f5036cbf1a__is-full", "header": "_76fb3b28fcbd45fc__header f1c50237c4787636__header", "footer": "_00eeb4f220cddae3__footer _579f95efdec92a66__footer", "title": "f636832002af749e__title _5371cc08aad82574__title", "content": "_101038da9af7162f__content _766d9011d37ce2d9__content", "description": "d9d6da914ef0a77c__description" }; 17483 if (typeof process === "undefined" || true) { 17484 registerStyle11("2a5ab8f3a7", "@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;@layer wp-ui-utilities{._08e8a2e44959f892__outset-ring--focus,._970d04df7376df67__outset-ring--focus-within-except-active,.c5cb3ee4bddaa8e4__outset-ring--focus-within-visible,.cd83dfc2126a0846__outset-ring--focus-within,.d0541bc9dd9dc7b6__outset-ring--focus-visible,.e25b2bdd7aa21721__outset-ring--focus-except-active,.ecadb9e080e2dfa5__outset-ring--focus-parent-visible{@media not (prefers-reduced-motion){--_gcd-a-transition:outline 0.1s ease-out;transition:outline .1s ease-out}outline:0 solid #0000;outline-offset:1px}._08e8a2e44959f892__outset-ring--focus:focus,._970d04df7376df67__outset-ring--focus-within-except-active:focus-within:not(:has(:active)),.c5cb3ee4bddaa8e4__outset-ring--focus-within-visible:focus-within:has(:focus-visible),.cd83dfc2126a0846__outset-ring--focus-within:focus-within,.d0541bc9dd9dc7b6__outset-ring--focus-visible:focus-visible,.e25b2bdd7aa21721__outset-ring--focus-except-active:focus:not(:active),:focus-visible .ecadb9e080e2dfa5__outset-ring--focus-parent-visible{--_gcd-a-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--wpds-color-stroke-focus-brand,var(--wp-admin-theme-color,#3858e9));--_gcd-div-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--wpds-color-stroke-focus-brand,var(--wp-admin-theme-color,#3858e9));outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--wpds-color-stroke-focus-brand,var(--wp-admin-theme-color,#3858e9))}}"); 17485 } 17486 var focus_default3 = { "outset-ring--focus": "_08e8a2e44959f892__outset-ring--focus", "outset-ring--focus-except-active": "e25b2bdd7aa21721__outset-ring--focus-except-active", "outset-ring--focus-visible": "d0541bc9dd9dc7b6__outset-ring--focus-visible", "outset-ring--focus-within": "cd83dfc2126a0846__outset-ring--focus-within", "outset-ring--focus-within-except-active": "_970d04df7376df67__outset-ring--focus-within-except-active", "outset-ring--focus-within-visible": "c5cb3ee4bddaa8e4__outset-ring--focus-within-visible", "outset-ring--focus-parent-visible": "ecadb9e080e2dfa5__outset-ring--focus-parent-visible" }; 17487 if (typeof process === "undefined" || true) { 17488 registerStyle11("538652eb41", "@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;@layer wp-ui-components{.f1c50237c4787636__header{min-height:32px;padding-block:var(--wpds-dimension-padding-2xl,24px) var(--wpds-dimension-gap-lg,16px)}._579f95efdec92a66__footer,.f1c50237c4787636__header{align-items:center;display:flex;gap:var(--wpds-dimension-gap-sm,8px);padding-inline:var(--wpds-dimension-padding-2xl,24px)}._579f95efdec92a66__footer{justify-content:flex-end;padding-block:var(--wpds-dimension-gap-lg,16px) var(--wpds-dimension-padding-2xl,24px)}._5371cc08aad82574__title{--_gcd-heading-color:var(--wpds-color-fg-content-neutral,#1e1e1e);--_gcd-heading-margin:0 auto 0 0;color:var(--wpds-color-fg-content-neutral,#1e1e1e);margin-inline-end:auto;&:dir(rtl){--_gcd-heading-margin:0 0 0 auto}}._766d9011d37ce2d9__content{flex:1 1 auto;min-block-size:0;overflow-block:auto;overflow-inline:hidden;padding:var(--wpds-dimension-padding-2xl,24px);&:focus-visible{outline-offset:calc(var(--wpds-border-width-focus, var(--wp-admin-border-width-focus, 2px))*-1)}}.f1c50237c4787636__header:has(~._766d9011d37ce2d9__content){border-block-end:1px solid #0000;padding-block-end:calc(var(--wpds-dimension-gap-lg, 16px) - 1px)}.f1c50237c4787636__header~._766d9011d37ce2d9__content{padding-block-start:0}._766d9011d37ce2d9__content~._579f95efdec92a66__footer{border-block-start:1px solid #0000;padding-block-start:calc(var(--wpds-dimension-gap-lg, 16px) - 1px)}._766d9011d37ce2d9__content:has(~._579f95efdec92a66__footer){padding-block-end:0}._766d9011d37ce2d9__content>.f1c50237c4787636__header,._766d9011d37ce2d9__content>[data-drawer-content]>.f1c50237c4787636__header{padding-inline:0}._766d9011d37ce2d9__content>.f1c50237c4787636__header:first-child,._766d9011d37ce2d9__content>[data-drawer-content]>.f1c50237c4787636__header:first-child{padding-block-start:0}._766d9011d37ce2d9__content>._579f95efdec92a66__footer,._766d9011d37ce2d9__content>[data-drawer-content]>._579f95efdec92a66__footer{padding-inline:0}._766d9011d37ce2d9__content>._579f95efdec92a66__footer:last-child,._766d9011d37ce2d9__content>[data-drawer-content]>._579f95efdec92a66__footer:last-child{padding-block-end:0}.f1c50237c4787636__header:has(~[data-wp-ui-overlay-scroll-container][data-wp-ui-overlay-scrolled-from-top]){border-block-end-color:var(--wpds-color-stroke-surface-neutral,#dbdbdb)}[data-wp-ui-overlay-scroll-container][data-wp-ui-overlay-scrolled-from-bottom]~._579f95efdec92a66__footer{border-block-start-color:var(--wpds-color-stroke-surface-neutral,#dbdbdb)}[data-wp-ui-overlay-modal] [data-wp-ui-overlay-scroll-container]{overscroll-behavior:contain}}"); 17489 } 17490 var overlay_chrome_default = { "header": "f1c50237c4787636__header", "footer": "_579f95efdec92a66__footer", "title": "_5371cc08aad82574__title", "content": "_766d9011d37ce2d9__content" }; 17491 if (typeof process === "undefined" || true) { 17492 registerStyle11("ea48258a83", "@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;@layer wp-ui-components{.dbff6618234a2a93__error-message{align-self:flex-end;color:var(--wpds-color-fg-content-error,#470000)}._66cf5fe0c6a030bd__footer-column{align-items:stretch;flex-direction:column;gap:var(--wpds-dimension-gap-md,12px);justify-content:flex-start}}@layer wp-ui-compositions{._2ddc2fc9155a1dad__irreversible-action{--wp-ui-button-background-color:var(--wpds-color-bg-interactive-error-strong,#cc1818);--wp-ui-button-background-color-active:var(--wpds-color-bg-interactive-error-strong-active,#b90000);--wp-ui-button-foreground-color:var(--wpds-color-fg-interactive-error-strong,#f2efef);--wp-ui-button-foreground-color-active:var(--wpds-color-fg-interactive-error-strong-active,#f2efef)}}"); 17493 } 17494 var style_default22 = { "error-message": "dbff6618234a2a93__error-message", "footer-column": "_66cf5fe0c6a030bd__footer-column", "irreversible-action": "_2ddc2fc9155a1dad__irreversible-action" }; 17495 var ThemeProvider = unlock(import_theme.privateApis).ThemeProvider; 17496 var Popup = (0, import_element37.forwardRef)( 17497 function AlertDialogPopup({ 17498 className, 17499 portal, 17500 intent = "default", 17501 title, 17502 description, 17503 children, 17504 confirmButtonText = (0, import_i18n2.__)("OK"), 17505 cancelButtonText = (0, import_i18n2.__)("Cancel"), 17506 stickyHeader = true, 17507 stickyFooter = true, 17508 initialFocus, 17509 finalFocus, 17510 ...props 17511 }, ref) { 17512 const { phase, showSpinner, errorMessage, confirm } = (0, import_element37.useContext)(AlertDialogContext); 17513 const { ref: scrollStateRef, onScroll } = useOverlayScrollStateAttributes(); 17514 const { resolvedInitialFocus, popupRef } = useDeprioritizedInitialFocus( 17515 { 17516 initialFocus, 17517 deprioritizedAttributes: [SCROLL_CONTAINER_ATTR] 17518 } 17519 ); 17520 const mergedRef = (0, import_compose.useMergeRefs)([ref, popupRef]); 17521 const confirmClassName = intent === "irreversible" ? style_default22["irreversible-action"] : void 0; 17522 const buttonsDisabled = phase !== "idle" || void 0; 17523 const headerElement = /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("div", { className: overlay_chrome_default.header, children: /* @__PURE__ */ (0, import_jsx_runtime73.jsx)( 17524 Text, 17525 { 17526 variant: "heading-xl", 17527 render: /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(index_parts_exports.Title, {}), 17528 className: overlay_chrome_default.title, 17529 children: title 17530 } 17531 ) }); 17532 const footerElement = /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)( 17533 "div", 17534 { 17535 className: clsx_default( 17536 overlay_chrome_default.footer, 17537 style_default22["footer-column"] 17538 ), 17539 children: [ 17540 /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)( 17541 Stack, 17542 { 17543 direction: "row", 17544 gap: "sm", 17545 justify: "flex-end", 17546 align: "center", 17547 children: [ 17548 /* @__PURE__ */ (0, import_jsx_runtime73.jsx)( 17549 index_parts_exports.Close, 17550 { 17551 render: /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(Button4, { variant: "minimal" }), 17552 disabled: buttonsDisabled, 17553 children: cancelButtonText 17554 } 17555 ), 17556 /* @__PURE__ */ (0, import_jsx_runtime73.jsx)( 17557 Button4, 17558 { 17559 className: confirmClassName, 17560 onClick: confirm, 17561 loading: showSpinner || void 0, 17562 disabled: buttonsDisabled, 17563 children: confirmButtonText 17564 } 17565 ) 17566 ] 17567 } 17568 ), 17569 errorMessage && /* @__PURE__ */ (0, import_jsx_runtime73.jsx)( 17570 Text, 17571 { 17572 variant: "body-sm", 17573 className: style_default22["error-message"], 17574 children: errorMessage 17575 } 17576 ) 17577 ] 17578 } 17579 ); 17580 const portalChildren = /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)(import_jsx_runtime73.Fragment, { children: [ 17581 /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(index_parts_exports.Backdrop, { className: style_default11.backdrop }), 17582 /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(ThemeProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)( 17583 index_parts_exports.Popup, 17584 { 17585 ref: mergedRef, 17586 className: clsx_default( 17587 style_default11.popup, 17588 className, 17589 style_default11["is-medium"] 17590 ), 17591 initialFocus: resolvedInitialFocus, 17592 finalFocus, 17593 ...props, 17594 "data-wp-ui-overlay-modal": "", 17595 children: [ 17596 stickyHeader && headerElement, 17597 /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)( 17598 "div", 17599 { 17600 ref: scrollStateRef, 17601 className: clsx_default( 17602 overlay_chrome_default.content, 17603 focus_default3["outset-ring--focus-visible"] 17604 ), 17605 onScroll, 17606 children: [ 17607 !stickyHeader && headerElement, 17608 description && /* @__PURE__ */ (0, import_jsx_runtime73.jsx)( 17609 Text, 17610 { 17611 variant: "body-md", 17612 render: /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(index_parts_exports.Description, {}), 17613 children: description 17614 } 17615 ), 17616 children, 17617 !stickyFooter && footerElement 17618 ] 17619 } 17620 ), 17621 stickyFooter && footerElement 17622 ] 17623 } 17624 ) }) 17625 ] }); 17626 return renderSlotWithChildren(portal, /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(Portal, {}), portalChildren); 17627 } 17628 ); 17629 17630 // packages/ui/build-module/dialog/index.mjs 17631 var dialog_exports = {}; 17632 __export(dialog_exports, { 17633 Action: () => Action, 17634 CloseIcon: () => CloseIcon, 17635 Content: () => Content3, 17636 Description: () => Description, 17637 Footer: () => Footer, 17638 Header: () => Header3, 17639 Popup: () => Popup3, 17640 Portal: () => Portal3, 17641 Root: () => Root6, 17642 Title: () => Title2, 17643 Trigger: () => Trigger4 17644 }); 17645 17646 // packages/ui/build-module/dialog/action.mjs 17647 var import_element38 = __toESM(require_element(), 1); 17648 var import_jsx_runtime74 = __toESM(require_jsx_runtime(), 1); 17649 var Action = (0, import_element38.forwardRef)( 17650 function DialogAction({ render: render4, disabled: disabled2, loading, ...props }, ref) { 17651 const resolvedDisabled = disabled2 ?? loading; 17652 return /* @__PURE__ */ (0, import_jsx_runtime74.jsx)( 17653 index_parts_exports3.Close, 17654 { 17655 ref, 17656 render: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(Button4, { render: render4, loading }), 17657 disabled: resolvedDisabled, 17658 ...props 17659 } 17660 ); 17661 } 17662 ); 17663 17664 // packages/ui/build-module/dialog/close-icon.mjs 17665 var import_element44 = __toESM(require_element(), 1); 17666 var import_i18n3 = __toESM(require_i18n(), 1); 17667 17668 // packages/ui/build-module/icon-button/icon-button.mjs 17669 var import_element43 = __toESM(require_element(), 1); 17670 17671 // packages/ui/build-module/tooltip/index.mjs 17672 var tooltip_exports = {}; 17673 __export(tooltip_exports, { 17674 Popup: () => Popup2, 17675 Portal: () => Portal2, 17676 Positioner: () => Positioner, 17677 Provider: () => Provider, 17678 Root: () => Root5, 17679 Trigger: () => Trigger3 17680 }); 17681 17682 // packages/ui/build-module/tooltip/popup.mjs 17683 var import_element41 = __toESM(require_element(), 1); 17684 var import_theme2 = __toESM(require_theme(), 1); 17685 17686 // packages/ui/build-module/tooltip/portal.mjs 17687 var import_element39 = __toESM(require_element(), 1); 17688 17689 // packages/ui/build-module/utils/wp-compat-overlay-slot.mjs 17690 var STYLE_HASH_ATTRIBUTE12 = "data-wp-hash"; 17691 function getRuntime12() { 17692 const globalScope = globalThis; 17693 if (globalScope.__wpStyleRuntime) { 17694 return globalScope.__wpStyleRuntime; 17695 } 17696 globalScope.__wpStyleRuntime = { 17697 documents: /* @__PURE__ */ new Map(), 17698 styles: /* @__PURE__ */ new Map(), 17699 injectedStyles: /* @__PURE__ */ new WeakMap() 17700 }; 17701 if (typeof document !== "undefined") { 17702 registerDocument12(document); 17703 } 17704 return globalScope.__wpStyleRuntime; 17705 } 17706 function documentContainsStyleHash12(targetDocument, hash) { 17707 if (!targetDocument.head) { 17708 return false; 17709 } 17710 for (const style of targetDocument.head.querySelectorAll( 17711 `style[$STYLE_HASH_ATTRIBUTE12}]` 17712 )) { 17713 if (style.getAttribute(STYLE_HASH_ATTRIBUTE12) === hash) { 17714 return true; 17715 } 17716 } 17717 return false; 17718 } 17719 function injectStyle12(targetDocument, hash, css) { 17720 if (!targetDocument.head) { 17721 return; 17722 } 17723 const runtime = getRuntime12(); 17724 let injectedStyles = runtime.injectedStyles.get(targetDocument); 17725 if (!injectedStyles) { 17726 injectedStyles = /* @__PURE__ */ new Set(); 17727 runtime.injectedStyles.set(targetDocument, injectedStyles); 17728 } 17729 if (injectedStyles.has(hash)) { 17730 return; 17731 } 17732 if (documentContainsStyleHash12(targetDocument, hash)) { 17733 injectedStyles.add(hash); 17734 return; 17735 } 17736 const style = targetDocument.createElement("style"); 17737 style.setAttribute(STYLE_HASH_ATTRIBUTE12, hash); 17738 style.appendChild(targetDocument.createTextNode(css)); 17739 targetDocument.head.appendChild(style); 17740 injectedStyles.add(hash); 17741 } 17742 function registerDocument12(targetDocument) { 17743 const runtime = getRuntime12(); 17744 runtime.documents.set( 17745 targetDocument, 17746 (runtime.documents.get(targetDocument) ?? 0) + 1 17747 ); 17748 for (const [hash, css] of runtime.styles) { 17749 injectStyle12(targetDocument, hash, css); 17750 } 17751 return () => { 17752 const count = runtime.documents.get(targetDocument); 17753 if (count === void 0) { 17754 return; 17755 } 17756 if (count <= 1) { 17757 runtime.documents.delete(targetDocument); 17758 return; 17759 } 17760 runtime.documents.set(targetDocument, count - 1); 17761 }; 17762 } 17763 function registerStyle12(hash, css) { 17764 const runtime = getRuntime12(); 17765 runtime.styles.set(hash, css); 17766 for (const targetDocument of runtime.documents.keys()) { 17767 injectStyle12(targetDocument, hash, css); 17768 } 17769 } 17770 if (typeof process === "undefined" || true) { 17771 registerStyle12("45eb1fe20f", "@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;._11fc52b637ff8a7e__slot{inset:0;isolation:isolate;pointer-events:none;position:fixed;z-index:1000000003}@layer wp-ui-utilities{._11fc52b637ff8a7e__slot>*{pointer-events:auto}}"); 17772 } 17773 var wp_compat_overlay_slot_default = { "slot": "_11fc52b637ff8a7e__slot" }; 17774 var WP_COMPAT_OVERLAY_SLOT_ATTRIBUTE = "data-wp-compat-overlay-slot"; 17775 function resolveOwnerDocument() { 17776 return typeof document === "undefined" ? null : document; 17777 } 17778 function isInWordPressEnvironment() { 17779 let topWp; 17780 try { 17781 topWp = window.top?.wp; 17782 } catch { 17783 } 17784 const wp = topWp ?? window.wp; 17785 return typeof wp?.components === "object" && wp.components !== null; 17786 } 17787 var cachedSlot = null; 17788 function createSlot(ownerDocument2) { 17789 const element = ownerDocument2.createElement("div"); 17790 element.setAttribute(WP_COMPAT_OVERLAY_SLOT_ATTRIBUTE, ""); 17791 if (wp_compat_overlay_slot_default.slot) { 17792 element.classList.add(wp_compat_overlay_slot_default.slot); 17793 } 17794 ownerDocument2.body.appendChild(element); 17795 return element; 17796 } 17797 function getWpCompatOverlaySlot() { 17798 if (typeof window === "undefined") { 17799 return void 0; 17800 } 17801 if (!isInWordPressEnvironment() && window.__wpUiCompatOverlaySlotEnabled !== true) { 17802 return void 0; 17803 } 17804 const ownerDocument2 = resolveOwnerDocument(); 17805 if (!ownerDocument2 || !ownerDocument2.body) { 17806 return void 0; 17807 } 17808 if (cachedSlot && cachedSlot.ownerDocument === ownerDocument2 && cachedSlot.isConnected) { 17809 return cachedSlot; 17810 } 17811 const existing = ownerDocument2.querySelector( 17812 `[$WP_COMPAT_OVERLAY_SLOT_ATTRIBUTE}]` 17813 ); 17814 if (existing instanceof HTMLDivElement) { 17815 cachedSlot = existing; 17816 return existing; 17817 } 17818 if (cachedSlot?.isConnected) { 17819 cachedSlot.remove(); 17820 } 17821 cachedSlot = createSlot(ownerDocument2); 17822 return cachedSlot; 17823 } 17824 17825 // packages/ui/build-module/tooltip/portal.mjs 17826 var import_jsx_runtime75 = __toESM(require_jsx_runtime(), 1); 17827 var Portal2 = (0, import_element39.forwardRef)( 17828 function TooltipPortal3({ container, ...restProps }, ref) { 17829 return /* @__PURE__ */ (0, import_jsx_runtime75.jsx)( 17830 index_parts_exports6.Portal, 17831 { 17832 container: container ?? getWpCompatOverlaySlot(), 17833 ...restProps, 17834 ref 17835 } 17836 ); 17837 } 17838 ); 17839 17840 // packages/ui/build-module/tooltip/positioner.mjs 17841 var import_element40 = __toESM(require_element(), 1); 17842 var import_jsx_runtime76 = __toESM(require_jsx_runtime(), 1); 17843 var STYLE_HASH_ATTRIBUTE13 = "data-wp-hash"; 17844 function getRuntime13() { 17845 const globalScope = globalThis; 17846 if (globalScope.__wpStyleRuntime) { 17847 return globalScope.__wpStyleRuntime; 17848 } 17849 globalScope.__wpStyleRuntime = { 17850 documents: /* @__PURE__ */ new Map(), 17851 styles: /* @__PURE__ */ new Map(), 17852 injectedStyles: /* @__PURE__ */ new WeakMap() 17853 }; 17854 if (typeof document !== "undefined") { 17855 registerDocument13(document); 17856 } 17857 return globalScope.__wpStyleRuntime; 17858 } 17859 function documentContainsStyleHash13(targetDocument, hash) { 17860 if (!targetDocument.head) { 17861 return false; 17862 } 17863 for (const style of targetDocument.head.querySelectorAll( 17864 `style[$STYLE_HASH_ATTRIBUTE13}]` 17865 )) { 17866 if (style.getAttribute(STYLE_HASH_ATTRIBUTE13) === hash) { 17867 return true; 17868 } 17869 } 17870 return false; 17871 } 17872 function injectStyle13(targetDocument, hash, css) { 17873 if (!targetDocument.head) { 17874 return; 17875 } 17876 const runtime = getRuntime13(); 17877 let injectedStyles = runtime.injectedStyles.get(targetDocument); 17878 if (!injectedStyles) { 17879 injectedStyles = /* @__PURE__ */ new Set(); 17880 runtime.injectedStyles.set(targetDocument, injectedStyles); 17881 } 17882 if (injectedStyles.has(hash)) { 17883 return; 17884 } 17885 if (documentContainsStyleHash13(targetDocument, hash)) { 17886 injectedStyles.add(hash); 17887 return; 17888 } 17889 const style = targetDocument.createElement("style"); 17890 style.setAttribute(STYLE_HASH_ATTRIBUTE13, hash); 17891 style.appendChild(targetDocument.createTextNode(css)); 17892 targetDocument.head.appendChild(style); 17893 injectedStyles.add(hash); 17894 } 17895 function registerDocument13(targetDocument) { 17896 const runtime = getRuntime13(); 17897 runtime.documents.set( 17898 targetDocument, 17899 (runtime.documents.get(targetDocument) ?? 0) + 1 17900 ); 17901 for (const [hash, css] of runtime.styles) { 17902 injectStyle13(targetDocument, hash, css); 17903 } 17904 return () => { 17905 const count = runtime.documents.get(targetDocument); 17906 if (count === void 0) { 17907 return; 17908 } 17909 if (count <= 1) { 17910 runtime.documents.delete(targetDocument); 17911 return; 17912 } 17913 runtime.documents.set(targetDocument, count - 1); 17914 }; 17915 } 17916 function registerStyle13(hash, css) { 17917 const runtime = getRuntime13(); 17918 runtime.styles.set(hash, css); 17919 for (const targetDocument of runtime.documents.keys()) { 17920 injectStyle13(targetDocument, hash, css); 17921 } 17922 } 17923 if (typeof process === "undefined" || true) { 17924 registerStyle13("e3ae230cea", "@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;@layer wp-ui-utilities{._336cd3e4e743482f__box-sizing{box-sizing:border-box;*,:after,:before{box-sizing:inherit}}}"); 17925 } 17926 var resets_default3 = { "box-sizing": "_336cd3e4e743482f__box-sizing" }; 17927 if (typeof process === "undefined" || true) { 17928 registerStyle13("8293efbb49", '@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;@layer wp-ui-components{._480b748dd3510e64__positioner{z-index:var(--wp-ui-tooltip-z-index,initial)}._50096b232db7709d__popup{background-color:var(--wpds-color-bg-surface-neutral-strong,#fff);border-radius:var(--wpds-border-radius-sm,2px);box-shadow:var(--wpds-elevation-sm,0 1px 2px 0 #0000000d,0 2px 3px 0 #0000000a,0 6px 6px 0 #00000008,0 8px 8px 0 #00000005);color:var(--wpds-color-fg-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}}}'); 17929 } 17930 var style_default12 = { "positioner": "_480b748dd3510e64__positioner", "popup": "_50096b232db7709d__popup" }; 17931 var Positioner = (0, import_element40.forwardRef)( 17932 function TooltipPositioner3({ align = "center", className, side = "top", sideOffset = 4, ...props }, ref) { 17933 return /* @__PURE__ */ (0, import_jsx_runtime76.jsx)( 17934 index_parts_exports6.Positioner, 17935 { 17936 ref, 17937 align, 17938 side, 17939 sideOffset, 17940 ...props, 17941 className: clsx_default( 17942 resets_default3["box-sizing"], 17943 style_default12.positioner, 17944 className 17945 ) 17946 } 17947 ); 17948 } 17949 ); 17950 17951 // packages/ui/build-module/tooltip/popup.mjs 17952 var import_jsx_runtime77 = __toESM(require_jsx_runtime(), 1); 17953 var STYLE_HASH_ATTRIBUTE14 = "data-wp-hash"; 17954 function getRuntime14() { 17955 const globalScope = globalThis; 17956 if (globalScope.__wpStyleRuntime) { 17957 return globalScope.__wpStyleRuntime; 17958 } 17959 globalScope.__wpStyleRuntime = { 17960 documents: /* @__PURE__ */ new Map(), 17961 styles: /* @__PURE__ */ new Map(), 17962 injectedStyles: /* @__PURE__ */ new WeakMap() 17963 }; 17964 if (typeof document !== "undefined") { 17965 registerDocument14(document); 17966 } 17967 return globalScope.__wpStyleRuntime; 17968 } 17969 function documentContainsStyleHash14(targetDocument, hash) { 17970 if (!targetDocument.head) { 17971 return false; 17972 } 17973 for (const style of targetDocument.head.querySelectorAll( 17974 `style[$STYLE_HASH_ATTRIBUTE14}]` 17975 )) { 17976 if (style.getAttribute(STYLE_HASH_ATTRIBUTE14) === hash) { 17977 return true; 17978 } 17979 } 17980 return false; 17981 } 17982 function injectStyle14(targetDocument, hash, css) { 17983 if (!targetDocument.head) { 17984 return; 17985 } 17986 const runtime = getRuntime14(); 17987 let injectedStyles = runtime.injectedStyles.get(targetDocument); 17988 if (!injectedStyles) { 17989 injectedStyles = /* @__PURE__ */ new Set(); 17990 runtime.injectedStyles.set(targetDocument, injectedStyles); 17991 } 17992 if (injectedStyles.has(hash)) { 17993 return; 17994 } 17995 if (documentContainsStyleHash14(targetDocument, hash)) { 17996 injectedStyles.add(hash); 17997 return; 17998 } 17999 const style = targetDocument.createElement("style"); 18000 style.setAttribute(STYLE_HASH_ATTRIBUTE14, hash); 18001 style.appendChild(targetDocument.createTextNode(css)); 18002 targetDocument.head.appendChild(style); 18003 injectedStyles.add(hash); 18004 } 18005 function registerDocument14(targetDocument) { 18006 const runtime = getRuntime14(); 18007 runtime.documents.set( 18008 targetDocument, 18009 (runtime.documents.get(targetDocument) ?? 0) + 1 18010 ); 18011 for (const [hash, css] of runtime.styles) { 18012 injectStyle14(targetDocument, hash, css); 18013 } 18014 return () => { 18015 const count = runtime.documents.get(targetDocument); 18016 if (count === void 0) { 18017 return; 18018 } 18019 if (count <= 1) { 18020 runtime.documents.delete(targetDocument); 18021 return; 18022 } 18023 runtime.documents.set(targetDocument, count - 1); 18024 }; 18025 } 18026 function registerStyle14(hash, css) { 18027 const runtime = getRuntime14(); 18028 runtime.styles.set(hash, css); 18029 for (const targetDocument of runtime.documents.keys()) { 18030 injectStyle14(targetDocument, hash, css); 18031 } 18032 } 18033 if (typeof process === "undefined" || true) { 18034 registerStyle14("8293efbb49", '@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;@layer wp-ui-components{._480b748dd3510e64__positioner{z-index:var(--wp-ui-tooltip-z-index,initial)}._50096b232db7709d__popup{background-color:var(--wpds-color-bg-surface-neutral-strong,#fff);border-radius:var(--wpds-border-radius-sm,2px);box-shadow:var(--wpds-elevation-sm,0 1px 2px 0 #0000000d,0 2px 3px 0 #0000000a,0 6px 6px 0 #00000008,0 8px 8px 0 #00000005);color:var(--wpds-color-fg-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}}}'); 18035 } 18036 var style_default13 = { "positioner": "_480b748dd3510e64__positioner", "popup": "_50096b232db7709d__popup" }; 18037 var ThemeProvider2 = unlock(import_theme2.privateApis).ThemeProvider; 18038 var Popup2 = (0, import_element41.forwardRef)(function TooltipPopup3({ portal, positioner, children, className, ...props }, ref) { 18039 const popupContent = ( 18040 /* This should ideally use whatever dark color makes sense, 18041 * and not be hardcoded to #1e1e1e. The solutions would be to: 18042 * - review the design of the tooltip, in case we want to stop 18043 * hardcoding it to a dark background 18044 * - create new semantic tokens as needed (aliasing either the 18045 * "inverted bg" or "perma-dark bg" private tokens) and have 18046 * Tooltip.Popup use them; 18047 * - remove the hardcoded `bg` setting from the `ThemeProvider` 18048 * below 18049 */ 18050 /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(ThemeProvider2, { color: { bg: "#1e1e1e" }, children: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)( 18051 index_parts_exports6.Popup, 18052 { 18053 ref, 18054 className: clsx_default(style_default13.popup, className), 18055 ...props, 18056 children 18057 } 18058 ) }) 18059 ); 18060 const positionedPopup = renderSlotWithChildren( 18061 positioner, 18062 /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(Positioner, {}), 18063 popupContent 18064 ); 18065 return renderSlotWithChildren(portal, /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(Portal2, {}), positionedPopup); 18066 }); 18067 18068 // packages/ui/build-module/tooltip/trigger.mjs 18069 var import_element42 = __toESM(require_element(), 1); 18070 var import_jsx_runtime78 = __toESM(require_jsx_runtime(), 1); 18071 var Trigger3 = (0, import_element42.forwardRef)( 18072 function TooltipTrigger3(props, ref) { 18073 return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(index_parts_exports6.Trigger, { ref, ...props }); 18074 } 18075 ); 18076 18077 // packages/ui/build-module/tooltip/root.mjs 18078 var import_jsx_runtime79 = __toESM(require_jsx_runtime(), 1); 18079 function Root5(props) { 18080 return /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(index_parts_exports6.Root, { ...props }); 18081 } 18082 18083 // packages/ui/build-module/tooltip/provider.mjs 18084 var import_jsx_runtime80 = __toESM(require_jsx_runtime(), 1); 18085 function Provider({ ...props }) { 18086 return /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(index_parts_exports6.Provider, { ...props }); 18087 } 18088 18089 // packages/ui/build-module/icon-button/icon-button.mjs 18090 var import_jsx_runtime81 = __toESM(require_jsx_runtime(), 1); 18091 var STYLE_HASH_ATTRIBUTE15 = "data-wp-hash"; 18092 function getRuntime15() { 18093 const globalScope = globalThis; 18094 if (globalScope.__wpStyleRuntime) { 18095 return globalScope.__wpStyleRuntime; 18096 } 18097 globalScope.__wpStyleRuntime = { 18098 documents: /* @__PURE__ */ new Map(), 18099 styles: /* @__PURE__ */ new Map(), 18100 injectedStyles: /* @__PURE__ */ new WeakMap() 18101 }; 18102 if (typeof document !== "undefined") { 18103 registerDocument15(document); 18104 } 18105 return globalScope.__wpStyleRuntime; 18106 } 18107 function documentContainsStyleHash15(targetDocument, hash) { 18108 if (!targetDocument.head) { 18109 return false; 18110 } 18111 for (const style of targetDocument.head.querySelectorAll( 18112 `style[$STYLE_HASH_ATTRIBUTE15}]` 18113 )) { 18114 if (style.getAttribute(STYLE_HASH_ATTRIBUTE15) === hash) { 18115 return true; 18116 } 18117 } 18118 return false; 18119 } 18120 function injectStyle15(targetDocument, hash, css) { 18121 if (!targetDocument.head) { 18122 return; 18123 } 18124 const runtime = getRuntime15(); 18125 let injectedStyles = runtime.injectedStyles.get(targetDocument); 18126 if (!injectedStyles) { 18127 injectedStyles = /* @__PURE__ */ new Set(); 18128 runtime.injectedStyles.set(targetDocument, injectedStyles); 18129 } 18130 if (injectedStyles.has(hash)) { 18131 return; 18132 } 18133 if (documentContainsStyleHash15(targetDocument, hash)) { 18134 injectedStyles.add(hash); 18135 return; 18136 } 18137 const style = targetDocument.createElement("style"); 18138 style.setAttribute(STYLE_HASH_ATTRIBUTE15, hash); 18139 style.appendChild(targetDocument.createTextNode(css)); 18140 targetDocument.head.appendChild(style); 18141 injectedStyles.add(hash); 18142 } 18143 function registerDocument15(targetDocument) { 18144 const runtime = getRuntime15(); 18145 runtime.documents.set( 18146 targetDocument, 18147 (runtime.documents.get(targetDocument) ?? 0) + 1 18148 ); 18149 for (const [hash, css] of runtime.styles) { 18150 injectStyle15(targetDocument, hash, css); 18151 } 18152 return () => { 18153 const count = runtime.documents.get(targetDocument); 18154 if (count === void 0) { 18155 return; 18156 } 18157 if (count <= 1) { 18158 runtime.documents.delete(targetDocument); 18159 return; 18160 } 18161 runtime.documents.set(targetDocument, count - 1); 18162 }; 18163 } 18164 function registerStyle15(hash, css) { 18165 const runtime = getRuntime15(); 18166 runtime.styles.set(hash, css); 18167 for (const targetDocument of runtime.documents.keys()) { 18168 injectStyle15(targetDocument, hash, css); 18169 } 18170 } 18171 if (typeof process === "undefined" || true) { 18172 registerStyle15("358a2a646a", "@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;@layer wp-ui-compositions{._28cfdc260e755391__icon-button{--wp-ui-button-aspect-ratio:1;--wp-ui-button-padding-inline:0;--wp-ui-button-min-width:unset}.f1c70d719989a85a__icon{margin:-1px}}"); 18173 } 18174 var style_default14 = { "icon-button": "_28cfdc260e755391__icon-button", "icon": "f1c70d719989a85a__icon" }; 18175 var IconButton = (0, import_element43.forwardRef)( 18176 function IconButton2({ 18177 label, 18178 className, 18179 // Prevent accidental forwarding of `children` 18180 children: _children, 18181 disabled: disabled2, 18182 focusableWhenDisabled = true, 18183 icon, 18184 size: size4, 18185 shortcut, 18186 positioner, 18187 ...restProps 18188 }, ref) { 18189 const classes = clsx_default(style_default14["icon-button"], className); 18190 return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(Provider, { delay: 0, children: /* @__PURE__ */ (0, import_jsx_runtime81.jsxs)(Root5, { children: [ 18191 /* @__PURE__ */ (0, import_jsx_runtime81.jsx)( 18192 Trigger3, 18193 { 18194 ref, 18195 disabled: disabled2 && !focusableWhenDisabled, 18196 render: /* @__PURE__ */ (0, import_jsx_runtime81.jsx)( 18197 Button4, 18198 { 18199 ...restProps, 18200 size: size4, 18201 "aria-label": label, 18202 "aria-keyshortcuts": shortcut?.ariaKeyShortcut, 18203 disabled: disabled2, 18204 focusableWhenDisabled 18205 } 18206 ), 18207 className: classes, 18208 children: /* @__PURE__ */ (0, import_jsx_runtime81.jsx)( 18209 Icon, 18210 { 18211 icon, 18212 size: 24, 18213 className: style_default14.icon 18214 } 18215 ) 18216 } 18217 ), 18218 /* @__PURE__ */ (0, import_jsx_runtime81.jsxs)(Popup2, { positioner, children: [ 18219 label, 18220 shortcut && /* @__PURE__ */ (0, import_jsx_runtime81.jsxs)(import_jsx_runtime81.Fragment, { children: [ 18221 " ", 18222 /* @__PURE__ */ (0, import_jsx_runtime81.jsx)("span", { "aria-hidden": "true", children: shortcut.displayShortcut }) 18223 ] }) 18224 ] }) 18225 ] }) }); 18226 } 18227 ); 18228 18229 // packages/ui/build-module/dialog/close-icon.mjs 18230 var import_jsx_runtime82 = __toESM(require_jsx_runtime(), 1); 18231 var CloseIcon = (0, import_element44.forwardRef)( 18232 function DialogCloseIcon({ icon, label, ...props }, ref) { 18233 return /* @__PURE__ */ (0, import_jsx_runtime82.jsx)( 18234 index_parts_exports3.Close, 18235 { 18236 ref, 18237 render: /* @__PURE__ */ (0, import_jsx_runtime82.jsx)( 18238 IconButton, 18239 { 18240 variant: "minimal", 18241 size: "compact", 18242 tone: "neutral", 18243 ...props, 18244 icon: icon ?? close_default, 18245 label: label ?? (0, import_i18n3.__)("Close"), 18246 "data-wp-ui-dialog-close-icon": "" 18247 } 18248 ) 18249 } 18250 ); 18251 } 18252 ); 18253 18254 // packages/ui/build-module/dialog/content.mjs 18255 var import_element45 = __toESM(require_element(), 1); 18256 var import_compose2 = __toESM(require_compose(), 1); 18257 var STYLE_HASH_ATTRIBUTE16 = "data-wp-hash"; 18258 function getRuntime16() { 18259 const globalScope = globalThis; 18260 if (globalScope.__wpStyleRuntime) { 18261 return globalScope.__wpStyleRuntime; 18262 } 18263 globalScope.__wpStyleRuntime = { 18264 documents: /* @__PURE__ */ new Map(), 18265 styles: /* @__PURE__ */ new Map(), 18266 injectedStyles: /* @__PURE__ */ new WeakMap() 18267 }; 18268 if (typeof document !== "undefined") { 18269 registerDocument16(document); 18270 } 18271 return globalScope.__wpStyleRuntime; 18272 } 18273 function documentContainsStyleHash16(targetDocument, hash) { 18274 if (!targetDocument.head) { 18275 return false; 18276 } 18277 for (const style of targetDocument.head.querySelectorAll( 18278 `style[$STYLE_HASH_ATTRIBUTE16}]` 18279 )) { 18280 if (style.getAttribute(STYLE_HASH_ATTRIBUTE16) === hash) { 18281 return true; 18282 } 18283 } 18284 return false; 18285 } 18286 function injectStyle16(targetDocument, hash, css) { 18287 if (!targetDocument.head) { 18288 return; 18289 } 18290 const runtime = getRuntime16(); 18291 let injectedStyles = runtime.injectedStyles.get(targetDocument); 18292 if (!injectedStyles) { 18293 injectedStyles = /* @__PURE__ */ new Set(); 18294 runtime.injectedStyles.set(targetDocument, injectedStyles); 18295 } 18296 if (injectedStyles.has(hash)) { 18297 return; 18298 } 18299 if (documentContainsStyleHash16(targetDocument, hash)) { 18300 injectedStyles.add(hash); 18301 return; 18302 } 18303 const style = targetDocument.createElement("style"); 18304 style.setAttribute(STYLE_HASH_ATTRIBUTE16, hash); 18305 style.appendChild(targetDocument.createTextNode(css)); 18306 targetDocument.head.appendChild(style); 18307 injectedStyles.add(hash); 18308 } 18309 function registerDocument16(targetDocument) { 18310 const runtime = getRuntime16(); 18311 runtime.documents.set( 18312 targetDocument, 18313 (runtime.documents.get(targetDocument) ?? 0) + 1 18314 ); 18315 for (const [hash, css] of runtime.styles) { 18316 injectStyle16(targetDocument, hash, css); 18317 } 18318 return () => { 18319 const count = runtime.documents.get(targetDocument); 18320 if (count === void 0) { 18321 return; 18322 } 18323 if (count <= 1) { 18324 runtime.documents.delete(targetDocument); 18325 return; 18326 } 18327 runtime.documents.set(targetDocument, count - 1); 18328 }; 18329 } 18330 function registerStyle16(hash, css) { 18331 const runtime = getRuntime16(); 18332 runtime.styles.set(hash, css); 18333 for (const targetDocument of runtime.documents.keys()) { 18334 injectStyle16(targetDocument, hash, css); 18335 } 18336 } 18337 if (typeof process === "undefined" || true) { 18338 registerStyle16("2a5ab8f3a7", "@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;@layer wp-ui-utilities{._08e8a2e44959f892__outset-ring--focus,._970d04df7376df67__outset-ring--focus-within-except-active,.c5cb3ee4bddaa8e4__outset-ring--focus-within-visible,.cd83dfc2126a0846__outset-ring--focus-within,.d0541bc9dd9dc7b6__outset-ring--focus-visible,.e25b2bdd7aa21721__outset-ring--focus-except-active,.ecadb9e080e2dfa5__outset-ring--focus-parent-visible{@media not (prefers-reduced-motion){--_gcd-a-transition:outline 0.1s ease-out;transition:outline .1s ease-out}outline:0 solid #0000;outline-offset:1px}._08e8a2e44959f892__outset-ring--focus:focus,._970d04df7376df67__outset-ring--focus-within-except-active:focus-within:not(:has(:active)),.c5cb3ee4bddaa8e4__outset-ring--focus-within-visible:focus-within:has(:focus-visible),.cd83dfc2126a0846__outset-ring--focus-within:focus-within,.d0541bc9dd9dc7b6__outset-ring--focus-visible:focus-visible,.e25b2bdd7aa21721__outset-ring--focus-except-active:focus:not(:active),:focus-visible .ecadb9e080e2dfa5__outset-ring--focus-parent-visible{--_gcd-a-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--wpds-color-stroke-focus-brand,var(--wp-admin-theme-color,#3858e9));--_gcd-div-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--wpds-color-stroke-focus-brand,var(--wp-admin-theme-color,#3858e9));outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--wpds-color-stroke-focus-brand,var(--wp-admin-theme-color,#3858e9))}}"); 18339 } 18340 var focus_default4 = { "outset-ring--focus": "_08e8a2e44959f892__outset-ring--focus", "outset-ring--focus-except-active": "e25b2bdd7aa21721__outset-ring--focus-except-active", "outset-ring--focus-visible": "d0541bc9dd9dc7b6__outset-ring--focus-visible", "outset-ring--focus-within": "cd83dfc2126a0846__outset-ring--focus-within", "outset-ring--focus-within-except-active": "_970d04df7376df67__outset-ring--focus-within-except-active", "outset-ring--focus-within-visible": "c5cb3ee4bddaa8e4__outset-ring--focus-within-visible", "outset-ring--focus-parent-visible": "ecadb9e080e2dfa5__outset-ring--focus-parent-visible" }; 18341 if (typeof process === "undefined" || true) { 18342 registerStyle16("a400076f01", '@layer wp-ui-components{.f1c50237c4787636__header{min-height:32px;padding-block:var(--wpds-dimension-padding-2xl,24px) var(--wpds-dimension-gap-lg,16px)}._579f95efdec92a66__footer,.f1c50237c4787636__header{align-items:center;display:flex;gap:var(--wpds-dimension-gap-sm,8px);padding-inline:var(--wpds-dimension-padding-2xl,24px)}._579f95efdec92a66__footer{justify-content:flex-end;padding-block:var(--wpds-dimension-gap-lg,16px) var(--wpds-dimension-padding-2xl,24px)}._5371cc08aad82574__title{--_gcd-heading-color:var(--wpds-color-fg-content-neutral,#1e1e1e);--_gcd-heading-margin:0 auto 0 0;color:var(--wpds-color-fg-content-neutral,#1e1e1e);margin-inline-end:auto;&:dir(rtl){--_gcd-heading-margin:0 0 0 auto}}._766d9011d37ce2d9__content{flex:1 1 auto;min-block-size:0;overflow-block:auto;overflow-inline:hidden;padding:var(--wpds-dimension-padding-2xl,24px);&:focus-visible{outline-offset:calc(var(--wpds-border-width-focus, var(--wp-admin-border-width-focus, 2px))*-1)}}.f1c50237c4787636__header:has(~._766d9011d37ce2d9__content){border-block-end:1px solid #0000;padding-block-end:calc(var(--wpds-dimension-gap-lg, 16px) - 1px)}.f1c50237c4787636__header~._766d9011d37ce2d9__content{padding-block-start:0}._766d9011d37ce2d9__content~._579f95efdec92a66__footer{border-block-start:1px solid #0000;padding-block-start:calc(var(--wpds-dimension-gap-lg, 16px) - 1px)}._766d9011d37ce2d9__content:has(~._579f95efdec92a66__footer){padding-block-end:0}._766d9011d37ce2d9__content>.f1c50237c4787636__header,._766d9011d37ce2d9__content>[data-drawer-content]>.f1c50237c4787636__header{padding-inline:0}._766d9011d37ce2d9__content>.f1c50237c4787636__header:first-child,._766d9011d37ce2d9__content>[data-drawer-content]>.f1c50237c4787636__header:first-child{padding-block-start:0}._766d9011d37ce2d9__content>._579f95efdec92a66__footer,._766d9011d37ce2d9__content>[data-drawer-content]>._579f95efdec92a66__footer{padding-inline:0}._766d9011d37ce2d9__content>._579f95efdec92a66__footer:last-child,._766d9011d37ce2d9__content>[data-drawer-content]>._579f95efdec92a66__footer:last-child{padding-block-end:0}.f1c50237c4787636__header:has(~[data-wp-ui-overlay-scroll-container][data-wp-ui-overlay-scrolled-from-top]){border-block-end-color:var(--wpds-color-stroke-surface-neutral,#dbdbdb)}[data-wp-ui-overlay-scroll-container][data-wp-ui-overlay-scrolled-from-bottom]~._579f95efdec92a66__footer{border-block-start-color:var(--wpds-color-stroke-surface-neutral,#dbdbdb)}[data-wp-ui-overlay-modal] [data-wp-ui-overlay-scroll-container]{overscroll-behavior:contain}}@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;@layer wp-ui-components{._074affe4c56b4f2f__backdrop{background-color:#00000059;inset:0;position:fixed;z-index:var(--wp-ui-dialog-z-index,initial);&[data-ending-style],&[data-starting-style]{opacity:0}&[data-open]{opacity:1}@media not (prefers-reduced-motion){transition:opacity var(--wpds-motion-duration-md,.2s) var(--wpds-motion-easing-subtle,cubic-bezier(.15,0,.15,1))}}._8acaa98861620d4d__popup{--viewport-inset:var(--wpds-dimension-padding-2xl,24px);background-color:var(--wpds-color-bg-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-lg,8px);box-shadow:var(--wpds-elevation-lg,0 5px 15px 0 #00000014,0 15px 27px 0 #00000012,0 30px 36px 0 #0000000a,0 50px 43px 0 #00000005);box-sizing:border-box;color:var(--wpds-color-fg-content-neutral,#1e1e1e);display:flex;flex-direction:column;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);left:50%;line-height:var(--wpds-typography-line-height-md,24px);max-height:calc(100dvh - var(--viewport-inset)*2);min-width:var(--wpds-dimension-surface-width-sm,320px);overflow:hidden;position:fixed;top:50%;transform:translate(-50%,-50%);width:calc(100vw - var(--viewport-inset)*2);z-index:var(--wp-ui-dialog-z-index,initial);&[data-ending-style],&[data-starting-style]{opacity:0;transform:translate(-50%,-50%) scale(.9)}@media not (prefers-reduced-motion){transition:opacity var(--wpds-motion-duration-md,.2s) var(--wpds-motion-easing-expressive,cubic-bezier(.25,0,0,1)),transform var(--wpds-motion-duration-md,.2s) var(--wpds-motion-easing-expressive,cubic-bezier(.25,0,0,1))}@media (min-width:480px){min-width:var(--wpds-dimension-surface-width-md,400px)}&._7acfa67ebf092988__is-small{max-width:var(--wpds-dimension-surface-width-md,400px)}&._1eeeed880cb5769d__is-medium{max-width:var(--wpds-dimension-surface-width-lg,560px)}&._99f900b2267e22d0__is-large{max-width:var(--wpds-dimension-surface-width-2xl,960px)}&.b49f7ff9c06fe387__is-stretch{max-width:none}&.dcd4c2f5036cbf1a__is-full{height:100dvh}}._074affe4c56b4f2f__backdrop~* ._8acaa98861620d4d__popup{border-color:#0000}@media (forced-colors:active){._074affe4c56b4f2f__backdrop~* ._8acaa98861620d4d__popup,._8acaa98861620d4d__popup{border-color:CanvasText}}._76fb3b28fcbd45fc__header [data-wp-ui-dialog-close-icon]{margin-inline-start:auto}.d9d6da914ef0a77c__description{margin-bottom:var(--wpds-dimension-gap-lg,16px)}}'); 18343 } 18344 var style_default15 = { "backdrop": "_074affe4c56b4f2f__backdrop", "popup": "_8acaa98861620d4d__popup", "is-small": "_7acfa67ebf092988__is-small", "is-medium": "_1eeeed880cb5769d__is-medium", "is-large": "_99f900b2267e22d0__is-large", "is-stretch": "b49f7ff9c06fe387__is-stretch", "is-full": "dcd4c2f5036cbf1a__is-full", "header": "_76fb3b28fcbd45fc__header f1c50237c4787636__header", "footer": "_00eeb4f220cddae3__footer _579f95efdec92a66__footer", "title": "f636832002af749e__title _5371cc08aad82574__title", "content": "_101038da9af7162f__content _766d9011d37ce2d9__content", "description": "d9d6da914ef0a77c__description" }; 18345 var Content3 = (0, import_element45.forwardRef)( 18346 function DialogContent({ className, render: render4, onScroll, ...props }, ref) { 18347 const { ref: scrollStateRef, onScroll: scrollStateOnScroll } = useOverlayScrollStateAttributes(onScroll); 18348 const mergedRef = (0, import_compose2.useMergeRefs)([ref, scrollStateRef]); 18349 const element = useRender({ 18350 defaultTagName: "div", 18351 render: render4, 18352 ref: mergedRef, 18353 props: mergeProps(props, { 18354 className: clsx_default( 18355 style_default15.content, 18356 focus_default4["outset-ring--focus-visible"], 18357 className 18358 ), 18359 onScroll: scrollStateOnScroll 18360 }) 18361 }); 18362 return element; 18363 } 18364 ); 18365 18366 // packages/ui/build-module/dialog/description.mjs 18367 var import_element46 = __toESM(require_element(), 1); 18368 var import_jsx_runtime83 = __toESM(require_jsx_runtime(), 1); 18369 var STYLE_HASH_ATTRIBUTE17 = "data-wp-hash"; 18370 function getRuntime17() { 18371 const globalScope = globalThis; 18372 if (globalScope.__wpStyleRuntime) { 18373 return globalScope.__wpStyleRuntime; 18374 } 18375 globalScope.__wpStyleRuntime = { 18376 documents: /* @__PURE__ */ new Map(), 18377 styles: /* @__PURE__ */ new Map(), 18378 injectedStyles: /* @__PURE__ */ new WeakMap() 18379 }; 18380 if (typeof document !== "undefined") { 18381 registerDocument17(document); 18382 } 18383 return globalScope.__wpStyleRuntime; 18384 } 18385 function documentContainsStyleHash17(targetDocument, hash) { 18386 if (!targetDocument.head) { 18387 return false; 18388 } 18389 for (const style of targetDocument.head.querySelectorAll( 18390 `style[$STYLE_HASH_ATTRIBUTE17}]` 18391 )) { 18392 if (style.getAttribute(STYLE_HASH_ATTRIBUTE17) === hash) { 18393 return true; 18394 } 18395 } 18396 return false; 18397 } 18398 function injectStyle17(targetDocument, hash, css) { 18399 if (!targetDocument.head) { 18400 return; 18401 } 18402 const runtime = getRuntime17(); 18403 let injectedStyles = runtime.injectedStyles.get(targetDocument); 18404 if (!injectedStyles) { 18405 injectedStyles = /* @__PURE__ */ new Set(); 18406 runtime.injectedStyles.set(targetDocument, injectedStyles); 18407 } 18408 if (injectedStyles.has(hash)) { 18409 return; 18410 } 18411 if (documentContainsStyleHash17(targetDocument, hash)) { 18412 injectedStyles.add(hash); 18413 return; 18414 } 18415 const style = targetDocument.createElement("style"); 18416 style.setAttribute(STYLE_HASH_ATTRIBUTE17, hash); 18417 style.appendChild(targetDocument.createTextNode(css)); 18418 targetDocument.head.appendChild(style); 18419 injectedStyles.add(hash); 18420 } 18421 function registerDocument17(targetDocument) { 18422 const runtime = getRuntime17(); 18423 runtime.documents.set( 18424 targetDocument, 18425 (runtime.documents.get(targetDocument) ?? 0) + 1 18426 ); 18427 for (const [hash, css] of runtime.styles) { 18428 injectStyle17(targetDocument, hash, css); 18429 } 18430 return () => { 18431 const count = runtime.documents.get(targetDocument); 18432 if (count === void 0) { 18433 return; 18434 } 18435 if (count <= 1) { 18436 runtime.documents.delete(targetDocument); 18437 return; 18438 } 18439 runtime.documents.set(targetDocument, count - 1); 18440 }; 18441 } 18442 function registerStyle17(hash, css) { 18443 const runtime = getRuntime17(); 18444 runtime.styles.set(hash, css); 18445 for (const targetDocument of runtime.documents.keys()) { 18446 injectStyle17(targetDocument, hash, css); 18447 } 18448 } 18449 if (typeof process === "undefined" || true) { 18450 registerStyle17("a400076f01", '@layer wp-ui-components{.f1c50237c4787636__header{min-height:32px;padding-block:var(--wpds-dimension-padding-2xl,24px) var(--wpds-dimension-gap-lg,16px)}._579f95efdec92a66__footer,.f1c50237c4787636__header{align-items:center;display:flex;gap:var(--wpds-dimension-gap-sm,8px);padding-inline:var(--wpds-dimension-padding-2xl,24px)}._579f95efdec92a66__footer{justify-content:flex-end;padding-block:var(--wpds-dimension-gap-lg,16px) var(--wpds-dimension-padding-2xl,24px)}._5371cc08aad82574__title{--_gcd-heading-color:var(--wpds-color-fg-content-neutral,#1e1e1e);--_gcd-heading-margin:0 auto 0 0;color:var(--wpds-color-fg-content-neutral,#1e1e1e);margin-inline-end:auto;&:dir(rtl){--_gcd-heading-margin:0 0 0 auto}}._766d9011d37ce2d9__content{flex:1 1 auto;min-block-size:0;overflow-block:auto;overflow-inline:hidden;padding:var(--wpds-dimension-padding-2xl,24px);&:focus-visible{outline-offset:calc(var(--wpds-border-width-focus, var(--wp-admin-border-width-focus, 2px))*-1)}}.f1c50237c4787636__header:has(~._766d9011d37ce2d9__content){border-block-end:1px solid #0000;padding-block-end:calc(var(--wpds-dimension-gap-lg, 16px) - 1px)}.f1c50237c4787636__header~._766d9011d37ce2d9__content{padding-block-start:0}._766d9011d37ce2d9__content~._579f95efdec92a66__footer{border-block-start:1px solid #0000;padding-block-start:calc(var(--wpds-dimension-gap-lg, 16px) - 1px)}._766d9011d37ce2d9__content:has(~._579f95efdec92a66__footer){padding-block-end:0}._766d9011d37ce2d9__content>.f1c50237c4787636__header,._766d9011d37ce2d9__content>[data-drawer-content]>.f1c50237c4787636__header{padding-inline:0}._766d9011d37ce2d9__content>.f1c50237c4787636__header:first-child,._766d9011d37ce2d9__content>[data-drawer-content]>.f1c50237c4787636__header:first-child{padding-block-start:0}._766d9011d37ce2d9__content>._579f95efdec92a66__footer,._766d9011d37ce2d9__content>[data-drawer-content]>._579f95efdec92a66__footer{padding-inline:0}._766d9011d37ce2d9__content>._579f95efdec92a66__footer:last-child,._766d9011d37ce2d9__content>[data-drawer-content]>._579f95efdec92a66__footer:last-child{padding-block-end:0}.f1c50237c4787636__header:has(~[data-wp-ui-overlay-scroll-container][data-wp-ui-overlay-scrolled-from-top]){border-block-end-color:var(--wpds-color-stroke-surface-neutral,#dbdbdb)}[data-wp-ui-overlay-scroll-container][data-wp-ui-overlay-scrolled-from-bottom]~._579f95efdec92a66__footer{border-block-start-color:var(--wpds-color-stroke-surface-neutral,#dbdbdb)}[data-wp-ui-overlay-modal] [data-wp-ui-overlay-scroll-container]{overscroll-behavior:contain}}@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;@layer wp-ui-components{._074affe4c56b4f2f__backdrop{background-color:#00000059;inset:0;position:fixed;z-index:var(--wp-ui-dialog-z-index,initial);&[data-ending-style],&[data-starting-style]{opacity:0}&[data-open]{opacity:1}@media not (prefers-reduced-motion){transition:opacity var(--wpds-motion-duration-md,.2s) var(--wpds-motion-easing-subtle,cubic-bezier(.15,0,.15,1))}}._8acaa98861620d4d__popup{--viewport-inset:var(--wpds-dimension-padding-2xl,24px);background-color:var(--wpds-color-bg-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-lg,8px);box-shadow:var(--wpds-elevation-lg,0 5px 15px 0 #00000014,0 15px 27px 0 #00000012,0 30px 36px 0 #0000000a,0 50px 43px 0 #00000005);box-sizing:border-box;color:var(--wpds-color-fg-content-neutral,#1e1e1e);display:flex;flex-direction:column;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);left:50%;line-height:var(--wpds-typography-line-height-md,24px);max-height:calc(100dvh - var(--viewport-inset)*2);min-width:var(--wpds-dimension-surface-width-sm,320px);overflow:hidden;position:fixed;top:50%;transform:translate(-50%,-50%);width:calc(100vw - var(--viewport-inset)*2);z-index:var(--wp-ui-dialog-z-index,initial);&[data-ending-style],&[data-starting-style]{opacity:0;transform:translate(-50%,-50%) scale(.9)}@media not (prefers-reduced-motion){transition:opacity var(--wpds-motion-duration-md,.2s) var(--wpds-motion-easing-expressive,cubic-bezier(.25,0,0,1)),transform var(--wpds-motion-duration-md,.2s) var(--wpds-motion-easing-expressive,cubic-bezier(.25,0,0,1))}@media (min-width:480px){min-width:var(--wpds-dimension-surface-width-md,400px)}&._7acfa67ebf092988__is-small{max-width:var(--wpds-dimension-surface-width-md,400px)}&._1eeeed880cb5769d__is-medium{max-width:var(--wpds-dimension-surface-width-lg,560px)}&._99f900b2267e22d0__is-large{max-width:var(--wpds-dimension-surface-width-2xl,960px)}&.b49f7ff9c06fe387__is-stretch{max-width:none}&.dcd4c2f5036cbf1a__is-full{height:100dvh}}._074affe4c56b4f2f__backdrop~* ._8acaa98861620d4d__popup{border-color:#0000}@media (forced-colors:active){._074affe4c56b4f2f__backdrop~* ._8acaa98861620d4d__popup,._8acaa98861620d4d__popup{border-color:CanvasText}}._76fb3b28fcbd45fc__header [data-wp-ui-dialog-close-icon]{margin-inline-start:auto}.d9d6da914ef0a77c__description{margin-bottom:var(--wpds-dimension-gap-lg,16px)}}'); 18451 } 18452 var style_default16 = { "backdrop": "_074affe4c56b4f2f__backdrop", "popup": "_8acaa98861620d4d__popup", "is-small": "_7acfa67ebf092988__is-small", "is-medium": "_1eeeed880cb5769d__is-medium", "is-large": "_99f900b2267e22d0__is-large", "is-stretch": "b49f7ff9c06fe387__is-stretch", "is-full": "dcd4c2f5036cbf1a__is-full", "header": "_76fb3b28fcbd45fc__header f1c50237c4787636__header", "footer": "_00eeb4f220cddae3__footer _579f95efdec92a66__footer", "title": "f636832002af749e__title _5371cc08aad82574__title", "content": "_101038da9af7162f__content _766d9011d37ce2d9__content", "description": "d9d6da914ef0a77c__description" }; 18453 var Description = (0, import_element46.forwardRef)( 18454 function DialogDescription3({ children, ...props }, ref) { 18455 return /* @__PURE__ */ (0, import_jsx_runtime83.jsx)( 18456 Text, 18457 { 18458 ref, 18459 variant: "body-md", 18460 render: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(index_parts_exports3.Description, { ...props }), 18461 className: style_default16.description, 18462 children 18463 } 18464 ); 18465 } 18466 ); 18467 18468 // packages/ui/build-module/dialog/footer.mjs 18469 var import_element47 = __toESM(require_element(), 1); 18470 var STYLE_HASH_ATTRIBUTE18 = "data-wp-hash"; 18471 function getRuntime18() { 18472 const globalScope = globalThis; 18473 if (globalScope.__wpStyleRuntime) { 18474 return globalScope.__wpStyleRuntime; 18475 } 18476 globalScope.__wpStyleRuntime = { 18477 documents: /* @__PURE__ */ new Map(), 18478 styles: /* @__PURE__ */ new Map(), 18479 injectedStyles: /* @__PURE__ */ new WeakMap() 18480 }; 18481 if (typeof document !== "undefined") { 18482 registerDocument18(document); 18483 } 18484 return globalScope.__wpStyleRuntime; 18485 } 18486 function documentContainsStyleHash18(targetDocument, hash) { 18487 if (!targetDocument.head) { 18488 return false; 18489 } 18490 for (const style of targetDocument.head.querySelectorAll( 18491 `style[$STYLE_HASH_ATTRIBUTE18}]` 18492 )) { 18493 if (style.getAttribute(STYLE_HASH_ATTRIBUTE18) === hash) { 18494 return true; 18495 } 18496 } 18497 return false; 18498 } 18499 function injectStyle18(targetDocument, hash, css) { 18500 if (!targetDocument.head) { 18501 return; 18502 } 18503 const runtime = getRuntime18(); 18504 let injectedStyles = runtime.injectedStyles.get(targetDocument); 18505 if (!injectedStyles) { 18506 injectedStyles = /* @__PURE__ */ new Set(); 18507 runtime.injectedStyles.set(targetDocument, injectedStyles); 18508 } 18509 if (injectedStyles.has(hash)) { 18510 return; 18511 } 18512 if (documentContainsStyleHash18(targetDocument, hash)) { 18513 injectedStyles.add(hash); 18514 return; 18515 } 18516 const style = targetDocument.createElement("style"); 18517 style.setAttribute(STYLE_HASH_ATTRIBUTE18, hash); 18518 style.appendChild(targetDocument.createTextNode(css)); 18519 targetDocument.head.appendChild(style); 18520 injectedStyles.add(hash); 18521 } 18522 function registerDocument18(targetDocument) { 18523 const runtime = getRuntime18(); 18524 runtime.documents.set( 18525 targetDocument, 18526 (runtime.documents.get(targetDocument) ?? 0) + 1 18527 ); 18528 for (const [hash, css] of runtime.styles) { 18529 injectStyle18(targetDocument, hash, css); 18530 } 18531 return () => { 18532 const count = runtime.documents.get(targetDocument); 18533 if (count === void 0) { 18534 return; 18535 } 18536 if (count <= 1) { 18537 runtime.documents.delete(targetDocument); 18538 return; 18539 } 18540 runtime.documents.set(targetDocument, count - 1); 18541 }; 18542 } 18543 function registerStyle18(hash, css) { 18544 const runtime = getRuntime18(); 18545 runtime.styles.set(hash, css); 18546 for (const targetDocument of runtime.documents.keys()) { 18547 injectStyle18(targetDocument, hash, css); 18548 } 18549 } 18550 if (typeof process === "undefined" || true) { 18551 registerStyle18("a400076f01", '@layer wp-ui-components{.f1c50237c4787636__header{min-height:32px;padding-block:var(--wpds-dimension-padding-2xl,24px) var(--wpds-dimension-gap-lg,16px)}._579f95efdec92a66__footer,.f1c50237c4787636__header{align-items:center;display:flex;gap:var(--wpds-dimension-gap-sm,8px);padding-inline:var(--wpds-dimension-padding-2xl,24px)}._579f95efdec92a66__footer{justify-content:flex-end;padding-block:var(--wpds-dimension-gap-lg,16px) var(--wpds-dimension-padding-2xl,24px)}._5371cc08aad82574__title{--_gcd-heading-color:var(--wpds-color-fg-content-neutral,#1e1e1e);--_gcd-heading-margin:0 auto 0 0;color:var(--wpds-color-fg-content-neutral,#1e1e1e);margin-inline-end:auto;&:dir(rtl){--_gcd-heading-margin:0 0 0 auto}}._766d9011d37ce2d9__content{flex:1 1 auto;min-block-size:0;overflow-block:auto;overflow-inline:hidden;padding:var(--wpds-dimension-padding-2xl,24px);&:focus-visible{outline-offset:calc(var(--wpds-border-width-focus, var(--wp-admin-border-width-focus, 2px))*-1)}}.f1c50237c4787636__header:has(~._766d9011d37ce2d9__content){border-block-end:1px solid #0000;padding-block-end:calc(var(--wpds-dimension-gap-lg, 16px) - 1px)}.f1c50237c4787636__header~._766d9011d37ce2d9__content{padding-block-start:0}._766d9011d37ce2d9__content~._579f95efdec92a66__footer{border-block-start:1px solid #0000;padding-block-start:calc(var(--wpds-dimension-gap-lg, 16px) - 1px)}._766d9011d37ce2d9__content:has(~._579f95efdec92a66__footer){padding-block-end:0}._766d9011d37ce2d9__content>.f1c50237c4787636__header,._766d9011d37ce2d9__content>[data-drawer-content]>.f1c50237c4787636__header{padding-inline:0}._766d9011d37ce2d9__content>.f1c50237c4787636__header:first-child,._766d9011d37ce2d9__content>[data-drawer-content]>.f1c50237c4787636__header:first-child{padding-block-start:0}._766d9011d37ce2d9__content>._579f95efdec92a66__footer,._766d9011d37ce2d9__content>[data-drawer-content]>._579f95efdec92a66__footer{padding-inline:0}._766d9011d37ce2d9__content>._579f95efdec92a66__footer:last-child,._766d9011d37ce2d9__content>[data-drawer-content]>._579f95efdec92a66__footer:last-child{padding-block-end:0}.f1c50237c4787636__header:has(~[data-wp-ui-overlay-scroll-container][data-wp-ui-overlay-scrolled-from-top]){border-block-end-color:var(--wpds-color-stroke-surface-neutral,#dbdbdb)}[data-wp-ui-overlay-scroll-container][data-wp-ui-overlay-scrolled-from-bottom]~._579f95efdec92a66__footer{border-block-start-color:var(--wpds-color-stroke-surface-neutral,#dbdbdb)}[data-wp-ui-overlay-modal] [data-wp-ui-overlay-scroll-container]{overscroll-behavior:contain}}@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;@layer wp-ui-components{._074affe4c56b4f2f__backdrop{background-color:#00000059;inset:0;position:fixed;z-index:var(--wp-ui-dialog-z-index,initial);&[data-ending-style],&[data-starting-style]{opacity:0}&[data-open]{opacity:1}@media not (prefers-reduced-motion){transition:opacity var(--wpds-motion-duration-md,.2s) var(--wpds-motion-easing-subtle,cubic-bezier(.15,0,.15,1))}}._8acaa98861620d4d__popup{--viewport-inset:var(--wpds-dimension-padding-2xl,24px);background-color:var(--wpds-color-bg-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-lg,8px);box-shadow:var(--wpds-elevation-lg,0 5px 15px 0 #00000014,0 15px 27px 0 #00000012,0 30px 36px 0 #0000000a,0 50px 43px 0 #00000005);box-sizing:border-box;color:var(--wpds-color-fg-content-neutral,#1e1e1e);display:flex;flex-direction:column;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);left:50%;line-height:var(--wpds-typography-line-height-md,24px);max-height:calc(100dvh - var(--viewport-inset)*2);min-width:var(--wpds-dimension-surface-width-sm,320px);overflow:hidden;position:fixed;top:50%;transform:translate(-50%,-50%);width:calc(100vw - var(--viewport-inset)*2);z-index:var(--wp-ui-dialog-z-index,initial);&[data-ending-style],&[data-starting-style]{opacity:0;transform:translate(-50%,-50%) scale(.9)}@media not (prefers-reduced-motion){transition:opacity var(--wpds-motion-duration-md,.2s) var(--wpds-motion-easing-expressive,cubic-bezier(.25,0,0,1)),transform var(--wpds-motion-duration-md,.2s) var(--wpds-motion-easing-expressive,cubic-bezier(.25,0,0,1))}@media (min-width:480px){min-width:var(--wpds-dimension-surface-width-md,400px)}&._7acfa67ebf092988__is-small{max-width:var(--wpds-dimension-surface-width-md,400px)}&._1eeeed880cb5769d__is-medium{max-width:var(--wpds-dimension-surface-width-lg,560px)}&._99f900b2267e22d0__is-large{max-width:var(--wpds-dimension-surface-width-2xl,960px)}&.b49f7ff9c06fe387__is-stretch{max-width:none}&.dcd4c2f5036cbf1a__is-full{height:100dvh}}._074affe4c56b4f2f__backdrop~* ._8acaa98861620d4d__popup{border-color:#0000}@media (forced-colors:active){._074affe4c56b4f2f__backdrop~* ._8acaa98861620d4d__popup,._8acaa98861620d4d__popup{border-color:CanvasText}}._76fb3b28fcbd45fc__header [data-wp-ui-dialog-close-icon]{margin-inline-start:auto}.d9d6da914ef0a77c__description{margin-bottom:var(--wpds-dimension-gap-lg,16px)}}'); 18552 } 18553 var style_default17 = { "backdrop": "_074affe4c56b4f2f__backdrop", "popup": "_8acaa98861620d4d__popup", "is-small": "_7acfa67ebf092988__is-small", "is-medium": "_1eeeed880cb5769d__is-medium", "is-large": "_99f900b2267e22d0__is-large", "is-stretch": "b49f7ff9c06fe387__is-stretch", "is-full": "dcd4c2f5036cbf1a__is-full", "header": "_76fb3b28fcbd45fc__header f1c50237c4787636__header", "footer": "_00eeb4f220cddae3__footer _579f95efdec92a66__footer", "title": "f636832002af749e__title _5371cc08aad82574__title", "content": "_101038da9af7162f__content _766d9011d37ce2d9__content", "description": "d9d6da914ef0a77c__description" }; 18554 var Footer = (0, import_element47.forwardRef)(function DialogFooter({ className, render: render4, ...props }, ref) { 18555 const element = useRender({ 18556 defaultTagName: "footer", 18557 render: render4, 18558 ref, 18559 props: mergeProps(props, { 18560 className: clsx_default(style_default17.footer, className) 18561 }) 18562 }); 18563 return element; 18564 }); 18565 18566 // packages/ui/build-module/dialog/header.mjs 18567 var import_element48 = __toESM(require_element(), 1); 18568 var STYLE_HASH_ATTRIBUTE19 = "data-wp-hash"; 18569 function getRuntime19() { 18570 const globalScope = globalThis; 18571 if (globalScope.__wpStyleRuntime) { 18572 return globalScope.__wpStyleRuntime; 18573 } 18574 globalScope.__wpStyleRuntime = { 18575 documents: /* @__PURE__ */ new Map(), 18576 styles: /* @__PURE__ */ new Map(), 18577 injectedStyles: /* @__PURE__ */ new WeakMap() 18578 }; 18579 if (typeof document !== "undefined") { 18580 registerDocument19(document); 18581 } 18582 return globalScope.__wpStyleRuntime; 18583 } 18584 function documentContainsStyleHash19(targetDocument, hash) { 18585 if (!targetDocument.head) { 18586 return false; 18587 } 18588 for (const style of targetDocument.head.querySelectorAll( 18589 `style[$STYLE_HASH_ATTRIBUTE19}]` 18590 )) { 18591 if (style.getAttribute(STYLE_HASH_ATTRIBUTE19) === hash) { 18592 return true; 18593 } 18594 } 18595 return false; 18596 } 18597 function injectStyle19(targetDocument, hash, css) { 18598 if (!targetDocument.head) { 18599 return; 18600 } 18601 const runtime = getRuntime19(); 18602 let injectedStyles = runtime.injectedStyles.get(targetDocument); 18603 if (!injectedStyles) { 18604 injectedStyles = /* @__PURE__ */ new Set(); 18605 runtime.injectedStyles.set(targetDocument, injectedStyles); 18606 } 18607 if (injectedStyles.has(hash)) { 18608 return; 18609 } 18610 if (documentContainsStyleHash19(targetDocument, hash)) { 18611 injectedStyles.add(hash); 18612 return; 18613 } 18614 const style = targetDocument.createElement("style"); 18615 style.setAttribute(STYLE_HASH_ATTRIBUTE19, hash); 18616 style.appendChild(targetDocument.createTextNode(css)); 18617 targetDocument.head.appendChild(style); 18618 injectedStyles.add(hash); 18619 } 18620 function registerDocument19(targetDocument) { 18621 const runtime = getRuntime19(); 18622 runtime.documents.set( 18623 targetDocument, 18624 (runtime.documents.get(targetDocument) ?? 0) + 1 18625 ); 18626 for (const [hash, css] of runtime.styles) { 18627 injectStyle19(targetDocument, hash, css); 18628 } 18629 return () => { 18630 const count = runtime.documents.get(targetDocument); 18631 if (count === void 0) { 18632 return; 18633 } 18634 if (count <= 1) { 18635 runtime.documents.delete(targetDocument); 18636 return; 18637 } 18638 runtime.documents.set(targetDocument, count - 1); 18639 }; 18640 } 18641 function registerStyle19(hash, css) { 18642 const runtime = getRuntime19(); 18643 runtime.styles.set(hash, css); 18644 for (const targetDocument of runtime.documents.keys()) { 18645 injectStyle19(targetDocument, hash, css); 18646 } 18647 } 18648 if (typeof process === "undefined" || true) { 18649 registerStyle19("a400076f01", '@layer wp-ui-components{.f1c50237c4787636__header{min-height:32px;padding-block:var(--wpds-dimension-padding-2xl,24px) var(--wpds-dimension-gap-lg,16px)}._579f95efdec92a66__footer,.f1c50237c4787636__header{align-items:center;display:flex;gap:var(--wpds-dimension-gap-sm,8px);padding-inline:var(--wpds-dimension-padding-2xl,24px)}._579f95efdec92a66__footer{justify-content:flex-end;padding-block:var(--wpds-dimension-gap-lg,16px) var(--wpds-dimension-padding-2xl,24px)}._5371cc08aad82574__title{--_gcd-heading-color:var(--wpds-color-fg-content-neutral,#1e1e1e);--_gcd-heading-margin:0 auto 0 0;color:var(--wpds-color-fg-content-neutral,#1e1e1e);margin-inline-end:auto;&:dir(rtl){--_gcd-heading-margin:0 0 0 auto}}._766d9011d37ce2d9__content{flex:1 1 auto;min-block-size:0;overflow-block:auto;overflow-inline:hidden;padding:var(--wpds-dimension-padding-2xl,24px);&:focus-visible{outline-offset:calc(var(--wpds-border-width-focus, var(--wp-admin-border-width-focus, 2px))*-1)}}.f1c50237c4787636__header:has(~._766d9011d37ce2d9__content){border-block-end:1px solid #0000;padding-block-end:calc(var(--wpds-dimension-gap-lg, 16px) - 1px)}.f1c50237c4787636__header~._766d9011d37ce2d9__content{padding-block-start:0}._766d9011d37ce2d9__content~._579f95efdec92a66__footer{border-block-start:1px solid #0000;padding-block-start:calc(var(--wpds-dimension-gap-lg, 16px) - 1px)}._766d9011d37ce2d9__content:has(~._579f95efdec92a66__footer){padding-block-end:0}._766d9011d37ce2d9__content>.f1c50237c4787636__header,._766d9011d37ce2d9__content>[data-drawer-content]>.f1c50237c4787636__header{padding-inline:0}._766d9011d37ce2d9__content>.f1c50237c4787636__header:first-child,._766d9011d37ce2d9__content>[data-drawer-content]>.f1c50237c4787636__header:first-child{padding-block-start:0}._766d9011d37ce2d9__content>._579f95efdec92a66__footer,._766d9011d37ce2d9__content>[data-drawer-content]>._579f95efdec92a66__footer{padding-inline:0}._766d9011d37ce2d9__content>._579f95efdec92a66__footer:last-child,._766d9011d37ce2d9__content>[data-drawer-content]>._579f95efdec92a66__footer:last-child{padding-block-end:0}.f1c50237c4787636__header:has(~[data-wp-ui-overlay-scroll-container][data-wp-ui-overlay-scrolled-from-top]){border-block-end-color:var(--wpds-color-stroke-surface-neutral,#dbdbdb)}[data-wp-ui-overlay-scroll-container][data-wp-ui-overlay-scrolled-from-bottom]~._579f95efdec92a66__footer{border-block-start-color:var(--wpds-color-stroke-surface-neutral,#dbdbdb)}[data-wp-ui-overlay-modal] [data-wp-ui-overlay-scroll-container]{overscroll-behavior:contain}}@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;@layer wp-ui-components{._074affe4c56b4f2f__backdrop{background-color:#00000059;inset:0;position:fixed;z-index:var(--wp-ui-dialog-z-index,initial);&[data-ending-style],&[data-starting-style]{opacity:0}&[data-open]{opacity:1}@media not (prefers-reduced-motion){transition:opacity var(--wpds-motion-duration-md,.2s) var(--wpds-motion-easing-subtle,cubic-bezier(.15,0,.15,1))}}._8acaa98861620d4d__popup{--viewport-inset:var(--wpds-dimension-padding-2xl,24px);background-color:var(--wpds-color-bg-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-lg,8px);box-shadow:var(--wpds-elevation-lg,0 5px 15px 0 #00000014,0 15px 27px 0 #00000012,0 30px 36px 0 #0000000a,0 50px 43px 0 #00000005);box-sizing:border-box;color:var(--wpds-color-fg-content-neutral,#1e1e1e);display:flex;flex-direction:column;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);left:50%;line-height:var(--wpds-typography-line-height-md,24px);max-height:calc(100dvh - var(--viewport-inset)*2);min-width:var(--wpds-dimension-surface-width-sm,320px);overflow:hidden;position:fixed;top:50%;transform:translate(-50%,-50%);width:calc(100vw - var(--viewport-inset)*2);z-index:var(--wp-ui-dialog-z-index,initial);&[data-ending-style],&[data-starting-style]{opacity:0;transform:translate(-50%,-50%) scale(.9)}@media not (prefers-reduced-motion){transition:opacity var(--wpds-motion-duration-md,.2s) var(--wpds-motion-easing-expressive,cubic-bezier(.25,0,0,1)),transform var(--wpds-motion-duration-md,.2s) var(--wpds-motion-easing-expressive,cubic-bezier(.25,0,0,1))}@media (min-width:480px){min-width:var(--wpds-dimension-surface-width-md,400px)}&._7acfa67ebf092988__is-small{max-width:var(--wpds-dimension-surface-width-md,400px)}&._1eeeed880cb5769d__is-medium{max-width:var(--wpds-dimension-surface-width-lg,560px)}&._99f900b2267e22d0__is-large{max-width:var(--wpds-dimension-surface-width-2xl,960px)}&.b49f7ff9c06fe387__is-stretch{max-width:none}&.dcd4c2f5036cbf1a__is-full{height:100dvh}}._074affe4c56b4f2f__backdrop~* ._8acaa98861620d4d__popup{border-color:#0000}@media (forced-colors:active){._074affe4c56b4f2f__backdrop~* ._8acaa98861620d4d__popup,._8acaa98861620d4d__popup{border-color:CanvasText}}._76fb3b28fcbd45fc__header [data-wp-ui-dialog-close-icon]{margin-inline-start:auto}.d9d6da914ef0a77c__description{margin-bottom:var(--wpds-dimension-gap-lg,16px)}}'); 18650 } 18651 var style_default18 = { "backdrop": "_074affe4c56b4f2f__backdrop", "popup": "_8acaa98861620d4d__popup", "is-small": "_7acfa67ebf092988__is-small", "is-medium": "_1eeeed880cb5769d__is-medium", "is-large": "_99f900b2267e22d0__is-large", "is-stretch": "b49f7ff9c06fe387__is-stretch", "is-full": "dcd4c2f5036cbf1a__is-full", "header": "_76fb3b28fcbd45fc__header f1c50237c4787636__header", "footer": "_00eeb4f220cddae3__footer _579f95efdec92a66__footer", "title": "f636832002af749e__title _5371cc08aad82574__title", "content": "_101038da9af7162f__content _766d9011d37ce2d9__content", "description": "d9d6da914ef0a77c__description" }; 18652 var Header3 = (0, import_element48.forwardRef)(function DialogHeader({ className, render: render4, ...props }, ref) { 18653 const element = useRender({ 18654 defaultTagName: "header", 18655 render: render4, 18656 ref, 18657 props: mergeProps(props, { 18658 className: clsx_default(style_default18.header, className) 18659 }) 18660 }); 18661 return element; 18662 }); 18663 18664 // packages/ui/build-module/dialog/popup.mjs 18665 var import_element53 = __toESM(require_element(), 1); 18666 var import_compose3 = __toESM(require_compose(), 1); 18667 var import_theme3 = __toESM(require_theme(), 1); 18668 18669 // packages/ui/build-module/utils/create-overlay-modal-context.mjs 18670 var import_element49 = __toESM(require_element(), 1); 18671 var import_jsx_runtime84 = __toESM(require_jsx_runtime(), 1); 18672 function createOverlayModalContext(initialValue) { 18673 const OverlayModalContext = (0, import_element49.createContext)(initialValue); 18674 function OverlayModalProvider({ 18675 modal, 18676 children 18677 }) { 18678 return /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(OverlayModalContext.Provider, { value: modal, children }); 18679 } 18680 function useOverlayModal() { 18681 return (0, import_element49.useContext)(OverlayModalContext); 18682 } 18683 return { 18684 Provider: OverlayModalProvider, 18685 useModal: useOverlayModal 18686 }; 18687 } 18688 18689 // packages/ui/build-module/utils/create-overlay-title-validation.mjs 18690 var import_element51 = __toESM(require_element(), 1); 18691 18692 // packages/ui/build-module/utils/use-schedule-validation.mjs 18693 var import_element50 = __toESM(require_element(), 1); 18694 function useScheduleValidation(validate) { 18695 const validateRef = (0, import_element50.useRef)(validate); 18696 validateRef.current = validate; 18697 const timerRef = (0, import_element50.useRef)(null); 18698 const unmountedRef = (0, import_element50.useRef)(false); 18699 const scheduleValidation = (0, import_element50.useCallback)(() => { 18700 if (unmountedRef.current) { 18701 return; 18702 } 18703 if (timerRef.current) { 18704 clearTimeout(timerRef.current); 18705 } 18706 timerRef.current = setTimeout(() => { 18707 validateRef.current(); 18708 timerRef.current = null; 18709 }, 0); 18710 }, []); 18711 (0, import_element50.useEffect)(() => { 18712 unmountedRef.current = false; 18713 return () => { 18714 unmountedRef.current = true; 18715 if (timerRef.current) { 18716 clearTimeout(timerRef.current); 18717 } 18718 }; 18719 }, []); 18720 return scheduleValidation; 18721 } 18722 18723 // packages/ui/build-module/utils/create-overlay-title-validation.mjs 18724 var import_jsx_runtime85 = __toESM(require_jsx_runtime(), 1); 18725 var VALIDATION_ENABLED = true; 18726 function createOverlayTitleValidation(componentName) { 18727 const componentNameLowerCase = componentName.toLowerCase(); 18728 const OverlayValidationContext = VALIDATION_ENABLED ? (0, import_element51.createContext)(null) : null; 18729 function useValidationContextDev() { 18730 return (0, import_element51.useContext)(OverlayValidationContext); 18731 } 18732 function useValidationContextProd() { 18733 return null; 18734 } 18735 const useValidationContext = VALIDATION_ENABLED ? useValidationContextDev : useValidationContextProd; 18736 function ValidationProviderDev({ 18737 children 18738 }) { 18739 const titleElementRef = (0, import_element51.useRef)(null); 18740 const scheduleValidation = useScheduleValidation(() => { 18741 const titleElement = titleElementRef.current; 18742 if (!titleElement) { 18743 throw new Error( 18744 `$componentName}: Missing <$componentName}.Title>. For accessibility, every $componentNameLowerCase} requires a title. If needed, the title can be visually hidden but must not be omitted.` 18745 ); 18746 } 18747 const textContent = titleElement.textContent?.trim(); 18748 if (!textContent) { 18749 throw new Error( 18750 `$componentName}: <$componentName}.Title> cannot be empty. Provide meaningful text content for the $componentNameLowerCase} title.` 18751 ); 18752 } 18753 }); 18754 const registerTitle = (0, import_element51.useCallback)( 18755 (element) => { 18756 titleElementRef.current = element; 18757 scheduleValidation(); 18758 return () => { 18759 titleElementRef.current = null; 18760 scheduleValidation(); 18761 }; 18762 }, 18763 [scheduleValidation] 18764 ); 18765 const contextValue = (0, import_element51.useMemo)( 18766 () => ({ registerTitle }), 18767 [registerTitle] 18768 ); 18769 (0, import_element51.useEffect)(() => { 18770 scheduleValidation(); 18771 }, [scheduleValidation]); 18772 return /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(OverlayValidationContext.Provider, { value: contextValue, children }); 18773 } 18774 function ValidationProviderProd({ 18775 children 18776 }) { 18777 return /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(import_jsx_runtime85.Fragment, { children }); 18778 } 18779 const ValidationProvider = VALIDATION_ENABLED ? ValidationProviderDev : ValidationProviderProd; 18780 return { 18781 ValidationProvider, 18782 useValidationContext 18783 }; 18784 } 18785 18786 // packages/ui/build-module/dialog/context.mjs 18787 var dialogModal = createOverlayModalContext(true); 18788 var DialogModalProvider = dialogModal.Provider; 18789 var useDialogModal = dialogModal.useModal; 18790 var dialogTitleValidation = createOverlayTitleValidation("Dialog"); 18791 var useDialogValidationContext = dialogTitleValidation.useValidationContext; 18792 var DialogValidationProvider = dialogTitleValidation.ValidationProvider; 18793 18794 // packages/ui/build-module/dialog/portal.mjs 18795 var import_element52 = __toESM(require_element(), 1); 18796 var import_jsx_runtime86 = __toESM(require_jsx_runtime(), 1); 18797 var Portal3 = (0, import_element52.forwardRef)( 18798 function DialogPortal3(props, ref) { 18799 return /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(index_parts_exports3.Portal, { ref, ...props }); 18800 } 18801 ); 18802 18803 // packages/ui/build-module/dialog/popup.mjs 18804 var import_jsx_runtime87 = __toESM(require_jsx_runtime(), 1); 18805 var STYLE_HASH_ATTRIBUTE20 = "data-wp-hash"; 18806 function getRuntime20() { 18807 const globalScope = globalThis; 18808 if (globalScope.__wpStyleRuntime) { 18809 return globalScope.__wpStyleRuntime; 18810 } 18811 globalScope.__wpStyleRuntime = { 18812 documents: /* @__PURE__ */ new Map(), 18813 styles: /* @__PURE__ */ new Map(), 18814 injectedStyles: /* @__PURE__ */ new WeakMap() 18815 }; 18816 if (typeof document !== "undefined") { 18817 registerDocument20(document); 18818 } 18819 return globalScope.__wpStyleRuntime; 18820 } 18821 function documentContainsStyleHash20(targetDocument, hash) { 18822 if (!targetDocument.head) { 18823 return false; 18824 } 18825 for (const style of targetDocument.head.querySelectorAll( 18826 `style[$STYLE_HASH_ATTRIBUTE20}]` 18827 )) { 18828 if (style.getAttribute(STYLE_HASH_ATTRIBUTE20) === hash) { 18829 return true; 18830 } 18831 } 18832 return false; 18833 } 18834 function injectStyle20(targetDocument, hash, css) { 18835 if (!targetDocument.head) { 18836 return; 18837 } 18838 const runtime = getRuntime20(); 18839 let injectedStyles = runtime.injectedStyles.get(targetDocument); 18840 if (!injectedStyles) { 18841 injectedStyles = /* @__PURE__ */ new Set(); 18842 runtime.injectedStyles.set(targetDocument, injectedStyles); 18843 } 18844 if (injectedStyles.has(hash)) { 18845 return; 18846 } 18847 if (documentContainsStyleHash20(targetDocument, hash)) { 18848 injectedStyles.add(hash); 18849 return; 18850 } 18851 const style = targetDocument.createElement("style"); 18852 style.setAttribute(STYLE_HASH_ATTRIBUTE20, hash); 18853 style.appendChild(targetDocument.createTextNode(css)); 18854 targetDocument.head.appendChild(style); 18855 injectedStyles.add(hash); 18856 } 18857 function registerDocument20(targetDocument) { 18858 const runtime = getRuntime20(); 18859 runtime.documents.set( 18860 targetDocument, 18861 (runtime.documents.get(targetDocument) ?? 0) + 1 18862 ); 18863 for (const [hash, css] of runtime.styles) { 18864 injectStyle20(targetDocument, hash, css); 18865 } 18866 return () => { 18867 const count = runtime.documents.get(targetDocument); 18868 if (count === void 0) { 18869 return; 18870 } 18871 if (count <= 1) { 18872 runtime.documents.delete(targetDocument); 18873 return; 18874 } 18875 runtime.documents.set(targetDocument, count - 1); 18876 }; 18877 } 18878 function registerStyle20(hash, css) { 18879 const runtime = getRuntime20(); 18880 runtime.styles.set(hash, css); 18881 for (const targetDocument of runtime.documents.keys()) { 18882 injectStyle20(targetDocument, hash, css); 18883 } 18884 } 18885 if (typeof process === "undefined" || true) { 18886 registerStyle20("a400076f01", '@layer wp-ui-components{.f1c50237c4787636__header{min-height:32px;padding-block:var(--wpds-dimension-padding-2xl,24px) var(--wpds-dimension-gap-lg,16px)}._579f95efdec92a66__footer,.f1c50237c4787636__header{align-items:center;display:flex;gap:var(--wpds-dimension-gap-sm,8px);padding-inline:var(--wpds-dimension-padding-2xl,24px)}._579f95efdec92a66__footer{justify-content:flex-end;padding-block:var(--wpds-dimension-gap-lg,16px) var(--wpds-dimension-padding-2xl,24px)}._5371cc08aad82574__title{--_gcd-heading-color:var(--wpds-color-fg-content-neutral,#1e1e1e);--_gcd-heading-margin:0 auto 0 0;color:var(--wpds-color-fg-content-neutral,#1e1e1e);margin-inline-end:auto;&:dir(rtl){--_gcd-heading-margin:0 0 0 auto}}._766d9011d37ce2d9__content{flex:1 1 auto;min-block-size:0;overflow-block:auto;overflow-inline:hidden;padding:var(--wpds-dimension-padding-2xl,24px);&:focus-visible{outline-offset:calc(var(--wpds-border-width-focus, var(--wp-admin-border-width-focus, 2px))*-1)}}.f1c50237c4787636__header:has(~._766d9011d37ce2d9__content){border-block-end:1px solid #0000;padding-block-end:calc(var(--wpds-dimension-gap-lg, 16px) - 1px)}.f1c50237c4787636__header~._766d9011d37ce2d9__content{padding-block-start:0}._766d9011d37ce2d9__content~._579f95efdec92a66__footer{border-block-start:1px solid #0000;padding-block-start:calc(var(--wpds-dimension-gap-lg, 16px) - 1px)}._766d9011d37ce2d9__content:has(~._579f95efdec92a66__footer){padding-block-end:0}._766d9011d37ce2d9__content>.f1c50237c4787636__header,._766d9011d37ce2d9__content>[data-drawer-content]>.f1c50237c4787636__header{padding-inline:0}._766d9011d37ce2d9__content>.f1c50237c4787636__header:first-child,._766d9011d37ce2d9__content>[data-drawer-content]>.f1c50237c4787636__header:first-child{padding-block-start:0}._766d9011d37ce2d9__content>._579f95efdec92a66__footer,._766d9011d37ce2d9__content>[data-drawer-content]>._579f95efdec92a66__footer{padding-inline:0}._766d9011d37ce2d9__content>._579f95efdec92a66__footer:last-child,._766d9011d37ce2d9__content>[data-drawer-content]>._579f95efdec92a66__footer:last-child{padding-block-end:0}.f1c50237c4787636__header:has(~[data-wp-ui-overlay-scroll-container][data-wp-ui-overlay-scrolled-from-top]){border-block-end-color:var(--wpds-color-stroke-surface-neutral,#dbdbdb)}[data-wp-ui-overlay-scroll-container][data-wp-ui-overlay-scrolled-from-bottom]~._579f95efdec92a66__footer{border-block-start-color:var(--wpds-color-stroke-surface-neutral,#dbdbdb)}[data-wp-ui-overlay-modal] [data-wp-ui-overlay-scroll-container]{overscroll-behavior:contain}}@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;@layer wp-ui-components{._074affe4c56b4f2f__backdrop{background-color:#00000059;inset:0;position:fixed;z-index:var(--wp-ui-dialog-z-index,initial);&[data-ending-style],&[data-starting-style]{opacity:0}&[data-open]{opacity:1}@media not (prefers-reduced-motion){transition:opacity var(--wpds-motion-duration-md,.2s) var(--wpds-motion-easing-subtle,cubic-bezier(.15,0,.15,1))}}._8acaa98861620d4d__popup{--viewport-inset:var(--wpds-dimension-padding-2xl,24px);background-color:var(--wpds-color-bg-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-lg,8px);box-shadow:var(--wpds-elevation-lg,0 5px 15px 0 #00000014,0 15px 27px 0 #00000012,0 30px 36px 0 #0000000a,0 50px 43px 0 #00000005);box-sizing:border-box;color:var(--wpds-color-fg-content-neutral,#1e1e1e);display:flex;flex-direction:column;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);left:50%;line-height:var(--wpds-typography-line-height-md,24px);max-height:calc(100dvh - var(--viewport-inset)*2);min-width:var(--wpds-dimension-surface-width-sm,320px);overflow:hidden;position:fixed;top:50%;transform:translate(-50%,-50%);width:calc(100vw - var(--viewport-inset)*2);z-index:var(--wp-ui-dialog-z-index,initial);&[data-ending-style],&[data-starting-style]{opacity:0;transform:translate(-50%,-50%) scale(.9)}@media not (prefers-reduced-motion){transition:opacity var(--wpds-motion-duration-md,.2s) var(--wpds-motion-easing-expressive,cubic-bezier(.25,0,0,1)),transform var(--wpds-motion-duration-md,.2s) var(--wpds-motion-easing-expressive,cubic-bezier(.25,0,0,1))}@media (min-width:480px){min-width:var(--wpds-dimension-surface-width-md,400px)}&._7acfa67ebf092988__is-small{max-width:var(--wpds-dimension-surface-width-md,400px)}&._1eeeed880cb5769d__is-medium{max-width:var(--wpds-dimension-surface-width-lg,560px)}&._99f900b2267e22d0__is-large{max-width:var(--wpds-dimension-surface-width-2xl,960px)}&.b49f7ff9c06fe387__is-stretch{max-width:none}&.dcd4c2f5036cbf1a__is-full{height:100dvh}}._074affe4c56b4f2f__backdrop~* ._8acaa98861620d4d__popup{border-color:#0000}@media (forced-colors:active){._074affe4c56b4f2f__backdrop~* ._8acaa98861620d4d__popup,._8acaa98861620d4d__popup{border-color:CanvasText}}._76fb3b28fcbd45fc__header [data-wp-ui-dialog-close-icon]{margin-inline-start:auto}.d9d6da914ef0a77c__description{margin-bottom:var(--wpds-dimension-gap-lg,16px)}}'); 18887 } 18888 var style_default19 = { "backdrop": "_074affe4c56b4f2f__backdrop", "popup": "_8acaa98861620d4d__popup", "is-small": "_7acfa67ebf092988__is-small", "is-medium": "_1eeeed880cb5769d__is-medium", "is-large": "_99f900b2267e22d0__is-large", "is-stretch": "b49f7ff9c06fe387__is-stretch", "is-full": "dcd4c2f5036cbf1a__is-full", "header": "_76fb3b28fcbd45fc__header f1c50237c4787636__header", "footer": "_00eeb4f220cddae3__footer _579f95efdec92a66__footer", "title": "f636832002af749e__title _5371cc08aad82574__title", "content": "_101038da9af7162f__content _766d9011d37ce2d9__content", "description": "d9d6da914ef0a77c__description" }; 18889 var ThemeProvider3 = unlock(import_theme3.privateApis).ThemeProvider; 18890 var CLOSE_ICON_ATTR = "data-wp-ui-dialog-close-icon"; 18891 var Popup3 = (0, import_element53.forwardRef)(function DialogPopup3({ 18892 className, 18893 portal, 18894 children, 18895 size: size4 = "medium", 18896 initialFocus, 18897 finalFocus, 18898 ...props 18899 }, ref) { 18900 const { resolvedInitialFocus, popupRef } = useDeprioritizedInitialFocus({ 18901 initialFocus, 18902 deprioritizedAttributes: [CLOSE_ICON_ATTR, SCROLL_CONTAINER_ATTR] 18903 }); 18904 const mergedRef = (0, import_compose3.useMergeRefs)([ref, popupRef]); 18905 const modal = useDialogModal(); 18906 const portalChildren = /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)(import_jsx_runtime87.Fragment, { children: [ 18907 modal === true && /* @__PURE__ */ (0, import_jsx_runtime87.jsx)( 18908 index_parts_exports3.Backdrop, 18909 { 18910 className: style_default19.backdrop, 18911 "data-testid": "dialog-backdrop" 18912 } 18913 ), 18914 /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(ThemeProvider3, { children: /* @__PURE__ */ (0, import_jsx_runtime87.jsx)( 18915 index_parts_exports3.Popup, 18916 { 18917 ref: mergedRef, 18918 className: clsx_default( 18919 style_default19.popup, 18920 className, 18921 style_default19[`is-$size4}`] 18922 ), 18923 initialFocus: resolvedInitialFocus, 18924 finalFocus, 18925 ...props, 18926 "data-wp-ui-overlay-modal": modal === true ? "" : void 0, 18927 children: /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(DialogValidationProvider, { children }) 18928 } 18929 ) }) 18930 ] }); 18931 return renderSlotWithChildren(portal, /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(Portal3, {}), portalChildren); 18932 }); 18933 18934 // packages/ui/build-module/dialog/root.mjs 18935 var import_jsx_runtime88 = __toESM(require_jsx_runtime(), 1); 18936 function Root6({ modal = true, children, ...props }) { 18937 return /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(index_parts_exports3.Root, { modal, ...props, children: /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(DialogModalProvider, { modal, children }) }); 18938 } 18939 18940 // packages/ui/build-module/dialog/title.mjs 18941 var import_compose4 = __toESM(require_compose(), 1); 18942 var import_element54 = __toESM(require_element(), 1); 18943 var import_jsx_runtime89 = __toESM(require_jsx_runtime(), 1); 18944 var STYLE_HASH_ATTRIBUTE21 = "data-wp-hash"; 18945 function getRuntime21() { 18946 const globalScope = globalThis; 18947 if (globalScope.__wpStyleRuntime) { 18948 return globalScope.__wpStyleRuntime; 18949 } 18950 globalScope.__wpStyleRuntime = { 18951 documents: /* @__PURE__ */ new Map(), 18952 styles: /* @__PURE__ */ new Map(), 18953 injectedStyles: /* @__PURE__ */ new WeakMap() 18954 }; 18955 if (typeof document !== "undefined") { 18956 registerDocument21(document); 18957 } 18958 return globalScope.__wpStyleRuntime; 18959 } 18960 function documentContainsStyleHash21(targetDocument, hash) { 18961 if (!targetDocument.head) { 18962 return false; 18963 } 18964 for (const style of targetDocument.head.querySelectorAll( 18965 `style[$STYLE_HASH_ATTRIBUTE21}]` 18966 )) { 18967 if (style.getAttribute(STYLE_HASH_ATTRIBUTE21) === hash) { 18968 return true; 18969 } 18970 } 18971 return false; 18972 } 18973 function injectStyle21(targetDocument, hash, css) { 18974 if (!targetDocument.head) { 18975 return; 18976 } 18977 const runtime = getRuntime21(); 18978 let injectedStyles = runtime.injectedStyles.get(targetDocument); 18979 if (!injectedStyles) { 18980 injectedStyles = /* @__PURE__ */ new Set(); 18981 runtime.injectedStyles.set(targetDocument, injectedStyles); 18982 } 18983 if (injectedStyles.has(hash)) { 18984 return; 18985 } 18986 if (documentContainsStyleHash21(targetDocument, hash)) { 18987 injectedStyles.add(hash); 18988 return; 18989 } 18990 const style = targetDocument.createElement("style"); 18991 style.setAttribute(STYLE_HASH_ATTRIBUTE21, hash); 18992 style.appendChild(targetDocument.createTextNode(css)); 18993 targetDocument.head.appendChild(style); 18994 injectedStyles.add(hash); 18995 } 18996 function registerDocument21(targetDocument) { 18997 const runtime = getRuntime21(); 18998 runtime.documents.set( 18999 targetDocument, 19000 (runtime.documents.get(targetDocument) ?? 0) + 1 19001 ); 19002 for (const [hash, css] of runtime.styles) { 19003 injectStyle21(targetDocument, hash, css); 19004 } 19005 return () => { 19006 const count = runtime.documents.get(targetDocument); 19007 if (count === void 0) { 19008 return; 19009 } 19010 if (count <= 1) { 19011 runtime.documents.delete(targetDocument); 19012 return; 19013 } 19014 runtime.documents.set(targetDocument, count - 1); 19015 }; 19016 } 19017 function registerStyle21(hash, css) { 19018 const runtime = getRuntime21(); 19019 runtime.styles.set(hash, css); 19020 for (const targetDocument of runtime.documents.keys()) { 19021 injectStyle21(targetDocument, hash, css); 19022 } 19023 } 19024 if (typeof process === "undefined" || true) { 19025 registerStyle21("a400076f01", '@layer wp-ui-components{.f1c50237c4787636__header{min-height:32px;padding-block:var(--wpds-dimension-padding-2xl,24px) var(--wpds-dimension-gap-lg,16px)}._579f95efdec92a66__footer,.f1c50237c4787636__header{align-items:center;display:flex;gap:var(--wpds-dimension-gap-sm,8px);padding-inline:var(--wpds-dimension-padding-2xl,24px)}._579f95efdec92a66__footer{justify-content:flex-end;padding-block:var(--wpds-dimension-gap-lg,16px) var(--wpds-dimension-padding-2xl,24px)}._5371cc08aad82574__title{--_gcd-heading-color:var(--wpds-color-fg-content-neutral,#1e1e1e);--_gcd-heading-margin:0 auto 0 0;color:var(--wpds-color-fg-content-neutral,#1e1e1e);margin-inline-end:auto;&:dir(rtl){--_gcd-heading-margin:0 0 0 auto}}._766d9011d37ce2d9__content{flex:1 1 auto;min-block-size:0;overflow-block:auto;overflow-inline:hidden;padding:var(--wpds-dimension-padding-2xl,24px);&:focus-visible{outline-offset:calc(var(--wpds-border-width-focus, var(--wp-admin-border-width-focus, 2px))*-1)}}.f1c50237c4787636__header:has(~._766d9011d37ce2d9__content){border-block-end:1px solid #0000;padding-block-end:calc(var(--wpds-dimension-gap-lg, 16px) - 1px)}.f1c50237c4787636__header~._766d9011d37ce2d9__content{padding-block-start:0}._766d9011d37ce2d9__content~._579f95efdec92a66__footer{border-block-start:1px solid #0000;padding-block-start:calc(var(--wpds-dimension-gap-lg, 16px) - 1px)}._766d9011d37ce2d9__content:has(~._579f95efdec92a66__footer){padding-block-end:0}._766d9011d37ce2d9__content>.f1c50237c4787636__header,._766d9011d37ce2d9__content>[data-drawer-content]>.f1c50237c4787636__header{padding-inline:0}._766d9011d37ce2d9__content>.f1c50237c4787636__header:first-child,._766d9011d37ce2d9__content>[data-drawer-content]>.f1c50237c4787636__header:first-child{padding-block-start:0}._766d9011d37ce2d9__content>._579f95efdec92a66__footer,._766d9011d37ce2d9__content>[data-drawer-content]>._579f95efdec92a66__footer{padding-inline:0}._766d9011d37ce2d9__content>._579f95efdec92a66__footer:last-child,._766d9011d37ce2d9__content>[data-drawer-content]>._579f95efdec92a66__footer:last-child{padding-block-end:0}.f1c50237c4787636__header:has(~[data-wp-ui-overlay-scroll-container][data-wp-ui-overlay-scrolled-from-top]){border-block-end-color:var(--wpds-color-stroke-surface-neutral,#dbdbdb)}[data-wp-ui-overlay-scroll-container][data-wp-ui-overlay-scrolled-from-bottom]~._579f95efdec92a66__footer{border-block-start-color:var(--wpds-color-stroke-surface-neutral,#dbdbdb)}[data-wp-ui-overlay-modal] [data-wp-ui-overlay-scroll-container]{overscroll-behavior:contain}}@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;@layer wp-ui-components{._074affe4c56b4f2f__backdrop{background-color:#00000059;inset:0;position:fixed;z-index:var(--wp-ui-dialog-z-index,initial);&[data-ending-style],&[data-starting-style]{opacity:0}&[data-open]{opacity:1}@media not (prefers-reduced-motion){transition:opacity var(--wpds-motion-duration-md,.2s) var(--wpds-motion-easing-subtle,cubic-bezier(.15,0,.15,1))}}._8acaa98861620d4d__popup{--viewport-inset:var(--wpds-dimension-padding-2xl,24px);background-color:var(--wpds-color-bg-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-lg,8px);box-shadow:var(--wpds-elevation-lg,0 5px 15px 0 #00000014,0 15px 27px 0 #00000012,0 30px 36px 0 #0000000a,0 50px 43px 0 #00000005);box-sizing:border-box;color:var(--wpds-color-fg-content-neutral,#1e1e1e);display:flex;flex-direction:column;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);left:50%;line-height:var(--wpds-typography-line-height-md,24px);max-height:calc(100dvh - var(--viewport-inset)*2);min-width:var(--wpds-dimension-surface-width-sm,320px);overflow:hidden;position:fixed;top:50%;transform:translate(-50%,-50%);width:calc(100vw - var(--viewport-inset)*2);z-index:var(--wp-ui-dialog-z-index,initial);&[data-ending-style],&[data-starting-style]{opacity:0;transform:translate(-50%,-50%) scale(.9)}@media not (prefers-reduced-motion){transition:opacity var(--wpds-motion-duration-md,.2s) var(--wpds-motion-easing-expressive,cubic-bezier(.25,0,0,1)),transform var(--wpds-motion-duration-md,.2s) var(--wpds-motion-easing-expressive,cubic-bezier(.25,0,0,1))}@media (min-width:480px){min-width:var(--wpds-dimension-surface-width-md,400px)}&._7acfa67ebf092988__is-small{max-width:var(--wpds-dimension-surface-width-md,400px)}&._1eeeed880cb5769d__is-medium{max-width:var(--wpds-dimension-surface-width-lg,560px)}&._99f900b2267e22d0__is-large{max-width:var(--wpds-dimension-surface-width-2xl,960px)}&.b49f7ff9c06fe387__is-stretch{max-width:none}&.dcd4c2f5036cbf1a__is-full{height:100dvh}}._074affe4c56b4f2f__backdrop~* ._8acaa98861620d4d__popup{border-color:#0000}@media (forced-colors:active){._074affe4c56b4f2f__backdrop~* ._8acaa98861620d4d__popup,._8acaa98861620d4d__popup{border-color:CanvasText}}._76fb3b28fcbd45fc__header [data-wp-ui-dialog-close-icon]{margin-inline-start:auto}.d9d6da914ef0a77c__description{margin-bottom:var(--wpds-dimension-gap-lg,16px)}}'); 19026 } 19027 var style_default20 = { "backdrop": "_074affe4c56b4f2f__backdrop", "popup": "_8acaa98861620d4d__popup", "is-small": "_7acfa67ebf092988__is-small", "is-medium": "_1eeeed880cb5769d__is-medium", "is-large": "_99f900b2267e22d0__is-large", "is-stretch": "b49f7ff9c06fe387__is-stretch", "is-full": "dcd4c2f5036cbf1a__is-full", "header": "_76fb3b28fcbd45fc__header f1c50237c4787636__header", "footer": "_00eeb4f220cddae3__footer _579f95efdec92a66__footer", "title": "f636832002af749e__title _5371cc08aad82574__title", "content": "_101038da9af7162f__content _766d9011d37ce2d9__content", "description": "d9d6da914ef0a77c__description" }; 19028 var Title2 = (0, import_element54.forwardRef)( 19029 function DialogTitle3({ children, ...props }, forwardedRef) { 19030 const validationContext = useDialogValidationContext(); 19031 const internalRef = (0, import_element54.useRef)(null); 19032 const mergedRef = (0, import_compose4.useMergeRefs)([internalRef, forwardedRef]); 19033 (0, import_element54.useEffect)(() => { 19034 if (validationContext) { 19035 return validationContext.registerTitle(internalRef.current); 19036 } 19037 return void 0; 19038 }, [validationContext]); 19039 return /* @__PURE__ */ (0, import_jsx_runtime89.jsx)( 19040 Text, 19041 { 19042 ref: mergedRef, 19043 variant: "heading-xl", 19044 render: /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(index_parts_exports3.Title, { ...props }), 19045 className: style_default20.title, 19046 children 19047 } 19048 ); 19049 } 19050 ); 19051 19052 // packages/ui/build-module/dialog/trigger.mjs 19053 var import_element55 = __toESM(require_element(), 1); 19054 var import_jsx_runtime90 = __toESM(require_jsx_runtime(), 1); 19055 var Trigger4 = (0, import_element55.forwardRef)( 19056 function DialogTrigger3(props, ref) { 19057 return /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(index_parts_exports3.Trigger, { ref, ...props }); 19058 } 19059 ); 19060 19061 // packages/ui/build-module/drawer/index.mjs 19062 var drawer_exports = {}; 19063 __export(drawer_exports, { 19064 Action: () => Action2, 19065 CloseIcon: () => CloseIcon2, 19066 Content: () => Content4, 19067 Description: () => Description2, 19068 Footer: () => Footer2, 19069 Header: () => Header4, 19070 Popup: () => Popup4, 19071 Portal: () => Portal4, 19072 Root: () => Root7, 19073 Title: () => Title3, 19074 Trigger: () => Trigger5 19075 }); 19076 19077 // packages/ui/build-module/drawer/action.mjs 19078 var import_element56 = __toESM(require_element(), 1); 19079 var import_jsx_runtime91 = __toESM(require_jsx_runtime(), 1); 19080 var Action2 = (0, import_element56.forwardRef)( 19081 function DrawerAction({ render: render4, disabled: disabled2, loading, ...props }, ref) { 19082 const resolvedDisabled = disabled2 ?? loading; 19083 return /* @__PURE__ */ (0, import_jsx_runtime91.jsx)( 19084 index_parts_exports4.Close, 19085 { 19086 ref, 19087 render: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(Button4, { render: render4, loading }), 19088 disabled: resolvedDisabled, 19089 ...props 19090 } 19091 ); 19092 } 19093 ); 19094 19095 // packages/ui/build-module/drawer/close-icon.mjs 19096 var import_element57 = __toESM(require_element(), 1); 19097 var import_i18n4 = __toESM(require_i18n(), 1); 19098 var import_jsx_runtime92 = __toESM(require_jsx_runtime(), 1); 19099 var CloseIcon2 = (0, import_element57.forwardRef)( 19100 function DrawerCloseIcon({ icon, label, ...props }, ref) { 19101 return /* @__PURE__ */ (0, import_jsx_runtime92.jsx)( 19102 index_parts_exports4.Close, 19103 { 19104 ref, 19105 render: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)( 19106 IconButton, 19107 { 19108 variant: "minimal", 19109 size: "compact", 19110 tone: "neutral", 19111 ...props, 19112 icon: icon ?? close_default, 19113 label: label ?? (0, import_i18n4.__)("Close"), 19114 "data-wp-ui-drawer-close-icon": "" 19115 } 19116 ) 19117 } 19118 ); 19119 } 19120 ); 19121 19122 // packages/ui/build-module/drawer/content.mjs 19123 var import_element58 = __toESM(require_element(), 1); 19124 var import_compose5 = __toESM(require_compose(), 1); 19125 var import_jsx_runtime93 = __toESM(require_jsx_runtime(), 1); 19126 var STYLE_HASH_ATTRIBUTE22 = "data-wp-hash"; 19127 function getRuntime22() { 19128 const globalScope = globalThis; 19129 if (globalScope.__wpStyleRuntime) { 19130 return globalScope.__wpStyleRuntime; 19131 } 19132 globalScope.__wpStyleRuntime = { 19133 documents: /* @__PURE__ */ new Map(), 19134 styles: /* @__PURE__ */ new Map(), 19135 injectedStyles: /* @__PURE__ */ new WeakMap() 19136 }; 19137 if (typeof document !== "undefined") { 19138 registerDocument22(document); 19139 } 19140 return globalScope.__wpStyleRuntime; 19141 } 19142 function documentContainsStyleHash22(targetDocument, hash) { 19143 if (!targetDocument.head) { 19144 return false; 19145 } 19146 for (const style of targetDocument.head.querySelectorAll( 19147 `style[$STYLE_HASH_ATTRIBUTE22}]` 19148 )) { 19149 if (style.getAttribute(STYLE_HASH_ATTRIBUTE22) === hash) { 19150 return true; 19151 } 19152 } 19153 return false; 19154 } 19155 function injectStyle22(targetDocument, hash, css) { 19156 if (!targetDocument.head) { 19157 return; 19158 } 19159 const runtime = getRuntime22(); 19160 let injectedStyles = runtime.injectedStyles.get(targetDocument); 19161 if (!injectedStyles) { 19162 injectedStyles = /* @__PURE__ */ new Set(); 19163 runtime.injectedStyles.set(targetDocument, injectedStyles); 19164 } 19165 if (injectedStyles.has(hash)) { 19166 return; 19167 } 19168 if (documentContainsStyleHash22(targetDocument, hash)) { 19169 injectedStyles.add(hash); 19170 return; 19171 } 19172 const style = targetDocument.createElement("style"); 19173 style.setAttribute(STYLE_HASH_ATTRIBUTE22, hash); 19174 style.appendChild(targetDocument.createTextNode(css)); 19175 targetDocument.head.appendChild(style); 19176 injectedStyles.add(hash); 19177 } 19178 function registerDocument22(targetDocument) { 19179 const runtime = getRuntime22(); 19180 runtime.documents.set( 19181 targetDocument, 19182 (runtime.documents.get(targetDocument) ?? 0) + 1 19183 ); 19184 for (const [hash, css] of runtime.styles) { 19185 injectStyle22(targetDocument, hash, css); 19186 } 19187 return () => { 19188 const count = runtime.documents.get(targetDocument); 19189 if (count === void 0) { 19190 return; 19191 } 19192 if (count <= 1) { 19193 runtime.documents.delete(targetDocument); 19194 return; 19195 } 19196 runtime.documents.set(targetDocument, count - 1); 19197 }; 19198 } 19199 function registerStyle22(hash, css) { 19200 const runtime = getRuntime22(); 19201 runtime.styles.set(hash, css); 19202 for (const targetDocument of runtime.documents.keys()) { 19203 injectStyle22(targetDocument, hash, css); 19204 } 19205 } 19206 if (typeof process === "undefined" || true) { 19207 registerStyle22("2a5ab8f3a7", "@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;@layer wp-ui-utilities{._08e8a2e44959f892__outset-ring--focus,._970d04df7376df67__outset-ring--focus-within-except-active,.c5cb3ee4bddaa8e4__outset-ring--focus-within-visible,.cd83dfc2126a0846__outset-ring--focus-within,.d0541bc9dd9dc7b6__outset-ring--focus-visible,.e25b2bdd7aa21721__outset-ring--focus-except-active,.ecadb9e080e2dfa5__outset-ring--focus-parent-visible{@media not (prefers-reduced-motion){--_gcd-a-transition:outline 0.1s ease-out;transition:outline .1s ease-out}outline:0 solid #0000;outline-offset:1px}._08e8a2e44959f892__outset-ring--focus:focus,._970d04df7376df67__outset-ring--focus-within-except-active:focus-within:not(:has(:active)),.c5cb3ee4bddaa8e4__outset-ring--focus-within-visible:focus-within:has(:focus-visible),.cd83dfc2126a0846__outset-ring--focus-within:focus-within,.d0541bc9dd9dc7b6__outset-ring--focus-visible:focus-visible,.e25b2bdd7aa21721__outset-ring--focus-except-active:focus:not(:active),:focus-visible .ecadb9e080e2dfa5__outset-ring--focus-parent-visible{--_gcd-a-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--wpds-color-stroke-focus-brand,var(--wp-admin-theme-color,#3858e9));--_gcd-div-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--wpds-color-stroke-focus-brand,var(--wp-admin-theme-color,#3858e9));outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--wpds-color-stroke-focus-brand,var(--wp-admin-theme-color,#3858e9))}}"); 19208 } 19209 var focus_default5 = { "outset-ring--focus": "_08e8a2e44959f892__outset-ring--focus", "outset-ring--focus-except-active": "e25b2bdd7aa21721__outset-ring--focus-except-active", "outset-ring--focus-visible": "d0541bc9dd9dc7b6__outset-ring--focus-visible", "outset-ring--focus-within": "cd83dfc2126a0846__outset-ring--focus-within", "outset-ring--focus-within-except-active": "_970d04df7376df67__outset-ring--focus-within-except-active", "outset-ring--focus-within-visible": "c5cb3ee4bddaa8e4__outset-ring--focus-within-visible", "outset-ring--focus-parent-visible": "ecadb9e080e2dfa5__outset-ring--focus-parent-visible" }; 19210 if (typeof process === "undefined" || true) { 19211 registerStyle22("f56e33ff28", '@layer wp-ui-components{.f1c50237c4787636__header{min-height:32px;padding-block:var(--wpds-dimension-padding-2xl,24px) var(--wpds-dimension-gap-lg,16px)}._579f95efdec92a66__footer,.f1c50237c4787636__header{align-items:center;display:flex;gap:var(--wpds-dimension-gap-sm,8px);padding-inline:var(--wpds-dimension-padding-2xl,24px)}._579f95efdec92a66__footer{justify-content:flex-end;padding-block:var(--wpds-dimension-gap-lg,16px) var(--wpds-dimension-padding-2xl,24px)}._5371cc08aad82574__title{--_gcd-heading-color:var(--wpds-color-fg-content-neutral,#1e1e1e);--_gcd-heading-margin:0 auto 0 0;color:var(--wpds-color-fg-content-neutral,#1e1e1e);margin-inline-end:auto;&:dir(rtl){--_gcd-heading-margin:0 0 0 auto}}._766d9011d37ce2d9__content{flex:1 1 auto;min-block-size:0;overflow-block:auto;overflow-inline:hidden;padding:var(--wpds-dimension-padding-2xl,24px);&:focus-visible{outline-offset:calc(var(--wpds-border-width-focus, var(--wp-admin-border-width-focus, 2px))*-1)}}.f1c50237c4787636__header:has(~._766d9011d37ce2d9__content){border-block-end:1px solid #0000;padding-block-end:calc(var(--wpds-dimension-gap-lg, 16px) - 1px)}.f1c50237c4787636__header~._766d9011d37ce2d9__content{padding-block-start:0}._766d9011d37ce2d9__content~._579f95efdec92a66__footer{border-block-start:1px solid #0000;padding-block-start:calc(var(--wpds-dimension-gap-lg, 16px) - 1px)}._766d9011d37ce2d9__content:has(~._579f95efdec92a66__footer){padding-block-end:0}._766d9011d37ce2d9__content>.f1c50237c4787636__header,._766d9011d37ce2d9__content>[data-drawer-content]>.f1c50237c4787636__header{padding-inline:0}._766d9011d37ce2d9__content>.f1c50237c4787636__header:first-child,._766d9011d37ce2d9__content>[data-drawer-content]>.f1c50237c4787636__header:first-child{padding-block-start:0}._766d9011d37ce2d9__content>._579f95efdec92a66__footer,._766d9011d37ce2d9__content>[data-drawer-content]>._579f95efdec92a66__footer{padding-inline:0}._766d9011d37ce2d9__content>._579f95efdec92a66__footer:last-child,._766d9011d37ce2d9__content>[data-drawer-content]>._579f95efdec92a66__footer:last-child{padding-block-end:0}.f1c50237c4787636__header:has(~[data-wp-ui-overlay-scroll-container][data-wp-ui-overlay-scrolled-from-top]){border-block-end-color:var(--wpds-color-stroke-surface-neutral,#dbdbdb)}[data-wp-ui-overlay-scroll-container][data-wp-ui-overlay-scrolled-from-bottom]~._579f95efdec92a66__footer{border-block-start-color:var(--wpds-color-stroke-surface-neutral,#dbdbdb)}[data-wp-ui-overlay-modal] [data-wp-ui-overlay-scroll-container]{overscroll-behavior:contain}}@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;[data-wpds-theme-provider-id]:has(>._882277c289298491__popup){display:block}@layer wp-ui-components{._07e459cfa0254522__backdrop{--backdrop-opacity:0.35;background-color:#000;inset:0;min-height:100dvh;opacity:calc(var(--backdrop-opacity)*(1 - var(--drawer-swipe-progress)));position:fixed;z-index:var(--wp-ui-drawer-z-index,initial);@supports (-webkit-touch-callout:none){position:absolute}&[data-ending-style],&[data-starting-style]{opacity:0}@media not (prefers-reduced-motion){transition:opacity .45s cubic-bezier(.32,.72,0,1);&[data-ending-style]{pointer-events:none;transition-duration:calc(var(--drawer-swipe-strength)*.4s)}&[data-swiping]{transition-duration:0ms}}}.f1cf22f966cf516e__viewport{inset:0;pointer-events:none;position:fixed;z-index:var(--wp-ui-drawer-z-index,initial)}._882277c289298491__popup{--viewport-inset:var(--wpds-dimension-padding-2xl,24px);background-color:var(--wpds-color-bg-surface-neutral-strong,#fff);border:var(--wpds-border-width-xs,1px) solid var(--wpds-color-stroke-surface-neutral,#dbdbdb);box-shadow:var(--wpds-elevation-lg,0 5px 15px 0 #00000014,0 15px 27px 0 #00000012,0 30px 36px 0 #0000000a,0 50px 43px 0 #00000005);box-sizing:border-box;color:var(--wpds-color-fg-content-neutral,#1e1e1e);display:flex;flex-direction:column;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(--wpds-typography-line-height-md,24px);outline:0;overflow:hidden;pointer-events:auto;position:fixed;touch-action:auto;z-index:var(--wp-ui-drawer-z-index,initial);&[data-ending-style],&[data-open],&[data-swiping]{will-change:transform}&[data-ending-style],&[data-starting-style]{box-shadow:none}@media not (prefers-reduced-motion){transition:transform .45s cubic-bezier(.32,.72,0,1),box-shadow .45s cubic-bezier(.32,.72,0,1);&[data-ending-style]{transition-duration:calc(var(--drawer-swipe-strength)*.4s)}&[data-swiping]{transition-duration:0ms}}&.e758b2a0572e1951__is-small{--popup-size:var(--wpds-dimension-surface-width-sm,320px)}&._21ddafd99d004b84__is-medium{--popup-size:var(--wpds-dimension-surface-width-md,400px)}&._78636e3fdcb75c3b__is-large{--popup-size:var(--wpds-dimension-surface-width-lg,560px)}&.b2960a80aa46d1f9__is-stretch{--popup-size:var(--stretch-size)}&._949cc180111d609b__is-auto{--popup-size:auto}&[data-swiping]{user-select:none}&[data-swipe-direction=left]{--stretch-size:calc(100vw - var(--viewport-inset));border-end-end-radius:var(--wpds-border-radius-lg,8px);border-start-end-radius:var(--wpds-border-radius-lg,8px);bottom:0;left:0;max-width:calc(100vw - var(--viewport-inset));top:0;transform:translateX(var(--drawer-swipe-movement-x));width:var(--popup-size);&[data-ending-style],&[data-starting-style]{transform:translateX(-100%)}}&[data-swipe-direction=right]{--stretch-size:calc(100vw - var(--viewport-inset));border-end-start-radius:var(--wpds-border-radius-lg,8px);border-start-start-radius:var(--wpds-border-radius-lg,8px);bottom:0;max-width:calc(100vw - var(--viewport-inset));right:0;top:0;transform:translateX(var(--drawer-swipe-movement-x));width:var(--popup-size);&[data-ending-style],&[data-starting-style]{transform:translateX(100%)}}&[data-swipe-direction=down]{--stretch-size:calc(100dvh - var(--viewport-inset));border-start-end-radius:var(--wpds-border-radius-lg,8px);border-start-start-radius:var(--wpds-border-radius-lg,8px);bottom:0;height:var(--popup-size);left:0;max-height:calc(100dvh - var(--viewport-inset));right:0;transform:translateY(var(--drawer-swipe-movement-y));&[data-ending-style],&[data-starting-style]{transform:translateY(100%)}}&[data-swipe-direction=up]{--stretch-size:calc(100dvh - var(--viewport-inset));border-end-end-radius:var(--wpds-border-radius-lg,8px);border-end-start-radius:var(--wpds-border-radius-lg,8px);height:var(--popup-size);left:0;max-height:calc(100dvh - var(--viewport-inset));right:0;top:0;transform:translateY(var(--drawer-swipe-movement-y));&[data-ending-style],&[data-starting-style]{transform:translateY(-100%)}}}._07e459cfa0254522__backdrop~* ._882277c289298491__popup{border-color:#0000}@media (forced-colors:active){._07e459cfa0254522__backdrop~* ._882277c289298491__popup,._882277c289298491__popup{border-color:CanvasText}}.e84af91dc76cf84f__header [data-wp-ui-drawer-close-icon]{margin-inline-start:auto}._882277c289298491__popup[data-swipe-direction=left] .c7c17b6b2378b2ee__content{padding-left:max(var(--wpds-dimension-padding-2xl,24px),env(safe-area-inset-left))}._882277c289298491__popup[data-swipe-direction=right] .c7c17b6b2378b2ee__content{padding-right:max(var(--wpds-dimension-padding-2xl,24px),env(safe-area-inset-right))}._882277c289298491__popup[data-swipe-direction=up]>.e84af91dc76cf84f__header{padding-top:max(var(--wpds-dimension-padding-2xl,24px),env(safe-area-inset-top))}._882277c289298491__popup[data-swipe-direction=down]>._1136b31b67a81245__footer{padding-bottom:max(var(--wpds-dimension-padding-2xl,24px),env(safe-area-inset-bottom))}._882277c289298491__popup[data-swipe-direction=up]>.c7c17b6b2378b2ee__content:first-child{padding-top:max(var(--wpds-dimension-padding-2xl,24px),env(safe-area-inset-top))}._882277c289298491__popup[data-swipe-direction=down]>.c7c17b6b2378b2ee__content:last-child{padding-bottom:max(var(--wpds-dimension-padding-2xl,24px),env(safe-area-inset-bottom))}}'); 19212 } 19213 var style_default21 = { "popup": "_882277c289298491__popup", "backdrop": "_07e459cfa0254522__backdrop", "viewport": "f1cf22f966cf516e__viewport", "is-small": "e758b2a0572e1951__is-small", "is-medium": "_21ddafd99d004b84__is-medium", "is-large": "_78636e3fdcb75c3b__is-large", "is-stretch": "b2960a80aa46d1f9__is-stretch", "is-auto": "_949cc180111d609b__is-auto", "header": "e84af91dc76cf84f__header f1c50237c4787636__header", "footer": "_1136b31b67a81245__footer _579f95efdec92a66__footer", "title": "_0dab095165fca096__title _5371cc08aad82574__title", "content": "c7c17b6b2378b2ee__content _766d9011d37ce2d9__content" }; 19214 var Content4 = (0, import_element58.forwardRef)( 19215 function DrawerContent3({ className, render: render4, children, onScroll, ...props }, ref) { 19216 const { ref: scrollStateRef, onScroll: scrollStateOnScroll } = useOverlayScrollStateAttributes(onScroll); 19217 const mergedRef = (0, import_compose5.useMergeRefs)([ref, scrollStateRef]); 19218 const element = useRender({ 19219 defaultTagName: "div", 19220 render: render4, 19221 ref: mergedRef, 19222 props: mergeProps(props, { 19223 className: clsx_default( 19224 style_default21.content, 19225 focus_default5["outset-ring--focus-visible"], 19226 className 19227 ), 19228 onScroll: scrollStateOnScroll, 19229 // `_Drawer.Content` carries the `[data-drawer-content]` 19230 // marker that Base UI's swipe-dismiss logic uses to skip 19231 // mouse-drag swipes started inside the body, preserving 19232 // text selection. It must sit *inside* the scroll 19233 // container so the popup's edge padding gutter falls 19234 // outside the marker and stays mouse-draggable. 19235 children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(index_parts_exports4.Content, { children }) 19236 }) 19237 }); 19238 return element; 19239 } 19240 ); 19241 19242 // packages/ui/build-module/drawer/description.mjs 19243 var import_element59 = __toESM(require_element(), 1); 19244 var import_jsx_runtime94 = __toESM(require_jsx_runtime(), 1); 19245 var Description2 = (0, import_element59.forwardRef)( 19246 function DrawerDescription2({ children, ...props }, ref) { 19247 return /* @__PURE__ */ (0, import_jsx_runtime94.jsx)( 19248 Text, 19249 { 19250 ref, 19251 variant: "body-md", 19252 render: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(index_parts_exports4.Description, { ...props }), 19253 children 19254 } 19255 ); 19256 } 19257 ); 19258 19259 // packages/ui/build-module/drawer/footer.mjs 19260 var import_element60 = __toESM(require_element(), 1); 19261 var STYLE_HASH_ATTRIBUTE23 = "data-wp-hash"; 19262 function getRuntime23() { 19263 const globalScope = globalThis; 19264 if (globalScope.__wpStyleRuntime) { 19265 return globalScope.__wpStyleRuntime; 19266 } 19267 globalScope.__wpStyleRuntime = { 19268 documents: /* @__PURE__ */ new Map(), 19269 styles: /* @__PURE__ */ new Map(), 19270 injectedStyles: /* @__PURE__ */ new WeakMap() 19271 }; 19272 if (typeof document !== "undefined") { 19273 registerDocument23(document); 19274 } 19275 return globalScope.__wpStyleRuntime; 19276 } 19277 function documentContainsStyleHash23(targetDocument, hash) { 19278 if (!targetDocument.head) { 19279 return false; 19280 } 19281 for (const style of targetDocument.head.querySelectorAll( 19282 `style[$STYLE_HASH_ATTRIBUTE23}]` 19283 )) { 19284 if (style.getAttribute(STYLE_HASH_ATTRIBUTE23) === hash) { 19285 return true; 19286 } 19287 } 19288 return false; 19289 } 19290 function injectStyle23(targetDocument, hash, css) { 19291 if (!targetDocument.head) { 19292 return; 19293 } 19294 const runtime = getRuntime23(); 19295 let injectedStyles = runtime.injectedStyles.get(targetDocument); 19296 if (!injectedStyles) { 19297 injectedStyles = /* @__PURE__ */ new Set(); 19298 runtime.injectedStyles.set(targetDocument, injectedStyles); 19299 } 19300 if (injectedStyles.has(hash)) { 19301 return; 19302 } 19303 if (documentContainsStyleHash23(targetDocument, hash)) { 19304 injectedStyles.add(hash); 19305 return; 19306 } 19307 const style = targetDocument.createElement("style"); 19308 style.setAttribute(STYLE_HASH_ATTRIBUTE23, hash); 19309 style.appendChild(targetDocument.createTextNode(css)); 19310 targetDocument.head.appendChild(style); 19311 injectedStyles.add(hash); 19312 } 19313 function registerDocument23(targetDocument) { 19314 const runtime = getRuntime23(); 19315 runtime.documents.set( 19316 targetDocument, 19317 (runtime.documents.get(targetDocument) ?? 0) + 1 19318 ); 19319 for (const [hash, css] of runtime.styles) { 19320 injectStyle23(targetDocument, hash, css); 19321 } 19322 return () => { 19323 const count = runtime.documents.get(targetDocument); 19324 if (count === void 0) { 19325 return; 19326 } 19327 if (count <= 1) { 19328 runtime.documents.delete(targetDocument); 19329 return; 19330 } 19331 runtime.documents.set(targetDocument, count - 1); 19332 }; 19333 } 19334 function registerStyle23(hash, css) { 19335 const runtime = getRuntime23(); 19336 runtime.styles.set(hash, css); 19337 for (const targetDocument of runtime.documents.keys()) { 19338 injectStyle23(targetDocument, hash, css); 19339 } 19340 } 19341 if (typeof process === "undefined" || true) { 19342 registerStyle23("f56e33ff28", '@layer wp-ui-components{.f1c50237c4787636__header{min-height:32px;padding-block:var(--wpds-dimension-padding-2xl,24px) var(--wpds-dimension-gap-lg,16px)}._579f95efdec92a66__footer,.f1c50237c4787636__header{align-items:center;display:flex;gap:var(--wpds-dimension-gap-sm,8px);padding-inline:var(--wpds-dimension-padding-2xl,24px)}._579f95efdec92a66__footer{justify-content:flex-end;padding-block:var(--wpds-dimension-gap-lg,16px) var(--wpds-dimension-padding-2xl,24px)}._5371cc08aad82574__title{--_gcd-heading-color:var(--wpds-color-fg-content-neutral,#1e1e1e);--_gcd-heading-margin:0 auto 0 0;color:var(--wpds-color-fg-content-neutral,#1e1e1e);margin-inline-end:auto;&:dir(rtl){--_gcd-heading-margin:0 0 0 auto}}._766d9011d37ce2d9__content{flex:1 1 auto;min-block-size:0;overflow-block:auto;overflow-inline:hidden;padding:var(--wpds-dimension-padding-2xl,24px);&:focus-visible{outline-offset:calc(var(--wpds-border-width-focus, var(--wp-admin-border-width-focus, 2px))*-1)}}.f1c50237c4787636__header:has(~._766d9011d37ce2d9__content){border-block-end:1px solid #0000;padding-block-end:calc(var(--wpds-dimension-gap-lg, 16px) - 1px)}.f1c50237c4787636__header~._766d9011d37ce2d9__content{padding-block-start:0}._766d9011d37ce2d9__content~._579f95efdec92a66__footer{border-block-start:1px solid #0000;padding-block-start:calc(var(--wpds-dimension-gap-lg, 16px) - 1px)}._766d9011d37ce2d9__content:has(~._579f95efdec92a66__footer){padding-block-end:0}._766d9011d37ce2d9__content>.f1c50237c4787636__header,._766d9011d37ce2d9__content>[data-drawer-content]>.f1c50237c4787636__header{padding-inline:0}._766d9011d37ce2d9__content>.f1c50237c4787636__header:first-child,._766d9011d37ce2d9__content>[data-drawer-content]>.f1c50237c4787636__header:first-child{padding-block-start:0}._766d9011d37ce2d9__content>._579f95efdec92a66__footer,._766d9011d37ce2d9__content>[data-drawer-content]>._579f95efdec92a66__footer{padding-inline:0}._766d9011d37ce2d9__content>._579f95efdec92a66__footer:last-child,._766d9011d37ce2d9__content>[data-drawer-content]>._579f95efdec92a66__footer:last-child{padding-block-end:0}.f1c50237c4787636__header:has(~[data-wp-ui-overlay-scroll-container][data-wp-ui-overlay-scrolled-from-top]){border-block-end-color:var(--wpds-color-stroke-surface-neutral,#dbdbdb)}[data-wp-ui-overlay-scroll-container][data-wp-ui-overlay-scrolled-from-bottom]~._579f95efdec92a66__footer{border-block-start-color:var(--wpds-color-stroke-surface-neutral,#dbdbdb)}[data-wp-ui-overlay-modal] [data-wp-ui-overlay-scroll-container]{overscroll-behavior:contain}}@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;[data-wpds-theme-provider-id]:has(>._882277c289298491__popup){display:block}@layer wp-ui-components{._07e459cfa0254522__backdrop{--backdrop-opacity:0.35;background-color:#000;inset:0;min-height:100dvh;opacity:calc(var(--backdrop-opacity)*(1 - var(--drawer-swipe-progress)));position:fixed;z-index:var(--wp-ui-drawer-z-index,initial);@supports (-webkit-touch-callout:none){position:absolute}&[data-ending-style],&[data-starting-style]{opacity:0}@media not (prefers-reduced-motion){transition:opacity .45s cubic-bezier(.32,.72,0,1);&[data-ending-style]{pointer-events:none;transition-duration:calc(var(--drawer-swipe-strength)*.4s)}&[data-swiping]{transition-duration:0ms}}}.f1cf22f966cf516e__viewport{inset:0;pointer-events:none;position:fixed;z-index:var(--wp-ui-drawer-z-index,initial)}._882277c289298491__popup{--viewport-inset:var(--wpds-dimension-padding-2xl,24px);background-color:var(--wpds-color-bg-surface-neutral-strong,#fff);border:var(--wpds-border-width-xs,1px) solid var(--wpds-color-stroke-surface-neutral,#dbdbdb);box-shadow:var(--wpds-elevation-lg,0 5px 15px 0 #00000014,0 15px 27px 0 #00000012,0 30px 36px 0 #0000000a,0 50px 43px 0 #00000005);box-sizing:border-box;color:var(--wpds-color-fg-content-neutral,#1e1e1e);display:flex;flex-direction:column;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(--wpds-typography-line-height-md,24px);outline:0;overflow:hidden;pointer-events:auto;position:fixed;touch-action:auto;z-index:var(--wp-ui-drawer-z-index,initial);&[data-ending-style],&[data-open],&[data-swiping]{will-change:transform}&[data-ending-style],&[data-starting-style]{box-shadow:none}@media not (prefers-reduced-motion){transition:transform .45s cubic-bezier(.32,.72,0,1),box-shadow .45s cubic-bezier(.32,.72,0,1);&[data-ending-style]{transition-duration:calc(var(--drawer-swipe-strength)*.4s)}&[data-swiping]{transition-duration:0ms}}&.e758b2a0572e1951__is-small{--popup-size:var(--wpds-dimension-surface-width-sm,320px)}&._21ddafd99d004b84__is-medium{--popup-size:var(--wpds-dimension-surface-width-md,400px)}&._78636e3fdcb75c3b__is-large{--popup-size:var(--wpds-dimension-surface-width-lg,560px)}&.b2960a80aa46d1f9__is-stretch{--popup-size:var(--stretch-size)}&._949cc180111d609b__is-auto{--popup-size:auto}&[data-swiping]{user-select:none}&[data-swipe-direction=left]{--stretch-size:calc(100vw - var(--viewport-inset));border-end-end-radius:var(--wpds-border-radius-lg,8px);border-start-end-radius:var(--wpds-border-radius-lg,8px);bottom:0;left:0;max-width:calc(100vw - var(--viewport-inset));top:0;transform:translateX(var(--drawer-swipe-movement-x));width:var(--popup-size);&[data-ending-style],&[data-starting-style]{transform:translateX(-100%)}}&[data-swipe-direction=right]{--stretch-size:calc(100vw - var(--viewport-inset));border-end-start-radius:var(--wpds-border-radius-lg,8px);border-start-start-radius:var(--wpds-border-radius-lg,8px);bottom:0;max-width:calc(100vw - var(--viewport-inset));right:0;top:0;transform:translateX(var(--drawer-swipe-movement-x));width:var(--popup-size);&[data-ending-style],&[data-starting-style]{transform:translateX(100%)}}&[data-swipe-direction=down]{--stretch-size:calc(100dvh - var(--viewport-inset));border-start-end-radius:var(--wpds-border-radius-lg,8px);border-start-start-radius:var(--wpds-border-radius-lg,8px);bottom:0;height:var(--popup-size);left:0;max-height:calc(100dvh - var(--viewport-inset));right:0;transform:translateY(var(--drawer-swipe-movement-y));&[data-ending-style],&[data-starting-style]{transform:translateY(100%)}}&[data-swipe-direction=up]{--stretch-size:calc(100dvh - var(--viewport-inset));border-end-end-radius:var(--wpds-border-radius-lg,8px);border-end-start-radius:var(--wpds-border-radius-lg,8px);height:var(--popup-size);left:0;max-height:calc(100dvh - var(--viewport-inset));right:0;top:0;transform:translateY(var(--drawer-swipe-movement-y));&[data-ending-style],&[data-starting-style]{transform:translateY(-100%)}}}._07e459cfa0254522__backdrop~* ._882277c289298491__popup{border-color:#0000}@media (forced-colors:active){._07e459cfa0254522__backdrop~* ._882277c289298491__popup,._882277c289298491__popup{border-color:CanvasText}}.e84af91dc76cf84f__header [data-wp-ui-drawer-close-icon]{margin-inline-start:auto}._882277c289298491__popup[data-swipe-direction=left] .c7c17b6b2378b2ee__content{padding-left:max(var(--wpds-dimension-padding-2xl,24px),env(safe-area-inset-left))}._882277c289298491__popup[data-swipe-direction=right] .c7c17b6b2378b2ee__content{padding-right:max(var(--wpds-dimension-padding-2xl,24px),env(safe-area-inset-right))}._882277c289298491__popup[data-swipe-direction=up]>.e84af91dc76cf84f__header{padding-top:max(var(--wpds-dimension-padding-2xl,24px),env(safe-area-inset-top))}._882277c289298491__popup[data-swipe-direction=down]>._1136b31b67a81245__footer{padding-bottom:max(var(--wpds-dimension-padding-2xl,24px),env(safe-area-inset-bottom))}._882277c289298491__popup[data-swipe-direction=up]>.c7c17b6b2378b2ee__content:first-child{padding-top:max(var(--wpds-dimension-padding-2xl,24px),env(safe-area-inset-top))}._882277c289298491__popup[data-swipe-direction=down]>.c7c17b6b2378b2ee__content:last-child{padding-bottom:max(var(--wpds-dimension-padding-2xl,24px),env(safe-area-inset-bottom))}}'); 19343 } 19344 var style_default23 = { "popup": "_882277c289298491__popup", "backdrop": "_07e459cfa0254522__backdrop", "viewport": "f1cf22f966cf516e__viewport", "is-small": "e758b2a0572e1951__is-small", "is-medium": "_21ddafd99d004b84__is-medium", "is-large": "_78636e3fdcb75c3b__is-large", "is-stretch": "b2960a80aa46d1f9__is-stretch", "is-auto": "_949cc180111d609b__is-auto", "header": "e84af91dc76cf84f__header f1c50237c4787636__header", "footer": "_1136b31b67a81245__footer _579f95efdec92a66__footer", "title": "_0dab095165fca096__title _5371cc08aad82574__title", "content": "c7c17b6b2378b2ee__content _766d9011d37ce2d9__content" }; 19345 var Footer2 = (0, import_element60.forwardRef)(function DrawerFooter({ className, render: render4, ...props }, ref) { 19346 const element = useRender({ 19347 defaultTagName: "footer", 19348 render: render4, 19349 ref, 19350 props: mergeProps(props, { 19351 className: clsx_default(style_default23.footer, className) 19352 }) 19353 }); 19354 return element; 19355 }); 19356 19357 // packages/ui/build-module/drawer/header.mjs 19358 var import_element61 = __toESM(require_element(), 1); 19359 var STYLE_HASH_ATTRIBUTE24 = "data-wp-hash"; 19360 function getRuntime24() { 19361 const globalScope = globalThis; 19362 if (globalScope.__wpStyleRuntime) { 19363 return globalScope.__wpStyleRuntime; 19364 } 19365 globalScope.__wpStyleRuntime = { 19366 documents: /* @__PURE__ */ new Map(), 19367 styles: /* @__PURE__ */ new Map(), 19368 injectedStyles: /* @__PURE__ */ new WeakMap() 19369 }; 19370 if (typeof document !== "undefined") { 19371 registerDocument24(document); 19372 } 19373 return globalScope.__wpStyleRuntime; 19374 } 19375 function documentContainsStyleHash24(targetDocument, hash) { 19376 if (!targetDocument.head) { 19377 return false; 19378 } 19379 for (const style of targetDocument.head.querySelectorAll( 19380 `style[$STYLE_HASH_ATTRIBUTE24}]` 19381 )) { 19382 if (style.getAttribute(STYLE_HASH_ATTRIBUTE24) === hash) { 19383 return true; 19384 } 19385 } 19386 return false; 19387 } 19388 function injectStyle24(targetDocument, hash, css) { 19389 if (!targetDocument.head) { 19390 return; 19391 } 19392 const runtime = getRuntime24(); 19393 let injectedStyles = runtime.injectedStyles.get(targetDocument); 19394 if (!injectedStyles) { 19395 injectedStyles = /* @__PURE__ */ new Set(); 19396 runtime.injectedStyles.set(targetDocument, injectedStyles); 19397 } 19398 if (injectedStyles.has(hash)) { 19399 return; 19400 } 19401 if (documentContainsStyleHash24(targetDocument, hash)) { 19402 injectedStyles.add(hash); 19403 return; 19404 } 19405 const style = targetDocument.createElement("style"); 19406 style.setAttribute(STYLE_HASH_ATTRIBUTE24, hash); 19407 style.appendChild(targetDocument.createTextNode(css)); 19408 targetDocument.head.appendChild(style); 19409 injectedStyles.add(hash); 19410 } 19411 function registerDocument24(targetDocument) { 19412 const runtime = getRuntime24(); 19413 runtime.documents.set( 19414 targetDocument, 19415 (runtime.documents.get(targetDocument) ?? 0) + 1 19416 ); 19417 for (const [hash, css] of runtime.styles) { 19418 injectStyle24(targetDocument, hash, css); 19419 } 19420 return () => { 19421 const count = runtime.documents.get(targetDocument); 19422 if (count === void 0) { 19423 return; 19424 } 19425 if (count <= 1) { 19426 runtime.documents.delete(targetDocument); 19427 return; 19428 } 19429 runtime.documents.set(targetDocument, count - 1); 19430 }; 19431 } 19432 function registerStyle24(hash, css) { 19433 const runtime = getRuntime24(); 19434 runtime.styles.set(hash, css); 19435 for (const targetDocument of runtime.documents.keys()) { 19436 injectStyle24(targetDocument, hash, css); 19437 } 19438 } 19439 if (typeof process === "undefined" || true) { 19440 registerStyle24("f56e33ff28", '@layer wp-ui-components{.f1c50237c4787636__header{min-height:32px;padding-block:var(--wpds-dimension-padding-2xl,24px) var(--wpds-dimension-gap-lg,16px)}._579f95efdec92a66__footer,.f1c50237c4787636__header{align-items:center;display:flex;gap:var(--wpds-dimension-gap-sm,8px);padding-inline:var(--wpds-dimension-padding-2xl,24px)}._579f95efdec92a66__footer{justify-content:flex-end;padding-block:var(--wpds-dimension-gap-lg,16px) var(--wpds-dimension-padding-2xl,24px)}._5371cc08aad82574__title{--_gcd-heading-color:var(--wpds-color-fg-content-neutral,#1e1e1e);--_gcd-heading-margin:0 auto 0 0;color:var(--wpds-color-fg-content-neutral,#1e1e1e);margin-inline-end:auto;&:dir(rtl){--_gcd-heading-margin:0 0 0 auto}}._766d9011d37ce2d9__content{flex:1 1 auto;min-block-size:0;overflow-block:auto;overflow-inline:hidden;padding:var(--wpds-dimension-padding-2xl,24px);&:focus-visible{outline-offset:calc(var(--wpds-border-width-focus, var(--wp-admin-border-width-focus, 2px))*-1)}}.f1c50237c4787636__header:has(~._766d9011d37ce2d9__content){border-block-end:1px solid #0000;padding-block-end:calc(var(--wpds-dimension-gap-lg, 16px) - 1px)}.f1c50237c4787636__header~._766d9011d37ce2d9__content{padding-block-start:0}._766d9011d37ce2d9__content~._579f95efdec92a66__footer{border-block-start:1px solid #0000;padding-block-start:calc(var(--wpds-dimension-gap-lg, 16px) - 1px)}._766d9011d37ce2d9__content:has(~._579f95efdec92a66__footer){padding-block-end:0}._766d9011d37ce2d9__content>.f1c50237c4787636__header,._766d9011d37ce2d9__content>[data-drawer-content]>.f1c50237c4787636__header{padding-inline:0}._766d9011d37ce2d9__content>.f1c50237c4787636__header:first-child,._766d9011d37ce2d9__content>[data-drawer-content]>.f1c50237c4787636__header:first-child{padding-block-start:0}._766d9011d37ce2d9__content>._579f95efdec92a66__footer,._766d9011d37ce2d9__content>[data-drawer-content]>._579f95efdec92a66__footer{padding-inline:0}._766d9011d37ce2d9__content>._579f95efdec92a66__footer:last-child,._766d9011d37ce2d9__content>[data-drawer-content]>._579f95efdec92a66__footer:last-child{padding-block-end:0}.f1c50237c4787636__header:has(~[data-wp-ui-overlay-scroll-container][data-wp-ui-overlay-scrolled-from-top]){border-block-end-color:var(--wpds-color-stroke-surface-neutral,#dbdbdb)}[data-wp-ui-overlay-scroll-container][data-wp-ui-overlay-scrolled-from-bottom]~._579f95efdec92a66__footer{border-block-start-color:var(--wpds-color-stroke-surface-neutral,#dbdbdb)}[data-wp-ui-overlay-modal] [data-wp-ui-overlay-scroll-container]{overscroll-behavior:contain}}@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;[data-wpds-theme-provider-id]:has(>._882277c289298491__popup){display:block}@layer wp-ui-components{._07e459cfa0254522__backdrop{--backdrop-opacity:0.35;background-color:#000;inset:0;min-height:100dvh;opacity:calc(var(--backdrop-opacity)*(1 - var(--drawer-swipe-progress)));position:fixed;z-index:var(--wp-ui-drawer-z-index,initial);@supports (-webkit-touch-callout:none){position:absolute}&[data-ending-style],&[data-starting-style]{opacity:0}@media not (prefers-reduced-motion){transition:opacity .45s cubic-bezier(.32,.72,0,1);&[data-ending-style]{pointer-events:none;transition-duration:calc(var(--drawer-swipe-strength)*.4s)}&[data-swiping]{transition-duration:0ms}}}.f1cf22f966cf516e__viewport{inset:0;pointer-events:none;position:fixed;z-index:var(--wp-ui-drawer-z-index,initial)}._882277c289298491__popup{--viewport-inset:var(--wpds-dimension-padding-2xl,24px);background-color:var(--wpds-color-bg-surface-neutral-strong,#fff);border:var(--wpds-border-width-xs,1px) solid var(--wpds-color-stroke-surface-neutral,#dbdbdb);box-shadow:var(--wpds-elevation-lg,0 5px 15px 0 #00000014,0 15px 27px 0 #00000012,0 30px 36px 0 #0000000a,0 50px 43px 0 #00000005);box-sizing:border-box;color:var(--wpds-color-fg-content-neutral,#1e1e1e);display:flex;flex-direction:column;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(--wpds-typography-line-height-md,24px);outline:0;overflow:hidden;pointer-events:auto;position:fixed;touch-action:auto;z-index:var(--wp-ui-drawer-z-index,initial);&[data-ending-style],&[data-open],&[data-swiping]{will-change:transform}&[data-ending-style],&[data-starting-style]{box-shadow:none}@media not (prefers-reduced-motion){transition:transform .45s cubic-bezier(.32,.72,0,1),box-shadow .45s cubic-bezier(.32,.72,0,1);&[data-ending-style]{transition-duration:calc(var(--drawer-swipe-strength)*.4s)}&[data-swiping]{transition-duration:0ms}}&.e758b2a0572e1951__is-small{--popup-size:var(--wpds-dimension-surface-width-sm,320px)}&._21ddafd99d004b84__is-medium{--popup-size:var(--wpds-dimension-surface-width-md,400px)}&._78636e3fdcb75c3b__is-large{--popup-size:var(--wpds-dimension-surface-width-lg,560px)}&.b2960a80aa46d1f9__is-stretch{--popup-size:var(--stretch-size)}&._949cc180111d609b__is-auto{--popup-size:auto}&[data-swiping]{user-select:none}&[data-swipe-direction=left]{--stretch-size:calc(100vw - var(--viewport-inset));border-end-end-radius:var(--wpds-border-radius-lg,8px);border-start-end-radius:var(--wpds-border-radius-lg,8px);bottom:0;left:0;max-width:calc(100vw - var(--viewport-inset));top:0;transform:translateX(var(--drawer-swipe-movement-x));width:var(--popup-size);&[data-ending-style],&[data-starting-style]{transform:translateX(-100%)}}&[data-swipe-direction=right]{--stretch-size:calc(100vw - var(--viewport-inset));border-end-start-radius:var(--wpds-border-radius-lg,8px);border-start-start-radius:var(--wpds-border-radius-lg,8px);bottom:0;max-width:calc(100vw - var(--viewport-inset));right:0;top:0;transform:translateX(var(--drawer-swipe-movement-x));width:var(--popup-size);&[data-ending-style],&[data-starting-style]{transform:translateX(100%)}}&[data-swipe-direction=down]{--stretch-size:calc(100dvh - var(--viewport-inset));border-start-end-radius:var(--wpds-border-radius-lg,8px);border-start-start-radius:var(--wpds-border-radius-lg,8px);bottom:0;height:var(--popup-size);left:0;max-height:calc(100dvh - var(--viewport-inset));right:0;transform:translateY(var(--drawer-swipe-movement-y));&[data-ending-style],&[data-starting-style]{transform:translateY(100%)}}&[data-swipe-direction=up]{--stretch-size:calc(100dvh - var(--viewport-inset));border-end-end-radius:var(--wpds-border-radius-lg,8px);border-end-start-radius:var(--wpds-border-radius-lg,8px);height:var(--popup-size);left:0;max-height:calc(100dvh - var(--viewport-inset));right:0;top:0;transform:translateY(var(--drawer-swipe-movement-y));&[data-ending-style],&[data-starting-style]{transform:translateY(-100%)}}}._07e459cfa0254522__backdrop~* ._882277c289298491__popup{border-color:#0000}@media (forced-colors:active){._07e459cfa0254522__backdrop~* ._882277c289298491__popup,._882277c289298491__popup{border-color:CanvasText}}.e84af91dc76cf84f__header [data-wp-ui-drawer-close-icon]{margin-inline-start:auto}._882277c289298491__popup[data-swipe-direction=left] .c7c17b6b2378b2ee__content{padding-left:max(var(--wpds-dimension-padding-2xl,24px),env(safe-area-inset-left))}._882277c289298491__popup[data-swipe-direction=right] .c7c17b6b2378b2ee__content{padding-right:max(var(--wpds-dimension-padding-2xl,24px),env(safe-area-inset-right))}._882277c289298491__popup[data-swipe-direction=up]>.e84af91dc76cf84f__header{padding-top:max(var(--wpds-dimension-padding-2xl,24px),env(safe-area-inset-top))}._882277c289298491__popup[data-swipe-direction=down]>._1136b31b67a81245__footer{padding-bottom:max(var(--wpds-dimension-padding-2xl,24px),env(safe-area-inset-bottom))}._882277c289298491__popup[data-swipe-direction=up]>.c7c17b6b2378b2ee__content:first-child{padding-top:max(var(--wpds-dimension-padding-2xl,24px),env(safe-area-inset-top))}._882277c289298491__popup[data-swipe-direction=down]>.c7c17b6b2378b2ee__content:last-child{padding-bottom:max(var(--wpds-dimension-padding-2xl,24px),env(safe-area-inset-bottom))}}'); 19441 } 19442 var style_default24 = { "popup": "_882277c289298491__popup", "backdrop": "_07e459cfa0254522__backdrop", "viewport": "f1cf22f966cf516e__viewport", "is-small": "e758b2a0572e1951__is-small", "is-medium": "_21ddafd99d004b84__is-medium", "is-large": "_78636e3fdcb75c3b__is-large", "is-stretch": "b2960a80aa46d1f9__is-stretch", "is-auto": "_949cc180111d609b__is-auto", "header": "e84af91dc76cf84f__header f1c50237c4787636__header", "footer": "_1136b31b67a81245__footer _579f95efdec92a66__footer", "title": "_0dab095165fca096__title _5371cc08aad82574__title", "content": "c7c17b6b2378b2ee__content _766d9011d37ce2d9__content" }; 19443 var Header4 = (0, import_element61.forwardRef)(function DrawerHeader({ className, render: render4, ...props }, ref) { 19444 const element = useRender({ 19445 defaultTagName: "header", 19446 render: render4, 19447 ref, 19448 props: mergeProps(props, { 19449 className: clsx_default(style_default24.header, className) 19450 }) 19451 }); 19452 return element; 19453 }); 19454 19455 // packages/ui/build-module/drawer/popup.mjs 19456 var import_element63 = __toESM(require_element(), 1); 19457 var import_compose6 = __toESM(require_compose(), 1); 19458 var import_theme4 = __toESM(require_theme(), 1); 19459 19460 // packages/ui/build-module/drawer/context.mjs 19461 var drawerModal = createOverlayModalContext(true); 19462 var DrawerModalProvider = drawerModal.Provider; 19463 var useDrawerModal = drawerModal.useModal; 19464 var drawerTitleValidation = createOverlayTitleValidation("Drawer"); 19465 var useDrawerValidationContext = drawerTitleValidation.useValidationContext; 19466 var DrawerValidationProvider = drawerTitleValidation.ValidationProvider; 19467 19468 // packages/ui/build-module/drawer/portal.mjs 19469 var import_element62 = __toESM(require_element(), 1); 19470 var import_jsx_runtime95 = __toESM(require_jsx_runtime(), 1); 19471 var Portal4 = (0, import_element62.forwardRef)( 19472 function DrawerPortal2(props, ref) { 19473 return /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(index_parts_exports4.Portal, { ref, ...props }); 19474 } 19475 ); 19476 19477 // packages/ui/build-module/drawer/popup.mjs 19478 var import_jsx_runtime96 = __toESM(require_jsx_runtime(), 1); 19479 var STYLE_HASH_ATTRIBUTE25 = "data-wp-hash"; 19480 function getRuntime25() { 19481 const globalScope = globalThis; 19482 if (globalScope.__wpStyleRuntime) { 19483 return globalScope.__wpStyleRuntime; 19484 } 19485 globalScope.__wpStyleRuntime = { 19486 documents: /* @__PURE__ */ new Map(), 19487 styles: /* @__PURE__ */ new Map(), 19488 injectedStyles: /* @__PURE__ */ new WeakMap() 19489 }; 19490 if (typeof document !== "undefined") { 19491 registerDocument25(document); 19492 } 19493 return globalScope.__wpStyleRuntime; 19494 } 19495 function documentContainsStyleHash25(targetDocument, hash) { 19496 if (!targetDocument.head) { 19497 return false; 19498 } 19499 for (const style of targetDocument.head.querySelectorAll( 19500 `style[$STYLE_HASH_ATTRIBUTE25}]` 19501 )) { 19502 if (style.getAttribute(STYLE_HASH_ATTRIBUTE25) === hash) { 19503 return true; 19504 } 19505 } 19506 return false; 19507 } 19508 function injectStyle25(targetDocument, hash, css) { 19509 if (!targetDocument.head) { 19510 return; 19511 } 19512 const runtime = getRuntime25(); 19513 let injectedStyles = runtime.injectedStyles.get(targetDocument); 19514 if (!injectedStyles) { 19515 injectedStyles = /* @__PURE__ */ new Set(); 19516 runtime.injectedStyles.set(targetDocument, injectedStyles); 19517 } 19518 if (injectedStyles.has(hash)) { 19519 return; 19520 } 19521 if (documentContainsStyleHash25(targetDocument, hash)) { 19522 injectedStyles.add(hash); 19523 return; 19524 } 19525 const style = targetDocument.createElement("style"); 19526 style.setAttribute(STYLE_HASH_ATTRIBUTE25, hash); 19527 style.appendChild(targetDocument.createTextNode(css)); 19528 targetDocument.head.appendChild(style); 19529 injectedStyles.add(hash); 19530 } 19531 function registerDocument25(targetDocument) { 19532 const runtime = getRuntime25(); 19533 runtime.documents.set( 19534 targetDocument, 19535 (runtime.documents.get(targetDocument) ?? 0) + 1 19536 ); 19537 for (const [hash, css] of runtime.styles) { 19538 injectStyle25(targetDocument, hash, css); 19539 } 19540 return () => { 19541 const count = runtime.documents.get(targetDocument); 19542 if (count === void 0) { 19543 return; 19544 } 19545 if (count <= 1) { 19546 runtime.documents.delete(targetDocument); 19547 return; 19548 } 19549 runtime.documents.set(targetDocument, count - 1); 19550 }; 19551 } 19552 function registerStyle25(hash, css) { 19553 const runtime = getRuntime25(); 19554 runtime.styles.set(hash, css); 19555 for (const targetDocument of runtime.documents.keys()) { 19556 injectStyle25(targetDocument, hash, css); 19557 } 19558 } 19559 if (typeof process === "undefined" || true) { 19560 registerStyle25("f56e33ff28", '@layer wp-ui-components{.f1c50237c4787636__header{min-height:32px;padding-block:var(--wpds-dimension-padding-2xl,24px) var(--wpds-dimension-gap-lg,16px)}._579f95efdec92a66__footer,.f1c50237c4787636__header{align-items:center;display:flex;gap:var(--wpds-dimension-gap-sm,8px);padding-inline:var(--wpds-dimension-padding-2xl,24px)}._579f95efdec92a66__footer{justify-content:flex-end;padding-block:var(--wpds-dimension-gap-lg,16px) var(--wpds-dimension-padding-2xl,24px)}._5371cc08aad82574__title{--_gcd-heading-color:var(--wpds-color-fg-content-neutral,#1e1e1e);--_gcd-heading-margin:0 auto 0 0;color:var(--wpds-color-fg-content-neutral,#1e1e1e);margin-inline-end:auto;&:dir(rtl){--_gcd-heading-margin:0 0 0 auto}}._766d9011d37ce2d9__content{flex:1 1 auto;min-block-size:0;overflow-block:auto;overflow-inline:hidden;padding:var(--wpds-dimension-padding-2xl,24px);&:focus-visible{outline-offset:calc(var(--wpds-border-width-focus, var(--wp-admin-border-width-focus, 2px))*-1)}}.f1c50237c4787636__header:has(~._766d9011d37ce2d9__content){border-block-end:1px solid #0000;padding-block-end:calc(var(--wpds-dimension-gap-lg, 16px) - 1px)}.f1c50237c4787636__header~._766d9011d37ce2d9__content{padding-block-start:0}._766d9011d37ce2d9__content~._579f95efdec92a66__footer{border-block-start:1px solid #0000;padding-block-start:calc(var(--wpds-dimension-gap-lg, 16px) - 1px)}._766d9011d37ce2d9__content:has(~._579f95efdec92a66__footer){padding-block-end:0}._766d9011d37ce2d9__content>.f1c50237c4787636__header,._766d9011d37ce2d9__content>[data-drawer-content]>.f1c50237c4787636__header{padding-inline:0}._766d9011d37ce2d9__content>.f1c50237c4787636__header:first-child,._766d9011d37ce2d9__content>[data-drawer-content]>.f1c50237c4787636__header:first-child{padding-block-start:0}._766d9011d37ce2d9__content>._579f95efdec92a66__footer,._766d9011d37ce2d9__content>[data-drawer-content]>._579f95efdec92a66__footer{padding-inline:0}._766d9011d37ce2d9__content>._579f95efdec92a66__footer:last-child,._766d9011d37ce2d9__content>[data-drawer-content]>._579f95efdec92a66__footer:last-child{padding-block-end:0}.f1c50237c4787636__header:has(~[data-wp-ui-overlay-scroll-container][data-wp-ui-overlay-scrolled-from-top]){border-block-end-color:var(--wpds-color-stroke-surface-neutral,#dbdbdb)}[data-wp-ui-overlay-scroll-container][data-wp-ui-overlay-scrolled-from-bottom]~._579f95efdec92a66__footer{border-block-start-color:var(--wpds-color-stroke-surface-neutral,#dbdbdb)}[data-wp-ui-overlay-modal] [data-wp-ui-overlay-scroll-container]{overscroll-behavior:contain}}@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;[data-wpds-theme-provider-id]:has(>._882277c289298491__popup){display:block}@layer wp-ui-components{._07e459cfa0254522__backdrop{--backdrop-opacity:0.35;background-color:#000;inset:0;min-height:100dvh;opacity:calc(var(--backdrop-opacity)*(1 - var(--drawer-swipe-progress)));position:fixed;z-index:var(--wp-ui-drawer-z-index,initial);@supports (-webkit-touch-callout:none){position:absolute}&[data-ending-style],&[data-starting-style]{opacity:0}@media not (prefers-reduced-motion){transition:opacity .45s cubic-bezier(.32,.72,0,1);&[data-ending-style]{pointer-events:none;transition-duration:calc(var(--drawer-swipe-strength)*.4s)}&[data-swiping]{transition-duration:0ms}}}.f1cf22f966cf516e__viewport{inset:0;pointer-events:none;position:fixed;z-index:var(--wp-ui-drawer-z-index,initial)}._882277c289298491__popup{--viewport-inset:var(--wpds-dimension-padding-2xl,24px);background-color:var(--wpds-color-bg-surface-neutral-strong,#fff);border:var(--wpds-border-width-xs,1px) solid var(--wpds-color-stroke-surface-neutral,#dbdbdb);box-shadow:var(--wpds-elevation-lg,0 5px 15px 0 #00000014,0 15px 27px 0 #00000012,0 30px 36px 0 #0000000a,0 50px 43px 0 #00000005);box-sizing:border-box;color:var(--wpds-color-fg-content-neutral,#1e1e1e);display:flex;flex-direction:column;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(--wpds-typography-line-height-md,24px);outline:0;overflow:hidden;pointer-events:auto;position:fixed;touch-action:auto;z-index:var(--wp-ui-drawer-z-index,initial);&[data-ending-style],&[data-open],&[data-swiping]{will-change:transform}&[data-ending-style],&[data-starting-style]{box-shadow:none}@media not (prefers-reduced-motion){transition:transform .45s cubic-bezier(.32,.72,0,1),box-shadow .45s cubic-bezier(.32,.72,0,1);&[data-ending-style]{transition-duration:calc(var(--drawer-swipe-strength)*.4s)}&[data-swiping]{transition-duration:0ms}}&.e758b2a0572e1951__is-small{--popup-size:var(--wpds-dimension-surface-width-sm,320px)}&._21ddafd99d004b84__is-medium{--popup-size:var(--wpds-dimension-surface-width-md,400px)}&._78636e3fdcb75c3b__is-large{--popup-size:var(--wpds-dimension-surface-width-lg,560px)}&.b2960a80aa46d1f9__is-stretch{--popup-size:var(--stretch-size)}&._949cc180111d609b__is-auto{--popup-size:auto}&[data-swiping]{user-select:none}&[data-swipe-direction=left]{--stretch-size:calc(100vw - var(--viewport-inset));border-end-end-radius:var(--wpds-border-radius-lg,8px);border-start-end-radius:var(--wpds-border-radius-lg,8px);bottom:0;left:0;max-width:calc(100vw - var(--viewport-inset));top:0;transform:translateX(var(--drawer-swipe-movement-x));width:var(--popup-size);&[data-ending-style],&[data-starting-style]{transform:translateX(-100%)}}&[data-swipe-direction=right]{--stretch-size:calc(100vw - var(--viewport-inset));border-end-start-radius:var(--wpds-border-radius-lg,8px);border-start-start-radius:var(--wpds-border-radius-lg,8px);bottom:0;max-width:calc(100vw - var(--viewport-inset));right:0;top:0;transform:translateX(var(--drawer-swipe-movement-x));width:var(--popup-size);&[data-ending-style],&[data-starting-style]{transform:translateX(100%)}}&[data-swipe-direction=down]{--stretch-size:calc(100dvh - var(--viewport-inset));border-start-end-radius:var(--wpds-border-radius-lg,8px);border-start-start-radius:var(--wpds-border-radius-lg,8px);bottom:0;height:var(--popup-size);left:0;max-height:calc(100dvh - var(--viewport-inset));right:0;transform:translateY(var(--drawer-swipe-movement-y));&[data-ending-style],&[data-starting-style]{transform:translateY(100%)}}&[data-swipe-direction=up]{--stretch-size:calc(100dvh - var(--viewport-inset));border-end-end-radius:var(--wpds-border-radius-lg,8px);border-end-start-radius:var(--wpds-border-radius-lg,8px);height:var(--popup-size);left:0;max-height:calc(100dvh - var(--viewport-inset));right:0;top:0;transform:translateY(var(--drawer-swipe-movement-y));&[data-ending-style],&[data-starting-style]{transform:translateY(-100%)}}}._07e459cfa0254522__backdrop~* ._882277c289298491__popup{border-color:#0000}@media (forced-colors:active){._07e459cfa0254522__backdrop~* ._882277c289298491__popup,._882277c289298491__popup{border-color:CanvasText}}.e84af91dc76cf84f__header [data-wp-ui-drawer-close-icon]{margin-inline-start:auto}._882277c289298491__popup[data-swipe-direction=left] .c7c17b6b2378b2ee__content{padding-left:max(var(--wpds-dimension-padding-2xl,24px),env(safe-area-inset-left))}._882277c289298491__popup[data-swipe-direction=right] .c7c17b6b2378b2ee__content{padding-right:max(var(--wpds-dimension-padding-2xl,24px),env(safe-area-inset-right))}._882277c289298491__popup[data-swipe-direction=up]>.e84af91dc76cf84f__header{padding-top:max(var(--wpds-dimension-padding-2xl,24px),env(safe-area-inset-top))}._882277c289298491__popup[data-swipe-direction=down]>._1136b31b67a81245__footer{padding-bottom:max(var(--wpds-dimension-padding-2xl,24px),env(safe-area-inset-bottom))}._882277c289298491__popup[data-swipe-direction=up]>.c7c17b6b2378b2ee__content:first-child{padding-top:max(var(--wpds-dimension-padding-2xl,24px),env(safe-area-inset-top))}._882277c289298491__popup[data-swipe-direction=down]>.c7c17b6b2378b2ee__content:last-child{padding-bottom:max(var(--wpds-dimension-padding-2xl,24px),env(safe-area-inset-bottom))}}'); 19561 } 19562 var style_default25 = { "popup": "_882277c289298491__popup", "backdrop": "_07e459cfa0254522__backdrop", "viewport": "f1cf22f966cf516e__viewport", "is-small": "e758b2a0572e1951__is-small", "is-medium": "_21ddafd99d004b84__is-medium", "is-large": "_78636e3fdcb75c3b__is-large", "is-stretch": "b2960a80aa46d1f9__is-stretch", "is-auto": "_949cc180111d609b__is-auto", "header": "e84af91dc76cf84f__header f1c50237c4787636__header", "footer": "_1136b31b67a81245__footer _579f95efdec92a66__footer", "title": "_0dab095165fca096__title _5371cc08aad82574__title", "content": "c7c17b6b2378b2ee__content _766d9011d37ce2d9__content" }; 19563 var ThemeProvider4 = unlock(import_theme4.privateApis).ThemeProvider; 19564 var CLOSE_ICON_ATTR2 = "data-wp-ui-drawer-close-icon"; 19565 var Popup4 = (0, import_element63.forwardRef)(function DrawerPopup3({ className, portal, children, size: size4, initialFocus, finalFocus, ...props }, ref) { 19566 const { resolvedInitialFocus, popupRef } = useDeprioritizedInitialFocus({ 19567 initialFocus, 19568 deprioritizedAttributes: [CLOSE_ICON_ATTR2, SCROLL_CONTAINER_ATTR] 19569 }); 19570 const mergedRef = (0, import_compose6.useMergeRefs)([ref, popupRef]); 19571 const modal = useDrawerModal(); 19572 const portalChildren = /* @__PURE__ */ (0, import_jsx_runtime96.jsxs)(import_jsx_runtime96.Fragment, { children: [ 19573 modal === true && /* @__PURE__ */ (0, import_jsx_runtime96.jsx)( 19574 index_parts_exports4.Backdrop, 19575 { 19576 className: style_default25.backdrop, 19577 "data-testid": "drawer-backdrop" 19578 } 19579 ), 19580 /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(index_parts_exports4.Viewport, { className: style_default25.viewport, children: /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(ThemeProvider4, { children: /* @__PURE__ */ (0, import_jsx_runtime96.jsx)( 19581 index_parts_exports4.Popup, 19582 { 19583 ref: mergedRef, 19584 className: (state) => { 19585 const isVertical = state.swipeDirection === "up" || state.swipeDirection === "down"; 19586 const resolvedSize = size4 ?? (isVertical ? "auto" : "medium"); 19587 return clsx_default( 19588 style_default25.popup, 19589 className, 19590 style_default25[`is-$resolvedSize}`] 19591 ); 19592 }, 19593 initialFocus: resolvedInitialFocus, 19594 finalFocus, 19595 ...props, 19596 "data-wp-ui-overlay-modal": modal === true ? "" : void 0, 19597 children: /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(DrawerValidationProvider, { children }) 19598 } 19599 ) }) }) 19600 ] }); 19601 return renderSlotWithChildren(portal, /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(Portal4, {}), portalChildren); 19602 }); 19603 19604 // packages/ui/build-module/drawer/root.mjs 19605 var import_jsx_runtime97 = __toESM(require_jsx_runtime(), 1); 19606 function Root7({ 19607 modal = true, 19608 swipeDirection = "left", 19609 children, 19610 ...props 19611 }) { 19612 return /* @__PURE__ */ (0, import_jsx_runtime97.jsx)( 19613 index_parts_exports4.Root, 19614 { 19615 modal, 19616 swipeDirection, 19617 ...props, 19618 children: /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(DrawerModalProvider, { modal, children }) 19619 } 19620 ); 19621 } 19622 19623 // packages/ui/build-module/drawer/title.mjs 19624 var import_compose7 = __toESM(require_compose(), 1); 19625 var import_element64 = __toESM(require_element(), 1); 19626 var import_jsx_runtime98 = __toESM(require_jsx_runtime(), 1); 19627 var STYLE_HASH_ATTRIBUTE26 = "data-wp-hash"; 19628 function getRuntime26() { 19629 const globalScope = globalThis; 19630 if (globalScope.__wpStyleRuntime) { 19631 return globalScope.__wpStyleRuntime; 19632 } 19633 globalScope.__wpStyleRuntime = { 19634 documents: /* @__PURE__ */ new Map(), 19635 styles: /* @__PURE__ */ new Map(), 19636 injectedStyles: /* @__PURE__ */ new WeakMap() 19637 }; 19638 if (typeof document !== "undefined") { 19639 registerDocument26(document); 19640 } 19641 return globalScope.__wpStyleRuntime; 19642 } 19643 function documentContainsStyleHash26(targetDocument, hash) { 19644 if (!targetDocument.head) { 19645 return false; 19646 } 19647 for (const style of targetDocument.head.querySelectorAll( 19648 `style[$STYLE_HASH_ATTRIBUTE26}]` 19649 )) { 19650 if (style.getAttribute(STYLE_HASH_ATTRIBUTE26) === hash) { 19651 return true; 19652 } 19653 } 19654 return false; 19655 } 19656 function injectStyle26(targetDocument, hash, css) { 19657 if (!targetDocument.head) { 19658 return; 19659 } 19660 const runtime = getRuntime26(); 19661 let injectedStyles = runtime.injectedStyles.get(targetDocument); 19662 if (!injectedStyles) { 19663 injectedStyles = /* @__PURE__ */ new Set(); 19664 runtime.injectedStyles.set(targetDocument, injectedStyles); 19665 } 19666 if (injectedStyles.has(hash)) { 19667 return; 19668 } 19669 if (documentContainsStyleHash26(targetDocument, hash)) { 19670 injectedStyles.add(hash); 19671 return; 19672 } 19673 const style = targetDocument.createElement("style"); 19674 style.setAttribute(STYLE_HASH_ATTRIBUTE26, hash); 19675 style.appendChild(targetDocument.createTextNode(css)); 19676 targetDocument.head.appendChild(style); 19677 injectedStyles.add(hash); 19678 } 19679 function registerDocument26(targetDocument) { 19680 const runtime = getRuntime26(); 19681 runtime.documents.set( 19682 targetDocument, 19683 (runtime.documents.get(targetDocument) ?? 0) + 1 19684 ); 19685 for (const [hash, css] of runtime.styles) { 19686 injectStyle26(targetDocument, hash, css); 19687 } 19688 return () => { 19689 const count = runtime.documents.get(targetDocument); 19690 if (count === void 0) { 19691 return; 19692 } 19693 if (count <= 1) { 19694 runtime.documents.delete(targetDocument); 19695 return; 19696 } 19697 runtime.documents.set(targetDocument, count - 1); 19698 }; 19699 } 19700 function registerStyle26(hash, css) { 19701 const runtime = getRuntime26(); 19702 runtime.styles.set(hash, css); 19703 for (const targetDocument of runtime.documents.keys()) { 19704 injectStyle26(targetDocument, hash, css); 19705 } 19706 } 19707 if (typeof process === "undefined" || true) { 19708 registerStyle26("f56e33ff28", '@layer wp-ui-components{.f1c50237c4787636__header{min-height:32px;padding-block:var(--wpds-dimension-padding-2xl,24px) var(--wpds-dimension-gap-lg,16px)}._579f95efdec92a66__footer,.f1c50237c4787636__header{align-items:center;display:flex;gap:var(--wpds-dimension-gap-sm,8px);padding-inline:var(--wpds-dimension-padding-2xl,24px)}._579f95efdec92a66__footer{justify-content:flex-end;padding-block:var(--wpds-dimension-gap-lg,16px) var(--wpds-dimension-padding-2xl,24px)}._5371cc08aad82574__title{--_gcd-heading-color:var(--wpds-color-fg-content-neutral,#1e1e1e);--_gcd-heading-margin:0 auto 0 0;color:var(--wpds-color-fg-content-neutral,#1e1e1e);margin-inline-end:auto;&:dir(rtl){--_gcd-heading-margin:0 0 0 auto}}._766d9011d37ce2d9__content{flex:1 1 auto;min-block-size:0;overflow-block:auto;overflow-inline:hidden;padding:var(--wpds-dimension-padding-2xl,24px);&:focus-visible{outline-offset:calc(var(--wpds-border-width-focus, var(--wp-admin-border-width-focus, 2px))*-1)}}.f1c50237c4787636__header:has(~._766d9011d37ce2d9__content){border-block-end:1px solid #0000;padding-block-end:calc(var(--wpds-dimension-gap-lg, 16px) - 1px)}.f1c50237c4787636__header~._766d9011d37ce2d9__content{padding-block-start:0}._766d9011d37ce2d9__content~._579f95efdec92a66__footer{border-block-start:1px solid #0000;padding-block-start:calc(var(--wpds-dimension-gap-lg, 16px) - 1px)}._766d9011d37ce2d9__content:has(~._579f95efdec92a66__footer){padding-block-end:0}._766d9011d37ce2d9__content>.f1c50237c4787636__header,._766d9011d37ce2d9__content>[data-drawer-content]>.f1c50237c4787636__header{padding-inline:0}._766d9011d37ce2d9__content>.f1c50237c4787636__header:first-child,._766d9011d37ce2d9__content>[data-drawer-content]>.f1c50237c4787636__header:first-child{padding-block-start:0}._766d9011d37ce2d9__content>._579f95efdec92a66__footer,._766d9011d37ce2d9__content>[data-drawer-content]>._579f95efdec92a66__footer{padding-inline:0}._766d9011d37ce2d9__content>._579f95efdec92a66__footer:last-child,._766d9011d37ce2d9__content>[data-drawer-content]>._579f95efdec92a66__footer:last-child{padding-block-end:0}.f1c50237c4787636__header:has(~[data-wp-ui-overlay-scroll-container][data-wp-ui-overlay-scrolled-from-top]){border-block-end-color:var(--wpds-color-stroke-surface-neutral,#dbdbdb)}[data-wp-ui-overlay-scroll-container][data-wp-ui-overlay-scrolled-from-bottom]~._579f95efdec92a66__footer{border-block-start-color:var(--wpds-color-stroke-surface-neutral,#dbdbdb)}[data-wp-ui-overlay-modal] [data-wp-ui-overlay-scroll-container]{overscroll-behavior:contain}}@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;[data-wpds-theme-provider-id]:has(>._882277c289298491__popup){display:block}@layer wp-ui-components{._07e459cfa0254522__backdrop{--backdrop-opacity:0.35;background-color:#000;inset:0;min-height:100dvh;opacity:calc(var(--backdrop-opacity)*(1 - var(--drawer-swipe-progress)));position:fixed;z-index:var(--wp-ui-drawer-z-index,initial);@supports (-webkit-touch-callout:none){position:absolute}&[data-ending-style],&[data-starting-style]{opacity:0}@media not (prefers-reduced-motion){transition:opacity .45s cubic-bezier(.32,.72,0,1);&[data-ending-style]{pointer-events:none;transition-duration:calc(var(--drawer-swipe-strength)*.4s)}&[data-swiping]{transition-duration:0ms}}}.f1cf22f966cf516e__viewport{inset:0;pointer-events:none;position:fixed;z-index:var(--wp-ui-drawer-z-index,initial)}._882277c289298491__popup{--viewport-inset:var(--wpds-dimension-padding-2xl,24px);background-color:var(--wpds-color-bg-surface-neutral-strong,#fff);border:var(--wpds-border-width-xs,1px) solid var(--wpds-color-stroke-surface-neutral,#dbdbdb);box-shadow:var(--wpds-elevation-lg,0 5px 15px 0 #00000014,0 15px 27px 0 #00000012,0 30px 36px 0 #0000000a,0 50px 43px 0 #00000005);box-sizing:border-box;color:var(--wpds-color-fg-content-neutral,#1e1e1e);display:flex;flex-direction:column;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(--wpds-typography-line-height-md,24px);outline:0;overflow:hidden;pointer-events:auto;position:fixed;touch-action:auto;z-index:var(--wp-ui-drawer-z-index,initial);&[data-ending-style],&[data-open],&[data-swiping]{will-change:transform}&[data-ending-style],&[data-starting-style]{box-shadow:none}@media not (prefers-reduced-motion){transition:transform .45s cubic-bezier(.32,.72,0,1),box-shadow .45s cubic-bezier(.32,.72,0,1);&[data-ending-style]{transition-duration:calc(var(--drawer-swipe-strength)*.4s)}&[data-swiping]{transition-duration:0ms}}&.e758b2a0572e1951__is-small{--popup-size:var(--wpds-dimension-surface-width-sm,320px)}&._21ddafd99d004b84__is-medium{--popup-size:var(--wpds-dimension-surface-width-md,400px)}&._78636e3fdcb75c3b__is-large{--popup-size:var(--wpds-dimension-surface-width-lg,560px)}&.b2960a80aa46d1f9__is-stretch{--popup-size:var(--stretch-size)}&._949cc180111d609b__is-auto{--popup-size:auto}&[data-swiping]{user-select:none}&[data-swipe-direction=left]{--stretch-size:calc(100vw - var(--viewport-inset));border-end-end-radius:var(--wpds-border-radius-lg,8px);border-start-end-radius:var(--wpds-border-radius-lg,8px);bottom:0;left:0;max-width:calc(100vw - var(--viewport-inset));top:0;transform:translateX(var(--drawer-swipe-movement-x));width:var(--popup-size);&[data-ending-style],&[data-starting-style]{transform:translateX(-100%)}}&[data-swipe-direction=right]{--stretch-size:calc(100vw - var(--viewport-inset));border-end-start-radius:var(--wpds-border-radius-lg,8px);border-start-start-radius:var(--wpds-border-radius-lg,8px);bottom:0;max-width:calc(100vw - var(--viewport-inset));right:0;top:0;transform:translateX(var(--drawer-swipe-movement-x));width:var(--popup-size);&[data-ending-style],&[data-starting-style]{transform:translateX(100%)}}&[data-swipe-direction=down]{--stretch-size:calc(100dvh - var(--viewport-inset));border-start-end-radius:var(--wpds-border-radius-lg,8px);border-start-start-radius:var(--wpds-border-radius-lg,8px);bottom:0;height:var(--popup-size);left:0;max-height:calc(100dvh - var(--viewport-inset));right:0;transform:translateY(var(--drawer-swipe-movement-y));&[data-ending-style],&[data-starting-style]{transform:translateY(100%)}}&[data-swipe-direction=up]{--stretch-size:calc(100dvh - var(--viewport-inset));border-end-end-radius:var(--wpds-border-radius-lg,8px);border-end-start-radius:var(--wpds-border-radius-lg,8px);height:var(--popup-size);left:0;max-height:calc(100dvh - var(--viewport-inset));right:0;top:0;transform:translateY(var(--drawer-swipe-movement-y));&[data-ending-style],&[data-starting-style]{transform:translateY(-100%)}}}._07e459cfa0254522__backdrop~* ._882277c289298491__popup{border-color:#0000}@media (forced-colors:active){._07e459cfa0254522__backdrop~* ._882277c289298491__popup,._882277c289298491__popup{border-color:CanvasText}}.e84af91dc76cf84f__header [data-wp-ui-drawer-close-icon]{margin-inline-start:auto}._882277c289298491__popup[data-swipe-direction=left] .c7c17b6b2378b2ee__content{padding-left:max(var(--wpds-dimension-padding-2xl,24px),env(safe-area-inset-left))}._882277c289298491__popup[data-swipe-direction=right] .c7c17b6b2378b2ee__content{padding-right:max(var(--wpds-dimension-padding-2xl,24px),env(safe-area-inset-right))}._882277c289298491__popup[data-swipe-direction=up]>.e84af91dc76cf84f__header{padding-top:max(var(--wpds-dimension-padding-2xl,24px),env(safe-area-inset-top))}._882277c289298491__popup[data-swipe-direction=down]>._1136b31b67a81245__footer{padding-bottom:max(var(--wpds-dimension-padding-2xl,24px),env(safe-area-inset-bottom))}._882277c289298491__popup[data-swipe-direction=up]>.c7c17b6b2378b2ee__content:first-child{padding-top:max(var(--wpds-dimension-padding-2xl,24px),env(safe-area-inset-top))}._882277c289298491__popup[data-swipe-direction=down]>.c7c17b6b2378b2ee__content:last-child{padding-bottom:max(var(--wpds-dimension-padding-2xl,24px),env(safe-area-inset-bottom))}}'); 19709 } 19710 var style_default26 = { "popup": "_882277c289298491__popup", "backdrop": "_07e459cfa0254522__backdrop", "viewport": "f1cf22f966cf516e__viewport", "is-small": "e758b2a0572e1951__is-small", "is-medium": "_21ddafd99d004b84__is-medium", "is-large": "_78636e3fdcb75c3b__is-large", "is-stretch": "b2960a80aa46d1f9__is-stretch", "is-auto": "_949cc180111d609b__is-auto", "header": "e84af91dc76cf84f__header f1c50237c4787636__header", "footer": "_1136b31b67a81245__footer _579f95efdec92a66__footer", "title": "_0dab095165fca096__title _5371cc08aad82574__title", "content": "c7c17b6b2378b2ee__content _766d9011d37ce2d9__content" }; 19711 var Title3 = (0, import_element64.forwardRef)( 19712 function DrawerTitle2({ children, ...props }, forwardedRef) { 19713 const validationContext = useDrawerValidationContext(); 19714 const internalRef = (0, import_element64.useRef)(null); 19715 const mergedRef = (0, import_compose7.useMergeRefs)([internalRef, forwardedRef]); 19716 (0, import_element64.useEffect)(() => { 19717 if (validationContext) { 19718 return validationContext.registerTitle(internalRef.current); 19719 } 19720 return void 0; 19721 }, [validationContext]); 19722 return /* @__PURE__ */ (0, import_jsx_runtime98.jsx)( 19723 Text, 19724 { 19725 ref: mergedRef, 19726 variant: "heading-xl", 19727 render: /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(index_parts_exports4.Title, { ...props }), 19728 className: style_default26.title, 19729 children 19730 } 19731 ); 19732 } 19733 ); 19734 19735 // packages/ui/build-module/drawer/trigger.mjs 19736 var import_element65 = __toESM(require_element(), 1); 19737 var import_jsx_runtime99 = __toESM(require_jsx_runtime(), 1); 19738 var Trigger5 = (0, import_element65.forwardRef)( 19739 function DrawerTrigger2(props, ref) { 19740 return /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(index_parts_exports4.Trigger, { ref, ...props }); 19741 } 19742 ); 19743 19744 // packages/ui/build-module/empty-state/index.mjs 19745 var empty_state_exports = {}; 19746 __export(empty_state_exports, { 19747 Actions: () => Actions, 19748 Description: () => Description3, 19749 Icon: () => Icon3, 19750 Root: () => Root8, 19751 Title: () => Title4, 19752 Visual: () => Visual 19753 }); 19754 19755 // packages/ui/build-module/empty-state/root.mjs 19756 var import_element66 = __toESM(require_element(), 1); 19757 var STYLE_HASH_ATTRIBUTE27 = "data-wp-hash"; 19758 function getRuntime27() { 19759 const globalScope = globalThis; 19760 if (globalScope.__wpStyleRuntime) { 19761 return globalScope.__wpStyleRuntime; 19762 } 19763 globalScope.__wpStyleRuntime = { 19764 documents: /* @__PURE__ */ new Map(), 19765 styles: /* @__PURE__ */ new Map(), 19766 injectedStyles: /* @__PURE__ */ new WeakMap() 19767 }; 19768 if (typeof document !== "undefined") { 19769 registerDocument27(document); 19770 } 19771 return globalScope.__wpStyleRuntime; 19772 } 19773 function documentContainsStyleHash27(targetDocument, hash) { 19774 if (!targetDocument.head) { 19775 return false; 19776 } 19777 for (const style of targetDocument.head.querySelectorAll( 19778 `style[$STYLE_HASH_ATTRIBUTE27}]` 19779 )) { 19780 if (style.getAttribute(STYLE_HASH_ATTRIBUTE27) === hash) { 19781 return true; 19782 } 19783 } 19784 return false; 19785 } 19786 function injectStyle27(targetDocument, hash, css) { 19787 if (!targetDocument.head) { 19788 return; 19789 } 19790 const runtime = getRuntime27(); 19791 let injectedStyles = runtime.injectedStyles.get(targetDocument); 19792 if (!injectedStyles) { 19793 injectedStyles = /* @__PURE__ */ new Set(); 19794 runtime.injectedStyles.set(targetDocument, injectedStyles); 19795 } 19796 if (injectedStyles.has(hash)) { 19797 return; 19798 } 19799 if (documentContainsStyleHash27(targetDocument, hash)) { 19800 injectedStyles.add(hash); 19801 return; 19802 } 19803 const style = targetDocument.createElement("style"); 19804 style.setAttribute(STYLE_HASH_ATTRIBUTE27, hash); 19805 style.appendChild(targetDocument.createTextNode(css)); 19806 targetDocument.head.appendChild(style); 19807 injectedStyles.add(hash); 19808 } 19809 function registerDocument27(targetDocument) { 19810 const runtime = getRuntime27(); 19811 runtime.documents.set( 19812 targetDocument, 19813 (runtime.documents.get(targetDocument) ?? 0) + 1 19814 ); 19815 for (const [hash, css] of runtime.styles) { 19816 injectStyle27(targetDocument, hash, css); 19817 } 19818 return () => { 19819 const count = runtime.documents.get(targetDocument); 19820 if (count === void 0) { 19821 return; 19822 } 19823 if (count <= 1) { 19824 runtime.documents.delete(targetDocument); 19825 return; 19826 } 19827 runtime.documents.set(targetDocument, count - 1); 19828 }; 19829 } 19830 function registerStyle27(hash, css) { 19831 const runtime = getRuntime27(); 19832 runtime.styles.set(hash, css); 19833 for (const targetDocument of runtime.documents.keys()) { 19834 injectStyle27(targetDocument, hash, css); 19835 } 19836 } 19837 if (typeof process === "undefined" || true) { 19838 registerStyle27("6d6361d221", '@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;@layer wp-ui-components{.a23e08e65c8e62e5__root{text-wrap:balance;align-items:center;color:var(--wpds-color-fg-content-neutral,#1e1e1e);display:flex;flex-direction:column;font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);gap:var(--wpds-dimension-gap-xs,4px);max-width:var(--wpds-dimension-surface-width-sm,320px);text-align:center}._01303b3680eaa216__visual{align-items:center;color:var(--wpds-color-fg-content-neutral-weak,#707070);display:flex;justify-content:center;line-height:1;margin-block-end:var(--wpds-dimension-gap-xs,4px)}._58c8e351db225608__icon{background-color:var(--wpds-color-bg-surface-neutral-weak,#f4f4f4);border:1px solid var(--wpds-color-stroke-surface-neutral-weak,#e4e4e4);border-radius:50%;padding:var(--wpds-dimension-padding-xs,4px)}.b8b96f70820333a1__title{margin:0}._70f1dd22bad55b18__description{color:var(--wpds-color-fg-content-neutral-weak,#707070);margin:0}._89ac025fd8e2bc52__actions{align-items:center;display:flex;flex-direction:column;gap:var(--wpds-dimension-gap-xs,4px);margin-block-start:var(--wpds-dimension-gap-md,12px);@media (min-width:480px){flex-direction:row;justify-content:center}}}'); 19839 } 19840 var style_default27 = { "root": "a23e08e65c8e62e5__root", "visual": "_01303b3680eaa216__visual", "icon": "_58c8e351db225608__icon", "title": "b8b96f70820333a1__title", "description": "_70f1dd22bad55b18__description", "actions": "_89ac025fd8e2bc52__actions" }; 19841 var Root8 = (0, import_element66.forwardRef)( 19842 function EmptyStateRoot({ render: render4, ...props }, ref) { 19843 const className = clsx_default(style_default27.root); 19844 const element = useRender({ 19845 defaultTagName: "div", 19846 render: render4, 19847 ref, 19848 props: mergeProps({ className }, props) 19849 }); 19850 return element; 19851 } 19852 ); 19853 19854 // packages/ui/build-module/empty-state/visual.mjs 19855 var import_element67 = __toESM(require_element(), 1); 19856 var STYLE_HASH_ATTRIBUTE28 = "data-wp-hash"; 19857 function getRuntime28() { 19858 const globalScope = globalThis; 19859 if (globalScope.__wpStyleRuntime) { 19860 return globalScope.__wpStyleRuntime; 19861 } 19862 globalScope.__wpStyleRuntime = { 19863 documents: /* @__PURE__ */ new Map(), 19864 styles: /* @__PURE__ */ new Map(), 19865 injectedStyles: /* @__PURE__ */ new WeakMap() 19866 }; 19867 if (typeof document !== "undefined") { 19868 registerDocument28(document); 19869 } 19870 return globalScope.__wpStyleRuntime; 19871 } 19872 function documentContainsStyleHash28(targetDocument, hash) { 19873 if (!targetDocument.head) { 19874 return false; 19875 } 19876 for (const style of targetDocument.head.querySelectorAll( 19877 `style[$STYLE_HASH_ATTRIBUTE28}]` 19878 )) { 19879 if (style.getAttribute(STYLE_HASH_ATTRIBUTE28) === hash) { 19880 return true; 19881 } 19882 } 19883 return false; 19884 } 19885 function injectStyle28(targetDocument, hash, css) { 19886 if (!targetDocument.head) { 19887 return; 19888 } 19889 const runtime = getRuntime28(); 19890 let injectedStyles = runtime.injectedStyles.get(targetDocument); 19891 if (!injectedStyles) { 19892 injectedStyles = /* @__PURE__ */ new Set(); 19893 runtime.injectedStyles.set(targetDocument, injectedStyles); 19894 } 19895 if (injectedStyles.has(hash)) { 19896 return; 19897 } 19898 if (documentContainsStyleHash28(targetDocument, hash)) { 19899 injectedStyles.add(hash); 19900 return; 19901 } 19902 const style = targetDocument.createElement("style"); 19903 style.setAttribute(STYLE_HASH_ATTRIBUTE28, hash); 19904 style.appendChild(targetDocument.createTextNode(css)); 19905 targetDocument.head.appendChild(style); 19906 injectedStyles.add(hash); 19907 } 19908 function registerDocument28(targetDocument) { 19909 const runtime = getRuntime28(); 19910 runtime.documents.set( 19911 targetDocument, 19912 (runtime.documents.get(targetDocument) ?? 0) + 1 19913 ); 19914 for (const [hash, css] of runtime.styles) { 19915 injectStyle28(targetDocument, hash, css); 19916 } 19917 return () => { 19918 const count = runtime.documents.get(targetDocument); 19919 if (count === void 0) { 19920 return; 19921 } 19922 if (count <= 1) { 19923 runtime.documents.delete(targetDocument); 19924 return; 19925 } 19926 runtime.documents.set(targetDocument, count - 1); 19927 }; 19928 } 19929 function registerStyle28(hash, css) { 19930 const runtime = getRuntime28(); 19931 runtime.styles.set(hash, css); 19932 for (const targetDocument of runtime.documents.keys()) { 19933 injectStyle28(targetDocument, hash, css); 19934 } 19935 } 19936 if (typeof process === "undefined" || true) { 19937 registerStyle28("6d6361d221", '@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;@layer wp-ui-components{.a23e08e65c8e62e5__root{text-wrap:balance;align-items:center;color:var(--wpds-color-fg-content-neutral,#1e1e1e);display:flex;flex-direction:column;font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);gap:var(--wpds-dimension-gap-xs,4px);max-width:var(--wpds-dimension-surface-width-sm,320px);text-align:center}._01303b3680eaa216__visual{align-items:center;color:var(--wpds-color-fg-content-neutral-weak,#707070);display:flex;justify-content:center;line-height:1;margin-block-end:var(--wpds-dimension-gap-xs,4px)}._58c8e351db225608__icon{background-color:var(--wpds-color-bg-surface-neutral-weak,#f4f4f4);border:1px solid var(--wpds-color-stroke-surface-neutral-weak,#e4e4e4);border-radius:50%;padding:var(--wpds-dimension-padding-xs,4px)}.b8b96f70820333a1__title{margin:0}._70f1dd22bad55b18__description{color:var(--wpds-color-fg-content-neutral-weak,#707070);margin:0}._89ac025fd8e2bc52__actions{align-items:center;display:flex;flex-direction:column;gap:var(--wpds-dimension-gap-xs,4px);margin-block-start:var(--wpds-dimension-gap-md,12px);@media (min-width:480px){flex-direction:row;justify-content:center}}}'); 19938 } 19939 var style_default28 = { "root": "a23e08e65c8e62e5__root", "visual": "_01303b3680eaa216__visual", "icon": "_58c8e351db225608__icon", "title": "b8b96f70820333a1__title", "description": "_70f1dd22bad55b18__description", "actions": "_89ac025fd8e2bc52__actions" }; 19940 var Visual = (0, import_element67.forwardRef)( 19941 function EmptyStateVisual({ render: render4, ...props }, ref) { 19942 const className = clsx_default(style_default28.visual); 19943 const element = useRender({ 19944 defaultTagName: "div", 19945 render: render4, 19946 ref, 19947 props: mergeProps({ className }, props) 19948 }); 19949 return element; 19950 } 19951 ); 19952 19953 // packages/ui/build-module/empty-state/icon.mjs 19954 var import_element68 = __toESM(require_element(), 1); 19955 var import_jsx_runtime100 = __toESM(require_jsx_runtime(), 1); 19956 var STYLE_HASH_ATTRIBUTE29 = "data-wp-hash"; 19957 function getRuntime29() { 19958 const globalScope = globalThis; 19959 if (globalScope.__wpStyleRuntime) { 19960 return globalScope.__wpStyleRuntime; 19961 } 19962 globalScope.__wpStyleRuntime = { 19963 documents: /* @__PURE__ */ new Map(), 19964 styles: /* @__PURE__ */ new Map(), 19965 injectedStyles: /* @__PURE__ */ new WeakMap() 19966 }; 19967 if (typeof document !== "undefined") { 19968 registerDocument29(document); 19969 } 19970 return globalScope.__wpStyleRuntime; 19971 } 19972 function documentContainsStyleHash29(targetDocument, hash) { 19973 if (!targetDocument.head) { 19974 return false; 19975 } 19976 for (const style of targetDocument.head.querySelectorAll( 19977 `style[$STYLE_HASH_ATTRIBUTE29}]` 19978 )) { 19979 if (style.getAttribute(STYLE_HASH_ATTRIBUTE29) === hash) { 19980 return true; 19981 } 19982 } 19983 return false; 19984 } 19985 function injectStyle29(targetDocument, hash, css) { 19986 if (!targetDocument.head) { 19987 return; 19988 } 19989 const runtime = getRuntime29(); 19990 let injectedStyles = runtime.injectedStyles.get(targetDocument); 19991 if (!injectedStyles) { 19992 injectedStyles = /* @__PURE__ */ new Set(); 19993 runtime.injectedStyles.set(targetDocument, injectedStyles); 19994 } 19995 if (injectedStyles.has(hash)) { 19996 return; 19997 } 19998 if (documentContainsStyleHash29(targetDocument, hash)) { 19999 injectedStyles.add(hash); 20000 return; 20001 } 20002 const style = targetDocument.createElement("style"); 20003 style.setAttribute(STYLE_HASH_ATTRIBUTE29, hash); 20004 style.appendChild(targetDocument.createTextNode(css)); 20005 targetDocument.head.appendChild(style); 20006 injectedStyles.add(hash); 20007 } 20008 function registerDocument29(targetDocument) { 20009 const runtime = getRuntime29(); 20010 runtime.documents.set( 20011 targetDocument, 20012 (runtime.documents.get(targetDocument) ?? 0) + 1 20013 ); 20014 for (const [hash, css] of runtime.styles) { 20015 injectStyle29(targetDocument, hash, css); 20016 } 20017 return () => { 20018 const count = runtime.documents.get(targetDocument); 20019 if (count === void 0) { 20020 return; 20021 } 20022 if (count <= 1) { 20023 runtime.documents.delete(targetDocument); 20024 return; 20025 } 20026 runtime.documents.set(targetDocument, count - 1); 20027 }; 20028 } 20029 function registerStyle29(hash, css) { 20030 const runtime = getRuntime29(); 20031 runtime.styles.set(hash, css); 20032 for (const targetDocument of runtime.documents.keys()) { 20033 injectStyle29(targetDocument, hash, css); 20034 } 20035 } 20036 if (typeof process === "undefined" || true) { 20037 registerStyle29("6d6361d221", '@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;@layer wp-ui-components{.a23e08e65c8e62e5__root{text-wrap:balance;align-items:center;color:var(--wpds-color-fg-content-neutral,#1e1e1e);display:flex;flex-direction:column;font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);gap:var(--wpds-dimension-gap-xs,4px);max-width:var(--wpds-dimension-surface-width-sm,320px);text-align:center}._01303b3680eaa216__visual{align-items:center;color:var(--wpds-color-fg-content-neutral-weak,#707070);display:flex;justify-content:center;line-height:1;margin-block-end:var(--wpds-dimension-gap-xs,4px)}._58c8e351db225608__icon{background-color:var(--wpds-color-bg-surface-neutral-weak,#f4f4f4);border:1px solid var(--wpds-color-stroke-surface-neutral-weak,#e4e4e4);border-radius:50%;padding:var(--wpds-dimension-padding-xs,4px)}.b8b96f70820333a1__title{margin:0}._70f1dd22bad55b18__description{color:var(--wpds-color-fg-content-neutral-weak,#707070);margin:0}._89ac025fd8e2bc52__actions{align-items:center;display:flex;flex-direction:column;gap:var(--wpds-dimension-gap-xs,4px);margin-block-start:var(--wpds-dimension-gap-md,12px);@media (min-width:480px){flex-direction:row;justify-content:center}}}'); 20038 } 20039 var style_default29 = { "root": "a23e08e65c8e62e5__root", "visual": "_01303b3680eaa216__visual", "icon": "_58c8e351db225608__icon", "title": "b8b96f70820333a1__title", "description": "_70f1dd22bad55b18__description", "actions": "_89ac025fd8e2bc52__actions" }; 20040 var Icon3 = (0, import_element68.forwardRef)( 20041 function EmptyStateIcon({ icon, className, ...restProps }, ref) { 20042 return /* @__PURE__ */ (0, import_jsx_runtime100.jsx)( 20043 Visual, 20044 { 20045 ref, 20046 className: clsx_default(style_default29.icon, className), 20047 ...restProps, 20048 children: /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(Icon, { icon }) 20049 } 20050 ); 20051 } 20052 ); 20053 20054 // packages/ui/build-module/empty-state/title.mjs 20055 var import_element69 = __toESM(require_element(), 1); 20056 var import_jsx_runtime101 = __toESM(require_jsx_runtime(), 1); 20057 var STYLE_HASH_ATTRIBUTE30 = "data-wp-hash"; 20058 function getRuntime30() { 20059 const globalScope = globalThis; 20060 if (globalScope.__wpStyleRuntime) { 20061 return globalScope.__wpStyleRuntime; 20062 } 20063 globalScope.__wpStyleRuntime = { 20064 documents: /* @__PURE__ */ new Map(), 20065 styles: /* @__PURE__ */ new Map(), 20066 injectedStyles: /* @__PURE__ */ new WeakMap() 20067 }; 20068 if (typeof document !== "undefined") { 20069 registerDocument30(document); 20070 } 20071 return globalScope.__wpStyleRuntime; 20072 } 20073 function documentContainsStyleHash30(targetDocument, hash) { 20074 if (!targetDocument.head) { 20075 return false; 20076 } 20077 for (const style of targetDocument.head.querySelectorAll( 20078 `style[$STYLE_HASH_ATTRIBUTE30}]` 20079 )) { 20080 if (style.getAttribute(STYLE_HASH_ATTRIBUTE30) === hash) { 20081 return true; 20082 } 20083 } 20084 return false; 20085 } 20086 function injectStyle30(targetDocument, hash, css) { 20087 if (!targetDocument.head) { 20088 return; 20089 } 20090 const runtime = getRuntime30(); 20091 let injectedStyles = runtime.injectedStyles.get(targetDocument); 20092 if (!injectedStyles) { 20093 injectedStyles = /* @__PURE__ */ new Set(); 20094 runtime.injectedStyles.set(targetDocument, injectedStyles); 20095 } 20096 if (injectedStyles.has(hash)) { 20097 return; 20098 } 20099 if (documentContainsStyleHash30(targetDocument, hash)) { 20100 injectedStyles.add(hash); 20101 return; 20102 } 20103 const style = targetDocument.createElement("style"); 20104 style.setAttribute(STYLE_HASH_ATTRIBUTE30, hash); 20105 style.appendChild(targetDocument.createTextNode(css)); 20106 targetDocument.head.appendChild(style); 20107 injectedStyles.add(hash); 20108 } 20109 function registerDocument30(targetDocument) { 20110 const runtime = getRuntime30(); 20111 runtime.documents.set( 20112 targetDocument, 20113 (runtime.documents.get(targetDocument) ?? 0) + 1 20114 ); 20115 for (const [hash, css] of runtime.styles) { 20116 injectStyle30(targetDocument, hash, css); 20117 } 20118 return () => { 20119 const count = runtime.documents.get(targetDocument); 20120 if (count === void 0) { 20121 return; 20122 } 20123 if (count <= 1) { 20124 runtime.documents.delete(targetDocument); 20125 return; 20126 } 20127 runtime.documents.set(targetDocument, count - 1); 20128 }; 20129 } 20130 function registerStyle30(hash, css) { 20131 const runtime = getRuntime30(); 20132 runtime.styles.set(hash, css); 20133 for (const targetDocument of runtime.documents.keys()) { 20134 injectStyle30(targetDocument, hash, css); 20135 } 20136 } 20137 if (typeof process === "undefined" || true) { 20138 registerStyle30("6d6361d221", '@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;@layer wp-ui-components{.a23e08e65c8e62e5__root{text-wrap:balance;align-items:center;color:var(--wpds-color-fg-content-neutral,#1e1e1e);display:flex;flex-direction:column;font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);gap:var(--wpds-dimension-gap-xs,4px);max-width:var(--wpds-dimension-surface-width-sm,320px);text-align:center}._01303b3680eaa216__visual{align-items:center;color:var(--wpds-color-fg-content-neutral-weak,#707070);display:flex;justify-content:center;line-height:1;margin-block-end:var(--wpds-dimension-gap-xs,4px)}._58c8e351db225608__icon{background-color:var(--wpds-color-bg-surface-neutral-weak,#f4f4f4);border:1px solid var(--wpds-color-stroke-surface-neutral-weak,#e4e4e4);border-radius:50%;padding:var(--wpds-dimension-padding-xs,4px)}.b8b96f70820333a1__title{margin:0}._70f1dd22bad55b18__description{color:var(--wpds-color-fg-content-neutral-weak,#707070);margin:0}._89ac025fd8e2bc52__actions{align-items:center;display:flex;flex-direction:column;gap:var(--wpds-dimension-gap-xs,4px);margin-block-start:var(--wpds-dimension-gap-md,12px);@media (min-width:480px){flex-direction:row;justify-content:center}}}'); 20139 } 20140 var style_default30 = { "root": "a23e08e65c8e62e5__root", "visual": "_01303b3680eaa216__visual", "icon": "_58c8e351db225608__icon", "title": "b8b96f70820333a1__title", "description": "_70f1dd22bad55b18__description", "actions": "_89ac025fd8e2bc52__actions" }; 20141 var DEFAULT_TAG2 = /* @__PURE__ */ (0, import_jsx_runtime101.jsx)("h2", {}); 20142 var Title4 = (0, import_element69.forwardRef)( 20143 function EmptyStateTitle({ render: render4 = DEFAULT_TAG2, className, children, ...props }, ref) { 20144 return /* @__PURE__ */ (0, import_jsx_runtime101.jsx)( 20145 Text, 20146 { 20147 ref, 20148 variant: "heading-lg", 20149 render: render4, 20150 className: clsx_default(style_default30.title, className), 20151 ...props, 20152 children 20153 } 20154 ); 20155 } 20156 ); 20157 20158 // packages/ui/build-module/empty-state/description.mjs 20159 var import_element70 = __toESM(require_element(), 1); 20160 var import_jsx_runtime102 = __toESM(require_jsx_runtime(), 1); 20161 var STYLE_HASH_ATTRIBUTE31 = "data-wp-hash"; 20162 function getRuntime31() { 20163 const globalScope = globalThis; 20164 if (globalScope.__wpStyleRuntime) { 20165 return globalScope.__wpStyleRuntime; 20166 } 20167 globalScope.__wpStyleRuntime = { 20168 documents: /* @__PURE__ */ new Map(), 20169 styles: /* @__PURE__ */ new Map(), 20170 injectedStyles: /* @__PURE__ */ new WeakMap() 20171 }; 20172 if (typeof document !== "undefined") { 20173 registerDocument31(document); 20174 } 20175 return globalScope.__wpStyleRuntime; 20176 } 20177 function documentContainsStyleHash31(targetDocument, hash) { 20178 if (!targetDocument.head) { 20179 return false; 20180 } 20181 for (const style of targetDocument.head.querySelectorAll( 20182 `style[$STYLE_HASH_ATTRIBUTE31}]` 20183 )) { 20184 if (style.getAttribute(STYLE_HASH_ATTRIBUTE31) === hash) { 20185 return true; 20186 } 20187 } 20188 return false; 20189 } 20190 function injectStyle31(targetDocument, hash, css) { 20191 if (!targetDocument.head) { 20192 return; 20193 } 20194 const runtime = getRuntime31(); 20195 let injectedStyles = runtime.injectedStyles.get(targetDocument); 20196 if (!injectedStyles) { 20197 injectedStyles = /* @__PURE__ */ new Set(); 20198 runtime.injectedStyles.set(targetDocument, injectedStyles); 20199 } 20200 if (injectedStyles.has(hash)) { 20201 return; 20202 } 20203 if (documentContainsStyleHash31(targetDocument, hash)) { 20204 injectedStyles.add(hash); 20205 return; 20206 } 20207 const style = targetDocument.createElement("style"); 20208 style.setAttribute(STYLE_HASH_ATTRIBUTE31, hash); 20209 style.appendChild(targetDocument.createTextNode(css)); 20210 targetDocument.head.appendChild(style); 20211 injectedStyles.add(hash); 20212 } 20213 function registerDocument31(targetDocument) { 20214 const runtime = getRuntime31(); 20215 runtime.documents.set( 20216 targetDocument, 20217 (runtime.documents.get(targetDocument) ?? 0) + 1 20218 ); 20219 for (const [hash, css] of runtime.styles) { 20220 injectStyle31(targetDocument, hash, css); 20221 } 20222 return () => { 20223 const count = runtime.documents.get(targetDocument); 20224 if (count === void 0) { 20225 return; 20226 } 20227 if (count <= 1) { 20228 runtime.documents.delete(targetDocument); 20229 return; 20230 } 20231 runtime.documents.set(targetDocument, count - 1); 20232 }; 20233 } 20234 function registerStyle31(hash, css) { 20235 const runtime = getRuntime31(); 20236 runtime.styles.set(hash, css); 20237 for (const targetDocument of runtime.documents.keys()) { 20238 injectStyle31(targetDocument, hash, css); 20239 } 20240 } 20241 if (typeof process === "undefined" || true) { 20242 registerStyle31("6d6361d221", '@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;@layer wp-ui-components{.a23e08e65c8e62e5__root{text-wrap:balance;align-items:center;color:var(--wpds-color-fg-content-neutral,#1e1e1e);display:flex;flex-direction:column;font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);gap:var(--wpds-dimension-gap-xs,4px);max-width:var(--wpds-dimension-surface-width-sm,320px);text-align:center}._01303b3680eaa216__visual{align-items:center;color:var(--wpds-color-fg-content-neutral-weak,#707070);display:flex;justify-content:center;line-height:1;margin-block-end:var(--wpds-dimension-gap-xs,4px)}._58c8e351db225608__icon{background-color:var(--wpds-color-bg-surface-neutral-weak,#f4f4f4);border:1px solid var(--wpds-color-stroke-surface-neutral-weak,#e4e4e4);border-radius:50%;padding:var(--wpds-dimension-padding-xs,4px)}.b8b96f70820333a1__title{margin:0}._70f1dd22bad55b18__description{color:var(--wpds-color-fg-content-neutral-weak,#707070);margin:0}._89ac025fd8e2bc52__actions{align-items:center;display:flex;flex-direction:column;gap:var(--wpds-dimension-gap-xs,4px);margin-block-start:var(--wpds-dimension-gap-md,12px);@media (min-width:480px){flex-direction:row;justify-content:center}}}'); 20243 } 20244 var style_default31 = { "root": "a23e08e65c8e62e5__root", "visual": "_01303b3680eaa216__visual", "icon": "_58c8e351db225608__icon", "title": "b8b96f70820333a1__title", "description": "_70f1dd22bad55b18__description", "actions": "_89ac025fd8e2bc52__actions" }; 20245 var DEFAULT_TAG3 = /* @__PURE__ */ (0, import_jsx_runtime102.jsx)("p", {}); 20246 var Description3 = (0, import_element70.forwardRef)(function EmptyStateDescription({ render: render4 = DEFAULT_TAG3, className, children, ...props }, ref) { 20247 return /* @__PURE__ */ (0, import_jsx_runtime102.jsx)( 20248 Text, 20249 { 20250 ref, 20251 variant: "body-md", 20252 render: render4, 20253 className: clsx_default(style_default31.description, className), 20254 ...props, 20255 children 20256 } 20257 ); 20258 }); 20259 20260 // packages/ui/build-module/empty-state/actions.mjs 20261 var import_element71 = __toESM(require_element(), 1); 20262 var STYLE_HASH_ATTRIBUTE32 = "data-wp-hash"; 20263 function getRuntime32() { 20264 const globalScope = globalThis; 20265 if (globalScope.__wpStyleRuntime) { 20266 return globalScope.__wpStyleRuntime; 20267 } 20268 globalScope.__wpStyleRuntime = { 20269 documents: /* @__PURE__ */ new Map(), 20270 styles: /* @__PURE__ */ new Map(), 20271 injectedStyles: /* @__PURE__ */ new WeakMap() 20272 }; 20273 if (typeof document !== "undefined") { 20274 registerDocument32(document); 20275 } 20276 return globalScope.__wpStyleRuntime; 20277 } 20278 function documentContainsStyleHash32(targetDocument, hash) { 20279 if (!targetDocument.head) { 20280 return false; 20281 } 20282 for (const style of targetDocument.head.querySelectorAll( 20283 `style[$STYLE_HASH_ATTRIBUTE32}]` 20284 )) { 20285 if (style.getAttribute(STYLE_HASH_ATTRIBUTE32) === hash) { 20286 return true; 20287 } 20288 } 20289 return false; 20290 } 20291 function injectStyle32(targetDocument, hash, css) { 20292 if (!targetDocument.head) { 20293 return; 20294 } 20295 const runtime = getRuntime32(); 20296 let injectedStyles = runtime.injectedStyles.get(targetDocument); 20297 if (!injectedStyles) { 20298 injectedStyles = /* @__PURE__ */ new Set(); 20299 runtime.injectedStyles.set(targetDocument, injectedStyles); 20300 } 20301 if (injectedStyles.has(hash)) { 20302 return; 20303 } 20304 if (documentContainsStyleHash32(targetDocument, hash)) { 20305 injectedStyles.add(hash); 20306 return; 20307 } 20308 const style = targetDocument.createElement("style"); 20309 style.setAttribute(STYLE_HASH_ATTRIBUTE32, hash); 20310 style.appendChild(targetDocument.createTextNode(css)); 20311 targetDocument.head.appendChild(style); 20312 injectedStyles.add(hash); 20313 } 20314 function registerDocument32(targetDocument) { 20315 const runtime = getRuntime32(); 20316 runtime.documents.set( 20317 targetDocument, 20318 (runtime.documents.get(targetDocument) ?? 0) + 1 20319 ); 20320 for (const [hash, css] of runtime.styles) { 20321 injectStyle32(targetDocument, hash, css); 20322 } 20323 return () => { 20324 const count = runtime.documents.get(targetDocument); 20325 if (count === void 0) { 20326 return; 20327 } 20328 if (count <= 1) { 20329 runtime.documents.delete(targetDocument); 20330 return; 20331 } 20332 runtime.documents.set(targetDocument, count - 1); 20333 }; 20334 } 20335 function registerStyle32(hash, css) { 20336 const runtime = getRuntime32(); 20337 runtime.styles.set(hash, css); 20338 for (const targetDocument of runtime.documents.keys()) { 20339 injectStyle32(targetDocument, hash, css); 20340 } 20341 } 20342 if (typeof process === "undefined" || true) { 20343 registerStyle32("6d6361d221", '@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;@layer wp-ui-components{.a23e08e65c8e62e5__root{text-wrap:balance;align-items:center;color:var(--wpds-color-fg-content-neutral,#1e1e1e);display:flex;flex-direction:column;font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);gap:var(--wpds-dimension-gap-xs,4px);max-width:var(--wpds-dimension-surface-width-sm,320px);text-align:center}._01303b3680eaa216__visual{align-items:center;color:var(--wpds-color-fg-content-neutral-weak,#707070);display:flex;justify-content:center;line-height:1;margin-block-end:var(--wpds-dimension-gap-xs,4px)}._58c8e351db225608__icon{background-color:var(--wpds-color-bg-surface-neutral-weak,#f4f4f4);border:1px solid var(--wpds-color-stroke-surface-neutral-weak,#e4e4e4);border-radius:50%;padding:var(--wpds-dimension-padding-xs,4px)}.b8b96f70820333a1__title{margin:0}._70f1dd22bad55b18__description{color:var(--wpds-color-fg-content-neutral-weak,#707070);margin:0}._89ac025fd8e2bc52__actions{align-items:center;display:flex;flex-direction:column;gap:var(--wpds-dimension-gap-xs,4px);margin-block-start:var(--wpds-dimension-gap-md,12px);@media (min-width:480px){flex-direction:row;justify-content:center}}}'); 20344 } 20345 var style_default32 = { "root": "a23e08e65c8e62e5__root", "visual": "_01303b3680eaa216__visual", "icon": "_58c8e351db225608__icon", "title": "b8b96f70820333a1__title", "description": "_70f1dd22bad55b18__description", "actions": "_89ac025fd8e2bc52__actions" }; 20346 var Actions = (0, import_element71.forwardRef)( 20347 function EmptyStateActions({ render: render4, ...props }, ref) { 20348 const className = clsx_default(style_default32.actions); 20349 const element = useRender({ 20350 defaultTagName: "div", 20351 render: render4, 20352 ref, 20353 props: mergeProps({ className }, props) 20354 }); 20355 return element; 20356 } 20357 ); 20358 20359 // packages/ui/build-module/visually-hidden/visually-hidden.mjs 20360 var import_element72 = __toESM(require_element(), 1); 20361 var STYLE_HASH_ATTRIBUTE33 = "data-wp-hash"; 20362 function getRuntime33() { 20363 const globalScope = globalThis; 20364 if (globalScope.__wpStyleRuntime) { 20365 return globalScope.__wpStyleRuntime; 20366 } 20367 globalScope.__wpStyleRuntime = { 20368 documents: /* @__PURE__ */ new Map(), 20369 styles: /* @__PURE__ */ new Map(), 20370 injectedStyles: /* @__PURE__ */ new WeakMap() 20371 }; 20372 if (typeof document !== "undefined") { 20373 registerDocument33(document); 20374 } 20375 return globalScope.__wpStyleRuntime; 20376 } 20377 function documentContainsStyleHash33(targetDocument, hash) { 20378 if (!targetDocument.head) { 20379 return false; 20380 } 20381 for (const style of targetDocument.head.querySelectorAll( 20382 `style[$STYLE_HASH_ATTRIBUTE33}]` 20383 )) { 20384 if (style.getAttribute(STYLE_HASH_ATTRIBUTE33) === hash) { 20385 return true; 20386 } 20387 } 20388 return false; 20389 } 20390 function injectStyle33(targetDocument, hash, css) { 20391 if (!targetDocument.head) { 20392 return; 20393 } 20394 const runtime = getRuntime33(); 20395 let injectedStyles = runtime.injectedStyles.get(targetDocument); 20396 if (!injectedStyles) { 20397 injectedStyles = /* @__PURE__ */ new Set(); 20398 runtime.injectedStyles.set(targetDocument, injectedStyles); 20399 } 20400 if (injectedStyles.has(hash)) { 20401 return; 20402 } 20403 if (documentContainsStyleHash33(targetDocument, hash)) { 20404 injectedStyles.add(hash); 20405 return; 20406 } 20407 const style = targetDocument.createElement("style"); 20408 style.setAttribute(STYLE_HASH_ATTRIBUTE33, hash); 20409 style.appendChild(targetDocument.createTextNode(css)); 20410 targetDocument.head.appendChild(style); 20411 injectedStyles.add(hash); 20412 } 20413 function registerDocument33(targetDocument) { 20414 const runtime = getRuntime33(); 20415 runtime.documents.set( 20416 targetDocument, 20417 (runtime.documents.get(targetDocument) ?? 0) + 1 20418 ); 20419 for (const [hash, css] of runtime.styles) { 20420 injectStyle33(targetDocument, hash, css); 20421 } 20422 return () => { 20423 const count = runtime.documents.get(targetDocument); 20424 if (count === void 0) { 20425 return; 20426 } 20427 if (count <= 1) { 20428 runtime.documents.delete(targetDocument); 20429 return; 20430 } 20431 runtime.documents.set(targetDocument, count - 1); 20432 }; 20433 } 20434 function registerStyle33(hash, css) { 20435 const runtime = getRuntime33(); 20436 runtime.styles.set(hash, css); 20437 for (const targetDocument of runtime.documents.keys()) { 20438 injectStyle33(targetDocument, hash, css); 20439 } 20440 } 20441 if (typeof process === "undefined" || true) { 20442 registerStyle33("c46e8cb841", "@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;@layer wp-ui-components{.f37b9e2e191ebd66__visually-hidden{word-wrap:normal;border:0;clip-path:inset(50%);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;word-break:normal}}"); 20443 } 20444 var style_default33 = { "visually-hidden": "f37b9e2e191ebd66__visually-hidden" }; 20445 var VisuallyHidden = (0, import_element72.forwardRef)( 20446 function VisuallyHidden2({ render: render4, ...restProps }, ref) { 20447 const element = useRender({ 20448 render: render4, 20449 ref, 20450 props: mergeProps( 20451 { className: style_default33["visually-hidden"] }, 20452 restProps, 20453 { 20454 // @ts-expect-error Arbitrary data-* attributes aren't indexable on the typed div props. Kept hardcoded so consumers can't change or remove it. 20455 "data-visually-hidden": "" 20456 } 20457 ) 20458 }); 20459 return element; 20460 } 20461 ); 20462 20463 // packages/ui/build-module/form/primitives/fieldset/index.mjs 20464 var fieldset_exports = {}; 20465 __export(fieldset_exports, { 20466 Description: () => FieldsetDescription, 20467 Details: () => FieldsetDetails, 20468 Legend: () => FieldsetLegend3, 20469 Root: () => FieldsetRoot3 20470 }); 20471 20472 // packages/ui/build-module/form/primitives/fieldset/root.mjs 20473 var import_element74 = __toESM(require_element(), 1); 20474 20475 // packages/ui/build-module/form/primitives/fieldset/context.mjs 20476 var import_element73 = __toESM(require_element(), 1); 20477 var FieldsetContext = (0, import_element73.createContext)({ 20478 registerDescriptionId: () => { 20479 }, 20480 unregisterDescriptionId: () => { 20481 } 20482 }); 20483 var useFieldsetContext = () => (0, import_element73.useContext)(FieldsetContext); 20484 20485 // packages/ui/build-module/form/primitives/fieldset/root.mjs 20486 var import_jsx_runtime103 = __toESM(require_jsx_runtime(), 1); 20487 var STYLE_HASH_ATTRIBUTE34 = "data-wp-hash"; 20488 function getRuntime34() { 20489 const globalScope = globalThis; 20490 if (globalScope.__wpStyleRuntime) { 20491 return globalScope.__wpStyleRuntime; 20492 } 20493 globalScope.__wpStyleRuntime = { 20494 documents: /* @__PURE__ */ new Map(), 20495 styles: /* @__PURE__ */ new Map(), 20496 injectedStyles: /* @__PURE__ */ new WeakMap() 20497 }; 20498 if (typeof document !== "undefined") { 20499 registerDocument34(document); 20500 } 20501 return globalScope.__wpStyleRuntime; 20502 } 20503 function documentContainsStyleHash34(targetDocument, hash) { 20504 if (!targetDocument.head) { 20505 return false; 20506 } 20507 for (const style of targetDocument.head.querySelectorAll( 20508 `style[$STYLE_HASH_ATTRIBUTE34}]` 20509 )) { 20510 if (style.getAttribute(STYLE_HASH_ATTRIBUTE34) === hash) { 20511 return true; 20512 } 20513 } 20514 return false; 20515 } 20516 function injectStyle34(targetDocument, hash, css) { 20517 if (!targetDocument.head) { 20518 return; 20519 } 20520 const runtime = getRuntime34(); 20521 let injectedStyles = runtime.injectedStyles.get(targetDocument); 20522 if (!injectedStyles) { 20523 injectedStyles = /* @__PURE__ */ new Set(); 20524 runtime.injectedStyles.set(targetDocument, injectedStyles); 20525 } 20526 if (injectedStyles.has(hash)) { 20527 return; 20528 } 20529 if (documentContainsStyleHash34(targetDocument, hash)) { 20530 injectedStyles.add(hash); 20531 return; 20532 } 20533 const style = targetDocument.createElement("style"); 20534 style.setAttribute(STYLE_HASH_ATTRIBUTE34, hash); 20535 style.appendChild(targetDocument.createTextNode(css)); 20536 targetDocument.head.appendChild(style); 20537 injectedStyles.add(hash); 20538 } 20539 function registerDocument34(targetDocument) { 20540 const runtime = getRuntime34(); 20541 runtime.documents.set( 20542 targetDocument, 20543 (runtime.documents.get(targetDocument) ?? 0) + 1 20544 ); 20545 for (const [hash, css] of runtime.styles) { 20546 injectStyle34(targetDocument, hash, css); 20547 } 20548 return () => { 20549 const count = runtime.documents.get(targetDocument); 20550 if (count === void 0) { 20551 return; 20552 } 20553 if (count <= 1) { 20554 runtime.documents.delete(targetDocument); 20555 return; 20556 } 20557 runtime.documents.set(targetDocument, count - 1); 20558 }; 20559 } 20560 function registerStyle34(hash, css) { 20561 const runtime = getRuntime34(); 20562 runtime.styles.set(hash, css); 20563 for (const targetDocument of runtime.documents.keys()) { 20564 injectStyle34(targetDocument, hash, css); 20565 } 20566 } 20567 if (typeof process === "undefined" || true) { 20568 registerStyle34("5c78160068", "@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;@layer wp-ui-components{.a946d12d3d763c87__root{border:0;display:flex;flex-direction:column;gap:var(--wpds-dimension-gap-xs,4px);margin:0;padding:0}}"); 20569 } 20570 var style_default34 = { "root": "a946d12d3d763c87__root" }; 20571 var FieldsetRoot3 = (0, import_element74.forwardRef)(function FieldsetRoot22({ className, children, ...restProps }, ref) { 20572 const [descriptionId, setDescriptionId] = (0, import_element74.useState)(); 20573 const contextValue = (0, import_element74.useMemo)( 20574 () => ({ 20575 registerDescriptionId: (id) => setDescriptionId(id), 20576 unregisterDescriptionId: () => setDescriptionId(void 0) 20577 }), 20578 [] 20579 ); 20580 return /* @__PURE__ */ (0, import_jsx_runtime103.jsx)(FieldsetContext.Provider, { value: contextValue, children: /* @__PURE__ */ (0, import_jsx_runtime103.jsx)( 20581 index_parts_exports5.Root, 20582 { 20583 ref, 20584 className: clsx_default(style_default34.root, className), 20585 "aria-describedby": descriptionId, 20586 ...restProps, 20587 children 20588 } 20589 ) }); 20590 }); 20591 20592 // packages/ui/build-module/form/primitives/fieldset/legend.mjs 20593 var import_element75 = __toESM(require_element(), 1); 20594 var import_jsx_runtime104 = __toESM(require_jsx_runtime(), 1); 20595 var STYLE_HASH_ATTRIBUTE35 = "data-wp-hash"; 20596 function getRuntime35() { 20597 const globalScope = globalThis; 20598 if (globalScope.__wpStyleRuntime) { 20599 return globalScope.__wpStyleRuntime; 20600 } 20601 globalScope.__wpStyleRuntime = { 20602 documents: /* @__PURE__ */ new Map(), 20603 styles: /* @__PURE__ */ new Map(), 20604 injectedStyles: /* @__PURE__ */ new WeakMap() 20605 }; 20606 if (typeof document !== "undefined") { 20607 registerDocument35(document); 20608 } 20609 return globalScope.__wpStyleRuntime; 20610 } 20611 function documentContainsStyleHash35(targetDocument, hash) { 20612 if (!targetDocument.head) { 20613 return false; 20614 } 20615 for (const style of targetDocument.head.querySelectorAll( 20616 `style[$STYLE_HASH_ATTRIBUTE35}]` 20617 )) { 20618 if (style.getAttribute(STYLE_HASH_ATTRIBUTE35) === hash) { 20619 return true; 20620 } 20621 } 20622 return false; 20623 } 20624 function injectStyle35(targetDocument, hash, css) { 20625 if (!targetDocument.head) { 20626 return; 20627 } 20628 const runtime = getRuntime35(); 20629 let injectedStyles = runtime.injectedStyles.get(targetDocument); 20630 if (!injectedStyles) { 20631 injectedStyles = /* @__PURE__ */ new Set(); 20632 runtime.injectedStyles.set(targetDocument, injectedStyles); 20633 } 20634 if (injectedStyles.has(hash)) { 20635 return; 20636 } 20637 if (documentContainsStyleHash35(targetDocument, hash)) { 20638 injectedStyles.add(hash); 20639 return; 20640 } 20641 const style = targetDocument.createElement("style"); 20642 style.setAttribute(STYLE_HASH_ATTRIBUTE35, hash); 20643 style.appendChild(targetDocument.createTextNode(css)); 20644 targetDocument.head.appendChild(style); 20645 injectedStyles.add(hash); 20646 } 20647 function registerDocument35(targetDocument) { 20648 const runtime = getRuntime35(); 20649 runtime.documents.set( 20650 targetDocument, 20651 (runtime.documents.get(targetDocument) ?? 0) + 1 20652 ); 20653 for (const [hash, css] of runtime.styles) { 20654 injectStyle35(targetDocument, hash, css); 20655 } 20656 return () => { 20657 const count = runtime.documents.get(targetDocument); 20658 if (count === void 0) { 20659 return; 20660 } 20661 if (count <= 1) { 20662 runtime.documents.delete(targetDocument); 20663 return; 20664 } 20665 runtime.documents.set(targetDocument, count - 1); 20666 }; 20667 } 20668 function registerStyle35(hash, css) { 20669 const runtime = getRuntime35(); 20670 runtime.styles.set(hash, css); 20671 for (const targetDocument of runtime.documents.keys()) { 20672 injectStyle35(targetDocument, hash, css); 20673 } 20674 } 20675 if (typeof process === "undefined" || true) { 20676 registerStyle35("f9ecc2af7d", '@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;@layer wp-ui-utilities{._2d5ad850b2f90964__label{--wp-ui-field-label-line-height:var(--wpds-typography-line-height-xs,16px);color:var(--wpds-color-fg-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-medium,499);line-height:var(--wp-ui-field-label-line-height);text-transform:uppercase;&._17c4214649230bea__is-plain{font-size:var(--wpds-typography-font-size-md,13px);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;color:var(--wpds-color-fg-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)}}'); 20677 } 20678 var field_default = { "label": "_2d5ad850b2f90964__label", "is-plain": "_17c4214649230bea__is-plain", "description": "_08a3750500e0233f__description" }; 20679 var FieldsetLegend3 = (0, import_element75.forwardRef)( 20680 function FieldsetLegend22({ className, hideFromVision, ...restProps }, ref) { 20681 const legend = /* @__PURE__ */ (0, import_jsx_runtime104.jsx)( 20682 index_parts_exports5.Legend, 20683 { 20684 ref, 20685 className: clsx_default(field_default.label, className), 20686 ...restProps 20687 } 20688 ); 20689 if (hideFromVision) { 20690 return /* @__PURE__ */ (0, import_jsx_runtime104.jsx)(VisuallyHidden, { render: legend }); 20691 } 20692 return legend; 20693 } 20694 ); 20695 20696 // packages/ui/build-module/form/primitives/fieldset/description.mjs 20697 var import_element76 = __toESM(require_element(), 1); 20698 var STYLE_HASH_ATTRIBUTE36 = "data-wp-hash"; 20699 function getRuntime36() { 20700 const globalScope = globalThis; 20701 if (globalScope.__wpStyleRuntime) { 20702 return globalScope.__wpStyleRuntime; 20703 } 20704 globalScope.__wpStyleRuntime = { 20705 documents: /* @__PURE__ */ new Map(), 20706 styles: /* @__PURE__ */ new Map(), 20707 injectedStyles: /* @__PURE__ */ new WeakMap() 20708 }; 20709 if (typeof document !== "undefined") { 20710 registerDocument36(document); 20711 } 20712 return globalScope.__wpStyleRuntime; 20713 } 20714 function documentContainsStyleHash36(targetDocument, hash) { 20715 if (!targetDocument.head) { 20716 return false; 20717 } 20718 for (const style of targetDocument.head.querySelectorAll( 20719 `style[$STYLE_HASH_ATTRIBUTE36}]` 20720 )) { 20721 if (style.getAttribute(STYLE_HASH_ATTRIBUTE36) === hash) { 20722 return true; 20723 } 20724 } 20725 return false; 20726 } 20727 function injectStyle36(targetDocument, hash, css) { 20728 if (!targetDocument.head) { 20729 return; 20730 } 20731 const runtime = getRuntime36(); 20732 let injectedStyles = runtime.injectedStyles.get(targetDocument); 20733 if (!injectedStyles) { 20734 injectedStyles = /* @__PURE__ */ new Set(); 20735 runtime.injectedStyles.set(targetDocument, injectedStyles); 20736 } 20737 if (injectedStyles.has(hash)) { 20738 return; 20739 } 20740 if (documentContainsStyleHash36(targetDocument, hash)) { 20741 injectedStyles.add(hash); 20742 return; 20743 } 20744 const style = targetDocument.createElement("style"); 20745 style.setAttribute(STYLE_HASH_ATTRIBUTE36, hash); 20746 style.appendChild(targetDocument.createTextNode(css)); 20747 targetDocument.head.appendChild(style); 20748 injectedStyles.add(hash); 20749 } 20750 function registerDocument36(targetDocument) { 20751 const runtime = getRuntime36(); 20752 runtime.documents.set( 20753 targetDocument, 20754 (runtime.documents.get(targetDocument) ?? 0) + 1 20755 ); 20756 for (const [hash, css] of runtime.styles) { 20757 injectStyle36(targetDocument, hash, css); 20758 } 20759 return () => { 20760 const count = runtime.documents.get(targetDocument); 20761 if (count === void 0) { 20762 return; 20763 } 20764 if (count <= 1) { 20765 runtime.documents.delete(targetDocument); 20766 return; 20767 } 20768 runtime.documents.set(targetDocument, count - 1); 20769 }; 20770 } 20771 function registerStyle36(hash, css) { 20772 const runtime = getRuntime36(); 20773 runtime.styles.set(hash, css); 20774 for (const targetDocument of runtime.documents.keys()) { 20775 injectStyle36(targetDocument, hash, css); 20776 } 20777 } 20778 if (typeof process === "undefined" || true) { 20779 registerStyle36("1fb29d3a3c", "._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);&: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,#0000);border:var(--_gcd-input-border,none);border-radius:var(--_gcd-input-border-radius,0);box-shadow:var(--_gcd-input-box-shadow,0 0 0 #0000);color:var(--_gcd-input-color,var(--wpds-color-fg-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,#0000);border-color:var(--_gcd-input-border-color-disabled,#0000);box-shadow:var(--_gcd-input-box-shadow-disabled,none);color:var(--_gcd-input-color-disabled,var(--wpds-color-fg-interactive-neutral-disabled,#8d8d8d))}&::placeholder{color:var(--_gcd-input-placeholder-color,var(--wpds-color-fg-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 #0000)}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-fg-content-neutral,#1e1e1e));font-size:var(--_gcd-heading-font-size,inherit);font-weight:var(--_gcd-heading-font-weight,var(--wpds-typography-font-weight-medium,499));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 #0000);transition:var(--_gcd-a-transition,none)}"); 20780 } 20781 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" }; 20782 if (typeof process === "undefined" || true) { 20783 registerStyle36("f9ecc2af7d", '@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;@layer wp-ui-utilities{._2d5ad850b2f90964__label{--wp-ui-field-label-line-height:var(--wpds-typography-line-height-xs,16px);color:var(--wpds-color-fg-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-medium,499);line-height:var(--wp-ui-field-label-line-height);text-transform:uppercase;&._17c4214649230bea__is-plain{font-size:var(--wpds-typography-font-size-md,13px);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;color:var(--wpds-color-fg-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)}}'); 20784 } 20785 var field_default2 = { "label": "_2d5ad850b2f90964__label", "is-plain": "_17c4214649230bea__is-plain", "description": "_08a3750500e0233f__description" }; 20786 var FieldsetDescription = (0, import_element76.forwardRef)(function FieldsetDescription2({ className, id: idProp, render: render4, ...restProps }, ref) { 20787 const generatedId = (0, import_element76.useId)(); 20788 const id = idProp ?? generatedId; 20789 const { registerDescriptionId, unregisterDescriptionId } = useFieldsetContext(); 20790 (0, import_element76.useEffect)(() => { 20791 registerDescriptionId(id); 20792 return unregisterDescriptionId; 20793 }, [registerDescriptionId, unregisterDescriptionId, id]); 20794 const element = useRender({ 20795 defaultTagName: "p", 20796 render: render4, 20797 ref, 20798 props: mergeProps( 20799 { 20800 className: clsx_default( 20801 global_css_defense_default4.p, 20802 field_default2.description, 20803 className 20804 ), 20805 id 20806 }, 20807 restProps 20808 ) 20809 }); 20810 return element; 20811 }); 20812 20813 // packages/ui/build-module/form/primitives/fieldset/details.mjs 20814 var import_element77 = __toESM(require_element(), 1); 20815 var import_i18n5 = __toESM(require_i18n(), 1); 20816 var import_jsx_runtime105 = __toESM(require_jsx_runtime(), 1); 20817 var STYLE_HASH_ATTRIBUTE37 = "data-wp-hash"; 20818 function getRuntime37() { 20819 const globalScope = globalThis; 20820 if (globalScope.__wpStyleRuntime) { 20821 return globalScope.__wpStyleRuntime; 20822 } 20823 globalScope.__wpStyleRuntime = { 20824 documents: /* @__PURE__ */ new Map(), 20825 styles: /* @__PURE__ */ new Map(), 20826 injectedStyles: /* @__PURE__ */ new WeakMap() 20827 }; 20828 if (typeof document !== "undefined") { 20829 registerDocument37(document); 20830 } 20831 return globalScope.__wpStyleRuntime; 20832 } 20833 function documentContainsStyleHash37(targetDocument, hash) { 20834 if (!targetDocument.head) { 20835 return false; 20836 } 20837 for (const style of targetDocument.head.querySelectorAll( 20838 `style[$STYLE_HASH_ATTRIBUTE37}]` 20839 )) { 20840 if (style.getAttribute(STYLE_HASH_ATTRIBUTE37) === hash) { 20841 return true; 20842 } 20843 } 20844 return false; 20845 } 20846 function injectStyle37(targetDocument, hash, css) { 20847 if (!targetDocument.head) { 20848 return; 20849 } 20850 const runtime = getRuntime37(); 20851 let injectedStyles = runtime.injectedStyles.get(targetDocument); 20852 if (!injectedStyles) { 20853 injectedStyles = /* @__PURE__ */ new Set(); 20854 runtime.injectedStyles.set(targetDocument, injectedStyles); 20855 } 20856 if (injectedStyles.has(hash)) { 20857 return; 20858 } 20859 if (documentContainsStyleHash37(targetDocument, hash)) { 20860 injectedStyles.add(hash); 20861 return; 20862 } 20863 const style = targetDocument.createElement("style"); 20864 style.setAttribute(STYLE_HASH_ATTRIBUTE37, hash); 20865 style.appendChild(targetDocument.createTextNode(css)); 20866 targetDocument.head.appendChild(style); 20867 injectedStyles.add(hash); 20868 } 20869 function registerDocument37(targetDocument) { 20870 const runtime = getRuntime37(); 20871 runtime.documents.set( 20872 targetDocument, 20873 (runtime.documents.get(targetDocument) ?? 0) + 1 20874 ); 20875 for (const [hash, css] of runtime.styles) { 20876 injectStyle37(targetDocument, hash, css); 20877 } 20878 return () => { 20879 const count = runtime.documents.get(targetDocument); 20880 if (count === void 0) { 20881 return; 20882 } 20883 if (count <= 1) { 20884 runtime.documents.delete(targetDocument); 20885 return; 20886 } 20887 runtime.documents.set(targetDocument, count - 1); 20888 }; 20889 } 20890 function registerStyle37(hash, css) { 20891 const runtime = getRuntime37(); 20892 runtime.styles.set(hash, css); 20893 for (const targetDocument of runtime.documents.keys()) { 20894 injectStyle37(targetDocument, hash, css); 20895 } 20896 } 20897 if (typeof process === "undefined" || true) { 20898 registerStyle37("f9ecc2af7d", '@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;@layer wp-ui-utilities{._2d5ad850b2f90964__label{--wp-ui-field-label-line-height:var(--wpds-typography-line-height-xs,16px);color:var(--wpds-color-fg-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-medium,499);line-height:var(--wp-ui-field-label-line-height);text-transform:uppercase;&._17c4214649230bea__is-plain{font-size:var(--wpds-typography-font-size-md,13px);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;color:var(--wpds-color-fg-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)}}'); 20899 } 20900 var field_default3 = { "label": "_2d5ad850b2f90964__label", "is-plain": "_17c4214649230bea__is-plain", "description": "_08a3750500e0233f__description" }; 20901 var FieldsetDetails = (0, import_element77.forwardRef)(function FieldsetDetails2({ className, ...restProps }, ref) { 20902 const id = (0, import_element77.useId)(); 20903 const { registerDescriptionId, unregisterDescriptionId } = useFieldsetContext(); 20904 (0, import_element77.useEffect)(() => { 20905 registerDescriptionId(id); 20906 return unregisterDescriptionId; 20907 }, [registerDescriptionId, unregisterDescriptionId, id]); 20908 return /* @__PURE__ */ (0, import_jsx_runtime105.jsxs)(import_jsx_runtime105.Fragment, { children: [ 20909 /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(VisuallyHidden, { id, children: (0, import_i18n5.__)("More details follow.") }), 20910 /* @__PURE__ */ (0, import_jsx_runtime105.jsx)( 20911 "div", 20912 { 20913 ref, 20914 className: clsx_default(field_default3.description, className), 20915 ...restProps 20916 } 20917 ) 20918 ] }); 20919 }); 20920 20921 // packages/ui/build-module/link/link.mjs 20922 var import_element78 = __toESM(require_element(), 1); 20923 var import_i18n6 = __toESM(require_i18n(), 1); 20924 var import_jsx_runtime106 = __toESM(require_jsx_runtime(), 1); 20925 var STYLE_HASH_ATTRIBUTE38 = "data-wp-hash"; 20926 function getRuntime38() { 20927 const globalScope = globalThis; 20928 if (globalScope.__wpStyleRuntime) { 20929 return globalScope.__wpStyleRuntime; 20930 } 20931 globalScope.__wpStyleRuntime = { 20932 documents: /* @__PURE__ */ new Map(), 20933 styles: /* @__PURE__ */ new Map(), 20934 injectedStyles: /* @__PURE__ */ new WeakMap() 20935 }; 20936 if (typeof document !== "undefined") { 20937 registerDocument38(document); 20938 } 20939 return globalScope.__wpStyleRuntime; 20940 } 20941 function documentContainsStyleHash38(targetDocument, hash) { 20942 if (!targetDocument.head) { 20943 return false; 20944 } 20945 for (const style of targetDocument.head.querySelectorAll( 20946 `style[$STYLE_HASH_ATTRIBUTE38}]` 20947 )) { 20948 if (style.getAttribute(STYLE_HASH_ATTRIBUTE38) === hash) { 20949 return true; 20950 } 20951 } 20952 return false; 20953 } 20954 function injectStyle38(targetDocument, hash, css) { 20955 if (!targetDocument.head) { 20956 return; 20957 } 20958 const runtime = getRuntime38(); 20959 let injectedStyles = runtime.injectedStyles.get(targetDocument); 20960 if (!injectedStyles) { 20961 injectedStyles = /* @__PURE__ */ new Set(); 20962 runtime.injectedStyles.set(targetDocument, injectedStyles); 20963 } 20964 if (injectedStyles.has(hash)) { 20965 return; 20966 } 20967 if (documentContainsStyleHash38(targetDocument, hash)) { 20968 injectedStyles.add(hash); 20969 return; 20970 } 20971 const style = targetDocument.createElement("style"); 20972 style.setAttribute(STYLE_HASH_ATTRIBUTE38, hash); 20973 style.appendChild(targetDocument.createTextNode(css)); 20974 targetDocument.head.appendChild(style); 20975 injectedStyles.add(hash); 20976 } 20977 function registerDocument38(targetDocument) { 20978 const runtime = getRuntime38(); 20979 runtime.documents.set( 20980 targetDocument, 20981 (runtime.documents.get(targetDocument) ?? 0) + 1 20982 ); 20983 for (const [hash, css] of runtime.styles) { 20984 injectStyle38(targetDocument, hash, css); 20985 } 20986 return () => { 20987 const count = runtime.documents.get(targetDocument); 20988 if (count === void 0) { 20989 return; 20990 } 20991 if (count <= 1) { 20992 runtime.documents.delete(targetDocument); 20993 return; 20994 } 20995 runtime.documents.set(targetDocument, count - 1); 20996 }; 20997 } 20998 function registerStyle38(hash, css) { 20999 const runtime = getRuntime38(); 21000 runtime.styles.set(hash, css); 21001 for (const targetDocument of runtime.documents.keys()) { 21002 injectStyle38(targetDocument, hash, css); 21003 } 21004 } 21005 if (typeof process === "undefined" || true) { 21006 registerStyle38("e3ae230cea", "@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;@layer wp-ui-utilities{._336cd3e4e743482f__box-sizing{box-sizing:border-box;*,:after,:before{box-sizing:inherit}}}"); 21007 } 21008 var resets_default4 = { "box-sizing": "_336cd3e4e743482f__box-sizing" }; 21009 if (typeof process === "undefined" || true) { 21010 registerStyle38("2a5ab8f3a7", "@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;@layer wp-ui-utilities{._08e8a2e44959f892__outset-ring--focus,._970d04df7376df67__outset-ring--focus-within-except-active,.c5cb3ee4bddaa8e4__outset-ring--focus-within-visible,.cd83dfc2126a0846__outset-ring--focus-within,.d0541bc9dd9dc7b6__outset-ring--focus-visible,.e25b2bdd7aa21721__outset-ring--focus-except-active,.ecadb9e080e2dfa5__outset-ring--focus-parent-visible{@media not (prefers-reduced-motion){--_gcd-a-transition:outline 0.1s ease-out;transition:outline .1s ease-out}outline:0 solid #0000;outline-offset:1px}._08e8a2e44959f892__outset-ring--focus:focus,._970d04df7376df67__outset-ring--focus-within-except-active:focus-within:not(:has(:active)),.c5cb3ee4bddaa8e4__outset-ring--focus-within-visible:focus-within:has(:focus-visible),.cd83dfc2126a0846__outset-ring--focus-within:focus-within,.d0541bc9dd9dc7b6__outset-ring--focus-visible:focus-visible,.e25b2bdd7aa21721__outset-ring--focus-except-active:focus:not(:active),:focus-visible .ecadb9e080e2dfa5__outset-ring--focus-parent-visible{--_gcd-a-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--wpds-color-stroke-focus-brand,var(--wp-admin-theme-color,#3858e9));--_gcd-div-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--wpds-color-stroke-focus-brand,var(--wp-admin-theme-color,#3858e9));outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--wpds-color-stroke-focus-brand,var(--wp-admin-theme-color,#3858e9))}}"); 21011 } 21012 var focus_default6 = { "outset-ring--focus": "_08e8a2e44959f892__outset-ring--focus", "outset-ring--focus-except-active": "e25b2bdd7aa21721__outset-ring--focus-except-active", "outset-ring--focus-visible": "d0541bc9dd9dc7b6__outset-ring--focus-visible", "outset-ring--focus-within": "cd83dfc2126a0846__outset-ring--focus-within", "outset-ring--focus-within-except-active": "_970d04df7376df67__outset-ring--focus-within-except-active", "outset-ring--focus-within-visible": "c5cb3ee4bddaa8e4__outset-ring--focus-within-visible", "outset-ring--focus-parent-visible": "ecadb9e080e2dfa5__outset-ring--focus-parent-visible" }; 21013 if (typeof process === "undefined" || true) { 21014 registerStyle38("90a23568f8", '@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;@layer wp-ui-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-fg-interactive-brand,var(--wp-admin-theme-color,#3858e9));color:var(--wpds-color-fg-interactive-brand,var(--wp-admin-theme-color,#3858e9))}.c6055659b8e2cd2c__is-brand:active,.c6055659b8e2cd2c__is-brand:hover{--_gcd-a-color:var(--wpds-color-fg-interactive-brand-active,var(--wp-admin-theme-color,#3858e9));color:var(--wpds-color-fg-interactive-brand-active,var(--wp-admin-theme-color,#3858e9))}._92e0dfcaeee15b88__is-neutral,._92e0dfcaeee15b88__is-neutral:visited{--_gcd-a-color:var(--wpds-color-fg-interactive-neutral,#1e1e1e);color:var(--wpds-color-fg-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-fg-interactive-neutral-active,#1e1e1e);color:var(--wpds-color-fg-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-regular,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"}}'); 21015 } 21016 var style_default35 = { "link": "d4250949359b05ce__link", "is-brand": "c6055659b8e2cd2c__is-brand", "is-neutral": "_92e0dfcaeee15b88__is-neutral", "is-unstyled": "cf122a9bf1035d42__is-unstyled", "link-icon": "_0cb411afac4c86c7__link-icon" }; 21017 if (typeof process === "undefined" || true) { 21018 registerStyle38("1fb29d3a3c", "._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);&: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,#0000);border:var(--_gcd-input-border,none);border-radius:var(--_gcd-input-border-radius,0);box-shadow:var(--_gcd-input-box-shadow,0 0 0 #0000);color:var(--_gcd-input-color,var(--wpds-color-fg-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,#0000);border-color:var(--_gcd-input-border-color-disabled,#0000);box-shadow:var(--_gcd-input-box-shadow-disabled,none);color:var(--_gcd-input-color-disabled,var(--wpds-color-fg-interactive-neutral-disabled,#8d8d8d))}&::placeholder{color:var(--_gcd-input-placeholder-color,var(--wpds-color-fg-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 #0000)}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-fg-content-neutral,#1e1e1e));font-size:var(--_gcd-heading-font-size,inherit);font-weight:var(--_gcd-heading-font-weight,var(--wpds-typography-font-weight-medium,499));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 #0000);transition:var(--_gcd-a-transition,none)}"); 21019 } 21020 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" }; 21021 var Link = (0, import_element78.forwardRef)(function Link2({ 21022 children, 21023 variant = "default", 21024 tone = "brand", 21025 openInNewTab = false, 21026 render: render4, 21027 className, 21028 ...props 21029 }, ref) { 21030 const element = useRender({ 21031 render: render4, 21032 defaultTagName: "a", 21033 ref, 21034 props: mergeProps(props, { 21035 className: clsx_default( 21036 global_css_defense_default5.a, 21037 resets_default4["box-sizing"], 21038 focus_default6["outset-ring--focus"], 21039 variant !== "unstyled" && style_default35.link, 21040 variant !== "unstyled" && style_default35[`is-$tone}`], 21041 variant === "unstyled" && style_default35["is-unstyled"], 21042 className 21043 ), 21044 target: openInNewTab ? "_blank" : void 0, 21045 children: /* @__PURE__ */ (0, import_jsx_runtime106.jsxs)(import_jsx_runtime106.Fragment, { children: [ 21046 children, 21047 openInNewTab && /* @__PURE__ */ (0, import_jsx_runtime106.jsx)( 21048 "span", 21049 { 21050 className: style_default35["link-icon"], 21051 role: "img", 21052 "aria-label": ( 21053 /* translators: accessibility text appended to link text */ 21054 (0, import_i18n6.__)("(opens in a new tab)") 21055 ) 21056 } 21057 ) 21058 ] }) 21059 }) 21060 }); 21061 return element; 21062 }); 21063 21064 // packages/ui/build-module/notice/index.mjs 21065 var notice_exports = {}; 21066 __export(notice_exports, { 21067 ActionButton: () => ActionButton, 21068 ActionLink: () => ActionLink, 21069 Actions: () => Actions2, 21070 CloseIcon: () => CloseIcon3, 21071 Description: () => Description4, 21072 Root: () => Root9, 21073 Title: () => Title5 21074 }); 21075 21076 // packages/ui/build-module/notice/root.mjs 21077 var import_element79 = __toESM(require_element(), 1); 21078 import { speak as speak3 } from "@wordpress/a11y"; 21079 var import_jsx_runtime107 = __toESM(require_jsx_runtime(), 1); 21080 var STYLE_HASH_ATTRIBUTE39 = "data-wp-hash"; 21081 function getRuntime39() { 21082 const globalScope = globalThis; 21083 if (globalScope.__wpStyleRuntime) { 21084 return globalScope.__wpStyleRuntime; 21085 } 21086 globalScope.__wpStyleRuntime = { 21087 documents: /* @__PURE__ */ new Map(), 21088 styles: /* @__PURE__ */ new Map(), 21089 injectedStyles: /* @__PURE__ */ new WeakMap() 21090 }; 21091 if (typeof document !== "undefined") { 21092 registerDocument39(document); 21093 } 21094 return globalScope.__wpStyleRuntime; 21095 } 21096 function documentContainsStyleHash39(targetDocument, hash) { 21097 if (!targetDocument.head) { 21098 return false; 21099 } 21100 for (const style of targetDocument.head.querySelectorAll( 21101 `style[$STYLE_HASH_ATTRIBUTE39}]` 21102 )) { 21103 if (style.getAttribute(STYLE_HASH_ATTRIBUTE39) === hash) { 21104 return true; 21105 } 21106 } 21107 return false; 21108 } 21109 function injectStyle39(targetDocument, hash, css) { 21110 if (!targetDocument.head) { 21111 return; 21112 } 21113 const runtime = getRuntime39(); 21114 let injectedStyles = runtime.injectedStyles.get(targetDocument); 21115 if (!injectedStyles) { 21116 injectedStyles = /* @__PURE__ */ new Set(); 21117 runtime.injectedStyles.set(targetDocument, injectedStyles); 21118 } 21119 if (injectedStyles.has(hash)) { 21120 return; 21121 } 21122 if (documentContainsStyleHash39(targetDocument, hash)) { 21123 injectedStyles.add(hash); 21124 return; 21125 } 21126 const style = targetDocument.createElement("style"); 21127 style.setAttribute(STYLE_HASH_ATTRIBUTE39, hash); 21128 style.appendChild(targetDocument.createTextNode(css)); 21129 targetDocument.head.appendChild(style); 21130 injectedStyles.add(hash); 21131 } 21132 function registerDocument39(targetDocument) { 21133 const runtime = getRuntime39(); 21134 runtime.documents.set( 21135 targetDocument, 21136 (runtime.documents.get(targetDocument) ?? 0) + 1 21137 ); 21138 for (const [hash, css] of runtime.styles) { 21139 injectStyle39(targetDocument, hash, css); 21140 } 21141 return () => { 21142 const count = runtime.documents.get(targetDocument); 21143 if (count === void 0) { 21144 return; 21145 } 21146 if (count <= 1) { 21147 runtime.documents.delete(targetDocument); 21148 return; 21149 } 21150 runtime.documents.set(targetDocument, count - 1); 21151 }; 21152 } 21153 function registerStyle39(hash, css) { 21154 const runtime = getRuntime39(); 21155 runtime.styles.set(hash, css); 21156 for (const targetDocument of runtime.documents.keys()) { 21157 injectStyle39(targetDocument, hash, css); 21158 } 21159 } 21160 if (typeof process === "undefined" || true) { 21161 registerStyle39("e3ae230cea", "@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;@layer wp-ui-utilities{._336cd3e4e743482f__box-sizing{box-sizing:border-box;*,:after,:before{box-sizing:inherit}}}"); 21162 } 21163 var resets_default5 = { "box-sizing": "_336cd3e4e743482f__box-sizing" }; 21164 if (typeof process === "undefined" || true) { 21165 registerStyle39("60dd1d4d42", "@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;@layer wp-ui-components{._4145abab73d17514__notice{--icon-height:24px;--text-vertical-padding:calc((var(--icon-height) - var(--wpds-typography-line-height-sm, 20px))/2);--wp-ui-notice-background-color:var(--wpds-color-bg-surface-neutral-weak,#f4f4f4);--wp-ui-notice-border-color:var(--wpds-color-stroke-surface-neutral,#dbdbdb);--wp-ui-notice-text-color:var(--wpds-color-fg-content-neutral,#1e1e1e);--wp-ui-notice-decorative-icon-color:var(--wpds-color-fg-content-neutral,#1e1e1e);align-items:start;background-color:var(--wp-ui-notice-background-color);border:1px solid var(--wp-ui-notice-border-color);border-radius:var(--wpds-border-radius-lg,8px);container-type:inline-size;display:grid;grid-template-columns:auto 1fr auto;padding:var(--wpds-dimension-padding-md,12px)}.d0a25570cb528528__icon{color:var(--wp-ui-notice-decorative-icon-color);grid-column:1;grid-row:1;margin-inline-end:var(--wpds-dimension-gap-xs,4px)}._1904b570a89bb815__description,.b5397fb9d05389e3__title{color:var(--wp-ui-notice-text-color);grid-column:2;padding-block:var(--text-vertical-padding)}._1904b570a89bb815__description{text-wrap:pretty}._0a1270dcdd79c031__actions{display:flex;flex-wrap:wrap;gap:var(--wpds-dimension-gap-md,12px);grid-column:2}._4145abab73d17514__notice:has(._1904b570a89bb815__description) ._0a1270dcdd79c031__actions,._4145abab73d17514__notice:has(.b5397fb9d05389e3__title) ._0a1270dcdd79c031__actions{margin-block-start:var(--wpds-dimension-gap-sm,8px)}._983740ab855c4e09__action-button{flex-shrink:0}.d329e7416d368d31__action-link{flex-shrink:0;&:not(:first-child){margin-inline-start:var(--wpds-dimension-gap-xs,4px)}&:not(:last-child){margin-inline-end:var(--wpds-dimension-gap-xs,4px)}}._487e6a5c1375f7dc__close-icon{grid-column:3;grid-row:1;margin-inline-start:var(--wpds-dimension-gap-xs,4px)}._531c140826094795__is-info{--wp-ui-notice-background-color:var(--wpds-color-bg-surface-info-weak,#f3f9ff);--wp-ui-notice-border-color:var(--wpds-color-stroke-surface-info,#9fbcdc);--wp-ui-notice-text-color:var(--wpds-color-fg-content-info,#001b4f);--wp-ui-notice-decorative-icon-color:var(--wpds-color-fg-content-info-weak,#006bd7)}.ae2e1004697cce95__is-warning{--wp-ui-notice-background-color:var(--wpds-color-bg-surface-warning-weak,#fff7e1);--wp-ui-notice-border-color:var(--wpds-color-stroke-surface-warning,#d0b481);--wp-ui-notice-text-color:var(--wpds-color-fg-content-warning,#2e1900);--wp-ui-notice-decorative-icon-color:var(--wpds-color-fg-content-warning-weak,#926300)}._2e614a76af494837__is-success{--wp-ui-notice-background-color:var(--wpds-color-bg-surface-success-weak,#ebffed);--wp-ui-notice-border-color:var(--wpds-color-stroke-surface-success,#8ac894);--wp-ui-notice-text-color:var(--wpds-color-fg-content-success,#002900);--wp-ui-notice-decorative-icon-color:var(--wpds-color-fg-content-success-weak,#008030)}.af00331ae17a0065__is-error{--wp-ui-notice-background-color:var(--wpds-color-bg-surface-error-weak,#fff6f5);--wp-ui-notice-border-color:var(--wpds-color-stroke-surface-error,#daa39b);--wp-ui-notice-text-color:var(--wpds-color-fg-content-error,#470000);--wp-ui-notice-decorative-icon-color:var(--wpds-color-fg-content-error-weak,#cc1818)}@container (max-width: 320px){._4145abab73d17514__notice:has(.b5397fb9d05389e3__title) ._0a1270dcdd79c031__actions,._4145abab73d17514__notice:has(.b5397fb9d05389e3__title) ._1904b570a89bb815__description{grid-column:1/3}}}@layer wp-ui-compositions{.d329e7416d368d31__action-link{margin-block:auto}._487e6a5c1375f7dc__close-icon,._983740ab855c4e09__action-button:is(._8ddb8fb33fbf3d38__is-action-button-outline,._77bbde495a8a0af3__is-action-button-minimal){--wp-ui-button-background-color-active:color-mix(in srgb,#0000 50%,var(--wpds-color-bg-interactive-neutral-weak-active,#ededed))}}"); 21166 } 21167 var style_default36 = { "notice": "_4145abab73d17514__notice", "icon": "d0a25570cb528528__icon", "title": "b5397fb9d05389e3__title", "description": "_1904b570a89bb815__description", "actions": "_0a1270dcdd79c031__actions", "action-button": "_983740ab855c4e09__action-button", "action-link": "d329e7416d368d31__action-link", "close-icon": "_487e6a5c1375f7dc__close-icon", "is-info": "_531c140826094795__is-info", "is-warning": "ae2e1004697cce95__is-warning", "is-success": "_2e614a76af494837__is-success", "is-error": "af00331ae17a0065__is-error", "is-action-button-outline": "_8ddb8fb33fbf3d38__is-action-button-outline", "is-action-button-minimal": "_77bbde495a8a0af3__is-action-button-minimal" }; 21168 var icons = { 21169 neutral: null, 21170 info: info_default, 21171 warning: caution_default, 21172 success: published_default, 21173 error: error_default 21174 }; 21175 function getDefaultPoliteness(intent) { 21176 return intent === "error" ? "assertive" : "polite"; 21177 } 21178 function safeRenderToString(message2) { 21179 if (!message2) { 21180 return void 0; 21181 } 21182 if (typeof message2 === "string") { 21183 return message2; 21184 } 21185 try { 21186 return (0, import_element79.renderToString)(message2); 21187 } catch { 21188 return void 0; 21189 } 21190 } 21191 function useSpokenMessage(message2, politeness) { 21192 const spokenMessage = safeRenderToString(message2); 21193 (0, import_element79.useEffect)(() => { 21194 if (spokenMessage) { 21195 speak3(spokenMessage, politeness); 21196 } 21197 }, [spokenMessage, politeness]); 21198 } 21199 var Root9 = (0, import_element79.forwardRef)(function Notice({ 21200 intent = "neutral", 21201 children, 21202 icon, 21203 spokenMessage = children, 21204 politeness = getDefaultPoliteness(intent), 21205 render: render4, 21206 ...restProps 21207 }, ref) { 21208 useSpokenMessage(spokenMessage, politeness); 21209 const iconElement = icon === null ? null : icon ?? icons[intent]; 21210 const mergedClassName = clsx_default( 21211 style_default36.notice, 21212 style_default36[`is-$intent}`], 21213 resets_default5["box-sizing"] 21214 ); 21215 const element = useRender({ 21216 defaultTagName: "div", 21217 render: render4, 21218 ref, 21219 props: mergeProps( 21220 { 21221 className: mergedClassName, 21222 children: /* @__PURE__ */ (0, import_jsx_runtime107.jsxs)(import_jsx_runtime107.Fragment, { children: [ 21223 children, 21224 iconElement && /* @__PURE__ */ (0, import_jsx_runtime107.jsx)( 21225 Icon, 21226 { 21227 className: style_default36.icon, 21228 icon: iconElement 21229 } 21230 ) 21231 ] }) 21232 }, 21233 restProps 21234 ) 21235 }); 21236 return element; 21237 }); 21238 21239 // packages/ui/build-module/notice/title.mjs 21240 var import_element80 = __toESM(require_element(), 1); 21241 var import_jsx_runtime108 = __toESM(require_jsx_runtime(), 1); 21242 var STYLE_HASH_ATTRIBUTE40 = "data-wp-hash"; 21243 function getRuntime40() { 21244 const globalScope = globalThis; 21245 if (globalScope.__wpStyleRuntime) { 21246 return globalScope.__wpStyleRuntime; 21247 } 21248 globalScope.__wpStyleRuntime = { 21249 documents: /* @__PURE__ */ new Map(), 21250 styles: /* @__PURE__ */ new Map(), 21251 injectedStyles: /* @__PURE__ */ new WeakMap() 21252 }; 21253 if (typeof document !== "undefined") { 21254 registerDocument40(document); 21255 } 21256 return globalScope.__wpStyleRuntime; 21257 } 21258 function documentContainsStyleHash40(targetDocument, hash) { 21259 if (!targetDocument.head) { 21260 return false; 21261 } 21262 for (const style of targetDocument.head.querySelectorAll( 21263 `style[$STYLE_HASH_ATTRIBUTE40}]` 21264 )) { 21265 if (style.getAttribute(STYLE_HASH_ATTRIBUTE40) === hash) { 21266 return true; 21267 } 21268 } 21269 return false; 21270 } 21271 function injectStyle40(targetDocument, hash, css) { 21272 if (!targetDocument.head) { 21273 return; 21274 } 21275 const runtime = getRuntime40(); 21276 let injectedStyles = runtime.injectedStyles.get(targetDocument); 21277 if (!injectedStyles) { 21278 injectedStyles = /* @__PURE__ */ new Set(); 21279 runtime.injectedStyles.set(targetDocument, injectedStyles); 21280 } 21281 if (injectedStyles.has(hash)) { 21282 return; 21283 } 21284 if (documentContainsStyleHash40(targetDocument, hash)) { 21285 injectedStyles.add(hash); 21286 return; 21287 } 21288 const style = targetDocument.createElement("style"); 21289 style.setAttribute(STYLE_HASH_ATTRIBUTE40, hash); 21290 style.appendChild(targetDocument.createTextNode(css)); 21291 targetDocument.head.appendChild(style); 21292 injectedStyles.add(hash); 21293 } 21294 function registerDocument40(targetDocument) { 21295 const runtime = getRuntime40(); 21296 runtime.documents.set( 21297 targetDocument, 21298 (runtime.documents.get(targetDocument) ?? 0) + 1 21299 ); 21300 for (const [hash, css] of runtime.styles) { 21301 injectStyle40(targetDocument, hash, css); 21302 } 21303 return () => { 21304 const count = runtime.documents.get(targetDocument); 21305 if (count === void 0) { 21306 return; 21307 } 21308 if (count <= 1) { 21309 runtime.documents.delete(targetDocument); 21310 return; 21311 } 21312 runtime.documents.set(targetDocument, count - 1); 21313 }; 21314 } 21315 function registerStyle40(hash, css) { 21316 const runtime = getRuntime40(); 21317 runtime.styles.set(hash, css); 21318 for (const targetDocument of runtime.documents.keys()) { 21319 injectStyle40(targetDocument, hash, css); 21320 } 21321 } 21322 if (typeof process === "undefined" || true) { 21323 registerStyle40("60dd1d4d42", "@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;@layer wp-ui-components{._4145abab73d17514__notice{--icon-height:24px;--text-vertical-padding:calc((var(--icon-height) - var(--wpds-typography-line-height-sm, 20px))/2);--wp-ui-notice-background-color:var(--wpds-color-bg-surface-neutral-weak,#f4f4f4);--wp-ui-notice-border-color:var(--wpds-color-stroke-surface-neutral,#dbdbdb);--wp-ui-notice-text-color:var(--wpds-color-fg-content-neutral,#1e1e1e);--wp-ui-notice-decorative-icon-color:var(--wpds-color-fg-content-neutral,#1e1e1e);align-items:start;background-color:var(--wp-ui-notice-background-color);border:1px solid var(--wp-ui-notice-border-color);border-radius:var(--wpds-border-radius-lg,8px);container-type:inline-size;display:grid;grid-template-columns:auto 1fr auto;padding:var(--wpds-dimension-padding-md,12px)}.d0a25570cb528528__icon{color:var(--wp-ui-notice-decorative-icon-color);grid-column:1;grid-row:1;margin-inline-end:var(--wpds-dimension-gap-xs,4px)}._1904b570a89bb815__description,.b5397fb9d05389e3__title{color:var(--wp-ui-notice-text-color);grid-column:2;padding-block:var(--text-vertical-padding)}._1904b570a89bb815__description{text-wrap:pretty}._0a1270dcdd79c031__actions{display:flex;flex-wrap:wrap;gap:var(--wpds-dimension-gap-md,12px);grid-column:2}._4145abab73d17514__notice:has(._1904b570a89bb815__description) ._0a1270dcdd79c031__actions,._4145abab73d17514__notice:has(.b5397fb9d05389e3__title) ._0a1270dcdd79c031__actions{margin-block-start:var(--wpds-dimension-gap-sm,8px)}._983740ab855c4e09__action-button{flex-shrink:0}.d329e7416d368d31__action-link{flex-shrink:0;&:not(:first-child){margin-inline-start:var(--wpds-dimension-gap-xs,4px)}&:not(:last-child){margin-inline-end:var(--wpds-dimension-gap-xs,4px)}}._487e6a5c1375f7dc__close-icon{grid-column:3;grid-row:1;margin-inline-start:var(--wpds-dimension-gap-xs,4px)}._531c140826094795__is-info{--wp-ui-notice-background-color:var(--wpds-color-bg-surface-info-weak,#f3f9ff);--wp-ui-notice-border-color:var(--wpds-color-stroke-surface-info,#9fbcdc);--wp-ui-notice-text-color:var(--wpds-color-fg-content-info,#001b4f);--wp-ui-notice-decorative-icon-color:var(--wpds-color-fg-content-info-weak,#006bd7)}.ae2e1004697cce95__is-warning{--wp-ui-notice-background-color:var(--wpds-color-bg-surface-warning-weak,#fff7e1);--wp-ui-notice-border-color:var(--wpds-color-stroke-surface-warning,#d0b481);--wp-ui-notice-text-color:var(--wpds-color-fg-content-warning,#2e1900);--wp-ui-notice-decorative-icon-color:var(--wpds-color-fg-content-warning-weak,#926300)}._2e614a76af494837__is-success{--wp-ui-notice-background-color:var(--wpds-color-bg-surface-success-weak,#ebffed);--wp-ui-notice-border-color:var(--wpds-color-stroke-surface-success,#8ac894);--wp-ui-notice-text-color:var(--wpds-color-fg-content-success,#002900);--wp-ui-notice-decorative-icon-color:var(--wpds-color-fg-content-success-weak,#008030)}.af00331ae17a0065__is-error{--wp-ui-notice-background-color:var(--wpds-color-bg-surface-error-weak,#fff6f5);--wp-ui-notice-border-color:var(--wpds-color-stroke-surface-error,#daa39b);--wp-ui-notice-text-color:var(--wpds-color-fg-content-error,#470000);--wp-ui-notice-decorative-icon-color:var(--wpds-color-fg-content-error-weak,#cc1818)}@container (max-width: 320px){._4145abab73d17514__notice:has(.b5397fb9d05389e3__title) ._0a1270dcdd79c031__actions,._4145abab73d17514__notice:has(.b5397fb9d05389e3__title) ._1904b570a89bb815__description{grid-column:1/3}}}@layer wp-ui-compositions{.d329e7416d368d31__action-link{margin-block:auto}._487e6a5c1375f7dc__close-icon,._983740ab855c4e09__action-button:is(._8ddb8fb33fbf3d38__is-action-button-outline,._77bbde495a8a0af3__is-action-button-minimal){--wp-ui-button-background-color-active:color-mix(in srgb,#0000 50%,var(--wpds-color-bg-interactive-neutral-weak-active,#ededed))}}"); 21324 } 21325 var style_default37 = { "notice": "_4145abab73d17514__notice", "icon": "d0a25570cb528528__icon", "title": "b5397fb9d05389e3__title", "description": "_1904b570a89bb815__description", "actions": "_0a1270dcdd79c031__actions", "action-button": "_983740ab855c4e09__action-button", "action-link": "d329e7416d368d31__action-link", "close-icon": "_487e6a5c1375f7dc__close-icon", "is-info": "_531c140826094795__is-info", "is-warning": "ae2e1004697cce95__is-warning", "is-success": "_2e614a76af494837__is-success", "is-error": "af00331ae17a0065__is-error", "is-action-button-outline": "_8ddb8fb33fbf3d38__is-action-button-outline", "is-action-button-minimal": "_77bbde495a8a0af3__is-action-button-minimal" }; 21326 var Title5 = (0, import_element80.forwardRef)( 21327 function NoticeTitle({ className, ...props }, ref) { 21328 return /* @__PURE__ */ (0, import_jsx_runtime108.jsx)( 21329 Text, 21330 { 21331 ref, 21332 variant: "heading-md", 21333 className: clsx_default(style_default37.title, className), 21334 ...props 21335 } 21336 ); 21337 } 21338 ); 21339 21340 // packages/ui/build-module/notice/description.mjs 21341 var import_element81 = __toESM(require_element(), 1); 21342 var import_jsx_runtime109 = __toESM(require_jsx_runtime(), 1); 21343 var STYLE_HASH_ATTRIBUTE41 = "data-wp-hash"; 21344 function getRuntime41() { 21345 const globalScope = globalThis; 21346 if (globalScope.__wpStyleRuntime) { 21347 return globalScope.__wpStyleRuntime; 21348 } 21349 globalScope.__wpStyleRuntime = { 21350 documents: /* @__PURE__ */ new Map(), 21351 styles: /* @__PURE__ */ new Map(), 21352 injectedStyles: /* @__PURE__ */ new WeakMap() 21353 }; 21354 if (typeof document !== "undefined") { 21355 registerDocument41(document); 21356 } 21357 return globalScope.__wpStyleRuntime; 21358 } 21359 function documentContainsStyleHash41(targetDocument, hash) { 21360 if (!targetDocument.head) { 21361 return false; 21362 } 21363 for (const style of targetDocument.head.querySelectorAll( 21364 `style[$STYLE_HASH_ATTRIBUTE41}]` 21365 )) { 21366 if (style.getAttribute(STYLE_HASH_ATTRIBUTE41) === hash) { 21367 return true; 21368 } 21369 } 21370 return false; 21371 } 21372 function injectStyle41(targetDocument, hash, css) { 21373 if (!targetDocument.head) { 21374 return; 21375 } 21376 const runtime = getRuntime41(); 21377 let injectedStyles = runtime.injectedStyles.get(targetDocument); 21378 if (!injectedStyles) { 21379 injectedStyles = /* @__PURE__ */ new Set(); 21380 runtime.injectedStyles.set(targetDocument, injectedStyles); 21381 } 21382 if (injectedStyles.has(hash)) { 21383 return; 21384 } 21385 if (documentContainsStyleHash41(targetDocument, hash)) { 21386 injectedStyles.add(hash); 21387 return; 21388 } 21389 const style = targetDocument.createElement("style"); 21390 style.setAttribute(STYLE_HASH_ATTRIBUTE41, hash); 21391 style.appendChild(targetDocument.createTextNode(css)); 21392 targetDocument.head.appendChild(style); 21393 injectedStyles.add(hash); 21394 } 21395 function registerDocument41(targetDocument) { 21396 const runtime = getRuntime41(); 21397 runtime.documents.set( 21398 targetDocument, 21399 (runtime.documents.get(targetDocument) ?? 0) + 1 21400 ); 21401 for (const [hash, css] of runtime.styles) { 21402 injectStyle41(targetDocument, hash, css); 21403 } 21404 return () => { 21405 const count = runtime.documents.get(targetDocument); 21406 if (count === void 0) { 21407 return; 21408 } 21409 if (count <= 1) { 21410 runtime.documents.delete(targetDocument); 21411 return; 21412 } 21413 runtime.documents.set(targetDocument, count - 1); 21414 }; 21415 } 21416 function registerStyle41(hash, css) { 21417 const runtime = getRuntime41(); 21418 runtime.styles.set(hash, css); 21419 for (const targetDocument of runtime.documents.keys()) { 21420 injectStyle41(targetDocument, hash, css); 21421 } 21422 } 21423 if (typeof process === "undefined" || true) { 21424 registerStyle41("60dd1d4d42", "@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;@layer wp-ui-components{._4145abab73d17514__notice{--icon-height:24px;--text-vertical-padding:calc((var(--icon-height) - var(--wpds-typography-line-height-sm, 20px))/2);--wp-ui-notice-background-color:var(--wpds-color-bg-surface-neutral-weak,#f4f4f4);--wp-ui-notice-border-color:var(--wpds-color-stroke-surface-neutral,#dbdbdb);--wp-ui-notice-text-color:var(--wpds-color-fg-content-neutral,#1e1e1e);--wp-ui-notice-decorative-icon-color:var(--wpds-color-fg-content-neutral,#1e1e1e);align-items:start;background-color:var(--wp-ui-notice-background-color);border:1px solid var(--wp-ui-notice-border-color);border-radius:var(--wpds-border-radius-lg,8px);container-type:inline-size;display:grid;grid-template-columns:auto 1fr auto;padding:var(--wpds-dimension-padding-md,12px)}.d0a25570cb528528__icon{color:var(--wp-ui-notice-decorative-icon-color);grid-column:1;grid-row:1;margin-inline-end:var(--wpds-dimension-gap-xs,4px)}._1904b570a89bb815__description,.b5397fb9d05389e3__title{color:var(--wp-ui-notice-text-color);grid-column:2;padding-block:var(--text-vertical-padding)}._1904b570a89bb815__description{text-wrap:pretty}._0a1270dcdd79c031__actions{display:flex;flex-wrap:wrap;gap:var(--wpds-dimension-gap-md,12px);grid-column:2}._4145abab73d17514__notice:has(._1904b570a89bb815__description) ._0a1270dcdd79c031__actions,._4145abab73d17514__notice:has(.b5397fb9d05389e3__title) ._0a1270dcdd79c031__actions{margin-block-start:var(--wpds-dimension-gap-sm,8px)}._983740ab855c4e09__action-button{flex-shrink:0}.d329e7416d368d31__action-link{flex-shrink:0;&:not(:first-child){margin-inline-start:var(--wpds-dimension-gap-xs,4px)}&:not(:last-child){margin-inline-end:var(--wpds-dimension-gap-xs,4px)}}._487e6a5c1375f7dc__close-icon{grid-column:3;grid-row:1;margin-inline-start:var(--wpds-dimension-gap-xs,4px)}._531c140826094795__is-info{--wp-ui-notice-background-color:var(--wpds-color-bg-surface-info-weak,#f3f9ff);--wp-ui-notice-border-color:var(--wpds-color-stroke-surface-info,#9fbcdc);--wp-ui-notice-text-color:var(--wpds-color-fg-content-info,#001b4f);--wp-ui-notice-decorative-icon-color:var(--wpds-color-fg-content-info-weak,#006bd7)}.ae2e1004697cce95__is-warning{--wp-ui-notice-background-color:var(--wpds-color-bg-surface-warning-weak,#fff7e1);--wp-ui-notice-border-color:var(--wpds-color-stroke-surface-warning,#d0b481);--wp-ui-notice-text-color:var(--wpds-color-fg-content-warning,#2e1900);--wp-ui-notice-decorative-icon-color:var(--wpds-color-fg-content-warning-weak,#926300)}._2e614a76af494837__is-success{--wp-ui-notice-background-color:var(--wpds-color-bg-surface-success-weak,#ebffed);--wp-ui-notice-border-color:var(--wpds-color-stroke-surface-success,#8ac894);--wp-ui-notice-text-color:var(--wpds-color-fg-content-success,#002900);--wp-ui-notice-decorative-icon-color:var(--wpds-color-fg-content-success-weak,#008030)}.af00331ae17a0065__is-error{--wp-ui-notice-background-color:var(--wpds-color-bg-surface-error-weak,#fff6f5);--wp-ui-notice-border-color:var(--wpds-color-stroke-surface-error,#daa39b);--wp-ui-notice-text-color:var(--wpds-color-fg-content-error,#470000);--wp-ui-notice-decorative-icon-color:var(--wpds-color-fg-content-error-weak,#cc1818)}@container (max-width: 320px){._4145abab73d17514__notice:has(.b5397fb9d05389e3__title) ._0a1270dcdd79c031__actions,._4145abab73d17514__notice:has(.b5397fb9d05389e3__title) ._1904b570a89bb815__description{grid-column:1/3}}}@layer wp-ui-compositions{.d329e7416d368d31__action-link{margin-block:auto}._487e6a5c1375f7dc__close-icon,._983740ab855c4e09__action-button:is(._8ddb8fb33fbf3d38__is-action-button-outline,._77bbde495a8a0af3__is-action-button-minimal){--wp-ui-button-background-color-active:color-mix(in srgb,#0000 50%,var(--wpds-color-bg-interactive-neutral-weak-active,#ededed))}}"); 21425 } 21426 var style_default38 = { "notice": "_4145abab73d17514__notice", "icon": "d0a25570cb528528__icon", "title": "b5397fb9d05389e3__title", "description": "_1904b570a89bb815__description", "actions": "_0a1270dcdd79c031__actions", "action-button": "_983740ab855c4e09__action-button", "action-link": "d329e7416d368d31__action-link", "close-icon": "_487e6a5c1375f7dc__close-icon", "is-info": "_531c140826094795__is-info", "is-warning": "ae2e1004697cce95__is-warning", "is-success": "_2e614a76af494837__is-success", "is-error": "af00331ae17a0065__is-error", "is-action-button-outline": "_8ddb8fb33fbf3d38__is-action-button-outline", "is-action-button-minimal": "_77bbde495a8a0af3__is-action-button-minimal" }; 21427 var Description4 = (0, import_element81.forwardRef)( 21428 function NoticeDescription({ className, ...props }, ref) { 21429 return /* @__PURE__ */ (0, import_jsx_runtime109.jsx)( 21430 Text, 21431 { 21432 ref, 21433 variant: "body-md", 21434 className: clsx_default(style_default38.description, className), 21435 ...props 21436 } 21437 ); 21438 } 21439 ); 21440 21441 // packages/ui/build-module/notice/actions.mjs 21442 var import_element82 = __toESM(require_element(), 1); 21443 var STYLE_HASH_ATTRIBUTE42 = "data-wp-hash"; 21444 function getRuntime42() { 21445 const globalScope = globalThis; 21446 if (globalScope.__wpStyleRuntime) { 21447 return globalScope.__wpStyleRuntime; 21448 } 21449 globalScope.__wpStyleRuntime = { 21450 documents: /* @__PURE__ */ new Map(), 21451 styles: /* @__PURE__ */ new Map(), 21452 injectedStyles: /* @__PURE__ */ new WeakMap() 21453 }; 21454 if (typeof document !== "undefined") { 21455 registerDocument42(document); 21456 } 21457 return globalScope.__wpStyleRuntime; 21458 } 21459 function documentContainsStyleHash42(targetDocument, hash) { 21460 if (!targetDocument.head) { 21461 return false; 21462 } 21463 for (const style of targetDocument.head.querySelectorAll( 21464 `style[$STYLE_HASH_ATTRIBUTE42}]` 21465 )) { 21466 if (style.getAttribute(STYLE_HASH_ATTRIBUTE42) === hash) { 21467 return true; 21468 } 21469 } 21470 return false; 21471 } 21472 function injectStyle42(targetDocument, hash, css) { 21473 if (!targetDocument.head) { 21474 return; 21475 } 21476 const runtime = getRuntime42(); 21477 let injectedStyles = runtime.injectedStyles.get(targetDocument); 21478 if (!injectedStyles) { 21479 injectedStyles = /* @__PURE__ */ new Set(); 21480 runtime.injectedStyles.set(targetDocument, injectedStyles); 21481 } 21482 if (injectedStyles.has(hash)) { 21483 return; 21484 } 21485 if (documentContainsStyleHash42(targetDocument, hash)) { 21486 injectedStyles.add(hash); 21487 return; 21488 } 21489 const style = targetDocument.createElement("style"); 21490 style.setAttribute(STYLE_HASH_ATTRIBUTE42, hash); 21491 style.appendChild(targetDocument.createTextNode(css)); 21492 targetDocument.head.appendChild(style); 21493 injectedStyles.add(hash); 21494 } 21495 function registerDocument42(targetDocument) { 21496 const runtime = getRuntime42(); 21497 runtime.documents.set( 21498 targetDocument, 21499 (runtime.documents.get(targetDocument) ?? 0) + 1 21500 ); 21501 for (const [hash, css] of runtime.styles) { 21502 injectStyle42(targetDocument, hash, css); 21503 } 21504 return () => { 21505 const count = runtime.documents.get(targetDocument); 21506 if (count === void 0) { 21507 return; 21508 } 21509 if (count <= 1) { 21510 runtime.documents.delete(targetDocument); 21511 return; 21512 } 21513 runtime.documents.set(targetDocument, count - 1); 21514 }; 21515 } 21516 function registerStyle42(hash, css) { 21517 const runtime = getRuntime42(); 21518 runtime.styles.set(hash, css); 21519 for (const targetDocument of runtime.documents.keys()) { 21520 injectStyle42(targetDocument, hash, css); 21521 } 21522 } 21523 if (typeof process === "undefined" || true) { 21524 registerStyle42("60dd1d4d42", "@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;@layer wp-ui-components{._4145abab73d17514__notice{--icon-height:24px;--text-vertical-padding:calc((var(--icon-height) - var(--wpds-typography-line-height-sm, 20px))/2);--wp-ui-notice-background-color:var(--wpds-color-bg-surface-neutral-weak,#f4f4f4);--wp-ui-notice-border-color:var(--wpds-color-stroke-surface-neutral,#dbdbdb);--wp-ui-notice-text-color:var(--wpds-color-fg-content-neutral,#1e1e1e);--wp-ui-notice-decorative-icon-color:var(--wpds-color-fg-content-neutral,#1e1e1e);align-items:start;background-color:var(--wp-ui-notice-background-color);border:1px solid var(--wp-ui-notice-border-color);border-radius:var(--wpds-border-radius-lg,8px);container-type:inline-size;display:grid;grid-template-columns:auto 1fr auto;padding:var(--wpds-dimension-padding-md,12px)}.d0a25570cb528528__icon{color:var(--wp-ui-notice-decorative-icon-color);grid-column:1;grid-row:1;margin-inline-end:var(--wpds-dimension-gap-xs,4px)}._1904b570a89bb815__description,.b5397fb9d05389e3__title{color:var(--wp-ui-notice-text-color);grid-column:2;padding-block:var(--text-vertical-padding)}._1904b570a89bb815__description{text-wrap:pretty}._0a1270dcdd79c031__actions{display:flex;flex-wrap:wrap;gap:var(--wpds-dimension-gap-md,12px);grid-column:2}._4145abab73d17514__notice:has(._1904b570a89bb815__description) ._0a1270dcdd79c031__actions,._4145abab73d17514__notice:has(.b5397fb9d05389e3__title) ._0a1270dcdd79c031__actions{margin-block-start:var(--wpds-dimension-gap-sm,8px)}._983740ab855c4e09__action-button{flex-shrink:0}.d329e7416d368d31__action-link{flex-shrink:0;&:not(:first-child){margin-inline-start:var(--wpds-dimension-gap-xs,4px)}&:not(:last-child){margin-inline-end:var(--wpds-dimension-gap-xs,4px)}}._487e6a5c1375f7dc__close-icon{grid-column:3;grid-row:1;margin-inline-start:var(--wpds-dimension-gap-xs,4px)}._531c140826094795__is-info{--wp-ui-notice-background-color:var(--wpds-color-bg-surface-info-weak,#f3f9ff);--wp-ui-notice-border-color:var(--wpds-color-stroke-surface-info,#9fbcdc);--wp-ui-notice-text-color:var(--wpds-color-fg-content-info,#001b4f);--wp-ui-notice-decorative-icon-color:var(--wpds-color-fg-content-info-weak,#006bd7)}.ae2e1004697cce95__is-warning{--wp-ui-notice-background-color:var(--wpds-color-bg-surface-warning-weak,#fff7e1);--wp-ui-notice-border-color:var(--wpds-color-stroke-surface-warning,#d0b481);--wp-ui-notice-text-color:var(--wpds-color-fg-content-warning,#2e1900);--wp-ui-notice-decorative-icon-color:var(--wpds-color-fg-content-warning-weak,#926300)}._2e614a76af494837__is-success{--wp-ui-notice-background-color:var(--wpds-color-bg-surface-success-weak,#ebffed);--wp-ui-notice-border-color:var(--wpds-color-stroke-surface-success,#8ac894);--wp-ui-notice-text-color:var(--wpds-color-fg-content-success,#002900);--wp-ui-notice-decorative-icon-color:var(--wpds-color-fg-content-success-weak,#008030)}.af00331ae17a0065__is-error{--wp-ui-notice-background-color:var(--wpds-color-bg-surface-error-weak,#fff6f5);--wp-ui-notice-border-color:var(--wpds-color-stroke-surface-error,#daa39b);--wp-ui-notice-text-color:var(--wpds-color-fg-content-error,#470000);--wp-ui-notice-decorative-icon-color:var(--wpds-color-fg-content-error-weak,#cc1818)}@container (max-width: 320px){._4145abab73d17514__notice:has(.b5397fb9d05389e3__title) ._0a1270dcdd79c031__actions,._4145abab73d17514__notice:has(.b5397fb9d05389e3__title) ._1904b570a89bb815__description{grid-column:1/3}}}@layer wp-ui-compositions{.d329e7416d368d31__action-link{margin-block:auto}._487e6a5c1375f7dc__close-icon,._983740ab855c4e09__action-button:is(._8ddb8fb33fbf3d38__is-action-button-outline,._77bbde495a8a0af3__is-action-button-minimal){--wp-ui-button-background-color-active:color-mix(in srgb,#0000 50%,var(--wpds-color-bg-interactive-neutral-weak-active,#ededed))}}"); 21525 } 21526 var style_default39 = { "notice": "_4145abab73d17514__notice", "icon": "d0a25570cb528528__icon", "title": "b5397fb9d05389e3__title", "description": "_1904b570a89bb815__description", "actions": "_0a1270dcdd79c031__actions", "action-button": "_983740ab855c4e09__action-button", "action-link": "d329e7416d368d31__action-link", "close-icon": "_487e6a5c1375f7dc__close-icon", "is-info": "_531c140826094795__is-info", "is-warning": "ae2e1004697cce95__is-warning", "is-success": "_2e614a76af494837__is-success", "is-error": "af00331ae17a0065__is-error", "is-action-button-outline": "_8ddb8fb33fbf3d38__is-action-button-outline", "is-action-button-minimal": "_77bbde495a8a0af3__is-action-button-minimal" }; 21527 var Actions2 = (0, import_element82.forwardRef)( 21528 function NoticeActions({ render: render4, ...props }, ref) { 21529 const element = useRender({ 21530 defaultTagName: "div", 21531 render: render4, 21532 ref, 21533 props: mergeProps( 21534 { 21535 className: style_default39.actions 21536 }, 21537 props 21538 ) 21539 }); 21540 return element; 21541 } 21542 ); 21543 21544 // packages/ui/build-module/notice/close-icon.mjs 21545 var import_element83 = __toESM(require_element(), 1); 21546 var import_i18n7 = __toESM(require_i18n(), 1); 21547 var import_jsx_runtime110 = __toESM(require_jsx_runtime(), 1); 21548 var STYLE_HASH_ATTRIBUTE43 = "data-wp-hash"; 21549 function getRuntime43() { 21550 const globalScope = globalThis; 21551 if (globalScope.__wpStyleRuntime) { 21552 return globalScope.__wpStyleRuntime; 21553 } 21554 globalScope.__wpStyleRuntime = { 21555 documents: /* @__PURE__ */ new Map(), 21556 styles: /* @__PURE__ */ new Map(), 21557 injectedStyles: /* @__PURE__ */ new WeakMap() 21558 }; 21559 if (typeof document !== "undefined") { 21560 registerDocument43(document); 21561 } 21562 return globalScope.__wpStyleRuntime; 21563 } 21564 function documentContainsStyleHash43(targetDocument, hash) { 21565 if (!targetDocument.head) { 21566 return false; 21567 } 21568 for (const style of targetDocument.head.querySelectorAll( 21569 `style[$STYLE_HASH_ATTRIBUTE43}]` 21570 )) { 21571 if (style.getAttribute(STYLE_HASH_ATTRIBUTE43) === hash) { 21572 return true; 21573 } 21574 } 21575 return false; 21576 } 21577 function injectStyle43(targetDocument, hash, css) { 21578 if (!targetDocument.head) { 21579 return; 21580 } 21581 const runtime = getRuntime43(); 21582 let injectedStyles = runtime.injectedStyles.get(targetDocument); 21583 if (!injectedStyles) { 21584 injectedStyles = /* @__PURE__ */ new Set(); 21585 runtime.injectedStyles.set(targetDocument, injectedStyles); 21586 } 21587 if (injectedStyles.has(hash)) { 21588 return; 21589 } 21590 if (documentContainsStyleHash43(targetDocument, hash)) { 21591 injectedStyles.add(hash); 21592 return; 21593 } 21594 const style = targetDocument.createElement("style"); 21595 style.setAttribute(STYLE_HASH_ATTRIBUTE43, hash); 21596 style.appendChild(targetDocument.createTextNode(css)); 21597 targetDocument.head.appendChild(style); 21598 injectedStyles.add(hash); 21599 } 21600 function registerDocument43(targetDocument) { 21601 const runtime = getRuntime43(); 21602 runtime.documents.set( 21603 targetDocument, 21604 (runtime.documents.get(targetDocument) ?? 0) + 1 21605 ); 21606 for (const [hash, css] of runtime.styles) { 21607 injectStyle43(targetDocument, hash, css); 21608 } 21609 return () => { 21610 const count = runtime.documents.get(targetDocument); 21611 if (count === void 0) { 21612 return; 21613 } 21614 if (count <= 1) { 21615 runtime.documents.delete(targetDocument); 21616 return; 21617 } 21618 runtime.documents.set(targetDocument, count - 1); 21619 }; 21620 } 21621 function registerStyle43(hash, css) { 21622 const runtime = getRuntime43(); 21623 runtime.styles.set(hash, css); 21624 for (const targetDocument of runtime.documents.keys()) { 21625 injectStyle43(targetDocument, hash, css); 21626 } 21627 } 21628 if (typeof process === "undefined" || true) { 21629 registerStyle43("60dd1d4d42", "@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;@layer wp-ui-components{._4145abab73d17514__notice{--icon-height:24px;--text-vertical-padding:calc((var(--icon-height) - var(--wpds-typography-line-height-sm, 20px))/2);--wp-ui-notice-background-color:var(--wpds-color-bg-surface-neutral-weak,#f4f4f4);--wp-ui-notice-border-color:var(--wpds-color-stroke-surface-neutral,#dbdbdb);--wp-ui-notice-text-color:var(--wpds-color-fg-content-neutral,#1e1e1e);--wp-ui-notice-decorative-icon-color:var(--wpds-color-fg-content-neutral,#1e1e1e);align-items:start;background-color:var(--wp-ui-notice-background-color);border:1px solid var(--wp-ui-notice-border-color);border-radius:var(--wpds-border-radius-lg,8px);container-type:inline-size;display:grid;grid-template-columns:auto 1fr auto;padding:var(--wpds-dimension-padding-md,12px)}.d0a25570cb528528__icon{color:var(--wp-ui-notice-decorative-icon-color);grid-column:1;grid-row:1;margin-inline-end:var(--wpds-dimension-gap-xs,4px)}._1904b570a89bb815__description,.b5397fb9d05389e3__title{color:var(--wp-ui-notice-text-color);grid-column:2;padding-block:var(--text-vertical-padding)}._1904b570a89bb815__description{text-wrap:pretty}._0a1270dcdd79c031__actions{display:flex;flex-wrap:wrap;gap:var(--wpds-dimension-gap-md,12px);grid-column:2}._4145abab73d17514__notice:has(._1904b570a89bb815__description) ._0a1270dcdd79c031__actions,._4145abab73d17514__notice:has(.b5397fb9d05389e3__title) ._0a1270dcdd79c031__actions{margin-block-start:var(--wpds-dimension-gap-sm,8px)}._983740ab855c4e09__action-button{flex-shrink:0}.d329e7416d368d31__action-link{flex-shrink:0;&:not(:first-child){margin-inline-start:var(--wpds-dimension-gap-xs,4px)}&:not(:last-child){margin-inline-end:var(--wpds-dimension-gap-xs,4px)}}._487e6a5c1375f7dc__close-icon{grid-column:3;grid-row:1;margin-inline-start:var(--wpds-dimension-gap-xs,4px)}._531c140826094795__is-info{--wp-ui-notice-background-color:var(--wpds-color-bg-surface-info-weak,#f3f9ff);--wp-ui-notice-border-color:var(--wpds-color-stroke-surface-info,#9fbcdc);--wp-ui-notice-text-color:var(--wpds-color-fg-content-info,#001b4f);--wp-ui-notice-decorative-icon-color:var(--wpds-color-fg-content-info-weak,#006bd7)}.ae2e1004697cce95__is-warning{--wp-ui-notice-background-color:var(--wpds-color-bg-surface-warning-weak,#fff7e1);--wp-ui-notice-border-color:var(--wpds-color-stroke-surface-warning,#d0b481);--wp-ui-notice-text-color:var(--wpds-color-fg-content-warning,#2e1900);--wp-ui-notice-decorative-icon-color:var(--wpds-color-fg-content-warning-weak,#926300)}._2e614a76af494837__is-success{--wp-ui-notice-background-color:var(--wpds-color-bg-surface-success-weak,#ebffed);--wp-ui-notice-border-color:var(--wpds-color-stroke-surface-success,#8ac894);--wp-ui-notice-text-color:var(--wpds-color-fg-content-success,#002900);--wp-ui-notice-decorative-icon-color:var(--wpds-color-fg-content-success-weak,#008030)}.af00331ae17a0065__is-error{--wp-ui-notice-background-color:var(--wpds-color-bg-surface-error-weak,#fff6f5);--wp-ui-notice-border-color:var(--wpds-color-stroke-surface-error,#daa39b);--wp-ui-notice-text-color:var(--wpds-color-fg-content-error,#470000);--wp-ui-notice-decorative-icon-color:var(--wpds-color-fg-content-error-weak,#cc1818)}@container (max-width: 320px){._4145abab73d17514__notice:has(.b5397fb9d05389e3__title) ._0a1270dcdd79c031__actions,._4145abab73d17514__notice:has(.b5397fb9d05389e3__title) ._1904b570a89bb815__description{grid-column:1/3}}}@layer wp-ui-compositions{.d329e7416d368d31__action-link{margin-block:auto}._487e6a5c1375f7dc__close-icon,._983740ab855c4e09__action-button:is(._8ddb8fb33fbf3d38__is-action-button-outline,._77bbde495a8a0af3__is-action-button-minimal){--wp-ui-button-background-color-active:color-mix(in srgb,#0000 50%,var(--wpds-color-bg-interactive-neutral-weak-active,#ededed))}}"); 21630 } 21631 var style_default40 = { "notice": "_4145abab73d17514__notice", "icon": "d0a25570cb528528__icon", "title": "b5397fb9d05389e3__title", "description": "_1904b570a89bb815__description", "actions": "_0a1270dcdd79c031__actions", "action-button": "_983740ab855c4e09__action-button", "action-link": "d329e7416d368d31__action-link", "close-icon": "_487e6a5c1375f7dc__close-icon", "is-info": "_531c140826094795__is-info", "is-warning": "ae2e1004697cce95__is-warning", "is-success": "_2e614a76af494837__is-success", "is-error": "af00331ae17a0065__is-error", "is-action-button-outline": "_8ddb8fb33fbf3d38__is-action-button-outline", "is-action-button-minimal": "_77bbde495a8a0af3__is-action-button-minimal" }; 21632 var CloseIcon3 = (0, import_element83.forwardRef)( 21633 function NoticeCloseIcon({ className, icon = close_small_default, label = (0, import_i18n7.__)("Dismiss"), ...props }, ref) { 21634 return /* @__PURE__ */ (0, import_jsx_runtime110.jsx)( 21635 IconButton, 21636 { 21637 ...props, 21638 ref, 21639 className: clsx_default(style_default40["close-icon"], className), 21640 variant: "minimal", 21641 size: "small", 21642 tone: "neutral", 21643 icon, 21644 label 21645 } 21646 ); 21647 } 21648 ); 21649 21650 // packages/ui/build-module/notice/action-button.mjs 21651 var import_element84 = __toESM(require_element(), 1); 21652 var import_jsx_runtime111 = __toESM(require_jsx_runtime(), 1); 21653 var STYLE_HASH_ATTRIBUTE44 = "data-wp-hash"; 21654 function getRuntime44() { 21655 const globalScope = globalThis; 21656 if (globalScope.__wpStyleRuntime) { 21657 return globalScope.__wpStyleRuntime; 21658 } 21659 globalScope.__wpStyleRuntime = { 21660 documents: /* @__PURE__ */ new Map(), 21661 styles: /* @__PURE__ */ new Map(), 21662 injectedStyles: /* @__PURE__ */ new WeakMap() 21663 }; 21664 if (typeof document !== "undefined") { 21665 registerDocument44(document); 21666 } 21667 return globalScope.__wpStyleRuntime; 21668 } 21669 function documentContainsStyleHash44(targetDocument, hash) { 21670 if (!targetDocument.head) { 21671 return false; 21672 } 21673 for (const style of targetDocument.head.querySelectorAll( 21674 `style[$STYLE_HASH_ATTRIBUTE44}]` 21675 )) { 21676 if (style.getAttribute(STYLE_HASH_ATTRIBUTE44) === hash) { 21677 return true; 21678 } 21679 } 21680 return false; 21681 } 21682 function injectStyle44(targetDocument, hash, css) { 21683 if (!targetDocument.head) { 21684 return; 21685 } 21686 const runtime = getRuntime44(); 21687 let injectedStyles = runtime.injectedStyles.get(targetDocument); 21688 if (!injectedStyles) { 21689 injectedStyles = /* @__PURE__ */ new Set(); 21690 runtime.injectedStyles.set(targetDocument, injectedStyles); 21691 } 21692 if (injectedStyles.has(hash)) { 21693 return; 21694 } 21695 if (documentContainsStyleHash44(targetDocument, hash)) { 21696 injectedStyles.add(hash); 21697 return; 21698 } 21699 const style = targetDocument.createElement("style"); 21700 style.setAttribute(STYLE_HASH_ATTRIBUTE44, hash); 21701 style.appendChild(targetDocument.createTextNode(css)); 21702 targetDocument.head.appendChild(style); 21703 injectedStyles.add(hash); 21704 } 21705 function registerDocument44(targetDocument) { 21706 const runtime = getRuntime44(); 21707 runtime.documents.set( 21708 targetDocument, 21709 (runtime.documents.get(targetDocument) ?? 0) + 1 21710 ); 21711 for (const [hash, css] of runtime.styles) { 21712 injectStyle44(targetDocument, hash, css); 21713 } 21714 return () => { 21715 const count = runtime.documents.get(targetDocument); 21716 if (count === void 0) { 21717 return; 21718 } 21719 if (count <= 1) { 21720 runtime.documents.delete(targetDocument); 21721 return; 21722 } 21723 runtime.documents.set(targetDocument, count - 1); 21724 }; 21725 } 21726 function registerStyle44(hash, css) { 21727 const runtime = getRuntime44(); 21728 runtime.styles.set(hash, css); 21729 for (const targetDocument of runtime.documents.keys()) { 21730 injectStyle44(targetDocument, hash, css); 21731 } 21732 } 21733 if (typeof process === "undefined" || true) { 21734 registerStyle44("60dd1d4d42", "@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;@layer wp-ui-components{._4145abab73d17514__notice{--icon-height:24px;--text-vertical-padding:calc((var(--icon-height) - var(--wpds-typography-line-height-sm, 20px))/2);--wp-ui-notice-background-color:var(--wpds-color-bg-surface-neutral-weak,#f4f4f4);--wp-ui-notice-border-color:var(--wpds-color-stroke-surface-neutral,#dbdbdb);--wp-ui-notice-text-color:var(--wpds-color-fg-content-neutral,#1e1e1e);--wp-ui-notice-decorative-icon-color:var(--wpds-color-fg-content-neutral,#1e1e1e);align-items:start;background-color:var(--wp-ui-notice-background-color);border:1px solid var(--wp-ui-notice-border-color);border-radius:var(--wpds-border-radius-lg,8px);container-type:inline-size;display:grid;grid-template-columns:auto 1fr auto;padding:var(--wpds-dimension-padding-md,12px)}.d0a25570cb528528__icon{color:var(--wp-ui-notice-decorative-icon-color);grid-column:1;grid-row:1;margin-inline-end:var(--wpds-dimension-gap-xs,4px)}._1904b570a89bb815__description,.b5397fb9d05389e3__title{color:var(--wp-ui-notice-text-color);grid-column:2;padding-block:var(--text-vertical-padding)}._1904b570a89bb815__description{text-wrap:pretty}._0a1270dcdd79c031__actions{display:flex;flex-wrap:wrap;gap:var(--wpds-dimension-gap-md,12px);grid-column:2}._4145abab73d17514__notice:has(._1904b570a89bb815__description) ._0a1270dcdd79c031__actions,._4145abab73d17514__notice:has(.b5397fb9d05389e3__title) ._0a1270dcdd79c031__actions{margin-block-start:var(--wpds-dimension-gap-sm,8px)}._983740ab855c4e09__action-button{flex-shrink:0}.d329e7416d368d31__action-link{flex-shrink:0;&:not(:first-child){margin-inline-start:var(--wpds-dimension-gap-xs,4px)}&:not(:last-child){margin-inline-end:var(--wpds-dimension-gap-xs,4px)}}._487e6a5c1375f7dc__close-icon{grid-column:3;grid-row:1;margin-inline-start:var(--wpds-dimension-gap-xs,4px)}._531c140826094795__is-info{--wp-ui-notice-background-color:var(--wpds-color-bg-surface-info-weak,#f3f9ff);--wp-ui-notice-border-color:var(--wpds-color-stroke-surface-info,#9fbcdc);--wp-ui-notice-text-color:var(--wpds-color-fg-content-info,#001b4f);--wp-ui-notice-decorative-icon-color:var(--wpds-color-fg-content-info-weak,#006bd7)}.ae2e1004697cce95__is-warning{--wp-ui-notice-background-color:var(--wpds-color-bg-surface-warning-weak,#fff7e1);--wp-ui-notice-border-color:var(--wpds-color-stroke-surface-warning,#d0b481);--wp-ui-notice-text-color:var(--wpds-color-fg-content-warning,#2e1900);--wp-ui-notice-decorative-icon-color:var(--wpds-color-fg-content-warning-weak,#926300)}._2e614a76af494837__is-success{--wp-ui-notice-background-color:var(--wpds-color-bg-surface-success-weak,#ebffed);--wp-ui-notice-border-color:var(--wpds-color-stroke-surface-success,#8ac894);--wp-ui-notice-text-color:var(--wpds-color-fg-content-success,#002900);--wp-ui-notice-decorative-icon-color:var(--wpds-color-fg-content-success-weak,#008030)}.af00331ae17a0065__is-error{--wp-ui-notice-background-color:var(--wpds-color-bg-surface-error-weak,#fff6f5);--wp-ui-notice-border-color:var(--wpds-color-stroke-surface-error,#daa39b);--wp-ui-notice-text-color:var(--wpds-color-fg-content-error,#470000);--wp-ui-notice-decorative-icon-color:var(--wpds-color-fg-content-error-weak,#cc1818)}@container (max-width: 320px){._4145abab73d17514__notice:has(.b5397fb9d05389e3__title) ._0a1270dcdd79c031__actions,._4145abab73d17514__notice:has(.b5397fb9d05389e3__title) ._1904b570a89bb815__description{grid-column:1/3}}}@layer wp-ui-compositions{.d329e7416d368d31__action-link{margin-block:auto}._487e6a5c1375f7dc__close-icon,._983740ab855c4e09__action-button:is(._8ddb8fb33fbf3d38__is-action-button-outline,._77bbde495a8a0af3__is-action-button-minimal){--wp-ui-button-background-color-active:color-mix(in srgb,#0000 50%,var(--wpds-color-bg-interactive-neutral-weak-active,#ededed))}}"); 21735 } 21736 var style_default41 = { "notice": "_4145abab73d17514__notice", "icon": "d0a25570cb528528__icon", "title": "b5397fb9d05389e3__title", "description": "_1904b570a89bb815__description", "actions": "_0a1270dcdd79c031__actions", "action-button": "_983740ab855c4e09__action-button", "action-link": "d329e7416d368d31__action-link", "close-icon": "_487e6a5c1375f7dc__close-icon", "is-info": "_531c140826094795__is-info", "is-warning": "ae2e1004697cce95__is-warning", "is-success": "_2e614a76af494837__is-success", "is-error": "af00331ae17a0065__is-error", "is-action-button-outline": "_8ddb8fb33fbf3d38__is-action-button-outline", "is-action-button-minimal": "_77bbde495a8a0af3__is-action-button-minimal" }; 21737 var ActionButton = (0, import_element84.forwardRef)( 21738 function NoticeActionButton({ className, loading, loadingAnnouncement, variant, ...props }, ref) { 21739 const loadingProps = loading !== void 0 ? { loading, loadingAnnouncement: loadingAnnouncement ?? "" } : {}; 21740 return /* @__PURE__ */ (0, import_jsx_runtime111.jsx)( 21741 Button4, 21742 { 21743 ...props, 21744 ...loadingProps, 21745 ref, 21746 size: "compact", 21747 tone: "neutral", 21748 variant, 21749 className: clsx_default( 21750 style_default41["action-button"], 21751 style_default41[`is-action-button-$variant}`], 21752 className 21753 ) 21754 } 21755 ); 21756 } 21757 ); 21758 21759 // packages/ui/build-module/notice/action-link.mjs 21760 var import_element85 = __toESM(require_element(), 1); 21761 var import_jsx_runtime112 = __toESM(require_jsx_runtime(), 1); 21762 var STYLE_HASH_ATTRIBUTE45 = "data-wp-hash"; 21763 function getRuntime45() { 21764 const globalScope = globalThis; 21765 if (globalScope.__wpStyleRuntime) { 21766 return globalScope.__wpStyleRuntime; 21767 } 21768 globalScope.__wpStyleRuntime = { 21769 documents: /* @__PURE__ */ new Map(), 21770 styles: /* @__PURE__ */ new Map(), 21771 injectedStyles: /* @__PURE__ */ new WeakMap() 21772 }; 21773 if (typeof document !== "undefined") { 21774 registerDocument45(document); 21775 } 21776 return globalScope.__wpStyleRuntime; 21777 } 21778 function documentContainsStyleHash45(targetDocument, hash) { 21779 if (!targetDocument.head) { 21780 return false; 21781 } 21782 for (const style of targetDocument.head.querySelectorAll( 21783 `style[$STYLE_HASH_ATTRIBUTE45}]` 21784 )) { 21785 if (style.getAttribute(STYLE_HASH_ATTRIBUTE45) === hash) { 21786 return true; 21787 } 21788 } 21789 return false; 21790 } 21791 function injectStyle45(targetDocument, hash, css) { 21792 if (!targetDocument.head) { 21793 return; 21794 } 21795 const runtime = getRuntime45(); 21796 let injectedStyles = runtime.injectedStyles.get(targetDocument); 21797 if (!injectedStyles) { 21798 injectedStyles = /* @__PURE__ */ new Set(); 21799 runtime.injectedStyles.set(targetDocument, injectedStyles); 21800 } 21801 if (injectedStyles.has(hash)) { 21802 return; 21803 } 21804 if (documentContainsStyleHash45(targetDocument, hash)) { 21805 injectedStyles.add(hash); 21806 return; 21807 } 21808 const style = targetDocument.createElement("style"); 21809 style.setAttribute(STYLE_HASH_ATTRIBUTE45, hash); 21810 style.appendChild(targetDocument.createTextNode(css)); 21811 targetDocument.head.appendChild(style); 21812 injectedStyles.add(hash); 21813 } 21814 function registerDocument45(targetDocument) { 21815 const runtime = getRuntime45(); 21816 runtime.documents.set( 21817 targetDocument, 21818 (runtime.documents.get(targetDocument) ?? 0) + 1 21819 ); 21820 for (const [hash, css] of runtime.styles) { 21821 injectStyle45(targetDocument, hash, css); 21822 } 21823 return () => { 21824 const count = runtime.documents.get(targetDocument); 21825 if (count === void 0) { 21826 return; 21827 } 21828 if (count <= 1) { 21829 runtime.documents.delete(targetDocument); 21830 return; 21831 } 21832 runtime.documents.set(targetDocument, count - 1); 21833 }; 21834 } 21835 function registerStyle45(hash, css) { 21836 const runtime = getRuntime45(); 21837 runtime.styles.set(hash, css); 21838 for (const targetDocument of runtime.documents.keys()) { 21839 injectStyle45(targetDocument, hash, css); 21840 } 21841 } 21842 if (typeof process === "undefined" || true) { 21843 registerStyle45("60dd1d4d42", "@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;@layer wp-ui-components{._4145abab73d17514__notice{--icon-height:24px;--text-vertical-padding:calc((var(--icon-height) - var(--wpds-typography-line-height-sm, 20px))/2);--wp-ui-notice-background-color:var(--wpds-color-bg-surface-neutral-weak,#f4f4f4);--wp-ui-notice-border-color:var(--wpds-color-stroke-surface-neutral,#dbdbdb);--wp-ui-notice-text-color:var(--wpds-color-fg-content-neutral,#1e1e1e);--wp-ui-notice-decorative-icon-color:var(--wpds-color-fg-content-neutral,#1e1e1e);align-items:start;background-color:var(--wp-ui-notice-background-color);border:1px solid var(--wp-ui-notice-border-color);border-radius:var(--wpds-border-radius-lg,8px);container-type:inline-size;display:grid;grid-template-columns:auto 1fr auto;padding:var(--wpds-dimension-padding-md,12px)}.d0a25570cb528528__icon{color:var(--wp-ui-notice-decorative-icon-color);grid-column:1;grid-row:1;margin-inline-end:var(--wpds-dimension-gap-xs,4px)}._1904b570a89bb815__description,.b5397fb9d05389e3__title{color:var(--wp-ui-notice-text-color);grid-column:2;padding-block:var(--text-vertical-padding)}._1904b570a89bb815__description{text-wrap:pretty}._0a1270dcdd79c031__actions{display:flex;flex-wrap:wrap;gap:var(--wpds-dimension-gap-md,12px);grid-column:2}._4145abab73d17514__notice:has(._1904b570a89bb815__description) ._0a1270dcdd79c031__actions,._4145abab73d17514__notice:has(.b5397fb9d05389e3__title) ._0a1270dcdd79c031__actions{margin-block-start:var(--wpds-dimension-gap-sm,8px)}._983740ab855c4e09__action-button{flex-shrink:0}.d329e7416d368d31__action-link{flex-shrink:0;&:not(:first-child){margin-inline-start:var(--wpds-dimension-gap-xs,4px)}&:not(:last-child){margin-inline-end:var(--wpds-dimension-gap-xs,4px)}}._487e6a5c1375f7dc__close-icon{grid-column:3;grid-row:1;margin-inline-start:var(--wpds-dimension-gap-xs,4px)}._531c140826094795__is-info{--wp-ui-notice-background-color:var(--wpds-color-bg-surface-info-weak,#f3f9ff);--wp-ui-notice-border-color:var(--wpds-color-stroke-surface-info,#9fbcdc);--wp-ui-notice-text-color:var(--wpds-color-fg-content-info,#001b4f);--wp-ui-notice-decorative-icon-color:var(--wpds-color-fg-content-info-weak,#006bd7)}.ae2e1004697cce95__is-warning{--wp-ui-notice-background-color:var(--wpds-color-bg-surface-warning-weak,#fff7e1);--wp-ui-notice-border-color:var(--wpds-color-stroke-surface-warning,#d0b481);--wp-ui-notice-text-color:var(--wpds-color-fg-content-warning,#2e1900);--wp-ui-notice-decorative-icon-color:var(--wpds-color-fg-content-warning-weak,#926300)}._2e614a76af494837__is-success{--wp-ui-notice-background-color:var(--wpds-color-bg-surface-success-weak,#ebffed);--wp-ui-notice-border-color:var(--wpds-color-stroke-surface-success,#8ac894);--wp-ui-notice-text-color:var(--wpds-color-fg-content-success,#002900);--wp-ui-notice-decorative-icon-color:var(--wpds-color-fg-content-success-weak,#008030)}.af00331ae17a0065__is-error{--wp-ui-notice-background-color:var(--wpds-color-bg-surface-error-weak,#fff6f5);--wp-ui-notice-border-color:var(--wpds-color-stroke-surface-error,#daa39b);--wp-ui-notice-text-color:var(--wpds-color-fg-content-error,#470000);--wp-ui-notice-decorative-icon-color:var(--wpds-color-fg-content-error-weak,#cc1818)}@container (max-width: 320px){._4145abab73d17514__notice:has(.b5397fb9d05389e3__title) ._0a1270dcdd79c031__actions,._4145abab73d17514__notice:has(.b5397fb9d05389e3__title) ._1904b570a89bb815__description{grid-column:1/3}}}@layer wp-ui-compositions{.d329e7416d368d31__action-link{margin-block:auto}._487e6a5c1375f7dc__close-icon,._983740ab855c4e09__action-button:is(._8ddb8fb33fbf3d38__is-action-button-outline,._77bbde495a8a0af3__is-action-button-minimal){--wp-ui-button-background-color-active:color-mix(in srgb,#0000 50%,var(--wpds-color-bg-interactive-neutral-weak-active,#ededed))}}"); 21844 } 21845 var style_default42 = { "notice": "_4145abab73d17514__notice", "icon": "d0a25570cb528528__icon", "title": "b5397fb9d05389e3__title", "description": "_1904b570a89bb815__description", "actions": "_0a1270dcdd79c031__actions", "action-button": "_983740ab855c4e09__action-button", "action-link": "d329e7416d368d31__action-link", "close-icon": "_487e6a5c1375f7dc__close-icon", "is-info": "_531c140826094795__is-info", "is-warning": "ae2e1004697cce95__is-warning", "is-success": "_2e614a76af494837__is-success", "is-error": "af00331ae17a0065__is-error", "is-action-button-outline": "_8ddb8fb33fbf3d38__is-action-button-outline", "is-action-button-minimal": "_77bbde495a8a0af3__is-action-button-minimal" }; 21846 var ActionLink = (0, import_element85.forwardRef)( 21847 function NoticeActionLink({ className, render: render4, ...props }, ref) { 21848 return /* @__PURE__ */ (0, import_jsx_runtime112.jsx)( 21849 Text, 21850 { 21851 ref, 21852 className: clsx_default(style_default42["action-link"], className), 21853 ...props, 21854 variant: "body-md", 21855 render: /* @__PURE__ */ (0, import_jsx_runtime112.jsx)(Link, { tone: "neutral", variant: "default", render: render4 }) 21856 } 21857 ); 21858 } 21859 ); 21860 21861 // packages/admin-ui/build-module/navigable-region/index.mjs 21862 var import_element86 = __toESM(require_element(), 1); 21863 var import_jsx_runtime113 = __toESM(require_jsx_runtime(), 1); 21864 var NavigableRegion = (0, import_element86.forwardRef)( 21865 ({ children, className, ariaLabel, as: Tag = "div", ...props }, ref) => { 21866 return /* @__PURE__ */ (0, import_jsx_runtime113.jsx)( 21867 Tag, 21868 { 21869 ref, 21870 className: clsx_default("admin-ui-navigable-region", className), 21871 "aria-label": ariaLabel, 21872 role: "region", 21873 tabIndex: "-1", 21874 ...props, 21875 children 21876 } 21877 ); 21878 } 21879 ); 21880 NavigableRegion.displayName = "NavigableRegion"; 21881 var navigable_region_default = NavigableRegion; 21882 21883 // packages/admin-ui/build-module/page/sidebar-toggle-slot.mjs 21884 var import_components = __toESM(require_components(), 1); 21885 var { Fill: SidebarToggleFill, Slot: SidebarToggleSlot } = (0, import_components.createSlotFill)("SidebarToggle"); 21886 21887 // packages/admin-ui/build-module/page/header.mjs 21888 var import_jsx_runtime114 = __toESM(require_jsx_runtime(), 1); 21889 var STYLE_HASH_ATTRIBUTE46 = "data-wp-hash"; 21890 function getRuntime46() { 21891 const globalScope = globalThis; 21892 if (globalScope.__wpStyleRuntime) { 21893 return globalScope.__wpStyleRuntime; 21894 } 21895 globalScope.__wpStyleRuntime = { 21896 documents: /* @__PURE__ */ new Map(), 21897 styles: /* @__PURE__ */ new Map(), 21898 injectedStyles: /* @__PURE__ */ new WeakMap() 21899 }; 21900 if (typeof document !== "undefined") { 21901 registerDocument46(document); 21902 } 21903 return globalScope.__wpStyleRuntime; 21904 } 21905 function documentContainsStyleHash46(targetDocument, hash) { 21906 if (!targetDocument.head) { 21907 return false; 21908 } 21909 for (const style of targetDocument.head.querySelectorAll( 21910 `style[$STYLE_HASH_ATTRIBUTE46}]` 21911 )) { 21912 if (style.getAttribute(STYLE_HASH_ATTRIBUTE46) === hash) { 21913 return true; 21914 } 21915 } 21916 return false; 21917 } 21918 function injectStyle46(targetDocument, hash, css) { 21919 if (!targetDocument.head) { 21920 return; 21921 } 21922 const runtime = getRuntime46(); 21923 let injectedStyles = runtime.injectedStyles.get(targetDocument); 21924 if (!injectedStyles) { 21925 injectedStyles = /* @__PURE__ */ new Set(); 21926 runtime.injectedStyles.set(targetDocument, injectedStyles); 21927 } 21928 if (injectedStyles.has(hash)) { 21929 return; 21930 } 21931 if (documentContainsStyleHash46(targetDocument, hash)) { 21932 injectedStyles.add(hash); 21933 return; 21934 } 21935 const style = targetDocument.createElement("style"); 21936 style.setAttribute(STYLE_HASH_ATTRIBUTE46, hash); 21937 style.appendChild(targetDocument.createTextNode(css)); 21938 targetDocument.head.appendChild(style); 21939 injectedStyles.add(hash); 21940 } 21941 function registerDocument46(targetDocument) { 21942 const runtime = getRuntime46(); 21943 runtime.documents.set( 21944 targetDocument, 21945 (runtime.documents.get(targetDocument) ?? 0) + 1 21946 ); 21947 for (const [hash, css] of runtime.styles) { 21948 injectStyle46(targetDocument, hash, css); 21949 } 21950 return () => { 21951 const count = runtime.documents.get(targetDocument); 21952 if (count === void 0) { 21953 return; 21954 } 21955 if (count <= 1) { 21956 runtime.documents.delete(targetDocument); 21957 return; 21958 } 21959 runtime.documents.set(targetDocument, count - 1); 21960 }; 21961 } 21962 function registerStyle46(hash, css) { 21963 const runtime = getRuntime46(); 21964 runtime.styles.set(hash, css); 21965 for (const targetDocument of runtime.documents.keys()) { 21966 injectStyle46(targetDocument, hash, css); 21967 } 21968 } 21969 if (typeof process === "undefined" || true) { 21970 registerStyle46("aa9c241ccc", "._956b6df0898efed0__page{text-wrap:pretty;background-color:var(--wpds-color-bg-surface-neutral,#fcfcfc);color:var(--wpds-color-fg-content-neutral,#1e1e1e);display:flex;flex-flow:column;height:100%;position:relative;z-index:1}._0625b55e82a0d93d__header{background:var(--wpds-color-bg-surface-neutral-strong,#fff);border-block-end:var(--wpds-border-width-xs,1px) solid var(--wpds-color-stroke-surface-neutral-weak,#e4e4e4);inset-block-start:0;padding:var(--wpds-dimension-padding-lg,16px) var(--wpds-dimension-padding-2xl,24px);position:sticky;z-index:1}.a43c44d5ae28b2e8__header-content{min-height:calc(var(--wpds-dimension-base, 4px)*8)}.b7cb5b9daf3a3b25__header-actions{flex-shrink:0}._8113be94e7caf73c__header-title{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}._9a776c7f70996f61__header-visual{display:grid;flex-shrink:0;grid-template-columns:1fr;grid-template-rows:1fr;height:calc(var(--wpds-dimension-base, 4px)*6);width:calc(var(--wpds-dimension-base, 4px)*6);>*{grid-column:1/-1;grid-row:1/-1;max-height:100%;max-width:100%}}.d5e0920cd15d35bc__sidebar-toggle-slot:empty{display:none}._60fea2f6bf5319cd__header-subtitle{color:var(--wpds-color-fg-content-neutral-weak,#707070);padding-block-end:var(--wpds-dimension-padding-xs,4px)}.be5e57d029ec4036__content{display:flex;flex-direction:column;flex-grow:1;overflow:auto;&._128806d0b26e3a50__has-padding{padding:var(--wpds-dimension-padding-lg,16px) var(--wpds-dimension-padding-2xl,24px)}}"); 21971 } 21972 var style_default43 = { "page": "_956b6df0898efed0__page", "header": "_0625b55e82a0d93d__header", "header-content": "a43c44d5ae28b2e8__header-content", "header-actions": "b7cb5b9daf3a3b25__header-actions", "header-title": "_8113be94e7caf73c__header-title", "header-visual": "_9a776c7f70996f61__header-visual", "sidebar-toggle-slot": "d5e0920cd15d35bc__sidebar-toggle-slot", "header-subtitle": "_60fea2f6bf5319cd__header-subtitle", "content": "be5e57d029ec4036__content", "has-padding": "_128806d0b26e3a50__has-padding" }; 21973 function Header5({ 21974 headingLevel = 1, 21975 breadcrumbs, 21976 badges, 21977 visual, 21978 title, 21979 subTitle, 21980 actions, 21981 showSidebarToggle = true 21982 }) { 21983 const HeadingTag = `h$headingLevel}`; 21984 return /* @__PURE__ */ (0, import_jsx_runtime114.jsxs)(Stack, { direction: "column", className: style_default43.header, children: [ 21985 /* @__PURE__ */ (0, import_jsx_runtime114.jsxs)( 21986 Stack, 21987 { 21988 className: style_default43["header-content"], 21989 direction: "row", 21990 gap: "sm", 21991 justify: "space-between", 21992 children: [ 21993 /* @__PURE__ */ (0, import_jsx_runtime114.jsxs)(Stack, { direction: "row", gap: "sm", align: "center", justify: "start", children: [ 21994 showSidebarToggle && /* @__PURE__ */ (0, import_jsx_runtime114.jsx)( 21995 SidebarToggleSlot, 21996 { 21997 bubblesVirtually: true, 21998 className: style_default43["sidebar-toggle-slot"] 21999 } 22000 ), 22001 visual && /* @__PURE__ */ (0, import_jsx_runtime114.jsx)( 22002 "div", 22003 { 22004 className: style_default43["header-visual"], 22005 "aria-hidden": "true", 22006 children: visual 22007 } 22008 ), 22009 title && /* @__PURE__ */ (0, import_jsx_runtime114.jsx)( 22010 Text, 22011 { 22012 className: style_default43["header-title"], 22013 render: /* @__PURE__ */ (0, import_jsx_runtime114.jsx)(HeadingTag, {}), 22014 variant: "heading-lg", 22015 children: title 22016 } 22017 ), 22018 breadcrumbs, 22019 badges 22020 ] }), 22021 actions && /* @__PURE__ */ (0, import_jsx_runtime114.jsx)( 22022 Stack, 22023 { 22024 align: "center", 22025 className: style_default43["header-actions"], 22026 direction: "row", 22027 gap: "sm", 22028 children: actions 22029 } 22030 ) 22031 ] 22032 } 22033 ), 22034 subTitle && /* @__PURE__ */ (0, import_jsx_runtime114.jsx)( 22035 Text, 22036 { 22037 render: /* @__PURE__ */ (0, import_jsx_runtime114.jsx)("p", {}), 22038 variant: "body-md", 22039 className: style_default43["header-subtitle"], 22040 children: subTitle 22041 } 22042 ) 22043 ] }); 22044 } 22045 22046 // packages/admin-ui/build-module/page/index.mjs 22047 var import_jsx_runtime115 = __toESM(require_jsx_runtime(), 1); 22048 var STYLE_HASH_ATTRIBUTE47 = "data-wp-hash"; 22049 function getRuntime47() { 22050 const globalScope = globalThis; 22051 if (globalScope.__wpStyleRuntime) { 22052 return globalScope.__wpStyleRuntime; 22053 } 22054 globalScope.__wpStyleRuntime = { 22055 documents: /* @__PURE__ */ new Map(), 22056 styles: /* @__PURE__ */ new Map(), 22057 injectedStyles: /* @__PURE__ */ new WeakMap() 22058 }; 22059 if (typeof document !== "undefined") { 22060 registerDocument47(document); 22061 } 22062 return globalScope.__wpStyleRuntime; 22063 } 22064 function documentContainsStyleHash47(targetDocument, hash) { 22065 if (!targetDocument.head) { 22066 return false; 22067 } 22068 for (const style of targetDocument.head.querySelectorAll( 22069 `style[$STYLE_HASH_ATTRIBUTE47}]` 22070 )) { 22071 if (style.getAttribute(STYLE_HASH_ATTRIBUTE47) === hash) { 22072 return true; 22073 } 22074 } 22075 return false; 22076 } 22077 function injectStyle47(targetDocument, hash, css) { 22078 if (!targetDocument.head) { 22079 return; 22080 } 22081 const runtime = getRuntime47(); 22082 let injectedStyles = runtime.injectedStyles.get(targetDocument); 22083 if (!injectedStyles) { 22084 injectedStyles = /* @__PURE__ */ new Set(); 22085 runtime.injectedStyles.set(targetDocument, injectedStyles); 22086 } 22087 if (injectedStyles.has(hash)) { 22088 return; 22089 } 22090 if (documentContainsStyleHash47(targetDocument, hash)) { 22091 injectedStyles.add(hash); 22092 return; 22093 } 22094 const style = targetDocument.createElement("style"); 22095 style.setAttribute(STYLE_HASH_ATTRIBUTE47, hash); 22096 style.appendChild(targetDocument.createTextNode(css)); 22097 targetDocument.head.appendChild(style); 22098 injectedStyles.add(hash); 22099 } 22100 function registerDocument47(targetDocument) { 22101 const runtime = getRuntime47(); 22102 runtime.documents.set( 22103 targetDocument, 22104 (runtime.documents.get(targetDocument) ?? 0) + 1 22105 ); 22106 for (const [hash, css] of runtime.styles) { 22107 injectStyle47(targetDocument, hash, css); 22108 } 22109 return () => { 22110 const count = runtime.documents.get(targetDocument); 22111 if (count === void 0) { 22112 return; 22113 } 22114 if (count <= 1) { 22115 runtime.documents.delete(targetDocument); 22116 return; 22117 } 22118 runtime.documents.set(targetDocument, count - 1); 22119 }; 22120 } 22121 function registerStyle47(hash, css) { 22122 const runtime = getRuntime47(); 22123 runtime.styles.set(hash, css); 22124 for (const targetDocument of runtime.documents.keys()) { 22125 injectStyle47(targetDocument, hash, css); 22126 } 22127 } 22128 if (typeof process === "undefined" || true) { 22129 registerStyle47("aa9c241ccc", "._956b6df0898efed0__page{text-wrap:pretty;background-color:var(--wpds-color-bg-surface-neutral,#fcfcfc);color:var(--wpds-color-fg-content-neutral,#1e1e1e);display:flex;flex-flow:column;height:100%;position:relative;z-index:1}._0625b55e82a0d93d__header{background:var(--wpds-color-bg-surface-neutral-strong,#fff);border-block-end:var(--wpds-border-width-xs,1px) solid var(--wpds-color-stroke-surface-neutral-weak,#e4e4e4);inset-block-start:0;padding:var(--wpds-dimension-padding-lg,16px) var(--wpds-dimension-padding-2xl,24px);position:sticky;z-index:1}.a43c44d5ae28b2e8__header-content{min-height:calc(var(--wpds-dimension-base, 4px)*8)}.b7cb5b9daf3a3b25__header-actions{flex-shrink:0}._8113be94e7caf73c__header-title{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}._9a776c7f70996f61__header-visual{display:grid;flex-shrink:0;grid-template-columns:1fr;grid-template-rows:1fr;height:calc(var(--wpds-dimension-base, 4px)*6);width:calc(var(--wpds-dimension-base, 4px)*6);>*{grid-column:1/-1;grid-row:1/-1;max-height:100%;max-width:100%}}.d5e0920cd15d35bc__sidebar-toggle-slot:empty{display:none}._60fea2f6bf5319cd__header-subtitle{color:var(--wpds-color-fg-content-neutral-weak,#707070);padding-block-end:var(--wpds-dimension-padding-xs,4px)}.be5e57d029ec4036__content{display:flex;flex-direction:column;flex-grow:1;overflow:auto;&._128806d0b26e3a50__has-padding{padding:var(--wpds-dimension-padding-lg,16px) var(--wpds-dimension-padding-2xl,24px)}}"); 22130 } 22131 var style_default44 = { "page": "_956b6df0898efed0__page", "header": "_0625b55e82a0d93d__header", "header-content": "a43c44d5ae28b2e8__header-content", "header-actions": "b7cb5b9daf3a3b25__header-actions", "header-title": "_8113be94e7caf73c__header-title", "header-visual": "_9a776c7f70996f61__header-visual", "sidebar-toggle-slot": "d5e0920cd15d35bc__sidebar-toggle-slot", "header-subtitle": "_60fea2f6bf5319cd__header-subtitle", "content": "be5e57d029ec4036__content", "has-padding": "_128806d0b26e3a50__has-padding" }; 22132 function Page({ 22133 headingLevel, 22134 breadcrumbs, 22135 badges, 22136 visual, 22137 title, 22138 subTitle, 22139 children, 22140 className, 22141 actions, 22142 ariaLabel, 22143 hasPadding = false, 22144 showSidebarToggle = true 22145 }) { 22146 const classes = clsx_default(style_default44.page, className); 22147 const effectiveAriaLabel = ariaLabel ?? (typeof title === "string" ? title : ""); 22148 return /* @__PURE__ */ (0, import_jsx_runtime115.jsxs)(navigable_region_default, { className: classes, ariaLabel: effectiveAriaLabel, children: [ 22149 (title || breadcrumbs || badges || actions || visual) && /* @__PURE__ */ (0, import_jsx_runtime115.jsx)( 22150 Header5, 22151 { 22152 headingLevel, 22153 breadcrumbs, 22154 badges, 22155 visual, 22156 title, 22157 subTitle, 22158 actions, 22159 showSidebarToggle 22160 } 22161 ), 22162 hasPadding ? /* @__PURE__ */ (0, import_jsx_runtime115.jsx)( 22163 "div", 22164 { 22165 className: clsx_default( 22166 style_default44.content, 22167 style_default44["has-padding"] 22168 ), 22169 children 22170 } 22171 ) : children 22172 ] }); 22173 } 22174 Page.SidebarToggleFill = SidebarToggleFill; 22175 var page_default = Page; 22176 22177 // routes/dashboard/stage.tsx 22178 var import_data10 = __toESM(require_data()); 22179 var import_element181 = __toESM(require_element()); 22180 var import_i18n69 = __toESM(require_i18n()); 22181 var import_notices = __toESM(require_notices()); 22182 var import_viewport2 = __toESM(require_viewport()); 22183 22184 // routes/dashboard/hooks/use-dashboard-layout/use-dashboard-layout.ts 22185 var import_api_fetch = __toESM(require_api_fetch()); 22186 var import_data = __toESM(require_data()); 22187 var import_preferences = __toESM(require_preferences()); 22188 var SCOPE = "core/dashboard"; 22189 var KEY = "dashboardLayout"; 22190 function useDashboardLayout(dashboardName) { 22191 const layout = (0, import_data.useSelect)( 22192 (select) => select(import_preferences.store).get(SCOPE, KEY) ?? [], 22193 [] 22194 ); 22195 const { set: set3 } = (0, import_data.useDispatch)(import_preferences.store); 22196 function setLayout(newLayout) { 22197 void set3(SCOPE, KEY, newLayout); 22198 } 22199 async function resetLayout() { 22200 const fresh = await (0, import_api_fetch.default)({ 22201 path: `/wp/v2/dashboards/$dashboardName}/default-layout` 22202 }); 22203 void set3(SCOPE, KEY, fresh); 22204 } 22205 return [layout, setLayout, resetLayout]; 22206 } 22207 22208 // routes/dashboard/hooks/use-dashboard-grid-settings/use-dashboard-grid-settings.ts 22209 var import_es6 = __toESM(require_es6()); 22210 var import_data2 = __toESM(require_data()); 22211 var import_preferences2 = __toESM(require_preferences()); 22212 var SCOPE2 = "core/dashboard"; 22213 var KEY2 = "dashboardGridSettings"; 22214 var DEFAULT_GRID_SETTINGS = { 22215 model: "grid", 22216 columns: 12, 22217 minColumnWidth: 140, 22218 rowHeight: 140 22219 }; 22220 function useDashboardGridSettings() { 22221 const settings = (0, import_data2.useSelect)( 22222 (select) => select(import_preferences2.store).get(SCOPE2, KEY2) ?? DEFAULT_GRID_SETTINGS, 22223 [] 22224 ); 22225 const { set: set3 } = (0, import_data2.useDispatch)(import_preferences2.store); 22226 function setSettings(next) { 22227 if ((0, import_es6.default)(next, DEFAULT_GRID_SETTINGS)) { 22228 void set3(SCOPE2, KEY2, null); 22229 return; 22230 } 22231 void set3(SCOPE2, KEY2, next); 22232 } 22233 function resetSettings() { 22234 void set3(SCOPE2, KEY2, null); 22235 } 22236 return [settings, setSettings, resetSettings]; 22237 } 22238 22239 // routes/dashboard/widget-dashboard/context/dashboard-context.tsx 22240 var import_es62 = __toESM(require_es6()); 22241 var import_element87 = __toESM(require_element()); 22242 22243 // routes/dashboard/widget-dashboard/utils/migrate-layout/migrate-layout.ts 22244 var FALLBACK_COLUMNS = 6; 22245 function gridWidthToMasonryWidth(width, targetColumns) { 22246 if (width === "full") { 22247 return targetColumns; 22248 } 22249 if (width === "fill" || width === void 0) { 22250 return 1; 22251 } 22252 return width; 22253 } 22254 function migratePlacementGridToMasonry(placement, context) { 22255 if (!placement) { 22256 return {}; 22257 } 22258 const next = {}; 22259 const width = gridWidthToMasonryWidth(placement.width, context.columns); 22260 if (width !== 1) { 22261 next.width = width; 22262 } 22263 if (placement.order !== void 0) { 22264 next.order = placement.order; 22265 } 22266 return next; 22267 } 22268 function migratePlacementMasonryToGrid(placement) { 22269 if (!placement) { 22270 return { height: 1 }; 22271 } 22272 const next = { height: 1 }; 22273 if (placement.width !== void 0) { 22274 next.width = placement.width; 22275 } 22276 if (placement.order !== void 0) { 22277 next.order = placement.order; 22278 } 22279 return next; 22280 } 22281 function migrateLayout(widgets, from, to, context = {}) { 22282 const resolvedFrom = from ?? "grid"; 22283 if (resolvedFrom === to) { 22284 return widgets; 22285 } 22286 const resolvedContext = { 22287 columns: context.columns ?? FALLBACK_COLUMNS 22288 }; 22289 if (resolvedFrom === "grid" && to === "masonry") { 22290 return widgets.map((widget) => ({ 22291 ...widget, 22292 placement: migratePlacementGridToMasonry( 22293 widget.placement, 22294 resolvedContext 22295 ) 22296 })); 22297 } 22298 if (resolvedFrom === "masonry" && to === "grid") { 22299 return widgets.map((widget) => ({ 22300 ...widget, 22301 placement: migratePlacementMasonryToGrid( 22302 widget.placement 22303 ) 22304 })); 22305 } 22306 return widgets; 22307 } 22308 22309 // routes/dashboard/widget-dashboard/utils/grid-model-change/grid-model-change.ts 22310 var DEFAULT_FIXED_COLUMNS = 6; 22311 function getGridModel(settings) { 22312 return settings.model ?? "grid"; 22313 } 22314 function computeGridModelChange({ 22315 layout, 22316 gridSettings, 22317 targetModel 22318 }) { 22319 const currentModel = getGridModel(gridSettings); 22320 if (currentModel === targetModel) { 22321 return null; 22322 } 22323 return { 22324 layout: migrateLayout(layout, currentModel, targetModel, { 22325 columns: gridSettings.columns ?? DEFAULT_FIXED_COLUMNS 22326 }), 22327 gridSettings: { 22328 ...gridSettings, 22329 model: targetModel 22330 } 22331 }; 22332 } 22333 22334 // routes/dashboard/widget-dashboard/context/dashboard-context.tsx 22335 var import_jsx_runtime116 = __toESM(require_jsx_runtime()); 22336 var DEFAULT_GRID = { 22337 model: "grid", 22338 columns: 12, 22339 minColumnWidth: 140, 22340 rowHeight: 140 22341 }; 22342 function resolveGridSettings(settings) { 22343 return { 22344 ...settings, 22345 columns: settings.columns ?? DEFAULT_GRID.columns 22346 }; 22347 } 22348 var DEFAULT_RESOLVE_WIDGET_MODULE = (moduleId) => import( 22349 /* webpackIgnore: true */ 22350 moduleId 22351 ); 22352 function canonicalize(layout) { 22353 const indexed = layout.map((widget, index2) => ({ 22354 widget, 22355 order: widget.placement?.order ?? index2 22356 })); 22357 indexed.sort((a2, b2) => a2.order - b2.order); 22358 return indexed.map(({ widget }) => { 22359 if (!widget.placement) { 22360 return widget; 22361 } 22362 const { order: _stripped, ...placement } = widget.placement; 22363 return { ...widget, placement }; 22364 }); 22365 } 22366 var Context = (0, import_element87.createContext)(null); 22367 function useDashboardInternalContext() { 22368 const ctx8 = (0, import_element87.useContext)(Context); 22369 if (!ctx8) { 22370 throw new Error( 22371 "Dashboard compound used outside a WidgetDashboard subtree." 22372 ); 22373 } 22374 return ctx8; 22375 } 22376 function WidgetDashboardProvider({ 22377 widgetTypes, 22378 layout: committedLayout, 22379 onLayoutChange, 22380 onLayoutReset, 22381 editMode = false, 22382 onEditChange, 22383 resolveWidgetModule = DEFAULT_RESOLVE_WIDGET_MODULE, 22384 gridSettings: committedGridSettings = DEFAULT_GRID, 22385 onGridSettingsChange, 22386 children 22387 }) { 22388 const [stagingLayout, setStagingLayout] = (0, import_element87.useState)(committedLayout); 22389 (0, import_element87.useEffect)(() => { 22390 setStagingLayout(committedLayout); 22391 }, [committedLayout]); 22392 const [stagingGridSettings, setStagingGridSettings] = (0, import_element87.useState)(committedGridSettings); 22393 (0, import_element87.useEffect)(() => { 22394 setStagingGridSettings(committedGridSettings); 22395 }, [committedGridSettings]); 22396 const hasLayoutChanges = (0, import_element87.useMemo)( 22397 () => !(0, import_es62.default)( 22398 canonicalize(committedLayout), 22399 canonicalize(stagingLayout) 22400 ), 22401 [committedLayout, stagingLayout] 22402 ); 22403 const hasGridSettingsChanges = (0, import_element87.useMemo)( 22404 () => !(0, import_es62.default)(committedGridSettings, stagingGridSettings), 22405 [committedGridSettings, stagingGridSettings] 22406 ); 22407 const hasUncommittedChanges = hasLayoutChanges || hasGridSettingsChanges; 22408 const commit = (0, import_element87.useCallback)( 22409 (options) => { 22410 if (hasLayoutChanges) { 22411 onLayoutChange(canonicalize(stagingLayout)); 22412 } 22413 if (hasGridSettingsChanges) { 22414 onGridSettingsChange?.(stagingGridSettings); 22415 } 22416 if (options?.exitEditMode !== false) { 22417 onEditChange?.(false); 22418 } 22419 }, 22420 [ 22421 hasLayoutChanges, 22422 hasGridSettingsChanges, 22423 onLayoutChange, 22424 onGridSettingsChange, 22425 stagingLayout, 22426 stagingGridSettings, 22427 onEditChange 22428 ] 22429 ); 22430 const cancel = (0, import_element87.useCallback)( 22431 (options) => { 22432 setStagingLayout(committedLayout); 22433 setStagingGridSettings(committedGridSettings); 22434 if (options?.exitEditMode !== false) { 22435 onEditChange?.(false); 22436 } 22437 }, 22438 [committedLayout, committedGridSettings, onEditChange] 22439 ); 22440 const commitGridModelChange = (0, import_element87.useCallback)( 22441 (targetModel) => { 22442 const next = computeGridModelChange({ 22443 layout: stagingLayout, 22444 gridSettings: stagingGridSettings, 22445 targetModel 22446 }); 22447 if (!next) { 22448 return; 22449 } 22450 setStagingLayout(next.layout); 22451 setStagingGridSettings(next.gridSettings); 22452 onLayoutChange(canonicalize(next.layout)); 22453 onGridSettingsChange?.(next.gridSettings); 22454 onEditChange?.(false); 22455 }, 22456 [ 22457 stagingLayout, 22458 stagingGridSettings, 22459 onLayoutChange, 22460 onGridSettingsChange, 22461 onEditChange 22462 ] 22463 ); 22464 const resetGridSettings = (0, import_element87.useCallback)(() => { 22465 setStagingGridSettings(DEFAULT_GRID); 22466 }, []); 22467 (0, import_element87.useEffect)(() => { 22468 if (stagingLayout.length === 0) { 22469 onEditChange?.(true); 22470 } 22471 }, [stagingLayout.length === 0]); 22472 const canEditGridSettings = onGridSettingsChange !== void 0; 22473 const value = (0, import_element87.useMemo)( 22474 () => ({ 22475 widgetTypes, 22476 layout: stagingLayout, 22477 onLayoutChange: setStagingLayout, 22478 onLayoutReset, 22479 gridSettings: resolveGridSettings(stagingGridSettings), 22480 onGridSettingsChange: setStagingGridSettings, 22481 canEditGridSettings, 22482 resetGridSettings, 22483 commit, 22484 commitGridModelChange, 22485 cancel, 22486 hasUncommittedChanges, 22487 editMode, 22488 onEditChange, 22489 resolveWidgetModule 22490 }), 22491 [ 22492 widgetTypes, 22493 stagingLayout, 22494 onLayoutReset, 22495 stagingGridSettings, 22496 canEditGridSettings, 22497 resetGridSettings, 22498 commit, 22499 commitGridModelChange, 22500 cancel, 22501 hasUncommittedChanges, 22502 editMode, 22503 onEditChange, 22504 resolveWidgetModule 22505 ] 22506 ); 22507 return /* @__PURE__ */ (0, import_jsx_runtime116.jsx)(Context.Provider, { value, children }); 22508 } 22509 22510 // routes/dashboard/widget-dashboard/context/ui-context.tsx 22511 var import_element88 = __toESM(require_element()); 22512 var import_jsx_runtime117 = __toESM(require_jsx_runtime()); 22513 var Context2 = (0, import_element88.createContext)(null); 22514 function useDashboardUIContext() { 22515 const ctx8 = (0, import_element88.useContext)(Context2); 22516 if (!ctx8) { 22517 throw new Error( 22518 "Dashboard compound used outside a WidgetDashboard subtree." 22519 ); 22520 } 22521 return ctx8; 22522 } 22523 function WidgetDashboardUIProvider({ children }) { 22524 const [inserterOpen, setInserterOpen] = (0, import_element88.useState)(false); 22525 const [layoutSettingsOpen, setLayoutSettingsOpen] = (0, import_element88.useState)(false); 22526 const [resetDialogOpen, setResetDialogOpen] = (0, import_element88.useState)(false); 22527 const [settingsWidgetUuid, setSettingsWidgetUuid] = (0, import_element88.useState)(null); 22528 const [settingsDrawerSide, setSettingsDrawerSide] = (0, import_element88.useState)("right"); 22529 const [settingsDrawerInset, setSettingsDrawerInset] = (0, import_element88.useState)(0); 22530 const value = (0, import_element88.useMemo)( 22531 () => ({ 22532 inserterOpen, 22533 setInserterOpen, 22534 layoutSettingsOpen, 22535 setLayoutSettingsOpen, 22536 resetDialogOpen, 22537 setResetDialogOpen, 22538 settingsWidgetUuid, 22539 setSettingsWidgetUuid, 22540 settingsDrawerSide, 22541 setSettingsDrawerSide, 22542 settingsDrawerInset, 22543 setSettingsDrawerInset 22544 }), 22545 [ 22546 inserterOpen, 22547 layoutSettingsOpen, 22548 resetDialogOpen, 22549 settingsWidgetUuid, 22550 settingsDrawerSide, 22551 settingsDrawerInset 22552 ] 22553 ); 22554 return /* @__PURE__ */ (0, import_jsx_runtime117.jsx)(Context2.Provider, { value, children }); 22555 } 22556 22557 // routes/dashboard/widget-dashboard/components/actions/actions.tsx 22558 var import_data8 = __toESM(require_data()); 22559 var import_element158 = __toESM(require_element()); 22560 var import_i18n58 = __toESM(require_i18n()); 22561 var import_viewport = __toESM(require_viewport()); 22562 22563 // packages/style-runtime/src/index.ts 22564 var STYLE_HASH_ATTRIBUTE48 = "data-wp-hash"; 22565 function getRuntime48() { 22566 const globalScope = globalThis; 22567 if (globalScope.__wpStyleRuntime) { 22568 return globalScope.__wpStyleRuntime; 22569 } 22570 globalScope.__wpStyleRuntime = { 22571 documents: /* @__PURE__ */ new Map(), 22572 styles: /* @__PURE__ */ new Map(), 22573 injectedStyles: /* @__PURE__ */ new WeakMap() 22574 }; 22575 if (typeof document !== "undefined") { 22576 registerDocument48(document); 22577 } 22578 return globalScope.__wpStyleRuntime; 22579 } 22580 function documentContainsStyleHash48(targetDocument, hash) { 22581 if (!targetDocument.head) { 22582 return false; 22583 } 22584 for (const style of targetDocument.head.querySelectorAll( 22585 `style[$STYLE_HASH_ATTRIBUTE48}]` 22586 )) { 22587 if (style.getAttribute(STYLE_HASH_ATTRIBUTE48) === hash) { 22588 return true; 22589 } 22590 } 22591 return false; 22592 } 22593 function injectStyle48(targetDocument, hash, css) { 22594 if (!targetDocument.head) { 22595 return; 22596 } 22597 const runtime = getRuntime48(); 22598 let injectedStyles = runtime.injectedStyles.get(targetDocument); 22599 if (!injectedStyles) { 22600 injectedStyles = /* @__PURE__ */ new Set(); 22601 runtime.injectedStyles.set(targetDocument, injectedStyles); 22602 } 22603 if (injectedStyles.has(hash)) { 22604 return; 22605 } 22606 if (documentContainsStyleHash48(targetDocument, hash)) { 22607 injectedStyles.add(hash); 22608 return; 22609 } 22610 const style = targetDocument.createElement("style"); 22611 style.setAttribute(STYLE_HASH_ATTRIBUTE48, hash); 22612 style.appendChild(targetDocument.createTextNode(css)); 22613 targetDocument.head.appendChild(style); 22614 injectedStyles.add(hash); 22615 } 22616 function registerDocument48(targetDocument) { 22617 const runtime = getRuntime48(); 22618 runtime.documents.set( 22619 targetDocument, 22620 (runtime.documents.get(targetDocument) ?? 0) + 1 22621 ); 22622 for (const [hash, css] of runtime.styles) { 22623 injectStyle48(targetDocument, hash, css); 22624 } 22625 return () => { 22626 const count = runtime.documents.get(targetDocument); 22627 if (count === void 0) { 22628 return; 22629 } 22630 if (count <= 1) { 22631 runtime.documents.delete(targetDocument); 22632 return; 22633 } 22634 runtime.documents.set(targetDocument, count - 1); 22635 }; 22636 } 22637 function registerStyle48(hash, css) { 22638 const runtime = getRuntime48(); 22639 runtime.styles.set(hash, css); 22640 for (const targetDocument of runtime.documents.keys()) { 22641 injectStyle48(targetDocument, hash, css); 22642 } 22643 } 22644 22645 // routes/dashboard/widget-dashboard/components/actions/actions.module.css 22646 if (typeof process === "undefined" || true) { 22647 registerStyle48("0a2cf0e1e5", ".a6e8ada13acc9f11__editActionsExit,.aa9a2b8bca16d3d4__editActionsEnter{align-items:center;display:inline-flex;gap:var(--wp--preset--spacing--20);transform-origin:right center}.d75534e71f4a967a__editActionsDivider{align-self:center;background-color:var(--wpds-color-stroke-surface-neutral,#dbdbdb);flex-shrink:0;height:calc(var(--wpds-dimension-base, 4px)*4);width:1px}@media not (prefers-reduced-motion){.a6e8ada13acc9f11__editActionsExit,.aa9a2b8bca16d3d4__editActionsEnter{will-change:opacity,transform}.aa9a2b8bca16d3d4__editActionsEnter{animation:_6ad9417d3c8378ea__actions-slide-in var(--wpds-motion-duration-md,.2s) var(--wpds-motion-easing-expressive,cubic-bezier(.25,0,0,1)) forwards}.a6e8ada13acc9f11__editActionsExit{animation:ca863286783f6f27__actions-fold-out var(--wpds-motion-duration-sm,.1s) var(--wpds-motion-easing-balanced,cubic-bezier(.4,0,.2,1)) forwards}@keyframes _6ad9417d3c8378ea__actions-slide-in{0%{opacity:0;transform:translateX(12px) scaleX(.92)}to{opacity:1;transform:translateX(0) scaleX(1)}}@keyframes ca863286783f6f27__actions-fold-out{0%{opacity:1;transform:translateX(0) scaleX(1)}to{opacity:0;transform:translateX(12px) scaleX(.92)}}}"); 22648 } 22649 var actions_default = { "editActionsEnter": "aa9a2b8bca16d3d4__editActionsEnter", "editActionsExit": "a6e8ada13acc9f11__editActionsExit", "editActionsDivider": "d75534e71f4a967a__editActionsDivider", "actions-slide-in": "_6ad9417d3c8378ea__actions-slide-in", "actions-fold-out": "ca863286783f6f27__actions-fold-out" }; 22650 22651 // routes/dashboard/widget-dashboard/components/layout-settings/layout-settings.tsx 22652 var import_components52 = __toESM(require_components()); 22653 22654 // packages/dataviews/build-module/components/dataviews-context/index.mjs 22655 var import_element89 = __toESM(require_element(), 1); 22656 22657 // packages/dataviews/build-module/constants.mjs 22658 var import_i18n8 = __toESM(require_i18n(), 1); 22659 var OPERATOR_IS_ANY = "isAny"; 22660 var OPERATOR_IS_NONE = "isNone"; 22661 var OPERATOR_IS_ALL = "isAll"; 22662 var OPERATOR_IS_NOT_ALL = "isNotAll"; 22663 var OPERATOR_BETWEEN = "between"; 22664 var OPERATOR_IN_THE_PAST = "inThePast"; 22665 var OPERATOR_OVER = "over"; 22666 var OPERATOR_IS = "is"; 22667 var OPERATOR_IS_NOT = "isNot"; 22668 var OPERATOR_LESS_THAN = "lessThan"; 22669 var OPERATOR_GREATER_THAN = "greaterThan"; 22670 var OPERATOR_LESS_THAN_OR_EQUAL = "lessThanOrEqual"; 22671 var OPERATOR_GREATER_THAN_OR_EQUAL = "greaterThanOrEqual"; 22672 var OPERATOR_BEFORE = "before"; 22673 var OPERATOR_AFTER = "after"; 22674 var OPERATOR_BEFORE_INC = "beforeInc"; 22675 var OPERATOR_AFTER_INC = "afterInc"; 22676 var OPERATOR_CONTAINS = "contains"; 22677 var OPERATOR_NOT_CONTAINS = "notContains"; 22678 var OPERATOR_STARTS_WITH = "startsWith"; 22679 var OPERATOR_ON = "on"; 22680 var OPERATOR_NOT_ON = "notOn"; 22681 var SORTING_DIRECTIONS = ["asc", "desc"]; 22682 var sortArrows = { asc: "\u2191", desc: "\u2193" }; 22683 var sortValues = { asc: "ascending", desc: "descending" }; 22684 var sortLabels = { 22685 asc: (0, import_i18n8.__)("Sort ascending"), 22686 desc: (0, import_i18n8.__)("Sort descending") 22687 }; 22688 var sortIcons = { 22689 asc: arrow_up_default, 22690 desc: arrow_down_default 22691 }; 22692 var LAYOUT_TABLE = "table"; 22693 var LAYOUT_GRID = "grid"; 22694 var LAYOUT_LIST = "list"; 22695 var LAYOUT_ACTIVITY = "activity"; 22696 var LAYOUT_PICKER_GRID = "pickerGrid"; 22697 var LAYOUT_PICKER_TABLE = "pickerTable"; 22698 22699 // packages/dataviews/build-module/components/dataviews-context/index.mjs 22700 var DataViewsContext = (0, import_element89.createContext)({ 22701 view: { type: LAYOUT_TABLE }, 22702 onChangeView: () => { 22703 }, 22704 fields: [], 22705 data: [], 22706 paginationInfo: { 22707 totalItems: 0, 22708 totalPages: 0 22709 }, 22710 selection: [], 22711 onChangeSelection: () => { 22712 }, 22713 setOpenedFilter: () => { 22714 }, 22715 openedFilter: null, 22716 getItemId: (item) => item.id, 22717 isItemClickable: () => true, 22718 renderItemLink: void 0, 22719 containerWidth: 0, 22720 containerRef: (0, import_element89.createRef)(), 22721 resizeObserverRef: () => { 22722 }, 22723 defaultLayouts: { list: {}, grid: {}, table: {} }, 22724 filters: [], 22725 isShowingFilter: false, 22726 setIsShowingFilter: () => { 22727 }, 22728 hasInitiallyLoaded: false, 22729 config: { 22730 perPageSizes: [] 22731 }, 22732 intersectionObserver: null 22733 }); 22734 DataViewsContext.displayName = "DataViewsContext"; 22735 var dataviews_context_default = DataViewsContext; 22736 22737 // packages/dataviews/build-module/components/dataviews-layouts/index.mjs 22738 var import_i18n28 = __toESM(require_i18n(), 1); 22739 22740 // packages/dataviews/build-module/components/dataviews-layouts/table/index.mjs 22741 var import_i18n16 = __toESM(require_i18n(), 1); 22742 var import_components7 = __toESM(require_components(), 1); 22743 var import_element97 = __toESM(require_element(), 1); 22744 var import_keycodes = __toESM(require_keycodes(), 1); 22745 22746 // packages/dataviews/build-module/components/dataviews-selection-checkbox/index.mjs 22747 var import_components2 = __toESM(require_components(), 1); 22748 var import_i18n9 = __toESM(require_i18n(), 1); 22749 var import_jsx_runtime118 = __toESM(require_jsx_runtime(), 1); 22750 function DataViewsSelectionCheckbox({ 22751 selection, 22752 onChangeSelection, 22753 item, 22754 getItemId: getItemId2, 22755 titleField, 22756 disabled: disabled2, 22757 ...extraProps 22758 }) { 22759 const id = getItemId2(item); 22760 const isInSelectionArray = selection.includes(id); 22761 const checked = !disabled2 && isInSelectionArray; 22762 const selectionLabel = titleField?.getValue?.({ item }) || (0, import_i18n9.__)("(no title)"); 22763 return /* @__PURE__ */ (0, import_jsx_runtime118.jsx)( 22764 import_components2.CheckboxControl, 22765 { 22766 className: "dataviews-selection-checkbox", 22767 "aria-label": selectionLabel, 22768 "aria-disabled": disabled2, 22769 checked, 22770 onChange: () => { 22771 if (disabled2) { 22772 return; 22773 } 22774 onChangeSelection( 22775 isInSelectionArray ? selection.filter((itemId) => id !== itemId) : [...selection, id] 22776 ); 22777 }, 22778 ...extraProps 22779 } 22780 ); 22781 } 22782 22783 // packages/dataviews/build-module/components/dataviews-item-actions/index.mjs 22784 var import_components3 = __toESM(require_components(), 1); 22785 var import_i18n10 = __toESM(require_i18n(), 1); 22786 var import_element90 = __toESM(require_element(), 1); 22787 var import_data3 = __toESM(require_data(), 1); 22788 var import_compose8 = __toESM(require_compose(), 1); 22789 22790 // packages/dataviews/build-module/lock-unlock.mjs 22791 var import_private_apis2 = __toESM(require_private_apis(), 1); 22792 var { lock: lock2, unlock: unlock2 } = (0, import_private_apis2.__dangerousOptInToUnstableAPIsOnlyForCoreModules)( 22793 "I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.", 22794 "@wordpress/dataviews" 22795 ); 22796 22797 // packages/dataviews/build-module/components/dataviews-item-actions/index.mjs 22798 var import_jsx_runtime119 = __toESM(require_jsx_runtime(), 1); 22799 var { Menu, kebabCase } = unlock2(import_components3.privateApis); 22800 function ButtonTrigger({ 22801 action, 22802 onClick, 22803 items, 22804 variant 22805 }) { 22806 const label = typeof action.label === "string" ? action.label : action.label(items); 22807 return /* @__PURE__ */ (0, import_jsx_runtime119.jsx)( 22808 import_components3.Button, 22809 { 22810 disabled: !!action.disabled, 22811 accessibleWhenDisabled: true, 22812 size: "compact", 22813 variant, 22814 onClick, 22815 children: label 22816 } 22817 ); 22818 } 22819 function MenuItemTrigger({ 22820 action, 22821 onClick, 22822 items 22823 }) { 22824 const label = typeof action.label === "string" ? action.label : action.label(items); 22825 return /* @__PURE__ */ (0, import_jsx_runtime119.jsx)(Menu.Item, { disabled: action.disabled, onClick, children: /* @__PURE__ */ (0, import_jsx_runtime119.jsx)(Menu.ItemLabel, { children: label }) }); 22826 } 22827 function ActionModal({ 22828 action, 22829 items, 22830 closeModal 22831 }) { 22832 const label = typeof action.label === "string" ? action.label : action.label(items); 22833 const modalHeader = typeof action.modalHeader === "function" ? action.modalHeader(items) : action.modalHeader; 22834 return /* @__PURE__ */ (0, import_jsx_runtime119.jsx)( 22835 import_components3.Modal, 22836 { 22837 title: modalHeader || label, 22838 __experimentalHideHeader: !!action.hideModalHeader, 22839 onRequestClose: closeModal, 22840 focusOnMount: action.modalFocusOnMount ?? true, 22841 size: action.modalSize || "medium", 22842 overlayClassName: `dataviews-action-modal dataviews-action-modal__$kebabCase( 22843 action.id 22844 )}`, 22845 children: /* @__PURE__ */ (0, import_jsx_runtime119.jsx)(action.RenderModal, { items, closeModal }) 22846 } 22847 ); 22848 } 22849 function ActionsMenuGroup({ 22850 actions, 22851 item, 22852 registry, 22853 setActiveModalAction 22854 }) { 22855 const { primaryActions, regularActions } = (0, import_element90.useMemo)(() => { 22856 return actions.reduce( 22857 (acc, action) => { 22858 (action.isPrimary ? acc.primaryActions : acc.regularActions).push(action); 22859 return acc; 22860 }, 22861 { 22862 primaryActions: [], 22863 regularActions: [] 22864 } 22865 ); 22866 }, [actions]); 22867 const renderActionGroup = (actionList) => actionList.map((action) => /* @__PURE__ */ (0, import_jsx_runtime119.jsx)( 22868 MenuItemTrigger, 22869 { 22870 action, 22871 onClick: () => { 22872 if ("RenderModal" in action) { 22873 setActiveModalAction(action); 22874 return; 22875 } 22876 action.callback([item], { registry }); 22877 }, 22878 items: [item] 22879 }, 22880 action.id 22881 )); 22882 return /* @__PURE__ */ (0, import_jsx_runtime119.jsxs)(Menu.Group, { children: [ 22883 renderActionGroup(primaryActions), 22884 renderActionGroup(regularActions) 22885 ] }); 22886 } 22887 function ItemActions({ 22888 item, 22889 actions, 22890 isCompact 22891 }) { 22892 const registry = (0, import_data3.useRegistry)(); 22893 const { primaryActions, eligibleActions } = (0, import_element90.useMemo)(() => { 22894 const _eligibleActions = actions.filter( 22895 (action) => !action.isEligible || action.isEligible(item) 22896 ); 22897 const _primaryActions = _eligibleActions.filter( 22898 (action) => action.isPrimary 22899 ); 22900 return { 22901 primaryActions: _primaryActions, 22902 eligibleActions: _eligibleActions 22903 }; 22904 }, [actions, item]); 22905 const isMobileViewport = (0, import_compose8.useViewportMatch)("medium", "<"); 22906 if (isCompact) { 22907 return /* @__PURE__ */ (0, import_jsx_runtime119.jsx)( 22908 CompactItemActions, 22909 { 22910 item, 22911 actions: eligibleActions, 22912 isSmall: true, 22913 registry 22914 } 22915 ); 22916 } 22917 return /* @__PURE__ */ (0, import_jsx_runtime119.jsxs)( 22918 Stack, 22919 { 22920 direction: "row", 22921 justify: "flex-end", 22922 className: "dataviews-item-actions", 22923 style: { 22924 flexShrink: 0, 22925 width: "auto" 22926 }, 22927 children: [ 22928 /* @__PURE__ */ (0, import_jsx_runtime119.jsx)( 22929 PrimaryActions, 22930 { 22931 item, 22932 actions: primaryActions, 22933 registry 22934 } 22935 ), 22936 (primaryActions.length < eligibleActions.length || // Since we hide primary actions on mobile, we need to show the menu 22937 // there if there are any actions at all. 22938 isMobileViewport) && /* @__PURE__ */ (0, import_jsx_runtime119.jsx)( 22939 CompactItemActions, 22940 { 22941 item, 22942 actions: eligibleActions, 22943 registry 22944 } 22945 ) 22946 ] 22947 } 22948 ); 22949 } 22950 function CompactItemActions({ 22951 item, 22952 actions, 22953 isSmall, 22954 registry 22955 }) { 22956 const [activeModalAction, setActiveModalAction] = (0, import_element90.useState)( 22957 null 22958 ); 22959 return /* @__PURE__ */ (0, import_jsx_runtime119.jsxs)(import_jsx_runtime119.Fragment, { children: [ 22960 /* @__PURE__ */ (0, import_jsx_runtime119.jsxs)(Menu, { placement: "bottom-end", children: [ 22961 /* @__PURE__ */ (0, import_jsx_runtime119.jsx)( 22962 Menu.TriggerButton, 22963 { 22964 render: /* @__PURE__ */ (0, import_jsx_runtime119.jsx)( 22965 import_components3.Button, 22966 { 22967 size: isSmall ? "small" : "compact", 22968 icon: more_vertical_default, 22969 label: (0, import_i18n10.__)("Actions"), 22970 accessibleWhenDisabled: true, 22971 disabled: !actions.length, 22972 className: "dataviews-all-actions-button" 22973 } 22974 ) 22975 } 22976 ), 22977 /* @__PURE__ */ (0, import_jsx_runtime119.jsx)(Menu.Popover, { children: /* @__PURE__ */ (0, import_jsx_runtime119.jsx)( 22978 ActionsMenuGroup, 22979 { 22980 actions, 22981 item, 22982 registry, 22983 setActiveModalAction 22984 } 22985 ) }) 22986 ] }), 22987 !!activeModalAction && /* @__PURE__ */ (0, import_jsx_runtime119.jsx)( 22988 ActionModal, 22989 { 22990 action: activeModalAction, 22991 items: [item], 22992 closeModal: () => setActiveModalAction(null) 22993 } 22994 ) 22995 ] }); 22996 } 22997 function PrimaryActions({ 22998 item, 22999 actions, 23000 registry, 23001 buttonVariant 23002 }) { 23003 const [activeModalAction, setActiveModalAction] = (0, import_element90.useState)(null); 23004 const isMobileViewport = (0, import_compose8.useViewportMatch)("medium", "<"); 23005 if (isMobileViewport) { 23006 return null; 23007 } 23008 if (!Array.isArray(actions) || actions.length === 0) { 23009 return null; 23010 } 23011 return /* @__PURE__ */ (0, import_jsx_runtime119.jsxs)(import_jsx_runtime119.Fragment, { children: [ 23012 actions.map((action) => /* @__PURE__ */ (0, import_jsx_runtime119.jsx)( 23013 ButtonTrigger, 23014 { 23015 action, 23016 onClick: () => { 23017 if ("RenderModal" in action) { 23018 setActiveModalAction(action); 23019 return; 23020 } 23021 action.callback([item], { registry }); 23022 }, 23023 items: [item], 23024 variant: buttonVariant 23025 }, 23026 action.id 23027 )), 23028 !!activeModalAction && /* @__PURE__ */ (0, import_jsx_runtime119.jsx)( 23029 ActionModal, 23030 { 23031 action: activeModalAction, 23032 items: [item], 23033 closeModal: () => setActiveModalAction(null) 23034 } 23035 ) 23036 ] }); 23037 } 23038 23039 // packages/dataviews/build-module/components/dataviews-bulk-actions/index.mjs 23040 var import_components4 = __toESM(require_components(), 1); 23041 var import_i18n12 = __toESM(require_i18n(), 1); 23042 var import_element91 = __toESM(require_element(), 1); 23043 var import_data4 = __toESM(require_data(), 1); 23044 var import_compose9 = __toESM(require_compose(), 1); 23045 23046 // packages/dataviews/build-module/utils/get-footer-message.mjs 23047 var import_i18n11 = __toESM(require_i18n(), 1); 23048 function getFooterMessage(selectionCount, itemsCount, totalItems, onlyTotalCount = false) { 23049 if (selectionCount > 0) { 23050 return (0, import_i18n11.sprintf)( 23051 /* translators: %d: number of items. */ 23052 (0, import_i18n11._n)("%d Item selected", "%d Items selected", selectionCount), 23053 selectionCount 23054 ); 23055 } 23056 if (onlyTotalCount || totalItems <= itemsCount) { 23057 return (0, import_i18n11.sprintf)( 23058 /* translators: %d: number of items. */ 23059 (0, import_i18n11._n)("%d Item", "%d Items", totalItems), 23060 totalItems 23061 ); 23062 } 23063 return (0, import_i18n11.sprintf)( 23064 /* translators: %1$d: number of items. %2$d: total number of items. */ 23065 (0, import_i18n11._n)("%1$d of %2$d Item", "%1$d of %2$d Items", totalItems), 23066 itemsCount, 23067 totalItems 23068 ); 23069 } 23070 23071 // packages/dataviews/build-module/components/dataviews-bulk-actions/index.mjs 23072 var import_jsx_runtime120 = __toESM(require_jsx_runtime(), 1); 23073 function useHasAPossibleBulkAction(actions, item) { 23074 return (0, import_element91.useMemo)(() => { 23075 return actions.some((action) => { 23076 return action.supportsBulk && (!action.isEligible || action.isEligible(item)); 23077 }); 23078 }, [actions, item]); 23079 } 23080 function useSomeItemHasAPossibleBulkAction(actions, data) { 23081 return (0, import_element91.useMemo)(() => { 23082 return data.some((item) => { 23083 return actions.some((action) => { 23084 return action.supportsBulk && (!action.isEligible || action.isEligible(item)); 23085 }); 23086 }); 23087 }, [actions, data]); 23088 } 23089 function BulkSelectionCheckbox({ 23090 selection, 23091 onChangeSelection, 23092 data, 23093 actions, 23094 getItemId: getItemId2, 23095 disableSelectAll = false 23096 }) { 23097 const selectableItems = (0, import_element91.useMemo)(() => { 23098 return data.filter((item) => { 23099 return actions.some( 23100 (action) => action.supportsBulk && (!action.isEligible || action.isEligible(item)) 23101 ); 23102 }); 23103 }, [data, actions]); 23104 const selectedItems = data.filter( 23105 (item) => selection.includes(getItemId2(item)) && selectableItems.includes(item) 23106 ); 23107 const hasSelection = selection.length > 0; 23108 const areAllSelected = selectedItems.length === selectableItems.length; 23109 if (disableSelectAll) { 23110 return /* @__PURE__ */ (0, import_jsx_runtime120.jsx)( 23111 import_components4.CheckboxControl, 23112 { 23113 className: "dataviews-view-table-selection-checkbox", 23114 checked: hasSelection, 23115 disabled: !hasSelection, 23116 onChange: () => { 23117 onChangeSelection([]); 23118 }, 23119 "aria-label": (0, import_i18n12.__)("Deselect all") 23120 } 23121 ); 23122 } 23123 return /* @__PURE__ */ (0, import_jsx_runtime120.jsx)( 23124 import_components4.CheckboxControl, 23125 { 23126 className: "dataviews-view-table-selection-checkbox", 23127 checked: areAllSelected, 23128 indeterminate: !areAllSelected && !!selectedItems.length, 23129 onChange: () => { 23130 if (areAllSelected) { 23131 onChangeSelection([]); 23132 } else { 23133 onChangeSelection( 23134 selectableItems.map((item) => getItemId2(item)) 23135 ); 23136 } 23137 }, 23138 "aria-label": areAllSelected ? (0, import_i18n12.__)("Deselect all") : (0, import_i18n12.__)("Select all") 23139 } 23140 ); 23141 } 23142 23143 // packages/dataviews/build-module/components/dataviews-layouts/table/column-header-menu.mjs 23144 var import_i18n13 = __toESM(require_i18n(), 1); 23145 var import_components5 = __toESM(require_components(), 1); 23146 var import_element92 = __toESM(require_element(), 1); 23147 23148 // packages/dataviews/build-module/utils/get-hideable-fields.mjs 23149 function getHideableFields(view, fields3) { 23150 const togglableFields = [ 23151 view?.titleField, 23152 view?.mediaField, 23153 view?.descriptionField 23154 ].filter(Boolean); 23155 return fields3.filter( 23156 (f2) => !togglableFields.includes(f2.id) && f2.type !== "media" && f2.enableHiding !== false 23157 ); 23158 } 23159 23160 // packages/dataviews/build-module/components/dataviews-layouts/table/column-header-menu.mjs 23161 var import_jsx_runtime121 = __toESM(require_jsx_runtime(), 1); 23162 var { Menu: Menu2 } = unlock2(import_components5.privateApis); 23163 function WithMenuSeparators({ children }) { 23164 return import_element92.Children.toArray(children).filter(Boolean).map((child, i2) => /* @__PURE__ */ (0, import_jsx_runtime121.jsxs)(import_element92.Fragment, { children: [ 23165 i2 > 0 && /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(Menu2.Separator, {}), 23166 child 23167 ] }, i2)); 23168 } 23169 var _HeaderMenu = (0, import_element92.forwardRef)(function HeaderMenu({ 23170 fieldId, 23171 view, 23172 fields: fields3, 23173 onChangeView, 23174 onHide, 23175 setOpenedFilter, 23176 canMove = true, 23177 canInsertLeft = true, 23178 canInsertRight = true 23179 }, ref) { 23180 const visibleFieldIds = view.fields ?? []; 23181 const index2 = visibleFieldIds?.indexOf(fieldId); 23182 const isSorted = view.sort?.field === fieldId; 23183 let isHidable = false; 23184 let isSortable = false; 23185 let canAddFilter = false; 23186 let operators = []; 23187 const field = fields3.find((f2) => f2.id === fieldId); 23188 const { setIsShowingFilter } = (0, import_element92.useContext)(dataviews_context_default); 23189 if (!field) { 23190 return null; 23191 } 23192 isHidable = field.enableHiding !== false; 23193 isSortable = field.enableSorting !== false; 23194 const header = field.header; 23195 operators = !!field.filterBy && field.filterBy?.operators || []; 23196 canAddFilter = !view.filters?.some((_filter) => fieldId === _filter.field) && !!(field.hasElements || field.Edit) && field.filterBy !== false && !field.filterBy?.isPrimary; 23197 if (!isSortable && !canMove && !isHidable && !canAddFilter) { 23198 return header; 23199 } 23200 const hiddenFields = getHideableFields(view, fields3).filter( 23201 (f2) => !visibleFieldIds.includes(f2.id) 23202 ); 23203 const canInsert = (canInsertLeft || canInsertRight) && !!hiddenFields.length; 23204 const isRtl = (0, import_i18n13.isRTL)(); 23205 return /* @__PURE__ */ (0, import_jsx_runtime121.jsxs)(Menu2, { children: [ 23206 /* @__PURE__ */ (0, import_jsx_runtime121.jsxs)( 23207 Menu2.TriggerButton, 23208 { 23209 render: /* @__PURE__ */ (0, import_jsx_runtime121.jsx)( 23210 import_components5.Button, 23211 { 23212 size: "compact", 23213 className: "dataviews-view-table-header-button", 23214 ref, 23215 variant: "tertiary" 23216 } 23217 ), 23218 children: [ 23219 header, 23220 view.sort && isSorted && /* @__PURE__ */ (0, import_jsx_runtime121.jsx)("span", { "aria-hidden": "true", children: sortArrows[view.sort.direction] }) 23221 ] 23222 } 23223 ), 23224 /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(Menu2.Popover, { style: { minWidth: "240px" }, children: /* @__PURE__ */ (0, import_jsx_runtime121.jsxs)(WithMenuSeparators, { children: [ 23225 isSortable && /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(Menu2.Group, { children: SORTING_DIRECTIONS.map( 23226 (direction) => { 23227 const isChecked = view.sort && isSorted && view.sort.direction === direction; 23228 const value = `$fieldId}-$direction}`; 23229 return /* @__PURE__ */ (0, import_jsx_runtime121.jsx)( 23230 Menu2.RadioItem, 23231 { 23232 name: "view-table-sorting", 23233 value, 23234 checked: isChecked, 23235 onChange: () => { 23236 onChangeView({ 23237 ...view, 23238 sort: { 23239 field: fieldId, 23240 direction 23241 }, 23242 showLevels: false 23243 }); 23244 }, 23245 children: /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(Menu2.ItemLabel, { children: sortLabels[direction] }) 23246 }, 23247 value 23248 ); 23249 } 23250 ) }), 23251 canAddFilter && /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(Menu2.Group, { children: /* @__PURE__ */ (0, import_jsx_runtime121.jsx)( 23252 Menu2.Item, 23253 { 23254 prefix: /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(import_components5.Icon, { icon: funnel_default }), 23255 onClick: () => { 23256 setOpenedFilter(fieldId); 23257 setIsShowingFilter(true); 23258 onChangeView({ 23259 ...view, 23260 page: 1, 23261 filters: [ 23262 ...view.filters || [], 23263 { 23264 field: fieldId, 23265 value: void 0, 23266 operator: operators[0] 23267 } 23268 ] 23269 }); 23270 }, 23271 children: /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(Menu2.ItemLabel, { children: (0, import_i18n13.__)("Add filter") }) 23272 } 23273 ) }), 23274 (canMove || isHidable || canInsert) && field && /* @__PURE__ */ (0, import_jsx_runtime121.jsxs)(Menu2.Group, { children: [ 23275 canMove && /* @__PURE__ */ (0, import_jsx_runtime121.jsx)( 23276 Menu2.Item, 23277 { 23278 prefix: /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(import_components5.Icon, { icon: arrow_left_default }), 23279 disabled: isRtl ? index2 >= visibleFieldIds.length - 1 : index2 < 1, 23280 onClick: () => { 23281 const targetIndex = isRtl ? index2 + 1 : index2 - 1; 23282 const newFields = [ 23283 ...visibleFieldIds 23284 ]; 23285 newFields.splice(index2, 1); 23286 newFields.splice( 23287 targetIndex, 23288 0, 23289 fieldId 23290 ); 23291 onChangeView({ 23292 ...view, 23293 fields: newFields 23294 }); 23295 }, 23296 children: /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(Menu2.ItemLabel, { children: (0, import_i18n13.__)("Move left") }) 23297 } 23298 ), 23299 canMove && /* @__PURE__ */ (0, import_jsx_runtime121.jsx)( 23300 Menu2.Item, 23301 { 23302 prefix: /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(import_components5.Icon, { icon: arrow_right_default }), 23303 disabled: isRtl ? index2 < 1 : index2 >= visibleFieldIds.length - 1, 23304 onClick: () => { 23305 const targetIndex = isRtl ? index2 - 1 : index2 + 1; 23306 const newFields = [ 23307 ...visibleFieldIds 23308 ]; 23309 newFields.splice(index2, 1); 23310 newFields.splice( 23311 targetIndex, 23312 0, 23313 fieldId 23314 ); 23315 onChangeView({ 23316 ...view, 23317 fields: newFields 23318 }); 23319 }, 23320 children: /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(Menu2.ItemLabel, { children: (0, import_i18n13.__)("Move right") }) 23321 } 23322 ), 23323 canInsertLeft && !!hiddenFields.length && /* @__PURE__ */ (0, import_jsx_runtime121.jsxs)(Menu2, { children: [ 23324 /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(Menu2.SubmenuTriggerItem, { children: /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(Menu2.ItemLabel, { children: (0, import_i18n13.__)("Insert left") }) }), 23325 /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(Menu2.Popover, { children: hiddenFields.map((hiddenField) => { 23326 const insertIndex = isRtl ? index2 + 1 : index2; 23327 return /* @__PURE__ */ (0, import_jsx_runtime121.jsx)( 23328 Menu2.Item, 23329 { 23330 onClick: () => { 23331 onChangeView({ 23332 ...view, 23333 fields: [ 23334 ...visibleFieldIds.slice( 23335 0, 23336 insertIndex 23337 ), 23338 hiddenField.id, 23339 ...visibleFieldIds.slice( 23340 insertIndex 23341 ) 23342 ] 23343 }); 23344 }, 23345 children: /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(Menu2.ItemLabel, { children: hiddenField.label }) 23346 }, 23347 hiddenField.id 23348 ); 23349 }) }) 23350 ] }), 23351 canInsertRight && !!hiddenFields.length && /* @__PURE__ */ (0, import_jsx_runtime121.jsxs)(Menu2, { children: [ 23352 /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(Menu2.SubmenuTriggerItem, { children: /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(Menu2.ItemLabel, { children: (0, import_i18n13.__)("Insert right") }) }), 23353 /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(Menu2.Popover, { children: hiddenFields.map((hiddenField) => { 23354 const insertIndex = isRtl ? index2 : index2 + 1; 23355 return /* @__PURE__ */ (0, import_jsx_runtime121.jsx)( 23356 Menu2.Item, 23357 { 23358 onClick: () => { 23359 onChangeView({ 23360 ...view, 23361 fields: [ 23362 ...visibleFieldIds.slice( 23363 0, 23364 insertIndex 23365 ), 23366 hiddenField.id, 23367 ...visibleFieldIds.slice( 23368 insertIndex 23369 ) 23370 ] 23371 }); 23372 }, 23373 children: /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(Menu2.ItemLabel, { children: hiddenField.label }) 23374 }, 23375 hiddenField.id 23376 ); 23377 }) }) 23378 ] }), 23379 isHidable && field && /* @__PURE__ */ (0, import_jsx_runtime121.jsx)( 23380 Menu2.Item, 23381 { 23382 prefix: /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(import_components5.Icon, { icon: unseen_default }), 23383 onClick: () => { 23384 onHide(field); 23385 onChangeView({ 23386 ...view, 23387 fields: visibleFieldIds.filter( 23388 (id) => id !== fieldId 23389 ) 23390 }); 23391 }, 23392 children: /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(Menu2.ItemLabel, { children: (0, import_i18n13.__)("Hide column") }) 23393 } 23394 ) 23395 ] }) 23396 ] }) }) 23397 ] }); 23398 }); 23399 var ColumnHeaderMenu = _HeaderMenu; 23400 var column_header_menu_default = ColumnHeaderMenu; 23401 23402 // packages/dataviews/build-module/components/dataviews-layouts/utils/item-click-wrapper.mjs 23403 var import_element93 = __toESM(require_element(), 1); 23404 var import_jsx_runtime122 = __toESM(require_jsx_runtime(), 1); 23405 function getClickableItemProps({ 23406 item, 23407 isItemClickable: isItemClickable2, 23408 onClickItem, 23409 className 23410 }) { 23411 if (!isItemClickable2(item) || !onClickItem) { 23412 return { className }; 23413 } 23414 return { 23415 className: className ? `$className} $className}--clickable` : void 0, 23416 role: "button", 23417 tabIndex: 0, 23418 onClick: (event) => { 23419 event.stopPropagation(); 23420 onClickItem(item); 23421 }, 23422 onKeyDown: (event) => { 23423 if (event.key === "Enter" || event.key === "" || event.key === " ") { 23424 event.stopPropagation(); 23425 onClickItem(item); 23426 } 23427 } 23428 }; 23429 } 23430 function ItemClickWrapper({ 23431 item, 23432 isItemClickable: isItemClickable2, 23433 onClickItem, 23434 renderItemLink, 23435 className, 23436 children, 23437 ...extraProps 23438 }) { 23439 if (!isItemClickable2(item)) { 23440 return /* @__PURE__ */ (0, import_jsx_runtime122.jsx)("div", { className, ...extraProps, children }); 23441 } 23442 if (renderItemLink) { 23443 const renderedElement = renderItemLink({ 23444 item, 23445 className: `$className} $className}--clickable`, 23446 ...extraProps, 23447 children 23448 }); 23449 return (0, import_element93.cloneElement)(renderedElement, { 23450 onClick: (event) => { 23451 event.stopPropagation(); 23452 if (renderedElement.props.onClick) { 23453 renderedElement.props.onClick(event); 23454 } 23455 }, 23456 onKeyDown: (event) => { 23457 if (event.key === "Enter" || event.key === "" || event.key === " ") { 23458 event.stopPropagation(); 23459 if (renderedElement.props.onKeyDown) { 23460 renderedElement.props.onKeyDown(event); 23461 } 23462 } 23463 } 23464 }); 23465 } 23466 const clickProps = getClickableItemProps({ 23467 item, 23468 isItemClickable: isItemClickable2, 23469 onClickItem, 23470 className 23471 }); 23472 return /* @__PURE__ */ (0, import_jsx_runtime122.jsx)("div", { ...clickProps, ...extraProps, children }); 23473 } 23474 23475 // packages/dataviews/build-module/components/dataviews-layouts/table/column-primary.mjs 23476 var import_jsx_runtime123 = __toESM(require_jsx_runtime(), 1); 23477 function ColumnPrimary({ 23478 item, 23479 level, 23480 titleField, 23481 mediaField, 23482 descriptionField, 23483 onClickItem, 23484 renderItemLink, 23485 isItemClickable: isItemClickable2 23486 }) { 23487 return /* @__PURE__ */ (0, import_jsx_runtime123.jsxs)(Stack, { direction: "row", gap: "md", align: "flex-start", justify: "flex-start", children: [ 23488 mediaField && /* @__PURE__ */ (0, import_jsx_runtime123.jsx)( 23489 ItemClickWrapper, 23490 { 23491 item, 23492 isItemClickable: isItemClickable2, 23493 onClickItem, 23494 renderItemLink, 23495 className: "dataviews-view-table__cell-content-wrapper dataviews-column-primary__media", 23496 "aria-label": isItemClickable2(item) && (!!onClickItem || !!renderItemLink) && !!titleField ? titleField.getValue?.({ item }) : void 0, 23497 children: /* @__PURE__ */ (0, import_jsx_runtime123.jsx)( 23498 mediaField.render, 23499 { 23500 item, 23501 field: mediaField, 23502 config: { sizes: "32px" } 23503 } 23504 ) 23505 } 23506 ), 23507 /* @__PURE__ */ (0, import_jsx_runtime123.jsxs)( 23508 Stack, 23509 { 23510 direction: "column", 23511 align: "flex-start", 23512 className: "dataviews-view-table__primary-column-content", 23513 children: [ 23514 titleField && /* @__PURE__ */ (0, import_jsx_runtime123.jsxs)( 23515 ItemClickWrapper, 23516 { 23517 item, 23518 isItemClickable: isItemClickable2, 23519 onClickItem, 23520 renderItemLink, 23521 className: "dataviews-view-table__cell-content-wrapper dataviews-title-field", 23522 children: [ 23523 level !== void 0 && level > 0 && /* @__PURE__ */ (0, import_jsx_runtime123.jsxs)("span", { className: "dataviews-view-table__level", children: [ 23524 Array(level).fill("\u2014").join(" "), 23525 "\xA0" 23526 ] }), 23527 /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(titleField.render, { item, field: titleField }) 23528 ] 23529 } 23530 ), 23531 descriptionField && /* @__PURE__ */ (0, import_jsx_runtime123.jsx)( 23532 descriptionField.render, 23533 { 23534 item, 23535 field: descriptionField 23536 } 23537 ) 23538 ] 23539 } 23540 ) 23541 ] }); 23542 } 23543 var column_primary_default = ColumnPrimary; 23544 23545 // packages/dataviews/build-module/components/dataviews-layouts/table/use-scroll-state.mjs 23546 var import_element94 = __toESM(require_element(), 1); 23547 var import_i18n14 = __toESM(require_i18n(), 1); 23548 var isScrolledToEnd = (element) => { 23549 if ((0, import_i18n14.isRTL)()) { 23550 const scrollLeft = Math.abs(element.scrollLeft); 23551 return scrollLeft <= 1; 23552 } 23553 return element.scrollLeft + element.clientWidth >= element.scrollWidth - 1; 23554 }; 23555 function useScrollState({ 23556 scrollContainerRef, 23557 enabledHorizontal = false 23558 }) { 23559 const [isHorizontalScrollEnd, setIsHorizontalScrollEnd] = (0, import_element94.useState)(false); 23560 const [isVerticallyScrolled, setIsVerticallyScrolled] = (0, import_element94.useState)(false); 23561 const handleScroll = (0, import_element94.useCallback)(() => { 23562 const scrollContainer = scrollContainerRef.current; 23563 if (!scrollContainer) { 23564 return; 23565 } 23566 if (enabledHorizontal) { 23567 setIsHorizontalScrollEnd(isScrolledToEnd(scrollContainer)); 23568 } 23569 setIsVerticallyScrolled(scrollContainer.scrollTop > 0); 23570 }, [scrollContainerRef, enabledHorizontal]); 23571 (0, import_element94.useEffect)(() => { 23572 if (typeof window === "undefined" || !scrollContainerRef.current) { 23573 return () => { 23574 }; 23575 } 23576 const scrollContainer = scrollContainerRef.current; 23577 handleScroll(); 23578 scrollContainer.addEventListener("scroll", handleScroll); 23579 window.addEventListener("resize", handleScroll); 23580 return () => { 23581 scrollContainer.removeEventListener("scroll", handleScroll); 23582 window.removeEventListener("resize", handleScroll); 23583 }; 23584 }, [scrollContainerRef, enabledHorizontal, handleScroll]); 23585 return { isHorizontalScrollEnd, isVerticallyScrolled }; 23586 } 23587 23588 // packages/dataviews/build-module/components/dataviews-layouts/utils/get-data-by-group.mjs 23589 function getDataByGroup(data, groupByField) { 23590 return data.reduce((groups, item) => { 23591 const groupName = groupByField.getValue({ item }); 23592 if (!groups.has(groupName)) { 23593 groups.set(groupName, []); 23594 } 23595 groups.get(groupName)?.push(item); 23596 return groups; 23597 }, /* @__PURE__ */ new Map()); 23598 } 23599 23600 // packages/dataviews/build-module/components/dataviews-view-config/properties-section.mjs 23601 var import_components6 = __toESM(require_components(), 1); 23602 var import_i18n15 = __toESM(require_i18n(), 1); 23603 var import_element95 = __toESM(require_element(), 1); 23604 var import_jsx_runtime124 = __toESM(require_jsx_runtime(), 1); 23605 function FieldItem({ 23606 field, 23607 isVisible: isVisible2, 23608 onToggleVisibility 23609 }) { 23610 return /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(import_components6.__experimentalItem, { onClick: field.enableHiding ? onToggleVisibility : void 0, children: /* @__PURE__ */ (0, import_jsx_runtime124.jsxs)(Stack, { direction: "row", gap: "sm", justify: "flex-start", align: "center", children: [ 23611 /* @__PURE__ */ (0, import_jsx_runtime124.jsx)("div", { style: { height: 24, width: 24 }, children: isVisible2 && /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(import_components6.Icon, { icon: check_default }) }), 23612 /* @__PURE__ */ (0, import_jsx_runtime124.jsx)("span", { className: "dataviews-view-config__label", children: field.label }) 23613 ] }) }); 23614 } 23615 function isDefined(item) { 23616 return !!item; 23617 } 23618 function PropertiesSection({ 23619 showLabel = true 23620 }) { 23621 const { view, fields: fields3, onChangeView } = (0, import_element95.useContext)(dataviews_context_default); 23622 const regularFields = getHideableFields(view, fields3); 23623 if (!regularFields?.length) { 23624 return null; 23625 } 23626 const titleField = fields3.find((f2) => f2.id === view.titleField); 23627 const previewField = fields3.find((f2) => f2.id === view.mediaField); 23628 const descriptionField = fields3.find( 23629 (f2) => f2.id === view.descriptionField 23630 ); 23631 const lockedFields = [ 23632 { 23633 field: titleField, 23634 isVisibleFlag: "showTitle" 23635 }, 23636 { 23637 field: previewField, 23638 isVisibleFlag: "showMedia" 23639 }, 23640 { 23641 field: descriptionField, 23642 isVisibleFlag: "showDescription" 23643 } 23644 ].filter(({ field }) => isDefined(field)); 23645 const visibleFieldIds = view.fields ?? []; 23646 const visibleRegularFieldsCount = regularFields.filter( 23647 (f2) => visibleFieldIds.includes(f2.id) 23648 ).length; 23649 const visibleLockedFields = lockedFields.filter( 23650 ({ isVisibleFlag }) => ( 23651 // @ts-expect-error 23652 view[isVisibleFlag] ?? true 23653 ) 23654 ); 23655 const totalVisibleFields = visibleLockedFields.length + visibleRegularFieldsCount; 23656 const isSingleVisibleLockedField = totalVisibleFields === 1 && visibleLockedFields.length === 1; 23657 return /* @__PURE__ */ (0, import_jsx_runtime124.jsxs)(Stack, { direction: "column", className: "dataviews-field-control", children: [ 23658 showLabel && /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(import_components6.BaseControl.VisualLabel, { children: (0, import_i18n15.__)("Properties") }), 23659 /* @__PURE__ */ (0, import_jsx_runtime124.jsx)( 23660 Stack, 23661 { 23662 direction: "column", 23663 className: "dataviews-view-config__properties", 23664 children: /* @__PURE__ */ (0, import_jsx_runtime124.jsxs)(import_components6.__experimentalItemGroup, { isBordered: true, isSeparated: true, size: "medium", children: [ 23665 lockedFields.map(({ field, isVisibleFlag }) => { 23666 const isVisible2 = view[isVisibleFlag] ?? true; 23667 const fieldToRender = isSingleVisibleLockedField && isVisible2 ? { ...field, enableHiding: false } : field; 23668 return /* @__PURE__ */ (0, import_jsx_runtime124.jsx)( 23669 FieldItem, 23670 { 23671 field: fieldToRender, 23672 isVisible: isVisible2, 23673 onToggleVisibility: () => { 23674 onChangeView({ 23675 ...view, 23676 [isVisibleFlag]: !isVisible2 23677 }); 23678 } 23679 }, 23680 field.id 23681 ); 23682 }), 23683 regularFields.map((field) => { 23684 const isVisible2 = visibleFieldIds.includes(field.id); 23685 const fieldToRender = totalVisibleFields === 1 && isVisible2 ? { ...field, enableHiding: false } : field; 23686 return /* @__PURE__ */ (0, import_jsx_runtime124.jsx)( 23687 FieldItem, 23688 { 23689 field: fieldToRender, 23690 isVisible: isVisible2, 23691 onToggleVisibility: () => { 23692 onChangeView({ 23693 ...view, 23694 fields: isVisible2 ? visibleFieldIds.filter( 23695 (fieldId) => fieldId !== field.id 23696 ) : [...visibleFieldIds, field.id] 23697 }); 23698 } 23699 }, 23700 field.id 23701 ); 23702 }) 23703 ] }) 23704 } 23705 ) 23706 ] }); 23707 } 23708 23709 // packages/dataviews/build-module/hooks/use-delayed-loading.mjs 23710 var import_element96 = __toESM(require_element(), 1); 23711 function useDelayedLoading(isLoading, options = { delay: 400 }) { 23712 const [showLoader, setShowLoader] = (0, import_element96.useState)(false); 23713 (0, import_element96.useEffect)(() => { 23714 if (!isLoading) { 23715 return; 23716 } 23717 const timeout = setTimeout(() => { 23718 setShowLoader(true); 23719 }, options.delay); 23720 return () => { 23721 clearTimeout(timeout); 23722 setShowLoader(false); 23723 }; 23724 }, [isLoading, options.delay]); 23725 return showLoader; 23726 } 23727 23728 // packages/dataviews/build-module/components/dataviews-layouts/table/index.mjs 23729 var import_jsx_runtime125 = __toESM(require_jsx_runtime(), 1); 23730 function getEffectiveAlign(explicitAlign, fieldType) { 23731 if (explicitAlign) { 23732 return explicitAlign; 23733 } 23734 if (fieldType === "integer" || fieldType === "number") { 23735 return "end"; 23736 } 23737 return void 0; 23738 } 23739 function TableColumnField({ 23740 item, 23741 fields: fields3, 23742 column, 23743 align 23744 }) { 23745 const field = fields3.find((f2) => f2.id === column); 23746 if (!field) { 23747 return null; 23748 } 23749 const className = clsx_default("dataviews-view-table__cell-content-wrapper", { 23750 "dataviews-view-table__cell-align-end": align === "end", 23751 "dataviews-view-table__cell-align-center": align === "center" 23752 }); 23753 return /* @__PURE__ */ (0, import_jsx_runtime125.jsx)("div", { className, children: /* @__PURE__ */ (0, import_jsx_runtime125.jsx)(field.render, { item, field }) }); 23754 } 23755 function TableRow({ 23756 hasBulkActions, 23757 item, 23758 level, 23759 actions, 23760 fields: fields3, 23761 id, 23762 view, 23763 titleField, 23764 mediaField, 23765 descriptionField, 23766 selection, 23767 getItemId: getItemId2, 23768 isItemClickable: isItemClickable2, 23769 onClickItem, 23770 renderItemLink, 23771 onChangeSelection, 23772 isActionsColumnSticky, 23773 posinset 23774 }) { 23775 const { paginationInfo } = (0, import_element97.useContext)(dataviews_context_default); 23776 const hasPossibleBulkAction = useHasAPossibleBulkAction(actions, item); 23777 const isSelected2 = hasPossibleBulkAction && selection.includes(id); 23778 const { 23779 showTitle = true, 23780 showMedia = true, 23781 showDescription = true, 23782 infiniteScrollEnabled 23783 } = view; 23784 const isTouchDeviceRef = (0, import_element97.useRef)(false); 23785 const columns = view.fields ?? []; 23786 const hasPrimaryColumn = titleField && showTitle || mediaField && showMedia || descriptionField && showDescription; 23787 return /* @__PURE__ */ (0, import_jsx_runtime125.jsxs)( 23788 "tr", 23789 { 23790 className: clsx_default("dataviews-view-table__row", { 23791 "is-selected": hasPossibleBulkAction && isSelected2, 23792 "has-bulk-actions": hasPossibleBulkAction 23793 }), 23794 onTouchStart: () => { 23795 isTouchDeviceRef.current = true; 23796 }, 23797 "aria-setsize": infiniteScrollEnabled ? paginationInfo.totalItems : void 0, 23798 "aria-posinset": posinset, 23799 role: infiniteScrollEnabled ? "article" : void 0, 23800 onMouseDown: (event) => { 23801 const isMetaClick = (0, import_keycodes.isAppleOS)() ? event.metaKey : event.ctrlKey; 23802 if (event.button === 0 && isMetaClick && window.navigator.userAgent.toLowerCase().includes("firefox")) { 23803 event?.preventDefault(); 23804 } 23805 }, 23806 onClick: (event) => { 23807 if (!hasPossibleBulkAction) { 23808 return; 23809 } 23810 const isModifierKeyPressed = (0, import_keycodes.isAppleOS)() ? event.metaKey : event.ctrlKey; 23811 if (isModifierKeyPressed && !isTouchDeviceRef.current && document.getSelection()?.type !== "Range") { 23812 onChangeSelection( 23813 selection.includes(id) ? selection.filter((itemId) => id !== itemId) : [...selection, id] 23814 ); 23815 } 23816 }, 23817 children: [ 23818 hasBulkActions && /* @__PURE__ */ (0, import_jsx_runtime125.jsx)("td", { className: "dataviews-view-table__checkbox-column", children: /* @__PURE__ */ (0, import_jsx_runtime125.jsx)("div", { className: "dataviews-view-table__cell-content-wrapper", children: /* @__PURE__ */ (0, import_jsx_runtime125.jsx)( 23819 DataViewsSelectionCheckbox, 23820 { 23821 item, 23822 selection, 23823 onChangeSelection, 23824 getItemId: getItemId2, 23825 titleField, 23826 disabled: !hasPossibleBulkAction 23827 } 23828 ) }) }), 23829 hasPrimaryColumn && /* @__PURE__ */ (0, import_jsx_runtime125.jsx)("td", { children: /* @__PURE__ */ (0, import_jsx_runtime125.jsx)( 23830 column_primary_default, 23831 { 23832 item, 23833 level, 23834 titleField: showTitle ? titleField : void 0, 23835 mediaField: showMedia ? mediaField : void 0, 23836 descriptionField: showDescription ? descriptionField : void 0, 23837 isItemClickable: isItemClickable2, 23838 onClickItem, 23839 renderItemLink 23840 } 23841 ) }), 23842 columns.map((column) => { 23843 const { width, maxWidth, minWidth, align } = view.layout?.styles?.[column] ?? {}; 23844 const field = fields3.find((f2) => f2.id === column); 23845 const effectiveAlign = getEffectiveAlign(align, field?.type); 23846 return /* @__PURE__ */ (0, import_jsx_runtime125.jsx)( 23847 "td", 23848 { 23849 style: { 23850 width, 23851 maxWidth, 23852 minWidth 23853 }, 23854 children: /* @__PURE__ */ (0, import_jsx_runtime125.jsx)( 23855 TableColumnField, 23856 { 23857 fields: fields3, 23858 item, 23859 column, 23860 align: effectiveAlign 23861 } 23862 ) 23863 }, 23864 column 23865 ); 23866 }), 23867 !!actions?.length && // Disable reason: we are not making the element interactive, 23868 // but preventing any click events from bubbling up to the 23869 // table row. This allows us to add a click handler to the row 23870 // itself (to toggle row selection) without erroneously 23871 // intercepting click events from ItemActions. 23872 /* @__PURE__ */ (0, import_jsx_runtime125.jsx)( 23873 "td", 23874 { 23875 className: clsx_default("dataviews-view-table__actions-column", { 23876 "dataviews-view-table__actions-column--sticky": true, 23877 "dataviews-view-table__actions-column--stuck": isActionsColumnSticky 23878 }), 23879 onClick: (e2) => e2.stopPropagation(), 23880 children: /* @__PURE__ */ (0, import_jsx_runtime125.jsx)(ItemActions, { item, actions }) 23881 } 23882 ) 23883 ] 23884 } 23885 ); 23886 } 23887 function ViewTable({ 23888 actions, 23889 data, 23890 fields: fields3, 23891 getItemId: getItemId2, 23892 getItemLevel, 23893 isLoading = false, 23894 onChangeView, 23895 onChangeSelection, 23896 selection, 23897 setOpenedFilter, 23898 onClickItem, 23899 isItemClickable: isItemClickable2, 23900 renderItemLink, 23901 view, 23902 className, 23903 empty 23904 }) { 23905 const { containerRef } = (0, import_element97.useContext)(dataviews_context_default); 23906 const isDelayedLoading = useDelayedLoading(isLoading); 23907 const headerMenuRefs = (0, import_element97.useRef)(/* @__PURE__ */ new Map()); 23908 const headerMenuToFocusRef = (0, import_element97.useRef)(void 0); 23909 const [nextHeaderMenuToFocus, setNextHeaderMenuToFocus] = (0, import_element97.useState)(); 23910 const [contextMenuAnchor, setContextMenuAnchor] = (0, import_element97.useState)(null); 23911 (0, import_element97.useEffect)(() => { 23912 if (headerMenuToFocusRef.current) { 23913 headerMenuToFocusRef.current.focus(); 23914 headerMenuToFocusRef.current = void 0; 23915 } 23916 }); 23917 const tableNoticeId = (0, import_element97.useId)(); 23918 const { isHorizontalScrollEnd, isVerticallyScrolled } = useScrollState({ 23919 scrollContainerRef: containerRef, 23920 enabledHorizontal: !!actions?.length 23921 }); 23922 const hasBulkActions = useSomeItemHasAPossibleBulkAction(actions, data); 23923 if (nextHeaderMenuToFocus) { 23924 headerMenuToFocusRef.current = nextHeaderMenuToFocus; 23925 setNextHeaderMenuToFocus(void 0); 23926 return; 23927 } 23928 const onHide = (field) => { 23929 const hidden = headerMenuRefs.current.get(field.id); 23930 const fallback = hidden ? headerMenuRefs.current.get(hidden.fallback) : void 0; 23931 setNextHeaderMenuToFocus(fallback?.node); 23932 }; 23933 const handleHeaderContextMenu = (event) => { 23934 event.preventDefault(); 23935 event.stopPropagation(); 23936 const virtualAnchor = { 23937 getBoundingClientRect: () => ({ 23938 x: event.clientX, 23939 y: event.clientY, 23940 top: event.clientY, 23941 left: event.clientX, 23942 right: event.clientX, 23943 bottom: event.clientY, 23944 width: 0, 23945 height: 0, 23946 toJSON: () => ({}) 23947 }) 23948 }; 23949 window.requestAnimationFrame(() => { 23950 setContextMenuAnchor(virtualAnchor); 23951 }); 23952 }; 23953 const hasData = !!data?.length; 23954 const titleField = fields3.find((field) => field.id === view.titleField); 23955 const mediaField = fields3.find((field) => field.id === view.mediaField); 23956 const descriptionField = fields3.find( 23957 (field) => field.id === view.descriptionField 23958 ); 23959 const groupField = view.groupBy?.field ? fields3.find((f2) => f2.id === view.groupBy?.field) : null; 23960 const dataByGroup = groupField ? getDataByGroup(data, groupField) : null; 23961 const { showTitle = true, showMedia = true, showDescription = true } = view; 23962 const hasPrimaryColumn = titleField && showTitle || mediaField && showMedia || descriptionField && showDescription; 23963 const columns = view.fields ?? []; 23964 const headerMenuRef = (column, index2) => (node) => { 23965 if (node) { 23966 headerMenuRefs.current.set(column, { 23967 node, 23968 fallback: columns[index2 > 0 ? index2 - 1 : 1] 23969 }); 23970 } else { 23971 headerMenuRefs.current.delete(column); 23972 } 23973 }; 23974 const isInfiniteScroll = view.infiniteScrollEnabled && !dataByGroup; 23975 const isRtl = (0, import_i18n16.isRTL)(); 23976 if (!hasData) { 23977 return /* @__PURE__ */ (0, import_jsx_runtime125.jsx)( 23978 "div", 23979 { 23980 className: clsx_default("dataviews-no-results", { 23981 "is-refreshing": isDelayedLoading 23982 }), 23983 id: tableNoticeId, 23984 children: empty 23985 } 23986 ); 23987 } 23988 return /* @__PURE__ */ (0, import_jsx_runtime125.jsxs)(import_jsx_runtime125.Fragment, { children: [ 23989 /* @__PURE__ */ (0, import_jsx_runtime125.jsxs)( 23990 "table", 23991 { 23992 className: clsx_default("dataviews-view-table", className, { 23993 [`has-$view.layout?.density}-density`]: view.layout?.density && ["compact", "comfortable"].includes( 23994 view.layout.density 23995 ), 23996 "has-bulk-actions": hasBulkActions, 23997 "is-refreshing": !isInfiniteScroll && isDelayedLoading 23998 }), 23999 "aria-busy": isLoading, 24000 "aria-describedby": tableNoticeId, 24001 role: isInfiniteScroll ? "feed" : void 0, 24002 inert: !isInfiniteScroll && isLoading ? "true" : void 0, 24003 children: [ 24004 /* @__PURE__ */ (0, import_jsx_runtime125.jsxs)("colgroup", { children: [ 24005 hasBulkActions && /* @__PURE__ */ (0, import_jsx_runtime125.jsx)("col", { className: "dataviews-view-table__col-checkbox" }), 24006 hasPrimaryColumn && /* @__PURE__ */ (0, import_jsx_runtime125.jsx)("col", { className: "dataviews-view-table__col-first-data" }), 24007 columns.map((column, index2) => /* @__PURE__ */ (0, import_jsx_runtime125.jsx)( 24008 "col", 24009 { 24010 className: clsx_default( 24011 `dataviews-view-table__col-$column}`, 24012 { 24013 "dataviews-view-table__col-expand": !hasPrimaryColumn && index2 === columns.length - 1 24014 } 24015 ) 24016 }, 24017 `col-$column}` 24018 )), 24019 !!actions?.length && /* @__PURE__ */ (0, import_jsx_runtime125.jsx)("col", { className: "dataviews-view-table__col-actions" }) 24020 ] }), 24021 contextMenuAnchor && /* @__PURE__ */ (0, import_jsx_runtime125.jsx)( 24022 import_components7.Popover, 24023 { 24024 anchor: contextMenuAnchor, 24025 onClose: () => setContextMenuAnchor(null), 24026 placement: "bottom-start", 24027 children: /* @__PURE__ */ (0, import_jsx_runtime125.jsx)(PropertiesSection, { showLabel: false }) 24028 } 24029 ), 24030 /* @__PURE__ */ (0, import_jsx_runtime125.jsx)( 24031 "thead", 24032 { 24033 className: clsx_default({ 24034 "dataviews-view-table__thead--stuck": isVerticallyScrolled 24035 }), 24036 onContextMenu: handleHeaderContextMenu, 24037 children: /* @__PURE__ */ (0, import_jsx_runtime125.jsxs)("tr", { className: "dataviews-view-table__row", children: [ 24038 hasBulkActions && /* @__PURE__ */ (0, import_jsx_runtime125.jsx)( 24039 "th", 24040 { 24041 className: "dataviews-view-table__checkbox-column", 24042 scope: "col", 24043 onContextMenu: handleHeaderContextMenu, 24044 children: /* @__PURE__ */ (0, import_jsx_runtime125.jsx)( 24045 BulkSelectionCheckbox, 24046 { 24047 selection, 24048 onChangeSelection, 24049 data, 24050 actions, 24051 getItemId: getItemId2 24052 } 24053 ) 24054 } 24055 ), 24056 hasPrimaryColumn && /* @__PURE__ */ (0, import_jsx_runtime125.jsx)("th", { scope: "col", children: titleField && /* @__PURE__ */ (0, import_jsx_runtime125.jsx)( 24057 column_header_menu_default, 24058 { 24059 ref: headerMenuRef( 24060 titleField.id, 24061 0 24062 ), 24063 fieldId: titleField.id, 24064 view, 24065 fields: fields3, 24066 onChangeView, 24067 onHide, 24068 setOpenedFilter, 24069 canMove: false, 24070 canInsertLeft: isRtl ? view.layout?.enableMoving ?? true : false, 24071 canInsertRight: isRtl ? false : view.layout?.enableMoving ?? true 24072 } 24073 ) }), 24074 columns.map((column, index2) => { 24075 const { width, maxWidth, minWidth, align } = view.layout?.styles?.[column] ?? {}; 24076 const field = fields3.find( 24077 (f2) => f2.id === column 24078 ); 24079 const effectiveAlign = getEffectiveAlign( 24080 align, 24081 field?.type 24082 ); 24083 const canInsertOrMove = view.layout?.enableMoving ?? true; 24084 return /* @__PURE__ */ (0, import_jsx_runtime125.jsx)( 24085 "th", 24086 { 24087 style: { 24088 width, 24089 maxWidth, 24090 minWidth, 24091 textAlign: effectiveAlign 24092 }, 24093 "aria-sort": view.sort?.direction && view.sort?.field === column ? sortValues[view.sort.direction] : void 0, 24094 scope: "col", 24095 children: /* @__PURE__ */ (0, import_jsx_runtime125.jsx)( 24096 column_header_menu_default, 24097 { 24098 ref: headerMenuRef(column, index2), 24099 fieldId: column, 24100 view, 24101 fields: fields3, 24102 onChangeView, 24103 onHide, 24104 setOpenedFilter, 24105 canMove: canInsertOrMove, 24106 canInsertLeft: canInsertOrMove, 24107 canInsertRight: canInsertOrMove 24108 } 24109 ) 24110 }, 24111 column 24112 ); 24113 }), 24114 !!actions?.length && /* @__PURE__ */ (0, import_jsx_runtime125.jsx)( 24115 "th", 24116 { 24117 className: clsx_default( 24118 "dataviews-view-table__actions-column", 24119 { 24120 "dataviews-view-table__actions-column--sticky": true, 24121 "dataviews-view-table__actions-column--stuck": !isHorizontalScrollEnd 24122 } 24123 ), 24124 children: /* @__PURE__ */ (0, import_jsx_runtime125.jsx)("span", { className: "dataviews-view-table-header", children: (0, import_i18n16.__)("Actions") }) 24125 } 24126 ) 24127 ] }) 24128 } 24129 ), 24130 hasData && groupField && dataByGroup ? Array.from(dataByGroup.entries()).map( 24131 ([groupName, groupItems]) => /* @__PURE__ */ (0, import_jsx_runtime125.jsxs)("tbody", { children: [ 24132 /* @__PURE__ */ (0, import_jsx_runtime125.jsx)("tr", { className: "dataviews-view-table__group-header-row", children: /* @__PURE__ */ (0, import_jsx_runtime125.jsx)( 24133 "td", 24134 { 24135 colSpan: columns.length + (hasPrimaryColumn ? 1 : 0) + (hasBulkActions ? 1 : 0) + (actions?.length ? 1 : 0), 24136 className: "dataviews-view-table__group-header-cell", 24137 children: view.groupBy?.showLabel === false ? groupName : (0, import_i18n16.sprintf)( 24138 // translators: 1: The label of the field e.g. "Date". 2: The value of the field, e.g.: "May 2022". 24139 (0, import_i18n16.__)("%1$s: %2$s"), 24140 groupField.label, 24141 groupName 24142 ) 24143 } 24144 ) }), 24145 groupItems.map((item, index2) => /* @__PURE__ */ (0, import_jsx_runtime125.jsx)( 24146 TableRow, 24147 { 24148 item, 24149 level: view.showLevels && typeof getItemLevel === "function" ? getItemLevel(item) : void 0, 24150 hasBulkActions, 24151 actions, 24152 fields: fields3, 24153 id: getItemId2(item) || index2.toString(), 24154 view, 24155 titleField, 24156 mediaField, 24157 descriptionField, 24158 selection, 24159 getItemId: getItemId2, 24160 onChangeSelection, 24161 onClickItem, 24162 renderItemLink, 24163 isItemClickable: isItemClickable2, 24164 isActionsColumnSticky: !isHorizontalScrollEnd 24165 }, 24166 getItemId2(item) 24167 )) 24168 ] }, `group-$groupName}`) 24169 ) : /* @__PURE__ */ (0, import_jsx_runtime125.jsx)("tbody", { children: hasData && data.map((item, index2) => /* @__PURE__ */ (0, import_jsx_runtime125.jsx)( 24170 TableRow, 24171 { 24172 item, 24173 level: view.showLevels && typeof getItemLevel === "function" ? getItemLevel(item) : void 0, 24174 hasBulkActions, 24175 actions, 24176 fields: fields3, 24177 id: getItemId2(item) || index2.toString(), 24178 view, 24179 titleField, 24180 mediaField, 24181 descriptionField, 24182 selection, 24183 getItemId: getItemId2, 24184 onChangeSelection, 24185 onClickItem, 24186 renderItemLink, 24187 isItemClickable: isItemClickable2, 24188 isActionsColumnSticky: !isHorizontalScrollEnd, 24189 posinset: isInfiniteScroll ? index2 + 1 : void 0 24190 }, 24191 getItemId2(item) 24192 )) }) 24193 ] 24194 } 24195 ), 24196 isInfiniteScroll && isLoading && /* @__PURE__ */ (0, import_jsx_runtime125.jsx)("div", { className: "dataviews-loading", id: tableNoticeId, children: /* @__PURE__ */ (0, import_jsx_runtime125.jsx)("p", { className: "dataviews-loading-more", children: /* @__PURE__ */ (0, import_jsx_runtime125.jsx)(import_components7.Spinner, {}) }) }) 24197 ] }); 24198 } 24199 var table_default = ViewTable; 24200 24201 // packages/dataviews/build-module/components/dataviews-layouts/grid/index.mjs 24202 var import_components10 = __toESM(require_components(), 1); 24203 var import_i18n19 = __toESM(require_i18n(), 1); 24204 24205 // packages/dataviews/build-module/components/dataviews-layouts/grid/composite-grid.mjs 24206 var import_components9 = __toESM(require_components(), 1); 24207 var import_i18n18 = __toESM(require_i18n(), 1); 24208 var import_compose10 = __toESM(require_compose(), 1); 24209 var import_keycodes2 = __toESM(require_keycodes(), 1); 24210 var import_element101 = __toESM(require_element(), 1); 24211 24212 // packages/dataviews/build-module/components/dataviews-layouts/grid/preview-size-picker.mjs 24213 var import_components8 = __toESM(require_components(), 1); 24214 var import_i18n17 = __toESM(require_i18n(), 1); 24215 var import_element98 = __toESM(require_element(), 1); 24216 var import_jsx_runtime126 = __toESM(require_jsx_runtime(), 1); 24217 var imageSizes = [ 24218 { 24219 value: 120, 24220 breakpoint: 1 24221 }, 24222 { 24223 value: 170, 24224 breakpoint: 1 24225 }, 24226 { 24227 value: 230, 24228 breakpoint: 1 24229 }, 24230 { 24231 value: 290, 24232 breakpoint: 1112 24233 // at minimum image width, 4 images display at this container size 24234 }, 24235 { 24236 value: 350, 24237 breakpoint: 1636 24238 // at minimum image width, 6 images display at this container size 24239 }, 24240 { 24241 value: 430, 24242 breakpoint: 588 24243 // at minimum image width, 2 images display at this container size 24244 } 24245 ]; 24246 var DEFAULT_PREVIEW_SIZE = imageSizes[2].value; 24247 function useGridColumns() { 24248 const context = (0, import_element98.useContext)(dataviews_context_default); 24249 const view = context.view; 24250 return (0, import_element98.useMemo)(() => { 24251 const containerWidth = context.containerWidth; 24252 const gap = 32; 24253 const previewSize = view.layout?.previewSize ?? DEFAULT_PREVIEW_SIZE; 24254 const columns = Math.floor( 24255 (containerWidth + gap) / (previewSize + gap) 24256 ); 24257 return Math.max(1, columns); 24258 }, [context.containerWidth, view.layout?.previewSize]); 24259 } 24260 24261 // packages/dataviews/build-module/components/dataviews-layouts/utils/grid-items.mjs 24262 var import_element99 = __toESM(require_element(), 1); 24263 var import_jsx_runtime127 = __toESM(require_jsx_runtime(), 1); 24264 var GridItems = (0, import_element99.forwardRef)(({ className, previewSize, ...props }, ref) => { 24265 return /* @__PURE__ */ (0, import_jsx_runtime127.jsx)( 24266 "div", 24267 { 24268 ref, 24269 className: clsx_default("dataviews-view-grid-items", className), 24270 style: { 24271 gridTemplateColumns: previewSize && `repeat(auto-fill, minmax($previewSize}px, 1fr))` 24272 }, 24273 ...props 24274 } 24275 ); 24276 }); 24277 24278 // packages/dataviews/build-module/components/dataviews-layouts/utils/use-infinite-scroll.mjs 24279 var import_element100 = __toESM(require_element(), 1); 24280 function useIntersectionObserver(elementRef, posinset) { 24281 const { intersectionObserver } = (0, import_element100.useContext)(dataviews_context_default); 24282 (0, import_element100.useEffect)(() => { 24283 const element = elementRef.current; 24284 if (!element || posinset === void 0 || !intersectionObserver) { 24285 return; 24286 } 24287 intersectionObserver.observe(element); 24288 return () => { 24289 intersectionObserver.unobserve(element); 24290 }; 24291 }, [elementRef, intersectionObserver, posinset]); 24292 } 24293 function usePlaceholdersNeeded(data, isInfiniteScroll, gridColumns) { 24294 const hasData = !!data?.length; 24295 const firstItemPosition = hasData && isInfiniteScroll ? data[0].position : void 0; 24296 return firstItemPosition && gridColumns ? (firstItemPosition - 1) % gridColumns : 0; 24297 } 24298 24299 // packages/dataviews/build-module/components/dataviews-layouts/grid/composite-grid.mjs 24300 var import_jsx_runtime128 = __toESM(require_jsx_runtime(), 1); 24301 var { Badge: WCBadge } = unlock2(import_components9.privateApis); 24302 function chunk(array, size4) { 24303 const chunks = []; 24304 for (let i2 = 0, j2 = array.length; i2 < j2; i2 += size4) { 24305 chunks.push(array.slice(i2, i2 + size4)); 24306 } 24307 return chunks; 24308 } 24309 var GridItem = (0, import_element101.forwardRef)( 24310 function GridItem2({ 24311 view, 24312 selection, 24313 onChangeSelection, 24314 onClickItem, 24315 isItemClickable: isItemClickable2, 24316 renderItemLink, 24317 getItemId: getItemId2, 24318 item, 24319 actions, 24320 mediaField, 24321 titleField, 24322 descriptionField, 24323 regularFields, 24324 badgeFields, 24325 hasBulkActions, 24326 config, 24327 posinset, 24328 setsize, 24329 ...props 24330 }, forwardedRef) { 24331 const { 24332 showTitle = true, 24333 showMedia = true, 24334 showDescription = true 24335 } = view; 24336 const hasBulkAction = useHasAPossibleBulkAction(actions, item); 24337 const id = getItemId2(item); 24338 const elementRef = (0, import_element101.useRef)(null); 24339 const setRefs = (0, import_element101.useCallback)( 24340 (node) => { 24341 elementRef.current = node; 24342 if (typeof forwardedRef === "function") { 24343 forwardedRef(node); 24344 } else if (forwardedRef) { 24345 forwardedRef.current = node; 24346 } 24347 }, 24348 [forwardedRef] 24349 ); 24350 useIntersectionObserver(elementRef, posinset); 24351 const instanceId = (0, import_compose10.useInstanceId)(GridItem2); 24352 const isSelected2 = selection.includes(id); 24353 const mediaPlaceholder = /* @__PURE__ */ (0, import_jsx_runtime128.jsx)("span", { className: "dataviews-view-grid__media-placeholder" }); 24354 const rendersMediaField = showMedia && mediaField?.render; 24355 const renderedMediaField = rendersMediaField ? /* @__PURE__ */ (0, import_jsx_runtime128.jsx)( 24356 mediaField.render, 24357 { 24358 item, 24359 field: mediaField, 24360 config 24361 } 24362 ) : mediaPlaceholder; 24363 const renderedTitleField = showTitle && titleField?.render ? /* @__PURE__ */ (0, import_jsx_runtime128.jsx)(titleField.render, { item, field: titleField }) : null; 24364 let mediaA11yProps; 24365 let titleA11yProps; 24366 if (isItemClickable2(item) && onClickItem) { 24367 if (renderedTitleField) { 24368 mediaA11yProps = { 24369 "aria-labelledby": `dataviews-view-grid__title-field-$instanceId}` 24370 }; 24371 titleA11yProps = { 24372 id: `dataviews-view-grid__title-field-$instanceId}` 24373 }; 24374 } else { 24375 mediaA11yProps = { 24376 "aria-label": (0, import_i18n18.__)("Navigate to item") 24377 }; 24378 } 24379 } 24380 return /* @__PURE__ */ (0, import_jsx_runtime128.jsxs)( 24381 Stack, 24382 { 24383 direction: "column", 24384 ...props, 24385 ref: setRefs, 24386 "aria-setsize": setsize, 24387 "aria-posinset": posinset, 24388 className: clsx_default( 24389 props.className, 24390 "dataviews-view-grid__row__gridcell", 24391 "dataviews-view-grid__card", 24392 { 24393 "is-selected": hasBulkAction && isSelected2 24394 } 24395 ), 24396 onClickCapture: (event) => { 24397 props.onClickCapture?.(event); 24398 if ((0, import_keycodes2.isAppleOS)() ? event.metaKey : event.ctrlKey) { 24399 event.stopPropagation(); 24400 event.preventDefault(); 24401 if (!hasBulkAction) { 24402 return; 24403 } 24404 onChangeSelection( 24405 isSelected2 ? selection.filter( 24406 (itemId) => id !== itemId 24407 ) : [...selection, id] 24408 ); 24409 } 24410 }, 24411 children: [ 24412 /* @__PURE__ */ (0, import_jsx_runtime128.jsx)( 24413 ItemClickWrapper, 24414 { 24415 item, 24416 isItemClickable: isItemClickable2, 24417 onClickItem, 24418 renderItemLink, 24419 className: clsx_default("dataviews-view-grid__media", { 24420 "dataviews-view-grid__media--placeholder": !rendersMediaField 24421 }), 24422 ...mediaA11yProps, 24423 children: renderedMediaField 24424 } 24425 ), 24426 hasBulkActions && /* @__PURE__ */ (0, import_jsx_runtime128.jsx)( 24427 DataViewsSelectionCheckbox, 24428 { 24429 item, 24430 selection, 24431 onChangeSelection, 24432 getItemId: getItemId2, 24433 titleField, 24434 disabled: !hasBulkAction 24435 } 24436 ), 24437 !!actions?.length && /* @__PURE__ */ (0, import_jsx_runtime128.jsx)("div", { className: "dataviews-view-grid__media-actions", children: /* @__PURE__ */ (0, import_jsx_runtime128.jsx)( 24438 ItemActions, 24439 { 24440 item, 24441 actions, 24442 isCompact: true 24443 } 24444 ) }), 24445 showTitle && /* @__PURE__ */ (0, import_jsx_runtime128.jsx)("div", { className: "dataviews-view-grid__title-actions", children: /* @__PURE__ */ (0, import_jsx_runtime128.jsx)( 24446 ItemClickWrapper, 24447 { 24448 item, 24449 isItemClickable: isItemClickable2, 24450 onClickItem, 24451 renderItemLink, 24452 className: "dataviews-view-grid__title-field dataviews-title-field", 24453 ...titleA11yProps, 24454 title: titleField?.getValueFormatted({ 24455 item, 24456 field: titleField 24457 }) || void 0, 24458 children: renderedTitleField 24459 } 24460 ) }), 24461 /* @__PURE__ */ (0, import_jsx_runtime128.jsxs)(Stack, { direction: "column", gap: "xs", children: [ 24462 showDescription && descriptionField?.render && /* @__PURE__ */ (0, import_jsx_runtime128.jsx)( 24463 descriptionField.render, 24464 { 24465 item, 24466 field: descriptionField 24467 } 24468 ), 24469 !!badgeFields?.length && /* @__PURE__ */ (0, import_jsx_runtime128.jsx)( 24470 Stack, 24471 { 24472 direction: "row", 24473 className: "dataviews-view-grid__badge-fields", 24474 gap: "sm", 24475 wrap: "wrap", 24476 align: "top", 24477 justify: "flex-start", 24478 children: badgeFields.map((field) => { 24479 return /* @__PURE__ */ (0, import_jsx_runtime128.jsx)( 24480 WCBadge, 24481 { 24482 className: "dataviews-view-grid__field-value", 24483 children: /* @__PURE__ */ (0, import_jsx_runtime128.jsx)( 24484 field.render, 24485 { 24486 item, 24487 field 24488 } 24489 ) 24490 }, 24491 field.id 24492 ); 24493 }) 24494 } 24495 ), 24496 !!regularFields?.length && /* @__PURE__ */ (0, import_jsx_runtime128.jsx)( 24497 Stack, 24498 { 24499 direction: "column", 24500 className: "dataviews-view-grid__fields", 24501 gap: "xs", 24502 children: regularFields.map((field) => { 24503 return /* @__PURE__ */ (0, import_jsx_runtime128.jsx)( 24504 import_components9.Flex, 24505 { 24506 className: "dataviews-view-grid__field", 24507 gap: 1, 24508 justify: "flex-start", 24509 expanded: true, 24510 style: { height: "auto" }, 24511 direction: "row", 24512 children: /* @__PURE__ */ (0, import_jsx_runtime128.jsxs)(import_jsx_runtime128.Fragment, { children: [ 24513 /* @__PURE__ */ (0, import_jsx_runtime128.jsxs)(tooltip_exports.Root, { children: [ 24514 /* @__PURE__ */ (0, import_jsx_runtime128.jsx)( 24515 tooltip_exports.Trigger, 24516 { 24517 render: /* @__PURE__ */ (0, import_jsx_runtime128.jsx)(import_components9.FlexItem, { className: "dataviews-view-grid__field-name", children: field.header }) 24518 } 24519 ), 24520 /* @__PURE__ */ (0, import_jsx_runtime128.jsx)(tooltip_exports.Popup, { children: field.label }) 24521 ] }), 24522 /* @__PURE__ */ (0, import_jsx_runtime128.jsx)( 24523 import_components9.FlexItem, 24524 { 24525 className: "dataviews-view-grid__field-value", 24526 style: { maxHeight: "none" }, 24527 children: /* @__PURE__ */ (0, import_jsx_runtime128.jsx)( 24528 field.render, 24529 { 24530 item, 24531 field 24532 } 24533 ) 24534 } 24535 ) 24536 ] }) 24537 }, 24538 field.id 24539 ); 24540 }) 24541 } 24542 ) 24543 ] }) 24544 ] 24545 } 24546 ); 24547 } 24548 ); 24549 function CompositeGrid({ 24550 data, 24551 isInfiniteScroll, 24552 className, 24553 inert, 24554 isLoading, 24555 view, 24556 fields: fields3, 24557 selection, 24558 onChangeSelection, 24559 onClickItem, 24560 isItemClickable: isItemClickable2, 24561 renderItemLink, 24562 getItemId: getItemId2, 24563 actions 24564 }) { 24565 const { paginationInfo, resizeObserverRef } = (0, import_element101.useContext)(dataviews_context_default); 24566 const gridColumns = useGridColumns(); 24567 const hasBulkActions = useSomeItemHasAPossibleBulkAction(actions, data); 24568 const titleField = fields3.find( 24569 (field) => field.id === view?.titleField 24570 ); 24571 const mediaField = fields3.find( 24572 (field) => field.id === view?.mediaField 24573 ); 24574 const descriptionField = fields3.find( 24575 (field) => field.id === view?.descriptionField 24576 ); 24577 const otherFields = view.fields ?? []; 24578 const { regularFields, badgeFields } = otherFields.reduce( 24579 (accumulator, fieldId) => { 24580 const field = fields3.find((f2) => f2.id === fieldId); 24581 if (!field) { 24582 return accumulator; 24583 } 24584 const key2 = view.layout?.badgeFields?.includes(fieldId) ? "badgeFields" : "regularFields"; 24585 accumulator[key2].push(field); 24586 return accumulator; 24587 }, 24588 { regularFields: [], badgeFields: [] } 24589 ); 24590 const size4 = "900px"; 24591 const totalRows = Math.ceil(data.length / gridColumns); 24592 const placeholdersNeeded = usePlaceholdersNeeded( 24593 data, 24594 isInfiniteScroll, 24595 gridColumns 24596 ); 24597 return /* @__PURE__ */ (0, import_jsx_runtime128.jsxs)(import_jsx_runtime128.Fragment, { 24598 // Render infinite scroll layout (no rows, feed semantics) 24599 children: [ 24600 isInfiniteScroll && /* @__PURE__ */ (0, import_jsx_runtime128.jsxs)( 24601 import_components9.Composite, 24602 { 24603 render: /* @__PURE__ */ (0, import_jsx_runtime128.jsx)( 24604 GridItems, 24605 { 24606 className: clsx_default( 24607 "dataviews-view-grid-infinite-scroll", 24608 className, 24609 { 24610 [`has-$view.layout?.density}-density`]: view.layout?.density && [ 24611 "compact", 24612 "comfortable" 24613 ].includes(view.layout.density) 24614 } 24615 ), 24616 previewSize: view.layout?.previewSize, 24617 "aria-busy": isLoading, 24618 ref: resizeObserverRef 24619 } 24620 ), 24621 role: "feed", 24622 focusWrap: true, 24623 inert, 24624 children: [ 24625 Array.from({ length: placeholdersNeeded }).map( 24626 (_, index2) => /* @__PURE__ */ (0, import_jsx_runtime128.jsx)( 24627 import_components9.Composite.Item, 24628 { 24629 render: (props) => /* @__PURE__ */ (0, import_jsx_runtime128.jsx)( 24630 Stack, 24631 { 24632 ...props, 24633 direction: "column", 24634 role: "article", 24635 className: "dataviews-view-grid__row__gridcell dataviews-view-grid__card dataviews-view-grid__placeholder" 24636 } 24637 ), 24638 "aria-hidden": true, 24639 tabIndex: -1 24640 }, 24641 `placeholder-$index2}` 24642 ) 24643 ), 24644 data.map((item) => { 24645 const itemId = getItemId2(item); 24646 const stablePosition = item.position; 24647 return /* @__PURE__ */ (0, import_jsx_runtime128.jsx)( 24648 import_components9.Composite.Item, 24649 { 24650 render: (props) => /* @__PURE__ */ (0, import_jsx_runtime128.jsx)( 24651 GridItem, 24652 { 24653 ...props, 24654 id: itemId, 24655 role: "article", 24656 view, 24657 selection, 24658 onChangeSelection, 24659 onClickItem, 24660 isItemClickable: isItemClickable2, 24661 renderItemLink, 24662 getItemId: getItemId2, 24663 item, 24664 actions, 24665 mediaField, 24666 titleField, 24667 descriptionField, 24668 regularFields, 24669 badgeFields, 24670 hasBulkActions, 24671 posinset: stablePosition, 24672 setsize: paginationInfo.totalItems, 24673 config: { 24674 sizes: size4 24675 } 24676 } 24677 ) 24678 }, 24679 itemId 24680 ); 24681 }) 24682 ] 24683 } 24684 ), 24685 // Render standard grid layout (with rows, grid semantics) 24686 !isInfiniteScroll && /* @__PURE__ */ (0, import_jsx_runtime128.jsx)( 24687 import_components9.Composite, 24688 { 24689 role: "grid", 24690 className: clsx_default("dataviews-view-grid", className, { 24691 [`has-$view.layout?.density}-density`]: view.layout?.density && ["compact", "comfortable"].includes( 24692 view.layout.density 24693 ) 24694 }), 24695 focusWrap: true, 24696 "aria-busy": isLoading, 24697 "aria-rowcount": totalRows, 24698 ref: resizeObserverRef, 24699 inert, 24700 children: chunk(data, gridColumns).map((row, i2) => /* @__PURE__ */ (0, import_jsx_runtime128.jsx)( 24701 import_components9.Composite.Row, 24702 { 24703 render: /* @__PURE__ */ (0, import_jsx_runtime128.jsx)( 24704 "div", 24705 { 24706 role: "row", 24707 "aria-rowindex": i2 + 1, 24708 "aria-label": (0, import_i18n18.sprintf)( 24709 /* translators: %d: The row number in the grid */ 24710 (0, import_i18n18.__)("Row %d"), 24711 i2 + 1 24712 ), 24713 className: "dataviews-view-grid__row", 24714 style: { 24715 gridTemplateColumns: `repeat( $gridColumns}, minmax(0, 1fr) )` 24716 } 24717 } 24718 ), 24719 children: row.map((item) => { 24720 const itemId = getItemId2(item); 24721 return /* @__PURE__ */ (0, import_jsx_runtime128.jsx)( 24722 import_components9.Composite.Item, 24723 { 24724 render: (props) => /* @__PURE__ */ (0, import_jsx_runtime128.jsx)( 24725 GridItem, 24726 { 24727 ...props, 24728 id: itemId, 24729 role: "gridcell", 24730 view, 24731 selection, 24732 onChangeSelection, 24733 onClickItem, 24734 isItemClickable: isItemClickable2, 24735 renderItemLink, 24736 getItemId: getItemId2, 24737 item, 24738 actions, 24739 mediaField, 24740 titleField, 24741 descriptionField, 24742 regularFields, 24743 badgeFields, 24744 hasBulkActions, 24745 config: { 24746 sizes: size4 24747 } 24748 } 24749 ) 24750 }, 24751 itemId 24752 ); 24753 }) 24754 }, 24755 i2 24756 )) 24757 } 24758 ) 24759 ] 24760 }); 24761 } 24762 24763 // packages/dataviews/build-module/components/dataviews-layouts/grid/index.mjs 24764 var import_jsx_runtime129 = __toESM(require_jsx_runtime(), 1); 24765 function ViewGrid({ 24766 actions, 24767 data, 24768 fields: fields3, 24769 getItemId: getItemId2, 24770 isLoading, 24771 onChangeSelection, 24772 onClickItem, 24773 isItemClickable: isItemClickable2, 24774 renderItemLink, 24775 selection, 24776 view, 24777 className, 24778 empty 24779 }) { 24780 const isDelayedLoading = useDelayedLoading(!!isLoading); 24781 const hasData = !!data?.length; 24782 const groupField = view.groupBy?.field ? fields3.find((f2) => f2.id === view.groupBy?.field) : null; 24783 const dataByGroup = groupField ? getDataByGroup(data, groupField) : null; 24784 const isInfiniteScroll = view.infiniteScrollEnabled && !dataByGroup; 24785 if (!hasData) { 24786 return /* @__PURE__ */ (0, import_jsx_runtime129.jsx)( 24787 "div", 24788 { 24789 className: clsx_default("dataviews-no-results", { 24790 "is-refreshing": isDelayedLoading 24791 }), 24792 children: empty 24793 } 24794 ); 24795 } 24796 const gridProps = { 24797 className: clsx_default(className, { 24798 "is-refreshing": !isInfiniteScroll && isDelayedLoading 24799 }), 24800 inert: !isInfiniteScroll && !!isLoading ? "true" : void 0, 24801 isLoading, 24802 view, 24803 fields: fields3, 24804 selection, 24805 onChangeSelection, 24806 onClickItem, 24807 isItemClickable: isItemClickable2, 24808 renderItemLink, 24809 getItemId: getItemId2, 24810 actions 24811 }; 24812 return /* @__PURE__ */ (0, import_jsx_runtime129.jsxs)(import_jsx_runtime129.Fragment, { 24813 // Render multiple groups. 24814 children: [ 24815 hasData && groupField && dataByGroup && /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(Stack, { direction: "column", gap: "lg", children: Array.from(dataByGroup.entries()).map( 24816 ([groupName, groupItems]) => /* @__PURE__ */ (0, import_jsx_runtime129.jsxs)( 24817 Stack, 24818 { 24819 direction: "column", 24820 gap: "sm", 24821 children: [ 24822 /* @__PURE__ */ (0, import_jsx_runtime129.jsx)("h3", { className: "dataviews-view-grid__group-header", children: view.groupBy?.showLabel === false ? groupName : (0, import_i18n19.sprintf)( 24823 // translators: 1: The label of the field e.g. "Date". 2: The value of the field, e.g.: "May 2022". 24824 (0, import_i18n19.__)("%1$s: %2$s"), 24825 groupField.label, 24826 groupName 24827 ) }), 24828 /* @__PURE__ */ (0, import_jsx_runtime129.jsx)( 24829 CompositeGrid, 24830 { 24831 ...gridProps, 24832 data: groupItems, 24833 isInfiniteScroll: false 24834 } 24835 ) 24836 ] 24837 }, 24838 groupName 24839 ) 24840 ) }), 24841 // Render a single grid with all data. 24842 !dataByGroup && /* @__PURE__ */ (0, import_jsx_runtime129.jsx)( 24843 CompositeGrid, 24844 { 24845 ...gridProps, 24846 data, 24847 isInfiniteScroll: !!isInfiniteScroll 24848 } 24849 ), 24850 isInfiniteScroll && isLoading && /* @__PURE__ */ (0, import_jsx_runtime129.jsx)("p", { className: "dataviews-loading-more", children: /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(import_components10.Spinner, {}) }) 24851 ] 24852 }); 24853 } 24854 var grid_default2 = ViewGrid; 24855 24856 // packages/dataviews/build-module/components/dataviews-layouts/list/index.mjs 24857 var import_compose11 = __toESM(require_compose(), 1); 24858 var import_components11 = __toESM(require_components(), 1); 24859 var import_element102 = __toESM(require_element(), 1); 24860 var import_i18n20 = __toESM(require_i18n(), 1); 24861 var import_data5 = __toESM(require_data(), 1); 24862 var import_jsx_runtime130 = __toESM(require_jsx_runtime(), 1); 24863 var { Menu: Menu3 } = unlock2(import_components11.privateApis); 24864 function generateItemWrapperCompositeId(idPrefix) { 24865 return `$idPrefix}-item-wrapper`; 24866 } 24867 function generatePrimaryActionCompositeId(idPrefix, primaryActionId) { 24868 return `$idPrefix}-primary-action-$primaryActionId}`; 24869 } 24870 function generateDropdownTriggerCompositeId(idPrefix) { 24871 return `$idPrefix}-dropdown`; 24872 } 24873 function PrimaryActionGridCell({ 24874 idPrefix, 24875 primaryAction, 24876 item 24877 }) { 24878 const registry = (0, import_data5.useRegistry)(); 24879 const [isModalOpen, setIsModalOpen] = (0, import_element102.useState)(false); 24880 const compositeItemId = generatePrimaryActionCompositeId( 24881 idPrefix, 24882 primaryAction.id 24883 ); 24884 const label = typeof primaryAction.label === "string" ? primaryAction.label : primaryAction.label([item]); 24885 return "RenderModal" in primaryAction ? /* @__PURE__ */ (0, import_jsx_runtime130.jsx)("div", { role: "gridcell", children: /* @__PURE__ */ (0, import_jsx_runtime130.jsx)( 24886 import_components11.Composite.Item, 24887 { 24888 id: compositeItemId, 24889 render: /* @__PURE__ */ (0, import_jsx_runtime130.jsx)( 24890 import_components11.Button, 24891 { 24892 disabled: !!primaryAction.disabled, 24893 accessibleWhenDisabled: true, 24894 text: label, 24895 size: "small", 24896 onClick: () => setIsModalOpen(true) 24897 } 24898 ), 24899 children: isModalOpen && /* @__PURE__ */ (0, import_jsx_runtime130.jsx)( 24900 ActionModal, 24901 { 24902 action: primaryAction, 24903 items: [item], 24904 closeModal: () => setIsModalOpen(false) 24905 } 24906 ) 24907 } 24908 ) }, primaryAction.id) : /* @__PURE__ */ (0, import_jsx_runtime130.jsx)("div", { role: "gridcell", children: /* @__PURE__ */ (0, import_jsx_runtime130.jsx)( 24909 import_components11.Composite.Item, 24910 { 24911 id: compositeItemId, 24912 render: /* @__PURE__ */ (0, import_jsx_runtime130.jsx)( 24913 import_components11.Button, 24914 { 24915 disabled: !!primaryAction.disabled, 24916 accessibleWhenDisabled: true, 24917 size: "small", 24918 onClick: () => { 24919 primaryAction.callback([item], { registry }); 24920 }, 24921 children: label 24922 } 24923 ) 24924 } 24925 ) }, primaryAction.id); 24926 } 24927 function ListItem({ 24928 view, 24929 actions, 24930 idPrefix, 24931 isSelected: isSelected2, 24932 item, 24933 titleField, 24934 mediaField, 24935 descriptionField, 24936 onSelect, 24937 otherFields, 24938 onDropdownTriggerKeyDown, 24939 posinset 24940 }) { 24941 const { 24942 showTitle = true, 24943 showMedia = true, 24944 showDescription = true, 24945 infiniteScrollEnabled 24946 } = view; 24947 const itemRef = (0, import_element102.useRef)(null); 24948 const labelId = `$idPrefix}-label`; 24949 const descriptionId = `$idPrefix}-description`; 24950 const registry = (0, import_data5.useRegistry)(); 24951 const [isHovered, setIsHovered] = (0, import_element102.useState)(false); 24952 const [activeModalAction, setActiveModalAction] = (0, import_element102.useState)( 24953 null 24954 ); 24955 const handleHover = ({ type }) => { 24956 const isHover = type === "mouseenter"; 24957 setIsHovered(isHover); 24958 }; 24959 const { paginationInfo } = (0, import_element102.useContext)(dataviews_context_default); 24960 (0, import_element102.useEffect)(() => { 24961 if (isSelected2) { 24962 itemRef.current?.scrollIntoView({ 24963 behavior: "auto", 24964 block: "nearest", 24965 inline: "nearest" 24966 }); 24967 } 24968 }, [isSelected2]); 24969 const { primaryAction, eligibleActions } = (0, import_element102.useMemo)(() => { 24970 const _eligibleActions = actions.filter( 24971 (action) => !action.isEligible || action.isEligible(item) 24972 ); 24973 const _primaryActions = _eligibleActions.filter( 24974 (action) => action.isPrimary 24975 ); 24976 return { 24977 primaryAction: _primaryActions[0], 24978 eligibleActions: _eligibleActions 24979 }; 24980 }, [actions, item]); 24981 const hasOnlyOnePrimaryAction = primaryAction && actions.length === 1; 24982 const renderedMediaField = showMedia && mediaField?.render ? /* @__PURE__ */ (0, import_jsx_runtime130.jsx)("div", { className: "dataviews-view-list__media-wrapper", children: /* @__PURE__ */ (0, import_jsx_runtime130.jsx)( 24983 mediaField.render, 24984 { 24985 item, 24986 field: mediaField, 24987 config: { sizes: "52px" } 24988 } 24989 ) }) : null; 24990 const renderedTitleField = showTitle && titleField?.render ? /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(titleField.render, { item, field: titleField }) : null; 24991 const renderDescription = showDescription && descriptionField?.render; 24992 const hasOnlyMediaAndTitle = !!renderedMediaField && !renderDescription && !otherFields.length; 24993 const usedActions = eligibleActions?.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime130.jsxs)( 24994 Stack, 24995 { 24996 direction: "row", 24997 gap: "md", 24998 className: "dataviews-view-list__item-actions", 24999 children: [ 25000 primaryAction && /* @__PURE__ */ (0, import_jsx_runtime130.jsx)( 25001 PrimaryActionGridCell, 25002 { 25003 idPrefix, 25004 primaryAction, 25005 item 25006 } 25007 ), 25008 !hasOnlyOnePrimaryAction && /* @__PURE__ */ (0, import_jsx_runtime130.jsxs)("div", { role: "gridcell", children: [ 25009 /* @__PURE__ */ (0, import_jsx_runtime130.jsxs)(Menu3, { placement: "bottom-end", children: [ 25010 /* @__PURE__ */ (0, import_jsx_runtime130.jsx)( 25011 Menu3.TriggerButton, 25012 { 25013 render: /* @__PURE__ */ (0, import_jsx_runtime130.jsx)( 25014 import_components11.Composite.Item, 25015 { 25016 id: generateDropdownTriggerCompositeId( 25017 idPrefix 25018 ), 25019 render: /* @__PURE__ */ (0, import_jsx_runtime130.jsx)( 25020 import_components11.Button, 25021 { 25022 size: "small", 25023 icon: more_vertical_default, 25024 label: (0, import_i18n20.__)("Actions"), 25025 accessibleWhenDisabled: true, 25026 disabled: !actions.length, 25027 onKeyDown: onDropdownTriggerKeyDown 25028 } 25029 ) 25030 } 25031 ) 25032 } 25033 ), 25034 /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(Menu3.Popover, { children: /* @__PURE__ */ (0, import_jsx_runtime130.jsx)( 25035 ActionsMenuGroup, 25036 { 25037 actions: eligibleActions, 25038 item, 25039 registry, 25040 setActiveModalAction 25041 } 25042 ) }) 25043 ] }), 25044 !!activeModalAction && /* @__PURE__ */ (0, import_jsx_runtime130.jsx)( 25045 ActionModal, 25046 { 25047 action: activeModalAction, 25048 items: [item], 25049 closeModal: () => setActiveModalAction(null) 25050 } 25051 ) 25052 ] }) 25053 ] 25054 } 25055 ); 25056 return /* @__PURE__ */ (0, import_jsx_runtime130.jsx)( 25057 import_components11.Composite.Row, 25058 { 25059 ref: itemRef, 25060 render: ( 25061 /* aria-posinset breaks Composite.Row if passed to it directly. */ 25062 /* @__PURE__ */ (0, import_jsx_runtime130.jsx)( 25063 "div", 25064 { 25065 "aria-posinset": posinset, 25066 "aria-setsize": infiniteScrollEnabled ? paginationInfo.totalItems : void 0 25067 } 25068 ) 25069 ), 25070 role: infiniteScrollEnabled ? "article" : "row", 25071 className: clsx_default({ 25072 "is-selected": isSelected2, 25073 "is-hovered": isHovered 25074 }), 25075 onMouseEnter: handleHover, 25076 onMouseLeave: handleHover, 25077 children: /* @__PURE__ */ (0, import_jsx_runtime130.jsxs)( 25078 Stack, 25079 { 25080 direction: "row", 25081 className: "dataviews-view-list__item-wrapper", 25082 children: [ 25083 /* @__PURE__ */ (0, import_jsx_runtime130.jsx)("div", { role: "gridcell", children: /* @__PURE__ */ (0, import_jsx_runtime130.jsx)( 25084 import_components11.Composite.Item, 25085 { 25086 id: generateItemWrapperCompositeId(idPrefix), 25087 "aria-pressed": isSelected2, 25088 "aria-labelledby": labelId, 25089 "aria-describedby": descriptionId, 25090 className: "dataviews-view-list__item", 25091 onClick: () => onSelect(item) 25092 } 25093 ) }), 25094 /* @__PURE__ */ (0, import_jsx_runtime130.jsxs)( 25095 Stack, 25096 { 25097 direction: "row", 25098 gap: "md", 25099 justify: "start", 25100 align: hasOnlyMediaAndTitle ? "center" : "flex-start", 25101 style: { flex: 1, minWidth: 0 }, 25102 children: [ 25103 renderedMediaField, 25104 /* @__PURE__ */ (0, import_jsx_runtime130.jsxs)( 25105 Stack, 25106 { 25107 direction: "column", 25108 gap: "xs", 25109 className: "dataviews-view-list__field-wrapper", 25110 children: [ 25111 /* @__PURE__ */ (0, import_jsx_runtime130.jsxs)(Stack, { direction: "row", align: "center", children: [ 25112 /* @__PURE__ */ (0, import_jsx_runtime130.jsx)( 25113 "div", 25114 { 25115 className: "dataviews-title-field dataviews-view-list__title-field", 25116 id: labelId, 25117 children: renderedTitleField 25118 } 25119 ), 25120 usedActions 25121 ] }), 25122 renderDescription && /* @__PURE__ */ (0, import_jsx_runtime130.jsx)("div", { className: "dataviews-view-list__field", children: /* @__PURE__ */ (0, import_jsx_runtime130.jsx)( 25123 descriptionField.render, 25124 { 25125 item, 25126 field: descriptionField 25127 } 25128 ) }), 25129 /* @__PURE__ */ (0, import_jsx_runtime130.jsx)( 25130 "div", 25131 { 25132 className: "dataviews-view-list__fields", 25133 id: descriptionId, 25134 children: otherFields.map((field) => /* @__PURE__ */ (0, import_jsx_runtime130.jsxs)( 25135 "div", 25136 { 25137 className: "dataviews-view-list__field", 25138 children: [ 25139 /* @__PURE__ */ (0, import_jsx_runtime130.jsx)( 25140 VisuallyHidden, 25141 { 25142 className: "dataviews-view-list__field-label", 25143 render: /* @__PURE__ */ (0, import_jsx_runtime130.jsx)("span", {}), 25144 children: field.label 25145 } 25146 ), 25147 /* @__PURE__ */ (0, import_jsx_runtime130.jsx)("span", { className: "dataviews-view-list__field-value", children: /* @__PURE__ */ (0, import_jsx_runtime130.jsx)( 25148 field.render, 25149 { 25150 item, 25151 field 25152 } 25153 ) }) 25154 ] 25155 }, 25156 field.id 25157 )) 25158 } 25159 ) 25160 ] 25161 } 25162 ) 25163 ] 25164 } 25165 ) 25166 ] 25167 } 25168 ) 25169 } 25170 ); 25171 } 25172 function isDefined2(item) { 25173 return !!item; 25174 } 25175 function ViewList(props) { 25176 const { 25177 actions, 25178 data, 25179 fields: fields3, 25180 getItemId: getItemId2, 25181 isLoading, 25182 onChangeSelection, 25183 selection, 25184 view, 25185 className, 25186 empty 25187 } = props; 25188 const baseId = (0, import_compose11.useInstanceId)(ViewList, "view-list"); 25189 const isDelayedLoading = useDelayedLoading(!!isLoading); 25190 const selectedItem = data?.findLast( 25191 (item) => selection.includes(getItemId2(item)) 25192 ); 25193 const titleField = fields3.find((field) => field.id === view.titleField); 25194 const mediaField = fields3.find((field) => field.id === view.mediaField); 25195 const descriptionField = fields3.find( 25196 (field) => field.id === view.descriptionField 25197 ); 25198 const otherFields = (view?.fields ?? []).map((fieldId) => fields3.find((f2) => fieldId === f2.id)).filter(isDefined2); 25199 const onSelect = (item) => onChangeSelection([getItemId2(item)]); 25200 const generateCompositeItemIdPrefix = (0, import_element102.useCallback)( 25201 (item) => `$baseId}-$getItemId2(item)}`, 25202 [baseId, getItemId2] 25203 ); 25204 const isActiveCompositeItem = (0, import_element102.useCallback)( 25205 (item, idToCheck) => { 25206 return idToCheck.startsWith( 25207 generateCompositeItemIdPrefix(item) 25208 ); 25209 }, 25210 [generateCompositeItemIdPrefix] 25211 ); 25212 const [activeCompositeId, setActiveCompositeId] = (0, import_element102.useState)(void 0); 25213 const compositeRef = (0, import_element102.useRef)(null); 25214 (0, import_element102.useEffect)(() => { 25215 if (selectedItem) { 25216 setActiveCompositeId( 25217 generateItemWrapperCompositeId( 25218 generateCompositeItemIdPrefix(selectedItem) 25219 ) 25220 ); 25221 } 25222 }, [selectedItem, generateCompositeItemIdPrefix]); 25223 const activeItemIndex = data.findIndex( 25224 (item) => isActiveCompositeItem(item, activeCompositeId ?? "") 25225 ); 25226 const previousActiveItemIndex = (0, import_compose11.usePrevious)(activeItemIndex); 25227 const isActiveIdInList = activeItemIndex !== -1; 25228 const selectCompositeItem = (0, import_element102.useCallback)( 25229 (targetIndex, generateCompositeId) => { 25230 const clampedIndex = Math.min( 25231 data.length - 1, 25232 Math.max(0, targetIndex) 25233 ); 25234 if (!data[clampedIndex]) { 25235 return; 25236 } 25237 const itemIdPrefix = generateCompositeItemIdPrefix( 25238 data[clampedIndex] 25239 ); 25240 const targetCompositeItemId = generateCompositeId(itemIdPrefix); 25241 setActiveCompositeId(targetCompositeItemId); 25242 if (compositeRef.current?.contains( 25243 compositeRef.current.ownerDocument.activeElement 25244 )) { 25245 document.getElementById(targetCompositeItemId)?.focus(); 25246 } 25247 }, 25248 [data, generateCompositeItemIdPrefix] 25249 ); 25250 (0, import_element102.useEffect)(() => { 25251 const wasActiveIdInList = previousActiveItemIndex !== void 0 && previousActiveItemIndex !== -1; 25252 if (!isActiveIdInList && wasActiveIdInList) { 25253 selectCompositeItem( 25254 previousActiveItemIndex, 25255 generateItemWrapperCompositeId 25256 ); 25257 } 25258 }, [isActiveIdInList, selectCompositeItem, previousActiveItemIndex]); 25259 const onDropdownTriggerKeyDown = (0, import_element102.useCallback)( 25260 (event) => { 25261 if (event.key === "ArrowDown") { 25262 event.preventDefault(); 25263 selectCompositeItem( 25264 activeItemIndex + 1, 25265 generateDropdownTriggerCompositeId 25266 ); 25267 } 25268 if (event.key === "ArrowUp") { 25269 event.preventDefault(); 25270 selectCompositeItem( 25271 activeItemIndex - 1, 25272 generateDropdownTriggerCompositeId 25273 ); 25274 } 25275 }, 25276 [selectCompositeItem, activeItemIndex] 25277 ); 25278 const hasData = !!data?.length; 25279 const groupField = view.groupBy?.field ? fields3.find((field) => field.id === view.groupBy?.field) : null; 25280 const dataByGroup = hasData && groupField ? getDataByGroup(data, groupField) : null; 25281 const isInfiniteScroll = view.infiniteScrollEnabled && !dataByGroup; 25282 if (!hasData) { 25283 return /* @__PURE__ */ (0, import_jsx_runtime130.jsx)( 25284 "div", 25285 { 25286 className: clsx_default("dataviews-no-results", { 25287 "is-refreshing": isDelayedLoading 25288 }), 25289 children: empty 25290 } 25291 ); 25292 } 25293 if (hasData && groupField && dataByGroup) { 25294 return /* @__PURE__ */ (0, import_jsx_runtime130.jsx)( 25295 import_components11.Composite, 25296 { 25297 ref: compositeRef, 25298 id: `$baseId}`, 25299 render: /* @__PURE__ */ (0, import_jsx_runtime130.jsx)("div", {}), 25300 className: "dataviews-view-list__group", 25301 role: "grid", 25302 activeId: activeCompositeId, 25303 setActiveId: setActiveCompositeId, 25304 children: /* @__PURE__ */ (0, import_jsx_runtime130.jsx)( 25305 Stack, 25306 { 25307 direction: "column", 25308 gap: "lg", 25309 className: clsx_default("dataviews-view-list", className), 25310 children: Array.from(dataByGroup.entries()).map( 25311 ([groupName, groupItems]) => /* @__PURE__ */ (0, import_jsx_runtime130.jsxs)( 25312 Stack, 25313 { 25314 direction: "column", 25315 gap: "sm", 25316 children: [ 25317 /* @__PURE__ */ (0, import_jsx_runtime130.jsx)("h3", { className: "dataviews-view-list__group-header", children: view.groupBy?.showLabel === false ? groupName : (0, import_i18n20.sprintf)( 25318 // translators: 1: The label of the field e.g. "Date". 2: The value of the field, e.g.: "May 2022". 25319 (0, import_i18n20.__)("%1$s: %2$s"), 25320 groupField.label, 25321 groupName 25322 ) }), 25323 groupItems.map((item) => { 25324 const id = generateCompositeItemIdPrefix(item); 25325 return /* @__PURE__ */ (0, import_jsx_runtime130.jsx)( 25326 ListItem, 25327 { 25328 view, 25329 idPrefix: id, 25330 actions, 25331 item, 25332 isSelected: item === selectedItem, 25333 onSelect, 25334 mediaField, 25335 titleField, 25336 descriptionField, 25337 otherFields, 25338 onDropdownTriggerKeyDown 25339 }, 25340 id 25341 ); 25342 }) 25343 ] 25344 }, 25345 groupName 25346 ) 25347 ) 25348 } 25349 ) 25350 } 25351 ); 25352 } 25353 return /* @__PURE__ */ (0, import_jsx_runtime130.jsxs)(import_jsx_runtime130.Fragment, { children: [ 25354 /* @__PURE__ */ (0, import_jsx_runtime130.jsx)( 25355 import_components11.Composite, 25356 { 25357 ref: compositeRef, 25358 id: baseId, 25359 render: /* @__PURE__ */ (0, import_jsx_runtime130.jsx)("div", {}), 25360 className: clsx_default("dataviews-view-list", className, { 25361 [`has-$view.layout?.density}-density`]: view.layout?.density && ["compact", "comfortable"].includes( 25362 view.layout.density 25363 ), 25364 "is-refreshing": !isInfiniteScroll && isDelayedLoading 25365 }), 25366 role: view.infiniteScrollEnabled ? "feed" : "grid", 25367 activeId: activeCompositeId, 25368 setActiveId: setActiveCompositeId, 25369 inert: !isInfiniteScroll && !!isLoading ? "true" : void 0, 25370 children: data.map((item, index2) => { 25371 const id = generateCompositeItemIdPrefix(item); 25372 return /* @__PURE__ */ (0, import_jsx_runtime130.jsx)( 25373 ListItem, 25374 { 25375 view, 25376 idPrefix: id, 25377 actions, 25378 item, 25379 isSelected: item === selectedItem, 25380 onSelect, 25381 mediaField, 25382 titleField, 25383 descriptionField, 25384 otherFields, 25385 onDropdownTriggerKeyDown, 25386 posinset: view.infiniteScrollEnabled ? index2 + 1 : void 0 25387 }, 25388 id 25389 ); 25390 }) 25391 } 25392 ), 25393 isInfiniteScroll && isLoading && /* @__PURE__ */ (0, import_jsx_runtime130.jsx)("p", { className: "dataviews-loading-more", children: /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(import_components11.Spinner, {}) }) 25394 ] }); 25395 } 25396 25397 // packages/dataviews/build-module/components/dataviews-layouts/activity/index.mjs 25398 var import_components12 = __toESM(require_components(), 1); 25399 25400 // packages/dataviews/build-module/components/dataviews-layouts/activity/activity-group.mjs 25401 var import_i18n21 = __toESM(require_i18n(), 1); 25402 var import_element103 = __toESM(require_element(), 1); 25403 var import_jsx_runtime131 = __toESM(require_jsx_runtime(), 1); 25404 function ActivityGroup({ 25405 groupName, 25406 groupData, 25407 groupField, 25408 showLabel = true, 25409 children 25410 }) { 25411 const groupHeader = showLabel ? (0, import_element103.createInterpolateElement)( 25412 // translators: %s: The label of the field e.g. "Status". 25413 (0, import_i18n21.sprintf)((0, import_i18n21.__)("%s: <groupName />"), groupField.label).trim(), 25414 { 25415 groupName: /* @__PURE__ */ (0, import_jsx_runtime131.jsx)( 25416 groupField.render, 25417 { 25418 item: groupData[0], 25419 field: groupField 25420 } 25421 ) 25422 } 25423 ) : /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(groupField.render, { item: groupData[0], field: groupField }); 25424 return /* @__PURE__ */ (0, import_jsx_runtime131.jsxs)( 25425 Stack, 25426 { 25427 direction: "column", 25428 className: "dataviews-view-activity__group", 25429 children: [ 25430 /* @__PURE__ */ (0, import_jsx_runtime131.jsx)("h3", { className: "dataviews-view-activity__group-header", children: groupHeader }), 25431 children 25432 ] 25433 }, 25434 groupName 25435 ); 25436 } 25437 25438 // packages/dataviews/build-module/components/dataviews-layouts/activity/activity-item.mjs 25439 var import_element104 = __toESM(require_element(), 1); 25440 var import_data6 = __toESM(require_data(), 1); 25441 var import_compose12 = __toESM(require_compose(), 1); 25442 var import_jsx_runtime132 = __toESM(require_jsx_runtime(), 1); 25443 function ActivityItem(props) { 25444 const { 25445 view, 25446 actions, 25447 item, 25448 titleField, 25449 mediaField, 25450 descriptionField, 25451 otherFields, 25452 posinset, 25453 onClickItem, 25454 renderItemLink, 25455 isItemClickable: isItemClickable2 25456 } = props; 25457 const { 25458 showTitle = true, 25459 showMedia = true, 25460 showDescription = true, 25461 infiniteScrollEnabled 25462 } = view; 25463 const itemRef = (0, import_element104.useRef)(null); 25464 const registry = (0, import_data6.useRegistry)(); 25465 const { paginationInfo } = (0, import_element104.useContext)(dataviews_context_default); 25466 const { primaryActions, eligibleActions } = (0, import_element104.useMemo)(() => { 25467 const _eligibleActions = actions.filter( 25468 (action) => !action.isEligible || action.isEligible(item) 25469 ); 25470 const _primaryActions = _eligibleActions.filter( 25471 (action) => action.isPrimary 25472 ); 25473 return { 25474 primaryActions: _primaryActions, 25475 eligibleActions: _eligibleActions 25476 }; 25477 }, [actions, item]); 25478 const isMobileViewport = (0, import_compose12.useViewportMatch)("medium", "<"); 25479 const density = view.layout?.density ?? "balanced"; 25480 const mediaContent = showMedia && density !== "compact" && mediaField?.render ? /* @__PURE__ */ (0, import_jsx_runtime132.jsx)( 25481 mediaField.render, 25482 { 25483 item, 25484 field: mediaField, 25485 config: { 25486 sizes: density === "comfortable" ? "32px" : "24px" 25487 } 25488 } 25489 ) : null; 25490 const renderedMediaField = /* @__PURE__ */ (0, import_jsx_runtime132.jsx)("div", { className: "dataviews-view-activity__item-type-icon", children: mediaContent || /* @__PURE__ */ (0, import_jsx_runtime132.jsx)( 25491 "span", 25492 { 25493 className: "dataviews-view-activity__item-bullet", 25494 "aria-hidden": "true" 25495 } 25496 ) }); 25497 const renderedTitleField = showTitle && titleField?.render ? /* @__PURE__ */ (0, import_jsx_runtime132.jsx)(titleField.render, { item, field: titleField }) : null; 25498 const verticalGap = (0, import_element104.useMemo)(() => { 25499 switch (density) { 25500 case "comfortable": 25501 return "md"; 25502 default: 25503 return "sm"; 25504 } 25505 }, [density]); 25506 return /* @__PURE__ */ (0, import_jsx_runtime132.jsx)( 25507 "div", 25508 { 25509 ref: itemRef, 25510 role: infiniteScrollEnabled ? "article" : void 0, 25511 "aria-posinset": posinset, 25512 "aria-setsize": infiniteScrollEnabled ? paginationInfo.totalItems : void 0, 25513 className: clsx_default( 25514 "dataviews-view-activity__item", 25515 density === "compact" && "is-compact", 25516 density === "balanced" && "is-balanced", 25517 density === "comfortable" && "is-comfortable" 25518 ), 25519 children: /* @__PURE__ */ (0, import_jsx_runtime132.jsxs)(Stack, { direction: "row", gap: "lg", justify: "start", align: "flex-start", children: [ 25520 /* @__PURE__ */ (0, import_jsx_runtime132.jsx)( 25521 Stack, 25522 { 25523 direction: "column", 25524 gap: "xs", 25525 align: "center", 25526 className: "dataviews-view-activity__item-type", 25527 children: renderedMediaField 25528 } 25529 ), 25530 /* @__PURE__ */ (0, import_jsx_runtime132.jsxs)( 25531 Stack, 25532 { 25533 direction: "column", 25534 gap: verticalGap, 25535 align: "flex-start", 25536 className: "dataviews-view-activity__item-content", 25537 children: [ 25538 renderedTitleField && /* @__PURE__ */ (0, import_jsx_runtime132.jsx)( 25539 ItemClickWrapper, 25540 { 25541 item, 25542 isItemClickable: isItemClickable2, 25543 onClickItem, 25544 renderItemLink, 25545 className: "dataviews-view-activity__item-title", 25546 children: renderedTitleField 25547 } 25548 ), 25549 showDescription && descriptionField && /* @__PURE__ */ (0, import_jsx_runtime132.jsx)("div", { className: "dataviews-view-activity__item-description", children: /* @__PURE__ */ (0, import_jsx_runtime132.jsx)( 25550 descriptionField.render, 25551 { 25552 item, 25553 field: descriptionField 25554 } 25555 ) }), 25556 /* @__PURE__ */ (0, import_jsx_runtime132.jsx)("div", { className: "dataviews-view-activity__item-fields", children: otherFields.map((field) => /* @__PURE__ */ (0, import_jsx_runtime132.jsxs)( 25557 "div", 25558 { 25559 className: "dataviews-view-activity__item-field", 25560 children: [ 25561 /* @__PURE__ */ (0, import_jsx_runtime132.jsx)( 25562 VisuallyHidden, 25563 { 25564 className: "dataviews-view-activity__item-field-label", 25565 render: /* @__PURE__ */ (0, import_jsx_runtime132.jsx)("span", {}), 25566 children: field.label 25567 } 25568 ), 25569 /* @__PURE__ */ (0, import_jsx_runtime132.jsx)("span", { className: "dataviews-view-activity__item-field-value", children: /* @__PURE__ */ (0, import_jsx_runtime132.jsx)( 25570 field.render, 25571 { 25572 item, 25573 field 25574 } 25575 ) }) 25576 ] 25577 }, 25578 field.id 25579 )) }), 25580 !!primaryActions?.length && /* @__PURE__ */ (0, import_jsx_runtime132.jsx)( 25581 PrimaryActions, 25582 { 25583 item, 25584 actions: primaryActions, 25585 registry, 25586 buttonVariant: "secondary" 25587 } 25588 ) 25589 ] 25590 } 25591 ), 25592 (primaryActions.length < eligibleActions.length || // Since we hide primary actions on mobile, we need to show the menu 25593 // there if there are any actions at all. 25594 isMobileViewport && // At the same time, only show the menu if there are actions to show. 25595 eligibleActions.length > 0) && /* @__PURE__ */ (0, import_jsx_runtime132.jsx)("div", { className: "dataviews-view-activity__item-actions", children: /* @__PURE__ */ (0, import_jsx_runtime132.jsx)( 25596 ItemActions, 25597 { 25598 item, 25599 actions: eligibleActions, 25600 isCompact: true 25601 } 25602 ) }) 25603 ] }) 25604 } 25605 ); 25606 } 25607 var activity_item_default = ActivityItem; 25608 25609 // packages/dataviews/build-module/components/dataviews-layouts/activity/activity-items.mjs 25610 var import_react24 = __toESM(require_react(), 1); 25611 function isDefined3(item) { 25612 return !!item; 25613 } 25614 function ActivityItems(props) { 25615 const { data, fields: fields3, getItemId: getItemId2, view } = props; 25616 const titleField = fields3.find((field) => field.id === view.titleField); 25617 const mediaField = fields3.find((field) => field.id === view.mediaField); 25618 const descriptionField = fields3.find( 25619 (field) => field.id === view.descriptionField 25620 ); 25621 const otherFields = (view?.fields ?? []).map((fieldId) => fields3.find((f2) => fieldId === f2.id)).filter(isDefined3); 25622 return data.map((item, index2) => { 25623 return /* @__PURE__ */ (0, import_react24.createElement)( 25624 activity_item_default, 25625 { 25626 ...props, 25627 key: getItemId2(item), 25628 item, 25629 mediaField, 25630 titleField, 25631 descriptionField, 25632 otherFields, 25633 posinset: view.infiniteScrollEnabled ? index2 + 1 : void 0 25634 } 25635 ); 25636 }); 25637 } 25638 25639 // packages/dataviews/build-module/components/dataviews-layouts/activity/index.mjs 25640 var import_jsx_runtime133 = __toESM(require_jsx_runtime(), 1); 25641 function ViewActivity(props) { 25642 const { empty, data, fields: fields3, isLoading, view, className } = props; 25643 const isDelayedLoading = useDelayedLoading(!!isLoading); 25644 const hasData = !!data?.length; 25645 const groupField = view.groupBy?.field ? fields3.find((field) => field.id === view.groupBy?.field) : null; 25646 const dataByGroup = hasData && groupField ? getDataByGroup(data, groupField) : null; 25647 const isInfiniteScroll = view.infiniteScrollEnabled && !dataByGroup; 25648 if (!hasData) { 25649 return /* @__PURE__ */ (0, import_jsx_runtime133.jsx)( 25650 "div", 25651 { 25652 className: clsx_default("dataviews-no-results", { 25653 "is-refreshing": isDelayedLoading 25654 }), 25655 children: empty 25656 } 25657 ); 25658 } 25659 const isInert2 = !isInfiniteScroll && !!isLoading; 25660 const wrapperClassName = clsx_default("dataviews-view-activity", className, { 25661 "is-refreshing": !isInfiniteScroll && isDelayedLoading 25662 }); 25663 const groupedEntries = dataByGroup ? Array.from(dataByGroup.entries()) : []; 25664 if (hasData && groupField && dataByGroup) { 25665 return /* @__PURE__ */ (0, import_jsx_runtime133.jsx)( 25666 Stack, 25667 { 25668 direction: "column", 25669 gap: "sm", 25670 className: wrapperClassName, 25671 inert: isInert2 ? "true" : void 0, 25672 children: groupedEntries.map( 25673 ([groupName, groupData]) => /* @__PURE__ */ (0, import_jsx_runtime133.jsx)( 25674 ActivityGroup, 25675 { 25676 groupName, 25677 groupData, 25678 groupField, 25679 showLabel: view.groupBy?.showLabel !== false, 25680 children: /* @__PURE__ */ (0, import_jsx_runtime133.jsx)( 25681 ActivityItems, 25682 { 25683 ...props, 25684 data: groupData 25685 } 25686 ) 25687 }, 25688 groupName 25689 ) 25690 ) 25691 } 25692 ); 25693 } 25694 return /* @__PURE__ */ (0, import_jsx_runtime133.jsxs)(import_jsx_runtime133.Fragment, { children: [ 25695 /* @__PURE__ */ (0, import_jsx_runtime133.jsx)( 25696 "div", 25697 { 25698 className: wrapperClassName, 25699 role: view.infiniteScrollEnabled ? "feed" : void 0, 25700 inert: isInert2 ? "true" : void 0, 25701 children: /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(ActivityItems, { ...props }) 25702 } 25703 ), 25704 isInfiniteScroll && isLoading && /* @__PURE__ */ (0, import_jsx_runtime133.jsx)("p", { className: "dataviews-loading-more", children: /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(import_components12.Spinner, {}) }) 25705 ] }); 25706 } 25707 25708 // packages/dataviews/build-module/components/dataviews-layouts/picker-grid/index.mjs 25709 var import_components15 = __toESM(require_components(), 1); 25710 var import_i18n24 = __toESM(require_i18n(), 1); 25711 var import_compose13 = __toESM(require_compose(), 1); 25712 var import_element107 = __toESM(require_element(), 1); 25713 25714 // packages/dataviews/build-module/components/dataviews-picker-footer/index.mjs 25715 var import_components14 = __toESM(require_components(), 1); 25716 var import_data7 = __toESM(require_data(), 1); 25717 var import_element106 = __toESM(require_element(), 1); 25718 var import_i18n23 = __toESM(require_i18n(), 1); 25719 25720 // packages/dataviews/build-module/components/dataviews-pagination/index.mjs 25721 var import_components13 = __toESM(require_components(), 1); 25722 var import_element105 = __toESM(require_element(), 1); 25723 var import_i18n22 = __toESM(require_i18n(), 1); 25724 var import_jsx_runtime134 = __toESM(require_jsx_runtime(), 1); 25725 function DataViewsPagination() { 25726 const { 25727 view, 25728 onChangeView, 25729 paginationInfo: { totalItems = 0, totalPages } 25730 } = (0, import_element105.useContext)(dataviews_context_default); 25731 if (!totalItems || !totalPages || view.infiniteScrollEnabled) { 25732 return null; 25733 } 25734 const currentPage = view.page ?? 1; 25735 const pageSelectOptions = Array.from(Array(totalPages)).map( 25736 (_, i2) => { 25737 const page = i2 + 1; 25738 return { 25739 value: page.toString(), 25740 label: page.toString(), 25741 "aria-label": currentPage === page ? (0, import_i18n22.sprintf)( 25742 // translators: 1: current page number. 2: total number of pages. 25743 (0, import_i18n22.__)("Page %1$d of %2$d"), 25744 currentPage, 25745 totalPages 25746 ) : page.toString() 25747 }; 25748 } 25749 ); 25750 return !!totalItems && totalPages !== 1 && /* @__PURE__ */ (0, import_jsx_runtime134.jsxs)( 25751 Stack, 25752 { 25753 direction: "row", 25754 className: "dataviews-pagination", 25755 justify: "end", 25756 align: "center", 25757 gap: "xl", 25758 children: [ 25759 /* @__PURE__ */ (0, import_jsx_runtime134.jsx)( 25760 Stack, 25761 { 25762 direction: "row", 25763 justify: "flex-start", 25764 align: "center", 25765 gap: "xs", 25766 className: "dataviews-pagination__page-select", 25767 children: (0, import_element105.createInterpolateElement)( 25768 (0, import_i18n22.sprintf)( 25769 // translators: 1: Current page number, 2: Total number of pages. 25770 (0, import_i18n22._x)( 25771 "<div>Page</div>%1$s<div>of %2$d</div>", 25772 "paging" 25773 ), 25774 "<CurrentPage />", 25775 totalPages 25776 ), 25777 { 25778 div: /* @__PURE__ */ (0, import_jsx_runtime134.jsx)("div", { "aria-hidden": true }), 25779 // @ts-expect-error — Tag injected via sprintf argument, not visible in format string. 25780 CurrentPage: /* @__PURE__ */ (0, import_jsx_runtime134.jsx)( 25781 import_components13.SelectControl, 25782 { 25783 "aria-label": (0, import_i18n22.__)("Current page"), 25784 value: currentPage.toString(), 25785 options: pageSelectOptions, 25786 onChange: (newValue) => { 25787 onChangeView({ 25788 ...view, 25789 page: +newValue 25790 }); 25791 }, 25792 size: "small", 25793 variant: "minimal" 25794 } 25795 ) 25796 } 25797 ) 25798 } 25799 ), 25800 /* @__PURE__ */ (0, import_jsx_runtime134.jsxs)(Stack, { direction: "row", gap: "xs", align: "center", children: [ 25801 /* @__PURE__ */ (0, import_jsx_runtime134.jsx)( 25802 import_components13.Button, 25803 { 25804 onClick: () => onChangeView({ 25805 ...view, 25806 page: currentPage - 1 25807 }), 25808 disabled: currentPage === 1, 25809 accessibleWhenDisabled: true, 25810 label: (0, import_i18n22.__)("Previous page"), 25811 icon: (0, import_i18n22.isRTL)() ? next_default : previous_default, 25812 showTooltip: true, 25813 size: "compact", 25814 tooltipPosition: "top" 25815 } 25816 ), 25817 /* @__PURE__ */ (0, import_jsx_runtime134.jsx)( 25818 import_components13.Button, 25819 { 25820 onClick: () => onChangeView({ ...view, page: currentPage + 1 }), 25821 disabled: currentPage >= totalPages, 25822 accessibleWhenDisabled: true, 25823 label: (0, import_i18n22.__)("Next page"), 25824 icon: (0, import_i18n22.isRTL)() ? previous_default : next_default, 25825 showTooltip: true, 25826 size: "compact", 25827 tooltipPosition: "top" 25828 } 25829 ) 25830 ] }) 25831 ] 25832 } 25833 ); 25834 } 25835 var dataviews_pagination_default = (0, import_element105.memo)(DataViewsPagination); 25836 25837 // packages/dataviews/build-module/components/dataviews-picker-footer/index.mjs 25838 var import_jsx_runtime135 = __toESM(require_jsx_runtime(), 1); 25839 var EMPTY_ARRAY2 = []; 25840 function useIsMultiselectPicker(actions) { 25841 return (0, import_element106.useMemo)(() => { 25842 return actions?.every((action) => action.supportsBulk); 25843 }, [actions]); 25844 } 25845 function BulkSelectionCheckbox2({ 25846 selection, 25847 selectedItems, 25848 onChangeSelection, 25849 data, 25850 getItemId: getItemId2, 25851 disableSelectAll = false 25852 }) { 25853 const hasSelection = selection.length > 0; 25854 const areAllSelected = selectedItems.length === data.length; 25855 if (disableSelectAll) { 25856 return /* @__PURE__ */ (0, import_jsx_runtime135.jsx)( 25857 import_components14.CheckboxControl, 25858 { 25859 className: "dataviews-view-table-selection-checkbox", 25860 checked: hasSelection, 25861 disabled: !hasSelection, 25862 onChange: () => { 25863 onChangeSelection([]); 25864 }, 25865 "aria-label": (0, import_i18n23.__)("Deselect all") 25866 } 25867 ); 25868 } 25869 return /* @__PURE__ */ (0, import_jsx_runtime135.jsx)( 25870 import_components14.CheckboxControl, 25871 { 25872 className: "dataviews-view-table-selection-checkbox", 25873 checked: areAllSelected, 25874 indeterminate: !areAllSelected && !!selectedItems.length, 25875 onChange: () => { 25876 if (areAllSelected) { 25877 onChangeSelection( 25878 selection.filter( 25879 (id) => !data.some( 25880 (item) => id === getItemId2(item) 25881 ) 25882 ) 25883 ); 25884 } else { 25885 const selectionSet = /* @__PURE__ */ new Set([ 25886 ...selection, 25887 ...data.map((item) => getItemId2(item)) 25888 ]); 25889 onChangeSelection(Array.from(selectionSet)); 25890 } 25891 }, 25892 "aria-label": areAllSelected ? (0, import_i18n23.__)("Deselect all") : (0, import_i18n23.__)("Select all") 25893 } 25894 ); 25895 } 25896 function ActionButtons({ 25897 actions, 25898 items, 25899 selection 25900 }) { 25901 const registry = (0, import_data7.useRegistry)(); 25902 const [actionInProgress, setActionInProgress] = (0, import_element106.useState)( 25903 null 25904 ); 25905 return /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(Stack, { direction: "row", gap: "xs", children: actions.map((action) => { 25906 if (!("callback" in action)) { 25907 return null; 25908 } 25909 const { id, label, icon, isPrimary, callback } = action; 25910 const _label = typeof label === "string" ? label : label(items); 25911 const variant = isPrimary ? "primary" : "tertiary"; 25912 const isInProgress = id === actionInProgress; 25913 return /* @__PURE__ */ (0, import_jsx_runtime135.jsx)( 25914 import_components14.Button, 25915 { 25916 accessibleWhenDisabled: true, 25917 icon, 25918 disabled: isInProgress || !selection?.length, 25919 isBusy: isInProgress, 25920 onClick: async () => { 25921 setActionInProgress(id); 25922 await callback(items, { 25923 registry 25924 }); 25925 setActionInProgress(null); 25926 }, 25927 size: "compact", 25928 variant, 25929 children: _label 25930 }, 25931 id 25932 ); 25933 }) }); 25934 } 25935 function DataViewsPickerFooter() { 25936 const { 25937 data, 25938 selection, 25939 onChangeSelection, 25940 getItemId: getItemId2, 25941 actions = EMPTY_ARRAY2, 25942 paginationInfo, 25943 view 25944 } = (0, import_element106.useContext)(dataviews_context_default); 25945 const isMultiselect = useIsMultiselectPicker(actions); 25946 const message2 = getFooterMessage( 25947 selection.length, 25948 data.length, 25949 paginationInfo.totalItems, 25950 !!view.infiniteScrollEnabled 25951 ); 25952 const selectedItems = (0, import_element106.useMemo)( 25953 () => data.filter((item) => selection.includes(getItemId2(item))), 25954 [selection, getItemId2, data] 25955 ); 25956 return /* @__PURE__ */ (0, import_jsx_runtime135.jsxs)( 25957 Stack, 25958 { 25959 direction: "row", 25960 justify: "space-between", 25961 align: "center", 25962 className: "dataviews-footer", 25963 gap: "sm", 25964 children: [ 25965 /* @__PURE__ */ (0, import_jsx_runtime135.jsxs)( 25966 Stack, 25967 { 25968 direction: "row", 25969 className: "dataviews-picker-footer__bulk-selection", 25970 gap: "md", 25971 align: "center", 25972 children: [ 25973 isMultiselect && /* @__PURE__ */ (0, import_jsx_runtime135.jsx)( 25974 BulkSelectionCheckbox2, 25975 { 25976 selection, 25977 selectedItems, 25978 onChangeSelection, 25979 data, 25980 getItemId: getItemId2, 25981 disableSelectAll: !!view.infiniteScrollEnabled 25982 } 25983 ), 25984 /* @__PURE__ */ (0, import_jsx_runtime135.jsx)("span", { className: "dataviews-bulk-actions-footer__item-count", children: message2 }) 25985 ] 25986 } 25987 ), 25988 /* @__PURE__ */ (0, import_jsx_runtime135.jsx)(dataviews_pagination_default, {}), 25989 Boolean(actions?.length) && /* @__PURE__ */ (0, import_jsx_runtime135.jsx)("div", { className: "dataviews-picker-footer__actions", children: /* @__PURE__ */ (0, import_jsx_runtime135.jsx)( 25990 ActionButtons, 25991 { 25992 actions, 25993 items: selectedItems, 25994 selection 25995 } 25996 ) }) 25997 ] 25998 } 25999 ); 26000 } 26001 26002 // packages/dataviews/build-module/components/dataviews-layouts/picker-grid/index.mjs 26003 var import_jsx_runtime136 = __toESM(require_jsx_runtime(), 1); 26004 var { Badge: WCBadge2 } = unlock2(import_components15.privateApis); 26005 function GridItem3({ 26006 view, 26007 multiselect, 26008 selection, 26009 onChangeSelection, 26010 getItemId: getItemId2, 26011 item, 26012 mediaField, 26013 titleField, 26014 descriptionField, 26015 regularFields, 26016 badgeFields, 26017 config, 26018 posinset, 26019 setsize 26020 }) { 26021 const { showTitle = true, showMedia = true, showDescription = true } = view; 26022 const id = getItemId2(item); 26023 const elementRef = (0, import_element107.useRef)(null); 26024 const isSelected2 = selection.includes(id); 26025 useIntersectionObserver(elementRef, posinset); 26026 const renderedMediaField = mediaField?.render ? /* @__PURE__ */ (0, import_jsx_runtime136.jsx)( 26027 mediaField.render, 26028 { 26029 item, 26030 field: mediaField, 26031 config 26032 } 26033 ) : null; 26034 const renderedTitleField = showTitle && titleField?.render ? /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(titleField.render, { item, field: titleField }) : null; 26035 return /* @__PURE__ */ (0, import_jsx_runtime136.jsxs)( 26036 import_components15.Composite.Item, 26037 { 26038 ref: elementRef, 26039 "aria-label": titleField ? titleField.getValue({ item }) || (0, import_i18n24.__)("(no title)") : void 0, 26040 render: ({ children, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(Stack, { direction: "column", children, ...props }), 26041 role: "option", 26042 "aria-posinset": posinset, 26043 "aria-setsize": setsize, 26044 className: clsx_default("dataviews-view-picker-grid__card", { 26045 "is-selected": isSelected2 26046 }), 26047 "aria-selected": isSelected2, 26048 onClick: () => { 26049 if (isSelected2) { 26050 onChangeSelection( 26051 selection.filter((itemId) => id !== itemId) 26052 ); 26053 } else { 26054 const newSelection = multiselect ? [...selection, id] : [id]; 26055 onChangeSelection(newSelection); 26056 } 26057 }, 26058 children: [ 26059 showMedia && renderedMediaField && /* @__PURE__ */ (0, import_jsx_runtime136.jsx)("div", { className: "dataviews-view-picker-grid__media", children: renderedMediaField }), 26060 showMedia && renderedMediaField && /* @__PURE__ */ (0, import_jsx_runtime136.jsx)( 26061 DataViewsSelectionCheckbox, 26062 { 26063 item, 26064 selection, 26065 onChangeSelection, 26066 getItemId: getItemId2, 26067 titleField, 26068 disabled: false, 26069 "aria-hidden": true, 26070 tabIndex: -1 26071 } 26072 ), 26073 showTitle && /* @__PURE__ */ (0, import_jsx_runtime136.jsx)( 26074 Stack, 26075 { 26076 direction: "row", 26077 justify: "space-between", 26078 className: "dataviews-view-picker-grid__title-actions", 26079 children: /* @__PURE__ */ (0, import_jsx_runtime136.jsx)("div", { className: "dataviews-view-picker-grid__title-field dataviews-title-field", children: renderedTitleField }) 26080 } 26081 ), 26082 /* @__PURE__ */ (0, import_jsx_runtime136.jsxs)(Stack, { direction: "column", gap: "xs", children: [ 26083 showDescription && descriptionField?.render && /* @__PURE__ */ (0, import_jsx_runtime136.jsx)( 26084 descriptionField.render, 26085 { 26086 item, 26087 field: descriptionField 26088 } 26089 ), 26090 !!badgeFields?.length && /* @__PURE__ */ (0, import_jsx_runtime136.jsx)( 26091 Stack, 26092 { 26093 direction: "row", 26094 className: "dataviews-view-picker-grid__badge-fields", 26095 gap: "sm", 26096 wrap: "wrap", 26097 align: "top", 26098 justify: "flex-start", 26099 children: badgeFields.map((field) => { 26100 return /* @__PURE__ */ (0, import_jsx_runtime136.jsx)( 26101 WCBadge2, 26102 { 26103 className: "dataviews-view-picker-grid__field-value", 26104 children: /* @__PURE__ */ (0, import_jsx_runtime136.jsx)( 26105 field.render, 26106 { 26107 item, 26108 field 26109 } 26110 ) 26111 }, 26112 field.id 26113 ); 26114 }) 26115 } 26116 ), 26117 !!regularFields?.length && /* @__PURE__ */ (0, import_jsx_runtime136.jsx)( 26118 Stack, 26119 { 26120 direction: "column", 26121 className: "dataviews-view-picker-grid__fields", 26122 gap: "xs", 26123 children: regularFields.map((field) => { 26124 return /* @__PURE__ */ (0, import_jsx_runtime136.jsx)( 26125 import_components15.Flex, 26126 { 26127 className: "dataviews-view-picker-grid__field", 26128 gap: 1, 26129 justify: "flex-start", 26130 expanded: true, 26131 style: { height: "auto" }, 26132 direction: "row", 26133 children: /* @__PURE__ */ (0, import_jsx_runtime136.jsxs)(import_jsx_runtime136.Fragment, { children: [ 26134 /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(import_components15.FlexItem, { className: "dataviews-view-picker-grid__field-name", children: field.header }), 26135 /* @__PURE__ */ (0, import_jsx_runtime136.jsx)( 26136 import_components15.FlexItem, 26137 { 26138 className: "dataviews-view-picker-grid__field-value", 26139 style: { maxHeight: "none" }, 26140 children: /* @__PURE__ */ (0, import_jsx_runtime136.jsx)( 26141 field.render, 26142 { 26143 item, 26144 field 26145 } 26146 ) 26147 } 26148 ) 26149 ] }) 26150 }, 26151 field.id 26152 ); 26153 }) 26154 } 26155 ) 26156 ] }) 26157 ] 26158 }, 26159 id 26160 ); 26161 } 26162 function GridGroup({ 26163 groupName, 26164 groupField, 26165 showLabel = true, 26166 children 26167 }) { 26168 const headerId = (0, import_compose13.useInstanceId)( 26169 GridGroup, 26170 "dataviews-view-picker-grid-group__header" 26171 ); 26172 return /* @__PURE__ */ (0, import_jsx_runtime136.jsxs)( 26173 Stack, 26174 { 26175 direction: "column", 26176 gap: "sm", 26177 role: "group", 26178 "aria-labelledby": headerId, 26179 children: [ 26180 /* @__PURE__ */ (0, import_jsx_runtime136.jsx)( 26181 "h3", 26182 { 26183 className: "dataviews-view-picker-grid-group__header", 26184 id: headerId, 26185 children: showLabel ? (0, import_i18n24.sprintf)( 26186 // translators: 1: The label of the field e.g. "Date". 2: The value of the field, e.g.: "May 2022". 26187 (0, import_i18n24.__)("%1$s: %2$s"), 26188 groupField.label, 26189 groupName 26190 ) : groupName 26191 } 26192 ), 26193 children 26194 ] 26195 }, 26196 groupName 26197 ); 26198 } 26199 function ViewPickerGrid({ 26200 actions, 26201 data, 26202 fields: fields3, 26203 getItemId: getItemId2, 26204 isLoading, 26205 onChangeSelection, 26206 selection, 26207 view, 26208 className, 26209 empty 26210 }) { 26211 const { resizeObserverRef, paginationInfo, itemListLabel } = (0, import_element107.useContext)(dataviews_context_default); 26212 const titleField = fields3.find( 26213 (field) => field.id === view?.titleField 26214 ); 26215 const mediaField = fields3.find( 26216 (field) => field.id === view?.mediaField 26217 ); 26218 const descriptionField = fields3.find( 26219 (field) => field.id === view?.descriptionField 26220 ); 26221 const otherFields = view.fields ?? []; 26222 const { regularFields, badgeFields } = otherFields.reduce( 26223 (accumulator, fieldId) => { 26224 const field = fields3.find((f2) => f2.id === fieldId); 26225 if (!field) { 26226 return accumulator; 26227 } 26228 const key2 = view.layout?.badgeFields?.includes(fieldId) ? "badgeFields" : "regularFields"; 26229 accumulator[key2].push(field); 26230 return accumulator; 26231 }, 26232 { regularFields: [], badgeFields: [] } 26233 ); 26234 const hasData = !!data?.length; 26235 const usedPreviewSize = view.layout?.previewSize; 26236 const isMultiselect = useIsMultiselectPicker(actions); 26237 const size4 = "900px"; 26238 const groupField = view.groupBy?.field ? fields3.find((f2) => f2.id === view.groupBy?.field) : null; 26239 const dataByGroup = groupField ? getDataByGroup(data, groupField) : null; 26240 const isInfiniteScroll = (view.infiniteScrollEnabled && !dataByGroup) ?? false; 26241 const currentPage = view?.page ?? 1; 26242 const perPage = view?.perPage ?? 0; 26243 const setSize = isInfiniteScroll ? paginationInfo?.totalItems : void 0; 26244 const gridColumns = useGridColumns(); 26245 const placeholdersNeeded = usePlaceholdersNeeded( 26246 data, 26247 isInfiniteScroll, 26248 gridColumns 26249 ); 26250 return /* @__PURE__ */ (0, import_jsx_runtime136.jsxs)(import_jsx_runtime136.Fragment, { 26251 // Render multiple groups. 26252 children: [ 26253 hasData && groupField && dataByGroup && /* @__PURE__ */ (0, import_jsx_runtime136.jsx)( 26254 import_components15.Composite, 26255 { 26256 virtualFocus: true, 26257 orientation: "horizontal", 26258 role: "listbox", 26259 "aria-multiselectable": isMultiselect, 26260 className: clsx_default( 26261 "dataviews-view-picker-grid", 26262 className, 26263 { 26264 [`has-$view.layout?.density}-density`]: view.layout?.density && ["compact", "comfortable"].includes( 26265 view.layout.density 26266 ) 26267 } 26268 ), 26269 "aria-label": itemListLabel, 26270 render: ({ children, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime136.jsx)( 26271 Stack, 26272 { 26273 direction: "column", 26274 gap: "lg", 26275 children, 26276 ...props 26277 } 26278 ), 26279 children: Array.from(dataByGroup.entries()).map( 26280 ([groupName, groupItems]) => /* @__PURE__ */ (0, import_jsx_runtime136.jsx)( 26281 GridGroup, 26282 { 26283 groupName, 26284 groupField, 26285 showLabel: view.groupBy?.showLabel !== false, 26286 children: /* @__PURE__ */ (0, import_jsx_runtime136.jsx)( 26287 GridItems, 26288 { 26289 previewSize: usedPreviewSize, 26290 style: { 26291 gridTemplateColumns: usedPreviewSize && `repeat(auto-fill, minmax($usedPreviewSize}px, 1fr))` 26292 }, 26293 "aria-busy": isLoading, 26294 ref: resizeObserverRef, 26295 children: groupItems.map((item) => { 26296 const posInSet = item.position ?? (currentPage - 1) * perPage + data.indexOf(item) + 1; 26297 return /* @__PURE__ */ (0, import_jsx_runtime136.jsx)( 26298 GridItem3, 26299 { 26300 view, 26301 multiselect: isMultiselect, 26302 selection, 26303 onChangeSelection, 26304 getItemId: getItemId2, 26305 item, 26306 mediaField, 26307 titleField, 26308 descriptionField, 26309 regularFields, 26310 badgeFields, 26311 config: { 26312 sizes: size4 26313 }, 26314 posinset: posInSet, 26315 setsize: setSize 26316 }, 26317 getItemId2(item) 26318 ); 26319 }) 26320 } 26321 ) 26322 }, 26323 groupName 26324 ) 26325 ) 26326 } 26327 ), 26328 // Render a single grid with all data. 26329 hasData && !dataByGroup && /* @__PURE__ */ (0, import_jsx_runtime136.jsxs)( 26330 import_components15.Composite, 26331 { 26332 render: /* @__PURE__ */ (0, import_jsx_runtime136.jsx)( 26333 GridItems, 26334 { 26335 className: clsx_default( 26336 "dataviews-view-picker-grid", 26337 className, 26338 { 26339 [`has-$view.layout?.density}-density`]: view.layout?.density && [ 26340 "compact", 26341 "comfortable" 26342 ].includes(view.layout.density) 26343 } 26344 ), 26345 previewSize: usedPreviewSize, 26346 "aria-busy": isLoading, 26347 ref: resizeObserverRef 26348 } 26349 ), 26350 virtualFocus: true, 26351 orientation: "horizontal", 26352 role: "listbox", 26353 "aria-multiselectable": isMultiselect, 26354 "aria-label": itemListLabel, 26355 children: [ 26356 Array.from({ length: placeholdersNeeded }).map( 26357 (_, index2) => /* @__PURE__ */ (0, import_jsx_runtime136.jsx)( 26358 import_components15.Composite.Item, 26359 { 26360 render: ({ children, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime136.jsx)( 26361 Stack, 26362 { 26363 direction: "column", 26364 children, 26365 ...props 26366 } 26367 ), 26368 role: "option", 26369 "aria-hidden": true, 26370 tabIndex: -1, 26371 className: "dataviews-view-picker-grid__card dataviews-view-picker-grid__placeholder" 26372 }, 26373 `placeholder-$index2}` 26374 ) 26375 ), 26376 data.map((item) => { 26377 const posinset = item.position; 26378 return /* @__PURE__ */ (0, import_jsx_runtime136.jsx)( 26379 GridItem3, 26380 { 26381 view, 26382 multiselect: isMultiselect, 26383 selection, 26384 onChangeSelection, 26385 getItemId: getItemId2, 26386 item, 26387 mediaField, 26388 titleField, 26389 descriptionField, 26390 regularFields, 26391 badgeFields, 26392 config: { 26393 sizes: size4 26394 }, 26395 posinset, 26396 setsize: setSize 26397 }, 26398 getItemId2(item) 26399 ); 26400 }) 26401 ] 26402 } 26403 ), 26404 // Render empty state. 26405 !hasData && /* @__PURE__ */ (0, import_jsx_runtime136.jsx)( 26406 "div", 26407 { 26408 className: clsx_default({ 26409 "dataviews-loading": isLoading, 26410 "dataviews-no-results": !isLoading 26411 }), 26412 children: isLoading ? /* @__PURE__ */ (0, import_jsx_runtime136.jsx)("p", { children: /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(import_components15.Spinner, {}) }) : empty 26413 } 26414 ), 26415 hasData && isLoading && /* @__PURE__ */ (0, import_jsx_runtime136.jsx)("p", { className: "dataviews-loading-more", children: /* @__PURE__ */ (0, import_jsx_runtime136.jsx)(import_components15.Spinner, {}) }) 26416 ] 26417 }); 26418 } 26419 var picker_grid_default = ViewPickerGrid; 26420 26421 // packages/dataviews/build-module/components/dataviews-layouts/picker-table/index.mjs 26422 var import_i18n25 = __toESM(require_i18n(), 1); 26423 var import_components16 = __toESM(require_components(), 1); 26424 var import_element108 = __toESM(require_element(), 1); 26425 var import_jsx_runtime137 = __toESM(require_jsx_runtime(), 1); 26426 function TableColumnField2({ 26427 item, 26428 fields: fields3, 26429 column, 26430 align 26431 }) { 26432 const field = fields3.find((f2) => f2.id === column); 26433 if (!field) { 26434 return null; 26435 } 26436 const className = clsx_default("dataviews-view-table__cell-content-wrapper", { 26437 "dataviews-view-table__cell-align-end": align === "end", 26438 "dataviews-view-table__cell-align-center": align === "center" 26439 }); 26440 return /* @__PURE__ */ (0, import_jsx_runtime137.jsx)("div", { className, children: /* @__PURE__ */ (0, import_jsx_runtime137.jsx)(field.render, { item, field }) }); 26441 } 26442 function TableRow2({ 26443 item, 26444 fields: fields3, 26445 id, 26446 view, 26447 titleField, 26448 mediaField, 26449 descriptionField, 26450 selection, 26451 getItemId: getItemId2, 26452 onChangeSelection, 26453 multiselect, 26454 posinset 26455 }) { 26456 const { paginationInfo } = (0, import_element108.useContext)(dataviews_context_default); 26457 const isSelected2 = selection.includes(id); 26458 const [isHovered, setIsHovered] = (0, import_element108.useState)(false); 26459 const elementRef = (0, import_element108.useRef)(null); 26460 useIntersectionObserver(elementRef, posinset); 26461 const { 26462 showTitle = true, 26463 showMedia = true, 26464 showDescription = true, 26465 infiniteScrollEnabled 26466 } = view; 26467 const handleMouseEnter = () => { 26468 setIsHovered(true); 26469 }; 26470 const handleMouseLeave = () => { 26471 setIsHovered(false); 26472 }; 26473 const columns = view.fields ?? []; 26474 const hasPrimaryColumn = titleField && showTitle || mediaField && showMedia || descriptionField && showDescription; 26475 return /* @__PURE__ */ (0, import_jsx_runtime137.jsxs)( 26476 import_components16.Composite.Item, 26477 { 26478 ref: elementRef, 26479 render: ({ children, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime137.jsx)( 26480 "tr", 26481 { 26482 className: clsx_default("dataviews-view-table__row", { 26483 "is-selected": isSelected2, 26484 "is-hovered": isHovered 26485 }), 26486 onMouseEnter: handleMouseEnter, 26487 onMouseLeave: handleMouseLeave, 26488 children, 26489 ...props 26490 } 26491 ), 26492 "aria-selected": isSelected2, 26493 "aria-setsize": paginationInfo.totalItems || void 0, 26494 "aria-posinset": posinset, 26495 role: infiniteScrollEnabled ? "article" : "option", 26496 onMouseDown: (event) => { 26497 if (event.button !== 0) { 26498 return; 26499 } 26500 event.currentTarget.parentElement?.focus({ 26501 preventScroll: true 26502 }); 26503 }, 26504 onClick: () => { 26505 if (isSelected2) { 26506 onChangeSelection( 26507 selection.filter((itemId) => id !== itemId) 26508 ); 26509 } else { 26510 const newSelection = multiselect ? [...selection, id] : [id]; 26511 onChangeSelection(newSelection); 26512 } 26513 }, 26514 children: [ 26515 /* @__PURE__ */ (0, import_jsx_runtime137.jsx)( 26516 "td", 26517 { 26518 className: "dataviews-view-table__checkbox-column", 26519 role: "presentation", 26520 children: /* @__PURE__ */ (0, import_jsx_runtime137.jsx)("div", { className: "dataviews-view-table__cell-content-wrapper", children: /* @__PURE__ */ (0, import_jsx_runtime137.jsx)( 26521 DataViewsSelectionCheckbox, 26522 { 26523 item, 26524 selection, 26525 onChangeSelection, 26526 getItemId: getItemId2, 26527 titleField, 26528 disabled: false, 26529 "aria-hidden": true, 26530 tabIndex: -1 26531 } 26532 ) }) 26533 } 26534 ), 26535 hasPrimaryColumn && /* @__PURE__ */ (0, import_jsx_runtime137.jsx)( 26536 "td", 26537 { 26538 role: "presentation", 26539 children: /* @__PURE__ */ (0, import_jsx_runtime137.jsx)( 26540 column_primary_default, 26541 { 26542 item, 26543 titleField: showTitle ? titleField : void 0, 26544 mediaField: showMedia ? mediaField : void 0, 26545 descriptionField: showDescription ? descriptionField : void 0, 26546 isItemClickable: () => false 26547 } 26548 ) 26549 } 26550 ), 26551 columns.map((column) => { 26552 const { width, maxWidth, minWidth, align } = view.layout?.styles?.[column] ?? {}; 26553 return /* @__PURE__ */ (0, import_jsx_runtime137.jsx)( 26554 "td", 26555 { 26556 style: { 26557 width, 26558 maxWidth, 26559 minWidth 26560 }, 26561 role: "presentation", 26562 children: /* @__PURE__ */ (0, import_jsx_runtime137.jsx)( 26563 TableColumnField2, 26564 { 26565 fields: fields3, 26566 item, 26567 column, 26568 align 26569 } 26570 ) 26571 }, 26572 column 26573 ); 26574 }) 26575 ] 26576 }, 26577 id 26578 ); 26579 } 26580 function ViewPickerTable({ 26581 actions, 26582 data, 26583 fields: fields3, 26584 getItemId: getItemId2, 26585 isLoading = false, 26586 onChangeView, 26587 onChangeSelection, 26588 selection, 26589 setOpenedFilter, 26590 view, 26591 className, 26592 empty 26593 }) { 26594 const headerMenuRefs = (0, import_element108.useRef)(/* @__PURE__ */ new Map()); 26595 const headerMenuToFocusRef = (0, import_element108.useRef)(void 0); 26596 const [nextHeaderMenuToFocus, setNextHeaderMenuToFocus] = (0, import_element108.useState)(); 26597 const isMultiselect = useIsMultiselectPicker(actions) ?? false; 26598 (0, import_element108.useEffect)(() => { 26599 if (headerMenuToFocusRef.current) { 26600 headerMenuToFocusRef.current.focus(); 26601 headerMenuToFocusRef.current = void 0; 26602 } 26603 }); 26604 const groupField = view.groupBy?.field ? fields3.find((f2) => f2.id === view.groupBy?.field) : null; 26605 const dataByGroup = groupField ? getDataByGroup(data, groupField) : null; 26606 const isInfiniteScroll = view.infiniteScrollEnabled && !dataByGroup; 26607 const tableNoticeId = (0, import_element108.useId)(); 26608 if (nextHeaderMenuToFocus) { 26609 headerMenuToFocusRef.current = nextHeaderMenuToFocus; 26610 setNextHeaderMenuToFocus(void 0); 26611 return; 26612 } 26613 const onHide = (field) => { 26614 const hidden = headerMenuRefs.current.get(field.id); 26615 const fallback = hidden ? headerMenuRefs.current.get(hidden.fallback) : void 0; 26616 setNextHeaderMenuToFocus(fallback?.node); 26617 }; 26618 const hasData = !!data?.length; 26619 const titleField = fields3.find((field) => field.id === view.titleField); 26620 const mediaField = fields3.find((field) => field.id === view.mediaField); 26621 const descriptionField = fields3.find( 26622 (field) => field.id === view.descriptionField 26623 ); 26624 const { showTitle = true, showMedia = true, showDescription = true } = view; 26625 const hasPrimaryColumn = titleField && showTitle || mediaField && showMedia || descriptionField && showDescription; 26626 const columns = view.fields ?? []; 26627 const headerMenuRef = (column, index2) => (node) => { 26628 if (node) { 26629 headerMenuRefs.current.set(column, { 26630 node, 26631 fallback: columns[index2 > 0 ? index2 - 1 : 1] 26632 }); 26633 } else { 26634 headerMenuRefs.current.delete(column); 26635 } 26636 }; 26637 return /* @__PURE__ */ (0, import_jsx_runtime137.jsxs)(import_jsx_runtime137.Fragment, { children: [ 26638 /* @__PURE__ */ (0, import_jsx_runtime137.jsxs)( 26639 "table", 26640 { 26641 className: clsx_default( 26642 "dataviews-view-table", 26643 "dataviews-view-picker-table", 26644 className, 26645 { 26646 [`has-$view.layout?.density}-density`]: view.layout?.density && ["compact", "comfortable"].includes( 26647 view.layout.density 26648 ) 26649 } 26650 ), 26651 "aria-busy": isLoading, 26652 "aria-describedby": tableNoticeId, 26653 role: isInfiniteScroll ? "feed" : "listbox", 26654 children: [ 26655 /* @__PURE__ */ (0, import_jsx_runtime137.jsx)("thead", { role: "presentation", children: /* @__PURE__ */ (0, import_jsx_runtime137.jsxs)( 26656 "tr", 26657 { 26658 className: "dataviews-view-table__row", 26659 role: "presentation", 26660 children: [ 26661 /* @__PURE__ */ (0, import_jsx_runtime137.jsx)("th", { className: "dataviews-view-table__checkbox-column", children: isMultiselect && /* @__PURE__ */ (0, import_jsx_runtime137.jsx)( 26662 BulkSelectionCheckbox, 26663 { 26664 selection, 26665 onChangeSelection, 26666 data, 26667 actions, 26668 getItemId: getItemId2, 26669 disableSelectAll: isInfiniteScroll 26670 } 26671 ) }), 26672 hasPrimaryColumn && /* @__PURE__ */ (0, import_jsx_runtime137.jsx)("th", { children: titleField && /* @__PURE__ */ (0, import_jsx_runtime137.jsx)( 26673 column_header_menu_default, 26674 { 26675 ref: headerMenuRef( 26676 titleField.id, 26677 0 26678 ), 26679 fieldId: titleField.id, 26680 view, 26681 fields: fields3, 26682 onChangeView, 26683 onHide, 26684 setOpenedFilter, 26685 canMove: false 26686 } 26687 ) }), 26688 columns.map((column, index2) => { 26689 const { width, maxWidth, minWidth, align } = view.layout?.styles?.[column] ?? {}; 26690 return /* @__PURE__ */ (0, import_jsx_runtime137.jsx)( 26691 "th", 26692 { 26693 style: { 26694 width, 26695 maxWidth, 26696 minWidth, 26697 textAlign: align 26698 }, 26699 "aria-sort": view.sort?.direction && view.sort?.field === column ? sortValues[view.sort.direction] : void 0, 26700 scope: "col", 26701 children: /* @__PURE__ */ (0, import_jsx_runtime137.jsx)( 26702 column_header_menu_default, 26703 { 26704 ref: headerMenuRef(column, index2), 26705 fieldId: column, 26706 view, 26707 fields: fields3, 26708 onChangeView, 26709 onHide, 26710 setOpenedFilter, 26711 canMove: view.layout?.enableMoving ?? true 26712 } 26713 ) 26714 }, 26715 column 26716 ); 26717 }) 26718 ] 26719 } 26720 ) }), 26721 hasData && groupField && dataByGroup ? Array.from(dataByGroup.entries()).map( 26722 ([groupName, groupItems]) => /* @__PURE__ */ (0, import_jsx_runtime137.jsxs)( 26723 import_components16.Composite, 26724 { 26725 virtualFocus: true, 26726 orientation: "vertical", 26727 render: /* @__PURE__ */ (0, import_jsx_runtime137.jsx)("tbody", { role: "group" }), 26728 children: [ 26729 /* @__PURE__ */ (0, import_jsx_runtime137.jsx)( 26730 "tr", 26731 { 26732 className: "dataviews-view-table__group-header-row", 26733 role: "presentation", 26734 children: /* @__PURE__ */ (0, import_jsx_runtime137.jsx)( 26735 "td", 26736 { 26737 colSpan: columns.length + (hasPrimaryColumn ? 1 : 0) + 1, 26738 className: "dataviews-view-table__group-header-cell", 26739 role: "presentation", 26740 children: view.groupBy?.showLabel === false ? groupName : (0, import_i18n25.sprintf)( 26741 // translators: 1: The label of the field e.g. "Date". 2: The value of the field, e.g.: "May 2022". 26742 (0, import_i18n25.__)("%1$s: %2$s"), 26743 groupField.label, 26744 groupName 26745 ) 26746 } 26747 ) 26748 } 26749 ), 26750 groupItems.map((item, index2) => /* @__PURE__ */ (0, import_jsx_runtime137.jsx)( 26751 TableRow2, 26752 { 26753 item, 26754 fields: fields3, 26755 id: getItemId2(item) || index2.toString(), 26756 view, 26757 titleField, 26758 mediaField, 26759 descriptionField, 26760 selection, 26761 getItemId: getItemId2, 26762 onChangeSelection, 26763 multiselect: isMultiselect 26764 }, 26765 getItemId2(item) 26766 )) 26767 ] 26768 }, 26769 `group-$groupName}` 26770 ) 26771 ) : /* @__PURE__ */ (0, import_jsx_runtime137.jsx)( 26772 import_components16.Composite, 26773 { 26774 render: /* @__PURE__ */ (0, import_jsx_runtime137.jsx)("tbody", { role: "presentation" }), 26775 virtualFocus: true, 26776 orientation: "vertical", 26777 children: hasData && data.map((item, index2) => { 26778 const itemId = getItemId2(item); 26779 const posinset = item.position; 26780 return /* @__PURE__ */ (0, import_jsx_runtime137.jsx)( 26781 TableRow2, 26782 { 26783 item, 26784 fields: fields3, 26785 id: itemId || index2.toString(), 26786 view, 26787 titleField, 26788 mediaField, 26789 descriptionField, 26790 selection, 26791 getItemId: getItemId2, 26792 onChangeSelection, 26793 multiselect: isMultiselect, 26794 posinset 26795 }, 26796 itemId 26797 ); 26798 }) 26799 } 26800 ) 26801 ] 26802 } 26803 ), 26804 /* @__PURE__ */ (0, import_jsx_runtime137.jsxs)( 26805 "div", 26806 { 26807 className: clsx_default({ 26808 "dataviews-loading": isLoading, 26809 "dataviews-no-results": !hasData && !isLoading 26810 }), 26811 id: tableNoticeId, 26812 children: [ 26813 !hasData && (isLoading ? /* @__PURE__ */ (0, import_jsx_runtime137.jsx)("p", { children: /* @__PURE__ */ (0, import_jsx_runtime137.jsx)(import_components16.Spinner, {}) }) : empty), 26814 hasData && isLoading && /* @__PURE__ */ (0, import_jsx_runtime137.jsx)("p", { className: "dataviews-loading-more", children: /* @__PURE__ */ (0, import_jsx_runtime137.jsx)(import_components16.Spinner, {}) }) 26815 ] 26816 } 26817 ) 26818 ] }); 26819 } 26820 var picker_table_default = ViewPickerTable; 26821 26822 // packages/dataviews/build-module/components/dataviews-layouts/utils/density-picker.mjs 26823 var import_components17 = __toESM(require_components(), 1); 26824 var import_i18n26 = __toESM(require_i18n(), 1); 26825 var import_element109 = __toESM(require_element(), 1); 26826 var import_jsx_runtime138 = __toESM(require_jsx_runtime(), 1); 26827 function DensityPicker() { 26828 const context = (0, import_element109.useContext)(dataviews_context_default); 26829 const view = context.view; 26830 return /* @__PURE__ */ (0, import_jsx_runtime138.jsxs)( 26831 import_components17.__experimentalToggleGroupControl, 26832 { 26833 size: "__unstable-large", 26834 label: (0, import_i18n26.__)("Density"), 26835 value: view.layout?.density || "balanced", 26836 onChange: (value) => { 26837 context.onChangeView({ 26838 ...view, 26839 layout: { 26840 ...view.layout, 26841 density: value 26842 } 26843 }); 26844 }, 26845 isBlock: true, 26846 children: [ 26847 /* @__PURE__ */ (0, import_jsx_runtime138.jsx)( 26848 import_components17.__experimentalToggleGroupControlOption, 26849 { 26850 value: "comfortable", 26851 label: (0, import_i18n26._x)( 26852 "Comfortable", 26853 "Density option for DataView layout" 26854 ) 26855 }, 26856 "comfortable" 26857 ), 26858 /* @__PURE__ */ (0, import_jsx_runtime138.jsx)( 26859 import_components17.__experimentalToggleGroupControlOption, 26860 { 26861 value: "balanced", 26862 label: (0, import_i18n26._x)("Balanced", "Density option for DataView layout") 26863 }, 26864 "balanced" 26865 ), 26866 /* @__PURE__ */ (0, import_jsx_runtime138.jsx)( 26867 import_components17.__experimentalToggleGroupControlOption, 26868 { 26869 value: "compact", 26870 label: (0, import_i18n26._x)("Compact", "Density option for DataView layout") 26871 }, 26872 "compact" 26873 ) 26874 ] 26875 } 26876 ); 26877 } 26878 26879 // packages/dataviews/build-module/components/dataviews-layouts/utils/preview-size-picker.mjs 26880 var import_components18 = __toESM(require_components(), 1); 26881 var import_i18n27 = __toESM(require_i18n(), 1); 26882 var import_element110 = __toESM(require_element(), 1); 26883 var import_jsx_runtime139 = __toESM(require_jsx_runtime(), 1); 26884 var imageSizes2 = [ 26885 { 26886 value: 120, 26887 breakpoint: 1 26888 }, 26889 { 26890 value: 170, 26891 breakpoint: 1 26892 }, 26893 { 26894 value: 230, 26895 breakpoint: 1 26896 }, 26897 { 26898 value: 290, 26899 breakpoint: 1112 26900 // at minimum image width, 4 images display at this container size 26901 }, 26902 { 26903 value: 350, 26904 breakpoint: 1636 26905 // at minimum image width, 6 images display at this container size 26906 }, 26907 { 26908 value: 430, 26909 breakpoint: 588 26910 // at minimum image width, 2 images display at this container size 26911 } 26912 ]; 26913 function PreviewSizePicker() { 26914 const context = (0, import_element110.useContext)(dataviews_context_default); 26915 const view = context.view; 26916 const breakValues = imageSizes2.filter((size4) => { 26917 return context.containerWidth >= size4.breakpoint; 26918 }); 26919 const layoutPreviewSize = view.layout?.previewSize ?? 230; 26920 const previewSizeToUse = breakValues.map((size4, index2) => ({ ...size4, index: index2 })).filter((size4) => size4.value <= layoutPreviewSize).sort((a2, b2) => b2.value - a2.value)[0]?.index ?? 0; 26921 const marks = breakValues.map((size4, index2) => { 26922 return { 26923 value: index2 26924 }; 26925 }); 26926 return /* @__PURE__ */ (0, import_jsx_runtime139.jsx)( 26927 import_components18.RangeControl, 26928 { 26929 __next40pxDefaultSize: true, 26930 showTooltip: false, 26931 label: (0, import_i18n27.__)("Preview size"), 26932 value: previewSizeToUse, 26933 min: 0, 26934 max: breakValues.length - 1, 26935 withInputField: false, 26936 onChange: (value = 0) => { 26937 context.onChangeView({ 26938 ...view, 26939 layout: { 26940 ...view.layout, 26941 previewSize: breakValues[value].value 26942 } 26943 }); 26944 }, 26945 step: 1, 26946 marks 26947 } 26948 ); 26949 } 26950 26951 // packages/dataviews/build-module/components/dataviews-layouts/utils/grid-config-options.mjs 26952 var import_jsx_runtime140 = __toESM(require_jsx_runtime(), 1); 26953 function GridConfigOptions() { 26954 return /* @__PURE__ */ (0, import_jsx_runtime140.jsxs)(import_jsx_runtime140.Fragment, { children: [ 26955 /* @__PURE__ */ (0, import_jsx_runtime140.jsx)(DensityPicker, {}), 26956 /* @__PURE__ */ (0, import_jsx_runtime140.jsx)(PreviewSizePicker, {}) 26957 ] }); 26958 } 26959 26960 // packages/dataviews/build-module/components/dataviews-layouts/index.mjs 26961 var VIEW_LAYOUTS = [ 26962 { 26963 type: LAYOUT_TABLE, 26964 label: (0, import_i18n28.__)("Table"), 26965 component: table_default, 26966 icon: block_table_default, 26967 viewConfigOptions: DensityPicker 26968 }, 26969 { 26970 type: LAYOUT_GRID, 26971 label: (0, import_i18n28.__)("Grid"), 26972 component: grid_default2, 26973 icon: category_default, 26974 viewConfigOptions: GridConfigOptions 26975 }, 26976 { 26977 type: LAYOUT_LIST, 26978 label: (0, import_i18n28.__)("List"), 26979 component: ViewList, 26980 icon: (0, import_i18n28.isRTL)() ? format_list_bullets_rtl_default : format_list_bullets_default, 26981 viewConfigOptions: DensityPicker 26982 }, 26983 { 26984 type: LAYOUT_ACTIVITY, 26985 label: (0, import_i18n28.__)("Activity"), 26986 component: ViewActivity, 26987 icon: scheduled_default, 26988 viewConfigOptions: DensityPicker 26989 }, 26990 { 26991 type: LAYOUT_PICKER_GRID, 26992 label: (0, import_i18n28.__)("Grid"), 26993 component: picker_grid_default, 26994 icon: category_default, 26995 viewConfigOptions: GridConfigOptions, 26996 isPicker: true 26997 }, 26998 { 26999 type: LAYOUT_PICKER_TABLE, 27000 label: (0, import_i18n28.__)("Table"), 27001 component: picker_table_default, 27002 icon: block_table_default, 27003 viewConfigOptions: DensityPicker, 27004 isPicker: true 27005 } 27006 ]; 27007 27008 // packages/dataviews/build-module/components/dataviews-filters/filters.mjs 27009 var import_element118 = __toESM(require_element(), 1); 27010 27011 // packages/dataviews/build-module/components/dataviews-filters/filter.mjs 27012 var import_components21 = __toESM(require_components(), 1); 27013 var import_i18n31 = __toESM(require_i18n(), 1); 27014 var import_element115 = __toESM(require_element(), 1); 27015 27016 // node_modules/@ariakit/core/esm/__chunks/XMCVU3LR.js 27017 function noop5(..._) { 27018 } 27019 function applyState(argument, currentValue) { 27020 if (isUpdater(argument)) { 27021 const value = isLazyValue(currentValue) ? currentValue() : currentValue; 27022 return argument(value); 27023 } 27024 return argument; 27025 } 27026 function isUpdater(argument) { 27027 return typeof argument === "function"; 27028 } 27029 function isLazyValue(value) { 27030 return typeof value === "function"; 27031 } 27032 function hasOwnProperty(object, prop) { 27033 if (typeof Object.hasOwn === "function") { 27034 return Object.hasOwn(object, prop); 27035 } 27036 return Object.prototype.hasOwnProperty.call(object, prop); 27037 } 27038 function chain(...fns) { 27039 return (...args) => { 27040 for (const fn of fns) { 27041 if (typeof fn === "function") { 27042 fn(...args); 27043 } 27044 } 27045 }; 27046 } 27047 function normalizeString(str) { 27048 return str.normalize("NFD").replace(/[\u0300-\u036f]/g, ""); 27049 } 27050 function omit(object, keys) { 27051 const result = { ...object }; 27052 for (const key2 of keys) { 27053 if (hasOwnProperty(result, key2)) { 27054 delete result[key2]; 27055 } 27056 } 27057 return result; 27058 } 27059 function pick(object, paths) { 27060 const result = {}; 27061 for (const key2 of paths) { 27062 if (hasOwnProperty(object, key2)) { 27063 result[key2] = object[key2]; 27064 } 27065 } 27066 return result; 27067 } 27068 function identity(value) { 27069 return value; 27070 } 27071 function invariant(condition, message2) { 27072 if (condition) return; 27073 if (typeof message2 !== "string") throw new Error("Invariant failed"); 27074 throw new Error(message2); 27075 } 27076 function getKeys(obj) { 27077 return Object.keys(obj); 27078 } 27079 function isFalsyBooleanCallback(booleanOrCallback, ...args) { 27080 const result = typeof booleanOrCallback === "function" ? booleanOrCallback(...args) : booleanOrCallback; 27081 if (result == null) return false; 27082 return !result; 27083 } 27084 function disabledFromProps(props) { 27085 return props.disabled || props["aria-disabled"] === true || props["aria-disabled"] === "true"; 27086 } 27087 function removeUndefinedValues(obj) { 27088 const result = {}; 27089 for (const key2 in obj) { 27090 if (obj[key2] !== void 0) { 27091 result[key2] = obj[key2]; 27092 } 27093 } 27094 return result; 27095 } 27096 function defaultValue(...values) { 27097 for (const value of values) { 27098 if (value !== void 0) return value; 27099 } 27100 return void 0; 27101 } 27102 27103 // node_modules/@ariakit/react-core/esm/__chunks/YXGXYGQX.js 27104 var import_react25 = __toESM(require_react(), 1); 27105 function setRef(ref, value) { 27106 if (typeof ref === "function") { 27107 ref(value); 27108 } else if (ref) { 27109 ref.current = value; 27110 } 27111 } 27112 function isValidElementWithRef(element) { 27113 if (!element) return false; 27114 if (!(0, import_react25.isValidElement)(element)) return false; 27115 if ("ref" in element.props) return true; 27116 if ("ref" in element) return true; 27117 return false; 27118 } 27119 function getRefProperty(element) { 27120 if (!isValidElementWithRef(element)) return null; 27121 const props = { ...element.props }; 27122 return props.ref || element.ref; 27123 } 27124 function mergeProps3(base, overrides) { 27125 const props = { ...base }; 27126 for (const key2 in overrides) { 27127 if (!hasOwnProperty(overrides, key2)) continue; 27128 if (key2 === "className") { 27129 const prop = "className"; 27130 props[prop] = base[prop] ? `$base[prop]} $overrides[prop]}` : overrides[prop]; 27131 continue; 27132 } 27133 if (key2 === "style") { 27134 const prop = "style"; 27135 props[prop] = base[prop] ? { ...base[prop], ...overrides[prop] } : overrides[prop]; 27136 continue; 27137 } 27138 const overrideValue = overrides[key2]; 27139 if (typeof overrideValue === "function" && key2.startsWith("on")) { 27140 const baseValue = base[key2]; 27141 if (typeof baseValue === "function") { 27142 props[key2] = (...args) => { 27143 overrideValue(...args); 27144 baseValue(...args); 27145 }; 27146 continue; 27147 } 27148 } 27149 props[key2] = overrideValue; 27150 } 27151 return props; 27152 } 27153 27154 // node_modules/@ariakit/core/esm/__chunks/3DNM6L6E.js 27155 var canUseDOM = checkIsBrowser(); 27156 function checkIsBrowser() { 27157 var _a; 27158 return typeof window !== "undefined" && !!((_a = window.document) == null ? void 0 : _a.createElement); 27159 } 27160 function getDocument(node) { 27161 if (!node) return document; 27162 if ("self" in node) return node.document; 27163 return node.ownerDocument || document; 27164 } 27165 function getActiveElement(node, activeDescendant = false) { 27166 var _a; 27167 const { activeElement: activeElement2 } = getDocument(node); 27168 if (!(activeElement2 == null ? void 0 : activeElement2.nodeName)) { 27169 return null; 27170 } 27171 if (isFrame(activeElement2) && ((_a = activeElement2.contentDocument) == null ? void 0 : _a.body)) { 27172 return getActiveElement( 27173 activeElement2.contentDocument.body, 27174 activeDescendant 27175 ); 27176 } 27177 if (activeDescendant) { 27178 const id = activeElement2.getAttribute("aria-activedescendant"); 27179 if (id) { 27180 const element = getDocument(activeElement2).getElementById(id); 27181 if (element) { 27182 return element; 27183 } 27184 } 27185 } 27186 return activeElement2; 27187 } 27188 function contains2(parent, child) { 27189 return parent === child || parent.contains(child); 27190 } 27191 function isFrame(element) { 27192 return element.tagName === "IFRAME"; 27193 } 27194 function isButton(element) { 27195 const tagName = element.tagName.toLowerCase(); 27196 if (tagName === "button") return true; 27197 if (tagName === "input" && element.type) { 27198 return buttonInputTypes.indexOf(element.type) !== -1; 27199 } 27200 return false; 27201 } 27202 var buttonInputTypes = [ 27203 "button", 27204 "color", 27205 "file", 27206 "image", 27207 "reset", 27208 "submit" 27209 ]; 27210 function isVisible(element) { 27211 if (typeof element.checkVisibility === "function") { 27212 return element.checkVisibility(); 27213 } 27214 const htmlElement = element; 27215 return htmlElement.offsetWidth > 0 || htmlElement.offsetHeight > 0 || element.getClientRects().length > 0; 27216 } 27217 function isTextField(element) { 27218 try { 27219 const isTextInput = element instanceof HTMLInputElement && element.selectionStart !== null; 27220 const isTextArea = element.tagName === "TEXTAREA"; 27221 return isTextInput || isTextArea || false; 27222 } catch (_error) { 27223 return false; 27224 } 27225 } 27226 function isTextbox(element) { 27227 return element.isContentEditable || isTextField(element); 27228 } 27229 function getTextboxValue(element) { 27230 if (isTextField(element)) { 27231 return element.value; 27232 } 27233 if (element.isContentEditable) { 27234 const range = getDocument(element).createRange(); 27235 range.selectNodeContents(element); 27236 return range.toString(); 27237 } 27238 return ""; 27239 } 27240 function getTextboxSelection(element) { 27241 let start = 0; 27242 let end = 0; 27243 if (isTextField(element)) { 27244 start = element.selectionStart || 0; 27245 end = element.selectionEnd || 0; 27246 } else if (element.isContentEditable) { 27247 const selection = getDocument(element).getSelection(); 27248 if ((selection == null ? void 0 : selection.rangeCount) && selection.anchorNode && contains2(element, selection.anchorNode) && selection.focusNode && contains2(element, selection.focusNode)) { 27249 const range = selection.getRangeAt(0); 27250 const nextRange = range.cloneRange(); 27251 nextRange.selectNodeContents(element); 27252 nextRange.setEnd(range.startContainer, range.startOffset); 27253 start = nextRange.toString().length; 27254 nextRange.setEnd(range.endContainer, range.endOffset); 27255 end = nextRange.toString().length; 27256 } 27257 } 27258 return { start, end }; 27259 } 27260 function getPopupRole(element, fallback) { 27261 const allowedPopupRoles = ["dialog", "menu", "listbox", "tree", "grid"]; 27262 const role = element == null ? void 0 : element.getAttribute("role"); 27263 if (role && allowedPopupRoles.indexOf(role) !== -1) { 27264 return role; 27265 } 27266 return fallback; 27267 } 27268 function getScrollingElement(element) { 27269 if (!element) return null; 27270 const isScrollableOverflow = (overflow) => { 27271 if (overflow === "auto") return true; 27272 if (overflow === "scroll") return true; 27273 return false; 27274 }; 27275 if (element.clientHeight && element.scrollHeight > element.clientHeight) { 27276 const { overflowY } = getComputedStyle(element); 27277 if (isScrollableOverflow(overflowY)) return element; 27278 } else if (element.clientWidth && element.scrollWidth > element.clientWidth) { 27279 const { overflowX } = getComputedStyle(element); 27280 if (isScrollableOverflow(overflowX)) return element; 27281 } 27282 return getScrollingElement(element.parentElement) || document.scrollingElement || document.body; 27283 } 27284 function setSelectionRange(element, ...args) { 27285 if (/text|search|password|tel|url/i.test(element.type)) { 27286 element.setSelectionRange(...args); 27287 } 27288 } 27289 function sortBasedOnDOMPosition(items, getElement) { 27290 const pairs = items.map((item, index2) => [index2, item]); 27291 let isOrderDifferent = false; 27292 pairs.sort(([indexA, a2], [indexB, b2]) => { 27293 const elementA = getElement(a2); 27294 const elementB = getElement(b2); 27295 if (elementA === elementB) return 0; 27296 if (!elementA || !elementB) return 0; 27297 if (isElementPreceding(elementA, elementB)) { 27298 if (indexA > indexB) { 27299 isOrderDifferent = true; 27300 } 27301 return -1; 27302 } 27303 if (indexA < indexB) { 27304 isOrderDifferent = true; 27305 } 27306 return 1; 27307 }); 27308 if (isOrderDifferent) { 27309 return pairs.map(([_, item]) => item); 27310 } 27311 return items; 27312 } 27313 function isElementPreceding(a2, b2) { 27314 return Boolean( 27315 b2.compareDocumentPosition(a2) & Node.DOCUMENT_POSITION_PRECEDING 27316 ); 27317 } 27318 27319 // node_modules/@ariakit/core/esm/__chunks/SNHYQNEZ.js 27320 function isTouchDevice() { 27321 return canUseDOM && !!navigator.maxTouchPoints; 27322 } 27323 function isApple() { 27324 if (!canUseDOM) return false; 27325 return /mac|iphone|ipad|ipod/i.test(navigator.platform); 27326 } 27327 function isSafari2() { 27328 return canUseDOM && isApple() && /apple/i.test(navigator.vendor); 27329 } 27330 function isFirefox2() { 27331 return canUseDOM && /firefox\//i.test(navigator.userAgent); 27332 } 27333 27334 // node_modules/@ariakit/core/esm/utils/events.js 27335 function isPortalEvent(event) { 27336 return Boolean( 27337 event.currentTarget && !contains2(event.currentTarget, event.target) 27338 ); 27339 } 27340 function isSelfTarget(event) { 27341 return event.target === event.currentTarget; 27342 } 27343 function isOpeningInNewTab(event) { 27344 const element = event.currentTarget; 27345 if (!element) return false; 27346 const isAppleDevice = isApple(); 27347 if (isAppleDevice && !event.metaKey) return false; 27348 if (!isAppleDevice && !event.ctrlKey) return false; 27349 const tagName = element.tagName.toLowerCase(); 27350 if (tagName === "a") return true; 27351 if (tagName === "button" && element.type === "submit") return true; 27352 if (tagName === "input" && element.type === "submit") return true; 27353 return false; 27354 } 27355 function isDownloading(event) { 27356 const element = event.currentTarget; 27357 if (!element) return false; 27358 const tagName = element.tagName.toLowerCase(); 27359 if (!event.altKey) return false; 27360 if (tagName === "a") return true; 27361 if (tagName === "button" && element.type === "submit") return true; 27362 if (tagName === "input" && element.type === "submit") return true; 27363 return false; 27364 } 27365 function fireBlurEvent(element, eventInit) { 27366 const event = new FocusEvent("blur", eventInit); 27367 const defaultAllowed = element.dispatchEvent(event); 27368 const bubbleInit = { ...eventInit, bubbles: true }; 27369 element.dispatchEvent(new FocusEvent("focusout", bubbleInit)); 27370 return defaultAllowed; 27371 } 27372 function fireKeyboardEvent(element, type, eventInit) { 27373 const event = new KeyboardEvent(type, eventInit); 27374 return element.dispatchEvent(event); 27375 } 27376 function fireClickEvent(element, eventInit) { 27377 const event = new MouseEvent("click", eventInit); 27378 return element.dispatchEvent(event); 27379 } 27380 function isFocusEventOutside(event, container) { 27381 const containerElement = container || event.currentTarget; 27382 const relatedTarget = event.relatedTarget; 27383 return !relatedTarget || !contains2(containerElement, relatedTarget); 27384 } 27385 function queueBeforeEvent(element, type, callback, timeout) { 27386 const createTimer = (callback2) => { 27387 if (timeout) { 27388 const timerId2 = setTimeout(callback2, timeout); 27389 return () => clearTimeout(timerId2); 27390 } 27391 const timerId = requestAnimationFrame(callback2); 27392 return () => cancelAnimationFrame(timerId); 27393 }; 27394 const cancelTimer = createTimer(() => { 27395 element.removeEventListener(type, callSync, true); 27396 callback(); 27397 }); 27398 const callSync = () => { 27399 cancelTimer(); 27400 callback(); 27401 }; 27402 element.addEventListener(type, callSync, { once: true, capture: true }); 27403 return cancelTimer; 27404 } 27405 function addGlobalEventListener(type, listener, options, scope = window) { 27406 const children = []; 27407 try { 27408 scope.document.addEventListener(type, listener, options); 27409 for (const frame of Array.from(scope.frames)) { 27410 children.push(addGlobalEventListener(type, listener, options, frame)); 27411 } 27412 } catch (e2) { 27413 } 27414 const removeEventListener = () => { 27415 try { 27416 scope.document.removeEventListener(type, listener, options); 27417 } catch (e2) { 27418 } 27419 for (const remove of children) { 27420 remove(); 27421 } 27422 }; 27423 return removeEventListener; 27424 } 27425 27426 // node_modules/@ariakit/react-core/esm/__chunks/KPHZR4MB.js 27427 var React97 = __toESM(require_react(), 1); 27428 var import_react26 = __toESM(require_react(), 1); 27429 var _React = { ...React97 }; 27430 var useReactId = _React.useId; 27431 var useReactDeferredValue = _React.useDeferredValue; 27432 var useReactInsertionEffect = _React.useInsertionEffect; 27433 var useSafeLayoutEffect = canUseDOM ? import_react26.useLayoutEffect : import_react26.useEffect; 27434 function useInitialValue(value) { 27435 const [initialValue] = (0, import_react26.useState)(value); 27436 return initialValue; 27437 } 27438 function useLiveRef(value) { 27439 const ref = (0, import_react26.useRef)(value); 27440 useSafeLayoutEffect(() => { 27441 ref.current = value; 27442 }); 27443 return ref; 27444 } 27445 function useEvent(callback) { 27446 const ref = (0, import_react26.useRef)(() => { 27447 throw new Error("Cannot call an event handler while rendering."); 27448 }); 27449 if (useReactInsertionEffect) { 27450 useReactInsertionEffect(() => { 27451 ref.current = callback; 27452 }); 27453 } else { 27454 ref.current = callback; 27455 } 27456 return (0, import_react26.useCallback)((...args) => { 27457 var _a; 27458 return (_a = ref.current) == null ? void 0 : _a.call(ref, ...args); 27459 }, []); 27460 } 27461 function useTransactionState(callback) { 27462 const [state, setState] = (0, import_react26.useState)(null); 27463 useSafeLayoutEffect(() => { 27464 if (state == null) return; 27465 if (!callback) return; 27466 let prevState = null; 27467 callback((prev) => { 27468 prevState = prev; 27469 return state; 27470 }); 27471 return () => { 27472 callback(prevState); 27473 }; 27474 }, [state, callback]); 27475 return [state, setState]; 27476 } 27477 function useMergeRefs8(...refs) { 27478 return (0, import_react26.useMemo)(() => { 27479 if (!refs.some(Boolean)) return; 27480 return (value) => { 27481 for (const ref of refs) { 27482 setRef(ref, value); 27483 } 27484 }; 27485 }, refs); 27486 } 27487 function useId7(defaultId) { 27488 if (useReactId) { 27489 const reactId = useReactId(); 27490 if (defaultId) return defaultId; 27491 return reactId; 27492 } 27493 const [id, setId] = (0, import_react26.useState)(defaultId); 27494 useSafeLayoutEffect(() => { 27495 if (defaultId || id) return; 27496 const random = Math.random().toString(36).slice(2, 8); 27497 setId(`id-$random}`); 27498 }, [defaultId, id]); 27499 return defaultId || id; 27500 } 27501 function useTagName(refOrElement, type) { 27502 const stringOrUndefined = (type2) => { 27503 if (typeof type2 !== "string") return; 27504 return type2; 27505 }; 27506 const [tagName, setTagName] = (0, import_react26.useState)(() => stringOrUndefined(type)); 27507 useSafeLayoutEffect(() => { 27508 const element = refOrElement && "current" in refOrElement ? refOrElement.current : refOrElement; 27509 setTagName((element == null ? void 0 : element.tagName.toLowerCase()) || stringOrUndefined(type)); 27510 }, [refOrElement, type]); 27511 return tagName; 27512 } 27513 function useAttribute(refOrElement, attributeName, defaultValue3) { 27514 const initialValue = useInitialValue(defaultValue3); 27515 const [attribute, setAttribute] = (0, import_react26.useState)(initialValue); 27516 (0, import_react26.useEffect)(() => { 27517 const element = refOrElement && "current" in refOrElement ? refOrElement.current : refOrElement; 27518 if (!element) return; 27519 const callback = () => { 27520 const value = element.getAttribute(attributeName); 27521 setAttribute(value == null ? initialValue : value); 27522 }; 27523 const observer = new MutationObserver(callback); 27524 observer.observe(element, { attributeFilter: [attributeName] }); 27525 callback(); 27526 return () => observer.disconnect(); 27527 }, [refOrElement, attributeName, initialValue]); 27528 return attribute; 27529 } 27530 function useUpdateEffect(effect, deps) { 27531 const mounted = (0, import_react26.useRef)(false); 27532 (0, import_react26.useEffect)(() => { 27533 if (mounted.current) { 27534 return effect(); 27535 } 27536 mounted.current = true; 27537 }, deps); 27538 (0, import_react26.useEffect)( 27539 () => () => { 27540 mounted.current = false; 27541 }, 27542 [] 27543 ); 27544 } 27545 function useUpdateLayoutEffect(effect, deps) { 27546 const mounted = (0, import_react26.useRef)(false); 27547 useSafeLayoutEffect(() => { 27548 if (mounted.current) { 27549 return effect(); 27550 } 27551 mounted.current = true; 27552 }, deps); 27553 useSafeLayoutEffect( 27554 () => () => { 27555 mounted.current = false; 27556 }, 27557 [] 27558 ); 27559 } 27560 function useForceUpdate() { 27561 return (0, import_react26.useReducer)(() => [], []); 27562 } 27563 function useBooleanEvent(booleanOrCallback) { 27564 return useEvent( 27565 typeof booleanOrCallback === "function" ? booleanOrCallback : () => booleanOrCallback 27566 ); 27567 } 27568 function useWrapElement(props, callback, deps = []) { 27569 const wrapElement = (0, import_react26.useCallback)( 27570 (element) => { 27571 if (props.wrapElement) { 27572 element = props.wrapElement(element); 27573 } 27574 return callback(element); 27575 }, 27576 [...deps, props.wrapElement] 27577 ); 27578 return { ...props, wrapElement }; 27579 } 27580 function useMetadataProps(props, key2, value) { 27581 const parent = props.onLoadedMetadataCapture; 27582 const onLoadedMetadataCapture = (0, import_react26.useMemo)(() => { 27583 return Object.assign(() => { 27584 }, { ...parent, [key2]: value }); 27585 }, [parent, key2, value]); 27586 return [parent == null ? void 0 : parent[key2], { onLoadedMetadataCapture }]; 27587 } 27588 var hasInstalledGlobalEventListeners = false; 27589 function useIsMouseMoving() { 27590 (0, import_react26.useEffect)(() => { 27591 if (hasInstalledGlobalEventListeners) return; 27592 addGlobalEventListener("mousemove", setMouseMoving, true); 27593 addGlobalEventListener("mousedown", resetMouseMoving, true); 27594 addGlobalEventListener("mouseup", resetMouseMoving, true); 27595 addGlobalEventListener("keydown", resetMouseMoving, true); 27596 addGlobalEventListener("scroll", resetMouseMoving, true); 27597 hasInstalledGlobalEventListeners = true; 27598 }, []); 27599 const isMouseMoving = useEvent(() => mouseMoving); 27600 return isMouseMoving; 27601 } 27602 var mouseMoving = false; 27603 var previousScreenX = 0; 27604 var previousScreenY = 0; 27605 function hasMouseMovement(event) { 27606 const movementX = event.movementX || event.screenX - previousScreenX; 27607 const movementY = event.movementY || event.screenY - previousScreenY; 27608 previousScreenX = event.screenX; 27609 previousScreenY = event.screenY; 27610 return movementX || movementY || false; 27611 } 27612 function setMouseMoving(event) { 27613 if (!hasMouseMovement(event)) return; 27614 mouseMoving = true; 27615 } 27616 function resetMouseMoving() { 27617 mouseMoving = false; 27618 } 27619 27620 // node_modules/@ariakit/react-core/esm/__chunks/GWSL6KNJ.js 27621 var React98 = __toESM(require_react(), 1); 27622 var import_jsx_runtime141 = __toESM(require_jsx_runtime(), 1); 27623 function forwardRef210(render4) { 27624 const Role = React98.forwardRef( 27625 // @ts-ignore Incompatible with React 19 types. Ignore for now. 27626 (props, ref) => render4({ ...props, ref }) 27627 ); 27628 Role.displayName = render4.displayName || render4.name; 27629 return Role; 27630 } 27631 function memo22(Component2, propsAreEqual) { 27632 return React98.memo(Component2, propsAreEqual); 27633 } 27634 function createElement3(Type, props) { 27635 const { wrapElement, render: render4, ...rest } = props; 27636 const mergedRef = useMergeRefs8(props.ref, getRefProperty(render4)); 27637 let element; 27638 if (React98.isValidElement(render4)) { 27639 const renderProps = { 27640 // @ts-ignore Incompatible with React 19 types. Ignore for now. 27641 ...render4.props, 27642 ref: mergedRef 27643 }; 27644 element = React98.cloneElement(render4, mergeProps3(rest, renderProps)); 27645 } else if (render4) { 27646 element = render4(rest); 27647 } else { 27648 element = /* @__PURE__ */ (0, import_jsx_runtime141.jsx)(Type, { ...rest }); 27649 } 27650 if (wrapElement) { 27651 return wrapElement(element); 27652 } 27653 return element; 27654 } 27655 function createHook(useProps) { 27656 const useRole2 = (props = {}) => { 27657 return useProps(props); 27658 }; 27659 useRole2.displayName = useProps.name; 27660 return useRole2; 27661 } 27662 function createStoreContext(providers = [], scopedProviders = []) { 27663 const context = React98.createContext(void 0); 27664 const scopedContext = React98.createContext(void 0); 27665 const useContext210 = () => React98.useContext(context); 27666 const useScopedContext = (onlyScoped = false) => { 27667 const scoped = React98.useContext(scopedContext); 27668 const store = useContext210(); 27669 if (onlyScoped) return scoped; 27670 return scoped || store; 27671 }; 27672 const useProviderContext = () => { 27673 const scoped = React98.useContext(scopedContext); 27674 const store = useContext210(); 27675 if (scoped && scoped === store) return; 27676 return store; 27677 }; 27678 const ContextProvider = (props) => { 27679 return providers.reduceRight( 27680 (children, Provider2) => /* @__PURE__ */ (0, import_jsx_runtime141.jsx)(Provider2, { ...props, children }), 27681 /* @__PURE__ */ (0, import_jsx_runtime141.jsx)(context.Provider, { ...props }) 27682 ); 27683 }; 27684 const ScopedContextProvider = (props) => { 27685 return /* @__PURE__ */ (0, import_jsx_runtime141.jsx)(ContextProvider, { ...props, children: scopedProviders.reduceRight( 27686 (children, Provider2) => /* @__PURE__ */ (0, import_jsx_runtime141.jsx)(Provider2, { ...props, children }), 27687 /* @__PURE__ */ (0, import_jsx_runtime141.jsx)(scopedContext.Provider, { ...props }) 27688 ) }); 27689 }; 27690 return { 27691 context, 27692 scopedContext, 27693 useContext: useContext210, 27694 useScopedContext, 27695 useProviderContext, 27696 ContextProvider, 27697 ScopedContextProvider 27698 }; 27699 } 27700 27701 // node_modules/@ariakit/react-core/esm/__chunks/SMPCIMZM.js 27702 var ctx = createStoreContext(); 27703 var useCollectionContext = ctx.useContext; 27704 var useCollectionScopedContext = ctx.useScopedContext; 27705 var useCollectionProviderContext = ctx.useProviderContext; 27706 var CollectionContextProvider = ctx.ContextProvider; 27707 var CollectionScopedContextProvider = ctx.ScopedContextProvider; 27708 27709 // node_modules/@ariakit/react-core/esm/__chunks/AVVXDJMZ.js 27710 var import_react27 = __toESM(require_react(), 1); 27711 var ctx2 = createStoreContext( 27712 [CollectionContextProvider], 27713 [CollectionScopedContextProvider] 27714 ); 27715 var useCompositeContext = ctx2.useContext; 27716 var useCompositeScopedContext = ctx2.useScopedContext; 27717 var useCompositeProviderContext = ctx2.useProviderContext; 27718 var CompositeContextProvider = ctx2.ContextProvider; 27719 var CompositeScopedContextProvider = ctx2.ScopedContextProvider; 27720 var CompositeItemContext = (0, import_react27.createContext)( 27721 void 0 27722 ); 27723 var CompositeRowContext = (0, import_react27.createContext)( 27724 void 0 27725 ); 27726 27727 // node_modules/@ariakit/react-core/esm/__chunks/5VQZOHHZ.js 27728 function findFirstEnabledItem(items, excludeId) { 27729 return items.find((item) => { 27730 if (excludeId) { 27731 return !item.disabled && item.id !== excludeId; 27732 } 27733 return !item.disabled; 27734 }); 27735 } 27736 function getEnabledItem(store, id) { 27737 if (!id) return null; 27738 return store.item(id) || null; 27739 } 27740 function groupItemsByRows(items) { 27741 const rows = []; 27742 for (const item of items) { 27743 const row = rows.find((currentRow) => { 27744 var _a; 27745 return ((_a = currentRow[0]) == null ? void 0 : _a.rowId) === item.rowId; 27746 }); 27747 if (row) { 27748 row.push(item); 27749 } else { 27750 rows.push([item]); 27751 } 27752 } 27753 return rows; 27754 } 27755 function selectTextField(element, collapseToEnd = false) { 27756 if (isTextField(element)) { 27757 element.setSelectionRange( 27758 collapseToEnd ? element.value.length : 0, 27759 element.value.length 27760 ); 27761 } else if (element.isContentEditable) { 27762 const selection = getDocument(element).getSelection(); 27763 selection == null ? void 0 : selection.selectAllChildren(element); 27764 if (collapseToEnd) { 27765 selection == null ? void 0 : selection.collapseToEnd(); 27766 } 27767 } 27768 } 27769 var FOCUS_SILENTLY = /* @__PURE__ */ Symbol("FOCUS_SILENTLY"); 27770 function focusSilently(element) { 27771 element[FOCUS_SILENTLY] = true; 27772 element.focus({ preventScroll: true }); 27773 } 27774 function silentlyFocused(element) { 27775 const isSilentlyFocused = element[FOCUS_SILENTLY]; 27776 delete element[FOCUS_SILENTLY]; 27777 return isSilentlyFocused; 27778 } 27779 function isItem(store, element, exclude) { 27780 if (!element) return false; 27781 if (element === exclude) return false; 27782 const item = store.item(element.id); 27783 if (!item) return false; 27784 if (exclude && item.element === exclude) return false; 27785 return true; 27786 } 27787 27788 // node_modules/@ariakit/react-core/esm/__chunks/Z2O3VLAQ.js 27789 var import_react28 = __toESM(require_react(), 1); 27790 var TagName = "div"; 27791 var useCollectionItem = createHook( 27792 function useCollectionItem2({ 27793 store, 27794 shouldRegisterItem = true, 27795 getItem = identity, 27796 // @ts-expect-error This prop may come from a collection renderer. 27797 element, 27798 ...props 27799 }) { 27800 const context = useCollectionContext(); 27801 store = store || context; 27802 const id = useId7(props.id); 27803 const ref = (0, import_react28.useRef)(element); 27804 (0, import_react28.useEffect)(() => { 27805 const element2 = ref.current; 27806 if (!id) return; 27807 if (!element2) return; 27808 if (!shouldRegisterItem) return; 27809 const item = getItem({ id, element: element2 }); 27810 return store == null ? void 0 : store.renderItem(item); 27811 }, [id, shouldRegisterItem, getItem, store]); 27812 props = { 27813 ...props, 27814 ref: useMergeRefs8(ref, props.ref) 27815 }; 27816 return removeUndefinedValues(props); 27817 } 27818 ); 27819 var CollectionItem = forwardRef210(function CollectionItem2(props) { 27820 const htmlProps = useCollectionItem(props); 27821 return createElement3(TagName, htmlProps); 27822 }); 27823 27824 // node_modules/@ariakit/react-core/esm/__chunks/SWN3JYXT.js 27825 var import_react29 = __toESM(require_react(), 1); 27826 var FocusableContext = (0, import_react29.createContext)(true); 27827 27828 // node_modules/@ariakit/core/esm/utils/focus.js 27829 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'])"; 27830 function isFocusable(element) { 27831 if (!element.matches(selector)) return false; 27832 if (!isVisible(element)) return false; 27833 if (element.closest("[inert]")) return false; 27834 return true; 27835 } 27836 function getClosestFocusable(element) { 27837 while (element && !isFocusable(element)) { 27838 element = element.closest(selector); 27839 } 27840 return element || null; 27841 } 27842 function hasFocus(element) { 27843 const activeElement2 = getActiveElement(element); 27844 if (!activeElement2) return false; 27845 if (activeElement2 === element) return true; 27846 const activeDescendant = activeElement2.getAttribute("aria-activedescendant"); 27847 if (!activeDescendant) return false; 27848 return activeDescendant === element.id; 27849 } 27850 function hasFocusWithin(element) { 27851 const activeElement2 = getActiveElement(element); 27852 if (!activeElement2) return false; 27853 if (contains2(element, activeElement2)) return true; 27854 const activeDescendant = activeElement2.getAttribute("aria-activedescendant"); 27855 if (!activeDescendant) return false; 27856 if (!("id" in element)) return false; 27857 if (activeDescendant === element.id) return true; 27858 return !!element.querySelector(`#$CSS.escape(activeDescendant)}`); 27859 } 27860 function focusIfNeeded(element) { 27861 if (!hasFocusWithin(element) && isFocusable(element)) { 27862 element.focus(); 27863 } 27864 } 27865 function focusIntoView(element, options) { 27866 if (!("scrollIntoView" in element)) { 27867 element.focus(); 27868 } else { 27869 element.focus({ preventScroll: true }); 27870 element.scrollIntoView({ block: "nearest", inline: "nearest", ...options }); 27871 } 27872 } 27873 27874 // node_modules/@ariakit/react-core/esm/__chunks/U6HHPQDW.js 27875 var import_react30 = __toESM(require_react(), 1); 27876 var TagName2 = "div"; 27877 var isSafariBrowser = isSafari2(); 27878 var alwaysFocusVisibleInputTypes = [ 27879 "text", 27880 "search", 27881 "url", 27882 "tel", 27883 "email", 27884 "password", 27885 "number", 27886 "date", 27887 "month", 27888 "week", 27889 "time", 27890 "datetime", 27891 "datetime-local" 27892 ]; 27893 var safariFocusAncestorSymbol = /* @__PURE__ */ Symbol("safariFocusAncestor"); 27894 function markSafariFocusAncestor(element, value) { 27895 if (!element) return; 27896 element[safariFocusAncestorSymbol] = value; 27897 } 27898 function isAlwaysFocusVisible(element) { 27899 const { tagName, readOnly, type } = element; 27900 if (tagName === "TEXTAREA" && !readOnly) return true; 27901 if (tagName === "SELECT" && !readOnly) return true; 27902 if (tagName === "INPUT" && !readOnly) { 27903 return alwaysFocusVisibleInputTypes.includes(type); 27904 } 27905 if (element.isContentEditable) return true; 27906 const role = element.getAttribute("role"); 27907 if (role === "combobox" && element.dataset.name) { 27908 return true; 27909 } 27910 return false; 27911 } 27912 function getLabels(element) { 27913 if ("labels" in element) { 27914 return element.labels; 27915 } 27916 return null; 27917 } 27918 function isNativeCheckboxOrRadio(element) { 27919 const tagName = element.tagName.toLowerCase(); 27920 if (tagName === "input" && element.type) { 27921 return element.type === "radio" || element.type === "checkbox"; 27922 } 27923 return false; 27924 } 27925 function isNativeTabbable(tagName) { 27926 if (!tagName) return true; 27927 return tagName === "button" || tagName === "summary" || tagName === "input" || tagName === "select" || tagName === "textarea" || tagName === "a"; 27928 } 27929 function supportsDisabledAttribute(tagName) { 27930 if (!tagName) return true; 27931 return tagName === "button" || tagName === "input" || tagName === "select" || tagName === "textarea"; 27932 } 27933 function getTabIndex4(focusable2, trulyDisabled, nativeTabbable, supportsDisabled, tabIndexProp) { 27934 if (!focusable2) { 27935 return tabIndexProp; 27936 } 27937 if (trulyDisabled) { 27938 if (nativeTabbable && !supportsDisabled) { 27939 return -1; 27940 } 27941 return; 27942 } 27943 if (nativeTabbable) { 27944 return tabIndexProp; 27945 } 27946 return tabIndexProp || 0; 27947 } 27948 function useDisableEvent(onEvent, disabled2) { 27949 return useEvent((event) => { 27950 onEvent == null ? void 0 : onEvent(event); 27951 if (event.defaultPrevented) return; 27952 if (disabled2) { 27953 event.stopPropagation(); 27954 event.preventDefault(); 27955 } 27956 }); 27957 } 27958 var hasInstalledGlobalEventListeners2 = false; 27959 var isKeyboardModality = true; 27960 function onGlobalMouseDown(event) { 27961 const target = event.target; 27962 if (target && "hasAttribute" in target) { 27963 if (!target.hasAttribute("data-focus-visible")) { 27964 isKeyboardModality = false; 27965 } 27966 } 27967 } 27968 function onGlobalKeyDown(event) { 27969 if (event.metaKey) return; 27970 if (event.ctrlKey) return; 27971 if (event.altKey) return; 27972 isKeyboardModality = true; 27973 } 27974 var useFocusable = createHook( 27975 function useFocusable2({ 27976 focusable: focusable2 = true, 27977 accessibleWhenDisabled, 27978 autoFocus, 27979 onFocusVisible, 27980 ...props 27981 }) { 27982 const ref = (0, import_react30.useRef)(null); 27983 (0, import_react30.useEffect)(() => { 27984 if (!focusable2) return; 27985 if (hasInstalledGlobalEventListeners2) return; 27986 addGlobalEventListener("mousedown", onGlobalMouseDown, true); 27987 addGlobalEventListener("keydown", onGlobalKeyDown, true); 27988 hasInstalledGlobalEventListeners2 = true; 27989 }, [focusable2]); 27990 if (isSafariBrowser) { 27991 (0, import_react30.useEffect)(() => { 27992 if (!focusable2) return; 27993 const element = ref.current; 27994 if (!element) return; 27995 if (!isNativeCheckboxOrRadio(element)) return; 27996 const labels = getLabels(element); 27997 if (!labels) return; 27998 const onMouseUp = () => queueMicrotask(() => element.focus()); 27999 for (const label of labels) { 28000 label.addEventListener("mouseup", onMouseUp); 28001 } 28002 return () => { 28003 for (const label of labels) { 28004 label.removeEventListener("mouseup", onMouseUp); 28005 } 28006 }; 28007 }, [focusable2]); 28008 } 28009 const disabled2 = focusable2 && disabledFromProps(props); 28010 const trulyDisabled = !!disabled2 && !accessibleWhenDisabled; 28011 const [focusVisible, setFocusVisible] = (0, import_react30.useState)(false); 28012 (0, import_react30.useEffect)(() => { 28013 if (!focusable2) return; 28014 if (trulyDisabled && focusVisible) { 28015 setFocusVisible(false); 28016 } 28017 }, [focusable2, trulyDisabled, focusVisible]); 28018 (0, import_react30.useEffect)(() => { 28019 if (!focusable2) return; 28020 if (!focusVisible) return; 28021 const element = ref.current; 28022 if (!element) return; 28023 if (typeof IntersectionObserver === "undefined") return; 28024 const observer = new IntersectionObserver(() => { 28025 if (!isFocusable(element)) { 28026 setFocusVisible(false); 28027 } 28028 }); 28029 observer.observe(element); 28030 return () => observer.disconnect(); 28031 }, [focusable2, focusVisible]); 28032 const onKeyPressCapture = useDisableEvent( 28033 props.onKeyPressCapture, 28034 disabled2 28035 ); 28036 const onMouseDownCapture = useDisableEvent( 28037 props.onMouseDownCapture, 28038 disabled2 28039 ); 28040 const onClickCapture = useDisableEvent(props.onClickCapture, disabled2); 28041 const onMouseDownProp = props.onMouseDown; 28042 const onMouseDown = useEvent((event) => { 28043 onMouseDownProp == null ? void 0 : onMouseDownProp(event); 28044 if (event.defaultPrevented) return; 28045 if (!focusable2) return; 28046 const element = event.currentTarget; 28047 if (!isSafariBrowser) return; 28048 if (isPortalEvent(event)) return; 28049 if (!isButton(element) && !isNativeCheckboxOrRadio(element)) return; 28050 let receivedFocus = false; 28051 const onFocus = () => { 28052 receivedFocus = true; 28053 }; 28054 const options = { capture: true, once: true }; 28055 element.addEventListener("focusin", onFocus, options); 28056 const focusableContainer = getClosestFocusable(element.parentElement); 28057 markSafariFocusAncestor(focusableContainer, true); 28058 queueBeforeEvent(element, "mouseup", () => { 28059 element.removeEventListener("focusin", onFocus, true); 28060 markSafariFocusAncestor(focusableContainer, false); 28061 if (receivedFocus) return; 28062 focusIfNeeded(element); 28063 }); 28064 }); 28065 const handleFocusVisible = (event, currentTarget) => { 28066 if (currentTarget) { 28067 event.currentTarget = currentTarget; 28068 } 28069 if (!focusable2) return; 28070 const element = event.currentTarget; 28071 if (!element) return; 28072 if (!hasFocus(element)) return; 28073 onFocusVisible == null ? void 0 : onFocusVisible(event); 28074 if (event.defaultPrevented) return; 28075 element.dataset.focusVisible = "true"; 28076 setFocusVisible(true); 28077 }; 28078 const onKeyDownCaptureProp = props.onKeyDownCapture; 28079 const onKeyDownCapture = useEvent((event) => { 28080 onKeyDownCaptureProp == null ? void 0 : onKeyDownCaptureProp(event); 28081 if (event.defaultPrevented) return; 28082 if (!focusable2) return; 28083 if (focusVisible) return; 28084 if (event.metaKey) return; 28085 if (event.altKey) return; 28086 if (event.ctrlKey) return; 28087 if (!isSelfTarget(event)) return; 28088 const element = event.currentTarget; 28089 const applyFocusVisible = () => handleFocusVisible(event, element); 28090 queueBeforeEvent(element, "focusout", applyFocusVisible); 28091 }); 28092 const onFocusCaptureProp = props.onFocusCapture; 28093 const onFocusCapture = useEvent((event) => { 28094 onFocusCaptureProp == null ? void 0 : onFocusCaptureProp(event); 28095 if (event.defaultPrevented) return; 28096 if (!focusable2) return; 28097 if (!isSelfTarget(event)) { 28098 setFocusVisible(false); 28099 return; 28100 } 28101 const element = event.currentTarget; 28102 const applyFocusVisible = () => handleFocusVisible(event, element); 28103 if (isKeyboardModality || isAlwaysFocusVisible(event.target)) { 28104 queueBeforeEvent(event.target, "focusout", applyFocusVisible); 28105 } else { 28106 setFocusVisible(false); 28107 } 28108 }); 28109 const onBlurProp = props.onBlur; 28110 const onBlur = useEvent((event) => { 28111 onBlurProp == null ? void 0 : onBlurProp(event); 28112 if (!focusable2) return; 28113 if (!isFocusEventOutside(event)) return; 28114 event.currentTarget.removeAttribute("data-focus-visible"); 28115 setFocusVisible(false); 28116 }); 28117 const autoFocusOnShow = (0, import_react30.useContext)(FocusableContext); 28118 const autoFocusRef = useEvent((element) => { 28119 if (!focusable2) return; 28120 if (!autoFocus) return; 28121 if (!element) return; 28122 if (!autoFocusOnShow) return; 28123 queueMicrotask(() => { 28124 if (hasFocus(element)) return; 28125 if (!isFocusable(element)) return; 28126 element.focus(); 28127 }); 28128 }); 28129 const tagName = useTagName(ref); 28130 const nativeTabbable = focusable2 && isNativeTabbable(tagName); 28131 const supportsDisabled = focusable2 && supportsDisabledAttribute(tagName); 28132 const styleProp = props.style; 28133 const style = (0, import_react30.useMemo)(() => { 28134 if (trulyDisabled) { 28135 return { pointerEvents: "none", ...styleProp }; 28136 } 28137 return styleProp; 28138 }, [trulyDisabled, styleProp]); 28139 props = { 28140 "data-focus-visible": focusable2 && focusVisible || void 0, 28141 "data-autofocus": autoFocus || void 0, 28142 "aria-disabled": disabled2 || void 0, 28143 ...props, 28144 ref: useMergeRefs8(ref, autoFocusRef, props.ref), 28145 style, 28146 tabIndex: getTabIndex4( 28147 focusable2, 28148 trulyDisabled, 28149 nativeTabbable, 28150 supportsDisabled, 28151 props.tabIndex 28152 ), 28153 disabled: supportsDisabled && trulyDisabled ? true : void 0, 28154 // TODO: Test Focusable contentEditable. 28155 contentEditable: disabled2 ? void 0 : props.contentEditable, 28156 onKeyPressCapture, 28157 onClickCapture, 28158 onMouseDownCapture, 28159 onMouseDown, 28160 onKeyDownCapture, 28161 onFocusCapture, 28162 onBlur 28163 }; 28164 return removeUndefinedValues(props); 28165 } 28166 ); 28167 var Focusable = forwardRef210(function Focusable2(props) { 28168 const htmlProps = useFocusable(props); 28169 return createElement3(TagName2, htmlProps); 28170 }); 28171 28172 // node_modules/@ariakit/react-core/esm/__chunks/PZ3OL7I2.js 28173 var import_react31 = __toESM(require_react(), 1); 28174 var TagName3 = "button"; 28175 function isNativeClick(event) { 28176 if (!event.isTrusted) return false; 28177 const element = event.currentTarget; 28178 if (event.key === "Enter") { 28179 return isButton(element) || element.tagName === "SUMMARY" || element.tagName === "A"; 28180 } 28181 if (event.key === " ") { 28182 return isButton(element) || element.tagName === "SUMMARY" || element.tagName === "INPUT" || element.tagName === "SELECT"; 28183 } 28184 return false; 28185 } 28186 var symbol = /* @__PURE__ */ Symbol("command"); 28187 var useCommand = createHook( 28188 function useCommand2({ clickOnEnter = true, clickOnSpace = true, ...props }) { 28189 const ref = (0, import_react31.useRef)(null); 28190 const [isNativeButton, setIsNativeButton] = (0, import_react31.useState)(false); 28191 (0, import_react31.useEffect)(() => { 28192 if (!ref.current) return; 28193 setIsNativeButton(isButton(ref.current)); 28194 }, []); 28195 const [active, setActive] = (0, import_react31.useState)(false); 28196 const activeRef = (0, import_react31.useRef)(false); 28197 const disabled2 = disabledFromProps(props); 28198 const [isDuplicate, metadataProps] = useMetadataProps(props, symbol, true); 28199 const onKeyDownProp = props.onKeyDown; 28200 const onKeyDown = useEvent((event) => { 28201 onKeyDownProp == null ? void 0 : onKeyDownProp(event); 28202 const element = event.currentTarget; 28203 if (event.defaultPrevented) return; 28204 if (isDuplicate) return; 28205 if (disabled2) return; 28206 if (!isSelfTarget(event)) return; 28207 if (isTextField(element)) return; 28208 if (element.isContentEditable) return; 28209 const isEnter = clickOnEnter && event.key === "Enter"; 28210 const isSpace = clickOnSpace && event.key === " "; 28211 const shouldPreventEnter = event.key === "Enter" && !clickOnEnter; 28212 const shouldPreventSpace = event.key === " " && !clickOnSpace; 28213 if (shouldPreventEnter || shouldPreventSpace) { 28214 event.preventDefault(); 28215 return; 28216 } 28217 if (isEnter || isSpace) { 28218 const nativeClick = isNativeClick(event); 28219 if (isEnter) { 28220 if (!nativeClick) { 28221 event.preventDefault(); 28222 const { view, ...eventInit } = event; 28223 const click = () => fireClickEvent(element, eventInit); 28224 if (isFirefox2()) { 28225 queueBeforeEvent(element, "keyup", click); 28226 } else { 28227 queueMicrotask(click); 28228 } 28229 } 28230 } else if (isSpace) { 28231 activeRef.current = true; 28232 if (!nativeClick) { 28233 event.preventDefault(); 28234 setActive(true); 28235 } 28236 } 28237 } 28238 }); 28239 const onKeyUpProp = props.onKeyUp; 28240 const onKeyUp = useEvent((event) => { 28241 onKeyUpProp == null ? void 0 : onKeyUpProp(event); 28242 if (event.defaultPrevented) return; 28243 if (isDuplicate) return; 28244 if (disabled2) return; 28245 if (event.metaKey) return; 28246 const isSpace = clickOnSpace && event.key === " "; 28247 if (activeRef.current && isSpace) { 28248 activeRef.current = false; 28249 if (!isNativeClick(event)) { 28250 event.preventDefault(); 28251 setActive(false); 28252 const element = event.currentTarget; 28253 const { view, ...eventInit } = event; 28254 queueMicrotask(() => fireClickEvent(element, eventInit)); 28255 } 28256 } 28257 }); 28258 props = { 28259 "data-active": active || void 0, 28260 type: isNativeButton ? "button" : void 0, 28261 ...metadataProps, 28262 ...props, 28263 ref: useMergeRefs8(ref, props.ref), 28264 onKeyDown, 28265 onKeyUp 28266 }; 28267 props = useFocusable(props); 28268 return props; 28269 } 28270 ); 28271 var Command = forwardRef210(function Command2(props) { 28272 const htmlProps = useCommand(props); 28273 return createElement3(TagName3, htmlProps); 28274 }); 28275 28276 // node_modules/@ariakit/core/esm/__chunks/SXKM4CGU.js 28277 function getInternal(store, key2) { 28278 const internals = store.__unstableInternals; 28279 invariant(internals, "Invalid store"); 28280 return internals[key2]; 28281 } 28282 function createStore(initialState, ...stores) { 28283 let state = initialState; 28284 let prevStateBatch = state; 28285 let lastUpdate = /* @__PURE__ */ Symbol(); 28286 let destroy = noop5; 28287 const instances = /* @__PURE__ */ new Set(); 28288 const updatedKeys = /* @__PURE__ */ new Set(); 28289 const setups = /* @__PURE__ */ new Set(); 28290 const listeners = /* @__PURE__ */ new Set(); 28291 const batchListeners = /* @__PURE__ */ new Set(); 28292 const disposables = /* @__PURE__ */ new WeakMap(); 28293 const listenerKeys = /* @__PURE__ */ new WeakMap(); 28294 const storeSetup = (callback) => { 28295 setups.add(callback); 28296 return () => setups.delete(callback); 28297 }; 28298 const storeInit = () => { 28299 const initialized = instances.size; 28300 const instance = /* @__PURE__ */ Symbol(); 28301 instances.add(instance); 28302 const maybeDestroy = () => { 28303 instances.delete(instance); 28304 if (instances.size) return; 28305 destroy(); 28306 }; 28307 if (initialized) return maybeDestroy; 28308 const desyncs = getKeys(state).map( 28309 (key2) => chain( 28310 ...stores.map((store) => { 28311 var _a; 28312 const storeState = (_a = store == null ? void 0 : store.getState) == null ? void 0 : _a.call(store); 28313 if (!storeState) return; 28314 if (!hasOwnProperty(storeState, key2)) return; 28315 return sync(store, [key2], (state2) => { 28316 setState( 28317 key2, 28318 state2[key2], 28319 // @ts-expect-error - Not public API. This is just to prevent 28320 // infinite loops. 28321 true 28322 ); 28323 }); 28324 }) 28325 ) 28326 ); 28327 const teardowns = []; 28328 for (const setup2 of setups) { 28329 teardowns.push(setup2()); 28330 } 28331 const cleanups = stores.map(init); 28332 destroy = chain(...desyncs, ...teardowns, ...cleanups); 28333 return maybeDestroy; 28334 }; 28335 const sub = (keys, listener, set3 = listeners) => { 28336 set3.add(listener); 28337 listenerKeys.set(listener, keys); 28338 return () => { 28339 var _a; 28340 (_a = disposables.get(listener)) == null ? void 0 : _a(); 28341 disposables.delete(listener); 28342 listenerKeys.delete(listener); 28343 set3.delete(listener); 28344 }; 28345 }; 28346 const storeSubscribe = (keys, listener) => sub(keys, listener); 28347 const storeSync = (keys, listener) => { 28348 disposables.set(listener, listener(state, state)); 28349 return sub(keys, listener); 28350 }; 28351 const storeBatch = (keys, listener) => { 28352 disposables.set(listener, listener(state, prevStateBatch)); 28353 return sub(keys, listener, batchListeners); 28354 }; 28355 const storePick = (keys) => createStore(pick(state, keys), finalStore); 28356 const storeOmit = (keys) => createStore(omit(state, keys), finalStore); 28357 const getState = () => state; 28358 const setState = (key2, value, fromStores = false) => { 28359 var _a; 28360 if (!hasOwnProperty(state, key2)) return; 28361 const nextValue = applyState(value, state[key2]); 28362 if (nextValue === state[key2]) return; 28363 if (!fromStores) { 28364 for (const store of stores) { 28365 (_a = store == null ? void 0 : store.setState) == null ? void 0 : _a.call(store, key2, nextValue); 28366 } 28367 } 28368 const prevState = state; 28369 state = { ...state, [key2]: nextValue }; 28370 const thisUpdate = /* @__PURE__ */ Symbol(); 28371 lastUpdate = thisUpdate; 28372 updatedKeys.add(key2); 28373 const run = (listener, prev, uKeys) => { 28374 var _a2; 28375 const keys = listenerKeys.get(listener); 28376 const updated = (k) => uKeys ? uKeys.has(k) : k === key2; 28377 if (!keys || keys.some(updated)) { 28378 (_a2 = disposables.get(listener)) == null ? void 0 : _a2(); 28379 disposables.set(listener, listener(state, prev)); 28380 } 28381 }; 28382 for (const listener of listeners) { 28383 run(listener, prevState); 28384 } 28385 queueMicrotask(() => { 28386 if (lastUpdate !== thisUpdate) return; 28387 const snapshot = state; 28388 for (const listener of batchListeners) { 28389 run(listener, prevStateBatch, updatedKeys); 28390 } 28391 prevStateBatch = snapshot; 28392 updatedKeys.clear(); 28393 }); 28394 }; 28395 const finalStore = { 28396 getState, 28397 setState, 28398 __unstableInternals: { 28399 setup: storeSetup, 28400 init: storeInit, 28401 subscribe: storeSubscribe, 28402 sync: storeSync, 28403 batch: storeBatch, 28404 pick: storePick, 28405 omit: storeOmit 28406 } 28407 }; 28408 return finalStore; 28409 } 28410 function setup(store, ...args) { 28411 if (!store) return; 28412 return getInternal(store, "setup")(...args); 28413 } 28414 function init(store, ...args) { 28415 if (!store) return; 28416 return getInternal(store, "init")(...args); 28417 } 28418 function subscribe(store, ...args) { 28419 if (!store) return; 28420 return getInternal(store, "subscribe")(...args); 28421 } 28422 function sync(store, ...args) { 28423 if (!store) return; 28424 return getInternal(store, "sync")(...args); 28425 } 28426 function batch(store, ...args) { 28427 if (!store) return; 28428 return getInternal(store, "batch")(...args); 28429 } 28430 function omit2(store, ...args) { 28431 if (!store) return; 28432 return getInternal(store, "omit")(...args); 28433 } 28434 function pick2(store, ...args) { 28435 if (!store) return; 28436 return getInternal(store, "pick")(...args); 28437 } 28438 function mergeStore(...stores) { 28439 var _a; 28440 const initialState = {}; 28441 for (const store2 of stores) { 28442 const nextState = (_a = store2 == null ? void 0 : store2.getState) == null ? void 0 : _a.call(store2); 28443 if (nextState) { 28444 Object.assign(initialState, nextState); 28445 } 28446 } 28447 const store = createStore(initialState, ...stores); 28448 return Object.assign({}, ...stores, store); 28449 } 28450 function throwOnConflictingProps(props, store) { 28451 if (false) return; 28452 if (!store) return; 28453 const defaultKeys = Object.entries(props).filter(([key2, value]) => key2.startsWith("default") && value !== void 0).map(([key2]) => { 28454 var _a; 28455 const stateKey = key2.replace("default", ""); 28456 return `${((_a = stateKey[0]) == null ? void 0 : _a.toLowerCase()) || ""}$stateKey.slice(1)}`; 28457 }); 28458 if (!defaultKeys.length) return; 28459 const storeState = store.getState(); 28460 const conflictingProps = defaultKeys.filter( 28461 (key2) => hasOwnProperty(storeState, key2) 28462 ); 28463 if (!conflictingProps.length) return; 28464 throw new Error( 28465 `Passing a store prop in conjunction with a default state is not supported. 28466 28467 const store = useSelectStore(); 28468 <SelectProvider store={store} defaultValue="Apple" /> 28469 ^ ^ 28470 28471 Instead, pass the default state to the topmost store: 28472 28473 const store = useSelectStore({ defaultValue: "Apple" }); 28474 <SelectProvider store={store} /> 28475 28476 See https://github.com/ariakit/ariakit/pull/2745 for more details. 28477 28478 If there's a particular need for this, please submit a feature request at https://github.com/ariakit/ariakit 28479 ` 28480 ); 28481 } 28482 28483 // node_modules/@ariakit/react-core/esm/__chunks/Q5W46E73.js 28484 var React99 = __toESM(require_react(), 1); 28485 var import_shim2 = __toESM(require_shim(), 1); 28486 var { useSyncExternalStore: useSyncExternalStore2 } = import_shim2.default; 28487 var noopSubscribe = () => () => { 28488 }; 28489 function useStoreState(store, keyOrSelector = identity) { 28490 const storeSubscribe = React99.useCallback( 28491 (callback) => { 28492 if (!store) return noopSubscribe(); 28493 return subscribe(store, null, callback); 28494 }, 28495 [store] 28496 ); 28497 const getSnapshot = () => { 28498 const key2 = typeof keyOrSelector === "string" ? keyOrSelector : null; 28499 const selector2 = typeof keyOrSelector === "function" ? keyOrSelector : null; 28500 const state = store == null ? void 0 : store.getState(); 28501 if (selector2) return selector2(state); 28502 if (!state) return; 28503 if (!key2) return; 28504 if (!hasOwnProperty(state, key2)) return; 28505 return state[key2]; 28506 }; 28507 return useSyncExternalStore2(storeSubscribe, getSnapshot, getSnapshot); 28508 } 28509 function useStoreStateObject(store, object) { 28510 const objRef = React99.useRef( 28511 {} 28512 ); 28513 const storeSubscribe = React99.useCallback( 28514 (callback) => { 28515 if (!store) return noopSubscribe(); 28516 return subscribe(store, null, callback); 28517 }, 28518 [store] 28519 ); 28520 const getSnapshot = () => { 28521 const state = store == null ? void 0 : store.getState(); 28522 let updated = false; 28523 const obj = objRef.current; 28524 for (const prop in object) { 28525 const keyOrSelector = object[prop]; 28526 if (typeof keyOrSelector === "function") { 28527 const value = keyOrSelector(state); 28528 if (value !== obj[prop]) { 28529 obj[prop] = value; 28530 updated = true; 28531 } 28532 } 28533 if (typeof keyOrSelector === "string") { 28534 if (!state) continue; 28535 if (!hasOwnProperty(state, keyOrSelector)) continue; 28536 const value = state[keyOrSelector]; 28537 if (value !== obj[prop]) { 28538 obj[prop] = value; 28539 updated = true; 28540 } 28541 } 28542 } 28543 if (updated) { 28544 objRef.current = { ...obj }; 28545 } 28546 return objRef.current; 28547 }; 28548 return useSyncExternalStore2(storeSubscribe, getSnapshot, getSnapshot); 28549 } 28550 function useStoreProps(store, props, key2, setKey) { 28551 const value = hasOwnProperty(props, key2) ? props[key2] : void 0; 28552 const setValue = setKey ? props[setKey] : void 0; 28553 const propsRef = useLiveRef({ value, setValue }); 28554 useSafeLayoutEffect(() => { 28555 return sync(store, [key2], (state, prev) => { 28556 const { value: value2, setValue: setValue2 } = propsRef.current; 28557 if (!setValue2) return; 28558 if (state[key2] === prev[key2]) return; 28559 if (state[key2] === value2) return; 28560 setValue2(state[key2]); 28561 }); 28562 }, [store, key2]); 28563 useSafeLayoutEffect(() => { 28564 if (value === void 0) return; 28565 store.setState(key2, value); 28566 return batch(store, [key2], () => { 28567 if (value === void 0) return; 28568 store.setState(key2, value); 28569 }); 28570 }); 28571 } 28572 function useStore2(createStore2, props) { 28573 const [store, setStore] = React99.useState(() => createStore2(props)); 28574 useSafeLayoutEffect(() => init(store), [store]); 28575 const useState210 = React99.useCallback( 28576 (keyOrSelector) => useStoreState(store, keyOrSelector), 28577 [store] 28578 ); 28579 const memoizedStore = React99.useMemo( 28580 () => ({ ...store, useState: useState210 }), 28581 [store, useState210] 28582 ); 28583 const updateStore = useEvent(() => { 28584 setStore((store2) => createStore2({ ...props, ...store2.getState() })); 28585 }); 28586 return [memoizedStore, updateStore]; 28587 } 28588 28589 // node_modules/@ariakit/react-core/esm/__chunks/WZWDIE3S.js 28590 var import_react32 = __toESM(require_react(), 1); 28591 var import_jsx_runtime142 = __toESM(require_jsx_runtime(), 1); 28592 var TagName4 = "button"; 28593 function isEditableElement(element) { 28594 if (isTextbox(element)) return true; 28595 return element.tagName === "INPUT" && !isButton(element); 28596 } 28597 function getNextPageOffset(scrollingElement, pageUp = false) { 28598 const height = scrollingElement.clientHeight; 28599 const { top } = scrollingElement.getBoundingClientRect(); 28600 const pageSize = Math.max(height * 0.875, height - 40) * 1.5; 28601 const pageOffset = pageUp ? height - pageSize + top : pageSize + top; 28602 if (scrollingElement.tagName === "HTML") { 28603 return pageOffset + scrollingElement.scrollTop; 28604 } 28605 return pageOffset; 28606 } 28607 function getItemOffset(itemElement, pageUp = false) { 28608 const { top } = itemElement.getBoundingClientRect(); 28609 if (pageUp) { 28610 return top + itemElement.clientHeight; 28611 } 28612 return top; 28613 } 28614 function findNextPageItemId(element, store, next, pageUp = false) { 28615 var _a; 28616 if (!store) return; 28617 if (!next) return; 28618 const { renderedItems } = store.getState(); 28619 const scrollingElement = getScrollingElement(element); 28620 if (!scrollingElement) return; 28621 const nextPageOffset = getNextPageOffset(scrollingElement, pageUp); 28622 let id; 28623 let prevDifference; 28624 for (let i2 = 0; i2 < renderedItems.length; i2 += 1) { 28625 const previousId = id; 28626 id = next(i2); 28627 if (!id) break; 28628 if (id === previousId) continue; 28629 const itemElement = (_a = getEnabledItem(store, id)) == null ? void 0 : _a.element; 28630 if (!itemElement) continue; 28631 const itemOffset = getItemOffset(itemElement, pageUp); 28632 const difference = itemOffset - nextPageOffset; 28633 const absDifference = Math.abs(difference); 28634 if (pageUp && difference <= 0 || !pageUp && difference >= 0) { 28635 if (prevDifference !== void 0 && prevDifference < absDifference) { 28636 id = previousId; 28637 } 28638 break; 28639 } 28640 prevDifference = absDifference; 28641 } 28642 return id; 28643 } 28644 function targetIsAnotherItem(event, store) { 28645 if (isSelfTarget(event)) return false; 28646 return isItem(store, event.target); 28647 } 28648 var useCompositeItem = createHook( 28649 function useCompositeItem2({ 28650 store, 28651 rowId: rowIdProp, 28652 preventScrollOnKeyDown = false, 28653 moveOnKeyPress = true, 28654 tabbable: tabbable4 = false, 28655 getItem: getItemProp, 28656 "aria-setsize": ariaSetSizeProp, 28657 "aria-posinset": ariaPosInSetProp, 28658 ...props 28659 }) { 28660 const context = useCompositeContext(); 28661 store = store || context; 28662 const id = useId7(props.id); 28663 const ref = (0, import_react32.useRef)(null); 28664 const row = (0, import_react32.useContext)(CompositeRowContext); 28665 const disabled2 = disabledFromProps(props); 28666 const trulyDisabled = disabled2 && !props.accessibleWhenDisabled; 28667 const { 28668 rowId, 28669 baseElement, 28670 isActiveItem, 28671 ariaSetSize, 28672 ariaPosInSet, 28673 isTabbable: isTabbable2 28674 } = useStoreStateObject(store, { 28675 rowId(state) { 28676 if (rowIdProp) return rowIdProp; 28677 if (!state) return; 28678 if (!(row == null ? void 0 : row.baseElement)) return; 28679 if (row.baseElement !== state.baseElement) return; 28680 return row.id; 28681 }, 28682 baseElement(state) { 28683 return (state == null ? void 0 : state.baseElement) || void 0; 28684 }, 28685 isActiveItem(state) { 28686 return !!state && state.activeId === id; 28687 }, 28688 ariaSetSize(state) { 28689 if (ariaSetSizeProp != null) return ariaSetSizeProp; 28690 if (!state) return; 28691 if (!(row == null ? void 0 : row.ariaSetSize)) return; 28692 if (row.baseElement !== state.baseElement) return; 28693 return row.ariaSetSize; 28694 }, 28695 ariaPosInSet(state) { 28696 if (ariaPosInSetProp != null) return ariaPosInSetProp; 28697 if (!state) return; 28698 if (!(row == null ? void 0 : row.ariaPosInSet)) return; 28699 if (row.baseElement !== state.baseElement) return; 28700 const itemsInRow = state.renderedItems.filter( 28701 (item) => item.rowId === rowId 28702 ); 28703 return row.ariaPosInSet + itemsInRow.findIndex((item) => item.id === id); 28704 }, 28705 isTabbable(state) { 28706 if (!(state == null ? void 0 : state.renderedItems.length)) return true; 28707 if (state.virtualFocus) return false; 28708 if (tabbable4) return true; 28709 if (state.activeId === null) return false; 28710 const item = store == null ? void 0 : store.item(state.activeId); 28711 if (item == null ? void 0 : item.disabled) return true; 28712 if (!(item == null ? void 0 : item.element)) return true; 28713 return state.activeId === id; 28714 } 28715 }); 28716 const getItem = (0, import_react32.useCallback)( 28717 (item) => { 28718 var _a; 28719 const nextItem = { 28720 ...item, 28721 id: id || item.id, 28722 rowId, 28723 disabled: !!trulyDisabled, 28724 children: (_a = item.element) == null ? void 0 : _a.textContent 28725 }; 28726 if (getItemProp) { 28727 return getItemProp(nextItem); 28728 } 28729 return nextItem; 28730 }, 28731 [id, rowId, trulyDisabled, getItemProp] 28732 ); 28733 const onFocusProp = props.onFocus; 28734 const hasFocusedComposite = (0, import_react32.useRef)(false); 28735 const onFocus = useEvent((event) => { 28736 onFocusProp == null ? void 0 : onFocusProp(event); 28737 if (event.defaultPrevented) return; 28738 if (isPortalEvent(event)) return; 28739 if (!id) return; 28740 if (!store) return; 28741 if (targetIsAnotherItem(event, store)) return; 28742 const { virtualFocus, baseElement: baseElement2 } = store.getState(); 28743 store.setActiveId(id); 28744 if (isTextbox(event.currentTarget)) { 28745 selectTextField(event.currentTarget); 28746 } 28747 if (!virtualFocus) return; 28748 if (!isSelfTarget(event)) return; 28749 if (isEditableElement(event.currentTarget)) return; 28750 if (!(baseElement2 == null ? void 0 : baseElement2.isConnected)) return; 28751 if (isSafari2() && event.currentTarget.hasAttribute("data-autofocus")) { 28752 event.currentTarget.scrollIntoView({ 28753 block: "nearest", 28754 inline: "nearest" 28755 }); 28756 } 28757 hasFocusedComposite.current = true; 28758 const fromComposite = event.relatedTarget === baseElement2 || isItem(store, event.relatedTarget); 28759 if (fromComposite) { 28760 focusSilently(baseElement2); 28761 } else { 28762 baseElement2.focus(); 28763 } 28764 }); 28765 const onBlurCaptureProp = props.onBlurCapture; 28766 const onBlurCapture = useEvent((event) => { 28767 onBlurCaptureProp == null ? void 0 : onBlurCaptureProp(event); 28768 if (event.defaultPrevented) return; 28769 const state = store == null ? void 0 : store.getState(); 28770 if ((state == null ? void 0 : state.virtualFocus) && hasFocusedComposite.current) { 28771 hasFocusedComposite.current = false; 28772 event.preventDefault(); 28773 event.stopPropagation(); 28774 } 28775 }); 28776 const onKeyDownProp = props.onKeyDown; 28777 const preventScrollOnKeyDownProp = useBooleanEvent(preventScrollOnKeyDown); 28778 const moveOnKeyPressProp = useBooleanEvent(moveOnKeyPress); 28779 const onKeyDown = useEvent((event) => { 28780 onKeyDownProp == null ? void 0 : onKeyDownProp(event); 28781 if (event.defaultPrevented) return; 28782 if (!isSelfTarget(event)) return; 28783 if (!store) return; 28784 const { currentTarget } = event; 28785 const state = store.getState(); 28786 const item = store.item(id); 28787 const isGrid2 = !!(item == null ? void 0 : item.rowId); 28788 const isVertical = state.orientation !== "horizontal"; 28789 const isHorizontal = state.orientation !== "vertical"; 28790 const canHomeEnd = () => { 28791 if (isGrid2) return true; 28792 if (isHorizontal) return true; 28793 if (!state.baseElement) return true; 28794 if (!isTextField(state.baseElement)) return true; 28795 return false; 28796 }; 28797 const keyMap = { 28798 ArrowUp: (isGrid2 || isVertical) && store.up, 28799 ArrowRight: (isGrid2 || isHorizontal) && store.next, 28800 ArrowDown: (isGrid2 || isVertical) && store.down, 28801 ArrowLeft: (isGrid2 || isHorizontal) && store.previous, 28802 Home: () => { 28803 if (!canHomeEnd()) return; 28804 if (!isGrid2 || event.ctrlKey) { 28805 return store == null ? void 0 : store.first(); 28806 } 28807 return store == null ? void 0 : store.previous(-1); 28808 }, 28809 End: () => { 28810 if (!canHomeEnd()) return; 28811 if (!isGrid2 || event.ctrlKey) { 28812 return store == null ? void 0 : store.last(); 28813 } 28814 return store == null ? void 0 : store.next(-1); 28815 }, 28816 PageUp: () => { 28817 return findNextPageItemId(currentTarget, store, store == null ? void 0 : store.up, true); 28818 }, 28819 PageDown: () => { 28820 return findNextPageItemId(currentTarget, store, store == null ? void 0 : store.down); 28821 } 28822 }; 28823 const action = keyMap[event.key]; 28824 if (action) { 28825 if (isTextbox(currentTarget)) { 28826 const selection = getTextboxSelection(currentTarget); 28827 const isLeft = isHorizontal && event.key === "ArrowLeft"; 28828 const isRight = isHorizontal && event.key === "ArrowRight"; 28829 const isUp = isVertical && event.key === "ArrowUp"; 28830 const isDown = isVertical && event.key === "ArrowDown"; 28831 if (isRight || isDown) { 28832 const { length: valueLength } = getTextboxValue(currentTarget); 28833 if (selection.end !== valueLength) return; 28834 } else if ((isLeft || isUp) && selection.start !== 0) return; 28835 } 28836 const nextId = action(); 28837 if (preventScrollOnKeyDownProp(event) || nextId !== void 0) { 28838 if (!moveOnKeyPressProp(event)) return; 28839 event.preventDefault(); 28840 store.move(nextId); 28841 } 28842 } 28843 }); 28844 const providerValue = (0, import_react32.useMemo)( 28845 () => ({ id, baseElement }), 28846 [id, baseElement] 28847 ); 28848 props = useWrapElement( 28849 props, 28850 (element) => /* @__PURE__ */ (0, import_jsx_runtime142.jsx)(CompositeItemContext.Provider, { value: providerValue, children: element }), 28851 [providerValue] 28852 ); 28853 props = { 28854 id, 28855 "data-active-item": isActiveItem || void 0, 28856 ...props, 28857 ref: useMergeRefs8(ref, props.ref), 28858 tabIndex: isTabbable2 ? props.tabIndex : -1, 28859 onFocus, 28860 onBlurCapture, 28861 onKeyDown 28862 }; 28863 props = useCommand(props); 28864 props = useCollectionItem({ 28865 store, 28866 ...props, 28867 getItem, 28868 shouldRegisterItem: id ? props.shouldRegisterItem : false 28869 }); 28870 return removeUndefinedValues({ 28871 ...props, 28872 "aria-setsize": ariaSetSize, 28873 "aria-posinset": ariaPosInSet 28874 }); 28875 } 28876 ); 28877 var CompositeItem = memo22( 28878 forwardRef210(function CompositeItem2(props) { 28879 const htmlProps = useCompositeItem(props); 28880 return createElement3(TagName4, htmlProps); 28881 }) 28882 ); 28883 28884 // node_modules/@ariakit/core/esm/__chunks/7PRQYBBV.js 28885 function toArray(arg) { 28886 if (Array.isArray(arg)) { 28887 return arg; 28888 } 28889 return typeof arg !== "undefined" ? [arg] : []; 28890 } 28891 function flatten2DArray(array) { 28892 const flattened = []; 28893 for (const row of array) { 28894 flattened.push(...row); 28895 } 28896 return flattened; 28897 } 28898 function reverseArray(array) { 28899 return array.slice().reverse(); 28900 } 28901 28902 // node_modules/@ariakit/react-core/esm/__chunks/ZMWF7ASR.js 28903 var import_react33 = __toESM(require_react(), 1); 28904 var import_jsx_runtime143 = __toESM(require_jsx_runtime(), 1); 28905 var TagName5 = "div"; 28906 function isGrid(items) { 28907 return items.some((item) => !!item.rowId); 28908 } 28909 function isPrintableKey(event) { 28910 const target = event.target; 28911 if (target && !isTextField(target)) return false; 28912 return event.key.length === 1 && !event.ctrlKey && !event.metaKey; 28913 } 28914 function isModifierKey(event) { 28915 return event.key === "Shift" || event.key === "Control" || event.key === "Alt" || event.key === "Meta"; 28916 } 28917 function useKeyboardEventProxy(store, onKeyboardEvent, previousElementRef) { 28918 return useEvent((event) => { 28919 var _a; 28920 onKeyboardEvent == null ? void 0 : onKeyboardEvent(event); 28921 if (event.defaultPrevented) return; 28922 if (event.isPropagationStopped()) return; 28923 if (!isSelfTarget(event)) return; 28924 if (isModifierKey(event)) return; 28925 if (isPrintableKey(event)) return; 28926 const state = store.getState(); 28927 const activeElement2 = (_a = getEnabledItem(store, state.activeId)) == null ? void 0 : _a.element; 28928 if (!activeElement2) return; 28929 const { view, ...eventInit } = event; 28930 const previousElement = previousElementRef == null ? void 0 : previousElementRef.current; 28931 if (activeElement2 !== previousElement) { 28932 activeElement2.focus(); 28933 } 28934 if (!fireKeyboardEvent(activeElement2, event.type, eventInit)) { 28935 event.preventDefault(); 28936 } 28937 if (event.currentTarget.contains(activeElement2)) { 28938 event.stopPropagation(); 28939 } 28940 }); 28941 } 28942 function findFirstEnabledItemInTheLastRow(items) { 28943 return findFirstEnabledItem( 28944 flatten2DArray(reverseArray(groupItemsByRows(items))) 28945 ); 28946 } 28947 function useScheduleFocus(store) { 28948 const [scheduled, setScheduled] = (0, import_react33.useState)(false); 28949 const schedule = (0, import_react33.useCallback)(() => setScheduled(true), []); 28950 const activeItem = store.useState( 28951 (state) => getEnabledItem(store, state.activeId) 28952 ); 28953 (0, import_react33.useEffect)(() => { 28954 const activeElement2 = activeItem == null ? void 0 : activeItem.element; 28955 if (!scheduled) return; 28956 if (!activeElement2) return; 28957 setScheduled(false); 28958 activeElement2.focus({ preventScroll: true }); 28959 }, [activeItem, scheduled]); 28960 return schedule; 28961 } 28962 var useComposite = createHook( 28963 function useComposite2({ 28964 store, 28965 composite = true, 28966 focusOnMove = composite, 28967 moveOnKeyPress = true, 28968 ...props 28969 }) { 28970 const context = useCompositeProviderContext(); 28971 store = store || context; 28972 invariant( 28973 store, 28974 "Composite must receive a `store` prop or be wrapped in a CompositeProvider component." 28975 ); 28976 const ref = (0, import_react33.useRef)(null); 28977 const previousElementRef = (0, import_react33.useRef)(null); 28978 const scheduleFocus = useScheduleFocus(store); 28979 const moves = store.useState("moves"); 28980 const [, setBaseElement] = useTransactionState( 28981 composite ? store.setBaseElement : null 28982 ); 28983 (0, import_react33.useEffect)(() => { 28984 var _a; 28985 if (!store) return; 28986 if (!moves) return; 28987 if (!composite) return; 28988 if (!focusOnMove) return; 28989 const { activeId: activeId2 } = store.getState(); 28990 const itemElement = (_a = getEnabledItem(store, activeId2)) == null ? void 0 : _a.element; 28991 if (!itemElement) return; 28992 focusIntoView(itemElement); 28993 }, [store, moves, composite, focusOnMove]); 28994 useSafeLayoutEffect(() => { 28995 if (!store) return; 28996 if (!moves) return; 28997 if (!composite) return; 28998 const { baseElement, activeId: activeId2 } = store.getState(); 28999 const isSelfAcive = activeId2 === null; 29000 if (!isSelfAcive) return; 29001 if (!baseElement) return; 29002 const previousElement = previousElementRef.current; 29003 previousElementRef.current = null; 29004 if (previousElement) { 29005 fireBlurEvent(previousElement, { relatedTarget: baseElement }); 29006 } 29007 if (!hasFocus(baseElement)) { 29008 baseElement.focus(); 29009 } 29010 }, [store, moves, composite]); 29011 const activeId = store.useState("activeId"); 29012 const virtualFocus = store.useState("virtualFocus"); 29013 useSafeLayoutEffect(() => { 29014 var _a; 29015 if (!store) return; 29016 if (!composite) return; 29017 if (!virtualFocus) return; 29018 const previousElement = previousElementRef.current; 29019 previousElementRef.current = null; 29020 if (!previousElement) return; 29021 const activeElement2 = (_a = getEnabledItem(store, activeId)) == null ? void 0 : _a.element; 29022 const relatedTarget = activeElement2 || getActiveElement(previousElement); 29023 if (relatedTarget === previousElement) return; 29024 fireBlurEvent(previousElement, { relatedTarget }); 29025 }, [store, activeId, virtualFocus, composite]); 29026 const onKeyDownCapture = useKeyboardEventProxy( 29027 store, 29028 props.onKeyDownCapture, 29029 previousElementRef 29030 ); 29031 const onKeyUpCapture = useKeyboardEventProxy( 29032 store, 29033 props.onKeyUpCapture, 29034 previousElementRef 29035 ); 29036 const onFocusCaptureProp = props.onFocusCapture; 29037 const onFocusCapture = useEvent((event) => { 29038 onFocusCaptureProp == null ? void 0 : onFocusCaptureProp(event); 29039 if (event.defaultPrevented) return; 29040 if (!store) return; 29041 const { virtualFocus: virtualFocus2 } = store.getState(); 29042 if (!virtualFocus2) return; 29043 const previousActiveElement = event.relatedTarget; 29044 const isSilentlyFocused = silentlyFocused(event.currentTarget); 29045 if (isSelfTarget(event) && isSilentlyFocused) { 29046 event.stopPropagation(); 29047 previousElementRef.current = previousActiveElement; 29048 } 29049 }); 29050 const onFocusProp = props.onFocus; 29051 const onFocus = useEvent((event) => { 29052 onFocusProp == null ? void 0 : onFocusProp(event); 29053 if (event.defaultPrevented) return; 29054 if (!composite) return; 29055 if (!store) return; 29056 const { relatedTarget } = event; 29057 const { virtualFocus: virtualFocus2 } = store.getState(); 29058 if (virtualFocus2) { 29059 if (isSelfTarget(event) && !isItem(store, relatedTarget)) { 29060 queueMicrotask(scheduleFocus); 29061 } 29062 } else if (isSelfTarget(event)) { 29063 store.setActiveId(null); 29064 } 29065 }); 29066 const onBlurCaptureProp = props.onBlurCapture; 29067 const onBlurCapture = useEvent((event) => { 29068 var _a; 29069 onBlurCaptureProp == null ? void 0 : onBlurCaptureProp(event); 29070 if (event.defaultPrevented) return; 29071 if (!store) return; 29072 const { virtualFocus: virtualFocus2, activeId: activeId2 } = store.getState(); 29073 if (!virtualFocus2) return; 29074 const activeElement2 = (_a = getEnabledItem(store, activeId2)) == null ? void 0 : _a.element; 29075 const nextActiveElement = event.relatedTarget; 29076 const nextActiveElementIsItem = isItem(store, nextActiveElement); 29077 const previousElement = previousElementRef.current; 29078 previousElementRef.current = null; 29079 if (isSelfTarget(event) && nextActiveElementIsItem) { 29080 if (nextActiveElement === activeElement2) { 29081 if (previousElement && previousElement !== nextActiveElement) { 29082 fireBlurEvent(previousElement, event); 29083 } 29084 } else if (activeElement2) { 29085 fireBlurEvent(activeElement2, event); 29086 } else if (previousElement) { 29087 fireBlurEvent(previousElement, event); 29088 } 29089 event.stopPropagation(); 29090 } else { 29091 const targetIsItem = isItem(store, event.target); 29092 if (!targetIsItem && activeElement2) { 29093 fireBlurEvent(activeElement2, event); 29094 } 29095 } 29096 }); 29097 const onKeyDownProp = props.onKeyDown; 29098 const moveOnKeyPressProp = useBooleanEvent(moveOnKeyPress); 29099 const onKeyDown = useEvent((event) => { 29100 var _a; 29101 onKeyDownProp == null ? void 0 : onKeyDownProp(event); 29102 if (event.nativeEvent.isComposing) return; 29103 if (event.defaultPrevented) return; 29104 if (!store) return; 29105 if (!isSelfTarget(event)) return; 29106 const { orientation, renderedItems, activeId: activeId2 } = store.getState(); 29107 const activeItem = getEnabledItem(store, activeId2); 29108 if ((_a = activeItem == null ? void 0 : activeItem.element) == null ? void 0 : _a.isConnected) return; 29109 const isVertical = orientation !== "horizontal"; 29110 const isHorizontal = orientation !== "vertical"; 29111 const grid = isGrid(renderedItems); 29112 const isHorizontalKey = event.key === "ArrowLeft" || event.key === "ArrowRight" || event.key === "Home" || event.key === "End"; 29113 if (isHorizontalKey && isTextField(event.currentTarget)) return; 29114 const up = () => { 29115 if (grid) { 29116 const item = findFirstEnabledItemInTheLastRow(renderedItems); 29117 return item == null ? void 0 : item.id; 29118 } 29119 return store == null ? void 0 : store.last(); 29120 }; 29121 const keyMap = { 29122 ArrowUp: (grid || isVertical) && up, 29123 ArrowRight: (grid || isHorizontal) && store.first, 29124 ArrowDown: (grid || isVertical) && store.first, 29125 ArrowLeft: (grid || isHorizontal) && store.last, 29126 Home: store.first, 29127 End: store.last, 29128 PageUp: store.first, 29129 PageDown: store.last 29130 }; 29131 const action = keyMap[event.key]; 29132 if (action) { 29133 const id = action(); 29134 if (id !== void 0) { 29135 if (!moveOnKeyPressProp(event)) return; 29136 event.preventDefault(); 29137 store.move(id); 29138 } 29139 } 29140 }); 29141 props = useWrapElement( 29142 props, 29143 (element) => /* @__PURE__ */ (0, import_jsx_runtime143.jsx)(CompositeContextProvider, { value: store, children: element }), 29144 [store] 29145 ); 29146 const activeDescendant = store.useState((state) => { 29147 var _a; 29148 if (!store) return; 29149 if (!composite) return; 29150 if (!state.virtualFocus) return; 29151 return (_a = getEnabledItem(store, state.activeId)) == null ? void 0 : _a.id; 29152 }); 29153 props = { 29154 "aria-activedescendant": activeDescendant, 29155 ...props, 29156 ref: useMergeRefs8(ref, setBaseElement, props.ref), 29157 onKeyDownCapture, 29158 onKeyUpCapture, 29159 onFocusCapture, 29160 onFocus, 29161 onBlurCapture, 29162 onKeyDown 29163 }; 29164 const focusable2 = store.useState( 29165 (state) => composite && (state.virtualFocus || state.activeId === null) 29166 ); 29167 props = useFocusable({ focusable: focusable2, ...props }); 29168 return props; 29169 } 29170 ); 29171 var Composite5 = forwardRef210(function Composite22(props) { 29172 const htmlProps = useComposite(props); 29173 return createElement3(TagName5, htmlProps); 29174 }); 29175 29176 // node_modules/@ariakit/react-core/esm/__chunks/LVDQFHCH.js 29177 var ctx3 = createStoreContext(); 29178 var useDisclosureContext = ctx3.useContext; 29179 var useDisclosureScopedContext = ctx3.useScopedContext; 29180 var useDisclosureProviderContext = ctx3.useProviderContext; 29181 var DisclosureContextProvider = ctx3.ContextProvider; 29182 var DisclosureScopedContextProvider = ctx3.ScopedContextProvider; 29183 29184 // node_modules/@ariakit/react-core/esm/__chunks/A62MDFCW.js 29185 var import_react34 = __toESM(require_react(), 1); 29186 var ctx4 = createStoreContext( 29187 [DisclosureContextProvider], 29188 [DisclosureScopedContextProvider] 29189 ); 29190 var useDialogContext = ctx4.useContext; 29191 var useDialogScopedContext = ctx4.useScopedContext; 29192 var useDialogProviderContext = ctx4.useProviderContext; 29193 var DialogContextProvider = ctx4.ContextProvider; 29194 var DialogScopedContextProvider = ctx4.ScopedContextProvider; 29195 var DialogHeadingContext = (0, import_react34.createContext)(void 0); 29196 var DialogDescriptionContext = (0, import_react34.createContext)(void 0); 29197 29198 // node_modules/@ariakit/react-core/esm/__chunks/6B3RXHKP.js 29199 var import_react35 = __toESM(require_react(), 1); 29200 var import_react_dom4 = __toESM(require_react_dom(), 1); 29201 var import_jsx_runtime144 = __toESM(require_jsx_runtime(), 1); 29202 var TagName6 = "div"; 29203 function afterTimeout(timeoutMs, cb) { 29204 const timeoutId = setTimeout(cb, timeoutMs); 29205 return () => clearTimeout(timeoutId); 29206 } 29207 function afterPaint2(cb) { 29208 let raf = requestAnimationFrame(() => { 29209 raf = requestAnimationFrame(cb); 29210 }); 29211 return () => cancelAnimationFrame(raf); 29212 } 29213 function parseCSSTime(...times) { 29214 return times.join(", ").split(", ").reduce((longestTime, currentTimeString) => { 29215 const multiplier = currentTimeString.endsWith("ms") ? 1 : 1e3; 29216 const currentTime = Number.parseFloat(currentTimeString || "0s") * multiplier; 29217 if (currentTime > longestTime) return currentTime; 29218 return longestTime; 29219 }, 0); 29220 } 29221 function isHidden3(mounted, hidden, alwaysVisible) { 29222 return !alwaysVisible && hidden !== false && (!mounted || !!hidden); 29223 } 29224 var useDisclosureContent = createHook(function useDisclosureContent2({ store, alwaysVisible, ...props }) { 29225 const context = useDisclosureProviderContext(); 29226 store = store || context; 29227 invariant( 29228 store, 29229 "DisclosureContent must receive a `store` prop or be wrapped in a DisclosureProvider component." 29230 ); 29231 const ref = (0, import_react35.useRef)(null); 29232 const id = useId7(props.id); 29233 const [transition, setTransition] = (0, import_react35.useState)(null); 29234 const open = store.useState("open"); 29235 const mounted = store.useState("mounted"); 29236 const animated = store.useState("animated"); 29237 const contentElement = store.useState("contentElement"); 29238 const otherElement = useStoreState(store.disclosure, "contentElement"); 29239 useSafeLayoutEffect(() => { 29240 if (!ref.current) return; 29241 store == null ? void 0 : store.setContentElement(ref.current); 29242 }, [store]); 29243 useSafeLayoutEffect(() => { 29244 let previousAnimated; 29245 store == null ? void 0 : store.setState("animated", (animated2) => { 29246 previousAnimated = animated2; 29247 return true; 29248 }); 29249 return () => { 29250 if (previousAnimated === void 0) return; 29251 store == null ? void 0 : store.setState("animated", previousAnimated); 29252 }; 29253 }, [store]); 29254 useSafeLayoutEffect(() => { 29255 if (!animated) return; 29256 if (!(contentElement == null ? void 0 : contentElement.isConnected)) { 29257 setTransition(null); 29258 return; 29259 } 29260 return afterPaint2(() => { 29261 setTransition(open ? "enter" : mounted ? "leave" : null); 29262 }); 29263 }, [animated, contentElement, open, mounted]); 29264 useSafeLayoutEffect(() => { 29265 if (!store) return; 29266 if (!animated) return; 29267 if (!transition) return; 29268 if (!contentElement) return; 29269 const stopAnimation = () => store == null ? void 0 : store.setState("animating", false); 29270 const stopAnimationSync = () => (0, import_react_dom4.flushSync)(stopAnimation); 29271 if (transition === "leave" && open) return; 29272 if (transition === "enter" && !open) return; 29273 if (typeof animated === "number") { 29274 const timeout2 = animated; 29275 return afterTimeout(timeout2, stopAnimationSync); 29276 } 29277 const { 29278 transitionDuration, 29279 animationDuration, 29280 transitionDelay, 29281 animationDelay 29282 } = getComputedStyle(contentElement); 29283 const { 29284 transitionDuration: transitionDuration2 = "0", 29285 animationDuration: animationDuration2 = "0", 29286 transitionDelay: transitionDelay2 = "0", 29287 animationDelay: animationDelay2 = "0" 29288 } = otherElement ? getComputedStyle(otherElement) : {}; 29289 const delay = parseCSSTime( 29290 transitionDelay, 29291 animationDelay, 29292 transitionDelay2, 29293 animationDelay2 29294 ); 29295 const duration = parseCSSTime( 29296 transitionDuration, 29297 animationDuration, 29298 transitionDuration2, 29299 animationDuration2 29300 ); 29301 const timeout = delay + duration; 29302 if (!timeout) { 29303 if (transition === "enter") { 29304 store.setState("animated", false); 29305 } 29306 stopAnimation(); 29307 return; 29308 } 29309 const frameRate = 1e3 / 60; 29310 const maxTimeout = Math.max(timeout - frameRate, 0); 29311 return afterTimeout(maxTimeout, stopAnimationSync); 29312 }, [store, animated, contentElement, otherElement, open, transition]); 29313 props = useWrapElement( 29314 props, 29315 (element) => /* @__PURE__ */ (0, import_jsx_runtime144.jsx)(DialogScopedContextProvider, { value: store, children: element }), 29316 [store] 29317 ); 29318 const hidden = isHidden3(mounted, props.hidden, alwaysVisible); 29319 const styleProp = props.style; 29320 const style = (0, import_react35.useMemo)(() => { 29321 if (hidden) { 29322 return { ...styleProp, display: "none" }; 29323 } 29324 return styleProp; 29325 }, [hidden, styleProp]); 29326 props = { 29327 id, 29328 "data-open": open || void 0, 29329 "data-enter": transition === "enter" || void 0, 29330 "data-leave": transition === "leave" || void 0, 29331 hidden, 29332 ...props, 29333 ref: useMergeRefs8(id ? store.setContentElement : null, ref, props.ref), 29334 style 29335 }; 29336 return removeUndefinedValues(props); 29337 }); 29338 var DisclosureContentImpl = forwardRef210(function DisclosureContentImpl2(props) { 29339 const htmlProps = useDisclosureContent(props); 29340 return createElement3(TagName6, htmlProps); 29341 }); 29342 var DisclosureContent = forwardRef210(function DisclosureContent2({ 29343 unmountOnHide, 29344 ...props 29345 }) { 29346 const context = useDisclosureProviderContext(); 29347 const store = props.store || context; 29348 const mounted = useStoreState( 29349 store, 29350 (state) => !unmountOnHide || (state == null ? void 0 : state.mounted) 29351 ); 29352 if (mounted === false) return null; 29353 return /* @__PURE__ */ (0, import_jsx_runtime144.jsx)(DisclosureContentImpl, { ...props }); 29354 }); 29355 29356 // node_modules/@ariakit/core/esm/__chunks/75BJEVSH.js 29357 function createDisclosureStore(props = {}) { 29358 const store = mergeStore( 29359 props.store, 29360 omit2(props.disclosure, ["contentElement", "disclosureElement"]) 29361 ); 29362 throwOnConflictingProps(props, store); 29363 const syncState = store == null ? void 0 : store.getState(); 29364 const open = defaultValue( 29365 props.open, 29366 syncState == null ? void 0 : syncState.open, 29367 props.defaultOpen, 29368 false 29369 ); 29370 const animated = defaultValue(props.animated, syncState == null ? void 0 : syncState.animated, false); 29371 const initialState = { 29372 open, 29373 animated, 29374 animating: !!animated && open, 29375 mounted: open, 29376 contentElement: defaultValue(syncState == null ? void 0 : syncState.contentElement, null), 29377 disclosureElement: defaultValue(syncState == null ? void 0 : syncState.disclosureElement, null) 29378 }; 29379 const disclosure = createStore(initialState, store); 29380 setup( 29381 disclosure, 29382 () => sync(disclosure, ["animated", "animating"], (state) => { 29383 if (state.animated) return; 29384 disclosure.setState("animating", false); 29385 }) 29386 ); 29387 setup( 29388 disclosure, 29389 () => subscribe(disclosure, ["open"], () => { 29390 if (!disclosure.getState().animated) return; 29391 disclosure.setState("animating", true); 29392 }) 29393 ); 29394 setup( 29395 disclosure, 29396 () => sync(disclosure, ["open", "animating"], (state) => { 29397 disclosure.setState("mounted", state.open || state.animating); 29398 }) 29399 ); 29400 return { 29401 ...disclosure, 29402 disclosure: props.disclosure, 29403 setOpen: (value) => disclosure.setState("open", value), 29404 show: () => disclosure.setState("open", true), 29405 hide: () => disclosure.setState("open", false), 29406 toggle: () => disclosure.setState("open", (open2) => !open2), 29407 stopAnimation: () => disclosure.setState("animating", false), 29408 setContentElement: (value) => disclosure.setState("contentElement", value), 29409 setDisclosureElement: (value) => disclosure.setState("disclosureElement", value) 29410 }; 29411 } 29412 29413 // node_modules/@ariakit/react-core/esm/__chunks/WLZ6H5FH.js 29414 function useDisclosureStoreProps(store, update2, props) { 29415 useUpdateEffect(update2, [props.store, props.disclosure]); 29416 useStoreProps(store, props, "open", "setOpen"); 29417 useStoreProps(store, props, "mounted", "setMounted"); 29418 useStoreProps(store, props, "animated"); 29419 return Object.assign(store, { disclosure: props.disclosure }); 29420 } 29421 29422 // node_modules/@ariakit/react-core/esm/__chunks/JMU4N4M5.js 29423 var ctx5 = createStoreContext( 29424 [DialogContextProvider], 29425 [DialogScopedContextProvider] 29426 ); 29427 var usePopoverContext = ctx5.useContext; 29428 var usePopoverScopedContext = ctx5.useScopedContext; 29429 var usePopoverProviderContext = ctx5.useProviderContext; 29430 var PopoverContextProvider = ctx5.ContextProvider; 29431 var PopoverScopedContextProvider = ctx5.ScopedContextProvider; 29432 29433 // node_modules/@ariakit/core/esm/__chunks/N5XGANPW.js 29434 function getCommonParent(items) { 29435 var _a; 29436 const firstItem = items.find((item) => !!item.element); 29437 const lastItem = [...items].reverse().find((item) => !!item.element); 29438 let parentElement = (_a = firstItem == null ? void 0 : firstItem.element) == null ? void 0 : _a.parentElement; 29439 while (parentElement && (lastItem == null ? void 0 : lastItem.element)) { 29440 const parent = parentElement; 29441 if (lastItem && parent.contains(lastItem.element)) { 29442 return parentElement; 29443 } 29444 parentElement = parentElement.parentElement; 29445 } 29446 return getDocument(parentElement).body; 29447 } 29448 function getPrivateStore(store) { 29449 return store == null ? void 0 : store.__unstablePrivateStore; 29450 } 29451 function createCollectionStore(props = {}) { 29452 var _a; 29453 throwOnConflictingProps(props, props.store); 29454 const syncState = (_a = props.store) == null ? void 0 : _a.getState(); 29455 const items = defaultValue( 29456 props.items, 29457 syncState == null ? void 0 : syncState.items, 29458 props.defaultItems, 29459 [] 29460 ); 29461 const itemsMap = new Map(items.map((item) => [item.id, item])); 29462 const initialState = { 29463 items, 29464 renderedItems: defaultValue(syncState == null ? void 0 : syncState.renderedItems, []) 29465 }; 29466 const syncPrivateStore = getPrivateStore(props.store); 29467 const privateStore = createStore( 29468 { items, renderedItems: initialState.renderedItems }, 29469 syncPrivateStore 29470 ); 29471 const collection = createStore(initialState, props.store); 29472 const sortItems = (renderedItems) => { 29473 const sortedItems = sortBasedOnDOMPosition(renderedItems, (i2) => i2.element); 29474 privateStore.setState("renderedItems", sortedItems); 29475 collection.setState("renderedItems", sortedItems); 29476 }; 29477 setup(collection, () => init(privateStore)); 29478 setup(privateStore, () => { 29479 return batch(privateStore, ["items"], (state) => { 29480 collection.setState("items", state.items); 29481 }); 29482 }); 29483 setup(privateStore, () => { 29484 return batch(privateStore, ["renderedItems"], (state) => { 29485 let firstRun = true; 29486 let raf = requestAnimationFrame(() => { 29487 const { renderedItems } = collection.getState(); 29488 if (state.renderedItems === renderedItems) return; 29489 sortItems(state.renderedItems); 29490 }); 29491 if (typeof IntersectionObserver !== "function") { 29492 return () => cancelAnimationFrame(raf); 29493 } 29494 const ioCallback = () => { 29495 if (firstRun) { 29496 firstRun = false; 29497 return; 29498 } 29499 cancelAnimationFrame(raf); 29500 raf = requestAnimationFrame(() => sortItems(state.renderedItems)); 29501 }; 29502 const root = getCommonParent(state.renderedItems); 29503 const observer = new IntersectionObserver(ioCallback, { root }); 29504 for (const item of state.renderedItems) { 29505 if (!item.element) continue; 29506 observer.observe(item.element); 29507 } 29508 return () => { 29509 cancelAnimationFrame(raf); 29510 observer.disconnect(); 29511 }; 29512 }); 29513 }); 29514 const mergeItem = (item, setItems, canDeleteFromMap = false) => { 29515 let prevItem; 29516 setItems((items2) => { 29517 const index2 = items2.findIndex(({ id }) => id === item.id); 29518 const nextItems = items2.slice(); 29519 if (index2 !== -1) { 29520 prevItem = items2[index2]; 29521 const nextItem = { ...prevItem, ...item }; 29522 nextItems[index2] = nextItem; 29523 itemsMap.set(item.id, nextItem); 29524 } else { 29525 nextItems.push(item); 29526 itemsMap.set(item.id, item); 29527 } 29528 return nextItems; 29529 }); 29530 const unmergeItem = () => { 29531 setItems((items2) => { 29532 if (!prevItem) { 29533 if (canDeleteFromMap) { 29534 itemsMap.delete(item.id); 29535 } 29536 return items2.filter(({ id }) => id !== item.id); 29537 } 29538 const index2 = items2.findIndex(({ id }) => id === item.id); 29539 if (index2 === -1) return items2; 29540 const nextItems = items2.slice(); 29541 nextItems[index2] = prevItem; 29542 itemsMap.set(item.id, prevItem); 29543 return nextItems; 29544 }); 29545 }; 29546 return unmergeItem; 29547 }; 29548 const registerItem = (item) => mergeItem( 29549 item, 29550 (getItems) => privateStore.setState("items", getItems), 29551 true 29552 ); 29553 return { 29554 ...collection, 29555 registerItem, 29556 renderItem: (item) => chain( 29557 registerItem(item), 29558 mergeItem( 29559 item, 29560 (getItems) => privateStore.setState("renderedItems", getItems) 29561 ) 29562 ), 29563 item: (id) => { 29564 if (!id) return null; 29565 let item = itemsMap.get(id); 29566 if (!item) { 29567 const { items: items2 } = privateStore.getState(); 29568 item = items2.find((item2) => item2.id === id); 29569 if (item) { 29570 itemsMap.set(id, item); 29571 } 29572 } 29573 return item || null; 29574 }, 29575 // @ts-expect-error Internal 29576 __unstablePrivateStore: privateStore 29577 }; 29578 } 29579 29580 // node_modules/@ariakit/react-core/esm/__chunks/GVAFFF2B.js 29581 function useCollectionStoreProps(store, update2, props) { 29582 useUpdateEffect(update2, [props.store]); 29583 useStoreProps(store, props, "items", "setItems"); 29584 return store; 29585 } 29586 29587 // node_modules/@ariakit/core/esm/__chunks/RVTIKFRL.js 29588 var NULL_ITEM = { id: null }; 29589 function findFirstEnabledItem2(items, excludeId) { 29590 return items.find((item) => { 29591 if (excludeId) { 29592 return !item.disabled && item.id !== excludeId; 29593 } 29594 return !item.disabled; 29595 }); 29596 } 29597 function getEnabledItems(items, excludeId) { 29598 return items.filter((item) => { 29599 if (excludeId) { 29600 return !item.disabled && item.id !== excludeId; 29601 } 29602 return !item.disabled; 29603 }); 29604 } 29605 function getItemsInRow(items, rowId) { 29606 return items.filter((item) => item.rowId === rowId); 29607 } 29608 function flipItems(items, activeId, shouldInsertNullItem = false) { 29609 const index2 = items.findIndex((item) => item.id === activeId); 29610 return [ 29611 ...items.slice(index2 + 1), 29612 ...shouldInsertNullItem ? [NULL_ITEM] : [], 29613 ...items.slice(0, index2) 29614 ]; 29615 } 29616 function groupItemsByRows2(items) { 29617 const rows = []; 29618 for (const item of items) { 29619 const row = rows.find((currentRow) => { 29620 var _a; 29621 return ((_a = currentRow[0]) == null ? void 0 : _a.rowId) === item.rowId; 29622 }); 29623 if (row) { 29624 row.push(item); 29625 } else { 29626 rows.push([item]); 29627 } 29628 } 29629 return rows; 29630 } 29631 function getMaxRowLength(array) { 29632 let maxLength = 0; 29633 for (const { length } of array) { 29634 if (length > maxLength) { 29635 maxLength = length; 29636 } 29637 } 29638 return maxLength; 29639 } 29640 function createEmptyItem(rowId) { 29641 return { 29642 id: "__EMPTY_ITEM__", 29643 disabled: true, 29644 rowId 29645 }; 29646 } 29647 function normalizeRows(rows, activeId, focusShift) { 29648 const maxLength = getMaxRowLength(rows); 29649 for (const row of rows) { 29650 for (let i2 = 0; i2 < maxLength; i2 += 1) { 29651 const item = row[i2]; 29652 if (!item || focusShift && item.disabled) { 29653 const isFirst = i2 === 0; 29654 const previousItem = isFirst && focusShift ? findFirstEnabledItem2(row) : row[i2 - 1]; 29655 row[i2] = previousItem && activeId !== previousItem.id && focusShift ? previousItem : createEmptyItem(previousItem == null ? void 0 : previousItem.rowId); 29656 } 29657 } 29658 } 29659 return rows; 29660 } 29661 function verticalizeItems(items) { 29662 const rows = groupItemsByRows2(items); 29663 const maxLength = getMaxRowLength(rows); 29664 const verticalized = []; 29665 for (let i2 = 0; i2 < maxLength; i2 += 1) { 29666 for (const row of rows) { 29667 const item = row[i2]; 29668 if (item) { 29669 verticalized.push({ 29670 ...item, 29671 // If there's no rowId, it means that it's not a grid composite, but 29672 // a single row instead. So, instead of verticalizing it, that is, 29673 // assigning a different rowId based on the column index, we keep it 29674 // undefined so they will be part of the same row. This is useful 29675 // when using up/down on one-dimensional composites. 29676 rowId: item.rowId ? `$i2}` : void 0 29677 }); 29678 } 29679 } 29680 } 29681 return verticalized; 29682 } 29683 function createCompositeStore(props = {}) { 29684 var _a; 29685 const syncState = (_a = props.store) == null ? void 0 : _a.getState(); 29686 const collection = createCollectionStore(props); 29687 const activeId = defaultValue( 29688 props.activeId, 29689 syncState == null ? void 0 : syncState.activeId, 29690 props.defaultActiveId 29691 ); 29692 const initialState = { 29693 ...collection.getState(), 29694 id: defaultValue( 29695 props.id, 29696 syncState == null ? void 0 : syncState.id, 29697 `id-$Math.random().toString(36).slice(2, 8)}` 29698 ), 29699 activeId, 29700 baseElement: defaultValue(syncState == null ? void 0 : syncState.baseElement, null), 29701 includesBaseElement: defaultValue( 29702 props.includesBaseElement, 29703 syncState == null ? void 0 : syncState.includesBaseElement, 29704 activeId === null 29705 ), 29706 moves: defaultValue(syncState == null ? void 0 : syncState.moves, 0), 29707 orientation: defaultValue( 29708 props.orientation, 29709 syncState == null ? void 0 : syncState.orientation, 29710 "both" 29711 ), 29712 rtl: defaultValue(props.rtl, syncState == null ? void 0 : syncState.rtl, false), 29713 virtualFocus: defaultValue( 29714 props.virtualFocus, 29715 syncState == null ? void 0 : syncState.virtualFocus, 29716 false 29717 ), 29718 focusLoop: defaultValue(props.focusLoop, syncState == null ? void 0 : syncState.focusLoop, false), 29719 focusWrap: defaultValue(props.focusWrap, syncState == null ? void 0 : syncState.focusWrap, false), 29720 focusShift: defaultValue(props.focusShift, syncState == null ? void 0 : syncState.focusShift, false) 29721 }; 29722 const composite = createStore(initialState, collection, props.store); 29723 setup( 29724 composite, 29725 () => sync(composite, ["renderedItems", "activeId"], (state) => { 29726 composite.setState("activeId", (activeId2) => { 29727 var _a2; 29728 if (activeId2 !== void 0) return activeId2; 29729 return (_a2 = findFirstEnabledItem2(state.renderedItems)) == null ? void 0 : _a2.id; 29730 }); 29731 }) 29732 ); 29733 const getNextId = (direction = "next", options = {}) => { 29734 var _a2, _b; 29735 const defaultState = composite.getState(); 29736 const { 29737 skip = 0, 29738 activeId: activeId2 = defaultState.activeId, 29739 focusShift = defaultState.focusShift, 29740 focusLoop = defaultState.focusLoop, 29741 focusWrap = defaultState.focusWrap, 29742 includesBaseElement = defaultState.includesBaseElement, 29743 renderedItems = defaultState.renderedItems, 29744 rtl = defaultState.rtl 29745 } = options; 29746 const isVerticalDirection = direction === "up" || direction === "down"; 29747 const isNextDirection = direction === "next" || direction === "down"; 29748 const canReverse = isNextDirection ? rtl && !isVerticalDirection : !rtl || isVerticalDirection; 29749 const canShift = focusShift && !skip; 29750 let items = !isVerticalDirection ? renderedItems : flatten2DArray( 29751 normalizeRows(groupItemsByRows2(renderedItems), activeId2, canShift) 29752 ); 29753 items = canReverse ? reverseArray(items) : items; 29754 items = isVerticalDirection ? verticalizeItems(items) : items; 29755 if (activeId2 == null) { 29756 return (_a2 = findFirstEnabledItem2(items)) == null ? void 0 : _a2.id; 29757 } 29758 const activeItem = items.find((item) => item.id === activeId2); 29759 if (!activeItem) { 29760 return (_b = findFirstEnabledItem2(items)) == null ? void 0 : _b.id; 29761 } 29762 const isGrid2 = items.some((item) => item.rowId); 29763 const activeIndex = items.indexOf(activeItem); 29764 const nextItems = items.slice(activeIndex + 1); 29765 const nextItemsInRow = getItemsInRow(nextItems, activeItem.rowId); 29766 if (skip) { 29767 const nextEnabledItemsInRow = getEnabledItems(nextItemsInRow, activeId2); 29768 const nextItem2 = nextEnabledItemsInRow.slice(skip)[0] || // If we can't find an item, just return the last one. 29769 nextEnabledItemsInRow[nextEnabledItemsInRow.length - 1]; 29770 return nextItem2 == null ? void 0 : nextItem2.id; 29771 } 29772 const canLoop = focusLoop && (isVerticalDirection ? focusLoop !== "horizontal" : focusLoop !== "vertical"); 29773 const canWrap = isGrid2 && focusWrap && (isVerticalDirection ? focusWrap !== "horizontal" : focusWrap !== "vertical"); 29774 const hasNullItem = isNextDirection ? (!isGrid2 || isVerticalDirection) && canLoop && includesBaseElement : isVerticalDirection ? includesBaseElement : false; 29775 if (canLoop) { 29776 const loopItems = canWrap && !hasNullItem ? items : getItemsInRow(items, activeItem.rowId); 29777 const sortedItems = flipItems(loopItems, activeId2, hasNullItem); 29778 const nextItem2 = findFirstEnabledItem2(sortedItems, activeId2); 29779 return nextItem2 == null ? void 0 : nextItem2.id; 29780 } 29781 if (canWrap) { 29782 const nextItem2 = findFirstEnabledItem2( 29783 // We can use nextItems, which contains all the next items, including 29784 // items from other rows, to wrap between rows. However, if there is a 29785 // null item (the composite container), we'll only use the next items in 29786 // the row. So moving next from the last item will focus on the 29787 // composite container. On grid composites, horizontal navigation never 29788 // focuses on the composite container, only vertical. 29789 hasNullItem ? nextItemsInRow : nextItems, 29790 activeId2 29791 ); 29792 const nextId = hasNullItem ? (nextItem2 == null ? void 0 : nextItem2.id) || null : nextItem2 == null ? void 0 : nextItem2.id; 29793 return nextId; 29794 } 29795 const nextItem = findFirstEnabledItem2(nextItemsInRow, activeId2); 29796 if (!nextItem && hasNullItem) { 29797 return null; 29798 } 29799 return nextItem == null ? void 0 : nextItem.id; 29800 }; 29801 return { 29802 ...collection, 29803 ...composite, 29804 setBaseElement: (element) => composite.setState("baseElement", element), 29805 setActiveId: (id) => composite.setState("activeId", id), 29806 move: (id) => { 29807 if (id === void 0) return; 29808 composite.setState("activeId", id); 29809 composite.setState("moves", (moves) => moves + 1); 29810 }, 29811 first: () => { 29812 var _a2; 29813 return (_a2 = findFirstEnabledItem2(composite.getState().renderedItems)) == null ? void 0 : _a2.id; 29814 }, 29815 last: () => { 29816 var _a2; 29817 return (_a2 = findFirstEnabledItem2(reverseArray(composite.getState().renderedItems))) == null ? void 0 : _a2.id; 29818 }, 29819 next: (options) => { 29820 if (options !== void 0 && typeof options === "number") { 29821 options = { skip: options }; 29822 } 29823 return getNextId("next", options); 29824 }, 29825 previous: (options) => { 29826 if (options !== void 0 && typeof options === "number") { 29827 options = { skip: options }; 29828 } 29829 return getNextId("previous", options); 29830 }, 29831 down: (options) => { 29832 if (options !== void 0 && typeof options === "number") { 29833 options = { skip: options }; 29834 } 29835 return getNextId("down", options); 29836 }, 29837 up: (options) => { 29838 if (options !== void 0 && typeof options === "number") { 29839 options = { skip: options }; 29840 } 29841 return getNextId("up", options); 29842 } 29843 }; 29844 } 29845 29846 // node_modules/@ariakit/react-core/esm/__chunks/IQYAUKXT.js 29847 function useCompositeStoreOptions(props) { 29848 const id = useId7(props.id); 29849 return { id, ...props }; 29850 } 29851 function useCompositeStoreProps(store, update2, props) { 29852 store = useCollectionStoreProps(store, update2, props); 29853 useStoreProps(store, props, "activeId", "setActiveId"); 29854 useStoreProps(store, props, "includesBaseElement"); 29855 useStoreProps(store, props, "virtualFocus"); 29856 useStoreProps(store, props, "orientation"); 29857 useStoreProps(store, props, "rtl"); 29858 useStoreProps(store, props, "focusLoop"); 29859 useStoreProps(store, props, "focusWrap"); 29860 useStoreProps(store, props, "focusShift"); 29861 return store; 29862 } 29863 29864 // node_modules/@ariakit/react-core/esm/__chunks/CVCFNOHX.js 29865 var import_react36 = __toESM(require_react(), 1); 29866 var ComboboxListRoleContext = (0, import_react36.createContext)( 29867 void 0 29868 ); 29869 var ctx6 = createStoreContext( 29870 [PopoverContextProvider, CompositeContextProvider], 29871 [PopoverScopedContextProvider, CompositeScopedContextProvider] 29872 ); 29873 var useComboboxContext = ctx6.useContext; 29874 var useComboboxScopedContext = ctx6.useScopedContext; 29875 var useComboboxProviderContext = ctx6.useProviderContext; 29876 var ComboboxContextProvider = ctx6.ContextProvider; 29877 var ComboboxScopedContextProvider = ctx6.ScopedContextProvider; 29878 var ComboboxItemValueContext = (0, import_react36.createContext)( 29879 void 0 29880 ); 29881 var ComboboxItemCheckedContext = (0, import_react36.createContext)(false); 29882 29883 // node_modules/@ariakit/core/esm/__chunks/KMAUV3TY.js 29884 function createDialogStore(props = {}) { 29885 return createDisclosureStore(props); 29886 } 29887 29888 // node_modules/@ariakit/react-core/esm/__chunks/4NYSH4UO.js 29889 function useDialogStoreProps(store, update2, props) { 29890 return useDisclosureStoreProps(store, update2, props); 29891 } 29892 29893 // node_modules/@ariakit/core/esm/__chunks/BFGNM53A.js 29894 function createPopoverStore({ 29895 popover: otherPopover, 29896 ...props 29897 } = {}) { 29898 const store = mergeStore( 29899 props.store, 29900 omit2(otherPopover, [ 29901 "arrowElement", 29902 "anchorElement", 29903 "contentElement", 29904 "popoverElement", 29905 "disclosureElement" 29906 ]) 29907 ); 29908 throwOnConflictingProps(props, store); 29909 const syncState = store == null ? void 0 : store.getState(); 29910 const dialog = createDialogStore({ ...props, store }); 29911 const placement = defaultValue( 29912 props.placement, 29913 syncState == null ? void 0 : syncState.placement, 29914 "bottom" 29915 ); 29916 const initialState = { 29917 ...dialog.getState(), 29918 placement, 29919 currentPlacement: placement, 29920 anchorElement: defaultValue(syncState == null ? void 0 : syncState.anchorElement, null), 29921 popoverElement: defaultValue(syncState == null ? void 0 : syncState.popoverElement, null), 29922 arrowElement: defaultValue(syncState == null ? void 0 : syncState.arrowElement, null), 29923 rendered: /* @__PURE__ */ Symbol("rendered") 29924 }; 29925 const popover = createStore(initialState, dialog, store); 29926 return { 29927 ...dialog, 29928 ...popover, 29929 setAnchorElement: (element) => popover.setState("anchorElement", element), 29930 setPopoverElement: (element) => popover.setState("popoverElement", element), 29931 setArrowElement: (element) => popover.setState("arrowElement", element), 29932 render: () => popover.setState("rendered", /* @__PURE__ */ Symbol("rendered")) 29933 }; 29934 } 29935 29936 // node_modules/@ariakit/react-core/esm/__chunks/B6FLPFJM.js 29937 function usePopoverStoreProps(store, update2, props) { 29938 useUpdateEffect(update2, [props.popover]); 29939 useStoreProps(store, props, "placement"); 29940 return useDialogStoreProps(store, update2, props); 29941 } 29942 29943 // node_modules/@ariakit/react-core/esm/__chunks/4POTBZ2J.js 29944 var TagName7 = "div"; 29945 var usePopoverAnchor = createHook( 29946 function usePopoverAnchor2({ store, ...props }) { 29947 const context = usePopoverProviderContext(); 29948 store = store || context; 29949 props = { 29950 ...props, 29951 ref: useMergeRefs8(store == null ? void 0 : store.setAnchorElement, props.ref) 29952 }; 29953 return props; 29954 } 29955 ); 29956 var PopoverAnchor = forwardRef210(function PopoverAnchor2(props) { 29957 const htmlProps = usePopoverAnchor(props); 29958 return createElement3(TagName7, htmlProps); 29959 }); 29960 29961 // node_modules/@ariakit/react-core/esm/__chunks/X6LNAU2F.js 29962 var import_react37 = __toESM(require_react(), 1); 29963 var TagName8 = "div"; 29964 function getMouseDestination(event) { 29965 const relatedTarget = event.relatedTarget; 29966 if ((relatedTarget == null ? void 0 : relatedTarget.nodeType) === Node.ELEMENT_NODE) { 29967 return relatedTarget; 29968 } 29969 return null; 29970 } 29971 function hoveringInside(event) { 29972 const nextElement = getMouseDestination(event); 29973 if (!nextElement) return false; 29974 return contains2(event.currentTarget, nextElement); 29975 } 29976 var symbol2 = /* @__PURE__ */ Symbol("composite-hover"); 29977 function movingToAnotherItem(event) { 29978 let dest = getMouseDestination(event); 29979 if (!dest) return false; 29980 do { 29981 if (hasOwnProperty(dest, symbol2) && dest[symbol2]) return true; 29982 dest = dest.parentElement; 29983 } while (dest); 29984 return false; 29985 } 29986 var useCompositeHover = createHook( 29987 function useCompositeHover2({ 29988 store, 29989 focusOnHover = true, 29990 blurOnHoverEnd = !!focusOnHover, 29991 ...props 29992 }) { 29993 const context = useCompositeContext(); 29994 store = store || context; 29995 invariant( 29996 store, 29997 "CompositeHover must be wrapped in a Composite component." 29998 ); 29999 const isMouseMoving = useIsMouseMoving(); 30000 const onMouseMoveProp = props.onMouseMove; 30001 const focusOnHoverProp = useBooleanEvent(focusOnHover); 30002 const onMouseMove = useEvent((event) => { 30003 onMouseMoveProp == null ? void 0 : onMouseMoveProp(event); 30004 if (event.defaultPrevented) return; 30005 if (!isMouseMoving()) return; 30006 if (!focusOnHoverProp(event)) return; 30007 if (!hasFocusWithin(event.currentTarget)) { 30008 const baseElement = store == null ? void 0 : store.getState().baseElement; 30009 if (baseElement && !hasFocus(baseElement)) { 30010 baseElement.focus(); 30011 } 30012 } 30013 store == null ? void 0 : store.setActiveId(event.currentTarget.id); 30014 }); 30015 const onMouseLeaveProp = props.onMouseLeave; 30016 const blurOnHoverEndProp = useBooleanEvent(blurOnHoverEnd); 30017 const onMouseLeave = useEvent((event) => { 30018 var _a; 30019 onMouseLeaveProp == null ? void 0 : onMouseLeaveProp(event); 30020 if (event.defaultPrevented) return; 30021 if (!isMouseMoving()) return; 30022 if (hoveringInside(event)) return; 30023 if (movingToAnotherItem(event)) return; 30024 if (!focusOnHoverProp(event)) return; 30025 if (!blurOnHoverEndProp(event)) return; 30026 store == null ? void 0 : store.setActiveId(null); 30027 (_a = store == null ? void 0 : store.getState().baseElement) == null ? void 0 : _a.focus(); 30028 }); 30029 const ref = (0, import_react37.useCallback)((element) => { 30030 if (!element) return; 30031 element[symbol2] = true; 30032 }, []); 30033 props = { 30034 ...props, 30035 ref: useMergeRefs8(ref, props.ref), 30036 onMouseMove, 30037 onMouseLeave 30038 }; 30039 return removeUndefinedValues(props); 30040 } 30041 ); 30042 var CompositeHover = memo22( 30043 forwardRef210(function CompositeHover2(props) { 30044 const htmlProps = useCompositeHover(props); 30045 return createElement3(TagName8, htmlProps); 30046 }) 30047 ); 30048 30049 // node_modules/@ariakit/react-core/esm/combobox/combobox.js 30050 var import_react38 = __toESM(require_react(), 1); 30051 var TagName9 = "input"; 30052 function isFirstItemAutoSelected(items, activeValue, autoSelect) { 30053 if (!autoSelect) return false; 30054 const firstItem = items.find((item) => !item.disabled && item.value); 30055 return (firstItem == null ? void 0 : firstItem.value) === activeValue; 30056 } 30057 function hasCompletionString(value, activeValue) { 30058 if (!activeValue) return false; 30059 if (value == null) return false; 30060 value = normalizeString(value); 30061 return activeValue.length > value.length && activeValue.toLowerCase().indexOf(value.toLowerCase()) === 0; 30062 } 30063 function isInputEvent(event) { 30064 return event.type === "input"; 30065 } 30066 function isAriaAutoCompleteValue(value) { 30067 return value === "inline" || value === "list" || value === "both" || value === "none"; 30068 } 30069 function getDefaultAutoSelectId(items) { 30070 const item = items.find((item2) => { 30071 var _a; 30072 if (item2.disabled) return false; 30073 return ((_a = item2.element) == null ? void 0 : _a.getAttribute("role")) !== "tab"; 30074 }); 30075 return item == null ? void 0 : item.id; 30076 } 30077 var useCombobox = createHook( 30078 function useCombobox2({ 30079 store, 30080 focusable: focusable2 = true, 30081 autoSelect: autoSelectProp = false, 30082 getAutoSelectId, 30083 setValueOnChange, 30084 showMinLength = 0, 30085 showOnChange, 30086 showOnMouseDown, 30087 showOnClick = showOnMouseDown, 30088 showOnKeyDown, 30089 showOnKeyPress = showOnKeyDown, 30090 blurActiveItemOnClick, 30091 setValueOnClick = true, 30092 moveOnKeyPress = true, 30093 autoComplete = "list", 30094 ...props 30095 }) { 30096 const context = useComboboxProviderContext(); 30097 store = store || context; 30098 invariant( 30099 store, 30100 "Combobox must receive a `store` prop or be wrapped in a ComboboxProvider component." 30101 ); 30102 const ref = (0, import_react38.useRef)(null); 30103 const [valueUpdated, forceValueUpdate] = useForceUpdate(); 30104 const canAutoSelectRef = (0, import_react38.useRef)(false); 30105 const composingRef = (0, import_react38.useRef)(false); 30106 const autoSelect = store.useState( 30107 (state) => state.virtualFocus && autoSelectProp 30108 ); 30109 const inline4 = autoComplete === "inline" || autoComplete === "both"; 30110 const [canInline, setCanInline] = (0, import_react38.useState)(inline4); 30111 useUpdateLayoutEffect(() => { 30112 if (!inline4) return; 30113 setCanInline(true); 30114 }, [inline4]); 30115 const storeValue = store.useState("value"); 30116 const prevSelectedValueRef = (0, import_react38.useRef)(void 0); 30117 (0, import_react38.useEffect)(() => { 30118 return sync(store, ["selectedValue", "activeId"], (_, prev) => { 30119 prevSelectedValueRef.current = prev.selectedValue; 30120 }); 30121 }, []); 30122 const inlineActiveValue = store.useState((state) => { 30123 var _a; 30124 if (!inline4) return; 30125 if (!canInline) return; 30126 if (state.activeValue && Array.isArray(state.selectedValue)) { 30127 if (state.selectedValue.includes(state.activeValue)) return; 30128 if ((_a = prevSelectedValueRef.current) == null ? void 0 : _a.includes(state.activeValue)) return; 30129 } 30130 return state.activeValue; 30131 }); 30132 const items = store.useState("renderedItems"); 30133 const open = store.useState("open"); 30134 const contentElement = store.useState("contentElement"); 30135 const value = (0, import_react38.useMemo)(() => { 30136 if (!inline4) return storeValue; 30137 if (!canInline) return storeValue; 30138 const firstItemAutoSelected = isFirstItemAutoSelected( 30139 items, 30140 inlineActiveValue, 30141 autoSelect 30142 ); 30143 if (firstItemAutoSelected) { 30144 if (hasCompletionString(storeValue, inlineActiveValue)) { 30145 const slice = (inlineActiveValue == null ? void 0 : inlineActiveValue.slice(storeValue.length)) || ""; 30146 return storeValue + slice; 30147 } 30148 return storeValue; 30149 } 30150 return inlineActiveValue || storeValue; 30151 }, [inline4, canInline, items, inlineActiveValue, autoSelect, storeValue]); 30152 (0, import_react38.useEffect)(() => { 30153 const element = ref.current; 30154 if (!element) return; 30155 const onCompositeItemMove = () => setCanInline(true); 30156 element.addEventListener("combobox-item-move", onCompositeItemMove); 30157 return () => { 30158 element.removeEventListener("combobox-item-move", onCompositeItemMove); 30159 }; 30160 }, []); 30161 (0, import_react38.useEffect)(() => { 30162 if (!inline4) return; 30163 if (!canInline) return; 30164 if (!inlineActiveValue) return; 30165 const firstItemAutoSelected = isFirstItemAutoSelected( 30166 items, 30167 inlineActiveValue, 30168 autoSelect 30169 ); 30170 if (!firstItemAutoSelected) return; 30171 if (!hasCompletionString(storeValue, inlineActiveValue)) return; 30172 let cleanup = noop5; 30173 queueMicrotask(() => { 30174 const element = ref.current; 30175 if (!element) return; 30176 const { start: prevStart, end: prevEnd } = getTextboxSelection(element); 30177 const nextStart = storeValue.length; 30178 const nextEnd = inlineActiveValue.length; 30179 setSelectionRange(element, nextStart, nextEnd); 30180 cleanup = () => { 30181 if (!hasFocus(element)) return; 30182 const { start, end } = getTextboxSelection(element); 30183 if (start !== nextStart) return; 30184 if (end !== nextEnd) return; 30185 setSelectionRange(element, prevStart, prevEnd); 30186 }; 30187 }); 30188 return () => cleanup(); 30189 }, [ 30190 valueUpdated, 30191 inline4, 30192 canInline, 30193 inlineActiveValue, 30194 items, 30195 autoSelect, 30196 storeValue 30197 ]); 30198 const scrollingElementRef = (0, import_react38.useRef)(null); 30199 const getAutoSelectIdProp = useEvent(getAutoSelectId); 30200 const autoSelectIdRef = (0, import_react38.useRef)(null); 30201 (0, import_react38.useEffect)(() => { 30202 if (!open) return; 30203 if (!contentElement) return; 30204 const scrollingElement = getScrollingElement(contentElement); 30205 if (!scrollingElement) return; 30206 scrollingElementRef.current = scrollingElement; 30207 const onUserScroll = () => { 30208 canAutoSelectRef.current = false; 30209 }; 30210 const onScroll = () => { 30211 if (!store) return; 30212 if (!canAutoSelectRef.current) return; 30213 const { activeId } = store.getState(); 30214 if (activeId === null) return; 30215 if (activeId === autoSelectIdRef.current) return; 30216 canAutoSelectRef.current = false; 30217 }; 30218 const options = { passive: true, capture: true }; 30219 scrollingElement.addEventListener("wheel", onUserScroll, options); 30220 scrollingElement.addEventListener("touchmove", onUserScroll, options); 30221 scrollingElement.addEventListener("scroll", onScroll, options); 30222 return () => { 30223 scrollingElement.removeEventListener("wheel", onUserScroll, true); 30224 scrollingElement.removeEventListener("touchmove", onUserScroll, true); 30225 scrollingElement.removeEventListener("scroll", onScroll, true); 30226 }; 30227 }, [open, contentElement, store]); 30228 useSafeLayoutEffect(() => { 30229 if (!storeValue) return; 30230 if (composingRef.current) return; 30231 canAutoSelectRef.current = true; 30232 }, [storeValue]); 30233 useSafeLayoutEffect(() => { 30234 if (autoSelect !== "always" && open) return; 30235 canAutoSelectRef.current = open; 30236 }, [autoSelect, open]); 30237 const resetValueOnSelect = store.useState("resetValueOnSelect"); 30238 useUpdateEffect(() => { 30239 var _a, _b; 30240 const canAutoSelect = canAutoSelectRef.current; 30241 if (!store) return; 30242 if (!open) return; 30243 if (!canAutoSelect && !resetValueOnSelect) return; 30244 const { baseElement, contentElement: contentElement2, activeId } = store.getState(); 30245 if (baseElement && !hasFocus(baseElement)) return; 30246 if (contentElement2 == null ? void 0 : contentElement2.hasAttribute("data-placing")) { 30247 const observer = new MutationObserver(forceValueUpdate); 30248 observer.observe(contentElement2, { attributeFilter: ["data-placing"] }); 30249 return () => observer.disconnect(); 30250 } 30251 if (autoSelect && canAutoSelect) { 30252 const userAutoSelectId = getAutoSelectIdProp(items); 30253 const autoSelectId = userAutoSelectId !== void 0 ? userAutoSelectId : (_a = getDefaultAutoSelectId(items)) != null ? _a : store.first(); 30254 autoSelectIdRef.current = autoSelectId; 30255 store.move(autoSelectId != null ? autoSelectId : null); 30256 } else { 30257 const element = (_b = store.item(activeId || store.first())) == null ? void 0 : _b.element; 30258 if (element && "scrollIntoView" in element) { 30259 element.scrollIntoView({ block: "nearest", inline: "nearest" }); 30260 } 30261 } 30262 return; 30263 }, [ 30264 store, 30265 open, 30266 valueUpdated, 30267 storeValue, 30268 autoSelect, 30269 resetValueOnSelect, 30270 getAutoSelectIdProp, 30271 items 30272 ]); 30273 (0, import_react38.useEffect)(() => { 30274 if (!inline4) return; 30275 const combobox = ref.current; 30276 if (!combobox) return; 30277 const elements = [combobox, contentElement].filter( 30278 (value2) => !!value2 30279 ); 30280 const onBlur2 = (event) => { 30281 if (elements.every((el) => isFocusEventOutside(event, el))) { 30282 store == null ? void 0 : store.setValue(value); 30283 } 30284 }; 30285 for (const element of elements) { 30286 element.addEventListener("focusout", onBlur2); 30287 } 30288 return () => { 30289 for (const element of elements) { 30290 element.removeEventListener("focusout", onBlur2); 30291 } 30292 }; 30293 }, [inline4, contentElement, store, value]); 30294 const canShow = (event) => { 30295 const currentTarget = event.currentTarget; 30296 return currentTarget.value.length >= showMinLength; 30297 }; 30298 const onChangeProp = props.onChange; 30299 const showOnChangeProp = useBooleanEvent(showOnChange != null ? showOnChange : canShow); 30300 const setValueOnChangeProp = useBooleanEvent( 30301 // If the combobox is combined with tags, the value will be set by the tag 30302 // input component. 30303 setValueOnChange != null ? setValueOnChange : !store.tag 30304 ); 30305 const onChange = useEvent((event) => { 30306 onChangeProp == null ? void 0 : onChangeProp(event); 30307 if (event.defaultPrevented) return; 30308 if (!store) return; 30309 const currentTarget = event.currentTarget; 30310 const { value: value2, selectionStart, selectionEnd } = currentTarget; 30311 const nativeEvent = event.nativeEvent; 30312 canAutoSelectRef.current = true; 30313 if (isInputEvent(nativeEvent)) { 30314 if (nativeEvent.isComposing) { 30315 canAutoSelectRef.current = false; 30316 composingRef.current = true; 30317 } 30318 if (inline4) { 30319 const textInserted = nativeEvent.inputType === "insertText" || nativeEvent.inputType === "insertCompositionText"; 30320 const caretAtEnd = selectionStart === value2.length; 30321 setCanInline(textInserted && caretAtEnd); 30322 } 30323 } 30324 if (setValueOnChangeProp(event)) { 30325 const isSameValue = value2 === store.getState().value; 30326 store.setValue(value2); 30327 queueMicrotask(() => { 30328 setSelectionRange(currentTarget, selectionStart, selectionEnd); 30329 }); 30330 if (inline4 && autoSelect && isSameValue) { 30331 forceValueUpdate(); 30332 } 30333 } 30334 if (showOnChangeProp(event)) { 30335 store.show(); 30336 } 30337 if (!autoSelect || !canAutoSelectRef.current) { 30338 store.setActiveId(null); 30339 } 30340 }); 30341 const onCompositionEndProp = props.onCompositionEnd; 30342 const onCompositionEnd = useEvent((event) => { 30343 canAutoSelectRef.current = true; 30344 composingRef.current = false; 30345 onCompositionEndProp == null ? void 0 : onCompositionEndProp(event); 30346 if (event.defaultPrevented) return; 30347 if (!autoSelect) return; 30348 forceValueUpdate(); 30349 }); 30350 const onMouseDownProp = props.onMouseDown; 30351 const blurActiveItemOnClickProp = useBooleanEvent( 30352 blurActiveItemOnClick != null ? blurActiveItemOnClick : (() => !!(store == null ? void 0 : store.getState().includesBaseElement)) 30353 ); 30354 const setValueOnClickProp = useBooleanEvent(setValueOnClick); 30355 const showOnClickProp = useBooleanEvent(showOnClick != null ? showOnClick : canShow); 30356 const onMouseDown = useEvent((event) => { 30357 onMouseDownProp == null ? void 0 : onMouseDownProp(event); 30358 if (event.defaultPrevented) return; 30359 if (event.button) return; 30360 if (event.ctrlKey) return; 30361 if (!store) return; 30362 if (blurActiveItemOnClickProp(event)) { 30363 store.setActiveId(null); 30364 } 30365 if (setValueOnClickProp(event)) { 30366 store.setValue(value); 30367 } 30368 if (showOnClickProp(event)) { 30369 queueBeforeEvent(event.currentTarget, "mouseup", store.show); 30370 } 30371 }); 30372 const onKeyDownProp = props.onKeyDown; 30373 const showOnKeyPressProp = useBooleanEvent(showOnKeyPress != null ? showOnKeyPress : canShow); 30374 const onKeyDown = useEvent((event) => { 30375 onKeyDownProp == null ? void 0 : onKeyDownProp(event); 30376 if (!event.repeat) { 30377 canAutoSelectRef.current = false; 30378 } 30379 if (event.defaultPrevented) return; 30380 if (event.ctrlKey) return; 30381 if (event.altKey) return; 30382 if (event.shiftKey) return; 30383 if (event.metaKey) return; 30384 if (!store) return; 30385 const { open: open2 } = store.getState(); 30386 if (open2) return; 30387 if (event.key === "ArrowUp" || event.key === "ArrowDown") { 30388 if (showOnKeyPressProp(event)) { 30389 event.preventDefault(); 30390 store.show(); 30391 } 30392 } 30393 }); 30394 const onBlurProp = props.onBlur; 30395 const onBlur = useEvent((event) => { 30396 canAutoSelectRef.current = false; 30397 onBlurProp == null ? void 0 : onBlurProp(event); 30398 if (event.defaultPrevented) return; 30399 }); 30400 const id = useId7(props.id); 30401 const ariaAutoComplete = isAriaAutoCompleteValue(autoComplete) ? autoComplete : void 0; 30402 const isActiveItem = store.useState((state) => state.activeId === null); 30403 props = { 30404 id, 30405 role: "combobox", 30406 "aria-autocomplete": ariaAutoComplete, 30407 "aria-haspopup": getPopupRole(contentElement, "listbox"), 30408 "aria-expanded": open, 30409 "aria-controls": contentElement == null ? void 0 : contentElement.id, 30410 "data-active-item": isActiveItem || void 0, 30411 value, 30412 ...props, 30413 ref: useMergeRefs8(ref, props.ref), 30414 onChange, 30415 onCompositionEnd, 30416 onMouseDown, 30417 onKeyDown, 30418 onBlur 30419 }; 30420 props = useComposite({ 30421 store, 30422 focusable: focusable2, 30423 ...props, 30424 // Enable inline autocomplete when the user moves from the combobox input 30425 // to an item. 30426 moveOnKeyPress: (event) => { 30427 if (isFalsyBooleanCallback(moveOnKeyPress, event)) return false; 30428 if (inline4) setCanInline(true); 30429 return true; 30430 } 30431 }); 30432 props = usePopoverAnchor({ store, ...props }); 30433 return { autoComplete: "off", ...props }; 30434 } 30435 ); 30436 var Combobox = forwardRef210(function Combobox2(props) { 30437 const htmlProps = useCombobox(props); 30438 return createElement3(TagName9, htmlProps); 30439 }); 30440 30441 // node_modules/@ariakit/react-core/esm/__chunks/IBXZ2LQC.js 30442 var import_react39 = __toESM(require_react(), 1); 30443 var import_jsx_runtime145 = __toESM(require_jsx_runtime(), 1); 30444 var TagName10 = "div"; 30445 function isSelected(storeValue, itemValue) { 30446 if (itemValue == null) return; 30447 if (storeValue == null) return false; 30448 if (Array.isArray(storeValue)) { 30449 return storeValue.includes(itemValue); 30450 } 30451 return storeValue === itemValue; 30452 } 30453 function getItemRole(popupRole) { 30454 var _a; 30455 const itemRoleByPopupRole = { 30456 menu: "menuitem", 30457 listbox: "option", 30458 tree: "treeitem" 30459 }; 30460 const key2 = popupRole; 30461 return (_a = itemRoleByPopupRole[key2]) != null ? _a : "option"; 30462 } 30463 var useComboboxItem = createHook( 30464 function useComboboxItem2({ 30465 store, 30466 value, 30467 hideOnClick, 30468 setValueOnClick, 30469 selectValueOnClick = true, 30470 resetValueOnSelect, 30471 focusOnHover = false, 30472 moveOnKeyPress = true, 30473 getItem: getItemProp, 30474 ...props 30475 }) { 30476 var _a; 30477 const context = useComboboxScopedContext(); 30478 store = store || context; 30479 invariant( 30480 store, 30481 "ComboboxItem must be wrapped in a ComboboxList or ComboboxPopover component." 30482 ); 30483 const { resetValueOnSelectState, multiSelectable, selected } = useStoreStateObject(store, { 30484 resetValueOnSelectState: "resetValueOnSelect", 30485 multiSelectable(state) { 30486 return Array.isArray(state.selectedValue); 30487 }, 30488 selected(state) { 30489 return isSelected(state.selectedValue, value); 30490 } 30491 }); 30492 const getItem = (0, import_react39.useCallback)( 30493 (item) => { 30494 const nextItem = { ...item, value }; 30495 if (getItemProp) { 30496 return getItemProp(nextItem); 30497 } 30498 return nextItem; 30499 }, 30500 [value, getItemProp] 30501 ); 30502 setValueOnClick = setValueOnClick != null ? setValueOnClick : !multiSelectable; 30503 hideOnClick = hideOnClick != null ? hideOnClick : value != null && !multiSelectable; 30504 const onClickProp = props.onClick; 30505 const setValueOnClickProp = useBooleanEvent(setValueOnClick); 30506 const selectValueOnClickProp = useBooleanEvent(selectValueOnClick); 30507 const resetValueOnSelectProp = useBooleanEvent( 30508 (_a = resetValueOnSelect != null ? resetValueOnSelect : resetValueOnSelectState) != null ? _a : multiSelectable 30509 ); 30510 const hideOnClickProp = useBooleanEvent(hideOnClick); 30511 const onClick = useEvent((event) => { 30512 onClickProp == null ? void 0 : onClickProp(event); 30513 if (event.defaultPrevented) return; 30514 if (isDownloading(event)) return; 30515 if (isOpeningInNewTab(event)) return; 30516 if (value != null) { 30517 if (selectValueOnClickProp(event)) { 30518 if (resetValueOnSelectProp(event)) { 30519 store == null ? void 0 : store.resetValue(); 30520 } 30521 store == null ? void 0 : store.setSelectedValue((prevValue) => { 30522 if (!Array.isArray(prevValue)) return value; 30523 if (prevValue.includes(value)) { 30524 return prevValue.filter((v2) => v2 !== value); 30525 } 30526 return [...prevValue, value]; 30527 }); 30528 } 30529 if (setValueOnClickProp(event)) { 30530 store == null ? void 0 : store.setValue(value); 30531 } 30532 } 30533 if (hideOnClickProp(event)) { 30534 store == null ? void 0 : store.hide(); 30535 } 30536 }); 30537 const onKeyDownProp = props.onKeyDown; 30538 const onKeyDown = useEvent((event) => { 30539 onKeyDownProp == null ? void 0 : onKeyDownProp(event); 30540 if (event.defaultPrevented) return; 30541 const baseElement = store == null ? void 0 : store.getState().baseElement; 30542 if (!baseElement) return; 30543 if (hasFocus(baseElement)) return; 30544 const printable = event.key.length === 1; 30545 if (printable || event.key === "Backspace" || event.key === "Delete") { 30546 queueMicrotask(() => baseElement.focus()); 30547 if (isTextField(baseElement)) { 30548 store == null ? void 0 : store.setValue(baseElement.value); 30549 } 30550 } 30551 }); 30552 if (multiSelectable && selected != null) { 30553 props = { 30554 "aria-selected": selected, 30555 ...props 30556 }; 30557 } 30558 props = useWrapElement( 30559 props, 30560 (element) => /* @__PURE__ */ (0, import_jsx_runtime145.jsx)(ComboboxItemValueContext.Provider, { value, children: /* @__PURE__ */ (0, import_jsx_runtime145.jsx)(ComboboxItemCheckedContext.Provider, { value: selected != null ? selected : false, children: element }) }), 30561 [value, selected] 30562 ); 30563 const popupRole = (0, import_react39.useContext)(ComboboxListRoleContext); 30564 props = { 30565 role: getItemRole(popupRole), 30566 children: value, 30567 ...props, 30568 onClick, 30569 onKeyDown 30570 }; 30571 const moveOnKeyPressProp = useBooleanEvent(moveOnKeyPress); 30572 props = useCompositeItem({ 30573 store, 30574 ...props, 30575 getItem, 30576 // Dispatch a custom event on the combobox input when moving to an item 30577 // with the keyboard so the Combobox component can enable inline 30578 // autocompletion. 30579 moveOnKeyPress: (event) => { 30580 if (!moveOnKeyPressProp(event)) return false; 30581 const moveEvent = new Event("combobox-item-move"); 30582 const baseElement = store == null ? void 0 : store.getState().baseElement; 30583 baseElement == null ? void 0 : baseElement.dispatchEvent(moveEvent); 30584 return true; 30585 } 30586 }); 30587 props = useCompositeHover({ store, focusOnHover, ...props }); 30588 return props; 30589 } 30590 ); 30591 var ComboboxItem = memo22( 30592 forwardRef210(function ComboboxItem2(props) { 30593 const htmlProps = useComboboxItem(props); 30594 return createElement3(TagName10, htmlProps); 30595 }) 30596 ); 30597 30598 // node_modules/@ariakit/react-core/esm/combobox/combobox-item-value.js 30599 var import_react40 = __toESM(require_react(), 1); 30600 var import_jsx_runtime146 = __toESM(require_jsx_runtime(), 1); 30601 var TagName11 = "span"; 30602 function normalizeValue(value) { 30603 return normalizeString(value).toLowerCase(); 30604 } 30605 function getOffsets(string, values) { 30606 const offsets = []; 30607 for (const value of values) { 30608 let pos = 0; 30609 const length = value.length; 30610 while (string.indexOf(value, pos) !== -1) { 30611 const index2 = string.indexOf(value, pos); 30612 if (index2 !== -1) { 30613 offsets.push([index2, length]); 30614 } 30615 pos = index2 + 1; 30616 } 30617 } 30618 return offsets; 30619 } 30620 function filterOverlappingOffsets(offsets) { 30621 return offsets.filter(([offset4, length], i2, arr) => { 30622 return !arr.some( 30623 ([o2, l2], j2) => j2 !== i2 && o2 <= offset4 && o2 + l2 >= offset4 + length 30624 ); 30625 }); 30626 } 30627 function sortOffsets(offsets) { 30628 return offsets.sort(([a2], [b2]) => a2 - b2); 30629 } 30630 function splitValue(itemValue, userValue) { 30631 if (!itemValue) return itemValue; 30632 if (!userValue) return itemValue; 30633 const userValues = toArray(userValue).filter(Boolean).map(normalizeValue); 30634 const parts = []; 30635 const span = (value, autocomplete = false) => /* @__PURE__ */ (0, import_jsx_runtime146.jsx)( 30636 "span", 30637 { 30638 "data-autocomplete-value": autocomplete ? "" : void 0, 30639 "data-user-value": autocomplete ? void 0 : "", 30640 children: value 30641 }, 30642 parts.length 30643 ); 30644 const offsets = sortOffsets( 30645 filterOverlappingOffsets( 30646 // Convert userValues into a set to avoid duplicates 30647 getOffsets(normalizeValue(itemValue), new Set(userValues)) 30648 ) 30649 ); 30650 if (!offsets.length) { 30651 parts.push(span(itemValue, true)); 30652 return parts; 30653 } 30654 const [firstOffset] = offsets[0]; 30655 const values = [ 30656 itemValue.slice(0, firstOffset), 30657 ...offsets.flatMap(([offset4, length], i2) => { 30658 var _a; 30659 const value = itemValue.slice(offset4, offset4 + length); 30660 const nextOffset = (_a = offsets[i2 + 1]) == null ? void 0 : _a[0]; 30661 const nextValue = itemValue.slice(offset4 + length, nextOffset); 30662 return [value, nextValue]; 30663 }) 30664 ]; 30665 values.forEach((value, i2) => { 30666 if (!value) return; 30667 parts.push(span(value, i2 % 2 === 0)); 30668 }); 30669 return parts; 30670 } 30671 var useComboboxItemValue = createHook(function useComboboxItemValue2({ store, value, userValue, ...props }) { 30672 const context = useComboboxScopedContext(); 30673 store = store || context; 30674 const itemContext = (0, import_react40.useContext)(ComboboxItemValueContext); 30675 const itemValue = value != null ? value : itemContext; 30676 const inputValue = useStoreState(store, (state) => userValue != null ? userValue : state == null ? void 0 : state.value); 30677 const children = (0, import_react40.useMemo)(() => { 30678 if (!itemValue) return; 30679 if (!inputValue) return itemValue; 30680 return splitValue(itemValue, inputValue); 30681 }, [itemValue, inputValue]); 30682 props = { 30683 children, 30684 ...props 30685 }; 30686 return removeUndefinedValues(props); 30687 }); 30688 var ComboboxItemValue = forwardRef210(function ComboboxItemValue2(props) { 30689 const htmlProps = useComboboxItemValue(props); 30690 return createElement3(TagName11, htmlProps); 30691 }); 30692 30693 // node_modules/@ariakit/react-core/esm/combobox/combobox-label.js 30694 var TagName12 = "label"; 30695 var useComboboxLabel = createHook( 30696 function useComboboxLabel2({ store, ...props }) { 30697 const context = useComboboxProviderContext(); 30698 store = store || context; 30699 invariant( 30700 store, 30701 "ComboboxLabel must receive a `store` prop or be wrapped in a ComboboxProvider component." 30702 ); 30703 const comboboxId = store.useState((state) => { 30704 var _a; 30705 return (_a = state.baseElement) == null ? void 0 : _a.id; 30706 }); 30707 props = { 30708 htmlFor: comboboxId, 30709 ...props 30710 }; 30711 return removeUndefinedValues(props); 30712 } 30713 ); 30714 var ComboboxLabel = memo22( 30715 forwardRef210(function ComboboxLabel2(props) { 30716 const htmlProps = useComboboxLabel(props); 30717 return createElement3(TagName12, htmlProps); 30718 }) 30719 ); 30720 30721 // node_modules/@ariakit/react-core/esm/__chunks/2G6YEJT4.js 30722 var import_react41 = __toESM(require_react(), 1); 30723 var import_jsx_runtime147 = __toESM(require_jsx_runtime(), 1); 30724 var TagName13 = "div"; 30725 var useComboboxList = createHook( 30726 function useComboboxList2({ store, alwaysVisible, ...props }) { 30727 const scopedContext = useComboboxScopedContext(true); 30728 const context = useComboboxContext(); 30729 store = store || context; 30730 const scopedContextSameStore = !!store && store === scopedContext; 30731 invariant( 30732 store, 30733 "ComboboxList must receive a `store` prop or be wrapped in a ComboboxProvider component." 30734 ); 30735 const ref = (0, import_react41.useRef)(null); 30736 const id = useId7(props.id); 30737 const mounted = store.useState("mounted"); 30738 const hidden = isHidden3(mounted, props.hidden, alwaysVisible); 30739 const style = hidden ? { ...props.style, display: "none" } : props.style; 30740 const multiSelectable = store.useState( 30741 (state) => Array.isArray(state.selectedValue) 30742 ); 30743 const role = useAttribute(ref, "role", props.role); 30744 const isCompositeRole = role === "listbox" || role === "tree" || role === "grid"; 30745 const ariaMultiSelectable = isCompositeRole ? multiSelectable || void 0 : void 0; 30746 const [hasListboxInside, setHasListboxInside] = (0, import_react41.useState)(false); 30747 const contentElement = store.useState("contentElement"); 30748 useSafeLayoutEffect(() => { 30749 if (!mounted) return; 30750 const element = ref.current; 30751 if (!element) return; 30752 if (contentElement !== element) return; 30753 const callback = () => { 30754 setHasListboxInside(!!element.querySelector("[role='listbox']")); 30755 }; 30756 const observer = new MutationObserver(callback); 30757 observer.observe(element, { 30758 subtree: true, 30759 childList: true, 30760 attributeFilter: ["role"] 30761 }); 30762 callback(); 30763 return () => observer.disconnect(); 30764 }, [mounted, contentElement]); 30765 if (!hasListboxInside) { 30766 props = { 30767 role: "listbox", 30768 "aria-multiselectable": ariaMultiSelectable, 30769 ...props 30770 }; 30771 } 30772 props = useWrapElement( 30773 props, 30774 (element) => /* @__PURE__ */ (0, import_jsx_runtime147.jsx)(ComboboxScopedContextProvider, { value: store, children: /* @__PURE__ */ (0, import_jsx_runtime147.jsx)(ComboboxListRoleContext.Provider, { value: role, children: element }) }), 30775 [store, role] 30776 ); 30777 const setContentElement = id && (!scopedContext || !scopedContextSameStore) ? store.setContentElement : null; 30778 props = { 30779 id, 30780 hidden, 30781 ...props, 30782 ref: useMergeRefs8(setContentElement, ref, props.ref), 30783 style 30784 }; 30785 return removeUndefinedValues(props); 30786 } 30787 ); 30788 var ComboboxList = forwardRef210(function ComboboxList2(props) { 30789 const htmlProps = useComboboxList(props); 30790 return createElement3(TagName13, htmlProps); 30791 }); 30792 30793 // node_modules/@ariakit/react-core/esm/__chunks/XSIEPKGA.js 30794 var import_react42 = __toESM(require_react(), 1); 30795 var TagValueContext = (0, import_react42.createContext)(null); 30796 var TagRemoveIdContext = (0, import_react42.createContext)( 30797 null 30798 ); 30799 var ctx7 = createStoreContext( 30800 [CompositeContextProvider], 30801 [CompositeScopedContextProvider] 30802 ); 30803 var useTagContext = ctx7.useContext; 30804 var useTagScopedContext = ctx7.useScopedContext; 30805 var useTagProviderContext = ctx7.useProviderContext; 30806 var TagContextProvider = ctx7.ContextProvider; 30807 var TagScopedContextProvider = ctx7.ScopedContextProvider; 30808 30809 // node_modules/@ariakit/core/esm/combobox/combobox-store.js 30810 var isTouchSafari = isSafari2() && isTouchDevice(); 30811 function createComboboxStore({ 30812 tag, 30813 ...props 30814 } = {}) { 30815 const store = mergeStore(props.store, pick2(tag, ["value", "rtl"])); 30816 throwOnConflictingProps(props, store); 30817 const tagState = tag == null ? void 0 : tag.getState(); 30818 const syncState = store == null ? void 0 : store.getState(); 30819 const activeId = defaultValue( 30820 props.activeId, 30821 syncState == null ? void 0 : syncState.activeId, 30822 props.defaultActiveId, 30823 null 30824 ); 30825 const composite = createCompositeStore({ 30826 ...props, 30827 activeId, 30828 includesBaseElement: defaultValue( 30829 props.includesBaseElement, 30830 syncState == null ? void 0 : syncState.includesBaseElement, 30831 true 30832 ), 30833 orientation: defaultValue( 30834 props.orientation, 30835 syncState == null ? void 0 : syncState.orientation, 30836 "vertical" 30837 ), 30838 focusLoop: defaultValue(props.focusLoop, syncState == null ? void 0 : syncState.focusLoop, true), 30839 focusWrap: defaultValue(props.focusWrap, syncState == null ? void 0 : syncState.focusWrap, true), 30840 virtualFocus: defaultValue( 30841 props.virtualFocus, 30842 syncState == null ? void 0 : syncState.virtualFocus, 30843 true 30844 ) 30845 }); 30846 const popover = createPopoverStore({ 30847 ...props, 30848 placement: defaultValue( 30849 props.placement, 30850 syncState == null ? void 0 : syncState.placement, 30851 "bottom-start" 30852 ) 30853 }); 30854 const value = defaultValue( 30855 props.value, 30856 syncState == null ? void 0 : syncState.value, 30857 props.defaultValue, 30858 "" 30859 ); 30860 const selectedValue = defaultValue( 30861 props.selectedValue, 30862 syncState == null ? void 0 : syncState.selectedValue, 30863 tagState == null ? void 0 : tagState.values, 30864 props.defaultSelectedValue, 30865 "" 30866 ); 30867 const multiSelectable = Array.isArray(selectedValue); 30868 const initialState = { 30869 ...composite.getState(), 30870 ...popover.getState(), 30871 value, 30872 selectedValue, 30873 resetValueOnSelect: defaultValue( 30874 props.resetValueOnSelect, 30875 syncState == null ? void 0 : syncState.resetValueOnSelect, 30876 multiSelectable 30877 ), 30878 resetValueOnHide: defaultValue( 30879 props.resetValueOnHide, 30880 syncState == null ? void 0 : syncState.resetValueOnHide, 30881 multiSelectable && !tag 30882 ), 30883 activeValue: syncState == null ? void 0 : syncState.activeValue 30884 }; 30885 const combobox = createStore(initialState, composite, popover, store); 30886 if (isTouchSafari) { 30887 setup( 30888 combobox, 30889 () => sync(combobox, ["virtualFocus"], () => { 30890 combobox.setState("virtualFocus", false); 30891 }) 30892 ); 30893 } 30894 setup(combobox, () => { 30895 if (!tag) return; 30896 return chain( 30897 sync(combobox, ["selectedValue"], (state) => { 30898 if (!Array.isArray(state.selectedValue)) return; 30899 tag.setValues(state.selectedValue); 30900 }), 30901 sync(tag, ["values"], (state) => { 30902 combobox.setState("selectedValue", state.values); 30903 }) 30904 ); 30905 }); 30906 setup( 30907 combobox, 30908 () => sync(combobox, ["resetValueOnHide", "mounted"], (state) => { 30909 if (!state.resetValueOnHide) return; 30910 if (state.mounted) return; 30911 combobox.setState("value", value); 30912 }) 30913 ); 30914 setup( 30915 combobox, 30916 () => sync(combobox, ["open"], (state) => { 30917 if (state.open) return; 30918 combobox.setState("activeId", activeId); 30919 combobox.setState("moves", 0); 30920 }) 30921 ); 30922 setup( 30923 combobox, 30924 () => sync(combobox, ["moves", "activeId"], (state, prevState) => { 30925 if (state.moves === prevState.moves) { 30926 combobox.setState("activeValue", void 0); 30927 } 30928 }) 30929 ); 30930 setup( 30931 combobox, 30932 () => batch(combobox, ["moves", "renderedItems"], (state, prev) => { 30933 if (state.moves === prev.moves) return; 30934 const { activeId: activeId2 } = combobox.getState(); 30935 const activeItem = composite.item(activeId2); 30936 combobox.setState("activeValue", activeItem == null ? void 0 : activeItem.value); 30937 }) 30938 ); 30939 return { 30940 ...popover, 30941 ...composite, 30942 ...combobox, 30943 tag, 30944 setValue: (value2) => combobox.setState("value", value2), 30945 resetValue: () => combobox.setState("value", initialState.value), 30946 setSelectedValue: (selectedValue2) => combobox.setState("selectedValue", selectedValue2) 30947 }; 30948 } 30949 30950 // node_modules/@ariakit/react-core/esm/__chunks/SVN33SY6.js 30951 function useComboboxStoreOptions(props) { 30952 const tag = useTagContext(); 30953 props = { 30954 ...props, 30955 tag: props.tag !== void 0 ? props.tag : tag 30956 }; 30957 return useCompositeStoreOptions(props); 30958 } 30959 function useComboboxStoreProps(store, update2, props) { 30960 useUpdateEffect(update2, [props.tag]); 30961 useStoreProps(store, props, "value", "setValue"); 30962 useStoreProps(store, props, "selectedValue", "setSelectedValue"); 30963 useStoreProps(store, props, "resetValueOnHide"); 30964 useStoreProps(store, props, "resetValueOnSelect"); 30965 return Object.assign( 30966 useCompositeStoreProps( 30967 usePopoverStoreProps(store, update2, props), 30968 update2, 30969 props 30970 ), 30971 { tag: props.tag } 30972 ); 30973 } 30974 function useComboboxStore(props = {}) { 30975 props = useComboboxStoreOptions(props); 30976 const [store, update2] = useStore2(createComboboxStore, props); 30977 return useComboboxStoreProps(store, update2, props); 30978 } 30979 30980 // node_modules/@ariakit/react-core/esm/combobox/combobox-provider.js 30981 var import_jsx_runtime148 = __toESM(require_jsx_runtime(), 1); 30982 function ComboboxProvider(props = {}) { 30983 const store = useComboboxStore(props); 30984 return /* @__PURE__ */ (0, import_jsx_runtime148.jsx)(ComboboxContextProvider, { value: store, children: props.children }); 30985 } 30986 30987 // packages/dataviews/build-module/components/dataviews-filters/search-widget.mjs 30988 var import_remove_accents = __toESM(require_remove_accents(), 1); 30989 var import_compose14 = __toESM(require_compose(), 1); 30990 var import_i18n29 = __toESM(require_i18n(), 1); 30991 var import_element112 = __toESM(require_element(), 1); 30992 var import_components19 = __toESM(require_components(), 1); 30993 30994 // packages/dataviews/build-module/components/dataviews-filters/utils.mjs 30995 var EMPTY_ARRAY3 = []; 30996 var getCurrentValue = (filterDefinition, currentFilter) => { 30997 if (filterDefinition.singleSelection) { 30998 return currentFilter?.value; 30999 } 31000 if (Array.isArray(currentFilter?.value)) { 31001 return currentFilter.value; 31002 } 31003 if (!Array.isArray(currentFilter?.value) && !!currentFilter?.value) { 31004 return [currentFilter.value]; 31005 } 31006 return EMPTY_ARRAY3; 31007 }; 31008 31009 // packages/dataviews/build-module/hooks/use-elements.mjs 31010 var import_element111 = __toESM(require_element(), 1); 31011 var EMPTY_ARRAY4 = []; 31012 function useElements({ 31013 elements, 31014 getElements 31015 }) { 31016 const staticElements = Array.isArray(elements) && elements.length > 0 ? elements : EMPTY_ARRAY4; 31017 const [records, setRecords] = (0, import_element111.useState)(staticElements); 31018 const [isLoading, setIsLoading] = (0, import_element111.useState)(false); 31019 (0, import_element111.useEffect)(() => { 31020 if (!getElements) { 31021 setRecords(staticElements); 31022 return; 31023 } 31024 let cancelled = false; 31025 setIsLoading(true); 31026 getElements().then((fetchedElements) => { 31027 if (!cancelled) { 31028 const dynamicElements = Array.isArray(fetchedElements) && fetchedElements.length > 0 ? fetchedElements : staticElements; 31029 setRecords(dynamicElements); 31030 } 31031 }).catch(() => { 31032 if (!cancelled) { 31033 setRecords(staticElements); 31034 } 31035 }).finally(() => { 31036 if (!cancelled) { 31037 setIsLoading(false); 31038 } 31039 }); 31040 return () => { 31041 cancelled = true; 31042 }; 31043 }, [getElements, staticElements]); 31044 return { 31045 elements: records, 31046 isLoading 31047 }; 31048 } 31049 31050 // packages/dataviews/build-module/components/dataviews-filters/search-widget.mjs 31051 var import_jsx_runtime149 = __toESM(require_jsx_runtime(), 1); 31052 function normalizeSearchInput(input = "") { 31053 return (0, import_remove_accents.default)(input.trim().toLowerCase()); 31054 } 31055 var getNewValue = (filterDefinition, currentFilter, value) => { 31056 if (filterDefinition.singleSelection) { 31057 return value; 31058 } 31059 if (Array.isArray(currentFilter?.value)) { 31060 return currentFilter.value.includes(value) ? currentFilter.value.filter((v2) => v2 !== value) : [...currentFilter.value, value]; 31061 } 31062 return [value]; 31063 }; 31064 function generateFilterElementCompositeItemId(prefix, filterElementValue) { 31065 return `$prefix}-$filterElementValue}`; 31066 } 31067 var MultiSelectionOption = ({ selected }) => { 31068 return /* @__PURE__ */ (0, import_jsx_runtime149.jsx)( 31069 "span", 31070 { 31071 className: clsx_default( 31072 "dataviews-filters__search-widget-listitem-multi-selection", 31073 { "is-selected": selected } 31074 ), 31075 children: selected && /* @__PURE__ */ (0, import_jsx_runtime149.jsx)(import_components19.Icon, { icon: check_default }) 31076 } 31077 ); 31078 }; 31079 var SingleSelectionOption = ({ selected }) => { 31080 return /* @__PURE__ */ (0, import_jsx_runtime149.jsx)( 31081 "span", 31082 { 31083 className: clsx_default( 31084 "dataviews-filters__search-widget-listitem-single-selection", 31085 { "is-selected": selected } 31086 ) 31087 } 31088 ); 31089 }; 31090 function ListBox({ view, filter, onChangeView }) { 31091 const baseId = (0, import_compose14.useInstanceId)(ListBox, "dataviews-filter-list-box"); 31092 const [activeCompositeId, setActiveCompositeId] = (0, import_element112.useState)( 31093 // When there are one or less operators, the first item is set as active 31094 // (by setting the initial `activeId` to `undefined`). 31095 // With 2 or more operators, the focus is moved on the operators control 31096 // (by setting the initial `activeId` to `null`), meaning that there won't 31097 // be an active item initially. Focus is then managed via the 31098 // `onFocusVisible` callback. 31099 filter.operators?.length === 1 ? void 0 : null 31100 ); 31101 const currentFilter = view.filters?.find( 31102 (f2) => f2.field === filter.field 31103 ); 31104 const currentValue = getCurrentValue(filter, currentFilter); 31105 return /* @__PURE__ */ (0, import_jsx_runtime149.jsx)( 31106 import_components19.Composite, 31107 { 31108 virtualFocus: true, 31109 focusLoop: true, 31110 activeId: activeCompositeId, 31111 setActiveId: setActiveCompositeId, 31112 role: "listbox", 31113 className: "dataviews-filters__search-widget-listbox", 31114 "aria-label": (0, import_i18n29.sprintf)( 31115 /* translators: List of items for a filter. 1: Filter name. e.g.: "List of: Author". */ 31116 (0, import_i18n29.__)("List of: %1$s"), 31117 filter.name 31118 ), 31119 onFocusVisible: () => { 31120 if (!activeCompositeId && filter.elements.length) { 31121 setActiveCompositeId( 31122 generateFilterElementCompositeItemId( 31123 baseId, 31124 filter.elements[0].value 31125 ) 31126 ); 31127 } 31128 }, 31129 render: /* @__PURE__ */ (0, import_jsx_runtime149.jsx)(import_components19.Composite.Typeahead, {}), 31130 children: filter.elements.map((element) => /* @__PURE__ */ (0, import_jsx_runtime149.jsxs)( 31131 import_components19.Composite.Hover, 31132 { 31133 render: /* @__PURE__ */ (0, import_jsx_runtime149.jsx)( 31134 import_components19.Composite.Item, 31135 { 31136 id: generateFilterElementCompositeItemId( 31137 baseId, 31138 element.value 31139 ), 31140 render: /* @__PURE__ */ (0, import_jsx_runtime149.jsx)( 31141 "div", 31142 { 31143 "aria-label": element.label, 31144 role: "option", 31145 className: "dataviews-filters__search-widget-listitem" 31146 } 31147 ), 31148 onClick: () => { 31149 const newFilters = currentFilter ? [ 31150 ...(view.filters ?? []).map( 31151 (_filter) => { 31152 if (_filter.field === filter.field) { 31153 return { 31154 ..._filter, 31155 operator: currentFilter.operator || filter.operators[0], 31156 value: getNewValue( 31157 filter, 31158 currentFilter, 31159 element.value 31160 ) 31161 }; 31162 } 31163 return _filter; 31164 } 31165 ) 31166 ] : [ 31167 ...view.filters ?? [], 31168 { 31169 field: filter.field, 31170 operator: filter.operators[0], 31171 value: getNewValue( 31172 filter, 31173 currentFilter, 31174 element.value 31175 ) 31176 } 31177 ]; 31178 onChangeView({ 31179 ...view, 31180 page: 1, 31181 filters: newFilters 31182 }); 31183 } 31184 } 31185 ), 31186 children: [ 31187 filter.singleSelection && /* @__PURE__ */ (0, import_jsx_runtime149.jsx)( 31188 SingleSelectionOption, 31189 { 31190 selected: currentValue === element.value 31191 } 31192 ), 31193 !filter.singleSelection && /* @__PURE__ */ (0, import_jsx_runtime149.jsx)( 31194 MultiSelectionOption, 31195 { 31196 selected: currentValue.includes(element.value) 31197 } 31198 ), 31199 /* @__PURE__ */ (0, import_jsx_runtime149.jsx)( 31200 "span", 31201 { 31202 className: "dataviews-filters__search-widget-listitem-value", 31203 title: element.label, 31204 children: element.label 31205 } 31206 ) 31207 ] 31208 }, 31209 element.value 31210 )) 31211 } 31212 ); 31213 } 31214 function ComboboxList22({ view, filter, onChangeView }) { 31215 const [searchValue, setSearchValue] = (0, import_element112.useState)(""); 31216 const deferredSearchValue = (0, import_element112.useDeferredValue)(searchValue); 31217 const currentFilter = view.filters?.find( 31218 (_filter) => _filter.field === filter.field 31219 ); 31220 const currentValue = getCurrentValue(filter, currentFilter); 31221 const matches2 = (0, import_element112.useMemo)(() => { 31222 const normalizedSearch = normalizeSearchInput(deferredSearchValue); 31223 return filter.elements.filter( 31224 (item) => normalizeSearchInput(item.label).includes(normalizedSearch) 31225 ); 31226 }, [filter.elements, deferredSearchValue]); 31227 return /* @__PURE__ */ (0, import_jsx_runtime149.jsxs)( 31228 ComboboxProvider, 31229 { 31230 selectedValue: currentValue, 31231 setSelectedValue: (value) => { 31232 const newFilters = currentFilter ? [ 31233 ...(view.filters ?? []).map((_filter) => { 31234 if (_filter.field === filter.field) { 31235 return { 31236 ..._filter, 31237 operator: currentFilter.operator || filter.operators[0], 31238 value 31239 }; 31240 } 31241 return _filter; 31242 }) 31243 ] : [ 31244 ...view.filters ?? [], 31245 { 31246 field: filter.field, 31247 operator: filter.operators[0], 31248 value 31249 } 31250 ]; 31251 onChangeView({ 31252 ...view, 31253 page: 1, 31254 filters: newFilters 31255 }); 31256 }, 31257 setValue: setSearchValue, 31258 children: [ 31259 /* @__PURE__ */ (0, import_jsx_runtime149.jsxs)("div", { className: "dataviews-filters__search-widget-filter-combobox__wrapper", children: [ 31260 /* @__PURE__ */ (0, import_jsx_runtime149.jsx)(VisuallyHidden, { render: /* @__PURE__ */ (0, import_jsx_runtime149.jsx)(ComboboxLabel, {}), children: (0, import_i18n29.__)("Search items") }), 31261 /* @__PURE__ */ (0, import_jsx_runtime149.jsx)( 31262 Combobox, 31263 { 31264 autoSelect: "always", 31265 placeholder: (0, import_i18n29.__)("Search"), 31266 className: "dataviews-filters__search-widget-filter-combobox__input" 31267 } 31268 ), 31269 /* @__PURE__ */ (0, import_jsx_runtime149.jsx)("div", { className: "dataviews-filters__search-widget-filter-combobox__icon", children: /* @__PURE__ */ (0, import_jsx_runtime149.jsx)(import_components19.Icon, { icon: search_default }) }) 31270 ] }), 31271 /* @__PURE__ */ (0, import_jsx_runtime149.jsxs)( 31272 ComboboxList, 31273 { 31274 className: "dataviews-filters__search-widget-filter-combobox-list", 31275 alwaysVisible: true, 31276 children: [ 31277 matches2.map((element) => { 31278 return /* @__PURE__ */ (0, import_jsx_runtime149.jsxs)( 31279 ComboboxItem, 31280 { 31281 resetValueOnSelect: false, 31282 value: element.value, 31283 className: "dataviews-filters__search-widget-listitem", 31284 hideOnClick: false, 31285 setValueOnClick: false, 31286 focusOnHover: true, 31287 children: [ 31288 filter.singleSelection && /* @__PURE__ */ (0, import_jsx_runtime149.jsx)( 31289 SingleSelectionOption, 31290 { 31291 selected: currentValue === element.value 31292 } 31293 ), 31294 !filter.singleSelection && /* @__PURE__ */ (0, import_jsx_runtime149.jsx)( 31295 MultiSelectionOption, 31296 { 31297 selected: currentValue.includes( 31298 element.value 31299 ) 31300 } 31301 ), 31302 /* @__PURE__ */ (0, import_jsx_runtime149.jsxs)( 31303 "span", 31304 { 31305 className: "dataviews-filters__search-widget-listitem-value", 31306 title: element.label, 31307 children: [ 31308 /* @__PURE__ */ (0, import_jsx_runtime149.jsx)( 31309 ComboboxItemValue, 31310 { 31311 className: "dataviews-filters__search-widget-filter-combobox-item-value", 31312 value: element.label 31313 } 31314 ), 31315 !!element.description && /* @__PURE__ */ (0, import_jsx_runtime149.jsx)("span", { className: "dataviews-filters__search-widget-listitem-description", children: element.description }) 31316 ] 31317 } 31318 ) 31319 ] 31320 }, 31321 element.value 31322 ); 31323 }), 31324 !matches2.length && /* @__PURE__ */ (0, import_jsx_runtime149.jsx)("p", { children: (0, import_i18n29.__)("No results found") }) 31325 ] 31326 } 31327 ) 31328 ] 31329 } 31330 ); 31331 } 31332 function SearchWidget(props) { 31333 const { elements, isLoading } = useElements({ 31334 elements: props.filter.elements, 31335 getElements: props.filter.getElements 31336 }); 31337 if (isLoading) { 31338 return /* @__PURE__ */ (0, import_jsx_runtime149.jsx)("div", { className: "dataviews-filters__search-widget-no-elements", children: /* @__PURE__ */ (0, import_jsx_runtime149.jsx)(import_components19.Spinner, {}) }); 31339 } 31340 if (elements.length === 0) { 31341 return /* @__PURE__ */ (0, import_jsx_runtime149.jsx)("div", { className: "dataviews-filters__search-widget-no-elements", children: (0, import_i18n29.__)("No elements found") }); 31342 } 31343 const Widget = elements.length > 10 ? ComboboxList22 : ListBox; 31344 return /* @__PURE__ */ (0, import_jsx_runtime149.jsx)(Widget, { ...props, filter: { ...props.filter, elements } }); 31345 } 31346 31347 // packages/dataviews/build-module/components/dataviews-filters/input-widget.mjs 31348 var import_es63 = __toESM(require_es6(), 1); 31349 var import_compose15 = __toESM(require_compose(), 1); 31350 var import_element113 = __toESM(require_element(), 1); 31351 var import_components20 = __toESM(require_components(), 1); 31352 var import_jsx_runtime150 = __toESM(require_jsx_runtime(), 1); 31353 function InputWidget({ 31354 filter, 31355 view, 31356 onChangeView, 31357 fields: fields3 31358 }) { 31359 const currentFilter = view.filters?.find( 31360 (f2) => f2.field === filter.field 31361 ); 31362 const currentValue = getCurrentValue(filter, currentFilter); 31363 const field = (0, import_element113.useMemo)(() => { 31364 const currentField = fields3.find((f2) => f2.id === filter.field); 31365 if (currentField) { 31366 return { 31367 ...currentField, 31368 // Deactivate validation for filters. 31369 isValid: {}, 31370 // Filter controls are always enabled. 31371 isDisabled: () => false, 31372 // Filter controls are always visible. 31373 isVisible: () => true, 31374 // Configure getValue/setValue as if Item was a plain object. 31375 getValue: ({ item }) => item[currentField.id], 31376 setValue: ({ value }) => ({ 31377 [currentField.id]: value 31378 }) 31379 }; 31380 } 31381 return currentField; 31382 }, [fields3, filter.field]); 31383 const data = (0, import_element113.useMemo)(() => { 31384 return (view.filters ?? []).reduce( 31385 (acc, activeFilter) => { 31386 acc[activeFilter.field] = activeFilter.value; 31387 return acc; 31388 }, 31389 {} 31390 ); 31391 }, [view.filters]); 31392 const handleChange = (0, import_compose15.useEvent)((updatedData) => { 31393 if (!field || !currentFilter) { 31394 return; 31395 } 31396 const nextValue = field.getValue({ item: updatedData }); 31397 if ((0, import_es63.default)(nextValue, currentValue)) { 31398 return; 31399 } 31400 onChangeView({ 31401 ...view, 31402 filters: (view.filters ?? []).map( 31403 (_filter) => _filter.field === filter.field ? { 31404 ..._filter, 31405 operator: currentFilter.operator || filter.operators[0], 31406 // Consider empty strings as undefined: 31407 // 31408 // - undefined as value means the filter is unset: the filter widget displays no value and the search returns all records 31409 // - empty string as value means "search empty string": returns only the records that have an empty string as value 31410 // 31411 // In practice, this means the filter will not be able to find an empty string as the value. 31412 value: nextValue === "" ? void 0 : nextValue 31413 } : _filter 31414 ) 31415 }); 31416 }); 31417 if (!field || !field.Edit || !currentFilter) { 31418 return null; 31419 } 31420 return /* @__PURE__ */ (0, import_jsx_runtime150.jsx)( 31421 import_components20.Flex, 31422 { 31423 className: "dataviews-filters__user-input-widget", 31424 gap: 2.5, 31425 direction: "column", 31426 children: /* @__PURE__ */ (0, import_jsx_runtime150.jsx)( 31427 field.Edit, 31428 { 31429 hideLabelFromVision: true, 31430 data, 31431 field, 31432 operator: currentFilter.operator, 31433 onChange: handleChange 31434 } 31435 ) 31436 } 31437 ); 31438 } 31439 31440 // node_modules/date-fns/constants.js 31441 var daysInYear = 365.2425; 31442 var maxTime = Math.pow(10, 8) * 24 * 60 * 60 * 1e3; 31443 var minTime = -maxTime; 31444 var millisecondsInWeek = 6048e5; 31445 var millisecondsInDay = 864e5; 31446 var secondsInHour = 3600; 31447 var secondsInDay = secondsInHour * 24; 31448 var secondsInWeek = secondsInDay * 7; 31449 var secondsInYear = secondsInDay * daysInYear; 31450 var secondsInMonth = secondsInYear / 12; 31451 var secondsInQuarter = secondsInMonth * 3; 31452 var constructFromSymbol = /* @__PURE__ */ Symbol.for("constructDateFrom"); 31453 31454 // node_modules/date-fns/constructFrom.js 31455 function constructFrom(date, value) { 31456 if (typeof date === "function") return date(value); 31457 if (date && typeof date === "object" && constructFromSymbol in date) 31458 return date[constructFromSymbol](value); 31459 if (date instanceof Date) return new date.constructor(value); 31460 return new Date(value); 31461 } 31462 31463 // node_modules/date-fns/toDate.js 31464 function toDate(argument, context) { 31465 return constructFrom(context || argument, argument); 31466 } 31467 31468 // node_modules/date-fns/addDays.js 31469 function addDays(date, amount, options) { 31470 const _date = toDate(date, options?.in); 31471 if (isNaN(amount)) return constructFrom(options?.in || date, NaN); 31472 if (!amount) return _date; 31473 _date.setDate(_date.getDate() + amount); 31474 return _date; 31475 } 31476 31477 // node_modules/date-fns/addMonths.js 31478 function addMonths(date, amount, options) { 31479 const _date = toDate(date, options?.in); 31480 if (isNaN(amount)) return constructFrom(options?.in || date, NaN); 31481 if (!amount) { 31482 return _date; 31483 } 31484 const dayOfMonth = _date.getDate(); 31485 const endOfDesiredMonth = constructFrom(options?.in || date, _date.getTime()); 31486 endOfDesiredMonth.setMonth(_date.getMonth() + amount + 1, 0); 31487 const daysInMonth = endOfDesiredMonth.getDate(); 31488 if (dayOfMonth >= daysInMonth) { 31489 return endOfDesiredMonth; 31490 } else { 31491 _date.setFullYear( 31492 endOfDesiredMonth.getFullYear(), 31493 endOfDesiredMonth.getMonth(), 31494 dayOfMonth 31495 ); 31496 return _date; 31497 } 31498 } 31499 31500 // node_modules/date-fns/_lib/defaultOptions.js 31501 var defaultOptions = {}; 31502 function getDefaultOptions() { 31503 return defaultOptions; 31504 } 31505 31506 // node_modules/date-fns/startOfWeek.js 31507 function startOfWeek(date, options) { 31508 const defaultOptions3 = getDefaultOptions(); 31509 const weekStartsOn = options?.weekStartsOn ?? options?.locale?.options?.weekStartsOn ?? defaultOptions3.weekStartsOn ?? defaultOptions3.locale?.options?.weekStartsOn ?? 0; 31510 const _date = toDate(date, options?.in); 31511 const day = _date.getDay(); 31512 const diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn; 31513 _date.setDate(_date.getDate() - diff); 31514 _date.setHours(0, 0, 0, 0); 31515 return _date; 31516 } 31517 31518 // node_modules/date-fns/startOfISOWeek.js 31519 function startOfISOWeek(date, options) { 31520 return startOfWeek(date, { ...options, weekStartsOn: 1 }); 31521 } 31522 31523 // node_modules/date-fns/getISOWeekYear.js 31524 function getISOWeekYear(date, options) { 31525 const _date = toDate(date, options?.in); 31526 const year = _date.getFullYear(); 31527 const fourthOfJanuaryOfNextYear = constructFrom(_date, 0); 31528 fourthOfJanuaryOfNextYear.setFullYear(year + 1, 0, 4); 31529 fourthOfJanuaryOfNextYear.setHours(0, 0, 0, 0); 31530 const startOfNextYear = startOfISOWeek(fourthOfJanuaryOfNextYear); 31531 const fourthOfJanuaryOfThisYear = constructFrom(_date, 0); 31532 fourthOfJanuaryOfThisYear.setFullYear(year, 0, 4); 31533 fourthOfJanuaryOfThisYear.setHours(0, 0, 0, 0); 31534 const startOfThisYear = startOfISOWeek(fourthOfJanuaryOfThisYear); 31535 if (_date.getTime() >= startOfNextYear.getTime()) { 31536 return year + 1; 31537 } else if (_date.getTime() >= startOfThisYear.getTime()) { 31538 return year; 31539 } else { 31540 return year - 1; 31541 } 31542 } 31543 31544 // node_modules/date-fns/_lib/getTimezoneOffsetInMilliseconds.js 31545 function getTimezoneOffsetInMilliseconds(date) { 31546 const _date = toDate(date); 31547 const utcDate = new Date( 31548 Date.UTC( 31549 _date.getFullYear(), 31550 _date.getMonth(), 31551 _date.getDate(), 31552 _date.getHours(), 31553 _date.getMinutes(), 31554 _date.getSeconds(), 31555 _date.getMilliseconds() 31556 ) 31557 ); 31558 utcDate.setUTCFullYear(_date.getFullYear()); 31559 return +date - +utcDate; 31560 } 31561 31562 // node_modules/date-fns/_lib/normalizeDates.js 31563 function normalizeDates(context, ...dates) { 31564 const normalize = constructFrom.bind( 31565 null, 31566 context || dates.find((date) => typeof date === "object") 31567 ); 31568 return dates.map(normalize); 31569 } 31570 31571 // node_modules/date-fns/startOfDay.js 31572 function startOfDay(date, options) { 31573 const _date = toDate(date, options?.in); 31574 _date.setHours(0, 0, 0, 0); 31575 return _date; 31576 } 31577 31578 // node_modules/date-fns/differenceInCalendarDays.js 31579 function differenceInCalendarDays(laterDate, earlierDate, options) { 31580 const [laterDate_, earlierDate_] = normalizeDates( 31581 options?.in, 31582 laterDate, 31583 earlierDate 31584 ); 31585 const laterStartOfDay = startOfDay(laterDate_); 31586 const earlierStartOfDay = startOfDay(earlierDate_); 31587 const laterTimestamp = +laterStartOfDay - getTimezoneOffsetInMilliseconds(laterStartOfDay); 31588 const earlierTimestamp = +earlierStartOfDay - getTimezoneOffsetInMilliseconds(earlierStartOfDay); 31589 return Math.round((laterTimestamp - earlierTimestamp) / millisecondsInDay); 31590 } 31591 31592 // node_modules/date-fns/startOfISOWeekYear.js 31593 function startOfISOWeekYear(date, options) { 31594 const year = getISOWeekYear(date, options); 31595 const fourthOfJanuary = constructFrom(options?.in || date, 0); 31596 fourthOfJanuary.setFullYear(year, 0, 4); 31597 fourthOfJanuary.setHours(0, 0, 0, 0); 31598 return startOfISOWeek(fourthOfJanuary); 31599 } 31600 31601 // node_modules/date-fns/addWeeks.js 31602 function addWeeks(date, amount, options) { 31603 return addDays(date, amount * 7, options); 31604 } 31605 31606 // node_modules/date-fns/addYears.js 31607 function addYears(date, amount, options) { 31608 return addMonths(date, amount * 12, options); 31609 } 31610 31611 // node_modules/date-fns/isDate.js 31612 function isDate(value) { 31613 return value instanceof Date || typeof value === "object" && Object.prototype.toString.call(value) === "[object Date]"; 31614 } 31615 31616 // node_modules/date-fns/isValid.js 31617 function isValid(date) { 31618 return !(!isDate(date) && typeof date !== "number" || isNaN(+toDate(date))); 31619 } 31620 31621 // node_modules/date-fns/startOfMonth.js 31622 function startOfMonth(date, options) { 31623 const _date = toDate(date, options?.in); 31624 _date.setDate(1); 31625 _date.setHours(0, 0, 0, 0); 31626 return _date; 31627 } 31628 31629 // node_modules/date-fns/startOfYear.js 31630 function startOfYear(date, options) { 31631 const date_ = toDate(date, options?.in); 31632 date_.setFullYear(date_.getFullYear(), 0, 1); 31633 date_.setHours(0, 0, 0, 0); 31634 return date_; 31635 } 31636 31637 // node_modules/date-fns/locale/en-US/_lib/formatDistance.js 31638 var formatDistanceLocale = { 31639 lessThanXSeconds: { 31640 one: "less than a second", 31641 other: "less than {{count}} seconds" 31642 }, 31643 xSeconds: { 31644 one: "1 second", 31645 other: "{{count}} seconds" 31646 }, 31647 halfAMinute: "half a minute", 31648 lessThanXMinutes: { 31649 one: "less than a minute", 31650 other: "less than {{count}} minutes" 31651 }, 31652 xMinutes: { 31653 one: "1 minute", 31654 other: "{{count}} minutes" 31655 }, 31656 aboutXHours: { 31657 one: "about 1 hour", 31658 other: "about {{count}} hours" 31659 }, 31660 xHours: { 31661 one: "1 hour", 31662 other: "{{count}} hours" 31663 }, 31664 xDays: { 31665 one: "1 day", 31666 other: "{{count}} days" 31667 }, 31668 aboutXWeeks: { 31669 one: "about 1 week", 31670 other: "about {{count}} weeks" 31671 }, 31672 xWeeks: { 31673 one: "1 week", 31674 other: "{{count}} weeks" 31675 }, 31676 aboutXMonths: { 31677 one: "about 1 month", 31678 other: "about {{count}} months" 31679 }, 31680 xMonths: { 31681 one: "1 month", 31682 other: "{{count}} months" 31683 }, 31684 aboutXYears: { 31685 one: "about 1 year", 31686 other: "about {{count}} years" 31687 }, 31688 xYears: { 31689 one: "1 year", 31690 other: "{{count}} years" 31691 }, 31692 overXYears: { 31693 one: "over 1 year", 31694 other: "over {{count}} years" 31695 }, 31696 almostXYears: { 31697 one: "almost 1 year", 31698 other: "almost {{count}} years" 31699 } 31700 }; 31701 var formatDistance = (token, count, options) => { 31702 let result; 31703 const tokenValue = formatDistanceLocale[token]; 31704 if (typeof tokenValue === "string") { 31705 result = tokenValue; 31706 } else if (count === 1) { 31707 result = tokenValue.one; 31708 } else { 31709 result = tokenValue.other.replace("{{count}}", count.toString()); 31710 } 31711 if (options?.addSuffix) { 31712 if (options.comparison && options.comparison > 0) { 31713 return "in " + result; 31714 } else { 31715 return result + " ago"; 31716 } 31717 } 31718 return result; 31719 }; 31720 31721 // node_modules/date-fns/locale/_lib/buildFormatLongFn.js 31722 function buildFormatLongFn(args) { 31723 return (options = {}) => { 31724 const width = options.width ? String(options.width) : args.defaultWidth; 31725 const format6 = args.formats[width] || args.formats[args.defaultWidth]; 31726 return format6; 31727 }; 31728 } 31729 31730 // node_modules/date-fns/locale/en-US/_lib/formatLong.js 31731 var dateFormats = { 31732 full: "EEEE, MMMM do, y", 31733 long: "MMMM do, y", 31734 medium: "MMM d, y", 31735 short: "MM/dd/yyyy" 31736 }; 31737 var timeFormats = { 31738 full: "h:mm:ss a zzzz", 31739 long: "h:mm:ss a z", 31740 medium: "h:mm:ss a", 31741 short: "h:mm a" 31742 }; 31743 var dateTimeFormats = { 31744 full: "{{date}} 'at' {{time}}", 31745 long: "{{date}} 'at' {{time}}", 31746 medium: "{{date}}, {{time}}", 31747 short: "{{date}}, {{time}}" 31748 }; 31749 var formatLong = { 31750 date: buildFormatLongFn({ 31751 formats: dateFormats, 31752 defaultWidth: "full" 31753 }), 31754 time: buildFormatLongFn({ 31755 formats: timeFormats, 31756 defaultWidth: "full" 31757 }), 31758 dateTime: buildFormatLongFn({ 31759 formats: dateTimeFormats, 31760 defaultWidth: "full" 31761 }) 31762 }; 31763 31764 // node_modules/date-fns/locale/en-US/_lib/formatRelative.js 31765 var formatRelativeLocale = { 31766 lastWeek: "'last' eeee 'at' p", 31767 yesterday: "'yesterday at' p", 31768 today: "'today at' p", 31769 tomorrow: "'tomorrow at' p", 31770 nextWeek: "eeee 'at' p", 31771 other: "P" 31772 }; 31773 var formatRelative = (token, _date, _baseDate, _options) => formatRelativeLocale[token]; 31774 31775 // node_modules/date-fns/locale/_lib/buildLocalizeFn.js 31776 function buildLocalizeFn(args) { 31777 return (value, options) => { 31778 const context = options?.context ? String(options.context) : "standalone"; 31779 let valuesArray; 31780 if (context === "formatting" && args.formattingValues) { 31781 const defaultWidth = args.defaultFormattingWidth || args.defaultWidth; 31782 const width = options?.width ? String(options.width) : defaultWidth; 31783 valuesArray = args.formattingValues[width] || args.formattingValues[defaultWidth]; 31784 } else { 31785 const defaultWidth = args.defaultWidth; 31786 const width = options?.width ? String(options.width) : args.defaultWidth; 31787 valuesArray = args.values[width] || args.values[defaultWidth]; 31788 } 31789 const index2 = args.argumentCallback ? args.argumentCallback(value) : value; 31790 return valuesArray[index2]; 31791 }; 31792 } 31793 31794 // node_modules/date-fns/locale/en-US/_lib/localize.js 31795 var eraValues = { 31796 narrow: ["B", "A"], 31797 abbreviated: ["BC", "AD"], 31798 wide: ["Before Christ", "Anno Domini"] 31799 }; 31800 var quarterValues = { 31801 narrow: ["1", "2", "3", "4"], 31802 abbreviated: ["Q1", "Q2", "Q3", "Q4"], 31803 wide: ["1st quarter", "2nd quarter", "3rd quarter", "4th quarter"] 31804 }; 31805 var monthValues = { 31806 narrow: ["J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"], 31807 abbreviated: [ 31808 "Jan", 31809 "Feb", 31810 "Mar", 31811 "Apr", 31812 "May", 31813 "Jun", 31814 "Jul", 31815 "Aug", 31816 "Sep", 31817 "Oct", 31818 "Nov", 31819 "Dec" 31820 ], 31821 wide: [ 31822 "January", 31823 "February", 31824 "March", 31825 "April", 31826 "May", 31827 "June", 31828 "July", 31829 "August", 31830 "September", 31831 "October", 31832 "November", 31833 "December" 31834 ] 31835 }; 31836 var dayValues = { 31837 narrow: ["S", "M", "T", "W", "T", "F", "S"], 31838 short: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"], 31839 abbreviated: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], 31840 wide: [ 31841 "Sunday", 31842 "Monday", 31843 "Tuesday", 31844 "Wednesday", 31845 "Thursday", 31846 "Friday", 31847 "Saturday" 31848 ] 31849 }; 31850 var dayPeriodValues = { 31851 narrow: { 31852 am: "a", 31853 pm: "p", 31854 midnight: "mi", 31855 noon: "n", 31856 morning: "morning", 31857 afternoon: "afternoon", 31858 evening: "evening", 31859 night: "night" 31860 }, 31861 abbreviated: { 31862 am: "AM", 31863 pm: "PM", 31864 midnight: "midnight", 31865 noon: "noon", 31866 morning: "morning", 31867 afternoon: "afternoon", 31868 evening: "evening", 31869 night: "night" 31870 }, 31871 wide: { 31872 am: "a.m.", 31873 pm: "p.m.", 31874 midnight: "midnight", 31875 noon: "noon", 31876 morning: "morning", 31877 afternoon: "afternoon", 31878 evening: "evening", 31879 night: "night" 31880 } 31881 }; 31882 var formattingDayPeriodValues = { 31883 narrow: { 31884 am: "a", 31885 pm: "p", 31886 midnight: "mi", 31887 noon: "n", 31888 morning: "in the morning", 31889 afternoon: "in the afternoon", 31890 evening: "in the evening", 31891 night: "at night" 31892 }, 31893 abbreviated: { 31894 am: "AM", 31895 pm: "PM", 31896 midnight: "midnight", 31897 noon: "noon", 31898 morning: "in the morning", 31899 afternoon: "in the afternoon", 31900 evening: "in the evening", 31901 night: "at night" 31902 }, 31903 wide: { 31904 am: "a.m.", 31905 pm: "p.m.", 31906 midnight: "midnight", 31907 noon: "noon", 31908 morning: "in the morning", 31909 afternoon: "in the afternoon", 31910 evening: "in the evening", 31911 night: "at night" 31912 } 31913 }; 31914 var ordinalNumber = (dirtyNumber, _options) => { 31915 const number = Number(dirtyNumber); 31916 const rem100 = number % 100; 31917 if (rem100 > 20 || rem100 < 10) { 31918 switch (rem100 % 10) { 31919 case 1: 31920 return number + "st"; 31921 case 2: 31922 return number + "nd"; 31923 case 3: 31924 return number + "rd"; 31925 } 31926 } 31927 return number + "th"; 31928 }; 31929 var localize = { 31930 ordinalNumber, 31931 era: buildLocalizeFn({ 31932 values: eraValues, 31933 defaultWidth: "wide" 31934 }), 31935 quarter: buildLocalizeFn({ 31936 values: quarterValues, 31937 defaultWidth: "wide", 31938 argumentCallback: (quarter) => quarter - 1 31939 }), 31940 month: buildLocalizeFn({ 31941 values: monthValues, 31942 defaultWidth: "wide" 31943 }), 31944 day: buildLocalizeFn({ 31945 values: dayValues, 31946 defaultWidth: "wide" 31947 }), 31948 dayPeriod: buildLocalizeFn({ 31949 values: dayPeriodValues, 31950 defaultWidth: "wide", 31951 formattingValues: formattingDayPeriodValues, 31952 defaultFormattingWidth: "wide" 31953 }) 31954 }; 31955 31956 // node_modules/date-fns/locale/_lib/buildMatchFn.js 31957 function buildMatchFn(args) { 31958 return (string, options = {}) => { 31959 const width = options.width; 31960 const matchPattern = width && args.matchPatterns[width] || args.matchPatterns[args.defaultMatchWidth]; 31961 const matchResult = string.match(matchPattern); 31962 if (!matchResult) { 31963 return null; 31964 } 31965 const matchedString = matchResult[0]; 31966 const parsePatterns = width && args.parsePatterns[width] || args.parsePatterns[args.defaultParseWidth]; 31967 const key2 = Array.isArray(parsePatterns) ? findIndex(parsePatterns, (pattern) => pattern.test(matchedString)) : ( 31968 // [TODO] -- I challenge you to fix the type 31969 findKey(parsePatterns, (pattern) => pattern.test(matchedString)) 31970 ); 31971 let value; 31972 value = args.valueCallback ? args.valueCallback(key2) : key2; 31973 value = options.valueCallback ? ( 31974 // [TODO] -- I challenge you to fix the type 31975 options.valueCallback(value) 31976 ) : value; 31977 const rest = string.slice(matchedString.length); 31978 return { value, rest }; 31979 }; 31980 } 31981 function findKey(object, predicate) { 31982 for (const key2 in object) { 31983 if (Object.prototype.hasOwnProperty.call(object, key2) && predicate(object[key2])) { 31984 return key2; 31985 } 31986 } 31987 return void 0; 31988 } 31989 function findIndex(array, predicate) { 31990 for (let key2 = 0; key2 < array.length; key2++) { 31991 if (predicate(array[key2])) { 31992 return key2; 31993 } 31994 } 31995 return void 0; 31996 } 31997 31998 // node_modules/date-fns/locale/_lib/buildMatchPatternFn.js 31999 function buildMatchPatternFn(args) { 32000 return (string, options = {}) => { 32001 const matchResult = string.match(args.matchPattern); 32002 if (!matchResult) return null; 32003 const matchedString = matchResult[0]; 32004 const parseResult = string.match(args.parsePattern); 32005 if (!parseResult) return null; 32006 let value = args.valueCallback ? args.valueCallback(parseResult[0]) : parseResult[0]; 32007 value = options.valueCallback ? options.valueCallback(value) : value; 32008 const rest = string.slice(matchedString.length); 32009 return { value, rest }; 32010 }; 32011 } 32012 32013 // node_modules/date-fns/locale/en-US/_lib/match.js 32014 var matchOrdinalNumberPattern = /^(\d+)(th|st|nd|rd)?/i; 32015 var parseOrdinalNumberPattern = /\d+/i; 32016 var matchEraPatterns = { 32017 narrow: /^(b|a)/i, 32018 abbreviated: /^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i, 32019 wide: /^(before christ|before common era|anno domini|common era)/i 32020 }; 32021 var parseEraPatterns = { 32022 any: [/^b/i, /^(a|c)/i] 32023 }; 32024 var matchQuarterPatterns = { 32025 narrow: /^[1234]/i, 32026 abbreviated: /^q[1234]/i, 32027 wide: /^[1234](th|st|nd|rd)? quarter/i 32028 }; 32029 var parseQuarterPatterns = { 32030 any: [/1/i, /2/i, /3/i, /4/i] 32031 }; 32032 var matchMonthPatterns = { 32033 narrow: /^[jfmasond]/i, 32034 abbreviated: /^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i, 32035 wide: /^(january|february|march|april|may|june|july|august|september|october|november|december)/i 32036 }; 32037 var parseMonthPatterns = { 32038 narrow: [ 32039 /^j/i, 32040 /^f/i, 32041 /^m/i, 32042 /^a/i, 32043 /^m/i, 32044 /^j/i, 32045 /^j/i, 32046 /^a/i, 32047 /^s/i, 32048 /^o/i, 32049 /^n/i, 32050 /^d/i 32051 ], 32052 any: [ 32053 /^ja/i, 32054 /^f/i, 32055 /^mar/i, 32056 /^ap/i, 32057 /^may/i, 32058 /^jun/i, 32059 /^jul/i, 32060 /^au/i, 32061 /^s/i, 32062 /^o/i, 32063 /^n/i, 32064 /^d/i 32065 ] 32066 }; 32067 var matchDayPatterns = { 32068 narrow: /^[smtwf]/i, 32069 short: /^(su|mo|tu|we|th|fr|sa)/i, 32070 abbreviated: /^(sun|mon|tue|wed|thu|fri|sat)/i, 32071 wide: /^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i 32072 }; 32073 var parseDayPatterns = { 32074 narrow: [/^s/i, /^m/i, /^t/i, /^w/i, /^t/i, /^f/i, /^s/i], 32075 any: [/^su/i, /^m/i, /^tu/i, /^w/i, /^th/i, /^f/i, /^sa/i] 32076 }; 32077 var matchDayPeriodPatterns = { 32078 narrow: /^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i, 32079 any: /^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i 32080 }; 32081 var parseDayPeriodPatterns = { 32082 any: { 32083 am: /^a/i, 32084 pm: /^p/i, 32085 midnight: /^mi/i, 32086 noon: /^no/i, 32087 morning: /morning/i, 32088 afternoon: /afternoon/i, 32089 evening: /evening/i, 32090 night: /night/i 32091 } 32092 }; 32093 var match = { 32094 ordinalNumber: buildMatchPatternFn({ 32095 matchPattern: matchOrdinalNumberPattern, 32096 parsePattern: parseOrdinalNumberPattern, 32097 valueCallback: (value) => parseInt(value, 10) 32098 }), 32099 era: buildMatchFn({ 32100 matchPatterns: matchEraPatterns, 32101 defaultMatchWidth: "wide", 32102 parsePatterns: parseEraPatterns, 32103 defaultParseWidth: "any" 32104 }), 32105 quarter: buildMatchFn({ 32106 matchPatterns: matchQuarterPatterns, 32107 defaultMatchWidth: "wide", 32108 parsePatterns: parseQuarterPatterns, 32109 defaultParseWidth: "any", 32110 valueCallback: (index2) => index2 + 1 32111 }), 32112 month: buildMatchFn({ 32113 matchPatterns: matchMonthPatterns, 32114 defaultMatchWidth: "wide", 32115 parsePatterns: parseMonthPatterns, 32116 defaultParseWidth: "any" 32117 }), 32118 day: buildMatchFn({ 32119 matchPatterns: matchDayPatterns, 32120 defaultMatchWidth: "wide", 32121 parsePatterns: parseDayPatterns, 32122 defaultParseWidth: "any" 32123 }), 32124 dayPeriod: buildMatchFn({ 32125 matchPatterns: matchDayPeriodPatterns, 32126 defaultMatchWidth: "any", 32127 parsePatterns: parseDayPeriodPatterns, 32128 defaultParseWidth: "any" 32129 }) 32130 }; 32131 32132 // node_modules/date-fns/locale/en-US.js 32133 var enUS = { 32134 code: "en-US", 32135 formatDistance, 32136 formatLong, 32137 formatRelative, 32138 localize, 32139 match, 32140 options: { 32141 weekStartsOn: 0, 32142 firstWeekContainsDate: 1 32143 } 32144 }; 32145 32146 // node_modules/date-fns/getDayOfYear.js 32147 function getDayOfYear(date, options) { 32148 const _date = toDate(date, options?.in); 32149 const diff = differenceInCalendarDays(_date, startOfYear(_date)); 32150 const dayOfYear = diff + 1; 32151 return dayOfYear; 32152 } 32153 32154 // node_modules/date-fns/getISOWeek.js 32155 function getISOWeek(date, options) { 32156 const _date = toDate(date, options?.in); 32157 const diff = +startOfISOWeek(_date) - +startOfISOWeekYear(_date); 32158 return Math.round(diff / millisecondsInWeek) + 1; 32159 } 32160 32161 // node_modules/date-fns/getWeekYear.js 32162 function getWeekYear(date, options) { 32163 const _date = toDate(date, options?.in); 32164 const year = _date.getFullYear(); 32165 const defaultOptions3 = getDefaultOptions(); 32166 const firstWeekContainsDate = options?.firstWeekContainsDate ?? options?.locale?.options?.firstWeekContainsDate ?? defaultOptions3.firstWeekContainsDate ?? defaultOptions3.locale?.options?.firstWeekContainsDate ?? 1; 32167 const firstWeekOfNextYear = constructFrom(options?.in || date, 0); 32168 firstWeekOfNextYear.setFullYear(year + 1, 0, firstWeekContainsDate); 32169 firstWeekOfNextYear.setHours(0, 0, 0, 0); 32170 const startOfNextYear = startOfWeek(firstWeekOfNextYear, options); 32171 const firstWeekOfThisYear = constructFrom(options?.in || date, 0); 32172 firstWeekOfThisYear.setFullYear(year, 0, firstWeekContainsDate); 32173 firstWeekOfThisYear.setHours(0, 0, 0, 0); 32174 const startOfThisYear = startOfWeek(firstWeekOfThisYear, options); 32175 if (+_date >= +startOfNextYear) { 32176 return year + 1; 32177 } else if (+_date >= +startOfThisYear) { 32178 return year; 32179 } else { 32180 return year - 1; 32181 } 32182 } 32183 32184 // node_modules/date-fns/startOfWeekYear.js 32185 function startOfWeekYear(date, options) { 32186 const defaultOptions3 = getDefaultOptions(); 32187 const firstWeekContainsDate = options?.firstWeekContainsDate ?? options?.locale?.options?.firstWeekContainsDate ?? defaultOptions3.firstWeekContainsDate ?? defaultOptions3.locale?.options?.firstWeekContainsDate ?? 1; 32188 const year = getWeekYear(date, options); 32189 const firstWeek = constructFrom(options?.in || date, 0); 32190 firstWeek.setFullYear(year, 0, firstWeekContainsDate); 32191 firstWeek.setHours(0, 0, 0, 0); 32192 const _date = startOfWeek(firstWeek, options); 32193 return _date; 32194 } 32195 32196 // node_modules/date-fns/getWeek.js 32197 function getWeek(date, options) { 32198 const _date = toDate(date, options?.in); 32199 const diff = +startOfWeek(_date, options) - +startOfWeekYear(_date, options); 32200 return Math.round(diff / millisecondsInWeek) + 1; 32201 } 32202 32203 // node_modules/date-fns/_lib/addLeadingZeros.js 32204 function addLeadingZeros(number, targetLength) { 32205 const sign = number < 0 ? "-" : ""; 32206 const output = Math.abs(number).toString().padStart(targetLength, "0"); 32207 return sign + output; 32208 } 32209 32210 // node_modules/date-fns/_lib/format/lightFormatters.js 32211 var lightFormatters = { 32212 // Year 32213 y(date, token) { 32214 const signedYear = date.getFullYear(); 32215 const year = signedYear > 0 ? signedYear : 1 - signedYear; 32216 return addLeadingZeros(token === "yy" ? year % 100 : year, token.length); 32217 }, 32218 // Month 32219 M(date, token) { 32220 const month = date.getMonth(); 32221 return token === "M" ? String(month + 1) : addLeadingZeros(month + 1, 2); 32222 }, 32223 // Day of the month 32224 d(date, token) { 32225 return addLeadingZeros(date.getDate(), token.length); 32226 }, 32227 // AM or PM 32228 a(date, token) { 32229 const dayPeriodEnumValue = date.getHours() / 12 >= 1 ? "pm" : "am"; 32230 switch (token) { 32231 case "a": 32232 case "aa": 32233 return dayPeriodEnumValue.toUpperCase(); 32234 case "aaa": 32235 return dayPeriodEnumValue; 32236 case "aaaaa": 32237 return dayPeriodEnumValue[0]; 32238 case "aaaa": 32239 default: 32240 return dayPeriodEnumValue === "am" ? "a.m." : "p.m."; 32241 } 32242 }, 32243 // Hour [1-12] 32244 h(date, token) { 32245 return addLeadingZeros(date.getHours() % 12 || 12, token.length); 32246 }, 32247 // Hour [0-23] 32248 H(date, token) { 32249 return addLeadingZeros(date.getHours(), token.length); 32250 }, 32251 // Minute 32252 m(date, token) { 32253 return addLeadingZeros(date.getMinutes(), token.length); 32254 }, 32255 // Second 32256 s(date, token) { 32257 return addLeadingZeros(date.getSeconds(), token.length); 32258 }, 32259 // Fraction of second 32260 S(date, token) { 32261 const numberOfDigits = token.length; 32262 const milliseconds = date.getMilliseconds(); 32263 const fractionalSeconds = Math.trunc( 32264 milliseconds * Math.pow(10, numberOfDigits - 3) 32265 ); 32266 return addLeadingZeros(fractionalSeconds, token.length); 32267 } 32268 }; 32269 32270 // node_modules/date-fns/_lib/format/formatters.js 32271 var dayPeriodEnum = { 32272 am: "am", 32273 pm: "pm", 32274 midnight: "midnight", 32275 noon: "noon", 32276 morning: "morning", 32277 afternoon: "afternoon", 32278 evening: "evening", 32279 night: "night" 32280 }; 32281 var formatters = { 32282 // Era 32283 G: function(date, token, localize2) { 32284 const era = date.getFullYear() > 0 ? 1 : 0; 32285 switch (token) { 32286 // AD, BC 32287 case "G": 32288 case "GG": 32289 case "GGG": 32290 return localize2.era(era, { width: "abbreviated" }); 32291 // A, B 32292 case "GGGGG": 32293 return localize2.era(era, { width: "narrow" }); 32294 // Anno Domini, Before Christ 32295 case "GGGG": 32296 default: 32297 return localize2.era(era, { width: "wide" }); 32298 } 32299 }, 32300 // Year 32301 y: function(date, token, localize2) { 32302 if (token === "yo") { 32303 const signedYear = date.getFullYear(); 32304 const year = signedYear > 0 ? signedYear : 1 - signedYear; 32305 return localize2.ordinalNumber(year, { unit: "year" }); 32306 } 32307 return lightFormatters.y(date, token); 32308 }, 32309 // Local week-numbering year 32310 Y: function(date, token, localize2, options) { 32311 const signedWeekYear = getWeekYear(date, options); 32312 const weekYear = signedWeekYear > 0 ? signedWeekYear : 1 - signedWeekYear; 32313 if (token === "YY") { 32314 const twoDigitYear = weekYear % 100; 32315 return addLeadingZeros(twoDigitYear, 2); 32316 } 32317 if (token === "Yo") { 32318 return localize2.ordinalNumber(weekYear, { unit: "year" }); 32319 } 32320 return addLeadingZeros(weekYear, token.length); 32321 }, 32322 // ISO week-numbering year 32323 R: function(date, token) { 32324 const isoWeekYear = getISOWeekYear(date); 32325 return addLeadingZeros(isoWeekYear, token.length); 32326 }, 32327 // Extended year. This is a single number designating the year of this calendar system. 32328 // The main difference between `y` and `u` localizers are B.C. years: 32329 // | Year | `y` | `u` | 32330 // |------|-----|-----| 32331 // | AC 1 | 1 | 1 | 32332 // | BC 1 | 1 | 0 | 32333 // | BC 2 | 2 | -1 | 32334 // Also `yy` always returns the last two digits of a year, 32335 // while `uu` pads single digit years to 2 characters and returns other years unchanged. 32336 u: function(date, token) { 32337 const year = date.getFullYear(); 32338 return addLeadingZeros(year, token.length); 32339 }, 32340 // Quarter 32341 Q: function(date, token, localize2) { 32342 const quarter = Math.ceil((date.getMonth() + 1) / 3); 32343 switch (token) { 32344 // 1, 2, 3, 4 32345 case "Q": 32346 return String(quarter); 32347 // 01, 02, 03, 04 32348 case "QQ": 32349 return addLeadingZeros(quarter, 2); 32350 // 1st, 2nd, 3rd, 4th 32351 case "Qo": 32352 return localize2.ordinalNumber(quarter, { unit: "quarter" }); 32353 // Q1, Q2, Q3, Q4 32354 case "QQQ": 32355 return localize2.quarter(quarter, { 32356 width: "abbreviated", 32357 context: "formatting" 32358 }); 32359 // 1, 2, 3, 4 (narrow quarter; could be not numerical) 32360 case "QQQQQ": 32361 return localize2.quarter(quarter, { 32362 width: "narrow", 32363 context: "formatting" 32364 }); 32365 // 1st quarter, 2nd quarter, ... 32366 case "QQQQ": 32367 default: 32368 return localize2.quarter(quarter, { 32369 width: "wide", 32370 context: "formatting" 32371 }); 32372 } 32373 }, 32374 // Stand-alone quarter 32375 q: function(date, token, localize2) { 32376 const quarter = Math.ceil((date.getMonth() + 1) / 3); 32377 switch (token) { 32378 // 1, 2, 3, 4 32379 case "q": 32380 return String(quarter); 32381 // 01, 02, 03, 04 32382 case "qq": 32383 return addLeadingZeros(quarter, 2); 32384 // 1st, 2nd, 3rd, 4th 32385 case "qo": 32386 return localize2.ordinalNumber(quarter, { unit: "quarter" }); 32387 // Q1, Q2, Q3, Q4 32388 case "qqq": 32389 return localize2.quarter(quarter, { 32390 width: "abbreviated", 32391 context: "standalone" 32392 }); 32393 // 1, 2, 3, 4 (narrow quarter; could be not numerical) 32394 case "qqqqq": 32395 return localize2.quarter(quarter, { 32396 width: "narrow", 32397 context: "standalone" 32398 }); 32399 // 1st quarter, 2nd quarter, ... 32400 case "qqqq": 32401 default: 32402 return localize2.quarter(quarter, { 32403 width: "wide", 32404 context: "standalone" 32405 }); 32406 } 32407 }, 32408 // Month 32409 M: function(date, token, localize2) { 32410 const month = date.getMonth(); 32411 switch (token) { 32412 case "M": 32413 case "MM": 32414 return lightFormatters.M(date, token); 32415 // 1st, 2nd, ..., 12th 32416 case "Mo": 32417 return localize2.ordinalNumber(month + 1, { unit: "month" }); 32418 // Jan, Feb, ..., Dec 32419 case "MMM": 32420 return localize2.month(month, { 32421 width: "abbreviated", 32422 context: "formatting" 32423 }); 32424 // J, F, ..., D 32425 case "MMMMM": 32426 return localize2.month(month, { 32427 width: "narrow", 32428 context: "formatting" 32429 }); 32430 // January, February, ..., December 32431 case "MMMM": 32432 default: 32433 return localize2.month(month, { width: "wide", context: "formatting" }); 32434 } 32435 }, 32436 // Stand-alone month 32437 L: function(date, token, localize2) { 32438 const month = date.getMonth(); 32439 switch (token) { 32440 // 1, 2, ..., 12 32441 case "L": 32442 return String(month + 1); 32443 // 01, 02, ..., 12 32444 case "LL": 32445 return addLeadingZeros(month + 1, 2); 32446 // 1st, 2nd, ..., 12th 32447 case "Lo": 32448 return localize2.ordinalNumber(month + 1, { unit: "month" }); 32449 // Jan, Feb, ..., Dec 32450 case "LLL": 32451 return localize2.month(month, { 32452 width: "abbreviated", 32453 context: "standalone" 32454 }); 32455 // J, F, ..., D 32456 case "LLLLL": 32457 return localize2.month(month, { 32458 width: "narrow", 32459 context: "standalone" 32460 }); 32461 // January, February, ..., December 32462 case "LLLL": 32463 default: 32464 return localize2.month(month, { width: "wide", context: "standalone" }); 32465 } 32466 }, 32467 // Local week of year 32468 w: function(date, token, localize2, options) { 32469 const week = getWeek(date, options); 32470 if (token === "wo") { 32471 return localize2.ordinalNumber(week, { unit: "week" }); 32472 } 32473 return addLeadingZeros(week, token.length); 32474 }, 32475 // ISO week of year 32476 I: function(date, token, localize2) { 32477 const isoWeek = getISOWeek(date); 32478 if (token === "Io") { 32479 return localize2.ordinalNumber(isoWeek, { unit: "week" }); 32480 } 32481 return addLeadingZeros(isoWeek, token.length); 32482 }, 32483 // Day of the month 32484 d: function(date, token, localize2) { 32485 if (token === "do") { 32486 return localize2.ordinalNumber(date.getDate(), { unit: "date" }); 32487 } 32488 return lightFormatters.d(date, token); 32489 }, 32490 // Day of year 32491 D: function(date, token, localize2) { 32492 const dayOfYear = getDayOfYear(date); 32493 if (token === "Do") { 32494 return localize2.ordinalNumber(dayOfYear, { unit: "dayOfYear" }); 32495 } 32496 return addLeadingZeros(dayOfYear, token.length); 32497 }, 32498 // Day of week 32499 E: function(date, token, localize2) { 32500 const dayOfWeek = date.getDay(); 32501 switch (token) { 32502 // Tue 32503 case "E": 32504 case "EE": 32505 case "EEE": 32506 return localize2.day(dayOfWeek, { 32507 width: "abbreviated", 32508 context: "formatting" 32509 }); 32510 // T 32511 case "EEEEE": 32512 return localize2.day(dayOfWeek, { 32513 width: "narrow", 32514 context: "formatting" 32515 }); 32516 // Tu 32517 case "EEEEEE": 32518 return localize2.day(dayOfWeek, { 32519 width: "short", 32520 context: "formatting" 32521 }); 32522 // Tuesday 32523 case "EEEE": 32524 default: 32525 return localize2.day(dayOfWeek, { 32526 width: "wide", 32527 context: "formatting" 32528 }); 32529 } 32530 }, 32531 // Local day of week 32532 e: function(date, token, localize2, options) { 32533 const dayOfWeek = date.getDay(); 32534 const localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7; 32535 switch (token) { 32536 // Numerical value (Nth day of week with current locale or weekStartsOn) 32537 case "e": 32538 return String(localDayOfWeek); 32539 // Padded numerical value 32540 case "ee": 32541 return addLeadingZeros(localDayOfWeek, 2); 32542 // 1st, 2nd, ..., 7th 32543 case "eo": 32544 return localize2.ordinalNumber(localDayOfWeek, { unit: "day" }); 32545 case "eee": 32546 return localize2.day(dayOfWeek, { 32547 width: "abbreviated", 32548 context: "formatting" 32549 }); 32550 // T 32551 case "eeeee": 32552 return localize2.day(dayOfWeek, { 32553 width: "narrow", 32554 context: "formatting" 32555 }); 32556 // Tu 32557 case "eeeeee": 32558 return localize2.day(dayOfWeek, { 32559 width: "short", 32560 context: "formatting" 32561 }); 32562 // Tuesday 32563 case "eeee": 32564 default: 32565 return localize2.day(dayOfWeek, { 32566 width: "wide", 32567 context: "formatting" 32568 }); 32569 } 32570 }, 32571 // Stand-alone local day of week 32572 c: function(date, token, localize2, options) { 32573 const dayOfWeek = date.getDay(); 32574 const localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7; 32575 switch (token) { 32576 // Numerical value (same as in `e`) 32577 case "c": 32578 return String(localDayOfWeek); 32579 // Padded numerical value 32580 case "cc": 32581 return addLeadingZeros(localDayOfWeek, token.length); 32582 // 1st, 2nd, ..., 7th 32583 case "co": 32584 return localize2.ordinalNumber(localDayOfWeek, { unit: "day" }); 32585 case "ccc": 32586 return localize2.day(dayOfWeek, { 32587 width: "abbreviated", 32588 context: "standalone" 32589 }); 32590 // T 32591 case "ccccc": 32592 return localize2.day(dayOfWeek, { 32593 width: "narrow", 32594 context: "standalone" 32595 }); 32596 // Tu 32597 case "cccccc": 32598 return localize2.day(dayOfWeek, { 32599 width: "short", 32600 context: "standalone" 32601 }); 32602 // Tuesday 32603 case "cccc": 32604 default: 32605 return localize2.day(dayOfWeek, { 32606 width: "wide", 32607 context: "standalone" 32608 }); 32609 } 32610 }, 32611 // ISO day of week 32612 i: function(date, token, localize2) { 32613 const dayOfWeek = date.getDay(); 32614 const isoDayOfWeek = dayOfWeek === 0 ? 7 : dayOfWeek; 32615 switch (token) { 32616 // 2 32617 case "i": 32618 return String(isoDayOfWeek); 32619 // 02 32620 case "ii": 32621 return addLeadingZeros(isoDayOfWeek, token.length); 32622 // 2nd 32623 case "io": 32624 return localize2.ordinalNumber(isoDayOfWeek, { unit: "day" }); 32625 // Tue 32626 case "iii": 32627 return localize2.day(dayOfWeek, { 32628 width: "abbreviated", 32629 context: "formatting" 32630 }); 32631 // T 32632 case "iiiii": 32633 return localize2.day(dayOfWeek, { 32634 width: "narrow", 32635 context: "formatting" 32636 }); 32637 // Tu 32638 case "iiiiii": 32639 return localize2.day(dayOfWeek, { 32640 width: "short", 32641 context: "formatting" 32642 }); 32643 // Tuesday 32644 case "iiii": 32645 default: 32646 return localize2.day(dayOfWeek, { 32647 width: "wide", 32648 context: "formatting" 32649 }); 32650 } 32651 }, 32652 // AM or PM 32653 a: function(date, token, localize2) { 32654 const hours = date.getHours(); 32655 const dayPeriodEnumValue = hours / 12 >= 1 ? "pm" : "am"; 32656 switch (token) { 32657 case "a": 32658 case "aa": 32659 return localize2.dayPeriod(dayPeriodEnumValue, { 32660 width: "abbreviated", 32661 context: "formatting" 32662 }); 32663 case "aaa": 32664 return localize2.dayPeriod(dayPeriodEnumValue, { 32665 width: "abbreviated", 32666 context: "formatting" 32667 }).toLowerCase(); 32668 case "aaaaa": 32669 return localize2.dayPeriod(dayPeriodEnumValue, { 32670 width: "narrow", 32671 context: "formatting" 32672 }); 32673 case "aaaa": 32674 default: 32675 return localize2.dayPeriod(dayPeriodEnumValue, { 32676 width: "wide", 32677 context: "formatting" 32678 }); 32679 } 32680 }, 32681 // AM, PM, midnight, noon 32682 b: function(date, token, localize2) { 32683 const hours = date.getHours(); 32684 let dayPeriodEnumValue; 32685 if (hours === 12) { 32686 dayPeriodEnumValue = dayPeriodEnum.noon; 32687 } else if (hours === 0) { 32688 dayPeriodEnumValue = dayPeriodEnum.midnight; 32689 } else { 32690 dayPeriodEnumValue = hours / 12 >= 1 ? "pm" : "am"; 32691 } 32692 switch (token) { 32693 case "b": 32694 case "bb": 32695 return localize2.dayPeriod(dayPeriodEnumValue, { 32696 width: "abbreviated", 32697 context: "formatting" 32698 }); 32699 case "bbb": 32700 return localize2.dayPeriod(dayPeriodEnumValue, { 32701 width: "abbreviated", 32702 context: "formatting" 32703 }).toLowerCase(); 32704 case "bbbbb": 32705 return localize2.dayPeriod(dayPeriodEnumValue, { 32706 width: "narrow", 32707 context: "formatting" 32708 }); 32709 case "bbbb": 32710 default: 32711 return localize2.dayPeriod(dayPeriodEnumValue, { 32712 width: "wide", 32713 context: "formatting" 32714 }); 32715 } 32716 }, 32717 // in the morning, in the afternoon, in the evening, at night 32718 B: function(date, token, localize2) { 32719 const hours = date.getHours(); 32720 let dayPeriodEnumValue; 32721 if (hours >= 17) { 32722 dayPeriodEnumValue = dayPeriodEnum.evening; 32723 } else if (hours >= 12) { 32724 dayPeriodEnumValue = dayPeriodEnum.afternoon; 32725 } else if (hours >= 4) { 32726 dayPeriodEnumValue = dayPeriodEnum.morning; 32727 } else { 32728 dayPeriodEnumValue = dayPeriodEnum.night; 32729 } 32730 switch (token) { 32731 case "B": 32732 case "BB": 32733 case "BBB": 32734 return localize2.dayPeriod(dayPeriodEnumValue, { 32735 width: "abbreviated", 32736 context: "formatting" 32737 }); 32738 case "BBBBB": 32739 return localize2.dayPeriod(dayPeriodEnumValue, { 32740 width: "narrow", 32741 context: "formatting" 32742 }); 32743 case "BBBB": 32744 default: 32745 return localize2.dayPeriod(dayPeriodEnumValue, { 32746 width: "wide", 32747 context: "formatting" 32748 }); 32749 } 32750 }, 32751 // Hour [1-12] 32752 h: function(date, token, localize2) { 32753 if (token === "ho") { 32754 let hours = date.getHours() % 12; 32755 if (hours === 0) hours = 12; 32756 return localize2.ordinalNumber(hours, { unit: "hour" }); 32757 } 32758 return lightFormatters.h(date, token); 32759 }, 32760 // Hour [0-23] 32761 H: function(date, token, localize2) { 32762 if (token === "Ho") { 32763 return localize2.ordinalNumber(date.getHours(), { unit: "hour" }); 32764 } 32765 return lightFormatters.H(date, token); 32766 }, 32767 // Hour [0-11] 32768 K: function(date, token, localize2) { 32769 const hours = date.getHours() % 12; 32770 if (token === "Ko") { 32771 return localize2.ordinalNumber(hours, { unit: "hour" }); 32772 } 32773 return addLeadingZeros(hours, token.length); 32774 }, 32775 // Hour [1-24] 32776 k: function(date, token, localize2) { 32777 let hours = date.getHours(); 32778 if (hours === 0) hours = 24; 32779 if (token === "ko") { 32780 return localize2.ordinalNumber(hours, { unit: "hour" }); 32781 } 32782 return addLeadingZeros(hours, token.length); 32783 }, 32784 // Minute 32785 m: function(date, token, localize2) { 32786 if (token === "mo") { 32787 return localize2.ordinalNumber(date.getMinutes(), { unit: "minute" }); 32788 } 32789 return lightFormatters.m(date, token); 32790 }, 32791 // Second 32792 s: function(date, token, localize2) { 32793 if (token === "so") { 32794 return localize2.ordinalNumber(date.getSeconds(), { unit: "second" }); 32795 } 32796 return lightFormatters.s(date, token); 32797 }, 32798 // Fraction of second 32799 S: function(date, token) { 32800 return lightFormatters.S(date, token); 32801 }, 32802 // Timezone (ISO-8601. If offset is 0, output is always `'Z'`) 32803 X: function(date, token, _localize) { 32804 const timezoneOffset = date.getTimezoneOffset(); 32805 if (timezoneOffset === 0) { 32806 return "Z"; 32807 } 32808 switch (token) { 32809 // Hours and optional minutes 32810 case "X": 32811 return formatTimezoneWithOptionalMinutes(timezoneOffset); 32812 // Hours, minutes and optional seconds without `:` delimiter 32813 // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets 32814 // so this token always has the same output as `XX` 32815 case "XXXX": 32816 case "XX": 32817 return formatTimezone(timezoneOffset); 32818 // Hours, minutes and optional seconds with `:` delimiter 32819 // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets 32820 // so this token always has the same output as `XXX` 32821 case "XXXXX": 32822 case "XXX": 32823 // Hours and minutes with `:` delimiter 32824 default: 32825 return formatTimezone(timezoneOffset, ":"); 32826 } 32827 }, 32828 // Timezone (ISO-8601. If offset is 0, output is `'+00:00'` or equivalent) 32829 x: function(date, token, _localize) { 32830 const timezoneOffset = date.getTimezoneOffset(); 32831 switch (token) { 32832 // Hours and optional minutes 32833 case "x": 32834 return formatTimezoneWithOptionalMinutes(timezoneOffset); 32835 // Hours, minutes and optional seconds without `:` delimiter 32836 // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets 32837 // so this token always has the same output as `xx` 32838 case "xxxx": 32839 case "xx": 32840 return formatTimezone(timezoneOffset); 32841 // Hours, minutes and optional seconds with `:` delimiter 32842 // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets 32843 // so this token always has the same output as `xxx` 32844 case "xxxxx": 32845 case "xxx": 32846 // Hours and minutes with `:` delimiter 32847 default: 32848 return formatTimezone(timezoneOffset, ":"); 32849 } 32850 }, 32851 // Timezone (GMT) 32852 O: function(date, token, _localize) { 32853 const timezoneOffset = date.getTimezoneOffset(); 32854 switch (token) { 32855 // Short 32856 case "O": 32857 case "OO": 32858 case "OOO": 32859 return "GMT" + formatTimezoneShort(timezoneOffset, ":"); 32860 // Long 32861 case "OOOO": 32862 default: 32863 return "GMT" + formatTimezone(timezoneOffset, ":"); 32864 } 32865 }, 32866 // Timezone (specific non-location) 32867 z: function(date, token, _localize) { 32868 const timezoneOffset = date.getTimezoneOffset(); 32869 switch (token) { 32870 // Short 32871 case "z": 32872 case "zz": 32873 case "zzz": 32874 return "GMT" + formatTimezoneShort(timezoneOffset, ":"); 32875 // Long 32876 case "zzzz": 32877 default: 32878 return "GMT" + formatTimezone(timezoneOffset, ":"); 32879 } 32880 }, 32881 // Seconds timestamp 32882 t: function(date, token, _localize) { 32883 const timestamp = Math.trunc(+date / 1e3); 32884 return addLeadingZeros(timestamp, token.length); 32885 }, 32886 // Milliseconds timestamp 32887 T: function(date, token, _localize) { 32888 return addLeadingZeros(+date, token.length); 32889 } 32890 }; 32891 function formatTimezoneShort(offset4, delimiter = "") { 32892 const sign = offset4 > 0 ? "-" : "+"; 32893 const absOffset = Math.abs(offset4); 32894 const hours = Math.trunc(absOffset / 60); 32895 const minutes = absOffset % 60; 32896 if (minutes === 0) { 32897 return sign + String(hours); 32898 } 32899 return sign + String(hours) + delimiter + addLeadingZeros(minutes, 2); 32900 } 32901 function formatTimezoneWithOptionalMinutes(offset4, delimiter) { 32902 if (offset4 % 60 === 0) { 32903 const sign = offset4 > 0 ? "-" : "+"; 32904 return sign + addLeadingZeros(Math.abs(offset4) / 60, 2); 32905 } 32906 return formatTimezone(offset4, delimiter); 32907 } 32908 function formatTimezone(offset4, delimiter = "") { 32909 const sign = offset4 > 0 ? "-" : "+"; 32910 const absOffset = Math.abs(offset4); 32911 const hours = addLeadingZeros(Math.trunc(absOffset / 60), 2); 32912 const minutes = addLeadingZeros(absOffset % 60, 2); 32913 return sign + hours + delimiter + minutes; 32914 } 32915 32916 // node_modules/date-fns/_lib/format/longFormatters.js 32917 var dateLongFormatter = (pattern, formatLong2) => { 32918 switch (pattern) { 32919 case "P": 32920 return formatLong2.date({ width: "short" }); 32921 case "PP": 32922 return formatLong2.date({ width: "medium" }); 32923 case "PPP": 32924 return formatLong2.date({ width: "long" }); 32925 case "PPPP": 32926 default: 32927 return formatLong2.date({ width: "full" }); 32928 } 32929 }; 32930 var timeLongFormatter = (pattern, formatLong2) => { 32931 switch (pattern) { 32932 case "p": 32933 return formatLong2.time({ width: "short" }); 32934 case "pp": 32935 return formatLong2.time({ width: "medium" }); 32936 case "ppp": 32937 return formatLong2.time({ width: "long" }); 32938 case "pppp": 32939 default: 32940 return formatLong2.time({ width: "full" }); 32941 } 32942 }; 32943 var dateTimeLongFormatter = (pattern, formatLong2) => { 32944 const matchResult = pattern.match(/(P+)(p+)?/) || []; 32945 const datePattern = matchResult[1]; 32946 const timePattern = matchResult[2]; 32947 if (!timePattern) { 32948 return dateLongFormatter(pattern, formatLong2); 32949 } 32950 let dateTimeFormat; 32951 switch (datePattern) { 32952 case "P": 32953 dateTimeFormat = formatLong2.dateTime({ width: "short" }); 32954 break; 32955 case "PP": 32956 dateTimeFormat = formatLong2.dateTime({ width: "medium" }); 32957 break; 32958 case "PPP": 32959 dateTimeFormat = formatLong2.dateTime({ width: "long" }); 32960 break; 32961 case "PPPP": 32962 default: 32963 dateTimeFormat = formatLong2.dateTime({ width: "full" }); 32964 break; 32965 } 32966 return dateTimeFormat.replace("{{date}}", dateLongFormatter(datePattern, formatLong2)).replace("{{time}}", timeLongFormatter(timePattern, formatLong2)); 32967 }; 32968 var longFormatters = { 32969 p: timeLongFormatter, 32970 P: dateTimeLongFormatter 32971 }; 32972 32973 // node_modules/date-fns/_lib/protectedTokens.js 32974 var dayOfYearTokenRE = /^D+$/; 32975 var weekYearTokenRE = /^Y+$/; 32976 var throwTokens = ["D", "DD", "YY", "YYYY"]; 32977 function isProtectedDayOfYearToken(token) { 32978 return dayOfYearTokenRE.test(token); 32979 } 32980 function isProtectedWeekYearToken(token) { 32981 return weekYearTokenRE.test(token); 32982 } 32983 function warnOrThrowProtectedError(token, format6, input) { 32984 const _message = message(token, format6, input); 32985 console.warn(_message); 32986 if (throwTokens.includes(token)) throw new RangeError(_message); 32987 } 32988 function message(token, format6, input) { 32989 const subject = token[0] === "Y" ? "years" : "days of the month"; 32990 return `Use \`$token.toLowerCase()}\` instead of \`$token}\` (in \`$format6}\`) for formatting $subject} to the input \`$input}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`; 32991 } 32992 32993 // node_modules/date-fns/format.js 32994 var formattingTokensRegExp = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g; 32995 var longFormattingTokensRegExp = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g; 32996 var escapedStringRegExp = /^'([^]*?)'?$/; 32997 var doubleQuoteRegExp = /''/g; 32998 var unescapedLatinCharacterRegExp = /[a-zA-Z]/; 32999 function format(date, formatStr, options) { 33000 const defaultOptions3 = getDefaultOptions(); 33001 const locale = options?.locale ?? defaultOptions3.locale ?? enUS; 33002 const firstWeekContainsDate = options?.firstWeekContainsDate ?? options?.locale?.options?.firstWeekContainsDate ?? defaultOptions3.firstWeekContainsDate ?? defaultOptions3.locale?.options?.firstWeekContainsDate ?? 1; 33003 const weekStartsOn = options?.weekStartsOn ?? options?.locale?.options?.weekStartsOn ?? defaultOptions3.weekStartsOn ?? defaultOptions3.locale?.options?.weekStartsOn ?? 0; 33004 const originalDate = toDate(date, options?.in); 33005 if (!isValid(originalDate)) { 33006 throw new RangeError("Invalid time value"); 33007 } 33008 let parts = formatStr.match(longFormattingTokensRegExp).map((substring) => { 33009 const firstCharacter = substring[0]; 33010 if (firstCharacter === "p" || firstCharacter === "P") { 33011 const longFormatter = longFormatters[firstCharacter]; 33012 return longFormatter(substring, locale.formatLong); 33013 } 33014 return substring; 33015 }).join("").match(formattingTokensRegExp).map((substring) => { 33016 if (substring === "''") { 33017 return { isToken: false, value: "'" }; 33018 } 33019 const firstCharacter = substring[0]; 33020 if (firstCharacter === "'") { 33021 return { isToken: false, value: cleanEscapedString(substring) }; 33022 } 33023 if (formatters[firstCharacter]) { 33024 return { isToken: true, value: substring }; 33025 } 33026 if (firstCharacter.match(unescapedLatinCharacterRegExp)) { 33027 throw new RangeError( 33028 "Format string contains an unescaped latin alphabet character `" + firstCharacter + "`" 33029 ); 33030 } 33031 return { isToken: false, value: substring }; 33032 }); 33033 if (locale.localize.preprocessor) { 33034 parts = locale.localize.preprocessor(originalDate, parts); 33035 } 33036 const formatterOptions = { 33037 firstWeekContainsDate, 33038 weekStartsOn, 33039 locale 33040 }; 33041 return parts.map((part) => { 33042 if (!part.isToken) return part.value; 33043 const token = part.value; 33044 if (!options?.useAdditionalWeekYearTokens && isProtectedWeekYearToken(token) || !options?.useAdditionalDayOfYearTokens && isProtectedDayOfYearToken(token)) { 33045 warnOrThrowProtectedError(token, formatStr, String(date)); 33046 } 33047 const formatter = formatters[token[0]]; 33048 return formatter(originalDate, token, locale.localize, formatterOptions); 33049 }).join(""); 33050 } 33051 function cleanEscapedString(input) { 33052 const matched = input.match(escapedStringRegExp); 33053 if (!matched) { 33054 return input; 33055 } 33056 return matched[1].replace(doubleQuoteRegExp, "'"); 33057 } 33058 33059 // node_modules/date-fns/subDays.js 33060 function subDays(date, amount, options) { 33061 return addDays(date, -amount, options); 33062 } 33063 33064 // node_modules/date-fns/subMonths.js 33065 function subMonths(date, amount, options) { 33066 return addMonths(date, -amount, options); 33067 } 33068 33069 // node_modules/date-fns/subWeeks.js 33070 function subWeeks(date, amount, options) { 33071 return addWeeks(date, -amount, options); 33072 } 33073 33074 // node_modules/date-fns/subYears.js 33075 function subYears(date, amount, options) { 33076 return addYears(date, -amount, options); 33077 } 33078 33079 // packages/dataviews/build-module/utils/operators.mjs 33080 var import_i18n30 = __toESM(require_i18n(), 1); 33081 var import_element114 = __toESM(require_element(), 1); 33082 var import_date = __toESM(require_date(), 1); 33083 var import_jsx_runtime151 = __toESM(require_jsx_runtime(), 1); 33084 var filterTextWrappers = { 33085 Name: /* @__PURE__ */ (0, import_jsx_runtime151.jsx)("span", { className: "dataviews-filters__summary-filter-text-name" }), 33086 Value: /* @__PURE__ */ (0, import_jsx_runtime151.jsx)("span", { className: "dataviews-filters__summary-filter-text-value" }) 33087 }; 33088 function getRelativeDate(value, unit) { 33089 switch (unit) { 33090 case "days": 33091 return subDays(/* @__PURE__ */ new Date(), value); 33092 case "weeks": 33093 return subWeeks(/* @__PURE__ */ new Date(), value); 33094 case "months": 33095 return subMonths(/* @__PURE__ */ new Date(), value); 33096 case "years": 33097 return subYears(/* @__PURE__ */ new Date(), value); 33098 default: 33099 return /* @__PURE__ */ new Date(); 33100 } 33101 } 33102 var isNoneOperatorDefinition = { 33103 /* translators: DataViews operator name */ 33104 label: (0, import_i18n30.__)("Is none of"), 33105 filterText: (filter, activeElements) => (0, import_element114.createInterpolateElement)( 33106 (0, import_i18n30.sprintf)( 33107 /* translators: 1: Filter name (e.g. "Author"). 2: Filter value (e.g. "Admin"): "Author is none of: Admin, Editor". */ 33108 (0, import_i18n30.__)("<Name>%1$s is none of: </Name><Value>%2$s</Value>"), 33109 filter.name, 33110 activeElements.map((element) => element.label).join(", ") 33111 ), 33112 filterTextWrappers 33113 ), 33114 filter: ((item, field, filterValue) => { 33115 if (!filterValue?.length) { 33116 return true; 33117 } 33118 const fieldValue = field.getValue({ item }); 33119 if (Array.isArray(fieldValue)) { 33120 return !filterValue.some( 33121 (fv) => fieldValue.includes(fv) 33122 ); 33123 } else if (typeof fieldValue === "string") { 33124 return !filterValue.includes(fieldValue); 33125 } 33126 return false; 33127 }), 33128 selection: "multi" 33129 }; 33130 var OPERATORS = [ 33131 { 33132 name: OPERATOR_IS_ANY, 33133 /* translators: DataViews operator name */ 33134 label: (0, import_i18n30.__)("Includes"), 33135 filterText: (filter, activeElements) => (0, import_element114.createInterpolateElement)( 33136 (0, import_i18n30.sprintf)( 33137 /* translators: 1: Filter name (e.g. "Author"). 2: Filter value (e.g. "Admin"): "Author is any: Admin, Editor". */ 33138 (0, import_i18n30.__)("<Name>%1$s includes: </Name><Value>%2$s</Value>"), 33139 filter.name, 33140 activeElements.map((element) => element.label).join(", ") 33141 ), 33142 filterTextWrappers 33143 ), 33144 filter(item, field, filterValue) { 33145 if (!filterValue?.length) { 33146 return true; 33147 } 33148 const fieldValue = field.getValue({ item }); 33149 if (Array.isArray(fieldValue)) { 33150 return filterValue.some( 33151 (fv) => fieldValue.includes(fv) 33152 ); 33153 } else if (typeof fieldValue === "string") { 33154 return filterValue.includes(fieldValue); 33155 } 33156 return false; 33157 }, 33158 selection: "multi" 33159 }, 33160 { 33161 name: OPERATOR_IS_NONE, 33162 ...isNoneOperatorDefinition 33163 }, 33164 { 33165 name: OPERATOR_IS_ALL, 33166 /* translators: DataViews operator name */ 33167 label: (0, import_i18n30.__)("Includes all"), 33168 filterText: (filter, activeElements) => (0, import_element114.createInterpolateElement)( 33169 (0, import_i18n30.sprintf)( 33170 /* translators: 1: Filter name (e.g. "Author"). 2: Filter value (e.g. "Admin"): "Author includes all: Admin, Editor". */ 33171 (0, import_i18n30.__)("<Name>%1$s includes all: </Name><Value>%2$s</Value>"), 33172 filter.name, 33173 activeElements.map((element) => element.label).join(", ") 33174 ), 33175 filterTextWrappers 33176 ), 33177 filter(item, field, filterValue) { 33178 if (!filterValue?.length) { 33179 return true; 33180 } 33181 return filterValue.every((value) => { 33182 return field.getValue({ item })?.includes(value); 33183 }); 33184 }, 33185 selection: "multi" 33186 }, 33187 { 33188 name: OPERATOR_IS_NOT_ALL, 33189 ...isNoneOperatorDefinition 33190 }, 33191 { 33192 name: OPERATOR_BETWEEN, 33193 /* translators: DataViews operator name */ 33194 label: (0, import_i18n30.__)("Between (inc)"), 33195 filterText: (filter, activeElements) => (0, import_element114.createInterpolateElement)( 33196 (0, import_i18n30.sprintf)( 33197 /* 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". */ 33198 (0, import_i18n30.__)( 33199 "<Name>%1$s between (inc): </Name><Value>%2$s and %3$s</Value>" 33200 ), 33201 filter.name, 33202 activeElements[0].label[0], 33203 activeElements[0].label[1] 33204 ), 33205 filterTextWrappers 33206 ), 33207 filter(item, field, filterValue) { 33208 if (!Array.isArray(filterValue) || filterValue.length !== 2 || filterValue[0] === void 0 || filterValue[1] === void 0) { 33209 return true; 33210 } 33211 const fieldValue = field.getValue({ item }); 33212 if (typeof fieldValue === "number" || fieldValue instanceof Date || typeof fieldValue === "string") { 33213 return fieldValue >= filterValue[0] && fieldValue <= filterValue[1]; 33214 } 33215 return false; 33216 }, 33217 selection: "custom" 33218 }, 33219 { 33220 name: OPERATOR_IN_THE_PAST, 33221 /* translators: DataViews operator name */ 33222 label: (0, import_i18n30.__)("In the past"), 33223 filterText: (filter, activeElements) => (0, import_element114.createInterpolateElement)( 33224 (0, import_i18n30.sprintf)( 33225 /* translators: 1: Filter name (e.g. "Date"). 2: Filter value (e.g. "7 days"): "Date is in the past: 7 days". */ 33226 (0, import_i18n30.__)( 33227 "<Name>%1$s is in the past: </Name><Value>%2$s</Value>" 33228 ), 33229 filter.name, 33230 `$activeElements[0].value.value} $activeElements[0].value.unit}` 33231 ), 33232 filterTextWrappers 33233 ), 33234 filter(item, field, filterValue) { 33235 if (filterValue?.value === void 0 || filterValue?.unit === void 0) { 33236 return true; 33237 } 33238 const targetDate = getRelativeDate( 33239 filterValue.value, 33240 filterValue.unit 33241 ); 33242 const fieldValue = (0, import_date.getDate)(field.getValue({ item })); 33243 return fieldValue >= targetDate && fieldValue <= /* @__PURE__ */ new Date(); 33244 }, 33245 selection: "custom" 33246 }, 33247 { 33248 name: OPERATOR_OVER, 33249 /* translators: DataViews operator name */ 33250 label: (0, import_i18n30.__)("Over"), 33251 filterText: (filter, activeElements) => (0, import_element114.createInterpolateElement)( 33252 (0, import_i18n30.sprintf)( 33253 /* translators: 1: Filter name (e.g. "Date"). 2: Filter value (e.g. "7 days"): "Date is over: 7 days". */ 33254 (0, import_i18n30.__)("<Name>%1$s is over: </Name><Value>%2$s</Value>"), 33255 filter.name, 33256 `$activeElements[0].value.value} $activeElements[0].value.unit}` 33257 ), 33258 filterTextWrappers 33259 ), 33260 filter(item, field, filterValue) { 33261 if (filterValue?.value === void 0 || filterValue?.unit === void 0) { 33262 return true; 33263 } 33264 const targetDate = getRelativeDate( 33265 filterValue.value, 33266 filterValue.unit 33267 ); 33268 const fieldValue = (0, import_date.getDate)(field.getValue({ item })); 33269 return fieldValue < targetDate; 33270 }, 33271 selection: "custom" 33272 }, 33273 { 33274 name: OPERATOR_IS, 33275 /* translators: DataViews operator name */ 33276 label: (0, import_i18n30.__)("Is"), 33277 filterText: (filter, activeElements) => (0, import_element114.createInterpolateElement)( 33278 (0, import_i18n30.sprintf)( 33279 /* translators: 1: Filter name (e.g. "Author"). 2: Filter value (e.g. "Admin"): "Author is: Admin". */ 33280 (0, import_i18n30.__)("<Name>%1$s is: </Name><Value>%2$s</Value>"), 33281 filter.name, 33282 activeElements[0].label 33283 ), 33284 filterTextWrappers 33285 ), 33286 filter(item, field, filterValue) { 33287 return filterValue === field.getValue({ item }) || filterValue === void 0; 33288 }, 33289 selection: "single" 33290 }, 33291 { 33292 name: OPERATOR_IS_NOT, 33293 /* translators: DataViews operator name */ 33294 label: (0, import_i18n30.__)("Is not"), 33295 filterText: (filter, activeElements) => (0, import_element114.createInterpolateElement)( 33296 (0, import_i18n30.sprintf)( 33297 /* translators: 1: Filter name (e.g. "Author"). 2: Filter value (e.g. "Admin"): "Author is not: Admin". */ 33298 (0, import_i18n30.__)("<Name>%1$s is not: </Name><Value>%2$s</Value>"), 33299 filter.name, 33300 activeElements[0].label 33301 ), 33302 filterTextWrappers 33303 ), 33304 filter(item, field, filterValue) { 33305 return filterValue !== field.getValue({ item }); 33306 }, 33307 selection: "single" 33308 }, 33309 { 33310 name: OPERATOR_LESS_THAN, 33311 /* translators: DataViews operator name */ 33312 label: (0, import_i18n30.__)("Less than"), 33313 filterText: (filter, activeElements) => (0, import_element114.createInterpolateElement)( 33314 (0, import_i18n30.sprintf)( 33315 /* translators: 1: Filter name (e.g. "Count"). 2: Filter value (e.g. "10"): "Count is less than: 10". */ 33316 (0, import_i18n30.__)("<Name>%1$s is less than: </Name><Value>%2$s</Value>"), 33317 filter.name, 33318 activeElements[0].label 33319 ), 33320 filterTextWrappers 33321 ), 33322 filter(item, field, filterValue) { 33323 if (filterValue === void 0) { 33324 return true; 33325 } 33326 const fieldValue = field.getValue({ item }); 33327 return fieldValue < filterValue; 33328 }, 33329 selection: "single" 33330 }, 33331 { 33332 name: OPERATOR_GREATER_THAN, 33333 /* translators: DataViews operator name */ 33334 label: (0, import_i18n30.__)("Greater than"), 33335 filterText: (filter, activeElements) => (0, import_element114.createInterpolateElement)( 33336 (0, import_i18n30.sprintf)( 33337 /* translators: 1: Filter name (e.g. "Count"). 2: Filter value (e.g. "10"): "Count is greater than: 10". */ 33338 (0, import_i18n30.__)( 33339 "<Name>%1$s is greater than: </Name><Value>%2$s</Value>" 33340 ), 33341 filter.name, 33342 activeElements[0].label 33343 ), 33344 filterTextWrappers 33345 ), 33346 filter(item, field, filterValue) { 33347 if (filterValue === void 0) { 33348 return true; 33349 } 33350 const fieldValue = field.getValue({ item }); 33351 return fieldValue > filterValue; 33352 }, 33353 selection: "single" 33354 }, 33355 { 33356 name: OPERATOR_LESS_THAN_OR_EQUAL, 33357 /* translators: DataViews operator name */ 33358 label: (0, import_i18n30.__)("Less than or equal"), 33359 filterText: (filter, activeElements) => (0, import_element114.createInterpolateElement)( 33360 (0, import_i18n30.sprintf)( 33361 /* translators: 1: Filter name (e.g. "Count"). 2: Filter value (e.g. "10"): "Count is less than or equal to: 10". */ 33362 (0, import_i18n30.__)( 33363 "<Name>%1$s is less than or equal to: </Name><Value>%2$s</Value>" 33364 ), 33365 filter.name, 33366 activeElements[0].label 33367 ), 33368 filterTextWrappers 33369 ), 33370 filter(item, field, filterValue) { 33371 if (filterValue === void 0) { 33372 return true; 33373 } 33374 const fieldValue = field.getValue({ item }); 33375 return fieldValue <= filterValue; 33376 }, 33377 selection: "single" 33378 }, 33379 { 33380 name: OPERATOR_GREATER_THAN_OR_EQUAL, 33381 /* translators: DataViews operator name */ 33382 label: (0, import_i18n30.__)("Greater than or equal"), 33383 filterText: (filter, activeElements) => (0, import_element114.createInterpolateElement)( 33384 (0, import_i18n30.sprintf)( 33385 /* translators: 1: Filter name (e.g. "Count"). 2: Filter value (e.g. "10"): "Count is greater than or equal to: 10". */ 33386 (0, import_i18n30.__)( 33387 "<Name>%1$s is greater than or equal to: </Name><Value>%2$s</Value>" 33388 ), 33389 filter.name, 33390 activeElements[0].label 33391 ), 33392 filterTextWrappers 33393 ), 33394 filter(item, field, filterValue) { 33395 if (filterValue === void 0) { 33396 return true; 33397 } 33398 const fieldValue = field.getValue({ item }); 33399 return fieldValue >= filterValue; 33400 }, 33401 selection: "single" 33402 }, 33403 { 33404 name: OPERATOR_BEFORE, 33405 /* translators: DataViews operator name */ 33406 label: (0, import_i18n30.__)("Before"), 33407 filterText: (filter, activeElements) => (0, import_element114.createInterpolateElement)( 33408 (0, import_i18n30.sprintf)( 33409 /* translators: 1: Filter name (e.g. "Date"). 2: Filter value (e.g. "2024-01-01"): "Date is before: 2024-01-01". */ 33410 (0, import_i18n30.__)("<Name>%1$s is before: </Name><Value>%2$s</Value>"), 33411 filter.name, 33412 activeElements[0].label 33413 ), 33414 filterTextWrappers 33415 ), 33416 filter(item, field, filterValue) { 33417 if (filterValue === void 0) { 33418 return true; 33419 } 33420 const filterDate = (0, import_date.getDate)(filterValue); 33421 const fieldDate = (0, import_date.getDate)(field.getValue({ item })); 33422 return fieldDate < filterDate; 33423 }, 33424 selection: "single" 33425 }, 33426 { 33427 name: OPERATOR_AFTER, 33428 /* translators: DataViews operator name */ 33429 label: (0, import_i18n30.__)("After"), 33430 filterText: (filter, activeElements) => (0, import_element114.createInterpolateElement)( 33431 (0, import_i18n30.sprintf)( 33432 /* translators: 1: Filter name (e.g. "Date"). 2: Filter value (e.g. "2024-01-01"): "Date is after: 2024-01-01". */ 33433 (0, import_i18n30.__)("<Name>%1$s is after: </Name><Value>%2$s</Value>"), 33434 filter.name, 33435 activeElements[0].label 33436 ), 33437 filterTextWrappers 33438 ), 33439 filter(item, field, filterValue) { 33440 if (filterValue === void 0) { 33441 return true; 33442 } 33443 const filterDate = (0, import_date.getDate)(filterValue); 33444 const fieldDate = (0, import_date.getDate)(field.getValue({ item })); 33445 return fieldDate > filterDate; 33446 }, 33447 selection: "single" 33448 }, 33449 { 33450 name: OPERATOR_BEFORE_INC, 33451 /* translators: DataViews operator name */ 33452 label: (0, import_i18n30.__)("Before (inc)"), 33453 filterText: (filter, activeElements) => (0, import_element114.createInterpolateElement)( 33454 (0, import_i18n30.sprintf)( 33455 /* translators: 1: Filter name (e.g. "Date"). 2: Filter value (e.g. "2024-01-01"): "Date is on or before: 2024-01-01". */ 33456 (0, import_i18n30.__)( 33457 "<Name>%1$s is on or before: </Name><Value>%2$s</Value>" 33458 ), 33459 filter.name, 33460 activeElements[0].label 33461 ), 33462 filterTextWrappers 33463 ), 33464 filter(item, field, filterValue) { 33465 if (filterValue === void 0) { 33466 return true; 33467 } 33468 const filterDate = (0, import_date.getDate)(filterValue); 33469 const fieldDate = (0, import_date.getDate)(field.getValue({ item })); 33470 return fieldDate <= filterDate; 33471 }, 33472 selection: "single" 33473 }, 33474 { 33475 name: OPERATOR_AFTER_INC, 33476 /* translators: DataViews operator name */ 33477 label: (0, import_i18n30.__)("After (inc)"), 33478 filterText: (filter, activeElements) => (0, import_element114.createInterpolateElement)( 33479 (0, import_i18n30.sprintf)( 33480 /* translators: 1: Filter name (e.g. "Date"). 2: Filter value (e.g. "2024-01-01"): "Date is on or after: 2024-01-01". */ 33481 (0, import_i18n30.__)( 33482 "<Name>%1$s is on or after: </Name><Value>%2$s</Value>" 33483 ), 33484 filter.name, 33485 activeElements[0].label 33486 ), 33487 filterTextWrappers 33488 ), 33489 filter(item, field, filterValue) { 33490 if (filterValue === void 0) { 33491 return true; 33492 } 33493 const filterDate = (0, import_date.getDate)(filterValue); 33494 const fieldDate = (0, import_date.getDate)(field.getValue({ item })); 33495 return fieldDate >= filterDate; 33496 }, 33497 selection: "single" 33498 }, 33499 { 33500 name: OPERATOR_CONTAINS, 33501 /* translators: DataViews operator name */ 33502 label: (0, import_i18n30.__)("Contains"), 33503 filterText: (filter, activeElements) => (0, import_element114.createInterpolateElement)( 33504 (0, import_i18n30.sprintf)( 33505 /* translators: 1: Filter name (e.g. "Title"). 2: Filter value (e.g. "Hello"): "Title contains: Hello". */ 33506 (0, import_i18n30.__)("<Name>%1$s contains: </Name><Value>%2$s</Value>"), 33507 filter.name, 33508 activeElements[0].label 33509 ), 33510 filterTextWrappers 33511 ), 33512 filter(item, field, filterValue) { 33513 if (filterValue === void 0) { 33514 return true; 33515 } 33516 const fieldValue = field.getValue({ item }); 33517 return typeof fieldValue === "string" && filterValue && fieldValue.toLowerCase().includes(String(filterValue).toLowerCase()); 33518 }, 33519 selection: "single" 33520 }, 33521 { 33522 name: OPERATOR_NOT_CONTAINS, 33523 /* translators: DataViews operator name */ 33524 label: (0, import_i18n30.__)("Doesn't contain"), 33525 filterText: (filter, activeElements) => (0, import_element114.createInterpolateElement)( 33526 (0, import_i18n30.sprintf)( 33527 /* translators: 1: Filter name (e.g. "Title"). 2: Filter value (e.g. "Hello"): "Title doesn't contain: Hello". */ 33528 (0, import_i18n30.__)( 33529 "<Name>%1$s doesn't contain: </Name><Value>%2$s</Value>" 33530 ), 33531 filter.name, 33532 activeElements[0].label 33533 ), 33534 filterTextWrappers 33535 ), 33536 filter(item, field, filterValue) { 33537 if (filterValue === void 0) { 33538 return true; 33539 } 33540 const fieldValue = field.getValue({ item }); 33541 return typeof fieldValue === "string" && filterValue && !fieldValue.toLowerCase().includes(String(filterValue).toLowerCase()); 33542 }, 33543 selection: "single" 33544 }, 33545 { 33546 name: OPERATOR_STARTS_WITH, 33547 /* translators: DataViews operator name */ 33548 label: (0, import_i18n30.__)("Starts with"), 33549 filterText: (filter, activeElements) => (0, import_element114.createInterpolateElement)( 33550 (0, import_i18n30.sprintf)( 33551 /* translators: 1: Filter name (e.g. "Title"). 2: Filter value (e.g. "Hello"): "Title starts with: Hello". */ 33552 (0, import_i18n30.__)("<Name>%1$s starts with: </Name><Value>%2$s</Value>"), 33553 filter.name, 33554 activeElements[0].label 33555 ), 33556 filterTextWrappers 33557 ), 33558 filter(item, field, filterValue) { 33559 if (filterValue === void 0) { 33560 return true; 33561 } 33562 const fieldValue = field.getValue({ item }); 33563 return typeof fieldValue === "string" && filterValue && fieldValue.toLowerCase().startsWith(String(filterValue).toLowerCase()); 33564 }, 33565 selection: "single" 33566 }, 33567 { 33568 name: OPERATOR_ON, 33569 /* translators: DataViews operator name */ 33570 label: (0, import_i18n30.__)("On"), 33571 filterText: (filter, activeElements) => (0, import_element114.createInterpolateElement)( 33572 (0, import_i18n30.sprintf)( 33573 /* translators: 1: Filter name (e.g. "Date"). 2: Filter value (e.g. "2024-01-01"): "Date is: 2024-01-01". */ 33574 (0, import_i18n30.__)("<Name>%1$s is: </Name><Value>%2$s</Value>"), 33575 filter.name, 33576 activeElements[0].label 33577 ), 33578 filterTextWrappers 33579 ), 33580 filter(item, field, filterValue) { 33581 if (filterValue === void 0) { 33582 return true; 33583 } 33584 const filterDate = (0, import_date.getDate)(filterValue); 33585 const fieldDate = (0, import_date.getDate)(field.getValue({ item })); 33586 return filterDate.getTime() === fieldDate.getTime(); 33587 }, 33588 selection: "single" 33589 }, 33590 { 33591 name: OPERATOR_NOT_ON, 33592 /* translators: DataViews operator name */ 33593 label: (0, import_i18n30.__)("Not on"), 33594 filterText: (filter, activeElements) => (0, import_element114.createInterpolateElement)( 33595 (0, import_i18n30.sprintf)( 33596 /* translators: 1: Filter name (e.g. "Date"). 2: Filter value (e.g. "2024-01-01"): "Date is not: 2024-01-01". */ 33597 (0, import_i18n30.__)("<Name>%1$s is not: </Name><Value>%2$s</Value>"), 33598 filter.name, 33599 activeElements[0].label 33600 ), 33601 filterTextWrappers 33602 ), 33603 filter(item, field, filterValue) { 33604 if (filterValue === void 0) { 33605 return true; 33606 } 33607 const filterDate = (0, import_date.getDate)(filterValue); 33608 const fieldDate = (0, import_date.getDate)(field.getValue({ item })); 33609 return filterDate.getTime() !== fieldDate.getTime(); 33610 }, 33611 selection: "single" 33612 } 33613 ]; 33614 var getOperatorByName = (name) => OPERATORS.find((op) => op.name === name); 33615 var getAllOperatorNames = () => OPERATORS.map((op) => op.name); 33616 var isSingleSelectionOperator = (name) => OPERATORS.filter((op) => op.selection === "single").some( 33617 (op) => op.name === name 33618 ); 33619 var isRegisteredOperator = (name) => OPERATORS.some((op) => op.name === name); 33620 33621 // packages/dataviews/build-module/components/dataviews-filters/filter.mjs 33622 var import_jsx_runtime152 = __toESM(require_jsx_runtime(), 1); 33623 var ENTER = "Enter"; 33624 var SPACE = " "; 33625 var FilterText = ({ 33626 activeElements, 33627 filterInView, 33628 filter 33629 }) => { 33630 if (activeElements === void 0 || activeElements.length === 0) { 33631 return filter.name; 33632 } 33633 const operator = getOperatorByName(filterInView?.operator); 33634 if (operator !== void 0) { 33635 return operator.filterText(filter, activeElements); 33636 } 33637 return (0, import_i18n31.sprintf)( 33638 /* translators: 1: Filter name e.g.: "Unknown status for Author". */ 33639 (0, import_i18n31.__)("Unknown status for %1$s"), 33640 filter.name 33641 ); 33642 }; 33643 function OperatorSelector({ 33644 filter, 33645 view, 33646 onChangeView 33647 }) { 33648 const operatorOptions = filter.operators?.map((operator) => ({ 33649 value: operator, 33650 label: getOperatorByName(operator)?.label || operator 33651 })); 33652 const currentFilter = view.filters?.find( 33653 (_filter) => _filter.field === filter.field 33654 ); 33655 const value = currentFilter?.operator || filter.operators[0]; 33656 return operatorOptions.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime152.jsxs)( 33657 Stack, 33658 { 33659 direction: "row", 33660 gap: "sm", 33661 justify: "flex-start", 33662 className: "dataviews-filters__summary-operators-container", 33663 align: "center", 33664 children: [ 33665 /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(import_components21.FlexItem, { className: "dataviews-filters__summary-operators-filter-name", children: filter.name }), 33666 /* @__PURE__ */ (0, import_jsx_runtime152.jsx)( 33667 import_components21.SelectControl, 33668 { 33669 className: "dataviews-filters__summary-operators-filter-select", 33670 label: (0, import_i18n31.__)("Conditions"), 33671 value, 33672 options: operatorOptions, 33673 onChange: (newValue) => { 33674 const newOperator = newValue; 33675 const currentOperator = currentFilter?.operator; 33676 const newFilters = currentFilter ? [ 33677 ...(view.filters ?? []).map( 33678 (_filter) => { 33679 if (_filter.field === filter.field) { 33680 const currentOpSelectionModel = getOperatorByName( 33681 currentOperator 33682 )?.selection; 33683 const newOpSelectionModel = getOperatorByName( 33684 newOperator 33685 )?.selection; 33686 const shouldResetValue = currentOpSelectionModel !== newOpSelectionModel || [ 33687 currentOpSelectionModel, 33688 newOpSelectionModel 33689 ].includes("custom"); 33690 return { 33691 ..._filter, 33692 value: shouldResetValue ? void 0 : _filter.value, 33693 operator: newOperator 33694 }; 33695 } 33696 return _filter; 33697 } 33698 ) 33699 ] : [ 33700 ...view.filters ?? [], 33701 { 33702 field: filter.field, 33703 operator: newOperator, 33704 value: void 0 33705 } 33706 ]; 33707 onChangeView({ 33708 ...view, 33709 page: 1, 33710 filters: newFilters 33711 }); 33712 }, 33713 size: "small", 33714 variant: "minimal", 33715 hideLabelFromVision: true 33716 } 33717 ) 33718 ] 33719 } 33720 ); 33721 } 33722 function Filter({ 33723 addFilterRef, 33724 openedFilter, 33725 fields: fields3, 33726 ...commonProps 33727 }) { 33728 const toggleRef = (0, import_element115.useRef)(null); 33729 const { filter, view, onChangeView } = commonProps; 33730 const filterInView = view.filters?.find( 33731 (f2) => f2.field === filter.field 33732 ); 33733 let activeElements = []; 33734 const field = (0, import_element115.useMemo)(() => { 33735 const currentField = fields3.find((f2) => f2.id === filter.field); 33736 if (currentField) { 33737 return { 33738 ...currentField, 33739 // Configure getValue as if Item was a plain object. 33740 // See related input-widget.tsx 33741 getValue: ({ item }) => item[currentField.id] 33742 }; 33743 } 33744 return currentField; 33745 }, [fields3, filter.field]); 33746 const { elements } = useElements({ 33747 elements: filter.elements, 33748 getElements: filter.getElements 33749 }); 33750 if (elements.length > 0) { 33751 activeElements = elements.filter((element) => { 33752 if (filter.singleSelection) { 33753 return element.value === filterInView?.value; 33754 } 33755 return filterInView?.value?.includes(element.value); 33756 }); 33757 } else if (Array.isArray(filterInView?.value)) { 33758 const label = filterInView.value.map((v2) => { 33759 const formattedValue = field?.getValueFormatted({ 33760 item: { [field.id]: v2 }, 33761 field 33762 }); 33763 return formattedValue || String(v2); 33764 }); 33765 activeElements = [ 33766 { 33767 value: filterInView.value, 33768 // @ts-ignore 33769 label 33770 } 33771 ]; 33772 } else if (typeof filterInView?.value === "object") { 33773 activeElements = [ 33774 { value: filterInView.value, label: filterInView.value } 33775 ]; 33776 } else if (filterInView?.value !== void 0) { 33777 const label = field !== void 0 ? field.getValueFormatted({ 33778 item: { [field.id]: filterInView.value }, 33779 field 33780 }) : String(filterInView.value); 33781 activeElements = [ 33782 { 33783 value: filterInView.value, 33784 label 33785 } 33786 ]; 33787 } 33788 const isPrimary = filter.isPrimary; 33789 const isLocked = filterInView?.isLocked; 33790 const hasValues = !isLocked && filterInView?.value !== void 0; 33791 const canResetOrRemove = !isLocked && (!isPrimary || hasValues); 33792 const resetOrRemoveLabel = isPrimary ? (0, import_i18n31.__)("Reset") : (0, import_i18n31.__)("Remove"); 33793 return /* @__PURE__ */ (0, import_jsx_runtime152.jsx)( 33794 import_components21.Dropdown, 33795 { 33796 defaultOpen: openedFilter === filter.field, 33797 contentClassName: "dataviews-filters__summary-popover", 33798 popoverProps: { placement: "bottom-start", role: "dialog" }, 33799 onClose: () => { 33800 toggleRef.current?.focus(); 33801 }, 33802 renderToggle: ({ isOpen, onToggle }) => /* @__PURE__ */ (0, import_jsx_runtime152.jsxs)("div", { className: "dataviews-filters__summary-chip-container", children: [ 33803 /* @__PURE__ */ (0, import_jsx_runtime152.jsxs)(tooltip_exports.Root, { children: [ 33804 /* @__PURE__ */ (0, import_jsx_runtime152.jsx)( 33805 tooltip_exports.Trigger, 33806 { 33807 render: /* @__PURE__ */ (0, import_jsx_runtime152.jsx)( 33808 "div", 33809 { 33810 className: clsx_default( 33811 "dataviews-filters__summary-chip", 33812 { 33813 "has-reset": canResetOrRemove, 33814 "has-values": hasValues, 33815 "is-not-clickable": isLocked 33816 } 33817 ), 33818 role: "button", 33819 tabIndex: isLocked ? -1 : 0, 33820 onClick: () => { 33821 if (!isLocked) { 33822 onToggle(); 33823 } 33824 }, 33825 onKeyDown: (event) => { 33826 if (!isLocked && [ENTER, SPACE].includes( 33827 event.key 33828 )) { 33829 onToggle(); 33830 event.preventDefault(); 33831 } 33832 }, 33833 "aria-disabled": isLocked, 33834 "aria-pressed": isOpen, 33835 "aria-expanded": isOpen, 33836 ref: toggleRef, 33837 children: /* @__PURE__ */ (0, import_jsx_runtime152.jsx)( 33838 FilterText, 33839 { 33840 activeElements, 33841 filterInView, 33842 filter 33843 } 33844 ) 33845 } 33846 ) 33847 } 33848 ), 33849 /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(tooltip_exports.Popup, { children: (0, import_i18n31.sprintf)( 33850 /* translators: 1: Filter name. */ 33851 (0, import_i18n31.__)("Filter by: %1$s"), 33852 filter.name.toLowerCase() 33853 ) }) 33854 ] }), 33855 canResetOrRemove && /* @__PURE__ */ (0, import_jsx_runtime152.jsxs)(tooltip_exports.Root, { children: [ 33856 /* @__PURE__ */ (0, import_jsx_runtime152.jsx)( 33857 tooltip_exports.Trigger, 33858 { 33859 render: /* @__PURE__ */ (0, import_jsx_runtime152.jsx)( 33860 "button", 33861 { 33862 className: clsx_default( 33863 "dataviews-filters__summary-chip-remove", 33864 { "has-values": hasValues } 33865 ), 33866 "aria-label": resetOrRemoveLabel, 33867 onClick: () => { 33868 onChangeView({ 33869 ...view, 33870 page: 1, 33871 filters: view.filters?.filter( 33872 (_filter) => _filter.field !== filter.field 33873 ) 33874 }); 33875 if (!isPrimary) { 33876 addFilterRef.current?.focus(); 33877 } else { 33878 toggleRef.current?.focus(); 33879 } 33880 }, 33881 children: /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(import_components21.Icon, { icon: close_small_default }) 33882 } 33883 ) 33884 } 33885 ), 33886 /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(tooltip_exports.Popup, { children: resetOrRemoveLabel }) 33887 ] }) 33888 ] }), 33889 renderContent: () => { 33890 return /* @__PURE__ */ (0, import_jsx_runtime152.jsxs)(Stack, { direction: "column", justify: "flex-start", children: [ 33891 /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(OperatorSelector, { ...commonProps }), 33892 commonProps.filter.hasElements ? /* @__PURE__ */ (0, import_jsx_runtime152.jsx)( 33893 SearchWidget, 33894 { 33895 ...commonProps, 33896 filter: { 33897 ...commonProps.filter, 33898 elements 33899 } 33900 } 33901 ) : /* @__PURE__ */ (0, import_jsx_runtime152.jsx)(InputWidget, { ...commonProps, fields: fields3 }) 33902 ] }); 33903 } 33904 } 33905 ); 33906 } 33907 33908 // packages/dataviews/build-module/components/dataviews-filters/add-filter.mjs 33909 var import_components22 = __toESM(require_components(), 1); 33910 var import_i18n32 = __toESM(require_i18n(), 1); 33911 var import_element116 = __toESM(require_element(), 1); 33912 var import_jsx_runtime153 = __toESM(require_jsx_runtime(), 1); 33913 var { Menu: Menu4 } = unlock2(import_components22.privateApis); 33914 function AddFilterMenu({ 33915 filters, 33916 view, 33917 onChangeView, 33918 setOpenedFilter, 33919 triggerProps 33920 }) { 33921 const inactiveFilters = filters.filter((filter) => !filter.isVisible); 33922 return /* @__PURE__ */ (0, import_jsx_runtime153.jsxs)(Menu4, { children: [ 33923 /* @__PURE__ */ (0, import_jsx_runtime153.jsx)(Menu4.TriggerButton, { ...triggerProps }), 33924 /* @__PURE__ */ (0, import_jsx_runtime153.jsx)(Menu4.Popover, { children: inactiveFilters.map((filter) => { 33925 return /* @__PURE__ */ (0, import_jsx_runtime153.jsx)( 33926 Menu4.Item, 33927 { 33928 onClick: () => { 33929 setOpenedFilter(filter.field); 33930 onChangeView({ 33931 ...view, 33932 page: 1, 33933 filters: [ 33934 ...view.filters || [], 33935 { 33936 field: filter.field, 33937 value: void 0, 33938 operator: filter.operators[0] 33939 } 33940 ] 33941 }); 33942 }, 33943 children: /* @__PURE__ */ (0, import_jsx_runtime153.jsx)(Menu4.ItemLabel, { children: filter.name }) 33944 }, 33945 filter.field 33946 ); 33947 }) }) 33948 ] }); 33949 } 33950 function AddFilter({ filters, view, onChangeView, setOpenedFilter }, ref) { 33951 if (!filters.length || filters.every(({ isPrimary }) => isPrimary)) { 33952 return null; 33953 } 33954 const inactiveFilters = filters.filter((filter) => !filter.isVisible); 33955 return /* @__PURE__ */ (0, import_jsx_runtime153.jsx)( 33956 AddFilterMenu, 33957 { 33958 triggerProps: { 33959 render: /* @__PURE__ */ (0, import_jsx_runtime153.jsx)( 33960 import_components22.Button, 33961 { 33962 accessibleWhenDisabled: true, 33963 size: "compact", 33964 className: "dataviews-filters-button", 33965 variant: "tertiary", 33966 disabled: !inactiveFilters.length, 33967 ref 33968 } 33969 ), 33970 children: (0, import_i18n32.__)("Add filter") 33971 }, 33972 ...{ filters, view, onChangeView, setOpenedFilter } 33973 } 33974 ); 33975 } 33976 var add_filter_default = (0, import_element116.forwardRef)(AddFilter); 33977 33978 // packages/dataviews/build-module/components/dataviews-filters/reset-filters.mjs 33979 var import_components23 = __toESM(require_components(), 1); 33980 var import_i18n33 = __toESM(require_i18n(), 1); 33981 var import_jsx_runtime154 = __toESM(require_jsx_runtime(), 1); 33982 function ResetFilter({ 33983 filters, 33984 view, 33985 onChangeView 33986 }) { 33987 const isPrimary = (field) => filters.some( 33988 (_filter) => _filter.field === field && _filter.isPrimary 33989 ); 33990 const isDisabled = !view.search && !view.filters?.some( 33991 (_filter) => !_filter.isLocked && (_filter.value !== void 0 || !isPrimary(_filter.field)) 33992 ); 33993 return /* @__PURE__ */ (0, import_jsx_runtime154.jsx)( 33994 import_components23.Button, 33995 { 33996 disabled: isDisabled, 33997 accessibleWhenDisabled: true, 33998 size: "compact", 33999 variant: "tertiary", 34000 className: "dataviews-filters__reset-button", 34001 onClick: () => { 34002 onChangeView({ 34003 ...view, 34004 page: 1, 34005 search: "", 34006 filters: view.filters?.filter((f2) => !!f2.isLocked) || [] 34007 }); 34008 }, 34009 children: (0, import_i18n33.__)("Reset") 34010 } 34011 ); 34012 } 34013 34014 // packages/dataviews/build-module/components/dataviews-filters/use-filters.mjs 34015 var import_element117 = __toESM(require_element(), 1); 34016 function useFilters(fields3, view) { 34017 return (0, import_element117.useMemo)(() => { 34018 const filters = []; 34019 fields3.forEach((field) => { 34020 if (field.filterBy === false || !field.hasElements && !field.Edit) { 34021 return; 34022 } 34023 const operators = field.filterBy.operators; 34024 const isPrimary = !!field.filterBy?.isPrimary; 34025 const isLocked = view.filters?.some( 34026 (f2) => f2.field === field.id && !!f2.isLocked 34027 ) ?? false; 34028 filters.push({ 34029 field: field.id, 34030 name: field.label, 34031 elements: field.elements, 34032 getElements: field.getElements, 34033 hasElements: field.hasElements, 34034 singleSelection: operators.some( 34035 (op) => isSingleSelectionOperator(op) 34036 ), 34037 operators, 34038 isVisible: isLocked || isPrimary || !!view.filters?.some( 34039 (f2) => f2.field === field.id && isRegisteredOperator(f2.operator) 34040 ), 34041 isPrimary, 34042 isLocked 34043 }); 34044 }); 34045 filters.sort((a2, b2) => { 34046 if (a2.isLocked && !b2.isLocked) { 34047 return -1; 34048 } 34049 if (!a2.isLocked && b2.isLocked) { 34050 return 1; 34051 } 34052 if (a2.isPrimary && !b2.isPrimary) { 34053 return -1; 34054 } 34055 if (!a2.isPrimary && b2.isPrimary) { 34056 return 1; 34057 } 34058 return a2.name.localeCompare(b2.name); 34059 }); 34060 return filters; 34061 }, [fields3, view]); 34062 } 34063 var use_filters_default = useFilters; 34064 34065 // packages/dataviews/build-module/components/dataviews-filters/filters.mjs 34066 var import_jsx_runtime155 = __toESM(require_jsx_runtime(), 1); 34067 function Filters({ className }) { 34068 const { fields: fields3, view, onChangeView, openedFilter, setOpenedFilter } = (0, import_element118.useContext)(dataviews_context_default); 34069 const addFilterRef = (0, import_element118.useRef)(null); 34070 const filters = use_filters_default(fields3, view); 34071 const addFilter = /* @__PURE__ */ (0, import_jsx_runtime155.jsx)( 34072 add_filter_default, 34073 { 34074 filters, 34075 view, 34076 onChangeView, 34077 ref: addFilterRef, 34078 setOpenedFilter 34079 }, 34080 "add-filter" 34081 ); 34082 const visibleFilters = filters.filter((filter) => filter.isVisible); 34083 if (visibleFilters.length === 0) { 34084 return null; 34085 } 34086 const filterComponents = [ 34087 ...visibleFilters.map((filter) => { 34088 return /* @__PURE__ */ (0, import_jsx_runtime155.jsx)( 34089 Filter, 34090 { 34091 filter, 34092 view, 34093 fields: fields3, 34094 onChangeView, 34095 addFilterRef, 34096 openedFilter 34097 }, 34098 filter.field 34099 ); 34100 }), 34101 addFilter 34102 ]; 34103 filterComponents.push( 34104 /* @__PURE__ */ (0, import_jsx_runtime155.jsx)( 34105 ResetFilter, 34106 { 34107 filters, 34108 view, 34109 onChangeView 34110 }, 34111 "reset-filters" 34112 ) 34113 ); 34114 return /* @__PURE__ */ (0, import_jsx_runtime155.jsx)( 34115 Stack, 34116 { 34117 direction: "row", 34118 justify: "flex-start", 34119 gap: "sm", 34120 style: { width: "fit-content" }, 34121 wrap: "wrap", 34122 className, 34123 children: filterComponents 34124 } 34125 ); 34126 } 34127 var filters_default = (0, import_element118.memo)(Filters); 34128 34129 // packages/dataviews/build-module/components/dataviews-filters/toggle.mjs 34130 var import_element119 = __toESM(require_element(), 1); 34131 var import_components24 = __toESM(require_components(), 1); 34132 var import_i18n34 = __toESM(require_i18n(), 1); 34133 var import_jsx_runtime156 = __toESM(require_jsx_runtime(), 1); 34134 function FiltersToggle() { 34135 const { 34136 filters, 34137 view, 34138 onChangeView, 34139 setOpenedFilter, 34140 isShowingFilter, 34141 setIsShowingFilter 34142 } = (0, import_element119.useContext)(dataviews_context_default); 34143 const buttonRef = (0, import_element119.useRef)(null); 34144 const onChangeViewWithFilterVisibility = (0, import_element119.useCallback)( 34145 (_view) => { 34146 onChangeView(_view); 34147 setIsShowingFilter(true); 34148 }, 34149 [onChangeView, setIsShowingFilter] 34150 ); 34151 if (filters.length === 0) { 34152 return null; 34153 } 34154 const hasVisibleFilters = filters.some((filter) => filter.isVisible); 34155 const addFilterButtonProps = { 34156 label: (0, import_i18n34.__)("Add filter"), 34157 "aria-expanded": false, 34158 isPressed: false 34159 }; 34160 const toggleFiltersButtonProps = { 34161 label: (0, import_i18n34._x)("Filter", "verb"), 34162 "aria-expanded": isShowingFilter, 34163 isPressed: isShowingFilter, 34164 onClick: () => { 34165 if (!isShowingFilter) { 34166 setOpenedFilter(null); 34167 } 34168 setIsShowingFilter(!isShowingFilter); 34169 } 34170 }; 34171 const hasPrimaryOrLockedFilters = filters.some( 34172 (filter) => filter.isPrimary || filter.isLocked 34173 ); 34174 const buttonComponent = /* @__PURE__ */ (0, import_jsx_runtime156.jsx)( 34175 import_components24.Button, 34176 { 34177 ref: buttonRef, 34178 className: "dataviews-filters__visibility-toggle", 34179 size: "compact", 34180 icon: funnel_default, 34181 disabled: hasPrimaryOrLockedFilters, 34182 accessibleWhenDisabled: true, 34183 ...hasVisibleFilters ? toggleFiltersButtonProps : addFilterButtonProps 34184 } 34185 ); 34186 return /* @__PURE__ */ (0, import_jsx_runtime156.jsx)("div", { className: "dataviews-filters__container-visibility-toggle", children: !hasVisibleFilters ? /* @__PURE__ */ (0, import_jsx_runtime156.jsx)( 34187 AddFilterMenu, 34188 { 34189 filters, 34190 view, 34191 onChangeView: onChangeViewWithFilterVisibility, 34192 setOpenedFilter, 34193 triggerProps: { render: buttonComponent } 34194 } 34195 ) : /* @__PURE__ */ (0, import_jsx_runtime156.jsx)( 34196 FilterVisibilityToggle, 34197 { 34198 buttonRef, 34199 filtersCount: view.filters?.length, 34200 children: buttonComponent 34201 } 34202 ) }); 34203 } 34204 function FilterVisibilityToggle({ 34205 buttonRef, 34206 filtersCount, 34207 children 34208 }) { 34209 (0, import_element119.useEffect)( 34210 () => () => { 34211 buttonRef.current?.focus(); 34212 }, 34213 [buttonRef] 34214 ); 34215 return /* @__PURE__ */ (0, import_jsx_runtime156.jsxs)(import_jsx_runtime156.Fragment, { children: [ 34216 children, 34217 !!filtersCount && /* @__PURE__ */ (0, import_jsx_runtime156.jsx)("span", { className: "dataviews-filters-toggle__count", children: filtersCount }) 34218 ] }); 34219 } 34220 var toggle_default = FiltersToggle; 34221 34222 // packages/dataviews/build-module/components/dataviews-filters/filters-toggled.mjs 34223 var import_element120 = __toESM(require_element(), 1); 34224 var import_jsx_runtime157 = __toESM(require_jsx_runtime(), 1); 34225 function FiltersToggled(props) { 34226 const { isShowingFilter } = (0, import_element120.useContext)(dataviews_context_default); 34227 if (!isShowingFilter) { 34228 return null; 34229 } 34230 return /* @__PURE__ */ (0, import_jsx_runtime157.jsx)(filters_default, { ...props }); 34231 } 34232 var filters_toggled_default = FiltersToggled; 34233 34234 // packages/dataviews/build-module/components/dataviews-layout/index.mjs 34235 var import_element121 = __toESM(require_element(), 1); 34236 var import_components25 = __toESM(require_components(), 1); 34237 var import_i18n35 = __toESM(require_i18n(), 1); 34238 var import_jsx_runtime158 = __toESM(require_jsx_runtime(), 1); 34239 function DataViewsLayout({ className }) { 34240 const { 34241 actions = [], 34242 data, 34243 fields: fields3, 34244 getItemId: getItemId2, 34245 getItemLevel, 34246 hasInitiallyLoaded, 34247 isLoading, 34248 view, 34249 onChangeView, 34250 selection, 34251 onChangeSelection, 34252 setOpenedFilter, 34253 onClickItem, 34254 isItemClickable: isItemClickable2, 34255 renderItemLink, 34256 defaultLayouts, 34257 containerRef, 34258 empty = /* @__PURE__ */ (0, import_jsx_runtime158.jsx)("p", { children: (0, import_i18n35.__)("No results") }) 34259 } = (0, import_element121.useContext)(dataviews_context_default); 34260 const isDelayedInitialLoading = useDelayedLoading(!hasInitiallyLoaded, { 34261 delay: 200 34262 }); 34263 if (!hasInitiallyLoaded) { 34264 if (!isDelayedInitialLoading) { 34265 return null; 34266 } 34267 return /* @__PURE__ */ (0, import_jsx_runtime158.jsx)("div", { className: "dataviews-loading", children: /* @__PURE__ */ (0, import_jsx_runtime158.jsx)("p", { children: /* @__PURE__ */ (0, import_jsx_runtime158.jsx)(import_components25.Spinner, {}) }) }); 34268 } 34269 const ViewComponent = VIEW_LAYOUTS.find( 34270 (v2) => v2.type === view.type && defaultLayouts[v2.type] 34271 )?.component; 34272 return /* @__PURE__ */ (0, import_jsx_runtime158.jsx)("div", { className: "dataviews-layout__container", ref: containerRef, children: /* @__PURE__ */ (0, import_jsx_runtime158.jsx)( 34273 ViewComponent, 34274 { 34275 className, 34276 actions, 34277 data, 34278 fields: fields3, 34279 getItemId: getItemId2, 34280 getItemLevel, 34281 isLoading, 34282 onChangeView, 34283 onChangeSelection, 34284 selection, 34285 setOpenedFilter, 34286 onClickItem, 34287 renderItemLink, 34288 isItemClickable: isItemClickable2, 34289 view, 34290 empty 34291 } 34292 ) }); 34293 } 34294 34295 // packages/dataviews/build-module/components/dataviews-search/index.mjs 34296 var import_i18n36 = __toESM(require_i18n(), 1); 34297 var import_element122 = __toESM(require_element(), 1); 34298 var import_components26 = __toESM(require_components(), 1); 34299 var import_compose16 = __toESM(require_compose(), 1); 34300 var import_jsx_runtime159 = __toESM(require_jsx_runtime(), 1); 34301 var DataViewsSearch = (0, import_element122.memo)(function Search({ label }) { 34302 const { view, onChangeView } = (0, import_element122.useContext)(dataviews_context_default); 34303 const [search, setSearch, debouncedSearch] = (0, import_compose16.useDebouncedInput)( 34304 view.search 34305 ); 34306 (0, import_element122.useEffect)(() => { 34307 if (view.search !== debouncedSearch) { 34308 setSearch(view.search ?? ""); 34309 } 34310 }, [view.search, setSearch]); 34311 const onChangeViewRef = (0, import_element122.useRef)(onChangeView); 34312 const viewRef = (0, import_element122.useRef)(view); 34313 (0, import_element122.useEffect)(() => { 34314 onChangeViewRef.current = onChangeView; 34315 viewRef.current = view; 34316 }, [onChangeView, view]); 34317 (0, import_element122.useEffect)(() => { 34318 if (debouncedSearch !== viewRef.current?.search) { 34319 onChangeViewRef.current({ 34320 ...viewRef.current, 34321 page: view.page ? 1 : void 0, 34322 startPosition: view.startPosition ? 1 : void 0, 34323 search: debouncedSearch 34324 }); 34325 } 34326 }, [debouncedSearch]); 34327 const searchLabel = label || (0, import_i18n36.__)("Search"); 34328 return /* @__PURE__ */ (0, import_jsx_runtime159.jsx)( 34329 import_components26.SearchControl, 34330 { 34331 className: "dataviews-search", 34332 onChange: setSearch, 34333 value: search, 34334 label: searchLabel, 34335 placeholder: searchLabel, 34336 size: "compact" 34337 } 34338 ); 34339 }); 34340 var dataviews_search_default = DataViewsSearch; 34341 34342 // packages/dataviews/build-module/components/dataviews-view-config/index.mjs 34343 var import_components27 = __toESM(require_components(), 1); 34344 var import_i18n37 = __toESM(require_i18n(), 1); 34345 var import_element123 = __toESM(require_element(), 1); 34346 var import_warning = __toESM(require_warning(), 1); 34347 var import_compose17 = __toESM(require_compose(), 1); 34348 var import_jsx_runtime160 = __toESM(require_jsx_runtime(), 1); 34349 var { Menu: Menu5 } = unlock2(import_components27.privateApis); 34350 var DATAVIEWS_CONFIG_POPOVER_PROPS = { 34351 className: "dataviews-config__popover", 34352 placement: "bottom-end", 34353 offset: 9 34354 }; 34355 function ViewTypeMenu() { 34356 const { view, onChangeView, defaultLayouts } = (0, import_element123.useContext)(dataviews_context_default); 34357 const availableLayouts = Object.keys(defaultLayouts); 34358 if (availableLayouts.length <= 1) { 34359 return null; 34360 } 34361 const activeView = VIEW_LAYOUTS.find((v2) => view.type === v2.type); 34362 return /* @__PURE__ */ (0, import_jsx_runtime160.jsxs)(Menu5, { children: [ 34363 /* @__PURE__ */ (0, import_jsx_runtime160.jsx)( 34364 Menu5.TriggerButton, 34365 { 34366 render: /* @__PURE__ */ (0, import_jsx_runtime160.jsx)( 34367 import_components27.Button, 34368 { 34369 size: "compact", 34370 icon: activeView?.icon, 34371 label: (0, import_i18n37.__)("Layout") 34372 } 34373 ) 34374 } 34375 ), 34376 /* @__PURE__ */ (0, import_jsx_runtime160.jsx)(Menu5.Popover, { children: availableLayouts.map((layout) => { 34377 const config = VIEW_LAYOUTS.find( 34378 (v2) => v2.type === layout 34379 ); 34380 if (!config) { 34381 return null; 34382 } 34383 return /* @__PURE__ */ (0, import_jsx_runtime160.jsx)( 34384 Menu5.RadioItem, 34385 { 34386 value: layout, 34387 name: "view-actions-available-view", 34388 checked: layout === view.type, 34389 hideOnClick: true, 34390 onChange: (e2) => { 34391 switch (e2.target.value) { 34392 case "list": 34393 case "grid": 34394 case "table": 34395 case "pickerGrid": 34396 case "pickerTable": 34397 case "activity": 34398 const viewWithoutLayout = { ...view }; 34399 if ("layout" in viewWithoutLayout) { 34400 delete viewWithoutLayout.layout; 34401 } 34402 return onChangeView({ 34403 ...viewWithoutLayout, 34404 type: e2.target.value, 34405 ...defaultLayouts[e2.target.value] 34406 }); 34407 } 34408 (0, import_warning.default)("Invalid dataview"); 34409 }, 34410 children: /* @__PURE__ */ (0, import_jsx_runtime160.jsx)(Menu5.ItemLabel, { children: config.label }) 34411 }, 34412 layout 34413 ); 34414 }) }) 34415 ] }); 34416 } 34417 function SortFieldControl() { 34418 const { view, fields: fields3, onChangeView } = (0, import_element123.useContext)(dataviews_context_default); 34419 const orderOptions = (0, import_element123.useMemo)(() => { 34420 const sortableFields = fields3.filter( 34421 (field) => field.enableSorting !== false 34422 ); 34423 return sortableFields.map((field) => { 34424 return { 34425 label: field.label, 34426 value: field.id 34427 }; 34428 }); 34429 }, [fields3]); 34430 return /* @__PURE__ */ (0, import_jsx_runtime160.jsx)( 34431 import_components27.SelectControl, 34432 { 34433 __next40pxDefaultSize: true, 34434 label: (0, import_i18n37.__)("Sort by"), 34435 value: view.sort?.field, 34436 options: orderOptions, 34437 onChange: (value) => { 34438 onChangeView({ 34439 ...view, 34440 sort: { 34441 direction: view?.sort?.direction || "desc", 34442 field: value 34443 }, 34444 showLevels: false 34445 }); 34446 } 34447 } 34448 ); 34449 } 34450 function SortDirectionControl() { 34451 const { view, fields: fields3, onChangeView } = (0, import_element123.useContext)(dataviews_context_default); 34452 const sortableFields = fields3.filter( 34453 (field) => field.enableSorting !== false 34454 ); 34455 if (sortableFields.length === 0) { 34456 return null; 34457 } 34458 let value = view.sort?.direction; 34459 if (!value && view.sort?.field) { 34460 value = "desc"; 34461 } 34462 return /* @__PURE__ */ (0, import_jsx_runtime160.jsx)( 34463 import_components27.__experimentalToggleGroupControl, 34464 { 34465 className: "dataviews-view-config__sort-direction", 34466 __next40pxDefaultSize: true, 34467 isBlock: true, 34468 label: (0, import_i18n37.__)("Order"), 34469 value, 34470 onChange: (newDirection) => { 34471 if (newDirection === "asc" || newDirection === "desc") { 34472 onChangeView({ 34473 ...view, 34474 sort: { 34475 direction: newDirection, 34476 field: view.sort?.field || // If there is no field assigned as the sorting field assign the first sortable field. 34477 fields3.find( 34478 (field) => field.enableSorting !== false 34479 )?.id || "" 34480 }, 34481 showLevels: false 34482 }); 34483 return; 34484 } 34485 (0, import_warning.default)("Invalid direction"); 34486 }, 34487 children: SORTING_DIRECTIONS.map((direction) => { 34488 return /* @__PURE__ */ (0, import_jsx_runtime160.jsx)( 34489 import_components27.__experimentalToggleGroupControlOptionIcon, 34490 { 34491 value: direction, 34492 icon: sortIcons[direction], 34493 label: sortLabels[direction] 34494 }, 34495 direction 34496 ); 34497 }) 34498 } 34499 ); 34500 } 34501 function ItemsPerPageControl() { 34502 const { view, config, onChangeView } = (0, import_element123.useContext)(dataviews_context_default); 34503 const { infiniteScrollEnabled } = view; 34504 if (!config || !config.perPageSizes || config.perPageSizes.length < 2 || config.perPageSizes.length > 6 || infiniteScrollEnabled) { 34505 return null; 34506 } 34507 return /* @__PURE__ */ (0, import_jsx_runtime160.jsx)( 34508 import_components27.__experimentalToggleGroupControl, 34509 { 34510 __next40pxDefaultSize: true, 34511 isBlock: true, 34512 label: (0, import_i18n37.__)("Items per page"), 34513 value: view.perPage || 10, 34514 disabled: !view?.sort?.field, 34515 onChange: (newItemsPerPage) => { 34516 const newItemsPerPageNumber = typeof newItemsPerPage === "number" || newItemsPerPage === void 0 ? newItemsPerPage : parseInt(newItemsPerPage, 10); 34517 onChangeView({ 34518 ...view, 34519 perPage: newItemsPerPageNumber, 34520 page: 1 34521 }); 34522 }, 34523 children: config.perPageSizes.map((value) => { 34524 return /* @__PURE__ */ (0, import_jsx_runtime160.jsx)( 34525 import_components27.__experimentalToggleGroupControlOption, 34526 { 34527 value, 34528 label: value.toString() 34529 }, 34530 value 34531 ); 34532 }) 34533 } 34534 ); 34535 } 34536 function ResetViewButton() { 34537 const { onReset } = (0, import_element123.useContext)(dataviews_context_default); 34538 if (onReset === void 0) { 34539 return null; 34540 } 34541 const isDisabled = onReset === false; 34542 return /* @__PURE__ */ (0, import_jsx_runtime160.jsx)( 34543 import_components27.Button, 34544 { 34545 variant: "tertiary", 34546 size: "compact", 34547 disabled: isDisabled, 34548 accessibleWhenDisabled: true, 34549 className: "dataviews-view-config__reset-button", 34550 onClick: () => { 34551 if (typeof onReset === "function") { 34552 onReset(); 34553 } 34554 }, 34555 children: (0, import_i18n37.__)("Reset view") 34556 } 34557 ); 34558 } 34559 function DataviewsViewConfigDropdown() { 34560 const { view, onReset } = (0, import_element123.useContext)(dataviews_context_default); 34561 const popoverId = (0, import_compose17.useInstanceId)( 34562 _DataViewsViewConfig, 34563 "dataviews-view-config-dropdown" 34564 ); 34565 const activeLayout = VIEW_LAYOUTS.find( 34566 (layout) => layout.type === view.type 34567 ); 34568 const isModified = typeof onReset === "function"; 34569 return /* @__PURE__ */ (0, import_jsx_runtime160.jsx)( 34570 import_components27.Dropdown, 34571 { 34572 expandOnMobile: true, 34573 popoverProps: { 34574 ...DATAVIEWS_CONFIG_POPOVER_PROPS, 34575 id: popoverId 34576 }, 34577 renderToggle: ({ onToggle, isOpen }) => { 34578 return /* @__PURE__ */ (0, import_jsx_runtime160.jsxs)("div", { className: "dataviews-view-config__toggle-wrapper", children: [ 34579 /* @__PURE__ */ (0, import_jsx_runtime160.jsx)( 34580 import_components27.Button, 34581 { 34582 size: "compact", 34583 icon: cog_default, 34584 label: (0, import_i18n37._x)( 34585 "View options", 34586 "View is used as a noun" 34587 ), 34588 onClick: onToggle, 34589 "aria-expanded": isOpen ? "true" : "false", 34590 "aria-controls": popoverId 34591 } 34592 ), 34593 isModified && /* @__PURE__ */ (0, import_jsx_runtime160.jsx)("span", { className: "dataviews-view-config__modified-indicator" }) 34594 ] }); 34595 }, 34596 renderContent: () => /* @__PURE__ */ (0, import_jsx_runtime160.jsx)( 34597 import_components27.__experimentalDropdownContentWrapper, 34598 { 34599 paddingSize: "medium", 34600 className: "dataviews-config__popover-content-wrapper", 34601 children: /* @__PURE__ */ (0, import_jsx_runtime160.jsxs)( 34602 Stack, 34603 { 34604 direction: "column", 34605 className: "dataviews-view-config", 34606 gap: "xl", 34607 children: [ 34608 /* @__PURE__ */ (0, import_jsx_runtime160.jsxs)( 34609 Stack, 34610 { 34611 direction: "row", 34612 justify: "space-between", 34613 align: "center", 34614 className: "dataviews-view-config__header", 34615 children: [ 34616 /* @__PURE__ */ (0, import_jsx_runtime160.jsx)( 34617 import_components27.__experimentalHeading, 34618 { 34619 level: 2, 34620 className: "dataviews-settings-section__title", 34621 children: (0, import_i18n37.__)("Appearance") 34622 } 34623 ), 34624 /* @__PURE__ */ (0, import_jsx_runtime160.jsx)(ResetViewButton, {}) 34625 ] 34626 } 34627 ), 34628 /* @__PURE__ */ (0, import_jsx_runtime160.jsxs)(Stack, { direction: "column", gap: "lg", children: [ 34629 /* @__PURE__ */ (0, import_jsx_runtime160.jsxs)( 34630 Stack, 34631 { 34632 direction: "row", 34633 gap: "sm", 34634 className: "dataviews-view-config__sort-controls", 34635 children: [ 34636 /* @__PURE__ */ (0, import_jsx_runtime160.jsx)(SortFieldControl, {}), 34637 /* @__PURE__ */ (0, import_jsx_runtime160.jsx)(SortDirectionControl, {}) 34638 ] 34639 } 34640 ), 34641 !!activeLayout?.viewConfigOptions && /* @__PURE__ */ (0, import_jsx_runtime160.jsx)(activeLayout.viewConfigOptions, {}), 34642 /* @__PURE__ */ (0, import_jsx_runtime160.jsx)(ItemsPerPageControl, {}), 34643 /* @__PURE__ */ (0, import_jsx_runtime160.jsx)(PropertiesSection, {}) 34644 ] }) 34645 ] 34646 } 34647 ) 34648 } 34649 ) 34650 } 34651 ); 34652 } 34653 function _DataViewsViewConfig() { 34654 return /* @__PURE__ */ (0, import_jsx_runtime160.jsxs)(import_jsx_runtime160.Fragment, { children: [ 34655 /* @__PURE__ */ (0, import_jsx_runtime160.jsx)(ViewTypeMenu, {}), 34656 /* @__PURE__ */ (0, import_jsx_runtime160.jsx)(DataviewsViewConfigDropdown, {}) 34657 ] }); 34658 } 34659 var DataViewsViewConfig = (0, import_element123.memo)(_DataViewsViewConfig); 34660 var dataviews_view_config_default = DataViewsViewConfig; 34661 34662 // packages/dataviews/build-module/components/dataform-controls/checkbox.mjs 34663 var import_components28 = __toESM(require_components(), 1); 34664 var import_element124 = __toESM(require_element(), 1); 34665 34666 // packages/dataviews/build-module/components/dataform-controls/utils/get-custom-validity.mjs 34667 function getCustomValidity(isValid2, validity) { 34668 let customValidity; 34669 if (isValid2?.required && validity?.required) { 34670 customValidity = validity?.required?.message ? validity.required : void 0; 34671 } else if (isValid2?.pattern && validity?.pattern) { 34672 customValidity = validity.pattern; 34673 } else if (isValid2?.min && validity?.min) { 34674 customValidity = validity.min; 34675 } else if (isValid2?.max && validity?.max) { 34676 customValidity = validity.max; 34677 } else if (isValid2?.minLength && validity?.minLength) { 34678 customValidity = validity.minLength; 34679 } else if (isValid2?.maxLength && validity?.maxLength) { 34680 customValidity = validity.maxLength; 34681 } else if (isValid2?.elements && validity?.elements) { 34682 customValidity = validity.elements; 34683 } else if (validity?.custom) { 34684 customValidity = validity.custom; 34685 } 34686 return customValidity; 34687 } 34688 34689 // packages/dataviews/build-module/components/dataform-controls/checkbox.mjs 34690 var import_jsx_runtime161 = __toESM(require_jsx_runtime(), 1); 34691 var { ValidatedCheckboxControl } = unlock2(import_components28.privateApis); 34692 function Checkbox({ 34693 field, 34694 onChange, 34695 data, 34696 hideLabelFromVision, 34697 markWhenOptional, 34698 validity 34699 }) { 34700 const { getValue, setValue, label, description, isValid: isValid2 } = field; 34701 const disabled2 = field.isDisabled({ item: data, field }); 34702 const onChangeControl = (0, import_element124.useCallback)(() => { 34703 onChange( 34704 setValue({ item: data, value: !getValue({ item: data }) }) 34705 ); 34706 }, [data, getValue, onChange, setValue]); 34707 return /* @__PURE__ */ (0, import_jsx_runtime161.jsx)( 34708 ValidatedCheckboxControl, 34709 { 34710 required: !!field.isValid?.required, 34711 markWhenOptional, 34712 customValidity: getCustomValidity(isValid2, validity), 34713 hidden: hideLabelFromVision, 34714 label, 34715 help: description, 34716 checked: getValue({ item: data }), 34717 onChange: onChangeControl, 34718 disabled: disabled2 34719 } 34720 ); 34721 } 34722 34723 // packages/dataviews/build-module/components/dataform-controls/combobox.mjs 34724 var import_components29 = __toESM(require_components(), 1); 34725 var import_element125 = __toESM(require_element(), 1); 34726 var import_jsx_runtime162 = __toESM(require_jsx_runtime(), 1); 34727 var { ValidatedComboboxControl } = unlock2(import_components29.privateApis); 34728 function Combobox3({ 34729 data, 34730 field, 34731 onChange, 34732 hideLabelFromVision, 34733 validity 34734 }) { 34735 const { label, description, placeholder, getValue, setValue, isValid: isValid2 } = field; 34736 const value = getValue({ item: data }) ?? ""; 34737 const onChangeControl = (0, import_element125.useCallback)( 34738 (newValue) => onChange(setValue({ item: data, value: newValue ?? "" })), 34739 [data, onChange, setValue] 34740 ); 34741 const { elements, isLoading } = useElements({ 34742 elements: field.elements, 34743 getElements: field.getElements 34744 }); 34745 if (isLoading) { 34746 return /* @__PURE__ */ (0, import_jsx_runtime162.jsx)(import_components29.Spinner, {}); 34747 } 34748 return /* @__PURE__ */ (0, import_jsx_runtime162.jsx)( 34749 ValidatedComboboxControl, 34750 { 34751 required: !!field.isValid?.required, 34752 customValidity: getCustomValidity(isValid2, validity), 34753 label, 34754 value, 34755 help: description, 34756 placeholder, 34757 options: elements, 34758 onChange: onChangeControl, 34759 hideLabelFromVision, 34760 allowReset: true, 34761 expandOnFocus: true 34762 } 34763 ); 34764 } 34765 34766 // packages/dataviews/build-module/components/dataform-controls/datetime.mjs 34767 var import_components31 = __toESM(require_components(), 1); 34768 var import_element128 = __toESM(require_element(), 1); 34769 var import_i18n39 = __toESM(require_i18n(), 1); 34770 var import_date3 = __toESM(require_date(), 1); 34771 34772 // packages/dataviews/build-module/components/dataform-controls/utils/relative-date-control.mjs 34773 var import_components30 = __toESM(require_components(), 1); 34774 var import_element126 = __toESM(require_element(), 1); 34775 var import_i18n38 = __toESM(require_i18n(), 1); 34776 var import_jsx_runtime163 = __toESM(require_jsx_runtime(), 1); 34777 var TIME_UNITS_OPTIONS = { 34778 [OPERATOR_IN_THE_PAST]: [ 34779 { value: "days", label: (0, import_i18n38.__)("Days") }, 34780 { value: "weeks", label: (0, import_i18n38.__)("Weeks") }, 34781 { value: "months", label: (0, import_i18n38.__)("Months") }, 34782 { value: "years", label: (0, import_i18n38.__)("Years") } 34783 ], 34784 [OPERATOR_OVER]: [ 34785 { value: "days", label: (0, import_i18n38.__)("Days ago") }, 34786 { value: "weeks", label: (0, import_i18n38.__)("Weeks ago") }, 34787 { value: "months", label: (0, import_i18n38.__)("Months ago") }, 34788 { value: "years", label: (0, import_i18n38.__)("Years ago") } 34789 ] 34790 }; 34791 function RelativeDateControl({ 34792 className, 34793 data, 34794 field, 34795 onChange, 34796 hideLabelFromVision, 34797 operator 34798 }) { 34799 const options = TIME_UNITS_OPTIONS[operator === OPERATOR_IN_THE_PAST ? "inThePast" : "over"]; 34800 const { id, label, description, getValue, setValue } = field; 34801 const disabled2 = field.isDisabled({ item: data, field }); 34802 const fieldValue = getValue({ item: data }); 34803 const { value: relValue = "", unit = options[0].value } = fieldValue && typeof fieldValue === "object" ? fieldValue : {}; 34804 const onChangeValue = (0, import_element126.useCallback)( 34805 (newValue) => onChange( 34806 setValue({ 34807 item: data, 34808 value: { value: Number(newValue), unit } 34809 }) 34810 ), 34811 [onChange, setValue, data, unit] 34812 ); 34813 const onChangeUnit = (0, import_element126.useCallback)( 34814 (newUnit) => onChange( 34815 setValue({ 34816 item: data, 34817 value: { value: relValue, unit: newUnit } 34818 }) 34819 ), 34820 [onChange, setValue, data, relValue] 34821 ); 34822 return /* @__PURE__ */ (0, import_jsx_runtime163.jsx)( 34823 import_components30.BaseControl, 34824 { 34825 id, 34826 className: clsx_default(className, "dataviews-controls__relative-date"), 34827 label, 34828 hideLabelFromVision, 34829 help: description, 34830 children: /* @__PURE__ */ (0, import_jsx_runtime163.jsxs)(Stack, { direction: "row", gap: "sm", children: [ 34831 /* @__PURE__ */ (0, import_jsx_runtime163.jsx)( 34832 import_components30.__experimentalNumberControl, 34833 { 34834 __next40pxDefaultSize: true, 34835 className: "dataviews-controls__relative-date-number", 34836 spinControls: "none", 34837 min: 1, 34838 step: 1, 34839 value: relValue, 34840 onChange: onChangeValue, 34841 disabled: disabled2 34842 } 34843 ), 34844 /* @__PURE__ */ (0, import_jsx_runtime163.jsx)( 34845 import_components30.SelectControl, 34846 { 34847 className: "dataviews-controls__relative-date-unit", 34848 __next40pxDefaultSize: true, 34849 label: (0, import_i18n38.__)("Unit"), 34850 value: unit, 34851 options, 34852 onChange: onChangeUnit, 34853 hideLabelFromVision: true, 34854 disabled: disabled2 34855 } 34856 ) 34857 ] }) 34858 } 34859 ); 34860 } 34861 34862 // packages/dataviews/build-module/components/dataform-controls/utils/use-disabled-date-matchers.mjs 34863 var import_element127 = __toESM(require_element(), 1); 34864 function useDisabledDateMatchers(isValid2, parseDateFn) { 34865 const minConstraint = typeof isValid2.min?.constraint === "string" ? isValid2.min.constraint : void 0; 34866 const maxConstraint = typeof isValid2.max?.constraint === "string" ? isValid2.max.constraint : void 0; 34867 const disabledMatchers = (0, import_element127.useMemo)(() => { 34868 const matchers = []; 34869 if (minConstraint) { 34870 const minDate = parseDateFn(minConstraint); 34871 if (minDate) { 34872 matchers.push({ before: minDate }); 34873 } 34874 } 34875 if (maxConstraint) { 34876 const maxDate = parseDateFn(maxConstraint); 34877 if (maxDate) { 34878 matchers.push({ after: maxDate }); 34879 } 34880 } 34881 return matchers.length > 0 ? matchers : void 0; 34882 }, [minConstraint, maxConstraint, parseDateFn]); 34883 return { minConstraint, maxConstraint, disabledMatchers }; 34884 } 34885 34886 // packages/dataviews/build-module/field-types/utils/parse-date-time.mjs 34887 var import_date2 = __toESM(require_date(), 1); 34888 function parseDateTime(dateTimeString) { 34889 if (!dateTimeString) { 34890 return null; 34891 } 34892 const parsed = (0, import_date2.getDate)(dateTimeString); 34893 return parsed && isValid(parsed) ? parsed : null; 34894 } 34895 34896 // packages/dataviews/build-module/components/dataform-controls/datetime.mjs 34897 var import_jsx_runtime164 = __toESM(require_jsx_runtime(), 1); 34898 var { DateCalendar, ValidatedInputControl } = unlock2(import_components31.privateApis); 34899 var formatDateTime = (value) => { 34900 if (!value) { 34901 return ""; 34902 } 34903 return (0, import_date3.dateI18n)("Y-m-d\\TH:i", (0, import_date3.getDate)(value)); 34904 }; 34905 function CalendarDateTimeControl({ 34906 data, 34907 field, 34908 onChange, 34909 hideLabelFromVision, 34910 markWhenOptional, 34911 validity, 34912 config 34913 }) { 34914 const { compact } = config || {}; 34915 const { id, label, description, setValue, getValue, isValid: isValid2 } = field; 34916 const disabled2 = field.isDisabled({ item: data, field }); 34917 const fieldValue = getValue({ item: data }); 34918 const value = typeof fieldValue === "string" ? fieldValue : void 0; 34919 const [calendarMonth, setCalendarMonth] = (0, import_element128.useState)(() => { 34920 const parsedDate = parseDateTime(value); 34921 return parsedDate || /* @__PURE__ */ new Date(); 34922 }); 34923 const inputControlRef = (0, import_element128.useRef)(null); 34924 const validationTimeoutRef = (0, import_element128.useRef)(void 0); 34925 const previousFocusRef = (0, import_element128.useRef)(null); 34926 const { minConstraint, maxConstraint, disabledMatchers } = useDisabledDateMatchers(isValid2, parseDateTime); 34927 const onChangeCallback = (0, import_element128.useCallback)( 34928 (newValue) => onChange(setValue({ item: data, value: newValue })), 34929 [data, onChange, setValue] 34930 ); 34931 (0, import_element128.useEffect)(() => { 34932 return () => { 34933 if (validationTimeoutRef.current) { 34934 clearTimeout(validationTimeoutRef.current); 34935 } 34936 }; 34937 }, []); 34938 const onSelectDate = (0, import_element128.useCallback)( 34939 (newDate) => { 34940 let dateTimeValue; 34941 if (newDate) { 34942 const wpDate = (0, import_date3.dateI18n)("Y-m-d", newDate); 34943 let wpTime; 34944 if (value) { 34945 wpTime = (0, import_date3.dateI18n)("H:i", (0, import_date3.getDate)(value)); 34946 } else { 34947 wpTime = (0, import_date3.dateI18n)("H:i", newDate); 34948 } 34949 const finalDateTime = (0, import_date3.getDate)(`$wpDate}T$wpTime}`); 34950 dateTimeValue = finalDateTime.toISOString(); 34951 onChangeCallback(dateTimeValue); 34952 if (validationTimeoutRef.current) { 34953 clearTimeout(validationTimeoutRef.current); 34954 } 34955 } else { 34956 onChangeCallback(void 0); 34957 } 34958 previousFocusRef.current = inputControlRef.current && inputControlRef.current.ownerDocument.activeElement; 34959 validationTimeoutRef.current = setTimeout(() => { 34960 if (inputControlRef.current) { 34961 inputControlRef.current.focus(); 34962 inputControlRef.current.blur(); 34963 onChangeCallback(dateTimeValue); 34964 if (previousFocusRef.current && previousFocusRef.current instanceof HTMLElement) { 34965 previousFocusRef.current.focus(); 34966 } 34967 } 34968 }, 0); 34969 }, 34970 [onChangeCallback, value] 34971 ); 34972 const handleManualDateTimeChange = (0, import_element128.useCallback)( 34973 (newValue) => { 34974 if (newValue) { 34975 const dateTime = (0, import_date3.getDate)(newValue); 34976 onChangeCallback(dateTime.toISOString()); 34977 const parsedDate = parseDateTime(dateTime.toISOString()); 34978 if (parsedDate) { 34979 setCalendarMonth(parsedDate); 34980 } 34981 } else { 34982 onChangeCallback(void 0); 34983 } 34984 }, 34985 [onChangeCallback] 34986 ); 34987 const { format: fieldFormat } = field; 34988 const weekStartsOn = fieldFormat.weekStartsOn ?? (0, import_date3.getSettings)().l10n.startOfWeek; 34989 const { 34990 timezone: { string: timezoneString } 34991 } = (0, import_date3.getSettings)(); 34992 let displayLabel = label; 34993 if (isValid2?.required && !markWhenOptional && !hideLabelFromVision) { 34994 displayLabel = `$label} (${(0, import_i18n39.__)("Required")})`; 34995 } else if (!isValid2?.required && markWhenOptional && !hideLabelFromVision) { 34996 displayLabel = `$label} (${(0, import_i18n39.__)("Optional")})`; 34997 } 34998 return /* @__PURE__ */ (0, import_jsx_runtime164.jsx)( 34999 import_components31.BaseControl, 35000 { 35001 id, 35002 label: displayLabel, 35003 help: description, 35004 hideLabelFromVision, 35005 children: /* @__PURE__ */ (0, import_jsx_runtime164.jsxs)(Stack, { direction: "column", gap: "lg", children: [ 35006 /* @__PURE__ */ (0, import_jsx_runtime164.jsx)( 35007 ValidatedInputControl, 35008 { 35009 ref: inputControlRef, 35010 __next40pxDefaultSize: true, 35011 required: !!isValid2?.required, 35012 customValidity: getCustomValidity(isValid2, validity), 35013 type: "datetime-local", 35014 label: (0, import_i18n39.__)("Date time"), 35015 hideLabelFromVision: true, 35016 value: formatDateTime(value), 35017 onChange: handleManualDateTimeChange, 35018 disabled: disabled2, 35019 min: minConstraint ? formatDateTime(minConstraint) : void 0, 35020 max: maxConstraint ? formatDateTime(maxConstraint) : void 0 35021 } 35022 ), 35023 !compact && /* @__PURE__ */ (0, import_jsx_runtime164.jsx)( 35024 DateCalendar, 35025 { 35026 style: { width: "100%" }, 35027 selected: value ? parseDateTime(value) || void 0 : void 0, 35028 onSelect: onSelectDate, 35029 month: calendarMonth, 35030 onMonthChange: setCalendarMonth, 35031 timeZone: timezoneString || void 0, 35032 weekStartsOn, 35033 disabled: disabled2 || disabledMatchers 35034 } 35035 ) 35036 ] }) 35037 } 35038 ); 35039 } 35040 function DateTime({ 35041 data, 35042 field, 35043 onChange, 35044 hideLabelFromVision, 35045 markWhenOptional, 35046 operator, 35047 validity, 35048 config 35049 }) { 35050 if (operator === OPERATOR_IN_THE_PAST || operator === OPERATOR_OVER) { 35051 return /* @__PURE__ */ (0, import_jsx_runtime164.jsx)( 35052 RelativeDateControl, 35053 { 35054 className: "dataviews-controls__datetime", 35055 data, 35056 field, 35057 onChange, 35058 hideLabelFromVision, 35059 operator 35060 } 35061 ); 35062 } 35063 return /* @__PURE__ */ (0, import_jsx_runtime164.jsx)( 35064 CalendarDateTimeControl, 35065 { 35066 data, 35067 field, 35068 onChange, 35069 hideLabelFromVision, 35070 markWhenOptional, 35071 validity, 35072 config 35073 } 35074 ); 35075 } 35076 35077 // packages/dataviews/build-module/components/dataform-controls/date.mjs 35078 var import_components32 = __toESM(require_components(), 1); 35079 var import_element129 = __toESM(require_element(), 1); 35080 var import_i18n40 = __toESM(require_i18n(), 1); 35081 var import_date4 = __toESM(require_date(), 1); 35082 var import_jsx_runtime165 = __toESM(require_jsx_runtime(), 1); 35083 var { DateCalendar: DateCalendar2, DateRangeCalendar } = unlock2(import_components32.privateApis); 35084 var DATE_PRESETS = [ 35085 { 35086 id: "today", 35087 label: (0, import_i18n40.__)("Today"), 35088 getValue: () => (0, import_date4.getDate)(null) 35089 }, 35090 { 35091 id: "yesterday", 35092 label: (0, import_i18n40.__)("Yesterday"), 35093 getValue: () => { 35094 const today = (0, import_date4.getDate)(null); 35095 return subDays(today, 1); 35096 } 35097 }, 35098 { 35099 id: "past-week", 35100 label: (0, import_i18n40.__)("Past week"), 35101 getValue: () => { 35102 const today = (0, import_date4.getDate)(null); 35103 return subDays(today, 7); 35104 } 35105 }, 35106 { 35107 id: "past-month", 35108 label: (0, import_i18n40.__)("Past month"), 35109 getValue: () => { 35110 const today = (0, import_date4.getDate)(null); 35111 return subMonths(today, 1); 35112 } 35113 } 35114 ]; 35115 var DATE_RANGE_PRESETS = [ 35116 { 35117 id: "last-7-days", 35118 label: (0, import_i18n40.__)("Last 7 days"), 35119 getValue: () => { 35120 const today = (0, import_date4.getDate)(null); 35121 return [subDays(today, 7), today]; 35122 } 35123 }, 35124 { 35125 id: "last-30-days", 35126 label: (0, import_i18n40.__)("Last 30 days"), 35127 getValue: () => { 35128 const today = (0, import_date4.getDate)(null); 35129 return [subDays(today, 30), today]; 35130 } 35131 }, 35132 { 35133 id: "month-to-date", 35134 label: (0, import_i18n40.__)("Month to date"), 35135 getValue: () => { 35136 const today = (0, import_date4.getDate)(null); 35137 return [startOfMonth(today), today]; 35138 } 35139 }, 35140 { 35141 id: "last-year", 35142 label: (0, import_i18n40.__)("Last year"), 35143 getValue: () => { 35144 const today = (0, import_date4.getDate)(null); 35145 return [subYears(today, 1), today]; 35146 } 35147 }, 35148 { 35149 id: "year-to-date", 35150 label: (0, import_i18n40.__)("Year to date"), 35151 getValue: () => { 35152 const today = (0, import_date4.getDate)(null); 35153 return [startOfYear(today), today]; 35154 } 35155 } 35156 ]; 35157 var parseDate = (dateString) => { 35158 if (!dateString) { 35159 return null; 35160 } 35161 const parsed = (0, import_date4.getDate)(dateString); 35162 return parsed && isValid(parsed) ? parsed : null; 35163 }; 35164 var formatDate = (date) => { 35165 if (!date) { 35166 return ""; 35167 } 35168 return typeof date === "string" ? date : format(date, "yyyy-MM-dd"); 35169 }; 35170 function ValidatedDateControl({ 35171 field, 35172 validity, 35173 inputRefs, 35174 isTouched, 35175 setIsTouched, 35176 children 35177 }) { 35178 const { isValid: isValid2 } = field; 35179 const [customValidity, setCustomValidity] = (0, import_element129.useState)(void 0); 35180 const validateRefs = (0, import_element129.useCallback)(() => { 35181 const refs = Array.isArray(inputRefs) ? inputRefs : [inputRefs]; 35182 for (const ref of refs) { 35183 const input = ref.current; 35184 if (input && !input.validity.valid) { 35185 setCustomValidity({ 35186 type: "invalid", 35187 message: input.validationMessage 35188 }); 35189 return; 35190 } 35191 } 35192 setCustomValidity(void 0); 35193 }, [inputRefs]); 35194 (0, import_element129.useEffect)(() => { 35195 const refs = Array.isArray(inputRefs) ? inputRefs : [inputRefs]; 35196 const result = validity ? getCustomValidity(isValid2, validity) : void 0; 35197 for (const ref of refs) { 35198 const input = ref.current; 35199 if (input) { 35200 input.setCustomValidity( 35201 result?.type === "invalid" && result.message ? result.message : "" 35202 ); 35203 } 35204 } 35205 }, [inputRefs, isValid2, validity]); 35206 (0, import_element129.useEffect)(() => { 35207 const refs = Array.isArray(inputRefs) ? inputRefs : [inputRefs]; 35208 const handleInvalid = (event) => { 35209 event.preventDefault(); 35210 setIsTouched(true); 35211 }; 35212 for (const ref of refs) { 35213 ref.current?.addEventListener("invalid", handleInvalid); 35214 } 35215 return () => { 35216 for (const ref of refs) { 35217 ref.current?.removeEventListener("invalid", handleInvalid); 35218 } 35219 }; 35220 }, [inputRefs, setIsTouched]); 35221 (0, import_element129.useEffect)(() => { 35222 if (!isTouched) { 35223 return; 35224 } 35225 const result = validity ? getCustomValidity(isValid2, validity) : void 0; 35226 if (result) { 35227 setCustomValidity(result); 35228 } else { 35229 validateRefs(); 35230 } 35231 }, [isTouched, isValid2, validity, validateRefs]); 35232 const onBlur = (event) => { 35233 if (isTouched) { 35234 return; 35235 } 35236 if (!event.relatedTarget || !event.currentTarget.contains(event.relatedTarget)) { 35237 setIsTouched(true); 35238 } 35239 }; 35240 return /* @__PURE__ */ (0, import_jsx_runtime165.jsxs)("div", { onBlur, children: [ 35241 children, 35242 /* @__PURE__ */ (0, import_jsx_runtime165.jsx)("div", { "aria-live": "polite", children: customValidity && /* @__PURE__ */ (0, import_jsx_runtime165.jsxs)( 35243 "p", 35244 { 35245 className: clsx_default( 35246 "components-validated-control__indicator", 35247 customValidity.type === "invalid" ? "is-invalid" : void 0 35248 ), 35249 children: [ 35250 /* @__PURE__ */ (0, import_jsx_runtime165.jsx)( 35251 import_components32.Icon, 35252 { 35253 className: "components-validated-control__indicator-icon", 35254 icon: error_default, 35255 size: 16, 35256 fill: "currentColor" 35257 } 35258 ), 35259 customValidity.message 35260 ] 35261 } 35262 ) }) 35263 ] }); 35264 } 35265 function CalendarDateControl({ 35266 data, 35267 field, 35268 onChange, 35269 hideLabelFromVision, 35270 markWhenOptional, 35271 validity 35272 }) { 35273 const { 35274 id, 35275 label, 35276 description, 35277 setValue, 35278 getValue, 35279 isValid: isValid2, 35280 format: fieldFormat 35281 } = field; 35282 const disabled2 = field.isDisabled({ item: data, field }); 35283 const [selectedPresetId, setSelectedPresetId] = (0, import_element129.useState)( 35284 null 35285 ); 35286 const weekStartsOn = fieldFormat.weekStartsOn ?? (0, import_date4.getSettings)().l10n.startOfWeek; 35287 const fieldValue = getValue({ item: data }); 35288 const value = typeof fieldValue === "string" ? fieldValue : void 0; 35289 const [calendarMonth, setCalendarMonth] = (0, import_element129.useState)(() => { 35290 const parsedDate = parseDate(value); 35291 return parsedDate || /* @__PURE__ */ new Date(); 35292 }); 35293 const [isTouched, setIsTouched] = (0, import_element129.useState)(false); 35294 const validityTargetRef = (0, import_element129.useRef)(null); 35295 const { minConstraint, maxConstraint, disabledMatchers } = useDisabledDateMatchers(isValid2, parseDate); 35296 const onChangeCallback = (0, import_element129.useCallback)( 35297 (newValue) => onChange(setValue({ item: data, value: newValue })), 35298 [data, onChange, setValue] 35299 ); 35300 const onSelectDate = (0, import_element129.useCallback)( 35301 (newDate) => { 35302 const dateValue = newDate ? format(newDate, "yyyy-MM-dd") : void 0; 35303 onChangeCallback(dateValue); 35304 setSelectedPresetId(null); 35305 setIsTouched(true); 35306 }, 35307 [onChangeCallback] 35308 ); 35309 const handlePresetClick = (0, import_element129.useCallback)( 35310 (preset) => { 35311 const presetDate = preset.getValue(); 35312 const dateValue = formatDate(presetDate); 35313 setCalendarMonth(presetDate); 35314 onChangeCallback(dateValue); 35315 setSelectedPresetId(preset.id); 35316 setIsTouched(true); 35317 }, 35318 [onChangeCallback] 35319 ); 35320 const handleManualDateChange = (0, import_element129.useCallback)( 35321 (newValue) => { 35322 onChangeCallback(newValue); 35323 if (newValue) { 35324 const parsedDate = parseDate(newValue); 35325 if (parsedDate) { 35326 setCalendarMonth(parsedDate); 35327 } 35328 } 35329 setSelectedPresetId(null); 35330 setIsTouched(true); 35331 }, 35332 [onChangeCallback] 35333 ); 35334 const { 35335 timezone: { string: timezoneString } 35336 } = (0, import_date4.getSettings)(); 35337 let displayLabel = label; 35338 if (isValid2?.required && !markWhenOptional) { 35339 displayLabel = `$label} (${(0, import_i18n40.__)("Required")})`; 35340 } else if (!isValid2?.required && markWhenOptional) { 35341 displayLabel = `$label} (${(0, import_i18n40.__)("Optional")})`; 35342 } 35343 return /* @__PURE__ */ (0, import_jsx_runtime165.jsx)( 35344 ValidatedDateControl, 35345 { 35346 field, 35347 validity, 35348 inputRefs: validityTargetRef, 35349 isTouched, 35350 setIsTouched, 35351 children: /* @__PURE__ */ (0, import_jsx_runtime165.jsx)( 35352 import_components32.BaseControl, 35353 { 35354 id, 35355 className: "dataviews-controls__date", 35356 label: displayLabel, 35357 help: description, 35358 hideLabelFromVision, 35359 children: /* @__PURE__ */ (0, import_jsx_runtime165.jsxs)(Stack, { direction: "column", gap: "lg", children: [ 35360 /* @__PURE__ */ (0, import_jsx_runtime165.jsxs)( 35361 Stack, 35362 { 35363 direction: "row", 35364 gap: "sm", 35365 wrap: "wrap", 35366 justify: "flex-start", 35367 children: [ 35368 DATE_PRESETS.map((preset) => { 35369 const isSelected2 = selectedPresetId === preset.id; 35370 return /* @__PURE__ */ (0, import_jsx_runtime165.jsx)( 35371 import_components32.Button, 35372 { 35373 className: "dataviews-controls__date-preset", 35374 variant: "tertiary", 35375 isPressed: isSelected2, 35376 size: "small", 35377 disabled: disabled2, 35378 accessibleWhenDisabled: true, 35379 onClick: () => handlePresetClick(preset), 35380 children: preset.label 35381 }, 35382 preset.id 35383 ); 35384 }), 35385 /* @__PURE__ */ (0, import_jsx_runtime165.jsx)( 35386 import_components32.Button, 35387 { 35388 className: "dataviews-controls__date-preset", 35389 variant: "tertiary", 35390 isPressed: !selectedPresetId, 35391 size: "small", 35392 disabled: !!selectedPresetId || disabled2, 35393 accessibleWhenDisabled: true, 35394 children: (0, import_i18n40.__)("Custom") 35395 } 35396 ) 35397 ] 35398 } 35399 ), 35400 /* @__PURE__ */ (0, import_jsx_runtime165.jsx)( 35401 import_components32.__experimentalInputControl, 35402 { 35403 __next40pxDefaultSize: true, 35404 ref: validityTargetRef, 35405 type: "date", 35406 label: (0, import_i18n40.__)("Date"), 35407 hideLabelFromVision: true, 35408 value, 35409 onChange: handleManualDateChange, 35410 required: !!field.isValid?.required, 35411 disabled: disabled2, 35412 min: minConstraint, 35413 max: maxConstraint 35414 } 35415 ), 35416 /* @__PURE__ */ (0, import_jsx_runtime165.jsx)( 35417 DateCalendar2, 35418 { 35419 style: { width: "100%" }, 35420 selected: value ? parseDate(value) || void 0 : void 0, 35421 onSelect: onSelectDate, 35422 month: calendarMonth, 35423 onMonthChange: setCalendarMonth, 35424 timeZone: timezoneString || void 0, 35425 weekStartsOn, 35426 disabled: disabled2 || disabledMatchers, 35427 disableNavigation: disabled2 35428 } 35429 ) 35430 ] }) 35431 } 35432 ) 35433 } 35434 ); 35435 } 35436 function CalendarDateRangeControl({ 35437 data, 35438 field, 35439 onChange, 35440 hideLabelFromVision, 35441 markWhenOptional, 35442 validity 35443 }) { 35444 const { 35445 id, 35446 label, 35447 description, 35448 getValue, 35449 setValue, 35450 isValid: isValid2, 35451 format: fieldFormat 35452 } = field; 35453 const disabled2 = field.isDisabled({ item: data, field }); 35454 let value; 35455 const fieldValue = getValue({ item: data }); 35456 if (Array.isArray(fieldValue) && fieldValue.length === 2 && fieldValue.every((date) => typeof date === "string")) { 35457 value = fieldValue; 35458 } 35459 const weekStartsOn = fieldFormat.weekStartsOn ?? (0, import_date4.getSettings)().l10n.startOfWeek; 35460 const { minConstraint, maxConstraint, disabledMatchers } = useDisabledDateMatchers(isValid2, parseDate); 35461 const onChangeCallback = (0, import_element129.useCallback)( 35462 (newValue) => { 35463 onChange( 35464 setValue({ 35465 item: data, 35466 value: newValue 35467 }) 35468 ); 35469 }, 35470 [data, onChange, setValue] 35471 ); 35472 const [selectedPresetId, setSelectedPresetId] = (0, import_element129.useState)( 35473 null 35474 ); 35475 const selectedRange = (0, import_element129.useMemo)(() => { 35476 if (!value) { 35477 return { from: void 0, to: void 0 }; 35478 } 35479 const [from, to] = value; 35480 return { 35481 from: parseDate(from) || void 0, 35482 to: parseDate(to) || void 0 35483 }; 35484 }, [value]); 35485 const [calendarMonth, setCalendarMonth] = (0, import_element129.useState)(() => { 35486 return selectedRange.from || /* @__PURE__ */ new Date(); 35487 }); 35488 const [isTouched, setIsTouched] = (0, import_element129.useState)(false); 35489 const fromInputRef = (0, import_element129.useRef)(null); 35490 const toInputRef = (0, import_element129.useRef)(null); 35491 const updateDateRange = (0, import_element129.useCallback)( 35492 (fromDate, toDate2) => { 35493 if (fromDate && toDate2) { 35494 onChangeCallback([ 35495 formatDate(fromDate), 35496 formatDate(toDate2) 35497 ]); 35498 } else if (!fromDate && !toDate2) { 35499 onChangeCallback(void 0); 35500 } 35501 }, 35502 [onChangeCallback] 35503 ); 35504 const onSelectCalendarRange = (0, import_element129.useCallback)( 35505 (newRange) => { 35506 updateDateRange(newRange?.from, newRange?.to); 35507 setSelectedPresetId(null); 35508 setIsTouched(true); 35509 }, 35510 [updateDateRange] 35511 ); 35512 const handlePresetClick = (0, import_element129.useCallback)( 35513 (preset) => { 35514 const [startDate, endDate] = preset.getValue(); 35515 setCalendarMonth(startDate); 35516 updateDateRange(startDate, endDate); 35517 setSelectedPresetId(preset.id); 35518 setIsTouched(true); 35519 }, 35520 [updateDateRange] 35521 ); 35522 const handleManualDateChange = (0, import_element129.useCallback)( 35523 (fromOrTo, newValue) => { 35524 const [currentFrom, currentTo] = value || [ 35525 void 0, 35526 void 0 35527 ]; 35528 const updatedFrom = fromOrTo === "from" ? newValue : currentFrom; 35529 const updatedTo = fromOrTo === "to" ? newValue : currentTo; 35530 updateDateRange(updatedFrom, updatedTo); 35531 if (newValue) { 35532 const parsedDate = parseDate(newValue); 35533 if (parsedDate) { 35534 setCalendarMonth(parsedDate); 35535 } 35536 } 35537 setSelectedPresetId(null); 35538 setIsTouched(true); 35539 }, 35540 [value, updateDateRange] 35541 ); 35542 const { timezone } = (0, import_date4.getSettings)(); 35543 let displayLabel = label; 35544 if (field.isValid?.required && !markWhenOptional) { 35545 displayLabel = `$label} (${(0, import_i18n40.__)("Required")})`; 35546 } else if (!field.isValid?.required && markWhenOptional) { 35547 displayLabel = `$label} (${(0, import_i18n40.__)("Optional")})`; 35548 } 35549 return /* @__PURE__ */ (0, import_jsx_runtime165.jsx)( 35550 ValidatedDateControl, 35551 { 35552 field, 35553 validity, 35554 inputRefs: [fromInputRef, toInputRef], 35555 isTouched, 35556 setIsTouched, 35557 children: /* @__PURE__ */ (0, import_jsx_runtime165.jsx)( 35558 import_components32.BaseControl, 35559 { 35560 id, 35561 className: "dataviews-controls__date", 35562 label: displayLabel, 35563 help: description, 35564 hideLabelFromVision, 35565 children: /* @__PURE__ */ (0, import_jsx_runtime165.jsxs)(Stack, { direction: "column", gap: "lg", children: [ 35566 /* @__PURE__ */ (0, import_jsx_runtime165.jsxs)( 35567 Stack, 35568 { 35569 direction: "row", 35570 gap: "sm", 35571 wrap: "wrap", 35572 justify: "flex-start", 35573 children: [ 35574 DATE_RANGE_PRESETS.map((preset) => { 35575 const isSelected2 = selectedPresetId === preset.id; 35576 return /* @__PURE__ */ (0, import_jsx_runtime165.jsx)( 35577 import_components32.Button, 35578 { 35579 className: "dataviews-controls__date-preset", 35580 variant: "tertiary", 35581 isPressed: isSelected2, 35582 size: "small", 35583 disabled: disabled2, 35584 accessibleWhenDisabled: true, 35585 onClick: () => handlePresetClick(preset), 35586 children: preset.label 35587 }, 35588 preset.id 35589 ); 35590 }), 35591 /* @__PURE__ */ (0, import_jsx_runtime165.jsx)( 35592 import_components32.Button, 35593 { 35594 className: "dataviews-controls__date-preset", 35595 variant: "tertiary", 35596 isPressed: !selectedPresetId, 35597 size: "small", 35598 accessibleWhenDisabled: true, 35599 disabled: !!selectedPresetId || disabled2, 35600 children: (0, import_i18n40.__)("Custom") 35601 } 35602 ) 35603 ] 35604 } 35605 ), 35606 /* @__PURE__ */ (0, import_jsx_runtime165.jsxs)( 35607 Stack, 35608 { 35609 direction: "row", 35610 gap: "sm", 35611 justify: "space-between", 35612 className: "dataviews-controls__date-range-inputs", 35613 children: [ 35614 /* @__PURE__ */ (0, import_jsx_runtime165.jsx)( 35615 import_components32.__experimentalInputControl, 35616 { 35617 __next40pxDefaultSize: true, 35618 ref: fromInputRef, 35619 type: "date", 35620 label: (0, import_i18n40.__)("From"), 35621 hideLabelFromVision: true, 35622 value: value?.[0], 35623 onChange: (newValue) => handleManualDateChange("from", newValue), 35624 required: !!field.isValid?.required, 35625 disabled: disabled2, 35626 min: minConstraint, 35627 max: maxConstraint 35628 } 35629 ), 35630 /* @__PURE__ */ (0, import_jsx_runtime165.jsx)( 35631 import_components32.__experimentalInputControl, 35632 { 35633 __next40pxDefaultSize: true, 35634 ref: toInputRef, 35635 type: "date", 35636 label: (0, import_i18n40.__)("To"), 35637 hideLabelFromVision: true, 35638 value: value?.[1], 35639 onChange: (newValue) => handleManualDateChange("to", newValue), 35640 required: !!field.isValid?.required, 35641 disabled: disabled2, 35642 min: minConstraint, 35643 max: maxConstraint 35644 } 35645 ) 35646 ] 35647 } 35648 ), 35649 /* @__PURE__ */ (0, import_jsx_runtime165.jsx)( 35650 DateRangeCalendar, 35651 { 35652 style: { width: "100%" }, 35653 selected: selectedRange, 35654 onSelect: onSelectCalendarRange, 35655 month: calendarMonth, 35656 onMonthChange: setCalendarMonth, 35657 timeZone: timezone.string || void 0, 35658 weekStartsOn, 35659 disabled: disabled2 || disabledMatchers 35660 } 35661 ) 35662 ] }) 35663 } 35664 ) 35665 } 35666 ); 35667 } 35668 function DateControl({ 35669 data, 35670 field, 35671 onChange, 35672 hideLabelFromVision, 35673 markWhenOptional, 35674 operator, 35675 validity 35676 }) { 35677 if (operator === OPERATOR_IN_THE_PAST || operator === OPERATOR_OVER) { 35678 return /* @__PURE__ */ (0, import_jsx_runtime165.jsx)( 35679 RelativeDateControl, 35680 { 35681 className: "dataviews-controls__date", 35682 data, 35683 field, 35684 onChange, 35685 hideLabelFromVision, 35686 operator 35687 } 35688 ); 35689 } 35690 if (operator === OPERATOR_BETWEEN) { 35691 return /* @__PURE__ */ (0, import_jsx_runtime165.jsx)( 35692 CalendarDateRangeControl, 35693 { 35694 data, 35695 field, 35696 onChange, 35697 hideLabelFromVision, 35698 markWhenOptional, 35699 validity 35700 } 35701 ); 35702 } 35703 return /* @__PURE__ */ (0, import_jsx_runtime165.jsx)( 35704 CalendarDateControl, 35705 { 35706 data, 35707 field, 35708 onChange, 35709 hideLabelFromVision, 35710 markWhenOptional, 35711 validity 35712 } 35713 ); 35714 } 35715 35716 // packages/dataviews/build-module/components/dataform-controls/select.mjs 35717 var import_components33 = __toESM(require_components(), 1); 35718 var import_element130 = __toESM(require_element(), 1); 35719 var import_jsx_runtime166 = __toESM(require_jsx_runtime(), 1); 35720 var { ValidatedSelectControl } = unlock2(import_components33.privateApis); 35721 function Select({ 35722 data, 35723 field, 35724 onChange, 35725 hideLabelFromVision, 35726 markWhenOptional, 35727 validity 35728 }) { 35729 const { type, label, description, getValue, setValue, isValid: isValid2 } = field; 35730 const disabled2 = field.isDisabled({ item: data, field }); 35731 const isMultiple = type === "array"; 35732 const value = getValue({ item: data }) ?? (isMultiple ? [] : ""); 35733 const onChangeControl = (0, import_element130.useCallback)( 35734 (newValue) => onChange(setValue({ item: data, value: newValue })), 35735 [data, onChange, setValue] 35736 ); 35737 const { elements, isLoading } = useElements({ 35738 elements: field.elements, 35739 getElements: field.getElements 35740 }); 35741 if (isLoading) { 35742 return /* @__PURE__ */ (0, import_jsx_runtime166.jsx)(import_components33.Spinner, {}); 35743 } 35744 return /* @__PURE__ */ (0, import_jsx_runtime166.jsx)( 35745 ValidatedSelectControl, 35746 { 35747 required: !!field.isValid?.required, 35748 markWhenOptional, 35749 customValidity: getCustomValidity(isValid2, validity), 35750 label, 35751 value, 35752 help: description, 35753 options: elements, 35754 onChange: onChangeControl, 35755 __next40pxDefaultSize: true, 35756 hideLabelFromVision, 35757 multiple: isMultiple, 35758 disabled: disabled2 35759 } 35760 ); 35761 } 35762 35763 // packages/dataviews/build-module/components/dataform-controls/adaptive-select.mjs 35764 var import_jsx_runtime167 = __toESM(require_jsx_runtime(), 1); 35765 var ELEMENTS_THRESHOLD = 10; 35766 function AdaptiveSelect(props) { 35767 const { field } = props; 35768 const { elements } = useElements({ 35769 elements: field.elements, 35770 getElements: field.getElements 35771 }); 35772 if (elements.length >= ELEMENTS_THRESHOLD) { 35773 return /* @__PURE__ */ (0, import_jsx_runtime167.jsx)(Combobox3, { ...props }); 35774 } 35775 return /* @__PURE__ */ (0, import_jsx_runtime167.jsx)(Select, { ...props }); 35776 } 35777 35778 // packages/dataviews/build-module/components/dataform-controls/email.mjs 35779 var import_components35 = __toESM(require_components(), 1); 35780 35781 // packages/dataviews/build-module/components/dataform-controls/utils/validated-input.mjs 35782 var import_components34 = __toESM(require_components(), 1); 35783 var import_element131 = __toESM(require_element(), 1); 35784 var import_jsx_runtime168 = __toESM(require_jsx_runtime(), 1); 35785 var { ValidatedInputControl: ValidatedInputControl2 } = unlock2(import_components34.privateApis); 35786 function ValidatedText({ 35787 data, 35788 field, 35789 onChange, 35790 hideLabelFromVision, 35791 markWhenOptional, 35792 type, 35793 prefix, 35794 suffix, 35795 validity 35796 }) { 35797 const { label, placeholder, description, getValue, setValue, isValid: isValid2 } = field; 35798 const value = getValue({ item: data }); 35799 const disabled2 = field.isDisabled({ item: data, field }); 35800 const onChangeControl = (0, import_element131.useCallback)( 35801 (newValue) => onChange( 35802 setValue({ 35803 item: data, 35804 value: newValue 35805 }) 35806 ), 35807 [data, setValue, onChange] 35808 ); 35809 return /* @__PURE__ */ (0, import_jsx_runtime168.jsx)( 35810 ValidatedInputControl2, 35811 { 35812 required: !!isValid2.required, 35813 markWhenOptional, 35814 customValidity: getCustomValidity(isValid2, validity), 35815 label, 35816 placeholder, 35817 value: value ?? "", 35818 help: description, 35819 onChange: onChangeControl, 35820 hideLabelFromVision, 35821 type, 35822 prefix, 35823 suffix, 35824 disabled: disabled2, 35825 pattern: isValid2.pattern ? isValid2.pattern.constraint : void 0, 35826 minLength: isValid2.minLength ? isValid2.minLength.constraint : void 0, 35827 maxLength: isValid2.maxLength ? isValid2.maxLength.constraint : void 0, 35828 __next40pxDefaultSize: true 35829 } 35830 ); 35831 } 35832 35833 // packages/dataviews/build-module/components/dataform-controls/email.mjs 35834 var import_jsx_runtime169 = __toESM(require_jsx_runtime(), 1); 35835 function Email({ 35836 data, 35837 field, 35838 onChange, 35839 hideLabelFromVision, 35840 markWhenOptional, 35841 validity 35842 }) { 35843 return /* @__PURE__ */ (0, import_jsx_runtime169.jsx)( 35844 ValidatedText, 35845 { 35846 ...{ 35847 data, 35848 field, 35849 onChange, 35850 hideLabelFromVision, 35851 markWhenOptional, 35852 validity, 35853 type: "email", 35854 prefix: /* @__PURE__ */ (0, import_jsx_runtime169.jsx)(import_components35.__experimentalInputControlPrefixWrapper, { variant: "icon", children: /* @__PURE__ */ (0, import_jsx_runtime169.jsx)(import_components35.Icon, { icon: envelope_default }) }) 35855 } 35856 } 35857 ); 35858 } 35859 35860 // packages/dataviews/build-module/components/dataform-controls/telephone.mjs 35861 var import_components36 = __toESM(require_components(), 1); 35862 var import_jsx_runtime170 = __toESM(require_jsx_runtime(), 1); 35863 function Telephone({ 35864 data, 35865 field, 35866 onChange, 35867 hideLabelFromVision, 35868 markWhenOptional, 35869 validity 35870 }) { 35871 return /* @__PURE__ */ (0, import_jsx_runtime170.jsx)( 35872 ValidatedText, 35873 { 35874 ...{ 35875 data, 35876 field, 35877 onChange, 35878 hideLabelFromVision, 35879 markWhenOptional, 35880 validity, 35881 type: "tel", 35882 prefix: /* @__PURE__ */ (0, import_jsx_runtime170.jsx)(import_components36.__experimentalInputControlPrefixWrapper, { variant: "icon", children: /* @__PURE__ */ (0, import_jsx_runtime170.jsx)(import_components36.Icon, { icon: mobile_default }) }) 35883 } 35884 } 35885 ); 35886 } 35887 35888 // packages/dataviews/build-module/components/dataform-controls/url.mjs 35889 var import_components37 = __toESM(require_components(), 1); 35890 var import_jsx_runtime171 = __toESM(require_jsx_runtime(), 1); 35891 function Url({ 35892 data, 35893 field, 35894 onChange, 35895 hideLabelFromVision, 35896 markWhenOptional, 35897 validity 35898 }) { 35899 return /* @__PURE__ */ (0, import_jsx_runtime171.jsx)( 35900 ValidatedText, 35901 { 35902 ...{ 35903 data, 35904 field, 35905 onChange, 35906 hideLabelFromVision, 35907 markWhenOptional, 35908 validity, 35909 type: "url", 35910 prefix: /* @__PURE__ */ (0, import_jsx_runtime171.jsx)(import_components37.__experimentalInputControlPrefixWrapper, { variant: "icon", children: /* @__PURE__ */ (0, import_jsx_runtime171.jsx)(import_components37.Icon, { icon: link_default }) }) 35911 } 35912 } 35913 ); 35914 } 35915 35916 // packages/dataviews/build-module/components/dataform-controls/utils/validated-number.mjs 35917 var import_components38 = __toESM(require_components(), 1); 35918 var import_element132 = __toESM(require_element(), 1); 35919 var import_i18n41 = __toESM(require_i18n(), 1); 35920 var import_jsx_runtime172 = __toESM(require_jsx_runtime(), 1); 35921 var { ValidatedNumberControl } = unlock2(import_components38.privateApis); 35922 function toNumberOrEmpty(value) { 35923 if (value === "" || value === void 0) { 35924 return ""; 35925 } 35926 const number = Number(value); 35927 return Number.isFinite(number) ? number : ""; 35928 } 35929 function BetweenControls({ 35930 value, 35931 onChange, 35932 hideLabelFromVision, 35933 step 35934 }) { 35935 const [min2 = "", max2 = ""] = value; 35936 const onChangeMin = (0, import_element132.useCallback)( 35937 (newValue) => onChange([toNumberOrEmpty(newValue), max2]), 35938 [onChange, max2] 35939 ); 35940 const onChangeMax = (0, import_element132.useCallback)( 35941 (newValue) => onChange([min2, toNumberOrEmpty(newValue)]), 35942 [onChange, min2] 35943 ); 35944 return /* @__PURE__ */ (0, import_jsx_runtime172.jsx)( 35945 import_components38.BaseControl, 35946 { 35947 help: (0, import_i18n41.__)("The max. value must be greater than the min. value."), 35948 children: /* @__PURE__ */ (0, import_jsx_runtime172.jsxs)(import_components38.Flex, { direction: "row", gap: 4, children: [ 35949 /* @__PURE__ */ (0, import_jsx_runtime172.jsx)( 35950 import_components38.__experimentalNumberControl, 35951 { 35952 label: (0, import_i18n41.__)("Min."), 35953 value: min2, 35954 max: max2 ? Number(max2) - step : void 0, 35955 onChange: onChangeMin, 35956 __next40pxDefaultSize: true, 35957 hideLabelFromVision, 35958 step 35959 } 35960 ), 35961 /* @__PURE__ */ (0, import_jsx_runtime172.jsx)( 35962 import_components38.__experimentalNumberControl, 35963 { 35964 label: (0, import_i18n41.__)("Max."), 35965 value: max2, 35966 min: min2 ? Number(min2) + step : void 0, 35967 onChange: onChangeMax, 35968 __next40pxDefaultSize: true, 35969 hideLabelFromVision, 35970 step 35971 } 35972 ) 35973 ] }) 35974 } 35975 ); 35976 } 35977 function ValidatedNumber({ 35978 data, 35979 field, 35980 onChange, 35981 hideLabelFromVision, 35982 markWhenOptional, 35983 operator, 35984 validity 35985 }) { 35986 const decimals = field.format?.decimals ?? 0; 35987 const step = Math.pow(10, Math.abs(decimals) * -1); 35988 const { label, description, getValue, setValue, isValid: isValid2 } = field; 35989 const value = getValue({ item: data }) ?? ""; 35990 const disabled2 = field.isDisabled({ item: data, field }); 35991 const onChangeControl = (0, import_element132.useCallback)( 35992 (newValue) => { 35993 onChange( 35994 setValue({ 35995 item: data, 35996 // Do not convert an empty string or undefined to a number, 35997 // otherwise there's a mismatch between the UI control (empty) 35998 // and the data relied by onChange (0). 35999 value: ["", void 0].includes(newValue) ? void 0 : Number(newValue) 36000 }) 36001 ); 36002 }, 36003 [data, onChange, setValue] 36004 ); 36005 const onChangeBetweenControls = (0, import_element132.useCallback)( 36006 (newValue) => { 36007 onChange( 36008 setValue({ 36009 item: data, 36010 value: newValue 36011 }) 36012 ); 36013 }, 36014 [data, onChange, setValue] 36015 ); 36016 if (operator === OPERATOR_BETWEEN) { 36017 let valueBetween = ["", ""]; 36018 if (Array.isArray(value) && value.length === 2 && value.every( 36019 (element) => typeof element === "number" || element === "" 36020 )) { 36021 valueBetween = value; 36022 } 36023 return /* @__PURE__ */ (0, import_jsx_runtime172.jsx)( 36024 BetweenControls, 36025 { 36026 value: valueBetween, 36027 onChange: onChangeBetweenControls, 36028 hideLabelFromVision, 36029 step 36030 } 36031 ); 36032 } 36033 return /* @__PURE__ */ (0, import_jsx_runtime172.jsx)( 36034 ValidatedNumberControl, 36035 { 36036 required: !!isValid2.required, 36037 markWhenOptional, 36038 customValidity: getCustomValidity(isValid2, validity), 36039 label, 36040 help: description, 36041 value, 36042 onChange: onChangeControl, 36043 __next40pxDefaultSize: true, 36044 hideLabelFromVision, 36045 step, 36046 min: isValid2.min ? isValid2.min.constraint : void 0, 36047 max: isValid2.max ? isValid2.max.constraint : void 0, 36048 disabled: disabled2 36049 } 36050 ); 36051 } 36052 36053 // packages/dataviews/build-module/components/dataform-controls/integer.mjs 36054 var import_jsx_runtime173 = __toESM(require_jsx_runtime(), 1); 36055 function Integer(props) { 36056 return /* @__PURE__ */ (0, import_jsx_runtime173.jsx)(ValidatedNumber, { ...props }); 36057 } 36058 36059 // packages/dataviews/build-module/components/dataform-controls/number.mjs 36060 var import_jsx_runtime174 = __toESM(require_jsx_runtime(), 1); 36061 function Number2(props) { 36062 return /* @__PURE__ */ (0, import_jsx_runtime174.jsx)(ValidatedNumber, { ...props }); 36063 } 36064 36065 // packages/dataviews/build-module/components/dataform-controls/radio.mjs 36066 var import_components39 = __toESM(require_components(), 1); 36067 var import_element133 = __toESM(require_element(), 1); 36068 var import_jsx_runtime175 = __toESM(require_jsx_runtime(), 1); 36069 var { ValidatedRadioControl } = unlock2(import_components39.privateApis); 36070 function Radio({ 36071 data, 36072 field, 36073 onChange, 36074 hideLabelFromVision, 36075 markWhenOptional, 36076 validity 36077 }) { 36078 const { label, description, getValue, setValue, isValid: isValid2 } = field; 36079 const disabled2 = field.isDisabled({ item: data, field }); 36080 const { elements, isLoading } = useElements({ 36081 elements: field.elements, 36082 getElements: field.getElements 36083 }); 36084 const value = getValue({ item: data }); 36085 const onChangeControl = (0, import_element133.useCallback)( 36086 (newValue) => onChange(setValue({ item: data, value: newValue })), 36087 [data, onChange, setValue] 36088 ); 36089 if (isLoading) { 36090 return /* @__PURE__ */ (0, import_jsx_runtime175.jsx)(import_components39.Spinner, {}); 36091 } 36092 return /* @__PURE__ */ (0, import_jsx_runtime175.jsx)( 36093 ValidatedRadioControl, 36094 { 36095 required: !!field.isValid?.required, 36096 markWhenOptional, 36097 customValidity: getCustomValidity(isValid2, validity), 36098 label, 36099 help: description, 36100 onChange: onChangeControl, 36101 options: elements, 36102 selected: value, 36103 hideLabelFromVision, 36104 disabled: disabled2 36105 } 36106 ); 36107 } 36108 36109 // packages/dataviews/build-module/components/dataform-controls/text.mjs 36110 var import_element134 = __toESM(require_element(), 1); 36111 var import_jsx_runtime176 = __toESM(require_jsx_runtime(), 1); 36112 function Text3({ 36113 data, 36114 field, 36115 onChange, 36116 hideLabelFromVision, 36117 markWhenOptional, 36118 config, 36119 validity 36120 }) { 36121 const { prefix, suffix } = config || {}; 36122 return /* @__PURE__ */ (0, import_jsx_runtime176.jsx)( 36123 ValidatedText, 36124 { 36125 ...{ 36126 data, 36127 field, 36128 onChange, 36129 hideLabelFromVision, 36130 markWhenOptional, 36131 validity, 36132 prefix: prefix ? (0, import_element134.createElement)(prefix) : void 0, 36133 suffix: suffix ? (0, import_element134.createElement)(suffix) : void 0 36134 } 36135 } 36136 ); 36137 } 36138 36139 // packages/dataviews/build-module/components/dataform-controls/toggle.mjs 36140 var import_components40 = __toESM(require_components(), 1); 36141 var import_element135 = __toESM(require_element(), 1); 36142 var import_jsx_runtime177 = __toESM(require_jsx_runtime(), 1); 36143 var { ValidatedToggleControl } = unlock2(import_components40.privateApis); 36144 function Toggle({ 36145 field, 36146 onChange, 36147 data, 36148 hideLabelFromVision, 36149 markWhenOptional, 36150 validity 36151 }) { 36152 const { label, description, getValue, setValue, isValid: isValid2 } = field; 36153 const disabled2 = field.isDisabled({ item: data, field }); 36154 const onChangeControl = (0, import_element135.useCallback)(() => { 36155 onChange( 36156 setValue({ item: data, value: !getValue({ item: data }) }) 36157 ); 36158 }, [onChange, setValue, data, getValue]); 36159 return /* @__PURE__ */ (0, import_jsx_runtime177.jsx)( 36160 ValidatedToggleControl, 36161 { 36162 required: !!isValid2.required, 36163 markWhenOptional, 36164 customValidity: getCustomValidity(isValid2, validity), 36165 hidden: hideLabelFromVision, 36166 label, 36167 help: description, 36168 checked: getValue({ item: data }), 36169 onChange: onChangeControl, 36170 disabled: disabled2 36171 } 36172 ); 36173 } 36174 36175 // packages/dataviews/build-module/components/dataform-controls/textarea.mjs 36176 var import_components41 = __toESM(require_components(), 1); 36177 var import_element136 = __toESM(require_element(), 1); 36178 var import_jsx_runtime178 = __toESM(require_jsx_runtime(), 1); 36179 var { ValidatedTextareaControl } = unlock2(import_components41.privateApis); 36180 function Textarea({ 36181 data, 36182 field, 36183 onChange, 36184 hideLabelFromVision, 36185 markWhenOptional, 36186 config, 36187 validity 36188 }) { 36189 const { rows = 4 } = config || {}; 36190 const disabled2 = field.isDisabled({ item: data, field }); 36191 const { label, placeholder, description, setValue, isValid: isValid2 } = field; 36192 const value = field.getValue({ item: data }); 36193 const onChangeControl = (0, import_element136.useCallback)( 36194 (newValue) => onChange(setValue({ item: data, value: newValue })), 36195 [data, onChange, setValue] 36196 ); 36197 return /* @__PURE__ */ (0, import_jsx_runtime178.jsx)( 36198 ValidatedTextareaControl, 36199 { 36200 required: !!isValid2.required, 36201 markWhenOptional, 36202 customValidity: getCustomValidity(isValid2, validity), 36203 label, 36204 placeholder, 36205 value: value ?? "", 36206 help: description, 36207 onChange: onChangeControl, 36208 rows, 36209 disabled: disabled2, 36210 minLength: isValid2.minLength ? isValid2.minLength.constraint : void 0, 36211 maxLength: isValid2.maxLength ? isValid2.maxLength.constraint : void 0, 36212 __next40pxDefaultSize: true, 36213 hideLabelFromVision 36214 } 36215 ); 36216 } 36217 36218 // packages/dataviews/build-module/components/dataform-controls/toggle-group.mjs 36219 var import_components42 = __toESM(require_components(), 1); 36220 var import_element137 = __toESM(require_element(), 1); 36221 var import_jsx_runtime179 = __toESM(require_jsx_runtime(), 1); 36222 var { ValidatedToggleGroupControl } = unlock2(import_components42.privateApis); 36223 function ToggleGroup({ 36224 data, 36225 field, 36226 onChange, 36227 hideLabelFromVision, 36228 markWhenOptional, 36229 validity 36230 }) { 36231 const { getValue, setValue, isValid: isValid2 } = field; 36232 const disabled2 = field.isDisabled({ item: data, field }); 36233 const value = getValue({ item: data }); 36234 const onChangeControl = (0, import_element137.useCallback)( 36235 (newValue) => onChange(setValue({ item: data, value: newValue })), 36236 [data, onChange, setValue] 36237 ); 36238 const { elements, isLoading } = useElements({ 36239 elements: field.elements, 36240 getElements: field.getElements 36241 }); 36242 if (isLoading) { 36243 return /* @__PURE__ */ (0, import_jsx_runtime179.jsx)(import_components42.Spinner, {}); 36244 } 36245 if (elements.length === 0) { 36246 return null; 36247 } 36248 const selectedOption = elements.find((el) => el.value === value); 36249 return /* @__PURE__ */ (0, import_jsx_runtime179.jsx)( 36250 ValidatedToggleGroupControl, 36251 { 36252 required: !!field.isValid?.required, 36253 markWhenOptional, 36254 customValidity: getCustomValidity(isValid2, validity), 36255 __next40pxDefaultSize: true, 36256 isBlock: true, 36257 label: field.label, 36258 help: selectedOption?.description || field.description, 36259 onChange: onChangeControl, 36260 value, 36261 hideLabelFromVision, 36262 children: elements.map((el) => /* @__PURE__ */ (0, import_jsx_runtime179.jsx)( 36263 import_components42.__experimentalToggleGroupControlOption, 36264 { 36265 label: el.label, 36266 value: el.value, 36267 disabled: disabled2 36268 }, 36269 el.value 36270 )) 36271 } 36272 ); 36273 } 36274 36275 // packages/dataviews/build-module/components/dataform-controls/array.mjs 36276 var import_components43 = __toESM(require_components(), 1); 36277 var import_element138 = __toESM(require_element(), 1); 36278 var import_jsx_runtime180 = __toESM(require_jsx_runtime(), 1); 36279 var { ValidatedFormTokenField } = unlock2(import_components43.privateApis); 36280 function ArrayControl({ 36281 data, 36282 field, 36283 onChange, 36284 hideLabelFromVision, 36285 markWhenOptional, 36286 validity 36287 }) { 36288 const { label, placeholder, description, getValue, setValue, isValid: isValid2 } = field; 36289 const value = getValue({ item: data }); 36290 const disabled2 = field.isDisabled({ item: data, field }); 36291 const { elements, isLoading } = useElements({ 36292 elements: field.elements, 36293 getElements: field.getElements 36294 }); 36295 const arrayValueAsElements = (0, import_element138.useMemo)( 36296 () => Array.isArray(value) ? value.map((token) => { 36297 const element = elements?.find( 36298 (suggestion) => suggestion.value === token 36299 ); 36300 return element || { value: token, label: token }; 36301 }) : [], 36302 [value, elements] 36303 ); 36304 const onChangeControl = (0, import_element138.useCallback)( 36305 (tokens) => { 36306 const valueTokens = tokens.map((token) => { 36307 if (typeof token === "object" && "value" in token) { 36308 return token.value; 36309 } 36310 return token; 36311 }); 36312 onChange(setValue({ item: data, value: valueTokens })); 36313 }, 36314 [onChange, setValue, data] 36315 ); 36316 if (isLoading) { 36317 return /* @__PURE__ */ (0, import_jsx_runtime180.jsx)(import_components43.Spinner, {}); 36318 } 36319 return /* @__PURE__ */ (0, import_jsx_runtime180.jsx)( 36320 ValidatedFormTokenField, 36321 { 36322 required: !!isValid2?.required, 36323 markWhenOptional, 36324 customValidity: getCustomValidity(isValid2, validity), 36325 label: hideLabelFromVision ? void 0 : label, 36326 value: arrayValueAsElements, 36327 onChange: onChangeControl, 36328 placeholder, 36329 suggestions: elements?.map((element) => element.value), 36330 disabled: disabled2, 36331 __experimentalValidateInput: (token) => { 36332 if (field.isValid?.elements && elements) { 36333 return elements.some( 36334 (element) => element.value === token || element.label === token 36335 ); 36336 } 36337 return true; 36338 }, 36339 __experimentalExpandOnFocus: elements && elements.length > 0, 36340 help: description ?? (field.isValid?.elements ? "" : void 0), 36341 displayTransform: (token) => { 36342 if (typeof token === "object" && "label" in token) { 36343 return token.label; 36344 } 36345 if (typeof token === "string" && elements) { 36346 const element = elements.find( 36347 (el) => el.value === token 36348 ); 36349 return element?.label || token; 36350 } 36351 return token; 36352 }, 36353 __experimentalRenderItem: ({ item }) => { 36354 if (typeof item === "string" && elements) { 36355 const element = elements.find( 36356 (el) => el.value === item 36357 ); 36358 return /* @__PURE__ */ (0, import_jsx_runtime180.jsx)("span", { children: element?.label || item }); 36359 } 36360 return /* @__PURE__ */ (0, import_jsx_runtime180.jsx)("span", { children: item }); 36361 } 36362 } 36363 ); 36364 } 36365 36366 // node_modules/colord/index.mjs 36367 var r2 = { grad: 0.9, turn: 360, rad: 360 / (2 * Math.PI) }; 36368 var t = function(r3) { 36369 return "string" == typeof r3 ? r3.length > 0 : "number" == typeof r3; 36370 }; 36371 var n = function(r3, t2, n2) { 36372 return void 0 === t2 && (t2 = 0), void 0 === n2 && (n2 = Math.pow(10, t2)), Math.round(n2 * r3) / n2 + 0; 36373 }; 36374 var e = function(r3, t2, n2) { 36375 return void 0 === t2 && (t2 = 0), void 0 === n2 && (n2 = 1), r3 > n2 ? n2 : r3 > t2 ? r3 : t2; 36376 }; 36377 var u = function(r3) { 36378 return (r3 = isFinite(r3) ? r3 % 360 : 0) > 0 ? r3 : r3 + 360; 36379 }; 36380 var a = function(r3) { 36381 return { r: e(r3.r, 0, 255), g: e(r3.g, 0, 255), b: e(r3.b, 0, 255), a: e(r3.a) }; 36382 }; 36383 var o = function(r3) { 36384 return { r: n(r3.r), g: n(r3.g), b: n(r3.b), a: n(r3.a, 3) }; 36385 }; 36386 var i = /^#([0-9a-f]{3,8})$/i; 36387 var s = function(r3) { 36388 var t2 = r3.toString(16); 36389 return t2.length < 2 ? "0" + t2 : t2; 36390 }; 36391 var h = function(r3) { 36392 var t2 = r3.r, n2 = r3.g, e2 = r3.b, u2 = r3.a, a2 = Math.max(t2, n2, e2), o2 = a2 - Math.min(t2, n2, e2), i2 = o2 ? a2 === t2 ? (n2 - e2) / o2 : a2 === n2 ? 2 + (e2 - t2) / o2 : 4 + (t2 - n2) / o2 : 0; 36393 return { h: 60 * (i2 < 0 ? i2 + 6 : i2), s: a2 ? o2 / a2 * 100 : 0, v: a2 / 255 * 100, a: u2 }; 36394 }; 36395 var b = function(r3) { 36396 var t2 = r3.h, n2 = r3.s, e2 = r3.v, u2 = r3.a; 36397 t2 = t2 / 360 * 6, n2 /= 100, e2 /= 100; 36398 var a2 = Math.floor(t2), o2 = e2 * (1 - n2), i2 = e2 * (1 - (t2 - a2) * n2), s2 = e2 * (1 - (1 - t2 + a2) * n2), h2 = a2 % 6; 36399 return { r: 255 * [e2, i2, o2, o2, s2, e2][h2], g: 255 * [s2, e2, e2, i2, o2, o2][h2], b: 255 * [o2, o2, s2, e2, e2, i2][h2], a: u2 }; 36400 }; 36401 var g = function(r3) { 36402 return { h: u(r3.h), s: e(r3.s, 0, 100), l: e(r3.l, 0, 100), a: e(r3.a) }; 36403 }; 36404 var d = function(r3) { 36405 return { h: n(r3.h), s: n(r3.s), l: n(r3.l), a: n(r3.a, 3) }; 36406 }; 36407 var f = function(r3) { 36408 return b((n2 = (t2 = r3).s, { h: t2.h, s: (n2 *= ((e2 = t2.l) < 50 ? e2 : 100 - e2) / 100) > 0 ? 2 * n2 / (e2 + n2) * 100 : 0, v: e2 + n2, a: t2.a })); 36409 var t2, n2, e2; 36410 }; 36411 var c = function(r3) { 36412 return { h: (t2 = h(r3)).h, s: (u2 = (200 - (n2 = t2.s)) * (e2 = t2.v) / 100) > 0 && u2 < 200 ? n2 * e2 / 100 / (u2 <= 100 ? u2 : 200 - u2) * 100 : 0, l: u2 / 2, a: t2.a }; 36413 var t2, n2, e2, u2; 36414 }; 36415 var l = /^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i; 36416 var p = /^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i; 36417 var v = /^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i; 36418 var m = /^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i; 36419 var y = { string: [[function(r3) { 36420 var t2 = i.exec(r3); 36421 return t2 ? (r3 = t2[1]).length <= 4 ? { r: parseInt(r3[0] + r3[0], 16), g: parseInt(r3[1] + r3[1], 16), b: parseInt(r3[2] + r3[2], 16), a: 4 === r3.length ? n(parseInt(r3[3] + r3[3], 16) / 255, 2) : 1 } : 6 === r3.length || 8 === r3.length ? { r: parseInt(r3.substr(0, 2), 16), g: parseInt(r3.substr(2, 2), 16), b: parseInt(r3.substr(4, 2), 16), a: 8 === r3.length ? n(parseInt(r3.substr(6, 2), 16) / 255, 2) : 1 } : null : null; 36422 }, "hex"], [function(r3) { 36423 var t2 = v.exec(r3) || m.exec(r3); 36424 return t2 ? t2[2] !== t2[4] || t2[4] !== t2[6] ? null : a({ r: Number(t2[1]) / (t2[2] ? 100 / 255 : 1), g: Number(t2[3]) / (t2[4] ? 100 / 255 : 1), b: Number(t2[5]) / (t2[6] ? 100 / 255 : 1), a: void 0 === t2[7] ? 1 : Number(t2[7]) / (t2[8] ? 100 : 1) }) : null; 36425 }, "rgb"], [function(t2) { 36426 var n2 = l.exec(t2) || p.exec(t2); 36427 if (!n2) return null; 36428 var e2, u2, a2 = g({ h: (e2 = n2[1], u2 = n2[2], void 0 === u2 && (u2 = "deg"), Number(e2) * (r2[u2] || 1)), s: Number(n2[3]), l: Number(n2[4]), a: void 0 === n2[5] ? 1 : Number(n2[5]) / (n2[6] ? 100 : 1) }); 36429 return f(a2); 36430 }, "hsl"]], object: [[function(r3) { 36431 var n2 = r3.r, e2 = r3.g, u2 = r3.b, o2 = r3.a, i2 = void 0 === o2 ? 1 : o2; 36432 return t(n2) && t(e2) && t(u2) ? a({ r: Number(n2), g: Number(e2), b: Number(u2), a: Number(i2) }) : null; 36433 }, "rgb"], [function(r3) { 36434 var n2 = r3.h, e2 = r3.s, u2 = r3.l, a2 = r3.a, o2 = void 0 === a2 ? 1 : a2; 36435 if (!t(n2) || !t(e2) || !t(u2)) return null; 36436 var i2 = g({ h: Number(n2), s: Number(e2), l: Number(u2), a: Number(o2) }); 36437 return f(i2); 36438 }, "hsl"], [function(r3) { 36439 var n2 = r3.h, a2 = r3.s, o2 = r3.v, i2 = r3.a, s2 = void 0 === i2 ? 1 : i2; 36440 if (!t(n2) || !t(a2) || !t(o2)) return null; 36441 var h2 = (function(r4) { 36442 return { h: u(r4.h), s: e(r4.s, 0, 100), v: e(r4.v, 0, 100), a: e(r4.a) }; 36443 })({ h: Number(n2), s: Number(a2), v: Number(o2), a: Number(s2) }); 36444 return b(h2); 36445 }, "hsv"]] }; 36446 var N = function(r3, t2) { 36447 for (var n2 = 0; n2 < t2.length; n2++) { 36448 var e2 = t2[n2][0](r3); 36449 if (e2) return [e2, t2[n2][1]]; 36450 } 36451 return [null, void 0]; 36452 }; 36453 var x = function(r3) { 36454 return "string" == typeof r3 ? N(r3.trim(), y.string) : "object" == typeof r3 && null !== r3 ? N(r3, y.object) : [null, void 0]; 36455 }; 36456 var M = function(r3, t2) { 36457 var n2 = c(r3); 36458 return { h: n2.h, s: e(n2.s + 100 * t2, 0, 100), l: n2.l, a: n2.a }; 36459 }; 36460 var H = function(r3) { 36461 return (299 * r3.r + 587 * r3.g + 114 * r3.b) / 1e3 / 255; 36462 }; 36463 var $ = function(r3, t2) { 36464 var n2 = c(r3); 36465 return { h: n2.h, s: n2.s, l: e(n2.l + 100 * t2, 0, 100), a: n2.a }; 36466 }; 36467 var j = (function() { 36468 function r3(r4) { 36469 this.parsed = x(r4)[0], this.rgba = this.parsed || { r: 0, g: 0, b: 0, a: 1 }; 36470 } 36471 return r3.prototype.isValid = function() { 36472 return null !== this.parsed; 36473 }, r3.prototype.brightness = function() { 36474 return n(H(this.rgba), 2); 36475 }, r3.prototype.isDark = function() { 36476 return H(this.rgba) < 0.5; 36477 }, r3.prototype.isLight = function() { 36478 return H(this.rgba) >= 0.5; 36479 }, r3.prototype.toHex = function() { 36480 return r4 = o(this.rgba), t2 = r4.r, e2 = r4.g, u2 = r4.b, i2 = (a2 = r4.a) < 1 ? s(n(255 * a2)) : "", "#" + s(t2) + s(e2) + s(u2) + i2; 36481 var r4, t2, e2, u2, a2, i2; 36482 }, r3.prototype.toRgb = function() { 36483 return o(this.rgba); 36484 }, r3.prototype.toRgbString = function() { 36485 return r4 = o(this.rgba), t2 = r4.r, n2 = r4.g, e2 = r4.b, (u2 = r4.a) < 1 ? "rgba(" + t2 + ", " + n2 + ", " + e2 + ", " + u2 + ")" : "rgb(" + t2 + ", " + n2 + ", " + e2 + ")"; 36486 var r4, t2, n2, e2, u2; 36487 }, r3.prototype.toHsl = function() { 36488 return d(c(this.rgba)); 36489 }, r3.prototype.toHslString = function() { 36490 return r4 = d(c(this.rgba)), t2 = r4.h, n2 = r4.s, e2 = r4.l, (u2 = r4.a) < 1 ? "hsla(" + t2 + ", " + n2 + "%, " + e2 + "%, " + u2 + ")" : "hsl(" + t2 + ", " + n2 + "%, " + e2 + "%)"; 36491 var r4, t2, n2, e2, u2; 36492 }, r3.prototype.toHsv = function() { 36493 return r4 = h(this.rgba), { h: n(r4.h), s: n(r4.s), v: n(r4.v), a: n(r4.a, 3) }; 36494 var r4; 36495 }, r3.prototype.invert = function() { 36496 return w({ r: 255 - (r4 = this.rgba).r, g: 255 - r4.g, b: 255 - r4.b, a: r4.a }); 36497 var r4; 36498 }, r3.prototype.saturate = function(r4) { 36499 return void 0 === r4 && (r4 = 0.1), w(M(this.rgba, r4)); 36500 }, r3.prototype.desaturate = function(r4) { 36501 return void 0 === r4 && (r4 = 0.1), w(M(this.rgba, -r4)); 36502 }, r3.prototype.grayscale = function() { 36503 return w(M(this.rgba, -1)); 36504 }, r3.prototype.lighten = function(r4) { 36505 return void 0 === r4 && (r4 = 0.1), w($(this.rgba, r4)); 36506 }, r3.prototype.darken = function(r4) { 36507 return void 0 === r4 && (r4 = 0.1), w($(this.rgba, -r4)); 36508 }, r3.prototype.rotate = function(r4) { 36509 return void 0 === r4 && (r4 = 15), this.hue(this.hue() + r4); 36510 }, r3.prototype.alpha = function(r4) { 36511 return "number" == typeof r4 ? w({ r: (t2 = this.rgba).r, g: t2.g, b: t2.b, a: r4 }) : n(this.rgba.a, 3); 36512 var t2; 36513 }, r3.prototype.hue = function(r4) { 36514 var t2 = c(this.rgba); 36515 return "number" == typeof r4 ? w({ h: r4, s: t2.s, l: t2.l, a: t2.a }) : n(t2.h); 36516 }, r3.prototype.isEqual = function(r4) { 36517 return this.toHex() === w(r4).toHex(); 36518 }, r3; 36519 })(); 36520 var w = function(r3) { 36521 return r3 instanceof j ? r3 : new j(r3); 36522 }; 36523 36524 // packages/dataviews/build-module/components/dataform-controls/color.mjs 36525 var import_components44 = __toESM(require_components(), 1); 36526 var import_element139 = __toESM(require_element(), 1); 36527 var import_i18n42 = __toESM(require_i18n(), 1); 36528 var import_jsx_runtime181 = __toESM(require_jsx_runtime(), 1); 36529 var { ValidatedInputControl: ValidatedInputControl3 } = unlock2(import_components44.privateApis); 36530 var ColorPickerDropdown = ({ 36531 color, 36532 onColorChange, 36533 disabled: disabled2 36534 }) => { 36535 const validColor = color && w(color).isValid() ? color : "#ffffff"; 36536 return /* @__PURE__ */ (0, import_jsx_runtime181.jsx)( 36537 import_components44.Dropdown, 36538 { 36539 className: "dataviews-controls__color-picker-dropdown", 36540 popoverProps: { resize: false }, 36541 renderToggle: ({ onToggle }) => /* @__PURE__ */ (0, import_jsx_runtime181.jsx)( 36542 import_components44.Button, 36543 { 36544 onClick: onToggle, 36545 "aria-label": (0, import_i18n42.__)("Open color picker"), 36546 size: "small", 36547 disabled: disabled2, 36548 accessibleWhenDisabled: true, 36549 icon: () => /* @__PURE__ */ (0, import_jsx_runtime181.jsx)(import_components44.ColorIndicator, { colorValue: validColor }) 36550 } 36551 ), 36552 renderContent: () => /* @__PURE__ */ (0, import_jsx_runtime181.jsx)(import_components44.__experimentalDropdownContentWrapper, { paddingSize: "none", children: /* @__PURE__ */ (0, import_jsx_runtime181.jsx)( 36553 import_components44.ColorPicker, 36554 { 36555 color: validColor, 36556 onChange: onColorChange, 36557 enableAlpha: true 36558 } 36559 ) }) 36560 } 36561 ); 36562 }; 36563 function Color({ 36564 data, 36565 field, 36566 onChange, 36567 hideLabelFromVision, 36568 markWhenOptional, 36569 validity 36570 }) { 36571 const { label, placeholder, description, setValue, isValid: isValid2 } = field; 36572 const disabled2 = field.isDisabled({ item: data, field }); 36573 const value = field.getValue({ item: data }) || ""; 36574 const handleColorChange = (0, import_element139.useCallback)( 36575 (newColor) => { 36576 onChange(setValue({ item: data, value: newColor })); 36577 }, 36578 [data, onChange, setValue] 36579 ); 36580 const handleInputChange = (0, import_element139.useCallback)( 36581 (newValue) => { 36582 onChange(setValue({ item: data, value: newValue || "" })); 36583 }, 36584 [data, onChange, setValue] 36585 ); 36586 return /* @__PURE__ */ (0, import_jsx_runtime181.jsx)( 36587 ValidatedInputControl3, 36588 { 36589 required: !!field.isValid?.required, 36590 markWhenOptional, 36591 customValidity: getCustomValidity(isValid2, validity), 36592 label, 36593 placeholder, 36594 value, 36595 help: description, 36596 onChange: handleInputChange, 36597 hideLabelFromVision, 36598 type: "text", 36599 disabled: disabled2, 36600 prefix: /* @__PURE__ */ (0, import_jsx_runtime181.jsx)(import_components44.__experimentalInputControlPrefixWrapper, { variant: "control", children: /* @__PURE__ */ (0, import_jsx_runtime181.jsx)( 36601 ColorPickerDropdown, 36602 { 36603 color: value, 36604 onColorChange: handleColorChange, 36605 disabled: disabled2 36606 } 36607 ) }) 36608 } 36609 ); 36610 } 36611 36612 // packages/dataviews/build-module/components/dataform-controls/password.mjs 36613 var import_components45 = __toESM(require_components(), 1); 36614 var import_element140 = __toESM(require_element(), 1); 36615 var import_i18n43 = __toESM(require_i18n(), 1); 36616 var import_jsx_runtime182 = __toESM(require_jsx_runtime(), 1); 36617 function Password({ 36618 data, 36619 field, 36620 onChange, 36621 hideLabelFromVision, 36622 markWhenOptional, 36623 validity 36624 }) { 36625 const [isVisible2, setIsVisible] = (0, import_element140.useState)(false); 36626 const disabled2 = field.isDisabled({ item: data, field }); 36627 const toggleVisibility = (0, import_element140.useCallback)(() => { 36628 setIsVisible((prev) => !prev); 36629 }, []); 36630 return /* @__PURE__ */ (0, import_jsx_runtime182.jsx)( 36631 ValidatedText, 36632 { 36633 ...{ 36634 data, 36635 field, 36636 onChange, 36637 hideLabelFromVision, 36638 markWhenOptional, 36639 validity, 36640 type: isVisible2 ? "text" : "password", 36641 suffix: /* @__PURE__ */ (0, import_jsx_runtime182.jsx)(import_components45.__experimentalInputControlSuffixWrapper, { variant: "control", children: /* @__PURE__ */ (0, import_jsx_runtime182.jsx)( 36642 import_components45.Button, 36643 { 36644 icon: isVisible2 ? unseen_default : seen_default, 36645 onClick: toggleVisibility, 36646 size: "small", 36647 label: isVisible2 ? (0, import_i18n43.__)("Hide password") : (0, import_i18n43.__)("Show password"), 36648 disabled: disabled2, 36649 accessibleWhenDisabled: true 36650 } 36651 ) }) 36652 } 36653 } 36654 ); 36655 } 36656 36657 // packages/dataviews/build-module/field-types/utils/has-elements.mjs 36658 function hasElements(field) { 36659 return Array.isArray(field.elements) && field.elements.length > 0 || typeof field.getElements === "function"; 36660 } 36661 36662 // packages/dataviews/build-module/components/dataform-controls/index.mjs 36663 var import_jsx_runtime183 = __toESM(require_jsx_runtime(), 1); 36664 var FORM_CONTROLS = { 36665 adaptiveSelect: AdaptiveSelect, 36666 array: ArrayControl, 36667 checkbox: Checkbox, 36668 color: Color, 36669 combobox: Combobox3, 36670 datetime: DateTime, 36671 date: DateControl, 36672 email: Email, 36673 telephone: Telephone, 36674 url: Url, 36675 integer: Integer, 36676 number: Number2, 36677 password: Password, 36678 radio: Radio, 36679 select: Select, 36680 text: Text3, 36681 toggle: Toggle, 36682 textarea: Textarea, 36683 toggleGroup: ToggleGroup 36684 }; 36685 function isEditConfig(value) { 36686 return value && typeof value === "object" && typeof value.control === "string"; 36687 } 36688 function createConfiguredControl(config) { 36689 const { control, ...controlConfig } = config; 36690 const BaseControlType = getControlByType(control); 36691 if (BaseControlType === null) { 36692 return null; 36693 } 36694 return function ConfiguredControl(props) { 36695 return /* @__PURE__ */ (0, import_jsx_runtime183.jsx)(BaseControlType, { ...props, config: controlConfig }); 36696 }; 36697 } 36698 function getControl(field, fallback) { 36699 if (typeof field.Edit === "function") { 36700 return field.Edit; 36701 } 36702 if (typeof field.Edit === "string") { 36703 return getControlByType(field.Edit); 36704 } 36705 if (isEditConfig(field.Edit)) { 36706 return createConfiguredControl(field.Edit); 36707 } 36708 if (hasElements(field) && field.type !== "array") { 36709 return getControlByType("adaptiveSelect"); 36710 } 36711 if (fallback === null) { 36712 return null; 36713 } 36714 return getControlByType(fallback); 36715 } 36716 function getControlByType(type) { 36717 if (Object.keys(FORM_CONTROLS).includes(type)) { 36718 return FORM_CONTROLS[type]; 36719 } 36720 return null; 36721 } 36722 36723 // packages/dataviews/build-module/field-types/utils/get-filter-by.mjs 36724 function getFilterBy(field, defaultOperators, validOperators) { 36725 if (field.filterBy === false) { 36726 return false; 36727 } 36728 const operators = field.filterBy?.operators?.filter( 36729 (op) => validOperators.includes(op) 36730 ) ?? defaultOperators; 36731 if (operators.length === 0) { 36732 return false; 36733 } 36734 return { 36735 isPrimary: !!field.filterBy?.isPrimary, 36736 operators 36737 }; 36738 } 36739 var get_filter_by_default = getFilterBy; 36740 36741 // packages/dataviews/build-module/field-types/utils/get-value-from-id.mjs 36742 var getValueFromId = (id) => ({ item }) => { 36743 const path = id.split("."); 36744 let value = item; 36745 for (const segment of path) { 36746 if (value.hasOwnProperty(segment)) { 36747 value = value[segment]; 36748 } else { 36749 value = void 0; 36750 } 36751 } 36752 return value; 36753 }; 36754 var get_value_from_id_default = getValueFromId; 36755 36756 // packages/dataviews/build-module/field-types/utils/set-value-from-id.mjs 36757 var setValueFromId = (id) => ({ value }) => { 36758 const path = id.split("."); 36759 const result = {}; 36760 let current = result; 36761 for (const segment of path.slice(0, -1)) { 36762 current[segment] = {}; 36763 current = current[segment]; 36764 } 36765 current[path.at(-1)] = value; 36766 return result; 36767 }; 36768 var set_value_from_id_default = setValueFromId; 36769 36770 // packages/dataviews/build-module/field-types/email.mjs 36771 var import_i18n44 = __toESM(require_i18n(), 1); 36772 36773 // packages/dataviews/build-module/field-types/utils/render-from-elements.mjs 36774 function RenderFromElements({ 36775 item, 36776 field 36777 }) { 36778 const { elements, isLoading } = useElements({ 36779 elements: field.elements, 36780 getElements: field.getElements 36781 }); 36782 const value = field.getValue({ item }); 36783 if (isLoading) { 36784 return value; 36785 } 36786 if (elements.length === 0) { 36787 return value; 36788 } 36789 return elements?.find((element) => element.value === value)?.label || field.getValue({ item }); 36790 } 36791 36792 // packages/dataviews/build-module/field-types/utils/render-default.mjs 36793 var import_jsx_runtime184 = __toESM(require_jsx_runtime(), 1); 36794 function render({ 36795 item, 36796 field 36797 }) { 36798 if (field.hasElements) { 36799 return /* @__PURE__ */ (0, import_jsx_runtime184.jsx)(RenderFromElements, { item, field }); 36800 } 36801 return field.getValueFormatted({ item, field }); 36802 } 36803 36804 // packages/dataviews/build-module/field-types/utils/sort-text.mjs 36805 var sort_text_default = (a2, b2, direction) => { 36806 return direction === "asc" ? a2.localeCompare(b2) : b2.localeCompare(a2); 36807 }; 36808 36809 // packages/dataviews/build-module/field-types/utils/is-valid-required.mjs 36810 function isValidRequired(item, field) { 36811 const value = field.getValue({ item }); 36812 return ![void 0, "", null].includes(value); 36813 } 36814 36815 // packages/dataviews/build-module/field-types/utils/is-valid-min-length.mjs 36816 function isValidMinLength(item, field) { 36817 if (typeof field.isValid.minLength?.constraint !== "number") { 36818 return false; 36819 } 36820 const value = field.getValue({ item }); 36821 if ([void 0, "", null].includes(value)) { 36822 return true; 36823 } 36824 return String(value).length >= field.isValid.minLength.constraint; 36825 } 36826 36827 // packages/dataviews/build-module/field-types/utils/is-valid-max-length.mjs 36828 function isValidMaxLength(item, field) { 36829 if (typeof field.isValid.maxLength?.constraint !== "number") { 36830 return false; 36831 } 36832 const value = field.getValue({ item }); 36833 if ([void 0, "", null].includes(value)) { 36834 return true; 36835 } 36836 return String(value).length <= field.isValid.maxLength.constraint; 36837 } 36838 36839 // packages/dataviews/build-module/field-types/utils/is-valid-pattern.mjs 36840 function isValidPattern(item, field) { 36841 if (field.isValid.pattern?.constraint === void 0) { 36842 return true; 36843 } 36844 try { 36845 const regexp = new RegExp(field.isValid.pattern.constraint); 36846 const value = field.getValue({ item }); 36847 if ([void 0, "", null].includes(value)) { 36848 return true; 36849 } 36850 return regexp.test(String(value)); 36851 } catch { 36852 return false; 36853 } 36854 } 36855 36856 // packages/dataviews/build-module/field-types/utils/is-valid-elements.mjs 36857 function isValidElements(item, field) { 36858 const elements = field.elements ?? []; 36859 const validValues = elements.map((el) => el.value); 36860 if (validValues.length === 0) { 36861 return true; 36862 } 36863 const value = field.getValue({ item }); 36864 return [].concat(value).every((v2) => validValues.includes(v2)); 36865 } 36866 36867 // packages/dataviews/build-module/field-types/utils/get-value-formatted-default.mjs 36868 function getValueFormatted({ 36869 item, 36870 field 36871 }) { 36872 return field.getValue({ item }); 36873 } 36874 var get_value_formatted_default_default = getValueFormatted; 36875 36876 // packages/dataviews/build-module/field-types/email.mjs 36877 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])?)*$/; 36878 function isValidCustom(item, field) { 36879 const value = field.getValue({ item }); 36880 if (![void 0, "", null].includes(value) && !emailRegex.test(value)) { 36881 return (0, import_i18n44.__)("Value must be a valid email address."); 36882 } 36883 return null; 36884 } 36885 var email_default = { 36886 type: "email", 36887 render, 36888 Edit: "email", 36889 sort: sort_text_default, 36890 enableSorting: true, 36891 enableGlobalSearch: false, 36892 defaultOperators: [OPERATOR_IS_ANY, OPERATOR_IS_NONE], 36893 validOperators: [ 36894 OPERATOR_IS, 36895 OPERATOR_IS_NOT, 36896 OPERATOR_CONTAINS, 36897 OPERATOR_NOT_CONTAINS, 36898 OPERATOR_STARTS_WITH, 36899 // Multiple selection 36900 OPERATOR_IS_ANY, 36901 OPERATOR_IS_NONE, 36902 OPERATOR_IS_ALL, 36903 OPERATOR_IS_NOT_ALL 36904 ], 36905 format: {}, 36906 getValueFormatted: get_value_formatted_default_default, 36907 validate: { 36908 required: isValidRequired, 36909 pattern: isValidPattern, 36910 minLength: isValidMinLength, 36911 maxLength: isValidMaxLength, 36912 elements: isValidElements, 36913 custom: isValidCustom 36914 } 36915 }; 36916 36917 // packages/dataviews/build-module/field-types/integer.mjs 36918 var import_i18n45 = __toESM(require_i18n(), 1); 36919 36920 // packages/dataviews/build-module/field-types/utils/sort-number.mjs 36921 var sort_number_default = (a2, b2, direction) => { 36922 return direction === "asc" ? a2 - b2 : b2 - a2; 36923 }; 36924 36925 // packages/dataviews/build-module/field-types/utils/is-valid-min.mjs 36926 function isValidMin(item, field) { 36927 if (typeof field.isValid.min?.constraint !== "number") { 36928 return false; 36929 } 36930 const value = field.getValue({ item }); 36931 if ([void 0, "", null].includes(value)) { 36932 return true; 36933 } 36934 return Number(value) >= field.isValid.min.constraint; 36935 } 36936 36937 // packages/dataviews/build-module/field-types/utils/is-valid-max.mjs 36938 function isValidMax(item, field) { 36939 if (typeof field.isValid.max?.constraint !== "number") { 36940 return false; 36941 } 36942 const value = field.getValue({ item }); 36943 if ([void 0, "", null].includes(value)) { 36944 return true; 36945 } 36946 return Number(value) <= field.isValid.max.constraint; 36947 } 36948 36949 // packages/dataviews/build-module/field-types/integer.mjs 36950 var format2 = { 36951 separatorThousand: "," 36952 }; 36953 function getValueFormatted2({ 36954 item, 36955 field 36956 }) { 36957 let value = field.getValue({ item }); 36958 if (value === null || value === void 0) { 36959 return ""; 36960 } 36961 value = Number(value); 36962 if (!Number.isFinite(value)) { 36963 return String(value); 36964 } 36965 let formatInteger; 36966 if (field.type !== "integer") { 36967 formatInteger = format2; 36968 } else { 36969 formatInteger = field.format; 36970 } 36971 const { separatorThousand } = formatInteger; 36972 const integerValue = Math.trunc(value); 36973 if (!separatorThousand) { 36974 return String(integerValue); 36975 } 36976 return String(integerValue).replace( 36977 /\B(?=(\d{3})+(?!\d))/g, 36978 separatorThousand 36979 ); 36980 } 36981 function isValidCustom2(item, field) { 36982 const value = field.getValue({ item }); 36983 if (![void 0, "", null].includes(value) && !Number.isInteger(value)) { 36984 return (0, import_i18n45.__)("Value must be an integer."); 36985 } 36986 return null; 36987 } 36988 var integer_default = { 36989 type: "integer", 36990 render, 36991 Edit: "integer", 36992 sort: sort_number_default, 36993 enableSorting: true, 36994 enableGlobalSearch: false, 36995 defaultOperators: [ 36996 OPERATOR_IS, 36997 OPERATOR_IS_NOT, 36998 OPERATOR_LESS_THAN, 36999 OPERATOR_GREATER_THAN, 37000 OPERATOR_LESS_THAN_OR_EQUAL, 37001 OPERATOR_GREATER_THAN_OR_EQUAL, 37002 OPERATOR_BETWEEN 37003 ], 37004 validOperators: [ 37005 // Single-selection 37006 OPERATOR_IS, 37007 OPERATOR_IS_NOT, 37008 OPERATOR_LESS_THAN, 37009 OPERATOR_GREATER_THAN, 37010 OPERATOR_LESS_THAN_OR_EQUAL, 37011 OPERATOR_GREATER_THAN_OR_EQUAL, 37012 OPERATOR_BETWEEN, 37013 // Multiple-selection 37014 OPERATOR_IS_ANY, 37015 OPERATOR_IS_NONE, 37016 OPERATOR_IS_ALL, 37017 OPERATOR_IS_NOT_ALL 37018 ], 37019 format: format2, 37020 getValueFormatted: getValueFormatted2, 37021 validate: { 37022 required: isValidRequired, 37023 min: isValidMin, 37024 max: isValidMax, 37025 elements: isValidElements, 37026 custom: isValidCustom2 37027 } 37028 }; 37029 37030 // packages/dataviews/build-module/field-types/number.mjs 37031 var import_i18n46 = __toESM(require_i18n(), 1); 37032 var format3 = { 37033 separatorThousand: ",", 37034 separatorDecimal: ".", 37035 decimals: 2 37036 }; 37037 function getValueFormatted3({ 37038 item, 37039 field 37040 }) { 37041 let value = field.getValue({ item }); 37042 if (value === null || value === void 0) { 37043 return ""; 37044 } 37045 value = Number(value); 37046 if (!Number.isFinite(value)) { 37047 return String(value); 37048 } 37049 let formatNumber; 37050 if (field.type !== "number") { 37051 formatNumber = format3; 37052 } else { 37053 formatNumber = field.format; 37054 } 37055 const { separatorThousand, separatorDecimal, decimals } = formatNumber; 37056 const fixedValue = value.toFixed(decimals); 37057 const [integerPart, decimalPart] = fixedValue.split("."); 37058 const formattedInteger = separatorThousand ? integerPart.replace(/\B(?=(\d{3})+(?!\d))/g, separatorThousand) : integerPart; 37059 return decimals === 0 ? formattedInteger : formattedInteger + separatorDecimal + decimalPart; 37060 } 37061 function isEmpty2(value) { 37062 return value === "" || value === void 0 || value === null; 37063 } 37064 function isValidCustom3(item, field) { 37065 const value = field.getValue({ item }); 37066 if (!isEmpty2(value) && !Number.isFinite(value)) { 37067 return (0, import_i18n46.__)("Value must be a number."); 37068 } 37069 return null; 37070 } 37071 var number_default = { 37072 type: "number", 37073 render, 37074 Edit: "number", 37075 sort: sort_number_default, 37076 enableSorting: true, 37077 enableGlobalSearch: false, 37078 defaultOperators: [ 37079 OPERATOR_IS, 37080 OPERATOR_IS_NOT, 37081 OPERATOR_LESS_THAN, 37082 OPERATOR_GREATER_THAN, 37083 OPERATOR_LESS_THAN_OR_EQUAL, 37084 OPERATOR_GREATER_THAN_OR_EQUAL, 37085 OPERATOR_BETWEEN 37086 ], 37087 validOperators: [ 37088 // Single-selection 37089 OPERATOR_IS, 37090 OPERATOR_IS_NOT, 37091 OPERATOR_LESS_THAN, 37092 OPERATOR_GREATER_THAN, 37093 OPERATOR_LESS_THAN_OR_EQUAL, 37094 OPERATOR_GREATER_THAN_OR_EQUAL, 37095 OPERATOR_BETWEEN, 37096 // Multiple-selection 37097 OPERATOR_IS_ANY, 37098 OPERATOR_IS_NONE, 37099 OPERATOR_IS_ALL, 37100 OPERATOR_IS_NOT_ALL 37101 ], 37102 format: format3, 37103 getValueFormatted: getValueFormatted3, 37104 validate: { 37105 required: isValidRequired, 37106 min: isValidMin, 37107 max: isValidMax, 37108 elements: isValidElements, 37109 custom: isValidCustom3 37110 } 37111 }; 37112 37113 // packages/dataviews/build-module/field-types/text.mjs 37114 var text_default = { 37115 type: "text", 37116 render, 37117 Edit: "text", 37118 sort: sort_text_default, 37119 enableSorting: true, 37120 enableGlobalSearch: false, 37121 defaultOperators: [OPERATOR_IS_ANY, OPERATOR_IS_NONE], 37122 validOperators: [ 37123 // Single selection 37124 OPERATOR_IS, 37125 OPERATOR_IS_NOT, 37126 OPERATOR_CONTAINS, 37127 OPERATOR_NOT_CONTAINS, 37128 OPERATOR_STARTS_WITH, 37129 // Multiple selection 37130 OPERATOR_IS_ANY, 37131 OPERATOR_IS_NONE, 37132 OPERATOR_IS_ALL, 37133 OPERATOR_IS_NOT_ALL 37134 ], 37135 format: {}, 37136 getValueFormatted: get_value_formatted_default_default, 37137 validate: { 37138 required: isValidRequired, 37139 pattern: isValidPattern, 37140 minLength: isValidMinLength, 37141 maxLength: isValidMaxLength, 37142 elements: isValidElements 37143 } 37144 }; 37145 37146 // packages/dataviews/build-module/field-types/datetime.mjs 37147 var import_date7 = __toESM(require_date(), 1); 37148 37149 // packages/dataviews/build-module/field-types/utils/is-valid-date-boundary.mjs 37150 var import_date6 = __toESM(require_date(), 1); 37151 function parseDateLike(value) { 37152 if (!value) { 37153 return null; 37154 } 37155 if (!isValid(new Date(value))) { 37156 return null; 37157 } 37158 const parsed = (0, import_date6.getDate)(value); 37159 return parsed && isValid(parsed) ? parsed : null; 37160 } 37161 function validateDateLikeBoundary(item, field, boundary) { 37162 const constraint = field.isValid[boundary]?.constraint; 37163 if (typeof constraint !== "string") { 37164 return false; 37165 } 37166 const value = field.getValue({ item }); 37167 const boundaryValue = Array.isArray(value) ? value[boundary === "min" ? 0 : value.length - 1] : value; 37168 if (boundaryValue === void 0 || boundaryValue === null || boundaryValue === "") { 37169 return true; 37170 } 37171 const parsedConstraint = parseDateLike(constraint); 37172 const parsedValue = parseDateLike(String(boundaryValue)); 37173 return !!parsedConstraint && !!parsedValue && (boundary === "min" ? parsedValue.getTime() >= parsedConstraint.getTime() : parsedValue.getTime() <= parsedConstraint.getTime()); 37174 } 37175 function isValidMinDate(item, field) { 37176 return validateDateLikeBoundary(item, field, "min"); 37177 } 37178 function isValidMaxDate(item, field) { 37179 return validateDateLikeBoundary(item, field, "max"); 37180 } 37181 37182 // packages/dataviews/build-module/field-types/datetime.mjs 37183 var format4 = { 37184 datetime: (0, import_date7.getSettings)().formats.datetime, 37185 weekStartsOn: (0, import_date7.getSettings)().l10n.startOfWeek 37186 }; 37187 function getValueFormatted4({ 37188 item, 37189 field 37190 }) { 37191 const value = field.getValue({ item }); 37192 if (["", void 0, null].includes(value)) { 37193 return ""; 37194 } 37195 let formatDatetime; 37196 if (field.type !== "datetime") { 37197 formatDatetime = format4; 37198 } else { 37199 formatDatetime = field.format; 37200 } 37201 return (0, import_date7.dateI18n)(formatDatetime.datetime, (0, import_date7.getDate)(value)); 37202 } 37203 var sort = (a2, b2, direction) => { 37204 const timeA = new Date(a2).getTime(); 37205 const timeB = new Date(b2).getTime(); 37206 return direction === "asc" ? timeA - timeB : timeB - timeA; 37207 }; 37208 var datetime_default = { 37209 type: "datetime", 37210 render, 37211 Edit: "datetime", 37212 sort, 37213 enableSorting: true, 37214 enableGlobalSearch: false, 37215 defaultOperators: [ 37216 OPERATOR_ON, 37217 OPERATOR_NOT_ON, 37218 OPERATOR_BEFORE, 37219 OPERATOR_AFTER, 37220 OPERATOR_BEFORE_INC, 37221 OPERATOR_AFTER_INC, 37222 OPERATOR_IN_THE_PAST, 37223 OPERATOR_OVER 37224 ], 37225 validOperators: [ 37226 OPERATOR_ON, 37227 OPERATOR_NOT_ON, 37228 OPERATOR_BEFORE, 37229 OPERATOR_AFTER, 37230 OPERATOR_BEFORE_INC, 37231 OPERATOR_AFTER_INC, 37232 OPERATOR_IN_THE_PAST, 37233 OPERATOR_OVER 37234 ], 37235 format: format4, 37236 getValueFormatted: getValueFormatted4, 37237 validate: { 37238 required: isValidRequired, 37239 elements: isValidElements, 37240 min: isValidMinDate, 37241 max: isValidMaxDate 37242 } 37243 }; 37244 37245 // packages/dataviews/build-module/field-types/date.mjs 37246 var import_date8 = __toESM(require_date(), 1); 37247 var format5 = { 37248 date: (0, import_date8.getSettings)().formats.date, 37249 weekStartsOn: (0, import_date8.getSettings)().l10n.startOfWeek 37250 }; 37251 function getValueFormatted5({ 37252 item, 37253 field 37254 }) { 37255 const value = field.getValue({ item }); 37256 if (["", void 0, null].includes(value)) { 37257 return ""; 37258 } 37259 let formatDate2; 37260 if (field.type !== "date") { 37261 formatDate2 = format5; 37262 } else { 37263 formatDate2 = field.format; 37264 } 37265 return (0, import_date8.dateI18n)(formatDate2.date, (0, import_date8.getDate)(value)); 37266 } 37267 var sort2 = (a2, b2, direction) => { 37268 const timeA = new Date(a2).getTime(); 37269 const timeB = new Date(b2).getTime(); 37270 return direction === "asc" ? timeA - timeB : timeB - timeA; 37271 }; 37272 var date_default = { 37273 type: "date", 37274 render, 37275 Edit: "date", 37276 sort: sort2, 37277 enableSorting: true, 37278 enableGlobalSearch: false, 37279 defaultOperators: [ 37280 OPERATOR_ON, 37281 OPERATOR_NOT_ON, 37282 OPERATOR_BEFORE, 37283 OPERATOR_AFTER, 37284 OPERATOR_BEFORE_INC, 37285 OPERATOR_AFTER_INC, 37286 OPERATOR_IN_THE_PAST, 37287 OPERATOR_OVER, 37288 OPERATOR_BETWEEN 37289 ], 37290 validOperators: [ 37291 OPERATOR_ON, 37292 OPERATOR_NOT_ON, 37293 OPERATOR_BEFORE, 37294 OPERATOR_AFTER, 37295 OPERATOR_BEFORE_INC, 37296 OPERATOR_AFTER_INC, 37297 OPERATOR_IN_THE_PAST, 37298 OPERATOR_OVER, 37299 OPERATOR_BETWEEN 37300 ], 37301 format: format5, 37302 getValueFormatted: getValueFormatted5, 37303 validate: { 37304 required: isValidRequired, 37305 elements: isValidElements, 37306 min: isValidMinDate, 37307 max: isValidMaxDate 37308 } 37309 }; 37310 37311 // packages/dataviews/build-module/field-types/boolean.mjs 37312 var import_i18n47 = __toESM(require_i18n(), 1); 37313 37314 // packages/dataviews/build-module/field-types/utils/is-valid-required-for-bool.mjs 37315 function isValidRequiredForBool(item, field) { 37316 const value = field.getValue({ item }); 37317 return value === true; 37318 } 37319 37320 // packages/dataviews/build-module/field-types/boolean.mjs 37321 function getValueFormatted6({ 37322 item, 37323 field 37324 }) { 37325 const value = field.getValue({ item }); 37326 if (value === true) { 37327 return (0, import_i18n47.__)("True"); 37328 } 37329 if (value === false) { 37330 return (0, import_i18n47.__)("False"); 37331 } 37332 return ""; 37333 } 37334 function isValidCustom4(item, field) { 37335 const value = field.getValue({ item }); 37336 if (![void 0, "", null].includes(value) && ![true, false].includes(value)) { 37337 return (0, import_i18n47.__)("Value must be true, false, or undefined"); 37338 } 37339 return null; 37340 } 37341 var sort3 = (a2, b2, direction) => { 37342 const boolA = Boolean(a2); 37343 const boolB = Boolean(b2); 37344 if (boolA === boolB) { 37345 return 0; 37346 } 37347 if (direction === "asc") { 37348 return boolA ? 1 : -1; 37349 } 37350 return boolA ? -1 : 1; 37351 }; 37352 var boolean_default = { 37353 type: "boolean", 37354 render, 37355 Edit: "checkbox", 37356 sort: sort3, 37357 validate: { 37358 required: isValidRequiredForBool, 37359 elements: isValidElements, 37360 custom: isValidCustom4 37361 }, 37362 enableSorting: true, 37363 enableGlobalSearch: false, 37364 defaultOperators: [OPERATOR_IS, OPERATOR_IS_NOT], 37365 validOperators: [OPERATOR_IS, OPERATOR_IS_NOT], 37366 format: {}, 37367 getValueFormatted: getValueFormatted6 37368 }; 37369 37370 // packages/dataviews/build-module/field-types/media.mjs 37371 var media_default = { 37372 type: "media", 37373 render: () => null, 37374 Edit: null, 37375 sort: () => 0, 37376 enableSorting: false, 37377 enableGlobalSearch: false, 37378 defaultOperators: [], 37379 validOperators: [], 37380 format: {}, 37381 getValueFormatted: get_value_formatted_default_default, 37382 // cannot validate any constraint, so 37383 // the only available validation for the field author 37384 // would be providing a custom validator. 37385 validate: {} 37386 }; 37387 37388 // packages/dataviews/build-module/field-types/array.mjs 37389 var import_i18n48 = __toESM(require_i18n(), 1); 37390 37391 // packages/dataviews/build-module/field-types/utils/is-valid-required-for-array.mjs 37392 function isValidRequiredForArray(item, field) { 37393 const value = field.getValue({ item }); 37394 return Array.isArray(value) && value.length > 0 && value.every( 37395 (element) => ![void 0, "", null].includes(element) 37396 ); 37397 } 37398 37399 // packages/dataviews/build-module/field-types/array.mjs 37400 function getValueFormatted7({ 37401 item, 37402 field 37403 }) { 37404 const value = field.getValue({ item }); 37405 const arr = Array.isArray(value) ? value : []; 37406 return arr.join(", "); 37407 } 37408 function render2({ item, field }) { 37409 return getValueFormatted7({ item, field }); 37410 } 37411 function isValidCustom5(item, field) { 37412 const value = field.getValue({ item }); 37413 if (![void 0, "", null].includes(value) && !Array.isArray(value)) { 37414 return (0, import_i18n48.__)("Value must be an array."); 37415 } 37416 if (!value.every((v2) => typeof v2 === "string")) { 37417 return (0, import_i18n48.__)("Every value must be a string."); 37418 } 37419 return null; 37420 } 37421 var sort4 = (a2, b2, direction) => { 37422 const arrA = Array.isArray(a2) ? a2 : []; 37423 const arrB = Array.isArray(b2) ? b2 : []; 37424 if (arrA.length !== arrB.length) { 37425 return direction === "asc" ? arrA.length - arrB.length : arrB.length - arrA.length; 37426 } 37427 const joinedA = arrA.join(","); 37428 const joinedB = arrB.join(","); 37429 return direction === "asc" ? joinedA.localeCompare(joinedB) : joinedB.localeCompare(joinedA); 37430 }; 37431 var array_default = { 37432 type: "array", 37433 render: render2, 37434 Edit: "array", 37435 sort: sort4, 37436 enableSorting: true, 37437 enableGlobalSearch: false, 37438 defaultOperators: [OPERATOR_IS_ANY, OPERATOR_IS_NONE], 37439 validOperators: [ 37440 OPERATOR_IS_ANY, 37441 OPERATOR_IS_NONE, 37442 OPERATOR_IS_ALL, 37443 OPERATOR_IS_NOT_ALL 37444 ], 37445 format: {}, 37446 getValueFormatted: getValueFormatted7, 37447 validate: { 37448 required: isValidRequiredForArray, 37449 elements: isValidElements, 37450 custom: isValidCustom5 37451 } 37452 }; 37453 37454 // packages/dataviews/build-module/field-types/password.mjs 37455 function getValueFormatted8({ 37456 item, 37457 field 37458 }) { 37459 return field.getValue({ item }) ? "\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022" : ""; 37460 } 37461 var password_default = { 37462 type: "password", 37463 render, 37464 Edit: "password", 37465 sort: () => 0, 37466 // Passwords should not be sortable for security reasons 37467 enableSorting: false, 37468 enableGlobalSearch: false, 37469 defaultOperators: [], 37470 validOperators: [], 37471 format: {}, 37472 getValueFormatted: getValueFormatted8, 37473 validate: { 37474 required: isValidRequired, 37475 pattern: isValidPattern, 37476 minLength: isValidMinLength, 37477 maxLength: isValidMaxLength, 37478 elements: isValidElements 37479 } 37480 }; 37481 37482 // packages/dataviews/build-module/field-types/telephone.mjs 37483 var telephone_default = { 37484 type: "telephone", 37485 render, 37486 Edit: "telephone", 37487 sort: sort_text_default, 37488 enableSorting: true, 37489 enableGlobalSearch: false, 37490 defaultOperators: [OPERATOR_IS_ANY, OPERATOR_IS_NONE], 37491 validOperators: [ 37492 OPERATOR_IS, 37493 OPERATOR_IS_NOT, 37494 OPERATOR_CONTAINS, 37495 OPERATOR_NOT_CONTAINS, 37496 OPERATOR_STARTS_WITH, 37497 // Multiple selection 37498 OPERATOR_IS_ANY, 37499 OPERATOR_IS_NONE, 37500 OPERATOR_IS_ALL, 37501 OPERATOR_IS_NOT_ALL 37502 ], 37503 format: {}, 37504 getValueFormatted: get_value_formatted_default_default, 37505 validate: { 37506 required: isValidRequired, 37507 pattern: isValidPattern, 37508 minLength: isValidMinLength, 37509 maxLength: isValidMaxLength, 37510 elements: isValidElements 37511 } 37512 }; 37513 37514 // packages/dataviews/build-module/field-types/color.mjs 37515 var import_i18n49 = __toESM(require_i18n(), 1); 37516 var import_jsx_runtime185 = __toESM(require_jsx_runtime(), 1); 37517 function render3({ item, field }) { 37518 if (field.hasElements) { 37519 return /* @__PURE__ */ (0, import_jsx_runtime185.jsx)(RenderFromElements, { item, field }); 37520 } 37521 const value = get_value_formatted_default_default({ item, field }); 37522 if (!value || !w(value).isValid()) { 37523 return value; 37524 } 37525 return /* @__PURE__ */ (0, import_jsx_runtime185.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: "8px" }, children: [ 37526 /* @__PURE__ */ (0, import_jsx_runtime185.jsx)( 37527 "div", 37528 { 37529 style: { 37530 width: "16px", 37531 height: "16px", 37532 borderRadius: "50%", 37533 backgroundColor: value, 37534 border: "1px solid #ddd", 37535 flexShrink: 0 37536 } 37537 } 37538 ), 37539 /* @__PURE__ */ (0, import_jsx_runtime185.jsx)("span", { children: value }) 37540 ] }); 37541 } 37542 function isValidCustom6(item, field) { 37543 const value = field.getValue({ item }); 37544 if (![void 0, "", null].includes(value) && !w(value).isValid()) { 37545 return (0, import_i18n49.__)("Value must be a valid color."); 37546 } 37547 return null; 37548 } 37549 var sort5 = (a2, b2, direction) => { 37550 const colorA = w(a2); 37551 const colorB = w(b2); 37552 if (!colorA.isValid() && !colorB.isValid()) { 37553 return 0; 37554 } 37555 if (!colorA.isValid()) { 37556 return direction === "asc" ? 1 : -1; 37557 } 37558 if (!colorB.isValid()) { 37559 return direction === "asc" ? -1 : 1; 37560 } 37561 const hslA = colorA.toHsl(); 37562 const hslB = colorB.toHsl(); 37563 if (hslA.h !== hslB.h) { 37564 return direction === "asc" ? hslA.h - hslB.h : hslB.h - hslA.h; 37565 } 37566 if (hslA.s !== hslB.s) { 37567 return direction === "asc" ? hslA.s - hslB.s : hslB.s - hslA.s; 37568 } 37569 return direction === "asc" ? hslA.l - hslB.l : hslB.l - hslA.l; 37570 }; 37571 var color_default = { 37572 type: "color", 37573 render: render3, 37574 Edit: "color", 37575 sort: sort5, 37576 enableSorting: true, 37577 enableGlobalSearch: false, 37578 defaultOperators: [OPERATOR_IS_ANY, OPERATOR_IS_NONE], 37579 validOperators: [ 37580 OPERATOR_IS, 37581 OPERATOR_IS_NOT, 37582 OPERATOR_IS_ANY, 37583 OPERATOR_IS_NONE 37584 ], 37585 format: {}, 37586 getValueFormatted: get_value_formatted_default_default, 37587 validate: { 37588 required: isValidRequired, 37589 elements: isValidElements, 37590 custom: isValidCustom6 37591 } 37592 }; 37593 37594 // packages/dataviews/build-module/field-types/url.mjs 37595 var url_default = { 37596 type: "url", 37597 render, 37598 Edit: "url", 37599 sort: sort_text_default, 37600 enableSorting: true, 37601 enableGlobalSearch: false, 37602 defaultOperators: [OPERATOR_IS_ANY, OPERATOR_IS_NONE], 37603 validOperators: [ 37604 OPERATOR_IS, 37605 OPERATOR_IS_NOT, 37606 OPERATOR_CONTAINS, 37607 OPERATOR_NOT_CONTAINS, 37608 OPERATOR_STARTS_WITH, 37609 // Multiple selection 37610 OPERATOR_IS_ANY, 37611 OPERATOR_IS_NONE, 37612 OPERATOR_IS_ALL, 37613 OPERATOR_IS_NOT_ALL 37614 ], 37615 format: {}, 37616 getValueFormatted: get_value_formatted_default_default, 37617 validate: { 37618 required: isValidRequired, 37619 pattern: isValidPattern, 37620 minLength: isValidMinLength, 37621 maxLength: isValidMaxLength, 37622 elements: isValidElements 37623 } 37624 }; 37625 37626 // packages/dataviews/build-module/field-types/no-type.mjs 37627 var sort6 = (a2, b2, direction) => { 37628 if (typeof a2 === "number" && typeof b2 === "number") { 37629 return sort_number_default(a2, b2, direction); 37630 } 37631 return sort_text_default(a2, b2, direction); 37632 }; 37633 var no_type_default = { 37634 // type: no type for this one 37635 render, 37636 Edit: null, 37637 sort: sort6, 37638 enableSorting: true, 37639 enableGlobalSearch: false, 37640 defaultOperators: [OPERATOR_IS, OPERATOR_IS_NOT], 37641 validOperators: getAllOperatorNames(), 37642 format: {}, 37643 getValueFormatted: get_value_formatted_default_default, 37644 validate: { 37645 required: isValidRequired, 37646 elements: isValidElements 37647 } 37648 }; 37649 37650 // packages/dataviews/build-module/field-types/utils/get-is-valid.mjs 37651 function supportsNumericRangeConstraint(type) { 37652 return type === "integer" || type === "number"; 37653 } 37654 function supportsDateRangeConstraint(type) { 37655 return type === "date" || type === "datetime"; 37656 } 37657 function normalizeRangeRule(value, fieldType, key2) { 37658 const validator = fieldType.validate[key2]; 37659 if (validator && (typeof value === "number" && supportsNumericRangeConstraint(fieldType.type) || typeof value === "string" && supportsDateRangeConstraint(fieldType.type))) { 37660 return { constraint: value, validate: validator }; 37661 } 37662 return void 0; 37663 } 37664 function getIsValid(field, fieldType) { 37665 const rules = field.isValid; 37666 let required; 37667 if (rules?.required === true && fieldType.validate.required !== void 0) { 37668 required = { 37669 constraint: true, 37670 validate: fieldType.validate.required 37671 }; 37672 } 37673 let elements; 37674 if ((rules?.elements === true || // elements is enabled unless the field opts-out 37675 rules?.elements === void 0 && (!!field.elements || !!field.getElements)) && fieldType.validate.elements !== void 0) { 37676 elements = { 37677 constraint: true, 37678 validate: fieldType.validate.elements 37679 }; 37680 } 37681 const min2 = normalizeRangeRule(rules?.min, fieldType, "min"); 37682 const max2 = normalizeRangeRule(rules?.max, fieldType, "max"); 37683 const minLengthValue = rules?.minLength; 37684 let minLength; 37685 if (typeof minLengthValue === "number" && fieldType.validate.minLength !== void 0) { 37686 minLength = { 37687 constraint: minLengthValue, 37688 validate: fieldType.validate.minLength 37689 }; 37690 } 37691 const maxLengthValue = rules?.maxLength; 37692 let maxLength; 37693 if (typeof maxLengthValue === "number" && fieldType.validate.maxLength !== void 0) { 37694 maxLength = { 37695 constraint: maxLengthValue, 37696 validate: fieldType.validate.maxLength 37697 }; 37698 } 37699 const patternValue = rules?.pattern; 37700 let pattern; 37701 if (patternValue !== void 0 && fieldType.validate.pattern !== void 0) { 37702 pattern = { 37703 constraint: patternValue, 37704 validate: fieldType.validate.pattern 37705 }; 37706 } 37707 const custom = rules?.custom ?? fieldType.validate.custom; 37708 return { 37709 required, 37710 elements, 37711 min: min2, 37712 max: max2, 37713 minLength, 37714 maxLength, 37715 pattern, 37716 custom 37717 }; 37718 } 37719 37720 // packages/dataviews/build-module/field-types/utils/get-filter.mjs 37721 function getFilter(fieldType) { 37722 return fieldType.validOperators.reduce((accumulator, operator) => { 37723 const operatorObj = getOperatorByName(operator); 37724 if (operatorObj?.filter) { 37725 accumulator[operator] = operatorObj.filter; 37726 } 37727 return accumulator; 37728 }, {}); 37729 } 37730 37731 // packages/dataviews/build-module/field-types/utils/get-format.mjs 37732 function getFormat(field, fieldType) { 37733 return { 37734 ...fieldType.format, 37735 ...field.format 37736 }; 37737 } 37738 var get_format_default = getFormat; 37739 37740 // packages/dataviews/build-module/field-types/index.mjs 37741 function getFieldTypeByName(type) { 37742 const found = [ 37743 email_default, 37744 integer_default, 37745 number_default, 37746 text_default, 37747 datetime_default, 37748 date_default, 37749 boolean_default, 37750 media_default, 37751 array_default, 37752 password_default, 37753 telephone_default, 37754 color_default, 37755 url_default 37756 ].find((fieldType) => fieldType?.type === type); 37757 if (!!found) { 37758 return found; 37759 } 37760 return no_type_default; 37761 } 37762 function normalizeFields(fields3) { 37763 return fields3.map((field) => { 37764 const fieldType = getFieldTypeByName(field.type); 37765 const getValue = field.getValue || get_value_from_id_default(field.id); 37766 const sort7 = function(a2, b2, direction) { 37767 const aValue = getValue({ item: a2 }); 37768 const bValue = getValue({ item: b2 }); 37769 return field.sort ? field.sort(aValue, bValue, direction) : fieldType.sort(aValue, bValue, direction); 37770 }; 37771 return { 37772 id: field.id, 37773 label: field.label || field.id, 37774 header: field.header || field.label || field.id, 37775 description: field.description, 37776 placeholder: field.placeholder, 37777 getValue, 37778 setValue: field.setValue || set_value_from_id_default(field.id), 37779 elements: field.elements, 37780 getElements: field.getElements, 37781 hasElements: hasElements(field), 37782 isVisible: field.isVisible, 37783 isDisabled: typeof field.isDisabled === "function" ? field.isDisabled : () => !!field.isDisabled, 37784 enableHiding: field.enableHiding ?? true, 37785 readOnly: field.readOnly ?? false, 37786 // The type provides defaults for the following props 37787 type: fieldType.type, 37788 render: field.render ?? fieldType.render, 37789 Edit: getControl(field, fieldType.Edit), 37790 sort: sort7, 37791 enableSorting: field.enableSorting ?? fieldType.enableSorting, 37792 enableGlobalSearch: field.enableGlobalSearch ?? fieldType.enableGlobalSearch, 37793 isValid: getIsValid(field, fieldType), 37794 filterBy: get_filter_by_default( 37795 field, 37796 fieldType.defaultOperators, 37797 fieldType.validOperators 37798 ), 37799 filter: getFilter(fieldType), 37800 format: get_format_default(field, fieldType), 37801 getValueFormatted: field.getValueFormatted ?? fieldType.getValueFormatted 37802 }; 37803 }); 37804 } 37805 37806 // packages/dataviews/build-module/hooks/use-data.mjs 37807 var import_element141 = __toESM(require_element(), 1); 37808 function useData({ 37809 view, 37810 data: shownData, 37811 getItemId: getItemId2, 37812 isLoading, 37813 paginationInfo, 37814 selection 37815 }) { 37816 const isInfiniteScrollEnabled = view.infiniteScrollEnabled; 37817 const [hasInitiallyLoaded, setHasInitiallyLoaded] = (0, import_element141.useState)( 37818 !isLoading 37819 ); 37820 (0, import_element141.useEffect)(() => { 37821 if (!isLoading) { 37822 setHasInitiallyLoaded(true); 37823 } 37824 }, [isLoading]); 37825 const previousDataRef = (0, import_element141.useRef)(shownData); 37826 const previousPaginationInfoRef = (0, import_element141.useRef)(paginationInfo); 37827 (0, import_element141.useEffect)(() => { 37828 if (!isLoading) { 37829 previousDataRef.current = shownData; 37830 previousPaginationInfoRef.current = paginationInfo; 37831 } 37832 }, [shownData, isLoading, paginationInfo]); 37833 const [visibleEntries, setVisibleEntries] = (0, import_element141.useState)([]); 37834 const positionMapRef = (0, import_element141.useRef)(/* @__PURE__ */ new Map()); 37835 const allLoadedRecordsRef = (0, import_element141.useRef)([]); 37836 const prevViewParamsRef = (0, import_element141.useRef)({ 37837 search: void 0, 37838 filters: void 0, 37839 perPage: void 0 37840 }); 37841 const scrollDirectionRef = (0, import_element141.useRef)(void 0); 37842 const prevStartPositionRef = (0, import_element141.useRef)(void 0); 37843 const hasInitializedRef = (0, import_element141.useRef)(false); 37844 const allLoadedRecords = (0, import_element141.useMemo)(() => { 37845 if (view.startPosition !== void 0 && prevStartPositionRef.current !== void 0) { 37846 if (view.startPosition < prevStartPositionRef.current) { 37847 scrollDirectionRef.current = "up"; 37848 } else if (view.startPosition > prevStartPositionRef.current) { 37849 scrollDirectionRef.current = "down"; 37850 } 37851 } 37852 prevStartPositionRef.current = view.startPosition; 37853 const currentFiltersKey = JSON.stringify(view.filters ?? []); 37854 const prevFiltersKey = prevViewParamsRef.current.filters; 37855 const shouldReset = !hasInitializedRef.current || !view.infiniteScrollEnabled || view.search !== prevViewParamsRef.current.search || currentFiltersKey !== prevFiltersKey || view.perPage !== prevViewParamsRef.current.perPage; 37856 hasInitializedRef.current = true; 37857 prevViewParamsRef.current = { 37858 search: view.search, 37859 filters: currentFiltersKey, 37860 perPage: view.perPage 37861 }; 37862 if (shouldReset) { 37863 positionMapRef.current.clear(); 37864 scrollDirectionRef.current = void 0; 37865 const startPosition = view.search ? 1 : view.startPosition ?? 1; 37866 const records = shownData.map((record, index2) => { 37867 const position = startPosition + index2; 37868 positionMapRef.current.set(getItemId2(record), position); 37869 return { 37870 ...record, 37871 position 37872 }; 37873 }); 37874 allLoadedRecordsRef.current = records; 37875 return records; 37876 } 37877 const prev = allLoadedRecordsRef.current; 37878 const shownDataIds = new Set(shownData.map(getItemId2)); 37879 const scrollDirection = scrollDirectionRef.current; 37880 const basePosition = view.search ? 1 : view.startPosition ?? 1; 37881 const newRecords = shownData.map((record, index2) => { 37882 const itemId = getItemId2(record); 37883 const position = view.infiniteScrollEnabled ? basePosition + index2 : void 0; 37884 if (position !== void 0) { 37885 positionMapRef.current.set(itemId, position); 37886 } 37887 return { 37888 ...record, 37889 position 37890 }; 37891 }); 37892 if (newRecords.length === 0) { 37893 return prev; 37894 } 37895 const prevWithoutDuplicates = prev.filter( 37896 (record) => !shownDataIds.has(getItemId2(record)) 37897 ); 37898 const allRecords = scrollDirection === "up" ? [...newRecords, ...prevWithoutDuplicates] : [...prevWithoutDuplicates, ...newRecords]; 37899 allRecords.sort((a2, b2) => { 37900 const posA = a2.position; 37901 const posB = b2.position; 37902 return posA - posB; 37903 }); 37904 let result = allRecords; 37905 if (visibleEntries.length > 0) { 37906 const visibleMin = Math.min(...visibleEntries); 37907 const visibleMax = Math.max(...visibleEntries); 37908 const buffer = 20; 37909 const recordPositions = allRecords.map( 37910 (r3) => r3.position 37911 ); 37912 const minRecordPos = Math.min(...recordPositions); 37913 const maxRecordPos = Math.max(...recordPositions); 37914 const hasOverlap = !(maxRecordPos < visibleMin - buffer || minRecordPos > visibleMax + buffer); 37915 if (hasOverlap) { 37916 result = allRecords.filter((record) => { 37917 const itemId = getItemId2(record); 37918 const isSelected2 = selection?.includes(itemId); 37919 if (isSelected2) { 37920 return true; 37921 } 37922 const itemPosition = record.position; 37923 if (scrollDirection === "up") { 37924 return itemPosition <= visibleMax + buffer; 37925 } else if (scrollDirection === "down") { 37926 return itemPosition >= visibleMin - buffer; 37927 } 37928 return itemPosition >= visibleMin - buffer && itemPosition <= visibleMax + buffer; 37929 }); 37930 } 37931 } 37932 allLoadedRecordsRef.current = result; 37933 return result; 37934 }, [ 37935 shownData, 37936 view.search, 37937 view.filters, 37938 view.perPage, 37939 view.startPosition, 37940 view.infiniteScrollEnabled, 37941 visibleEntries, 37942 selection, 37943 getItemId2 37944 ]); 37945 if (!isInfiniteScrollEnabled) { 37946 const dataToReturn = isLoading && previousDataRef.current?.length ? previousDataRef.current : shownData; 37947 return { 37948 data: dataToReturn.map((item) => ({ 37949 ...item, 37950 position: void 0 37951 })), 37952 paginationInfo: isLoading && previousDataRef.current?.length ? previousPaginationInfoRef.current : paginationInfo, 37953 hasInitiallyLoaded, 37954 setVisibleEntries: void 0 37955 }; 37956 } 37957 return { 37958 data: allLoadedRecords, 37959 paginationInfo, 37960 hasInitiallyLoaded, 37961 setVisibleEntries 37962 }; 37963 } 37964 37965 // packages/dataviews/build-module/hooks/use-infinite-scroll.mjs 37966 var import_element142 = __toESM(require_element(), 1); 37967 var import_compose18 = __toESM(require_compose(), 1); 37968 function captureAnchorElement(container, anchorElementRef, direction) { 37969 const containerRect = container.getBoundingClientRect(); 37970 const centerY = containerRect.top + containerRect.height / 2; 37971 const items = Array.from(container.querySelectorAll("[aria-posinset]")); 37972 if (items.length === 0) { 37973 return false; 37974 } 37975 const bestAnchor = items.reduce((best, item) => { 37976 const itemRect = item.getBoundingClientRect(); 37977 const itemCenterY = itemRect.top + itemRect.height / 2; 37978 const distance = Math.abs(itemCenterY - centerY); 37979 const bestRect = best.getBoundingClientRect(); 37980 const bestCenterY = bestRect.top + bestRect.height / 2; 37981 const bestDistance = Math.abs(bestCenterY - centerY); 37982 return distance < bestDistance ? item : best; 37983 }); 37984 const posinset = Number(bestAnchor.getAttribute("aria-posinset")); 37985 const anchorRect = bestAnchor.getBoundingClientRect(); 37986 anchorElementRef.current = { 37987 posinset, 37988 viewportOffset: anchorRect.top - containerRect.top, 37989 direction 37990 }; 37991 return true; 37992 } 37993 function useInfiniteScroll({ 37994 view, 37995 onChangeView, 37996 isLoading, 37997 paginationInfo, 37998 containerRef, 37999 setVisibleEntries 38000 }) { 38001 const anchorElementRef = (0, import_element142.useRef)(null); 38002 const viewRef = (0, import_element142.useRef)(view); 38003 const isLoadingRef = (0, import_element142.useRef)(isLoading); 38004 const onChangeViewRef = (0, import_element142.useRef)(onChangeView); 38005 const totalItemsRef = (0, import_element142.useRef)(paginationInfo.totalItems); 38006 (0, import_element142.useLayoutEffect)(() => { 38007 viewRef.current = view; 38008 isLoadingRef.current = isLoading; 38009 onChangeViewRef.current = onChangeView; 38010 totalItemsRef.current = paginationInfo.totalItems; 38011 }, [view, isLoading, onChangeView, paginationInfo.totalItems]); 38012 const intersectionObserverCallback = (0, import_element142.useCallback)( 38013 (entries) => { 38014 if (!setVisibleEntries) { 38015 return; 38016 } 38017 setVisibleEntries((prev) => { 38018 const newVisibleEntries = new Set(prev); 38019 let hasChanged = false; 38020 entries.forEach((entry) => { 38021 const posInSet = Number( 38022 entry.target?.attributes?.getNamedItem( 38023 "aria-posinset" 38024 )?.value 38025 ); 38026 if (isNaN(posInSet)) { 38027 return; 38028 } 38029 if (entry.isIntersecting) { 38030 if (!newVisibleEntries.has(posInSet)) { 38031 newVisibleEntries.add(posInSet); 38032 hasChanged = true; 38033 } 38034 } else if (newVisibleEntries.has(posInSet)) { 38035 newVisibleEntries.delete(posInSet); 38036 hasChanged = true; 38037 } 38038 }); 38039 return hasChanged ? Array.from(newVisibleEntries).sort() : prev; 38040 }); 38041 }, 38042 [setVisibleEntries] 38043 ); 38044 (0, import_element142.useLayoutEffect)(() => { 38045 const container = containerRef.current; 38046 const anchor = anchorElementRef.current; 38047 if (!container || !view.infiniteScrollEnabled || !anchor || isLoading) { 38048 return; 38049 } 38050 const anchorElement = container.querySelector( 38051 `[aria-posinset="$anchor.posinset}"]` 38052 ); 38053 if (anchorElement) { 38054 const containerRect = container.getBoundingClientRect(); 38055 const anchorRect = anchorElement.getBoundingClientRect(); 38056 const currentOffset = anchorRect.top - containerRect.top; 38057 const scrollAdjustment = currentOffset - anchor.viewportOffset; 38058 if (Math.abs(scrollAdjustment) > 1) { 38059 container.scrollTop += scrollAdjustment; 38060 } 38061 } 38062 anchorElementRef.current = null; 38063 }, [containerRef, isLoading, view.infiniteScrollEnabled]); 38064 const intersectionObserverRef = (0, import_element142.useRef)( 38065 null 38066 ); 38067 (0, import_element142.useEffect)(() => { 38068 if (!view.infiniteScrollEnabled || !intersectionObserverCallback) { 38069 if (intersectionObserverRef.current) { 38070 intersectionObserverRef.current.disconnect(); 38071 intersectionObserverRef.current = null; 38072 } 38073 return; 38074 } 38075 intersectionObserverRef.current = new IntersectionObserver( 38076 intersectionObserverCallback, 38077 { root: null, rootMargin: "0px", threshold: 0.1 } 38078 ); 38079 return () => { 38080 if (intersectionObserverRef.current) { 38081 intersectionObserverRef.current.disconnect(); 38082 intersectionObserverRef.current = null; 38083 } 38084 }; 38085 }, [view.infiniteScrollEnabled, intersectionObserverCallback]); 38086 (0, import_element142.useEffect)(() => { 38087 if (!view.infiniteScrollEnabled || !containerRef.current) { 38088 return; 38089 } 38090 let lastScrollTop = 0; 38091 const BOTTOM_THRESHOLD = 600; 38092 const TOP_THRESHOLD = 800; 38093 const handleScroll = (0, import_compose18.throttle)((event) => { 38094 const currentView = viewRef.current; 38095 const totalItems = totalItemsRef.current; 38096 const target = event.target; 38097 const scrollTop = target.scrollTop; 38098 const scrollHeight = target.scrollHeight; 38099 const clientHeight = target.clientHeight; 38100 const scrollDirection = scrollTop > lastScrollTop ? "down" : "up"; 38101 lastScrollTop = scrollTop; 38102 if (isLoadingRef.current) { 38103 return; 38104 } 38105 const currentStartPosition = currentView.startPosition || 1; 38106 const batchSize = currentView.perPage || 10; 38107 const currentEndPosition = Math.min( 38108 currentStartPosition + batchSize, 38109 totalItems 38110 ); 38111 if (scrollDirection === "down" && scrollTop + clientHeight >= scrollHeight - BOTTOM_THRESHOLD) { 38112 if (currentEndPosition < totalItems) { 38113 const newStartPosition = currentEndPosition; 38114 captureAnchorElement(target, anchorElementRef, "down"); 38115 onChangeViewRef.current({ 38116 ...currentView, 38117 startPosition: newStartPosition 38118 }); 38119 } 38120 } 38121 if (scrollDirection === "up" && scrollTop <= TOP_THRESHOLD) { 38122 if (currentStartPosition > 1) { 38123 const calculatedStartPosition = currentStartPosition - batchSize; 38124 const newStartPosition = calculatedStartPosition < 6 ? 1 : calculatedStartPosition; 38125 captureAnchorElement(target, anchorElementRef, "up"); 38126 onChangeViewRef.current({ 38127 ...currentView, 38128 startPosition: newStartPosition 38129 }); 38130 } 38131 } 38132 }, 50); 38133 const container = containerRef.current; 38134 container.addEventListener("scroll", handleScroll); 38135 return () => { 38136 container.removeEventListener("scroll", handleScroll); 38137 handleScroll.cancel(); 38138 }; 38139 }, [containerRef, view.infiniteScrollEnabled]); 38140 return { 38141 intersectionObserver: intersectionObserverRef.current 38142 }; 38143 } 38144 38145 // packages/dataviews/build-module/dataviews-picker/index.mjs 38146 var import_element143 = __toESM(require_element(), 1); 38147 var import_compose19 = __toESM(require_compose(), 1); 38148 var import_jsx_runtime186 = __toESM(require_jsx_runtime(), 1); 38149 var isItemClickable = () => false; 38150 var dataViewsPickerLayouts = VIEW_LAYOUTS.filter( 38151 (viewLayout) => viewLayout.isPicker 38152 ); 38153 var defaultGetItemId = (item) => item.id; 38154 var EMPTY_ARRAY5 = []; 38155 var DEFAULT_PICKER_LAYOUTS = { 38156 pickerGrid: true, 38157 pickerTable: true 38158 }; 38159 function DefaultUI({ 38160 search = true, 38161 searchLabel = void 0 38162 }) { 38163 const { view } = (0, import_element143.useContext)(dataviews_context_default); 38164 const isInfiniteScroll = view.infiniteScrollEnabled; 38165 return /* @__PURE__ */ (0, import_jsx_runtime186.jsxs)(import_jsx_runtime186.Fragment, { children: [ 38166 /* @__PURE__ */ (0, import_jsx_runtime186.jsxs)( 38167 Stack, 38168 { 38169 direction: "row", 38170 align: "top", 38171 justify: "space-between", 38172 className: clsx_default("dataviews__view-actions", { 38173 "dataviews__view-actions--infinite-scroll": isInfiniteScroll 38174 }), 38175 gap: "xs", 38176 children: [ 38177 /* @__PURE__ */ (0, import_jsx_runtime186.jsxs)( 38178 Stack, 38179 { 38180 direction: "row", 38181 gap: "sm", 38182 justify: "start", 38183 className: "dataviews__search", 38184 children: [ 38185 search && /* @__PURE__ */ (0, import_jsx_runtime186.jsx)(dataviews_search_default, { label: searchLabel }), 38186 /* @__PURE__ */ (0, import_jsx_runtime186.jsx)(toggle_default, {}) 38187 ] 38188 } 38189 ), 38190 /* @__PURE__ */ (0, import_jsx_runtime186.jsx)(Stack, { direction: "row", gap: "xs", style: { flexShrink: 0 }, children: /* @__PURE__ */ (0, import_jsx_runtime186.jsx)(dataviews_view_config_default, {}) }) 38191 ] 38192 } 38193 ), 38194 /* @__PURE__ */ (0, import_jsx_runtime186.jsx)(filters_toggled_default, { className: "dataviews-filters__container" }), 38195 /* @__PURE__ */ (0, import_jsx_runtime186.jsx)(DataViewsLayout, {}), 38196 /* @__PURE__ */ (0, import_jsx_runtime186.jsx)(DataViewsPickerFooter, {}) 38197 ] }); 38198 } 38199 function DataViewsPicker({ 38200 view, 38201 onChangeView, 38202 fields: fields3, 38203 search = true, 38204 searchLabel = void 0, 38205 actions = EMPTY_ARRAY5, 38206 data, 38207 getItemId: getItemId2 = defaultGetItemId, 38208 isLoading = false, 38209 paginationInfo, 38210 defaultLayouts: defaultLayoutsProperty = DEFAULT_PICKER_LAYOUTS, 38211 selection, 38212 onChangeSelection, 38213 children, 38214 config = { perPageSizes: [10, 20, 50, 100] }, 38215 itemListLabel, 38216 empty, 38217 onReset 38218 }) { 38219 const { data: displayData, setVisibleEntries } = useData({ 38220 view, 38221 data, 38222 getItemId: getItemId2, 38223 selection, 38224 paginationInfo 38225 }); 38226 const containerRef = (0, import_element143.useRef)(null); 38227 const [containerWidth, setContainerWidth] = (0, import_element143.useState)(0); 38228 const resizeObserverRef = (0, import_compose19.useResizeObserver)( 38229 (resizeObserverEntries) => { 38230 setContainerWidth( 38231 resizeObserverEntries[0].borderBoxSize[0].inlineSize 38232 ); 38233 }, 38234 { box: "border-box" } 38235 ); 38236 const [openedFilter, setOpenedFilter] = (0, import_element143.useState)(null); 38237 function setSelectionWithChange(value) { 38238 const newValue = typeof value === "function" ? value(selection) : value; 38239 if (onChangeSelection) { 38240 onChangeSelection(newValue); 38241 } 38242 } 38243 const _fields = (0, import_element143.useMemo)(() => normalizeFields(fields3), [fields3]); 38244 const filters = use_filters_default(_fields, view); 38245 const hasPrimaryOrLockedFilters = (0, import_element143.useMemo)( 38246 () => (filters || []).some( 38247 (filter) => filter.isPrimary || filter.isLocked 38248 ), 38249 [filters] 38250 ); 38251 const [isShowingFilter, setIsShowingFilter] = (0, import_element143.useState)( 38252 hasPrimaryOrLockedFilters 38253 ); 38254 const { intersectionObserver } = useInfiniteScroll({ 38255 view, 38256 onChangeView, 38257 isLoading, 38258 paginationInfo, 38259 containerRef, 38260 setVisibleEntries 38261 }); 38262 (0, import_element143.useEffect)(() => { 38263 if (hasPrimaryOrLockedFilters && !isShowingFilter) { 38264 setIsShowingFilter(true); 38265 } 38266 }, [hasPrimaryOrLockedFilters, isShowingFilter]); 38267 const defaultLayouts = (0, import_element143.useMemo)( 38268 () => Object.fromEntries( 38269 Object.entries(defaultLayoutsProperty).filter(([layoutType]) => { 38270 return dataViewsPickerLayouts.some( 38271 (viewLayout) => viewLayout.type === layoutType 38272 ); 38273 }).map(([key2, value]) => [ 38274 key2, 38275 value === true ? {} : value 38276 ]) 38277 ), 38278 [defaultLayoutsProperty] 38279 ); 38280 if (!defaultLayouts[view.type]) { 38281 return null; 38282 } 38283 return /* @__PURE__ */ (0, import_jsx_runtime186.jsx)( 38284 dataviews_context_default.Provider, 38285 { 38286 value: { 38287 view, 38288 onChangeView, 38289 fields: _fields, 38290 actions, 38291 data: displayData, 38292 isLoading, 38293 paginationInfo, 38294 isItemClickable, 38295 selection, 38296 onChangeSelection: setSelectionWithChange, 38297 openedFilter, 38298 setOpenedFilter, 38299 getItemId: getItemId2, 38300 containerWidth, 38301 containerRef, 38302 resizeObserverRef, 38303 defaultLayouts, 38304 filters, 38305 isShowingFilter, 38306 setIsShowingFilter, 38307 config, 38308 itemListLabel, 38309 empty, 38310 onReset, 38311 hasInitiallyLoaded: true, 38312 intersectionObserver 38313 }, 38314 children: /* @__PURE__ */ (0, import_jsx_runtime186.jsx)("div", { className: "dataviews-picker-wrapper", children: children ?? /* @__PURE__ */ (0, import_jsx_runtime186.jsx)(DefaultUI, { search, searchLabel }) }) 38315 } 38316 ); 38317 } 38318 var DataViewsPickerSubComponents = DataViewsPicker; 38319 DataViewsPickerSubComponents.BulkActionToolbar = DataViewsPickerFooter; 38320 DataViewsPickerSubComponents.Filters = filters_default; 38321 DataViewsPickerSubComponents.FiltersToggled = filters_toggled_default; 38322 DataViewsPickerSubComponents.FiltersToggle = toggle_default; 38323 DataViewsPickerSubComponents.Layout = DataViewsLayout; 38324 DataViewsPickerSubComponents.LayoutSwitcher = ViewTypeMenu; 38325 DataViewsPickerSubComponents.Pagination = DataViewsPagination; 38326 DataViewsPickerSubComponents.Search = dataviews_search_default; 38327 DataViewsPickerSubComponents.ViewConfig = DataviewsViewConfigDropdown; 38328 var dataviews_picker_default = DataViewsPickerSubComponents; 38329 38330 // packages/dataviews/build-module/dataform/index.mjs 38331 var import_element155 = __toESM(require_element(), 1); 38332 38333 // packages/dataviews/build-module/components/dataform-context/index.mjs 38334 var import_element144 = __toESM(require_element(), 1); 38335 var import_jsx_runtime187 = __toESM(require_jsx_runtime(), 1); 38336 var DataFormContext = (0, import_element144.createContext)({ 38337 fields: [] 38338 }); 38339 DataFormContext.displayName = "DataFormContext"; 38340 function DataFormProvider({ 38341 fields: fields3, 38342 children 38343 }) { 38344 return /* @__PURE__ */ (0, import_jsx_runtime187.jsx)(DataFormContext.Provider, { value: { fields: fields3 }, children }); 38345 } 38346 var dataform_context_default = DataFormContext; 38347 38348 // packages/dataviews/build-module/components/dataform-layouts/data-form-layout.mjs 38349 var import_element154 = __toESM(require_element(), 1); 38350 38351 // packages/dataviews/build-module/components/dataform-layouts/regular/index.mjs 38352 var import_element145 = __toESM(require_element(), 1); 38353 var import_components46 = __toESM(require_components(), 1); 38354 38355 // packages/dataviews/build-module/components/dataform-layouts/normalize-form.mjs 38356 var import_i18n50 = __toESM(require_i18n(), 1); 38357 var DEFAULT_LAYOUT = { 38358 type: "regular", 38359 labelPosition: "top" 38360 }; 38361 var normalizeCardSummaryField = (sum) => { 38362 if (typeof sum === "string") { 38363 return [{ id: sum, visibility: "when-collapsed" }]; 38364 } 38365 return sum.map((item) => { 38366 if (typeof item === "string") { 38367 return { id: item, visibility: "when-collapsed" }; 38368 } 38369 return { id: item.id, visibility: item.visibility }; 38370 }); 38371 }; 38372 function normalizeLayout(layout) { 38373 let normalizedLayout = DEFAULT_LAYOUT; 38374 if (layout?.type === "regular") { 38375 normalizedLayout = { 38376 type: "regular", 38377 labelPosition: layout?.labelPosition ?? "top" 38378 }; 38379 } else if (layout?.type === "panel") { 38380 const summary = layout.summary ?? []; 38381 const normalizedSummary = Array.isArray(summary) ? summary : [summary]; 38382 const openAs = layout?.openAs; 38383 let normalizedOpenAs; 38384 if (typeof openAs === "object" && openAs.type === "modal") { 38385 normalizedOpenAs = { 38386 type: "modal", 38387 applyLabel: openAs.applyLabel?.trim() || (0, import_i18n50.__)("Apply"), 38388 cancelLabel: openAs.cancelLabel?.trim() || (0, import_i18n50.__)("Cancel") 38389 }; 38390 } else if (openAs === "modal") { 38391 normalizedOpenAs = { 38392 type: "modal", 38393 applyLabel: (0, import_i18n50.__)("Apply"), 38394 cancelLabel: (0, import_i18n50.__)("Cancel") 38395 }; 38396 } else { 38397 normalizedOpenAs = { type: "dropdown" }; 38398 } 38399 normalizedLayout = { 38400 type: "panel", 38401 labelPosition: layout?.labelPosition ?? "side", 38402 openAs: normalizedOpenAs, 38403 summary: normalizedSummary, 38404 editVisibility: layout?.editVisibility ?? "on-hover" 38405 }; 38406 } else if (layout?.type === "card") { 38407 if (layout.withHeader === false) { 38408 normalizedLayout = { 38409 type: "card", 38410 withHeader: false, 38411 isOpened: true, 38412 summary: [], 38413 isCollapsible: false 38414 }; 38415 } else { 38416 const summary = layout.summary ?? []; 38417 normalizedLayout = { 38418 type: "card", 38419 withHeader: true, 38420 isOpened: typeof layout.isOpened === "boolean" ? layout.isOpened : true, 38421 summary: normalizeCardSummaryField(summary), 38422 isCollapsible: layout.isCollapsible === void 0 ? true : layout.isCollapsible 38423 }; 38424 } 38425 } else if (layout?.type === "row") { 38426 normalizedLayout = { 38427 type: "row", 38428 alignment: layout?.alignment ?? "center", 38429 styles: layout?.styles ?? {} 38430 }; 38431 } else if (layout?.type === "details") { 38432 normalizedLayout = { 38433 type: "details", 38434 summary: layout?.summary ?? "" 38435 }; 38436 } 38437 return normalizedLayout; 38438 } 38439 function normalizeForm(form2) { 38440 const normalizedFormLayout = normalizeLayout(form2?.layout); 38441 const normalizedFields = (form2.fields ?? []).map( 38442 (field) => { 38443 if (typeof field === "string") { 38444 return { 38445 id: field, 38446 layout: normalizedFormLayout 38447 }; 38448 } 38449 const fieldLayout = field.layout ? normalizeLayout(field.layout) : normalizedFormLayout; 38450 return { 38451 id: field.id, 38452 layout: fieldLayout, 38453 ...!!field.label && { label: field.label }, 38454 ...!!field.description && { 38455 description: field.description 38456 }, 38457 ..."children" in field && Array.isArray(field.children) && { 38458 children: normalizeForm({ 38459 fields: field.children, 38460 layout: DEFAULT_LAYOUT 38461 }).fields 38462 } 38463 }; 38464 } 38465 ); 38466 return { 38467 layout: normalizedFormLayout, 38468 fields: normalizedFields 38469 }; 38470 } 38471 var normalize_form_default = normalizeForm; 38472 38473 // packages/dataviews/build-module/components/dataform-layouts/regular/index.mjs 38474 var import_jsx_runtime188 = __toESM(require_jsx_runtime(), 1); 38475 function Header6({ title }) { 38476 return /* @__PURE__ */ (0, import_jsx_runtime188.jsx)( 38477 Stack, 38478 { 38479 direction: "column", 38480 className: "dataforms-layouts-regular__header", 38481 gap: "lg", 38482 children: /* @__PURE__ */ (0, import_jsx_runtime188.jsx)(Stack, { direction: "row", align: "center", children: /* @__PURE__ */ (0, import_jsx_runtime188.jsx)(import_components46.__experimentalHeading, { level: 2, size: 13, children: title }) }) 38483 } 38484 ); 38485 } 38486 function FormRegularField({ 38487 data, 38488 field, 38489 onChange, 38490 hideLabelFromVision, 38491 markWhenOptional, 38492 validity 38493 }) { 38494 const { fields: fields3 } = (0, import_element145.useContext)(dataform_context_default); 38495 const layout = field.layout; 38496 const form2 = (0, import_element145.useMemo)( 38497 () => ({ 38498 layout: DEFAULT_LAYOUT, 38499 fields: !!field.children ? field.children : [] 38500 }), 38501 [field] 38502 ); 38503 if (!!field.children) { 38504 return /* @__PURE__ */ (0, import_jsx_runtime188.jsxs)(import_jsx_runtime188.Fragment, { children: [ 38505 !hideLabelFromVision && field.label && /* @__PURE__ */ (0, import_jsx_runtime188.jsx)(Header6, { title: field.label }), 38506 /* @__PURE__ */ (0, import_jsx_runtime188.jsx)( 38507 DataFormLayout, 38508 { 38509 data, 38510 form: form2, 38511 onChange, 38512 validity: validity?.children 38513 } 38514 ) 38515 ] }); 38516 } 38517 const labelPosition = layout.labelPosition; 38518 const fieldDefinition = fields3.find( 38519 (fieldDef) => fieldDef.id === field.id 38520 ); 38521 if (!fieldDefinition || !fieldDefinition.Edit) { 38522 return null; 38523 } 38524 if (labelPosition === "side") { 38525 return /* @__PURE__ */ (0, import_jsx_runtime188.jsxs)( 38526 Stack, 38527 { 38528 direction: "row", 38529 className: "dataforms-layouts-regular__field", 38530 gap: "sm", 38531 children: [ 38532 /* @__PURE__ */ (0, import_jsx_runtime188.jsx)( 38533 "div", 38534 { 38535 className: clsx_default( 38536 "dataforms-layouts-regular__field-label", 38537 `dataforms-layouts-regular__field-label--label-position-$labelPosition}` 38538 ), 38539 children: /* @__PURE__ */ (0, import_jsx_runtime188.jsx)(import_components46.BaseControl.VisualLabel, { children: fieldDefinition.label }) 38540 } 38541 ), 38542 /* @__PURE__ */ (0, import_jsx_runtime188.jsx)("div", { className: "dataforms-layouts-regular__field-control", children: fieldDefinition.readOnly === true ? /* @__PURE__ */ (0, import_jsx_runtime188.jsx)( 38543 fieldDefinition.render, 38544 { 38545 item: data, 38546 field: fieldDefinition 38547 } 38548 ) : /* @__PURE__ */ (0, import_jsx_runtime188.jsx)( 38549 fieldDefinition.Edit, 38550 { 38551 data, 38552 field: fieldDefinition, 38553 onChange, 38554 hideLabelFromVision: true, 38555 markWhenOptional, 38556 validity 38557 }, 38558 fieldDefinition.id 38559 ) }) 38560 ] 38561 } 38562 ); 38563 } 38564 return /* @__PURE__ */ (0, import_jsx_runtime188.jsx)("div", { className: "dataforms-layouts-regular__field", children: fieldDefinition.readOnly === true ? /* @__PURE__ */ (0, import_jsx_runtime188.jsx)(import_jsx_runtime188.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime188.jsxs)(import_jsx_runtime188.Fragment, { children: [ 38565 !hideLabelFromVision && labelPosition !== "none" && /* @__PURE__ */ (0, import_jsx_runtime188.jsx)(import_components46.BaseControl.VisualLabel, { children: fieldDefinition.label }), 38566 /* @__PURE__ */ (0, import_jsx_runtime188.jsx)( 38567 fieldDefinition.render, 38568 { 38569 item: data, 38570 field: fieldDefinition 38571 } 38572 ) 38573 ] }) }) : /* @__PURE__ */ (0, import_jsx_runtime188.jsx)( 38574 fieldDefinition.Edit, 38575 { 38576 data, 38577 field: fieldDefinition, 38578 onChange, 38579 hideLabelFromVision: labelPosition === "none" ? true : hideLabelFromVision, 38580 markWhenOptional, 38581 validity 38582 } 38583 ) }); 38584 } 38585 38586 // packages/dataviews/build-module/components/dataform-layouts/panel/modal.mjs 38587 var import_deepmerge2 = __toESM(require_cjs(), 1); 38588 var import_components49 = __toESM(require_components(), 1); 38589 var import_element150 = __toESM(require_element(), 1); 38590 var import_compose21 = __toESM(require_compose(), 1); 38591 38592 // packages/dataviews/build-module/components/dataform-layouts/panel/summary-button.mjs 38593 var import_components48 = __toESM(require_components(), 1); 38594 var import_i18n51 = __toESM(require_i18n(), 1); 38595 var import_compose20 = __toESM(require_compose(), 1); 38596 var import_element146 = __toESM(require_element(), 1); 38597 38598 // packages/dataviews/build-module/components/dataform-layouts/panel/utils/get-label-classname.mjs 38599 function getLabelClassName(labelPosition, showError) { 38600 return clsx_default( 38601 "dataforms-layouts-panel__field-label", 38602 `dataforms-layouts-panel__field-label--label-position-$labelPosition}`, 38603 { "has-error": showError } 38604 ); 38605 } 38606 var get_label_classname_default = getLabelClassName; 38607 38608 // packages/dataviews/build-module/components/dataform-layouts/panel/utils/get-label-content.mjs 38609 var import_components47 = __toESM(require_components(), 1); 38610 var import_jsx_runtime189 = __toESM(require_jsx_runtime(), 1); 38611 function getLabelContent(showError, errorMessage, fieldLabel) { 38612 return showError ? /* @__PURE__ */ (0, import_jsx_runtime189.jsxs)(tooltip_exports.Root, { children: [ 38613 /* @__PURE__ */ (0, import_jsx_runtime189.jsx)( 38614 tooltip_exports.Trigger, 38615 { 38616 render: /* @__PURE__ */ (0, import_jsx_runtime189.jsxs)("span", { className: "dataforms-layouts-panel__field-label-error-content", children: [ 38617 /* @__PURE__ */ (0, import_jsx_runtime189.jsx)(import_components47.Icon, { icon: error_default, size: 16 }), 38618 /* @__PURE__ */ (0, import_jsx_runtime189.jsxs)(VisuallyHidden, { children: [ 38619 errorMessage, 38620 ": " 38621 ] }), 38622 fieldLabel 38623 ] }) 38624 } 38625 ), 38626 /* @__PURE__ */ (0, import_jsx_runtime189.jsx)(tooltip_exports.Popup, { children: errorMessage }) 38627 ] }) : fieldLabel; 38628 } 38629 var get_label_content_default = getLabelContent; 38630 38631 // packages/dataviews/build-module/components/dataform-layouts/panel/utils/get-first-validation-error.mjs 38632 function getFirstValidationError(validity) { 38633 if (!validity) { 38634 return void 0; 38635 } 38636 const validityRules = Object.keys(validity).filter( 38637 (key2) => key2 !== "children" 38638 ); 38639 for (const key2 of validityRules) { 38640 const rule = validity[key2]; 38641 if (rule === void 0) { 38642 continue; 38643 } 38644 if (rule.type === "invalid") { 38645 if (rule.message) { 38646 return rule.message; 38647 } 38648 if (key2 === "required") { 38649 return "A required field is empty"; 38650 } 38651 return "Unidentified validation error"; 38652 } 38653 } 38654 if (validity.children) { 38655 for (const childValidity of Object.values(validity.children)) { 38656 const childError = getFirstValidationError(childValidity); 38657 if (childError) { 38658 return childError; 38659 } 38660 } 38661 } 38662 return void 0; 38663 } 38664 var get_first_validation_error_default = getFirstValidationError; 38665 38666 // packages/dataviews/build-module/components/dataform-layouts/panel/summary-button.mjs 38667 var import_jsx_runtime190 = __toESM(require_jsx_runtime(), 1); 38668 function SummaryButton({ 38669 data, 38670 field, 38671 fieldLabel, 38672 summaryFields, 38673 validity, 38674 touched, 38675 disabled: disabled2, 38676 onClick, 38677 "aria-expanded": ariaExpanded 38678 }) { 38679 const { labelPosition, editVisibility } = field.layout; 38680 const errorMessage = get_first_validation_error_default(validity); 38681 const showError = touched && !!errorMessage; 38682 const labelClassName = get_label_classname_default(labelPosition, showError); 38683 const labelContent = get_label_content_default(showError, errorMessage, fieldLabel); 38684 const className = clsx_default( 38685 "dataforms-layouts-panel__field-trigger", 38686 `dataforms-layouts-panel__field-trigger--label-$labelPosition}`, 38687 { 38688 "is-disabled": disabled2, 38689 "dataforms-layouts-panel__field-trigger--edit-always": editVisibility === "always" 38690 } 38691 ); 38692 const controlId = (0, import_compose20.useInstanceId)( 38693 SummaryButton, 38694 "dataforms-layouts-panel__field-control" 38695 ); 38696 const ariaLabel = showError ? (0, import_i18n51.sprintf)( 38697 // translators: %s: Field name. 38698 (0, import_i18n51._x)("Edit %s (has errors)", "field"), 38699 fieldLabel || "" 38700 ) : (0, import_i18n51.sprintf)( 38701 // translators: %s: Field name. 38702 (0, import_i18n51._x)("Edit %s", "field"), 38703 fieldLabel || "" 38704 ); 38705 const rowRef = (0, import_element146.useRef)(null); 38706 const handleRowClick = () => { 38707 const selection = rowRef.current?.ownerDocument.defaultView?.getSelection(); 38708 if (selection && selection.toString().length > 0) { 38709 return; 38710 } 38711 onClick(); 38712 }; 38713 const handleKeyDown = (event) => { 38714 if (event.target === event.currentTarget && (event.key === "Enter" || event.key === " ")) { 38715 event.preventDefault(); 38716 onClick(); 38717 } 38718 }; 38719 return /* @__PURE__ */ (0, import_jsx_runtime190.jsxs)( 38720 "div", 38721 { 38722 ref: rowRef, 38723 className, 38724 onClick: !disabled2 ? handleRowClick : void 0, 38725 onKeyDown: !disabled2 ? handleKeyDown : void 0, 38726 children: [ 38727 labelPosition !== "none" && /* @__PURE__ */ (0, import_jsx_runtime190.jsx)("span", { className: labelClassName, children: labelContent }), 38728 labelPosition === "none" && showError && /* @__PURE__ */ (0, import_jsx_runtime190.jsxs)(tooltip_exports.Root, { children: [ 38729 /* @__PURE__ */ (0, import_jsx_runtime190.jsx)( 38730 tooltip_exports.Trigger, 38731 { 38732 render: /* @__PURE__ */ (0, import_jsx_runtime190.jsx)( 38733 "span", 38734 { 38735 className: "dataforms-layouts-panel__field-label-error-content", 38736 role: "img", 38737 "aria-label": errorMessage, 38738 children: /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(import_components48.Icon, { icon: error_default, size: 16 }) 38739 } 38740 ) 38741 } 38742 ), 38743 /* @__PURE__ */ (0, import_jsx_runtime190.jsx)(tooltip_exports.Popup, { children: errorMessage }) 38744 ] }), 38745 /* @__PURE__ */ (0, import_jsx_runtime190.jsx)( 38746 "span", 38747 { 38748 id: `$controlId}`, 38749 className: "dataforms-layouts-panel__field-control", 38750 children: summaryFields.length > 1 ? /* @__PURE__ */ (0, import_jsx_runtime190.jsx)( 38751 "span", 38752 { 38753 style: { 38754 display: "flex", 38755 flexDirection: "column", 38756 alignItems: "flex-start", 38757 width: "100%", 38758 gap: "2px" 38759 }, 38760 children: summaryFields.map((summaryField) => /* @__PURE__ */ (0, import_jsx_runtime190.jsx)( 38761 "span", 38762 { 38763 style: { width: "100%" }, 38764 children: /* @__PURE__ */ (0, import_jsx_runtime190.jsx)( 38765 summaryField.render, 38766 { 38767 item: data, 38768 field: summaryField 38769 } 38770 ) 38771 }, 38772 summaryField.id 38773 )) 38774 } 38775 ) : summaryFields.map((summaryField) => /* @__PURE__ */ (0, import_jsx_runtime190.jsx)( 38776 summaryField.render, 38777 { 38778 item: data, 38779 field: summaryField 38780 }, 38781 summaryField.id 38782 )) 38783 } 38784 ), 38785 !disabled2 && /* @__PURE__ */ (0, import_jsx_runtime190.jsx)( 38786 import_components48.Button, 38787 { 38788 className: "dataforms-layouts-panel__field-trigger-icon", 38789 label: ariaLabel, 38790 icon: pencil_default, 38791 size: "small", 38792 "aria-expanded": ariaExpanded, 38793 "aria-haspopup": "dialog", 38794 "aria-describedby": `$controlId}` 38795 } 38796 ) 38797 ] 38798 } 38799 ); 38800 } 38801 38802 // packages/dataviews/build-module/hooks/use-form-validity.mjs 38803 var import_deepmerge = __toESM(require_cjs(), 1); 38804 var import_es64 = __toESM(require_es6(), 1); 38805 var import_element147 = __toESM(require_element(), 1); 38806 var import_i18n52 = __toESM(require_i18n(), 1); 38807 function isFormValid(formValidity) { 38808 if (!formValidity) { 38809 return true; 38810 } 38811 return Object.values(formValidity).every((fieldValidation) => { 38812 return Object.entries(fieldValidation).every( 38813 ([key2, validation]) => { 38814 if (key2 === "children" && validation && typeof validation === "object") { 38815 return isFormValid(validation); 38816 } 38817 return validation.type !== "invalid" && validation.type !== "validating"; 38818 } 38819 ); 38820 }); 38821 } 38822 function getFormFieldsToValidate(form2, fields3) { 38823 const normalizedForm = normalize_form_default(form2); 38824 if (normalizedForm.fields.length === 0) { 38825 return []; 38826 } 38827 const fieldsMap = /* @__PURE__ */ new Map(); 38828 fields3.forEach((field) => { 38829 fieldsMap.set(field.id, field); 38830 }); 38831 function processFormField(formField) { 38832 if ("children" in formField && Array.isArray(formField.children)) { 38833 const processedChildren = formField.children.map(processFormField).filter((child) => child !== null); 38834 if (processedChildren.length === 0) { 38835 return null; 38836 } 38837 const fieldDef2 = fieldsMap.get(formField.id); 38838 if (fieldDef2) { 38839 const [normalizedField2] = normalizeFields([ 38840 fieldDef2 38841 ]); 38842 return { 38843 id: formField.id, 38844 children: processedChildren, 38845 field: normalizedField2 38846 }; 38847 } 38848 return { 38849 id: formField.id, 38850 children: processedChildren 38851 }; 38852 } 38853 const fieldDef = fieldsMap.get(formField.id); 38854 if (!fieldDef) { 38855 return null; 38856 } 38857 const [normalizedField] = normalizeFields([fieldDef]); 38858 return { 38859 id: formField.id, 38860 children: [], 38861 field: normalizedField 38862 }; 38863 } 38864 const toValidate = normalizedForm.fields.map(processFormField).filter((field) => field !== null); 38865 return toValidate; 38866 } 38867 function setValidityAtPath(formValidity, fieldValidity, path) { 38868 if (!formValidity) { 38869 formValidity = {}; 38870 } 38871 if (path.length === 0) { 38872 return formValidity; 38873 } 38874 const result = { ...formValidity }; 38875 let current = result; 38876 for (let i2 = 0; i2 < path.length - 1; i2++) { 38877 const segment = path[i2]; 38878 if (!current[segment]) { 38879 current[segment] = {}; 38880 } 38881 current[segment] = { ...current[segment] }; 38882 current = current[segment]; 38883 } 38884 const finalKey = path[path.length - 1]; 38885 current[finalKey] = { 38886 ...current[finalKey] || {}, 38887 ...fieldValidity 38888 }; 38889 return result; 38890 } 38891 function removeValidationProperty(formValidity, path, property) { 38892 if (!formValidity || path.length === 0) { 38893 return formValidity; 38894 } 38895 const result = { ...formValidity }; 38896 let current = result; 38897 for (let i2 = 0; i2 < path.length - 1; i2++) { 38898 const segment = path[i2]; 38899 if (!current[segment]) { 38900 return formValidity; 38901 } 38902 current[segment] = { ...current[segment] }; 38903 current = current[segment]; 38904 } 38905 const finalKey = path[path.length - 1]; 38906 if (!current[finalKey]) { 38907 return formValidity; 38908 } 38909 const fieldValidity = { ...current[finalKey] }; 38910 delete fieldValidity[property]; 38911 if (Object.keys(fieldValidity).length === 0) { 38912 delete current[finalKey]; 38913 } else { 38914 current[finalKey] = fieldValidity; 38915 } 38916 if (Object.keys(result).length === 0) { 38917 return void 0; 38918 } 38919 return result; 38920 } 38921 function handleElementsValidationAsync(promise, formField, promiseHandler) { 38922 const { elementsCounterRef, setFormValidity, path, item } = promiseHandler; 38923 const currentToken = (elementsCounterRef.current[formField.id] || 0) + 1; 38924 elementsCounterRef.current[formField.id] = currentToken; 38925 promise.then((result) => { 38926 if (currentToken !== elementsCounterRef.current[formField.id]) { 38927 return; 38928 } 38929 if (!Array.isArray(result)) { 38930 setFormValidity((prev) => { 38931 const newFormValidity = setValidityAtPath( 38932 prev, 38933 { 38934 elements: { 38935 type: "invalid", 38936 message: (0, import_i18n52.__)("Could not validate elements.") 38937 } 38938 }, 38939 [...path, formField.id] 38940 ); 38941 return newFormValidity; 38942 }); 38943 return; 38944 } 38945 if (formField.field?.isValid.elements && !formField.field.isValid.elements.validate(item, { 38946 ...formField.field, 38947 elements: result 38948 })) { 38949 setFormValidity((prev) => { 38950 const newFormValidity = setValidityAtPath( 38951 prev, 38952 { 38953 elements: { 38954 type: "invalid", 38955 message: (0, import_i18n52.__)( 38956 "Value must be one of the elements." 38957 ) 38958 } 38959 }, 38960 [...path, formField.id] 38961 ); 38962 return newFormValidity; 38963 }); 38964 } else { 38965 setFormValidity((prev) => { 38966 return removeValidationProperty( 38967 prev, 38968 [...path, formField.id], 38969 "elements" 38970 ); 38971 }); 38972 } 38973 }).catch((error2) => { 38974 if (currentToken !== elementsCounterRef.current[formField.id]) { 38975 return; 38976 } 38977 let errorMessage; 38978 if (error2 instanceof Error) { 38979 errorMessage = error2.message; 38980 } else { 38981 errorMessage = String(error2) || (0, import_i18n52.__)( 38982 "Unknown error when running elements validation asynchronously." 38983 ); 38984 } 38985 setFormValidity((prev) => { 38986 const newFormValidity = setValidityAtPath( 38987 prev, 38988 { 38989 elements: { 38990 type: "invalid", 38991 message: errorMessage 38992 } 38993 }, 38994 [...path, formField.id] 38995 ); 38996 return newFormValidity; 38997 }); 38998 }); 38999 } 39000 function handleCustomValidationAsync(promise, formField, promiseHandler) { 39001 const { customCounterRef, setFormValidity, path } = promiseHandler; 39002 const currentToken = (customCounterRef.current[formField.id] || 0) + 1; 39003 customCounterRef.current[formField.id] = currentToken; 39004 promise.then((result) => { 39005 if (currentToken !== customCounterRef.current[formField.id]) { 39006 return; 39007 } 39008 if (result === null) { 39009 setFormValidity((prev) => { 39010 return removeValidationProperty( 39011 prev, 39012 [...path, formField.id], 39013 "custom" 39014 ); 39015 }); 39016 return; 39017 } 39018 if (typeof result === "string") { 39019 setFormValidity((prev) => { 39020 const newFormValidity = setValidityAtPath( 39021 prev, 39022 { 39023 custom: { 39024 type: "invalid", 39025 message: result 39026 } 39027 }, 39028 [...path, formField.id] 39029 ); 39030 return newFormValidity; 39031 }); 39032 return; 39033 } 39034 setFormValidity((prev) => { 39035 const newFormValidity = setValidityAtPath( 39036 prev, 39037 { 39038 custom: { 39039 type: "invalid", 39040 message: (0, import_i18n52.__)("Validation could not be processed.") 39041 } 39042 }, 39043 [...path, formField.id] 39044 ); 39045 return newFormValidity; 39046 }); 39047 }).catch((error2) => { 39048 if (currentToken !== customCounterRef.current[formField.id]) { 39049 return; 39050 } 39051 let errorMessage; 39052 if (error2 instanceof Error) { 39053 errorMessage = error2.message; 39054 } else { 39055 errorMessage = String(error2) || (0, import_i18n52.__)( 39056 "Unknown error when running custom validation asynchronously." 39057 ); 39058 } 39059 setFormValidity((prev) => { 39060 const newFormValidity = setValidityAtPath( 39061 prev, 39062 { 39063 custom: { 39064 type: "invalid", 39065 message: errorMessage 39066 } 39067 }, 39068 [...path, formField.id] 39069 ); 39070 return newFormValidity; 39071 }); 39072 }); 39073 } 39074 function validateFormField(item, formField, promiseHandler) { 39075 if (formField.field?.isValid.required && !formField.field.isValid.required.validate(item, formField.field)) { 39076 return { 39077 required: { type: "invalid" } 39078 }; 39079 } 39080 if (formField.field?.isValid.pattern && !formField.field.isValid.pattern.validate(item, formField.field)) { 39081 return { 39082 pattern: { 39083 type: "invalid", 39084 message: (0, import_i18n52.__)("Value does not match the required pattern.") 39085 } 39086 }; 39087 } 39088 if (formField.field?.isValid.min && !formField.field.isValid.min.validate(item, formField.field)) { 39089 return { 39090 min: { 39091 type: "invalid", 39092 message: (0, import_i18n52.__)("Value is below the minimum.") 39093 } 39094 }; 39095 } 39096 if (formField.field?.isValid.max && !formField.field.isValid.max.validate(item, formField.field)) { 39097 return { 39098 max: { 39099 type: "invalid", 39100 message: (0, import_i18n52.__)("Value is above the maximum.") 39101 } 39102 }; 39103 } 39104 if (formField.field?.isValid.minLength && !formField.field.isValid.minLength.validate(item, formField.field)) { 39105 return { 39106 minLength: { 39107 type: "invalid", 39108 message: (0, import_i18n52.__)("Value is too short.") 39109 } 39110 }; 39111 } 39112 if (formField.field?.isValid.maxLength && !formField.field.isValid.maxLength.validate(item, formField.field)) { 39113 return { 39114 maxLength: { 39115 type: "invalid", 39116 message: (0, import_i18n52.__)("Value is too long.") 39117 } 39118 }; 39119 } 39120 if (formField.field?.isValid.elements && formField.field.hasElements && !formField.field.getElements && Array.isArray(formField.field.elements) && !formField.field.isValid.elements.validate(item, formField.field)) { 39121 return { 39122 elements: { 39123 type: "invalid", 39124 message: (0, import_i18n52.__)("Value must be one of the elements.") 39125 } 39126 }; 39127 } 39128 let customError; 39129 if (!!formField.field && formField.field.isValid.custom) { 39130 try { 39131 const value = formField.field.getValue({ item }); 39132 customError = formField.field.isValid.custom( 39133 (0, import_deepmerge.default)( 39134 item, 39135 formField.field.setValue({ 39136 item, 39137 value 39138 }) 39139 ), 39140 formField.field 39141 ); 39142 } catch (error2) { 39143 let errorMessage; 39144 if (error2 instanceof Error) { 39145 errorMessage = error2.message; 39146 } else { 39147 errorMessage = String(error2) || (0, import_i18n52.__)("Unknown error when running custom validation."); 39148 } 39149 return { 39150 custom: { 39151 type: "invalid", 39152 message: errorMessage 39153 } 39154 }; 39155 } 39156 } 39157 if (typeof customError === "string") { 39158 return { 39159 custom: { 39160 type: "invalid", 39161 message: customError 39162 } 39163 }; 39164 } 39165 const fieldValidity = {}; 39166 if (!!formField.field && formField.field.isValid.elements && formField.field.hasElements && typeof formField.field.getElements === "function") { 39167 handleElementsValidationAsync( 39168 formField.field.getElements(), 39169 formField, 39170 promiseHandler 39171 ); 39172 fieldValidity.elements = { 39173 type: "validating", 39174 message: (0, import_i18n52.__)("Validating\u2026") 39175 }; 39176 } 39177 if (customError instanceof Promise) { 39178 handleCustomValidationAsync(customError, formField, promiseHandler); 39179 fieldValidity.custom = { 39180 type: "validating", 39181 message: (0, import_i18n52.__)("Validating\u2026") 39182 }; 39183 } 39184 if (Object.keys(fieldValidity).length > 0) { 39185 return fieldValidity; 39186 } 39187 if (formField.children.length > 0) { 39188 const result = {}; 39189 formField.children.forEach((child) => { 39190 result[child.id] = validateFormField(item, child, { 39191 ...promiseHandler, 39192 path: [...promiseHandler.path, formField.id, "children"] 39193 }); 39194 }); 39195 const filteredResult = {}; 39196 Object.entries(result).forEach(([key2, value]) => { 39197 if (value !== void 0) { 39198 filteredResult[key2] = value; 39199 } 39200 }); 39201 if (Object.keys(filteredResult).length === 0) { 39202 return void 0; 39203 } 39204 return { 39205 children: filteredResult 39206 }; 39207 } 39208 return void 0; 39209 } 39210 function getFormFieldValue(formField, item) { 39211 const fieldValue = formField?.field?.getValue({ item }); 39212 if (formField.children.length === 0) { 39213 return fieldValue; 39214 } 39215 const childrenValues = formField.children.map( 39216 (child) => getFormFieldValue(child, item) 39217 ); 39218 if (!childrenValues) { 39219 return fieldValue; 39220 } 39221 return { 39222 value: fieldValue, 39223 children: childrenValues 39224 }; 39225 } 39226 function useFormValidity(item, fields3, form2) { 39227 const [formValidity, setFormValidity] = (0, import_element147.useState)(); 39228 const customCounterRef = (0, import_element147.useRef)({}); 39229 const elementsCounterRef = (0, import_element147.useRef)({}); 39230 const previousValuesRef = (0, import_element147.useRef)({}); 39231 const validate = (0, import_element147.useCallback)(() => { 39232 const promiseHandler = { 39233 customCounterRef, 39234 elementsCounterRef, 39235 setFormValidity, 39236 path: [], 39237 item 39238 }; 39239 const formFieldsToValidate = getFormFieldsToValidate(form2, fields3); 39240 if (formFieldsToValidate.length === 0) { 39241 setFormValidity(void 0); 39242 return; 39243 } 39244 const newFormValidity = {}; 39245 const untouchedFields = []; 39246 formFieldsToValidate.forEach((formField) => { 39247 const value = getFormFieldValue(formField, item); 39248 if (previousValuesRef.current.hasOwnProperty(formField.id) && (0, import_es64.default)( 39249 previousValuesRef.current[formField.id], 39250 value 39251 )) { 39252 untouchedFields.push(formField.id); 39253 return; 39254 } 39255 previousValuesRef.current[formField.id] = value; 39256 const fieldValidity = validateFormField( 39257 item, 39258 formField, 39259 promiseHandler 39260 ); 39261 if (fieldValidity !== void 0) { 39262 newFormValidity[formField.id] = fieldValidity; 39263 } 39264 }); 39265 setFormValidity((existingFormValidity) => { 39266 let validity = { 39267 ...existingFormValidity, 39268 ...newFormValidity 39269 }; 39270 const fieldsToKeep = [ 39271 ...untouchedFields, 39272 ...Object.keys(newFormValidity) 39273 ]; 39274 Object.keys(validity).forEach((key2) => { 39275 if (validity && !fieldsToKeep.includes(key2)) { 39276 delete validity[key2]; 39277 } 39278 }); 39279 if (Object.keys(validity).length === 0) { 39280 validity = void 0; 39281 } 39282 const areEqual = (0, import_es64.default)(existingFormValidity, validity); 39283 if (areEqual) { 39284 return existingFormValidity; 39285 } 39286 return validity; 39287 }); 39288 }, [item, fields3, form2]); 39289 (0, import_element147.useEffect)(() => { 39290 validate(); 39291 }, [validate]); 39292 return { 39293 validity: formValidity, 39294 isValid: isFormValid(formValidity) 39295 }; 39296 } 39297 var use_form_validity_default = useFormValidity; 39298 39299 // packages/dataviews/build-module/hooks/use-report-validity.mjs 39300 var import_element148 = __toESM(require_element(), 1); 39301 function useReportValidity(ref, shouldReport) { 39302 (0, import_element148.useEffect)(() => { 39303 if (shouldReport && ref.current) { 39304 const inputs = ref.current.querySelectorAll( 39305 "input, textarea, select" 39306 ); 39307 inputs.forEach((input) => { 39308 input.reportValidity(); 39309 }); 39310 } 39311 }, [shouldReport, ref]); 39312 } 39313 39314 // packages/dataviews/build-module/components/dataform-layouts/panel/utils/use-field-from-form-field.mjs 39315 var import_element149 = __toESM(require_element(), 1); 39316 39317 // packages/dataviews/build-module/components/dataform-layouts/get-summary-fields.mjs 39318 function extractSummaryIds(summary) { 39319 if (Array.isArray(summary)) { 39320 return summary.map( 39321 (item) => typeof item === "string" ? item : item.id 39322 ); 39323 } 39324 return []; 39325 } 39326 var getSummaryFields = (summaryField, fields3) => { 39327 if (Array.isArray(summaryField) && summaryField.length > 0) { 39328 const summaryIds = extractSummaryIds(summaryField); 39329 return summaryIds.map( 39330 (summaryId) => fields3.find((_field) => _field.id === summaryId) 39331 ).filter((_field) => _field !== void 0); 39332 } 39333 return []; 39334 }; 39335 39336 // packages/dataviews/build-module/components/dataform-layouts/panel/utils/use-field-from-form-field.mjs 39337 var getFieldDefinition = (field, fields3) => { 39338 const fieldDefinition = fields3.find((_field) => _field.id === field.id); 39339 if (!fieldDefinition) { 39340 return fields3.find((_field) => { 39341 if (!!field.children) { 39342 const simpleChildren = field.children.filter( 39343 (child) => !child.children 39344 ); 39345 if (simpleChildren.length === 0) { 39346 return false; 39347 } 39348 return _field.id === simpleChildren[0].id; 39349 } 39350 return _field.id === field.id; 39351 }); 39352 } 39353 return fieldDefinition; 39354 }; 39355 function useFieldFromFormField(field) { 39356 const { fields: fields3 } = (0, import_element149.useContext)(dataform_context_default); 39357 const layout = field.layout; 39358 const summaryFields = getSummaryFields(layout.summary, fields3); 39359 const fieldDefinition = getFieldDefinition(field, fields3); 39360 const fieldLabel = !!field.children ? field.label : fieldDefinition?.label; 39361 if (summaryFields.length === 0) { 39362 return { 39363 summaryFields: fieldDefinition ? [fieldDefinition] : [], 39364 fieldDefinition, 39365 fieldLabel 39366 }; 39367 } 39368 return { 39369 summaryFields, 39370 fieldDefinition, 39371 fieldLabel 39372 }; 39373 } 39374 var use_field_from_form_field_default = useFieldFromFormField; 39375 39376 // packages/dataviews/build-module/components/dataform-layouts/panel/modal.mjs 39377 var import_jsx_runtime191 = __toESM(require_jsx_runtime(), 1); 39378 function ModalContent({ 39379 data, 39380 field, 39381 onChange, 39382 fieldLabel, 39383 onClose, 39384 touched 39385 }) { 39386 const { openAs } = field.layout; 39387 const { applyLabel, cancelLabel } = openAs; 39388 const { fields: fields3 } = (0, import_element150.useContext)(dataform_context_default); 39389 const [changes, setChanges] = (0, import_element150.useState)({}); 39390 const modalData = (0, import_element150.useMemo)(() => { 39391 return (0, import_deepmerge2.default)(data, changes, { 39392 arrayMerge: (target, source) => source 39393 }); 39394 }, [data, changes]); 39395 const form2 = (0, import_element150.useMemo)( 39396 () => ({ 39397 layout: DEFAULT_LAYOUT, 39398 fields: !!field.children ? field.children : ( 39399 // If not explicit children return the field id itself. 39400 [{ id: field.id, layout: DEFAULT_LAYOUT }] 39401 ) 39402 }), 39403 [field] 39404 ); 39405 const fieldsAsFieldType = fields3.map((f2) => ({ 39406 ...f2, 39407 Edit: f2.Edit === null ? void 0 : f2.Edit, 39408 isValid: { 39409 required: f2.isValid.required?.constraint, 39410 elements: f2.isValid.elements?.constraint, 39411 min: f2.isValid.min?.constraint, 39412 max: f2.isValid.max?.constraint, 39413 pattern: f2.isValid.pattern?.constraint, 39414 minLength: f2.isValid.minLength?.constraint, 39415 maxLength: f2.isValid.maxLength?.constraint 39416 } 39417 })); 39418 const { validity } = use_form_validity_default(modalData, fieldsAsFieldType, form2); 39419 const onApply = () => { 39420 onChange(changes); 39421 onClose(); 39422 }; 39423 const handleOnChange = (newValue) => { 39424 setChanges( 39425 (prev) => (0, import_deepmerge2.default)(prev, newValue, { 39426 arrayMerge: (target, source) => source 39427 }) 39428 ); 39429 }; 39430 const focusOnMountRef = (0, import_compose21.useFocusOnMount)("firstInputElement"); 39431 const contentRef = (0, import_element150.useRef)(null); 39432 const mergedRef = (0, import_compose21.useMergeRefs)([focusOnMountRef, contentRef]); 39433 useReportValidity(contentRef, touched); 39434 return /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)( 39435 import_components49.Modal, 39436 { 39437 className: "dataforms-layouts-panel__modal", 39438 onRequestClose: onClose, 39439 isFullScreen: false, 39440 title: fieldLabel, 39441 size: "medium", 39442 children: [ 39443 /* @__PURE__ */ (0, import_jsx_runtime191.jsx)("div", { ref: mergedRef, children: /* @__PURE__ */ (0, import_jsx_runtime191.jsx)( 39444 DataFormLayout, 39445 { 39446 data: modalData, 39447 form: form2, 39448 onChange: handleOnChange, 39449 validity, 39450 children: (FieldLayout, childField, childFieldValidity, markWhenOptional) => /* @__PURE__ */ (0, import_jsx_runtime191.jsx)( 39451 FieldLayout, 39452 { 39453 data: modalData, 39454 field: childField, 39455 onChange: handleOnChange, 39456 hideLabelFromVision: form2.fields.length < 2, 39457 markWhenOptional, 39458 validity: childFieldValidity 39459 }, 39460 childField.id 39461 ) 39462 } 39463 ) }), 39464 /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)( 39465 Stack, 39466 { 39467 direction: "row", 39468 className: "dataforms-layouts-panel__modal-footer", 39469 gap: "md", 39470 children: [ 39471 /* @__PURE__ */ (0, import_jsx_runtime191.jsx)(import_components49.__experimentalSpacer, { style: { flex: 1 } }), 39472 /* @__PURE__ */ (0, import_jsx_runtime191.jsx)( 39473 import_components49.Button, 39474 { 39475 variant: "tertiary", 39476 onClick: onClose, 39477 __next40pxDefaultSize: true, 39478 children: cancelLabel 39479 } 39480 ), 39481 /* @__PURE__ */ (0, import_jsx_runtime191.jsx)( 39482 import_components49.Button, 39483 { 39484 variant: "primary", 39485 onClick: onApply, 39486 __next40pxDefaultSize: true, 39487 children: applyLabel 39488 } 39489 ) 39490 ] 39491 } 39492 ) 39493 ] 39494 } 39495 ); 39496 } 39497 function PanelModal({ 39498 data, 39499 field, 39500 onChange, 39501 validity 39502 }) { 39503 const [touched, setTouched] = (0, import_element150.useState)(false); 39504 const [isOpen, setIsOpen] = (0, import_element150.useState)(false); 39505 const { fieldDefinition, fieldLabel, summaryFields } = use_field_from_form_field_default(field); 39506 if (!fieldDefinition) { 39507 return null; 39508 } 39509 const handleClose = () => { 39510 setIsOpen(false); 39511 setTouched(true); 39512 }; 39513 return /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)(import_jsx_runtime191.Fragment, { children: [ 39514 /* @__PURE__ */ (0, import_jsx_runtime191.jsx)( 39515 SummaryButton, 39516 { 39517 data, 39518 field, 39519 fieldLabel, 39520 summaryFields, 39521 validity, 39522 touched, 39523 disabled: fieldDefinition.readOnly === true, 39524 onClick: () => setIsOpen(true), 39525 "aria-expanded": isOpen 39526 } 39527 ), 39528 isOpen && /* @__PURE__ */ (0, import_jsx_runtime191.jsx)( 39529 ModalContent, 39530 { 39531 data, 39532 field, 39533 onChange, 39534 fieldLabel: fieldLabel ?? "", 39535 onClose: handleClose, 39536 touched 39537 } 39538 ) 39539 ] }); 39540 } 39541 var modal_default = PanelModal; 39542 39543 // packages/dataviews/build-module/components/dataform-layouts/panel/dropdown.mjs 39544 var import_components50 = __toESM(require_components(), 1); 39545 var import_i18n53 = __toESM(require_i18n(), 1); 39546 var import_element151 = __toESM(require_element(), 1); 39547 var import_compose22 = __toESM(require_compose(), 1); 39548 var import_jsx_runtime192 = __toESM(require_jsx_runtime(), 1); 39549 function DropdownHeader({ 39550 title, 39551 onClose 39552 }) { 39553 return /* @__PURE__ */ (0, import_jsx_runtime192.jsx)( 39554 Stack, 39555 { 39556 direction: "column", 39557 className: "dataforms-layouts-panel__dropdown-header", 39558 gap: "lg", 39559 children: /* @__PURE__ */ (0, import_jsx_runtime192.jsxs)(Stack, { direction: "row", gap: "sm", align: "center", children: [ 39560 title && /* @__PURE__ */ (0, import_jsx_runtime192.jsx)(import_components50.__experimentalHeading, { level: 2, size: 13, children: title }), 39561 /* @__PURE__ */ (0, import_jsx_runtime192.jsx)(import_components50.__experimentalSpacer, { style: { flex: 1 } }), 39562 onClose && /* @__PURE__ */ (0, import_jsx_runtime192.jsx)( 39563 import_components50.Button, 39564 { 39565 label: (0, import_i18n53.__)("Close"), 39566 icon: close_small_default, 39567 onClick: onClose, 39568 size: "small" 39569 } 39570 ) 39571 ] }) 39572 } 39573 ); 39574 } 39575 function DropdownContentWithValidation({ 39576 touched, 39577 children 39578 }) { 39579 const ref = (0, import_element151.useRef)(null); 39580 useReportValidity(ref, touched); 39581 return /* @__PURE__ */ (0, import_jsx_runtime192.jsx)("div", { ref, children }); 39582 } 39583 function PanelDropdown({ 39584 data, 39585 field, 39586 onChange, 39587 validity 39588 }) { 39589 const [touched, setTouched] = (0, import_element151.useState)(false); 39590 const [popoverAnchor, setPopoverAnchor] = (0, import_element151.useState)( 39591 null 39592 ); 39593 const popoverProps = (0, import_element151.useMemo)( 39594 () => ({ 39595 // Anchor the popover to the middle of the entire row so that it doesn't 39596 // move around when the label changes. 39597 anchor: popoverAnchor, 39598 placement: "left-start", 39599 offset: 36, 39600 shift: true 39601 }), 39602 [popoverAnchor] 39603 ); 39604 const [dialogRef, dialogProps] = (0, import_compose22.__experimentalUseDialog)({ 39605 focusOnMount: "firstInputElement" 39606 }); 39607 const form2 = (0, import_element151.useMemo)( 39608 () => ({ 39609 layout: DEFAULT_LAYOUT, 39610 fields: !!field.children ? field.children : ( 39611 // If not explicit children return the field id itself. 39612 [{ id: field.id, layout: DEFAULT_LAYOUT }] 39613 ) 39614 }), 39615 [field] 39616 ); 39617 const formValidity = (0, import_element151.useMemo)(() => { 39618 if (validity === void 0) { 39619 return void 0; 39620 } 39621 if (!!field.children) { 39622 return validity?.children; 39623 } 39624 return { [field.id]: validity }; 39625 }, [validity, field]); 39626 const { fieldDefinition, fieldLabel, summaryFields } = use_field_from_form_field_default(field); 39627 if (!fieldDefinition) { 39628 return null; 39629 } 39630 return /* @__PURE__ */ (0, import_jsx_runtime192.jsx)( 39631 "div", 39632 { 39633 ref: setPopoverAnchor, 39634 className: "dataforms-layouts-panel__field-dropdown-anchor", 39635 children: /* @__PURE__ */ (0, import_jsx_runtime192.jsx)( 39636 import_components50.Dropdown, 39637 { 39638 contentClassName: "dataforms-layouts-panel__field-dropdown", 39639 popoverProps, 39640 focusOnMount: false, 39641 onToggle: (willOpen) => { 39642 if (!willOpen) { 39643 setTouched(true); 39644 } 39645 }, 39646 renderToggle: ({ isOpen, onToggle }) => /* @__PURE__ */ (0, import_jsx_runtime192.jsx)( 39647 SummaryButton, 39648 { 39649 data, 39650 field, 39651 fieldLabel, 39652 summaryFields, 39653 validity, 39654 touched, 39655 disabled: fieldDefinition.readOnly === true, 39656 onClick: onToggle, 39657 "aria-expanded": isOpen 39658 } 39659 ), 39660 renderContent: ({ onClose }) => /* @__PURE__ */ (0, import_jsx_runtime192.jsx)(DropdownContentWithValidation, { touched, children: /* @__PURE__ */ (0, import_jsx_runtime192.jsxs)("div", { ref: dialogRef, ...dialogProps, children: [ 39661 /* @__PURE__ */ (0, import_jsx_runtime192.jsx)( 39662 DropdownHeader, 39663 { 39664 title: fieldLabel, 39665 onClose 39666 } 39667 ), 39668 /* @__PURE__ */ (0, import_jsx_runtime192.jsx)( 39669 DataFormLayout, 39670 { 39671 data, 39672 form: form2, 39673 onChange, 39674 validity: formValidity, 39675 children: (FieldLayout, childField, childFieldValidity, markWhenOptional) => /* @__PURE__ */ (0, import_jsx_runtime192.jsx)( 39676 FieldLayout, 39677 { 39678 data, 39679 field: childField, 39680 onChange, 39681 hideLabelFromVision: (form2?.fields ?? []).length < 2, 39682 markWhenOptional, 39683 validity: childFieldValidity 39684 }, 39685 childField.id 39686 ) 39687 } 39688 ) 39689 ] }) }) 39690 } 39691 ) 39692 } 39693 ); 39694 } 39695 var dropdown_default = PanelDropdown; 39696 39697 // packages/dataviews/build-module/components/dataform-layouts/panel/index.mjs 39698 var import_jsx_runtime193 = __toESM(require_jsx_runtime(), 1); 39699 function FormPanelField({ 39700 data, 39701 field, 39702 onChange, 39703 validity 39704 }) { 39705 const layout = field.layout; 39706 if (layout.openAs.type === "modal") { 39707 return /* @__PURE__ */ (0, import_jsx_runtime193.jsx)( 39708 modal_default, 39709 { 39710 data, 39711 field, 39712 onChange, 39713 validity 39714 } 39715 ); 39716 } 39717 return /* @__PURE__ */ (0, import_jsx_runtime193.jsx)( 39718 dropdown_default, 39719 { 39720 data, 39721 field, 39722 onChange, 39723 validity 39724 } 39725 ); 39726 } 39727 39728 // packages/dataviews/build-module/components/dataform-layouts/card/index.mjs 39729 var import_element152 = __toESM(require_element(), 1); 39730 39731 // packages/dataviews/build-module/components/dataform-layouts/validation-badge.mjs 39732 var import_i18n54 = __toESM(require_i18n(), 1); 39733 var import_jsx_runtime194 = __toESM(require_jsx_runtime(), 1); 39734 function countInvalidFields(validity) { 39735 if (!validity) { 39736 return 0; 39737 } 39738 let count = 0; 39739 const validityRules = Object.keys(validity).filter( 39740 (key2) => key2 !== "children" 39741 ); 39742 for (const key2 of validityRules) { 39743 const rule = validity[key2]; 39744 if (rule?.type === "invalid") { 39745 count++; 39746 } 39747 } 39748 if (validity.children) { 39749 for (const childValidity of Object.values(validity.children)) { 39750 count += countInvalidFields(childValidity); 39751 } 39752 } 39753 return count; 39754 } 39755 function ValidationBadge({ 39756 validity 39757 }) { 39758 const invalidCount = countInvalidFields(validity); 39759 if (invalidCount === 0) { 39760 return null; 39761 } 39762 return /* @__PURE__ */ (0, import_jsx_runtime194.jsx)(Badge, { intent: "high", children: (0, import_i18n54.sprintf)( 39763 /* translators: %d: Number of fields that need attention */ 39764 (0, import_i18n54._n)( 39765 "%d field needs attention", 39766 "%d fields need attention", 39767 invalidCount 39768 ), 39769 invalidCount 39770 ) }); 39771 } 39772 39773 // packages/dataviews/build-module/components/dataform-layouts/card/index.mjs 39774 var import_jsx_runtime195 = __toESM(require_jsx_runtime(), 1); 39775 function isSummaryFieldVisible(summaryField, summaryConfig, isOpen) { 39776 if (!summaryConfig || Array.isArray(summaryConfig) && summaryConfig.length === 0) { 39777 return false; 39778 } 39779 const summaryConfigArray = Array.isArray(summaryConfig) ? summaryConfig : [summaryConfig]; 39780 const fieldConfig = summaryConfigArray.find((config) => { 39781 if (typeof config === "string") { 39782 return config === summaryField.id; 39783 } 39784 if (typeof config === "object" && "id" in config) { 39785 return config.id === summaryField.id; 39786 } 39787 return false; 39788 }); 39789 if (!fieldConfig) { 39790 return false; 39791 } 39792 if (typeof fieldConfig === "string") { 39793 return true; 39794 } 39795 if (typeof fieldConfig === "object" && "visibility" in fieldConfig) { 39796 return fieldConfig.visibility === "always" || fieldConfig.visibility === "when-collapsed" && !isOpen; 39797 } 39798 return true; 39799 } 39800 function HeaderContent({ 39801 data, 39802 fields: fields3, 39803 label, 39804 layout, 39805 isOpen, 39806 touched, 39807 validity 39808 }) { 39809 const summaryFields = getSummaryFields(layout.summary, fields3); 39810 const visibleSummaryFields = summaryFields.filter( 39811 (summaryField) => isSummaryFieldVisible(summaryField, layout.summary, isOpen) 39812 ); 39813 const hasBadge = touched && layout.isCollapsible; 39814 const hasSummary = visibleSummaryFields.length > 0 && layout.withHeader; 39815 return /* @__PURE__ */ (0, import_jsx_runtime195.jsxs)( 39816 Stack, 39817 { 39818 align: "center", 39819 justify: "space-between", 39820 className: "dataforms-layouts-card__field-header-content", 39821 children: [ 39822 /* @__PURE__ */ (0, import_jsx_runtime195.jsx)(card_exports.Title, { children: label }), 39823 (hasBadge || hasSummary) && /* @__PURE__ */ (0, import_jsx_runtime195.jsxs)(collapsible_card_exports.HeaderDescription, { className: "dataforms-layouts-card__field-header-content-description", children: [ 39824 hasBadge && /* @__PURE__ */ (0, import_jsx_runtime195.jsx)(ValidationBadge, { validity }), 39825 hasSummary && /* @__PURE__ */ (0, import_jsx_runtime195.jsx)("div", { className: "dataforms-layouts-card__field-summary", children: visibleSummaryFields.map((summaryField) => /* @__PURE__ */ (0, import_jsx_runtime195.jsx)( 39826 summaryField.render, 39827 { 39828 item: data, 39829 field: summaryField 39830 }, 39831 summaryField.id 39832 )) }) 39833 ] }) 39834 ] 39835 } 39836 ); 39837 } 39838 function BodyContent({ 39839 data, 39840 field, 39841 form: form2, 39842 onChange, 39843 hideLabelFromVision, 39844 markWhenOptional, 39845 validity, 39846 withHeader 39847 }) { 39848 if (field.children) { 39849 return /* @__PURE__ */ (0, import_jsx_runtime195.jsxs)(import_jsx_runtime195.Fragment, { children: [ 39850 field.description && /* @__PURE__ */ (0, import_jsx_runtime195.jsx)("div", { className: "dataforms-layouts-card__field-description", children: field.description }), 39851 /* @__PURE__ */ (0, import_jsx_runtime195.jsx)( 39852 DataFormLayout, 39853 { 39854 data, 39855 form: form2, 39856 onChange, 39857 validity: validity?.children 39858 } 39859 ) 39860 ] }); 39861 } 39862 const SingleFieldLayout = getFormFieldLayout("regular")?.component; 39863 if (!SingleFieldLayout) { 39864 return null; 39865 } 39866 return /* @__PURE__ */ (0, import_jsx_runtime195.jsx)( 39867 SingleFieldLayout, 39868 { 39869 data, 39870 field, 39871 onChange, 39872 hideLabelFromVision: hideLabelFromVision || withHeader, 39873 markWhenOptional, 39874 validity 39875 } 39876 ); 39877 } 39878 function FormCardField({ 39879 data, 39880 field, 39881 onChange, 39882 hideLabelFromVision, 39883 markWhenOptional, 39884 validity 39885 }) { 39886 const { fields: fields3 } = (0, import_element152.useContext)(dataform_context_default); 39887 const layout = field.layout; 39888 const contentRef = (0, import_element152.useRef)(null); 39889 const form2 = (0, import_element152.useMemo)( 39890 () => ({ 39891 layout: DEFAULT_LAYOUT, 39892 fields: field.children ?? [] 39893 }), 39894 [field] 39895 ); 39896 const { isOpened, isCollapsible } = layout; 39897 const [isOpen, setIsOpen] = (0, import_element152.useState)(isOpened); 39898 const [touched, setTouched] = (0, import_element152.useState)(false); 39899 (0, import_element152.useEffect)(() => { 39900 setIsOpen(isOpened); 39901 }, [isOpened]); 39902 const handleOpenChange = (0, import_element152.useCallback)((open) => { 39903 if (!open) { 39904 setTouched(true); 39905 } 39906 setIsOpen(open); 39907 }, []); 39908 const handleBlur = (0, import_element152.useCallback)(() => { 39909 setTouched(true); 39910 }, []); 39911 useReportValidity( 39912 contentRef, 39913 (isCollapsible ? isOpen : true) && touched 39914 ); 39915 let label = field.label; 39916 let withHeader; 39917 if (field.children) { 39918 withHeader = !!label && layout.withHeader; 39919 } else { 39920 const fieldDefinition = fields3.find( 39921 (fieldDef) => fieldDef.id === field.id 39922 ); 39923 if (!fieldDefinition || !fieldDefinition.Edit) { 39924 return null; 39925 } 39926 label = fieldDefinition.label; 39927 withHeader = !!label && layout.withHeader; 39928 } 39929 const bodyContent = /* @__PURE__ */ (0, import_jsx_runtime195.jsx)( 39930 BodyContent, 39931 { 39932 data, 39933 field, 39934 form: form2, 39935 onChange, 39936 hideLabelFromVision, 39937 markWhenOptional, 39938 validity, 39939 withHeader 39940 } 39941 ); 39942 const headerContent = /* @__PURE__ */ (0, import_jsx_runtime195.jsx)( 39943 HeaderContent, 39944 { 39945 data, 39946 fields: fields3, 39947 label, 39948 layout, 39949 isOpen: isCollapsible ? !!isOpen : true, 39950 touched, 39951 validity 39952 } 39953 ); 39954 if (withHeader && isCollapsible) { 39955 return /* @__PURE__ */ (0, import_jsx_runtime195.jsxs)( 39956 collapsible_card_exports.Root, 39957 { 39958 className: "dataforms-layouts-card__field", 39959 open: isOpen, 39960 onOpenChange: handleOpenChange, 39961 children: [ 39962 /* @__PURE__ */ (0, import_jsx_runtime195.jsx)(collapsible_card_exports.Header, { children: headerContent }), 39963 /* @__PURE__ */ (0, import_jsx_runtime195.jsx)( 39964 collapsible_card_exports.Content, 39965 { 39966 ref: contentRef, 39967 onBlur: handleBlur, 39968 children: bodyContent 39969 } 39970 ) 39971 ] 39972 } 39973 ); 39974 } 39975 return /* @__PURE__ */ (0, import_jsx_runtime195.jsxs)(card_exports.Root, { className: "dataforms-layouts-card__field", children: [ 39976 withHeader && /* @__PURE__ */ (0, import_jsx_runtime195.jsx)(card_exports.Header, { children: headerContent }), 39977 /* @__PURE__ */ (0, import_jsx_runtime195.jsx)(card_exports.Content, { ref: contentRef, onBlur: handleBlur, children: bodyContent }) 39978 ] }); 39979 } 39980 39981 // packages/dataviews/build-module/components/dataform-layouts/row/index.mjs 39982 var import_components51 = __toESM(require_components(), 1); 39983 var import_jsx_runtime196 = __toESM(require_jsx_runtime(), 1); 39984 function Header7({ title }) { 39985 return /* @__PURE__ */ (0, import_jsx_runtime196.jsx)( 39986 Stack, 39987 { 39988 direction: "column", 39989 className: "dataforms-layouts-row__header", 39990 gap: "lg", 39991 children: /* @__PURE__ */ (0, import_jsx_runtime196.jsx)(Stack, { direction: "row", align: "center", children: /* @__PURE__ */ (0, import_jsx_runtime196.jsx)(import_components51.__experimentalHeading, { level: 2, size: 13, children: title }) }) 39992 } 39993 ); 39994 } 39995 var EMPTY_WRAPPER = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime196.jsx)(import_jsx_runtime196.Fragment, { children }); 39996 function FormRowField({ 39997 data, 39998 field, 39999 onChange, 40000 hideLabelFromVision, 40001 markWhenOptional, 40002 validity 40003 }) { 40004 const layout = field.layout; 40005 if (!!field.children) { 40006 const form2 = { 40007 layout: DEFAULT_LAYOUT, 40008 fields: field.children 40009 }; 40010 return /* @__PURE__ */ (0, import_jsx_runtime196.jsxs)("div", { className: "dataforms-layouts-row__field", children: [ 40011 !hideLabelFromVision && field.label && /* @__PURE__ */ (0, import_jsx_runtime196.jsx)(Header7, { title: field.label }), 40012 /* @__PURE__ */ (0, import_jsx_runtime196.jsx)(Stack, { direction: "row", align: layout.alignment, gap: "lg", children: /* @__PURE__ */ (0, import_jsx_runtime196.jsx)( 40013 DataFormLayout, 40014 { 40015 data, 40016 form: form2, 40017 onChange, 40018 validity: validity?.children, 40019 as: EMPTY_WRAPPER, 40020 children: (FieldLayout, childField, childFieldValidity) => /* @__PURE__ */ (0, import_jsx_runtime196.jsx)( 40021 "div", 40022 { 40023 className: "dataforms-layouts-row__field-control", 40024 style: layout.styles[childField.id], 40025 children: /* @__PURE__ */ (0, import_jsx_runtime196.jsx)( 40026 FieldLayout, 40027 { 40028 data, 40029 field: childField, 40030 onChange, 40031 hideLabelFromVision, 40032 markWhenOptional, 40033 validity: childFieldValidity 40034 } 40035 ) 40036 }, 40037 childField.id 40038 ) 40039 } 40040 ) }) 40041 ] }); 40042 } 40043 const RegularLayout = getFormFieldLayout("regular")?.component; 40044 if (!RegularLayout) { 40045 return null; 40046 } 40047 return /* @__PURE__ */ (0, import_jsx_runtime196.jsx)(import_jsx_runtime196.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime196.jsx)("div", { className: "dataforms-layouts-row__field-control", children: /* @__PURE__ */ (0, import_jsx_runtime196.jsx)( 40048 RegularLayout, 40049 { 40050 data, 40051 field, 40052 onChange, 40053 markWhenOptional, 40054 validity 40055 } 40056 ) }) }); 40057 } 40058 40059 // packages/dataviews/build-module/components/dataform-layouts/details/index.mjs 40060 var import_element153 = __toESM(require_element(), 1); 40061 var import_i18n55 = __toESM(require_i18n(), 1); 40062 var import_jsx_runtime197 = __toESM(require_jsx_runtime(), 1); 40063 function FormDetailsField({ 40064 data, 40065 field, 40066 onChange, 40067 validity 40068 }) { 40069 const { fields: fields3 } = (0, import_element153.useContext)(dataform_context_default); 40070 const detailsRef = (0, import_element153.useRef)(null); 40071 const contentRef = (0, import_element153.useRef)(null); 40072 const [touched, setTouched] = (0, import_element153.useState)(false); 40073 const [isOpen, setIsOpen] = (0, import_element153.useState)(false); 40074 const form2 = (0, import_element153.useMemo)( 40075 () => ({ 40076 layout: DEFAULT_LAYOUT, 40077 fields: field.children ?? [] 40078 }), 40079 [field] 40080 ); 40081 (0, import_element153.useEffect)(() => { 40082 const details = detailsRef.current; 40083 if (!details) { 40084 return; 40085 } 40086 const handleToggle = () => { 40087 const nowOpen = details.open; 40088 if (!nowOpen) { 40089 setTouched(true); 40090 } 40091 setIsOpen(nowOpen); 40092 }; 40093 details.addEventListener("toggle", handleToggle); 40094 return () => { 40095 details.removeEventListener("toggle", handleToggle); 40096 }; 40097 }, []); 40098 useReportValidity(contentRef, isOpen && touched); 40099 const handleBlur = (0, import_element153.useCallback)(() => { 40100 setTouched(true); 40101 }, []); 40102 if (!field.children) { 40103 return null; 40104 } 40105 const summaryFieldId = field.layout.summary ?? ""; 40106 const summaryField = summaryFieldId ? fields3.find((fieldDef) => fieldDef.id === summaryFieldId) : void 0; 40107 let summaryContent; 40108 if (summaryField && summaryField.render) { 40109 summaryContent = /* @__PURE__ */ (0, import_jsx_runtime197.jsx)(summaryField.render, { item: data, field: summaryField }); 40110 } else { 40111 summaryContent = field.label || (0, import_i18n55.__)("More details"); 40112 } 40113 return /* @__PURE__ */ (0, import_jsx_runtime197.jsxs)( 40114 "details", 40115 { 40116 ref: detailsRef, 40117 className: "dataforms-layouts-details__details", 40118 children: [ 40119 /* @__PURE__ */ (0, import_jsx_runtime197.jsx)("summary", { className: "dataforms-layouts-details__summary", children: /* @__PURE__ */ (0, import_jsx_runtime197.jsxs)( 40120 Stack, 40121 { 40122 direction: "row", 40123 align: "center", 40124 gap: "md", 40125 className: "dataforms-layouts-details__summary-content", 40126 children: [ 40127 summaryContent, 40128 touched && /* @__PURE__ */ (0, import_jsx_runtime197.jsx)(ValidationBadge, { validity }) 40129 ] 40130 } 40131 ) }), 40132 /* @__PURE__ */ (0, import_jsx_runtime197.jsx)( 40133 "div", 40134 { 40135 ref: contentRef, 40136 className: "dataforms-layouts-details__content", 40137 onBlur: handleBlur, 40138 children: /* @__PURE__ */ (0, import_jsx_runtime197.jsx)( 40139 DataFormLayout, 40140 { 40141 data, 40142 form: form2, 40143 onChange, 40144 validity: validity?.children 40145 } 40146 ) 40147 } 40148 ) 40149 ] 40150 } 40151 ); 40152 } 40153 40154 // packages/dataviews/build-module/components/dataform-layouts/index.mjs 40155 var import_jsx_runtime198 = __toESM(require_jsx_runtime(), 1); 40156 var FORM_FIELD_LAYOUTS = [ 40157 { 40158 type: "regular", 40159 component: FormRegularField, 40160 wrapper: ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime198.jsx)( 40161 Stack, 40162 { 40163 direction: "column", 40164 className: "dataforms-layouts__wrapper", 40165 gap: "lg", 40166 children 40167 } 40168 ) 40169 }, 40170 { 40171 type: "panel", 40172 component: FormPanelField, 40173 wrapper: ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime198.jsx)( 40174 Stack, 40175 { 40176 direction: "column", 40177 className: "dataforms-layouts__wrapper", 40178 gap: "md", 40179 children 40180 } 40181 ) 40182 }, 40183 { 40184 type: "card", 40185 component: FormCardField, 40186 wrapper: ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime198.jsx)( 40187 Stack, 40188 { 40189 direction: "column", 40190 className: "dataforms-layouts__wrapper", 40191 gap: "xl", 40192 children 40193 } 40194 ) 40195 }, 40196 { 40197 type: "row", 40198 component: FormRowField, 40199 wrapper: ({ 40200 children, 40201 layout 40202 }) => /* @__PURE__ */ (0, import_jsx_runtime198.jsx)( 40203 Stack, 40204 { 40205 direction: "column", 40206 className: "dataforms-layouts__wrapper", 40207 gap: "lg", 40208 children: /* @__PURE__ */ (0, import_jsx_runtime198.jsx)("div", { className: "dataforms-layouts-row__field", children: /* @__PURE__ */ (0, import_jsx_runtime198.jsx)( 40209 Stack, 40210 { 40211 direction: "row", 40212 gap: "lg", 40213 align: layout.alignment, 40214 children 40215 } 40216 ) }) 40217 } 40218 ) 40219 }, 40220 { 40221 type: "details", 40222 component: FormDetailsField 40223 } 40224 ]; 40225 function getFormFieldLayout(type) { 40226 return FORM_FIELD_LAYOUTS.find((layout) => layout.type === type); 40227 } 40228 40229 // packages/dataviews/build-module/components/dataform-layouts/data-form-layout.mjs 40230 var import_jsx_runtime199 = __toESM(require_jsx_runtime(), 1); 40231 var DEFAULT_WRAPPER = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime199.jsx)(Stack, { direction: "column", className: "dataforms-layouts__wrapper", gap: "lg", children }); 40232 function DataFormLayout({ 40233 data, 40234 form: form2, 40235 onChange, 40236 validity, 40237 children, 40238 as 40239 }) { 40240 const { fields: fieldDefinitions } = (0, import_element154.useContext)(dataform_context_default); 40241 const markWhenOptional = (0, import_element154.useMemo)(() => { 40242 const requiredCount = fieldDefinitions.filter( 40243 (f2) => !!f2.isValid?.required 40244 ).length; 40245 const optionalCount = fieldDefinitions.length - requiredCount; 40246 return requiredCount > optionalCount; 40247 }, [fieldDefinitions]); 40248 function getFieldDefinition2(field) { 40249 return fieldDefinitions.find( 40250 (fieldDefinition) => fieldDefinition.id === field.id 40251 ); 40252 } 40253 const Wrapper = as ?? getFormFieldLayout(form2.layout.type)?.wrapper ?? DEFAULT_WRAPPER; 40254 return /* @__PURE__ */ (0, import_jsx_runtime199.jsx)(Wrapper, { layout: form2.layout, children: form2.fields.map((formField) => { 40255 const FieldLayout = getFormFieldLayout(formField.layout.type)?.component; 40256 if (!FieldLayout) { 40257 return null; 40258 } 40259 const fieldDefinition = !formField.children ? getFieldDefinition2(formField) : void 0; 40260 if (fieldDefinition && fieldDefinition.isVisible && !fieldDefinition.isVisible(data)) { 40261 return null; 40262 } 40263 if (children) { 40264 return children( 40265 FieldLayout, 40266 formField, 40267 validity?.[formField.id], 40268 markWhenOptional 40269 ); 40270 } 40271 return /* @__PURE__ */ (0, import_jsx_runtime199.jsx)( 40272 FieldLayout, 40273 { 40274 data, 40275 field: formField, 40276 onChange, 40277 markWhenOptional, 40278 validity: validity?.[formField.id] 40279 }, 40280 formField.id 40281 ); 40282 }) }); 40283 } 40284 40285 // packages/dataviews/build-module/dataform/index.mjs 40286 var import_jsx_runtime200 = __toESM(require_jsx_runtime(), 1); 40287 function DataForm({ 40288 data, 40289 form: form2, 40290 fields: fields3, 40291 onChange, 40292 validity 40293 }) { 40294 const normalizedForm = (0, import_element155.useMemo)(() => normalize_form_default(form2), [form2]); 40295 const normalizedFields = (0, import_element155.useMemo)( 40296 () => normalizeFields(fields3), 40297 [fields3] 40298 ); 40299 if (!form2.fields) { 40300 return null; 40301 } 40302 return /* @__PURE__ */ (0, import_jsx_runtime200.jsx)(DataFormProvider, { fields: normalizedFields, children: /* @__PURE__ */ (0, import_jsx_runtime200.jsx)( 40303 DataFormLayout, 40304 { 40305 data, 40306 form: normalizedForm, 40307 onChange, 40308 validity 40309 } 40310 ) }); 40311 } 40312 40313 // packages/dataviews/build-module/utils/filter-sort-and-paginate.mjs 40314 var import_remove_accents2 = __toESM(require_remove_accents(), 1); 40315 var import_deprecated = __toESM(require_deprecated(), 1); 40316 function normalizeSearchInput2(input = "") { 40317 return (0, import_remove_accents2.default)(input.trim().toLowerCase()); 40318 } 40319 var EMPTY_ARRAY6 = []; 40320 function filterSortAndPaginate(data, view, fields3) { 40321 if (!data) { 40322 return { 40323 data: EMPTY_ARRAY6, 40324 paginationInfo: { totalItems: 0, totalPages: 0 } 40325 }; 40326 } 40327 const _fields = normalizeFields(fields3); 40328 let filteredData = [...data]; 40329 if (view.search) { 40330 const normalizedSearch = normalizeSearchInput2(view.search); 40331 filteredData = filteredData.filter((item) => { 40332 return _fields.filter((field) => field.enableGlobalSearch).some((field) => { 40333 const fieldValue = field.getValue({ item }); 40334 const values = Array.isArray(fieldValue) ? fieldValue : [fieldValue]; 40335 return values.some( 40336 (value) => normalizeSearchInput2(String(value)).includes( 40337 normalizedSearch 40338 ) 40339 ); 40340 }); 40341 }); 40342 } 40343 if (view.filters && view.filters?.length > 0) { 40344 view.filters.forEach((filter) => { 40345 const field = _fields.find( 40346 (_field) => _field.id === filter.field 40347 ); 40348 if (field) { 40349 if (filter.operator === OPERATOR_IS_NOT_ALL) { 40350 (0, import_deprecated.default)("The 'isNotAll' filter operator", { 40351 since: "7.0", 40352 alternative: "'isNone'" 40353 }); 40354 } 40355 const handler = field.filter[filter.operator]; 40356 if (handler) { 40357 filteredData = filteredData.filter( 40358 (item) => handler(item, field, filter.value) 40359 ); 40360 } 40361 } 40362 }); 40363 } 40364 const sortByField = view.sort?.field ? _fields.find((field) => { 40365 return field.enableSorting !== false && field.id === view.sort?.field; 40366 }) : null; 40367 const groupByField = view.groupBy?.field ? _fields.find((field) => { 40368 return field.enableSorting !== false && field.id === view.groupBy?.field; 40369 }) : null; 40370 if (sortByField || groupByField) { 40371 filteredData.sort((a2, b2) => { 40372 if (groupByField) { 40373 const groupCompare = groupByField.sort( 40374 a2, 40375 b2, 40376 view.groupBy?.direction ?? "asc" 40377 ); 40378 if (groupCompare !== 0) { 40379 return groupCompare; 40380 } 40381 } 40382 if (sortByField) { 40383 return sortByField.sort(a2, b2, view.sort?.direction ?? "desc"); 40384 } 40385 return 0; 40386 }); 40387 } 40388 let totalItems = filteredData.length; 40389 let totalPages = 1; 40390 if (view.infiniteScrollEnabled && view.startPosition !== void 0 && view.perPage !== void 0) { 40391 const start = view.startPosition - 1; 40392 const end = Math.min(start + view.perPage, totalItems); 40393 filteredData = filteredData?.slice(start, end); 40394 } else if (view.page !== void 0 && view.perPage !== void 0) { 40395 const start = (view.page - 1) * view.perPage; 40396 totalItems = filteredData?.length || 0; 40397 totalPages = Math.ceil(totalItems / view.perPage); 40398 filteredData = filteredData?.slice(start, start + view.perPage); 40399 } 40400 return { 40401 data: filteredData, 40402 paginationInfo: { 40403 totalItems, 40404 totalPages 40405 } 40406 }; 40407 } 40408 40409 // routes/dashboard/widget-dashboard/components/layout-settings/layout-settings.tsx 40410 var import_element157 = __toESM(require_element()); 40411 var import_i18n56 = __toESM(require_i18n()); 40412 40413 // routes/dashboard/widget-dashboard/components/layout-settings/layout-model-edit-field/index.tsx 40414 var import_element156 = __toESM(require_element()); 40415 40416 // routes/dashboard/widget-dashboard/components/layout-settings/layout-model-edit-field/thumbnail-grid.tsx 40417 var import_primitives37 = __toESM(require_primitives()); 40418 var import_jsx_runtime201 = __toESM(require_jsx_runtime()); 40419 function GridThumbnail({ 40420 className 40421 }) { 40422 return /* @__PURE__ */ (0, import_jsx_runtime201.jsxs)( 40423 import_primitives37.SVG, 40424 { 40425 className, 40426 viewBox: "0 0 40 24", 40427 fill: "currentColor", 40428 "aria-hidden": "true", 40429 children: [ 40430 /* @__PURE__ */ (0, import_jsx_runtime201.jsx)(import_primitives37.Rect, { x: "2", y: "1.25", width: "11", height: "10", rx: "1.5" }), 40431 /* @__PURE__ */ (0, import_jsx_runtime201.jsx)(import_primitives37.Rect, { x: "14.5", y: "1.25", width: "11", height: "10", rx: "1.5" }), 40432 /* @__PURE__ */ (0, import_jsx_runtime201.jsx)(import_primitives37.Rect, { x: "27", y: "1.25", width: "11", height: "10", rx: "1.5" }), 40433 /* @__PURE__ */ (0, import_jsx_runtime201.jsx)(import_primitives37.Rect, { x: "2", y: "12.75", width: "11", height: "10", rx: "1.5" }), 40434 /* @__PURE__ */ (0, import_jsx_runtime201.jsx)(import_primitives37.Rect, { x: "14.5", y: "12.75", width: "11", height: "10", rx: "1.5" }), 40435 /* @__PURE__ */ (0, import_jsx_runtime201.jsx)(import_primitives37.Rect, { x: "27", y: "12.75", width: "11", height: "10", rx: "1.5" }) 40436 ] 40437 } 40438 ); 40439 } 40440 40441 // routes/dashboard/widget-dashboard/components/layout-settings/layout-model-edit-field/thumbnail-masonry.tsx 40442 var import_primitives38 = __toESM(require_primitives()); 40443 var import_jsx_runtime202 = __toESM(require_jsx_runtime()); 40444 function MasonryThumbnail({ 40445 className 40446 }) { 40447 return /* @__PURE__ */ (0, import_jsx_runtime202.jsxs)( 40448 import_primitives38.SVG, 40449 { 40450 className, 40451 viewBox: "0 0 40 24", 40452 fill: "currentColor", 40453 "aria-hidden": "true", 40454 children: [ 40455 /* @__PURE__ */ (0, import_jsx_runtime202.jsx)(import_primitives38.Rect, { x: "2", y: "0.75", width: "11", height: "13", rx: "1.5" }), 40456 /* @__PURE__ */ (0, import_jsx_runtime202.jsx)(import_primitives38.Rect, { x: "2", y: "15.25", width: "11", height: "8", rx: "1.5" }), 40457 /* @__PURE__ */ (0, import_jsx_runtime202.jsx)(import_primitives38.Rect, { x: "14.5", y: "0.75", width: "11", height: "8", rx: "1.5" }), 40458 /* @__PURE__ */ (0, import_jsx_runtime202.jsx)(import_primitives38.Rect, { x: "14.5", y: "10.25", width: "11", height: "13", rx: "1.5" }), 40459 /* @__PURE__ */ (0, import_jsx_runtime202.jsx)(import_primitives38.Rect, { x: "27", y: "0.75", width: "11", height: "10", rx: "1.5" }), 40460 /* @__PURE__ */ (0, import_jsx_runtime202.jsx)(import_primitives38.Rect, { x: "27", y: "12.25", width: "11", height: "11", rx: "1.5" }) 40461 ] 40462 } 40463 ); 40464 } 40465 40466 // routes/dashboard/widget-dashboard/components/layout-settings/layout-model-edit-field/style.module.css 40467 if (typeof process === "undefined" || true) { 40468 registerStyle48("39847911c0", "._012a136bebacc789__option{background:#0000;border:var(--wpds-border-width-xs,1px) solid var(--wpds-color-stroke-surface-neutral,#dbdbdb);border-radius:var(--wpds-border-radius-md,4px);color:inherit;cursor:var(--wpds-cursor-control,pointer);flex:1;padding:var(--wpds-dimension-padding-md,12px);text-align:center;transition:border-color var(--wpds-motion-duration-sm,.1s) var(--wpds-motion-easing-subtle,cubic-bezier(.15,0,.15,1)),background-color var(--wpds-motion-duration-sm,.1s) var(--wpds-motion-easing-subtle,cubic-bezier(.15,0,.15,1))}._012a136bebacc789__option:hover{border-color:var(--wpds-color-stroke-surface-neutral-strong,#8d8d8d)}._59343eae03545c63__optionSelected,._59343eae03545c63__optionSelected:hover{background-color:color-mix(in srgb,var(--wpds-color-bg-surface-brand,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 9%,#fff)) 6%,#0000);border-color:var(--wpds-color-stroke-interactive-brand,var(--wp-admin-theme-color,#3858e9))}._46d8d9de106458f4__thumbnail{block-size:auto;color:var(--wpds-color-fg-content-neutral-weak,#707070);display:block;inline-size:100%}._59343eae03545c63__optionSelected ._46d8d9de106458f4__thumbnail{color:var(--wpds-color-fg-interactive-brand,var(--wp-admin-theme-color,#3858e9))}"); 40469 } 40470 var style_default45 = { "option": "_012a136bebacc789__option", "optionSelected": "_59343eae03545c63__optionSelected", "thumbnail": "_46d8d9de106458f4__thumbnail" }; 40471 40472 // routes/dashboard/widget-dashboard/components/layout-settings/layout-model-edit-field/index.tsx 40473 var import_jsx_runtime203 = __toESM(require_jsx_runtime()); 40474 function ModelThumbnail({ 40475 model, 40476 className 40477 }) { 40478 return model === "masonry" ? /* @__PURE__ */ (0, import_jsx_runtime203.jsx)(MasonryThumbnail, { className }) : /* @__PURE__ */ (0, import_jsx_runtime203.jsx)(GridThumbnail, { className }); 40479 } 40480 function LayoutModelEditField({ 40481 data, 40482 field, 40483 onChange 40484 }) { 40485 const { getValue, setValue, elements = [] } = field; 40486 const value = getValue({ item: data }); 40487 const disabled2 = field.isDisabled({ item: data, field }); 40488 const onSelect = (0, import_element156.useCallback)( 40489 (nextValue) => onChange(setValue({ item: data, value: nextValue })), 40490 [data, onChange, setValue] 40491 ); 40492 return /* @__PURE__ */ (0, import_jsx_runtime203.jsxs)(fieldset_exports.Root, { children: [ 40493 /* @__PURE__ */ (0, import_jsx_runtime203.jsx)(fieldset_exports.Legend, { children: field.label }), 40494 /* @__PURE__ */ (0, import_jsx_runtime203.jsx)(Stack, { direction: "row", gap: "md", role: "radiogroup", children: elements.map((option) => { 40495 const isSelected2 = value === option.value; 40496 return /* @__PURE__ */ (0, import_jsx_runtime203.jsx)( 40497 Button4, 40498 { 40499 variant: "unstyled", 40500 role: "radio", 40501 "aria-checked": isSelected2, 40502 disabled: disabled2, 40503 className: clsx_default(style_default45.option, { 40504 [style_default45.optionSelected]: isSelected2 40505 }), 40506 onClick: () => onSelect(option.value), 40507 children: /* @__PURE__ */ (0, import_jsx_runtime203.jsxs)(Stack, { direction: "column", gap: "sm", align: "stretch", children: [ 40508 /* @__PURE__ */ (0, import_jsx_runtime203.jsx)( 40509 ModelThumbnail, 40510 { 40511 model: String(option.value), 40512 className: style_default45.thumbnail 40513 } 40514 ), 40515 /* @__PURE__ */ (0, import_jsx_runtime203.jsx)(Text, { children: option.label }) 40516 ] }) 40517 }, 40518 String(option.value) 40519 ); 40520 }) }), 40521 typeof field.description === "string" && /* @__PURE__ */ (0, import_jsx_runtime203.jsx)(fieldset_exports.Description, { children: field.description }) 40522 ] }); 40523 } 40524 40525 // routes/dashboard/widget-dashboard/components/layout-settings/layout-settings.tsx 40526 var import_jsx_runtime204 = __toESM(require_jsx_runtime()); 40527 var DEFAULT_FIXED_COLUMNS2 = 6; 40528 var DEFAULT_MIN_COLUMN_WIDTH = 350; 40529 var DEFAULT_ROW_HEIGHT = 200; 40530 var ROW_HEIGHT_AUTO = "auto"; 40531 function getModel(item) { 40532 return item.model ?? "grid"; 40533 } 40534 function isMasonry(item) { 40535 return getModel(item) === "masonry"; 40536 } 40537 function getRowHeight(item) { 40538 if (isMasonry(item)) { 40539 return void 0; 40540 } 40541 return item.rowHeight; 40542 } 40543 function isAutoRowHeight(item) { 40544 return getRowHeight(item) === ROW_HEIGHT_AUTO; 40545 } 40546 function StepperIntegerEdit({ 40547 data, 40548 field, 40549 onChange 40550 }) { 40551 const { label, description, getValue, setValue, isValid: isValid2 } = field; 40552 const value = getValue({ item: data }); 40553 const disabled2 = field.isDisabled({ item: data, field }); 40554 const min2 = typeof isValid2.min?.constraint === "number" ? isValid2.min.constraint : void 0; 40555 const max2 = typeof isValid2.max?.constraint === "number" ? isValid2.max.constraint : void 0; 40556 return /* @__PURE__ */ (0, import_jsx_runtime204.jsx)( 40557 import_components52.__experimentalNumberControl, 40558 { 40559 __next40pxDefaultSize: true, 40560 label, 40561 help: description, 40562 value: value ?? "", 40563 min: min2, 40564 max: max2, 40565 step: 1, 40566 spinControls: "custom", 40567 disabled: disabled2, 40568 onChange: (next) => { 40569 const parsed = next === "" || next === void 0 ? void 0 : Number(next); 40570 onChange(setValue({ item: data, value: parsed })); 40571 } 40572 } 40573 ); 40574 } 40575 var fields = [ 40576 { 40577 id: "model", 40578 type: "text", 40579 Edit: LayoutModelEditField, 40580 label: (0, import_i18n56.__)("Layout model"), 40581 description: (0, import_i18n56.__)( 40582 "Grid keeps every tile the same height. Masonry lets tiles flow at their own height." 40583 ), 40584 elements: [ 40585 { value: "grid", label: (0, import_i18n56.__)("Standard grid") }, 40586 { value: "masonry", label: (0, import_i18n56.__)("Masonry") } 40587 ], 40588 getValue: ({ item }) => getModel(item) 40589 }, 40590 { 40591 id: "columns", 40592 type: "integer", 40593 Edit: StepperIntegerEdit, 40594 label: (0, import_i18n56.__)("Columns"), 40595 description: (0, import_i18n56.__)( 40596 "How many columns to show when the dashboard has enough space." 40597 ), 40598 isValid: { min: 1, max: 12 } 40599 }, 40600 { 40601 id: "adaptiveColumns", 40602 type: "boolean", 40603 Edit: "toggle", 40604 label: (0, import_i18n56.__)("Adjust on narrow screens"), 40605 description: (0, import_i18n56.__)( 40606 "Show fewer columns when the dashboard gets too narrow to keep tiles readable." 40607 ), 40608 getValue: ({ item }) => item.minColumnWidth !== 0, 40609 setValue: ({ item, value }) => { 40610 if (!value) { 40611 return { minColumnWidth: 0 }; 40612 } 40613 const previous = item.minColumnWidth; 40614 return { 40615 minColumnWidth: previous && previous > 0 ? previous : DEFAULT_MIN_COLUMN_WIDTH 40616 }; 40617 } 40618 }, 40619 { 40620 id: "minColumnWidth", 40621 type: "integer", 40622 Edit: StepperIntegerEdit, 40623 label: (0, import_i18n56.__)("Minimum tile width"), 40624 description: (0, import_i18n56.__)( 40625 "The smallest tile width before a column is removed." 40626 ), 40627 isValid: { min: 48, max: 600 }, 40628 isVisible: (item) => item.minColumnWidth !== 0 40629 }, 40630 { 40631 id: "autoRowHeight", 40632 type: "boolean", 40633 Edit: "toggle", 40634 label: (0, import_i18n56.__)("Auto-fit row height to content"), 40635 getValue: ({ item }) => isAutoRowHeight(item), 40636 setValue: ({ value }) => ({ 40637 rowHeight: value ? ROW_HEIGHT_AUTO : DEFAULT_ROW_HEIGHT 40638 }), 40639 isVisible: (item) => !isMasonry(item) 40640 }, 40641 { 40642 id: "rowHeight", 40643 type: "integer", 40644 Edit: StepperIntegerEdit, 40645 label: (0, import_i18n56.__)("Row height (px)"), 40646 description: (0, import_i18n56.__)("Height of each row in the standard grid."), 40647 isValid: { min: 100 }, 40648 getValue: ({ item }) => { 40649 const rh = getRowHeight(item); 40650 return typeof rh === "number" ? rh : void 0; 40651 }, 40652 isVisible: (item) => !isMasonry(item), 40653 isDisabled: ({ item }) => isAutoRowHeight(item) 40654 } 40655 ]; 40656 var form = { 40657 layout: { type: "regular", labelPosition: "top" }, 40658 fields: [ 40659 "model", 40660 "columns", 40661 "adaptiveColumns", 40662 "minColumnWidth", 40663 "autoRowHeight", 40664 "rowHeight" 40665 ] 40666 }; 40667 function LayoutSettings({ 40668 open, 40669 onOpenChange 40670 }) { 40671 const { 40672 gridSettings, 40673 onGridSettingsChange, 40674 layout, 40675 onLayoutChange, 40676 commit, 40677 cancel: cancelStaging, 40678 resetGridSettings, 40679 hasUncommittedChanges 40680 } = useDashboardInternalContext(); 40681 const handleChange = (0, import_element157.useCallback)( 40682 (edits) => { 40683 const nextModel = edits.model; 40684 const currentModel = getModel(gridSettings); 40685 if (nextModel && nextModel !== currentModel) { 40686 const migrated = migrateLayout( 40687 layout, 40688 currentModel, 40689 nextModel, 40690 { columns: gridSettings.columns ?? DEFAULT_FIXED_COLUMNS2 } 40691 ); 40692 onLayoutChange(migrated); 40693 } 40694 onGridSettingsChange({ 40695 ...gridSettings, 40696 ...edits 40697 }); 40698 }, 40699 [gridSettings, layout, onGridSettingsChange, onLayoutChange] 40700 ); 40701 const handleCancel = (0, import_element157.useCallback)(() => { 40702 cancelStaging({ exitEditMode: false }); 40703 onOpenChange(false); 40704 }, [cancelStaging, onOpenChange]); 40705 const handleSave = (0, import_element157.useCallback)(() => { 40706 commit({ exitEditMode: false }); 40707 onOpenChange(false); 40708 }, [commit, onOpenChange]); 40709 const handleOpenChange = (0, import_element157.useCallback)( 40710 (nextOpen) => { 40711 if (!nextOpen && open) { 40712 cancelStaging({ exitEditMode: false }); 40713 } 40714 onOpenChange(nextOpen); 40715 }, 40716 [open, cancelStaging, onOpenChange] 40717 ); 40718 return /* @__PURE__ */ (0, import_jsx_runtime204.jsx)( 40719 drawer_exports.Root, 40720 { 40721 open, 40722 onOpenChange: handleOpenChange, 40723 swipeDirection: "right", 40724 modal: false, 40725 disablePointerDismissal: true, 40726 children: /* @__PURE__ */ (0, import_jsx_runtime204.jsxs)(drawer_exports.Popup, { size: "medium", style: { marginTop: "32px" }, children: [ 40727 /* @__PURE__ */ (0, import_jsx_runtime204.jsxs)(drawer_exports.Header, { children: [ 40728 /* @__PURE__ */ (0, import_jsx_runtime204.jsx)(drawer_exports.Title, { children: (0, import_i18n56.__)("Layout settings") }), 40729 /* @__PURE__ */ (0, import_jsx_runtime204.jsx)(drawer_exports.CloseIcon, {}) 40730 ] }), 40731 /* @__PURE__ */ (0, import_jsx_runtime204.jsx)(drawer_exports.Content, { children: /* @__PURE__ */ (0, import_jsx_runtime204.jsx)( 40732 DataForm, 40733 { 40734 data: gridSettings, 40735 fields, 40736 form, 40737 onChange: handleChange 40738 } 40739 ) }), 40740 /* @__PURE__ */ (0, import_jsx_runtime204.jsxs)(drawer_exports.Footer, { children: [ 40741 /* @__PURE__ */ (0, import_jsx_runtime204.jsx)( 40742 Button4, 40743 { 40744 variant: "minimal", 40745 tone: "neutral", 40746 size: "compact", 40747 onClick: resetGridSettings, 40748 style: { marginInlineEnd: "auto" }, 40749 children: (0, import_i18n56.__)("Reset") 40750 } 40751 ), 40752 /* @__PURE__ */ (0, import_jsx_runtime204.jsx)( 40753 Button4, 40754 { 40755 variant: "minimal", 40756 tone: "brand", 40757 size: "compact", 40758 onClick: handleCancel, 40759 children: (0, import_i18n56.__)("Cancel") 40760 } 40761 ), 40762 /* @__PURE__ */ (0, import_jsx_runtime204.jsx)( 40763 Button4, 40764 { 40765 variant: "solid", 40766 tone: "brand", 40767 size: "compact", 40768 onClick: handleSave, 40769 disabled: !hasUncommittedChanges, 40770 children: (0, import_i18n56.__)("Save") 40771 } 40772 ) 40773 ] }) 40774 ] }) 40775 } 40776 ); 40777 } 40778 40779 // routes/dashboard/widget-dashboard/components/more-actions-dropdown/more-actions-dropdown.tsx 40780 var import_components53 = __toESM(require_components()); 40781 var import_i18n57 = __toESM(require_i18n()); 40782 40783 // routes/dashboard/lock-unlock.ts 40784 var import_private_apis3 = __toESM(require_private_apis()); 40785 var { lock: lock3, unlock: unlock3 } = (0, import_private_apis3.__dangerousOptInToUnstableAPIsOnlyForCoreModules)( 40786 "I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.", 40787 "@wordpress/routes" 40788 ); 40789 40790 // routes/dashboard/widget-dashboard/components/more-actions-dropdown/more-actions-dropdown.tsx 40791 var import_jsx_runtime205 = __toESM(require_jsx_runtime()); 40792 var { Menu: Menu6 } = unlock3(import_components53.privateApis); 40793 function MoreActionsMenuItem({ item }) { 40794 const showDisabledTooltip = item.disabled && item.disabledTooltip; 40795 const menuItem = /* @__PURE__ */ (0, import_jsx_runtime205.jsx)( 40796 Menu6.Item, 40797 { 40798 disabled: item.disabled, 40799 onClick: item.onClick, 40800 render: /* @__PURE__ */ (0, import_jsx_runtime205.jsx)(Button4, { variant: "minimal", tone: "neutral" }), 40801 children: item.label 40802 } 40803 ); 40804 if (!showDisabledTooltip) { 40805 return menuItem; 40806 } 40807 return /* @__PURE__ */ (0, import_jsx_runtime205.jsxs)(tooltip_exports.Root, { children: [ 40808 /* @__PURE__ */ (0, import_jsx_runtime205.jsx)( 40809 tooltip_exports.Trigger, 40810 { 40811 render: /* @__PURE__ */ (0, import_jsx_runtime205.jsx)( 40812 Menu6.Item, 40813 { 40814 disabled: item.disabled, 40815 onClick: item.onClick, 40816 render: /* @__PURE__ */ (0, import_jsx_runtime205.jsx)(Button4, { variant: "minimal", tone: "neutral" }) 40817 } 40818 ), 40819 children: item.label 40820 } 40821 ), 40822 /* @__PURE__ */ (0, import_jsx_runtime205.jsx)(tooltip_exports.Popup, { positioner: /* @__PURE__ */ (0, import_jsx_runtime205.jsx)(tooltip_exports.Positioner, { side: "bottom" }), children: item.disabledTooltip }) 40823 ] }); 40824 } 40825 function MoreActionsDropdown({ 40826 items 40827 }) { 40828 if (items.length === 0) { 40829 return null; 40830 } 40831 return /* @__PURE__ */ (0, import_jsx_runtime205.jsxs)(Menu6, { children: [ 40832 /* @__PURE__ */ (0, import_jsx_runtime205.jsx)( 40833 Menu6.TriggerButton, 40834 { 40835 render: /* @__PURE__ */ (0, import_jsx_runtime205.jsx)( 40836 IconButton, 40837 { 40838 icon: more_vertical_default, 40839 label: (0, import_i18n57.__)("More options"), 40840 variant: "minimal", 40841 tone: "brand", 40842 size: "compact" 40843 } 40844 ) 40845 } 40846 ), 40847 /* @__PURE__ */ (0, import_jsx_runtime205.jsx)(Menu6.Popover, { children: /* @__PURE__ */ (0, import_jsx_runtime205.jsx)(tooltip_exports.Provider, { delay: 0, children: /* @__PURE__ */ (0, import_jsx_runtime205.jsx)(Menu6.Group, { children: items.map((item, index2) => /* @__PURE__ */ (0, import_jsx_runtime205.jsx)(MoreActionsMenuItem, { item }, index2)) }) }) }) 40848 ] }); 40849 } 40850 40851 // routes/dashboard/widget-dashboard/components/actions/actions.tsx 40852 var import_jsx_runtime206 = __toESM(require_jsx_runtime()); 40853 function Actions3() { 40854 const { 40855 editMode, 40856 onEditChange, 40857 onLayoutReset, 40858 commit, 40859 cancel: cancelStaging, 40860 hasUncommittedChanges, 40861 canEditGridSettings 40862 } = useDashboardInternalContext(); 40863 const [isEditActionsMounted, setIsEditActionsMounted] = (0, import_element158.useState)(editMode); 40864 const [isExitingEditActions, setIsExitingEditActions] = (0, import_element158.useState)(false); 40865 (0, import_element158.useEffect)(() => { 40866 if (editMode) { 40867 setIsEditActionsMounted(true); 40868 setIsExitingEditActions(false); 40869 return; 40870 } 40871 if (!isEditActionsMounted) { 40872 return; 40873 } 40874 setIsExitingEditActions(true); 40875 const exitTimeout = setTimeout(() => { 40876 setIsEditActionsMounted(false); 40877 setIsExitingEditActions(false); 40878 }, 220); 40879 return () => clearTimeout(exitTimeout); 40880 }, [editMode, isEditActionsMounted]); 40881 const { 40882 setInserterOpen, 40883 layoutSettingsOpen, 40884 setLayoutSettingsOpen, 40885 resetDialogOpen, 40886 setResetDialogOpen 40887 } = useDashboardUIContext(); 40888 const isMobileViewport = (0, import_data8.useSelect)( 40889 (select) => select(import_viewport.store).isViewportMatch("< small"), 40890 [] 40891 ); 40892 const handleEditMode = (0, import_element158.useCallback)(() => { 40893 onEditChange?.(!editMode); 40894 }, [editMode, onEditChange]); 40895 const insert = (0, import_element158.useCallback)(() => { 40896 setInserterOpen(true); 40897 }, [setInserterOpen]); 40898 const cancel = (0, import_element158.useCallback)(() => { 40899 cancelStaging(); 40900 }, [cancelStaging]); 40901 const done = (0, import_element158.useCallback)(() => { 40902 commit(); 40903 }, [commit]); 40904 const openLayoutSettings = (0, import_element158.useCallback)(() => { 40905 setLayoutSettingsOpen(true); 40906 }, [setLayoutSettingsOpen]); 40907 const moreActionsItems = [ 40908 { 40909 label: (0, import_i18n58.__)("Reset to default"), 40910 onClick: () => setResetDialogOpen(true), 40911 disabled: !onLayoutReset 40912 } 40913 ]; 40914 if (canEditGridSettings) { 40915 moreActionsItems.unshift({ 40916 label: (0, import_i18n58.__)("Layout settings"), 40917 onClick: openLayoutSettings, 40918 disabled: editMode, 40919 disabledTooltip: (0, import_i18n58.__)("Disabled while editing widgets") 40920 }); 40921 } 40922 if (!onEditChange) { 40923 return null; 40924 } 40925 return /* @__PURE__ */ (0, import_jsx_runtime206.jsxs)(Stack, { direction: "row", gap: "sm", children: [ 40926 isEditActionsMounted ? /* @__PURE__ */ (0, import_jsx_runtime206.jsxs)( 40927 Stack, 40928 { 40929 direction: "row", 40930 gap: "sm", 40931 className: isExitingEditActions ? actions_default.editActionsExit : actions_default.editActionsEnter, 40932 children: [ 40933 /* @__PURE__ */ (0, import_jsx_runtime206.jsxs)( 40934 Button4, 40935 { 40936 variant: "minimal", 40937 tone: "brand", 40938 size: "compact", 40939 onClick: insert, 40940 children: [ 40941 !isMobileViewport && /* @__PURE__ */ (0, import_jsx_runtime206.jsx)(Button4.Icon, { icon: plus_default }), 40942 (0, import_i18n58.__)("Add widget") 40943 ] 40944 } 40945 ), 40946 /* @__PURE__ */ (0, import_jsx_runtime206.jsx)( 40947 "div", 40948 { 40949 className: actions_default.editActionsDivider, 40950 "aria-hidden": "true" 40951 } 40952 ), 40953 /* @__PURE__ */ (0, import_jsx_runtime206.jsx)( 40954 Button4, 40955 { 40956 variant: "minimal", 40957 tone: "brand", 40958 size: "compact", 40959 onClick: cancel, 40960 children: (0, import_i18n58.__)("Cancel") 40961 } 40962 ), 40963 /* @__PURE__ */ (0, import_jsx_runtime206.jsx)( 40964 Button4, 40965 { 40966 variant: "solid", 40967 tone: "brand", 40968 size: "compact", 40969 onClick: done, 40970 disabled: !hasUncommittedChanges, 40971 children: (0, import_i18n58.__)("Done") 40972 } 40973 ) 40974 ] 40975 } 40976 ) : /* @__PURE__ */ (0, import_jsx_runtime206.jsx)( 40977 Button4, 40978 { 40979 variant: "minimal", 40980 tone: "brand", 40981 size: "compact", 40982 onClick: handleEditMode, 40983 children: (0, import_i18n58.__)("Customize") 40984 } 40985 ), 40986 /* @__PURE__ */ (0, import_jsx_runtime206.jsx)(MoreActionsDropdown, { items: moreActionsItems }), 40987 /* @__PURE__ */ (0, import_jsx_runtime206.jsx)( 40988 alert_dialog_exports.Root, 40989 { 40990 open: resetDialogOpen, 40991 onOpenChange: setResetDialogOpen, 40992 onConfirm: async () => { 40993 await onLayoutReset?.(); 40994 onEditChange?.(false); 40995 setResetDialogOpen(false); 40996 }, 40997 children: /* @__PURE__ */ (0, import_jsx_runtime206.jsx)( 40998 alert_dialog_exports.Popup, 40999 { 41000 intent: "irreversible", 41001 title: (0, import_i18n58.__)("Reset dashboard to default?"), 41002 description: (0, import_i18n58.__)( 41003 "All customizations will be permanently lost." 41004 ), 41005 confirmButtonText: (0, import_i18n58.__)("Reset") 41006 } 41007 ) 41008 } 41009 ), 41010 canEditGridSettings && /* @__PURE__ */ (0, import_jsx_runtime206.jsx)( 41011 LayoutSettings, 41012 { 41013 open: layoutSettingsOpen, 41014 onOpenChange: setLayoutSettingsOpen 41015 } 41016 ) 41017 ] }); 41018 } 41019 41020 // routes/dashboard/widget-dashboard/components/dashboard-commands/dashboard-commands.tsx 41021 var import_element160 = __toESM(require_element()); 41022 var import_i18n59 = __toESM(require_i18n()); 41023 var import_commands = __toESM(require_commands()); 41024 41025 // routes/dashboard/widget-dashboard/components/dashboard-commands/use-pending-when-edit-mode.ts 41026 var import_element159 = __toESM(require_element()); 41027 function usePendingWhenEditMode({ 41028 editMode, 41029 onEditChange 41030 }) { 41031 const pendingRef = (0, import_element159.useRef)(null); 41032 const wasEditingRef = (0, import_element159.useRef)(editMode); 41033 (0, import_element159.useEffect)(() => { 41034 if (!wasEditingRef.current && editMode && pendingRef.current) { 41035 const action = pendingRef.current; 41036 pendingRef.current = null; 41037 action(); 41038 } 41039 wasEditingRef.current = editMode; 41040 }, [editMode]); 41041 return (0, import_element159.useCallback)( 41042 (action) => { 41043 if (editMode) { 41044 action(); 41045 return; 41046 } 41047 pendingRef.current = action; 41048 onEditChange?.(true); 41049 }, 41050 [editMode, onEditChange] 41051 ); 41052 } 41053 41054 // routes/dashboard/widget-dashboard/components/dashboard-commands/dashboard-commands.tsx 41055 var { useCommandContext } = unlock3(import_commands.privateApis); 41056 var DASHBOARD_COMMAND_CONTEXT = "dashboard"; 41057 function DashboardCommands() { 41058 const { 41059 editMode, 41060 onEditChange, 41061 onLayoutReset, 41062 gridSettings, 41063 canEditGridSettings, 41064 commitGridModelChange 41065 } = useDashboardInternalContext(); 41066 const { setInserterOpen, setResetDialogOpen } = useDashboardUIContext(); 41067 useCommandContext(DASHBOARD_COMMAND_CONTEXT); 41068 const runWhenInEditMode = usePendingWhenEditMode({ 41069 editMode, 41070 onEditChange 41071 }); 41072 const gridModel = getGridModel(gridSettings); 41073 const isGridLayout = gridModel === "grid"; 41074 const isMasonryLayout = gridModel === "masonry"; 41075 const switchToMasonry = (0, import_element160.useCallback)( 41076 ({ close }) => { 41077 close(); 41078 commitGridModelChange("masonry"); 41079 }, 41080 [commitGridModelChange] 41081 ); 41082 const switchToGrid = (0, import_element160.useCallback)( 41083 ({ close }) => { 41084 close(); 41085 commitGridModelChange("grid"); 41086 }, 41087 [commitGridModelChange] 41088 ); 41089 const resetToDefault = (0, import_element160.useCallback)( 41090 ({ close }) => { 41091 close(); 41092 setResetDialogOpen(true); 41093 }, 41094 [setResetDialogOpen] 41095 ); 41096 const addWidgets = (0, import_element160.useCallback)( 41097 ({ close }) => { 41098 close(); 41099 runWhenInEditMode(() => { 41100 setInserterOpen(true); 41101 }); 41102 }, 41103 [runWhenInEditMode, setInserterOpen] 41104 ); 41105 const customize = (0, import_element160.useCallback)( 41106 ({ close }) => { 41107 close(); 41108 onEditChange?.(true); 41109 }, 41110 [onEditChange] 41111 ); 41112 const commands = (0, import_element160.useMemo)( 41113 () => [ 41114 { 41115 name: "core/dashboard/customize", 41116 label: (0, import_i18n59.__)("Customize dashboard"), 41117 icon: layout_default, 41118 category: "command", 41119 context: DASHBOARD_COMMAND_CONTEXT, 41120 keywords: [(0, import_i18n59.__)("edit"), (0, import_i18n59.__)("widgets"), (0, import_i18n59.__)("layout")], 41121 disabled: !onEditChange || editMode, 41122 callback: customize 41123 }, 41124 { 41125 name: "core/dashboard/add-widgets", 41126 label: (0, import_i18n59.__)("Add dashboard widgets"), 41127 icon: plus_default, 41128 category: "command", 41129 context: DASHBOARD_COMMAND_CONTEXT, 41130 keywords: [(0, import_i18n59.__)("widgets"), (0, import_i18n59.__)("inserter")], 41131 disabled: !onEditChange, 41132 callback: addWidgets 41133 }, 41134 { 41135 name: "core/dashboard/switch-to-masonry-layout", 41136 label: (0, import_i18n59.__)("Switch dashboard to masonry layout"), 41137 icon: columns_default, 41138 category: "command", 41139 context: DASHBOARD_COMMAND_CONTEXT, 41140 keywords: [ 41141 (0, import_i18n59.__)("layout"), 41142 (0, import_i18n59.__)("layout model"), 41143 (0, import_i18n59.__)("masonry") 41144 ], 41145 disabled: !canEditGridSettings || isMasonryLayout || editMode, 41146 callback: switchToMasonry 41147 }, 41148 { 41149 name: "core/dashboard/switch-to-grid-layout", 41150 label: (0, import_i18n59.__)("Switch dashboard to grid layout"), 41151 icon: grid_default, 41152 category: "command", 41153 context: DASHBOARD_COMMAND_CONTEXT, 41154 keywords: [ 41155 (0, import_i18n59.__)("layout"), 41156 (0, import_i18n59.__)("layout model"), 41157 (0, import_i18n59.__)("grid"), 41158 (0, import_i18n59.__)("standard grid") 41159 ], 41160 disabled: !canEditGridSettings || isGridLayout || editMode, 41161 callback: switchToGrid 41162 }, 41163 { 41164 name: "core/dashboard/reset-to-default", 41165 label: (0, import_i18n59.__)("Reset dashboard widgets to default"), 41166 icon: trash_default, 41167 category: "command", 41168 context: DASHBOARD_COMMAND_CONTEXT, 41169 keywords: [(0, import_i18n59.__)("reset"), (0, import_i18n59.__)("default")], 41170 disabled: !onLayoutReset, 41171 callback: resetToDefault 41172 } 41173 ], 41174 [ 41175 onEditChange, 41176 editMode, 41177 customize, 41178 addWidgets, 41179 canEditGridSettings, 41180 isMasonryLayout, 41181 isGridLayout, 41182 switchToMasonry, 41183 switchToGrid, 41184 onLayoutReset, 41185 resetToDefault 41186 ] 41187 ); 41188 (0, import_commands.useCommands)(commands); 41189 return null; 41190 } 41191 41192 // routes/dashboard/widget-dashboard/components/inserter/inserter.tsx 41193 var import_element164 = __toESM(require_element()); 41194 var import_i18n61 = __toESM(require_i18n()); 41195 41196 // routes/dashboard/widget-dashboard/utils/create-dashboard-widget/create-dashboard-widget.ts 41197 var DEFAULT_PLACEMENT = { 41198 width: 1, 41199 height: 2, 41200 order: 0 41201 }; 41202 function createDashboardWidget(widgetType, initialAttributes) { 41203 return { 41204 uuid: crypto.randomUUID(), 41205 type: widgetType.name, 41206 attributes: initialAttributes ?? widgetType.example?.attributes, 41207 placement: DEFAULT_PLACEMENT 41208 }; 41209 } 41210 41211 // routes/dashboard/widget-dashboard/components/widget-picker/widget-picker.tsx 41212 var import_element163 = __toESM(require_element()); 41213 var import_i18n60 = __toESM(require_i18n()); 41214 41215 // routes/dashboard/widget-dashboard/components/widget-render/widget-render.tsx 41216 var import_element162 = __toESM(require_element()); 41217 41218 // routes/dashboard/widget-dashboard/utils/get-lazy-widget-component/get-lazy-widget-component.ts 41219 var import_element161 = __toESM(require_element()); 41220 function isValidWidgetModule(module) { 41221 return typeof module === "object" && module !== null && "default" in module && typeof module.default === "function"; 41222 } 41223 var componentCache = /* @__PURE__ */ new Map(); 41224 function getLazyWidgetComponent(renderModule, resolveWidgetModule) { 41225 const cached = componentCache.get(renderModule); 41226 if (cached) { 41227 return cached; 41228 } 41229 const lazyComponent = (0, import_element161.lazy)(async () => { 41230 const module = await resolveWidgetModule(renderModule); 41231 if (!isValidWidgetModule(module)) { 41232 throw new Error(`Invalid widget module: $renderModule}`); 41233 } 41234 return module; 41235 }); 41236 componentCache.set(renderModule, lazyComponent); 41237 return lazyComponent; 41238 } 41239 41240 // routes/dashboard/widget-dashboard/components/widget-render/widget-render.tsx 41241 var import_jsx_runtime207 = __toESM(require_jsx_runtime()); 41242 function WidgetRenderImpl({ widget, widgetType }) { 41243 const { layout, onLayoutChange, resolveWidgetModule } = useDashboardInternalContext(); 41244 const WidgetComponent = getLazyWidgetComponent( 41245 widgetType.renderModule, 41246 resolveWidgetModule 41247 ); 41248 const setAttributes = (0, import_element162.useCallback)( 41249 (next) => { 41250 onLayoutChange( 41251 layout.map( 41252 (w2) => w2.uuid === widget.uuid ? { 41253 ...w2, 41254 attributes: { 41255 ...w2.attributes, 41256 ...next 41257 } 41258 } : w2 41259 ) 41260 ); 41261 }, 41262 [widget.uuid, layout, onLayoutChange] 41263 ); 41264 return /* @__PURE__ */ (0, import_jsx_runtime207.jsx)(import_jsx_runtime207.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime207.jsx)( 41265 WidgetComponent, 41266 { 41267 attributes: widget.attributes, 41268 setAttributes 41269 } 41270 ) }); 41271 } 41272 var WidgetRender = WidgetRenderImpl; 41273 41274 // routes/dashboard/widget-dashboard/components/widget-picker/widget-picker.module.css 41275 if (typeof process === "undefined" || true) { 41276 registerStyle48("2aafbc3440", "._32fba4d898ff4e12__preview{height:125%;overflow:hidden;padding:0;pointer-events:none;transform:scale(.8);transform-origin:top left;user-select:none;width:125%}"); 41277 } 41278 var widget_picker_default = { "preview": "_32fba4d898ff4e12__preview" }; 41279 41280 // routes/dashboard/widget-dashboard/components/widget-picker/widget-picker.tsx 41281 var import_jsx_runtime208 = __toESM(require_jsx_runtime()); 41282 var DEFAULT_VIEW = { 41283 type: "pickerGrid", 41284 page: 1, 41285 search: "", 41286 mediaField: "preview", 41287 titleField: "title" 41288 }; 41289 var getItemId = (item) => item.name; 41290 function WidgetPreview({ item }) { 41291 const exampleWidget = (0, import_element163.useMemo)( 41292 () => createDashboardWidget(item, item.example?.attributes), 41293 [item] 41294 ); 41295 return /* @__PURE__ */ (0, import_jsx_runtime208.jsx)("div", { className: widget_picker_default.preview, inert: true, children: /* @__PURE__ */ (0, import_jsx_runtime208.jsx)(import_element163.Suspense, { fallback: null, children: /* @__PURE__ */ (0, import_jsx_runtime208.jsx)(WidgetRender, { widget: exampleWidget, widgetType: item }) }) }); 41296 } 41297 var fields2 = [ 41298 { 41299 id: "title", 41300 type: "text", 41301 label: (0, import_i18n60.__)("Title"), 41302 filterBy: false 41303 }, 41304 { 41305 id: "preview", 41306 type: "media", 41307 render: WidgetPreview 41308 }, 41309 { 41310 id: "name", 41311 type: "text", 41312 enableGlobalSearch: true, 41313 enableHiding: false, 41314 enableSorting: false, 41315 filterBy: false, 41316 getValue: ({ item }) => `$item.name.replace(/[\/,\-_]/g, " ")} $item.title}` 41317 } 41318 ]; 41319 function WidgetPicker({ 41320 onSelect, 41321 itemListLabel = (0, import_i18n60.__)("Widget list") 41322 }) { 41323 const { widgetTypes: registeredTypes } = useDashboardInternalContext(); 41324 const [selection, setSelection] = (0, import_element163.useState)([]); 41325 const [view, setView] = (0, import_element163.useState)(DEFAULT_VIEW); 41326 const { data: widgetTypes } = filterSortAndPaginate( 41327 registeredTypes, 41328 view, 41329 fields2 41330 ); 41331 const actions = (0, import_element163.useMemo)( 41332 () => [ 41333 { 41334 id: "select", 41335 label: (0, import_i18n60.__)("Select"), 41336 isPrimary: true, 41337 supportsBulk: true, 41338 callback: (items) => onSelect(items) 41339 } 41340 ], 41341 [onSelect] 41342 ); 41343 return /* @__PURE__ */ (0, import_jsx_runtime208.jsx)( 41344 dataviews_picker_default, 41345 { 41346 data: widgetTypes, 41347 fields: fields2, 41348 view, 41349 actions, 41350 defaultLayouts: { pickerGrid: {} }, 41351 onChangeView: setView, 41352 isLoading: false, 41353 paginationInfo: { 41354 totalItems: widgetTypes.length, 41355 totalPages: 1 41356 }, 41357 selection, 41358 onChangeSelection: setSelection, 41359 getItemId, 41360 itemListLabel 41361 } 41362 ); 41363 } 41364 41365 // routes/dashboard/widget-dashboard/components/inserter/inserter.tsx 41366 var import_jsx_runtime209 = __toESM(require_jsx_runtime()); 41367 function Inserter() { 41368 const { layout, onLayoutChange } = useDashboardInternalContext(); 41369 const { inserterOpen, setInserterOpen } = useDashboardUIContext(); 41370 const insertWidgets = (0, import_element164.useCallback)( 41371 (widgetTypes) => { 41372 if (widgetTypes.length > 0) { 41373 const newWidgets = widgetTypes.map( 41374 (widgetType) => createDashboardWidget(widgetType) 41375 ); 41376 onLayoutChange([...layout, ...newWidgets]); 41377 } 41378 setInserterOpen(false); 41379 }, 41380 [layout, onLayoutChange, setInserterOpen] 41381 ); 41382 if (!inserterOpen) { 41383 return null; 41384 } 41385 return /* @__PURE__ */ (0, import_jsx_runtime209.jsx)(dialog_exports.Root, { open: inserterOpen, onOpenChange: setInserterOpen, children: /* @__PURE__ */ (0, import_jsx_runtime209.jsxs)( 41386 dialog_exports.Popup, 41387 { 41388 size: "full", 41389 portal: /* @__PURE__ */ (0, import_jsx_runtime209.jsx)( 41390 dialog_exports.Portal, 41391 { 41392 style: { 41393 "--wp-ui-dialog-z-index": 99999 41394 } 41395 } 41396 ), 41397 children: [ 41398 /* @__PURE__ */ (0, import_jsx_runtime209.jsxs)(dialog_exports.Header, { children: [ 41399 /* @__PURE__ */ (0, import_jsx_runtime209.jsx)(dialog_exports.Title, { children: (0, import_i18n61.__)("Add widget") }), 41400 /* @__PURE__ */ (0, import_jsx_runtime209.jsx)(dialog_exports.CloseIcon, {}) 41401 ] }), 41402 /* @__PURE__ */ (0, import_jsx_runtime209.jsx)(dialog_exports.Content, { children: /* @__PURE__ */ (0, import_jsx_runtime209.jsx)(WidgetPicker, { onSelect: insertWidgets }) }) 41403 ] 41404 } 41405 ) }); 41406 } 41407 41408 // routes/dashboard/widget-dashboard/components/widget-chrome/widget-chrome.tsx 41409 var import_components54 = __toESM(require_components()); 41410 var import_element166 = __toESM(require_element()); 41411 var import_i18n62 = __toESM(require_i18n()); 41412 41413 // routes/dashboard/widget-dashboard/context/widget-context.tsx 41414 var import_element165 = __toESM(require_element()); 41415 var import_jsx_runtime210 = __toESM(require_jsx_runtime()); 41416 var WidgetContext = (0, import_element165.createContext)(null); 41417 function WidgetContextProvider({ 41418 value, 41419 children 41420 }) { 41421 return /* @__PURE__ */ (0, import_jsx_runtime210.jsx)(WidgetContext.Provider, { value, children }); 41422 } 41423 41424 // routes/dashboard/widget-dashboard/components/widget-chrome/widget-chrome.module.css 41425 if (typeof process === "undefined" || true) { 41426 registerStyle48("210d1457fc", "._22b961782d58cf14__widgetChrome{contain:layout;height:100%}._22b961782d58cf14__widgetChrome:has(._65ccc0ffeadb15bf__widgetChromeContent :focus-visible){outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--wpds-color-stroke-focus-brand,var(--wp-admin-theme-color,#3858e9));outline-offset:2px}._2e38cde45383ef41__widgetChromeHeaderIcon{color:var(--wpds-color-fg-content-neutral,#1e1e1e);display:inline-flex}._65ccc0ffeadb15bf__widgetChromeContent{flex:1;height:100%;min-height:0;min-width:0;overflow-y:auto}._132a15281d3a4a3c__widgetChromeContentBleed{padding-block:0}.d8613f533b0e359e__widgetChromeBleedScroll{height:100%;margin-block-end:0;overflow-y:auto}.d86427717f1c6168__loading{height:100%}"); 41427 } 41428 var widget_chrome_default = { "widgetChrome": "_22b961782d58cf14__widgetChrome", "widgetChromeContent": "_65ccc0ffeadb15bf__widgetChromeContent", "widgetChromeHeaderIcon": "_2e38cde45383ef41__widgetChromeHeaderIcon", "widgetChromeContentBleed": "_132a15281d3a4a3c__widgetChromeContentBleed", "widgetChromeBleedScroll": "d8613f533b0e359e__widgetChromeBleedScroll", "loading": "d86427717f1c6168__loading" }; 41429 41430 // routes/dashboard/widget-dashboard/components/widget-chrome/widget-chrome.tsx 41431 var import_jsx_runtime211 = __toESM(require_jsx_runtime()); 41432 var WidgetErrorBoundary = class extends import_element166.Component { 41433 state = { hasError: false }; 41434 static getDerivedStateFromError() { 41435 return { hasError: true }; 41436 } 41437 render() { 41438 if (this.state.hasError) { 41439 return /* @__PURE__ */ (0, import_jsx_runtime211.jsx)(notice_exports.Root, { intent: "error", children: /* @__PURE__ */ (0, import_jsx_runtime211.jsx)(notice_exports.Description, { children: (0, import_i18n62.__)("This widget encountered an error.") }) }); 41440 } 41441 return this.props.children; 41442 } 41443 }; 41444 function LoadingOverlay() { 41445 return /* @__PURE__ */ (0, import_jsx_runtime211.jsx)(Stack, { justify: "center", align: "center", className: widget_chrome_default.loading, children: /* @__PURE__ */ (0, import_jsx_runtime211.jsx)(import_components54.Spinner, {}) }); 41446 } 41447 function Header8({ titleId, widgetType }) { 41448 if (!widgetType.title) { 41449 return null; 41450 } 41451 return /* @__PURE__ */ (0, import_jsx_runtime211.jsx)(card_exports.Header, { children: /* @__PURE__ */ (0, import_jsx_runtime211.jsxs)(Stack, { direction: "row", align: "center", gap: "sm", children: [ 41452 widgetType.icon && /* @__PURE__ */ (0, import_jsx_runtime211.jsx)( 41453 "span", 41454 { 41455 className: widget_chrome_default.widgetChromeHeaderIcon, 41456 "aria-hidden": "true", 41457 children: /* @__PURE__ */ (0, import_jsx_runtime211.jsx)(import_components54.Icon, { icon: widgetType.icon }) 41458 } 41459 ), 41460 /* @__PURE__ */ (0, import_jsx_runtime211.jsx)(card_exports.Title, { id: titleId, render: /* @__PURE__ */ (0, import_jsx_runtime211.jsx)("h3", {}), children: widgetType.title }) 41461 ] }) }); 41462 } 41463 var WidgetChrome = (0, import_element166.forwardRef)( 41464 function WidgetChrome2({ widget, index: index2, className }, ref) { 41465 const { widgetTypes, editMode } = useDashboardInternalContext(); 41466 const widgetType = widgetTypes.find((t2) => t2.name === widget.type); 41467 const titleId = (0, import_element166.useId)(); 41468 const contextValue = (0, import_element166.useMemo)( 41469 () => ({ 41470 uuid: widget.uuid, 41471 name: widget.type, 41472 index: index2 41473 }), 41474 [widget.uuid, widget.type, index2] 41475 ); 41476 if (!widgetType) { 41477 return null; 41478 } 41479 const { presentation } = widgetType; 41480 const isHeaderHidden = presentation === "full-bleed"; 41481 const isBodyBleeding = presentation === "full-bleed" || presentation === "content-bleed"; 41482 const header = /* @__PURE__ */ (0, import_jsx_runtime211.jsx)(Header8, { titleId, widgetType }); 41483 const body = /* @__PURE__ */ (0, import_jsx_runtime211.jsx)(WidgetErrorBoundary, { children: /* @__PURE__ */ (0, import_jsx_runtime211.jsx)(import_element166.Suspense, { fallback: /* @__PURE__ */ (0, import_jsx_runtime211.jsx)(LoadingOverlay, {}), children: /* @__PURE__ */ (0, import_jsx_runtime211.jsx)(WidgetRender, { widget, widgetType }) }) }); 41484 return /* @__PURE__ */ (0, import_jsx_runtime211.jsx)(WidgetContextProvider, { value: contextValue, children: /* @__PURE__ */ (0, import_jsx_runtime211.jsxs)( 41485 card_exports.Root, 41486 { 41487 render: /* @__PURE__ */ (0, import_jsx_runtime211.jsx)("section", {}), 41488 ref, 41489 className: clsx_default(widget_chrome_default.widgetChrome, className), 41490 "aria-labelledby": widgetType.title ? titleId : void 0, 41491 inert: editMode || void 0, 41492 children: [ 41493 isHeaderHidden ? /* @__PURE__ */ (0, import_jsx_runtime211.jsx)(VisuallyHidden, { children: header }) : header, 41494 /* @__PURE__ */ (0, import_jsx_runtime211.jsx)( 41495 card_exports.Content, 41496 { 41497 className: clsx_default( 41498 widget_chrome_default.widgetChromeContent, 41499 isBodyBleeding && widget_chrome_default.widgetChromeContentBleed 41500 ), 41501 children: isBodyBleeding ? /* @__PURE__ */ (0, import_jsx_runtime211.jsx)( 41502 card_exports.FullBleed, 41503 { 41504 className: widget_chrome_default.widgetChromeBleedScroll, 41505 children: body 41506 } 41507 ) : body 41508 } 41509 ) 41510 ] 41511 } 41512 ) }); 41513 } 41514 ); 41515 41516 // routes/dashboard/widget-dashboard/components/widget-settings/widget-settings.tsx 41517 var import_element167 = __toESM(require_element()); 41518 var import_i18n64 = __toESM(require_i18n()); 41519 41520 // routes/dashboard/widget-dashboard/components/widget-settings/utils/get-admin-menu-inset.ts 41521 var ADMIN_MENU_ID = "adminmenuback"; 41522 function getAdminMenuInset() { 41523 if (typeof document === "undefined") { 41524 return 0; 41525 } 41526 const adminMenu = document.getElementById(ADMIN_MENU_ID); 41527 if (!adminMenu) { 41528 return 0; 41529 } 41530 return Math.max(0, adminMenu.getBoundingClientRect().right); 41531 } 41532 41533 // routes/dashboard/widget-dashboard/components/widget-settings/utils/get-widget-settings.ts 41534 var import_i18n63 = __toESM(require_i18n()); 41535 function getWidgetSettingsTitle(widgetType) { 41536 return widgetType?.title ? (0, import_i18n63.sprintf)( 41537 /* translators: %s: Widget title. */ 41538 (0, import_i18n63.__)("%s settings"), 41539 widgetType.title 41540 ) : (0, import_i18n63.__)("Widget settings"); 41541 } 41542 41543 // routes/dashboard/widget-dashboard/components/widget-settings/widget-settings.module.css 41544 if (typeof process === "undefined" || true) { 41545 registerStyle48("bfe0d947d2", ".d20001c5bbde9edb__popup{margin-block-start:var(--wp-admin--admin-bar--height,0)}"); 41546 } 41547 var widget_settings_default = { "popup": "d20001c5bbde9edb__popup" }; 41548 41549 // routes/dashboard/widget-dashboard/components/widget-settings/widget-settings.tsx 41550 var import_jsx_runtime212 = __toESM(require_jsx_runtime()); 41551 function WidgetSettings() { 41552 const { 41553 layout, 41554 onLayoutChange, 41555 widgetTypes, 41556 commit, 41557 cancel: cancelStaging, 41558 hasUncommittedChanges 41559 } = useDashboardInternalContext(); 41560 const { 41561 settingsWidgetUuid, 41562 setSettingsWidgetUuid, 41563 settingsDrawerSide, 41564 settingsDrawerInset 41565 } = useDashboardUIContext(); 41566 const open = settingsWidgetUuid !== null; 41567 const [lastWidgetUuid, setLastWidgetUuid] = (0, import_element167.useState)( 41568 settingsWidgetUuid 41569 ); 41570 (0, import_element167.useEffect)(() => { 41571 if (settingsWidgetUuid) { 41572 setLastWidgetUuid(settingsWidgetUuid); 41573 } 41574 }, [settingsWidgetUuid]); 41575 const activeUuid = settingsWidgetUuid ?? lastWidgetUuid; 41576 const widget = activeUuid ? layout.find((instance) => instance.uuid === activeUuid) : void 0; 41577 const widgetType = widget ? widgetTypes.find((type) => type.name === widget.type) : void 0; 41578 const fields3 = (0, import_element167.useMemo)( 41579 () => widgetType?.attributes ?? [], 41580 [widgetType?.attributes] 41581 ); 41582 const form2 = (0, import_element167.useMemo)( 41583 () => ({ 41584 layout: { type: "regular", labelPosition: "top" }, 41585 fields: fields3.map((field) => field.id) 41586 }), 41587 [fields3] 41588 ); 41589 const handleChange = (0, import_element167.useCallback)( 41590 (edits) => { 41591 if (!widget) { 41592 return; 41593 } 41594 onLayoutChange( 41595 layout.map( 41596 (instance) => instance.uuid === widget.uuid ? { 41597 ...instance, 41598 attributes: { 41599 ...instance.attributes, 41600 ...edits 41601 } 41602 } : instance 41603 ) 41604 ); 41605 }, 41606 [layout, onLayoutChange, widget] 41607 ); 41608 const close = (0, import_element167.useCallback)( 41609 () => setSettingsWidgetUuid(null), 41610 [setSettingsWidgetUuid] 41611 ); 41612 const handleSave = (0, import_element167.useCallback)(() => { 41613 commit(); 41614 close(); 41615 }, [commit, close]); 41616 const handleOpenChange = (0, import_element167.useCallback)( 41617 (nextOpen) => { 41618 if (!nextOpen) { 41619 cancelStaging(); 41620 close(); 41621 } 41622 }, 41623 [cancelStaging, close] 41624 ); 41625 const popupStyle = (0, import_element167.useMemo)( 41626 () => settingsDrawerSide === "left" && settingsDrawerInset > 0 ? { marginLeft: settingsDrawerInset } : {}, 41627 [settingsDrawerSide, settingsDrawerInset] 41628 ); 41629 const hasForm = !!widget && !!widgetType && fields3.length > 0; 41630 if (!hasForm) { 41631 return null; 41632 } 41633 const title = getWidgetSettingsTitle(widgetType); 41634 const data = widget?.attributes ?? widgetType?.example?.attributes ?? {}; 41635 return /* @__PURE__ */ (0, import_jsx_runtime212.jsx)( 41636 drawer_exports.Root, 41637 { 41638 open, 41639 onOpenChange: handleOpenChange, 41640 swipeDirection: settingsDrawerSide, 41641 modal: false, 41642 disablePointerDismissal: true, 41643 children: /* @__PURE__ */ (0, import_jsx_runtime212.jsxs)( 41644 drawer_exports.Popup, 41645 { 41646 size: "medium", 41647 className: widget_settings_default.popup, 41648 style: popupStyle, 41649 children: [ 41650 /* @__PURE__ */ (0, import_jsx_runtime212.jsxs)(drawer_exports.Header, { children: [ 41651 /* @__PURE__ */ (0, import_jsx_runtime212.jsx)(drawer_exports.Title, { children: title }), 41652 /* @__PURE__ */ (0, import_jsx_runtime212.jsx)(drawer_exports.CloseIcon, {}) 41653 ] }), 41654 /* @__PURE__ */ (0, import_jsx_runtime212.jsx)(drawer_exports.Content, { children: /* @__PURE__ */ (0, import_jsx_runtime212.jsx)( 41655 DataForm, 41656 { 41657 data, 41658 fields: fields3, 41659 form: form2, 41660 onChange: handleChange 41661 } 41662 ) }), 41663 /* @__PURE__ */ (0, import_jsx_runtime212.jsxs)(drawer_exports.Footer, { children: [ 41664 /* @__PURE__ */ (0, import_jsx_runtime212.jsx)( 41665 Button4, 41666 { 41667 variant: "minimal", 41668 tone: "brand", 41669 size: "compact", 41670 onClick: () => handleOpenChange(false), 41671 children: (0, import_i18n64.__)("Cancel") 41672 } 41673 ), 41674 /* @__PURE__ */ (0, import_jsx_runtime212.jsx)( 41675 Button4, 41676 { 41677 variant: "solid", 41678 tone: "brand", 41679 size: "compact", 41680 onClick: handleSave, 41681 disabled: !hasUncommittedChanges, 41682 children: (0, import_i18n64.__)("Save") 41683 } 41684 ) 41685 ] }) 41686 ] 41687 } 41688 ) 41689 } 41690 ); 41691 } 41692 41693 // routes/dashboard/widget-dashboard/components/widget-toolbar/widget-toolbar.module.css 41694 if (typeof process === "undefined" || true) { 41695 registerStyle48("35ffd01a9a", "._067564f92a835c12__widgetToolbar{border-radius:var(--wpds-border-radius-md,4px);inset-block-start:var(--wpds-dimension-padding-sm,8px);inset-inline-end:var(--wpds-dimension-padding-sm,8px);padding:var(--wpds-dimension-padding-xs,4px);position:absolute;z-index:1}"); 41696 } 41697 var widget_toolbar_default = { "widgetToolbar": "_067564f92a835c12__widgetToolbar" }; 41698 41699 // routes/dashboard/widget-dashboard/components/widget-toolbar/widget-toolbar.tsx 41700 var import_jsx_runtime213 = __toESM(require_jsx_runtime()); 41701 function WidgetToolbar({ 41702 children, 41703 className 41704 }) { 41705 return /* @__PURE__ */ (0, import_jsx_runtime213.jsx)( 41706 Stack, 41707 { 41708 direction: "row", 41709 align: "center", 41710 gap: "xs", 41711 className: clsx_default(widget_toolbar_default.widgetToolbar, className), 41712 children 41713 } 41714 ); 41715 } 41716 41717 // routes/dashboard/widget-dashboard/components/widget-settings/widget-settings-trigger.tsx 41718 var import_element168 = __toESM(require_element()); 41719 var import_i18n65 = __toESM(require_i18n()); 41720 var import_jsx_runtime214 = __toESM(require_jsx_runtime()); 41721 function WidgetSettingsTrigger({ 41722 widget, 41723 widgetType 41724 }) { 41725 const { 41726 setSettingsWidgetUuid, 41727 setSettingsDrawerSide, 41728 setSettingsDrawerInset 41729 } = useDashboardUIContext(); 41730 const open = (0, import_element168.useCallback)( 41731 (event) => { 41732 const adminMenuInset = getAdminMenuInset(); 41733 const tile = event.currentTarget.closest( 41734 "[data-wp-grid-item-key]" 41735 ); 41736 const rect = (tile ?? event.currentTarget).getBoundingClientRect(); 41737 const widgetCenter = rect.left + rect.width / 2; 41738 const contentCenter = (adminMenuInset + window.innerWidth) / 2; 41739 const side = widgetCenter > contentCenter ? "left" : "right"; 41740 setSettingsDrawerSide(side); 41741 setSettingsDrawerInset(side === "left" ? adminMenuInset : 0); 41742 setSettingsWidgetUuid(widget.uuid); 41743 }, 41744 [ 41745 setSettingsDrawerSide, 41746 setSettingsDrawerInset, 41747 setSettingsWidgetUuid, 41748 widget.uuid 41749 ] 41750 ); 41751 if (!widgetType.attributes?.length) { 41752 return null; 41753 } 41754 return /* @__PURE__ */ (0, import_jsx_runtime214.jsx)( 41755 IconButton, 41756 { 41757 icon: cog_default, 41758 label: (0, import_i18n65.__)("Widget settings"), 41759 variant: "minimal", 41760 tone: "neutral", 41761 size: "compact", 41762 onClick: open 41763 } 41764 ); 41765 } 41766 41767 // routes/dashboard/widget-dashboard/components/widget-settings/widget-settings-toolbar.module.css 41768 if (typeof process === "undefined" || true) { 41769 registerStyle48("f5930796a0", "._23f9a8e74f27d62f__widgetSettingsToolbar{background:color-mix(in srgb,var(--wpds-color-bg-surface-neutral,#fcfcfc) 40%,#0000);opacity:0;pointer-events:none}[data-wp-grid-item-key]:focus-within ._23f9a8e74f27d62f__widgetSettingsToolbar,[data-wp-grid-item-key]:hover ._23f9a8e74f27d62f__widgetSettingsToolbar{opacity:1;pointer-events:auto}@media not (prefers-reduced-motion){._23f9a8e74f27d62f__widgetSettingsToolbar{transition:opacity var(--wpds-motion-duration-sm,.1s) var(--wpds-motion-easing-subtle,cubic-bezier(.15,0,.15,1))}}"); 41770 } 41771 var widget_settings_toolbar_default = { "widgetSettingsToolbar": "_23f9a8e74f27d62f__widgetSettingsToolbar" }; 41772 41773 // routes/dashboard/widget-dashboard/components/widget-settings/widget-settings-toolbar.tsx 41774 var import_jsx_runtime215 = __toESM(require_jsx_runtime()); 41775 function WidgetSettingsToolbar({ 41776 widget, 41777 widgetType 41778 }) { 41779 if (!widgetType.attributes?.length) { 41780 return null; 41781 } 41782 return /* @__PURE__ */ (0, import_jsx_runtime215.jsx)(WidgetToolbar, { className: widget_settings_toolbar_default.widgetSettingsToolbar, children: /* @__PURE__ */ (0, import_jsx_runtime215.jsx)( 41783 WidgetSettingsTrigger, 41784 { 41785 widget, 41786 widgetType 41787 } 41788 ) }); 41789 } 41790 41791 // routes/dashboard/widget-dashboard/components/widgets/widgets.tsx 41792 var import_element179 = __toESM(require_element()); 41793 41794 // node_modules/@dnd-kit/core/dist/core.esm.js 41795 var import_react45 = __toESM(require_react()); 41796 var import_react_dom5 = __toESM(require_react_dom()); 41797 41798 // node_modules/@dnd-kit/utilities/dist/utilities.esm.js 41799 var import_react43 = __toESM(require_react()); 41800 function useCombinedRefs() { 41801 for (var _len = arguments.length, refs = new Array(_len), _key = 0; _key < _len; _key++) { 41802 refs[_key] = arguments[_key]; 41803 } 41804 return (0, import_react43.useMemo)( 41805 () => (node) => { 41806 refs.forEach((ref) => ref(node)); 41807 }, 41808 // eslint-disable-next-line react-hooks/exhaustive-deps 41809 refs 41810 ); 41811 } 41812 var canUseDOM2 = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined"; 41813 function isWindow(element) { 41814 const elementString = Object.prototype.toString.call(element); 41815 return elementString === "[object Window]" || // In Electron context the Window object serializes to [object global] 41816 elementString === "[object global]"; 41817 } 41818 function isNode2(node) { 41819 return "nodeType" in node; 41820 } 41821 function getWindow3(target) { 41822 var _target$ownerDocument, _target$ownerDocument2; 41823 if (!target) { 41824 return window; 41825 } 41826 if (isWindow(target)) { 41827 return target; 41828 } 41829 if (!isNode2(target)) { 41830 return window; 41831 } 41832 return (_target$ownerDocument = (_target$ownerDocument2 = target.ownerDocument) == null ? void 0 : _target$ownerDocument2.defaultView) != null ? _target$ownerDocument : window; 41833 } 41834 function isDocument(node) { 41835 const { 41836 Document 41837 } = getWindow3(node); 41838 return node instanceof Document; 41839 } 41840 function isHTMLElement2(node) { 41841 if (isWindow(node)) { 41842 return false; 41843 } 41844 return node instanceof getWindow3(node).HTMLElement; 41845 } 41846 function isSVGElement(node) { 41847 return node instanceof getWindow3(node).SVGElement; 41848 } 41849 function getOwnerDocument(target) { 41850 if (!target) { 41851 return document; 41852 } 41853 if (isWindow(target)) { 41854 return target.document; 41855 } 41856 if (!isNode2(target)) { 41857 return document; 41858 } 41859 if (isDocument(target)) { 41860 return target; 41861 } 41862 if (isHTMLElement2(target) || isSVGElement(target)) { 41863 return target.ownerDocument; 41864 } 41865 return document; 41866 } 41867 var useIsomorphicLayoutEffect = canUseDOM2 ? import_react43.useLayoutEffect : import_react43.useEffect; 41868 function useEvent3(handler) { 41869 const handlerRef = (0, import_react43.useRef)(handler); 41870 useIsomorphicLayoutEffect(() => { 41871 handlerRef.current = handler; 41872 }); 41873 return (0, import_react43.useCallback)(function() { 41874 for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { 41875 args[_key] = arguments[_key]; 41876 } 41877 return handlerRef.current == null ? void 0 : handlerRef.current(...args); 41878 }, []); 41879 } 41880 function useInterval() { 41881 const intervalRef = (0, import_react43.useRef)(null); 41882 const set3 = (0, import_react43.useCallback)((listener, duration) => { 41883 intervalRef.current = setInterval(listener, duration); 41884 }, []); 41885 const clear = (0, import_react43.useCallback)(() => { 41886 if (intervalRef.current !== null) { 41887 clearInterval(intervalRef.current); 41888 intervalRef.current = null; 41889 } 41890 }, []); 41891 return [set3, clear]; 41892 } 41893 function useLatestValue(value, dependencies) { 41894 if (dependencies === void 0) { 41895 dependencies = [value]; 41896 } 41897 const valueRef = (0, import_react43.useRef)(value); 41898 useIsomorphicLayoutEffect(() => { 41899 if (valueRef.current !== value) { 41900 valueRef.current = value; 41901 } 41902 }, dependencies); 41903 return valueRef; 41904 } 41905 function useLazyMemo(callback, dependencies) { 41906 const valueRef = (0, import_react43.useRef)(); 41907 return (0, import_react43.useMemo)( 41908 () => { 41909 const newValue = callback(valueRef.current); 41910 valueRef.current = newValue; 41911 return newValue; 41912 }, 41913 // eslint-disable-next-line react-hooks/exhaustive-deps 41914 [...dependencies] 41915 ); 41916 } 41917 function useNodeRef(onChange) { 41918 const onChangeHandler = useEvent3(onChange); 41919 const node = (0, import_react43.useRef)(null); 41920 const setNodeRef = (0, import_react43.useCallback)( 41921 (element) => { 41922 if (element !== node.current) { 41923 onChangeHandler == null ? void 0 : onChangeHandler(element, node.current); 41924 } 41925 node.current = element; 41926 }, 41927 //eslint-disable-next-line 41928 [] 41929 ); 41930 return [node, setNodeRef]; 41931 } 41932 function usePrevious2(value) { 41933 const ref = (0, import_react43.useRef)(); 41934 (0, import_react43.useEffect)(() => { 41935 ref.current = value; 41936 }, [value]); 41937 return ref.current; 41938 } 41939 var ids = {}; 41940 function useUniqueId(prefix, value) { 41941 return (0, import_react43.useMemo)(() => { 41942 if (value) { 41943 return value; 41944 } 41945 const id = ids[prefix] == null ? 0 : ids[prefix] + 1; 41946 ids[prefix] = id; 41947 return prefix + "-" + id; 41948 }, [prefix, value]); 41949 } 41950 function createAdjustmentFn(modifier) { 41951 return function(object) { 41952 for (var _len = arguments.length, adjustments = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { 41953 adjustments[_key - 1] = arguments[_key]; 41954 } 41955 return adjustments.reduce((accumulator, adjustment) => { 41956 const entries = Object.entries(adjustment); 41957 for (const [key2, valueAdjustment] of entries) { 41958 const value = accumulator[key2]; 41959 if (value != null) { 41960 accumulator[key2] = value + modifier * valueAdjustment; 41961 } 41962 } 41963 return accumulator; 41964 }, { 41965 ...object 41966 }); 41967 }; 41968 } 41969 var add = /* @__PURE__ */ createAdjustmentFn(1); 41970 var subtract = /* @__PURE__ */ createAdjustmentFn(-1); 41971 function hasViewportRelativeCoordinates(event) { 41972 return "clientX" in event && "clientY" in event; 41973 } 41974 function isKeyboardEvent(event) { 41975 if (!event) { 41976 return false; 41977 } 41978 const { 41979 KeyboardEvent: KeyboardEvent2 41980 } = getWindow3(event.target); 41981 return KeyboardEvent2 && event instanceof KeyboardEvent2; 41982 } 41983 function isTouchEvent(event) { 41984 if (!event) { 41985 return false; 41986 } 41987 const { 41988 TouchEvent 41989 } = getWindow3(event.target); 41990 return TouchEvent && event instanceof TouchEvent; 41991 } 41992 function getEventCoordinates(event) { 41993 if (isTouchEvent(event)) { 41994 if (event.touches && event.touches.length) { 41995 const { 41996 clientX: x2, 41997 clientY: y2 41998 } = event.touches[0]; 41999 return { 42000 x: x2, 42001 y: y2 42002 }; 42003 } else if (event.changedTouches && event.changedTouches.length) { 42004 const { 42005 clientX: x2, 42006 clientY: y2 42007 } = event.changedTouches[0]; 42008 return { 42009 x: x2, 42010 y: y2 42011 }; 42012 } 42013 } 42014 if (hasViewportRelativeCoordinates(event)) { 42015 return { 42016 x: event.clientX, 42017 y: event.clientY 42018 }; 42019 } 42020 return null; 42021 } 42022 var CSS2 = /* @__PURE__ */ Object.freeze({ 42023 Translate: { 42024 toString(transform) { 42025 if (!transform) { 42026 return; 42027 } 42028 const { 42029 x: x2, 42030 y: y2 42031 } = transform; 42032 return "translate3d(" + (x2 ? Math.round(x2) : 0) + "px, " + (y2 ? Math.round(y2) : 0) + "px, 0)"; 42033 } 42034 }, 42035 Scale: { 42036 toString(transform) { 42037 if (!transform) { 42038 return; 42039 } 42040 const { 42041 scaleX, 42042 scaleY 42043 } = transform; 42044 return "scaleX(" + scaleX + ") scaleY(" + scaleY + ")"; 42045 } 42046 }, 42047 Transform: { 42048 toString(transform) { 42049 if (!transform) { 42050 return; 42051 } 42052 return [CSS2.Translate.toString(transform), CSS2.Scale.toString(transform)].join(" "); 42053 } 42054 }, 42055 Transition: { 42056 toString(_ref) { 42057 let { 42058 property, 42059 duration, 42060 easing 42061 } = _ref; 42062 return property + " " + duration + "ms " + easing; 42063 } 42064 } 42065 }); 42066 var SELECTOR = "a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]"; 42067 function findFirstFocusableNode(element) { 42068 if (element.matches(SELECTOR)) { 42069 return element; 42070 } 42071 return element.querySelector(SELECTOR); 42072 } 42073 42074 // node_modules/@dnd-kit/accessibility/dist/accessibility.esm.js 42075 var import_react44 = __toESM(require_react()); 42076 var hiddenStyles = { 42077 display: "none" 42078 }; 42079 function HiddenText(_ref) { 42080 let { 42081 id, 42082 value 42083 } = _ref; 42084 return import_react44.default.createElement("div", { 42085 id, 42086 style: hiddenStyles 42087 }, value); 42088 } 42089 function LiveRegion(_ref) { 42090 let { 42091 id, 42092 announcement, 42093 ariaLiveType = "assertive" 42094 } = _ref; 42095 const visuallyHidden2 = { 42096 position: "fixed", 42097 top: 0, 42098 left: 0, 42099 width: 1, 42100 height: 1, 42101 margin: -1, 42102 border: 0, 42103 padding: 0, 42104 overflow: "hidden", 42105 clip: "rect(0 0 0 0)", 42106 clipPath: "inset(100%)", 42107 whiteSpace: "nowrap" 42108 }; 42109 return import_react44.default.createElement("div", { 42110 id, 42111 style: visuallyHidden2, 42112 role: "status", 42113 "aria-live": ariaLiveType, 42114 "aria-atomic": true 42115 }, announcement); 42116 } 42117 function useAnnouncement() { 42118 const [announcement, setAnnouncement] = (0, import_react44.useState)(""); 42119 const announce = (0, import_react44.useCallback)((value) => { 42120 if (value != null) { 42121 setAnnouncement(value); 42122 } 42123 }, []); 42124 return { 42125 announce, 42126 announcement 42127 }; 42128 } 42129 42130 // node_modules/@dnd-kit/core/dist/core.esm.js 42131 var DndMonitorContext = /* @__PURE__ */ (0, import_react45.createContext)(null); 42132 function useDndMonitor(listener) { 42133 const registerListener = (0, import_react45.useContext)(DndMonitorContext); 42134 (0, import_react45.useEffect)(() => { 42135 if (!registerListener) { 42136 throw new Error("useDndMonitor must be used within a children of <DndContext>"); 42137 } 42138 const unsubscribe = registerListener(listener); 42139 return unsubscribe; 42140 }, [listener, registerListener]); 42141 } 42142 function useDndMonitorProvider() { 42143 const [listeners] = (0, import_react45.useState)(() => /* @__PURE__ */ new Set()); 42144 const registerListener = (0, import_react45.useCallback)((listener) => { 42145 listeners.add(listener); 42146 return () => listeners.delete(listener); 42147 }, [listeners]); 42148 const dispatch2 = (0, import_react45.useCallback)((_ref) => { 42149 let { 42150 type, 42151 event 42152 } = _ref; 42153 listeners.forEach((listener) => { 42154 var _listener$type; 42155 return (_listener$type = listener[type]) == null ? void 0 : _listener$type.call(listener, event); 42156 }); 42157 }, [listeners]); 42158 return [dispatch2, registerListener]; 42159 } 42160 var defaultScreenReaderInstructions = { 42161 draggable: "\n To pick up a draggable item, press the space bar.\n While dragging, use the arrow keys to move the item.\n Press space again to drop the item in its new position, or press escape to cancel.\n " 42162 }; 42163 var defaultAnnouncements = { 42164 onDragStart(_ref) { 42165 let { 42166 active 42167 } = _ref; 42168 return "Picked up draggable item " + active.id + "."; 42169 }, 42170 onDragOver(_ref2) { 42171 let { 42172 active, 42173 over 42174 } = _ref2; 42175 if (over) { 42176 return "Draggable item " + active.id + " was moved over droppable area " + over.id + "."; 42177 } 42178 return "Draggable item " + active.id + " is no longer over a droppable area."; 42179 }, 42180 onDragEnd(_ref3) { 42181 let { 42182 active, 42183 over 42184 } = _ref3; 42185 if (over) { 42186 return "Draggable item " + active.id + " was dropped over droppable area " + over.id; 42187 } 42188 return "Draggable item " + active.id + " was dropped."; 42189 }, 42190 onDragCancel(_ref4) { 42191 let { 42192 active 42193 } = _ref4; 42194 return "Dragging was cancelled. Draggable item " + active.id + " was dropped."; 42195 } 42196 }; 42197 function Accessibility(_ref) { 42198 let { 42199 announcements = defaultAnnouncements, 42200 container, 42201 hiddenTextDescribedById, 42202 screenReaderInstructions = defaultScreenReaderInstructions 42203 } = _ref; 42204 const { 42205 announce, 42206 announcement 42207 } = useAnnouncement(); 42208 const liveRegionId = useUniqueId("DndLiveRegion"); 42209 const [mounted, setMounted] = (0, import_react45.useState)(false); 42210 (0, import_react45.useEffect)(() => { 42211 setMounted(true); 42212 }, []); 42213 useDndMonitor((0, import_react45.useMemo)(() => ({ 42214 onDragStart(_ref2) { 42215 let { 42216 active 42217 } = _ref2; 42218 announce(announcements.onDragStart({ 42219 active 42220 })); 42221 }, 42222 onDragMove(_ref3) { 42223 let { 42224 active, 42225 over 42226 } = _ref3; 42227 if (announcements.onDragMove) { 42228 announce(announcements.onDragMove({ 42229 active, 42230 over 42231 })); 42232 } 42233 }, 42234 onDragOver(_ref4) { 42235 let { 42236 active, 42237 over 42238 } = _ref4; 42239 announce(announcements.onDragOver({ 42240 active, 42241 over 42242 })); 42243 }, 42244 onDragEnd(_ref5) { 42245 let { 42246 active, 42247 over 42248 } = _ref5; 42249 announce(announcements.onDragEnd({ 42250 active, 42251 over 42252 })); 42253 }, 42254 onDragCancel(_ref6) { 42255 let { 42256 active, 42257 over 42258 } = _ref6; 42259 announce(announcements.onDragCancel({ 42260 active, 42261 over 42262 })); 42263 } 42264 }), [announce, announcements])); 42265 if (!mounted) { 42266 return null; 42267 } 42268 const markup = import_react45.default.createElement(import_react45.default.Fragment, null, import_react45.default.createElement(HiddenText, { 42269 id: hiddenTextDescribedById, 42270 value: screenReaderInstructions.draggable 42271 }), import_react45.default.createElement(LiveRegion, { 42272 id: liveRegionId, 42273 announcement 42274 })); 42275 return container ? (0, import_react_dom5.createPortal)(markup, container) : markup; 42276 } 42277 var Action3; 42278 (function(Action4) { 42279 Action4["DragStart"] = "dragStart"; 42280 Action4["DragMove"] = "dragMove"; 42281 Action4["DragEnd"] = "dragEnd"; 42282 Action4["DragCancel"] = "dragCancel"; 42283 Action4["DragOver"] = "dragOver"; 42284 Action4["RegisterDroppable"] = "registerDroppable"; 42285 Action4["SetDroppableDisabled"] = "setDroppableDisabled"; 42286 Action4["UnregisterDroppable"] = "unregisterDroppable"; 42287 })(Action3 || (Action3 = {})); 42288 function noop6() { 42289 } 42290 function useSensor(sensor, options) { 42291 return (0, import_react45.useMemo)( 42292 () => ({ 42293 sensor, 42294 options: options != null ? options : {} 42295 }), 42296 // eslint-disable-next-line react-hooks/exhaustive-deps 42297 [sensor, options] 42298 ); 42299 } 42300 function useSensors() { 42301 for (var _len = arguments.length, sensors = new Array(_len), _key = 0; _key < _len; _key++) { 42302 sensors[_key] = arguments[_key]; 42303 } 42304 return (0, import_react45.useMemo)( 42305 () => [...sensors].filter((sensor) => sensor != null), 42306 // eslint-disable-next-line react-hooks/exhaustive-deps 42307 [...sensors] 42308 ); 42309 } 42310 var defaultCoordinates = /* @__PURE__ */ Object.freeze({ 42311 x: 0, 42312 y: 0 42313 }); 42314 function distanceBetween(p1, p2) { 42315 return Math.sqrt(Math.pow(p1.x - p2.x, 2) + Math.pow(p1.y - p2.y, 2)); 42316 } 42317 function getRelativeTransformOrigin(event, rect) { 42318 const eventCoordinates = getEventCoordinates(event); 42319 if (!eventCoordinates) { 42320 return "0 0"; 42321 } 42322 const transformOrigin = { 42323 x: (eventCoordinates.x - rect.left) / rect.width * 100, 42324 y: (eventCoordinates.y - rect.top) / rect.height * 100 42325 }; 42326 return transformOrigin.x + "% " + transformOrigin.y + "%"; 42327 } 42328 function sortCollisionsAsc(_ref, _ref2) { 42329 let { 42330 data: { 42331 value: a2 42332 } 42333 } = _ref; 42334 let { 42335 data: { 42336 value: b2 42337 } 42338 } = _ref2; 42339 return a2 - b2; 42340 } 42341 function sortCollisionsDesc(_ref3, _ref4) { 42342 let { 42343 data: { 42344 value: a2 42345 } 42346 } = _ref3; 42347 let { 42348 data: { 42349 value: b2 42350 } 42351 } = _ref4; 42352 return b2 - a2; 42353 } 42354 function cornersOfRectangle(_ref5) { 42355 let { 42356 left, 42357 top, 42358 height, 42359 width 42360 } = _ref5; 42361 return [{ 42362 x: left, 42363 y: top 42364 }, { 42365 x: left + width, 42366 y: top 42367 }, { 42368 x: left, 42369 y: top + height 42370 }, { 42371 x: left + width, 42372 y: top + height 42373 }]; 42374 } 42375 function getFirstCollision(collisions, property) { 42376 if (!collisions || collisions.length === 0) { 42377 return null; 42378 } 42379 const [firstCollision] = collisions; 42380 return property ? firstCollision[property] : firstCollision; 42381 } 42382 var closestCorners = (_ref) => { 42383 let { 42384 collisionRect, 42385 droppableRects, 42386 droppableContainers 42387 } = _ref; 42388 const corners = cornersOfRectangle(collisionRect); 42389 const collisions = []; 42390 for (const droppableContainer of droppableContainers) { 42391 const { 42392 id 42393 } = droppableContainer; 42394 const rect = droppableRects.get(id); 42395 if (rect) { 42396 const rectCorners = cornersOfRectangle(rect); 42397 const distances = corners.reduce((accumulator, corner, index2) => { 42398 return accumulator + distanceBetween(rectCorners[index2], corner); 42399 }, 0); 42400 const effectiveDistance = Number((distances / 4).toFixed(4)); 42401 collisions.push({ 42402 id, 42403 data: { 42404 droppableContainer, 42405 value: effectiveDistance 42406 } 42407 }); 42408 } 42409 } 42410 return collisions.sort(sortCollisionsAsc); 42411 }; 42412 function getIntersectionRatio(entry, target) { 42413 const top = Math.max(target.top, entry.top); 42414 const left = Math.max(target.left, entry.left); 42415 const right = Math.min(target.left + target.width, entry.left + entry.width); 42416 const bottom = Math.min(target.top + target.height, entry.top + entry.height); 42417 const width = right - left; 42418 const height = bottom - top; 42419 if (left < right && top < bottom) { 42420 const targetArea = target.width * target.height; 42421 const entryArea = entry.width * entry.height; 42422 const intersectionArea = width * height; 42423 const intersectionRatio = intersectionArea / (targetArea + entryArea - intersectionArea); 42424 return Number(intersectionRatio.toFixed(4)); 42425 } 42426 return 0; 42427 } 42428 var rectIntersection = (_ref) => { 42429 let { 42430 collisionRect, 42431 droppableRects, 42432 droppableContainers 42433 } = _ref; 42434 const collisions = []; 42435 for (const droppableContainer of droppableContainers) { 42436 const { 42437 id 42438 } = droppableContainer; 42439 const rect = droppableRects.get(id); 42440 if (rect) { 42441 const intersectionRatio = getIntersectionRatio(rect, collisionRect); 42442 if (intersectionRatio > 0) { 42443 collisions.push({ 42444 id, 42445 data: { 42446 droppableContainer, 42447 value: intersectionRatio 42448 } 42449 }); 42450 } 42451 } 42452 } 42453 return collisions.sort(sortCollisionsDesc); 42454 }; 42455 function adjustScale(transform, rect1, rect2) { 42456 return { 42457 ...transform, 42458 scaleX: rect1 && rect2 ? rect1.width / rect2.width : 1, 42459 scaleY: rect1 && rect2 ? rect1.height / rect2.height : 1 42460 }; 42461 } 42462 function getRectDelta(rect1, rect2) { 42463 return rect1 && rect2 ? { 42464 x: rect1.left - rect2.left, 42465 y: rect1.top - rect2.top 42466 } : defaultCoordinates; 42467 } 42468 function createRectAdjustmentFn(modifier) { 42469 return function adjustClientRect(rect) { 42470 for (var _len = arguments.length, adjustments = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { 42471 adjustments[_key - 1] = arguments[_key]; 42472 } 42473 return adjustments.reduce((acc, adjustment) => ({ 42474 ...acc, 42475 top: acc.top + modifier * adjustment.y, 42476 bottom: acc.bottom + modifier * adjustment.y, 42477 left: acc.left + modifier * adjustment.x, 42478 right: acc.right + modifier * adjustment.x 42479 }), { 42480 ...rect 42481 }); 42482 }; 42483 } 42484 var getAdjustedRect = /* @__PURE__ */ createRectAdjustmentFn(1); 42485 function parseTransform(transform) { 42486 if (transform.startsWith("matrix3d(")) { 42487 const transformArray = transform.slice(9, -1).split(/, /); 42488 return { 42489 x: +transformArray[12], 42490 y: +transformArray[13], 42491 scaleX: +transformArray[0], 42492 scaleY: +transformArray[5] 42493 }; 42494 } else if (transform.startsWith("matrix(")) { 42495 const transformArray = transform.slice(7, -1).split(/, /); 42496 return { 42497 x: +transformArray[4], 42498 y: +transformArray[5], 42499 scaleX: +transformArray[0], 42500 scaleY: +transformArray[3] 42501 }; 42502 } 42503 return null; 42504 } 42505 function inverseTransform(rect, transform, transformOrigin) { 42506 const parsedTransform = parseTransform(transform); 42507 if (!parsedTransform) { 42508 return rect; 42509 } 42510 const { 42511 scaleX, 42512 scaleY, 42513 x: translateX, 42514 y: translateY 42515 } = parsedTransform; 42516 const x2 = rect.left - translateX - (1 - scaleX) * parseFloat(transformOrigin); 42517 const y2 = rect.top - translateY - (1 - scaleY) * parseFloat(transformOrigin.slice(transformOrigin.indexOf(" ") + 1)); 42518 const w2 = scaleX ? rect.width / scaleX : rect.width; 42519 const h2 = scaleY ? rect.height / scaleY : rect.height; 42520 return { 42521 width: w2, 42522 height: h2, 42523 top: y2, 42524 right: x2 + w2, 42525 bottom: y2 + h2, 42526 left: x2 42527 }; 42528 } 42529 var defaultOptions2 = { 42530 ignoreTransform: false 42531 }; 42532 function getClientRect(element, options) { 42533 if (options === void 0) { 42534 options = defaultOptions2; 42535 } 42536 let rect = element.getBoundingClientRect(); 42537 if (options.ignoreTransform) { 42538 const { 42539 transform, 42540 transformOrigin 42541 } = getWindow3(element).getComputedStyle(element); 42542 if (transform) { 42543 rect = inverseTransform(rect, transform, transformOrigin); 42544 } 42545 } 42546 const { 42547 top, 42548 left, 42549 width, 42550 height, 42551 bottom, 42552 right 42553 } = rect; 42554 return { 42555 top, 42556 left, 42557 width, 42558 height, 42559 bottom, 42560 right 42561 }; 42562 } 42563 function getTransformAgnosticClientRect(element) { 42564 return getClientRect(element, { 42565 ignoreTransform: true 42566 }); 42567 } 42568 function getWindowClientRect(element) { 42569 const width = element.innerWidth; 42570 const height = element.innerHeight; 42571 return { 42572 top: 0, 42573 left: 0, 42574 right: width, 42575 bottom: height, 42576 width, 42577 height 42578 }; 42579 } 42580 function isFixed(node, computedStyle) { 42581 if (computedStyle === void 0) { 42582 computedStyle = getWindow3(node).getComputedStyle(node); 42583 } 42584 return computedStyle.position === "fixed"; 42585 } 42586 function isScrollable2(element, computedStyle) { 42587 if (computedStyle === void 0) { 42588 computedStyle = getWindow3(element).getComputedStyle(element); 42589 } 42590 const overflowRegex = /(auto|scroll|overlay)/; 42591 const properties2 = ["overflow", "overflowX", "overflowY"]; 42592 return properties2.some((property) => { 42593 const value = computedStyle[property]; 42594 return typeof value === "string" ? overflowRegex.test(value) : false; 42595 }); 42596 } 42597 function getScrollableAncestors(element, limit) { 42598 const scrollParents = []; 42599 function findScrollableAncestors(node) { 42600 if (limit != null && scrollParents.length >= limit) { 42601 return scrollParents; 42602 } 42603 if (!node) { 42604 return scrollParents; 42605 } 42606 if (isDocument(node) && node.scrollingElement != null && !scrollParents.includes(node.scrollingElement)) { 42607 scrollParents.push(node.scrollingElement); 42608 return scrollParents; 42609 } 42610 if (!isHTMLElement2(node) || isSVGElement(node)) { 42611 return scrollParents; 42612 } 42613 if (scrollParents.includes(node)) { 42614 return scrollParents; 42615 } 42616 const computedStyle = getWindow3(element).getComputedStyle(node); 42617 if (node !== element) { 42618 if (isScrollable2(node, computedStyle)) { 42619 scrollParents.push(node); 42620 } 42621 } 42622 if (isFixed(node, computedStyle)) { 42623 return scrollParents; 42624 } 42625 return findScrollableAncestors(node.parentNode); 42626 } 42627 if (!element) { 42628 return scrollParents; 42629 } 42630 return findScrollableAncestors(element); 42631 } 42632 function getFirstScrollableAncestor(node) { 42633 const [firstScrollableAncestor] = getScrollableAncestors(node, 1); 42634 return firstScrollableAncestor != null ? firstScrollableAncestor : null; 42635 } 42636 function getScrollableElement(element) { 42637 if (!canUseDOM2 || !element) { 42638 return null; 42639 } 42640 if (isWindow(element)) { 42641 return element; 42642 } 42643 if (!isNode2(element)) { 42644 return null; 42645 } 42646 if (isDocument(element) || element === getOwnerDocument(element).scrollingElement) { 42647 return window; 42648 } 42649 if (isHTMLElement2(element)) { 42650 return element; 42651 } 42652 return null; 42653 } 42654 function getScrollXCoordinate(element) { 42655 if (isWindow(element)) { 42656 return element.scrollX; 42657 } 42658 return element.scrollLeft; 42659 } 42660 function getScrollYCoordinate(element) { 42661 if (isWindow(element)) { 42662 return element.scrollY; 42663 } 42664 return element.scrollTop; 42665 } 42666 function getScrollCoordinates(element) { 42667 return { 42668 x: getScrollXCoordinate(element), 42669 y: getScrollYCoordinate(element) 42670 }; 42671 } 42672 var Direction; 42673 (function(Direction2) { 42674 Direction2[Direction2["Forward"] = 1] = "Forward"; 42675 Direction2[Direction2["Backward"] = -1] = "Backward"; 42676 })(Direction || (Direction = {})); 42677 function isDocumentScrollingElement(element) { 42678 if (!canUseDOM2 || !element) { 42679 return false; 42680 } 42681 return element === document.scrollingElement; 42682 } 42683 function getScrollPosition(scrollingContainer) { 42684 const minScroll = { 42685 x: 0, 42686 y: 0 42687 }; 42688 const dimensions = isDocumentScrollingElement(scrollingContainer) ? { 42689 height: window.innerHeight, 42690 width: window.innerWidth 42691 } : { 42692 height: scrollingContainer.clientHeight, 42693 width: scrollingContainer.clientWidth 42694 }; 42695 const maxScroll = { 42696 x: scrollingContainer.scrollWidth - dimensions.width, 42697 y: scrollingContainer.scrollHeight - dimensions.height 42698 }; 42699 const isTop = scrollingContainer.scrollTop <= minScroll.y; 42700 const isLeft = scrollingContainer.scrollLeft <= minScroll.x; 42701 const isBottom = scrollingContainer.scrollTop >= maxScroll.y; 42702 const isRight = scrollingContainer.scrollLeft >= maxScroll.x; 42703 return { 42704 isTop, 42705 isLeft, 42706 isBottom, 42707 isRight, 42708 maxScroll, 42709 minScroll 42710 }; 42711 } 42712 var defaultThreshold = { 42713 x: 0.2, 42714 y: 0.2 42715 }; 42716 function getScrollDirectionAndSpeed(scrollContainer, scrollContainerRect, _ref, acceleration, thresholdPercentage) { 42717 let { 42718 top, 42719 left, 42720 right, 42721 bottom 42722 } = _ref; 42723 if (acceleration === void 0) { 42724 acceleration = 10; 42725 } 42726 if (thresholdPercentage === void 0) { 42727 thresholdPercentage = defaultThreshold; 42728 } 42729 const { 42730 isTop, 42731 isBottom, 42732 isLeft, 42733 isRight 42734 } = getScrollPosition(scrollContainer); 42735 const direction = { 42736 x: 0, 42737 y: 0 42738 }; 42739 const speed = { 42740 x: 0, 42741 y: 0 42742 }; 42743 const threshold = { 42744 height: scrollContainerRect.height * thresholdPercentage.y, 42745 width: scrollContainerRect.width * thresholdPercentage.x 42746 }; 42747 if (!isTop && top <= scrollContainerRect.top + threshold.height) { 42748 direction.y = Direction.Backward; 42749 speed.y = acceleration * Math.abs((scrollContainerRect.top + threshold.height - top) / threshold.height); 42750 } else if (!isBottom && bottom >= scrollContainerRect.bottom - threshold.height) { 42751 direction.y = Direction.Forward; 42752 speed.y = acceleration * Math.abs((scrollContainerRect.bottom - threshold.height - bottom) / threshold.height); 42753 } 42754 if (!isRight && right >= scrollContainerRect.right - threshold.width) { 42755 direction.x = Direction.Forward; 42756 speed.x = acceleration * Math.abs((scrollContainerRect.right - threshold.width - right) / threshold.width); 42757 } else if (!isLeft && left <= scrollContainerRect.left + threshold.width) { 42758 direction.x = Direction.Backward; 42759 speed.x = acceleration * Math.abs((scrollContainerRect.left + threshold.width - left) / threshold.width); 42760 } 42761 return { 42762 direction, 42763 speed 42764 }; 42765 } 42766 function getScrollElementRect(element) { 42767 if (element === document.scrollingElement) { 42768 const { 42769 innerWidth, 42770 innerHeight 42771 } = window; 42772 return { 42773 top: 0, 42774 left: 0, 42775 right: innerWidth, 42776 bottom: innerHeight, 42777 width: innerWidth, 42778 height: innerHeight 42779 }; 42780 } 42781 const { 42782 top, 42783 left, 42784 right, 42785 bottom 42786 } = element.getBoundingClientRect(); 42787 return { 42788 top, 42789 left, 42790 right, 42791 bottom, 42792 width: element.clientWidth, 42793 height: element.clientHeight 42794 }; 42795 } 42796 function getScrollOffsets(scrollableAncestors) { 42797 return scrollableAncestors.reduce((acc, node) => { 42798 return add(acc, getScrollCoordinates(node)); 42799 }, defaultCoordinates); 42800 } 42801 function getScrollXOffset(scrollableAncestors) { 42802 return scrollableAncestors.reduce((acc, node) => { 42803 return acc + getScrollXCoordinate(node); 42804 }, 0); 42805 } 42806 function getScrollYOffset(scrollableAncestors) { 42807 return scrollableAncestors.reduce((acc, node) => { 42808 return acc + getScrollYCoordinate(node); 42809 }, 0); 42810 } 42811 function scrollIntoViewIfNeeded2(element, measure) { 42812 if (measure === void 0) { 42813 measure = getClientRect; 42814 } 42815 if (!element) { 42816 return; 42817 } 42818 const { 42819 top, 42820 left, 42821 bottom, 42822 right 42823 } = measure(element); 42824 const firstScrollableAncestor = getFirstScrollableAncestor(element); 42825 if (!firstScrollableAncestor) { 42826 return; 42827 } 42828 if (bottom <= 0 || right <= 0 || top >= window.innerHeight || left >= window.innerWidth) { 42829 element.scrollIntoView({ 42830 block: "center", 42831 inline: "center" 42832 }); 42833 } 42834 } 42835 var properties = [["x", ["left", "right"], getScrollXOffset], ["y", ["top", "bottom"], getScrollYOffset]]; 42836 var Rect3 = class { 42837 constructor(rect, element) { 42838 this.rect = void 0; 42839 this.width = void 0; 42840 this.height = void 0; 42841 this.top = void 0; 42842 this.bottom = void 0; 42843 this.right = void 0; 42844 this.left = void 0; 42845 const scrollableAncestors = getScrollableAncestors(element); 42846 const scrollOffsets = getScrollOffsets(scrollableAncestors); 42847 this.rect = { 42848 ...rect 42849 }; 42850 this.width = rect.width; 42851 this.height = rect.height; 42852 for (const [axis, keys, getScrollOffset] of properties) { 42853 for (const key2 of keys) { 42854 Object.defineProperty(this, key2, { 42855 get: () => { 42856 const currentOffsets = getScrollOffset(scrollableAncestors); 42857 const scrollOffsetsDeltla = scrollOffsets[axis] - currentOffsets; 42858 return this.rect[key2] + scrollOffsetsDeltla; 42859 }, 42860 enumerable: true 42861 }); 42862 } 42863 } 42864 Object.defineProperty(this, "rect", { 42865 enumerable: false 42866 }); 42867 } 42868 }; 42869 var Listeners = class { 42870 constructor(target) { 42871 this.target = void 0; 42872 this.listeners = []; 42873 this.removeAll = () => { 42874 this.listeners.forEach((listener) => { 42875 var _this$target; 42876 return (_this$target = this.target) == null ? void 0 : _this$target.removeEventListener(...listener); 42877 }); 42878 }; 42879 this.target = target; 42880 } 42881 add(eventName, handler, options) { 42882 var _this$target2; 42883 (_this$target2 = this.target) == null ? void 0 : _this$target2.addEventListener(eventName, handler, options); 42884 this.listeners.push([eventName, handler, options]); 42885 } 42886 }; 42887 function getEventListenerTarget(target) { 42888 const { 42889 EventTarget 42890 } = getWindow3(target); 42891 return target instanceof EventTarget ? target : getOwnerDocument(target); 42892 } 42893 function hasExceededDistance(delta, measurement) { 42894 const dx = Math.abs(delta.x); 42895 const dy = Math.abs(delta.y); 42896 if (typeof measurement === "number") { 42897 return Math.sqrt(dx ** 2 + dy ** 2) > measurement; 42898 } 42899 if ("x" in measurement && "y" in measurement) { 42900 return dx > measurement.x && dy > measurement.y; 42901 } 42902 if ("x" in measurement) { 42903 return dx > measurement.x; 42904 } 42905 if ("y" in measurement) { 42906 return dy > measurement.y; 42907 } 42908 return false; 42909 } 42910 var EventName; 42911 (function(EventName2) { 42912 EventName2["Click"] = "click"; 42913 EventName2["DragStart"] = "dragstart"; 42914 EventName2["Keydown"] = "keydown"; 42915 EventName2["ContextMenu"] = "contextmenu"; 42916 EventName2["Resize"] = "resize"; 42917 EventName2["SelectionChange"] = "selectionchange"; 42918 EventName2["VisibilityChange"] = "visibilitychange"; 42919 })(EventName || (EventName = {})); 42920 function preventDefault(event) { 42921 event.preventDefault(); 42922 } 42923 function stopPropagation(event) { 42924 event.stopPropagation(); 42925 } 42926 var KeyboardCode; 42927 (function(KeyboardCode2) { 42928 KeyboardCode2["Space"] = "Space"; 42929 KeyboardCode2["Down"] = "ArrowDown"; 42930 KeyboardCode2["Right"] = "ArrowRight"; 42931 KeyboardCode2["Left"] = "ArrowLeft"; 42932 KeyboardCode2["Up"] = "ArrowUp"; 42933 KeyboardCode2["Esc"] = "Escape"; 42934 KeyboardCode2["Enter"] = "Enter"; 42935 KeyboardCode2["Tab"] = "Tab"; 42936 })(KeyboardCode || (KeyboardCode = {})); 42937 var defaultKeyboardCodes = { 42938 start: [KeyboardCode.Space, KeyboardCode.Enter], 42939 cancel: [KeyboardCode.Esc], 42940 end: [KeyboardCode.Space, KeyboardCode.Enter, KeyboardCode.Tab] 42941 }; 42942 var defaultKeyboardCoordinateGetter = (event, _ref) => { 42943 let { 42944 currentCoordinates 42945 } = _ref; 42946 switch (event.code) { 42947 case KeyboardCode.Right: 42948 return { 42949 ...currentCoordinates, 42950 x: currentCoordinates.x + 25 42951 }; 42952 case KeyboardCode.Left: 42953 return { 42954 ...currentCoordinates, 42955 x: currentCoordinates.x - 25 42956 }; 42957 case KeyboardCode.Down: 42958 return { 42959 ...currentCoordinates, 42960 y: currentCoordinates.y + 25 42961 }; 42962 case KeyboardCode.Up: 42963 return { 42964 ...currentCoordinates, 42965 y: currentCoordinates.y - 25 42966 }; 42967 } 42968 return void 0; 42969 }; 42970 var KeyboardSensor = class { 42971 constructor(props) { 42972 this.props = void 0; 42973 this.autoScrollEnabled = false; 42974 this.referenceCoordinates = void 0; 42975 this.listeners = void 0; 42976 this.windowListeners = void 0; 42977 this.props = props; 42978 const { 42979 event: { 42980 target 42981 } 42982 } = props; 42983 this.props = props; 42984 this.listeners = new Listeners(getOwnerDocument(target)); 42985 this.windowListeners = new Listeners(getWindow3(target)); 42986 this.handleKeyDown = this.handleKeyDown.bind(this); 42987 this.handleCancel = this.handleCancel.bind(this); 42988 this.attach(); 42989 } 42990 attach() { 42991 this.handleStart(); 42992 this.windowListeners.add(EventName.Resize, this.handleCancel); 42993 this.windowListeners.add(EventName.VisibilityChange, this.handleCancel); 42994 setTimeout(() => this.listeners.add(EventName.Keydown, this.handleKeyDown)); 42995 } 42996 handleStart() { 42997 const { 42998 activeNode, 42999 onStart 43000 } = this.props; 43001 const node = activeNode.node.current; 43002 if (node) { 43003 scrollIntoViewIfNeeded2(node); 43004 } 43005 onStart(defaultCoordinates); 43006 } 43007 handleKeyDown(event) { 43008 if (isKeyboardEvent(event)) { 43009 const { 43010 active, 43011 context, 43012 options 43013 } = this.props; 43014 const { 43015 keyboardCodes = defaultKeyboardCodes, 43016 coordinateGetter = defaultKeyboardCoordinateGetter, 43017 scrollBehavior = "smooth" 43018 } = options; 43019 const { 43020 code 43021 } = event; 43022 if (keyboardCodes.end.includes(code)) { 43023 this.handleEnd(event); 43024 return; 43025 } 43026 if (keyboardCodes.cancel.includes(code)) { 43027 this.handleCancel(event); 43028 return; 43029 } 43030 const { 43031 collisionRect 43032 } = context.current; 43033 const currentCoordinates = collisionRect ? { 43034 x: collisionRect.left, 43035 y: collisionRect.top 43036 } : defaultCoordinates; 43037 if (!this.referenceCoordinates) { 43038 this.referenceCoordinates = currentCoordinates; 43039 } 43040 const newCoordinates = coordinateGetter(event, { 43041 active, 43042 context: context.current, 43043 currentCoordinates 43044 }); 43045 if (newCoordinates) { 43046 const coordinatesDelta = subtract(newCoordinates, currentCoordinates); 43047 const scrollDelta = { 43048 x: 0, 43049 y: 0 43050 }; 43051 const { 43052 scrollableAncestors 43053 } = context.current; 43054 for (const scrollContainer of scrollableAncestors) { 43055 const direction = event.code; 43056 const { 43057 isTop, 43058 isRight, 43059 isLeft, 43060 isBottom, 43061 maxScroll, 43062 minScroll 43063 } = getScrollPosition(scrollContainer); 43064 const scrollElementRect = getScrollElementRect(scrollContainer); 43065 const clampedCoordinates = { 43066 x: Math.min(direction === KeyboardCode.Right ? scrollElementRect.right - scrollElementRect.width / 2 : scrollElementRect.right, Math.max(direction === KeyboardCode.Right ? scrollElementRect.left : scrollElementRect.left + scrollElementRect.width / 2, newCoordinates.x)), 43067 y: Math.min(direction === KeyboardCode.Down ? scrollElementRect.bottom - scrollElementRect.height / 2 : scrollElementRect.bottom, Math.max(direction === KeyboardCode.Down ? scrollElementRect.top : scrollElementRect.top + scrollElementRect.height / 2, newCoordinates.y)) 43068 }; 43069 const canScrollX = direction === KeyboardCode.Right && !isRight || direction === KeyboardCode.Left && !isLeft; 43070 const canScrollY = direction === KeyboardCode.Down && !isBottom || direction === KeyboardCode.Up && !isTop; 43071 if (canScrollX && clampedCoordinates.x !== newCoordinates.x) { 43072 const newScrollCoordinates = scrollContainer.scrollLeft + coordinatesDelta.x; 43073 const canScrollToNewCoordinates = direction === KeyboardCode.Right && newScrollCoordinates <= maxScroll.x || direction === KeyboardCode.Left && newScrollCoordinates >= minScroll.x; 43074 if (canScrollToNewCoordinates && !coordinatesDelta.y) { 43075 scrollContainer.scrollTo({ 43076 left: newScrollCoordinates, 43077 behavior: scrollBehavior 43078 }); 43079 return; 43080 } 43081 if (canScrollToNewCoordinates) { 43082 scrollDelta.x = scrollContainer.scrollLeft - newScrollCoordinates; 43083 } else { 43084 scrollDelta.x = direction === KeyboardCode.Right ? scrollContainer.scrollLeft - maxScroll.x : scrollContainer.scrollLeft - minScroll.x; 43085 } 43086 if (scrollDelta.x) { 43087 scrollContainer.scrollBy({ 43088 left: -scrollDelta.x, 43089 behavior: scrollBehavior 43090 }); 43091 } 43092 break; 43093 } else if (canScrollY && clampedCoordinates.y !== newCoordinates.y) { 43094 const newScrollCoordinates = scrollContainer.scrollTop + coordinatesDelta.y; 43095 const canScrollToNewCoordinates = direction === KeyboardCode.Down && newScrollCoordinates <= maxScroll.y || direction === KeyboardCode.Up && newScrollCoordinates >= minScroll.y; 43096 if (canScrollToNewCoordinates && !coordinatesDelta.x) { 43097 scrollContainer.scrollTo({ 43098 top: newScrollCoordinates, 43099 behavior: scrollBehavior 43100 }); 43101 return; 43102 } 43103 if (canScrollToNewCoordinates) { 43104 scrollDelta.y = scrollContainer.scrollTop - newScrollCoordinates; 43105 } else { 43106 scrollDelta.y = direction === KeyboardCode.Down ? scrollContainer.scrollTop - maxScroll.y : scrollContainer.scrollTop - minScroll.y; 43107 } 43108 if (scrollDelta.y) { 43109 scrollContainer.scrollBy({ 43110 top: -scrollDelta.y, 43111 behavior: scrollBehavior 43112 }); 43113 } 43114 break; 43115 } 43116 } 43117 this.handleMove(event, add(subtract(newCoordinates, this.referenceCoordinates), scrollDelta)); 43118 } 43119 } 43120 } 43121 handleMove(event, coordinates) { 43122 const { 43123 onMove 43124 } = this.props; 43125 event.preventDefault(); 43126 onMove(coordinates); 43127 } 43128 handleEnd(event) { 43129 const { 43130 onEnd 43131 } = this.props; 43132 event.preventDefault(); 43133 this.detach(); 43134 onEnd(); 43135 } 43136 handleCancel(event) { 43137 const { 43138 onCancel 43139 } = this.props; 43140 event.preventDefault(); 43141 this.detach(); 43142 onCancel(); 43143 } 43144 detach() { 43145 this.listeners.removeAll(); 43146 this.windowListeners.removeAll(); 43147 } 43148 }; 43149 KeyboardSensor.activators = [{ 43150 eventName: "onKeyDown", 43151 handler: (event, _ref, _ref2) => { 43152 let { 43153 keyboardCodes = defaultKeyboardCodes, 43154 onActivation 43155 } = _ref; 43156 let { 43157 active 43158 } = _ref2; 43159 const { 43160 code 43161 } = event.nativeEvent; 43162 if (keyboardCodes.start.includes(code)) { 43163 const activator = active.activatorNode.current; 43164 if (activator && event.target !== activator) { 43165 return false; 43166 } 43167 event.preventDefault(); 43168 onActivation == null ? void 0 : onActivation({ 43169 event: event.nativeEvent 43170 }); 43171 return true; 43172 } 43173 return false; 43174 } 43175 }]; 43176 function isDistanceConstraint(constraint) { 43177 return Boolean(constraint && "distance" in constraint); 43178 } 43179 function isDelayConstraint(constraint) { 43180 return Boolean(constraint && "delay" in constraint); 43181 } 43182 var AbstractPointerSensor = class { 43183 constructor(props, events2, listenerTarget) { 43184 var _getEventCoordinates; 43185 if (listenerTarget === void 0) { 43186 listenerTarget = getEventListenerTarget(props.event.target); 43187 } 43188 this.props = void 0; 43189 this.events = void 0; 43190 this.autoScrollEnabled = true; 43191 this.document = void 0; 43192 this.activated = false; 43193 this.initialCoordinates = void 0; 43194 this.timeoutId = null; 43195 this.listeners = void 0; 43196 this.documentListeners = void 0; 43197 this.windowListeners = void 0; 43198 this.props = props; 43199 this.events = events2; 43200 const { 43201 event 43202 } = props; 43203 const { 43204 target 43205 } = event; 43206 this.props = props; 43207 this.events = events2; 43208 this.document = getOwnerDocument(target); 43209 this.documentListeners = new Listeners(this.document); 43210 this.listeners = new Listeners(listenerTarget); 43211 this.windowListeners = new Listeners(getWindow3(target)); 43212 this.initialCoordinates = (_getEventCoordinates = getEventCoordinates(event)) != null ? _getEventCoordinates : defaultCoordinates; 43213 this.handleStart = this.handleStart.bind(this); 43214 this.handleMove = this.handleMove.bind(this); 43215 this.handleEnd = this.handleEnd.bind(this); 43216 this.handleCancel = this.handleCancel.bind(this); 43217 this.handleKeydown = this.handleKeydown.bind(this); 43218 this.removeTextSelection = this.removeTextSelection.bind(this); 43219 this.attach(); 43220 } 43221 attach() { 43222 const { 43223 events: events2, 43224 props: { 43225 options: { 43226 activationConstraint, 43227 bypassActivationConstraint 43228 } 43229 } 43230 } = this; 43231 this.listeners.add(events2.move.name, this.handleMove, { 43232 passive: false 43233 }); 43234 this.listeners.add(events2.end.name, this.handleEnd); 43235 if (events2.cancel) { 43236 this.listeners.add(events2.cancel.name, this.handleCancel); 43237 } 43238 this.windowListeners.add(EventName.Resize, this.handleCancel); 43239 this.windowListeners.add(EventName.DragStart, preventDefault); 43240 this.windowListeners.add(EventName.VisibilityChange, this.handleCancel); 43241 this.windowListeners.add(EventName.ContextMenu, preventDefault); 43242 this.documentListeners.add(EventName.Keydown, this.handleKeydown); 43243 if (activationConstraint) { 43244 if (bypassActivationConstraint != null && bypassActivationConstraint({ 43245 event: this.props.event, 43246 activeNode: this.props.activeNode, 43247 options: this.props.options 43248 })) { 43249 return this.handleStart(); 43250 } 43251 if (isDelayConstraint(activationConstraint)) { 43252 this.timeoutId = setTimeout(this.handleStart, activationConstraint.delay); 43253 this.handlePending(activationConstraint); 43254 return; 43255 } 43256 if (isDistanceConstraint(activationConstraint)) { 43257 this.handlePending(activationConstraint); 43258 return; 43259 } 43260 } 43261 this.handleStart(); 43262 } 43263 detach() { 43264 this.listeners.removeAll(); 43265 this.windowListeners.removeAll(); 43266 setTimeout(this.documentListeners.removeAll, 50); 43267 if (this.timeoutId !== null) { 43268 clearTimeout(this.timeoutId); 43269 this.timeoutId = null; 43270 } 43271 } 43272 handlePending(constraint, offset4) { 43273 const { 43274 active, 43275 onPending 43276 } = this.props; 43277 onPending(active, constraint, this.initialCoordinates, offset4); 43278 } 43279 handleStart() { 43280 const { 43281 initialCoordinates 43282 } = this; 43283 const { 43284 onStart 43285 } = this.props; 43286 if (initialCoordinates) { 43287 this.activated = true; 43288 this.documentListeners.add(EventName.Click, stopPropagation, { 43289 capture: true 43290 }); 43291 this.removeTextSelection(); 43292 this.documentListeners.add(EventName.SelectionChange, this.removeTextSelection); 43293 onStart(initialCoordinates); 43294 } 43295 } 43296 handleMove(event) { 43297 var _getEventCoordinates2; 43298 const { 43299 activated, 43300 initialCoordinates, 43301 props 43302 } = this; 43303 const { 43304 onMove, 43305 options: { 43306 activationConstraint 43307 } 43308 } = props; 43309 if (!initialCoordinates) { 43310 return; 43311 } 43312 const coordinates = (_getEventCoordinates2 = getEventCoordinates(event)) != null ? _getEventCoordinates2 : defaultCoordinates; 43313 const delta = subtract(initialCoordinates, coordinates); 43314 if (!activated && activationConstraint) { 43315 if (isDistanceConstraint(activationConstraint)) { 43316 if (activationConstraint.tolerance != null && hasExceededDistance(delta, activationConstraint.tolerance)) { 43317 return this.handleCancel(); 43318 } 43319 if (hasExceededDistance(delta, activationConstraint.distance)) { 43320 return this.handleStart(); 43321 } 43322 } 43323 if (isDelayConstraint(activationConstraint)) { 43324 if (hasExceededDistance(delta, activationConstraint.tolerance)) { 43325 return this.handleCancel(); 43326 } 43327 } 43328 this.handlePending(activationConstraint, delta); 43329 return; 43330 } 43331 if (event.cancelable) { 43332 event.preventDefault(); 43333 } 43334 onMove(coordinates); 43335 } 43336 handleEnd() { 43337 const { 43338 onAbort, 43339 onEnd 43340 } = this.props; 43341 this.detach(); 43342 if (!this.activated) { 43343 onAbort(this.props.active); 43344 } 43345 onEnd(); 43346 } 43347 handleCancel() { 43348 const { 43349 onAbort, 43350 onCancel 43351 } = this.props; 43352 this.detach(); 43353 if (!this.activated) { 43354 onAbort(this.props.active); 43355 } 43356 onCancel(); 43357 } 43358 handleKeydown(event) { 43359 if (event.code === KeyboardCode.Esc) { 43360 this.handleCancel(); 43361 } 43362 } 43363 removeTextSelection() { 43364 var _this$document$getSel; 43365 (_this$document$getSel = this.document.getSelection()) == null ? void 0 : _this$document$getSel.removeAllRanges(); 43366 } 43367 }; 43368 var events = { 43369 cancel: { 43370 name: "pointercancel" 43371 }, 43372 move: { 43373 name: "pointermove" 43374 }, 43375 end: { 43376 name: "pointerup" 43377 } 43378 }; 43379 var PointerSensor = class extends AbstractPointerSensor { 43380 constructor(props) { 43381 const { 43382 event 43383 } = props; 43384 const listenerTarget = getOwnerDocument(event.target); 43385 super(props, events, listenerTarget); 43386 } 43387 }; 43388 PointerSensor.activators = [{ 43389 eventName: "onPointerDown", 43390 handler: (_ref, _ref2) => { 43391 let { 43392 nativeEvent: event 43393 } = _ref; 43394 let { 43395 onActivation 43396 } = _ref2; 43397 if (!event.isPrimary || event.button !== 0) { 43398 return false; 43399 } 43400 onActivation == null ? void 0 : onActivation({ 43401 event 43402 }); 43403 return true; 43404 } 43405 }]; 43406 var events$1 = { 43407 move: { 43408 name: "mousemove" 43409 }, 43410 end: { 43411 name: "mouseup" 43412 } 43413 }; 43414 var MouseButton; 43415 (function(MouseButton2) { 43416 MouseButton2[MouseButton2["RightClick"] = 2] = "RightClick"; 43417 })(MouseButton || (MouseButton = {})); 43418 var MouseSensor = class extends AbstractPointerSensor { 43419 constructor(props) { 43420 super(props, events$1, getOwnerDocument(props.event.target)); 43421 } 43422 }; 43423 MouseSensor.activators = [{ 43424 eventName: "onMouseDown", 43425 handler: (_ref, _ref2) => { 43426 let { 43427 nativeEvent: event 43428 } = _ref; 43429 let { 43430 onActivation 43431 } = _ref2; 43432 if (event.button === MouseButton.RightClick) { 43433 return false; 43434 } 43435 onActivation == null ? void 0 : onActivation({ 43436 event 43437 }); 43438 return true; 43439 } 43440 }]; 43441 var events$2 = { 43442 cancel: { 43443 name: "touchcancel" 43444 }, 43445 move: { 43446 name: "touchmove" 43447 }, 43448 end: { 43449 name: "touchend" 43450 } 43451 }; 43452 var TouchSensor = class extends AbstractPointerSensor { 43453 constructor(props) { 43454 super(props, events$2); 43455 } 43456 static setup() { 43457 window.addEventListener(events$2.move.name, noop7, { 43458 capture: false, 43459 passive: false 43460 }); 43461 return function teardown() { 43462 window.removeEventListener(events$2.move.name, noop7); 43463 }; 43464 function noop7() { 43465 } 43466 } 43467 }; 43468 TouchSensor.activators = [{ 43469 eventName: "onTouchStart", 43470 handler: (_ref, _ref2) => { 43471 let { 43472 nativeEvent: event 43473 } = _ref; 43474 let { 43475 onActivation 43476 } = _ref2; 43477 const { 43478 touches 43479 } = event; 43480 if (touches.length > 1) { 43481 return false; 43482 } 43483 onActivation == null ? void 0 : onActivation({ 43484 event 43485 }); 43486 return true; 43487 } 43488 }]; 43489 var AutoScrollActivator; 43490 (function(AutoScrollActivator2) { 43491 AutoScrollActivator2[AutoScrollActivator2["Pointer"] = 0] = "Pointer"; 43492 AutoScrollActivator2[AutoScrollActivator2["DraggableRect"] = 1] = "DraggableRect"; 43493 })(AutoScrollActivator || (AutoScrollActivator = {})); 43494 var TraversalOrder; 43495 (function(TraversalOrder2) { 43496 TraversalOrder2[TraversalOrder2["TreeOrder"] = 0] = "TreeOrder"; 43497 TraversalOrder2[TraversalOrder2["ReversedTreeOrder"] = 1] = "ReversedTreeOrder"; 43498 })(TraversalOrder || (TraversalOrder = {})); 43499 function useAutoScroller(_ref) { 43500 let { 43501 acceleration, 43502 activator = AutoScrollActivator.Pointer, 43503 canScroll, 43504 draggingRect, 43505 enabled, 43506 interval = 5, 43507 order = TraversalOrder.TreeOrder, 43508 pointerCoordinates, 43509 scrollableAncestors, 43510 scrollableAncestorRects, 43511 delta, 43512 threshold 43513 } = _ref; 43514 const scrollIntent = useScrollIntent({ 43515 delta, 43516 disabled: !enabled 43517 }); 43518 const [setAutoScrollInterval, clearAutoScrollInterval] = useInterval(); 43519 const scrollSpeed = (0, import_react45.useRef)({ 43520 x: 0, 43521 y: 0 43522 }); 43523 const scrollDirection = (0, import_react45.useRef)({ 43524 x: 0, 43525 y: 0 43526 }); 43527 const rect = (0, import_react45.useMemo)(() => { 43528 switch (activator) { 43529 case AutoScrollActivator.Pointer: 43530 return pointerCoordinates ? { 43531 top: pointerCoordinates.y, 43532 bottom: pointerCoordinates.y, 43533 left: pointerCoordinates.x, 43534 right: pointerCoordinates.x 43535 } : null; 43536 case AutoScrollActivator.DraggableRect: 43537 return draggingRect; 43538 } 43539 }, [activator, draggingRect, pointerCoordinates]); 43540 const scrollContainerRef = (0, import_react45.useRef)(null); 43541 const autoScroll = (0, import_react45.useCallback)(() => { 43542 const scrollContainer = scrollContainerRef.current; 43543 if (!scrollContainer) { 43544 return; 43545 } 43546 const scrollLeft = scrollSpeed.current.x * scrollDirection.current.x; 43547 const scrollTop = scrollSpeed.current.y * scrollDirection.current.y; 43548 scrollContainer.scrollBy(scrollLeft, scrollTop); 43549 }, []); 43550 const sortedScrollableAncestors = (0, import_react45.useMemo)(() => order === TraversalOrder.TreeOrder ? [...scrollableAncestors].reverse() : scrollableAncestors, [order, scrollableAncestors]); 43551 (0, import_react45.useEffect)( 43552 () => { 43553 if (!enabled || !scrollableAncestors.length || !rect) { 43554 clearAutoScrollInterval(); 43555 return; 43556 } 43557 for (const scrollContainer of sortedScrollableAncestors) { 43558 if ((canScroll == null ? void 0 : canScroll(scrollContainer)) === false) { 43559 continue; 43560 } 43561 const index2 = scrollableAncestors.indexOf(scrollContainer); 43562 const scrollContainerRect = scrollableAncestorRects[index2]; 43563 if (!scrollContainerRect) { 43564 continue; 43565 } 43566 const { 43567 direction, 43568 speed 43569 } = getScrollDirectionAndSpeed(scrollContainer, scrollContainerRect, rect, acceleration, threshold); 43570 for (const axis of ["x", "y"]) { 43571 if (!scrollIntent[axis][direction[axis]]) { 43572 speed[axis] = 0; 43573 direction[axis] = 0; 43574 } 43575 } 43576 if (speed.x > 0 || speed.y > 0) { 43577 clearAutoScrollInterval(); 43578 scrollContainerRef.current = scrollContainer; 43579 setAutoScrollInterval(autoScroll, interval); 43580 scrollSpeed.current = speed; 43581 scrollDirection.current = direction; 43582 return; 43583 } 43584 } 43585 scrollSpeed.current = { 43586 x: 0, 43587 y: 0 43588 }; 43589 scrollDirection.current = { 43590 x: 0, 43591 y: 0 43592 }; 43593 clearAutoScrollInterval(); 43594 }, 43595 // eslint-disable-next-line react-hooks/exhaustive-deps 43596 [ 43597 acceleration, 43598 autoScroll, 43599 canScroll, 43600 clearAutoScrollInterval, 43601 enabled, 43602 interval, 43603 // eslint-disable-next-line react-hooks/exhaustive-deps 43604 JSON.stringify(rect), 43605 // eslint-disable-next-line react-hooks/exhaustive-deps 43606 JSON.stringify(scrollIntent), 43607 setAutoScrollInterval, 43608 scrollableAncestors, 43609 sortedScrollableAncestors, 43610 scrollableAncestorRects, 43611 // eslint-disable-next-line react-hooks/exhaustive-deps 43612 JSON.stringify(threshold) 43613 ] 43614 ); 43615 } 43616 var defaultScrollIntent = { 43617 x: { 43618 [Direction.Backward]: false, 43619 [Direction.Forward]: false 43620 }, 43621 y: { 43622 [Direction.Backward]: false, 43623 [Direction.Forward]: false 43624 } 43625 }; 43626 function useScrollIntent(_ref2) { 43627 let { 43628 delta, 43629 disabled: disabled2 43630 } = _ref2; 43631 const previousDelta = usePrevious2(delta); 43632 return useLazyMemo((previousIntent) => { 43633 if (disabled2 || !previousDelta || !previousIntent) { 43634 return defaultScrollIntent; 43635 } 43636 const direction = { 43637 x: Math.sign(delta.x - previousDelta.x), 43638 y: Math.sign(delta.y - previousDelta.y) 43639 }; 43640 return { 43641 x: { 43642 [Direction.Backward]: previousIntent.x[Direction.Backward] || direction.x === -1, 43643 [Direction.Forward]: previousIntent.x[Direction.Forward] || direction.x === 1 43644 }, 43645 y: { 43646 [Direction.Backward]: previousIntent.y[Direction.Backward] || direction.y === -1, 43647 [Direction.Forward]: previousIntent.y[Direction.Forward] || direction.y === 1 43648 } 43649 }; 43650 }, [disabled2, delta, previousDelta]); 43651 } 43652 function useCachedNode(draggableNodes, id) { 43653 const draggableNode = id != null ? draggableNodes.get(id) : void 0; 43654 const node = draggableNode ? draggableNode.node.current : null; 43655 return useLazyMemo((cachedNode) => { 43656 var _ref; 43657 if (id == null) { 43658 return null; 43659 } 43660 return (_ref = node != null ? node : cachedNode) != null ? _ref : null; 43661 }, [node, id]); 43662 } 43663 function useCombineActivators(sensors, getSyntheticHandler) { 43664 return (0, import_react45.useMemo)(() => sensors.reduce((accumulator, sensor) => { 43665 const { 43666 sensor: Sensor 43667 } = sensor; 43668 const sensorActivators = Sensor.activators.map((activator) => ({ 43669 eventName: activator.eventName, 43670 handler: getSyntheticHandler(activator.handler, sensor) 43671 })); 43672 return [...accumulator, ...sensorActivators]; 43673 }, []), [sensors, getSyntheticHandler]); 43674 } 43675 var MeasuringStrategy; 43676 (function(MeasuringStrategy2) { 43677 MeasuringStrategy2[MeasuringStrategy2["Always"] = 0] = "Always"; 43678 MeasuringStrategy2[MeasuringStrategy2["BeforeDragging"] = 1] = "BeforeDragging"; 43679 MeasuringStrategy2[MeasuringStrategy2["WhileDragging"] = 2] = "WhileDragging"; 43680 })(MeasuringStrategy || (MeasuringStrategy = {})); 43681 var MeasuringFrequency; 43682 (function(MeasuringFrequency2) { 43683 MeasuringFrequency2["Optimized"] = "optimized"; 43684 })(MeasuringFrequency || (MeasuringFrequency = {})); 43685 var defaultValue2 = /* @__PURE__ */ new Map(); 43686 function useDroppableMeasuring(containers, _ref) { 43687 let { 43688 dragging, 43689 dependencies, 43690 config 43691 } = _ref; 43692 const [queue, setQueue] = (0, import_react45.useState)(null); 43693 const { 43694 frequency, 43695 measure, 43696 strategy 43697 } = config; 43698 const containersRef = (0, import_react45.useRef)(containers); 43699 const disabled2 = isDisabled(); 43700 const disabledRef = useLatestValue(disabled2); 43701 const measureDroppableContainers = (0, import_react45.useCallback)(function(ids2) { 43702 if (ids2 === void 0) { 43703 ids2 = []; 43704 } 43705 if (disabledRef.current) { 43706 return; 43707 } 43708 setQueue((value) => { 43709 if (value === null) { 43710 return ids2; 43711 } 43712 return value.concat(ids2.filter((id) => !value.includes(id))); 43713 }); 43714 }, [disabledRef]); 43715 const timeoutId = (0, import_react45.useRef)(null); 43716 const droppableRects = useLazyMemo((previousValue) => { 43717 if (disabled2 && !dragging) { 43718 return defaultValue2; 43719 } 43720 if (!previousValue || previousValue === defaultValue2 || containersRef.current !== containers || queue != null) { 43721 const map = /* @__PURE__ */ new Map(); 43722 for (let container of containers) { 43723 if (!container) { 43724 continue; 43725 } 43726 if (queue && queue.length > 0 && !queue.includes(container.id) && container.rect.current) { 43727 map.set(container.id, container.rect.current); 43728 continue; 43729 } 43730 const node = container.node.current; 43731 const rect = node ? new Rect3(measure(node), node) : null; 43732 container.rect.current = rect; 43733 if (rect) { 43734 map.set(container.id, rect); 43735 } 43736 } 43737 return map; 43738 } 43739 return previousValue; 43740 }, [containers, queue, dragging, disabled2, measure]); 43741 (0, import_react45.useEffect)(() => { 43742 containersRef.current = containers; 43743 }, [containers]); 43744 (0, import_react45.useEffect)( 43745 () => { 43746 if (disabled2) { 43747 return; 43748 } 43749 measureDroppableContainers(); 43750 }, 43751 // eslint-disable-next-line react-hooks/exhaustive-deps 43752 [dragging, disabled2] 43753 ); 43754 (0, import_react45.useEffect)( 43755 () => { 43756 if (queue && queue.length > 0) { 43757 setQueue(null); 43758 } 43759 }, 43760 //eslint-disable-next-line react-hooks/exhaustive-deps 43761 [JSON.stringify(queue)] 43762 ); 43763 (0, import_react45.useEffect)( 43764 () => { 43765 if (disabled2 || typeof frequency !== "number" || timeoutId.current !== null) { 43766 return; 43767 } 43768 timeoutId.current = setTimeout(() => { 43769 measureDroppableContainers(); 43770 timeoutId.current = null; 43771 }, frequency); 43772 }, 43773 // eslint-disable-next-line react-hooks/exhaustive-deps 43774 [frequency, disabled2, measureDroppableContainers, ...dependencies] 43775 ); 43776 return { 43777 droppableRects, 43778 measureDroppableContainers, 43779 measuringScheduled: queue != null 43780 }; 43781 function isDisabled() { 43782 switch (strategy) { 43783 case MeasuringStrategy.Always: 43784 return false; 43785 case MeasuringStrategy.BeforeDragging: 43786 return dragging; 43787 default: 43788 return !dragging; 43789 } 43790 } 43791 } 43792 function useInitialValue2(value, computeFn) { 43793 return useLazyMemo((previousValue) => { 43794 if (!value) { 43795 return null; 43796 } 43797 if (previousValue) { 43798 return previousValue; 43799 } 43800 return typeof computeFn === "function" ? computeFn(value) : value; 43801 }, [computeFn, value]); 43802 } 43803 function useInitialRect(node, measure) { 43804 return useInitialValue2(node, measure); 43805 } 43806 function useMutationObserver(_ref) { 43807 let { 43808 callback, 43809 disabled: disabled2 43810 } = _ref; 43811 const handleMutations = useEvent3(callback); 43812 const mutationObserver = (0, import_react45.useMemo)(() => { 43813 if (disabled2 || typeof window === "undefined" || typeof window.MutationObserver === "undefined") { 43814 return void 0; 43815 } 43816 const { 43817 MutationObserver: MutationObserver2 43818 } = window; 43819 return new MutationObserver2(handleMutations); 43820 }, [handleMutations, disabled2]); 43821 (0, import_react45.useEffect)(() => { 43822 return () => mutationObserver == null ? void 0 : mutationObserver.disconnect(); 43823 }, [mutationObserver]); 43824 return mutationObserver; 43825 } 43826 function useResizeObserver2(_ref) { 43827 let { 43828 callback, 43829 disabled: disabled2 43830 } = _ref; 43831 const handleResize = useEvent3(callback); 43832 const resizeObserver = (0, import_react45.useMemo)( 43833 () => { 43834 if (disabled2 || typeof window === "undefined" || typeof window.ResizeObserver === "undefined") { 43835 return void 0; 43836 } 43837 const { 43838 ResizeObserver: ResizeObserver2 43839 } = window; 43840 return new ResizeObserver2(handleResize); 43841 }, 43842 // eslint-disable-next-line react-hooks/exhaustive-deps 43843 [disabled2] 43844 ); 43845 (0, import_react45.useEffect)(() => { 43846 return () => resizeObserver == null ? void 0 : resizeObserver.disconnect(); 43847 }, [resizeObserver]); 43848 return resizeObserver; 43849 } 43850 function defaultMeasure(element) { 43851 return new Rect3(getClientRect(element), element); 43852 } 43853 function useRect(element, measure, fallbackRect) { 43854 if (measure === void 0) { 43855 measure = defaultMeasure; 43856 } 43857 const [rect, setRect] = (0, import_react45.useState)(null); 43858 function measureRect() { 43859 setRect((currentRect) => { 43860 if (!element) { 43861 return null; 43862 } 43863 if (element.isConnected === false) { 43864 var _ref; 43865 return (_ref = currentRect != null ? currentRect : fallbackRect) != null ? _ref : null; 43866 } 43867 const newRect = measure(element); 43868 if (JSON.stringify(currentRect) === JSON.stringify(newRect)) { 43869 return currentRect; 43870 } 43871 return newRect; 43872 }); 43873 } 43874 const mutationObserver = useMutationObserver({ 43875 callback(records) { 43876 if (!element) { 43877 return; 43878 } 43879 for (const record of records) { 43880 const { 43881 type, 43882 target 43883 } = record; 43884 if (type === "childList" && target instanceof HTMLElement && target.contains(element)) { 43885 measureRect(); 43886 break; 43887 } 43888 } 43889 } 43890 }); 43891 const resizeObserver = useResizeObserver2({ 43892 callback: measureRect 43893 }); 43894 useIsomorphicLayoutEffect(() => { 43895 measureRect(); 43896 if (element) { 43897 resizeObserver == null ? void 0 : resizeObserver.observe(element); 43898 mutationObserver == null ? void 0 : mutationObserver.observe(document.body, { 43899 childList: true, 43900 subtree: true 43901 }); 43902 } else { 43903 resizeObserver == null ? void 0 : resizeObserver.disconnect(); 43904 mutationObserver == null ? void 0 : mutationObserver.disconnect(); 43905 } 43906 }, [element]); 43907 return rect; 43908 } 43909 function useRectDelta(rect) { 43910 const initialRect = useInitialValue2(rect); 43911 return getRectDelta(rect, initialRect); 43912 } 43913 var defaultValue$1 = []; 43914 function useScrollableAncestors(node) { 43915 const previousNode = (0, import_react45.useRef)(node); 43916 const ancestors = useLazyMemo((previousValue) => { 43917 if (!node) { 43918 return defaultValue$1; 43919 } 43920 if (previousValue && previousValue !== defaultValue$1 && node && previousNode.current && node.parentNode === previousNode.current.parentNode) { 43921 return previousValue; 43922 } 43923 return getScrollableAncestors(node); 43924 }, [node]); 43925 (0, import_react45.useEffect)(() => { 43926 previousNode.current = node; 43927 }, [node]); 43928 return ancestors; 43929 } 43930 function useScrollOffsets(elements) { 43931 const [scrollCoordinates, setScrollCoordinates] = (0, import_react45.useState)(null); 43932 const prevElements = (0, import_react45.useRef)(elements); 43933 const handleScroll = (0, import_react45.useCallback)((event) => { 43934 const scrollingElement = getScrollableElement(event.target); 43935 if (!scrollingElement) { 43936 return; 43937 } 43938 setScrollCoordinates((scrollCoordinates2) => { 43939 if (!scrollCoordinates2) { 43940 return null; 43941 } 43942 scrollCoordinates2.set(scrollingElement, getScrollCoordinates(scrollingElement)); 43943 return new Map(scrollCoordinates2); 43944 }); 43945 }, []); 43946 (0, import_react45.useEffect)(() => { 43947 const previousElements = prevElements.current; 43948 if (elements !== previousElements) { 43949 cleanup(previousElements); 43950 const entries = elements.map((element) => { 43951 const scrollableElement = getScrollableElement(element); 43952 if (scrollableElement) { 43953 scrollableElement.addEventListener("scroll", handleScroll, { 43954 passive: true 43955 }); 43956 return [scrollableElement, getScrollCoordinates(scrollableElement)]; 43957 } 43958 return null; 43959 }).filter((entry) => entry != null); 43960 setScrollCoordinates(entries.length ? new Map(entries) : null); 43961 prevElements.current = elements; 43962 } 43963 return () => { 43964 cleanup(elements); 43965 cleanup(previousElements); 43966 }; 43967 function cleanup(elements2) { 43968 elements2.forEach((element) => { 43969 const scrollableElement = getScrollableElement(element); 43970 scrollableElement == null ? void 0 : scrollableElement.removeEventListener("scroll", handleScroll); 43971 }); 43972 } 43973 }, [handleScroll, elements]); 43974 return (0, import_react45.useMemo)(() => { 43975 if (elements.length) { 43976 return scrollCoordinates ? Array.from(scrollCoordinates.values()).reduce((acc, coordinates) => add(acc, coordinates), defaultCoordinates) : getScrollOffsets(elements); 43977 } 43978 return defaultCoordinates; 43979 }, [elements, scrollCoordinates]); 43980 } 43981 function useScrollOffsetsDelta(scrollOffsets, dependencies) { 43982 if (dependencies === void 0) { 43983 dependencies = []; 43984 } 43985 const initialScrollOffsets = (0, import_react45.useRef)(null); 43986 (0, import_react45.useEffect)( 43987 () => { 43988 initialScrollOffsets.current = null; 43989 }, 43990 // eslint-disable-next-line react-hooks/exhaustive-deps 43991 dependencies 43992 ); 43993 (0, import_react45.useEffect)(() => { 43994 const hasScrollOffsets = scrollOffsets !== defaultCoordinates; 43995 if (hasScrollOffsets && !initialScrollOffsets.current) { 43996 initialScrollOffsets.current = scrollOffsets; 43997 } 43998 if (!hasScrollOffsets && initialScrollOffsets.current) { 43999 initialScrollOffsets.current = null; 44000 } 44001 }, [scrollOffsets]); 44002 return initialScrollOffsets.current ? subtract(scrollOffsets, initialScrollOffsets.current) : defaultCoordinates; 44003 } 44004 function useSensorSetup(sensors) { 44005 (0, import_react45.useEffect)( 44006 () => { 44007 if (!canUseDOM2) { 44008 return; 44009 } 44010 const teardownFns = sensors.map((_ref) => { 44011 let { 44012 sensor 44013 } = _ref; 44014 return sensor.setup == null ? void 0 : sensor.setup(); 44015 }); 44016 return () => { 44017 for (const teardown of teardownFns) { 44018 teardown == null ? void 0 : teardown(); 44019 } 44020 }; 44021 }, 44022 // TO-DO: Sensors length could theoretically change which would not be a valid dependency 44023 // eslint-disable-next-line react-hooks/exhaustive-deps 44024 sensors.map((_ref2) => { 44025 let { 44026 sensor 44027 } = _ref2; 44028 return sensor; 44029 }) 44030 ); 44031 } 44032 function useSyntheticListeners(listeners, id) { 44033 return (0, import_react45.useMemo)(() => { 44034 return listeners.reduce((acc, _ref) => { 44035 let { 44036 eventName, 44037 handler 44038 } = _ref; 44039 acc[eventName] = (event) => { 44040 handler(event, id); 44041 }; 44042 return acc; 44043 }, {}); 44044 }, [listeners, id]); 44045 } 44046 function useWindowRect(element) { 44047 return (0, import_react45.useMemo)(() => element ? getWindowClientRect(element) : null, [element]); 44048 } 44049 var defaultValue$2 = []; 44050 function useRects(elements, measure) { 44051 if (measure === void 0) { 44052 measure = getClientRect; 44053 } 44054 const [firstElement] = elements; 44055 const windowRect = useWindowRect(firstElement ? getWindow3(firstElement) : null); 44056 const [rects, setRects] = (0, import_react45.useState)(defaultValue$2); 44057 function measureRects() { 44058 setRects(() => { 44059 if (!elements.length) { 44060 return defaultValue$2; 44061 } 44062 return elements.map((element) => isDocumentScrollingElement(element) ? windowRect : new Rect3(measure(element), element)); 44063 }); 44064 } 44065 const resizeObserver = useResizeObserver2({ 44066 callback: measureRects 44067 }); 44068 useIsomorphicLayoutEffect(() => { 44069 resizeObserver == null ? void 0 : resizeObserver.disconnect(); 44070 measureRects(); 44071 elements.forEach((element) => resizeObserver == null ? void 0 : resizeObserver.observe(element)); 44072 }, [elements]); 44073 return rects; 44074 } 44075 function getMeasurableNode(node) { 44076 if (!node) { 44077 return null; 44078 } 44079 if (node.children.length > 1) { 44080 return node; 44081 } 44082 const firstChild = node.children[0]; 44083 return isHTMLElement2(firstChild) ? firstChild : node; 44084 } 44085 function useDragOverlayMeasuring(_ref) { 44086 let { 44087 measure 44088 } = _ref; 44089 const [rect, setRect] = (0, import_react45.useState)(null); 44090 const handleResize = (0, import_react45.useCallback)((entries) => { 44091 for (const { 44092 target 44093 } of entries) { 44094 if (isHTMLElement2(target)) { 44095 setRect((rect2) => { 44096 const newRect = measure(target); 44097 return rect2 ? { 44098 ...rect2, 44099 width: newRect.width, 44100 height: newRect.height 44101 } : newRect; 44102 }); 44103 break; 44104 } 44105 } 44106 }, [measure]); 44107 const resizeObserver = useResizeObserver2({ 44108 callback: handleResize 44109 }); 44110 const handleNodeChange = (0, import_react45.useCallback)((element) => { 44111 const node = getMeasurableNode(element); 44112 resizeObserver == null ? void 0 : resizeObserver.disconnect(); 44113 if (node) { 44114 resizeObserver == null ? void 0 : resizeObserver.observe(node); 44115 } 44116 setRect(node ? measure(node) : null); 44117 }, [measure, resizeObserver]); 44118 const [nodeRef, setRef2] = useNodeRef(handleNodeChange); 44119 return (0, import_react45.useMemo)(() => ({ 44120 nodeRef, 44121 rect, 44122 setRef: setRef2 44123 }), [rect, nodeRef, setRef2]); 44124 } 44125 var defaultSensors = [{ 44126 sensor: PointerSensor, 44127 options: {} 44128 }, { 44129 sensor: KeyboardSensor, 44130 options: {} 44131 }]; 44132 var defaultData = { 44133 current: {} 44134 }; 44135 var defaultMeasuringConfiguration = { 44136 draggable: { 44137 measure: getTransformAgnosticClientRect 44138 }, 44139 droppable: { 44140 measure: getTransformAgnosticClientRect, 44141 strategy: MeasuringStrategy.WhileDragging, 44142 frequency: MeasuringFrequency.Optimized 44143 }, 44144 dragOverlay: { 44145 measure: getClientRect 44146 } 44147 }; 44148 var DroppableContainersMap = class extends Map { 44149 get(id) { 44150 var _super$get; 44151 return id != null ? (_super$get = super.get(id)) != null ? _super$get : void 0 : void 0; 44152 } 44153 toArray() { 44154 return Array.from(this.values()); 44155 } 44156 getEnabled() { 44157 return this.toArray().filter((_ref) => { 44158 let { 44159 disabled: disabled2 44160 } = _ref; 44161 return !disabled2; 44162 }); 44163 } 44164 getNodeFor(id) { 44165 var _this$get$node$curren, _this$get; 44166 return (_this$get$node$curren = (_this$get = this.get(id)) == null ? void 0 : _this$get.node.current) != null ? _this$get$node$curren : void 0; 44167 } 44168 }; 44169 var defaultPublicContext = { 44170 activatorEvent: null, 44171 active: null, 44172 activeNode: null, 44173 activeNodeRect: null, 44174 collisions: null, 44175 containerNodeRect: null, 44176 draggableNodes: /* @__PURE__ */ new Map(), 44177 droppableRects: /* @__PURE__ */ new Map(), 44178 droppableContainers: /* @__PURE__ */ new DroppableContainersMap(), 44179 over: null, 44180 dragOverlay: { 44181 nodeRef: { 44182 current: null 44183 }, 44184 rect: null, 44185 setRef: noop6 44186 }, 44187 scrollableAncestors: [], 44188 scrollableAncestorRects: [], 44189 measuringConfiguration: defaultMeasuringConfiguration, 44190 measureDroppableContainers: noop6, 44191 windowRect: null, 44192 measuringScheduled: false 44193 }; 44194 var defaultInternalContext = { 44195 activatorEvent: null, 44196 activators: [], 44197 active: null, 44198 activeNodeRect: null, 44199 ariaDescribedById: { 44200 draggable: "" 44201 }, 44202 dispatch: noop6, 44203 draggableNodes: /* @__PURE__ */ new Map(), 44204 over: null, 44205 measureDroppableContainers: noop6 44206 }; 44207 var InternalContext = /* @__PURE__ */ (0, import_react45.createContext)(defaultInternalContext); 44208 var PublicContext = /* @__PURE__ */ (0, import_react45.createContext)(defaultPublicContext); 44209 function getInitialState() { 44210 return { 44211 draggable: { 44212 active: null, 44213 initialCoordinates: { 44214 x: 0, 44215 y: 0 44216 }, 44217 nodes: /* @__PURE__ */ new Map(), 44218 translate: { 44219 x: 0, 44220 y: 0 44221 } 44222 }, 44223 droppable: { 44224 containers: new DroppableContainersMap() 44225 } 44226 }; 44227 } 44228 function reducer(state, action) { 44229 switch (action.type) { 44230 case Action3.DragStart: 44231 return { 44232 ...state, 44233 draggable: { 44234 ...state.draggable, 44235 initialCoordinates: action.initialCoordinates, 44236 active: action.active 44237 } 44238 }; 44239 case Action3.DragMove: 44240 if (state.draggable.active == null) { 44241 return state; 44242 } 44243 return { 44244 ...state, 44245 draggable: { 44246 ...state.draggable, 44247 translate: { 44248 x: action.coordinates.x - state.draggable.initialCoordinates.x, 44249 y: action.coordinates.y - state.draggable.initialCoordinates.y 44250 } 44251 } 44252 }; 44253 case Action3.DragEnd: 44254 case Action3.DragCancel: 44255 return { 44256 ...state, 44257 draggable: { 44258 ...state.draggable, 44259 active: null, 44260 initialCoordinates: { 44261 x: 0, 44262 y: 0 44263 }, 44264 translate: { 44265 x: 0, 44266 y: 0 44267 } 44268 } 44269 }; 44270 case Action3.RegisterDroppable: { 44271 const { 44272 element 44273 } = action; 44274 const { 44275 id 44276 } = element; 44277 const containers = new DroppableContainersMap(state.droppable.containers); 44278 containers.set(id, element); 44279 return { 44280 ...state, 44281 droppable: { 44282 ...state.droppable, 44283 containers 44284 } 44285 }; 44286 } 44287 case Action3.SetDroppableDisabled: { 44288 const { 44289 id, 44290 key: key2, 44291 disabled: disabled2 44292 } = action; 44293 const element = state.droppable.containers.get(id); 44294 if (!element || key2 !== element.key) { 44295 return state; 44296 } 44297 const containers = new DroppableContainersMap(state.droppable.containers); 44298 containers.set(id, { 44299 ...element, 44300 disabled: disabled2 44301 }); 44302 return { 44303 ...state, 44304 droppable: { 44305 ...state.droppable, 44306 containers 44307 } 44308 }; 44309 } 44310 case Action3.UnregisterDroppable: { 44311 const { 44312 id, 44313 key: key2 44314 } = action; 44315 const element = state.droppable.containers.get(id); 44316 if (!element || key2 !== element.key) { 44317 return state; 44318 } 44319 const containers = new DroppableContainersMap(state.droppable.containers); 44320 containers.delete(id); 44321 return { 44322 ...state, 44323 droppable: { 44324 ...state.droppable, 44325 containers 44326 } 44327 }; 44328 } 44329 default: { 44330 return state; 44331 } 44332 } 44333 } 44334 function RestoreFocus(_ref) { 44335 let { 44336 disabled: disabled2 44337 } = _ref; 44338 const { 44339 active, 44340 activatorEvent, 44341 draggableNodes 44342 } = (0, import_react45.useContext)(InternalContext); 44343 const previousActivatorEvent = usePrevious2(activatorEvent); 44344 const previousActiveId = usePrevious2(active == null ? void 0 : active.id); 44345 (0, import_react45.useEffect)(() => { 44346 if (disabled2) { 44347 return; 44348 } 44349 if (!activatorEvent && previousActivatorEvent && previousActiveId != null) { 44350 if (!isKeyboardEvent(previousActivatorEvent)) { 44351 return; 44352 } 44353 if (document.activeElement === previousActivatorEvent.target) { 44354 return; 44355 } 44356 const draggableNode = draggableNodes.get(previousActiveId); 44357 if (!draggableNode) { 44358 return; 44359 } 44360 const { 44361 activatorNode, 44362 node 44363 } = draggableNode; 44364 if (!activatorNode.current && !node.current) { 44365 return; 44366 } 44367 requestAnimationFrame(() => { 44368 for (const element of [activatorNode.current, node.current]) { 44369 if (!element) { 44370 continue; 44371 } 44372 const focusableNode = findFirstFocusableNode(element); 44373 if (focusableNode) { 44374 focusableNode.focus(); 44375 break; 44376 } 44377 } 44378 }); 44379 } 44380 }, [activatorEvent, disabled2, draggableNodes, previousActiveId, previousActivatorEvent]); 44381 return null; 44382 } 44383 function applyModifiers(modifiers, _ref) { 44384 let { 44385 transform, 44386 ...args 44387 } = _ref; 44388 return modifiers != null && modifiers.length ? modifiers.reduce((accumulator, modifier) => { 44389 return modifier({ 44390 transform: accumulator, 44391 ...args 44392 }); 44393 }, transform) : transform; 44394 } 44395 function useMeasuringConfiguration(config) { 44396 return (0, import_react45.useMemo)( 44397 () => ({ 44398 draggable: { 44399 ...defaultMeasuringConfiguration.draggable, 44400 ...config == null ? void 0 : config.draggable 44401 }, 44402 droppable: { 44403 ...defaultMeasuringConfiguration.droppable, 44404 ...config == null ? void 0 : config.droppable 44405 }, 44406 dragOverlay: { 44407 ...defaultMeasuringConfiguration.dragOverlay, 44408 ...config == null ? void 0 : config.dragOverlay 44409 } 44410 }), 44411 // eslint-disable-next-line react-hooks/exhaustive-deps 44412 [config == null ? void 0 : config.draggable, config == null ? void 0 : config.droppable, config == null ? void 0 : config.dragOverlay] 44413 ); 44414 } 44415 function useLayoutShiftScrollCompensation(_ref) { 44416 let { 44417 activeNode, 44418 measure, 44419 initialRect, 44420 config = true 44421 } = _ref; 44422 const initialized = (0, import_react45.useRef)(false); 44423 const { 44424 x: x2, 44425 y: y2 44426 } = typeof config === "boolean" ? { 44427 x: config, 44428 y: config 44429 } : config; 44430 useIsomorphicLayoutEffect(() => { 44431 const disabled2 = !x2 && !y2; 44432 if (disabled2 || !activeNode) { 44433 initialized.current = false; 44434 return; 44435 } 44436 if (initialized.current || !initialRect) { 44437 return; 44438 } 44439 const node = activeNode == null ? void 0 : activeNode.node.current; 44440 if (!node || node.isConnected === false) { 44441 return; 44442 } 44443 const rect = measure(node); 44444 const rectDelta = getRectDelta(rect, initialRect); 44445 if (!x2) { 44446 rectDelta.x = 0; 44447 } 44448 if (!y2) { 44449 rectDelta.y = 0; 44450 } 44451 initialized.current = true; 44452 if (Math.abs(rectDelta.x) > 0 || Math.abs(rectDelta.y) > 0) { 44453 const firstScrollableAncestor = getFirstScrollableAncestor(node); 44454 if (firstScrollableAncestor) { 44455 firstScrollableAncestor.scrollBy({ 44456 top: rectDelta.y, 44457 left: rectDelta.x 44458 }); 44459 } 44460 } 44461 }, [activeNode, x2, y2, initialRect, measure]); 44462 } 44463 var ActiveDraggableContext = /* @__PURE__ */ (0, import_react45.createContext)({ 44464 ...defaultCoordinates, 44465 scaleX: 1, 44466 scaleY: 1 44467 }); 44468 var Status; 44469 (function(Status2) { 44470 Status2[Status2["Uninitialized"] = 0] = "Uninitialized"; 44471 Status2[Status2["Initializing"] = 1] = "Initializing"; 44472 Status2[Status2["Initialized"] = 2] = "Initialized"; 44473 })(Status || (Status = {})); 44474 var DndContext = /* @__PURE__ */ (0, import_react45.memo)(function DndContext2(_ref) { 44475 var _sensorContext$curren, _dragOverlay$nodeRef$, _dragOverlay$rect, _over$rect; 44476 let { 44477 id, 44478 accessibility, 44479 autoScroll = true, 44480 children, 44481 sensors = defaultSensors, 44482 collisionDetection = rectIntersection, 44483 measuring, 44484 modifiers, 44485 ...props 44486 } = _ref; 44487 const store = (0, import_react45.useReducer)(reducer, void 0, getInitialState); 44488 const [state, dispatch2] = store; 44489 const [dispatchMonitorEvent, registerMonitorListener] = useDndMonitorProvider(); 44490 const [status, setStatus] = (0, import_react45.useState)(Status.Uninitialized); 44491 const isInitialized = status === Status.Initialized; 44492 const { 44493 draggable: { 44494 active: activeId, 44495 nodes: draggableNodes, 44496 translate 44497 }, 44498 droppable: { 44499 containers: droppableContainers 44500 } 44501 } = state; 44502 const node = activeId != null ? draggableNodes.get(activeId) : null; 44503 const activeRects = (0, import_react45.useRef)({ 44504 initial: null, 44505 translated: null 44506 }); 44507 const active = (0, import_react45.useMemo)(() => { 44508 var _node$data; 44509 return activeId != null ? { 44510 id: activeId, 44511 // It's possible for the active node to unmount while dragging 44512 data: (_node$data = node == null ? void 0 : node.data) != null ? _node$data : defaultData, 44513 rect: activeRects 44514 } : null; 44515 }, [activeId, node]); 44516 const activeRef = (0, import_react45.useRef)(null); 44517 const [activeSensor, setActiveSensor] = (0, import_react45.useState)(null); 44518 const [activatorEvent, setActivatorEvent] = (0, import_react45.useState)(null); 44519 const latestProps = useLatestValue(props, Object.values(props)); 44520 const draggableDescribedById = useUniqueId("DndDescribedBy", id); 44521 const enabledDroppableContainers = (0, import_react45.useMemo)(() => droppableContainers.getEnabled(), [droppableContainers]); 44522 const measuringConfiguration = useMeasuringConfiguration(measuring); 44523 const { 44524 droppableRects, 44525 measureDroppableContainers, 44526 measuringScheduled 44527 } = useDroppableMeasuring(enabledDroppableContainers, { 44528 dragging: isInitialized, 44529 dependencies: [translate.x, translate.y], 44530 config: measuringConfiguration.droppable 44531 }); 44532 const activeNode = useCachedNode(draggableNodes, activeId); 44533 const activationCoordinates = (0, import_react45.useMemo)(() => activatorEvent ? getEventCoordinates(activatorEvent) : null, [activatorEvent]); 44534 const autoScrollOptions = getAutoScrollerOptions(); 44535 const initialActiveNodeRect = useInitialRect(activeNode, measuringConfiguration.draggable.measure); 44536 useLayoutShiftScrollCompensation({ 44537 activeNode: activeId != null ? draggableNodes.get(activeId) : null, 44538 config: autoScrollOptions.layoutShiftCompensation, 44539 initialRect: initialActiveNodeRect, 44540 measure: measuringConfiguration.draggable.measure 44541 }); 44542 const activeNodeRect = useRect(activeNode, measuringConfiguration.draggable.measure, initialActiveNodeRect); 44543 const containerNodeRect = useRect(activeNode ? activeNode.parentElement : null); 44544 const sensorContext = (0, import_react45.useRef)({ 44545 activatorEvent: null, 44546 active: null, 44547 activeNode, 44548 collisionRect: null, 44549 collisions: null, 44550 droppableRects, 44551 draggableNodes, 44552 draggingNode: null, 44553 draggingNodeRect: null, 44554 droppableContainers, 44555 over: null, 44556 scrollableAncestors: [], 44557 scrollAdjustedTranslate: null 44558 }); 44559 const overNode = droppableContainers.getNodeFor((_sensorContext$curren = sensorContext.current.over) == null ? void 0 : _sensorContext$curren.id); 44560 const dragOverlay = useDragOverlayMeasuring({ 44561 measure: measuringConfiguration.dragOverlay.measure 44562 }); 44563 const draggingNode = (_dragOverlay$nodeRef$ = dragOverlay.nodeRef.current) != null ? _dragOverlay$nodeRef$ : activeNode; 44564 const draggingNodeRect = isInitialized ? (_dragOverlay$rect = dragOverlay.rect) != null ? _dragOverlay$rect : activeNodeRect : null; 44565 const usesDragOverlay = Boolean(dragOverlay.nodeRef.current && dragOverlay.rect); 44566 const nodeRectDelta = useRectDelta(usesDragOverlay ? null : activeNodeRect); 44567 const windowRect = useWindowRect(draggingNode ? getWindow3(draggingNode) : null); 44568 const scrollableAncestors = useScrollableAncestors(isInitialized ? overNode != null ? overNode : activeNode : null); 44569 const scrollableAncestorRects = useRects(scrollableAncestors); 44570 const modifiedTranslate = applyModifiers(modifiers, { 44571 transform: { 44572 x: translate.x - nodeRectDelta.x, 44573 y: translate.y - nodeRectDelta.y, 44574 scaleX: 1, 44575 scaleY: 1 44576 }, 44577 activatorEvent, 44578 active, 44579 activeNodeRect, 44580 containerNodeRect, 44581 draggingNodeRect, 44582 over: sensorContext.current.over, 44583 overlayNodeRect: dragOverlay.rect, 44584 scrollableAncestors, 44585 scrollableAncestorRects, 44586 windowRect 44587 }); 44588 const pointerCoordinates = activationCoordinates ? add(activationCoordinates, translate) : null; 44589 const scrollOffsets = useScrollOffsets(scrollableAncestors); 44590 const scrollAdjustment = useScrollOffsetsDelta(scrollOffsets); 44591 const activeNodeScrollDelta = useScrollOffsetsDelta(scrollOffsets, [activeNodeRect]); 44592 const scrollAdjustedTranslate = add(modifiedTranslate, scrollAdjustment); 44593 const collisionRect = draggingNodeRect ? getAdjustedRect(draggingNodeRect, modifiedTranslate) : null; 44594 const collisions = active && collisionRect ? collisionDetection({ 44595 active, 44596 collisionRect, 44597 droppableRects, 44598 droppableContainers: enabledDroppableContainers, 44599 pointerCoordinates 44600 }) : null; 44601 const overId = getFirstCollision(collisions, "id"); 44602 const [over, setOver] = (0, import_react45.useState)(null); 44603 const appliedTranslate = usesDragOverlay ? modifiedTranslate : add(modifiedTranslate, activeNodeScrollDelta); 44604 const transform = adjustScale(appliedTranslate, (_over$rect = over == null ? void 0 : over.rect) != null ? _over$rect : null, activeNodeRect); 44605 const activeSensorRef = (0, import_react45.useRef)(null); 44606 const instantiateSensor = (0, import_react45.useCallback)( 44607 (event, _ref2) => { 44608 let { 44609 sensor: Sensor, 44610 options 44611 } = _ref2; 44612 if (activeRef.current == null) { 44613 return; 44614 } 44615 const activeNode2 = draggableNodes.get(activeRef.current); 44616 if (!activeNode2) { 44617 return; 44618 } 44619 const activatorEvent2 = event.nativeEvent; 44620 const sensorInstance = new Sensor({ 44621 active: activeRef.current, 44622 activeNode: activeNode2, 44623 event: activatorEvent2, 44624 options, 44625 // Sensors need to be instantiated with refs for arguments that change over time 44626 // otherwise they are frozen in time with the stale arguments 44627 context: sensorContext, 44628 onAbort(id2) { 44629 const draggableNode = draggableNodes.get(id2); 44630 if (!draggableNode) { 44631 return; 44632 } 44633 const { 44634 onDragAbort 44635 } = latestProps.current; 44636 const event2 = { 44637 id: id2 44638 }; 44639 onDragAbort == null ? void 0 : onDragAbort(event2); 44640 dispatchMonitorEvent({ 44641 type: "onDragAbort", 44642 event: event2 44643 }); 44644 }, 44645 onPending(id2, constraint, initialCoordinates, offset4) { 44646 const draggableNode = draggableNodes.get(id2); 44647 if (!draggableNode) { 44648 return; 44649 } 44650 const { 44651 onDragPending 44652 } = latestProps.current; 44653 const event2 = { 44654 id: id2, 44655 constraint, 44656 initialCoordinates, 44657 offset: offset4 44658 }; 44659 onDragPending == null ? void 0 : onDragPending(event2); 44660 dispatchMonitorEvent({ 44661 type: "onDragPending", 44662 event: event2 44663 }); 44664 }, 44665 onStart(initialCoordinates) { 44666 const id2 = activeRef.current; 44667 if (id2 == null) { 44668 return; 44669 } 44670 const draggableNode = draggableNodes.get(id2); 44671 if (!draggableNode) { 44672 return; 44673 } 44674 const { 44675 onDragStart 44676 } = latestProps.current; 44677 const event2 = { 44678 activatorEvent: activatorEvent2, 44679 active: { 44680 id: id2, 44681 data: draggableNode.data, 44682 rect: activeRects 44683 } 44684 }; 44685 (0, import_react_dom5.unstable_batchedUpdates)(() => { 44686 onDragStart == null ? void 0 : onDragStart(event2); 44687 setStatus(Status.Initializing); 44688 dispatch2({ 44689 type: Action3.DragStart, 44690 initialCoordinates, 44691 active: id2 44692 }); 44693 dispatchMonitorEvent({ 44694 type: "onDragStart", 44695 event: event2 44696 }); 44697 setActiveSensor(activeSensorRef.current); 44698 setActivatorEvent(activatorEvent2); 44699 }); 44700 }, 44701 onMove(coordinates) { 44702 dispatch2({ 44703 type: Action3.DragMove, 44704 coordinates 44705 }); 44706 }, 44707 onEnd: createHandler(Action3.DragEnd), 44708 onCancel: createHandler(Action3.DragCancel) 44709 }); 44710 activeSensorRef.current = sensorInstance; 44711 function createHandler(type) { 44712 return async function handler() { 44713 const { 44714 active: active2, 44715 collisions: collisions2, 44716 over: over2, 44717 scrollAdjustedTranslate: scrollAdjustedTranslate2 44718 } = sensorContext.current; 44719 let event2 = null; 44720 if (active2 && scrollAdjustedTranslate2) { 44721 const { 44722 cancelDrop 44723 } = latestProps.current; 44724 event2 = { 44725 activatorEvent: activatorEvent2, 44726 active: active2, 44727 collisions: collisions2, 44728 delta: scrollAdjustedTranslate2, 44729 over: over2 44730 }; 44731 if (type === Action3.DragEnd && typeof cancelDrop === "function") { 44732 const shouldCancel = await Promise.resolve(cancelDrop(event2)); 44733 if (shouldCancel) { 44734 type = Action3.DragCancel; 44735 } 44736 } 44737 } 44738 activeRef.current = null; 44739 (0, import_react_dom5.unstable_batchedUpdates)(() => { 44740 dispatch2({ 44741 type 44742 }); 44743 setStatus(Status.Uninitialized); 44744 setOver(null); 44745 setActiveSensor(null); 44746 setActivatorEvent(null); 44747 activeSensorRef.current = null; 44748 const eventName = type === Action3.DragEnd ? "onDragEnd" : "onDragCancel"; 44749 if (event2) { 44750 const handler2 = latestProps.current[eventName]; 44751 handler2 == null ? void 0 : handler2(event2); 44752 dispatchMonitorEvent({ 44753 type: eventName, 44754 event: event2 44755 }); 44756 } 44757 }); 44758 }; 44759 } 44760 }, 44761 // eslint-disable-next-line react-hooks/exhaustive-deps 44762 [draggableNodes] 44763 ); 44764 const bindActivatorToSensorInstantiator = (0, import_react45.useCallback)((handler, sensor) => { 44765 return (event, active2) => { 44766 const nativeEvent = event.nativeEvent; 44767 const activeDraggableNode = draggableNodes.get(active2); 44768 if ( 44769 // Another sensor is already instantiating 44770 activeRef.current !== null || // No active draggable 44771 !activeDraggableNode || // Event has already been captured 44772 nativeEvent.dndKit || nativeEvent.defaultPrevented 44773 ) { 44774 return; 44775 } 44776 const activationContext = { 44777 active: activeDraggableNode 44778 }; 44779 const shouldActivate = handler(event, sensor.options, activationContext); 44780 if (shouldActivate === true) { 44781 nativeEvent.dndKit = { 44782 capturedBy: sensor.sensor 44783 }; 44784 activeRef.current = active2; 44785 instantiateSensor(event, sensor); 44786 } 44787 }; 44788 }, [draggableNodes, instantiateSensor]); 44789 const activators = useCombineActivators(sensors, bindActivatorToSensorInstantiator); 44790 useSensorSetup(sensors); 44791 useIsomorphicLayoutEffect(() => { 44792 if (activeNodeRect && status === Status.Initializing) { 44793 setStatus(Status.Initialized); 44794 } 44795 }, [activeNodeRect, status]); 44796 (0, import_react45.useEffect)( 44797 () => { 44798 const { 44799 onDragMove 44800 } = latestProps.current; 44801 const { 44802 active: active2, 44803 activatorEvent: activatorEvent2, 44804 collisions: collisions2, 44805 over: over2 44806 } = sensorContext.current; 44807 if (!active2 || !activatorEvent2) { 44808 return; 44809 } 44810 const event = { 44811 active: active2, 44812 activatorEvent: activatorEvent2, 44813 collisions: collisions2, 44814 delta: { 44815 x: scrollAdjustedTranslate.x, 44816 y: scrollAdjustedTranslate.y 44817 }, 44818 over: over2 44819 }; 44820 (0, import_react_dom5.unstable_batchedUpdates)(() => { 44821 onDragMove == null ? void 0 : onDragMove(event); 44822 dispatchMonitorEvent({ 44823 type: "onDragMove", 44824 event 44825 }); 44826 }); 44827 }, 44828 // eslint-disable-next-line react-hooks/exhaustive-deps 44829 [scrollAdjustedTranslate.x, scrollAdjustedTranslate.y] 44830 ); 44831 (0, import_react45.useEffect)( 44832 () => { 44833 const { 44834 active: active2, 44835 activatorEvent: activatorEvent2, 44836 collisions: collisions2, 44837 droppableContainers: droppableContainers2, 44838 scrollAdjustedTranslate: scrollAdjustedTranslate2 44839 } = sensorContext.current; 44840 if (!active2 || activeRef.current == null || !activatorEvent2 || !scrollAdjustedTranslate2) { 44841 return; 44842 } 44843 const { 44844 onDragOver 44845 } = latestProps.current; 44846 const overContainer = droppableContainers2.get(overId); 44847 const over2 = overContainer && overContainer.rect.current ? { 44848 id: overContainer.id, 44849 rect: overContainer.rect.current, 44850 data: overContainer.data, 44851 disabled: overContainer.disabled 44852 } : null; 44853 const event = { 44854 active: active2, 44855 activatorEvent: activatorEvent2, 44856 collisions: collisions2, 44857 delta: { 44858 x: scrollAdjustedTranslate2.x, 44859 y: scrollAdjustedTranslate2.y 44860 }, 44861 over: over2 44862 }; 44863 (0, import_react_dom5.unstable_batchedUpdates)(() => { 44864 setOver(over2); 44865 onDragOver == null ? void 0 : onDragOver(event); 44866 dispatchMonitorEvent({ 44867 type: "onDragOver", 44868 event 44869 }); 44870 }); 44871 }, 44872 // eslint-disable-next-line react-hooks/exhaustive-deps 44873 [overId] 44874 ); 44875 useIsomorphicLayoutEffect(() => { 44876 sensorContext.current = { 44877 activatorEvent, 44878 active, 44879 activeNode, 44880 collisionRect, 44881 collisions, 44882 droppableRects, 44883 draggableNodes, 44884 draggingNode, 44885 draggingNodeRect, 44886 droppableContainers, 44887 over, 44888 scrollableAncestors, 44889 scrollAdjustedTranslate 44890 }; 44891 activeRects.current = { 44892 initial: draggingNodeRect, 44893 translated: collisionRect 44894 }; 44895 }, [active, activeNode, collisions, collisionRect, draggableNodes, draggingNode, draggingNodeRect, droppableRects, droppableContainers, over, scrollableAncestors, scrollAdjustedTranslate]); 44896 useAutoScroller({ 44897 ...autoScrollOptions, 44898 delta: translate, 44899 draggingRect: collisionRect, 44900 pointerCoordinates, 44901 scrollableAncestors, 44902 scrollableAncestorRects 44903 }); 44904 const publicContext = (0, import_react45.useMemo)(() => { 44905 const context = { 44906 active, 44907 activeNode, 44908 activeNodeRect, 44909 activatorEvent, 44910 collisions, 44911 containerNodeRect, 44912 dragOverlay, 44913 draggableNodes, 44914 droppableContainers, 44915 droppableRects, 44916 over, 44917 measureDroppableContainers, 44918 scrollableAncestors, 44919 scrollableAncestorRects, 44920 measuringConfiguration, 44921 measuringScheduled, 44922 windowRect 44923 }; 44924 return context; 44925 }, [active, activeNode, activeNodeRect, activatorEvent, collisions, containerNodeRect, dragOverlay, draggableNodes, droppableContainers, droppableRects, over, measureDroppableContainers, scrollableAncestors, scrollableAncestorRects, measuringConfiguration, measuringScheduled, windowRect]); 44926 const internalContext = (0, import_react45.useMemo)(() => { 44927 const context = { 44928 activatorEvent, 44929 activators, 44930 active, 44931 activeNodeRect, 44932 ariaDescribedById: { 44933 draggable: draggableDescribedById 44934 }, 44935 dispatch: dispatch2, 44936 draggableNodes, 44937 over, 44938 measureDroppableContainers 44939 }; 44940 return context; 44941 }, [activatorEvent, activators, active, activeNodeRect, dispatch2, draggableDescribedById, draggableNodes, over, measureDroppableContainers]); 44942 return import_react45.default.createElement(DndMonitorContext.Provider, { 44943 value: registerMonitorListener 44944 }, import_react45.default.createElement(InternalContext.Provider, { 44945 value: internalContext 44946 }, import_react45.default.createElement(PublicContext.Provider, { 44947 value: publicContext 44948 }, import_react45.default.createElement(ActiveDraggableContext.Provider, { 44949 value: transform 44950 }, children)), import_react45.default.createElement(RestoreFocus, { 44951 disabled: (accessibility == null ? void 0 : accessibility.restoreFocus) === false 44952 })), import_react45.default.createElement(Accessibility, { 44953 ...accessibility, 44954 hiddenTextDescribedById: draggableDescribedById 44955 })); 44956 function getAutoScrollerOptions() { 44957 const activeSensorDisablesAutoscroll = (activeSensor == null ? void 0 : activeSensor.autoScrollEnabled) === false; 44958 const autoScrollGloballyDisabled = typeof autoScroll === "object" ? autoScroll.enabled === false : autoScroll === false; 44959 const enabled = isInitialized && !activeSensorDisablesAutoscroll && !autoScrollGloballyDisabled; 44960 if (typeof autoScroll === "object") { 44961 return { 44962 ...autoScroll, 44963 enabled 44964 }; 44965 } 44966 return { 44967 enabled 44968 }; 44969 } 44970 }); 44971 var NullContext = /* @__PURE__ */ (0, import_react45.createContext)(null); 44972 var defaultRole = "button"; 44973 var ID_PREFIX = "Draggable"; 44974 function useDraggable(_ref) { 44975 let { 44976 id, 44977 data, 44978 disabled: disabled2 = false, 44979 attributes 44980 } = _ref; 44981 const key2 = useUniqueId(ID_PREFIX); 44982 const { 44983 activators, 44984 activatorEvent, 44985 active, 44986 activeNodeRect, 44987 ariaDescribedById, 44988 draggableNodes, 44989 over 44990 } = (0, import_react45.useContext)(InternalContext); 44991 const { 44992 role = defaultRole, 44993 roleDescription = "draggable", 44994 tabIndex = 0 44995 } = attributes != null ? attributes : {}; 44996 const isDragging = (active == null ? void 0 : active.id) === id; 44997 const transform = (0, import_react45.useContext)(isDragging ? ActiveDraggableContext : NullContext); 44998 const [node, setNodeRef] = useNodeRef(); 44999 const [activatorNode, setActivatorNodeRef] = useNodeRef(); 45000 const listeners = useSyntheticListeners(activators, id); 45001 const dataRef = useLatestValue(data); 45002 useIsomorphicLayoutEffect( 45003 () => { 45004 draggableNodes.set(id, { 45005 id, 45006 key: key2, 45007 node, 45008 activatorNode, 45009 data: dataRef 45010 }); 45011 return () => { 45012 const node2 = draggableNodes.get(id); 45013 if (node2 && node2.key === key2) { 45014 draggableNodes.delete(id); 45015 } 45016 }; 45017 }, 45018 // eslint-disable-next-line react-hooks/exhaustive-deps 45019 [draggableNodes, id] 45020 ); 45021 const memoizedAttributes = (0, import_react45.useMemo)(() => ({ 45022 role, 45023 tabIndex, 45024 "aria-disabled": disabled2, 45025 "aria-pressed": isDragging && role === defaultRole ? true : void 0, 45026 "aria-roledescription": roleDescription, 45027 "aria-describedby": ariaDescribedById.draggable 45028 }), [disabled2, role, tabIndex, isDragging, roleDescription, ariaDescribedById.draggable]); 45029 return { 45030 active, 45031 activatorEvent, 45032 activeNodeRect, 45033 attributes: memoizedAttributes, 45034 isDragging, 45035 listeners: disabled2 ? void 0 : listeners, 45036 node, 45037 over, 45038 setNodeRef, 45039 setActivatorNodeRef, 45040 transform 45041 }; 45042 } 45043 function useDndContext() { 45044 return (0, import_react45.useContext)(PublicContext); 45045 } 45046 var ID_PREFIX$1 = "Droppable"; 45047 var defaultResizeObserverConfig = { 45048 timeout: 25 45049 }; 45050 function useDroppable(_ref) { 45051 let { 45052 data, 45053 disabled: disabled2 = false, 45054 id, 45055 resizeObserverConfig 45056 } = _ref; 45057 const key2 = useUniqueId(ID_PREFIX$1); 45058 const { 45059 active, 45060 dispatch: dispatch2, 45061 over, 45062 measureDroppableContainers 45063 } = (0, import_react45.useContext)(InternalContext); 45064 const previous = (0, import_react45.useRef)({ 45065 disabled: disabled2 45066 }); 45067 const resizeObserverConnected = (0, import_react45.useRef)(false); 45068 const rect = (0, import_react45.useRef)(null); 45069 const callbackId = (0, import_react45.useRef)(null); 45070 const { 45071 disabled: resizeObserverDisabled, 45072 updateMeasurementsFor, 45073 timeout: resizeObserverTimeout 45074 } = { 45075 ...defaultResizeObserverConfig, 45076 ...resizeObserverConfig 45077 }; 45078 const ids2 = useLatestValue(updateMeasurementsFor != null ? updateMeasurementsFor : id); 45079 const handleResize = (0, import_react45.useCallback)( 45080 () => { 45081 if (!resizeObserverConnected.current) { 45082 resizeObserverConnected.current = true; 45083 return; 45084 } 45085 if (callbackId.current != null) { 45086 clearTimeout(callbackId.current); 45087 } 45088 callbackId.current = setTimeout(() => { 45089 measureDroppableContainers(Array.isArray(ids2.current) ? ids2.current : [ids2.current]); 45090 callbackId.current = null; 45091 }, resizeObserverTimeout); 45092 }, 45093 //eslint-disable-next-line react-hooks/exhaustive-deps 45094 [resizeObserverTimeout] 45095 ); 45096 const resizeObserver = useResizeObserver2({ 45097 callback: handleResize, 45098 disabled: resizeObserverDisabled || !active 45099 }); 45100 const handleNodeChange = (0, import_react45.useCallback)((newElement, previousElement) => { 45101 if (!resizeObserver) { 45102 return; 45103 } 45104 if (previousElement) { 45105 resizeObserver.unobserve(previousElement); 45106 resizeObserverConnected.current = false; 45107 } 45108 if (newElement) { 45109 resizeObserver.observe(newElement); 45110 } 45111 }, [resizeObserver]); 45112 const [nodeRef, setNodeRef] = useNodeRef(handleNodeChange); 45113 const dataRef = useLatestValue(data); 45114 (0, import_react45.useEffect)(() => { 45115 if (!resizeObserver || !nodeRef.current) { 45116 return; 45117 } 45118 resizeObserver.disconnect(); 45119 resizeObserverConnected.current = false; 45120 resizeObserver.observe(nodeRef.current); 45121 }, [nodeRef, resizeObserver]); 45122 (0, import_react45.useEffect)( 45123 () => { 45124 dispatch2({ 45125 type: Action3.RegisterDroppable, 45126 element: { 45127 id, 45128 key: key2, 45129 disabled: disabled2, 45130 node: nodeRef, 45131 rect, 45132 data: dataRef 45133 } 45134 }); 45135 return () => dispatch2({ 45136 type: Action3.UnregisterDroppable, 45137 key: key2, 45138 id 45139 }); 45140 }, 45141 // eslint-disable-next-line react-hooks/exhaustive-deps 45142 [id] 45143 ); 45144 (0, import_react45.useEffect)(() => { 45145 if (disabled2 !== previous.current.disabled) { 45146 dispatch2({ 45147 type: Action3.SetDroppableDisabled, 45148 id, 45149 key: key2, 45150 disabled: disabled2 45151 }); 45152 previous.current.disabled = disabled2; 45153 } 45154 }, [id, key2, disabled2, dispatch2]); 45155 return { 45156 active, 45157 rect, 45158 isOver: (over == null ? void 0 : over.id) === id, 45159 node: nodeRef, 45160 over, 45161 setNodeRef 45162 }; 45163 } 45164 function AnimationManager(_ref) { 45165 let { 45166 animation, 45167 children 45168 } = _ref; 45169 const [clonedChildren, setClonedChildren] = (0, import_react45.useState)(null); 45170 const [element, setElement] = (0, import_react45.useState)(null); 45171 const previousChildren = usePrevious2(children); 45172 if (!children && !clonedChildren && previousChildren) { 45173 setClonedChildren(previousChildren); 45174 } 45175 useIsomorphicLayoutEffect(() => { 45176 if (!element) { 45177 return; 45178 } 45179 const key2 = clonedChildren == null ? void 0 : clonedChildren.key; 45180 const id = clonedChildren == null ? void 0 : clonedChildren.props.id; 45181 if (key2 == null || id == null) { 45182 setClonedChildren(null); 45183 return; 45184 } 45185 Promise.resolve(animation(id, element)).then(() => { 45186 setClonedChildren(null); 45187 }); 45188 }, [animation, clonedChildren, element]); 45189 return import_react45.default.createElement(import_react45.default.Fragment, null, children, clonedChildren ? (0, import_react45.cloneElement)(clonedChildren, { 45190 ref: setElement 45191 }) : null); 45192 } 45193 var defaultTransform = { 45194 x: 0, 45195 y: 0, 45196 scaleX: 1, 45197 scaleY: 1 45198 }; 45199 function NullifiedContextProvider(_ref) { 45200 let { 45201 children 45202 } = _ref; 45203 return import_react45.default.createElement(InternalContext.Provider, { 45204 value: defaultInternalContext 45205 }, import_react45.default.createElement(ActiveDraggableContext.Provider, { 45206 value: defaultTransform 45207 }, children)); 45208 } 45209 var baseStyles = { 45210 position: "fixed", 45211 touchAction: "none" 45212 }; 45213 var defaultTransition = (activatorEvent) => { 45214 const isKeyboardActivator = isKeyboardEvent(activatorEvent); 45215 return isKeyboardActivator ? "transform 250ms ease" : void 0; 45216 }; 45217 var PositionedOverlay = /* @__PURE__ */ (0, import_react45.forwardRef)((_ref, ref) => { 45218 let { 45219 as, 45220 activatorEvent, 45221 adjustScale: adjustScale2, 45222 children, 45223 className, 45224 rect, 45225 style, 45226 transform, 45227 transition = defaultTransition 45228 } = _ref; 45229 if (!rect) { 45230 return null; 45231 } 45232 const scaleAdjustedTransform = adjustScale2 ? transform : { 45233 ...transform, 45234 scaleX: 1, 45235 scaleY: 1 45236 }; 45237 const styles = { 45238 ...baseStyles, 45239 width: rect.width, 45240 height: rect.height, 45241 top: rect.top, 45242 left: rect.left, 45243 transform: CSS2.Transform.toString(scaleAdjustedTransform), 45244 transformOrigin: adjustScale2 && activatorEvent ? getRelativeTransformOrigin(activatorEvent, rect) : void 0, 45245 transition: typeof transition === "function" ? transition(activatorEvent) : transition, 45246 ...style 45247 }; 45248 return import_react45.default.createElement(as, { 45249 className, 45250 style: styles, 45251 ref 45252 }, children); 45253 }); 45254 var defaultDropAnimationSideEffects = (options) => (_ref) => { 45255 let { 45256 active, 45257 dragOverlay 45258 } = _ref; 45259 const originalStyles = {}; 45260 const { 45261 styles, 45262 className 45263 } = options; 45264 if (styles != null && styles.active) { 45265 for (const [key2, value] of Object.entries(styles.active)) { 45266 if (value === void 0) { 45267 continue; 45268 } 45269 originalStyles[key2] = active.node.style.getPropertyValue(key2); 45270 active.node.style.setProperty(key2, value); 45271 } 45272 } 45273 if (styles != null && styles.dragOverlay) { 45274 for (const [key2, value] of Object.entries(styles.dragOverlay)) { 45275 if (value === void 0) { 45276 continue; 45277 } 45278 dragOverlay.node.style.setProperty(key2, value); 45279 } 45280 } 45281 if (className != null && className.active) { 45282 active.node.classList.add(className.active); 45283 } 45284 if (className != null && className.dragOverlay) { 45285 dragOverlay.node.classList.add(className.dragOverlay); 45286 } 45287 return function cleanup() { 45288 for (const [key2, value] of Object.entries(originalStyles)) { 45289 active.node.style.setProperty(key2, value); 45290 } 45291 if (className != null && className.active) { 45292 active.node.classList.remove(className.active); 45293 } 45294 }; 45295 }; 45296 var defaultKeyframeResolver = (_ref2) => { 45297 let { 45298 transform: { 45299 initial, 45300 final 45301 } 45302 } = _ref2; 45303 return [{ 45304 transform: CSS2.Transform.toString(initial) 45305 }, { 45306 transform: CSS2.Transform.toString(final) 45307 }]; 45308 }; 45309 var defaultDropAnimationConfiguration = { 45310 duration: 250, 45311 easing: "ease", 45312 keyframes: defaultKeyframeResolver, 45313 sideEffects: /* @__PURE__ */ defaultDropAnimationSideEffects({ 45314 styles: { 45315 active: { 45316 opacity: "0" 45317 } 45318 } 45319 }) 45320 }; 45321 function useDropAnimation(_ref3) { 45322 let { 45323 config, 45324 draggableNodes, 45325 droppableContainers, 45326 measuringConfiguration 45327 } = _ref3; 45328 return useEvent3((id, node) => { 45329 if (config === null) { 45330 return; 45331 } 45332 const activeDraggable = draggableNodes.get(id); 45333 if (!activeDraggable) { 45334 return; 45335 } 45336 const activeNode = activeDraggable.node.current; 45337 if (!activeNode) { 45338 return; 45339 } 45340 const measurableNode = getMeasurableNode(node); 45341 if (!measurableNode) { 45342 return; 45343 } 45344 const { 45345 transform 45346 } = getWindow3(node).getComputedStyle(node); 45347 const parsedTransform = parseTransform(transform); 45348 if (!parsedTransform) { 45349 return; 45350 } 45351 const animation = typeof config === "function" ? config : createDefaultDropAnimation(config); 45352 scrollIntoViewIfNeeded2(activeNode, measuringConfiguration.draggable.measure); 45353 return animation({ 45354 active: { 45355 id, 45356 data: activeDraggable.data, 45357 node: activeNode, 45358 rect: measuringConfiguration.draggable.measure(activeNode) 45359 }, 45360 draggableNodes, 45361 dragOverlay: { 45362 node, 45363 rect: measuringConfiguration.dragOverlay.measure(measurableNode) 45364 }, 45365 droppableContainers, 45366 measuringConfiguration, 45367 transform: parsedTransform 45368 }); 45369 }); 45370 } 45371 function createDefaultDropAnimation(options) { 45372 const { 45373 duration, 45374 easing, 45375 sideEffects, 45376 keyframes 45377 } = { 45378 ...defaultDropAnimationConfiguration, 45379 ...options 45380 }; 45381 return (_ref4) => { 45382 let { 45383 active, 45384 dragOverlay, 45385 transform, 45386 ...rest 45387 } = _ref4; 45388 if (!duration) { 45389 return; 45390 } 45391 const delta = { 45392 x: dragOverlay.rect.left - active.rect.left, 45393 y: dragOverlay.rect.top - active.rect.top 45394 }; 45395 const scale = { 45396 scaleX: transform.scaleX !== 1 ? active.rect.width * transform.scaleX / dragOverlay.rect.width : 1, 45397 scaleY: transform.scaleY !== 1 ? active.rect.height * transform.scaleY / dragOverlay.rect.height : 1 45398 }; 45399 const finalTransform = { 45400 x: transform.x - delta.x, 45401 y: transform.y - delta.y, 45402 ...scale 45403 }; 45404 const animationKeyframes = keyframes({ 45405 ...rest, 45406 active, 45407 dragOverlay, 45408 transform: { 45409 initial: transform, 45410 final: finalTransform 45411 } 45412 }); 45413 const [firstKeyframe] = animationKeyframes; 45414 const lastKeyframe = animationKeyframes[animationKeyframes.length - 1]; 45415 if (JSON.stringify(firstKeyframe) === JSON.stringify(lastKeyframe)) { 45416 return; 45417 } 45418 const cleanup = sideEffects == null ? void 0 : sideEffects({ 45419 active, 45420 dragOverlay, 45421 ...rest 45422 }); 45423 const animation = dragOverlay.node.animate(animationKeyframes, { 45424 duration, 45425 easing, 45426 fill: "forwards" 45427 }); 45428 return new Promise((resolve) => { 45429 animation.onfinish = () => { 45430 cleanup == null ? void 0 : cleanup(); 45431 resolve(); 45432 }; 45433 }); 45434 }; 45435 } 45436 var key = 0; 45437 function useKey(id) { 45438 return (0, import_react45.useMemo)(() => { 45439 if (id == null) { 45440 return; 45441 } 45442 key++; 45443 return key; 45444 }, [id]); 45445 } 45446 var DragOverlay = /* @__PURE__ */ import_react45.default.memo((_ref) => { 45447 let { 45448 adjustScale: adjustScale2 = false, 45449 children, 45450 dropAnimation: dropAnimationConfig, 45451 style, 45452 transition, 45453 modifiers, 45454 wrapperElement = "div", 45455 className, 45456 zIndex = 999 45457 } = _ref; 45458 const { 45459 activatorEvent, 45460 active, 45461 activeNodeRect, 45462 containerNodeRect, 45463 draggableNodes, 45464 droppableContainers, 45465 dragOverlay, 45466 over, 45467 measuringConfiguration, 45468 scrollableAncestors, 45469 scrollableAncestorRects, 45470 windowRect 45471 } = useDndContext(); 45472 const transform = (0, import_react45.useContext)(ActiveDraggableContext); 45473 const key2 = useKey(active == null ? void 0 : active.id); 45474 const modifiedTransform = applyModifiers(modifiers, { 45475 activatorEvent, 45476 active, 45477 activeNodeRect, 45478 containerNodeRect, 45479 draggingNodeRect: dragOverlay.rect, 45480 over, 45481 overlayNodeRect: dragOverlay.rect, 45482 scrollableAncestors, 45483 scrollableAncestorRects, 45484 transform, 45485 windowRect 45486 }); 45487 const initialRect = useInitialValue2(activeNodeRect); 45488 const dropAnimation = useDropAnimation({ 45489 config: dropAnimationConfig, 45490 draggableNodes, 45491 droppableContainers, 45492 measuringConfiguration 45493 }); 45494 const ref = initialRect ? dragOverlay.setRef : void 0; 45495 return import_react45.default.createElement(NullifiedContextProvider, null, import_react45.default.createElement(AnimationManager, { 45496 animation: dropAnimation 45497 }, active && key2 ? import_react45.default.createElement(PositionedOverlay, { 45498 key: key2, 45499 id: active.id, 45500 ref, 45501 as: wrapperElement, 45502 activatorEvent, 45503 adjustScale: adjustScale2, 45504 className, 45505 transition, 45506 rect: initialRect, 45507 style: { 45508 zIndex, 45509 ...style 45510 }, 45511 transform: modifiedTransform 45512 }, children) : null)); 45513 }); 45514 45515 // node_modules/@dnd-kit/sortable/dist/sortable.esm.js 45516 var import_react46 = __toESM(require_react()); 45517 function arrayMove(array, from, to) { 45518 const newArray = array.slice(); 45519 newArray.splice(to < 0 ? newArray.length + to : to, 0, newArray.splice(from, 1)[0]); 45520 return newArray; 45521 } 45522 function getSortedRects(items, rects) { 45523 return items.reduce((accumulator, id, index2) => { 45524 const rect = rects.get(id); 45525 if (rect) { 45526 accumulator[index2] = rect; 45527 } 45528 return accumulator; 45529 }, Array(items.length)); 45530 } 45531 function isValidIndex(index2) { 45532 return index2 !== null && index2 >= 0; 45533 } 45534 function itemsEqual(a2, b2) { 45535 if (a2 === b2) { 45536 return true; 45537 } 45538 if (a2.length !== b2.length) { 45539 return false; 45540 } 45541 for (let i2 = 0; i2 < a2.length; i2++) { 45542 if (a2[i2] !== b2[i2]) { 45543 return false; 45544 } 45545 } 45546 return true; 45547 } 45548 function normalizeDisabled(disabled2) { 45549 if (typeof disabled2 === "boolean") { 45550 return { 45551 draggable: disabled2, 45552 droppable: disabled2 45553 }; 45554 } 45555 return disabled2; 45556 } 45557 var rectSortingStrategy = (_ref) => { 45558 let { 45559 rects, 45560 activeIndex, 45561 overIndex, 45562 index: index2 45563 } = _ref; 45564 const newRects = arrayMove(rects, overIndex, activeIndex); 45565 const oldRect = rects[index2]; 45566 const newRect = newRects[index2]; 45567 if (!newRect || !oldRect) { 45568 return null; 45569 } 45570 return { 45571 x: newRect.left - oldRect.left, 45572 y: newRect.top - oldRect.top, 45573 scaleX: newRect.width / oldRect.width, 45574 scaleY: newRect.height / oldRect.height 45575 }; 45576 }; 45577 var ID_PREFIX2 = "Sortable"; 45578 var Context3 = /* @__PURE__ */ import_react46.default.createContext({ 45579 activeIndex: -1, 45580 containerId: ID_PREFIX2, 45581 disableTransforms: false, 45582 items: [], 45583 overIndex: -1, 45584 useDragOverlay: false, 45585 sortedRects: [], 45586 strategy: rectSortingStrategy, 45587 disabled: { 45588 draggable: false, 45589 droppable: false 45590 } 45591 }); 45592 function SortableContext(_ref) { 45593 let { 45594 children, 45595 id, 45596 items: userDefinedItems, 45597 strategy = rectSortingStrategy, 45598 disabled: disabledProp = false 45599 } = _ref; 45600 const { 45601 active, 45602 dragOverlay, 45603 droppableRects, 45604 over, 45605 measureDroppableContainers 45606 } = useDndContext(); 45607 const containerId = useUniqueId(ID_PREFIX2, id); 45608 const useDragOverlay = Boolean(dragOverlay.rect !== null); 45609 const items = (0, import_react46.useMemo)(() => userDefinedItems.map((item) => typeof item === "object" && "id" in item ? item.id : item), [userDefinedItems]); 45610 const isDragging = active != null; 45611 const activeIndex = active ? items.indexOf(active.id) : -1; 45612 const overIndex = over ? items.indexOf(over.id) : -1; 45613 const previousItemsRef = (0, import_react46.useRef)(items); 45614 const itemsHaveChanged = !itemsEqual(items, previousItemsRef.current); 45615 const disableTransforms = overIndex !== -1 && activeIndex === -1 || itemsHaveChanged; 45616 const disabled2 = normalizeDisabled(disabledProp); 45617 useIsomorphicLayoutEffect(() => { 45618 if (itemsHaveChanged && isDragging) { 45619 measureDroppableContainers(items); 45620 } 45621 }, [itemsHaveChanged, items, isDragging, measureDroppableContainers]); 45622 (0, import_react46.useEffect)(() => { 45623 previousItemsRef.current = items; 45624 }, [items]); 45625 const contextValue = (0, import_react46.useMemo)( 45626 () => ({ 45627 activeIndex, 45628 containerId, 45629 disabled: disabled2, 45630 disableTransforms, 45631 items, 45632 overIndex, 45633 useDragOverlay, 45634 sortedRects: getSortedRects(items, droppableRects), 45635 strategy 45636 }), 45637 // eslint-disable-next-line react-hooks/exhaustive-deps 45638 [activeIndex, containerId, disabled2.draggable, disabled2.droppable, disableTransforms, items, overIndex, droppableRects, useDragOverlay, strategy] 45639 ); 45640 return import_react46.default.createElement(Context3.Provider, { 45641 value: contextValue 45642 }, children); 45643 } 45644 var defaultNewIndexGetter = (_ref) => { 45645 let { 45646 id, 45647 items, 45648 activeIndex, 45649 overIndex 45650 } = _ref; 45651 return arrayMove(items, activeIndex, overIndex).indexOf(id); 45652 }; 45653 var defaultAnimateLayoutChanges = (_ref2) => { 45654 let { 45655 containerId, 45656 isSorting, 45657 wasDragging, 45658 index: index2, 45659 items, 45660 newIndex, 45661 previousItems, 45662 previousContainerId, 45663 transition 45664 } = _ref2; 45665 if (!transition || !wasDragging) { 45666 return false; 45667 } 45668 if (previousItems !== items && index2 === newIndex) { 45669 return false; 45670 } 45671 if (isSorting) { 45672 return true; 45673 } 45674 return newIndex !== index2 && containerId === previousContainerId; 45675 }; 45676 var defaultTransition2 = { 45677 duration: 200, 45678 easing: "ease" 45679 }; 45680 var transitionProperty = "transform"; 45681 var disabledTransition = /* @__PURE__ */ CSS2.Transition.toString({ 45682 property: transitionProperty, 45683 duration: 0, 45684 easing: "linear" 45685 }); 45686 var defaultAttributes = { 45687 roleDescription: "sortable" 45688 }; 45689 function useDerivedTransform(_ref) { 45690 let { 45691 disabled: disabled2, 45692 index: index2, 45693 node, 45694 rect 45695 } = _ref; 45696 const [derivedTransform, setDerivedtransform] = (0, import_react46.useState)(null); 45697 const previousIndex = (0, import_react46.useRef)(index2); 45698 useIsomorphicLayoutEffect(() => { 45699 if (!disabled2 && index2 !== previousIndex.current && node.current) { 45700 const initial = rect.current; 45701 if (initial) { 45702 const current = getClientRect(node.current, { 45703 ignoreTransform: true 45704 }); 45705 const delta = { 45706 x: initial.left - current.left, 45707 y: initial.top - current.top, 45708 scaleX: initial.width / current.width, 45709 scaleY: initial.height / current.height 45710 }; 45711 if (delta.x || delta.y) { 45712 setDerivedtransform(delta); 45713 } 45714 } 45715 } 45716 if (index2 !== previousIndex.current) { 45717 previousIndex.current = index2; 45718 } 45719 }, [disabled2, index2, node, rect]); 45720 (0, import_react46.useEffect)(() => { 45721 if (derivedTransform) { 45722 setDerivedtransform(null); 45723 } 45724 }, [derivedTransform]); 45725 return derivedTransform; 45726 } 45727 function useSortable(_ref) { 45728 let { 45729 animateLayoutChanges = defaultAnimateLayoutChanges, 45730 attributes: userDefinedAttributes, 45731 disabled: localDisabled, 45732 data: customData, 45733 getNewIndex = defaultNewIndexGetter, 45734 id, 45735 strategy: localStrategy, 45736 resizeObserverConfig, 45737 transition = defaultTransition2 45738 } = _ref; 45739 const { 45740 items, 45741 containerId, 45742 activeIndex, 45743 disabled: globalDisabled, 45744 disableTransforms, 45745 sortedRects, 45746 overIndex, 45747 useDragOverlay, 45748 strategy: globalStrategy 45749 } = (0, import_react46.useContext)(Context3); 45750 const disabled2 = normalizeLocalDisabled(localDisabled, globalDisabled); 45751 const index2 = items.indexOf(id); 45752 const data = (0, import_react46.useMemo)(() => ({ 45753 sortable: { 45754 containerId, 45755 index: index2, 45756 items 45757 }, 45758 ...customData 45759 }), [containerId, customData, index2, items]); 45760 const itemsAfterCurrentSortable = (0, import_react46.useMemo)(() => items.slice(items.indexOf(id)), [items, id]); 45761 const { 45762 rect, 45763 node, 45764 isOver, 45765 setNodeRef: setDroppableNodeRef 45766 } = useDroppable({ 45767 id, 45768 data, 45769 disabled: disabled2.droppable, 45770 resizeObserverConfig: { 45771 updateMeasurementsFor: itemsAfterCurrentSortable, 45772 ...resizeObserverConfig 45773 } 45774 }); 45775 const { 45776 active, 45777 activatorEvent, 45778 activeNodeRect, 45779 attributes, 45780 setNodeRef: setDraggableNodeRef, 45781 listeners, 45782 isDragging, 45783 over, 45784 setActivatorNodeRef, 45785 transform 45786 } = useDraggable({ 45787 id, 45788 data, 45789 attributes: { 45790 ...defaultAttributes, 45791 ...userDefinedAttributes 45792 }, 45793 disabled: disabled2.draggable 45794 }); 45795 const setNodeRef = useCombinedRefs(setDroppableNodeRef, setDraggableNodeRef); 45796 const isSorting = Boolean(active); 45797 const displaceItem = isSorting && !disableTransforms && isValidIndex(activeIndex) && isValidIndex(overIndex); 45798 const shouldDisplaceDragSource = !useDragOverlay && isDragging; 45799 const dragSourceDisplacement = shouldDisplaceDragSource && displaceItem ? transform : null; 45800 const strategy = localStrategy != null ? localStrategy : globalStrategy; 45801 const finalTransform = displaceItem ? dragSourceDisplacement != null ? dragSourceDisplacement : strategy({ 45802 rects: sortedRects, 45803 activeNodeRect, 45804 activeIndex, 45805 overIndex, 45806 index: index2 45807 }) : null; 45808 const newIndex = isValidIndex(activeIndex) && isValidIndex(overIndex) ? getNewIndex({ 45809 id, 45810 items, 45811 activeIndex, 45812 overIndex 45813 }) : index2; 45814 const activeId = active == null ? void 0 : active.id; 45815 const previous = (0, import_react46.useRef)({ 45816 activeId, 45817 items, 45818 newIndex, 45819 containerId 45820 }); 45821 const itemsHaveChanged = items !== previous.current.items; 45822 const shouldAnimateLayoutChanges = animateLayoutChanges({ 45823 active, 45824 containerId, 45825 isDragging, 45826 isSorting, 45827 id, 45828 index: index2, 45829 items, 45830 newIndex: previous.current.newIndex, 45831 previousItems: previous.current.items, 45832 previousContainerId: previous.current.containerId, 45833 transition, 45834 wasDragging: previous.current.activeId != null 45835 }); 45836 const derivedTransform = useDerivedTransform({ 45837 disabled: !shouldAnimateLayoutChanges, 45838 index: index2, 45839 node, 45840 rect 45841 }); 45842 (0, import_react46.useEffect)(() => { 45843 if (isSorting && previous.current.newIndex !== newIndex) { 45844 previous.current.newIndex = newIndex; 45845 } 45846 if (containerId !== previous.current.containerId) { 45847 previous.current.containerId = containerId; 45848 } 45849 if (items !== previous.current.items) { 45850 previous.current.items = items; 45851 } 45852 }, [isSorting, newIndex, containerId, items]); 45853 (0, import_react46.useEffect)(() => { 45854 if (activeId === previous.current.activeId) { 45855 return; 45856 } 45857 if (activeId != null && previous.current.activeId == null) { 45858 previous.current.activeId = activeId; 45859 return; 45860 } 45861 const timeoutId = setTimeout(() => { 45862 previous.current.activeId = activeId; 45863 }, 50); 45864 return () => clearTimeout(timeoutId); 45865 }, [activeId]); 45866 return { 45867 active, 45868 activeIndex, 45869 attributes, 45870 data, 45871 rect, 45872 index: index2, 45873 newIndex, 45874 items, 45875 isOver, 45876 isSorting, 45877 isDragging, 45878 listeners, 45879 node, 45880 overIndex, 45881 over, 45882 setNodeRef, 45883 setActivatorNodeRef, 45884 setDroppableNodeRef, 45885 setDraggableNodeRef, 45886 transform: derivedTransform != null ? derivedTransform : finalTransform, 45887 transition: getTransition() 45888 }; 45889 function getTransition() { 45890 if ( 45891 // Temporarily disable transitions for a single frame to set up derived transforms 45892 derivedTransform || // Or to prevent items jumping to back to their "new" position when items change 45893 itemsHaveChanged && previous.current.newIndex === index2 45894 ) { 45895 return disabledTransition; 45896 } 45897 if (shouldDisplaceDragSource && !isKeyboardEvent(activatorEvent) || !transition) { 45898 return void 0; 45899 } 45900 if (isSorting || shouldAnimateLayoutChanges) { 45901 return CSS2.Transition.toString({ 45902 ...transition, 45903 property: transitionProperty 45904 }); 45905 } 45906 return void 0; 45907 } 45908 } 45909 function normalizeLocalDisabled(localDisabled, globalDisabled) { 45910 var _localDisabled$dragga, _localDisabled$droppa; 45911 if (typeof localDisabled === "boolean") { 45912 return { 45913 draggable: localDisabled, 45914 // Backwards compatibility 45915 droppable: false 45916 }; 45917 } 45918 return { 45919 draggable: (_localDisabled$dragga = localDisabled == null ? void 0 : localDisabled.draggable) != null ? _localDisabled$dragga : globalDisabled.draggable, 45920 droppable: (_localDisabled$droppa = localDisabled == null ? void 0 : localDisabled.droppable) != null ? _localDisabled$droppa : globalDisabled.droppable 45921 }; 45922 } 45923 function hasSortableData(entry) { 45924 if (!entry) { 45925 return false; 45926 } 45927 const data = entry.data.current; 45928 if (data && "sortable" in data && typeof data.sortable === "object" && "containerId" in data.sortable && "items" in data.sortable && "index" in data.sortable) { 45929 return true; 45930 } 45931 return false; 45932 } 45933 var directions = [KeyboardCode.Down, KeyboardCode.Right, KeyboardCode.Up, KeyboardCode.Left]; 45934 var sortableKeyboardCoordinates = (event, _ref) => { 45935 let { 45936 context: { 45937 active, 45938 collisionRect, 45939 droppableRects, 45940 droppableContainers, 45941 over, 45942 scrollableAncestors 45943 } 45944 } = _ref; 45945 if (directions.includes(event.code)) { 45946 event.preventDefault(); 45947 if (!active || !collisionRect) { 45948 return; 45949 } 45950 const filteredContainers = []; 45951 droppableContainers.getEnabled().forEach((entry) => { 45952 if (!entry || entry != null && entry.disabled) { 45953 return; 45954 } 45955 const rect = droppableRects.get(entry.id); 45956 if (!rect) { 45957 return; 45958 } 45959 switch (event.code) { 45960 case KeyboardCode.Down: 45961 if (collisionRect.top < rect.top) { 45962 filteredContainers.push(entry); 45963 } 45964 break; 45965 case KeyboardCode.Up: 45966 if (collisionRect.top > rect.top) { 45967 filteredContainers.push(entry); 45968 } 45969 break; 45970 case KeyboardCode.Left: 45971 if (collisionRect.left > rect.left) { 45972 filteredContainers.push(entry); 45973 } 45974 break; 45975 case KeyboardCode.Right: 45976 if (collisionRect.left < rect.left) { 45977 filteredContainers.push(entry); 45978 } 45979 break; 45980 } 45981 }); 45982 const collisions = closestCorners({ 45983 active, 45984 collisionRect, 45985 droppableRects, 45986 droppableContainers: filteredContainers, 45987 pointerCoordinates: null 45988 }); 45989 let closestId = getFirstCollision(collisions, "id"); 45990 if (closestId === (over == null ? void 0 : over.id) && collisions.length > 1) { 45991 closestId = collisions[1].id; 45992 } 45993 if (closestId != null) { 45994 const activeDroppable = droppableContainers.get(active.id); 45995 const newDroppable = droppableContainers.get(closestId); 45996 const newRect = newDroppable ? droppableRects.get(newDroppable.id) : null; 45997 const newNode = newDroppable == null ? void 0 : newDroppable.node.current; 45998 if (newNode && newRect && activeDroppable && newDroppable) { 45999 const newScrollAncestors = getScrollableAncestors(newNode); 46000 const hasDifferentScrollAncestors = newScrollAncestors.some((element, index2) => scrollableAncestors[index2] !== element); 46001 const hasSameContainer = isSameContainer(activeDroppable, newDroppable); 46002 const isAfterActive = isAfter(activeDroppable, newDroppable); 46003 const offset4 = hasDifferentScrollAncestors || !hasSameContainer ? { 46004 x: 0, 46005 y: 0 46006 } : { 46007 x: isAfterActive ? collisionRect.width - newRect.width : 0, 46008 y: isAfterActive ? collisionRect.height - newRect.height : 0 46009 }; 46010 const rectCoordinates = { 46011 x: newRect.left, 46012 y: newRect.top 46013 }; 46014 const newCoordinates = offset4.x && offset4.y ? rectCoordinates : subtract(rectCoordinates, offset4); 46015 return newCoordinates; 46016 } 46017 } 46018 } 46019 return void 0; 46020 }; 46021 function isSameContainer(a2, b2) { 46022 if (!hasSortableData(a2) || !hasSortableData(b2)) { 46023 return false; 46024 } 46025 return a2.data.current.sortable.containerId === b2.data.current.sortable.containerId; 46026 } 46027 function isAfter(a2, b2) { 46028 if (!hasSortableData(a2) || !hasSortableData(b2)) { 46029 return false; 46030 } 46031 if (!isSameContainer(a2, b2)) { 46032 return false; 46033 } 46034 return a2.data.current.sortable.index < b2.data.current.sortable.index; 46035 } 46036 46037 // packages/grid/build-module/dashboard-grid/index.mjs 46038 var import_compose25 = __toESM(require_compose(), 1); 46039 var import_element174 = __toESM(require_element(), 1); 46040 46041 // packages/grid/build-module/dashboard-grid/grid-item.mjs 46042 var import_element170 = __toESM(require_element(), 1); 46043 var import_compose24 = __toESM(require_compose(), 1); 46044 46045 // packages/grid/build-module/shared/grid-item-key.mjs 46046 var GRID_ITEM_DATA_KEY = "data-wp-grid-item-key"; 46047 46048 // packages/grid/build-module/shared/resize-handle.mjs 46049 var import_element169 = __toESM(require_element(), 1); 46050 var import_compose23 = __toESM(require_compose(), 1); 46051 var import_jsx_runtime216 = __toESM(require_jsx_runtime(), 1); 46052 var STYLE_HASH_ATTRIBUTE49 = "data-wp-hash"; 46053 function getRuntime49() { 46054 const globalScope = globalThis; 46055 if (globalScope.__wpStyleRuntime) { 46056 return globalScope.__wpStyleRuntime; 46057 } 46058 globalScope.__wpStyleRuntime = { 46059 documents: /* @__PURE__ */ new Map(), 46060 styles: /* @__PURE__ */ new Map(), 46061 injectedStyles: /* @__PURE__ */ new WeakMap() 46062 }; 46063 if (typeof document !== "undefined") { 46064 registerDocument49(document); 46065 } 46066 return globalScope.__wpStyleRuntime; 46067 } 46068 function documentContainsStyleHash49(targetDocument, hash) { 46069 if (!targetDocument.head) { 46070 return false; 46071 } 46072 for (const style of targetDocument.head.querySelectorAll( 46073 `style[$STYLE_HASH_ATTRIBUTE49}]` 46074 )) { 46075 if (style.getAttribute(STYLE_HASH_ATTRIBUTE49) === hash) { 46076 return true; 46077 } 46078 } 46079 return false; 46080 } 46081 function injectStyle49(targetDocument, hash, css) { 46082 if (!targetDocument.head) { 46083 return; 46084 } 46085 const runtime = getRuntime49(); 46086 let injectedStyles = runtime.injectedStyles.get(targetDocument); 46087 if (!injectedStyles) { 46088 injectedStyles = /* @__PURE__ */ new Set(); 46089 runtime.injectedStyles.set(targetDocument, injectedStyles); 46090 } 46091 if (injectedStyles.has(hash)) { 46092 return; 46093 } 46094 if (documentContainsStyleHash49(targetDocument, hash)) { 46095 injectedStyles.add(hash); 46096 return; 46097 } 46098 const style = targetDocument.createElement("style"); 46099 style.setAttribute(STYLE_HASH_ATTRIBUTE49, hash); 46100 style.appendChild(targetDocument.createTextNode(css)); 46101 targetDocument.head.appendChild(style); 46102 injectedStyles.add(hash); 46103 } 46104 function registerDocument49(targetDocument) { 46105 const runtime = getRuntime49(); 46106 runtime.documents.set( 46107 targetDocument, 46108 (runtime.documents.get(targetDocument) ?? 0) + 1 46109 ); 46110 for (const [hash, css] of runtime.styles) { 46111 injectStyle49(targetDocument, hash, css); 46112 } 46113 return () => { 46114 const count = runtime.documents.get(targetDocument); 46115 if (count === void 0) { 46116 return; 46117 } 46118 if (count <= 1) { 46119 runtime.documents.delete(targetDocument); 46120 return; 46121 } 46122 runtime.documents.set(targetDocument, count - 1); 46123 }; 46124 } 46125 function registerStyle49(hash, css) { 46126 const runtime = getRuntime49(); 46127 runtime.styles.set(hash, css); 46128 for (const targetDocument of runtime.documents.keys()) { 46129 injectStyle49(targetDocument, hash, css); 46130 } 46131 } 46132 if (typeof process === "undefined" || true) { 46133 registerStyle49("dde53d3bf4", '._91523dc3a37aecb8__resize-handle-slot{opacity:1}@media (prefers-reduced-motion:no-preference){._91523dc3a37aecb8__resize-handle-slot{transition:opacity var(--wpds-motion-duration-md,.2s) var(--wpds-motion-easing-subtle,cubic-bezier(.15,0,.15,1))}}[data-wp-grid-dragging] ._91523dc3a37aecb8__resize-handle-slot,[data-wp-grid-resizing] ._91523dc3a37aecb8__resize-handle-slot{opacity:0;pointer-events:none}[data-wp-grid-resizing]\n[data-wp-grid-item-resizing]\n._91523dc3a37aecb8__resize-handle-slot{opacity:1;pointer-events:auto}._4da787f72dc00d8b__resize-handle{border-block-end:12px solid var(--wpds-color-fg-interactive-brand,var(--wp-admin-theme-color,#3858e9));border-inline-start:12px solid #0000;bottom:0;cursor:nwse-resize;height:0;inset-inline-end:0;position:absolute;width:0;z-index:1}._885412b44a137da0__is-horizontal-only{align-items:center;background:#0000;border-style:none;bottom:auto;cursor:ew-resize;display:flex;height:40px;justify-content:center;top:50%;transform:translateY(-50%);width:16px}._885412b44a137da0__is-horizontal-only:before{background-color:var(--wpds-color-fg-interactive-brand,var(--wp-admin-theme-color,#3858e9));border-radius:2px;content:"";height:24px;width:4px}@media (forced-colors:active){._885412b44a137da0__is-horizontal-only:before{background-color:Highlight}}'); 46134 } 46135 var resize_handle_default = { "resize-handle-slot": "_91523dc3a37aecb8__resize-handle-slot", "resize-handle": "_4da787f72dc00d8b__resize-handle", "is-horizontal-only": "_885412b44a137da0__is-horizontal-only" }; 46136 function lockDocumentCursorWhileActive(getDocument2, cursor) { 46137 const root = getDocument2().documentElement; 46138 const previous = root.style.cursor; 46139 root.style.cursor = cursor; 46140 return () => { 46141 root.style.cursor = previous; 46142 }; 46143 } 46144 function ResizeHandle({ 46145 itemId, 46146 verticalResizable = true, 46147 renderResizeHandle 46148 }) { 46149 const { attributes, listeners, setNodeRef, isDragging } = useDraggable({ 46150 id: "draggable", 46151 data: { itemId } 46152 }); 46153 const ownerDocumentRef = (0, import_element169.useRef)(null); 46154 const setOwnerDocumentRef = (0, import_element169.useCallback)((node) => { 46155 ownerDocumentRef.current = node?.ownerDocument ?? null; 46156 }, []); 46157 const mergedRef = (0, import_compose23.useMergeRefs)([setOwnerDocumentRef, setNodeRef]); 46158 (0, import_element169.useEffect)(() => { 46159 if (!isDragging) { 46160 return; 46161 } 46162 const cursor = verticalResizable ? "nwse-resize" : "ew-resize"; 46163 return lockDocumentCursorWhileActive( 46164 () => ownerDocumentRef.current ?? document, 46165 cursor 46166 ); 46167 }, [isDragging, verticalResizable]); 46168 if (renderResizeHandle) { 46169 const RenderResizeHandle = renderResizeHandle; 46170 return /* @__PURE__ */ (0, import_jsx_runtime216.jsx)( 46171 RenderResizeHandle, 46172 { 46173 ref: mergedRef, 46174 listeners, 46175 attributes, 46176 verticalResizable, 46177 isResizing: isDragging, 46178 itemId 46179 } 46180 ); 46181 } 46182 return /* @__PURE__ */ (0, import_jsx_runtime216.jsx)( 46183 "div", 46184 { 46185 ref: mergedRef, 46186 className: clsx_default( 46187 resize_handle_default["resize-handle"], 46188 !verticalResizable && resize_handle_default["is-horizontal-only"] 46189 ), 46190 ...listeners, 46191 ...attributes 46192 } 46193 ); 46194 } 46195 function ResizeHandleWrapper(props) { 46196 const throttleDelay = 16; 46197 const throttledResize = (0, import_compose23.useThrottle)((delta) => { 46198 if (props.onResize) { 46199 props.onResize(delta); 46200 } 46201 }, throttleDelay); 46202 const handleDragMove = (event) => { 46203 if (event.active.id !== "draggable") { 46204 return; 46205 } 46206 throttledResize({ 46207 width: event.delta.x, 46208 height: event.delta.y 46209 }); 46210 }; 46211 const handleDragEnd = () => { 46212 if (props.onResizeEnd) { 46213 props.onResizeEnd(); 46214 } 46215 }; 46216 return /* @__PURE__ */ (0, import_jsx_runtime216.jsx)( 46217 DndContext, 46218 { 46219 autoScroll: { 46220 threshold: { x: 5e-3, y: 5e-3 }, 46221 acceleration: 1 46222 }, 46223 onDragMove: handleDragMove, 46224 onDragEnd: handleDragEnd, 46225 children: /* @__PURE__ */ (0, import_jsx_runtime216.jsx)("div", { className: resize_handle_default["resize-handle-slot"], children: /* @__PURE__ */ (0, import_jsx_runtime216.jsx)(ResizeHandle, { ...props }) }) 46226 } 46227 ); 46228 } 46229 46230 // packages/grid/build-module/shared/resize-snap.mjs 46231 function clampResizeDelta(delta, initialSize, minSize) { 46232 const maxShrinkWidth = initialSize.width - minSize.width; 46233 const width = Math.max(delta.width, -maxShrinkWidth); 46234 if (minSize.height === void 0) { 46235 return { ...delta, width }; 46236 } 46237 const maxShrinkHeight = initialSize.height - minSize.height; 46238 const height = Math.max(delta.height, -maxShrinkHeight); 46239 return { width, height }; 46240 } 46241 function gridSpanToPixelSize(columnSpan, rowSpan, columnWidth, gapPx, rowHeightPx) { 46242 const widthPx = columnSpan * columnWidth + (columnSpan - 1) * gapPx; 46243 const heightPx = rowHeightPx === null ? null : rowSpan * rowHeightPx + (rowSpan - 1) * gapPx; 46244 return { widthPx, heightPx }; 46245 } 46246 46247 // packages/grid/build-module/dashboard-grid/grid-item.mjs 46248 var import_jsx_runtime217 = __toESM(require_jsx_runtime(), 1); 46249 var STYLE_HASH_ATTRIBUTE50 = "data-wp-hash"; 46250 function getRuntime50() { 46251 const globalScope = globalThis; 46252 if (globalScope.__wpStyleRuntime) { 46253 return globalScope.__wpStyleRuntime; 46254 } 46255 globalScope.__wpStyleRuntime = { 46256 documents: /* @__PURE__ */ new Map(), 46257 styles: /* @__PURE__ */ new Map(), 46258 injectedStyles: /* @__PURE__ */ new WeakMap() 46259 }; 46260 if (typeof document !== "undefined") { 46261 registerDocument50(document); 46262 } 46263 return globalScope.__wpStyleRuntime; 46264 } 46265 function documentContainsStyleHash50(targetDocument, hash) { 46266 if (!targetDocument.head) { 46267 return false; 46268 } 46269 for (const style of targetDocument.head.querySelectorAll( 46270 `style[$STYLE_HASH_ATTRIBUTE50}]` 46271 )) { 46272 if (style.getAttribute(STYLE_HASH_ATTRIBUTE50) === hash) { 46273 return true; 46274 } 46275 } 46276 return false; 46277 } 46278 function injectStyle50(targetDocument, hash, css) { 46279 if (!targetDocument.head) { 46280 return; 46281 } 46282 const runtime = getRuntime50(); 46283 let injectedStyles = runtime.injectedStyles.get(targetDocument); 46284 if (!injectedStyles) { 46285 injectedStyles = /* @__PURE__ */ new Set(); 46286 runtime.injectedStyles.set(targetDocument, injectedStyles); 46287 } 46288 if (injectedStyles.has(hash)) { 46289 return; 46290 } 46291 if (documentContainsStyleHash50(targetDocument, hash)) { 46292 injectedStyles.add(hash); 46293 return; 46294 } 46295 const style = targetDocument.createElement("style"); 46296 style.setAttribute(STYLE_HASH_ATTRIBUTE50, hash); 46297 style.appendChild(targetDocument.createTextNode(css)); 46298 targetDocument.head.appendChild(style); 46299 injectedStyles.add(hash); 46300 } 46301 function registerDocument50(targetDocument) { 46302 const runtime = getRuntime50(); 46303 runtime.documents.set( 46304 targetDocument, 46305 (runtime.documents.get(targetDocument) ?? 0) + 1 46306 ); 46307 for (const [hash, css] of runtime.styles) { 46308 injectStyle50(targetDocument, hash, css); 46309 } 46310 return () => { 46311 const count = runtime.documents.get(targetDocument); 46312 if (count === void 0) { 46313 return; 46314 } 46315 if (count <= 1) { 46316 runtime.documents.delete(targetDocument); 46317 return; 46318 } 46319 runtime.documents.set(targetDocument, count - 1); 46320 }; 46321 } 46322 function registerStyle50(hash, css) { 46323 const runtime = getRuntime50(); 46324 runtime.styles.set(hash, css); 46325 for (const targetDocument of runtime.documents.keys()) { 46326 injectStyle50(targetDocument, hash, css); 46327 } 46328 } 46329 if (typeof process === "undefined" || true) { 46330 registerStyle50("ac1094954c", "._1c54fe8165d3023e__actionable-area-slot{opacity:1}@media (prefers-reduced-motion:no-preference){._1c54fe8165d3023e__actionable-area-slot{transition:opacity var(--wpds-motion-duration-md,.2s) var(--wpds-motion-easing-subtle,cubic-bezier(.15,0,.15,1))}}[data-wp-grid-resizing] ._1c54fe8165d3023e__actionable-area-slot{opacity:0;pointer-events:none}"); 46331 } 46332 var actionable_area_slot_default = { "actionable-area-slot": "_1c54fe8165d3023e__actionable-area-slot" }; 46333 if (typeof process === "undefined" || true) { 46334 registerStyle50("af050c3b2b", "._5d1abcb332a18701__item{position:relative}._54de57c12d3ce67e__item-content{height:100%;position:relative}._3e086aa073b9bbd9__is-resizing{overflow:visible;z-index:1}._3e086aa073b9bbd9__is-resizing ._54de57c12d3ce67e__item-content{overflow:visible;position:relative;z-index:2}._81d4e1a6c979f1e4__is-dragging{pointer-events:none}[data-wp-grid-dragging] ._81d4e1a6c979f1e4__is-dragging{border-radius:var(--wp-grid-placeholder-radius,0)}@media not (prefers-reduced-motion:reduce){[data-wp-grid-dragging] ._81d4e1a6c979f1e4__is-dragging{animation:_0447be8a7068a873__wp-grid-item-placeholder-in 0ms linear var(--wpds-motion-duration-sm,.1s) forwards;opacity:1;outline-color:#0000;outline-style:var(--wp-grid-placeholder-outline-style,dashed);outline-width:0}@keyframes _0447be8a7068a873__wp-grid-item-placeholder-in{to{opacity:var(--wp-grid-placeholder-opacity,.4);outline-color:var(--wp-grid-placeholder-outline-color,var(--wpds-color-stroke-interactive-brand,var(--wp-admin-theme-color,#3858e9)));outline-width:var(--wpds-border-width-sm,2px)}}}@media (prefers-reduced-motion:reduce){[data-wp-grid-dragging] ._81d4e1a6c979f1e4__is-dragging{opacity:var(--wp-grid-placeholder-opacity,.4);outline:var(--wpds-border-width-sm,2px) var(--wp-grid-placeholder-outline-style,dashed) var(--wp-grid-placeholder-outline-color,var(--wpds-color-stroke-interactive-brand,var(--wp-admin-theme-color,#3858e9)))}}@media (forced-colors:active){[data-wp-grid-dragging] ._81d4e1a6c979f1e4__is-dragging{--wp-grid-placeholder-outline-color:Highlight}}._2028fc095dbc5cb2__preview-overlay{background:#0000;border:var(--wpds-border-width-sm,2px) var(--wp-grid-resize-preview-outline-style,solid) var(--wp-grid-placeholder-outline-color,var(--wpds-color-stroke-interactive-brand,var(--wp-admin-theme-color,#3858e9)));border-radius:var(--wp-grid-placeholder-radius,0);box-sizing:border-box;inset-inline-start:0;pointer-events:none;position:absolute;top:0;z-index:0}@media (forced-colors:active){._2028fc095dbc5cb2__preview-overlay{border-color:Highlight}}"); 46335 } 46336 var grid_item_default = { "item": "_5d1abcb332a18701__item", "item-content": "_54de57c12d3ce67e__item-content", "is-resizing": "_3e086aa073b9bbd9__is-resizing", "is-dragging": "_81d4e1a6c979f1e4__is-dragging", "wp-grid-item-placeholder-in": "_0447be8a7068a873__wp-grid-item-placeholder-in", "preview-overlay": "_2028fc095dbc5cb2__preview-overlay" }; 46337 function getItemCursor(disabled2, interacting) { 46338 if (disabled2) { 46339 return "default"; 46340 } 46341 if (interacting) { 46342 return void 0; 46343 } 46344 return "grab"; 46345 } 46346 function GridItem4({ 46347 item, 46348 maxColumns, 46349 disabled: disabled2 = false, 46350 verticalResizable = true, 46351 interacting = false, 46352 dragging = false, 46353 children, 46354 actionableArea = null, 46355 onResize, 46356 onResizeEnd, 46357 resizeSnapPreview = null, 46358 minResizeWidthPx, 46359 minResizeHeightPx, 46360 renderResizeHandle 46361 }) { 46362 const [resizeDelta, setResizeDelta] = (0, import_element170.useState)( 46363 null 46364 ); 46365 const [initialContentSize, setInitialContentSize] = (0, import_element170.useState)(null); 46366 const itemRef = (0, import_element170.useRef)(null); 46367 const contentRef = (0, import_element170.useRef)(null); 46368 const { 46369 attributes, 46370 listeners, 46371 setNodeRef, 46372 setActivatorNodeRef, 46373 isDragging 46374 } = useSortable({ 46375 id: item.key, 46376 disabled: disabled2 46377 }); 46378 const mergedRef = (0, import_compose24.useMergeRefs)([itemRef, setNodeRef]); 46379 const contentMergedRef = (0, import_compose24.useMergeRefs)([contentRef]); 46380 const style = { 46381 gridColumnEnd: `span $item.width === "full" ? maxColumns : Math.min( 46382 typeof item.width === "number" ? item.width : 1, 46383 maxColumns 46384 )}`, 46385 gridRowEnd: `span $item.height || 1}` 46386 }; 46387 const isResizing = resizeDelta !== null; 46388 const itemClassName = clsx_default( 46389 grid_item_default.item, 46390 isDragging && grid_item_default["is-dragging"], 46391 isResizing && grid_item_default["is-resizing"] 46392 ); 46393 const handleResize = (delta) => { 46394 const contentNode = contentRef.current; 46395 let baselineSize = initialContentSize; 46396 if (contentNode && !baselineSize) { 46397 const { width, height } = contentNode.getBoundingClientRect(); 46398 baselineSize = { width, height }; 46399 setInitialContentSize(baselineSize); 46400 } 46401 let clamped = { 46402 width: delta.width, 46403 height: verticalResizable ? delta.height : 0 46404 }; 46405 if (baselineSize) { 46406 clamped = clampResizeDelta(clamped, baselineSize, { 46407 width: minResizeWidthPx, 46408 height: verticalResizable ? minResizeHeightPx : void 0 46409 }); 46410 } 46411 setResizeDelta(clamped); 46412 onResize(item.key, clamped); 46413 }; 46414 const handleResizeEnd = () => { 46415 setResizeDelta(null); 46416 setInitialContentSize(null); 46417 onResizeEnd(); 46418 }; 46419 const continuousContentStyle = resizeDelta && initialContentSize ? { 46420 width: initialContentSize.width + resizeDelta.width, 46421 height: verticalResizable ? initialContentSize.height + resizeDelta.height : void 0 46422 } : void 0; 46423 const previewOverlay = resizeSnapPreview ? /* @__PURE__ */ (0, import_jsx_runtime217.jsx)(SnapPreviewOverlay, { snap: resizeSnapPreview }) : null; 46424 return /* @__PURE__ */ (0, import_jsx_runtime217.jsxs)( 46425 "div", 46426 { 46427 ref: mergedRef, 46428 className: itemClassName, 46429 style, 46430 ...{ [GRID_ITEM_DATA_KEY]: item.key }, 46431 "data-wp-grid-item-resizing": isResizing || void 0, 46432 children: [ 46433 actionableArea ? /* @__PURE__ */ (0, import_jsx_runtime217.jsx)( 46434 "div", 46435 { 46436 className: actionable_area_slot_default["actionable-area-slot"], 46437 children: /* @__PURE__ */ (0, import_jsx_runtime217.jsx)( 46438 "div", 46439 { 46440 style: { display: "contents" }, 46441 inert: dragging || void 0, 46442 children: actionableArea 46443 } 46444 ) 46445 } 46446 ) : null, 46447 /* @__PURE__ */ (0, import_jsx_runtime217.jsxs)( 46448 "div", 46449 { 46450 ref: setActivatorNodeRef, 46451 ...attributes, 46452 ...listeners, 46453 style: { 46454 height: "100%", 46455 cursor: getItemCursor(disabled2, interacting) 46456 }, 46457 children: [ 46458 /* @__PURE__ */ (0, import_jsx_runtime217.jsxs)( 46459 "div", 46460 { 46461 ref: contentMergedRef, 46462 className: grid_item_default["item-content"], 46463 style: continuousContentStyle, 46464 children: [ 46465 children, 46466 !disabled2 && /* @__PURE__ */ (0, import_jsx_runtime217.jsx)( 46467 ResizeHandleWrapper, 46468 { 46469 itemId: item.key, 46470 verticalResizable, 46471 onResize: handleResize, 46472 onResizeEnd: handleResizeEnd, 46473 renderResizeHandle 46474 } 46475 ) 46476 ] 46477 } 46478 ), 46479 previewOverlay 46480 ] 46481 } 46482 ) 46483 ] 46484 } 46485 ); 46486 } 46487 function SnapPreviewOverlay({ snap }) { 46488 return /* @__PURE__ */ (0, import_jsx_runtime217.jsx)( 46489 "div", 46490 { 46491 className: grid_item_default["preview-overlay"], 46492 style: { 46493 width: snap.widthPx, 46494 height: snap.heightPx ?? "100%" 46495 } 46496 } 46497 ); 46498 } 46499 46500 // packages/grid/build-module/shared/grid-overlay.mjs 46501 var import_element171 = __toESM(require_element(), 1); 46502 var import_jsx_runtime218 = __toESM(require_jsx_runtime(), 1); 46503 var STYLE_HASH_ATTRIBUTE51 = "data-wp-hash"; 46504 function getRuntime51() { 46505 const globalScope = globalThis; 46506 if (globalScope.__wpStyleRuntime) { 46507 return globalScope.__wpStyleRuntime; 46508 } 46509 globalScope.__wpStyleRuntime = { 46510 documents: /* @__PURE__ */ new Map(), 46511 styles: /* @__PURE__ */ new Map(), 46512 injectedStyles: /* @__PURE__ */ new WeakMap() 46513 }; 46514 if (typeof document !== "undefined") { 46515 registerDocument51(document); 46516 } 46517 return globalScope.__wpStyleRuntime; 46518 } 46519 function documentContainsStyleHash51(targetDocument, hash) { 46520 if (!targetDocument.head) { 46521 return false; 46522 } 46523 for (const style of targetDocument.head.querySelectorAll( 46524 `style[$STYLE_HASH_ATTRIBUTE51}]` 46525 )) { 46526 if (style.getAttribute(STYLE_HASH_ATTRIBUTE51) === hash) { 46527 return true; 46528 } 46529 } 46530 return false; 46531 } 46532 function injectStyle51(targetDocument, hash, css) { 46533 if (!targetDocument.head) { 46534 return; 46535 } 46536 const runtime = getRuntime51(); 46537 let injectedStyles = runtime.injectedStyles.get(targetDocument); 46538 if (!injectedStyles) { 46539 injectedStyles = /* @__PURE__ */ new Set(); 46540 runtime.injectedStyles.set(targetDocument, injectedStyles); 46541 } 46542 if (injectedStyles.has(hash)) { 46543 return; 46544 } 46545 if (documentContainsStyleHash51(targetDocument, hash)) { 46546 injectedStyles.add(hash); 46547 return; 46548 } 46549 const style = targetDocument.createElement("style"); 46550 style.setAttribute(STYLE_HASH_ATTRIBUTE51, hash); 46551 style.appendChild(targetDocument.createTextNode(css)); 46552 targetDocument.head.appendChild(style); 46553 injectedStyles.add(hash); 46554 } 46555 function registerDocument51(targetDocument) { 46556 const runtime = getRuntime51(); 46557 runtime.documents.set( 46558 targetDocument, 46559 (runtime.documents.get(targetDocument) ?? 0) + 1 46560 ); 46561 for (const [hash, css] of runtime.styles) { 46562 injectStyle51(targetDocument, hash, css); 46563 } 46564 return () => { 46565 const count = runtime.documents.get(targetDocument); 46566 if (count === void 0) { 46567 return; 46568 } 46569 if (count <= 1) { 46570 runtime.documents.delete(targetDocument); 46571 return; 46572 } 46573 runtime.documents.set(targetDocument, count - 1); 46574 }; 46575 } 46576 function registerStyle51(hash, css) { 46577 const runtime = getRuntime51(); 46578 runtime.styles.set(hash, css); 46579 for (const targetDocument of runtime.documents.keys()) { 46580 injectStyle51(targetDocument, hash, css); 46581 } 46582 } 46583 if (typeof process === "undefined" || true) { 46584 registerStyle51("1883fed125", "._9d372b1b567c1c15__overlay{display:grid;gap:var(--wp-grid-gap,var(--wpds-dimension-gap-xl,24px));inset:0;opacity:0;pointer-events:none;position:absolute;visibility:hidden}._9d372b1b567c1c15__overlay.acb42ab28bd5e371__is-active{opacity:1;visibility:visible}@media not (prefers-reduced-motion){._9d372b1b567c1c15__overlay.acb42ab28bd5e371__is-active .d8e6ee9623aadacf__row,._9d372b1b567c1c15__overlay.acb42ab28bd5e371__is-active:not(._1cee1202cb622c6b__has-rows) ._04ff499ab60b4891__column{animation:_2d68e980e4534716__grid-overlay-tile-in var(--wpds-motion-duration-md,.2s) var(--wpds-motion-easing-subtle,cubic-bezier(.15,0,.15,1)) both;animation-delay:calc(var(--wp-grid-overlay-wave-delay-step, 28ms)*(var(--wp-grid-overlay-column-index, 0) + var(--wp-grid-overlay-row-index, 0)));opacity:0;transform:scale(.64)}@keyframes _2d68e980e4534716__grid-overlay-tile-in{to{opacity:1;transform:scale(1)}}._9d372b1b567c1c15__overlay:not(.acb42ab28bd5e371__is-active){transition:opacity var(--wpds-motion-duration-sm,.1s) var(--wpds-motion-easing-subtle,cubic-bezier(.15,0,.15,1)),visibility 0s linear var(--wpds-motion-duration-sm,.1s)}._9d372b1b567c1c15__overlay:not(.acb42ab28bd5e371__is-active) ._04ff499ab60b4891__column,._9d372b1b567c1c15__overlay:not(.acb42ab28bd5e371__is-active) .d8e6ee9623aadacf__row{animation:none;transform:none}}@media (prefers-reduced-motion:reduce){._9d372b1b567c1c15__overlay{transition:opacity var(--wpds-motion-duration-sm,.1s) var(--wpds-motion-easing-subtle,cubic-bezier(.15,0,.15,1)),visibility 0s linear var(--wpds-motion-duration-sm,.1s)}._9d372b1b567c1c15__overlay.acb42ab28bd5e371__is-active{transition:opacity var(--wpds-motion-duration-sm,.1s) var(--wpds-motion-easing-subtle,cubic-bezier(.15,0,.15,1)),visibility 0s linear 0s}}._04ff499ab60b4891__column{display:flex;flex-direction:column;gap:var(--wp-grid-gap,var(--wpds-dimension-gap-xl,24px));min-width:0}.d8e6ee9623aadacf__row{background-color:var(--wp-grid-overlay-tile-bg,var(--wpds-color-bg-surface-neutral-weak,#f4f4f4));border-radius:var(--wpds-border-radius-lg,8px);box-sizing:border-box;flex:0 0 var(--wp-grid-overlay-row-height);height:var(--wp-grid-overlay-row-height)}"); 46585 } 46586 var grid_overlay_default = { "overlay": "_9d372b1b567c1c15__overlay", "is-active": "acb42ab28bd5e371__is-active", "row": "d8e6ee9623aadacf__row", "has-rows": "_1cee1202cb622c6b__has-rows", "column": "_04ff499ab60b4891__column", "grid-overlay-tile-in": "_2d68e980e4534716__grid-overlay-tile-in" }; 46587 function GridOverlay({ 46588 columns, 46589 rowHeight, 46590 rows, 46591 isActive 46592 }) { 46593 const showRows = typeof rowHeight === "number" && typeof rows === "number" && rows > 0; 46594 const [waveKey, setWaveKey] = (0, import_element171.useState)(0); 46595 (0, import_element171.useEffect)(() => { 46596 if (isActive) { 46597 setWaveKey((key2) => key2 + 1); 46598 } 46599 }, [isActive]); 46600 const style = { 46601 gridTemplateColumns: `repeat($columns}, minmax(0, 1fr))`, 46602 ...showRows ? { 46603 "--wp-grid-overlay-row-height": `$rowHeight}px` 46604 } : {} 46605 }; 46606 return /* @__PURE__ */ (0, import_jsx_runtime218.jsx)( 46607 "div", 46608 { 46609 "aria-hidden": true, 46610 className: clsx_default( 46611 grid_overlay_default.overlay, 46612 isActive && grid_overlay_default["is-active"], 46613 showRows && grid_overlay_default["has-rows"] 46614 ), 46615 style, 46616 children: Array.from({ length: columns }, (_column, columnIndex) => /* @__PURE__ */ (0, import_jsx_runtime218.jsx)( 46617 "div", 46618 { 46619 className: grid_overlay_default.column, 46620 style: { 46621 "--wp-grid-overlay-column-index": columnIndex, 46622 "--wp-grid-overlay-row-index": 0 46623 }, 46624 children: showRows && Array.from({ length: rows }, (_row, rowIndex) => /* @__PURE__ */ (0, import_jsx_runtime218.jsx)( 46625 "div", 46626 { 46627 className: grid_overlay_default.row, 46628 style: { 46629 "--wp-grid-overlay-row-index": rowIndex 46630 } 46631 }, 46632 rowIndex 46633 )) 46634 }, 46635 columnIndex 46636 )) 46637 }, 46638 waveKey 46639 ); 46640 } 46641 46642 // packages/grid/build-module/shared/item-exit-overlay.mjs 46643 var import_jsx_runtime219 = __toESM(require_jsx_runtime(), 1); 46644 var STYLE_HASH_ATTRIBUTE52 = "data-wp-hash"; 46645 function getRuntime52() { 46646 const globalScope = globalThis; 46647 if (globalScope.__wpStyleRuntime) { 46648 return globalScope.__wpStyleRuntime; 46649 } 46650 globalScope.__wpStyleRuntime = { 46651 documents: /* @__PURE__ */ new Map(), 46652 styles: /* @__PURE__ */ new Map(), 46653 injectedStyles: /* @__PURE__ */ new WeakMap() 46654 }; 46655 if (typeof document !== "undefined") { 46656 registerDocument52(document); 46657 } 46658 return globalScope.__wpStyleRuntime; 46659 } 46660 function documentContainsStyleHash52(targetDocument, hash) { 46661 if (!targetDocument.head) { 46662 return false; 46663 } 46664 for (const style of targetDocument.head.querySelectorAll( 46665 `style[$STYLE_HASH_ATTRIBUTE52}]` 46666 )) { 46667 if (style.getAttribute(STYLE_HASH_ATTRIBUTE52) === hash) { 46668 return true; 46669 } 46670 } 46671 return false; 46672 } 46673 function injectStyle52(targetDocument, hash, css) { 46674 if (!targetDocument.head) { 46675 return; 46676 } 46677 const runtime = getRuntime52(); 46678 let injectedStyles = runtime.injectedStyles.get(targetDocument); 46679 if (!injectedStyles) { 46680 injectedStyles = /* @__PURE__ */ new Set(); 46681 runtime.injectedStyles.set(targetDocument, injectedStyles); 46682 } 46683 if (injectedStyles.has(hash)) { 46684 return; 46685 } 46686 if (documentContainsStyleHash52(targetDocument, hash)) { 46687 injectedStyles.add(hash); 46688 return; 46689 } 46690 const style = targetDocument.createElement("style"); 46691 style.setAttribute(STYLE_HASH_ATTRIBUTE52, hash); 46692 style.appendChild(targetDocument.createTextNode(css)); 46693 targetDocument.head.appendChild(style); 46694 injectedStyles.add(hash); 46695 } 46696 function registerDocument52(targetDocument) { 46697 const runtime = getRuntime52(); 46698 runtime.documents.set( 46699 targetDocument, 46700 (runtime.documents.get(targetDocument) ?? 0) + 1 46701 ); 46702 for (const [hash, css] of runtime.styles) { 46703 injectStyle52(targetDocument, hash, css); 46704 } 46705 return () => { 46706 const count = runtime.documents.get(targetDocument); 46707 if (count === void 0) { 46708 return; 46709 } 46710 if (count <= 1) { 46711 runtime.documents.delete(targetDocument); 46712 return; 46713 } 46714 runtime.documents.set(targetDocument, count - 1); 46715 }; 46716 } 46717 function registerStyle52(hash, css) { 46718 const runtime = getRuntime52(); 46719 runtime.styles.set(hash, css); 46720 for (const targetDocument of runtime.documents.keys()) { 46721 injectStyle52(targetDocument, hash, css); 46722 } 46723 } 46724 if (typeof process === "undefined" || true) { 46725 registerStyle52("1e0c56b346", ".f5f31b390af63a56__exit-overlay{opacity:1;overflow:hidden;pointer-events:none;position:absolute;transform:scale(1);transform-origin:center center;z-index:2}@media not (prefers-reduced-motion:reduce){.f5f31b390af63a56__exit-overlay{animation:_5e96d3d4062490e6__wp-grid-item-exit-opacity var(--wpds-motion-duration-md,.2s) var(--wpds-motion-easing-subtle,cubic-bezier(.15,0,.15,1)) forwards,a74da0751a183719__wp-grid-item-exit-scale var(--wpds-motion-duration-md,.2s) var(--wpds-motion-easing-balanced,cubic-bezier(.4,0,.2,1)) forwards}}@keyframes _5e96d3d4062490e6__wp-grid-item-exit-opacity{0%{opacity:1}to{opacity:0}}@keyframes a74da0751a183719__wp-grid-item-exit-scale{0%{transform:scale(1)}to{transform:scale(.88)}}@media (prefers-reduced-motion:reduce){.f5f31b390af63a56__exit-overlay{display:none}}"); 46726 } 46727 var item_exit_animation_default = { "exit-overlay": "f5f31b390af63a56__exit-overlay", "wp-grid-item-exit-opacity": "_5e96d3d4062490e6__wp-grid-item-exit-opacity", "wp-grid-item-exit-scale": "a74da0751a183719__wp-grid-item-exit-scale" }; 46728 function ItemExitOverlay({ 46729 itemKey, 46730 rect, 46731 children, 46732 onAnimationEnd 46733 }) { 46734 return /* @__PURE__ */ (0, import_jsx_runtime219.jsx)( 46735 "div", 46736 { 46737 className: item_exit_animation_default["exit-overlay"], 46738 style: { 46739 left: rect.left, 46740 top: rect.top, 46741 width: rect.width, 46742 height: rect.height 46743 }, 46744 ...{ [GRID_ITEM_DATA_KEY]: itemKey }, 46745 "data-wp-grid-item-exiting": "", 46746 onAnimationEnd: (event) => { 46747 if (event.target !== event.currentTarget) { 46748 return; 46749 } 46750 onAnimationEnd(); 46751 }, 46752 children 46753 } 46754 ); 46755 } 46756 46757 // packages/grid/build-module/shared/use-layout-shift-animation.mjs 46758 var import_element172 = __toESM(require_element(), 1); 46759 function queryGridItems(container) { 46760 return Array.from( 46761 container.querySelectorAll( 46762 `[$GRID_ITEM_DATA_KEY}]:not([data-wp-grid-item-exiting])` 46763 ) 46764 ); 46765 } 46766 function readItemKey(element) { 46767 return element.getAttribute(GRID_ITEM_DATA_KEY); 46768 } 46769 function snapshotPositions(container) { 46770 const base = container.getBoundingClientRect(); 46771 const positions = /* @__PURE__ */ new Map(); 46772 for (const element of queryGridItems(container)) { 46773 const key2 = readItemKey(element); 46774 if (!key2) { 46775 continue; 46776 } 46777 const { left, top, width, height } = element.getBoundingClientRect(); 46778 positions.set(key2, { 46779 left: left - base.left, 46780 top: top - base.top, 46781 width, 46782 height 46783 }); 46784 } 46785 return positions; 46786 } 46787 function clearLayoutShiftStyles(element) { 46788 element.style.removeProperty("transform"); 46789 element.style.removeProperty("transition"); 46790 } 46791 function playLayoutShift(element, deltaX, deltaY) { 46792 if (deltaX === 0 && deltaY === 0) { 46793 return; 46794 } 46795 element.style.transition = "none"; 46796 element.style.transform = `translate($deltaX}px, $deltaY}px)`; 46797 void element.offsetHeight; 46798 requestAnimationFrame(() => { 46799 element.style.removeProperty("transition"); 46800 element.style.transform = ""; 46801 const onTransitionEnd = (event) => { 46802 if (event.propertyName !== "transform") { 46803 return; 46804 } 46805 element.removeEventListener("transitionend", onTransitionEnd); 46806 clearLayoutShiftStyles(element); 46807 }; 46808 element.addEventListener("transitionend", onTransitionEnd); 46809 }); 46810 } 46811 function useLayoutShiftAnimation({ 46812 container, 46813 enabled, 46814 layoutFingerprint, 46815 excludeItemKey = null 46816 }) { 46817 const snapshotBeforeChangeRef = (0, import_element172.useRef)(null); 46818 const lastRenderedPositionsRef = (0, import_element172.useRef)(null); 46819 const positionsBeforeLastChangeRef = (0, import_element172.useRef)(null); 46820 const captureLayoutSnapshot = (0, import_element172.useCallback)(() => { 46821 if (container) { 46822 snapshotBeforeChangeRef.current = snapshotPositions(container); 46823 } 46824 }, [container]); 46825 (0, import_element172.useLayoutEffect)(() => { 46826 if (!container || !enabled) { 46827 snapshotBeforeChangeRef.current = null; 46828 lastRenderedPositionsRef.current = null; 46829 positionsBeforeLastChangeRef.current = null; 46830 if (container) { 46831 for (const element of queryGridItems(container)) { 46832 clearLayoutShiftStyles(element); 46833 } 46834 } 46835 return; 46836 } 46837 for (const element of queryGridItems(container)) { 46838 clearLayoutShiftStyles(element); 46839 } 46840 const previous = snapshotBeforeChangeRef.current ?? lastRenderedPositionsRef.current; 46841 snapshotBeforeChangeRef.current = null; 46842 positionsBeforeLastChangeRef.current = previous ? new Map(previous) : null; 46843 lastRenderedPositionsRef.current = snapshotPositions(container); 46844 if (previous) { 46845 const base = container.getBoundingClientRect(); 46846 for (const element of queryGridItems(container)) { 46847 const key2 = readItemKey(element); 46848 if (!key2 || key2 === excludeItemKey) { 46849 continue; 46850 } 46851 const old = previous.get(key2); 46852 if (!old) { 46853 continue; 46854 } 46855 const { left, top } = element.getBoundingClientRect(); 46856 const deltaX = old.left - (left - base.left); 46857 const deltaY = old.top - (top - base.top); 46858 playLayoutShift(element, deltaX, deltaY); 46859 } 46860 } 46861 }, [container, enabled, layoutFingerprint, excludeItemKey]); 46862 const getLastPositions = (0, import_element172.useCallback)(() => { 46863 return lastRenderedPositionsRef.current; 46864 }, []); 46865 const getPositionsBeforeLastChange = (0, import_element172.useCallback)(() => { 46866 return positionsBeforeLastChangeRef.current; 46867 }, []); 46868 return { 46869 captureLayoutSnapshot, 46870 getLastPositions, 46871 getPositionsBeforeLastChange 46872 }; 46873 } 46874 function getLayoutFingerprint(layout) { 46875 return layout.map( 46876 (item) => `$item.key}:$String(item.width ?? "")}:$item.height ?? 1}:$item.order ?? ""}:$item.lane ?? ""}` 46877 ).join("|"); 46878 } 46879 function getPlacementFingerprint(itemStyles) { 46880 return [...itemStyles.entries()].sort(([a2], [b2]) => a2.localeCompare(b2)).map(([key2, style]) => { 46881 const column = style.gridColumn ?? ""; 46882 const columnStart = style.gridColumnStart ?? ""; 46883 const rowStart = style.gridRowStart ?? ""; 46884 const rowEnd = style.gridRowEnd ?? ""; 46885 return `$key2}:$String(column)}:$String( 46886 columnStart 46887 )}:$String(rowStart)}:$String(rowEnd)}`; 46888 }).join("|"); 46889 } 46890 46891 // packages/grid/build-module/shared/use-item-exit-animation.mjs 46892 var import_element173 = __toESM(require_element(), 1); 46893 var EXIT_SAFETY_TIMEOUT_MS = 1e3; 46894 function prefersReducedMotion() { 46895 return typeof window !== "undefined" && window.matchMedia("(prefers-reduced-motion: reduce)").matches; 46896 } 46897 function useItemExitAnimation({ 46898 container, 46899 enabled, 46900 layoutKeys, 46901 getPositionsBeforeLastChange, 46902 childrenCacheRef 46903 }) { 46904 const [exitingItems, setExitingItems] = (0, import_element173.useState)( 46905 [] 46906 ); 46907 const prevLayoutKeysRef = (0, import_element173.useRef)(/* @__PURE__ */ new Set()); 46908 const exitTimeoutsRef = (0, import_element173.useRef)(/* @__PURE__ */ new Map()); 46909 const clearExitingItem = (0, import_element173.useCallback)( 46910 (key2) => { 46911 const timeout = exitTimeoutsRef.current.get(key2); 46912 if (timeout) { 46913 clearTimeout(timeout); 46914 exitTimeoutsRef.current.delete(key2); 46915 } 46916 setExitingItems( 46917 (current) => current.filter((item) => item.key !== key2) 46918 ); 46919 childrenCacheRef.current.delete(key2); 46920 }, 46921 [childrenCacheRef] 46922 ); 46923 const scheduleExitComplete = (0, import_element173.useCallback)( 46924 (key2) => { 46925 if (exitTimeoutsRef.current.has(key2)) { 46926 return; 46927 } 46928 const timeout = setTimeout(() => { 46929 exitTimeoutsRef.current.delete(key2); 46930 clearExitingItem(key2); 46931 }, EXIT_SAFETY_TIMEOUT_MS); 46932 exitTimeoutsRef.current.set(key2, timeout); 46933 }, 46934 [clearExitingItem] 46935 ); 46936 (0, import_element173.useLayoutEffect)(() => { 46937 if (!enabled || !container) { 46938 prevLayoutKeysRef.current = new Set(layoutKeys); 46939 for (const timeout of exitTimeoutsRef.current.values()) { 46940 clearTimeout(timeout); 46941 } 46942 exitTimeoutsRef.current.clear(); 46943 setExitingItems([]); 46944 return; 46945 } 46946 const prevKeys = prevLayoutKeysRef.current; 46947 const removed = []; 46948 for (const key2 of prevKeys) { 46949 if (!layoutKeys.has(key2)) { 46950 removed.push(key2); 46951 } 46952 } 46953 prevLayoutKeysRef.current = new Set(layoutKeys); 46954 if (removed.length === 0) { 46955 return; 46956 } 46957 const lastPositions = getPositionsBeforeLastChange(); 46958 if (!lastPositions) { 46959 return; 46960 } 46961 const nextExiting = []; 46962 for (const key2 of removed) { 46963 const position = lastPositions.get(key2); 46964 const child = childrenCacheRef.current.get(key2); 46965 if (!position || !child) { 46966 continue; 46967 } 46968 nextExiting.push({ 46969 key: key2, 46970 rect: position, 46971 child 46972 }); 46973 } 46974 if (nextExiting.length === 0) { 46975 return; 46976 } 46977 if (prefersReducedMotion()) { 46978 for (const { key: key2 } of nextExiting) { 46979 childrenCacheRef.current.delete(key2); 46980 } 46981 return; 46982 } 46983 setExitingItems((current) => [...current, ...nextExiting]); 46984 for (const { key: key2 } of nextExiting) { 46985 scheduleExitComplete(key2); 46986 } 46987 }, [ 46988 container, 46989 enabled, 46990 getPositionsBeforeLastChange, 46991 layoutKeys, 46992 childrenCacheRef, 46993 scheduleExitComplete 46994 ]); 46995 (0, import_element173.useLayoutEffect)(() => { 46996 const exitTimeouts = exitTimeoutsRef.current; 46997 return () => { 46998 for (const timeout of exitTimeouts.values()) { 46999 clearTimeout(timeout); 47000 } 47001 exitTimeouts.clear(); 47002 }; 47003 }, []); 47004 return { 47005 exitingItems, 47006 hasExitingItems: exitingItems.length > 0, 47007 clearExitingItem 47008 }; 47009 } 47010 47011 // packages/grid/build-module/dashboard-grid/resolve-fill-widths.mjs 47012 function resolveFillWidths(sortedKeys, layoutMap, maxColumns) { 47013 const resolved = /* @__PURE__ */ new Map(); 47014 const n2 = sortedKeys.length; 47015 const items = new Array(n2); 47016 const widths = new Array(n2); 47017 const heights = new Array(n2); 47018 let hasFill = false; 47019 let hasMultiRow = false; 47020 let totalRows = 0; 47021 for (let i2 = 0; i2 < n2; i2++) { 47022 const item = layoutMap.get(sortedKeys[i2]); 47023 items[i2] = item; 47024 widths[i2] = item && typeof item.width === "number" ? Math.min(item.width, maxColumns) : 1; 47025 const h2 = Math.max(1, Math.floor(item?.height ?? 1)); 47026 heights[i2] = h2; 47027 if (item?.width === "fill") { 47028 hasFill = true; 47029 } 47030 if (h2 > 1) { 47031 hasMultiRow = true; 47032 } 47033 totalRows += h2; 47034 } 47035 if (!hasFill) { 47036 return resolved; 47037 } 47038 if (!hasMultiRow) { 47039 let currentCol = 0; 47040 for (let i2 = 0; i2 < n2; i2++) { 47041 const item = items[i2]; 47042 if (!item) { 47043 continue; 47044 } 47045 if (item.width === "full") { 47046 currentCol = 0; 47047 continue; 47048 } 47049 if (item.width === "fill") { 47050 let reserved = 0; 47051 for (let j2 = i2 + 1; j2 < n2; j2++) { 47052 const next = items[j2]; 47053 if (!next || next.width === "full" || next.width === "fill") { 47054 break; 47055 } 47056 const nextW = widths[j2]; 47057 if (currentCol + 1 + reserved + nextW <= maxColumns) { 47058 reserved += nextW; 47059 } else { 47060 break; 47061 } 47062 } 47063 const fillCols = Math.max( 47064 1, 47065 maxColumns - currentCol - reserved 47066 ); 47067 resolved.set(item.key, fillCols); 47068 currentCol += fillCols; 47069 } else { 47070 const w2 = widths[i2]; 47071 if (currentCol + w2 > maxColumns) { 47072 currentCol = 0; 47073 } 47074 currentCol += w2; 47075 } 47076 if (currentCol >= maxColumns) { 47077 currentCol = 0; 47078 } 47079 } 47080 return resolved; 47081 } 47082 const rowOccupancy = new Array(maxColumns).fill(0); 47083 let cursorRow = 0; 47084 let cursorCol = 0; 47085 for (let i2 = 0; i2 < n2; i2++) { 47086 const item = items[i2]; 47087 if (!item) { 47088 continue; 47089 } 47090 const h2 = heights[i2]; 47091 if (item.width === "full") { 47092 let r22 = cursorRow; 47093 for (let c22 = 0; c22 < maxColumns; c22++) { 47094 if (rowOccupancy[c22] > r22) { 47095 r22 = rowOccupancy[c22]; 47096 } 47097 } 47098 for (let c22 = 0; c22 < maxColumns; c22++) { 47099 rowOccupancy[c22] = r22 + h2; 47100 } 47101 cursorRow = r22 + h2; 47102 cursorCol = 0; 47103 continue; 47104 } 47105 if (item.width === "fill") { 47106 let r22 = cursorRow; 47107 let c22 = cursorCol; 47108 scan: for (; r22 <= totalRows; r22++) { 47109 const start = r22 === cursorRow ? cursorCol : 0; 47110 for (c22 = start; c22 < maxColumns; c22++) { 47111 if (rowOccupancy[c22] <= r22) { 47112 break scan; 47113 } 47114 } 47115 } 47116 const fillStartRow = r22; 47117 const fillStartCol = c22; 47118 let runLength = 0; 47119 while (fillStartCol + runLength < maxColumns && rowOccupancy[fillStartCol + runLength] <= fillStartRow) { 47120 runLength++; 47121 } 47122 let reserved = 0; 47123 for (let j2 = i2 + 1; j2 < n2; j2++) { 47124 const next = items[j2]; 47125 if (!next || next.width === "full" || next.width === "fill") { 47126 break; 47127 } 47128 const nextW = widths[j2]; 47129 if (1 + reserved + nextW <= runLength) { 47130 reserved += nextW; 47131 } else { 47132 break; 47133 } 47134 } 47135 const fillCols = Math.max(1, runLength - reserved); 47136 resolved.set(item.key, fillCols); 47137 for (let k = 0; k < fillCols; k++) { 47138 rowOccupancy[fillStartCol + k] = fillStartRow + h2; 47139 } 47140 cursorRow = fillStartRow; 47141 cursorCol = fillStartCol + fillCols; 47142 continue; 47143 } 47144 const w2 = widths[i2]; 47145 let r3 = cursorRow; 47146 let c2 = cursorCol; 47147 place: for (; r3 <= totalRows; r3++) { 47148 c2 = r3 === cursorRow ? cursorCol : 0; 47149 while (c2 + w2 <= maxColumns) { 47150 let blocked = -1; 47151 for (let k = 0; k < w2; k++) { 47152 if (rowOccupancy[c2 + k] > r3) { 47153 blocked = c2 + k; 47154 break; 47155 } 47156 } 47157 if (blocked === -1) { 47158 break place; 47159 } 47160 c2 = blocked + 1; 47161 } 47162 } 47163 for (let k = 0; k < w2; k++) { 47164 rowOccupancy[c2 + k] = r3 + h2; 47165 } 47166 cursorRow = r3; 47167 cursorCol = c2 + w2; 47168 } 47169 return resolved; 47170 } 47171 47172 // packages/grid/build-module/shared/drag-overlay-drop-animation.mjs 47173 var DROP_ANIMATION_DURATION_MS = 200; 47174 var DROP_ANIMATION_EASING = "cubic-bezier(0.4, 0, 0.2, 1)"; 47175 function createDashboardDragDropAnimation(dragPreviewFrameClassName, exitingFrameClassName) { 47176 return { 47177 ...defaultDropAnimationConfiguration, 47178 duration: DROP_ANIMATION_DURATION_MS, 47179 easing: DROP_ANIMATION_EASING, 47180 sideEffects(args) { 47181 const cleanupDefault = defaultDropAnimationSideEffects({ 47182 styles: { 47183 active: { 47184 opacity: "0" 47185 } 47186 } 47187 })(args); 47188 const frame = args.dragOverlay.node.getElementsByClassName( 47189 dragPreviewFrameClassName 47190 )[0]; 47191 if (frame) { 47192 frame.getAnimations().forEach((animation) => animation.cancel()); 47193 const lift = frame.firstElementChild; 47194 if (lift instanceof HTMLElement) { 47195 lift.getAnimations().forEach( 47196 (animation) => animation.cancel() 47197 ); 47198 } 47199 frame.classList.add(exitingFrameClassName); 47200 } 47201 return () => { 47202 cleanupDefault?.(); 47203 if (frame) { 47204 frame.classList.remove(exitingFrameClassName); 47205 } 47206 }; 47207 } 47208 }; 47209 } 47210 47211 // packages/grid/build-module/dashboard-grid/index.mjs 47212 var import_jsx_runtime220 = __toESM(require_jsx_runtime(), 1); 47213 var STYLE_HASH_ATTRIBUTE53 = "data-wp-hash"; 47214 function getRuntime53() { 47215 const globalScope = globalThis; 47216 if (globalScope.__wpStyleRuntime) { 47217 return globalScope.__wpStyleRuntime; 47218 } 47219 globalScope.__wpStyleRuntime = { 47220 documents: /* @__PURE__ */ new Map(), 47221 styles: /* @__PURE__ */ new Map(), 47222 injectedStyles: /* @__PURE__ */ new WeakMap() 47223 }; 47224 if (typeof document !== "undefined") { 47225 registerDocument53(document); 47226 } 47227 return globalScope.__wpStyleRuntime; 47228 } 47229 function documentContainsStyleHash53(targetDocument, hash) { 47230 if (!targetDocument.head) { 47231 return false; 47232 } 47233 for (const style of targetDocument.head.querySelectorAll( 47234 `style[$STYLE_HASH_ATTRIBUTE53}]` 47235 )) { 47236 if (style.getAttribute(STYLE_HASH_ATTRIBUTE53) === hash) { 47237 return true; 47238 } 47239 } 47240 return false; 47241 } 47242 function injectStyle53(targetDocument, hash, css) { 47243 if (!targetDocument.head) { 47244 return; 47245 } 47246 const runtime = getRuntime53(); 47247 let injectedStyles = runtime.injectedStyles.get(targetDocument); 47248 if (!injectedStyles) { 47249 injectedStyles = /* @__PURE__ */ new Set(); 47250 runtime.injectedStyles.set(targetDocument, injectedStyles); 47251 } 47252 if (injectedStyles.has(hash)) { 47253 return; 47254 } 47255 if (documentContainsStyleHash53(targetDocument, hash)) { 47256 injectedStyles.add(hash); 47257 return; 47258 } 47259 const style = targetDocument.createElement("style"); 47260 style.setAttribute(STYLE_HASH_ATTRIBUTE53, hash); 47261 style.appendChild(targetDocument.createTextNode(css)); 47262 targetDocument.head.appendChild(style); 47263 injectedStyles.add(hash); 47264 } 47265 function registerDocument53(targetDocument) { 47266 const runtime = getRuntime53(); 47267 runtime.documents.set( 47268 targetDocument, 47269 (runtime.documents.get(targetDocument) ?? 0) + 1 47270 ); 47271 for (const [hash, css] of runtime.styles) { 47272 injectStyle53(targetDocument, hash, css); 47273 } 47274 return () => { 47275 const count = runtime.documents.get(targetDocument); 47276 if (count === void 0) { 47277 return; 47278 } 47279 if (count <= 1) { 47280 runtime.documents.delete(targetDocument); 47281 return; 47282 } 47283 runtime.documents.set(targetDocument, count - 1); 47284 }; 47285 } 47286 function registerStyle53(hash, css) { 47287 const runtime = getRuntime53(); 47288 runtime.styles.set(hash, css); 47289 for (const targetDocument of runtime.documents.keys()) { 47290 injectStyle53(targetDocument, hash, css); 47291 } 47292 } 47293 if (typeof process === "undefined" || true) { 47294 registerStyle53("9e5573e51f", "._2db63116caa90ae9__layout-animating [data-wp-grid-item-key]{transition:transform var(--wpds-motion-duration-md,.2s) var(--wpds-motion-easing-balanced,cubic-bezier(.4,0,.2,1))}@media (prefers-reduced-motion:reduce){._2db63116caa90ae9__layout-animating [data-wp-grid-item-key]{transition:none}}"); 47295 } 47296 var layout_shift_animation_default = { "layout-animating": "_2db63116caa90ae9__layout-animating" }; 47297 if (typeof process === "undefined" || true) { 47298 registerStyle53("52d51e7d5c", "._960c435c33759f46__grid{display:grid;gap:var(--wp-grid-gap,var(--wpds-dimension-gap-xl,24px));position:relative}._48e8cd4225dcb813__drag-preview-frame{border-radius:var(--wp-grid-drag-preview-radius,0);box-shadow:var(--wpds-elevation-md,0 2px 3px 0 #0000000d,0 4px 5px 0 #0000000a,0 12px 12px 0 #00000008,0 16px 16px 0 #00000005);cursor:grabbing;height:100%;pointer-events:none}._4b471bf24f891d2d__drag-preview-frame__lift{height:100%;transform:scale(var(--wp-grid-drag-preview-scale,1.05));transform-origin:center}@media not (prefers-reduced-motion:reduce){._48e8cd4225dcb813__drag-preview-frame{animation:_08fdf90ef86c4706__wp-grid-drag-preview-shadow-enter var(--wpds-motion-duration-sm,.1s) var(--wpds-motion-easing-balanced,cubic-bezier(.4,0,.2,1)) both}._4b471bf24f891d2d__drag-preview-frame__lift{animation:_8aaeb335436989f9__wp-grid-drag-preview-scale-enter var(--wpds-motion-duration-sm,.1s) var(--wpds-motion-easing-balanced,cubic-bezier(.4,0,.2,1)) both}}@media not (prefers-reduced-motion:reduce){@keyframes _08fdf90ef86c4706__wp-grid-drag-preview-shadow-enter{0%{box-shadow:var(--wpds-elevation-xs,0 1px 1px 0 #00000008,0 1px 2px 0 #00000005,0 3px 3px 0 #00000005,0 4px 4px 0 #00000003)}to{box-shadow:var(--wpds-elevation-md,0 2px 3px 0 #0000000d,0 4px 5px 0 #0000000a,0 12px 12px 0 #00000008,0 16px 16px 0 #00000005)}}@keyframes _8aaeb335436989f9__wp-grid-drag-preview-scale-enter{0%{transform:scale(1)}to{transform:scale(var(--wp-grid-drag-preview-scale,1.05))}}}@media not (prefers-reduced-motion:reduce){._48e8cd4225dcb813__drag-preview-frame._66b0aefb2bc02eb9__dragPreviewFrameExiting{animation:a7ead84bfd25ff8a__wp-grid-drag-preview-shadow-exit var(--wpds-motion-duration-md,.2s) var(--wpds-motion-easing-balanced,cubic-bezier(.4,0,.2,1)) forwards}._48e8cd4225dcb813__drag-preview-frame._66b0aefb2bc02eb9__dragPreviewFrameExiting ._4b471bf24f891d2d__drag-preview-frame__lift{animation:_234ccad5c20d49f8__wp-grid-drag-preview-scale-exit var(--wpds-motion-duration-md,.2s) var(--wpds-motion-easing-balanced,cubic-bezier(.4,0,.2,1)) forwards}@keyframes a7ead84bfd25ff8a__wp-grid-drag-preview-shadow-exit{0%{box-shadow:var(--wpds-elevation-md,0 2px 3px 0 #0000000d,0 4px 5px 0 #0000000a,0 12px 12px 0 #00000008,0 16px 16px 0 #00000005)}to{box-shadow:var(--wpds-elevation-xs,0 1px 1px 0 #00000008,0 1px 2px 0 #00000005,0 3px 3px 0 #00000005,0 4px 4px 0 #00000003)}}@keyframes _234ccad5c20d49f8__wp-grid-drag-preview-scale-exit{0%{transform:scale(var(--wp-grid-drag-preview-scale,1.05))}to{transform:scale(1)}}}._48e8cd4225dcb813__drag-preview-frame._66b0aefb2bc02eb9__dragPreviewFrameExiting{box-shadow:var(--wpds-elevation-xs,0 1px 1px 0 #00000008,0 1px 2px 0 #00000005,0 3px 3px 0 #00000005,0 4px 4px 0 #00000003)}._48e8cd4225dcb813__drag-preview-frame._66b0aefb2bc02eb9__dragPreviewFrameExiting ._4b471bf24f891d2d__drag-preview-frame__lift{transform:scale(1)}@media (prefers-reduced-motion:reduce){._48e8cd4225dcb813__drag-preview-frame{box-shadow:var(--wpds-elevation-md,0 2px 3px 0 #0000000d,0 4px 5px 0 #0000000a,0 12px 12px 0 #00000008,0 16px 16px 0 #00000005)}._4b471bf24f891d2d__drag-preview-frame__lift{transform:none}._48e8cd4225dcb813__drag-preview-frame._66b0aefb2bc02eb9__dragPreviewFrameExiting{box-shadow:var(--wpds-elevation-xs,0 1px 1px 0 #00000008,0 1px 2px 0 #00000005,0 3px 3px 0 #00000005,0 4px 4px 0 #00000003);transition:none}._48e8cd4225dcb813__drag-preview-frame._66b0aefb2bc02eb9__dragPreviewFrameExiting ._4b471bf24f891d2d__drag-preview-frame__lift{transition:none}}"); 47299 } 47300 var grid_default3 = { "grid": "_960c435c33759f46__grid", "drag-preview-frame": "_48e8cd4225dcb813__drag-preview-frame", "drag-preview-frame__lift": "_4b471bf24f891d2d__drag-preview-frame__lift", "wp-grid-drag-preview-shadow-enter": "_08fdf90ef86c4706__wp-grid-drag-preview-shadow-enter", "wp-grid-drag-preview-scale-enter": "_8aaeb335436989f9__wp-grid-drag-preview-scale-enter", "dragPreviewFrameExiting": "_66b0aefb2bc02eb9__dragPreviewFrameExiting", "wp-grid-drag-preview-shadow-exit": "a7ead84bfd25ff8a__wp-grid-drag-preview-shadow-exit", "wp-grid-drag-preview-scale-exit": "_234ccad5c20d49f8__wp-grid-drag-preview-scale-exit" }; 47301 var dashboardDragDropAnimation = createDashboardDragDropAnimation( 47302 grid_default3["drag-preview-frame"], 47303 grid_default3.dragPreviewFrameExiting 47304 ); 47305 var FALLBACK_GAP_PX = 24; 47306 var DEFAULT_COLUMNS = 6; 47307 var NO_SORT_STRATEGY = () => null; 47308 var DashboardGrid = (0, import_element174.forwardRef)( 47309 function DashboardGrid2(props, ref) { 47310 const { 47311 layout, 47312 columns, 47313 children, 47314 className, 47315 style, 47316 rowHeight = "auto", 47317 minColumnWidth, 47318 editMode = false, 47319 onChangeLayout, 47320 onPreviewLayout, 47321 renderResizeHandle, 47322 renderDragPreview, 47323 renderGridOverlay, 47324 ...divProps 47325 } = props; 47326 const [temporaryLayout, setTemporaryLayout] = (0, import_element174.useState)(); 47327 const [activeId, setActiveId] = (0, import_element174.useState)(null); 47328 const [isResizing, setIsResizing] = (0, import_element174.useState)(false); 47329 const [resizeSnapPreview, setResizeSnapPreview] = (0, import_element174.useState)(null); 47330 const latestLayoutRef = (0, import_element174.useRef)( 47331 void 0 47332 ); 47333 const lastReorderCursorRef = (0, import_element174.useRef)(null); 47334 const resizeBaselineRef = (0, import_element174.useRef)(null); 47335 const captureLayoutSnapshotRef = (0, import_element174.useRef)(() => { 47336 }); 47337 const childrenCacheRef = (0, import_element174.useRef)( 47338 /* @__PURE__ */ new Map() 47339 ); 47340 const activeLayout = temporaryLayout ?? layout; 47341 const [gridRoot, setGridRoot] = (0, import_element174.useState)( 47342 null 47343 ); 47344 const [containerWidth, setContainerWidth] = (0, import_element174.useState)(0); 47345 const [containerHeight, setContainerHeight] = (0, import_element174.useState)(0); 47346 const [gapPx, setGapPx] = (0, import_element174.useState)(FALLBACK_GAP_PX); 47347 const resizeObserverRef = (0, import_compose25.useResizeObserver)( 47348 ([{ contentRect }]) => { 47349 setContainerWidth(contentRect.width); 47350 setContainerHeight(contentRect.height); 47351 } 47352 ); 47353 const mergedGridRef = (0, import_compose25.useMergeRefs)([ 47354 setGridRoot, 47355 resizeObserverRef, 47356 ref 47357 ]); 47358 (0, import_element174.useLayoutEffect)(() => { 47359 if (!gridRoot) { 47360 return; 47361 } 47362 const { width, height } = gridRoot.getBoundingClientRect(); 47363 if (width > 0) { 47364 setContainerWidth(width); 47365 } 47366 if (height > 0) { 47367 setContainerHeight(height); 47368 } 47369 const parsed = Number.parseFloat( 47370 window.getComputedStyle(gridRoot).columnGap 47371 ); 47372 if (Number.isFinite(parsed) && parsed > 0) { 47373 setGapPx(parsed); 47374 } 47375 }, [gridRoot]); 47376 const effectiveColumns = (0, import_element174.useMemo)(() => { 47377 if (!minColumnWidth) { 47378 return columns ?? DEFAULT_COLUMNS; 47379 } 47380 const totalWidthPerColumn = minColumnWidth + gapPx; 47381 const maxFit = Math.max( 47382 1, 47383 Math.floor((containerWidth + gapPx) / totalWidthPerColumn) 47384 ); 47385 return columns !== void 0 ? Math.min(columns, maxFit) : maxFit; 47386 }, [minColumnWidth, gapPx, containerWidth, columns]); 47387 const columnWidth = (containerWidth - (effectiveColumns - 1) * gapPx) / effectiveColumns; 47388 const minResizeWidthPx = gridSpanToPixelSize( 47389 1, 47390 1, 47391 columnWidth, 47392 gapPx, 47393 null 47394 ).widthPx; 47395 const rowHeightPx = typeof rowHeight === "number" ? rowHeight : null; 47396 const minResizeHeightPx = rowHeightPx === null ? void 0 : gridSpanToPixelSize(1, 1, columnWidth, gapPx, rowHeightPx).heightPx ?? void 0; 47397 const layoutMap = (0, import_element174.useMemo)(() => { 47398 const map = /* @__PURE__ */ new Map(); 47399 activeLayout.forEach((item) => map.set(item.key, item)); 47400 return map; 47401 }, [activeLayout]); 47402 const layoutKeys = (0, import_element174.useMemo)( 47403 () => new Set(layout.map((item) => item.key)), 47404 [layout] 47405 ); 47406 const sortedItems = (0, import_element174.useMemo)( 47407 () => activeLayout.map((item, index2) => ({ item, index: index2 })).sort( 47408 (a2, b2) => (a2.item.order ?? a2.index) - (b2.item.order ?? b2.index) 47409 ).map(({ item }) => item.key), 47410 [activeLayout] 47411 ); 47412 const items = sortedItems; 47413 const resolvedItemMap = (0, import_element174.useMemo)(() => { 47414 const fillWidths = resolveFillWidths( 47415 items, 47416 layoutMap, 47417 effectiveColumns 47418 ); 47419 if (fillWidths.size === 0) { 47420 return layoutMap; 47421 } 47422 const map = /* @__PURE__ */ new Map(); 47423 for (const [key2, item] of layoutMap) { 47424 const fillW = fillWidths.get(key2); 47425 map.set( 47426 key2, 47427 fillW !== void 0 ? { ...item, width: fillW } : item 47428 ); 47429 } 47430 return map; 47431 }, [items, layoutMap, effectiveColumns]); 47432 const [childrenMap, actionableAreaMap, remaining, renderedByKey] = (0, import_element174.useMemo)(() => { 47433 const childMap = /* @__PURE__ */ new Map(); 47434 const actionableMap = /* @__PURE__ */ new Map(); 47435 const rest = []; 47436 const byKey = /* @__PURE__ */ new Map(); 47437 import_element174.Children.forEach(children, (child) => { 47438 if (!(0, import_element174.isValidElement)(child)) { 47439 rest.push(child); 47440 return; 47441 } 47442 const key2 = child.key?.toString(); 47443 if (!key2) { 47444 rest.push(child); 47445 return; 47446 } 47447 const typedChild = child; 47448 const { actionableArea } = typedChild.props; 47449 const stripped = actionableArea !== void 0 ? (0, import_element174.cloneElement)(typedChild, { 47450 actionableArea: void 0 47451 }) : child; 47452 byKey.set(key2, stripped); 47453 if (layoutKeys.has(key2)) { 47454 if (actionableArea !== void 0) { 47455 actionableMap.set(key2, actionableArea); 47456 } 47457 childMap.set(key2, stripped); 47458 } else { 47459 rest.push(child); 47460 } 47461 }); 47462 return [childMap, actionableMap, rest, byKey]; 47463 }, [children, layoutKeys]); 47464 (0, import_element174.useLayoutEffect)(() => { 47465 for (const [key2, child] of renderedByKey) { 47466 childrenCacheRef.current.set(key2, child); 47467 } 47468 }, [renderedByKey]); 47469 const sensors = useSensors( 47470 useSensor(PointerSensor), 47471 useSensor(KeyboardSensor, { 47472 coordinateGetter: sortableKeyboardCoordinates 47473 }) 47474 ); 47475 const handleDragStart = (0, import_compose25.useEvent)((event) => { 47476 setActiveId(String(event.active.id)); 47477 lastReorderCursorRef.current = null; 47478 }); 47479 const handleDragCancel = (0, import_compose25.useEvent)(() => { 47480 setActiveId(null); 47481 latestLayoutRef.current = void 0; 47482 lastReorderCursorRef.current = null; 47483 resizeBaselineRef.current = null; 47484 setIsResizing(false); 47485 setResizeSnapPreview(null); 47486 setTemporaryLayout(void 0); 47487 }); 47488 const handleDragMove = (0, import_compose25.useEvent)((event) => { 47489 const { active, over } = event; 47490 if (!over || active.id === over.id) { 47491 return; 47492 } 47493 const activeRect = active.rect.current.translated; 47494 if (!activeRect) { 47495 return; 47496 } 47497 const activeCenterX = activeRect.left + activeRect.width / 2; 47498 const activeCenterY = activeRect.top + activeRect.height / 2; 47499 const lastCursor = lastReorderCursorRef.current; 47500 if (lastCursor) { 47501 const dx = activeCenterX - lastCursor.x; 47502 const dy = activeCenterY - lastCursor.y; 47503 if (dx * dx + dy * dy < 100) { 47504 return; 47505 } 47506 } 47507 const overCenterX = over.rect.left + over.rect.width / 2; 47508 const insertAfter = activeCenterX > overCenterX; 47509 const currentIndex = items.indexOf(String(active.id)); 47510 const overIndex = items.indexOf(String(over.id)); 47511 let newIndex; 47512 if (insertAfter) { 47513 newIndex = currentIndex > overIndex ? overIndex + 1 : overIndex; 47514 } else { 47515 newIndex = currentIndex > overIndex ? overIndex : overIndex - 1; 47516 } 47517 newIndex = Math.max(0, Math.min(newIndex, items.length - 1)); 47518 if (newIndex === currentIndex) { 47519 return; 47520 } 47521 const updatedItems = arrayMove(items, currentIndex, newIndex); 47522 const updatedLayout = activeLayout.map((item) => ({ 47523 ...item, 47524 order: updatedItems.indexOf(item.key) 47525 })); 47526 lastReorderCursorRef.current = { 47527 x: activeCenterX, 47528 y: activeCenterY 47529 }; 47530 latestLayoutRef.current = updatedLayout; 47531 captureLayoutSnapshotRef.current(); 47532 setTemporaryLayout(updatedLayout); 47533 onPreviewLayout?.(updatedLayout); 47534 }); 47535 const persistTemporaryLayout = (0, import_compose25.useEvent)(() => { 47536 const latest = latestLayoutRef.current; 47537 latestLayoutRef.current = void 0; 47538 resizeBaselineRef.current = null; 47539 setIsResizing(false); 47540 setResizeSnapPreview(null); 47541 if (!onChangeLayout || !latest) { 47542 setTemporaryLayout(void 0); 47543 return; 47544 } 47545 onChangeLayout(latest); 47546 setTemporaryLayout(void 0); 47547 }); 47548 const handleResize = (0, import_compose25.useEvent)((id, delta) => { 47549 if (!editMode) { 47550 return; 47551 } 47552 if (!isResizing) { 47553 setIsResizing(true); 47554 } 47555 const relativeDelta = { 47556 width: Math.round(delta.width / (columnWidth + gapPx)), 47557 height: rowHeight === "auto" ? 0 : Math.round(delta.height / (rowHeight + gapPx)) 47558 }; 47559 if (!resizeBaselineRef.current) { 47560 const baseItem = activeLayout.find( 47561 (item) => item.key === id 47562 ); 47563 const resolvedItem = resolvedItemMap.get(id); 47564 let baseWidth; 47565 if (baseItem?.width === "full") { 47566 baseWidth = effectiveColumns; 47567 } else if (baseItem?.width === "fill") { 47568 baseWidth = typeof resolvedItem?.width === "number" ? resolvedItem.width : 1; 47569 } else { 47570 baseWidth = baseItem?.width ?? 1; 47571 } 47572 resizeBaselineRef.current = { 47573 width: baseWidth, 47574 height: baseItem?.height ?? 1 47575 }; 47576 } 47577 const baseline = resizeBaselineRef.current; 47578 const newWidth = Math.max( 47579 1, 47580 Math.min( 47581 baseline.width + relativeDelta.width, 47582 effectiveColumns 47583 ) 47584 ); 47585 const newHeight = Math.max( 47586 1, 47587 baseline.height + relativeDelta.height 47588 ); 47589 setResizeSnapPreview({ 47590 id, 47591 snap: gridSpanToPixelSize( 47592 newWidth, 47593 newHeight, 47594 columnWidth, 47595 gapPx, 47596 rowHeightPx 47597 ) 47598 }); 47599 const pendingItem = latestLayoutRef.current?.find( 47600 (item) => item.key === id 47601 ); 47602 const currentItem = pendingItem ?? activeLayout.find((item) => item.key === id); 47603 if (currentItem && currentItem.width === newWidth && (currentItem.height ?? 1) === newHeight) { 47604 return; 47605 } 47606 const updatedLayout = activeLayout.map( 47607 (item) => item.key === id ? { ...item, width: newWidth, height: newHeight } : item 47608 ); 47609 latestLayoutRef.current = updatedLayout; 47610 captureLayoutSnapshotRef.current(); 47611 setTemporaryLayout(updatedLayout); 47612 onPreviewLayout?.(updatedLayout); 47613 }); 47614 const activeClone = activeId ? childrenMap.get(activeId) : null; 47615 const DragPreview = renderDragPreview; 47616 const dragOverlayContent = activeId && activeClone ? /* @__PURE__ */ (0, import_jsx_runtime220.jsx)("div", { className: grid_default3["drag-preview-frame"], children: /* @__PURE__ */ (0, import_jsx_runtime220.jsx)("div", { className: grid_default3["drag-preview-frame__lift"], children: DragPreview ? /* @__PURE__ */ (0, import_jsx_runtime220.jsx)(DragPreview, { itemId: activeId, children: activeClone }) : activeClone }) }) : null; 47617 const Overlay = renderGridOverlay ?? GridOverlay; 47618 const overlayRowHeight = typeof rowHeight === "number" ? rowHeight : void 0; 47619 const overlayRows = (0, import_element174.useMemo)(() => { 47620 if (overlayRowHeight === void 0 || containerHeight <= 0) { 47621 return void 0; 47622 } 47623 const rowTile = overlayRowHeight + gapPx; 47624 return Math.max( 47625 1, 47626 Math.floor((containerHeight + gapPx) / rowTile) 47627 ); 47628 }, [overlayRowHeight, containerHeight, gapPx]); 47629 const gridOverlay = (0, import_element174.useMemo)( 47630 () => /* @__PURE__ */ (0, import_jsx_runtime220.jsx)( 47631 Overlay, 47632 { 47633 columns: effectiveColumns, 47634 rowHeight: overlayRowHeight, 47635 rows: overlayRows, 47636 isActive: editMode 47637 } 47638 ), 47639 [ 47640 Overlay, 47641 editMode, 47642 effectiveColumns, 47643 overlayRowHeight, 47644 overlayRows 47645 ] 47646 ); 47647 const layoutFingerprint = (0, import_element174.useMemo)( 47648 () => getLayoutFingerprint([...resolvedItemMap.values()]), 47649 [resolvedItemMap] 47650 ); 47651 const excludeLayoutAnimationKey = activeId ?? (isResizing ? resizeSnapPreview?.id : null); 47652 const { captureLayoutSnapshot, getPositionsBeforeLastChange } = useLayoutShiftAnimation({ 47653 container: gridRoot, 47654 enabled: editMode, 47655 layoutFingerprint, 47656 excludeItemKey: excludeLayoutAnimationKey 47657 }); 47658 const { exitingItems, clearExitingItem } = useItemExitAnimation({ 47659 container: gridRoot, 47660 enabled: editMode, 47661 layoutKeys, 47662 getPositionsBeforeLastChange, 47663 childrenCacheRef 47664 }); 47665 const layoutAnimating = editMode; 47666 (0, import_element174.useLayoutEffect)(() => { 47667 captureLayoutSnapshotRef.current = captureLayoutSnapshot; 47668 }, [captureLayoutSnapshot]); 47669 return /* @__PURE__ */ (0, import_jsx_runtime220.jsxs)( 47670 DndContext, 47671 { 47672 sensors, 47673 onDragStart: handleDragStart, 47674 onDragCancel: handleDragCancel, 47675 onDragMove: handleDragMove, 47676 onDragEnd: () => { 47677 persistTemporaryLayout(); 47678 lastReorderCursorRef.current = null; 47679 setActiveId(null); 47680 }, 47681 children: [ 47682 /* @__PURE__ */ (0, import_jsx_runtime220.jsx)(SortableContext, { items, strategy: NO_SORT_STRATEGY, children: /* @__PURE__ */ (0, import_jsx_runtime220.jsxs)( 47683 "div", 47684 { 47685 ...divProps, 47686 ref: mergedGridRef, 47687 className: clsx_default( 47688 grid_default3.grid, 47689 layoutAnimating && layout_shift_animation_default["layout-animating"], 47690 className 47691 ), 47692 "data-wp-grid-dragging": activeId || void 0, 47693 "data-wp-grid-resizing": isResizing || void 0, 47694 style: { 47695 ...style, 47696 gridTemplateColumns: `repeat($effectiveColumns}, minmax(0, 1fr))`, 47697 gridAutoRows: rowHeight 47698 }, 47699 children: [ 47700 gridOverlay, 47701 items.map((id) => /* @__PURE__ */ (0, import_jsx_runtime220.jsx)( 47702 GridItem4, 47703 { 47704 item: resolvedItemMap.get( 47705 id 47706 ), 47707 maxColumns: effectiveColumns, 47708 disabled: !editMode, 47709 verticalResizable: rowHeight !== "auto", 47710 interacting: activeId !== null || isResizing, 47711 dragging: activeId !== null, 47712 onResize: handleResize, 47713 onResizeEnd: persistTemporaryLayout, 47714 resizeSnapPreview: resizeSnapPreview?.id === id ? resizeSnapPreview.snap : null, 47715 minResizeWidthPx, 47716 minResizeHeightPx, 47717 actionableArea: actionableAreaMap.get(id), 47718 renderResizeHandle, 47719 children: childrenMap.get(id) 47720 }, 47721 id 47722 )), 47723 remaining, 47724 exitingItems.map(({ key: key2, rect, child }) => /* @__PURE__ */ (0, import_jsx_runtime220.jsx)( 47725 ItemExitOverlay, 47726 { 47727 itemKey: key2, 47728 rect, 47729 onAnimationEnd: () => clearExitingItem(key2), 47730 children: child 47731 }, 47732 `exiting-$key2}` 47733 )) 47734 ] 47735 } 47736 ) }), 47737 /* @__PURE__ */ (0, import_jsx_runtime220.jsx)(DragOverlay, { dropAnimation: dashboardDragDropAnimation, children: dragOverlayContent }) 47738 ] 47739 } 47740 ); 47741 } 47742 ); 47743 47744 // packages/grid/build-module/dashboard-lanes/index.mjs 47745 var import_compose27 = __toESM(require_compose(), 1); 47746 var import_element177 = __toESM(require_element(), 1); 47747 47748 // packages/grid/build-module/dashboard-lanes/lanes-item.mjs 47749 var import_element175 = __toESM(require_element(), 1); 47750 var import_compose26 = __toESM(require_compose(), 1); 47751 var import_jsx_runtime221 = __toESM(require_jsx_runtime(), 1); 47752 var STYLE_HASH_ATTRIBUTE54 = "data-wp-hash"; 47753 function getRuntime54() { 47754 const globalScope = globalThis; 47755 if (globalScope.__wpStyleRuntime) { 47756 return globalScope.__wpStyleRuntime; 47757 } 47758 globalScope.__wpStyleRuntime = { 47759 documents: /* @__PURE__ */ new Map(), 47760 styles: /* @__PURE__ */ new Map(), 47761 injectedStyles: /* @__PURE__ */ new WeakMap() 47762 }; 47763 if (typeof document !== "undefined") { 47764 registerDocument54(document); 47765 } 47766 return globalScope.__wpStyleRuntime; 47767 } 47768 function documentContainsStyleHash54(targetDocument, hash) { 47769 if (!targetDocument.head) { 47770 return false; 47771 } 47772 for (const style of targetDocument.head.querySelectorAll( 47773 `style[$STYLE_HASH_ATTRIBUTE54}]` 47774 )) { 47775 if (style.getAttribute(STYLE_HASH_ATTRIBUTE54) === hash) { 47776 return true; 47777 } 47778 } 47779 return false; 47780 } 47781 function injectStyle54(targetDocument, hash, css) { 47782 if (!targetDocument.head) { 47783 return; 47784 } 47785 const runtime = getRuntime54(); 47786 let injectedStyles = runtime.injectedStyles.get(targetDocument); 47787 if (!injectedStyles) { 47788 injectedStyles = /* @__PURE__ */ new Set(); 47789 runtime.injectedStyles.set(targetDocument, injectedStyles); 47790 } 47791 if (injectedStyles.has(hash)) { 47792 return; 47793 } 47794 if (documentContainsStyleHash54(targetDocument, hash)) { 47795 injectedStyles.add(hash); 47796 return; 47797 } 47798 const style = targetDocument.createElement("style"); 47799 style.setAttribute(STYLE_HASH_ATTRIBUTE54, hash); 47800 style.appendChild(targetDocument.createTextNode(css)); 47801 targetDocument.head.appendChild(style); 47802 injectedStyles.add(hash); 47803 } 47804 function registerDocument54(targetDocument) { 47805 const runtime = getRuntime54(); 47806 runtime.documents.set( 47807 targetDocument, 47808 (runtime.documents.get(targetDocument) ?? 0) + 1 47809 ); 47810 for (const [hash, css] of runtime.styles) { 47811 injectStyle54(targetDocument, hash, css); 47812 } 47813 return () => { 47814 const count = runtime.documents.get(targetDocument); 47815 if (count === void 0) { 47816 return; 47817 } 47818 if (count <= 1) { 47819 runtime.documents.delete(targetDocument); 47820 return; 47821 } 47822 runtime.documents.set(targetDocument, count - 1); 47823 }; 47824 } 47825 function registerStyle54(hash, css) { 47826 const runtime = getRuntime54(); 47827 runtime.styles.set(hash, css); 47828 for (const targetDocument of runtime.documents.keys()) { 47829 injectStyle54(targetDocument, hash, css); 47830 } 47831 } 47832 if (typeof process === "undefined" || true) { 47833 registerStyle54("ac1094954c", "._1c54fe8165d3023e__actionable-area-slot{opacity:1}@media (prefers-reduced-motion:no-preference){._1c54fe8165d3023e__actionable-area-slot{transition:opacity var(--wpds-motion-duration-md,.2s) var(--wpds-motion-easing-subtle,cubic-bezier(.15,0,.15,1))}}[data-wp-grid-resizing] ._1c54fe8165d3023e__actionable-area-slot{opacity:0;pointer-events:none}"); 47834 } 47835 var actionable_area_slot_default2 = { "actionable-area-slot": "_1c54fe8165d3023e__actionable-area-slot" }; 47836 if (typeof process === "undefined" || true) { 47837 registerStyle54("4f49e83538", "._0a62d9f1dff8c7d8__item{position:relative}._20c43fcd930d828a__item-content{height:100%;position:relative}._11928ee35f1a9519__is-resizing{overflow:visible;z-index:1}._11928ee35f1a9519__is-resizing ._20c43fcd930d828a__item-content{overflow:visible;position:relative;z-index:2}.b7fc83c8b16e9ee5__is-dragging{pointer-events:none}[data-wp-grid-dragging] .b7fc83c8b16e9ee5__is-dragging{border-radius:var(--wp-grid-placeholder-radius,0)}@media not (prefers-reduced-motion:reduce){[data-wp-grid-dragging] .b7fc83c8b16e9ee5__is-dragging{animation:b026dda570d0eea0__wp-grid-item-placeholder-in 0ms linear var(--wpds-motion-duration-sm,.1s) forwards;opacity:1;outline-color:#0000;outline-style:var(--wp-grid-placeholder-outline-style,dashed);outline-width:0}@keyframes b026dda570d0eea0__wp-grid-item-placeholder-in{to{opacity:var(--wp-grid-placeholder-opacity,.4);outline-color:var(--wp-grid-placeholder-outline-color,var(--wpds-color-stroke-interactive-brand,var(--wp-admin-theme-color,#3858e9)));outline-width:var(--wpds-border-width-sm,2px)}}}@media (prefers-reduced-motion:reduce){[data-wp-grid-dragging] .b7fc83c8b16e9ee5__is-dragging{opacity:var(--wp-grid-placeholder-opacity,.4);outline:var(--wpds-border-width-sm,2px) var(--wp-grid-placeholder-outline-style,dashed) var(--wp-grid-placeholder-outline-color,var(--wpds-color-stroke-interactive-brand,var(--wp-admin-theme-color,#3858e9)))}}@media (forced-colors:active){[data-wp-grid-dragging] .b7fc83c8b16e9ee5__is-dragging{--wp-grid-placeholder-outline-color:Highlight}}.cd44faab32c27168__preview-overlay{background:#0000;border:var(--wpds-border-width-sm,2px) var(--wp-grid-resize-preview-outline-style,solid) var(--wp-grid-placeholder-outline-color,var(--wpds-color-stroke-interactive-brand,var(--wp-admin-theme-color,#3858e9)));box-sizing:border-box;inset-inline-start:0;pointer-events:none;position:absolute;top:0;z-index:0}@media (forced-colors:active){.cd44faab32c27168__preview-overlay{border-color:Highlight}}"); 47838 } 47839 var lanes_item_default = { "item": "_0a62d9f1dff8c7d8__item", "item-content": "_20c43fcd930d828a__item-content", "is-resizing": "_11928ee35f1a9519__is-resizing", "is-dragging": "b7fc83c8b16e9ee5__is-dragging", "wp-grid-item-placeholder-in": "b026dda570d0eea0__wp-grid-item-placeholder-in", "preview-overlay": "cd44faab32c27168__preview-overlay" }; 47840 function getItemCursor2(disabled2, interacting) { 47841 if (disabled2) { 47842 return "default"; 47843 } 47844 if (interacting) { 47845 return void 0; 47846 } 47847 return "grab"; 47848 } 47849 function LanesItem({ 47850 itemKey, 47851 placementStyle, 47852 disabled: disabled2 = false, 47853 interacting = false, 47854 children, 47855 actionableArea = null, 47856 onResize, 47857 onResizeEnd, 47858 resizeSnapPreview = null, 47859 minResizeWidthPx, 47860 renderResizeHandle, 47861 dragging = false 47862 }) { 47863 const [resizeDelta, setResizeDelta] = (0, import_element175.useState)( 47864 null 47865 ); 47866 const [initialContentSize, setInitialContentSize] = (0, import_element175.useState)(null); 47867 const itemRef = (0, import_element175.useRef)(null); 47868 const contentRef = (0, import_element175.useRef)(null); 47869 const { 47870 attributes, 47871 listeners, 47872 setNodeRef, 47873 setActivatorNodeRef, 47874 isDragging 47875 } = useSortable({ 47876 id: itemKey, 47877 disabled: disabled2 47878 }); 47879 const mergedRef = (0, import_compose26.useMergeRefs)([itemRef, setNodeRef]); 47880 const contentMergedRef = (0, import_compose26.useMergeRefs)([contentRef]); 47881 const style = { 47882 ...placementStyle, 47883 alignSelf: "start" 47884 }; 47885 const isResizing = resizeDelta !== null; 47886 const itemClassName = clsx_default( 47887 lanes_item_default.item, 47888 isDragging && lanes_item_default["is-dragging"], 47889 isResizing && lanes_item_default["is-resizing"] 47890 ); 47891 const handleResize = (delta) => { 47892 const contentNode = contentRef.current; 47893 let baselineSize = initialContentSize; 47894 if (contentNode && !baselineSize) { 47895 const { width, height } = contentNode.getBoundingClientRect(); 47896 baselineSize = { width, height }; 47897 setInitialContentSize(baselineSize); 47898 } 47899 let clamped = { width: delta.width, height: 0 }; 47900 if (baselineSize) { 47901 clamped = clampResizeDelta(clamped, baselineSize, { 47902 width: minResizeWidthPx 47903 }); 47904 } 47905 setResizeDelta(clamped); 47906 onResize(itemKey, clamped); 47907 }; 47908 const handleResizeEnd = () => { 47909 setResizeDelta(null); 47910 setInitialContentSize(null); 47911 onResizeEnd(); 47912 }; 47913 const continuousContentStyle = resizeDelta && initialContentSize ? { 47914 width: initialContentSize.width + resizeDelta.width 47915 } : void 0; 47916 const previewOverlay = resizeSnapPreview ? /* @__PURE__ */ (0, import_jsx_runtime221.jsx)( 47917 "div", 47918 { 47919 className: lanes_item_default["preview-overlay"], 47920 style: { 47921 width: resizeSnapPreview.widthPx, 47922 height: resizeSnapPreview.heightPx ?? "100%" 47923 } 47924 } 47925 ) : null; 47926 return /* @__PURE__ */ (0, import_jsx_runtime221.jsxs)( 47927 "div", 47928 { 47929 ref: mergedRef, 47930 className: itemClassName, 47931 style, 47932 ...{ [GRID_ITEM_DATA_KEY]: itemKey }, 47933 "data-wp-grid-item-resizing": isResizing || void 0, 47934 children: [ 47935 actionableArea ? /* @__PURE__ */ (0, import_jsx_runtime221.jsx)( 47936 "div", 47937 { 47938 className: actionable_area_slot_default2["actionable-area-slot"], 47939 children: /* @__PURE__ */ (0, import_jsx_runtime221.jsx)( 47940 "div", 47941 { 47942 style: { display: "contents" }, 47943 inert: dragging || void 0, 47944 children: actionableArea 47945 } 47946 ) 47947 } 47948 ) : null, 47949 /* @__PURE__ */ (0, import_jsx_runtime221.jsxs)( 47950 "div", 47951 { 47952 ref: setActivatorNodeRef, 47953 ...attributes, 47954 ...listeners, 47955 style: { 47956 height: "100%", 47957 cursor: getItemCursor2(disabled2, interacting) 47958 }, 47959 children: [ 47960 /* @__PURE__ */ (0, import_jsx_runtime221.jsxs)( 47961 "div", 47962 { 47963 ref: contentMergedRef, 47964 className: lanes_item_default["item-content"], 47965 style: continuousContentStyle, 47966 children: [ 47967 children, 47968 !disabled2 && /* @__PURE__ */ (0, import_jsx_runtime221.jsx)( 47969 ResizeHandleWrapper, 47970 { 47971 itemId: itemKey, 47972 verticalResizable: false, 47973 onResize: handleResize, 47974 onResizeEnd: handleResizeEnd, 47975 renderResizeHandle 47976 } 47977 ) 47978 ] 47979 } 47980 ), 47981 previewOverlay 47982 ] 47983 } 47984 ) 47985 ] 47986 } 47987 ); 47988 } 47989 47990 // packages/grid/build-module/dashboard-lanes/use-lane-placement.mjs 47991 var import_element176 = __toESM(require_element(), 1); 47992 47993 // packages/grid/build-module/dashboard-lanes/lane-placement.mjs 47994 function clampSpan(span, lanes) { 47995 if (!Number.isFinite(span)) { 47996 return 1; 47997 } 47998 return Math.max(1, Math.min(Math.floor(span), lanes)); 47999 } 48000 function clampLane(lane, span, lanes) { 48001 if (!Number.isFinite(lane)) { 48002 return 0; 48003 } 48004 return Math.max(0, Math.min(Math.floor(lane), lanes - span)); 48005 } 48006 function maxBaselineAcross(laneBottoms, startLane, span) { 48007 let maxBaseline = 0; 48008 for (let i2 = startLane; i2 < startLane + span; i2++) { 48009 if (laneBottoms[i2] > maxBaseline) { 48010 maxBaseline = laneBottoms[i2]; 48011 } 48012 } 48013 return maxBaseline; 48014 } 48015 function computeLanePlacements(input) { 48016 const lanes = Math.max(1, Math.floor(input.lanes)); 48017 const gap = Math.max(0, input.gap); 48018 const tolerance = Math.max(0, input.flowTolerance); 48019 const laneBottoms = new Array(lanes).fill(0); 48020 const placements2 = /* @__PURE__ */ new Map(); 48021 const explicitItems = []; 48022 const autoItems = []; 48023 for (const item of input.items) { 48024 if (item.lane !== void 0) { 48025 explicitItems.push(item); 48026 } else { 48027 autoItems.push(item); 48028 } 48029 } 48030 for (const item of explicitItems) { 48031 const span = clampSpan(item.span, lanes); 48032 const lane = clampLane(item.lane, span, lanes); 48033 const baseline = maxBaselineAcross(laneBottoms, lane, span); 48034 const top = baseline === 0 ? 0 : baseline + gap; 48035 const height = Math.max(0, item.height); 48036 placements2.set(item.key, { key: item.key, lane, top, span }); 48037 const newBottom = top + height; 48038 for (let i2 = lane; i2 < lane + span; i2++) { 48039 laneBottoms[i2] = newBottom; 48040 } 48041 } 48042 for (const item of autoItems) { 48043 const span = clampSpan(item.span, lanes); 48044 let bestLane = 0; 48045 let bestBaseline = Infinity; 48046 for (let candidate = 0; candidate <= lanes - span; candidate++) { 48047 const baseline = maxBaselineAcross(laneBottoms, candidate, span); 48048 if (bestBaseline - baseline > tolerance) { 48049 bestBaseline = baseline; 48050 bestLane = candidate; 48051 } 48052 } 48053 const top = bestBaseline === 0 ? 0 : bestBaseline + gap; 48054 const height = Math.max(0, item.height); 48055 placements2.set(item.key, { 48056 key: item.key, 48057 lane: bestLane, 48058 top, 48059 span 48060 }); 48061 const newBottom = top + height; 48062 for (let i2 = bestLane; i2 < bestLane + span; i2++) { 48063 laneBottoms[i2] = newBottom; 48064 } 48065 } 48066 let totalHeight = 0; 48067 for (const bottom of laneBottoms) { 48068 if (bottom > totalHeight) { 48069 totalHeight = bottom; 48070 } 48071 } 48072 return { placements: placements2, totalHeight }; 48073 } 48074 48075 // packages/grid/build-module/dashboard-lanes/use-lane-placement.mjs 48076 var DEFAULT_ROW_UNIT = 4; 48077 function supportsGridLanes() { 48078 if (typeof CSS === "undefined" || !CSS.supports) { 48079 return false; 48080 } 48081 return CSS.supports("display", "grid-lanes"); 48082 } 48083 function clampSpan2(span) { 48084 if (typeof span !== "number" || !Number.isFinite(span)) { 48085 return 1; 48086 } 48087 return Math.max(1, Math.floor(span)); 48088 } 48089 function useLanePlacement(container, input) { 48090 const [isPolyfilled] = (0, import_element176.useState)(() => !supportsGridLanes()); 48091 const [itemStyles, setItemStyles] = (0, import_element176.useState)(() => /* @__PURE__ */ new Map()); 48092 const nativeStyles = (0, import_element176.useMemo)(() => { 48093 const map = /* @__PURE__ */ new Map(); 48094 for (const item of input.items) { 48095 map.set(item.key, { 48096 gridColumn: `span $clampSpan2(item.span)}` 48097 }); 48098 } 48099 return map; 48100 }, [input.items]); 48101 const itemsSignature = (0, import_element176.useMemo)(() => { 48102 return input.items.map( 48103 (item) => `$item.key}/$item.span ?? 1}/$item.lane ?? ""}` 48104 ).join("\0"); 48105 }, [input.items]); 48106 const itemsForPlacement = (0, import_element176.useMemo)(() => input.items, [itemsSignature]); 48107 const { lanes, gap, flowTolerance, rowUnit } = input; 48108 (0, import_element176.useLayoutEffect)(() => { 48109 if (!isPolyfilled || !container) { 48110 return; 48111 } 48112 if (typeof ResizeObserver === "undefined") { 48113 return; 48114 } 48115 const heights = /* @__PURE__ */ new Map(); 48116 const observed = /* @__PURE__ */ new Set(); 48117 let cancelled = false; 48118 let rafId2 = null; 48119 const recompute = () => { 48120 if (rafId2 !== null || cancelled) { 48121 return; 48122 } 48123 rafId2 = requestAnimationFrame(() => { 48124 rafId2 = null; 48125 if (cancelled) { 48126 return; 48127 } 48128 const itemsWithHeight = itemsForPlacement.map((item) => ({ 48129 key: item.key, 48130 span: clampSpan2(item.span), 48131 lane: item.lane, 48132 height: heights.get(item.key) ?? 0 48133 })); 48134 const result = computeLanePlacements({ 48135 items: itemsWithHeight, 48136 lanes, 48137 gap, 48138 flowTolerance 48139 }); 48140 const effectiveRowUnit = Math.max( 48141 1, 48142 rowUnit ?? DEFAULT_ROW_UNIT 48143 ); 48144 const next = /* @__PURE__ */ new Map(); 48145 for (const item of itemsForPlacement) { 48146 const placement = result.placements.get(item.key); 48147 if (!placement) { 48148 continue; 48149 } 48150 const height = heights.get(item.key) ?? 0; 48151 const rowStart = Math.floor(placement.top / effectiveRowUnit) + 1; 48152 const rowSpan = Math.max( 48153 1, 48154 Math.ceil(height / effectiveRowUnit) 48155 ); 48156 next.set(item.key, { 48157 gridColumnStart: placement.lane + 1, 48158 gridColumnEnd: `span $placement.span}`, 48159 gridRowStart: rowStart, 48160 gridRowEnd: `span $rowSpan}` 48161 }); 48162 } 48163 setItemStyles(next); 48164 }); 48165 }; 48166 const resizeObserver = new ResizeObserver((entries) => { 48167 let changed = false; 48168 for (const entry of entries) { 48169 const key2 = entry.target.getAttribute( 48170 GRID_ITEM_DATA_KEY 48171 ); 48172 if (!key2) { 48173 continue; 48174 } 48175 const newHeight = entry.contentRect.height; 48176 if (heights.get(key2) !== newHeight) { 48177 heights.set(key2, newHeight); 48178 changed = true; 48179 } 48180 } 48181 if (changed) { 48182 recompute(); 48183 } 48184 }); 48185 const refreshObserved = () => { 48186 const current = container.querySelectorAll( 48187 `[$GRID_ITEM_DATA_KEY}]` 48188 ); 48189 for (const element of current) { 48190 if (!observed.has(element)) { 48191 observed.add(element); 48192 resizeObserver.observe(element); 48193 const key2 = element.getAttribute(GRID_ITEM_DATA_KEY); 48194 if (key2) { 48195 const rect = element.getBoundingClientRect(); 48196 heights.set(key2, rect.height); 48197 } 48198 } 48199 } 48200 for (const element of observed) { 48201 if (!container.contains(element)) { 48202 resizeObserver.unobserve(element); 48203 observed.delete(element); 48204 } 48205 } 48206 }; 48207 const mutationObserver = typeof MutationObserver !== "undefined" ? new MutationObserver(() => { 48208 refreshObserved(); 48209 recompute(); 48210 }) : null; 48211 if (mutationObserver) { 48212 mutationObserver.observe(container, { 48213 childList: true, 48214 subtree: true, 48215 attributes: true, 48216 attributeFilter: [GRID_ITEM_DATA_KEY] 48217 }); 48218 } 48219 refreshObserved(); 48220 recompute(); 48221 return () => { 48222 cancelled = true; 48223 if (rafId2 !== null) { 48224 cancelAnimationFrame(rafId2); 48225 } 48226 resizeObserver.disconnect(); 48227 mutationObserver?.disconnect(); 48228 }; 48229 }, [ 48230 container, 48231 isPolyfilled, 48232 lanes, 48233 gap, 48234 flowTolerance, 48235 rowUnit, 48236 itemsForPlacement 48237 ]); 48238 if (!isPolyfilled) { 48239 return { itemStyles: nativeStyles, isPolyfilled: false }; 48240 } 48241 if (itemStyles.size === 0) { 48242 return { 48243 itemStyles: nativeStyles, 48244 isPolyfilled: true 48245 }; 48246 } 48247 return { itemStyles, isPolyfilled: true }; 48248 } 48249 48250 // packages/grid/build-module/dashboard-lanes/index.mjs 48251 var import_jsx_runtime222 = __toESM(require_jsx_runtime(), 1); 48252 var STYLE_HASH_ATTRIBUTE55 = "data-wp-hash"; 48253 function getRuntime55() { 48254 const globalScope = globalThis; 48255 if (globalScope.__wpStyleRuntime) { 48256 return globalScope.__wpStyleRuntime; 48257 } 48258 globalScope.__wpStyleRuntime = { 48259 documents: /* @__PURE__ */ new Map(), 48260 styles: /* @__PURE__ */ new Map(), 48261 injectedStyles: /* @__PURE__ */ new WeakMap() 48262 }; 48263 if (typeof document !== "undefined") { 48264 registerDocument55(document); 48265 } 48266 return globalScope.__wpStyleRuntime; 48267 } 48268 function documentContainsStyleHash55(targetDocument, hash) { 48269 if (!targetDocument.head) { 48270 return false; 48271 } 48272 for (const style of targetDocument.head.querySelectorAll( 48273 `style[$STYLE_HASH_ATTRIBUTE55}]` 48274 )) { 48275 if (style.getAttribute(STYLE_HASH_ATTRIBUTE55) === hash) { 48276 return true; 48277 } 48278 } 48279 return false; 48280 } 48281 function injectStyle55(targetDocument, hash, css) { 48282 if (!targetDocument.head) { 48283 return; 48284 } 48285 const runtime = getRuntime55(); 48286 let injectedStyles = runtime.injectedStyles.get(targetDocument); 48287 if (!injectedStyles) { 48288 injectedStyles = /* @__PURE__ */ new Set(); 48289 runtime.injectedStyles.set(targetDocument, injectedStyles); 48290 } 48291 if (injectedStyles.has(hash)) { 48292 return; 48293 } 48294 if (documentContainsStyleHash55(targetDocument, hash)) { 48295 injectedStyles.add(hash); 48296 return; 48297 } 48298 const style = targetDocument.createElement("style"); 48299 style.setAttribute(STYLE_HASH_ATTRIBUTE55, hash); 48300 style.appendChild(targetDocument.createTextNode(css)); 48301 targetDocument.head.appendChild(style); 48302 injectedStyles.add(hash); 48303 } 48304 function registerDocument55(targetDocument) { 48305 const runtime = getRuntime55(); 48306 runtime.documents.set( 48307 targetDocument, 48308 (runtime.documents.get(targetDocument) ?? 0) + 1 48309 ); 48310 for (const [hash, css] of runtime.styles) { 48311 injectStyle55(targetDocument, hash, css); 48312 } 48313 return () => { 48314 const count = runtime.documents.get(targetDocument); 48315 if (count === void 0) { 48316 return; 48317 } 48318 if (count <= 1) { 48319 runtime.documents.delete(targetDocument); 48320 return; 48321 } 48322 runtime.documents.set(targetDocument, count - 1); 48323 }; 48324 } 48325 function registerStyle55(hash, css) { 48326 const runtime = getRuntime55(); 48327 runtime.styles.set(hash, css); 48328 for (const targetDocument of runtime.documents.keys()) { 48329 injectStyle55(targetDocument, hash, css); 48330 } 48331 } 48332 if (typeof process === "undefined" || true) { 48333 registerStyle55("9e5573e51f", "._2db63116caa90ae9__layout-animating [data-wp-grid-item-key]{transition:transform var(--wpds-motion-duration-md,.2s) var(--wpds-motion-easing-balanced,cubic-bezier(.4,0,.2,1))}@media (prefers-reduced-motion:reduce){._2db63116caa90ae9__layout-animating [data-wp-grid-item-key]{transition:none}}"); 48334 } 48335 var layout_shift_animation_default2 = { "layout-animating": "_2db63116caa90ae9__layout-animating" }; 48336 if (typeof process === "undefined" || true) { 48337 registerStyle55("44ea80456a", "._8cc368bc6c2d79c6__lanes{column-gap:var(--wp-grid-gap,var(--wpds-dimension-gap-xl,24px));display:grid-lanes;position:relative;row-gap:var(--wp-grid-gap,var(--wpds-dimension-gap-xl,24px))}@supports not (display:grid-lanes){._8cc368bc6c2d79c6__lanes{display:grid;grid-auto-flow:dense;grid-auto-rows:var(--wp-grid-lane-row-unit,4px);row-gap:0}}._1bfa908a532e32a4__drag-preview-frame{border-radius:var(--wp-grid-drag-preview-radius,0);box-shadow:var(--wpds-elevation-md,0 2px 3px 0 #0000000d,0 4px 5px 0 #0000000a,0 12px 12px 0 #00000008,0 16px 16px 0 #00000005);cursor:grabbing;height:100%;pointer-events:none}.bd684ee9f92388ed__drag-preview-frame__lift{height:100%;transform:scale(var(--wp-grid-drag-preview-scale,1.05));transform-origin:center}@media not (prefers-reduced-motion:reduce){._1bfa908a532e32a4__drag-preview-frame{animation:_5f4a1718cb7927ee__wp-grid-drag-preview-shadow-enter var(--wpds-motion-duration-sm,.1s) var(--wpds-motion-easing-balanced,cubic-bezier(.4,0,.2,1)) both}.bd684ee9f92388ed__drag-preview-frame__lift{animation:_29f7f02d4f227b1e__wp-grid-drag-preview-scale-enter var(--wpds-motion-duration-sm,.1s) var(--wpds-motion-easing-balanced,cubic-bezier(.4,0,.2,1)) both}}@media not (prefers-reduced-motion:reduce){@keyframes _5f4a1718cb7927ee__wp-grid-drag-preview-shadow-enter{0%{box-shadow:var(--wpds-elevation-xs,0 1px 1px 0 #00000008,0 1px 2px 0 #00000005,0 3px 3px 0 #00000005,0 4px 4px 0 #00000003)}to{box-shadow:var(--wpds-elevation-md,0 2px 3px 0 #0000000d,0 4px 5px 0 #0000000a,0 12px 12px 0 #00000008,0 16px 16px 0 #00000005)}}@keyframes _29f7f02d4f227b1e__wp-grid-drag-preview-scale-enter{0%{transform:scale(1)}to{transform:scale(var(--wp-grid-drag-preview-scale,1.05))}}}@media not (prefers-reduced-motion:reduce){._1bfa908a532e32a4__drag-preview-frame._13e2d868ade475b5__dragPreviewFrameExiting{animation:_6883de14c5fb8559__wp-grid-drag-preview-shadow-exit var(--wpds-motion-duration-md,.2s) var(--wpds-motion-easing-balanced,cubic-bezier(.4,0,.2,1)) forwards}._1bfa908a532e32a4__drag-preview-frame._13e2d868ade475b5__dragPreviewFrameExiting .bd684ee9f92388ed__drag-preview-frame__lift{animation:_0de4da1cd817e536__wp-grid-drag-preview-scale-exit var(--wpds-motion-duration-md,.2s) var(--wpds-motion-easing-balanced,cubic-bezier(.4,0,.2,1)) forwards}@keyframes _6883de14c5fb8559__wp-grid-drag-preview-shadow-exit{0%{box-shadow:var(--wpds-elevation-md,0 2px 3px 0 #0000000d,0 4px 5px 0 #0000000a,0 12px 12px 0 #00000008,0 16px 16px 0 #00000005)}to{box-shadow:var(--wpds-elevation-xs,0 1px 1px 0 #00000008,0 1px 2px 0 #00000005,0 3px 3px 0 #00000005,0 4px 4px 0 #00000003)}}@keyframes _0de4da1cd817e536__wp-grid-drag-preview-scale-exit{0%{transform:scale(var(--wp-grid-drag-preview-scale,1.05))}to{transform:scale(1)}}}._1bfa908a532e32a4__drag-preview-frame._13e2d868ade475b5__dragPreviewFrameExiting{box-shadow:var(--wpds-elevation-xs,0 1px 1px 0 #00000008,0 1px 2px 0 #00000005,0 3px 3px 0 #00000005,0 4px 4px 0 #00000003)}._1bfa908a532e32a4__drag-preview-frame._13e2d868ade475b5__dragPreviewFrameExiting .bd684ee9f92388ed__drag-preview-frame__lift{transform:scale(1)}@media (prefers-reduced-motion:reduce){._1bfa908a532e32a4__drag-preview-frame{box-shadow:var(--wpds-elevation-md,0 2px 3px 0 #0000000d,0 4px 5px 0 #0000000a,0 12px 12px 0 #00000008,0 16px 16px 0 #00000005)}.bd684ee9f92388ed__drag-preview-frame__lift{transform:none}._1bfa908a532e32a4__drag-preview-frame._13e2d868ade475b5__dragPreviewFrameExiting{box-shadow:var(--wpds-elevation-xs,0 1px 1px 0 #00000008,0 1px 2px 0 #00000005,0 3px 3px 0 #00000005,0 4px 4px 0 #00000003);transition:none}._1bfa908a532e32a4__drag-preview-frame._13e2d868ade475b5__dragPreviewFrameExiting .bd684ee9f92388ed__drag-preview-frame__lift{transition:none}}"); 48338 } 48339 var lanes_default = { "lanes": "_8cc368bc6c2d79c6__lanes", "drag-preview-frame": "_1bfa908a532e32a4__drag-preview-frame", "drag-preview-frame__lift": "bd684ee9f92388ed__drag-preview-frame__lift", "wp-grid-drag-preview-shadow-enter": "_5f4a1718cb7927ee__wp-grid-drag-preview-shadow-enter", "wp-grid-drag-preview-scale-enter": "_29f7f02d4f227b1e__wp-grid-drag-preview-scale-enter", "dragPreviewFrameExiting": "_13e2d868ade475b5__dragPreviewFrameExiting", "wp-grid-drag-preview-shadow-exit": "_6883de14c5fb8559__wp-grid-drag-preview-shadow-exit", "wp-grid-drag-preview-scale-exit": "_0de4da1cd817e536__wp-grid-drag-preview-scale-exit" }; 48340 var dashboardDragDropAnimation2 = createDashboardDragDropAnimation( 48341 lanes_default["drag-preview-frame"], 48342 lanes_default.dragPreviewFrameExiting 48343 ); 48344 var FALLBACK_GAP_PX2 = 24; 48345 var DEFAULT_COLUMNS2 = 6; 48346 var NO_SORT_STRATEGY2 = () => null; 48347 var DashboardLanes = (0, import_element177.forwardRef)( 48348 function DashboardLanes2(props, ref) { 48349 const { 48350 layout, 48351 columns, 48352 children, 48353 className, 48354 style, 48355 flowTolerance = 16, 48356 rowUnit = 4, 48357 minColumnWidth, 48358 editMode = false, 48359 onChangeLayout, 48360 onPreviewLayout, 48361 renderResizeHandle, 48362 renderDragPreview, 48363 renderGridOverlay, 48364 ...divProps 48365 } = props; 48366 const [temporaryLayout, setTemporaryLayout] = (0, import_element177.useState)(); 48367 const [activeId, setActiveId] = (0, import_element177.useState)(null); 48368 const [isResizing, setIsResizing] = (0, import_element177.useState)(false); 48369 const [resizeSnapPreview, setResizeSnapPreview] = (0, import_element177.useState)(null); 48370 const latestLayoutRef = (0, import_element177.useRef)(void 0); 48371 const lastReorderCursorRef = (0, import_element177.useRef)(null); 48372 const resizeBaselineRef = (0, import_element177.useRef)(null); 48373 const captureLayoutSnapshotRef = (0, import_element177.useRef)(() => { 48374 }); 48375 const childrenCacheRef = (0, import_element177.useRef)( 48376 /* @__PURE__ */ new Map() 48377 ); 48378 const activeLayout = temporaryLayout ?? layout; 48379 const [container, setContainer] = (0, import_element177.useState)( 48380 null 48381 ); 48382 const [containerWidth, setContainerWidth] = (0, import_element177.useState)(0); 48383 const [gapPx, setGapPx] = (0, import_element177.useState)(FALLBACK_GAP_PX2); 48384 const resizeObserverRef = (0, import_compose27.useResizeObserver)( 48385 ([{ contentRect }]) => { 48386 setContainerWidth(contentRect.width); 48387 } 48388 ); 48389 const mergedRootRef = (0, import_compose27.useMergeRefs)([ 48390 setContainer, 48391 resizeObserverRef, 48392 ref 48393 ]); 48394 (0, import_element177.useLayoutEffect)(() => { 48395 if (!container) { 48396 return; 48397 } 48398 const { width } = container.getBoundingClientRect(); 48399 if (width > 0) { 48400 setContainerWidth(width); 48401 } 48402 const parsed = Number.parseFloat( 48403 window.getComputedStyle(container).columnGap 48404 ); 48405 if (Number.isFinite(parsed) && parsed > 0) { 48406 setGapPx(parsed); 48407 } 48408 }, [container]); 48409 const effectiveColumns = (0, import_element177.useMemo)(() => { 48410 if (!minColumnWidth) { 48411 return columns ?? DEFAULT_COLUMNS2; 48412 } 48413 const totalWidthPerColumn = minColumnWidth + gapPx; 48414 const maxFit = Math.max( 48415 1, 48416 Math.floor((containerWidth + gapPx) / totalWidthPerColumn) 48417 ); 48418 return columns !== void 0 ? Math.min(columns, maxFit) : maxFit; 48419 }, [minColumnWidth, gapPx, containerWidth, columns]); 48420 const columnWidth = (containerWidth - (effectiveColumns - 1) * gapPx) / effectiveColumns; 48421 const minResizeWidthPx = gridSpanToPixelSize( 48422 1, 48423 1, 48424 columnWidth, 48425 gapPx, 48426 null 48427 ).widthPx; 48428 const layoutMap = (0, import_element177.useMemo)(() => { 48429 const map = /* @__PURE__ */ new Map(); 48430 activeLayout.forEach((item) => map.set(item.key, item)); 48431 return map; 48432 }, [activeLayout]); 48433 const layoutKeys = (0, import_element177.useMemo)( 48434 () => new Set(layout.map((item) => item.key)), 48435 [layout] 48436 ); 48437 const sortedItems = (0, import_element177.useMemo)( 48438 () => activeLayout.map((item, index2) => ({ item, index: index2 })).sort( 48439 (a2, b2) => (a2.item.order ?? a2.index) - (b2.item.order ?? b2.index) 48440 ).map(({ item }) => item.key), 48441 [activeLayout] 48442 ); 48443 const items = sortedItems; 48444 const placementItems = (0, import_element177.useMemo)(() => { 48445 return items.map((key2) => { 48446 const item = layoutMap.get(key2); 48447 const width = item?.width; 48448 const span = typeof width === "number" ? Math.max(1, Math.min(width, effectiveColumns)) : 1; 48449 return { key: key2, span, lane: item?.lane }; 48450 }); 48451 }, [items, layoutMap, effectiveColumns]); 48452 const { itemStyles } = useLanePlacement(container, { 48453 items: placementItems, 48454 lanes: effectiveColumns, 48455 gap: gapPx, 48456 flowTolerance, 48457 rowUnit 48458 }); 48459 const [childrenMap, actionableAreaMap, remaining, renderedByKey] = (0, import_element177.useMemo)(() => { 48460 const childMap = /* @__PURE__ */ new Map(); 48461 const actionableMap = /* @__PURE__ */ new Map(); 48462 const rest = []; 48463 const byKey = /* @__PURE__ */ new Map(); 48464 import_element177.Children.forEach(children, (child) => { 48465 if (!(0, import_element177.isValidElement)(child)) { 48466 rest.push(child); 48467 return; 48468 } 48469 const key2 = child.key?.toString(); 48470 if (!key2) { 48471 rest.push(child); 48472 return; 48473 } 48474 const { actionableArea } = child.props; 48475 const stripped = actionableArea !== void 0 ? (0, import_element177.cloneElement)( 48476 child, 48477 { actionableArea: void 0 } 48478 ) : child; 48479 byKey.set(key2, stripped); 48480 if (layoutKeys.has(key2)) { 48481 if (actionableArea !== void 0) { 48482 actionableMap.set(key2, actionableArea); 48483 } 48484 childMap.set(key2, stripped); 48485 } else { 48486 rest.push(child); 48487 } 48488 }); 48489 return [childMap, actionableMap, rest, byKey]; 48490 }, [children, layoutKeys]); 48491 (0, import_element177.useLayoutEffect)(() => { 48492 for (const [key2, child] of renderedByKey) { 48493 childrenCacheRef.current.set(key2, child); 48494 } 48495 }, [renderedByKey]); 48496 const sensors = useSensors( 48497 useSensor(PointerSensor), 48498 useSensor(KeyboardSensor, { 48499 coordinateGetter: sortableKeyboardCoordinates 48500 }) 48501 ); 48502 const handleDragStart = (0, import_compose27.useEvent)((event) => { 48503 setActiveId(String(event.active.id)); 48504 lastReorderCursorRef.current = null; 48505 }); 48506 const handleDragCancel = (0, import_compose27.useEvent)(() => { 48507 setActiveId(null); 48508 latestLayoutRef.current = void 0; 48509 lastReorderCursorRef.current = null; 48510 resizeBaselineRef.current = null; 48511 setIsResizing(false); 48512 setResizeSnapPreview(null); 48513 setTemporaryLayout(void 0); 48514 }); 48515 const handleDragMove = (0, import_compose27.useEvent)((event) => { 48516 const { active, over } = event; 48517 if (!over || active.id === over.id) { 48518 return; 48519 } 48520 const activeRect = active.rect.current.translated; 48521 if (!activeRect) { 48522 return; 48523 } 48524 const activeCenterX = activeRect.left + activeRect.width / 2; 48525 const activeCenterY = activeRect.top + activeRect.height / 2; 48526 const lastCursor = lastReorderCursorRef.current; 48527 if (lastCursor) { 48528 const dx = activeCenterX - lastCursor.x; 48529 const dy = activeCenterY - lastCursor.y; 48530 if (dx * dx + dy * dy < 100) { 48531 return; 48532 } 48533 } 48534 const overCenterX = over.rect.left + over.rect.width / 2; 48535 const insertAfter = activeCenterX > overCenterX; 48536 const currentIndex = items.indexOf(String(active.id)); 48537 const overIndex = items.indexOf(String(over.id)); 48538 let newIndex; 48539 if (insertAfter) { 48540 newIndex = currentIndex > overIndex ? overIndex + 1 : overIndex; 48541 } else { 48542 newIndex = currentIndex > overIndex ? overIndex : overIndex - 1; 48543 } 48544 newIndex = Math.max(0, Math.min(newIndex, items.length - 1)); 48545 if (newIndex === currentIndex) { 48546 return; 48547 } 48548 const updatedItems = arrayMove(items, currentIndex, newIndex); 48549 const orderByKey = /* @__PURE__ */ new Map(); 48550 updatedItems.forEach((key2, index2) => { 48551 orderByKey.set(key2, index2); 48552 }); 48553 const updatedLayout = activeLayout.map((item) => ({ 48554 ...item, 48555 order: orderByKey.get(item.key) ?? 0 48556 })); 48557 lastReorderCursorRef.current = { 48558 x: activeCenterX, 48559 y: activeCenterY 48560 }; 48561 latestLayoutRef.current = updatedLayout; 48562 captureLayoutSnapshotRef.current(); 48563 setTemporaryLayout(updatedLayout); 48564 onPreviewLayout?.(updatedLayout); 48565 }); 48566 const persistTemporaryLayout = (0, import_compose27.useEvent)(() => { 48567 const latest = latestLayoutRef.current; 48568 latestLayoutRef.current = void 0; 48569 resizeBaselineRef.current = null; 48570 setIsResizing(false); 48571 setResizeSnapPreview(null); 48572 if (!onChangeLayout || !latest) { 48573 setTemporaryLayout(void 0); 48574 return; 48575 } 48576 onChangeLayout(latest); 48577 setTemporaryLayout(void 0); 48578 }); 48579 const handleResize = (0, import_compose27.useEvent)((id, delta) => { 48580 if (!editMode) { 48581 return; 48582 } 48583 if (!isResizing) { 48584 setIsResizing(true); 48585 } 48586 const relativeDelta = Math.round( 48587 delta.width / (columnWidth + gapPx) 48588 ); 48589 if (resizeBaselineRef.current === null) { 48590 const baseItem = layoutMap.get(id); 48591 const baseWidth = typeof baseItem?.width === "number" ? baseItem.width : 1; 48592 resizeBaselineRef.current = baseWidth; 48593 } 48594 const baseline = resizeBaselineRef.current; 48595 const newWidth = Math.max( 48596 1, 48597 Math.min(baseline + relativeDelta, effectiveColumns) 48598 ); 48599 setResizeSnapPreview({ 48600 id, 48601 snap: gridSpanToPixelSize( 48602 newWidth, 48603 1, 48604 columnWidth, 48605 gapPx, 48606 null 48607 ) 48608 }); 48609 const pendingItem = latestLayoutRef.current?.find( 48610 (item) => item.key === id 48611 ); 48612 const currentItem = pendingItem ?? layoutMap.get(id); 48613 if (currentItem && currentItem.width === newWidth) { 48614 return; 48615 } 48616 const updatedLayout = activeLayout.map( 48617 (item) => item.key === id ? { ...item, width: newWidth } : item 48618 ); 48619 latestLayoutRef.current = updatedLayout; 48620 captureLayoutSnapshotRef.current(); 48621 setTemporaryLayout(updatedLayout); 48622 onPreviewLayout?.(updatedLayout); 48623 }); 48624 const interacting = activeId !== null || isResizing; 48625 const activeClone = activeId ? childrenMap.get(activeId) : null; 48626 const DragPreview = renderDragPreview; 48627 const dragOverlayContent = activeId && activeClone ? /* @__PURE__ */ (0, import_jsx_runtime222.jsx)("div", { className: lanes_default["drag-preview-frame"], children: /* @__PURE__ */ (0, import_jsx_runtime222.jsx)("div", { className: lanes_default["drag-preview-frame__lift"], children: DragPreview ? /* @__PURE__ */ (0, import_jsx_runtime222.jsx)(DragPreview, { itemId: activeId, children: activeClone }) : activeClone }) }) : null; 48628 const Overlay = renderGridOverlay ?? GridOverlay; 48629 const gridOverlay = (0, import_element177.useMemo)( 48630 () => /* @__PURE__ */ (0, import_jsx_runtime222.jsx)(Overlay, { columns: effectiveColumns, isActive: editMode }), 48631 [Overlay, editMode, effectiveColumns] 48632 ); 48633 const layoutFingerprint = (0, import_element177.useMemo)(() => { 48634 const layoutSig = getLayoutFingerprint(activeLayout); 48635 const placementSig = getPlacementFingerprint(itemStyles); 48636 return `$layoutSig}\0$placementSig}`; 48637 }, [activeLayout, itemStyles]); 48638 const excludeLayoutAnimationKey = activeId ?? (isResizing ? resizeSnapPreview?.id : null); 48639 const { captureLayoutSnapshot, getPositionsBeforeLastChange } = useLayoutShiftAnimation({ 48640 container, 48641 enabled: editMode, 48642 layoutFingerprint, 48643 excludeItemKey: excludeLayoutAnimationKey 48644 }); 48645 const { exitingItems, clearExitingItem } = useItemExitAnimation({ 48646 container, 48647 enabled: editMode, 48648 layoutKeys, 48649 getPositionsBeforeLastChange, 48650 childrenCacheRef 48651 }); 48652 const layoutAnimating = editMode; 48653 (0, import_element177.useLayoutEffect)(() => { 48654 captureLayoutSnapshotRef.current = captureLayoutSnapshot; 48655 }, [captureLayoutSnapshot]); 48656 return /* @__PURE__ */ (0, import_jsx_runtime222.jsxs)( 48657 DndContext, 48658 { 48659 sensors, 48660 onDragStart: handleDragStart, 48661 onDragCancel: handleDragCancel, 48662 onDragMove: handleDragMove, 48663 onDragEnd: () => { 48664 persistTemporaryLayout(); 48665 lastReorderCursorRef.current = null; 48666 setActiveId(null); 48667 }, 48668 children: [ 48669 /* @__PURE__ */ (0, import_jsx_runtime222.jsx)(SortableContext, { items, strategy: NO_SORT_STRATEGY2, children: /* @__PURE__ */ (0, import_jsx_runtime222.jsxs)( 48670 "div", 48671 { 48672 ...divProps, 48673 ref: mergedRootRef, 48674 className: clsx_default( 48675 lanes_default.lanes, 48676 layoutAnimating && layout_shift_animation_default2["layout-animating"], 48677 className 48678 ), 48679 "data-wp-grid-dragging": activeId || void 0, 48680 "data-wp-grid-resizing": isResizing || void 0, 48681 style: { 48682 ...style, 48683 gridTemplateColumns: `repeat($effectiveColumns}, minmax(0, 1fr))`, 48684 // `column-gap` and `row-gap` are set in 48685 // `lanes.module.css` from the 48686 // design-system gap token, with an 48687 // `@supports` block that zeroes `row-gap` 48688 // in polyfill mode (the skyline already 48689 // encodes vertical spacing in each tile's 48690 // `top`). Driving the toggle from CSS 48691 // keeps SSR and client output identical 48692 // regardless of native support. 48693 "--wp-grid-lane-row-unit": `$Math.max( 48694 1, 48695 rowUnit 48696 )}px` 48697 }, 48698 children: [ 48699 gridOverlay, 48700 items.map((id) => { 48701 const child = childrenMap.get(id); 48702 if (!child) { 48703 return null; 48704 } 48705 return /* @__PURE__ */ (0, import_jsx_runtime222.jsx)( 48706 LanesItem, 48707 { 48708 itemKey: id, 48709 placementStyle: itemStyles.get(id) ?? {}, 48710 disabled: !editMode, 48711 interacting, 48712 dragging: activeId !== null, 48713 onResize: handleResize, 48714 onResizeEnd: persistTemporaryLayout, 48715 resizeSnapPreview: resizeSnapPreview?.id === id ? resizeSnapPreview.snap : null, 48716 minResizeWidthPx, 48717 actionableArea: actionableAreaMap.get( 48718 id 48719 ), 48720 renderResizeHandle, 48721 children: child 48722 }, 48723 id 48724 ); 48725 }), 48726 remaining, 48727 exitingItems.map(({ key: key2, rect, child }) => /* @__PURE__ */ (0, import_jsx_runtime222.jsx)( 48728 ItemExitOverlay, 48729 { 48730 itemKey: key2, 48731 rect, 48732 onAnimationEnd: () => clearExitingItem(key2), 48733 children: child 48734 }, 48735 `exiting-$key2}` 48736 )) 48737 ] 48738 } 48739 ) }), 48740 /* @__PURE__ */ (0, import_jsx_runtime222.jsx)(DragOverlay, { dropAnimation: dashboardDragDropAnimation2, children: dragOverlayContent }) 48741 ] 48742 } 48743 ); 48744 } 48745 ); 48746 48747 // routes/dashboard/widget-dashboard/components/widgets/widget-layout-toolbar.tsx 48748 var import_components55 = __toESM(require_components()); 48749 var import_i18n66 = __toESM(require_i18n()); 48750 48751 // routes/dashboard/widget-dashboard/components/widgets/widget-layout-toolbar.module.css 48752 if (typeof process === "undefined" || true) { 48753 registerStyle48("8943f164ef", "._64fb135a680c4ffd__widgetLayoutToolbar{background:var(--wpds-color-bg-surface-neutral-strong,#fff);border:1px solid var(--wpds-color-stroke-surface-neutral-weak,#e4e4e4);box-shadow:var(--wpds-elevation-xs,0 1px 1px 0 #00000008,0 1px 2px 0 #00000005,0 3px 3px 0 #00000005,0 4px 4px 0 #00000003)}"); 48754 } 48755 var widget_layout_toolbar_default = { "widgetLayoutToolbar": "_64fb135a680c4ffd__widgetLayoutToolbar" }; 48756 48757 // routes/dashboard/widget-dashboard/components/widgets/widget-layout-toolbar.tsx 48758 var import_jsx_runtime223 = __toESM(require_jsx_runtime()); 48759 var { Menu: Menu7 } = unlock3(import_components55.privateApis); 48760 function WidgetLayoutToolbar({ 48761 widget 48762 }) { 48763 const { layout, onLayoutChange } = useDashboardInternalContext(); 48764 const width = widget.placement?.width; 48765 const updateWidth = (nextWidth) => { 48766 const nextLayout = layout.map( 48767 (currentWidget) => currentWidget.uuid === widget.uuid ? { 48768 ...currentWidget, 48769 placement: { 48770 ...currentWidget.placement, 48771 width: nextWidth 48772 } 48773 } : currentWidget 48774 ); 48775 onLayoutChange(nextLayout); 48776 }; 48777 const onNamedWidthChange = (nextWidth) => { 48778 updateWidth(nextWidth); 48779 }; 48780 const onRemove = () => { 48781 onLayoutChange( 48782 layout.filter( 48783 (currentWidget) => currentWidget.uuid !== widget.uuid 48784 ) 48785 ); 48786 }; 48787 return /* @__PURE__ */ (0, import_jsx_runtime223.jsxs)(WidgetToolbar, { className: widget_layout_toolbar_default.widgetLayoutToolbar, children: [ 48788 /* @__PURE__ */ (0, import_jsx_runtime223.jsxs)(Menu7, { children: [ 48789 /* @__PURE__ */ (0, import_jsx_runtime223.jsx)( 48790 Menu7.TriggerButton, 48791 { 48792 render: /* @__PURE__ */ (0, import_jsx_runtime223.jsx)( 48793 IconButton, 48794 { 48795 icon: more_vertical_default, 48796 label: (0, import_i18n66.__)("Widget options"), 48797 size: "compact", 48798 variant: "minimal", 48799 tone: "neutral" 48800 } 48801 ) 48802 } 48803 ), 48804 /* @__PURE__ */ (0, import_jsx_runtime223.jsx)(Menu7.Popover, { children: /* @__PURE__ */ (0, import_jsx_runtime223.jsxs)(Menu7.Group, { children: [ 48805 /* @__PURE__ */ (0, import_jsx_runtime223.jsx)(Menu7.GroupLabel, { children: (0, import_i18n66.__)("Width") }), 48806 /* @__PURE__ */ (0, import_jsx_runtime223.jsx)( 48807 Menu7.Item, 48808 { 48809 disabled: width === "fill", 48810 onClick: () => onNamedWidthChange("fill"), 48811 children: /* @__PURE__ */ (0, import_jsx_runtime223.jsx)(Menu7.ItemLabel, { children: (0, import_i18n66.__)("Use available width") }) 48812 } 48813 ), 48814 /* @__PURE__ */ (0, import_jsx_runtime223.jsx)( 48815 Menu7.Item, 48816 { 48817 disabled: width === "full", 48818 onClick: () => onNamedWidthChange("full"), 48819 children: /* @__PURE__ */ (0, import_jsx_runtime223.jsx)(Menu7.ItemLabel, { children: (0, import_i18n66.__)("Make full width") }) 48820 } 48821 ) 48822 ] }) }) 48823 ] }), 48824 /* @__PURE__ */ (0, import_jsx_runtime223.jsx)( 48825 IconButton, 48826 { 48827 icon: trash_default, 48828 label: (0, import_i18n66.__)("Remove"), 48829 size: "compact", 48830 variant: "minimal", 48831 tone: "neutral", 48832 onClick: onRemove 48833 } 48834 ) 48835 ] }); 48836 } 48837 48838 // routes/dashboard/widget-dashboard/components/widgets/widget-resize-handle.tsx 48839 var import_element178 = __toESM(require_element()); 48840 48841 // routes/dashboard/widget-dashboard/components/widgets/widget-resize-handle.module.css 48842 if (typeof process === "undefined" || true) { 48843 registerStyle48("5ce44b4889", '._41552c4502ad12ed__handle{--widget-resize-handle-visual-inset:var(--wpds-dimension-padding-xs,4px);--widget-resize-handle-hover-scale:1.18;background:#0000;bottom:0;box-sizing:border-box;inset-inline-end:0;padding:0;position:absolute;z-index:1}._41552c4502ad12ed__handle:focus-visible{border-radius:var(--wpds-border-radius-sm,2px);outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--wpds-color-stroke-focus-brand,var(--wp-admin-theme-color,#3858e9));outline-offset:calc(var(--wpds-dimension-base, 4px)*.5)}._2b207b12a7288f5f__resizing{opacity:.72}._20bdd1c81423a95f__handleCorner{cursor:nwse-resize;height:calc(var(--wpds-dimension-base, 4px)*6);width:calc(var(--wpds-dimension-base, 4px)*6)}._20bdd1c81423a95f__handleCorner:after{border-block-end:var(--wpds-border-width-sm,2px) solid var(--wpds-color-fg-interactive-brand,var(--wp-admin-theme-color,#3858e9));border-block-start:none;border-end-end-radius:var(--wpds-border-radius-md,4px);border-inline-end:var(--wpds-border-width-sm,2px) solid var(--wpds-color-fg-interactive-brand,var(--wp-admin-theme-color,#3858e9));border-inline-start:none;bottom:var(--widget-resize-handle-visual-inset);box-sizing:border-box;content:"";height:calc(var(--wpds-dimension-base, 4px)*2);inset-inline-end:var(--widget-resize-handle-visual-inset);position:absolute;transform:scale(1);transform-origin:100% 100%;width:calc(var(--wpds-dimension-base, 4px)*2)}[dir=rtl] ._20bdd1c81423a95f__handleCorner:after{transform-origin:0 100%}._20bdd1c81423a95f__handleCorner._2b207b12a7288f5f__resizing:after,._20bdd1c81423a95f__handleCorner:focus-visible:after,._20bdd1c81423a95f__handleCorner:hover:after{border-block-end:var(--wpds-border-width-sm,2px) solid var(--wpds-color-fg-interactive-brand-active,var(--wp-admin-theme-color,#3858e9));border-inline-end:var(--wpds-border-width-sm,2px) solid var(--wpds-color-fg-interactive-brand-active,var(--wp-admin-theme-color,#3858e9));transform:scale(var(--widget-resize-handle-hover-scale))}.e518fe7259304488__handleHorizontal{align-items:center;border:none;cursor:ew-resize;display:flex;height:calc(var(--wpds-dimension-base, 4px)*10);justify-content:center;padding-inline-end:var(--widget-resize-handle-visual-inset);width:calc(var(--wpds-dimension-base, 4px)*6)}@media not (prefers-reduced-motion){._20bdd1c81423a95f__handleCorner:after{transition:transform var(--wpds-motion-duration-xs,50ms) var(--wpds-motion-easing-balanced,cubic-bezier(.4,0,.2,1)),border-block-end-color var(--wpds-motion-duration-xs,50ms) var(--wpds-motion-easing-balanced,cubic-bezier(.4,0,.2,1)),border-inline-end-color var(--wpds-motion-duration-xs,50ms) var(--wpds-motion-easing-balanced,cubic-bezier(.4,0,.2,1))}.e518fe7259304488__handleHorizontal:after{transition:transform var(--wpds-motion-duration-xs,50ms) var(--wpds-motion-easing-balanced,cubic-bezier(.4,0,.2,1)),background-color var(--wpds-motion-duration-xs,50ms) var(--wpds-motion-easing-balanced,cubic-bezier(.4,0,.2,1))}}.e518fe7259304488__handleHorizontal:after{background-color:var(--wpds-color-fg-interactive-brand,var(--wp-admin-theme-color,#3858e9));content:"";height:calc(var(--wpds-dimension-base, 4px)*3);transform:scale(1);transform-origin:50% 100%;width:var(--wpds-border-width-sm,2px)}.e518fe7259304488__handleHorizontal._2b207b12a7288f5f__resizing:after,.e518fe7259304488__handleHorizontal:focus-visible:after,.e518fe7259304488__handleHorizontal:hover:after{background-color:var(--wpds-color-fg-interactive-brand-active,var(--wp-admin-theme-color,#3858e9));transform:scale(var(--widget-resize-handle-hover-scale))}@media (forced-colors:active){._20bdd1c81423a95f__handleCorner._2b207b12a7288f5f__resizing:after,._20bdd1c81423a95f__handleCorner:after,._20bdd1c81423a95f__handleCorner:focus-visible:after,._20bdd1c81423a95f__handleCorner:hover:after{border-block-end-color:Highlight;border-inline-end-color:Highlight}.e518fe7259304488__handleHorizontal._2b207b12a7288f5f__resizing:after,.e518fe7259304488__handleHorizontal:after,.e518fe7259304488__handleHorizontal:focus-visible:after,.e518fe7259304488__handleHorizontal:hover:after{background-color:Highlight}}'); 48844 } 48845 var widget_resize_handle_default = { "handle": "_41552c4502ad12ed__handle", "resizing": "_2b207b12a7288f5f__resizing", "handleCorner": "_20bdd1c81423a95f__handleCorner", "handleHorizontal": "e518fe7259304488__handleHorizontal" }; 48846 48847 // routes/dashboard/widget-dashboard/components/widgets/widget-resize-handle.tsx 48848 var import_jsx_runtime224 = __toESM(require_jsx_runtime()); 48849 var WidgetResizeHandle = (0, import_element178.forwardRef)(function WidgetResizeHandle2({ listeners, attributes, verticalResizable, isResizing }, ref) { 48850 if (!verticalResizable) { 48851 return /* @__PURE__ */ (0, import_jsx_runtime224.jsx)( 48852 "div", 48853 { 48854 ref, 48855 className: clsx_default( 48856 widget_resize_handle_default.handle, 48857 widget_resize_handle_default.handleHorizontal, 48858 isResizing && widget_resize_handle_default.resizing 48859 ), 48860 ...listeners, 48861 ...attributes 48862 } 48863 ); 48864 } 48865 return /* @__PURE__ */ (0, import_jsx_runtime224.jsx)( 48866 "div", 48867 { 48868 ref, 48869 className: clsx_default( 48870 widget_resize_handle_default.handle, 48871 widget_resize_handle_default.handleCorner, 48872 isResizing && widget_resize_handle_default.resizing 48873 ), 48874 ...listeners, 48875 ...attributes 48876 } 48877 ); 48878 }); 48879 48880 // routes/dashboard/widget-dashboard/components/widgets/widgets.module.css 48881 if (typeof process === "undefined" || true) { 48882 registerStyle48("7be094ccea", "._561eb2c5c7cbcb6b__grid{--wp-grid-placeholder-radius:var(--wpds-border-radius-lg,8px);--wp-grid-drag-preview-radius:var(--wpds-border-radius-lg,8px);width:100%}._8fa4ad5c2e86a6b9__tile{border-radius:var(--wpds-border-radius-lg,8px);height:100%}._8a257ea80aac989e__tileEditMode{box-shadow:var(--wpds-elevation-xs,0 1px 1px 0 #00000008,0 1px 2px 0 #00000005,0 3px 3px 0 #00000005,0 4px 4px 0 #00000003)}._8a257ea80aac989e__tileEditMode:focus-visible{outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--wpds-color-stroke-focus-brand,var(--wp-admin-theme-color,#3858e9));outline-offset:2px}._48e2b8516636ed6b__dragPreview{height:100%}._48e2b8516636ed6b__dragPreview ._8fa4ad5c2e86a6b9__tile{box-shadow:none}"); 48883 } 48884 var widgets_default = { "grid": "_561eb2c5c7cbcb6b__grid", "tile": "_8fa4ad5c2e86a6b9__tile", "tileEditMode": "_8a257ea80aac989e__tileEditMode", "dragPreview": "_48e2b8516636ed6b__dragPreview" }; 48885 48886 // routes/dashboard/widget-dashboard/components/widgets/widgets.tsx 48887 var import_jsx_runtime225 = __toESM(require_jsx_runtime()); 48888 var DASHBOARD_MIN_COLUMN_WIDTH = 350; 48889 function toGridLayout(widgets) { 48890 return widgets.map((w2) => ({ 48891 key: w2.uuid, 48892 ...w2.placement 48893 })); 48894 } 48895 function toMasonryLayout(widgets) { 48896 return widgets.map((w2) => ({ 48897 key: w2.uuid, 48898 ...w2.placement 48899 })); 48900 } 48901 function applyGridChange(widgets, gridLayout) { 48902 return gridLayout.map(({ key: key2, ...placement }) => { 48903 const existing = widgets.find((w2) => w2.uuid === key2); 48904 if (!existing) { 48905 return { 48906 uuid: key2, 48907 type: "", 48908 placement 48909 }; 48910 } 48911 return { 48912 ...existing, 48913 placement 48914 }; 48915 }); 48916 } 48917 function applyMasonryChange(widgets, masonryLayout) { 48918 return masonryLayout.map(({ key: key2, ...placement }) => { 48919 const existing = widgets.find((w2) => w2.uuid === key2); 48920 if (!existing) { 48921 return { 48922 uuid: key2, 48923 type: "", 48924 placement 48925 }; 48926 } 48927 return { 48928 ...existing, 48929 placement 48930 }; 48931 }); 48932 } 48933 var Widgets = (0, import_element179.forwardRef)( 48934 function Widgets2({ className }, ref) { 48935 const { layout, onLayoutChange, editMode, gridSettings, widgetTypes } = useDashboardInternalContext(); 48936 const isMasonry2 = gridSettings.model === "masonry"; 48937 const minColumnWidth = gridSettings.minColumnWidth ?? DASHBOARD_MIN_COLUMN_WIDTH; 48938 const gridLayout = (0, import_element179.useMemo)( 48939 () => isMasonry2 ? toMasonryLayout(layout) : toGridLayout(layout), 48940 [layout, isMasonry2] 48941 ); 48942 const handleGridChange = (0, import_element179.useCallback)( 48943 (newGridLayout) => { 48944 onLayoutChange(applyGridChange(layout, newGridLayout)); 48945 }, 48946 [layout, onLayoutChange] 48947 ); 48948 const handleMasonryChange = (0, import_element179.useCallback)( 48949 (newMasonryLayout) => { 48950 onLayoutChange( 48951 applyMasonryChange(layout, newMasonryLayout) 48952 ); 48953 }, 48954 [layout, onLayoutChange] 48955 ); 48956 const children = layout.map((widget, index2) => { 48957 const widgetType = widgetTypes.find( 48958 (type) => type.name === widget.type 48959 ); 48960 const hasSettings = !!widgetType?.attributes?.length; 48961 let actionableArea; 48962 if (editMode) { 48963 actionableArea = /* @__PURE__ */ (0, import_jsx_runtime225.jsx)(WidgetLayoutToolbar, { widget }); 48964 } else if (hasSettings && widgetType) { 48965 actionableArea = /* @__PURE__ */ (0, import_jsx_runtime225.jsx)( 48966 WidgetSettingsToolbar, 48967 { 48968 widget, 48969 widgetType 48970 } 48971 ); 48972 } 48973 return /* @__PURE__ */ (0, import_jsx_runtime225.jsx)( 48974 WidgetChrome, 48975 { 48976 widget, 48977 index: index2, 48978 className: clsx_default(widgets_default.tile, { 48979 [widgets_default.tileEditMode]: editMode 48980 }), 48981 actionableArea 48982 }, 48983 widget.uuid 48984 ); 48985 }); 48986 const renderDragPreview = (0, import_element179.useCallback)( 48987 ({ children: clone }) => /* @__PURE__ */ (0, import_jsx_runtime225.jsx)("div", { className: widgets_default.dragPreview, children: clone }), 48988 [] 48989 ); 48990 const sharedRenderProps = { 48991 editMode, 48992 renderDragPreview, 48993 renderResizeHandle: WidgetResizeHandle 48994 }; 48995 const surface = isMasonry2 ? /* @__PURE__ */ (0, import_jsx_runtime225.jsx)( 48996 DashboardLanes, 48997 { 48998 layout: gridLayout, 48999 columns: gridSettings.columns, 49000 minColumnWidth, 49001 flowTolerance: gridSettings.flowTolerance, 49002 onChangeLayout: handleMasonryChange, 49003 ...sharedRenderProps, 49004 children 49005 } 49006 ) : /* @__PURE__ */ (0, import_jsx_runtime225.jsx)( 49007 DashboardGrid, 49008 { 49009 layout: gridLayout, 49010 columns: gridSettings.columns, 49011 minColumnWidth, 49012 rowHeight: gridSettings.rowHeight, 49013 onChangeLayout: handleGridChange, 49014 ...sharedRenderProps, 49015 children 49016 } 49017 ); 49018 return /* @__PURE__ */ (0, import_jsx_runtime225.jsx)("div", { ref, className: clsx_default(widgets_default.grid, className), children: surface }); 49019 } 49020 ); 49021 49022 // routes/dashboard/widget-dashboard/components/no-widgets-state/no-widgets-state.tsx 49023 var import_i18n67 = __toESM(require_i18n()); 49024 49025 // routes/dashboard/widget-dashboard/components/no-widgets-state/no-widgets-state.module.css 49026 if (typeof process === "undefined" || true) { 49027 registerStyle48("4dec2ea292", "._43aa5df1b0907556__root{padding-block-start:calc(var(--wpds-dimension-padding-3xl, 32px)*3.5)}"); 49028 } 49029 var no_widgets_state_default = { "root": "_43aa5df1b0907556__root" }; 49030 49031 // routes/dashboard/widget-dashboard/components/no-widgets-state/no-widgets-state.tsx 49032 var import_jsx_runtime226 = __toESM(require_jsx_runtime()); 49033 function NoWidgetsStateImpl({ children }) { 49034 const { layout } = useDashboardInternalContext(); 49035 if (layout.length > 0) { 49036 return null; 49037 } 49038 return /* @__PURE__ */ (0, import_jsx_runtime226.jsx)(Stack, { justify: "center", align: "center", className: no_widgets_state_default.root, children: children ?? /* @__PURE__ */ (0, import_jsx_runtime226.jsxs)(empty_state_exports.Root, { children: [ 49039 /* @__PURE__ */ (0, import_jsx_runtime226.jsx)(empty_state_exports.Icon, { icon: home_default }), 49040 /* @__PURE__ */ (0, import_jsx_runtime226.jsx)(empty_state_exports.Title, { children: (0, import_i18n67.__)("Your dashboard is empty") }), 49041 /* @__PURE__ */ (0, import_jsx_runtime226.jsx)(empty_state_exports.Description, { children: (0, import_i18n67.__)( 49042 "Add widgets to start customizing your dashboard." 49043 ) }) 49044 ] }) }); 49045 } 49046 var NoWidgetsState = NoWidgetsStateImpl; 49047 49048 // routes/dashboard/widget-dashboard/widget-dashboard.tsx 49049 var import_jsx_runtime227 = __toESM(require_jsx_runtime()); 49050 var WidgetDashboard = Object.assign( 49051 function WidgetDashboard2({ 49052 layout, 49053 onLayoutChange, 49054 onLayoutReset, 49055 widgetTypes, 49056 editMode, 49057 onEditChange, 49058 resolveWidgetModule, 49059 gridSettings, 49060 onGridSettingsChange, 49061 children 49062 }) { 49063 return /* @__PURE__ */ (0, import_jsx_runtime227.jsx)( 49064 WidgetDashboardProvider, 49065 { 49066 layout, 49067 onLayoutChange, 49068 onLayoutReset, 49069 widgetTypes, 49070 editMode, 49071 onEditChange, 49072 resolveWidgetModule, 49073 gridSettings, 49074 onGridSettingsChange, 49075 children: /* @__PURE__ */ (0, import_jsx_runtime227.jsxs)(WidgetDashboardUIProvider, { children: [ 49076 children ?? /* @__PURE__ */ (0, import_jsx_runtime227.jsxs)(import_jsx_runtime227.Fragment, { children: [ 49077 /* @__PURE__ */ (0, import_jsx_runtime227.jsx)(NoWidgetsState, {}), 49078 /* @__PURE__ */ (0, import_jsx_runtime227.jsx)(Actions3, {}), 49079 /* @__PURE__ */ (0, import_jsx_runtime227.jsx)(Widgets, {}) 49080 ] }), 49081 /* @__PURE__ */ (0, import_jsx_runtime227.jsx)(DashboardCommands, {}), 49082 /* @__PURE__ */ (0, import_jsx_runtime227.jsx)(Inserter, {}), 49083 /* @__PURE__ */ (0, import_jsx_runtime227.jsx)(WidgetSettings, {}) 49084 ] }) 49085 } 49086 ); 49087 }, 49088 { Actions: Actions3, Widgets, WidgetChrome, NoWidgetsState } 49089 ); 49090 49091 // routes/dashboard/widget-types/hooks/use-widget-types.ts 49092 var import_data9 = __toESM(require_data()); 49093 var import_core_data = __toESM(require_core_data()); 49094 var import_element180 = __toESM(require_element()); 49095 var import_i18n68 = __toESM(require_i18n()); 49096 (0, import_data9.dispatch)(import_core_data.store).addEntities([ 49097 { 49098 name: "widgetModule", 49099 kind: "root", 49100 key: "name", 49101 baseURL: "/wp/v2/widget-modules", 49102 plural: "widgetModules", 49103 label: (0, import_i18n68.__)("Widget modules"), 49104 supportsPagination: false 49105 } 49106 ]); 49107 function useWidgetTypes() { 49108 const records = (0, import_data9.useSelect)( 49109 (select) => select(import_core_data.store).getEntityRecords("root", "widgetModule"), 49110 [] 49111 ); 49112 const [widgetTypes, setWidgetTypes] = (0, import_element180.useState)([]); 49113 (0, import_element180.useEffect)(() => { 49114 if (!records) { 49115 return; 49116 } 49117 let cancelled = false; 49118 Promise.all( 49119 records.map(async (record) => { 49120 if (!record.widget_module) { 49121 return null; 49122 } 49123 try { 49124 const module = await import( 49125 /* webpackIgnore: true */ 49126 record.widget_module 49127 ); 49128 if (!module?.default) { 49129 return null; 49130 } 49131 return { 49132 ...module.default, 49133 name: record.name, 49134 renderModule: record.render_module ?? "", 49135 ...record.presentation ? { presentation: record.presentation } : {} 49136 }; 49137 } catch { 49138 return null; 49139 } 49140 }) 49141 ).then((results) => { 49142 if (cancelled) { 49143 return; 49144 } 49145 setWidgetTypes( 49146 results.filter((t2) => t2 !== null) 49147 ); 49148 }); 49149 return () => { 49150 cancelled = true; 49151 }; 49152 }, [records]); 49153 return widgetTypes; 49154 } 49155 49156 // routes/dashboard/stage.tsx 49157 var import_jsx_runtime228 = __toESM(require_jsx_runtime()); 49158 function Dashboard() { 49159 const [layout, setLayout, resetLayout] = useDashboardLayout( 49160 "gutenberg_dashboard" 49161 ); 49162 const [gridSettings, setGridSettings] = useDashboardGridSettings(); 49163 const widgetTypes = useWidgetTypes(); 49164 const [editMode, setEditMode] = (0, import_element181.useState)(false); 49165 const isMobileViewport = (0, import_data10.useSelect)( 49166 (select) => select(import_viewport2.store).isViewportMatch("< small"), 49167 [] 49168 ); 49169 const customizeDashboardLabel = (0, import_i18n69.__)("Customize Dashboard"); 49170 const dashboardLabel = (0, import_i18n69.__)("Dashboard"); 49171 const { createSuccessNotice } = (0, import_data10.useDispatch)(import_notices.store); 49172 const handleLayoutChange = (next) => { 49173 setLayout(next); 49174 void createSuccessNotice((0, import_i18n69.__)("Dashboard saved."), { 49175 type: "snackbar" 49176 }); 49177 }; 49178 const pageTitle = editMode ? customizeDashboardLabel : dashboardLabel; 49179 return /* @__PURE__ */ (0, import_jsx_runtime228.jsx)( 49180 WidgetDashboard, 49181 { 49182 widgetTypes, 49183 layout, 49184 onLayoutChange: handleLayoutChange, 49185 onLayoutReset: resetLayout, 49186 gridSettings, 49187 onGridSettingsChange: setGridSettings, 49188 editMode, 49189 onEditChange: setEditMode, 49190 children: /* @__PURE__ */ (0, import_jsx_runtime228.jsxs)( 49191 page_default, 49192 { 49193 title: editMode && isMobileViewport ? void 0 : pageTitle, 49194 ariaLabel: pageTitle, 49195 actions: /* @__PURE__ */ (0, import_jsx_runtime228.jsx)(WidgetDashboard.Actions, {}), 49196 hasPadding: true, 49197 children: [ 49198 /* @__PURE__ */ (0, import_jsx_runtime228.jsx)(WidgetDashboard.NoWidgetsState, {}), 49199 /* @__PURE__ */ (0, import_jsx_runtime228.jsx)(WidgetDashboard.Widgets, {}) 49200 ] 49201 } 49202 ) 49203 } 49204 ); 49205 } 49206 var stage = Dashboard; 49207 export { 49208 stage 49209 }; 49210 /*! Bundled license information: 49211 49212 use-sync-external-store/cjs/use-sync-external-store-shim.development.js: 49213 (** 49214 * @license React 49215 * use-sync-external-store-shim.development.js 49216 * 49217 * Copyright (c) Meta Platforms, Inc. and affiliates. 49218 * 49219 * This source code is licensed under the MIT license found in the 49220 * LICENSE file in the root directory of this source tree. 49221 *) 49222 49223 use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js: 49224 (** 49225 * @license React 49226 * use-sync-external-store-shim/with-selector.development.js 49227 * 49228 * Copyright (c) Meta Platforms, Inc. and affiliates. 49229 * 49230 * This source code is licensed under the MIT license found in the 49231 * LICENSE file in the root directory of this source tree. 49232 *) 49233 49234 tabbable/dist/index.esm.js: 49235 (*! 49236 * tabbable 6.4.0 49237 * @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE 49238 *) 49239 */
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated : Tue Jun 30 08:20:12 2026 | Cross-referenced by PHPXref |