| [ Index ] |
PHP Cross Reference of WordPress Trunk (Updated Daily) |
[Summary view] [Print] [Text view]
1 (function() { 2 var wp; 3 (wp ||= {}).editWidgets = (() => { 4 var __create = Object.create; 5 var __defProp = Object.defineProperty; 6 var __getOwnPropDesc = Object.getOwnPropertyDescriptor; 7 var __getOwnPropNames = Object.getOwnPropertyNames; 8 var __getProtoOf = Object.getPrototypeOf; 9 var __hasOwnProp = Object.prototype.hasOwnProperty; 10 var __commonJS = (cb, mod) => function __require() { 11 return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; 12 }; 13 var __export = (target, all) => { 14 for (var name2 in all) 15 __defProp(target, name2, { get: all[name2], enumerable: true }); 16 }; 17 var __copyProps = (to, from, except, desc) => { 18 if (from && typeof from === "object" || typeof from === "function") { 19 for (let key of __getOwnPropNames(from)) 20 if (!__hasOwnProp.call(to, key) && key !== except) 21 __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); 22 } 23 return to; 24 }; 25 var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( 26 // If the importer is in node compatibility mode or this is not an ESM 27 // file that has been converted to a CommonJS file using a Babel- 28 // compatible transform (i.e. "__esModule" has not been set), then set 29 // "default" to the CommonJS "module.exports" for node compatibility. 30 isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, 31 mod 32 )); 33 var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); 34 35 // package-external:@wordpress/blocks 36 var require_blocks = __commonJS({ 37 "package-external:@wordpress/blocks"(exports, module) { 38 module.exports = window.wp.blocks; 39 } 40 }); 41 42 // package-external:@wordpress/data 43 var require_data = __commonJS({ 44 "package-external:@wordpress/data"(exports, module) { 45 module.exports = window.wp.data; 46 } 47 }); 48 49 // package-external:@wordpress/deprecated 50 var require_deprecated = __commonJS({ 51 "package-external:@wordpress/deprecated"(exports, module) { 52 module.exports = window.wp.deprecated; 53 } 54 }); 55 56 // package-external:@wordpress/element 57 var require_element = __commonJS({ 58 "package-external:@wordpress/element"(exports, module) { 59 module.exports = window.wp.element; 60 } 61 }); 62 63 // package-external:@wordpress/block-library 64 var require_block_library = __commonJS({ 65 "package-external:@wordpress/block-library"(exports, module) { 66 module.exports = window.wp.blockLibrary; 67 } 68 }); 69 70 // package-external:@wordpress/core-data 71 var require_core_data = __commonJS({ 72 "package-external:@wordpress/core-data"(exports, module) { 73 module.exports = window.wp.coreData; 74 } 75 }); 76 77 // package-external:@wordpress/widgets 78 var require_widgets = __commonJS({ 79 "package-external:@wordpress/widgets"(exports, module) { 80 module.exports = window.wp.widgets; 81 } 82 }); 83 84 // package-external:@wordpress/preferences 85 var require_preferences = __commonJS({ 86 "package-external:@wordpress/preferences"(exports, module) { 87 module.exports = window.wp.preferences; 88 } 89 }); 90 91 // package-external:@wordpress/api-fetch 92 var require_api_fetch = __commonJS({ 93 "package-external:@wordpress/api-fetch"(exports, module) { 94 module.exports = window.wp.apiFetch; 95 } 96 }); 97 98 // package-external:@wordpress/i18n 99 var require_i18n = __commonJS({ 100 "package-external:@wordpress/i18n"(exports, module) { 101 module.exports = window.wp.i18n; 102 } 103 }); 104 105 // package-external:@wordpress/notices 106 var require_notices = __commonJS({ 107 "package-external:@wordpress/notices"(exports, module) { 108 module.exports = window.wp.notices; 109 } 110 }); 111 112 // package-external:@wordpress/components 113 var require_components = __commonJS({ 114 "package-external:@wordpress/components"(exports, module) { 115 module.exports = window.wp.components; 116 } 117 }); 118 119 // package-external:@wordpress/primitives 120 var require_primitives = __commonJS({ 121 "package-external:@wordpress/primitives"(exports, module) { 122 module.exports = window.wp.primitives; 123 } 124 }); 125 126 // vendor-external:react/jsx-runtime 127 var require_jsx_runtime = __commonJS({ 128 "vendor-external:react/jsx-runtime"(exports, module) { 129 module.exports = window.ReactJSXRuntime; 130 } 131 }); 132 133 // package-external:@wordpress/viewport 134 var require_viewport = __commonJS({ 135 "package-external:@wordpress/viewport"(exports, module) { 136 module.exports = window.wp.viewport; 137 } 138 }); 139 140 // package-external:@wordpress/compose 141 var require_compose = __commonJS({ 142 "package-external:@wordpress/compose"(exports, module) { 143 module.exports = window.wp.compose; 144 } 145 }); 146 147 // package-external:@wordpress/plugins 148 var require_plugins = __commonJS({ 149 "package-external:@wordpress/plugins"(exports, module) { 150 module.exports = window.wp.plugins; 151 } 152 }); 153 154 // vendor-external:react 155 var require_react = __commonJS({ 156 "vendor-external:react"(exports, module) { 157 module.exports = window.React; 158 } 159 }); 160 161 // vendor-external:react-dom 162 var require_react_dom = __commonJS({ 163 "vendor-external:react-dom"(exports, module) { 164 module.exports = window.ReactDOM; 165 } 166 }); 167 168 // node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js 169 var require_use_sync_external_store_shim_development = __commonJS({ 170 "node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js"(exports) { 171 "use strict"; 172 (function() { 173 function is(x, y) { 174 return x === y && (0 !== x || 1 / x === 1 / y) || x !== x && y !== y; 175 } 176 function useSyncExternalStore$2(subscribe, getSnapshot) { 177 didWarnOld18Alpha || void 0 === React59.startTransition || (didWarnOld18Alpha = true, console.error( 178 "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." 179 )); 180 var value = getSnapshot(); 181 if (!didWarnUncachedGetSnapshot) { 182 var cachedValue = getSnapshot(); 183 objectIs(value, cachedValue) || (console.error( 184 "The result of getSnapshot should be cached to avoid an infinite loop" 185 ), didWarnUncachedGetSnapshot = true); 186 } 187 cachedValue = useState21({ 188 inst: { value, getSnapshot } 189 }); 190 var inst = cachedValue[0].inst, forceUpdate = cachedValue[1]; 191 useLayoutEffect4( 192 function() { 193 inst.value = value; 194 inst.getSnapshot = getSnapshot; 195 checkIfSnapshotChanged(inst) && forceUpdate({ inst }); 196 }, 197 [subscribe, value, getSnapshot] 198 ); 199 useEffect26( 200 function() { 201 checkIfSnapshotChanged(inst) && forceUpdate({ inst }); 202 return subscribe(function() { 203 checkIfSnapshotChanged(inst) && forceUpdate({ inst }); 204 }); 205 }, 206 [subscribe] 207 ); 208 useDebugValue2(value); 209 return value; 210 } 211 function checkIfSnapshotChanged(inst) { 212 var latestGetSnapshot = inst.getSnapshot; 213 inst = inst.value; 214 try { 215 var nextValue = latestGetSnapshot(); 216 return !objectIs(inst, nextValue); 217 } catch (error2) { 218 return true; 219 } 220 } 221 function useSyncExternalStore$1(subscribe, getSnapshot) { 222 return getSnapshot(); 223 } 224 "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error()); 225 var React59 = require_react(), objectIs = "function" === typeof Object.is ? Object.is : is, useState21 = React59.useState, useEffect26 = 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; 226 exports.useSyncExternalStore = void 0 !== React59.useSyncExternalStore ? React59.useSyncExternalStore : shim; 227 "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error()); 228 })(); 229 } 230 }); 231 232 // node_modules/use-sync-external-store/shim/index.js 233 var require_shim = __commonJS({ 234 "node_modules/use-sync-external-store/shim/index.js"(exports, module) { 235 "use strict"; 236 if (false) { 237 module.exports = null; 238 } else { 239 module.exports = require_use_sync_external_store_shim_development(); 240 } 241 } 242 }); 243 244 // node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js 245 var require_with_selector_development = __commonJS({ 246 "node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js"(exports) { 247 "use strict"; 248 (function() { 249 function is(x, y) { 250 return x === y && (0 !== x || 1 / x === 1 / y) || x !== x && y !== y; 251 } 252 "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error()); 253 var React59 = require_react(), shim = require_shim(), objectIs = "function" === typeof Object.is ? Object.is : is, useSyncExternalStore3 = shim.useSyncExternalStore, useRef27 = React59.useRef, useEffect26 = React59.useEffect, useMemo24 = React59.useMemo, useDebugValue2 = React59.useDebugValue; 254 exports.useSyncExternalStoreWithSelector = function(subscribe, getSnapshot, getServerSnapshot, selector, isEqual) { 255 var instRef = useRef27(null); 256 if (null === instRef.current) { 257 var inst = { hasValue: false, value: null }; 258 instRef.current = inst; 259 } else inst = instRef.current; 260 instRef = useMemo24( 261 function() { 262 function memoizedSelector(nextSnapshot) { 263 if (!hasMemo) { 264 hasMemo = true; 265 memoizedSnapshot = nextSnapshot; 266 nextSnapshot = selector(nextSnapshot); 267 if (void 0 !== isEqual && inst.hasValue) { 268 var currentSelection = inst.value; 269 if (isEqual(currentSelection, nextSnapshot)) 270 return memoizedSelection = currentSelection; 271 } 272 return memoizedSelection = nextSnapshot; 273 } 274 currentSelection = memoizedSelection; 275 if (objectIs(memoizedSnapshot, nextSnapshot)) 276 return currentSelection; 277 var nextSelection = selector(nextSnapshot); 278 if (void 0 !== isEqual && isEqual(currentSelection, nextSelection)) 279 return memoizedSnapshot = nextSnapshot, currentSelection; 280 memoizedSnapshot = nextSnapshot; 281 return memoizedSelection = nextSelection; 282 } 283 var hasMemo = false, memoizedSnapshot, memoizedSelection, maybeGetServerSnapshot = void 0 === getServerSnapshot ? null : getServerSnapshot; 284 return [ 285 function() { 286 return memoizedSelector(getSnapshot()); 287 }, 288 null === maybeGetServerSnapshot ? void 0 : function() { 289 return memoizedSelector(maybeGetServerSnapshot()); 290 } 291 ]; 292 }, 293 [getSnapshot, getServerSnapshot, selector, isEqual] 294 ); 295 var value = useSyncExternalStore3(subscribe, instRef[0], instRef[1]); 296 useEffect26( 297 function() { 298 inst.hasValue = true; 299 inst.value = value; 300 }, 301 [value] 302 ); 303 useDebugValue2(value); 304 return value; 305 }; 306 "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error()); 307 })(); 308 } 309 }); 310 311 // node_modules/use-sync-external-store/shim/with-selector.js 312 var require_with_selector = __commonJS({ 313 "node_modules/use-sync-external-store/shim/with-selector.js"(exports, module) { 314 "use strict"; 315 if (false) { 316 module.exports = null; 317 } else { 318 module.exports = require_with_selector_development(); 319 } 320 } 321 }); 322 323 // package-external:@wordpress/theme 324 var require_theme = __commonJS({ 325 "package-external:@wordpress/theme"(exports, module) { 326 module.exports = window.wp.theme; 327 } 328 }); 329 330 // package-external:@wordpress/private-apis 331 var require_private_apis = __commonJS({ 332 "package-external:@wordpress/private-apis"(exports, module) { 333 module.exports = window.wp.privateApis; 334 } 335 }); 336 337 // package-external:@wordpress/a11y 338 var require_a11y = __commonJS({ 339 "package-external:@wordpress/a11y"(exports, module) { 340 module.exports = window.wp.a11y; 341 } 342 }); 343 344 // package-external:@wordpress/block-editor 345 var require_block_editor = __commonJS({ 346 "package-external:@wordpress/block-editor"(exports, module) { 347 module.exports = window.wp.blockEditor; 348 } 349 }); 350 351 // package-external:@wordpress/hooks 352 var require_hooks = __commonJS({ 353 "package-external:@wordpress/hooks"(exports, module) { 354 module.exports = window.wp.hooks; 355 } 356 }); 357 358 // package-external:@wordpress/media-utils 359 var require_media_utils = __commonJS({ 360 "package-external:@wordpress/media-utils"(exports, module) { 361 module.exports = window.wp.mediaUtils; 362 } 363 }); 364 365 // package-external:@wordpress/patterns 366 var require_patterns = __commonJS({ 367 "package-external:@wordpress/patterns"(exports, module) { 368 module.exports = window.wp.patterns; 369 } 370 }); 371 372 // package-external:@wordpress/keyboard-shortcuts 373 var require_keyboard_shortcuts = __commonJS({ 374 "package-external:@wordpress/keyboard-shortcuts"(exports, module) { 375 module.exports = window.wp.keyboardShortcuts; 376 } 377 }); 378 379 // package-external:@wordpress/keycodes 380 var require_keycodes = __commonJS({ 381 "package-external:@wordpress/keycodes"(exports, module) { 382 module.exports = window.wp.keycodes; 383 } 384 }); 385 386 // package-external:@wordpress/url 387 var require_url = __commonJS({ 388 "package-external:@wordpress/url"(exports, module) { 389 module.exports = window.wp.url; 390 } 391 }); 392 393 // package-external:@wordpress/dom 394 var require_dom = __commonJS({ 395 "package-external:@wordpress/dom"(exports, module) { 396 module.exports = window.wp.dom; 397 } 398 }); 399 400 // packages/edit-widgets/build-module/index.mjs 401 var index_exports = {}; 402 __export(index_exports, { 403 initialize: () => initialize, 404 initializeEditor: () => initializeEditor, 405 reinitializeEditor: () => reinitializeEditor, 406 store: () => store2 407 }); 408 var import_blocks3 = __toESM(require_blocks(), 1); 409 var import_data33 = __toESM(require_data(), 1); 410 var import_deprecated6 = __toESM(require_deprecated(), 1); 411 var import_element70 = __toESM(require_element(), 1); 412 var import_block_library = __toESM(require_block_library(), 1); 413 var import_core_data12 = __toESM(require_core_data(), 1); 414 var import_widgets5 = __toESM(require_widgets(), 1); 415 var import_preferences10 = __toESM(require_preferences(), 1); 416 417 // packages/edit-widgets/build-module/store/index.mjs 418 var import_api_fetch = __toESM(require_api_fetch(), 1); 419 var import_data8 = __toESM(require_data(), 1); 420 421 // packages/edit-widgets/build-module/store/reducer.mjs 422 var import_data = __toESM(require_data(), 1); 423 function widgetAreasOpenState(state = {}, action) { 424 const { type } = action; 425 switch (type) { 426 case "SET_WIDGET_AREAS_OPEN_STATE": { 427 return action.widgetAreasOpenState; 428 } 429 case "SET_IS_WIDGET_AREA_OPEN": { 430 const { clientId, isOpen } = action; 431 return { 432 ...state, 433 [clientId]: isOpen 434 }; 435 } 436 default: { 437 return state; 438 } 439 } 440 } 441 function blockInserterPanel(state = false, action) { 442 switch (action.type) { 443 case "SET_IS_LIST_VIEW_OPENED": 444 return action.isOpen ? false : state; 445 case "SET_IS_INSERTER_OPENED": 446 return action.value; 447 } 448 return state; 449 } 450 function listViewPanel(state = false, action) { 451 switch (action.type) { 452 case "SET_IS_INSERTER_OPENED": 453 return action.value ? false : state; 454 case "SET_IS_LIST_VIEW_OPENED": 455 return action.isOpen; 456 } 457 return state; 458 } 459 function listViewToggleRef(state = { current: null }) { 460 return state; 461 } 462 function inserterSidebarToggleRef(state = { current: null }) { 463 return state; 464 } 465 function widgetSavingLock(state = {}, action) { 466 switch (action.type) { 467 case "LOCK_WIDGET_SAVING": 468 return { ...state, [action.lockName]: true }; 469 case "UNLOCK_WIDGET_SAVING": { 470 const { [action.lockName]: removedLockName, ...restState } = state; 471 return restState; 472 } 473 } 474 return state; 475 } 476 var reducer_default = (0, import_data.combineReducers)({ 477 blockInserterPanel, 478 inserterSidebarToggleRef, 479 listViewPanel, 480 listViewToggleRef, 481 widgetAreasOpenState, 482 widgetSavingLock 483 }); 484 485 // packages/edit-widgets/build-module/store/resolvers.mjs 486 var resolvers_exports = {}; 487 __export(resolvers_exports, { 488 getWidgetAreas: () => getWidgetAreas, 489 getWidgets: () => getWidgets 490 }); 491 var import_blocks2 = __toESM(require_blocks(), 1); 492 var import_core_data2 = __toESM(require_core_data(), 1); 493 494 // packages/edit-widgets/build-module/store/actions.mjs 495 var actions_exports2 = {}; 496 __export(actions_exports2, { 497 closeGeneralSidebar: () => closeGeneralSidebar, 498 lockWidgetSaving: () => lockWidgetSaving, 499 moveBlockToWidgetArea: () => moveBlockToWidgetArea, 500 persistStubPost: () => persistStubPost, 501 saveEditedWidgetAreas: () => saveEditedWidgetAreas, 502 saveWidgetArea: () => saveWidgetArea, 503 saveWidgetAreas: () => saveWidgetAreas, 504 setIsInserterOpened: () => setIsInserterOpened, 505 setIsListViewOpened: () => setIsListViewOpened, 506 setIsWidgetAreaOpen: () => setIsWidgetAreaOpen, 507 setWidgetAreasOpenState: () => setWidgetAreasOpenState, 508 setWidgetIdForClientId: () => setWidgetIdForClientId, 509 unlockWidgetSaving: () => unlockWidgetSaving 510 }); 511 var import_i18n8 = __toESM(require_i18n(), 1); 512 var import_notices = __toESM(require_notices(), 1); 513 514 // node_modules/clsx/dist/clsx.mjs 515 function r(e) { 516 var t, f, n = ""; 517 if ("string" == typeof e || "number" == typeof e) n += e; 518 else if ("object" == typeof e) if (Array.isArray(e)) { 519 var o = e.length; 520 for (t = 0; t < o; t++) e[t] && (f = r(e[t])) && (n && (n += " "), n += f); 521 } else for (f in e) e[f] && (n && (n += " "), n += f); 522 return n; 523 } 524 function clsx() { 525 for (var e, t, f = 0, n = "", o = arguments.length; f < o; f++) (e = arguments[f]) && (t = r(e)) && (n && (n += " "), n += t); 526 return n; 527 } 528 var clsx_default = clsx; 529 530 // packages/interface/build-module/components/complementary-area/index.mjs 531 var import_components4 = __toESM(require_components(), 1); 532 var import_data6 = __toESM(require_data(), 1); 533 var import_i18n = __toESM(require_i18n(), 1); 534 535 // packages/icons/build-module/library/caution.mjs 536 var import_primitives = __toESM(require_primitives(), 1); 537 var import_jsx_runtime = __toESM(require_jsx_runtime(), 1); 538 var caution_default = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_primitives.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", style: { fill: "none" }, stroke: "currentColor", strokeWidth: "1.5", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_primitives.Path, { d: "M12 8L12 13M12 14.5L12 16M4.75 12C4.75 7.99593 7.99594 4.75 12 4.75C16.0041 4.75 19.25 7.99594 19.25 12C19.25 16.0041 16.0041 19.25 12 19.25C7.99594 19.25 4.75 16.0041 4.75 12Z", strokeLinejoin: "round", vectorEffect: "non-scaling-stroke" }) }); 539 540 // packages/icons/build-module/library/check.mjs 541 var import_primitives2 = __toESM(require_primitives(), 1); 542 var import_jsx_runtime2 = __toESM(require_jsx_runtime(), 1); 543 var check_default = /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_primitives2.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", style: { fill: "none" }, stroke: "currentColor", strokeWidth: "1.5", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_primitives2.Path, { d: "M7 12L10 15L17 8", vectorEffect: "non-scaling-stroke" }) }); 544 545 // packages/icons/build-module/library/chevron-down.mjs 546 var import_primitives3 = __toESM(require_primitives(), 1); 547 var import_jsx_runtime3 = __toESM(require_jsx_runtime(), 1); 548 var chevron_down_default = /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_primitives3.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", style: { fill: "none" }, stroke: "currentColor", strokeWidth: "1.5", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_primitives3.Path, { d: "M7 11L12 15L17 11", vectorEffect: "non-scaling-stroke" }) }); 549 550 // packages/icons/build-module/library/close-small.mjs 551 var import_primitives4 = __toESM(require_primitives(), 1); 552 var import_jsx_runtime4 = __toESM(require_jsx_runtime(), 1); 553 var close_small_default = /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_primitives4.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", style: { fill: "none" }, stroke: "currentColor", strokeWidth: "1.5", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_primitives4.Path, { d: "M7.75 16.25L16.25 7.75M16.25 16.25L7.75 7.75", vectorEffect: "non-scaling-stroke" }) }); 554 555 // packages/icons/build-module/library/drawer-left.mjs 556 var import_primitives5 = __toESM(require_primitives(), 1); 557 var import_jsx_runtime5 = __toESM(require_jsx_runtime(), 1); 558 var drawer_left_default = /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_primitives5.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", style: { fill: "none" }, stroke: "currentColor", strokeWidth: "1.5", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_primitives5.Path, { d: "M9.75 4.75H6C5.30964 4.75 4.75 5.30964 4.75 6V18C4.75 18.6904 5.30964 19.25 6 19.25H9.75M9.75 4.75H18C18.6904 4.75 19.25 5.30964 19.25 6V18C19.25 18.6904 18.6904 19.25 18 19.25H9.75M9.75 4.75V19.25", vectorEffect: "non-scaling-stroke" }) }); 559 560 // packages/icons/build-module/library/drawer-right.mjs 561 var import_primitives6 = __toESM(require_primitives(), 1); 562 var import_jsx_runtime6 = __toESM(require_jsx_runtime(), 1); 563 var drawer_right_default = /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_primitives6.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", style: { fill: "none" }, stroke: "currentColor", strokeWidth: "1.5", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_primitives6.Path, { d: "M14.25 19.25L18 19.25C18.6904 19.25 19.25 18.6904 19.25 18L19.25 6C19.25 5.30964 18.6904 4.75 18 4.75L14.25 4.75M14.25 19.25L6 19.25C5.30964 19.25 4.75 18.6904 4.75 18L4.75 6C4.75 5.30964 5.30965 4.75 6 4.75L14.25 4.75M14.25 19.25L14.25 4.75", vectorEffect: "non-scaling-stroke" }) }); 564 565 // packages/icons/build-module/library/error.mjs 566 var import_primitives7 = __toESM(require_primitives(), 1); 567 var import_jsx_runtime7 = __toESM(require_jsx_runtime(), 1); 568 var error_default = /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_primitives7.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", style: { fill: "none" }, stroke: "currentColor", strokeWidth: "1.5", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_primitives7.Path, { d: "M12 9L12 14M12 15.5V17M11.1284 5.04947L3.83827 18.0097C3.46331 18.6763 3.94502 19.5 4.70985 19.5H19.2902C20.055 19.5 20.5367 18.6763 20.1617 18.0097L12.8716 5.04947C12.4893 4.36982 11.5107 4.36982 11.1284 5.04947Z", vectorEffect: "non-scaling-stroke" }) }); 569 570 // packages/icons/build-module/library/external.mjs 571 var import_primitives8 = __toESM(require_primitives(), 1); 572 var import_jsx_runtime8 = __toESM(require_jsx_runtime(), 1); 573 var external_default = /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_primitives8.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", style: { fill: "none" }, stroke: "currentColor", strokeWidth: "1.5", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_primitives8.Path, { d: "M9.5 6.25H6.5C5.80964 6.25 5.25 6.80964 5.25 7.5V17.5C5.25 18.1904 5.80964 18.75 6.5 18.75H16.5C17.1904 18.75 17.75 18.1904 17.75 17.5V14.5M11.5 12.5L18.75 5.25M12.5 5.25H18.75V11.5", vectorEffect: "non-scaling-stroke" }) }); 574 575 // packages/icons/build-module/library/info.mjs 576 var import_primitives9 = __toESM(require_primitives(), 1); 577 var import_jsx_runtime9 = __toESM(require_jsx_runtime(), 1); 578 var info_default = /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_primitives9.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", style: { fill: "none" }, stroke: "currentColor", strokeWidth: "1.5", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_primitives9.Path, { d: "M12 16V11M12 9.5V8M19.25 12C19.25 16.0041 16.0041 19.25 12 19.25C7.99594 19.25 4.75 16.0041 4.75 12C4.75 7.99594 7.99594 4.75 12 4.75C16.0041 4.75 19.25 7.99594 19.25 12Z", strokeLinejoin: "round", vectorEffect: "non-scaling-stroke" }) }); 579 580 // packages/icons/build-module/library/layout.mjs 581 var import_primitives10 = __toESM(require_primitives(), 1); 582 var import_jsx_runtime10 = __toESM(require_jsx_runtime(), 1); 583 var layout_default = /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_primitives10.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", style: { fill: "none" }, stroke: "currentColor", strokeWidth: "1.5", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_primitives10.Path, { d: "M9.75 19.25H18C18.6904 19.25 19.25 18.6904 19.25 18V9.75M9.75 19.25H6C5.30964 19.25 4.75 18.6904 4.75 18V9.75M9.75 19.25V9.75M19.25 9.75V6C19.25 5.30964 18.6904 4.75 18 4.75H6C5.30964 4.75 4.75 5.30964 4.75 6V9.75M19.25 9.75H9.75M9.75 9.75H4.75", vectorEffect: "non-scaling-stroke" }) }); 584 585 // packages/icons/build-module/library/list-view.mjs 586 var import_primitives11 = __toESM(require_primitives(), 1); 587 var import_jsx_runtime11 = __toESM(require_jsx_runtime(), 1); 588 var list_view_default = /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_primitives11.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", style: { fill: "none" }, stroke: "currentColor", strokeWidth: "1.5", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_primitives11.Path, { d: "M10 17.5H21M6.5 12H17.5M3 6.5H14", strokeLinejoin: "round", vectorEffect: "non-scaling-stroke" }) }); 589 590 // packages/icons/build-module/library/more-vertical.mjs 591 var import_primitives12 = __toESM(require_primitives(), 1); 592 var import_jsx_runtime12 = __toESM(require_jsx_runtime(), 1); 593 var more_vertical_default = /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_primitives12.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", style: { fill: "none" }, stroke: "currentColor", strokeWidth: "1.5", children: [ 594 /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_primitives12.Path, { d: "M11.75 18.25L12.25 18.25L12.25 17.75L11.75 17.75L11.75 18.25Z", fill: "currentColor", stroke: "none" }), 595 /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_primitives12.Path, { d: "M11.75 12.25L12.25 12.25L12.25 11.75L11.75 11.75L11.75 12.25Z", fill: "currentColor", stroke: "none" }), 596 /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_primitives12.Path, { d: "M11.75 6.25L12.25 6.25L12.25 5.75L11.75 5.75L11.75 6.25Z", fill: "currentColor", stroke: "none" }), 597 /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_primitives12.Path, { d: "M11.75 18.25L12.25 18.25L12.25 17.75L11.75 17.75L11.75 18.25Z", vectorEffect: "non-scaling-stroke" }), 598 /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_primitives12.Path, { d: "M11.75 12.25L12.25 12.25L12.25 11.75L11.75 11.75L11.75 12.25Z", vectorEffect: "non-scaling-stroke" }), 599 /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_primitives12.Path, { d: "M11.75 6.25L12.25 6.25L12.25 5.75L11.75 5.75L11.75 6.25Z", vectorEffect: "non-scaling-stroke" }) 600 ] }); 601 602 // packages/icons/build-module/library/plus.mjs 603 var import_primitives13 = __toESM(require_primitives(), 1); 604 var import_jsx_runtime13 = __toESM(require_jsx_runtime(), 1); 605 var plus_default = /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_primitives13.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", style: { fill: "none" }, stroke: "currentColor", strokeWidth: "1.5", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_primitives13.Path, { d: "M12 18V6M18 12H6", vectorEffect: "non-scaling-stroke" }) }); 606 607 // packages/icons/build-module/library/published.mjs 608 var import_primitives14 = __toESM(require_primitives(), 1); 609 var import_jsx_runtime14 = __toESM(require_jsx_runtime(), 1); 610 var published_default = /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_primitives14.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", style: { fill: "none" }, stroke: "currentColor", strokeWidth: "1.5", children: [ 611 /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_primitives14.Path, { d: "M12 19.25C16.0041 19.25 19.25 16.0041 19.25 12C19.25 7.99594 16.0041 4.75 12 4.75C7.99594 4.75 4.75 7.99594 4.75 12C4.75 16.0041 7.99594 19.25 12 19.25Z", strokeLinejoin: "round", vectorEffect: "non-scaling-stroke" }), 612 /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_primitives14.Path, { d: "M9 12L11 14L15 10", vectorEffect: "non-scaling-stroke" }) 613 ] }); 614 615 // packages/icons/build-module/library/redo.mjs 616 var import_primitives15 = __toESM(require_primitives(), 1); 617 var import_jsx_runtime15 = __toESM(require_jsx_runtime(), 1); 618 var redo_default = /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_primitives15.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", style: { fill: "none" }, stroke: "currentColor", strokeWidth: "1.5", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_primitives15.Path, { d: "M15 15L18.5 11L15 7M18.5 11H8C5 11 4.75 13.8 4.75 17", vectorEffect: "non-scaling-stroke" }) }); 619 620 // packages/icons/build-module/library/star-empty.mjs 621 var import_primitives16 = __toESM(require_primitives(), 1); 622 var import_jsx_runtime16 = __toESM(require_jsx_runtime(), 1); 623 var star_empty_default = /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_primitives16.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", style: { fill: "none" }, stroke: "currentColor", strokeWidth: "1.5", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_primitives16.Path, { d: "M12 5.71576L13.6106 8.97924C13.7563 9.27438 14.0379 9.47895 14.3636 9.52628L17.965 10.0496L15.359 12.5899C15.1233 12.8196 15.0157 13.1506 15.0714 13.475L15.6866 17.0619L12.4653 15.3684C12.174 15.2152 11.826 15.2152 11.5347 15.3684L8.31341 17.0619L8.92861 13.475C8.98425 13.1506 8.8767 12.8196 8.64102 12.5899L6.03497 10.0496L9.63644 9.52628C9.96215 9.47895 10.2437 9.27438 10.3894 8.97924L12 5.71576Z", vectorEffect: "non-scaling-stroke" }) }); 624 625 // packages/icons/build-module/library/star-filled.mjs 626 var import_primitives17 = __toESM(require_primitives(), 1); 627 var import_jsx_runtime17 = __toESM(require_jsx_runtime(), 1); 628 var star_filled_default = /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_primitives17.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", style: { fill: "none" }, stroke: "currentColor", strokeWidth: "1.5", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_primitives17.Path, { d: "M12 5.71576L13.6106 8.97924C13.7563 9.27438 14.0379 9.47895 14.3636 9.52628L17.965 10.0496L15.359 12.5899C15.1233 12.8196 15.0157 13.1506 15.0714 13.475L15.6866 17.0619L12.4653 15.3684C12.174 15.2152 11.826 15.2152 11.5347 15.3684L8.31341 17.0619L8.92861 13.475C8.98425 13.1506 8.8767 12.8196 8.64102 12.5899L6.03497 10.0496L9.63644 9.52628C9.96215 9.47895 10.2437 9.27438 10.3894 8.97924L12 5.71576Z", fill: "currentColor", vectorEffect: "non-scaling-stroke" }) }); 629 630 // packages/icons/build-module/library/undo.mjs 631 var import_primitives18 = __toESM(require_primitives(), 1); 632 var import_jsx_runtime18 = __toESM(require_jsx_runtime(), 1); 633 var undo_default = /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_primitives18.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", style: { fill: "none" }, stroke: "currentColor", strokeWidth: "1.5", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_primitives18.Path, { d: "M8.25 15L4.75 11L8.25 7M4.75 11H15.25C18.25 11 18.5 13.8 18.5 17", vectorEffect: "non-scaling-stroke" }) }); 634 635 // packages/interface/build-module/components/complementary-area/index.mjs 636 var import_element3 = __toESM(require_element(), 1); 637 var import_viewport = __toESM(require_viewport(), 1); 638 var import_preferences3 = __toESM(require_preferences(), 1); 639 var import_compose2 = __toESM(require_compose(), 1); 640 var import_plugins2 = __toESM(require_plugins(), 1); 641 642 // packages/interface/build-module/components/complementary-area-toggle/index.mjs 643 var import_components = __toESM(require_components(), 1); 644 var import_data5 = __toESM(require_data(), 1); 645 var import_plugins = __toESM(require_plugins(), 1); 646 647 // packages/interface/build-module/store/index.mjs 648 var import_data4 = __toESM(require_data(), 1); 649 650 // packages/interface/build-module/store/actions.mjs 651 var actions_exports = {}; 652 __export(actions_exports, { 653 closeModal: () => closeModal, 654 disableComplementaryArea: () => disableComplementaryArea, 655 enableComplementaryArea: () => enableComplementaryArea, 656 openModal: () => openModal, 657 pinItem: () => pinItem, 658 setDefaultComplementaryArea: () => setDefaultComplementaryArea, 659 setFeatureDefaults: () => setFeatureDefaults, 660 setFeatureValue: () => setFeatureValue, 661 toggleFeature: () => toggleFeature, 662 unpinItem: () => unpinItem 663 }); 664 var import_deprecated2 = __toESM(require_deprecated(), 1); 665 var import_preferences = __toESM(require_preferences(), 1); 666 667 // packages/interface/build-module/store/deprecated.mjs 668 var import_deprecated = __toESM(require_deprecated(), 1); 669 function normalizeComplementaryAreaScope(scope) { 670 if (["core/edit-post", "core/edit-site"].includes(scope)) { 671 (0, import_deprecated.default)(`$scope} interface scope`, { 672 alternative: "core interface scope", 673 hint: "core/edit-post and core/edit-site are merging.", 674 version: "6.6" 675 }); 676 return "core"; 677 } 678 return scope; 679 } 680 function normalizeComplementaryAreaName(scope, name2) { 681 if (scope === "core" && name2 === "edit-site/template") { 682 (0, import_deprecated.default)(`edit-site/template sidebar`, { 683 alternative: "edit-post/document", 684 version: "6.6" 685 }); 686 return "edit-post/document"; 687 } 688 if (scope === "core" && name2 === "edit-site/block-inspector") { 689 (0, import_deprecated.default)(`edit-site/block-inspector sidebar`, { 690 alternative: "edit-post/block", 691 version: "6.6" 692 }); 693 return "edit-post/block"; 694 } 695 return name2; 696 } 697 698 // packages/interface/build-module/store/actions.mjs 699 var setDefaultComplementaryArea = (scope, area) => { 700 scope = normalizeComplementaryAreaScope(scope); 701 area = normalizeComplementaryAreaName(scope, area); 702 return { 703 type: "SET_DEFAULT_COMPLEMENTARY_AREA", 704 scope, 705 area 706 }; 707 }; 708 var enableComplementaryArea = (scope, area) => ({ registry, dispatch: dispatch2 }) => { 709 if (!area) { 710 return; 711 } 712 scope = normalizeComplementaryAreaScope(scope); 713 area = normalizeComplementaryAreaName(scope, area); 714 const isComplementaryAreaVisible = registry.select(import_preferences.store).get(scope, "isComplementaryAreaVisible"); 715 if (!isComplementaryAreaVisible) { 716 registry.dispatch(import_preferences.store).set(scope, "isComplementaryAreaVisible", true); 717 } 718 dispatch2({ 719 type: "ENABLE_COMPLEMENTARY_AREA", 720 scope, 721 area 722 }); 723 }; 724 var disableComplementaryArea = (scope) => ({ registry }) => { 725 scope = normalizeComplementaryAreaScope(scope); 726 const isComplementaryAreaVisible = registry.select(import_preferences.store).get(scope, "isComplementaryAreaVisible"); 727 if (isComplementaryAreaVisible) { 728 registry.dispatch(import_preferences.store).set(scope, "isComplementaryAreaVisible", false); 729 } 730 }; 731 var pinItem = (scope, item) => ({ registry }) => { 732 if (!item) { 733 return; 734 } 735 scope = normalizeComplementaryAreaScope(scope); 736 item = normalizeComplementaryAreaName(scope, item); 737 const pinnedItems = registry.select(import_preferences.store).get(scope, "pinnedItems"); 738 if (pinnedItems?.[item] === true) { 739 return; 740 } 741 registry.dispatch(import_preferences.store).set(scope, "pinnedItems", { 742 ...pinnedItems, 743 [item]: true 744 }); 745 }; 746 var unpinItem = (scope, item) => ({ registry }) => { 747 if (!item) { 748 return; 749 } 750 scope = normalizeComplementaryAreaScope(scope); 751 item = normalizeComplementaryAreaName(scope, item); 752 const pinnedItems = registry.select(import_preferences.store).get(scope, "pinnedItems"); 753 registry.dispatch(import_preferences.store).set(scope, "pinnedItems", { 754 ...pinnedItems, 755 [item]: false 756 }); 757 }; 758 function toggleFeature(scope, featureName) { 759 return function({ registry }) { 760 (0, import_deprecated2.default)(`dispatch( 'core/interface' ).toggleFeature`, { 761 since: "6.0", 762 alternative: `dispatch( 'core/preferences' ).toggle` 763 }); 764 registry.dispatch(import_preferences.store).toggle(scope, featureName); 765 }; 766 } 767 function setFeatureValue(scope, featureName, value) { 768 return function({ registry }) { 769 (0, import_deprecated2.default)(`dispatch( 'core/interface' ).setFeatureValue`, { 770 since: "6.0", 771 alternative: `dispatch( 'core/preferences' ).set` 772 }); 773 registry.dispatch(import_preferences.store).set(scope, featureName, !!value); 774 }; 775 } 776 function setFeatureDefaults(scope, defaults) { 777 return function({ registry }) { 778 (0, import_deprecated2.default)(`dispatch( 'core/interface' ).setFeatureDefaults`, { 779 since: "6.0", 780 alternative: `dispatch( 'core/preferences' ).setDefaults` 781 }); 782 registry.dispatch(import_preferences.store).setDefaults(scope, defaults); 783 }; 784 } 785 function openModal(name2) { 786 return { 787 type: "OPEN_MODAL", 788 name: name2 789 }; 790 } 791 function closeModal() { 792 return { 793 type: "CLOSE_MODAL" 794 }; 795 } 796 797 // packages/interface/build-module/store/selectors.mjs 798 var selectors_exports = {}; 799 __export(selectors_exports, { 800 getActiveComplementaryArea: () => getActiveComplementaryArea, 801 isComplementaryAreaLoading: () => isComplementaryAreaLoading, 802 isFeatureActive: () => isFeatureActive, 803 isItemPinned: () => isItemPinned, 804 isModalActive: () => isModalActive 805 }); 806 var import_data2 = __toESM(require_data(), 1); 807 var import_deprecated4 = __toESM(require_deprecated(), 1); 808 var import_preferences2 = __toESM(require_preferences(), 1); 809 var getActiveComplementaryArea = (0, import_data2.createRegistrySelector)( 810 (select) => (state, scope) => { 811 scope = normalizeComplementaryAreaScope(scope); 812 const isComplementaryAreaVisible = select(import_preferences2.store).get( 813 scope, 814 "isComplementaryAreaVisible" 815 ); 816 if (isComplementaryAreaVisible === void 0) { 817 return void 0; 818 } 819 if (isComplementaryAreaVisible === false) { 820 return null; 821 } 822 return state?.complementaryAreas?.[scope]; 823 } 824 ); 825 var isComplementaryAreaLoading = (0, import_data2.createRegistrySelector)( 826 (select) => (state, scope) => { 827 scope = normalizeComplementaryAreaScope(scope); 828 const isVisible = select(import_preferences2.store).get( 829 scope, 830 "isComplementaryAreaVisible" 831 ); 832 const identifier = state?.complementaryAreas?.[scope]; 833 return isVisible && identifier === void 0; 834 } 835 ); 836 var isItemPinned = (0, import_data2.createRegistrySelector)( 837 (select) => (state, scope, item) => { 838 scope = normalizeComplementaryAreaScope(scope); 839 item = normalizeComplementaryAreaName(scope, item); 840 const pinnedItems = select( 841 import_preferences2.store 842 ).get(scope, "pinnedItems"); 843 return pinnedItems?.[item] ?? true; 844 } 845 ); 846 var isFeatureActive = (0, import_data2.createRegistrySelector)( 847 (select) => (state, scope, featureName) => { 848 (0, import_deprecated4.default)( 849 `select( 'core/interface' ).isFeatureActive( scope, featureName )`, 850 { 851 since: "6.0", 852 alternative: `select( 'core/preferences' ).get( scope, featureName )` 853 } 854 ); 855 return !!select(import_preferences2.store).get(scope, featureName); 856 } 857 ); 858 function isModalActive(state, modalName) { 859 return state.activeModal === modalName; 860 } 861 862 // packages/interface/build-module/store/reducer.mjs 863 var import_data3 = __toESM(require_data(), 1); 864 function complementaryAreas(state = {}, action) { 865 switch (action.type) { 866 case "SET_DEFAULT_COMPLEMENTARY_AREA": { 867 const { scope, area } = action; 868 if (state[scope]) { 869 return state; 870 } 871 return { 872 ...state, 873 [scope]: area 874 }; 875 } 876 case "ENABLE_COMPLEMENTARY_AREA": { 877 const { scope, area } = action; 878 return { 879 ...state, 880 [scope]: area 881 }; 882 } 883 } 884 return state; 885 } 886 function activeModal(state = null, action) { 887 switch (action.type) { 888 case "OPEN_MODAL": 889 return action.name; 890 case "CLOSE_MODAL": 891 return null; 892 } 893 return state; 894 } 895 var reducer_default2 = (0, import_data3.combineReducers)({ 896 complementaryAreas, 897 activeModal 898 }); 899 900 // packages/interface/build-module/store/constants.mjs 901 var STORE_NAME = "core/interface"; 902 903 // packages/interface/build-module/store/index.mjs 904 var store = (0, import_data4.createReduxStore)(STORE_NAME, { 905 reducer: reducer_default2, 906 actions: actions_exports, 907 selectors: selectors_exports 908 }); 909 (0, import_data4.register)(store); 910 911 // packages/interface/build-module/components/complementary-area-toggle/index.mjs 912 var import_jsx_runtime19 = __toESM(require_jsx_runtime(), 1); 913 function roleSupportsCheckedState(role) { 914 return [ 915 "checkbox", 916 "option", 917 "radio", 918 "switch", 919 "menuitemcheckbox", 920 "menuitemradio", 921 "treeitem" 922 ].includes(role); 923 } 924 function ComplementaryAreaToggle({ 925 as = import_components.Button, 926 scope, 927 identifier: identifierProp, 928 icon: iconProp, 929 selectedIcon, 930 name: name2, 931 shortcut, 932 ...props 933 }) { 934 const ComponentToUse = as; 935 const context = (0, import_plugins.usePluginContext)(); 936 const icon = iconProp || context.icon; 937 const identifier = identifierProp || `$context.name}/$name2}`; 938 const isSelected = (0, import_data5.useSelect)( 939 (select) => select(store).getActiveComplementaryArea(scope) === identifier, 940 [identifier, scope] 941 ); 942 const { enableComplementaryArea: enableComplementaryArea2, disableComplementaryArea: disableComplementaryArea2 } = (0, import_data5.useDispatch)(store); 943 return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)( 944 ComponentToUse, 945 { 946 icon: selectedIcon && isSelected ? selectedIcon : icon, 947 "aria-controls": identifier.replace("/", ":"), 948 "aria-checked": roleSupportsCheckedState(props.role) ? isSelected : void 0, 949 onClick: () => { 950 if (isSelected) { 951 disableComplementaryArea2(scope); 952 } else { 953 enableComplementaryArea2(scope, identifier); 954 } 955 }, 956 shortcut, 957 ...props 958 } 959 ); 960 } 961 962 // packages/interface/build-module/components/complementary-area-header/index.mjs 963 var import_jsx_runtime20 = __toESM(require_jsx_runtime(), 1); 964 var ComplementaryAreaHeader = ({ 965 children, 966 className, 967 toggleButtonProps 968 }) => { 969 const toggleButton = /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(ComplementaryAreaToggle, { icon: close_small_default, ...toggleButtonProps }); 970 return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)( 971 "div", 972 { 973 className: clsx_default( 974 "components-panel__header", 975 "interface-complementary-area-header", 976 className 977 ), 978 tabIndex: -1, 979 children: [ 980 children, 981 toggleButton 982 ] 983 } 984 ); 985 }; 986 var complementary_area_header_default = ComplementaryAreaHeader; 987 988 // packages/interface/build-module/components/complementary-area-more-menu-item/index.mjs 989 var import_compose = __toESM(require_compose(), 1); 990 var import_element2 = __toESM(require_element(), 1); 991 992 // packages/interface/build-module/components/action-item/index.mjs 993 var import_components2 = __toESM(require_components(), 1); 994 var import_element = __toESM(require_element(), 1); 995 var import_jsx_runtime21 = __toESM(require_jsx_runtime(), 1); 996 function ActionItemSlot({ 997 name: name2, 998 as: Component2 = import_components2.MenuGroup, 999 fillProps = {}, 1000 children, 1001 ...props 1002 }) { 1003 return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_components2.Slot, { name: name2, fillProps, children: (fills) => { 1004 const items = import_element.Children.toArray(fills); 1005 if (!items.length) { 1006 return null; 1007 } 1008 if (typeof children === "function") { 1009 return children(items); 1010 } 1011 return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Component2, { ...props, children: items }); 1012 } }); 1013 } 1014 function ActionItem({ name: name2, as, onClick, ...props }) { 1015 return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_components2.Fill, { name: name2, children: ({ as: slotAs = import_components2.MenuItem, onClick: slotOnClick }) => { 1016 const Component2 = as ?? slotAs; 1017 const handlers = [onClick, slotOnClick].filter(Boolean); 1018 return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)( 1019 Component2, 1020 { 1021 onClick: handlers.length ? (...args) => handlers.forEach( 1022 (handler) => handler(...args) 1023 ) : void 0, 1024 ...props 1025 } 1026 ); 1027 } }); 1028 } 1029 ActionItem.Slot = ActionItemSlot; 1030 var action_item_default = ActionItem; 1031 1032 // packages/interface/build-module/components/complementary-area-more-menu-item/index.mjs 1033 var import_jsx_runtime22 = __toESM(require_jsx_runtime(), 1); 1034 var menuItems = (0, import_compose.observableMap)(); 1035 function useHasComplementaryAreaMenuItem(scope, target) { 1036 return !!(0, import_compose.useObservableValue)(menuItems, `$scope}/$target}`); 1037 } 1038 function DefaultComplementaryAreaMoreMenuItem({ 1039 scope, 1040 target, 1041 ...props 1042 }) { 1043 return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)( 1044 ComplementaryAreaToggle, 1045 { 1046 as: (toggleProps) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)( 1047 action_item_default, 1048 { 1049 name: `$scope}/plugin-more-menu`, 1050 ...toggleProps 1051 } 1052 ), 1053 role: "menuitemcheckbox", 1054 name: target, 1055 scope, 1056 ...props 1057 } 1058 ); 1059 } 1060 1061 // packages/interface/build-module/components/pinned-items/index.mjs 1062 var import_components3 = __toESM(require_components(), 1); 1063 var import_jsx_runtime23 = __toESM(require_jsx_runtime(), 1); 1064 function PinnedItems({ scope, ...props }) { 1065 return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_components3.Fill, { name: `PinnedItems/$scope}`, ...props }); 1066 } 1067 function PinnedItemsSlot({ 1068 scope, 1069 className, 1070 ...props 1071 }) { 1072 return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_components3.Slot, { name: `PinnedItems/$scope}`, ...props, children: (fills) => fills?.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)( 1073 "div", 1074 { 1075 className: clsx_default( 1076 className, 1077 "interface-pinned-items" 1078 ), 1079 children: fills 1080 } 1081 ) }); 1082 } 1083 PinnedItems.Slot = PinnedItemsSlot; 1084 var pinned_items_default = PinnedItems; 1085 1086 // packages/interface/build-module/components/complementary-area/index.mjs 1087 var import_jsx_runtime24 = __toESM(require_jsx_runtime(), 1); 1088 var ANIMATION_DURATION = 0.3; 1089 function ComplementaryAreaSlot({ 1090 scope, 1091 ...props 1092 }) { 1093 return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_components4.Slot, { name: `ComplementaryArea/$scope}`, ...props }); 1094 } 1095 var variants = { 1096 // `auto` leaves the width to the area's own stylesheet, so it stays in one 1097 // place. framer-motion measures the element to animate, then restores 1098 // `auto`. 1099 open: { width: "auto" }, 1100 // Resolved with the `custom` value passed to `AnimatePresence`, which is 1101 // the only way an already removed element can be given a fresh transition. 1102 closed: (transition) => ({ 1103 width: 0, 1104 transition 1105 }) 1106 }; 1107 function renderContainer(render, props) { 1108 if ((0, import_element3.isValidElement)(render)) { 1109 return (0, import_element3.cloneElement)(render, { 1110 ...props, 1111 className: clsx_default(render.props.className, props.className), 1112 style: { ...render.props.style, ...props.style } 1113 }); 1114 } 1115 return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { ...props }); 1116 } 1117 function ComplementaryAreaFill({ 1118 activeArea, 1119 isActive, 1120 scope, 1121 children, 1122 className, 1123 id, 1124 render 1125 }) { 1126 const disableMotion = (0, import_compose2.useReducedMotion)(); 1127 const isMobileViewport = (0, import_compose2.useViewportMatch)("medium", "<"); 1128 const previousActiveArea = (0, import_compose2.usePrevious)(activeArea); 1129 const isSwitchingAreas = !!previousActiveArea && !!activeArea && activeArea !== previousActiveArea; 1130 const transition = { 1131 type: "tween", 1132 duration: disableMotion || isMobileViewport || isSwitchingAreas ? 0 : ANIMATION_DURATION, 1133 ease: [0.6, 0, 0.4, 1] 1134 }; 1135 return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_components4.Fill, { name: `ComplementaryArea/$scope}`, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_components4.__unstableAnimatePresence, { initial: false, custom: transition, children: isActive && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)( 1136 import_components4.__unstableMotion.div, 1137 { 1138 variants, 1139 initial: "closed", 1140 animate: "open", 1141 exit: "closed", 1142 transition, 1143 className: "interface-complementary-area__fill", 1144 children: renderContainer(render, { 1145 id, 1146 className, 1147 children 1148 }) 1149 } 1150 ) }) }); 1151 } 1152 function useAdjustComplementaryListener(scope, identifier, activeArea, isActive, isSmall) { 1153 const previousIsSmallRef = (0, import_element3.useRef)(false); 1154 const shouldOpenWhenNotSmallRef = (0, import_element3.useRef)(false); 1155 const { enableComplementaryArea: enableComplementaryArea2, disableComplementaryArea: disableComplementaryArea2 } = (0, import_data6.useDispatch)(store); 1156 (0, import_element3.useEffect)(() => { 1157 if (isActive && isSmall && !previousIsSmallRef.current) { 1158 disableComplementaryArea2(scope); 1159 shouldOpenWhenNotSmallRef.current = true; 1160 } else if ( 1161 // If there is a flag indicating the complementary area should be 1162 // enabled when we go from small to big window size and we are going 1163 // from a small to big window size. 1164 shouldOpenWhenNotSmallRef.current && !isSmall && previousIsSmallRef.current 1165 ) { 1166 shouldOpenWhenNotSmallRef.current = false; 1167 enableComplementaryArea2(scope, identifier); 1168 } else if ( 1169 // If the flag is indicating the current complementary should be 1170 // reopened but another complementary area becomes active, remove 1171 // the flag. 1172 shouldOpenWhenNotSmallRef.current && activeArea && activeArea !== identifier 1173 ) { 1174 shouldOpenWhenNotSmallRef.current = false; 1175 } 1176 if (isSmall !== previousIsSmallRef.current) { 1177 previousIsSmallRef.current = isSmall; 1178 } 1179 }, [ 1180 isActive, 1181 isSmall, 1182 scope, 1183 identifier, 1184 activeArea, 1185 disableComplementaryArea2, 1186 enableComplementaryArea2 1187 ]); 1188 } 1189 function ComplementaryArea({ 1190 children, 1191 className, 1192 closeLabel = (0, import_i18n.__)("Close plugin"), 1193 identifier: identifierProp, 1194 header, 1195 headerClassName, 1196 icon: iconProp, 1197 isPinnable = true, 1198 panelClassName, 1199 render, 1200 scope, 1201 name: name2, 1202 title, 1203 toggleShortcut, 1204 isActiveByDefault 1205 }) { 1206 const context = (0, import_plugins2.usePluginContext)(); 1207 const icon = iconProp || context.icon; 1208 const identifier = identifierProp || `$context.name}/$name2}`; 1209 const [isReady, setIsReady] = (0, import_element3.useState)(false); 1210 const { 1211 isLoading, 1212 isActive, 1213 isPinned, 1214 activeArea, 1215 isSmall, 1216 isLarge, 1217 showIconLabels 1218 } = (0, import_data6.useSelect)( 1219 (select) => { 1220 const { 1221 getActiveComplementaryArea: getActiveComplementaryArea2, 1222 isComplementaryAreaLoading: isComplementaryAreaLoading2, 1223 isItemPinned: isItemPinned2 1224 } = select(store); 1225 const { get } = select(import_preferences3.store); 1226 const _activeArea = getActiveComplementaryArea2(scope); 1227 return { 1228 isLoading: isComplementaryAreaLoading2(scope), 1229 isActive: _activeArea === identifier, 1230 isPinned: isItemPinned2(scope, identifier), 1231 activeArea: _activeArea, 1232 isSmall: select(import_viewport.store).isViewportMatch("< medium"), 1233 isLarge: select(import_viewport.store).isViewportMatch("large"), 1234 showIconLabels: get("core", "showIconLabels") 1235 }; 1236 }, 1237 [identifier, scope] 1238 ); 1239 const hasMenuItem = useHasComplementaryAreaMenuItem(scope, name2); 1240 const isMobileViewport = (0, import_compose2.useViewportMatch)("medium", "<"); 1241 useAdjustComplementaryListener( 1242 scope, 1243 identifier, 1244 activeArea, 1245 isActive, 1246 isSmall 1247 ); 1248 const { 1249 enableComplementaryArea: enableComplementaryArea2, 1250 disableComplementaryArea: disableComplementaryArea2, 1251 pinItem: pinItem2, 1252 unpinItem: unpinItem2 1253 } = (0, import_data6.useDispatch)(store); 1254 (0, import_element3.useEffect)(() => { 1255 if (isActiveByDefault && activeArea === void 0 && !isSmall) { 1256 enableComplementaryArea2(scope, identifier); 1257 } else if (activeArea === void 0 && isSmall) { 1258 disableComplementaryArea2(scope); 1259 } 1260 setIsReady(true); 1261 }, [ 1262 activeArea, 1263 isActiveByDefault, 1264 scope, 1265 identifier, 1266 isSmall, 1267 enableComplementaryArea2, 1268 disableComplementaryArea2 1269 ]); 1270 if (!isReady) { 1271 return; 1272 } 1273 return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_jsx_runtime24.Fragment, { children: [ 1274 isPinnable && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(pinned_items_default, { scope, children: isPinned && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)( 1275 ComplementaryAreaToggle, 1276 { 1277 scope, 1278 identifier, 1279 isPressed: isActive && (!showIconLabels || isLarge), 1280 "aria-expanded": isActive, 1281 "aria-disabled": isLoading, 1282 label: title, 1283 icon: showIconLabels ? check_default : icon, 1284 showTooltip: !showIconLabels, 1285 variant: showIconLabels ? "tertiary" : void 0, 1286 size: "compact", 1287 shortcut: toggleShortcut 1288 } 1289 ) }), 1290 name2 && isPinnable && !hasMenuItem && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)( 1291 DefaultComplementaryAreaMoreMenuItem, 1292 { 1293 target: name2, 1294 scope, 1295 icon, 1296 identifier, 1297 children: title 1298 } 1299 ), 1300 /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)( 1301 ComplementaryAreaFill, 1302 { 1303 activeArea, 1304 isActive, 1305 className: clsx_default("interface-complementary-area", className), 1306 scope, 1307 id: identifier.replace("/", ":"), 1308 render, 1309 children: [ 1310 /* @__PURE__ */ (0, import_jsx_runtime24.jsx)( 1311 complementary_area_header_default, 1312 { 1313 className: headerClassName, 1314 toggleButtonProps: { 1315 label: closeLabel, 1316 size: "compact", 1317 shortcut: toggleShortcut, 1318 scope, 1319 identifier 1320 }, 1321 children: header || /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_jsx_runtime24.Fragment, { children: [ 1322 /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("h2", { className: "interface-complementary-area-header__title", children: title }), 1323 isPinnable && !isMobileViewport && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)( 1324 import_components4.Button, 1325 { 1326 className: "interface-complementary-area__pin-unpin-item", 1327 icon: isPinned ? star_filled_default : star_empty_default, 1328 label: isPinned ? (0, import_i18n.__)("Unpin from toolbar") : (0, import_i18n.__)("Pin to toolbar"), 1329 onClick: () => (isPinned ? unpinItem2 : pinItem2)( 1330 scope, 1331 identifier 1332 ), 1333 isPressed: isPinned, 1334 size: "compact" 1335 } 1336 ) 1337 ] }) 1338 } 1339 ), 1340 /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_components4.Panel, { className: panelClassName, children }) 1341 ] 1342 } 1343 ) 1344 ] }); 1345 } 1346 ComplementaryArea.Slot = ComplementaryAreaSlot; 1347 var complementary_area_default = ComplementaryArea; 1348 1349 // node_modules/@base-ui/utils/useControlled.mjs 1350 var React = __toESM(require_react(), 1); 1351 1352 // node_modules/@base-ui/utils/createLogOnce.mjs 1353 var loggedMessages; 1354 if (true) { 1355 loggedMessages = /* @__PURE__ */ new Set(); 1356 } 1357 function createLogOnce(severity, prefix) { 1358 return function logOnce(...messages) { 1359 if (true) { 1360 const message = messages.join(" "); 1361 const output = prefix ? `$prefix}: $message}` : message; 1362 const key = `$severity}:$output}`; 1363 if (!loggedMessages.has(key)) { 1364 loggedMessages.add(key); 1365 if (severity === "warn") { 1366 console.warn(output); 1367 } else { 1368 console.error(output); 1369 } 1370 } 1371 } 1372 }; 1373 } 1374 1375 // node_modules/@base-ui/utils/error.mjs 1376 var error = createLogOnce("error", "Base UI"); 1377 1378 // node_modules/@base-ui/utils/useControlled.mjs 1379 function useControlled({ 1380 controlled, 1381 default: defaultProp, 1382 name: name2, 1383 state = "value" 1384 }) { 1385 const { 1386 current: isControlled 1387 } = React.useRef(controlled !== void 0); 1388 const [valueState, setValue] = React.useState(defaultProp); 1389 const value = isControlled && controlled !== void 0 ? controlled : valueState; 1390 if (true) { 1391 React.useEffect(() => { 1392 if (isControlled !== (controlled !== void 0)) { 1393 error([`A component is changing the $isControlled ? "" : "un"}controlled $state} state of $name2} to be $isControlled ? "un" : ""}controlled.`, "Elements should not switch from uncontrolled to controlled (or vice versa).", `Decide between using a controlled or uncontrolled $name2} 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")); 1394 } 1395 }, [state, name2, controlled]); 1396 const { 1397 current: defaultValue 1398 } = React.useRef(defaultProp); 1399 React.useEffect(() => { 1400 if (!isControlled && serializeToDevModeString(defaultValue) !== serializeToDevModeString(defaultProp)) { 1401 error([`A component is changing the default $state} state of an uncontrolled $name2} after being initialized. To suppress this warning opt to use a controlled $name2}.`].join("\n")); 1402 } 1403 }, [defaultProp]); 1404 } 1405 const setValueIfUncontrolled = React.useCallback((newValue) => { 1406 if (!isControlled) { 1407 setValue(newValue); 1408 } 1409 }, []); 1410 return [value, setValueIfUncontrolled]; 1411 } 1412 function serializeToDevModeString(input) { 1413 let nextId = 0; 1414 const seen = /* @__PURE__ */ new WeakMap(); 1415 try { 1416 const result = JSON.stringify(input, function replacer(key, value) { 1417 if (key === "_owner" && this != null && typeof this === "object" && "$$typeof" in this) { 1418 return void 0; 1419 } 1420 if (typeof value === "bigint") { 1421 return `__bigint__:$value}`; 1422 } 1423 if (value !== null && typeof value === "object") { 1424 const id = seen.get(value); 1425 if (id !== void 0) { 1426 return `__object__:$id}`; 1427 } 1428 seen.set(value, nextId); 1429 nextId += 1; 1430 } 1431 return value; 1432 }); 1433 return result ?? `__top__:$typeof input}`; 1434 } catch { 1435 return "__unserializable__"; 1436 } 1437 } 1438 1439 // node_modules/@base-ui/utils/safeReact.mjs 1440 var React2 = __toESM(require_react(), 1); 1441 var SafeReact = { 1442 ...React2 1443 }; 1444 1445 // node_modules/@base-ui/utils/useRefWithInit.mjs 1446 var React3 = __toESM(require_react(), 1); 1447 var UNINITIALIZED = {}; 1448 function useRefWithInit(init, initArg) { 1449 const ref = React3.useRef(UNINITIALIZED); 1450 if (ref.current === UNINITIALIZED) { 1451 ref.current = init(initArg); 1452 } 1453 return ref; 1454 } 1455 1456 // node_modules/@base-ui/utils/useStableCallback.mjs 1457 var useInsertionEffect = SafeReact.useInsertionEffect; 1458 var useSafeInsertionEffect = ( 1459 // React 17 doesn't have useInsertionEffect. 1460 useInsertionEffect && // Preact replaces useInsertionEffect with useLayoutEffect and fires too late. 1461 useInsertionEffect !== SafeReact.useLayoutEffect ? useInsertionEffect : (fn) => fn() 1462 ); 1463 function useStableCallback(callback) { 1464 const stable = useRefWithInit(createStableCallback).current; 1465 stable.next = callback; 1466 useSafeInsertionEffect(stable.effect); 1467 return stable.trampoline; 1468 } 1469 function createStableCallback() { 1470 const stable = { 1471 next: void 0, 1472 callback: assertNotCalled, 1473 trampoline: (...args) => stable.callback?.(...args), 1474 effect: () => { 1475 stable.callback = stable.next; 1476 } 1477 }; 1478 return stable; 1479 } 1480 function assertNotCalled() { 1481 if (true) { 1482 throw ( 1483 /* minify-error-disabled */ 1484 new Error("Base UI: Cannot call an event handler while rendering.") 1485 ); 1486 } 1487 } 1488 1489 // node_modules/@base-ui/utils/warn.mjs 1490 var warn = createLogOnce("warn", "Base UI"); 1491 1492 // node_modules/@base-ui/utils/empty.mjs 1493 function NOOP() { 1494 } 1495 var EMPTY_ARRAY = Object.freeze([]); 1496 var EMPTY_OBJECT = Object.freeze({}); 1497 1498 // node_modules/@base-ui/utils/useIsoLayoutEffect.mjs 1499 var React4 = __toESM(require_react(), 1); 1500 var noop = () => { 1501 }; 1502 var useIsoLayoutEffect = typeof document !== "undefined" ? React4.useLayoutEffect : noop; 1503 1504 // node_modules/@base-ui/react/internals/useRenderElement.mjs 1505 var React7 = __toESM(require_react(), 1); 1506 1507 // node_modules/@base-ui/utils/useMergedRefs.mjs 1508 function useMergedRefs(a, b, c, d) { 1509 const forkRef = useRefWithInit(createForkRef).current; 1510 if (didChange(forkRef, a, b, c, d)) { 1511 update(forkRef, [a, b, c, d]); 1512 } 1513 return forkRef.callback; 1514 } 1515 function useMergedRefsN(refs) { 1516 const forkRef = useRefWithInit(createForkRef).current; 1517 if (didChangeN(forkRef, refs)) { 1518 update(forkRef, refs); 1519 } 1520 return forkRef.callback; 1521 } 1522 function createForkRef() { 1523 return { 1524 callback: null, 1525 cleanup: null, 1526 refs: [] 1527 }; 1528 } 1529 function didChange(forkRef, a, b, c, d) { 1530 return forkRef.refs[0] !== a || forkRef.refs[1] !== b || forkRef.refs[2] !== c || forkRef.refs[3] !== d; 1531 } 1532 function didChangeN(forkRef, newRefs) { 1533 return forkRef.refs.length !== newRefs.length || forkRef.refs.some((ref, index2) => ref !== newRefs[index2]); 1534 } 1535 function update(forkRef, refs) { 1536 forkRef.refs = refs; 1537 if (refs.every((ref) => ref == null)) { 1538 forkRef.callback = null; 1539 return; 1540 } 1541 forkRef.callback = (instance) => { 1542 if (forkRef.cleanup) { 1543 forkRef.cleanup(); 1544 forkRef.cleanup = null; 1545 } 1546 if (instance != null) { 1547 const cleanupCallbacks = Array(refs.length).fill(null); 1548 for (let i = 0; i < refs.length; i += 1) { 1549 const ref = refs[i]; 1550 if (ref == null) { 1551 continue; 1552 } 1553 switch (typeof ref) { 1554 case "function": { 1555 const refCleanup = ref(instance); 1556 if (typeof refCleanup === "function") { 1557 cleanupCallbacks[i] = refCleanup; 1558 } 1559 break; 1560 } 1561 case "object": { 1562 ref.current = instance; 1563 break; 1564 } 1565 default: 1566 } 1567 } 1568 forkRef.cleanup = () => { 1569 for (let i = 0; i < refs.length; i += 1) { 1570 const ref = refs[i]; 1571 if (ref == null) { 1572 continue; 1573 } 1574 switch (typeof ref) { 1575 case "function": { 1576 const cleanupCallback = cleanupCallbacks[i]; 1577 if (typeof cleanupCallback === "function") { 1578 cleanupCallback(); 1579 } else { 1580 void ref(null); 1581 } 1582 break; 1583 } 1584 case "object": { 1585 ref.current = null; 1586 break; 1587 } 1588 default: 1589 } 1590 } 1591 }; 1592 } 1593 }; 1594 } 1595 1596 // node_modules/@base-ui/utils/getReactElementRef.mjs 1597 var React6 = __toESM(require_react(), 1); 1598 1599 // node_modules/@base-ui/utils/reactVersion.mjs 1600 var React5 = __toESM(require_react(), 1); 1601 var majorVersion = parseInt(React5.version, 10); 1602 function isReactVersionAtLeast(reactVersionToCheck) { 1603 return majorVersion >= reactVersionToCheck; 1604 } 1605 1606 // node_modules/@base-ui/utils/getReactElementRef.mjs 1607 function getReactElementRef(element) { 1608 if (!/* @__PURE__ */ React6.isValidElement(element)) { 1609 return null; 1610 } 1611 const reactElement = element; 1612 const propsWithRef = reactElement.props; 1613 return (isReactVersionAtLeast(19) ? propsWithRef?.ref : reactElement.ref) ?? null; 1614 } 1615 1616 // node_modules/@base-ui/utils/mergeObjects.mjs 1617 function mergeObjects(a, b) { 1618 if (a && !b) { 1619 return a; 1620 } 1621 if (!a && b) { 1622 return b; 1623 } 1624 if (a || b) { 1625 return { 1626 ...a, 1627 ...b 1628 }; 1629 } 1630 return void 0; 1631 } 1632 1633 // node_modules/@base-ui/react/internals/getStateAttributesProps.mjs 1634 function getStateAttributesProps(state, customMapping) { 1635 const props = {}; 1636 for (const key in state) { 1637 const value = state[key]; 1638 if (customMapping?.hasOwnProperty(key)) { 1639 const customProps = customMapping[key](value); 1640 if (customProps != null) { 1641 Object.assign(props, customProps); 1642 } 1643 continue; 1644 } 1645 if (value === true) { 1646 props[`data-$key.toLowerCase()}`] = ""; 1647 } else if (value) { 1648 props[`data-$key.toLowerCase()}`] = value.toString(); 1649 } 1650 } 1651 return props; 1652 } 1653 1654 // node_modules/@base-ui/react/utils/resolveClassName.mjs 1655 function resolveClassName(className, state) { 1656 return typeof className === "function" ? className(state) : className; 1657 } 1658 1659 // node_modules/@base-ui/react/utils/resolveStyle.mjs 1660 function resolveStyle(style, state) { 1661 return typeof style === "function" ? style(state) : style; 1662 } 1663 1664 // node_modules/@base-ui/react/merge-props/mergeProps.mjs 1665 var EMPTY_PROPS = {}; 1666 function mergeProps(a, b, c, d, e) { 1667 if (!c && !d && !e && !a) { 1668 return createInitialMergedProps(b); 1669 } 1670 let merged = createInitialMergedProps(a); 1671 if (b) { 1672 merged = mergeInto(merged, b); 1673 } 1674 if (c) { 1675 merged = mergeInto(merged, c); 1676 } 1677 if (d) { 1678 merged = mergeInto(merged, d); 1679 } 1680 if (e) { 1681 merged = mergeInto(merged, e); 1682 } 1683 return merged; 1684 } 1685 function mergePropsN(props) { 1686 if (props.length === 0) { 1687 return EMPTY_PROPS; 1688 } 1689 if (props.length === 1) { 1690 return createInitialMergedProps(props[0]); 1691 } 1692 let merged = createInitialMergedProps(props[0]); 1693 for (let i = 1; i < props.length; i += 1) { 1694 merged = mergeInto(merged, props[i]); 1695 } 1696 return merged; 1697 } 1698 function createInitialMergedProps(inputProps) { 1699 if (isPropsGetter(inputProps)) { 1700 return { 1701 ...resolvePropsGetter(inputProps, EMPTY_PROPS) 1702 }; 1703 } 1704 return copyInitialProps(inputProps); 1705 } 1706 function mergeInto(merged, inputProps) { 1707 if (isPropsGetter(inputProps)) { 1708 return resolvePropsGetter(inputProps, merged); 1709 } 1710 return mutablyMergeInto(merged, inputProps); 1711 } 1712 function copyInitialProps(inputProps) { 1713 const copiedProps = { 1714 ...inputProps 1715 }; 1716 for (const propName in copiedProps) { 1717 const propValue = copiedProps[propName]; 1718 if (isEventHandler(propName, propValue)) { 1719 copiedProps[propName] = wrapEventHandler(propValue); 1720 } 1721 } 1722 return copiedProps; 1723 } 1724 function mutablyMergeInto(mergedProps, externalProps) { 1725 if (!externalProps) { 1726 return mergedProps; 1727 } 1728 for (const propName in externalProps) { 1729 const externalPropValue = externalProps[propName]; 1730 switch (propName) { 1731 case "style": { 1732 mergedProps[propName] = mergeObjects(mergedProps.style, externalPropValue); 1733 break; 1734 } 1735 case "className": { 1736 mergedProps[propName] = mergeClassNames(mergedProps.className, externalPropValue); 1737 break; 1738 } 1739 default: { 1740 if (isEventHandler(propName, externalPropValue)) { 1741 mergedProps[propName] = mergeEventHandlers(mergedProps[propName], externalPropValue); 1742 } else { 1743 mergedProps[propName] = externalPropValue; 1744 } 1745 } 1746 } 1747 } 1748 return mergedProps; 1749 } 1750 function isEventHandler(key, value) { 1751 const code0 = key.charCodeAt(0); 1752 const code1 = key.charCodeAt(1); 1753 const code2 = key.charCodeAt(2); 1754 return code0 === 111 && code1 === 110 && code2 >= 65 && code2 <= 90 && (typeof value === "function" || typeof value === "undefined"); 1755 } 1756 function isPropsGetter(inputProps) { 1757 return typeof inputProps === "function"; 1758 } 1759 function resolvePropsGetter(inputProps, previousProps) { 1760 if (isPropsGetter(inputProps)) { 1761 return inputProps(previousProps); 1762 } 1763 return inputProps ?? EMPTY_PROPS; 1764 } 1765 function mergeEventHandlers(ourHandler, theirHandler) { 1766 if (!theirHandler) { 1767 return ourHandler; 1768 } 1769 if (!ourHandler) { 1770 return wrapEventHandler(theirHandler); 1771 } 1772 return (...args) => { 1773 const event = args[0]; 1774 if (isSyntheticEvent(event)) { 1775 const baseUIEvent = event; 1776 makeEventPreventable(baseUIEvent); 1777 const result2 = theirHandler(...args); 1778 if (!baseUIEvent.baseUIHandlerPrevented) { 1779 ourHandler?.(...args); 1780 } 1781 return result2; 1782 } 1783 const result = theirHandler(...args); 1784 ourHandler?.(...args); 1785 return result; 1786 }; 1787 } 1788 function wrapEventHandler(handler) { 1789 if (!handler) { 1790 return handler; 1791 } 1792 return (...args) => { 1793 const event = args[0]; 1794 if (isSyntheticEvent(event)) { 1795 makeEventPreventable(event); 1796 } 1797 return handler(...args); 1798 }; 1799 } 1800 function makeEventPreventable(event) { 1801 event.preventBaseUIHandler = () => { 1802 event.baseUIHandlerPrevented = true; 1803 }; 1804 return event; 1805 } 1806 function mergeClassNames(ourClassName, theirClassName) { 1807 if (theirClassName) { 1808 if (ourClassName) { 1809 return theirClassName + " " + ourClassName; 1810 } 1811 return theirClassName; 1812 } 1813 return ourClassName; 1814 } 1815 function isSyntheticEvent(event) { 1816 return event != null && typeof event === "object" && "nativeEvent" in event; 1817 } 1818 1819 // node_modules/@base-ui/react/internals/useRenderElement.mjs 1820 var import_react = __toESM(require_react(), 1); 1821 function useRenderElement(element, componentProps, params = {}) { 1822 let renderProp = componentProps.render; 1823 if (params.enabled !== false) { 1824 renderProp = unwrapLazyRenderProp(renderProp); 1825 } 1826 const outProps = useRenderElementProps(componentProps, params, renderProp); 1827 if (params.enabled === false) { 1828 return null; 1829 } 1830 const state = params.state ?? EMPTY_OBJECT; 1831 return evaluateRenderProp(element, renderProp, outProps, state); 1832 } 1833 function useRenderElementProps(componentProps, params, renderProp) { 1834 const { 1835 className: classNameProp, 1836 style: styleProp 1837 } = componentProps; 1838 const { 1839 state = EMPTY_OBJECT, 1840 ref, 1841 props, 1842 stateAttributesMapping: stateAttributesMapping2, 1843 enabled = true 1844 } = params; 1845 const className = enabled ? resolveClassName(classNameProp, state) : void 0; 1846 const style = enabled ? resolveStyle(styleProp, state) : void 0; 1847 const stateProps = enabled ? getStateAttributesProps(state, stateAttributesMapping2) : EMPTY_OBJECT; 1848 const resolvedProps = enabled && props ? resolveRenderFunctionProps(props) : void 0; 1849 const outProps = enabled ? mergeObjects(stateProps, resolvedProps) ?? {} : EMPTY_OBJECT; 1850 if (typeof document !== "undefined") { 1851 if (!enabled) { 1852 void useMergedRefs(null, null); 1853 } else if (Array.isArray(ref)) { 1854 outProps.ref = useMergedRefsN([outProps.ref, getReactElementRef(renderProp), ...ref]); 1855 } else { 1856 outProps.ref = useMergedRefs(outProps.ref, getReactElementRef(renderProp), ref); 1857 } 1858 } 1859 if (!enabled) { 1860 return EMPTY_OBJECT; 1861 } 1862 if (className !== void 0) { 1863 outProps.className = mergeClassNames(outProps.className, className); 1864 } 1865 if (style !== void 0) { 1866 outProps.style = mergeObjects(outProps.style, style); 1867 } 1868 return outProps; 1869 } 1870 function resolveRenderFunctionProps(props) { 1871 if (Array.isArray(props)) { 1872 return mergePropsN(props); 1873 } 1874 return mergeProps(void 0, props); 1875 } 1876 var REACT_LAZY_TYPE = /* @__PURE__ */ Symbol.for("react.lazy"); 1877 var COMPONENT_IDENTIFIER_PATTERN = /^[A-Z][A-Za-z0-9$]*$/; 1878 var LOWERCASE_CHARACTER_PATTERN = /[a-z]/; 1879 function unwrapLazyRenderProp(render) { 1880 if (render?.$$typeof !== REACT_LAZY_TYPE) { 1881 return render; 1882 } 1883 const unwrapped = React7.Children.toArray(render)[0]; 1884 return /* @__PURE__ */ React7.isValidElement(unwrapped) ? unwrapped : render; 1885 } 1886 function evaluateRenderProp(element, render, props, state) { 1887 if (render) { 1888 if (typeof render === "function") { 1889 if (true) { 1890 warnIfRenderPropLooksLikeComponent(render); 1891 } 1892 return render(props, state); 1893 } 1894 const mergedProps = mergeProps(props, render.props); 1895 mergedProps.ref = props.ref; 1896 if (true) { 1897 if (!/* @__PURE__ */ React7.isValidElement(render)) { 1898 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")); 1899 } 1900 } 1901 return /* @__PURE__ */ React7.cloneElement(render, mergedProps); 1902 } 1903 if (element) { 1904 if (typeof element === "string") { 1905 return renderTag(element, props); 1906 } 1907 } 1908 throw new Error(true ? "Base UI: Render element or function are not defined." : formatErrorMessage_default(8)); 1909 } 1910 function warnIfRenderPropLooksLikeComponent(renderFn) { 1911 const functionName = renderFn.name; 1912 if (functionName.length === 0) { 1913 return; 1914 } 1915 if (!COMPONENT_IDENTIFIER_PATTERN.test(functionName)) { 1916 return; 1917 } 1918 if (!LOWERCASE_CHARACTER_PATTERN.test(functionName)) { 1919 return; 1920 } 1921 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"); 1922 } 1923 function renderTag(Tag, props) { 1924 if (Tag === "button") { 1925 return /* @__PURE__ */ (0, import_react.createElement)("button", { 1926 type: "button", 1927 ...props, 1928 key: props.key 1929 }); 1930 } 1931 if (Tag === "img") { 1932 return /* @__PURE__ */ (0, import_react.createElement)("img", { 1933 alt: "", 1934 ...props, 1935 key: props.key 1936 }); 1937 } 1938 return /* @__PURE__ */ React7.createElement(Tag, props); 1939 } 1940 1941 // node_modules/@base-ui/utils/useId.mjs 1942 var React8 = __toESM(require_react(), 1); 1943 var globalId = 0; 1944 function useGlobalId(idOverride, prefix = "mui") { 1945 const [defaultId, setDefaultId] = React8.useState(idOverride); 1946 const id = idOverride || defaultId; 1947 React8.useEffect(() => { 1948 if (defaultId == null) { 1949 globalId += 1; 1950 setDefaultId(`$prefix}-$globalId}`); 1951 } 1952 }, [defaultId, prefix]); 1953 return id; 1954 } 1955 var maybeReactUseId = SafeReact.useId; 1956 function useId(idOverride, prefix) { 1957 if (maybeReactUseId !== void 0) { 1958 const reactId = maybeReactUseId(); 1959 return idOverride ?? (prefix ? `$prefix}-$reactId}` : reactId); 1960 } 1961 return useGlobalId(idOverride, prefix); 1962 } 1963 1964 // node_modules/@base-ui/react/internals/useBaseUiId.mjs 1965 function useBaseUiId(idOverride) { 1966 return useId(idOverride, "base-ui"); 1967 } 1968 1969 // node_modules/@base-ui/react/collapsible/root/useCollapsibleRoot.mjs 1970 var React11 = __toESM(require_react(), 1); 1971 1972 // node_modules/@base-ui/react/internals/reason-parts.mjs 1973 var reason_parts_exports = {}; 1974 __export(reason_parts_exports, { 1975 cancelOpen: () => cancelOpen, 1976 chipRemovePress: () => chipRemovePress, 1977 clearPress: () => clearPress, 1978 closePress: () => closePress, 1979 closeWatcher: () => closeWatcher, 1980 decrementPress: () => decrementPress, 1981 disabled: () => disabled, 1982 drag: () => drag, 1983 escapeKey: () => escapeKey, 1984 focusOut: () => focusOut, 1985 imperativeAction: () => imperativeAction, 1986 incrementPress: () => incrementPress, 1987 initial: () => initial, 1988 inputBlur: () => inputBlur, 1989 inputChange: () => inputChange, 1990 inputClear: () => inputClear, 1991 inputPaste: () => inputPaste, 1992 inputPress: () => inputPress, 1993 itemPress: () => itemPress, 1994 keyboard: () => keyboard, 1995 linkPress: () => linkPress, 1996 listNavigation: () => listNavigation, 1997 missing: () => missing, 1998 none: () => none, 1999 outsidePress: () => outsidePress, 2000 pointer: () => pointer, 2001 scrub: () => scrub, 2002 siblingOpen: () => siblingOpen, 2003 swipe: () => swipe, 2004 trackPress: () => trackPress, 2005 triggerFocus: () => triggerFocus, 2006 triggerHover: () => triggerHover, 2007 triggerPress: () => triggerPress, 2008 wheel: () => wheel, 2009 windowResize: () => windowResize 2010 }); 2011 var none = "none"; 2012 var triggerPress = "trigger-press"; 2013 var triggerHover = "trigger-hover"; 2014 var triggerFocus = "trigger-focus"; 2015 var outsidePress = "outside-press"; 2016 var itemPress = "item-press"; 2017 var closePress = "close-press"; 2018 var linkPress = "link-press"; 2019 var clearPress = "clear-press"; 2020 var chipRemovePress = "chip-remove-press"; 2021 var trackPress = "track-press"; 2022 var incrementPress = "increment-press"; 2023 var decrementPress = "decrement-press"; 2024 var inputChange = "input-change"; 2025 var inputClear = "input-clear"; 2026 var inputBlur = "input-blur"; 2027 var inputPaste = "input-paste"; 2028 var inputPress = "input-press"; 2029 var focusOut = "focus-out"; 2030 var escapeKey = "escape-key"; 2031 var closeWatcher = "close-watcher"; 2032 var listNavigation = "list-navigation"; 2033 var keyboard = "keyboard"; 2034 var pointer = "pointer"; 2035 var drag = "drag"; 2036 var wheel = "wheel"; 2037 var scrub = "scrub"; 2038 var cancelOpen = "cancel-open"; 2039 var siblingOpen = "sibling-open"; 2040 var disabled = "disabled"; 2041 var missing = "missing"; 2042 var initial = "initial"; 2043 var imperativeAction = "imperative-action"; 2044 var swipe = "swipe"; 2045 var windowResize = "window-resize"; 2046 2047 // node_modules/@base-ui/react/internals/createBaseUIEventDetails.mjs 2048 function createChangeEventDetails(reason, event, trigger, customProperties) { 2049 let canceled = false; 2050 let allowPropagation = false; 2051 const custom = customProperties ?? EMPTY_OBJECT; 2052 const details = { 2053 reason, 2054 event: event ?? new Event("base-ui"), 2055 cancel() { 2056 canceled = true; 2057 }, 2058 allowPropagation() { 2059 allowPropagation = true; 2060 }, 2061 get isCanceled() { 2062 return canceled; 2063 }, 2064 get isPropagationAllowed() { 2065 return allowPropagation; 2066 }, 2067 trigger, 2068 ...custom 2069 }; 2070 return details; 2071 } 2072 2073 // node_modules/@base-ui/react/internals/useTransitionStatus.mjs 2074 var React10 = __toESM(require_react(), 1); 2075 2076 // node_modules/@base-ui/utils/useOnMount.mjs 2077 var React9 = __toESM(require_react(), 1); 2078 function useOnMount(fn) { 2079 React9.useEffect(fn, EMPTY_ARRAY); 2080 } 2081 2082 // node_modules/@base-ui/utils/useAnimationFrame.mjs 2083 var EMPTY = null; 2084 var LAST_RAF = globalThis.requestAnimationFrame; 2085 var Scheduler = class { 2086 /* This implementation uses an array as a backing data-structure for frame callbacks. 2087 * It allows `O(1)` callback cancelling by inserting a `null` in the array, though it 2088 * never calls the native `cancelAnimationFrame` if there are no frames left. This can 2089 * be much more efficient if there is a call pattern that alterns as 2090 * "request-cancel-request-cancel-…". 2091 * But in the case of "request-request-…-cancel-cancel-…", it leaves the final animation 2092 * frame to run anyway. We turn that frame into a `O(1)` no-op via `callbacksCount`. */ 2093 callbacks = []; 2094 callbacksCount = 0; 2095 nextId = 1; 2096 startId = 1; 2097 isScheduled = false; 2098 tick = (timestamp) => { 2099 this.isScheduled = false; 2100 const currentCallbacks = this.callbacks; 2101 const currentCallbacksCount = this.callbacksCount; 2102 this.callbacks = []; 2103 this.callbacksCount = 0; 2104 this.startId = this.nextId; 2105 if (currentCallbacksCount > 0) { 2106 for (let i = 0; i < currentCallbacks.length; i += 1) { 2107 currentCallbacks[i]?.(timestamp); 2108 } 2109 } 2110 }; 2111 request(fn) { 2112 const id = this.nextId; 2113 this.nextId += 1; 2114 this.callbacks.push(fn); 2115 this.callbacksCount += 1; 2116 const didRAFChange = LAST_RAF !== requestAnimationFrame && (LAST_RAF = requestAnimationFrame, true); 2117 if (!this.isScheduled || didRAFChange) { 2118 requestAnimationFrame(this.tick); 2119 this.isScheduled = true; 2120 } 2121 return id; 2122 } 2123 cancel(id) { 2124 const index2 = id - this.startId; 2125 if (index2 < 0 || index2 >= this.callbacks.length) { 2126 return; 2127 } 2128 if (this.callbacks[index2] === null) { 2129 return; 2130 } 2131 this.callbacks[index2] = null; 2132 this.callbacksCount -= 1; 2133 } 2134 }; 2135 var scheduler = new Scheduler(); 2136 var AnimationFrame = class _AnimationFrame { 2137 static create() { 2138 return new _AnimationFrame(); 2139 } 2140 static request(fn) { 2141 return scheduler.request(fn); 2142 } 2143 static cancel(id) { 2144 return scheduler.cancel(id); 2145 } 2146 currentId = EMPTY; 2147 /** 2148 * Executes `fn` after `delay`, clearing any previously scheduled call. 2149 */ 2150 request(fn) { 2151 this.cancel(); 2152 this.currentId = scheduler.request(() => { 2153 this.currentId = EMPTY; 2154 fn(); 2155 }); 2156 } 2157 cancel = () => { 2158 if (this.currentId !== EMPTY) { 2159 scheduler.cancel(this.currentId); 2160 this.currentId = EMPTY; 2161 } 2162 }; 2163 disposeEffect = () => { 2164 return this.cancel; 2165 }; 2166 }; 2167 function useAnimationFrame() { 2168 const timeout = useRefWithInit(AnimationFrame.create).current; 2169 useOnMount(timeout.disposeEffect); 2170 return timeout; 2171 } 2172 2173 // node_modules/@base-ui/react/internals/useTransitionStatus.mjs 2174 function useTransitionStatus(open3, enableIdleState = false, deferEndingState = false, animateInitialOpen = false) { 2175 const [transitionStatus, setTransitionStatus] = React10.useState(open3 && enableIdleState ? "idle" : void 0); 2176 const [mounted, setMounted] = React10.useState(open3 && !animateInitialOpen); 2177 if (open3 && !mounted) { 2178 setMounted(true); 2179 setTransitionStatus("starting"); 2180 } 2181 if (!open3 && mounted && transitionStatus !== "ending" && !deferEndingState) { 2182 setTransitionStatus("ending"); 2183 } 2184 if (!open3 && !mounted && transitionStatus === "ending") { 2185 setTransitionStatus(void 0); 2186 } 2187 useIsoLayoutEffect(() => { 2188 if (!open3 && mounted && transitionStatus !== "ending" && deferEndingState) { 2189 const frame = AnimationFrame.request(() => { 2190 setTransitionStatus("ending"); 2191 }); 2192 return () => { 2193 AnimationFrame.cancel(frame); 2194 }; 2195 } 2196 return void 0; 2197 }, [open3, mounted, transitionStatus, deferEndingState]); 2198 useIsoLayoutEffect(() => { 2199 if (!open3 || enableIdleState) { 2200 return void 0; 2201 } 2202 const frame = AnimationFrame.request(() => { 2203 setTransitionStatus(void 0); 2204 }); 2205 return () => { 2206 AnimationFrame.cancel(frame); 2207 }; 2208 }, [enableIdleState, open3]); 2209 useIsoLayoutEffect(() => { 2210 if (!open3 || !enableIdleState) { 2211 return void 0; 2212 } 2213 if (open3 && mounted && transitionStatus !== "idle") { 2214 setTransitionStatus("starting"); 2215 } 2216 const frame = AnimationFrame.request(() => { 2217 setTransitionStatus("idle"); 2218 }); 2219 return () => { 2220 AnimationFrame.cancel(frame); 2221 }; 2222 }, [enableIdleState, open3, mounted, transitionStatus]); 2223 return { 2224 mounted, 2225 setMounted, 2226 transitionStatus 2227 }; 2228 } 2229 2230 // node_modules/@base-ui/react/collapsible/root/useCollapsibleRoot.mjs 2231 function useCollapsibleRoot(parameters) { 2232 const { 2233 open: openParam, 2234 defaultOpen = false, 2235 onOpenChange, 2236 disabled: disabled2 2237 } = parameters; 2238 const [open3, setOpen] = useControlled({ 2239 controlled: openParam, 2240 default: defaultOpen, 2241 name: "Collapsible", 2242 state: "open" 2243 }); 2244 const { 2245 mounted, 2246 setMounted, 2247 transitionStatus 2248 } = useTransitionStatus(open3, true, true); 2249 const defaultPanelId = useBaseUiId(); 2250 const [registeredPanelId, setPanelIdState] = React11.useState(); 2251 const panelId = registeredPanelId === null ? void 0 : registeredPanelId ?? defaultPanelId; 2252 const handleTrigger = useStableCallback((event) => { 2253 const nextOpen = !open3; 2254 const eventDetails = createChangeEventDetails(reason_parts_exports.triggerPress, event.nativeEvent); 2255 onOpenChange(nextOpen, eventDetails); 2256 if (eventDetails.isCanceled) { 2257 return; 2258 } 2259 setOpen(nextOpen); 2260 }); 2261 return React11.useMemo(() => ({ 2262 defaultPanelId, 2263 disabled: disabled2, 2264 handleTrigger, 2265 mounted, 2266 open: open3, 2267 panelId, 2268 setMounted, 2269 setOpen, 2270 setPanelIdState, 2271 transitionStatus 2272 }), [defaultPanelId, disabled2, handleTrigger, mounted, open3, panelId, setMounted, setOpen, setPanelIdState, transitionStatus]); 2273 } 2274 2275 // node_modules/@base-ui/react/collapsible/root/CollapsibleRootContext.mjs 2276 var React12 = __toESM(require_react(), 1); 2277 var CollapsibleRootContext = /* @__PURE__ */ React12.createContext(void 0); 2278 if (true) CollapsibleRootContext.displayName = "CollapsibleRootContext"; 2279 function useCollapsibleRootContext() { 2280 const context = React12.useContext(CollapsibleRootContext); 2281 if (context === void 0) { 2282 throw new Error(true ? "Base UI: CollapsibleRootContext is missing. Collapsible parts must be placed within <Collapsible.Root>." : formatErrorMessage_default(15)); 2283 } 2284 return context; 2285 } 2286 2287 // node_modules/@base-ui/react/internals/TransitionStatusDataAttributes.mjs 2288 var TransitionStatusDataAttributes_exports = {}; 2289 __export(TransitionStatusDataAttributes_exports, { 2290 endingStyle: () => endingStyle, 2291 startingStyle: () => startingStyle 2292 }); 2293 var startingStyle = "data-starting-style"; 2294 var endingStyle = "data-ending-style"; 2295 2296 // node_modules/@base-ui/react/internals/stateAttributesMapping.mjs 2297 var STARTING_HOOK = { 2298 [startingStyle]: "" 2299 }; 2300 var ENDING_HOOK = { 2301 [endingStyle]: "" 2302 }; 2303 var transitionStatusMapping = { 2304 transitionStatus(value) { 2305 if (value === "starting") { 2306 return STARTING_HOOK; 2307 } 2308 if (value === "ending") { 2309 return ENDING_HOOK; 2310 } 2311 return null; 2312 } 2313 }; 2314 2315 // node_modules/@base-ui/react/collapsible/panel/CollapsiblePanelDataAttributes.mjs 2316 var open = "data-open"; 2317 var closed = "data-closed"; 2318 var startingStyle2 = TransitionStatusDataAttributes_exports.startingStyle; 2319 var endingStyle2 = TransitionStatusDataAttributes_exports.endingStyle; 2320 2321 // node_modules/@base-ui/react/collapsible/trigger/CollapsibleTriggerDataAttributes.mjs 2322 var panelOpen = "data-panel-open"; 2323 2324 // node_modules/@base-ui/react/utils/collapsibleOpenStateMapping.mjs 2325 var PANEL_OPEN_HOOK = { 2326 [open]: "" 2327 }; 2328 var PANEL_CLOSED_HOOK = { 2329 [closed]: "" 2330 }; 2331 var triggerOpenStateMapping = { 2332 open(value) { 2333 if (value) { 2334 return { 2335 [panelOpen]: "" 2336 }; 2337 } 2338 return null; 2339 } 2340 }; 2341 var collapsibleOpenStateMapping = { 2342 open(value) { 2343 if (value) { 2344 return PANEL_OPEN_HOOK; 2345 } 2346 return PANEL_CLOSED_HOOK; 2347 } 2348 }; 2349 2350 // node_modules/@base-ui/react/internals/use-button/useButton.mjs 2351 var React15 = __toESM(require_react(), 1); 2352 2353 // node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.mjs 2354 function hasWindow() { 2355 return typeof window !== "undefined"; 2356 } 2357 function getNodeName(node) { 2358 if (isNode(node)) { 2359 return (node.nodeName || "").toLowerCase(); 2360 } 2361 return "#document"; 2362 } 2363 function getWindow(node) { 2364 var _node$ownerDocument; 2365 return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window; 2366 } 2367 function getDocumentElement(node) { 2368 var _ref; 2369 return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement; 2370 } 2371 function isNode(value) { 2372 if (!hasWindow()) { 2373 return false; 2374 } 2375 return value instanceof Node || value instanceof getWindow(value).Node; 2376 } 2377 function isElement(value) { 2378 if (!hasWindow()) { 2379 return false; 2380 } 2381 return value instanceof Element || value instanceof getWindow(value).Element; 2382 } 2383 function isHTMLElement(value) { 2384 if (!hasWindow()) { 2385 return false; 2386 } 2387 return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement; 2388 } 2389 function isShadowRoot(value) { 2390 if (!hasWindow() || typeof ShadowRoot === "undefined") { 2391 return false; 2392 } 2393 return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot; 2394 } 2395 function isOverflowElement(element) { 2396 const { 2397 overflow, 2398 overflowX, 2399 overflowY, 2400 display 2401 } = getComputedStyle2(element); 2402 return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && display !== "inline" && display !== "contents"; 2403 } 2404 function isTableElement(element) { 2405 return /^(table|td|th)$/.test(getNodeName(element)); 2406 } 2407 function isTopLayer(element) { 2408 try { 2409 if (element.matches(":popover-open")) { 2410 return true; 2411 } 2412 } catch (_e) { 2413 } 2414 try { 2415 return element.matches(":modal"); 2416 } catch (_e) { 2417 return false; 2418 } 2419 } 2420 var willChangeRe = /transform|translate|scale|rotate|perspective|filter/; 2421 var containRe = /paint|layout|strict|content/; 2422 var isNotNone = (value) => !!value && value !== "none"; 2423 var isWebKitValue; 2424 function isContainingBlock(elementOrCss) { 2425 const css = isElement(elementOrCss) ? getComputedStyle2(elementOrCss) : elementOrCss; 2426 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 || ""); 2427 } 2428 function getContainingBlock(element) { 2429 let currentNode = getParentNode(element); 2430 while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) { 2431 if (isContainingBlock(currentNode)) { 2432 return currentNode; 2433 } else if (isTopLayer(currentNode)) { 2434 return null; 2435 } 2436 currentNode = getParentNode(currentNode); 2437 } 2438 return null; 2439 } 2440 function isWebKit() { 2441 if (isWebKitValue == null) { 2442 isWebKitValue = typeof CSS !== "undefined" && CSS.supports && CSS.supports("-webkit-backdrop-filter", "none"); 2443 } 2444 return isWebKitValue; 2445 } 2446 function isLastTraversableNode(node) { 2447 return /^(html|body|#document)$/.test(getNodeName(node)); 2448 } 2449 function getComputedStyle2(element) { 2450 return getWindow(element).getComputedStyle(element); 2451 } 2452 function getNodeScroll(element) { 2453 if (isElement(element)) { 2454 return { 2455 scrollLeft: element.scrollLeft, 2456 scrollTop: element.scrollTop 2457 }; 2458 } 2459 return { 2460 scrollLeft: element.scrollX, 2461 scrollTop: element.scrollY 2462 }; 2463 } 2464 function getParentNode(node) { 2465 if (getNodeName(node) === "html") { 2466 return node; 2467 } 2468 const result = ( 2469 // Step into the shadow DOM of the parent of a slotted node. 2470 node.assignedSlot || // DOM Element detected. 2471 node.parentNode || // ShadowRoot detected. 2472 isShadowRoot(node) && node.host || // Fallback. 2473 getDocumentElement(node) 2474 ); 2475 return isShadowRoot(result) ? result.host : result; 2476 } 2477 function getNearestOverflowAncestor(node) { 2478 const parentNode = getParentNode(node); 2479 if (isLastTraversableNode(parentNode)) { 2480 return (node.ownerDocument || node).body; 2481 } 2482 if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) { 2483 return parentNode; 2484 } 2485 return getNearestOverflowAncestor(parentNode); 2486 } 2487 function getOverflowAncestors(node, list, traverseIframes) { 2488 var _node$ownerDocument2; 2489 if (list === void 0) { 2490 list = []; 2491 } 2492 if (traverseIframes === void 0) { 2493 traverseIframes = true; 2494 } 2495 const scrollableAncestor = getNearestOverflowAncestor(node); 2496 const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body); 2497 const win = getWindow(scrollableAncestor); 2498 if (isBody) { 2499 const frameElement = getFrameElement(win); 2500 return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], frameElement && traverseIframes ? getOverflowAncestors(frameElement) : []); 2501 } else { 2502 return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes)); 2503 } 2504 } 2505 function getFrameElement(win) { 2506 return win.parent && Object.getPrototypeOf(win.parent) ? win.frameElement : null; 2507 } 2508 2509 // node_modules/@base-ui/react/internals/composite/root/CompositeRootContext.mjs 2510 var React13 = __toESM(require_react(), 1); 2511 var CompositeRootContext = /* @__PURE__ */ React13.createContext(void 0); 2512 if (true) CompositeRootContext.displayName = "CompositeRootContext"; 2513 function useCompositeRootContext(optional = false) { 2514 const context = React13.useContext(CompositeRootContext); 2515 if (context === void 0 && !optional) { 2516 throw new Error(true ? "Base UI: CompositeRootContext is missing. Composite parts must be placed within <Composite.Root>." : formatErrorMessage_default(16)); 2517 } 2518 return context; 2519 } 2520 2521 // node_modules/@base-ui/react/utils/useFocusableWhenDisabled.mjs 2522 var React14 = __toESM(require_react(), 1); 2523 function useFocusableWhenDisabled(parameters) { 2524 const { 2525 focusableWhenDisabled, 2526 disabled: disabled2, 2527 composite = false, 2528 tabIndex: tabIndexProp = 0, 2529 isNativeButton 2530 } = parameters; 2531 const isFocusableComposite = composite && focusableWhenDisabled !== false; 2532 const isNonFocusableComposite = composite && focusableWhenDisabled === false; 2533 const props = React14.useMemo(() => { 2534 const additionalProps = { 2535 // allow Tabbing away from focusableWhenDisabled elements 2536 onKeyDown(event) { 2537 if (disabled2 && focusableWhenDisabled && event.key !== "Tab") { 2538 event.preventDefault(); 2539 } 2540 } 2541 }; 2542 if (!composite) { 2543 additionalProps.tabIndex = tabIndexProp; 2544 if (!isNativeButton && disabled2) { 2545 additionalProps.tabIndex = focusableWhenDisabled ? tabIndexProp : -1; 2546 } 2547 } 2548 if (isNativeButton && (focusableWhenDisabled || isFocusableComposite) || !isNativeButton && disabled2) { 2549 additionalProps["aria-disabled"] = disabled2; 2550 } 2551 if (isNativeButton && (!focusableWhenDisabled || isNonFocusableComposite)) { 2552 additionalProps.disabled = disabled2; 2553 } 2554 return additionalProps; 2555 }, [composite, disabled2, focusableWhenDisabled, isFocusableComposite, isNonFocusableComposite, isNativeButton, tabIndexProp]); 2556 return { 2557 props 2558 }; 2559 } 2560 2561 // node_modules/@base-ui/utils/owner.mjs 2562 function ownerDocument(node) { 2563 return node?.ownerDocument || document; 2564 } 2565 2566 // node_modules/@base-ui/react/utils/dispatchClickWithModifiers.mjs 2567 function dispatchClickWithModifiers(target, sourceEvent, { 2568 detail = 0 2569 } = {}) { 2570 target.dispatchEvent(new (getWindow(target)).PointerEvent("click", { 2571 bubbles: true, 2572 cancelable: true, 2573 composed: true, 2574 detail, 2575 shiftKey: sourceEvent.shiftKey, 2576 ctrlKey: sourceEvent.ctrlKey, 2577 altKey: sourceEvent.altKey, 2578 metaKey: sourceEvent.metaKey 2579 })); 2580 } 2581 2582 // node_modules/@base-ui/react/internals/use-button/useButton.mjs 2583 function useButton(parameters = {}) { 2584 const { 2585 disabled: disabled2 = false, 2586 focusableWhenDisabled, 2587 tabIndex = 0, 2588 native: isNativeButton = true, 2589 composite: compositeProp 2590 } = parameters; 2591 const elementRef = React15.useRef(null); 2592 const compositeRootContext = useCompositeRootContext(true); 2593 const isCompositeItem = compositeProp ?? compositeRootContext !== void 0; 2594 const { 2595 props: focusableWhenDisabledProps 2596 } = useFocusableWhenDisabled({ 2597 focusableWhenDisabled, 2598 disabled: disabled2, 2599 composite: isCompositeItem, 2600 tabIndex, 2601 isNativeButton 2602 }); 2603 if (true) { 2604 React15.useEffect(() => { 2605 if (!elementRef.current) { 2606 return; 2607 } 2608 const isButtonTag = isButtonElement(elementRef.current); 2609 if (isNativeButton) { 2610 if (!isButtonTag) { 2611 const ownerStackMessage = SafeReact.captureOwnerStack?.() || ""; 2612 const message = "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`."; 2613 error(`$message}$ownerStackMessage}`); 2614 } 2615 } else if (isButtonTag) { 2616 const ownerStackMessage = SafeReact.captureOwnerStack?.() || ""; 2617 const message = "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`."; 2618 error(`$message}$ownerStackMessage}`); 2619 } 2620 }, [isNativeButton]); 2621 } 2622 const updateDisabled = React15.useCallback(() => { 2623 const element = elementRef.current; 2624 if (!isButtonElement(element)) { 2625 return; 2626 } 2627 if (isCompositeItem && disabled2 && focusableWhenDisabledProps.disabled === void 0 && element.disabled) { 2628 element.disabled = false; 2629 } 2630 }, [disabled2, focusableWhenDisabledProps.disabled, isCompositeItem]); 2631 useIsoLayoutEffect(updateDisabled, [updateDisabled]); 2632 const getButtonProps = React15.useCallback((externalProps = {}) => { 2633 const { 2634 onClick: externalOnClick, 2635 onMouseDown: externalOnMouseDown, 2636 onKeyUp: externalOnKeyUp, 2637 onKeyDown: externalOnKeyDown, 2638 onPointerDown: externalOnPointerDown, 2639 ...otherExternalProps 2640 } = externalProps; 2641 return mergeProps({ 2642 onClick(event) { 2643 if (disabled2) { 2644 event.preventDefault(); 2645 return; 2646 } 2647 externalOnClick?.(event); 2648 }, 2649 onMouseDown(event) { 2650 if (!disabled2) { 2651 externalOnMouseDown?.(event); 2652 } 2653 }, 2654 onKeyDown(event) { 2655 if (disabled2) { 2656 return; 2657 } 2658 makeEventPreventable(event); 2659 externalOnKeyDown?.(event); 2660 if (event.baseUIHandlerPrevented) { 2661 return; 2662 } 2663 const isCurrentTarget = event.target === event.currentTarget; 2664 const currentTarget = event.currentTarget; 2665 const isButton = isButtonElement(currentTarget); 2666 const isLink = !isNativeButton && isValidLinkElement(currentTarget); 2667 const shouldClick = isCurrentTarget && (isNativeButton ? isButton : !isLink); 2668 const isEnterKey = event.key === "Enter"; 2669 const isSpaceKey = event.key === " "; 2670 const role = currentTarget.getAttribute("role"); 2671 const isTextNavigationRole = role?.startsWith("menuitem") || role === "option" || role === "gridcell"; 2672 if (isCurrentTarget && isCompositeItem && isSpaceKey) { 2673 if (event.defaultPrevented && isTextNavigationRole) { 2674 return; 2675 } 2676 event.preventDefault(); 2677 if (!isNativeButton || isButton) { 2678 event.preventBaseUIHandler(); 2679 dispatchClickWithModifiers(currentTarget, event); 2680 } 2681 return; 2682 } 2683 if (!shouldClick || isNativeButton || !isSpaceKey && !isEnterKey) { 2684 if (isCurrentTarget && isLink && isSpaceKey) { 2685 event.preventDefault(); 2686 } 2687 return; 2688 } 2689 if (event.defaultPrevented) { 2690 return; 2691 } 2692 event.preventDefault(); 2693 if (isEnterKey) { 2694 event.preventBaseUIHandler(); 2695 dispatchClickWithModifiers(currentTarget, event); 2696 } 2697 }, 2698 onKeyUp(event) { 2699 if (disabled2) { 2700 return; 2701 } 2702 makeEventPreventable(event); 2703 externalOnKeyUp?.(event); 2704 if (event.target === event.currentTarget && isNativeButton && isCompositeItem && isButtonElement(event.currentTarget) && event.key === " ") { 2705 event.preventDefault(); 2706 return; 2707 } 2708 if (event.baseUIHandlerPrevented) { 2709 return; 2710 } 2711 if (event.target === event.currentTarget && !isNativeButton && !isCompositeItem && !event.defaultPrevented && event.key === " ") { 2712 event.preventBaseUIHandler(); 2713 dispatchClickWithModifiers(event.currentTarget, event); 2714 } 2715 }, 2716 onPointerDown(event) { 2717 if (disabled2) { 2718 event.preventDefault(); 2719 return; 2720 } 2721 externalOnPointerDown?.(event); 2722 } 2723 }, isNativeButton ? { 2724 type: "button" 2725 } : { 2726 role: "button" 2727 }, focusableWhenDisabledProps, otherExternalProps); 2728 }, [disabled2, focusableWhenDisabledProps, isCompositeItem, isNativeButton]); 2729 const buttonRef = useStableCallback((element) => { 2730 elementRef.current = element; 2731 updateDisabled(); 2732 }); 2733 return { 2734 getButtonProps, 2735 buttonRef 2736 }; 2737 } 2738 function isButtonElement(elem) { 2739 return isHTMLElement(elem) && elem.tagName === "BUTTON"; 2740 } 2741 function isValidLinkElement(elem) { 2742 return isHTMLElement(elem) && elem.tagName === "A" && Boolean(elem.href); 2743 } 2744 2745 // node_modules/@base-ui/react/collapsible/panel/useCollapsiblePanel.mjs 2746 var React17 = __toESM(require_react(), 1); 2747 2748 // node_modules/@base-ui/utils/addEventListener.mjs 2749 function addEventListener(target, type, listener, options) { 2750 target.addEventListener(type, listener, options); 2751 return () => { 2752 target.removeEventListener(type, listener, options); 2753 }; 2754 } 2755 2756 // node_modules/@base-ui/utils/useValueAsRef.mjs 2757 function useValueAsRef(value) { 2758 const latest = useRefWithInit(createLatestRef, value).current; 2759 latest.next = value; 2760 useIsoLayoutEffect(latest.effect); 2761 return latest; 2762 } 2763 function createLatestRef(value) { 2764 const latest = { 2765 current: value, 2766 next: value, 2767 effect: () => { 2768 latest.current = latest.next; 2769 } 2770 }; 2771 return latest; 2772 } 2773 2774 // node_modules/@base-ui/react/internals/useOpenChangeComplete.mjs 2775 var React16 = __toESM(require_react(), 1); 2776 2777 // node_modules/@base-ui/react/internals/useAnimationsFinished.mjs 2778 var ReactDOM = __toESM(require_react_dom(), 1); 2779 2780 // node_modules/@base-ui/react/utils/resolveRef.mjs 2781 function resolveRef(maybeRef) { 2782 if (maybeRef == null) { 2783 return maybeRef; 2784 } 2785 return "current" in maybeRef ? maybeRef.current : maybeRef; 2786 } 2787 2788 // node_modules/@base-ui/react/internals/useAnimationsFinished.mjs 2789 var pendingCallbacks = null; 2790 function flushBeforePaint(fn) { 2791 if (!pendingCallbacks) { 2792 const callbacks = []; 2793 pendingCallbacks = callbacks; 2794 queueMicrotask(() => { 2795 pendingCallbacks = null; 2796 ReactDOM.flushSync(() => { 2797 for (const callback of callbacks) { 2798 callback(); 2799 } 2800 }); 2801 }); 2802 } 2803 pendingCallbacks.push(fn); 2804 } 2805 function useAnimationsFinished(elementOrRef, waitForStartingStyleRemoved = false, batch = false) { 2806 const frame = useAnimationFrame(); 2807 return useStableCallback((fnToExecute, signal = null) => { 2808 frame.cancel(); 2809 const element = resolveRef(elementOrRef); 2810 if (element == null) { 2811 return; 2812 } 2813 const resolvedElement = element; 2814 const done = () => { 2815 if (!batch) { 2816 ReactDOM.flushSync(fnToExecute); 2817 return; 2818 } 2819 flushBeforePaint(() => { 2820 if (!signal?.aborted) { 2821 fnToExecute(); 2822 } 2823 }); 2824 }; 2825 if (typeof resolvedElement.getAnimations !== "function" || globalThis.BASE_UI_ANIMATIONS_DISABLED) { 2826 fnToExecute(); 2827 return; 2828 } 2829 function exec() { 2830 Promise.all(resolvedElement.getAnimations().map((animation) => animation.finished)).then(() => { 2831 if (!signal?.aborted) { 2832 done(); 2833 } 2834 }, () => { 2835 if (signal?.aborted) { 2836 return; 2837 } 2838 const currentAnimations = resolvedElement.getAnimations(); 2839 if (currentAnimations.some((animation) => animation.pending || animation.playState !== "finished")) { 2840 exec(); 2841 return; 2842 } 2843 done(); 2844 }); 2845 } 2846 if (waitForStartingStyleRemoved) { 2847 const startingStyleAttribute = startingStyle; 2848 if (!resolvedElement.hasAttribute(startingStyleAttribute)) { 2849 frame.request(exec); 2850 return; 2851 } 2852 const attributeObserver = new MutationObserver(() => { 2853 if (!resolvedElement.hasAttribute(startingStyleAttribute)) { 2854 attributeObserver.disconnect(); 2855 exec(); 2856 } 2857 }); 2858 attributeObserver.observe(resolvedElement, { 2859 attributes: true, 2860 attributeFilter: [startingStyleAttribute] 2861 }); 2862 signal?.addEventListener("abort", () => attributeObserver.disconnect(), { 2863 once: true 2864 }); 2865 return; 2866 } 2867 frame.request(exec); 2868 }); 2869 } 2870 2871 // node_modules/@base-ui/react/internals/useOpenChangeComplete.mjs 2872 function useOpenChangeComplete(parameters) { 2873 const { 2874 enabled = true, 2875 open: open3, 2876 ref, 2877 batch = false, 2878 onComplete: onCompleteParam 2879 } = parameters; 2880 const onComplete = useStableCallback(onCompleteParam); 2881 const runOnceAnimationsFinish = useAnimationsFinished(ref, open3, batch); 2882 React16.useEffect(() => { 2883 if (!enabled) { 2884 return void 0; 2885 } 2886 const abortController = new AbortController(); 2887 runOnceAnimationsFinish(onComplete, abortController.signal); 2888 return () => { 2889 abortController.abort(); 2890 }; 2891 }, [enabled, open3, onComplete, runOnceAnimationsFinish]); 2892 } 2893 2894 // node_modules/@base-ui/react/collapsible/panel/useCollapsiblePanel.mjs 2895 var EMPTY_DIMENSIONS = { 2896 height: void 0, 2897 width: void 0 2898 }; 2899 function useCollapsiblePanel(parameters) { 2900 const { 2901 externalRef, 2902 hiddenUntilFound, 2903 id: idParam, 2904 keepMounted, 2905 mounted, 2906 onOpenChange, 2907 open: open3, 2908 setMounted, 2909 setOpen, 2910 transitionStatus 2911 } = parameters; 2912 const panelRef = React17.useRef(null); 2913 const animationTypeRef = React17.useRef(null); 2914 const [dimensions, setDimensionsUnwrapped] = React17.useState(EMPTY_DIMENSIONS); 2915 const lastMeasuredDimensionsRef = React17.useRef(EMPTY_DIMENSIONS); 2916 const shouldSkipNextOpenRef = React17.useRef(false); 2917 const shouldPreventMountAnimationRef = React17.useRef(open3); 2918 const shouldPreventActivityResumeAnimationRef = React17.useRef(false); 2919 const [forcePanelIdle, setForcePanelIdle] = React17.useState(false); 2920 const pendingTemporaryStyleRestoreRef = React17.useRef(null); 2921 const mergedPanelRef = useMergedRefs(externalRef, panelRef); 2922 const latestOpenRef = useValueAsRef(open3); 2923 const runOnceCloseAnimationsFinish = useAnimationsFinished(panelRef); 2924 const hidden = !open3 && !mounted; 2925 const panelTransitionStatus = forcePanelIdle ? "idle" : transitionStatus; 2926 const shouldPreventOpenAnimation = open3 && // These 2 refs are safe to read in render, they are only written from committed 2927 // layout/effect paths and gate one-shot motion suppression for the next open 2928 // lifecycle. They intentionally expose the last committed motion snapshot. 2929 (shouldPreventMountAnimationRef.current || shouldPreventActivityResumeAnimationRef.current); 2930 const renderedDimensions = !open3 && mounted && // These 2 refs are also safe to read in render, both hold the last committed 2931 // animation mode and measurement. This fallback only restores a previously 2932 // measured pixel size after the live dimensions state has been reset back to `auto`. 2933 animationTypeRef.current === "css-animation" && dimensions.height === void 0 && dimensions.width === void 0 ? lastMeasuredDimensionsRef.current : dimensions; 2934 const shouldPersistHiddenTransitionStyles = hiddenUntilFound && hidden && animationTypeRef.current !== "css-animation"; 2935 const setDimensions = useStableCallback((nextDimensions, shouldCacheMeasurement = true) => { 2936 if (shouldCacheMeasurement) { 2937 lastMeasuredDimensionsRef.current = nextDimensions; 2938 } 2939 setDimensionsUnwrapped(nextDimensions); 2940 }); 2941 const restorePendingTemporaryStyle = useStableCallback(() => { 2942 pendingTemporaryStyleRestoreRef.current?.(); 2943 pendingTemporaryStyleRestoreRef.current = null; 2944 }); 2945 const setPendingTemporaryStyleRestore = useStableCallback((restore) => { 2946 restorePendingTemporaryStyle(); 2947 pendingTemporaryStyleRestoreRef.current = () => { 2948 pendingTemporaryStyleRestoreRef.current = null; 2949 restore(); 2950 }; 2951 }); 2952 const markActivityResumeAnimationSuppressed = useStableCallback(() => { 2953 if (open3 && mounted && animationTypeRef.current === "css-animation") { 2954 shouldPreventActivityResumeAnimationRef.current = true; 2955 } 2956 }); 2957 useIsoLayoutEffect(() => { 2958 if (!forcePanelIdle || transitionStatus === "starting") { 2959 return; 2960 } 2961 setForcePanelIdle(false); 2962 }, [forcePanelIdle, transitionStatus]); 2963 React17.useEffect(() => { 2964 return () => { 2965 markActivityResumeAnimationSuppressed(); 2966 restorePendingTemporaryStyle(); 2967 }; 2968 }, [markActivityResumeAnimationSuppressed, restorePendingTemporaryStyle]); 2969 useIsoLayoutEffect(() => { 2970 const panel = panelRef.current; 2971 if (!panel) { 2972 return void 0; 2973 } 2974 if (!open3 && pendingTemporaryStyleRestoreRef.current) { 2975 restorePendingTemporaryStyle(); 2976 } 2977 const animationType = getAnimationType(panel, shouldPreventOpenAnimation); 2978 animationTypeRef.current = animationType; 2979 if (open3 && transitionStatus === "idle" && shouldPreventMountAnimationRef.current && animationType === "css-animation") { 2980 lastMeasuredDimensionsRef.current = getDimensions(panel); 2981 return void 0; 2982 } 2983 if (open3 && transitionStatus === "starting") { 2984 const skipNextOpen = shouldSkipNextOpenRef.current; 2985 shouldSkipNextOpenRef.current = false; 2986 if (animationType === "none") { 2987 setDimensions(getDimensions(panel)); 2988 setForcePanelIdle(true); 2989 return void 0; 2990 } 2991 if (animationType === "css-transition") { 2992 const restoreLayoutStyles = resetLayoutStyles(panel); 2993 setDimensions(getDimensions(panel)); 2994 if (!skipNextOpen) { 2995 return restoreLayoutStyles; 2996 } 2997 const restoreTransitionDuration = setTemporaryStyle(panel, "transition-duration", "0s"); 2998 setPendingTemporaryStyleRestore(restoreTransitionDuration); 2999 setForcePanelIdle(true); 3000 return restoreLayoutStyles; 3001 } 3002 setDimensions(getDimensions(panel)); 3003 const restoreAnimationName = setTemporaryStyle(panel, "animation-name", "none"); 3004 if (!skipNextOpen) { 3005 restoreAnimationName(); 3006 return void 0; 3007 } 3008 const restoreAnimationDuration = setTemporaryStyle(panel, "animation-duration", "0s"); 3009 restoreAnimationName(); 3010 setPendingTemporaryStyleRestore(restoreAnimationDuration); 3011 setForcePanelIdle(true); 3012 return void 0; 3013 } 3014 if (!open3 && mounted && (transitionStatus === "idle" || transitionStatus === "starting")) { 3015 shouldPreventMountAnimationRef.current = false; 3016 shouldPreventActivityResumeAnimationRef.current = false; 3017 if (animationType === "none") { 3018 setDimensions(EMPTY_DIMENSIONS, false); 3019 setMounted(false); 3020 return void 0; 3021 } 3022 setDimensions(getDimensions(panel)); 3023 return void 0; 3024 } 3025 if (transitionStatus !== "ending") { 3026 return void 0; 3027 } 3028 if (animationType === "none") { 3029 setMounted(false); 3030 return void 0; 3031 } 3032 const nextDimensions = getDimensions(panel); 3033 const hasMeasuredSize = nextDimensions.height > 0 || nextDimensions.width > 0; 3034 if (!hasMeasuredSize) { 3035 setMounted(false); 3036 return void 0; 3037 } 3038 setDimensions(nextDimensions); 3039 if (animationType === "css-animation") { 3040 const restoreAnimationName = setTemporaryStyle(panel, "animation-name", "none"); 3041 restoreAnimationName(); 3042 } 3043 return void 0; 3044 }, [mounted, open3, restorePendingTemporaryStyle, setDimensions, setMounted, setPendingTemporaryStyleRestore, shouldPreventOpenAnimation, transitionStatus]); 3045 useOpenChangeComplete({ 3046 enabled: open3 && mounted && panelTransitionStatus === "idle", 3047 open: true, 3048 ref: panelRef, 3049 onComplete() { 3050 if (!open3) { 3051 return; 3052 } 3053 setDimensions(EMPTY_DIMENSIONS, false); 3054 } 3055 }); 3056 React17.useEffect(() => { 3057 if (open3 || !mounted || panelTransitionStatus !== "ending") { 3058 return void 0; 3059 } 3060 const panel = panelRef.current; 3061 if (!panel) { 3062 return void 0; 3063 } 3064 const abortController = new AbortController(); 3065 let endingStyleFrame = -1; 3066 function handleComplete() { 3067 if (latestOpenRef.current) { 3068 return; 3069 } 3070 setMounted(false); 3071 setDimensions(EMPTY_DIMENSIONS, false); 3072 } 3073 endingStyleFrame = AnimationFrame.request(() => { 3074 runOnceCloseAnimationsFinish(handleComplete, abortController.signal); 3075 }); 3076 return () => { 3077 AnimationFrame.cancel(endingStyleFrame); 3078 abortController.abort(); 3079 }; 3080 }, [latestOpenRef, mounted, open3, panelTransitionStatus, runOnceCloseAnimationsFinish, setDimensions, setMounted]); 3081 useIsoLayoutEffect(() => { 3082 const panel = panelRef.current; 3083 if (!panel || !hiddenUntilFound || !hidden) { 3084 return; 3085 } 3086 panel.setAttribute("hidden", "until-found"); 3087 }, [hidden, hiddenUntilFound]); 3088 React17.useEffect(function registerBeforeMatchListener() { 3089 const panel = panelRef.current; 3090 if (!panel) { 3091 return void 0; 3092 } 3093 function handleBeforeMatch(event) { 3094 const eventDetails = createChangeEventDetails(reason_parts_exports.none, event); 3095 onOpenChange(true, eventDetails); 3096 if (eventDetails.isCanceled) { 3097 return; 3098 } 3099 shouldSkipNextOpenRef.current = true; 3100 setOpen(true); 3101 } 3102 return addEventListener(panel, "beforematch", handleBeforeMatch); 3103 }, [onOpenChange, setOpen]); 3104 const shouldRender = keepMounted || hiddenUntilFound || mounted || open3; 3105 return { 3106 height: renderedDimensions.height, 3107 props: { 3108 ...shouldPersistHiddenTransitionStyles ? { 3109 [startingStyle2]: "" 3110 } : void 0, 3111 hidden, 3112 id: idParam 3113 }, 3114 ref: mergedPanelRef, 3115 shouldPreventOpenAnimation, 3116 shouldRender, 3117 transitionStatus: panelTransitionStatus, 3118 width: renderedDimensions.width 3119 }; 3120 } 3121 function getDimensions(element) { 3122 return { 3123 height: element.scrollHeight, 3124 width: element.scrollWidth 3125 }; 3126 } 3127 function getAnimationType(element, hasSuppressedMountAnimation) { 3128 const panelStyles = getWindow(element).getComputedStyle(element); 3129 const hasAnimation = (panelStyles.animationName.split(",").map((name2) => name2.trim()).some((name2) => name2 !== "" && name2 !== "none") || hasSuppressedMountAnimation) && hasNonZeroDuration(panelStyles.animationDuration); 3130 const hasTransition = hasNonZeroDuration(panelStyles.transitionDuration); 3131 if (hasAnimation && hasTransition) { 3132 if (true) { 3133 warn("CSS transitions and CSS animations both detected on Collapsible or Accordion panel.", "Only one of either animation type should be used."); 3134 } 3135 return "css-transition"; 3136 } 3137 if (hasTransition) { 3138 return "css-transition"; 3139 } 3140 if (hasAnimation) { 3141 return "css-animation"; 3142 } 3143 return "none"; 3144 } 3145 function hasNonZeroDuration(value) { 3146 return value.split(",").map((part) => part.trim()).some((part) => part !== "" && Number.parseFloat(part) > 0); 3147 } 3148 function setTemporaryStyle(element, property, value) { 3149 const previousValue = element.style.getPropertyValue(property); 3150 const previousPriority = element.style.getPropertyPriority(property); 3151 element.style.setProperty(property, value); 3152 return () => { 3153 if (previousValue === "") { 3154 element.style.removeProperty(property); 3155 return; 3156 } 3157 element.style.setProperty(property, previousValue, previousPriority); 3158 }; 3159 } 3160 function resetLayoutStyles(element) { 3161 const originalLayoutStyles = { 3162 "justify-content": element.style.justifyContent, 3163 "align-items": element.style.alignItems, 3164 "align-content": element.style.alignContent, 3165 "justify-items": element.style.justifyItems 3166 }; 3167 Object.keys(originalLayoutStyles).forEach((key) => { 3168 element.style.setProperty(key, "initial", "important"); 3169 }); 3170 function restoreLayoutStyles() { 3171 Object.entries(originalLayoutStyles).forEach(([key, value]) => { 3172 if (value === "") { 3173 element.style.removeProperty(key); 3174 return; 3175 } 3176 element.style.setProperty(key, value); 3177 }); 3178 } 3179 const frame = AnimationFrame.request(restoreLayoutStyles); 3180 return () => { 3181 AnimationFrame.cancel(frame); 3182 restoreLayoutStyles(); 3183 }; 3184 } 3185 3186 // node_modules/@base-ui/utils/platform/parts.mjs 3187 var parts_exports = {}; 3188 __export(parts_exports, { 3189 engine: () => engine_exports, 3190 env: () => env_exports, 3191 mediaQuery: () => media_query_exports, 3192 os: () => os_exports, 3193 screenReader: () => screen_reader_exports 3194 }); 3195 3196 // node_modules/@base-ui/utils/platform/os.mjs 3197 var os_exports = {}; 3198 __export(os_exports, { 3199 android: () => android, 3200 apple: () => apple, 3201 ios: () => ios, 3202 linux: () => linux, 3203 mac: () => mac, 3204 windows: () => windows 3205 }); 3206 3207 // node_modules/@base-ui/utils/platform/shared.mjs 3208 function readRawData() { 3209 if (typeof navigator === "undefined") { 3210 return { 3211 userAgent: "", 3212 platform: "", 3213 maxTouchPoints: 0 3214 }; 3215 } 3216 if (true) { 3217 const uaData = navigator.userAgentData; 3218 if (uaData && Array.isArray(uaData.brands)) { 3219 return { 3220 userAgent: uaData.brands.map(({ 3221 brand, 3222 version: version2 3223 }) => `$brand}/$version2}`).join(" "), 3224 platform: uaData.platform ?? navigator.platform ?? "", 3225 maxTouchPoints: navigator.maxTouchPoints ?? 0 3226 }; 3227 } 3228 } 3229 return { 3230 userAgent: navigator.userAgent, 3231 platform: navigator.platform ?? "", 3232 maxTouchPoints: navigator.maxTouchPoints ?? 0 3233 }; 3234 } 3235 var { 3236 userAgent, 3237 platform, 3238 maxTouchPoints 3239 } = readRawData(); 3240 var lowerUserAgent = userAgent.toLowerCase(); 3241 var lowerPlatform = platform.toLowerCase(); 3242 3243 // node_modules/@base-ui/utils/platform/os.mjs 3244 var ios = /^i(os$|p)/.test(lowerPlatform) || lowerPlatform === "macintel" && maxTouchPoints > 1; 3245 var ANDROID_STRING = "android"; 3246 var android = lowerPlatform === ANDROID_STRING || lowerUserAgent.includes(ANDROID_STRING); 3247 var mac = !ios && lowerPlatform.startsWith("mac"); 3248 var windows = lowerPlatform.startsWith("win"); 3249 var linux = !android && /^(linux|chrome os)/.test(lowerPlatform); 3250 var apple = mac || ios; 3251 3252 // node_modules/@base-ui/utils/platform/engine.mjs 3253 var engine_exports = {}; 3254 __export(engine_exports, { 3255 blink: () => blink, 3256 gecko: () => gecko, 3257 webkit: () => webkit 3258 }); 3259 var webkit = typeof CSS !== "undefined" && !!CSS.supports?.("-webkit-backdrop-filter:none"); 3260 var gecko = !webkit && lowerUserAgent.includes("firefox"); 3261 var blink = !webkit && lowerUserAgent.includes("chrom"); 3262 3263 // node_modules/@base-ui/utils/platform/screen-reader.mjs 3264 var screen_reader_exports = {}; 3265 __export(screen_reader_exports, { 3266 voiceOver: () => voiceOver 3267 }); 3268 var voiceOver = apple; 3269 3270 // node_modules/@base-ui/utils/platform/env.mjs 3271 var env_exports = {}; 3272 __export(env_exports, { 3273 jsdom: () => jsdom 3274 }); 3275 var jsdom = /jsdom|happydom/.test(lowerUserAgent); 3276 3277 // node_modules/@base-ui/utils/platform/media-query.mjs 3278 var media_query_exports = {}; 3279 __export(media_query_exports, { 3280 iOS: () => iOS 3281 }); 3282 var iOS = "@supports (-webkit-touch-callout: none)"; 3283 3284 // node_modules/@base-ui/utils/useTimeout.mjs 3285 var EMPTY2 = 0; 3286 var Timeout = class _Timeout { 3287 static create() { 3288 return new _Timeout(); 3289 } 3290 currentId = EMPTY2; 3291 /** 3292 * Executes `fn` after `delay`, clearing any previously scheduled call. 3293 */ 3294 start(delay, fn) { 3295 this.clear(); 3296 this.currentId = setTimeout(() => { 3297 this.currentId = EMPTY2; 3298 fn(); 3299 }, delay); 3300 } 3301 isStarted() { 3302 return this.currentId !== EMPTY2; 3303 } 3304 clear = () => { 3305 if (this.currentId !== EMPTY2) { 3306 clearTimeout(this.currentId); 3307 this.currentId = EMPTY2; 3308 } 3309 }; 3310 disposeEffect = () => { 3311 return this.clear; 3312 }; 3313 }; 3314 function useTimeout() { 3315 const timeout = useRefWithInit(Timeout.create).current; 3316 useOnMount(timeout.disposeEffect); 3317 return timeout; 3318 } 3319 3320 // node_modules/@base-ui/react/floating-ui-react/components/FloatingDelayGroup.mjs 3321 var React18 = __toESM(require_react(), 1); 3322 3323 // node_modules/@base-ui/react/floating-ui-react/utils/event.mjs 3324 function isReactEvent(event) { 3325 return "nativeEvent" in event; 3326 } 3327 function isVirtualClick(event) { 3328 if (event.pointerType === "" && event.isTrusted) { 3329 return true; 3330 } 3331 if (parts_exports.os.android && event.pointerType) { 3332 return event.type === "click" && event.buttons === 1; 3333 } 3334 return event.detail === 0 && !event.pointerType; 3335 } 3336 function isMouseLikePointerType(pointerType, strict) { 3337 const values = ["mouse", "pen"]; 3338 if (!strict) { 3339 values.push("", void 0); 3340 } 3341 return values.includes(pointerType); 3342 } 3343 function isClickLikeEvent(event) { 3344 const type = event.type; 3345 return type === "click" || type === "mousedown" || type === "keydown" || type === "keyup"; 3346 } 3347 3348 // node_modules/@base-ui/utils/shadowDom.mjs 3349 function activeElement(doc) { 3350 let element = doc.activeElement; 3351 while (element?.shadowRoot?.activeElement != null) { 3352 element = element.shadowRoot.activeElement; 3353 } 3354 return element; 3355 } 3356 function contains(parent, child) { 3357 if (!parent || !child) { 3358 return false; 3359 } 3360 const rootNode = child.getRootNode?.(); 3361 if (parent.contains(child)) { 3362 return true; 3363 } 3364 if (rootNode && isShadowRoot(rootNode)) { 3365 let next = child; 3366 while (next) { 3367 if (parent === next) { 3368 return true; 3369 } 3370 next = next.parentNode || next.host; 3371 } 3372 } 3373 return false; 3374 } 3375 function getTarget(event) { 3376 if ("composedPath" in event) { 3377 return event.composedPath()[0] ?? event.target; 3378 } 3379 return event.target; 3380 } 3381 3382 // node_modules/@base-ui/react/floating-ui-react/utils/constants.mjs 3383 var FOCUSABLE_ATTRIBUTE = "data-base-ui-focusable"; 3384 var TYPEABLE_SELECTOR = "input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])"; 3385 3386 // node_modules/@base-ui/react/utils/CommonPopupDataAttributes.mjs 3387 var open2 = "data-open"; 3388 var closed2 = "data-closed"; 3389 var anchorHidden = "data-anchor-hidden"; 3390 3391 // node_modules/@base-ui/react/utils/CommonTriggerDataAttributes.mjs 3392 var CommonTriggerDataAttributes_exports = {}; 3393 __export(CommonTriggerDataAttributes_exports, { 3394 popupOpen: () => popupOpen, 3395 pressed: () => pressed 3396 }); 3397 var popupOpen = "data-popup-open"; 3398 var pressed = "data-pressed"; 3399 3400 // node_modules/@base-ui/react/utils/popupStateMapping.mjs 3401 var TRIGGER_HOOK = { 3402 [popupOpen]: "" 3403 }; 3404 var PRESSABLE_TRIGGER_HOOK = { 3405 [popupOpen]: "", 3406 [pressed]: "" 3407 }; 3408 var POPUP_OPEN_HOOK = { 3409 [open2]: "" 3410 }; 3411 var POPUP_CLOSED_HOOK = { 3412 [closed2]: "" 3413 }; 3414 var ANCHOR_HIDDEN_HOOK = { 3415 [anchorHidden]: "" 3416 }; 3417 var triggerOpenStateMapping2 = { 3418 open(value) { 3419 if (value) { 3420 return TRIGGER_HOOK; 3421 } 3422 return null; 3423 } 3424 }; 3425 var popupStateMapping = { 3426 open(value) { 3427 if (value) { 3428 return POPUP_OPEN_HOOK; 3429 } 3430 return POPUP_CLOSED_HOOK; 3431 }, 3432 anchorHidden(value) { 3433 if (value) { 3434 return ANCHOR_HIDDEN_HOOK; 3435 } 3436 return null; 3437 } 3438 }; 3439 var popupTransitionStateMapping = { 3440 ...popupStateMapping, 3441 ...transitionStatusMapping 3442 }; 3443 3444 // node_modules/@base-ui/react/tooltip/trigger/TooltipTriggerDataAttributes.mjs 3445 var popupOpen2 = CommonTriggerDataAttributes_exports.popupOpen; 3446 var triggerDisabled = "data-trigger-disabled"; 3447 3448 // node_modules/@base-ui/react/floating-ui-react/utils/element.mjs 3449 function isTargetInsideEnabledTrigger(target, triggerElements) { 3450 if (!isElement(target)) { 3451 return false; 3452 } 3453 const targetElement = target; 3454 if (triggerElements.hasElement(targetElement)) { 3455 return !targetElement.hasAttribute(triggerDisabled); 3456 } 3457 for (const [, trigger] of triggerElements.entries()) { 3458 if (contains(trigger, targetElement)) { 3459 return !trigger.hasAttribute(triggerDisabled); 3460 } 3461 } 3462 return false; 3463 } 3464 function isEventTargetWithin(event, node) { 3465 if (node == null) { 3466 return false; 3467 } 3468 if ("composedPath" in event) { 3469 return event.composedPath().includes(node); 3470 } 3471 const eventAgain = event; 3472 return eventAgain.target != null && node.contains(eventAgain.target); 3473 } 3474 function isRootElement(element) { 3475 return element.matches("html,body"); 3476 } 3477 function isTypeableElement(element) { 3478 return isHTMLElement(element) && element.matches(TYPEABLE_SELECTOR); 3479 } 3480 function isInteractiveElement(element) { 3481 return element?.closest(`button,a[href],[role="button"],select,[tabindex]:not([tabindex="-1"]),$TYPEABLE_SELECTOR}`) != null; 3482 } 3483 function matchesFocusVisible(element) { 3484 if (!element || parts_exports.env.jsdom) { 3485 return true; 3486 } 3487 try { 3488 return element.matches(":focus-visible"); 3489 } catch (_e) { 3490 return true; 3491 } 3492 } 3493 3494 // node_modules/@base-ui/react/floating-ui-react/hooks/useHoverShared.mjs 3495 function resolveValue(value, pointerType) { 3496 if (pointerType != null && !isMouseLikePointerType(pointerType)) { 3497 return 0; 3498 } 3499 if (typeof value === "function") { 3500 return value(); 3501 } 3502 return value; 3503 } 3504 function getDelay(value, prop, pointerType) { 3505 const result = resolveValue(value, pointerType); 3506 if (typeof result === "number") { 3507 return result; 3508 } 3509 return result?.[prop]; 3510 } 3511 function getRestMs(value) { 3512 if (typeof value === "function") { 3513 return value(); 3514 } 3515 return value; 3516 } 3517 function isClickLikeOpenEvent(openEventType, interactedInside) { 3518 return interactedInside || openEventType === "click" || openEventType === "mousedown"; 3519 } 3520 function isHoverOpenEvent(openEventType) { 3521 return openEventType?.includes("mouse") && openEventType !== "mousedown"; 3522 } 3523 3524 // node_modules/@base-ui/react/floating-ui-react/components/FloatingDelayGroup.mjs 3525 var import_jsx_runtime25 = __toESM(require_jsx_runtime(), 1); 3526 var FloatingDelayGroupContext = /* @__PURE__ */ React18.createContext({ 3527 hasProvider: false, 3528 timeoutMs: 0, 3529 delayRef: { 3530 current: 0 3531 }, 3532 initialDelayRef: { 3533 current: 0 3534 }, 3535 timeout: new Timeout(), 3536 currentIdRef: { 3537 current: null 3538 }, 3539 currentContextRef: { 3540 current: null 3541 } 3542 }); 3543 if (true) FloatingDelayGroupContext.displayName = "FloatingDelayGroupContext"; 3544 function resetDelayRef(delayRef, initialDelayRef) { 3545 delayRef.current = initialDelayRef.current; 3546 } 3547 function FloatingDelayGroup(props) { 3548 const { 3549 children, 3550 delay, 3551 timeoutMs = 0 3552 } = props; 3553 const delayRef = React18.useRef(delay); 3554 const initialDelayRef = React18.useRef(delay); 3555 const currentIdRef = React18.useRef(null); 3556 const currentContextRef = React18.useRef(null); 3557 const timeout = useTimeout(); 3558 useIsoLayoutEffect(() => { 3559 initialDelayRef.current = delay; 3560 if (!currentIdRef.current) { 3561 delayRef.current = delay; 3562 return; 3563 } 3564 delayRef.current = { 3565 open: getDelay(delayRef.current, "open"), 3566 close: getDelay(delay, "close") 3567 }; 3568 }, [delay, currentIdRef, delayRef, initialDelayRef]); 3569 return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(FloatingDelayGroupContext.Provider, { 3570 value: React18.useMemo(() => ({ 3571 hasProvider: true, 3572 delayRef, 3573 initialDelayRef, 3574 currentIdRef, 3575 timeoutMs, 3576 currentContextRef, 3577 timeout 3578 }), [timeoutMs, timeout]), 3579 children 3580 }); 3581 } 3582 function useDelayGroup(context, options = { 3583 open: false 3584 }) { 3585 const { 3586 open: open3 3587 } = options; 3588 const store3 = "rootStore" in context ? context.rootStore : context; 3589 const floatingId = store3.useState("floatingId"); 3590 const groupContext = React18.useContext(FloatingDelayGroupContext); 3591 const { 3592 currentIdRef, 3593 delayRef, 3594 timeoutMs, 3595 initialDelayRef, 3596 currentContextRef, 3597 hasProvider, 3598 timeout 3599 } = groupContext; 3600 const [isInstantPhase, setIsInstantPhase] = React18.useState(false); 3601 const openRef = React18.useRef(open3); 3602 useIsoLayoutEffect(() => { 3603 openRef.current = open3; 3604 }, [open3]); 3605 useIsoLayoutEffect(() => { 3606 function unset() { 3607 currentContextRef.current?.setIsInstantPhase(false); 3608 currentIdRef.current = null; 3609 currentContextRef.current = null; 3610 delayRef.current = initialDelayRef.current; 3611 timeout.clear(); 3612 } 3613 if (!currentIdRef.current) { 3614 return void 0; 3615 } 3616 if (!open3 && currentIdRef.current === floatingId) { 3617 setIsInstantPhase(false); 3618 if (timeoutMs) { 3619 const closingId = floatingId; 3620 timeout.start(timeoutMs, () => { 3621 if (store3.select("open") || currentIdRef.current && currentIdRef.current !== closingId) { 3622 return; 3623 } 3624 unset(); 3625 }); 3626 return () => { 3627 if (openRef.current || currentIdRef.current !== closingId) { 3628 timeout.clear(); 3629 } 3630 }; 3631 } 3632 unset(); 3633 } 3634 return void 0; 3635 }, [open3, floatingId, currentIdRef, delayRef, timeoutMs, initialDelayRef, currentContextRef, timeout, store3]); 3636 useIsoLayoutEffect(() => { 3637 if (!open3) { 3638 return; 3639 } 3640 const prevContext = currentContextRef.current; 3641 const prevId = currentIdRef.current; 3642 timeout.clear(); 3643 currentContextRef.current = { 3644 onOpenChange: store3.setOpen, 3645 setIsInstantPhase 3646 }; 3647 currentIdRef.current = floatingId; 3648 delayRef.current = { 3649 open: 0, 3650 close: getDelay(initialDelayRef.current, "close") 3651 }; 3652 if (prevId !== null && prevId !== floatingId) { 3653 setIsInstantPhase(true); 3654 prevContext?.setIsInstantPhase(true); 3655 prevContext?.onOpenChange(false, createChangeEventDetails(reason_parts_exports.none)); 3656 } else { 3657 setIsInstantPhase(false); 3658 prevContext?.setIsInstantPhase(false); 3659 } 3660 }, [open3, floatingId, store3, currentIdRef, delayRef, initialDelayRef, currentContextRef, timeout]); 3661 useIsoLayoutEffect(() => { 3662 return () => { 3663 if (currentIdRef.current === floatingId) { 3664 currentContextRef.current = null; 3665 if (!openRef.current) { 3666 return; 3667 } 3668 currentIdRef.current = null; 3669 resetDelayRef(delayRef, initialDelayRef); 3670 timeout.clear(); 3671 } 3672 }; 3673 }, [currentContextRef, currentIdRef, delayRef, floatingId, initialDelayRef, timeout]); 3674 return React18.useMemo(() => ({ 3675 activeIdRef: currentIdRef, 3676 hasProvider, 3677 delayRef, 3678 isInstantPhase 3679 }), [currentIdRef, hasProvider, delayRef, isInstantPhase]); 3680 } 3681 3682 // node_modules/@base-ui/utils/mergeCleanups.mjs 3683 function mergeCleanups(...cleanups) { 3684 return () => { 3685 for (let i = 0; i < cleanups.length; i += 1) { 3686 const cleanup = cleanups[i]; 3687 if (cleanup) { 3688 cleanup(); 3689 } 3690 } 3691 }; 3692 } 3693 3694 // node_modules/@base-ui/react/utils/FocusGuard.mjs 3695 var React19 = __toESM(require_react(), 1); 3696 3697 // node_modules/@base-ui/utils/visuallyHidden.mjs 3698 var visuallyHiddenBase = { 3699 clipPath: "inset(50%)", 3700 overflow: "hidden", 3701 whiteSpace: "nowrap", 3702 border: 0, 3703 padding: 0, 3704 width: 1, 3705 height: 1, 3706 margin: -1 3707 }; 3708 var visuallyHidden = { 3709 ...visuallyHiddenBase, 3710 position: "fixed", 3711 top: 0, 3712 left: 0 3713 }; 3714 var visuallyHiddenInput = { 3715 ...visuallyHiddenBase, 3716 position: "absolute" 3717 }; 3718 3719 // node_modules/@base-ui/react/utils/FocusGuard.mjs 3720 var import_jsx_runtime26 = __toESM(require_jsx_runtime(), 1); 3721 var FocusGuard = /* @__PURE__ */ React19.forwardRef(function FocusGuard2(props, ref) { 3722 const [role, setRole] = React19.useState(); 3723 useIsoLayoutEffect(() => { 3724 if (parts_exports.screenReader.voiceOver && parts_exports.engine.webkit) { 3725 setRole("button"); 3726 } 3727 }, []); 3728 const restProps = { 3729 tabIndex: 0, 3730 // Role is only for VoiceOver 3731 role 3732 }; 3733 return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { 3734 ...props, 3735 ref, 3736 style: visuallyHidden, 3737 "aria-hidden": role ? void 0 : true, 3738 ...restProps, 3739 "data-base-ui-focus-guard": "" 3740 }); 3741 }); 3742 if (true) FocusGuard.displayName = "FocusGuard"; 3743 3744 // node_modules/@floating-ui/utils/dist/floating-ui.utils.mjs 3745 var min = Math.min; 3746 var max = Math.max; 3747 var round = Math.round; 3748 var floor = Math.floor; 3749 var createCoords = (v) => ({ 3750 x: v, 3751 y: v 3752 }); 3753 var oppositeSideMap = { 3754 left: "right", 3755 right: "left", 3756 bottom: "top", 3757 top: "bottom" 3758 }; 3759 function clamp(start, value, end) { 3760 return max(start, min(value, end)); 3761 } 3762 function evaluate(value, param) { 3763 return typeof value === "function" ? value(param) : value; 3764 } 3765 function getSide(placement) { 3766 return placement.split("-")[0]; 3767 } 3768 function getAlignment(placement) { 3769 return placement.split("-")[1]; 3770 } 3771 function getOppositeAxis(axis) { 3772 return axis === "x" ? "y" : "x"; 3773 } 3774 function getAxisLength(axis) { 3775 return axis === "y" ? "height" : "width"; 3776 } 3777 function getSideAxis(placement) { 3778 const firstChar = placement[0]; 3779 return firstChar === "t" || firstChar === "b" ? "y" : "x"; 3780 } 3781 function getAlignmentAxis(placement) { 3782 return getOppositeAxis(getSideAxis(placement)); 3783 } 3784 function getAlignmentSides(placement, rects, rtl) { 3785 if (rtl === void 0) { 3786 rtl = false; 3787 } 3788 const alignment = getAlignment(placement); 3789 const alignmentAxis = getAlignmentAxis(placement); 3790 const length = getAxisLength(alignmentAxis); 3791 let mainAlignmentSide = alignmentAxis === "x" ? alignment === (rtl ? "end" : "start") ? "right" : "left" : alignment === "start" ? "bottom" : "top"; 3792 if (rects.reference[length] > rects.floating[length]) { 3793 mainAlignmentSide = getOppositePlacement(mainAlignmentSide); 3794 } 3795 return [mainAlignmentSide, getOppositePlacement(mainAlignmentSide)]; 3796 } 3797 function getExpandedPlacements(placement) { 3798 const oppositePlacement = getOppositePlacement(placement); 3799 return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)]; 3800 } 3801 function getOppositeAlignmentPlacement(placement) { 3802 return placement.includes("start") ? placement.replace("start", "end") : placement.replace("end", "start"); 3803 } 3804 var lrPlacement = ["left", "right"]; 3805 var rlPlacement = ["right", "left"]; 3806 var tbPlacement = ["top", "bottom"]; 3807 var btPlacement = ["bottom", "top"]; 3808 function getSideList(side, isStart, rtl) { 3809 switch (side) { 3810 case "top": 3811 case "bottom": 3812 if (rtl) return isStart ? rlPlacement : lrPlacement; 3813 return isStart ? lrPlacement : rlPlacement; 3814 case "left": 3815 case "right": 3816 return isStart ? tbPlacement : btPlacement; 3817 default: 3818 return []; 3819 } 3820 } 3821 function getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) { 3822 const alignment = getAlignment(placement); 3823 let list = getSideList(getSide(placement), direction === "start", rtl); 3824 if (alignment) { 3825 list = list.map((side) => side + "-" + alignment); 3826 if (flipAlignment) { 3827 list = list.concat(list.map(getOppositeAlignmentPlacement)); 3828 } 3829 } 3830 return list; 3831 } 3832 function getOppositePlacement(placement) { 3833 const side = getSide(placement); 3834 return oppositeSideMap[side] + placement.slice(side.length); 3835 } 3836 function expandPaddingObject(padding) { 3837 var _padding$top, _padding$right, _padding$bottom, _padding$left; 3838 return { 3839 top: (_padding$top = padding.top) != null ? _padding$top : 0, 3840 right: (_padding$right = padding.right) != null ? _padding$right : 0, 3841 bottom: (_padding$bottom = padding.bottom) != null ? _padding$bottom : 0, 3842 left: (_padding$left = padding.left) != null ? _padding$left : 0 3843 }; 3844 } 3845 function getPaddingObject(padding) { 3846 return typeof padding !== "number" ? expandPaddingObject(padding) : { 3847 top: padding, 3848 right: padding, 3849 bottom: padding, 3850 left: padding 3851 }; 3852 } 3853 function rectToClientRect(rect) { 3854 const { 3855 x, 3856 y, 3857 width, 3858 height 3859 } = rect; 3860 return { 3861 width, 3862 height, 3863 top: y, 3864 left: x, 3865 right: x + width, 3866 bottom: y + height, 3867 x, 3868 y 3869 }; 3870 } 3871 3872 // node_modules/@base-ui/react/floating-ui-react/utils/composite.mjs 3873 function isHiddenByStyles(styles) { 3874 return styles.visibility === "hidden" || styles.visibility === "collapse"; 3875 } 3876 function isElementVisible(element, styles = element ? getComputedStyle2(element) : null) { 3877 if (!element || !element.isConnected || !styles || isHiddenByStyles(styles)) { 3878 return false; 3879 } 3880 if (typeof element.checkVisibility === "function") { 3881 return element.checkVisibility(); 3882 } 3883 return styles.display !== "none" && styles.display !== "contents"; 3884 } 3885 3886 // node_modules/@base-ui/react/floating-ui-react/utils/tabbable.mjs 3887 var CANDIDATE_SELECTOR = 'a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable="false"]),audio[controls],video[controls]'; 3888 function getParentElement(element) { 3889 const assignedSlot = element.assignedSlot; 3890 if (assignedSlot) { 3891 return assignedSlot; 3892 } 3893 if (element.parentElement) { 3894 return element.parentElement; 3895 } 3896 const rootNode = element.getRootNode(); 3897 return isShadowRoot(rootNode) ? rootNode.host : null; 3898 } 3899 function getDetailsSummary(details) { 3900 for (const child of Array.from(details.children)) { 3901 if (getNodeName(child) === "summary") { 3902 return child; 3903 } 3904 } 3905 return null; 3906 } 3907 function isWithinOpenDetailsSummary(element, details) { 3908 const summary = getDetailsSummary(details); 3909 return !!summary && (element === summary || contains(summary, element)); 3910 } 3911 function isFocusableCandidate(element) { 3912 const nodeName = element ? getNodeName(element) : ""; 3913 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"); 3914 } 3915 function isFocusableElement(element) { 3916 if (!isFocusableCandidate(element) || !element.isConnected || element.matches(":disabled")) { 3917 return false; 3918 } 3919 for (let current = element; current; current = getParentElement(current)) { 3920 const isAncestor = current !== element; 3921 const isSlot = getNodeName(current) === "slot"; 3922 if (current.hasAttribute("inert")) { 3923 return false; 3924 } 3925 if (isAncestor && getNodeName(current) === "details" && !current.open && !isWithinOpenDetailsSummary(element, current) || current.hasAttribute("hidden") || !isSlot && !isVisibleInTabbableTree(current, isAncestor)) { 3926 return false; 3927 } 3928 } 3929 return true; 3930 } 3931 function isVisibleInTabbableTree(element, isAncestor) { 3932 const styles = getComputedStyle2(element); 3933 if (!isAncestor) { 3934 return isElementVisible(element, styles); 3935 } 3936 return styles.display !== "none"; 3937 } 3938 function getTabIndex(element) { 3939 const tabIndex = element.tabIndex; 3940 if (tabIndex < 0) { 3941 const nodeName = getNodeName(element); 3942 if (nodeName === "details" || nodeName === "audio" || nodeName === "video" || isHTMLElement(element) && element.isContentEditable) { 3943 return 0; 3944 } 3945 } 3946 return tabIndex; 3947 } 3948 function getNamedRadioInput(element) { 3949 if (getNodeName(element) !== "input") { 3950 return null; 3951 } 3952 const input = element; 3953 return input.type === "radio" && input.name !== "" ? input : null; 3954 } 3955 function isTabbableRadio(element, candidates) { 3956 const input = getNamedRadioInput(element); 3957 if (!input) { 3958 return true; 3959 } 3960 const checkedRadio = candidates.find((candidate) => { 3961 const radio = getNamedRadioInput(candidate); 3962 return radio?.name === input.name && radio.form === input.form && radio.checked; 3963 }); 3964 if (checkedRadio) { 3965 return checkedRadio === input; 3966 } 3967 return candidates.find((candidate) => { 3968 const radio = getNamedRadioInput(candidate); 3969 return radio?.name === input.name && radio.form === input.form; 3970 }) === input; 3971 } 3972 function getComposedChildren(container) { 3973 if (isHTMLElement(container) && getNodeName(container) === "slot") { 3974 const assignedElements = container.assignedElements({ 3975 flatten: true 3976 }); 3977 if (assignedElements.length > 0) { 3978 return assignedElements; 3979 } 3980 } 3981 if (isHTMLElement(container) && container.shadowRoot) { 3982 return Array.from(container.shadowRoot.children); 3983 } 3984 return Array.from(container.children); 3985 } 3986 function appendCandidates(container, list) { 3987 getComposedChildren(container).forEach((child) => { 3988 if (isFocusableCandidate(child)) { 3989 list.push(child); 3990 } 3991 appendCandidates(child, list); 3992 }); 3993 } 3994 function appendMatchingElements(container, selector, list) { 3995 getComposedChildren(container).forEach((child) => { 3996 if (isHTMLElement(child) && child.matches(selector)) { 3997 list.push(child); 3998 } 3999 appendMatchingElements(child, selector, list); 4000 }); 4001 } 4002 function focusable(container) { 4003 const candidates = []; 4004 appendCandidates(container, candidates); 4005 return candidates.filter(isFocusableElement); 4006 } 4007 function tabbable(container) { 4008 const candidates = focusable(container); 4009 return candidates.filter((element) => getTabIndex(element) >= 0 && isTabbableRadio(element, candidates)); 4010 } 4011 function getTabbableIn(container, dir) { 4012 const list = tabbable(container); 4013 const len = list.length; 4014 if (len === 0) { 4015 return void 0; 4016 } 4017 const active = activeElement(ownerDocument(container)); 4018 const index2 = list.indexOf(active); 4019 const nextIndex = index2 === -1 ? dir === 1 ? 0 : len - 1 : index2 + dir; 4020 return list[nextIndex]; 4021 } 4022 function getNextTabbable(referenceElement) { 4023 return getTabbableIn(ownerDocument(referenceElement).body, 1) || referenceElement; 4024 } 4025 function getPreviousTabbable(referenceElement) { 4026 return getTabbableIn(ownerDocument(referenceElement).body, -1) || referenceElement; 4027 } 4028 function isOutsideEvent(event, container) { 4029 const containerElement = container || event.currentTarget; 4030 const relatedTarget = event.relatedTarget; 4031 return !relatedTarget || !contains(containerElement, relatedTarget); 4032 } 4033 function disableFocusInside(container) { 4034 const tabbableElements = tabbable(container); 4035 tabbableElements.forEach((element) => { 4036 element.dataset.tabindex = element.getAttribute("tabindex") || ""; 4037 element.setAttribute("tabindex", "-1"); 4038 }); 4039 } 4040 function enableFocusInside(container) { 4041 const elements = []; 4042 appendMatchingElements(container, "[data-tabindex]", elements); 4043 elements.forEach((element) => { 4044 const tabindex = element.dataset.tabindex; 4045 delete element.dataset.tabindex; 4046 if (tabindex) { 4047 element.setAttribute("tabindex", tabindex); 4048 } else { 4049 element.removeAttribute("tabindex"); 4050 } 4051 }); 4052 } 4053 4054 // node_modules/@base-ui/react/floating-ui-react/utils/nodes.mjs 4055 function getNodeChildren(nodes, id, onlyOpenChildren = true) { 4056 const directChildren = nodes.filter((node) => node.parentId === id); 4057 return directChildren.flatMap((child) => [...!onlyOpenChildren || child.context?.open ? [child] : [], ...getNodeChildren(nodes, child.id, onlyOpenChildren)]); 4058 } 4059 4060 // node_modules/@base-ui/react/floating-ui-react/utils/createAttribute.mjs 4061 function createAttribute(name2) { 4062 return `data-base-ui-$name2}`; 4063 } 4064 4065 // node_modules/@base-ui/react/floating-ui-react/components/FloatingPortal.mjs 4066 var React20 = __toESM(require_react(), 1); 4067 var ReactDOM2 = __toESM(require_react_dom(), 1); 4068 4069 // node_modules/@base-ui/react/internals/constants.mjs 4070 var DISABLED_TRANSITIONS_STYLE = { 4071 style: { 4072 transition: "none" 4073 } 4074 }; 4075 var BASE_UI_SWIPE_IGNORE_ATTRIBUTE = "data-base-ui-swipe-ignore"; 4076 var LEGACY_SWIPE_IGNORE_ATTRIBUTE = "data-swipe-ignore"; 4077 var BASE_UI_SWIPE_IGNORE_SELECTOR = `[$BASE_UI_SWIPE_IGNORE_ATTRIBUTE}]`; 4078 var LEGACY_SWIPE_IGNORE_SELECTOR = `[$LEGACY_SWIPE_IGNORE_ATTRIBUTE}]`; 4079 var POPUP_COLLISION_AVOIDANCE = { 4080 fallbackAxisSide: "end" 4081 }; 4082 var ownerVisuallyHidden = { 4083 clipPath: "inset(50%)", 4084 position: "fixed", 4085 top: 0, 4086 left: 0 4087 }; 4088 4089 // node_modules/@base-ui/react/floating-ui-react/components/FloatingPortal.mjs 4090 var import_jsx_runtime27 = __toESM(require_jsx_runtime(), 1); 4091 var PortalContext = /* @__PURE__ */ React20.createContext(null); 4092 if (true) PortalContext.displayName = "PortalContext"; 4093 var usePortalContext = () => React20.useContext(PortalContext); 4094 var attr = createAttribute("portal"); 4095 function useFloatingPortalNode(props = {}) { 4096 const { 4097 ref, 4098 container: containerProp, 4099 componentProps = EMPTY_OBJECT, 4100 elementProps 4101 } = props; 4102 const uniqueId = useId(); 4103 const portalContext = usePortalContext(); 4104 const parentPortalNode = portalContext?.portalNode; 4105 const [containerElement, setContainerElement] = React20.useState(null); 4106 const [portalNode, setPortalNode] = React20.useState(null); 4107 const setPortalNodeRef = useStableCallback((node) => { 4108 if (node !== null) { 4109 setPortalNode(node); 4110 } 4111 }); 4112 const containerRef = React20.useRef(null); 4113 useIsoLayoutEffect(() => { 4114 if (containerProp === null) { 4115 if (containerRef.current) { 4116 containerRef.current = null; 4117 setPortalNode(null); 4118 setContainerElement(null); 4119 } 4120 return; 4121 } 4122 const resolvedContainer = (containerProp && (isNode(containerProp) ? containerProp : containerProp.current)) ?? parentPortalNode ?? document.body; 4123 if (resolvedContainer == null) { 4124 if (containerRef.current) { 4125 containerRef.current = null; 4126 setPortalNode(null); 4127 setContainerElement(null); 4128 } 4129 return; 4130 } 4131 if (containerRef.current !== resolvedContainer) { 4132 containerRef.current = resolvedContainer; 4133 setPortalNode(null); 4134 setContainerElement(resolvedContainer); 4135 } 4136 }, [containerProp, parentPortalNode]); 4137 const portalElement = useRenderElement("div", componentProps, { 4138 ref: [ref, setPortalNodeRef], 4139 props: [{ 4140 id: uniqueId, 4141 [attr]: "" 4142 }, elementProps] 4143 }); 4144 const portalSubtree = containerElement && portalElement ? /* @__PURE__ */ ReactDOM2.createPortal(portalElement, containerElement) : null; 4145 return { 4146 node: portalNode, 4147 // `id` and `render` props can override or remove the generated ID. Use the exact 4148 // rendered value so `aria-owns` never points at an ID absent from the DOM. 4149 nodeId: /* @__PURE__ */ React20.isValidElement(portalElement) ? portalElement.props.id : void 0, 4150 subtree: portalSubtree 4151 }; 4152 } 4153 var FloatingPortal = /* @__PURE__ */ React20.forwardRef(function FloatingPortal2(componentProps, forwardedRef) { 4154 const { 4155 render, 4156 className, 4157 style, 4158 children, 4159 container, 4160 portalOwnerRole, 4161 ...elementProps 4162 } = componentProps; 4163 const { 4164 node: portalNode, 4165 nodeId: portalNodeId, 4166 subtree: portalSubtree 4167 } = useFloatingPortalNode({ 4168 container, 4169 ref: forwardedRef, 4170 componentProps, 4171 elementProps 4172 }); 4173 const beforeOutsideRef = React20.useRef(null); 4174 const afterOutsideRef = React20.useRef(null); 4175 const beforeInsideRef = React20.useRef(null); 4176 const afterInsideRef = React20.useRef(null); 4177 const [focusManagerState, setFocusManagerState] = React20.useState(null); 4178 const focusInsideDisabledRef = React20.useRef(false); 4179 const modal = focusManagerState?.modal; 4180 const open3 = focusManagerState?.open; 4181 const shouldRenderGuards = !!focusManagerState && !focusManagerState.modal && focusManagerState.open && !!portalNode; 4182 React20.useEffect(() => { 4183 if (!portalNode || modal) { 4184 return void 0; 4185 } 4186 function onFocus(event) { 4187 if (portalNode && event.relatedTarget && isOutsideEvent(event)) { 4188 if (event.type === "focusin") { 4189 if (focusInsideDisabledRef.current) { 4190 enableFocusInside(portalNode); 4191 focusInsideDisabledRef.current = false; 4192 } 4193 } else { 4194 disableFocusInside(portalNode); 4195 focusInsideDisabledRef.current = true; 4196 } 4197 } 4198 } 4199 return mergeCleanups(addEventListener(portalNode, "focusin", onFocus, true), addEventListener(portalNode, "focusout", onFocus, true)); 4200 }, [portalNode, modal]); 4201 useIsoLayoutEffect(() => { 4202 if (!portalNode || open3 !== true || !focusInsideDisabledRef.current) { 4203 return; 4204 } 4205 enableFocusInside(portalNode); 4206 focusInsideDisabledRef.current = false; 4207 }, [open3, portalNode]); 4208 const portalContextValue = React20.useMemo(() => ({ 4209 beforeOutsideRef, 4210 afterOutsideRef, 4211 beforeInsideRef, 4212 afterInsideRef, 4213 portalNode, 4214 setFocusManagerState 4215 }), [portalNode]); 4216 return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(React20.Fragment, { 4217 children: [portalSubtree, /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(PortalContext.Provider, { 4218 value: portalContextValue, 4219 children: [shouldRenderGuards && portalNode && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(FocusGuard, { 4220 "data-type": "outside", 4221 ref: beforeOutsideRef, 4222 onFocus: (event) => { 4223 if (isOutsideEvent(event, portalNode)) { 4224 beforeInsideRef.current?.focus(); 4225 } else { 4226 const domReference = focusManagerState ? focusManagerState.domReference : null; 4227 const prevTabbable = getPreviousTabbable(domReference); 4228 prevTabbable?.focus(); 4229 } 4230 } 4231 }), shouldRenderGuards && portalNode && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { 4232 role: portalOwnerRole, 4233 "aria-owns": portalNodeId, 4234 style: ownerVisuallyHidden 4235 }), portalNode && /* @__PURE__ */ ReactDOM2.createPortal(children, portalNode), shouldRenderGuards && portalNode && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(FocusGuard, { 4236 "data-type": "outside", 4237 ref: afterOutsideRef, 4238 onFocus: (event) => { 4239 if (isOutsideEvent(event, portalNode)) { 4240 afterInsideRef.current?.focus(); 4241 } else { 4242 const domReference = focusManagerState ? focusManagerState.domReference : null; 4243 const nextTabbable = getNextTabbable(domReference); 4244 nextTabbable?.focus(); 4245 if (focusManagerState?.closeOnFocusOut) { 4246 focusManagerState?.onOpenChange(false, createChangeEventDetails(reason_parts_exports.focusOut, event.nativeEvent)); 4247 } 4248 } 4249 } 4250 })] 4251 })] 4252 }); 4253 }); 4254 if (true) FloatingPortal.displayName = "FloatingPortal"; 4255 4256 // node_modules/@base-ui/react/floating-ui-react/components/FloatingTree.mjs 4257 var React21 = __toESM(require_react(), 1); 4258 4259 // node_modules/@base-ui/react/floating-ui-react/utils/createEventEmitter.mjs 4260 function createEventEmitter() { 4261 const map = /* @__PURE__ */ new Map(); 4262 return { 4263 emit(event, data) { 4264 map.get(event)?.forEach((listener) => listener(data)); 4265 }, 4266 on(event, listener) { 4267 if (!map.has(event)) { 4268 map.set(event, /* @__PURE__ */ new Set()); 4269 } 4270 map.get(event).add(listener); 4271 }, 4272 off(event, listener) { 4273 map.get(event)?.delete(listener); 4274 } 4275 }; 4276 } 4277 4278 // node_modules/@base-ui/react/floating-ui-react/components/FloatingTree.mjs 4279 var import_jsx_runtime28 = __toESM(require_jsx_runtime(), 1); 4280 var FloatingNodeContext = /* @__PURE__ */ React21.createContext(null); 4281 if (true) FloatingNodeContext.displayName = "FloatingNodeContext"; 4282 var FloatingTreeContext = /* @__PURE__ */ React21.createContext(null); 4283 if (true) FloatingTreeContext.displayName = "FloatingTreeContext"; 4284 var useFloatingParentNodeId = () => React21.useContext(FloatingNodeContext)?.id || null; 4285 var useFloatingTree = (externalTree) => { 4286 const contextTree = React21.useContext(FloatingTreeContext); 4287 return externalTree ?? contextTree; 4288 }; 4289 4290 // node_modules/@base-ui/react/floating-ui-react/hooks/useClientPoint.mjs 4291 var React22 = __toESM(require_react(), 1); 4292 function createVirtualElement(domElement, data) { 4293 let offsetX = null; 4294 let offsetY = null; 4295 let isAutoUpdateEvent = false; 4296 return { 4297 contextElement: domElement || void 0, 4298 getBoundingClientRect() { 4299 const domRect = domElement?.getBoundingClientRect() || { 4300 width: 0, 4301 height: 0, 4302 x: 0, 4303 y: 0 4304 }; 4305 const isXAxis = data.axis === "x" || data.axis === "both"; 4306 const isYAxis = data.axis === "y" || data.axis === "both"; 4307 const canTrackCursorOnAutoUpdate = ["mouseenter", "mousemove"].includes(data.dataRef.current.openEvent?.type || "") && data.pointerType !== "touch"; 4308 let width = domRect.width; 4309 let height = domRect.height; 4310 let x = domRect.x; 4311 let y = domRect.y; 4312 if (offsetX == null && data.x && isXAxis) { 4313 offsetX = domRect.x - data.x; 4314 } 4315 if (offsetY == null && data.y && isYAxis) { 4316 offsetY = domRect.y - data.y; 4317 } 4318 x -= offsetX || 0; 4319 y -= offsetY || 0; 4320 width = 0; 4321 height = 0; 4322 if (!isAutoUpdateEvent || canTrackCursorOnAutoUpdate) { 4323 width = data.axis === "y" ? domRect.width : 0; 4324 height = data.axis === "x" ? domRect.height : 0; 4325 x = isXAxis && data.x != null ? data.x : x; 4326 y = isYAxis && data.y != null ? data.y : y; 4327 } else if (isAutoUpdateEvent && !canTrackCursorOnAutoUpdate) { 4328 height = data.axis === "x" ? domRect.height : height; 4329 width = data.axis === "y" ? domRect.width : width; 4330 } 4331 isAutoUpdateEvent = true; 4332 return { 4333 width, 4334 height, 4335 x, 4336 y, 4337 top: y, 4338 right: x + width, 4339 bottom: y + height, 4340 left: x 4341 }; 4342 } 4343 }; 4344 } 4345 function isMouseBasedEvent(event) { 4346 return event != null && event.clientX != null; 4347 } 4348 function useClientPoint(context, props = {}) { 4349 const { 4350 enabled = true, 4351 axis = "both" 4352 } = props; 4353 const store3 = "rootStore" in context ? context.rootStore : context; 4354 const open3 = store3.useState("open"); 4355 const floating = store3.useState("floatingElement"); 4356 const domReference = store3.useState("domReferenceElement"); 4357 const dataRef = store3.context.dataRef; 4358 const initialRef = React22.useRef(false); 4359 const cleanupListenerRef = React22.useRef(null); 4360 const [pointerType, setPointerType] = React22.useState(); 4361 const [reactive, setReactive] = React22.useState([]); 4362 const resetReference = useStableCallback((reference2) => { 4363 store3.set("positionReference", reference2); 4364 }); 4365 const setReference = useStableCallback((newX, newY, referenceElement) => { 4366 if (initialRef.current) { 4367 return; 4368 } 4369 if (dataRef.current.openEvent && !isMouseBasedEvent(dataRef.current.openEvent)) { 4370 return; 4371 } 4372 store3.set("positionReference", createVirtualElement(referenceElement ?? domReference, { 4373 x: newX, 4374 y: newY, 4375 axis, 4376 dataRef, 4377 pointerType 4378 })); 4379 }); 4380 const handleReferenceEnterOrMove = useStableCallback((event) => { 4381 if (!open3) { 4382 setReference(event.clientX, event.clientY, event.currentTarget); 4383 } else if (!cleanupListenerRef.current) { 4384 setReference(event.clientX, event.clientY, event.currentTarget); 4385 setReactive([]); 4386 } 4387 }); 4388 const openCheck = isMouseLikePointerType(pointerType) ? floating : open3; 4389 React22.useEffect(() => { 4390 if (!enabled) { 4391 resetReference(domReference); 4392 return void 0; 4393 } 4394 if (!openCheck) { 4395 return void 0; 4396 } 4397 function cleanupListener() { 4398 cleanupListenerRef.current?.(); 4399 cleanupListenerRef.current = null; 4400 } 4401 const win = getWindow(floating); 4402 function handleMouseMove(event) { 4403 const target = getTarget(event); 4404 if (!contains(floating, target)) { 4405 setReference(event.clientX, event.clientY); 4406 } else { 4407 cleanupListener(); 4408 } 4409 } 4410 if (!dataRef.current.openEvent || isMouseBasedEvent(dataRef.current.openEvent)) { 4411 cleanupListenerRef.current = addEventListener(win, "mousemove", handleMouseMove); 4412 } else { 4413 resetReference(domReference); 4414 } 4415 return cleanupListener; 4416 }, [openCheck, enabled, floating, dataRef, domReference, store3, setReference, resetReference, reactive]); 4417 React22.useEffect(() => () => { 4418 store3.set("positionReference", null); 4419 }, [store3]); 4420 React22.useEffect(() => { 4421 if (enabled && !floating) { 4422 initialRef.current = false; 4423 } 4424 }, [enabled, floating]); 4425 React22.useEffect(() => { 4426 if (!enabled && open3) { 4427 initialRef.current = true; 4428 } 4429 }, [enabled, open3]); 4430 const reference = React22.useMemo(() => { 4431 function setPointerTypeRef(event) { 4432 setPointerType(event.pointerType); 4433 } 4434 return { 4435 onPointerDown: setPointerTypeRef, 4436 onPointerEnter: setPointerTypeRef, 4437 onMouseMove: handleReferenceEnterOrMove, 4438 onMouseEnter: handleReferenceEnterOrMove 4439 }; 4440 }, [handleReferenceEnterOrMove]); 4441 return React22.useMemo(() => enabled ? { 4442 reference, 4443 trigger: reference 4444 } : {}, [enabled, reference]); 4445 } 4446 4447 // node_modules/@base-ui/react/floating-ui-react/hooks/useDismiss.mjs 4448 var React23 = __toESM(require_react(), 1); 4449 function alwaysFalse() { 4450 return false; 4451 } 4452 function normalizeProp(normalizable) { 4453 return { 4454 escapeKey: typeof normalizable === "boolean" ? normalizable : normalizable?.escapeKey ?? false, 4455 outsidePress: typeof normalizable === "boolean" ? normalizable : normalizable?.outsidePress ?? true 4456 }; 4457 } 4458 function useDismiss(context, props = {}) { 4459 const { 4460 enabled = true, 4461 escapeKey: escapeKey2 = true, 4462 outsidePress: outsidePressProp = true, 4463 outsidePressEvent = "sloppy", 4464 referencePress = alwaysFalse, 4465 bubbles, 4466 externalTree 4467 } = props; 4468 const store3 = "rootStore" in context ? context.rootStore : context; 4469 const open3 = store3.useState("open"); 4470 const floatingElement = store3.useState("floatingElement"); 4471 const { 4472 dataRef, 4473 events 4474 } = store3.context; 4475 const tree = useFloatingTree(externalTree); 4476 const outsidePressFn = useStableCallback(typeof outsidePressProp === "function" ? outsidePressProp : () => false); 4477 const outsidePress2 = typeof outsidePressProp === "function" ? outsidePressFn : outsidePressProp; 4478 const outsidePressEnabled = outsidePress2 !== false; 4479 const getOutsidePressEventProp = useStableCallback(() => outsidePressEvent); 4480 const { 4481 escapeKey: escapeKeyBubbles, 4482 outsidePress: outsidePressBubbles 4483 } = normalizeProp(bubbles); 4484 const pressStartedInsideRef = React23.useRef(false); 4485 const pressStartPreventedRef = React23.useRef(false); 4486 const suppressNextOutsideClickRef = React23.useRef(false); 4487 const sawPressWhileOpenRef = React23.useRef(false); 4488 const isComposingRef = React23.useRef(false); 4489 const currentPointerTypeRef = React23.useRef(""); 4490 const touchStateRef = React23.useRef(null); 4491 const cancelDismissOnEndTimeout = useTimeout(); 4492 const clearInsideReactTreeTimeout = useTimeout(); 4493 const clearInsideReactTree = useStableCallback(() => { 4494 clearInsideReactTreeTimeout.clear(); 4495 dataRef.current.insideReactTree = false; 4496 }); 4497 const hasBlockingChild = useStableCallback((bubbleKey) => { 4498 const nodeId = dataRef.current.floatingContext?.nodeId; 4499 const children = tree ? getNodeChildren(tree.nodesRef.current, nodeId) : []; 4500 return children.some((child) => child.context?.open && !child.context.dataRef.current[bubbleKey]); 4501 }); 4502 const isEventWithinOwnElements = useStableCallback((event) => { 4503 return isEventTargetWithin(event, store3.select("floatingElement")) || isEventTargetWithin(event, store3.select("domReferenceElement")); 4504 }); 4505 const closeOnReferencePress = useStableCallback((event) => { 4506 if (!referencePress()) { 4507 return; 4508 } 4509 store3.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerPress, event.nativeEvent)); 4510 }); 4511 const closeOnEscapeKeyDown = useStableCallback((event) => { 4512 if (!open3 || !enabled || !escapeKey2 || event.key !== "Escape") { 4513 return; 4514 } 4515 if (isComposingRef.current) { 4516 return; 4517 } 4518 if (!escapeKeyBubbles && hasBlockingChild("__escapeKeyBubbles")) { 4519 return; 4520 } 4521 const native = isReactEvent(event) ? event.nativeEvent : event; 4522 const eventDetails = createChangeEventDetails(reason_parts_exports.escapeKey, native); 4523 store3.setOpen(false, eventDetails); 4524 if (!eventDetails.isCanceled) { 4525 event.preventDefault(); 4526 } 4527 if (!escapeKeyBubbles && !eventDetails.isPropagationAllowed) { 4528 event.stopPropagation(); 4529 } 4530 }); 4531 const markInsideReactTree = useStableCallback(() => { 4532 dataRef.current.insideReactTree = true; 4533 clearInsideReactTreeTimeout.start(0, clearInsideReactTree); 4534 }); 4535 const markPressStartedInsideReactTree = useStableCallback((event) => { 4536 if (!open3 || !enabled || event.button !== 0) { 4537 return; 4538 } 4539 const target = getTarget(event.nativeEvent); 4540 if (!contains(store3.select("floatingElement"), target)) { 4541 return; 4542 } 4543 if (!pressStartedInsideRef.current) { 4544 pressStartedInsideRef.current = true; 4545 pressStartPreventedRef.current = false; 4546 } 4547 }); 4548 const markInsidePressStartPrevented = useStableCallback((event) => { 4549 if (!open3 || !enabled) { 4550 return; 4551 } 4552 if (!(event.defaultPrevented || event.nativeEvent.defaultPrevented)) { 4553 return; 4554 } 4555 if (pressStartedInsideRef.current) { 4556 pressStartPreventedRef.current = true; 4557 } 4558 }); 4559 React23.useEffect(() => { 4560 function handleOpenChange(details) { 4561 if (!details.open) { 4562 sawPressWhileOpenRef.current = false; 4563 } 4564 } 4565 events.on("openchange", handleOpenChange); 4566 return () => { 4567 events.off("openchange", handleOpenChange); 4568 }; 4569 }, [events]); 4570 React23.useEffect(() => { 4571 if (!open3 || !enabled) { 4572 if (!open3) { 4573 sawPressWhileOpenRef.current = false; 4574 } 4575 return clearInsideReactTree; 4576 } 4577 dataRef.current.__escapeKeyBubbles = escapeKeyBubbles; 4578 dataRef.current.__outsidePressBubbles = outsidePressBubbles; 4579 const compositionTimeout = new Timeout(); 4580 const preventedPressSuppressionTimeout = new Timeout(); 4581 const doc = ownerDocument(floatingElement); 4582 function handleCompositionStart() { 4583 compositionTimeout.clear(); 4584 isComposingRef.current = true; 4585 } 4586 function handleCompositionEnd() { 4587 compositionTimeout.start( 4588 // 0ms or 1ms don't work in Safari. 5ms appears to consistently work. 4589 // Only apply to WebKit for the test to remain 0ms. 4590 parts_exports.engine.webkit ? 5 : 0, 4591 () => { 4592 isComposingRef.current = false; 4593 } 4594 ); 4595 } 4596 function suppressImmediateOutsideClickAfterPreventedStart() { 4597 suppressNextOutsideClickRef.current = true; 4598 preventedPressSuppressionTimeout.start(0, () => { 4599 suppressNextOutsideClickRef.current = false; 4600 }); 4601 } 4602 function resetPressStartState() { 4603 pressStartedInsideRef.current = false; 4604 pressStartPreventedRef.current = false; 4605 } 4606 function getOutsidePressEvent() { 4607 const type = currentPointerTypeRef.current; 4608 const computedType = type === "pen" || !type ? "mouse" : type; 4609 const outsidePressEventValue = getOutsidePressEventProp(); 4610 const resolved = typeof outsidePressEventValue === "function" ? outsidePressEventValue() : outsidePressEventValue; 4611 if (typeof resolved === "string") { 4612 return resolved; 4613 } 4614 return resolved[computedType]; 4615 } 4616 function shouldIgnoreEvent(event) { 4617 const computedOutsidePressEvent = getOutsidePressEvent(); 4618 return computedOutsidePressEvent === "intentional" && event.type !== "click" || computedOutsidePressEvent === "sloppy" && event.type === "click"; 4619 } 4620 function isEventWithinFloatingTree(event) { 4621 const nodeId = dataRef.current.floatingContext?.nodeId; 4622 const targetIsInsideChildren = tree && getNodeChildren(tree.nodesRef.current, nodeId).some((node) => isEventTargetWithin(event, node.context?.elements.floating)); 4623 return isEventWithinOwnElements(event) || targetIsInsideChildren; 4624 } 4625 function closeOnPressOutside(event) { 4626 if (shouldIgnoreEvent(event)) { 4627 if (event.type !== "click" && !isEventWithinOwnElements(event)) { 4628 preventedPressSuppressionTimeout.clear(); 4629 suppressNextOutsideClickRef.current = false; 4630 } 4631 clearInsideReactTree(); 4632 return; 4633 } 4634 if (dataRef.current.insideReactTree) { 4635 clearInsideReactTree(); 4636 return; 4637 } 4638 const target = getTarget(event); 4639 const inertSelector = `[$createAttribute("inert")}]`; 4640 const targetRoot = isElement(target) ? target.getRootNode() : null; 4641 const markers = Array.from((isShadowRoot(targetRoot) ? targetRoot : ownerDocument(store3.select("floatingElement"))).querySelectorAll(inertSelector)); 4642 const triggers = store3.context.triggerElements; 4643 if (target && (triggers.hasElement(target) || triggers.hasMatchingElement((trigger) => contains(trigger, target)))) { 4644 return; 4645 } 4646 let targetRootAncestor = isElement(target) ? target : null; 4647 while (targetRootAncestor && !isLastTraversableNode(targetRootAncestor)) { 4648 const nextParent = getParentNode(targetRootAncestor); 4649 if (isLastTraversableNode(nextParent) || !isElement(nextParent)) { 4650 break; 4651 } 4652 targetRootAncestor = nextParent; 4653 } 4654 if (markers.length && isElement(target) && !isRootElement(target) && // Clicked on a direct ancestor (e.g. FloatingOverlay). 4655 !contains(target, store3.select("floatingElement")) && // If the target root element contains none of the markers, then the 4656 // element was injected after the floating element rendered. 4657 markers.every((marker) => !contains(targetRootAncestor, marker))) { 4658 return; 4659 } 4660 if (isHTMLElement(target) && !("touches" in event)) { 4661 const lastTraversableNode = isLastTraversableNode(target); 4662 const style = getComputedStyle2(target); 4663 const scrollRe = /auto|scroll/; 4664 const isScrollableX = lastTraversableNode || scrollRe.test(style.overflowX); 4665 const isScrollableY = lastTraversableNode || scrollRe.test(style.overflowY); 4666 const canScrollX = isScrollableX && target.clientWidth > 0 && target.scrollWidth > target.clientWidth; 4667 const canScrollY = isScrollableY && target.clientHeight > 0 && target.scrollHeight > target.clientHeight; 4668 const isRTL6 = style.direction === "rtl"; 4669 const pressedVerticalScrollbar = canScrollY && (isRTL6 ? event.offsetX <= target.offsetWidth - target.clientWidth : event.offsetX > target.clientWidth); 4670 const pressedHorizontalScrollbar = canScrollX && event.offsetY > target.clientHeight; 4671 if (pressedVerticalScrollbar || pressedHorizontalScrollbar) { 4672 return; 4673 } 4674 } 4675 if (isEventWithinFloatingTree(event)) { 4676 return; 4677 } 4678 if (getOutsidePressEvent() === "intentional") { 4679 if (event.detail !== 0 && !isVirtualClick(event) && !sawPressWhileOpenRef.current) { 4680 return; 4681 } 4682 if (suppressNextOutsideClickRef.current) { 4683 preventedPressSuppressionTimeout.clear(); 4684 suppressNextOutsideClickRef.current = false; 4685 return; 4686 } 4687 } 4688 if (typeof outsidePress2 === "function" && !outsidePress2(event)) { 4689 return; 4690 } 4691 if (hasBlockingChild("__outsidePressBubbles")) { 4692 return; 4693 } 4694 store3.setOpen(false, createChangeEventDetails(reason_parts_exports.outsidePress, event)); 4695 clearInsideReactTree(); 4696 } 4697 function handlePointerDown(event) { 4698 if (getOutsidePressEvent() !== "sloppy" || event.pointerType === "touch" || !store3.select("open") || !enabled || isEventWithinOwnElements(event)) { 4699 return; 4700 } 4701 closeOnPressOutside(event); 4702 } 4703 function handleTouchStart(event) { 4704 if (getOutsidePressEvent() !== "sloppy" || !store3.select("open") || !enabled || isEventWithinOwnElements(event)) { 4705 return; 4706 } 4707 const touch = event.touches[0]; 4708 if (touch) { 4709 touchStateRef.current = { 4710 startTime: Date.now(), 4711 startX: touch.clientX, 4712 startY: touch.clientY, 4713 dismissOnTouchEnd: false, 4714 dismissOnMouseDown: true 4715 }; 4716 cancelDismissOnEndTimeout.start(1e3, () => { 4717 if (touchStateRef.current) { 4718 touchStateRef.current.dismissOnTouchEnd = false; 4719 touchStateRef.current.dismissOnMouseDown = false; 4720 } 4721 }); 4722 } 4723 } 4724 function addTargetEventListenerOnce(event, listener) { 4725 const target = getTarget(event); 4726 if (!target) { 4727 return; 4728 } 4729 const unsubscribe2 = addEventListener(target, event.type, () => { 4730 listener(event); 4731 unsubscribe2(); 4732 }); 4733 } 4734 function handleTouchStartCapture(event) { 4735 currentPointerTypeRef.current = "touch"; 4736 addTargetEventListenerOnce(event, handleTouchStart); 4737 } 4738 function closeOnPressOutsideCapture(event) { 4739 cancelDismissOnEndTimeout.clear(); 4740 if (event.type === "pointerdown") { 4741 if (event.button === 0) { 4742 sawPressWhileOpenRef.current = true; 4743 } 4744 currentPointerTypeRef.current = event.pointerType; 4745 } 4746 if (event.type === "mousedown" && touchStateRef.current && !touchStateRef.current.dismissOnMouseDown) { 4747 return; 4748 } 4749 addTargetEventListenerOnce(event, (targetEvent) => { 4750 if (targetEvent.type === "pointerdown") { 4751 handlePointerDown(targetEvent); 4752 } else { 4753 closeOnPressOutside(targetEvent); 4754 } 4755 }); 4756 } 4757 function handlePressEndCapture(event) { 4758 if (event.type === "pointercancel") { 4759 sawPressWhileOpenRef.current = false; 4760 } 4761 if (!pressStartedInsideRef.current) { 4762 return; 4763 } 4764 const pressStartedInsideDefaultPrevented = pressStartPreventedRef.current; 4765 resetPressStartState(); 4766 if (getOutsidePressEvent() !== "intentional") { 4767 return; 4768 } 4769 if (event.type === "pointercancel") { 4770 if (pressStartedInsideDefaultPrevented) { 4771 suppressImmediateOutsideClickAfterPreventedStart(); 4772 } 4773 return; 4774 } 4775 if (isEventWithinFloatingTree(event)) { 4776 return; 4777 } 4778 if (pressStartedInsideDefaultPrevented) { 4779 suppressImmediateOutsideClickAfterPreventedStart(); 4780 return; 4781 } 4782 if (typeof outsidePress2 === "function" && !outsidePress2(event)) { 4783 return; 4784 } 4785 preventedPressSuppressionTimeout.clear(); 4786 suppressNextOutsideClickRef.current = true; 4787 clearInsideReactTree(); 4788 } 4789 function handleTouchMove(event) { 4790 if (getOutsidePressEvent() !== "sloppy" || !touchStateRef.current || isEventWithinOwnElements(event)) { 4791 return; 4792 } 4793 const touch = event.touches[0]; 4794 if (!touch) { 4795 return; 4796 } 4797 const deltaX = Math.abs(touch.clientX - touchStateRef.current.startX); 4798 const deltaY = Math.abs(touch.clientY - touchStateRef.current.startY); 4799 const distance = Math.sqrt(deltaX * deltaX + deltaY * deltaY); 4800 if (distance > 5) { 4801 touchStateRef.current.dismissOnTouchEnd = true; 4802 } 4803 if (distance > 10) { 4804 closeOnPressOutside(event); 4805 cancelDismissOnEndTimeout.clear(); 4806 touchStateRef.current = null; 4807 } 4808 } 4809 function handleTouchMoveCapture(event) { 4810 addTargetEventListenerOnce(event, handleTouchMove); 4811 } 4812 function handleTouchEnd(event) { 4813 if (getOutsidePressEvent() !== "sloppy" || !touchStateRef.current || isEventWithinOwnElements(event)) { 4814 return; 4815 } 4816 if (touchStateRef.current.dismissOnTouchEnd) { 4817 closeOnPressOutside(event); 4818 } 4819 cancelDismissOnEndTimeout.clear(); 4820 touchStateRef.current = null; 4821 } 4822 function handleTouchEndCapture(event) { 4823 addTargetEventListenerOnce(event, handleTouchEnd); 4824 } 4825 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, { 4826 capture: true, 4827 passive: true 4828 }), addEventListener(doc, "touchmove", handleTouchMoveCapture, { 4829 capture: true, 4830 passive: true 4831 }), addEventListener(doc, "touchend", handleTouchEndCapture, { 4832 capture: true, 4833 passive: true 4834 }))); 4835 return () => { 4836 unsubscribe(); 4837 compositionTimeout.clear(); 4838 preventedPressSuppressionTimeout.clear(); 4839 resetPressStartState(); 4840 suppressNextOutsideClickRef.current = false; 4841 clearInsideReactTree(); 4842 }; 4843 }, [dataRef, floatingElement, escapeKey2, outsidePressEnabled, outsidePress2, open3, enabled, escapeKeyBubbles, outsidePressBubbles, closeOnEscapeKeyDown, clearInsideReactTree, getOutsidePressEventProp, hasBlockingChild, isEventWithinOwnElements, tree, store3, cancelDismissOnEndTimeout]); 4844 const reference = React23.useMemo(() => ({ 4845 onKeyDown: closeOnEscapeKeyDown, 4846 onPointerDown: closeOnReferencePress, 4847 onClick: closeOnReferencePress 4848 }), [closeOnEscapeKeyDown, closeOnReferencePress]); 4849 const floating = React23.useMemo(() => ({ 4850 onKeyDown: closeOnEscapeKeyDown, 4851 // `onMouseDown` may be blocked if `event.preventDefault()` is called in 4852 // `onPointerDown`, such as with <NumberField.ScrubArea>. 4853 // See https://github.com/mui/base-ui/pull/3379 4854 onPointerDown: markInsidePressStartPrevented, 4855 onMouseDown: markInsidePressStartPrevented, 4856 onClickCapture: markInsideReactTree, 4857 onMouseDownCapture(event) { 4858 markInsideReactTree(); 4859 markPressStartedInsideReactTree(event); 4860 }, 4861 onPointerDownCapture(event) { 4862 markInsideReactTree(); 4863 markPressStartedInsideReactTree(event); 4864 }, 4865 onMouseUpCapture: markInsideReactTree, 4866 onTouchEndCapture: markInsideReactTree, 4867 onTouchMoveCapture: markInsideReactTree 4868 }), [closeOnEscapeKeyDown, markInsideReactTree, markPressStartedInsideReactTree, markInsidePressStartPrevented]); 4869 return React23.useMemo(() => enabled ? { 4870 reference, 4871 floating, 4872 trigger: reference 4873 } : {}, [enabled, reference, floating]); 4874 } 4875 4876 // node_modules/@base-ui/react/floating-ui-react/hooks/useFloating.mjs 4877 var React31 = __toESM(require_react(), 1); 4878 4879 // node_modules/@floating-ui/core/dist/floating-ui.core.mjs 4880 function computeCoordsFromPlacement(_ref, placement, rtl) { 4881 let { 4882 reference, 4883 floating 4884 } = _ref; 4885 const sideAxis = getSideAxis(placement); 4886 const alignmentAxis = getAlignmentAxis(placement); 4887 const alignLength = getAxisLength(alignmentAxis); 4888 const side = getSide(placement); 4889 const isVertical = sideAxis === "y"; 4890 const commonX = reference.x + reference.width / 2 - floating.width / 2; 4891 const commonY = reference.y + reference.height / 2 - floating.height / 2; 4892 const commonAlign = reference[alignLength] / 2 - floating[alignLength] / 2; 4893 let coords; 4894 switch (side) { 4895 case "top": 4896 coords = { 4897 x: commonX, 4898 y: reference.y - floating.height 4899 }; 4900 break; 4901 case "bottom": 4902 coords = { 4903 x: commonX, 4904 y: reference.y + reference.height 4905 }; 4906 break; 4907 case "right": 4908 coords = { 4909 x: reference.x + reference.width, 4910 y: commonY 4911 }; 4912 break; 4913 case "left": 4914 coords = { 4915 x: reference.x - floating.width, 4916 y: commonY 4917 }; 4918 break; 4919 default: 4920 coords = { 4921 x: reference.x, 4922 y: reference.y 4923 }; 4924 } 4925 const alignment = getAlignment(placement); 4926 if (alignment) { 4927 coords[alignmentAxis] += commonAlign * (alignment === "end" ? 1 : -1) * (rtl && isVertical ? -1 : 1); 4928 } 4929 return coords; 4930 } 4931 async function detectOverflow(state, options) { 4932 var _await$platform$isEle; 4933 if (options === void 0) { 4934 options = {}; 4935 } 4936 const { 4937 x, 4938 y, 4939 platform: platform3, 4940 rects, 4941 elements, 4942 strategy 4943 } = state; 4944 const { 4945 boundary = "clippingAncestors", 4946 rootBoundary = "viewport", 4947 elementContext = "floating", 4948 altBoundary = false, 4949 padding = 0 4950 } = evaluate(options, state); 4951 const paddingObject = getPaddingObject(padding); 4952 const altContext = elementContext === "floating" ? "reference" : "floating"; 4953 const element = elements[altBoundary ? altContext : elementContext]; 4954 const clippingClientRect = rectToClientRect(await platform3.getClippingRect({ 4955 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)), 4956 boundary, 4957 rootBoundary, 4958 strategy 4959 })); 4960 const rect = elementContext === "floating" ? { 4961 x, 4962 y, 4963 width: rects.floating.width, 4964 height: rects.floating.height 4965 } : rects.reference; 4966 const offsetParent = await (platform3.getOffsetParent == null ? void 0 : platform3.getOffsetParent(elements.floating)); 4967 const offsetScale = await (platform3.isElement == null ? void 0 : platform3.isElement(offsetParent)) && await (platform3.getScale == null ? void 0 : platform3.getScale(offsetParent)) || { 4968 x: 1, 4969 y: 1 4970 }; 4971 const elementClientRect = rectToClientRect(platform3.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform3.convertOffsetParentRelativeRectToViewportRelativeRect({ 4972 elements, 4973 rect, 4974 offsetParent, 4975 strategy 4976 }) : rect); 4977 return { 4978 top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y, 4979 bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y, 4980 left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x, 4981 right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x 4982 }; 4983 } 4984 var MAX_RESET_COUNT = 50; 4985 var computePosition = async (reference, floating, config) => { 4986 const { 4987 placement = "bottom", 4988 strategy = "absolute", 4989 middleware = [], 4990 platform: platform3 4991 } = config; 4992 const platformWithDetectOverflow = platform3.detectOverflow ? platform3 : { 4993 ...platform3, 4994 detectOverflow 4995 }; 4996 const rtl = await (platform3.isRTL == null ? void 0 : platform3.isRTL(floating)); 4997 let rects = await platform3.getElementRects({ 4998 reference, 4999 floating, 5000 strategy 5001 }); 5002 let { 5003 x, 5004 y 5005 } = computeCoordsFromPlacement(rects, placement, rtl); 5006 let statefulPlacement = placement; 5007 let resetCount = 0; 5008 const middlewareData = {}; 5009 for (let i = 0; i < middleware.length; i++) { 5010 const currentMiddleware = middleware[i]; 5011 if (!currentMiddleware) { 5012 continue; 5013 } 5014 const { 5015 name: name2, 5016 fn 5017 } = currentMiddleware; 5018 const { 5019 x: nextX, 5020 y: nextY, 5021 data, 5022 reset 5023 } = await fn({ 5024 x, 5025 y, 5026 initialPlacement: placement, 5027 placement: statefulPlacement, 5028 strategy, 5029 middlewareData, 5030 rects, 5031 platform: platformWithDetectOverflow, 5032 elements: { 5033 reference, 5034 floating 5035 } 5036 }); 5037 x = nextX != null ? nextX : x; 5038 y = nextY != null ? nextY : y; 5039 middlewareData[name2] = { 5040 ...middlewareData[name2], 5041 ...data 5042 }; 5043 if (reset && resetCount < MAX_RESET_COUNT) { 5044 resetCount++; 5045 if (typeof reset === "object") { 5046 if (reset.placement) { 5047 statefulPlacement = reset.placement; 5048 } 5049 if (reset.rects) { 5050 rects = reset.rects === true ? await platform3.getElementRects({ 5051 reference, 5052 floating, 5053 strategy 5054 }) : reset.rects; 5055 } 5056 ({ 5057 x, 5058 y 5059 } = computeCoordsFromPlacement(rects, statefulPlacement, rtl)); 5060 } 5061 i = -1; 5062 } 5063 } 5064 return { 5065 x, 5066 y, 5067 placement: statefulPlacement, 5068 strategy, 5069 middlewareData 5070 }; 5071 }; 5072 var flip = function(options) { 5073 if (options === void 0) { 5074 options = {}; 5075 } 5076 return { 5077 name: "flip", 5078 options, 5079 async fn(state) { 5080 var _middlewareData$arrow, _middlewareData$flip; 5081 const { 5082 placement, 5083 middlewareData, 5084 rects, 5085 initialPlacement, 5086 platform: platform3, 5087 elements 5088 } = state; 5089 const { 5090 mainAxis: checkMainAxis = true, 5091 crossAxis: checkCrossAxis = true, 5092 fallbackPlacements: specifiedFallbackPlacements, 5093 fallbackStrategy = "bestFit", 5094 fallbackAxisSideDirection = "none", 5095 flipAlignment = true, 5096 ...detectOverflowOptions 5097 } = evaluate(options, state); 5098 if ((_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) { 5099 return {}; 5100 } 5101 const side = getSide(placement); 5102 const initialSideAxis = getSideAxis(initialPlacement); 5103 const isBasePlacement = getSide(initialPlacement) === initialPlacement; 5104 const rtl = await (platform3.isRTL == null ? void 0 : platform3.isRTL(elements.floating)); 5105 const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement)); 5106 const hasFallbackAxisSideDirection = fallbackAxisSideDirection !== "none"; 5107 if (!specifiedFallbackPlacements && hasFallbackAxisSideDirection) { 5108 fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl)); 5109 } 5110 const placements2 = [initialPlacement, ...fallbackPlacements]; 5111 const overflow = await platform3.detectOverflow(state, detectOverflowOptions); 5112 const overflows = []; 5113 let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || []; 5114 if (checkMainAxis) { 5115 overflows.push(overflow[side]); 5116 } 5117 if (checkCrossAxis) { 5118 const sides2 = getAlignmentSides(placement, rects, rtl); 5119 overflows.push(overflow[sides2[0]], overflow[sides2[1]]); 5120 } 5121 overflowsData = [...overflowsData, { 5122 placement, 5123 overflows 5124 }]; 5125 if (!overflows.every((side2) => side2 <= 0)) { 5126 var _middlewareData$flip2, _overflowsData$filter; 5127 const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1; 5128 const nextPlacement = placements2[nextIndex]; 5129 if (nextPlacement) { 5130 const ignoreCrossAxisOverflow = checkCrossAxis === "alignment" ? initialSideAxis !== getSideAxis(nextPlacement) : false; 5131 if (!ignoreCrossAxisOverflow || // We leave the current main axis only if every placement on that axis 5132 // overflows the main axis. 5133 overflowsData.every((d) => getSideAxis(d.placement) === initialSideAxis ? d.overflows[0] > 0 : true)) { 5134 return { 5135 data: { 5136 index: nextIndex, 5137 overflows: overflowsData 5138 }, 5139 reset: { 5140 placement: nextPlacement 5141 } 5142 }; 5143 } 5144 } 5145 let resetPlacement = (_overflowsData$filter = overflowsData.filter((d) => d.overflows[0] <= 0).sort((a, b) => a.overflows[1] - b.overflows[1])[0]) == null ? void 0 : _overflowsData$filter.placement; 5146 if (!resetPlacement) { 5147 switch (fallbackStrategy) { 5148 case "bestFit": { 5149 var _overflowsData$filter2; 5150 const placement2 = (_overflowsData$filter2 = overflowsData.filter((d) => { 5151 if (hasFallbackAxisSideDirection) { 5152 const currentSideAxis = getSideAxis(d.placement); 5153 return currentSideAxis === initialSideAxis || // Create a bias to the `y` side axis due to horizontal 5154 // reading directions favoring greater width. 5155 currentSideAxis === "y"; 5156 } 5157 return true; 5158 }).map((d) => [d.placement, d.overflows.filter((overflow2) => overflow2 > 0).reduce((acc, overflow2) => acc + overflow2, 0)]).sort((a, b) => a[1] - b[1])[0]) == null ? void 0 : _overflowsData$filter2[0]; 5159 if (placement2) { 5160 resetPlacement = placement2; 5161 } 5162 break; 5163 } 5164 case "initialPlacement": 5165 resetPlacement = initialPlacement; 5166 break; 5167 } 5168 } 5169 if (placement !== resetPlacement) { 5170 return { 5171 reset: { 5172 placement: resetPlacement 5173 } 5174 }; 5175 } 5176 } 5177 return {}; 5178 } 5179 }; 5180 }; 5181 var originSides = /* @__PURE__ */ new Set(["left", "top"]); 5182 async function convertValueToCoords(state, options) { 5183 const { 5184 placement, 5185 platform: platform3, 5186 elements 5187 } = state; 5188 const rtl = await (platform3.isRTL == null ? void 0 : platform3.isRTL(elements.floating)); 5189 const side = getSide(placement); 5190 const alignment = getAlignment(placement); 5191 const isVertical = getSideAxis(placement) === "y"; 5192 const mainAxisMulti = originSides.has(side) ? -1 : 1; 5193 const crossAxisMulti = rtl && isVertical ? -1 : 1; 5194 const rawValue = evaluate(options, state); 5195 let { 5196 mainAxis, 5197 crossAxis, 5198 alignmentAxis 5199 } = typeof rawValue === "number" ? { 5200 mainAxis: rawValue, 5201 crossAxis: 0, 5202 alignmentAxis: null 5203 } : { 5204 mainAxis: rawValue.mainAxis || 0, 5205 crossAxis: rawValue.crossAxis || 0, 5206 alignmentAxis: rawValue.alignmentAxis 5207 }; 5208 if (alignment && typeof alignmentAxis === "number") { 5209 crossAxis = alignment === "end" ? alignmentAxis * -1 : alignmentAxis; 5210 } 5211 return isVertical ? { 5212 x: crossAxis * crossAxisMulti, 5213 y: mainAxis * mainAxisMulti 5214 } : { 5215 x: mainAxis * mainAxisMulti, 5216 y: crossAxis * crossAxisMulti 5217 }; 5218 } 5219 var offset = function(options) { 5220 if (options === void 0) { 5221 options = 0; 5222 } 5223 return { 5224 name: "offset", 5225 options, 5226 async fn(state) { 5227 var _middlewareData$offse, _middlewareData$arrow; 5228 const { 5229 x, 5230 y, 5231 placement, 5232 middlewareData 5233 } = state; 5234 const diffCoords = await convertValueToCoords(state, options); 5235 if (placement === ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse.placement) && (_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) { 5236 return {}; 5237 } 5238 return { 5239 x: x + diffCoords.x, 5240 y: y + diffCoords.y, 5241 data: { 5242 ...diffCoords, 5243 placement 5244 } 5245 }; 5246 } 5247 }; 5248 }; 5249 var shift = function(options) { 5250 if (options === void 0) { 5251 options = {}; 5252 } 5253 return { 5254 name: "shift", 5255 options, 5256 async fn(state) { 5257 const { 5258 x, 5259 y, 5260 placement, 5261 platform: platform3 5262 } = state; 5263 const { 5264 mainAxis: checkMainAxis = true, 5265 crossAxis: checkCrossAxis = false, 5266 limiter = { 5267 fn: (_ref) => { 5268 let { 5269 x: x2, 5270 y: y2 5271 } = _ref; 5272 return { 5273 x: x2, 5274 y: y2 5275 }; 5276 } 5277 }, 5278 ...detectOverflowOptions 5279 } = evaluate(options, state); 5280 const coords = { 5281 x, 5282 y 5283 }; 5284 const overflow = await platform3.detectOverflow(state, detectOverflowOptions); 5285 const crossAxis = getSideAxis(placement); 5286 const mainAxis = getOppositeAxis(crossAxis); 5287 let mainAxisCoord = coords[mainAxis]; 5288 let crossAxisCoord = coords[crossAxis]; 5289 const clampCoord = (axis, coord) => clamp(coord + overflow[axis === "y" ? "top" : "left"], coord, coord - overflow[axis === "y" ? "bottom" : "right"]); 5290 if (checkMainAxis) { 5291 mainAxisCoord = clampCoord(mainAxis, mainAxisCoord); 5292 } 5293 if (checkCrossAxis) { 5294 crossAxisCoord = clampCoord(crossAxis, crossAxisCoord); 5295 } 5296 const limitedCoords = limiter.fn({ 5297 ...state, 5298 [mainAxis]: mainAxisCoord, 5299 [crossAxis]: crossAxisCoord 5300 }); 5301 return { 5302 ...limitedCoords, 5303 data: { 5304 x: limitedCoords.x - x, 5305 y: limitedCoords.y - y, 5306 enabled: { 5307 [mainAxis]: checkMainAxis, 5308 [crossAxis]: checkCrossAxis 5309 } 5310 } 5311 }; 5312 } 5313 }; 5314 }; 5315 var limitShift = function(options) { 5316 if (options === void 0) { 5317 options = {}; 5318 } 5319 return { 5320 options, 5321 fn(state) { 5322 var _rawOffset$mainAxis, _rawOffset$crossAxis; 5323 const { 5324 x, 5325 y, 5326 placement, 5327 rects, 5328 middlewareData 5329 } = state; 5330 const { 5331 offset: offset4 = 0, 5332 mainAxis: checkMainAxis = true, 5333 crossAxis: checkCrossAxis = true 5334 } = evaluate(options, state); 5335 const coords = { 5336 x, 5337 y 5338 }; 5339 const crossAxis = getSideAxis(placement); 5340 const mainAxis = getOppositeAxis(crossAxis); 5341 let mainAxisCoord = coords[mainAxis]; 5342 let crossAxisCoord = coords[crossAxis]; 5343 const rawOffset = evaluate(offset4, state); 5344 const computedOffset = typeof rawOffset === "number" ? { 5345 mainAxis: rawOffset, 5346 crossAxis: 0 5347 } : { 5348 mainAxis: (_rawOffset$mainAxis = rawOffset.mainAxis) != null ? _rawOffset$mainAxis : 0, 5349 crossAxis: (_rawOffset$crossAxis = rawOffset.crossAxis) != null ? _rawOffset$crossAxis : 0 5350 }; 5351 if (checkMainAxis) { 5352 const len = mainAxis === "y" ? "height" : "width"; 5353 const limitMin = rects.reference[mainAxis] - rects.floating[len] + computedOffset.mainAxis; 5354 const limitMax = rects.reference[mainAxis] + rects.reference[len] - computedOffset.mainAxis; 5355 if (mainAxisCoord < limitMin) { 5356 mainAxisCoord = limitMin; 5357 } else if (mainAxisCoord > limitMax) { 5358 mainAxisCoord = limitMax; 5359 } 5360 } 5361 if (checkCrossAxis) { 5362 var _middlewareData$offse, _middlewareData$offse2; 5363 const len = mainAxis === "y" ? "width" : "height"; 5364 const isOriginSide = originSides.has(getSide(placement)); 5365 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); 5366 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); 5367 if (crossAxisCoord < limitMin) { 5368 crossAxisCoord = limitMin; 5369 } else if (crossAxisCoord > limitMax) { 5370 crossAxisCoord = limitMax; 5371 } 5372 } 5373 return { 5374 [mainAxis]: mainAxisCoord, 5375 [crossAxis]: crossAxisCoord 5376 }; 5377 } 5378 }; 5379 }; 5380 var size = function(options) { 5381 if (options === void 0) { 5382 options = {}; 5383 } 5384 return { 5385 name: "size", 5386 options, 5387 async fn(state) { 5388 const { 5389 placement, 5390 rects, 5391 platform: platform3, 5392 elements 5393 } = state; 5394 const { 5395 apply = () => { 5396 }, 5397 ...detectOverflowOptions 5398 } = evaluate(options, state); 5399 const overflow = await platform3.detectOverflow(state, detectOverflowOptions); 5400 const side = getSide(placement); 5401 const alignment = getAlignment(placement); 5402 const isYAxis = getSideAxis(placement) === "y"; 5403 const { 5404 width, 5405 height 5406 } = rects.floating; 5407 let heightSide; 5408 let widthSide; 5409 if (side === "top" || side === "bottom") { 5410 heightSide = side; 5411 widthSide = alignment === (await (platform3.isRTL == null ? void 0 : platform3.isRTL(elements.floating)) ? "start" : "end") ? "left" : "right"; 5412 } else { 5413 widthSide = side; 5414 heightSide = alignment === "end" ? "top" : "bottom"; 5415 } 5416 const maximumClippingHeight = height - overflow.top - overflow.bottom; 5417 const maximumClippingWidth = width - overflow.left - overflow.right; 5418 const overflowAvailableHeight = min(height - overflow[heightSide], maximumClippingHeight); 5419 const overflowAvailableWidth = min(width - overflow[widthSide], maximumClippingWidth); 5420 const shiftData = state.middlewareData.shift; 5421 const noShift = !shiftData; 5422 let availableHeight2 = overflowAvailableHeight; 5423 let availableWidth2 = overflowAvailableWidth; 5424 if (shiftData != null && shiftData.enabled.x) { 5425 availableWidth2 = maximumClippingWidth; 5426 } 5427 if (shiftData != null && shiftData.enabled.y) { 5428 availableHeight2 = maximumClippingHeight; 5429 } 5430 if (noShift && !alignment) { 5431 if (isYAxis) { 5432 availableWidth2 = width - 2 * max(overflow.left, overflow.right); 5433 } else { 5434 availableHeight2 = height - 2 * max(overflow.top, overflow.bottom); 5435 } 5436 } 5437 await apply({ 5438 ...state, 5439 availableWidth: availableWidth2, 5440 availableHeight: availableHeight2 5441 }); 5442 const nextDimensions = await platform3.getDimensions(elements.floating); 5443 if (width !== nextDimensions.width || height !== nextDimensions.height) { 5444 return { 5445 reset: { 5446 rects: true 5447 } 5448 }; 5449 } 5450 return {}; 5451 } 5452 }; 5453 }; 5454 5455 // node_modules/@floating-ui/dom/dist/floating-ui.dom.mjs 5456 function getCssDimensions(element) { 5457 const css = getComputedStyle2(element); 5458 let width = parseFloat(css.width) || 0; 5459 let height = parseFloat(css.height) || 0; 5460 const hasOffset = isHTMLElement(element); 5461 const offsetWidth = hasOffset ? element.offsetWidth : width; 5462 const offsetHeight = hasOffset ? element.offsetHeight : height; 5463 const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight; 5464 if (shouldFallback) { 5465 width = offsetWidth; 5466 height = offsetHeight; 5467 } 5468 return { 5469 width, 5470 height, 5471 $: shouldFallback 5472 }; 5473 } 5474 function unwrapElement(element) { 5475 return !isElement(element) ? element.contextElement : element; 5476 } 5477 function getScale(element) { 5478 const domElement = unwrapElement(element); 5479 if (!isHTMLElement(domElement)) { 5480 return createCoords(1); 5481 } 5482 const rect = domElement.getBoundingClientRect(); 5483 const { 5484 width, 5485 height, 5486 $ 5487 } = getCssDimensions(domElement); 5488 let x = ($ ? round(rect.width) : rect.width) / width; 5489 let y = ($ ? round(rect.height) : rect.height) / height; 5490 if (!x || !Number.isFinite(x)) { 5491 x = 1; 5492 } 5493 if (!y || !Number.isFinite(y)) { 5494 y = 1; 5495 } 5496 return { 5497 x, 5498 y 5499 }; 5500 } 5501 var noOffsets = /* @__PURE__ */ createCoords(0); 5502 function getVisualOffsets(element) { 5503 const win = getWindow(element); 5504 if (!isWebKit() || !win.visualViewport) { 5505 return noOffsets; 5506 } 5507 return { 5508 x: win.visualViewport.offsetLeft, 5509 y: win.visualViewport.offsetTop 5510 }; 5511 } 5512 function shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) { 5513 if (isFixed === void 0) { 5514 isFixed = false; 5515 } 5516 return !!floatingOffsetParent && isFixed && floatingOffsetParent === getWindow(element); 5517 } 5518 function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) { 5519 if (includeScale === void 0) { 5520 includeScale = false; 5521 } 5522 if (isFixedStrategy === void 0) { 5523 isFixedStrategy = false; 5524 } 5525 const clientRect = element.getBoundingClientRect(); 5526 const domElement = unwrapElement(element); 5527 let scale = createCoords(1); 5528 if (includeScale) { 5529 if (offsetParent) { 5530 if (isElement(offsetParent)) { 5531 scale = getScale(offsetParent); 5532 } 5533 } else { 5534 scale = getScale(element); 5535 } 5536 } 5537 const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : createCoords(0); 5538 let x = (clientRect.left + visualOffsets.x) / scale.x; 5539 let y = (clientRect.top + visualOffsets.y) / scale.y; 5540 let width = clientRect.width / scale.x; 5541 let height = clientRect.height / scale.y; 5542 if (domElement && offsetParent) { 5543 const win = getWindow(domElement); 5544 const offsetWin = isElement(offsetParent) ? getWindow(offsetParent) : offsetParent; 5545 let currentWin = win; 5546 let currentIFrame = getFrameElement(currentWin); 5547 while (currentIFrame && offsetWin !== currentWin) { 5548 const iframeScale = getScale(currentIFrame); 5549 const iframeRect = currentIFrame.getBoundingClientRect(); 5550 const css = getComputedStyle2(currentIFrame); 5551 const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x; 5552 const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y; 5553 x *= iframeScale.x; 5554 y *= iframeScale.y; 5555 width *= iframeScale.x; 5556 height *= iframeScale.y; 5557 x += left; 5558 y += top; 5559 currentWin = getWindow(currentIFrame); 5560 currentIFrame = getFrameElement(currentWin); 5561 } 5562 } 5563 return rectToClientRect({ 5564 width, 5565 height, 5566 x, 5567 y 5568 }); 5569 } 5570 function getWindowScrollBarX(element, rect) { 5571 const leftScroll = getNodeScroll(element).scrollLeft; 5572 if (!rect) { 5573 return getBoundingClientRect(getDocumentElement(element)).left + leftScroll; 5574 } 5575 return rect.left + leftScroll; 5576 } 5577 function getHTMLOffset(documentElement, scroll) { 5578 const htmlRect = documentElement.getBoundingClientRect(); 5579 const x = htmlRect.left + scroll.scrollLeft - getWindowScrollBarX(documentElement, htmlRect); 5580 const y = htmlRect.top + scroll.scrollTop; 5581 return { 5582 x, 5583 y 5584 }; 5585 } 5586 function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) { 5587 let { 5588 elements, 5589 rect, 5590 offsetParent, 5591 strategy 5592 } = _ref; 5593 const isFixed = strategy === "fixed"; 5594 const documentElement = getDocumentElement(offsetParent); 5595 const topLayer = elements ? isTopLayer(elements.floating) : false; 5596 if (offsetParent === documentElement || topLayer && isFixed) { 5597 return rect; 5598 } 5599 let scroll = { 5600 scrollLeft: 0, 5601 scrollTop: 0 5602 }; 5603 let scale = createCoords(1); 5604 const offsets = createCoords(0); 5605 const isOffsetParentAnElement = isHTMLElement(offsetParent); 5606 if (isOffsetParentAnElement || !isFixed) { 5607 if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) { 5608 scroll = getNodeScroll(offsetParent); 5609 } 5610 if (isOffsetParentAnElement) { 5611 const offsetRect = getBoundingClientRect(offsetParent); 5612 scale = getScale(offsetParent); 5613 offsets.x = offsetRect.x + offsetParent.clientLeft; 5614 offsets.y = offsetRect.y + offsetParent.clientTop; 5615 } 5616 } 5617 const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0); 5618 return { 5619 width: rect.width * scale.x, 5620 height: rect.height * scale.y, 5621 x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x + htmlOffset.x, 5622 y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y + htmlOffset.y 5623 }; 5624 } 5625 function getClientRects(element) { 5626 return element.getClientRects ? Array.from(element.getClientRects()) : []; 5627 } 5628 function getDocumentRect(html) { 5629 const scroll = getNodeScroll(html); 5630 const body = html.ownerDocument.body; 5631 const width = max(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth); 5632 const height = max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight); 5633 let x = -scroll.scrollLeft + getWindowScrollBarX(html); 5634 const y = -scroll.scrollTop; 5635 if (getComputedStyle2(body).direction === "rtl") { 5636 x += max(html.clientWidth, body.clientWidth) - width; 5637 } 5638 return { 5639 width, 5640 height, 5641 x, 5642 y 5643 }; 5644 } 5645 var SCROLLBAR_MAX = 25; 5646 function getViewportRect(element, strategy, rootBoundary) { 5647 if (rootBoundary === void 0) { 5648 rootBoundary = "viewport"; 5649 } 5650 const isLayoutViewport = rootBoundary === "layoutViewport"; 5651 const win = getWindow(element); 5652 const html = getDocumentElement(element); 5653 const visualViewport = win.visualViewport; 5654 let width = html.clientWidth; 5655 let height = html.clientHeight; 5656 let x = 0; 5657 let y = 0; 5658 if (visualViewport) { 5659 const layoutRelativeClientCoords = !isWebKit() || strategy === "fixed"; 5660 if (isLayoutViewport) { 5661 if (!layoutRelativeClientCoords) { 5662 x = -visualViewport.offsetLeft; 5663 y = -visualViewport.offsetTop; 5664 } 5665 } else { 5666 width = visualViewport.width; 5667 height = visualViewport.height; 5668 if (layoutRelativeClientCoords) { 5669 x = visualViewport.offsetLeft; 5670 y = visualViewport.offsetTop; 5671 } 5672 } 5673 } 5674 const windowScrollbarX = getWindowScrollBarX(html); 5675 if (windowScrollbarX <= 0) { 5676 const doc = html.ownerDocument; 5677 const body = doc.body; 5678 const bodyStyles = getComputedStyle(body); 5679 const bodyMarginInline = doc.compatMode === "CSS1Compat" ? parseFloat(bodyStyles.marginLeft) + parseFloat(bodyStyles.marginRight) || 0 : 0; 5680 const reservedWidth = Math.abs(html.clientWidth - body.clientWidth - bodyMarginInline); 5681 const gutter = getComputedStyle(html).scrollbarGutter === "stable both-edges" ? reservedWidth / 2 : reservedWidth; 5682 if (gutter <= SCROLLBAR_MAX) { 5683 width -= gutter; 5684 } 5685 } 5686 return { 5687 width, 5688 height, 5689 x, 5690 y 5691 }; 5692 } 5693 function getInnerBoundingClientRect(element, strategy) { 5694 const clientRect = getBoundingClientRect(element, true, strategy === "fixed"); 5695 const top = clientRect.top + element.clientTop; 5696 const left = clientRect.left + element.clientLeft; 5697 const scale = getScale(element); 5698 const width = element.clientWidth * scale.x; 5699 const height = element.clientHeight * scale.y; 5700 const x = left * scale.x; 5701 const y = top * scale.y; 5702 return { 5703 width, 5704 height, 5705 x, 5706 y 5707 }; 5708 } 5709 function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) { 5710 let rect; 5711 if (clippingAncestor === "viewport" || clippingAncestor === "layoutViewport") { 5712 rect = getViewportRect(element, strategy, clippingAncestor); 5713 } else if (clippingAncestor === "document") { 5714 rect = getDocumentRect(getDocumentElement(element)); 5715 } else if (isElement(clippingAncestor)) { 5716 rect = getInnerBoundingClientRect(clippingAncestor, strategy); 5717 } else { 5718 const visualOffsets = getVisualOffsets(element); 5719 rect = { 5720 x: clippingAncestor.x - visualOffsets.x, 5721 y: clippingAncestor.y - visualOffsets.y, 5722 width: clippingAncestor.width, 5723 height: clippingAncestor.height 5724 }; 5725 } 5726 return rectToClientRect(rect); 5727 } 5728 function getClippingElementAncestors(element, cache) { 5729 const cachedResult = cache.get(element); 5730 if (cachedResult) { 5731 return cachedResult; 5732 } 5733 let result = getOverflowAncestors(element, [], false).filter((el) => isElement(el) && getNodeName(el) !== "body"); 5734 let lastKeptComputedStyle = null; 5735 const elementIsFixed = getComputedStyle2(element).position === "fixed"; 5736 let currentNode = elementIsFixed ? getParentNode(element) : element; 5737 while (isElement(currentNode) && !isLastTraversableNode(currentNode)) { 5738 const computedStyle = getComputedStyle2(currentNode); 5739 const currentNodeIsContaining = isContainingBlock(currentNode); 5740 const lastPosition = lastKeptComputedStyle ? lastKeptComputedStyle.position : elementIsFixed ? "fixed" : ""; 5741 const shouldDropCurrentNode = !currentNodeIsContaining && (lastPosition === "fixed" || lastPosition === "absolute" && computedStyle.position === "static"); 5742 if (shouldDropCurrentNode) { 5743 result = result.filter((ancestor) => ancestor !== currentNode); 5744 } else { 5745 lastKeptComputedStyle = computedStyle; 5746 } 5747 currentNode = getParentNode(currentNode); 5748 } 5749 cache.set(element, result); 5750 return result; 5751 } 5752 function getClippingRect(_ref) { 5753 let { 5754 element, 5755 boundary, 5756 rootBoundary, 5757 strategy 5758 } = _ref; 5759 const elementClippingAncestors = boundary === "clippingAncestors" ? isTopLayer(element) ? [] : getClippingElementAncestors(element, this._c) : [].concat(boundary); 5760 const clippingAncestors = [...elementClippingAncestors, rootBoundary]; 5761 const firstRect = getClientRectFromClippingAncestor(element, clippingAncestors[0], strategy); 5762 let top = firstRect.top; 5763 let right = firstRect.right; 5764 let bottom = firstRect.bottom; 5765 let left = firstRect.left; 5766 for (let i = 1; i < clippingAncestors.length; i++) { 5767 const rect = getClientRectFromClippingAncestor(element, clippingAncestors[i], strategy); 5768 top = max(rect.top, top); 5769 right = min(rect.right, right); 5770 bottom = min(rect.bottom, bottom); 5771 left = max(rect.left, left); 5772 } 5773 return { 5774 width: right - left, 5775 height: bottom - top, 5776 x: left, 5777 y: top 5778 }; 5779 } 5780 function getDimensions2(element) { 5781 const { 5782 width, 5783 height 5784 } = getCssDimensions(element); 5785 return { 5786 width, 5787 height 5788 }; 5789 } 5790 function getRectRelativeToOffsetParent(element, offsetParent, strategy) { 5791 const isOffsetParentAnElement = isHTMLElement(offsetParent); 5792 const documentElement = getDocumentElement(offsetParent); 5793 const isFixed = strategy === "fixed"; 5794 const rect = getBoundingClientRect(element, true, isFixed, offsetParent); 5795 let scroll = { 5796 scrollLeft: 0, 5797 scrollTop: 0 5798 }; 5799 const offsets = createCoords(0); 5800 if (isOffsetParentAnElement || !isFixed) { 5801 if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) { 5802 scroll = getNodeScroll(offsetParent); 5803 } 5804 if (isOffsetParentAnElement) { 5805 const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent); 5806 offsets.x = offsetRect.x + offsetParent.clientLeft; 5807 offsets.y = offsetRect.y + offsetParent.clientTop; 5808 } 5809 } 5810 if (!isOffsetParentAnElement && documentElement) { 5811 offsets.x = getWindowScrollBarX(documentElement); 5812 } 5813 const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0); 5814 const x = rect.left + scroll.scrollLeft - offsets.x - htmlOffset.x; 5815 const y = rect.top + scroll.scrollTop - offsets.y - htmlOffset.y; 5816 return { 5817 x, 5818 y, 5819 width: rect.width, 5820 height: rect.height 5821 }; 5822 } 5823 function isStaticPositioned(element) { 5824 return getComputedStyle2(element).position === "static"; 5825 } 5826 function getTrueOffsetParent(element, polyfill) { 5827 if (!isHTMLElement(element) || getComputedStyle2(element).position === "fixed") { 5828 return null; 5829 } 5830 if (polyfill) { 5831 return polyfill(element); 5832 } 5833 let rawOffsetParent = element.offsetParent; 5834 if (getDocumentElement(element) === rawOffsetParent) { 5835 rawOffsetParent = rawOffsetParent.ownerDocument.body; 5836 } 5837 return rawOffsetParent; 5838 } 5839 function getOffsetParent(element, polyfill) { 5840 const win = getWindow(element); 5841 if (isTopLayer(element)) { 5842 return win; 5843 } 5844 if (!isHTMLElement(element)) { 5845 let svgOffsetParent = getParentNode(element); 5846 while (svgOffsetParent && !isLastTraversableNode(svgOffsetParent)) { 5847 if (isElement(svgOffsetParent) && !isStaticPositioned(svgOffsetParent)) { 5848 return svgOffsetParent; 5849 } 5850 svgOffsetParent = getParentNode(svgOffsetParent); 5851 } 5852 return win; 5853 } 5854 let offsetParent = getTrueOffsetParent(element, polyfill); 5855 while (offsetParent && isTableElement(offsetParent) && isStaticPositioned(offsetParent)) { 5856 offsetParent = getTrueOffsetParent(offsetParent, polyfill); 5857 } 5858 if (offsetParent && isLastTraversableNode(offsetParent) && isStaticPositioned(offsetParent) && !isContainingBlock(offsetParent)) { 5859 return win; 5860 } 5861 return offsetParent || getContainingBlock(element) || win; 5862 } 5863 var getElementRects = async function(data) { 5864 const getOffsetParentFn = this.getOffsetParent || getOffsetParent; 5865 const getDimensionsFn = this.getDimensions; 5866 const floatingDimensions = await getDimensionsFn(data.floating); 5867 return { 5868 reference: getRectRelativeToOffsetParent(data.reference, await getOffsetParentFn(data.floating), data.strategy), 5869 floating: { 5870 x: 0, 5871 y: 0, 5872 width: floatingDimensions.width, 5873 height: floatingDimensions.height 5874 } 5875 }; 5876 }; 5877 function isRTL(element) { 5878 return getComputedStyle2(element).direction === "rtl"; 5879 } 5880 var platform2 = { 5881 convertOffsetParentRelativeRectToViewportRelativeRect, 5882 getDocumentElement, 5883 getClippingRect, 5884 getOffsetParent, 5885 getElementRects, 5886 getClientRects, 5887 getDimensions: getDimensions2, 5888 getScale, 5889 isElement, 5890 isRTL 5891 }; 5892 function rectsAreEqual(a, b) { 5893 return a.x === b.x && a.y === b.y && a.width === b.width && a.height === b.height; 5894 } 5895 function observeMove(element, onMove, ancestorResize) { 5896 let io = null; 5897 let timeoutId; 5898 const root = getDocumentElement(element); 5899 function cleanup() { 5900 var _io; 5901 clearTimeout(timeoutId); 5902 (_io = io) == null || _io.disconnect(); 5903 io = null; 5904 } 5905 function refresh(skip, threshold) { 5906 if (skip === void 0) { 5907 skip = false; 5908 } 5909 if (threshold === void 0) { 5910 threshold = 1; 5911 } 5912 cleanup(); 5913 const elementRectForRootMargin = element.getBoundingClientRect(); 5914 const { 5915 left, 5916 top, 5917 width, 5918 height 5919 } = elementRectForRootMargin; 5920 if (!skip) { 5921 onMove(); 5922 } 5923 if (!width || !height) { 5924 return; 5925 } 5926 const insetTop = floor(top); 5927 const insetRight = floor(root.clientWidth - (left + width)); 5928 const insetBottom = floor(root.clientHeight - (top + height)); 5929 const insetLeft = floor(left); 5930 const rootMargin = -insetTop + "px " + -insetRight + "px " + -insetBottom + "px " + -insetLeft + "px"; 5931 const options = { 5932 rootMargin, 5933 threshold: max(0, min(1, threshold)) || 1 5934 }; 5935 let isFirstUpdate = true; 5936 function handleObserve(entries) { 5937 const ratio = entries[0].intersectionRatio; 5938 if (!rectsAreEqual(elementRectForRootMargin, element.getBoundingClientRect())) { 5939 return refresh(); 5940 } 5941 if (ratio !== threshold) { 5942 if (!isFirstUpdate) { 5943 return refresh(); 5944 } 5945 if (!ratio) { 5946 timeoutId = setTimeout(() => { 5947 refresh(false, 1e-7); 5948 }, 1e3); 5949 } else { 5950 refresh(false, ratio); 5951 } 5952 } 5953 isFirstUpdate = false; 5954 } 5955 try { 5956 io = new IntersectionObserver(handleObserve, { 5957 ...options, 5958 // Handle <iframe>s 5959 root: root.ownerDocument 5960 }); 5961 } catch (_e) { 5962 io = new IntersectionObserver(handleObserve, options); 5963 } 5964 io.observe(element); 5965 } 5966 const win = getWindow(element); 5967 const handleResize = () => refresh(ancestorResize); 5968 win.addEventListener("resize", handleResize); 5969 refresh(true); 5970 return () => { 5971 win.removeEventListener("resize", handleResize); 5972 cleanup(); 5973 }; 5974 } 5975 function autoUpdate(reference, floating, update2, options) { 5976 if (options === void 0) { 5977 options = {}; 5978 } 5979 const { 5980 ancestorScroll = true, 5981 ancestorResize = true, 5982 elementResize = typeof ResizeObserver === "function", 5983 layoutShift = typeof IntersectionObserver === "function", 5984 animationFrame = false 5985 } = options; 5986 const referenceEl = unwrapElement(reference); 5987 const ancestors = ancestorScroll || ancestorResize ? [...referenceEl ? getOverflowAncestors(referenceEl) : [], ...floating ? getOverflowAncestors(floating) : []] : []; 5988 ancestors.forEach((ancestor) => { 5989 ancestorScroll && ancestor.addEventListener("scroll", update2); 5990 ancestorResize && ancestor.addEventListener("resize", update2); 5991 }); 5992 const cleanupIo = referenceEl && layoutShift ? observeMove(referenceEl, update2, ancestorResize) : null; 5993 let reobserveFrame = -1; 5994 let resizeObserver = null; 5995 if (elementResize) { 5996 resizeObserver = new ResizeObserver((_ref) => { 5997 let [firstEntry] = _ref; 5998 if (firstEntry && firstEntry.target === referenceEl && resizeObserver && floating) { 5999 resizeObserver.unobserve(floating); 6000 cancelAnimationFrame(reobserveFrame); 6001 reobserveFrame = requestAnimationFrame(() => { 6002 var _resizeObserver; 6003 (_resizeObserver = resizeObserver) == null || _resizeObserver.observe(floating); 6004 }); 6005 } 6006 update2(); 6007 }); 6008 if (referenceEl && !animationFrame) { 6009 resizeObserver.observe(referenceEl); 6010 } 6011 if (floating) { 6012 resizeObserver.observe(floating); 6013 } 6014 } 6015 let frameId; 6016 let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null; 6017 if (animationFrame) { 6018 frameLoop(); 6019 } 6020 function frameLoop() { 6021 const nextRefRect = getBoundingClientRect(reference); 6022 if (prevRefRect && !rectsAreEqual(prevRefRect, nextRefRect)) { 6023 update2(); 6024 } 6025 prevRefRect = nextRefRect; 6026 frameId = requestAnimationFrame(frameLoop); 6027 } 6028 update2(); 6029 return () => { 6030 var _resizeObserver2; 6031 ancestors.forEach((ancestor) => { 6032 ancestorScroll && ancestor.removeEventListener("scroll", update2); 6033 ancestorResize && ancestor.removeEventListener("resize", update2); 6034 }); 6035 cleanupIo == null || cleanupIo(); 6036 (_resizeObserver2 = resizeObserver) == null || _resizeObserver2.disconnect(); 6037 resizeObserver = null; 6038 if (animationFrame) { 6039 cancelAnimationFrame(frameId); 6040 } 6041 }; 6042 } 6043 var offset2 = offset; 6044 var shift2 = shift; 6045 var flip2 = flip; 6046 var size2 = size; 6047 var limitShift2 = limitShift; 6048 var computePosition2 = (reference, floating, options) => { 6049 const cache = /* @__PURE__ */ new Map(); 6050 const mergedOptions = options != null ? options : {}; 6051 const platformWithCache = { 6052 ...platform2, 6053 ...mergedOptions.platform, 6054 _c: cache 6055 }; 6056 return computePosition(reference, floating, { 6057 ...mergedOptions, 6058 platform: platformWithCache 6059 }); 6060 }; 6061 6062 // node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.mjs 6063 var React24 = __toESM(require_react(), 1); 6064 var import_react2 = __toESM(require_react(), 1); 6065 var ReactDOM3 = __toESM(require_react_dom(), 1); 6066 var isClient = typeof document !== "undefined"; 6067 var noop2 = function noop3() { 6068 }; 6069 var index = isClient ? import_react2.useLayoutEffect : noop2; 6070 function deepEqual(a, b) { 6071 if (a === b) { 6072 return true; 6073 } 6074 if (typeof a !== typeof b) { 6075 return false; 6076 } 6077 if (typeof a === "function" && a.toString() === b.toString()) { 6078 return true; 6079 } 6080 let length; 6081 let i; 6082 let keys; 6083 if (a && b && typeof a === "object") { 6084 if (Array.isArray(a)) { 6085 length = a.length; 6086 if (length !== b.length) return false; 6087 for (i = length; i-- !== 0; ) { 6088 if (!deepEqual(a[i], b[i])) { 6089 return false; 6090 } 6091 } 6092 return true; 6093 } 6094 keys = Object.keys(a); 6095 length = keys.length; 6096 if (length !== Object.keys(b).length) { 6097 return false; 6098 } 6099 for (i = length; i-- !== 0; ) { 6100 if (!{}.hasOwnProperty.call(b, keys[i])) { 6101 return false; 6102 } 6103 } 6104 for (i = length; i-- !== 0; ) { 6105 const key = keys[i]; 6106 if (key === "_owner" && a.$$typeof) { 6107 continue; 6108 } 6109 if (!deepEqual(a[key], b[key])) { 6110 return false; 6111 } 6112 } 6113 return true; 6114 } 6115 return a !== a && b !== b; 6116 } 6117 function getDPR(element) { 6118 if (typeof window === "undefined") { 6119 return 1; 6120 } 6121 const win = element.ownerDocument.defaultView || window; 6122 return win.devicePixelRatio || 1; 6123 } 6124 function roundByDPR(element, value) { 6125 const dpr = getDPR(element); 6126 return Math.round(value * dpr) / dpr; 6127 } 6128 function useLatestRef(value) { 6129 const ref = React24.useRef(value); 6130 index(() => { 6131 ref.current = value; 6132 }); 6133 return ref; 6134 } 6135 function useFloating(options) { 6136 if (options === void 0) { 6137 options = {}; 6138 } 6139 const { 6140 placement = "bottom", 6141 strategy = "absolute", 6142 middleware = [], 6143 platform: platform3, 6144 elements: { 6145 reference: externalReference, 6146 floating: externalFloating 6147 } = {}, 6148 transform = true, 6149 whileElementsMounted, 6150 open: open3 6151 } = options; 6152 const [data, setData] = React24.useState({ 6153 x: 0, 6154 y: 0, 6155 strategy, 6156 placement, 6157 middlewareData: {}, 6158 isPositioned: false 6159 }); 6160 const [latestMiddleware, setLatestMiddleware] = React24.useState(middleware); 6161 if (!deepEqual(latestMiddleware, middleware)) { 6162 setLatestMiddleware(middleware); 6163 } 6164 const [_reference, _setReference] = React24.useState(null); 6165 const [_floating, _setFloating] = React24.useState(null); 6166 const setReference = React24.useCallback((node) => { 6167 if (node !== referenceRef.current) { 6168 referenceRef.current = node; 6169 _setReference(node); 6170 } 6171 }, []); 6172 const setFloating = React24.useCallback((node) => { 6173 if (node !== floatingRef.current) { 6174 floatingRef.current = node; 6175 _setFloating(node); 6176 } 6177 }, []); 6178 const referenceEl = externalReference || _reference; 6179 const floatingEl = externalFloating || _floating; 6180 const referenceRef = React24.useRef(null); 6181 const floatingRef = React24.useRef(null); 6182 const dataRef = React24.useRef(data); 6183 const hasWhileElementsMounted = whileElementsMounted != null; 6184 const whileElementsMountedRef = useLatestRef(whileElementsMounted); 6185 const platformRef = useLatestRef(platform3); 6186 const openRef = useLatestRef(open3); 6187 const update2 = React24.useCallback(() => { 6188 if (!referenceRef.current || !floatingRef.current) { 6189 return; 6190 } 6191 const config = { 6192 placement, 6193 strategy, 6194 middleware: latestMiddleware 6195 }; 6196 if (platformRef.current) { 6197 config.platform = platformRef.current; 6198 } 6199 computePosition2(referenceRef.current, floatingRef.current, config).then((data2) => { 6200 const fullData = { 6201 ...data2, 6202 // The floating element's position may be recomputed while it's closed 6203 // but still mounted (such as when transitioning out). To ensure 6204 // `isPositioned` will be `false` initially on the next open, avoid 6205 // setting it to `true` when `open === false` (must be specified). 6206 isPositioned: openRef.current !== false 6207 }; 6208 if (isMountedRef.current && !deepEqual(dataRef.current, fullData)) { 6209 dataRef.current = fullData; 6210 ReactDOM3.flushSync(() => { 6211 setData(fullData); 6212 }); 6213 } 6214 }); 6215 }, [latestMiddleware, placement, strategy, platformRef, openRef]); 6216 index(() => { 6217 if (open3 === false && dataRef.current.isPositioned) { 6218 dataRef.current.isPositioned = false; 6219 setData((data2) => ({ 6220 ...data2, 6221 isPositioned: false 6222 })); 6223 } 6224 }, [open3]); 6225 const isMountedRef = React24.useRef(false); 6226 index(() => { 6227 isMountedRef.current = true; 6228 return () => { 6229 isMountedRef.current = false; 6230 }; 6231 }, []); 6232 index(() => { 6233 if (referenceEl) referenceRef.current = referenceEl; 6234 if (floatingEl) floatingRef.current = floatingEl; 6235 if (referenceEl && floatingEl) { 6236 if (whileElementsMountedRef.current) { 6237 return whileElementsMountedRef.current(referenceEl, floatingEl, update2); 6238 } 6239 update2(); 6240 } 6241 }, [referenceEl, floatingEl, update2, whileElementsMountedRef, hasWhileElementsMounted]); 6242 const refs = React24.useMemo(() => ({ 6243 reference: referenceRef, 6244 floating: floatingRef, 6245 setReference, 6246 setFloating 6247 }), [setReference, setFloating]); 6248 const elements = React24.useMemo(() => ({ 6249 reference: referenceEl, 6250 floating: floatingEl 6251 }), [referenceEl, floatingEl]); 6252 const floatingStyles = React24.useMemo(() => { 6253 const initialStyles = { 6254 position: strategy, 6255 left: 0, 6256 top: 0 6257 }; 6258 if (!elements.floating) { 6259 return initialStyles; 6260 } 6261 const x = roundByDPR(elements.floating, data.x); 6262 const y = roundByDPR(elements.floating, data.y); 6263 if (transform) { 6264 return { 6265 ...initialStyles, 6266 transform: "translate(" + x + "px, " + y + "px)", 6267 ...getDPR(elements.floating) >= 1.5 && { 6268 willChange: "transform" 6269 } 6270 }; 6271 } 6272 return { 6273 position: strategy, 6274 left: x, 6275 top: y 6276 }; 6277 }, [strategy, transform, elements.floating, data.x, data.y]); 6278 return React24.useMemo(() => ({ 6279 ...data, 6280 update: update2, 6281 refs, 6282 elements, 6283 floatingStyles 6284 }), [data, update2, refs, elements, floatingStyles]); 6285 } 6286 var offset3 = (options, deps) => { 6287 const result = offset2(options); 6288 return { 6289 name: result.name, 6290 fn: result.fn, 6291 options: [options, deps] 6292 }; 6293 }; 6294 var shift3 = (options, deps) => { 6295 const result = shift2(options); 6296 return { 6297 name: result.name, 6298 fn: result.fn, 6299 options: [options, deps] 6300 }; 6301 }; 6302 var limitShift3 = (options, deps) => { 6303 const result = limitShift2(options); 6304 return { 6305 fn: result.fn, 6306 options: [options, deps] 6307 }; 6308 }; 6309 var flip3 = (options, deps) => { 6310 const result = flip2(options); 6311 return { 6312 name: result.name, 6313 fn: result.fn, 6314 options: [options, deps] 6315 }; 6316 }; 6317 var size3 = (options, deps) => { 6318 const result = size2(options); 6319 return { 6320 name: result.name, 6321 fn: result.fn, 6322 options: [options, deps] 6323 }; 6324 }; 6325 6326 // node_modules/@base-ui/react/utils/popups/popupHandle.mjs 6327 var BasePopupHandle = class { 6328 /** 6329 * Stores of every root currently using this handle, in attach order. A handle is meant to be used 6330 * by a single mounted root, but roots can transiently overlap (e.g. during an animated route 6331 * transition), so this stack lets `attachStore`'s cleanup restore the previous root instead of 6332 * leaving a still-mounted root uncontrollable when a newer overlapping root detaches first. 6333 */ 6334 attachedStores = []; 6335 /** 6336 * Store of the root that currently controls the handle: the most recently attached one still 6337 * mounted, or `null` when no root is attached. Imperative methods are no-ops while this is `null`. 6338 */ 6339 attachedStoreValue = null; 6340 /** 6341 * Listeners notified when `attachedStore` changes, so detached triggers can follow the store pointer. 6342 */ 6343 storeListeners = /* @__PURE__ */ new Set(); 6344 /** 6345 * Creates a handle backed by the store used while no root is attached. 6346 * 6347 * @param fallbackStore Inert, closed store handed to detached triggers while no root is attached, 6348 * so they can render and register without a mounted root. Triggers register into whichever store 6349 * `store` currently resolves to, so while detached they live in this store's trigger map and 6350 * migrate themselves to the root's store (and back) as it attaches/detaches. 6351 * @param componentName Component name used to prefix dev warnings, e.g. `'Menu'` produces 6352 * `MenuHandle.open()` in warning text. 6353 * @param throwOnMissingTrigger Whether `open(triggerId)` throws when no trigger with that id is 6354 * registered. Anchored popups (Menu, Popover, Tooltip, PreviewCard) need a trigger to anchor to, 6355 * so they throw; Dialog is not anchored and instead opens unassociated with a dev warning. 6356 */ 6357 constructor(fallbackStore, componentName, throwOnMissingTrigger = true) { 6358 this.fallbackStore = fallbackStore; 6359 this.componentName = componentName; 6360 this.throwOnMissingTrigger = throwOnMissingTrigger; 6361 } 6362 get attachedStore() { 6363 return this.attachedStoreValue; 6364 } 6365 /** 6366 * Store that detached triggers read from: the attached root's store, or an inert fallback store 6367 * used while no root is attached. 6368 * @internal 6369 */ 6370 get store() { 6371 return this.attachedStoreValue ?? this.fallbackStore; 6372 } 6373 /** 6374 * Stable fallback store used for server rendering and hydration. Root stores cannot be recorded on 6375 * the handle during render because a handle can be shared by concurrent server-rendered requests. 6376 * @internal 6377 */ 6378 get serverStore() { 6379 return this.fallbackStore; 6380 } 6381 /** 6382 * Subscribes to changes of the attached store pointer so detached triggers re-render and re-bind 6383 * when a root attaches or detaches. Returns a function that removes the listener. 6384 * @internal 6385 */ 6386 subscribeStore(listener) { 6387 this.storeListeners.add(listener); 6388 return () => { 6389 this.storeListeners.delete(listener); 6390 }; 6391 } 6392 /** 6393 * Points the handle at a root's store and notifies subscribers so detached triggers re-render and 6394 * re-register into it (their registration effect migrates them when the store pointer changes). 6395 * Returns a cleanup function that detaches the store again. 6396 * @internal 6397 */ 6398 attachStore(newStore) { 6399 this.attachedStores.push(newStore); 6400 this.setActiveStore(newStore); 6401 if (true) { 6402 if (this.attachedStores.length > 1) { 6403 const dev = this; 6404 (dev.overlapWarningFrame ??= AnimationFrame.create()).request(() => { 6405 if (this.attachedStores.length > 1) { 6406 console.warn("Base UI: A handle is attached to more than one mounted root at the same time. The most recently mounted root takes over and the previous one stops being controlled by the handle. A handle should be used by a single root that stays mounted for the lifetime of the handle."); 6407 } 6408 }); 6409 } 6410 } 6411 return () => { 6412 const index2 = this.attachedStores.lastIndexOf(newStore); 6413 if (index2 !== -1) { 6414 this.attachedStores.splice(index2, 1); 6415 } 6416 this.setActiveStore(this.attachedStores[this.attachedStores.length - 1] ?? null); 6417 }; 6418 } 6419 /** 6420 * Sets the store that currently controls the handle and notifies subscribers when it changes, so 6421 * detached triggers re-render and migrate their registration to the new store. 6422 */ 6423 setActiveStore(store3) { 6424 if (this.attachedStoreValue !== store3) { 6425 this.attachedStoreValue = store3; 6426 this.storeListeners.forEach((listener) => { 6427 listener(); 6428 }); 6429 } 6430 } 6431 /** 6432 * Opens the attached root's store and associates it with the trigger with the given id, or a 6433 * no-op (with a dev warning) while no root is attached. Shared by every concrete handle's public 6434 * `open()` method, which only narrows the parameter type. 6435 * 6436 * When a trigger id is given but no matching trigger is registered, anchored popups throw (see 6437 * `throwOnMissingTrigger`); Dialog opens unassociated with a dev warning instead. 6438 * 6439 * This method should only be called in an event handler or an effect (not during rendering). 6440 * 6441 * @param triggerId ID of the trigger to associate with the popup, or `null`/`undefined` to open 6442 * without associating any trigger. 6443 */ 6444 openByTrigger(triggerId) { 6445 const attachedStore = this.attachedStore; 6446 if (attachedStore === null) { 6447 if (true) { 6448 console.warn(`Base UI: $this.componentName}Handle.open() was called while no root using this handle is mounted. The call was ignored; mount a root with this handle before opening it imperatively.`); 6449 } 6450 return; 6451 } 6452 let triggerElement; 6453 if (triggerId) { 6454 for (let i = this.attachedStores.length - 1; i >= 0 && !triggerElement; i -= 1) { 6455 triggerElement = this.attachedStores[i].context.triggerElements.getById(triggerId); 6456 } 6457 triggerElement ??= this.fallbackStore.context.triggerElements.getById(triggerId); 6458 } 6459 if (triggerId && !triggerElement) { 6460 if (this.throwOnMissingTrigger) { 6461 throw new Error(true ? `Base UI: $this.componentName}Handle.open() was called with the trigger id "$triggerId}", but no matching trigger is registered with this handle. An anchored popup cannot open without a trigger to anchor to. Pass the id of a mounted $this.componentName}.Trigger that has this handle set on its "handle" prop.` : formatErrorMessage_default(99, this.componentName, triggerId, this.componentName)); 6462 } 6463 if (true) { 6464 console.warn(`Base UI: $this.componentName}Handle.open: No trigger found with id "$triggerId}". The popup will open, but the trigger will not be associated with it.`); 6465 } 6466 } 6467 attachedStore.setOpen(true, createChangeEventDetails(reason_parts_exports.imperativeAction, void 0, triggerElement)); 6468 } 6469 /** 6470 * Closes the popup by setting the attached root's store to closed, or a no-op (with a dev warning) 6471 * while no root is attached. Shared by every concrete handle's public `close()` method. 6472 * 6473 * This method should only be called in an event handler or an effect (not during rendering). 6474 */ 6475 closePopup() { 6476 const attachedStore = this.attachedStore; 6477 if (attachedStore === null) { 6478 if (true) { 6479 console.warn(`Base UI: $this.componentName}Handle.close() was called while no root using this handle is mounted. The call was ignored.`); 6480 } 6481 return; 6482 } 6483 attachedStore.setOpen(false, createChangeEventDetails(reason_parts_exports.imperativeAction)); 6484 } 6485 }; 6486 6487 // node_modules/@base-ui/react/utils/popups/popupStoreUtils.mjs 6488 var React29 = __toESM(require_react(), 1); 6489 var ReactDOM4 = __toESM(require_react_dom(), 1); 6490 6491 // node_modules/@base-ui/react/floating-ui-react/hooks/useSyncedFloatingRootContext.mjs 6492 var React28 = __toESM(require_react(), 1); 6493 6494 // node_modules/@base-ui/utils/store/useStore.mjs 6495 var React26 = __toESM(require_react(), 1); 6496 var import_shim = __toESM(require_shim(), 1); 6497 var import_with_selector = __toESM(require_with_selector(), 1); 6498 6499 // node_modules/@base-ui/utils/fastHooks.mjs 6500 var React25 = __toESM(require_react(), 1); 6501 var hooks = []; 6502 var currentInstance = void 0; 6503 function getInstance() { 6504 return currentInstance; 6505 } 6506 function register2(hook) { 6507 hooks.push(hook); 6508 } 6509 function fastComponent(fn) { 6510 const FastComponent = (props, forwardedRef) => { 6511 const instance = useRefWithInit(createInstance).current; 6512 let result; 6513 try { 6514 currentInstance = instance; 6515 for (const hook of hooks) { 6516 hook.before(instance); 6517 } 6518 result = fn(props, forwardedRef); 6519 for (const hook of hooks) { 6520 hook.after(instance); 6521 } 6522 instance.didInitialize = true; 6523 } finally { 6524 currentInstance = void 0; 6525 } 6526 return result; 6527 }; 6528 FastComponent.displayName = fn.displayName || fn.name; 6529 return FastComponent; 6530 } 6531 function fastComponentRef(fn) { 6532 return /* @__PURE__ */ React25.forwardRef(fastComponent(fn)); 6533 } 6534 function createInstance() { 6535 return { 6536 didInitialize: false 6537 }; 6538 } 6539 6540 // node_modules/@base-ui/utils/store/useStore.mjs 6541 var canUseRawUseSyncExternalStore = isReactVersionAtLeast(19); 6542 var useStoreImplementation = canUseRawUseSyncExternalStore ? useStoreFast : useStoreLegacy; 6543 function useStore(store3, selector, a1, a2, a3) { 6544 return useStoreImplementation(store3, selector, a1, a2, a3); 6545 } 6546 function useStoreR19(store3, selector, a1, a2, a3) { 6547 const getSelection = React26.useCallback(() => selector(store3.getSnapshot(), a1, a2, a3), [store3, selector, a1, a2, a3]); 6548 return (0, import_shim.useSyncExternalStore)(store3.subscribe, getSelection, getSelection); 6549 } 6550 register2({ 6551 before(instance) { 6552 instance.syncIndex = 0; 6553 if (!instance.didInitialize) { 6554 instance.syncTick = 1; 6555 instance.syncHooks = []; 6556 instance.didChangeStore = true; 6557 instance.getSnapshot = () => { 6558 let didChange2 = false; 6559 for (let i = 0; i < instance.syncHooks.length; i += 1) { 6560 const hook = instance.syncHooks[i]; 6561 const value = hook.selector(hook.store.state, hook.a1, hook.a2, hook.a3); 6562 if (!Object.is(hook.value, value)) { 6563 didChange2 = true; 6564 hook.value = value; 6565 } 6566 } 6567 if (didChange2) { 6568 instance.syncTick += 1; 6569 } 6570 return instance.syncTick; 6571 }; 6572 } 6573 }, 6574 after(instance) { 6575 if (instance.syncHooks.length > 0) { 6576 if (instance.didChangeStore) { 6577 instance.didChangeStore = false; 6578 instance.subscribe = (onStoreChange) => { 6579 const stores = /* @__PURE__ */ new Set(); 6580 for (const hook of instance.syncHooks) { 6581 stores.add(hook.store); 6582 } 6583 const unsubscribes = []; 6584 for (const store3 of stores) { 6585 unsubscribes.push(store3.subscribe(onStoreChange)); 6586 } 6587 return () => { 6588 for (const unsubscribe of unsubscribes) { 6589 unsubscribe(); 6590 } 6591 }; 6592 }; 6593 } 6594 (0, import_shim.useSyncExternalStore)(instance.subscribe, instance.getSnapshot, instance.getSnapshot); 6595 } 6596 } 6597 }); 6598 function useStoreFast(store3, selector, a1, a2, a3) { 6599 const instance = getInstance(); 6600 if (!instance) { 6601 return useStoreR19(store3, selector, a1, a2, a3); 6602 } 6603 const index2 = instance.syncIndex; 6604 instance.syncIndex += 1; 6605 let hook; 6606 if (!instance.didInitialize) { 6607 hook = { 6608 store: store3, 6609 selector, 6610 a1, 6611 a2, 6612 a3, 6613 value: selector(store3.getSnapshot(), a1, a2, a3) 6614 }; 6615 instance.syncHooks.push(hook); 6616 } else { 6617 hook = instance.syncHooks[index2]; 6618 if (hook.store !== store3 || hook.selector !== selector || !Object.is(hook.a1, a1) || !Object.is(hook.a2, a2) || !Object.is(hook.a3, a3)) { 6619 if (hook.store !== store3) { 6620 instance.didChangeStore = true; 6621 } 6622 hook.store = store3; 6623 hook.selector = selector; 6624 hook.a1 = a1; 6625 hook.a2 = a2; 6626 hook.a3 = a3; 6627 hook.value = selector(store3.getSnapshot(), a1, a2, a3); 6628 } 6629 } 6630 return hook.value; 6631 } 6632 function useStoreLegacy(store3, selector, a1, a2, a3) { 6633 return (0, import_with_selector.useSyncExternalStoreWithSelector)(store3.subscribe, store3.getSnapshot, store3.getSnapshot, (state) => selector(state, a1, a2, a3)); 6634 } 6635 6636 // node_modules/@base-ui/utils/store/Store.mjs 6637 var Store = class { 6638 /** 6639 * Creates a store with the given initial state, constructing the class it is called on. 6640 * Calling it on a generic base class (e.g. `ReactStore.create(...)`) constructs that 6641 * class but degrades the inferred instance type to `Store`; use `new` there instead. 6642 */ 6643 static create(state) { 6644 return new this(state); 6645 } 6646 /** 6647 * The current state of the store. 6648 * This property is updated immediately when the state changes as a result of calling {@link setState}, {@link update}, or {@link set}. 6649 * 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). 6650 * The values can be used directly (to avoid subscribing to the store) in effects or event handlers. 6651 * 6652 * Do not modify properties in state directly. Instead, use the provided methods to ensure proper state management and listener notification. 6653 */ 6654 // Internal state to handle recursive `setState()` calls 6655 constructor(state) { 6656 this.state = state; 6657 this.listeners = /* @__PURE__ */ new Set(); 6658 this.updateTick = 0; 6659 } 6660 /** 6661 * Registers a listener that will be called whenever the store's state changes. 6662 * 6663 * @param fn The listener function to be called on state changes. 6664 * @returns A function to unsubscribe the listener. 6665 */ 6666 subscribe = (fn) => { 6667 this.listeners.add(fn); 6668 return () => { 6669 this.listeners.delete(fn); 6670 }; 6671 }; 6672 /** 6673 * Returns the current state of the store. 6674 */ 6675 getSnapshot = () => { 6676 return this.state; 6677 }; 6678 /** 6679 * Updates the entire store's state and notifies all registered listeners. 6680 * 6681 * @param newState The new state to set for the store. 6682 */ 6683 setState(newState) { 6684 if (this.state === newState) { 6685 return; 6686 } 6687 this.state = newState; 6688 this.updateTick += 1; 6689 const currentTick = this.updateTick; 6690 for (const listener of this.listeners) { 6691 if (currentTick !== this.updateTick) { 6692 return; 6693 } 6694 listener(newState); 6695 } 6696 } 6697 /** 6698 * Merges the provided changes into the current state and notifies listeners if there are changes. 6699 * Each value must match its state key. Pass an exact known subset rather than a broad 6700 * `Partial<State>`, which may contain `undefined` for required state fields. 6701 * 6702 * @param changes An object containing the changes to apply to the current state. 6703 */ 6704 update(changes) { 6705 for (const key in changes) { 6706 if (!Object.is(this.state[key], changes[key])) { 6707 this.setState({ 6708 ...this.state, 6709 ...changes 6710 }); 6711 return; 6712 } 6713 } 6714 } 6715 /** 6716 * Sets a specific key in the store's state to a new value and notifies listeners if the value has changed. 6717 * 6718 * @param key The key in the store's state to update. 6719 * @param value The new value to set for the specified key. 6720 */ 6721 set(key, value) { 6722 if (!Object.is(this.state[key], value)) { 6723 this.setState({ 6724 ...this.state, 6725 [key]: value 6726 }); 6727 } 6728 } 6729 /** 6730 * Gives the state a new reference and updates all registered listeners. 6731 */ 6732 notifyAll() { 6733 const newState = { 6734 ...this.state 6735 }; 6736 this.setState(newState); 6737 } 6738 use(selector, a1, a2, a3) { 6739 return useStore(this, selector, a1, a2, a3); 6740 } 6741 }; 6742 6743 // node_modules/@base-ui/utils/store/ReactStore.mjs 6744 var React27 = __toESM(require_react(), 1); 6745 var ReactStore = class extends Store { 6746 /** 6747 * Creates a new ReactStore instance. 6748 * 6749 * @param state Initial state of the store. 6750 * @param context Non-reactive context values. 6751 * @param selectors Optional selectors for use with `useState`. 6752 */ 6753 constructor(state, context = {}, selectors3) { 6754 super(state); 6755 this.context = context; 6756 this.selectors = selectors3; 6757 } 6758 /** 6759 * Non-reactive values such as refs, callbacks, etc. 6760 */ 6761 /** 6762 * Synchronizes a single external value into the store. 6763 * 6764 * Note that the while the value in `state` is updated immediately, the value returned 6765 * by `useState` is updated before the next render (similarly to React's `useState`). 6766 */ 6767 useSyncedValue(key, value) { 6768 React27.useDebugValue(key); 6769 const store3 = this; 6770 useIsoLayoutEffect(() => { 6771 if (store3.state[key] !== value) { 6772 store3.set(key, value); 6773 } 6774 }, [store3, key, value]); 6775 } 6776 /** 6777 * Synchronizes a single external value into the store and 6778 * cleans it up (sets to `undefined`) on unmount. 6779 * 6780 * Note that the while the value in `state` is updated immediately, the value returned 6781 * by `useState` is updated before the next render (similarly to React's `useState`). 6782 */ 6783 useSyncedValueWithCleanup(key, value) { 6784 const store3 = this; 6785 useIsoLayoutEffect(() => { 6786 if (store3.state[key] !== value) { 6787 store3.set(key, value); 6788 } 6789 return () => { 6790 store3.set(key, void 0); 6791 }; 6792 }, [store3, key, value]); 6793 } 6794 /** 6795 * Synchronizes multiple external values into the store. 6796 * Each value must match its state key. Pass an exact known subset rather than a broad 6797 * `Partial<State>`, which may contain `undefined` for required state fields. 6798 * 6799 * Note that the while the values in `state` are updated immediately, the values returned 6800 * by `useState` are updated before the next render (similarly to React's `useState`). 6801 * 6802 * @param statePart An exact subset of state fields to synchronize. Unknown keys are not accepted. 6803 */ 6804 useSyncedValues(statePart) { 6805 const store3 = this; 6806 if (true) { 6807 React27.useDebugValue(statePart, (p) => Object.keys(p)); 6808 const keys = React27.useRef(Object.keys(statePart)).current; 6809 const nextKeys = Object.keys(statePart); 6810 if (keys.length !== nextKeys.length || keys.some((key, index2) => key !== nextKeys[index2])) { 6811 console.error("ReactStore.useSyncedValues expects the same prop keys on every render. Keys should be stable."); 6812 } 6813 } 6814 const dependencies = Object.values(statePart); 6815 useIsoLayoutEffect(() => { 6816 store3.update(statePart); 6817 }, [store3, ...dependencies]); 6818 } 6819 /** 6820 * Registers a controllable prop pair (`controlled`, `defaultValue`) for a specific key. If `controlled` 6821 * is non-undefined, the store's state at `key` is updated to match `controlled`. 6822 */ 6823 useControlledProp(key, controlled) { 6824 React27.useDebugValue(key); 6825 const store3 = this; 6826 const isControlled = controlled !== void 0; 6827 useIsoLayoutEffect(() => { 6828 if (isControlled && !Object.is(store3.state[key], controlled)) { 6829 store3.setState({ 6830 ...store3.state, 6831 [key]: controlled 6832 }); 6833 } 6834 }, [store3, key, controlled, isControlled]); 6835 if (true) { 6836 const cache = this.controlledValues ??= /* @__PURE__ */ new Map(); 6837 if (!cache.has(key)) { 6838 cache.set(key, isControlled); 6839 } 6840 const previouslyControlled = cache.get(key); 6841 if (previouslyControlled !== void 0 && previouslyControlled !== isControlled) { 6842 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).`); 6843 } 6844 } 6845 } 6846 /** Gets the current value from the store using a selector with the provided key. 6847 * 6848 * @param key Key of the selector to use. 6849 */ 6850 select(key, a1, a2, a3) { 6851 const selector = this.selectors[key]; 6852 return selector(this.state, a1, a2, a3); 6853 } 6854 /** 6855 * Returns a value from the store's state using a selector function. 6856 * Used to subscribe to specific parts of the state. 6857 * This methods causes a rerender whenever the selected state changes. 6858 * 6859 * @param key Key of the selector to use. 6860 */ 6861 useState(key, a1, a2, a3) { 6862 React27.useDebugValue(key); 6863 return useStore(this, this.selectors[key], a1, a2, a3); 6864 } 6865 /** 6866 * Wraps a function with `useStableCallback` to ensure it has a stable reference 6867 * and assigns it to the context. 6868 * 6869 * @param key Key of the event callback. Must be a function in the context. 6870 * @param fn Function to assign. 6871 */ 6872 useContextCallback(key, fn) { 6873 React27.useDebugValue(key); 6874 const stableFunction = useStableCallback(fn ?? NOOP); 6875 this.context[key] = stableFunction; 6876 } 6877 /** 6878 * Returns a stable setter function for a specific key in the store's state. 6879 * It's commonly used to pass as a ref callback to React elements. 6880 * 6881 * @param key Key of the state to set. 6882 */ 6883 useStateSetter(key) { 6884 const ref = React27.useRef(void 0); 6885 if (ref.current === void 0) { 6886 ref.current = (value) => { 6887 this.set(key, value); 6888 }; 6889 } 6890 return ref.current; 6891 } 6892 /** 6893 * Observes changes derived from the store's selectors and calls the listener when the selected value changes. 6894 * 6895 * @param key Key of the selector to observe. 6896 * @param listener Listener function called when the selector result changes. 6897 */ 6898 observe(selector, listener) { 6899 let selectFn; 6900 if (typeof selector === "function") { 6901 selectFn = selector; 6902 } else { 6903 selectFn = this.selectors[selector]; 6904 } 6905 let prevValue = selectFn(this.state); 6906 listener(prevValue, prevValue, this); 6907 return this.subscribe((nextState) => { 6908 const nextValue = selectFn(nextState); 6909 if (!Object.is(prevValue, nextValue)) { 6910 const oldValue = prevValue; 6911 prevValue = nextValue; 6912 listener(nextValue, oldValue, this); 6913 } 6914 }); 6915 } 6916 }; 6917 6918 // node_modules/@base-ui/react/floating-ui-react/components/FloatingRootStore.mjs 6919 var selectors = { 6920 open: (state) => state.open, 6921 transitionStatus: (state) => state.transitionStatus, 6922 domReferenceElement: (state) => state.domReferenceElement, 6923 referenceElement: (state) => state.positionReference ?? state.referenceElement, 6924 floatingElement: (state) => state.floatingElement, 6925 floatingId: (state) => state.floatingId 6926 }; 6927 var FloatingRootStore = class extends ReactStore { 6928 constructor(options) { 6929 const { 6930 syncOnly, 6931 nested, 6932 onOpenChange, 6933 triggerElements, 6934 ...initialState 6935 } = options; 6936 super({ 6937 ...initialState, 6938 positionReference: initialState.referenceElement, 6939 domReferenceElement: initialState.referenceElement 6940 }, { 6941 onOpenChange, 6942 dataRef: { 6943 current: {} 6944 }, 6945 events: createEventEmitter(), 6946 nested, 6947 triggerElements 6948 }, selectors); 6949 this.syncOnly = syncOnly; 6950 } 6951 /** 6952 * Syncs the event used by hover logic to distinguish hover-open from click-like interaction. 6953 */ 6954 syncOpenEvent = (newOpen, event) => { 6955 if (!newOpen || !this.state.open || // Prevent a pending hover-open from overwriting a click-open event, while allowing 6956 // click events to upgrade a hover-open. 6957 event != null && isClickLikeEvent(event)) { 6958 this.context.dataRef.current.openEvent = newOpen ? event : void 0; 6959 } 6960 }; 6961 /** 6962 * Runs the root-owned side effects for an open state change. 6963 */ 6964 dispatchOpenChange = (newOpen, eventDetails) => { 6965 this.syncOpenEvent(newOpen, eventDetails.event); 6966 const details = { 6967 open: newOpen, 6968 reason: eventDetails.reason, 6969 nativeEvent: eventDetails.event, 6970 nested: this.context.nested, 6971 triggerElement: eventDetails.trigger 6972 }; 6973 this.context.events.emit("openchange", details); 6974 }; 6975 /** 6976 * Emits the `openchange` event through the internal event emitter and calls the `onOpenChange` handler with the provided arguments. 6977 * 6978 * @param newOpen The new open state. 6979 * @param eventDetails Details about the event that triggered the open state change. 6980 */ 6981 setOpen = (newOpen, eventDetails) => { 6982 if (this.syncOnly) { 6983 this.context.onOpenChange?.(newOpen, eventDetails); 6984 return; 6985 } 6986 this.dispatchOpenChange(newOpen, eventDetails); 6987 this.context.onOpenChange?.(newOpen, eventDetails); 6988 }; 6989 }; 6990 6991 // node_modules/@base-ui/react/floating-ui-react/hooks/useSyncedFloatingRootContext.mjs 6992 function useSyncedFloatingRootContext(options) { 6993 const { 6994 popupStore, 6995 treatPopupAsFloatingElement = false, 6996 floatingRootContext: floatingRootContextProp, 6997 floatingId, 6998 nested, 6999 onOpenChange 7000 } = options; 7001 const open3 = popupStore.useState("open"); 7002 const referenceElement = popupStore.useState("activeTriggerElement"); 7003 const floatingElement = popupStore.useState(treatPopupAsFloatingElement ? "popupElement" : "positionerElement"); 7004 const triggerElements = popupStore.context.triggerElements; 7005 const handleOpenChange = onOpenChange; 7006 const internalStoreRef = React28.useRef(null); 7007 if (floatingRootContextProp === void 0 && internalStoreRef.current === null) { 7008 internalStoreRef.current = new FloatingRootStore({ 7009 open: open3, 7010 transitionStatus: void 0, 7011 referenceElement, 7012 floatingElement, 7013 triggerElements, 7014 onOpenChange: handleOpenChange, 7015 floatingId, 7016 syncOnly: true, 7017 nested 7018 }); 7019 } 7020 const store3 = floatingRootContextProp ?? internalStoreRef.current; 7021 popupStore.useSyncedValue("floatingId", floatingId); 7022 useIsoLayoutEffect(() => { 7023 const valuesToSync = { 7024 open: open3, 7025 floatingId, 7026 referenceElement, 7027 floatingElement 7028 }; 7029 if (isElement(referenceElement)) { 7030 valuesToSync.domReferenceElement = referenceElement; 7031 } 7032 if (store3.state.positionReference === store3.state.referenceElement) { 7033 valuesToSync.positionReference = referenceElement; 7034 } 7035 store3.update(valuesToSync); 7036 }, [open3, floatingId, referenceElement, floatingElement, store3]); 7037 store3.context.onOpenChange = handleOpenChange; 7038 store3.context.nested = nested; 7039 return store3; 7040 } 7041 7042 // node_modules/@base-ui/react/utils/popups/popupStoreUtils.mjs 7043 var FOCUSABLE_POPUP_PROPS = { 7044 tabIndex: -1, 7045 [FOCUSABLE_ATTRIBUTE]: "" 7046 }; 7047 function usePopupRootStore(createStore, treatPopupAsFloatingElement = false) { 7048 const floatingId = useId(); 7049 const nested = useFloatingParentNodeId() != null; 7050 const store3 = useRefWithInit(() => createStore(floatingId, nested)).current; 7051 useSyncedFloatingRootContext({ 7052 popupStore: store3, 7053 treatPopupAsFloatingElement, 7054 floatingRootContext: store3.state.floatingRootContext, 7055 floatingId, 7056 nested, 7057 onOpenChange: store3.setOpen 7058 }); 7059 return store3; 7060 } 7061 function PopupHandleAttachment({ 7062 handle, 7063 store: store3 7064 }) { 7065 useIsoLayoutEffect(() => { 7066 return handle.attachStore(store3); 7067 }, [handle, store3]); 7068 return null; 7069 } 7070 function syncTriggerCount(store3) { 7071 const triggerCount = store3.context.triggerElements.size; 7072 if (store3.select("open") && store3.state.triggerCount !== triggerCount) { 7073 store3.set("triggerCount", triggerCount); 7074 } 7075 } 7076 function useTriggerRegistration(id, store3) { 7077 const registrationRef = React29.useRef(null); 7078 return useStableCallback((element) => { 7079 const registration = registrationRef.current; 7080 if (registration !== null) { 7081 if (registration.element === element && registration.store === store3 && registration.id === id) { 7082 return; 7083 } 7084 registrationRef.current = null; 7085 const registeredStore = registration.store; 7086 if (registeredStore.context.triggerElements.getById(registration.id) === registration.element) { 7087 registeredStore.context.triggerElements.delete(registration.id); 7088 syncTriggerCount(registeredStore); 7089 } 7090 } 7091 if (element !== null && id !== void 0) { 7092 registrationRef.current = { 7093 store: store3, 7094 id, 7095 element 7096 }; 7097 store3.context.triggerElements.add(id, element); 7098 syncTriggerCount(store3); 7099 } 7100 }); 7101 } 7102 function createPopupOpenState(state, open3, trigger, preventUnmountOnClose = false) { 7103 let preventUnmountingOnClose = state.preventUnmountingOnClose; 7104 if (open3) { 7105 preventUnmountingOnClose = false; 7106 } else if (preventUnmountOnClose) { 7107 preventUnmountingOnClose = true; 7108 } 7109 const triggerId = trigger?.id ?? null; 7110 let activeTriggerId = state.activeTriggerId; 7111 let activeTriggerElement = state.activeTriggerElement; 7112 if (triggerId || open3) { 7113 activeTriggerId = triggerId; 7114 activeTriggerElement = trigger ?? null; 7115 } 7116 return { 7117 open: open3, 7118 preventUnmountingOnClose, 7119 activeTriggerId, 7120 activeTriggerElement 7121 }; 7122 } 7123 function attachPreventUnmountOnClose(eventDetails) { 7124 let preventUnmountOnClose = false; 7125 eventDetails.preventUnmountOnClose = () => { 7126 preventUnmountOnClose = true; 7127 }; 7128 return () => preventUnmountOnClose; 7129 } 7130 function applyPopupOpenChange(store3, nextOpen, eventDetails, options = {}) { 7131 const reason = eventDetails.reason; 7132 const isHover = reason === reason_parts_exports.triggerHover; 7133 const isFocusOpen = nextOpen && reason === reason_parts_exports.triggerFocus; 7134 const isDismissClose = !nextOpen && (reason === reason_parts_exports.triggerPress || reason === reason_parts_exports.escapeKey); 7135 const shouldPreventUnmountOnClose = attachPreventUnmountOnClose(eventDetails); 7136 store3.context.onOpenChange?.(nextOpen, eventDetails); 7137 if (eventDetails.isCanceled) { 7138 return; 7139 } 7140 options.onBeforeDispatch?.(); 7141 store3.state.floatingRootContext.dispatchOpenChange(nextOpen, eventDetails); 7142 const changeState = () => { 7143 const popupOpenState = createPopupOpenState(store3.state, nextOpen, eventDetails.trigger, shouldPreventUnmountOnClose()); 7144 const updatedState = { 7145 ...options.extraState, 7146 ...popupOpenState 7147 }; 7148 if (isFocusOpen) { 7149 updatedState.instantType = "focus"; 7150 } else if (isDismissClose) { 7151 updatedState.instantType = "dismiss"; 7152 } else if (isHover) { 7153 updatedState.instantType = void 0; 7154 } 7155 store3.update(updatedState); 7156 }; 7157 if (isHover) { 7158 ReactDOM4.flushSync(changeState); 7159 } else { 7160 changeState(); 7161 } 7162 } 7163 function useTriggerDataForwarding(triggerId, triggerElementRef, store3, stateUpdates) { 7164 const isMountedByThisTrigger = store3.useState("isMountedByTrigger", triggerId); 7165 const baseRegisterTrigger = useTriggerRegistration(triggerId, store3); 7166 const applyTriggerData = useStableCallback((element) => { 7167 const open3 = store3.select("open"); 7168 const activeTriggerId = store3.select("activeTriggerId"); 7169 if (activeTriggerId === triggerId) { 7170 const changes = { 7171 activeTriggerElement: element, 7172 ...open3 ? stateUpdates : null 7173 }; 7174 store3.update(changes); 7175 return; 7176 } 7177 if (activeTriggerId == null && open3) { 7178 const changes = { 7179 activeTriggerId: triggerId ?? null, 7180 activeTriggerElement: element, 7181 ...stateUpdates 7182 }; 7183 store3.update(changes); 7184 } 7185 }); 7186 const registerTrigger = useStableCallback((element) => { 7187 baseRegisterTrigger(element); 7188 if (element) { 7189 applyTriggerData(element); 7190 } 7191 }); 7192 useIsoLayoutEffect(() => { 7193 registerTrigger(triggerElementRef.current); 7194 return () => registerTrigger(null); 7195 }, [registerTrigger, triggerElementRef, store3, triggerId]); 7196 useIsoLayoutEffect(() => { 7197 if (isMountedByThisTrigger) { 7198 const changes = { 7199 activeTriggerElement: triggerElementRef.current, 7200 ...stateUpdates 7201 }; 7202 store3.update(changes); 7203 } 7204 }, [isMountedByThisTrigger, store3, triggerElementRef, ...Object.values(stateUpdates)]); 7205 return { 7206 registerTrigger, 7207 isMountedByThisTrigger 7208 }; 7209 } 7210 function useImplicitActiveTrigger(store3, options = {}) { 7211 const { 7212 closeOnActiveTriggerUnmount = false 7213 } = options; 7214 const resolvedActiveTriggerIdRef = React29.useRef(null); 7215 const open3 = store3.useState("open"); 7216 const reactiveTriggerCount = store3.useState("triggerCount"); 7217 const activeTriggerId = store3.useState("activeTriggerId"); 7218 const reactiveActiveTriggerElement = store3.useState("activeTriggerElement"); 7219 useIsoLayoutEffect(() => { 7220 if (!open3) { 7221 resolvedActiveTriggerIdRef.current = null; 7222 if (store3.state.triggerCount !== 0) { 7223 store3.set("triggerCount", 0); 7224 } 7225 return; 7226 } 7227 const triggerCount = store3.context.triggerElements.size; 7228 const stateUpdates = {}; 7229 if (store3.state.triggerCount !== triggerCount) { 7230 stateUpdates.triggerCount = triggerCount; 7231 } 7232 const currentActiveTriggerId = store3.select("activeTriggerId"); 7233 let lostActiveTriggerId = null; 7234 if (currentActiveTriggerId) { 7235 const activeTriggerElement = store3.context.triggerElements.getById(currentActiveTriggerId); 7236 if (!activeTriggerElement) { 7237 for (const [triggerId, triggerElement] of store3.context.triggerElements.entries()) { 7238 if (triggerElement === store3.state.activeTriggerElement) { 7239 stateUpdates.activeTriggerId = triggerId; 7240 stateUpdates.activeTriggerElement = triggerElement; 7241 resolvedActiveTriggerIdRef.current = triggerId; 7242 break; 7243 } 7244 } 7245 if (stateUpdates.activeTriggerId === void 0) { 7246 if (resolvedActiveTriggerIdRef.current === currentActiveTriggerId) { 7247 lostActiveTriggerId = currentActiveTriggerId; 7248 } else { 7249 resolvedActiveTriggerIdRef.current = null; 7250 } 7251 } 7252 } else { 7253 resolvedActiveTriggerIdRef.current = currentActiveTriggerId; 7254 if (activeTriggerElement !== store3.state.activeTriggerElement) { 7255 stateUpdates.activeTriggerElement = activeTriggerElement; 7256 } 7257 } 7258 } else { 7259 resolvedActiveTriggerIdRef.current = null; 7260 } 7261 if (!lostActiveTriggerId && !currentActiveTriggerId && triggerCount === 1) { 7262 const iteratorResult = store3.context.triggerElements.entries().next(); 7263 if (!iteratorResult.done) { 7264 const [implicitTriggerId, implicitTriggerElement] = iteratorResult.value; 7265 stateUpdates.activeTriggerId = implicitTriggerId; 7266 stateUpdates.activeTriggerElement = implicitTriggerElement; 7267 resolvedActiveTriggerIdRef.current = implicitTriggerId; 7268 } 7269 } 7270 if (stateUpdates.triggerCount !== void 0 || stateUpdates.activeTriggerId !== void 0 || stateUpdates.activeTriggerElement !== void 0) { 7271 store3.update(stateUpdates); 7272 } 7273 if (lostActiveTriggerId) { 7274 if (closeOnActiveTriggerUnmount) { 7275 queueMicrotask(() => { 7276 if (store3.select("open") && store3.select("activeTriggerId") === lostActiveTriggerId && !store3.context.triggerElements.getById(lostActiveTriggerId)) { 7277 const eventDetails = createChangeEventDetails(reason_parts_exports.none); 7278 store3.setOpen(false, eventDetails); 7279 if (!eventDetails.isCanceled) { 7280 store3.update({ 7281 activeTriggerId: null, 7282 activeTriggerElement: null 7283 }); 7284 } 7285 } 7286 }); 7287 } 7288 } 7289 }, [open3, store3, reactiveTriggerCount, activeTriggerId, reactiveActiveTriggerElement, closeOnActiveTriggerUnmount]); 7290 } 7291 function useOpenStateTransitions(open3, store3, onUnmount, animateInitialOpen) { 7292 const { 7293 mounted, 7294 setMounted, 7295 transitionStatus 7296 } = useTransitionStatus(open3, false, false, animateInitialOpen); 7297 const preventUnmountingOnClose = store3.useState("preventUnmountingOnClose"); 7298 const syncedPreventUnmountingOnClose = open3 ? false : preventUnmountingOnClose; 7299 store3.useSyncedValues({ 7300 mounted, 7301 transitionStatus, 7302 preventUnmountingOnClose: syncedPreventUnmountingOnClose 7303 }); 7304 const forceUnmount = useStableCallback(() => { 7305 setMounted(false); 7306 store3.update({ 7307 activeTriggerId: null, 7308 activeTriggerElement: null, 7309 mounted: false, 7310 preventUnmountingOnClose: false 7311 }); 7312 onUnmount?.(); 7313 store3.context.onOpenChangeComplete?.(false); 7314 }); 7315 useOpenChangeComplete({ 7316 enabled: mounted && !open3 && !syncedPreventUnmountingOnClose, 7317 open: open3, 7318 ref: store3.context.popupRef, 7319 onComplete() { 7320 if (!open3) { 7321 forceUnmount(); 7322 } 7323 } 7324 }); 7325 return { 7326 forceUnmount, 7327 transitionStatus 7328 }; 7329 } 7330 function usePopupInteractionProps(store3, statePart) { 7331 store3.useSyncedValues(statePart); 7332 useIsoLayoutEffect(() => () => { 7333 store3.update({ 7334 activeTriggerProps: EMPTY_OBJECT, 7335 inactiveTriggerProps: EMPTY_OBJECT, 7336 popupProps: EMPTY_OBJECT 7337 }); 7338 }, [store3]); 7339 } 7340 7341 // node_modules/@base-ui/react/utils/popups/popupTriggerMap.mjs 7342 var devElementIdsByMap; 7343 function getDevElementIds(map) { 7344 devElementIdsByMap ??= /* @__PURE__ */ new WeakMap(); 7345 let elementIds = devElementIdsByMap.get(map); 7346 if (!elementIds) { 7347 elementIds = /* @__PURE__ */ new WeakMap(); 7348 devElementIdsByMap.set(map, elementIds); 7349 } 7350 return elementIds; 7351 } 7352 var PopupTriggerMap = class { 7353 constructor() { 7354 this.idMap = /* @__PURE__ */ new Map(); 7355 } 7356 /** 7357 * Adds a trigger element with the given ID. 7358 * 7359 * Note: The provided element is assumed to not be registered under multiple IDs. 7360 */ 7361 add(id, element) { 7362 if (true) { 7363 const elementIds = getDevElementIds(this); 7364 const existingId = elementIds.get(element); 7365 if (existingId !== void 0 && existingId !== id) { 7366 throw new Error("Base UI: A trigger element cannot be registered under multiple IDs in PopupTriggerMap."); 7367 } 7368 const previousElement = this.idMap.get(id); 7369 if (previousElement !== void 0 && previousElement !== element) { 7370 elementIds.delete(previousElement); 7371 } 7372 elementIds.set(element, id); 7373 } 7374 this.idMap.set(id, element); 7375 } 7376 /** 7377 * Removes the trigger element with the given ID. 7378 */ 7379 delete(id) { 7380 if (true) { 7381 const element = this.idMap.get(id); 7382 if (element !== void 0) { 7383 devElementIdsByMap?.get(this)?.delete(element); 7384 } 7385 } 7386 this.idMap.delete(id); 7387 } 7388 /** 7389 * Whether the given element is registered as a trigger. 7390 */ 7391 hasElement(element) { 7392 for (const registered of this.idMap.values()) { 7393 if (registered === element) { 7394 return true; 7395 } 7396 } 7397 return false; 7398 } 7399 /** 7400 * Whether there is a registered trigger element matching the given predicate. 7401 */ 7402 hasMatchingElement(predicate) { 7403 for (const element of this.idMap.values()) { 7404 if (predicate(element)) { 7405 return true; 7406 } 7407 } 7408 return false; 7409 } 7410 /** 7411 * Returns the trigger element associated with the given ID, or undefined if no such element exists. 7412 */ 7413 getById(id) { 7414 return this.idMap.get(id); 7415 } 7416 /** 7417 * Returns an iterable of all registered trigger entries, where each entry is a tuple of [id, element]. 7418 */ 7419 entries() { 7420 return this.idMap.entries(); 7421 } 7422 /** 7423 * Returns an iterable of all registered trigger elements. 7424 */ 7425 elements() { 7426 return this.idMap.values(); 7427 } 7428 /** 7429 * Returns the number of registered trigger elements. 7430 */ 7431 get size() { 7432 return this.idMap.size; 7433 } 7434 }; 7435 7436 // node_modules/@base-ui/react/utils/popups/store.mjs 7437 function createInitialPopupStoreState(triggerElements, floatingId, nested = false) { 7438 return { 7439 open: false, 7440 openProp: void 0, 7441 mounted: false, 7442 transitionStatus: void 0, 7443 floatingRootContext: new FloatingRootStore({ 7444 open: false, 7445 transitionStatus: void 0, 7446 floatingElement: null, 7447 referenceElement: null, 7448 triggerElements, 7449 floatingId, 7450 syncOnly: true, 7451 nested, 7452 onOpenChange: void 0 7453 }), 7454 floatingId, 7455 triggerCount: 0, 7456 preventUnmountingOnClose: false, 7457 payload: void 0, 7458 activeTriggerId: null, 7459 activeTriggerElement: null, 7460 triggerIdProp: void 0, 7461 popupElement: null, 7462 positionerElement: null, 7463 activeTriggerProps: EMPTY_OBJECT, 7464 inactiveTriggerProps: EMPTY_OBJECT, 7465 popupProps: EMPTY_OBJECT 7466 }; 7467 } 7468 var activeTriggerIdSelector = (state) => state.triggerIdProp ?? state.activeTriggerId; 7469 var openSelector = (state) => state.openProp ?? state.open; 7470 var popupIdSelector = (state) => { 7471 const popupId = state.popupElement?.id ?? state.floatingId; 7472 return popupId || void 0; 7473 }; 7474 function triggerOwnsOpenPopup(state, triggerId) { 7475 return triggerId !== void 0 && openSelector(state) && activeTriggerIdSelector(state) === triggerId; 7476 } 7477 function triggerOwnsOpenPopupOrIsOnlyTrigger(state, triggerId) { 7478 if (triggerOwnsOpenPopup(state, triggerId)) { 7479 return true; 7480 } 7481 return triggerId !== void 0 && openSelector(state) && activeTriggerIdSelector(state) == null && state.triggerCount === 1; 7482 } 7483 var popupStoreSelectors = { 7484 open: openSelector, 7485 mounted: (state) => state.mounted, 7486 transitionStatus: (state) => state.transitionStatus, 7487 floatingRootContext: (state) => state.floatingRootContext, 7488 triggerCount: (state) => state.triggerCount, 7489 preventUnmountingOnClose: (state) => state.preventUnmountingOnClose, 7490 payload: (state) => state.payload, 7491 activeTriggerId: activeTriggerIdSelector, 7492 activeTriggerElement: (state) => state.mounted ? state.activeTriggerElement : null, 7493 popupId: popupIdSelector, 7494 /** 7495 * Whether the trigger with the given ID was used to open the popup. 7496 */ 7497 isTriggerActive: (state, triggerId) => triggerId !== void 0 && activeTriggerIdSelector(state) === triggerId, 7498 /** 7499 * Whether the popup is open and was activated by a trigger with the given ID. 7500 */ 7501 isOpenedByTrigger: (state, triggerId) => triggerOwnsOpenPopup(state, triggerId), 7502 /** 7503 * Whether the popup is mounted and was activated by a trigger with the given ID. 7504 */ 7505 isMountedByTrigger: (state, triggerId) => triggerId !== void 0 && activeTriggerIdSelector(state) === triggerId && state.mounted, 7506 triggerProps: (state, isActive) => isActive ? state.activeTriggerProps : state.inactiveTriggerProps, 7507 /** 7508 * Popup id for the trigger that currently owns the open popup. 7509 */ 7510 triggerPopupId: (state, triggerId) => triggerOwnsOpenPopupOrIsOnlyTrigger(state, triggerId) ? popupIdSelector(state) : void 0, 7511 popupProps: (state) => state.popupProps, 7512 popupElement: (state) => state.popupElement, 7513 positionerElement: (state) => state.positionerElement 7514 }; 7515 7516 // node_modules/@base-ui/react/utils/popups/usePopupHandleStore.mjs 7517 var React30 = __toESM(require_react(), 1); 7518 var import_shim2 = __toESM(require_shim(), 1); 7519 function usePopupHandleStore(handle) { 7520 const subscribe = React30.useCallback((listener) => { 7521 if (handle === void 0) { 7522 return NOOP; 7523 } 7524 return handle.subscribeStore(listener); 7525 }, [handle]); 7526 const getSnapshot = React30.useCallback(() => { 7527 return handle === void 0 ? void 0 : handle.store; 7528 }, [handle]); 7529 return (0, import_shim2.useSyncExternalStore)(subscribe, getSnapshot, () => handle?.serverStore); 7530 } 7531 7532 // node_modules/@base-ui/react/floating-ui-react/hooks/useFloating.mjs 7533 function useBaseUIFloating(options) { 7534 return useFloatingWithStore(options, options.rootContext); 7535 } 7536 function useFloatingWithStore(options, store3) { 7537 const { 7538 nodeId, 7539 externalTree 7540 } = options; 7541 const referenceElement = store3.useState("referenceElement"); 7542 const floatingElement = store3.useState("floatingElement"); 7543 const domReferenceElement = store3.useState("domReferenceElement"); 7544 const open3 = store3.useState("open"); 7545 const floatingId = store3.useState("floatingId"); 7546 const [positionReference, setPositionReferenceRaw] = React31.useState(null); 7547 const [localDomReference, setLocalDomReference] = React31.useState(void 0); 7548 const [localFloatingElement, setLocalFloatingElement] = React31.useState(void 0); 7549 const domReferenceRef = React31.useRef(null); 7550 const tree = useFloatingTree(externalTree); 7551 const storeElements = React31.useMemo(() => ({ 7552 reference: referenceElement, 7553 floating: floatingElement, 7554 domReference: domReferenceElement 7555 }), [referenceElement, floatingElement, domReferenceElement]); 7556 const position = useFloating({ 7557 ...options, 7558 elements: { 7559 ...storeElements, 7560 ...positionReference && { 7561 reference: positionReference 7562 } 7563 } 7564 }); 7565 const localDomReferenceElement = isElement(localDomReference) ? localDomReference : null; 7566 const syncedFloatingElement = localFloatingElement === void 0 ? store3.state.floatingElement : localFloatingElement; 7567 store3.useSyncedValue("referenceElement", localDomReference ?? null); 7568 store3.useSyncedValue("domReferenceElement", localDomReference === void 0 ? domReferenceElement : localDomReferenceElement); 7569 store3.useSyncedValue("floatingElement", syncedFloatingElement); 7570 const setPositionReference = React31.useCallback((node) => { 7571 const computedPositionReference = isElement(node) ? { 7572 getBoundingClientRect: () => node.getBoundingClientRect(), 7573 getClientRects: () => node.getClientRects(), 7574 contextElement: node 7575 } : node; 7576 setPositionReferenceRaw(computedPositionReference); 7577 position.refs.setReference(computedPositionReference); 7578 }, [position.refs]); 7579 const setReference = React31.useCallback((node) => { 7580 if (isElement(node) || node === null) { 7581 domReferenceRef.current = node; 7582 setLocalDomReference(node); 7583 } 7584 if (isElement(position.refs.reference.current) || position.refs.reference.current === null || // Don't allow setting virtual elements using the old technique back to 7585 // `null` to support `positionReference` + an unstable `reference` 7586 // callback ref. 7587 node !== null && !isElement(node)) { 7588 position.refs.setReference(node); 7589 } 7590 }, [position.refs, setLocalDomReference]); 7591 const setFloating = React31.useCallback((node) => { 7592 setLocalFloatingElement(node); 7593 position.refs.setFloating(node); 7594 }, [position.refs]); 7595 const refs = React31.useMemo(() => ({ 7596 ...position.refs, 7597 setReference, 7598 setFloating, 7599 setPositionReference, 7600 domReference: domReferenceRef 7601 }), [position.refs, setReference, setFloating, setPositionReference]); 7602 const elements = React31.useMemo(() => ({ 7603 ...position.elements, 7604 domReference: domReferenceElement 7605 }), [position.elements, domReferenceElement]); 7606 const context = React31.useMemo(() => ({ 7607 ...position, 7608 dataRef: store3.context.dataRef, 7609 open: open3, 7610 onOpenChange: store3.setOpen, 7611 events: store3.context.events, 7612 floatingId, 7613 refs, 7614 elements, 7615 nodeId, 7616 rootStore: store3 7617 }), [position, refs, elements, nodeId, store3, open3, floatingId]); 7618 useIsoLayoutEffect(() => { 7619 if (domReferenceElement) { 7620 domReferenceRef.current = domReferenceElement; 7621 } 7622 }, [domReferenceElement]); 7623 useIsoLayoutEffect(() => { 7624 store3.context.dataRef.current.floatingContext = context; 7625 const node = tree?.nodesRef.current.find((n) => n.id === nodeId); 7626 if (node) { 7627 node.context = context; 7628 } 7629 }); 7630 return React31.useMemo(() => ({ 7631 ...position, 7632 context, 7633 refs, 7634 elements, 7635 rootStore: store3 7636 }), [position, refs, elements, context, store3]); 7637 } 7638 7639 // node_modules/@base-ui/react/floating-ui-react/hooks/useFocus.mjs 7640 var React32 = __toESM(require_react(), 1); 7641 var isMacSafari = parts_exports.os.mac && parts_exports.engine.webkit; 7642 function useFocus(context, props = {}) { 7643 const { 7644 enabled = true, 7645 delay 7646 } = props; 7647 const store3 = "rootStore" in context ? context.rootStore : context; 7648 const { 7649 events, 7650 dataRef 7651 } = store3.context; 7652 const blockFocusRef = React32.useRef(false); 7653 const blockedReferenceRef = React32.useRef(null); 7654 const keyboardModalityRef = React32.useRef(true); 7655 const timeout = useTimeout(); 7656 React32.useEffect(() => { 7657 const domReference = store3.select("domReferenceElement"); 7658 if (!enabled) { 7659 return void 0; 7660 } 7661 const win = getWindow(domReference); 7662 function onBlur() { 7663 const currentDomReference = store3.select("domReferenceElement"); 7664 if (!store3.select("open") && isHTMLElement(currentDomReference) && currentDomReference === activeElement(ownerDocument(currentDomReference))) { 7665 blockFocusRef.current = true; 7666 blockedReferenceRef.current = currentDomReference; 7667 } 7668 } 7669 function onKeyDown() { 7670 keyboardModalityRef.current = true; 7671 } 7672 function onPointerDown() { 7673 keyboardModalityRef.current = false; 7674 } 7675 return mergeCleanups(addEventListener(win, "blur", onBlur), isMacSafari && addEventListener(win, "keydown", onKeyDown, true), isMacSafari && addEventListener(win, "pointerdown", onPointerDown, true)); 7676 }, [store3, enabled]); 7677 React32.useEffect(() => { 7678 if (!enabled) { 7679 return void 0; 7680 } 7681 function onOpenChangeLocal(details) { 7682 if (details.reason === reason_parts_exports.triggerPress || details.reason === reason_parts_exports.escapeKey) { 7683 const referenceElement = store3.select("domReferenceElement"); 7684 if (isElement(referenceElement)) { 7685 blockedReferenceRef.current = referenceElement; 7686 blockFocusRef.current = true; 7687 } 7688 } 7689 } 7690 events.on("openchange", onOpenChangeLocal); 7691 return () => { 7692 events.off("openchange", onOpenChangeLocal); 7693 }; 7694 }, [events, enabled, store3]); 7695 const reference = React32.useMemo(() => { 7696 function resetBlockedFocus() { 7697 blockFocusRef.current = false; 7698 blockedReferenceRef.current = null; 7699 } 7700 return { 7701 onMouseLeave() { 7702 resetBlockedFocus(); 7703 }, 7704 onFocus(event) { 7705 const focusTarget = event.currentTarget; 7706 if (blockFocusRef.current) { 7707 if (blockedReferenceRef.current === focusTarget) { 7708 return; 7709 } 7710 resetBlockedFocus(); 7711 } 7712 const target = getTarget(event.nativeEvent); 7713 if (isElement(target)) { 7714 if (isMacSafari && !event.relatedTarget) { 7715 if (!keyboardModalityRef.current && !isTypeableElement(target)) { 7716 return; 7717 } 7718 } else if (!matchesFocusVisible(target)) { 7719 return; 7720 } 7721 } 7722 const movedFromOtherEnabledTrigger = isTargetInsideEnabledTrigger(event.relatedTarget, store3.context.triggerElements); 7723 const { 7724 nativeEvent, 7725 currentTarget 7726 } = event; 7727 const delayValue = typeof delay === "function" ? delay() : delay; 7728 if (store3.select("open") && movedFromOtherEnabledTrigger || delayValue === 0 || delayValue === void 0) { 7729 store3.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerFocus, nativeEvent, currentTarget)); 7730 return; 7731 } 7732 timeout.start(delayValue, () => { 7733 if (blockFocusRef.current) { 7734 return; 7735 } 7736 store3.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerFocus, nativeEvent, currentTarget)); 7737 }); 7738 }, 7739 onBlur(event) { 7740 resetBlockedFocus(); 7741 const relatedTarget = event.relatedTarget; 7742 const nativeEvent = event.nativeEvent; 7743 const movedToFocusGuard = isElement(relatedTarget) && relatedTarget.hasAttribute(createAttribute("focus-guard")) && relatedTarget.getAttribute("data-type") === "outside"; 7744 timeout.start(0, () => { 7745 const domReference = store3.select("domReferenceElement"); 7746 const activeEl = activeElement(ownerDocument(domReference)); 7747 if (!relatedTarget && activeEl === domReference) { 7748 return; 7749 } 7750 if (contains(dataRef.current.floatingContext?.refs.floating.current, activeEl) || contains(domReference, activeEl) || movedToFocusGuard) { 7751 return; 7752 } 7753 const nextFocusedElement = relatedTarget ?? activeEl; 7754 if (isTargetInsideEnabledTrigger(nextFocusedElement, store3.context.triggerElements)) { 7755 return; 7756 } 7757 store3.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerFocus, nativeEvent)); 7758 }); 7759 } 7760 }; 7761 }, [dataRef, delay, store3, timeout]); 7762 return React32.useMemo(() => enabled ? { 7763 reference, 7764 trigger: reference 7765 } : {}, [enabled, reference]); 7766 } 7767 7768 // node_modules/@base-ui/react/floating-ui-react/hooks/useHoverFloatingInteraction.mjs 7769 var React33 = __toESM(require_react(), 1); 7770 7771 // node_modules/@base-ui/react/floating-ui-react/hooks/useHoverInteractionSharedState.mjs 7772 var HoverInteraction = class _HoverInteraction { 7773 constructor() { 7774 this.pointerType = void 0; 7775 this.interactedInside = false; 7776 this.handler = void 0; 7777 this.blockMouseMove = true; 7778 this.performedPointerEventsMutation = false; 7779 this.pointerEventsScopeElement = null; 7780 this.pointerEventsReferenceElement = null; 7781 this.pointerEventsFloatingElement = null; 7782 this.restTimeoutPending = false; 7783 this.openChangeTimeout = new Timeout(); 7784 this.restTimeout = new Timeout(); 7785 this.handleCloseOptions = void 0; 7786 } 7787 static create() { 7788 return new _HoverInteraction(); 7789 } 7790 dispose = () => { 7791 this.openChangeTimeout.clear(); 7792 this.restTimeout.clear(); 7793 }; 7794 disposeEffect = () => { 7795 return this.dispose; 7796 }; 7797 }; 7798 var pointerEventsMutationOwnerByScopeElement = /* @__PURE__ */ new WeakMap(); 7799 function clearSafePolygonPointerEventsMutation(instance) { 7800 if (!instance.performedPointerEventsMutation) { 7801 return; 7802 } 7803 const scopeElement = instance.pointerEventsScopeElement; 7804 if (scopeElement && pointerEventsMutationOwnerByScopeElement.get(scopeElement) === instance) { 7805 instance.pointerEventsScopeElement?.style.removeProperty("pointer-events"); 7806 instance.pointerEventsReferenceElement?.style.removeProperty("pointer-events"); 7807 instance.pointerEventsFloatingElement?.style.removeProperty("pointer-events"); 7808 pointerEventsMutationOwnerByScopeElement.delete(scopeElement); 7809 } 7810 instance.performedPointerEventsMutation = false; 7811 instance.pointerEventsScopeElement = null; 7812 instance.pointerEventsReferenceElement = null; 7813 instance.pointerEventsFloatingElement = null; 7814 } 7815 function applySafePolygonPointerEventsMutation(instance, options) { 7816 const { 7817 scopeElement, 7818 referenceElement, 7819 floatingElement 7820 } = options; 7821 const existingOwner = pointerEventsMutationOwnerByScopeElement.get(scopeElement); 7822 if (existingOwner && existingOwner !== instance) { 7823 clearSafePolygonPointerEventsMutation(existingOwner); 7824 } 7825 clearSafePolygonPointerEventsMutation(instance); 7826 instance.performedPointerEventsMutation = true; 7827 instance.pointerEventsScopeElement = scopeElement; 7828 instance.pointerEventsReferenceElement = referenceElement; 7829 instance.pointerEventsFloatingElement = floatingElement; 7830 pointerEventsMutationOwnerByScopeElement.set(scopeElement, instance); 7831 scopeElement.style.pointerEvents = "none"; 7832 referenceElement.style.pointerEvents = "auto"; 7833 floatingElement.style.pointerEvents = "auto"; 7834 } 7835 function useHoverInteractionSharedState(store3) { 7836 const data = store3.context.dataRef.current; 7837 const instance = useRefWithInit(() => data.hoverInteractionState ?? HoverInteraction.create()).current; 7838 if (!data.hoverInteractionState) { 7839 data.hoverInteractionState = instance; 7840 } 7841 useOnMount(data.hoverInteractionState.disposeEffect); 7842 return data.hoverInteractionState; 7843 } 7844 7845 // node_modules/@base-ui/react/floating-ui-react/hooks/useHoverFloatingInteraction.mjs 7846 function useHoverFloatingInteraction(context, parameters = {}) { 7847 const { 7848 enabled = true, 7849 closeDelay: closeDelayProp = 0, 7850 nodeId: nodeIdProp 7851 } = parameters; 7852 const store3 = "rootStore" in context ? context.rootStore : context; 7853 const open3 = store3.useState("open"); 7854 const floatingElement = store3.useState("floatingElement"); 7855 const domReferenceElement = store3.useState("domReferenceElement"); 7856 const { 7857 dataRef 7858 } = store3.context; 7859 const tree = useFloatingTree(); 7860 const parentId = useFloatingParentNodeId(); 7861 const instance = useHoverInteractionSharedState(store3); 7862 const childClosedTimeout = useTimeout(); 7863 const isClickLikeOpenEvent2 = useStableCallback(() => { 7864 return isClickLikeOpenEvent(dataRef.current.openEvent?.type, instance.interactedInside); 7865 }); 7866 const isHoverOpen = useStableCallback(() => { 7867 return isHoverOpenEvent(dataRef.current.openEvent?.type); 7868 }); 7869 const clearPointerEvents = useStableCallback(() => { 7870 clearSafePolygonPointerEventsMutation(instance); 7871 }); 7872 useIsoLayoutEffect(() => { 7873 if (!open3) { 7874 instance.pointerType = void 0; 7875 instance.restTimeoutPending = false; 7876 instance.interactedInside = false; 7877 clearPointerEvents(); 7878 } 7879 }, [open3, instance, clearPointerEvents]); 7880 React33.useEffect(() => { 7881 return clearPointerEvents; 7882 }, [clearPointerEvents]); 7883 useIsoLayoutEffect(() => { 7884 if (!enabled) { 7885 return void 0; 7886 } 7887 if (open3 && instance.handleCloseOptions?.blockPointerEvents && isHoverOpen() && isElement(domReferenceElement) && floatingElement) { 7888 const ref = domReferenceElement; 7889 const floatingEl = floatingElement; 7890 const doc = ownerDocument(floatingElement); 7891 const parentFloating = tree?.nodesRef.current.find((node) => node.id === parentId)?.context?.elements.floating; 7892 if (parentFloating) { 7893 parentFloating.style.pointerEvents = ""; 7894 } 7895 const cachedScopeElement = instance.pointerEventsScopeElement !== floatingEl ? instance.pointerEventsScopeElement : null; 7896 const parentScopeElement = parentFloating !== floatingEl ? parentFloating : null; 7897 const scopeElement = instance.handleCloseOptions?.getScope?.() ?? cachedScopeElement ?? parentScopeElement ?? ref.closest("[data-rootownerid]") ?? doc.body; 7898 applySafePolygonPointerEventsMutation(instance, { 7899 scopeElement, 7900 referenceElement: ref, 7901 floatingElement: floatingEl 7902 }); 7903 return () => { 7904 clearPointerEvents(); 7905 }; 7906 } 7907 return void 0; 7908 }, [enabled, open3, domReferenceElement, floatingElement, instance, isHoverOpen, tree, parentId, clearPointerEvents]); 7909 React33.useEffect(() => { 7910 if (!enabled) { 7911 return void 0; 7912 } 7913 function hasParentChildren() { 7914 return !!(tree && parentId && getNodeChildren(tree.nodesRef.current, parentId).length > 0); 7915 } 7916 function closeWithDelay(event) { 7917 const closeDelay = getDelay(closeDelayProp, "close", instance.pointerType); 7918 const close = () => { 7919 store3.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerHover, event)); 7920 tree?.events.emit("floating.closed", event); 7921 }; 7922 if (closeDelay) { 7923 instance.openChangeTimeout.start(closeDelay, close); 7924 } else { 7925 instance.openChangeTimeout.clear(); 7926 close(); 7927 } 7928 } 7929 function handleInteractInside(event) { 7930 const target = getTarget(event); 7931 if (!isInteractiveElement(target)) { 7932 instance.interactedInside = false; 7933 return; 7934 } 7935 instance.interactedInside = target?.closest("[aria-haspopup]") != null; 7936 } 7937 function onFloatingMouseEnter() { 7938 instance.openChangeTimeout.clear(); 7939 childClosedTimeout.clear(); 7940 tree?.events.off("floating.closed", onNodeClosed); 7941 clearPointerEvents(); 7942 } 7943 function onFloatingMouseLeave(event) { 7944 if (hasParentChildren() && tree) { 7945 tree.events.on("floating.closed", onNodeClosed); 7946 return; 7947 } 7948 if (isTargetInsideEnabledTrigger(event.relatedTarget, store3.context.triggerElements)) { 7949 return; 7950 } 7951 const currentNodeId = dataRef.current.floatingContext?.nodeId ?? nodeIdProp; 7952 const relatedTarget = event.relatedTarget; 7953 const isMovingIntoDescendantFloating = tree && currentNodeId && isElement(relatedTarget) && getNodeChildren(tree.nodesRef.current, currentNodeId, false).some((node) => contains(node.context?.elements.floating, relatedTarget)); 7954 if (isMovingIntoDescendantFloating) { 7955 return; 7956 } 7957 if (instance.handler) { 7958 instance.handler(event); 7959 return; 7960 } 7961 clearPointerEvents(); 7962 if (isHoverOpen() && !isClickLikeOpenEvent2()) { 7963 closeWithDelay(event); 7964 } 7965 } 7966 function onNodeClosed(event) { 7967 if (!tree || !parentId || hasParentChildren()) { 7968 return; 7969 } 7970 childClosedTimeout.start(0, () => { 7971 tree.events.off("floating.closed", onNodeClosed); 7972 store3.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerHover, event)); 7973 tree.events.emit("floating.closed", event); 7974 }); 7975 } 7976 const floating = floatingElement; 7977 return mergeCleanups(floating && addEventListener(floating, "mouseenter", onFloatingMouseEnter), floating && addEventListener(floating, "mouseleave", onFloatingMouseLeave), floating && addEventListener(floating, "pointerdown", handleInteractInside, true), () => { 7978 tree?.events.off("floating.closed", onNodeClosed); 7979 }); 7980 }, [enabled, floatingElement, store3, dataRef, closeDelayProp, nodeIdProp, isHoverOpen, isClickLikeOpenEvent2, clearPointerEvents, instance, tree, parentId, childClosedTimeout]); 7981 } 7982 7983 // node_modules/@base-ui/react/floating-ui-react/hooks/useHoverReferenceInteraction.mjs 7984 var React34 = __toESM(require_react(), 1); 7985 var ReactDOM5 = __toESM(require_react_dom(), 1); 7986 var EMPTY_REF = { 7987 current: null 7988 }; 7989 function useHoverReferenceInteraction(context, props = {}) { 7990 const { 7991 enabled = true, 7992 delay = 0, 7993 handleClose = null, 7994 mouseOnly = false, 7995 restMs = 0, 7996 move = true, 7997 triggerElementRef = EMPTY_REF, 7998 externalTree, 7999 isActiveTrigger = true, 8000 getHandleCloseContext, 8001 isClosing, 8002 shouldOpen: shouldOpenProp, 8003 guardStaleOpen = false 8004 } = props; 8005 const store3 = "rootStore" in context ? context.rootStore : context; 8006 const { 8007 dataRef, 8008 events 8009 } = store3.context; 8010 const tree = useFloatingTree(externalTree); 8011 const instance = useHoverInteractionSharedState(store3); 8012 const isHoverCloseActiveRef = React34.useRef(false); 8013 const handleCloseRef = useValueAsRef(handleClose); 8014 const delayRef = useValueAsRef(delay); 8015 const restMsRef = useValueAsRef(restMs); 8016 const enabledRef = useValueAsRef(enabled); 8017 const shouldOpenRef = useValueAsRef(shouldOpenProp); 8018 const isClosingRef = useValueAsRef(isClosing); 8019 const isClickLikeOpenEvent2 = useStableCallback(() => { 8020 return isClickLikeOpenEvent(dataRef.current.openEvent?.type, instance.interactedInside); 8021 }); 8022 const checkShouldOpen = useStableCallback(() => { 8023 return shouldOpenRef.current?.() !== false; 8024 }); 8025 const isOverInactiveTrigger = useStableCallback((currentDomReference, currentTarget, target) => { 8026 const allTriggers = store3.context.triggerElements; 8027 if (allTriggers.hasElement(currentTarget)) { 8028 return !currentDomReference || !contains(currentDomReference, currentTarget); 8029 } 8030 if (!isElement(target)) { 8031 return false; 8032 } 8033 const targetElement = target; 8034 return allTriggers.hasMatchingElement((trigger) => contains(trigger, targetElement)) && (!currentDomReference || !contains(currentDomReference, targetElement)); 8035 }); 8036 const cleanupMouseMoveHandler = useStableCallback(() => { 8037 if (!instance.handler) { 8038 return; 8039 } 8040 const doc = ownerDocument(store3.select("domReferenceElement")); 8041 doc.removeEventListener("mousemove", instance.handler); 8042 instance.handler = void 0; 8043 }); 8044 const clearPointerEvents = useStableCallback(() => { 8045 clearSafePolygonPointerEventsMutation(instance); 8046 }); 8047 if (isActiveTrigger) { 8048 instance.handleCloseOptions = handleClose?.__options; 8049 } 8050 React34.useEffect(() => cleanupMouseMoveHandler, [cleanupMouseMoveHandler]); 8051 React34.useEffect(() => { 8052 if (!enabled) { 8053 return void 0; 8054 } 8055 function onOpenChangeLocal(details) { 8056 if (!details.open) { 8057 isHoverCloseActiveRef.current = details.reason === reason_parts_exports.triggerHover; 8058 cleanupMouseMoveHandler(); 8059 instance.openChangeTimeout.clear(); 8060 instance.restTimeout.clear(); 8061 instance.blockMouseMove = true; 8062 instance.restTimeoutPending = false; 8063 } else { 8064 isHoverCloseActiveRef.current = false; 8065 } 8066 } 8067 events.on("openchange", onOpenChangeLocal); 8068 return () => { 8069 events.off("openchange", onOpenChangeLocal); 8070 }; 8071 }, [enabled, events, instance, cleanupMouseMoveHandler]); 8072 React34.useEffect(() => { 8073 if (!enabled) { 8074 return void 0; 8075 } 8076 function closeWithDelay(event, runElseBranch = true) { 8077 const closeDelay = getDelay(delayRef.current, "close", instance.pointerType); 8078 if (closeDelay) { 8079 instance.openChangeTimeout.start(closeDelay, () => { 8080 store3.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerHover, event)); 8081 tree?.events.emit("floating.closed", event); 8082 }); 8083 } else if (runElseBranch) { 8084 instance.openChangeTimeout.clear(); 8085 store3.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerHover, event)); 8086 tree?.events.emit("floating.closed", event); 8087 } 8088 } 8089 const trigger = triggerElementRef.current ?? (isActiveTrigger ? store3.select("domReferenceElement") : null); 8090 if (!isElement(trigger)) { 8091 return void 0; 8092 } 8093 function onMouseEnter(event) { 8094 instance.openChangeTimeout.clear(); 8095 instance.blockMouseMove = false; 8096 if (mouseOnly && !isMouseLikePointerType(instance.pointerType)) { 8097 return; 8098 } 8099 const restMsValue = getRestMs(restMsRef.current); 8100 const openDelay = getDelay(delayRef.current, "open", instance.pointerType); 8101 const eventTarget = getTarget(event); 8102 const currentTarget = event.currentTarget ?? null; 8103 const currentDomReference = store3.select("domReferenceElement"); 8104 let triggerNode = currentTarget; 8105 if (isElement(eventTarget) && !store3.context.triggerElements.hasElement(eventTarget)) { 8106 for (const triggerElement of store3.context.triggerElements.elements()) { 8107 if (contains(triggerElement, eventTarget)) { 8108 triggerNode = triggerElement; 8109 break; 8110 } 8111 } 8112 } 8113 if (isElement(currentTarget) && isElement(currentDomReference) && !store3.context.triggerElements.hasElement(currentTarget) && contains(currentTarget, currentDomReference)) { 8114 triggerNode = currentDomReference; 8115 } 8116 const isOverInactive = triggerNode == null ? false : isOverInactiveTrigger(currentDomReference, triggerNode, eventTarget); 8117 const isOpen = store3.select("open"); 8118 const isInClosingTransition = isClosingRef.current?.() ?? store3.select("transitionStatus") === "ending"; 8119 const isHoverCloseTransition = !isOpen && isInClosingTransition && isHoverCloseActiveRef.current; 8120 const isReenteringSameTriggerDuringCloseTransition = !isOverInactive && isElement(triggerNode) && isElement(currentDomReference) && contains(currentDomReference, triggerNode) && isHoverCloseTransition; 8121 const isRestOnlyDelay = restMsValue > 0 && !openDelay; 8122 const shouldOpenImmediately = isOverInactive && (isOpen || isHoverCloseTransition) || isReenteringSameTriggerDuringCloseTransition; 8123 const shouldOpen = !isOpen || isOverInactive; 8124 if (shouldOpenImmediately) { 8125 if (checkShouldOpen()) { 8126 store3.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerHover, event, triggerNode)); 8127 } 8128 return; 8129 } 8130 if (isRestOnlyDelay) { 8131 return; 8132 } 8133 if (openDelay) { 8134 instance.openChangeTimeout.start(openDelay, () => { 8135 if (shouldOpen && checkShouldOpen()) { 8136 store3.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerHover, event, triggerNode)); 8137 } 8138 }); 8139 } else if (shouldOpen) { 8140 if (checkShouldOpen()) { 8141 store3.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerHover, event, triggerNode)); 8142 } 8143 } 8144 } 8145 function onMouseLeave(event) { 8146 if (isClickLikeOpenEvent2()) { 8147 clearPointerEvents(); 8148 return; 8149 } 8150 cleanupMouseMoveHandler(); 8151 const domReferenceElement = store3.select("domReferenceElement"); 8152 const doc = ownerDocument(domReferenceElement); 8153 instance.restTimeout.clear(); 8154 instance.restTimeoutPending = false; 8155 const handleCloseContextBase = dataRef.current.floatingContext ?? getHandleCloseContext?.(); 8156 if (isTargetInsideEnabledTrigger(event.relatedTarget, store3.context.triggerElements)) { 8157 return; 8158 } 8159 if (handleCloseRef.current && handleCloseContextBase) { 8160 if (!store3.select("open")) { 8161 instance.openChangeTimeout.clear(); 8162 } 8163 const currentTrigger = triggerElementRef.current; 8164 instance.handler = handleCloseRef.current({ 8165 ...handleCloseContextBase, 8166 tree, 8167 x: event.clientX, 8168 y: event.clientY, 8169 onClose() { 8170 clearPointerEvents(); 8171 cleanupMouseMoveHandler(); 8172 if (enabledRef.current && !isClickLikeOpenEvent2() && currentTrigger === store3.select("domReferenceElement")) { 8173 closeWithDelay(event, true); 8174 } 8175 } 8176 }); 8177 doc.addEventListener("mousemove", instance.handler); 8178 instance.handler(event); 8179 return; 8180 } 8181 const shouldClose = instance.pointerType === "touch" ? !contains(store3.select("floatingElement"), event.relatedTarget) : true; 8182 if (shouldClose) { 8183 closeWithDelay(event); 8184 } 8185 } 8186 function onMouseOut(event) { 8187 if (contains(trigger, event.relatedTarget)) { 8188 return; 8189 } 8190 instance.openChangeTimeout.clear(); 8191 instance.restTimeout.clear(); 8192 instance.restTimeoutPending = false; 8193 } 8194 const staleOpenGuard = guardStaleOpen ? addEventListener(trigger, "mouseout", onMouseOut) : void 0; 8195 if (move) { 8196 return mergeCleanups(addEventListener(trigger, "mousemove", onMouseEnter, { 8197 once: true 8198 }), addEventListener(trigger, "mouseenter", onMouseEnter), addEventListener(trigger, "mouseleave", onMouseLeave), staleOpenGuard); 8199 } 8200 return mergeCleanups(addEventListener(trigger, "mouseenter", onMouseEnter), addEventListener(trigger, "mouseleave", onMouseLeave), staleOpenGuard); 8201 }, [cleanupMouseMoveHandler, clearPointerEvents, dataRef, delayRef, store3, enabled, handleCloseRef, instance, isActiveTrigger, isOverInactiveTrigger, isClickLikeOpenEvent2, mouseOnly, move, restMsRef, triggerElementRef, tree, enabledRef, getHandleCloseContext, isClosingRef, checkShouldOpen, guardStaleOpen]); 8202 return React34.useMemo(() => { 8203 if (!enabled) { 8204 return void 0; 8205 } 8206 function setPointerRef(event) { 8207 instance.pointerType = event.pointerType; 8208 } 8209 return { 8210 onPointerDown: setPointerRef, 8211 onPointerEnter: setPointerRef, 8212 onMouseMove(event) { 8213 const { 8214 nativeEvent 8215 } = event; 8216 const trigger = event.currentTarget; 8217 const currentDomReference = store3.select("domReferenceElement"); 8218 const currentOpen = store3.select("open"); 8219 const isOverInactive = isOverInactiveTrigger(currentDomReference, trigger, event.target); 8220 if (mouseOnly && !isMouseLikePointerType(instance.pointerType)) { 8221 return; 8222 } 8223 if (currentOpen && isOverInactive && instance.handleCloseOptions?.blockPointerEvents) { 8224 const floatingElement = store3.select("floatingElement"); 8225 if (floatingElement) { 8226 const scopeElement = instance.handleCloseOptions?.getScope?.() ?? trigger.ownerDocument.body; 8227 applySafePolygonPointerEventsMutation(instance, { 8228 scopeElement, 8229 referenceElement: trigger, 8230 floatingElement 8231 }); 8232 } 8233 } 8234 const restMsValue = getRestMs(restMsRef.current); 8235 if (currentOpen && !isOverInactive || restMsValue === 0) { 8236 return; 8237 } 8238 if (!isOverInactive && instance.restTimeoutPending && event.movementX ** 2 + event.movementY ** 2 < 2) { 8239 return; 8240 } 8241 instance.restTimeout.clear(); 8242 function handleMouseMove() { 8243 instance.restTimeoutPending = false; 8244 if (isClickLikeOpenEvent2()) { 8245 return; 8246 } 8247 const latestOpen = store3.select("open"); 8248 if (!instance.blockMouseMove && (!latestOpen || isOverInactive) && checkShouldOpen()) { 8249 store3.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerHover, nativeEvent, trigger)); 8250 } 8251 } 8252 if (instance.pointerType === "touch") { 8253 ReactDOM5.flushSync(() => { 8254 handleMouseMove(); 8255 }); 8256 } else if (isOverInactive && currentOpen) { 8257 handleMouseMove(); 8258 } else { 8259 instance.restTimeoutPending = true; 8260 instance.restTimeout.start(restMsValue, handleMouseMove); 8261 } 8262 } 8263 }; 8264 }, [enabled, instance, isClickLikeOpenEvent2, isOverInactiveTrigger, mouseOnly, store3, restMsRef, checkShouldOpen]); 8265 } 8266 8267 // node_modules/@base-ui/react/floating-ui-react/safePolygon.mjs 8268 var CURSOR_SPEED_THRESHOLD = 0.1; 8269 var CURSOR_SPEED_THRESHOLD_SQUARED = CURSOR_SPEED_THRESHOLD * CURSOR_SPEED_THRESHOLD; 8270 var POLYGON_BUFFER = 0.5; 8271 function hasIntersectingEdge(pointX, pointY, xi, yi, xj, yj) { 8272 return yi >= pointY !== yj >= pointY && pointX <= (xj - xi) * (pointY - yi) / (yj - yi) + xi; 8273 } 8274 function isPointInQuadrilateral(pointX, pointY, x1, y1, x2, y2, x3, y3, x4, y4) { 8275 let isInsideValue = false; 8276 if (hasIntersectingEdge(pointX, pointY, x1, y1, x2, y2)) { 8277 isInsideValue = !isInsideValue; 8278 } 8279 if (hasIntersectingEdge(pointX, pointY, x2, y2, x3, y3)) { 8280 isInsideValue = !isInsideValue; 8281 } 8282 if (hasIntersectingEdge(pointX, pointY, x3, y3, x4, y4)) { 8283 isInsideValue = !isInsideValue; 8284 } 8285 if (hasIntersectingEdge(pointX, pointY, x4, y4, x1, y1)) { 8286 isInsideValue = !isInsideValue; 8287 } 8288 return isInsideValue; 8289 } 8290 function isInsideRect(pointX, pointY, rect) { 8291 return pointX >= rect.x && pointX <= rect.x + rect.width && pointY >= rect.y && pointY <= rect.y + rect.height; 8292 } 8293 function isInsideAxisAlignedRect(pointX, pointY, x1, y1, x2, y2) { 8294 const minX = Math.min(x1, x2); 8295 const maxX = Math.max(x1, x2); 8296 const minY = Math.min(y1, y2); 8297 const maxY = Math.max(y1, y2); 8298 return pointX >= minX && pointX <= maxX && pointY >= minY && pointY <= maxY; 8299 } 8300 function safePolygon(options = {}) { 8301 const { 8302 blockPointerEvents = false 8303 } = options; 8304 const timeout = new Timeout(); 8305 const fn = ({ 8306 x, 8307 y, 8308 placement, 8309 elements, 8310 onClose, 8311 nodeId, 8312 tree 8313 }) => { 8314 const side = placement?.split("-")[0]; 8315 let hasLanded = false; 8316 let lastX = null; 8317 let lastY = null; 8318 let lastCursorTime = typeof performance !== "undefined" ? performance.now() : 0; 8319 function isCursorMovingSlowly(nextX, nextY) { 8320 const currentTime = performance.now(); 8321 const elapsedTime = currentTime - lastCursorTime; 8322 if (lastX === null || lastY === null || elapsedTime === 0) { 8323 lastX = nextX; 8324 lastY = nextY; 8325 lastCursorTime = currentTime; 8326 return false; 8327 } 8328 const deltaX = nextX - lastX; 8329 const deltaY = nextY - lastY; 8330 const distanceSquared = deltaX * deltaX + deltaY * deltaY; 8331 const thresholdSquared = elapsedTime * elapsedTime * CURSOR_SPEED_THRESHOLD_SQUARED; 8332 lastX = nextX; 8333 lastY = nextY; 8334 lastCursorTime = currentTime; 8335 return distanceSquared < thresholdSquared; 8336 } 8337 function close() { 8338 timeout.clear(); 8339 onClose(); 8340 } 8341 return function onMouseMove(event) { 8342 timeout.clear(); 8343 const domReference = elements.domReference; 8344 const floating = elements.floating; 8345 if (!domReference || !floating || side == null || x == null || y == null) { 8346 return void 0; 8347 } 8348 const { 8349 clientX, 8350 clientY 8351 } = event; 8352 const target = getTarget(event); 8353 const isLeave = event.type === "mouseleave"; 8354 const isOverFloatingEl = contains(floating, target); 8355 const isOverReferenceEl = contains(domReference, target); 8356 if (isOverFloatingEl) { 8357 hasLanded = true; 8358 if (!isLeave) { 8359 return void 0; 8360 } 8361 } 8362 if (isOverReferenceEl) { 8363 hasLanded = false; 8364 if (!isLeave) { 8365 hasLanded = true; 8366 return void 0; 8367 } 8368 } 8369 if (isLeave && isElement(event.relatedTarget) && contains(floating, event.relatedTarget)) { 8370 return void 0; 8371 } 8372 function hasOpenChildNode() { 8373 return Boolean(tree && getNodeChildren(tree.nodesRef.current, nodeId).length > 0); 8374 } 8375 function closeIfNoOpenChild() { 8376 if (!hasOpenChildNode()) { 8377 close(); 8378 } 8379 } 8380 if (hasOpenChildNode()) { 8381 return void 0; 8382 } 8383 const refRect = domReference.getBoundingClientRect(); 8384 const rect = floating.getBoundingClientRect(); 8385 const cursorLeaveFromRight = x > rect.right - rect.width / 2; 8386 const cursorLeaveFromBottom = y > rect.bottom - rect.height / 2; 8387 const isFloatingWider = rect.width > refRect.width; 8388 const isFloatingTaller = rect.height > refRect.height; 8389 const left = (isFloatingWider ? refRect : rect).left; 8390 const right = (isFloatingWider ? refRect : rect).right; 8391 const top = (isFloatingTaller ? refRect : rect).top; 8392 const bottom = (isFloatingTaller ? refRect : rect).bottom; 8393 if (side === "top" && y >= refRect.bottom - 1 || side === "bottom" && y <= refRect.top + 1 || side === "left" && x >= refRect.right - 1 || side === "right" && x <= refRect.left + 1) { 8394 closeIfNoOpenChild(); 8395 return void 0; 8396 } 8397 let isInsideTroughRect = false; 8398 switch (side) { 8399 case "top": 8400 isInsideTroughRect = isInsideAxisAlignedRect(clientX, clientY, left, refRect.top + 1, right, rect.bottom - 1); 8401 break; 8402 case "bottom": 8403 isInsideTroughRect = isInsideAxisAlignedRect(clientX, clientY, left, rect.top + 1, right, refRect.bottom - 1); 8404 break; 8405 case "left": 8406 isInsideTroughRect = isInsideAxisAlignedRect(clientX, clientY, rect.right - 1, bottom, refRect.left + 1, top); 8407 break; 8408 case "right": 8409 isInsideTroughRect = isInsideAxisAlignedRect(clientX, clientY, refRect.right - 1, bottom, rect.left + 1, top); 8410 break; 8411 default: 8412 } 8413 if (isInsideTroughRect) { 8414 return void 0; 8415 } 8416 if (hasLanded && !isInsideRect(clientX, clientY, refRect)) { 8417 closeIfNoOpenChild(); 8418 return void 0; 8419 } 8420 if (!isLeave && isCursorMovingSlowly(clientX, clientY)) { 8421 closeIfNoOpenChild(); 8422 return void 0; 8423 } 8424 let isInsidePolygon = false; 8425 switch (side) { 8426 case "top": { 8427 const cursorXOffset = isFloatingWider ? POLYGON_BUFFER / 2 : POLYGON_BUFFER * 4; 8428 const cursorPointOneX = isFloatingWider ? x + cursorXOffset : cursorLeaveFromRight ? x + cursorXOffset : x - cursorXOffset; 8429 const cursorPointTwoX = isFloatingWider ? x - cursorXOffset : cursorLeaveFromRight ? x + cursorXOffset : x - cursorXOffset; 8430 const cursorPointY = y + POLYGON_BUFFER + 1; 8431 const commonYLeft = cursorLeaveFromRight ? rect.bottom - POLYGON_BUFFER : isFloatingWider ? rect.bottom - POLYGON_BUFFER : rect.top; 8432 const commonYRight = cursorLeaveFromRight ? isFloatingWider ? rect.bottom - POLYGON_BUFFER : rect.top : rect.bottom - POLYGON_BUFFER; 8433 isInsidePolygon = isPointInQuadrilateral(clientX, clientY, cursorPointOneX, cursorPointY, cursorPointTwoX, cursorPointY, rect.left, commonYLeft, rect.right, commonYRight); 8434 break; 8435 } 8436 case "bottom": { 8437 const cursorXOffset = isFloatingWider ? POLYGON_BUFFER / 2 : POLYGON_BUFFER * 4; 8438 const cursorPointOneX = isFloatingWider ? x + cursorXOffset : cursorLeaveFromRight ? x + cursorXOffset : x - cursorXOffset; 8439 const cursorPointTwoX = isFloatingWider ? x - cursorXOffset : cursorLeaveFromRight ? x + cursorXOffset : x - cursorXOffset; 8440 const cursorPointY = y - POLYGON_BUFFER; 8441 const commonYLeft = cursorLeaveFromRight ? rect.top + POLYGON_BUFFER : isFloatingWider ? rect.top + POLYGON_BUFFER : rect.bottom; 8442 const commonYRight = cursorLeaveFromRight ? isFloatingWider ? rect.top + POLYGON_BUFFER : rect.bottom : rect.top + POLYGON_BUFFER; 8443 isInsidePolygon = isPointInQuadrilateral(clientX, clientY, cursorPointOneX, cursorPointY, cursorPointTwoX, cursorPointY, rect.left, commonYLeft, rect.right, commonYRight); 8444 break; 8445 } 8446 case "left": { 8447 const cursorYOffset = isFloatingTaller ? POLYGON_BUFFER / 2 : POLYGON_BUFFER * 4; 8448 const cursorPointOneY = isFloatingTaller ? y + cursorYOffset : cursorLeaveFromBottom ? y + cursorYOffset : y - cursorYOffset; 8449 const cursorPointTwoY = isFloatingTaller ? y - cursorYOffset : cursorLeaveFromBottom ? y + cursorYOffset : y - cursorYOffset; 8450 const cursorPointX = x + POLYGON_BUFFER + 1; 8451 const commonXTop = cursorLeaveFromBottom ? rect.right - POLYGON_BUFFER : isFloatingTaller ? rect.right - POLYGON_BUFFER : rect.left; 8452 const commonXBottom = cursorLeaveFromBottom ? isFloatingTaller ? rect.right - POLYGON_BUFFER : rect.left : rect.right - POLYGON_BUFFER; 8453 isInsidePolygon = isPointInQuadrilateral(clientX, clientY, commonXTop, rect.top, commonXBottom, rect.bottom, cursorPointX, cursorPointOneY, cursorPointX, cursorPointTwoY); 8454 break; 8455 } 8456 case "right": { 8457 const cursorYOffset = isFloatingTaller ? POLYGON_BUFFER / 2 : POLYGON_BUFFER * 4; 8458 const cursorPointOneY = isFloatingTaller ? y + cursorYOffset : cursorLeaveFromBottom ? y + cursorYOffset : y - cursorYOffset; 8459 const cursorPointTwoY = isFloatingTaller ? y - cursorYOffset : cursorLeaveFromBottom ? y + cursorYOffset : y - cursorYOffset; 8460 const cursorPointX = x - POLYGON_BUFFER; 8461 const commonXTop = cursorLeaveFromBottom ? rect.left + POLYGON_BUFFER : isFloatingTaller ? rect.left + POLYGON_BUFFER : rect.right; 8462 const commonXBottom = cursorLeaveFromBottom ? isFloatingTaller ? rect.left + POLYGON_BUFFER : rect.right : rect.left + POLYGON_BUFFER; 8463 isInsidePolygon = isPointInQuadrilateral(clientX, clientY, cursorPointX, cursorPointOneY, cursorPointX, cursorPointTwoY, commonXTop, rect.top, commonXBottom, rect.bottom); 8464 break; 8465 } 8466 default: 8467 } 8468 if (!isInsidePolygon) { 8469 closeIfNoOpenChild(); 8470 } else if (!hasLanded) { 8471 timeout.start(40, closeIfNoOpenChild); 8472 } 8473 return void 0; 8474 }; 8475 }; 8476 fn.__options = { 8477 ...options, 8478 blockPointerEvents 8479 }; 8480 return fn; 8481 } 8482 8483 // node_modules/@base-ui/react/utils/NullStore.mjs 8484 var NullStore = class extends ReactStore { 8485 // `update`/`set`/`notifyAll` funnel through `setState` in the base `Store`, so overriding 8486 // `setState` alone would neutralize them today. They are overridden explicitly so the store stays 8487 // inert even if a future base-class change stops routing a mutator through `setState`. 8488 setState(_newState) { 8489 } 8490 update(_changes) { 8491 } 8492 set(_key, _value) { 8493 } 8494 notifyAll() { 8495 } 8496 }; 8497 8498 // node_modules/@base-ui/utils/inertValue.mjs 8499 function inertValue(value) { 8500 if (isReactVersionAtLeast(19)) { 8501 return value; 8502 } 8503 return value ? "true" : void 0; 8504 } 8505 8506 // node_modules/@base-ui/react/internals/direction-context/DirectionContext.mjs 8507 var React35 = __toESM(require_react(), 1); 8508 var DirectionContext = /* @__PURE__ */ React35.createContext(void 0); 8509 if (true) DirectionContext.displayName = "DirectionContext"; 8510 function useDirection() { 8511 const context = React35.useContext(DirectionContext); 8512 return context?.direction ?? "ltr"; 8513 } 8514 8515 // node_modules/@base-ui/react/internals/useAnchorPositioning.mjs 8516 var React36 = __toESM(require_react(), 1); 8517 8518 // node_modules/@base-ui/react/floating-ui-react/middleware/arrow.mjs 8519 var baseArrow = (options) => ({ 8520 name: "arrow", 8521 options, 8522 async fn(state) { 8523 const { 8524 x, 8525 y, 8526 placement, 8527 rects, 8528 platform: platform3, 8529 elements, 8530 middlewareData 8531 } = state; 8532 const { 8533 element, 8534 padding = 0, 8535 offsetParent = "real" 8536 } = evaluate(options, state) || {}; 8537 if (element == null) { 8538 return {}; 8539 } 8540 const paddingObject = getPaddingObject(padding); 8541 const coords = { 8542 x, 8543 y 8544 }; 8545 const axis = getAlignmentAxis(placement); 8546 const length = getAxisLength(axis); 8547 const arrowDimensions = await platform3.getDimensions(element); 8548 const isYAxis = axis === "y"; 8549 const minProp = isYAxis ? "top" : "left"; 8550 const maxProp = isYAxis ? "bottom" : "right"; 8551 const clientProp = isYAxis ? "clientHeight" : "clientWidth"; 8552 const endDiff = rects.reference[length] + rects.reference[axis] - coords[axis] - rects.floating[length]; 8553 const startDiff = coords[axis] - rects.reference[axis]; 8554 const arrowOffsetParent = offsetParent === "real" ? await platform3.getOffsetParent?.(element) : elements.floating; 8555 let clientSize = elements.floating[clientProp] || rects.floating[length]; 8556 if (!clientSize || !await platform3.isElement?.(arrowOffsetParent)) { 8557 clientSize = elements.floating[clientProp] || rects.floating[length]; 8558 } 8559 const centerToReference = endDiff / 2 - startDiff / 2; 8560 const largestPossiblePadding = clientSize / 2 - arrowDimensions[length] / 2 - 1; 8561 const minPadding = Math.min(paddingObject[minProp], largestPossiblePadding); 8562 const maxPadding = Math.min(paddingObject[maxProp], largestPossiblePadding); 8563 const min2 = minPadding; 8564 const max2 = clientSize - arrowDimensions[length] - maxPadding; 8565 const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference; 8566 const offset4 = clamp(min2, center, max2); 8567 const shouldAddOffset = !middlewareData.arrow && getAlignment(placement) != null && center !== offset4 && rects.reference[length] / 2 - (center < min2 ? minPadding : maxPadding) - arrowDimensions[length] / 2 < 0; 8568 const alignmentOffset = shouldAddOffset ? center < min2 ? center - min2 : center - max2 : 0; 8569 return { 8570 [axis]: coords[axis] + alignmentOffset, 8571 data: { 8572 [axis]: offset4, 8573 centerOffset: center - offset4 - alignmentOffset, 8574 ...shouldAddOffset && { 8575 alignmentOffset 8576 } 8577 }, 8578 reset: shouldAddOffset 8579 }; 8580 } 8581 }); 8582 var arrow4 = (options, deps) => { 8583 const { 8584 name: name2, 8585 fn 8586 } = baseArrow(options); 8587 return { 8588 name: name2, 8589 fn, 8590 options: [options, deps] 8591 }; 8592 }; 8593 8594 // node_modules/@base-ui/react/utils/hideMiddleware.mjs 8595 var hide4 = { 8596 name: "hide", 8597 async fn(state) { 8598 const { 8599 width, 8600 height, 8601 x, 8602 y 8603 } = state.rects.reference; 8604 const anchorHidden2 = width === 0 && height === 0 && x === 0 && y === 0; 8605 const overflow = await state.platform.detectOverflow(state, { 8606 elementContext: "reference" 8607 }); 8608 const referenceHidden = overflow.top - height >= 0 || overflow.right - width >= 0 || overflow.bottom - height >= 0 || overflow.left - width >= 0; 8609 return { 8610 data: { 8611 referenceHidden: referenceHidden || anchorHidden2 8612 } 8613 }; 8614 } 8615 }; 8616 8617 // node_modules/@base-ui/react/utils/adaptiveOriginConstants.mjs 8618 var DEFAULT_SIDES = { 8619 sideX: "left", 8620 sideY: "top" 8621 }; 8622 8623 // node_modules/@base-ui/react/utils/CommonPositionerCssVars.mjs 8624 var availableWidth = "--available-width"; 8625 var availableHeight = "--available-height"; 8626 var anchorWidth = "--anchor-width"; 8627 var anchorHeight = "--anchor-height"; 8628 var transformOrigin = "--transform-origin"; 8629 var positionerWidth = "--positioner-width"; 8630 var positionerHeight = "--positioner-height"; 8631 8632 // node_modules/@base-ui/react/internals/useAnchorPositioning.mjs 8633 var AVAILABLE_WIDTH_VAR = availableWidth; 8634 var AVAILABLE_HEIGHT_VAR = availableHeight; 8635 function getLogicalSide(sideParam, renderedSide, isRtl) { 8636 const isLogicalSideParam = sideParam === "inline-start" || sideParam === "inline-end"; 8637 const logicalRight = isRtl ? "inline-start" : "inline-end"; 8638 const logicalLeft = isRtl ? "inline-end" : "inline-start"; 8639 return { 8640 top: "top", 8641 right: isLogicalSideParam ? logicalRight : "right", 8642 bottom: "bottom", 8643 left: isLogicalSideParam ? logicalLeft : "left" 8644 }[renderedSide]; 8645 } 8646 function getOffsetData(state, sideParam, isRtl) { 8647 const { 8648 rects, 8649 placement 8650 } = state; 8651 const data = { 8652 side: getLogicalSide(sideParam, getSide(placement), isRtl), 8653 align: getAlignment(placement) || "center", 8654 anchor: { 8655 width: rects.reference.width, 8656 height: rects.reference.height 8657 }, 8658 positioner: { 8659 width: rects.floating.width, 8660 height: rects.floating.height 8661 } 8662 }; 8663 return data; 8664 } 8665 function useAnchorPositioning(params) { 8666 return useAnchorPositioningWithHook(params, useBaseUIFloating); 8667 } 8668 function useAnchorPositioningWithHook(params, useFloatingHook) { 8669 const { 8670 // Public parameters 8671 anchor, 8672 positionMethod = "absolute", 8673 side: sideParam = "bottom", 8674 sideOffset = 0, 8675 align = "center", 8676 alignOffset = 0, 8677 collisionBoundary, 8678 collisionPadding: collisionPaddingParam = 5, 8679 sticky = false, 8680 arrowPadding = 5, 8681 disableAnchorTracking = false, 8682 inline: inlineMiddleware, 8683 // Private parameters 8684 keepMounted = false, 8685 floatingRootContext, 8686 mounted, 8687 collisionAvoidance, 8688 shift: shift4, 8689 nodeId, 8690 adaptiveOrigin: adaptiveOrigin2, 8691 lazyFlip = false, 8692 externalTree 8693 } = params; 8694 const [mountSide, setMountSide] = React36.useState(null); 8695 if (!mounted && mountSide !== null) { 8696 setMountSide(null); 8697 } 8698 const collisionAvoidanceSide = collisionAvoidance.side || "flip"; 8699 const collisionAvoidanceAlign = collisionAvoidance.align || "flip"; 8700 const collisionAvoidanceFallbackAxisSide = collisionAvoidance.fallbackAxisSide || "end"; 8701 const shiftCrossAxis = shift4?.crossAxis ?? false; 8702 const shiftRootBoundary = shift4?.rootBoundary; 8703 const anchorFn = typeof anchor === "function" ? anchor : void 0; 8704 const anchorFnCallback = useStableCallback(anchorFn); 8705 const anchorDep = anchorFn ? anchorFnCallback : anchor; 8706 const anchorValueRef = useValueAsRef(anchor); 8707 const mountedRef = useValueAsRef(mounted); 8708 const direction = useDirection(); 8709 const isRtl = direction === "rtl"; 8710 const side = mountSide || { 8711 top: "top", 8712 right: "right", 8713 bottom: "bottom", 8714 left: "left", 8715 "inline-end": isRtl ? "left" : "right", 8716 "inline-start": isRtl ? "right" : "left" 8717 }[sideParam]; 8718 const placement = align === "center" ? side : `$side}-$align}`; 8719 let collisionPadding = collisionPaddingParam; 8720 if (typeof collisionPadding === "number") { 8721 collisionPadding = { 8722 top: collisionPadding, 8723 right: collisionPadding, 8724 bottom: collisionPadding, 8725 left: collisionPadding 8726 }; 8727 } else if (collisionPadding) { 8728 collisionPadding = { 8729 top: collisionPadding.top || 0, 8730 right: collisionPadding.right || 0, 8731 bottom: collisionPadding.bottom || 0, 8732 left: collisionPadding.left || 0 8733 }; 8734 } 8735 const bias = 1; 8736 const biasTop = sideParam === "bottom" ? bias : 0; 8737 const biasBottom = sideParam === "top" ? bias : 0; 8738 const biasLeft = sideParam === "right" ? bias : 0; 8739 const biasRight = sideParam === "left" ? bias : 0; 8740 const commonCollisionProps = { 8741 boundary: collisionBoundary === "clipping-ancestors" ? "clippingAncestors" : collisionBoundary, 8742 padding: collisionPadding 8743 }; 8744 const arrowRef = React36.useRef(null); 8745 const sideOffsetRef = useValueAsRef(sideOffset); 8746 const alignOffsetRef = useValueAsRef(alignOffset); 8747 const sideOffsetDep = typeof sideOffset !== "function" ? sideOffset : 0; 8748 const alignOffsetDep = typeof alignOffset !== "function" ? alignOffset : 0; 8749 const middleware = []; 8750 if (inlineMiddleware) { 8751 middleware.push(inlineMiddleware); 8752 } 8753 middleware.push(offset3((state) => { 8754 const data = getOffsetData(state, sideParam, isRtl); 8755 const sideAxis = typeof sideOffsetRef.current === "function" ? sideOffsetRef.current(data) : sideOffsetRef.current; 8756 const alignAxis = typeof alignOffsetRef.current === "function" ? alignOffsetRef.current(data) : alignOffsetRef.current; 8757 return { 8758 mainAxis: sideAxis, 8759 crossAxis: alignAxis, 8760 alignmentAxis: alignAxis 8761 }; 8762 }, [sideOffsetDep, alignOffsetDep, isRtl, sideParam])); 8763 const shiftDisabled = collisionAvoidanceAlign === "none" && collisionAvoidanceSide !== "shift"; 8764 const crossAxisShiftEnabled = !shiftDisabled && (sticky || shiftCrossAxis || collisionAvoidanceSide === "shift"); 8765 const flipMiddleware = collisionAvoidanceSide === "none" ? null : flip3({ 8766 ...commonCollisionProps, 8767 // Ensure the popup flips if it's been limited by its --available-height and it resizes. 8768 // Since the size() padding is smaller than the flip() padding, flip() will take precedence. 8769 padding: { 8770 top: collisionPadding.top + bias + biasTop, 8771 right: collisionPadding.right + bias + biasRight, 8772 bottom: collisionPadding.bottom + bias + biasBottom, 8773 left: collisionPadding.left + bias + biasLeft 8774 }, 8775 mainAxis: !shiftCrossAxis && collisionAvoidanceSide === "flip", 8776 crossAxis: collisionAvoidanceAlign === "flip" ? "alignment" : false, 8777 fallbackAxisSideDirection: collisionAvoidanceFallbackAxisSide 8778 }); 8779 const shiftMiddleware = shiftDisabled ? null : shift3({ 8780 ...commonCollisionProps, 8781 // Use the Layout Viewport to avoid shifting around when pinch-zooming. 8782 rootBoundary: shiftRootBoundary, 8783 mainAxis: collisionAvoidanceAlign !== "none", 8784 crossAxis: crossAxisShiftEnabled, 8785 limiter: sticky || shiftCrossAxis ? void 0 : limitShift3((limitData) => { 8786 if (!arrowRef.current) { 8787 return {}; 8788 } 8789 const { 8790 width, 8791 height 8792 } = arrowRef.current.getBoundingClientRect(); 8793 const sideAxis = getSideAxis(getSide(limitData.placement)); 8794 const arrowSize = sideAxis === "y" ? width : height; 8795 const offsetAmount = sideAxis === "y" ? collisionPadding.left + collisionPadding.right : collisionPadding.top + collisionPadding.bottom; 8796 return { 8797 offset: arrowSize / 2 + offsetAmount / 2 8798 }; 8799 }) 8800 }, [commonCollisionProps, sticky, shiftCrossAxis, shiftRootBoundary, collisionPadding, collisionAvoidanceAlign]); 8801 if (collisionAvoidanceSide === "shift" || collisionAvoidanceAlign === "shift" || align === "center") { 8802 middleware.push(shiftMiddleware, flipMiddleware); 8803 } else { 8804 middleware.push(flipMiddleware, shiftMiddleware); 8805 } 8806 middleware.push(size3({ 8807 ...commonCollisionProps, 8808 apply({ 8809 elements: { 8810 floating 8811 }, 8812 availableWidth: availableWidth2, 8813 availableHeight: availableHeight2, 8814 rects 8815 }) { 8816 if (!mountedRef.current) { 8817 return; 8818 } 8819 const floatingStyle = floating.style; 8820 floatingStyle.setProperty(AVAILABLE_WIDTH_VAR, `$availableWidth2}px`); 8821 floatingStyle.setProperty(AVAILABLE_HEIGHT_VAR, `$availableHeight2}px`); 8822 const dpr = getWindow(floating).devicePixelRatio || 1; 8823 const { 8824 x: x2, 8825 y: y2, 8826 width, 8827 height 8828 } = rects.reference; 8829 const anchorWidth2 = (Math.round((x2 + width) * dpr) - Math.round(x2 * dpr)) / dpr; 8830 const anchorHeight2 = (Math.round((y2 + height) * dpr) - Math.round(y2 * dpr)) / dpr; 8831 floatingStyle.setProperty(anchorWidth, `$anchorWidth2}px`); 8832 floatingStyle.setProperty(anchorHeight, `$anchorHeight2}px`); 8833 } 8834 }), arrow4((state) => ({ 8835 // `transform-origin` calculations rely on an element existing. If the arrow hasn't been set, 8836 // we'll create a fake element. 8837 element: arrowRef.current || ownerDocument(state.elements.floating).createElement("div"), 8838 // No padding for the fake arrow: it would displace aligned popups on narrow anchors. 8839 padding: arrowRef.current ? arrowPadding : 0, 8840 offsetParent: "floating" 8841 }), [arrowPadding]), { 8842 name: "transformOrigin", 8843 fn(state) { 8844 const { 8845 elements: { 8846 floating 8847 }, 8848 middlewareData: middlewareData2, 8849 placement: renderedPlacement2, 8850 platform: platform3, 8851 rects, 8852 y: y2 8853 } = state; 8854 const renderedSide2 = getSide(renderedPlacement2); 8855 const renderedAlign2 = getAlignment(renderedPlacement2); 8856 const isVertical = getSideAxis(renderedSide2) === "y"; 8857 const arrowEl = arrowRef.current; 8858 const sideOffsetValue = typeof sideOffset === "function" ? sideOffset(getOffsetData(state, sideParam, isRtl)) : sideOffset; 8859 let crossOrigin; 8860 if (!arrowEl && renderedAlign2 && Math.abs(isVertical ? middlewareData2.shift?.x || 0 : middlewareData2.shift?.y || 0) <= 1) { 8861 crossOrigin = renderedAlign2 === "start" === (isVertical && platform3.isRTL?.(floating) === true) ? "100%" : "0%"; 8862 } else { 8863 const arrowOffset = isVertical ? middlewareData2.arrow?.x || 0 : middlewareData2.arrow?.y || 0; 8864 const arrowSize = isVertical ? arrowEl?.clientWidth || 0 : arrowEl?.clientHeight || 0; 8865 crossOrigin = `$arrowOffset + arrowSize / 2}px`; 8866 } 8867 let sideOrigin = renderedSide2 === "top" || renderedSide2 === "left" ? `calc(100% + $sideOffsetValue}px)` : `${-sideOffsetValue}px`; 8868 if (crossAxisShiftEnabled && isVertical && Math.abs(middlewareData2.shift?.y || 0) > sideOffsetValue) { 8869 sideOrigin = `$rects.reference.y + rects.reference.height / 2 - y2}px`; 8870 } 8871 floating.style.setProperty(transformOrigin, isVertical ? `$crossOrigin} $sideOrigin}` : `$sideOrigin} $crossOrigin}`); 8872 return {}; 8873 } 8874 }, hide4, adaptiveOrigin2); 8875 useIsoLayoutEffect(() => { 8876 if (!mounted && floatingRootContext) { 8877 floatingRootContext.update({ 8878 referenceElement: null, 8879 floatingElement: null, 8880 domReferenceElement: null, 8881 positionReference: null 8882 }); 8883 } 8884 }, [mounted, floatingRootContext]); 8885 const autoUpdateOptions = React36.useMemo(() => ({ 8886 ancestorScroll: !disableAnchorTracking, 8887 elementResize: !disableAnchorTracking && typeof ResizeObserver !== "undefined", 8888 layoutShift: !disableAnchorTracking && typeof IntersectionObserver !== "undefined" 8889 }), [disableAnchorTracking]); 8890 const { 8891 refs, 8892 elements, 8893 x, 8894 y, 8895 middlewareData, 8896 update: update2, 8897 placement: renderedPlacement, 8898 context, 8899 isPositioned, 8900 floatingStyles: originalFloatingStyles 8901 } = useFloatingHook({ 8902 rootContext: floatingRootContext, 8903 open: keepMounted ? mounted : void 0, 8904 placement, 8905 middleware, 8906 strategy: positionMethod, 8907 whileElementsMounted: keepMounted ? void 0 : (...args) => autoUpdate(...args, autoUpdateOptions), 8908 nodeId, 8909 externalTree 8910 }); 8911 const { 8912 sideX, 8913 sideY 8914 } = middlewareData.adaptiveOrigin || DEFAULT_SIDES; 8915 const resolvedPosition = isPositioned ? positionMethod : "fixed"; 8916 const floatingStyles = React36.useMemo(() => { 8917 let base; 8918 if (!isPositioned) { 8919 base = { 8920 position: resolvedPosition, 8921 top: 0, 8922 left: 0 8923 }; 8924 } else if (adaptiveOrigin2) { 8925 base = { 8926 position: resolvedPosition, 8927 [sideX]: x, 8928 [sideY]: y 8929 }; 8930 } else { 8931 base = { 8932 ...originalFloatingStyles, 8933 position: resolvedPosition 8934 }; 8935 } 8936 base[AVAILABLE_WIDTH_VAR] = "100vw"; 8937 base[AVAILABLE_HEIGHT_VAR] = "100vh"; 8938 if (!isPositioned) { 8939 base.opacity = 0; 8940 } 8941 return base; 8942 }, [adaptiveOrigin2, resolvedPosition, sideX, x, sideY, y, originalFloatingStyles, isPositioned]); 8943 const registeredPositionReferenceRef = React36.useRef(null); 8944 useIsoLayoutEffect(() => { 8945 if (!mounted) { 8946 return; 8947 } 8948 const anchorValue = anchorValueRef.current; 8949 const resolvedAnchor = typeof anchorValue === "function" ? anchorValue() : anchorValue; 8950 const unwrappedElement = (isRef(resolvedAnchor) ? resolvedAnchor.current : resolvedAnchor) || null; 8951 const finalAnchor = unwrappedElement || null; 8952 if (finalAnchor !== registeredPositionReferenceRef.current) { 8953 refs.setPositionReference(finalAnchor); 8954 registeredPositionReferenceRef.current = finalAnchor; 8955 } 8956 }, [mounted, refs, anchorDep, anchorValueRef]); 8957 React36.useEffect(() => { 8958 if (!mounted) { 8959 return; 8960 } 8961 const anchorValue = anchorValueRef.current; 8962 if (typeof anchorValue === "function") { 8963 return; 8964 } 8965 if (isRef(anchorValue) && anchorValue.current !== registeredPositionReferenceRef.current) { 8966 refs.setPositionReference(anchorValue.current); 8967 registeredPositionReferenceRef.current = anchorValue.current; 8968 } 8969 }, [mounted, refs, anchorDep, anchorValueRef]); 8970 React36.useEffect(() => { 8971 if (keepMounted && mounted && elements.reference && elements.floating) { 8972 return autoUpdate(elements.reference, elements.floating, update2, autoUpdateOptions); 8973 } 8974 return void 0; 8975 }, [keepMounted, mounted, elements, update2, autoUpdateOptions]); 8976 const renderedSide = getSide(renderedPlacement); 8977 const logicalRenderedSide = getLogicalSide(sideParam, renderedSide, isRtl); 8978 const renderedAlign = getAlignment(renderedPlacement) || "center"; 8979 const anchorHidden2 = Boolean(middlewareData.hide?.referenceHidden); 8980 useIsoLayoutEffect(() => { 8981 if (lazyFlip && mounted && isPositioned && renderedSide !== side) { 8982 setMountSide(renderedSide); 8983 } 8984 }, [lazyFlip, mounted, isPositioned, renderedSide, side]); 8985 const arrowStyles = React36.useMemo(() => ({ 8986 position: "absolute", 8987 top: middlewareData.arrow?.y, 8988 left: middlewareData.arrow?.x 8989 }), [middlewareData.arrow]); 8990 const arrowUncentered = middlewareData.arrow?.centerOffset !== 0; 8991 return React36.useMemo(() => ({ 8992 positionerStyles: floatingStyles, 8993 arrowStyles, 8994 arrowRef, 8995 arrowUncentered, 8996 side: logicalRenderedSide, 8997 align: renderedAlign, 8998 physicalSide: renderedSide, 8999 anchorHidden: anchorHidden2, 9000 refs, 9001 context, 9002 isPositioned, 9003 update: update2 9004 }), [floatingStyles, arrowStyles, arrowRef, arrowUncentered, logicalRenderedSide, renderedAlign, renderedSide, anchorHidden2, refs, context, isPositioned, update2]); 9005 } 9006 function isRef(param) { 9007 return param != null && "current" in param; 9008 } 9009 9010 // node_modules/@base-ui/react/internals/getDisabledMountTransitionStyles.mjs 9011 function getDisabledMountTransitionStyles(transitionStatus) { 9012 return transitionStatus === "starting" ? DISABLED_TRANSITIONS_STYLE : EMPTY_OBJECT; 9013 } 9014 9015 // node_modules/@base-ui/react/utils/usePositioner.mjs 9016 function usePositioner(componentProps, state, { 9017 styles, 9018 transitionStatus, 9019 props, 9020 refs, 9021 hidden, 9022 inert = false 9023 }) { 9024 const style = { 9025 ...styles 9026 }; 9027 if (inert) { 9028 style.pointerEvents = "none"; 9029 } 9030 return useRenderElement("div", componentProps, { 9031 state, 9032 ref: refs, 9033 props: [{ 9034 role: "presentation", 9035 hidden, 9036 style 9037 }, getDisabledMountTransitionStyles(transitionStatus), props], 9038 stateAttributesMapping: popupStateMapping 9039 }); 9040 } 9041 9042 // node_modules/@base-ui/react/button/Button.mjs 9043 var React37 = __toESM(require_react(), 1); 9044 var Button3 = /* @__PURE__ */ React37.forwardRef(function Button4(componentProps, forwardedRef) { 9045 const { 9046 render, 9047 className, 9048 disabled: disabled2 = false, 9049 focusableWhenDisabled = false, 9050 nativeButton = true, 9051 style, 9052 ...elementProps 9053 } = componentProps; 9054 const { 9055 getButtonProps, 9056 buttonRef 9057 } = useButton({ 9058 disabled: disabled2, 9059 focusableWhenDisabled, 9060 native: nativeButton 9061 }); 9062 const state = { 9063 disabled: disabled2 9064 }; 9065 return useRenderElement("button", componentProps, { 9066 state, 9067 ref: [forwardedRef, buttonRef], 9068 props: [elementProps, getButtonProps] 9069 }); 9070 }); 9071 if (true) Button3.displayName = "Button"; 9072 9073 // node_modules/@base-ui/react/collapsible/index.parts.mjs 9074 var index_parts_exports = {}; 9075 __export(index_parts_exports, { 9076 Panel: () => CollapsiblePanel, 9077 Root: () => CollapsibleRoot, 9078 Trigger: () => CollapsibleTrigger 9079 }); 9080 9081 // node_modules/@base-ui/react/collapsible/root/CollapsibleRoot.mjs 9082 var React38 = __toESM(require_react(), 1); 9083 9084 // node_modules/@base-ui/react/collapsible/root/stateAttributesMapping.mjs 9085 var collapsibleStateAttributesMapping = { 9086 ...collapsibleOpenStateMapping, 9087 ...transitionStatusMapping 9088 }; 9089 9090 // node_modules/@base-ui/react/collapsible/root/CollapsibleRoot.mjs 9091 var import_jsx_runtime29 = __toESM(require_jsx_runtime(), 1); 9092 var CollapsibleRoot = /* @__PURE__ */ React38.forwardRef(function CollapsibleRoot2(componentProps, forwardedRef) { 9093 const { 9094 render, 9095 className, 9096 defaultOpen = false, 9097 disabled: disabled2 = false, 9098 onOpenChange: onOpenChangeProp, 9099 open: open3, 9100 style, 9101 ...elementProps 9102 } = componentProps; 9103 const onOpenChange = useStableCallback(onOpenChangeProp); 9104 const collapsible = useCollapsibleRoot({ 9105 open: open3, 9106 defaultOpen, 9107 onOpenChange, 9108 disabled: disabled2 9109 }); 9110 const state = React38.useMemo(() => ({ 9111 open: collapsible.open, 9112 disabled: collapsible.disabled, 9113 transitionStatus: collapsible.transitionStatus 9114 }), [collapsible.open, collapsible.disabled, collapsible.transitionStatus]); 9115 const contextValue = React38.useMemo(() => ({ 9116 ...collapsible, 9117 onOpenChange, 9118 state 9119 }), [collapsible, onOpenChange, state]); 9120 const element = useRenderElement("div", componentProps, { 9121 state, 9122 ref: forwardedRef, 9123 props: elementProps, 9124 stateAttributesMapping: collapsibleStateAttributesMapping 9125 }); 9126 return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(CollapsibleRootContext.Provider, { 9127 value: contextValue, 9128 children: element 9129 }); 9130 }); 9131 if (true) CollapsibleRoot.displayName = "CollapsibleRoot"; 9132 9133 // node_modules/@base-ui/react/collapsible/trigger/CollapsibleTrigger.mjs 9134 var React39 = __toESM(require_react(), 1); 9135 var stateAttributesMapping = { 9136 ...triggerOpenStateMapping, 9137 ...transitionStatusMapping 9138 }; 9139 var CollapsibleTrigger = /* @__PURE__ */ React39.forwardRef(function CollapsibleTrigger2(componentProps, forwardedRef) { 9140 const { 9141 panelId, 9142 open: open3, 9143 handleTrigger, 9144 state, 9145 disabled: contextDisabled 9146 } = useCollapsibleRootContext(); 9147 const { 9148 className, 9149 disabled: disabled2 = contextDisabled, 9150 render, 9151 nativeButton = true, 9152 style, 9153 ...elementProps 9154 } = componentProps; 9155 const { 9156 getButtonProps, 9157 buttonRef 9158 } = useButton({ 9159 disabled: disabled2, 9160 focusableWhenDisabled: true, 9161 native: nativeButton 9162 }); 9163 const element = useRenderElement("button", componentProps, { 9164 state, 9165 ref: [forwardedRef, buttonRef], 9166 props: [{ 9167 "aria-controls": open3 ? panelId : void 0, 9168 "aria-expanded": open3, 9169 onClick: handleTrigger 9170 }, elementProps, getButtonProps], 9171 stateAttributesMapping 9172 }); 9173 return element; 9174 }); 9175 if (true) CollapsibleTrigger.displayName = "CollapsibleTrigger"; 9176 9177 // node_modules/@base-ui/react/collapsible/panel/CollapsiblePanel.mjs 9178 var React40 = __toESM(require_react(), 1); 9179 9180 // node_modules/@base-ui/react/collapsible/panel/CollapsiblePanelCssVars.mjs 9181 var collapsiblePanelHeight = "--collapsible-panel-height"; 9182 var collapsiblePanelWidth = "--collapsible-panel-width"; 9183 9184 // node_modules/@base-ui/react/collapsible/panel/CollapsiblePanel.mjs 9185 var CollapsiblePanel = /* @__PURE__ */ React40.forwardRef(function CollapsiblePanel2(componentProps, forwardedRef) { 9186 const { 9187 className, 9188 hiddenUntilFound: hiddenUntilFoundProp, 9189 keepMounted: keepMountedProp, 9190 render, 9191 id: idProp, 9192 style, 9193 ...elementProps 9194 } = componentProps; 9195 if (true) { 9196 React40.useEffect(() => { 9197 if (hiddenUntilFoundProp && keepMountedProp === false) { 9198 warn("The `keepMounted={false}` prop on `Collapsible.Panel` is ignored when `hiddenUntilFound` is enabled, since the panel must remain mounted while closed."); 9199 } 9200 }, [hiddenUntilFoundProp, keepMountedProp]); 9201 } 9202 const { 9203 defaultPanelId, 9204 mounted, 9205 onOpenChange, 9206 open: open3, 9207 setMounted, 9208 setPanelIdState, 9209 setOpen, 9210 state, 9211 transitionStatus 9212 } = useCollapsibleRootContext(); 9213 const hiddenUntilFound = hiddenUntilFoundProp ?? false; 9214 const keepMounted = keepMountedProp ?? false; 9215 const registeredId = idProp || void 0; 9216 const id = registeredId ?? defaultPanelId; 9217 useIsoLayoutEffect(() => { 9218 setPanelIdState((currentId) => registeredId ?? (currentId === null ? void 0 : currentId)); 9219 return () => { 9220 setPanelIdState((currentId) => currentId === registeredId ? null : currentId); 9221 }; 9222 }, [registeredId, setPanelIdState]); 9223 const { 9224 height, 9225 props, 9226 ref, 9227 shouldPreventOpenAnimation, 9228 shouldRender, 9229 transitionStatus: panelTransitionStatus, 9230 width 9231 } = useCollapsiblePanel({ 9232 externalRef: forwardedRef, 9233 hiddenUntilFound, 9234 id, 9235 keepMounted, 9236 mounted, 9237 onOpenChange, 9238 open: open3, 9239 setMounted, 9240 setOpen, 9241 transitionStatus 9242 }); 9243 const panelState = { 9244 ...state, 9245 transitionStatus: panelTransitionStatus 9246 }; 9247 const resolvedStyle = resolveStyle(style, panelState); 9248 const element = useRenderElement("div", { 9249 ...componentProps, 9250 style: void 0 9251 }, { 9252 state: panelState, 9253 ref, 9254 props: [ 9255 props, 9256 { 9257 style: { 9258 [collapsiblePanelHeight]: height === void 0 ? "auto" : `$height}px`, 9259 [collapsiblePanelWidth]: width === void 0 ? "auto" : `$width}px` 9260 } 9261 }, 9262 elementProps, 9263 resolvedStyle ? { 9264 style: resolvedStyle 9265 } : void 0, 9266 // Resolve the public `style` prop so temporary `animationName: 'none'` 9267 // can still win after user's inline styles have been merged. 9268 shouldPreventOpenAnimation ? { 9269 style: { 9270 animationName: "none" 9271 } 9272 } : void 0 9273 ], 9274 stateAttributesMapping: collapsibleStateAttributesMapping 9275 }); 9276 if (!shouldRender) { 9277 return null; 9278 } 9279 return element; 9280 }); 9281 if (true) CollapsiblePanel.displayName = "CollapsiblePanel"; 9282 9283 // node_modules/@base-ui/react/utils/usePopupViewport.mjs 9284 var React44 = __toESM(require_react(), 1); 9285 var ReactDOM6 = __toESM(require_react_dom(), 1); 9286 9287 // node_modules/@base-ui/utils/usePreviousValue.mjs 9288 var React41 = __toESM(require_react(), 1); 9289 function usePreviousValue(value) { 9290 const [state, setState] = React41.useState({ 9291 current: value, 9292 previous: null 9293 }); 9294 if (!Object.is(value, state.current)) { 9295 setState({ 9296 current: value, 9297 previous: state.current 9298 }); 9299 } 9300 return state.previous; 9301 } 9302 9303 // node_modules/@base-ui/react/utils/usePopupAutoResize.mjs 9304 var React42 = __toESM(require_react(), 1); 9305 9306 // node_modules/@base-ui/react/utils/getCssDimensions.mjs 9307 function getCssDimensions2(element) { 9308 const css = getComputedStyle2(element); 9309 let width = parseFloat(css.width) || 0; 9310 let height = parseFloat(css.height) || 0; 9311 const hasOffset = isHTMLElement(element); 9312 const offsetWidth = hasOffset ? element.offsetWidth : width; 9313 const offsetHeight = hasOffset ? element.offsetHeight : height; 9314 const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight; 9315 if (shouldFallback) { 9316 width = offsetWidth; 9317 height = offsetHeight; 9318 } 9319 return { 9320 width, 9321 height 9322 }; 9323 } 9324 9325 // node_modules/@base-ui/react/utils/CommonPopupCssVars.mjs 9326 var popupWidth = "--popup-width"; 9327 var popupHeight = "--popup-height"; 9328 9329 // node_modules/@base-ui/react/utils/usePopupAutoResize.mjs 9330 function usePopupAutoResize(parameters) { 9331 const { 9332 popupElement, 9333 positionerElement, 9334 content, 9335 mounted, 9336 onMeasureLayout: onMeasureLayoutParam, 9337 onMeasureLayoutComplete: onMeasureLayoutCompleteParam, 9338 side, 9339 direction 9340 } = parameters; 9341 const runOnceAnimationsFinish = useAnimationsFinished(popupElement, true); 9342 const animationFrame = useAnimationFrame(); 9343 const committedDimensionsRef = React42.useRef(null); 9344 const isInitialRenderRef = React42.useRef(true); 9345 const restoreAnchoringStylesRef = React42.useRef(NOOP); 9346 const onMeasureLayout = useStableCallback(onMeasureLayoutParam); 9347 const onMeasureLayoutComplete = useStableCallback(onMeasureLayoutCompleteParam); 9348 const anchoringStyles = React42.useMemo(() => getPopupAnchoringStyles(side, direction), [side, direction]); 9349 useIsoLayoutEffect(() => { 9350 if (!mounted) { 9351 restoreAnchoringStylesRef.current = NOOP; 9352 isInitialRenderRef.current = true; 9353 committedDimensionsRef.current = null; 9354 return void 0; 9355 } 9356 if (!popupElement || !positionerElement) { 9357 return void 0; 9358 } 9359 restoreAnchoringStylesRef.current = applyElementStyles(popupElement, anchoringStyles); 9360 setPopupCssSize(popupElement, "auto"); 9361 const restorePopupPosition = overrideElementStyle(popupElement, "position", "static"); 9362 const restorePopupTransform = overrideElementStyle(popupElement, "transform", "none"); 9363 const restorePopupScale = overrideElementStyle(popupElement, "scale", "1"); 9364 const restorePositionerAvailableSize = applyElementStyles(positionerElement, { 9365 [availableWidth]: "max-content", 9366 [availableHeight]: "max-content" 9367 }); 9368 function restoreMeasurementOverrides() { 9369 restorePopupPosition(); 9370 restorePopupTransform(); 9371 restorePositionerAvailableSize(); 9372 } 9373 function restoreMeasurementOverridesIncludingScale() { 9374 restoreMeasurementOverrides(); 9375 restorePopupScale(); 9376 } 9377 onMeasureLayout?.(); 9378 if (isInitialRenderRef.current || committedDimensionsRef.current === null) { 9379 setPositionerCssSize(positionerElement, "max-content"); 9380 const dimensions = getCssDimensions2(popupElement); 9381 committedDimensionsRef.current = dimensions; 9382 setPositionerCssSize(positionerElement, dimensions); 9383 restoreMeasurementOverridesIncludingScale(); 9384 onMeasureLayoutComplete?.(null, dimensions); 9385 isInitialRenderRef.current = false; 9386 return () => { 9387 restoreAnchoringStylesRef.current(); 9388 restoreAnchoringStylesRef.current = NOOP; 9389 }; 9390 } 9391 setPositionerCssSize(positionerElement, "max-content"); 9392 const previousDimensions = committedDimensionsRef.current; 9393 const newDimensions = getCssDimensions2(popupElement); 9394 committedDimensionsRef.current = newDimensions; 9395 setPopupCssSize(popupElement, previousDimensions); 9396 restoreMeasurementOverridesIncludingScale(); 9397 onMeasureLayoutComplete?.(previousDimensions, newDimensions); 9398 setPositionerCssSize(positionerElement, newDimensions); 9399 const abortController = new AbortController(); 9400 animationFrame.request(() => { 9401 setPopupCssSize(popupElement, newDimensions); 9402 runOnceAnimationsFinish(() => { 9403 popupElement.style.setProperty(popupWidth, "auto"); 9404 popupElement.style.setProperty(popupHeight, "auto"); 9405 }, abortController.signal); 9406 }); 9407 return () => { 9408 abortController.abort(); 9409 animationFrame.cancel(); 9410 restoreAnchoringStylesRef.current(); 9411 restoreAnchoringStylesRef.current = NOOP; 9412 }; 9413 }, [content, popupElement, positionerElement, runOnceAnimationsFinish, animationFrame, mounted, onMeasureLayout, onMeasureLayoutComplete, anchoringStyles]); 9414 } 9415 function getPopupAnchoringStyles(side, direction) { 9416 const isPhysicalTop = side === "top"; 9417 const isPhysicalLeft = side === "left" || side === (direction === "rtl" ? "inline-end" : "inline-start"); 9418 if (!isPhysicalTop && !isPhysicalLeft) { 9419 return EMPTY_OBJECT; 9420 } 9421 return { 9422 position: "absolute", 9423 [isPhysicalTop ? "bottom" : "top"]: "0", 9424 [isPhysicalLeft ? "right" : "left"]: "0" 9425 }; 9426 } 9427 function overrideElementStyle(element, property, value) { 9428 const originalValue = element.style.getPropertyValue(property); 9429 element.style.setProperty(property, value); 9430 return () => { 9431 element.style.setProperty(property, originalValue); 9432 }; 9433 } 9434 function applyElementStyles(element, styles) { 9435 const restorers = []; 9436 for (const [key, value] of Object.entries(styles)) { 9437 restorers.push(overrideElementStyle(element, key, value)); 9438 } 9439 return restorers.length ? () => { 9440 restorers.forEach((restore) => restore()); 9441 } : NOOP; 9442 } 9443 function setPopupCssSize(popupElement, size4) { 9444 const width = size4 === "auto" ? "auto" : `$size4.width}px`; 9445 const height = size4 === "auto" ? "auto" : `$size4.height}px`; 9446 popupElement.style.setProperty(popupWidth, width); 9447 popupElement.style.setProperty(popupHeight, height); 9448 } 9449 function setPositionerCssSize(positionerElement, size4) { 9450 const width = size4 === "max-content" ? "max-content" : `$size4.width}px`; 9451 const height = size4 === "max-content" ? "max-content" : `$size4.height}px`; 9452 positionerElement.style.setProperty(positionerWidth, width); 9453 positionerElement.style.setProperty(positionerHeight, height); 9454 } 9455 9456 // node_modules/@base-ui/react/direction-provider/DirectionProvider.mjs 9457 var React43 = __toESM(require_react(), 1); 9458 var import_jsx_runtime30 = __toESM(require_jsx_runtime(), 1); 9459 var DirectionProvider = function DirectionProvider2(props) { 9460 const { 9461 direction = "ltr" 9462 } = props; 9463 const contextValue = React43.useMemo(() => ({ 9464 direction 9465 }), [direction]); 9466 return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(DirectionContext.Provider, { 9467 value: contextValue, 9468 children: props.children 9469 }); 9470 }; 9471 if (true) DirectionProvider.displayName = "DirectionProvider"; 9472 9473 // node_modules/@base-ui/react/utils/adaptiveOriginMiddleware.mjs 9474 var adaptiveOrigin = { 9475 name: "adaptiveOrigin", 9476 async fn(state) { 9477 const { 9478 x: rawX, 9479 y: rawY, 9480 rects: { 9481 floating: floatRect 9482 }, 9483 elements: { 9484 floating 9485 }, 9486 platform: platform3, 9487 strategy, 9488 placement 9489 } = state; 9490 const win = getWindow(floating); 9491 const styles = win.getComputedStyle(floating); 9492 const hasTransition = styles.transitionDuration !== "0s" && styles.transitionDuration !== ""; 9493 if (!hasTransition) { 9494 return { 9495 x: rawX, 9496 y: rawY, 9497 data: DEFAULT_SIDES 9498 }; 9499 } 9500 const offsetParent = await platform3.getOffsetParent?.(floating); 9501 let offsetDimensions = { 9502 width: 0, 9503 height: 0 9504 }; 9505 if (strategy === "fixed" && win?.visualViewport) { 9506 offsetDimensions = { 9507 width: win.visualViewport.width, 9508 height: win.visualViewport.height 9509 }; 9510 } else if (offsetParent === win) { 9511 const doc = ownerDocument(floating); 9512 offsetDimensions = { 9513 width: doc.documentElement.clientWidth, 9514 height: doc.documentElement.clientHeight 9515 }; 9516 } else if (await platform3.isElement?.(offsetParent)) { 9517 offsetDimensions = await platform3.getDimensions(offsetParent); 9518 } 9519 const currentSide = getSide(placement); 9520 let x = rawX; 9521 let y = rawY; 9522 if (currentSide === "left") { 9523 x = offsetDimensions.width - (rawX + floatRect.width); 9524 } 9525 if (currentSide === "top") { 9526 y = offsetDimensions.height - (rawY + floatRect.height); 9527 } 9528 const sideX = currentSide === "left" ? "right" : DEFAULT_SIDES.sideX; 9529 const sideY = currentSide === "top" ? "bottom" : DEFAULT_SIDES.sideY; 9530 return { 9531 x, 9532 y, 9533 data: { 9534 sideX, 9535 sideY 9536 } 9537 }; 9538 } 9539 }; 9540 9541 // node_modules/@base-ui/react/utils/CommonViewportDataAttributes.mjs 9542 var activationDirection = "data-activation-direction"; 9543 9544 // node_modules/@base-ui/react/utils/usePopupViewport.mjs 9545 var import_jsx_runtime31 = __toESM(require_jsx_runtime(), 1); 9546 var popupViewportStateMapping = { 9547 activationDirection: (value) => value ? { 9548 [activationDirection]: value 9549 } : null 9550 }; 9551 function usePopupViewport(parameters) { 9552 const { 9553 store: store3, 9554 side, 9555 children 9556 } = parameters; 9557 const direction = useDirection(); 9558 const activeTrigger = store3.useState("activeTriggerElement"); 9559 const activeTriggerId = store3.useState("activeTriggerId"); 9560 const open3 = store3.useState("open"); 9561 const payload = store3.useState("payload"); 9562 const mounted = store3.useState("mounted"); 9563 const popupElement = store3.useState("popupElement"); 9564 const positionerElement = store3.useState("positionerElement"); 9565 const previousActiveTrigger = usePreviousValue(open3 ? activeTrigger : null); 9566 const currentContentKey = usePopupContentKey(activeTriggerId, payload); 9567 const capturedNodeRef = React44.useRef(null); 9568 const [previousContentNode, setPreviousContentNode] = React44.useState(null); 9569 const [newTriggerOffset, setNewTriggerOffset] = React44.useState(null); 9570 const currentContainerRef = React44.useRef(null); 9571 const previousContainerRef = React44.useRef(null); 9572 const onAnimationsFinished = useAnimationsFinished(currentContainerRef, true); 9573 const cleanupFrame = useAnimationFrame(); 9574 const cleanupControllerRef = React44.useRef(null); 9575 const [previousContentDimensions, setPreviousContentDimensions] = React44.useState(null); 9576 const [showStartingStyleAttribute, setShowStartingStyleAttribute] = React44.useState(false); 9577 useIsoLayoutEffect(() => { 9578 store3.set("adaptiveOrigin", adaptiveOrigin); 9579 return () => { 9580 store3.set("adaptiveOrigin", void 0); 9581 }; 9582 }, [store3]); 9583 const handleMeasureLayout = useStableCallback(() => { 9584 currentContainerRef.current?.style.setProperty("animation", "none"); 9585 currentContainerRef.current?.style.setProperty("transition", "none"); 9586 previousContainerRef.current?.style.setProperty("display", "none"); 9587 }); 9588 const handleMeasureLayoutComplete = useStableCallback((previousDimensions) => { 9589 currentContainerRef.current?.style.removeProperty("animation"); 9590 currentContainerRef.current?.style.removeProperty("transition"); 9591 previousContainerRef.current?.style.removeProperty("display"); 9592 if (previousDimensions) { 9593 setPreviousContentDimensions(previousDimensions); 9594 } 9595 }); 9596 const armViewportCleanup = useStableCallback(() => { 9597 cleanupControllerRef.current?.abort(); 9598 const controller = new AbortController(); 9599 cleanupControllerRef.current = controller; 9600 onAnimationsFinished(() => { 9601 setPreviousContentNode(null); 9602 setPreviousContentDimensions(null); 9603 capturedNodeRef.current = null; 9604 }, controller.signal); 9605 }); 9606 const lastHandledTriggerRef = React44.useRef(null); 9607 useIsoLayoutEffect(() => { 9608 if (!open3 || !mounted) { 9609 lastHandledTriggerRef.current = null; 9610 } 9611 }, [open3, mounted]); 9612 useIsoLayoutEffect(() => { 9613 if (activeTrigger && previousActiveTrigger && activeTrigger !== previousActiveTrigger && lastHandledTriggerRef.current !== activeTrigger && capturedNodeRef.current) { 9614 setPreviousContentNode(capturedNodeRef.current); 9615 setShowStartingStyleAttribute(true); 9616 const offset4 = calculateRelativePosition(previousActiveTrigger, activeTrigger); 9617 setNewTriggerOffset(offset4); 9618 lastHandledTriggerRef.current = activeTrigger; 9619 } 9620 }, [activeTrigger, previousActiveTrigger]); 9621 useIsoLayoutEffect(() => { 9622 if (previousContentNode == null) { 9623 return; 9624 } 9625 cleanupControllerRef.current?.abort(); 9626 setShowStartingStyleAttribute(true); 9627 cleanupFrame.request(() => { 9628 ReactDOM6.flushSync(() => { 9629 setShowStartingStyleAttribute(false); 9630 }); 9631 armViewportCleanup(); 9632 }); 9633 }, [currentContentKey, previousContentNode, armViewportCleanup, cleanupFrame]); 9634 useIsoLayoutEffect(() => { 9635 const source = currentContainerRef.current; 9636 if (!source) { 9637 return; 9638 } 9639 const wrapper = ownerDocument(source).createElement("div"); 9640 for (const child of Array.from(source.childNodes)) { 9641 wrapper.appendChild(child.cloneNode(true)); 9642 } 9643 capturedNodeRef.current = wrapper; 9644 }); 9645 const isTransitioning = previousContentNode != null; 9646 let childrenToRender; 9647 if (!isTransitioning) { 9648 childrenToRender = /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { 9649 "data-current": true, 9650 ref: currentContainerRef, 9651 children 9652 }, currentContentKey); 9653 } else { 9654 childrenToRender = /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(React44.Fragment, { 9655 children: [/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { 9656 "data-previous": true, 9657 inert: inertValue(true), 9658 ref: previousContainerRef, 9659 style: { 9660 ...previousContentDimensions ? { 9661 [popupWidth]: `$previousContentDimensions.width}px`, 9662 [popupHeight]: `$previousContentDimensions.height}px` 9663 } : null, 9664 position: "absolute" 9665 }, 9666 "data-ending-style": showStartingStyleAttribute ? void 0 : "" 9667 }, "previous"), /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { 9668 "data-current": true, 9669 ref: currentContainerRef, 9670 "data-starting-style": showStartingStyleAttribute ? "" : void 0, 9671 children 9672 }, currentContentKey)] 9673 }); 9674 } 9675 useIsoLayoutEffect(() => { 9676 const container = previousContainerRef.current; 9677 if (!container || !previousContentNode) { 9678 return; 9679 } 9680 container.replaceChildren(...Array.from(previousContentNode.childNodes)); 9681 }, [previousContentNode]); 9682 usePopupAutoResize({ 9683 popupElement, 9684 positionerElement, 9685 mounted, 9686 content: payload, 9687 onMeasureLayout: handleMeasureLayout, 9688 onMeasureLayoutComplete: handleMeasureLayoutComplete, 9689 side, 9690 direction 9691 }); 9692 const state = { 9693 activationDirection: getActivationDirection(newTriggerOffset), 9694 transitioning: isTransitioning 9695 }; 9696 return { 9697 children: childrenToRender, 9698 state 9699 }; 9700 } 9701 function getActivationDirection(offset4) { 9702 if (!offset4) { 9703 return void 0; 9704 } 9705 return `$getValueWithTolerance(offset4.horizontal, 5, "right", "left")} $getValueWithTolerance(offset4.vertical, 5, "down", "up")}`; 9706 } 9707 function getValueWithTolerance(value, tolerance, positiveLabel, negativeLabel) { 9708 if (value > tolerance) { 9709 return positiveLabel; 9710 } 9711 if (value < -tolerance) { 9712 return negativeLabel; 9713 } 9714 return ""; 9715 } 9716 function calculateRelativePosition(from, to) { 9717 const fromRect = from.getBoundingClientRect(); 9718 const toRect = to.getBoundingClientRect(); 9719 const fromCenter = { 9720 x: fromRect.left + fromRect.width / 2, 9721 y: fromRect.top + fromRect.height / 2 9722 }; 9723 const toCenter = { 9724 x: toRect.left + toRect.width / 2, 9725 y: toRect.top + toRect.height / 2 9726 }; 9727 return { 9728 horizontal: toCenter.x - fromCenter.x, 9729 vertical: toCenter.y - fromCenter.y 9730 }; 9731 } 9732 function usePopupContentKey(activeTriggerId, payload) { 9733 const [contentKey, setContentKey] = React44.useState(0); 9734 const previousActiveTriggerIdRef = React44.useRef(activeTriggerId); 9735 const previousPayloadRef = React44.useRef(payload); 9736 const pendingPayloadUpdateRef = React44.useRef(false); 9737 useIsoLayoutEffect(() => { 9738 const previousActiveTriggerId = previousActiveTriggerIdRef.current; 9739 const previousPayload = previousPayloadRef.current; 9740 const triggerIdChanged = activeTriggerId !== previousActiveTriggerId; 9741 const payloadChanged = payload !== previousPayload; 9742 if (triggerIdChanged) { 9743 setContentKey((value) => value + 1); 9744 pendingPayloadUpdateRef.current = !payloadChanged; 9745 } else if (pendingPayloadUpdateRef.current && payloadChanged) { 9746 setContentKey((value) => value + 1); 9747 pendingPayloadUpdateRef.current = false; 9748 } 9749 previousActiveTriggerIdRef.current = activeTriggerId; 9750 previousPayloadRef.current = payload; 9751 }, [activeTriggerId, payload]); 9752 return `$activeTriggerId ?? "current"}-$contentKey}`; 9753 } 9754 9755 // node_modules/@base-ui/react/utils/FloatingPortalLite.mjs 9756 var React45 = __toESM(require_react(), 1); 9757 var ReactDOM7 = __toESM(require_react_dom(), 1); 9758 var import_jsx_runtime32 = __toESM(require_jsx_runtime(), 1); 9759 var FloatingPortalLite = /* @__PURE__ */ React45.forwardRef(function FloatingPortalLite2(componentProps, forwardedRef) { 9760 const { 9761 children, 9762 container, 9763 className, 9764 render, 9765 style, 9766 ...elementProps 9767 } = componentProps; 9768 const { 9769 node: portalNode, 9770 subtree: portalSubtree 9771 } = useFloatingPortalNode({ 9772 container, 9773 ref: forwardedRef, 9774 componentProps, 9775 elementProps 9776 }); 9777 if (!portalSubtree && !portalNode) { 9778 return null; 9779 } 9780 return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(React45.Fragment, { 9781 children: [portalSubtree, portalNode && /* @__PURE__ */ ReactDOM7.createPortal(children, portalNode)] 9782 }); 9783 }); 9784 if (true) FloatingPortalLite.displayName = "FloatingPortalLite"; 9785 9786 // node_modules/@base-ui/react/tooltip/index.parts.mjs 9787 var index_parts_exports2 = {}; 9788 __export(index_parts_exports2, { 9789 Arrow: () => TooltipArrow, 9790 Handle: () => TooltipHandle, 9791 Popup: () => TooltipPopup, 9792 Portal: () => TooltipPortal, 9793 Positioner: () => TooltipPositioner, 9794 Provider: () => TooltipProvider, 9795 Root: () => TooltipRoot, 9796 Trigger: () => TooltipTrigger, 9797 Viewport: () => TooltipViewport, 9798 createHandle: () => createTooltipHandle 9799 }); 9800 9801 // node_modules/@base-ui/react/tooltip/root/TooltipRoot.mjs 9802 var React48 = __toESM(require_react(), 1); 9803 9804 // node_modules/@base-ui/react/tooltip/root/TooltipRootContext.mjs 9805 var React46 = __toESM(require_react(), 1); 9806 var TooltipRootContext = /* @__PURE__ */ React46.createContext(void 0); 9807 if (true) TooltipRootContext.displayName = "TooltipRootContext"; 9808 function useTooltipRootContext(optional) { 9809 const context = React46.useContext(TooltipRootContext); 9810 if (context === void 0 && !optional) { 9811 throw new Error(true ? "Base UI: TooltipRootContext is missing. Tooltip parts must be placed within <Tooltip.Root>." : formatErrorMessage_default(72)); 9812 } 9813 return context; 9814 } 9815 9816 // node_modules/@base-ui/react/tooltip/store/TooltipStore.mjs 9817 var React47 = __toESM(require_react(), 1); 9818 var selectors2 = { 9819 ...popupStoreSelectors, 9820 disabled: (state) => state.disabled, 9821 instantType: (state) => state.instantType, 9822 isInstantPhase: (state) => state.isInstantPhase, 9823 trackCursorAxis: (state) => state.trackCursorAxis, 9824 disableHoverablePopup: (state) => state.disableHoverablePopup, 9825 lastOpenChangeReason: (state) => state.openChangeReason, 9826 closeOnClick: (state) => state.closeOnClick, 9827 closeDelay: (state) => state.closeDelay, 9828 adaptiveOrigin: (state) => state.adaptiveOrigin 9829 }; 9830 var TooltipStore = class extends ReactStore { 9831 constructor(initialState, floatingId, nested) { 9832 const triggerElements = new PopupTriggerMap(); 9833 super(createInitialState(initialState, triggerElements, floatingId, nested), createInitialContext(triggerElements), selectors2); 9834 } 9835 setOpen = (nextOpen, eventDetails) => { 9836 applyPopupOpenChange(this, nextOpen, eventDetails, { 9837 extraState: { 9838 openChangeReason: eventDetails.reason 9839 } 9840 }); 9841 }; 9842 // Used by trigger clicks to clear a delayed hover open without reporting a public open-state change. 9843 cancelPendingOpen(event) { 9844 this.state.floatingRootContext.dispatchOpenChange(false, createChangeEventDetails(reason_parts_exports.triggerPress, event)); 9845 } 9846 }; 9847 function createNullTooltipStore() { 9848 const triggerElements = new PopupTriggerMap(); 9849 const store3 = new NullStore(Object.freeze(createInitialState(void 0, triggerElements)), Object.freeze(createInitialContext(triggerElements)), selectors2); 9850 return Object.assign(store3, { 9851 setOpen: NOOP, 9852 cancelPendingOpen: NOOP 9853 }); 9854 } 9855 function createInitialState(initialState, triggerElements, floatingId, nested = false) { 9856 const state = { 9857 ...createInitialPopupStoreState(triggerElements, floatingId, nested), 9858 disabled: false, 9859 instantType: void 0, 9860 isInstantPhase: false, 9861 trackCursorAxis: "none", 9862 disableHoverablePopup: false, 9863 openChangeReason: null, 9864 closeOnClick: true, 9865 closeDelay: 0, 9866 adaptiveOrigin: void 0, 9867 ...initialState 9868 }; 9869 return state; 9870 } 9871 function createInitialContext(triggerElements) { 9872 return { 9873 popupRef: /* @__PURE__ */ React47.createRef(), 9874 onOpenChange: void 0, 9875 onOpenChangeComplete: void 0, 9876 triggerElements 9877 }; 9878 } 9879 9880 // node_modules/@base-ui/react/tooltip/root/TooltipRoot.mjs 9881 var import_jsx_runtime33 = __toESM(require_jsx_runtime(), 1); 9882 var TooltipRoot = fastComponent(function TooltipRoot2(props) { 9883 const { 9884 disabled: disabled2 = false, 9885 defaultOpen = false, 9886 open: openProp, 9887 disableHoverablePopup = false, 9888 trackCursorAxis = "none", 9889 actionsRef, 9890 onOpenChange, 9891 onOpenChangeComplete, 9892 handle, 9893 triggerId: triggerIdProp, 9894 defaultTriggerId: defaultTriggerIdProp = null, 9895 children 9896 } = props; 9897 const store3 = usePopupRootStore((floatingId, nested) => new TooltipStore({ 9898 open: defaultOpen, 9899 openProp, 9900 activeTriggerId: defaultTriggerIdProp, 9901 triggerIdProp 9902 }, floatingId, nested)); 9903 store3.useControlledProp("openProp", openProp); 9904 store3.useControlledProp("triggerIdProp", triggerIdProp); 9905 store3.useContextCallback("onOpenChange", onOpenChange); 9906 store3.useContextCallback("onOpenChangeComplete", onOpenChangeComplete); 9907 const openState = store3.useState("open"); 9908 const open3 = !disabled2 && openState; 9909 const activeTriggerId = store3.useState("activeTriggerId"); 9910 const mounted = store3.useState("mounted"); 9911 const payload = store3.useState("payload"); 9912 store3.useSyncedValues({ 9913 trackCursorAxis, 9914 disableHoverablePopup, 9915 disabled: disabled2 9916 }); 9917 useImplicitActiveTrigger(store3, { 9918 closeOnActiveTriggerUnmount: true 9919 }); 9920 const { 9921 forceUnmount, 9922 transitionStatus 9923 } = useOpenStateTransitions(open3, store3); 9924 const isInstantPhase = store3.useState("isInstantPhase"); 9925 const instantType = store3.useState("instantType"); 9926 const lastOpenChangeReason = store3.useState("lastOpenChangeReason"); 9927 const previousInstantTypeRef = React48.useRef(null); 9928 useIsoLayoutEffect(() => { 9929 if (openState && disabled2) { 9930 store3.setOpen(false, createChangeEventDetails(reason_parts_exports.disabled)); 9931 } 9932 }, [openState, disabled2, store3]); 9933 useIsoLayoutEffect(() => { 9934 if (transitionStatus === "ending" && lastOpenChangeReason === reason_parts_exports.none || transitionStatus !== "ending" && isInstantPhase) { 9935 if (instantType !== "delay") { 9936 previousInstantTypeRef.current = instantType; 9937 } 9938 store3.set("instantType", "delay"); 9939 } else if (previousInstantTypeRef.current !== null) { 9940 store3.set("instantType", previousInstantTypeRef.current); 9941 previousInstantTypeRef.current = null; 9942 } 9943 }, [transitionStatus, isInstantPhase, lastOpenChangeReason, instantType, store3]); 9944 useIsoLayoutEffect(() => { 9945 if (open3) { 9946 if (activeTriggerId == null) { 9947 store3.set("payload", void 0); 9948 } 9949 } 9950 }, [store3, activeTriggerId, open3]); 9951 React48.useImperativeHandle(actionsRef, () => ({ 9952 unmount: forceUnmount, 9953 close: () => store3.setOpen(false, createChangeEventDetails(reason_parts_exports.imperativeAction)) 9954 }), [forceUnmount, store3]); 9955 const shouldRenderInteractions = open3 || mounted || !disabled2 && trackCursorAxis !== "none"; 9956 return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(TooltipRootContext.Provider, { 9957 value: store3, 9958 children: [handle && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(PopupHandleAttachment, { 9959 handle, 9960 store: store3 9961 }), shouldRenderInteractions && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(TooltipInteractions, { 9962 store: store3, 9963 disabled: disabled2, 9964 trackCursorAxis 9965 }), typeof children === "function" ? children({ 9966 payload 9967 }) : children] 9968 }); 9969 }); 9970 if (true) TooltipRoot.displayName = "TooltipRoot"; 9971 function TooltipInteractions({ 9972 store: store3, 9973 disabled: disabled2, 9974 trackCursorAxis 9975 }) { 9976 const floatingRootContext = store3.useState("floatingRootContext"); 9977 const dismiss = useDismiss(floatingRootContext, { 9978 enabled: !disabled2, 9979 referencePress: () => store3.select("closeOnClick") 9980 }); 9981 const clientPoint = useClientPoint(floatingRootContext, { 9982 enabled: !disabled2 && trackCursorAxis !== "none", 9983 axis: trackCursorAxis === "none" ? void 0 : trackCursorAxis 9984 }); 9985 const triggerProps = React48.useMemo(() => mergeProps(clientPoint.reference, dismiss.reference), [clientPoint.reference, dismiss.reference]); 9986 usePopupInteractionProps(store3, { 9987 activeTriggerProps: triggerProps, 9988 inactiveTriggerProps: triggerProps, 9989 popupProps: dismiss.floating ?? EMPTY_OBJECT 9990 }); 9991 return null; 9992 } 9993 9994 // node_modules/@base-ui/react/tooltip/trigger/TooltipTrigger.mjs 9995 var React50 = __toESM(require_react(), 1); 9996 9997 // node_modules/@base-ui/react/tooltip/provider/TooltipProviderContext.mjs 9998 var React49 = __toESM(require_react(), 1); 9999 var TooltipProviderContext = /* @__PURE__ */ React49.createContext(void 0); 10000 if (true) TooltipProviderContext.displayName = "TooltipProviderContext"; 10001 function useTooltipProviderContext() { 10002 return React49.useContext(TooltipProviderContext); 10003 } 10004 10005 // node_modules/@base-ui/react/tooltip/utils/constants.mjs 10006 var OPEN_DELAY = 600; 10007 10008 // node_modules/@base-ui/react/tooltip/trigger/TooltipTrigger.mjs 10009 var TOOLTIP_TRIGGER_IDENTIFIER = "data-base-ui-tooltip-trigger"; 10010 function getTargetElement(event) { 10011 if ("composedPath" in event) { 10012 const path = event.composedPath(); 10013 for (let i = 0; i < path.length; i += 1) { 10014 const element = path[i]; 10015 if (isElement(element)) { 10016 return element; 10017 } 10018 } 10019 } 10020 const target = event.target; 10021 if (isElement(target)) { 10022 return target; 10023 } 10024 return null; 10025 } 10026 function closestEnabledTooltipTrigger(element) { 10027 let current = element; 10028 while (current) { 10029 const trigger = current.closest(`[$TOOLTIP_TRIGGER_IDENTIFIER}]`); 10030 if (trigger) { 10031 return trigger; 10032 } 10033 const root = current.getRootNode(); 10034 current = "host" in root && isElement(root.host) ? root.host : null; 10035 } 10036 return null; 10037 } 10038 var TooltipTrigger = fastComponentRef(function TooltipTrigger2(componentProps, forwardedRef) { 10039 const { 10040 render, 10041 className, 10042 style, 10043 handle, 10044 payload, 10045 disabled: disabledProp, 10046 delay, 10047 closeOnClick = true, 10048 closeDelay, 10049 id: idProp, 10050 ...elementProps 10051 } = componentProps; 10052 const rootContext = useTooltipRootContext(true); 10053 const handleStore = usePopupHandleStore(handle); 10054 const store3 = handleStore ?? rootContext; 10055 if (!store3) { 10056 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)); 10057 } 10058 const thisTriggerId = useBaseUiId(idProp); 10059 const isTriggerActive = store3.useState("isTriggerActive", thisTriggerId); 10060 const isOpenedByThisTrigger = store3.useState("isOpenedByTrigger", thisTriggerId); 10061 const floatingRootContext = store3.useState("floatingRootContext"); 10062 const triggerElementRef = React50.useRef(null); 10063 const closeDelayWithDefault = closeDelay ?? 0; 10064 const { 10065 registerTrigger, 10066 isMountedByThisTrigger 10067 } = useTriggerDataForwarding(thisTriggerId, triggerElementRef, store3, { 10068 payload, 10069 closeOnClick, 10070 closeDelay: closeDelayWithDefault 10071 }); 10072 const providerDelay = useTooltipProviderContext(); 10073 const { 10074 activeIdRef, 10075 delayRef, 10076 isInstantPhase, 10077 hasProvider 10078 } = useDelayGroup(floatingRootContext, { 10079 open: isOpenedByThisTrigger 10080 }); 10081 const hoverInteraction = useHoverInteractionSharedState(floatingRootContext); 10082 store3.useSyncedValue("isInstantPhase", isInstantPhase); 10083 const rootDisabled = store3.useState("disabled"); 10084 const disabled2 = disabledProp ?? rootDisabled; 10085 const disabledRef = useValueAsRef(disabled2); 10086 const trackCursorAxis = store3.useState("trackCursorAxis"); 10087 const disableHoverablePopup = store3.useState("disableHoverablePopup"); 10088 const isNestedTriggerHoveredRef = React50.useRef(false); 10089 const nestedTriggerOpenTimeout = useTimeout(); 10090 const pointerTypeRef = React50.useRef(void 0); 10091 function getOpenDelay() { 10092 if (hasProvider && activeIdRef.current != null) { 10093 return 0; 10094 } 10095 return delay ?? providerDelay ?? OPEN_DELAY; 10096 } 10097 function isEnabledNestedTriggerTarget(target) { 10098 const triggerEl = triggerElementRef.current; 10099 if (!triggerEl || !target) { 10100 return false; 10101 } 10102 const nearestTrigger = closestEnabledTooltipTrigger(target); 10103 return nearestTrigger !== null && nearestTrigger !== triggerEl && contains(triggerEl, nearestTrigger); 10104 } 10105 function detectNestedTriggerHover(target) { 10106 const nestedTriggerHovered = isEnabledNestedTriggerTarget(target); 10107 isNestedTriggerHoveredRef.current = nestedTriggerHovered; 10108 if (nestedTriggerHovered) { 10109 hoverInteraction.openChangeTimeout.clear(); 10110 hoverInteraction.restTimeout.clear(); 10111 hoverInteraction.restTimeoutPending = false; 10112 nestedTriggerOpenTimeout.clear(); 10113 } 10114 return nestedTriggerHovered; 10115 } 10116 const hoverProps = useHoverReferenceInteraction(floatingRootContext, { 10117 enabled: !disabled2, 10118 mouseOnly: true, 10119 move: false, 10120 handleClose: !disableHoverablePopup && trackCursorAxis !== "both" ? safePolygon() : null, 10121 restMs: getOpenDelay, 10122 delay() { 10123 if (closeDelay == null && hasProvider) { 10124 return { 10125 close: getDelay(delayRef.current, "close") 10126 }; 10127 } 10128 return { 10129 close: closeDelayWithDefault 10130 }; 10131 }, 10132 triggerElementRef, 10133 isActiveTrigger: isTriggerActive, 10134 isClosing: () => store3.select("transitionStatus") === "ending", 10135 shouldOpen() { 10136 return !isNestedTriggerHoveredRef.current; 10137 } 10138 }); 10139 const focusProps = useFocus(floatingRootContext, { 10140 enabled: !disabled2 10141 }).reference; 10142 const handleNestedTriggerHover = (event) => { 10143 const wasNestedTriggerHovered = isNestedTriggerHoveredRef.current; 10144 const target = getTargetElement(event); 10145 const nestedTriggerHovered = detectNestedTriggerHover(target); 10146 const triggerEl = triggerElementRef.current; 10147 const targetInsideTrigger = triggerEl && target && contains(triggerEl, target); 10148 if (nestedTriggerHovered && store3.select("open") && store3.select("lastOpenChangeReason") === reason_parts_exports.triggerHover) { 10149 store3.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerHover, event)); 10150 return; 10151 } 10152 if (wasNestedTriggerHovered && !nestedTriggerHovered && targetInsideTrigger && !disabledRef.current && !store3.select("open") && triggerEl && // Match the hover hook's non-strict mouse fallback for mouse-only event sequences. 10153 isMouseLikePointerType(pointerTypeRef.current)) { 10154 const open3 = () => { 10155 if (!isNestedTriggerHoveredRef.current && !disabledRef.current && !store3.select("open")) { 10156 store3.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerHover, event, triggerEl)); 10157 } 10158 }; 10159 const openDelay = getOpenDelay(); 10160 if (openDelay === 0) { 10161 nestedTriggerOpenTimeout.clear(); 10162 open3(); 10163 } else { 10164 nestedTriggerOpenTimeout.start(openDelay, open3); 10165 } 10166 } 10167 }; 10168 const rootTriggerProps = store3.useState("triggerProps", isMountedByThisTrigger); 10169 const shouldApplyRootTriggerProps = isMountedByThisTrigger || trackCursorAxis !== "none"; 10170 const state = { 10171 open: isOpenedByThisTrigger 10172 }; 10173 const element = useRenderElement("button", componentProps, { 10174 state, 10175 ref: [forwardedRef, registerTrigger, triggerElementRef], 10176 props: [hoverProps, focusProps, shouldApplyRootTriggerProps ? rootTriggerProps : void 0, { 10177 onMouseOver(event) { 10178 handleNestedTriggerHover(event.nativeEvent); 10179 }, 10180 onFocus(event) { 10181 if (isEnabledNestedTriggerTarget(getTargetElement(event.nativeEvent))) { 10182 event.preventBaseUIHandler(); 10183 } 10184 }, 10185 onMouseLeave() { 10186 isNestedTriggerHoveredRef.current = false; 10187 nestedTriggerOpenTimeout.clear(); 10188 pointerTypeRef.current = void 0; 10189 }, 10190 onPointerEnter(event) { 10191 pointerTypeRef.current = event.pointerType; 10192 }, 10193 onPointerDown(event) { 10194 pointerTypeRef.current = event.pointerType; 10195 store3.set("closeOnClick", closeOnClick); 10196 if (closeOnClick && !store3.select("open")) { 10197 store3.cancelPendingOpen(event.nativeEvent); 10198 } 10199 }, 10200 onClick(event) { 10201 if (closeOnClick && !store3.select("open")) { 10202 store3.cancelPendingOpen(event.nativeEvent); 10203 } 10204 }, 10205 id: thisTriggerId, 10206 [triggerDisabled]: disabled2 ? "" : void 0, 10207 [TOOLTIP_TRIGGER_IDENTIFIER]: disabled2 ? void 0 : "" 10208 }, elementProps], 10209 stateAttributesMapping: triggerOpenStateMapping2 10210 }); 10211 return element; 10212 }); 10213 if (true) TooltipTrigger.displayName = "TooltipTrigger"; 10214 10215 // node_modules/@base-ui/react/tooltip/portal/TooltipPortal.mjs 10216 var React52 = __toESM(require_react(), 1); 10217 10218 // node_modules/@base-ui/react/tooltip/portal/TooltipPortalContext.mjs 10219 var React51 = __toESM(require_react(), 1); 10220 var TooltipPortalContext = /* @__PURE__ */ React51.createContext(void 0); 10221 if (true) TooltipPortalContext.displayName = "TooltipPortalContext"; 10222 function useTooltipPortalContext() { 10223 const value = React51.useContext(TooltipPortalContext); 10224 if (value === void 0) { 10225 throw new Error(true ? "Base UI: <Tooltip.Portal> is missing." : formatErrorMessage_default(70)); 10226 } 10227 return value; 10228 } 10229 10230 // node_modules/@base-ui/react/tooltip/portal/TooltipPortal.mjs 10231 var import_jsx_runtime34 = __toESM(require_jsx_runtime(), 1); 10232 var TooltipPortal = /* @__PURE__ */ React52.forwardRef(function TooltipPortal2(props, forwardedRef) { 10233 const { 10234 keepMounted = false, 10235 ...portalProps 10236 } = props; 10237 const store3 = useTooltipRootContext(); 10238 const mounted = store3.useState("mounted"); 10239 const shouldRender = mounted || keepMounted; 10240 if (!shouldRender) { 10241 return null; 10242 } 10243 return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(TooltipPortalContext.Provider, { 10244 value: keepMounted, 10245 children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(FloatingPortalLite, { 10246 ref: forwardedRef, 10247 ...portalProps 10248 }) 10249 }); 10250 }); 10251 if (true) TooltipPortal.displayName = "TooltipPortal"; 10252 10253 // node_modules/@base-ui/react/tooltip/positioner/TooltipPositioner.mjs 10254 var React54 = __toESM(require_react(), 1); 10255 10256 // node_modules/@base-ui/react/tooltip/positioner/TooltipPositionerContext.mjs 10257 var React53 = __toESM(require_react(), 1); 10258 var TooltipPositionerContext = /* @__PURE__ */ React53.createContext(void 0); 10259 if (true) TooltipPositionerContext.displayName = "TooltipPositionerContext"; 10260 function useTooltipPositionerContext() { 10261 const context = React53.useContext(TooltipPositionerContext); 10262 if (context === void 0) { 10263 throw new Error(true ? "Base UI: TooltipPositionerContext is missing. TooltipPositioner parts must be placed within <Tooltip.Positioner>." : formatErrorMessage_default(71)); 10264 } 10265 return context; 10266 } 10267 10268 // node_modules/@base-ui/react/tooltip/positioner/TooltipPositioner.mjs 10269 var import_jsx_runtime35 = __toESM(require_jsx_runtime(), 1); 10270 var TooltipPositioner = /* @__PURE__ */ React54.forwardRef(function TooltipPositioner2(componentProps, forwardedRef) { 10271 const { 10272 render, 10273 className, 10274 anchor, 10275 positionMethod = "absolute", 10276 side = "top", 10277 align = "center", 10278 sideOffset = 0, 10279 alignOffset = 0, 10280 collisionBoundary = "clipping-ancestors", 10281 collisionPadding = 5, 10282 arrowPadding = 5, 10283 sticky = false, 10284 disableAnchorTracking = false, 10285 collisionAvoidance = POPUP_COLLISION_AVOIDANCE, 10286 style, 10287 ...elementProps 10288 } = componentProps; 10289 const store3 = useTooltipRootContext(); 10290 const keepMounted = useTooltipPortalContext(); 10291 const open3 = store3.useState("open"); 10292 const mounted = store3.useState("mounted"); 10293 const trackCursorAxis = store3.useState("trackCursorAxis"); 10294 const disableHoverablePopup = store3.useState("disableHoverablePopup"); 10295 const floatingRootContext = store3.useState("floatingRootContext"); 10296 const instantType = store3.useState("instantType"); 10297 const transitionStatus = store3.useState("transitionStatus"); 10298 const adaptiveOrigin2 = store3.useState("adaptiveOrigin"); 10299 const positioning = useAnchorPositioning({ 10300 anchor, 10301 positionMethod, 10302 floatingRootContext, 10303 mounted, 10304 side, 10305 sideOffset, 10306 align, 10307 alignOffset, 10308 collisionBoundary, 10309 collisionPadding, 10310 sticky, 10311 arrowPadding, 10312 disableAnchorTracking, 10313 keepMounted, 10314 collisionAvoidance, 10315 adaptiveOrigin: adaptiveOrigin2 10316 }); 10317 const state = React54.useMemo(() => ({ 10318 open: open3, 10319 side: positioning.side, 10320 align: positioning.align, 10321 anchorHidden: positioning.anchorHidden, 10322 instant: trackCursorAxis !== "none" ? "tracking-cursor" : instantType 10323 }), [open3, positioning.side, positioning.align, positioning.anchorHidden, trackCursorAxis, instantType]); 10324 const element = usePositioner(componentProps, state, { 10325 styles: positioning.positionerStyles, 10326 transitionStatus, 10327 props: elementProps, 10328 refs: [forwardedRef, store3.useStateSetter("positionerElement")], 10329 hidden: !mounted, 10330 inert: !open3 || trackCursorAxis === "both" || disableHoverablePopup 10331 }); 10332 return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(TooltipPositionerContext.Provider, { 10333 value: positioning, 10334 children: element 10335 }); 10336 }); 10337 if (true) TooltipPositioner.displayName = "TooltipPositioner"; 10338 10339 // node_modules/@base-ui/react/tooltip/popup/TooltipPopup.mjs 10340 var React55 = __toESM(require_react(), 1); 10341 var TooltipPopup = /* @__PURE__ */ React55.forwardRef(function TooltipPopup2(componentProps, forwardedRef) { 10342 const { 10343 render, 10344 className, 10345 style, 10346 ...elementProps 10347 } = componentProps; 10348 const store3 = useTooltipRootContext(); 10349 const { 10350 side, 10351 align 10352 } = useTooltipPositionerContext(); 10353 const open3 = store3.useState("open"); 10354 const instantType = store3.useState("instantType"); 10355 const transitionStatus = store3.useState("transitionStatus"); 10356 const popupProps = store3.useState("popupProps"); 10357 const floatingContext = store3.useState("floatingRootContext"); 10358 const disabled2 = store3.useState("disabled"); 10359 const closeDelay = store3.useState("closeDelay"); 10360 useOpenChangeComplete({ 10361 open: open3, 10362 ref: store3.context.popupRef, 10363 onComplete() { 10364 if (open3) { 10365 store3.context.onOpenChangeComplete?.(true); 10366 } 10367 } 10368 }); 10369 useHoverFloatingInteraction(floatingContext, { 10370 enabled: !disabled2, 10371 closeDelay 10372 }); 10373 const setPopupElement = store3.useStateSetter("popupElement"); 10374 const state = { 10375 open: open3, 10376 side, 10377 align, 10378 instant: instantType, 10379 transitionStatus 10380 }; 10381 const element = useRenderElement("div", componentProps, { 10382 state, 10383 ref: [forwardedRef, store3.context.popupRef, setPopupElement], 10384 props: [FOCUSABLE_POPUP_PROPS, popupProps, getDisabledMountTransitionStyles(transitionStatus), elementProps], 10385 stateAttributesMapping: popupTransitionStateMapping 10386 }); 10387 return element; 10388 }); 10389 if (true) TooltipPopup.displayName = "TooltipPopup"; 10390 10391 // node_modules/@base-ui/react/tooltip/arrow/TooltipArrow.mjs 10392 var React56 = __toESM(require_react(), 1); 10393 var TooltipArrow = /* @__PURE__ */ React56.forwardRef(function TooltipArrow2(componentProps, forwardedRef) { 10394 const { 10395 render, 10396 className, 10397 style, 10398 ...elementProps 10399 } = componentProps; 10400 const store3 = useTooltipRootContext(); 10401 const { 10402 arrowRef, 10403 side, 10404 align, 10405 arrowUncentered, 10406 arrowStyles 10407 } = useTooltipPositionerContext(); 10408 const open3 = store3.useState("open"); 10409 const instantType = store3.useState("instantType"); 10410 const state = { 10411 open: open3, 10412 side, 10413 align, 10414 uncentered: arrowUncentered, 10415 instant: instantType 10416 }; 10417 const element = useRenderElement("div", componentProps, { 10418 state, 10419 ref: [forwardedRef, arrowRef], 10420 props: [{ 10421 style: arrowStyles, 10422 "aria-hidden": true 10423 }, elementProps], 10424 stateAttributesMapping: popupStateMapping 10425 }); 10426 return element; 10427 }); 10428 if (true) TooltipArrow.displayName = "TooltipArrow"; 10429 10430 // node_modules/@base-ui/react/tooltip/provider/TooltipProvider.mjs 10431 var React57 = __toESM(require_react(), 1); 10432 var import_jsx_runtime36 = __toESM(require_jsx_runtime(), 1); 10433 var TooltipProvider = function TooltipProvider2(props) { 10434 const { 10435 delay, 10436 closeDelay, 10437 timeout = 400 10438 } = props; 10439 const delayValue = React57.useMemo(() => ({ 10440 open: delay, 10441 close: closeDelay 10442 }), [delay, closeDelay]); 10443 return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(TooltipProviderContext.Provider, { 10444 value: delay, 10445 children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(FloatingDelayGroup, { 10446 delay: delayValue, 10447 timeoutMs: timeout, 10448 children: props.children 10449 }) 10450 }); 10451 }; 10452 if (true) TooltipProvider.displayName = "TooltipProvider"; 10453 10454 // node_modules/@base-ui/react/tooltip/viewport/TooltipViewport.mjs 10455 var React58 = __toESM(require_react(), 1); 10456 var TooltipViewport = /* @__PURE__ */ React58.forwardRef(function TooltipViewport2(componentProps, forwardedRef) { 10457 const { 10458 render, 10459 className, 10460 style, 10461 children, 10462 ...elementProps 10463 } = componentProps; 10464 const store3 = useTooltipRootContext(); 10465 const positioner = useTooltipPositionerContext(); 10466 const instantType = store3.useState("instantType"); 10467 const { 10468 children: childrenToRender, 10469 state: viewportState 10470 } = usePopupViewport({ 10471 store: store3, 10472 side: positioner.side, 10473 children 10474 }); 10475 const state = { 10476 activationDirection: viewportState.activationDirection, 10477 transitioning: viewportState.transitioning, 10478 instant: instantType 10479 }; 10480 return useRenderElement("div", componentProps, { 10481 state, 10482 ref: forwardedRef, 10483 props: [elementProps, { 10484 children: childrenToRender 10485 }], 10486 stateAttributesMapping: popupViewportStateMapping 10487 }); 10488 }); 10489 if (true) TooltipViewport.displayName = "TooltipViewport"; 10490 10491 // node_modules/@base-ui/react/tooltip/store/TooltipHandle.mjs 10492 var TooltipHandle = class extends BasePopupHandle { 10493 constructor() { 10494 super(createNullTooltipStore(), "Tooltip"); 10495 } 10496 /** 10497 * Opens the tooltip and associates it with the trigger with the given id. 10498 * 10499 * This method should only be called in an event handler or an effect (not during rendering). 10500 * 10501 * @param triggerId ID of the trigger to associate with the tooltip. The trigger must be a matching 10502 * `Tooltip.Trigger` with this handle passed as a prop. 10503 */ 10504 open(triggerId) { 10505 this.openByTrigger(triggerId); 10506 } 10507 /** 10508 * Closes the tooltip. 10509 * 10510 * This method should only be called in an event handler or an effect (not during rendering). 10511 */ 10512 close() { 10513 this.closePopup(); 10514 } 10515 /** 10516 * Whether the tooltip is currently open. Returns `false` while no root is attached to the handle. 10517 */ 10518 get isOpen() { 10519 return this.attachedStore?.select("open") ?? false; 10520 } 10521 }; 10522 function createTooltipHandle() { 10523 return new TooltipHandle(); 10524 } 10525 10526 // node_modules/@base-ui/react/use-render/useRender.mjs 10527 function useRender(params) { 10528 return useRenderElement(params.defaultTagName ?? "div", params, params); 10529 } 10530 10531 // packages/ui/build-module/text/text.mjs 10532 var import_element13 = __toESM(require_element(), 1); 10533 var STYLE_HASH_ATTRIBUTE = "data-wp-hash"; 10534 function getRuntime() { 10535 const globalScope = globalThis; 10536 if (globalScope.__wpStyleRuntime) { 10537 return globalScope.__wpStyleRuntime; 10538 } 10539 globalScope.__wpStyleRuntime = { 10540 documents: /* @__PURE__ */ new Map(), 10541 styles: /* @__PURE__ */ new Map(), 10542 injectedStyles: /* @__PURE__ */ new WeakMap() 10543 }; 10544 if (typeof document !== "undefined") { 10545 registerDocument(document); 10546 } 10547 return globalScope.__wpStyleRuntime; 10548 } 10549 function documentContainsStyleHash(targetDocument, hash) { 10550 if (!targetDocument.head) { 10551 return false; 10552 } 10553 for (const style of targetDocument.head.querySelectorAll( 10554 `style[$STYLE_HASH_ATTRIBUTE}]` 10555 )) { 10556 if (style.getAttribute(STYLE_HASH_ATTRIBUTE) === hash) { 10557 return true; 10558 } 10559 } 10560 return false; 10561 } 10562 function injectStyle(targetDocument, hash, css) { 10563 if (!targetDocument.head) { 10564 return; 10565 } 10566 const runtime = getRuntime(); 10567 let injectedStyles = runtime.injectedStyles.get(targetDocument); 10568 if (!injectedStyles) { 10569 injectedStyles = /* @__PURE__ */ new Set(); 10570 runtime.injectedStyles.set(targetDocument, injectedStyles); 10571 } 10572 if (injectedStyles.has(hash)) { 10573 return; 10574 } 10575 if (documentContainsStyleHash(targetDocument, hash)) { 10576 injectedStyles.add(hash); 10577 return; 10578 } 10579 const style = targetDocument.createElement("style"); 10580 style.setAttribute(STYLE_HASH_ATTRIBUTE, hash); 10581 style.appendChild(targetDocument.createTextNode(css)); 10582 targetDocument.head.appendChild(style); 10583 injectedStyles.add(hash); 10584 } 10585 function registerDocument(targetDocument) { 10586 const runtime = getRuntime(); 10587 runtime.documents.set( 10588 targetDocument, 10589 (runtime.documents.get(targetDocument) ?? 0) + 1 10590 ); 10591 for (const [hash, css] of runtime.styles) { 10592 injectStyle(targetDocument, hash, css); 10593 } 10594 return () => { 10595 const count = runtime.documents.get(targetDocument); 10596 if (count === void 0) { 10597 return; 10598 } 10599 if (count <= 1) { 10600 runtime.documents.delete(targetDocument); 10601 return; 10602 } 10603 runtime.documents.set(targetDocument, count - 1); 10604 }; 10605 } 10606 function registerStyle(hash, css) { 10607 const runtime = getRuntime(); 10608 runtime.styles.set(hash, css); 10609 for (const targetDocument of runtime.documents.keys()) { 10610 injectStyle(targetDocument, hash, css); 10611 } 10612 } 10613 if (typeof process === "undefined" || true) { 10614 registerStyle("3167e7d116", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._83ed8a8da5dd50ea__text{text-wrap:pretty;margin:0}._14437cfb77831647__heading-2xl{--_gcd-heading-font-size:var(--wpds-typography-font-size-2xl,32px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-emphasis,600);--_gcd-p-font-size:var(--wpds-typography-font-size-2xl,32px);--_gcd-p-line-height:var(--wpds-typography-line-height-2xl,40px);font-size:var(--wpds-typography-font-size-2xl,32px);line-height:var(--wpds-typography-line-height-2xl,40px)}._14437cfb77831647__heading-2xl,._3c78b7fa9b4072dd__heading-xl{font-family:var(--wpds-typography-font-family-heading,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-weight:var(--wpds-typography-font-weight-emphasis,600)}._3c78b7fa9b4072dd__heading-xl{--_gcd-heading-font-size:var(--wpds-typography-font-size-xl,20px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-emphasis,600);--_gcd-p-font-size:var(--wpds-typography-font-size-xl,20px);--_gcd-p-line-height:var(--wpds-typography-line-height-md,24px);font-size:var(--wpds-typography-font-size-xl,20px);line-height:var(--wpds-typography-line-height-md,24px)}.aa58f227716bcde2__heading-lg{--_gcd-heading-font-size:var(--wpds-typography-font-size-lg,15px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-emphasis,600);--_gcd-p-font-size:var(--wpds-typography-font-size-lg,15px);--_gcd-p-line-height:var(--wpds-typography-line-height-sm,20px);font-size:var(--wpds-typography-font-size-lg,15px)}.aa58f227716bcde2__heading-lg,.fc4da56d8dfe52c4__heading-md{font-family:var(--wpds-typography-font-family-heading,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-weight:var(--wpds-typography-font-weight-emphasis,600);line-height:var(--wpds-typography-line-height-sm,20px)}.fc4da56d8dfe52c4__heading-md{--_gcd-heading-font-size:var(--wpds-typography-font-size-md,13px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-emphasis,600);--_gcd-p-font-size:var(--wpds-typography-font-size-md,13px);--_gcd-p-line-height:var(--wpds-typography-line-height-sm,20px);font-size:var(--wpds-typography-font-size-md,13px)}.a9b78c7c82e8dff7__heading-sm{--_gcd-heading-font-size:var(--wpds-typography-font-size-xs,11px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-emphasis,600);--_gcd-p-font-size:var(--wpds-typography-font-size-xs,11px);--_gcd-p-line-height:var(--wpds-typography-line-height-xs,16px);font-family:var(--wpds-typography-font-family-heading,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wpds-typography-font-size-xs,11px);font-weight:var(--wpds-typography-font-weight-emphasis,600);line-height:var(--wpds-typography-line-height-xs,16px);text-transform:uppercase}._305ff559e52180d5__body-xl{--_gcd-heading-font-size:var(--wpds-typography-font-size-xl,20px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-default,400);--_gcd-p-font-size:var(--wpds-typography-font-size-xl,20px);--_gcd-p-line-height:var(--wpds-typography-line-height-xl,32px);font-size:var(--wpds-typography-font-size-xl,20px);line-height:var(--wpds-typography-line-height-xl,32px)}._305ff559e52180d5__body-xl,.ca1aa3fc2029e958__body-lg{font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-weight:var(--wpds-typography-font-weight-default,400)}.ca1aa3fc2029e958__body-lg{--_gcd-heading-font-size:var(--wpds-typography-font-size-lg,15px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-default,400);--_gcd-p-font-size:var(--wpds-typography-font-size-lg,15px);--_gcd-p-line-height:var(--wpds-typography-line-height-md,24px);font-size:var(--wpds-typography-font-size-lg,15px);line-height:var(--wpds-typography-line-height-md,24px)}._131101940be12424__body-md{--_gcd-heading-font-size:var(--wpds-typography-font-size-md,13px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-default,400);--_gcd-p-font-size:var(--wpds-typography-font-size-md,13px);--_gcd-p-line-height:var(--wpds-typography-line-height-sm,20px);font-size:var(--wpds-typography-font-size-md,13px);line-height:var(--wpds-typography-line-height-sm,20px)}._0e8d87a42c1f75fa__body-sm,._131101940be12424__body-md{font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-weight:var(--wpds-typography-font-weight-default,400)}._0e8d87a42c1f75fa__body-sm{--_gcd-heading-font-size:var(--wpds-typography-font-size-sm,12px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-default,400);--_gcd-p-font-size:var(--wpds-typography-font-size-sm,12px);--_gcd-p-line-height:var(--wpds-typography-line-height-xs,16px);font-size:var(--wpds-typography-font-size-sm,12px);line-height:var(--wpds-typography-line-height-xs,16px)}}}'); 10615 } 10616 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" }; 10617 if (typeof process === "undefined" || true) { 10618 registerStyle("e8e31009f5", "._6defc79820e382c6__button{box-sizing:var(--_gcd-button-box-sizing,border-box);font-family:var(--_gcd-button-font-family,inherit);font-size:var(--_gcd-button-font-size,inherit);font-weight:var(--_gcd-button-font-weight,inherit)}.d2cff2e5dea83bd1__input{box-sizing:var(--_gcd-input-box-sizing,border-box);font-family:var(--_gcd-input-font-family,inherit);font-size:var(--_gcd-input-font-size,inherit);font-weight:var(--_gcd-input-font-weight,inherit);margin:var(--_gcd-input-margin,0);&::placeholder{color:var(--_gcd-input-placeholder-color,var(--wpds-color-foreground-interactive-neutral-weak,#707070))}&:is(textarea,[type=text],[type=password],[type=color],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){background-color:var(--_gcd-input-background-color,transparent);border:var(--_gcd-input-border,none);border-radius:var(--_gcd-input-border-radius,0);box-shadow:var(--_gcd-input-box-shadow,0 0 0 transparent);color:var(--_gcd-input-color,var(--wpds-color-foreground-interactive-neutral,#1e1e1e));&:focus{border-color:var(--_gcd-input-border-color-focus,var(--wp-admin-theme-color));box-shadow:var(--_gcd-input-box-shadow-focus,none);outline:var(--_gcd-input-outline-focus,none)}&:disabled{background:var(--_gcd-input-background-disabled,transparent);border-color:var(--_gcd-input-border-color-disabled,transparent);box-shadow:var(--_gcd-input-box-shadow-disabled,none);color:var(--_gcd-input-color-disabled,var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d))}}&:is(textarea,[type=text],[type=password],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){line-height:var(--_gcd-input-line-height,inherit);min-height:var(--_gcd-input-min-height,auto);padding:var(--_gcd-input-padding,0)}}._547d86373d02e108__textarea{box-sizing:var(--_gcd-textarea-box-sizing,border-box);overflow:var(--_gcd-textarea-overflow,auto);resize:var(--_gcd-textarea-resize,block)}._8c15fd0ed9f28ba4__div{outline:var(--_gcd-div-outline,0 solid transparent)}p._43cec3e1eec1066d__p{font-size:var(--_gcd-p-font-size,13px);line-height:var(--_gcd-p-line-height,1.5);margin:var(--_gcd-p-margin,0)}:is(h1,h2,h3,h4,h5,h6).e97669c6d9a38497__heading{color:var(--_gcd-heading-color,var(--wpds-color-foreground-content-neutral,#1e1e1e));font-size:var(--_gcd-heading-font-size,inherit);font-weight:var(--_gcd-heading-font-weight,var(--wpds-typography-font-weight-emphasis,600));margin:var(--_gcd-heading-margin,0)}._2c0831b0499dbd6e__a,._2c0831b0499dbd6e__a:is(:hover,:focus,:active){border-radius:var(--_gcd-a-border-radius,0);box-shadow:var(--_gcd-a-box-shadow,none);color:var(--_gcd-a-color,inherit);outline:var(--_gcd-a-outline,0 solid transparent);transition:var(--_gcd-a-transition,none)}.c59a0ebebd71fa4a__ol{list-style:var(--_gcd-ol-list-style,none);margin:var(--_gcd-ol-margin,0);padding-block:var(--_gcd-ol-padding-block,0);padding-inline:var(--_gcd-ol-padding-inline,0)}._46b5cb0c8e24e8c9__li{margin:var(--_gcd-li-margin,0)}"); 10619 } 10620 var global_css_defense_default = { "button": "_6defc79820e382c6__button", "input": "d2cff2e5dea83bd1__input", "textarea": "_547d86373d02e108__textarea", "div": "_8c15fd0ed9f28ba4__div", "p": "_43cec3e1eec1066d__p", "heading": "e97669c6d9a38497__heading", "a": "_2c0831b0499dbd6e__a", "ol": "c59a0ebebd71fa4a__ol", "li": "_46b5cb0c8e24e8c9__li" }; 10621 var Text = (0, import_element13.forwardRef)(function Text2({ variant = "body-md", render, className, ...props }, ref) { 10622 const element = useRender({ 10623 render, 10624 defaultTagName: "span", 10625 ref, 10626 props: mergeProps(props, { 10627 className: clsx_default( 10628 style_default.text, 10629 global_css_defense_default.heading, 10630 global_css_defense_default.p, 10631 style_default[variant], 10632 className 10633 ) 10634 }) 10635 }); 10636 return element; 10637 }); 10638 10639 // packages/ui/build-module/tooltip/popup.mjs 10640 var import_element17 = __toESM(require_element(), 1); 10641 10642 // packages/ui/build-module/tooltip/portal.mjs 10643 var import_element14 = __toESM(require_element(), 1); 10644 10645 // packages/ui/build-module/utils/wp-compat-overlay-slot.mjs 10646 var STYLE_HASH_ATTRIBUTE2 = "data-wp-hash"; 10647 function getRuntime2() { 10648 const globalScope = globalThis; 10649 if (globalScope.__wpStyleRuntime) { 10650 return globalScope.__wpStyleRuntime; 10651 } 10652 globalScope.__wpStyleRuntime = { 10653 documents: /* @__PURE__ */ new Map(), 10654 styles: /* @__PURE__ */ new Map(), 10655 injectedStyles: /* @__PURE__ */ new WeakMap() 10656 }; 10657 if (typeof document !== "undefined") { 10658 registerDocument2(document); 10659 } 10660 return globalScope.__wpStyleRuntime; 10661 } 10662 function documentContainsStyleHash2(targetDocument, hash) { 10663 if (!targetDocument.head) { 10664 return false; 10665 } 10666 for (const style of targetDocument.head.querySelectorAll( 10667 `style[$STYLE_HASH_ATTRIBUTE2}]` 10668 )) { 10669 if (style.getAttribute(STYLE_HASH_ATTRIBUTE2) === hash) { 10670 return true; 10671 } 10672 } 10673 return false; 10674 } 10675 function injectStyle2(targetDocument, hash, css) { 10676 if (!targetDocument.head) { 10677 return; 10678 } 10679 const runtime = getRuntime2(); 10680 let injectedStyles = runtime.injectedStyles.get(targetDocument); 10681 if (!injectedStyles) { 10682 injectedStyles = /* @__PURE__ */ new Set(); 10683 runtime.injectedStyles.set(targetDocument, injectedStyles); 10684 } 10685 if (injectedStyles.has(hash)) { 10686 return; 10687 } 10688 if (documentContainsStyleHash2(targetDocument, hash)) { 10689 injectedStyles.add(hash); 10690 return; 10691 } 10692 const style = targetDocument.createElement("style"); 10693 style.setAttribute(STYLE_HASH_ATTRIBUTE2, hash); 10694 style.appendChild(targetDocument.createTextNode(css)); 10695 targetDocument.head.appendChild(style); 10696 injectedStyles.add(hash); 10697 } 10698 function registerDocument2(targetDocument) { 10699 const runtime = getRuntime2(); 10700 runtime.documents.set( 10701 targetDocument, 10702 (runtime.documents.get(targetDocument) ?? 0) + 1 10703 ); 10704 for (const [hash, css] of runtime.styles) { 10705 injectStyle2(targetDocument, hash, css); 10706 } 10707 return () => { 10708 const count = runtime.documents.get(targetDocument); 10709 if (count === void 0) { 10710 return; 10711 } 10712 if (count <= 1) { 10713 runtime.documents.delete(targetDocument); 10714 return; 10715 } 10716 runtime.documents.set(targetDocument, count - 1); 10717 }; 10718 } 10719 function registerStyle2(hash, css) { 10720 const runtime = getRuntime2(); 10721 runtime.styles.set(hash, css); 10722 for (const targetDocument of runtime.documents.keys()) { 10723 injectStyle2(targetDocument, hash, css); 10724 } 10725 } 10726 if (typeof process === "undefined" || true) { 10727 registerStyle2("be37f31c1e", "._11fc52b637ff8a7e__slot{inset:0;isolation:isolate;pointer-events:none;position:fixed;z-index:1000000003}@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._11fc52b637ff8a7e__slot>*{pointer-events:auto}}}"); 10728 } 10729 var wp_compat_overlay_slot_default = { "slot": "_11fc52b637ff8a7e__slot" }; 10730 var WP_COMPAT_OVERLAY_SLOT_ATTRIBUTE = "data-wp-compat-overlay-slot"; 10731 function resolveOwnerDocument() { 10732 return typeof document === "undefined" ? null : document; 10733 } 10734 function isInWordPressEnvironment() { 10735 let topWp; 10736 try { 10737 topWp = window.top?.wp; 10738 } catch { 10739 } 10740 const wp = topWp ?? window.wp; 10741 return typeof wp?.components === "object" && wp.components !== null; 10742 } 10743 var cachedSlot = null; 10744 function ensureSlotIsAccessible(element) { 10745 element.setAttribute("aria-hidden", "false"); 10746 return element; 10747 } 10748 function createSlot(ownerDocument2) { 10749 const element = ownerDocument2.createElement("div"); 10750 element.setAttribute(WP_COMPAT_OVERLAY_SLOT_ATTRIBUTE, ""); 10751 if (wp_compat_overlay_slot_default.slot) { 10752 element.classList.add(wp_compat_overlay_slot_default.slot); 10753 } 10754 ownerDocument2.body.appendChild(element); 10755 return element; 10756 } 10757 function getWpCompatOverlaySlot() { 10758 if (typeof window === "undefined") { 10759 return void 0; 10760 } 10761 if (!isInWordPressEnvironment() && window.__wpUiCompatOverlaySlotEnabled !== true) { 10762 return void 0; 10763 } 10764 const ownerDocument2 = resolveOwnerDocument(); 10765 if (!ownerDocument2 || !ownerDocument2.body) { 10766 return void 0; 10767 } 10768 if (cachedSlot && cachedSlot.ownerDocument === ownerDocument2 && cachedSlot.isConnected) { 10769 return ensureSlotIsAccessible(cachedSlot); 10770 } 10771 const existing = ownerDocument2.querySelector( 10772 `[$WP_COMPAT_OVERLAY_SLOT_ATTRIBUTE}]` 10773 ); 10774 if (existing instanceof HTMLDivElement) { 10775 cachedSlot = ensureSlotIsAccessible(existing); 10776 return cachedSlot; 10777 } 10778 if (cachedSlot?.isConnected) { 10779 cachedSlot.remove(); 10780 } 10781 cachedSlot = ensureSlotIsAccessible(createSlot(ownerDocument2)); 10782 return cachedSlot; 10783 } 10784 10785 // packages/ui/build-module/tooltip/portal.mjs 10786 var import_jsx_runtime37 = __toESM(require_jsx_runtime(), 1); 10787 var Portal = (0, import_element14.forwardRef)( 10788 function TooltipPortal3({ container, ...restProps }, ref) { 10789 return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)( 10790 index_parts_exports2.Portal, 10791 { 10792 container: container ?? getWpCompatOverlaySlot(), 10793 ...restProps, 10794 ref 10795 } 10796 ); 10797 } 10798 ); 10799 10800 // packages/ui/build-module/tooltip/positioner.mjs 10801 var import_element15 = __toESM(require_element(), 1); 10802 var import_jsx_runtime38 = __toESM(require_jsx_runtime(), 1); 10803 var STYLE_HASH_ATTRIBUTE3 = "data-wp-hash"; 10804 function getRuntime3() { 10805 const globalScope = globalThis; 10806 if (globalScope.__wpStyleRuntime) { 10807 return globalScope.__wpStyleRuntime; 10808 } 10809 globalScope.__wpStyleRuntime = { 10810 documents: /* @__PURE__ */ new Map(), 10811 styles: /* @__PURE__ */ new Map(), 10812 injectedStyles: /* @__PURE__ */ new WeakMap() 10813 }; 10814 if (typeof document !== "undefined") { 10815 registerDocument3(document); 10816 } 10817 return globalScope.__wpStyleRuntime; 10818 } 10819 function documentContainsStyleHash3(targetDocument, hash) { 10820 if (!targetDocument.head) { 10821 return false; 10822 } 10823 for (const style of targetDocument.head.querySelectorAll( 10824 `style[$STYLE_HASH_ATTRIBUTE3}]` 10825 )) { 10826 if (style.getAttribute(STYLE_HASH_ATTRIBUTE3) === hash) { 10827 return true; 10828 } 10829 } 10830 return false; 10831 } 10832 function injectStyle3(targetDocument, hash, css) { 10833 if (!targetDocument.head) { 10834 return; 10835 } 10836 const runtime = getRuntime3(); 10837 let injectedStyles = runtime.injectedStyles.get(targetDocument); 10838 if (!injectedStyles) { 10839 injectedStyles = /* @__PURE__ */ new Set(); 10840 runtime.injectedStyles.set(targetDocument, injectedStyles); 10841 } 10842 if (injectedStyles.has(hash)) { 10843 return; 10844 } 10845 if (documentContainsStyleHash3(targetDocument, hash)) { 10846 injectedStyles.add(hash); 10847 return; 10848 } 10849 const style = targetDocument.createElement("style"); 10850 style.setAttribute(STYLE_HASH_ATTRIBUTE3, hash); 10851 style.appendChild(targetDocument.createTextNode(css)); 10852 targetDocument.head.appendChild(style); 10853 injectedStyles.add(hash); 10854 } 10855 function registerDocument3(targetDocument) { 10856 const runtime = getRuntime3(); 10857 runtime.documents.set( 10858 targetDocument, 10859 (runtime.documents.get(targetDocument) ?? 0) + 1 10860 ); 10861 for (const [hash, css] of runtime.styles) { 10862 injectStyle3(targetDocument, hash, css); 10863 } 10864 return () => { 10865 const count = runtime.documents.get(targetDocument); 10866 if (count === void 0) { 10867 return; 10868 } 10869 if (count <= 1) { 10870 runtime.documents.delete(targetDocument); 10871 return; 10872 } 10873 runtime.documents.set(targetDocument, count - 1); 10874 }; 10875 } 10876 function registerStyle3(hash, css) { 10877 const runtime = getRuntime3(); 10878 runtime.styles.set(hash, css); 10879 for (const targetDocument of runtime.documents.keys()) { 10880 injectStyle3(targetDocument, hash, css); 10881 } 10882 } 10883 if (typeof process === "undefined" || true) { 10884 registerStyle3("10f3806643", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._336cd3e4e743482f__box-sizing{box-sizing:border-box;*,:after,:before{box-sizing:inherit}}}}"); 10885 } 10886 var resets_default = { "box-sizing": "_336cd3e4e743482f__box-sizing" }; 10887 if (typeof process === "undefined" || true) { 10888 registerStyle3("19fcc06039", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._480b748dd3510e64__positioner{z-index:var(--wp-ui-tooltip-z-index,initial)}._50096b232db7709d__popup{--_wp-ui-elevation-sm:0 1px 2px rgba(0,0,0,.05),0 2px 3px rgba(0,0,0,.04),0 6px 6px rgba(0,0,0,.03),0 8px 8px rgba(0,0,0,.02);background-color:var(--wpds-color-background-surface-neutral-strong,#fff);border-radius:var(--wpds-border-radius-md,4px);box-shadow:var(--_wp-ui-elevation-sm);color:var(--wpds-color-foreground-content-neutral,#1e1e1e);font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wpds-typography-font-size-sm,12px);line-height:1.4;padding:var(--wpds-dimension-padding-xs,4px) var(--wpds-dimension-padding-sm,8px);@media (forced-colors:active){border-bottom-color:CanvasText;border-bottom-style:solid;border-bottom-width:1px;border-left-color:CanvasText;border-left-style:solid;border-left-width:1px;border-right-color:CanvasText;border-right-style:solid;border-right-width:1px;border-top-color:CanvasText;border-top-style:solid;border-top-width:1px}}}}'); 10889 } 10890 var style_default2 = { "positioner": "_480b748dd3510e64__positioner", "popup": "_50096b232db7709d__popup" }; 10891 var Positioner = (0, import_element15.forwardRef)( 10892 function TooltipPositioner3({ align = "center", className, side = "top", sideOffset = 4, ...props }, ref) { 10893 return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)( 10894 index_parts_exports2.Positioner, 10895 { 10896 ref, 10897 align, 10898 side, 10899 sideOffset, 10900 ...props, 10901 className: clsx_default( 10902 resets_default["box-sizing"], 10903 style_default2.positioner, 10904 className 10905 ) 10906 } 10907 ); 10908 } 10909 ); 10910 10911 // packages/ui/build-module/utils/render-slot-with-children.mjs 10912 var import_element16 = __toESM(require_element(), 1); 10913 function renderSlotWithChildren(slot, defaultSlot, children) { 10914 return (0, import_element16.cloneElement)(slot ?? defaultSlot, { children }); 10915 } 10916 10917 // packages/ui/build-module/utils/theme-provider.mjs 10918 var theme = __toESM(require_theme(), 1); 10919 10920 // packages/ui/build-module/lock-unlock.mjs 10921 var import_private_apis = __toESM(require_private_apis(), 1); 10922 var { lock, unlock } = (0, import_private_apis.__dangerousOptInToUnstableAPIsOnlyForCoreModules)( 10923 "I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.", 10924 "@wordpress/ui" 10925 ); 10926 10927 // packages/ui/build-module/utils/theme-provider.mjs 10928 function getThemeProvider() { 10929 const themePackage = theme; 10930 if (themePackage.ThemeProvider) { 10931 return themePackage.ThemeProvider; 10932 } 10933 if (!themePackage.privateApis) { 10934 throw new Error( 10935 "@wordpress/ui: @wordpress/theme must expose `ThemeProvider` or `privateApis.ThemeProvider`." 10936 ); 10937 } 10938 return unlock( 10939 themePackage.privateApis 10940 ).ThemeProvider; 10941 } 10942 var ThemeProvider = getThemeProvider(); 10943 10944 // packages/ui/build-module/tooltip/popup.mjs 10945 var import_jsx_runtime39 = __toESM(require_jsx_runtime(), 1); 10946 var STYLE_HASH_ATTRIBUTE4 = "data-wp-hash"; 10947 function getRuntime4() { 10948 const globalScope = globalThis; 10949 if (globalScope.__wpStyleRuntime) { 10950 return globalScope.__wpStyleRuntime; 10951 } 10952 globalScope.__wpStyleRuntime = { 10953 documents: /* @__PURE__ */ new Map(), 10954 styles: /* @__PURE__ */ new Map(), 10955 injectedStyles: /* @__PURE__ */ new WeakMap() 10956 }; 10957 if (typeof document !== "undefined") { 10958 registerDocument4(document); 10959 } 10960 return globalScope.__wpStyleRuntime; 10961 } 10962 function documentContainsStyleHash4(targetDocument, hash) { 10963 if (!targetDocument.head) { 10964 return false; 10965 } 10966 for (const style of targetDocument.head.querySelectorAll( 10967 `style[$STYLE_HASH_ATTRIBUTE4}]` 10968 )) { 10969 if (style.getAttribute(STYLE_HASH_ATTRIBUTE4) === hash) { 10970 return true; 10971 } 10972 } 10973 return false; 10974 } 10975 function injectStyle4(targetDocument, hash, css) { 10976 if (!targetDocument.head) { 10977 return; 10978 } 10979 const runtime = getRuntime4(); 10980 let injectedStyles = runtime.injectedStyles.get(targetDocument); 10981 if (!injectedStyles) { 10982 injectedStyles = /* @__PURE__ */ new Set(); 10983 runtime.injectedStyles.set(targetDocument, injectedStyles); 10984 } 10985 if (injectedStyles.has(hash)) { 10986 return; 10987 } 10988 if (documentContainsStyleHash4(targetDocument, hash)) { 10989 injectedStyles.add(hash); 10990 return; 10991 } 10992 const style = targetDocument.createElement("style"); 10993 style.setAttribute(STYLE_HASH_ATTRIBUTE4, hash); 10994 style.appendChild(targetDocument.createTextNode(css)); 10995 targetDocument.head.appendChild(style); 10996 injectedStyles.add(hash); 10997 } 10998 function registerDocument4(targetDocument) { 10999 const runtime = getRuntime4(); 11000 runtime.documents.set( 11001 targetDocument, 11002 (runtime.documents.get(targetDocument) ?? 0) + 1 11003 ); 11004 for (const [hash, css] of runtime.styles) { 11005 injectStyle4(targetDocument, hash, css); 11006 } 11007 return () => { 11008 const count = runtime.documents.get(targetDocument); 11009 if (count === void 0) { 11010 return; 11011 } 11012 if (count <= 1) { 11013 runtime.documents.delete(targetDocument); 11014 return; 11015 } 11016 runtime.documents.set(targetDocument, count - 1); 11017 }; 11018 } 11019 function registerStyle4(hash, css) { 11020 const runtime = getRuntime4(); 11021 runtime.styles.set(hash, css); 11022 for (const targetDocument of runtime.documents.keys()) { 11023 injectStyle4(targetDocument, hash, css); 11024 } 11025 } 11026 if (typeof process === "undefined" || true) { 11027 registerStyle4("19fcc06039", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._480b748dd3510e64__positioner{z-index:var(--wp-ui-tooltip-z-index,initial)}._50096b232db7709d__popup{--_wp-ui-elevation-sm:0 1px 2px rgba(0,0,0,.05),0 2px 3px rgba(0,0,0,.04),0 6px 6px rgba(0,0,0,.03),0 8px 8px rgba(0,0,0,.02);background-color:var(--wpds-color-background-surface-neutral-strong,#fff);border-radius:var(--wpds-border-radius-md,4px);box-shadow:var(--_wp-ui-elevation-sm);color:var(--wpds-color-foreground-content-neutral,#1e1e1e);font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wpds-typography-font-size-sm,12px);line-height:1.4;padding:var(--wpds-dimension-padding-xs,4px) var(--wpds-dimension-padding-sm,8px);@media (forced-colors:active){border-bottom-color:CanvasText;border-bottom-style:solid;border-bottom-width:1px;border-left-color:CanvasText;border-left-style:solid;border-left-width:1px;border-right-color:CanvasText;border-right-style:solid;border-right-width:1px;border-top-color:CanvasText;border-top-style:solid;border-top-width:1px}}}}'); 11028 } 11029 var style_default3 = { "positioner": "_480b748dd3510e64__positioner", "popup": "_50096b232db7709d__popup" }; 11030 var POPUP_COLOR = { background: "#1e1e1e" }; 11031 var Popup = (0, import_element17.forwardRef)(function TooltipPopup3({ portal, positioner, children, className, ...props }, ref) { 11032 const popupContent = /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(ThemeProvider, { color: POPUP_COLOR, children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)( 11033 index_parts_exports2.Popup, 11034 { 11035 ref, 11036 className: clsx_default(style_default3.popup, className), 11037 ...props, 11038 children 11039 } 11040 ) }); 11041 const positionedPopup = renderSlotWithChildren( 11042 positioner, 11043 /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Positioner, {}), 11044 popupContent 11045 ); 11046 return renderSlotWithChildren(portal, /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Portal, {}), positionedPopup); 11047 }); 11048 11049 // packages/ui/build-module/tooltip/trigger.mjs 11050 var import_element18 = __toESM(require_element(), 1); 11051 var import_jsx_runtime40 = __toESM(require_jsx_runtime(), 1); 11052 var Trigger = (0, import_element18.forwardRef)( 11053 function TooltipTrigger3(props, ref) { 11054 return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(index_parts_exports2.Trigger, { ref, ...props }); 11055 } 11056 ); 11057 11058 // packages/ui/build-module/utils/direction-provider.mjs 11059 var import_i18n2 = __toESM(require_i18n(), 1); 11060 var import_jsx_runtime41 = __toESM(require_jsx_runtime(), 1); 11061 function DirectionProvider3({ children }) { 11062 return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(DirectionProvider, { direction: (0, import_i18n2.isRTL)() ? "rtl" : "ltr", children }); 11063 } 11064 11065 // packages/ui/build-module/tooltip/root.mjs 11066 var import_jsx_runtime42 = __toESM(require_jsx_runtime(), 1); 11067 function Root(props) { 11068 return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(DirectionProvider3, { children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(index_parts_exports2.Root, { ...props }) }); 11069 } 11070 11071 // packages/ui/build-module/link/link.mjs 11072 var import_element19 = __toESM(require_element(), 1); 11073 var import_i18n3 = __toESM(require_i18n(), 1); 11074 var import_jsx_runtime43 = __toESM(require_jsx_runtime(), 1); 11075 var STYLE_HASH_ATTRIBUTE5 = "data-wp-hash"; 11076 function getRuntime5() { 11077 const globalScope = globalThis; 11078 if (globalScope.__wpStyleRuntime) { 11079 return globalScope.__wpStyleRuntime; 11080 } 11081 globalScope.__wpStyleRuntime = { 11082 documents: /* @__PURE__ */ new Map(), 11083 styles: /* @__PURE__ */ new Map(), 11084 injectedStyles: /* @__PURE__ */ new WeakMap() 11085 }; 11086 if (typeof document !== "undefined") { 11087 registerDocument5(document); 11088 } 11089 return globalScope.__wpStyleRuntime; 11090 } 11091 function documentContainsStyleHash5(targetDocument, hash) { 11092 if (!targetDocument.head) { 11093 return false; 11094 } 11095 for (const style of targetDocument.head.querySelectorAll( 11096 `style[$STYLE_HASH_ATTRIBUTE5}]` 11097 )) { 11098 if (style.getAttribute(STYLE_HASH_ATTRIBUTE5) === hash) { 11099 return true; 11100 } 11101 } 11102 return false; 11103 } 11104 function injectStyle5(targetDocument, hash, css) { 11105 if (!targetDocument.head) { 11106 return; 11107 } 11108 const runtime = getRuntime5(); 11109 let injectedStyles = runtime.injectedStyles.get(targetDocument); 11110 if (!injectedStyles) { 11111 injectedStyles = /* @__PURE__ */ new Set(); 11112 runtime.injectedStyles.set(targetDocument, injectedStyles); 11113 } 11114 if (injectedStyles.has(hash)) { 11115 return; 11116 } 11117 if (documentContainsStyleHash5(targetDocument, hash)) { 11118 injectedStyles.add(hash); 11119 return; 11120 } 11121 const style = targetDocument.createElement("style"); 11122 style.setAttribute(STYLE_HASH_ATTRIBUTE5, hash); 11123 style.appendChild(targetDocument.createTextNode(css)); 11124 targetDocument.head.appendChild(style); 11125 injectedStyles.add(hash); 11126 } 11127 function registerDocument5(targetDocument) { 11128 const runtime = getRuntime5(); 11129 runtime.documents.set( 11130 targetDocument, 11131 (runtime.documents.get(targetDocument) ?? 0) + 1 11132 ); 11133 for (const [hash, css] of runtime.styles) { 11134 injectStyle5(targetDocument, hash, css); 11135 } 11136 return () => { 11137 const count = runtime.documents.get(targetDocument); 11138 if (count === void 0) { 11139 return; 11140 } 11141 if (count <= 1) { 11142 runtime.documents.delete(targetDocument); 11143 return; 11144 } 11145 runtime.documents.set(targetDocument, count - 1); 11146 }; 11147 } 11148 function registerStyle5(hash, css) { 11149 const runtime = getRuntime5(); 11150 runtime.styles.set(hash, css); 11151 for (const targetDocument of runtime.documents.keys()) { 11152 injectStyle5(targetDocument, hash, css); 11153 } 11154 } 11155 if (typeof process === "undefined" || true) { 11156 registerStyle5("10f3806643", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._336cd3e4e743482f__box-sizing{box-sizing:border-box;*,:after,:before{box-sizing:inherit}}}}"); 11157 } 11158 var resets_default2 = { "box-sizing": "_336cd3e4e743482f__box-sizing" }; 11159 if (typeof process === "undefined" || true) { 11160 registerStyle5("08122b3d53", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{.af79fb116edb0dd7__outset-ring--focus:focus,.dfcfdc28396e5d98__outset-ring--focus-visible:focus-visible,.e5cd9ee879f6403a__outset-ring--focus-within:focus-within,:focus-visible ._81935a08e952f267__outset-ring--focus-parent-visible{--_gcd-a-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));--_gcd-div-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));outline-offset:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px))}._3c9f5ee9fc9c136d__outset-ring--focus-within-except-active:focus-within,.abc777e9713fa711__outset-ring--focus-except-active:focus{outline:none}._3c9f5ee9fc9c136d__outset-ring--focus-within-except-active:focus-within:not(:has(:active)),.abc777e9713fa711__outset-ring--focus-except-active:focus:not(:active){--_gcd-a-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));--_gcd-div-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));outline-offset:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px))}}}"); 11161 } 11162 var focus_module_default = { "outset-ring--focus": "af79fb116edb0dd7__outset-ring--focus", "outset-ring--focus-visible": "dfcfdc28396e5d98__outset-ring--focus-visible", "outset-ring--focus-within": "e5cd9ee879f6403a__outset-ring--focus-within", "outset-ring--focus-parent-visible": "_81935a08e952f267__outset-ring--focus-parent-visible", "outset-ring--focus-except-active": "abc777e9713fa711__outset-ring--focus-except-active", "outset-ring--focus-within-except-active": "_3c9f5ee9fc9c136d__outset-ring--focus-within-except-active" }; 11163 if (typeof process === "undefined" || true) { 11164 registerStyle5("e8e6a9be37", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{.d4250949359b05ce__link{text-decoration-thickness:from-font;text-underline-offset:.2em}.c6055659b8e2cd2c__is-brand,.c6055659b8e2cd2c__is-brand:visited{--_gcd-a-color:var(--wpds-color-foreground-interactive-brand,var(--wp-admin-theme-color,#3858e9));color:var(--wpds-color-foreground-interactive-brand,var(--wp-admin-theme-color,#3858e9))}.c6055659b8e2cd2c__is-brand:active,.c6055659b8e2cd2c__is-brand:hover{--_gcd-a-color:var(--wpds-color-foreground-interactive-brand-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 52%,#000));color:var(--wpds-color-foreground-interactive-brand-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 52%,#000))}._92e0dfcaeee15b88__is-neutral,._92e0dfcaeee15b88__is-neutral:visited{--_gcd-a-color:var(--wpds-color-foreground-interactive-neutral,#1e1e1e);color:var(--wpds-color-foreground-interactive-neutral,#1e1e1e);text-decoration-color:var(--wpds-color-stroke-interactive-neutral,#8d8d8d)}._92e0dfcaeee15b88__is-neutral:active,._92e0dfcaeee15b88__is-neutral:hover{--_gcd-a-color:var(--wpds-color-foreground-interactive-neutral-active,#1e1e1e);color:var(--wpds-color-foreground-interactive-neutral-active,#1e1e1e)}.cf122a9bf1035d42__is-unstyled{--_gcd-a-color:inherit;color:inherit;text-decoration:none}._0cb411afac4c86c7__link-icon{display:inline-block;font-weight:var(--wpds-typography-font-weight-default,400);line-height:1;margin-inline-start:var(--wpds-dimension-padding-xs,4px);text-decoration:none}._0cb411afac4c86c7__link-icon:after{content:"\\2197"}._0cb411afac4c86c7__link-icon:dir(rtl):after{content:"\\2196"}}}'); 11165 } 11166 var style_default4 = { "link": "d4250949359b05ce__link", "is-brand": "c6055659b8e2cd2c__is-brand", "is-neutral": "_92e0dfcaeee15b88__is-neutral", "is-unstyled": "cf122a9bf1035d42__is-unstyled", "link-icon": "_0cb411afac4c86c7__link-icon" }; 11167 if (typeof process === "undefined" || true) { 11168 registerStyle5("e8e31009f5", "._6defc79820e382c6__button{box-sizing:var(--_gcd-button-box-sizing,border-box);font-family:var(--_gcd-button-font-family,inherit);font-size:var(--_gcd-button-font-size,inherit);font-weight:var(--_gcd-button-font-weight,inherit)}.d2cff2e5dea83bd1__input{box-sizing:var(--_gcd-input-box-sizing,border-box);font-family:var(--_gcd-input-font-family,inherit);font-size:var(--_gcd-input-font-size,inherit);font-weight:var(--_gcd-input-font-weight,inherit);margin:var(--_gcd-input-margin,0);&::placeholder{color:var(--_gcd-input-placeholder-color,var(--wpds-color-foreground-interactive-neutral-weak,#707070))}&:is(textarea,[type=text],[type=password],[type=color],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){background-color:var(--_gcd-input-background-color,transparent);border:var(--_gcd-input-border,none);border-radius:var(--_gcd-input-border-radius,0);box-shadow:var(--_gcd-input-box-shadow,0 0 0 transparent);color:var(--_gcd-input-color,var(--wpds-color-foreground-interactive-neutral,#1e1e1e));&:focus{border-color:var(--_gcd-input-border-color-focus,var(--wp-admin-theme-color));box-shadow:var(--_gcd-input-box-shadow-focus,none);outline:var(--_gcd-input-outline-focus,none)}&:disabled{background:var(--_gcd-input-background-disabled,transparent);border-color:var(--_gcd-input-border-color-disabled,transparent);box-shadow:var(--_gcd-input-box-shadow-disabled,none);color:var(--_gcd-input-color-disabled,var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d))}}&:is(textarea,[type=text],[type=password],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){line-height:var(--_gcd-input-line-height,inherit);min-height:var(--_gcd-input-min-height,auto);padding:var(--_gcd-input-padding,0)}}._547d86373d02e108__textarea{box-sizing:var(--_gcd-textarea-box-sizing,border-box);overflow:var(--_gcd-textarea-overflow,auto);resize:var(--_gcd-textarea-resize,block)}._8c15fd0ed9f28ba4__div{outline:var(--_gcd-div-outline,0 solid transparent)}p._43cec3e1eec1066d__p{font-size:var(--_gcd-p-font-size,13px);line-height:var(--_gcd-p-line-height,1.5);margin:var(--_gcd-p-margin,0)}:is(h1,h2,h3,h4,h5,h6).e97669c6d9a38497__heading{color:var(--_gcd-heading-color,var(--wpds-color-foreground-content-neutral,#1e1e1e));font-size:var(--_gcd-heading-font-size,inherit);font-weight:var(--_gcd-heading-font-weight,var(--wpds-typography-font-weight-emphasis,600));margin:var(--_gcd-heading-margin,0)}._2c0831b0499dbd6e__a,._2c0831b0499dbd6e__a:is(:hover,:focus,:active){border-radius:var(--_gcd-a-border-radius,0);box-shadow:var(--_gcd-a-box-shadow,none);color:var(--_gcd-a-color,inherit);outline:var(--_gcd-a-outline,0 solid transparent);transition:var(--_gcd-a-transition,none)}.c59a0ebebd71fa4a__ol{list-style:var(--_gcd-ol-list-style,none);margin:var(--_gcd-ol-margin,0);padding-block:var(--_gcd-ol-padding-block,0);padding-inline:var(--_gcd-ol-padding-inline,0)}._46b5cb0c8e24e8c9__li{margin:var(--_gcd-li-margin,0)}"); 11169 } 11170 var global_css_defense_default2 = { "button": "_6defc79820e382c6__button", "input": "d2cff2e5dea83bd1__input", "textarea": "_547d86373d02e108__textarea", "div": "_8c15fd0ed9f28ba4__div", "p": "_43cec3e1eec1066d__p", "heading": "e97669c6d9a38497__heading", "a": "_2c0831b0499dbd6e__a", "ol": "c59a0ebebd71fa4a__ol", "li": "_46b5cb0c8e24e8c9__li" }; 11171 var Link = (0, import_element19.forwardRef)(function Link2({ 11172 children, 11173 variant = "default", 11174 tone = "brand", 11175 openInNewTab = false, 11176 target, 11177 render, 11178 className, 11179 ...props 11180 }, ref) { 11181 const shouldShowNewTabIndicator = openInNewTab || /^_blank$/i.test(target ?? ""); 11182 const element = useRender({ 11183 render, 11184 defaultTagName: "a", 11185 ref, 11186 props: mergeProps(props, { 11187 className: clsx_default( 11188 global_css_defense_default2.a, 11189 resets_default2["box-sizing"], 11190 focus_module_default["outset-ring--focus-except-active"], 11191 variant !== "unstyled" && style_default4.link, 11192 variant !== "unstyled" && style_default4[`is-$tone}`], 11193 variant === "unstyled" && style_default4["is-unstyled"], 11194 className 11195 ), 11196 target: target ?? (openInNewTab ? "_blank" : void 0), 11197 children: /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(import_jsx_runtime43.Fragment, { children: [ 11198 children, 11199 shouldShowNewTabIndicator && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)( 11200 "span", 11201 { 11202 className: style_default4["link-icon"], 11203 role: "img", 11204 "aria-label": ( 11205 /* translators: accessibility text appended to link text */ 11206 (0, import_i18n3.__)("(opens in a new tab)") 11207 ) 11208 } 11209 ) 11210 ] }) 11211 }) 11212 }); 11213 return element; 11214 }); 11215 11216 // packages/ui/build-module/icon/icon.mjs 11217 var import_element20 = __toESM(require_element(), 1); 11218 var import_primitives19 = __toESM(require_primitives(), 1); 11219 var import_jsx_runtime44 = __toESM(require_jsx_runtime(), 1); 11220 var Icon = (0, import_element20.forwardRef)(function Icon2({ icon, size: size4 = 24, style, ...restProps }, ref) { 11221 const mergedStyle = icon.props.style || style ? { ...icon.props.style, ...style } : void 0; 11222 return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)( 11223 import_primitives19.SVG, 11224 { 11225 ref, 11226 ...icon.props, 11227 ...restProps, 11228 ...mergedStyle ? { style: mergedStyle } : {}, 11229 width: size4, 11230 height: size4 11231 } 11232 ); 11233 }); 11234 11235 // packages/ui/build-module/utils/keyboard-shortcut.mjs 11236 var import_element22 = __toESM(require_element(), 1); 11237 var import_i18n4 = __toESM(require_i18n(), 1); 11238 11239 // packages/ui/build-module/visually-hidden/visually-hidden.mjs 11240 var import_element21 = __toESM(require_element(), 1); 11241 var STYLE_HASH_ATTRIBUTE6 = "data-wp-hash"; 11242 function getRuntime6() { 11243 const globalScope = globalThis; 11244 if (globalScope.__wpStyleRuntime) { 11245 return globalScope.__wpStyleRuntime; 11246 } 11247 globalScope.__wpStyleRuntime = { 11248 documents: /* @__PURE__ */ new Map(), 11249 styles: /* @__PURE__ */ new Map(), 11250 injectedStyles: /* @__PURE__ */ new WeakMap() 11251 }; 11252 if (typeof document !== "undefined") { 11253 registerDocument6(document); 11254 } 11255 return globalScope.__wpStyleRuntime; 11256 } 11257 function documentContainsStyleHash6(targetDocument, hash) { 11258 if (!targetDocument.head) { 11259 return false; 11260 } 11261 for (const style of targetDocument.head.querySelectorAll( 11262 `style[$STYLE_HASH_ATTRIBUTE6}]` 11263 )) { 11264 if (style.getAttribute(STYLE_HASH_ATTRIBUTE6) === hash) { 11265 return true; 11266 } 11267 } 11268 return false; 11269 } 11270 function injectStyle6(targetDocument, hash, css) { 11271 if (!targetDocument.head) { 11272 return; 11273 } 11274 const runtime = getRuntime6(); 11275 let injectedStyles = runtime.injectedStyles.get(targetDocument); 11276 if (!injectedStyles) { 11277 injectedStyles = /* @__PURE__ */ new Set(); 11278 runtime.injectedStyles.set(targetDocument, injectedStyles); 11279 } 11280 if (injectedStyles.has(hash)) { 11281 return; 11282 } 11283 if (documentContainsStyleHash6(targetDocument, hash)) { 11284 injectedStyles.add(hash); 11285 return; 11286 } 11287 const style = targetDocument.createElement("style"); 11288 style.setAttribute(STYLE_HASH_ATTRIBUTE6, hash); 11289 style.appendChild(targetDocument.createTextNode(css)); 11290 targetDocument.head.appendChild(style); 11291 injectedStyles.add(hash); 11292 } 11293 function registerDocument6(targetDocument) { 11294 const runtime = getRuntime6(); 11295 runtime.documents.set( 11296 targetDocument, 11297 (runtime.documents.get(targetDocument) ?? 0) + 1 11298 ); 11299 for (const [hash, css] of runtime.styles) { 11300 injectStyle6(targetDocument, hash, css); 11301 } 11302 return () => { 11303 const count = runtime.documents.get(targetDocument); 11304 if (count === void 0) { 11305 return; 11306 } 11307 if (count <= 1) { 11308 runtime.documents.delete(targetDocument); 11309 return; 11310 } 11311 runtime.documents.set(targetDocument, count - 1); 11312 }; 11313 } 11314 function registerStyle6(hash, css) { 11315 const runtime = getRuntime6(); 11316 runtime.styles.set(hash, css); 11317 for (const targetDocument of runtime.documents.keys()) { 11318 injectStyle6(targetDocument, hash, css); 11319 } 11320 } 11321 if (typeof process === "undefined" || true) { 11322 registerStyle6("f4df7461e9", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{.f37b9e2e191ebd66__visually-hidden{border:0;clip-path:inset(50%);height:1px;margin:-1px;overflow:hidden;overflow-wrap:normal;padding:0;position:absolute;width:1px;word-break:normal}}}"); 11323 } 11324 var style_default5 = { "visually-hidden": "f37b9e2e191ebd66__visually-hidden" }; 11325 var VisuallyHidden = (0, import_element21.forwardRef)( 11326 function VisuallyHidden2({ render, ...restProps }, ref) { 11327 const element = useRender({ 11328 render, 11329 ref, 11330 props: mergeProps( 11331 { className: style_default5["visually-hidden"] }, 11332 restProps, 11333 { 11334 // @ts-expect-error Arbitrary data-* attributes aren't indexable on the typed div props. Kept hardcoded so consumers can't change or remove it. 11335 "data-visually-hidden": "" 11336 } 11337 ) 11338 }); 11339 return element; 11340 } 11341 ); 11342 11343 // packages/ui/build-module/utils/keyboard-shortcut.mjs 11344 var import_jsx_runtime45 = __toESM(require_jsx_runtime(), 1); 11345 function useKeyboardShortcutProps({ 11346 "aria-describedby": ariaDescribedBy, 11347 "aria-keyshortcuts": ariaKeyShortcuts, 11348 shortcut 11349 }) { 11350 const generatedDescriptionId = (0, import_element22.useId)(); 11351 const descriptionId = shortcut ? generatedDescriptionId : void 0; 11352 const describedBy = [ariaDescribedBy, descriptionId].filter(Boolean).join(" "); 11353 return { 11354 descriptionId, 11355 targetProps: { 11356 "aria-describedby": describedBy || void 0, 11357 "aria-keyshortcuts": shortcut?.ariaKeyShortcut ?? ariaKeyShortcuts 11358 } 11359 }; 11360 } 11361 var KeyboardShortcutDescription = (0, import_element22.forwardRef)(function KeyboardShortcutDescription2({ descriptionId, shortcut }, ref) { 11362 return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)( 11363 VisuallyHidden, 11364 { 11365 id: descriptionId, 11366 "aria-hidden": "true", 11367 render: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("span", { ref }), 11368 children: (0, import_i18n4.sprintf)( 11369 /* translators: %s: keyboard shortcut. */ 11370 (0, import_i18n4.__)("Keyboard shortcut: %s"), 11371 shortcut.label ?? shortcut.ariaKeyShortcut 11372 ) 11373 } 11374 ); 11375 }); 11376 var KeyboardShortcutDisplay = (0, import_element22.forwardRef)(function KeyboardShortcutDisplay2({ className, shortcut }, ref) { 11377 return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("span", { ref, "aria-hidden": "true", className, dir: "ltr", children: shortcut.displayShortcut }); 11378 }); 11379 11380 // packages/ui/build-module/button/button.mjs 11381 var import_a11y = __toESM(require_a11y(), 1); 11382 var import_element23 = __toESM(require_element(), 1); 11383 var import_i18n5 = __toESM(require_i18n(), 1); 11384 var import_jsx_runtime46 = __toESM(require_jsx_runtime(), 1); 11385 var STYLE_HASH_ATTRIBUTE7 = "data-wp-hash"; 11386 function getRuntime7() { 11387 const globalScope = globalThis; 11388 if (globalScope.__wpStyleRuntime) { 11389 return globalScope.__wpStyleRuntime; 11390 } 11391 globalScope.__wpStyleRuntime = { 11392 documents: /* @__PURE__ */ new Map(), 11393 styles: /* @__PURE__ */ new Map(), 11394 injectedStyles: /* @__PURE__ */ new WeakMap() 11395 }; 11396 if (typeof document !== "undefined") { 11397 registerDocument7(document); 11398 } 11399 return globalScope.__wpStyleRuntime; 11400 } 11401 function documentContainsStyleHash7(targetDocument, hash) { 11402 if (!targetDocument.head) { 11403 return false; 11404 } 11405 for (const style of targetDocument.head.querySelectorAll( 11406 `style[$STYLE_HASH_ATTRIBUTE7}]` 11407 )) { 11408 if (style.getAttribute(STYLE_HASH_ATTRIBUTE7) === hash) { 11409 return true; 11410 } 11411 } 11412 return false; 11413 } 11414 function injectStyle7(targetDocument, hash, css) { 11415 if (!targetDocument.head) { 11416 return; 11417 } 11418 const runtime = getRuntime7(); 11419 let injectedStyles = runtime.injectedStyles.get(targetDocument); 11420 if (!injectedStyles) { 11421 injectedStyles = /* @__PURE__ */ new Set(); 11422 runtime.injectedStyles.set(targetDocument, injectedStyles); 11423 } 11424 if (injectedStyles.has(hash)) { 11425 return; 11426 } 11427 if (documentContainsStyleHash7(targetDocument, hash)) { 11428 injectedStyles.add(hash); 11429 return; 11430 } 11431 const style = targetDocument.createElement("style"); 11432 style.setAttribute(STYLE_HASH_ATTRIBUTE7, hash); 11433 style.appendChild(targetDocument.createTextNode(css)); 11434 targetDocument.head.appendChild(style); 11435 injectedStyles.add(hash); 11436 } 11437 function registerDocument7(targetDocument) { 11438 const runtime = getRuntime7(); 11439 runtime.documents.set( 11440 targetDocument, 11441 (runtime.documents.get(targetDocument) ?? 0) + 1 11442 ); 11443 for (const [hash, css] of runtime.styles) { 11444 injectStyle7(targetDocument, hash, css); 11445 } 11446 return () => { 11447 const count = runtime.documents.get(targetDocument); 11448 if (count === void 0) { 11449 return; 11450 } 11451 if (count <= 1) { 11452 runtime.documents.delete(targetDocument); 11453 return; 11454 } 11455 runtime.documents.set(targetDocument, count - 1); 11456 }; 11457 } 11458 function registerStyle7(hash, css) { 11459 const runtime = getRuntime7(); 11460 runtime.styles.set(hash, css); 11461 for (const targetDocument of runtime.documents.keys()) { 11462 injectStyle7(targetDocument, hash, css); 11463 } 11464 } 11465 if (typeof process === "undefined" || true) { 11466 registerStyle7("effc4e3032", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._97b0fc33c028be1a__button,.abbb272e2ce49bd6__is-unstyled{appearance:none;padding:0}._97b0fc33c028be1a__button{--wp-ui-button-font-weight:var(--wpds-typography-font-weight-emphasis,600);--wp-ui-button-background-color:var(--wpds-color-background-interactive-brand-strong,var(--wp-admin-theme-color,#3858e9));--wp-ui-button-background-color-active:var(--wpds-color-background-interactive-brand-strong-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 93%,#000));--wp-ui-button-background-color-disabled:var(--wpds-color-background-interactive-brand-strong-disabled,#e6e6e6);--wp-ui-button-foreground-color:var(--wpds-color-foreground-interactive-brand-strong,#fff);--wp-ui-button-foreground-color-active:var(--wpds-color-foreground-interactive-brand-strong-active,#fff);--wp-ui-button-foreground-color-disabled:var(--wpds-color-foreground-interactive-brand-strong-disabled,#8d8d8d);--wp-ui-button-padding-block:var(--wpds-dimension-padding-xs,4px);--wp-ui-button-padding-inline:var(--wpds-dimension-padding-md,12px);--wp-ui-button-height:var(--wpds-dimension-size-lg,40px);--wp-ui-button-aspect-ratio:auto;--wp-ui-button-font-size:var(--wpds-typography-font-size-md,13px);--wp-ui-button-min-width:calc(4ch + var(--wp-ui-button-padding-inline)*2);--wp-ui-button-icon-margin:calc((var(--wpds-dimension-size-2xs, 16px) - var(--wpds-dimension-size-sm, 24px))/2);--wp-ui-button-border-color:var(--wp-ui-button-background-color);--wp-ui-button-border-color-active:var(--wp-ui-button-background-color-active);--wp-ui-button-border-color-disabled:var(--wp-ui-button-background-color-disabled);--_gcd-button-font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);--_gcd-button-font-size:var(--wp-ui-button-font-size);--_gcd-button-font-weight:var(--wp-ui-button-font-weight);align-items:center;aspect-ratio:var(--wp-ui-button-aspect-ratio);background-clip:border-box;background-color:var(--wp-ui-button-background-color);border-color:var(--wp-ui-button-border-color);border-radius:var(--wpds-border-radius-sm,2px);border-style:solid;border-width:1px;color:var(--wp-ui-button-foreground-color);display:inline-flex;font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wp-ui-button-font-size);font-weight:var(--wp-ui-button-font-weight);gap:var(--wpds-dimension-gap-sm,8px);justify-content:center;line-height:var(--wpds-typography-line-height-sm,20px);max-width:100%;min-height:var(--wp-ui-button-height);min-width:var(--wp-ui-button-min-width);overflow-wrap:anywhere;padding-block:var(--wp-ui-button-padding-block);padding-inline:var(--wp-ui-button-padding-inline);position:relative;text-align:center;text-decoration:none;&:not([data-disabled]){cursor:var(--wpds-cursor-control,pointer)}@media not (prefers-reduced-motion){transition:color .1s ease-out;*{transition:opacity .1s ease-out}}&[href]{cursor:pointer}[href]{color:inherit;text-decoration:inherit}&:not([data-disabled]):is(:hover,:active,:focus){background-color:var(--wp-ui-button-background-color-active);border-color:var(--wp-ui-button-border-color-active);color:var(--wp-ui-button-foreground-color-active)}&[data-disabled]:not(._914b42f315c0e580__is-loading){background-color:var(--wp-ui-button-background-color-disabled);border-color:var(--wp-ui-button-border-color-disabled);color:var(--wp-ui-button-foreground-color-disabled);@media (forced-colors:active){border-bottom-color:GrayText;border-left-color:GrayText;border-right-color:GrayText;border-top-color:GrayText;color:GrayText}}&:before{aspect-ratio:1;border:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid;border-block-end-color:transparent;border-block-start-color:var(--wp-ui-button-foreground-color);border-inline-end-color:var(--wp-ui-button-foreground-color);border-inline-start-color:transparent;border-radius:50%;box-sizing:border-box;content:"";display:block;height:var(--wp-ui-button-font-size);left:50%;opacity:0;pointer-events:none;position:absolute;top:50%;transform:translate(-50%,-50%);@media not (prefers-reduced-motion){transition:opacity .1s ease-out}@media (forced-colors:active){border-block-end-style:none;border-bottom-color:ButtonText;border-inline-start-style:none;border-left-color:ButtonText;border-right-color:ButtonText;border-top-color:ButtonText}}}._908205475f9f2a92__is-small{--wp-ui-button-padding-block:0px;--wp-ui-button-padding-inline:var(--wpds-dimension-padding-sm,8px);--wp-ui-button-height:var(--wpds-dimension-size-sm,24px)}._9f6fc6553aeb36fe__icon{margin:var(--wp-ui-button-icon-margin)}.dd460c965226cc77__is-brand{&._62d5a778b7b258ee__is-outline,&.ad0619a3217c6a5b__is-minimal{--wp-ui-button-foreground-color:var(--wpds-color-foreground-interactive-brand,var(--wp-admin-theme-color,#3858e9));--wp-ui-button-foreground-color-active:var(--wpds-color-foreground-interactive-brand-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 52%,#000));--wp-ui-button-foreground-color-disabled:var(--wpds-color-foreground-interactive-brand-disabled,#8d8d8d)}&._62d5a778b7b258ee__is-outline{--wp-ui-button-background-color:var(--wpds-color-background-interactive-brand-weak,#0000);--wp-ui-button-background-color-active:var(--wpds-color-background-interactive-brand-weak-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 12%,#fff));--wp-ui-button-background-color-disabled:var(--wpds-color-background-interactive-brand-weak-disabled,#0000);--wp-ui-button-border-color:var(--wpds-color-stroke-interactive-brand,var(--wp-admin-theme-color,#3858e9));--wp-ui-button-border-color-active:var(--wpds-color-stroke-interactive-brand-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 85%,#000));--wp-ui-button-border-color-disabled:var(--wpds-color-stroke-interactive-brand-disabled,#dbdbdb)}&.ad0619a3217c6a5b__is-minimal{--wp-ui-button-background-color:var(--wpds-color-background-interactive-brand-weak,#0000);--wp-ui-button-background-color-active:var(--wpds-color-background-interactive-brand-weak-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 12%,#fff));--wp-ui-button-background-color-disabled:var(--wpds-color-background-interactive-brand-weak-disabled,#0000)}}.e722a8f96726aa99__is-neutral{&.ad0619a3217c6a5b__is-minimal[aria-pressed=true],&.b50b3358c5fb4d0b__is-solid{--wp-ui-button-background-color:var(--wpds-color-background-interactive-neutral-strong,#2d2d2d);--wp-ui-button-background-color-active:var(--wpds-color-background-interactive-neutral-strong-active,#1e1e1e);--wp-ui-button-background-color-disabled:var(--wpds-color-background-interactive-neutral-strong-disabled,#e6e6e6);--wp-ui-button-foreground-color:var(--wpds-color-foreground-interactive-neutral-strong,#f0f0f0);--wp-ui-button-foreground-color-active:var(--wpds-color-foreground-interactive-neutral-strong-active,#f0f0f0);--wp-ui-button-foreground-color-disabled:var(--wpds-color-foreground-interactive-neutral-strong-disabled,#8d8d8d)}&._62d5a778b7b258ee__is-outline,&.ad0619a3217c6a5b__is-minimal:not([aria-pressed=true]){--wp-ui-button-foreground-color:var(--wpds-color-foreground-interactive-neutral,#1e1e1e);--wp-ui-button-foreground-color-active:var(--wpds-color-foreground-interactive-neutral-active,#1e1e1e);--wp-ui-button-foreground-color-disabled:var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d)}&._62d5a778b7b258ee__is-outline{--wp-ui-button-background-color:var(--wpds-color-background-interactive-neutral-weak,#0000);--wp-ui-button-background-color-active:var(--wpds-color-background-interactive-neutral-weak-active,#ededed);--wp-ui-button-background-color-disabled:var(--wpds-color-background-interactive-neutral-weak-disabled,#0000);--wp-ui-button-border-color:var(--wpds-color-stroke-interactive-neutral,#8d8d8d);--wp-ui-button-border-color-active:var(--wpds-color-stroke-interactive-neutral-active,#6e6e6e);--wp-ui-button-border-color-disabled:var(--wpds-color-stroke-interactive-neutral-disabled,#dbdbdb)}&.ad0619a3217c6a5b__is-minimal:not([aria-pressed=true]){--wp-ui-button-background-color:var(--wpds-color-background-interactive-neutral-weak,#0000);--wp-ui-button-background-color-active:var(--wpds-color-background-interactive-neutral-weak-active,#ededed);--wp-ui-button-background-color-disabled:var(--wpds-color-background-interactive-neutral-weak-disabled,#0000)}}.abbb272e2ce49bd6__is-unstyled{background:none;border:none;min-width:unset}.cf59cf1b69629838__is-compact{--wp-ui-button-height:var(--wpds-dimension-size-md,32px)}._914b42f315c0e580__is-loading:not(.abbb272e2ce49bd6__is-unstyled){color:transparent;&:not([data-disabled]):is(:hover,:active,:focus){color:transparent}@media (forced-colors:active){color:ButtonFace}*{opacity:0}&:before{opacity:1;transition-delay:.05s;@media not (prefers-reduced-motion){animation:_5a1d53da6f830c8d__loading-animation 1s linear infinite}}}}@keyframes _5a1d53da6f830c8d__loading-animation{0%{transform:translate(-50%,-50%) rotate(0deg)}to{transform:translate(-50%,-50%) rotate(1turn)}}}'); 11467 } 11468 var style_default6 = { "button": "_97b0fc33c028be1a__button", "is-unstyled": "abbb272e2ce49bd6__is-unstyled", "is-loading": "_914b42f315c0e580__is-loading", "is-small": "_908205475f9f2a92__is-small", "icon": "_9f6fc6553aeb36fe__icon", "is-brand": "dd460c965226cc77__is-brand", "is-outline": "_62d5a778b7b258ee__is-outline", "is-minimal": "ad0619a3217c6a5b__is-minimal", "is-neutral": "e722a8f96726aa99__is-neutral", "is-solid": "b50b3358c5fb4d0b__is-solid", "is-compact": "cf59cf1b69629838__is-compact", "loading-animation": "_5a1d53da6f830c8d__loading-animation" }; 11469 if (typeof process === "undefined" || true) { 11470 registerStyle7("10f3806643", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._336cd3e4e743482f__box-sizing{box-sizing:border-box;*,:after,:before{box-sizing:inherit}}}}"); 11471 } 11472 var resets_default3 = { "box-sizing": "_336cd3e4e743482f__box-sizing" }; 11473 if (typeof process === "undefined" || true) { 11474 registerStyle7("08122b3d53", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{.af79fb116edb0dd7__outset-ring--focus:focus,.dfcfdc28396e5d98__outset-ring--focus-visible:focus-visible,.e5cd9ee879f6403a__outset-ring--focus-within:focus-within,:focus-visible ._81935a08e952f267__outset-ring--focus-parent-visible{--_gcd-a-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));--_gcd-div-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));outline-offset:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px))}._3c9f5ee9fc9c136d__outset-ring--focus-within-except-active:focus-within,.abc777e9713fa711__outset-ring--focus-except-active:focus{outline:none}._3c9f5ee9fc9c136d__outset-ring--focus-within-except-active:focus-within:not(:has(:active)),.abc777e9713fa711__outset-ring--focus-except-active:focus:not(:active){--_gcd-a-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));--_gcd-div-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));outline-offset:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px))}}}"); 11475 } 11476 var focus_module_default2 = { "outset-ring--focus": "af79fb116edb0dd7__outset-ring--focus", "outset-ring--focus-visible": "dfcfdc28396e5d98__outset-ring--focus-visible", "outset-ring--focus-within": "e5cd9ee879f6403a__outset-ring--focus-within", "outset-ring--focus-parent-visible": "_81935a08e952f267__outset-ring--focus-parent-visible", "outset-ring--focus-except-active": "abc777e9713fa711__outset-ring--focus-except-active", "outset-ring--focus-within-except-active": "_3c9f5ee9fc9c136d__outset-ring--focus-within-except-active" }; 11477 if (typeof process === "undefined" || true) { 11478 registerStyle7("e8e31009f5", "._6defc79820e382c6__button{box-sizing:var(--_gcd-button-box-sizing,border-box);font-family:var(--_gcd-button-font-family,inherit);font-size:var(--_gcd-button-font-size,inherit);font-weight:var(--_gcd-button-font-weight,inherit)}.d2cff2e5dea83bd1__input{box-sizing:var(--_gcd-input-box-sizing,border-box);font-family:var(--_gcd-input-font-family,inherit);font-size:var(--_gcd-input-font-size,inherit);font-weight:var(--_gcd-input-font-weight,inherit);margin:var(--_gcd-input-margin,0);&::placeholder{color:var(--_gcd-input-placeholder-color,var(--wpds-color-foreground-interactive-neutral-weak,#707070))}&:is(textarea,[type=text],[type=password],[type=color],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){background-color:var(--_gcd-input-background-color,transparent);border:var(--_gcd-input-border,none);border-radius:var(--_gcd-input-border-radius,0);box-shadow:var(--_gcd-input-box-shadow,0 0 0 transparent);color:var(--_gcd-input-color,var(--wpds-color-foreground-interactive-neutral,#1e1e1e));&:focus{border-color:var(--_gcd-input-border-color-focus,var(--wp-admin-theme-color));box-shadow:var(--_gcd-input-box-shadow-focus,none);outline:var(--_gcd-input-outline-focus,none)}&:disabled{background:var(--_gcd-input-background-disabled,transparent);border-color:var(--_gcd-input-border-color-disabled,transparent);box-shadow:var(--_gcd-input-box-shadow-disabled,none);color:var(--_gcd-input-color-disabled,var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d))}}&:is(textarea,[type=text],[type=password],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){line-height:var(--_gcd-input-line-height,inherit);min-height:var(--_gcd-input-min-height,auto);padding:var(--_gcd-input-padding,0)}}._547d86373d02e108__textarea{box-sizing:var(--_gcd-textarea-box-sizing,border-box);overflow:var(--_gcd-textarea-overflow,auto);resize:var(--_gcd-textarea-resize,block)}._8c15fd0ed9f28ba4__div{outline:var(--_gcd-div-outline,0 solid transparent)}p._43cec3e1eec1066d__p{font-size:var(--_gcd-p-font-size,13px);line-height:var(--_gcd-p-line-height,1.5);margin:var(--_gcd-p-margin,0)}:is(h1,h2,h3,h4,h5,h6).e97669c6d9a38497__heading{color:var(--_gcd-heading-color,var(--wpds-color-foreground-content-neutral,#1e1e1e));font-size:var(--_gcd-heading-font-size,inherit);font-weight:var(--_gcd-heading-font-weight,var(--wpds-typography-font-weight-emphasis,600));margin:var(--_gcd-heading-margin,0)}._2c0831b0499dbd6e__a,._2c0831b0499dbd6e__a:is(:hover,:focus,:active){border-radius:var(--_gcd-a-border-radius,0);box-shadow:var(--_gcd-a-box-shadow,none);color:var(--_gcd-a-color,inherit);outline:var(--_gcd-a-outline,0 solid transparent);transition:var(--_gcd-a-transition,none)}.c59a0ebebd71fa4a__ol{list-style:var(--_gcd-ol-list-style,none);margin:var(--_gcd-ol-margin,0);padding-block:var(--_gcd-ol-padding-block,0);padding-inline:var(--_gcd-ol-padding-inline,0)}._46b5cb0c8e24e8c9__li{margin:var(--_gcd-li-margin,0)}"); 11479 } 11480 var global_css_defense_default3 = { "button": "_6defc79820e382c6__button", "input": "d2cff2e5dea83bd1__input", "textarea": "_547d86373d02e108__textarea", "div": "_8c15fd0ed9f28ba4__div", "p": "_43cec3e1eec1066d__p", "heading": "e97669c6d9a38497__heading", "a": "_2c0831b0499dbd6e__a", "ol": "c59a0ebebd71fa4a__ol", "li": "_46b5cb0c8e24e8c9__li" }; 11481 var Button5 = (0, import_element23.forwardRef)( 11482 function Button22({ 11483 tone = "brand", 11484 variant = "solid", 11485 size: size4 = "default", 11486 className, 11487 focusableWhenDisabled = true, 11488 disabled: disabled2, 11489 loading, 11490 loadingAnnouncement = (0, import_i18n5.__)("Loading"), 11491 children, 11492 ...props 11493 }, ref) { 11494 const mergedClassName = clsx_default( 11495 global_css_defense_default3.button, 11496 resets_default3["box-sizing"], 11497 focus_module_default2["outset-ring--focus-except-active"], 11498 variant !== "unstyled" && style_default6.button, 11499 style_default6[`is-$tone}`], 11500 style_default6[`is-$variant}`], 11501 style_default6[`is-$size4}`], 11502 loading && style_default6["is-loading"], 11503 className 11504 ); 11505 (0, import_element23.useEffect)(() => { 11506 if (loading && loadingAnnouncement) { 11507 (0, import_a11y.speak)(loadingAnnouncement); 11508 } 11509 }, [loading, loadingAnnouncement]); 11510 return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)( 11511 Button3, 11512 { 11513 ref, 11514 className: mergedClassName, 11515 focusableWhenDisabled, 11516 disabled: disabled2 ?? loading, 11517 ...props, 11518 children 11519 } 11520 ); 11521 } 11522 ); 11523 11524 // packages/ui/build-module/button/icon.mjs 11525 var import_element24 = __toESM(require_element(), 1); 11526 var import_jsx_runtime47 = __toESM(require_jsx_runtime(), 1); 11527 var STYLE_HASH_ATTRIBUTE8 = "data-wp-hash"; 11528 function getRuntime8() { 11529 const globalScope = globalThis; 11530 if (globalScope.__wpStyleRuntime) { 11531 return globalScope.__wpStyleRuntime; 11532 } 11533 globalScope.__wpStyleRuntime = { 11534 documents: /* @__PURE__ */ new Map(), 11535 styles: /* @__PURE__ */ new Map(), 11536 injectedStyles: /* @__PURE__ */ new WeakMap() 11537 }; 11538 if (typeof document !== "undefined") { 11539 registerDocument8(document); 11540 } 11541 return globalScope.__wpStyleRuntime; 11542 } 11543 function documentContainsStyleHash8(targetDocument, hash) { 11544 if (!targetDocument.head) { 11545 return false; 11546 } 11547 for (const style of targetDocument.head.querySelectorAll( 11548 `style[$STYLE_HASH_ATTRIBUTE8}]` 11549 )) { 11550 if (style.getAttribute(STYLE_HASH_ATTRIBUTE8) === hash) { 11551 return true; 11552 } 11553 } 11554 return false; 11555 } 11556 function injectStyle8(targetDocument, hash, css) { 11557 if (!targetDocument.head) { 11558 return; 11559 } 11560 const runtime = getRuntime8(); 11561 let injectedStyles = runtime.injectedStyles.get(targetDocument); 11562 if (!injectedStyles) { 11563 injectedStyles = /* @__PURE__ */ new Set(); 11564 runtime.injectedStyles.set(targetDocument, injectedStyles); 11565 } 11566 if (injectedStyles.has(hash)) { 11567 return; 11568 } 11569 if (documentContainsStyleHash8(targetDocument, hash)) { 11570 injectedStyles.add(hash); 11571 return; 11572 } 11573 const style = targetDocument.createElement("style"); 11574 style.setAttribute(STYLE_HASH_ATTRIBUTE8, hash); 11575 style.appendChild(targetDocument.createTextNode(css)); 11576 targetDocument.head.appendChild(style); 11577 injectedStyles.add(hash); 11578 } 11579 function registerDocument8(targetDocument) { 11580 const runtime = getRuntime8(); 11581 runtime.documents.set( 11582 targetDocument, 11583 (runtime.documents.get(targetDocument) ?? 0) + 1 11584 ); 11585 for (const [hash, css] of runtime.styles) { 11586 injectStyle8(targetDocument, hash, css); 11587 } 11588 return () => { 11589 const count = runtime.documents.get(targetDocument); 11590 if (count === void 0) { 11591 return; 11592 } 11593 if (count <= 1) { 11594 runtime.documents.delete(targetDocument); 11595 return; 11596 } 11597 runtime.documents.set(targetDocument, count - 1); 11598 }; 11599 } 11600 function registerStyle8(hash, css) { 11601 const runtime = getRuntime8(); 11602 runtime.styles.set(hash, css); 11603 for (const targetDocument of runtime.documents.keys()) { 11604 injectStyle8(targetDocument, hash, css); 11605 } 11606 } 11607 if (typeof process === "undefined" || true) { 11608 registerStyle8("effc4e3032", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._97b0fc33c028be1a__button,.abbb272e2ce49bd6__is-unstyled{appearance:none;padding:0}._97b0fc33c028be1a__button{--wp-ui-button-font-weight:var(--wpds-typography-font-weight-emphasis,600);--wp-ui-button-background-color:var(--wpds-color-background-interactive-brand-strong,var(--wp-admin-theme-color,#3858e9));--wp-ui-button-background-color-active:var(--wpds-color-background-interactive-brand-strong-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 93%,#000));--wp-ui-button-background-color-disabled:var(--wpds-color-background-interactive-brand-strong-disabled,#e6e6e6);--wp-ui-button-foreground-color:var(--wpds-color-foreground-interactive-brand-strong,#fff);--wp-ui-button-foreground-color-active:var(--wpds-color-foreground-interactive-brand-strong-active,#fff);--wp-ui-button-foreground-color-disabled:var(--wpds-color-foreground-interactive-brand-strong-disabled,#8d8d8d);--wp-ui-button-padding-block:var(--wpds-dimension-padding-xs,4px);--wp-ui-button-padding-inline:var(--wpds-dimension-padding-md,12px);--wp-ui-button-height:var(--wpds-dimension-size-lg,40px);--wp-ui-button-aspect-ratio:auto;--wp-ui-button-font-size:var(--wpds-typography-font-size-md,13px);--wp-ui-button-min-width:calc(4ch + var(--wp-ui-button-padding-inline)*2);--wp-ui-button-icon-margin:calc((var(--wpds-dimension-size-2xs, 16px) - var(--wpds-dimension-size-sm, 24px))/2);--wp-ui-button-border-color:var(--wp-ui-button-background-color);--wp-ui-button-border-color-active:var(--wp-ui-button-background-color-active);--wp-ui-button-border-color-disabled:var(--wp-ui-button-background-color-disabled);--_gcd-button-font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);--_gcd-button-font-size:var(--wp-ui-button-font-size);--_gcd-button-font-weight:var(--wp-ui-button-font-weight);align-items:center;aspect-ratio:var(--wp-ui-button-aspect-ratio);background-clip:border-box;background-color:var(--wp-ui-button-background-color);border-color:var(--wp-ui-button-border-color);border-radius:var(--wpds-border-radius-sm,2px);border-style:solid;border-width:1px;color:var(--wp-ui-button-foreground-color);display:inline-flex;font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wp-ui-button-font-size);font-weight:var(--wp-ui-button-font-weight);gap:var(--wpds-dimension-gap-sm,8px);justify-content:center;line-height:var(--wpds-typography-line-height-sm,20px);max-width:100%;min-height:var(--wp-ui-button-height);min-width:var(--wp-ui-button-min-width);overflow-wrap:anywhere;padding-block:var(--wp-ui-button-padding-block);padding-inline:var(--wp-ui-button-padding-inline);position:relative;text-align:center;text-decoration:none;&:not([data-disabled]){cursor:var(--wpds-cursor-control,pointer)}@media not (prefers-reduced-motion){transition:color .1s ease-out;*{transition:opacity .1s ease-out}}&[href]{cursor:pointer}[href]{color:inherit;text-decoration:inherit}&:not([data-disabled]):is(:hover,:active,:focus){background-color:var(--wp-ui-button-background-color-active);border-color:var(--wp-ui-button-border-color-active);color:var(--wp-ui-button-foreground-color-active)}&[data-disabled]:not(._914b42f315c0e580__is-loading){background-color:var(--wp-ui-button-background-color-disabled);border-color:var(--wp-ui-button-border-color-disabled);color:var(--wp-ui-button-foreground-color-disabled);@media (forced-colors:active){border-bottom-color:GrayText;border-left-color:GrayText;border-right-color:GrayText;border-top-color:GrayText;color:GrayText}}&:before{aspect-ratio:1;border:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid;border-block-end-color:transparent;border-block-start-color:var(--wp-ui-button-foreground-color);border-inline-end-color:var(--wp-ui-button-foreground-color);border-inline-start-color:transparent;border-radius:50%;box-sizing:border-box;content:"";display:block;height:var(--wp-ui-button-font-size);left:50%;opacity:0;pointer-events:none;position:absolute;top:50%;transform:translate(-50%,-50%);@media not (prefers-reduced-motion){transition:opacity .1s ease-out}@media (forced-colors:active){border-block-end-style:none;border-bottom-color:ButtonText;border-inline-start-style:none;border-left-color:ButtonText;border-right-color:ButtonText;border-top-color:ButtonText}}}._908205475f9f2a92__is-small{--wp-ui-button-padding-block:0px;--wp-ui-button-padding-inline:var(--wpds-dimension-padding-sm,8px);--wp-ui-button-height:var(--wpds-dimension-size-sm,24px)}._9f6fc6553aeb36fe__icon{margin:var(--wp-ui-button-icon-margin)}.dd460c965226cc77__is-brand{&._62d5a778b7b258ee__is-outline,&.ad0619a3217c6a5b__is-minimal{--wp-ui-button-foreground-color:var(--wpds-color-foreground-interactive-brand,var(--wp-admin-theme-color,#3858e9));--wp-ui-button-foreground-color-active:var(--wpds-color-foreground-interactive-brand-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 52%,#000));--wp-ui-button-foreground-color-disabled:var(--wpds-color-foreground-interactive-brand-disabled,#8d8d8d)}&._62d5a778b7b258ee__is-outline{--wp-ui-button-background-color:var(--wpds-color-background-interactive-brand-weak,#0000);--wp-ui-button-background-color-active:var(--wpds-color-background-interactive-brand-weak-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 12%,#fff));--wp-ui-button-background-color-disabled:var(--wpds-color-background-interactive-brand-weak-disabled,#0000);--wp-ui-button-border-color:var(--wpds-color-stroke-interactive-brand,var(--wp-admin-theme-color,#3858e9));--wp-ui-button-border-color-active:var(--wpds-color-stroke-interactive-brand-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 85%,#000));--wp-ui-button-border-color-disabled:var(--wpds-color-stroke-interactive-brand-disabled,#dbdbdb)}&.ad0619a3217c6a5b__is-minimal{--wp-ui-button-background-color:var(--wpds-color-background-interactive-brand-weak,#0000);--wp-ui-button-background-color-active:var(--wpds-color-background-interactive-brand-weak-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 12%,#fff));--wp-ui-button-background-color-disabled:var(--wpds-color-background-interactive-brand-weak-disabled,#0000)}}.e722a8f96726aa99__is-neutral{&.ad0619a3217c6a5b__is-minimal[aria-pressed=true],&.b50b3358c5fb4d0b__is-solid{--wp-ui-button-background-color:var(--wpds-color-background-interactive-neutral-strong,#2d2d2d);--wp-ui-button-background-color-active:var(--wpds-color-background-interactive-neutral-strong-active,#1e1e1e);--wp-ui-button-background-color-disabled:var(--wpds-color-background-interactive-neutral-strong-disabled,#e6e6e6);--wp-ui-button-foreground-color:var(--wpds-color-foreground-interactive-neutral-strong,#f0f0f0);--wp-ui-button-foreground-color-active:var(--wpds-color-foreground-interactive-neutral-strong-active,#f0f0f0);--wp-ui-button-foreground-color-disabled:var(--wpds-color-foreground-interactive-neutral-strong-disabled,#8d8d8d)}&._62d5a778b7b258ee__is-outline,&.ad0619a3217c6a5b__is-minimal:not([aria-pressed=true]){--wp-ui-button-foreground-color:var(--wpds-color-foreground-interactive-neutral,#1e1e1e);--wp-ui-button-foreground-color-active:var(--wpds-color-foreground-interactive-neutral-active,#1e1e1e);--wp-ui-button-foreground-color-disabled:var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d)}&._62d5a778b7b258ee__is-outline{--wp-ui-button-background-color:var(--wpds-color-background-interactive-neutral-weak,#0000);--wp-ui-button-background-color-active:var(--wpds-color-background-interactive-neutral-weak-active,#ededed);--wp-ui-button-background-color-disabled:var(--wpds-color-background-interactive-neutral-weak-disabled,#0000);--wp-ui-button-border-color:var(--wpds-color-stroke-interactive-neutral,#8d8d8d);--wp-ui-button-border-color-active:var(--wpds-color-stroke-interactive-neutral-active,#6e6e6e);--wp-ui-button-border-color-disabled:var(--wpds-color-stroke-interactive-neutral-disabled,#dbdbdb)}&.ad0619a3217c6a5b__is-minimal:not([aria-pressed=true]){--wp-ui-button-background-color:var(--wpds-color-background-interactive-neutral-weak,#0000);--wp-ui-button-background-color-active:var(--wpds-color-background-interactive-neutral-weak-active,#ededed);--wp-ui-button-background-color-disabled:var(--wpds-color-background-interactive-neutral-weak-disabled,#0000)}}.abbb272e2ce49bd6__is-unstyled{background:none;border:none;min-width:unset}.cf59cf1b69629838__is-compact{--wp-ui-button-height:var(--wpds-dimension-size-md,32px)}._914b42f315c0e580__is-loading:not(.abbb272e2ce49bd6__is-unstyled){color:transparent;&:not([data-disabled]):is(:hover,:active,:focus){color:transparent}@media (forced-colors:active){color:ButtonFace}*{opacity:0}&:before{opacity:1;transition-delay:.05s;@media not (prefers-reduced-motion){animation:_5a1d53da6f830c8d__loading-animation 1s linear infinite}}}}@keyframes _5a1d53da6f830c8d__loading-animation{0%{transform:translate(-50%,-50%) rotate(0deg)}to{transform:translate(-50%,-50%) rotate(1turn)}}}'); 11609 } 11610 var style_default7 = { "button": "_97b0fc33c028be1a__button", "is-unstyled": "abbb272e2ce49bd6__is-unstyled", "is-loading": "_914b42f315c0e580__is-loading", "is-small": "_908205475f9f2a92__is-small", "icon": "_9f6fc6553aeb36fe__icon", "is-brand": "dd460c965226cc77__is-brand", "is-outline": "_62d5a778b7b258ee__is-outline", "is-minimal": "ad0619a3217c6a5b__is-minimal", "is-neutral": "e722a8f96726aa99__is-neutral", "is-solid": "b50b3358c5fb4d0b__is-solid", "is-compact": "cf59cf1b69629838__is-compact", "loading-animation": "_5a1d53da6f830c8d__loading-animation" }; 11611 var ButtonIcon = (0, import_element24.forwardRef)( 11612 function ButtonIcon2({ className, icon, ...props }, ref) { 11613 return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)( 11614 Icon, 11615 { 11616 ref, 11617 icon, 11618 className: clsx_default(style_default7.icon, className), 11619 size: 24, 11620 ...props 11621 } 11622 ); 11623 } 11624 ); 11625 11626 // packages/ui/build-module/button/index.mjs 11627 ButtonIcon.displayName = "Button.Icon"; 11628 var Button6 = Object.assign(Button5, { 11629 /** 11630 * An icon component specifically designed to work well when rendered inside 11631 * a `Button` component. 11632 */ 11633 Icon: ButtonIcon 11634 }); 11635 11636 // packages/ui/build-module/icon-button/icon-button.mjs 11637 var import_element25 = __toESM(require_element(), 1); 11638 var import_jsx_runtime48 = __toESM(require_jsx_runtime(), 1); 11639 var STYLE_HASH_ATTRIBUTE9 = "data-wp-hash"; 11640 function getRuntime9() { 11641 const globalScope = globalThis; 11642 if (globalScope.__wpStyleRuntime) { 11643 return globalScope.__wpStyleRuntime; 11644 } 11645 globalScope.__wpStyleRuntime = { 11646 documents: /* @__PURE__ */ new Map(), 11647 styles: /* @__PURE__ */ new Map(), 11648 injectedStyles: /* @__PURE__ */ new WeakMap() 11649 }; 11650 if (typeof document !== "undefined") { 11651 registerDocument9(document); 11652 } 11653 return globalScope.__wpStyleRuntime; 11654 } 11655 function documentContainsStyleHash9(targetDocument, hash) { 11656 if (!targetDocument.head) { 11657 return false; 11658 } 11659 for (const style of targetDocument.head.querySelectorAll( 11660 `style[$STYLE_HASH_ATTRIBUTE9}]` 11661 )) { 11662 if (style.getAttribute(STYLE_HASH_ATTRIBUTE9) === hash) { 11663 return true; 11664 } 11665 } 11666 return false; 11667 } 11668 function injectStyle9(targetDocument, hash, css) { 11669 if (!targetDocument.head) { 11670 return; 11671 } 11672 const runtime = getRuntime9(); 11673 let injectedStyles = runtime.injectedStyles.get(targetDocument); 11674 if (!injectedStyles) { 11675 injectedStyles = /* @__PURE__ */ new Set(); 11676 runtime.injectedStyles.set(targetDocument, injectedStyles); 11677 } 11678 if (injectedStyles.has(hash)) { 11679 return; 11680 } 11681 if (documentContainsStyleHash9(targetDocument, hash)) { 11682 injectedStyles.add(hash); 11683 return; 11684 } 11685 const style = targetDocument.createElement("style"); 11686 style.setAttribute(STYLE_HASH_ATTRIBUTE9, hash); 11687 style.appendChild(targetDocument.createTextNode(css)); 11688 targetDocument.head.appendChild(style); 11689 injectedStyles.add(hash); 11690 } 11691 function registerDocument9(targetDocument) { 11692 const runtime = getRuntime9(); 11693 runtime.documents.set( 11694 targetDocument, 11695 (runtime.documents.get(targetDocument) ?? 0) + 1 11696 ); 11697 for (const [hash, css] of runtime.styles) { 11698 injectStyle9(targetDocument, hash, css); 11699 } 11700 return () => { 11701 const count = runtime.documents.get(targetDocument); 11702 if (count === void 0) { 11703 return; 11704 } 11705 if (count <= 1) { 11706 runtime.documents.delete(targetDocument); 11707 return; 11708 } 11709 runtime.documents.set(targetDocument, count - 1); 11710 }; 11711 } 11712 function registerStyle9(hash, css) { 11713 const runtime = getRuntime9(); 11714 runtime.styles.set(hash, css); 11715 for (const targetDocument of runtime.documents.keys()) { 11716 injectStyle9(targetDocument, hash, css); 11717 } 11718 } 11719 if (typeof process === "undefined" || true) { 11720 registerStyle9("c5cdafb1bc", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer compositions{._28cfdc260e755391__icon-button{--wp-ui-button-aspect-ratio:1;--wp-ui-button-padding-inline:0px;--wp-ui-button-min-width:unset}.f1c70d719989a85a__icon{margin:-1px}}}"); 11721 } 11722 var style_default8 = { "icon-button": "_28cfdc260e755391__icon-button", "icon": "f1c70d719989a85a__icon" }; 11723 var IconButton = (0, import_element25.forwardRef)( 11724 function IconButton2({ 11725 label, 11726 className, 11727 // Prevent accidental forwarding of `children` 11728 children: _children, 11729 disabled: disabled2, 11730 focusableWhenDisabled = true, 11731 icon, 11732 size: size4, 11733 shortcut, 11734 positioner, 11735 "aria-describedby": ariaDescribedBy, 11736 "aria-keyshortcuts": ariaKeyShortcuts, 11737 ...restProps 11738 }, ref) { 11739 const classes = clsx_default(style_default8["icon-button"], className); 11740 const { descriptionId, targetProps } = useKeyboardShortcutProps({ 11741 "aria-describedby": ariaDescribedBy, 11742 "aria-keyshortcuts": ariaKeyShortcuts, 11743 shortcut 11744 }); 11745 return /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(Root, { children: [ 11746 /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)( 11747 Trigger, 11748 { 11749 ref, 11750 ...targetProps, 11751 disabled: disabled2 && !focusableWhenDisabled, 11752 render: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)( 11753 Button6, 11754 { 11755 ...restProps, 11756 size: size4, 11757 "aria-label": label, 11758 disabled: disabled2, 11759 focusableWhenDisabled 11760 } 11761 ), 11762 className: classes, 11763 children: [ 11764 /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(Icon, { icon, size: 24, className: style_default8.icon }), 11765 shortcut && descriptionId && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)( 11766 KeyboardShortcutDescription, 11767 { 11768 descriptionId, 11769 shortcut 11770 } 11771 ) 11772 ] 11773 } 11774 ), 11775 /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(Popup, { positioner, children: [ 11776 label, 11777 shortcut && /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(import_jsx_runtime48.Fragment, { children: [ 11778 " ", 11779 /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(KeyboardShortcutDisplay, { shortcut }) 11780 ] }) 11781 ] }) 11782 ] }); 11783 } 11784 ); 11785 11786 // packages/ui/build-module/card/index.mjs 11787 var card_exports = {}; 11788 __export(card_exports, { 11789 Content: () => Content, 11790 FullBleed: () => FullBleed, 11791 Header: () => Header, 11792 Root: () => Root2, 11793 Title: () => Title 11794 }); 11795 11796 // packages/ui/build-module/card/root.mjs 11797 var import_element26 = __toESM(require_element(), 1); 11798 var STYLE_HASH_ATTRIBUTE10 = "data-wp-hash"; 11799 function getRuntime10() { 11800 const globalScope = globalThis; 11801 if (globalScope.__wpStyleRuntime) { 11802 return globalScope.__wpStyleRuntime; 11803 } 11804 globalScope.__wpStyleRuntime = { 11805 documents: /* @__PURE__ */ new Map(), 11806 styles: /* @__PURE__ */ new Map(), 11807 injectedStyles: /* @__PURE__ */ new WeakMap() 11808 }; 11809 if (typeof document !== "undefined") { 11810 registerDocument10(document); 11811 } 11812 return globalScope.__wpStyleRuntime; 11813 } 11814 function documentContainsStyleHash10(targetDocument, hash) { 11815 if (!targetDocument.head) { 11816 return false; 11817 } 11818 for (const style of targetDocument.head.querySelectorAll( 11819 `style[$STYLE_HASH_ATTRIBUTE10}]` 11820 )) { 11821 if (style.getAttribute(STYLE_HASH_ATTRIBUTE10) === hash) { 11822 return true; 11823 } 11824 } 11825 return false; 11826 } 11827 function injectStyle10(targetDocument, hash, css) { 11828 if (!targetDocument.head) { 11829 return; 11830 } 11831 const runtime = getRuntime10(); 11832 let injectedStyles = runtime.injectedStyles.get(targetDocument); 11833 if (!injectedStyles) { 11834 injectedStyles = /* @__PURE__ */ new Set(); 11835 runtime.injectedStyles.set(targetDocument, injectedStyles); 11836 } 11837 if (injectedStyles.has(hash)) { 11838 return; 11839 } 11840 if (documentContainsStyleHash10(targetDocument, hash)) { 11841 injectedStyles.add(hash); 11842 return; 11843 } 11844 const style = targetDocument.createElement("style"); 11845 style.setAttribute(STYLE_HASH_ATTRIBUTE10, hash); 11846 style.appendChild(targetDocument.createTextNode(css)); 11847 targetDocument.head.appendChild(style); 11848 injectedStyles.add(hash); 11849 } 11850 function registerDocument10(targetDocument) { 11851 const runtime = getRuntime10(); 11852 runtime.documents.set( 11853 targetDocument, 11854 (runtime.documents.get(targetDocument) ?? 0) + 1 11855 ); 11856 for (const [hash, css] of runtime.styles) { 11857 injectStyle10(targetDocument, hash, css); 11858 } 11859 return () => { 11860 const count = runtime.documents.get(targetDocument); 11861 if (count === void 0) { 11862 return; 11863 } 11864 if (count <= 1) { 11865 runtime.documents.delete(targetDocument); 11866 return; 11867 } 11868 runtime.documents.set(targetDocument, count - 1); 11869 }; 11870 } 11871 function registerStyle10(hash, css) { 11872 const runtime = getRuntime10(); 11873 runtime.styles.set(hash, css); 11874 for (const targetDocument of runtime.documents.keys()) { 11875 injectStyle10(targetDocument, hash, css); 11876 } 11877 } 11878 if (typeof process === "undefined" || true) { 11879 registerStyle10("10f3806643", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._336cd3e4e743482f__box-sizing{box-sizing:border-box;*,:after,:before{box-sizing:inherit}}}}"); 11880 } 11881 var resets_default4 = { "box-sizing": "_336cd3e4e743482f__box-sizing" }; 11882 if (typeof process === "undefined" || true) { 11883 registerStyle10("cb866dcef6", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer 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-background-surface-neutral-strong,#fff);border:1px solid var(--wpds-color-stroke-surface-neutral,#dbdbdb);border-radius:var(--wpds-border-radius-lg,8px);color:var(--wpds-color-foreground-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)}}}"); 11884 } 11885 var style_default9 = { "root": "_02872bf298eadc43__root", "header": "bbccc92e6ba5662d__header", "content": "_5dffdaf2a6e669ac__content", "fullbleed": "c1fa192587e1b4a6__fullbleed" }; 11886 var Root2 = (0, import_element26.forwardRef)(function Card({ render, ...restProps }, ref) { 11887 const mergedClassName = clsx_default(style_default9.root, resets_default4["box-sizing"]); 11888 const element = useRender({ 11889 defaultTagName: "div", 11890 render, 11891 ref, 11892 props: mergeProps({ className: mergedClassName }, restProps) 11893 }); 11894 return element; 11895 }); 11896 11897 // packages/ui/build-module/card/header.mjs 11898 var import_element27 = __toESM(require_element(), 1); 11899 var STYLE_HASH_ATTRIBUTE11 = "data-wp-hash"; 11900 function getRuntime11() { 11901 const globalScope = globalThis; 11902 if (globalScope.__wpStyleRuntime) { 11903 return globalScope.__wpStyleRuntime; 11904 } 11905 globalScope.__wpStyleRuntime = { 11906 documents: /* @__PURE__ */ new Map(), 11907 styles: /* @__PURE__ */ new Map(), 11908 injectedStyles: /* @__PURE__ */ new WeakMap() 11909 }; 11910 if (typeof document !== "undefined") { 11911 registerDocument11(document); 11912 } 11913 return globalScope.__wpStyleRuntime; 11914 } 11915 function documentContainsStyleHash11(targetDocument, hash) { 11916 if (!targetDocument.head) { 11917 return false; 11918 } 11919 for (const style of targetDocument.head.querySelectorAll( 11920 `style[$STYLE_HASH_ATTRIBUTE11}]` 11921 )) { 11922 if (style.getAttribute(STYLE_HASH_ATTRIBUTE11) === hash) { 11923 return true; 11924 } 11925 } 11926 return false; 11927 } 11928 function injectStyle11(targetDocument, hash, css) { 11929 if (!targetDocument.head) { 11930 return; 11931 } 11932 const runtime = getRuntime11(); 11933 let injectedStyles = runtime.injectedStyles.get(targetDocument); 11934 if (!injectedStyles) { 11935 injectedStyles = /* @__PURE__ */ new Set(); 11936 runtime.injectedStyles.set(targetDocument, injectedStyles); 11937 } 11938 if (injectedStyles.has(hash)) { 11939 return; 11940 } 11941 if (documentContainsStyleHash11(targetDocument, hash)) { 11942 injectedStyles.add(hash); 11943 return; 11944 } 11945 const style = targetDocument.createElement("style"); 11946 style.setAttribute(STYLE_HASH_ATTRIBUTE11, hash); 11947 style.appendChild(targetDocument.createTextNode(css)); 11948 targetDocument.head.appendChild(style); 11949 injectedStyles.add(hash); 11950 } 11951 function registerDocument11(targetDocument) { 11952 const runtime = getRuntime11(); 11953 runtime.documents.set( 11954 targetDocument, 11955 (runtime.documents.get(targetDocument) ?? 0) + 1 11956 ); 11957 for (const [hash, css] of runtime.styles) { 11958 injectStyle11(targetDocument, hash, css); 11959 } 11960 return () => { 11961 const count = runtime.documents.get(targetDocument); 11962 if (count === void 0) { 11963 return; 11964 } 11965 if (count <= 1) { 11966 runtime.documents.delete(targetDocument); 11967 return; 11968 } 11969 runtime.documents.set(targetDocument, count - 1); 11970 }; 11971 } 11972 function registerStyle11(hash, css) { 11973 const runtime = getRuntime11(); 11974 runtime.styles.set(hash, css); 11975 for (const targetDocument of runtime.documents.keys()) { 11976 injectStyle11(targetDocument, hash, css); 11977 } 11978 } 11979 if (typeof process === "undefined" || true) { 11980 registerStyle11("cb866dcef6", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer 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-background-surface-neutral-strong,#fff);border:1px solid var(--wpds-color-stroke-surface-neutral,#dbdbdb);border-radius:var(--wpds-border-radius-lg,8px);color:var(--wpds-color-foreground-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)}}}"); 11981 } 11982 var style_default10 = { "root": "_02872bf298eadc43__root", "header": "bbccc92e6ba5662d__header", "content": "_5dffdaf2a6e669ac__content", "fullbleed": "c1fa192587e1b4a6__fullbleed" }; 11983 var Header = (0, import_element27.forwardRef)( 11984 function CardHeader({ render, ...props }, ref) { 11985 const element = useRender({ 11986 defaultTagName: "div", 11987 render, 11988 ref, 11989 props: mergeProps({ className: style_default10.header }, props) 11990 }); 11991 return element; 11992 } 11993 ); 11994 11995 // packages/ui/build-module/card/content.mjs 11996 var import_element28 = __toESM(require_element(), 1); 11997 var STYLE_HASH_ATTRIBUTE12 = "data-wp-hash"; 11998 function getRuntime12() { 11999 const globalScope = globalThis; 12000 if (globalScope.__wpStyleRuntime) { 12001 return globalScope.__wpStyleRuntime; 12002 } 12003 globalScope.__wpStyleRuntime = { 12004 documents: /* @__PURE__ */ new Map(), 12005 styles: /* @__PURE__ */ new Map(), 12006 injectedStyles: /* @__PURE__ */ new WeakMap() 12007 }; 12008 if (typeof document !== "undefined") { 12009 registerDocument12(document); 12010 } 12011 return globalScope.__wpStyleRuntime; 12012 } 12013 function documentContainsStyleHash12(targetDocument, hash) { 12014 if (!targetDocument.head) { 12015 return false; 12016 } 12017 for (const style of targetDocument.head.querySelectorAll( 12018 `style[$STYLE_HASH_ATTRIBUTE12}]` 12019 )) { 12020 if (style.getAttribute(STYLE_HASH_ATTRIBUTE12) === hash) { 12021 return true; 12022 } 12023 } 12024 return false; 12025 } 12026 function injectStyle12(targetDocument, hash, css) { 12027 if (!targetDocument.head) { 12028 return; 12029 } 12030 const runtime = getRuntime12(); 12031 let injectedStyles = runtime.injectedStyles.get(targetDocument); 12032 if (!injectedStyles) { 12033 injectedStyles = /* @__PURE__ */ new Set(); 12034 runtime.injectedStyles.set(targetDocument, injectedStyles); 12035 } 12036 if (injectedStyles.has(hash)) { 12037 return; 12038 } 12039 if (documentContainsStyleHash12(targetDocument, hash)) { 12040 injectedStyles.add(hash); 12041 return; 12042 } 12043 const style = targetDocument.createElement("style"); 12044 style.setAttribute(STYLE_HASH_ATTRIBUTE12, hash); 12045 style.appendChild(targetDocument.createTextNode(css)); 12046 targetDocument.head.appendChild(style); 12047 injectedStyles.add(hash); 12048 } 12049 function registerDocument12(targetDocument) { 12050 const runtime = getRuntime12(); 12051 runtime.documents.set( 12052 targetDocument, 12053 (runtime.documents.get(targetDocument) ?? 0) + 1 12054 ); 12055 for (const [hash, css] of runtime.styles) { 12056 injectStyle12(targetDocument, hash, css); 12057 } 12058 return () => { 12059 const count = runtime.documents.get(targetDocument); 12060 if (count === void 0) { 12061 return; 12062 } 12063 if (count <= 1) { 12064 runtime.documents.delete(targetDocument); 12065 return; 12066 } 12067 runtime.documents.set(targetDocument, count - 1); 12068 }; 12069 } 12070 function registerStyle12(hash, css) { 12071 const runtime = getRuntime12(); 12072 runtime.styles.set(hash, css); 12073 for (const targetDocument of runtime.documents.keys()) { 12074 injectStyle12(targetDocument, hash, css); 12075 } 12076 } 12077 if (typeof process === "undefined" || true) { 12078 registerStyle12("cb866dcef6", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer 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-background-surface-neutral-strong,#fff);border:1px solid var(--wpds-color-stroke-surface-neutral,#dbdbdb);border-radius:var(--wpds-border-radius-lg,8px);color:var(--wpds-color-foreground-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)}}}"); 12079 } 12080 var style_default11 = { "root": "_02872bf298eadc43__root", "header": "bbccc92e6ba5662d__header", "content": "_5dffdaf2a6e669ac__content", "fullbleed": "c1fa192587e1b4a6__fullbleed" }; 12081 var Content = (0, import_element28.forwardRef)( 12082 function CardContent({ render, ...props }, ref) { 12083 const element = useRender({ 12084 defaultTagName: "div", 12085 render, 12086 ref, 12087 props: mergeProps({ className: style_default11.content }, props) 12088 }); 12089 return element; 12090 } 12091 ); 12092 12093 // packages/ui/build-module/card/full-bleed.mjs 12094 var import_element29 = __toESM(require_element(), 1); 12095 var STYLE_HASH_ATTRIBUTE13 = "data-wp-hash"; 12096 function getRuntime13() { 12097 const globalScope = globalThis; 12098 if (globalScope.__wpStyleRuntime) { 12099 return globalScope.__wpStyleRuntime; 12100 } 12101 globalScope.__wpStyleRuntime = { 12102 documents: /* @__PURE__ */ new Map(), 12103 styles: /* @__PURE__ */ new Map(), 12104 injectedStyles: /* @__PURE__ */ new WeakMap() 12105 }; 12106 if (typeof document !== "undefined") { 12107 registerDocument13(document); 12108 } 12109 return globalScope.__wpStyleRuntime; 12110 } 12111 function documentContainsStyleHash13(targetDocument, hash) { 12112 if (!targetDocument.head) { 12113 return false; 12114 } 12115 for (const style of targetDocument.head.querySelectorAll( 12116 `style[$STYLE_HASH_ATTRIBUTE13}]` 12117 )) { 12118 if (style.getAttribute(STYLE_HASH_ATTRIBUTE13) === hash) { 12119 return true; 12120 } 12121 } 12122 return false; 12123 } 12124 function injectStyle13(targetDocument, hash, css) { 12125 if (!targetDocument.head) { 12126 return; 12127 } 12128 const runtime = getRuntime13(); 12129 let injectedStyles = runtime.injectedStyles.get(targetDocument); 12130 if (!injectedStyles) { 12131 injectedStyles = /* @__PURE__ */ new Set(); 12132 runtime.injectedStyles.set(targetDocument, injectedStyles); 12133 } 12134 if (injectedStyles.has(hash)) { 12135 return; 12136 } 12137 if (documentContainsStyleHash13(targetDocument, hash)) { 12138 injectedStyles.add(hash); 12139 return; 12140 } 12141 const style = targetDocument.createElement("style"); 12142 style.setAttribute(STYLE_HASH_ATTRIBUTE13, hash); 12143 style.appendChild(targetDocument.createTextNode(css)); 12144 targetDocument.head.appendChild(style); 12145 injectedStyles.add(hash); 12146 } 12147 function registerDocument13(targetDocument) { 12148 const runtime = getRuntime13(); 12149 runtime.documents.set( 12150 targetDocument, 12151 (runtime.documents.get(targetDocument) ?? 0) + 1 12152 ); 12153 for (const [hash, css] of runtime.styles) { 12154 injectStyle13(targetDocument, hash, css); 12155 } 12156 return () => { 12157 const count = runtime.documents.get(targetDocument); 12158 if (count === void 0) { 12159 return; 12160 } 12161 if (count <= 1) { 12162 runtime.documents.delete(targetDocument); 12163 return; 12164 } 12165 runtime.documents.set(targetDocument, count - 1); 12166 }; 12167 } 12168 function registerStyle13(hash, css) { 12169 const runtime = getRuntime13(); 12170 runtime.styles.set(hash, css); 12171 for (const targetDocument of runtime.documents.keys()) { 12172 injectStyle13(targetDocument, hash, css); 12173 } 12174 } 12175 if (typeof process === "undefined" || true) { 12176 registerStyle13("cb866dcef6", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer 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-background-surface-neutral-strong,#fff);border:1px solid var(--wpds-color-stroke-surface-neutral,#dbdbdb);border-radius:var(--wpds-border-radius-lg,8px);color:var(--wpds-color-foreground-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)}}}"); 12177 } 12178 var style_default12 = { "root": "_02872bf298eadc43__root", "header": "bbccc92e6ba5662d__header", "content": "_5dffdaf2a6e669ac__content", "fullbleed": "c1fa192587e1b4a6__fullbleed" }; 12179 var FullBleed = (0, import_element29.forwardRef)( 12180 function CardFullBleed({ render, ...props }, ref) { 12181 const element = useRender({ 12182 defaultTagName: "div", 12183 render, 12184 ref, 12185 props: mergeProps( 12186 { className: style_default12.fullbleed }, 12187 props 12188 ) 12189 }); 12190 return element; 12191 } 12192 ); 12193 12194 // packages/ui/build-module/card/title.mjs 12195 var import_element30 = __toESM(require_element(), 1); 12196 var import_jsx_runtime49 = __toESM(require_jsx_runtime(), 1); 12197 var DEFAULT_TAG = /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", {}); 12198 var Title = (0, import_element30.forwardRef)( 12199 function CardTitle({ render = DEFAULT_TAG, children, ...props }, ref) { 12200 return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)( 12201 Text, 12202 { 12203 ref, 12204 variant: "heading-lg", 12205 render, 12206 ...props, 12207 children 12208 } 12209 ); 12210 } 12211 ); 12212 12213 // packages/ui/build-module/collapsible/panel.mjs 12214 var import_element31 = __toESM(require_element(), 1); 12215 var import_jsx_runtime50 = __toESM(require_jsx_runtime(), 1); 12216 var Panel2 = (0, import_element31.forwardRef)( 12217 function CollapsiblePanel3(props, forwardedRef) { 12218 return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(index_parts_exports.Panel, { ref: forwardedRef, ...props }); 12219 } 12220 ); 12221 12222 // packages/ui/build-module/collapsible/root.mjs 12223 var import_element32 = __toESM(require_element(), 1); 12224 var import_jsx_runtime51 = __toESM(require_jsx_runtime(), 1); 12225 var Root3 = (0, import_element32.forwardRef)( 12226 function CollapsibleRoot3(props, forwardedRef) { 12227 return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(index_parts_exports.Root, { ref: forwardedRef, ...props }); 12228 } 12229 ); 12230 12231 // packages/ui/build-module/collapsible/trigger.mjs 12232 var import_element33 = __toESM(require_element(), 1); 12233 var import_jsx_runtime52 = __toESM(require_jsx_runtime(), 1); 12234 var Trigger2 = (0, import_element33.forwardRef)( 12235 function CollapsibleTrigger3(props, forwardedRef) { 12236 return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(index_parts_exports.Trigger, { ref: forwardedRef, ...props }); 12237 } 12238 ); 12239 12240 // packages/ui/build-module/collapsible-card/index.mjs 12241 var collapsible_card_exports = {}; 12242 __export(collapsible_card_exports, { 12243 Content: () => Content2, 12244 Header: () => Header2, 12245 HeaderDescription: () => HeaderDescription, 12246 Root: () => Root32 12247 }); 12248 12249 // packages/ui/build-module/collapsible-card/root.mjs 12250 var import_element34 = __toESM(require_element(), 1); 12251 var import_jsx_runtime53 = __toESM(require_jsx_runtime(), 1); 12252 var Root32 = (0, import_element34.forwardRef)( 12253 function CollapsibleCardRoot({ render, ...restProps }, ref) { 12254 return /* @__PURE__ */ (0, import_jsx_runtime53.jsx)( 12255 Root3, 12256 { 12257 ref, 12258 render: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(Root2, { render }), 12259 ...restProps 12260 } 12261 ); 12262 } 12263 ); 12264 12265 // packages/ui/build-module/collapsible-card/header.mjs 12266 var import_compose3 = __toESM(require_compose(), 1); 12267 var import_element36 = __toESM(require_element(), 1); 12268 12269 // packages/ui/build-module/collapsible-card/context.mjs 12270 var import_element35 = __toESM(require_element(), 1); 12271 var HeaderDescriptionIdContext = (0, import_element35.createContext)(null); 12272 12273 // packages/ui/build-module/collapsible-card/header.mjs 12274 var import_jsx_runtime54 = __toESM(require_jsx_runtime(), 1); 12275 var STYLE_HASH_ATTRIBUTE14 = "data-wp-hash"; 12276 function getRuntime14() { 12277 const globalScope = globalThis; 12278 if (globalScope.__wpStyleRuntime) { 12279 return globalScope.__wpStyleRuntime; 12280 } 12281 globalScope.__wpStyleRuntime = { 12282 documents: /* @__PURE__ */ new Map(), 12283 styles: /* @__PURE__ */ new Map(), 12284 injectedStyles: /* @__PURE__ */ new WeakMap() 12285 }; 12286 if (typeof document !== "undefined") { 12287 registerDocument14(document); 12288 } 12289 return globalScope.__wpStyleRuntime; 12290 } 12291 function documentContainsStyleHash14(targetDocument, hash) { 12292 if (!targetDocument.head) { 12293 return false; 12294 } 12295 for (const style of targetDocument.head.querySelectorAll( 12296 `style[$STYLE_HASH_ATTRIBUTE14}]` 12297 )) { 12298 if (style.getAttribute(STYLE_HASH_ATTRIBUTE14) === hash) { 12299 return true; 12300 } 12301 } 12302 return false; 12303 } 12304 function injectStyle14(targetDocument, hash, css) { 12305 if (!targetDocument.head) { 12306 return; 12307 } 12308 const runtime = getRuntime14(); 12309 let injectedStyles = runtime.injectedStyles.get(targetDocument); 12310 if (!injectedStyles) { 12311 injectedStyles = /* @__PURE__ */ new Set(); 12312 runtime.injectedStyles.set(targetDocument, injectedStyles); 12313 } 12314 if (injectedStyles.has(hash)) { 12315 return; 12316 } 12317 if (documentContainsStyleHash14(targetDocument, hash)) { 12318 injectedStyles.add(hash); 12319 return; 12320 } 12321 const style = targetDocument.createElement("style"); 12322 style.setAttribute(STYLE_HASH_ATTRIBUTE14, hash); 12323 style.appendChild(targetDocument.createTextNode(css)); 12324 targetDocument.head.appendChild(style); 12325 injectedStyles.add(hash); 12326 } 12327 function registerDocument14(targetDocument) { 12328 const runtime = getRuntime14(); 12329 runtime.documents.set( 12330 targetDocument, 12331 (runtime.documents.get(targetDocument) ?? 0) + 1 12332 ); 12333 for (const [hash, css] of runtime.styles) { 12334 injectStyle14(targetDocument, hash, css); 12335 } 12336 return () => { 12337 const count = runtime.documents.get(targetDocument); 12338 if (count === void 0) { 12339 return; 12340 } 12341 if (count <= 1) { 12342 runtime.documents.delete(targetDocument); 12343 return; 12344 } 12345 runtime.documents.set(targetDocument, count - 1); 12346 }; 12347 } 12348 function registerStyle14(hash, css) { 12349 const runtime = getRuntime14(); 12350 runtime.styles.set(hash, css); 12351 for (const targetDocument of runtime.documents.keys()) { 12352 injectStyle14(targetDocument, hash, css); 12353 } 12354 } 12355 if (typeof process === "undefined" || true) { 12356 registerStyle14("64bdb4d46e", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer 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}._92ebbaa30c8a1d05__header-description{color:var(--wpds-color-foreground-content-neutral-weak,#707070)}.dd89d27c4f15912d__header-trigger-positioner{align-self:flex-start;flex-shrink:0;margin-block-start:calc(var(--wpds-typography-line-height-sm, 20px)/2);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-foreground-interactive-neutral-disabled,#8d8d8d)}.e34cf37ccd0d81e0__content{height:var(--collapsible-panel-height);margin-block-start:var(--wp-ui-card-header-content-margin);overflow:hidden;&._03cfdbcd710393c9__overflow-visible{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 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)}}}}"); 12357 } 12358 var style_default13 = { "heading-wrapper": "_626190151275d6d3__heading-wrapper", "header-content": "cab17c7a373cb60d__header-content", "header-description": "_92ebbaa30c8a1d05__header-description", "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", "overflow-visible": "_03cfdbcd710393c9__overflow-visible", "content-inner": "_41bfdbf7b6c087c2__content-inner" }; 12359 if (typeof process === "undefined" || true) { 12360 registerStyle14("e8e31009f5", "._6defc79820e382c6__button{box-sizing:var(--_gcd-button-box-sizing,border-box);font-family:var(--_gcd-button-font-family,inherit);font-size:var(--_gcd-button-font-size,inherit);font-weight:var(--_gcd-button-font-weight,inherit)}.d2cff2e5dea83bd1__input{box-sizing:var(--_gcd-input-box-sizing,border-box);font-family:var(--_gcd-input-font-family,inherit);font-size:var(--_gcd-input-font-size,inherit);font-weight:var(--_gcd-input-font-weight,inherit);margin:var(--_gcd-input-margin,0);&::placeholder{color:var(--_gcd-input-placeholder-color,var(--wpds-color-foreground-interactive-neutral-weak,#707070))}&:is(textarea,[type=text],[type=password],[type=color],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){background-color:var(--_gcd-input-background-color,transparent);border:var(--_gcd-input-border,none);border-radius:var(--_gcd-input-border-radius,0);box-shadow:var(--_gcd-input-box-shadow,0 0 0 transparent);color:var(--_gcd-input-color,var(--wpds-color-foreground-interactive-neutral,#1e1e1e));&:focus{border-color:var(--_gcd-input-border-color-focus,var(--wp-admin-theme-color));box-shadow:var(--_gcd-input-box-shadow-focus,none);outline:var(--_gcd-input-outline-focus,none)}&:disabled{background:var(--_gcd-input-background-disabled,transparent);border-color:var(--_gcd-input-border-color-disabled,transparent);box-shadow:var(--_gcd-input-box-shadow-disabled,none);color:var(--_gcd-input-color-disabled,var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d))}}&:is(textarea,[type=text],[type=password],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){line-height:var(--_gcd-input-line-height,inherit);min-height:var(--_gcd-input-min-height,auto);padding:var(--_gcd-input-padding,0)}}._547d86373d02e108__textarea{box-sizing:var(--_gcd-textarea-box-sizing,border-box);overflow:var(--_gcd-textarea-overflow,auto);resize:var(--_gcd-textarea-resize,block)}._8c15fd0ed9f28ba4__div{outline:var(--_gcd-div-outline,0 solid transparent)}p._43cec3e1eec1066d__p{font-size:var(--_gcd-p-font-size,13px);line-height:var(--_gcd-p-line-height,1.5);margin:var(--_gcd-p-margin,0)}:is(h1,h2,h3,h4,h5,h6).e97669c6d9a38497__heading{color:var(--_gcd-heading-color,var(--wpds-color-foreground-content-neutral,#1e1e1e));font-size:var(--_gcd-heading-font-size,inherit);font-weight:var(--_gcd-heading-font-weight,var(--wpds-typography-font-weight-emphasis,600));margin:var(--_gcd-heading-margin,0)}._2c0831b0499dbd6e__a,._2c0831b0499dbd6e__a:is(:hover,:focus,:active){border-radius:var(--_gcd-a-border-radius,0);box-shadow:var(--_gcd-a-box-shadow,none);color:var(--_gcd-a-color,inherit);outline:var(--_gcd-a-outline,0 solid transparent);transition:var(--_gcd-a-transition,none)}.c59a0ebebd71fa4a__ol{list-style:var(--_gcd-ol-list-style,none);margin:var(--_gcd-ol-margin,0);padding-block:var(--_gcd-ol-padding-block,0);padding-inline:var(--_gcd-ol-padding-inline,0)}._46b5cb0c8e24e8c9__li{margin:var(--_gcd-li-margin,0)}"); 12361 } 12362 var global_css_defense_default4 = { "button": "_6defc79820e382c6__button", "input": "d2cff2e5dea83bd1__input", "textarea": "_547d86373d02e108__textarea", "div": "_8c15fd0ed9f28ba4__div", "p": "_43cec3e1eec1066d__p", "heading": "e97669c6d9a38497__heading", "a": "_2c0831b0499dbd6e__a", "ol": "c59a0ebebd71fa4a__ol", "li": "_46b5cb0c8e24e8c9__li" }; 12363 if (typeof process === "undefined" || true) { 12364 registerStyle14("08122b3d53", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{.af79fb116edb0dd7__outset-ring--focus:focus,.dfcfdc28396e5d98__outset-ring--focus-visible:focus-visible,.e5cd9ee879f6403a__outset-ring--focus-within:focus-within,:focus-visible ._81935a08e952f267__outset-ring--focus-parent-visible{--_gcd-a-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));--_gcd-div-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));outline-offset:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px))}._3c9f5ee9fc9c136d__outset-ring--focus-within-except-active:focus-within,.abc777e9713fa711__outset-ring--focus-except-active:focus{outline:none}._3c9f5ee9fc9c136d__outset-ring--focus-within-except-active:focus-within:not(:has(:active)),.abc777e9713fa711__outset-ring--focus-except-active:focus:not(:active){--_gcd-a-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));--_gcd-div-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--focus-color,var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9)));outline-offset:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px))}}}"); 12365 } 12366 var focus_module_default3 = { "outset-ring--focus": "af79fb116edb0dd7__outset-ring--focus", "outset-ring--focus-visible": "dfcfdc28396e5d98__outset-ring--focus-visible", "outset-ring--focus-within": "e5cd9ee879f6403a__outset-ring--focus-within", "outset-ring--focus-parent-visible": "_81935a08e952f267__outset-ring--focus-parent-visible", "outset-ring--focus-except-active": "abc777e9713fa711__outset-ring--focus-except-active", "outset-ring--focus-within-except-active": "_3c9f5ee9fc9c136d__outset-ring--focus-within-except-active" }; 12367 var Header2 = (0, import_element36.forwardRef)( 12368 function CollapsibleCardHeader({ 12369 children, 12370 className, 12371 render, 12372 "aria-describedby": ariaDescribedByProp, 12373 ...restProps 12374 }, ref) { 12375 const [descriptionIds, setDescriptionIds] = (0, import_element36.useState)( 12376 [] 12377 ); 12378 const [orderedDescriptionIds, setOrderedDescriptionIds] = (0, import_element36.useState)([]); 12379 const headerContentRef = (0, import_element36.useRef)(null); 12380 const registerDescriptionId = (0, import_element36.useCallback)((id) => { 12381 setDescriptionIds((currentDescriptionIds) => { 12382 if (currentDescriptionIds.includes(id)) { 12383 return currentDescriptionIds; 12384 } 12385 return [...currentDescriptionIds, id]; 12386 }); 12387 return () => { 12388 setDescriptionIds( 12389 (currentDescriptionIds) => currentDescriptionIds.filter( 12390 (descriptionId) => descriptionId !== id 12391 ) 12392 ); 12393 }; 12394 }, []); 12395 const contextValue = (0, import_element36.useMemo)( 12396 () => ({ registerDescriptionId }), 12397 [registerDescriptionId] 12398 ); 12399 (0, import_compose3.useIsomorphicLayoutEffect)(() => { 12400 const registeredDescriptionIds = new Set(descriptionIds); 12401 const nextDescriptionIds = Array.from( 12402 headerContentRef.current?.querySelectorAll("[id]") ?? [] 12403 ).map((element) => element.id).filter((id) => registeredDescriptionIds.has(id)); 12404 setOrderedDescriptionIds((currentDescriptionIds) => { 12405 if (currentDescriptionIds.length === nextDescriptionIds.length && currentDescriptionIds.every( 12406 (id, index2) => id === nextDescriptionIds[index2] 12407 )) { 12408 return currentDescriptionIds; 12409 } 12410 return nextDescriptionIds; 12411 }); 12412 }); 12413 const ariaDescribedBy = Array.from( 12414 /* @__PURE__ */ new Set([ 12415 ...ariaDescribedByProp?.split(/\s+/).filter(Boolean) ?? [], 12416 ...orderedDescriptionIds 12417 ]) 12418 ).join(" ") || void 0; 12419 return useRender({ 12420 defaultTagName: "div", 12421 render, 12422 ref, 12423 props: mergeProps(restProps, { 12424 className: clsx_default( 12425 global_css_defense_default4.heading, 12426 style_default13["heading-wrapper"], 12427 className 12428 ), 12429 children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(HeaderDescriptionIdContext.Provider, { value: contextValue, children: /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)( 12430 Trigger2, 12431 { 12432 className: style_default13.header, 12433 render: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(Header, {}), 12434 nativeButton: false, 12435 "aria-describedby": ariaDescribedBy, 12436 children: [ 12437 /* @__PURE__ */ (0, import_jsx_runtime54.jsx)( 12438 "div", 12439 { 12440 ref: headerContentRef, 12441 className: style_default13["header-content"], 12442 children 12443 } 12444 ), 12445 /* @__PURE__ */ (0, import_jsx_runtime54.jsx)( 12446 "div", 12447 { 12448 className: clsx_default( 12449 style_default13["header-trigger-positioner"] 12450 ), 12451 children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)( 12452 "div", 12453 { 12454 className: clsx_default( 12455 style_default13["header-trigger-wrapper"], 12456 global_css_defense_default4.div, 12457 // While the interactive trigger element is the whole header, 12458 // the focus ring will be displayed only on the icon to visually 12459 // emulate it being the button. 12460 focus_module_default3["outset-ring--focus-parent-visible"] 12461 ), 12462 children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)( 12463 Icon, 12464 { 12465 icon: chevron_down_default, 12466 className: style_default13["header-trigger"] 12467 } 12468 ) 12469 } 12470 ) 12471 } 12472 ) 12473 ] 12474 } 12475 ) }) 12476 }) 12477 }); 12478 } 12479 ); 12480 12481 // packages/ui/build-module/collapsible-card/header-description.mjs 12482 var import_element37 = __toESM(require_element(), 1); 12483 var import_jsx_runtime55 = __toESM(require_jsx_runtime(), 1); 12484 var STYLE_HASH_ATTRIBUTE15 = "data-wp-hash"; 12485 function getRuntime15() { 12486 const globalScope = globalThis; 12487 if (globalScope.__wpStyleRuntime) { 12488 return globalScope.__wpStyleRuntime; 12489 } 12490 globalScope.__wpStyleRuntime = { 12491 documents: /* @__PURE__ */ new Map(), 12492 styles: /* @__PURE__ */ new Map(), 12493 injectedStyles: /* @__PURE__ */ new WeakMap() 12494 }; 12495 if (typeof document !== "undefined") { 12496 registerDocument15(document); 12497 } 12498 return globalScope.__wpStyleRuntime; 12499 } 12500 function documentContainsStyleHash15(targetDocument, hash) { 12501 if (!targetDocument.head) { 12502 return false; 12503 } 12504 for (const style of targetDocument.head.querySelectorAll( 12505 `style[$STYLE_HASH_ATTRIBUTE15}]` 12506 )) { 12507 if (style.getAttribute(STYLE_HASH_ATTRIBUTE15) === hash) { 12508 return true; 12509 } 12510 } 12511 return false; 12512 } 12513 function injectStyle15(targetDocument, hash, css) { 12514 if (!targetDocument.head) { 12515 return; 12516 } 12517 const runtime = getRuntime15(); 12518 let injectedStyles = runtime.injectedStyles.get(targetDocument); 12519 if (!injectedStyles) { 12520 injectedStyles = /* @__PURE__ */ new Set(); 12521 runtime.injectedStyles.set(targetDocument, injectedStyles); 12522 } 12523 if (injectedStyles.has(hash)) { 12524 return; 12525 } 12526 if (documentContainsStyleHash15(targetDocument, hash)) { 12527 injectedStyles.add(hash); 12528 return; 12529 } 12530 const style = targetDocument.createElement("style"); 12531 style.setAttribute(STYLE_HASH_ATTRIBUTE15, hash); 12532 style.appendChild(targetDocument.createTextNode(css)); 12533 targetDocument.head.appendChild(style); 12534 injectedStyles.add(hash); 12535 } 12536 function registerDocument15(targetDocument) { 12537 const runtime = getRuntime15(); 12538 runtime.documents.set( 12539 targetDocument, 12540 (runtime.documents.get(targetDocument) ?? 0) + 1 12541 ); 12542 for (const [hash, css] of runtime.styles) { 12543 injectStyle15(targetDocument, hash, css); 12544 } 12545 return () => { 12546 const count = runtime.documents.get(targetDocument); 12547 if (count === void 0) { 12548 return; 12549 } 12550 if (count <= 1) { 12551 runtime.documents.delete(targetDocument); 12552 return; 12553 } 12554 runtime.documents.set(targetDocument, count - 1); 12555 }; 12556 } 12557 function registerStyle15(hash, css) { 12558 const runtime = getRuntime15(); 12559 runtime.styles.set(hash, css); 12560 for (const targetDocument of runtime.documents.keys()) { 12561 injectStyle15(targetDocument, hash, css); 12562 } 12563 } 12564 if (typeof process === "undefined" || true) { 12565 registerStyle15("64bdb4d46e", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer 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}._92ebbaa30c8a1d05__header-description{color:var(--wpds-color-foreground-content-neutral-weak,#707070)}.dd89d27c4f15912d__header-trigger-positioner{align-self:flex-start;flex-shrink:0;margin-block-start:calc(var(--wpds-typography-line-height-sm, 20px)/2);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-foreground-interactive-neutral-disabled,#8d8d8d)}.e34cf37ccd0d81e0__content{height:var(--collapsible-panel-height);margin-block-start:var(--wp-ui-card-header-content-margin);overflow:hidden;&._03cfdbcd710393c9__overflow-visible{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 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)}}}}"); 12566 } 12567 var style_default14 = { "heading-wrapper": "_626190151275d6d3__heading-wrapper", "header-content": "cab17c7a373cb60d__header-content", "header-description": "_92ebbaa30c8a1d05__header-description", "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", "overflow-visible": "_03cfdbcd710393c9__overflow-visible", "content-inner": "_41bfdbf7b6c087c2__content-inner" }; 12568 var DEFAULT_TAG2 = /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("div", {}); 12569 var HeaderDescription = (0, import_element37.forwardRef)(function CollapsibleCardHeaderDescription({ children, className, id: idProp, render = DEFAULT_TAG2, ...restProps }, ref) { 12570 const generatedId = (0, import_element37.useId)(); 12571 const descriptionId = idProp ?? generatedId; 12572 const context = (0, import_element37.useContext)(HeaderDescriptionIdContext); 12573 if (!context) { 12574 throw new Error( 12575 "CollapsibleCard.HeaderDescription: Missing parent <CollapsibleCard.Header>. Render <CollapsibleCard.HeaderDescription> inside <CollapsibleCard.Header>." 12576 ); 12577 } 12578 (0, import_element37.useEffect)(() => { 12579 return context?.registerDescriptionId(descriptionId); 12580 }, [context, descriptionId]); 12581 return /* @__PURE__ */ (0, import_jsx_runtime55.jsx)( 12582 Text, 12583 { 12584 ref, 12585 variant: "body-md", 12586 render, 12587 id: descriptionId, 12588 "aria-hidden": "true", 12589 className: clsx_default(style_default14["header-description"], className), 12590 ...restProps, 12591 children 12592 } 12593 ); 12594 }); 12595 12596 // packages/ui/build-module/collapsible-card/content.mjs 12597 var import_element38 = __toESM(require_element(), 1); 12598 var import_jsx_runtime56 = __toESM(require_jsx_runtime(), 1); 12599 var STYLE_HASH_ATTRIBUTE16 = "data-wp-hash"; 12600 function getRuntime16() { 12601 const globalScope = globalThis; 12602 if (globalScope.__wpStyleRuntime) { 12603 return globalScope.__wpStyleRuntime; 12604 } 12605 globalScope.__wpStyleRuntime = { 12606 documents: /* @__PURE__ */ new Map(), 12607 styles: /* @__PURE__ */ new Map(), 12608 injectedStyles: /* @__PURE__ */ new WeakMap() 12609 }; 12610 if (typeof document !== "undefined") { 12611 registerDocument16(document); 12612 } 12613 return globalScope.__wpStyleRuntime; 12614 } 12615 function documentContainsStyleHash16(targetDocument, hash) { 12616 if (!targetDocument.head) { 12617 return false; 12618 } 12619 for (const style of targetDocument.head.querySelectorAll( 12620 `style[$STYLE_HASH_ATTRIBUTE16}]` 12621 )) { 12622 if (style.getAttribute(STYLE_HASH_ATTRIBUTE16) === hash) { 12623 return true; 12624 } 12625 } 12626 return false; 12627 } 12628 function injectStyle16(targetDocument, hash, css) { 12629 if (!targetDocument.head) { 12630 return; 12631 } 12632 const runtime = getRuntime16(); 12633 let injectedStyles = runtime.injectedStyles.get(targetDocument); 12634 if (!injectedStyles) { 12635 injectedStyles = /* @__PURE__ */ new Set(); 12636 runtime.injectedStyles.set(targetDocument, injectedStyles); 12637 } 12638 if (injectedStyles.has(hash)) { 12639 return; 12640 } 12641 if (documentContainsStyleHash16(targetDocument, hash)) { 12642 injectedStyles.add(hash); 12643 return; 12644 } 12645 const style = targetDocument.createElement("style"); 12646 style.setAttribute(STYLE_HASH_ATTRIBUTE16, hash); 12647 style.appendChild(targetDocument.createTextNode(css)); 12648 targetDocument.head.appendChild(style); 12649 injectedStyles.add(hash); 12650 } 12651 function registerDocument16(targetDocument) { 12652 const runtime = getRuntime16(); 12653 runtime.documents.set( 12654 targetDocument, 12655 (runtime.documents.get(targetDocument) ?? 0) + 1 12656 ); 12657 for (const [hash, css] of runtime.styles) { 12658 injectStyle16(targetDocument, hash, css); 12659 } 12660 return () => { 12661 const count = runtime.documents.get(targetDocument); 12662 if (count === void 0) { 12663 return; 12664 } 12665 if (count <= 1) { 12666 runtime.documents.delete(targetDocument); 12667 return; 12668 } 12669 runtime.documents.set(targetDocument, count - 1); 12670 }; 12671 } 12672 function registerStyle16(hash, css) { 12673 const runtime = getRuntime16(); 12674 runtime.styles.set(hash, css); 12675 for (const targetDocument of runtime.documents.keys()) { 12676 injectStyle16(targetDocument, hash, css); 12677 } 12678 } 12679 if (typeof process === "undefined" || true) { 12680 registerStyle16("64bdb4d46e", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer 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}._92ebbaa30c8a1d05__header-description{color:var(--wpds-color-foreground-content-neutral-weak,#707070)}.dd89d27c4f15912d__header-trigger-positioner{align-self:flex-start;flex-shrink:0;margin-block-start:calc(var(--wpds-typography-line-height-sm, 20px)/2);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-foreground-interactive-neutral-disabled,#8d8d8d)}.e34cf37ccd0d81e0__content{height:var(--collapsible-panel-height);margin-block-start:var(--wp-ui-card-header-content-margin);overflow:hidden;&._03cfdbcd710393c9__overflow-visible{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 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)}}}}"); 12681 } 12682 var style_default15 = { "heading-wrapper": "_626190151275d6d3__heading-wrapper", "header-content": "cab17c7a373cb60d__header-content", "header-description": "_92ebbaa30c8a1d05__header-description", "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", "overflow-visible": "_03cfdbcd710393c9__overflow-visible", "content-inner": "_41bfdbf7b6c087c2__content-inner" }; 12683 var Content2 = (0, import_element38.forwardRef)( 12684 function CollapsibleCardContent({ className, render, children, hiddenUntilFound = true, ...restProps }, ref) { 12685 return /* @__PURE__ */ (0, import_jsx_runtime56.jsx)( 12686 Panel2, 12687 { 12688 ref, 12689 className: (state) => clsx_default( 12690 style_default15.content, 12691 state.open && state.transitionStatus === "idle" && style_default15["overflow-visible"], 12692 className 12693 ), 12694 hiddenUntilFound, 12695 ...restProps, 12696 children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)( 12697 Content, 12698 { 12699 className: style_default15["content-inner"], 12700 render, 12701 children 12702 } 12703 ) 12704 } 12705 ); 12706 } 12707 ); 12708 12709 // packages/ui/build-module/stack/stack.mjs 12710 var import_element39 = __toESM(require_element(), 1); 12711 var STYLE_HASH_ATTRIBUTE17 = "data-wp-hash"; 12712 function getRuntime17() { 12713 const globalScope = globalThis; 12714 if (globalScope.__wpStyleRuntime) { 12715 return globalScope.__wpStyleRuntime; 12716 } 12717 globalScope.__wpStyleRuntime = { 12718 documents: /* @__PURE__ */ new Map(), 12719 styles: /* @__PURE__ */ new Map(), 12720 injectedStyles: /* @__PURE__ */ new WeakMap() 12721 }; 12722 if (typeof document !== "undefined") { 12723 registerDocument17(document); 12724 } 12725 return globalScope.__wpStyleRuntime; 12726 } 12727 function documentContainsStyleHash17(targetDocument, hash) { 12728 if (!targetDocument.head) { 12729 return false; 12730 } 12731 for (const style of targetDocument.head.querySelectorAll( 12732 `style[$STYLE_HASH_ATTRIBUTE17}]` 12733 )) { 12734 if (style.getAttribute(STYLE_HASH_ATTRIBUTE17) === hash) { 12735 return true; 12736 } 12737 } 12738 return false; 12739 } 12740 function injectStyle17(targetDocument, hash, css) { 12741 if (!targetDocument.head) { 12742 return; 12743 } 12744 const runtime = getRuntime17(); 12745 let injectedStyles = runtime.injectedStyles.get(targetDocument); 12746 if (!injectedStyles) { 12747 injectedStyles = /* @__PURE__ */ new Set(); 12748 runtime.injectedStyles.set(targetDocument, injectedStyles); 12749 } 12750 if (injectedStyles.has(hash)) { 12751 return; 12752 } 12753 if (documentContainsStyleHash17(targetDocument, hash)) { 12754 injectedStyles.add(hash); 12755 return; 12756 } 12757 const style = targetDocument.createElement("style"); 12758 style.setAttribute(STYLE_HASH_ATTRIBUTE17, hash); 12759 style.appendChild(targetDocument.createTextNode(css)); 12760 targetDocument.head.appendChild(style); 12761 injectedStyles.add(hash); 12762 } 12763 function registerDocument17(targetDocument) { 12764 const runtime = getRuntime17(); 12765 runtime.documents.set( 12766 targetDocument, 12767 (runtime.documents.get(targetDocument) ?? 0) + 1 12768 ); 12769 for (const [hash, css] of runtime.styles) { 12770 injectStyle17(targetDocument, hash, css); 12771 } 12772 return () => { 12773 const count = runtime.documents.get(targetDocument); 12774 if (count === void 0) { 12775 return; 12776 } 12777 if (count <= 1) { 12778 runtime.documents.delete(targetDocument); 12779 return; 12780 } 12781 runtime.documents.set(targetDocument, count - 1); 12782 }; 12783 } 12784 function registerStyle17(hash, css) { 12785 const runtime = getRuntime17(); 12786 runtime.styles.set(hash, css); 12787 for (const targetDocument of runtime.documents.keys()) { 12788 injectStyle17(targetDocument, hash, css); 12789 } 12790 } 12791 if (typeof process === "undefined" || true) { 12792 registerStyle17("32aba35fe1", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._19ce0419607e1896__stack{display:flex}}}"); 12793 } 12794 var style_default16 = { "stack": "_19ce0419607e1896__stack" }; 12795 var gapTokens = { 12796 xs: "var(--wpds-dimension-gap-xs, 4px)", 12797 sm: "var(--wpds-dimension-gap-sm, 8px)", 12798 md: "var(--wpds-dimension-gap-md, 12px)", 12799 lg: "var(--wpds-dimension-gap-lg, 16px)", 12800 xl: "var(--wpds-dimension-gap-xl, 24px)", 12801 "2xl": "var(--wpds-dimension-gap-2xl, 32px)", 12802 "3xl": "var(--wpds-dimension-gap-3xl, 40px)" 12803 }; 12804 var Stack = (0, import_element39.forwardRef)(function Stack2({ direction, gap, align, justify, wrap, render, ...props }, ref) { 12805 const style = { 12806 gap: gap && gapTokens[gap], 12807 alignItems: align, 12808 justifyContent: justify, 12809 flexDirection: direction, 12810 flexWrap: wrap 12811 }; 12812 const element = useRender({ 12813 render, 12814 ref, 12815 props: mergeProps(props, { style, className: style_default16.stack }) 12816 }); 12817 return element; 12818 }); 12819 12820 // packages/ui/build-module/notice/index.mjs 12821 var notice_exports = {}; 12822 __export(notice_exports, { 12823 ActionButton: () => ActionButton, 12824 ActionLink: () => ActionLink, 12825 Actions: () => Actions, 12826 CloseIcon: () => CloseIcon, 12827 Description: () => Description, 12828 Root: () => Root4, 12829 Title: () => Title2 12830 }); 12831 12832 // packages/ui/build-module/notice/root.mjs 12833 var import_a11y2 = __toESM(require_a11y(), 1); 12834 var import_element40 = __toESM(require_element(), 1); 12835 var import_jsx_runtime57 = __toESM(require_jsx_runtime(), 1); 12836 var STYLE_HASH_ATTRIBUTE18 = "data-wp-hash"; 12837 function getRuntime18() { 12838 const globalScope = globalThis; 12839 if (globalScope.__wpStyleRuntime) { 12840 return globalScope.__wpStyleRuntime; 12841 } 12842 globalScope.__wpStyleRuntime = { 12843 documents: /* @__PURE__ */ new Map(), 12844 styles: /* @__PURE__ */ new Map(), 12845 injectedStyles: /* @__PURE__ */ new WeakMap() 12846 }; 12847 if (typeof document !== "undefined") { 12848 registerDocument18(document); 12849 } 12850 return globalScope.__wpStyleRuntime; 12851 } 12852 function documentContainsStyleHash18(targetDocument, hash) { 12853 if (!targetDocument.head) { 12854 return false; 12855 } 12856 for (const style of targetDocument.head.querySelectorAll( 12857 `style[$STYLE_HASH_ATTRIBUTE18}]` 12858 )) { 12859 if (style.getAttribute(STYLE_HASH_ATTRIBUTE18) === hash) { 12860 return true; 12861 } 12862 } 12863 return false; 12864 } 12865 function injectStyle18(targetDocument, hash, css) { 12866 if (!targetDocument.head) { 12867 return; 12868 } 12869 const runtime = getRuntime18(); 12870 let injectedStyles = runtime.injectedStyles.get(targetDocument); 12871 if (!injectedStyles) { 12872 injectedStyles = /* @__PURE__ */ new Set(); 12873 runtime.injectedStyles.set(targetDocument, injectedStyles); 12874 } 12875 if (injectedStyles.has(hash)) { 12876 return; 12877 } 12878 if (documentContainsStyleHash18(targetDocument, hash)) { 12879 injectedStyles.add(hash); 12880 return; 12881 } 12882 const style = targetDocument.createElement("style"); 12883 style.setAttribute(STYLE_HASH_ATTRIBUTE18, hash); 12884 style.appendChild(targetDocument.createTextNode(css)); 12885 targetDocument.head.appendChild(style); 12886 injectedStyles.add(hash); 12887 } 12888 function registerDocument18(targetDocument) { 12889 const runtime = getRuntime18(); 12890 runtime.documents.set( 12891 targetDocument, 12892 (runtime.documents.get(targetDocument) ?? 0) + 1 12893 ); 12894 for (const [hash, css] of runtime.styles) { 12895 injectStyle18(targetDocument, hash, css); 12896 } 12897 return () => { 12898 const count = runtime.documents.get(targetDocument); 12899 if (count === void 0) { 12900 return; 12901 } 12902 if (count <= 1) { 12903 runtime.documents.delete(targetDocument); 12904 return; 12905 } 12906 runtime.documents.set(targetDocument, count - 1); 12907 }; 12908 } 12909 function registerStyle18(hash, css) { 12910 const runtime = getRuntime18(); 12911 runtime.styles.set(hash, css); 12912 for (const targetDocument of runtime.documents.keys()) { 12913 injectStyle18(targetDocument, hash, css); 12914 } 12915 } 12916 if (typeof process === "undefined" || true) { 12917 registerStyle18("10f3806643", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._336cd3e4e743482f__box-sizing{box-sizing:border-box;*,:after,:before{box-sizing:inherit}}}}"); 12918 } 12919 var resets_default5 = { "box-sizing": "_336cd3e4e743482f__box-sizing" }; 12920 if (typeof process === "undefined" || true) { 12921 registerStyle18("2e53930a41", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._4145abab73d17514__notice{--icon-height:var(--wpds-dimension-size-sm,24px);--text-vertical-padding:calc((var(--icon-height) - var(--wpds-typography-line-height-sm, 20px))/2);--wp-ui-notice-background-color:var(--wpds-color-background-surface-neutral-weak,#f4f4f4);--wp-ui-notice-border-color:var(--wpds-color-stroke-surface-neutral,#dbdbdb);--wp-ui-notice-text-color:var(--wpds-color-foreground-content-neutral,#1e1e1e);--wp-ui-notice-decorative-icon-color:var(--wpds-color-foreground-content-neutral,#1e1e1e);align-items:start;background-color:var(--wp-ui-notice-background-color);border:1px solid var(--wp-ui-notice-border-color);border-radius:var(--wpds-border-radius-lg,8px);container-type:inline-size;display:grid;grid-template-columns:auto 1fr auto;padding:var(--wpds-dimension-padding-md,12px)}.d0a25570cb528528__icon{color:var(--wp-ui-notice-decorative-icon-color);grid-column:1;grid-row:1;margin-inline-end:var(--wpds-dimension-gap-xs,4px)}._1904b570a89bb815__description,.b5397fb9d05389e3__title{color:var(--wp-ui-notice-text-color);grid-column:2;padding-block:var(--text-vertical-padding)}._0a1270dcdd79c031__actions{display:flex;flex-wrap:wrap;gap:var(--wpds-dimension-gap-md,12px);grid-column:2}._4145abab73d17514__notice:has(._1904b570a89bb815__description) ._0a1270dcdd79c031__actions,._4145abab73d17514__notice:has(.b5397fb9d05389e3__title) ._0a1270dcdd79c031__actions{margin-block-start:var(--wpds-dimension-gap-sm,8px)}._983740ab855c4e09__action-button{flex-shrink:0}.d329e7416d368d31__action-link{flex-shrink:0;&:not(:first-child){margin-inline-start:var(--wpds-dimension-gap-xs,4px)}&:not(:last-child){margin-inline-end:var(--wpds-dimension-gap-xs,4px)}}._487e6a5c1375f7dc__close-icon{grid-column:3;grid-row:1;margin-inline-start:var(--wpds-dimension-gap-xs,4px)}._531c140826094795__is-info{--wp-ui-notice-background-color:var(--wpds-color-background-surface-info-weak,#f3f9ff);--wp-ui-notice-border-color:var(--wpds-color-stroke-surface-info,#adc6e2);--wp-ui-notice-text-color:var(--wpds-color-foreground-content-info,#001b4f);--wp-ui-notice-decorative-icon-color:var(--wpds-color-foreground-content-info-weak,#006bd7)}.ae2e1004697cce95__is-warning{--wp-ui-notice-background-color:var(--wpds-color-background-surface-warning-weak,#fff7e1);--wp-ui-notice-border-color:var(--wpds-color-stroke-surface-warning,#e1bd7c);--wp-ui-notice-text-color:var(--wpds-color-foreground-content-warning,#2e1900);--wp-ui-notice-decorative-icon-color:var(--wpds-color-foreground-content-warning-weak,#936300)}._2e614a76af494837__is-success{--wp-ui-notice-background-color:var(--wpds-color-background-surface-success-weak,#ebffed);--wp-ui-notice-border-color:var(--wpds-color-stroke-surface-success,#92d39d);--wp-ui-notice-text-color:var(--wpds-color-foreground-content-success,#002900);--wp-ui-notice-decorative-icon-color:var(--wpds-color-foreground-content-success-weak,#008030)}.af00331ae17a0065__is-error{--wp-ui-notice-background-color:var(--wpds-color-background-surface-error-weak,#fff6f5);--wp-ui-notice-border-color:var(--wpds-color-stroke-surface-error,#e0afa7);--wp-ui-notice-text-color:var(--wpds-color-foreground-content-error,#470000);--wp-ui-notice-decorative-icon-color:var(--wpds-color-foreground-content-error-weak,#cc1818)}@container (max-width: 320px){._4145abab73d17514__notice:has(.b5397fb9d05389e3__title) ._0a1270dcdd79c031__actions,._4145abab73d17514__notice:has(.b5397fb9d05389e3__title) ._1904b570a89bb815__description{grid-column:1/3}}}@layer compositions{.d329e7416d368d31__action-link{margin-block:auto}._487e6a5c1375f7dc__close-icon,._983740ab855c4e09__action-button:is(._8ddb8fb33fbf3d38__is-action-button-outline,._77bbde495a8a0af3__is-action-button-minimal){--wp-ui-button-background-color-active:color-mix(in srgb,transparent 50%,var(--wpds-color-background-interactive-neutral-weak-active,#ededed))}}}"); 12922 } 12923 var style_default17 = { "notice": "_4145abab73d17514__notice", "icon": "d0a25570cb528528__icon", "title": "b5397fb9d05389e3__title", "description": "_1904b570a89bb815__description", "actions": "_0a1270dcdd79c031__actions", "action-button": "_983740ab855c4e09__action-button", "action-link": "d329e7416d368d31__action-link", "close-icon": "_487e6a5c1375f7dc__close-icon", "is-info": "_531c140826094795__is-info", "is-warning": "ae2e1004697cce95__is-warning", "is-success": "_2e614a76af494837__is-success", "is-error": "af00331ae17a0065__is-error", "is-action-button-outline": "_8ddb8fb33fbf3d38__is-action-button-outline", "is-action-button-minimal": "_77bbde495a8a0af3__is-action-button-minimal" }; 12924 var icons = { 12925 neutral: null, 12926 info: info_default, 12927 warning: caution_default, 12928 success: published_default, 12929 error: error_default 12930 }; 12931 function getDefaultPoliteness(intent) { 12932 return intent === "error" ? "assertive" : "polite"; 12933 } 12934 function safeRenderToString(message) { 12935 if (!message) { 12936 return void 0; 12937 } 12938 if (typeof message === "string") { 12939 return message; 12940 } 12941 try { 12942 return (0, import_element40.renderToString)(message); 12943 } catch { 12944 return void 0; 12945 } 12946 } 12947 function useSpokenMessage(message, politeness) { 12948 const spokenMessage = safeRenderToString(message); 12949 (0, import_element40.useEffect)(() => { 12950 if (spokenMessage) { 12951 (0, import_a11y2.speak)(spokenMessage, politeness); 12952 } 12953 }, [spokenMessage, politeness]); 12954 } 12955 var Root4 = (0, import_element40.forwardRef)(function Notice({ 12956 intent = "neutral", 12957 children, 12958 icon, 12959 spokenMessage = children, 12960 politeness = getDefaultPoliteness(intent), 12961 render, 12962 ...restProps 12963 }, ref) { 12964 useSpokenMessage(spokenMessage, politeness); 12965 const iconElement = icon === null ? null : icon ?? icons[intent]; 12966 const mergedClassName = clsx_default( 12967 style_default17.notice, 12968 style_default17[`is-$intent}`], 12969 resets_default5["box-sizing"] 12970 ); 12971 const element = useRender({ 12972 defaultTagName: "div", 12973 render, 12974 ref, 12975 props: mergeProps( 12976 { 12977 className: mergedClassName, 12978 children: /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(import_jsx_runtime57.Fragment, { children: [ 12979 children, 12980 iconElement && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)( 12981 Icon, 12982 { 12983 className: style_default17.icon, 12984 icon: iconElement 12985 } 12986 ) 12987 ] }) 12988 }, 12989 restProps 12990 ) 12991 }); 12992 return element; 12993 }); 12994 12995 // packages/ui/build-module/notice/title.mjs 12996 var import_element41 = __toESM(require_element(), 1); 12997 var import_jsx_runtime58 = __toESM(require_jsx_runtime(), 1); 12998 var STYLE_HASH_ATTRIBUTE19 = "data-wp-hash"; 12999 function getRuntime19() { 13000 const globalScope = globalThis; 13001 if (globalScope.__wpStyleRuntime) { 13002 return globalScope.__wpStyleRuntime; 13003 } 13004 globalScope.__wpStyleRuntime = { 13005 documents: /* @__PURE__ */ new Map(), 13006 styles: /* @__PURE__ */ new Map(), 13007 injectedStyles: /* @__PURE__ */ new WeakMap() 13008 }; 13009 if (typeof document !== "undefined") { 13010 registerDocument19(document); 13011 } 13012 return globalScope.__wpStyleRuntime; 13013 } 13014 function documentContainsStyleHash19(targetDocument, hash) { 13015 if (!targetDocument.head) { 13016 return false; 13017 } 13018 for (const style of targetDocument.head.querySelectorAll( 13019 `style[$STYLE_HASH_ATTRIBUTE19}]` 13020 )) { 13021 if (style.getAttribute(STYLE_HASH_ATTRIBUTE19) === hash) { 13022 return true; 13023 } 13024 } 13025 return false; 13026 } 13027 function injectStyle19(targetDocument, hash, css) { 13028 if (!targetDocument.head) { 13029 return; 13030 } 13031 const runtime = getRuntime19(); 13032 let injectedStyles = runtime.injectedStyles.get(targetDocument); 13033 if (!injectedStyles) { 13034 injectedStyles = /* @__PURE__ */ new Set(); 13035 runtime.injectedStyles.set(targetDocument, injectedStyles); 13036 } 13037 if (injectedStyles.has(hash)) { 13038 return; 13039 } 13040 if (documentContainsStyleHash19(targetDocument, hash)) { 13041 injectedStyles.add(hash); 13042 return; 13043 } 13044 const style = targetDocument.createElement("style"); 13045 style.setAttribute(STYLE_HASH_ATTRIBUTE19, hash); 13046 style.appendChild(targetDocument.createTextNode(css)); 13047 targetDocument.head.appendChild(style); 13048 injectedStyles.add(hash); 13049 } 13050 function registerDocument19(targetDocument) { 13051 const runtime = getRuntime19(); 13052 runtime.documents.set( 13053 targetDocument, 13054 (runtime.documents.get(targetDocument) ?? 0) + 1 13055 ); 13056 for (const [hash, css] of runtime.styles) { 13057 injectStyle19(targetDocument, hash, css); 13058 } 13059 return () => { 13060 const count = runtime.documents.get(targetDocument); 13061 if (count === void 0) { 13062 return; 13063 } 13064 if (count <= 1) { 13065 runtime.documents.delete(targetDocument); 13066 return; 13067 } 13068 runtime.documents.set(targetDocument, count - 1); 13069 }; 13070 } 13071 function registerStyle19(hash, css) { 13072 const runtime = getRuntime19(); 13073 runtime.styles.set(hash, css); 13074 for (const targetDocument of runtime.documents.keys()) { 13075 injectStyle19(targetDocument, hash, css); 13076 } 13077 } 13078 if (typeof process === "undefined" || true) { 13079 registerStyle19("2e53930a41", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._4145abab73d17514__notice{--icon-height:var(--wpds-dimension-size-sm,24px);--text-vertical-padding:calc((var(--icon-height) - var(--wpds-typography-line-height-sm, 20px))/2);--wp-ui-notice-background-color:var(--wpds-color-background-surface-neutral-weak,#f4f4f4);--wp-ui-notice-border-color:var(--wpds-color-stroke-surface-neutral,#dbdbdb);--wp-ui-notice-text-color:var(--wpds-color-foreground-content-neutral,#1e1e1e);--wp-ui-notice-decorative-icon-color:var(--wpds-color-foreground-content-neutral,#1e1e1e);align-items:start;background-color:var(--wp-ui-notice-background-color);border:1px solid var(--wp-ui-notice-border-color);border-radius:var(--wpds-border-radius-lg,8px);container-type:inline-size;display:grid;grid-template-columns:auto 1fr auto;padding:var(--wpds-dimension-padding-md,12px)}.d0a25570cb528528__icon{color:var(--wp-ui-notice-decorative-icon-color);grid-column:1;grid-row:1;margin-inline-end:var(--wpds-dimension-gap-xs,4px)}._1904b570a89bb815__description,.b5397fb9d05389e3__title{color:var(--wp-ui-notice-text-color);grid-column:2;padding-block:var(--text-vertical-padding)}._0a1270dcdd79c031__actions{display:flex;flex-wrap:wrap;gap:var(--wpds-dimension-gap-md,12px);grid-column:2}._4145abab73d17514__notice:has(._1904b570a89bb815__description) ._0a1270dcdd79c031__actions,._4145abab73d17514__notice:has(.b5397fb9d05389e3__title) ._0a1270dcdd79c031__actions{margin-block-start:var(--wpds-dimension-gap-sm,8px)}._983740ab855c4e09__action-button{flex-shrink:0}.d329e7416d368d31__action-link{flex-shrink:0;&:not(:first-child){margin-inline-start:var(--wpds-dimension-gap-xs,4px)}&:not(:last-child){margin-inline-end:var(--wpds-dimension-gap-xs,4px)}}._487e6a5c1375f7dc__close-icon{grid-column:3;grid-row:1;margin-inline-start:var(--wpds-dimension-gap-xs,4px)}._531c140826094795__is-info{--wp-ui-notice-background-color:var(--wpds-color-background-surface-info-weak,#f3f9ff);--wp-ui-notice-border-color:var(--wpds-color-stroke-surface-info,#adc6e2);--wp-ui-notice-text-color:var(--wpds-color-foreground-content-info,#001b4f);--wp-ui-notice-decorative-icon-color:var(--wpds-color-foreground-content-info-weak,#006bd7)}.ae2e1004697cce95__is-warning{--wp-ui-notice-background-color:var(--wpds-color-background-surface-warning-weak,#fff7e1);--wp-ui-notice-border-color:var(--wpds-color-stroke-surface-warning,#e1bd7c);--wp-ui-notice-text-color:var(--wpds-color-foreground-content-warning,#2e1900);--wp-ui-notice-decorative-icon-color:var(--wpds-color-foreground-content-warning-weak,#936300)}._2e614a76af494837__is-success{--wp-ui-notice-background-color:var(--wpds-color-background-surface-success-weak,#ebffed);--wp-ui-notice-border-color:var(--wpds-color-stroke-surface-success,#92d39d);--wp-ui-notice-text-color:var(--wpds-color-foreground-content-success,#002900);--wp-ui-notice-decorative-icon-color:var(--wpds-color-foreground-content-success-weak,#008030)}.af00331ae17a0065__is-error{--wp-ui-notice-background-color:var(--wpds-color-background-surface-error-weak,#fff6f5);--wp-ui-notice-border-color:var(--wpds-color-stroke-surface-error,#e0afa7);--wp-ui-notice-text-color:var(--wpds-color-foreground-content-error,#470000);--wp-ui-notice-decorative-icon-color:var(--wpds-color-foreground-content-error-weak,#cc1818)}@container (max-width: 320px){._4145abab73d17514__notice:has(.b5397fb9d05389e3__title) ._0a1270dcdd79c031__actions,._4145abab73d17514__notice:has(.b5397fb9d05389e3__title) ._1904b570a89bb815__description{grid-column:1/3}}}@layer compositions{.d329e7416d368d31__action-link{margin-block:auto}._487e6a5c1375f7dc__close-icon,._983740ab855c4e09__action-button:is(._8ddb8fb33fbf3d38__is-action-button-outline,._77bbde495a8a0af3__is-action-button-minimal){--wp-ui-button-background-color-active:color-mix(in srgb,transparent 50%,var(--wpds-color-background-interactive-neutral-weak-active,#ededed))}}}"); 13080 } 13081 var style_default18 = { "notice": "_4145abab73d17514__notice", "icon": "d0a25570cb528528__icon", "title": "b5397fb9d05389e3__title", "description": "_1904b570a89bb815__description", "actions": "_0a1270dcdd79c031__actions", "action-button": "_983740ab855c4e09__action-button", "action-link": "d329e7416d368d31__action-link", "close-icon": "_487e6a5c1375f7dc__close-icon", "is-info": "_531c140826094795__is-info", "is-warning": "ae2e1004697cce95__is-warning", "is-success": "_2e614a76af494837__is-success", "is-error": "af00331ae17a0065__is-error", "is-action-button-outline": "_8ddb8fb33fbf3d38__is-action-button-outline", "is-action-button-minimal": "_77bbde495a8a0af3__is-action-button-minimal" }; 13082 var Title2 = (0, import_element41.forwardRef)( 13083 function NoticeTitle({ className, ...props }, ref) { 13084 return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)( 13085 Text, 13086 { 13087 ref, 13088 variant: "heading-md", 13089 className: clsx_default(style_default18.title, className), 13090 ...props 13091 } 13092 ); 13093 } 13094 ); 13095 13096 // packages/ui/build-module/notice/description.mjs 13097 var import_element42 = __toESM(require_element(), 1); 13098 var import_jsx_runtime59 = __toESM(require_jsx_runtime(), 1); 13099 var STYLE_HASH_ATTRIBUTE20 = "data-wp-hash"; 13100 function getRuntime20() { 13101 const globalScope = globalThis; 13102 if (globalScope.__wpStyleRuntime) { 13103 return globalScope.__wpStyleRuntime; 13104 } 13105 globalScope.__wpStyleRuntime = { 13106 documents: /* @__PURE__ */ new Map(), 13107 styles: /* @__PURE__ */ new Map(), 13108 injectedStyles: /* @__PURE__ */ new WeakMap() 13109 }; 13110 if (typeof document !== "undefined") { 13111 registerDocument20(document); 13112 } 13113 return globalScope.__wpStyleRuntime; 13114 } 13115 function documentContainsStyleHash20(targetDocument, hash) { 13116 if (!targetDocument.head) { 13117 return false; 13118 } 13119 for (const style of targetDocument.head.querySelectorAll( 13120 `style[$STYLE_HASH_ATTRIBUTE20}]` 13121 )) { 13122 if (style.getAttribute(STYLE_HASH_ATTRIBUTE20) === hash) { 13123 return true; 13124 } 13125 } 13126 return false; 13127 } 13128 function injectStyle20(targetDocument, hash, css) { 13129 if (!targetDocument.head) { 13130 return; 13131 } 13132 const runtime = getRuntime20(); 13133 let injectedStyles = runtime.injectedStyles.get(targetDocument); 13134 if (!injectedStyles) { 13135 injectedStyles = /* @__PURE__ */ new Set(); 13136 runtime.injectedStyles.set(targetDocument, injectedStyles); 13137 } 13138 if (injectedStyles.has(hash)) { 13139 return; 13140 } 13141 if (documentContainsStyleHash20(targetDocument, hash)) { 13142 injectedStyles.add(hash); 13143 return; 13144 } 13145 const style = targetDocument.createElement("style"); 13146 style.setAttribute(STYLE_HASH_ATTRIBUTE20, hash); 13147 style.appendChild(targetDocument.createTextNode(css)); 13148 targetDocument.head.appendChild(style); 13149 injectedStyles.add(hash); 13150 } 13151 function registerDocument20(targetDocument) { 13152 const runtime = getRuntime20(); 13153 runtime.documents.set( 13154 targetDocument, 13155 (runtime.documents.get(targetDocument) ?? 0) + 1 13156 ); 13157 for (const [hash, css] of runtime.styles) { 13158 injectStyle20(targetDocument, hash, css); 13159 } 13160 return () => { 13161 const count = runtime.documents.get(targetDocument); 13162 if (count === void 0) { 13163 return; 13164 } 13165 if (count <= 1) { 13166 runtime.documents.delete(targetDocument); 13167 return; 13168 } 13169 runtime.documents.set(targetDocument, count - 1); 13170 }; 13171 } 13172 function registerStyle20(hash, css) { 13173 const runtime = getRuntime20(); 13174 runtime.styles.set(hash, css); 13175 for (const targetDocument of runtime.documents.keys()) { 13176 injectStyle20(targetDocument, hash, css); 13177 } 13178 } 13179 if (typeof process === "undefined" || true) { 13180 registerStyle20("2e53930a41", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._4145abab73d17514__notice{--icon-height:var(--wpds-dimension-size-sm,24px);--text-vertical-padding:calc((var(--icon-height) - var(--wpds-typography-line-height-sm, 20px))/2);--wp-ui-notice-background-color:var(--wpds-color-background-surface-neutral-weak,#f4f4f4);--wp-ui-notice-border-color:var(--wpds-color-stroke-surface-neutral,#dbdbdb);--wp-ui-notice-text-color:var(--wpds-color-foreground-content-neutral,#1e1e1e);--wp-ui-notice-decorative-icon-color:var(--wpds-color-foreground-content-neutral,#1e1e1e);align-items:start;background-color:var(--wp-ui-notice-background-color);border:1px solid var(--wp-ui-notice-border-color);border-radius:var(--wpds-border-radius-lg,8px);container-type:inline-size;display:grid;grid-template-columns:auto 1fr auto;padding:var(--wpds-dimension-padding-md,12px)}.d0a25570cb528528__icon{color:var(--wp-ui-notice-decorative-icon-color);grid-column:1;grid-row:1;margin-inline-end:var(--wpds-dimension-gap-xs,4px)}._1904b570a89bb815__description,.b5397fb9d05389e3__title{color:var(--wp-ui-notice-text-color);grid-column:2;padding-block:var(--text-vertical-padding)}._0a1270dcdd79c031__actions{display:flex;flex-wrap:wrap;gap:var(--wpds-dimension-gap-md,12px);grid-column:2}._4145abab73d17514__notice:has(._1904b570a89bb815__description) ._0a1270dcdd79c031__actions,._4145abab73d17514__notice:has(.b5397fb9d05389e3__title) ._0a1270dcdd79c031__actions{margin-block-start:var(--wpds-dimension-gap-sm,8px)}._983740ab855c4e09__action-button{flex-shrink:0}.d329e7416d368d31__action-link{flex-shrink:0;&:not(:first-child){margin-inline-start:var(--wpds-dimension-gap-xs,4px)}&:not(:last-child){margin-inline-end:var(--wpds-dimension-gap-xs,4px)}}._487e6a5c1375f7dc__close-icon{grid-column:3;grid-row:1;margin-inline-start:var(--wpds-dimension-gap-xs,4px)}._531c140826094795__is-info{--wp-ui-notice-background-color:var(--wpds-color-background-surface-info-weak,#f3f9ff);--wp-ui-notice-border-color:var(--wpds-color-stroke-surface-info,#adc6e2);--wp-ui-notice-text-color:var(--wpds-color-foreground-content-info,#001b4f);--wp-ui-notice-decorative-icon-color:var(--wpds-color-foreground-content-info-weak,#006bd7)}.ae2e1004697cce95__is-warning{--wp-ui-notice-background-color:var(--wpds-color-background-surface-warning-weak,#fff7e1);--wp-ui-notice-border-color:var(--wpds-color-stroke-surface-warning,#e1bd7c);--wp-ui-notice-text-color:var(--wpds-color-foreground-content-warning,#2e1900);--wp-ui-notice-decorative-icon-color:var(--wpds-color-foreground-content-warning-weak,#936300)}._2e614a76af494837__is-success{--wp-ui-notice-background-color:var(--wpds-color-background-surface-success-weak,#ebffed);--wp-ui-notice-border-color:var(--wpds-color-stroke-surface-success,#92d39d);--wp-ui-notice-text-color:var(--wpds-color-foreground-content-success,#002900);--wp-ui-notice-decorative-icon-color:var(--wpds-color-foreground-content-success-weak,#008030)}.af00331ae17a0065__is-error{--wp-ui-notice-background-color:var(--wpds-color-background-surface-error-weak,#fff6f5);--wp-ui-notice-border-color:var(--wpds-color-stroke-surface-error,#e0afa7);--wp-ui-notice-text-color:var(--wpds-color-foreground-content-error,#470000);--wp-ui-notice-decorative-icon-color:var(--wpds-color-foreground-content-error-weak,#cc1818)}@container (max-width: 320px){._4145abab73d17514__notice:has(.b5397fb9d05389e3__title) ._0a1270dcdd79c031__actions,._4145abab73d17514__notice:has(.b5397fb9d05389e3__title) ._1904b570a89bb815__description{grid-column:1/3}}}@layer compositions{.d329e7416d368d31__action-link{margin-block:auto}._487e6a5c1375f7dc__close-icon,._983740ab855c4e09__action-button:is(._8ddb8fb33fbf3d38__is-action-button-outline,._77bbde495a8a0af3__is-action-button-minimal){--wp-ui-button-background-color-active:color-mix(in srgb,transparent 50%,var(--wpds-color-background-interactive-neutral-weak-active,#ededed))}}}"); 13181 } 13182 var style_default19 = { "notice": "_4145abab73d17514__notice", "icon": "d0a25570cb528528__icon", "title": "b5397fb9d05389e3__title", "description": "_1904b570a89bb815__description", "actions": "_0a1270dcdd79c031__actions", "action-button": "_983740ab855c4e09__action-button", "action-link": "d329e7416d368d31__action-link", "close-icon": "_487e6a5c1375f7dc__close-icon", "is-info": "_531c140826094795__is-info", "is-warning": "ae2e1004697cce95__is-warning", "is-success": "_2e614a76af494837__is-success", "is-error": "af00331ae17a0065__is-error", "is-action-button-outline": "_8ddb8fb33fbf3d38__is-action-button-outline", "is-action-button-minimal": "_77bbde495a8a0af3__is-action-button-minimal" }; 13183 var Description = (0, import_element42.forwardRef)( 13184 function NoticeDescription({ className, ...props }, ref) { 13185 return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)( 13186 Text, 13187 { 13188 ref, 13189 variant: "body-md", 13190 className: clsx_default(style_default19.description, className), 13191 ...props 13192 } 13193 ); 13194 } 13195 ); 13196 13197 // packages/ui/build-module/notice/actions.mjs 13198 var import_element43 = __toESM(require_element(), 1); 13199 var STYLE_HASH_ATTRIBUTE21 = "data-wp-hash"; 13200 function getRuntime21() { 13201 const globalScope = globalThis; 13202 if (globalScope.__wpStyleRuntime) { 13203 return globalScope.__wpStyleRuntime; 13204 } 13205 globalScope.__wpStyleRuntime = { 13206 documents: /* @__PURE__ */ new Map(), 13207 styles: /* @__PURE__ */ new Map(), 13208 injectedStyles: /* @__PURE__ */ new WeakMap() 13209 }; 13210 if (typeof document !== "undefined") { 13211 registerDocument21(document); 13212 } 13213 return globalScope.__wpStyleRuntime; 13214 } 13215 function documentContainsStyleHash21(targetDocument, hash) { 13216 if (!targetDocument.head) { 13217 return false; 13218 } 13219 for (const style of targetDocument.head.querySelectorAll( 13220 `style[$STYLE_HASH_ATTRIBUTE21}]` 13221 )) { 13222 if (style.getAttribute(STYLE_HASH_ATTRIBUTE21) === hash) { 13223 return true; 13224 } 13225 } 13226 return false; 13227 } 13228 function injectStyle21(targetDocument, hash, css) { 13229 if (!targetDocument.head) { 13230 return; 13231 } 13232 const runtime = getRuntime21(); 13233 let injectedStyles = runtime.injectedStyles.get(targetDocument); 13234 if (!injectedStyles) { 13235 injectedStyles = /* @__PURE__ */ new Set(); 13236 runtime.injectedStyles.set(targetDocument, injectedStyles); 13237 } 13238 if (injectedStyles.has(hash)) { 13239 return; 13240 } 13241 if (documentContainsStyleHash21(targetDocument, hash)) { 13242 injectedStyles.add(hash); 13243 return; 13244 } 13245 const style = targetDocument.createElement("style"); 13246 style.setAttribute(STYLE_HASH_ATTRIBUTE21, hash); 13247 style.appendChild(targetDocument.createTextNode(css)); 13248 targetDocument.head.appendChild(style); 13249 injectedStyles.add(hash); 13250 } 13251 function registerDocument21(targetDocument) { 13252 const runtime = getRuntime21(); 13253 runtime.documents.set( 13254 targetDocument, 13255 (runtime.documents.get(targetDocument) ?? 0) + 1 13256 ); 13257 for (const [hash, css] of runtime.styles) { 13258 injectStyle21(targetDocument, hash, css); 13259 } 13260 return () => { 13261 const count = runtime.documents.get(targetDocument); 13262 if (count === void 0) { 13263 return; 13264 } 13265 if (count <= 1) { 13266 runtime.documents.delete(targetDocument); 13267 return; 13268 } 13269 runtime.documents.set(targetDocument, count - 1); 13270 }; 13271 } 13272 function registerStyle21(hash, css) { 13273 const runtime = getRuntime21(); 13274 runtime.styles.set(hash, css); 13275 for (const targetDocument of runtime.documents.keys()) { 13276 injectStyle21(targetDocument, hash, css); 13277 } 13278 } 13279 if (typeof process === "undefined" || true) { 13280 registerStyle21("2e53930a41", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._4145abab73d17514__notice{--icon-height:var(--wpds-dimension-size-sm,24px);--text-vertical-padding:calc((var(--icon-height) - var(--wpds-typography-line-height-sm, 20px))/2);--wp-ui-notice-background-color:var(--wpds-color-background-surface-neutral-weak,#f4f4f4);--wp-ui-notice-border-color:var(--wpds-color-stroke-surface-neutral,#dbdbdb);--wp-ui-notice-text-color:var(--wpds-color-foreground-content-neutral,#1e1e1e);--wp-ui-notice-decorative-icon-color:var(--wpds-color-foreground-content-neutral,#1e1e1e);align-items:start;background-color:var(--wp-ui-notice-background-color);border:1px solid var(--wp-ui-notice-border-color);border-radius:var(--wpds-border-radius-lg,8px);container-type:inline-size;display:grid;grid-template-columns:auto 1fr auto;padding:var(--wpds-dimension-padding-md,12px)}.d0a25570cb528528__icon{color:var(--wp-ui-notice-decorative-icon-color);grid-column:1;grid-row:1;margin-inline-end:var(--wpds-dimension-gap-xs,4px)}._1904b570a89bb815__description,.b5397fb9d05389e3__title{color:var(--wp-ui-notice-text-color);grid-column:2;padding-block:var(--text-vertical-padding)}._0a1270dcdd79c031__actions{display:flex;flex-wrap:wrap;gap:var(--wpds-dimension-gap-md,12px);grid-column:2}._4145abab73d17514__notice:has(._1904b570a89bb815__description) ._0a1270dcdd79c031__actions,._4145abab73d17514__notice:has(.b5397fb9d05389e3__title) ._0a1270dcdd79c031__actions{margin-block-start:var(--wpds-dimension-gap-sm,8px)}._983740ab855c4e09__action-button{flex-shrink:0}.d329e7416d368d31__action-link{flex-shrink:0;&:not(:first-child){margin-inline-start:var(--wpds-dimension-gap-xs,4px)}&:not(:last-child){margin-inline-end:var(--wpds-dimension-gap-xs,4px)}}._487e6a5c1375f7dc__close-icon{grid-column:3;grid-row:1;margin-inline-start:var(--wpds-dimension-gap-xs,4px)}._531c140826094795__is-info{--wp-ui-notice-background-color:var(--wpds-color-background-surface-info-weak,#f3f9ff);--wp-ui-notice-border-color:var(--wpds-color-stroke-surface-info,#adc6e2);--wp-ui-notice-text-color:var(--wpds-color-foreground-content-info,#001b4f);--wp-ui-notice-decorative-icon-color:var(--wpds-color-foreground-content-info-weak,#006bd7)}.ae2e1004697cce95__is-warning{--wp-ui-notice-background-color:var(--wpds-color-background-surface-warning-weak,#fff7e1);--wp-ui-notice-border-color:var(--wpds-color-stroke-surface-warning,#e1bd7c);--wp-ui-notice-text-color:var(--wpds-color-foreground-content-warning,#2e1900);--wp-ui-notice-decorative-icon-color:var(--wpds-color-foreground-content-warning-weak,#936300)}._2e614a76af494837__is-success{--wp-ui-notice-background-color:var(--wpds-color-background-surface-success-weak,#ebffed);--wp-ui-notice-border-color:var(--wpds-color-stroke-surface-success,#92d39d);--wp-ui-notice-text-color:var(--wpds-color-foreground-content-success,#002900);--wp-ui-notice-decorative-icon-color:var(--wpds-color-foreground-content-success-weak,#008030)}.af00331ae17a0065__is-error{--wp-ui-notice-background-color:var(--wpds-color-background-surface-error-weak,#fff6f5);--wp-ui-notice-border-color:var(--wpds-color-stroke-surface-error,#e0afa7);--wp-ui-notice-text-color:var(--wpds-color-foreground-content-error,#470000);--wp-ui-notice-decorative-icon-color:var(--wpds-color-foreground-content-error-weak,#cc1818)}@container (max-width: 320px){._4145abab73d17514__notice:has(.b5397fb9d05389e3__title) ._0a1270dcdd79c031__actions,._4145abab73d17514__notice:has(.b5397fb9d05389e3__title) ._1904b570a89bb815__description{grid-column:1/3}}}@layer compositions{.d329e7416d368d31__action-link{margin-block:auto}._487e6a5c1375f7dc__close-icon,._983740ab855c4e09__action-button:is(._8ddb8fb33fbf3d38__is-action-button-outline,._77bbde495a8a0af3__is-action-button-minimal){--wp-ui-button-background-color-active:color-mix(in srgb,transparent 50%,var(--wpds-color-background-interactive-neutral-weak-active,#ededed))}}}"); 13281 } 13282 var style_default20 = { "notice": "_4145abab73d17514__notice", "icon": "d0a25570cb528528__icon", "title": "b5397fb9d05389e3__title", "description": "_1904b570a89bb815__description", "actions": "_0a1270dcdd79c031__actions", "action-button": "_983740ab855c4e09__action-button", "action-link": "d329e7416d368d31__action-link", "close-icon": "_487e6a5c1375f7dc__close-icon", "is-info": "_531c140826094795__is-info", "is-warning": "ae2e1004697cce95__is-warning", "is-success": "_2e614a76af494837__is-success", "is-error": "af00331ae17a0065__is-error", "is-action-button-outline": "_8ddb8fb33fbf3d38__is-action-button-outline", "is-action-button-minimal": "_77bbde495a8a0af3__is-action-button-minimal" }; 13283 var Actions = (0, import_element43.forwardRef)( 13284 function NoticeActions({ render, ...props }, ref) { 13285 const element = useRender({ 13286 defaultTagName: "div", 13287 render, 13288 ref, 13289 props: mergeProps( 13290 { 13291 className: style_default20.actions 13292 }, 13293 props 13294 ) 13295 }); 13296 return element; 13297 } 13298 ); 13299 13300 // packages/ui/build-module/notice/close-icon.mjs 13301 var import_element44 = __toESM(require_element(), 1); 13302 var import_i18n6 = __toESM(require_i18n(), 1); 13303 var import_jsx_runtime60 = __toESM(require_jsx_runtime(), 1); 13304 var STYLE_HASH_ATTRIBUTE22 = "data-wp-hash"; 13305 function getRuntime22() { 13306 const globalScope = globalThis; 13307 if (globalScope.__wpStyleRuntime) { 13308 return globalScope.__wpStyleRuntime; 13309 } 13310 globalScope.__wpStyleRuntime = { 13311 documents: /* @__PURE__ */ new Map(), 13312 styles: /* @__PURE__ */ new Map(), 13313 injectedStyles: /* @__PURE__ */ new WeakMap() 13314 }; 13315 if (typeof document !== "undefined") { 13316 registerDocument22(document); 13317 } 13318 return globalScope.__wpStyleRuntime; 13319 } 13320 function documentContainsStyleHash22(targetDocument, hash) { 13321 if (!targetDocument.head) { 13322 return false; 13323 } 13324 for (const style of targetDocument.head.querySelectorAll( 13325 `style[$STYLE_HASH_ATTRIBUTE22}]` 13326 )) { 13327 if (style.getAttribute(STYLE_HASH_ATTRIBUTE22) === hash) { 13328 return true; 13329 } 13330 } 13331 return false; 13332 } 13333 function injectStyle22(targetDocument, hash, css) { 13334 if (!targetDocument.head) { 13335 return; 13336 } 13337 const runtime = getRuntime22(); 13338 let injectedStyles = runtime.injectedStyles.get(targetDocument); 13339 if (!injectedStyles) { 13340 injectedStyles = /* @__PURE__ */ new Set(); 13341 runtime.injectedStyles.set(targetDocument, injectedStyles); 13342 } 13343 if (injectedStyles.has(hash)) { 13344 return; 13345 } 13346 if (documentContainsStyleHash22(targetDocument, hash)) { 13347 injectedStyles.add(hash); 13348 return; 13349 } 13350 const style = targetDocument.createElement("style"); 13351 style.setAttribute(STYLE_HASH_ATTRIBUTE22, hash); 13352 style.appendChild(targetDocument.createTextNode(css)); 13353 targetDocument.head.appendChild(style); 13354 injectedStyles.add(hash); 13355 } 13356 function registerDocument22(targetDocument) { 13357 const runtime = getRuntime22(); 13358 runtime.documents.set( 13359 targetDocument, 13360 (runtime.documents.get(targetDocument) ?? 0) + 1 13361 ); 13362 for (const [hash, css] of runtime.styles) { 13363 injectStyle22(targetDocument, hash, css); 13364 } 13365 return () => { 13366 const count = runtime.documents.get(targetDocument); 13367 if (count === void 0) { 13368 return; 13369 } 13370 if (count <= 1) { 13371 runtime.documents.delete(targetDocument); 13372 return; 13373 } 13374 runtime.documents.set(targetDocument, count - 1); 13375 }; 13376 } 13377 function registerStyle22(hash, css) { 13378 const runtime = getRuntime22(); 13379 runtime.styles.set(hash, css); 13380 for (const targetDocument of runtime.documents.keys()) { 13381 injectStyle22(targetDocument, hash, css); 13382 } 13383 } 13384 if (typeof process === "undefined" || true) { 13385 registerStyle22("2e53930a41", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._4145abab73d17514__notice{--icon-height:var(--wpds-dimension-size-sm,24px);--text-vertical-padding:calc((var(--icon-height) - var(--wpds-typography-line-height-sm, 20px))/2);--wp-ui-notice-background-color:var(--wpds-color-background-surface-neutral-weak,#f4f4f4);--wp-ui-notice-border-color:var(--wpds-color-stroke-surface-neutral,#dbdbdb);--wp-ui-notice-text-color:var(--wpds-color-foreground-content-neutral,#1e1e1e);--wp-ui-notice-decorative-icon-color:var(--wpds-color-foreground-content-neutral,#1e1e1e);align-items:start;background-color:var(--wp-ui-notice-background-color);border:1px solid var(--wp-ui-notice-border-color);border-radius:var(--wpds-border-radius-lg,8px);container-type:inline-size;display:grid;grid-template-columns:auto 1fr auto;padding:var(--wpds-dimension-padding-md,12px)}.d0a25570cb528528__icon{color:var(--wp-ui-notice-decorative-icon-color);grid-column:1;grid-row:1;margin-inline-end:var(--wpds-dimension-gap-xs,4px)}._1904b570a89bb815__description,.b5397fb9d05389e3__title{color:var(--wp-ui-notice-text-color);grid-column:2;padding-block:var(--text-vertical-padding)}._0a1270dcdd79c031__actions{display:flex;flex-wrap:wrap;gap:var(--wpds-dimension-gap-md,12px);grid-column:2}._4145abab73d17514__notice:has(._1904b570a89bb815__description) ._0a1270dcdd79c031__actions,._4145abab73d17514__notice:has(.b5397fb9d05389e3__title) ._0a1270dcdd79c031__actions{margin-block-start:var(--wpds-dimension-gap-sm,8px)}._983740ab855c4e09__action-button{flex-shrink:0}.d329e7416d368d31__action-link{flex-shrink:0;&:not(:first-child){margin-inline-start:var(--wpds-dimension-gap-xs,4px)}&:not(:last-child){margin-inline-end:var(--wpds-dimension-gap-xs,4px)}}._487e6a5c1375f7dc__close-icon{grid-column:3;grid-row:1;margin-inline-start:var(--wpds-dimension-gap-xs,4px)}._531c140826094795__is-info{--wp-ui-notice-background-color:var(--wpds-color-background-surface-info-weak,#f3f9ff);--wp-ui-notice-border-color:var(--wpds-color-stroke-surface-info,#adc6e2);--wp-ui-notice-text-color:var(--wpds-color-foreground-content-info,#001b4f);--wp-ui-notice-decorative-icon-color:var(--wpds-color-foreground-content-info-weak,#006bd7)}.ae2e1004697cce95__is-warning{--wp-ui-notice-background-color:var(--wpds-color-background-surface-warning-weak,#fff7e1);--wp-ui-notice-border-color:var(--wpds-color-stroke-surface-warning,#e1bd7c);--wp-ui-notice-text-color:var(--wpds-color-foreground-content-warning,#2e1900);--wp-ui-notice-decorative-icon-color:var(--wpds-color-foreground-content-warning-weak,#936300)}._2e614a76af494837__is-success{--wp-ui-notice-background-color:var(--wpds-color-background-surface-success-weak,#ebffed);--wp-ui-notice-border-color:var(--wpds-color-stroke-surface-success,#92d39d);--wp-ui-notice-text-color:var(--wpds-color-foreground-content-success,#002900);--wp-ui-notice-decorative-icon-color:var(--wpds-color-foreground-content-success-weak,#008030)}.af00331ae17a0065__is-error{--wp-ui-notice-background-color:var(--wpds-color-background-surface-error-weak,#fff6f5);--wp-ui-notice-border-color:var(--wpds-color-stroke-surface-error,#e0afa7);--wp-ui-notice-text-color:var(--wpds-color-foreground-content-error,#470000);--wp-ui-notice-decorative-icon-color:var(--wpds-color-foreground-content-error-weak,#cc1818)}@container (max-width: 320px){._4145abab73d17514__notice:has(.b5397fb9d05389e3__title) ._0a1270dcdd79c031__actions,._4145abab73d17514__notice:has(.b5397fb9d05389e3__title) ._1904b570a89bb815__description{grid-column:1/3}}}@layer compositions{.d329e7416d368d31__action-link{margin-block:auto}._487e6a5c1375f7dc__close-icon,._983740ab855c4e09__action-button:is(._8ddb8fb33fbf3d38__is-action-button-outline,._77bbde495a8a0af3__is-action-button-minimal){--wp-ui-button-background-color-active:color-mix(in srgb,transparent 50%,var(--wpds-color-background-interactive-neutral-weak-active,#ededed))}}}"); 13386 } 13387 var style_default21 = { "notice": "_4145abab73d17514__notice", "icon": "d0a25570cb528528__icon", "title": "b5397fb9d05389e3__title", "description": "_1904b570a89bb815__description", "actions": "_0a1270dcdd79c031__actions", "action-button": "_983740ab855c4e09__action-button", "action-link": "d329e7416d368d31__action-link", "close-icon": "_487e6a5c1375f7dc__close-icon", "is-info": "_531c140826094795__is-info", "is-warning": "ae2e1004697cce95__is-warning", "is-success": "_2e614a76af494837__is-success", "is-error": "af00331ae17a0065__is-error", "is-action-button-outline": "_8ddb8fb33fbf3d38__is-action-button-outline", "is-action-button-minimal": "_77bbde495a8a0af3__is-action-button-minimal" }; 13388 var CloseIcon = (0, import_element44.forwardRef)( 13389 function NoticeCloseIcon({ className, icon = close_small_default, label = (0, import_i18n6.__)("Dismiss"), ...props }, ref) { 13390 return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)( 13391 IconButton, 13392 { 13393 ...props, 13394 ref, 13395 className: clsx_default(style_default21["close-icon"], className), 13396 variant: "minimal", 13397 size: "small", 13398 tone: "neutral", 13399 icon, 13400 label 13401 } 13402 ); 13403 } 13404 ); 13405 13406 // packages/ui/build-module/notice/action-button.mjs 13407 var import_element45 = __toESM(require_element(), 1); 13408 var import_jsx_runtime61 = __toESM(require_jsx_runtime(), 1); 13409 var STYLE_HASH_ATTRIBUTE23 = "data-wp-hash"; 13410 function getRuntime23() { 13411 const globalScope = globalThis; 13412 if (globalScope.__wpStyleRuntime) { 13413 return globalScope.__wpStyleRuntime; 13414 } 13415 globalScope.__wpStyleRuntime = { 13416 documents: /* @__PURE__ */ new Map(), 13417 styles: /* @__PURE__ */ new Map(), 13418 injectedStyles: /* @__PURE__ */ new WeakMap() 13419 }; 13420 if (typeof document !== "undefined") { 13421 registerDocument23(document); 13422 } 13423 return globalScope.__wpStyleRuntime; 13424 } 13425 function documentContainsStyleHash23(targetDocument, hash) { 13426 if (!targetDocument.head) { 13427 return false; 13428 } 13429 for (const style of targetDocument.head.querySelectorAll( 13430 `style[$STYLE_HASH_ATTRIBUTE23}]` 13431 )) { 13432 if (style.getAttribute(STYLE_HASH_ATTRIBUTE23) === hash) { 13433 return true; 13434 } 13435 } 13436 return false; 13437 } 13438 function injectStyle23(targetDocument, hash, css) { 13439 if (!targetDocument.head) { 13440 return; 13441 } 13442 const runtime = getRuntime23(); 13443 let injectedStyles = runtime.injectedStyles.get(targetDocument); 13444 if (!injectedStyles) { 13445 injectedStyles = /* @__PURE__ */ new Set(); 13446 runtime.injectedStyles.set(targetDocument, injectedStyles); 13447 } 13448 if (injectedStyles.has(hash)) { 13449 return; 13450 } 13451 if (documentContainsStyleHash23(targetDocument, hash)) { 13452 injectedStyles.add(hash); 13453 return; 13454 } 13455 const style = targetDocument.createElement("style"); 13456 style.setAttribute(STYLE_HASH_ATTRIBUTE23, hash); 13457 style.appendChild(targetDocument.createTextNode(css)); 13458 targetDocument.head.appendChild(style); 13459 injectedStyles.add(hash); 13460 } 13461 function registerDocument23(targetDocument) { 13462 const runtime = getRuntime23(); 13463 runtime.documents.set( 13464 targetDocument, 13465 (runtime.documents.get(targetDocument) ?? 0) + 1 13466 ); 13467 for (const [hash, css] of runtime.styles) { 13468 injectStyle23(targetDocument, hash, css); 13469 } 13470 return () => { 13471 const count = runtime.documents.get(targetDocument); 13472 if (count === void 0) { 13473 return; 13474 } 13475 if (count <= 1) { 13476 runtime.documents.delete(targetDocument); 13477 return; 13478 } 13479 runtime.documents.set(targetDocument, count - 1); 13480 }; 13481 } 13482 function registerStyle23(hash, css) { 13483 const runtime = getRuntime23(); 13484 runtime.styles.set(hash, css); 13485 for (const targetDocument of runtime.documents.keys()) { 13486 injectStyle23(targetDocument, hash, css); 13487 } 13488 } 13489 if (typeof process === "undefined" || true) { 13490 registerStyle23("2e53930a41", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._4145abab73d17514__notice{--icon-height:var(--wpds-dimension-size-sm,24px);--text-vertical-padding:calc((var(--icon-height) - var(--wpds-typography-line-height-sm, 20px))/2);--wp-ui-notice-background-color:var(--wpds-color-background-surface-neutral-weak,#f4f4f4);--wp-ui-notice-border-color:var(--wpds-color-stroke-surface-neutral,#dbdbdb);--wp-ui-notice-text-color:var(--wpds-color-foreground-content-neutral,#1e1e1e);--wp-ui-notice-decorative-icon-color:var(--wpds-color-foreground-content-neutral,#1e1e1e);align-items:start;background-color:var(--wp-ui-notice-background-color);border:1px solid var(--wp-ui-notice-border-color);border-radius:var(--wpds-border-radius-lg,8px);container-type:inline-size;display:grid;grid-template-columns:auto 1fr auto;padding:var(--wpds-dimension-padding-md,12px)}.d0a25570cb528528__icon{color:var(--wp-ui-notice-decorative-icon-color);grid-column:1;grid-row:1;margin-inline-end:var(--wpds-dimension-gap-xs,4px)}._1904b570a89bb815__description,.b5397fb9d05389e3__title{color:var(--wp-ui-notice-text-color);grid-column:2;padding-block:var(--text-vertical-padding)}._0a1270dcdd79c031__actions{display:flex;flex-wrap:wrap;gap:var(--wpds-dimension-gap-md,12px);grid-column:2}._4145abab73d17514__notice:has(._1904b570a89bb815__description) ._0a1270dcdd79c031__actions,._4145abab73d17514__notice:has(.b5397fb9d05389e3__title) ._0a1270dcdd79c031__actions{margin-block-start:var(--wpds-dimension-gap-sm,8px)}._983740ab855c4e09__action-button{flex-shrink:0}.d329e7416d368d31__action-link{flex-shrink:0;&:not(:first-child){margin-inline-start:var(--wpds-dimension-gap-xs,4px)}&:not(:last-child){margin-inline-end:var(--wpds-dimension-gap-xs,4px)}}._487e6a5c1375f7dc__close-icon{grid-column:3;grid-row:1;margin-inline-start:var(--wpds-dimension-gap-xs,4px)}._531c140826094795__is-info{--wp-ui-notice-background-color:var(--wpds-color-background-surface-info-weak,#f3f9ff);--wp-ui-notice-border-color:var(--wpds-color-stroke-surface-info,#adc6e2);--wp-ui-notice-text-color:var(--wpds-color-foreground-content-info,#001b4f);--wp-ui-notice-decorative-icon-color:var(--wpds-color-foreground-content-info-weak,#006bd7)}.ae2e1004697cce95__is-warning{--wp-ui-notice-background-color:var(--wpds-color-background-surface-warning-weak,#fff7e1);--wp-ui-notice-border-color:var(--wpds-color-stroke-surface-warning,#e1bd7c);--wp-ui-notice-text-color:var(--wpds-color-foreground-content-warning,#2e1900);--wp-ui-notice-decorative-icon-color:var(--wpds-color-foreground-content-warning-weak,#936300)}._2e614a76af494837__is-success{--wp-ui-notice-background-color:var(--wpds-color-background-surface-success-weak,#ebffed);--wp-ui-notice-border-color:var(--wpds-color-stroke-surface-success,#92d39d);--wp-ui-notice-text-color:var(--wpds-color-foreground-content-success,#002900);--wp-ui-notice-decorative-icon-color:var(--wpds-color-foreground-content-success-weak,#008030)}.af00331ae17a0065__is-error{--wp-ui-notice-background-color:var(--wpds-color-background-surface-error-weak,#fff6f5);--wp-ui-notice-border-color:var(--wpds-color-stroke-surface-error,#e0afa7);--wp-ui-notice-text-color:var(--wpds-color-foreground-content-error,#470000);--wp-ui-notice-decorative-icon-color:var(--wpds-color-foreground-content-error-weak,#cc1818)}@container (max-width: 320px){._4145abab73d17514__notice:has(.b5397fb9d05389e3__title) ._0a1270dcdd79c031__actions,._4145abab73d17514__notice:has(.b5397fb9d05389e3__title) ._1904b570a89bb815__description{grid-column:1/3}}}@layer compositions{.d329e7416d368d31__action-link{margin-block:auto}._487e6a5c1375f7dc__close-icon,._983740ab855c4e09__action-button:is(._8ddb8fb33fbf3d38__is-action-button-outline,._77bbde495a8a0af3__is-action-button-minimal){--wp-ui-button-background-color-active:color-mix(in srgb,transparent 50%,var(--wpds-color-background-interactive-neutral-weak-active,#ededed))}}}"); 13491 } 13492 var style_default22 = { "notice": "_4145abab73d17514__notice", "icon": "d0a25570cb528528__icon", "title": "b5397fb9d05389e3__title", "description": "_1904b570a89bb815__description", "actions": "_0a1270dcdd79c031__actions", "action-button": "_983740ab855c4e09__action-button", "action-link": "d329e7416d368d31__action-link", "close-icon": "_487e6a5c1375f7dc__close-icon", "is-info": "_531c140826094795__is-info", "is-warning": "ae2e1004697cce95__is-warning", "is-success": "_2e614a76af494837__is-success", "is-error": "af00331ae17a0065__is-error", "is-action-button-outline": "_8ddb8fb33fbf3d38__is-action-button-outline", "is-action-button-minimal": "_77bbde495a8a0af3__is-action-button-minimal" }; 13493 var ActionButton = (0, import_element45.forwardRef)( 13494 function NoticeActionButton({ className, loading, loadingAnnouncement, variant, ...props }, ref) { 13495 const loadingProps = loading !== void 0 ? { loading, loadingAnnouncement: loadingAnnouncement ?? "" } : {}; 13496 return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)( 13497 Button6, 13498 { 13499 ...props, 13500 ...loadingProps, 13501 ref, 13502 size: "compact", 13503 tone: "neutral", 13504 variant, 13505 className: clsx_default( 13506 style_default22["action-button"], 13507 style_default22[`is-action-button-$variant}`], 13508 className 13509 ) 13510 } 13511 ); 13512 } 13513 ); 13514 13515 // packages/ui/build-module/notice/action-link.mjs 13516 var import_element46 = __toESM(require_element(), 1); 13517 var import_jsx_runtime62 = __toESM(require_jsx_runtime(), 1); 13518 var STYLE_HASH_ATTRIBUTE24 = "data-wp-hash"; 13519 function getRuntime24() { 13520 const globalScope = globalThis; 13521 if (globalScope.__wpStyleRuntime) { 13522 return globalScope.__wpStyleRuntime; 13523 } 13524 globalScope.__wpStyleRuntime = { 13525 documents: /* @__PURE__ */ new Map(), 13526 styles: /* @__PURE__ */ new Map(), 13527 injectedStyles: /* @__PURE__ */ new WeakMap() 13528 }; 13529 if (typeof document !== "undefined") { 13530 registerDocument24(document); 13531 } 13532 return globalScope.__wpStyleRuntime; 13533 } 13534 function documentContainsStyleHash24(targetDocument, hash) { 13535 if (!targetDocument.head) { 13536 return false; 13537 } 13538 for (const style of targetDocument.head.querySelectorAll( 13539 `style[$STYLE_HASH_ATTRIBUTE24}]` 13540 )) { 13541 if (style.getAttribute(STYLE_HASH_ATTRIBUTE24) === hash) { 13542 return true; 13543 } 13544 } 13545 return false; 13546 } 13547 function injectStyle24(targetDocument, hash, css) { 13548 if (!targetDocument.head) { 13549 return; 13550 } 13551 const runtime = getRuntime24(); 13552 let injectedStyles = runtime.injectedStyles.get(targetDocument); 13553 if (!injectedStyles) { 13554 injectedStyles = /* @__PURE__ */ new Set(); 13555 runtime.injectedStyles.set(targetDocument, injectedStyles); 13556 } 13557 if (injectedStyles.has(hash)) { 13558 return; 13559 } 13560 if (documentContainsStyleHash24(targetDocument, hash)) { 13561 injectedStyles.add(hash); 13562 return; 13563 } 13564 const style = targetDocument.createElement("style"); 13565 style.setAttribute(STYLE_HASH_ATTRIBUTE24, hash); 13566 style.appendChild(targetDocument.createTextNode(css)); 13567 targetDocument.head.appendChild(style); 13568 injectedStyles.add(hash); 13569 } 13570 function registerDocument24(targetDocument) { 13571 const runtime = getRuntime24(); 13572 runtime.documents.set( 13573 targetDocument, 13574 (runtime.documents.get(targetDocument) ?? 0) + 1 13575 ); 13576 for (const [hash, css] of runtime.styles) { 13577 injectStyle24(targetDocument, hash, css); 13578 } 13579 return () => { 13580 const count = runtime.documents.get(targetDocument); 13581 if (count === void 0) { 13582 return; 13583 } 13584 if (count <= 1) { 13585 runtime.documents.delete(targetDocument); 13586 return; 13587 } 13588 runtime.documents.set(targetDocument, count - 1); 13589 }; 13590 } 13591 function registerStyle24(hash, css) { 13592 const runtime = getRuntime24(); 13593 runtime.styles.set(hash, css); 13594 for (const targetDocument of runtime.documents.keys()) { 13595 injectStyle24(targetDocument, hash, css); 13596 } 13597 } 13598 if (typeof process === "undefined" || true) { 13599 registerStyle24("2e53930a41", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._4145abab73d17514__notice{--icon-height:var(--wpds-dimension-size-sm,24px);--text-vertical-padding:calc((var(--icon-height) - var(--wpds-typography-line-height-sm, 20px))/2);--wp-ui-notice-background-color:var(--wpds-color-background-surface-neutral-weak,#f4f4f4);--wp-ui-notice-border-color:var(--wpds-color-stroke-surface-neutral,#dbdbdb);--wp-ui-notice-text-color:var(--wpds-color-foreground-content-neutral,#1e1e1e);--wp-ui-notice-decorative-icon-color:var(--wpds-color-foreground-content-neutral,#1e1e1e);align-items:start;background-color:var(--wp-ui-notice-background-color);border:1px solid var(--wp-ui-notice-border-color);border-radius:var(--wpds-border-radius-lg,8px);container-type:inline-size;display:grid;grid-template-columns:auto 1fr auto;padding:var(--wpds-dimension-padding-md,12px)}.d0a25570cb528528__icon{color:var(--wp-ui-notice-decorative-icon-color);grid-column:1;grid-row:1;margin-inline-end:var(--wpds-dimension-gap-xs,4px)}._1904b570a89bb815__description,.b5397fb9d05389e3__title{color:var(--wp-ui-notice-text-color);grid-column:2;padding-block:var(--text-vertical-padding)}._0a1270dcdd79c031__actions{display:flex;flex-wrap:wrap;gap:var(--wpds-dimension-gap-md,12px);grid-column:2}._4145abab73d17514__notice:has(._1904b570a89bb815__description) ._0a1270dcdd79c031__actions,._4145abab73d17514__notice:has(.b5397fb9d05389e3__title) ._0a1270dcdd79c031__actions{margin-block-start:var(--wpds-dimension-gap-sm,8px)}._983740ab855c4e09__action-button{flex-shrink:0}.d329e7416d368d31__action-link{flex-shrink:0;&:not(:first-child){margin-inline-start:var(--wpds-dimension-gap-xs,4px)}&:not(:last-child){margin-inline-end:var(--wpds-dimension-gap-xs,4px)}}._487e6a5c1375f7dc__close-icon{grid-column:3;grid-row:1;margin-inline-start:var(--wpds-dimension-gap-xs,4px)}._531c140826094795__is-info{--wp-ui-notice-background-color:var(--wpds-color-background-surface-info-weak,#f3f9ff);--wp-ui-notice-border-color:var(--wpds-color-stroke-surface-info,#adc6e2);--wp-ui-notice-text-color:var(--wpds-color-foreground-content-info,#001b4f);--wp-ui-notice-decorative-icon-color:var(--wpds-color-foreground-content-info-weak,#006bd7)}.ae2e1004697cce95__is-warning{--wp-ui-notice-background-color:var(--wpds-color-background-surface-warning-weak,#fff7e1);--wp-ui-notice-border-color:var(--wpds-color-stroke-surface-warning,#e1bd7c);--wp-ui-notice-text-color:var(--wpds-color-foreground-content-warning,#2e1900);--wp-ui-notice-decorative-icon-color:var(--wpds-color-foreground-content-warning-weak,#936300)}._2e614a76af494837__is-success{--wp-ui-notice-background-color:var(--wpds-color-background-surface-success-weak,#ebffed);--wp-ui-notice-border-color:var(--wpds-color-stroke-surface-success,#92d39d);--wp-ui-notice-text-color:var(--wpds-color-foreground-content-success,#002900);--wp-ui-notice-decorative-icon-color:var(--wpds-color-foreground-content-success-weak,#008030)}.af00331ae17a0065__is-error{--wp-ui-notice-background-color:var(--wpds-color-background-surface-error-weak,#fff6f5);--wp-ui-notice-border-color:var(--wpds-color-stroke-surface-error,#e0afa7);--wp-ui-notice-text-color:var(--wpds-color-foreground-content-error,#470000);--wp-ui-notice-decorative-icon-color:var(--wpds-color-foreground-content-error-weak,#cc1818)}@container (max-width: 320px){._4145abab73d17514__notice:has(.b5397fb9d05389e3__title) ._0a1270dcdd79c031__actions,._4145abab73d17514__notice:has(.b5397fb9d05389e3__title) ._1904b570a89bb815__description{grid-column:1/3}}}@layer compositions{.d329e7416d368d31__action-link{margin-block:auto}._487e6a5c1375f7dc__close-icon,._983740ab855c4e09__action-button:is(._8ddb8fb33fbf3d38__is-action-button-outline,._77bbde495a8a0af3__is-action-button-minimal){--wp-ui-button-background-color-active:color-mix(in srgb,transparent 50%,var(--wpds-color-background-interactive-neutral-weak-active,#ededed))}}}"); 13600 } 13601 var style_default23 = { "notice": "_4145abab73d17514__notice", "icon": "d0a25570cb528528__icon", "title": "b5397fb9d05389e3__title", "description": "_1904b570a89bb815__description", "actions": "_0a1270dcdd79c031__actions", "action-button": "_983740ab855c4e09__action-button", "action-link": "d329e7416d368d31__action-link", "close-icon": "_487e6a5c1375f7dc__close-icon", "is-info": "_531c140826094795__is-info", "is-warning": "ae2e1004697cce95__is-warning", "is-success": "_2e614a76af494837__is-success", "is-error": "af00331ae17a0065__is-error", "is-action-button-outline": "_8ddb8fb33fbf3d38__is-action-button-outline", "is-action-button-minimal": "_77bbde495a8a0af3__is-action-button-minimal" }; 13602 var ActionLink = (0, import_element46.forwardRef)( 13603 function NoticeActionLink({ className, render, ...props }, ref) { 13604 return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)( 13605 Text, 13606 { 13607 ref, 13608 className: clsx_default(style_default23["action-link"], className), 13609 ...props, 13610 variant: "body-md", 13611 render: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(Link, { tone: "neutral", variant: "default", render }) 13612 } 13613 ); 13614 } 13615 ); 13616 13617 // packages/admin-ui/build-module/navigable-region/index.mjs 13618 var import_element47 = __toESM(require_element(), 1); 13619 var import_jsx_runtime63 = __toESM(require_jsx_runtime(), 1); 13620 var NavigableRegion = (0, import_element47.forwardRef)( 13621 ({ children, className, ariaLabel, as: Tag = "div", ...props }, ref) => { 13622 return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)( 13623 Tag, 13624 { 13625 ref, 13626 className: clsx_default("admin-ui-navigable-region", className), 13627 "aria-label": ariaLabel, 13628 role: "region", 13629 tabIndex: "-1", 13630 ...props, 13631 children 13632 } 13633 ); 13634 } 13635 ); 13636 NavigableRegion.displayName = "NavigableRegion"; 13637 var navigable_region_default = NavigableRegion; 13638 13639 // packages/admin-ui/build-module/admin-theme-colors/index.mjs 13640 var DEFAULT_THEME_COLORS = { 13641 primary: "#3858e9", 13642 background: "#222524" 13643 }; 13644 var ADMIN_THEME_COLORS = /* @__PURE__ */ new Map([ 13645 ["modern", DEFAULT_THEME_COLORS], 13646 ["fresh", { primary: "#007cba", background: "#25292b" }], 13647 ["midnight", { primary: "#cf4339", background: "#3d4042" }], 13648 ["coffee", { primary: "#916745", background: "#5b534d" }], 13649 ["ocean", { primary: "#567958", background: "#5f787f" }], 13650 ["blue", { primary: "#437aa8", background: "#3876a8" }], 13651 ["ectoplasm", { primary: "#646c3e", background: "#4f386e" }], 13652 ["sunrise", { primary: "#ad631e", background: "#cc4541" }], 13653 ["light", { primary: "#007cba", background: "#eaeeed" }] 13654 ]); 13655 function getAdminThemeColors() { 13656 const scheme = document.body.className.match(/admin-color-([\w-]+)/)?.[1] ?? "modern"; 13657 return ADMIN_THEME_COLORS.get(scheme) ?? DEFAULT_THEME_COLORS; 13658 } 13659 13660 // packages/interface/build-module/components/interface-skeleton/index.mjs 13661 var import_element48 = __toESM(require_element(), 1); 13662 var import_components5 = __toESM(require_components(), 1); 13663 var import_i18n7 = __toESM(require_i18n(), 1); 13664 var import_compose4 = __toESM(require_compose(), 1); 13665 var import_jsx_runtime64 = __toESM(require_jsx_runtime(), 1); 13666 var ANIMATION_DURATION2 = 0.25; 13667 var commonTransition = { 13668 type: "tween", 13669 duration: ANIMATION_DURATION2, 13670 ease: [0.6, 0, 0.4, 1] 13671 }; 13672 function useHTMLClass(className) { 13673 (0, import_element48.useEffect)(() => { 13674 const element = document && document.querySelector(`html:not(.$className})`); 13675 if (!element) { 13676 return; 13677 } 13678 element.classList.toggle(className); 13679 return () => { 13680 element.classList.toggle(className); 13681 }; 13682 }, [className]); 13683 } 13684 var headerVariants = { 13685 hidden: { opacity: 1, marginTop: -60 }, 13686 visible: { opacity: 1, marginTop: 0 }, 13687 distractionFreeHover: { 13688 opacity: 1, 13689 marginTop: 0, 13690 transition: { 13691 ...commonTransition, 13692 delay: 0.2, 13693 delayChildren: 0.2 13694 } 13695 }, 13696 distractionFreeHidden: { 13697 opacity: 0, 13698 marginTop: -60 13699 }, 13700 distractionFreeDisabled: { 13701 opacity: 0, 13702 marginTop: 0, 13703 transition: { 13704 ...commonTransition, 13705 delay: 0.8, 13706 delayChildren: 0.8 13707 } 13708 } 13709 }; 13710 function InterfaceSkeleton({ 13711 isDistractionFree, 13712 footer, 13713 header, 13714 editorNotices, 13715 sidebar, 13716 secondarySidebar, 13717 content, 13718 actions, 13719 labels, 13720 className 13721 }, ref) { 13722 const isMobileViewport = (0, import_compose4.useViewportMatch)("medium", "<"); 13723 const disableMotion = (0, import_compose4.useReducedMotion)(); 13724 const defaultTransition = { 13725 type: "tween", 13726 duration: disableMotion ? 0 : ANIMATION_DURATION2, 13727 ease: [0.6, 0, 0.4, 1] 13728 }; 13729 useHTMLClass("interface-interface-skeleton__html-container"); 13730 const defaultLabels = { 13731 /* translators: accessibility text for the top bar landmark region. */ 13732 header: (0, import_i18n7._x)("Header", "header landmark area"), 13733 /* translators: accessibility text for the content landmark region. */ 13734 body: (0, import_i18n7.__)("Content"), 13735 /* translators: accessibility text for the secondary sidebar landmark region. */ 13736 secondarySidebar: (0, import_i18n7.__)("Block Library"), 13737 /* translators: accessibility text for the settings landmark region. */ 13738 sidebar: (0, import_i18n7._x)("Settings", "settings landmark area"), 13739 /* translators: accessibility text for the publish landmark region. */ 13740 actions: (0, import_i18n7.__)("Publish"), 13741 /* translators: accessibility text for the footer landmark region. */ 13742 footer: (0, import_i18n7.__)("Footer") 13743 }; 13744 const mergedLabels = { ...defaultLabels, ...labels }; 13745 return /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)( 13746 "div", 13747 { 13748 ref, 13749 className: clsx_default( 13750 className, 13751 "interface-interface-skeleton", 13752 !!footer && "has-footer" 13753 ), 13754 children: [ 13755 /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("div", { className: "interface-interface-skeleton__editor", children: [ 13756 /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(import_components5.__unstableAnimatePresence, { initial: false, children: !!header && /* @__PURE__ */ (0, import_jsx_runtime64.jsx)( 13757 navigable_region_default, 13758 { 13759 as: import_components5.__unstableMotion.div, 13760 className: "interface-interface-skeleton__header", 13761 ariaLabel: mergedLabels.header, 13762 initial: isDistractionFree && !isMobileViewport ? "distractionFreeHidden" : "hidden", 13763 whileHover: isDistractionFree && !isMobileViewport ? "distractionFreeHover" : "visible", 13764 animate: isDistractionFree && !isMobileViewport ? "distractionFreeDisabled" : "visible", 13765 exit: isDistractionFree && !isMobileViewport ? "distractionFreeHidden" : "hidden", 13766 variants: headerVariants, 13767 transition: defaultTransition, 13768 children: header 13769 } 13770 ) }), 13771 isDistractionFree && /* @__PURE__ */ (0, import_jsx_runtime64.jsx)("div", { className: "interface-interface-skeleton__header", children: editorNotices }), 13772 /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("div", { className: "interface-interface-skeleton__body", children: [ 13773 /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(import_components5.__unstableAnimatePresence, { initial: false, children: !!secondarySidebar && /* @__PURE__ */ (0, import_jsx_runtime64.jsx)( 13774 navigable_region_default, 13775 { 13776 className: "interface-interface-skeleton__secondary-sidebar", 13777 ariaLabel: mergedLabels.secondarySidebar, 13778 as: import_components5.__unstableMotion.div, 13779 initial: "closed", 13780 animate: "open", 13781 exit: "closed", 13782 variants: { 13783 open: { width: "auto" }, 13784 closed: { width: 0 } 13785 }, 13786 transition: defaultTransition, 13787 children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)( 13788 import_components5.__unstableMotion.div, 13789 { 13790 style: { 13791 width: isMobileViewport ? "100vw" : "max-content", 13792 height: "100%" 13793 }, 13794 variants: { 13795 open: { x: 0 }, 13796 closed: { x: "-100%" } 13797 }, 13798 transition: defaultTransition, 13799 children: secondarySidebar 13800 } 13801 ) 13802 } 13803 ) }), 13804 /* @__PURE__ */ (0, import_jsx_runtime64.jsx)( 13805 navigable_region_default, 13806 { 13807 className: "interface-interface-skeleton__content", 13808 ariaLabel: mergedLabels.body, 13809 children: content 13810 } 13811 ), 13812 !!sidebar && /* @__PURE__ */ (0, import_jsx_runtime64.jsx)( 13813 navigable_region_default, 13814 { 13815 className: "interface-interface-skeleton__sidebar", 13816 ariaLabel: mergedLabels.sidebar, 13817 children: sidebar 13818 } 13819 ), 13820 !!actions && /* @__PURE__ */ (0, import_jsx_runtime64.jsx)( 13821 navigable_region_default, 13822 { 13823 className: "interface-interface-skeleton__actions", 13824 ariaLabel: mergedLabels.actions, 13825 children: actions 13826 } 13827 ) 13828 ] }) 13829 ] }), 13830 !!footer && /* @__PURE__ */ (0, import_jsx_runtime64.jsx)( 13831 navigable_region_default, 13832 { 13833 className: "interface-interface-skeleton__footer", 13834 ariaLabel: mergedLabels.footer, 13835 children: footer 13836 } 13837 ) 13838 ] 13839 } 13840 ); 13841 } 13842 var interface_skeleton_default = (0, import_element48.forwardRef)(InterfaceSkeleton); 13843 13844 // packages/edit-widgets/build-module/store/actions.mjs 13845 var import_widgets2 = __toESM(require_widgets(), 1); 13846 var import_core_data = __toESM(require_core_data(), 1); 13847 var import_block_editor = __toESM(require_block_editor(), 1); 13848 13849 // packages/edit-widgets/build-module/store/transformers.mjs 13850 var import_blocks = __toESM(require_blocks(), 1); 13851 var import_widgets = __toESM(require_widgets(), 1); 13852 function transformWidgetToBlock(widget) { 13853 if (widget.id_base === "block") { 13854 const parsedBlocks = (0, import_blocks.parse)(widget.instance.raw.content, { 13855 __unstableSkipAutop: true 13856 }); 13857 if (!parsedBlocks.length) { 13858 return (0, import_widgets.addWidgetIdToBlock)( 13859 (0, import_blocks.createBlock)("core/paragraph", {}, []), 13860 widget.id 13861 ); 13862 } 13863 return (0, import_widgets.addWidgetIdToBlock)(parsedBlocks[0], widget.id); 13864 } 13865 let attributes; 13866 if (widget._embedded.about[0].is_multi) { 13867 attributes = { 13868 idBase: widget.id_base, 13869 instance: widget.instance 13870 }; 13871 } else { 13872 attributes = { 13873 id: widget.id 13874 }; 13875 } 13876 return (0, import_widgets.addWidgetIdToBlock)( 13877 (0, import_blocks.createBlock)("core/legacy-widget", attributes, []), 13878 widget.id 13879 ); 13880 } 13881 function transformBlockToWidget(block, relatedWidget = {}) { 13882 let widget; 13883 const isValidLegacyWidgetBlock = block.name === "core/legacy-widget" && (block.attributes.id || block.attributes.instance); 13884 if (isValidLegacyWidgetBlock) { 13885 widget = { 13886 ...relatedWidget, 13887 id: block.attributes.id ?? relatedWidget.id, 13888 id_base: block.attributes.idBase ?? relatedWidget.id_base, 13889 instance: block.attributes.instance ?? relatedWidget.instance 13890 }; 13891 } else { 13892 widget = { 13893 ...relatedWidget, 13894 id_base: "block", 13895 instance: { 13896 raw: { 13897 content: (0, import_blocks.serialize)(block) 13898 } 13899 } 13900 }; 13901 } 13902 delete widget.rendered; 13903 delete widget.rendered_form; 13904 return widget; 13905 } 13906 13907 // packages/edit-widgets/build-module/store/utils.mjs 13908 var KIND = "root"; 13909 var WIDGET_AREA_ENTITY_TYPE = "sidebar"; 13910 var POST_TYPE = "postType"; 13911 var buildWidgetAreaPostId = (widgetAreaId) => `widget-area-$widgetAreaId}`; 13912 var buildWidgetAreasPostId = () => `widget-areas`; 13913 function buildWidgetAreasQuery() { 13914 return { 13915 per_page: -1 13916 }; 13917 } 13918 function buildWidgetsQuery() { 13919 return { 13920 per_page: -1, 13921 _embed: "about" 13922 }; 13923 } 13924 var createStubPost = (id, blocks) => ({ 13925 id, 13926 slug: id, 13927 status: "draft", 13928 type: "page", 13929 blocks, 13930 meta: { 13931 widgetAreaId: id 13932 } 13933 }); 13934 13935 // packages/edit-widgets/build-module/store/constants.mjs 13936 var STORE_NAME2 = "core/edit-widgets"; 13937 13938 // packages/edit-widgets/build-module/store/actions.mjs 13939 var persistStubPost = (id, blocks) => ({ registry }) => { 13940 const stubPost = createStubPost(id, blocks); 13941 registry.dispatch(import_core_data.store).receiveEntityRecords( 13942 KIND, 13943 POST_TYPE, 13944 stubPost, 13945 { id: stubPost.id }, 13946 false 13947 ); 13948 return stubPost; 13949 }; 13950 var saveEditedWidgetAreas = () => async ({ select, dispatch: dispatch2, registry }) => { 13951 const editedWidgetAreas = select.getEditedWidgetAreas(); 13952 if (!editedWidgetAreas?.length) { 13953 return; 13954 } 13955 try { 13956 await dispatch2.saveWidgetAreas(editedWidgetAreas); 13957 registry.dispatch(import_notices.store).createSuccessNotice((0, import_i18n8.__)("Widgets saved."), { 13958 type: "snackbar" 13959 }); 13960 } catch (e) { 13961 registry.dispatch(import_notices.store).createErrorNotice( 13962 /* translators: %s: The error message. */ 13963 (0, import_i18n8.sprintf)((0, import_i18n8.__)("There was an error. %s"), e.message), 13964 { 13965 type: "snackbar" 13966 } 13967 ); 13968 } 13969 }; 13970 var saveWidgetAreas = (widgetAreas) => async ({ dispatch: dispatch2, registry }) => { 13971 try { 13972 for (const widgetArea of widgetAreas) { 13973 await dispatch2.saveWidgetArea(widgetArea.id); 13974 } 13975 } finally { 13976 await registry.dispatch(import_core_data.store).finishResolution( 13977 "getEntityRecord", 13978 KIND, 13979 WIDGET_AREA_ENTITY_TYPE, 13980 buildWidgetAreasQuery() 13981 ); 13982 } 13983 }; 13984 var saveWidgetArea = (widgetAreaId) => async ({ dispatch: dispatch2, select, registry }) => { 13985 const widgets = select.getWidgets(); 13986 const post = registry.select(import_core_data.store).getEditedEntityRecord( 13987 KIND, 13988 POST_TYPE, 13989 buildWidgetAreaPostId(widgetAreaId) 13990 ); 13991 const areaWidgets = Object.values(widgets).filter( 13992 ({ sidebar }) => sidebar === widgetAreaId 13993 ); 13994 const usedReferenceWidgets = []; 13995 const widgetsBlocks = post.blocks.filter((block) => { 13996 const { id } = block.attributes; 13997 if (block.name === "core/legacy-widget" && id) { 13998 if (usedReferenceWidgets.includes(id)) { 13999 return false; 14000 } 14001 usedReferenceWidgets.push(id); 14002 } 14003 return true; 14004 }); 14005 const deletedWidgets = []; 14006 for (const widget of areaWidgets) { 14007 const widgetsNewArea = select.getWidgetAreaForWidgetId(widget.id); 14008 if (!widgetsNewArea) { 14009 deletedWidgets.push(widget); 14010 } 14011 } 14012 const batchMeta = []; 14013 const batchTasks = []; 14014 const sidebarWidgetsIds = []; 14015 for (let i = 0; i < widgetsBlocks.length; i++) { 14016 const block = widgetsBlocks[i]; 14017 const widgetId = (0, import_widgets2.getWidgetIdFromBlock)(block); 14018 const oldWidget = widgets[widgetId]; 14019 const widget = transformBlockToWidget(block, oldWidget); 14020 sidebarWidgetsIds.push(widgetId); 14021 if (oldWidget) { 14022 registry.dispatch(import_core_data.store).editEntityRecord( 14023 "root", 14024 "widget", 14025 widgetId, 14026 { 14027 ...widget, 14028 sidebar: widgetAreaId 14029 }, 14030 { undoIgnore: true } 14031 ); 14032 const hasEdits = registry.select(import_core_data.store).hasEditsForEntityRecord("root", "widget", widgetId); 14033 if (!hasEdits) { 14034 continue; 14035 } 14036 batchTasks.push( 14037 ({ saveEditedEntityRecord }) => saveEditedEntityRecord("root", "widget", widgetId) 14038 ); 14039 } else { 14040 batchTasks.push( 14041 ({ saveEntityRecord }) => saveEntityRecord("root", "widget", { 14042 ...widget, 14043 sidebar: widgetAreaId 14044 }) 14045 ); 14046 } 14047 batchMeta.push({ 14048 block, 14049 position: i, 14050 clientId: block.clientId 14051 }); 14052 } 14053 for (const widget of deletedWidgets) { 14054 batchTasks.push( 14055 ({ deleteEntityRecord }) => deleteEntityRecord("root", "widget", widget.id, { 14056 force: true 14057 }) 14058 ); 14059 } 14060 const records = await registry.dispatch(import_core_data.store).__experimentalBatch(batchTasks); 14061 const preservedRecords = records.filter( 14062 (record) => !record.hasOwnProperty("deleted") 14063 ); 14064 const failedWidgetNames = []; 14065 for (let i = 0; i < preservedRecords.length; i++) { 14066 const widget = preservedRecords[i]; 14067 const { block, position } = batchMeta[i]; 14068 post.blocks[position].attributes.__internalWidgetId = widget.id; 14069 const error2 = registry.select(import_core_data.store).getLastEntitySaveError("root", "widget", widget.id); 14070 if (error2) { 14071 failedWidgetNames.push(block.attributes?.name || block?.name); 14072 } 14073 if (!sidebarWidgetsIds[position]) { 14074 sidebarWidgetsIds[position] = widget.id; 14075 } 14076 } 14077 if (failedWidgetNames.length) { 14078 throw new Error( 14079 (0, import_i18n8.sprintf)( 14080 /* translators: %s: List of widget names */ 14081 (0, import_i18n8.__)("Could not save the following widgets: %s."), 14082 failedWidgetNames.join(", ") 14083 ) 14084 ); 14085 } 14086 registry.dispatch(import_core_data.store).editEntityRecord( 14087 KIND, 14088 WIDGET_AREA_ENTITY_TYPE, 14089 widgetAreaId, 14090 { 14091 widgets: sidebarWidgetsIds 14092 }, 14093 { undoIgnore: true } 14094 ); 14095 dispatch2(trySaveWidgetArea(widgetAreaId)); 14096 registry.dispatch(import_core_data.store).receiveEntityRecords(KIND, POST_TYPE, post, void 0); 14097 }; 14098 var trySaveWidgetArea = (widgetAreaId) => ({ registry }) => { 14099 registry.dispatch(import_core_data.store).saveEditedEntityRecord( 14100 KIND, 14101 WIDGET_AREA_ENTITY_TYPE, 14102 widgetAreaId, 14103 { 14104 throwOnError: true 14105 } 14106 ); 14107 }; 14108 function setWidgetIdForClientId(clientId, widgetId) { 14109 return { 14110 type: "SET_WIDGET_ID_FOR_CLIENT_ID", 14111 clientId, 14112 widgetId 14113 }; 14114 } 14115 function setWidgetAreasOpenState(widgetAreasOpenState2) { 14116 return { 14117 type: "SET_WIDGET_AREAS_OPEN_STATE", 14118 widgetAreasOpenState: widgetAreasOpenState2 14119 }; 14120 } 14121 function setIsWidgetAreaOpen(clientId, isOpen) { 14122 return { 14123 type: "SET_IS_WIDGET_AREA_OPEN", 14124 clientId, 14125 isOpen 14126 }; 14127 } 14128 function setIsInserterOpened(value) { 14129 return { 14130 type: "SET_IS_INSERTER_OPENED", 14131 value 14132 }; 14133 } 14134 function setIsListViewOpened(isOpen) { 14135 return { 14136 type: "SET_IS_LIST_VIEW_OPENED", 14137 isOpen 14138 }; 14139 } 14140 var closeGeneralSidebar = () => ({ registry }) => { 14141 registry.dispatch(store).disableComplementaryArea(STORE_NAME2); 14142 }; 14143 var moveBlockToWidgetArea = (clientId, widgetAreaId) => async ({ dispatch: dispatch2, select, registry }) => { 14144 const sourceRootClientId = registry.select(import_block_editor.store).getBlockRootClientId(clientId); 14145 const widgetAreas = registry.select(import_block_editor.store).getBlocks(); 14146 const destinationWidgetAreaBlock = widgetAreas.find( 14147 ({ attributes }) => attributes.id === widgetAreaId 14148 ); 14149 const destinationRootClientId = destinationWidgetAreaBlock.clientId; 14150 const destinationInnerBlocksClientIds = registry.select(import_block_editor.store).getBlockOrder(destinationRootClientId); 14151 const destinationIndex = destinationInnerBlocksClientIds.length; 14152 const isDestinationWidgetAreaOpen = select.getIsWidgetAreaOpen( 14153 destinationRootClientId 14154 ); 14155 if (!isDestinationWidgetAreaOpen) { 14156 dispatch2.setIsWidgetAreaOpen(destinationRootClientId, true); 14157 } 14158 registry.dispatch(import_block_editor.store).moveBlocksToPosition( 14159 [clientId], 14160 sourceRootClientId, 14161 destinationRootClientId, 14162 destinationIndex 14163 ); 14164 }; 14165 function unlockWidgetSaving(lockName) { 14166 return { 14167 type: "UNLOCK_WIDGET_SAVING", 14168 lockName 14169 }; 14170 } 14171 function lockWidgetSaving(lockName) { 14172 return { 14173 type: "LOCK_WIDGET_SAVING", 14174 lockName 14175 }; 14176 } 14177 14178 // packages/edit-widgets/build-module/store/resolvers.mjs 14179 var getWidgetAreas = () => async ({ dispatch: dispatch2, registry }) => { 14180 const query = buildWidgetAreasQuery(); 14181 const widgetAreas = await registry.resolveSelect(import_core_data2.store).getEntityRecords(KIND, WIDGET_AREA_ENTITY_TYPE, query); 14182 const widgetAreaBlocks = []; 14183 const sortedWidgetAreas = widgetAreas.sort((a, b) => { 14184 if (a.id === "wp_inactive_widgets") { 14185 return 1; 14186 } 14187 if (b.id === "wp_inactive_widgets") { 14188 return -1; 14189 } 14190 return 0; 14191 }); 14192 for (const widgetArea of sortedWidgetAreas) { 14193 widgetAreaBlocks.push( 14194 (0, import_blocks2.createBlock)("core/widget-area", { 14195 id: widgetArea.id, 14196 name: widgetArea.name 14197 }) 14198 ); 14199 if (!widgetArea.widgets.length) { 14200 dispatch2( 14201 persistStubPost( 14202 buildWidgetAreaPostId(widgetArea.id), 14203 [] 14204 ) 14205 ); 14206 } 14207 } 14208 const widgetAreasOpenState2 = {}; 14209 widgetAreaBlocks.forEach((widgetAreaBlock, index2) => { 14210 widgetAreasOpenState2[widgetAreaBlock.clientId] = index2 === 0; 14211 }); 14212 dispatch2(setWidgetAreasOpenState(widgetAreasOpenState2)); 14213 dispatch2( 14214 persistStubPost(buildWidgetAreasPostId(), widgetAreaBlocks) 14215 ); 14216 }; 14217 var getWidgets = () => async ({ dispatch: dispatch2, registry }) => { 14218 const query = buildWidgetsQuery(); 14219 const widgets = await registry.resolveSelect(import_core_data2.store).getEntityRecords("root", "widget", query); 14220 const groupedBySidebar = {}; 14221 for (const widget of widgets) { 14222 const block = transformWidgetToBlock(widget); 14223 groupedBySidebar[widget.sidebar] = groupedBySidebar[widget.sidebar] || []; 14224 groupedBySidebar[widget.sidebar].push(block); 14225 } 14226 for (const sidebarId in groupedBySidebar) { 14227 if (groupedBySidebar.hasOwnProperty(sidebarId)) { 14228 dispatch2( 14229 persistStubPost( 14230 buildWidgetAreaPostId(sidebarId), 14231 groupedBySidebar[sidebarId] 14232 ) 14233 ); 14234 } 14235 } 14236 }; 14237 14238 // packages/edit-widgets/build-module/store/selectors.mjs 14239 var selectors_exports2 = {}; 14240 __export(selectors_exports2, { 14241 __experimentalGetInsertionPoint: () => __experimentalGetInsertionPoint, 14242 canInsertBlockInWidgetArea: () => canInsertBlockInWidgetArea, 14243 getEditedWidgetAreas: () => getEditedWidgetAreas, 14244 getIsWidgetAreaOpen: () => getIsWidgetAreaOpen, 14245 getParentWidgetAreaBlock: () => getParentWidgetAreaBlock, 14246 getReferenceWidgetBlocks: () => getReferenceWidgetBlocks, 14247 getWidget: () => getWidget, 14248 getWidgetAreaForWidgetId: () => getWidgetAreaForWidgetId, 14249 getWidgetAreas: () => getWidgetAreas2, 14250 getWidgets: () => getWidgets2, 14251 isInserterOpened: () => isInserterOpened, 14252 isListViewOpened: () => isListViewOpened, 14253 isSavingWidgetAreas: () => isSavingWidgetAreas, 14254 isWidgetSavingLocked: () => isWidgetSavingLocked 14255 }); 14256 var import_data7 = __toESM(require_data(), 1); 14257 var import_widgets3 = __toESM(require_widgets(), 1); 14258 var import_core_data3 = __toESM(require_core_data(), 1); 14259 var import_block_editor2 = __toESM(require_block_editor(), 1); 14260 var EMPTY_INSERTION_POINT = { 14261 rootClientId: void 0, 14262 insertionIndex: void 0 14263 }; 14264 var getWidgets2 = (0, import_data7.createRegistrySelector)( 14265 (select) => (0, import_data7.createSelector)( 14266 () => { 14267 const widgets = select(import_core_data3.store).getEntityRecords( 14268 "root", 14269 "widget", 14270 buildWidgetsQuery() 14271 ); 14272 return ( 14273 // Key widgets by their ID. 14274 widgets?.reduce( 14275 (allWidgets, widget) => ({ 14276 ...allWidgets, 14277 [widget.id]: widget 14278 }), 14279 {} 14280 ) ?? {} 14281 ); 14282 }, 14283 () => [ 14284 select(import_core_data3.store).getEntityRecords( 14285 "root", 14286 "widget", 14287 buildWidgetsQuery() 14288 ) 14289 ] 14290 ) 14291 ); 14292 var getWidget = (0, import_data7.createRegistrySelector)( 14293 (select) => (state, id) => { 14294 const widgets = select(STORE_NAME2).getWidgets(); 14295 return widgets[id]; 14296 } 14297 ); 14298 var getWidgetAreas2 = (0, import_data7.createRegistrySelector)((select) => () => { 14299 const query = buildWidgetAreasQuery(); 14300 return select(import_core_data3.store).getEntityRecords( 14301 KIND, 14302 WIDGET_AREA_ENTITY_TYPE, 14303 query 14304 ); 14305 }); 14306 var getWidgetAreaForWidgetId = (0, import_data7.createRegistrySelector)( 14307 (select) => (state, widgetId) => { 14308 const widgetAreas = select(STORE_NAME2).getWidgetAreas(); 14309 return widgetAreas.find((widgetArea) => { 14310 const post = select(import_core_data3.store).getEditedEntityRecord( 14311 KIND, 14312 POST_TYPE, 14313 buildWidgetAreaPostId(widgetArea.id) 14314 ); 14315 const blockWidgetIds = post.blocks.map( 14316 (block) => (0, import_widgets3.getWidgetIdFromBlock)(block) 14317 ); 14318 return blockWidgetIds.includes(widgetId); 14319 }); 14320 } 14321 ); 14322 var getParentWidgetAreaBlock = (0, import_data7.createRegistrySelector)( 14323 (select) => (state, clientId) => { 14324 const { getBlock, getBlockName, getBlockParents } = select(import_block_editor2.store); 14325 const blockParents = getBlockParents(clientId); 14326 const widgetAreaClientId = blockParents.find( 14327 (parentClientId) => getBlockName(parentClientId) === "core/widget-area" 14328 ); 14329 return getBlock(widgetAreaClientId); 14330 } 14331 ); 14332 var getEditedWidgetAreas = (0, import_data7.createRegistrySelector)( 14333 (select) => (state, ids) => { 14334 let widgetAreas = select(STORE_NAME2).getWidgetAreas(); 14335 if (!widgetAreas) { 14336 return []; 14337 } 14338 if (ids) { 14339 widgetAreas = widgetAreas.filter( 14340 ({ id }) => ids.includes(id) 14341 ); 14342 } 14343 return widgetAreas.filter( 14344 ({ id }) => select(import_core_data3.store).hasEditsForEntityRecord( 14345 KIND, 14346 POST_TYPE, 14347 buildWidgetAreaPostId(id) 14348 ) 14349 ).map( 14350 ({ id }) => select(import_core_data3.store).getEditedEntityRecord( 14351 KIND, 14352 WIDGET_AREA_ENTITY_TYPE, 14353 id 14354 ) 14355 ); 14356 } 14357 ); 14358 var getReferenceWidgetBlocks = (0, import_data7.createRegistrySelector)( 14359 (select) => (state, referenceWidgetName = null) => { 14360 const results = []; 14361 const widgetAreas = select(STORE_NAME2).getWidgetAreas(); 14362 for (const _widgetArea of widgetAreas) { 14363 const post = select(import_core_data3.store).getEditedEntityRecord( 14364 KIND, 14365 POST_TYPE, 14366 buildWidgetAreaPostId(_widgetArea.id) 14367 ); 14368 for (const block of post.blocks) { 14369 if (block.name === "core/legacy-widget" && (!referenceWidgetName || block.attributes?.referenceWidgetName === referenceWidgetName)) { 14370 results.push(block); 14371 } 14372 } 14373 } 14374 return results; 14375 } 14376 ); 14377 var isSavingWidgetAreas = (0, import_data7.createRegistrySelector)((select) => () => { 14378 const widgetAreasIds = select(STORE_NAME2).getWidgetAreas()?.map(({ id }) => id); 14379 if (!widgetAreasIds) { 14380 return false; 14381 } 14382 for (const id of widgetAreasIds) { 14383 const isSaving = select(import_core_data3.store).isSavingEntityRecord( 14384 KIND, 14385 WIDGET_AREA_ENTITY_TYPE, 14386 id 14387 ); 14388 if (isSaving) { 14389 return true; 14390 } 14391 } 14392 const widgetIds = [ 14393 ...Object.keys(select(STORE_NAME2).getWidgets()), 14394 void 0 14395 // account for new widgets without an ID 14396 ]; 14397 for (const id of widgetIds) { 14398 const isSaving = select(import_core_data3.store).isSavingEntityRecord( 14399 "root", 14400 "widget", 14401 id 14402 ); 14403 if (isSaving) { 14404 return true; 14405 } 14406 } 14407 return false; 14408 }); 14409 var getIsWidgetAreaOpen = (state, clientId) => { 14410 const { widgetAreasOpenState: widgetAreasOpenState2 } = state; 14411 return !!widgetAreasOpenState2[clientId]; 14412 }; 14413 function isInserterOpened(state) { 14414 return !!state.blockInserterPanel; 14415 } 14416 function __experimentalGetInsertionPoint(state) { 14417 if (typeof state.blockInserterPanel === "boolean") { 14418 return EMPTY_INSERTION_POINT; 14419 } 14420 return state.blockInserterPanel; 14421 } 14422 var canInsertBlockInWidgetArea = (0, import_data7.createRegistrySelector)( 14423 (select) => (state, blockName) => { 14424 const widgetAreas = select(import_block_editor2.store).getBlocks(); 14425 const [firstWidgetArea] = widgetAreas; 14426 if (!firstWidgetArea) { 14427 return false; 14428 } 14429 return select(import_block_editor2.store).canInsertBlockType( 14430 blockName, 14431 firstWidgetArea.clientId 14432 ); 14433 } 14434 ); 14435 function isListViewOpened(state) { 14436 return state.listViewPanel; 14437 } 14438 function isWidgetSavingLocked(state) { 14439 return Object.keys(state.widgetSavingLock).length > 0; 14440 } 14441 14442 // packages/edit-widgets/build-module/store/private-selectors.mjs 14443 var private_selectors_exports = {}; 14444 __export(private_selectors_exports, { 14445 getInserterSidebarToggleRef: () => getInserterSidebarToggleRef, 14446 getListViewToggleRef: () => getListViewToggleRef 14447 }); 14448 function getListViewToggleRef(state) { 14449 return state.listViewToggleRef; 14450 } 14451 function getInserterSidebarToggleRef(state) { 14452 return state.inserterSidebarToggleRef; 14453 } 14454 14455 // packages/edit-widgets/build-module/lock-unlock.mjs 14456 var import_private_apis2 = __toESM(require_private_apis(), 1); 14457 var { lock: lock2, unlock: unlock2 } = (0, import_private_apis2.__dangerousOptInToUnstableAPIsOnlyForCoreModules)( 14458 "I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.", 14459 "@wordpress/edit-widgets" 14460 ); 14461 14462 // packages/edit-widgets/build-module/store/index.mjs 14463 var storeConfig = { 14464 reducer: reducer_default, 14465 selectors: selectors_exports2, 14466 resolvers: resolvers_exports, 14467 actions: actions_exports2 14468 }; 14469 var store2 = (0, import_data8.createReduxStore)(STORE_NAME2, storeConfig); 14470 (0, import_data8.register)(store2); 14471 import_api_fetch.default.use(function(options, next) { 14472 if (options.path?.indexOf("/wp/v2/types/widget-area") === 0) { 14473 return Promise.resolve({}); 14474 } 14475 return next(options); 14476 }); 14477 unlock2(store2).registerPrivateSelectors(private_selectors_exports); 14478 14479 // packages/edit-widgets/build-module/filters/move-to-widget-area.mjs 14480 var import_block_editor3 = __toESM(require_block_editor(), 1); 14481 var import_compose5 = __toESM(require_compose(), 1); 14482 var import_data9 = __toESM(require_data(), 1); 14483 var import_hooks = __toESM(require_hooks(), 1); 14484 var import_widgets4 = __toESM(require_widgets(), 1); 14485 var import_jsx_runtime65 = __toESM(require_jsx_runtime(), 1); 14486 var withMoveToWidgetAreaToolbarItem = (0, import_compose5.createHigherOrderComponent)( 14487 (BlockEdit) => (props) => { 14488 const { clientId, name: blockName } = props; 14489 const { widgetAreas, currentWidgetAreaId, canInsertBlockInWidgetArea: canInsertBlockInWidgetArea2 } = (0, import_data9.useSelect)( 14490 (select) => { 14491 if (blockName === "core/widget-area") { 14492 return {}; 14493 } 14494 const selectors3 = select(store2); 14495 const widgetAreaBlock = selectors3.getParentWidgetAreaBlock(clientId); 14496 return { 14497 widgetAreas: selectors3.getWidgetAreas(), 14498 currentWidgetAreaId: widgetAreaBlock?.attributes?.id, 14499 canInsertBlockInWidgetArea: selectors3.canInsertBlockInWidgetArea(blockName) 14500 }; 14501 }, 14502 [clientId, blockName] 14503 ); 14504 const { moveBlockToWidgetArea: moveBlockToWidgetArea2 } = (0, import_data9.useDispatch)(store2); 14505 const hasMultipleWidgetAreas = widgetAreas?.length > 1; 14506 const isMoveToWidgetAreaVisible = blockName !== "core/widget-area" && hasMultipleWidgetAreas && canInsertBlockInWidgetArea2; 14507 return /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(import_jsx_runtime65.Fragment, { children: [ 14508 /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(BlockEdit, { ...props }, "edit"), 14509 isMoveToWidgetAreaVisible && /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(import_block_editor3.BlockControls, { children: /* @__PURE__ */ (0, import_jsx_runtime65.jsx)( 14510 import_widgets4.MoveToWidgetArea, 14511 { 14512 widgetAreas, 14513 currentWidgetAreaId, 14514 onSelect: (widgetAreaId) => { 14515 moveBlockToWidgetArea2( 14516 props.clientId, 14517 widgetAreaId 14518 ); 14519 } 14520 } 14521 ) }) 14522 ] }); 14523 }, 14524 "withMoveToWidgetAreaToolbarItem" 14525 ); 14526 (0, import_hooks.addFilter)( 14527 "editor.BlockEdit", 14528 "core/edit-widgets/block-edit", 14529 withMoveToWidgetAreaToolbarItem 14530 ); 14531 14532 // packages/edit-widgets/build-module/filters/replace-media-upload.mjs 14533 var import_hooks2 = __toESM(require_hooks(), 1); 14534 var import_media_utils = __toESM(require_media_utils(), 1); 14535 var replaceMediaUpload = () => import_media_utils.MediaUpload; 14536 (0, import_hooks2.addFilter)( 14537 "editor.MediaUpload", 14538 "core/edit-widgets/replace-media-upload", 14539 replaceMediaUpload 14540 ); 14541 14542 // packages/edit-widgets/build-module/blocks/widget-area/index.mjs 14543 var widget_area_exports = {}; 14544 __export(widget_area_exports, { 14545 metadata: () => block_default, 14546 name: () => name, 14547 settings: () => settings 14548 }); 14549 var import_i18n9 = __toESM(require_i18n(), 1); 14550 14551 // packages/edit-widgets/build-module/blocks/widget-area/block.json 14552 var block_default = { 14553 $schema: "https://schemas.wp.org/trunk/block.json", 14554 apiVersion: 3, 14555 name: "core/widget-area", 14556 title: "Widget Area", 14557 category: "widgets", 14558 attributes: { 14559 id: { 14560 type: "string" 14561 }, 14562 name: { 14563 type: "string" 14564 } 14565 }, 14566 supports: { 14567 html: false, 14568 inserter: false, 14569 customClassName: false, 14570 reusable: false, 14571 renaming: false, 14572 visibility: false, 14573 __experimentalToolbar: false, 14574 __experimentalParentSelector: false, 14575 __experimentalDisableBlockOverlay: true 14576 }, 14577 editorStyle: "wp-block-widget-area-editor", 14578 style: "wp-block-widget-area" 14579 }; 14580 14581 // packages/edit-widgets/build-module/blocks/widget-area/edit/index.mjs 14582 var import_element51 = __toESM(require_element(), 1); 14583 var import_data10 = __toESM(require_data(), 1); 14584 var import_core_data5 = __toESM(require_core_data(), 1); 14585 var import_components6 = __toESM(require_components(), 1); 14586 var import_block_editor5 = __toESM(require_block_editor(), 1); 14587 14588 // packages/edit-widgets/build-module/blocks/widget-area/edit/inner-blocks.mjs 14589 var import_core_data4 = __toESM(require_core_data(), 1); 14590 var import_block_editor4 = __toESM(require_block_editor(), 1); 14591 var import_element50 = __toESM(require_element(), 1); 14592 14593 // packages/edit-widgets/build-module/blocks/widget-area/edit/use-is-dragging-within.mjs 14594 var import_element49 = __toESM(require_element(), 1); 14595 var useIsDraggingWithin = (elementRef) => { 14596 const [isDraggingWithin, setIsDraggingWithin] = (0, import_element49.useState)(false); 14597 (0, import_element49.useEffect)(() => { 14598 const { ownerDocument: ownerDocument2 } = elementRef.current; 14599 function handleDragStart(event) { 14600 handleDragEnter(event); 14601 } 14602 function handleDragEnd() { 14603 setIsDraggingWithin(false); 14604 } 14605 function handleDragEnter(event) { 14606 if (elementRef.current.contains(event.target)) { 14607 setIsDraggingWithin(true); 14608 } else { 14609 setIsDraggingWithin(false); 14610 } 14611 } 14612 ownerDocument2.addEventListener("dragstart", handleDragStart); 14613 ownerDocument2.addEventListener("dragend", handleDragEnd); 14614 ownerDocument2.addEventListener("dragenter", handleDragEnter); 14615 return () => { 14616 ownerDocument2.removeEventListener("dragstart", handleDragStart); 14617 ownerDocument2.removeEventListener("dragend", handleDragEnd); 14618 ownerDocument2.removeEventListener("dragenter", handleDragEnter); 14619 }; 14620 }, []); 14621 return isDraggingWithin; 14622 }; 14623 var use_is_dragging_within_default = useIsDraggingWithin; 14624 14625 // packages/edit-widgets/build-module/blocks/widget-area/edit/inner-blocks.mjs 14626 var import_jsx_runtime66 = __toESM(require_jsx_runtime(), 1); 14627 function WidgetAreaInnerBlocks({ id }) { 14628 const [blocks, onInput, onChange] = (0, import_core_data4.useEntityBlockEditor)( 14629 "root", 14630 "postType" 14631 ); 14632 const innerBlocksRef = (0, import_element50.useRef)(); 14633 const isDraggingWithinInnerBlocks = use_is_dragging_within_default(innerBlocksRef); 14634 const shouldHighlightDropZone = isDraggingWithinInnerBlocks; 14635 const innerBlocksProps = (0, import_block_editor4.useInnerBlocksProps)( 14636 { ref: innerBlocksRef }, 14637 { 14638 value: blocks, 14639 onInput, 14640 onChange, 14641 templateLock: false, 14642 renderAppender: import_block_editor4.InnerBlocks.ButtonBlockAppender 14643 } 14644 ); 14645 return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)( 14646 "div", 14647 { 14648 "data-widget-area-id": id, 14649 className: clsx_default( 14650 "wp-block-widget-area__inner-blocks block-editor-inner-blocks editor-styles-wrapper", 14651 { 14652 "wp-block-widget-area__highlight-drop-zone": shouldHighlightDropZone 14653 } 14654 ), 14655 children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("div", { ...innerBlocksProps }) 14656 } 14657 ); 14658 } 14659 14660 // packages/edit-widgets/build-module/blocks/widget-area/edit/index.mjs 14661 var import_jsx_runtime67 = __toESM(require_jsx_runtime(), 1); 14662 function WidgetAreaEdit({ 14663 clientId, 14664 attributes: { id, name: name2 } 14665 }) { 14666 const isOpen = (0, import_data10.useSelect)( 14667 (select) => select(store2).getIsWidgetAreaOpen(clientId), 14668 [clientId] 14669 ); 14670 const { setIsWidgetAreaOpen: setIsWidgetAreaOpen2 } = (0, import_data10.useDispatch)(store2); 14671 const wrapper = (0, import_element51.useRef)(); 14672 const setOpen = (0, import_element51.useCallback)( 14673 (openState) => setIsWidgetAreaOpen2(clientId, openState), 14674 [clientId] 14675 ); 14676 const isDragging = useIsDragging(wrapper); 14677 const isDraggingWithin = use_is_dragging_within_default(wrapper); 14678 const [openedWhileDragging, setOpenedWhileDragging] = (0, import_element51.useState)(false); 14679 (0, import_element51.useEffect)(() => { 14680 if (!isDragging) { 14681 setOpenedWhileDragging(false); 14682 return; 14683 } 14684 if (isDraggingWithin && !isOpen) { 14685 setOpen(true); 14686 setOpenedWhileDragging(true); 14687 } else if (!isDraggingWithin && isOpen && openedWhileDragging) { 14688 setOpen(false); 14689 } 14690 }, [isOpen, isDragging, isDraggingWithin, openedWhileDragging]); 14691 const blockProps = (0, import_block_editor5.useBlockProps)(); 14692 return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("div", { ...blockProps, children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(import_components6.Panel, { ref: wrapper, children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)( 14693 import_components6.PanelBody, 14694 { 14695 title: name2, 14696 opened: isOpen, 14697 onToggle: () => { 14698 setIsWidgetAreaOpen2(clientId, !isOpen); 14699 }, 14700 scrollAfterOpen: !isDragging, 14701 children: ({ opened }) => ( 14702 // This is required to ensure LegacyWidget blocks are not 14703 // unmounted when the panel is collapsed. Unmounting legacy 14704 // widgets may have unintended consequences (e.g. TinyMCE 14705 // not being properly reinitialized) 14706 /* @__PURE__ */ (0, import_jsx_runtime67.jsx)( 14707 import_components6.__unstableDisclosureContent, 14708 { 14709 className: "wp-block-widget-area__panel-body-content", 14710 visible: opened, 14711 children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)( 14712 import_core_data5.EntityProvider, 14713 { 14714 kind: "root", 14715 type: "postType", 14716 id: `widget-area-$id}`, 14717 children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(WidgetAreaInnerBlocks, { id }) 14718 } 14719 ) 14720 } 14721 ) 14722 ) 14723 } 14724 ) }) }); 14725 } 14726 var useIsDragging = (elementRef) => { 14727 const [isDragging, setIsDragging] = (0, import_element51.useState)(false); 14728 (0, import_element51.useEffect)(() => { 14729 const { ownerDocument: ownerDocument2 } = elementRef.current; 14730 function handleDragStart() { 14731 setIsDragging(true); 14732 } 14733 function handleDragEnd() { 14734 setIsDragging(false); 14735 } 14736 ownerDocument2.addEventListener("dragstart", handleDragStart); 14737 ownerDocument2.addEventListener("dragend", handleDragEnd); 14738 return () => { 14739 ownerDocument2.removeEventListener("dragstart", handleDragStart); 14740 ownerDocument2.removeEventListener("dragend", handleDragEnd); 14741 }; 14742 }, []); 14743 return isDragging; 14744 }; 14745 14746 // packages/edit-widgets/build-module/blocks/widget-area/index.mjs 14747 var { name } = block_default; 14748 var settings = { 14749 title: (0, import_i18n9.__)("Widget Area"), 14750 description: (0, import_i18n9.__)("A widget area container."), 14751 __experimentalLabel: ({ name: label }) => label, 14752 icon: layout_default, 14753 edit: WidgetAreaEdit 14754 }; 14755 14756 // packages/edit-widgets/build-module/components/layout/index.mjs 14757 var import_i18n26 = __toESM(require_i18n(), 1); 14758 var import_element69 = __toESM(require_element(), 1); 14759 var import_data32 = __toESM(require_data(), 1); 14760 var import_plugins3 = __toESM(require_plugins(), 1); 14761 var import_notices4 = __toESM(require_notices(), 1); 14762 var import_components20 = __toESM(require_components(), 1); 14763 var import_theme2 = __toESM(require_theme(), 1); 14764 14765 // packages/edit-widgets/build-module/components/error-boundary/index.mjs 14766 var import_element52 = __toESM(require_element(), 1); 14767 var import_i18n10 = __toESM(require_i18n(), 1); 14768 var import_compose6 = __toESM(require_compose(), 1); 14769 var import_hooks3 = __toESM(require_hooks(), 1); 14770 var import_jsx_runtime68 = __toESM(require_jsx_runtime(), 1); 14771 function getErrorName(error2) { 14772 return error2 instanceof Error && error2.name || "Error"; 14773 } 14774 function getErrorMessage(error2) { 14775 if (typeof error2 === "string" && error2) { 14776 return error2; 14777 } 14778 if (typeof error2?.message === "string" && error2.message) { 14779 return error2.message; 14780 } 14781 return "An unknown error occurred."; 14782 } 14783 function getErrorSections(error2, componentStack) { 14784 const sections = [ 14785 { label: getErrorName(error2), content: getErrorMessage(error2) } 14786 ]; 14787 if (error2?.stack) { 14788 sections.push({ 14789 label: "Stack", 14790 content: error2.stack.trim(), 14791 preformatted: true 14792 }); 14793 } 14794 if (componentStack) { 14795 sections.push({ 14796 label: "Component stack", 14797 content: componentStack.trim(), 14798 preformatted: true 14799 }); 14800 } 14801 sections.push({ 14802 label: "Environment", 14803 content: `User agent: $window.navigator.userAgent}`, 14804 preformatted: true 14805 }); 14806 return sections; 14807 } 14808 function getErrorReport(error2, componentStack) { 14809 const sections = getErrorSections(error2, componentStack).map( 14810 ({ label, content, preformatted }) => `**$label}** 14811 14812 $preformatted ? `\`\`\` 14813 $content} 14814 \`\`\`` : content}` 14815 ); 14816 return ["### Error report", ...sections].join("\n\n"); 14817 } 14818 function CopyButton({ text, children, variant = "outline" }) { 14819 const ref = (0, import_compose6.useCopyToClipboard)(text); 14820 return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(notice_exports.ActionButton, { variant, ref, children }); 14821 } 14822 function ErrorReport({ error: error2, componentStack }) { 14823 return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)( 14824 Stack, 14825 { 14826 className: "edit-widgets-error-boundary__report", 14827 direction: "column", 14828 gap: "md", 14829 children: getErrorSections(error2, componentStack).map( 14830 ({ label, content }) => /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)(Stack, { direction: "column", gap: "xs", children: [ 14831 /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(Text, { variant: "heading-md", children: label }), 14832 /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("pre", { className: "edit-widgets-error-boundary__report-section", children: content }) 14833 ] }, label) 14834 ) 14835 } 14836 ); 14837 } 14838 function ErrorDetails({ error: error2, componentStack }) { 14839 return /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)(collapsible_card_exports.Root, { className: "edit-widgets-error-boundary__details", children: [ 14840 /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(collapsible_card_exports.Header, { children: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(card_exports.Title, { children: (0, import_i18n10.__)("Error details") }) }), 14841 /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(collapsible_card_exports.Content, { children: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)( 14842 ErrorReport, 14843 { 14844 error: error2, 14845 componentStack 14846 } 14847 ) }) 14848 ] }); 14849 } 14850 var ErrorBoundary = class extends import_element52.Component { 14851 constructor() { 14852 super(...arguments); 14853 this.state = { 14854 error: null, 14855 componentStack: null 14856 }; 14857 } 14858 componentDidCatch(error2, errorInfo) { 14859 this.setState({ componentStack: errorInfo?.componentStack }); 14860 (0, import_hooks3.doAction)("editor.ErrorBoundary.errorLogged", error2, errorInfo); 14861 } 14862 static getDerivedStateFromError(error2) { 14863 return { error: error2 }; 14864 } 14865 render() { 14866 const { error: error2, componentStack } = this.state; 14867 if (!error2) { 14868 return this.props.children; 14869 } 14870 return /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)( 14871 Stack, 14872 { 14873 className: "edit-widgets-error-boundary", 14874 direction: "column", 14875 gap: "lg", 14876 children: [ 14877 /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)(notice_exports.Root, { intent: "error", children: [ 14878 /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(notice_exports.Title, { children: (0, import_i18n10.__)("The editor has crashed") }), 14879 /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(notice_exports.Description, { children: (0, import_i18n10.__)( 14880 "An unknown error occurred. Reload your browser to try again, or copy the error to report the problem or search." 14881 ) }), 14882 /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(notice_exports.Actions, { children: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)( 14883 CopyButton, 14884 { 14885 variant: "solid", 14886 text: () => getErrorReport(error2, componentStack), 14887 children: (0, import_i18n10.__)("Copy error") 14888 } 14889 ) }) 14890 ] }), 14891 true ? /* @__PURE__ */ (0, import_jsx_runtime68.jsx)( 14892 ErrorDetails, 14893 { 14894 error: error2, 14895 componentStack 14896 } 14897 ) : null 14898 ] 14899 } 14900 ); 14901 } 14902 }; 14903 14904 // packages/edit-widgets/build-module/components/widget-areas-block-editor-provider/index.mjs 14905 var import_components7 = __toESM(require_components(), 1); 14906 var import_compose7 = __toESM(require_compose(), 1); 14907 var import_media_utils2 = __toESM(require_media_utils(), 1); 14908 var import_data13 = __toESM(require_data(), 1); 14909 var import_core_data8 = __toESM(require_core_data(), 1); 14910 var import_element54 = __toESM(require_element(), 1); 14911 var import_block_editor8 = __toESM(require_block_editor(), 1); 14912 var import_patterns = __toESM(require_patterns(), 1); 14913 var import_preferences4 = __toESM(require_preferences(), 1); 14914 14915 // packages/edit-widgets/build-module/components/keyboard-shortcuts/index.mjs 14916 var import_element53 = __toESM(require_element(), 1); 14917 var import_keyboard_shortcuts = __toESM(require_keyboard_shortcuts(), 1); 14918 var import_keycodes = __toESM(require_keycodes(), 1); 14919 var import_data11 = __toESM(require_data(), 1); 14920 var import_i18n11 = __toESM(require_i18n(), 1); 14921 var import_core_data6 = __toESM(require_core_data(), 1); 14922 var import_block_editor6 = __toESM(require_block_editor(), 1); 14923 var { usesNativeUndo } = unlock2(import_block_editor6.privateApis); 14924 function KeyboardShortcuts() { 14925 const { redo, undo } = (0, import_data11.useDispatch)(import_core_data6.store); 14926 const { saveEditedWidgetAreas: saveEditedWidgetAreas2 } = (0, import_data11.useDispatch)(store2); 14927 (0, import_keyboard_shortcuts.useShortcut)("core/edit-widgets/undo", (event) => { 14928 if (usesNativeUndo(event)) { 14929 return; 14930 } 14931 undo(); 14932 event.preventDefault(); 14933 }); 14934 (0, import_keyboard_shortcuts.useShortcut)("core/edit-widgets/redo", (event) => { 14935 if (usesNativeUndo(event)) { 14936 return; 14937 } 14938 redo(); 14939 event.preventDefault(); 14940 }); 14941 (0, import_keyboard_shortcuts.useShortcut)("core/edit-widgets/save", (event) => { 14942 event.preventDefault(); 14943 saveEditedWidgetAreas2(); 14944 }); 14945 return null; 14946 } 14947 function KeyboardShortcutsRegister() { 14948 const { registerShortcut } = (0, import_data11.useDispatch)(import_keyboard_shortcuts.store); 14949 (0, import_element53.useEffect)(() => { 14950 registerShortcut({ 14951 name: "core/edit-widgets/undo", 14952 category: "global", 14953 description: (0, import_i18n11.__)("Undo your last changes."), 14954 keyCombination: { 14955 modifier: "primary", 14956 character: "z" 14957 } 14958 }); 14959 registerShortcut({ 14960 name: "core/edit-widgets/redo", 14961 category: "global", 14962 description: (0, import_i18n11.__)("Redo your last undo."), 14963 keyCombination: { 14964 modifier: "primaryShift", 14965 character: "z" 14966 }, 14967 // Disable on Apple OS because it conflicts with the browser's 14968 // history shortcut. It's a fine alias for both Windows and Linux. 14969 // Since there's no conflict for Ctrl+Shift+Z on both Windows and 14970 // Linux, we keep it as the default for consistency. 14971 aliases: (0, import_keycodes.isAppleOS)() ? [] : [ 14972 { 14973 modifier: "primary", 14974 character: "y" 14975 } 14976 ] 14977 }); 14978 registerShortcut({ 14979 name: "core/edit-widgets/save", 14980 category: "global", 14981 description: (0, import_i18n11.__)("Save your changes."), 14982 keyCombination: { 14983 modifier: "primary", 14984 character: "s" 14985 } 14986 }); 14987 registerShortcut({ 14988 name: "core/edit-widgets/keyboard-shortcuts", 14989 category: "main", 14990 description: (0, import_i18n11.__)("Display these keyboard shortcuts."), 14991 keyCombination: { 14992 modifier: "access", 14993 character: "h" 14994 } 14995 }); 14996 registerShortcut({ 14997 name: "core/edit-widgets/next-region", 14998 category: "global", 14999 description: (0, import_i18n11.__)("Navigate to the next part of the editor."), 15000 keyCombination: { 15001 modifier: "ctrl", 15002 character: "`" 15003 }, 15004 aliases: [ 15005 { 15006 modifier: "access", 15007 character: "n" 15008 } 15009 ] 15010 }); 15011 registerShortcut({ 15012 name: "core/edit-widgets/previous-region", 15013 category: "global", 15014 description: (0, import_i18n11.__)("Navigate to the previous part of the editor."), 15015 keyCombination: { 15016 modifier: "ctrlShift", 15017 character: "`" 15018 }, 15019 aliases: [ 15020 { 15021 modifier: "access", 15022 character: "p" 15023 }, 15024 { 15025 modifier: "ctrlShift", 15026 character: "~" 15027 } 15028 ] 15029 }); 15030 }, [registerShortcut]); 15031 return null; 15032 } 15033 KeyboardShortcuts.Register = KeyboardShortcutsRegister; 15034 var keyboard_shortcuts_default = KeyboardShortcuts; 15035 15036 // packages/edit-widgets/build-module/hooks/use-last-selected-widget-area.mjs 15037 var import_data12 = __toESM(require_data(), 1); 15038 var import_block_editor7 = __toESM(require_block_editor(), 1); 15039 var import_core_data7 = __toESM(require_core_data(), 1); 15040 var useLastSelectedWidgetArea = () => (0, import_data12.useSelect)((select) => { 15041 const { getBlockSelectionEnd, getBlockName } = select(import_block_editor7.store); 15042 const selectionEndClientId = getBlockSelectionEnd(); 15043 if (getBlockName(selectionEndClientId) === "core/widget-area") { 15044 return selectionEndClientId; 15045 } 15046 const { getParentWidgetAreaBlock: getParentWidgetAreaBlock2 } = select(store2); 15047 const widgetAreaBlock = getParentWidgetAreaBlock2(selectionEndClientId); 15048 const widgetAreaBlockClientId = widgetAreaBlock?.clientId; 15049 if (widgetAreaBlockClientId) { 15050 return widgetAreaBlockClientId; 15051 } 15052 const { getEntityRecord } = select(import_core_data7.store); 15053 const widgetAreasPost = getEntityRecord( 15054 KIND, 15055 POST_TYPE, 15056 buildWidgetAreasPostId() 15057 ); 15058 return widgetAreasPost?.blocks[0]?.clientId; 15059 }, []); 15060 var use_last_selected_widget_area_default = useLastSelectedWidgetArea; 15061 15062 // packages/edit-widgets/build-module/constants.mjs 15063 var ALLOW_REUSABLE_BLOCKS = false; 15064 15065 // packages/edit-widgets/build-module/components/widget-areas-block-editor-provider/index.mjs 15066 var import_jsx_runtime69 = __toESM(require_jsx_runtime(), 1); 15067 var { ExperimentalBlockEditorProvider } = unlock2(import_block_editor8.privateApis); 15068 var { PatternsMenuItems } = unlock2(import_patterns.privateApis); 15069 var EMPTY_ARRAY2 = []; 15070 function WidgetAreasBlockEditorProvider({ 15071 blockEditorSettings, 15072 children, 15073 ...props 15074 }) { 15075 const isLargeViewport = (0, import_compose7.useViewportMatch)("medium"); 15076 const { 15077 hasUploadPermissions, 15078 reusableBlocks, 15079 isFixedToolbarActive, 15080 keepCaretInsideBlock, 15081 pageOnFront, 15082 pageForPosts 15083 } = (0, import_data13.useSelect)((select) => { 15084 const { canUser, getEntityRecord, getEntityRecords } = select(import_core_data8.store); 15085 const siteSettings = canUser("read", { 15086 kind: "root", 15087 name: "site" 15088 }) ? getEntityRecord("root", "site") : void 0; 15089 return { 15090 hasUploadPermissions: canUser("create", { 15091 kind: "postType", 15092 name: "attachment" 15093 }) ?? true, 15094 reusableBlocks: ALLOW_REUSABLE_BLOCKS ? getEntityRecords("postType", "wp_block") : EMPTY_ARRAY2, 15095 isFixedToolbarActive: !!select(import_preferences4.store).get( 15096 "core/edit-widgets", 15097 "fixedToolbar" 15098 ), 15099 keepCaretInsideBlock: !!select(import_preferences4.store).get( 15100 "core/edit-widgets", 15101 "keepCaretInsideBlock" 15102 ), 15103 pageOnFront: siteSettings?.page_on_front, 15104 pageForPosts: siteSettings?.page_for_posts 15105 }; 15106 }, []); 15107 const { setIsInserterOpened: setIsInserterOpened2 } = (0, import_data13.useDispatch)(store2); 15108 const settings2 = (0, import_element54.useMemo)(() => { 15109 let mediaUploadBlockEditor; 15110 if (hasUploadPermissions) { 15111 mediaUploadBlockEditor = ({ onError, ...argumentsObject }) => { 15112 (0, import_media_utils2.uploadMedia)({ 15113 wpAllowedMimeTypes: blockEditorSettings.allowedMimeTypes, 15114 onError: ({ message }) => onError(message), 15115 ...argumentsObject 15116 }); 15117 }; 15118 } 15119 return { 15120 ...blockEditorSettings, 15121 __experimentalReusableBlocks: reusableBlocks, 15122 hasFixedToolbar: isFixedToolbarActive || !isLargeViewport, 15123 keepCaretInsideBlock, 15124 mediaUpload: mediaUploadBlockEditor, 15125 templateLock: "all", 15126 __experimentalSetIsInserterOpened: setIsInserterOpened2, 15127 pageOnFront, 15128 pageForPosts 15129 }; 15130 }, [ 15131 hasUploadPermissions, 15132 blockEditorSettings, 15133 isFixedToolbarActive, 15134 isLargeViewport, 15135 keepCaretInsideBlock, 15136 reusableBlocks, 15137 setIsInserterOpened2, 15138 pageOnFront, 15139 pageForPosts 15140 ]); 15141 const widgetAreaId = use_last_selected_widget_area_default(); 15142 const [blocks, onInput, onChange] = (0, import_core_data8.useEntityBlockEditor)( 15143 KIND, 15144 POST_TYPE, 15145 { id: buildWidgetAreasPostId() } 15146 ); 15147 return /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)(import_components7.SlotFillProvider, { children: [ 15148 /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(keyboard_shortcuts_default.Register, {}), 15149 /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)( 15150 ExperimentalBlockEditorProvider, 15151 { 15152 value: blocks, 15153 onInput, 15154 onChange, 15155 settings: settings2, 15156 useSubRegistry: false, 15157 ...props, 15158 children: [ 15159 children, 15160 /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(PatternsMenuItems, { rootClientId: widgetAreaId }) 15161 ] 15162 } 15163 ) 15164 ] }); 15165 } 15166 15167 // packages/edit-widgets/build-module/components/sidebar/index.mjs 15168 var import_element56 = __toESM(require_element(), 1); 15169 var import_i18n13 = __toESM(require_i18n(), 1); 15170 var import_block_editor10 = __toESM(require_block_editor(), 1); 15171 var import_components9 = __toESM(require_components(), 1); 15172 var import_data15 = __toESM(require_data(), 1); 15173 15174 // packages/edit-widgets/build-module/components/sidebar/widget-areas.mjs 15175 var import_data14 = __toESM(require_data(), 1); 15176 var import_element55 = __toESM(require_element(), 1); 15177 var import_block_editor9 = __toESM(require_block_editor(), 1); 15178 var import_components8 = __toESM(require_components(), 1); 15179 var import_i18n12 = __toESM(require_i18n(), 1); 15180 var import_url = __toESM(require_url(), 1); 15181 var import_dom21 = __toESM(require_dom(), 1); 15182 var import_jsx_runtime70 = __toESM(require_jsx_runtime(), 1); 15183 function WidgetAreas({ selectedWidgetAreaId }) { 15184 const widgetAreas = (0, import_data14.useSelect)( 15185 (select) => select(store2).getWidgetAreas(), 15186 [] 15187 ); 15188 const selectedWidgetArea = (0, import_element55.useMemo)( 15189 () => selectedWidgetAreaId && widgetAreas?.find( 15190 (widgetArea) => widgetArea.id === selectedWidgetAreaId 15191 ), 15192 [selectedWidgetAreaId, widgetAreas] 15193 ); 15194 let description; 15195 if (!selectedWidgetArea) { 15196 description = (0, import_i18n12.__)( 15197 // eslint-disable-next-line no-restricted-syntax -- 'sidebar' is a common web design term for layouts 15198 "Widget Areas are global parts in your site\u2019s layout that can accept blocks. These vary by theme, but are typically parts like your Sidebar or Footer." 15199 ); 15200 } else if (selectedWidgetAreaId === "wp_inactive_widgets") { 15201 description = (0, import_i18n12.__)( 15202 "Blocks in this Widget Area will not be displayed in your site." 15203 ); 15204 } else { 15205 description = selectedWidgetArea.description; 15206 } 15207 return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("div", { className: "edit-widgets-widget-areas", children: /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { className: "edit-widgets-widget-areas__top-container", children: [ 15208 /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(import_block_editor9.BlockIcon, { icon: layout_default }), 15209 /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { children: [ 15210 /* @__PURE__ */ (0, import_jsx_runtime70.jsx)( 15211 "p", 15212 { 15213 dangerouslySetInnerHTML: { 15214 __html: (0, import_dom21.safeHTML)(description) 15215 } 15216 } 15217 ), 15218 widgetAreas?.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("p", { children: (0, import_i18n12.__)( 15219 "Your theme does not contain any Widget Areas." 15220 ) }), 15221 !selectedWidgetArea && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)( 15222 import_components8.Button, 15223 { 15224 __next40pxDefaultSize: true, 15225 href: (0, import_url.addQueryArgs)("customize.php", { 15226 "autofocus[panel]": "widgets", 15227 return: window.location.pathname 15228 }), 15229 variant: "tertiary", 15230 children: (0, import_i18n12.__)("Manage with live preview") 15231 } 15232 ) 15233 ] }) 15234 ] }) }); 15235 } 15236 15237 // packages/edit-widgets/build-module/components/sidebar/index.mjs 15238 var import_jsx_runtime71 = __toESM(require_jsx_runtime(), 1); 15239 var SIDEBAR_ACTIVE_BY_DEFAULT = true; 15240 var BLOCK_INSPECTOR_IDENTIFIER = "edit-widgets/block-inspector"; 15241 var WIDGET_AREAS_IDENTIFIER = "edit-widgets/block-areas"; 15242 var { Tabs } = unlock2(import_components9.privateApis); 15243 function SidebarHeader({ selectedWidgetAreaBlock }) { 15244 return /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)(Tabs.TabList, { children: [ 15245 /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Tabs.Tab, { tabId: WIDGET_AREAS_IDENTIFIER, children: selectedWidgetAreaBlock ? selectedWidgetAreaBlock.attributes.name : (0, import_i18n13.__)("Widget Areas") }), 15246 /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Tabs.Tab, { tabId: BLOCK_INSPECTOR_IDENTIFIER, children: (0, import_i18n13.__)("Block") }) 15247 ] }); 15248 } 15249 function SidebarContent({ 15250 hasSelectedNonAreaBlock, 15251 currentArea, 15252 isGeneralSidebarOpen, 15253 selectedWidgetAreaBlock 15254 }) { 15255 const { enableComplementaryArea: enableComplementaryArea2 } = (0, import_data15.useDispatch)(store); 15256 (0, import_element56.useEffect)(() => { 15257 if (hasSelectedNonAreaBlock && currentArea === WIDGET_AREAS_IDENTIFIER && isGeneralSidebarOpen) { 15258 enableComplementaryArea2( 15259 "core/edit-widgets", 15260 BLOCK_INSPECTOR_IDENTIFIER 15261 ); 15262 } 15263 if (!hasSelectedNonAreaBlock && currentArea === BLOCK_INSPECTOR_IDENTIFIER && isGeneralSidebarOpen) { 15264 enableComplementaryArea2( 15265 "core/edit-widgets", 15266 WIDGET_AREAS_IDENTIFIER 15267 ); 15268 } 15269 }, [hasSelectedNonAreaBlock, enableComplementaryArea2]); 15270 const tabsContextValue = (0, import_element56.useContext)(Tabs.Context); 15271 return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)( 15272 complementary_area_default, 15273 { 15274 className: "edit-widgets-sidebar", 15275 header: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Tabs.Context.Provider, { value: tabsContextValue, children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)( 15276 SidebarHeader, 15277 { 15278 selectedWidgetAreaBlock 15279 } 15280 ) }), 15281 headerClassName: "edit-widgets-sidebar__panel-tabs", 15282 title: (0, import_i18n13.__)("Settings"), 15283 closeLabel: (0, import_i18n13.__)("Close Settings"), 15284 scope: "core/edit-widgets", 15285 identifier: currentArea, 15286 icon: (0, import_i18n13.isRTL)() ? drawer_left_default : drawer_right_default, 15287 isActiveByDefault: SIDEBAR_ACTIVE_BY_DEFAULT, 15288 children: /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)(Tabs.Context.Provider, { value: tabsContextValue, children: [ 15289 /* @__PURE__ */ (0, import_jsx_runtime71.jsx)( 15290 Tabs.TabPanel, 15291 { 15292 tabId: WIDGET_AREAS_IDENTIFIER, 15293 focusable: false, 15294 children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)( 15295 WidgetAreas, 15296 { 15297 selectedWidgetAreaId: selectedWidgetAreaBlock?.attributes.id 15298 } 15299 ) 15300 } 15301 ), 15302 /* @__PURE__ */ (0, import_jsx_runtime71.jsx)( 15303 Tabs.TabPanel, 15304 { 15305 tabId: BLOCK_INSPECTOR_IDENTIFIER, 15306 focusable: false, 15307 children: hasSelectedNonAreaBlock ? /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(import_block_editor10.BlockInspector, {}) : ( 15308 // Pretend that Widget Areas are part of the UI by not 15309 // showing the Block Inspector when one is selected. 15310 /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("span", { className: "block-editor-block-inspector__no-blocks", children: (0, import_i18n13.__)("No block selected.") }) 15311 ) 15312 } 15313 ) 15314 ] }) 15315 } 15316 ); 15317 } 15318 function Sidebar() { 15319 const { 15320 currentArea, 15321 hasSelectedNonAreaBlock, 15322 isGeneralSidebarOpen, 15323 selectedWidgetAreaBlock 15324 } = (0, import_data15.useSelect)((select) => { 15325 const { getSelectedBlock, getBlock, getBlockParentsByBlockName } = select(import_block_editor10.store); 15326 const { getActiveComplementaryArea: getActiveComplementaryArea2 } = select(store); 15327 const selectedBlock = getSelectedBlock(); 15328 const activeArea = getActiveComplementaryArea2(store2.name); 15329 let currentSelection = activeArea; 15330 if (!currentSelection) { 15331 if (selectedBlock) { 15332 currentSelection = BLOCK_INSPECTOR_IDENTIFIER; 15333 } else { 15334 currentSelection = WIDGET_AREAS_IDENTIFIER; 15335 } 15336 } 15337 let widgetAreaBlock; 15338 if (selectedBlock) { 15339 if (selectedBlock.name === "core/widget-area") { 15340 widgetAreaBlock = selectedBlock; 15341 } else { 15342 widgetAreaBlock = getBlock( 15343 getBlockParentsByBlockName( 15344 selectedBlock.clientId, 15345 "core/widget-area" 15346 )[0] 15347 ); 15348 } 15349 } 15350 return { 15351 currentArea: currentSelection, 15352 hasSelectedNonAreaBlock: !!(selectedBlock && selectedBlock.name !== "core/widget-area"), 15353 isGeneralSidebarOpen: !!activeArea, 15354 selectedWidgetAreaBlock: widgetAreaBlock 15355 }; 15356 }, []); 15357 const { enableComplementaryArea: enableComplementaryArea2 } = (0, import_data15.useDispatch)(store); 15358 const onTabSelect = (0, import_element56.useCallback)( 15359 (newSelectedTabId) => { 15360 if (!!newSelectedTabId) { 15361 enableComplementaryArea2( 15362 store2.name, 15363 newSelectedTabId 15364 ); 15365 } 15366 }, 15367 [enableComplementaryArea2] 15368 ); 15369 return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)( 15370 Tabs, 15371 { 15372 selectedTabId: isGeneralSidebarOpen ? currentArea : null, 15373 onSelect: onTabSelect, 15374 selectOnMove: false, 15375 children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)( 15376 SidebarContent, 15377 { 15378 hasSelectedNonAreaBlock, 15379 currentArea, 15380 isGeneralSidebarOpen, 15381 selectedWidgetAreaBlock 15382 } 15383 ) 15384 } 15385 ); 15386 } 15387 15388 // packages/edit-widgets/build-module/components/layout/interface.mjs 15389 var import_compose13 = __toESM(require_compose(), 1); 15390 var import_block_editor17 = __toESM(require_block_editor(), 1); 15391 var import_element66 = __toESM(require_element(), 1); 15392 var import_data29 = __toESM(require_data(), 1); 15393 var import_i18n23 = __toESM(require_i18n(), 1); 15394 var import_preferences8 = __toESM(require_preferences(), 1); 15395 15396 // packages/edit-widgets/build-module/components/header/index.mjs 15397 var import_block_editor12 = __toESM(require_block_editor(), 1); 15398 var import_data23 = __toESM(require_data(), 1); 15399 var import_element62 = __toESM(require_element(), 1); 15400 var import_i18n21 = __toESM(require_i18n(), 1); 15401 var import_components17 = __toESM(require_components(), 1); 15402 var import_compose10 = __toESM(require_compose(), 1); 15403 var import_preferences6 = __toESM(require_preferences(), 1); 15404 15405 // packages/edit-widgets/build-module/components/header/document-tools/index.mjs 15406 var import_data18 = __toESM(require_data(), 1); 15407 var import_i18n16 = __toESM(require_i18n(), 1); 15408 var import_components12 = __toESM(require_components(), 1); 15409 var import_block_editor11 = __toESM(require_block_editor(), 1); 15410 var import_element59 = __toESM(require_element(), 1); 15411 var import_compose8 = __toESM(require_compose(), 1); 15412 15413 // packages/edit-widgets/build-module/components/header/undo-redo/undo.mjs 15414 var import_i18n14 = __toESM(require_i18n(), 1); 15415 var import_components10 = __toESM(require_components(), 1); 15416 var import_data16 = __toESM(require_data(), 1); 15417 var import_keycodes2 = __toESM(require_keycodes(), 1); 15418 var import_core_data9 = __toESM(require_core_data(), 1); 15419 var import_element57 = __toESM(require_element(), 1); 15420 var import_jsx_runtime72 = __toESM(require_jsx_runtime(), 1); 15421 function UndoButton(props, ref) { 15422 const hasUndo = (0, import_data16.useSelect)( 15423 (select) => select(import_core_data9.store).hasUndo(), 15424 [] 15425 ); 15426 const { undo } = (0, import_data16.useDispatch)(import_core_data9.store); 15427 return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)( 15428 import_components10.Button, 15429 { 15430 ...props, 15431 ref, 15432 icon: !(0, import_i18n14.isRTL)() ? undo_default : redo_default, 15433 label: (0, import_i18n14.__)("Undo"), 15434 shortcut: import_keycodes2.displayShortcut.primary("z"), 15435 "aria-disabled": !hasUndo, 15436 onClick: hasUndo ? undo : void 0, 15437 size: "compact" 15438 } 15439 ); 15440 } 15441 var undo_default2 = (0, import_element57.forwardRef)(UndoButton); 15442 15443 // packages/edit-widgets/build-module/components/header/undo-redo/redo.mjs 15444 var import_i18n15 = __toESM(require_i18n(), 1); 15445 var import_components11 = __toESM(require_components(), 1); 15446 var import_data17 = __toESM(require_data(), 1); 15447 var import_keycodes3 = __toESM(require_keycodes(), 1); 15448 var import_core_data10 = __toESM(require_core_data(), 1); 15449 var import_element58 = __toESM(require_element(), 1); 15450 var import_jsx_runtime73 = __toESM(require_jsx_runtime(), 1); 15451 function RedoButton(props, ref) { 15452 const shortcut = (0, import_keycodes3.isAppleOS)() ? import_keycodes3.displayShortcut.primaryShift("z") : import_keycodes3.displayShortcut.primary("y"); 15453 const hasRedo = (0, import_data17.useSelect)( 15454 (select) => select(import_core_data10.store).hasRedo(), 15455 [] 15456 ); 15457 const { redo } = (0, import_data17.useDispatch)(import_core_data10.store); 15458 return /* @__PURE__ */ (0, import_jsx_runtime73.jsx)( 15459 import_components11.Button, 15460 { 15461 ...props, 15462 ref, 15463 icon: !(0, import_i18n15.isRTL)() ? redo_default : undo_default, 15464 label: (0, import_i18n15.__)("Redo"), 15465 shortcut, 15466 "aria-disabled": !hasRedo, 15467 onClick: hasRedo ? redo : void 0, 15468 size: "compact" 15469 } 15470 ); 15471 } 15472 var redo_default2 = (0, import_element58.forwardRef)(RedoButton); 15473 15474 // packages/edit-widgets/build-module/components/header/document-tools/index.mjs 15475 var import_jsx_runtime74 = __toESM(require_jsx_runtime(), 1); 15476 function DocumentTools() { 15477 const isMediumViewport = (0, import_compose8.useViewportMatch)("medium"); 15478 const { 15479 isInserterOpen, 15480 isListViewOpen, 15481 inserterSidebarToggleRef: inserterSidebarToggleRef2, 15482 listViewToggleRef: listViewToggleRef2 15483 } = (0, import_data18.useSelect)((select) => { 15484 const { 15485 isInserterOpened: isInserterOpened2, 15486 getInserterSidebarToggleRef: getInserterSidebarToggleRef2, 15487 isListViewOpened: isListViewOpened2, 15488 getListViewToggleRef: getListViewToggleRef2 15489 } = unlock2(select(store2)); 15490 return { 15491 isInserterOpen: isInserterOpened2(), 15492 isListViewOpen: isListViewOpened2(), 15493 inserterSidebarToggleRef: getInserterSidebarToggleRef2(), 15494 listViewToggleRef: getListViewToggleRef2() 15495 }; 15496 }, []); 15497 const { setIsInserterOpened: setIsInserterOpened2, setIsListViewOpened: setIsListViewOpened2 } = (0, import_data18.useDispatch)(store2); 15498 const toggleListView = (0, import_element59.useCallback)( 15499 () => setIsListViewOpened2(!isListViewOpen), 15500 [setIsListViewOpened2, isListViewOpen] 15501 ); 15502 const toggleInserterSidebar = (0, import_element59.useCallback)( 15503 () => setIsInserterOpened2(!isInserterOpen), 15504 [setIsInserterOpened2, isInserterOpen] 15505 ); 15506 return /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)( 15507 import_block_editor11.NavigableToolbar, 15508 { 15509 className: "edit-widgets-header-toolbar", 15510 "aria-label": (0, import_i18n16.__)("Document tools"), 15511 variant: "unstyled", 15512 children: [ 15513 /* @__PURE__ */ (0, import_jsx_runtime74.jsx)( 15514 import_components12.ToolbarItem, 15515 { 15516 ref: inserterSidebarToggleRef2, 15517 as: import_components12.Button, 15518 className: "edit-widgets-header-toolbar__inserter-toggle", 15519 variant: "primary", 15520 isPressed: isInserterOpen, 15521 onMouseDown: (event) => { 15522 event.preventDefault(); 15523 }, 15524 onClick: toggleInserterSidebar, 15525 icon: plus_default, 15526 label: (0, import_i18n16._x)( 15527 "Block Inserter", 15528 "Generic label for block inserter button" 15529 ), 15530 size: "compact" 15531 } 15532 ), 15533 isMediumViewport && /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(import_jsx_runtime74.Fragment, { children: [ 15534 /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(import_components12.ToolbarItem, { as: undo_default2 }), 15535 /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(import_components12.ToolbarItem, { as: redo_default2 }), 15536 /* @__PURE__ */ (0, import_jsx_runtime74.jsx)( 15537 import_components12.ToolbarItem, 15538 { 15539 as: import_components12.Button, 15540 className: "edit-widgets-header-toolbar__list-view-toggle", 15541 icon: list_view_default, 15542 isPressed: isListViewOpen, 15543 label: (0, import_i18n16.__)("List View"), 15544 onClick: toggleListView, 15545 ref: listViewToggleRef2, 15546 size: "compact" 15547 } 15548 ) 15549 ] }) 15550 ] 15551 } 15552 ); 15553 } 15554 var document_tools_default = DocumentTools; 15555 15556 // packages/edit-widgets/build-module/components/save-button/index.mjs 15557 var import_components13 = __toESM(require_components(), 1); 15558 var import_i18n17 = __toESM(require_i18n(), 1); 15559 var import_data19 = __toESM(require_data(), 1); 15560 var import_jsx_runtime75 = __toESM(require_jsx_runtime(), 1); 15561 function SaveButton() { 15562 const { hasEditedWidgetAreaIds, isSaving, isWidgetSaveLocked } = (0, import_data19.useSelect)( 15563 (select) => { 15564 const { 15565 getEditedWidgetAreas: getEditedWidgetAreas2, 15566 isSavingWidgetAreas: isSavingWidgetAreas2, 15567 isWidgetSavingLocked: isWidgetSavingLocked2 15568 } = select(store2); 15569 return { 15570 hasEditedWidgetAreaIds: getEditedWidgetAreas2()?.length > 0, 15571 isSaving: isSavingWidgetAreas2(), 15572 isWidgetSaveLocked: isWidgetSavingLocked2() 15573 }; 15574 }, 15575 [] 15576 ); 15577 const { saveEditedWidgetAreas: saveEditedWidgetAreas2 } = (0, import_data19.useDispatch)(store2); 15578 const isDisabled = isWidgetSaveLocked || isSaving || !hasEditedWidgetAreaIds; 15579 return /* @__PURE__ */ (0, import_jsx_runtime75.jsx)( 15580 import_components13.Button, 15581 { 15582 variant: "primary", 15583 isBusy: isSaving, 15584 "aria-disabled": isDisabled, 15585 onClick: isDisabled ? void 0 : saveEditedWidgetAreas2, 15586 size: "compact", 15587 children: isSaving ? (0, import_i18n17.__)("Saving\u2026") : (0, import_i18n17.__)("Update") 15588 } 15589 ); 15590 } 15591 var save_button_default = SaveButton; 15592 15593 // packages/edit-widgets/build-module/components/more-menu/index.mjs 15594 var import_components16 = __toESM(require_components(), 1); 15595 var import_data22 = __toESM(require_data(), 1); 15596 var import_element61 = __toESM(require_element(), 1); 15597 var import_i18n20 = __toESM(require_i18n(), 1); 15598 var import_preferences5 = __toESM(require_preferences(), 1); 15599 var import_keycodes5 = __toESM(require_keycodes(), 1); 15600 var import_keyboard_shortcuts5 = __toESM(require_keyboard_shortcuts(), 1); 15601 var import_compose9 = __toESM(require_compose(), 1); 15602 15603 // packages/edit-widgets/build-module/components/keyboard-shortcut-help-modal/index.mjs 15604 var import_components14 = __toESM(require_components(), 1); 15605 var import_i18n19 = __toESM(require_i18n(), 1); 15606 var import_keyboard_shortcuts4 = __toESM(require_keyboard_shortcuts(), 1); 15607 var import_data21 = __toESM(require_data(), 1); 15608 15609 // packages/edit-widgets/build-module/components/keyboard-shortcut-help-modal/config.mjs 15610 var import_i18n18 = __toESM(require_i18n(), 1); 15611 var textFormattingShortcuts = [ 15612 { 15613 keyCombination: { modifier: "primary", character: "b" }, 15614 description: (0, import_i18n18.__)("Make the selected text bold.") 15615 }, 15616 { 15617 keyCombination: { modifier: "primary", character: "i" }, 15618 description: (0, import_i18n18.__)("Make the selected text italic.") 15619 }, 15620 { 15621 keyCombination: { modifier: "primary", character: "k" }, 15622 description: (0, import_i18n18.__)("Convert the selected text into a link.") 15623 }, 15624 { 15625 keyCombination: { modifier: "primaryShift", character: "k" }, 15626 description: (0, import_i18n18.__)("Remove a link.") 15627 }, 15628 { 15629 keyCombination: { character: "[[" }, 15630 description: (0, import_i18n18.__)("Insert a link to a post or page.") 15631 }, 15632 { 15633 keyCombination: { modifier: "primary", character: "u" }, 15634 description: (0, import_i18n18.__)("Underline the selected text.") 15635 }, 15636 { 15637 keyCombination: { modifier: "access", character: "d" }, 15638 description: (0, import_i18n18.__)("Strikethrough the selected text.") 15639 }, 15640 { 15641 keyCombination: { modifier: "access", character: "x" }, 15642 description: (0, import_i18n18.__)("Make the selected text inline code.") 15643 }, 15644 { 15645 keyCombination: { 15646 modifier: "access", 15647 character: "0" 15648 }, 15649 aliases: [ 15650 { 15651 modifier: "access", 15652 character: "7" 15653 } 15654 ], 15655 description: (0, import_i18n18.__)("Convert the current heading to a paragraph.") 15656 }, 15657 { 15658 keyCombination: { modifier: "access", character: "1-6" }, 15659 description: (0, import_i18n18.__)( 15660 "Convert the current paragraph or heading to a heading of level 1 to 6." 15661 ) 15662 }, 15663 { 15664 keyCombination: { modifier: "primaryShift", character: "SPACE" }, 15665 description: (0, import_i18n18.__)("Add non breaking space.") 15666 } 15667 ]; 15668 15669 // packages/edit-widgets/build-module/components/keyboard-shortcut-help-modal/shortcut.mjs 15670 var import_element60 = __toESM(require_element(), 1); 15671 var import_keycodes4 = __toESM(require_keycodes(), 1); 15672 var import_jsx_runtime76 = __toESM(require_jsx_runtime(), 1); 15673 function KeyCombination({ keyCombination, forceAriaLabel }) { 15674 const shortcut = keyCombination.modifier ? import_keycodes4.displayShortcutList[keyCombination.modifier]( 15675 keyCombination.character 15676 ) : keyCombination.character; 15677 const ariaLabel = keyCombination.modifier ? import_keycodes4.shortcutAriaLabel[keyCombination.modifier]( 15678 keyCombination.character 15679 ) : keyCombination.character; 15680 const shortcuts = Array.isArray(shortcut) ? shortcut : [shortcut]; 15681 return /* @__PURE__ */ (0, import_jsx_runtime76.jsx)( 15682 "kbd", 15683 { 15684 className: "edit-widgets-keyboard-shortcut-help-modal__shortcut-key-combination", 15685 "aria-label": forceAriaLabel || ariaLabel, 15686 children: shortcuts.map((character, index2) => { 15687 if (character === "+") { 15688 return /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(import_element60.Fragment, { children: character }, index2); 15689 } 15690 return /* @__PURE__ */ (0, import_jsx_runtime76.jsx)( 15691 "kbd", 15692 { 15693 className: "edit-widgets-keyboard-shortcut-help-modal__shortcut-key", 15694 children: character 15695 }, 15696 index2 15697 ); 15698 }) 15699 } 15700 ); 15701 } 15702 function Shortcut({ description, keyCombination, aliases = [], ariaLabel }) { 15703 return /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)(import_jsx_runtime76.Fragment, { children: [ 15704 /* @__PURE__ */ (0, import_jsx_runtime76.jsx)("div", { className: "edit-widgets-keyboard-shortcut-help-modal__shortcut-description", children: description }), 15705 /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)("div", { className: "edit-widgets-keyboard-shortcut-help-modal__shortcut-term", children: [ 15706 /* @__PURE__ */ (0, import_jsx_runtime76.jsx)( 15707 KeyCombination, 15708 { 15709 keyCombination, 15710 forceAriaLabel: ariaLabel 15711 } 15712 ), 15713 aliases.map((alias, index2) => /* @__PURE__ */ (0, import_jsx_runtime76.jsx)( 15714 KeyCombination, 15715 { 15716 keyCombination: alias, 15717 forceAriaLabel: ariaLabel 15718 }, 15719 index2 15720 )) 15721 ] }) 15722 ] }); 15723 } 15724 var shortcut_default = Shortcut; 15725 15726 // packages/edit-widgets/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.mjs 15727 var import_data20 = __toESM(require_data(), 1); 15728 var import_keyboard_shortcuts3 = __toESM(require_keyboard_shortcuts(), 1); 15729 var import_jsx_runtime77 = __toESM(require_jsx_runtime(), 1); 15730 function DynamicShortcut({ name: name2 }) { 15731 const { keyCombination, description, aliases } = (0, import_data20.useSelect)( 15732 (select) => { 15733 const { 15734 getShortcutKeyCombination, 15735 getShortcutDescription, 15736 getShortcutAliases 15737 } = select(import_keyboard_shortcuts3.store); 15738 return { 15739 keyCombination: getShortcutKeyCombination(name2), 15740 aliases: getShortcutAliases(name2), 15741 description: getShortcutDescription(name2) 15742 }; 15743 }, 15744 [name2] 15745 ); 15746 if (!keyCombination) { 15747 return null; 15748 } 15749 return /* @__PURE__ */ (0, import_jsx_runtime77.jsx)( 15750 shortcut_default, 15751 { 15752 keyCombination, 15753 description, 15754 aliases 15755 } 15756 ); 15757 } 15758 var dynamic_shortcut_default = DynamicShortcut; 15759 15760 // packages/edit-widgets/build-module/components/keyboard-shortcut-help-modal/index.mjs 15761 var import_jsx_runtime78 = __toESM(require_jsx_runtime(), 1); 15762 var ShortcutList = ({ shortcuts }) => ( 15763 /* 15764 * Disable reason: The `list` ARIA role is redundant but 15765 * Safari+VoiceOver won't announce the list otherwise. 15766 */ 15767 /* eslint-disable jsx-a11y/no-redundant-roles */ 15768 /* @__PURE__ */ (0, import_jsx_runtime78.jsx)( 15769 "ul", 15770 { 15771 className: "edit-widgets-keyboard-shortcut-help-modal__shortcut-list", 15772 role: "list", 15773 children: shortcuts.map((shortcut, index2) => /* @__PURE__ */ (0, import_jsx_runtime78.jsx)( 15774 "li", 15775 { 15776 className: "edit-widgets-keyboard-shortcut-help-modal__shortcut", 15777 children: typeof shortcut === "string" ? /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(dynamic_shortcut_default, { name: shortcut }) : /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(shortcut_default, { ...shortcut }) 15778 }, 15779 index2 15780 )) 15781 } 15782 ) 15783 ); 15784 var ShortcutSection = ({ title, shortcuts, className }) => /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)( 15785 "section", 15786 { 15787 className: clsx_default( 15788 "edit-widgets-keyboard-shortcut-help-modal__section", 15789 className 15790 ), 15791 children: [ 15792 !!title && /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("h2", { className: "edit-widgets-keyboard-shortcut-help-modal__section-title", children: title }), 15793 /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(ShortcutList, { shortcuts }) 15794 ] 15795 } 15796 ); 15797 var ShortcutCategorySection = ({ 15798 title, 15799 categoryName, 15800 additionalShortcuts = [] 15801 }) => { 15802 const categoryShortcuts = (0, import_data21.useSelect)( 15803 (select) => { 15804 return select(import_keyboard_shortcuts4.store).getCategoryShortcuts( 15805 categoryName 15806 ); 15807 }, 15808 [categoryName] 15809 ); 15810 return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)( 15811 ShortcutSection, 15812 { 15813 title, 15814 shortcuts: categoryShortcuts.concat(additionalShortcuts) 15815 } 15816 ); 15817 }; 15818 function KeyboardShortcutHelpModal({ 15819 isModalActive: isModalActive2, 15820 toggleModal 15821 }) { 15822 (0, import_keyboard_shortcuts4.useShortcut)("core/edit-widgets/keyboard-shortcuts", toggleModal, { 15823 bindGlobal: true 15824 }); 15825 if (!isModalActive2) { 15826 return null; 15827 } 15828 return /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)( 15829 import_components14.Modal, 15830 { 15831 className: "edit-widgets-keyboard-shortcut-help-modal", 15832 title: (0, import_i18n19.__)("Keyboard shortcuts"), 15833 onRequestClose: toggleModal, 15834 children: [ 15835 /* @__PURE__ */ (0, import_jsx_runtime78.jsx)( 15836 ShortcutSection, 15837 { 15838 className: "edit-widgets-keyboard-shortcut-help-modal__main-shortcuts", 15839 shortcuts: ["core/edit-widgets/keyboard-shortcuts"] 15840 } 15841 ), 15842 /* @__PURE__ */ (0, import_jsx_runtime78.jsx)( 15843 ShortcutCategorySection, 15844 { 15845 title: (0, import_i18n19.__)("Global shortcuts"), 15846 categoryName: "global" 15847 } 15848 ), 15849 /* @__PURE__ */ (0, import_jsx_runtime78.jsx)( 15850 ShortcutCategorySection, 15851 { 15852 title: (0, import_i18n19.__)("Selection shortcuts"), 15853 categoryName: "selection" 15854 } 15855 ), 15856 /* @__PURE__ */ (0, import_jsx_runtime78.jsx)( 15857 ShortcutCategorySection, 15858 { 15859 title: (0, import_i18n19.__)("Block shortcuts"), 15860 categoryName: "block", 15861 additionalShortcuts: [ 15862 { 15863 keyCombination: { character: "/" }, 15864 description: (0, import_i18n19.__)( 15865 "Change the block type after adding a new paragraph." 15866 ), 15867 /* translators: The forward-slash character. e.g. '/'. */ 15868 ariaLabel: (0, import_i18n19.__)("Forward-slash") 15869 } 15870 ] 15871 } 15872 ), 15873 /* @__PURE__ */ (0, import_jsx_runtime78.jsx)( 15874 ShortcutSection, 15875 { 15876 title: (0, import_i18n19.__)("Text formatting"), 15877 shortcuts: textFormattingShortcuts 15878 } 15879 ), 15880 /* @__PURE__ */ (0, import_jsx_runtime78.jsx)( 15881 ShortcutCategorySection, 15882 { 15883 title: (0, import_i18n19.__)("List View shortcuts"), 15884 categoryName: "list-view" 15885 } 15886 ) 15887 ] 15888 } 15889 ); 15890 } 15891 15892 // packages/edit-widgets/build-module/components/more-menu/tools-more-menu-group.mjs 15893 var import_components15 = __toESM(require_components(), 1); 15894 var { Fill: ToolsMoreMenuGroup, Slot: Slot4 } = (0, import_components15.createSlotFill)( 15895 "EditWidgetsToolsMoreMenuGroup" 15896 ); 15897 ToolsMoreMenuGroup.Slot = Slot4; 15898 var tools_more_menu_group_default = ToolsMoreMenuGroup; 15899 15900 // packages/edit-widgets/build-module/components/more-menu/index.mjs 15901 var import_jsx_runtime79 = __toESM(require_jsx_runtime(), 1); 15902 function MoreMenu() { 15903 const [ 15904 isKeyboardShortcutsModalActive, 15905 setIsKeyboardShortcutsModalVisible 15906 ] = (0, import_element61.useState)(false); 15907 const toggleKeyboardShortcutsModal = () => setIsKeyboardShortcutsModalVisible(!isKeyboardShortcutsModalActive); 15908 (0, import_keyboard_shortcuts5.useShortcut)( 15909 "core/edit-widgets/keyboard-shortcuts", 15910 toggleKeyboardShortcutsModal 15911 ); 15912 const isLargeViewport = (0, import_compose9.useViewportMatch)("medium"); 15913 const { toggle } = (0, import_data22.useDispatch)(import_preferences5.store); 15914 return /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)(import_jsx_runtime79.Fragment, { children: [ 15915 /* @__PURE__ */ (0, import_jsx_runtime79.jsx)( 15916 import_components16.DropdownMenu, 15917 { 15918 icon: more_vertical_default, 15919 label: (0, import_i18n20.__)("Options"), 15920 popoverProps: { 15921 placement: "bottom-end", 15922 className: "more-menu-dropdown__content" 15923 }, 15924 toggleProps: { 15925 tooltipPosition: "bottom", 15926 size: "compact" 15927 }, 15928 children: (onClose) => /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)(import_jsx_runtime79.Fragment, { children: [ 15929 isLargeViewport && /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(import_components16.MenuGroup, { label: (0, import_i18n20._x)("View", "noun"), children: /* @__PURE__ */ (0, import_jsx_runtime79.jsx)( 15930 import_preferences5.PreferenceToggleMenuItem, 15931 { 15932 scope: "core/edit-widgets", 15933 name: "fixedToolbar", 15934 label: (0, import_i18n20.__)("Top toolbar"), 15935 info: (0, import_i18n20.__)( 15936 "Access all block and document tools in a single place" 15937 ), 15938 messageActivated: (0, import_i18n20.__)( 15939 "Top toolbar activated" 15940 ), 15941 messageDeactivated: (0, import_i18n20.__)( 15942 "Top toolbar deactivated" 15943 ) 15944 } 15945 ) }), 15946 /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)(import_components16.MenuGroup, { label: (0, import_i18n20.__)("Tools"), children: [ 15947 /* @__PURE__ */ (0, import_jsx_runtime79.jsx)( 15948 import_components16.MenuItem, 15949 { 15950 onClick: () => { 15951 setIsKeyboardShortcutsModalVisible(true); 15952 }, 15953 shortcut: import_keycodes5.displayShortcut.access("h"), 15954 children: (0, import_i18n20.__)("Keyboard shortcuts") 15955 } 15956 ), 15957 /* @__PURE__ */ (0, import_jsx_runtime79.jsx)( 15958 import_components16.MenuItem, 15959 { 15960 onClick: () => toggle( 15961 "core/edit-widgets", 15962 "welcomeGuide" 15963 ), 15964 "aria-haspopup": "dialog", 15965 children: (0, import_i18n20.__)("Welcome Guide") 15966 } 15967 ), 15968 /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)( 15969 import_components16.MenuItem, 15970 { 15971 role: "menuitem", 15972 icon: external_default, 15973 href: (0, import_i18n20.__)( 15974 "https://wordpress.org/documentation/article/block-based-widgets-editor/" 15975 ), 15976 target: "_blank", 15977 rel: "noopener", 15978 children: [ 15979 (0, import_i18n20.__)("Help"), 15980 /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(VisuallyHidden, { 15981 render: /* @__PURE__ */ (0, import_jsx_runtime79.jsx)("span", {}), 15982 /* translators: accessibility text */ 15983 children: (0, import_i18n20.__)("(opens in a new tab)") 15984 }) 15985 ] 15986 } 15987 ), 15988 /* @__PURE__ */ (0, import_jsx_runtime79.jsx)( 15989 tools_more_menu_group_default.Slot, 15990 { 15991 fillProps: { onClose } 15992 } 15993 ) 15994 ] }), 15995 /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)(import_components16.MenuGroup, { label: (0, import_i18n20.__)("Preferences"), children: [ 15996 /* @__PURE__ */ (0, import_jsx_runtime79.jsx)( 15997 import_preferences5.PreferenceToggleMenuItem, 15998 { 15999 scope: "core/edit-widgets", 16000 name: "keepCaretInsideBlock", 16001 label: (0, import_i18n20.__)( 16002 "Contain text cursor inside block" 16003 ), 16004 info: (0, import_i18n20.__)( 16005 "Aids screen readers by stopping text caret from leaving blocks." 16006 ), 16007 messageActivated: (0, import_i18n20.__)( 16008 "Contain text cursor inside block activated" 16009 ), 16010 messageDeactivated: (0, import_i18n20.__)( 16011 "Contain text cursor inside block deactivated" 16012 ) 16013 } 16014 ), 16015 /* @__PURE__ */ (0, import_jsx_runtime79.jsx)( 16016 import_preferences5.PreferenceToggleMenuItem, 16017 { 16018 scope: "core/edit-widgets", 16019 name: "themeStyles", 16020 info: (0, import_i18n20.__)( 16021 "Make the editor look like your theme." 16022 ), 16023 label: (0, import_i18n20.__)("Use theme styles") 16024 } 16025 ), 16026 isLargeViewport && /* @__PURE__ */ (0, import_jsx_runtime79.jsx)( 16027 import_preferences5.PreferenceToggleMenuItem, 16028 { 16029 scope: "core/edit-widgets", 16030 name: "showBlockBreadcrumbs", 16031 label: (0, import_i18n20.__)("Display block breadcrumbs"), 16032 info: (0, import_i18n20.__)( 16033 "Shows block breadcrumbs at the bottom of the editor." 16034 ), 16035 messageActivated: (0, import_i18n20.__)( 16036 "Display block breadcrumbs activated" 16037 ), 16038 messageDeactivated: (0, import_i18n20.__)( 16039 "Display block breadcrumbs deactivated" 16040 ) 16041 } 16042 ) 16043 ] }) 16044 ] }) 16045 } 16046 ), 16047 /* @__PURE__ */ (0, import_jsx_runtime79.jsx)( 16048 KeyboardShortcutHelpModal, 16049 { 16050 isModalActive: isKeyboardShortcutsModalActive, 16051 toggleModal: toggleKeyboardShortcutsModal 16052 } 16053 ) 16054 ] }); 16055 } 16056 16057 // packages/edit-widgets/build-module/components/header/index.mjs 16058 var import_jsx_runtime80 = __toESM(require_jsx_runtime(), 1); 16059 function Header3() { 16060 const isLargeViewport = (0, import_compose10.useViewportMatch)("medium"); 16061 const blockToolbarRef = (0, import_element62.useRef)(); 16062 const { hasFixedToolbar } = (0, import_data23.useSelect)( 16063 (select) => ({ 16064 hasFixedToolbar: !!select(import_preferences6.store).get( 16065 "core/edit-widgets", 16066 "fixedToolbar" 16067 ) 16068 }), 16069 [] 16070 ); 16071 return /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(import_jsx_runtime80.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("div", { className: "edit-widgets-header", children: [ 16072 /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("div", { className: "edit-widgets-header__navigable-toolbar-wrapper", children: [ 16073 isLargeViewport && /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("h1", { className: "edit-widgets-header__title", children: (0, import_i18n21.__)("Widgets") }), 16074 !isLargeViewport && /* @__PURE__ */ (0, import_jsx_runtime80.jsx)( 16075 VisuallyHidden, 16076 { 16077 className: "edit-widgets-header__title", 16078 render: /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("h1", {}), 16079 children: (0, import_i18n21.__)("Widgets") 16080 } 16081 ), 16082 /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(document_tools_default, {}), 16083 hasFixedToolbar && isLargeViewport && /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)(import_jsx_runtime80.Fragment, { children: [ 16084 /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("div", { className: "selected-block-tools-wrapper", children: /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(import_block_editor12.BlockToolbar, { hideDragHandle: true }) }), 16085 /* @__PURE__ */ (0, import_jsx_runtime80.jsx)( 16086 import_components17.Popover.Slot, 16087 { 16088 ref: blockToolbarRef, 16089 name: "block-toolbar" 16090 } 16091 ) 16092 ] }) 16093 ] }), 16094 /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("div", { className: "edit-widgets-header__actions", children: [ 16095 /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(pinned_items_default.Slot, { scope: "core/edit-widgets" }), 16096 /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(save_button_default, {}), 16097 /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(MoreMenu, {}) 16098 ] }) 16099 ] }) }); 16100 } 16101 var header_default = Header3; 16102 16103 // packages/edit-widgets/build-module/components/widget-areas-block-editor-content/index.mjs 16104 var import_block_editor13 = __toESM(require_block_editor(), 1); 16105 var import_compose11 = __toESM(require_compose(), 1); 16106 var import_data24 = __toESM(require_data(), 1); 16107 var import_element63 = __toESM(require_element(), 1); 16108 var import_preferences7 = __toESM(require_preferences(), 1); 16109 16110 // packages/edit-widgets/build-module/components/notices/index.mjs 16111 var import_notices2 = __toESM(require_notices(), 1); 16112 var import_theme = __toESM(require_theme(), 1); 16113 var import_jsx_runtime81 = __toESM(require_jsx_runtime(), 1); 16114 function Notices() { 16115 return /* @__PURE__ */ (0, import_jsx_runtime81.jsxs)(import_theme.ThemeProvider, { cornerRadius: "none", children: [ 16116 /* @__PURE__ */ (0, import_jsx_runtime81.jsx)( 16117 import_notices2.InlineNotices, 16118 { 16119 className: "edit-widgets-notices", 16120 pinnedNoticesClassName: "edit-widgets-notices__pinned", 16121 dismissibleNoticesClassName: "edit-widgets-notices__dismissible" 16122 } 16123 ), 16124 /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(import_notices2.SnackbarNotices, { className: "edit-widgets-notices__snackbar" }) 16125 ] }); 16126 } 16127 var notices_default = Notices; 16128 16129 // packages/edit-widgets/build-module/components/widget-areas-block-editor-content/index.mjs 16130 var import_jsx_runtime82 = __toESM(require_jsx_runtime(), 1); 16131 function WidgetAreasBlockEditorContent({ 16132 blockEditorSettings 16133 }) { 16134 const hasThemeStyles = (0, import_data24.useSelect)( 16135 (select) => !!select(import_preferences7.store).get( 16136 "core/edit-widgets", 16137 "themeStyles" 16138 ), 16139 [] 16140 ); 16141 const isLargeViewport = (0, import_compose11.useViewportMatch)("medium"); 16142 const styles = (0, import_element63.useMemo)(() => { 16143 return hasThemeStyles ? blockEditorSettings.styles : []; 16144 }, [blockEditorSettings, hasThemeStyles]); 16145 return /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("div", { className: "edit-widgets-block-editor", children: [ 16146 /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(notices_default, {}), 16147 !isLargeViewport && /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(import_block_editor13.BlockToolbar, { hideDragHandle: true }), 16148 /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)(import_block_editor13.BlockTools, { children: [ 16149 /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(keyboard_shortcuts_default, {}), 16150 /* @__PURE__ */ (0, import_jsx_runtime82.jsx)( 16151 import_block_editor13.__unstableEditorStyles, 16152 { 16153 styles, 16154 scope: ":where(.editor-styles-wrapper)" 16155 } 16156 ), 16157 /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(import_block_editor13.BlockSelectionClearer, { children: /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(import_block_editor13.WritingFlow, { children: /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(import_block_editor13.BlockList, { className: "edit-widgets-main-block-list" }) }) }) 16158 ] }) 16159 ] }); 16160 } 16161 16162 // packages/edit-widgets/build-module/components/secondary-sidebar/index.mjs 16163 var import_data28 = __toESM(require_data(), 1); 16164 16165 // packages/edit-widgets/build-module/components/secondary-sidebar/inserter-sidebar.mjs 16166 var import_block_editor15 = __toESM(require_block_editor(), 1); 16167 var import_compose12 = __toESM(require_compose(), 1); 16168 var import_element64 = __toESM(require_element(), 1); 16169 var import_data26 = __toESM(require_data(), 1); 16170 16171 // packages/edit-widgets/build-module/hooks/use-widget-library-insertion-point.mjs 16172 var import_data25 = __toESM(require_data(), 1); 16173 var import_block_editor14 = __toESM(require_block_editor(), 1); 16174 var import_core_data11 = __toESM(require_core_data(), 1); 16175 var useWidgetLibraryInsertionPoint = () => { 16176 const firstRootId = (0, import_data25.useSelect)((select) => { 16177 const { getEntityRecord } = select(import_core_data11.store); 16178 const widgetAreasPost = getEntityRecord( 16179 KIND, 16180 POST_TYPE, 16181 buildWidgetAreasPostId() 16182 ); 16183 return widgetAreasPost?.blocks[0]?.clientId; 16184 }, []); 16185 return (0, import_data25.useSelect)( 16186 (select) => { 16187 const { 16188 getBlockRootClientId, 16189 getBlockSelectionEnd, 16190 getBlockOrder, 16191 getBlockIndex 16192 } = select(import_block_editor14.store); 16193 const insertionPoint = select(store2).__experimentalGetInsertionPoint(); 16194 if (insertionPoint.rootClientId) { 16195 return insertionPoint; 16196 } 16197 const clientId = getBlockSelectionEnd() || firstRootId; 16198 const rootClientId = getBlockRootClientId(clientId); 16199 if (clientId && rootClientId === "") { 16200 return { 16201 rootClientId: clientId, 16202 insertionIndex: getBlockOrder(clientId).length 16203 }; 16204 } 16205 return { 16206 rootClientId, 16207 insertionIndex: getBlockIndex(clientId) + 1 16208 }; 16209 }, 16210 [firstRootId] 16211 ); 16212 }; 16213 var use_widget_library_insertion_point_default = useWidgetLibraryInsertionPoint; 16214 16215 // packages/edit-widgets/build-module/components/secondary-sidebar/inserter-sidebar.mjs 16216 var import_jsx_runtime83 = __toESM(require_jsx_runtime(), 1); 16217 function InserterSidebar() { 16218 const isMobileViewport = (0, import_compose12.useViewportMatch)("medium", "<"); 16219 const { rootClientId, insertionIndex } = use_widget_library_insertion_point_default(); 16220 const { setIsInserterOpened: setIsInserterOpened2 } = (0, import_data26.useDispatch)(store2); 16221 const closeInserter = (0, import_element64.useCallback)(() => { 16222 return setIsInserterOpened2(false); 16223 }, [setIsInserterOpened2]); 16224 const libraryRef = (0, import_element64.useRef)(); 16225 return /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("div", { className: "edit-widgets-layout__inserter-panel", children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("div", { className: "edit-widgets-layout__inserter-panel-content", children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)( 16226 import_block_editor15.__experimentalLibrary, 16227 { 16228 showInserterHelpPanel: true, 16229 shouldFocusBlock: isMobileViewport, 16230 rootClientId, 16231 __experimentalInsertionIndex: insertionIndex, 16232 ref: libraryRef, 16233 onClose: closeInserter 16234 } 16235 ) }) }); 16236 } 16237 16238 // packages/edit-widgets/build-module/components/secondary-sidebar/list-view-sidebar.mjs 16239 var import_block_editor16 = __toESM(require_block_editor(), 1); 16240 var import_components18 = __toESM(require_components(), 1); 16241 var import_data27 = __toESM(require_data(), 1); 16242 var import_element65 = __toESM(require_element(), 1); 16243 var import_i18n22 = __toESM(require_i18n(), 1); 16244 var import_keycodes6 = __toESM(require_keycodes(), 1); 16245 var import_jsx_runtime84 = __toESM(require_jsx_runtime(), 1); 16246 function ListViewSidebar() { 16247 const { setIsListViewOpened: setIsListViewOpened2 } = (0, import_data27.useDispatch)(store2); 16248 const { getListViewToggleRef: getListViewToggleRef2 } = unlock2((0, import_data27.useSelect)(store2)); 16249 const [dropZoneElement, setDropZoneElement] = (0, import_element65.useState)(null); 16250 const closeListView = (0, import_element65.useCallback)(() => { 16251 setIsListViewOpened2(false); 16252 getListViewToggleRef2().current?.focus(); 16253 }, [getListViewToggleRef2, setIsListViewOpened2]); 16254 const closeOnEscape = (0, import_element65.useCallback)( 16255 (event) => { 16256 if (event.keyCode === import_keycodes6.ESCAPE && !event.defaultPrevented) { 16257 event.preventDefault(); 16258 closeListView(); 16259 } 16260 }, 16261 [closeListView] 16262 ); 16263 return ( 16264 // eslint-disable-next-line jsx-a11y/no-static-element-interactions 16265 /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)( 16266 "div", 16267 { 16268 className: "edit-widgets-editor__list-view-panel", 16269 onKeyDown: closeOnEscape, 16270 children: [ 16271 /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)("div", { className: "edit-widgets-editor__list-view-panel-header", children: [ 16272 /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("strong", { children: (0, import_i18n22.__)("List View") }), 16273 /* @__PURE__ */ (0, import_jsx_runtime84.jsx)( 16274 import_components18.Button, 16275 { 16276 icon: close_small_default, 16277 label: (0, import_i18n22.__)("Close"), 16278 onClick: closeListView, 16279 size: "compact" 16280 } 16281 ) 16282 ] }), 16283 /* @__PURE__ */ (0, import_jsx_runtime84.jsx)( 16284 "div", 16285 { 16286 className: "edit-widgets-editor__list-view-panel-content", 16287 ref: setDropZoneElement, 16288 children: /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(import_block_editor16.__experimentalListView, { dropZoneElement, focusOnMount: true }) 16289 } 16290 ) 16291 ] 16292 } 16293 ) 16294 ); 16295 } 16296 16297 // packages/edit-widgets/build-module/components/secondary-sidebar/index.mjs 16298 var import_jsx_runtime85 = __toESM(require_jsx_runtime(), 1); 16299 function SecondarySidebar() { 16300 const { isInserterOpen, isListViewOpen } = (0, import_data28.useSelect)((select) => { 16301 const { isInserterOpened: isInserterOpened2, isListViewOpened: isListViewOpened2 } = select(store2); 16302 return { 16303 isInserterOpen: isInserterOpened2(), 16304 isListViewOpen: isListViewOpened2() 16305 }; 16306 }, []); 16307 if (isInserterOpen) { 16308 return /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(InserterSidebar, {}); 16309 } 16310 if (isListViewOpen) { 16311 return /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(ListViewSidebar, {}); 16312 } 16313 return null; 16314 } 16315 16316 // packages/edit-widgets/build-module/components/layout/interface.mjs 16317 var import_jsx_runtime86 = __toESM(require_jsx_runtime(), 1); 16318 var interfaceLabels = { 16319 /* translators: accessibility text for the widgets screen top bar landmark region. */ 16320 header: (0, import_i18n23.__)("Widgets top bar"), 16321 /* translators: accessibility text for the widgets screen content landmark region. */ 16322 body: (0, import_i18n23.__)("Widgets and blocks"), 16323 /* translators: accessibility text for the widgets screen settings landmark region. */ 16324 sidebar: (0, import_i18n23.__)("Widgets settings"), 16325 /* translators: accessibility text for the widgets screen footer landmark region. */ 16326 footer: (0, import_i18n23.__)("Widgets footer") 16327 }; 16328 function Interface({ blockEditorSettings }) { 16329 const isMobileViewport = (0, import_compose13.useViewportMatch)("medium", "<"); 16330 const isHugeViewport = (0, import_compose13.useViewportMatch)("huge", ">="); 16331 const { setIsInserterOpened: setIsInserterOpened2, setIsListViewOpened: setIsListViewOpened2, closeGeneralSidebar: closeGeneralSidebar2 } = (0, import_data29.useDispatch)(store2); 16332 const { 16333 hasBlockBreadCrumbsEnabled, 16334 hasSidebarEnabled, 16335 isInserterOpened: isInserterOpened2, 16336 isListViewOpened: isListViewOpened2 16337 } = (0, import_data29.useSelect)( 16338 (select) => ({ 16339 hasSidebarEnabled: !!select( 16340 store 16341 ).getActiveComplementaryArea(store2.name), 16342 isInserterOpened: !!select(store2).isInserterOpened(), 16343 isListViewOpened: !!select(store2).isListViewOpened(), 16344 hasBlockBreadCrumbsEnabled: !!select(import_preferences8.store).get( 16345 "core/edit-widgets", 16346 "showBlockBreadcrumbs" 16347 ) 16348 }), 16349 [] 16350 ); 16351 (0, import_element66.useEffect)(() => { 16352 if (hasSidebarEnabled && !isHugeViewport) { 16353 setIsInserterOpened2(false); 16354 setIsListViewOpened2(false); 16355 } 16356 }, [hasSidebarEnabled, isHugeViewport]); 16357 (0, import_element66.useEffect)(() => { 16358 if ((isInserterOpened2 || isListViewOpened2) && !isHugeViewport) { 16359 closeGeneralSidebar2(); 16360 } 16361 }, [isInserterOpened2, isListViewOpened2, isHugeViewport]); 16362 const secondarySidebarLabel = isListViewOpened2 ? (0, import_i18n23.__)("List View") : (0, import_i18n23.__)("Block Library"); 16363 const hasSecondarySidebar = isListViewOpened2 || isInserterOpened2; 16364 return /* @__PURE__ */ (0, import_jsx_runtime86.jsx)( 16365 interface_skeleton_default, 16366 { 16367 labels: { 16368 ...interfaceLabels, 16369 secondarySidebar: secondarySidebarLabel 16370 }, 16371 header: /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(header_default, {}), 16372 secondarySidebar: hasSecondarySidebar && /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(SecondarySidebar, {}), 16373 sidebar: /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(complementary_area_default.Slot, { scope: "core/edit-widgets" }), 16374 content: /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(import_jsx_runtime86.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime86.jsx)( 16375 WidgetAreasBlockEditorContent, 16376 { 16377 blockEditorSettings 16378 } 16379 ) }), 16380 footer: hasBlockBreadCrumbsEnabled && !isMobileViewport && /* @__PURE__ */ (0, import_jsx_runtime86.jsx)("div", { className: "edit-widgets-layout__footer", children: /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(import_block_editor17.BlockBreadcrumb, { rootLabelText: (0, import_i18n23.__)("Widgets") }) }) 16381 } 16382 ); 16383 } 16384 var interface_default = Interface; 16385 16386 // packages/edit-widgets/build-module/components/layout/unsaved-changes-warning.mjs 16387 var import_i18n24 = __toESM(require_i18n(), 1); 16388 var import_element67 = __toESM(require_element(), 1); 16389 var import_data30 = __toESM(require_data(), 1); 16390 function UnsavedChangesWarning() { 16391 const isDirty = (0, import_data30.useSelect)((select) => { 16392 const { getEditedWidgetAreas: getEditedWidgetAreas2 } = select(store2); 16393 const editedWidgetAreas = getEditedWidgetAreas2(); 16394 return editedWidgetAreas?.length > 0; 16395 }, []); 16396 (0, import_element67.useEffect)(() => { 16397 const warnIfUnsavedChanges = (event) => { 16398 if (isDirty) { 16399 event.returnValue = (0, import_i18n24.__)( 16400 "You have unsaved changes. If you proceed, they will be lost." 16401 ); 16402 return event.returnValue; 16403 } 16404 }; 16405 window.addEventListener("beforeunload", warnIfUnsavedChanges); 16406 return () => { 16407 window.removeEventListener("beforeunload", warnIfUnsavedChanges); 16408 }; 16409 }, [isDirty]); 16410 return null; 16411 } 16412 16413 // packages/edit-widgets/build-module/components/welcome-guide/index.mjs 16414 var import_data31 = __toESM(require_data(), 1); 16415 var import_components19 = __toESM(require_components(), 1); 16416 var import_i18n25 = __toESM(require_i18n(), 1); 16417 var import_element68 = __toESM(require_element(), 1); 16418 var import_preferences9 = __toESM(require_preferences(), 1); 16419 var import_jsx_runtime87 = __toESM(require_jsx_runtime(), 1); 16420 function WelcomeGuide() { 16421 const isActive = (0, import_data31.useSelect)( 16422 (select) => !!select(import_preferences9.store).get( 16423 "core/edit-widgets", 16424 "welcomeGuide" 16425 ), 16426 [] 16427 ); 16428 const { toggle } = (0, import_data31.useDispatch)(import_preferences9.store); 16429 const widgetAreas = (0, import_data31.useSelect)( 16430 (select) => select(store2).getWidgetAreas({ per_page: -1 }), 16431 [] 16432 ); 16433 if (!isActive) { 16434 return null; 16435 } 16436 const isEntirelyBlockWidgets = widgetAreas?.every( 16437 (widgetArea) => widgetArea.id === "wp_inactive_widgets" || widgetArea.widgets.every( 16438 (widgetId) => widgetId.startsWith("block-") 16439 ) 16440 ); 16441 const numWidgetAreas = widgetAreas?.filter( 16442 (widgetArea) => widgetArea.id !== "wp_inactive_widgets" 16443 ).length ?? 0; 16444 return /* @__PURE__ */ (0, import_jsx_runtime87.jsx)( 16445 import_components19.Guide, 16446 { 16447 className: "edit-widgets-welcome-guide", 16448 contentLabel: (0, import_i18n25.__)("Welcome to block Widgets"), 16449 finishButtonText: (0, import_i18n25.__)("Get started"), 16450 onFinish: () => toggle("core/edit-widgets", "welcomeGuide"), 16451 pages: [ 16452 { 16453 image: /* @__PURE__ */ (0, import_jsx_runtime87.jsx)( 16454 WelcomeGuideImage, 16455 { 16456 nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-canvas.svg", 16457 animatedSrc: "https://s.w.org/images/block-editor/welcome-canvas.gif" 16458 } 16459 ), 16460 content: /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)(import_jsx_runtime87.Fragment, { children: [ 16461 /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("h1", { className: "edit-widgets-welcome-guide__heading", children: (0, import_i18n25.__)("Welcome to block Widgets") }), 16462 isEntirelyBlockWidgets ? /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(import_jsx_runtime87.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("p", { className: "edit-widgets-welcome-guide__text", children: (0, import_i18n25.sprintf)( 16463 // Translators: %s: Number of block areas in the current theme. 16464 (0, import_i18n25._n)( 16465 "Your theme provides %s \u201Cblock\u201D area for you to add and edit content.\xA0Try adding a search bar, social icons, or other types of blocks here and see how they\u2019ll look on your site.", 16466 "Your theme provides %s different \u201Cblock\u201D areas for you to add and edit content.\xA0Try adding a search bar, social icons, or other types of blocks here and see how they\u2019ll look on your site.", 16467 numWidgetAreas 16468 ), 16469 numWidgetAreas 16470 ) }) }) : /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)(import_jsx_runtime87.Fragment, { children: [ 16471 /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("p", { className: "edit-widgets-welcome-guide__text", children: (0, import_i18n25.__)( 16472 "You can now add any block to your site\u2019s widget areas. Don\u2019t worry, all of your favorite widgets still work flawlessly." 16473 ) }), 16474 /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)("p", { className: "edit-widgets-welcome-guide__text", children: [ 16475 /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("strong", { children: (0, import_i18n25.__)( 16476 "Want to stick with the old widgets?" 16477 ) }), 16478 " ", 16479 /* @__PURE__ */ (0, import_jsx_runtime87.jsx)( 16480 import_components19.ExternalLink, 16481 { 16482 href: (0, import_i18n25.__)( 16483 "https://wordpress.org/plugins/classic-widgets/" 16484 ), 16485 children: (0, import_i18n25.__)( 16486 "Get the Classic Widgets plugin." 16487 ) 16488 } 16489 ) 16490 ] }) 16491 ] }) 16492 ] }) 16493 }, 16494 { 16495 image: /* @__PURE__ */ (0, import_jsx_runtime87.jsx)( 16496 WelcomeGuideImage, 16497 { 16498 nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-editor.svg", 16499 animatedSrc: "https://s.w.org/images/block-editor/welcome-editor.gif" 16500 } 16501 ), 16502 content: /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)(import_jsx_runtime87.Fragment, { children: [ 16503 /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("h1", { className: "edit-widgets-welcome-guide__heading", children: (0, import_i18n25.__)("Customize each block") }), 16504 /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("p", { className: "edit-widgets-welcome-guide__text", children: (0, import_i18n25.__)( 16505 "Each block comes with its own set of controls for changing things like color, width, and alignment. These will show and hide automatically when you have a block selected." 16506 ) }) 16507 ] }) 16508 }, 16509 { 16510 image: /* @__PURE__ */ (0, import_jsx_runtime87.jsx)( 16511 WelcomeGuideImage, 16512 { 16513 nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-library.svg", 16514 animatedSrc: "https://s.w.org/images/block-editor/welcome-library.gif" 16515 } 16516 ), 16517 content: /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)(import_jsx_runtime87.Fragment, { children: [ 16518 /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("h1", { className: "edit-widgets-welcome-guide__heading", children: (0, import_i18n25.__)("Explore all blocks") }), 16519 /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("p", { className: "edit-widgets-welcome-guide__text", children: (0, import_element68.createInterpolateElement)( 16520 (0, import_i18n25.__)( 16521 "All of the blocks available to you live in the block library. You\u2019ll find it wherever you see the <InserterIconImage /> icon." 16522 ), 16523 { 16524 InserterIconImage: /* @__PURE__ */ (0, import_jsx_runtime87.jsx)( 16525 "img", 16526 { 16527 className: "edit-widgets-welcome-guide__inserter-icon", 16528 alt: (0, import_i18n25.__)("inserter"), 16529 src: "data:image/svg+xml,%3Csvg width='18' height='18' viewBox='0 0 18 18' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Crect width='18' height='18' rx='2' fill='%231E1E1E'/%3E%3Cpath d='M9.22727 4V14M4 8.77273H14' stroke='white' stroke-width='1.5'/%3E%3C/svg%3E%0A" 16530 } 16531 ) 16532 } 16533 ) }) 16534 ] }) 16535 }, 16536 { 16537 image: /* @__PURE__ */ (0, import_jsx_runtime87.jsx)( 16538 WelcomeGuideImage, 16539 { 16540 nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-documentation.svg", 16541 animatedSrc: "https://s.w.org/images/block-editor/welcome-documentation.gif" 16542 } 16543 ), 16544 content: /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)(import_jsx_runtime87.Fragment, { children: [ 16545 /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("h1", { className: "edit-widgets-welcome-guide__heading", children: (0, import_i18n25.__)("Learn more") }), 16546 /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("p", { className: "edit-widgets-welcome-guide__text", children: (0, import_element68.createInterpolateElement)( 16547 (0, import_i18n25.__)( 16548 "New to the block editor? Want to learn more about using it? <a>Here's a detailed guide.</a>" 16549 ), 16550 { 16551 a: /* @__PURE__ */ (0, import_jsx_runtime87.jsx)( 16552 import_components19.ExternalLink, 16553 { 16554 href: (0, import_i18n25.__)( 16555 "https://wordpress.org/documentation/article/wordpress-block-editor/" 16556 ) 16557 } 16558 ) 16559 } 16560 ) }) 16561 ] }) 16562 } 16563 ] 16564 } 16565 ); 16566 } 16567 function WelcomeGuideImage({ nonAnimatedSrc, animatedSrc }) { 16568 return /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)("picture", { className: "edit-widgets-welcome-guide__image", children: [ 16569 /* @__PURE__ */ (0, import_jsx_runtime87.jsx)( 16570 "source", 16571 { 16572 srcSet: nonAnimatedSrc, 16573 media: "(prefers-reduced-motion: reduce)" 16574 } 16575 ), 16576 /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("img", { src: animatedSrc, width: "312", height: "240", alt: "" }) 16577 ] }); 16578 } 16579 16580 // packages/edit-widgets/build-module/components/layout/index.mjs 16581 var import_jsx_runtime88 = __toESM(require_jsx_runtime(), 1); 16582 function Layout({ blockEditorSettings }) { 16583 const { createErrorNotice } = (0, import_data32.useDispatch)(import_notices4.store); 16584 function onPluginAreaError(name2) { 16585 createErrorNotice( 16586 (0, import_i18n26.sprintf)( 16587 /* translators: %s: plugin name */ 16588 (0, import_i18n26.__)( 16589 'The "%s" plugin has encountered an error and cannot be rendered.' 16590 ), 16591 name2 16592 ) 16593 ); 16594 } 16595 const navigateRegionsProps = (0, import_components20.__unstableUseNavigateRegions)(); 16596 const adminPrimary = (0, import_element69.useMemo)(() => getAdminThemeColors().primary, []); 16597 return /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(import_theme2.ThemeProvider, { isRoot: true, color: { primary: adminPrimary }, children: /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(ErrorBoundary, { children: /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("div", { ...navigateRegionsProps, children: /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)( 16598 WidgetAreasBlockEditorProvider, 16599 { 16600 blockEditorSettings, 16601 children: [ 16602 /* @__PURE__ */ (0, import_jsx_runtime88.jsx)( 16603 interface_default, 16604 { 16605 blockEditorSettings 16606 } 16607 ), 16608 /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(Sidebar, {}), 16609 /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(import_plugins3.PluginArea, { onError: onPluginAreaError }), 16610 /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(UnsavedChangesWarning, {}), 16611 /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(WelcomeGuide, {}) 16612 ] 16613 } 16614 ) }) }) }); 16615 } 16616 var layout_default2 = Layout; 16617 16618 // packages/edit-widgets/build-module/index.mjs 16619 var import_jsx_runtime89 = __toESM(require_jsx_runtime(), 1); 16620 var disabledBlocks = [ 16621 "core/more", 16622 "core/freeform", 16623 "core/template-part", 16624 ...ALLOW_REUSABLE_BLOCKS ? [] : ["core/block"] 16625 ]; 16626 function initializeEditor(id, settings2) { 16627 const target = document.getElementById(id); 16628 const root = (0, import_element70.createRoot)(target); 16629 const coreBlocks = (0, import_block_library.__experimentalGetCoreBlocks)().filter((block) => { 16630 return !(disabledBlocks.includes(block.name) || block.name.startsWith("core/post") || block.name.startsWith("core/query") || block.name.startsWith("core/site") || block.name.startsWith("core/navigation") || block.name.startsWith("core/term")); 16631 }); 16632 (0, import_data33.dispatch)(import_preferences10.store).setDefaults("core/edit-widgets", { 16633 fixedToolbar: false, 16634 welcomeGuide: true, 16635 showBlockBreadcrumbs: true, 16636 themeStyles: true 16637 }); 16638 (0, import_data33.dispatch)(import_blocks3.store).reapplyBlockTypeFilters(); 16639 (0, import_block_library.registerCoreBlocks)(coreBlocks); 16640 (0, import_widgets5.registerLegacyWidgetBlock)(); 16641 if (false) { 16642 (0, import_block_library.__experimentalRegisterExperimentalCoreBlocks)({ 16643 enableFSEBlocks: ENABLE_EXPERIMENTAL_FSE_BLOCKS 16644 }); 16645 } 16646 (0, import_widgets5.registerLegacyWidgetVariations)(settings2); 16647 registerBlock(widget_area_exports); 16648 (0, import_widgets5.registerWidgetGroupBlock)(); 16649 settings2.__experimentalFetchLinkSuggestions = (search, searchOptions) => (0, import_core_data12.__experimentalFetchLinkSuggestions)(search, searchOptions, settings2); 16650 (0, import_blocks3.setFreeformContentHandlerName)("core/html"); 16651 root.render( 16652 /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(import_element70.StrictMode, { children: /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(layout_default2, { blockEditorSettings: settings2 }) }) 16653 ); 16654 return root; 16655 } 16656 var initialize = initializeEditor; 16657 function reinitializeEditor() { 16658 (0, import_deprecated6.default)("wp.editWidgets.reinitializeEditor", { 16659 since: "6.2", 16660 version: "6.3" 16661 }); 16662 } 16663 var registerBlock = (block) => { 16664 if (!block) { 16665 return; 16666 } 16667 const { metadata, settings: settings2, name: name2 } = block; 16668 if (metadata) { 16669 (0, import_blocks3.unstable__bootstrapServerSideBlockDefinitions)({ [name2]: metadata }); 16670 } 16671 (0, import_blocks3.registerBlockType)(name2, settings2); 16672 }; 16673 return __toCommonJS(index_exports); 16674 })(); 16675 /*! Bundled license information: 16676 16677 use-sync-external-store/cjs/use-sync-external-store-shim.development.js: 16678 (** 16679 * @license React 16680 * use-sync-external-store-shim.development.js 16681 * 16682 * Copyright (c) Meta Platforms, Inc. and affiliates. 16683 * 16684 * This source code is licensed under the MIT license found in the 16685 * LICENSE file in the root directory of this source tree. 16686 *) 16687 16688 use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js: 16689 (** 16690 * @license React 16691 * use-sync-external-store-shim/with-selector.development.js 16692 * 16693 * Copyright (c) Meta Platforms, Inc. and affiliates. 16694 * 16695 * This source code is licensed under the MIT license found in the 16696 * LICENSE file in the root directory of this source tree. 16697 *) 16698 */ 16699 (window.wp ||= {}).editWidgets = wp.editWidgets; 16700 })();
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated : Wed Oct 7 08:20:33 2026 | Cross-referenced by PHPXref |