| [ 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 key of __getOwnPropNames(from)) 17 if (!__hasOwnProp.call(to, key) && key !== except) 18 __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || 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(subscribe, getSnapshot) { 75 didWarnOld18Alpha || void 0 === React59.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 = useState25({ 86 inst: { value, getSnapshot } 87 }); 88 var inst = cachedValue[0].inst, forceUpdate = cachedValue[1]; 89 useLayoutEffect4( 90 function() { 91 inst.value = value; 92 inst.getSnapshot = getSnapshot; 93 checkIfSnapshotChanged(inst) && forceUpdate({ inst }); 94 }, 95 [subscribe, value, getSnapshot] 96 ); 97 useEffect23( 98 function() { 99 checkIfSnapshotChanged(inst) && forceUpdate({ inst }); 100 return subscribe(function() { 101 checkIfSnapshotChanged(inst) && forceUpdate({ inst }); 102 }); 103 }, 104 [subscribe] 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(subscribe, 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 React59 = require_react(), objectIs = "function" === typeof Object.is ? Object.is : is, useState25 = React59.useState, useEffect23 = React59.useEffect, useLayoutEffect4 = React59.useLayoutEffect, useDebugValue2 = React59.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 !== React59.useSyncExternalStore ? React59.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 React59 = require_react(), shim = require_shim(), objectIs = "function" === typeof Object.is ? Object.is : is, useSyncExternalStore2 = shim.useSyncExternalStore, useRef30 = React59.useRef, useEffect23 = React59.useEffect, useMemo34 = React59.useMemo, useDebugValue2 = React59.useDebugValue; 152 exports.useSyncExternalStoreWithSelector = function(subscribe, getSnapshot, getServerSnapshot, selector, isEqual) { 153 var instRef = useRef30(null); 154 if (null === instRef.current) { 155 var inst = { hasValue: false, value: null }; 156 instRef.current = inst; 157 } else inst = instRef.current; 158 instRef = useMemo34( 159 function() { 160 function memoizedSelector(nextSnapshot) { 161 if (!hasMemo) { 162 hasMemo = true; 163 memoizedSnapshot = nextSnapshot; 164 nextSnapshot = selector(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 = selector(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, selector, isEqual] 192 ); 193 var value = useSyncExternalStore2(subscribe, instRef[0], instRef[1]); 194 useEffect23( 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/core-data 257 var require_core_data = __commonJS({ 258 "package-external:@wordpress/core-data"(exports, module) { 259 module.exports = window.wp.coreData; 260 } 261 }); 262 263 // package-external:@wordpress/data 264 var require_data = __commonJS({ 265 "package-external:@wordpress/data"(exports, module) { 266 module.exports = window.wp.data; 267 } 268 }); 269 270 // node_modules/fast-deep-equal/es6/index.js 271 var require_es6 = __commonJS({ 272 "node_modules/fast-deep-equal/es6/index.js"(exports, module) { 273 "use strict"; 274 module.exports = function equal(a2, b2) { 275 if (a2 === b2) return true; 276 if (a2 && b2 && typeof a2 == "object" && typeof b2 == "object") { 277 if (a2.constructor !== b2.constructor) return false; 278 var length, i2, keys; 279 if (Array.isArray(a2)) { 280 length = a2.length; 281 if (length != b2.length) return false; 282 for (i2 = length; i2-- !== 0; ) 283 if (!equal(a2[i2], b2[i2])) return false; 284 return true; 285 } 286 if (a2 instanceof Map && b2 instanceof Map) { 287 if (a2.size !== b2.size) return false; 288 for (i2 of a2.entries()) 289 if (!b2.has(i2[0])) return false; 290 for (i2 of a2.entries()) 291 if (!equal(i2[1], b2.get(i2[0]))) return false; 292 return true; 293 } 294 if (a2 instanceof Set && b2 instanceof Set) { 295 if (a2.size !== b2.size) return false; 296 for (i2 of a2.entries()) 297 if (!b2.has(i2[0])) return false; 298 return true; 299 } 300 if (ArrayBuffer.isView(a2) && ArrayBuffer.isView(b2)) { 301 length = a2.length; 302 if (length != b2.length) return false; 303 for (i2 = length; i2-- !== 0; ) 304 if (a2[i2] !== b2[i2]) return false; 305 return true; 306 } 307 if (a2.constructor === RegExp) return a2.source === b2.source && a2.flags === b2.flags; 308 if (a2.valueOf !== Object.prototype.valueOf) return a2.valueOf() === b2.valueOf(); 309 if (a2.toString !== Object.prototype.toString) return a2.toString() === b2.toString(); 310 keys = Object.keys(a2); 311 length = keys.length; 312 if (length !== Object.keys(b2).length) return false; 313 for (i2 = length; i2-- !== 0; ) 314 if (!Object.prototype.hasOwnProperty.call(b2, keys[i2])) return false; 315 for (i2 = length; i2-- !== 0; ) { 316 var key = keys[i2]; 317 if (!equal(a2[key], b2[key])) return false; 318 } 319 return true; 320 } 321 return a2 !== a2 && b2 !== b2; 322 }; 323 } 324 }); 325 326 // package-external:@wordpress/date 327 var require_date = __commonJS({ 328 "package-external:@wordpress/date"(exports, module) { 329 module.exports = window.wp.date; 330 } 331 }); 332 333 // node_modules/deepmerge/dist/cjs.js 334 var require_cjs = __commonJS({ 335 "node_modules/deepmerge/dist/cjs.js"(exports, module) { 336 "use strict"; 337 var isMergeableObject = function isMergeableObject2(value) { 338 return isNonNullObject(value) && !isSpecial(value); 339 }; 340 function isNonNullObject(value) { 341 return !!value && typeof value === "object"; 342 } 343 function isSpecial(value) { 344 var stringValue = Object.prototype.toString.call(value); 345 return stringValue === "[object RegExp]" || stringValue === "[object Date]" || isReactElement(value); 346 } 347 var canUseSymbol = typeof Symbol === "function" && Symbol.for; 348 var REACT_ELEMENT_TYPE = canUseSymbol ? /* @__PURE__ */ Symbol.for("react.element") : 60103; 349 function isReactElement(value) { 350 return value.$$typeof === REACT_ELEMENT_TYPE; 351 } 352 function emptyTarget(val) { 353 return Array.isArray(val) ? [] : {}; 354 } 355 function cloneUnlessOtherwiseSpecified(value, options) { 356 return options.clone !== false && options.isMergeableObject(value) ? deepmerge(emptyTarget(value), value, options) : value; 357 } 358 function defaultArrayMerge(target, source, options) { 359 return target.concat(source).map(function(element) { 360 return cloneUnlessOtherwiseSpecified(element, options); 361 }); 362 } 363 function getMergeFunction(key, options) { 364 if (!options.customMerge) { 365 return deepmerge; 366 } 367 var customMerge = options.customMerge(key); 368 return typeof customMerge === "function" ? customMerge : deepmerge; 369 } 370 function getEnumerableOwnPropertySymbols(target) { 371 return Object.getOwnPropertySymbols ? Object.getOwnPropertySymbols(target).filter(function(symbol) { 372 return Object.propertyIsEnumerable.call(target, symbol); 373 }) : []; 374 } 375 function getKeys(target) { 376 return Object.keys(target).concat(getEnumerableOwnPropertySymbols(target)); 377 } 378 function propertyIsOnObject(object, property) { 379 try { 380 return property in object; 381 } catch (_) { 382 return false; 383 } 384 } 385 function propertyIsUnsafe(target, key) { 386 return propertyIsOnObject(target, key) && !(Object.hasOwnProperty.call(target, key) && Object.propertyIsEnumerable.call(target, key)); 387 } 388 function mergeObject(target, source, options) { 389 var destination = {}; 390 if (options.isMergeableObject(target)) { 391 getKeys(target).forEach(function(key) { 392 destination[key] = cloneUnlessOtherwiseSpecified(target[key], options); 393 }); 394 } 395 getKeys(source).forEach(function(key) { 396 if (propertyIsUnsafe(target, key)) { 397 return; 398 } 399 if (propertyIsOnObject(target, key) && options.isMergeableObject(source[key])) { 400 destination[key] = getMergeFunction(key, options)(target[key], source[key], options); 401 } else { 402 destination[key] = cloneUnlessOtherwiseSpecified(source[key], options); 403 } 404 }); 405 return destination; 406 } 407 function deepmerge(target, source, options) { 408 options = options || {}; 409 options.arrayMerge = options.arrayMerge || defaultArrayMerge; 410 options.isMergeableObject = options.isMergeableObject || isMergeableObject; 411 options.cloneUnlessOtherwiseSpecified = cloneUnlessOtherwiseSpecified; 412 var sourceIsArray = Array.isArray(source); 413 var targetIsArray = Array.isArray(target); 414 var sourceAndTargetTypesMatch = sourceIsArray === targetIsArray; 415 if (!sourceAndTargetTypesMatch) { 416 return cloneUnlessOtherwiseSpecified(source, options); 417 } else if (sourceIsArray) { 418 return options.arrayMerge(target, source, options); 419 } else { 420 return mergeObject(target, source, options); 421 } 422 } 423 deepmerge.all = function deepmergeAll(array, options) { 424 if (!Array.isArray(array)) { 425 throw new Error("first argument should be an array"); 426 } 427 return array.reduce(function(prev, next) { 428 return deepmerge(prev, next, options); 429 }, {}); 430 }; 431 var deepmerge_1 = deepmerge; 432 module.exports = deepmerge_1; 433 } 434 }); 435 436 // package-external:@wordpress/notices 437 var require_notices = __commonJS({ 438 "package-external:@wordpress/notices"(exports, module) { 439 module.exports = window.wp.notices; 440 } 441 }); 442 443 // package-external:@wordpress/api-fetch 444 var require_api_fetch = __commonJS({ 445 "package-external:@wordpress/api-fetch"(exports, module) { 446 module.exports = window.wp.apiFetch; 447 } 448 }); 449 450 // node_modules/clsx/dist/clsx.mjs 451 function r(e2) { 452 var t2, f2, n2 = ""; 453 if ("string" == typeof e2 || "number" == typeof e2) n2 += e2; 454 else if ("object" == typeof e2) if (Array.isArray(e2)) { 455 var o2 = e2.length; 456 for (t2 = 0; t2 < o2; t2++) e2[t2] && (f2 = r(e2[t2])) && (n2 && (n2 += " "), n2 += f2); 457 } else for (f2 in e2) e2[f2] && (n2 && (n2 += " "), n2 += f2); 458 return n2; 459 } 460 function clsx() { 461 for (var e2, t2, f2 = 0, n2 = "", o2 = arguments.length; f2 < o2; f2++) (e2 = arguments[f2]) && (t2 = r(e2)) && (n2 && (n2 += " "), n2 += t2); 462 return n2; 463 } 464 var clsx_default = clsx; 465 466 // packages/ui/build-module/badge/badge.mjs 467 var import_element9 = __toESM(require_element(), 1); 468 469 // node_modules/@base-ui/utils/esm/useControlled.js 470 var React2 = __toESM(require_react(), 1); 471 472 // node_modules/@base-ui/utils/esm/error.js 473 var set; 474 if (true) { 475 set = /* @__PURE__ */ new Set(); 476 } 477 function error(...messages) { 478 if (true) { 479 const messageKey = messages.join(" "); 480 if (!set.has(messageKey)) { 481 set.add(messageKey); 482 console.error(`Base UI: $messageKey}`); 483 } 484 } 485 } 486 487 // node_modules/@base-ui/utils/esm/useControlled.js 488 function useControlled({ 489 controlled, 490 default: defaultProp, 491 name, 492 state = "value" 493 }) { 494 const { 495 current: isControlled 496 } = React2.useRef(controlled !== void 0); 497 const [valueState, setValue] = React2.useState(defaultProp); 498 const value = isControlled ? controlled : valueState; 499 if (true) { 500 React2.useEffect(() => { 501 if (isControlled !== (controlled !== void 0)) { 502 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")); 503 } 504 }, [state, name, controlled]); 505 const { 506 current: defaultValue 507 } = React2.useRef(defaultProp); 508 React2.useEffect(() => { 509 if (!isControlled && serializeToDevModeString(defaultValue) !== serializeToDevModeString(defaultProp)) { 510 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")); 511 } 512 }, [defaultProp]); 513 } 514 const setValueIfUncontrolled = React2.useCallback((newValue) => { 515 if (!isControlled) { 516 setValue(newValue); 517 } 518 }, []); 519 return [value, setValueIfUncontrolled]; 520 } 521 function serializeToDevModeString(input) { 522 let nextId = 0; 523 const seen = /* @__PURE__ */ new WeakMap(); 524 try { 525 const result = JSON.stringify(input, function replacer(key, value) { 526 if (key === "_owner" && this != null && typeof this === "object" && "$$typeof" in this) { 527 return void 0; 528 } 529 if (typeof value === "bigint") { 530 return `__bigint__:$value}`; 531 } 532 if (value !== null && typeof value === "object") { 533 const id = seen.get(value); 534 if (id !== void 0) { 535 return `__object__:$id}`; 536 } 537 seen.set(value, nextId); 538 nextId += 1; 539 } 540 return value; 541 }); 542 return result ?? `__top__:$typeof input}`; 543 } catch { 544 return "__unserializable__"; 545 } 546 } 547 548 // node_modules/@base-ui/utils/esm/useStableCallback.js 549 var React4 = __toESM(require_react(), 1); 550 551 // node_modules/@base-ui/utils/esm/useRefWithInit.js 552 var React3 = __toESM(require_react(), 1); 553 var UNINITIALIZED = {}; 554 function useRefWithInit(init, initArg) { 555 const ref = React3.useRef(UNINITIALIZED); 556 if (ref.current === UNINITIALIZED) { 557 ref.current = init(initArg); 558 } 559 return ref; 560 } 561 562 // node_modules/@base-ui/utils/esm/useStableCallback.js 563 var useInsertionEffect = React4[`useInsertionEffect$Math.random().toFixed(1)}`.slice(0, -3)]; 564 var useSafeInsertionEffect = ( 565 // React 17 doesn't have useInsertionEffect. 566 useInsertionEffect && // Preact replaces useInsertionEffect with useLayoutEffect and fires too late. 567 useInsertionEffect !== React4.useLayoutEffect ? useInsertionEffect : (fn) => fn() 568 ); 569 function useStableCallback(callback) { 570 const stable = useRefWithInit(createStableCallback).current; 571 stable.next = callback; 572 useSafeInsertionEffect(stable.effect); 573 return stable.trampoline; 574 } 575 function createStableCallback() { 576 const stable = { 577 next: void 0, 578 callback: assertNotCalled, 579 trampoline: (...args) => stable.callback?.(...args), 580 effect: () => { 581 stable.callback = stable.next; 582 } 583 }; 584 return stable; 585 } 586 function assertNotCalled() { 587 if (true) { 588 throw ( 589 /* minify-error-disabled */ 590 new Error("Base UI: Cannot call an event handler while rendering.") 591 ); 592 } 593 } 594 595 // node_modules/@base-ui/utils/esm/useIsoLayoutEffect.js 596 var React5 = __toESM(require_react(), 1); 597 var noop = () => { 598 }; 599 var useIsoLayoutEffect = typeof document !== "undefined" ? React5.useLayoutEffect : noop; 600 601 // node_modules/@base-ui/utils/esm/warn.js 602 var set2; 603 if (true) { 604 set2 = /* @__PURE__ */ new Set(); 605 } 606 function warn(...messages) { 607 if (true) { 608 const messageKey = messages.join(" "); 609 if (!set2.has(messageKey)) { 610 set2.add(messageKey); 611 console.warn(`Base UI: $messageKey}`); 612 } 613 } 614 } 615 616 // node_modules/@base-ui/react/esm/internals/direction-context/DirectionContext.js 617 var React6 = __toESM(require_react(), 1); 618 var DirectionContext = /* @__PURE__ */ React6.createContext(void 0); 619 if (true) DirectionContext.displayName = "DirectionContext"; 620 function useDirection() { 621 const context = React6.useContext(DirectionContext); 622 return context?.direction ?? "ltr"; 623 } 624 625 // node_modules/@base-ui/react/esm/internals/useRenderElement.js 626 var React9 = __toESM(require_react(), 1); 627 628 // node_modules/@base-ui/utils/esm/useMergedRefs.js 629 function useMergedRefs(a2, b2, c2, d2) { 630 const forkRef = useRefWithInit(createForkRef).current; 631 if (didChange(forkRef, a2, b2, c2, d2)) { 632 update(forkRef, [a2, b2, c2, d2]); 633 } 634 return forkRef.callback; 635 } 636 function useMergedRefsN(refs) { 637 const forkRef = useRefWithInit(createForkRef).current; 638 if (didChangeN(forkRef, refs)) { 639 update(forkRef, refs); 640 } 641 return forkRef.callback; 642 } 643 function createForkRef() { 644 return { 645 callback: null, 646 cleanup: null, 647 refs: [] 648 }; 649 } 650 function didChange(forkRef, a2, b2, c2, d2) { 651 return forkRef.refs[0] !== a2 || forkRef.refs[1] !== b2 || forkRef.refs[2] !== c2 || forkRef.refs[3] !== d2; 652 } 653 function didChangeN(forkRef, newRefs) { 654 return forkRef.refs.length !== newRefs.length || forkRef.refs.some((ref, index2) => ref !== newRefs[index2]); 655 } 656 function update(forkRef, refs) { 657 forkRef.refs = refs; 658 if (refs.every((ref) => ref == null)) { 659 forkRef.callback = null; 660 return; 661 } 662 forkRef.callback = (instance) => { 663 if (forkRef.cleanup) { 664 forkRef.cleanup(); 665 forkRef.cleanup = null; 666 } 667 if (instance != null) { 668 const cleanupCallbacks = Array(refs.length).fill(null); 669 for (let i2 = 0; i2 < refs.length; i2 += 1) { 670 const ref = refs[i2]; 671 if (ref == null) { 672 continue; 673 } 674 switch (typeof ref) { 675 case "function": { 676 const refCleanup = ref(instance); 677 if (typeof refCleanup === "function") { 678 cleanupCallbacks[i2] = refCleanup; 679 } 680 break; 681 } 682 case "object": { 683 ref.current = instance; 684 break; 685 } 686 default: 687 } 688 } 689 forkRef.cleanup = () => { 690 for (let i2 = 0; i2 < refs.length; i2 += 1) { 691 const ref = refs[i2]; 692 if (ref == null) { 693 continue; 694 } 695 switch (typeof ref) { 696 case "function": { 697 const cleanupCallback = cleanupCallbacks[i2]; 698 if (typeof cleanupCallback === "function") { 699 cleanupCallback(); 700 } else { 701 ref(null); 702 } 703 break; 704 } 705 case "object": { 706 ref.current = null; 707 break; 708 } 709 default: 710 } 711 } 712 }; 713 } 714 }; 715 } 716 717 // node_modules/@base-ui/utils/esm/getReactElementRef.js 718 var React8 = __toESM(require_react(), 1); 719 720 // node_modules/@base-ui/utils/esm/reactVersion.js 721 var React7 = __toESM(require_react(), 1); 722 var majorVersion = parseInt(React7.version, 10); 723 function isReactVersionAtLeast(reactVersionToCheck) { 724 return majorVersion >= reactVersionToCheck; 725 } 726 727 // node_modules/@base-ui/utils/esm/getReactElementRef.js 728 function getReactElementRef(element) { 729 if (!/* @__PURE__ */ React8.isValidElement(element)) { 730 return null; 731 } 732 const reactElement = element; 733 const propsWithRef = reactElement.props; 734 return (isReactVersionAtLeast(19) ? propsWithRef?.ref : reactElement.ref) ?? null; 735 } 736 737 // node_modules/@base-ui/utils/esm/mergeObjects.js 738 function mergeObjects(a2, b2) { 739 if (a2 && !b2) { 740 return a2; 741 } 742 if (!a2 && b2) { 743 return b2; 744 } 745 if (a2 || b2) { 746 return { 747 ...a2, 748 ...b2 749 }; 750 } 751 return void 0; 752 } 753 754 // node_modules/@base-ui/utils/esm/empty.js 755 function NOOP() { 756 } 757 var EMPTY_ARRAY = Object.freeze([]); 758 var EMPTY_OBJECT = Object.freeze({}); 759 760 // node_modules/@base-ui/react/esm/internals/getStateAttributesProps.js 761 function getStateAttributesProps(state, customMapping) { 762 const props = {}; 763 for (const key in state) { 764 const value = state[key]; 765 if (customMapping?.hasOwnProperty(key)) { 766 const customProps = customMapping[key](value); 767 if (customProps != null) { 768 Object.assign(props, customProps); 769 } 770 continue; 771 } 772 if (value === true) { 773 props[`data-$key.toLowerCase()}`] = ""; 774 } else if (value) { 775 props[`data-$key.toLowerCase()}`] = value.toString(); 776 } 777 } 778 return props; 779 } 780 781 // node_modules/@base-ui/react/esm/utils/resolveClassName.js 782 function resolveClassName(className, state) { 783 return typeof className === "function" ? className(state) : className; 784 } 785 786 // node_modules/@base-ui/react/esm/utils/resolveStyle.js 787 function resolveStyle(style, state) { 788 return typeof style === "function" ? style(state) : style; 789 } 790 791 // node_modules/@base-ui/react/esm/merge-props/mergeProps.js 792 var EMPTY_PROPS = {}; 793 function mergeProps(a2, b2, c2, d2, e2) { 794 if (!c2 && !d2 && !e2 && !a2) { 795 return createInitialMergedProps(b2); 796 } 797 let merged = createInitialMergedProps(a2); 798 if (b2) { 799 merged = mergeInto(merged, b2); 800 } 801 if (c2) { 802 merged = mergeInto(merged, c2); 803 } 804 if (d2) { 805 merged = mergeInto(merged, d2); 806 } 807 if (e2) { 808 merged = mergeInto(merged, e2); 809 } 810 return merged; 811 } 812 function mergePropsN(props) { 813 if (props.length === 0) { 814 return EMPTY_PROPS; 815 } 816 if (props.length === 1) { 817 return createInitialMergedProps(props[0]); 818 } 819 let merged = createInitialMergedProps(props[0]); 820 for (let i2 = 1; i2 < props.length; i2 += 1) { 821 merged = mergeInto(merged, props[i2]); 822 } 823 return merged; 824 } 825 function createInitialMergedProps(inputProps) { 826 if (isPropsGetter(inputProps)) { 827 return { 828 ...resolvePropsGetter(inputProps, EMPTY_PROPS) 829 }; 830 } 831 return copyInitialProps(inputProps); 832 } 833 function mergeInto(merged, inputProps) { 834 if (isPropsGetter(inputProps)) { 835 return resolvePropsGetter(inputProps, merged); 836 } 837 return mutablyMergeInto(merged, inputProps); 838 } 839 function copyInitialProps(inputProps) { 840 const copiedProps = { 841 ...inputProps 842 }; 843 for (const propName in copiedProps) { 844 const propValue = copiedProps[propName]; 845 if (isEventHandler(propName, propValue)) { 846 copiedProps[propName] = wrapEventHandler(propValue); 847 } 848 } 849 return copiedProps; 850 } 851 function mutablyMergeInto(mergedProps, externalProps) { 852 if (!externalProps) { 853 return mergedProps; 854 } 855 for (const propName in externalProps) { 856 const externalPropValue = externalProps[propName]; 857 switch (propName) { 858 case "style": { 859 mergedProps[propName] = mergeObjects(mergedProps.style, externalPropValue); 860 break; 861 } 862 case "className": { 863 mergedProps[propName] = mergeClassNames(mergedProps.className, externalPropValue); 864 break; 865 } 866 default: { 867 if (isEventHandler(propName, externalPropValue)) { 868 mergedProps[propName] = mergeEventHandlers(mergedProps[propName], externalPropValue); 869 } else { 870 mergedProps[propName] = externalPropValue; 871 } 872 } 873 } 874 } 875 return mergedProps; 876 } 877 function isEventHandler(key, value) { 878 const code0 = key.charCodeAt(0); 879 const code1 = key.charCodeAt(1); 880 const code2 = key.charCodeAt(2); 881 return code0 === 111 && code1 === 110 && code2 >= 65 && code2 <= 90 && (typeof value === "function" || typeof value === "undefined"); 882 } 883 function isPropsGetter(inputProps) { 884 return typeof inputProps === "function"; 885 } 886 function resolvePropsGetter(inputProps, previousProps) { 887 if (isPropsGetter(inputProps)) { 888 return inputProps(previousProps); 889 } 890 return inputProps ?? EMPTY_PROPS; 891 } 892 function mergeEventHandlers(ourHandler, theirHandler) { 893 if (!theirHandler) { 894 return ourHandler; 895 } 896 if (!ourHandler) { 897 return wrapEventHandler(theirHandler); 898 } 899 return (...args) => { 900 const event = args[0]; 901 if (isSyntheticEvent(event)) { 902 const baseUIEvent = event; 903 makeEventPreventable(baseUIEvent); 904 const result2 = theirHandler(...args); 905 if (!baseUIEvent.baseUIHandlerPrevented) { 906 ourHandler?.(...args); 907 } 908 return result2; 909 } 910 const result = theirHandler(...args); 911 ourHandler?.(...args); 912 return result; 913 }; 914 } 915 function wrapEventHandler(handler) { 916 if (!handler) { 917 return handler; 918 } 919 return (...args) => { 920 const event = args[0]; 921 if (isSyntheticEvent(event)) { 922 makeEventPreventable(event); 923 } 924 return handler(...args); 925 }; 926 } 927 function makeEventPreventable(event) { 928 event.preventBaseUIHandler = () => { 929 event.baseUIHandlerPrevented = true; 930 }; 931 return event; 932 } 933 function mergeClassNames(ourClassName, theirClassName) { 934 if (theirClassName) { 935 if (ourClassName) { 936 return theirClassName + " " + ourClassName; 937 } 938 return theirClassName; 939 } 940 return ourClassName; 941 } 942 function isSyntheticEvent(event) { 943 return event != null && typeof event === "object" && "nativeEvent" in event; 944 } 945 946 // node_modules/@base-ui/react/esm/internals/useRenderElement.js 947 var import_react = __toESM(require_react(), 1); 948 function useRenderElement(element, componentProps, params = {}) { 949 const renderProp = componentProps.render; 950 const outProps = useRenderElementProps(componentProps, params); 951 if (params.enabled === false) { 952 return null; 953 } 954 const state = params.state ?? EMPTY_OBJECT; 955 return evaluateRenderProp(element, renderProp, outProps, state); 956 } 957 function useRenderElementProps(componentProps, params = {}) { 958 const { 959 className: classNameProp, 960 style: styleProp, 961 render: renderProp 962 } = componentProps; 963 const { 964 state = EMPTY_OBJECT, 965 ref, 966 props, 967 stateAttributesMapping: stateAttributesMapping4, 968 enabled = true 969 } = params; 970 const className = enabled ? resolveClassName(classNameProp, state) : void 0; 971 const style = enabled ? resolveStyle(styleProp, state) : void 0; 972 const stateProps = enabled ? getStateAttributesProps(state, stateAttributesMapping4) : EMPTY_OBJECT; 973 const resolvedProps = enabled && props ? resolveRenderFunctionProps(props) : void 0; 974 const outProps = enabled ? mergeObjects(stateProps, resolvedProps) ?? {} : EMPTY_OBJECT; 975 if (typeof document !== "undefined") { 976 if (!enabled) { 977 useMergedRefs(null, null); 978 } else if (Array.isArray(ref)) { 979 outProps.ref = useMergedRefsN([outProps.ref, getReactElementRef(renderProp), ...ref]); 980 } else { 981 outProps.ref = useMergedRefs(outProps.ref, getReactElementRef(renderProp), ref); 982 } 983 } 984 if (!enabled) { 985 return EMPTY_OBJECT; 986 } 987 if (className !== void 0) { 988 outProps.className = mergeClassNames(outProps.className, className); 989 } 990 if (style !== void 0) { 991 outProps.style = mergeObjects(outProps.style, style); 992 } 993 return outProps; 994 } 995 function resolveRenderFunctionProps(props) { 996 if (Array.isArray(props)) { 997 return mergePropsN(props); 998 } 999 return mergeProps(void 0, props); 1000 } 1001 var REACT_LAZY_TYPE = /* @__PURE__ */ Symbol.for("react.lazy"); 1002 var COMPONENT_IDENTIFIER_PATTERN = /^[A-Z][A-Za-z0-9$]*$/; 1003 var LOWERCASE_CHARACTER_PATTERN = /[a-z]/; 1004 function evaluateRenderProp(element, render4, props, state) { 1005 if (render4) { 1006 if (typeof render4 === "function") { 1007 if (true) { 1008 warnIfRenderPropLooksLikeComponent(render4); 1009 } 1010 return render4(props, state); 1011 } 1012 const mergedProps = mergeProps(props, render4.props); 1013 mergedProps.ref = props.ref; 1014 let newElement = render4; 1015 if (newElement?.$$typeof === REACT_LAZY_TYPE) { 1016 const children = React9.Children.toArray(render4); 1017 newElement = children[0]; 1018 } 1019 if (true) { 1020 if (!/* @__PURE__ */ React9.isValidElement(newElement)) { 1021 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")); 1022 } 1023 } 1024 return /* @__PURE__ */ React9.cloneElement(newElement, mergedProps); 1025 } 1026 if (element) { 1027 if (typeof element === "string") { 1028 return renderTag(element, props); 1029 } 1030 } 1031 throw new Error(true ? "Base UI: Render element or function are not defined." : formatErrorMessage_default(8)); 1032 } 1033 function warnIfRenderPropLooksLikeComponent(renderFn) { 1034 const functionName = renderFn.name; 1035 if (functionName.length === 0) { 1036 return; 1037 } 1038 if (!COMPONENT_IDENTIFIER_PATTERN.test(functionName)) { 1039 return; 1040 } 1041 if (!LOWERCASE_CHARACTER_PATTERN.test(functionName)) { 1042 return; 1043 } 1044 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"); 1045 } 1046 function renderTag(Tag, props) { 1047 if (Tag === "button") { 1048 return /* @__PURE__ */ (0, import_react.createElement)("button", { 1049 type: "button", 1050 ...props, 1051 key: props.key 1052 }); 1053 } 1054 if (Tag === "img") { 1055 return /* @__PURE__ */ (0, import_react.createElement)("img", { 1056 alt: "", 1057 ...props, 1058 key: props.key 1059 }); 1060 } 1061 return /* @__PURE__ */ React9.createElement(Tag, props); 1062 } 1063 1064 // node_modules/@base-ui/react/esm/internals/reason-parts.js 1065 var reason_parts_exports = {}; 1066 __export(reason_parts_exports, { 1067 cancelOpen: () => cancelOpen, 1068 chipRemovePress: () => chipRemovePress, 1069 clearPress: () => clearPress, 1070 closePress: () => closePress, 1071 closeWatcher: () => closeWatcher, 1072 decrementPress: () => decrementPress, 1073 disabled: () => disabled, 1074 drag: () => drag, 1075 escapeKey: () => escapeKey, 1076 focusOut: () => focusOut, 1077 imperativeAction: () => imperativeAction, 1078 incrementPress: () => incrementPress, 1079 inputBlur: () => inputBlur, 1080 inputChange: () => inputChange, 1081 inputClear: () => inputClear, 1082 inputPaste: () => inputPaste, 1083 inputPress: () => inputPress, 1084 itemPress: () => itemPress, 1085 keyboard: () => keyboard, 1086 linkPress: () => linkPress, 1087 listNavigation: () => listNavigation, 1088 none: () => none, 1089 outsidePress: () => outsidePress, 1090 pointer: () => pointer, 1091 scrub: () => scrub, 1092 siblingOpen: () => siblingOpen, 1093 swipe: () => swipe, 1094 trackPress: () => trackPress, 1095 triggerFocus: () => triggerFocus, 1096 triggerHover: () => triggerHover, 1097 triggerPress: () => triggerPress, 1098 wheel: () => wheel, 1099 windowResize: () => windowResize 1100 }); 1101 var none = "none"; 1102 var triggerPress = "trigger-press"; 1103 var triggerHover = "trigger-hover"; 1104 var triggerFocus = "trigger-focus"; 1105 var outsidePress = "outside-press"; 1106 var itemPress = "item-press"; 1107 var closePress = "close-press"; 1108 var linkPress = "link-press"; 1109 var clearPress = "clear-press"; 1110 var chipRemovePress = "chip-remove-press"; 1111 var trackPress = "track-press"; 1112 var incrementPress = "increment-press"; 1113 var decrementPress = "decrement-press"; 1114 var inputChange = "input-change"; 1115 var inputClear = "input-clear"; 1116 var inputBlur = "input-blur"; 1117 var inputPaste = "input-paste"; 1118 var inputPress = "input-press"; 1119 var focusOut = "focus-out"; 1120 var escapeKey = "escape-key"; 1121 var closeWatcher = "close-watcher"; 1122 var listNavigation = "list-navigation"; 1123 var keyboard = "keyboard"; 1124 var pointer = "pointer"; 1125 var drag = "drag"; 1126 var wheel = "wheel"; 1127 var scrub = "scrub"; 1128 var cancelOpen = "cancel-open"; 1129 var siblingOpen = "sibling-open"; 1130 var disabled = "disabled"; 1131 var imperativeAction = "imperative-action"; 1132 var swipe = "swipe"; 1133 var windowResize = "window-resize"; 1134 1135 // node_modules/@base-ui/react/esm/internals/createBaseUIEventDetails.js 1136 function createChangeEventDetails(reason, event, trigger, customProperties) { 1137 let canceled = false; 1138 let allowPropagation = false; 1139 const custom = customProperties ?? EMPTY_OBJECT; 1140 const details = { 1141 reason, 1142 event: event ?? new Event("base-ui"), 1143 cancel() { 1144 canceled = true; 1145 }, 1146 allowPropagation() { 1147 allowPropagation = true; 1148 }, 1149 get isCanceled() { 1150 return canceled; 1151 }, 1152 get isPropagationAllowed() { 1153 return allowPropagation; 1154 }, 1155 trigger, 1156 ...custom 1157 }; 1158 return details; 1159 } 1160 1161 // node_modules/@base-ui/utils/esm/useId.js 1162 var React11 = __toESM(require_react(), 1); 1163 1164 // node_modules/@base-ui/utils/esm/safeReact.js 1165 var React10 = __toESM(require_react(), 1); 1166 var SafeReact = { 1167 ...React10 1168 }; 1169 1170 // node_modules/@base-ui/utils/esm/useId.js 1171 var globalId = 0; 1172 function useGlobalId(idOverride, prefix = "mui") { 1173 const [defaultId, setDefaultId] = React11.useState(idOverride); 1174 const id = idOverride || defaultId; 1175 React11.useEffect(() => { 1176 if (defaultId == null) { 1177 globalId += 1; 1178 setDefaultId(`$prefix}-$globalId}`); 1179 } 1180 }, [defaultId, prefix]); 1181 return id; 1182 } 1183 var maybeReactUseId = SafeReact.useId; 1184 function useId(idOverride, prefix) { 1185 if (maybeReactUseId !== void 0) { 1186 const reactId = maybeReactUseId(); 1187 return idOverride ?? (prefix ? `$prefix}-$reactId}` : reactId); 1188 } 1189 return useGlobalId(idOverride, prefix); 1190 } 1191 1192 // node_modules/@base-ui/react/esm/internals/useBaseUiId.js 1193 function useBaseUiId(idOverride) { 1194 return useId(idOverride, "base-ui"); 1195 } 1196 1197 // node_modules/@base-ui/react/esm/collapsible/root/useCollapsibleRoot.js 1198 var React14 = __toESM(require_react(), 1); 1199 1200 // node_modules/@base-ui/react/esm/internals/useAnimationsFinished.js 1201 var ReactDOM = __toESM(require_react_dom(), 1); 1202 1203 // node_modules/@base-ui/utils/esm/useOnMount.js 1204 var React12 = __toESM(require_react(), 1); 1205 var EMPTY = []; 1206 function useOnMount(fn) { 1207 React12.useEffect(fn, EMPTY); 1208 } 1209 1210 // node_modules/@base-ui/utils/esm/useAnimationFrame.js 1211 var EMPTY2 = null; 1212 var LAST_RAF = globalThis.requestAnimationFrame; 1213 var Scheduler = class { 1214 /* This implementation uses an array as a backing data-structure for frame callbacks. 1215 * It allows `O(1)` callback cancelling by inserting a `null` in the array, though it 1216 * never calls the native `cancelAnimationFrame` if there are no frames left. This can 1217 * be much more efficient if there is a call pattern that alterns as 1218 * "request-cancel-request-cancel-…". 1219 * But in the case of "request-request-…-cancel-cancel-…", it leaves the final animation 1220 * frame to run anyway. We turn that frame into a `O(1)` no-op via `callbacksCount`. */ 1221 callbacks = []; 1222 callbacksCount = 0; 1223 nextId = 1; 1224 startId = 1; 1225 isScheduled = false; 1226 tick = (timestamp) => { 1227 this.isScheduled = false; 1228 const currentCallbacks = this.callbacks; 1229 const currentCallbacksCount = this.callbacksCount; 1230 this.callbacks = []; 1231 this.callbacksCount = 0; 1232 this.startId = this.nextId; 1233 if (currentCallbacksCount > 0) { 1234 for (let i2 = 0; i2 < currentCallbacks.length; i2 += 1) { 1235 currentCallbacks[i2]?.(timestamp); 1236 } 1237 } 1238 }; 1239 request(fn) { 1240 const id = this.nextId; 1241 this.nextId += 1; 1242 this.callbacks.push(fn); 1243 this.callbacksCount += 1; 1244 const didRAFChange = LAST_RAF !== requestAnimationFrame && (LAST_RAF = requestAnimationFrame, true); 1245 if (!this.isScheduled || didRAFChange) { 1246 requestAnimationFrame(this.tick); 1247 this.isScheduled = true; 1248 } 1249 return id; 1250 } 1251 cancel(id) { 1252 const index2 = id - this.startId; 1253 if (index2 < 0 || index2 >= this.callbacks.length) { 1254 return; 1255 } 1256 this.callbacks[index2] = null; 1257 this.callbacksCount -= 1; 1258 } 1259 }; 1260 var scheduler = new Scheduler(); 1261 var AnimationFrame = class _AnimationFrame { 1262 static create() { 1263 return new _AnimationFrame(); 1264 } 1265 static request(fn) { 1266 return scheduler.request(fn); 1267 } 1268 static cancel(id) { 1269 return scheduler.cancel(id); 1270 } 1271 currentId = EMPTY2; 1272 /** 1273 * Executes `fn` after `delay`, clearing any previously scheduled call. 1274 */ 1275 request(fn) { 1276 this.cancel(); 1277 this.currentId = scheduler.request(() => { 1278 this.currentId = EMPTY2; 1279 fn(); 1280 }); 1281 } 1282 cancel = () => { 1283 if (this.currentId !== EMPTY2) { 1284 scheduler.cancel(this.currentId); 1285 this.currentId = EMPTY2; 1286 } 1287 }; 1288 disposeEffect = () => { 1289 return this.cancel; 1290 }; 1291 }; 1292 function useAnimationFrame() { 1293 const timeout = useRefWithInit(AnimationFrame.create).current; 1294 useOnMount(timeout.disposeEffect); 1295 return timeout; 1296 } 1297 1298 // node_modules/@base-ui/react/esm/utils/resolveRef.js 1299 function resolveRef(maybeRef) { 1300 if (maybeRef == null) { 1301 return maybeRef; 1302 } 1303 return "current" in maybeRef ? maybeRef.current : maybeRef; 1304 } 1305 1306 // node_modules/@base-ui/react/esm/internals/stateAttributesMapping.js 1307 var TransitionStatusDataAttributes = /* @__PURE__ */ (function(TransitionStatusDataAttributes2) { 1308 TransitionStatusDataAttributes2["startingStyle"] = "data-starting-style"; 1309 TransitionStatusDataAttributes2["endingStyle"] = "data-ending-style"; 1310 return TransitionStatusDataAttributes2; 1311 })({}); 1312 var STARTING_HOOK = { 1313 [TransitionStatusDataAttributes.startingStyle]: "" 1314 }; 1315 var ENDING_HOOK = { 1316 [TransitionStatusDataAttributes.endingStyle]: "" 1317 }; 1318 var transitionStatusMapping = { 1319 transitionStatus(value) { 1320 if (value === "starting") { 1321 return STARTING_HOOK; 1322 } 1323 if (value === "ending") { 1324 return ENDING_HOOK; 1325 } 1326 return null; 1327 } 1328 }; 1329 1330 // node_modules/@base-ui/react/esm/internals/useAnimationsFinished.js 1331 function useAnimationsFinished(elementOrRef, waitForStartingStyleRemoved = false, treatAbortedAsFinished = true) { 1332 const frame = useAnimationFrame(); 1333 return useStableCallback((fnToExecute, signal = null) => { 1334 frame.cancel(); 1335 const element = resolveRef(elementOrRef); 1336 if (element == null) { 1337 return; 1338 } 1339 const resolvedElement = element; 1340 const done = () => { 1341 ReactDOM.flushSync(fnToExecute); 1342 }; 1343 if (typeof resolvedElement.getAnimations !== "function" || globalThis.BASE_UI_ANIMATIONS_DISABLED) { 1344 fnToExecute(); 1345 return; 1346 } 1347 function exec() { 1348 Promise.all(resolvedElement.getAnimations().map((animation) => animation.finished)).then(() => { 1349 if (!signal?.aborted) { 1350 done(); 1351 } 1352 }).catch(() => { 1353 if (treatAbortedAsFinished) { 1354 if (!signal?.aborted) { 1355 done(); 1356 } 1357 return; 1358 } 1359 const currentAnimations = resolvedElement.getAnimations(); 1360 if (!signal?.aborted && currentAnimations.length > 0 && currentAnimations.some((animation) => animation.pending || animation.playState !== "finished")) { 1361 exec(); 1362 } 1363 }); 1364 } 1365 if (waitForStartingStyleRemoved) { 1366 const startingStyleAttribute = TransitionStatusDataAttributes.startingStyle; 1367 if (!resolvedElement.hasAttribute(startingStyleAttribute)) { 1368 frame.request(exec); 1369 return; 1370 } 1371 const attributeObserver = new MutationObserver(() => { 1372 if (!resolvedElement.hasAttribute(startingStyleAttribute)) { 1373 attributeObserver.disconnect(); 1374 exec(); 1375 } 1376 }); 1377 attributeObserver.observe(resolvedElement, { 1378 attributes: true, 1379 attributeFilter: [startingStyleAttribute] 1380 }); 1381 signal?.addEventListener("abort", () => attributeObserver.disconnect(), { 1382 once: true 1383 }); 1384 return; 1385 } 1386 frame.request(exec); 1387 }); 1388 } 1389 1390 // node_modules/@base-ui/react/esm/internals/useTransitionStatus.js 1391 var React13 = __toESM(require_react(), 1); 1392 function useTransitionStatus(open, enableIdleState = false, deferEndingState = false) { 1393 const [transitionStatus, setTransitionStatus] = React13.useState(open && enableIdleState ? "idle" : void 0); 1394 const [mounted, setMounted] = React13.useState(open); 1395 if (open && !mounted) { 1396 setMounted(true); 1397 setTransitionStatus("starting"); 1398 } 1399 if (!open && mounted && transitionStatus !== "ending" && !deferEndingState) { 1400 setTransitionStatus("ending"); 1401 } 1402 if (!open && !mounted && transitionStatus === "ending") { 1403 setTransitionStatus(void 0); 1404 } 1405 useIsoLayoutEffect(() => { 1406 if (!open && mounted && transitionStatus !== "ending" && deferEndingState) { 1407 const frame = AnimationFrame.request(() => { 1408 setTransitionStatus("ending"); 1409 }); 1410 return () => { 1411 AnimationFrame.cancel(frame); 1412 }; 1413 } 1414 return void 0; 1415 }, [open, mounted, transitionStatus, deferEndingState]); 1416 useIsoLayoutEffect(() => { 1417 if (!open || enableIdleState) { 1418 return void 0; 1419 } 1420 const frame = AnimationFrame.request(() => { 1421 setTransitionStatus(void 0); 1422 }); 1423 return () => { 1424 AnimationFrame.cancel(frame); 1425 }; 1426 }, [enableIdleState, open]); 1427 useIsoLayoutEffect(() => { 1428 if (!open || !enableIdleState) { 1429 return void 0; 1430 } 1431 if (open && mounted && transitionStatus !== "idle") { 1432 setTransitionStatus("starting"); 1433 } 1434 const frame = AnimationFrame.request(() => { 1435 setTransitionStatus("idle"); 1436 }); 1437 return () => { 1438 AnimationFrame.cancel(frame); 1439 }; 1440 }, [enableIdleState, open, mounted, transitionStatus]); 1441 return { 1442 mounted, 1443 setMounted, 1444 transitionStatus 1445 }; 1446 } 1447 1448 // node_modules/@base-ui/react/esm/collapsible/root/useCollapsibleRoot.js 1449 function useCollapsibleRoot(parameters) { 1450 const { 1451 open: openParam, 1452 defaultOpen, 1453 onOpenChange, 1454 disabled: disabled2 1455 } = parameters; 1456 const isControlled = openParam !== void 0; 1457 const [open, setOpen] = useControlled({ 1458 controlled: openParam, 1459 default: defaultOpen, 1460 name: "Collapsible", 1461 state: "open" 1462 }); 1463 const { 1464 mounted, 1465 setMounted, 1466 transitionStatus 1467 } = useTransitionStatus(open, true, true); 1468 const [visible, setVisible] = React14.useState(open); 1469 const [{ 1470 height, 1471 width 1472 }, setDimensions] = React14.useState({ 1473 height: void 0, 1474 width: void 0 1475 }); 1476 const defaultPanelId = useBaseUiId(); 1477 const [panelIdState, setPanelIdState] = React14.useState(); 1478 const panelId = panelIdState ?? defaultPanelId; 1479 const [hiddenUntilFound, setHiddenUntilFound] = React14.useState(false); 1480 const [keepMounted, setKeepMounted] = React14.useState(false); 1481 const abortControllerRef = React14.useRef(null); 1482 const animationTypeRef = React14.useRef(null); 1483 const transitionDimensionRef = React14.useRef(null); 1484 const panelRef = React14.useRef(null); 1485 const runOnceAnimationsFinish = useAnimationsFinished(panelRef, false); 1486 const handleTrigger = useStableCallback((event) => { 1487 const nextOpen = !open; 1488 const eventDetails = createChangeEventDetails(reason_parts_exports.triggerPress, event.nativeEvent); 1489 onOpenChange(nextOpen, eventDetails); 1490 if (eventDetails.isCanceled) { 1491 return; 1492 } 1493 const panel = panelRef.current; 1494 if (animationTypeRef.current === "css-animation" && panel != null) { 1495 panel.style.removeProperty("animation-name"); 1496 } 1497 if (!hiddenUntilFound && !keepMounted) { 1498 if (animationTypeRef.current != null && animationTypeRef.current !== "css-animation") { 1499 if (!mounted && nextOpen) { 1500 setMounted(true); 1501 } 1502 } 1503 if (animationTypeRef.current === "css-animation") { 1504 if (!visible && nextOpen) { 1505 setVisible(true); 1506 } 1507 if (!mounted && nextOpen) { 1508 setMounted(true); 1509 } 1510 } 1511 } 1512 setOpen(nextOpen); 1513 if (animationTypeRef.current === "none" && mounted && !nextOpen) { 1514 setMounted(false); 1515 } 1516 }); 1517 useIsoLayoutEffect(() => { 1518 if (isControlled && animationTypeRef.current === "none" && !open) { 1519 setMounted(false); 1520 } 1521 }, [isControlled, open, openParam, setMounted]); 1522 return React14.useMemo(() => ({ 1523 abortControllerRef, 1524 animationTypeRef, 1525 disabled: disabled2, 1526 handleTrigger, 1527 height, 1528 mounted, 1529 open, 1530 panelId, 1531 panelRef, 1532 runOnceAnimationsFinish, 1533 setDimensions, 1534 setHiddenUntilFound, 1535 setKeepMounted, 1536 setMounted, 1537 setOpen, 1538 setPanelIdState, 1539 setVisible, 1540 transitionDimensionRef, 1541 transitionStatus, 1542 visible, 1543 width 1544 }), [abortControllerRef, animationTypeRef, disabled2, handleTrigger, height, mounted, open, panelId, panelRef, runOnceAnimationsFinish, setDimensions, setHiddenUntilFound, setKeepMounted, setMounted, setOpen, setVisible, transitionDimensionRef, transitionStatus, visible, width]); 1545 } 1546 1547 // node_modules/@base-ui/react/esm/collapsible/root/CollapsibleRootContext.js 1548 var React15 = __toESM(require_react(), 1); 1549 var CollapsibleRootContext = /* @__PURE__ */ React15.createContext(void 0); 1550 if (true) CollapsibleRootContext.displayName = "CollapsibleRootContext"; 1551 function useCollapsibleRootContext() { 1552 const context = React15.useContext(CollapsibleRootContext); 1553 if (context === void 0) { 1554 throw new Error(true ? "Base UI: CollapsibleRootContext is missing. Collapsible parts must be placed within <Collapsible.Root>." : formatErrorMessage_default(15)); 1555 } 1556 return context; 1557 } 1558 1559 // node_modules/@base-ui/react/esm/collapsible/panel/CollapsiblePanelDataAttributes.js 1560 var CollapsiblePanelDataAttributes = (function(CollapsiblePanelDataAttributes2) { 1561 CollapsiblePanelDataAttributes2["open"] = "data-open"; 1562 CollapsiblePanelDataAttributes2["closed"] = "data-closed"; 1563 CollapsiblePanelDataAttributes2[CollapsiblePanelDataAttributes2["startingStyle"] = TransitionStatusDataAttributes.startingStyle] = "startingStyle"; 1564 CollapsiblePanelDataAttributes2[CollapsiblePanelDataAttributes2["endingStyle"] = TransitionStatusDataAttributes.endingStyle] = "endingStyle"; 1565 return CollapsiblePanelDataAttributes2; 1566 })({}); 1567 1568 // node_modules/@base-ui/react/esm/collapsible/trigger/CollapsibleTriggerDataAttributes.js 1569 var CollapsibleTriggerDataAttributes = /* @__PURE__ */ (function(CollapsibleTriggerDataAttributes2) { 1570 CollapsibleTriggerDataAttributes2["panelOpen"] = "data-panel-open"; 1571 return CollapsibleTriggerDataAttributes2; 1572 })({}); 1573 1574 // node_modules/@base-ui/react/esm/utils/collapsibleOpenStateMapping.js 1575 var PANEL_OPEN_HOOK = { 1576 [CollapsiblePanelDataAttributes.open]: "" 1577 }; 1578 var PANEL_CLOSED_HOOK = { 1579 [CollapsiblePanelDataAttributes.closed]: "" 1580 }; 1581 var triggerOpenStateMapping = { 1582 open(value) { 1583 if (value) { 1584 return { 1585 [CollapsibleTriggerDataAttributes.panelOpen]: "" 1586 }; 1587 } 1588 return null; 1589 } 1590 }; 1591 var collapsibleOpenStateMapping = { 1592 open(value) { 1593 if (value) { 1594 return PANEL_OPEN_HOOK; 1595 } 1596 return PANEL_CLOSED_HOOK; 1597 } 1598 }; 1599 1600 // node_modules/@base-ui/react/esm/internals/use-button/useButton.js 1601 var React18 = __toESM(require_react(), 1); 1602 1603 // node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.mjs 1604 function hasWindow() { 1605 return typeof window !== "undefined"; 1606 } 1607 function getNodeName(node) { 1608 if (isNode(node)) { 1609 return (node.nodeName || "").toLowerCase(); 1610 } 1611 return "#document"; 1612 } 1613 function getWindow(node) { 1614 var _node$ownerDocument; 1615 return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window; 1616 } 1617 function getDocumentElement(node) { 1618 var _ref; 1619 return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement; 1620 } 1621 function isNode(value) { 1622 if (!hasWindow()) { 1623 return false; 1624 } 1625 return value instanceof Node || value instanceof getWindow(value).Node; 1626 } 1627 function isElement(value) { 1628 if (!hasWindow()) { 1629 return false; 1630 } 1631 return value instanceof Element || value instanceof getWindow(value).Element; 1632 } 1633 function isHTMLElement(value) { 1634 if (!hasWindow()) { 1635 return false; 1636 } 1637 return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement; 1638 } 1639 function isShadowRoot(value) { 1640 if (!hasWindow() || typeof ShadowRoot === "undefined") { 1641 return false; 1642 } 1643 return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot; 1644 } 1645 function isOverflowElement(element) { 1646 const { 1647 overflow, 1648 overflowX, 1649 overflowY, 1650 display 1651 } = getComputedStyle2(element); 1652 return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && display !== "inline" && display !== "contents"; 1653 } 1654 function isTableElement(element) { 1655 return /^(table|td|th)$/.test(getNodeName(element)); 1656 } 1657 function isTopLayer(element) { 1658 try { 1659 if (element.matches(":popover-open")) { 1660 return true; 1661 } 1662 } catch (_e) { 1663 } 1664 try { 1665 return element.matches(":modal"); 1666 } catch (_e) { 1667 return false; 1668 } 1669 } 1670 var willChangeRe = /transform|translate|scale|rotate|perspective|filter/; 1671 var containRe = /paint|layout|strict|content/; 1672 var isNotNone = (value) => !!value && value !== "none"; 1673 var isWebKitValue; 1674 function isContainingBlock(elementOrCss) { 1675 const css = isElement(elementOrCss) ? getComputedStyle2(elementOrCss) : elementOrCss; 1676 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 || ""); 1677 } 1678 function getContainingBlock(element) { 1679 let currentNode = getParentNode(element); 1680 while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) { 1681 if (isContainingBlock(currentNode)) { 1682 return currentNode; 1683 } else if (isTopLayer(currentNode)) { 1684 return null; 1685 } 1686 currentNode = getParentNode(currentNode); 1687 } 1688 return null; 1689 } 1690 function isWebKit() { 1691 if (isWebKitValue == null) { 1692 isWebKitValue = typeof CSS !== "undefined" && CSS.supports && CSS.supports("-webkit-backdrop-filter", "none"); 1693 } 1694 return isWebKitValue; 1695 } 1696 function isLastTraversableNode(node) { 1697 return /^(html|body|#document)$/.test(getNodeName(node)); 1698 } 1699 function getComputedStyle2(element) { 1700 return getWindow(element).getComputedStyle(element); 1701 } 1702 function getNodeScroll(element) { 1703 if (isElement(element)) { 1704 return { 1705 scrollLeft: element.scrollLeft, 1706 scrollTop: element.scrollTop 1707 }; 1708 } 1709 return { 1710 scrollLeft: element.scrollX, 1711 scrollTop: element.scrollY 1712 }; 1713 } 1714 function getParentNode(node) { 1715 if (getNodeName(node) === "html") { 1716 return node; 1717 } 1718 const result = ( 1719 // Step into the shadow DOM of the parent of a slotted node. 1720 node.assignedSlot || // DOM Element detected. 1721 node.parentNode || // ShadowRoot detected. 1722 isShadowRoot(node) && node.host || // Fallback. 1723 getDocumentElement(node) 1724 ); 1725 return isShadowRoot(result) ? result.host : result; 1726 } 1727 function getNearestOverflowAncestor(node) { 1728 const parentNode = getParentNode(node); 1729 if (isLastTraversableNode(parentNode)) { 1730 return node.ownerDocument ? node.ownerDocument.body : node.body; 1731 } 1732 if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) { 1733 return parentNode; 1734 } 1735 return getNearestOverflowAncestor(parentNode); 1736 } 1737 function getOverflowAncestors(node, list, traverseIframes) { 1738 var _node$ownerDocument2; 1739 if (list === void 0) { 1740 list = []; 1741 } 1742 if (traverseIframes === void 0) { 1743 traverseIframes = true; 1744 } 1745 const scrollableAncestor = getNearestOverflowAncestor(node); 1746 const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body); 1747 const win = getWindow(scrollableAncestor); 1748 if (isBody) { 1749 const frameElement = getFrameElement(win); 1750 return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], frameElement && traverseIframes ? getOverflowAncestors(frameElement) : []); 1751 } else { 1752 return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes)); 1753 } 1754 } 1755 function getFrameElement(win) { 1756 return win.parent && Object.getPrototypeOf(win.parent) ? win.frameElement : null; 1757 } 1758 1759 // node_modules/@base-ui/react/esm/internals/composite/root/CompositeRootContext.js 1760 var React16 = __toESM(require_react(), 1); 1761 var CompositeRootContext = /* @__PURE__ */ React16.createContext(void 0); 1762 if (true) CompositeRootContext.displayName = "CompositeRootContext"; 1763 function useCompositeRootContext(optional = false) { 1764 const context = React16.useContext(CompositeRootContext); 1765 if (context === void 0 && !optional) { 1766 throw new Error(true ? "Base UI: CompositeRootContext is missing. Composite parts must be placed within <Composite.Root>." : formatErrorMessage_default(16)); 1767 } 1768 return context; 1769 } 1770 1771 // node_modules/@base-ui/react/esm/utils/useFocusableWhenDisabled.js 1772 var React17 = __toESM(require_react(), 1); 1773 function useFocusableWhenDisabled(parameters) { 1774 const { 1775 focusableWhenDisabled, 1776 disabled: disabled2, 1777 composite = false, 1778 tabIndex: tabIndexProp = 0, 1779 isNativeButton 1780 } = parameters; 1781 const isFocusableComposite = composite && focusableWhenDisabled !== false; 1782 const isNonFocusableComposite = composite && focusableWhenDisabled === false; 1783 const props = React17.useMemo(() => { 1784 const additionalProps = { 1785 // allow Tabbing away from focusableWhenDisabled elements 1786 onKeyDown(event) { 1787 if (disabled2 && focusableWhenDisabled && event.key !== "Tab") { 1788 event.preventDefault(); 1789 } 1790 } 1791 }; 1792 if (!composite) { 1793 additionalProps.tabIndex = tabIndexProp; 1794 if (!isNativeButton && disabled2) { 1795 additionalProps.tabIndex = focusableWhenDisabled ? tabIndexProp : -1; 1796 } 1797 } 1798 if (isNativeButton && (focusableWhenDisabled || isFocusableComposite) || !isNativeButton && disabled2) { 1799 additionalProps["aria-disabled"] = disabled2; 1800 } 1801 if (isNativeButton && (!focusableWhenDisabled || isNonFocusableComposite)) { 1802 additionalProps.disabled = disabled2; 1803 } 1804 return additionalProps; 1805 }, [composite, disabled2, focusableWhenDisabled, isFocusableComposite, isNonFocusableComposite, isNativeButton, tabIndexProp]); 1806 return { 1807 props 1808 }; 1809 } 1810 1811 // node_modules/@base-ui/react/esm/internals/use-button/useButton.js 1812 function useButton(parameters = {}) { 1813 const { 1814 disabled: disabled2 = false, 1815 focusableWhenDisabled, 1816 tabIndex = 0, 1817 native: isNativeButton = true, 1818 composite: compositeProp 1819 } = parameters; 1820 const elementRef = React18.useRef(null); 1821 const compositeRootContext = useCompositeRootContext(true); 1822 const isCompositeItem = compositeProp ?? compositeRootContext !== void 0; 1823 const { 1824 props: focusableWhenDisabledProps 1825 } = useFocusableWhenDisabled({ 1826 focusableWhenDisabled, 1827 disabled: disabled2, 1828 composite: isCompositeItem, 1829 tabIndex, 1830 isNativeButton 1831 }); 1832 if (true) { 1833 React18.useEffect(() => { 1834 if (!elementRef.current) { 1835 return; 1836 } 1837 const isButtonTag = isButtonElement(elementRef.current); 1838 if (isNativeButton) { 1839 if (!isButtonTag) { 1840 const ownerStackMessage = SafeReact.captureOwnerStack?.() || ""; 1841 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`."; 1842 error(`$message2}$ownerStackMessage}`); 1843 } 1844 } else if (isButtonTag) { 1845 const ownerStackMessage = SafeReact.captureOwnerStack?.() || ""; 1846 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`."; 1847 error(`$message2}$ownerStackMessage}`); 1848 } 1849 }, [isNativeButton]); 1850 } 1851 const updateDisabled = React18.useCallback(() => { 1852 const element = elementRef.current; 1853 if (!isButtonElement(element)) { 1854 return; 1855 } 1856 if (isCompositeItem && disabled2 && focusableWhenDisabledProps.disabled === void 0 && element.disabled) { 1857 element.disabled = false; 1858 } 1859 }, [disabled2, focusableWhenDisabledProps.disabled, isCompositeItem]); 1860 useIsoLayoutEffect(updateDisabled, [updateDisabled]); 1861 const getButtonProps = React18.useCallback((externalProps = {}) => { 1862 const { 1863 onClick: externalOnClick, 1864 onMouseDown: externalOnMouseDown, 1865 onKeyUp: externalOnKeyUp, 1866 onKeyDown: externalOnKeyDown, 1867 onPointerDown: externalOnPointerDown, 1868 ...otherExternalProps 1869 } = externalProps; 1870 const type = isNativeButton ? "button" : void 0; 1871 return mergeProps({ 1872 type, 1873 onClick(event) { 1874 if (disabled2) { 1875 event.preventDefault(); 1876 return; 1877 } 1878 externalOnClick?.(event); 1879 }, 1880 onMouseDown(event) { 1881 if (!disabled2) { 1882 externalOnMouseDown?.(event); 1883 } 1884 }, 1885 onKeyDown(event) { 1886 if (disabled2) { 1887 return; 1888 } 1889 makeEventPreventable(event); 1890 externalOnKeyDown?.(event); 1891 if (event.baseUIHandlerPrevented) { 1892 return; 1893 } 1894 const isCurrentTarget = event.target === event.currentTarget; 1895 const currentTarget = event.currentTarget; 1896 const isButton = isButtonElement(currentTarget); 1897 const isLink = !isNativeButton && isValidLinkElement(currentTarget); 1898 const shouldClick = isCurrentTarget && (isNativeButton ? isButton : !isLink); 1899 const isEnterKey = event.key === "Enter"; 1900 const isSpaceKey = event.key === " "; 1901 const role = currentTarget.getAttribute("role"); 1902 const isTextNavigationRole = role?.startsWith("menuitem") || role === "option" || role === "gridcell"; 1903 if (isCurrentTarget && isCompositeItem && isSpaceKey) { 1904 if (event.defaultPrevented && isTextNavigationRole) { 1905 return; 1906 } 1907 event.preventDefault(); 1908 if (isLink || isNativeButton && isButton) { 1909 currentTarget.click(); 1910 event.preventBaseUIHandler(); 1911 } else if (shouldClick) { 1912 externalOnClick?.(event); 1913 event.preventBaseUIHandler(); 1914 } 1915 return; 1916 } 1917 if (shouldClick) { 1918 if (!isNativeButton && (isSpaceKey || isEnterKey)) { 1919 event.preventDefault(); 1920 } 1921 if (!isNativeButton && isEnterKey) { 1922 externalOnClick?.(event); 1923 } 1924 } 1925 }, 1926 onKeyUp(event) { 1927 if (disabled2) { 1928 return; 1929 } 1930 makeEventPreventable(event); 1931 externalOnKeyUp?.(event); 1932 if (event.target === event.currentTarget && isNativeButton && isCompositeItem && isButtonElement(event.currentTarget) && event.key === " ") { 1933 event.preventDefault(); 1934 return; 1935 } 1936 if (event.baseUIHandlerPrevented) { 1937 return; 1938 } 1939 if (event.target === event.currentTarget && !isNativeButton && !isCompositeItem && event.key === " ") { 1940 externalOnClick?.(event); 1941 } 1942 }, 1943 onPointerDown(event) { 1944 if (disabled2) { 1945 event.preventDefault(); 1946 return; 1947 } 1948 externalOnPointerDown?.(event); 1949 } 1950 }, !isNativeButton ? { 1951 role: "button" 1952 } : void 0, focusableWhenDisabledProps, otherExternalProps); 1953 }, [disabled2, focusableWhenDisabledProps, isCompositeItem, isNativeButton]); 1954 const buttonRef = useStableCallback((element) => { 1955 elementRef.current = element; 1956 updateDisabled(); 1957 }); 1958 return { 1959 getButtonProps, 1960 buttonRef 1961 }; 1962 } 1963 function isButtonElement(elem) { 1964 return isHTMLElement(elem) && elem.tagName === "BUTTON"; 1965 } 1966 function isValidLinkElement(elem) { 1967 return Boolean(elem?.tagName === "A" && elem?.href); 1968 } 1969 1970 // node_modules/@base-ui/utils/esm/detectBrowser.js 1971 var hasNavigator = typeof navigator !== "undefined"; 1972 var nav = getNavigatorData(); 1973 var platform = getPlatform(); 1974 var userAgent = getUserAgent(); 1975 var isWebKit2 = typeof CSS === "undefined" || !CSS.supports ? false : CSS.supports("-webkit-backdrop-filter:none"); 1976 var isIOS = ( 1977 // iPads can claim to be MacIntel 1978 nav.platform === "MacIntel" && nav.maxTouchPoints > 1 ? true : /iP(hone|ad|od)|iOS/.test(nav.platform) 1979 ); 1980 var isFirefox = hasNavigator && /firefox/i.test(userAgent); 1981 var isSafari = hasNavigator && /apple/i.test(navigator.vendor); 1982 var isEdge = hasNavigator && /Edg/i.test(userAgent); 1983 var isAndroid = hasNavigator && /android/i.test(platform) || /android/i.test(userAgent); 1984 var isMac = hasNavigator && platform.toLowerCase().startsWith("mac") && !navigator.maxTouchPoints; 1985 var isJSDOM = userAgent.includes("jsdom/"); 1986 function getNavigatorData() { 1987 if (!hasNavigator) { 1988 return { 1989 platform: "", 1990 maxTouchPoints: -1 1991 }; 1992 } 1993 const uaData = navigator.userAgentData; 1994 if (uaData?.platform) { 1995 return { 1996 platform: uaData.platform, 1997 maxTouchPoints: navigator.maxTouchPoints 1998 }; 1999 } 2000 return { 2001 platform: navigator.platform ?? "", 2002 maxTouchPoints: navigator.maxTouchPoints ?? -1 2003 }; 2004 } 2005 function getUserAgent() { 2006 if (!hasNavigator) { 2007 return ""; 2008 } 2009 const uaData = navigator.userAgentData; 2010 if (uaData && Array.isArray(uaData.brands)) { 2011 return uaData.brands.map(({ 2012 brand, 2013 version: version2 2014 }) => `$brand}/$version2}`).join(" "); 2015 } 2016 return navigator.userAgent; 2017 } 2018 function getPlatform() { 2019 if (!hasNavigator) { 2020 return ""; 2021 } 2022 const uaData = navigator.userAgentData; 2023 if (uaData?.platform) { 2024 return uaData.platform; 2025 } 2026 return navigator.platform ?? ""; 2027 } 2028 2029 // node_modules/@base-ui/react/esm/floating-ui-react/utils/constants.js 2030 var FOCUSABLE_ATTRIBUTE = "data-base-ui-focusable"; 2031 var ACTIVE_KEY = "active"; 2032 var SELECTED_KEY = "selected"; 2033 var TYPEABLE_SELECTOR = "input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])"; 2034 2035 // node_modules/@base-ui/react/esm/internals/shadowDom.js 2036 function activeElement(doc) { 2037 let element = doc.activeElement; 2038 while (element?.shadowRoot?.activeElement != null) { 2039 element = element.shadowRoot.activeElement; 2040 } 2041 return element; 2042 } 2043 function contains(parent, child) { 2044 if (!parent || !child) { 2045 return false; 2046 } 2047 const rootNode = child.getRootNode?.(); 2048 if (parent.contains(child)) { 2049 return true; 2050 } 2051 if (rootNode && isShadowRoot(rootNode)) { 2052 let next = child; 2053 while (next) { 2054 if (parent === next) { 2055 return true; 2056 } 2057 next = next.parentNode || next.host; 2058 } 2059 } 2060 return false; 2061 } 2062 function getTarget(event) { 2063 if ("composedPath" in event) { 2064 return event.composedPath()[0]; 2065 } 2066 return event.target; 2067 } 2068 2069 // node_modules/@base-ui/react/esm/floating-ui-react/utils/element.js 2070 function isTargetInsideEnabledTrigger(target, triggerElements) { 2071 if (!isElement(target)) { 2072 return false; 2073 } 2074 const targetElement = target; 2075 if (triggerElements.hasElement(targetElement)) { 2076 return !targetElement.hasAttribute("data-trigger-disabled"); 2077 } 2078 for (const [, trigger] of triggerElements.entries()) { 2079 if (contains(trigger, targetElement)) { 2080 return !trigger.hasAttribute("data-trigger-disabled"); 2081 } 2082 } 2083 return false; 2084 } 2085 function isEventTargetWithin(event, node) { 2086 if (node == null) { 2087 return false; 2088 } 2089 if ("composedPath" in event) { 2090 return event.composedPath().includes(node); 2091 } 2092 const eventAgain = event; 2093 return eventAgain.target != null && node.contains(eventAgain.target); 2094 } 2095 function isRootElement(element) { 2096 return element.matches("html,body"); 2097 } 2098 function isTypeableElement(element) { 2099 return isHTMLElement(element) && element.matches(TYPEABLE_SELECTOR); 2100 } 2101 function isInteractiveElement(element) { 2102 return element?.closest(`button,a[href],[role="button"],select,[tabindex]:not([tabindex="-1"]),$TYPEABLE_SELECTOR}`) != null; 2103 } 2104 function matchesFocusVisible(element) { 2105 if (!element || isJSDOM) { 2106 return true; 2107 } 2108 try { 2109 return element.matches(":focus-visible"); 2110 } catch (_e) { 2111 return true; 2112 } 2113 } 2114 2115 // node_modules/@base-ui/react/esm/floating-ui-react/utils/nodes.js 2116 function getNodeChildren(nodes, id, onlyOpenChildren = true) { 2117 const directChildren = nodes.filter((node) => node.parentId === id); 2118 return directChildren.flatMap((child) => [...!onlyOpenChildren || child.context?.open ? [child] : [], ...getNodeChildren(nodes, child.id, onlyOpenChildren)]); 2119 } 2120 2121 // node_modules/@base-ui/react/esm/floating-ui-react/utils/event.js 2122 function isReactEvent(event) { 2123 return "nativeEvent" in event; 2124 } 2125 function isMouseLikePointerType(pointerType, strict) { 2126 const values = ["mouse", "pen"]; 2127 if (!strict) { 2128 values.push("", void 0); 2129 } 2130 return values.includes(pointerType); 2131 } 2132 function isClickLikeEvent(event) { 2133 const type = event.type; 2134 return type === "click" || type === "mousedown" || type === "keydown" || type === "keyup"; 2135 } 2136 2137 // node_modules/@floating-ui/utils/dist/floating-ui.utils.mjs 2138 var sides = ["top", "right", "bottom", "left"]; 2139 var min = Math.min; 2140 var max = Math.max; 2141 var round = Math.round; 2142 var floor = Math.floor; 2143 var createCoords = (v2) => ({ 2144 x: v2, 2145 y: v2 2146 }); 2147 var oppositeSideMap = { 2148 left: "right", 2149 right: "left", 2150 bottom: "top", 2151 top: "bottom" 2152 }; 2153 function clamp(start, value, end) { 2154 return max(start, min(value, end)); 2155 } 2156 function evaluate(value, param) { 2157 return typeof value === "function" ? value(param) : value; 2158 } 2159 function getSide(placement) { 2160 return placement.split("-")[0]; 2161 } 2162 function getAlignment(placement) { 2163 return placement.split("-")[1]; 2164 } 2165 function getOppositeAxis(axis) { 2166 return axis === "x" ? "y" : "x"; 2167 } 2168 function getAxisLength(axis) { 2169 return axis === "y" ? "height" : "width"; 2170 } 2171 function getSideAxis(placement) { 2172 const firstChar = placement[0]; 2173 return firstChar === "t" || firstChar === "b" ? "y" : "x"; 2174 } 2175 function getAlignmentAxis(placement) { 2176 return getOppositeAxis(getSideAxis(placement)); 2177 } 2178 function getAlignmentSides(placement, rects, rtl) { 2179 if (rtl === void 0) { 2180 rtl = false; 2181 } 2182 const alignment = getAlignment(placement); 2183 const alignmentAxis = getAlignmentAxis(placement); 2184 const length = getAxisLength(alignmentAxis); 2185 let mainAlignmentSide = alignmentAxis === "x" ? alignment === (rtl ? "end" : "start") ? "right" : "left" : alignment === "start" ? "bottom" : "top"; 2186 if (rects.reference[length] > rects.floating[length]) { 2187 mainAlignmentSide = getOppositePlacement(mainAlignmentSide); 2188 } 2189 return [mainAlignmentSide, getOppositePlacement(mainAlignmentSide)]; 2190 } 2191 function getExpandedPlacements(placement) { 2192 const oppositePlacement = getOppositePlacement(placement); 2193 return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)]; 2194 } 2195 function getOppositeAlignmentPlacement(placement) { 2196 return placement.includes("start") ? placement.replace("start", "end") : placement.replace("end", "start"); 2197 } 2198 var lrPlacement = ["left", "right"]; 2199 var rlPlacement = ["right", "left"]; 2200 var tbPlacement = ["top", "bottom"]; 2201 var btPlacement = ["bottom", "top"]; 2202 function getSideList(side, isStart, rtl) { 2203 switch (side) { 2204 case "top": 2205 case "bottom": 2206 if (rtl) return isStart ? rlPlacement : lrPlacement; 2207 return isStart ? lrPlacement : rlPlacement; 2208 case "left": 2209 case "right": 2210 return isStart ? tbPlacement : btPlacement; 2211 default: 2212 return []; 2213 } 2214 } 2215 function getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) { 2216 const alignment = getAlignment(placement); 2217 let list = getSideList(getSide(placement), direction === "start", rtl); 2218 if (alignment) { 2219 list = list.map((side) => side + "-" + alignment); 2220 if (flipAlignment) { 2221 list = list.concat(list.map(getOppositeAlignmentPlacement)); 2222 } 2223 } 2224 return list; 2225 } 2226 function getOppositePlacement(placement) { 2227 const side = getSide(placement); 2228 return oppositeSideMap[side] + placement.slice(side.length); 2229 } 2230 function expandPaddingObject(padding) { 2231 return { 2232 top: 0, 2233 right: 0, 2234 bottom: 0, 2235 left: 0, 2236 ...padding 2237 }; 2238 } 2239 function getPaddingObject(padding) { 2240 return typeof padding !== "number" ? expandPaddingObject(padding) : { 2241 top: padding, 2242 right: padding, 2243 bottom: padding, 2244 left: padding 2245 }; 2246 } 2247 function rectToClientRect(rect) { 2248 const { 2249 x: x2, 2250 y: y2, 2251 width, 2252 height 2253 } = rect; 2254 return { 2255 width, 2256 height, 2257 top: y2, 2258 left: x2, 2259 right: x2 + width, 2260 bottom: y2 + height, 2261 x: x2, 2262 y: y2 2263 }; 2264 } 2265 2266 // node_modules/@base-ui/react/esm/floating-ui-react/utils/composite.js 2267 function isHiddenByStyles(styles) { 2268 return styles.visibility === "hidden" || styles.visibility === "collapse"; 2269 } 2270 function isElementVisible(element, styles = element ? getComputedStyle2(element) : null) { 2271 if (!element || !element.isConnected || !styles || isHiddenByStyles(styles)) { 2272 return false; 2273 } 2274 if (typeof element.checkVisibility === "function") { 2275 return element.checkVisibility(); 2276 } 2277 return styles.display !== "none" && styles.display !== "contents"; 2278 } 2279 2280 // node_modules/@base-ui/utils/esm/owner.js 2281 function ownerDocument(node) { 2282 return node?.ownerDocument || document; 2283 } 2284 2285 // node_modules/@base-ui/react/esm/floating-ui-react/utils/tabbable.js 2286 var CANDIDATE_SELECTOR = 'a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable="false"]),audio[controls],video[controls]'; 2287 function getParentElement(element) { 2288 const assignedSlot = element.assignedSlot; 2289 if (assignedSlot) { 2290 return assignedSlot; 2291 } 2292 if (element.parentElement) { 2293 return element.parentElement; 2294 } 2295 const rootNode = element.getRootNode(); 2296 return isShadowRoot(rootNode) ? rootNode.host : null; 2297 } 2298 function getDetailsSummary(details) { 2299 for (const child of Array.from(details.children)) { 2300 if (getNodeName(child) === "summary") { 2301 return child; 2302 } 2303 } 2304 return null; 2305 } 2306 function isWithinOpenDetailsSummary(element, details) { 2307 const summary = getDetailsSummary(details); 2308 return !!summary && (element === summary || contains(summary, element)); 2309 } 2310 function isFocusableCandidate(element) { 2311 const nodeName = element ? getNodeName(element) : ""; 2312 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"); 2313 } 2314 function isFocusableElement(element) { 2315 if (!isFocusableCandidate(element) || !element.isConnected || element.matches(":disabled")) { 2316 return false; 2317 } 2318 for (let current = element; current; current = getParentElement(current)) { 2319 const isAncestor = current !== element; 2320 const isSlot = getNodeName(current) === "slot"; 2321 if (current.hasAttribute("inert")) { 2322 return false; 2323 } 2324 if (isAncestor && getNodeName(current) === "details" && !current.open && !isWithinOpenDetailsSummary(element, current) || current.hasAttribute("hidden") || !isSlot && !isVisibleInTabbableTree(current, isAncestor)) { 2325 return false; 2326 } 2327 } 2328 return true; 2329 } 2330 function isVisibleInTabbableTree(element, isAncestor) { 2331 const styles = getComputedStyle2(element); 2332 if (!isAncestor) { 2333 return isElementVisible(element, styles); 2334 } 2335 return styles.display !== "none"; 2336 } 2337 function getTabIndex(element) { 2338 const tabIndex = element.tabIndex; 2339 if (tabIndex < 0) { 2340 const nodeName = getNodeName(element); 2341 if (nodeName === "details" || nodeName === "audio" || nodeName === "video" || isHTMLElement(element) && element.isContentEditable) { 2342 return 0; 2343 } 2344 } 2345 return tabIndex; 2346 } 2347 function getNamedRadioInput(element) { 2348 if (getNodeName(element) !== "input") { 2349 return null; 2350 } 2351 const input = element; 2352 return input.type === "radio" && input.name !== "" ? input : null; 2353 } 2354 function isTabbableRadio(element, candidates) { 2355 const input = getNamedRadioInput(element); 2356 if (!input) { 2357 return true; 2358 } 2359 const checkedRadio = candidates.find((candidate) => { 2360 const radio = getNamedRadioInput(candidate); 2361 return radio?.name === input.name && radio.form === input.form && radio.checked; 2362 }); 2363 if (checkedRadio) { 2364 return checkedRadio === input; 2365 } 2366 return candidates.find((candidate) => { 2367 const radio = getNamedRadioInput(candidate); 2368 return radio?.name === input.name && radio.form === input.form; 2369 }) === input; 2370 } 2371 function getComposedChildren(container) { 2372 if (isHTMLElement(container) && getNodeName(container) === "slot") { 2373 const assignedElements = container.assignedElements({ 2374 flatten: true 2375 }); 2376 if (assignedElements.length > 0) { 2377 return assignedElements; 2378 } 2379 } 2380 if (isHTMLElement(container) && container.shadowRoot) { 2381 return Array.from(container.shadowRoot.children); 2382 } 2383 return Array.from(container.children); 2384 } 2385 function appendCandidates(container, list) { 2386 getComposedChildren(container).forEach((child) => { 2387 if (isFocusableCandidate(child)) { 2388 list.push(child); 2389 } 2390 appendCandidates(child, list); 2391 }); 2392 } 2393 function appendMatchingElements(container, selector, list) { 2394 getComposedChildren(container).forEach((child) => { 2395 if (isHTMLElement(child) && child.matches(selector)) { 2396 list.push(child); 2397 } 2398 appendMatchingElements(child, selector, list); 2399 }); 2400 } 2401 function focusable(container) { 2402 const candidates = []; 2403 appendCandidates(container, candidates); 2404 return candidates.filter(isFocusableElement); 2405 } 2406 function tabbable(container) { 2407 const candidates = focusable(container); 2408 return candidates.filter((element) => getTabIndex(element) >= 0 && isTabbableRadio(element, candidates)); 2409 } 2410 function getTabbableIn(container, dir) { 2411 const list = tabbable(container); 2412 const len = list.length; 2413 if (len === 0) { 2414 return void 0; 2415 } 2416 const active = activeElement(ownerDocument(container)); 2417 const index2 = list.indexOf(active); 2418 const nextIndex = index2 === -1 ? dir === 1 ? 0 : len - 1 : index2 + dir; 2419 return list[nextIndex]; 2420 } 2421 function getNextTabbable(referenceElement) { 2422 return getTabbableIn(ownerDocument(referenceElement).body, 1) || referenceElement; 2423 } 2424 function getPreviousTabbable(referenceElement) { 2425 return getTabbableIn(ownerDocument(referenceElement).body, -1) || referenceElement; 2426 } 2427 function isOutsideEvent(event, container) { 2428 const containerElement = container || event.currentTarget; 2429 const relatedTarget = event.relatedTarget; 2430 return !relatedTarget || !contains(containerElement, relatedTarget); 2431 } 2432 function disableFocusInside(container) { 2433 const tabbableElements = tabbable(container); 2434 tabbableElements.forEach((element) => { 2435 element.dataset.tabindex = element.getAttribute("tabindex") || ""; 2436 element.setAttribute("tabindex", "-1"); 2437 }); 2438 } 2439 function enableFocusInside(container) { 2440 const elements = []; 2441 appendMatchingElements(container, "[data-tabindex]", elements); 2442 elements.forEach((element) => { 2443 const tabindex = element.dataset.tabindex; 2444 delete element.dataset.tabindex; 2445 if (tabindex) { 2446 element.setAttribute("tabindex", tabindex); 2447 } else { 2448 element.removeAttribute("tabindex"); 2449 } 2450 }); 2451 } 2452 2453 // node_modules/@base-ui/react/esm/collapsible/panel/useCollapsiblePanel.js 2454 var React19 = __toESM(require_react(), 1); 2455 2456 // node_modules/@base-ui/utils/esm/addEventListener.js 2457 function addEventListener(target, type, listener, options) { 2458 target.addEventListener(type, listener, options); 2459 return () => { 2460 target.removeEventListener(type, listener, options); 2461 }; 2462 } 2463 2464 // node_modules/@base-ui/react/esm/accordion/root/AccordionRootDataAttributes.js 2465 var AccordionRootDataAttributes = /* @__PURE__ */ (function(AccordionRootDataAttributes2) { 2466 AccordionRootDataAttributes2["disabled"] = "data-disabled"; 2467 AccordionRootDataAttributes2["orientation"] = "data-orientation"; 2468 return AccordionRootDataAttributes2; 2469 })({}); 2470 2471 // node_modules/@base-ui/react/esm/collapsible/panel/useCollapsiblePanel.js 2472 function useCollapsiblePanel(parameters) { 2473 const { 2474 abortControllerRef, 2475 animationTypeRef, 2476 externalRef, 2477 height, 2478 hiddenUntilFound, 2479 keepMounted, 2480 id: idParam, 2481 mounted, 2482 onOpenChange, 2483 open, 2484 panelRef, 2485 runOnceAnimationsFinish, 2486 setDimensions, 2487 setMounted, 2488 setOpen, 2489 setVisible, 2490 transitionDimensionRef, 2491 visible, 2492 width 2493 } = parameters; 2494 const isBeforeMatchRef = React19.useRef(false); 2495 const latestAnimationNameRef = React19.useRef(null); 2496 const shouldCancelInitialOpenAnimationRef = React19.useRef(open); 2497 const shouldCancelInitialOpenTransitionRef = React19.useRef(open); 2498 const endingStyleFrame = useAnimationFrame(); 2499 const hidden = React19.useMemo(() => { 2500 if (animationTypeRef.current === "css-animation") { 2501 return !visible; 2502 } 2503 return !open && !mounted; 2504 }, [open, mounted, visible, animationTypeRef]); 2505 const handlePanelRef = useStableCallback((element) => { 2506 if (!element) { 2507 return void 0; 2508 } 2509 if (animationTypeRef.current == null || transitionDimensionRef.current == null) { 2510 const panelStyles = getComputedStyle(element); 2511 const hasAnimation = panelStyles.animationName !== "none" && panelStyles.animationName !== ""; 2512 const hasTransition = panelStyles.transitionDuration !== "0s" && panelStyles.transitionDuration !== ""; 2513 if (hasAnimation && hasTransition) { 2514 if (true) { 2515 warn("CSS transitions and CSS animations both detected on Collapsible or Accordion panel.", "Only one of either animation type should be used."); 2516 } 2517 } else if (panelStyles.animationName === "none" && panelStyles.transitionDuration !== "0s") { 2518 animationTypeRef.current = "css-transition"; 2519 } else if (panelStyles.animationName !== "none" && panelStyles.transitionDuration === "0s") { 2520 animationTypeRef.current = "css-animation"; 2521 } else { 2522 animationTypeRef.current = "none"; 2523 } 2524 if (element.getAttribute(AccordionRootDataAttributes.orientation) === "horizontal" || panelStyles.transitionProperty.indexOf("width") > -1) { 2525 transitionDimensionRef.current = "width"; 2526 } else { 2527 transitionDimensionRef.current = "height"; 2528 } 2529 } 2530 if (animationTypeRef.current !== "css-transition") { 2531 return void 0; 2532 } 2533 if (height === void 0 || width === void 0) { 2534 setDimensions({ 2535 height: element.scrollHeight, 2536 width: element.scrollWidth 2537 }); 2538 if (shouldCancelInitialOpenTransitionRef.current) { 2539 element.style.setProperty("transition-duration", "0s"); 2540 } 2541 } 2542 let frame = -1; 2543 let nextFrame = -1; 2544 frame = AnimationFrame.request(() => { 2545 shouldCancelInitialOpenTransitionRef.current = false; 2546 nextFrame = AnimationFrame.request(() => { 2547 setTimeout(() => { 2548 element.style.removeProperty("transition-duration"); 2549 }); 2550 }); 2551 }); 2552 return () => { 2553 AnimationFrame.cancel(frame); 2554 AnimationFrame.cancel(nextFrame); 2555 }; 2556 }); 2557 const mergedPanelRef = useMergedRefs(externalRef, panelRef, handlePanelRef); 2558 useIsoLayoutEffect(() => { 2559 if (animationTypeRef.current !== "css-transition") { 2560 return void 0; 2561 } 2562 const panel = panelRef.current; 2563 if (!panel) { 2564 return void 0; 2565 } 2566 let resizeFrame = -1; 2567 if (abortControllerRef.current != null) { 2568 abortControllerRef.current.abort(); 2569 abortControllerRef.current = null; 2570 } 2571 if (open) { 2572 const originalLayoutStyles = { 2573 "justify-content": panel.style.justifyContent, 2574 "align-items": panel.style.alignItems, 2575 "align-content": panel.style.alignContent, 2576 "justify-items": panel.style.justifyItems 2577 }; 2578 Object.keys(originalLayoutStyles).forEach((key) => { 2579 panel.style.setProperty(key, "initial", "important"); 2580 }); 2581 if (!shouldCancelInitialOpenTransitionRef.current && !keepMounted) { 2582 panel.setAttribute(CollapsiblePanelDataAttributes.startingStyle, ""); 2583 } 2584 setDimensions({ 2585 height: panel.scrollHeight, 2586 width: panel.scrollWidth 2587 }); 2588 resizeFrame = AnimationFrame.request(() => { 2589 Object.entries(originalLayoutStyles).forEach(([key, value]) => { 2590 if (value === "") { 2591 panel.style.removeProperty(key); 2592 } else { 2593 panel.style.setProperty(key, value); 2594 } 2595 }); 2596 }); 2597 } else { 2598 if (panel.scrollHeight === 0 && panel.scrollWidth === 0) { 2599 return void 0; 2600 } 2601 setDimensions({ 2602 height: panel.scrollHeight, 2603 width: panel.scrollWidth 2604 }); 2605 const abortController = new AbortController(); 2606 abortControllerRef.current = abortController; 2607 const signal = abortController.signal; 2608 let attributeObserver = null; 2609 const endingStyleAttribute = CollapsiblePanelDataAttributes.endingStyle; 2610 attributeObserver = new MutationObserver((mutationList) => { 2611 const hasEndingStyle = mutationList.some((mutation) => mutation.type === "attributes" && mutation.attributeName === endingStyleAttribute); 2612 if (hasEndingStyle) { 2613 attributeObserver?.disconnect(); 2614 attributeObserver = null; 2615 runOnceAnimationsFinish(() => { 2616 setDimensions({ 2617 height: 0, 2618 width: 0 2619 }); 2620 panel.style.removeProperty("content-visibility"); 2621 setMounted(false); 2622 if (abortControllerRef.current === abortController) { 2623 abortControllerRef.current = null; 2624 } 2625 }, signal); 2626 } 2627 }); 2628 attributeObserver.observe(panel, { 2629 attributes: true, 2630 attributeFilter: [endingStyleAttribute] 2631 }); 2632 return () => { 2633 attributeObserver?.disconnect(); 2634 endingStyleFrame.cancel(); 2635 if (abortControllerRef.current === abortController) { 2636 abortController.abort(); 2637 abortControllerRef.current = null; 2638 } 2639 }; 2640 } 2641 return () => { 2642 AnimationFrame.cancel(resizeFrame); 2643 }; 2644 }, [abortControllerRef, animationTypeRef, endingStyleFrame, hiddenUntilFound, keepMounted, mounted, open, panelRef, runOnceAnimationsFinish, setDimensions, setMounted]); 2645 useIsoLayoutEffect(() => { 2646 if (animationTypeRef.current !== "css-animation") { 2647 return; 2648 } 2649 const panel = panelRef.current; 2650 if (!panel) { 2651 return; 2652 } 2653 latestAnimationNameRef.current = panel.style.animationName || latestAnimationNameRef.current; 2654 panel.style.setProperty("animation-name", "none"); 2655 setDimensions({ 2656 height: panel.scrollHeight, 2657 width: panel.scrollWidth 2658 }); 2659 if (!shouldCancelInitialOpenAnimationRef.current && !isBeforeMatchRef.current) { 2660 panel.style.removeProperty("animation-name"); 2661 } 2662 if (open) { 2663 if (abortControllerRef.current != null) { 2664 abortControllerRef.current.abort(); 2665 abortControllerRef.current = null; 2666 } 2667 setMounted(true); 2668 setVisible(true); 2669 } else { 2670 abortControllerRef.current = new AbortController(); 2671 runOnceAnimationsFinish(() => { 2672 setMounted(false); 2673 setVisible(false); 2674 abortControllerRef.current = null; 2675 }, abortControllerRef.current.signal); 2676 } 2677 }, [abortControllerRef, animationTypeRef, open, panelRef, runOnceAnimationsFinish, setDimensions, setMounted, setVisible, visible]); 2678 useOnMount(() => { 2679 const frame = AnimationFrame.request(() => { 2680 shouldCancelInitialOpenAnimationRef.current = false; 2681 }); 2682 return () => AnimationFrame.cancel(frame); 2683 }); 2684 useIsoLayoutEffect(() => { 2685 if (!hiddenUntilFound) { 2686 return void 0; 2687 } 2688 const panel = panelRef.current; 2689 if (!panel) { 2690 return void 0; 2691 } 2692 let frame = -1; 2693 let nextFrame = -1; 2694 if (open && isBeforeMatchRef.current) { 2695 panel.style.transitionDuration = "0s"; 2696 setDimensions({ 2697 height: panel.scrollHeight, 2698 width: panel.scrollWidth 2699 }); 2700 frame = AnimationFrame.request(() => { 2701 isBeforeMatchRef.current = false; 2702 nextFrame = AnimationFrame.request(() => { 2703 setTimeout(() => { 2704 panel.style.removeProperty("transition-duration"); 2705 }); 2706 }); 2707 }); 2708 } 2709 return () => { 2710 AnimationFrame.cancel(frame); 2711 AnimationFrame.cancel(nextFrame); 2712 }; 2713 }, [hiddenUntilFound, open, panelRef, setDimensions]); 2714 useIsoLayoutEffect(() => { 2715 const panel = panelRef.current; 2716 if (panel && hiddenUntilFound && hidden) { 2717 panel.setAttribute("hidden", "until-found"); 2718 if (animationTypeRef.current === "css-transition") { 2719 panel.setAttribute(CollapsiblePanelDataAttributes.startingStyle, ""); 2720 } 2721 } 2722 }, [hiddenUntilFound, hidden, animationTypeRef, panelRef]); 2723 React19.useEffect(function registerBeforeMatchListener() { 2724 const panel = panelRef.current; 2725 if (!panel) { 2726 return void 0; 2727 } 2728 function handleBeforeMatch(event) { 2729 isBeforeMatchRef.current = true; 2730 setOpen(true); 2731 onOpenChange(true, createChangeEventDetails(reason_parts_exports.none, event)); 2732 } 2733 return addEventListener(panel, "beforematch", handleBeforeMatch); 2734 }, [onOpenChange, panelRef, setOpen]); 2735 return React19.useMemo(() => ({ 2736 props: { 2737 hidden, 2738 id: idParam, 2739 ref: mergedPanelRef 2740 } 2741 }), [hidden, idParam, mergedPanelRef]); 2742 } 2743 2744 // node_modules/@base-ui/react/esm/internals/useOpenChangeComplete.js 2745 var React20 = __toESM(require_react(), 1); 2746 function useOpenChangeComplete(parameters) { 2747 const { 2748 enabled = true, 2749 open, 2750 ref, 2751 onComplete: onCompleteParam 2752 } = parameters; 2753 const onComplete = useStableCallback(onCompleteParam); 2754 const runOnceAnimationsFinish = useAnimationsFinished(ref, open, false); 2755 React20.useEffect(() => { 2756 if (!enabled) { 2757 return void 0; 2758 } 2759 const abortController = new AbortController(); 2760 runOnceAnimationsFinish(onComplete, abortController.signal); 2761 return () => { 2762 abortController.abort(); 2763 }; 2764 }, [enabled, open, onComplete, runOnceAnimationsFinish]); 2765 } 2766 2767 // node_modules/@base-ui/utils/esm/useOnFirstRender.js 2768 var React21 = __toESM(require_react(), 1); 2769 function useOnFirstRender(fn) { 2770 const ref = React21.useRef(true); 2771 if (ref.current) { 2772 ref.current = false; 2773 fn(); 2774 } 2775 } 2776 2777 // node_modules/@base-ui/utils/esm/useTimeout.js 2778 var EMPTY3 = 0; 2779 var Timeout = class _Timeout { 2780 static create() { 2781 return new _Timeout(); 2782 } 2783 currentId = EMPTY3; 2784 /** 2785 * Executes `fn` after `delay`, clearing any previously scheduled call. 2786 */ 2787 start(delay, fn) { 2788 this.clear(); 2789 this.currentId = setTimeout(() => { 2790 this.currentId = EMPTY3; 2791 fn(); 2792 }, delay); 2793 } 2794 isStarted() { 2795 return this.currentId !== EMPTY3; 2796 } 2797 clear = () => { 2798 if (this.currentId !== EMPTY3) { 2799 clearTimeout(this.currentId); 2800 this.currentId = EMPTY3; 2801 } 2802 }; 2803 disposeEffect = () => { 2804 return this.clear; 2805 }; 2806 }; 2807 function useTimeout() { 2808 const timeout = useRefWithInit(Timeout.create).current; 2809 useOnMount(timeout.disposeEffect); 2810 return timeout; 2811 } 2812 2813 // node_modules/@base-ui/react/esm/floating-ui-react/components/FloatingDelayGroup.js 2814 var React22 = __toESM(require_react(), 1); 2815 2816 // node_modules/@base-ui/react/esm/floating-ui-react/hooks/useHoverShared.js 2817 function resolveValue(value, pointerType) { 2818 if (pointerType != null && !isMouseLikePointerType(pointerType)) { 2819 return 0; 2820 } 2821 if (typeof value === "function") { 2822 return value(); 2823 } 2824 return value; 2825 } 2826 function getDelay(value, prop, pointerType) { 2827 const result = resolveValue(value, pointerType); 2828 if (typeof result === "number") { 2829 return result; 2830 } 2831 return result?.[prop]; 2832 } 2833 function getRestMs(value) { 2834 if (typeof value === "function") { 2835 return value(); 2836 } 2837 return value; 2838 } 2839 function isClickLikeOpenEvent(openEventType, interactedInside) { 2840 return interactedInside || openEventType === "click" || openEventType === "mousedown"; 2841 } 2842 2843 // node_modules/@base-ui/react/esm/floating-ui-react/components/FloatingDelayGroup.js 2844 var import_jsx_runtime = __toESM(require_jsx_runtime(), 1); 2845 var FloatingDelayGroupContext = /* @__PURE__ */ React22.createContext({ 2846 hasProvider: false, 2847 timeoutMs: 0, 2848 delayRef: { 2849 current: 0 2850 }, 2851 initialDelayRef: { 2852 current: 0 2853 }, 2854 timeout: new Timeout(), 2855 currentIdRef: { 2856 current: null 2857 }, 2858 currentContextRef: { 2859 current: null 2860 } 2861 }); 2862 if (true) FloatingDelayGroupContext.displayName = "FloatingDelayGroupContext"; 2863 function FloatingDelayGroup(props) { 2864 const { 2865 children, 2866 delay, 2867 timeoutMs = 0 2868 } = props; 2869 const delayRef = React22.useRef(delay); 2870 const initialDelayRef = React22.useRef(delay); 2871 const currentIdRef = React22.useRef(null); 2872 const currentContextRef = React22.useRef(null); 2873 const timeout = useTimeout(); 2874 return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FloatingDelayGroupContext.Provider, { 2875 value: React22.useMemo(() => ({ 2876 hasProvider: true, 2877 delayRef, 2878 initialDelayRef, 2879 currentIdRef, 2880 timeoutMs, 2881 currentContextRef, 2882 timeout 2883 }), [timeoutMs, timeout]), 2884 children 2885 }); 2886 } 2887 function useDelayGroup(context, options = { 2888 open: false 2889 }) { 2890 const store = "rootStore" in context ? context.rootStore : context; 2891 const floatingId = store.useState("floatingId"); 2892 const { 2893 open 2894 } = options; 2895 const groupContext = React22.useContext(FloatingDelayGroupContext); 2896 const { 2897 currentIdRef, 2898 delayRef, 2899 timeoutMs, 2900 initialDelayRef, 2901 currentContextRef, 2902 hasProvider, 2903 timeout 2904 } = groupContext; 2905 const [isInstantPhase, setIsInstantPhase] = React22.useState(false); 2906 useIsoLayoutEffect(() => { 2907 function unset() { 2908 setIsInstantPhase(false); 2909 currentContextRef.current?.setIsInstantPhase(false); 2910 currentIdRef.current = null; 2911 currentContextRef.current = null; 2912 delayRef.current = initialDelayRef.current; 2913 } 2914 if (!currentIdRef.current) { 2915 return void 0; 2916 } 2917 if (!open && currentIdRef.current === floatingId) { 2918 setIsInstantPhase(false); 2919 if (timeoutMs) { 2920 const closingId = floatingId; 2921 timeout.start(timeoutMs, () => { 2922 if (store.select("open") || currentIdRef.current && currentIdRef.current !== closingId) { 2923 return; 2924 } 2925 unset(); 2926 }); 2927 return () => { 2928 timeout.clear(); 2929 }; 2930 } 2931 unset(); 2932 } 2933 return void 0; 2934 }, [open, floatingId, currentIdRef, delayRef, timeoutMs, initialDelayRef, currentContextRef, timeout, store]); 2935 useIsoLayoutEffect(() => { 2936 if (!open) { 2937 return; 2938 } 2939 const prevContext = currentContextRef.current; 2940 const prevId = currentIdRef.current; 2941 timeout.clear(); 2942 currentContextRef.current = { 2943 onOpenChange: store.setOpen, 2944 setIsInstantPhase 2945 }; 2946 currentIdRef.current = floatingId; 2947 delayRef.current = { 2948 open: 0, 2949 close: getDelay(initialDelayRef.current, "close") 2950 }; 2951 if (prevId !== null && prevId !== floatingId) { 2952 setIsInstantPhase(true); 2953 prevContext?.setIsInstantPhase(true); 2954 prevContext?.onOpenChange(false, createChangeEventDetails(reason_parts_exports.none)); 2955 } else { 2956 setIsInstantPhase(false); 2957 prevContext?.setIsInstantPhase(false); 2958 } 2959 }, [open, floatingId, store, currentIdRef, delayRef, timeoutMs, initialDelayRef, currentContextRef, timeout]); 2960 useIsoLayoutEffect(() => { 2961 return () => { 2962 currentContextRef.current = null; 2963 }; 2964 }, [currentContextRef]); 2965 return React22.useMemo(() => ({ 2966 hasProvider, 2967 delayRef, 2968 isInstantPhase 2969 }), [hasProvider, delayRef, isInstantPhase]); 2970 } 2971 2972 // node_modules/@base-ui/utils/esm/mergeCleanups.js 2973 function mergeCleanups(...cleanups) { 2974 return () => { 2975 for (let i2 = 0; i2 < cleanups.length; i2 += 1) { 2976 const cleanup = cleanups[i2]; 2977 if (cleanup) { 2978 cleanup(); 2979 } 2980 } 2981 }; 2982 } 2983 2984 // node_modules/@base-ui/utils/esm/useValueAsRef.js 2985 function useValueAsRef(value) { 2986 const latest = useRefWithInit(createLatestRef, value).current; 2987 latest.next = value; 2988 useIsoLayoutEffect(latest.effect); 2989 return latest; 2990 } 2991 function createLatestRef(value) { 2992 const latest = { 2993 current: value, 2994 next: value, 2995 effect: () => { 2996 latest.current = latest.next; 2997 } 2998 }; 2999 return latest; 3000 } 3001 3002 // node_modules/@base-ui/react/esm/utils/FocusGuard.js 3003 var React23 = __toESM(require_react(), 1); 3004 3005 // node_modules/@base-ui/utils/esm/visuallyHidden.js 3006 var visuallyHiddenBase = { 3007 clipPath: "inset(50%)", 3008 overflow: "hidden", 3009 whiteSpace: "nowrap", 3010 border: 0, 3011 padding: 0, 3012 width: 1, 3013 height: 1, 3014 margin: -1 3015 }; 3016 var visuallyHidden = { 3017 ...visuallyHiddenBase, 3018 position: "fixed", 3019 top: 0, 3020 left: 0 3021 }; 3022 var visuallyHiddenInput = { 3023 ...visuallyHiddenBase, 3024 position: "absolute" 3025 }; 3026 3027 // node_modules/@base-ui/react/esm/utils/FocusGuard.js 3028 var import_jsx_runtime2 = __toESM(require_jsx_runtime(), 1); 3029 var FocusGuard = /* @__PURE__ */ React23.forwardRef(function FocusGuard2(props, ref) { 3030 const [role, setRole] = React23.useState(); 3031 useIsoLayoutEffect(() => { 3032 if (isSafari) { 3033 setRole("button"); 3034 } 3035 }, []); 3036 const restProps = { 3037 tabIndex: 0, 3038 // Role is only for VoiceOver 3039 role 3040 }; 3041 return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { 3042 ...props, 3043 ref, 3044 style: visuallyHidden, 3045 "aria-hidden": role ? void 0 : true, 3046 ...restProps, 3047 "data-base-ui-focus-guard": "" 3048 }); 3049 }); 3050 if (true) FocusGuard.displayName = "FocusGuard"; 3051 3052 // node_modules/@base-ui/react/esm/floating-ui-react/utils/createAttribute.js 3053 function createAttribute(name) { 3054 return `data-base-ui-$name}`; 3055 } 3056 3057 // node_modules/@base-ui/react/esm/floating-ui-react/components/FloatingPortal.js 3058 var React24 = __toESM(require_react(), 1); 3059 var ReactDOM2 = __toESM(require_react_dom(), 1); 3060 3061 // node_modules/@base-ui/react/esm/internals/constants.js 3062 var DISABLED_TRANSITIONS_STYLE = { 3063 style: { 3064 transition: "none" 3065 } 3066 }; 3067 var BASE_UI_SWIPE_IGNORE_ATTRIBUTE = "data-base-ui-swipe-ignore"; 3068 var LEGACY_SWIPE_IGNORE_ATTRIBUTE = "data-swipe-ignore"; 3069 var BASE_UI_SWIPE_IGNORE_SELECTOR = `[$BASE_UI_SWIPE_IGNORE_ATTRIBUTE}]`; 3070 var LEGACY_SWIPE_IGNORE_SELECTOR = `[$LEGACY_SWIPE_IGNORE_ATTRIBUTE}]`; 3071 var POPUP_COLLISION_AVOIDANCE = { 3072 fallbackAxisSide: "end" 3073 }; 3074 var ownerVisuallyHidden = { 3075 clipPath: "inset(50%)", 3076 position: "fixed", 3077 top: 0, 3078 left: 0 3079 }; 3080 3081 // node_modules/@base-ui/react/esm/floating-ui-react/components/FloatingPortal.js 3082 var import_jsx_runtime3 = __toESM(require_jsx_runtime(), 1); 3083 var PortalContext = /* @__PURE__ */ React24.createContext(null); 3084 if (true) PortalContext.displayName = "PortalContext"; 3085 var usePortalContext = () => React24.useContext(PortalContext); 3086 var attr = createAttribute("portal"); 3087 function useFloatingPortalNode(props = {}) { 3088 const { 3089 ref, 3090 container: containerProp, 3091 componentProps = EMPTY_OBJECT, 3092 elementProps 3093 } = props; 3094 const uniqueId = useId(); 3095 const portalContext = usePortalContext(); 3096 const parentPortalNode = portalContext?.portalNode; 3097 const [containerElement, setContainerElement] = React24.useState(null); 3098 const [portalNode, setPortalNode] = React24.useState(null); 3099 const setPortalNodeRef = useStableCallback((node) => { 3100 if (node !== null) { 3101 setPortalNode(node); 3102 } 3103 }); 3104 const containerRef = React24.useRef(null); 3105 useIsoLayoutEffect(() => { 3106 if (containerProp === null) { 3107 if (containerRef.current) { 3108 containerRef.current = null; 3109 setPortalNode(null); 3110 setContainerElement(null); 3111 } 3112 return; 3113 } 3114 if (uniqueId == null) { 3115 return; 3116 } 3117 const resolvedContainer = (containerProp && (isNode(containerProp) ? containerProp : containerProp.current)) ?? parentPortalNode ?? document.body; 3118 if (resolvedContainer == null) { 3119 if (containerRef.current) { 3120 containerRef.current = null; 3121 setPortalNode(null); 3122 setContainerElement(null); 3123 } 3124 return; 3125 } 3126 if (containerRef.current !== resolvedContainer) { 3127 containerRef.current = resolvedContainer; 3128 setPortalNode(null); 3129 setContainerElement(resolvedContainer); 3130 } 3131 }, [containerProp, parentPortalNode, uniqueId]); 3132 const portalElement = useRenderElement("div", componentProps, { 3133 ref: [ref, setPortalNodeRef], 3134 props: [{ 3135 id: uniqueId, 3136 [attr]: "" 3137 }, elementProps] 3138 }); 3139 const portalSubtree = containerElement && portalElement ? /* @__PURE__ */ ReactDOM2.createPortal(portalElement, containerElement) : null; 3140 return { 3141 portalNode, 3142 portalSubtree 3143 }; 3144 } 3145 var FloatingPortal = /* @__PURE__ */ React24.forwardRef(function FloatingPortal2(componentProps, forwardedRef) { 3146 const { 3147 children, 3148 container, 3149 className, 3150 render: render4, 3151 renderGuards, 3152 style, 3153 ...elementProps 3154 } = componentProps; 3155 const { 3156 portalNode, 3157 portalSubtree 3158 } = useFloatingPortalNode({ 3159 container, 3160 ref: forwardedRef, 3161 componentProps, 3162 elementProps 3163 }); 3164 const beforeOutsideRef = React24.useRef(null); 3165 const afterOutsideRef = React24.useRef(null); 3166 const beforeInsideRef = React24.useRef(null); 3167 const afterInsideRef = React24.useRef(null); 3168 const [focusManagerState, setFocusManagerState] = React24.useState(null); 3169 const focusInsideDisabledRef = React24.useRef(false); 3170 const modal = focusManagerState?.modal; 3171 const open = focusManagerState?.open; 3172 const shouldRenderGuards = typeof renderGuards === "boolean" ? renderGuards : !!focusManagerState && !focusManagerState.modal && focusManagerState.open && !!portalNode; 3173 React24.useEffect(() => { 3174 if (!portalNode || modal) { 3175 return void 0; 3176 } 3177 function onFocus(event) { 3178 if (portalNode && event.relatedTarget && isOutsideEvent(event)) { 3179 if (event.type === "focusin") { 3180 if (focusInsideDisabledRef.current) { 3181 enableFocusInside(portalNode); 3182 focusInsideDisabledRef.current = false; 3183 } 3184 } else { 3185 disableFocusInside(portalNode); 3186 focusInsideDisabledRef.current = true; 3187 } 3188 } 3189 } 3190 return mergeCleanups(addEventListener(portalNode, "focusin", onFocus, true), addEventListener(portalNode, "focusout", onFocus, true)); 3191 }, [portalNode, modal]); 3192 React24.useEffect(() => { 3193 if (!portalNode || open !== false) { 3194 return; 3195 } 3196 enableFocusInside(portalNode); 3197 focusInsideDisabledRef.current = false; 3198 }, [open, portalNode]); 3199 const portalContextValue = React24.useMemo(() => ({ 3200 beforeOutsideRef, 3201 afterOutsideRef, 3202 beforeInsideRef, 3203 afterInsideRef, 3204 portalNode, 3205 setFocusManagerState 3206 }), [portalNode]); 3207 return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(React24.Fragment, { 3208 children: [portalSubtree, /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(PortalContext.Provider, { 3209 value: portalContextValue, 3210 children: [shouldRenderGuards && portalNode && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(FocusGuard, { 3211 "data-type": "outside", 3212 ref: beforeOutsideRef, 3213 onFocus: (event) => { 3214 if (isOutsideEvent(event, portalNode)) { 3215 beforeInsideRef.current?.focus(); 3216 } else { 3217 const domReference = focusManagerState ? focusManagerState.domReference : null; 3218 const prevTabbable = getPreviousTabbable(domReference); 3219 prevTabbable?.focus(); 3220 } 3221 } 3222 }), shouldRenderGuards && portalNode && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { 3223 "aria-owns": portalNode.id, 3224 style: ownerVisuallyHidden 3225 }), portalNode && /* @__PURE__ */ ReactDOM2.createPortal(children, portalNode), shouldRenderGuards && portalNode && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(FocusGuard, { 3226 "data-type": "outside", 3227 ref: afterOutsideRef, 3228 onFocus: (event) => { 3229 if (isOutsideEvent(event, portalNode)) { 3230 afterInsideRef.current?.focus(); 3231 } else { 3232 const domReference = focusManagerState ? focusManagerState.domReference : null; 3233 const nextTabbable = getNextTabbable(domReference); 3234 nextTabbable?.focus(); 3235 if (focusManagerState?.closeOnFocusOut) { 3236 focusManagerState?.onOpenChange(false, createChangeEventDetails(reason_parts_exports.focusOut, event.nativeEvent)); 3237 } 3238 } 3239 } 3240 })] 3241 })] 3242 }); 3243 }); 3244 if (true) FloatingPortal.displayName = "FloatingPortal"; 3245 3246 // node_modules/@base-ui/react/esm/floating-ui-react/components/FloatingTree.js 3247 var React25 = __toESM(require_react(), 1); 3248 3249 // node_modules/@base-ui/react/esm/floating-ui-react/utils/createEventEmitter.js 3250 function createEventEmitter() { 3251 const map = /* @__PURE__ */ new Map(); 3252 return { 3253 emit(event, data) { 3254 map.get(event)?.forEach((listener) => listener(data)); 3255 }, 3256 on(event, listener) { 3257 if (!map.has(event)) { 3258 map.set(event, /* @__PURE__ */ new Set()); 3259 } 3260 map.get(event).add(listener); 3261 }, 3262 off(event, listener) { 3263 map.get(event)?.delete(listener); 3264 } 3265 }; 3266 } 3267 3268 // node_modules/@base-ui/react/esm/floating-ui-react/components/FloatingTree.js 3269 var import_jsx_runtime4 = __toESM(require_jsx_runtime(), 1); 3270 var FloatingNodeContext = /* @__PURE__ */ React25.createContext(null); 3271 if (true) FloatingNodeContext.displayName = "FloatingNodeContext"; 3272 var FloatingTreeContext = /* @__PURE__ */ React25.createContext(null); 3273 if (true) FloatingTreeContext.displayName = "FloatingTreeContext"; 3274 var useFloatingParentNodeId = () => React25.useContext(FloatingNodeContext)?.id || null; 3275 var useFloatingTree = (externalTree) => { 3276 const contextTree = React25.useContext(FloatingTreeContext); 3277 return externalTree ?? contextTree; 3278 }; 3279 3280 // node_modules/@base-ui/react/esm/floating-ui-react/hooks/useClientPoint.js 3281 var React26 = __toESM(require_react(), 1); 3282 function createVirtualElement(domElement, data) { 3283 let offsetX = null; 3284 let offsetY = null; 3285 let isAutoUpdateEvent = false; 3286 return { 3287 contextElement: domElement || void 0, 3288 getBoundingClientRect() { 3289 const domRect = domElement?.getBoundingClientRect() || { 3290 width: 0, 3291 height: 0, 3292 x: 0, 3293 y: 0 3294 }; 3295 const isXAxis = data.axis === "x" || data.axis === "both"; 3296 const isYAxis = data.axis === "y" || data.axis === "both"; 3297 const canTrackCursorOnAutoUpdate = ["mouseenter", "mousemove"].includes(data.dataRef.current.openEvent?.type || "") && data.pointerType !== "touch"; 3298 let width = domRect.width; 3299 let height = domRect.height; 3300 let x2 = domRect.x; 3301 let y2 = domRect.y; 3302 if (offsetX == null && data.x && isXAxis) { 3303 offsetX = domRect.x - data.x; 3304 } 3305 if (offsetY == null && data.y && isYAxis) { 3306 offsetY = domRect.y - data.y; 3307 } 3308 x2 -= offsetX || 0; 3309 y2 -= offsetY || 0; 3310 width = 0; 3311 height = 0; 3312 if (!isAutoUpdateEvent || canTrackCursorOnAutoUpdate) { 3313 width = data.axis === "y" ? domRect.width : 0; 3314 height = data.axis === "x" ? domRect.height : 0; 3315 x2 = isXAxis && data.x != null ? data.x : x2; 3316 y2 = isYAxis && data.y != null ? data.y : y2; 3317 } else if (isAutoUpdateEvent && !canTrackCursorOnAutoUpdate) { 3318 height = data.axis === "x" ? domRect.height : height; 3319 width = data.axis === "y" ? domRect.width : width; 3320 } 3321 isAutoUpdateEvent = true; 3322 return { 3323 width, 3324 height, 3325 x: x2, 3326 y: y2, 3327 top: y2, 3328 right: x2 + width, 3329 bottom: y2 + height, 3330 left: x2 3331 }; 3332 } 3333 }; 3334 } 3335 function isMouseBasedEvent(event) { 3336 return event != null && event.clientX != null; 3337 } 3338 function useClientPoint(context, props = {}) { 3339 const store = "rootStore" in context ? context.rootStore : context; 3340 const open = store.useState("open"); 3341 const floating = store.useState("floatingElement"); 3342 const domReference = store.useState("domReferenceElement"); 3343 const dataRef = store.context.dataRef; 3344 const { 3345 enabled = true, 3346 axis = "both" 3347 } = props; 3348 const initialRef = React26.useRef(false); 3349 const cleanupListenerRef = React26.useRef(null); 3350 const [pointerType, setPointerType] = React26.useState(); 3351 const [reactive, setReactive] = React26.useState([]); 3352 const setReference = useStableCallback((newX, newY, referenceElement) => { 3353 if (initialRef.current) { 3354 return; 3355 } 3356 if (dataRef.current.openEvent && !isMouseBasedEvent(dataRef.current.openEvent)) { 3357 return; 3358 } 3359 store.set("positionReference", createVirtualElement(referenceElement ?? domReference, { 3360 x: newX, 3361 y: newY, 3362 axis, 3363 dataRef, 3364 pointerType 3365 })); 3366 }); 3367 const handleReferenceEnterOrMove = useStableCallback((event) => { 3368 if (!open) { 3369 setReference(event.clientX, event.clientY, event.currentTarget); 3370 } else if (!cleanupListenerRef.current) { 3371 setReactive([]); 3372 } 3373 }); 3374 const openCheck = isMouseLikePointerType(pointerType) ? floating : open; 3375 const addListener = React26.useCallback(() => { 3376 if (!openCheck || !enabled) { 3377 return void 0; 3378 } 3379 const win = getWindow(floating); 3380 function handleMouseMove(event) { 3381 const target = getTarget(event); 3382 if (!contains(floating, target)) { 3383 setReference(event.clientX, event.clientY); 3384 } else { 3385 cleanupListenerRef.current?.(); 3386 cleanupListenerRef.current = null; 3387 } 3388 } 3389 if (!dataRef.current.openEvent || isMouseBasedEvent(dataRef.current.openEvent)) { 3390 const cleanup = () => { 3391 cleanupListenerRef.current?.(); 3392 cleanupListenerRef.current = null; 3393 }; 3394 cleanupListenerRef.current = addEventListener(win, "mousemove", handleMouseMove); 3395 return cleanup; 3396 } 3397 store.set("positionReference", domReference); 3398 return void 0; 3399 }, [openCheck, enabled, floating, dataRef, domReference, store, setReference]); 3400 React26.useEffect(() => { 3401 return addListener(); 3402 }, [addListener, reactive]); 3403 React26.useEffect(() => { 3404 if (enabled && !floating) { 3405 initialRef.current = false; 3406 } 3407 }, [enabled, floating]); 3408 React26.useEffect(() => { 3409 if (!enabled && open) { 3410 initialRef.current = true; 3411 } 3412 }, [enabled, open]); 3413 const reference = React26.useMemo(() => { 3414 function setPointerTypeRef(event) { 3415 setPointerType(event.pointerType); 3416 } 3417 return { 3418 onPointerDown: setPointerTypeRef, 3419 onPointerEnter: setPointerTypeRef, 3420 onMouseMove: handleReferenceEnterOrMove, 3421 onMouseEnter: handleReferenceEnterOrMove 3422 }; 3423 }, [handleReferenceEnterOrMove]); 3424 return React26.useMemo(() => enabled ? { 3425 reference, 3426 trigger: reference 3427 } : {}, [enabled, reference]); 3428 } 3429 3430 // node_modules/@base-ui/react/esm/floating-ui-react/hooks/useDismiss.js 3431 var React27 = __toESM(require_react(), 1); 3432 var bubbleHandlerKeys = { 3433 intentional: "onClick", 3434 sloppy: "onPointerDown" 3435 }; 3436 function alwaysFalse() { 3437 return false; 3438 } 3439 function normalizeProp(normalizable) { 3440 return { 3441 escapeKey: typeof normalizable === "boolean" ? normalizable : normalizable?.escapeKey ?? false, 3442 outsidePress: typeof normalizable === "boolean" ? normalizable : normalizable?.outsidePress ?? true 3443 }; 3444 } 3445 function useDismiss(context, props = {}) { 3446 const store = "rootStore" in context ? context.rootStore : context; 3447 const open = store.useState("open"); 3448 const floatingElement = store.useState("floatingElement"); 3449 const { 3450 dataRef 3451 } = store.context; 3452 const { 3453 enabled = true, 3454 escapeKey: escapeKey2 = true, 3455 outsidePress: outsidePressProp = true, 3456 outsidePressEvent = "sloppy", 3457 referencePress = alwaysFalse, 3458 referencePressEvent = "sloppy", 3459 bubbles, 3460 externalTree 3461 } = props; 3462 const tree = useFloatingTree(externalTree); 3463 const outsidePressFn = useStableCallback(typeof outsidePressProp === "function" ? outsidePressProp : () => false); 3464 const outsidePress2 = typeof outsidePressProp === "function" ? outsidePressFn : outsidePressProp; 3465 const outsidePressEnabled = outsidePress2 !== false; 3466 const getOutsidePressEventProp = useStableCallback(() => outsidePressEvent); 3467 const pressStartedInsideRef = React27.useRef(false); 3468 const pressStartPreventedRef = React27.useRef(false); 3469 const suppressNextOutsideClickRef = React27.useRef(false); 3470 const { 3471 escapeKey: escapeKeyBubbles, 3472 outsidePress: outsidePressBubbles 3473 } = normalizeProp(bubbles); 3474 const touchStateRef = React27.useRef(null); 3475 const cancelDismissOnEndTimeout = useTimeout(); 3476 const clearInsideReactTreeTimeout = useTimeout(); 3477 const clearInsideReactTree = useStableCallback(() => { 3478 clearInsideReactTreeTimeout.clear(); 3479 dataRef.current.insideReactTree = false; 3480 }); 3481 const isComposingRef = React27.useRef(false); 3482 const currentPointerTypeRef = React27.useRef(""); 3483 const isReferencePressEnabled = useStableCallback(referencePress); 3484 const closeOnEscapeKeyDown = useStableCallback((event) => { 3485 if (!open || !enabled || !escapeKey2 || event.key !== "Escape") { 3486 return; 3487 } 3488 if (isComposingRef.current) { 3489 return; 3490 } 3491 const nodeId = dataRef.current.floatingContext?.nodeId; 3492 const children = tree ? getNodeChildren(tree.nodesRef.current, nodeId) : []; 3493 if (!escapeKeyBubbles) { 3494 if (children.length > 0) { 3495 let shouldDismiss = true; 3496 children.forEach((child) => { 3497 if (child.context?.open && !child.context.dataRef.current.__escapeKeyBubbles) { 3498 shouldDismiss = false; 3499 } 3500 }); 3501 if (!shouldDismiss) { 3502 return; 3503 } 3504 } 3505 } 3506 const native = isReactEvent(event) ? event.nativeEvent : event; 3507 const eventDetails = createChangeEventDetails(reason_parts_exports.escapeKey, native); 3508 store.setOpen(false, eventDetails); 3509 if (!escapeKeyBubbles && !eventDetails.isPropagationAllowed) { 3510 event.stopPropagation(); 3511 } 3512 }); 3513 const markInsideReactTree = useStableCallback(() => { 3514 dataRef.current.insideReactTree = true; 3515 clearInsideReactTreeTimeout.start(0, clearInsideReactTree); 3516 }); 3517 React27.useEffect(() => { 3518 if (!open || !enabled) { 3519 return void 0; 3520 } 3521 dataRef.current.__escapeKeyBubbles = escapeKeyBubbles; 3522 dataRef.current.__outsidePressBubbles = outsidePressBubbles; 3523 const compositionTimeout = new Timeout(); 3524 const preventedPressSuppressionTimeout = new Timeout(); 3525 function handleCompositionStart() { 3526 compositionTimeout.clear(); 3527 isComposingRef.current = true; 3528 } 3529 function handleCompositionEnd() { 3530 compositionTimeout.start( 3531 // 0ms or 1ms don't work in Safari. 5ms appears to consistently work. 3532 // Only apply to WebKit for the test to remain 0ms. 3533 isWebKit() ? 5 : 0, 3534 () => { 3535 isComposingRef.current = false; 3536 } 3537 ); 3538 } 3539 function suppressImmediateOutsideClickAfterPreventedStart() { 3540 suppressNextOutsideClickRef.current = true; 3541 preventedPressSuppressionTimeout.start(0, () => { 3542 suppressNextOutsideClickRef.current = false; 3543 }); 3544 } 3545 function resetPressStartState() { 3546 pressStartedInsideRef.current = false; 3547 pressStartPreventedRef.current = false; 3548 } 3549 function getOutsidePressEvent() { 3550 const type = currentPointerTypeRef.current; 3551 const computedType = type === "pen" || !type ? "mouse" : type; 3552 const outsidePressEventValue = getOutsidePressEventProp(); 3553 const resolved = typeof outsidePressEventValue === "function" ? outsidePressEventValue() : outsidePressEventValue; 3554 if (typeof resolved === "string") { 3555 return resolved; 3556 } 3557 return resolved[computedType]; 3558 } 3559 function shouldIgnoreEvent(event) { 3560 const computedOutsidePressEvent = getOutsidePressEvent(); 3561 return computedOutsidePressEvent === "intentional" && event.type !== "click" || computedOutsidePressEvent === "sloppy" && event.type === "click"; 3562 } 3563 function isEventWithinFloatingTree(event) { 3564 const nodeId = dataRef.current.floatingContext?.nodeId; 3565 const targetIsInsideChildren = tree && getNodeChildren(tree.nodesRef.current, nodeId).some((node) => isEventTargetWithin(event, node.context?.elements.floating)); 3566 return isEventTargetWithin(event, store.select("floatingElement")) || isEventTargetWithin(event, store.select("domReferenceElement")) || targetIsInsideChildren; 3567 } 3568 function closeOnPressOutside(event) { 3569 if (shouldIgnoreEvent(event)) { 3570 clearInsideReactTree(); 3571 return; 3572 } 3573 if (dataRef.current.insideReactTree) { 3574 clearInsideReactTree(); 3575 return; 3576 } 3577 const target = getTarget(event); 3578 const inertSelector = `[$createAttribute("inert")}]`; 3579 const targetRoot = isElement(target) ? target.getRootNode() : null; 3580 const markers = Array.from((isShadowRoot(targetRoot) ? targetRoot : ownerDocument(store.select("floatingElement"))).querySelectorAll(inertSelector)); 3581 const triggers = store.context.triggerElements; 3582 if (target && (triggers.hasElement(target) || triggers.hasMatchingElement((trigger) => contains(trigger, target)))) { 3583 return; 3584 } 3585 let targetRootAncestor = isElement(target) ? target : null; 3586 while (targetRootAncestor && !isLastTraversableNode(targetRootAncestor)) { 3587 const nextParent = getParentNode(targetRootAncestor); 3588 if (isLastTraversableNode(nextParent) || !isElement(nextParent)) { 3589 break; 3590 } 3591 targetRootAncestor = nextParent; 3592 } 3593 if (markers.length && isElement(target) && !isRootElement(target) && // Clicked on a direct ancestor (e.g. FloatingOverlay). 3594 !contains(target, store.select("floatingElement")) && // If the target root element contains none of the markers, then the 3595 // element was injected after the floating element rendered. 3596 markers.every((marker) => !contains(targetRootAncestor, marker))) { 3597 return; 3598 } 3599 if (isHTMLElement(target) && !("touches" in event)) { 3600 const lastTraversableNode = isLastTraversableNode(target); 3601 const style = getComputedStyle2(target); 3602 const scrollRe = /auto|scroll/; 3603 const isScrollableX = lastTraversableNode || scrollRe.test(style.overflowX); 3604 const isScrollableY = lastTraversableNode || scrollRe.test(style.overflowY); 3605 const canScrollX = isScrollableX && target.clientWidth > 0 && target.scrollWidth > target.clientWidth; 3606 const canScrollY = isScrollableY && target.clientHeight > 0 && target.scrollHeight > target.clientHeight; 3607 const isRTL2 = style.direction === "rtl"; 3608 const pressedVerticalScrollbar = canScrollY && (isRTL2 ? event.offsetX <= target.offsetWidth - target.clientWidth : event.offsetX > target.clientWidth); 3609 const pressedHorizontalScrollbar = canScrollX && event.offsetY > target.clientHeight; 3610 if (pressedVerticalScrollbar || pressedHorizontalScrollbar) { 3611 return; 3612 } 3613 } 3614 if (isEventWithinFloatingTree(event)) { 3615 return; 3616 } 3617 if (getOutsidePressEvent() === "intentional" && suppressNextOutsideClickRef.current) { 3618 preventedPressSuppressionTimeout.clear(); 3619 suppressNextOutsideClickRef.current = false; 3620 return; 3621 } 3622 if (typeof outsidePress2 === "function" && !outsidePress2(event)) { 3623 return; 3624 } 3625 const nodeId = dataRef.current.floatingContext?.nodeId; 3626 const children = tree ? getNodeChildren(tree.nodesRef.current, nodeId) : []; 3627 if (children.length > 0) { 3628 let shouldDismiss = true; 3629 children.forEach((child) => { 3630 if (child.context?.open && !child.context.dataRef.current.__outsidePressBubbles) { 3631 shouldDismiss = false; 3632 } 3633 }); 3634 if (!shouldDismiss) { 3635 return; 3636 } 3637 } 3638 store.setOpen(false, createChangeEventDetails(reason_parts_exports.outsidePress, event)); 3639 clearInsideReactTree(); 3640 } 3641 function handlePointerDown(event) { 3642 if (getOutsidePressEvent() !== "sloppy" || event.pointerType === "touch" || !store.select("open") || !enabled || isEventTargetWithin(event, store.select("floatingElement")) || isEventTargetWithin(event, store.select("domReferenceElement"))) { 3643 return; 3644 } 3645 closeOnPressOutside(event); 3646 } 3647 function handleTouchStart(event) { 3648 if (getOutsidePressEvent() !== "sloppy" || !store.select("open") || !enabled || isEventTargetWithin(event, store.select("floatingElement")) || isEventTargetWithin(event, store.select("domReferenceElement"))) { 3649 return; 3650 } 3651 const touch = event.touches[0]; 3652 if (touch) { 3653 touchStateRef.current = { 3654 startTime: Date.now(), 3655 startX: touch.clientX, 3656 startY: touch.clientY, 3657 dismissOnTouchEnd: false, 3658 dismissOnMouseDown: true 3659 }; 3660 cancelDismissOnEndTimeout.start(1e3, () => { 3661 if (touchStateRef.current) { 3662 touchStateRef.current.dismissOnTouchEnd = false; 3663 touchStateRef.current.dismissOnMouseDown = false; 3664 } 3665 }); 3666 } 3667 } 3668 function addTargetEventListenerOnce(event, listener) { 3669 const target = getTarget(event); 3670 if (!target) { 3671 return; 3672 } 3673 const unsubscribe2 = addEventListener(target, event.type, () => { 3674 listener(event); 3675 unsubscribe2(); 3676 }); 3677 } 3678 function handleTouchStartCapture(event) { 3679 currentPointerTypeRef.current = "touch"; 3680 addTargetEventListenerOnce(event, handleTouchStart); 3681 } 3682 function closeOnPressOutsideCapture(event) { 3683 cancelDismissOnEndTimeout.clear(); 3684 if (event.type === "pointerdown") { 3685 currentPointerTypeRef.current = event.pointerType; 3686 } 3687 if (event.type === "mousedown" && touchStateRef.current && !touchStateRef.current.dismissOnMouseDown) { 3688 return; 3689 } 3690 addTargetEventListenerOnce(event, (targetEvent) => { 3691 if (targetEvent.type === "pointerdown") { 3692 handlePointerDown(targetEvent); 3693 } else { 3694 closeOnPressOutside(targetEvent); 3695 } 3696 }); 3697 } 3698 function handlePressEndCapture(event) { 3699 if (!pressStartedInsideRef.current) { 3700 return; 3701 } 3702 const pressStartedInsideDefaultPrevented = pressStartPreventedRef.current; 3703 resetPressStartState(); 3704 if (getOutsidePressEvent() !== "intentional") { 3705 return; 3706 } 3707 if (event.type === "pointercancel") { 3708 if (pressStartedInsideDefaultPrevented) { 3709 suppressImmediateOutsideClickAfterPreventedStart(); 3710 } 3711 return; 3712 } 3713 if (isEventWithinFloatingTree(event)) { 3714 return; 3715 } 3716 if (pressStartedInsideDefaultPrevented) { 3717 suppressImmediateOutsideClickAfterPreventedStart(); 3718 return; 3719 } 3720 if (typeof outsidePress2 === "function" && !outsidePress2(event)) { 3721 return; 3722 } 3723 preventedPressSuppressionTimeout.clear(); 3724 suppressNextOutsideClickRef.current = true; 3725 clearInsideReactTree(); 3726 } 3727 function handleTouchMove(event) { 3728 if (getOutsidePressEvent() !== "sloppy" || !touchStateRef.current || isEventTargetWithin(event, store.select("floatingElement")) || isEventTargetWithin(event, store.select("domReferenceElement"))) { 3729 return; 3730 } 3731 const touch = event.touches[0]; 3732 if (!touch) { 3733 return; 3734 } 3735 const deltaX = Math.abs(touch.clientX - touchStateRef.current.startX); 3736 const deltaY = Math.abs(touch.clientY - touchStateRef.current.startY); 3737 const distance = Math.sqrt(deltaX * deltaX + deltaY * deltaY); 3738 if (distance > 5) { 3739 touchStateRef.current.dismissOnTouchEnd = true; 3740 } 3741 if (distance > 10) { 3742 closeOnPressOutside(event); 3743 cancelDismissOnEndTimeout.clear(); 3744 touchStateRef.current = null; 3745 } 3746 } 3747 function handleTouchMoveCapture(event) { 3748 addTargetEventListenerOnce(event, handleTouchMove); 3749 } 3750 function handleTouchEnd(event) { 3751 if (getOutsidePressEvent() !== "sloppy" || !touchStateRef.current || isEventTargetWithin(event, store.select("floatingElement")) || isEventTargetWithin(event, store.select("domReferenceElement"))) { 3752 return; 3753 } 3754 if (touchStateRef.current.dismissOnTouchEnd) { 3755 closeOnPressOutside(event); 3756 } 3757 cancelDismissOnEndTimeout.clear(); 3758 touchStateRef.current = null; 3759 } 3760 function handleTouchEndCapture(event) { 3761 addTargetEventListenerOnce(event, handleTouchEnd); 3762 } 3763 const doc = ownerDocument(floatingElement); 3764 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))); 3765 return () => { 3766 unsubscribe(); 3767 compositionTimeout.clear(); 3768 preventedPressSuppressionTimeout.clear(); 3769 resetPressStartState(); 3770 suppressNextOutsideClickRef.current = false; 3771 }; 3772 }, [dataRef, floatingElement, escapeKey2, outsidePressEnabled, outsidePress2, open, enabled, escapeKeyBubbles, outsidePressBubbles, closeOnEscapeKeyDown, clearInsideReactTree, getOutsidePressEventProp, tree, store, cancelDismissOnEndTimeout]); 3773 React27.useEffect(clearInsideReactTree, [outsidePress2, clearInsideReactTree]); 3774 const reference = React27.useMemo(() => ({ 3775 onKeyDown: closeOnEscapeKeyDown, 3776 [bubbleHandlerKeys[referencePressEvent]]: (event) => { 3777 if (!isReferencePressEnabled()) { 3778 return; 3779 } 3780 store.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerPress, event.nativeEvent)); 3781 }, 3782 ...referencePressEvent !== "intentional" && { 3783 onClick(event) { 3784 if (!isReferencePressEnabled()) { 3785 return; 3786 } 3787 store.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerPress, event.nativeEvent)); 3788 } 3789 } 3790 }), [closeOnEscapeKeyDown, store, referencePressEvent, isReferencePressEnabled]); 3791 const markPressStartedInsideReactTree = useStableCallback((event) => { 3792 if (!open || !enabled || event.button !== 0) { 3793 return; 3794 } 3795 const target = getTarget(event.nativeEvent); 3796 if (!contains(store.select("floatingElement"), target)) { 3797 return; 3798 } 3799 if (!pressStartedInsideRef.current) { 3800 pressStartedInsideRef.current = true; 3801 pressStartPreventedRef.current = false; 3802 } 3803 }); 3804 const markInsidePressStartPrevented = useStableCallback((event) => { 3805 if (!open || !enabled) { 3806 return; 3807 } 3808 if (!(event.defaultPrevented || event.nativeEvent.defaultPrevented)) { 3809 return; 3810 } 3811 if (pressStartedInsideRef.current) { 3812 pressStartPreventedRef.current = true; 3813 } 3814 }); 3815 const floating = React27.useMemo(() => ({ 3816 onKeyDown: closeOnEscapeKeyDown, 3817 // `onMouseDown` may be blocked if `event.preventDefault()` is called in 3818 // `onPointerDown`, such as with <NumberField.ScrubArea>. 3819 // See https://github.com/mui/base-ui/pull/3379 3820 onPointerDown: markInsidePressStartPrevented, 3821 onMouseDown: markInsidePressStartPrevented, 3822 onClickCapture: markInsideReactTree, 3823 onMouseDownCapture(event) { 3824 markInsideReactTree(); 3825 markPressStartedInsideReactTree(event); 3826 }, 3827 onPointerDownCapture(event) { 3828 markInsideReactTree(); 3829 markPressStartedInsideReactTree(event); 3830 }, 3831 onMouseUpCapture: markInsideReactTree, 3832 onTouchEndCapture: markInsideReactTree, 3833 onTouchMoveCapture: markInsideReactTree 3834 }), [closeOnEscapeKeyDown, markInsideReactTree, markPressStartedInsideReactTree, markInsidePressStartPrevented]); 3835 return React27.useMemo(() => enabled ? { 3836 reference, 3837 floating, 3838 trigger: reference 3839 } : {}, [enabled, reference, floating]); 3840 } 3841 3842 // node_modules/@base-ui/react/esm/floating-ui-react/hooks/useFloating.js 3843 var React33 = __toESM(require_react(), 1); 3844 3845 // node_modules/@floating-ui/core/dist/floating-ui.core.mjs 3846 function computeCoordsFromPlacement(_ref, placement, rtl) { 3847 let { 3848 reference, 3849 floating 3850 } = _ref; 3851 const sideAxis = getSideAxis(placement); 3852 const alignmentAxis = getAlignmentAxis(placement); 3853 const alignLength = getAxisLength(alignmentAxis); 3854 const side = getSide(placement); 3855 const isVertical = sideAxis === "y"; 3856 const commonX = reference.x + reference.width / 2 - floating.width / 2; 3857 const commonY = reference.y + reference.height / 2 - floating.height / 2; 3858 const commonAlign = reference[alignLength] / 2 - floating[alignLength] / 2; 3859 let coords; 3860 switch (side) { 3861 case "top": 3862 coords = { 3863 x: commonX, 3864 y: reference.y - floating.height 3865 }; 3866 break; 3867 case "bottom": 3868 coords = { 3869 x: commonX, 3870 y: reference.y + reference.height 3871 }; 3872 break; 3873 case "right": 3874 coords = { 3875 x: reference.x + reference.width, 3876 y: commonY 3877 }; 3878 break; 3879 case "left": 3880 coords = { 3881 x: reference.x - floating.width, 3882 y: commonY 3883 }; 3884 break; 3885 default: 3886 coords = { 3887 x: reference.x, 3888 y: reference.y 3889 }; 3890 } 3891 switch (getAlignment(placement)) { 3892 case "start": 3893 coords[alignmentAxis] -= commonAlign * (rtl && isVertical ? -1 : 1); 3894 break; 3895 case "end": 3896 coords[alignmentAxis] += commonAlign * (rtl && isVertical ? -1 : 1); 3897 break; 3898 } 3899 return coords; 3900 } 3901 async function detectOverflow(state, options) { 3902 var _await$platform$isEle; 3903 if (options === void 0) { 3904 options = {}; 3905 } 3906 const { 3907 x: x2, 3908 y: y2, 3909 platform: platform3, 3910 rects, 3911 elements, 3912 strategy 3913 } = state; 3914 const { 3915 boundary = "clippingAncestors", 3916 rootBoundary = "viewport", 3917 elementContext = "floating", 3918 altBoundary = false, 3919 padding = 0 3920 } = evaluate(options, state); 3921 const paddingObject = getPaddingObject(padding); 3922 const altContext = elementContext === "floating" ? "reference" : "floating"; 3923 const element = elements[altBoundary ? altContext : elementContext]; 3924 const clippingClientRect = rectToClientRect(await platform3.getClippingRect({ 3925 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)), 3926 boundary, 3927 rootBoundary, 3928 strategy 3929 })); 3930 const rect = elementContext === "floating" ? { 3931 x: x2, 3932 y: y2, 3933 width: rects.floating.width, 3934 height: rects.floating.height 3935 } : rects.reference; 3936 const offsetParent = await (platform3.getOffsetParent == null ? void 0 : platform3.getOffsetParent(elements.floating)); 3937 const offsetScale = await (platform3.isElement == null ? void 0 : platform3.isElement(offsetParent)) ? await (platform3.getScale == null ? void 0 : platform3.getScale(offsetParent)) || { 3938 x: 1, 3939 y: 1 3940 } : { 3941 x: 1, 3942 y: 1 3943 }; 3944 const elementClientRect = rectToClientRect(platform3.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform3.convertOffsetParentRelativeRectToViewportRelativeRect({ 3945 elements, 3946 rect, 3947 offsetParent, 3948 strategy 3949 }) : rect); 3950 return { 3951 top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y, 3952 bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y, 3953 left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x, 3954 right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x 3955 }; 3956 } 3957 var MAX_RESET_COUNT = 50; 3958 var computePosition = async (reference, floating, config) => { 3959 const { 3960 placement = "bottom", 3961 strategy = "absolute", 3962 middleware = [], 3963 platform: platform3 3964 } = config; 3965 const platformWithDetectOverflow = platform3.detectOverflow ? platform3 : { 3966 ...platform3, 3967 detectOverflow 3968 }; 3969 const rtl = await (platform3.isRTL == null ? void 0 : platform3.isRTL(floating)); 3970 let rects = await platform3.getElementRects({ 3971 reference, 3972 floating, 3973 strategy 3974 }); 3975 let { 3976 x: x2, 3977 y: y2 3978 } = computeCoordsFromPlacement(rects, placement, rtl); 3979 let statefulPlacement = placement; 3980 let resetCount = 0; 3981 const middlewareData = {}; 3982 for (let i2 = 0; i2 < middleware.length; i2++) { 3983 const currentMiddleware = middleware[i2]; 3984 if (!currentMiddleware) { 3985 continue; 3986 } 3987 const { 3988 name, 3989 fn 3990 } = currentMiddleware; 3991 const { 3992 x: nextX, 3993 y: nextY, 3994 data, 3995 reset 3996 } = await fn({ 3997 x: x2, 3998 y: y2, 3999 initialPlacement: placement, 4000 placement: statefulPlacement, 4001 strategy, 4002 middlewareData, 4003 rects, 4004 platform: platformWithDetectOverflow, 4005 elements: { 4006 reference, 4007 floating 4008 } 4009 }); 4010 x2 = nextX != null ? nextX : x2; 4011 y2 = nextY != null ? nextY : y2; 4012 middlewareData[name] = { 4013 ...middlewareData[name], 4014 ...data 4015 }; 4016 if (reset && resetCount < MAX_RESET_COUNT) { 4017 resetCount++; 4018 if (typeof reset === "object") { 4019 if (reset.placement) { 4020 statefulPlacement = reset.placement; 4021 } 4022 if (reset.rects) { 4023 rects = reset.rects === true ? await platform3.getElementRects({ 4024 reference, 4025 floating, 4026 strategy 4027 }) : reset.rects; 4028 } 4029 ({ 4030 x: x2, 4031 y: y2 4032 } = computeCoordsFromPlacement(rects, statefulPlacement, rtl)); 4033 } 4034 i2 = -1; 4035 } 4036 } 4037 return { 4038 x: x2, 4039 y: y2, 4040 placement: statefulPlacement, 4041 strategy, 4042 middlewareData 4043 }; 4044 }; 4045 var flip = function(options) { 4046 if (options === void 0) { 4047 options = {}; 4048 } 4049 return { 4050 name: "flip", 4051 options, 4052 async fn(state) { 4053 var _middlewareData$arrow, _middlewareData$flip; 4054 const { 4055 placement, 4056 middlewareData, 4057 rects, 4058 initialPlacement, 4059 platform: platform3, 4060 elements 4061 } = state; 4062 const { 4063 mainAxis: checkMainAxis = true, 4064 crossAxis: checkCrossAxis = true, 4065 fallbackPlacements: specifiedFallbackPlacements, 4066 fallbackStrategy = "bestFit", 4067 fallbackAxisSideDirection = "none", 4068 flipAlignment = true, 4069 ...detectOverflowOptions 4070 } = evaluate(options, state); 4071 if ((_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) { 4072 return {}; 4073 } 4074 const side = getSide(placement); 4075 const initialSideAxis = getSideAxis(initialPlacement); 4076 const isBasePlacement = getSide(initialPlacement) === initialPlacement; 4077 const rtl = await (platform3.isRTL == null ? void 0 : platform3.isRTL(elements.floating)); 4078 const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement)); 4079 const hasFallbackAxisSideDirection = fallbackAxisSideDirection !== "none"; 4080 if (!specifiedFallbackPlacements && hasFallbackAxisSideDirection) { 4081 fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl)); 4082 } 4083 const placements2 = [initialPlacement, ...fallbackPlacements]; 4084 const overflow = await platform3.detectOverflow(state, detectOverflowOptions); 4085 const overflows = []; 4086 let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || []; 4087 if (checkMainAxis) { 4088 overflows.push(overflow[side]); 4089 } 4090 if (checkCrossAxis) { 4091 const sides2 = getAlignmentSides(placement, rects, rtl); 4092 overflows.push(overflow[sides2[0]], overflow[sides2[1]]); 4093 } 4094 overflowsData = [...overflowsData, { 4095 placement, 4096 overflows 4097 }]; 4098 if (!overflows.every((side2) => side2 <= 0)) { 4099 var _middlewareData$flip2, _overflowsData$filter; 4100 const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1; 4101 const nextPlacement = placements2[nextIndex]; 4102 if (nextPlacement) { 4103 const ignoreCrossAxisOverflow = checkCrossAxis === "alignment" ? initialSideAxis !== getSideAxis(nextPlacement) : false; 4104 if (!ignoreCrossAxisOverflow || // We leave the current main axis only if every placement on that axis 4105 // overflows the main axis. 4106 overflowsData.every((d2) => getSideAxis(d2.placement) === initialSideAxis ? d2.overflows[0] > 0 : true)) { 4107 return { 4108 data: { 4109 index: nextIndex, 4110 overflows: overflowsData 4111 }, 4112 reset: { 4113 placement: nextPlacement 4114 } 4115 }; 4116 } 4117 } 4118 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; 4119 if (!resetPlacement) { 4120 switch (fallbackStrategy) { 4121 case "bestFit": { 4122 var _overflowsData$filter2; 4123 const placement2 = (_overflowsData$filter2 = overflowsData.filter((d2) => { 4124 if (hasFallbackAxisSideDirection) { 4125 const currentSideAxis = getSideAxis(d2.placement); 4126 return currentSideAxis === initialSideAxis || // Create a bias to the `y` side axis due to horizontal 4127 // reading directions favoring greater width. 4128 currentSideAxis === "y"; 4129 } 4130 return true; 4131 }).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]; 4132 if (placement2) { 4133 resetPlacement = placement2; 4134 } 4135 break; 4136 } 4137 case "initialPlacement": 4138 resetPlacement = initialPlacement; 4139 break; 4140 } 4141 } 4142 if (placement !== resetPlacement) { 4143 return { 4144 reset: { 4145 placement: resetPlacement 4146 } 4147 }; 4148 } 4149 } 4150 return {}; 4151 } 4152 }; 4153 }; 4154 function getSideOffsets(overflow, rect) { 4155 return { 4156 top: overflow.top - rect.height, 4157 right: overflow.right - rect.width, 4158 bottom: overflow.bottom - rect.height, 4159 left: overflow.left - rect.width 4160 }; 4161 } 4162 function isAnySideFullyClipped(overflow) { 4163 return sides.some((side) => overflow[side] >= 0); 4164 } 4165 var hide = function(options) { 4166 if (options === void 0) { 4167 options = {}; 4168 } 4169 return { 4170 name: "hide", 4171 options, 4172 async fn(state) { 4173 const { 4174 rects, 4175 platform: platform3 4176 } = state; 4177 const { 4178 strategy = "referenceHidden", 4179 ...detectOverflowOptions 4180 } = evaluate(options, state); 4181 switch (strategy) { 4182 case "referenceHidden": { 4183 const overflow = await platform3.detectOverflow(state, { 4184 ...detectOverflowOptions, 4185 elementContext: "reference" 4186 }); 4187 const offsets = getSideOffsets(overflow, rects.reference); 4188 return { 4189 data: { 4190 referenceHiddenOffsets: offsets, 4191 referenceHidden: isAnySideFullyClipped(offsets) 4192 } 4193 }; 4194 } 4195 case "escaped": { 4196 const overflow = await platform3.detectOverflow(state, { 4197 ...detectOverflowOptions, 4198 altBoundary: true 4199 }); 4200 const offsets = getSideOffsets(overflow, rects.floating); 4201 return { 4202 data: { 4203 escapedOffsets: offsets, 4204 escaped: isAnySideFullyClipped(offsets) 4205 } 4206 }; 4207 } 4208 default: { 4209 return {}; 4210 } 4211 } 4212 } 4213 }; 4214 }; 4215 var originSides = /* @__PURE__ */ new Set(["left", "top"]); 4216 async function convertValueToCoords(state, options) { 4217 const { 4218 placement, 4219 platform: platform3, 4220 elements 4221 } = state; 4222 const rtl = await (platform3.isRTL == null ? void 0 : platform3.isRTL(elements.floating)); 4223 const side = getSide(placement); 4224 const alignment = getAlignment(placement); 4225 const isVertical = getSideAxis(placement) === "y"; 4226 const mainAxisMulti = originSides.has(side) ? -1 : 1; 4227 const crossAxisMulti = rtl && isVertical ? -1 : 1; 4228 const rawValue = evaluate(options, state); 4229 let { 4230 mainAxis, 4231 crossAxis, 4232 alignmentAxis 4233 } = typeof rawValue === "number" ? { 4234 mainAxis: rawValue, 4235 crossAxis: 0, 4236 alignmentAxis: null 4237 } : { 4238 mainAxis: rawValue.mainAxis || 0, 4239 crossAxis: rawValue.crossAxis || 0, 4240 alignmentAxis: rawValue.alignmentAxis 4241 }; 4242 if (alignment && typeof alignmentAxis === "number") { 4243 crossAxis = alignment === "end" ? alignmentAxis * -1 : alignmentAxis; 4244 } 4245 return isVertical ? { 4246 x: crossAxis * crossAxisMulti, 4247 y: mainAxis * mainAxisMulti 4248 } : { 4249 x: mainAxis * mainAxisMulti, 4250 y: crossAxis * crossAxisMulti 4251 }; 4252 } 4253 var offset = function(options) { 4254 if (options === void 0) { 4255 options = 0; 4256 } 4257 return { 4258 name: "offset", 4259 options, 4260 async fn(state) { 4261 var _middlewareData$offse, _middlewareData$arrow; 4262 const { 4263 x: x2, 4264 y: y2, 4265 placement, 4266 middlewareData 4267 } = state; 4268 const diffCoords = await convertValueToCoords(state, options); 4269 if (placement === ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse.placement) && (_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) { 4270 return {}; 4271 } 4272 return { 4273 x: x2 + diffCoords.x, 4274 y: y2 + diffCoords.y, 4275 data: { 4276 ...diffCoords, 4277 placement 4278 } 4279 }; 4280 } 4281 }; 4282 }; 4283 var shift = function(options) { 4284 if (options === void 0) { 4285 options = {}; 4286 } 4287 return { 4288 name: "shift", 4289 options, 4290 async fn(state) { 4291 const { 4292 x: x2, 4293 y: y2, 4294 placement, 4295 platform: platform3 4296 } = state; 4297 const { 4298 mainAxis: checkMainAxis = true, 4299 crossAxis: checkCrossAxis = false, 4300 limiter = { 4301 fn: (_ref) => { 4302 let { 4303 x: x3, 4304 y: y3 4305 } = _ref; 4306 return { 4307 x: x3, 4308 y: y3 4309 }; 4310 } 4311 }, 4312 ...detectOverflowOptions 4313 } = evaluate(options, state); 4314 const coords = { 4315 x: x2, 4316 y: y2 4317 }; 4318 const overflow = await platform3.detectOverflow(state, detectOverflowOptions); 4319 const crossAxis = getSideAxis(getSide(placement)); 4320 const mainAxis = getOppositeAxis(crossAxis); 4321 let mainAxisCoord = coords[mainAxis]; 4322 let crossAxisCoord = coords[crossAxis]; 4323 if (checkMainAxis) { 4324 const minSide = mainAxis === "y" ? "top" : "left"; 4325 const maxSide = mainAxis === "y" ? "bottom" : "right"; 4326 const min2 = mainAxisCoord + overflow[minSide]; 4327 const max2 = mainAxisCoord - overflow[maxSide]; 4328 mainAxisCoord = clamp(min2, mainAxisCoord, max2); 4329 } 4330 if (checkCrossAxis) { 4331 const minSide = crossAxis === "y" ? "top" : "left"; 4332 const maxSide = crossAxis === "y" ? "bottom" : "right"; 4333 const min2 = crossAxisCoord + overflow[minSide]; 4334 const max2 = crossAxisCoord - overflow[maxSide]; 4335 crossAxisCoord = clamp(min2, crossAxisCoord, max2); 4336 } 4337 const limitedCoords = limiter.fn({ 4338 ...state, 4339 [mainAxis]: mainAxisCoord, 4340 [crossAxis]: crossAxisCoord 4341 }); 4342 return { 4343 ...limitedCoords, 4344 data: { 4345 x: limitedCoords.x - x2, 4346 y: limitedCoords.y - y2, 4347 enabled: { 4348 [mainAxis]: checkMainAxis, 4349 [crossAxis]: checkCrossAxis 4350 } 4351 } 4352 }; 4353 } 4354 }; 4355 }; 4356 var limitShift = function(options) { 4357 if (options === void 0) { 4358 options = {}; 4359 } 4360 return { 4361 options, 4362 fn(state) { 4363 const { 4364 x: x2, 4365 y: y2, 4366 placement, 4367 rects, 4368 middlewareData 4369 } = state; 4370 const { 4371 offset: offset4 = 0, 4372 mainAxis: checkMainAxis = true, 4373 crossAxis: checkCrossAxis = true 4374 } = evaluate(options, state); 4375 const coords = { 4376 x: x2, 4377 y: y2 4378 }; 4379 const crossAxis = getSideAxis(placement); 4380 const mainAxis = getOppositeAxis(crossAxis); 4381 let mainAxisCoord = coords[mainAxis]; 4382 let crossAxisCoord = coords[crossAxis]; 4383 const rawOffset = evaluate(offset4, state); 4384 const computedOffset = typeof rawOffset === "number" ? { 4385 mainAxis: rawOffset, 4386 crossAxis: 0 4387 } : { 4388 mainAxis: 0, 4389 crossAxis: 0, 4390 ...rawOffset 4391 }; 4392 if (checkMainAxis) { 4393 const len = mainAxis === "y" ? "height" : "width"; 4394 const limitMin = rects.reference[mainAxis] - rects.floating[len] + computedOffset.mainAxis; 4395 const limitMax = rects.reference[mainAxis] + rects.reference[len] - computedOffset.mainAxis; 4396 if (mainAxisCoord < limitMin) { 4397 mainAxisCoord = limitMin; 4398 } else if (mainAxisCoord > limitMax) { 4399 mainAxisCoord = limitMax; 4400 } 4401 } 4402 if (checkCrossAxis) { 4403 var _middlewareData$offse, _middlewareData$offse2; 4404 const len = mainAxis === "y" ? "width" : "height"; 4405 const isOriginSide = originSides.has(getSide(placement)); 4406 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); 4407 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); 4408 if (crossAxisCoord < limitMin) { 4409 crossAxisCoord = limitMin; 4410 } else if (crossAxisCoord > limitMax) { 4411 crossAxisCoord = limitMax; 4412 } 4413 } 4414 return { 4415 [mainAxis]: mainAxisCoord, 4416 [crossAxis]: crossAxisCoord 4417 }; 4418 } 4419 }; 4420 }; 4421 var size = function(options) { 4422 if (options === void 0) { 4423 options = {}; 4424 } 4425 return { 4426 name: "size", 4427 options, 4428 async fn(state) { 4429 var _state$middlewareData, _state$middlewareData2; 4430 const { 4431 placement, 4432 rects, 4433 platform: platform3, 4434 elements 4435 } = state; 4436 const { 4437 apply = () => { 4438 }, 4439 ...detectOverflowOptions 4440 } = evaluate(options, state); 4441 const overflow = await platform3.detectOverflow(state, detectOverflowOptions); 4442 const side = getSide(placement); 4443 const alignment = getAlignment(placement); 4444 const isYAxis = getSideAxis(placement) === "y"; 4445 const { 4446 width, 4447 height 4448 } = rects.floating; 4449 let heightSide; 4450 let widthSide; 4451 if (side === "top" || side === "bottom") { 4452 heightSide = side; 4453 widthSide = alignment === (await (platform3.isRTL == null ? void 0 : platform3.isRTL(elements.floating)) ? "start" : "end") ? "left" : "right"; 4454 } else { 4455 widthSide = side; 4456 heightSide = alignment === "end" ? "top" : "bottom"; 4457 } 4458 const maximumClippingHeight = height - overflow.top - overflow.bottom; 4459 const maximumClippingWidth = width - overflow.left - overflow.right; 4460 const overflowAvailableHeight = min(height - overflow[heightSide], maximumClippingHeight); 4461 const overflowAvailableWidth = min(width - overflow[widthSide], maximumClippingWidth); 4462 const noShift = !state.middlewareData.shift; 4463 let availableHeight = overflowAvailableHeight; 4464 let availableWidth = overflowAvailableWidth; 4465 if ((_state$middlewareData = state.middlewareData.shift) != null && _state$middlewareData.enabled.x) { 4466 availableWidth = maximumClippingWidth; 4467 } 4468 if ((_state$middlewareData2 = state.middlewareData.shift) != null && _state$middlewareData2.enabled.y) { 4469 availableHeight = maximumClippingHeight; 4470 } 4471 if (noShift && !alignment) { 4472 const xMin = max(overflow.left, 0); 4473 const xMax = max(overflow.right, 0); 4474 const yMin = max(overflow.top, 0); 4475 const yMax = max(overflow.bottom, 0); 4476 if (isYAxis) { 4477 availableWidth = width - 2 * (xMin !== 0 || xMax !== 0 ? xMin + xMax : max(overflow.left, overflow.right)); 4478 } else { 4479 availableHeight = height - 2 * (yMin !== 0 || yMax !== 0 ? yMin + yMax : max(overflow.top, overflow.bottom)); 4480 } 4481 } 4482 await apply({ 4483 ...state, 4484 availableWidth, 4485 availableHeight 4486 }); 4487 const nextDimensions = await platform3.getDimensions(elements.floating); 4488 if (width !== nextDimensions.width || height !== nextDimensions.height) { 4489 return { 4490 reset: { 4491 rects: true 4492 } 4493 }; 4494 } 4495 return {}; 4496 } 4497 }; 4498 }; 4499 4500 // node_modules/@floating-ui/dom/dist/floating-ui.dom.mjs 4501 function getCssDimensions(element) { 4502 const css = getComputedStyle2(element); 4503 let width = parseFloat(css.width) || 0; 4504 let height = parseFloat(css.height) || 0; 4505 const hasOffset = isHTMLElement(element); 4506 const offsetWidth = hasOffset ? element.offsetWidth : width; 4507 const offsetHeight = hasOffset ? element.offsetHeight : height; 4508 const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight; 4509 if (shouldFallback) { 4510 width = offsetWidth; 4511 height = offsetHeight; 4512 } 4513 return { 4514 width, 4515 height, 4516 $: shouldFallback 4517 }; 4518 } 4519 function unwrapElement(element) { 4520 return !isElement(element) ? element.contextElement : element; 4521 } 4522 function getScale(element) { 4523 const domElement = unwrapElement(element); 4524 if (!isHTMLElement(domElement)) { 4525 return createCoords(1); 4526 } 4527 const rect = domElement.getBoundingClientRect(); 4528 const { 4529 width, 4530 height, 4531 $: $2 4532 } = getCssDimensions(domElement); 4533 let x2 = ($2 ? round(rect.width) : rect.width) / width; 4534 let y2 = ($2 ? round(rect.height) : rect.height) / height; 4535 if (!x2 || !Number.isFinite(x2)) { 4536 x2 = 1; 4537 } 4538 if (!y2 || !Number.isFinite(y2)) { 4539 y2 = 1; 4540 } 4541 return { 4542 x: x2, 4543 y: y2 4544 }; 4545 } 4546 var noOffsets = /* @__PURE__ */ createCoords(0); 4547 function getVisualOffsets(element) { 4548 const win = getWindow(element); 4549 if (!isWebKit() || !win.visualViewport) { 4550 return noOffsets; 4551 } 4552 return { 4553 x: win.visualViewport.offsetLeft, 4554 y: win.visualViewport.offsetTop 4555 }; 4556 } 4557 function shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) { 4558 if (isFixed === void 0) { 4559 isFixed = false; 4560 } 4561 if (!floatingOffsetParent || isFixed && floatingOffsetParent !== getWindow(element)) { 4562 return false; 4563 } 4564 return isFixed; 4565 } 4566 function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) { 4567 if (includeScale === void 0) { 4568 includeScale = false; 4569 } 4570 if (isFixedStrategy === void 0) { 4571 isFixedStrategy = false; 4572 } 4573 const clientRect = element.getBoundingClientRect(); 4574 const domElement = unwrapElement(element); 4575 let scale = createCoords(1); 4576 if (includeScale) { 4577 if (offsetParent) { 4578 if (isElement(offsetParent)) { 4579 scale = getScale(offsetParent); 4580 } 4581 } else { 4582 scale = getScale(element); 4583 } 4584 } 4585 const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : createCoords(0); 4586 let x2 = (clientRect.left + visualOffsets.x) / scale.x; 4587 let y2 = (clientRect.top + visualOffsets.y) / scale.y; 4588 let width = clientRect.width / scale.x; 4589 let height = clientRect.height / scale.y; 4590 if (domElement) { 4591 const win = getWindow(domElement); 4592 const offsetWin = offsetParent && isElement(offsetParent) ? getWindow(offsetParent) : offsetParent; 4593 let currentWin = win; 4594 let currentIFrame = getFrameElement(currentWin); 4595 while (currentIFrame && offsetParent && offsetWin !== currentWin) { 4596 const iframeScale = getScale(currentIFrame); 4597 const iframeRect = currentIFrame.getBoundingClientRect(); 4598 const css = getComputedStyle2(currentIFrame); 4599 const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x; 4600 const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y; 4601 x2 *= iframeScale.x; 4602 y2 *= iframeScale.y; 4603 width *= iframeScale.x; 4604 height *= iframeScale.y; 4605 x2 += left; 4606 y2 += top; 4607 currentWin = getWindow(currentIFrame); 4608 currentIFrame = getFrameElement(currentWin); 4609 } 4610 } 4611 return rectToClientRect({ 4612 width, 4613 height, 4614 x: x2, 4615 y: y2 4616 }); 4617 } 4618 function getWindowScrollBarX(element, rect) { 4619 const leftScroll = getNodeScroll(element).scrollLeft; 4620 if (!rect) { 4621 return getBoundingClientRect(getDocumentElement(element)).left + leftScroll; 4622 } 4623 return rect.left + leftScroll; 4624 } 4625 function getHTMLOffset(documentElement, scroll) { 4626 const htmlRect = documentElement.getBoundingClientRect(); 4627 const x2 = htmlRect.left + scroll.scrollLeft - getWindowScrollBarX(documentElement, htmlRect); 4628 const y2 = htmlRect.top + scroll.scrollTop; 4629 return { 4630 x: x2, 4631 y: y2 4632 }; 4633 } 4634 function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) { 4635 let { 4636 elements, 4637 rect, 4638 offsetParent, 4639 strategy 4640 } = _ref; 4641 const isFixed = strategy === "fixed"; 4642 const documentElement = getDocumentElement(offsetParent); 4643 const topLayer = elements ? isTopLayer(elements.floating) : false; 4644 if (offsetParent === documentElement || topLayer && isFixed) { 4645 return rect; 4646 } 4647 let scroll = { 4648 scrollLeft: 0, 4649 scrollTop: 0 4650 }; 4651 let scale = createCoords(1); 4652 const offsets = createCoords(0); 4653 const isOffsetParentAnElement = isHTMLElement(offsetParent); 4654 if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) { 4655 if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) { 4656 scroll = getNodeScroll(offsetParent); 4657 } 4658 if (isOffsetParentAnElement) { 4659 const offsetRect = getBoundingClientRect(offsetParent); 4660 scale = getScale(offsetParent); 4661 offsets.x = offsetRect.x + offsetParent.clientLeft; 4662 offsets.y = offsetRect.y + offsetParent.clientTop; 4663 } 4664 } 4665 const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0); 4666 return { 4667 width: rect.width * scale.x, 4668 height: rect.height * scale.y, 4669 x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x + htmlOffset.x, 4670 y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y + htmlOffset.y 4671 }; 4672 } 4673 function getClientRects(element) { 4674 return Array.from(element.getClientRects()); 4675 } 4676 function getDocumentRect(element) { 4677 const html = getDocumentElement(element); 4678 const scroll = getNodeScroll(element); 4679 const body = element.ownerDocument.body; 4680 const width = max(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth); 4681 const height = max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight); 4682 let x2 = -scroll.scrollLeft + getWindowScrollBarX(element); 4683 const y2 = -scroll.scrollTop; 4684 if (getComputedStyle2(body).direction === "rtl") { 4685 x2 += max(html.clientWidth, body.clientWidth) - width; 4686 } 4687 return { 4688 width, 4689 height, 4690 x: x2, 4691 y: y2 4692 }; 4693 } 4694 var SCROLLBAR_MAX = 25; 4695 function getViewportRect(element, strategy) { 4696 const win = getWindow(element); 4697 const html = getDocumentElement(element); 4698 const visualViewport = win.visualViewport; 4699 let width = html.clientWidth; 4700 let height = html.clientHeight; 4701 let x2 = 0; 4702 let y2 = 0; 4703 if (visualViewport) { 4704 width = visualViewport.width; 4705 height = visualViewport.height; 4706 const visualViewportBased = isWebKit(); 4707 if (!visualViewportBased || visualViewportBased && strategy === "fixed") { 4708 x2 = visualViewport.offsetLeft; 4709 y2 = visualViewport.offsetTop; 4710 } 4711 } 4712 const windowScrollbarX = getWindowScrollBarX(html); 4713 if (windowScrollbarX <= 0) { 4714 const doc = html.ownerDocument; 4715 const body = doc.body; 4716 const bodyStyles = getComputedStyle(body); 4717 const bodyMarginInline = doc.compatMode === "CSS1Compat" ? parseFloat(bodyStyles.marginLeft) + parseFloat(bodyStyles.marginRight) || 0 : 0; 4718 const clippingStableScrollbarWidth = Math.abs(html.clientWidth - body.clientWidth - bodyMarginInline); 4719 if (clippingStableScrollbarWidth <= SCROLLBAR_MAX) { 4720 width -= clippingStableScrollbarWidth; 4721 } 4722 } else if (windowScrollbarX <= SCROLLBAR_MAX) { 4723 width += windowScrollbarX; 4724 } 4725 return { 4726 width, 4727 height, 4728 x: x2, 4729 y: y2 4730 }; 4731 } 4732 function getInnerBoundingClientRect(element, strategy) { 4733 const clientRect = getBoundingClientRect(element, true, strategy === "fixed"); 4734 const top = clientRect.top + element.clientTop; 4735 const left = clientRect.left + element.clientLeft; 4736 const scale = isHTMLElement(element) ? getScale(element) : createCoords(1); 4737 const width = element.clientWidth * scale.x; 4738 const height = element.clientHeight * scale.y; 4739 const x2 = left * scale.x; 4740 const y2 = top * scale.y; 4741 return { 4742 width, 4743 height, 4744 x: x2, 4745 y: y2 4746 }; 4747 } 4748 function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) { 4749 let rect; 4750 if (clippingAncestor === "viewport") { 4751 rect = getViewportRect(element, strategy); 4752 } else if (clippingAncestor === "document") { 4753 rect = getDocumentRect(getDocumentElement(element)); 4754 } else if (isElement(clippingAncestor)) { 4755 rect = getInnerBoundingClientRect(clippingAncestor, strategy); 4756 } else { 4757 const visualOffsets = getVisualOffsets(element); 4758 rect = { 4759 x: clippingAncestor.x - visualOffsets.x, 4760 y: clippingAncestor.y - visualOffsets.y, 4761 width: clippingAncestor.width, 4762 height: clippingAncestor.height 4763 }; 4764 } 4765 return rectToClientRect(rect); 4766 } 4767 function hasFixedPositionAncestor(element, stopNode) { 4768 const parentNode = getParentNode(element); 4769 if (parentNode === stopNode || !isElement(parentNode) || isLastTraversableNode(parentNode)) { 4770 return false; 4771 } 4772 return getComputedStyle2(parentNode).position === "fixed" || hasFixedPositionAncestor(parentNode, stopNode); 4773 } 4774 function getClippingElementAncestors(element, cache) { 4775 const cachedResult = cache.get(element); 4776 if (cachedResult) { 4777 return cachedResult; 4778 } 4779 let result = getOverflowAncestors(element, [], false).filter((el) => isElement(el) && getNodeName(el) !== "body"); 4780 let currentContainingBlockComputedStyle = null; 4781 const elementIsFixed = getComputedStyle2(element).position === "fixed"; 4782 let currentNode = elementIsFixed ? getParentNode(element) : element; 4783 while (isElement(currentNode) && !isLastTraversableNode(currentNode)) { 4784 const computedStyle = getComputedStyle2(currentNode); 4785 const currentNodeIsContaining = isContainingBlock(currentNode); 4786 if (!currentNodeIsContaining && computedStyle.position === "fixed") { 4787 currentContainingBlockComputedStyle = null; 4788 } 4789 const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === "static" && !!currentContainingBlockComputedStyle && (currentContainingBlockComputedStyle.position === "absolute" || currentContainingBlockComputedStyle.position === "fixed") || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode); 4790 if (shouldDropCurrentNode) { 4791 result = result.filter((ancestor) => ancestor !== currentNode); 4792 } else { 4793 currentContainingBlockComputedStyle = computedStyle; 4794 } 4795 currentNode = getParentNode(currentNode); 4796 } 4797 cache.set(element, result); 4798 return result; 4799 } 4800 function getClippingRect(_ref) { 4801 let { 4802 element, 4803 boundary, 4804 rootBoundary, 4805 strategy 4806 } = _ref; 4807 const elementClippingAncestors = boundary === "clippingAncestors" ? isTopLayer(element) ? [] : getClippingElementAncestors(element, this._c) : [].concat(boundary); 4808 const clippingAncestors = [...elementClippingAncestors, rootBoundary]; 4809 const firstRect = getClientRectFromClippingAncestor(element, clippingAncestors[0], strategy); 4810 let top = firstRect.top; 4811 let right = firstRect.right; 4812 let bottom = firstRect.bottom; 4813 let left = firstRect.left; 4814 for (let i2 = 1; i2 < clippingAncestors.length; i2++) { 4815 const rect = getClientRectFromClippingAncestor(element, clippingAncestors[i2], strategy); 4816 top = max(rect.top, top); 4817 right = min(rect.right, right); 4818 bottom = min(rect.bottom, bottom); 4819 left = max(rect.left, left); 4820 } 4821 return { 4822 width: right - left, 4823 height: bottom - top, 4824 x: left, 4825 y: top 4826 }; 4827 } 4828 function getDimensions(element) { 4829 const { 4830 width, 4831 height 4832 } = getCssDimensions(element); 4833 return { 4834 width, 4835 height 4836 }; 4837 } 4838 function getRectRelativeToOffsetParent(element, offsetParent, strategy) { 4839 const isOffsetParentAnElement = isHTMLElement(offsetParent); 4840 const documentElement = getDocumentElement(offsetParent); 4841 const isFixed = strategy === "fixed"; 4842 const rect = getBoundingClientRect(element, true, isFixed, offsetParent); 4843 let scroll = { 4844 scrollLeft: 0, 4845 scrollTop: 0 4846 }; 4847 const offsets = createCoords(0); 4848 function setLeftRTLScrollbarOffset() { 4849 offsets.x = getWindowScrollBarX(documentElement); 4850 } 4851 if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) { 4852 if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) { 4853 scroll = getNodeScroll(offsetParent); 4854 } 4855 if (isOffsetParentAnElement) { 4856 const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent); 4857 offsets.x = offsetRect.x + offsetParent.clientLeft; 4858 offsets.y = offsetRect.y + offsetParent.clientTop; 4859 } else if (documentElement) { 4860 setLeftRTLScrollbarOffset(); 4861 } 4862 } 4863 if (isFixed && !isOffsetParentAnElement && documentElement) { 4864 setLeftRTLScrollbarOffset(); 4865 } 4866 const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0); 4867 const x2 = rect.left + scroll.scrollLeft - offsets.x - htmlOffset.x; 4868 const y2 = rect.top + scroll.scrollTop - offsets.y - htmlOffset.y; 4869 return { 4870 x: x2, 4871 y: y2, 4872 width: rect.width, 4873 height: rect.height 4874 }; 4875 } 4876 function isStaticPositioned(element) { 4877 return getComputedStyle2(element).position === "static"; 4878 } 4879 function getTrueOffsetParent(element, polyfill) { 4880 if (!isHTMLElement(element) || getComputedStyle2(element).position === "fixed") { 4881 return null; 4882 } 4883 if (polyfill) { 4884 return polyfill(element); 4885 } 4886 let rawOffsetParent = element.offsetParent; 4887 if (getDocumentElement(element) === rawOffsetParent) { 4888 rawOffsetParent = rawOffsetParent.ownerDocument.body; 4889 } 4890 return rawOffsetParent; 4891 } 4892 function getOffsetParent(element, polyfill) { 4893 const win = getWindow(element); 4894 if (isTopLayer(element)) { 4895 return win; 4896 } 4897 if (!isHTMLElement(element)) { 4898 let svgOffsetParent = getParentNode(element); 4899 while (svgOffsetParent && !isLastTraversableNode(svgOffsetParent)) { 4900 if (isElement(svgOffsetParent) && !isStaticPositioned(svgOffsetParent)) { 4901 return svgOffsetParent; 4902 } 4903 svgOffsetParent = getParentNode(svgOffsetParent); 4904 } 4905 return win; 4906 } 4907 let offsetParent = getTrueOffsetParent(element, polyfill); 4908 while (offsetParent && isTableElement(offsetParent) && isStaticPositioned(offsetParent)) { 4909 offsetParent = getTrueOffsetParent(offsetParent, polyfill); 4910 } 4911 if (offsetParent && isLastTraversableNode(offsetParent) && isStaticPositioned(offsetParent) && !isContainingBlock(offsetParent)) { 4912 return win; 4913 } 4914 return offsetParent || getContainingBlock(element) || win; 4915 } 4916 var getElementRects = async function(data) { 4917 const getOffsetParentFn = this.getOffsetParent || getOffsetParent; 4918 const getDimensionsFn = this.getDimensions; 4919 const floatingDimensions = await getDimensionsFn(data.floating); 4920 return { 4921 reference: getRectRelativeToOffsetParent(data.reference, await getOffsetParentFn(data.floating), data.strategy), 4922 floating: { 4923 x: 0, 4924 y: 0, 4925 width: floatingDimensions.width, 4926 height: floatingDimensions.height 4927 } 4928 }; 4929 }; 4930 function isRTL(element) { 4931 return getComputedStyle2(element).direction === "rtl"; 4932 } 4933 var platform2 = { 4934 convertOffsetParentRelativeRectToViewportRelativeRect, 4935 getDocumentElement, 4936 getClippingRect, 4937 getOffsetParent, 4938 getElementRects, 4939 getClientRects, 4940 getDimensions, 4941 getScale, 4942 isElement, 4943 isRTL 4944 }; 4945 function rectsAreEqual(a2, b2) { 4946 return a2.x === b2.x && a2.y === b2.y && a2.width === b2.width && a2.height === b2.height; 4947 } 4948 function observeMove(element, onMove) { 4949 let io = null; 4950 let timeoutId; 4951 const root = getDocumentElement(element); 4952 function cleanup() { 4953 var _io; 4954 clearTimeout(timeoutId); 4955 (_io = io) == null || _io.disconnect(); 4956 io = null; 4957 } 4958 function refresh(skip, threshold) { 4959 if (skip === void 0) { 4960 skip = false; 4961 } 4962 if (threshold === void 0) { 4963 threshold = 1; 4964 } 4965 cleanup(); 4966 const elementRectForRootMargin = element.getBoundingClientRect(); 4967 const { 4968 left, 4969 top, 4970 width, 4971 height 4972 } = elementRectForRootMargin; 4973 if (!skip) { 4974 onMove(); 4975 } 4976 if (!width || !height) { 4977 return; 4978 } 4979 const insetTop = floor(top); 4980 const insetRight = floor(root.clientWidth - (left + width)); 4981 const insetBottom = floor(root.clientHeight - (top + height)); 4982 const insetLeft = floor(left); 4983 const rootMargin = -insetTop + "px " + -insetRight + "px " + -insetBottom + "px " + -insetLeft + "px"; 4984 const options = { 4985 rootMargin, 4986 threshold: max(0, min(1, threshold)) || 1 4987 }; 4988 let isFirstUpdate = true; 4989 function handleObserve(entries) { 4990 const ratio = entries[0].intersectionRatio; 4991 if (ratio !== threshold) { 4992 if (!isFirstUpdate) { 4993 return refresh(); 4994 } 4995 if (!ratio) { 4996 timeoutId = setTimeout(() => { 4997 refresh(false, 1e-7); 4998 }, 1e3); 4999 } else { 5000 refresh(false, ratio); 5001 } 5002 } 5003 if (ratio === 1 && !rectsAreEqual(elementRectForRootMargin, element.getBoundingClientRect())) { 5004 refresh(); 5005 } 5006 isFirstUpdate = false; 5007 } 5008 try { 5009 io = new IntersectionObserver(handleObserve, { 5010 ...options, 5011 // Handle <iframe>s 5012 root: root.ownerDocument 5013 }); 5014 } catch (_e) { 5015 io = new IntersectionObserver(handleObserve, options); 5016 } 5017 io.observe(element); 5018 } 5019 refresh(true); 5020 return cleanup; 5021 } 5022 function autoUpdate(reference, floating, update2, options) { 5023 if (options === void 0) { 5024 options = {}; 5025 } 5026 const { 5027 ancestorScroll = true, 5028 ancestorResize = true, 5029 elementResize = typeof ResizeObserver === "function", 5030 layoutShift = typeof IntersectionObserver === "function", 5031 animationFrame = false 5032 } = options; 5033 const referenceEl = unwrapElement(reference); 5034 const ancestors = ancestorScroll || ancestorResize ? [...referenceEl ? getOverflowAncestors(referenceEl) : [], ...floating ? getOverflowAncestors(floating) : []] : []; 5035 ancestors.forEach((ancestor) => { 5036 ancestorScroll && ancestor.addEventListener("scroll", update2, { 5037 passive: true 5038 }); 5039 ancestorResize && ancestor.addEventListener("resize", update2); 5040 }); 5041 const cleanupIo = referenceEl && layoutShift ? observeMove(referenceEl, update2) : null; 5042 let reobserveFrame = -1; 5043 let resizeObserver = null; 5044 if (elementResize) { 5045 resizeObserver = new ResizeObserver((_ref) => { 5046 let [firstEntry] = _ref; 5047 if (firstEntry && firstEntry.target === referenceEl && resizeObserver && floating) { 5048 resizeObserver.unobserve(floating); 5049 cancelAnimationFrame(reobserveFrame); 5050 reobserveFrame = requestAnimationFrame(() => { 5051 var _resizeObserver; 5052 (_resizeObserver = resizeObserver) == null || _resizeObserver.observe(floating); 5053 }); 5054 } 5055 update2(); 5056 }); 5057 if (referenceEl && !animationFrame) { 5058 resizeObserver.observe(referenceEl); 5059 } 5060 if (floating) { 5061 resizeObserver.observe(floating); 5062 } 5063 } 5064 let frameId; 5065 let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null; 5066 if (animationFrame) { 5067 frameLoop(); 5068 } 5069 function frameLoop() { 5070 const nextRefRect = getBoundingClientRect(reference); 5071 if (prevRefRect && !rectsAreEqual(prevRefRect, nextRefRect)) { 5072 update2(); 5073 } 5074 prevRefRect = nextRefRect; 5075 frameId = requestAnimationFrame(frameLoop); 5076 } 5077 update2(); 5078 return () => { 5079 var _resizeObserver2; 5080 ancestors.forEach((ancestor) => { 5081 ancestorScroll && ancestor.removeEventListener("scroll", update2); 5082 ancestorResize && ancestor.removeEventListener("resize", update2); 5083 }); 5084 cleanupIo == null || cleanupIo(); 5085 (_resizeObserver2 = resizeObserver) == null || _resizeObserver2.disconnect(); 5086 resizeObserver = null; 5087 if (animationFrame) { 5088 cancelAnimationFrame(frameId); 5089 } 5090 }; 5091 } 5092 var offset2 = offset; 5093 var shift2 = shift; 5094 var flip2 = flip; 5095 var size2 = size; 5096 var hide2 = hide; 5097 var limitShift2 = limitShift; 5098 var computePosition2 = (reference, floating, options) => { 5099 const cache = /* @__PURE__ */ new Map(); 5100 const mergedOptions = { 5101 platform: platform2, 5102 ...options 5103 }; 5104 const platformWithCache = { 5105 ...mergedOptions.platform, 5106 _c: cache 5107 }; 5108 return computePosition(reference, floating, { 5109 ...mergedOptions, 5110 platform: platformWithCache 5111 }); 5112 }; 5113 5114 // node_modules/@base-ui/react/node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.mjs 5115 var React28 = __toESM(require_react(), 1); 5116 var import_react2 = __toESM(require_react(), 1); 5117 var ReactDOM3 = __toESM(require_react_dom(), 1); 5118 var isClient = typeof document !== "undefined"; 5119 var noop2 = function noop3() { 5120 }; 5121 var index = isClient ? import_react2.useLayoutEffect : noop2; 5122 function deepEqual(a2, b2) { 5123 if (a2 === b2) { 5124 return true; 5125 } 5126 if (typeof a2 !== typeof b2) { 5127 return false; 5128 } 5129 if (typeof a2 === "function" && a2.toString() === b2.toString()) { 5130 return true; 5131 } 5132 let length; 5133 let i2; 5134 let keys; 5135 if (a2 && b2 && typeof a2 === "object") { 5136 if (Array.isArray(a2)) { 5137 length = a2.length; 5138 if (length !== b2.length) return false; 5139 for (i2 = length; i2-- !== 0; ) { 5140 if (!deepEqual(a2[i2], b2[i2])) { 5141 return false; 5142 } 5143 } 5144 return true; 5145 } 5146 keys = Object.keys(a2); 5147 length = keys.length; 5148 if (length !== Object.keys(b2).length) { 5149 return false; 5150 } 5151 for (i2 = length; i2-- !== 0; ) { 5152 if (!{}.hasOwnProperty.call(b2, keys[i2])) { 5153 return false; 5154 } 5155 } 5156 for (i2 = length; i2-- !== 0; ) { 5157 const key = keys[i2]; 5158 if (key === "_owner" && a2.$$typeof) { 5159 continue; 5160 } 5161 if (!deepEqual(a2[key], b2[key])) { 5162 return false; 5163 } 5164 } 5165 return true; 5166 } 5167 return a2 !== a2 && b2 !== b2; 5168 } 5169 function getDPR(element) { 5170 if (typeof window === "undefined") { 5171 return 1; 5172 } 5173 const win = element.ownerDocument.defaultView || window; 5174 return win.devicePixelRatio || 1; 5175 } 5176 function roundByDPR(element, value) { 5177 const dpr = getDPR(element); 5178 return Math.round(value * dpr) / dpr; 5179 } 5180 function useLatestRef(value) { 5181 const ref = React28.useRef(value); 5182 index(() => { 5183 ref.current = value; 5184 }); 5185 return ref; 5186 } 5187 function useFloating(options) { 5188 if (options === void 0) { 5189 options = {}; 5190 } 5191 const { 5192 placement = "bottom", 5193 strategy = "absolute", 5194 middleware = [], 5195 platform: platform3, 5196 elements: { 5197 reference: externalReference, 5198 floating: externalFloating 5199 } = {}, 5200 transform = true, 5201 whileElementsMounted, 5202 open 5203 } = options; 5204 const [data, setData] = React28.useState({ 5205 x: 0, 5206 y: 0, 5207 strategy, 5208 placement, 5209 middlewareData: {}, 5210 isPositioned: false 5211 }); 5212 const [latestMiddleware, setLatestMiddleware] = React28.useState(middleware); 5213 if (!deepEqual(latestMiddleware, middleware)) { 5214 setLatestMiddleware(middleware); 5215 } 5216 const [_reference, _setReference] = React28.useState(null); 5217 const [_floating, _setFloating] = React28.useState(null); 5218 const setReference = React28.useCallback((node) => { 5219 if (node !== referenceRef.current) { 5220 referenceRef.current = node; 5221 _setReference(node); 5222 } 5223 }, []); 5224 const setFloating = React28.useCallback((node) => { 5225 if (node !== floatingRef.current) { 5226 floatingRef.current = node; 5227 _setFloating(node); 5228 } 5229 }, []); 5230 const referenceEl = externalReference || _reference; 5231 const floatingEl = externalFloating || _floating; 5232 const referenceRef = React28.useRef(null); 5233 const floatingRef = React28.useRef(null); 5234 const dataRef = React28.useRef(data); 5235 const hasWhileElementsMounted = whileElementsMounted != null; 5236 const whileElementsMountedRef = useLatestRef(whileElementsMounted); 5237 const platformRef = useLatestRef(platform3); 5238 const openRef = useLatestRef(open); 5239 const update2 = React28.useCallback(() => { 5240 if (!referenceRef.current || !floatingRef.current) { 5241 return; 5242 } 5243 const config = { 5244 placement, 5245 strategy, 5246 middleware: latestMiddleware 5247 }; 5248 if (platformRef.current) { 5249 config.platform = platformRef.current; 5250 } 5251 computePosition2(referenceRef.current, floatingRef.current, config).then((data2) => { 5252 const fullData = { 5253 ...data2, 5254 // The floating element's position may be recomputed while it's closed 5255 // but still mounted (such as when transitioning out). To ensure 5256 // `isPositioned` will be `false` initially on the next open, avoid 5257 // setting it to `true` when `open === false` (must be specified). 5258 isPositioned: openRef.current !== false 5259 }; 5260 if (isMountedRef.current && !deepEqual(dataRef.current, fullData)) { 5261 dataRef.current = fullData; 5262 ReactDOM3.flushSync(() => { 5263 setData(fullData); 5264 }); 5265 } 5266 }); 5267 }, [latestMiddleware, placement, strategy, platformRef, openRef]); 5268 index(() => { 5269 if (open === false && dataRef.current.isPositioned) { 5270 dataRef.current.isPositioned = false; 5271 setData((data2) => ({ 5272 ...data2, 5273 isPositioned: false 5274 })); 5275 } 5276 }, [open]); 5277 const isMountedRef = React28.useRef(false); 5278 index(() => { 5279 isMountedRef.current = true; 5280 return () => { 5281 isMountedRef.current = false; 5282 }; 5283 }, []); 5284 index(() => { 5285 if (referenceEl) referenceRef.current = referenceEl; 5286 if (floatingEl) floatingRef.current = floatingEl; 5287 if (referenceEl && floatingEl) { 5288 if (whileElementsMountedRef.current) { 5289 return whileElementsMountedRef.current(referenceEl, floatingEl, update2); 5290 } 5291 update2(); 5292 } 5293 }, [referenceEl, floatingEl, update2, whileElementsMountedRef, hasWhileElementsMounted]); 5294 const refs = React28.useMemo(() => ({ 5295 reference: referenceRef, 5296 floating: floatingRef, 5297 setReference, 5298 setFloating 5299 }), [setReference, setFloating]); 5300 const elements = React28.useMemo(() => ({ 5301 reference: referenceEl, 5302 floating: floatingEl 5303 }), [referenceEl, floatingEl]); 5304 const floatingStyles = React28.useMemo(() => { 5305 const initialStyles = { 5306 position: strategy, 5307 left: 0, 5308 top: 0 5309 }; 5310 if (!elements.floating) { 5311 return initialStyles; 5312 } 5313 const x2 = roundByDPR(elements.floating, data.x); 5314 const y2 = roundByDPR(elements.floating, data.y); 5315 if (transform) { 5316 return { 5317 ...initialStyles, 5318 transform: "translate(" + x2 + "px, " + y2 + "px)", 5319 ...getDPR(elements.floating) >= 1.5 && { 5320 willChange: "transform" 5321 } 5322 }; 5323 } 5324 return { 5325 position: strategy, 5326 left: x2, 5327 top: y2 5328 }; 5329 }, [strategy, transform, elements.floating, data.x, data.y]); 5330 return React28.useMemo(() => ({ 5331 ...data, 5332 update: update2, 5333 refs, 5334 elements, 5335 floatingStyles 5336 }), [data, update2, refs, elements, floatingStyles]); 5337 } 5338 var offset3 = (options, deps) => { 5339 const result = offset2(options); 5340 return { 5341 name: result.name, 5342 fn: result.fn, 5343 options: [options, deps] 5344 }; 5345 }; 5346 var shift3 = (options, deps) => { 5347 const result = shift2(options); 5348 return { 5349 name: result.name, 5350 fn: result.fn, 5351 options: [options, deps] 5352 }; 5353 }; 5354 var limitShift3 = (options, deps) => { 5355 const result = limitShift2(options); 5356 return { 5357 fn: result.fn, 5358 options: [options, deps] 5359 }; 5360 }; 5361 var flip3 = (options, deps) => { 5362 const result = flip2(options); 5363 return { 5364 name: result.name, 5365 fn: result.fn, 5366 options: [options, deps] 5367 }; 5368 }; 5369 var size3 = (options, deps) => { 5370 const result = size2(options); 5371 return { 5372 name: result.name, 5373 fn: result.fn, 5374 options: [options, deps] 5375 }; 5376 }; 5377 var hide3 = (options, deps) => { 5378 const result = hide2(options); 5379 return { 5380 name: result.name, 5381 fn: result.fn, 5382 options: [options, deps] 5383 }; 5384 }; 5385 5386 // node_modules/@base-ui/utils/esm/store/createSelector.js 5387 var createSelector = (a2, b2, c2, d2, e2, f2, ...other) => { 5388 if (other.length > 0) { 5389 throw new Error(true ? "Unsupported number of selectors" : formatErrorMessage_default(1)); 5390 } 5391 let selector; 5392 if (a2 && b2 && c2 && d2 && e2 && f2) { 5393 selector = (state, a1, a22, a3) => { 5394 const va = a2(state, a1, a22, a3); 5395 const vb = b2(state, a1, a22, a3); 5396 const vc = c2(state, a1, a22, a3); 5397 const vd = d2(state, a1, a22, a3); 5398 const ve = e2(state, a1, a22, a3); 5399 return f2(va, vb, vc, vd, ve, a1, a22, a3); 5400 }; 5401 } else if (a2 && b2 && c2 && d2 && e2) { 5402 selector = (state, a1, a22, a3) => { 5403 const va = a2(state, a1, a22, a3); 5404 const vb = b2(state, a1, a22, a3); 5405 const vc = c2(state, a1, a22, a3); 5406 const vd = d2(state, a1, a22, a3); 5407 return e2(va, vb, vc, vd, a1, a22, a3); 5408 }; 5409 } else if (a2 && b2 && c2 && d2) { 5410 selector = (state, a1, a22, a3) => { 5411 const va = a2(state, a1, a22, a3); 5412 const vb = b2(state, a1, a22, a3); 5413 const vc = c2(state, a1, a22, a3); 5414 return d2(va, vb, vc, a1, a22, a3); 5415 }; 5416 } else if (a2 && b2 && c2) { 5417 selector = (state, a1, a22, a3) => { 5418 const va = a2(state, a1, a22, a3); 5419 const vb = b2(state, a1, a22, a3); 5420 return c2(va, vb, a1, a22, a3); 5421 }; 5422 } else if (a2 && b2) { 5423 selector = (state, a1, a22, a3) => { 5424 const va = a2(state, a1, a22, a3); 5425 return b2(va, a1, a22, a3); 5426 }; 5427 } else if (a2) { 5428 selector = a2; 5429 } else { 5430 throw ( 5431 /* minify-error-disabled */ 5432 new Error("Missing arguments") 5433 ); 5434 } 5435 return selector; 5436 }; 5437 5438 // node_modules/@base-ui/utils/esm/store/useStore.js 5439 var React30 = __toESM(require_react(), 1); 5440 var import_shim = __toESM(require_shim(), 1); 5441 var import_with_selector = __toESM(require_with_selector(), 1); 5442 5443 // node_modules/@base-ui/utils/esm/fastHooks.js 5444 var React29 = __toESM(require_react(), 1); 5445 var hooks = []; 5446 var currentInstance = void 0; 5447 function getInstance() { 5448 return currentInstance; 5449 } 5450 function register(hook) { 5451 hooks.push(hook); 5452 } 5453 function fastComponent(fn) { 5454 const FastComponent = (props, forwardedRef) => { 5455 const instance = useRefWithInit(createInstance).current; 5456 let result; 5457 try { 5458 currentInstance = instance; 5459 for (const hook of hooks) { 5460 hook.before(instance); 5461 } 5462 result = fn(props, forwardedRef); 5463 for (const hook of hooks) { 5464 hook.after(instance); 5465 } 5466 instance.didInitialize = true; 5467 } finally { 5468 currentInstance = void 0; 5469 } 5470 return result; 5471 }; 5472 FastComponent.displayName = fn.displayName || fn.name; 5473 return FastComponent; 5474 } 5475 function fastComponentRef(fn) { 5476 return /* @__PURE__ */ React29.forwardRef(fastComponent(fn)); 5477 } 5478 function createInstance() { 5479 return { 5480 didInitialize: false 5481 }; 5482 } 5483 5484 // node_modules/@base-ui/utils/esm/store/useStore.js 5485 var canUseRawUseSyncExternalStore = isReactVersionAtLeast(19); 5486 var useStoreImplementation = canUseRawUseSyncExternalStore ? useStoreFast : useStoreLegacy; 5487 function useStore(store, selector, a1, a2, a3) { 5488 return useStoreImplementation(store, selector, a1, a2, a3); 5489 } 5490 function useStoreR19(store, selector, a1, a2, a3) { 5491 const getSelection = React30.useCallback(() => selector(store.getSnapshot(), a1, a2, a3), [store, selector, a1, a2, a3]); 5492 return (0, import_shim.useSyncExternalStore)(store.subscribe, getSelection, getSelection); 5493 } 5494 register({ 5495 before(instance) { 5496 instance.syncIndex = 0; 5497 if (!instance.didInitialize) { 5498 instance.syncTick = 1; 5499 instance.syncHooks = []; 5500 instance.didChangeStore = true; 5501 instance.getSnapshot = () => { 5502 let didChange2 = false; 5503 for (let i2 = 0; i2 < instance.syncHooks.length; i2 += 1) { 5504 const hook = instance.syncHooks[i2]; 5505 const value = hook.selector(hook.store.state, hook.a1, hook.a2, hook.a3); 5506 if (hook.didChange || !Object.is(hook.value, value)) { 5507 didChange2 = true; 5508 hook.value = value; 5509 hook.didChange = false; 5510 } 5511 } 5512 if (didChange2) { 5513 instance.syncTick += 1; 5514 } 5515 return instance.syncTick; 5516 }; 5517 } 5518 }, 5519 after(instance) { 5520 if (instance.syncHooks.length > 0) { 5521 if (instance.didChangeStore) { 5522 instance.didChangeStore = false; 5523 instance.subscribe = (onStoreChange) => { 5524 const stores = /* @__PURE__ */ new Set(); 5525 for (const hook of instance.syncHooks) { 5526 stores.add(hook.store); 5527 } 5528 const unsubscribes = []; 5529 for (const store of stores) { 5530 unsubscribes.push(store.subscribe(onStoreChange)); 5531 } 5532 return () => { 5533 for (const unsubscribe of unsubscribes) { 5534 unsubscribe(); 5535 } 5536 }; 5537 }; 5538 } 5539 (0, import_shim.useSyncExternalStore)(instance.subscribe, instance.getSnapshot, instance.getSnapshot); 5540 } 5541 } 5542 }); 5543 function useStoreFast(store, selector, a1, a2, a3) { 5544 const instance = getInstance(); 5545 if (!instance) { 5546 return useStoreR19(store, selector, a1, a2, a3); 5547 } 5548 const index2 = instance.syncIndex; 5549 instance.syncIndex += 1; 5550 let hook; 5551 if (!instance.didInitialize) { 5552 hook = { 5553 store, 5554 selector, 5555 a1, 5556 a2, 5557 a3, 5558 value: selector(store.getSnapshot(), a1, a2, a3), 5559 didChange: false 5560 }; 5561 instance.syncHooks.push(hook); 5562 } else { 5563 hook = instance.syncHooks[index2]; 5564 if (hook.store !== store || hook.selector !== selector || !Object.is(hook.a1, a1) || !Object.is(hook.a2, a2) || !Object.is(hook.a3, a3)) { 5565 if (hook.store !== store) { 5566 instance.didChangeStore = true; 5567 } 5568 hook.store = store; 5569 hook.selector = selector; 5570 hook.a1 = a1; 5571 hook.a2 = a2; 5572 hook.a3 = a3; 5573 hook.didChange = true; 5574 } 5575 } 5576 return hook.value; 5577 } 5578 function useStoreLegacy(store, selector, a1, a2, a3) { 5579 return (0, import_with_selector.useSyncExternalStoreWithSelector)(store.subscribe, store.getSnapshot, store.getSnapshot, (state) => selector(state, a1, a2, a3)); 5580 } 5581 5582 // node_modules/@base-ui/utils/esm/store/Store.js 5583 var Store = class { 5584 /** 5585 * The current state of the store. 5586 * This property is updated immediately when the state changes as a result of calling {@link setState}, {@link update}, or {@link set}. 5587 * 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). 5588 * The values can be used directly (to avoid subscribing to the store) in effects or event handlers. 5589 * 5590 * Do not modify properties in state directly. Instead, use the provided methods to ensure proper state management and listener notification. 5591 */ 5592 // Internal state to handle recursive `setState()` calls 5593 constructor(state) { 5594 this.state = state; 5595 this.listeners = /* @__PURE__ */ new Set(); 5596 this.updateTick = 0; 5597 } 5598 /** 5599 * Registers a listener that will be called whenever the store's state changes. 5600 * 5601 * @param fn The listener function to be called on state changes. 5602 * @returns A function to unsubscribe the listener. 5603 */ 5604 subscribe = (fn) => { 5605 this.listeners.add(fn); 5606 return () => { 5607 this.listeners.delete(fn); 5608 }; 5609 }; 5610 /** 5611 * Returns the current state of the store. 5612 */ 5613 getSnapshot = () => { 5614 return this.state; 5615 }; 5616 /** 5617 * Updates the entire store's state and notifies all registered listeners. 5618 * 5619 * @param newState The new state to set for the store. 5620 */ 5621 setState(newState) { 5622 if (this.state === newState) { 5623 return; 5624 } 5625 this.state = newState; 5626 this.updateTick += 1; 5627 const currentTick = this.updateTick; 5628 for (const listener of this.listeners) { 5629 if (currentTick !== this.updateTick) { 5630 return; 5631 } 5632 listener(newState); 5633 } 5634 } 5635 /** 5636 * Merges the provided changes into the current state and notifies listeners if there are changes. 5637 * 5638 * @param changes An object containing the changes to apply to the current state. 5639 */ 5640 update(changes) { 5641 for (const key in changes) { 5642 if (!Object.is(this.state[key], changes[key])) { 5643 this.setState({ 5644 ...this.state, 5645 ...changes 5646 }); 5647 return; 5648 } 5649 } 5650 } 5651 /** 5652 * Sets a specific key in the store's state to a new value and notifies listeners if the value has changed. 5653 * 5654 * @param key The key in the store's state to update. 5655 * @param value The new value to set for the specified key. 5656 */ 5657 set(key, value) { 5658 if (!Object.is(this.state[key], value)) { 5659 this.setState({ 5660 ...this.state, 5661 [key]: value 5662 }); 5663 } 5664 } 5665 /** 5666 * Gives the state a new reference and updates all registered listeners. 5667 */ 5668 notifyAll() { 5669 const newState = { 5670 ...this.state 5671 }; 5672 this.setState(newState); 5673 } 5674 use(selector, a1, a2, a3) { 5675 return useStore(this, selector, a1, a2, a3); 5676 } 5677 }; 5678 5679 // node_modules/@base-ui/utils/esm/store/ReactStore.js 5680 var React31 = __toESM(require_react(), 1); 5681 var ReactStore = class extends Store { 5682 /** 5683 * Creates a new ReactStore instance. 5684 * 5685 * @param state Initial state of the store. 5686 * @param context Non-reactive context values. 5687 * @param selectors Optional selectors for use with `useState`. 5688 */ 5689 constructor(state, context = {}, selectors3) { 5690 super(state); 5691 this.context = context; 5692 this.selectors = selectors3; 5693 } 5694 /** 5695 * Non-reactive values such as refs, callbacks, etc. 5696 */ 5697 /** 5698 * Synchronizes a single external value into the store. 5699 * 5700 * Note that the while the value in `state` is updated immediately, the value returned 5701 * by `useState` is updated before the next render (similarly to React's `useState`). 5702 */ 5703 useSyncedValue(key, value) { 5704 React31.useDebugValue(key); 5705 useIsoLayoutEffect(() => { 5706 if (this.state[key] !== value) { 5707 this.set(key, value); 5708 } 5709 }, [key, value]); 5710 } 5711 /** 5712 * Synchronizes a single external value into the store and 5713 * cleans it up (sets to `undefined`) on unmount. 5714 * 5715 * Note that the while the value in `state` is updated immediately, the value returned 5716 * by `useState` is updated before the next render (similarly to React's `useState`). 5717 */ 5718 useSyncedValueWithCleanup(key, value) { 5719 const store = this; 5720 useIsoLayoutEffect(() => { 5721 if (store.state[key] !== value) { 5722 store.set(key, value); 5723 } 5724 return () => { 5725 store.set(key, void 0); 5726 }; 5727 }, [store, key, value]); 5728 } 5729 /** 5730 * Synchronizes multiple external values into the store. 5731 * 5732 * Note that the while the values in `state` are updated immediately, the values returned 5733 * by `useState` are updated before the next render (similarly to React's `useState`). 5734 */ 5735 useSyncedValues(statePart) { 5736 const store = this; 5737 if (true) { 5738 React31.useDebugValue(statePart, (p2) => Object.keys(p2)); 5739 const keys = React31.useRef(Object.keys(statePart)).current; 5740 const nextKeys = Object.keys(statePart); 5741 if (keys.length !== nextKeys.length || keys.some((key, index2) => key !== nextKeys[index2])) { 5742 console.error("ReactStore.useSyncedValues expects the same prop keys on every render. Keys should be stable."); 5743 } 5744 } 5745 const dependencies = Object.values(statePart); 5746 useIsoLayoutEffect(() => { 5747 store.update(statePart); 5748 }, [store, ...dependencies]); 5749 } 5750 /** 5751 * Registers a controllable prop pair (`controlled`, `defaultValue`) for a specific key. If `controlled` 5752 * is non-undefined, the store's state at `key` is updated to match `controlled`. 5753 */ 5754 useControlledProp(key, controlled) { 5755 React31.useDebugValue(key); 5756 const isControlled = controlled !== void 0; 5757 useIsoLayoutEffect(() => { 5758 if (isControlled && !Object.is(this.state[key], controlled)) { 5759 super.setState({ 5760 ...this.state, 5761 [key]: controlled 5762 }); 5763 } 5764 }, [key, controlled, isControlled]); 5765 if (true) { 5766 const cache = this.controlledValues ??= /* @__PURE__ */ new Map(); 5767 if (!cache.has(key)) { 5768 cache.set(key, isControlled); 5769 } 5770 const previouslyControlled = cache.get(key); 5771 if (previouslyControlled !== void 0 && previouslyControlled !== isControlled) { 5772 console.error(`A component is changing the $isControlled ? "" : "un"}controlled state of $key.toString()} to be $isControlled ? "un" : ""}controlled. Elements should not switch from uncontrolled to controlled (or vice versa).`); 5773 } 5774 } 5775 } 5776 /** Gets the current value from the store using a selector with the provided key. 5777 * 5778 * @param key Key of the selector to use. 5779 */ 5780 select(key, a1, a2, a3) { 5781 const selector = this.selectors[key]; 5782 return selector(this.state, a1, a2, a3); 5783 } 5784 /** 5785 * Returns a value from the store's state using a selector function. 5786 * Used to subscribe to specific parts of the state. 5787 * This methods causes a rerender whenever the selected state changes. 5788 * 5789 * @param key Key of the selector to use. 5790 */ 5791 useState(key, a1, a2, a3) { 5792 React31.useDebugValue(key); 5793 return useStore(this, this.selectors[key], a1, a2, a3); 5794 } 5795 /** 5796 * Wraps a function with `useStableCallback` to ensure it has a stable reference 5797 * and assigns it to the context. 5798 * 5799 * @param key Key of the event callback. Must be a function in the context. 5800 * @param fn Function to assign. 5801 */ 5802 useContextCallback(key, fn) { 5803 React31.useDebugValue(key); 5804 const stableFunction = useStableCallback(fn ?? NOOP); 5805 this.context[key] = stableFunction; 5806 } 5807 /** 5808 * Returns a stable setter function for a specific key in the store's state. 5809 * It's commonly used to pass as a ref callback to React elements. 5810 * 5811 * @param key Key of the state to set. 5812 */ 5813 useStateSetter(key) { 5814 const ref = React31.useRef(void 0); 5815 if (ref.current === void 0) { 5816 ref.current = (value) => { 5817 this.set(key, value); 5818 }; 5819 } 5820 return ref.current; 5821 } 5822 /** 5823 * Observes changes derived from the store's selectors and calls the listener when the selected value changes. 5824 * 5825 * @param key Key of the selector to observe. 5826 * @param listener Listener function called when the selector result changes. 5827 */ 5828 observe(selector, listener) { 5829 let selectFn; 5830 if (typeof selector === "function") { 5831 selectFn = selector; 5832 } else { 5833 selectFn = this.selectors[selector]; 5834 } 5835 let prevValue = selectFn(this.state); 5836 listener(prevValue, prevValue, this); 5837 return this.subscribe((nextState) => { 5838 const nextValue = selectFn(nextState); 5839 if (!Object.is(prevValue, nextValue)) { 5840 const oldValue = prevValue; 5841 prevValue = nextValue; 5842 listener(nextValue, oldValue, this); 5843 } 5844 }); 5845 } 5846 }; 5847 5848 // node_modules/@base-ui/react/esm/floating-ui-react/components/FloatingRootStore.js 5849 var selectors = { 5850 open: createSelector((state) => state.open), 5851 transitionStatus: createSelector((state) => state.transitionStatus), 5852 domReferenceElement: createSelector((state) => state.domReferenceElement), 5853 referenceElement: createSelector((state) => state.positionReference ?? state.referenceElement), 5854 floatingElement: createSelector((state) => state.floatingElement), 5855 floatingId: createSelector((state) => state.floatingId) 5856 }; 5857 var FloatingRootStore = class extends ReactStore { 5858 constructor(options) { 5859 const { 5860 syncOnly, 5861 nested, 5862 onOpenChange, 5863 triggerElements, 5864 ...initialState 5865 } = options; 5866 super({ 5867 ...initialState, 5868 positionReference: initialState.referenceElement, 5869 domReferenceElement: initialState.referenceElement 5870 }, { 5871 onOpenChange, 5872 dataRef: { 5873 current: {} 5874 }, 5875 events: createEventEmitter(), 5876 nested, 5877 triggerElements 5878 }, selectors); 5879 this.syncOnly = syncOnly; 5880 } 5881 /** 5882 * Syncs the event used by hover logic to distinguish hover-open from click-like interaction. 5883 */ 5884 syncOpenEvent = (newOpen, event) => { 5885 if (!newOpen || !this.state.open || // Prevent a pending hover-open from overwriting a click-open event, while allowing 5886 // click events to upgrade a hover-open. 5887 event != null && isClickLikeEvent(event)) { 5888 this.context.dataRef.current.openEvent = newOpen ? event : void 0; 5889 } 5890 }; 5891 /** 5892 * Runs the root-owned side effects for an open state change. 5893 */ 5894 dispatchOpenChange = (newOpen, eventDetails) => { 5895 this.syncOpenEvent(newOpen, eventDetails.event); 5896 const details = { 5897 open: newOpen, 5898 reason: eventDetails.reason, 5899 nativeEvent: eventDetails.event, 5900 nested: this.context.nested, 5901 triggerElement: eventDetails.trigger 5902 }; 5903 this.context.events.emit("openchange", details); 5904 }; 5905 /** 5906 * Emits the `openchange` event through the internal event emitter and calls the `onOpenChange` handler with the provided arguments. 5907 * 5908 * @param newOpen The new open state. 5909 * @param eventDetails Details about the event that triggered the open state change. 5910 */ 5911 setOpen = (newOpen, eventDetails) => { 5912 if (this.syncOnly) { 5913 this.context.onOpenChange?.(newOpen, eventDetails); 5914 return; 5915 } 5916 this.dispatchOpenChange(newOpen, eventDetails); 5917 this.context.onOpenChange?.(newOpen, eventDetails); 5918 }; 5919 }; 5920 5921 // node_modules/@base-ui/react/esm/utils/popups/popupStoreUtils.js 5922 var React32 = __toESM(require_react(), 1); 5923 function useTriggerRegistration(id, store) { 5924 const registeredElementIdRef = React32.useRef(null); 5925 const registeredElementRef = React32.useRef(null); 5926 return React32.useCallback((element) => { 5927 if (id === void 0) { 5928 return; 5929 } 5930 if (registeredElementIdRef.current !== null) { 5931 const registeredId = registeredElementIdRef.current; 5932 const registeredElement = registeredElementRef.current; 5933 const currentElement = store.context.triggerElements.getById(registeredId); 5934 if (registeredElement && currentElement === registeredElement) { 5935 store.context.triggerElements.delete(registeredId); 5936 } 5937 registeredElementIdRef.current = null; 5938 registeredElementRef.current = null; 5939 } 5940 if (element !== null) { 5941 registeredElementIdRef.current = id; 5942 registeredElementRef.current = element; 5943 store.context.triggerElements.add(id, element); 5944 } 5945 }, [store, id]); 5946 } 5947 function useTriggerDataForwarding(triggerId, triggerElementRef, store, stateUpdates) { 5948 const isMountedByThisTrigger = store.useState("isMountedByTrigger", triggerId); 5949 const baseRegisterTrigger = useTriggerRegistration(triggerId, store); 5950 const registerTrigger = useStableCallback((element) => { 5951 baseRegisterTrigger(element); 5952 if (!element || !store.select("open")) { 5953 return; 5954 } 5955 const activeTriggerId = store.select("activeTriggerId"); 5956 if (activeTriggerId === triggerId) { 5957 store.update({ 5958 activeTriggerElement: element, 5959 ...stateUpdates 5960 }); 5961 return; 5962 } 5963 if (activeTriggerId == null) { 5964 store.update({ 5965 activeTriggerId: triggerId, 5966 activeTriggerElement: element, 5967 ...stateUpdates 5968 }); 5969 } 5970 }); 5971 useIsoLayoutEffect(() => { 5972 if (isMountedByThisTrigger) { 5973 store.update({ 5974 activeTriggerElement: triggerElementRef.current, 5975 ...stateUpdates 5976 }); 5977 } 5978 }, [isMountedByThisTrigger, store, triggerElementRef, ...Object.values(stateUpdates)]); 5979 return { 5980 registerTrigger, 5981 isMountedByThisTrigger 5982 }; 5983 } 5984 function useImplicitActiveTrigger(store) { 5985 const open = store.useState("open"); 5986 useIsoLayoutEffect(() => { 5987 if (open && !store.select("activeTriggerId") && store.context.triggerElements.size === 1) { 5988 const iteratorResult = store.context.triggerElements.entries().next(); 5989 if (!iteratorResult.done) { 5990 const [implicitTriggerId, implicitTriggerElement] = iteratorResult.value; 5991 store.update({ 5992 activeTriggerId: implicitTriggerId, 5993 activeTriggerElement: implicitTriggerElement 5994 }); 5995 } 5996 } 5997 }, [open, store]); 5998 } 5999 function useOpenStateTransitions(open, store, onUnmount) { 6000 const { 6001 mounted, 6002 setMounted, 6003 transitionStatus 6004 } = useTransitionStatus(open); 6005 store.useSyncedValues({ 6006 mounted, 6007 transitionStatus 6008 }); 6009 const forceUnmount = useStableCallback(() => { 6010 setMounted(false); 6011 store.update({ 6012 activeTriggerId: null, 6013 activeTriggerElement: null, 6014 mounted: false 6015 }); 6016 onUnmount?.(); 6017 store.context.onOpenChangeComplete?.(false); 6018 }); 6019 const preventUnmountingOnClose = store.useState("preventUnmountingOnClose"); 6020 useOpenChangeComplete({ 6021 enabled: !preventUnmountingOnClose, 6022 open, 6023 ref: store.context.popupRef, 6024 onComplete() { 6025 if (!open) { 6026 forceUnmount(); 6027 } 6028 } 6029 }); 6030 return { 6031 forceUnmount, 6032 transitionStatus 6033 }; 6034 } 6035 6036 // node_modules/@base-ui/react/esm/utils/popups/popupTriggerMap.js 6037 var PopupTriggerMap = class { 6038 constructor() { 6039 this.elementsSet = /* @__PURE__ */ new Set(); 6040 this.idMap = /* @__PURE__ */ new Map(); 6041 } 6042 /** 6043 * Adds a trigger element with the given ID. 6044 * 6045 * Note: The provided element is assumed to not be registered under multiple IDs. 6046 */ 6047 add(id, element) { 6048 const existingElement = this.idMap.get(id); 6049 if (existingElement === element) { 6050 return; 6051 } 6052 if (existingElement !== void 0) { 6053 this.elementsSet.delete(existingElement); 6054 } 6055 this.elementsSet.add(element); 6056 this.idMap.set(id, element); 6057 if (true) { 6058 if (this.elementsSet.size !== this.idMap.size) { 6059 throw new Error("Base UI: A trigger element cannot be registered under multiple IDs in PopupTriggerMap."); 6060 } 6061 } 6062 } 6063 /** 6064 * Removes the trigger element with the given ID. 6065 */ 6066 delete(id) { 6067 const element = this.idMap.get(id); 6068 if (element) { 6069 this.elementsSet.delete(element); 6070 this.idMap.delete(id); 6071 } 6072 } 6073 /** 6074 * Whether the given element is registered as a trigger. 6075 */ 6076 hasElement(element) { 6077 return this.elementsSet.has(element); 6078 } 6079 /** 6080 * Whether there is a registered trigger element matching the given predicate. 6081 */ 6082 hasMatchingElement(predicate) { 6083 for (const element of this.elementsSet) { 6084 if (predicate(element)) { 6085 return true; 6086 } 6087 } 6088 return false; 6089 } 6090 /** 6091 * Returns the trigger element associated with the given ID, or undefined if no such element exists. 6092 */ 6093 getById(id) { 6094 return this.idMap.get(id); 6095 } 6096 /** 6097 * Returns an iterable of all registered trigger entries, where each entry is a tuple of [id, element]. 6098 */ 6099 entries() { 6100 return this.idMap.entries(); 6101 } 6102 /** 6103 * Returns an iterable of all registered trigger elements. 6104 */ 6105 elements() { 6106 return this.elementsSet.values(); 6107 } 6108 /** 6109 * Returns the number of registered trigger elements. 6110 */ 6111 get size() { 6112 return this.idMap.size; 6113 } 6114 }; 6115 6116 // node_modules/@base-ui/react/esm/floating-ui-react/utils/getEmptyRootContext.js 6117 function getEmptyRootContext() { 6118 return new FloatingRootStore({ 6119 open: false, 6120 transitionStatus: void 0, 6121 floatingElement: null, 6122 referenceElement: null, 6123 triggerElements: new PopupTriggerMap(), 6124 floatingId: "", 6125 syncOnly: false, 6126 nested: false, 6127 onOpenChange: void 0 6128 }); 6129 } 6130 6131 // node_modules/@base-ui/react/esm/utils/popups/store.js 6132 function createInitialPopupStoreState() { 6133 return { 6134 open: false, 6135 openProp: void 0, 6136 mounted: false, 6137 transitionStatus: void 0, 6138 floatingRootContext: getEmptyRootContext(), 6139 preventUnmountingOnClose: false, 6140 payload: void 0, 6141 activeTriggerId: null, 6142 activeTriggerElement: null, 6143 triggerIdProp: void 0, 6144 popupElement: null, 6145 positionerElement: null, 6146 activeTriggerProps: EMPTY_OBJECT, 6147 inactiveTriggerProps: EMPTY_OBJECT, 6148 popupProps: EMPTY_OBJECT 6149 }; 6150 } 6151 var activeTriggerIdSelector = createSelector((state) => state.triggerIdProp ?? state.activeTriggerId); 6152 var popupStoreSelectors = { 6153 open: createSelector((state) => state.openProp ?? state.open), 6154 mounted: createSelector((state) => state.mounted), 6155 transitionStatus: createSelector((state) => state.transitionStatus), 6156 floatingRootContext: createSelector((state) => state.floatingRootContext), 6157 preventUnmountingOnClose: createSelector((state) => state.preventUnmountingOnClose), 6158 payload: createSelector((state) => state.payload), 6159 activeTriggerId: activeTriggerIdSelector, 6160 activeTriggerElement: createSelector((state) => state.mounted ? state.activeTriggerElement : null), 6161 /** 6162 * Whether the trigger with the given ID was used to open the popup. 6163 */ 6164 isTriggerActive: createSelector((state, triggerId) => triggerId !== void 0 && activeTriggerIdSelector(state) === triggerId), 6165 /** 6166 * Whether the popup is open and was activated by a trigger with the given ID. 6167 */ 6168 isOpenedByTrigger: createSelector((state, triggerId) => triggerId !== void 0 && activeTriggerIdSelector(state) === triggerId && state.open), 6169 /** 6170 * Whether the popup is mounted and was activated by a trigger with the given ID. 6171 */ 6172 isMountedByTrigger: createSelector((state, triggerId) => triggerId !== void 0 && activeTriggerIdSelector(state) === triggerId && state.mounted), 6173 triggerProps: createSelector((state, isActive) => isActive ? state.activeTriggerProps : state.inactiveTriggerProps), 6174 popupProps: createSelector((state) => state.popupProps), 6175 popupElement: createSelector((state) => state.popupElement), 6176 positionerElement: createSelector((state) => state.positionerElement) 6177 }; 6178 6179 // node_modules/@base-ui/react/esm/floating-ui-react/hooks/useFloatingRootContext.js 6180 function useFloatingRootContext(options) { 6181 const { 6182 open = false, 6183 onOpenChange, 6184 elements = {} 6185 } = options; 6186 const floatingId = useId(); 6187 const nested = useFloatingParentNodeId() != null; 6188 if (true) { 6189 const optionDomReference = elements.reference; 6190 if (optionDomReference && !isElement(optionDomReference)) { 6191 console.error("Cannot pass a virtual element to the `elements.reference` option,", "as it must be a real DOM element. Use `context.setPositionReference()`", "instead."); 6192 } 6193 } 6194 const store = useRefWithInit(() => new FloatingRootStore({ 6195 open, 6196 transitionStatus: void 0, 6197 onOpenChange, 6198 referenceElement: elements.reference ?? null, 6199 floatingElement: elements.floating ?? null, 6200 triggerElements: new PopupTriggerMap(), 6201 floatingId, 6202 syncOnly: false, 6203 nested 6204 })).current; 6205 useIsoLayoutEffect(() => { 6206 const valuesToSync = { 6207 open, 6208 floatingId 6209 }; 6210 if (elements.reference !== void 0) { 6211 valuesToSync.referenceElement = elements.reference; 6212 valuesToSync.domReferenceElement = isElement(elements.reference) ? elements.reference : null; 6213 } 6214 if (elements.floating !== void 0) { 6215 valuesToSync.floatingElement = elements.floating; 6216 } 6217 store.update(valuesToSync); 6218 }, [open, floatingId, elements.reference, elements.floating, store]); 6219 store.context.onOpenChange = onOpenChange; 6220 store.context.nested = nested; 6221 return store; 6222 } 6223 6224 // node_modules/@base-ui/react/esm/floating-ui-react/hooks/useFloating.js 6225 function useFloating2(options = {}) { 6226 const { 6227 nodeId, 6228 externalTree 6229 } = options; 6230 const internalRootStore = useFloatingRootContext(options); 6231 const rootContext = options.rootContext || internalRootStore; 6232 const rootContextElements = { 6233 reference: rootContext.useState("referenceElement"), 6234 floating: rootContext.useState("floatingElement"), 6235 domReference: rootContext.useState("domReferenceElement") 6236 }; 6237 const [positionReference, setPositionReferenceRaw] = React33.useState(null); 6238 const domReferenceRef = React33.useRef(null); 6239 const tree = useFloatingTree(externalTree); 6240 useIsoLayoutEffect(() => { 6241 if (rootContextElements.domReference) { 6242 domReferenceRef.current = rootContextElements.domReference; 6243 } 6244 }, [rootContextElements.domReference]); 6245 const position = useFloating({ 6246 ...options, 6247 elements: { 6248 ...rootContextElements, 6249 ...positionReference && { 6250 reference: positionReference 6251 } 6252 } 6253 }); 6254 const setPositionReference = React33.useCallback((node) => { 6255 const computedPositionReference = isElement(node) ? { 6256 getBoundingClientRect: () => node.getBoundingClientRect(), 6257 getClientRects: () => node.getClientRects(), 6258 contextElement: node 6259 } : node; 6260 setPositionReferenceRaw(computedPositionReference); 6261 position.refs.setReference(computedPositionReference); 6262 }, [position.refs]); 6263 const [localDomReference, setLocalDomReference] = React33.useState(void 0); 6264 const [localFloatingElement, setLocalFloatingElement] = React33.useState(null); 6265 rootContext.useSyncedValue("referenceElement", localDomReference ?? null); 6266 const localDomReferenceElement = isElement(localDomReference) ? localDomReference : null; 6267 rootContext.useSyncedValue("domReferenceElement", localDomReference === void 0 ? rootContextElements.domReference : localDomReferenceElement); 6268 rootContext.useSyncedValue("floatingElement", localFloatingElement); 6269 const setReference = React33.useCallback((node) => { 6270 if (isElement(node) || node === null) { 6271 domReferenceRef.current = node; 6272 setLocalDomReference(node); 6273 } 6274 if (isElement(position.refs.reference.current) || position.refs.reference.current === null || // Don't allow setting virtual elements using the old technique back to 6275 // `null` to support `positionReference` + an unstable `reference` 6276 // callback ref. 6277 node !== null && !isElement(node)) { 6278 position.refs.setReference(node); 6279 } 6280 }, [position.refs, setLocalDomReference]); 6281 const setFloating = React33.useCallback((node) => { 6282 setLocalFloatingElement(node); 6283 position.refs.setFloating(node); 6284 }, [position.refs]); 6285 const refs = React33.useMemo(() => ({ 6286 ...position.refs, 6287 setReference, 6288 setFloating, 6289 setPositionReference, 6290 domReference: domReferenceRef 6291 }), [position.refs, setReference, setFloating, setPositionReference]); 6292 const elements = React33.useMemo(() => ({ 6293 ...position.elements, 6294 domReference: rootContextElements.domReference 6295 }), [position.elements, rootContextElements.domReference]); 6296 const open = rootContext.useState("open"); 6297 const floatingId = rootContext.useState("floatingId"); 6298 const context = React33.useMemo(() => ({ 6299 ...position, 6300 dataRef: rootContext.context.dataRef, 6301 open, 6302 onOpenChange: rootContext.setOpen, 6303 events: rootContext.context.events, 6304 floatingId, 6305 refs, 6306 elements, 6307 nodeId, 6308 rootStore: rootContext 6309 }), [position, refs, elements, nodeId, rootContext, open, floatingId]); 6310 useIsoLayoutEffect(() => { 6311 rootContext.context.dataRef.current.floatingContext = context; 6312 const node = tree?.nodesRef.current.find((n2) => n2.id === nodeId); 6313 if (node) { 6314 node.context = context; 6315 } 6316 }); 6317 return React33.useMemo(() => ({ 6318 ...position, 6319 context, 6320 refs, 6321 elements, 6322 rootStore: rootContext 6323 }), [position, refs, elements, context, rootContext]); 6324 } 6325 6326 // node_modules/@base-ui/react/esm/floating-ui-react/hooks/useSyncedFloatingRootContext.js 6327 function useSyncedFloatingRootContext(options) { 6328 const { 6329 popupStore, 6330 treatPopupAsFloatingElement = false, 6331 onOpenChange 6332 } = options; 6333 const floatingId = useId(); 6334 const nested = useFloatingParentNodeId() != null; 6335 const open = popupStore.useState("open"); 6336 const referenceElement = popupStore.useState("activeTriggerElement"); 6337 const floatingElement = popupStore.useState(treatPopupAsFloatingElement ? "popupElement" : "positionerElement"); 6338 const triggerElements = popupStore.context.triggerElements; 6339 const store = useRefWithInit(() => new FloatingRootStore({ 6340 open, 6341 transitionStatus: void 0, 6342 referenceElement, 6343 floatingElement, 6344 triggerElements, 6345 onOpenChange, 6346 floatingId, 6347 syncOnly: true, 6348 nested 6349 })).current; 6350 useIsoLayoutEffect(() => { 6351 const valuesToSync = { 6352 open, 6353 floatingId, 6354 referenceElement, 6355 floatingElement 6356 }; 6357 if (isElement(referenceElement)) { 6358 valuesToSync.domReferenceElement = referenceElement; 6359 } 6360 if (store.state.positionReference === store.state.referenceElement) { 6361 valuesToSync.positionReference = referenceElement; 6362 } 6363 store.update(valuesToSync); 6364 }, [open, floatingId, referenceElement, floatingElement, store]); 6365 store.context.onOpenChange = onOpenChange; 6366 store.context.nested = nested; 6367 return store; 6368 } 6369 6370 // node_modules/@base-ui/react/esm/floating-ui-react/hooks/useFocus.js 6371 var React34 = __toESM(require_react(), 1); 6372 var isMacSafari = isMac && isSafari; 6373 function useFocus(context, props = {}) { 6374 const store = "rootStore" in context ? context.rootStore : context; 6375 const { 6376 events, 6377 dataRef 6378 } = store.context; 6379 const { 6380 enabled = true, 6381 delay 6382 } = props; 6383 const blockFocusRef = React34.useRef(false); 6384 const blockedReferenceRef = React34.useRef(null); 6385 const timeout = useTimeout(); 6386 const keyboardModalityRef = React34.useRef(true); 6387 React34.useEffect(() => { 6388 const domReference = store.select("domReferenceElement"); 6389 if (!enabled) { 6390 return void 0; 6391 } 6392 const win = getWindow(domReference); 6393 function onBlur() { 6394 const currentDomReference = store.select("domReferenceElement"); 6395 if (!store.select("open") && isHTMLElement(currentDomReference) && currentDomReference === activeElement(ownerDocument(currentDomReference))) { 6396 blockFocusRef.current = true; 6397 } 6398 } 6399 function onKeyDown() { 6400 keyboardModalityRef.current = true; 6401 } 6402 function onPointerDown() { 6403 keyboardModalityRef.current = false; 6404 } 6405 return mergeCleanups(addEventListener(win, "blur", onBlur), isMacSafari && addEventListener(win, "keydown", onKeyDown, true), isMacSafari && addEventListener(win, "pointerdown", onPointerDown, true)); 6406 }, [store, enabled]); 6407 React34.useEffect(() => { 6408 if (!enabled) { 6409 return void 0; 6410 } 6411 function onOpenChangeLocal(details) { 6412 if (details.reason === reason_parts_exports.triggerPress || details.reason === reason_parts_exports.escapeKey) { 6413 const referenceElement = store.select("domReferenceElement"); 6414 if (isElement(referenceElement)) { 6415 blockedReferenceRef.current = referenceElement; 6416 blockFocusRef.current = true; 6417 } 6418 } 6419 } 6420 events.on("openchange", onOpenChangeLocal); 6421 return () => { 6422 events.off("openchange", onOpenChangeLocal); 6423 }; 6424 }, [events, enabled, store]); 6425 const reference = React34.useMemo(() => ({ 6426 onMouseLeave() { 6427 blockFocusRef.current = false; 6428 blockedReferenceRef.current = null; 6429 }, 6430 onFocus(event) { 6431 const focusTarget = event.currentTarget; 6432 if (blockFocusRef.current) { 6433 if (blockedReferenceRef.current === focusTarget) { 6434 return; 6435 } 6436 blockFocusRef.current = false; 6437 blockedReferenceRef.current = null; 6438 } 6439 const target = getTarget(event.nativeEvent); 6440 if (isElement(target)) { 6441 if (isMacSafari && !event.relatedTarget) { 6442 if (!keyboardModalityRef.current && !isTypeableElement(target)) { 6443 return; 6444 } 6445 } else if (!matchesFocusVisible(target)) { 6446 return; 6447 } 6448 } 6449 const movedFromOtherEnabledTrigger = isTargetInsideEnabledTrigger(event.relatedTarget, store.context.triggerElements); 6450 const { 6451 nativeEvent, 6452 currentTarget 6453 } = event; 6454 const delayValue = typeof delay === "function" ? delay() : delay; 6455 if (store.select("open") && movedFromOtherEnabledTrigger || delayValue === 0 || delayValue === void 0) { 6456 store.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerFocus, nativeEvent, currentTarget)); 6457 return; 6458 } 6459 timeout.start(delayValue, () => { 6460 if (blockFocusRef.current) { 6461 return; 6462 } 6463 store.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerFocus, nativeEvent, currentTarget)); 6464 }); 6465 }, 6466 onBlur(event) { 6467 blockFocusRef.current = false; 6468 blockedReferenceRef.current = null; 6469 const relatedTarget = event.relatedTarget; 6470 const nativeEvent = event.nativeEvent; 6471 const movedToFocusGuard = isElement(relatedTarget) && relatedTarget.hasAttribute(createAttribute("focus-guard")) && relatedTarget.getAttribute("data-type") === "outside"; 6472 timeout.start(0, () => { 6473 const domReference = store.select("domReferenceElement"); 6474 const activeEl = activeElement(ownerDocument(domReference)); 6475 if (!relatedTarget && activeEl === domReference) { 6476 return; 6477 } 6478 if (contains(dataRef.current.floatingContext?.refs.floating.current, activeEl) || contains(domReference, activeEl) || movedToFocusGuard) { 6479 return; 6480 } 6481 const nextFocusedElement = relatedTarget ?? activeEl; 6482 if (isTargetInsideEnabledTrigger(nextFocusedElement, store.context.triggerElements)) { 6483 return; 6484 } 6485 store.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerFocus, nativeEvent)); 6486 }); 6487 } 6488 }), [dataRef, store, timeout, delay]); 6489 return React34.useMemo(() => enabled ? { 6490 reference, 6491 trigger: reference 6492 } : {}, [enabled, reference]); 6493 } 6494 6495 // node_modules/@base-ui/react/esm/floating-ui-react/hooks/useHoverFloatingInteraction.js 6496 var React35 = __toESM(require_react(), 1); 6497 6498 // node_modules/@base-ui/react/esm/floating-ui-react/hooks/useHoverInteractionSharedState.js 6499 var HoverInteraction = class _HoverInteraction { 6500 constructor() { 6501 this.pointerType = void 0; 6502 this.interactedInside = false; 6503 this.handler = void 0; 6504 this.blockMouseMove = true; 6505 this.performedPointerEventsMutation = false; 6506 this.pointerEventsScopeElement = null; 6507 this.pointerEventsReferenceElement = null; 6508 this.pointerEventsFloatingElement = null; 6509 this.restTimeoutPending = false; 6510 this.openChangeTimeout = new Timeout(); 6511 this.restTimeout = new Timeout(); 6512 this.handleCloseOptions = void 0; 6513 } 6514 static create() { 6515 return new _HoverInteraction(); 6516 } 6517 dispose = () => { 6518 this.openChangeTimeout.clear(); 6519 this.restTimeout.clear(); 6520 }; 6521 disposeEffect = () => { 6522 return this.dispose; 6523 }; 6524 }; 6525 var pointerEventsMutationOwnerByScopeElement = /* @__PURE__ */ new WeakMap(); 6526 function clearSafePolygonPointerEventsMutation(instance) { 6527 if (!instance.performedPointerEventsMutation) { 6528 return; 6529 } 6530 const scopeElement = instance.pointerEventsScopeElement; 6531 if (scopeElement && pointerEventsMutationOwnerByScopeElement.get(scopeElement) === instance) { 6532 instance.pointerEventsScopeElement?.style.removeProperty("pointer-events"); 6533 instance.pointerEventsReferenceElement?.style.removeProperty("pointer-events"); 6534 instance.pointerEventsFloatingElement?.style.removeProperty("pointer-events"); 6535 pointerEventsMutationOwnerByScopeElement.delete(scopeElement); 6536 } 6537 instance.performedPointerEventsMutation = false; 6538 instance.pointerEventsScopeElement = null; 6539 instance.pointerEventsReferenceElement = null; 6540 instance.pointerEventsFloatingElement = null; 6541 } 6542 function applySafePolygonPointerEventsMutation(instance, options) { 6543 const { 6544 scopeElement, 6545 referenceElement, 6546 floatingElement 6547 } = options; 6548 const existingOwner = pointerEventsMutationOwnerByScopeElement.get(scopeElement); 6549 if (existingOwner && existingOwner !== instance) { 6550 clearSafePolygonPointerEventsMutation(existingOwner); 6551 } 6552 clearSafePolygonPointerEventsMutation(instance); 6553 instance.performedPointerEventsMutation = true; 6554 instance.pointerEventsScopeElement = scopeElement; 6555 instance.pointerEventsReferenceElement = referenceElement; 6556 instance.pointerEventsFloatingElement = floatingElement; 6557 pointerEventsMutationOwnerByScopeElement.set(scopeElement, instance); 6558 scopeElement.style.pointerEvents = "none"; 6559 referenceElement.style.pointerEvents = "auto"; 6560 floatingElement.style.pointerEvents = "auto"; 6561 } 6562 function useHoverInteractionSharedState(store) { 6563 const instance = useRefWithInit(HoverInteraction.create).current; 6564 const data = store.context.dataRef.current; 6565 if (!data.hoverInteractionState) { 6566 data.hoverInteractionState = instance; 6567 } 6568 useOnMount(data.hoverInteractionState.disposeEffect); 6569 return data.hoverInteractionState; 6570 } 6571 6572 // node_modules/@base-ui/react/esm/floating-ui-react/hooks/useHoverFloatingInteraction.js 6573 function useHoverFloatingInteraction(context, parameters = {}) { 6574 const store = "rootStore" in context ? context.rootStore : context; 6575 const open = store.useState("open"); 6576 const floatingElement = store.useState("floatingElement"); 6577 const domReferenceElement = store.useState("domReferenceElement"); 6578 const { 6579 dataRef 6580 } = store.context; 6581 const { 6582 enabled = true, 6583 closeDelay: closeDelayProp = 0, 6584 nodeId: nodeIdProp 6585 } = parameters; 6586 const instance = useHoverInteractionSharedState(store); 6587 const tree = useFloatingTree(); 6588 const parentId = useFloatingParentNodeId(); 6589 const isClickLikeOpenEvent2 = useStableCallback(() => { 6590 return isClickLikeOpenEvent(dataRef.current.openEvent?.type, instance.interactedInside); 6591 }); 6592 const isHoverOpen = useStableCallback(() => { 6593 const type = dataRef.current.openEvent?.type; 6594 return type?.includes("mouse") && type !== "mousedown"; 6595 }); 6596 const isRelatedTargetInsideEnabledTrigger = useStableCallback((target) => { 6597 return isTargetInsideEnabledTrigger(target, store.context.triggerElements); 6598 }); 6599 const closeWithDelay = React35.useCallback((event) => { 6600 const closeDelay = getDelay(closeDelayProp, "close", instance.pointerType); 6601 const close = () => { 6602 store.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerHover, event)); 6603 tree?.events.emit("floating.closed", event); 6604 }; 6605 if (closeDelay) { 6606 instance.openChangeTimeout.start(closeDelay, close); 6607 } else { 6608 instance.openChangeTimeout.clear(); 6609 close(); 6610 } 6611 }, [closeDelayProp, store, instance, tree]); 6612 const clearPointerEvents = useStableCallback(() => { 6613 clearSafePolygonPointerEventsMutation(instance); 6614 }); 6615 const handleInteractInside = useStableCallback((event) => { 6616 const target = getTarget(event); 6617 if (!isInteractiveElement(target)) { 6618 instance.interactedInside = false; 6619 return; 6620 } 6621 instance.interactedInside = target?.closest("[aria-haspopup]") != null; 6622 }); 6623 useIsoLayoutEffect(() => { 6624 if (!open) { 6625 instance.pointerType = void 0; 6626 instance.restTimeoutPending = false; 6627 instance.interactedInside = false; 6628 clearPointerEvents(); 6629 } 6630 }, [open, instance, clearPointerEvents]); 6631 React35.useEffect(() => { 6632 return clearPointerEvents; 6633 }, [clearPointerEvents]); 6634 useIsoLayoutEffect(() => { 6635 if (!enabled) { 6636 return void 0; 6637 } 6638 if (open && instance.handleCloseOptions?.blockPointerEvents && isHoverOpen() && isElement(domReferenceElement) && floatingElement) { 6639 const ref = domReferenceElement; 6640 const floatingEl = floatingElement; 6641 const doc = ownerDocument(floatingElement); 6642 const parentFloating = tree?.nodesRef.current.find((node) => node.id === parentId)?.context?.elements.floating; 6643 if (parentFloating) { 6644 parentFloating.style.pointerEvents = ""; 6645 } 6646 const scopeElement = instance.handleCloseOptions?.getScope?.() ?? instance.pointerEventsScopeElement ?? parentFloating ?? ref.closest("[data-rootownerid]") ?? doc.body; 6647 applySafePolygonPointerEventsMutation(instance, { 6648 scopeElement, 6649 referenceElement: ref, 6650 floatingElement: floatingEl 6651 }); 6652 return () => { 6653 clearPointerEvents(); 6654 }; 6655 } 6656 return void 0; 6657 }, [enabled, open, domReferenceElement, floatingElement, instance, isHoverOpen, tree, parentId, clearPointerEvents]); 6658 const childClosedTimeout = useTimeout(); 6659 React35.useEffect(() => { 6660 if (!enabled) { 6661 return void 0; 6662 } 6663 function onFloatingMouseEnter() { 6664 instance.openChangeTimeout.clear(); 6665 childClosedTimeout.clear(); 6666 tree?.events.off("floating.closed", onNodeClosed); 6667 clearPointerEvents(); 6668 } 6669 function onFloatingMouseLeave(event) { 6670 if (tree && parentId && getNodeChildren(tree.nodesRef.current, parentId).length > 0) { 6671 tree.events.on("floating.closed", onNodeClosed); 6672 return; 6673 } 6674 if (isRelatedTargetInsideEnabledTrigger(event.relatedTarget)) { 6675 return; 6676 } 6677 const currentNodeId = dataRef.current.floatingContext?.nodeId ?? nodeIdProp; 6678 const relatedTarget = event.relatedTarget; 6679 const isMovingIntoDescendantFloating = tree && currentNodeId && isElement(relatedTarget) && getNodeChildren(tree.nodesRef.current, currentNodeId, false).some((node) => contains(node.context?.elements.floating, relatedTarget)); 6680 if (isMovingIntoDescendantFloating) { 6681 return; 6682 } 6683 if (instance.handler) { 6684 instance.handler(event); 6685 return; 6686 } 6687 clearPointerEvents(); 6688 if (!isClickLikeOpenEvent2()) { 6689 closeWithDelay(event); 6690 } 6691 } 6692 function onNodeClosed(event) { 6693 if (!tree || !parentId || getNodeChildren(tree.nodesRef.current, parentId).length > 0) { 6694 return; 6695 } 6696 childClosedTimeout.start(0, () => { 6697 tree.events.off("floating.closed", onNodeClosed); 6698 store.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerHover, event)); 6699 tree.events.emit("floating.closed", event); 6700 }); 6701 } 6702 const floating = floatingElement; 6703 return mergeCleanups(floating && addEventListener(floating, "mouseenter", onFloatingMouseEnter), floating && addEventListener(floating, "mouseleave", onFloatingMouseLeave), floating && addEventListener(floating, "pointerdown", handleInteractInside, true), () => { 6704 tree?.events.off("floating.closed", onNodeClosed); 6705 }); 6706 }, [enabled, floatingElement, store, dataRef, nodeIdProp, isClickLikeOpenEvent2, isRelatedTargetInsideEnabledTrigger, closeWithDelay, clearPointerEvents, handleInteractInside, instance, tree, parentId, childClosedTimeout]); 6707 } 6708 6709 // node_modules/@base-ui/react/esm/floating-ui-react/hooks/useHoverReferenceInteraction.js 6710 var React36 = __toESM(require_react(), 1); 6711 var ReactDOM4 = __toESM(require_react_dom(), 1); 6712 var EMPTY_REF = { 6713 current: null 6714 }; 6715 function useHoverReferenceInteraction(context, props = {}) { 6716 const store = "rootStore" in context ? context.rootStore : context; 6717 const { 6718 dataRef, 6719 events 6720 } = store.context; 6721 const { 6722 enabled = true, 6723 delay = 0, 6724 handleClose = null, 6725 mouseOnly = false, 6726 restMs = 0, 6727 move = true, 6728 triggerElementRef = EMPTY_REF, 6729 externalTree, 6730 isActiveTrigger = true, 6731 getHandleCloseContext, 6732 isClosing 6733 } = props; 6734 const tree = useFloatingTree(externalTree); 6735 const instance = useHoverInteractionSharedState(store); 6736 const isHoverCloseActiveRef = React36.useRef(false); 6737 const handleCloseRef = useValueAsRef(handleClose); 6738 const delayRef = useValueAsRef(delay); 6739 const restMsRef = useValueAsRef(restMs); 6740 const enabledRef = useValueAsRef(enabled); 6741 const isClosingRef = useValueAsRef(isClosing); 6742 if (isActiveTrigger) { 6743 instance.handleCloseOptions = handleCloseRef.current?.__options; 6744 } 6745 const isClickLikeOpenEvent2 = useStableCallback(() => { 6746 return isClickLikeOpenEvent(dataRef.current.openEvent?.type, instance.interactedInside); 6747 }); 6748 const isRelatedTargetInsideEnabledTrigger = useStableCallback((target) => { 6749 return isTargetInsideEnabledTrigger(target, store.context.triggerElements); 6750 }); 6751 const isOverInactiveTrigger = useStableCallback((currentDomReference, currentTarget, target) => { 6752 const allTriggers = store.context.triggerElements; 6753 if (allTriggers.hasElement(currentTarget)) { 6754 return !currentDomReference || !contains(currentDomReference, currentTarget); 6755 } 6756 if (!isElement(target)) { 6757 return false; 6758 } 6759 const targetElement = target; 6760 return allTriggers.hasMatchingElement((trigger) => contains(trigger, targetElement)) && (!currentDomReference || !contains(currentDomReference, targetElement)); 6761 }); 6762 const closeWithDelay = useStableCallback((event, runElseBranch = true) => { 6763 const closeDelay = getDelay(delayRef.current, "close", instance.pointerType); 6764 if (closeDelay) { 6765 instance.openChangeTimeout.start(closeDelay, () => { 6766 store.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerHover, event)); 6767 tree?.events.emit("floating.closed", event); 6768 }); 6769 } else if (runElseBranch) { 6770 instance.openChangeTimeout.clear(); 6771 store.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerHover, event)); 6772 tree?.events.emit("floating.closed", event); 6773 } 6774 }); 6775 const cleanupMouseMoveHandler = useStableCallback(() => { 6776 if (!instance.handler) { 6777 return; 6778 } 6779 const doc = ownerDocument(store.select("domReferenceElement")); 6780 doc.removeEventListener("mousemove", instance.handler); 6781 instance.handler = void 0; 6782 }); 6783 const clearPointerEvents = useStableCallback(() => { 6784 clearSafePolygonPointerEventsMutation(instance); 6785 }); 6786 React36.useEffect(() => cleanupMouseMoveHandler, [cleanupMouseMoveHandler]); 6787 React36.useEffect(() => { 6788 if (!enabled) { 6789 return void 0; 6790 } 6791 function onOpenChangeLocal(details) { 6792 if (!details.open) { 6793 isHoverCloseActiveRef.current = details.reason === reason_parts_exports.triggerHover; 6794 cleanupMouseMoveHandler(); 6795 instance.openChangeTimeout.clear(); 6796 instance.restTimeout.clear(); 6797 instance.blockMouseMove = true; 6798 instance.restTimeoutPending = false; 6799 } else { 6800 isHoverCloseActiveRef.current = false; 6801 } 6802 } 6803 events.on("openchange", onOpenChangeLocal); 6804 return () => { 6805 events.off("openchange", onOpenChangeLocal); 6806 }; 6807 }, [enabled, events, instance, cleanupMouseMoveHandler]); 6808 React36.useEffect(() => { 6809 if (!enabled) { 6810 return void 0; 6811 } 6812 const trigger = triggerElementRef.current ?? (isActiveTrigger ? store.select("domReferenceElement") : null); 6813 if (!isElement(trigger)) { 6814 return void 0; 6815 } 6816 function onMouseEnter(event) { 6817 instance.openChangeTimeout.clear(); 6818 instance.blockMouseMove = false; 6819 if (mouseOnly && !isMouseLikePointerType(instance.pointerType)) { 6820 return; 6821 } 6822 const restMsValue = getRestMs(restMsRef.current); 6823 const openDelay = getDelay(delayRef.current, "open", instance.pointerType); 6824 const eventTarget = getTarget(event); 6825 const currentTarget = event.currentTarget ?? null; 6826 const currentDomReference = store.select("domReferenceElement"); 6827 let triggerNode = currentTarget; 6828 if (isElement(eventTarget) && !store.context.triggerElements.hasElement(eventTarget)) { 6829 for (const triggerElement of store.context.triggerElements.elements()) { 6830 if (contains(triggerElement, eventTarget)) { 6831 triggerNode = triggerElement; 6832 break; 6833 } 6834 } 6835 } 6836 if (isElement(currentTarget) && isElement(currentDomReference) && !store.context.triggerElements.hasElement(currentTarget) && contains(currentTarget, currentDomReference)) { 6837 triggerNode = currentDomReference; 6838 } 6839 const isOverInactive = triggerNode == null ? false : isOverInactiveTrigger(currentDomReference, triggerNode, eventTarget); 6840 const isOpen = store.select("open"); 6841 const isInClosingTransition = isClosingRef.current?.() ?? store.select("transitionStatus") === "ending"; 6842 const isHoverCloseTransition = !isOpen && isInClosingTransition && isHoverCloseActiveRef.current; 6843 const isReenteringSameTriggerDuringCloseTransition = !isOverInactive && isElement(triggerNode) && isElement(currentDomReference) && contains(currentDomReference, triggerNode) && isHoverCloseTransition; 6844 const isRestOnlyDelay = restMsValue > 0 && !openDelay; 6845 const shouldOpenImmediately = isOverInactive && (isOpen || isHoverCloseTransition) || isReenteringSameTriggerDuringCloseTransition; 6846 const shouldOpen = !isOpen || isOverInactive; 6847 if (shouldOpenImmediately) { 6848 store.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerHover, event, triggerNode)); 6849 return; 6850 } 6851 if (isRestOnlyDelay) { 6852 return; 6853 } 6854 if (openDelay) { 6855 instance.openChangeTimeout.start(openDelay, () => { 6856 if (shouldOpen) { 6857 store.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerHover, event, triggerNode)); 6858 } 6859 }); 6860 } else if (shouldOpen) { 6861 store.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerHover, event, triggerNode)); 6862 } 6863 } 6864 function onMouseLeave(event) { 6865 if (isClickLikeOpenEvent2()) { 6866 clearPointerEvents(); 6867 return; 6868 } 6869 cleanupMouseMoveHandler(); 6870 const domReferenceElement = store.select("domReferenceElement"); 6871 const doc = ownerDocument(domReferenceElement); 6872 instance.restTimeout.clear(); 6873 instance.restTimeoutPending = false; 6874 const handleCloseContextBase = dataRef.current.floatingContext ?? getHandleCloseContext?.(); 6875 const ignoreRelatedTargetTrigger = isRelatedTargetInsideEnabledTrigger(event.relatedTarget); 6876 if (ignoreRelatedTargetTrigger) { 6877 return; 6878 } 6879 if (handleCloseRef.current && handleCloseContextBase) { 6880 if (!store.select("open")) { 6881 instance.openChangeTimeout.clear(); 6882 } 6883 const currentTrigger = triggerElementRef.current; 6884 instance.handler = handleCloseRef.current({ 6885 ...handleCloseContextBase, 6886 tree, 6887 x: event.clientX, 6888 y: event.clientY, 6889 onClose() { 6890 clearPointerEvents(); 6891 cleanupMouseMoveHandler(); 6892 if (enabledRef.current && !isClickLikeOpenEvent2() && currentTrigger === store.select("domReferenceElement")) { 6893 closeWithDelay(event, true); 6894 } 6895 } 6896 }); 6897 doc.addEventListener("mousemove", instance.handler); 6898 instance.handler(event); 6899 return; 6900 } 6901 const shouldClose = instance.pointerType === "touch" ? !contains(store.select("floatingElement"), event.relatedTarget) : true; 6902 if (shouldClose) { 6903 closeWithDelay(event); 6904 } 6905 } 6906 if (move) { 6907 return mergeCleanups(addEventListener(trigger, "mousemove", onMouseEnter, { 6908 once: true 6909 }), addEventListener(trigger, "mouseenter", onMouseEnter), addEventListener(trigger, "mouseleave", onMouseLeave)); 6910 } 6911 return mergeCleanups(addEventListener(trigger, "mouseenter", onMouseEnter), addEventListener(trigger, "mouseleave", onMouseLeave)); 6912 }, [cleanupMouseMoveHandler, clearPointerEvents, dataRef, delayRef, closeWithDelay, store, enabled, handleCloseRef, instance, isActiveTrigger, isOverInactiveTrigger, isClickLikeOpenEvent2, isRelatedTargetInsideEnabledTrigger, mouseOnly, move, restMsRef, triggerElementRef, tree, enabledRef, getHandleCloseContext, isClosingRef]); 6913 return React36.useMemo(() => { 6914 if (!enabled) { 6915 return void 0; 6916 } 6917 function setPointerRef(event) { 6918 instance.pointerType = event.pointerType; 6919 } 6920 return { 6921 onPointerDown: setPointerRef, 6922 onPointerEnter: setPointerRef, 6923 onMouseMove(event) { 6924 const { 6925 nativeEvent 6926 } = event; 6927 const trigger = event.currentTarget; 6928 const currentDomReference = store.select("domReferenceElement"); 6929 const currentOpen = store.select("open"); 6930 const isOverInactive = isOverInactiveTrigger(currentDomReference, trigger, event.target); 6931 if (mouseOnly && !isMouseLikePointerType(instance.pointerType)) { 6932 return; 6933 } 6934 if (currentOpen && isOverInactive && instance.handleCloseOptions?.blockPointerEvents) { 6935 const floatingElement = store.select("floatingElement"); 6936 if (floatingElement) { 6937 const scopeElement = instance.handleCloseOptions?.getScope?.() ?? trigger.ownerDocument.body; 6938 applySafePolygonPointerEventsMutation(instance, { 6939 scopeElement, 6940 referenceElement: trigger, 6941 floatingElement 6942 }); 6943 } 6944 } 6945 const restMsValue = getRestMs(restMsRef.current); 6946 if (currentOpen && !isOverInactive || restMsValue === 0) { 6947 return; 6948 } 6949 if (!isOverInactive && instance.restTimeoutPending && event.movementX ** 2 + event.movementY ** 2 < 2) { 6950 return; 6951 } 6952 instance.restTimeout.clear(); 6953 function handleMouseMove() { 6954 instance.restTimeoutPending = false; 6955 if (isClickLikeOpenEvent2()) { 6956 return; 6957 } 6958 const latestOpen = store.select("open"); 6959 if (!instance.blockMouseMove && (!latestOpen || isOverInactive)) { 6960 store.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerHover, nativeEvent, trigger)); 6961 } 6962 } 6963 if (instance.pointerType === "touch") { 6964 ReactDOM4.flushSync(() => { 6965 handleMouseMove(); 6966 }); 6967 } else if (isOverInactive && currentOpen) { 6968 handleMouseMove(); 6969 } else { 6970 instance.restTimeoutPending = true; 6971 instance.restTimeout.start(restMsValue, handleMouseMove); 6972 } 6973 } 6974 }; 6975 }, [enabled, instance, isClickLikeOpenEvent2, isOverInactiveTrigger, mouseOnly, store, restMsRef]); 6976 } 6977 6978 // node_modules/@base-ui/react/esm/floating-ui-react/hooks/useInteractions.js 6979 var React37 = __toESM(require_react(), 1); 6980 function useInteractions(propsList = []) { 6981 const referenceDeps = propsList.map((key) => key?.reference); 6982 const floatingDeps = propsList.map((key) => key?.floating); 6983 const itemDeps = propsList.map((key) => key?.item); 6984 const triggerDeps = propsList.map((key) => key?.trigger); 6985 const getReferenceProps = React37.useCallback( 6986 (userProps) => mergeProps2(userProps, propsList, "reference"), 6987 // eslint-disable-next-line react-hooks/exhaustive-deps 6988 referenceDeps 6989 ); 6990 const getFloatingProps = React37.useCallback( 6991 (userProps) => mergeProps2(userProps, propsList, "floating"), 6992 // eslint-disable-next-line react-hooks/exhaustive-deps 6993 floatingDeps 6994 ); 6995 const getItemProps = React37.useCallback( 6996 (userProps) => mergeProps2(userProps, propsList, "item"), 6997 // eslint-disable-next-line react-hooks/exhaustive-deps 6998 itemDeps 6999 ); 7000 const getTriggerProps = React37.useCallback( 7001 (userProps) => mergeProps2(userProps, propsList, "trigger"), 7002 // eslint-disable-next-line react-hooks/exhaustive-deps 7003 triggerDeps 7004 ); 7005 return React37.useMemo(() => ({ 7006 getReferenceProps, 7007 getFloatingProps, 7008 getItemProps, 7009 getTriggerProps 7010 }), [getReferenceProps, getFloatingProps, getItemProps, getTriggerProps]); 7011 } 7012 function mergeProps2(userProps, propsList, elementKey) { 7013 const eventHandlers = /* @__PURE__ */ new Map(); 7014 const isItem = elementKey === "item"; 7015 const outputProps = {}; 7016 if (elementKey === "floating") { 7017 outputProps.tabIndex = -1; 7018 outputProps[FOCUSABLE_ATTRIBUTE] = ""; 7019 } 7020 for (const key in userProps) { 7021 if (isItem && userProps) { 7022 if (key === ACTIVE_KEY || key === SELECTED_KEY) { 7023 continue; 7024 } 7025 } 7026 outputProps[key] = userProps[key]; 7027 } 7028 for (let i2 = 0; i2 < propsList.length; i2 += 1) { 7029 let props; 7030 const propsOrGetProps = propsList[i2]?.[elementKey]; 7031 if (typeof propsOrGetProps === "function") { 7032 props = userProps ? propsOrGetProps(userProps) : null; 7033 } else { 7034 props = propsOrGetProps; 7035 } 7036 if (!props) { 7037 continue; 7038 } 7039 mutablyMergeProps(outputProps, props, isItem, eventHandlers); 7040 } 7041 mutablyMergeProps(outputProps, userProps, isItem, eventHandlers); 7042 return outputProps; 7043 } 7044 function mutablyMergeProps(outputProps, props, isItem, eventHandlers) { 7045 for (const key in props) { 7046 const value = props[key]; 7047 if (isItem && (key === ACTIVE_KEY || key === SELECTED_KEY)) { 7048 continue; 7049 } 7050 if (!key.startsWith("on")) { 7051 outputProps[key] = value; 7052 } else { 7053 if (!eventHandlers.has(key)) { 7054 eventHandlers.set(key, []); 7055 } 7056 if (typeof value === "function") { 7057 eventHandlers.get(key)?.push(value); 7058 outputProps[key] = (...args) => { 7059 return eventHandlers.get(key)?.map((fn) => fn(...args)).find((val) => val !== void 0); 7060 }; 7061 } 7062 } 7063 } 7064 } 7065 7066 // node_modules/@base-ui/react/esm/floating-ui-react/safePolygon.js 7067 var CURSOR_SPEED_THRESHOLD = 0.1; 7068 var CURSOR_SPEED_THRESHOLD_SQUARED = CURSOR_SPEED_THRESHOLD * CURSOR_SPEED_THRESHOLD; 7069 var POLYGON_BUFFER = 0.5; 7070 function hasIntersectingEdge(pointX, pointY, xi, yi, xj, yj) { 7071 return yi >= pointY !== yj >= pointY && pointX <= (xj - xi) * (pointY - yi) / (yj - yi) + xi; 7072 } 7073 function isPointInQuadrilateral(pointX, pointY, x1, y1, x2, y2, x3, y3, x4, y4) { 7074 let isInsideValue = false; 7075 if (hasIntersectingEdge(pointX, pointY, x1, y1, x2, y2)) { 7076 isInsideValue = !isInsideValue; 7077 } 7078 if (hasIntersectingEdge(pointX, pointY, x2, y2, x3, y3)) { 7079 isInsideValue = !isInsideValue; 7080 } 7081 if (hasIntersectingEdge(pointX, pointY, x3, y3, x4, y4)) { 7082 isInsideValue = !isInsideValue; 7083 } 7084 if (hasIntersectingEdge(pointX, pointY, x4, y4, x1, y1)) { 7085 isInsideValue = !isInsideValue; 7086 } 7087 return isInsideValue; 7088 } 7089 function isInsideRect(pointX, pointY, rect) { 7090 return pointX >= rect.x && pointX <= rect.x + rect.width && pointY >= rect.y && pointY <= rect.y + rect.height; 7091 } 7092 function isInsideAxisAlignedRect(pointX, pointY, x1, y1, x2, y2) { 7093 const minX = Math.min(x1, x2); 7094 const maxX = Math.max(x1, x2); 7095 const minY = Math.min(y1, y2); 7096 const maxY = Math.max(y1, y2); 7097 return pointX >= minX && pointX <= maxX && pointY >= minY && pointY <= maxY; 7098 } 7099 function safePolygon(options = {}) { 7100 const { 7101 blockPointerEvents = false 7102 } = options; 7103 const timeout = new Timeout(); 7104 const fn = ({ 7105 x: x2, 7106 y: y2, 7107 placement, 7108 elements, 7109 onClose, 7110 nodeId, 7111 tree 7112 }) => { 7113 const side = placement?.split("-")[0]; 7114 let hasLanded = false; 7115 let lastX = null; 7116 let lastY = null; 7117 let lastCursorTime = typeof performance !== "undefined" ? performance.now() : 0; 7118 function isCursorMovingSlowly(nextX, nextY) { 7119 const currentTime = performance.now(); 7120 const elapsedTime = currentTime - lastCursorTime; 7121 if (lastX === null || lastY === null || elapsedTime === 0) { 7122 lastX = nextX; 7123 lastY = nextY; 7124 lastCursorTime = currentTime; 7125 return false; 7126 } 7127 const deltaX = nextX - lastX; 7128 const deltaY = nextY - lastY; 7129 const distanceSquared = deltaX * deltaX + deltaY * deltaY; 7130 const thresholdSquared = elapsedTime * elapsedTime * CURSOR_SPEED_THRESHOLD_SQUARED; 7131 lastX = nextX; 7132 lastY = nextY; 7133 lastCursorTime = currentTime; 7134 return distanceSquared < thresholdSquared; 7135 } 7136 function close() { 7137 timeout.clear(); 7138 onClose(); 7139 } 7140 return function onMouseMove(event) { 7141 timeout.clear(); 7142 const domReference = elements.domReference; 7143 const floating = elements.floating; 7144 if (!domReference || !floating || side == null || x2 == null || y2 == null) { 7145 return void 0; 7146 } 7147 const { 7148 clientX, 7149 clientY 7150 } = event; 7151 const target = getTarget(event); 7152 const isLeave = event.type === "mouseleave"; 7153 const isOverFloatingEl = contains(floating, target); 7154 const isOverReferenceEl = contains(domReference, target); 7155 if (isOverFloatingEl) { 7156 hasLanded = true; 7157 if (!isLeave) { 7158 return void 0; 7159 } 7160 } 7161 if (isOverReferenceEl) { 7162 hasLanded = false; 7163 if (!isLeave) { 7164 hasLanded = true; 7165 return void 0; 7166 } 7167 } 7168 if (isLeave && isElement(event.relatedTarget) && contains(floating, event.relatedTarget)) { 7169 return void 0; 7170 } 7171 function hasOpenChildNode() { 7172 return Boolean(tree && getNodeChildren(tree.nodesRef.current, nodeId).length > 0); 7173 } 7174 function closeIfNoOpenChild() { 7175 if (!hasOpenChildNode()) { 7176 close(); 7177 } 7178 } 7179 if (hasOpenChildNode()) { 7180 return void 0; 7181 } 7182 const refRect = domReference.getBoundingClientRect(); 7183 const rect = floating.getBoundingClientRect(); 7184 const cursorLeaveFromRight = x2 > rect.right - rect.width / 2; 7185 const cursorLeaveFromBottom = y2 > rect.bottom - rect.height / 2; 7186 const isFloatingWider = rect.width > refRect.width; 7187 const isFloatingTaller = rect.height > refRect.height; 7188 const left = (isFloatingWider ? refRect : rect).left; 7189 const right = (isFloatingWider ? refRect : rect).right; 7190 const top = (isFloatingTaller ? refRect : rect).top; 7191 const bottom = (isFloatingTaller ? refRect : rect).bottom; 7192 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) { 7193 closeIfNoOpenChild(); 7194 return void 0; 7195 } 7196 let isInsideTroughRect = false; 7197 switch (side) { 7198 case "top": 7199 isInsideTroughRect = isInsideAxisAlignedRect(clientX, clientY, left, refRect.top + 1, right, rect.bottom - 1); 7200 break; 7201 case "bottom": 7202 isInsideTroughRect = isInsideAxisAlignedRect(clientX, clientY, left, rect.top + 1, right, refRect.bottom - 1); 7203 break; 7204 case "left": 7205 isInsideTroughRect = isInsideAxisAlignedRect(clientX, clientY, rect.right - 1, bottom, refRect.left + 1, top); 7206 break; 7207 case "right": 7208 isInsideTroughRect = isInsideAxisAlignedRect(clientX, clientY, refRect.right - 1, bottom, rect.left + 1, top); 7209 break; 7210 default: 7211 } 7212 if (isInsideTroughRect) { 7213 return void 0; 7214 } 7215 if (hasLanded && !isInsideRect(clientX, clientY, refRect)) { 7216 closeIfNoOpenChild(); 7217 return void 0; 7218 } 7219 if (!isLeave && isCursorMovingSlowly(clientX, clientY)) { 7220 closeIfNoOpenChild(); 7221 return void 0; 7222 } 7223 let isInsidePolygon = false; 7224 switch (side) { 7225 case "top": { 7226 const cursorXOffset = isFloatingWider ? POLYGON_BUFFER / 2 : POLYGON_BUFFER * 4; 7227 const cursorPointOneX = isFloatingWider ? x2 + cursorXOffset : cursorLeaveFromRight ? x2 + cursorXOffset : x2 - cursorXOffset; 7228 const cursorPointTwoX = isFloatingWider ? x2 - cursorXOffset : cursorLeaveFromRight ? x2 + cursorXOffset : x2 - cursorXOffset; 7229 const cursorPointY = y2 + POLYGON_BUFFER + 1; 7230 const commonYLeft = cursorLeaveFromRight ? rect.bottom - POLYGON_BUFFER : isFloatingWider ? rect.bottom - POLYGON_BUFFER : rect.top; 7231 const commonYRight = cursorLeaveFromRight ? isFloatingWider ? rect.bottom - POLYGON_BUFFER : rect.top : rect.bottom - POLYGON_BUFFER; 7232 isInsidePolygon = isPointInQuadrilateral(clientX, clientY, cursorPointOneX, cursorPointY, cursorPointTwoX, cursorPointY, rect.left, commonYLeft, rect.right, commonYRight); 7233 break; 7234 } 7235 case "bottom": { 7236 const cursorXOffset = isFloatingWider ? POLYGON_BUFFER / 2 : POLYGON_BUFFER * 4; 7237 const cursorPointOneX = isFloatingWider ? x2 + cursorXOffset : cursorLeaveFromRight ? x2 + cursorXOffset : x2 - cursorXOffset; 7238 const cursorPointTwoX = isFloatingWider ? x2 - cursorXOffset : cursorLeaveFromRight ? x2 + cursorXOffset : x2 - cursorXOffset; 7239 const cursorPointY = y2 - POLYGON_BUFFER; 7240 const commonYLeft = cursorLeaveFromRight ? rect.top + POLYGON_BUFFER : isFloatingWider ? rect.top + POLYGON_BUFFER : rect.bottom; 7241 const commonYRight = cursorLeaveFromRight ? isFloatingWider ? rect.top + POLYGON_BUFFER : rect.bottom : rect.top + POLYGON_BUFFER; 7242 isInsidePolygon = isPointInQuadrilateral(clientX, clientY, cursorPointOneX, cursorPointY, cursorPointTwoX, cursorPointY, rect.left, commonYLeft, rect.right, commonYRight); 7243 break; 7244 } 7245 case "left": { 7246 const cursorYOffset = isFloatingTaller ? POLYGON_BUFFER / 2 : POLYGON_BUFFER * 4; 7247 const cursorPointOneY = isFloatingTaller ? y2 + cursorYOffset : cursorLeaveFromBottom ? y2 + cursorYOffset : y2 - cursorYOffset; 7248 const cursorPointTwoY = isFloatingTaller ? y2 - cursorYOffset : cursorLeaveFromBottom ? y2 + cursorYOffset : y2 - cursorYOffset; 7249 const cursorPointX = x2 + POLYGON_BUFFER + 1; 7250 const commonXTop = cursorLeaveFromBottom ? rect.right - POLYGON_BUFFER : isFloatingTaller ? rect.right - POLYGON_BUFFER : rect.left; 7251 const commonXBottom = cursorLeaveFromBottom ? isFloatingTaller ? rect.right - POLYGON_BUFFER : rect.left : rect.right - POLYGON_BUFFER; 7252 isInsidePolygon = isPointInQuadrilateral(clientX, clientY, commonXTop, rect.top, commonXBottom, rect.bottom, cursorPointX, cursorPointOneY, cursorPointX, cursorPointTwoY); 7253 break; 7254 } 7255 case "right": { 7256 const cursorYOffset = isFloatingTaller ? POLYGON_BUFFER / 2 : POLYGON_BUFFER * 4; 7257 const cursorPointOneY = isFloatingTaller ? y2 + cursorYOffset : cursorLeaveFromBottom ? y2 + cursorYOffset : y2 - cursorYOffset; 7258 const cursorPointTwoY = isFloatingTaller ? y2 - cursorYOffset : cursorLeaveFromBottom ? y2 + cursorYOffset : y2 - cursorYOffset; 7259 const cursorPointX = x2 - POLYGON_BUFFER; 7260 const commonXTop = cursorLeaveFromBottom ? rect.left + POLYGON_BUFFER : isFloatingTaller ? rect.left + POLYGON_BUFFER : rect.right; 7261 const commonXBottom = cursorLeaveFromBottom ? isFloatingTaller ? rect.left + POLYGON_BUFFER : rect.right : rect.left + POLYGON_BUFFER; 7262 isInsidePolygon = isPointInQuadrilateral(clientX, clientY, cursorPointX, cursorPointOneY, cursorPointX, cursorPointTwoY, commonXTop, rect.top, commonXBottom, rect.bottom); 7263 break; 7264 } 7265 default: 7266 } 7267 if (!isInsidePolygon) { 7268 closeIfNoOpenChild(); 7269 } else if (!hasLanded) { 7270 timeout.start(40, closeIfNoOpenChild); 7271 } 7272 return void 0; 7273 }; 7274 }; 7275 fn.__options = { 7276 ...options, 7277 blockPointerEvents 7278 }; 7279 return fn; 7280 } 7281 7282 // node_modules/@base-ui/react/esm/utils/popupStateMapping.js 7283 var CommonPopupDataAttributes = (function(CommonPopupDataAttributes2) { 7284 CommonPopupDataAttributes2["open"] = "data-open"; 7285 CommonPopupDataAttributes2["closed"] = "data-closed"; 7286 CommonPopupDataAttributes2[CommonPopupDataAttributes2["startingStyle"] = TransitionStatusDataAttributes.startingStyle] = "startingStyle"; 7287 CommonPopupDataAttributes2[CommonPopupDataAttributes2["endingStyle"] = TransitionStatusDataAttributes.endingStyle] = "endingStyle"; 7288 CommonPopupDataAttributes2["anchorHidden"] = "data-anchor-hidden"; 7289 CommonPopupDataAttributes2["side"] = "data-side"; 7290 CommonPopupDataAttributes2["align"] = "data-align"; 7291 return CommonPopupDataAttributes2; 7292 })({}); 7293 var CommonTriggerDataAttributes = /* @__PURE__ */ (function(CommonTriggerDataAttributes2) { 7294 CommonTriggerDataAttributes2["popupOpen"] = "data-popup-open"; 7295 CommonTriggerDataAttributes2["pressed"] = "data-pressed"; 7296 return CommonTriggerDataAttributes2; 7297 })({}); 7298 var TRIGGER_HOOK = { 7299 [CommonTriggerDataAttributes.popupOpen]: "" 7300 }; 7301 var PRESSABLE_TRIGGER_HOOK = { 7302 [CommonTriggerDataAttributes.popupOpen]: "", 7303 [CommonTriggerDataAttributes.pressed]: "" 7304 }; 7305 var POPUP_OPEN_HOOK = { 7306 [CommonPopupDataAttributes.open]: "" 7307 }; 7308 var POPUP_CLOSED_HOOK = { 7309 [CommonPopupDataAttributes.closed]: "" 7310 }; 7311 var ANCHOR_HIDDEN_HOOK = { 7312 [CommonPopupDataAttributes.anchorHidden]: "" 7313 }; 7314 var triggerOpenStateMapping2 = { 7315 open(value) { 7316 if (value) { 7317 return TRIGGER_HOOK; 7318 } 7319 return null; 7320 } 7321 }; 7322 var popupStateMapping = { 7323 open(value) { 7324 if (value) { 7325 return POPUP_OPEN_HOOK; 7326 } 7327 return POPUP_CLOSED_HOOK; 7328 }, 7329 anchorHidden(value) { 7330 if (value) { 7331 return ANCHOR_HIDDEN_HOOK; 7332 } 7333 return null; 7334 } 7335 }; 7336 7337 // node_modules/@base-ui/utils/esm/inertValue.js 7338 function inertValue(value) { 7339 if (isReactVersionAtLeast(19)) { 7340 return value; 7341 } 7342 return value ? "true" : void 0; 7343 } 7344 7345 // node_modules/@base-ui/react/esm/utils/useAnchorPositioning.js 7346 var React38 = __toESM(require_react(), 1); 7347 7348 // node_modules/@base-ui/react/esm/floating-ui-react/middleware/arrow.js 7349 var baseArrow = (options) => ({ 7350 name: "arrow", 7351 options, 7352 async fn(state) { 7353 const { 7354 x: x2, 7355 y: y2, 7356 placement, 7357 rects, 7358 platform: platform3, 7359 elements, 7360 middlewareData 7361 } = state; 7362 const { 7363 element, 7364 padding = 0, 7365 offsetParent = "real" 7366 } = evaluate(options, state) || {}; 7367 if (element == null) { 7368 return {}; 7369 } 7370 const paddingObject = getPaddingObject(padding); 7371 const coords = { 7372 x: x2, 7373 y: y2 7374 }; 7375 const axis = getAlignmentAxis(placement); 7376 const length = getAxisLength(axis); 7377 const arrowDimensions = await platform3.getDimensions(element); 7378 const isYAxis = axis === "y"; 7379 const minProp = isYAxis ? "top" : "left"; 7380 const maxProp = isYAxis ? "bottom" : "right"; 7381 const clientProp = isYAxis ? "clientHeight" : "clientWidth"; 7382 const endDiff = rects.reference[length] + rects.reference[axis] - coords[axis] - rects.floating[length]; 7383 const startDiff = coords[axis] - rects.reference[axis]; 7384 const arrowOffsetParent = offsetParent === "real" ? await platform3.getOffsetParent?.(element) : elements.floating; 7385 let clientSize = elements.floating[clientProp] || rects.floating[length]; 7386 if (!clientSize || !await platform3.isElement?.(arrowOffsetParent)) { 7387 clientSize = elements.floating[clientProp] || rects.floating[length]; 7388 } 7389 const centerToReference = endDiff / 2 - startDiff / 2; 7390 const largestPossiblePadding = clientSize / 2 - arrowDimensions[length] / 2 - 1; 7391 const minPadding = Math.min(paddingObject[minProp], largestPossiblePadding); 7392 const maxPadding = Math.min(paddingObject[maxProp], largestPossiblePadding); 7393 const min2 = minPadding; 7394 const max2 = clientSize - arrowDimensions[length] - maxPadding; 7395 const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference; 7396 const offset4 = clamp(min2, center, max2); 7397 const shouldAddOffset = !middlewareData.arrow && getAlignment(placement) != null && center !== offset4 && rects.reference[length] / 2 - (center < min2 ? minPadding : maxPadding) - arrowDimensions[length] / 2 < 0; 7398 const alignmentOffset = shouldAddOffset ? center < min2 ? center - min2 : center - max2 : 0; 7399 return { 7400 [axis]: coords[axis] + alignmentOffset, 7401 data: { 7402 [axis]: offset4, 7403 centerOffset: center - offset4 - alignmentOffset, 7404 ...shouldAddOffset && { 7405 alignmentOffset 7406 } 7407 }, 7408 reset: shouldAddOffset 7409 }; 7410 } 7411 }); 7412 var arrow4 = (options, deps) => ({ 7413 ...baseArrow(options), 7414 options: [options, deps] 7415 }); 7416 7417 // node_modules/@base-ui/react/esm/utils/hideMiddleware.js 7418 var hide4 = { 7419 name: "hide", 7420 async fn(state) { 7421 const { 7422 width, 7423 height, 7424 x: x2, 7425 y: y2 7426 } = state.rects.reference; 7427 const anchorHidden = width === 0 && height === 0 && x2 === 0 && y2 === 0; 7428 const nativeHideResult = await hide3().fn(state); 7429 return { 7430 data: { 7431 referenceHidden: nativeHideResult.data?.referenceHidden || anchorHidden 7432 } 7433 }; 7434 } 7435 }; 7436 7437 // node_modules/@base-ui/react/esm/utils/adaptiveOriginMiddleware.js 7438 var DEFAULT_SIDES = { 7439 sideX: "left", 7440 sideY: "top" 7441 }; 7442 var adaptiveOrigin = { 7443 name: "adaptiveOrigin", 7444 async fn(state) { 7445 const { 7446 x: rawX, 7447 y: rawY, 7448 rects: { 7449 floating: floatRect 7450 }, 7451 elements: { 7452 floating 7453 }, 7454 platform: platform3, 7455 strategy, 7456 placement 7457 } = state; 7458 const win = getWindow(floating); 7459 const styles = win.getComputedStyle(floating); 7460 const hasTransition = styles.transitionDuration !== "0s" && styles.transitionDuration !== ""; 7461 if (!hasTransition) { 7462 return { 7463 x: rawX, 7464 y: rawY, 7465 data: DEFAULT_SIDES 7466 }; 7467 } 7468 const offsetParent = await platform3.getOffsetParent?.(floating); 7469 let offsetDimensions = { 7470 width: 0, 7471 height: 0 7472 }; 7473 if (strategy === "fixed" && win?.visualViewport) { 7474 offsetDimensions = { 7475 width: win.visualViewport.width, 7476 height: win.visualViewport.height 7477 }; 7478 } else if (offsetParent === win) { 7479 const doc = ownerDocument(floating); 7480 offsetDimensions = { 7481 width: doc.documentElement.clientWidth, 7482 height: doc.documentElement.clientHeight 7483 }; 7484 } else if (await platform3.isElement?.(offsetParent)) { 7485 offsetDimensions = await platform3.getDimensions(offsetParent); 7486 } 7487 const currentSide = getSide(placement); 7488 let x2 = rawX; 7489 let y2 = rawY; 7490 if (currentSide === "left") { 7491 x2 = offsetDimensions.width - (rawX + floatRect.width); 7492 } 7493 if (currentSide === "top") { 7494 y2 = offsetDimensions.height - (rawY + floatRect.height); 7495 } 7496 const sideX = currentSide === "left" ? "right" : DEFAULT_SIDES.sideX; 7497 const sideY = currentSide === "top" ? "bottom" : DEFAULT_SIDES.sideY; 7498 return { 7499 x: x2, 7500 y: y2, 7501 data: { 7502 sideX, 7503 sideY 7504 } 7505 }; 7506 } 7507 }; 7508 7509 // node_modules/@base-ui/react/esm/utils/useAnchorPositioning.js 7510 function getLogicalSide(sideParam, renderedSide, isRtl) { 7511 const isLogicalSideParam = sideParam === "inline-start" || sideParam === "inline-end"; 7512 const logicalRight = isRtl ? "inline-start" : "inline-end"; 7513 const logicalLeft = isRtl ? "inline-end" : "inline-start"; 7514 return { 7515 top: "top", 7516 right: isLogicalSideParam ? logicalRight : "right", 7517 bottom: "bottom", 7518 left: isLogicalSideParam ? logicalLeft : "left" 7519 }[renderedSide]; 7520 } 7521 function getOffsetData(state, sideParam, isRtl) { 7522 const { 7523 rects, 7524 placement 7525 } = state; 7526 const data = { 7527 side: getLogicalSide(sideParam, getSide(placement), isRtl), 7528 align: getAlignment(placement) || "center", 7529 anchor: { 7530 width: rects.reference.width, 7531 height: rects.reference.height 7532 }, 7533 positioner: { 7534 width: rects.floating.width, 7535 height: rects.floating.height 7536 } 7537 }; 7538 return data; 7539 } 7540 function useAnchorPositioning(params) { 7541 const { 7542 // Public parameters 7543 anchor, 7544 positionMethod = "absolute", 7545 side: sideParam = "bottom", 7546 sideOffset = 0, 7547 align = "center", 7548 alignOffset = 0, 7549 collisionBoundary, 7550 collisionPadding: collisionPaddingParam = 5, 7551 sticky = false, 7552 arrowPadding = 5, 7553 disableAnchorTracking = false, 7554 // Private parameters 7555 keepMounted = false, 7556 floatingRootContext, 7557 mounted, 7558 collisionAvoidance, 7559 shiftCrossAxis = false, 7560 nodeId, 7561 adaptiveOrigin: adaptiveOrigin2, 7562 lazyFlip = false, 7563 externalTree 7564 } = params; 7565 const [mountSide, setMountSide] = React38.useState(null); 7566 if (!mounted && mountSide !== null) { 7567 setMountSide(null); 7568 } 7569 const collisionAvoidanceSide = collisionAvoidance.side || "flip"; 7570 const collisionAvoidanceAlign = collisionAvoidance.align || "flip"; 7571 const collisionAvoidanceFallbackAxisSide = collisionAvoidance.fallbackAxisSide || "end"; 7572 const anchorFn = typeof anchor === "function" ? anchor : void 0; 7573 const anchorFnCallback = useStableCallback(anchorFn); 7574 const anchorDep = anchorFn ? anchorFnCallback : anchor; 7575 const anchorValueRef = useValueAsRef(anchor); 7576 const mountedRef = useValueAsRef(mounted); 7577 const direction = useDirection(); 7578 const isRtl = direction === "rtl"; 7579 const side = mountSide || { 7580 top: "top", 7581 right: "right", 7582 bottom: "bottom", 7583 left: "left", 7584 "inline-end": isRtl ? "left" : "right", 7585 "inline-start": isRtl ? "right" : "left" 7586 }[sideParam]; 7587 const placement = align === "center" ? side : `$side}-$align}`; 7588 let collisionPadding = collisionPaddingParam; 7589 const bias = 1; 7590 const biasTop = sideParam === "bottom" ? bias : 0; 7591 const biasBottom = sideParam === "top" ? bias : 0; 7592 const biasLeft = sideParam === "right" ? bias : 0; 7593 const biasRight = sideParam === "left" ? bias : 0; 7594 if (typeof collisionPadding === "number") { 7595 collisionPadding = { 7596 top: collisionPadding + biasTop, 7597 right: collisionPadding + biasRight, 7598 bottom: collisionPadding + biasBottom, 7599 left: collisionPadding + biasLeft 7600 }; 7601 } else if (collisionPadding) { 7602 collisionPadding = { 7603 top: (collisionPadding.top || 0) + biasTop, 7604 right: (collisionPadding.right || 0) + biasRight, 7605 bottom: (collisionPadding.bottom || 0) + biasBottom, 7606 left: (collisionPadding.left || 0) + biasLeft 7607 }; 7608 } 7609 const commonCollisionProps = { 7610 boundary: collisionBoundary === "clipping-ancestors" ? "clippingAncestors" : collisionBoundary, 7611 padding: collisionPadding 7612 }; 7613 const arrowRef = React38.useRef(null); 7614 const sideOffsetRef = useValueAsRef(sideOffset); 7615 const alignOffsetRef = useValueAsRef(alignOffset); 7616 const sideOffsetDep = typeof sideOffset !== "function" ? sideOffset : 0; 7617 const alignOffsetDep = typeof alignOffset !== "function" ? alignOffset : 0; 7618 const middleware = [offset3((state) => { 7619 const data = getOffsetData(state, sideParam, isRtl); 7620 const sideAxis = typeof sideOffsetRef.current === "function" ? sideOffsetRef.current(data) : sideOffsetRef.current; 7621 const alignAxis = typeof alignOffsetRef.current === "function" ? alignOffsetRef.current(data) : alignOffsetRef.current; 7622 return { 7623 mainAxis: sideAxis, 7624 crossAxis: alignAxis, 7625 alignmentAxis: alignAxis 7626 }; 7627 }, [sideOffsetDep, alignOffsetDep, isRtl, sideParam])]; 7628 const shiftDisabled = collisionAvoidanceAlign === "none" && collisionAvoidanceSide !== "shift"; 7629 const crossAxisShiftEnabled = !shiftDisabled && (sticky || shiftCrossAxis || collisionAvoidanceSide === "shift"); 7630 const flipMiddleware = collisionAvoidanceSide === "none" ? null : flip3({ 7631 ...commonCollisionProps, 7632 // Ensure the popup flips if it's been limited by its --available-height and it resizes. 7633 // Since the size() padding is smaller than the flip() padding, flip() will take precedence. 7634 padding: { 7635 top: collisionPadding.top + bias, 7636 right: collisionPadding.right + bias, 7637 bottom: collisionPadding.bottom + bias, 7638 left: collisionPadding.left + bias 7639 }, 7640 mainAxis: !shiftCrossAxis && collisionAvoidanceSide === "flip", 7641 crossAxis: collisionAvoidanceAlign === "flip" ? "alignment" : false, 7642 fallbackAxisSideDirection: collisionAvoidanceFallbackAxisSide 7643 }); 7644 const shiftMiddleware = shiftDisabled ? null : shift3((data) => { 7645 const html = ownerDocument(data.elements.floating).documentElement; 7646 return { 7647 ...commonCollisionProps, 7648 // Use the Layout Viewport to avoid shifting around when pinch-zooming 7649 // for context menus. 7650 rootBoundary: shiftCrossAxis ? { 7651 x: 0, 7652 y: 0, 7653 width: html.clientWidth, 7654 height: html.clientHeight 7655 } : void 0, 7656 mainAxis: collisionAvoidanceAlign !== "none", 7657 crossAxis: crossAxisShiftEnabled, 7658 limiter: sticky || shiftCrossAxis ? void 0 : limitShift3((limitData) => { 7659 if (!arrowRef.current) { 7660 return {}; 7661 } 7662 const { 7663 width, 7664 height 7665 } = arrowRef.current.getBoundingClientRect(); 7666 const sideAxis = getSideAxis(getSide(limitData.placement)); 7667 const arrowSize = sideAxis === "y" ? width : height; 7668 const offsetAmount = sideAxis === "y" ? collisionPadding.left + collisionPadding.right : collisionPadding.top + collisionPadding.bottom; 7669 return { 7670 offset: arrowSize / 2 + offsetAmount / 2 7671 }; 7672 }) 7673 }; 7674 }, [commonCollisionProps, sticky, shiftCrossAxis, collisionPadding, collisionAvoidanceAlign]); 7675 if (collisionAvoidanceSide === "shift" || collisionAvoidanceAlign === "shift" || align === "center") { 7676 middleware.push(shiftMiddleware, flipMiddleware); 7677 } else { 7678 middleware.push(flipMiddleware, shiftMiddleware); 7679 } 7680 middleware.push(size3({ 7681 ...commonCollisionProps, 7682 apply({ 7683 elements: { 7684 floating 7685 }, 7686 availableWidth, 7687 availableHeight, 7688 rects 7689 }) { 7690 if (!mountedRef.current) { 7691 return; 7692 } 7693 const floatingStyle = floating.style; 7694 floatingStyle.setProperty("--available-width", `$availableWidth}px`); 7695 floatingStyle.setProperty("--available-height", `$availableHeight}px`); 7696 const dpr = getWindow(floating).devicePixelRatio || 1; 7697 const { 7698 x: x3, 7699 y: y3, 7700 width, 7701 height 7702 } = rects.reference; 7703 const anchorWidth = (Math.round((x3 + width) * dpr) - Math.round(x3 * dpr)) / dpr; 7704 const anchorHeight = (Math.round((y3 + height) * dpr) - Math.round(y3 * dpr)) / dpr; 7705 floatingStyle.setProperty("--anchor-width", `$anchorWidth}px`); 7706 floatingStyle.setProperty("--anchor-height", `$anchorHeight}px`); 7707 } 7708 }), arrow4(() => ({ 7709 // `transform-origin` calculations rely on an element existing. If the arrow hasn't been set, 7710 // we'll create a fake element. 7711 element: arrowRef.current || ownerDocument(arrowRef.current).createElement("div"), 7712 padding: arrowPadding, 7713 offsetParent: "floating" 7714 }), [arrowPadding]), { 7715 name: "transformOrigin", 7716 fn(state) { 7717 const { 7718 elements: elements2, 7719 middlewareData: middlewareData2, 7720 placement: renderedPlacement2, 7721 rects, 7722 y: y3 7723 } = state; 7724 const currentRenderedSide = getSide(renderedPlacement2); 7725 const currentRenderedAxis = getSideAxis(currentRenderedSide); 7726 const arrowEl = arrowRef.current; 7727 const arrowX = middlewareData2.arrow?.x || 0; 7728 const arrowY = middlewareData2.arrow?.y || 0; 7729 const arrowWidth = arrowEl?.clientWidth || 0; 7730 const arrowHeight = arrowEl?.clientHeight || 0; 7731 const transformX = arrowX + arrowWidth / 2; 7732 const transformY = arrowY + arrowHeight / 2; 7733 const shiftY = Math.abs(middlewareData2.shift?.y || 0); 7734 const halfAnchorHeight = rects.reference.height / 2; 7735 const sideOffsetValue = typeof sideOffset === "function" ? sideOffset(getOffsetData(state, sideParam, isRtl)) : sideOffset; 7736 const isOverlappingAnchor = shiftY > sideOffsetValue; 7737 const adjacentTransformOrigin = { 7738 top: `$transformX}px calc(100% + $sideOffsetValue}px)`, 7739 bottom: `$transformX}px ${-sideOffsetValue}px`, 7740 left: `calc(100% + $sideOffsetValue}px) $transformY}px`, 7741 right: `${-sideOffsetValue}px $transformY}px` 7742 }[currentRenderedSide]; 7743 const overlapTransformOrigin = `$transformX}px $rects.reference.y + halfAnchorHeight - y3}px`; 7744 elements2.floating.style.setProperty("--transform-origin", crossAxisShiftEnabled && currentRenderedAxis === "y" && isOverlappingAnchor ? overlapTransformOrigin : adjacentTransformOrigin); 7745 return {}; 7746 } 7747 }, hide4, adaptiveOrigin2); 7748 useIsoLayoutEffect(() => { 7749 if (!mounted && floatingRootContext) { 7750 floatingRootContext.update({ 7751 referenceElement: null, 7752 floatingElement: null, 7753 domReferenceElement: null, 7754 positionReference: null 7755 }); 7756 } 7757 }, [mounted, floatingRootContext]); 7758 const autoUpdateOptions = React38.useMemo(() => ({ 7759 elementResize: !disableAnchorTracking && typeof ResizeObserver !== "undefined", 7760 layoutShift: !disableAnchorTracking && typeof IntersectionObserver !== "undefined" 7761 }), [disableAnchorTracking]); 7762 const { 7763 refs, 7764 elements, 7765 x: x2, 7766 y: y2, 7767 middlewareData, 7768 update: update2, 7769 placement: renderedPlacement, 7770 context, 7771 isPositioned, 7772 floatingStyles: originalFloatingStyles 7773 } = useFloating2({ 7774 rootContext: floatingRootContext, 7775 open: keepMounted ? mounted : void 0, 7776 placement, 7777 middleware, 7778 strategy: positionMethod, 7779 whileElementsMounted: keepMounted ? void 0 : (...args) => autoUpdate(...args, autoUpdateOptions), 7780 nodeId, 7781 externalTree 7782 }); 7783 const { 7784 sideX, 7785 sideY 7786 } = middlewareData.adaptiveOrigin || DEFAULT_SIDES; 7787 const resolvedPosition = isPositioned ? positionMethod : "fixed"; 7788 const floatingStyles = React38.useMemo(() => { 7789 const base = adaptiveOrigin2 ? { 7790 position: resolvedPosition, 7791 [sideX]: x2, 7792 [sideY]: y2 7793 } : { 7794 position: resolvedPosition, 7795 ...originalFloatingStyles 7796 }; 7797 if (!isPositioned) { 7798 base.opacity = 0; 7799 } 7800 return base; 7801 }, [adaptiveOrigin2, resolvedPosition, sideX, x2, sideY, y2, originalFloatingStyles, isPositioned]); 7802 const registeredPositionReferenceRef = React38.useRef(null); 7803 useIsoLayoutEffect(() => { 7804 if (!mounted) { 7805 return; 7806 } 7807 const anchorValue = anchorValueRef.current; 7808 const resolvedAnchor = typeof anchorValue === "function" ? anchorValue() : anchorValue; 7809 const unwrappedElement = (isRef(resolvedAnchor) ? resolvedAnchor.current : resolvedAnchor) || null; 7810 const finalAnchor = unwrappedElement || null; 7811 if (finalAnchor !== registeredPositionReferenceRef.current) { 7812 refs.setPositionReference(finalAnchor); 7813 registeredPositionReferenceRef.current = finalAnchor; 7814 } 7815 }, [mounted, refs, anchorDep, anchorValueRef]); 7816 React38.useEffect(() => { 7817 if (!mounted) { 7818 return; 7819 } 7820 const anchorValue = anchorValueRef.current; 7821 if (typeof anchorValue === "function") { 7822 return; 7823 } 7824 if (isRef(anchorValue) && anchorValue.current !== registeredPositionReferenceRef.current) { 7825 refs.setPositionReference(anchorValue.current); 7826 registeredPositionReferenceRef.current = anchorValue.current; 7827 } 7828 }, [mounted, refs, anchorDep, anchorValueRef]); 7829 React38.useEffect(() => { 7830 if (keepMounted && mounted && elements.domReference && elements.floating) { 7831 return autoUpdate(elements.domReference, elements.floating, update2, autoUpdateOptions); 7832 } 7833 return void 0; 7834 }, [keepMounted, mounted, elements, update2, autoUpdateOptions]); 7835 const renderedSide = getSide(renderedPlacement); 7836 const logicalRenderedSide = getLogicalSide(sideParam, renderedSide, isRtl); 7837 const renderedAlign = getAlignment(renderedPlacement) || "center"; 7838 const anchorHidden = Boolean(middlewareData.hide?.referenceHidden); 7839 useIsoLayoutEffect(() => { 7840 if (lazyFlip && mounted && isPositioned) { 7841 setMountSide(renderedSide); 7842 } 7843 }, [lazyFlip, mounted, isPositioned, renderedSide]); 7844 const arrowStyles = React38.useMemo(() => ({ 7845 position: "absolute", 7846 top: middlewareData.arrow?.y, 7847 left: middlewareData.arrow?.x 7848 }), [middlewareData.arrow]); 7849 const arrowUncentered = middlewareData.arrow?.centerOffset !== 0; 7850 return React38.useMemo(() => ({ 7851 positionerStyles: floatingStyles, 7852 arrowStyles, 7853 arrowRef, 7854 arrowUncentered, 7855 side: logicalRenderedSide, 7856 align: renderedAlign, 7857 physicalSide: renderedSide, 7858 anchorHidden, 7859 refs, 7860 context, 7861 isPositioned, 7862 update: update2 7863 }), [floatingStyles, arrowStyles, arrowRef, arrowUncentered, logicalRenderedSide, renderedAlign, renderedSide, anchorHidden, refs, context, isPositioned, update2]); 7864 } 7865 function isRef(param) { 7866 return param != null && "current" in param; 7867 } 7868 7869 // node_modules/@base-ui/react/esm/utils/getDisabledMountTransitionStyles.js 7870 function getDisabledMountTransitionStyles(transitionStatus) { 7871 return transitionStatus === "starting" ? DISABLED_TRANSITIONS_STYLE : EMPTY_OBJECT; 7872 } 7873 7874 // node_modules/@base-ui/react/esm/utils/usePositioner.js 7875 function usePositioner(componentProps, state, { 7876 styles, 7877 transitionStatus, 7878 props, 7879 refs, 7880 hidden, 7881 inert = false 7882 }) { 7883 const style = { 7884 ...styles 7885 }; 7886 if (inert) { 7887 style.pointerEvents = "none"; 7888 } 7889 return useRenderElement("div", componentProps, { 7890 state, 7891 ref: refs, 7892 props: [{ 7893 role: "presentation", 7894 hidden, 7895 style 7896 }, getDisabledMountTransitionStyles(transitionStatus), props], 7897 stateAttributesMapping: popupStateMapping 7898 }); 7899 } 7900 7901 // node_modules/@base-ui/react/esm/collapsible/index.parts.js 7902 var index_parts_exports = {}; 7903 __export(index_parts_exports, { 7904 Panel: () => CollapsiblePanel, 7905 Root: () => CollapsibleRoot, 7906 Trigger: () => CollapsibleTrigger 7907 }); 7908 7909 // node_modules/@base-ui/react/esm/collapsible/root/CollapsibleRoot.js 7910 var React39 = __toESM(require_react(), 1); 7911 7912 // node_modules/@base-ui/react/esm/collapsible/root/stateAttributesMapping.js 7913 var collapsibleStateAttributesMapping = { 7914 ...collapsibleOpenStateMapping, 7915 ...transitionStatusMapping 7916 }; 7917 7918 // node_modules/@base-ui/react/esm/collapsible/root/CollapsibleRoot.js 7919 var import_jsx_runtime5 = __toESM(require_jsx_runtime(), 1); 7920 var CollapsibleRoot = /* @__PURE__ */ React39.forwardRef(function CollapsibleRoot2(componentProps, forwardedRef) { 7921 const { 7922 render: render4, 7923 className, 7924 defaultOpen = false, 7925 disabled: disabled2 = false, 7926 onOpenChange: onOpenChangeProp, 7927 open, 7928 style, 7929 ...elementProps 7930 } = componentProps; 7931 const onOpenChange = useStableCallback(onOpenChangeProp); 7932 const collapsible = useCollapsibleRoot({ 7933 open, 7934 defaultOpen, 7935 onOpenChange, 7936 disabled: disabled2 7937 }); 7938 const state = React39.useMemo(() => ({ 7939 open: collapsible.open, 7940 disabled: collapsible.disabled, 7941 transitionStatus: collapsible.transitionStatus 7942 }), [collapsible.open, collapsible.disabled, collapsible.transitionStatus]); 7943 const contextValue = React39.useMemo(() => ({ 7944 ...collapsible, 7945 onOpenChange, 7946 state 7947 }), [collapsible, onOpenChange, state]); 7948 const element = useRenderElement("div", componentProps, { 7949 state, 7950 ref: forwardedRef, 7951 props: elementProps, 7952 stateAttributesMapping: collapsibleStateAttributesMapping 7953 }); 7954 return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(CollapsibleRootContext.Provider, { 7955 value: contextValue, 7956 children: element 7957 }); 7958 }); 7959 if (true) CollapsibleRoot.displayName = "CollapsibleRoot"; 7960 7961 // node_modules/@base-ui/react/esm/collapsible/trigger/CollapsibleTrigger.js 7962 var React40 = __toESM(require_react(), 1); 7963 var stateAttributesMapping = { 7964 ...triggerOpenStateMapping, 7965 ...transitionStatusMapping 7966 }; 7967 var CollapsibleTrigger = /* @__PURE__ */ React40.forwardRef(function CollapsibleTrigger2(componentProps, forwardedRef) { 7968 const { 7969 panelId, 7970 open, 7971 handleTrigger, 7972 state, 7973 disabled: contextDisabled 7974 } = useCollapsibleRootContext(); 7975 const { 7976 className, 7977 disabled: disabled2 = contextDisabled, 7978 id, 7979 render: render4, 7980 nativeButton = true, 7981 style, 7982 ...elementProps 7983 } = componentProps; 7984 const { 7985 getButtonProps, 7986 buttonRef 7987 } = useButton({ 7988 disabled: disabled2, 7989 focusableWhenDisabled: true, 7990 native: nativeButton 7991 }); 7992 const props = React40.useMemo(() => ({ 7993 "aria-controls": open ? panelId : void 0, 7994 "aria-expanded": open, 7995 onClick: handleTrigger 7996 }), [panelId, open, handleTrigger]); 7997 const element = useRenderElement("button", componentProps, { 7998 state, 7999 ref: [forwardedRef, buttonRef], 8000 props: [props, elementProps, getButtonProps], 8001 stateAttributesMapping 8002 }); 8003 return element; 8004 }); 8005 if (true) CollapsibleTrigger.displayName = "CollapsibleTrigger"; 8006 8007 // node_modules/@base-ui/react/esm/collapsible/panel/CollapsiblePanel.js 8008 var React41 = __toESM(require_react(), 1); 8009 8010 // node_modules/@base-ui/react/esm/collapsible/panel/CollapsiblePanelCssVars.js 8011 var CollapsiblePanelCssVars = /* @__PURE__ */ (function(CollapsiblePanelCssVars2) { 8012 CollapsiblePanelCssVars2["collapsiblePanelHeight"] = "--collapsible-panel-height"; 8013 CollapsiblePanelCssVars2["collapsiblePanelWidth"] = "--collapsible-panel-width"; 8014 return CollapsiblePanelCssVars2; 8015 })({}); 8016 8017 // node_modules/@base-ui/react/esm/collapsible/panel/CollapsiblePanel.js 8018 var CollapsiblePanel = /* @__PURE__ */ React41.forwardRef(function CollapsiblePanel2(componentProps, forwardedRef) { 8019 const { 8020 className, 8021 hiddenUntilFound: hiddenUntilFoundProp, 8022 keepMounted: keepMountedProp, 8023 render: render4, 8024 id: idProp, 8025 style, 8026 ...elementProps 8027 } = componentProps; 8028 if (true) { 8029 useIsoLayoutEffect(() => { 8030 if (hiddenUntilFoundProp && keepMountedProp === false) { 8031 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."); 8032 } 8033 }, [hiddenUntilFoundProp, keepMountedProp]); 8034 } 8035 const { 8036 abortControllerRef, 8037 animationTypeRef, 8038 height, 8039 mounted, 8040 onOpenChange, 8041 open, 8042 panelId, 8043 panelRef, 8044 runOnceAnimationsFinish, 8045 setDimensions, 8046 setHiddenUntilFound, 8047 setKeepMounted, 8048 setMounted, 8049 setPanelIdState, 8050 setOpen, 8051 setVisible, 8052 state, 8053 transitionDimensionRef, 8054 visible, 8055 width, 8056 transitionStatus 8057 } = useCollapsibleRootContext(); 8058 const hiddenUntilFound = hiddenUntilFoundProp ?? false; 8059 const keepMounted = keepMountedProp ?? false; 8060 useIsoLayoutEffect(() => { 8061 if (idProp) { 8062 setPanelIdState(idProp); 8063 return () => { 8064 setPanelIdState(void 0); 8065 }; 8066 } 8067 return void 0; 8068 }, [idProp, setPanelIdState]); 8069 useIsoLayoutEffect(() => { 8070 setHiddenUntilFound(hiddenUntilFound); 8071 }, [setHiddenUntilFound, hiddenUntilFound]); 8072 useIsoLayoutEffect(() => { 8073 setKeepMounted(keepMounted); 8074 }, [setKeepMounted, keepMounted]); 8075 const { 8076 props 8077 } = useCollapsiblePanel({ 8078 abortControllerRef, 8079 animationTypeRef, 8080 externalRef: forwardedRef, 8081 height, 8082 hiddenUntilFound, 8083 id: panelId, 8084 keepMounted, 8085 mounted, 8086 onOpenChange, 8087 open, 8088 panelRef, 8089 runOnceAnimationsFinish, 8090 setDimensions, 8091 setMounted, 8092 setOpen, 8093 setVisible, 8094 transitionDimensionRef, 8095 visible, 8096 width 8097 }); 8098 useOpenChangeComplete({ 8099 open: open && transitionStatus === "idle", 8100 ref: panelRef, 8101 onComplete() { 8102 if (!open) { 8103 return; 8104 } 8105 setDimensions({ 8106 height: void 0, 8107 width: void 0 8108 }); 8109 } 8110 }); 8111 const panelState = React41.useMemo(() => ({ 8112 ...state, 8113 transitionStatus 8114 }), [state, transitionStatus]); 8115 const element = useRenderElement("div", componentProps, { 8116 state: panelState, 8117 ref: [forwardedRef, panelRef], 8118 props: [props, { 8119 style: { 8120 [CollapsiblePanelCssVars.collapsiblePanelHeight]: height === void 0 ? "auto" : `$height}px`, 8121 [CollapsiblePanelCssVars.collapsiblePanelWidth]: width === void 0 ? "auto" : `$width}px` 8122 } 8123 }, elementProps], 8124 stateAttributesMapping: collapsibleStateAttributesMapping 8125 }); 8126 const shouldRender = keepMounted || hiddenUntilFound || mounted; 8127 if (!shouldRender) { 8128 return null; 8129 } 8130 return element; 8131 }); 8132 if (true) CollapsiblePanel.displayName = "CollapsiblePanel"; 8133 8134 // node_modules/@base-ui/react/esm/utils/usePopupViewport.js 8135 var React44 = __toESM(require_react(), 1); 8136 var ReactDOM5 = __toESM(require_react_dom(), 1); 8137 8138 // node_modules/@base-ui/utils/esm/usePreviousValue.js 8139 var React42 = __toESM(require_react(), 1); 8140 function usePreviousValue(value) { 8141 const [state, setState] = React42.useState({ 8142 current: value, 8143 previous: null 8144 }); 8145 if (value !== state.current) { 8146 setState({ 8147 current: value, 8148 previous: state.current 8149 }); 8150 } 8151 return state.previous; 8152 } 8153 8154 // node_modules/@base-ui/react/esm/utils/usePopupAutoResize.js 8155 var React43 = __toESM(require_react(), 1); 8156 8157 // node_modules/@base-ui/react/esm/utils/getCssDimensions.js 8158 function getCssDimensions2(element) { 8159 const css = getComputedStyle2(element); 8160 let width = parseFloat(css.width) || 0; 8161 let height = parseFloat(css.height) || 0; 8162 const hasOffset = isHTMLElement(element); 8163 const offsetWidth = hasOffset ? element.offsetWidth : width; 8164 const offsetHeight = hasOffset ? element.offsetHeight : height; 8165 const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight; 8166 if (shouldFallback) { 8167 width = offsetWidth; 8168 height = offsetHeight; 8169 } 8170 return { 8171 width, 8172 height 8173 }; 8174 } 8175 8176 // node_modules/@base-ui/react/esm/utils/usePopupAutoResize.js 8177 var DEFAULT_ENABLED = () => true; 8178 function usePopupAutoResize(parameters) { 8179 const { 8180 popupElement, 8181 positionerElement, 8182 content, 8183 mounted, 8184 enabled = DEFAULT_ENABLED, 8185 onMeasureLayout: onMeasureLayoutParam, 8186 onMeasureLayoutComplete: onMeasureLayoutCompleteParam, 8187 side, 8188 direction 8189 } = parameters; 8190 const runOnceAnimationsFinish = useAnimationsFinished(popupElement, true, false); 8191 const animationFrame = useAnimationFrame(); 8192 const committedDimensionsRef = React43.useRef(null); 8193 const liveDimensionsRef = React43.useRef(null); 8194 const isInitialRenderRef = React43.useRef(true); 8195 const restoreAnchoringStylesRef = React43.useRef(NOOP); 8196 const onMeasureLayout = useStableCallback(onMeasureLayoutParam); 8197 const onMeasureLayoutComplete = useStableCallback(onMeasureLayoutCompleteParam); 8198 const anchoringStyles = React43.useMemo(() => { 8199 let isOriginSide = side === "top"; 8200 let isPhysicalLeft = side === "left"; 8201 if (direction === "rtl") { 8202 isOriginSide = isOriginSide || side === "inline-end"; 8203 isPhysicalLeft = isPhysicalLeft || side === "inline-end"; 8204 } else { 8205 isOriginSide = isOriginSide || side === "inline-start"; 8206 isPhysicalLeft = isPhysicalLeft || side === "inline-start"; 8207 } 8208 return isOriginSide ? { 8209 position: "absolute", 8210 [side === "top" ? "bottom" : "top"]: "0", 8211 [isPhysicalLeft ? "right" : "left"]: "0" 8212 } : EMPTY_OBJECT; 8213 }, [side, direction]); 8214 useIsoLayoutEffect(() => { 8215 if (!mounted || !enabled() || typeof ResizeObserver !== "function") { 8216 restoreAnchoringStylesRef.current = NOOP; 8217 isInitialRenderRef.current = true; 8218 committedDimensionsRef.current = null; 8219 liveDimensionsRef.current = null; 8220 return void 0; 8221 } 8222 if (!popupElement || !positionerElement) { 8223 return void 0; 8224 } 8225 restoreAnchoringStylesRef.current = applyElementStyles(popupElement, anchoringStyles); 8226 const observer = new ResizeObserver((entries) => { 8227 const entry = entries[0]; 8228 if (entry) { 8229 liveDimensionsRef.current = { 8230 width: Math.ceil(entry.borderBoxSize[0].inlineSize), 8231 height: Math.ceil(entry.borderBoxSize[0].blockSize) 8232 }; 8233 } 8234 }); 8235 observer.observe(popupElement); 8236 setPopupCssSize(popupElement, "auto"); 8237 const restorePopupPosition = overrideElementStyle(popupElement, "position", "static"); 8238 const restorePopupTransform = overrideElementStyle(popupElement, "transform", "none"); 8239 const restorePopupScale = overrideElementStyle(popupElement, "scale", "1"); 8240 const restorePositionerAvailableSize = applyElementStyles(positionerElement, { 8241 "--available-width": "max-content", 8242 "--available-height": "max-content" 8243 }); 8244 function restoreMeasurementOverrides() { 8245 restorePopupPosition(); 8246 restorePopupTransform(); 8247 restorePositionerAvailableSize(); 8248 } 8249 function restoreMeasurementOverridesIncludingScale() { 8250 restoreMeasurementOverrides(); 8251 restorePopupScale(); 8252 } 8253 onMeasureLayout?.(); 8254 if (isInitialRenderRef.current || committedDimensionsRef.current === null) { 8255 setPositionerCssSize(positionerElement, "max-content"); 8256 const dimensions = getCssDimensions2(popupElement); 8257 committedDimensionsRef.current = dimensions; 8258 setPositionerCssSize(positionerElement, dimensions); 8259 restoreMeasurementOverridesIncludingScale(); 8260 onMeasureLayoutComplete?.(null, dimensions); 8261 isInitialRenderRef.current = false; 8262 return () => { 8263 observer.disconnect(); 8264 restoreAnchoringStylesRef.current(); 8265 restoreAnchoringStylesRef.current = NOOP; 8266 }; 8267 } 8268 setPopupCssSize(popupElement, "auto"); 8269 setPositionerCssSize(positionerElement, "max-content"); 8270 const previousDimensions = committedDimensionsRef.current ?? liveDimensionsRef.current; 8271 const newDimensions = getCssDimensions2(popupElement); 8272 committedDimensionsRef.current = newDimensions; 8273 if (!previousDimensions) { 8274 setPositionerCssSize(positionerElement, newDimensions); 8275 restoreMeasurementOverridesIncludingScale(); 8276 onMeasureLayoutComplete?.(null, newDimensions); 8277 return () => { 8278 observer.disconnect(); 8279 animationFrame.cancel(); 8280 restoreAnchoringStylesRef.current(); 8281 restoreAnchoringStylesRef.current = NOOP; 8282 }; 8283 } 8284 setPopupCssSize(popupElement, previousDimensions); 8285 restoreMeasurementOverridesIncludingScale(); 8286 onMeasureLayoutComplete?.(previousDimensions, newDimensions); 8287 setPositionerCssSize(positionerElement, newDimensions); 8288 const abortController = new AbortController(); 8289 animationFrame.request(() => { 8290 setPopupCssSize(popupElement, newDimensions); 8291 runOnceAnimationsFinish(() => { 8292 popupElement.style.setProperty("--popup-width", "auto"); 8293 popupElement.style.setProperty("--popup-height", "auto"); 8294 }, abortController.signal); 8295 }); 8296 return () => { 8297 observer.disconnect(); 8298 abortController.abort(); 8299 animationFrame.cancel(); 8300 restoreAnchoringStylesRef.current(); 8301 restoreAnchoringStylesRef.current = NOOP; 8302 }; 8303 }, [content, popupElement, positionerElement, runOnceAnimationsFinish, animationFrame, enabled, mounted, onMeasureLayout, onMeasureLayoutComplete, anchoringStyles]); 8304 } 8305 function overrideElementStyle(element, property, value) { 8306 const originalValue = element.style.getPropertyValue(property); 8307 element.style.setProperty(property, value); 8308 return () => { 8309 element.style.setProperty(property, originalValue); 8310 }; 8311 } 8312 function applyElementStyles(element, styles) { 8313 const restorers = []; 8314 for (const [key, value] of Object.entries(styles)) { 8315 restorers.push(overrideElementStyle(element, key, value)); 8316 } 8317 return restorers.length ? () => { 8318 restorers.forEach((restore) => restore()); 8319 } : NOOP; 8320 } 8321 function setPopupCssSize(popupElement, size4) { 8322 const width = size4 === "auto" ? "auto" : `$size4.width}px`; 8323 const height = size4 === "auto" ? "auto" : `$size4.height}px`; 8324 popupElement.style.setProperty("--popup-width", width); 8325 popupElement.style.setProperty("--popup-height", height); 8326 } 8327 function setPositionerCssSize(positionerElement, size4) { 8328 const width = size4 === "max-content" ? "max-content" : `$size4.width}px`; 8329 const height = size4 === "max-content" ? "max-content" : `$size4.height}px`; 8330 positionerElement.style.setProperty("--positioner-width", width); 8331 positionerElement.style.setProperty("--positioner-height", height); 8332 } 8333 8334 // node_modules/@base-ui/react/esm/utils/usePopupViewport.js 8335 var import_jsx_runtime6 = __toESM(require_jsx_runtime(), 1); 8336 function usePopupViewport(parameters) { 8337 const { 8338 store, 8339 side, 8340 cssVars, 8341 children 8342 } = parameters; 8343 const direction = useDirection(); 8344 const activeTrigger = store.useState("activeTriggerElement"); 8345 const activeTriggerId = store.useState("activeTriggerId"); 8346 const open = store.useState("open"); 8347 const payload = store.useState("payload"); 8348 const mounted = store.useState("mounted"); 8349 const popupElement = store.useState("popupElement"); 8350 const positionerElement = store.useState("positionerElement"); 8351 const previousActiveTrigger = usePreviousValue(open ? activeTrigger : null); 8352 const currentContentKey = usePopupContentKey(activeTriggerId, payload); 8353 const capturedNodeRef = React44.useRef(null); 8354 const [previousContentNode, setPreviousContentNode] = React44.useState(null); 8355 const [newTriggerOffset, setNewTriggerOffset] = React44.useState(null); 8356 const currentContainerRef = React44.useRef(null); 8357 const previousContainerRef = React44.useRef(null); 8358 const onAnimationsFinished = useAnimationsFinished(currentContainerRef, true, false); 8359 const cleanupFrame = useAnimationFrame(); 8360 const [previousContentDimensions, setPreviousContentDimensions] = React44.useState(null); 8361 const [showStartingStyleAttribute, setShowStartingStyleAttribute] = React44.useState(false); 8362 useIsoLayoutEffect(() => { 8363 store.set("hasViewport", true); 8364 return () => { 8365 store.set("hasViewport", false); 8366 }; 8367 }, [store]); 8368 const handleMeasureLayout = useStableCallback(() => { 8369 currentContainerRef.current?.style.setProperty("animation", "none"); 8370 currentContainerRef.current?.style.setProperty("transition", "none"); 8371 previousContainerRef.current?.style.setProperty("display", "none"); 8372 }); 8373 const handleMeasureLayoutComplete = useStableCallback((previousDimensions) => { 8374 currentContainerRef.current?.style.removeProperty("animation"); 8375 currentContainerRef.current?.style.removeProperty("transition"); 8376 previousContainerRef.current?.style.removeProperty("display"); 8377 if (previousDimensions) { 8378 setPreviousContentDimensions(previousDimensions); 8379 } 8380 }); 8381 const lastHandledTriggerRef = React44.useRef(null); 8382 useIsoLayoutEffect(() => { 8383 if (activeTrigger && previousActiveTrigger && activeTrigger !== previousActiveTrigger && lastHandledTriggerRef.current !== activeTrigger && capturedNodeRef.current) { 8384 setPreviousContentNode(capturedNodeRef.current); 8385 setShowStartingStyleAttribute(true); 8386 const offset4 = calculateRelativePosition(previousActiveTrigger, activeTrigger); 8387 setNewTriggerOffset(offset4); 8388 cleanupFrame.request(() => { 8389 ReactDOM5.flushSync(() => { 8390 setShowStartingStyleAttribute(false); 8391 }); 8392 onAnimationsFinished(() => { 8393 setPreviousContentNode(null); 8394 setPreviousContentDimensions(null); 8395 capturedNodeRef.current = null; 8396 }); 8397 }); 8398 lastHandledTriggerRef.current = activeTrigger; 8399 } 8400 }, [activeTrigger, previousActiveTrigger, previousContentNode, onAnimationsFinished, cleanupFrame]); 8401 useIsoLayoutEffect(() => { 8402 const source = currentContainerRef.current; 8403 if (!source) { 8404 return; 8405 } 8406 const wrapper = ownerDocument(source).createElement("div"); 8407 for (const child of Array.from(source.childNodes)) { 8408 wrapper.appendChild(child.cloneNode(true)); 8409 } 8410 capturedNodeRef.current = wrapper; 8411 }); 8412 const isTransitioning = previousContentNode != null; 8413 let childrenToRender; 8414 if (!isTransitioning) { 8415 childrenToRender = /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { 8416 "data-current": true, 8417 ref: currentContainerRef, 8418 children 8419 }, currentContentKey); 8420 } else { 8421 childrenToRender = /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(React44.Fragment, { 8422 children: [/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { 8423 "data-previous": true, 8424 inert: inertValue(true), 8425 ref: previousContainerRef, 8426 style: { 8427 ...previousContentDimensions ? { 8428 [cssVars.popupWidth]: `$previousContentDimensions.width}px`, 8429 [cssVars.popupHeight]: `$previousContentDimensions.height}px` 8430 } : null, 8431 position: "absolute" 8432 }, 8433 "data-ending-style": showStartingStyleAttribute ? void 0 : "" 8434 }, "previous"), /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { 8435 "data-current": true, 8436 ref: currentContainerRef, 8437 "data-starting-style": showStartingStyleAttribute ? "" : void 0, 8438 children 8439 }, currentContentKey)] 8440 }); 8441 } 8442 useIsoLayoutEffect(() => { 8443 const container = previousContainerRef.current; 8444 if (!container || !previousContentNode) { 8445 return; 8446 } 8447 container.replaceChildren(...Array.from(previousContentNode.childNodes)); 8448 }, [previousContentNode]); 8449 usePopupAutoResize({ 8450 popupElement, 8451 positionerElement, 8452 mounted, 8453 content: payload, 8454 onMeasureLayout: handleMeasureLayout, 8455 onMeasureLayoutComplete: handleMeasureLayoutComplete, 8456 side, 8457 direction 8458 }); 8459 const state = { 8460 activationDirection: getActivationDirection(newTriggerOffset), 8461 transitioning: isTransitioning 8462 }; 8463 return { 8464 children: childrenToRender, 8465 state 8466 }; 8467 } 8468 function getActivationDirection(offset4) { 8469 if (!offset4) { 8470 return void 0; 8471 } 8472 return `$getValueWithTolerance(offset4.horizontal, 5, "right", "left")} $getValueWithTolerance(offset4.vertical, 5, "down", "up")}`; 8473 } 8474 function getValueWithTolerance(value, tolerance, positiveLabel, negativeLabel) { 8475 if (value > tolerance) { 8476 return positiveLabel; 8477 } 8478 if (value < -tolerance) { 8479 return negativeLabel; 8480 } 8481 return ""; 8482 } 8483 function calculateRelativePosition(from, to) { 8484 const fromRect = from.getBoundingClientRect(); 8485 const toRect = to.getBoundingClientRect(); 8486 const fromCenter = { 8487 x: fromRect.left + fromRect.width / 2, 8488 y: fromRect.top + fromRect.height / 2 8489 }; 8490 const toCenter = { 8491 x: toRect.left + toRect.width / 2, 8492 y: toRect.top + toRect.height / 2 8493 }; 8494 return { 8495 horizontal: toCenter.x - fromCenter.x, 8496 vertical: toCenter.y - fromCenter.y 8497 }; 8498 } 8499 function usePopupContentKey(activeTriggerId, payload) { 8500 const [contentKey, setContentKey] = React44.useState(0); 8501 const previousActiveTriggerIdRef = React44.useRef(activeTriggerId); 8502 const previousPayloadRef = React44.useRef(payload); 8503 const pendingPayloadUpdateRef = React44.useRef(false); 8504 useIsoLayoutEffect(() => { 8505 const previousActiveTriggerId = previousActiveTriggerIdRef.current; 8506 const previousPayload = previousPayloadRef.current; 8507 const triggerIdChanged = activeTriggerId !== previousActiveTriggerId; 8508 const payloadChanged = payload !== previousPayload; 8509 if (triggerIdChanged) { 8510 setContentKey((value) => value + 1); 8511 pendingPayloadUpdateRef.current = !payloadChanged; 8512 } else if (pendingPayloadUpdateRef.current && payloadChanged) { 8513 setContentKey((value) => value + 1); 8514 pendingPayloadUpdateRef.current = false; 8515 } 8516 previousActiveTriggerIdRef.current = activeTriggerId; 8517 previousPayloadRef.current = payload; 8518 }, [activeTriggerId, payload]); 8519 return `$activeTriggerId ?? "current"}-$contentKey}`; 8520 } 8521 8522 // node_modules/@base-ui/react/esm/utils/FloatingPortalLite.js 8523 var React45 = __toESM(require_react(), 1); 8524 var ReactDOM6 = __toESM(require_react_dom(), 1); 8525 var import_jsx_runtime7 = __toESM(require_jsx_runtime(), 1); 8526 var FloatingPortalLite = /* @__PURE__ */ React45.forwardRef(function FloatingPortalLite2(componentProps, forwardedRef) { 8527 const { 8528 children, 8529 container, 8530 className, 8531 render: render4, 8532 style, 8533 ...elementProps 8534 } = componentProps; 8535 const { 8536 portalNode, 8537 portalSubtree 8538 } = useFloatingPortalNode({ 8539 container, 8540 ref: forwardedRef, 8541 componentProps, 8542 elementProps 8543 }); 8544 if (!portalSubtree && !portalNode) { 8545 return null; 8546 } 8547 return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(React45.Fragment, { 8548 children: [portalSubtree, portalNode && /* @__PURE__ */ ReactDOM6.createPortal(children, portalNode)] 8549 }); 8550 }); 8551 if (true) FloatingPortalLite.displayName = "FloatingPortalLite"; 8552 8553 // node_modules/@base-ui/react/esm/tooltip/index.parts.js 8554 var index_parts_exports2 = {}; 8555 __export(index_parts_exports2, { 8556 Arrow: () => TooltipArrow, 8557 Handle: () => TooltipHandle, 8558 Popup: () => TooltipPopup, 8559 Portal: () => TooltipPortal, 8560 Positioner: () => TooltipPositioner, 8561 Provider: () => TooltipProvider, 8562 Root: () => TooltipRoot, 8563 Trigger: () => TooltipTrigger, 8564 Viewport: () => TooltipViewport, 8565 createHandle: () => createTooltipHandle 8566 }); 8567 8568 // node_modules/@base-ui/react/esm/tooltip/root/TooltipRoot.js 8569 var React48 = __toESM(require_react(), 1); 8570 8571 // node_modules/@base-ui/react/esm/tooltip/root/TooltipRootContext.js 8572 var React46 = __toESM(require_react(), 1); 8573 var TooltipRootContext = /* @__PURE__ */ React46.createContext(void 0); 8574 if (true) TooltipRootContext.displayName = "TooltipRootContext"; 8575 function useTooltipRootContext(optional) { 8576 const context = React46.useContext(TooltipRootContext); 8577 if (context === void 0 && !optional) { 8578 throw new Error(true ? "Base UI: TooltipRootContext is missing. Tooltip parts must be placed within <Tooltip.Root>." : formatErrorMessage_default(72)); 8579 } 8580 return context; 8581 } 8582 8583 // node_modules/@base-ui/react/esm/tooltip/store/TooltipStore.js 8584 var React47 = __toESM(require_react(), 1); 8585 var ReactDOM7 = __toESM(require_react_dom(), 1); 8586 var selectors2 = { 8587 ...popupStoreSelectors, 8588 disabled: createSelector((state) => state.disabled), 8589 instantType: createSelector((state) => state.instantType), 8590 isInstantPhase: createSelector((state) => state.isInstantPhase), 8591 trackCursorAxis: createSelector((state) => state.trackCursorAxis), 8592 disableHoverablePopup: createSelector((state) => state.disableHoverablePopup), 8593 lastOpenChangeReason: createSelector((state) => state.openChangeReason), 8594 closeOnClick: createSelector((state) => state.closeOnClick), 8595 closeDelay: createSelector((state) => state.closeDelay), 8596 hasViewport: createSelector((state) => state.hasViewport) 8597 }; 8598 var TooltipStore = class _TooltipStore extends ReactStore { 8599 constructor(initialState) { 8600 super({ 8601 ...createInitialState(), 8602 ...initialState 8603 }, { 8604 popupRef: /* @__PURE__ */ React47.createRef(), 8605 onOpenChange: void 0, 8606 onOpenChangeComplete: void 0, 8607 triggerElements: new PopupTriggerMap() 8608 }, selectors2); 8609 } 8610 setOpen = (nextOpen, eventDetails) => { 8611 const reason = eventDetails.reason; 8612 const isHover = reason === reason_parts_exports.triggerHover; 8613 const isFocusOpen = nextOpen && reason === reason_parts_exports.triggerFocus; 8614 const isDismissClose = !nextOpen && (reason === reason_parts_exports.triggerPress || reason === reason_parts_exports.escapeKey); 8615 eventDetails.preventUnmountOnClose = () => { 8616 this.set("preventUnmountingOnClose", true); 8617 }; 8618 this.context.onOpenChange?.(nextOpen, eventDetails); 8619 if (eventDetails.isCanceled) { 8620 return; 8621 } 8622 this.state.floatingRootContext.dispatchOpenChange(nextOpen, eventDetails); 8623 const changeState = () => { 8624 const updatedState = { 8625 open: nextOpen, 8626 openChangeReason: reason 8627 }; 8628 if (isFocusOpen) { 8629 updatedState.instantType = "focus"; 8630 } else if (isDismissClose) { 8631 updatedState.instantType = "dismiss"; 8632 } else if (reason === reason_parts_exports.triggerHover) { 8633 updatedState.instantType = void 0; 8634 } 8635 const newTriggerId = eventDetails.trigger?.id ?? null; 8636 if (newTriggerId || nextOpen) { 8637 updatedState.activeTriggerId = newTriggerId; 8638 updatedState.activeTriggerElement = eventDetails.trigger ?? null; 8639 } 8640 this.update(updatedState); 8641 }; 8642 if (isHover) { 8643 ReactDOM7.flushSync(changeState); 8644 } else { 8645 changeState(); 8646 } 8647 }; 8648 static useStore(externalStore, initialState) { 8649 const internalStore = useRefWithInit(() => { 8650 return new _TooltipStore(initialState); 8651 }).current; 8652 const store = externalStore ?? internalStore; 8653 const floatingRootContext = useSyncedFloatingRootContext({ 8654 popupStore: store, 8655 onOpenChange: store.setOpen 8656 }); 8657 store.state.floatingRootContext = floatingRootContext; 8658 return store; 8659 } 8660 }; 8661 function createInitialState() { 8662 return { 8663 ...createInitialPopupStoreState(), 8664 disabled: false, 8665 instantType: void 0, 8666 isInstantPhase: false, 8667 trackCursorAxis: "none", 8668 disableHoverablePopup: false, 8669 openChangeReason: null, 8670 closeOnClick: true, 8671 closeDelay: 0, 8672 hasViewport: false 8673 }; 8674 } 8675 8676 // node_modules/@base-ui/react/esm/tooltip/root/TooltipRoot.js 8677 var import_jsx_runtime8 = __toESM(require_jsx_runtime(), 1); 8678 var TooltipRoot = fastComponent(function TooltipRoot2(props) { 8679 const { 8680 disabled: disabled2 = false, 8681 defaultOpen = false, 8682 open: openProp, 8683 disableHoverablePopup = false, 8684 trackCursorAxis = "none", 8685 actionsRef, 8686 onOpenChange, 8687 onOpenChangeComplete, 8688 handle, 8689 triggerId: triggerIdProp, 8690 defaultTriggerId: defaultTriggerIdProp = null, 8691 children 8692 } = props; 8693 const store = TooltipStore.useStore(handle?.store, { 8694 open: defaultOpen, 8695 openProp, 8696 activeTriggerId: defaultTriggerIdProp, 8697 triggerIdProp 8698 }); 8699 useOnFirstRender(() => { 8700 if (openProp === void 0 && store.state.open === false && defaultOpen === true) { 8701 store.update({ 8702 open: true, 8703 activeTriggerId: defaultTriggerIdProp 8704 }); 8705 } 8706 }); 8707 store.useControlledProp("openProp", openProp); 8708 store.useControlledProp("triggerIdProp", triggerIdProp); 8709 store.useContextCallback("onOpenChange", onOpenChange); 8710 store.useContextCallback("onOpenChangeComplete", onOpenChangeComplete); 8711 const openState = store.useState("open"); 8712 const open = !disabled2 && openState; 8713 const activeTriggerId = store.useState("activeTriggerId"); 8714 const payload = store.useState("payload"); 8715 store.useSyncedValues({ 8716 trackCursorAxis, 8717 disableHoverablePopup 8718 }); 8719 useIsoLayoutEffect(() => { 8720 if (openState && disabled2) { 8721 store.setOpen(false, createChangeEventDetails(reason_parts_exports.disabled)); 8722 } 8723 }, [openState, disabled2, store]); 8724 store.useSyncedValue("disabled", disabled2); 8725 useImplicitActiveTrigger(store); 8726 const { 8727 forceUnmount, 8728 transitionStatus 8729 } = useOpenStateTransitions(open, store); 8730 const floatingRootContext = store.select("floatingRootContext"); 8731 const isInstantPhase = store.useState("isInstantPhase"); 8732 const instantType = store.useState("instantType"); 8733 const lastOpenChangeReason = store.useState("lastOpenChangeReason"); 8734 const previousInstantTypeRef = React48.useRef(null); 8735 useIsoLayoutEffect(() => { 8736 if (transitionStatus === "ending" && lastOpenChangeReason === reason_parts_exports.none || transitionStatus !== "ending" && isInstantPhase) { 8737 if (instantType !== "delay") { 8738 previousInstantTypeRef.current = instantType; 8739 } 8740 store.set("instantType", "delay"); 8741 } else if (previousInstantTypeRef.current !== null) { 8742 store.set("instantType", previousInstantTypeRef.current); 8743 previousInstantTypeRef.current = null; 8744 } 8745 }, [transitionStatus, isInstantPhase, lastOpenChangeReason, instantType, store]); 8746 useIsoLayoutEffect(() => { 8747 if (open) { 8748 if (activeTriggerId == null) { 8749 store.set("payload", void 0); 8750 } 8751 } 8752 }, [store, activeTriggerId, open]); 8753 const handleImperativeClose = React48.useCallback(() => { 8754 store.setOpen(false, createChangeEventDetails(reason_parts_exports.imperativeAction)); 8755 }, [store]); 8756 React48.useImperativeHandle(actionsRef, () => ({ 8757 unmount: forceUnmount, 8758 close: handleImperativeClose 8759 }), [forceUnmount, handleImperativeClose]); 8760 const dismiss = useDismiss(floatingRootContext, { 8761 enabled: !disabled2, 8762 referencePress: () => store.select("closeOnClick") 8763 }); 8764 const clientPoint = useClientPoint(floatingRootContext, { 8765 enabled: !disabled2 && trackCursorAxis !== "none", 8766 axis: trackCursorAxis === "none" ? void 0 : trackCursorAxis 8767 }); 8768 const { 8769 getReferenceProps, 8770 getFloatingProps, 8771 getTriggerProps 8772 } = useInteractions([dismiss, clientPoint]); 8773 const activeTriggerProps = React48.useMemo(() => getReferenceProps(), [getReferenceProps]); 8774 const inactiveTriggerProps = React48.useMemo(() => getTriggerProps(), [getTriggerProps]); 8775 const popupProps = React48.useMemo(() => getFloatingProps(), [getFloatingProps]); 8776 store.useSyncedValues({ 8777 activeTriggerProps, 8778 inactiveTriggerProps, 8779 popupProps 8780 }); 8781 return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(TooltipRootContext.Provider, { 8782 value: store, 8783 children: typeof children === "function" ? children({ 8784 payload 8785 }) : children 8786 }); 8787 }); 8788 if (true) TooltipRoot.displayName = "TooltipRoot"; 8789 8790 // node_modules/@base-ui/react/esm/tooltip/trigger/TooltipTrigger.js 8791 var React50 = __toESM(require_react(), 1); 8792 8793 // node_modules/@base-ui/react/esm/tooltip/provider/TooltipProviderContext.js 8794 var React49 = __toESM(require_react(), 1); 8795 var TooltipProviderContext = /* @__PURE__ */ React49.createContext(void 0); 8796 if (true) TooltipProviderContext.displayName = "TooltipProviderContext"; 8797 function useTooltipProviderContext() { 8798 return React49.useContext(TooltipProviderContext); 8799 } 8800 8801 // node_modules/@base-ui/react/esm/tooltip/trigger/TooltipTriggerDataAttributes.js 8802 var TooltipTriggerDataAttributes = (function(TooltipTriggerDataAttributes2) { 8803 TooltipTriggerDataAttributes2[TooltipTriggerDataAttributes2["popupOpen"] = CommonTriggerDataAttributes.popupOpen] = "popupOpen"; 8804 TooltipTriggerDataAttributes2["triggerDisabled"] = "data-trigger-disabled"; 8805 return TooltipTriggerDataAttributes2; 8806 })({}); 8807 8808 // node_modules/@base-ui/react/esm/tooltip/utils/constants.js 8809 var OPEN_DELAY = 600; 8810 8811 // node_modules/@base-ui/react/esm/tooltip/trigger/TooltipTrigger.js 8812 var TooltipTrigger = fastComponentRef(function TooltipTrigger2(componentProps, forwardedRef) { 8813 const { 8814 className, 8815 render: render4, 8816 handle, 8817 payload, 8818 disabled: disabledProp, 8819 delay, 8820 closeOnClick = true, 8821 closeDelay, 8822 id: idProp, 8823 style, 8824 ...elementProps 8825 } = componentProps; 8826 const rootContext = useTooltipRootContext(true); 8827 const store = handle?.store ?? rootContext; 8828 if (!store) { 8829 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)); 8830 } 8831 const thisTriggerId = useBaseUiId(idProp); 8832 const isTriggerActive = store.useState("isTriggerActive", thisTriggerId); 8833 const isOpenedByThisTrigger = store.useState("isOpenedByTrigger", thisTriggerId); 8834 const floatingRootContext = store.useState("floatingRootContext"); 8835 const triggerElementRef = React50.useRef(null); 8836 const delayWithDefault = delay ?? OPEN_DELAY; 8837 const closeDelayWithDefault = closeDelay ?? 0; 8838 const { 8839 registerTrigger, 8840 isMountedByThisTrigger 8841 } = useTriggerDataForwarding(thisTriggerId, triggerElementRef, store, { 8842 payload, 8843 closeOnClick, 8844 closeDelay: closeDelayWithDefault 8845 }); 8846 const providerContext = useTooltipProviderContext(); 8847 const { 8848 delayRef, 8849 isInstantPhase, 8850 hasProvider 8851 } = useDelayGroup(floatingRootContext, { 8852 open: isOpenedByThisTrigger 8853 }); 8854 store.useSyncedValue("isInstantPhase", isInstantPhase); 8855 const rootDisabled = store.useState("disabled"); 8856 const disabled2 = disabledProp ?? rootDisabled; 8857 const trackCursorAxis = store.useState("trackCursorAxis"); 8858 const disableHoverablePopup = store.useState("disableHoverablePopup"); 8859 const hoverProps = useHoverReferenceInteraction(floatingRootContext, { 8860 enabled: !disabled2, 8861 mouseOnly: true, 8862 move: false, 8863 handleClose: !disableHoverablePopup && trackCursorAxis !== "both" ? safePolygon() : null, 8864 restMs() { 8865 const providerDelay = providerContext?.delay; 8866 const groupOpenValue = typeof delayRef.current === "object" ? delayRef.current.open : void 0; 8867 let computedRestMs = delayWithDefault; 8868 if (hasProvider) { 8869 if (groupOpenValue !== 0) { 8870 computedRestMs = delay ?? providerDelay ?? delayWithDefault; 8871 } else { 8872 computedRestMs = 0; 8873 } 8874 } 8875 return computedRestMs; 8876 }, 8877 delay() { 8878 const closeValue = typeof delayRef.current === "object" ? delayRef.current.close : void 0; 8879 let computedCloseDelay = closeDelayWithDefault; 8880 if (closeDelay == null && hasProvider) { 8881 computedCloseDelay = closeValue; 8882 } 8883 return { 8884 close: computedCloseDelay 8885 }; 8886 }, 8887 triggerElementRef, 8888 isActiveTrigger: isTriggerActive, 8889 isClosing: () => store.select("transitionStatus") === "ending" 8890 }); 8891 const focusProps = useFocus(floatingRootContext, { 8892 enabled: !disabled2 8893 }).reference; 8894 const state = { 8895 open: isOpenedByThisTrigger 8896 }; 8897 const rootTriggerProps = store.useState("triggerProps", isMountedByThisTrigger); 8898 const element = useRenderElement("button", componentProps, { 8899 state, 8900 ref: [forwardedRef, registerTrigger, triggerElementRef], 8901 props: [hoverProps, focusProps, rootTriggerProps, { 8902 onPointerDown() { 8903 store.set("closeOnClick", closeOnClick); 8904 }, 8905 id: thisTriggerId, 8906 [TooltipTriggerDataAttributes.triggerDisabled]: disabled2 ? "" : void 0 8907 }, elementProps], 8908 stateAttributesMapping: triggerOpenStateMapping2 8909 }); 8910 return element; 8911 }); 8912 if (true) TooltipTrigger.displayName = "TooltipTrigger"; 8913 8914 // node_modules/@base-ui/react/esm/tooltip/portal/TooltipPortal.js 8915 var React52 = __toESM(require_react(), 1); 8916 8917 // node_modules/@base-ui/react/esm/tooltip/portal/TooltipPortalContext.js 8918 var React51 = __toESM(require_react(), 1); 8919 var TooltipPortalContext = /* @__PURE__ */ React51.createContext(void 0); 8920 if (true) TooltipPortalContext.displayName = "TooltipPortalContext"; 8921 function useTooltipPortalContext() { 8922 const value = React51.useContext(TooltipPortalContext); 8923 if (value === void 0) { 8924 throw new Error(true ? "Base UI: <Tooltip.Portal> is missing." : formatErrorMessage_default(70)); 8925 } 8926 return value; 8927 } 8928 8929 // node_modules/@base-ui/react/esm/tooltip/portal/TooltipPortal.js 8930 var import_jsx_runtime9 = __toESM(require_jsx_runtime(), 1); 8931 var TooltipPortal = /* @__PURE__ */ React52.forwardRef(function TooltipPortal2(props, forwardedRef) { 8932 const { 8933 keepMounted = false, 8934 ...portalProps 8935 } = props; 8936 const store = useTooltipRootContext(); 8937 const mounted = store.useState("mounted"); 8938 const shouldRender = mounted || keepMounted; 8939 if (!shouldRender) { 8940 return null; 8941 } 8942 return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(TooltipPortalContext.Provider, { 8943 value: keepMounted, 8944 children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(FloatingPortalLite, { 8945 ref: forwardedRef, 8946 ...portalProps 8947 }) 8948 }); 8949 }); 8950 if (true) TooltipPortal.displayName = "TooltipPortal"; 8951 8952 // node_modules/@base-ui/react/esm/tooltip/positioner/TooltipPositioner.js 8953 var React54 = __toESM(require_react(), 1); 8954 8955 // node_modules/@base-ui/react/esm/tooltip/positioner/TooltipPositionerContext.js 8956 var React53 = __toESM(require_react(), 1); 8957 var TooltipPositionerContext = /* @__PURE__ */ React53.createContext(void 0); 8958 if (true) TooltipPositionerContext.displayName = "TooltipPositionerContext"; 8959 function useTooltipPositionerContext() { 8960 const context = React53.useContext(TooltipPositionerContext); 8961 if (context === void 0) { 8962 throw new Error(true ? "Base UI: TooltipPositionerContext is missing. TooltipPositioner parts must be placed within <Tooltip.Positioner>." : formatErrorMessage_default(71)); 8963 } 8964 return context; 8965 } 8966 8967 // node_modules/@base-ui/react/esm/tooltip/positioner/TooltipPositioner.js 8968 var import_jsx_runtime10 = __toESM(require_jsx_runtime(), 1); 8969 var TooltipPositioner = /* @__PURE__ */ React54.forwardRef(function TooltipPositioner2(componentProps, forwardedRef) { 8970 const { 8971 render: render4, 8972 className, 8973 anchor, 8974 positionMethod = "absolute", 8975 side = "top", 8976 align = "center", 8977 sideOffset = 0, 8978 alignOffset = 0, 8979 collisionBoundary = "clipping-ancestors", 8980 collisionPadding = 5, 8981 arrowPadding = 5, 8982 sticky = false, 8983 disableAnchorTracking = false, 8984 collisionAvoidance = POPUP_COLLISION_AVOIDANCE, 8985 style, 8986 ...elementProps 8987 } = componentProps; 8988 const store = useTooltipRootContext(); 8989 const keepMounted = useTooltipPortalContext(); 8990 const open = store.useState("open"); 8991 const mounted = store.useState("mounted"); 8992 const trackCursorAxis = store.useState("trackCursorAxis"); 8993 const disableHoverablePopup = store.useState("disableHoverablePopup"); 8994 const floatingRootContext = store.useState("floatingRootContext"); 8995 const instantType = store.useState("instantType"); 8996 const transitionStatus = store.useState("transitionStatus"); 8997 const hasViewport = store.useState("hasViewport"); 8998 const positioning = useAnchorPositioning({ 8999 anchor, 9000 positionMethod, 9001 floatingRootContext, 9002 mounted, 9003 side, 9004 sideOffset, 9005 align, 9006 alignOffset, 9007 collisionBoundary, 9008 collisionPadding, 9009 sticky, 9010 arrowPadding, 9011 disableAnchorTracking, 9012 keepMounted, 9013 collisionAvoidance, 9014 adaptiveOrigin: hasViewport ? adaptiveOrigin : void 0 9015 }); 9016 const state = React54.useMemo(() => ({ 9017 open, 9018 side: positioning.side, 9019 align: positioning.align, 9020 anchorHidden: positioning.anchorHidden, 9021 instant: trackCursorAxis !== "none" ? "tracking-cursor" : instantType 9022 }), [open, positioning.side, positioning.align, positioning.anchorHidden, trackCursorAxis, instantType]); 9023 const element = usePositioner(componentProps, state, { 9024 styles: positioning.positionerStyles, 9025 transitionStatus, 9026 props: elementProps, 9027 refs: [forwardedRef, store.useStateSetter("positionerElement")], 9028 hidden: !mounted, 9029 inert: !open || trackCursorAxis === "both" || disableHoverablePopup 9030 }); 9031 return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(TooltipPositionerContext.Provider, { 9032 value: positioning, 9033 children: element 9034 }); 9035 }); 9036 if (true) TooltipPositioner.displayName = "TooltipPositioner"; 9037 9038 // node_modules/@base-ui/react/esm/tooltip/popup/TooltipPopup.js 9039 var React55 = __toESM(require_react(), 1); 9040 var stateAttributesMapping2 = { 9041 ...popupStateMapping, 9042 ...transitionStatusMapping 9043 }; 9044 var TooltipPopup = /* @__PURE__ */ React55.forwardRef(function TooltipPopup2(componentProps, forwardedRef) { 9045 const { 9046 className, 9047 render: render4, 9048 style, 9049 ...elementProps 9050 } = componentProps; 9051 const store = useTooltipRootContext(); 9052 const { 9053 side, 9054 align 9055 } = useTooltipPositionerContext(); 9056 const open = store.useState("open"); 9057 const instantType = store.useState("instantType"); 9058 const transitionStatus = store.useState("transitionStatus"); 9059 const popupProps = store.useState("popupProps"); 9060 const floatingContext = store.useState("floatingRootContext"); 9061 useOpenChangeComplete({ 9062 open, 9063 ref: store.context.popupRef, 9064 onComplete() { 9065 if (open) { 9066 store.context.onOpenChangeComplete?.(true); 9067 } 9068 } 9069 }); 9070 const disabled2 = store.useState("disabled"); 9071 const closeDelay = store.useState("closeDelay"); 9072 useHoverFloatingInteraction(floatingContext, { 9073 enabled: !disabled2, 9074 closeDelay 9075 }); 9076 const state = { 9077 open, 9078 side, 9079 align, 9080 instant: instantType, 9081 transitionStatus 9082 }; 9083 const element = useRenderElement("div", componentProps, { 9084 state, 9085 ref: [forwardedRef, store.context.popupRef, store.useStateSetter("popupElement")], 9086 props: [popupProps, getDisabledMountTransitionStyles(transitionStatus), elementProps], 9087 stateAttributesMapping: stateAttributesMapping2 9088 }); 9089 return element; 9090 }); 9091 if (true) TooltipPopup.displayName = "TooltipPopup"; 9092 9093 // node_modules/@base-ui/react/esm/tooltip/arrow/TooltipArrow.js 9094 var React56 = __toESM(require_react(), 1); 9095 var TooltipArrow = /* @__PURE__ */ React56.forwardRef(function TooltipArrow2(componentProps, forwardedRef) { 9096 const { 9097 className, 9098 render: render4, 9099 style, 9100 ...elementProps 9101 } = componentProps; 9102 const store = useTooltipRootContext(); 9103 const open = store.useState("open"); 9104 const instantType = store.useState("instantType"); 9105 const { 9106 arrowRef, 9107 side, 9108 align, 9109 arrowUncentered, 9110 arrowStyles 9111 } = useTooltipPositionerContext(); 9112 const state = { 9113 open, 9114 side, 9115 align, 9116 uncentered: arrowUncentered, 9117 instant: instantType 9118 }; 9119 const element = useRenderElement("div", componentProps, { 9120 state, 9121 ref: [forwardedRef, arrowRef], 9122 props: [{ 9123 style: arrowStyles, 9124 "aria-hidden": true 9125 }, elementProps], 9126 stateAttributesMapping: popupStateMapping 9127 }); 9128 return element; 9129 }); 9130 if (true) TooltipArrow.displayName = "TooltipArrow"; 9131 9132 // node_modules/@base-ui/react/esm/tooltip/provider/TooltipProvider.js 9133 var React57 = __toESM(require_react(), 1); 9134 var import_jsx_runtime11 = __toESM(require_jsx_runtime(), 1); 9135 var TooltipProvider = function TooltipProvider2(props) { 9136 const { 9137 delay, 9138 closeDelay, 9139 timeout = 400 9140 } = props; 9141 const contextValue = React57.useMemo(() => ({ 9142 delay, 9143 closeDelay 9144 }), [delay, closeDelay]); 9145 const delayValue = React57.useMemo(() => ({ 9146 open: delay, 9147 close: closeDelay 9148 }), [delay, closeDelay]); 9149 return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(TooltipProviderContext.Provider, { 9150 value: contextValue, 9151 children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(FloatingDelayGroup, { 9152 delay: delayValue, 9153 timeoutMs: timeout, 9154 children: props.children 9155 }) 9156 }); 9157 }; 9158 if (true) TooltipProvider.displayName = "TooltipProvider"; 9159 9160 // node_modules/@base-ui/react/esm/tooltip/viewport/TooltipViewport.js 9161 var React58 = __toESM(require_react(), 1); 9162 9163 // node_modules/@base-ui/react/esm/tooltip/viewport/TooltipViewportCssVars.js 9164 var TooltipViewportCssVars = /* @__PURE__ */ (function(TooltipViewportCssVars2) { 9165 TooltipViewportCssVars2["popupWidth"] = "--popup-width"; 9166 TooltipViewportCssVars2["popupHeight"] = "--popup-height"; 9167 return TooltipViewportCssVars2; 9168 })({}); 9169 9170 // node_modules/@base-ui/react/esm/tooltip/viewport/TooltipViewport.js 9171 var stateAttributesMapping3 = { 9172 activationDirection: (value) => value ? { 9173 "data-activation-direction": value 9174 } : null 9175 }; 9176 var TooltipViewport = /* @__PURE__ */ React58.forwardRef(function TooltipViewport2(componentProps, forwardedRef) { 9177 const { 9178 render: render4, 9179 className, 9180 style, 9181 children, 9182 ...elementProps 9183 } = componentProps; 9184 const store = useTooltipRootContext(); 9185 const positioner = useTooltipPositionerContext(); 9186 const instantType = store.useState("instantType"); 9187 const { 9188 children: childrenToRender, 9189 state: viewportState 9190 } = usePopupViewport({ 9191 store, 9192 side: positioner.side, 9193 cssVars: TooltipViewportCssVars, 9194 children 9195 }); 9196 const state = { 9197 activationDirection: viewportState.activationDirection, 9198 transitioning: viewportState.transitioning, 9199 instant: instantType 9200 }; 9201 return useRenderElement("div", componentProps, { 9202 state, 9203 ref: forwardedRef, 9204 props: [elementProps, { 9205 children: childrenToRender 9206 }], 9207 stateAttributesMapping: stateAttributesMapping3 9208 }); 9209 }); 9210 if (true) TooltipViewport.displayName = "TooltipViewport"; 9211 9212 // node_modules/@base-ui/react/esm/tooltip/store/TooltipHandle.js 9213 var TooltipHandle = class { 9214 /** 9215 * Internal store holding the tooltip state. 9216 * @internal 9217 */ 9218 constructor() { 9219 this.store = new TooltipStore(); 9220 } 9221 /** 9222 * Opens the tooltip and associates it with the trigger with the given ID. 9223 * The trigger must be a Tooltip.Trigger component with this handle passed as a prop. 9224 * 9225 * This method should only be called in an event handler or an effect (not during rendering). 9226 * 9227 * @param triggerId ID of the trigger to associate with the tooltip. 9228 */ 9229 open(triggerId) { 9230 const triggerElement = triggerId ? this.store.context.triggerElements.getById(triggerId) : void 0; 9231 if (triggerId && !triggerElement) { 9232 throw new Error(true ? `Base UI: TooltipHandle.open: No trigger found with id "$triggerId}".` : formatErrorMessage_default(81, triggerId)); 9233 } 9234 this.store.setOpen(true, createChangeEventDetails(reason_parts_exports.imperativeAction, void 0, triggerElement)); 9235 } 9236 /** 9237 * Closes the tooltip. 9238 */ 9239 close() { 9240 this.store.setOpen(false, createChangeEventDetails(reason_parts_exports.imperativeAction, void 0, void 0)); 9241 } 9242 /** 9243 * Indicates whether the tooltip is currently open. 9244 */ 9245 get isOpen() { 9246 return this.store.state.open; 9247 } 9248 }; 9249 function createTooltipHandle() { 9250 return new TooltipHandle(); 9251 } 9252 9253 // node_modules/@base-ui/react/esm/use-render/useRender.js 9254 function useRender(params) { 9255 return useRenderElement(params.defaultTagName ?? "div", params, params); 9256 } 9257 9258 // packages/ui/build-module/text/text.mjs 9259 var import_element8 = __toESM(require_element(), 1); 9260 var STYLE_HASH_ATTRIBUTE = "data-wp-hash"; 9261 function getRuntime() { 9262 const globalScope = globalThis; 9263 if (globalScope.__wpStyleRuntime) { 9264 return globalScope.__wpStyleRuntime; 9265 } 9266 globalScope.__wpStyleRuntime = { 9267 documents: /* @__PURE__ */ new Map(), 9268 styles: /* @__PURE__ */ new Map(), 9269 injectedStyles: /* @__PURE__ */ new WeakMap() 9270 }; 9271 if (typeof document !== "undefined") { 9272 registerDocument(document); 9273 } 9274 return globalScope.__wpStyleRuntime; 9275 } 9276 function documentContainsStyleHash(targetDocument, hash) { 9277 if (!targetDocument.head) { 9278 return false; 9279 } 9280 for (const style of targetDocument.head.querySelectorAll( 9281 `style[$STYLE_HASH_ATTRIBUTE}]` 9282 )) { 9283 if (style.getAttribute(STYLE_HASH_ATTRIBUTE) === hash) { 9284 return true; 9285 } 9286 } 9287 return false; 9288 } 9289 function injectStyle(targetDocument, hash, css) { 9290 if (!targetDocument.head) { 9291 return; 9292 } 9293 const runtime = getRuntime(); 9294 let injectedStyles = runtime.injectedStyles.get(targetDocument); 9295 if (!injectedStyles) { 9296 injectedStyles = /* @__PURE__ */ new Set(); 9297 runtime.injectedStyles.set(targetDocument, injectedStyles); 9298 } 9299 if (injectedStyles.has(hash)) { 9300 return; 9301 } 9302 if (documentContainsStyleHash(targetDocument, hash)) { 9303 injectedStyles.add(hash); 9304 return; 9305 } 9306 const style = targetDocument.createElement("style"); 9307 style.setAttribute(STYLE_HASH_ATTRIBUTE, hash); 9308 style.appendChild(targetDocument.createTextNode(css)); 9309 targetDocument.head.appendChild(style); 9310 injectedStyles.add(hash); 9311 } 9312 function registerDocument(targetDocument) { 9313 const runtime = getRuntime(); 9314 runtime.documents.set( 9315 targetDocument, 9316 (runtime.documents.get(targetDocument) ?? 0) + 1 9317 ); 9318 for (const [hash, css] of runtime.styles) { 9319 injectStyle(targetDocument, hash, css); 9320 } 9321 return () => { 9322 const count = runtime.documents.get(targetDocument); 9323 if (count === void 0) { 9324 return; 9325 } 9326 if (count <= 1) { 9327 runtime.documents.delete(targetDocument); 9328 return; 9329 } 9330 runtime.documents.set(targetDocument, count - 1); 9331 }; 9332 } 9333 function registerStyle(hash, css) { 9334 const runtime = getRuntime(); 9335 runtime.styles.set(hash, css); 9336 for (const targetDocument of runtime.documents.keys()) { 9337 injectStyle(targetDocument, hash, css); 9338 } 9339 } 9340 if (typeof process === "undefined" || true) { 9341 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)}}'); 9342 } 9343 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" }; 9344 if (typeof process === "undefined" || true) { 9345 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)}"); 9346 } 9347 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" }; 9348 var Text = (0, import_element8.forwardRef)(function Text2({ variant = "body-md", render: render4, className, ...props }, ref) { 9349 const element = useRender({ 9350 render: render4, 9351 defaultTagName: "span", 9352 ref, 9353 props: mergeProps(props, { 9354 className: clsx_default( 9355 style_default.text, 9356 global_css_defense_default.heading, 9357 global_css_defense_default.p, 9358 style_default[variant], 9359 className 9360 ) 9361 }) 9362 }); 9363 return element; 9364 }); 9365 9366 // packages/ui/build-module/badge/badge.mjs 9367 var import_jsx_runtime12 = __toESM(require_jsx_runtime(), 1); 9368 var STYLE_HASH_ATTRIBUTE2 = "data-wp-hash"; 9369 function getRuntime2() { 9370 const globalScope = globalThis; 9371 if (globalScope.__wpStyleRuntime) { 9372 return globalScope.__wpStyleRuntime; 9373 } 9374 globalScope.__wpStyleRuntime = { 9375 documents: /* @__PURE__ */ new Map(), 9376 styles: /* @__PURE__ */ new Map(), 9377 injectedStyles: /* @__PURE__ */ new WeakMap() 9378 }; 9379 if (typeof document !== "undefined") { 9380 registerDocument2(document); 9381 } 9382 return globalScope.__wpStyleRuntime; 9383 } 9384 function documentContainsStyleHash2(targetDocument, hash) { 9385 if (!targetDocument.head) { 9386 return false; 9387 } 9388 for (const style of targetDocument.head.querySelectorAll( 9389 `style[$STYLE_HASH_ATTRIBUTE2}]` 9390 )) { 9391 if (style.getAttribute(STYLE_HASH_ATTRIBUTE2) === hash) { 9392 return true; 9393 } 9394 } 9395 return false; 9396 } 9397 function injectStyle2(targetDocument, hash, css) { 9398 if (!targetDocument.head) { 9399 return; 9400 } 9401 const runtime = getRuntime2(); 9402 let injectedStyles = runtime.injectedStyles.get(targetDocument); 9403 if (!injectedStyles) { 9404 injectedStyles = /* @__PURE__ */ new Set(); 9405 runtime.injectedStyles.set(targetDocument, injectedStyles); 9406 } 9407 if (injectedStyles.has(hash)) { 9408 return; 9409 } 9410 if (documentContainsStyleHash2(targetDocument, hash)) { 9411 injectedStyles.add(hash); 9412 return; 9413 } 9414 const style = targetDocument.createElement("style"); 9415 style.setAttribute(STYLE_HASH_ATTRIBUTE2, hash); 9416 style.appendChild(targetDocument.createTextNode(css)); 9417 targetDocument.head.appendChild(style); 9418 injectedStyles.add(hash); 9419 } 9420 function registerDocument2(targetDocument) { 9421 const runtime = getRuntime2(); 9422 runtime.documents.set( 9423 targetDocument, 9424 (runtime.documents.get(targetDocument) ?? 0) + 1 9425 ); 9426 for (const [hash, css] of runtime.styles) { 9427 injectStyle2(targetDocument, hash, css); 9428 } 9429 return () => { 9430 const count = runtime.documents.get(targetDocument); 9431 if (count === void 0) { 9432 return; 9433 } 9434 if (count <= 1) { 9435 runtime.documents.delete(targetDocument); 9436 return; 9437 } 9438 runtime.documents.set(targetDocument, count - 1); 9439 }; 9440 } 9441 function registerStyle2(hash, css) { 9442 const runtime = getRuntime2(); 9443 runtime.styles.set(hash, css); 9444 for (const targetDocument of runtime.documents.keys()) { 9445 injectStyle2(targetDocument, hash, css); 9446 } 9447 } 9448 if (typeof process === "undefined" || true) { 9449 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))}}"); 9450 } 9451 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" }; 9452 var Badge = (0, import_element9.forwardRef)(function Badge2({ intent = "none", className, ...props }, ref) { 9453 return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)( 9454 Text, 9455 { 9456 ref, 9457 className: clsx_default( 9458 style_default2.badge, 9459 style_default2[`is-$intent}-intent`], 9460 className 9461 ), 9462 ...props, 9463 variant: "body-sm" 9464 } 9465 ); 9466 }); 9467 9468 // packages/ui/build-module/icon/icon.mjs 9469 var import_element10 = __toESM(require_element(), 1); 9470 var import_primitives = __toESM(require_primitives(), 1); 9471 var import_jsx_runtime13 = __toESM(require_jsx_runtime(), 1); 9472 var Icon = (0, import_element10.forwardRef)(function Icon2({ icon, size: size4 = 24, ...restProps }, ref) { 9473 return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)( 9474 import_primitives.SVG, 9475 { 9476 ref, 9477 fill: "currentColor", 9478 ...icon.props, 9479 ...restProps, 9480 width: size4, 9481 height: size4 9482 } 9483 ); 9484 }); 9485 9486 // packages/ui/build-module/card/index.mjs 9487 var card_exports = {}; 9488 __export(card_exports, { 9489 Content: () => Content, 9490 FullBleed: () => FullBleed, 9491 Header: () => Header, 9492 Root: () => Root, 9493 Title: () => Title 9494 }); 9495 9496 // packages/ui/build-module/card/root.mjs 9497 var import_element11 = __toESM(require_element(), 1); 9498 var STYLE_HASH_ATTRIBUTE3 = "data-wp-hash"; 9499 function getRuntime3() { 9500 const globalScope = globalThis; 9501 if (globalScope.__wpStyleRuntime) { 9502 return globalScope.__wpStyleRuntime; 9503 } 9504 globalScope.__wpStyleRuntime = { 9505 documents: /* @__PURE__ */ new Map(), 9506 styles: /* @__PURE__ */ new Map(), 9507 injectedStyles: /* @__PURE__ */ new WeakMap() 9508 }; 9509 if (typeof document !== "undefined") { 9510 registerDocument3(document); 9511 } 9512 return globalScope.__wpStyleRuntime; 9513 } 9514 function documentContainsStyleHash3(targetDocument, hash) { 9515 if (!targetDocument.head) { 9516 return false; 9517 } 9518 for (const style of targetDocument.head.querySelectorAll( 9519 `style[$STYLE_HASH_ATTRIBUTE3}]` 9520 )) { 9521 if (style.getAttribute(STYLE_HASH_ATTRIBUTE3) === hash) { 9522 return true; 9523 } 9524 } 9525 return false; 9526 } 9527 function injectStyle3(targetDocument, hash, css) { 9528 if (!targetDocument.head) { 9529 return; 9530 } 9531 const runtime = getRuntime3(); 9532 let injectedStyles = runtime.injectedStyles.get(targetDocument); 9533 if (!injectedStyles) { 9534 injectedStyles = /* @__PURE__ */ new Set(); 9535 runtime.injectedStyles.set(targetDocument, injectedStyles); 9536 } 9537 if (injectedStyles.has(hash)) { 9538 return; 9539 } 9540 if (documentContainsStyleHash3(targetDocument, hash)) { 9541 injectedStyles.add(hash); 9542 return; 9543 } 9544 const style = targetDocument.createElement("style"); 9545 style.setAttribute(STYLE_HASH_ATTRIBUTE3, hash); 9546 style.appendChild(targetDocument.createTextNode(css)); 9547 targetDocument.head.appendChild(style); 9548 injectedStyles.add(hash); 9549 } 9550 function registerDocument3(targetDocument) { 9551 const runtime = getRuntime3(); 9552 runtime.documents.set( 9553 targetDocument, 9554 (runtime.documents.get(targetDocument) ?? 0) + 1 9555 ); 9556 for (const [hash, css] of runtime.styles) { 9557 injectStyle3(targetDocument, hash, css); 9558 } 9559 return () => { 9560 const count = runtime.documents.get(targetDocument); 9561 if (count === void 0) { 9562 return; 9563 } 9564 if (count <= 1) { 9565 runtime.documents.delete(targetDocument); 9566 return; 9567 } 9568 runtime.documents.set(targetDocument, count - 1); 9569 }; 9570 } 9571 function registerStyle3(hash, css) { 9572 const runtime = getRuntime3(); 9573 runtime.styles.set(hash, css); 9574 for (const targetDocument of runtime.documents.keys()) { 9575 injectStyle3(targetDocument, hash, css); 9576 } 9577 } 9578 if (typeof process === "undefined" || true) { 9579 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}}}"); 9580 } 9581 var resets_default = { "box-sizing": "_336cd3e4e743482f__box-sizing" }; 9582 if (typeof process === "undefined" || true) { 9583 registerStyle3("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)}}"); 9584 } 9585 var style_default3 = { "root": "_02872bf298eadc43__root", "header": "bbccc92e6ba5662d__header", "content": "_5dffdaf2a6e669ac__content", "fullbleed": "c1fa192587e1b4a6__fullbleed" }; 9586 var Root = (0, import_element11.forwardRef)(function Card({ render: render4, ...restProps }, ref) { 9587 const mergedClassName = clsx_default(style_default3.root, resets_default["box-sizing"]); 9588 const element = useRender({ 9589 defaultTagName: "div", 9590 render: render4, 9591 ref, 9592 props: mergeProps({ className: mergedClassName }, restProps) 9593 }); 9594 return element; 9595 }); 9596 9597 // packages/ui/build-module/card/header.mjs 9598 var import_element12 = __toESM(require_element(), 1); 9599 var STYLE_HASH_ATTRIBUTE4 = "data-wp-hash"; 9600 function getRuntime4() { 9601 const globalScope = globalThis; 9602 if (globalScope.__wpStyleRuntime) { 9603 return globalScope.__wpStyleRuntime; 9604 } 9605 globalScope.__wpStyleRuntime = { 9606 documents: /* @__PURE__ */ new Map(), 9607 styles: /* @__PURE__ */ new Map(), 9608 injectedStyles: /* @__PURE__ */ new WeakMap() 9609 }; 9610 if (typeof document !== "undefined") { 9611 registerDocument4(document); 9612 } 9613 return globalScope.__wpStyleRuntime; 9614 } 9615 function documentContainsStyleHash4(targetDocument, hash) { 9616 if (!targetDocument.head) { 9617 return false; 9618 } 9619 for (const style of targetDocument.head.querySelectorAll( 9620 `style[$STYLE_HASH_ATTRIBUTE4}]` 9621 )) { 9622 if (style.getAttribute(STYLE_HASH_ATTRIBUTE4) === hash) { 9623 return true; 9624 } 9625 } 9626 return false; 9627 } 9628 function injectStyle4(targetDocument, hash, css) { 9629 if (!targetDocument.head) { 9630 return; 9631 } 9632 const runtime = getRuntime4(); 9633 let injectedStyles = runtime.injectedStyles.get(targetDocument); 9634 if (!injectedStyles) { 9635 injectedStyles = /* @__PURE__ */ new Set(); 9636 runtime.injectedStyles.set(targetDocument, injectedStyles); 9637 } 9638 if (injectedStyles.has(hash)) { 9639 return; 9640 } 9641 if (documentContainsStyleHash4(targetDocument, hash)) { 9642 injectedStyles.add(hash); 9643 return; 9644 } 9645 const style = targetDocument.createElement("style"); 9646 style.setAttribute(STYLE_HASH_ATTRIBUTE4, hash); 9647 style.appendChild(targetDocument.createTextNode(css)); 9648 targetDocument.head.appendChild(style); 9649 injectedStyles.add(hash); 9650 } 9651 function registerDocument4(targetDocument) { 9652 const runtime = getRuntime4(); 9653 runtime.documents.set( 9654 targetDocument, 9655 (runtime.documents.get(targetDocument) ?? 0) + 1 9656 ); 9657 for (const [hash, css] of runtime.styles) { 9658 injectStyle4(targetDocument, hash, css); 9659 } 9660 return () => { 9661 const count = runtime.documents.get(targetDocument); 9662 if (count === void 0) { 9663 return; 9664 } 9665 if (count <= 1) { 9666 runtime.documents.delete(targetDocument); 9667 return; 9668 } 9669 runtime.documents.set(targetDocument, count - 1); 9670 }; 9671 } 9672 function registerStyle4(hash, css) { 9673 const runtime = getRuntime4(); 9674 runtime.styles.set(hash, css); 9675 for (const targetDocument of runtime.documents.keys()) { 9676 injectStyle4(targetDocument, hash, css); 9677 } 9678 } 9679 if (typeof process === "undefined" || true) { 9680 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)}}"); 9681 } 9682 var style_default4 = { "root": "_02872bf298eadc43__root", "header": "bbccc92e6ba5662d__header", "content": "_5dffdaf2a6e669ac__content", "fullbleed": "c1fa192587e1b4a6__fullbleed" }; 9683 var Header = (0, import_element12.forwardRef)( 9684 function CardHeader({ render: render4, ...props }, ref) { 9685 const element = useRender({ 9686 defaultTagName: "div", 9687 render: render4, 9688 ref, 9689 props: mergeProps({ className: style_default4.header }, props) 9690 }); 9691 return element; 9692 } 9693 ); 9694 9695 // packages/ui/build-module/card/content.mjs 9696 var import_element13 = __toESM(require_element(), 1); 9697 var STYLE_HASH_ATTRIBUTE5 = "data-wp-hash"; 9698 function getRuntime5() { 9699 const globalScope = globalThis; 9700 if (globalScope.__wpStyleRuntime) { 9701 return globalScope.__wpStyleRuntime; 9702 } 9703 globalScope.__wpStyleRuntime = { 9704 documents: /* @__PURE__ */ new Map(), 9705 styles: /* @__PURE__ */ new Map(), 9706 injectedStyles: /* @__PURE__ */ new WeakMap() 9707 }; 9708 if (typeof document !== "undefined") { 9709 registerDocument5(document); 9710 } 9711 return globalScope.__wpStyleRuntime; 9712 } 9713 function documentContainsStyleHash5(targetDocument, hash) { 9714 if (!targetDocument.head) { 9715 return false; 9716 } 9717 for (const style of targetDocument.head.querySelectorAll( 9718 `style[$STYLE_HASH_ATTRIBUTE5}]` 9719 )) { 9720 if (style.getAttribute(STYLE_HASH_ATTRIBUTE5) === hash) { 9721 return true; 9722 } 9723 } 9724 return false; 9725 } 9726 function injectStyle5(targetDocument, hash, css) { 9727 if (!targetDocument.head) { 9728 return; 9729 } 9730 const runtime = getRuntime5(); 9731 let injectedStyles = runtime.injectedStyles.get(targetDocument); 9732 if (!injectedStyles) { 9733 injectedStyles = /* @__PURE__ */ new Set(); 9734 runtime.injectedStyles.set(targetDocument, injectedStyles); 9735 } 9736 if (injectedStyles.has(hash)) { 9737 return; 9738 } 9739 if (documentContainsStyleHash5(targetDocument, hash)) { 9740 injectedStyles.add(hash); 9741 return; 9742 } 9743 const style = targetDocument.createElement("style"); 9744 style.setAttribute(STYLE_HASH_ATTRIBUTE5, hash); 9745 style.appendChild(targetDocument.createTextNode(css)); 9746 targetDocument.head.appendChild(style); 9747 injectedStyles.add(hash); 9748 } 9749 function registerDocument5(targetDocument) { 9750 const runtime = getRuntime5(); 9751 runtime.documents.set( 9752 targetDocument, 9753 (runtime.documents.get(targetDocument) ?? 0) + 1 9754 ); 9755 for (const [hash, css] of runtime.styles) { 9756 injectStyle5(targetDocument, hash, css); 9757 } 9758 return () => { 9759 const count = runtime.documents.get(targetDocument); 9760 if (count === void 0) { 9761 return; 9762 } 9763 if (count <= 1) { 9764 runtime.documents.delete(targetDocument); 9765 return; 9766 } 9767 runtime.documents.set(targetDocument, count - 1); 9768 }; 9769 } 9770 function registerStyle5(hash, css) { 9771 const runtime = getRuntime5(); 9772 runtime.styles.set(hash, css); 9773 for (const targetDocument of runtime.documents.keys()) { 9774 injectStyle5(targetDocument, hash, css); 9775 } 9776 } 9777 if (typeof process === "undefined" || true) { 9778 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)}}"); 9779 } 9780 var style_default5 = { "root": "_02872bf298eadc43__root", "header": "bbccc92e6ba5662d__header", "content": "_5dffdaf2a6e669ac__content", "fullbleed": "c1fa192587e1b4a6__fullbleed" }; 9781 var Content = (0, import_element13.forwardRef)( 9782 function CardContent({ render: render4, ...props }, ref) { 9783 const element = useRender({ 9784 defaultTagName: "div", 9785 render: render4, 9786 ref, 9787 props: mergeProps({ className: style_default5.content }, props) 9788 }); 9789 return element; 9790 } 9791 ); 9792 9793 // packages/ui/build-module/card/full-bleed.mjs 9794 var import_element14 = __toESM(require_element(), 1); 9795 var STYLE_HASH_ATTRIBUTE6 = "data-wp-hash"; 9796 function getRuntime6() { 9797 const globalScope = globalThis; 9798 if (globalScope.__wpStyleRuntime) { 9799 return globalScope.__wpStyleRuntime; 9800 } 9801 globalScope.__wpStyleRuntime = { 9802 documents: /* @__PURE__ */ new Map(), 9803 styles: /* @__PURE__ */ new Map(), 9804 injectedStyles: /* @__PURE__ */ new WeakMap() 9805 }; 9806 if (typeof document !== "undefined") { 9807 registerDocument6(document); 9808 } 9809 return globalScope.__wpStyleRuntime; 9810 } 9811 function documentContainsStyleHash6(targetDocument, hash) { 9812 if (!targetDocument.head) { 9813 return false; 9814 } 9815 for (const style of targetDocument.head.querySelectorAll( 9816 `style[$STYLE_HASH_ATTRIBUTE6}]` 9817 )) { 9818 if (style.getAttribute(STYLE_HASH_ATTRIBUTE6) === hash) { 9819 return true; 9820 } 9821 } 9822 return false; 9823 } 9824 function injectStyle6(targetDocument, hash, css) { 9825 if (!targetDocument.head) { 9826 return; 9827 } 9828 const runtime = getRuntime6(); 9829 let injectedStyles = runtime.injectedStyles.get(targetDocument); 9830 if (!injectedStyles) { 9831 injectedStyles = /* @__PURE__ */ new Set(); 9832 runtime.injectedStyles.set(targetDocument, injectedStyles); 9833 } 9834 if (injectedStyles.has(hash)) { 9835 return; 9836 } 9837 if (documentContainsStyleHash6(targetDocument, hash)) { 9838 injectedStyles.add(hash); 9839 return; 9840 } 9841 const style = targetDocument.createElement("style"); 9842 style.setAttribute(STYLE_HASH_ATTRIBUTE6, hash); 9843 style.appendChild(targetDocument.createTextNode(css)); 9844 targetDocument.head.appendChild(style); 9845 injectedStyles.add(hash); 9846 } 9847 function registerDocument6(targetDocument) { 9848 const runtime = getRuntime6(); 9849 runtime.documents.set( 9850 targetDocument, 9851 (runtime.documents.get(targetDocument) ?? 0) + 1 9852 ); 9853 for (const [hash, css] of runtime.styles) { 9854 injectStyle6(targetDocument, hash, css); 9855 } 9856 return () => { 9857 const count = runtime.documents.get(targetDocument); 9858 if (count === void 0) { 9859 return; 9860 } 9861 if (count <= 1) { 9862 runtime.documents.delete(targetDocument); 9863 return; 9864 } 9865 runtime.documents.set(targetDocument, count - 1); 9866 }; 9867 } 9868 function registerStyle6(hash, css) { 9869 const runtime = getRuntime6(); 9870 runtime.styles.set(hash, css); 9871 for (const targetDocument of runtime.documents.keys()) { 9872 injectStyle6(targetDocument, hash, css); 9873 } 9874 } 9875 if (typeof process === "undefined" || true) { 9876 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)}}"); 9877 } 9878 var style_default6 = { "root": "_02872bf298eadc43__root", "header": "bbccc92e6ba5662d__header", "content": "_5dffdaf2a6e669ac__content", "fullbleed": "c1fa192587e1b4a6__fullbleed" }; 9879 var FullBleed = (0, import_element14.forwardRef)( 9880 function CardFullBleed({ render: render4, ...props }, ref) { 9881 const element = useRender({ 9882 defaultTagName: "div", 9883 render: render4, 9884 ref, 9885 props: mergeProps( 9886 { className: style_default6.fullbleed }, 9887 props 9888 ) 9889 }); 9890 return element; 9891 } 9892 ); 9893 9894 // packages/ui/build-module/card/title.mjs 9895 var import_element15 = __toESM(require_element(), 1); 9896 var import_jsx_runtime14 = __toESM(require_jsx_runtime(), 1); 9897 var DEFAULT_TAG = /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", {}); 9898 var Title = (0, import_element15.forwardRef)( 9899 function CardTitle({ render: render4 = DEFAULT_TAG, children, ...props }, ref) { 9900 return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)( 9901 Text, 9902 { 9903 ref, 9904 variant: "heading-lg", 9905 render: render4, 9906 ...props, 9907 children 9908 } 9909 ); 9910 } 9911 ); 9912 9913 // packages/ui/build-module/collapsible/panel.mjs 9914 var import_element16 = __toESM(require_element(), 1); 9915 var import_jsx_runtime15 = __toESM(require_jsx_runtime(), 1); 9916 var Panel = (0, import_element16.forwardRef)( 9917 function CollapsiblePanel3(props, forwardedRef) { 9918 return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(index_parts_exports.Panel, { ref: forwardedRef, ...props }); 9919 } 9920 ); 9921 9922 // packages/ui/build-module/collapsible/root.mjs 9923 var import_element17 = __toESM(require_element(), 1); 9924 var import_jsx_runtime16 = __toESM(require_jsx_runtime(), 1); 9925 var Root2 = (0, import_element17.forwardRef)( 9926 function CollapsibleRoot3(props, forwardedRef) { 9927 return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(index_parts_exports.Root, { ref: forwardedRef, ...props }); 9928 } 9929 ); 9930 9931 // packages/ui/build-module/collapsible/trigger.mjs 9932 var import_element18 = __toESM(require_element(), 1); 9933 var import_jsx_runtime17 = __toESM(require_jsx_runtime(), 1); 9934 var Trigger = (0, import_element18.forwardRef)( 9935 function CollapsibleTrigger3(props, forwardedRef) { 9936 return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(index_parts_exports.Trigger, { ref: forwardedRef, ...props }); 9937 } 9938 ); 9939 9940 // packages/ui/build-module/collapsible-card/index.mjs 9941 var collapsible_card_exports = {}; 9942 __export(collapsible_card_exports, { 9943 Content: () => Content2, 9944 Header: () => Header2, 9945 HeaderDescription: () => HeaderDescription, 9946 Root: () => Root3 9947 }); 9948 9949 // packages/ui/build-module/collapsible-card/root.mjs 9950 var import_element19 = __toESM(require_element(), 1); 9951 var import_jsx_runtime18 = __toESM(require_jsx_runtime(), 1); 9952 var Root3 = (0, import_element19.forwardRef)( 9953 function CollapsibleCardRoot({ render: render4, ...restProps }, ref) { 9954 return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)( 9955 Root2, 9956 { 9957 ref, 9958 render: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Root, { render: render4 }), 9959 ...restProps 9960 } 9961 ); 9962 } 9963 ); 9964 9965 // packages/ui/build-module/collapsible-card/header.mjs 9966 var import_element21 = __toESM(require_element(), 1); 9967 9968 // packages/icons/build-module/library/chevron-down.mjs 9969 var import_primitives2 = __toESM(require_primitives(), 1); 9970 var import_jsx_runtime19 = __toESM(require_jsx_runtime(), 1); 9971 var chevron_down_default = /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_primitives2.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_primitives2.Path, { d: "M17.5 11.6L12 16l-5.5-4.4.9-1.2L12 14l4.5-3.6 1 1.2z" }) }); 9972 9973 // packages/icons/build-module/library/close-small.mjs 9974 var import_primitives3 = __toESM(require_primitives(), 1); 9975 var import_jsx_runtime20 = __toESM(require_jsx_runtime(), 1); 9976 var close_small_default = /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_primitives3.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_primitives3.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" }) }); 9977 9978 // packages/icons/build-module/library/envelope.mjs 9979 var import_primitives4 = __toESM(require_primitives(), 1); 9980 var import_jsx_runtime21 = __toESM(require_jsx_runtime(), 1); 9981 var envelope_default = /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_primitives4.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_primitives4.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" }) }); 9982 9983 // packages/icons/build-module/library/error.mjs 9984 var import_primitives5 = __toESM(require_primitives(), 1); 9985 var import_jsx_runtime22 = __toESM(require_jsx_runtime(), 1); 9986 var error_default = /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_primitives5.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_primitives5.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" }) }); 9987 9988 // packages/icons/build-module/library/link.mjs 9989 var import_primitives6 = __toESM(require_primitives(), 1); 9990 var import_jsx_runtime23 = __toESM(require_jsx_runtime(), 1); 9991 var link_default = /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_primitives6.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_primitives6.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" }) }); 9992 9993 // packages/icons/build-module/library/mobile.mjs 9994 var import_primitives7 = __toESM(require_primitives(), 1); 9995 var import_jsx_runtime24 = __toESM(require_jsx_runtime(), 1); 9996 var mobile_default = /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_primitives7.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_primitives7.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" }) }); 9997 9998 // packages/icons/build-module/library/pencil.mjs 9999 var import_primitives8 = __toESM(require_primitives(), 1); 10000 var import_jsx_runtime25 = __toESM(require_jsx_runtime(), 1); 10001 var pencil_default = /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_primitives8.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_primitives8.Path, { d: "m19 7-3-3-8.5 8.5-1 4 4-1L19 7Zm-7 11.5H5V20h7v-1.5Z" }) }); 10002 10003 // packages/icons/build-module/library/seen.mjs 10004 var import_primitives9 = __toESM(require_primitives(), 1); 10005 var import_jsx_runtime26 = __toESM(require_jsx_runtime(), 1); 10006 var seen_default = /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_primitives9.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_primitives9.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" }) }); 10007 10008 // packages/icons/build-module/library/unseen.mjs 10009 var import_primitives10 = __toESM(require_primitives(), 1); 10010 var import_jsx_runtime27 = __toESM(require_jsx_runtime(), 1); 10011 var unseen_default = /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_primitives10.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_primitives10.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" }) }); 10012 10013 // packages/ui/build-module/collapsible-card/context.mjs 10014 var import_element20 = __toESM(require_element(), 1); 10015 var HeaderDescriptionIdContext = (0, import_element20.createContext)({ 10016 setDescriptionId: () => { 10017 } 10018 }); 10019 10020 // packages/ui/build-module/collapsible-card/header.mjs 10021 var import_jsx_runtime28 = __toESM(require_jsx_runtime(), 1); 10022 var STYLE_HASH_ATTRIBUTE7 = "data-wp-hash"; 10023 function getRuntime7() { 10024 const globalScope = globalThis; 10025 if (globalScope.__wpStyleRuntime) { 10026 return globalScope.__wpStyleRuntime; 10027 } 10028 globalScope.__wpStyleRuntime = { 10029 documents: /* @__PURE__ */ new Map(), 10030 styles: /* @__PURE__ */ new Map(), 10031 injectedStyles: /* @__PURE__ */ new WeakMap() 10032 }; 10033 if (typeof document !== "undefined") { 10034 registerDocument7(document); 10035 } 10036 return globalScope.__wpStyleRuntime; 10037 } 10038 function documentContainsStyleHash7(targetDocument, hash) { 10039 if (!targetDocument.head) { 10040 return false; 10041 } 10042 for (const style of targetDocument.head.querySelectorAll( 10043 `style[$STYLE_HASH_ATTRIBUTE7}]` 10044 )) { 10045 if (style.getAttribute(STYLE_HASH_ATTRIBUTE7) === hash) { 10046 return true; 10047 } 10048 } 10049 return false; 10050 } 10051 function injectStyle7(targetDocument, hash, css) { 10052 if (!targetDocument.head) { 10053 return; 10054 } 10055 const runtime = getRuntime7(); 10056 let injectedStyles = runtime.injectedStyles.get(targetDocument); 10057 if (!injectedStyles) { 10058 injectedStyles = /* @__PURE__ */ new Set(); 10059 runtime.injectedStyles.set(targetDocument, injectedStyles); 10060 } 10061 if (injectedStyles.has(hash)) { 10062 return; 10063 } 10064 if (documentContainsStyleHash7(targetDocument, hash)) { 10065 injectedStyles.add(hash); 10066 return; 10067 } 10068 const style = targetDocument.createElement("style"); 10069 style.setAttribute(STYLE_HASH_ATTRIBUTE7, hash); 10070 style.appendChild(targetDocument.createTextNode(css)); 10071 targetDocument.head.appendChild(style); 10072 injectedStyles.add(hash); 10073 } 10074 function registerDocument7(targetDocument) { 10075 const runtime = getRuntime7(); 10076 runtime.documents.set( 10077 targetDocument, 10078 (runtime.documents.get(targetDocument) ?? 0) + 1 10079 ); 10080 for (const [hash, css] of runtime.styles) { 10081 injectStyle7(targetDocument, hash, css); 10082 } 10083 return () => { 10084 const count = runtime.documents.get(targetDocument); 10085 if (count === void 0) { 10086 return; 10087 } 10088 if (count <= 1) { 10089 runtime.documents.delete(targetDocument); 10090 return; 10091 } 10092 runtime.documents.set(targetDocument, count - 1); 10093 }; 10094 } 10095 function registerStyle7(hash, css) { 10096 const runtime = getRuntime7(); 10097 runtime.styles.set(hash, css); 10098 for (const targetDocument of runtime.documents.keys()) { 10099 injectStyle7(targetDocument, hash, css); 10100 } 10101 } 10102 if (typeof process === "undefined" || true) { 10103 registerStyle7("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)}}}"); 10104 } 10105 var style_default7 = { "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" }; 10106 if (typeof process === "undefined" || true) { 10107 registerStyle7("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)}"); 10108 } 10109 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" }; 10110 if (typeof process === "undefined" || true) { 10111 registerStyle7("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))}}"); 10112 } 10113 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" }; 10114 var Header2 = (0, import_element21.forwardRef)( 10115 function CollapsibleCardHeader({ children, className, render: render4, ...restProps }, ref) { 10116 const [descriptionId, setDescriptionId] = (0, import_element21.useState)(); 10117 const contextValue = (0, import_element21.useMemo)( 10118 () => ({ setDescriptionId }), 10119 [setDescriptionId] 10120 ); 10121 return useRender({ 10122 defaultTagName: "div", 10123 render: render4, 10124 ref, 10125 props: mergeProps(restProps, { 10126 className: clsx_default( 10127 global_css_defense_default2.heading, 10128 style_default7["heading-wrapper"], 10129 className 10130 ), 10131 children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(HeaderDescriptionIdContext.Provider, { value: contextValue, children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)( 10132 Trigger, 10133 { 10134 className: style_default7.header, 10135 render: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Header, {}), 10136 nativeButton: false, 10137 "aria-describedby": descriptionId, 10138 children: [ 10139 /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: style_default7["header-content"], children }), 10140 /* @__PURE__ */ (0, import_jsx_runtime28.jsx)( 10141 "div", 10142 { 10143 className: clsx_default( 10144 style_default7["header-trigger-positioner"] 10145 ), 10146 children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)( 10147 "div", 10148 { 10149 className: clsx_default( 10150 style_default7["header-trigger-wrapper"], 10151 global_css_defense_default2.div, 10152 // While the interactive trigger element is the whole header, 10153 // the focus ring will be displayed only on the icon to visually 10154 // emulate it being the button. 10155 focus_default["outset-ring--focus-parent-visible"] 10156 ), 10157 children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)( 10158 Icon, 10159 { 10160 icon: chevron_down_default, 10161 className: style_default7["header-trigger"] 10162 } 10163 ) 10164 } 10165 ) 10166 } 10167 ) 10168 ] 10169 } 10170 ) }) 10171 }) 10172 }); 10173 } 10174 ); 10175 10176 // packages/ui/build-module/collapsible-card/header-description.mjs 10177 var import_element22 = __toESM(require_element(), 1); 10178 var import_jsx_runtime29 = __toESM(require_jsx_runtime(), 1); 10179 var HeaderDescription = (0, import_element22.forwardRef)(function CollapsibleCardHeaderDescription({ children, className, ...restProps }, ref) { 10180 const descriptionId = (0, import_element22.useId)(); 10181 const { setDescriptionId } = (0, import_element22.useContext)(HeaderDescriptionIdContext); 10182 (0, import_element22.useEffect)(() => { 10183 setDescriptionId(descriptionId); 10184 return () => setDescriptionId(void 0); 10185 }, [descriptionId, setDescriptionId]); 10186 return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)( 10187 "div", 10188 { 10189 ref, 10190 id: descriptionId, 10191 "aria-hidden": "true", 10192 className, 10193 ...restProps, 10194 children 10195 } 10196 ); 10197 }); 10198 10199 // packages/ui/build-module/collapsible-card/content.mjs 10200 var import_element23 = __toESM(require_element(), 1); 10201 var import_jsx_runtime30 = __toESM(require_jsx_runtime(), 1); 10202 var STYLE_HASH_ATTRIBUTE8 = "data-wp-hash"; 10203 function getRuntime8() { 10204 const globalScope = globalThis; 10205 if (globalScope.__wpStyleRuntime) { 10206 return globalScope.__wpStyleRuntime; 10207 } 10208 globalScope.__wpStyleRuntime = { 10209 documents: /* @__PURE__ */ new Map(), 10210 styles: /* @__PURE__ */ new Map(), 10211 injectedStyles: /* @__PURE__ */ new WeakMap() 10212 }; 10213 if (typeof document !== "undefined") { 10214 registerDocument8(document); 10215 } 10216 return globalScope.__wpStyleRuntime; 10217 } 10218 function documentContainsStyleHash8(targetDocument, hash) { 10219 if (!targetDocument.head) { 10220 return false; 10221 } 10222 for (const style of targetDocument.head.querySelectorAll( 10223 `style[$STYLE_HASH_ATTRIBUTE8}]` 10224 )) { 10225 if (style.getAttribute(STYLE_HASH_ATTRIBUTE8) === hash) { 10226 return true; 10227 } 10228 } 10229 return false; 10230 } 10231 function injectStyle8(targetDocument, hash, css) { 10232 if (!targetDocument.head) { 10233 return; 10234 } 10235 const runtime = getRuntime8(); 10236 let injectedStyles = runtime.injectedStyles.get(targetDocument); 10237 if (!injectedStyles) { 10238 injectedStyles = /* @__PURE__ */ new Set(); 10239 runtime.injectedStyles.set(targetDocument, injectedStyles); 10240 } 10241 if (injectedStyles.has(hash)) { 10242 return; 10243 } 10244 if (documentContainsStyleHash8(targetDocument, hash)) { 10245 injectedStyles.add(hash); 10246 return; 10247 } 10248 const style = targetDocument.createElement("style"); 10249 style.setAttribute(STYLE_HASH_ATTRIBUTE8, hash); 10250 style.appendChild(targetDocument.createTextNode(css)); 10251 targetDocument.head.appendChild(style); 10252 injectedStyles.add(hash); 10253 } 10254 function registerDocument8(targetDocument) { 10255 const runtime = getRuntime8(); 10256 runtime.documents.set( 10257 targetDocument, 10258 (runtime.documents.get(targetDocument) ?? 0) + 1 10259 ); 10260 for (const [hash, css] of runtime.styles) { 10261 injectStyle8(targetDocument, hash, css); 10262 } 10263 return () => { 10264 const count = runtime.documents.get(targetDocument); 10265 if (count === void 0) { 10266 return; 10267 } 10268 if (count <= 1) { 10269 runtime.documents.delete(targetDocument); 10270 return; 10271 } 10272 runtime.documents.set(targetDocument, count - 1); 10273 }; 10274 } 10275 function registerStyle8(hash, css) { 10276 const runtime = getRuntime8(); 10277 runtime.styles.set(hash, css); 10278 for (const targetDocument of runtime.documents.keys()) { 10279 injectStyle8(targetDocument, hash, css); 10280 } 10281 } 10282 if (typeof process === "undefined" || true) { 10283 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)}}}"); 10284 } 10285 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" }; 10286 var Content2 = (0, import_element23.forwardRef)( 10287 function CollapsibleCardContent({ className, render: render4, children, hiddenUntilFound = true, ...restProps }, ref) { 10288 return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)( 10289 Panel, 10290 { 10291 ref, 10292 className: (state) => clsx_default( 10293 style_default8.content, 10294 state.open && state.transitionStatus === "idle" && style_default8.overflowVisible, 10295 className 10296 ), 10297 hiddenUntilFound, 10298 ...restProps, 10299 children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)( 10300 Content, 10301 { 10302 className: style_default8["content-inner"], 10303 render: render4, 10304 children 10305 } 10306 ) 10307 } 10308 ); 10309 } 10310 ); 10311 10312 // packages/ui/build-module/utils/render-slot-with-children.mjs 10313 var import_element24 = __toESM(require_element(), 1); 10314 function renderSlotWithChildren(slot, defaultSlot, children) { 10315 return (0, import_element24.cloneElement)( 10316 slot ?? defaultSlot, 10317 { children } 10318 ); 10319 } 10320 10321 // packages/ui/build-module/lock-unlock.mjs 10322 var import_private_apis = __toESM(require_private_apis(), 1); 10323 var { lock, unlock } = (0, import_private_apis.__dangerousOptInToUnstableAPIsOnlyForCoreModules)( 10324 "I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.", 10325 "@wordpress/ui" 10326 ); 10327 10328 // packages/ui/build-module/stack/stack.mjs 10329 var import_element25 = __toESM(require_element(), 1); 10330 var STYLE_HASH_ATTRIBUTE9 = "data-wp-hash"; 10331 function getRuntime9() { 10332 const globalScope = globalThis; 10333 if (globalScope.__wpStyleRuntime) { 10334 return globalScope.__wpStyleRuntime; 10335 } 10336 globalScope.__wpStyleRuntime = { 10337 documents: /* @__PURE__ */ new Map(), 10338 styles: /* @__PURE__ */ new Map(), 10339 injectedStyles: /* @__PURE__ */ new WeakMap() 10340 }; 10341 if (typeof document !== "undefined") { 10342 registerDocument9(document); 10343 } 10344 return globalScope.__wpStyleRuntime; 10345 } 10346 function documentContainsStyleHash9(targetDocument, hash) { 10347 if (!targetDocument.head) { 10348 return false; 10349 } 10350 for (const style of targetDocument.head.querySelectorAll( 10351 `style[$STYLE_HASH_ATTRIBUTE9}]` 10352 )) { 10353 if (style.getAttribute(STYLE_HASH_ATTRIBUTE9) === hash) { 10354 return true; 10355 } 10356 } 10357 return false; 10358 } 10359 function injectStyle9(targetDocument, hash, css) { 10360 if (!targetDocument.head) { 10361 return; 10362 } 10363 const runtime = getRuntime9(); 10364 let injectedStyles = runtime.injectedStyles.get(targetDocument); 10365 if (!injectedStyles) { 10366 injectedStyles = /* @__PURE__ */ new Set(); 10367 runtime.injectedStyles.set(targetDocument, injectedStyles); 10368 } 10369 if (injectedStyles.has(hash)) { 10370 return; 10371 } 10372 if (documentContainsStyleHash9(targetDocument, hash)) { 10373 injectedStyles.add(hash); 10374 return; 10375 } 10376 const style = targetDocument.createElement("style"); 10377 style.setAttribute(STYLE_HASH_ATTRIBUTE9, hash); 10378 style.appendChild(targetDocument.createTextNode(css)); 10379 targetDocument.head.appendChild(style); 10380 injectedStyles.add(hash); 10381 } 10382 function registerDocument9(targetDocument) { 10383 const runtime = getRuntime9(); 10384 runtime.documents.set( 10385 targetDocument, 10386 (runtime.documents.get(targetDocument) ?? 0) + 1 10387 ); 10388 for (const [hash, css] of runtime.styles) { 10389 injectStyle9(targetDocument, hash, css); 10390 } 10391 return () => { 10392 const count = runtime.documents.get(targetDocument); 10393 if (count === void 0) { 10394 return; 10395 } 10396 if (count <= 1) { 10397 runtime.documents.delete(targetDocument); 10398 return; 10399 } 10400 runtime.documents.set(targetDocument, count - 1); 10401 }; 10402 } 10403 function registerStyle9(hash, css) { 10404 const runtime = getRuntime9(); 10405 runtime.styles.set(hash, css); 10406 for (const targetDocument of runtime.documents.keys()) { 10407 injectStyle9(targetDocument, hash, css); 10408 } 10409 } 10410 if (typeof process === "undefined" || true) { 10411 registerStyle9("b51ff41489", "@layer wp-ui-utilities, wp-ui-components, wp-ui-compositions, wp-ui-overrides;@layer wp-ui-components{._19ce0419607e1896__stack{display:flex}}"); 10412 } 10413 var style_default9 = { "stack": "_19ce0419607e1896__stack" }; 10414 var gapTokens = { 10415 xs: "var(--wpds-dimension-gap-xs, 4px)", 10416 sm: "var(--wpds-dimension-gap-sm, 8px)", 10417 md: "var(--wpds-dimension-gap-md, 12px)", 10418 lg: "var(--wpds-dimension-gap-lg, 16px)", 10419 xl: "var(--wpds-dimension-gap-xl, 24px)", 10420 "2xl": "var(--wpds-dimension-gap-2xl, 32px)", 10421 "3xl": "var(--wpds-dimension-gap-3xl, 40px)" 10422 }; 10423 var Stack = (0, import_element25.forwardRef)(function Stack2({ direction, gap, align, justify, wrap, render: render4, ...props }, ref) { 10424 const style = { 10425 gap: gap && gapTokens[gap], 10426 alignItems: align, 10427 justifyContent: justify, 10428 flexDirection: direction, 10429 flexWrap: wrap 10430 }; 10431 const element = useRender({ 10432 render: render4, 10433 ref, 10434 props: mergeProps(props, { style, className: style_default9.stack }) 10435 }); 10436 return element; 10437 }); 10438 10439 // packages/ui/build-module/tooltip/index.mjs 10440 var tooltip_exports = {}; 10441 __export(tooltip_exports, { 10442 Popup: () => Popup, 10443 Portal: () => Portal, 10444 Positioner: () => Positioner, 10445 Provider: () => Provider, 10446 Root: () => Root4, 10447 Trigger: () => Trigger2 10448 }); 10449 10450 // packages/ui/build-module/tooltip/popup.mjs 10451 var import_element28 = __toESM(require_element(), 1); 10452 var import_theme = __toESM(require_theme(), 1); 10453 10454 // packages/ui/build-module/tooltip/portal.mjs 10455 var import_element26 = __toESM(require_element(), 1); 10456 10457 // packages/ui/build-module/utils/wp-compat-overlay-slot.mjs 10458 var STYLE_HASH_ATTRIBUTE10 = "data-wp-hash"; 10459 function getRuntime10() { 10460 const globalScope = globalThis; 10461 if (globalScope.__wpStyleRuntime) { 10462 return globalScope.__wpStyleRuntime; 10463 } 10464 globalScope.__wpStyleRuntime = { 10465 documents: /* @__PURE__ */ new Map(), 10466 styles: /* @__PURE__ */ new Map(), 10467 injectedStyles: /* @__PURE__ */ new WeakMap() 10468 }; 10469 if (typeof document !== "undefined") { 10470 registerDocument10(document); 10471 } 10472 return globalScope.__wpStyleRuntime; 10473 } 10474 function documentContainsStyleHash10(targetDocument, hash) { 10475 if (!targetDocument.head) { 10476 return false; 10477 } 10478 for (const style of targetDocument.head.querySelectorAll( 10479 `style[$STYLE_HASH_ATTRIBUTE10}]` 10480 )) { 10481 if (style.getAttribute(STYLE_HASH_ATTRIBUTE10) === hash) { 10482 return true; 10483 } 10484 } 10485 return false; 10486 } 10487 function injectStyle10(targetDocument, hash, css) { 10488 if (!targetDocument.head) { 10489 return; 10490 } 10491 const runtime = getRuntime10(); 10492 let injectedStyles = runtime.injectedStyles.get(targetDocument); 10493 if (!injectedStyles) { 10494 injectedStyles = /* @__PURE__ */ new Set(); 10495 runtime.injectedStyles.set(targetDocument, injectedStyles); 10496 } 10497 if (injectedStyles.has(hash)) { 10498 return; 10499 } 10500 if (documentContainsStyleHash10(targetDocument, hash)) { 10501 injectedStyles.add(hash); 10502 return; 10503 } 10504 const style = targetDocument.createElement("style"); 10505 style.setAttribute(STYLE_HASH_ATTRIBUTE10, hash); 10506 style.appendChild(targetDocument.createTextNode(css)); 10507 targetDocument.head.appendChild(style); 10508 injectedStyles.add(hash); 10509 } 10510 function registerDocument10(targetDocument) { 10511 const runtime = getRuntime10(); 10512 runtime.documents.set( 10513 targetDocument, 10514 (runtime.documents.get(targetDocument) ?? 0) + 1 10515 ); 10516 for (const [hash, css] of runtime.styles) { 10517 injectStyle10(targetDocument, hash, css); 10518 } 10519 return () => { 10520 const count = runtime.documents.get(targetDocument); 10521 if (count === void 0) { 10522 return; 10523 } 10524 if (count <= 1) { 10525 runtime.documents.delete(targetDocument); 10526 return; 10527 } 10528 runtime.documents.set(targetDocument, count - 1); 10529 }; 10530 } 10531 function registerStyle10(hash, css) { 10532 const runtime = getRuntime10(); 10533 runtime.styles.set(hash, css); 10534 for (const targetDocument of runtime.documents.keys()) { 10535 injectStyle10(targetDocument, hash, css); 10536 } 10537 } 10538 if (typeof process === "undefined" || true) { 10539 registerStyle10("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}}"); 10540 } 10541 var wp_compat_overlay_slot_default = { "slot": "_11fc52b637ff8a7e__slot" }; 10542 var WP_COMPAT_OVERLAY_SLOT_ATTRIBUTE = "data-wp-compat-overlay-slot"; 10543 function resolveOwnerDocument() { 10544 return typeof document === "undefined" ? null : document; 10545 } 10546 function isInWordPressEnvironment() { 10547 let topWp; 10548 try { 10549 topWp = window.top?.wp; 10550 } catch { 10551 } 10552 const wp = topWp ?? window.wp; 10553 return typeof wp?.components === "object" && wp.components !== null; 10554 } 10555 var cachedSlot = null; 10556 function createSlot(ownerDocument2) { 10557 const element = ownerDocument2.createElement("div"); 10558 element.setAttribute(WP_COMPAT_OVERLAY_SLOT_ATTRIBUTE, ""); 10559 if (wp_compat_overlay_slot_default.slot) { 10560 element.classList.add(wp_compat_overlay_slot_default.slot); 10561 } 10562 ownerDocument2.body.appendChild(element); 10563 return element; 10564 } 10565 function getWpCompatOverlaySlot() { 10566 if (typeof window === "undefined") { 10567 return void 0; 10568 } 10569 if (!isInWordPressEnvironment() && window.__wpUiCompatOverlaySlotEnabled !== true) { 10570 return void 0; 10571 } 10572 const ownerDocument2 = resolveOwnerDocument(); 10573 if (!ownerDocument2 || !ownerDocument2.body) { 10574 return void 0; 10575 } 10576 if (cachedSlot && cachedSlot.ownerDocument === ownerDocument2 && cachedSlot.isConnected) { 10577 return cachedSlot; 10578 } 10579 const existing = ownerDocument2.querySelector( 10580 `[$WP_COMPAT_OVERLAY_SLOT_ATTRIBUTE}]` 10581 ); 10582 if (existing instanceof HTMLDivElement) { 10583 cachedSlot = existing; 10584 return existing; 10585 } 10586 if (cachedSlot?.isConnected) { 10587 cachedSlot.remove(); 10588 } 10589 cachedSlot = createSlot(ownerDocument2); 10590 return cachedSlot; 10591 } 10592 10593 // packages/ui/build-module/tooltip/portal.mjs 10594 var import_jsx_runtime31 = __toESM(require_jsx_runtime(), 1); 10595 var Portal = (0, import_element26.forwardRef)( 10596 function TooltipPortal3({ container, ...restProps }, ref) { 10597 return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)( 10598 index_parts_exports2.Portal, 10599 { 10600 container: container ?? getWpCompatOverlaySlot(), 10601 ...restProps, 10602 ref 10603 } 10604 ); 10605 } 10606 ); 10607 10608 // packages/ui/build-module/tooltip/positioner.mjs 10609 var import_element27 = __toESM(require_element(), 1); 10610 var import_jsx_runtime32 = __toESM(require_jsx_runtime(), 1); 10611 var STYLE_HASH_ATTRIBUTE11 = "data-wp-hash"; 10612 function getRuntime11() { 10613 const globalScope = globalThis; 10614 if (globalScope.__wpStyleRuntime) { 10615 return globalScope.__wpStyleRuntime; 10616 } 10617 globalScope.__wpStyleRuntime = { 10618 documents: /* @__PURE__ */ new Map(), 10619 styles: /* @__PURE__ */ new Map(), 10620 injectedStyles: /* @__PURE__ */ new WeakMap() 10621 }; 10622 if (typeof document !== "undefined") { 10623 registerDocument11(document); 10624 } 10625 return globalScope.__wpStyleRuntime; 10626 } 10627 function documentContainsStyleHash11(targetDocument, hash) { 10628 if (!targetDocument.head) { 10629 return false; 10630 } 10631 for (const style of targetDocument.head.querySelectorAll( 10632 `style[$STYLE_HASH_ATTRIBUTE11}]` 10633 )) { 10634 if (style.getAttribute(STYLE_HASH_ATTRIBUTE11) === hash) { 10635 return true; 10636 } 10637 } 10638 return false; 10639 } 10640 function injectStyle11(targetDocument, hash, css) { 10641 if (!targetDocument.head) { 10642 return; 10643 } 10644 const runtime = getRuntime11(); 10645 let injectedStyles = runtime.injectedStyles.get(targetDocument); 10646 if (!injectedStyles) { 10647 injectedStyles = /* @__PURE__ */ new Set(); 10648 runtime.injectedStyles.set(targetDocument, injectedStyles); 10649 } 10650 if (injectedStyles.has(hash)) { 10651 return; 10652 } 10653 if (documentContainsStyleHash11(targetDocument, hash)) { 10654 injectedStyles.add(hash); 10655 return; 10656 } 10657 const style = targetDocument.createElement("style"); 10658 style.setAttribute(STYLE_HASH_ATTRIBUTE11, hash); 10659 style.appendChild(targetDocument.createTextNode(css)); 10660 targetDocument.head.appendChild(style); 10661 injectedStyles.add(hash); 10662 } 10663 function registerDocument11(targetDocument) { 10664 const runtime = getRuntime11(); 10665 runtime.documents.set( 10666 targetDocument, 10667 (runtime.documents.get(targetDocument) ?? 0) + 1 10668 ); 10669 for (const [hash, css] of runtime.styles) { 10670 injectStyle11(targetDocument, hash, css); 10671 } 10672 return () => { 10673 const count = runtime.documents.get(targetDocument); 10674 if (count === void 0) { 10675 return; 10676 } 10677 if (count <= 1) { 10678 runtime.documents.delete(targetDocument); 10679 return; 10680 } 10681 runtime.documents.set(targetDocument, count - 1); 10682 }; 10683 } 10684 function registerStyle11(hash, css) { 10685 const runtime = getRuntime11(); 10686 runtime.styles.set(hash, css); 10687 for (const targetDocument of runtime.documents.keys()) { 10688 injectStyle11(targetDocument, hash, css); 10689 } 10690 } 10691 if (typeof process === "undefined" || true) { 10692 registerStyle11("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}}}"); 10693 } 10694 var resets_default2 = { "box-sizing": "_336cd3e4e743482f__box-sizing" }; 10695 if (typeof process === "undefined" || true) { 10696 registerStyle11("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}}}'); 10697 } 10698 var style_default10 = { "positioner": "_480b748dd3510e64__positioner", "popup": "_50096b232db7709d__popup" }; 10699 var Positioner = (0, import_element27.forwardRef)( 10700 function TooltipPositioner3({ align = "center", className, side = "top", sideOffset = 4, ...props }, ref) { 10701 return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)( 10702 index_parts_exports2.Positioner, 10703 { 10704 ref, 10705 align, 10706 side, 10707 sideOffset, 10708 ...props, 10709 className: clsx_default( 10710 resets_default2["box-sizing"], 10711 style_default10.positioner, 10712 className 10713 ) 10714 } 10715 ); 10716 } 10717 ); 10718 10719 // packages/ui/build-module/tooltip/popup.mjs 10720 var import_jsx_runtime33 = __toESM(require_jsx_runtime(), 1); 10721 var STYLE_HASH_ATTRIBUTE12 = "data-wp-hash"; 10722 function getRuntime12() { 10723 const globalScope = globalThis; 10724 if (globalScope.__wpStyleRuntime) { 10725 return globalScope.__wpStyleRuntime; 10726 } 10727 globalScope.__wpStyleRuntime = { 10728 documents: /* @__PURE__ */ new Map(), 10729 styles: /* @__PURE__ */ new Map(), 10730 injectedStyles: /* @__PURE__ */ new WeakMap() 10731 }; 10732 if (typeof document !== "undefined") { 10733 registerDocument12(document); 10734 } 10735 return globalScope.__wpStyleRuntime; 10736 } 10737 function documentContainsStyleHash12(targetDocument, hash) { 10738 if (!targetDocument.head) { 10739 return false; 10740 } 10741 for (const style of targetDocument.head.querySelectorAll( 10742 `style[$STYLE_HASH_ATTRIBUTE12}]` 10743 )) { 10744 if (style.getAttribute(STYLE_HASH_ATTRIBUTE12) === hash) { 10745 return true; 10746 } 10747 } 10748 return false; 10749 } 10750 function injectStyle12(targetDocument, hash, css) { 10751 if (!targetDocument.head) { 10752 return; 10753 } 10754 const runtime = getRuntime12(); 10755 let injectedStyles = runtime.injectedStyles.get(targetDocument); 10756 if (!injectedStyles) { 10757 injectedStyles = /* @__PURE__ */ new Set(); 10758 runtime.injectedStyles.set(targetDocument, injectedStyles); 10759 } 10760 if (injectedStyles.has(hash)) { 10761 return; 10762 } 10763 if (documentContainsStyleHash12(targetDocument, hash)) { 10764 injectedStyles.add(hash); 10765 return; 10766 } 10767 const style = targetDocument.createElement("style"); 10768 style.setAttribute(STYLE_HASH_ATTRIBUTE12, hash); 10769 style.appendChild(targetDocument.createTextNode(css)); 10770 targetDocument.head.appendChild(style); 10771 injectedStyles.add(hash); 10772 } 10773 function registerDocument12(targetDocument) { 10774 const runtime = getRuntime12(); 10775 runtime.documents.set( 10776 targetDocument, 10777 (runtime.documents.get(targetDocument) ?? 0) + 1 10778 ); 10779 for (const [hash, css] of runtime.styles) { 10780 injectStyle12(targetDocument, hash, css); 10781 } 10782 return () => { 10783 const count = runtime.documents.get(targetDocument); 10784 if (count === void 0) { 10785 return; 10786 } 10787 if (count <= 1) { 10788 runtime.documents.delete(targetDocument); 10789 return; 10790 } 10791 runtime.documents.set(targetDocument, count - 1); 10792 }; 10793 } 10794 function registerStyle12(hash, css) { 10795 const runtime = getRuntime12(); 10796 runtime.styles.set(hash, css); 10797 for (const targetDocument of runtime.documents.keys()) { 10798 injectStyle12(targetDocument, hash, css); 10799 } 10800 } 10801 if (typeof process === "undefined" || true) { 10802 registerStyle12("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}}}'); 10803 } 10804 var style_default11 = { "positioner": "_480b748dd3510e64__positioner", "popup": "_50096b232db7709d__popup" }; 10805 var ThemeProvider = unlock(import_theme.privateApis).ThemeProvider; 10806 var Popup = (0, import_element28.forwardRef)(function TooltipPopup3({ portal, positioner, children, className, ...props }, ref) { 10807 const popupContent = ( 10808 /* This should ideally use whatever dark color makes sense, 10809 * and not be hardcoded to #1e1e1e. The solutions would be to: 10810 * - review the design of the tooltip, in case we want to stop 10811 * hardcoding it to a dark background 10812 * - create new semantic tokens as needed (aliasing either the 10813 * "inverted bg" or "perma-dark bg" private tokens) and have 10814 * Tooltip.Popup use them; 10815 * - remove the hardcoded `bg` setting from the `ThemeProvider` 10816 * below 10817 */ 10818 /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ThemeProvider, { color: { bg: "#1e1e1e" }, children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)( 10819 index_parts_exports2.Popup, 10820 { 10821 ref, 10822 className: clsx_default(style_default11.popup, className), 10823 ...props, 10824 children 10825 } 10826 ) }) 10827 ); 10828 const positionedPopup = renderSlotWithChildren( 10829 positioner, 10830 /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Positioner, {}), 10831 popupContent 10832 ); 10833 return renderSlotWithChildren(portal, /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(Portal, {}), positionedPopup); 10834 }); 10835 10836 // packages/ui/build-module/tooltip/trigger.mjs 10837 var import_element29 = __toESM(require_element(), 1); 10838 var import_jsx_runtime34 = __toESM(require_jsx_runtime(), 1); 10839 var Trigger2 = (0, import_element29.forwardRef)( 10840 function TooltipTrigger3(props, ref) { 10841 return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(index_parts_exports2.Trigger, { ref, ...props }); 10842 } 10843 ); 10844 10845 // packages/ui/build-module/tooltip/root.mjs 10846 var import_jsx_runtime35 = __toESM(require_jsx_runtime(), 1); 10847 function Root4(props) { 10848 return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(index_parts_exports2.Root, { ...props }); 10849 } 10850 10851 // packages/ui/build-module/tooltip/provider.mjs 10852 var import_jsx_runtime36 = __toESM(require_jsx_runtime(), 1); 10853 function Provider({ ...props }) { 10854 return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(index_parts_exports2.Provider, { ...props }); 10855 } 10856 10857 // packages/ui/build-module/visually-hidden/visually-hidden.mjs 10858 var import_element30 = __toESM(require_element(), 1); 10859 var STYLE_HASH_ATTRIBUTE13 = "data-wp-hash"; 10860 function getRuntime13() { 10861 const globalScope = globalThis; 10862 if (globalScope.__wpStyleRuntime) { 10863 return globalScope.__wpStyleRuntime; 10864 } 10865 globalScope.__wpStyleRuntime = { 10866 documents: /* @__PURE__ */ new Map(), 10867 styles: /* @__PURE__ */ new Map(), 10868 injectedStyles: /* @__PURE__ */ new WeakMap() 10869 }; 10870 if (typeof document !== "undefined") { 10871 registerDocument13(document); 10872 } 10873 return globalScope.__wpStyleRuntime; 10874 } 10875 function documentContainsStyleHash13(targetDocument, hash) { 10876 if (!targetDocument.head) { 10877 return false; 10878 } 10879 for (const style of targetDocument.head.querySelectorAll( 10880 `style[$STYLE_HASH_ATTRIBUTE13}]` 10881 )) { 10882 if (style.getAttribute(STYLE_HASH_ATTRIBUTE13) === hash) { 10883 return true; 10884 } 10885 } 10886 return false; 10887 } 10888 function injectStyle13(targetDocument, hash, css) { 10889 if (!targetDocument.head) { 10890 return; 10891 } 10892 const runtime = getRuntime13(); 10893 let injectedStyles = runtime.injectedStyles.get(targetDocument); 10894 if (!injectedStyles) { 10895 injectedStyles = /* @__PURE__ */ new Set(); 10896 runtime.injectedStyles.set(targetDocument, injectedStyles); 10897 } 10898 if (injectedStyles.has(hash)) { 10899 return; 10900 } 10901 if (documentContainsStyleHash13(targetDocument, hash)) { 10902 injectedStyles.add(hash); 10903 return; 10904 } 10905 const style = targetDocument.createElement("style"); 10906 style.setAttribute(STYLE_HASH_ATTRIBUTE13, hash); 10907 style.appendChild(targetDocument.createTextNode(css)); 10908 targetDocument.head.appendChild(style); 10909 injectedStyles.add(hash); 10910 } 10911 function registerDocument13(targetDocument) { 10912 const runtime = getRuntime13(); 10913 runtime.documents.set( 10914 targetDocument, 10915 (runtime.documents.get(targetDocument) ?? 0) + 1 10916 ); 10917 for (const [hash, css] of runtime.styles) { 10918 injectStyle13(targetDocument, hash, css); 10919 } 10920 return () => { 10921 const count = runtime.documents.get(targetDocument); 10922 if (count === void 0) { 10923 return; 10924 } 10925 if (count <= 1) { 10926 runtime.documents.delete(targetDocument); 10927 return; 10928 } 10929 runtime.documents.set(targetDocument, count - 1); 10930 }; 10931 } 10932 function registerStyle13(hash, css) { 10933 const runtime = getRuntime13(); 10934 runtime.styles.set(hash, css); 10935 for (const targetDocument of runtime.documents.keys()) { 10936 injectStyle13(targetDocument, hash, css); 10937 } 10938 } 10939 if (typeof process === "undefined" || true) { 10940 registerStyle13("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}}"); 10941 } 10942 var style_default12 = { "visually-hidden": "f37b9e2e191ebd66__visually-hidden" }; 10943 var VisuallyHidden = (0, import_element30.forwardRef)( 10944 function VisuallyHidden2({ render: render4, ...restProps }, ref) { 10945 const element = useRender({ 10946 render: render4, 10947 ref, 10948 props: mergeProps( 10949 { className: style_default12["visually-hidden"] }, 10950 restProps, 10951 { 10952 // @ts-expect-error Arbitrary data-* attributes aren't indexable on the typed div props. Kept hardcoded so consumers can't change or remove it. 10953 "data-visually-hidden": "" 10954 } 10955 ) 10956 }); 10957 return element; 10958 } 10959 ); 10960 10961 // packages/admin-ui/build-module/navigable-region/index.mjs 10962 var import_element31 = __toESM(require_element(), 1); 10963 var import_jsx_runtime37 = __toESM(require_jsx_runtime(), 1); 10964 var NavigableRegion = (0, import_element31.forwardRef)( 10965 ({ children, className, ariaLabel, as: Tag = "div", ...props }, ref) => { 10966 return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)( 10967 Tag, 10968 { 10969 ref, 10970 className: clsx_default("admin-ui-navigable-region", className), 10971 "aria-label": ariaLabel, 10972 role: "region", 10973 tabIndex: "-1", 10974 ...props, 10975 children 10976 } 10977 ); 10978 } 10979 ); 10980 NavigableRegion.displayName = "NavigableRegion"; 10981 var navigable_region_default = NavigableRegion; 10982 10983 // packages/admin-ui/build-module/page/sidebar-toggle-slot.mjs 10984 var import_components = __toESM(require_components(), 1); 10985 var { Fill: SidebarToggleFill, Slot: SidebarToggleSlot } = (0, import_components.createSlotFill)("SidebarToggle"); 10986 10987 // packages/admin-ui/build-module/page/header.mjs 10988 var import_jsx_runtime38 = __toESM(require_jsx_runtime(), 1); 10989 var STYLE_HASH_ATTRIBUTE14 = "data-wp-hash"; 10990 function getRuntime14() { 10991 const globalScope = globalThis; 10992 if (globalScope.__wpStyleRuntime) { 10993 return globalScope.__wpStyleRuntime; 10994 } 10995 globalScope.__wpStyleRuntime = { 10996 documents: /* @__PURE__ */ new Map(), 10997 styles: /* @__PURE__ */ new Map(), 10998 injectedStyles: /* @__PURE__ */ new WeakMap() 10999 }; 11000 if (typeof document !== "undefined") { 11001 registerDocument14(document); 11002 } 11003 return globalScope.__wpStyleRuntime; 11004 } 11005 function documentContainsStyleHash14(targetDocument, hash) { 11006 if (!targetDocument.head) { 11007 return false; 11008 } 11009 for (const style of targetDocument.head.querySelectorAll( 11010 `style[$STYLE_HASH_ATTRIBUTE14}]` 11011 )) { 11012 if (style.getAttribute(STYLE_HASH_ATTRIBUTE14) === hash) { 11013 return true; 11014 } 11015 } 11016 return false; 11017 } 11018 function injectStyle14(targetDocument, hash, css) { 11019 if (!targetDocument.head) { 11020 return; 11021 } 11022 const runtime = getRuntime14(); 11023 let injectedStyles = runtime.injectedStyles.get(targetDocument); 11024 if (!injectedStyles) { 11025 injectedStyles = /* @__PURE__ */ new Set(); 11026 runtime.injectedStyles.set(targetDocument, injectedStyles); 11027 } 11028 if (injectedStyles.has(hash)) { 11029 return; 11030 } 11031 if (documentContainsStyleHash14(targetDocument, hash)) { 11032 injectedStyles.add(hash); 11033 return; 11034 } 11035 const style = targetDocument.createElement("style"); 11036 style.setAttribute(STYLE_HASH_ATTRIBUTE14, hash); 11037 style.appendChild(targetDocument.createTextNode(css)); 11038 targetDocument.head.appendChild(style); 11039 injectedStyles.add(hash); 11040 } 11041 function registerDocument14(targetDocument) { 11042 const runtime = getRuntime14(); 11043 runtime.documents.set( 11044 targetDocument, 11045 (runtime.documents.get(targetDocument) ?? 0) + 1 11046 ); 11047 for (const [hash, css] of runtime.styles) { 11048 injectStyle14(targetDocument, hash, css); 11049 } 11050 return () => { 11051 const count = runtime.documents.get(targetDocument); 11052 if (count === void 0) { 11053 return; 11054 } 11055 if (count <= 1) { 11056 runtime.documents.delete(targetDocument); 11057 return; 11058 } 11059 runtime.documents.set(targetDocument, count - 1); 11060 }; 11061 } 11062 function registerStyle14(hash, css) { 11063 const runtime = getRuntime14(); 11064 runtime.styles.set(hash, css); 11065 for (const targetDocument of runtime.documents.keys()) { 11066 injectStyle14(targetDocument, hash, css); 11067 } 11068 } 11069 if (typeof process === "undefined" || true) { 11070 registerStyle14("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)}}"); 11071 } 11072 var style_default13 = { "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" }; 11073 function Header3({ 11074 headingLevel = 1, 11075 breadcrumbs, 11076 badges, 11077 visual, 11078 title, 11079 subTitle, 11080 actions, 11081 showSidebarToggle = true 11082 }) { 11083 const HeadingTag = `h$headingLevel}`; 11084 return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(Stack, { direction: "column", className: style_default13.header, children: [ 11085 /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)( 11086 Stack, 11087 { 11088 className: style_default13["header-content"], 11089 direction: "row", 11090 gap: "sm", 11091 justify: "space-between", 11092 children: [ 11093 /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(Stack, { direction: "row", gap: "sm", align: "center", justify: "start", children: [ 11094 showSidebarToggle && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)( 11095 SidebarToggleSlot, 11096 { 11097 bubblesVirtually: true, 11098 className: style_default13["sidebar-toggle-slot"] 11099 } 11100 ), 11101 visual && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)( 11102 "div", 11103 { 11104 className: style_default13["header-visual"], 11105 "aria-hidden": "true", 11106 children: visual 11107 } 11108 ), 11109 title && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)( 11110 Text, 11111 { 11112 className: style_default13["header-title"], 11113 render: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(HeadingTag, {}), 11114 variant: "heading-lg", 11115 children: title 11116 } 11117 ), 11118 breadcrumbs, 11119 badges 11120 ] }), 11121 actions && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)( 11122 Stack, 11123 { 11124 align: "center", 11125 className: style_default13["header-actions"], 11126 direction: "row", 11127 gap: "sm", 11128 children: actions 11129 } 11130 ) 11131 ] 11132 } 11133 ), 11134 subTitle && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)( 11135 Text, 11136 { 11137 render: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("p", {}), 11138 variant: "body-md", 11139 className: style_default13["header-subtitle"], 11140 children: subTitle 11141 } 11142 ) 11143 ] }); 11144 } 11145 11146 // packages/admin-ui/build-module/page/index.mjs 11147 var import_jsx_runtime39 = __toESM(require_jsx_runtime(), 1); 11148 var STYLE_HASH_ATTRIBUTE15 = "data-wp-hash"; 11149 function getRuntime15() { 11150 const globalScope = globalThis; 11151 if (globalScope.__wpStyleRuntime) { 11152 return globalScope.__wpStyleRuntime; 11153 } 11154 globalScope.__wpStyleRuntime = { 11155 documents: /* @__PURE__ */ new Map(), 11156 styles: /* @__PURE__ */ new Map(), 11157 injectedStyles: /* @__PURE__ */ new WeakMap() 11158 }; 11159 if (typeof document !== "undefined") { 11160 registerDocument15(document); 11161 } 11162 return globalScope.__wpStyleRuntime; 11163 } 11164 function documentContainsStyleHash15(targetDocument, hash) { 11165 if (!targetDocument.head) { 11166 return false; 11167 } 11168 for (const style of targetDocument.head.querySelectorAll( 11169 `style[$STYLE_HASH_ATTRIBUTE15}]` 11170 )) { 11171 if (style.getAttribute(STYLE_HASH_ATTRIBUTE15) === hash) { 11172 return true; 11173 } 11174 } 11175 return false; 11176 } 11177 function injectStyle15(targetDocument, hash, css) { 11178 if (!targetDocument.head) { 11179 return; 11180 } 11181 const runtime = getRuntime15(); 11182 let injectedStyles = runtime.injectedStyles.get(targetDocument); 11183 if (!injectedStyles) { 11184 injectedStyles = /* @__PURE__ */ new Set(); 11185 runtime.injectedStyles.set(targetDocument, injectedStyles); 11186 } 11187 if (injectedStyles.has(hash)) { 11188 return; 11189 } 11190 if (documentContainsStyleHash15(targetDocument, hash)) { 11191 injectedStyles.add(hash); 11192 return; 11193 } 11194 const style = targetDocument.createElement("style"); 11195 style.setAttribute(STYLE_HASH_ATTRIBUTE15, hash); 11196 style.appendChild(targetDocument.createTextNode(css)); 11197 targetDocument.head.appendChild(style); 11198 injectedStyles.add(hash); 11199 } 11200 function registerDocument15(targetDocument) { 11201 const runtime = getRuntime15(); 11202 runtime.documents.set( 11203 targetDocument, 11204 (runtime.documents.get(targetDocument) ?? 0) + 1 11205 ); 11206 for (const [hash, css] of runtime.styles) { 11207 injectStyle15(targetDocument, hash, css); 11208 } 11209 return () => { 11210 const count = runtime.documents.get(targetDocument); 11211 if (count === void 0) { 11212 return; 11213 } 11214 if (count <= 1) { 11215 runtime.documents.delete(targetDocument); 11216 return; 11217 } 11218 runtime.documents.set(targetDocument, count - 1); 11219 }; 11220 } 11221 function registerStyle15(hash, css) { 11222 const runtime = getRuntime15(); 11223 runtime.styles.set(hash, css); 11224 for (const targetDocument of runtime.documents.keys()) { 11225 injectStyle15(targetDocument, hash, css); 11226 } 11227 } 11228 if (typeof process === "undefined" || true) { 11229 registerStyle15("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)}}"); 11230 } 11231 var style_default14 = { "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" }; 11232 function Page({ 11233 headingLevel, 11234 breadcrumbs, 11235 badges, 11236 visual, 11237 title, 11238 subTitle, 11239 children, 11240 className, 11241 actions, 11242 ariaLabel, 11243 hasPadding = false, 11244 showSidebarToggle = true 11245 }) { 11246 const classes = clsx_default(style_default14.page, className); 11247 const effectiveAriaLabel = ariaLabel ?? (typeof title === "string" ? title : ""); 11248 return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(navigable_region_default, { className: classes, ariaLabel: effectiveAriaLabel, children: [ 11249 (title || breadcrumbs || badges || actions || visual) && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)( 11250 Header3, 11251 { 11252 headingLevel, 11253 breadcrumbs, 11254 badges, 11255 visual, 11256 title, 11257 subTitle, 11258 actions, 11259 showSidebarToggle 11260 } 11261 ), 11262 hasPadding ? /* @__PURE__ */ (0, import_jsx_runtime39.jsx)( 11263 "div", 11264 { 11265 className: clsx_default( 11266 style_default14.content, 11267 style_default14["has-padding"] 11268 ), 11269 children 11270 } 11271 ) : children 11272 ] }); 11273 } 11274 Page.SidebarToggleFill = SidebarToggleFill; 11275 var page_default = Page; 11276 11277 // routes/experiments-home/stage.tsx 11278 var import_components26 = __toESM(require_components()); 11279 var import_core_data = __toESM(require_core_data()); 11280 var import_data = __toESM(require_data()); 11281 11282 // packages/dataviews/build-module/constants.mjs 11283 var import_i18n = __toESM(require_i18n(), 1); 11284 var OPERATOR_IS_ANY = "isAny"; 11285 var OPERATOR_IS_NONE = "isNone"; 11286 var OPERATOR_IS_ALL = "isAll"; 11287 var OPERATOR_IS_NOT_ALL = "isNotAll"; 11288 var OPERATOR_BETWEEN = "between"; 11289 var OPERATOR_IN_THE_PAST = "inThePast"; 11290 var OPERATOR_OVER = "over"; 11291 var OPERATOR_IS = "is"; 11292 var OPERATOR_IS_NOT = "isNot"; 11293 var OPERATOR_LESS_THAN = "lessThan"; 11294 var OPERATOR_GREATER_THAN = "greaterThan"; 11295 var OPERATOR_LESS_THAN_OR_EQUAL = "lessThanOrEqual"; 11296 var OPERATOR_GREATER_THAN_OR_EQUAL = "greaterThanOrEqual"; 11297 var OPERATOR_BEFORE = "before"; 11298 var OPERATOR_AFTER = "after"; 11299 var OPERATOR_BEFORE_INC = "beforeInc"; 11300 var OPERATOR_AFTER_INC = "afterInc"; 11301 var OPERATOR_CONTAINS = "contains"; 11302 var OPERATOR_NOT_CONTAINS = "notContains"; 11303 var OPERATOR_STARTS_WITH = "startsWith"; 11304 var OPERATOR_ON = "on"; 11305 var OPERATOR_NOT_ON = "notOn"; 11306 var sortLabels = { 11307 asc: (0, import_i18n.__)("Sort ascending"), 11308 desc: (0, import_i18n.__)("Sort descending") 11309 }; 11310 11311 // packages/dataviews/build-module/lock-unlock.mjs 11312 var import_private_apis2 = __toESM(require_private_apis(), 1); 11313 var { lock: lock2, unlock: unlock2 } = (0, import_private_apis2.__dangerousOptInToUnstableAPIsOnlyForCoreModules)( 11314 "I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.", 11315 "@wordpress/dataviews" 11316 ); 11317 11318 // packages/dataviews/build-module/hooks/use-elements.mjs 11319 var import_element32 = __toESM(require_element(), 1); 11320 var EMPTY_ARRAY2 = []; 11321 function useElements({ 11322 elements, 11323 getElements 11324 }) { 11325 const staticElements = Array.isArray(elements) && elements.length > 0 ? elements : EMPTY_ARRAY2; 11326 const [records, setRecords] = (0, import_element32.useState)(staticElements); 11327 const [isLoading, setIsLoading] = (0, import_element32.useState)(false); 11328 (0, import_element32.useEffect)(() => { 11329 if (!getElements) { 11330 setRecords(staticElements); 11331 return; 11332 } 11333 let cancelled = false; 11334 setIsLoading(true); 11335 getElements().then((fetchedElements) => { 11336 if (!cancelled) { 11337 const dynamicElements = Array.isArray(fetchedElements) && fetchedElements.length > 0 ? fetchedElements : staticElements; 11338 setRecords(dynamicElements); 11339 } 11340 }).catch(() => { 11341 if (!cancelled) { 11342 setRecords(staticElements); 11343 } 11344 }).finally(() => { 11345 if (!cancelled) { 11346 setIsLoading(false); 11347 } 11348 }); 11349 return () => { 11350 cancelled = true; 11351 }; 11352 }, [getElements, staticElements]); 11353 return { 11354 elements: records, 11355 isLoading 11356 }; 11357 } 11358 11359 // node_modules/date-fns/constants.js 11360 var daysInYear = 365.2425; 11361 var maxTime = Math.pow(10, 8) * 24 * 60 * 60 * 1e3; 11362 var minTime = -maxTime; 11363 var millisecondsInWeek = 6048e5; 11364 var millisecondsInDay = 864e5; 11365 var secondsInHour = 3600; 11366 var secondsInDay = secondsInHour * 24; 11367 var secondsInWeek = secondsInDay * 7; 11368 var secondsInYear = secondsInDay * daysInYear; 11369 var secondsInMonth = secondsInYear / 12; 11370 var secondsInQuarter = secondsInMonth * 3; 11371 var constructFromSymbol = /* @__PURE__ */ Symbol.for("constructDateFrom"); 11372 11373 // node_modules/date-fns/constructFrom.js 11374 function constructFrom(date, value) { 11375 if (typeof date === "function") return date(value); 11376 if (date && typeof date === "object" && constructFromSymbol in date) 11377 return date[constructFromSymbol](value); 11378 if (date instanceof Date) return new date.constructor(value); 11379 return new Date(value); 11380 } 11381 11382 // node_modules/date-fns/toDate.js 11383 function toDate(argument, context) { 11384 return constructFrom(context || argument, argument); 11385 } 11386 11387 // node_modules/date-fns/addDays.js 11388 function addDays(date, amount, options) { 11389 const _date = toDate(date, options?.in); 11390 if (isNaN(amount)) return constructFrom(options?.in || date, NaN); 11391 if (!amount) return _date; 11392 _date.setDate(_date.getDate() + amount); 11393 return _date; 11394 } 11395 11396 // node_modules/date-fns/addMonths.js 11397 function addMonths(date, amount, options) { 11398 const _date = toDate(date, options?.in); 11399 if (isNaN(amount)) return constructFrom(options?.in || date, NaN); 11400 if (!amount) { 11401 return _date; 11402 } 11403 const dayOfMonth = _date.getDate(); 11404 const endOfDesiredMonth = constructFrom(options?.in || date, _date.getTime()); 11405 endOfDesiredMonth.setMonth(_date.getMonth() + amount + 1, 0); 11406 const daysInMonth = endOfDesiredMonth.getDate(); 11407 if (dayOfMonth >= daysInMonth) { 11408 return endOfDesiredMonth; 11409 } else { 11410 _date.setFullYear( 11411 endOfDesiredMonth.getFullYear(), 11412 endOfDesiredMonth.getMonth(), 11413 dayOfMonth 11414 ); 11415 return _date; 11416 } 11417 } 11418 11419 // node_modules/date-fns/_lib/defaultOptions.js 11420 var defaultOptions = {}; 11421 function getDefaultOptions() { 11422 return defaultOptions; 11423 } 11424 11425 // node_modules/date-fns/startOfWeek.js 11426 function startOfWeek(date, options) { 11427 const defaultOptions2 = getDefaultOptions(); 11428 const weekStartsOn = options?.weekStartsOn ?? options?.locale?.options?.weekStartsOn ?? defaultOptions2.weekStartsOn ?? defaultOptions2.locale?.options?.weekStartsOn ?? 0; 11429 const _date = toDate(date, options?.in); 11430 const day = _date.getDay(); 11431 const diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn; 11432 _date.setDate(_date.getDate() - diff); 11433 _date.setHours(0, 0, 0, 0); 11434 return _date; 11435 } 11436 11437 // node_modules/date-fns/startOfISOWeek.js 11438 function startOfISOWeek(date, options) { 11439 return startOfWeek(date, { ...options, weekStartsOn: 1 }); 11440 } 11441 11442 // node_modules/date-fns/getISOWeekYear.js 11443 function getISOWeekYear(date, options) { 11444 const _date = toDate(date, options?.in); 11445 const year = _date.getFullYear(); 11446 const fourthOfJanuaryOfNextYear = constructFrom(_date, 0); 11447 fourthOfJanuaryOfNextYear.setFullYear(year + 1, 0, 4); 11448 fourthOfJanuaryOfNextYear.setHours(0, 0, 0, 0); 11449 const startOfNextYear = startOfISOWeek(fourthOfJanuaryOfNextYear); 11450 const fourthOfJanuaryOfThisYear = constructFrom(_date, 0); 11451 fourthOfJanuaryOfThisYear.setFullYear(year, 0, 4); 11452 fourthOfJanuaryOfThisYear.setHours(0, 0, 0, 0); 11453 const startOfThisYear = startOfISOWeek(fourthOfJanuaryOfThisYear); 11454 if (_date.getTime() >= startOfNextYear.getTime()) { 11455 return year + 1; 11456 } else if (_date.getTime() >= startOfThisYear.getTime()) { 11457 return year; 11458 } else { 11459 return year - 1; 11460 } 11461 } 11462 11463 // node_modules/date-fns/_lib/getTimezoneOffsetInMilliseconds.js 11464 function getTimezoneOffsetInMilliseconds(date) { 11465 const _date = toDate(date); 11466 const utcDate = new Date( 11467 Date.UTC( 11468 _date.getFullYear(), 11469 _date.getMonth(), 11470 _date.getDate(), 11471 _date.getHours(), 11472 _date.getMinutes(), 11473 _date.getSeconds(), 11474 _date.getMilliseconds() 11475 ) 11476 ); 11477 utcDate.setUTCFullYear(_date.getFullYear()); 11478 return +date - +utcDate; 11479 } 11480 11481 // node_modules/date-fns/_lib/normalizeDates.js 11482 function normalizeDates(context, ...dates) { 11483 const normalize = constructFrom.bind( 11484 null, 11485 context || dates.find((date) => typeof date === "object") 11486 ); 11487 return dates.map(normalize); 11488 } 11489 11490 // node_modules/date-fns/startOfDay.js 11491 function startOfDay(date, options) { 11492 const _date = toDate(date, options?.in); 11493 _date.setHours(0, 0, 0, 0); 11494 return _date; 11495 } 11496 11497 // node_modules/date-fns/differenceInCalendarDays.js 11498 function differenceInCalendarDays(laterDate, earlierDate, options) { 11499 const [laterDate_, earlierDate_] = normalizeDates( 11500 options?.in, 11501 laterDate, 11502 earlierDate 11503 ); 11504 const laterStartOfDay = startOfDay(laterDate_); 11505 const earlierStartOfDay = startOfDay(earlierDate_); 11506 const laterTimestamp = +laterStartOfDay - getTimezoneOffsetInMilliseconds(laterStartOfDay); 11507 const earlierTimestamp = +earlierStartOfDay - getTimezoneOffsetInMilliseconds(earlierStartOfDay); 11508 return Math.round((laterTimestamp - earlierTimestamp) / millisecondsInDay); 11509 } 11510 11511 // node_modules/date-fns/startOfISOWeekYear.js 11512 function startOfISOWeekYear(date, options) { 11513 const year = getISOWeekYear(date, options); 11514 const fourthOfJanuary = constructFrom(options?.in || date, 0); 11515 fourthOfJanuary.setFullYear(year, 0, 4); 11516 fourthOfJanuary.setHours(0, 0, 0, 0); 11517 return startOfISOWeek(fourthOfJanuary); 11518 } 11519 11520 // node_modules/date-fns/addWeeks.js 11521 function addWeeks(date, amount, options) { 11522 return addDays(date, amount * 7, options); 11523 } 11524 11525 // node_modules/date-fns/addYears.js 11526 function addYears(date, amount, options) { 11527 return addMonths(date, amount * 12, options); 11528 } 11529 11530 // node_modules/date-fns/isDate.js 11531 function isDate(value) { 11532 return value instanceof Date || typeof value === "object" && Object.prototype.toString.call(value) === "[object Date]"; 11533 } 11534 11535 // node_modules/date-fns/isValid.js 11536 function isValid(date) { 11537 return !(!isDate(date) && typeof date !== "number" || isNaN(+toDate(date))); 11538 } 11539 11540 // node_modules/date-fns/startOfMonth.js 11541 function startOfMonth(date, options) { 11542 const _date = toDate(date, options?.in); 11543 _date.setDate(1); 11544 _date.setHours(0, 0, 0, 0); 11545 return _date; 11546 } 11547 11548 // node_modules/date-fns/startOfYear.js 11549 function startOfYear(date, options) { 11550 const date_ = toDate(date, options?.in); 11551 date_.setFullYear(date_.getFullYear(), 0, 1); 11552 date_.setHours(0, 0, 0, 0); 11553 return date_; 11554 } 11555 11556 // node_modules/date-fns/locale/en-US/_lib/formatDistance.js 11557 var formatDistanceLocale = { 11558 lessThanXSeconds: { 11559 one: "less than a second", 11560 other: "less than {{count}} seconds" 11561 }, 11562 xSeconds: { 11563 one: "1 second", 11564 other: "{{count}} seconds" 11565 }, 11566 halfAMinute: "half a minute", 11567 lessThanXMinutes: { 11568 one: "less than a minute", 11569 other: "less than {{count}} minutes" 11570 }, 11571 xMinutes: { 11572 one: "1 minute", 11573 other: "{{count}} minutes" 11574 }, 11575 aboutXHours: { 11576 one: "about 1 hour", 11577 other: "about {{count}} hours" 11578 }, 11579 xHours: { 11580 one: "1 hour", 11581 other: "{{count}} hours" 11582 }, 11583 xDays: { 11584 one: "1 day", 11585 other: "{{count}} days" 11586 }, 11587 aboutXWeeks: { 11588 one: "about 1 week", 11589 other: "about {{count}} weeks" 11590 }, 11591 xWeeks: { 11592 one: "1 week", 11593 other: "{{count}} weeks" 11594 }, 11595 aboutXMonths: { 11596 one: "about 1 month", 11597 other: "about {{count}} months" 11598 }, 11599 xMonths: { 11600 one: "1 month", 11601 other: "{{count}} months" 11602 }, 11603 aboutXYears: { 11604 one: "about 1 year", 11605 other: "about {{count}} years" 11606 }, 11607 xYears: { 11608 one: "1 year", 11609 other: "{{count}} years" 11610 }, 11611 overXYears: { 11612 one: "over 1 year", 11613 other: "over {{count}} years" 11614 }, 11615 almostXYears: { 11616 one: "almost 1 year", 11617 other: "almost {{count}} years" 11618 } 11619 }; 11620 var formatDistance = (token, count, options) => { 11621 let result; 11622 const tokenValue = formatDistanceLocale[token]; 11623 if (typeof tokenValue === "string") { 11624 result = tokenValue; 11625 } else if (count === 1) { 11626 result = tokenValue.one; 11627 } else { 11628 result = tokenValue.other.replace("{{count}}", count.toString()); 11629 } 11630 if (options?.addSuffix) { 11631 if (options.comparison && options.comparison > 0) { 11632 return "in " + result; 11633 } else { 11634 return result + " ago"; 11635 } 11636 } 11637 return result; 11638 }; 11639 11640 // node_modules/date-fns/locale/_lib/buildFormatLongFn.js 11641 function buildFormatLongFn(args) { 11642 return (options = {}) => { 11643 const width = options.width ? String(options.width) : args.defaultWidth; 11644 const format6 = args.formats[width] || args.formats[args.defaultWidth]; 11645 return format6; 11646 }; 11647 } 11648 11649 // node_modules/date-fns/locale/en-US/_lib/formatLong.js 11650 var dateFormats = { 11651 full: "EEEE, MMMM do, y", 11652 long: "MMMM do, y", 11653 medium: "MMM d, y", 11654 short: "MM/dd/yyyy" 11655 }; 11656 var timeFormats = { 11657 full: "h:mm:ss a zzzz", 11658 long: "h:mm:ss a z", 11659 medium: "h:mm:ss a", 11660 short: "h:mm a" 11661 }; 11662 var dateTimeFormats = { 11663 full: "{{date}} 'at' {{time}}", 11664 long: "{{date}} 'at' {{time}}", 11665 medium: "{{date}}, {{time}}", 11666 short: "{{date}}, {{time}}" 11667 }; 11668 var formatLong = { 11669 date: buildFormatLongFn({ 11670 formats: dateFormats, 11671 defaultWidth: "full" 11672 }), 11673 time: buildFormatLongFn({ 11674 formats: timeFormats, 11675 defaultWidth: "full" 11676 }), 11677 dateTime: buildFormatLongFn({ 11678 formats: dateTimeFormats, 11679 defaultWidth: "full" 11680 }) 11681 }; 11682 11683 // node_modules/date-fns/locale/en-US/_lib/formatRelative.js 11684 var formatRelativeLocale = { 11685 lastWeek: "'last' eeee 'at' p", 11686 yesterday: "'yesterday at' p", 11687 today: "'today at' p", 11688 tomorrow: "'tomorrow at' p", 11689 nextWeek: "eeee 'at' p", 11690 other: "P" 11691 }; 11692 var formatRelative = (token, _date, _baseDate, _options) => formatRelativeLocale[token]; 11693 11694 // node_modules/date-fns/locale/_lib/buildLocalizeFn.js 11695 function buildLocalizeFn(args) { 11696 return (value, options) => { 11697 const context = options?.context ? String(options.context) : "standalone"; 11698 let valuesArray; 11699 if (context === "formatting" && args.formattingValues) { 11700 const defaultWidth = args.defaultFormattingWidth || args.defaultWidth; 11701 const width = options?.width ? String(options.width) : defaultWidth; 11702 valuesArray = args.formattingValues[width] || args.formattingValues[defaultWidth]; 11703 } else { 11704 const defaultWidth = args.defaultWidth; 11705 const width = options?.width ? String(options.width) : args.defaultWidth; 11706 valuesArray = args.values[width] || args.values[defaultWidth]; 11707 } 11708 const index2 = args.argumentCallback ? args.argumentCallback(value) : value; 11709 return valuesArray[index2]; 11710 }; 11711 } 11712 11713 // node_modules/date-fns/locale/en-US/_lib/localize.js 11714 var eraValues = { 11715 narrow: ["B", "A"], 11716 abbreviated: ["BC", "AD"], 11717 wide: ["Before Christ", "Anno Domini"] 11718 }; 11719 var quarterValues = { 11720 narrow: ["1", "2", "3", "4"], 11721 abbreviated: ["Q1", "Q2", "Q3", "Q4"], 11722 wide: ["1st quarter", "2nd quarter", "3rd quarter", "4th quarter"] 11723 }; 11724 var monthValues = { 11725 narrow: ["J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"], 11726 abbreviated: [ 11727 "Jan", 11728 "Feb", 11729 "Mar", 11730 "Apr", 11731 "May", 11732 "Jun", 11733 "Jul", 11734 "Aug", 11735 "Sep", 11736 "Oct", 11737 "Nov", 11738 "Dec" 11739 ], 11740 wide: [ 11741 "January", 11742 "February", 11743 "March", 11744 "April", 11745 "May", 11746 "June", 11747 "July", 11748 "August", 11749 "September", 11750 "October", 11751 "November", 11752 "December" 11753 ] 11754 }; 11755 var dayValues = { 11756 narrow: ["S", "M", "T", "W", "T", "F", "S"], 11757 short: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"], 11758 abbreviated: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], 11759 wide: [ 11760 "Sunday", 11761 "Monday", 11762 "Tuesday", 11763 "Wednesday", 11764 "Thursday", 11765 "Friday", 11766 "Saturday" 11767 ] 11768 }; 11769 var dayPeriodValues = { 11770 narrow: { 11771 am: "a", 11772 pm: "p", 11773 midnight: "mi", 11774 noon: "n", 11775 morning: "morning", 11776 afternoon: "afternoon", 11777 evening: "evening", 11778 night: "night" 11779 }, 11780 abbreviated: { 11781 am: "AM", 11782 pm: "PM", 11783 midnight: "midnight", 11784 noon: "noon", 11785 morning: "morning", 11786 afternoon: "afternoon", 11787 evening: "evening", 11788 night: "night" 11789 }, 11790 wide: { 11791 am: "a.m.", 11792 pm: "p.m.", 11793 midnight: "midnight", 11794 noon: "noon", 11795 morning: "morning", 11796 afternoon: "afternoon", 11797 evening: "evening", 11798 night: "night" 11799 } 11800 }; 11801 var formattingDayPeriodValues = { 11802 narrow: { 11803 am: "a", 11804 pm: "p", 11805 midnight: "mi", 11806 noon: "n", 11807 morning: "in the morning", 11808 afternoon: "in the afternoon", 11809 evening: "in the evening", 11810 night: "at night" 11811 }, 11812 abbreviated: { 11813 am: "AM", 11814 pm: "PM", 11815 midnight: "midnight", 11816 noon: "noon", 11817 morning: "in the morning", 11818 afternoon: "in the afternoon", 11819 evening: "in the evening", 11820 night: "at night" 11821 }, 11822 wide: { 11823 am: "a.m.", 11824 pm: "p.m.", 11825 midnight: "midnight", 11826 noon: "noon", 11827 morning: "in the morning", 11828 afternoon: "in the afternoon", 11829 evening: "in the evening", 11830 night: "at night" 11831 } 11832 }; 11833 var ordinalNumber = (dirtyNumber, _options) => { 11834 const number = Number(dirtyNumber); 11835 const rem100 = number % 100; 11836 if (rem100 > 20 || rem100 < 10) { 11837 switch (rem100 % 10) { 11838 case 1: 11839 return number + "st"; 11840 case 2: 11841 return number + "nd"; 11842 case 3: 11843 return number + "rd"; 11844 } 11845 } 11846 return number + "th"; 11847 }; 11848 var localize = { 11849 ordinalNumber, 11850 era: buildLocalizeFn({ 11851 values: eraValues, 11852 defaultWidth: "wide" 11853 }), 11854 quarter: buildLocalizeFn({ 11855 values: quarterValues, 11856 defaultWidth: "wide", 11857 argumentCallback: (quarter) => quarter - 1 11858 }), 11859 month: buildLocalizeFn({ 11860 values: monthValues, 11861 defaultWidth: "wide" 11862 }), 11863 day: buildLocalizeFn({ 11864 values: dayValues, 11865 defaultWidth: "wide" 11866 }), 11867 dayPeriod: buildLocalizeFn({ 11868 values: dayPeriodValues, 11869 defaultWidth: "wide", 11870 formattingValues: formattingDayPeriodValues, 11871 defaultFormattingWidth: "wide" 11872 }) 11873 }; 11874 11875 // node_modules/date-fns/locale/_lib/buildMatchFn.js 11876 function buildMatchFn(args) { 11877 return (string, options = {}) => { 11878 const width = options.width; 11879 const matchPattern = width && args.matchPatterns[width] || args.matchPatterns[args.defaultMatchWidth]; 11880 const matchResult = string.match(matchPattern); 11881 if (!matchResult) { 11882 return null; 11883 } 11884 const matchedString = matchResult[0]; 11885 const parsePatterns = width && args.parsePatterns[width] || args.parsePatterns[args.defaultParseWidth]; 11886 const key = Array.isArray(parsePatterns) ? findIndex(parsePatterns, (pattern) => pattern.test(matchedString)) : ( 11887 // [TODO] -- I challenge you to fix the type 11888 findKey(parsePatterns, (pattern) => pattern.test(matchedString)) 11889 ); 11890 let value; 11891 value = args.valueCallback ? args.valueCallback(key) : key; 11892 value = options.valueCallback ? ( 11893 // [TODO] -- I challenge you to fix the type 11894 options.valueCallback(value) 11895 ) : value; 11896 const rest = string.slice(matchedString.length); 11897 return { value, rest }; 11898 }; 11899 } 11900 function findKey(object, predicate) { 11901 for (const key in object) { 11902 if (Object.prototype.hasOwnProperty.call(object, key) && predicate(object[key])) { 11903 return key; 11904 } 11905 } 11906 return void 0; 11907 } 11908 function findIndex(array, predicate) { 11909 for (let key = 0; key < array.length; key++) { 11910 if (predicate(array[key])) { 11911 return key; 11912 } 11913 } 11914 return void 0; 11915 } 11916 11917 // node_modules/date-fns/locale/_lib/buildMatchPatternFn.js 11918 function buildMatchPatternFn(args) { 11919 return (string, options = {}) => { 11920 const matchResult = string.match(args.matchPattern); 11921 if (!matchResult) return null; 11922 const matchedString = matchResult[0]; 11923 const parseResult = string.match(args.parsePattern); 11924 if (!parseResult) return null; 11925 let value = args.valueCallback ? args.valueCallback(parseResult[0]) : parseResult[0]; 11926 value = options.valueCallback ? options.valueCallback(value) : value; 11927 const rest = string.slice(matchedString.length); 11928 return { value, rest }; 11929 }; 11930 } 11931 11932 // node_modules/date-fns/locale/en-US/_lib/match.js 11933 var matchOrdinalNumberPattern = /^(\d+)(th|st|nd|rd)?/i; 11934 var parseOrdinalNumberPattern = /\d+/i; 11935 var matchEraPatterns = { 11936 narrow: /^(b|a)/i, 11937 abbreviated: /^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i, 11938 wide: /^(before christ|before common era|anno domini|common era)/i 11939 }; 11940 var parseEraPatterns = { 11941 any: [/^b/i, /^(a|c)/i] 11942 }; 11943 var matchQuarterPatterns = { 11944 narrow: /^[1234]/i, 11945 abbreviated: /^q[1234]/i, 11946 wide: /^[1234](th|st|nd|rd)? quarter/i 11947 }; 11948 var parseQuarterPatterns = { 11949 any: [/1/i, /2/i, /3/i, /4/i] 11950 }; 11951 var matchMonthPatterns = { 11952 narrow: /^[jfmasond]/i, 11953 abbreviated: /^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i, 11954 wide: /^(january|february|march|april|may|june|july|august|september|october|november|december)/i 11955 }; 11956 var parseMonthPatterns = { 11957 narrow: [ 11958 /^j/i, 11959 /^f/i, 11960 /^m/i, 11961 /^a/i, 11962 /^m/i, 11963 /^j/i, 11964 /^j/i, 11965 /^a/i, 11966 /^s/i, 11967 /^o/i, 11968 /^n/i, 11969 /^d/i 11970 ], 11971 any: [ 11972 /^ja/i, 11973 /^f/i, 11974 /^mar/i, 11975 /^ap/i, 11976 /^may/i, 11977 /^jun/i, 11978 /^jul/i, 11979 /^au/i, 11980 /^s/i, 11981 /^o/i, 11982 /^n/i, 11983 /^d/i 11984 ] 11985 }; 11986 var matchDayPatterns = { 11987 narrow: /^[smtwf]/i, 11988 short: /^(su|mo|tu|we|th|fr|sa)/i, 11989 abbreviated: /^(sun|mon|tue|wed|thu|fri|sat)/i, 11990 wide: /^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i 11991 }; 11992 var parseDayPatterns = { 11993 narrow: [/^s/i, /^m/i, /^t/i, /^w/i, /^t/i, /^f/i, /^s/i], 11994 any: [/^su/i, /^m/i, /^tu/i, /^w/i, /^th/i, /^f/i, /^sa/i] 11995 }; 11996 var matchDayPeriodPatterns = { 11997 narrow: /^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i, 11998 any: /^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i 11999 }; 12000 var parseDayPeriodPatterns = { 12001 any: { 12002 am: /^a/i, 12003 pm: /^p/i, 12004 midnight: /^mi/i, 12005 noon: /^no/i, 12006 morning: /morning/i, 12007 afternoon: /afternoon/i, 12008 evening: /evening/i, 12009 night: /night/i 12010 } 12011 }; 12012 var match = { 12013 ordinalNumber: buildMatchPatternFn({ 12014 matchPattern: matchOrdinalNumberPattern, 12015 parsePattern: parseOrdinalNumberPattern, 12016 valueCallback: (value) => parseInt(value, 10) 12017 }), 12018 era: buildMatchFn({ 12019 matchPatterns: matchEraPatterns, 12020 defaultMatchWidth: "wide", 12021 parsePatterns: parseEraPatterns, 12022 defaultParseWidth: "any" 12023 }), 12024 quarter: buildMatchFn({ 12025 matchPatterns: matchQuarterPatterns, 12026 defaultMatchWidth: "wide", 12027 parsePatterns: parseQuarterPatterns, 12028 defaultParseWidth: "any", 12029 valueCallback: (index2) => index2 + 1 12030 }), 12031 month: buildMatchFn({ 12032 matchPatterns: matchMonthPatterns, 12033 defaultMatchWidth: "wide", 12034 parsePatterns: parseMonthPatterns, 12035 defaultParseWidth: "any" 12036 }), 12037 day: buildMatchFn({ 12038 matchPatterns: matchDayPatterns, 12039 defaultMatchWidth: "wide", 12040 parsePatterns: parseDayPatterns, 12041 defaultParseWidth: "any" 12042 }), 12043 dayPeriod: buildMatchFn({ 12044 matchPatterns: matchDayPeriodPatterns, 12045 defaultMatchWidth: "any", 12046 parsePatterns: parseDayPeriodPatterns, 12047 defaultParseWidth: "any" 12048 }) 12049 }; 12050 12051 // node_modules/date-fns/locale/en-US.js 12052 var enUS = { 12053 code: "en-US", 12054 formatDistance, 12055 formatLong, 12056 formatRelative, 12057 localize, 12058 match, 12059 options: { 12060 weekStartsOn: 0, 12061 firstWeekContainsDate: 1 12062 } 12063 }; 12064 12065 // node_modules/date-fns/getDayOfYear.js 12066 function getDayOfYear(date, options) { 12067 const _date = toDate(date, options?.in); 12068 const diff = differenceInCalendarDays(_date, startOfYear(_date)); 12069 const dayOfYear = diff + 1; 12070 return dayOfYear; 12071 } 12072 12073 // node_modules/date-fns/getISOWeek.js 12074 function getISOWeek(date, options) { 12075 const _date = toDate(date, options?.in); 12076 const diff = +startOfISOWeek(_date) - +startOfISOWeekYear(_date); 12077 return Math.round(diff / millisecondsInWeek) + 1; 12078 } 12079 12080 // node_modules/date-fns/getWeekYear.js 12081 function getWeekYear(date, options) { 12082 const _date = toDate(date, options?.in); 12083 const year = _date.getFullYear(); 12084 const defaultOptions2 = getDefaultOptions(); 12085 const firstWeekContainsDate = options?.firstWeekContainsDate ?? options?.locale?.options?.firstWeekContainsDate ?? defaultOptions2.firstWeekContainsDate ?? defaultOptions2.locale?.options?.firstWeekContainsDate ?? 1; 12086 const firstWeekOfNextYear = constructFrom(options?.in || date, 0); 12087 firstWeekOfNextYear.setFullYear(year + 1, 0, firstWeekContainsDate); 12088 firstWeekOfNextYear.setHours(0, 0, 0, 0); 12089 const startOfNextYear = startOfWeek(firstWeekOfNextYear, options); 12090 const firstWeekOfThisYear = constructFrom(options?.in || date, 0); 12091 firstWeekOfThisYear.setFullYear(year, 0, firstWeekContainsDate); 12092 firstWeekOfThisYear.setHours(0, 0, 0, 0); 12093 const startOfThisYear = startOfWeek(firstWeekOfThisYear, options); 12094 if (+_date >= +startOfNextYear) { 12095 return year + 1; 12096 } else if (+_date >= +startOfThisYear) { 12097 return year; 12098 } else { 12099 return year - 1; 12100 } 12101 } 12102 12103 // node_modules/date-fns/startOfWeekYear.js 12104 function startOfWeekYear(date, options) { 12105 const defaultOptions2 = getDefaultOptions(); 12106 const firstWeekContainsDate = options?.firstWeekContainsDate ?? options?.locale?.options?.firstWeekContainsDate ?? defaultOptions2.firstWeekContainsDate ?? defaultOptions2.locale?.options?.firstWeekContainsDate ?? 1; 12107 const year = getWeekYear(date, options); 12108 const firstWeek = constructFrom(options?.in || date, 0); 12109 firstWeek.setFullYear(year, 0, firstWeekContainsDate); 12110 firstWeek.setHours(0, 0, 0, 0); 12111 const _date = startOfWeek(firstWeek, options); 12112 return _date; 12113 } 12114 12115 // node_modules/date-fns/getWeek.js 12116 function getWeek(date, options) { 12117 const _date = toDate(date, options?.in); 12118 const diff = +startOfWeek(_date, options) - +startOfWeekYear(_date, options); 12119 return Math.round(diff / millisecondsInWeek) + 1; 12120 } 12121 12122 // node_modules/date-fns/_lib/addLeadingZeros.js 12123 function addLeadingZeros(number, targetLength) { 12124 const sign = number < 0 ? "-" : ""; 12125 const output = Math.abs(number).toString().padStart(targetLength, "0"); 12126 return sign + output; 12127 } 12128 12129 // node_modules/date-fns/_lib/format/lightFormatters.js 12130 var lightFormatters = { 12131 // Year 12132 y(date, token) { 12133 const signedYear = date.getFullYear(); 12134 const year = signedYear > 0 ? signedYear : 1 - signedYear; 12135 return addLeadingZeros(token === "yy" ? year % 100 : year, token.length); 12136 }, 12137 // Month 12138 M(date, token) { 12139 const month = date.getMonth(); 12140 return token === "M" ? String(month + 1) : addLeadingZeros(month + 1, 2); 12141 }, 12142 // Day of the month 12143 d(date, token) { 12144 return addLeadingZeros(date.getDate(), token.length); 12145 }, 12146 // AM or PM 12147 a(date, token) { 12148 const dayPeriodEnumValue = date.getHours() / 12 >= 1 ? "pm" : "am"; 12149 switch (token) { 12150 case "a": 12151 case "aa": 12152 return dayPeriodEnumValue.toUpperCase(); 12153 case "aaa": 12154 return dayPeriodEnumValue; 12155 case "aaaaa": 12156 return dayPeriodEnumValue[0]; 12157 case "aaaa": 12158 default: 12159 return dayPeriodEnumValue === "am" ? "a.m." : "p.m."; 12160 } 12161 }, 12162 // Hour [1-12] 12163 h(date, token) { 12164 return addLeadingZeros(date.getHours() % 12 || 12, token.length); 12165 }, 12166 // Hour [0-23] 12167 H(date, token) { 12168 return addLeadingZeros(date.getHours(), token.length); 12169 }, 12170 // Minute 12171 m(date, token) { 12172 return addLeadingZeros(date.getMinutes(), token.length); 12173 }, 12174 // Second 12175 s(date, token) { 12176 return addLeadingZeros(date.getSeconds(), token.length); 12177 }, 12178 // Fraction of second 12179 S(date, token) { 12180 const numberOfDigits = token.length; 12181 const milliseconds = date.getMilliseconds(); 12182 const fractionalSeconds = Math.trunc( 12183 milliseconds * Math.pow(10, numberOfDigits - 3) 12184 ); 12185 return addLeadingZeros(fractionalSeconds, token.length); 12186 } 12187 }; 12188 12189 // node_modules/date-fns/_lib/format/formatters.js 12190 var dayPeriodEnum = { 12191 am: "am", 12192 pm: "pm", 12193 midnight: "midnight", 12194 noon: "noon", 12195 morning: "morning", 12196 afternoon: "afternoon", 12197 evening: "evening", 12198 night: "night" 12199 }; 12200 var formatters = { 12201 // Era 12202 G: function(date, token, localize2) { 12203 const era = date.getFullYear() > 0 ? 1 : 0; 12204 switch (token) { 12205 // AD, BC 12206 case "G": 12207 case "GG": 12208 case "GGG": 12209 return localize2.era(era, { width: "abbreviated" }); 12210 // A, B 12211 case "GGGGG": 12212 return localize2.era(era, { width: "narrow" }); 12213 // Anno Domini, Before Christ 12214 case "GGGG": 12215 default: 12216 return localize2.era(era, { width: "wide" }); 12217 } 12218 }, 12219 // Year 12220 y: function(date, token, localize2) { 12221 if (token === "yo") { 12222 const signedYear = date.getFullYear(); 12223 const year = signedYear > 0 ? signedYear : 1 - signedYear; 12224 return localize2.ordinalNumber(year, { unit: "year" }); 12225 } 12226 return lightFormatters.y(date, token); 12227 }, 12228 // Local week-numbering year 12229 Y: function(date, token, localize2, options) { 12230 const signedWeekYear = getWeekYear(date, options); 12231 const weekYear = signedWeekYear > 0 ? signedWeekYear : 1 - signedWeekYear; 12232 if (token === "YY") { 12233 const twoDigitYear = weekYear % 100; 12234 return addLeadingZeros(twoDigitYear, 2); 12235 } 12236 if (token === "Yo") { 12237 return localize2.ordinalNumber(weekYear, { unit: "year" }); 12238 } 12239 return addLeadingZeros(weekYear, token.length); 12240 }, 12241 // ISO week-numbering year 12242 R: function(date, token) { 12243 const isoWeekYear = getISOWeekYear(date); 12244 return addLeadingZeros(isoWeekYear, token.length); 12245 }, 12246 // Extended year. This is a single number designating the year of this calendar system. 12247 // The main difference between `y` and `u` localizers are B.C. years: 12248 // | Year | `y` | `u` | 12249 // |------|-----|-----| 12250 // | AC 1 | 1 | 1 | 12251 // | BC 1 | 1 | 0 | 12252 // | BC 2 | 2 | -1 | 12253 // Also `yy` always returns the last two digits of a year, 12254 // while `uu` pads single digit years to 2 characters and returns other years unchanged. 12255 u: function(date, token) { 12256 const year = date.getFullYear(); 12257 return addLeadingZeros(year, token.length); 12258 }, 12259 // Quarter 12260 Q: function(date, token, localize2) { 12261 const quarter = Math.ceil((date.getMonth() + 1) / 3); 12262 switch (token) { 12263 // 1, 2, 3, 4 12264 case "Q": 12265 return String(quarter); 12266 // 01, 02, 03, 04 12267 case "QQ": 12268 return addLeadingZeros(quarter, 2); 12269 // 1st, 2nd, 3rd, 4th 12270 case "Qo": 12271 return localize2.ordinalNumber(quarter, { unit: "quarter" }); 12272 // Q1, Q2, Q3, Q4 12273 case "QQQ": 12274 return localize2.quarter(quarter, { 12275 width: "abbreviated", 12276 context: "formatting" 12277 }); 12278 // 1, 2, 3, 4 (narrow quarter; could be not numerical) 12279 case "QQQQQ": 12280 return localize2.quarter(quarter, { 12281 width: "narrow", 12282 context: "formatting" 12283 }); 12284 // 1st quarter, 2nd quarter, ... 12285 case "QQQQ": 12286 default: 12287 return localize2.quarter(quarter, { 12288 width: "wide", 12289 context: "formatting" 12290 }); 12291 } 12292 }, 12293 // Stand-alone quarter 12294 q: function(date, token, localize2) { 12295 const quarter = Math.ceil((date.getMonth() + 1) / 3); 12296 switch (token) { 12297 // 1, 2, 3, 4 12298 case "q": 12299 return String(quarter); 12300 // 01, 02, 03, 04 12301 case "qq": 12302 return addLeadingZeros(quarter, 2); 12303 // 1st, 2nd, 3rd, 4th 12304 case "qo": 12305 return localize2.ordinalNumber(quarter, { unit: "quarter" }); 12306 // Q1, Q2, Q3, Q4 12307 case "qqq": 12308 return localize2.quarter(quarter, { 12309 width: "abbreviated", 12310 context: "standalone" 12311 }); 12312 // 1, 2, 3, 4 (narrow quarter; could be not numerical) 12313 case "qqqqq": 12314 return localize2.quarter(quarter, { 12315 width: "narrow", 12316 context: "standalone" 12317 }); 12318 // 1st quarter, 2nd quarter, ... 12319 case "qqqq": 12320 default: 12321 return localize2.quarter(quarter, { 12322 width: "wide", 12323 context: "standalone" 12324 }); 12325 } 12326 }, 12327 // Month 12328 M: function(date, token, localize2) { 12329 const month = date.getMonth(); 12330 switch (token) { 12331 case "M": 12332 case "MM": 12333 return lightFormatters.M(date, token); 12334 // 1st, 2nd, ..., 12th 12335 case "Mo": 12336 return localize2.ordinalNumber(month + 1, { unit: "month" }); 12337 // Jan, Feb, ..., Dec 12338 case "MMM": 12339 return localize2.month(month, { 12340 width: "abbreviated", 12341 context: "formatting" 12342 }); 12343 // J, F, ..., D 12344 case "MMMMM": 12345 return localize2.month(month, { 12346 width: "narrow", 12347 context: "formatting" 12348 }); 12349 // January, February, ..., December 12350 case "MMMM": 12351 default: 12352 return localize2.month(month, { width: "wide", context: "formatting" }); 12353 } 12354 }, 12355 // Stand-alone month 12356 L: function(date, token, localize2) { 12357 const month = date.getMonth(); 12358 switch (token) { 12359 // 1, 2, ..., 12 12360 case "L": 12361 return String(month + 1); 12362 // 01, 02, ..., 12 12363 case "LL": 12364 return addLeadingZeros(month + 1, 2); 12365 // 1st, 2nd, ..., 12th 12366 case "Lo": 12367 return localize2.ordinalNumber(month + 1, { unit: "month" }); 12368 // Jan, Feb, ..., Dec 12369 case "LLL": 12370 return localize2.month(month, { 12371 width: "abbreviated", 12372 context: "standalone" 12373 }); 12374 // J, F, ..., D 12375 case "LLLLL": 12376 return localize2.month(month, { 12377 width: "narrow", 12378 context: "standalone" 12379 }); 12380 // January, February, ..., December 12381 case "LLLL": 12382 default: 12383 return localize2.month(month, { width: "wide", context: "standalone" }); 12384 } 12385 }, 12386 // Local week of year 12387 w: function(date, token, localize2, options) { 12388 const week = getWeek(date, options); 12389 if (token === "wo") { 12390 return localize2.ordinalNumber(week, { unit: "week" }); 12391 } 12392 return addLeadingZeros(week, token.length); 12393 }, 12394 // ISO week of year 12395 I: function(date, token, localize2) { 12396 const isoWeek = getISOWeek(date); 12397 if (token === "Io") { 12398 return localize2.ordinalNumber(isoWeek, { unit: "week" }); 12399 } 12400 return addLeadingZeros(isoWeek, token.length); 12401 }, 12402 // Day of the month 12403 d: function(date, token, localize2) { 12404 if (token === "do") { 12405 return localize2.ordinalNumber(date.getDate(), { unit: "date" }); 12406 } 12407 return lightFormatters.d(date, token); 12408 }, 12409 // Day of year 12410 D: function(date, token, localize2) { 12411 const dayOfYear = getDayOfYear(date); 12412 if (token === "Do") { 12413 return localize2.ordinalNumber(dayOfYear, { unit: "dayOfYear" }); 12414 } 12415 return addLeadingZeros(dayOfYear, token.length); 12416 }, 12417 // Day of week 12418 E: function(date, token, localize2) { 12419 const dayOfWeek = date.getDay(); 12420 switch (token) { 12421 // Tue 12422 case "E": 12423 case "EE": 12424 case "EEE": 12425 return localize2.day(dayOfWeek, { 12426 width: "abbreviated", 12427 context: "formatting" 12428 }); 12429 // T 12430 case "EEEEE": 12431 return localize2.day(dayOfWeek, { 12432 width: "narrow", 12433 context: "formatting" 12434 }); 12435 // Tu 12436 case "EEEEEE": 12437 return localize2.day(dayOfWeek, { 12438 width: "short", 12439 context: "formatting" 12440 }); 12441 // Tuesday 12442 case "EEEE": 12443 default: 12444 return localize2.day(dayOfWeek, { 12445 width: "wide", 12446 context: "formatting" 12447 }); 12448 } 12449 }, 12450 // Local day of week 12451 e: function(date, token, localize2, options) { 12452 const dayOfWeek = date.getDay(); 12453 const localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7; 12454 switch (token) { 12455 // Numerical value (Nth day of week with current locale or weekStartsOn) 12456 case "e": 12457 return String(localDayOfWeek); 12458 // Padded numerical value 12459 case "ee": 12460 return addLeadingZeros(localDayOfWeek, 2); 12461 // 1st, 2nd, ..., 7th 12462 case "eo": 12463 return localize2.ordinalNumber(localDayOfWeek, { unit: "day" }); 12464 case "eee": 12465 return localize2.day(dayOfWeek, { 12466 width: "abbreviated", 12467 context: "formatting" 12468 }); 12469 // T 12470 case "eeeee": 12471 return localize2.day(dayOfWeek, { 12472 width: "narrow", 12473 context: "formatting" 12474 }); 12475 // Tu 12476 case "eeeeee": 12477 return localize2.day(dayOfWeek, { 12478 width: "short", 12479 context: "formatting" 12480 }); 12481 // Tuesday 12482 case "eeee": 12483 default: 12484 return localize2.day(dayOfWeek, { 12485 width: "wide", 12486 context: "formatting" 12487 }); 12488 } 12489 }, 12490 // Stand-alone local day of week 12491 c: function(date, token, localize2, options) { 12492 const dayOfWeek = date.getDay(); 12493 const localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7; 12494 switch (token) { 12495 // Numerical value (same as in `e`) 12496 case "c": 12497 return String(localDayOfWeek); 12498 // Padded numerical value 12499 case "cc": 12500 return addLeadingZeros(localDayOfWeek, token.length); 12501 // 1st, 2nd, ..., 7th 12502 case "co": 12503 return localize2.ordinalNumber(localDayOfWeek, { unit: "day" }); 12504 case "ccc": 12505 return localize2.day(dayOfWeek, { 12506 width: "abbreviated", 12507 context: "standalone" 12508 }); 12509 // T 12510 case "ccccc": 12511 return localize2.day(dayOfWeek, { 12512 width: "narrow", 12513 context: "standalone" 12514 }); 12515 // Tu 12516 case "cccccc": 12517 return localize2.day(dayOfWeek, { 12518 width: "short", 12519 context: "standalone" 12520 }); 12521 // Tuesday 12522 case "cccc": 12523 default: 12524 return localize2.day(dayOfWeek, { 12525 width: "wide", 12526 context: "standalone" 12527 }); 12528 } 12529 }, 12530 // ISO day of week 12531 i: function(date, token, localize2) { 12532 const dayOfWeek = date.getDay(); 12533 const isoDayOfWeek = dayOfWeek === 0 ? 7 : dayOfWeek; 12534 switch (token) { 12535 // 2 12536 case "i": 12537 return String(isoDayOfWeek); 12538 // 02 12539 case "ii": 12540 return addLeadingZeros(isoDayOfWeek, token.length); 12541 // 2nd 12542 case "io": 12543 return localize2.ordinalNumber(isoDayOfWeek, { unit: "day" }); 12544 // Tue 12545 case "iii": 12546 return localize2.day(dayOfWeek, { 12547 width: "abbreviated", 12548 context: "formatting" 12549 }); 12550 // T 12551 case "iiiii": 12552 return localize2.day(dayOfWeek, { 12553 width: "narrow", 12554 context: "formatting" 12555 }); 12556 // Tu 12557 case "iiiiii": 12558 return localize2.day(dayOfWeek, { 12559 width: "short", 12560 context: "formatting" 12561 }); 12562 // Tuesday 12563 case "iiii": 12564 default: 12565 return localize2.day(dayOfWeek, { 12566 width: "wide", 12567 context: "formatting" 12568 }); 12569 } 12570 }, 12571 // AM or PM 12572 a: function(date, token, localize2) { 12573 const hours = date.getHours(); 12574 const dayPeriodEnumValue = hours / 12 >= 1 ? "pm" : "am"; 12575 switch (token) { 12576 case "a": 12577 case "aa": 12578 return localize2.dayPeriod(dayPeriodEnumValue, { 12579 width: "abbreviated", 12580 context: "formatting" 12581 }); 12582 case "aaa": 12583 return localize2.dayPeriod(dayPeriodEnumValue, { 12584 width: "abbreviated", 12585 context: "formatting" 12586 }).toLowerCase(); 12587 case "aaaaa": 12588 return localize2.dayPeriod(dayPeriodEnumValue, { 12589 width: "narrow", 12590 context: "formatting" 12591 }); 12592 case "aaaa": 12593 default: 12594 return localize2.dayPeriod(dayPeriodEnumValue, { 12595 width: "wide", 12596 context: "formatting" 12597 }); 12598 } 12599 }, 12600 // AM, PM, midnight, noon 12601 b: function(date, token, localize2) { 12602 const hours = date.getHours(); 12603 let dayPeriodEnumValue; 12604 if (hours === 12) { 12605 dayPeriodEnumValue = dayPeriodEnum.noon; 12606 } else if (hours === 0) { 12607 dayPeriodEnumValue = dayPeriodEnum.midnight; 12608 } else { 12609 dayPeriodEnumValue = hours / 12 >= 1 ? "pm" : "am"; 12610 } 12611 switch (token) { 12612 case "b": 12613 case "bb": 12614 return localize2.dayPeriod(dayPeriodEnumValue, { 12615 width: "abbreviated", 12616 context: "formatting" 12617 }); 12618 case "bbb": 12619 return localize2.dayPeriod(dayPeriodEnumValue, { 12620 width: "abbreviated", 12621 context: "formatting" 12622 }).toLowerCase(); 12623 case "bbbbb": 12624 return localize2.dayPeriod(dayPeriodEnumValue, { 12625 width: "narrow", 12626 context: "formatting" 12627 }); 12628 case "bbbb": 12629 default: 12630 return localize2.dayPeriod(dayPeriodEnumValue, { 12631 width: "wide", 12632 context: "formatting" 12633 }); 12634 } 12635 }, 12636 // in the morning, in the afternoon, in the evening, at night 12637 B: function(date, token, localize2) { 12638 const hours = date.getHours(); 12639 let dayPeriodEnumValue; 12640 if (hours >= 17) { 12641 dayPeriodEnumValue = dayPeriodEnum.evening; 12642 } else if (hours >= 12) { 12643 dayPeriodEnumValue = dayPeriodEnum.afternoon; 12644 } else if (hours >= 4) { 12645 dayPeriodEnumValue = dayPeriodEnum.morning; 12646 } else { 12647 dayPeriodEnumValue = dayPeriodEnum.night; 12648 } 12649 switch (token) { 12650 case "B": 12651 case "BB": 12652 case "BBB": 12653 return localize2.dayPeriod(dayPeriodEnumValue, { 12654 width: "abbreviated", 12655 context: "formatting" 12656 }); 12657 case "BBBBB": 12658 return localize2.dayPeriod(dayPeriodEnumValue, { 12659 width: "narrow", 12660 context: "formatting" 12661 }); 12662 case "BBBB": 12663 default: 12664 return localize2.dayPeriod(dayPeriodEnumValue, { 12665 width: "wide", 12666 context: "formatting" 12667 }); 12668 } 12669 }, 12670 // Hour [1-12] 12671 h: function(date, token, localize2) { 12672 if (token === "ho") { 12673 let hours = date.getHours() % 12; 12674 if (hours === 0) hours = 12; 12675 return localize2.ordinalNumber(hours, { unit: "hour" }); 12676 } 12677 return lightFormatters.h(date, token); 12678 }, 12679 // Hour [0-23] 12680 H: function(date, token, localize2) { 12681 if (token === "Ho") { 12682 return localize2.ordinalNumber(date.getHours(), { unit: "hour" }); 12683 } 12684 return lightFormatters.H(date, token); 12685 }, 12686 // Hour [0-11] 12687 K: function(date, token, localize2) { 12688 const hours = date.getHours() % 12; 12689 if (token === "Ko") { 12690 return localize2.ordinalNumber(hours, { unit: "hour" }); 12691 } 12692 return addLeadingZeros(hours, token.length); 12693 }, 12694 // Hour [1-24] 12695 k: function(date, token, localize2) { 12696 let hours = date.getHours(); 12697 if (hours === 0) hours = 24; 12698 if (token === "ko") { 12699 return localize2.ordinalNumber(hours, { unit: "hour" }); 12700 } 12701 return addLeadingZeros(hours, token.length); 12702 }, 12703 // Minute 12704 m: function(date, token, localize2) { 12705 if (token === "mo") { 12706 return localize2.ordinalNumber(date.getMinutes(), { unit: "minute" }); 12707 } 12708 return lightFormatters.m(date, token); 12709 }, 12710 // Second 12711 s: function(date, token, localize2) { 12712 if (token === "so") { 12713 return localize2.ordinalNumber(date.getSeconds(), { unit: "second" }); 12714 } 12715 return lightFormatters.s(date, token); 12716 }, 12717 // Fraction of second 12718 S: function(date, token) { 12719 return lightFormatters.S(date, token); 12720 }, 12721 // Timezone (ISO-8601. If offset is 0, output is always `'Z'`) 12722 X: function(date, token, _localize) { 12723 const timezoneOffset = date.getTimezoneOffset(); 12724 if (timezoneOffset === 0) { 12725 return "Z"; 12726 } 12727 switch (token) { 12728 // Hours and optional minutes 12729 case "X": 12730 return formatTimezoneWithOptionalMinutes(timezoneOffset); 12731 // Hours, minutes and optional seconds without `:` delimiter 12732 // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets 12733 // so this token always has the same output as `XX` 12734 case "XXXX": 12735 case "XX": 12736 return formatTimezone(timezoneOffset); 12737 // Hours, minutes and optional seconds with `:` delimiter 12738 // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets 12739 // so this token always has the same output as `XXX` 12740 case "XXXXX": 12741 case "XXX": 12742 // Hours and minutes with `:` delimiter 12743 default: 12744 return formatTimezone(timezoneOffset, ":"); 12745 } 12746 }, 12747 // Timezone (ISO-8601. If offset is 0, output is `'+00:00'` or equivalent) 12748 x: function(date, token, _localize) { 12749 const timezoneOffset = date.getTimezoneOffset(); 12750 switch (token) { 12751 // Hours and optional minutes 12752 case "x": 12753 return formatTimezoneWithOptionalMinutes(timezoneOffset); 12754 // Hours, minutes and optional seconds without `:` delimiter 12755 // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets 12756 // so this token always has the same output as `xx` 12757 case "xxxx": 12758 case "xx": 12759 return formatTimezone(timezoneOffset); 12760 // Hours, minutes and optional seconds with `:` delimiter 12761 // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets 12762 // so this token always has the same output as `xxx` 12763 case "xxxxx": 12764 case "xxx": 12765 // Hours and minutes with `:` delimiter 12766 default: 12767 return formatTimezone(timezoneOffset, ":"); 12768 } 12769 }, 12770 // Timezone (GMT) 12771 O: function(date, token, _localize) { 12772 const timezoneOffset = date.getTimezoneOffset(); 12773 switch (token) { 12774 // Short 12775 case "O": 12776 case "OO": 12777 case "OOO": 12778 return "GMT" + formatTimezoneShort(timezoneOffset, ":"); 12779 // Long 12780 case "OOOO": 12781 default: 12782 return "GMT" + formatTimezone(timezoneOffset, ":"); 12783 } 12784 }, 12785 // Timezone (specific non-location) 12786 z: function(date, token, _localize) { 12787 const timezoneOffset = date.getTimezoneOffset(); 12788 switch (token) { 12789 // Short 12790 case "z": 12791 case "zz": 12792 case "zzz": 12793 return "GMT" + formatTimezoneShort(timezoneOffset, ":"); 12794 // Long 12795 case "zzzz": 12796 default: 12797 return "GMT" + formatTimezone(timezoneOffset, ":"); 12798 } 12799 }, 12800 // Seconds timestamp 12801 t: function(date, token, _localize) { 12802 const timestamp = Math.trunc(+date / 1e3); 12803 return addLeadingZeros(timestamp, token.length); 12804 }, 12805 // Milliseconds timestamp 12806 T: function(date, token, _localize) { 12807 return addLeadingZeros(+date, token.length); 12808 } 12809 }; 12810 function formatTimezoneShort(offset4, delimiter = "") { 12811 const sign = offset4 > 0 ? "-" : "+"; 12812 const absOffset = Math.abs(offset4); 12813 const hours = Math.trunc(absOffset / 60); 12814 const minutes = absOffset % 60; 12815 if (minutes === 0) { 12816 return sign + String(hours); 12817 } 12818 return sign + String(hours) + delimiter + addLeadingZeros(minutes, 2); 12819 } 12820 function formatTimezoneWithOptionalMinutes(offset4, delimiter) { 12821 if (offset4 % 60 === 0) { 12822 const sign = offset4 > 0 ? "-" : "+"; 12823 return sign + addLeadingZeros(Math.abs(offset4) / 60, 2); 12824 } 12825 return formatTimezone(offset4, delimiter); 12826 } 12827 function formatTimezone(offset4, delimiter = "") { 12828 const sign = offset4 > 0 ? "-" : "+"; 12829 const absOffset = Math.abs(offset4); 12830 const hours = addLeadingZeros(Math.trunc(absOffset / 60), 2); 12831 const minutes = addLeadingZeros(absOffset % 60, 2); 12832 return sign + hours + delimiter + minutes; 12833 } 12834 12835 // node_modules/date-fns/_lib/format/longFormatters.js 12836 var dateLongFormatter = (pattern, formatLong2) => { 12837 switch (pattern) { 12838 case "P": 12839 return formatLong2.date({ width: "short" }); 12840 case "PP": 12841 return formatLong2.date({ width: "medium" }); 12842 case "PPP": 12843 return formatLong2.date({ width: "long" }); 12844 case "PPPP": 12845 default: 12846 return formatLong2.date({ width: "full" }); 12847 } 12848 }; 12849 var timeLongFormatter = (pattern, formatLong2) => { 12850 switch (pattern) { 12851 case "p": 12852 return formatLong2.time({ width: "short" }); 12853 case "pp": 12854 return formatLong2.time({ width: "medium" }); 12855 case "ppp": 12856 return formatLong2.time({ width: "long" }); 12857 case "pppp": 12858 default: 12859 return formatLong2.time({ width: "full" }); 12860 } 12861 }; 12862 var dateTimeLongFormatter = (pattern, formatLong2) => { 12863 const matchResult = pattern.match(/(P+)(p+)?/) || []; 12864 const datePattern = matchResult[1]; 12865 const timePattern = matchResult[2]; 12866 if (!timePattern) { 12867 return dateLongFormatter(pattern, formatLong2); 12868 } 12869 let dateTimeFormat; 12870 switch (datePattern) { 12871 case "P": 12872 dateTimeFormat = formatLong2.dateTime({ width: "short" }); 12873 break; 12874 case "PP": 12875 dateTimeFormat = formatLong2.dateTime({ width: "medium" }); 12876 break; 12877 case "PPP": 12878 dateTimeFormat = formatLong2.dateTime({ width: "long" }); 12879 break; 12880 case "PPPP": 12881 default: 12882 dateTimeFormat = formatLong2.dateTime({ width: "full" }); 12883 break; 12884 } 12885 return dateTimeFormat.replace("{{date}}", dateLongFormatter(datePattern, formatLong2)).replace("{{time}}", timeLongFormatter(timePattern, formatLong2)); 12886 }; 12887 var longFormatters = { 12888 p: timeLongFormatter, 12889 P: dateTimeLongFormatter 12890 }; 12891 12892 // node_modules/date-fns/_lib/protectedTokens.js 12893 var dayOfYearTokenRE = /^D+$/; 12894 var weekYearTokenRE = /^Y+$/; 12895 var throwTokens = ["D", "DD", "YY", "YYYY"]; 12896 function isProtectedDayOfYearToken(token) { 12897 return dayOfYearTokenRE.test(token); 12898 } 12899 function isProtectedWeekYearToken(token) { 12900 return weekYearTokenRE.test(token); 12901 } 12902 function warnOrThrowProtectedError(token, format6, input) { 12903 const _message = message(token, format6, input); 12904 console.warn(_message); 12905 if (throwTokens.includes(token)) throw new RangeError(_message); 12906 } 12907 function message(token, format6, input) { 12908 const subject = token[0] === "Y" ? "years" : "days of the month"; 12909 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`; 12910 } 12911 12912 // node_modules/date-fns/format.js 12913 var formattingTokensRegExp = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g; 12914 var longFormattingTokensRegExp = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g; 12915 var escapedStringRegExp = /^'([^]*?)'?$/; 12916 var doubleQuoteRegExp = /''/g; 12917 var unescapedLatinCharacterRegExp = /[a-zA-Z]/; 12918 function format(date, formatStr, options) { 12919 const defaultOptions2 = getDefaultOptions(); 12920 const locale = options?.locale ?? defaultOptions2.locale ?? enUS; 12921 const firstWeekContainsDate = options?.firstWeekContainsDate ?? options?.locale?.options?.firstWeekContainsDate ?? defaultOptions2.firstWeekContainsDate ?? defaultOptions2.locale?.options?.firstWeekContainsDate ?? 1; 12922 const weekStartsOn = options?.weekStartsOn ?? options?.locale?.options?.weekStartsOn ?? defaultOptions2.weekStartsOn ?? defaultOptions2.locale?.options?.weekStartsOn ?? 0; 12923 const originalDate = toDate(date, options?.in); 12924 if (!isValid(originalDate)) { 12925 throw new RangeError("Invalid time value"); 12926 } 12927 let parts = formatStr.match(longFormattingTokensRegExp).map((substring) => { 12928 const firstCharacter = substring[0]; 12929 if (firstCharacter === "p" || firstCharacter === "P") { 12930 const longFormatter = longFormatters[firstCharacter]; 12931 return longFormatter(substring, locale.formatLong); 12932 } 12933 return substring; 12934 }).join("").match(formattingTokensRegExp).map((substring) => { 12935 if (substring === "''") { 12936 return { isToken: false, value: "'" }; 12937 } 12938 const firstCharacter = substring[0]; 12939 if (firstCharacter === "'") { 12940 return { isToken: false, value: cleanEscapedString(substring) }; 12941 } 12942 if (formatters[firstCharacter]) { 12943 return { isToken: true, value: substring }; 12944 } 12945 if (firstCharacter.match(unescapedLatinCharacterRegExp)) { 12946 throw new RangeError( 12947 "Format string contains an unescaped latin alphabet character `" + firstCharacter + "`" 12948 ); 12949 } 12950 return { isToken: false, value: substring }; 12951 }); 12952 if (locale.localize.preprocessor) { 12953 parts = locale.localize.preprocessor(originalDate, parts); 12954 } 12955 const formatterOptions = { 12956 firstWeekContainsDate, 12957 weekStartsOn, 12958 locale 12959 }; 12960 return parts.map((part) => { 12961 if (!part.isToken) return part.value; 12962 const token = part.value; 12963 if (!options?.useAdditionalWeekYearTokens && isProtectedWeekYearToken(token) || !options?.useAdditionalDayOfYearTokens && isProtectedDayOfYearToken(token)) { 12964 warnOrThrowProtectedError(token, formatStr, String(date)); 12965 } 12966 const formatter = formatters[token[0]]; 12967 return formatter(originalDate, token, locale.localize, formatterOptions); 12968 }).join(""); 12969 } 12970 function cleanEscapedString(input) { 12971 const matched = input.match(escapedStringRegExp); 12972 if (!matched) { 12973 return input; 12974 } 12975 return matched[1].replace(doubleQuoteRegExp, "'"); 12976 } 12977 12978 // node_modules/date-fns/subDays.js 12979 function subDays(date, amount, options) { 12980 return addDays(date, -amount, options); 12981 } 12982 12983 // node_modules/date-fns/subMonths.js 12984 function subMonths(date, amount, options) { 12985 return addMonths(date, -amount, options); 12986 } 12987 12988 // node_modules/date-fns/subWeeks.js 12989 function subWeeks(date, amount, options) { 12990 return addWeeks(date, -amount, options); 12991 } 12992 12993 // node_modules/date-fns/subYears.js 12994 function subYears(date, amount, options) { 12995 return addYears(date, -amount, options); 12996 } 12997 12998 // packages/dataviews/build-module/utils/operators.mjs 12999 var import_i18n2 = __toESM(require_i18n(), 1); 13000 var import_element33 = __toESM(require_element(), 1); 13001 var import_date = __toESM(require_date(), 1); 13002 var import_jsx_runtime40 = __toESM(require_jsx_runtime(), 1); 13003 var filterTextWrappers = { 13004 Name: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: "dataviews-filters__summary-filter-text-name" }), 13005 Value: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: "dataviews-filters__summary-filter-text-value" }) 13006 }; 13007 function getRelativeDate(value, unit) { 13008 switch (unit) { 13009 case "days": 13010 return subDays(/* @__PURE__ */ new Date(), value); 13011 case "weeks": 13012 return subWeeks(/* @__PURE__ */ new Date(), value); 13013 case "months": 13014 return subMonths(/* @__PURE__ */ new Date(), value); 13015 case "years": 13016 return subYears(/* @__PURE__ */ new Date(), value); 13017 default: 13018 return /* @__PURE__ */ new Date(); 13019 } 13020 } 13021 var isNoneOperatorDefinition = { 13022 /* translators: DataViews operator name */ 13023 label: (0, import_i18n2.__)("Is none of"), 13024 filterText: (filter, activeElements) => (0, import_element33.createInterpolateElement)( 13025 (0, import_i18n2.sprintf)( 13026 /* translators: 1: Filter name (e.g. "Author"). 2: Filter value (e.g. "Admin"): "Author is none of: Admin, Editor". */ 13027 (0, import_i18n2.__)("<Name>%1$s is none of: </Name><Value>%2$s</Value>"), 13028 filter.name, 13029 activeElements.map((element) => element.label).join(", ") 13030 ), 13031 filterTextWrappers 13032 ), 13033 filter: ((item, field, filterValue) => { 13034 if (!filterValue?.length) { 13035 return true; 13036 } 13037 const fieldValue = field.getValue({ item }); 13038 if (Array.isArray(fieldValue)) { 13039 return !filterValue.some( 13040 (fv) => fieldValue.includes(fv) 13041 ); 13042 } else if (typeof fieldValue === "string") { 13043 return !filterValue.includes(fieldValue); 13044 } 13045 return false; 13046 }), 13047 selection: "multi" 13048 }; 13049 var OPERATORS = [ 13050 { 13051 name: OPERATOR_IS_ANY, 13052 /* translators: DataViews operator name */ 13053 label: (0, import_i18n2.__)("Includes"), 13054 filterText: (filter, activeElements) => (0, import_element33.createInterpolateElement)( 13055 (0, import_i18n2.sprintf)( 13056 /* translators: 1: Filter name (e.g. "Author"). 2: Filter value (e.g. "Admin"): "Author is any: Admin, Editor". */ 13057 (0, import_i18n2.__)("<Name>%1$s includes: </Name><Value>%2$s</Value>"), 13058 filter.name, 13059 activeElements.map((element) => element.label).join(", ") 13060 ), 13061 filterTextWrappers 13062 ), 13063 filter(item, field, filterValue) { 13064 if (!filterValue?.length) { 13065 return true; 13066 } 13067 const fieldValue = field.getValue({ item }); 13068 if (Array.isArray(fieldValue)) { 13069 return filterValue.some( 13070 (fv) => fieldValue.includes(fv) 13071 ); 13072 } else if (typeof fieldValue === "string") { 13073 return filterValue.includes(fieldValue); 13074 } 13075 return false; 13076 }, 13077 selection: "multi" 13078 }, 13079 { 13080 name: OPERATOR_IS_NONE, 13081 ...isNoneOperatorDefinition 13082 }, 13083 { 13084 name: OPERATOR_IS_ALL, 13085 /* translators: DataViews operator name */ 13086 label: (0, import_i18n2.__)("Includes all"), 13087 filterText: (filter, activeElements) => (0, import_element33.createInterpolateElement)( 13088 (0, import_i18n2.sprintf)( 13089 /* translators: 1: Filter name (e.g. "Author"). 2: Filter value (e.g. "Admin"): "Author includes all: Admin, Editor". */ 13090 (0, import_i18n2.__)("<Name>%1$s includes all: </Name><Value>%2$s</Value>"), 13091 filter.name, 13092 activeElements.map((element) => element.label).join(", ") 13093 ), 13094 filterTextWrappers 13095 ), 13096 filter(item, field, filterValue) { 13097 if (!filterValue?.length) { 13098 return true; 13099 } 13100 return filterValue.every((value) => { 13101 return field.getValue({ item })?.includes(value); 13102 }); 13103 }, 13104 selection: "multi" 13105 }, 13106 { 13107 name: OPERATOR_IS_NOT_ALL, 13108 ...isNoneOperatorDefinition 13109 }, 13110 { 13111 name: OPERATOR_BETWEEN, 13112 /* translators: DataViews operator name */ 13113 label: (0, import_i18n2.__)("Between (inc)"), 13114 filterText: (filter, activeElements) => (0, import_element33.createInterpolateElement)( 13115 (0, import_i18n2.sprintf)( 13116 /* 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". */ 13117 (0, import_i18n2.__)( 13118 "<Name>%1$s between (inc): </Name><Value>%2$s and %3$s</Value>" 13119 ), 13120 filter.name, 13121 activeElements[0].label[0], 13122 activeElements[0].label[1] 13123 ), 13124 filterTextWrappers 13125 ), 13126 filter(item, field, filterValue) { 13127 if (!Array.isArray(filterValue) || filterValue.length !== 2 || filterValue[0] === void 0 || filterValue[1] === void 0) { 13128 return true; 13129 } 13130 const fieldValue = field.getValue({ item }); 13131 if (typeof fieldValue === "number" || fieldValue instanceof Date || typeof fieldValue === "string") { 13132 return fieldValue >= filterValue[0] && fieldValue <= filterValue[1]; 13133 } 13134 return false; 13135 }, 13136 selection: "custom" 13137 }, 13138 { 13139 name: OPERATOR_IN_THE_PAST, 13140 /* translators: DataViews operator name */ 13141 label: (0, import_i18n2.__)("In the past"), 13142 filterText: (filter, activeElements) => (0, import_element33.createInterpolateElement)( 13143 (0, import_i18n2.sprintf)( 13144 /* translators: 1: Filter name (e.g. "Date"). 2: Filter value (e.g. "7 days"): "Date is in the past: 7 days". */ 13145 (0, import_i18n2.__)( 13146 "<Name>%1$s is in the past: </Name><Value>%2$s</Value>" 13147 ), 13148 filter.name, 13149 `$activeElements[0].value.value} $activeElements[0].value.unit}` 13150 ), 13151 filterTextWrappers 13152 ), 13153 filter(item, field, filterValue) { 13154 if (filterValue?.value === void 0 || filterValue?.unit === void 0) { 13155 return true; 13156 } 13157 const targetDate = getRelativeDate( 13158 filterValue.value, 13159 filterValue.unit 13160 ); 13161 const fieldValue = (0, import_date.getDate)(field.getValue({ item })); 13162 return fieldValue >= targetDate && fieldValue <= /* @__PURE__ */ new Date(); 13163 }, 13164 selection: "custom" 13165 }, 13166 { 13167 name: OPERATOR_OVER, 13168 /* translators: DataViews operator name */ 13169 label: (0, import_i18n2.__)("Over"), 13170 filterText: (filter, activeElements) => (0, import_element33.createInterpolateElement)( 13171 (0, import_i18n2.sprintf)( 13172 /* translators: 1: Filter name (e.g. "Date"). 2: Filter value (e.g. "7 days"): "Date is over: 7 days". */ 13173 (0, import_i18n2.__)("<Name>%1$s is over: </Name><Value>%2$s</Value>"), 13174 filter.name, 13175 `$activeElements[0].value.value} $activeElements[0].value.unit}` 13176 ), 13177 filterTextWrappers 13178 ), 13179 filter(item, field, filterValue) { 13180 if (filterValue?.value === void 0 || filterValue?.unit === void 0) { 13181 return true; 13182 } 13183 const targetDate = getRelativeDate( 13184 filterValue.value, 13185 filterValue.unit 13186 ); 13187 const fieldValue = (0, import_date.getDate)(field.getValue({ item })); 13188 return fieldValue < targetDate; 13189 }, 13190 selection: "custom" 13191 }, 13192 { 13193 name: OPERATOR_IS, 13194 /* translators: DataViews operator name */ 13195 label: (0, import_i18n2.__)("Is"), 13196 filterText: (filter, activeElements) => (0, import_element33.createInterpolateElement)( 13197 (0, import_i18n2.sprintf)( 13198 /* translators: 1: Filter name (e.g. "Author"). 2: Filter value (e.g. "Admin"): "Author is: Admin". */ 13199 (0, import_i18n2.__)("<Name>%1$s is: </Name><Value>%2$s</Value>"), 13200 filter.name, 13201 activeElements[0].label 13202 ), 13203 filterTextWrappers 13204 ), 13205 filter(item, field, filterValue) { 13206 return filterValue === field.getValue({ item }) || filterValue === void 0; 13207 }, 13208 selection: "single" 13209 }, 13210 { 13211 name: OPERATOR_IS_NOT, 13212 /* translators: DataViews operator name */ 13213 label: (0, import_i18n2.__)("Is not"), 13214 filterText: (filter, activeElements) => (0, import_element33.createInterpolateElement)( 13215 (0, import_i18n2.sprintf)( 13216 /* translators: 1: Filter name (e.g. "Author"). 2: Filter value (e.g. "Admin"): "Author is not: Admin". */ 13217 (0, import_i18n2.__)("<Name>%1$s is not: </Name><Value>%2$s</Value>"), 13218 filter.name, 13219 activeElements[0].label 13220 ), 13221 filterTextWrappers 13222 ), 13223 filter(item, field, filterValue) { 13224 return filterValue !== field.getValue({ item }); 13225 }, 13226 selection: "single" 13227 }, 13228 { 13229 name: OPERATOR_LESS_THAN, 13230 /* translators: DataViews operator name */ 13231 label: (0, import_i18n2.__)("Less than"), 13232 filterText: (filter, activeElements) => (0, import_element33.createInterpolateElement)( 13233 (0, import_i18n2.sprintf)( 13234 /* translators: 1: Filter name (e.g. "Count"). 2: Filter value (e.g. "10"): "Count is less than: 10". */ 13235 (0, import_i18n2.__)("<Name>%1$s is less than: </Name><Value>%2$s</Value>"), 13236 filter.name, 13237 activeElements[0].label 13238 ), 13239 filterTextWrappers 13240 ), 13241 filter(item, field, filterValue) { 13242 if (filterValue === void 0) { 13243 return true; 13244 } 13245 const fieldValue = field.getValue({ item }); 13246 return fieldValue < filterValue; 13247 }, 13248 selection: "single" 13249 }, 13250 { 13251 name: OPERATOR_GREATER_THAN, 13252 /* translators: DataViews operator name */ 13253 label: (0, import_i18n2.__)("Greater than"), 13254 filterText: (filter, activeElements) => (0, import_element33.createInterpolateElement)( 13255 (0, import_i18n2.sprintf)( 13256 /* translators: 1: Filter name (e.g. "Count"). 2: Filter value (e.g. "10"): "Count is greater than: 10". */ 13257 (0, import_i18n2.__)( 13258 "<Name>%1$s is greater than: </Name><Value>%2$s</Value>" 13259 ), 13260 filter.name, 13261 activeElements[0].label 13262 ), 13263 filterTextWrappers 13264 ), 13265 filter(item, field, filterValue) { 13266 if (filterValue === void 0) { 13267 return true; 13268 } 13269 const fieldValue = field.getValue({ item }); 13270 return fieldValue > filterValue; 13271 }, 13272 selection: "single" 13273 }, 13274 { 13275 name: OPERATOR_LESS_THAN_OR_EQUAL, 13276 /* translators: DataViews operator name */ 13277 label: (0, import_i18n2.__)("Less than or equal"), 13278 filterText: (filter, activeElements) => (0, import_element33.createInterpolateElement)( 13279 (0, import_i18n2.sprintf)( 13280 /* translators: 1: Filter name (e.g. "Count"). 2: Filter value (e.g. "10"): "Count is less than or equal to: 10". */ 13281 (0, import_i18n2.__)( 13282 "<Name>%1$s is less than or equal to: </Name><Value>%2$s</Value>" 13283 ), 13284 filter.name, 13285 activeElements[0].label 13286 ), 13287 filterTextWrappers 13288 ), 13289 filter(item, field, filterValue) { 13290 if (filterValue === void 0) { 13291 return true; 13292 } 13293 const fieldValue = field.getValue({ item }); 13294 return fieldValue <= filterValue; 13295 }, 13296 selection: "single" 13297 }, 13298 { 13299 name: OPERATOR_GREATER_THAN_OR_EQUAL, 13300 /* translators: DataViews operator name */ 13301 label: (0, import_i18n2.__)("Greater than or equal"), 13302 filterText: (filter, activeElements) => (0, import_element33.createInterpolateElement)( 13303 (0, import_i18n2.sprintf)( 13304 /* translators: 1: Filter name (e.g. "Count"). 2: Filter value (e.g. "10"): "Count is greater than or equal to: 10". */ 13305 (0, import_i18n2.__)( 13306 "<Name>%1$s is greater than or equal to: </Name><Value>%2$s</Value>" 13307 ), 13308 filter.name, 13309 activeElements[0].label 13310 ), 13311 filterTextWrappers 13312 ), 13313 filter(item, field, filterValue) { 13314 if (filterValue === void 0) { 13315 return true; 13316 } 13317 const fieldValue = field.getValue({ item }); 13318 return fieldValue >= filterValue; 13319 }, 13320 selection: "single" 13321 }, 13322 { 13323 name: OPERATOR_BEFORE, 13324 /* translators: DataViews operator name */ 13325 label: (0, import_i18n2.__)("Before"), 13326 filterText: (filter, activeElements) => (0, import_element33.createInterpolateElement)( 13327 (0, import_i18n2.sprintf)( 13328 /* translators: 1: Filter name (e.g. "Date"). 2: Filter value (e.g. "2024-01-01"): "Date is before: 2024-01-01". */ 13329 (0, import_i18n2.__)("<Name>%1$s is before: </Name><Value>%2$s</Value>"), 13330 filter.name, 13331 activeElements[0].label 13332 ), 13333 filterTextWrappers 13334 ), 13335 filter(item, field, filterValue) { 13336 if (filterValue === void 0) { 13337 return true; 13338 } 13339 const filterDate = (0, import_date.getDate)(filterValue); 13340 const fieldDate = (0, import_date.getDate)(field.getValue({ item })); 13341 return fieldDate < filterDate; 13342 }, 13343 selection: "single" 13344 }, 13345 { 13346 name: OPERATOR_AFTER, 13347 /* translators: DataViews operator name */ 13348 label: (0, import_i18n2.__)("After"), 13349 filterText: (filter, activeElements) => (0, import_element33.createInterpolateElement)( 13350 (0, import_i18n2.sprintf)( 13351 /* translators: 1: Filter name (e.g. "Date"). 2: Filter value (e.g. "2024-01-01"): "Date is after: 2024-01-01". */ 13352 (0, import_i18n2.__)("<Name>%1$s is after: </Name><Value>%2$s</Value>"), 13353 filter.name, 13354 activeElements[0].label 13355 ), 13356 filterTextWrappers 13357 ), 13358 filter(item, field, filterValue) { 13359 if (filterValue === void 0) { 13360 return true; 13361 } 13362 const filterDate = (0, import_date.getDate)(filterValue); 13363 const fieldDate = (0, import_date.getDate)(field.getValue({ item })); 13364 return fieldDate > filterDate; 13365 }, 13366 selection: "single" 13367 }, 13368 { 13369 name: OPERATOR_BEFORE_INC, 13370 /* translators: DataViews operator name */ 13371 label: (0, import_i18n2.__)("Before (inc)"), 13372 filterText: (filter, activeElements) => (0, import_element33.createInterpolateElement)( 13373 (0, import_i18n2.sprintf)( 13374 /* translators: 1: Filter name (e.g. "Date"). 2: Filter value (e.g. "2024-01-01"): "Date is on or before: 2024-01-01". */ 13375 (0, import_i18n2.__)( 13376 "<Name>%1$s is on or before: </Name><Value>%2$s</Value>" 13377 ), 13378 filter.name, 13379 activeElements[0].label 13380 ), 13381 filterTextWrappers 13382 ), 13383 filter(item, field, filterValue) { 13384 if (filterValue === void 0) { 13385 return true; 13386 } 13387 const filterDate = (0, import_date.getDate)(filterValue); 13388 const fieldDate = (0, import_date.getDate)(field.getValue({ item })); 13389 return fieldDate <= filterDate; 13390 }, 13391 selection: "single" 13392 }, 13393 { 13394 name: OPERATOR_AFTER_INC, 13395 /* translators: DataViews operator name */ 13396 label: (0, import_i18n2.__)("After (inc)"), 13397 filterText: (filter, activeElements) => (0, import_element33.createInterpolateElement)( 13398 (0, import_i18n2.sprintf)( 13399 /* translators: 1: Filter name (e.g. "Date"). 2: Filter value (e.g. "2024-01-01"): "Date is on or after: 2024-01-01". */ 13400 (0, import_i18n2.__)( 13401 "<Name>%1$s is on or after: </Name><Value>%2$s</Value>" 13402 ), 13403 filter.name, 13404 activeElements[0].label 13405 ), 13406 filterTextWrappers 13407 ), 13408 filter(item, field, filterValue) { 13409 if (filterValue === void 0) { 13410 return true; 13411 } 13412 const filterDate = (0, import_date.getDate)(filterValue); 13413 const fieldDate = (0, import_date.getDate)(field.getValue({ item })); 13414 return fieldDate >= filterDate; 13415 }, 13416 selection: "single" 13417 }, 13418 { 13419 name: OPERATOR_CONTAINS, 13420 /* translators: DataViews operator name */ 13421 label: (0, import_i18n2.__)("Contains"), 13422 filterText: (filter, activeElements) => (0, import_element33.createInterpolateElement)( 13423 (0, import_i18n2.sprintf)( 13424 /* translators: 1: Filter name (e.g. "Title"). 2: Filter value (e.g. "Hello"): "Title contains: Hello". */ 13425 (0, import_i18n2.__)("<Name>%1$s contains: </Name><Value>%2$s</Value>"), 13426 filter.name, 13427 activeElements[0].label 13428 ), 13429 filterTextWrappers 13430 ), 13431 filter(item, field, filterValue) { 13432 if (filterValue === void 0) { 13433 return true; 13434 } 13435 const fieldValue = field.getValue({ item }); 13436 return typeof fieldValue === "string" && filterValue && fieldValue.toLowerCase().includes(String(filterValue).toLowerCase()); 13437 }, 13438 selection: "single" 13439 }, 13440 { 13441 name: OPERATOR_NOT_CONTAINS, 13442 /* translators: DataViews operator name */ 13443 label: (0, import_i18n2.__)("Doesn't contain"), 13444 filterText: (filter, activeElements) => (0, import_element33.createInterpolateElement)( 13445 (0, import_i18n2.sprintf)( 13446 /* translators: 1: Filter name (e.g. "Title"). 2: Filter value (e.g. "Hello"): "Title doesn't contain: Hello". */ 13447 (0, import_i18n2.__)( 13448 "<Name>%1$s doesn't contain: </Name><Value>%2$s</Value>" 13449 ), 13450 filter.name, 13451 activeElements[0].label 13452 ), 13453 filterTextWrappers 13454 ), 13455 filter(item, field, filterValue) { 13456 if (filterValue === void 0) { 13457 return true; 13458 } 13459 const fieldValue = field.getValue({ item }); 13460 return typeof fieldValue === "string" && filterValue && !fieldValue.toLowerCase().includes(String(filterValue).toLowerCase()); 13461 }, 13462 selection: "single" 13463 }, 13464 { 13465 name: OPERATOR_STARTS_WITH, 13466 /* translators: DataViews operator name */ 13467 label: (0, import_i18n2.__)("Starts with"), 13468 filterText: (filter, activeElements) => (0, import_element33.createInterpolateElement)( 13469 (0, import_i18n2.sprintf)( 13470 /* translators: 1: Filter name (e.g. "Title"). 2: Filter value (e.g. "Hello"): "Title starts with: Hello". */ 13471 (0, import_i18n2.__)("<Name>%1$s starts with: </Name><Value>%2$s</Value>"), 13472 filter.name, 13473 activeElements[0].label 13474 ), 13475 filterTextWrappers 13476 ), 13477 filter(item, field, filterValue) { 13478 if (filterValue === void 0) { 13479 return true; 13480 } 13481 const fieldValue = field.getValue({ item }); 13482 return typeof fieldValue === "string" && filterValue && fieldValue.toLowerCase().startsWith(String(filterValue).toLowerCase()); 13483 }, 13484 selection: "single" 13485 }, 13486 { 13487 name: OPERATOR_ON, 13488 /* translators: DataViews operator name */ 13489 label: (0, import_i18n2.__)("On"), 13490 filterText: (filter, activeElements) => (0, import_element33.createInterpolateElement)( 13491 (0, import_i18n2.sprintf)( 13492 /* translators: 1: Filter name (e.g. "Date"). 2: Filter value (e.g. "2024-01-01"): "Date is: 2024-01-01". */ 13493 (0, import_i18n2.__)("<Name>%1$s is: </Name><Value>%2$s</Value>"), 13494 filter.name, 13495 activeElements[0].label 13496 ), 13497 filterTextWrappers 13498 ), 13499 filter(item, field, filterValue) { 13500 if (filterValue === void 0) { 13501 return true; 13502 } 13503 const filterDate = (0, import_date.getDate)(filterValue); 13504 const fieldDate = (0, import_date.getDate)(field.getValue({ item })); 13505 return filterDate.getTime() === fieldDate.getTime(); 13506 }, 13507 selection: "single" 13508 }, 13509 { 13510 name: OPERATOR_NOT_ON, 13511 /* translators: DataViews operator name */ 13512 label: (0, import_i18n2.__)("Not on"), 13513 filterText: (filter, activeElements) => (0, import_element33.createInterpolateElement)( 13514 (0, import_i18n2.sprintf)( 13515 /* translators: 1: Filter name (e.g. "Date"). 2: Filter value (e.g. "2024-01-01"): "Date is not: 2024-01-01". */ 13516 (0, import_i18n2.__)("<Name>%1$s is not: </Name><Value>%2$s</Value>"), 13517 filter.name, 13518 activeElements[0].label 13519 ), 13520 filterTextWrappers 13521 ), 13522 filter(item, field, filterValue) { 13523 if (filterValue === void 0) { 13524 return true; 13525 } 13526 const filterDate = (0, import_date.getDate)(filterValue); 13527 const fieldDate = (0, import_date.getDate)(field.getValue({ item })); 13528 return filterDate.getTime() !== fieldDate.getTime(); 13529 }, 13530 selection: "single" 13531 } 13532 ]; 13533 var getOperatorByName = (name) => OPERATORS.find((op) => op.name === name); 13534 var getAllOperatorNames = () => OPERATORS.map((op) => op.name); 13535 13536 // packages/dataviews/build-module/components/dataform-controls/checkbox.mjs 13537 var import_components2 = __toESM(require_components(), 1); 13538 var import_element34 = __toESM(require_element(), 1); 13539 13540 // packages/dataviews/build-module/components/dataform-controls/utils/get-custom-validity.mjs 13541 function getCustomValidity(isValid2, validity) { 13542 let customValidity; 13543 if (isValid2?.required && validity?.required) { 13544 customValidity = validity?.required?.message ? validity.required : void 0; 13545 } else if (isValid2?.pattern && validity?.pattern) { 13546 customValidity = validity.pattern; 13547 } else if (isValid2?.min && validity?.min) { 13548 customValidity = validity.min; 13549 } else if (isValid2?.max && validity?.max) { 13550 customValidity = validity.max; 13551 } else if (isValid2?.minLength && validity?.minLength) { 13552 customValidity = validity.minLength; 13553 } else if (isValid2?.maxLength && validity?.maxLength) { 13554 customValidity = validity.maxLength; 13555 } else if (isValid2?.elements && validity?.elements) { 13556 customValidity = validity.elements; 13557 } else if (validity?.custom) { 13558 customValidity = validity.custom; 13559 } 13560 return customValidity; 13561 } 13562 13563 // packages/dataviews/build-module/components/dataform-controls/checkbox.mjs 13564 var import_jsx_runtime41 = __toESM(require_jsx_runtime(), 1); 13565 var { ValidatedCheckboxControl } = unlock2(import_components2.privateApis); 13566 function Checkbox({ 13567 field, 13568 onChange, 13569 data, 13570 hideLabelFromVision, 13571 markWhenOptional, 13572 validity 13573 }) { 13574 const { getValue, setValue, label, description, isValid: isValid2 } = field; 13575 const disabled2 = field.isDisabled({ item: data, field }); 13576 const onChangeControl = (0, import_element34.useCallback)(() => { 13577 onChange( 13578 setValue({ item: data, value: !getValue({ item: data }) }) 13579 ); 13580 }, [data, getValue, onChange, setValue]); 13581 return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)( 13582 ValidatedCheckboxControl, 13583 { 13584 required: !!field.isValid?.required, 13585 markWhenOptional, 13586 customValidity: getCustomValidity(isValid2, validity), 13587 hidden: hideLabelFromVision, 13588 label, 13589 help: description, 13590 checked: getValue({ item: data }), 13591 onChange: onChangeControl, 13592 disabled: disabled2 13593 } 13594 ); 13595 } 13596 13597 // packages/dataviews/build-module/components/dataform-controls/combobox.mjs 13598 var import_components3 = __toESM(require_components(), 1); 13599 var import_element35 = __toESM(require_element(), 1); 13600 var import_jsx_runtime42 = __toESM(require_jsx_runtime(), 1); 13601 var { ValidatedComboboxControl } = unlock2(import_components3.privateApis); 13602 function Combobox({ 13603 data, 13604 field, 13605 onChange, 13606 hideLabelFromVision, 13607 validity 13608 }) { 13609 const { label, description, placeholder, getValue, setValue, isValid: isValid2 } = field; 13610 const value = getValue({ item: data }) ?? ""; 13611 const onChangeControl = (0, import_element35.useCallback)( 13612 (newValue) => onChange(setValue({ item: data, value: newValue ?? "" })), 13613 [data, onChange, setValue] 13614 ); 13615 const { elements, isLoading } = useElements({ 13616 elements: field.elements, 13617 getElements: field.getElements 13618 }); 13619 if (isLoading) { 13620 return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_components3.Spinner, {}); 13621 } 13622 return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)( 13623 ValidatedComboboxControl, 13624 { 13625 required: !!field.isValid?.required, 13626 customValidity: getCustomValidity(isValid2, validity), 13627 label, 13628 value, 13629 help: description, 13630 placeholder, 13631 options: elements, 13632 onChange: onChangeControl, 13633 hideLabelFromVision, 13634 allowReset: true, 13635 expandOnFocus: true 13636 } 13637 ); 13638 } 13639 13640 // packages/dataviews/build-module/components/dataform-controls/datetime.mjs 13641 var import_components5 = __toESM(require_components(), 1); 13642 var import_element38 = __toESM(require_element(), 1); 13643 var import_i18n4 = __toESM(require_i18n(), 1); 13644 var import_date3 = __toESM(require_date(), 1); 13645 13646 // packages/dataviews/build-module/components/dataform-controls/utils/relative-date-control.mjs 13647 var import_components4 = __toESM(require_components(), 1); 13648 var import_element36 = __toESM(require_element(), 1); 13649 var import_i18n3 = __toESM(require_i18n(), 1); 13650 var import_jsx_runtime43 = __toESM(require_jsx_runtime(), 1); 13651 var TIME_UNITS_OPTIONS = { 13652 [OPERATOR_IN_THE_PAST]: [ 13653 { value: "days", label: (0, import_i18n3.__)("Days") }, 13654 { value: "weeks", label: (0, import_i18n3.__)("Weeks") }, 13655 { value: "months", label: (0, import_i18n3.__)("Months") }, 13656 { value: "years", label: (0, import_i18n3.__)("Years") } 13657 ], 13658 [OPERATOR_OVER]: [ 13659 { value: "days", label: (0, import_i18n3.__)("Days ago") }, 13660 { value: "weeks", label: (0, import_i18n3.__)("Weeks ago") }, 13661 { value: "months", label: (0, import_i18n3.__)("Months ago") }, 13662 { value: "years", label: (0, import_i18n3.__)("Years ago") } 13663 ] 13664 }; 13665 function RelativeDateControl({ 13666 className, 13667 data, 13668 field, 13669 onChange, 13670 hideLabelFromVision, 13671 operator 13672 }) { 13673 const options = TIME_UNITS_OPTIONS[operator === OPERATOR_IN_THE_PAST ? "inThePast" : "over"]; 13674 const { id, label, description, getValue, setValue } = field; 13675 const disabled2 = field.isDisabled({ item: data, field }); 13676 const fieldValue = getValue({ item: data }); 13677 const { value: relValue = "", unit = options[0].value } = fieldValue && typeof fieldValue === "object" ? fieldValue : {}; 13678 const onChangeValue = (0, import_element36.useCallback)( 13679 (newValue) => onChange( 13680 setValue({ 13681 item: data, 13682 value: { value: Number(newValue), unit } 13683 }) 13684 ), 13685 [onChange, setValue, data, unit] 13686 ); 13687 const onChangeUnit = (0, import_element36.useCallback)( 13688 (newUnit) => onChange( 13689 setValue({ 13690 item: data, 13691 value: { value: relValue, unit: newUnit } 13692 }) 13693 ), 13694 [onChange, setValue, data, relValue] 13695 ); 13696 return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)( 13697 import_components4.BaseControl, 13698 { 13699 id, 13700 className: clsx_default(className, "dataviews-controls__relative-date"), 13701 label, 13702 hideLabelFromVision, 13703 help: description, 13704 children: /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(Stack, { direction: "row", gap: "sm", children: [ 13705 /* @__PURE__ */ (0, import_jsx_runtime43.jsx)( 13706 import_components4.__experimentalNumberControl, 13707 { 13708 __next40pxDefaultSize: true, 13709 className: "dataviews-controls__relative-date-number", 13710 spinControls: "none", 13711 min: 1, 13712 step: 1, 13713 value: relValue, 13714 onChange: onChangeValue, 13715 disabled: disabled2 13716 } 13717 ), 13718 /* @__PURE__ */ (0, import_jsx_runtime43.jsx)( 13719 import_components4.SelectControl, 13720 { 13721 className: "dataviews-controls__relative-date-unit", 13722 __next40pxDefaultSize: true, 13723 label: (0, import_i18n3.__)("Unit"), 13724 value: unit, 13725 options, 13726 onChange: onChangeUnit, 13727 hideLabelFromVision: true, 13728 disabled: disabled2 13729 } 13730 ) 13731 ] }) 13732 } 13733 ); 13734 } 13735 13736 // packages/dataviews/build-module/components/dataform-controls/utils/use-disabled-date-matchers.mjs 13737 var import_element37 = __toESM(require_element(), 1); 13738 function useDisabledDateMatchers(isValid2, parseDateFn) { 13739 const minConstraint = typeof isValid2.min?.constraint === "string" ? isValid2.min.constraint : void 0; 13740 const maxConstraint = typeof isValid2.max?.constraint === "string" ? isValid2.max.constraint : void 0; 13741 const disabledMatchers = (0, import_element37.useMemo)(() => { 13742 const matchers = []; 13743 if (minConstraint) { 13744 const minDate = parseDateFn(minConstraint); 13745 if (minDate) { 13746 matchers.push({ before: minDate }); 13747 } 13748 } 13749 if (maxConstraint) { 13750 const maxDate = parseDateFn(maxConstraint); 13751 if (maxDate) { 13752 matchers.push({ after: maxDate }); 13753 } 13754 } 13755 return matchers.length > 0 ? matchers : void 0; 13756 }, [minConstraint, maxConstraint, parseDateFn]); 13757 return { minConstraint, maxConstraint, disabledMatchers }; 13758 } 13759 13760 // packages/dataviews/build-module/field-types/utils/parse-date-time.mjs 13761 var import_date2 = __toESM(require_date(), 1); 13762 function parseDateTime(dateTimeString) { 13763 if (!dateTimeString) { 13764 return null; 13765 } 13766 const parsed = (0, import_date2.getDate)(dateTimeString); 13767 return parsed && isValid(parsed) ? parsed : null; 13768 } 13769 13770 // packages/dataviews/build-module/components/dataform-controls/datetime.mjs 13771 var import_jsx_runtime44 = __toESM(require_jsx_runtime(), 1); 13772 var { DateCalendar, ValidatedInputControl } = unlock2(import_components5.privateApis); 13773 var formatDateTime = (value) => { 13774 if (!value) { 13775 return ""; 13776 } 13777 return (0, import_date3.dateI18n)("Y-m-d\\TH:i", (0, import_date3.getDate)(value)); 13778 }; 13779 function CalendarDateTimeControl({ 13780 data, 13781 field, 13782 onChange, 13783 hideLabelFromVision, 13784 markWhenOptional, 13785 validity, 13786 config 13787 }) { 13788 const { compact } = config || {}; 13789 const { id, label, description, setValue, getValue, isValid: isValid2 } = field; 13790 const disabled2 = field.isDisabled({ item: data, field }); 13791 const fieldValue = getValue({ item: data }); 13792 const value = typeof fieldValue === "string" ? fieldValue : void 0; 13793 const [calendarMonth, setCalendarMonth] = (0, import_element38.useState)(() => { 13794 const parsedDate = parseDateTime(value); 13795 return parsedDate || /* @__PURE__ */ new Date(); 13796 }); 13797 const inputControlRef = (0, import_element38.useRef)(null); 13798 const validationTimeoutRef = (0, import_element38.useRef)(void 0); 13799 const previousFocusRef = (0, import_element38.useRef)(null); 13800 const { minConstraint, maxConstraint, disabledMatchers } = useDisabledDateMatchers(isValid2, parseDateTime); 13801 const onChangeCallback = (0, import_element38.useCallback)( 13802 (newValue) => onChange(setValue({ item: data, value: newValue })), 13803 [data, onChange, setValue] 13804 ); 13805 (0, import_element38.useEffect)(() => { 13806 return () => { 13807 if (validationTimeoutRef.current) { 13808 clearTimeout(validationTimeoutRef.current); 13809 } 13810 }; 13811 }, []); 13812 const onSelectDate = (0, import_element38.useCallback)( 13813 (newDate) => { 13814 let dateTimeValue; 13815 if (newDate) { 13816 const wpDate = (0, import_date3.dateI18n)("Y-m-d", newDate); 13817 let wpTime; 13818 if (value) { 13819 wpTime = (0, import_date3.dateI18n)("H:i", (0, import_date3.getDate)(value)); 13820 } else { 13821 wpTime = (0, import_date3.dateI18n)("H:i", newDate); 13822 } 13823 const finalDateTime = (0, import_date3.getDate)(`$wpDate}T$wpTime}`); 13824 dateTimeValue = finalDateTime.toISOString(); 13825 onChangeCallback(dateTimeValue); 13826 if (validationTimeoutRef.current) { 13827 clearTimeout(validationTimeoutRef.current); 13828 } 13829 } else { 13830 onChangeCallback(void 0); 13831 } 13832 previousFocusRef.current = inputControlRef.current && inputControlRef.current.ownerDocument.activeElement; 13833 validationTimeoutRef.current = setTimeout(() => { 13834 if (inputControlRef.current) { 13835 inputControlRef.current.focus(); 13836 inputControlRef.current.blur(); 13837 onChangeCallback(dateTimeValue); 13838 if (previousFocusRef.current && previousFocusRef.current instanceof HTMLElement) { 13839 previousFocusRef.current.focus(); 13840 } 13841 } 13842 }, 0); 13843 }, 13844 [onChangeCallback, value] 13845 ); 13846 const handleManualDateTimeChange = (0, import_element38.useCallback)( 13847 (newValue) => { 13848 if (newValue) { 13849 const dateTime = (0, import_date3.getDate)(newValue); 13850 onChangeCallback(dateTime.toISOString()); 13851 const parsedDate = parseDateTime(dateTime.toISOString()); 13852 if (parsedDate) { 13853 setCalendarMonth(parsedDate); 13854 } 13855 } else { 13856 onChangeCallback(void 0); 13857 } 13858 }, 13859 [onChangeCallback] 13860 ); 13861 const { format: fieldFormat } = field; 13862 const weekStartsOn = fieldFormat.weekStartsOn ?? (0, import_date3.getSettings)().l10n.startOfWeek; 13863 const { 13864 timezone: { string: timezoneString } 13865 } = (0, import_date3.getSettings)(); 13866 let displayLabel = label; 13867 if (isValid2?.required && !markWhenOptional && !hideLabelFromVision) { 13868 displayLabel = `$label} (${(0, import_i18n4.__)("Required")})`; 13869 } else if (!isValid2?.required && markWhenOptional && !hideLabelFromVision) { 13870 displayLabel = `$label} (${(0, import_i18n4.__)("Optional")})`; 13871 } 13872 return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)( 13873 import_components5.BaseControl, 13874 { 13875 id, 13876 label: displayLabel, 13877 help: description, 13878 hideLabelFromVision, 13879 children: /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(Stack, { direction: "column", gap: "lg", children: [ 13880 /* @__PURE__ */ (0, import_jsx_runtime44.jsx)( 13881 ValidatedInputControl, 13882 { 13883 ref: inputControlRef, 13884 __next40pxDefaultSize: true, 13885 required: !!isValid2?.required, 13886 customValidity: getCustomValidity(isValid2, validity), 13887 type: "datetime-local", 13888 label: (0, import_i18n4.__)("Date time"), 13889 hideLabelFromVision: true, 13890 value: formatDateTime(value), 13891 onChange: handleManualDateTimeChange, 13892 disabled: disabled2, 13893 min: minConstraint ? formatDateTime(minConstraint) : void 0, 13894 max: maxConstraint ? formatDateTime(maxConstraint) : void 0 13895 } 13896 ), 13897 !compact && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)( 13898 DateCalendar, 13899 { 13900 style: { width: "100%" }, 13901 selected: value ? parseDateTime(value) || void 0 : void 0, 13902 onSelect: onSelectDate, 13903 month: calendarMonth, 13904 onMonthChange: setCalendarMonth, 13905 timeZone: timezoneString || void 0, 13906 weekStartsOn, 13907 disabled: disabled2 || disabledMatchers 13908 } 13909 ) 13910 ] }) 13911 } 13912 ); 13913 } 13914 function DateTime({ 13915 data, 13916 field, 13917 onChange, 13918 hideLabelFromVision, 13919 markWhenOptional, 13920 operator, 13921 validity, 13922 config 13923 }) { 13924 if (operator === OPERATOR_IN_THE_PAST || operator === OPERATOR_OVER) { 13925 return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)( 13926 RelativeDateControl, 13927 { 13928 className: "dataviews-controls__datetime", 13929 data, 13930 field, 13931 onChange, 13932 hideLabelFromVision, 13933 operator 13934 } 13935 ); 13936 } 13937 return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)( 13938 CalendarDateTimeControl, 13939 { 13940 data, 13941 field, 13942 onChange, 13943 hideLabelFromVision, 13944 markWhenOptional, 13945 validity, 13946 config 13947 } 13948 ); 13949 } 13950 13951 // packages/dataviews/build-module/components/dataform-controls/date.mjs 13952 var import_components6 = __toESM(require_components(), 1); 13953 var import_element39 = __toESM(require_element(), 1); 13954 var import_i18n5 = __toESM(require_i18n(), 1); 13955 var import_date4 = __toESM(require_date(), 1); 13956 var import_jsx_runtime45 = __toESM(require_jsx_runtime(), 1); 13957 var { DateCalendar: DateCalendar2, DateRangeCalendar } = unlock2(import_components6.privateApis); 13958 var DATE_PRESETS = [ 13959 { 13960 id: "today", 13961 label: (0, import_i18n5.__)("Today"), 13962 getValue: () => (0, import_date4.getDate)(null) 13963 }, 13964 { 13965 id: "yesterday", 13966 label: (0, import_i18n5.__)("Yesterday"), 13967 getValue: () => { 13968 const today = (0, import_date4.getDate)(null); 13969 return subDays(today, 1); 13970 } 13971 }, 13972 { 13973 id: "past-week", 13974 label: (0, import_i18n5.__)("Past week"), 13975 getValue: () => { 13976 const today = (0, import_date4.getDate)(null); 13977 return subDays(today, 7); 13978 } 13979 }, 13980 { 13981 id: "past-month", 13982 label: (0, import_i18n5.__)("Past month"), 13983 getValue: () => { 13984 const today = (0, import_date4.getDate)(null); 13985 return subMonths(today, 1); 13986 } 13987 } 13988 ]; 13989 var DATE_RANGE_PRESETS = [ 13990 { 13991 id: "last-7-days", 13992 label: (0, import_i18n5.__)("Last 7 days"), 13993 getValue: () => { 13994 const today = (0, import_date4.getDate)(null); 13995 return [subDays(today, 7), today]; 13996 } 13997 }, 13998 { 13999 id: "last-30-days", 14000 label: (0, import_i18n5.__)("Last 30 days"), 14001 getValue: () => { 14002 const today = (0, import_date4.getDate)(null); 14003 return [subDays(today, 30), today]; 14004 } 14005 }, 14006 { 14007 id: "month-to-date", 14008 label: (0, import_i18n5.__)("Month to date"), 14009 getValue: () => { 14010 const today = (0, import_date4.getDate)(null); 14011 return [startOfMonth(today), today]; 14012 } 14013 }, 14014 { 14015 id: "last-year", 14016 label: (0, import_i18n5.__)("Last year"), 14017 getValue: () => { 14018 const today = (0, import_date4.getDate)(null); 14019 return [subYears(today, 1), today]; 14020 } 14021 }, 14022 { 14023 id: "year-to-date", 14024 label: (0, import_i18n5.__)("Year to date"), 14025 getValue: () => { 14026 const today = (0, import_date4.getDate)(null); 14027 return [startOfYear(today), today]; 14028 } 14029 } 14030 ]; 14031 var parseDate = (dateString) => { 14032 if (!dateString) { 14033 return null; 14034 } 14035 const parsed = (0, import_date4.getDate)(dateString); 14036 return parsed && isValid(parsed) ? parsed : null; 14037 }; 14038 var formatDate = (date) => { 14039 if (!date) { 14040 return ""; 14041 } 14042 return typeof date === "string" ? date : format(date, "yyyy-MM-dd"); 14043 }; 14044 function ValidatedDateControl({ 14045 field, 14046 validity, 14047 inputRefs, 14048 isTouched, 14049 setIsTouched, 14050 children 14051 }) { 14052 const { isValid: isValid2 } = field; 14053 const [customValidity, setCustomValidity] = (0, import_element39.useState)(void 0); 14054 const validateRefs = (0, import_element39.useCallback)(() => { 14055 const refs = Array.isArray(inputRefs) ? inputRefs : [inputRefs]; 14056 for (const ref of refs) { 14057 const input = ref.current; 14058 if (input && !input.validity.valid) { 14059 setCustomValidity({ 14060 type: "invalid", 14061 message: input.validationMessage 14062 }); 14063 return; 14064 } 14065 } 14066 setCustomValidity(void 0); 14067 }, [inputRefs]); 14068 (0, import_element39.useEffect)(() => { 14069 const refs = Array.isArray(inputRefs) ? inputRefs : [inputRefs]; 14070 const result = validity ? getCustomValidity(isValid2, validity) : void 0; 14071 for (const ref of refs) { 14072 const input = ref.current; 14073 if (input) { 14074 input.setCustomValidity( 14075 result?.type === "invalid" && result.message ? result.message : "" 14076 ); 14077 } 14078 } 14079 }, [inputRefs, isValid2, validity]); 14080 (0, import_element39.useEffect)(() => { 14081 const refs = Array.isArray(inputRefs) ? inputRefs : [inputRefs]; 14082 const handleInvalid = (event) => { 14083 event.preventDefault(); 14084 setIsTouched(true); 14085 }; 14086 for (const ref of refs) { 14087 ref.current?.addEventListener("invalid", handleInvalid); 14088 } 14089 return () => { 14090 for (const ref of refs) { 14091 ref.current?.removeEventListener("invalid", handleInvalid); 14092 } 14093 }; 14094 }, [inputRefs, setIsTouched]); 14095 (0, import_element39.useEffect)(() => { 14096 if (!isTouched) { 14097 return; 14098 } 14099 const result = validity ? getCustomValidity(isValid2, validity) : void 0; 14100 if (result) { 14101 setCustomValidity(result); 14102 } else { 14103 validateRefs(); 14104 } 14105 }, [isTouched, isValid2, validity, validateRefs]); 14106 const onBlur = (event) => { 14107 if (isTouched) { 14108 return; 14109 } 14110 if (!event.relatedTarget || !event.currentTarget.contains(event.relatedTarget)) { 14111 setIsTouched(true); 14112 } 14113 }; 14114 return /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { onBlur, children: [ 14115 children, 14116 /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("div", { "aria-live": "polite", children: customValidity && /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)( 14117 "p", 14118 { 14119 className: clsx_default( 14120 "components-validated-control__indicator", 14121 customValidity.type === "invalid" ? "is-invalid" : void 0 14122 ), 14123 children: [ 14124 /* @__PURE__ */ (0, import_jsx_runtime45.jsx)( 14125 import_components6.Icon, 14126 { 14127 className: "components-validated-control__indicator-icon", 14128 icon: error_default, 14129 size: 16, 14130 fill: "currentColor" 14131 } 14132 ), 14133 customValidity.message 14134 ] 14135 } 14136 ) }) 14137 ] }); 14138 } 14139 function CalendarDateControl({ 14140 data, 14141 field, 14142 onChange, 14143 hideLabelFromVision, 14144 markWhenOptional, 14145 validity 14146 }) { 14147 const { 14148 id, 14149 label, 14150 description, 14151 setValue, 14152 getValue, 14153 isValid: isValid2, 14154 format: fieldFormat 14155 } = field; 14156 const disabled2 = field.isDisabled({ item: data, field }); 14157 const [selectedPresetId, setSelectedPresetId] = (0, import_element39.useState)( 14158 null 14159 ); 14160 const weekStartsOn = fieldFormat.weekStartsOn ?? (0, import_date4.getSettings)().l10n.startOfWeek; 14161 const fieldValue = getValue({ item: data }); 14162 const value = typeof fieldValue === "string" ? fieldValue : void 0; 14163 const [calendarMonth, setCalendarMonth] = (0, import_element39.useState)(() => { 14164 const parsedDate = parseDate(value); 14165 return parsedDate || /* @__PURE__ */ new Date(); 14166 }); 14167 const [isTouched, setIsTouched] = (0, import_element39.useState)(false); 14168 const validityTargetRef = (0, import_element39.useRef)(null); 14169 const { minConstraint, maxConstraint, disabledMatchers } = useDisabledDateMatchers(isValid2, parseDate); 14170 const onChangeCallback = (0, import_element39.useCallback)( 14171 (newValue) => onChange(setValue({ item: data, value: newValue })), 14172 [data, onChange, setValue] 14173 ); 14174 const onSelectDate = (0, import_element39.useCallback)( 14175 (newDate) => { 14176 const dateValue = newDate ? format(newDate, "yyyy-MM-dd") : void 0; 14177 onChangeCallback(dateValue); 14178 setSelectedPresetId(null); 14179 setIsTouched(true); 14180 }, 14181 [onChangeCallback] 14182 ); 14183 const handlePresetClick = (0, import_element39.useCallback)( 14184 (preset) => { 14185 const presetDate = preset.getValue(); 14186 const dateValue = formatDate(presetDate); 14187 setCalendarMonth(presetDate); 14188 onChangeCallback(dateValue); 14189 setSelectedPresetId(preset.id); 14190 setIsTouched(true); 14191 }, 14192 [onChangeCallback] 14193 ); 14194 const handleManualDateChange = (0, import_element39.useCallback)( 14195 (newValue) => { 14196 onChangeCallback(newValue); 14197 if (newValue) { 14198 const parsedDate = parseDate(newValue); 14199 if (parsedDate) { 14200 setCalendarMonth(parsedDate); 14201 } 14202 } 14203 setSelectedPresetId(null); 14204 setIsTouched(true); 14205 }, 14206 [onChangeCallback] 14207 ); 14208 const { 14209 timezone: { string: timezoneString } 14210 } = (0, import_date4.getSettings)(); 14211 let displayLabel = label; 14212 if (isValid2?.required && !markWhenOptional) { 14213 displayLabel = `$label} (${(0, import_i18n5.__)("Required")})`; 14214 } else if (!isValid2?.required && markWhenOptional) { 14215 displayLabel = `$label} (${(0, import_i18n5.__)("Optional")})`; 14216 } 14217 return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)( 14218 ValidatedDateControl, 14219 { 14220 field, 14221 validity, 14222 inputRefs: validityTargetRef, 14223 isTouched, 14224 setIsTouched, 14225 children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)( 14226 import_components6.BaseControl, 14227 { 14228 id, 14229 className: "dataviews-controls__date", 14230 label: displayLabel, 14231 help: description, 14232 hideLabelFromVision, 14233 children: /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(Stack, { direction: "column", gap: "lg", children: [ 14234 /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)( 14235 Stack, 14236 { 14237 direction: "row", 14238 gap: "sm", 14239 wrap: "wrap", 14240 justify: "flex-start", 14241 children: [ 14242 DATE_PRESETS.map((preset) => { 14243 const isSelected = selectedPresetId === preset.id; 14244 return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)( 14245 import_components6.Button, 14246 { 14247 className: "dataviews-controls__date-preset", 14248 variant: "tertiary", 14249 isPressed: isSelected, 14250 size: "small", 14251 disabled: disabled2, 14252 accessibleWhenDisabled: true, 14253 onClick: () => handlePresetClick(preset), 14254 children: preset.label 14255 }, 14256 preset.id 14257 ); 14258 }), 14259 /* @__PURE__ */ (0, import_jsx_runtime45.jsx)( 14260 import_components6.Button, 14261 { 14262 className: "dataviews-controls__date-preset", 14263 variant: "tertiary", 14264 isPressed: !selectedPresetId, 14265 size: "small", 14266 disabled: !!selectedPresetId || disabled2, 14267 accessibleWhenDisabled: true, 14268 children: (0, import_i18n5.__)("Custom") 14269 } 14270 ) 14271 ] 14272 } 14273 ), 14274 /* @__PURE__ */ (0, import_jsx_runtime45.jsx)( 14275 import_components6.__experimentalInputControl, 14276 { 14277 __next40pxDefaultSize: true, 14278 ref: validityTargetRef, 14279 type: "date", 14280 label: (0, import_i18n5.__)("Date"), 14281 hideLabelFromVision: true, 14282 value, 14283 onChange: handleManualDateChange, 14284 required: !!field.isValid?.required, 14285 disabled: disabled2, 14286 min: minConstraint, 14287 max: maxConstraint 14288 } 14289 ), 14290 /* @__PURE__ */ (0, import_jsx_runtime45.jsx)( 14291 DateCalendar2, 14292 { 14293 style: { width: "100%" }, 14294 selected: value ? parseDate(value) || void 0 : void 0, 14295 onSelect: onSelectDate, 14296 month: calendarMonth, 14297 onMonthChange: setCalendarMonth, 14298 timeZone: timezoneString || void 0, 14299 weekStartsOn, 14300 disabled: disabled2 || disabledMatchers, 14301 disableNavigation: disabled2 14302 } 14303 ) 14304 ] }) 14305 } 14306 ) 14307 } 14308 ); 14309 } 14310 function CalendarDateRangeControl({ 14311 data, 14312 field, 14313 onChange, 14314 hideLabelFromVision, 14315 markWhenOptional, 14316 validity 14317 }) { 14318 const { 14319 id, 14320 label, 14321 description, 14322 getValue, 14323 setValue, 14324 isValid: isValid2, 14325 format: fieldFormat 14326 } = field; 14327 const disabled2 = field.isDisabled({ item: data, field }); 14328 let value; 14329 const fieldValue = getValue({ item: data }); 14330 if (Array.isArray(fieldValue) && fieldValue.length === 2 && fieldValue.every((date) => typeof date === "string")) { 14331 value = fieldValue; 14332 } 14333 const weekStartsOn = fieldFormat.weekStartsOn ?? (0, import_date4.getSettings)().l10n.startOfWeek; 14334 const { minConstraint, maxConstraint, disabledMatchers } = useDisabledDateMatchers(isValid2, parseDate); 14335 const onChangeCallback = (0, import_element39.useCallback)( 14336 (newValue) => { 14337 onChange( 14338 setValue({ 14339 item: data, 14340 value: newValue 14341 }) 14342 ); 14343 }, 14344 [data, onChange, setValue] 14345 ); 14346 const [selectedPresetId, setSelectedPresetId] = (0, import_element39.useState)( 14347 null 14348 ); 14349 const selectedRange = (0, import_element39.useMemo)(() => { 14350 if (!value) { 14351 return { from: void 0, to: void 0 }; 14352 } 14353 const [from, to] = value; 14354 return { 14355 from: parseDate(from) || void 0, 14356 to: parseDate(to) || void 0 14357 }; 14358 }, [value]); 14359 const [calendarMonth, setCalendarMonth] = (0, import_element39.useState)(() => { 14360 return selectedRange.from || /* @__PURE__ */ new Date(); 14361 }); 14362 const [isTouched, setIsTouched] = (0, import_element39.useState)(false); 14363 const fromInputRef = (0, import_element39.useRef)(null); 14364 const toInputRef = (0, import_element39.useRef)(null); 14365 const updateDateRange = (0, import_element39.useCallback)( 14366 (fromDate, toDate2) => { 14367 if (fromDate && toDate2) { 14368 onChangeCallback([ 14369 formatDate(fromDate), 14370 formatDate(toDate2) 14371 ]); 14372 } else if (!fromDate && !toDate2) { 14373 onChangeCallback(void 0); 14374 } 14375 }, 14376 [onChangeCallback] 14377 ); 14378 const onSelectCalendarRange = (0, import_element39.useCallback)( 14379 (newRange) => { 14380 updateDateRange(newRange?.from, newRange?.to); 14381 setSelectedPresetId(null); 14382 setIsTouched(true); 14383 }, 14384 [updateDateRange] 14385 ); 14386 const handlePresetClick = (0, import_element39.useCallback)( 14387 (preset) => { 14388 const [startDate, endDate] = preset.getValue(); 14389 setCalendarMonth(startDate); 14390 updateDateRange(startDate, endDate); 14391 setSelectedPresetId(preset.id); 14392 setIsTouched(true); 14393 }, 14394 [updateDateRange] 14395 ); 14396 const handleManualDateChange = (0, import_element39.useCallback)( 14397 (fromOrTo, newValue) => { 14398 const [currentFrom, currentTo] = value || [ 14399 void 0, 14400 void 0 14401 ]; 14402 const updatedFrom = fromOrTo === "from" ? newValue : currentFrom; 14403 const updatedTo = fromOrTo === "to" ? newValue : currentTo; 14404 updateDateRange(updatedFrom, updatedTo); 14405 if (newValue) { 14406 const parsedDate = parseDate(newValue); 14407 if (parsedDate) { 14408 setCalendarMonth(parsedDate); 14409 } 14410 } 14411 setSelectedPresetId(null); 14412 setIsTouched(true); 14413 }, 14414 [value, updateDateRange] 14415 ); 14416 const { timezone } = (0, import_date4.getSettings)(); 14417 let displayLabel = label; 14418 if (field.isValid?.required && !markWhenOptional) { 14419 displayLabel = `$label} (${(0, import_i18n5.__)("Required")})`; 14420 } else if (!field.isValid?.required && markWhenOptional) { 14421 displayLabel = `$label} (${(0, import_i18n5.__)("Optional")})`; 14422 } 14423 return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)( 14424 ValidatedDateControl, 14425 { 14426 field, 14427 validity, 14428 inputRefs: [fromInputRef, toInputRef], 14429 isTouched, 14430 setIsTouched, 14431 children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)( 14432 import_components6.BaseControl, 14433 { 14434 id, 14435 className: "dataviews-controls__date", 14436 label: displayLabel, 14437 help: description, 14438 hideLabelFromVision, 14439 children: /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(Stack, { direction: "column", gap: "lg", children: [ 14440 /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)( 14441 Stack, 14442 { 14443 direction: "row", 14444 gap: "sm", 14445 wrap: "wrap", 14446 justify: "flex-start", 14447 children: [ 14448 DATE_RANGE_PRESETS.map((preset) => { 14449 const isSelected = selectedPresetId === preset.id; 14450 return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)( 14451 import_components6.Button, 14452 { 14453 className: "dataviews-controls__date-preset", 14454 variant: "tertiary", 14455 isPressed: isSelected, 14456 size: "small", 14457 disabled: disabled2, 14458 accessibleWhenDisabled: true, 14459 onClick: () => handlePresetClick(preset), 14460 children: preset.label 14461 }, 14462 preset.id 14463 ); 14464 }), 14465 /* @__PURE__ */ (0, import_jsx_runtime45.jsx)( 14466 import_components6.Button, 14467 { 14468 className: "dataviews-controls__date-preset", 14469 variant: "tertiary", 14470 isPressed: !selectedPresetId, 14471 size: "small", 14472 accessibleWhenDisabled: true, 14473 disabled: !!selectedPresetId || disabled2, 14474 children: (0, import_i18n5.__)("Custom") 14475 } 14476 ) 14477 ] 14478 } 14479 ), 14480 /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)( 14481 Stack, 14482 { 14483 direction: "row", 14484 gap: "sm", 14485 justify: "space-between", 14486 className: "dataviews-controls__date-range-inputs", 14487 children: [ 14488 /* @__PURE__ */ (0, import_jsx_runtime45.jsx)( 14489 import_components6.__experimentalInputControl, 14490 { 14491 __next40pxDefaultSize: true, 14492 ref: fromInputRef, 14493 type: "date", 14494 label: (0, import_i18n5.__)("From"), 14495 hideLabelFromVision: true, 14496 value: value?.[0], 14497 onChange: (newValue) => handleManualDateChange("from", newValue), 14498 required: !!field.isValid?.required, 14499 disabled: disabled2, 14500 min: minConstraint, 14501 max: maxConstraint 14502 } 14503 ), 14504 /* @__PURE__ */ (0, import_jsx_runtime45.jsx)( 14505 import_components6.__experimentalInputControl, 14506 { 14507 __next40pxDefaultSize: true, 14508 ref: toInputRef, 14509 type: "date", 14510 label: (0, import_i18n5.__)("To"), 14511 hideLabelFromVision: true, 14512 value: value?.[1], 14513 onChange: (newValue) => handleManualDateChange("to", newValue), 14514 required: !!field.isValid?.required, 14515 disabled: disabled2, 14516 min: minConstraint, 14517 max: maxConstraint 14518 } 14519 ) 14520 ] 14521 } 14522 ), 14523 /* @__PURE__ */ (0, import_jsx_runtime45.jsx)( 14524 DateRangeCalendar, 14525 { 14526 style: { width: "100%" }, 14527 selected: selectedRange, 14528 onSelect: onSelectCalendarRange, 14529 month: calendarMonth, 14530 onMonthChange: setCalendarMonth, 14531 timeZone: timezone.string || void 0, 14532 weekStartsOn, 14533 disabled: disabled2 || disabledMatchers 14534 } 14535 ) 14536 ] }) 14537 } 14538 ) 14539 } 14540 ); 14541 } 14542 function DateControl({ 14543 data, 14544 field, 14545 onChange, 14546 hideLabelFromVision, 14547 markWhenOptional, 14548 operator, 14549 validity 14550 }) { 14551 if (operator === OPERATOR_IN_THE_PAST || operator === OPERATOR_OVER) { 14552 return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)( 14553 RelativeDateControl, 14554 { 14555 className: "dataviews-controls__date", 14556 data, 14557 field, 14558 onChange, 14559 hideLabelFromVision, 14560 operator 14561 } 14562 ); 14563 } 14564 if (operator === OPERATOR_BETWEEN) { 14565 return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)( 14566 CalendarDateRangeControl, 14567 { 14568 data, 14569 field, 14570 onChange, 14571 hideLabelFromVision, 14572 markWhenOptional, 14573 validity 14574 } 14575 ); 14576 } 14577 return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)( 14578 CalendarDateControl, 14579 { 14580 data, 14581 field, 14582 onChange, 14583 hideLabelFromVision, 14584 markWhenOptional, 14585 validity 14586 } 14587 ); 14588 } 14589 14590 // packages/dataviews/build-module/components/dataform-controls/select.mjs 14591 var import_components7 = __toESM(require_components(), 1); 14592 var import_element40 = __toESM(require_element(), 1); 14593 var import_jsx_runtime46 = __toESM(require_jsx_runtime(), 1); 14594 var { ValidatedSelectControl } = unlock2(import_components7.privateApis); 14595 function Select({ 14596 data, 14597 field, 14598 onChange, 14599 hideLabelFromVision, 14600 markWhenOptional, 14601 validity 14602 }) { 14603 const { type, label, description, getValue, setValue, isValid: isValid2 } = field; 14604 const disabled2 = field.isDisabled({ item: data, field }); 14605 const isMultiple = type === "array"; 14606 const value = getValue({ item: data }) ?? (isMultiple ? [] : ""); 14607 const onChangeControl = (0, import_element40.useCallback)( 14608 (newValue) => onChange(setValue({ item: data, value: newValue })), 14609 [data, onChange, setValue] 14610 ); 14611 const { elements, isLoading } = useElements({ 14612 elements: field.elements, 14613 getElements: field.getElements 14614 }); 14615 if (isLoading) { 14616 return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_components7.Spinner, {}); 14617 } 14618 return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)( 14619 ValidatedSelectControl, 14620 { 14621 required: !!field.isValid?.required, 14622 markWhenOptional, 14623 customValidity: getCustomValidity(isValid2, validity), 14624 label, 14625 value, 14626 help: description, 14627 options: elements, 14628 onChange: onChangeControl, 14629 __next40pxDefaultSize: true, 14630 hideLabelFromVision, 14631 multiple: isMultiple, 14632 disabled: disabled2 14633 } 14634 ); 14635 } 14636 14637 // packages/dataviews/build-module/components/dataform-controls/adaptive-select.mjs 14638 var import_jsx_runtime47 = __toESM(require_jsx_runtime(), 1); 14639 var ELEMENTS_THRESHOLD = 10; 14640 function AdaptiveSelect(props) { 14641 const { field } = props; 14642 const { elements } = useElements({ 14643 elements: field.elements, 14644 getElements: field.getElements 14645 }); 14646 if (elements.length >= ELEMENTS_THRESHOLD) { 14647 return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(Combobox, { ...props }); 14648 } 14649 return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(Select, { ...props }); 14650 } 14651 14652 // packages/dataviews/build-module/components/dataform-controls/email.mjs 14653 var import_components9 = __toESM(require_components(), 1); 14654 14655 // packages/dataviews/build-module/components/dataform-controls/utils/validated-input.mjs 14656 var import_components8 = __toESM(require_components(), 1); 14657 var import_element41 = __toESM(require_element(), 1); 14658 var import_jsx_runtime48 = __toESM(require_jsx_runtime(), 1); 14659 var { ValidatedInputControl: ValidatedInputControl2 } = unlock2(import_components8.privateApis); 14660 function ValidatedText({ 14661 data, 14662 field, 14663 onChange, 14664 hideLabelFromVision, 14665 markWhenOptional, 14666 type, 14667 prefix, 14668 suffix, 14669 validity 14670 }) { 14671 const { label, placeholder, description, getValue, setValue, isValid: isValid2 } = field; 14672 const value = getValue({ item: data }); 14673 const disabled2 = field.isDisabled({ item: data, field }); 14674 const onChangeControl = (0, import_element41.useCallback)( 14675 (newValue) => onChange( 14676 setValue({ 14677 item: data, 14678 value: newValue 14679 }) 14680 ), 14681 [data, setValue, onChange] 14682 ); 14683 return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)( 14684 ValidatedInputControl2, 14685 { 14686 required: !!isValid2.required, 14687 markWhenOptional, 14688 customValidity: getCustomValidity(isValid2, validity), 14689 label, 14690 placeholder, 14691 value: value ?? "", 14692 help: description, 14693 onChange: onChangeControl, 14694 hideLabelFromVision, 14695 type, 14696 prefix, 14697 suffix, 14698 disabled: disabled2, 14699 pattern: isValid2.pattern ? isValid2.pattern.constraint : void 0, 14700 minLength: isValid2.minLength ? isValid2.minLength.constraint : void 0, 14701 maxLength: isValid2.maxLength ? isValid2.maxLength.constraint : void 0, 14702 __next40pxDefaultSize: true 14703 } 14704 ); 14705 } 14706 14707 // packages/dataviews/build-module/components/dataform-controls/email.mjs 14708 var import_jsx_runtime49 = __toESM(require_jsx_runtime(), 1); 14709 function Email({ 14710 data, 14711 field, 14712 onChange, 14713 hideLabelFromVision, 14714 markWhenOptional, 14715 validity 14716 }) { 14717 return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)( 14718 ValidatedText, 14719 { 14720 ...{ 14721 data, 14722 field, 14723 onChange, 14724 hideLabelFromVision, 14725 markWhenOptional, 14726 validity, 14727 type: "email", 14728 prefix: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_components9.__experimentalInputControlPrefixWrapper, { variant: "icon", children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_components9.Icon, { icon: envelope_default }) }) 14729 } 14730 } 14731 ); 14732 } 14733 14734 // packages/dataviews/build-module/components/dataform-controls/telephone.mjs 14735 var import_components10 = __toESM(require_components(), 1); 14736 var import_jsx_runtime50 = __toESM(require_jsx_runtime(), 1); 14737 function Telephone({ 14738 data, 14739 field, 14740 onChange, 14741 hideLabelFromVision, 14742 markWhenOptional, 14743 validity 14744 }) { 14745 return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)( 14746 ValidatedText, 14747 { 14748 ...{ 14749 data, 14750 field, 14751 onChange, 14752 hideLabelFromVision, 14753 markWhenOptional, 14754 validity, 14755 type: "tel", 14756 prefix: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_components10.__experimentalInputControlPrefixWrapper, { variant: "icon", children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_components10.Icon, { icon: mobile_default }) }) 14757 } 14758 } 14759 ); 14760 } 14761 14762 // packages/dataviews/build-module/components/dataform-controls/url.mjs 14763 var import_components11 = __toESM(require_components(), 1); 14764 var import_jsx_runtime51 = __toESM(require_jsx_runtime(), 1); 14765 function Url({ 14766 data, 14767 field, 14768 onChange, 14769 hideLabelFromVision, 14770 markWhenOptional, 14771 validity 14772 }) { 14773 return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)( 14774 ValidatedText, 14775 { 14776 ...{ 14777 data, 14778 field, 14779 onChange, 14780 hideLabelFromVision, 14781 markWhenOptional, 14782 validity, 14783 type: "url", 14784 prefix: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(import_components11.__experimentalInputControlPrefixWrapper, { variant: "icon", children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(import_components11.Icon, { icon: link_default }) }) 14785 } 14786 } 14787 ); 14788 } 14789 14790 // packages/dataviews/build-module/components/dataform-controls/utils/validated-number.mjs 14791 var import_components12 = __toESM(require_components(), 1); 14792 var import_element42 = __toESM(require_element(), 1); 14793 var import_i18n6 = __toESM(require_i18n(), 1); 14794 var import_jsx_runtime52 = __toESM(require_jsx_runtime(), 1); 14795 var { ValidatedNumberControl } = unlock2(import_components12.privateApis); 14796 function toNumberOrEmpty(value) { 14797 if (value === "" || value === void 0) { 14798 return ""; 14799 } 14800 const number = Number(value); 14801 return Number.isFinite(number) ? number : ""; 14802 } 14803 function BetweenControls({ 14804 value, 14805 onChange, 14806 hideLabelFromVision, 14807 step 14808 }) { 14809 const [min2 = "", max2 = ""] = value; 14810 const onChangeMin = (0, import_element42.useCallback)( 14811 (newValue) => onChange([toNumberOrEmpty(newValue), max2]), 14812 [onChange, max2] 14813 ); 14814 const onChangeMax = (0, import_element42.useCallback)( 14815 (newValue) => onChange([min2, toNumberOrEmpty(newValue)]), 14816 [onChange, min2] 14817 ); 14818 return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)( 14819 import_components12.BaseControl, 14820 { 14821 help: (0, import_i18n6.__)("The max. value must be greater than the min. value."), 14822 children: /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(import_components12.Flex, { direction: "row", gap: 4, children: [ 14823 /* @__PURE__ */ (0, import_jsx_runtime52.jsx)( 14824 import_components12.__experimentalNumberControl, 14825 { 14826 label: (0, import_i18n6.__)("Min."), 14827 value: min2, 14828 max: max2 ? Number(max2) - step : void 0, 14829 onChange: onChangeMin, 14830 __next40pxDefaultSize: true, 14831 hideLabelFromVision, 14832 step 14833 } 14834 ), 14835 /* @__PURE__ */ (0, import_jsx_runtime52.jsx)( 14836 import_components12.__experimentalNumberControl, 14837 { 14838 label: (0, import_i18n6.__)("Max."), 14839 value: max2, 14840 min: min2 ? Number(min2) + step : void 0, 14841 onChange: onChangeMax, 14842 __next40pxDefaultSize: true, 14843 hideLabelFromVision, 14844 step 14845 } 14846 ) 14847 ] }) 14848 } 14849 ); 14850 } 14851 function ValidatedNumber({ 14852 data, 14853 field, 14854 onChange, 14855 hideLabelFromVision, 14856 markWhenOptional, 14857 operator, 14858 validity 14859 }) { 14860 const decimals = field.format?.decimals ?? 0; 14861 const step = Math.pow(10, Math.abs(decimals) * -1); 14862 const { label, description, getValue, setValue, isValid: isValid2 } = field; 14863 const value = getValue({ item: data }) ?? ""; 14864 const disabled2 = field.isDisabled({ item: data, field }); 14865 const onChangeControl = (0, import_element42.useCallback)( 14866 (newValue) => { 14867 onChange( 14868 setValue({ 14869 item: data, 14870 // Do not convert an empty string or undefined to a number, 14871 // otherwise there's a mismatch between the UI control (empty) 14872 // and the data relied by onChange (0). 14873 value: ["", void 0].includes(newValue) ? void 0 : Number(newValue) 14874 }) 14875 ); 14876 }, 14877 [data, onChange, setValue] 14878 ); 14879 const onChangeBetweenControls = (0, import_element42.useCallback)( 14880 (newValue) => { 14881 onChange( 14882 setValue({ 14883 item: data, 14884 value: newValue 14885 }) 14886 ); 14887 }, 14888 [data, onChange, setValue] 14889 ); 14890 if (operator === OPERATOR_BETWEEN) { 14891 let valueBetween = ["", ""]; 14892 if (Array.isArray(value) && value.length === 2 && value.every( 14893 (element) => typeof element === "number" || element === "" 14894 )) { 14895 valueBetween = value; 14896 } 14897 return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)( 14898 BetweenControls, 14899 { 14900 value: valueBetween, 14901 onChange: onChangeBetweenControls, 14902 hideLabelFromVision, 14903 step 14904 } 14905 ); 14906 } 14907 return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)( 14908 ValidatedNumberControl, 14909 { 14910 required: !!isValid2.required, 14911 markWhenOptional, 14912 customValidity: getCustomValidity(isValid2, validity), 14913 label, 14914 help: description, 14915 value, 14916 onChange: onChangeControl, 14917 __next40pxDefaultSize: true, 14918 hideLabelFromVision, 14919 step, 14920 min: isValid2.min ? isValid2.min.constraint : void 0, 14921 max: isValid2.max ? isValid2.max.constraint : void 0, 14922 disabled: disabled2 14923 } 14924 ); 14925 } 14926 14927 // packages/dataviews/build-module/components/dataform-controls/integer.mjs 14928 var import_jsx_runtime53 = __toESM(require_jsx_runtime(), 1); 14929 function Integer(props) { 14930 return /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(ValidatedNumber, { ...props }); 14931 } 14932 14933 // packages/dataviews/build-module/components/dataform-controls/number.mjs 14934 var import_jsx_runtime54 = __toESM(require_jsx_runtime(), 1); 14935 function Number2(props) { 14936 return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(ValidatedNumber, { ...props }); 14937 } 14938 14939 // packages/dataviews/build-module/components/dataform-controls/radio.mjs 14940 var import_components13 = __toESM(require_components(), 1); 14941 var import_element43 = __toESM(require_element(), 1); 14942 var import_jsx_runtime55 = __toESM(require_jsx_runtime(), 1); 14943 var { ValidatedRadioControl } = unlock2(import_components13.privateApis); 14944 function Radio({ 14945 data, 14946 field, 14947 onChange, 14948 hideLabelFromVision, 14949 markWhenOptional, 14950 validity 14951 }) { 14952 const { label, description, getValue, setValue, isValid: isValid2 } = field; 14953 const disabled2 = field.isDisabled({ item: data, field }); 14954 const { elements, isLoading } = useElements({ 14955 elements: field.elements, 14956 getElements: field.getElements 14957 }); 14958 const value = getValue({ item: data }); 14959 const onChangeControl = (0, import_element43.useCallback)( 14960 (newValue) => onChange(setValue({ item: data, value: newValue })), 14961 [data, onChange, setValue] 14962 ); 14963 if (isLoading) { 14964 return /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(import_components13.Spinner, {}); 14965 } 14966 return /* @__PURE__ */ (0, import_jsx_runtime55.jsx)( 14967 ValidatedRadioControl, 14968 { 14969 required: !!field.isValid?.required, 14970 markWhenOptional, 14971 customValidity: getCustomValidity(isValid2, validity), 14972 label, 14973 help: description, 14974 onChange: onChangeControl, 14975 options: elements, 14976 selected: value, 14977 hideLabelFromVision, 14978 disabled: disabled2 14979 } 14980 ); 14981 } 14982 14983 // packages/dataviews/build-module/components/dataform-controls/text.mjs 14984 var import_element44 = __toESM(require_element(), 1); 14985 var import_jsx_runtime56 = __toESM(require_jsx_runtime(), 1); 14986 function Text3({ 14987 data, 14988 field, 14989 onChange, 14990 hideLabelFromVision, 14991 markWhenOptional, 14992 config, 14993 validity 14994 }) { 14995 const { prefix, suffix } = config || {}; 14996 return /* @__PURE__ */ (0, import_jsx_runtime56.jsx)( 14997 ValidatedText, 14998 { 14999 ...{ 15000 data, 15001 field, 15002 onChange, 15003 hideLabelFromVision, 15004 markWhenOptional, 15005 validity, 15006 prefix: prefix ? (0, import_element44.createElement)(prefix) : void 0, 15007 suffix: suffix ? (0, import_element44.createElement)(suffix) : void 0 15008 } 15009 } 15010 ); 15011 } 15012 15013 // packages/dataviews/build-module/components/dataform-controls/toggle.mjs 15014 var import_components14 = __toESM(require_components(), 1); 15015 var import_element45 = __toESM(require_element(), 1); 15016 var import_jsx_runtime57 = __toESM(require_jsx_runtime(), 1); 15017 var { ValidatedToggleControl } = unlock2(import_components14.privateApis); 15018 function Toggle({ 15019 field, 15020 onChange, 15021 data, 15022 hideLabelFromVision, 15023 markWhenOptional, 15024 validity 15025 }) { 15026 const { label, description, getValue, setValue, isValid: isValid2 } = field; 15027 const disabled2 = field.isDisabled({ item: data, field }); 15028 const onChangeControl = (0, import_element45.useCallback)(() => { 15029 onChange( 15030 setValue({ item: data, value: !getValue({ item: data }) }) 15031 ); 15032 }, [onChange, setValue, data, getValue]); 15033 return /* @__PURE__ */ (0, import_jsx_runtime57.jsx)( 15034 ValidatedToggleControl, 15035 { 15036 required: !!isValid2.required, 15037 markWhenOptional, 15038 customValidity: getCustomValidity(isValid2, validity), 15039 hidden: hideLabelFromVision, 15040 label, 15041 help: description, 15042 checked: getValue({ item: data }), 15043 onChange: onChangeControl, 15044 disabled: disabled2 15045 } 15046 ); 15047 } 15048 15049 // packages/dataviews/build-module/components/dataform-controls/textarea.mjs 15050 var import_components15 = __toESM(require_components(), 1); 15051 var import_element46 = __toESM(require_element(), 1); 15052 var import_jsx_runtime58 = __toESM(require_jsx_runtime(), 1); 15053 var { ValidatedTextareaControl } = unlock2(import_components15.privateApis); 15054 function Textarea({ 15055 data, 15056 field, 15057 onChange, 15058 hideLabelFromVision, 15059 markWhenOptional, 15060 config, 15061 validity 15062 }) { 15063 const { rows = 4 } = config || {}; 15064 const disabled2 = field.isDisabled({ item: data, field }); 15065 const { label, placeholder, description, setValue, isValid: isValid2 } = field; 15066 const value = field.getValue({ item: data }); 15067 const onChangeControl = (0, import_element46.useCallback)( 15068 (newValue) => onChange(setValue({ item: data, value: newValue })), 15069 [data, onChange, setValue] 15070 ); 15071 return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)( 15072 ValidatedTextareaControl, 15073 { 15074 required: !!isValid2.required, 15075 markWhenOptional, 15076 customValidity: getCustomValidity(isValid2, validity), 15077 label, 15078 placeholder, 15079 value: value ?? "", 15080 help: description, 15081 onChange: onChangeControl, 15082 rows, 15083 disabled: disabled2, 15084 minLength: isValid2.minLength ? isValid2.minLength.constraint : void 0, 15085 maxLength: isValid2.maxLength ? isValid2.maxLength.constraint : void 0, 15086 __next40pxDefaultSize: true, 15087 hideLabelFromVision 15088 } 15089 ); 15090 } 15091 15092 // packages/dataviews/build-module/components/dataform-controls/toggle-group.mjs 15093 var import_components16 = __toESM(require_components(), 1); 15094 var import_element47 = __toESM(require_element(), 1); 15095 var import_jsx_runtime59 = __toESM(require_jsx_runtime(), 1); 15096 var { ValidatedToggleGroupControl } = unlock2(import_components16.privateApis); 15097 function ToggleGroup({ 15098 data, 15099 field, 15100 onChange, 15101 hideLabelFromVision, 15102 markWhenOptional, 15103 validity 15104 }) { 15105 const { getValue, setValue, isValid: isValid2 } = field; 15106 const disabled2 = field.isDisabled({ item: data, field }); 15107 const value = getValue({ item: data }); 15108 const onChangeControl = (0, import_element47.useCallback)( 15109 (newValue) => onChange(setValue({ item: data, value: newValue })), 15110 [data, onChange, setValue] 15111 ); 15112 const { elements, isLoading } = useElements({ 15113 elements: field.elements, 15114 getElements: field.getElements 15115 }); 15116 if (isLoading) { 15117 return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(import_components16.Spinner, {}); 15118 } 15119 if (elements.length === 0) { 15120 return null; 15121 } 15122 const selectedOption = elements.find((el) => el.value === value); 15123 return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)( 15124 ValidatedToggleGroupControl, 15125 { 15126 required: !!field.isValid?.required, 15127 markWhenOptional, 15128 customValidity: getCustomValidity(isValid2, validity), 15129 __next40pxDefaultSize: true, 15130 isBlock: true, 15131 label: field.label, 15132 help: selectedOption?.description || field.description, 15133 onChange: onChangeControl, 15134 value, 15135 hideLabelFromVision, 15136 children: elements.map((el) => /* @__PURE__ */ (0, import_jsx_runtime59.jsx)( 15137 import_components16.__experimentalToggleGroupControlOption, 15138 { 15139 label: el.label, 15140 value: el.value, 15141 disabled: disabled2 15142 }, 15143 el.value 15144 )) 15145 } 15146 ); 15147 } 15148 15149 // packages/dataviews/build-module/components/dataform-controls/array.mjs 15150 var import_components17 = __toESM(require_components(), 1); 15151 var import_element48 = __toESM(require_element(), 1); 15152 var import_jsx_runtime60 = __toESM(require_jsx_runtime(), 1); 15153 var { ValidatedFormTokenField } = unlock2(import_components17.privateApis); 15154 function ArrayControl({ 15155 data, 15156 field, 15157 onChange, 15158 hideLabelFromVision, 15159 markWhenOptional, 15160 validity 15161 }) { 15162 const { label, placeholder, description, getValue, setValue, isValid: isValid2 } = field; 15163 const value = getValue({ item: data }); 15164 const disabled2 = field.isDisabled({ item: data, field }); 15165 const { elements, isLoading } = useElements({ 15166 elements: field.elements, 15167 getElements: field.getElements 15168 }); 15169 const arrayValueAsElements = (0, import_element48.useMemo)( 15170 () => Array.isArray(value) ? value.map((token) => { 15171 const element = elements?.find( 15172 (suggestion) => suggestion.value === token 15173 ); 15174 return element || { value: token, label: token }; 15175 }) : [], 15176 [value, elements] 15177 ); 15178 const onChangeControl = (0, import_element48.useCallback)( 15179 (tokens) => { 15180 const valueTokens = tokens.map((token) => { 15181 if (typeof token === "object" && "value" in token) { 15182 return token.value; 15183 } 15184 return token; 15185 }); 15186 onChange(setValue({ item: data, value: valueTokens })); 15187 }, 15188 [onChange, setValue, data] 15189 ); 15190 if (isLoading) { 15191 return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(import_components17.Spinner, {}); 15192 } 15193 return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)( 15194 ValidatedFormTokenField, 15195 { 15196 required: !!isValid2?.required, 15197 markWhenOptional, 15198 customValidity: getCustomValidity(isValid2, validity), 15199 label: hideLabelFromVision ? void 0 : label, 15200 value: arrayValueAsElements, 15201 onChange: onChangeControl, 15202 placeholder, 15203 suggestions: elements?.map((element) => element.value), 15204 disabled: disabled2, 15205 __experimentalValidateInput: (token) => { 15206 if (field.isValid?.elements && elements) { 15207 return elements.some( 15208 (element) => element.value === token || element.label === token 15209 ); 15210 } 15211 return true; 15212 }, 15213 __experimentalExpandOnFocus: elements && elements.length > 0, 15214 help: description ?? (field.isValid?.elements ? "" : void 0), 15215 displayTransform: (token) => { 15216 if (typeof token === "object" && "label" in token) { 15217 return token.label; 15218 } 15219 if (typeof token === "string" && elements) { 15220 const element = elements.find( 15221 (el) => el.value === token 15222 ); 15223 return element?.label || token; 15224 } 15225 return token; 15226 }, 15227 __experimentalRenderItem: ({ item }) => { 15228 if (typeof item === "string" && elements) { 15229 const element = elements.find( 15230 (el) => el.value === item 15231 ); 15232 return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("span", { children: element?.label || item }); 15233 } 15234 return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("span", { children: item }); 15235 } 15236 } 15237 ); 15238 } 15239 15240 // node_modules/colord/index.mjs 15241 var r2 = { grad: 0.9, turn: 360, rad: 360 / (2 * Math.PI) }; 15242 var t = function(r3) { 15243 return "string" == typeof r3 ? r3.length > 0 : "number" == typeof r3; 15244 }; 15245 var n = function(r3, t2, n2) { 15246 return void 0 === t2 && (t2 = 0), void 0 === n2 && (n2 = Math.pow(10, t2)), Math.round(n2 * r3) / n2 + 0; 15247 }; 15248 var e = function(r3, t2, n2) { 15249 return void 0 === t2 && (t2 = 0), void 0 === n2 && (n2 = 1), r3 > n2 ? n2 : r3 > t2 ? r3 : t2; 15250 }; 15251 var u = function(r3) { 15252 return (r3 = isFinite(r3) ? r3 % 360 : 0) > 0 ? r3 : r3 + 360; 15253 }; 15254 var a = function(r3) { 15255 return { r: e(r3.r, 0, 255), g: e(r3.g, 0, 255), b: e(r3.b, 0, 255), a: e(r3.a) }; 15256 }; 15257 var o = function(r3) { 15258 return { r: n(r3.r), g: n(r3.g), b: n(r3.b), a: n(r3.a, 3) }; 15259 }; 15260 var i = /^#([0-9a-f]{3,8})$/i; 15261 var s = function(r3) { 15262 var t2 = r3.toString(16); 15263 return t2.length < 2 ? "0" + t2 : t2; 15264 }; 15265 var h = function(r3) { 15266 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; 15267 return { h: 60 * (i2 < 0 ? i2 + 6 : i2), s: a2 ? o2 / a2 * 100 : 0, v: a2 / 255 * 100, a: u2 }; 15268 }; 15269 var b = function(r3) { 15270 var t2 = r3.h, n2 = r3.s, e2 = r3.v, u2 = r3.a; 15271 t2 = t2 / 360 * 6, n2 /= 100, e2 /= 100; 15272 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; 15273 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 }; 15274 }; 15275 var g = function(r3) { 15276 return { h: u(r3.h), s: e(r3.s, 0, 100), l: e(r3.l, 0, 100), a: e(r3.a) }; 15277 }; 15278 var d = function(r3) { 15279 return { h: n(r3.h), s: n(r3.s), l: n(r3.l), a: n(r3.a, 3) }; 15280 }; 15281 var f = function(r3) { 15282 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 })); 15283 var t2, n2, e2; 15284 }; 15285 var c = function(r3) { 15286 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 }; 15287 var t2, n2, e2, u2; 15288 }; 15289 var l = /^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i; 15290 var p = /^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i; 15291 var v = /^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i; 15292 var m = /^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i; 15293 var y = { string: [[function(r3) { 15294 var t2 = i.exec(r3); 15295 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; 15296 }, "hex"], [function(r3) { 15297 var t2 = v.exec(r3) || m.exec(r3); 15298 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; 15299 }, "rgb"], [function(t2) { 15300 var n2 = l.exec(t2) || p.exec(t2); 15301 if (!n2) return null; 15302 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) }); 15303 return f(a2); 15304 }, "hsl"]], object: [[function(r3) { 15305 var n2 = r3.r, e2 = r3.g, u2 = r3.b, o2 = r3.a, i2 = void 0 === o2 ? 1 : o2; 15306 return t(n2) && t(e2) && t(u2) ? a({ r: Number(n2), g: Number(e2), b: Number(u2), a: Number(i2) }) : null; 15307 }, "rgb"], [function(r3) { 15308 var n2 = r3.h, e2 = r3.s, u2 = r3.l, a2 = r3.a, o2 = void 0 === a2 ? 1 : a2; 15309 if (!t(n2) || !t(e2) || !t(u2)) return null; 15310 var i2 = g({ h: Number(n2), s: Number(e2), l: Number(u2), a: Number(o2) }); 15311 return f(i2); 15312 }, "hsl"], [function(r3) { 15313 var n2 = r3.h, a2 = r3.s, o2 = r3.v, i2 = r3.a, s2 = void 0 === i2 ? 1 : i2; 15314 if (!t(n2) || !t(a2) || !t(o2)) return null; 15315 var h2 = (function(r4) { 15316 return { h: u(r4.h), s: e(r4.s, 0, 100), v: e(r4.v, 0, 100), a: e(r4.a) }; 15317 })({ h: Number(n2), s: Number(a2), v: Number(o2), a: Number(s2) }); 15318 return b(h2); 15319 }, "hsv"]] }; 15320 var N = function(r3, t2) { 15321 for (var n2 = 0; n2 < t2.length; n2++) { 15322 var e2 = t2[n2][0](r3); 15323 if (e2) return [e2, t2[n2][1]]; 15324 } 15325 return [null, void 0]; 15326 }; 15327 var x = function(r3) { 15328 return "string" == typeof r3 ? N(r3.trim(), y.string) : "object" == typeof r3 && null !== r3 ? N(r3, y.object) : [null, void 0]; 15329 }; 15330 var M = function(r3, t2) { 15331 var n2 = c(r3); 15332 return { h: n2.h, s: e(n2.s + 100 * t2, 0, 100), l: n2.l, a: n2.a }; 15333 }; 15334 var H = function(r3) { 15335 return (299 * r3.r + 587 * r3.g + 114 * r3.b) / 1e3 / 255; 15336 }; 15337 var $ = function(r3, t2) { 15338 var n2 = c(r3); 15339 return { h: n2.h, s: n2.s, l: e(n2.l + 100 * t2, 0, 100), a: n2.a }; 15340 }; 15341 var j = (function() { 15342 function r3(r4) { 15343 this.parsed = x(r4)[0], this.rgba = this.parsed || { r: 0, g: 0, b: 0, a: 1 }; 15344 } 15345 return r3.prototype.isValid = function() { 15346 return null !== this.parsed; 15347 }, r3.prototype.brightness = function() { 15348 return n(H(this.rgba), 2); 15349 }, r3.prototype.isDark = function() { 15350 return H(this.rgba) < 0.5; 15351 }, r3.prototype.isLight = function() { 15352 return H(this.rgba) >= 0.5; 15353 }, r3.prototype.toHex = function() { 15354 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; 15355 var r4, t2, e2, u2, a2, i2; 15356 }, r3.prototype.toRgb = function() { 15357 return o(this.rgba); 15358 }, r3.prototype.toRgbString = function() { 15359 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 + ")"; 15360 var r4, t2, n2, e2, u2; 15361 }, r3.prototype.toHsl = function() { 15362 return d(c(this.rgba)); 15363 }, r3.prototype.toHslString = function() { 15364 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 + "%)"; 15365 var r4, t2, n2, e2, u2; 15366 }, r3.prototype.toHsv = function() { 15367 return r4 = h(this.rgba), { h: n(r4.h), s: n(r4.s), v: n(r4.v), a: n(r4.a, 3) }; 15368 var r4; 15369 }, r3.prototype.invert = function() { 15370 return w({ r: 255 - (r4 = this.rgba).r, g: 255 - r4.g, b: 255 - r4.b, a: r4.a }); 15371 var r4; 15372 }, r3.prototype.saturate = function(r4) { 15373 return void 0 === r4 && (r4 = 0.1), w(M(this.rgba, r4)); 15374 }, r3.prototype.desaturate = function(r4) { 15375 return void 0 === r4 && (r4 = 0.1), w(M(this.rgba, -r4)); 15376 }, r3.prototype.grayscale = function() { 15377 return w(M(this.rgba, -1)); 15378 }, r3.prototype.lighten = function(r4) { 15379 return void 0 === r4 && (r4 = 0.1), w($(this.rgba, r4)); 15380 }, r3.prototype.darken = function(r4) { 15381 return void 0 === r4 && (r4 = 0.1), w($(this.rgba, -r4)); 15382 }, r3.prototype.rotate = function(r4) { 15383 return void 0 === r4 && (r4 = 15), this.hue(this.hue() + r4); 15384 }, r3.prototype.alpha = function(r4) { 15385 return "number" == typeof r4 ? w({ r: (t2 = this.rgba).r, g: t2.g, b: t2.b, a: r4 }) : n(this.rgba.a, 3); 15386 var t2; 15387 }, r3.prototype.hue = function(r4) { 15388 var t2 = c(this.rgba); 15389 return "number" == typeof r4 ? w({ h: r4, s: t2.s, l: t2.l, a: t2.a }) : n(t2.h); 15390 }, r3.prototype.isEqual = function(r4) { 15391 return this.toHex() === w(r4).toHex(); 15392 }, r3; 15393 })(); 15394 var w = function(r3) { 15395 return r3 instanceof j ? r3 : new j(r3); 15396 }; 15397 15398 // packages/dataviews/build-module/components/dataform-controls/color.mjs 15399 var import_components18 = __toESM(require_components(), 1); 15400 var import_element49 = __toESM(require_element(), 1); 15401 var import_i18n7 = __toESM(require_i18n(), 1); 15402 var import_jsx_runtime61 = __toESM(require_jsx_runtime(), 1); 15403 var { ValidatedInputControl: ValidatedInputControl3 } = unlock2(import_components18.privateApis); 15404 var ColorPickerDropdown = ({ 15405 color, 15406 onColorChange, 15407 disabled: disabled2 15408 }) => { 15409 const validColor = color && w(color).isValid() ? color : "#ffffff"; 15410 return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)( 15411 import_components18.Dropdown, 15412 { 15413 className: "dataviews-controls__color-picker-dropdown", 15414 popoverProps: { resize: false }, 15415 renderToggle: ({ onToggle }) => /* @__PURE__ */ (0, import_jsx_runtime61.jsx)( 15416 import_components18.Button, 15417 { 15418 onClick: onToggle, 15419 "aria-label": (0, import_i18n7.__)("Open color picker"), 15420 size: "small", 15421 disabled: disabled2, 15422 accessibleWhenDisabled: true, 15423 icon: () => /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(import_components18.ColorIndicator, { colorValue: validColor }) 15424 } 15425 ), 15426 renderContent: () => /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(import_components18.__experimentalDropdownContentWrapper, { paddingSize: "none", children: /* @__PURE__ */ (0, import_jsx_runtime61.jsx)( 15427 import_components18.ColorPicker, 15428 { 15429 color: validColor, 15430 onChange: onColorChange, 15431 enableAlpha: true 15432 } 15433 ) }) 15434 } 15435 ); 15436 }; 15437 function Color({ 15438 data, 15439 field, 15440 onChange, 15441 hideLabelFromVision, 15442 markWhenOptional, 15443 validity 15444 }) { 15445 const { label, placeholder, description, setValue, isValid: isValid2 } = field; 15446 const disabled2 = field.isDisabled({ item: data, field }); 15447 const value = field.getValue({ item: data }) || ""; 15448 const handleColorChange = (0, import_element49.useCallback)( 15449 (newColor) => { 15450 onChange(setValue({ item: data, value: newColor })); 15451 }, 15452 [data, onChange, setValue] 15453 ); 15454 const handleInputChange = (0, import_element49.useCallback)( 15455 (newValue) => { 15456 onChange(setValue({ item: data, value: newValue || "" })); 15457 }, 15458 [data, onChange, setValue] 15459 ); 15460 return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)( 15461 ValidatedInputControl3, 15462 { 15463 required: !!field.isValid?.required, 15464 markWhenOptional, 15465 customValidity: getCustomValidity(isValid2, validity), 15466 label, 15467 placeholder, 15468 value, 15469 help: description, 15470 onChange: handleInputChange, 15471 hideLabelFromVision, 15472 type: "text", 15473 disabled: disabled2, 15474 prefix: /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(import_components18.__experimentalInputControlPrefixWrapper, { variant: "control", children: /* @__PURE__ */ (0, import_jsx_runtime61.jsx)( 15475 ColorPickerDropdown, 15476 { 15477 color: value, 15478 onColorChange: handleColorChange, 15479 disabled: disabled2 15480 } 15481 ) }) 15482 } 15483 ); 15484 } 15485 15486 // packages/dataviews/build-module/components/dataform-controls/password.mjs 15487 var import_components19 = __toESM(require_components(), 1); 15488 var import_element50 = __toESM(require_element(), 1); 15489 var import_i18n8 = __toESM(require_i18n(), 1); 15490 var import_jsx_runtime62 = __toESM(require_jsx_runtime(), 1); 15491 function Password({ 15492 data, 15493 field, 15494 onChange, 15495 hideLabelFromVision, 15496 markWhenOptional, 15497 validity 15498 }) { 15499 const [isVisible, setIsVisible] = (0, import_element50.useState)(false); 15500 const disabled2 = field.isDisabled({ item: data, field }); 15501 const toggleVisibility = (0, import_element50.useCallback)(() => { 15502 setIsVisible((prev) => !prev); 15503 }, []); 15504 return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)( 15505 ValidatedText, 15506 { 15507 ...{ 15508 data, 15509 field, 15510 onChange, 15511 hideLabelFromVision, 15512 markWhenOptional, 15513 validity, 15514 type: isVisible ? "text" : "password", 15515 suffix: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(import_components19.__experimentalInputControlSuffixWrapper, { variant: "control", children: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)( 15516 import_components19.Button, 15517 { 15518 icon: isVisible ? unseen_default : seen_default, 15519 onClick: toggleVisibility, 15520 size: "small", 15521 label: isVisible ? (0, import_i18n8.__)("Hide password") : (0, import_i18n8.__)("Show password"), 15522 disabled: disabled2, 15523 accessibleWhenDisabled: true 15524 } 15525 ) }) 15526 } 15527 } 15528 ); 15529 } 15530 15531 // packages/dataviews/build-module/field-types/utils/has-elements.mjs 15532 function hasElements(field) { 15533 return Array.isArray(field.elements) && field.elements.length > 0 || typeof field.getElements === "function"; 15534 } 15535 15536 // packages/dataviews/build-module/components/dataform-controls/index.mjs 15537 var import_jsx_runtime63 = __toESM(require_jsx_runtime(), 1); 15538 var FORM_CONTROLS = { 15539 adaptiveSelect: AdaptiveSelect, 15540 array: ArrayControl, 15541 checkbox: Checkbox, 15542 color: Color, 15543 combobox: Combobox, 15544 datetime: DateTime, 15545 date: DateControl, 15546 email: Email, 15547 telephone: Telephone, 15548 url: Url, 15549 integer: Integer, 15550 number: Number2, 15551 password: Password, 15552 radio: Radio, 15553 select: Select, 15554 text: Text3, 15555 toggle: Toggle, 15556 textarea: Textarea, 15557 toggleGroup: ToggleGroup 15558 }; 15559 function isEditConfig(value) { 15560 return value && typeof value === "object" && typeof value.control === "string"; 15561 } 15562 function createConfiguredControl(config) { 15563 const { control, ...controlConfig } = config; 15564 const BaseControlType = getControlByType(control); 15565 if (BaseControlType === null) { 15566 return null; 15567 } 15568 return function ConfiguredControl(props) { 15569 return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(BaseControlType, { ...props, config: controlConfig }); 15570 }; 15571 } 15572 function getControl(field, fallback) { 15573 if (typeof field.Edit === "function") { 15574 return field.Edit; 15575 } 15576 if (typeof field.Edit === "string") { 15577 return getControlByType(field.Edit); 15578 } 15579 if (isEditConfig(field.Edit)) { 15580 return createConfiguredControl(field.Edit); 15581 } 15582 if (hasElements(field) && field.type !== "array") { 15583 return getControlByType("adaptiveSelect"); 15584 } 15585 if (fallback === null) { 15586 return null; 15587 } 15588 return getControlByType(fallback); 15589 } 15590 function getControlByType(type) { 15591 if (Object.keys(FORM_CONTROLS).includes(type)) { 15592 return FORM_CONTROLS[type]; 15593 } 15594 return null; 15595 } 15596 15597 // packages/dataviews/build-module/field-types/utils/get-filter-by.mjs 15598 function getFilterBy(field, defaultOperators, validOperators) { 15599 if (field.filterBy === false) { 15600 return false; 15601 } 15602 const operators = field.filterBy?.operators?.filter( 15603 (op) => validOperators.includes(op) 15604 ) ?? defaultOperators; 15605 if (operators.length === 0) { 15606 return false; 15607 } 15608 return { 15609 isPrimary: !!field.filterBy?.isPrimary, 15610 operators 15611 }; 15612 } 15613 var get_filter_by_default = getFilterBy; 15614 15615 // packages/dataviews/build-module/field-types/utils/get-value-from-id.mjs 15616 var getValueFromId = (id) => ({ item }) => { 15617 const path = id.split("."); 15618 let value = item; 15619 for (const segment of path) { 15620 if (value.hasOwnProperty(segment)) { 15621 value = value[segment]; 15622 } else { 15623 value = void 0; 15624 } 15625 } 15626 return value; 15627 }; 15628 var get_value_from_id_default = getValueFromId; 15629 15630 // packages/dataviews/build-module/field-types/utils/set-value-from-id.mjs 15631 var setValueFromId = (id) => ({ value }) => { 15632 const path = id.split("."); 15633 const result = {}; 15634 let current = result; 15635 for (const segment of path.slice(0, -1)) { 15636 current[segment] = {}; 15637 current = current[segment]; 15638 } 15639 current[path.at(-1)] = value; 15640 return result; 15641 }; 15642 var set_value_from_id_default = setValueFromId; 15643 15644 // packages/dataviews/build-module/field-types/email.mjs 15645 var import_i18n9 = __toESM(require_i18n(), 1); 15646 15647 // packages/dataviews/build-module/field-types/utils/render-from-elements.mjs 15648 function RenderFromElements({ 15649 item, 15650 field 15651 }) { 15652 const { elements, isLoading } = useElements({ 15653 elements: field.elements, 15654 getElements: field.getElements 15655 }); 15656 const value = field.getValue({ item }); 15657 if (isLoading) { 15658 return value; 15659 } 15660 if (elements.length === 0) { 15661 return value; 15662 } 15663 return elements?.find((element) => element.value === value)?.label || field.getValue({ item }); 15664 } 15665 15666 // packages/dataviews/build-module/field-types/utils/render-default.mjs 15667 var import_jsx_runtime64 = __toESM(require_jsx_runtime(), 1); 15668 function render({ 15669 item, 15670 field 15671 }) { 15672 if (field.hasElements) { 15673 return /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(RenderFromElements, { item, field }); 15674 } 15675 return field.getValueFormatted({ item, field }); 15676 } 15677 15678 // packages/dataviews/build-module/field-types/utils/sort-text.mjs 15679 var sort_text_default = (a2, b2, direction) => { 15680 return direction === "asc" ? a2.localeCompare(b2) : b2.localeCompare(a2); 15681 }; 15682 15683 // packages/dataviews/build-module/field-types/utils/is-valid-required.mjs 15684 function isValidRequired(item, field) { 15685 const value = field.getValue({ item }); 15686 return ![void 0, "", null].includes(value); 15687 } 15688 15689 // packages/dataviews/build-module/field-types/utils/is-valid-min-length.mjs 15690 function isValidMinLength(item, field) { 15691 if (typeof field.isValid.minLength?.constraint !== "number") { 15692 return false; 15693 } 15694 const value = field.getValue({ item }); 15695 if ([void 0, "", null].includes(value)) { 15696 return true; 15697 } 15698 return String(value).length >= field.isValid.minLength.constraint; 15699 } 15700 15701 // packages/dataviews/build-module/field-types/utils/is-valid-max-length.mjs 15702 function isValidMaxLength(item, field) { 15703 if (typeof field.isValid.maxLength?.constraint !== "number") { 15704 return false; 15705 } 15706 const value = field.getValue({ item }); 15707 if ([void 0, "", null].includes(value)) { 15708 return true; 15709 } 15710 return String(value).length <= field.isValid.maxLength.constraint; 15711 } 15712 15713 // packages/dataviews/build-module/field-types/utils/is-valid-pattern.mjs 15714 function isValidPattern(item, field) { 15715 if (field.isValid.pattern?.constraint === void 0) { 15716 return true; 15717 } 15718 try { 15719 const regexp = new RegExp(field.isValid.pattern.constraint); 15720 const value = field.getValue({ item }); 15721 if ([void 0, "", null].includes(value)) { 15722 return true; 15723 } 15724 return regexp.test(String(value)); 15725 } catch { 15726 return false; 15727 } 15728 } 15729 15730 // packages/dataviews/build-module/field-types/utils/is-valid-elements.mjs 15731 function isValidElements(item, field) { 15732 const elements = field.elements ?? []; 15733 const validValues = elements.map((el) => el.value); 15734 if (validValues.length === 0) { 15735 return true; 15736 } 15737 const value = field.getValue({ item }); 15738 return [].concat(value).every((v2) => validValues.includes(v2)); 15739 } 15740 15741 // packages/dataviews/build-module/field-types/utils/get-value-formatted-default.mjs 15742 function getValueFormatted({ 15743 item, 15744 field 15745 }) { 15746 return field.getValue({ item }); 15747 } 15748 var get_value_formatted_default_default = getValueFormatted; 15749 15750 // packages/dataviews/build-module/field-types/email.mjs 15751 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])?)*$/; 15752 function isValidCustom(item, field) { 15753 const value = field.getValue({ item }); 15754 if (![void 0, "", null].includes(value) && !emailRegex.test(value)) { 15755 return (0, import_i18n9.__)("Value must be a valid email address."); 15756 } 15757 return null; 15758 } 15759 var email_default = { 15760 type: "email", 15761 render, 15762 Edit: "email", 15763 sort: sort_text_default, 15764 enableSorting: true, 15765 enableGlobalSearch: false, 15766 defaultOperators: [OPERATOR_IS_ANY, OPERATOR_IS_NONE], 15767 validOperators: [ 15768 OPERATOR_IS, 15769 OPERATOR_IS_NOT, 15770 OPERATOR_CONTAINS, 15771 OPERATOR_NOT_CONTAINS, 15772 OPERATOR_STARTS_WITH, 15773 // Multiple selection 15774 OPERATOR_IS_ANY, 15775 OPERATOR_IS_NONE, 15776 OPERATOR_IS_ALL, 15777 OPERATOR_IS_NOT_ALL 15778 ], 15779 format: {}, 15780 getValueFormatted: get_value_formatted_default_default, 15781 validate: { 15782 required: isValidRequired, 15783 pattern: isValidPattern, 15784 minLength: isValidMinLength, 15785 maxLength: isValidMaxLength, 15786 elements: isValidElements, 15787 custom: isValidCustom 15788 } 15789 }; 15790 15791 // packages/dataviews/build-module/field-types/integer.mjs 15792 var import_i18n10 = __toESM(require_i18n(), 1); 15793 15794 // packages/dataviews/build-module/field-types/utils/sort-number.mjs 15795 var sort_number_default = (a2, b2, direction) => { 15796 return direction === "asc" ? a2 - b2 : b2 - a2; 15797 }; 15798 15799 // packages/dataviews/build-module/field-types/utils/is-valid-min.mjs 15800 function isValidMin(item, field) { 15801 if (typeof field.isValid.min?.constraint !== "number") { 15802 return false; 15803 } 15804 const value = field.getValue({ item }); 15805 if ([void 0, "", null].includes(value)) { 15806 return true; 15807 } 15808 return Number(value) >= field.isValid.min.constraint; 15809 } 15810 15811 // packages/dataviews/build-module/field-types/utils/is-valid-max.mjs 15812 function isValidMax(item, field) { 15813 if (typeof field.isValid.max?.constraint !== "number") { 15814 return false; 15815 } 15816 const value = field.getValue({ item }); 15817 if ([void 0, "", null].includes(value)) { 15818 return true; 15819 } 15820 return Number(value) <= field.isValid.max.constraint; 15821 } 15822 15823 // packages/dataviews/build-module/field-types/integer.mjs 15824 var format2 = { 15825 separatorThousand: "," 15826 }; 15827 function getValueFormatted2({ 15828 item, 15829 field 15830 }) { 15831 let value = field.getValue({ item }); 15832 if (value === null || value === void 0) { 15833 return ""; 15834 } 15835 value = Number(value); 15836 if (!Number.isFinite(value)) { 15837 return String(value); 15838 } 15839 let formatInteger; 15840 if (field.type !== "integer") { 15841 formatInteger = format2; 15842 } else { 15843 formatInteger = field.format; 15844 } 15845 const { separatorThousand } = formatInteger; 15846 const integerValue = Math.trunc(value); 15847 if (!separatorThousand) { 15848 return String(integerValue); 15849 } 15850 return String(integerValue).replace( 15851 /\B(?=(\d{3})+(?!\d))/g, 15852 separatorThousand 15853 ); 15854 } 15855 function isValidCustom2(item, field) { 15856 const value = field.getValue({ item }); 15857 if (![void 0, "", null].includes(value) && !Number.isInteger(value)) { 15858 return (0, import_i18n10.__)("Value must be an integer."); 15859 } 15860 return null; 15861 } 15862 var integer_default = { 15863 type: "integer", 15864 render, 15865 Edit: "integer", 15866 sort: sort_number_default, 15867 enableSorting: true, 15868 enableGlobalSearch: false, 15869 defaultOperators: [ 15870 OPERATOR_IS, 15871 OPERATOR_IS_NOT, 15872 OPERATOR_LESS_THAN, 15873 OPERATOR_GREATER_THAN, 15874 OPERATOR_LESS_THAN_OR_EQUAL, 15875 OPERATOR_GREATER_THAN_OR_EQUAL, 15876 OPERATOR_BETWEEN 15877 ], 15878 validOperators: [ 15879 // Single-selection 15880 OPERATOR_IS, 15881 OPERATOR_IS_NOT, 15882 OPERATOR_LESS_THAN, 15883 OPERATOR_GREATER_THAN, 15884 OPERATOR_LESS_THAN_OR_EQUAL, 15885 OPERATOR_GREATER_THAN_OR_EQUAL, 15886 OPERATOR_BETWEEN, 15887 // Multiple-selection 15888 OPERATOR_IS_ANY, 15889 OPERATOR_IS_NONE, 15890 OPERATOR_IS_ALL, 15891 OPERATOR_IS_NOT_ALL 15892 ], 15893 format: format2, 15894 getValueFormatted: getValueFormatted2, 15895 validate: { 15896 required: isValidRequired, 15897 min: isValidMin, 15898 max: isValidMax, 15899 elements: isValidElements, 15900 custom: isValidCustom2 15901 } 15902 }; 15903 15904 // packages/dataviews/build-module/field-types/number.mjs 15905 var import_i18n11 = __toESM(require_i18n(), 1); 15906 var format3 = { 15907 separatorThousand: ",", 15908 separatorDecimal: ".", 15909 decimals: 2 15910 }; 15911 function getValueFormatted3({ 15912 item, 15913 field 15914 }) { 15915 let value = field.getValue({ item }); 15916 if (value === null || value === void 0) { 15917 return ""; 15918 } 15919 value = Number(value); 15920 if (!Number.isFinite(value)) { 15921 return String(value); 15922 } 15923 let formatNumber; 15924 if (field.type !== "number") { 15925 formatNumber = format3; 15926 } else { 15927 formatNumber = field.format; 15928 } 15929 const { separatorThousand, separatorDecimal, decimals } = formatNumber; 15930 const fixedValue = value.toFixed(decimals); 15931 const [integerPart, decimalPart] = fixedValue.split("."); 15932 const formattedInteger = separatorThousand ? integerPart.replace(/\B(?=(\d{3})+(?!\d))/g, separatorThousand) : integerPart; 15933 return decimals === 0 ? formattedInteger : formattedInteger + separatorDecimal + decimalPart; 15934 } 15935 function isEmpty(value) { 15936 return value === "" || value === void 0 || value === null; 15937 } 15938 function isValidCustom3(item, field) { 15939 const value = field.getValue({ item }); 15940 if (!isEmpty(value) && !Number.isFinite(value)) { 15941 return (0, import_i18n11.__)("Value must be a number."); 15942 } 15943 return null; 15944 } 15945 var number_default = { 15946 type: "number", 15947 render, 15948 Edit: "number", 15949 sort: sort_number_default, 15950 enableSorting: true, 15951 enableGlobalSearch: false, 15952 defaultOperators: [ 15953 OPERATOR_IS, 15954 OPERATOR_IS_NOT, 15955 OPERATOR_LESS_THAN, 15956 OPERATOR_GREATER_THAN, 15957 OPERATOR_LESS_THAN_OR_EQUAL, 15958 OPERATOR_GREATER_THAN_OR_EQUAL, 15959 OPERATOR_BETWEEN 15960 ], 15961 validOperators: [ 15962 // Single-selection 15963 OPERATOR_IS, 15964 OPERATOR_IS_NOT, 15965 OPERATOR_LESS_THAN, 15966 OPERATOR_GREATER_THAN, 15967 OPERATOR_LESS_THAN_OR_EQUAL, 15968 OPERATOR_GREATER_THAN_OR_EQUAL, 15969 OPERATOR_BETWEEN, 15970 // Multiple-selection 15971 OPERATOR_IS_ANY, 15972 OPERATOR_IS_NONE, 15973 OPERATOR_IS_ALL, 15974 OPERATOR_IS_NOT_ALL 15975 ], 15976 format: format3, 15977 getValueFormatted: getValueFormatted3, 15978 validate: { 15979 required: isValidRequired, 15980 min: isValidMin, 15981 max: isValidMax, 15982 elements: isValidElements, 15983 custom: isValidCustom3 15984 } 15985 }; 15986 15987 // packages/dataviews/build-module/field-types/text.mjs 15988 var text_default = { 15989 type: "text", 15990 render, 15991 Edit: "text", 15992 sort: sort_text_default, 15993 enableSorting: true, 15994 enableGlobalSearch: false, 15995 defaultOperators: [OPERATOR_IS_ANY, OPERATOR_IS_NONE], 15996 validOperators: [ 15997 // Single selection 15998 OPERATOR_IS, 15999 OPERATOR_IS_NOT, 16000 OPERATOR_CONTAINS, 16001 OPERATOR_NOT_CONTAINS, 16002 OPERATOR_STARTS_WITH, 16003 // Multiple selection 16004 OPERATOR_IS_ANY, 16005 OPERATOR_IS_NONE, 16006 OPERATOR_IS_ALL, 16007 OPERATOR_IS_NOT_ALL 16008 ], 16009 format: {}, 16010 getValueFormatted: get_value_formatted_default_default, 16011 validate: { 16012 required: isValidRequired, 16013 pattern: isValidPattern, 16014 minLength: isValidMinLength, 16015 maxLength: isValidMaxLength, 16016 elements: isValidElements 16017 } 16018 }; 16019 16020 // packages/dataviews/build-module/field-types/datetime.mjs 16021 var import_date7 = __toESM(require_date(), 1); 16022 16023 // packages/dataviews/build-module/field-types/utils/is-valid-date-boundary.mjs 16024 var import_date6 = __toESM(require_date(), 1); 16025 function parseDateLike(value) { 16026 if (!value) { 16027 return null; 16028 } 16029 if (!isValid(new Date(value))) { 16030 return null; 16031 } 16032 const parsed = (0, import_date6.getDate)(value); 16033 return parsed && isValid(parsed) ? parsed : null; 16034 } 16035 function validateDateLikeBoundary(item, field, boundary) { 16036 const constraint = field.isValid[boundary]?.constraint; 16037 if (typeof constraint !== "string") { 16038 return false; 16039 } 16040 const value = field.getValue({ item }); 16041 const boundaryValue = Array.isArray(value) ? value[boundary === "min" ? 0 : value.length - 1] : value; 16042 if (boundaryValue === void 0 || boundaryValue === null || boundaryValue === "") { 16043 return true; 16044 } 16045 const parsedConstraint = parseDateLike(constraint); 16046 const parsedValue = parseDateLike(String(boundaryValue)); 16047 return !!parsedConstraint && !!parsedValue && (boundary === "min" ? parsedValue.getTime() >= parsedConstraint.getTime() : parsedValue.getTime() <= parsedConstraint.getTime()); 16048 } 16049 function isValidMinDate(item, field) { 16050 return validateDateLikeBoundary(item, field, "min"); 16051 } 16052 function isValidMaxDate(item, field) { 16053 return validateDateLikeBoundary(item, field, "max"); 16054 } 16055 16056 // packages/dataviews/build-module/field-types/datetime.mjs 16057 var format4 = { 16058 datetime: (0, import_date7.getSettings)().formats.datetime, 16059 weekStartsOn: (0, import_date7.getSettings)().l10n.startOfWeek 16060 }; 16061 function getValueFormatted4({ 16062 item, 16063 field 16064 }) { 16065 const value = field.getValue({ item }); 16066 if (["", void 0, null].includes(value)) { 16067 return ""; 16068 } 16069 let formatDatetime; 16070 if (field.type !== "datetime") { 16071 formatDatetime = format4; 16072 } else { 16073 formatDatetime = field.format; 16074 } 16075 return (0, import_date7.dateI18n)(formatDatetime.datetime, (0, import_date7.getDate)(value)); 16076 } 16077 var sort = (a2, b2, direction) => { 16078 const timeA = new Date(a2).getTime(); 16079 const timeB = new Date(b2).getTime(); 16080 return direction === "asc" ? timeA - timeB : timeB - timeA; 16081 }; 16082 var datetime_default = { 16083 type: "datetime", 16084 render, 16085 Edit: "datetime", 16086 sort, 16087 enableSorting: true, 16088 enableGlobalSearch: false, 16089 defaultOperators: [ 16090 OPERATOR_ON, 16091 OPERATOR_NOT_ON, 16092 OPERATOR_BEFORE, 16093 OPERATOR_AFTER, 16094 OPERATOR_BEFORE_INC, 16095 OPERATOR_AFTER_INC, 16096 OPERATOR_IN_THE_PAST, 16097 OPERATOR_OVER 16098 ], 16099 validOperators: [ 16100 OPERATOR_ON, 16101 OPERATOR_NOT_ON, 16102 OPERATOR_BEFORE, 16103 OPERATOR_AFTER, 16104 OPERATOR_BEFORE_INC, 16105 OPERATOR_AFTER_INC, 16106 OPERATOR_IN_THE_PAST, 16107 OPERATOR_OVER 16108 ], 16109 format: format4, 16110 getValueFormatted: getValueFormatted4, 16111 validate: { 16112 required: isValidRequired, 16113 elements: isValidElements, 16114 min: isValidMinDate, 16115 max: isValidMaxDate 16116 } 16117 }; 16118 16119 // packages/dataviews/build-module/field-types/date.mjs 16120 var import_date8 = __toESM(require_date(), 1); 16121 var format5 = { 16122 date: (0, import_date8.getSettings)().formats.date, 16123 weekStartsOn: (0, import_date8.getSettings)().l10n.startOfWeek 16124 }; 16125 function getValueFormatted5({ 16126 item, 16127 field 16128 }) { 16129 const value = field.getValue({ item }); 16130 if (["", void 0, null].includes(value)) { 16131 return ""; 16132 } 16133 let formatDate2; 16134 if (field.type !== "date") { 16135 formatDate2 = format5; 16136 } else { 16137 formatDate2 = field.format; 16138 } 16139 return (0, import_date8.dateI18n)(formatDate2.date, (0, import_date8.getDate)(value)); 16140 } 16141 var sort2 = (a2, b2, direction) => { 16142 const timeA = new Date(a2).getTime(); 16143 const timeB = new Date(b2).getTime(); 16144 return direction === "asc" ? timeA - timeB : timeB - timeA; 16145 }; 16146 var date_default = { 16147 type: "date", 16148 render, 16149 Edit: "date", 16150 sort: sort2, 16151 enableSorting: true, 16152 enableGlobalSearch: false, 16153 defaultOperators: [ 16154 OPERATOR_ON, 16155 OPERATOR_NOT_ON, 16156 OPERATOR_BEFORE, 16157 OPERATOR_AFTER, 16158 OPERATOR_BEFORE_INC, 16159 OPERATOR_AFTER_INC, 16160 OPERATOR_IN_THE_PAST, 16161 OPERATOR_OVER, 16162 OPERATOR_BETWEEN 16163 ], 16164 validOperators: [ 16165 OPERATOR_ON, 16166 OPERATOR_NOT_ON, 16167 OPERATOR_BEFORE, 16168 OPERATOR_AFTER, 16169 OPERATOR_BEFORE_INC, 16170 OPERATOR_AFTER_INC, 16171 OPERATOR_IN_THE_PAST, 16172 OPERATOR_OVER, 16173 OPERATOR_BETWEEN 16174 ], 16175 format: format5, 16176 getValueFormatted: getValueFormatted5, 16177 validate: { 16178 required: isValidRequired, 16179 elements: isValidElements, 16180 min: isValidMinDate, 16181 max: isValidMaxDate 16182 } 16183 }; 16184 16185 // packages/dataviews/build-module/field-types/boolean.mjs 16186 var import_i18n12 = __toESM(require_i18n(), 1); 16187 16188 // packages/dataviews/build-module/field-types/utils/is-valid-required-for-bool.mjs 16189 function isValidRequiredForBool(item, field) { 16190 const value = field.getValue({ item }); 16191 return value === true; 16192 } 16193 16194 // packages/dataviews/build-module/field-types/boolean.mjs 16195 function getValueFormatted6({ 16196 item, 16197 field 16198 }) { 16199 const value = field.getValue({ item }); 16200 if (value === true) { 16201 return (0, import_i18n12.__)("True"); 16202 } 16203 if (value === false) { 16204 return (0, import_i18n12.__)("False"); 16205 } 16206 return ""; 16207 } 16208 function isValidCustom4(item, field) { 16209 const value = field.getValue({ item }); 16210 if (![void 0, "", null].includes(value) && ![true, false].includes(value)) { 16211 return (0, import_i18n12.__)("Value must be true, false, or undefined"); 16212 } 16213 return null; 16214 } 16215 var sort3 = (a2, b2, direction) => { 16216 const boolA = Boolean(a2); 16217 const boolB = Boolean(b2); 16218 if (boolA === boolB) { 16219 return 0; 16220 } 16221 if (direction === "asc") { 16222 return boolA ? 1 : -1; 16223 } 16224 return boolA ? -1 : 1; 16225 }; 16226 var boolean_default = { 16227 type: "boolean", 16228 render, 16229 Edit: "checkbox", 16230 sort: sort3, 16231 validate: { 16232 required: isValidRequiredForBool, 16233 elements: isValidElements, 16234 custom: isValidCustom4 16235 }, 16236 enableSorting: true, 16237 enableGlobalSearch: false, 16238 defaultOperators: [OPERATOR_IS, OPERATOR_IS_NOT], 16239 validOperators: [OPERATOR_IS, OPERATOR_IS_NOT], 16240 format: {}, 16241 getValueFormatted: getValueFormatted6 16242 }; 16243 16244 // packages/dataviews/build-module/field-types/media.mjs 16245 var media_default = { 16246 type: "media", 16247 render: () => null, 16248 Edit: null, 16249 sort: () => 0, 16250 enableSorting: false, 16251 enableGlobalSearch: false, 16252 defaultOperators: [], 16253 validOperators: [], 16254 format: {}, 16255 getValueFormatted: get_value_formatted_default_default, 16256 // cannot validate any constraint, so 16257 // the only available validation for the field author 16258 // would be providing a custom validator. 16259 validate: {} 16260 }; 16261 16262 // packages/dataviews/build-module/field-types/array.mjs 16263 var import_i18n13 = __toESM(require_i18n(), 1); 16264 16265 // packages/dataviews/build-module/field-types/utils/is-valid-required-for-array.mjs 16266 function isValidRequiredForArray(item, field) { 16267 const value = field.getValue({ item }); 16268 return Array.isArray(value) && value.length > 0 && value.every( 16269 (element) => ![void 0, "", null].includes(element) 16270 ); 16271 } 16272 16273 // packages/dataviews/build-module/field-types/array.mjs 16274 function getValueFormatted7({ 16275 item, 16276 field 16277 }) { 16278 const value = field.getValue({ item }); 16279 const arr = Array.isArray(value) ? value : []; 16280 return arr.join(", "); 16281 } 16282 function render2({ item, field }) { 16283 return getValueFormatted7({ item, field }); 16284 } 16285 function isValidCustom5(item, field) { 16286 const value = field.getValue({ item }); 16287 if (![void 0, "", null].includes(value) && !Array.isArray(value)) { 16288 return (0, import_i18n13.__)("Value must be an array."); 16289 } 16290 if (!value.every((v2) => typeof v2 === "string")) { 16291 return (0, import_i18n13.__)("Every value must be a string."); 16292 } 16293 return null; 16294 } 16295 var sort4 = (a2, b2, direction) => { 16296 const arrA = Array.isArray(a2) ? a2 : []; 16297 const arrB = Array.isArray(b2) ? b2 : []; 16298 if (arrA.length !== arrB.length) { 16299 return direction === "asc" ? arrA.length - arrB.length : arrB.length - arrA.length; 16300 } 16301 const joinedA = arrA.join(","); 16302 const joinedB = arrB.join(","); 16303 return direction === "asc" ? joinedA.localeCompare(joinedB) : joinedB.localeCompare(joinedA); 16304 }; 16305 var array_default = { 16306 type: "array", 16307 render: render2, 16308 Edit: "array", 16309 sort: sort4, 16310 enableSorting: true, 16311 enableGlobalSearch: false, 16312 defaultOperators: [OPERATOR_IS_ANY, OPERATOR_IS_NONE], 16313 validOperators: [ 16314 OPERATOR_IS_ANY, 16315 OPERATOR_IS_NONE, 16316 OPERATOR_IS_ALL, 16317 OPERATOR_IS_NOT_ALL 16318 ], 16319 format: {}, 16320 getValueFormatted: getValueFormatted7, 16321 validate: { 16322 required: isValidRequiredForArray, 16323 elements: isValidElements, 16324 custom: isValidCustom5 16325 } 16326 }; 16327 16328 // packages/dataviews/build-module/field-types/password.mjs 16329 function getValueFormatted8({ 16330 item, 16331 field 16332 }) { 16333 return field.getValue({ item }) ? "\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022" : ""; 16334 } 16335 var password_default = { 16336 type: "password", 16337 render, 16338 Edit: "password", 16339 sort: () => 0, 16340 // Passwords should not be sortable for security reasons 16341 enableSorting: false, 16342 enableGlobalSearch: false, 16343 defaultOperators: [], 16344 validOperators: [], 16345 format: {}, 16346 getValueFormatted: getValueFormatted8, 16347 validate: { 16348 required: isValidRequired, 16349 pattern: isValidPattern, 16350 minLength: isValidMinLength, 16351 maxLength: isValidMaxLength, 16352 elements: isValidElements 16353 } 16354 }; 16355 16356 // packages/dataviews/build-module/field-types/telephone.mjs 16357 var telephone_default = { 16358 type: "telephone", 16359 render, 16360 Edit: "telephone", 16361 sort: sort_text_default, 16362 enableSorting: true, 16363 enableGlobalSearch: false, 16364 defaultOperators: [OPERATOR_IS_ANY, OPERATOR_IS_NONE], 16365 validOperators: [ 16366 OPERATOR_IS, 16367 OPERATOR_IS_NOT, 16368 OPERATOR_CONTAINS, 16369 OPERATOR_NOT_CONTAINS, 16370 OPERATOR_STARTS_WITH, 16371 // Multiple selection 16372 OPERATOR_IS_ANY, 16373 OPERATOR_IS_NONE, 16374 OPERATOR_IS_ALL, 16375 OPERATOR_IS_NOT_ALL 16376 ], 16377 format: {}, 16378 getValueFormatted: get_value_formatted_default_default, 16379 validate: { 16380 required: isValidRequired, 16381 pattern: isValidPattern, 16382 minLength: isValidMinLength, 16383 maxLength: isValidMaxLength, 16384 elements: isValidElements 16385 } 16386 }; 16387 16388 // packages/dataviews/build-module/field-types/color.mjs 16389 var import_i18n14 = __toESM(require_i18n(), 1); 16390 var import_jsx_runtime65 = __toESM(require_jsx_runtime(), 1); 16391 function render3({ item, field }) { 16392 if (field.hasElements) { 16393 return /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(RenderFromElements, { item, field }); 16394 } 16395 const value = get_value_formatted_default_default({ item, field }); 16396 if (!value || !w(value).isValid()) { 16397 return value; 16398 } 16399 return /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: "8px" }, children: [ 16400 /* @__PURE__ */ (0, import_jsx_runtime65.jsx)( 16401 "div", 16402 { 16403 style: { 16404 width: "16px", 16405 height: "16px", 16406 borderRadius: "50%", 16407 backgroundColor: value, 16408 border: "1px solid #ddd", 16409 flexShrink: 0 16410 } 16411 } 16412 ), 16413 /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("span", { children: value }) 16414 ] }); 16415 } 16416 function isValidCustom6(item, field) { 16417 const value = field.getValue({ item }); 16418 if (![void 0, "", null].includes(value) && !w(value).isValid()) { 16419 return (0, import_i18n14.__)("Value must be a valid color."); 16420 } 16421 return null; 16422 } 16423 var sort5 = (a2, b2, direction) => { 16424 const colorA = w(a2); 16425 const colorB = w(b2); 16426 if (!colorA.isValid() && !colorB.isValid()) { 16427 return 0; 16428 } 16429 if (!colorA.isValid()) { 16430 return direction === "asc" ? 1 : -1; 16431 } 16432 if (!colorB.isValid()) { 16433 return direction === "asc" ? -1 : 1; 16434 } 16435 const hslA = colorA.toHsl(); 16436 const hslB = colorB.toHsl(); 16437 if (hslA.h !== hslB.h) { 16438 return direction === "asc" ? hslA.h - hslB.h : hslB.h - hslA.h; 16439 } 16440 if (hslA.s !== hslB.s) { 16441 return direction === "asc" ? hslA.s - hslB.s : hslB.s - hslA.s; 16442 } 16443 return direction === "asc" ? hslA.l - hslB.l : hslB.l - hslA.l; 16444 }; 16445 var color_default = { 16446 type: "color", 16447 render: render3, 16448 Edit: "color", 16449 sort: sort5, 16450 enableSorting: true, 16451 enableGlobalSearch: false, 16452 defaultOperators: [OPERATOR_IS_ANY, OPERATOR_IS_NONE], 16453 validOperators: [ 16454 OPERATOR_IS, 16455 OPERATOR_IS_NOT, 16456 OPERATOR_IS_ANY, 16457 OPERATOR_IS_NONE 16458 ], 16459 format: {}, 16460 getValueFormatted: get_value_formatted_default_default, 16461 validate: { 16462 required: isValidRequired, 16463 elements: isValidElements, 16464 custom: isValidCustom6 16465 } 16466 }; 16467 16468 // packages/dataviews/build-module/field-types/url.mjs 16469 var url_default = { 16470 type: "url", 16471 render, 16472 Edit: "url", 16473 sort: sort_text_default, 16474 enableSorting: true, 16475 enableGlobalSearch: false, 16476 defaultOperators: [OPERATOR_IS_ANY, OPERATOR_IS_NONE], 16477 validOperators: [ 16478 OPERATOR_IS, 16479 OPERATOR_IS_NOT, 16480 OPERATOR_CONTAINS, 16481 OPERATOR_NOT_CONTAINS, 16482 OPERATOR_STARTS_WITH, 16483 // Multiple selection 16484 OPERATOR_IS_ANY, 16485 OPERATOR_IS_NONE, 16486 OPERATOR_IS_ALL, 16487 OPERATOR_IS_NOT_ALL 16488 ], 16489 format: {}, 16490 getValueFormatted: get_value_formatted_default_default, 16491 validate: { 16492 required: isValidRequired, 16493 pattern: isValidPattern, 16494 minLength: isValidMinLength, 16495 maxLength: isValidMaxLength, 16496 elements: isValidElements 16497 } 16498 }; 16499 16500 // packages/dataviews/build-module/field-types/no-type.mjs 16501 var sort6 = (a2, b2, direction) => { 16502 if (typeof a2 === "number" && typeof b2 === "number") { 16503 return sort_number_default(a2, b2, direction); 16504 } 16505 return sort_text_default(a2, b2, direction); 16506 }; 16507 var no_type_default = { 16508 // type: no type for this one 16509 render, 16510 Edit: null, 16511 sort: sort6, 16512 enableSorting: true, 16513 enableGlobalSearch: false, 16514 defaultOperators: [OPERATOR_IS, OPERATOR_IS_NOT], 16515 validOperators: getAllOperatorNames(), 16516 format: {}, 16517 getValueFormatted: get_value_formatted_default_default, 16518 validate: { 16519 required: isValidRequired, 16520 elements: isValidElements 16521 } 16522 }; 16523 16524 // packages/dataviews/build-module/field-types/utils/get-is-valid.mjs 16525 function supportsNumericRangeConstraint(type) { 16526 return type === "integer" || type === "number"; 16527 } 16528 function supportsDateRangeConstraint(type) { 16529 return type === "date" || type === "datetime"; 16530 } 16531 function normalizeRangeRule(value, fieldType, key) { 16532 const validator = fieldType.validate[key]; 16533 if (validator && (typeof value === "number" && supportsNumericRangeConstraint(fieldType.type) || typeof value === "string" && supportsDateRangeConstraint(fieldType.type))) { 16534 return { constraint: value, validate: validator }; 16535 } 16536 return void 0; 16537 } 16538 function getIsValid(field, fieldType) { 16539 const rules = field.isValid; 16540 let required; 16541 if (rules?.required === true && fieldType.validate.required !== void 0) { 16542 required = { 16543 constraint: true, 16544 validate: fieldType.validate.required 16545 }; 16546 } 16547 let elements; 16548 if ((rules?.elements === true || // elements is enabled unless the field opts-out 16549 rules?.elements === void 0 && (!!field.elements || !!field.getElements)) && fieldType.validate.elements !== void 0) { 16550 elements = { 16551 constraint: true, 16552 validate: fieldType.validate.elements 16553 }; 16554 } 16555 const min2 = normalizeRangeRule(rules?.min, fieldType, "min"); 16556 const max2 = normalizeRangeRule(rules?.max, fieldType, "max"); 16557 const minLengthValue = rules?.minLength; 16558 let minLength; 16559 if (typeof minLengthValue === "number" && fieldType.validate.minLength !== void 0) { 16560 minLength = { 16561 constraint: minLengthValue, 16562 validate: fieldType.validate.minLength 16563 }; 16564 } 16565 const maxLengthValue = rules?.maxLength; 16566 let maxLength; 16567 if (typeof maxLengthValue === "number" && fieldType.validate.maxLength !== void 0) { 16568 maxLength = { 16569 constraint: maxLengthValue, 16570 validate: fieldType.validate.maxLength 16571 }; 16572 } 16573 const patternValue = rules?.pattern; 16574 let pattern; 16575 if (patternValue !== void 0 && fieldType.validate.pattern !== void 0) { 16576 pattern = { 16577 constraint: patternValue, 16578 validate: fieldType.validate.pattern 16579 }; 16580 } 16581 const custom = rules?.custom ?? fieldType.validate.custom; 16582 return { 16583 required, 16584 elements, 16585 min: min2, 16586 max: max2, 16587 minLength, 16588 maxLength, 16589 pattern, 16590 custom 16591 }; 16592 } 16593 16594 // packages/dataviews/build-module/field-types/utils/get-filter.mjs 16595 function getFilter(fieldType) { 16596 return fieldType.validOperators.reduce((accumulator, operator) => { 16597 const operatorObj = getOperatorByName(operator); 16598 if (operatorObj?.filter) { 16599 accumulator[operator] = operatorObj.filter; 16600 } 16601 return accumulator; 16602 }, {}); 16603 } 16604 16605 // packages/dataviews/build-module/field-types/utils/get-format.mjs 16606 function getFormat(field, fieldType) { 16607 return { 16608 ...fieldType.format, 16609 ...field.format 16610 }; 16611 } 16612 var get_format_default = getFormat; 16613 16614 // packages/dataviews/build-module/field-types/index.mjs 16615 function getFieldTypeByName(type) { 16616 const found = [ 16617 email_default, 16618 integer_default, 16619 number_default, 16620 text_default, 16621 datetime_default, 16622 date_default, 16623 boolean_default, 16624 media_default, 16625 array_default, 16626 password_default, 16627 telephone_default, 16628 color_default, 16629 url_default 16630 ].find((fieldType) => fieldType?.type === type); 16631 if (!!found) { 16632 return found; 16633 } 16634 return no_type_default; 16635 } 16636 function normalizeFields(fields) { 16637 return fields.map((field) => { 16638 const fieldType = getFieldTypeByName(field.type); 16639 const getValue = field.getValue || get_value_from_id_default(field.id); 16640 const sort7 = function(a2, b2, direction) { 16641 const aValue = getValue({ item: a2 }); 16642 const bValue = getValue({ item: b2 }); 16643 return field.sort ? field.sort(aValue, bValue, direction) : fieldType.sort(aValue, bValue, direction); 16644 }; 16645 return { 16646 id: field.id, 16647 label: field.label || field.id, 16648 header: field.header || field.label || field.id, 16649 description: field.description, 16650 placeholder: field.placeholder, 16651 getValue, 16652 setValue: field.setValue || set_value_from_id_default(field.id), 16653 elements: field.elements, 16654 getElements: field.getElements, 16655 hasElements: hasElements(field), 16656 isVisible: field.isVisible, 16657 isDisabled: typeof field.isDisabled === "function" ? field.isDisabled : () => !!field.isDisabled, 16658 enableHiding: field.enableHiding ?? true, 16659 readOnly: field.readOnly ?? false, 16660 // The type provides defaults for the following props 16661 type: fieldType.type, 16662 render: field.render ?? fieldType.render, 16663 Edit: getControl(field, fieldType.Edit), 16664 sort: sort7, 16665 enableSorting: field.enableSorting ?? fieldType.enableSorting, 16666 enableGlobalSearch: field.enableGlobalSearch ?? fieldType.enableGlobalSearch, 16667 isValid: getIsValid(field, fieldType), 16668 filterBy: get_filter_by_default( 16669 field, 16670 fieldType.defaultOperators, 16671 fieldType.validOperators 16672 ), 16673 filter: getFilter(fieldType), 16674 format: get_format_default(field, fieldType), 16675 getValueFormatted: field.getValueFormatted ?? fieldType.getValueFormatted 16676 }; 16677 }); 16678 } 16679 16680 // packages/dataviews/build-module/dataform/index.mjs 16681 var import_element62 = __toESM(require_element(), 1); 16682 16683 // packages/dataviews/build-module/components/dataform-context/index.mjs 16684 var import_element51 = __toESM(require_element(), 1); 16685 var import_jsx_runtime66 = __toESM(require_jsx_runtime(), 1); 16686 var DataFormContext = (0, import_element51.createContext)({ 16687 fields: [] 16688 }); 16689 DataFormContext.displayName = "DataFormContext"; 16690 function DataFormProvider({ 16691 fields, 16692 children 16693 }) { 16694 return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(DataFormContext.Provider, { value: { fields }, children }); 16695 } 16696 var dataform_context_default = DataFormContext; 16697 16698 // packages/dataviews/build-module/components/dataform-layouts/data-form-layout.mjs 16699 var import_element61 = __toESM(require_element(), 1); 16700 16701 // packages/dataviews/build-module/components/dataform-layouts/regular/index.mjs 16702 var import_element52 = __toESM(require_element(), 1); 16703 var import_components20 = __toESM(require_components(), 1); 16704 16705 // packages/dataviews/build-module/components/dataform-layouts/normalize-form.mjs 16706 var import_i18n15 = __toESM(require_i18n(), 1); 16707 var DEFAULT_LAYOUT = { 16708 type: "regular", 16709 labelPosition: "top" 16710 }; 16711 var normalizeCardSummaryField = (sum) => { 16712 if (typeof sum === "string") { 16713 return [{ id: sum, visibility: "when-collapsed" }]; 16714 } 16715 return sum.map((item) => { 16716 if (typeof item === "string") { 16717 return { id: item, visibility: "when-collapsed" }; 16718 } 16719 return { id: item.id, visibility: item.visibility }; 16720 }); 16721 }; 16722 function normalizeLayout(layout) { 16723 let normalizedLayout = DEFAULT_LAYOUT; 16724 if (layout?.type === "regular") { 16725 normalizedLayout = { 16726 type: "regular", 16727 labelPosition: layout?.labelPosition ?? "top" 16728 }; 16729 } else if (layout?.type === "panel") { 16730 const summary = layout.summary ?? []; 16731 const normalizedSummary = Array.isArray(summary) ? summary : [summary]; 16732 const openAs = layout?.openAs; 16733 let normalizedOpenAs; 16734 if (typeof openAs === "object" && openAs.type === "modal") { 16735 normalizedOpenAs = { 16736 type: "modal", 16737 applyLabel: openAs.applyLabel?.trim() || (0, import_i18n15.__)("Apply"), 16738 cancelLabel: openAs.cancelLabel?.trim() || (0, import_i18n15.__)("Cancel") 16739 }; 16740 } else if (openAs === "modal") { 16741 normalizedOpenAs = { 16742 type: "modal", 16743 applyLabel: (0, import_i18n15.__)("Apply"), 16744 cancelLabel: (0, import_i18n15.__)("Cancel") 16745 }; 16746 } else { 16747 normalizedOpenAs = { type: "dropdown" }; 16748 } 16749 normalizedLayout = { 16750 type: "panel", 16751 labelPosition: layout?.labelPosition ?? "side", 16752 openAs: normalizedOpenAs, 16753 summary: normalizedSummary, 16754 editVisibility: layout?.editVisibility ?? "on-hover" 16755 }; 16756 } else if (layout?.type === "card") { 16757 if (layout.withHeader === false) { 16758 normalizedLayout = { 16759 type: "card", 16760 withHeader: false, 16761 isOpened: true, 16762 summary: [], 16763 isCollapsible: false 16764 }; 16765 } else { 16766 const summary = layout.summary ?? []; 16767 normalizedLayout = { 16768 type: "card", 16769 withHeader: true, 16770 isOpened: typeof layout.isOpened === "boolean" ? layout.isOpened : true, 16771 summary: normalizeCardSummaryField(summary), 16772 isCollapsible: layout.isCollapsible === void 0 ? true : layout.isCollapsible 16773 }; 16774 } 16775 } else if (layout?.type === "row") { 16776 normalizedLayout = { 16777 type: "row", 16778 alignment: layout?.alignment ?? "center", 16779 styles: layout?.styles ?? {} 16780 }; 16781 } else if (layout?.type === "details") { 16782 normalizedLayout = { 16783 type: "details", 16784 summary: layout?.summary ?? "" 16785 }; 16786 } 16787 return normalizedLayout; 16788 } 16789 function normalizeForm(form) { 16790 const normalizedFormLayout = normalizeLayout(form?.layout); 16791 const normalizedFields = (form.fields ?? []).map( 16792 (field) => { 16793 if (typeof field === "string") { 16794 return { 16795 id: field, 16796 layout: normalizedFormLayout 16797 }; 16798 } 16799 const fieldLayout = field.layout ? normalizeLayout(field.layout) : normalizedFormLayout; 16800 return { 16801 id: field.id, 16802 layout: fieldLayout, 16803 ...!!field.label && { label: field.label }, 16804 ...!!field.description && { 16805 description: field.description 16806 }, 16807 ..."children" in field && Array.isArray(field.children) && { 16808 children: normalizeForm({ 16809 fields: field.children, 16810 layout: DEFAULT_LAYOUT 16811 }).fields 16812 } 16813 }; 16814 } 16815 ); 16816 return { 16817 layout: normalizedFormLayout, 16818 fields: normalizedFields 16819 }; 16820 } 16821 var normalize_form_default = normalizeForm; 16822 16823 // packages/dataviews/build-module/components/dataform-layouts/regular/index.mjs 16824 var import_jsx_runtime67 = __toESM(require_jsx_runtime(), 1); 16825 function Header4({ title }) { 16826 return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)( 16827 Stack, 16828 { 16829 direction: "column", 16830 className: "dataforms-layouts-regular__header", 16831 gap: "lg", 16832 children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Stack, { direction: "row", align: "center", children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(import_components20.__experimentalHeading, { level: 2, size: 13, children: title }) }) 16833 } 16834 ); 16835 } 16836 function FormRegularField({ 16837 data, 16838 field, 16839 onChange, 16840 hideLabelFromVision, 16841 markWhenOptional, 16842 validity 16843 }) { 16844 const { fields } = (0, import_element52.useContext)(dataform_context_default); 16845 const layout = field.layout; 16846 const form = (0, import_element52.useMemo)( 16847 () => ({ 16848 layout: DEFAULT_LAYOUT, 16849 fields: !!field.children ? field.children : [] 16850 }), 16851 [field] 16852 ); 16853 if (!!field.children) { 16854 return /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)(import_jsx_runtime67.Fragment, { children: [ 16855 !hideLabelFromVision && field.label && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Header4, { title: field.label }), 16856 /* @__PURE__ */ (0, import_jsx_runtime67.jsx)( 16857 DataFormLayout, 16858 { 16859 data, 16860 form, 16861 onChange, 16862 validity: validity?.children 16863 } 16864 ) 16865 ] }); 16866 } 16867 const labelPosition = layout.labelPosition; 16868 const fieldDefinition = fields.find( 16869 (fieldDef) => fieldDef.id === field.id 16870 ); 16871 if (!fieldDefinition || !fieldDefinition.Edit) { 16872 return null; 16873 } 16874 if (labelPosition === "side") { 16875 return /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)( 16876 Stack, 16877 { 16878 direction: "row", 16879 className: "dataforms-layouts-regular__field", 16880 gap: "sm", 16881 children: [ 16882 /* @__PURE__ */ (0, import_jsx_runtime67.jsx)( 16883 "div", 16884 { 16885 className: clsx_default( 16886 "dataforms-layouts-regular__field-label", 16887 `dataforms-layouts-regular__field-label--label-position-$labelPosition}` 16888 ), 16889 children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(import_components20.BaseControl.VisualLabel, { children: fieldDefinition.label }) 16890 } 16891 ), 16892 /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("div", { className: "dataforms-layouts-regular__field-control", children: fieldDefinition.readOnly === true ? /* @__PURE__ */ (0, import_jsx_runtime67.jsx)( 16893 fieldDefinition.render, 16894 { 16895 item: data, 16896 field: fieldDefinition 16897 } 16898 ) : /* @__PURE__ */ (0, import_jsx_runtime67.jsx)( 16899 fieldDefinition.Edit, 16900 { 16901 data, 16902 field: fieldDefinition, 16903 onChange, 16904 hideLabelFromVision: true, 16905 markWhenOptional, 16906 validity 16907 }, 16908 fieldDefinition.id 16909 ) }) 16910 ] 16911 } 16912 ); 16913 } 16914 return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("div", { className: "dataforms-layouts-regular__field", children: fieldDefinition.readOnly === true ? /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(import_jsx_runtime67.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)(import_jsx_runtime67.Fragment, { children: [ 16915 !hideLabelFromVision && labelPosition !== "none" && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(import_components20.BaseControl.VisualLabel, { children: fieldDefinition.label }), 16916 /* @__PURE__ */ (0, import_jsx_runtime67.jsx)( 16917 fieldDefinition.render, 16918 { 16919 item: data, 16920 field: fieldDefinition 16921 } 16922 ) 16923 ] }) }) : /* @__PURE__ */ (0, import_jsx_runtime67.jsx)( 16924 fieldDefinition.Edit, 16925 { 16926 data, 16927 field: fieldDefinition, 16928 onChange, 16929 hideLabelFromVision: labelPosition === "none" ? true : hideLabelFromVision, 16930 markWhenOptional, 16931 validity 16932 } 16933 ) }); 16934 } 16935 16936 // packages/dataviews/build-module/components/dataform-layouts/panel/modal.mjs 16937 var import_deepmerge2 = __toESM(require_cjs(), 1); 16938 var import_components23 = __toESM(require_components(), 1); 16939 var import_element57 = __toESM(require_element(), 1); 16940 var import_compose2 = __toESM(require_compose(), 1); 16941 16942 // packages/dataviews/build-module/components/dataform-layouts/panel/summary-button.mjs 16943 var import_components22 = __toESM(require_components(), 1); 16944 var import_i18n16 = __toESM(require_i18n(), 1); 16945 var import_compose = __toESM(require_compose(), 1); 16946 var import_element53 = __toESM(require_element(), 1); 16947 16948 // packages/dataviews/build-module/components/dataform-layouts/panel/utils/get-label-classname.mjs 16949 function getLabelClassName(labelPosition, showError) { 16950 return clsx_default( 16951 "dataforms-layouts-panel__field-label", 16952 `dataforms-layouts-panel__field-label--label-position-$labelPosition}`, 16953 { "has-error": showError } 16954 ); 16955 } 16956 var get_label_classname_default = getLabelClassName; 16957 16958 // packages/dataviews/build-module/components/dataform-layouts/panel/utils/get-label-content.mjs 16959 var import_components21 = __toESM(require_components(), 1); 16960 var import_jsx_runtime68 = __toESM(require_jsx_runtime(), 1); 16961 function getLabelContent(showError, errorMessage, fieldLabel) { 16962 return showError ? /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)(tooltip_exports.Root, { children: [ 16963 /* @__PURE__ */ (0, import_jsx_runtime68.jsx)( 16964 tooltip_exports.Trigger, 16965 { 16966 render: /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)("span", { className: "dataforms-layouts-panel__field-label-error-content", children: [ 16967 /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(import_components21.Icon, { icon: error_default, size: 16 }), 16968 /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)(VisuallyHidden, { children: [ 16969 errorMessage, 16970 ": " 16971 ] }), 16972 fieldLabel 16973 ] }) 16974 } 16975 ), 16976 /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(tooltip_exports.Popup, { children: errorMessage }) 16977 ] }) : fieldLabel; 16978 } 16979 var get_label_content_default = getLabelContent; 16980 16981 // packages/dataviews/build-module/components/dataform-layouts/panel/utils/get-first-validation-error.mjs 16982 function getFirstValidationError(validity) { 16983 if (!validity) { 16984 return void 0; 16985 } 16986 const validityRules = Object.keys(validity).filter( 16987 (key) => key !== "children" 16988 ); 16989 for (const key of validityRules) { 16990 const rule = validity[key]; 16991 if (rule === void 0) { 16992 continue; 16993 } 16994 if (rule.type === "invalid") { 16995 if (rule.message) { 16996 return rule.message; 16997 } 16998 if (key === "required") { 16999 return "A required field is empty"; 17000 } 17001 return "Unidentified validation error"; 17002 } 17003 } 17004 if (validity.children) { 17005 for (const childValidity of Object.values(validity.children)) { 17006 const childError = getFirstValidationError(childValidity); 17007 if (childError) { 17008 return childError; 17009 } 17010 } 17011 } 17012 return void 0; 17013 } 17014 var get_first_validation_error_default = getFirstValidationError; 17015 17016 // packages/dataviews/build-module/components/dataform-layouts/panel/summary-button.mjs 17017 var import_jsx_runtime69 = __toESM(require_jsx_runtime(), 1); 17018 function SummaryButton({ 17019 data, 17020 field, 17021 fieldLabel, 17022 summaryFields, 17023 validity, 17024 touched, 17025 disabled: disabled2, 17026 onClick, 17027 "aria-expanded": ariaExpanded 17028 }) { 17029 const { labelPosition, editVisibility } = field.layout; 17030 const errorMessage = get_first_validation_error_default(validity); 17031 const showError = touched && !!errorMessage; 17032 const labelClassName = get_label_classname_default(labelPosition, showError); 17033 const labelContent = get_label_content_default(showError, errorMessage, fieldLabel); 17034 const className = clsx_default( 17035 "dataforms-layouts-panel__field-trigger", 17036 `dataforms-layouts-panel__field-trigger--label-$labelPosition}`, 17037 { 17038 "is-disabled": disabled2, 17039 "dataforms-layouts-panel__field-trigger--edit-always": editVisibility === "always" 17040 } 17041 ); 17042 const controlId = (0, import_compose.useInstanceId)( 17043 SummaryButton, 17044 "dataforms-layouts-panel__field-control" 17045 ); 17046 const ariaLabel = showError ? (0, import_i18n16.sprintf)( 17047 // translators: %s: Field name. 17048 (0, import_i18n16._x)("Edit %s (has errors)", "field"), 17049 fieldLabel || "" 17050 ) : (0, import_i18n16.sprintf)( 17051 // translators: %s: Field name. 17052 (0, import_i18n16._x)("Edit %s", "field"), 17053 fieldLabel || "" 17054 ); 17055 const rowRef = (0, import_element53.useRef)(null); 17056 const handleRowClick = () => { 17057 const selection = rowRef.current?.ownerDocument.defaultView?.getSelection(); 17058 if (selection && selection.toString().length > 0) { 17059 return; 17060 } 17061 onClick(); 17062 }; 17063 const handleKeyDown = (event) => { 17064 if (event.target === event.currentTarget && (event.key === "Enter" || event.key === " ")) { 17065 event.preventDefault(); 17066 onClick(); 17067 } 17068 }; 17069 return /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)( 17070 "div", 17071 { 17072 ref: rowRef, 17073 className, 17074 onClick: !disabled2 ? handleRowClick : void 0, 17075 onKeyDown: !disabled2 ? handleKeyDown : void 0, 17076 children: [ 17077 labelPosition !== "none" && /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("span", { className: labelClassName, children: labelContent }), 17078 labelPosition === "none" && showError && /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)(tooltip_exports.Root, { children: [ 17079 /* @__PURE__ */ (0, import_jsx_runtime69.jsx)( 17080 tooltip_exports.Trigger, 17081 { 17082 render: /* @__PURE__ */ (0, import_jsx_runtime69.jsx)( 17083 "span", 17084 { 17085 className: "dataforms-layouts-panel__field-label-error-content", 17086 role: "img", 17087 "aria-label": errorMessage, 17088 children: /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(import_components22.Icon, { icon: error_default, size: 16 }) 17089 } 17090 ) 17091 } 17092 ), 17093 /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(tooltip_exports.Popup, { children: errorMessage }) 17094 ] }), 17095 /* @__PURE__ */ (0, import_jsx_runtime69.jsx)( 17096 "span", 17097 { 17098 id: `$controlId}`, 17099 className: "dataforms-layouts-panel__field-control", 17100 children: summaryFields.length > 1 ? /* @__PURE__ */ (0, import_jsx_runtime69.jsx)( 17101 "span", 17102 { 17103 style: { 17104 display: "flex", 17105 flexDirection: "column", 17106 alignItems: "flex-start", 17107 width: "100%", 17108 gap: "2px" 17109 }, 17110 children: summaryFields.map((summaryField) => /* @__PURE__ */ (0, import_jsx_runtime69.jsx)( 17111 "span", 17112 { 17113 style: { width: "100%" }, 17114 children: /* @__PURE__ */ (0, import_jsx_runtime69.jsx)( 17115 summaryField.render, 17116 { 17117 item: data, 17118 field: summaryField 17119 } 17120 ) 17121 }, 17122 summaryField.id 17123 )) 17124 } 17125 ) : summaryFields.map((summaryField) => /* @__PURE__ */ (0, import_jsx_runtime69.jsx)( 17126 summaryField.render, 17127 { 17128 item: data, 17129 field: summaryField 17130 }, 17131 summaryField.id 17132 )) 17133 } 17134 ), 17135 !disabled2 && /* @__PURE__ */ (0, import_jsx_runtime69.jsx)( 17136 import_components22.Button, 17137 { 17138 className: "dataforms-layouts-panel__field-trigger-icon", 17139 label: ariaLabel, 17140 icon: pencil_default, 17141 size: "small", 17142 "aria-expanded": ariaExpanded, 17143 "aria-haspopup": "dialog", 17144 "aria-describedby": `$controlId}` 17145 } 17146 ) 17147 ] 17148 } 17149 ); 17150 } 17151 17152 // packages/dataviews/build-module/hooks/use-form-validity.mjs 17153 var import_deepmerge = __toESM(require_cjs(), 1); 17154 var import_es6 = __toESM(require_es6(), 1); 17155 var import_element54 = __toESM(require_element(), 1); 17156 var import_i18n17 = __toESM(require_i18n(), 1); 17157 function isFormValid(formValidity) { 17158 if (!formValidity) { 17159 return true; 17160 } 17161 return Object.values(formValidity).every((fieldValidation) => { 17162 return Object.entries(fieldValidation).every( 17163 ([key, validation]) => { 17164 if (key === "children" && validation && typeof validation === "object") { 17165 return isFormValid(validation); 17166 } 17167 return validation.type !== "invalid" && validation.type !== "validating"; 17168 } 17169 ); 17170 }); 17171 } 17172 function getFormFieldsToValidate(form, fields) { 17173 const normalizedForm = normalize_form_default(form); 17174 if (normalizedForm.fields.length === 0) { 17175 return []; 17176 } 17177 const fieldsMap = /* @__PURE__ */ new Map(); 17178 fields.forEach((field) => { 17179 fieldsMap.set(field.id, field); 17180 }); 17181 function processFormField(formField) { 17182 if ("children" in formField && Array.isArray(formField.children)) { 17183 const processedChildren = formField.children.map(processFormField).filter((child) => child !== null); 17184 if (processedChildren.length === 0) { 17185 return null; 17186 } 17187 const fieldDef2 = fieldsMap.get(formField.id); 17188 if (fieldDef2) { 17189 const [normalizedField2] = normalizeFields([ 17190 fieldDef2 17191 ]); 17192 return { 17193 id: formField.id, 17194 children: processedChildren, 17195 field: normalizedField2 17196 }; 17197 } 17198 return { 17199 id: formField.id, 17200 children: processedChildren 17201 }; 17202 } 17203 const fieldDef = fieldsMap.get(formField.id); 17204 if (!fieldDef) { 17205 return null; 17206 } 17207 const [normalizedField] = normalizeFields([fieldDef]); 17208 return { 17209 id: formField.id, 17210 children: [], 17211 field: normalizedField 17212 }; 17213 } 17214 const toValidate = normalizedForm.fields.map(processFormField).filter((field) => field !== null); 17215 return toValidate; 17216 } 17217 function setValidityAtPath(formValidity, fieldValidity, path) { 17218 if (!formValidity) { 17219 formValidity = {}; 17220 } 17221 if (path.length === 0) { 17222 return formValidity; 17223 } 17224 const result = { ...formValidity }; 17225 let current = result; 17226 for (let i2 = 0; i2 < path.length - 1; i2++) { 17227 const segment = path[i2]; 17228 if (!current[segment]) { 17229 current[segment] = {}; 17230 } 17231 current[segment] = { ...current[segment] }; 17232 current = current[segment]; 17233 } 17234 const finalKey = path[path.length - 1]; 17235 current[finalKey] = { 17236 ...current[finalKey] || {}, 17237 ...fieldValidity 17238 }; 17239 return result; 17240 } 17241 function removeValidationProperty(formValidity, path, property) { 17242 if (!formValidity || path.length === 0) { 17243 return formValidity; 17244 } 17245 const result = { ...formValidity }; 17246 let current = result; 17247 for (let i2 = 0; i2 < path.length - 1; i2++) { 17248 const segment = path[i2]; 17249 if (!current[segment]) { 17250 return formValidity; 17251 } 17252 current[segment] = { ...current[segment] }; 17253 current = current[segment]; 17254 } 17255 const finalKey = path[path.length - 1]; 17256 if (!current[finalKey]) { 17257 return formValidity; 17258 } 17259 const fieldValidity = { ...current[finalKey] }; 17260 delete fieldValidity[property]; 17261 if (Object.keys(fieldValidity).length === 0) { 17262 delete current[finalKey]; 17263 } else { 17264 current[finalKey] = fieldValidity; 17265 } 17266 if (Object.keys(result).length === 0) { 17267 return void 0; 17268 } 17269 return result; 17270 } 17271 function handleElementsValidationAsync(promise, formField, promiseHandler) { 17272 const { elementsCounterRef, setFormValidity, path, item } = promiseHandler; 17273 const currentToken = (elementsCounterRef.current[formField.id] || 0) + 1; 17274 elementsCounterRef.current[formField.id] = currentToken; 17275 promise.then((result) => { 17276 if (currentToken !== elementsCounterRef.current[formField.id]) { 17277 return; 17278 } 17279 if (!Array.isArray(result)) { 17280 setFormValidity((prev) => { 17281 const newFormValidity = setValidityAtPath( 17282 prev, 17283 { 17284 elements: { 17285 type: "invalid", 17286 message: (0, import_i18n17.__)("Could not validate elements.") 17287 } 17288 }, 17289 [...path, formField.id] 17290 ); 17291 return newFormValidity; 17292 }); 17293 return; 17294 } 17295 if (formField.field?.isValid.elements && !formField.field.isValid.elements.validate(item, { 17296 ...formField.field, 17297 elements: result 17298 })) { 17299 setFormValidity((prev) => { 17300 const newFormValidity = setValidityAtPath( 17301 prev, 17302 { 17303 elements: { 17304 type: "invalid", 17305 message: (0, import_i18n17.__)( 17306 "Value must be one of the elements." 17307 ) 17308 } 17309 }, 17310 [...path, formField.id] 17311 ); 17312 return newFormValidity; 17313 }); 17314 } else { 17315 setFormValidity((prev) => { 17316 return removeValidationProperty( 17317 prev, 17318 [...path, formField.id], 17319 "elements" 17320 ); 17321 }); 17322 } 17323 }).catch((error2) => { 17324 if (currentToken !== elementsCounterRef.current[formField.id]) { 17325 return; 17326 } 17327 let errorMessage; 17328 if (error2 instanceof Error) { 17329 errorMessage = error2.message; 17330 } else { 17331 errorMessage = String(error2) || (0, import_i18n17.__)( 17332 "Unknown error when running elements validation asynchronously." 17333 ); 17334 } 17335 setFormValidity((prev) => { 17336 const newFormValidity = setValidityAtPath( 17337 prev, 17338 { 17339 elements: { 17340 type: "invalid", 17341 message: errorMessage 17342 } 17343 }, 17344 [...path, formField.id] 17345 ); 17346 return newFormValidity; 17347 }); 17348 }); 17349 } 17350 function handleCustomValidationAsync(promise, formField, promiseHandler) { 17351 const { customCounterRef, setFormValidity, path } = promiseHandler; 17352 const currentToken = (customCounterRef.current[formField.id] || 0) + 1; 17353 customCounterRef.current[formField.id] = currentToken; 17354 promise.then((result) => { 17355 if (currentToken !== customCounterRef.current[formField.id]) { 17356 return; 17357 } 17358 if (result === null) { 17359 setFormValidity((prev) => { 17360 return removeValidationProperty( 17361 prev, 17362 [...path, formField.id], 17363 "custom" 17364 ); 17365 }); 17366 return; 17367 } 17368 if (typeof result === "string") { 17369 setFormValidity((prev) => { 17370 const newFormValidity = setValidityAtPath( 17371 prev, 17372 { 17373 custom: { 17374 type: "invalid", 17375 message: result 17376 } 17377 }, 17378 [...path, formField.id] 17379 ); 17380 return newFormValidity; 17381 }); 17382 return; 17383 } 17384 setFormValidity((prev) => { 17385 const newFormValidity = setValidityAtPath( 17386 prev, 17387 { 17388 custom: { 17389 type: "invalid", 17390 message: (0, import_i18n17.__)("Validation could not be processed.") 17391 } 17392 }, 17393 [...path, formField.id] 17394 ); 17395 return newFormValidity; 17396 }); 17397 }).catch((error2) => { 17398 if (currentToken !== customCounterRef.current[formField.id]) { 17399 return; 17400 } 17401 let errorMessage; 17402 if (error2 instanceof Error) { 17403 errorMessage = error2.message; 17404 } else { 17405 errorMessage = String(error2) || (0, import_i18n17.__)( 17406 "Unknown error when running custom validation asynchronously." 17407 ); 17408 } 17409 setFormValidity((prev) => { 17410 const newFormValidity = setValidityAtPath( 17411 prev, 17412 { 17413 custom: { 17414 type: "invalid", 17415 message: errorMessage 17416 } 17417 }, 17418 [...path, formField.id] 17419 ); 17420 return newFormValidity; 17421 }); 17422 }); 17423 } 17424 function validateFormField(item, formField, promiseHandler) { 17425 if (formField.field?.isValid.required && !formField.field.isValid.required.validate(item, formField.field)) { 17426 return { 17427 required: { type: "invalid" } 17428 }; 17429 } 17430 if (formField.field?.isValid.pattern && !formField.field.isValid.pattern.validate(item, formField.field)) { 17431 return { 17432 pattern: { 17433 type: "invalid", 17434 message: (0, import_i18n17.__)("Value does not match the required pattern.") 17435 } 17436 }; 17437 } 17438 if (formField.field?.isValid.min && !formField.field.isValid.min.validate(item, formField.field)) { 17439 return { 17440 min: { 17441 type: "invalid", 17442 message: (0, import_i18n17.__)("Value is below the minimum.") 17443 } 17444 }; 17445 } 17446 if (formField.field?.isValid.max && !formField.field.isValid.max.validate(item, formField.field)) { 17447 return { 17448 max: { 17449 type: "invalid", 17450 message: (0, import_i18n17.__)("Value is above the maximum.") 17451 } 17452 }; 17453 } 17454 if (formField.field?.isValid.minLength && !formField.field.isValid.minLength.validate(item, formField.field)) { 17455 return { 17456 minLength: { 17457 type: "invalid", 17458 message: (0, import_i18n17.__)("Value is too short.") 17459 } 17460 }; 17461 } 17462 if (formField.field?.isValid.maxLength && !formField.field.isValid.maxLength.validate(item, formField.field)) { 17463 return { 17464 maxLength: { 17465 type: "invalid", 17466 message: (0, import_i18n17.__)("Value is too long.") 17467 } 17468 }; 17469 } 17470 if (formField.field?.isValid.elements && formField.field.hasElements && !formField.field.getElements && Array.isArray(formField.field.elements) && !formField.field.isValid.elements.validate(item, formField.field)) { 17471 return { 17472 elements: { 17473 type: "invalid", 17474 message: (0, import_i18n17.__)("Value must be one of the elements.") 17475 } 17476 }; 17477 } 17478 let customError; 17479 if (!!formField.field && formField.field.isValid.custom) { 17480 try { 17481 const value = formField.field.getValue({ item }); 17482 customError = formField.field.isValid.custom( 17483 (0, import_deepmerge.default)( 17484 item, 17485 formField.field.setValue({ 17486 item, 17487 value 17488 }) 17489 ), 17490 formField.field 17491 ); 17492 } catch (error2) { 17493 let errorMessage; 17494 if (error2 instanceof Error) { 17495 errorMessage = error2.message; 17496 } else { 17497 errorMessage = String(error2) || (0, import_i18n17.__)("Unknown error when running custom validation."); 17498 } 17499 return { 17500 custom: { 17501 type: "invalid", 17502 message: errorMessage 17503 } 17504 }; 17505 } 17506 } 17507 if (typeof customError === "string") { 17508 return { 17509 custom: { 17510 type: "invalid", 17511 message: customError 17512 } 17513 }; 17514 } 17515 const fieldValidity = {}; 17516 if (!!formField.field && formField.field.isValid.elements && formField.field.hasElements && typeof formField.field.getElements === "function") { 17517 handleElementsValidationAsync( 17518 formField.field.getElements(), 17519 formField, 17520 promiseHandler 17521 ); 17522 fieldValidity.elements = { 17523 type: "validating", 17524 message: (0, import_i18n17.__)("Validating\u2026") 17525 }; 17526 } 17527 if (customError instanceof Promise) { 17528 handleCustomValidationAsync(customError, formField, promiseHandler); 17529 fieldValidity.custom = { 17530 type: "validating", 17531 message: (0, import_i18n17.__)("Validating\u2026") 17532 }; 17533 } 17534 if (Object.keys(fieldValidity).length > 0) { 17535 return fieldValidity; 17536 } 17537 if (formField.children.length > 0) { 17538 const result = {}; 17539 formField.children.forEach((child) => { 17540 result[child.id] = validateFormField(item, child, { 17541 ...promiseHandler, 17542 path: [...promiseHandler.path, formField.id, "children"] 17543 }); 17544 }); 17545 const filteredResult = {}; 17546 Object.entries(result).forEach(([key, value]) => { 17547 if (value !== void 0) { 17548 filteredResult[key] = value; 17549 } 17550 }); 17551 if (Object.keys(filteredResult).length === 0) { 17552 return void 0; 17553 } 17554 return { 17555 children: filteredResult 17556 }; 17557 } 17558 return void 0; 17559 } 17560 function getFormFieldValue(formField, item) { 17561 const fieldValue = formField?.field?.getValue({ item }); 17562 if (formField.children.length === 0) { 17563 return fieldValue; 17564 } 17565 const childrenValues = formField.children.map( 17566 (child) => getFormFieldValue(child, item) 17567 ); 17568 if (!childrenValues) { 17569 return fieldValue; 17570 } 17571 return { 17572 value: fieldValue, 17573 children: childrenValues 17574 }; 17575 } 17576 function useFormValidity(item, fields, form) { 17577 const [formValidity, setFormValidity] = (0, import_element54.useState)(); 17578 const customCounterRef = (0, import_element54.useRef)({}); 17579 const elementsCounterRef = (0, import_element54.useRef)({}); 17580 const previousValuesRef = (0, import_element54.useRef)({}); 17581 const validate = (0, import_element54.useCallback)(() => { 17582 const promiseHandler = { 17583 customCounterRef, 17584 elementsCounterRef, 17585 setFormValidity, 17586 path: [], 17587 item 17588 }; 17589 const formFieldsToValidate = getFormFieldsToValidate(form, fields); 17590 if (formFieldsToValidate.length === 0) { 17591 setFormValidity(void 0); 17592 return; 17593 } 17594 const newFormValidity = {}; 17595 const untouchedFields = []; 17596 formFieldsToValidate.forEach((formField) => { 17597 const value = getFormFieldValue(formField, item); 17598 if (previousValuesRef.current.hasOwnProperty(formField.id) && (0, import_es6.default)( 17599 previousValuesRef.current[formField.id], 17600 value 17601 )) { 17602 untouchedFields.push(formField.id); 17603 return; 17604 } 17605 previousValuesRef.current[formField.id] = value; 17606 const fieldValidity = validateFormField( 17607 item, 17608 formField, 17609 promiseHandler 17610 ); 17611 if (fieldValidity !== void 0) { 17612 newFormValidity[formField.id] = fieldValidity; 17613 } 17614 }); 17615 setFormValidity((existingFormValidity) => { 17616 let validity = { 17617 ...existingFormValidity, 17618 ...newFormValidity 17619 }; 17620 const fieldsToKeep = [ 17621 ...untouchedFields, 17622 ...Object.keys(newFormValidity) 17623 ]; 17624 Object.keys(validity).forEach((key) => { 17625 if (validity && !fieldsToKeep.includes(key)) { 17626 delete validity[key]; 17627 } 17628 }); 17629 if (Object.keys(validity).length === 0) { 17630 validity = void 0; 17631 } 17632 const areEqual = (0, import_es6.default)(existingFormValidity, validity); 17633 if (areEqual) { 17634 return existingFormValidity; 17635 } 17636 return validity; 17637 }); 17638 }, [item, fields, form]); 17639 (0, import_element54.useEffect)(() => { 17640 validate(); 17641 }, [validate]); 17642 return { 17643 validity: formValidity, 17644 isValid: isFormValid(formValidity) 17645 }; 17646 } 17647 var use_form_validity_default = useFormValidity; 17648 17649 // packages/dataviews/build-module/hooks/use-report-validity.mjs 17650 var import_element55 = __toESM(require_element(), 1); 17651 function useReportValidity(ref, shouldReport) { 17652 (0, import_element55.useEffect)(() => { 17653 if (shouldReport && ref.current) { 17654 const inputs = ref.current.querySelectorAll( 17655 "input, textarea, select" 17656 ); 17657 inputs.forEach((input) => { 17658 input.reportValidity(); 17659 }); 17660 } 17661 }, [shouldReport, ref]); 17662 } 17663 17664 // packages/dataviews/build-module/components/dataform-layouts/panel/utils/use-field-from-form-field.mjs 17665 var import_element56 = __toESM(require_element(), 1); 17666 17667 // packages/dataviews/build-module/components/dataform-layouts/get-summary-fields.mjs 17668 function extractSummaryIds(summary) { 17669 if (Array.isArray(summary)) { 17670 return summary.map( 17671 (item) => typeof item === "string" ? item : item.id 17672 ); 17673 } 17674 return []; 17675 } 17676 var getSummaryFields = (summaryField, fields) => { 17677 if (Array.isArray(summaryField) && summaryField.length > 0) { 17678 const summaryIds = extractSummaryIds(summaryField); 17679 return summaryIds.map( 17680 (summaryId) => fields.find((_field) => _field.id === summaryId) 17681 ).filter((_field) => _field !== void 0); 17682 } 17683 return []; 17684 }; 17685 17686 // packages/dataviews/build-module/components/dataform-layouts/panel/utils/use-field-from-form-field.mjs 17687 var getFieldDefinition = (field, fields) => { 17688 const fieldDefinition = fields.find((_field) => _field.id === field.id); 17689 if (!fieldDefinition) { 17690 return fields.find((_field) => { 17691 if (!!field.children) { 17692 const simpleChildren = field.children.filter( 17693 (child) => !child.children 17694 ); 17695 if (simpleChildren.length === 0) { 17696 return false; 17697 } 17698 return _field.id === simpleChildren[0].id; 17699 } 17700 return _field.id === field.id; 17701 }); 17702 } 17703 return fieldDefinition; 17704 }; 17705 function useFieldFromFormField(field) { 17706 const { fields } = (0, import_element56.useContext)(dataform_context_default); 17707 const layout = field.layout; 17708 const summaryFields = getSummaryFields(layout.summary, fields); 17709 const fieldDefinition = getFieldDefinition(field, fields); 17710 const fieldLabel = !!field.children ? field.label : fieldDefinition?.label; 17711 if (summaryFields.length === 0) { 17712 return { 17713 summaryFields: fieldDefinition ? [fieldDefinition] : [], 17714 fieldDefinition, 17715 fieldLabel 17716 }; 17717 } 17718 return { 17719 summaryFields, 17720 fieldDefinition, 17721 fieldLabel 17722 }; 17723 } 17724 var use_field_from_form_field_default = useFieldFromFormField; 17725 17726 // packages/dataviews/build-module/components/dataform-layouts/panel/modal.mjs 17727 var import_jsx_runtime70 = __toESM(require_jsx_runtime(), 1); 17728 function ModalContent({ 17729 data, 17730 field, 17731 onChange, 17732 fieldLabel, 17733 onClose, 17734 touched 17735 }) { 17736 const { openAs } = field.layout; 17737 const { applyLabel, cancelLabel } = openAs; 17738 const { fields } = (0, import_element57.useContext)(dataform_context_default); 17739 const [changes, setChanges] = (0, import_element57.useState)({}); 17740 const modalData = (0, import_element57.useMemo)(() => { 17741 return (0, import_deepmerge2.default)(data, changes, { 17742 arrayMerge: (target, source) => source 17743 }); 17744 }, [data, changes]); 17745 const form = (0, import_element57.useMemo)( 17746 () => ({ 17747 layout: DEFAULT_LAYOUT, 17748 fields: !!field.children ? field.children : ( 17749 // If not explicit children return the field id itself. 17750 [{ id: field.id, layout: DEFAULT_LAYOUT }] 17751 ) 17752 }), 17753 [field] 17754 ); 17755 const fieldsAsFieldType = fields.map((f2) => ({ 17756 ...f2, 17757 Edit: f2.Edit === null ? void 0 : f2.Edit, 17758 isValid: { 17759 required: f2.isValid.required?.constraint, 17760 elements: f2.isValid.elements?.constraint, 17761 min: f2.isValid.min?.constraint, 17762 max: f2.isValid.max?.constraint, 17763 pattern: f2.isValid.pattern?.constraint, 17764 minLength: f2.isValid.minLength?.constraint, 17765 maxLength: f2.isValid.maxLength?.constraint 17766 } 17767 })); 17768 const { validity } = use_form_validity_default(modalData, fieldsAsFieldType, form); 17769 const onApply = () => { 17770 onChange(changes); 17771 onClose(); 17772 }; 17773 const handleOnChange = (newValue) => { 17774 setChanges( 17775 (prev) => (0, import_deepmerge2.default)(prev, newValue, { 17776 arrayMerge: (target, source) => source 17777 }) 17778 ); 17779 }; 17780 const focusOnMountRef = (0, import_compose2.useFocusOnMount)("firstInputElement"); 17781 const contentRef = (0, import_element57.useRef)(null); 17782 const mergedRef = (0, import_compose2.useMergeRefs)([focusOnMountRef, contentRef]); 17783 useReportValidity(contentRef, touched); 17784 return /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)( 17785 import_components23.Modal, 17786 { 17787 className: "dataforms-layouts-panel__modal", 17788 onRequestClose: onClose, 17789 isFullScreen: false, 17790 title: fieldLabel, 17791 size: "medium", 17792 children: [ 17793 /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("div", { ref: mergedRef, children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)( 17794 DataFormLayout, 17795 { 17796 data: modalData, 17797 form, 17798 onChange: handleOnChange, 17799 validity, 17800 children: (FieldLayout, childField, childFieldValidity, markWhenOptional) => /* @__PURE__ */ (0, import_jsx_runtime70.jsx)( 17801 FieldLayout, 17802 { 17803 data: modalData, 17804 field: childField, 17805 onChange: handleOnChange, 17806 hideLabelFromVision: form.fields.length < 2, 17807 markWhenOptional, 17808 validity: childFieldValidity 17809 }, 17810 childField.id 17811 ) 17812 } 17813 ) }), 17814 /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)( 17815 Stack, 17816 { 17817 direction: "row", 17818 className: "dataforms-layouts-panel__modal-footer", 17819 gap: "md", 17820 children: [ 17821 /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(import_components23.__experimentalSpacer, { style: { flex: 1 } }), 17822 /* @__PURE__ */ (0, import_jsx_runtime70.jsx)( 17823 import_components23.Button, 17824 { 17825 variant: "tertiary", 17826 onClick: onClose, 17827 __next40pxDefaultSize: true, 17828 children: cancelLabel 17829 } 17830 ), 17831 /* @__PURE__ */ (0, import_jsx_runtime70.jsx)( 17832 import_components23.Button, 17833 { 17834 variant: "primary", 17835 onClick: onApply, 17836 __next40pxDefaultSize: true, 17837 children: applyLabel 17838 } 17839 ) 17840 ] 17841 } 17842 ) 17843 ] 17844 } 17845 ); 17846 } 17847 function PanelModal({ 17848 data, 17849 field, 17850 onChange, 17851 validity 17852 }) { 17853 const [touched, setTouched] = (0, import_element57.useState)(false); 17854 const [isOpen, setIsOpen] = (0, import_element57.useState)(false); 17855 const { fieldDefinition, fieldLabel, summaryFields } = use_field_from_form_field_default(field); 17856 if (!fieldDefinition) { 17857 return null; 17858 } 17859 const handleClose = () => { 17860 setIsOpen(false); 17861 setTouched(true); 17862 }; 17863 return /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)(import_jsx_runtime70.Fragment, { children: [ 17864 /* @__PURE__ */ (0, import_jsx_runtime70.jsx)( 17865 SummaryButton, 17866 { 17867 data, 17868 field, 17869 fieldLabel, 17870 summaryFields, 17871 validity, 17872 touched, 17873 disabled: fieldDefinition.readOnly === true, 17874 onClick: () => setIsOpen(true), 17875 "aria-expanded": isOpen 17876 } 17877 ), 17878 isOpen && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)( 17879 ModalContent, 17880 { 17881 data, 17882 field, 17883 onChange, 17884 fieldLabel: fieldLabel ?? "", 17885 onClose: handleClose, 17886 touched 17887 } 17888 ) 17889 ] }); 17890 } 17891 var modal_default = PanelModal; 17892 17893 // packages/dataviews/build-module/components/dataform-layouts/panel/dropdown.mjs 17894 var import_components24 = __toESM(require_components(), 1); 17895 var import_i18n18 = __toESM(require_i18n(), 1); 17896 var import_element58 = __toESM(require_element(), 1); 17897 var import_compose3 = __toESM(require_compose(), 1); 17898 var import_jsx_runtime71 = __toESM(require_jsx_runtime(), 1); 17899 function DropdownHeader({ 17900 title, 17901 onClose 17902 }) { 17903 return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)( 17904 Stack, 17905 { 17906 direction: "column", 17907 className: "dataforms-layouts-panel__dropdown-header", 17908 gap: "lg", 17909 children: /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)(Stack, { direction: "row", gap: "sm", align: "center", children: [ 17910 title && /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(import_components24.__experimentalHeading, { level: 2, size: 13, children: title }), 17911 /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(import_components24.__experimentalSpacer, { style: { flex: 1 } }), 17912 onClose && /* @__PURE__ */ (0, import_jsx_runtime71.jsx)( 17913 import_components24.Button, 17914 { 17915 label: (0, import_i18n18.__)("Close"), 17916 icon: close_small_default, 17917 onClick: onClose, 17918 size: "small" 17919 } 17920 ) 17921 ] }) 17922 } 17923 ); 17924 } 17925 function DropdownContentWithValidation({ 17926 touched, 17927 children 17928 }) { 17929 const ref = (0, import_element58.useRef)(null); 17930 useReportValidity(ref, touched); 17931 return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("div", { ref, children }); 17932 } 17933 function PanelDropdown({ 17934 data, 17935 field, 17936 onChange, 17937 validity 17938 }) { 17939 const [touched, setTouched] = (0, import_element58.useState)(false); 17940 const [popoverAnchor, setPopoverAnchor] = (0, import_element58.useState)( 17941 null 17942 ); 17943 const popoverProps = (0, import_element58.useMemo)( 17944 () => ({ 17945 // Anchor the popover to the middle of the entire row so that it doesn't 17946 // move around when the label changes. 17947 anchor: popoverAnchor, 17948 placement: "left-start", 17949 offset: 36, 17950 shift: true 17951 }), 17952 [popoverAnchor] 17953 ); 17954 const [dialogRef, dialogProps] = (0, import_compose3.__experimentalUseDialog)({ 17955 focusOnMount: "firstInputElement" 17956 }); 17957 const form = (0, import_element58.useMemo)( 17958 () => ({ 17959 layout: DEFAULT_LAYOUT, 17960 fields: !!field.children ? field.children : ( 17961 // If not explicit children return the field id itself. 17962 [{ id: field.id, layout: DEFAULT_LAYOUT }] 17963 ) 17964 }), 17965 [field] 17966 ); 17967 const formValidity = (0, import_element58.useMemo)(() => { 17968 if (validity === void 0) { 17969 return void 0; 17970 } 17971 if (!!field.children) { 17972 return validity?.children; 17973 } 17974 return { [field.id]: validity }; 17975 }, [validity, field]); 17976 const { fieldDefinition, fieldLabel, summaryFields } = use_field_from_form_field_default(field); 17977 if (!fieldDefinition) { 17978 return null; 17979 } 17980 return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)( 17981 "div", 17982 { 17983 ref: setPopoverAnchor, 17984 className: "dataforms-layouts-panel__field-dropdown-anchor", 17985 children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)( 17986 import_components24.Dropdown, 17987 { 17988 contentClassName: "dataforms-layouts-panel__field-dropdown", 17989 popoverProps, 17990 focusOnMount: false, 17991 onToggle: (willOpen) => { 17992 if (!willOpen) { 17993 setTouched(true); 17994 } 17995 }, 17996 renderToggle: ({ isOpen, onToggle }) => /* @__PURE__ */ (0, import_jsx_runtime71.jsx)( 17997 SummaryButton, 17998 { 17999 data, 18000 field, 18001 fieldLabel, 18002 summaryFields, 18003 validity, 18004 touched, 18005 disabled: fieldDefinition.readOnly === true, 18006 onClick: onToggle, 18007 "aria-expanded": isOpen 18008 } 18009 ), 18010 renderContent: ({ onClose }) => /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(DropdownContentWithValidation, { touched, children: /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { ref: dialogRef, ...dialogProps, children: [ 18011 /* @__PURE__ */ (0, import_jsx_runtime71.jsx)( 18012 DropdownHeader, 18013 { 18014 title: fieldLabel, 18015 onClose 18016 } 18017 ), 18018 /* @__PURE__ */ (0, import_jsx_runtime71.jsx)( 18019 DataFormLayout, 18020 { 18021 data, 18022 form, 18023 onChange, 18024 validity: formValidity, 18025 children: (FieldLayout, childField, childFieldValidity, markWhenOptional) => /* @__PURE__ */ (0, import_jsx_runtime71.jsx)( 18026 FieldLayout, 18027 { 18028 data, 18029 field: childField, 18030 onChange, 18031 hideLabelFromVision: (form?.fields ?? []).length < 2, 18032 markWhenOptional, 18033 validity: childFieldValidity 18034 }, 18035 childField.id 18036 ) 18037 } 18038 ) 18039 ] }) }) 18040 } 18041 ) 18042 } 18043 ); 18044 } 18045 var dropdown_default = PanelDropdown; 18046 18047 // packages/dataviews/build-module/components/dataform-layouts/panel/index.mjs 18048 var import_jsx_runtime72 = __toESM(require_jsx_runtime(), 1); 18049 function FormPanelField({ 18050 data, 18051 field, 18052 onChange, 18053 validity 18054 }) { 18055 const layout = field.layout; 18056 if (layout.openAs.type === "modal") { 18057 return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)( 18058 modal_default, 18059 { 18060 data, 18061 field, 18062 onChange, 18063 validity 18064 } 18065 ); 18066 } 18067 return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)( 18068 dropdown_default, 18069 { 18070 data, 18071 field, 18072 onChange, 18073 validity 18074 } 18075 ); 18076 } 18077 18078 // packages/dataviews/build-module/components/dataform-layouts/card/index.mjs 18079 var import_element59 = __toESM(require_element(), 1); 18080 18081 // packages/dataviews/build-module/components/dataform-layouts/validation-badge.mjs 18082 var import_i18n19 = __toESM(require_i18n(), 1); 18083 var import_jsx_runtime73 = __toESM(require_jsx_runtime(), 1); 18084 function countInvalidFields(validity) { 18085 if (!validity) { 18086 return 0; 18087 } 18088 let count = 0; 18089 const validityRules = Object.keys(validity).filter( 18090 (key) => key !== "children" 18091 ); 18092 for (const key of validityRules) { 18093 const rule = validity[key]; 18094 if (rule?.type === "invalid") { 18095 count++; 18096 } 18097 } 18098 if (validity.children) { 18099 for (const childValidity of Object.values(validity.children)) { 18100 count += countInvalidFields(childValidity); 18101 } 18102 } 18103 return count; 18104 } 18105 function ValidationBadge({ 18106 validity 18107 }) { 18108 const invalidCount = countInvalidFields(validity); 18109 if (invalidCount === 0) { 18110 return null; 18111 } 18112 return /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(Badge, { intent: "high", children: (0, import_i18n19.sprintf)( 18113 /* translators: %d: Number of fields that need attention */ 18114 (0, import_i18n19._n)( 18115 "%d field needs attention", 18116 "%d fields need attention", 18117 invalidCount 18118 ), 18119 invalidCount 18120 ) }); 18121 } 18122 18123 // packages/dataviews/build-module/components/dataform-layouts/card/index.mjs 18124 var import_jsx_runtime74 = __toESM(require_jsx_runtime(), 1); 18125 function isSummaryFieldVisible(summaryField, summaryConfig, isOpen) { 18126 if (!summaryConfig || Array.isArray(summaryConfig) && summaryConfig.length === 0) { 18127 return false; 18128 } 18129 const summaryConfigArray = Array.isArray(summaryConfig) ? summaryConfig : [summaryConfig]; 18130 const fieldConfig = summaryConfigArray.find((config) => { 18131 if (typeof config === "string") { 18132 return config === summaryField.id; 18133 } 18134 if (typeof config === "object" && "id" in config) { 18135 return config.id === summaryField.id; 18136 } 18137 return false; 18138 }); 18139 if (!fieldConfig) { 18140 return false; 18141 } 18142 if (typeof fieldConfig === "string") { 18143 return true; 18144 } 18145 if (typeof fieldConfig === "object" && "visibility" in fieldConfig) { 18146 return fieldConfig.visibility === "always" || fieldConfig.visibility === "when-collapsed" && !isOpen; 18147 } 18148 return true; 18149 } 18150 function HeaderContent({ 18151 data, 18152 fields, 18153 label, 18154 layout, 18155 isOpen, 18156 touched, 18157 validity 18158 }) { 18159 const summaryFields = getSummaryFields(layout.summary, fields); 18160 const visibleSummaryFields = summaryFields.filter( 18161 (summaryField) => isSummaryFieldVisible(summaryField, layout.summary, isOpen) 18162 ); 18163 const hasBadge = touched && layout.isCollapsible; 18164 const hasSummary = visibleSummaryFields.length > 0 && layout.withHeader; 18165 return /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)( 18166 Stack, 18167 { 18168 align: "center", 18169 justify: "space-between", 18170 className: "dataforms-layouts-card__field-header-content", 18171 children: [ 18172 /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(card_exports.Title, { children: label }), 18173 (hasBadge || hasSummary) && /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(collapsible_card_exports.HeaderDescription, { className: "dataforms-layouts-card__field-header-content-description", children: [ 18174 hasBadge && /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(ValidationBadge, { validity }), 18175 hasSummary && /* @__PURE__ */ (0, import_jsx_runtime74.jsx)("div", { className: "dataforms-layouts-card__field-summary", children: visibleSummaryFields.map((summaryField) => /* @__PURE__ */ (0, import_jsx_runtime74.jsx)( 18176 summaryField.render, 18177 { 18178 item: data, 18179 field: summaryField 18180 }, 18181 summaryField.id 18182 )) }) 18183 ] }) 18184 ] 18185 } 18186 ); 18187 } 18188 function BodyContent({ 18189 data, 18190 field, 18191 form, 18192 onChange, 18193 hideLabelFromVision, 18194 markWhenOptional, 18195 validity, 18196 withHeader 18197 }) { 18198 if (field.children) { 18199 return /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(import_jsx_runtime74.Fragment, { children: [ 18200 field.description && /* @__PURE__ */ (0, import_jsx_runtime74.jsx)("div", { className: "dataforms-layouts-card__field-description", children: field.description }), 18201 /* @__PURE__ */ (0, import_jsx_runtime74.jsx)( 18202 DataFormLayout, 18203 { 18204 data, 18205 form, 18206 onChange, 18207 validity: validity?.children 18208 } 18209 ) 18210 ] }); 18211 } 18212 const SingleFieldLayout = getFormFieldLayout("regular")?.component; 18213 if (!SingleFieldLayout) { 18214 return null; 18215 } 18216 return /* @__PURE__ */ (0, import_jsx_runtime74.jsx)( 18217 SingleFieldLayout, 18218 { 18219 data, 18220 field, 18221 onChange, 18222 hideLabelFromVision: hideLabelFromVision || withHeader, 18223 markWhenOptional, 18224 validity 18225 } 18226 ); 18227 } 18228 function FormCardField({ 18229 data, 18230 field, 18231 onChange, 18232 hideLabelFromVision, 18233 markWhenOptional, 18234 validity 18235 }) { 18236 const { fields } = (0, import_element59.useContext)(dataform_context_default); 18237 const layout = field.layout; 18238 const contentRef = (0, import_element59.useRef)(null); 18239 const form = (0, import_element59.useMemo)( 18240 () => ({ 18241 layout: DEFAULT_LAYOUT, 18242 fields: field.children ?? [] 18243 }), 18244 [field] 18245 ); 18246 const { isOpened, isCollapsible } = layout; 18247 const [isOpen, setIsOpen] = (0, import_element59.useState)(isOpened); 18248 const [touched, setTouched] = (0, import_element59.useState)(false); 18249 (0, import_element59.useEffect)(() => { 18250 setIsOpen(isOpened); 18251 }, [isOpened]); 18252 const handleOpenChange = (0, import_element59.useCallback)((open) => { 18253 if (!open) { 18254 setTouched(true); 18255 } 18256 setIsOpen(open); 18257 }, []); 18258 const handleBlur = (0, import_element59.useCallback)(() => { 18259 setTouched(true); 18260 }, []); 18261 useReportValidity( 18262 contentRef, 18263 (isCollapsible ? isOpen : true) && touched 18264 ); 18265 let label = field.label; 18266 let withHeader; 18267 if (field.children) { 18268 withHeader = !!label && layout.withHeader; 18269 } else { 18270 const fieldDefinition = fields.find( 18271 (fieldDef) => fieldDef.id === field.id 18272 ); 18273 if (!fieldDefinition || !fieldDefinition.Edit) { 18274 return null; 18275 } 18276 label = fieldDefinition.label; 18277 withHeader = !!label && layout.withHeader; 18278 } 18279 const bodyContent = /* @__PURE__ */ (0, import_jsx_runtime74.jsx)( 18280 BodyContent, 18281 { 18282 data, 18283 field, 18284 form, 18285 onChange, 18286 hideLabelFromVision, 18287 markWhenOptional, 18288 validity, 18289 withHeader 18290 } 18291 ); 18292 const headerContent = /* @__PURE__ */ (0, import_jsx_runtime74.jsx)( 18293 HeaderContent, 18294 { 18295 data, 18296 fields, 18297 label, 18298 layout, 18299 isOpen: isCollapsible ? !!isOpen : true, 18300 touched, 18301 validity 18302 } 18303 ); 18304 if (withHeader && isCollapsible) { 18305 return /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)( 18306 collapsible_card_exports.Root, 18307 { 18308 className: "dataforms-layouts-card__field", 18309 open: isOpen, 18310 onOpenChange: handleOpenChange, 18311 children: [ 18312 /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(collapsible_card_exports.Header, { children: headerContent }), 18313 /* @__PURE__ */ (0, import_jsx_runtime74.jsx)( 18314 collapsible_card_exports.Content, 18315 { 18316 ref: contentRef, 18317 onBlur: handleBlur, 18318 children: bodyContent 18319 } 18320 ) 18321 ] 18322 } 18323 ); 18324 } 18325 return /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(card_exports.Root, { className: "dataforms-layouts-card__field", children: [ 18326 withHeader && /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(card_exports.Header, { children: headerContent }), 18327 /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(card_exports.Content, { ref: contentRef, onBlur: handleBlur, children: bodyContent }) 18328 ] }); 18329 } 18330 18331 // packages/dataviews/build-module/components/dataform-layouts/row/index.mjs 18332 var import_components25 = __toESM(require_components(), 1); 18333 var import_jsx_runtime75 = __toESM(require_jsx_runtime(), 1); 18334 function Header5({ title }) { 18335 return /* @__PURE__ */ (0, import_jsx_runtime75.jsx)( 18336 Stack, 18337 { 18338 direction: "column", 18339 className: "dataforms-layouts-row__header", 18340 gap: "lg", 18341 children: /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(Stack, { direction: "row", align: "center", children: /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(import_components25.__experimentalHeading, { level: 2, size: 13, children: title }) }) 18342 } 18343 ); 18344 } 18345 var EMPTY_WRAPPER = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(import_jsx_runtime75.Fragment, { children }); 18346 function FormRowField({ 18347 data, 18348 field, 18349 onChange, 18350 hideLabelFromVision, 18351 markWhenOptional, 18352 validity 18353 }) { 18354 const layout = field.layout; 18355 if (!!field.children) { 18356 const form = { 18357 layout: DEFAULT_LAYOUT, 18358 fields: field.children 18359 }; 18360 return /* @__PURE__ */ (0, import_jsx_runtime75.jsxs)("div", { className: "dataforms-layouts-row__field", children: [ 18361 !hideLabelFromVision && field.label && /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(Header5, { title: field.label }), 18362 /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(Stack, { direction: "row", align: layout.alignment, gap: "lg", children: /* @__PURE__ */ (0, import_jsx_runtime75.jsx)( 18363 DataFormLayout, 18364 { 18365 data, 18366 form, 18367 onChange, 18368 validity: validity?.children, 18369 as: EMPTY_WRAPPER, 18370 children: (FieldLayout, childField, childFieldValidity) => /* @__PURE__ */ (0, import_jsx_runtime75.jsx)( 18371 "div", 18372 { 18373 className: "dataforms-layouts-row__field-control", 18374 style: layout.styles[childField.id], 18375 children: /* @__PURE__ */ (0, import_jsx_runtime75.jsx)( 18376 FieldLayout, 18377 { 18378 data, 18379 field: childField, 18380 onChange, 18381 hideLabelFromVision, 18382 markWhenOptional, 18383 validity: childFieldValidity 18384 } 18385 ) 18386 }, 18387 childField.id 18388 ) 18389 } 18390 ) }) 18391 ] }); 18392 } 18393 const RegularLayout = getFormFieldLayout("regular")?.component; 18394 if (!RegularLayout) { 18395 return null; 18396 } 18397 return /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(import_jsx_runtime75.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime75.jsx)("div", { className: "dataforms-layouts-row__field-control", children: /* @__PURE__ */ (0, import_jsx_runtime75.jsx)( 18398 RegularLayout, 18399 { 18400 data, 18401 field, 18402 onChange, 18403 markWhenOptional, 18404 validity 18405 } 18406 ) }) }); 18407 } 18408 18409 // packages/dataviews/build-module/components/dataform-layouts/details/index.mjs 18410 var import_element60 = __toESM(require_element(), 1); 18411 var import_i18n20 = __toESM(require_i18n(), 1); 18412 var import_jsx_runtime76 = __toESM(require_jsx_runtime(), 1); 18413 function FormDetailsField({ 18414 data, 18415 field, 18416 onChange, 18417 validity 18418 }) { 18419 const { fields } = (0, import_element60.useContext)(dataform_context_default); 18420 const detailsRef = (0, import_element60.useRef)(null); 18421 const contentRef = (0, import_element60.useRef)(null); 18422 const [touched, setTouched] = (0, import_element60.useState)(false); 18423 const [isOpen, setIsOpen] = (0, import_element60.useState)(false); 18424 const form = (0, import_element60.useMemo)( 18425 () => ({ 18426 layout: DEFAULT_LAYOUT, 18427 fields: field.children ?? [] 18428 }), 18429 [field] 18430 ); 18431 (0, import_element60.useEffect)(() => { 18432 const details = detailsRef.current; 18433 if (!details) { 18434 return; 18435 } 18436 const handleToggle = () => { 18437 const nowOpen = details.open; 18438 if (!nowOpen) { 18439 setTouched(true); 18440 } 18441 setIsOpen(nowOpen); 18442 }; 18443 details.addEventListener("toggle", handleToggle); 18444 return () => { 18445 details.removeEventListener("toggle", handleToggle); 18446 }; 18447 }, []); 18448 useReportValidity(contentRef, isOpen && touched); 18449 const handleBlur = (0, import_element60.useCallback)(() => { 18450 setTouched(true); 18451 }, []); 18452 if (!field.children) { 18453 return null; 18454 } 18455 const summaryFieldId = field.layout.summary ?? ""; 18456 const summaryField = summaryFieldId ? fields.find((fieldDef) => fieldDef.id === summaryFieldId) : void 0; 18457 let summaryContent; 18458 if (summaryField && summaryField.render) { 18459 summaryContent = /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(summaryField.render, { item: data, field: summaryField }); 18460 } else { 18461 summaryContent = field.label || (0, import_i18n20.__)("More details"); 18462 } 18463 return /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)( 18464 "details", 18465 { 18466 ref: detailsRef, 18467 className: "dataforms-layouts-details__details", 18468 children: [ 18469 /* @__PURE__ */ (0, import_jsx_runtime76.jsx)("summary", { className: "dataforms-layouts-details__summary", children: /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)( 18470 Stack, 18471 { 18472 direction: "row", 18473 align: "center", 18474 gap: "md", 18475 className: "dataforms-layouts-details__summary-content", 18476 children: [ 18477 summaryContent, 18478 touched && /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(ValidationBadge, { validity }) 18479 ] 18480 } 18481 ) }), 18482 /* @__PURE__ */ (0, import_jsx_runtime76.jsx)( 18483 "div", 18484 { 18485 ref: contentRef, 18486 className: "dataforms-layouts-details__content", 18487 onBlur: handleBlur, 18488 children: /* @__PURE__ */ (0, import_jsx_runtime76.jsx)( 18489 DataFormLayout, 18490 { 18491 data, 18492 form, 18493 onChange, 18494 validity: validity?.children 18495 } 18496 ) 18497 } 18498 ) 18499 ] 18500 } 18501 ); 18502 } 18503 18504 // packages/dataviews/build-module/components/dataform-layouts/index.mjs 18505 var import_jsx_runtime77 = __toESM(require_jsx_runtime(), 1); 18506 var FORM_FIELD_LAYOUTS = [ 18507 { 18508 type: "regular", 18509 component: FormRegularField, 18510 wrapper: ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime77.jsx)( 18511 Stack, 18512 { 18513 direction: "column", 18514 className: "dataforms-layouts__wrapper", 18515 gap: "lg", 18516 children 18517 } 18518 ) 18519 }, 18520 { 18521 type: "panel", 18522 component: FormPanelField, 18523 wrapper: ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime77.jsx)( 18524 Stack, 18525 { 18526 direction: "column", 18527 className: "dataforms-layouts__wrapper", 18528 gap: "md", 18529 children 18530 } 18531 ) 18532 }, 18533 { 18534 type: "card", 18535 component: FormCardField, 18536 wrapper: ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime77.jsx)( 18537 Stack, 18538 { 18539 direction: "column", 18540 className: "dataforms-layouts__wrapper", 18541 gap: "xl", 18542 children 18543 } 18544 ) 18545 }, 18546 { 18547 type: "row", 18548 component: FormRowField, 18549 wrapper: ({ 18550 children, 18551 layout 18552 }) => /* @__PURE__ */ (0, import_jsx_runtime77.jsx)( 18553 Stack, 18554 { 18555 direction: "column", 18556 className: "dataforms-layouts__wrapper", 18557 gap: "lg", 18558 children: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)("div", { className: "dataforms-layouts-row__field", children: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)( 18559 Stack, 18560 { 18561 direction: "row", 18562 gap: "lg", 18563 align: layout.alignment, 18564 children 18565 } 18566 ) }) 18567 } 18568 ) 18569 }, 18570 { 18571 type: "details", 18572 component: FormDetailsField 18573 } 18574 ]; 18575 function getFormFieldLayout(type) { 18576 return FORM_FIELD_LAYOUTS.find((layout) => layout.type === type); 18577 } 18578 18579 // packages/dataviews/build-module/components/dataform-layouts/data-form-layout.mjs 18580 var import_jsx_runtime78 = __toESM(require_jsx_runtime(), 1); 18581 var DEFAULT_WRAPPER = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(Stack, { direction: "column", className: "dataforms-layouts__wrapper", gap: "lg", children }); 18582 function DataFormLayout({ 18583 data, 18584 form, 18585 onChange, 18586 validity, 18587 children, 18588 as 18589 }) { 18590 const { fields: fieldDefinitions } = (0, import_element61.useContext)(dataform_context_default); 18591 const markWhenOptional = (0, import_element61.useMemo)(() => { 18592 const requiredCount = fieldDefinitions.filter( 18593 (f2) => !!f2.isValid?.required 18594 ).length; 18595 const optionalCount = fieldDefinitions.length - requiredCount; 18596 return requiredCount > optionalCount; 18597 }, [fieldDefinitions]); 18598 function getFieldDefinition2(field) { 18599 return fieldDefinitions.find( 18600 (fieldDefinition) => fieldDefinition.id === field.id 18601 ); 18602 } 18603 const Wrapper = as ?? getFormFieldLayout(form.layout.type)?.wrapper ?? DEFAULT_WRAPPER; 18604 return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(Wrapper, { layout: form.layout, children: form.fields.map((formField) => { 18605 const FieldLayout = getFormFieldLayout(formField.layout.type)?.component; 18606 if (!FieldLayout) { 18607 return null; 18608 } 18609 const fieldDefinition = !formField.children ? getFieldDefinition2(formField) : void 0; 18610 if (fieldDefinition && fieldDefinition.isVisible && !fieldDefinition.isVisible(data)) { 18611 return null; 18612 } 18613 if (children) { 18614 return children( 18615 FieldLayout, 18616 formField, 18617 validity?.[formField.id], 18618 markWhenOptional 18619 ); 18620 } 18621 return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)( 18622 FieldLayout, 18623 { 18624 data, 18625 field: formField, 18626 onChange, 18627 markWhenOptional, 18628 validity: validity?.[formField.id] 18629 }, 18630 formField.id 18631 ); 18632 }) }); 18633 } 18634 18635 // packages/dataviews/build-module/dataform/index.mjs 18636 var import_jsx_runtime79 = __toESM(require_jsx_runtime(), 1); 18637 function DataForm({ 18638 data, 18639 form, 18640 fields, 18641 onChange, 18642 validity 18643 }) { 18644 const normalizedForm = (0, import_element62.useMemo)(() => normalize_form_default(form), [form]); 18645 const normalizedFields = (0, import_element62.useMemo)( 18646 () => normalizeFields(fields), 18647 [fields] 18648 ); 18649 if (!form.fields) { 18650 return null; 18651 } 18652 return /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(DataFormProvider, { fields: normalizedFields, children: /* @__PURE__ */ (0, import_jsx_runtime79.jsx)( 18653 DataFormLayout, 18654 { 18655 data, 18656 form: normalizedForm, 18657 onChange, 18658 validity 18659 } 18660 ) }); 18661 } 18662 18663 // routes/experiments-home/stage.tsx 18664 var import_element63 = __toESM(require_element()); 18665 var import_i18n21 = __toESM(require_i18n()); 18666 var import_notices = __toESM(require_notices()); 18667 18668 // routes/experiments-home/style.scss 18669 if (typeof document !== "undefined" && true && !document.head.querySelector("style[data-wp-hash='b010998a76']")) { 18670 const style = document.createElement("style"); 18671 style.setAttribute("data-wp-hash", "b010998a76"); 18672 style.appendChild(document.createTextNode(".experiments-page__form{margin:0 auto;max-width:680px;padding:24px}")); 18673 document.head.appendChild(style); 18674 } 18675 18676 // routes/experiments-home/api.ts 18677 var import_api_fetch = __toESM(require_api_fetch()); 18678 async function fetchExperiments() { 18679 const response = await (0, import_api_fetch.default)({ 18680 path: "/wp/v2/settings", 18681 method: "OPTIONS" 18682 }); 18683 const properties = response?.schema?.properties?.["gutenberg-experiments"]?.properties ?? {}; 18684 return Object.entries(properties).map(([id, schema]) => ({ 18685 id, 18686 label: schema.title ?? id, 18687 description: schema.description ?? "", 18688 group: schema.group ?? "other", 18689 groupLabel: schema.group_label ?? "" 18690 })); 18691 } 18692 18693 // routes/experiments-home/stage.tsx 18694 function ExperimentsPage() { 18695 const [experiments, setExperiments] = (0, import_element63.useState)( 18696 null 18697 ); 18698 (0, import_element63.useEffect)(() => { 18699 fetchExperiments().then(setExperiments).catch(() => setExperiments([])); 18700 }, []); 18701 const { 18702 editedRecord, 18703 save: saveSettings, 18704 edit 18705 } = (0, import_core_data.useEntityRecord)("root", "site", void 0); 18706 const siteSettings = editedRecord; 18707 const { createSuccessNotice, createErrorNotice } = (0, import_data.useDispatch)(import_notices.store); 18708 const gutenbergExperiments = (0, import_element63.useMemo)( 18709 () => siteSettings?.["gutenberg-experiments"] || {}, 18710 [siteSettings] 18711 ); 18712 const settings = (0, import_element63.useMemo)(() => { 18713 const combined = {}; 18714 for (const exp of experiments ?? []) { 18715 combined[exp.id] = false; 18716 } 18717 for (const [key, value] of Object.entries(gutenbergExperiments)) { 18718 combined[key] = Boolean(value); 18719 } 18720 const activeTemplates = siteSettings?.active_templates; 18721 combined.active_templates = typeof activeTemplates === "object" && activeTemplates !== null; 18722 return combined; 18723 }, [experiments, gutenbergExperiments, siteSettings]); 18724 const setSettings = async (values) => { 18725 const [changedId] = Object.keys(values); 18726 const changedExperiment = (experiments ?? []).find( 18727 (exp) => exp.id === changedId 18728 ); 18729 const editPayload = {}; 18730 if ("active_templates" in values) { 18731 editPayload.active_templates = values.active_templates ? {} : null; 18732 delete values.active_templates; 18733 } 18734 if (Object.keys(values).length > 0) { 18735 editPayload["gutenberg-experiments"] = { 18736 ...gutenbergExperiments, 18737 ...values 18738 }; 18739 } 18740 const groupLabel = changedExperiment?.groupLabel ?? ""; 18741 edit(editPayload); 18742 try { 18743 await saveSettings(); 18744 createSuccessNotice( 18745 (0, import_i18n21.sprintf)( 18746 /* translators: %s: Experiment group name, e.g. "Blocks". */ 18747 (0, import_i18n21.__)("%s settings updated."), 18748 groupLabel 18749 ), 18750 { type: "snackbar" } 18751 ); 18752 } catch { 18753 createErrorNotice( 18754 (0, import_i18n21.sprintf)( 18755 /* translators: %s: Experiment group name, e.g. "Blocks". */ 18756 (0, import_i18n21.__)("Failed to update %s settings."), 18757 groupLabel 18758 ), 18759 { type: "snackbar" } 18760 ); 18761 } 18762 }; 18763 const fields = (0, import_element63.useMemo)(() => { 18764 if (!experiments?.length) { 18765 return []; 18766 } 18767 return experiments.map((experiment) => ({ 18768 Edit: "toggle", 18769 id: experiment.id, 18770 label: experiment.label, 18771 description: experiment.description, 18772 type: "boolean" 18773 })); 18774 }, [experiments]); 18775 const formFields = (0, import_element63.useMemo)(() => { 18776 if (!experiments?.length) { 18777 return []; 18778 } 18779 const groups = /* @__PURE__ */ new Map(); 18780 experiments.forEach((experiment) => { 18781 const slug = experiment.group || "other"; 18782 if (!groups.has(slug)) { 18783 groups.set(slug, { 18784 label: experiment.groupLabel || slug, 18785 items: [] 18786 }); 18787 } 18788 groups.get(slug).items.push(experiment.id); 18789 }); 18790 return Array.from(groups.entries()).map(([slug, group]) => ({ 18791 id: `gutenberg-experiments--$slug}`, 18792 label: group.label, 18793 layout: { 18794 type: "card", 18795 withHeader: true, 18796 isCollapsible: true, 18797 isOpened: true 18798 }, 18799 children: group.items 18800 })); 18801 }, [experiments]); 18802 if (experiments === null || !siteSettings) { 18803 return /* @__PURE__ */ React.createElement(import_components26.Spinner, null); 18804 } 18805 return /* @__PURE__ */ React.createElement( 18806 page_default, 18807 { 18808 title: (0, import_i18n21.__)("Experimental settings"), 18809 subTitle: (0, import_i18n21.__)( 18810 "The block editor includes experimental features that are usable while they're in development. Select the ones you'd like to enable. These features are likely to change, so avoid using them in production." 18811 ) 18812 }, 18813 /* @__PURE__ */ React.createElement("div", { className: "experiments-page__form" }, /* @__PURE__ */ React.createElement( 18814 DataForm, 18815 { 18816 data: settings, 18817 fields, 18818 form: { 18819 layout: { type: "card" }, 18820 fields: formFields 18821 }, 18822 onChange: (values) => { 18823 setSettings(values); 18824 } 18825 } 18826 )) 18827 ); 18828 } 18829 function Stage() { 18830 return /* @__PURE__ */ React.createElement(ExperimentsPage, null); 18831 } 18832 var stage = Stage; 18833 export { 18834 stage 18835 }; 18836 /*! Bundled license information: 18837 18838 use-sync-external-store/cjs/use-sync-external-store-shim.development.js: 18839 (** 18840 * @license React 18841 * use-sync-external-store-shim.development.js 18842 * 18843 * Copyright (c) Meta Platforms, Inc. and affiliates. 18844 * 18845 * This source code is licensed under the MIT license found in the 18846 * LICENSE file in the root directory of this source tree. 18847 *) 18848 18849 use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js: 18850 (** 18851 * @license React 18852 * use-sync-external-store-shim/with-selector.development.js 18853 * 18854 * Copyright (c) Meta Platforms, Inc. and affiliates. 18855 * 18856 * This source code is licensed under the MIT license found in the 18857 * LICENSE file in the root directory of this source tree. 18858 *) 18859 */
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated : Tue Jun 30 08:20:12 2026 | Cross-referenced by PHPXref |