| 1 |
(function() { |
| 2 |
var wp; |
| 3 |
(wp ||= {}).customizeWidgets = (() => { |
| 4 |
var __create = Object.create; |
| 5 |
var __defProp = Object.defineProperty; |
| 6 |
var __getOwnPropDesc = Object.getOwnPropertyDescriptor; |
| 7 |
var __getOwnPropNames = Object.getOwnPropertyNames; |
| 8 |
var __getProtoOf = Object.getPrototypeOf; |
| 9 |
var __hasOwnProp = Object.prototype.hasOwnProperty; |
| 10 |
var __commonJS = (cb, mod) => function __require() { |
| 11 |
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; |
| 12 |
}; |
| 13 |
var __export = (target, all) => { |
| 14 |
for (var name in all) |
| 15 |
__defProp(target, name, { get: all[name], enumerable: true }); |
| 16 |
}; |
| 17 |
var __copyProps = (to, from, except, desc) => { |
| 18 |
if (from && typeof from === "object" || typeof from === "function") { |
| 19 |
for (let key of __getOwnPropNames(from)) |
| 20 |
if (!__hasOwnProp.call(to, key) && key !== except) |
| 21 |
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); |
| 22 |
} |
| 23 |
return to; |
| 24 |
}; |
| 25 |
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( |
| 26 |
// If the importer is in node compatibility mode or this is not an ESM |
| 27 |
// file that has been converted to a CommonJS file using a Babel- |
| 28 |
// compatible transform (i.e. "__esModule" has not been set), then set |
| 29 |
// "default" to the CommonJS "module.exports" for node compatibility. |
| 30 |
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, |
| 31 |
mod |
| 32 |
)); |
| 33 |
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); |
| 34 |
|
| 35 |
// package-external:@wordpress/element |
| 36 |
var require_element = __commonJS({ |
| 37 |
"package-external:@wordpress/element"(exports, module) { |
| 38 |
module.exports = window.wp.element; |
| 39 |
} |
| 40 |
}); |
| 41 |
|
| 42 |
// package-external:@wordpress/block-library |
| 43 |
var require_block_library = __commonJS({ |
| 44 |
"package-external:@wordpress/block-library"(exports, module) { |
| 45 |
module.exports = window.wp.blockLibrary; |
| 46 |
} |
| 47 |
}); |
| 48 |
|
| 49 |
// package-external:@wordpress/widgets |
| 50 |
var require_widgets = __commonJS({ |
| 51 |
"package-external:@wordpress/widgets"(exports, module) { |
| 52 |
module.exports = window.wp.widgets; |
| 53 |
} |
| 54 |
}); |
| 55 |
|
| 56 |
// package-external:@wordpress/blocks |
| 57 |
var require_blocks = __commonJS({ |
| 58 |
"package-external:@wordpress/blocks"(exports, module) { |
| 59 |
module.exports = window.wp.blocks; |
| 60 |
} |
| 61 |
}); |
| 62 |
|
| 63 |
// package-external:@wordpress/data |
| 64 |
var require_data = __commonJS({ |
| 65 |
"package-external:@wordpress/data"(exports, module) { |
| 66 |
module.exports = window.wp.data; |
| 67 |
} |
| 68 |
}); |
| 69 |
|
| 70 |
// package-external:@wordpress/preferences |
| 71 |
var require_preferences = __commonJS({ |
| 72 |
"package-external:@wordpress/preferences"(exports, module) { |
| 73 |
module.exports = window.wp.preferences; |
| 74 |
} |
| 75 |
}); |
| 76 |
|
| 77 |
// package-external:@wordpress/i18n |
| 78 |
var require_i18n = __commonJS({ |
| 79 |
"package-external:@wordpress/i18n"(exports, module) { |
| 80 |
module.exports = window.wp.i18n; |
| 81 |
} |
| 82 |
}); |
| 83 |
|
| 84 |
// vendor-external:react |
| 85 |
var require_react = __commonJS({ |
| 86 |
"vendor-external:react"(exports, module) { |
| 87 |
module.exports = window.React; |
| 88 |
} |
| 89 |
}); |
| 90 |
|
| 91 |
// vendor-external:react/jsx-runtime |
| 92 |
var require_jsx_runtime = __commonJS({ |
| 93 |
"vendor-external:react/jsx-runtime"(exports, module) { |
| 94 |
module.exports = window.ReactJSXRuntime; |
| 95 |
} |
| 96 |
}); |
| 97 |
|
| 98 |
// vendor-external:react-dom |
| 99 |
var require_react_dom = __commonJS({ |
| 100 |
"vendor-external:react-dom"(exports, module) { |
| 101 |
module.exports = window.ReactDOM; |
| 102 |
} |
| 103 |
}); |
| 104 |
|
| 105 |
// node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js |
| 106 |
var require_use_sync_external_store_shim_development = __commonJS({ |
| 107 |
"node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js"(exports) { |
| 108 |
"use strict"; |
| 109 |
(function() { |
| 110 |
function is(x, y) { |
| 111 |
return x === y && (0 !== x || 1 / x === 1 / y) || x !== x && y !== y; |
| 112 |
} |
| 113 |
function useSyncExternalStore$2(subscribe, getSnapshot) { |
| 114 |
didWarnOld18Alpha || void 0 === React59.startTransition || (didWarnOld18Alpha = true, console.error( |
| 115 |
"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." |
| 116 |
)); |
| 117 |
var value = getSnapshot(); |
| 118 |
if (!didWarnUncachedGetSnapshot) { |
| 119 |
var cachedValue = getSnapshot(); |
| 120 |
objectIs(value, cachedValue) || (console.error( |
| 121 |
"The result of getSnapshot should be cached to avoid an infinite loop" |
| 122 |
), didWarnUncachedGetSnapshot = true); |
| 123 |
} |
| 124 |
cachedValue = useState21({ |
| 125 |
inst: { value, getSnapshot } |
| 126 |
}); |
| 127 |
var inst = cachedValue[0].inst, forceUpdate = cachedValue[1]; |
| 128 |
useLayoutEffect3( |
| 129 |
function() { |
| 130 |
inst.value = value; |
| 131 |
inst.getSnapshot = getSnapshot; |
| 132 |
checkIfSnapshotChanged(inst) && forceUpdate({ inst }); |
| 133 |
}, |
| 134 |
[subscribe, value, getSnapshot] |
| 135 |
); |
| 136 |
useEffect28( |
| 137 |
function() { |
| 138 |
checkIfSnapshotChanged(inst) && forceUpdate({ inst }); |
| 139 |
return subscribe(function() { |
| 140 |
checkIfSnapshotChanged(inst) && forceUpdate({ inst }); |
| 141 |
}); |
| 142 |
}, |
| 143 |
[subscribe] |
| 144 |
); |
| 145 |
useDebugValue2(value); |
| 146 |
return value; |
| 147 |
} |
| 148 |
function checkIfSnapshotChanged(inst) { |
| 149 |
var latestGetSnapshot = inst.getSnapshot; |
| 150 |
inst = inst.value; |
| 151 |
try { |
| 152 |
var nextValue = latestGetSnapshot(); |
| 153 |
return !objectIs(inst, nextValue); |
| 154 |
} catch (error2) { |
| 155 |
return true; |
| 156 |
} |
| 157 |
} |
| 158 |
function useSyncExternalStore$1(subscribe, getSnapshot) { |
| 159 |
return getSnapshot(); |
| 160 |
} |
| 161 |
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error()); |
| 162 |
var React59 = require_react(), objectIs = "function" === typeof Object.is ? Object.is : is, useState21 = React59.useState, useEffect28 = React59.useEffect, useLayoutEffect3 = 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; |
| 163 |
exports.useSyncExternalStore = void 0 !== React59.useSyncExternalStore ? React59.useSyncExternalStore : shim; |
| 164 |
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error()); |
| 165 |
})(); |
| 166 |
} |
| 167 |
}); |
| 168 |
|
| 169 |
// node_modules/use-sync-external-store/shim/index.js |
| 170 |
var require_shim = __commonJS({ |
| 171 |
"node_modules/use-sync-external-store/shim/index.js"(exports, module) { |
| 172 |
"use strict"; |
| 173 |
if (false) { |
| 174 |
module.exports = null; |
| 175 |
} else { |
| 176 |
module.exports = require_use_sync_external_store_shim_development(); |
| 177 |
} |
| 178 |
} |
| 179 |
}); |
| 180 |
|
| 181 |
// node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js |
| 182 |
var require_with_selector_development = __commonJS({ |
| 183 |
"node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js"(exports) { |
| 184 |
"use strict"; |
| 185 |
(function() { |
| 186 |
function is(x, y) { |
| 187 |
return x === y && (0 !== x || 1 / x === 1 / y) || x !== x && y !== y; |
| 188 |
} |
| 189 |
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error()); |
| 190 |
var React59 = require_react(), shim = require_shim(), objectIs = "function" === typeof Object.is ? Object.is : is, useSyncExternalStore3 = shim.useSyncExternalStore, useRef25 = React59.useRef, useEffect28 = React59.useEffect, useMemo25 = React59.useMemo, useDebugValue2 = React59.useDebugValue; |
| 191 |
exports.useSyncExternalStoreWithSelector = function(subscribe, getSnapshot, getServerSnapshot, selector, isEqual) { |
| 192 |
var instRef = useRef25(null); |
| 193 |
if (null === instRef.current) { |
| 194 |
var inst = { hasValue: false, value: null }; |
| 195 |
instRef.current = inst; |
| 196 |
} else inst = instRef.current; |
| 197 |
instRef = useMemo25( |
| 198 |
function() { |
| 199 |
function memoizedSelector(nextSnapshot) { |
| 200 |
if (!hasMemo) { |
| 201 |
hasMemo = true; |
| 202 |
memoizedSnapshot = nextSnapshot; |
| 203 |
nextSnapshot = selector(nextSnapshot); |
| 204 |
if (void 0 !== isEqual && inst.hasValue) { |
| 205 |
var currentSelection = inst.value; |
| 206 |
if (isEqual(currentSelection, nextSnapshot)) |
| 207 |
return memoizedSelection = currentSelection; |
| 208 |
} |
| 209 |
return memoizedSelection = nextSnapshot; |
| 210 |
} |
| 211 |
currentSelection = memoizedSelection; |
| 212 |
if (objectIs(memoizedSnapshot, nextSnapshot)) |
| 213 |
return currentSelection; |
| 214 |
var nextSelection = selector(nextSnapshot); |
| 215 |
if (void 0 !== isEqual && isEqual(currentSelection, nextSelection)) |
| 216 |
return memoizedSnapshot = nextSnapshot, currentSelection; |
| 217 |
memoizedSnapshot = nextSnapshot; |
| 218 |
return memoizedSelection = nextSelection; |
| 219 |
} |
| 220 |
var hasMemo = false, memoizedSnapshot, memoizedSelection, maybeGetServerSnapshot = void 0 === getServerSnapshot ? null : getServerSnapshot; |
| 221 |
return [ |
| 222 |
function() { |
| 223 |
return memoizedSelector(getSnapshot()); |
| 224 |
}, |
| 225 |
null === maybeGetServerSnapshot ? void 0 : function() { |
| 226 |
return memoizedSelector(maybeGetServerSnapshot()); |
| 227 |
} |
| 228 |
]; |
| 229 |
}, |
| 230 |
[getSnapshot, getServerSnapshot, selector, isEqual] |
| 231 |
); |
| 232 |
var value = useSyncExternalStore3(subscribe, instRef[0], instRef[1]); |
| 233 |
useEffect28( |
| 234 |
function() { |
| 235 |
inst.hasValue = true; |
| 236 |
inst.value = value; |
| 237 |
}, |
| 238 |
[value] |
| 239 |
); |
| 240 |
useDebugValue2(value); |
| 241 |
return value; |
| 242 |
}; |
| 243 |
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error()); |
| 244 |
})(); |
| 245 |
} |
| 246 |
}); |
| 247 |
|
| 248 |
// node_modules/use-sync-external-store/shim/with-selector.js |
| 249 |
var require_with_selector = __commonJS({ |
| 250 |
"node_modules/use-sync-external-store/shim/with-selector.js"(exports, module) { |
| 251 |
"use strict"; |
| 252 |
if (false) { |
| 253 |
module.exports = null; |
| 254 |
} else { |
| 255 |
module.exports = require_with_selector_development(); |
| 256 |
} |
| 257 |
} |
| 258 |
}); |
| 259 |
|
| 260 |
// package-external:@wordpress/compose |
| 261 |
var require_compose = __commonJS({ |
| 262 |
"package-external:@wordpress/compose"(exports, module) { |
| 263 |
module.exports = window.wp.compose; |
| 264 |
} |
| 265 |
}); |
| 266 |
|
| 267 |
// package-external:@wordpress/theme |
| 268 |
var require_theme = __commonJS({ |
| 269 |
"package-external:@wordpress/theme"(exports, module) { |
| 270 |
module.exports = window.wp.theme; |
| 271 |
} |
| 272 |
}); |
| 273 |
|
| 274 |
// package-external:@wordpress/private-apis |
| 275 |
var require_private_apis = __commonJS({ |
| 276 |
"package-external:@wordpress/private-apis"(exports, module) { |
| 277 |
module.exports = window.wp.privateApis; |
| 278 |
} |
| 279 |
}); |
| 280 |
|
| 281 |
// package-external:@wordpress/primitives |
| 282 |
var require_primitives = __commonJS({ |
| 283 |
"package-external:@wordpress/primitives"(exports, module) { |
| 284 |
module.exports = window.wp.primitives; |
| 285 |
} |
| 286 |
}); |
| 287 |
|
| 288 |
// package-external:@wordpress/a11y |
| 289 |
var require_a11y = __commonJS({ |
| 290 |
"package-external:@wordpress/a11y"(exports, module) { |
| 291 |
module.exports = window.wp.a11y; |
| 292 |
} |
| 293 |
}); |
| 294 |
|
| 295 |
// package-external:@wordpress/components |
| 296 |
var require_components = __commonJS({ |
| 297 |
"package-external:@wordpress/components"(exports, module) { |
| 298 |
module.exports = window.wp.components; |
| 299 |
} |
| 300 |
}); |
| 301 |
|
| 302 |
// package-external:@wordpress/hooks |
| 303 |
var require_hooks = __commonJS({ |
| 304 |
"package-external:@wordpress/hooks"(exports, module) { |
| 305 |
module.exports = window.wp.hooks; |
| 306 |
} |
| 307 |
}); |
| 308 |
|
| 309 |
// package-external:@wordpress/core-data |
| 310 |
var require_core_data = __commonJS({ |
| 311 |
"package-external:@wordpress/core-data"(exports, module) { |
| 312 |
module.exports = window.wp.coreData; |
| 313 |
} |
| 314 |
}); |
| 315 |
|
| 316 |
// package-external:@wordpress/block-editor |
| 317 |
var require_block_editor = __commonJS({ |
| 318 |
"package-external:@wordpress/block-editor"(exports, module) { |
| 319 |
module.exports = window.wp.blockEditor; |
| 320 |
} |
| 321 |
}); |
| 322 |
|
| 323 |
// package-external:@wordpress/media-utils |
| 324 |
var require_media_utils = __commonJS({ |
| 325 |
"package-external:@wordpress/media-utils"(exports, module) { |
| 326 |
module.exports = window.wp.mediaUtils; |
| 327 |
} |
| 328 |
}); |
| 329 |
|
| 330 |
// package-external:@wordpress/keycodes |
| 331 |
var require_keycodes = __commonJS({ |
| 332 |
"package-external:@wordpress/keycodes"(exports, module) { |
| 333 |
module.exports = window.wp.keycodes; |
| 334 |
} |
| 335 |
}); |
| 336 |
|
| 337 |
// package-external:@wordpress/keyboard-shortcuts |
| 338 |
var require_keyboard_shortcuts = __commonJS({ |
| 339 |
"package-external:@wordpress/keyboard-shortcuts"(exports, module) { |
| 340 |
module.exports = window.wp.keyboardShortcuts; |
| 341 |
} |
| 342 |
}); |
| 343 |
|
| 344 |
// node_modules/fast-deep-equal/es6/index.js |
| 345 |
var require_es6 = __commonJS({ |
| 346 |
"node_modules/fast-deep-equal/es6/index.js"(exports, module) { |
| 347 |
"use strict"; |
| 348 |
module.exports = function equal(a, b) { |
| 349 |
if (a === b) return true; |
| 350 |
if (a && b && typeof a == "object" && typeof b == "object") { |
| 351 |
if (a.constructor !== b.constructor) return false; |
| 352 |
var length, i, keys; |
| 353 |
if (Array.isArray(a)) { |
| 354 |
length = a.length; |
| 355 |
if (length != b.length) return false; |
| 356 |
for (i = length; i-- !== 0; ) |
| 357 |
if (!equal(a[i], b[i])) return false; |
| 358 |
return true; |
| 359 |
} |
| 360 |
if (a instanceof Map && b instanceof Map) { |
| 361 |
if (a.size !== b.size) return false; |
| 362 |
for (i of a.entries()) |
| 363 |
if (!b.has(i[0])) return false; |
| 364 |
for (i of a.entries()) |
| 365 |
if (!equal(i[1], b.get(i[0]))) return false; |
| 366 |
return true; |
| 367 |
} |
| 368 |
if (a instanceof Set && b instanceof Set) { |
| 369 |
if (a.size !== b.size) return false; |
| 370 |
for (i of a.entries()) |
| 371 |
if (!b.has(i[0])) return false; |
| 372 |
return true; |
| 373 |
} |
| 374 |
if (ArrayBuffer.isView(a) && ArrayBuffer.isView(b)) { |
| 375 |
length = a.length; |
| 376 |
if (length != b.length) return false; |
| 377 |
for (i = length; i-- !== 0; ) |
| 378 |
if (a[i] !== b[i]) return false; |
| 379 |
return true; |
| 380 |
} |
| 381 |
if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags; |
| 382 |
if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf(); |
| 383 |
if (a.toString !== Object.prototype.toString) return a.toString() === b.toString(); |
| 384 |
keys = Object.keys(a); |
| 385 |
length = keys.length; |
| 386 |
if (length !== Object.keys(b).length) return false; |
| 387 |
for (i = length; i-- !== 0; ) |
| 388 |
if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false; |
| 389 |
for (i = length; i-- !== 0; ) { |
| 390 |
var key = keys[i]; |
| 391 |
if (!equal(a[key], b[key])) return false; |
| 392 |
} |
| 393 |
return true; |
| 394 |
} |
| 395 |
return a !== a && b !== b; |
| 396 |
}; |
| 397 |
} |
| 398 |
}); |
| 399 |
|
| 400 |
// package-external:@wordpress/is-shallow-equal |
| 401 |
var require_is_shallow_equal = __commonJS({ |
| 402 |
"package-external:@wordpress/is-shallow-equal"(exports, module) { |
| 403 |
module.exports = window.wp.isShallowEqual; |
| 404 |
} |
| 405 |
}); |
| 406 |
|
| 407 |
// package-external:@wordpress/dom |
| 408 |
var require_dom = __commonJS({ |
| 409 |
"package-external:@wordpress/dom"(exports, module) { |
| 410 |
module.exports = window.wp.dom; |
| 411 |
} |
| 412 |
}); |
| 413 |
|
| 414 |
// packages/customize-widgets/build-module/index.mjs |
| 415 |
var index_exports = {}; |
| 416 |
__export(index_exports, { |
| 417 |
initialize: () => initialize, |
| 418 |
store: () => store |
| 419 |
}); |
| 420 |
var import_element60 = __toESM(require_element(), 1); |
| 421 |
var import_block_library = __toESM(require_block_library(), 1); |
| 422 |
var import_widgets5 = __toESM(require_widgets(), 1); |
| 423 |
var import_blocks2 = __toESM(require_blocks(), 1); |
| 424 |
var import_data18 = __toESM(require_data(), 1); |
| 425 |
var import_preferences4 = __toESM(require_preferences(), 1); |
| 426 |
|
| 427 |
// node_modules/clsx/dist/clsx.mjs |
| 428 |
function r(e) { |
| 429 |
var t, f, n = ""; |
| 430 |
if ("string" == typeof e || "number" == typeof e) n += e; |
| 431 |
else if ("object" == typeof e) if (Array.isArray(e)) { |
| 432 |
var o = e.length; |
| 433 |
for (t = 0; t < o; t++) e[t] && (f = r(e[t])) && (n && (n += " "), n += f); |
| 434 |
} else for (f in e) e[f] && (n && (n += " "), n += f); |
| 435 |
return n; |
| 436 |
} |
| 437 |
function clsx() { |
| 438 |
for (var e, t, f = 0, n = "", o = arguments.length; f < o; f++) (e = arguments[f]) && (t = r(e)) && (n && (n += " "), n += t); |
| 439 |
return n; |
| 440 |
} |
| 441 |
var clsx_default = clsx; |
| 442 |
|
| 443 |
// node_modules/@base-ui/utils/useControlled.mjs |
| 444 |
var React = __toESM(require_react(), 1); |
| 445 |
|
| 446 |
// node_modules/@base-ui/utils/createLogOnce.mjs |
| 447 |
var loggedMessages; |
| 448 |
if (true) { |
| 449 |
loggedMessages = /* @__PURE__ */ new Set(); |
| 450 |
} |
| 451 |
function createLogOnce(severity, prefix) { |
| 452 |
return function logOnce(...messages) { |
| 453 |
if (true) { |
| 454 |
const message = messages.join(" "); |
| 455 |
const output = prefix ? `${prefix}: ${message}` : message; |
| 456 |
const key = `${severity}:${output}`; |
| 457 |
if (!loggedMessages.has(key)) { |
| 458 |
loggedMessages.add(key); |
| 459 |
if (severity === "warn") { |
| 460 |
console.warn(output); |
| 461 |
} else { |
| 462 |
console.error(output); |
| 463 |
} |
| 464 |
} |
| 465 |
} |
| 466 |
}; |
| 467 |
} |
| 468 |
|
| 469 |
// node_modules/@base-ui/utils/error.mjs |
| 470 |
var error = createLogOnce("error", "Base UI"); |
| 471 |
|
| 472 |
// node_modules/@base-ui/utils/useControlled.mjs |
| 473 |
function useControlled({ |
| 474 |
controlled, |
| 475 |
default: defaultProp, |
| 476 |
name, |
| 477 |
state = "value" |
| 478 |
}) { |
| 479 |
const { |
| 480 |
current: isControlled |
| 481 |
} = React.useRef(controlled !== void 0); |
| 482 |
const [valueState, setValue] = React.useState(defaultProp); |
| 483 |
const value = isControlled && controlled !== void 0 ? controlled : valueState; |
| 484 |
if (true) { |
| 485 |
React.useEffect(() => { |
| 486 |
if (isControlled !== (controlled !== void 0)) { |
| 487 |
error([`A component is changing the ${isControlled ? "" : "un"}controlled ${state} state of ${name} to be ${isControlled ? "un" : ""}controlled.`, "Elements should not switch from uncontrolled to controlled (or vice versa).", `Decide between using a controlled or uncontrolled ${name} element for the lifetime of the component.`, "The nature of the state is determined during the first render. It's considered controlled if the value is not `undefined`.", "More info: https://fb.me/react-controlled-components"].join("\n")); |
| 488 |
} |
| 489 |
}, [state, name, controlled]); |
| 490 |
const { |
| 491 |
current: defaultValue |
| 492 |
} = React.useRef(defaultProp); |
| 493 |
React.useEffect(() => { |
| 494 |
if (!isControlled && serializeToDevModeString(defaultValue) !== serializeToDevModeString(defaultProp)) { |
| 495 |
error([`A component is changing the default ${state} state of an uncontrolled ${name} after being initialized. To suppress this warning opt to use a controlled ${name}.`].join("\n")); |
| 496 |
} |
| 497 |
}, [defaultProp]); |
| 498 |
} |
| 499 |
const setValueIfUncontrolled = React.useCallback((newValue) => { |
| 500 |
if (!isControlled) { |
| 501 |
setValue(newValue); |
| 502 |
} |
| 503 |
}, []); |
| 504 |
return [value, setValueIfUncontrolled]; |
| 505 |
} |
| 506 |
function serializeToDevModeString(input) { |
| 507 |
let nextId = 0; |
| 508 |
const seen = /* @__PURE__ */ new WeakMap(); |
| 509 |
try { |
| 510 |
const result = JSON.stringify(input, function replacer(key, value) { |
| 511 |
if (key === "_owner" && this != null && typeof this === "object" && "$$typeof" in this) { |
| 512 |
return void 0; |
| 513 |
} |
| 514 |
if (typeof value === "bigint") { |
| 515 |
return `__bigint__:${value}`; |
| 516 |
} |
| 517 |
if (value !== null && typeof value === "object") { |
| 518 |
const id = seen.get(value); |
| 519 |
if (id !== void 0) { |
| 520 |
return `__object__:${id}`; |
| 521 |
} |
| 522 |
seen.set(value, nextId); |
| 523 |
nextId += 1; |
| 524 |
} |
| 525 |
return value; |
| 526 |
}); |
| 527 |
return result ?? `__top__:${typeof input}`; |
| 528 |
} catch { |
| 529 |
return "__unserializable__"; |
| 530 |
} |
| 531 |
} |
| 532 |
|
| 533 |
// node_modules/@base-ui/utils/safeReact.mjs |
| 534 |
var React2 = __toESM(require_react(), 1); |
| 535 |
var SafeReact = { |
| 536 |
...React2 |
| 537 |
}; |
| 538 |
|
| 539 |
// node_modules/@base-ui/utils/useRefWithInit.mjs |
| 540 |
var React3 = __toESM(require_react(), 1); |
| 541 |
var UNINITIALIZED = {}; |
| 542 |
function useRefWithInit(init, initArg) { |
| 543 |
const ref = React3.useRef(UNINITIALIZED); |
| 544 |
if (ref.current === UNINITIALIZED) { |
| 545 |
ref.current = init(initArg); |
| 546 |
} |
| 547 |
return ref; |
| 548 |
} |
| 549 |
|
| 550 |
// node_modules/@base-ui/utils/useStableCallback.mjs |
| 551 |
var useInsertionEffect = SafeReact.useInsertionEffect; |
| 552 |
var useSafeInsertionEffect = ( |
| 553 |
// React 17 doesn't have useInsertionEffect. |
| 554 |
useInsertionEffect && // Preact replaces useInsertionEffect with useLayoutEffect and fires too late. |
| 555 |
useInsertionEffect !== SafeReact.useLayoutEffect ? useInsertionEffect : (fn) => fn() |
| 556 |
); |
| 557 |
function useStableCallback(callback) { |
| 558 |
const stable = useRefWithInit(createStableCallback).current; |
| 559 |
stable.next = callback; |
| 560 |
useSafeInsertionEffect(stable.effect); |
| 561 |
return stable.trampoline; |
| 562 |
} |
| 563 |
function createStableCallback() { |
| 564 |
const stable = { |
| 565 |
next: void 0, |
| 566 |
callback: assertNotCalled, |
| 567 |
trampoline: (...args) => stable.callback?.(...args), |
| 568 |
effect: () => { |
| 569 |
stable.callback = stable.next; |
| 570 |
} |
| 571 |
}; |
| 572 |
return stable; |
| 573 |
} |
| 574 |
function assertNotCalled() { |
| 575 |
if (true) { |
| 576 |
throw ( |
| 577 |
/* minify-error-disabled */ |
| 578 |
new Error("Base UI: Cannot call an event handler while rendering.") |
| 579 |
); |
| 580 |
} |
| 581 |
} |
| 582 |
|
| 583 |
// node_modules/@base-ui/utils/warn.mjs |
| 584 |
var warn = createLogOnce("warn", "Base UI"); |
| 585 |
|
| 586 |
// node_modules/@base-ui/utils/empty.mjs |
| 587 |
function NOOP() { |
| 588 |
} |
| 589 |
var EMPTY_ARRAY = Object.freeze([]); |
| 590 |
var EMPTY_OBJECT = Object.freeze({}); |
| 591 |
|
| 592 |
// node_modules/@base-ui/utils/useIsoLayoutEffect.mjs |
| 593 |
var React4 = __toESM(require_react(), 1); |
| 594 |
var noop = () => { |
| 595 |
}; |
| 596 |
var useIsoLayoutEffect = typeof document !== "undefined" ? React4.useLayoutEffect : noop; |
| 597 |
|
| 598 |
// node_modules/@base-ui/react/internals/useRenderElement.mjs |
| 599 |
var React7 = __toESM(require_react(), 1); |
| 600 |
|
| 601 |
// node_modules/@base-ui/utils/useMergedRefs.mjs |
| 602 |
function useMergedRefs(a, b, c, d) { |
| 603 |
const forkRef = useRefWithInit(createForkRef).current; |
| 604 |
if (didChange(forkRef, a, b, c, d)) { |
| 605 |
update(forkRef, [a, b, c, d]); |
| 606 |
} |
| 607 |
return forkRef.callback; |
| 608 |
} |
| 609 |
function useMergedRefsN(refs) { |
| 610 |
const forkRef = useRefWithInit(createForkRef).current; |
| 611 |
if (didChangeN(forkRef, refs)) { |
| 612 |
update(forkRef, refs); |
| 613 |
} |
| 614 |
return forkRef.callback; |
| 615 |
} |
| 616 |
function createForkRef() { |
| 617 |
return { |
| 618 |
callback: null, |
| 619 |
cleanup: null, |
| 620 |
refs: [] |
| 621 |
}; |
| 622 |
} |
| 623 |
function didChange(forkRef, a, b, c, d) { |
| 624 |
return forkRef.refs[0] !== a || forkRef.refs[1] !== b || forkRef.refs[2] !== c || forkRef.refs[3] !== d; |
| 625 |
} |
| 626 |
function didChangeN(forkRef, newRefs) { |
| 627 |
return forkRef.refs.length !== newRefs.length || forkRef.refs.some((ref, index2) => ref !== newRefs[index2]); |
| 628 |
} |
| 629 |
function update(forkRef, refs) { |
| 630 |
forkRef.refs = refs; |
| 631 |
if (refs.every((ref) => ref == null)) { |
| 632 |
forkRef.callback = null; |
| 633 |
return; |
| 634 |
} |
| 635 |
forkRef.callback = (instance) => { |
| 636 |
if (forkRef.cleanup) { |
| 637 |
forkRef.cleanup(); |
| 638 |
forkRef.cleanup = null; |
| 639 |
} |
| 640 |
if (instance != null) { |
| 641 |
const cleanupCallbacks = Array(refs.length).fill(null); |
| 642 |
for (let i = 0; i < refs.length; i += 1) { |
| 643 |
const ref = refs[i]; |
| 644 |
if (ref == null) { |
| 645 |
continue; |
| 646 |
} |
| 647 |
switch (typeof ref) { |
| 648 |
case "function": { |
| 649 |
const refCleanup = ref(instance); |
| 650 |
if (typeof refCleanup === "function") { |
| 651 |
cleanupCallbacks[i] = refCleanup; |
| 652 |
} |
| 653 |
break; |
| 654 |
} |
| 655 |
case "object": { |
| 656 |
ref.current = instance; |
| 657 |
break; |
| 658 |
} |
| 659 |
default: |
| 660 |
} |
| 661 |
} |
| 662 |
forkRef.cleanup = () => { |
| 663 |
for (let i = 0; i < refs.length; i += 1) { |
| 664 |
const ref = refs[i]; |
| 665 |
if (ref == null) { |
| 666 |
continue; |
| 667 |
} |
| 668 |
switch (typeof ref) { |
| 669 |
case "function": { |
| 670 |
const cleanupCallback = cleanupCallbacks[i]; |
| 671 |
if (typeof cleanupCallback === "function") { |
| 672 |
cleanupCallback(); |
| 673 |
} else { |
| 674 |
void ref(null); |
| 675 |
} |
| 676 |
break; |
| 677 |
} |
| 678 |
case "object": { |
| 679 |
ref.current = null; |
| 680 |
break; |
| 681 |
} |
| 682 |
default: |
| 683 |
} |
| 684 |
} |
| 685 |
}; |
| 686 |
} |
| 687 |
}; |
| 688 |
} |
| 689 |
|
| 690 |
// node_modules/@base-ui/utils/getReactElementRef.mjs |
| 691 |
var React6 = __toESM(require_react(), 1); |
| 692 |
|
| 693 |
// node_modules/@base-ui/utils/reactVersion.mjs |
| 694 |
var React5 = __toESM(require_react(), 1); |
| 695 |
var majorVersion = parseInt(React5.version, 10); |
| 696 |
function isReactVersionAtLeast(reactVersionToCheck) { |
| 697 |
return majorVersion >= reactVersionToCheck; |
| 698 |
} |
| 699 |
|
| 700 |
// node_modules/@base-ui/utils/getReactElementRef.mjs |
| 701 |
function getReactElementRef(element) { |
| 702 |
if (!/* @__PURE__ */ React6.isValidElement(element)) { |
| 703 |
return null; |
| 704 |
} |
| 705 |
const reactElement = element; |
| 706 |
const propsWithRef = reactElement.props; |
| 707 |
return (isReactVersionAtLeast(19) ? propsWithRef?.ref : reactElement.ref) ?? null; |
| 708 |
} |
| 709 |
|
| 710 |
// node_modules/@base-ui/utils/mergeObjects.mjs |
| 711 |
function mergeObjects(a, b) { |
| 712 |
if (a && !b) { |
| 713 |
return a; |
| 714 |
} |
| 715 |
if (!a && b) { |
| 716 |
return b; |
| 717 |
} |
| 718 |
if (a || b) { |
| 719 |
return { |
| 720 |
...a, |
| 721 |
...b |
| 722 |
}; |
| 723 |
} |
| 724 |
return void 0; |
| 725 |
} |
| 726 |
|
| 727 |
// node_modules/@base-ui/react/internals/getStateAttributesProps.mjs |
| 728 |
function getStateAttributesProps(state, customMapping) { |
| 729 |
const props = {}; |
| 730 |
for (const key in state) { |
| 731 |
const value = state[key]; |
| 732 |
if (customMapping?.hasOwnProperty(key)) { |
| 733 |
const customProps = customMapping[key](value); |
| 734 |
if (customProps != null) { |
| 735 |
Object.assign(props, customProps); |
| 736 |
} |
| 737 |
continue; |
| 738 |
} |
| 739 |
if (value === true) { |
| 740 |
props[`data-${key.toLowerCase()}`] = ""; |
| 741 |
} else if (value) { |
| 742 |
props[`data-${key.toLowerCase()}`] = value.toString(); |
| 743 |
} |
| 744 |
} |
| 745 |
return props; |
| 746 |
} |
| 747 |
|
| 748 |
// node_modules/@base-ui/react/utils/resolveClassName.mjs |
| 749 |
function resolveClassName(className, state) { |
| 750 |
return typeof className === "function" ? className(state) : className; |
| 751 |
} |
| 752 |
|
| 753 |
// node_modules/@base-ui/react/utils/resolveStyle.mjs |
| 754 |
function resolveStyle(style, state) { |
| 755 |
return typeof style === "function" ? style(state) : style; |
| 756 |
} |
| 757 |
|
| 758 |
// node_modules/@base-ui/react/merge-props/mergeProps.mjs |
| 759 |
var EMPTY_PROPS = {}; |
| 760 |
function mergeProps(a, b, c, d, e) { |
| 761 |
if (!c && !d && !e && !a) { |
| 762 |
return createInitialMergedProps(b); |
| 763 |
} |
| 764 |
let merged = createInitialMergedProps(a); |
| 765 |
if (b) { |
| 766 |
merged = mergeInto(merged, b); |
| 767 |
} |
| 768 |
if (c) { |
| 769 |
merged = mergeInto(merged, c); |
| 770 |
} |
| 771 |
if (d) { |
| 772 |
merged = mergeInto(merged, d); |
| 773 |
} |
| 774 |
if (e) { |
| 775 |
merged = mergeInto(merged, e); |
| 776 |
} |
| 777 |
return merged; |
| 778 |
} |
| 779 |
function mergePropsN(props) { |
| 780 |
if (props.length === 0) { |
| 781 |
return EMPTY_PROPS; |
| 782 |
} |
| 783 |
if (props.length === 1) { |
| 784 |
return createInitialMergedProps(props[0]); |
| 785 |
} |
| 786 |
let merged = createInitialMergedProps(props[0]); |
| 787 |
for (let i = 1; i < props.length; i += 1) { |
| 788 |
merged = mergeInto(merged, props[i]); |
| 789 |
} |
| 790 |
return merged; |
| 791 |
} |
| 792 |
function createInitialMergedProps(inputProps) { |
| 793 |
if (isPropsGetter(inputProps)) { |
| 794 |
return { |
| 795 |
...resolvePropsGetter(inputProps, EMPTY_PROPS) |
| 796 |
}; |
| 797 |
} |
| 798 |
return copyInitialProps(inputProps); |
| 799 |
} |
| 800 |
function mergeInto(merged, inputProps) { |
| 801 |
if (isPropsGetter(inputProps)) { |
| 802 |
return resolvePropsGetter(inputProps, merged); |
| 803 |
} |
| 804 |
return mutablyMergeInto(merged, inputProps); |
| 805 |
} |
| 806 |
function copyInitialProps(inputProps) { |
| 807 |
const copiedProps = { |
| 808 |
...inputProps |
| 809 |
}; |
| 810 |
for (const propName in copiedProps) { |
| 811 |
const propValue = copiedProps[propName]; |
| 812 |
if (isEventHandler(propName, propValue)) { |
| 813 |
copiedProps[propName] = wrapEventHandler(propValue); |
| 814 |
} |
| 815 |
} |
| 816 |
return copiedProps; |
| 817 |
} |
| 818 |
function mutablyMergeInto(mergedProps, externalProps) { |
| 819 |
if (!externalProps) { |
| 820 |
return mergedProps; |
| 821 |
} |
| 822 |
for (const propName in externalProps) { |
| 823 |
const externalPropValue = externalProps[propName]; |
| 824 |
switch (propName) { |
| 825 |
case "style": { |
| 826 |
mergedProps[propName] = mergeObjects(mergedProps.style, externalPropValue); |
| 827 |
break; |
| 828 |
} |
| 829 |
case "className": { |
| 830 |
mergedProps[propName] = mergeClassNames(mergedProps.className, externalPropValue); |
| 831 |
break; |
| 832 |
} |
| 833 |
default: { |
| 834 |
if (isEventHandler(propName, externalPropValue)) { |
| 835 |
mergedProps[propName] = mergeEventHandlers(mergedProps[propName], externalPropValue); |
| 836 |
} else { |
| 837 |
mergedProps[propName] = externalPropValue; |
| 838 |
} |
| 839 |
} |
| 840 |
} |
| 841 |
} |
| 842 |
return mergedProps; |
| 843 |
} |
| 844 |
function isEventHandler(key, value) { |
| 845 |
const code0 = key.charCodeAt(0); |
| 846 |
const code1 = key.charCodeAt(1); |
| 847 |
const code2 = key.charCodeAt(2); |
| 848 |
return code0 === 111 && code1 === 110 && code2 >= 65 && code2 <= 90 && (typeof value === "function" || typeof value === "undefined"); |
| 849 |
} |
| 850 |
function isPropsGetter(inputProps) { |
| 851 |
return typeof inputProps === "function"; |
| 852 |
} |
| 853 |
function resolvePropsGetter(inputProps, previousProps) { |
| 854 |
if (isPropsGetter(inputProps)) { |
| 855 |
return inputProps(previousProps); |
| 856 |
} |
| 857 |
return inputProps ?? EMPTY_PROPS; |
| 858 |
} |
| 859 |
function mergeEventHandlers(ourHandler, theirHandler) { |
| 860 |
if (!theirHandler) { |
| 861 |
return ourHandler; |
| 862 |
} |
| 863 |
if (!ourHandler) { |
| 864 |
return wrapEventHandler(theirHandler); |
| 865 |
} |
| 866 |
return (...args) => { |
| 867 |
const event = args[0]; |
| 868 |
if (isSyntheticEvent(event)) { |
| 869 |
const baseUIEvent = event; |
| 870 |
makeEventPreventable(baseUIEvent); |
| 871 |
const result2 = theirHandler(...args); |
| 872 |
if (!baseUIEvent.baseUIHandlerPrevented) { |
| 873 |
ourHandler?.(...args); |
| 874 |
} |
| 875 |
return result2; |
| 876 |
} |
| 877 |
const result = theirHandler(...args); |
| 878 |
ourHandler?.(...args); |
| 879 |
return result; |
| 880 |
}; |
| 881 |
} |
| 882 |
function wrapEventHandler(handler) { |
| 883 |
if (!handler) { |
| 884 |
return handler; |
| 885 |
} |
| 886 |
return (...args) => { |
| 887 |
const event = args[0]; |
| 888 |
if (isSyntheticEvent(event)) { |
| 889 |
makeEventPreventable(event); |
| 890 |
} |
| 891 |
return handler(...args); |
| 892 |
}; |
| 893 |
} |
| 894 |
function makeEventPreventable(event) { |
| 895 |
event.preventBaseUIHandler = () => { |
| 896 |
event.baseUIHandlerPrevented = true; |
| 897 |
}; |
| 898 |
return event; |
| 899 |
} |
| 900 |
function mergeClassNames(ourClassName, theirClassName) { |
| 901 |
if (theirClassName) { |
| 902 |
if (ourClassName) { |
| 903 |
return theirClassName + " " + ourClassName; |
| 904 |
} |
| 905 |
return theirClassName; |
| 906 |
} |
| 907 |
return ourClassName; |
| 908 |
} |
| 909 |
function isSyntheticEvent(event) { |
| 910 |
return event != null && typeof event === "object" && "nativeEvent" in event; |
| 911 |
} |
| 912 |
|
| 913 |
// node_modules/@base-ui/react/internals/useRenderElement.mjs |
| 914 |
var import_react = __toESM(require_react(), 1); |
| 915 |
function useRenderElement(element, componentProps, params = {}) { |
| 916 |
let renderProp = componentProps.render; |
| 917 |
if (params.enabled !== false) { |
| 918 |
renderProp = unwrapLazyRenderProp(renderProp); |
| 919 |
} |
| 920 |
const outProps = useRenderElementProps(componentProps, params, renderProp); |
| 921 |
if (params.enabled === false) { |
| 922 |
return null; |
| 923 |
} |
| 924 |
const state = params.state ?? EMPTY_OBJECT; |
| 925 |
return evaluateRenderProp(element, renderProp, outProps, state); |
| 926 |
} |
| 927 |
function useRenderElementProps(componentProps, params, renderProp) { |
| 928 |
const { |
| 929 |
className: classNameProp, |
| 930 |
style: styleProp |
| 931 |
} = componentProps; |
| 932 |
const { |
| 933 |
state = EMPTY_OBJECT, |
| 934 |
ref, |
| 935 |
props, |
| 936 |
stateAttributesMapping: stateAttributesMapping2, |
| 937 |
enabled = true |
| 938 |
} = params; |
| 939 |
const className = enabled ? resolveClassName(classNameProp, state) : void 0; |
| 940 |
const style = enabled ? resolveStyle(styleProp, state) : void 0; |
| 941 |
const stateProps = enabled ? getStateAttributesProps(state, stateAttributesMapping2) : EMPTY_OBJECT; |
| 942 |
const resolvedProps = enabled && props ? resolveRenderFunctionProps(props) : void 0; |
| 943 |
const outProps = enabled ? mergeObjects(stateProps, resolvedProps) ?? {} : EMPTY_OBJECT; |
| 944 |
if (typeof document !== "undefined") { |
| 945 |
if (!enabled) { |
| 946 |
void useMergedRefs(null, null); |
| 947 |
} else if (Array.isArray(ref)) { |
| 948 |
outProps.ref = useMergedRefsN([outProps.ref, getReactElementRef(renderProp), ...ref]); |
| 949 |
} else { |
| 950 |
outProps.ref = useMergedRefs(outProps.ref, getReactElementRef(renderProp), ref); |
| 951 |
} |
| 952 |
} |
| 953 |
if (!enabled) { |
| 954 |
return EMPTY_OBJECT; |
| 955 |
} |
| 956 |
if (className !== void 0) { |
| 957 |
outProps.className = mergeClassNames(outProps.className, className); |
| 958 |
} |
| 959 |
if (style !== void 0) { |
| 960 |
outProps.style = mergeObjects(outProps.style, style); |
| 961 |
} |
| 962 |
return outProps; |
| 963 |
} |
| 964 |
function resolveRenderFunctionProps(props) { |
| 965 |
if (Array.isArray(props)) { |
| 966 |
return mergePropsN(props); |
| 967 |
} |
| 968 |
return mergeProps(void 0, props); |
| 969 |
} |
| 970 |
var REACT_LAZY_TYPE = /* @__PURE__ */ Symbol.for("react.lazy"); |
| 971 |
var COMPONENT_IDENTIFIER_PATTERN = /^[A-Z][A-Za-z0-9$]*$/; |
| 972 |
var LOWERCASE_CHARACTER_PATTERN = /[a-z]/; |
| 973 |
function unwrapLazyRenderProp(render) { |
| 974 |
if (render?.$$typeof !== REACT_LAZY_TYPE) { |
| 975 |
return render; |
| 976 |
} |
| 977 |
const unwrapped = React7.Children.toArray(render)[0]; |
| 978 |
return /* @__PURE__ */ React7.isValidElement(unwrapped) ? unwrapped : render; |
| 979 |
} |
| 980 |
function evaluateRenderProp(element, render, props, state) { |
| 981 |
if (render) { |
| 982 |
if (typeof render === "function") { |
| 983 |
if (true) { |
| 984 |
warnIfRenderPropLooksLikeComponent(render); |
| 985 |
} |
| 986 |
return render(props, state); |
| 987 |
} |
| 988 |
const mergedProps = mergeProps(props, render.props); |
| 989 |
mergedProps.ref = props.ref; |
| 990 |
if (true) { |
| 991 |
if (!/* @__PURE__ */ React7.isValidElement(render)) { |
| 992 |
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")); |
| 993 |
} |
| 994 |
} |
| 995 |
return /* @__PURE__ */ React7.cloneElement(render, mergedProps); |
| 996 |
} |
| 997 |
if (element) { |
| 998 |
if (typeof element === "string") { |
| 999 |
return renderTag(element, props); |
| 1000 |
} |
| 1001 |
} |
| 1002 |
throw new Error(true ? "Base UI: Render element or function are not defined." : formatErrorMessage_default(8)); |
| 1003 |
} |
| 1004 |
function warnIfRenderPropLooksLikeComponent(renderFn) { |
| 1005 |
const functionName = renderFn.name; |
| 1006 |
if (functionName.length === 0) { |
| 1007 |
return; |
| 1008 |
} |
| 1009 |
if (!COMPONENT_IDENTIFIER_PATTERN.test(functionName)) { |
| 1010 |
return; |
| 1011 |
} |
| 1012 |
if (!LOWERCASE_CHARACTER_PATTERN.test(functionName)) { |
| 1013 |
return; |
| 1014 |
} |
| 1015 |
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"); |
| 1016 |
} |
| 1017 |
function renderTag(Tag, props) { |
| 1018 |
if (Tag === "button") { |
| 1019 |
return /* @__PURE__ */ (0, import_react.createElement)("button", { |
| 1020 |
type: "button", |
| 1021 |
...props, |
| 1022 |
key: props.key |
| 1023 |
}); |
| 1024 |
} |
| 1025 |
if (Tag === "img") { |
| 1026 |
return /* @__PURE__ */ (0, import_react.createElement)("img", { |
| 1027 |
alt: "", |
| 1028 |
...props, |
| 1029 |
key: props.key |
| 1030 |
}); |
| 1031 |
} |
| 1032 |
return /* @__PURE__ */ React7.createElement(Tag, props); |
| 1033 |
} |
| 1034 |
|
| 1035 |
// node_modules/@base-ui/utils/useId.mjs |
| 1036 |
var React8 = __toESM(require_react(), 1); |
| 1037 |
var globalId = 0; |
| 1038 |
function useGlobalId(idOverride, prefix = "mui") { |
| 1039 |
const [defaultId, setDefaultId] = React8.useState(idOverride); |
| 1040 |
const id = idOverride || defaultId; |
| 1041 |
React8.useEffect(() => { |
| 1042 |
if (defaultId == null) { |
| 1043 |
globalId += 1; |
| 1044 |
setDefaultId(`${prefix}-${globalId}`); |
| 1045 |
} |
| 1046 |
}, [defaultId, prefix]); |
| 1047 |
return id; |
| 1048 |
} |
| 1049 |
var maybeReactUseId = SafeReact.useId; |
| 1050 |
function useId(idOverride, prefix) { |
| 1051 |
if (maybeReactUseId !== void 0) { |
| 1052 |
const reactId = maybeReactUseId(); |
| 1053 |
return idOverride ?? (prefix ? `${prefix}-${reactId}` : reactId); |
| 1054 |
} |
| 1055 |
return useGlobalId(idOverride, prefix); |
| 1056 |
} |
| 1057 |
|
| 1058 |
// node_modules/@base-ui/react/internals/useBaseUiId.mjs |
| 1059 |
function useBaseUiId(idOverride) { |
| 1060 |
return useId(idOverride, "base-ui"); |
| 1061 |
} |
| 1062 |
|
| 1063 |
// node_modules/@base-ui/react/collapsible/root/useCollapsibleRoot.mjs |
| 1064 |
var React11 = __toESM(require_react(), 1); |
| 1065 |
|
| 1066 |
// node_modules/@base-ui/react/internals/reason-parts.mjs |
| 1067 |
var reason_parts_exports = {}; |
| 1068 |
__export(reason_parts_exports, { |
| 1069 |
cancelOpen: () => cancelOpen, |
| 1070 |
chipRemovePress: () => chipRemovePress, |
| 1071 |
clearPress: () => clearPress, |
| 1072 |
closePress: () => closePress, |
| 1073 |
closeWatcher: () => closeWatcher, |
| 1074 |
decrementPress: () => decrementPress, |
| 1075 |
disabled: () => disabled, |
| 1076 |
drag: () => drag, |
| 1077 |
escapeKey: () => escapeKey, |
| 1078 |
focusOut: () => focusOut, |
| 1079 |
imperativeAction: () => imperativeAction, |
| 1080 |
incrementPress: () => incrementPress, |
| 1081 |
initial: () => initial, |
| 1082 |
inputBlur: () => inputBlur, |
| 1083 |
inputChange: () => inputChange, |
| 1084 |
inputClear: () => inputClear, |
| 1085 |
inputPaste: () => inputPaste, |
| 1086 |
inputPress: () => inputPress, |
| 1087 |
itemPress: () => itemPress, |
| 1088 |
keyboard: () => keyboard, |
| 1089 |
linkPress: () => linkPress, |
| 1090 |
listNavigation: () => listNavigation, |
| 1091 |
missing: () => missing, |
| 1092 |
none: () => none, |
| 1093 |
outsidePress: () => outsidePress, |
| 1094 |
pointer: () => pointer, |
| 1095 |
scrub: () => scrub, |
| 1096 |
siblingOpen: () => siblingOpen, |
| 1097 |
swipe: () => swipe, |
| 1098 |
trackPress: () => trackPress, |
| 1099 |
triggerFocus: () => triggerFocus, |
| 1100 |
triggerHover: () => triggerHover, |
| 1101 |
triggerPress: () => triggerPress, |
| 1102 |
wheel: () => wheel, |
| 1103 |
windowResize: () => windowResize |
| 1104 |
}); |
| 1105 |
var none = "none"; |
| 1106 |
var triggerPress = "trigger-press"; |
| 1107 |
var triggerHover = "trigger-hover"; |
| 1108 |
var triggerFocus = "trigger-focus"; |
| 1109 |
var outsidePress = "outside-press"; |
| 1110 |
var itemPress = "item-press"; |
| 1111 |
var closePress = "close-press"; |
| 1112 |
var linkPress = "link-press"; |
| 1113 |
var clearPress = "clear-press"; |
| 1114 |
var chipRemovePress = "chip-remove-press"; |
| 1115 |
var trackPress = "track-press"; |
| 1116 |
var incrementPress = "increment-press"; |
| 1117 |
var decrementPress = "decrement-press"; |
| 1118 |
var inputChange = "input-change"; |
| 1119 |
var inputClear = "input-clear"; |
| 1120 |
var inputBlur = "input-blur"; |
| 1121 |
var inputPaste = "input-paste"; |
| 1122 |
var inputPress = "input-press"; |
| 1123 |
var focusOut = "focus-out"; |
| 1124 |
var escapeKey = "escape-key"; |
| 1125 |
var closeWatcher = "close-watcher"; |
| 1126 |
var listNavigation = "list-navigation"; |
| 1127 |
var keyboard = "keyboard"; |
| 1128 |
var pointer = "pointer"; |
| 1129 |
var drag = "drag"; |
| 1130 |
var wheel = "wheel"; |
| 1131 |
var scrub = "scrub"; |
| 1132 |
var cancelOpen = "cancel-open"; |
| 1133 |
var siblingOpen = "sibling-open"; |
| 1134 |
var disabled = "disabled"; |
| 1135 |
var missing = "missing"; |
| 1136 |
var initial = "initial"; |
| 1137 |
var imperativeAction = "imperative-action"; |
| 1138 |
var swipe = "swipe"; |
| 1139 |
var windowResize = "window-resize"; |
| 1140 |
|
| 1141 |
// node_modules/@base-ui/react/internals/createBaseUIEventDetails.mjs |
| 1142 |
function createChangeEventDetails(reason, event, trigger, customProperties) { |
| 1143 |
let canceled = false; |
| 1144 |
let allowPropagation = false; |
| 1145 |
const custom = customProperties ?? EMPTY_OBJECT; |
| 1146 |
const details = { |
| 1147 |
reason, |
| 1148 |
event: event ?? new Event("base-ui"), |
| 1149 |
cancel() { |
| 1150 |
canceled = true; |
| 1151 |
}, |
| 1152 |
allowPropagation() { |
| 1153 |
allowPropagation = true; |
| 1154 |
}, |
| 1155 |
get isCanceled() { |
| 1156 |
return canceled; |
| 1157 |
}, |
| 1158 |
get isPropagationAllowed() { |
| 1159 |
return allowPropagation; |
| 1160 |
}, |
| 1161 |
trigger, |
| 1162 |
...custom |
| 1163 |
}; |
| 1164 |
return details; |
| 1165 |
} |
| 1166 |
|
| 1167 |
// node_modules/@base-ui/react/internals/useTransitionStatus.mjs |
| 1168 |
var React10 = __toESM(require_react(), 1); |
| 1169 |
|
| 1170 |
// node_modules/@base-ui/utils/useOnMount.mjs |
| 1171 |
var React9 = __toESM(require_react(), 1); |
| 1172 |
function useOnMount(fn) { |
| 1173 |
React9.useEffect(fn, EMPTY_ARRAY); |
| 1174 |
} |
| 1175 |
|
| 1176 |
// node_modules/@base-ui/utils/useAnimationFrame.mjs |
| 1177 |
var EMPTY = null; |
| 1178 |
var LAST_RAF = globalThis.requestAnimationFrame; |
| 1179 |
var Scheduler = class { |
| 1180 |
/* This implementation uses an array as a backing data-structure for frame callbacks. |
| 1181 |
* It allows `O(1)` callback cancelling by inserting a `null` in the array, though it |
| 1182 |
* never calls the native `cancelAnimationFrame` if there are no frames left. This can |
| 1183 |
* be much more efficient if there is a call pattern that alterns as |
| 1184 |
* "request-cancel-request-cancel-…". |
| 1185 |
* But in the case of "request-request-…-cancel-cancel-…", it leaves the final animation |
| 1186 |
* frame to run anyway. We turn that frame into a `O(1)` no-op via `callbacksCount`. */ |
| 1187 |
callbacks = []; |
| 1188 |
callbacksCount = 0; |
| 1189 |
nextId = 1; |
| 1190 |
startId = 1; |
| 1191 |
isScheduled = false; |
| 1192 |
tick = (timestamp) => { |
| 1193 |
this.isScheduled = false; |
| 1194 |
const currentCallbacks = this.callbacks; |
| 1195 |
const currentCallbacksCount = this.callbacksCount; |
| 1196 |
this.callbacks = []; |
| 1197 |
this.callbacksCount = 0; |
| 1198 |
this.startId = this.nextId; |
| 1199 |
if (currentCallbacksCount > 0) { |
| 1200 |
for (let i = 0; i < currentCallbacks.length; i += 1) { |
| 1201 |
currentCallbacks[i]?.(timestamp); |
| 1202 |
} |
| 1203 |
} |
| 1204 |
}; |
| 1205 |
request(fn) { |
| 1206 |
const id = this.nextId; |
| 1207 |
this.nextId += 1; |
| 1208 |
this.callbacks.push(fn); |
| 1209 |
this.callbacksCount += 1; |
| 1210 |
const didRAFChange = LAST_RAF !== requestAnimationFrame && (LAST_RAF = requestAnimationFrame, true); |
| 1211 |
if (!this.isScheduled || didRAFChange) { |
| 1212 |
requestAnimationFrame(this.tick); |
| 1213 |
this.isScheduled = true; |
| 1214 |
} |
| 1215 |
return id; |
| 1216 |
} |
| 1217 |
cancel(id) { |
| 1218 |
const index2 = id - this.startId; |
| 1219 |
if (index2 < 0 || index2 >= this.callbacks.length) { |
| 1220 |
return; |
| 1221 |
} |
| 1222 |
if (this.callbacks[index2] === null) { |
| 1223 |
return; |
| 1224 |
} |
| 1225 |
this.callbacks[index2] = null; |
| 1226 |
this.callbacksCount -= 1; |
| 1227 |
} |
| 1228 |
}; |
| 1229 |
var scheduler = new Scheduler(); |
| 1230 |
var AnimationFrame = class _AnimationFrame { |
| 1231 |
static create() { |
| 1232 |
return new _AnimationFrame(); |
| 1233 |
} |
| 1234 |
static request(fn) { |
| 1235 |
return scheduler.request(fn); |
| 1236 |
} |
| 1237 |
static cancel(id) { |
| 1238 |
return scheduler.cancel(id); |
| 1239 |
} |
| 1240 |
currentId = EMPTY; |
| 1241 |
/** |
| 1242 |
* Executes `fn` after `delay`, clearing any previously scheduled call. |
| 1243 |
*/ |
| 1244 |
request(fn) { |
| 1245 |
this.cancel(); |
| 1246 |
this.currentId = scheduler.request(() => { |
| 1247 |
this.currentId = EMPTY; |
| 1248 |
fn(); |
| 1249 |
}); |
| 1250 |
} |
| 1251 |
cancel = () => { |
| 1252 |
if (this.currentId !== EMPTY) { |
| 1253 |
scheduler.cancel(this.currentId); |
| 1254 |
this.currentId = EMPTY; |
| 1255 |
} |
| 1256 |
}; |
| 1257 |
disposeEffect = () => { |
| 1258 |
return this.cancel; |
| 1259 |
}; |
| 1260 |
}; |
| 1261 |
function useAnimationFrame() { |
| 1262 |
const timeout = useRefWithInit(AnimationFrame.create).current; |
| 1263 |
useOnMount(timeout.disposeEffect); |
| 1264 |
return timeout; |
| 1265 |
} |
| 1266 |
|
| 1267 |
// node_modules/@base-ui/react/internals/useTransitionStatus.mjs |
| 1268 |
function useTransitionStatus(open3, enableIdleState = false, deferEndingState = false, animateInitialOpen = false) { |
| 1269 |
const [transitionStatus, setTransitionStatus] = React10.useState(open3 && enableIdleState ? "idle" : void 0); |
| 1270 |
const [mounted, setMounted] = React10.useState(open3 && !animateInitialOpen); |
| 1271 |
if (open3 && !mounted) { |
| 1272 |
setMounted(true); |
| 1273 |
setTransitionStatus("starting"); |
| 1274 |
} |
| 1275 |
if (!open3 && mounted && transitionStatus !== "ending" && !deferEndingState) { |
| 1276 |
setTransitionStatus("ending"); |
| 1277 |
} |
| 1278 |
if (!open3 && !mounted && transitionStatus === "ending") { |
| 1279 |
setTransitionStatus(void 0); |
| 1280 |
} |
| 1281 |
useIsoLayoutEffect(() => { |
| 1282 |
if (!open3 && mounted && transitionStatus !== "ending" && deferEndingState) { |
| 1283 |
const frame = AnimationFrame.request(() => { |
| 1284 |
setTransitionStatus("ending"); |
| 1285 |
}); |
| 1286 |
return () => { |
| 1287 |
AnimationFrame.cancel(frame); |
| 1288 |
}; |
| 1289 |
} |
| 1290 |
return void 0; |
| 1291 |
}, [open3, mounted, transitionStatus, deferEndingState]); |
| 1292 |
useIsoLayoutEffect(() => { |
| 1293 |
if (!open3 || enableIdleState) { |
| 1294 |
return void 0; |
| 1295 |
} |
| 1296 |
const frame = AnimationFrame.request(() => { |
| 1297 |
setTransitionStatus(void 0); |
| 1298 |
}); |
| 1299 |
return () => { |
| 1300 |
AnimationFrame.cancel(frame); |
| 1301 |
}; |
| 1302 |
}, [enableIdleState, open3]); |
| 1303 |
useIsoLayoutEffect(() => { |
| 1304 |
if (!open3 || !enableIdleState) { |
| 1305 |
return void 0; |
| 1306 |
} |
| 1307 |
if (open3 && mounted && transitionStatus !== "idle") { |
| 1308 |
setTransitionStatus("starting"); |
| 1309 |
} |
| 1310 |
const frame = AnimationFrame.request(() => { |
| 1311 |
setTransitionStatus("idle"); |
| 1312 |
}); |
| 1313 |
return () => { |
| 1314 |
AnimationFrame.cancel(frame); |
| 1315 |
}; |
| 1316 |
}, [enableIdleState, open3, mounted, transitionStatus]); |
| 1317 |
return { |
| 1318 |
mounted, |
| 1319 |
setMounted, |
| 1320 |
transitionStatus |
| 1321 |
}; |
| 1322 |
} |
| 1323 |
|
| 1324 |
// node_modules/@base-ui/react/collapsible/root/useCollapsibleRoot.mjs |
| 1325 |
function useCollapsibleRoot(parameters) { |
| 1326 |
const { |
| 1327 |
open: openParam, |
| 1328 |
defaultOpen = false, |
| 1329 |
onOpenChange, |
| 1330 |
disabled: disabled2 |
| 1331 |
} = parameters; |
| 1332 |
const [open3, setOpen] = useControlled({ |
| 1333 |
controlled: openParam, |
| 1334 |
default: defaultOpen, |
| 1335 |
name: "Collapsible", |
| 1336 |
state: "open" |
| 1337 |
}); |
| 1338 |
const { |
| 1339 |
mounted, |
| 1340 |
setMounted, |
| 1341 |
transitionStatus |
| 1342 |
} = useTransitionStatus(open3, true, true); |
| 1343 |
const defaultPanelId = useBaseUiId(); |
| 1344 |
const [registeredPanelId, setPanelIdState] = React11.useState(); |
| 1345 |
const panelId = registeredPanelId === null ? void 0 : registeredPanelId ?? defaultPanelId; |
| 1346 |
const handleTrigger = useStableCallback((event) => { |
| 1347 |
const nextOpen = !open3; |
| 1348 |
const eventDetails = createChangeEventDetails(reason_parts_exports.triggerPress, event.nativeEvent); |
| 1349 |
onOpenChange(nextOpen, eventDetails); |
| 1350 |
if (eventDetails.isCanceled) { |
| 1351 |
return; |
| 1352 |
} |
| 1353 |
setOpen(nextOpen); |
| 1354 |
}); |
| 1355 |
return React11.useMemo(() => ({ |
| 1356 |
defaultPanelId, |
| 1357 |
disabled: disabled2, |
| 1358 |
handleTrigger, |
| 1359 |
mounted, |
| 1360 |
open: open3, |
| 1361 |
panelId, |
| 1362 |
setMounted, |
| 1363 |
setOpen, |
| 1364 |
setPanelIdState, |
| 1365 |
transitionStatus |
| 1366 |
}), [defaultPanelId, disabled2, handleTrigger, mounted, open3, panelId, setMounted, setOpen, setPanelIdState, transitionStatus]); |
| 1367 |
} |
| 1368 |
|
| 1369 |
// node_modules/@base-ui/react/collapsible/root/CollapsibleRootContext.mjs |
| 1370 |
var React12 = __toESM(require_react(), 1); |
| 1371 |
var CollapsibleRootContext = /* @__PURE__ */ React12.createContext(void 0); |
| 1372 |
if (true) CollapsibleRootContext.displayName = "CollapsibleRootContext"; |
| 1373 |
function useCollapsibleRootContext() { |
| 1374 |
const context = React12.useContext(CollapsibleRootContext); |
| 1375 |
if (context === void 0) { |
| 1376 |
throw new Error(true ? "Base UI: CollapsibleRootContext is missing. Collapsible parts must be placed within <Collapsible.Root>." : formatErrorMessage_default(15)); |
| 1377 |
} |
| 1378 |
return context; |
| 1379 |
} |
| 1380 |
|
| 1381 |
// node_modules/@base-ui/react/internals/TransitionStatusDataAttributes.mjs |
| 1382 |
var TransitionStatusDataAttributes_exports = {}; |
| 1383 |
__export(TransitionStatusDataAttributes_exports, { |
| 1384 |
endingStyle: () => endingStyle, |
| 1385 |
startingStyle: () => startingStyle |
| 1386 |
}); |
| 1387 |
var startingStyle = "data-starting-style"; |
| 1388 |
var endingStyle = "data-ending-style"; |
| 1389 |
|
| 1390 |
// node_modules/@base-ui/react/internals/stateAttributesMapping.mjs |
| 1391 |
var STARTING_HOOK = { |
| 1392 |
[startingStyle]: "" |
| 1393 |
}; |
| 1394 |
var ENDING_HOOK = { |
| 1395 |
[endingStyle]: "" |
| 1396 |
}; |
| 1397 |
var transitionStatusMapping = { |
| 1398 |
transitionStatus(value) { |
| 1399 |
if (value === "starting") { |
| 1400 |
return STARTING_HOOK; |
| 1401 |
} |
| 1402 |
if (value === "ending") { |
| 1403 |
return ENDING_HOOK; |
| 1404 |
} |
| 1405 |
return null; |
| 1406 |
} |
| 1407 |
}; |
| 1408 |
|
| 1409 |
// node_modules/@base-ui/react/collapsible/panel/CollapsiblePanelDataAttributes.mjs |
| 1410 |
var open = "data-open"; |
| 1411 |
var closed = "data-closed"; |
| 1412 |
var startingStyle2 = TransitionStatusDataAttributes_exports.startingStyle; |
| 1413 |
var endingStyle2 = TransitionStatusDataAttributes_exports.endingStyle; |
| 1414 |
|
| 1415 |
// node_modules/@base-ui/react/collapsible/trigger/CollapsibleTriggerDataAttributes.mjs |
| 1416 |
var panelOpen = "data-panel-open"; |
| 1417 |
|
| 1418 |
// node_modules/@base-ui/react/utils/collapsibleOpenStateMapping.mjs |
| 1419 |
var PANEL_OPEN_HOOK = { |
| 1420 |
[open]: "" |
| 1421 |
}; |
| 1422 |
var PANEL_CLOSED_HOOK = { |
| 1423 |
[closed]: "" |
| 1424 |
}; |
| 1425 |
var triggerOpenStateMapping = { |
| 1426 |
open(value) { |
| 1427 |
if (value) { |
| 1428 |
return { |
| 1429 |
[panelOpen]: "" |
| 1430 |
}; |
| 1431 |
} |
| 1432 |
return null; |
| 1433 |
} |
| 1434 |
}; |
| 1435 |
var collapsibleOpenStateMapping = { |
| 1436 |
open(value) { |
| 1437 |
if (value) { |
| 1438 |
return PANEL_OPEN_HOOK; |
| 1439 |
} |
| 1440 |
return PANEL_CLOSED_HOOK; |
| 1441 |
} |
| 1442 |
}; |
| 1443 |
|
| 1444 |
// node_modules/@base-ui/react/internals/use-button/useButton.mjs |
| 1445 |
var React15 = __toESM(require_react(), 1); |
| 1446 |
|
| 1447 |
// node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.mjs |
| 1448 |
function hasWindow() { |
| 1449 |
return typeof window !== "undefined"; |
| 1450 |
} |
| 1451 |
function getNodeName(node) { |
| 1452 |
if (isNode(node)) { |
| 1453 |
return (node.nodeName || "").toLowerCase(); |
| 1454 |
} |
| 1455 |
return "#document"; |
| 1456 |
} |
| 1457 |
function getWindow(node) { |
| 1458 |
var _node$ownerDocument; |
| 1459 |
return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window; |
| 1460 |
} |
| 1461 |
function getDocumentElement(node) { |
| 1462 |
var _ref; |
| 1463 |
return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement; |
| 1464 |
} |
| 1465 |
function isNode(value) { |
| 1466 |
if (!hasWindow()) { |
| 1467 |
return false; |
| 1468 |
} |
| 1469 |
return value instanceof Node || value instanceof getWindow(value).Node; |
| 1470 |
} |
| 1471 |
function isElement(value) { |
| 1472 |
if (!hasWindow()) { |
| 1473 |
return false; |
| 1474 |
} |
| 1475 |
return value instanceof Element || value instanceof getWindow(value).Element; |
| 1476 |
} |
| 1477 |
function isHTMLElement(value) { |
| 1478 |
if (!hasWindow()) { |
| 1479 |
return false; |
| 1480 |
} |
| 1481 |
return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement; |
| 1482 |
} |
| 1483 |
function isShadowRoot(value) { |
| 1484 |
if (!hasWindow() || typeof ShadowRoot === "undefined") { |
| 1485 |
return false; |
| 1486 |
} |
| 1487 |
return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot; |
| 1488 |
} |
| 1489 |
function isOverflowElement(element) { |
| 1490 |
const { |
| 1491 |
overflow, |
| 1492 |
overflowX, |
| 1493 |
overflowY, |
| 1494 |
display |
| 1495 |
} = getComputedStyle2(element); |
| 1496 |
return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && display !== "inline" && display !== "contents"; |
| 1497 |
} |
| 1498 |
function isTableElement(element) { |
| 1499 |
return /^(table|td|th)$/.test(getNodeName(element)); |
| 1500 |
} |
| 1501 |
function isTopLayer(element) { |
| 1502 |
try { |
| 1503 |
if (element.matches(":popover-open")) { |
| 1504 |
return true; |
| 1505 |
} |
| 1506 |
} catch (_e) { |
| 1507 |
} |
| 1508 |
try { |
| 1509 |
return element.matches(":modal"); |
| 1510 |
} catch (_e) { |
| 1511 |
return false; |
| 1512 |
} |
| 1513 |
} |
| 1514 |
var willChangeRe = /transform|translate|scale|rotate|perspective|filter/; |
| 1515 |
var containRe = /paint|layout|strict|content/; |
| 1516 |
var isNotNone = (value) => !!value && value !== "none"; |
| 1517 |
var isWebKitValue; |
| 1518 |
function isContainingBlock(elementOrCss) { |
| 1519 |
const css = isElement(elementOrCss) ? getComputedStyle2(elementOrCss) : elementOrCss; |
| 1520 |
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 || ""); |
| 1521 |
} |
| 1522 |
function getContainingBlock(element) { |
| 1523 |
let currentNode = getParentNode(element); |
| 1524 |
while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) { |
| 1525 |
if (isContainingBlock(currentNode)) { |
| 1526 |
return currentNode; |
| 1527 |
} else if (isTopLayer(currentNode)) { |
| 1528 |
return null; |
| 1529 |
} |
| 1530 |
currentNode = getParentNode(currentNode); |
| 1531 |
} |
| 1532 |
return null; |
| 1533 |
} |
| 1534 |
function isWebKit() { |
| 1535 |
if (isWebKitValue == null) { |
| 1536 |
isWebKitValue = typeof CSS !== "undefined" && CSS.supports && CSS.supports("-webkit-backdrop-filter", "none"); |
| 1537 |
} |
| 1538 |
return isWebKitValue; |
| 1539 |
} |
| 1540 |
function isLastTraversableNode(node) { |
| 1541 |
return /^(html|body|#document)$/.test(getNodeName(node)); |
| 1542 |
} |
| 1543 |
function getComputedStyle2(element) { |
| 1544 |
return getWindow(element).getComputedStyle(element); |
| 1545 |
} |
| 1546 |
function getNodeScroll(element) { |
| 1547 |
if (isElement(element)) { |
| 1548 |
return { |
| 1549 |
scrollLeft: element.scrollLeft, |
| 1550 |
scrollTop: element.scrollTop |
| 1551 |
}; |
| 1552 |
} |
| 1553 |
return { |
| 1554 |
scrollLeft: element.scrollX, |
| 1555 |
scrollTop: element.scrollY |
| 1556 |
}; |
| 1557 |
} |
| 1558 |
function getParentNode(node) { |
| 1559 |
if (getNodeName(node) === "html") { |
| 1560 |
return node; |
| 1561 |
} |
| 1562 |
const result = ( |
| 1563 |
// Step into the shadow DOM of the parent of a slotted node. |
| 1564 |
node.assignedSlot || // DOM Element detected. |
| 1565 |
node.parentNode || // ShadowRoot detected. |
| 1566 |
isShadowRoot(node) && node.host || // Fallback. |
| 1567 |
getDocumentElement(node) |
| 1568 |
); |
| 1569 |
return isShadowRoot(result) ? result.host : result; |
| 1570 |
} |
| 1571 |
function getNearestOverflowAncestor(node) { |
| 1572 |
const parentNode = getParentNode(node); |
| 1573 |
if (isLastTraversableNode(parentNode)) { |
| 1574 |
return (node.ownerDocument || node).body; |
| 1575 |
} |
| 1576 |
if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) { |
| 1577 |
return parentNode; |
| 1578 |
} |
| 1579 |
return getNearestOverflowAncestor(parentNode); |
| 1580 |
} |
| 1581 |
function getOverflowAncestors(node, list, traverseIframes) { |
| 1582 |
var _node$ownerDocument2; |
| 1583 |
if (list === void 0) { |
| 1584 |
list = []; |
| 1585 |
} |
| 1586 |
if (traverseIframes === void 0) { |
| 1587 |
traverseIframes = true; |
| 1588 |
} |
| 1589 |
const scrollableAncestor = getNearestOverflowAncestor(node); |
| 1590 |
const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body); |
| 1591 |
const win = getWindow(scrollableAncestor); |
| 1592 |
if (isBody) { |
| 1593 |
const frameElement = getFrameElement(win); |
| 1594 |
return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], frameElement && traverseIframes ? getOverflowAncestors(frameElement) : []); |
| 1595 |
} else { |
| 1596 |
return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes)); |
| 1597 |
} |
| 1598 |
} |
| 1599 |
function getFrameElement(win) { |
| 1600 |
return win.parent && Object.getPrototypeOf(win.parent) ? win.frameElement : null; |
| 1601 |
} |
| 1602 |
|
| 1603 |
// node_modules/@base-ui/react/internals/composite/root/CompositeRootContext.mjs |
| 1604 |
var React13 = __toESM(require_react(), 1); |
| 1605 |
var CompositeRootContext = /* @__PURE__ */ React13.createContext(void 0); |
| 1606 |
if (true) CompositeRootContext.displayName = "CompositeRootContext"; |
| 1607 |
function useCompositeRootContext(optional = false) { |
| 1608 |
const context = React13.useContext(CompositeRootContext); |
| 1609 |
if (context === void 0 && !optional) { |
| 1610 |
throw new Error(true ? "Base UI: CompositeRootContext is missing. Composite parts must be placed within <Composite.Root>." : formatErrorMessage_default(16)); |
| 1611 |
} |
| 1612 |
return context; |
| 1613 |
} |
| 1614 |
|
| 1615 |
// node_modules/@base-ui/react/utils/useFocusableWhenDisabled.mjs |
| 1616 |
var React14 = __toESM(require_react(), 1); |
| 1617 |
function useFocusableWhenDisabled(parameters) { |
| 1618 |
const { |
| 1619 |
focusableWhenDisabled, |
| 1620 |
disabled: disabled2, |
| 1621 |
composite = false, |
| 1622 |
tabIndex: tabIndexProp = 0, |
| 1623 |
isNativeButton |
| 1624 |
} = parameters; |
| 1625 |
const isFocusableComposite = composite && focusableWhenDisabled !== false; |
| 1626 |
const isNonFocusableComposite = composite && focusableWhenDisabled === false; |
| 1627 |
const props = React14.useMemo(() => { |
| 1628 |
const additionalProps = { |
| 1629 |
// allow Tabbing away from focusableWhenDisabled elements |
| 1630 |
onKeyDown(event) { |
| 1631 |
if (disabled2 && focusableWhenDisabled && event.key !== "Tab") { |
| 1632 |
event.preventDefault(); |
| 1633 |
} |
| 1634 |
} |
| 1635 |
}; |
| 1636 |
if (!composite) { |
| 1637 |
additionalProps.tabIndex = tabIndexProp; |
| 1638 |
if (!isNativeButton && disabled2) { |
| 1639 |
additionalProps.tabIndex = focusableWhenDisabled ? tabIndexProp : -1; |
| 1640 |
} |
| 1641 |
} |
| 1642 |
if (isNativeButton && (focusableWhenDisabled || isFocusableComposite) || !isNativeButton && disabled2) { |
| 1643 |
additionalProps["aria-disabled"] = disabled2; |
| 1644 |
} |
| 1645 |
if (isNativeButton && (!focusableWhenDisabled || isNonFocusableComposite)) { |
| 1646 |
additionalProps.disabled = disabled2; |
| 1647 |
} |
| 1648 |
return additionalProps; |
| 1649 |
}, [composite, disabled2, focusableWhenDisabled, isFocusableComposite, isNonFocusableComposite, isNativeButton, tabIndexProp]); |
| 1650 |
return { |
| 1651 |
props |
| 1652 |
}; |
| 1653 |
} |
| 1654 |
|
| 1655 |
// node_modules/@base-ui/utils/owner.mjs |
| 1656 |
function ownerDocument(node) { |
| 1657 |
return node?.ownerDocument || document; |
| 1658 |
} |
| 1659 |
|
| 1660 |
// node_modules/@base-ui/react/utils/dispatchClickWithModifiers.mjs |
| 1661 |
function dispatchClickWithModifiers(target, sourceEvent, { |
| 1662 |
detail = 0 |
| 1663 |
} = {}) { |
| 1664 |
target.dispatchEvent(new (getWindow(target)).PointerEvent("click", { |
| 1665 |
bubbles: true, |
| 1666 |
cancelable: true, |
| 1667 |
composed: true, |
| 1668 |
detail, |
| 1669 |
shiftKey: sourceEvent.shiftKey, |
| 1670 |
ctrlKey: sourceEvent.ctrlKey, |
| 1671 |
altKey: sourceEvent.altKey, |
| 1672 |
metaKey: sourceEvent.metaKey |
| 1673 |
})); |
| 1674 |
} |
| 1675 |
|
| 1676 |
// node_modules/@base-ui/react/internals/use-button/useButton.mjs |
| 1677 |
function useButton(parameters = {}) { |
| 1678 |
const { |
| 1679 |
disabled: disabled2 = false, |
| 1680 |
focusableWhenDisabled, |
| 1681 |
tabIndex = 0, |
| 1682 |
native: isNativeButton = true, |
| 1683 |
composite: compositeProp |
| 1684 |
} = parameters; |
| 1685 |
const elementRef = React15.useRef(null); |
| 1686 |
const compositeRootContext = useCompositeRootContext(true); |
| 1687 |
const isCompositeItem = compositeProp ?? compositeRootContext !== void 0; |
| 1688 |
const { |
| 1689 |
props: focusableWhenDisabledProps |
| 1690 |
} = useFocusableWhenDisabled({ |
| 1691 |
focusableWhenDisabled, |
| 1692 |
disabled: disabled2, |
| 1693 |
composite: isCompositeItem, |
| 1694 |
tabIndex, |
| 1695 |
isNativeButton |
| 1696 |
}); |
| 1697 |
if (true) { |
| 1698 |
React15.useEffect(() => { |
| 1699 |
if (!elementRef.current) { |
| 1700 |
return; |
| 1701 |
} |
| 1702 |
const isButtonTag = isButtonElement(elementRef.current); |
| 1703 |
if (isNativeButton) { |
| 1704 |
if (!isButtonTag) { |
| 1705 |
const ownerStackMessage = SafeReact.captureOwnerStack?.() || ""; |
| 1706 |
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`."; |
| 1707 |
error(`${message}${ownerStackMessage}`); |
| 1708 |
} |
| 1709 |
} else if (isButtonTag) { |
| 1710 |
const ownerStackMessage = SafeReact.captureOwnerStack?.() || ""; |
| 1711 |
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`."; |
| 1712 |
error(`${message}${ownerStackMessage}`); |
| 1713 |
} |
| 1714 |
}, [isNativeButton]); |
| 1715 |
} |
| 1716 |
const updateDisabled = React15.useCallback(() => { |
| 1717 |
const element = elementRef.current; |
| 1718 |
if (!isButtonElement(element)) { |
| 1719 |
return; |
| 1720 |
} |
| 1721 |
if (isCompositeItem && disabled2 && focusableWhenDisabledProps.disabled === void 0 && element.disabled) { |
| 1722 |
element.disabled = false; |
| 1723 |
} |
| 1724 |
}, [disabled2, focusableWhenDisabledProps.disabled, isCompositeItem]); |
| 1725 |
useIsoLayoutEffect(updateDisabled, [updateDisabled]); |
| 1726 |
const getButtonProps = React15.useCallback((externalProps = {}) => { |
| 1727 |
const { |
| 1728 |
onClick: externalOnClick, |
| 1729 |
onMouseDown: externalOnMouseDown, |
| 1730 |
onKeyUp: externalOnKeyUp, |
| 1731 |
onKeyDown: externalOnKeyDown, |
| 1732 |
onPointerDown: externalOnPointerDown, |
| 1733 |
...otherExternalProps |
| 1734 |
} = externalProps; |
| 1735 |
return mergeProps({ |
| 1736 |
onClick(event) { |
| 1737 |
if (disabled2) { |
| 1738 |
event.preventDefault(); |
| 1739 |
return; |
| 1740 |
} |
| 1741 |
externalOnClick?.(event); |
| 1742 |
}, |
| 1743 |
onMouseDown(event) { |
| 1744 |
if (!disabled2) { |
| 1745 |
externalOnMouseDown?.(event); |
| 1746 |
} |
| 1747 |
}, |
| 1748 |
onKeyDown(event) { |
| 1749 |
if (disabled2) { |
| 1750 |
return; |
| 1751 |
} |
| 1752 |
makeEventPreventable(event); |
| 1753 |
externalOnKeyDown?.(event); |
| 1754 |
if (event.baseUIHandlerPrevented) { |
| 1755 |
return; |
| 1756 |
} |
| 1757 |
const isCurrentTarget = event.target === event.currentTarget; |
| 1758 |
const currentTarget = event.currentTarget; |
| 1759 |
const isButton = isButtonElement(currentTarget); |
| 1760 |
const isLink = !isNativeButton && isValidLinkElement(currentTarget); |
| 1761 |
const shouldClick = isCurrentTarget && (isNativeButton ? isButton : !isLink); |
| 1762 |
const isEnterKey = event.key === "Enter"; |
| 1763 |
const isSpaceKey = event.key === " "; |
| 1764 |
const role = currentTarget.getAttribute("role"); |
| 1765 |
const isTextNavigationRole = role?.startsWith("menuitem") || role === "option" || role === "gridcell"; |
| 1766 |
if (isCurrentTarget && isCompositeItem && isSpaceKey) { |
| 1767 |
if (event.defaultPrevented && isTextNavigationRole) { |
| 1768 |
return; |
| 1769 |
} |
| 1770 |
event.preventDefault(); |
| 1771 |
if (!isNativeButton || isButton) { |
| 1772 |
event.preventBaseUIHandler(); |
| 1773 |
dispatchClickWithModifiers(currentTarget, event); |
| 1774 |
} |
| 1775 |
return; |
| 1776 |
} |
| 1777 |
if (!shouldClick || isNativeButton || !isSpaceKey && !isEnterKey) { |
| 1778 |
if (isCurrentTarget && isLink && isSpaceKey) { |
| 1779 |
event.preventDefault(); |
| 1780 |
} |
| 1781 |
return; |
| 1782 |
} |
| 1783 |
if (event.defaultPrevented) { |
| 1784 |
return; |
| 1785 |
} |
| 1786 |
event.preventDefault(); |
| 1787 |
if (isEnterKey) { |
| 1788 |
event.preventBaseUIHandler(); |
| 1789 |
dispatchClickWithModifiers(currentTarget, event); |
| 1790 |
} |
| 1791 |
}, |
| 1792 |
onKeyUp(event) { |
| 1793 |
if (disabled2) { |
| 1794 |
return; |
| 1795 |
} |
| 1796 |
makeEventPreventable(event); |
| 1797 |
externalOnKeyUp?.(event); |
| 1798 |
if (event.target === event.currentTarget && isNativeButton && isCompositeItem && isButtonElement(event.currentTarget) && event.key === " ") { |
| 1799 |
event.preventDefault(); |
| 1800 |
return; |
| 1801 |
} |
| 1802 |
if (event.baseUIHandlerPrevented) { |
| 1803 |
return; |
| 1804 |
} |
| 1805 |
if (event.target === event.currentTarget && !isNativeButton && !isCompositeItem && !event.defaultPrevented && event.key === " ") { |
| 1806 |
event.preventBaseUIHandler(); |
| 1807 |
dispatchClickWithModifiers(event.currentTarget, event); |
| 1808 |
} |
| 1809 |
}, |
| 1810 |
onPointerDown(event) { |
| 1811 |
if (disabled2) { |
| 1812 |
event.preventDefault(); |
| 1813 |
return; |
| 1814 |
} |
| 1815 |
externalOnPointerDown?.(event); |
| 1816 |
} |
| 1817 |
}, isNativeButton ? { |
| 1818 |
type: "button" |
| 1819 |
} : { |
| 1820 |
role: "button" |
| 1821 |
}, focusableWhenDisabledProps, otherExternalProps); |
| 1822 |
}, [disabled2, focusableWhenDisabledProps, isCompositeItem, isNativeButton]); |
| 1823 |
const buttonRef = useStableCallback((element) => { |
| 1824 |
elementRef.current = element; |
| 1825 |
updateDisabled(); |
| 1826 |
}); |
| 1827 |
return { |
| 1828 |
getButtonProps, |
| 1829 |
buttonRef |
| 1830 |
}; |
| 1831 |
} |
| 1832 |
function isButtonElement(elem) { |
| 1833 |
return isHTMLElement(elem) && elem.tagName === "BUTTON"; |
| 1834 |
} |
| 1835 |
function isValidLinkElement(elem) { |
| 1836 |
return isHTMLElement(elem) && elem.tagName === "A" && Boolean(elem.href); |
| 1837 |
} |
| 1838 |
|
| 1839 |
// node_modules/@base-ui/react/collapsible/panel/useCollapsiblePanel.mjs |
| 1840 |
var React17 = __toESM(require_react(), 1); |
| 1841 |
|
| 1842 |
// node_modules/@base-ui/utils/addEventListener.mjs |
| 1843 |
function addEventListener(target, type, listener, options) { |
| 1844 |
target.addEventListener(type, listener, options); |
| 1845 |
return () => { |
| 1846 |
target.removeEventListener(type, listener, options); |
| 1847 |
}; |
| 1848 |
} |
| 1849 |
|
| 1850 |
// node_modules/@base-ui/utils/useValueAsRef.mjs |
| 1851 |
function useValueAsRef(value) { |
| 1852 |
const latest = useRefWithInit(createLatestRef, value).current; |
| 1853 |
latest.next = value; |
| 1854 |
useIsoLayoutEffect(latest.effect); |
| 1855 |
return latest; |
| 1856 |
} |
| 1857 |
function createLatestRef(value) { |
| 1858 |
const latest = { |
| 1859 |
current: value, |
| 1860 |
next: value, |
| 1861 |
effect: () => { |
| 1862 |
latest.current = latest.next; |
| 1863 |
} |
| 1864 |
}; |
| 1865 |
return latest; |
| 1866 |
} |
| 1867 |
|
| 1868 |
// node_modules/@base-ui/react/internals/useOpenChangeComplete.mjs |
| 1869 |
var React16 = __toESM(require_react(), 1); |
| 1870 |
|
| 1871 |
// node_modules/@base-ui/react/internals/useAnimationsFinished.mjs |
| 1872 |
var ReactDOM = __toESM(require_react_dom(), 1); |
| 1873 |
|
| 1874 |
// node_modules/@base-ui/react/utils/resolveRef.mjs |
| 1875 |
function resolveRef(maybeRef) { |
| 1876 |
if (maybeRef == null) { |
| 1877 |
return maybeRef; |
| 1878 |
} |
| 1879 |
return "current" in maybeRef ? maybeRef.current : maybeRef; |
| 1880 |
} |
| 1881 |
|
| 1882 |
// node_modules/@base-ui/react/internals/useAnimationsFinished.mjs |
| 1883 |
var pendingCallbacks = null; |
| 1884 |
function flushBeforePaint(fn) { |
| 1885 |
if (!pendingCallbacks) { |
| 1886 |
const callbacks = []; |
| 1887 |
pendingCallbacks = callbacks; |
| 1888 |
queueMicrotask(() => { |
| 1889 |
pendingCallbacks = null; |
| 1890 |
ReactDOM.flushSync(() => { |
| 1891 |
for (const callback of callbacks) { |
| 1892 |
callback(); |
| 1893 |
} |
| 1894 |
}); |
| 1895 |
}); |
| 1896 |
} |
| 1897 |
pendingCallbacks.push(fn); |
| 1898 |
} |
| 1899 |
function useAnimationsFinished(elementOrRef, waitForStartingStyleRemoved = false, batch = false) { |
| 1900 |
const frame = useAnimationFrame(); |
| 1901 |
return useStableCallback((fnToExecute, signal = null) => { |
| 1902 |
frame.cancel(); |
| 1903 |
const element = resolveRef(elementOrRef); |
| 1904 |
if (element == null) { |
| 1905 |
return; |
| 1906 |
} |
| 1907 |
const resolvedElement = element; |
| 1908 |
const done = () => { |
| 1909 |
if (!batch) { |
| 1910 |
ReactDOM.flushSync(fnToExecute); |
| 1911 |
return; |
| 1912 |
} |
| 1913 |
flushBeforePaint(() => { |
| 1914 |
if (!signal?.aborted) { |
| 1915 |
fnToExecute(); |
| 1916 |
} |
| 1917 |
}); |
| 1918 |
}; |
| 1919 |
if (typeof resolvedElement.getAnimations !== "function" || globalThis.BASE_UI_ANIMATIONS_DISABLED) { |
| 1920 |
fnToExecute(); |
| 1921 |
return; |
| 1922 |
} |
| 1923 |
function exec() { |
| 1924 |
Promise.all(resolvedElement.getAnimations().map((animation) => animation.finished)).then(() => { |
| 1925 |
if (!signal?.aborted) { |
| 1926 |
done(); |
| 1927 |
} |
| 1928 |
}, () => { |
| 1929 |
if (signal?.aborted) { |
| 1930 |
return; |
| 1931 |
} |
| 1932 |
const currentAnimations = resolvedElement.getAnimations(); |
| 1933 |
if (currentAnimations.some((animation) => animation.pending || animation.playState !== "finished")) { |
| 1934 |
exec(); |
| 1935 |
return; |
| 1936 |
} |
| 1937 |
done(); |
| 1938 |
}); |
| 1939 |
} |
| 1940 |
if (waitForStartingStyleRemoved) { |
| 1941 |
const startingStyleAttribute = startingStyle; |
| 1942 |
if (!resolvedElement.hasAttribute(startingStyleAttribute)) { |
| 1943 |
frame.request(exec); |
| 1944 |
return; |
| 1945 |
} |
| 1946 |
const attributeObserver = new MutationObserver(() => { |
| 1947 |
if (!resolvedElement.hasAttribute(startingStyleAttribute)) { |
| 1948 |
attributeObserver.disconnect(); |
| 1949 |
exec(); |
| 1950 |
} |
| 1951 |
}); |
| 1952 |
attributeObserver.observe(resolvedElement, { |
| 1953 |
attributes: true, |
| 1954 |
attributeFilter: [startingStyleAttribute] |
| 1955 |
}); |
| 1956 |
signal?.addEventListener("abort", () => attributeObserver.disconnect(), { |
| 1957 |
once: true |
| 1958 |
}); |
| 1959 |
return; |
| 1960 |
} |
| 1961 |
frame.request(exec); |
| 1962 |
}); |
| 1963 |
} |
| 1964 |
|
| 1965 |
// node_modules/@base-ui/react/internals/useOpenChangeComplete.mjs |
| 1966 |
function useOpenChangeComplete(parameters) { |
| 1967 |
const { |
| 1968 |
enabled = true, |
| 1969 |
open: open3, |
| 1970 |
ref, |
| 1971 |
batch = false, |
| 1972 |
onComplete: onCompleteParam |
| 1973 |
} = parameters; |
| 1974 |
const onComplete = useStableCallback(onCompleteParam); |
| 1975 |
const runOnceAnimationsFinish = useAnimationsFinished(ref, open3, batch); |
| 1976 |
React16.useEffect(() => { |
| 1977 |
if (!enabled) { |
| 1978 |
return void 0; |
| 1979 |
} |
| 1980 |
const abortController = new AbortController(); |
| 1981 |
runOnceAnimationsFinish(onComplete, abortController.signal); |
| 1982 |
return () => { |
| 1983 |
abortController.abort(); |
| 1984 |
}; |
| 1985 |
}, [enabled, open3, onComplete, runOnceAnimationsFinish]); |
| 1986 |
} |
| 1987 |
|
| 1988 |
// node_modules/@base-ui/react/collapsible/panel/useCollapsiblePanel.mjs |
| 1989 |
var EMPTY_DIMENSIONS = { |
| 1990 |
height: void 0, |
| 1991 |
width: void 0 |
| 1992 |
}; |
| 1993 |
function useCollapsiblePanel(parameters) { |
| 1994 |
const { |
| 1995 |
externalRef, |
| 1996 |
hiddenUntilFound, |
| 1997 |
id: idParam, |
| 1998 |
keepMounted, |
| 1999 |
mounted, |
| 2000 |
onOpenChange, |
| 2001 |
open: open3, |
| 2002 |
setMounted, |
| 2003 |
setOpen, |
| 2004 |
transitionStatus |
| 2005 |
} = parameters; |
| 2006 |
const panelRef = React17.useRef(null); |
| 2007 |
const animationTypeRef = React17.useRef(null); |
| 2008 |
const [dimensions, setDimensionsUnwrapped] = React17.useState(EMPTY_DIMENSIONS); |
| 2009 |
const lastMeasuredDimensionsRef = React17.useRef(EMPTY_DIMENSIONS); |
| 2010 |
const shouldSkipNextOpenRef = React17.useRef(false); |
| 2011 |
const shouldPreventMountAnimationRef = React17.useRef(open3); |
| 2012 |
const shouldPreventActivityResumeAnimationRef = React17.useRef(false); |
| 2013 |
const [forcePanelIdle, setForcePanelIdle] = React17.useState(false); |
| 2014 |
const pendingTemporaryStyleRestoreRef = React17.useRef(null); |
| 2015 |
const mergedPanelRef = useMergedRefs(externalRef, panelRef); |
| 2016 |
const latestOpenRef = useValueAsRef(open3); |
| 2017 |
const runOnceCloseAnimationsFinish = useAnimationsFinished(panelRef); |
| 2018 |
const hidden = !open3 && !mounted; |
| 2019 |
const panelTransitionStatus = forcePanelIdle ? "idle" : transitionStatus; |
| 2020 |
const shouldPreventOpenAnimation = open3 && // These 2 refs are safe to read in render, they are only written from committed |
| 2021 |
// layout/effect paths and gate one-shot motion suppression for the next open |
| 2022 |
// lifecycle. They intentionally expose the last committed motion snapshot. |
| 2023 |
(shouldPreventMountAnimationRef.current || shouldPreventActivityResumeAnimationRef.current); |
| 2024 |
const renderedDimensions = !open3 && mounted && // These 2 refs are also safe to read in render, both hold the last committed |
| 2025 |
// animation mode and measurement. This fallback only restores a previously |
| 2026 |
// measured pixel size after the live dimensions state has been reset back to `auto`. |
| 2027 |
animationTypeRef.current === "css-animation" && dimensions.height === void 0 && dimensions.width === void 0 ? lastMeasuredDimensionsRef.current : dimensions; |
| 2028 |
const shouldPersistHiddenTransitionStyles = hiddenUntilFound && hidden && animationTypeRef.current !== "css-animation"; |
| 2029 |
const setDimensions = useStableCallback((nextDimensions, shouldCacheMeasurement = true) => { |
| 2030 |
if (shouldCacheMeasurement) { |
| 2031 |
lastMeasuredDimensionsRef.current = nextDimensions; |
| 2032 |
} |
| 2033 |
setDimensionsUnwrapped(nextDimensions); |
| 2034 |
}); |
| 2035 |
const restorePendingTemporaryStyle = useStableCallback(() => { |
| 2036 |
pendingTemporaryStyleRestoreRef.current?.(); |
| 2037 |
pendingTemporaryStyleRestoreRef.current = null; |
| 2038 |
}); |
| 2039 |
const setPendingTemporaryStyleRestore = useStableCallback((restore) => { |
| 2040 |
restorePendingTemporaryStyle(); |
| 2041 |
pendingTemporaryStyleRestoreRef.current = () => { |
| 2042 |
pendingTemporaryStyleRestoreRef.current = null; |
| 2043 |
restore(); |
| 2044 |
}; |
| 2045 |
}); |
| 2046 |
const markActivityResumeAnimationSuppressed = useStableCallback(() => { |
| 2047 |
if (open3 && mounted && animationTypeRef.current === "css-animation") { |
| 2048 |
shouldPreventActivityResumeAnimationRef.current = true; |
| 2049 |
} |
| 2050 |
}); |
| 2051 |
useIsoLayoutEffect(() => { |
| 2052 |
if (!forcePanelIdle || transitionStatus === "starting") { |
| 2053 |
return; |
| 2054 |
} |
| 2055 |
setForcePanelIdle(false); |
| 2056 |
}, [forcePanelIdle, transitionStatus]); |
| 2057 |
React17.useEffect(() => { |
| 2058 |
return () => { |
| 2059 |
markActivityResumeAnimationSuppressed(); |
| 2060 |
restorePendingTemporaryStyle(); |
| 2061 |
}; |
| 2062 |
}, [markActivityResumeAnimationSuppressed, restorePendingTemporaryStyle]); |
| 2063 |
useIsoLayoutEffect(() => { |
| 2064 |
const panel = panelRef.current; |
| 2065 |
if (!panel) { |
| 2066 |
return void 0; |
| 2067 |
} |
| 2068 |
if (!open3 && pendingTemporaryStyleRestoreRef.current) { |
| 2069 |
restorePendingTemporaryStyle(); |
| 2070 |
} |
| 2071 |
const animationType = getAnimationType(panel, shouldPreventOpenAnimation); |
| 2072 |
animationTypeRef.current = animationType; |
| 2073 |
if (open3 && transitionStatus === "idle" && shouldPreventMountAnimationRef.current && animationType === "css-animation") { |
| 2074 |
lastMeasuredDimensionsRef.current = getDimensions(panel); |
| 2075 |
return void 0; |
| 2076 |
} |
| 2077 |
if (open3 && transitionStatus === "starting") { |
| 2078 |
const skipNextOpen = shouldSkipNextOpenRef.current; |
| 2079 |
shouldSkipNextOpenRef.current = false; |
| 2080 |
if (animationType === "none") { |
| 2081 |
setDimensions(getDimensions(panel)); |
| 2082 |
setForcePanelIdle(true); |
| 2083 |
return void 0; |
| 2084 |
} |
| 2085 |
if (animationType === "css-transition") { |
| 2086 |
const restoreLayoutStyles = resetLayoutStyles(panel); |
| 2087 |
setDimensions(getDimensions(panel)); |
| 2088 |
if (!skipNextOpen) { |
| 2089 |
return restoreLayoutStyles; |
| 2090 |
} |
| 2091 |
const restoreTransitionDuration = setTemporaryStyle(panel, "transition-duration", "0s"); |
| 2092 |
setPendingTemporaryStyleRestore(restoreTransitionDuration); |
| 2093 |
setForcePanelIdle(true); |
| 2094 |
return restoreLayoutStyles; |
| 2095 |
} |
| 2096 |
setDimensions(getDimensions(panel)); |
| 2097 |
const restoreAnimationName = setTemporaryStyle(panel, "animation-name", "none"); |
| 2098 |
if (!skipNextOpen) { |
| 2099 |
restoreAnimationName(); |
| 2100 |
return void 0; |
| 2101 |
} |
| 2102 |
const restoreAnimationDuration = setTemporaryStyle(panel, "animation-duration", "0s"); |
| 2103 |
restoreAnimationName(); |
| 2104 |
setPendingTemporaryStyleRestore(restoreAnimationDuration); |
| 2105 |
setForcePanelIdle(true); |
| 2106 |
return void 0; |
| 2107 |
} |
| 2108 |
if (!open3 && mounted && (transitionStatus === "idle" || transitionStatus === "starting")) { |
| 2109 |
shouldPreventMountAnimationRef.current = false; |
| 2110 |
shouldPreventActivityResumeAnimationRef.current = false; |
| 2111 |
if (animationType === "none") { |
| 2112 |
setDimensions(EMPTY_DIMENSIONS, false); |
| 2113 |
setMounted(false); |
| 2114 |
return void 0; |
| 2115 |
} |
| 2116 |
setDimensions(getDimensions(panel)); |
| 2117 |
return void 0; |
| 2118 |
} |
| 2119 |
if (transitionStatus !== "ending") { |
| 2120 |
return void 0; |
| 2121 |
} |
| 2122 |
if (animationType === "none") { |
| 2123 |
setMounted(false); |
| 2124 |
return void 0; |
| 2125 |
} |
| 2126 |
const nextDimensions = getDimensions(panel); |
| 2127 |
const hasMeasuredSize = nextDimensions.height > 0 || nextDimensions.width > 0; |
| 2128 |
if (!hasMeasuredSize) { |
| 2129 |
setMounted(false); |
| 2130 |
return void 0; |
| 2131 |
} |
| 2132 |
setDimensions(nextDimensions); |
| 2133 |
if (animationType === "css-animation") { |
| 2134 |
const restoreAnimationName = setTemporaryStyle(panel, "animation-name", "none"); |
| 2135 |
restoreAnimationName(); |
| 2136 |
} |
| 2137 |
return void 0; |
| 2138 |
}, [mounted, open3, restorePendingTemporaryStyle, setDimensions, setMounted, setPendingTemporaryStyleRestore, shouldPreventOpenAnimation, transitionStatus]); |
| 2139 |
useOpenChangeComplete({ |
| 2140 |
enabled: open3 && mounted && panelTransitionStatus === "idle", |
| 2141 |
open: true, |
| 2142 |
ref: panelRef, |
| 2143 |
onComplete() { |
| 2144 |
if (!open3) { |
| 2145 |
return; |
| 2146 |
} |
| 2147 |
setDimensions(EMPTY_DIMENSIONS, false); |
| 2148 |
} |
| 2149 |
}); |
| 2150 |
React17.useEffect(() => { |
| 2151 |
if (open3 || !mounted || panelTransitionStatus !== "ending") { |
| 2152 |
return void 0; |
| 2153 |
} |
| 2154 |
const panel = panelRef.current; |
| 2155 |
if (!panel) { |
| 2156 |
return void 0; |
| 2157 |
} |
| 2158 |
const abortController = new AbortController(); |
| 2159 |
let endingStyleFrame = -1; |
| 2160 |
function handleComplete() { |
| 2161 |
if (latestOpenRef.current) { |
| 2162 |
return; |
| 2163 |
} |
| 2164 |
setMounted(false); |
| 2165 |
setDimensions(EMPTY_DIMENSIONS, false); |
| 2166 |
} |
| 2167 |
endingStyleFrame = AnimationFrame.request(() => { |
| 2168 |
runOnceCloseAnimationsFinish(handleComplete, abortController.signal); |
| 2169 |
}); |
| 2170 |
return () => { |
| 2171 |
AnimationFrame.cancel(endingStyleFrame); |
| 2172 |
abortController.abort(); |
| 2173 |
}; |
| 2174 |
}, [latestOpenRef, mounted, open3, panelTransitionStatus, runOnceCloseAnimationsFinish, setDimensions, setMounted]); |
| 2175 |
useIsoLayoutEffect(() => { |
| 2176 |
const panel = panelRef.current; |
| 2177 |
if (!panel || !hiddenUntilFound || !hidden) { |
| 2178 |
return; |
| 2179 |
} |
| 2180 |
panel.setAttribute("hidden", "until-found"); |
| 2181 |
}, [hidden, hiddenUntilFound]); |
| 2182 |
React17.useEffect(function registerBeforeMatchListener() { |
| 2183 |
const panel = panelRef.current; |
| 2184 |
if (!panel) { |
| 2185 |
return void 0; |
| 2186 |
} |
| 2187 |
function handleBeforeMatch(event) { |
| 2188 |
const eventDetails = createChangeEventDetails(reason_parts_exports.none, event); |
| 2189 |
onOpenChange(true, eventDetails); |
| 2190 |
if (eventDetails.isCanceled) { |
| 2191 |
return; |
| 2192 |
} |
| 2193 |
shouldSkipNextOpenRef.current = true; |
| 2194 |
setOpen(true); |
| 2195 |
} |
| 2196 |
return addEventListener(panel, "beforematch", handleBeforeMatch); |
| 2197 |
}, [onOpenChange, setOpen]); |
| 2198 |
const shouldRender = keepMounted || hiddenUntilFound || mounted || open3; |
| 2199 |
return { |
| 2200 |
height: renderedDimensions.height, |
| 2201 |
props: { |
| 2202 |
...shouldPersistHiddenTransitionStyles ? { |
| 2203 |
[startingStyle2]: "" |
| 2204 |
} : void 0, |
| 2205 |
hidden, |
| 2206 |
id: idParam |
| 2207 |
}, |
| 2208 |
ref: mergedPanelRef, |
| 2209 |
shouldPreventOpenAnimation, |
| 2210 |
shouldRender, |
| 2211 |
transitionStatus: panelTransitionStatus, |
| 2212 |
width: renderedDimensions.width |
| 2213 |
}; |
| 2214 |
} |
| 2215 |
function getDimensions(element) { |
| 2216 |
return { |
| 2217 |
height: element.scrollHeight, |
| 2218 |
width: element.scrollWidth |
| 2219 |
}; |
| 2220 |
} |
| 2221 |
function getAnimationType(element, hasSuppressedMountAnimation) { |
| 2222 |
const panelStyles = getWindow(element).getComputedStyle(element); |
| 2223 |
const hasAnimation = (panelStyles.animationName.split(",").map((name) => name.trim()).some((name) => name !== "" && name !== "none") || hasSuppressedMountAnimation) && hasNonZeroDuration(panelStyles.animationDuration); |
| 2224 |
const hasTransition = hasNonZeroDuration(panelStyles.transitionDuration); |
| 2225 |
if (hasAnimation && hasTransition) { |
| 2226 |
if (true) { |
| 2227 |
warn("CSS transitions and CSS animations both detected on Collapsible or Accordion panel.", "Only one of either animation type should be used."); |
| 2228 |
} |
| 2229 |
return "css-transition"; |
| 2230 |
} |
| 2231 |
if (hasTransition) { |
| 2232 |
return "css-transition"; |
| 2233 |
} |
| 2234 |
if (hasAnimation) { |
| 2235 |
return "css-animation"; |
| 2236 |
} |
| 2237 |
return "none"; |
| 2238 |
} |
| 2239 |
function hasNonZeroDuration(value) { |
| 2240 |
return value.split(",").map((part) => part.trim()).some((part) => part !== "" && Number.parseFloat(part) > 0); |
| 2241 |
} |
| 2242 |
function setTemporaryStyle(element, property, value) { |
| 2243 |
const previousValue = element.style.getPropertyValue(property); |
| 2244 |
const previousPriority = element.style.getPropertyPriority(property); |
| 2245 |
element.style.setProperty(property, value); |
| 2246 |
return () => { |
| 2247 |
if (previousValue === "") { |
| 2248 |
element.style.removeProperty(property); |
| 2249 |
return; |
| 2250 |
} |
| 2251 |
element.style.setProperty(property, previousValue, previousPriority); |
| 2252 |
}; |
| 2253 |
} |
| 2254 |
function resetLayoutStyles(element) { |
| 2255 |
const originalLayoutStyles = { |
| 2256 |
"justify-content": element.style.justifyContent, |
| 2257 |
"align-items": element.style.alignItems, |
| 2258 |
"align-content": element.style.alignContent, |
| 2259 |
"justify-items": element.style.justifyItems |
| 2260 |
}; |
| 2261 |
Object.keys(originalLayoutStyles).forEach((key) => { |
| 2262 |
element.style.setProperty(key, "initial", "important"); |
| 2263 |
}); |
| 2264 |
function restoreLayoutStyles() { |
| 2265 |
Object.entries(originalLayoutStyles).forEach(([key, value]) => { |
| 2266 |
if (value === "") { |
| 2267 |
element.style.removeProperty(key); |
| 2268 |
return; |
| 2269 |
} |
| 2270 |
element.style.setProperty(key, value); |
| 2271 |
}); |
| 2272 |
} |
| 2273 |
const frame = AnimationFrame.request(restoreLayoutStyles); |
| 2274 |
return () => { |
| 2275 |
AnimationFrame.cancel(frame); |
| 2276 |
restoreLayoutStyles(); |
| 2277 |
}; |
| 2278 |
} |
| 2279 |
|
| 2280 |
// node_modules/@base-ui/utils/platform/parts.mjs |
| 2281 |
var parts_exports = {}; |
| 2282 |
__export(parts_exports, { |
| 2283 |
engine: () => engine_exports, |
| 2284 |
env: () => env_exports, |
| 2285 |
mediaQuery: () => media_query_exports, |
| 2286 |
os: () => os_exports, |
| 2287 |
screenReader: () => screen_reader_exports |
| 2288 |
}); |
| 2289 |
|
| 2290 |
// node_modules/@base-ui/utils/platform/os.mjs |
| 2291 |
var os_exports = {}; |
| 2292 |
__export(os_exports, { |
| 2293 |
android: () => android, |
| 2294 |
apple: () => apple, |
| 2295 |
ios: () => ios, |
| 2296 |
linux: () => linux, |
| 2297 |
mac: () => mac, |
| 2298 |
windows: () => windows |
| 2299 |
}); |
| 2300 |
|
| 2301 |
// node_modules/@base-ui/utils/platform/shared.mjs |
| 2302 |
function readRawData() { |
| 2303 |
if (typeof navigator === "undefined") { |
| 2304 |
return { |
| 2305 |
userAgent: "", |
| 2306 |
platform: "", |
| 2307 |
maxTouchPoints: 0 |
| 2308 |
}; |
| 2309 |
} |
| 2310 |
if (true) { |
| 2311 |
const uaData = navigator.userAgentData; |
| 2312 |
if (uaData && Array.isArray(uaData.brands)) { |
| 2313 |
return { |
| 2314 |
userAgent: uaData.brands.map(({ |
| 2315 |
brand, |
| 2316 |
version: version2 |
| 2317 |
}) => `${brand}/${version2}`).join(" "), |
| 2318 |
platform: uaData.platform ?? navigator.platform ?? "", |
| 2319 |
maxTouchPoints: navigator.maxTouchPoints ?? 0 |
| 2320 |
}; |
| 2321 |
} |
| 2322 |
} |
| 2323 |
return { |
| 2324 |
userAgent: navigator.userAgent, |
| 2325 |
platform: navigator.platform ?? "", |
| 2326 |
maxTouchPoints: navigator.maxTouchPoints ?? 0 |
| 2327 |
}; |
| 2328 |
} |
| 2329 |
var { |
| 2330 |
userAgent, |
| 2331 |
platform, |
| 2332 |
maxTouchPoints |
| 2333 |
} = readRawData(); |
| 2334 |
var lowerUserAgent = userAgent.toLowerCase(); |
| 2335 |
var lowerPlatform = platform.toLowerCase(); |
| 2336 |
|
| 2337 |
// node_modules/@base-ui/utils/platform/os.mjs |
| 2338 |
var ios = /^i(os$|p)/.test(lowerPlatform) || lowerPlatform === "macintel" && maxTouchPoints > 1; |
| 2339 |
var ANDROID_STRING = "android"; |
| 2340 |
var android = lowerPlatform === ANDROID_STRING || lowerUserAgent.includes(ANDROID_STRING); |
| 2341 |
var mac = !ios && lowerPlatform.startsWith("mac"); |
| 2342 |
var windows = lowerPlatform.startsWith("win"); |
| 2343 |
var linux = !android && /^(linux|chrome os)/.test(lowerPlatform); |
| 2344 |
var apple = mac || ios; |
| 2345 |
|
| 2346 |
// node_modules/@base-ui/utils/platform/engine.mjs |
| 2347 |
var engine_exports = {}; |
| 2348 |
__export(engine_exports, { |
| 2349 |
blink: () => blink, |
| 2350 |
gecko: () => gecko, |
| 2351 |
webkit: () => webkit |
| 2352 |
}); |
| 2353 |
var webkit = typeof CSS !== "undefined" && !!CSS.supports?.("-webkit-backdrop-filter:none"); |
| 2354 |
var gecko = !webkit && lowerUserAgent.includes("firefox"); |
| 2355 |
var blink = !webkit && lowerUserAgent.includes("chrom"); |
| 2356 |
|
| 2357 |
// node_modules/@base-ui/utils/platform/screen-reader.mjs |
| 2358 |
var screen_reader_exports = {}; |
| 2359 |
__export(screen_reader_exports, { |
| 2360 |
voiceOver: () => voiceOver |
| 2361 |
}); |
| 2362 |
var voiceOver = apple; |
| 2363 |
|
| 2364 |
// node_modules/@base-ui/utils/platform/env.mjs |
| 2365 |
var env_exports = {}; |
| 2366 |
__export(env_exports, { |
| 2367 |
jsdom: () => jsdom |
| 2368 |
}); |
| 2369 |
var jsdom = /jsdom|happydom/.test(lowerUserAgent); |
| 2370 |
|
| 2371 |
// node_modules/@base-ui/utils/platform/media-query.mjs |
| 2372 |
var media_query_exports = {}; |
| 2373 |
__export(media_query_exports, { |
| 2374 |
iOS: () => iOS |
| 2375 |
}); |
| 2376 |
var iOS = "@supports (-webkit-touch-callout: none)"; |
| 2377 |
|
| 2378 |
// node_modules/@base-ui/utils/useTimeout.mjs |
| 2379 |
var EMPTY2 = 0; |
| 2380 |
var Timeout = class _Timeout { |
| 2381 |
static create() { |
| 2382 |
return new _Timeout(); |
| 2383 |
} |
| 2384 |
currentId = EMPTY2; |
| 2385 |
/** |
| 2386 |
* Executes `fn` after `delay`, clearing any previously scheduled call. |
| 2387 |
*/ |
| 2388 |
start(delay, fn) { |
| 2389 |
this.clear(); |
| 2390 |
this.currentId = setTimeout(() => { |
| 2391 |
this.currentId = EMPTY2; |
| 2392 |
fn(); |
| 2393 |
}, delay); |
| 2394 |
} |
| 2395 |
isStarted() { |
| 2396 |
return this.currentId !== EMPTY2; |
| 2397 |
} |
| 2398 |
clear = () => { |
| 2399 |
if (this.currentId !== EMPTY2) { |
| 2400 |
clearTimeout(this.currentId); |
| 2401 |
this.currentId = EMPTY2; |
| 2402 |
} |
| 2403 |
}; |
| 2404 |
disposeEffect = () => { |
| 2405 |
return this.clear; |
| 2406 |
}; |
| 2407 |
}; |
| 2408 |
function useTimeout() { |
| 2409 |
const timeout = useRefWithInit(Timeout.create).current; |
| 2410 |
useOnMount(timeout.disposeEffect); |
| 2411 |
return timeout; |
| 2412 |
} |
| 2413 |
|
| 2414 |
// node_modules/@base-ui/react/floating-ui-react/components/FloatingDelayGroup.mjs |
| 2415 |
var React18 = __toESM(require_react(), 1); |
| 2416 |
|
| 2417 |
// node_modules/@base-ui/react/floating-ui-react/utils/event.mjs |
| 2418 |
function isReactEvent(event) { |
| 2419 |
return "nativeEvent" in event; |
| 2420 |
} |
| 2421 |
function isVirtualClick(event) { |
| 2422 |
if (event.pointerType === "" && event.isTrusted) { |
| 2423 |
return true; |
| 2424 |
} |
| 2425 |
if (parts_exports.os.android && event.pointerType) { |
| 2426 |
return event.type === "click" && event.buttons === 1; |
| 2427 |
} |
| 2428 |
return event.detail === 0 && !event.pointerType; |
| 2429 |
} |
| 2430 |
function isMouseLikePointerType(pointerType, strict) { |
| 2431 |
const values = ["mouse", "pen"]; |
| 2432 |
if (!strict) { |
| 2433 |
values.push("", void 0); |
| 2434 |
} |
| 2435 |
return values.includes(pointerType); |
| 2436 |
} |
| 2437 |
function isClickLikeEvent(event) { |
| 2438 |
const type = event.type; |
| 2439 |
return type === "click" || type === "mousedown" || type === "keydown" || type === "keyup"; |
| 2440 |
} |
| 2441 |
|
| 2442 |
// node_modules/@base-ui/utils/shadowDom.mjs |
| 2443 |
function activeElement(doc) { |
| 2444 |
let element = doc.activeElement; |
| 2445 |
while (element?.shadowRoot?.activeElement != null) { |
| 2446 |
element = element.shadowRoot.activeElement; |
| 2447 |
} |
| 2448 |
return element; |
| 2449 |
} |
| 2450 |
function contains(parent, child) { |
| 2451 |
if (!parent || !child) { |
| 2452 |
return false; |
| 2453 |
} |
| 2454 |
const rootNode = child.getRootNode?.(); |
| 2455 |
if (parent.contains(child)) { |
| 2456 |
return true; |
| 2457 |
} |
| 2458 |
if (rootNode && isShadowRoot(rootNode)) { |
| 2459 |
let next = child; |
| 2460 |
while (next) { |
| 2461 |
if (parent === next) { |
| 2462 |
return true; |
| 2463 |
} |
| 2464 |
next = next.parentNode || next.host; |
| 2465 |
} |
| 2466 |
} |
| 2467 |
return false; |
| 2468 |
} |
| 2469 |
function getTarget(event) { |
| 2470 |
if ("composedPath" in event) { |
| 2471 |
return event.composedPath()[0] ?? event.target; |
| 2472 |
} |
| 2473 |
return event.target; |
| 2474 |
} |
| 2475 |
|
| 2476 |
// node_modules/@base-ui/react/floating-ui-react/utils/constants.mjs |
| 2477 |
var FOCUSABLE_ATTRIBUTE = "data-base-ui-focusable"; |
| 2478 |
var TYPEABLE_SELECTOR = "input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])"; |
| 2479 |
|
| 2480 |
// node_modules/@base-ui/react/utils/CommonPopupDataAttributes.mjs |
| 2481 |
var open2 = "data-open"; |
| 2482 |
var closed2 = "data-closed"; |
| 2483 |
var anchorHidden = "data-anchor-hidden"; |
| 2484 |
|
| 2485 |
// node_modules/@base-ui/react/utils/CommonTriggerDataAttributes.mjs |
| 2486 |
var CommonTriggerDataAttributes_exports = {}; |
| 2487 |
__export(CommonTriggerDataAttributes_exports, { |
| 2488 |
popupOpen: () => popupOpen, |
| 2489 |
pressed: () => pressed |
| 2490 |
}); |
| 2491 |
var popupOpen = "data-popup-open"; |
| 2492 |
var pressed = "data-pressed"; |
| 2493 |
|
| 2494 |
// node_modules/@base-ui/react/utils/popupStateMapping.mjs |
| 2495 |
var TRIGGER_HOOK = { |
| 2496 |
[popupOpen]: "" |
| 2497 |
}; |
| 2498 |
var PRESSABLE_TRIGGER_HOOK = { |
| 2499 |
[popupOpen]: "", |
| 2500 |
[pressed]: "" |
| 2501 |
}; |
| 2502 |
var POPUP_OPEN_HOOK = { |
| 2503 |
[open2]: "" |
| 2504 |
}; |
| 2505 |
var POPUP_CLOSED_HOOK = { |
| 2506 |
[closed2]: "" |
| 2507 |
}; |
| 2508 |
var ANCHOR_HIDDEN_HOOK = { |
| 2509 |
[anchorHidden]: "" |
| 2510 |
}; |
| 2511 |
var triggerOpenStateMapping2 = { |
| 2512 |
open(value) { |
| 2513 |
if (value) { |
| 2514 |
return TRIGGER_HOOK; |
| 2515 |
} |
| 2516 |
return null; |
| 2517 |
} |
| 2518 |
}; |
| 2519 |
var popupStateMapping = { |
| 2520 |
open(value) { |
| 2521 |
if (value) { |
| 2522 |
return POPUP_OPEN_HOOK; |
| 2523 |
} |
| 2524 |
return POPUP_CLOSED_HOOK; |
| 2525 |
}, |
| 2526 |
anchorHidden(value) { |
| 2527 |
if (value) { |
| 2528 |
return ANCHOR_HIDDEN_HOOK; |
| 2529 |
} |
| 2530 |
return null; |
| 2531 |
} |
| 2532 |
}; |
| 2533 |
var popupTransitionStateMapping = { |
| 2534 |
...popupStateMapping, |
| 2535 |
...transitionStatusMapping |
| 2536 |
}; |
| 2537 |
|
| 2538 |
// node_modules/@base-ui/react/tooltip/trigger/TooltipTriggerDataAttributes.mjs |
| 2539 |
var popupOpen2 = CommonTriggerDataAttributes_exports.popupOpen; |
| 2540 |
var triggerDisabled = "data-trigger-disabled"; |
| 2541 |
|
| 2542 |
// node_modules/@base-ui/react/floating-ui-react/utils/element.mjs |
| 2543 |
function isTargetInsideEnabledTrigger(target, triggerElements) { |
| 2544 |
if (!isElement(target)) { |
| 2545 |
return false; |
| 2546 |
} |
| 2547 |
const targetElement = target; |
| 2548 |
if (triggerElements.hasElement(targetElement)) { |
| 2549 |
return !targetElement.hasAttribute(triggerDisabled); |
| 2550 |
} |
| 2551 |
for (const [, trigger] of triggerElements.entries()) { |
| 2552 |
if (contains(trigger, targetElement)) { |
| 2553 |
return !trigger.hasAttribute(triggerDisabled); |
| 2554 |
} |
| 2555 |
} |
| 2556 |
return false; |
| 2557 |
} |
| 2558 |
function isEventTargetWithin(event, node) { |
| 2559 |
if (node == null) { |
| 2560 |
return false; |
| 2561 |
} |
| 2562 |
if ("composedPath" in event) { |
| 2563 |
return event.composedPath().includes(node); |
| 2564 |
} |
| 2565 |
const eventAgain = event; |
| 2566 |
return eventAgain.target != null && node.contains(eventAgain.target); |
| 2567 |
} |
| 2568 |
function isRootElement(element) { |
| 2569 |
return element.matches("html,body"); |
| 2570 |
} |
| 2571 |
function isTypeableElement(element) { |
| 2572 |
return isHTMLElement(element) && element.matches(TYPEABLE_SELECTOR); |
| 2573 |
} |
| 2574 |
function isInteractiveElement(element) { |
| 2575 |
return element?.closest(`button,a[href],[role="button"],select,[tabindex]:not([tabindex="-1"]),${TYPEABLE_SELECTOR}`) != null; |
| 2576 |
} |
| 2577 |
function matchesFocusVisible(element) { |
| 2578 |
if (!element || parts_exports.env.jsdom) { |
| 2579 |
return true; |
| 2580 |
} |
| 2581 |
try { |
| 2582 |
return element.matches(":focus-visible"); |
| 2583 |
} catch (_e) { |
| 2584 |
return true; |
| 2585 |
} |
| 2586 |
} |
| 2587 |
|
| 2588 |
// node_modules/@base-ui/react/floating-ui-react/hooks/useHoverShared.mjs |
| 2589 |
function resolveValue(value, pointerType) { |
| 2590 |
if (pointerType != null && !isMouseLikePointerType(pointerType)) { |
| 2591 |
return 0; |
| 2592 |
} |
| 2593 |
if (typeof value === "function") { |
| 2594 |
return value(); |
| 2595 |
} |
| 2596 |
return value; |
| 2597 |
} |
| 2598 |
function getDelay(value, prop, pointerType) { |
| 2599 |
const result = resolveValue(value, pointerType); |
| 2600 |
if (typeof result === "number") { |
| 2601 |
return result; |
| 2602 |
} |
| 2603 |
return result?.[prop]; |
| 2604 |
} |
| 2605 |
function getRestMs(value) { |
| 2606 |
if (typeof value === "function") { |
| 2607 |
return value(); |
| 2608 |
} |
| 2609 |
return value; |
| 2610 |
} |
| 2611 |
function isClickLikeOpenEvent(openEventType, interactedInside) { |
| 2612 |
return interactedInside || openEventType === "click" || openEventType === "mousedown"; |
| 2613 |
} |
| 2614 |
function isHoverOpenEvent(openEventType) { |
| 2615 |
return openEventType?.includes("mouse") && openEventType !== "mousedown"; |
| 2616 |
} |
| 2617 |
|
| 2618 |
// node_modules/@base-ui/react/floating-ui-react/components/FloatingDelayGroup.mjs |
| 2619 |
var import_jsx_runtime = __toESM(require_jsx_runtime(), 1); |
| 2620 |
var FloatingDelayGroupContext = /* @__PURE__ */ React18.createContext({ |
| 2621 |
hasProvider: false, |
| 2622 |
timeoutMs: 0, |
| 2623 |
delayRef: { |
| 2624 |
current: 0 |
| 2625 |
}, |
| 2626 |
initialDelayRef: { |
| 2627 |
current: 0 |
| 2628 |
}, |
| 2629 |
timeout: new Timeout(), |
| 2630 |
currentIdRef: { |
| 2631 |
current: null |
| 2632 |
}, |
| 2633 |
currentContextRef: { |
| 2634 |
current: null |
| 2635 |
} |
| 2636 |
}); |
| 2637 |
if (true) FloatingDelayGroupContext.displayName = "FloatingDelayGroupContext"; |
| 2638 |
function resetDelayRef(delayRef, initialDelayRef) { |
| 2639 |
delayRef.current = initialDelayRef.current; |
| 2640 |
} |
| 2641 |
function FloatingDelayGroup(props) { |
| 2642 |
const { |
| 2643 |
children, |
| 2644 |
delay, |
| 2645 |
timeoutMs = 0 |
| 2646 |
} = props; |
| 2647 |
const delayRef = React18.useRef(delay); |
| 2648 |
const initialDelayRef = React18.useRef(delay); |
| 2649 |
const currentIdRef = React18.useRef(null); |
| 2650 |
const currentContextRef = React18.useRef(null); |
| 2651 |
const timeout = useTimeout(); |
| 2652 |
useIsoLayoutEffect(() => { |
| 2653 |
initialDelayRef.current = delay; |
| 2654 |
if (!currentIdRef.current) { |
| 2655 |
delayRef.current = delay; |
| 2656 |
return; |
| 2657 |
} |
| 2658 |
delayRef.current = { |
| 2659 |
open: getDelay(delayRef.current, "open"), |
| 2660 |
close: getDelay(delay, "close") |
| 2661 |
}; |
| 2662 |
}, [delay, currentIdRef, delayRef, initialDelayRef]); |
| 2663 |
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FloatingDelayGroupContext.Provider, { |
| 2664 |
value: React18.useMemo(() => ({ |
| 2665 |
hasProvider: true, |
| 2666 |
delayRef, |
| 2667 |
initialDelayRef, |
| 2668 |
currentIdRef, |
| 2669 |
timeoutMs, |
| 2670 |
currentContextRef, |
| 2671 |
timeout |
| 2672 |
}), [timeoutMs, timeout]), |
| 2673 |
children |
| 2674 |
}); |
| 2675 |
} |
| 2676 |
function useDelayGroup(context, options = { |
| 2677 |
open: false |
| 2678 |
}) { |
| 2679 |
const { |
| 2680 |
open: open3 |
| 2681 |
} = options; |
| 2682 |
const store2 = "rootStore" in context ? context.rootStore : context; |
| 2683 |
const floatingId = store2.useState("floatingId"); |
| 2684 |
const groupContext = React18.useContext(FloatingDelayGroupContext); |
| 2685 |
const { |
| 2686 |
currentIdRef, |
| 2687 |
delayRef, |
| 2688 |
timeoutMs, |
| 2689 |
initialDelayRef, |
| 2690 |
currentContextRef, |
| 2691 |
hasProvider, |
| 2692 |
timeout |
| 2693 |
} = groupContext; |
| 2694 |
const [isInstantPhase, setIsInstantPhase] = React18.useState(false); |
| 2695 |
const openRef = React18.useRef(open3); |
| 2696 |
useIsoLayoutEffect(() => { |
| 2697 |
openRef.current = open3; |
| 2698 |
}, [open3]); |
| 2699 |
useIsoLayoutEffect(() => { |
| 2700 |
function unset() { |
| 2701 |
currentContextRef.current?.setIsInstantPhase(false); |
| 2702 |
currentIdRef.current = null; |
| 2703 |
currentContextRef.current = null; |
| 2704 |
delayRef.current = initialDelayRef.current; |
| 2705 |
timeout.clear(); |
| 2706 |
} |
| 2707 |
if (!currentIdRef.current) { |
| 2708 |
return void 0; |
| 2709 |
} |
| 2710 |
if (!open3 && currentIdRef.current === floatingId) { |
| 2711 |
setIsInstantPhase(false); |
| 2712 |
if (timeoutMs) { |
| 2713 |
const closingId = floatingId; |
| 2714 |
timeout.start(timeoutMs, () => { |
| 2715 |
if (store2.select("open") || currentIdRef.current && currentIdRef.current !== closingId) { |
| 2716 |
return; |
| 2717 |
} |
| 2718 |
unset(); |
| 2719 |
}); |
| 2720 |
return () => { |
| 2721 |
if (openRef.current || currentIdRef.current !== closingId) { |
| 2722 |
timeout.clear(); |
| 2723 |
} |
| 2724 |
}; |
| 2725 |
} |
| 2726 |
unset(); |
| 2727 |
} |
| 2728 |
return void 0; |
| 2729 |
}, [open3, floatingId, currentIdRef, delayRef, timeoutMs, initialDelayRef, currentContextRef, timeout, store2]); |
| 2730 |
useIsoLayoutEffect(() => { |
| 2731 |
if (!open3) { |
| 2732 |
return; |
| 2733 |
} |
| 2734 |
const prevContext = currentContextRef.current; |
| 2735 |
const prevId = currentIdRef.current; |
| 2736 |
timeout.clear(); |
| 2737 |
currentContextRef.current = { |
| 2738 |
onOpenChange: store2.setOpen, |
| 2739 |
setIsInstantPhase |
| 2740 |
}; |
| 2741 |
currentIdRef.current = floatingId; |
| 2742 |
delayRef.current = { |
| 2743 |
open: 0, |
| 2744 |
close: getDelay(initialDelayRef.current, "close") |
| 2745 |
}; |
| 2746 |
if (prevId !== null && prevId !== floatingId) { |
| 2747 |
setIsInstantPhase(true); |
| 2748 |
prevContext?.setIsInstantPhase(true); |
| 2749 |
prevContext?.onOpenChange(false, createChangeEventDetails(reason_parts_exports.none)); |
| 2750 |
} else { |
| 2751 |
setIsInstantPhase(false); |
| 2752 |
prevContext?.setIsInstantPhase(false); |
| 2753 |
} |
| 2754 |
}, [open3, floatingId, store2, currentIdRef, delayRef, initialDelayRef, currentContextRef, timeout]); |
| 2755 |
useIsoLayoutEffect(() => { |
| 2756 |
return () => { |
| 2757 |
if (currentIdRef.current === floatingId) { |
| 2758 |
currentContextRef.current = null; |
| 2759 |
if (!openRef.current) { |
| 2760 |
return; |
| 2761 |
} |
| 2762 |
currentIdRef.current = null; |
| 2763 |
resetDelayRef(delayRef, initialDelayRef); |
| 2764 |
timeout.clear(); |
| 2765 |
} |
| 2766 |
}; |
| 2767 |
}, [currentContextRef, currentIdRef, delayRef, floatingId, initialDelayRef, timeout]); |
| 2768 |
return React18.useMemo(() => ({ |
| 2769 |
activeIdRef: currentIdRef, |
| 2770 |
hasProvider, |
| 2771 |
delayRef, |
| 2772 |
isInstantPhase |
| 2773 |
}), [currentIdRef, hasProvider, delayRef, isInstantPhase]); |
| 2774 |
} |
| 2775 |
|
| 2776 |
// node_modules/@base-ui/utils/mergeCleanups.mjs |
| 2777 |
function mergeCleanups(...cleanups) { |
| 2778 |
return () => { |
| 2779 |
for (let i = 0; i < cleanups.length; i += 1) { |
| 2780 |
const cleanup = cleanups[i]; |
| 2781 |
if (cleanup) { |
| 2782 |
cleanup(); |
| 2783 |
} |
| 2784 |
} |
| 2785 |
}; |
| 2786 |
} |
| 2787 |
|
| 2788 |
// node_modules/@base-ui/react/utils/FocusGuard.mjs |
| 2789 |
var React19 = __toESM(require_react(), 1); |
| 2790 |
|
| 2791 |
// node_modules/@base-ui/utils/visuallyHidden.mjs |
| 2792 |
var visuallyHiddenBase = { |
| 2793 |
clipPath: "inset(50%)", |
| 2794 |
overflow: "hidden", |
| 2795 |
whiteSpace: "nowrap", |
| 2796 |
border: 0, |
| 2797 |
padding: 0, |
| 2798 |
width: 1, |
| 2799 |
height: 1, |
| 2800 |
margin: -1 |
| 2801 |
}; |
| 2802 |
var visuallyHidden = { |
| 2803 |
...visuallyHiddenBase, |
| 2804 |
position: "fixed", |
| 2805 |
top: 0, |
| 2806 |
left: 0 |
| 2807 |
}; |
| 2808 |
var visuallyHiddenInput = { |
| 2809 |
...visuallyHiddenBase, |
| 2810 |
position: "absolute" |
| 2811 |
}; |
| 2812 |
|
| 2813 |
// node_modules/@base-ui/react/utils/FocusGuard.mjs |
| 2814 |
var import_jsx_runtime2 = __toESM(require_jsx_runtime(), 1); |
| 2815 |
var FocusGuard = /* @__PURE__ */ React19.forwardRef(function FocusGuard2(props, ref) { |
| 2816 |
const [role, setRole] = React19.useState(); |
| 2817 |
useIsoLayoutEffect(() => { |
| 2818 |
if (parts_exports.screenReader.voiceOver && parts_exports.engine.webkit) { |
| 2819 |
setRole("button"); |
| 2820 |
} |
| 2821 |
}, []); |
| 2822 |
const restProps = { |
| 2823 |
tabIndex: 0, |
| 2824 |
// Role is only for VoiceOver |
| 2825 |
role |
| 2826 |
}; |
| 2827 |
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { |
| 2828 |
...props, |
| 2829 |
ref, |
| 2830 |
style: visuallyHidden, |
| 2831 |
"aria-hidden": role ? void 0 : true, |
| 2832 |
...restProps, |
| 2833 |
"data-base-ui-focus-guard": "" |
| 2834 |
}); |
| 2835 |
}); |
| 2836 |
if (true) FocusGuard.displayName = "FocusGuard"; |
| 2837 |
|
| 2838 |
// node_modules/@floating-ui/utils/dist/floating-ui.utils.mjs |
| 2839 |
var min = Math.min; |
| 2840 |
var max = Math.max; |
| 2841 |
var round = Math.round; |
| 2842 |
var floor = Math.floor; |
| 2843 |
var createCoords = (v) => ({ |
| 2844 |
x: v, |
| 2845 |
y: v |
| 2846 |
}); |
| 2847 |
var oppositeSideMap = { |
| 2848 |
left: "right", |
| 2849 |
right: "left", |
| 2850 |
bottom: "top", |
| 2851 |
top: "bottom" |
| 2852 |
}; |
| 2853 |
function clamp(start, value, end) { |
| 2854 |
return max(start, min(value, end)); |
| 2855 |
} |
| 2856 |
function evaluate(value, param) { |
| 2857 |
return typeof value === "function" ? value(param) : value; |
| 2858 |
} |
| 2859 |
function getSide(placement) { |
| 2860 |
return placement.split("-")[0]; |
| 2861 |
} |
| 2862 |
function getAlignment(placement) { |
| 2863 |
return placement.split("-")[1]; |
| 2864 |
} |
| 2865 |
function getOppositeAxis(axis) { |
| 2866 |
return axis === "x" ? "y" : "x"; |
| 2867 |
} |
| 2868 |
function getAxisLength(axis) { |
| 2869 |
return axis === "y" ? "height" : "width"; |
| 2870 |
} |
| 2871 |
function getSideAxis(placement) { |
| 2872 |
const firstChar = placement[0]; |
| 2873 |
return firstChar === "t" || firstChar === "b" ? "y" : "x"; |
| 2874 |
} |
| 2875 |
function getAlignmentAxis(placement) { |
| 2876 |
return getOppositeAxis(getSideAxis(placement)); |
| 2877 |
} |
| 2878 |
function getAlignmentSides(placement, rects, rtl) { |
| 2879 |
if (rtl === void 0) { |
| 2880 |
rtl = false; |
| 2881 |
} |
| 2882 |
const alignment = getAlignment(placement); |
| 2883 |
const alignmentAxis = getAlignmentAxis(placement); |
| 2884 |
const length = getAxisLength(alignmentAxis); |
| 2885 |
let mainAlignmentSide = alignmentAxis === "x" ? alignment === (rtl ? "end" : "start") ? "right" : "left" : alignment === "start" ? "bottom" : "top"; |
| 2886 |
if (rects.reference[length] > rects.floating[length]) { |
| 2887 |
mainAlignmentSide = getOppositePlacement(mainAlignmentSide); |
| 2888 |
} |
| 2889 |
return [mainAlignmentSide, getOppositePlacement(mainAlignmentSide)]; |
| 2890 |
} |
| 2891 |
function getExpandedPlacements(placement) { |
| 2892 |
const oppositePlacement = getOppositePlacement(placement); |
| 2893 |
return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)]; |
| 2894 |
} |
| 2895 |
function getOppositeAlignmentPlacement(placement) { |
| 2896 |
return placement.includes("start") ? placement.replace("start", "end") : placement.replace("end", "start"); |
| 2897 |
} |
| 2898 |
var lrPlacement = ["left", "right"]; |
| 2899 |
var rlPlacement = ["right", "left"]; |
| 2900 |
var tbPlacement = ["top", "bottom"]; |
| 2901 |
var btPlacement = ["bottom", "top"]; |
| 2902 |
function getSideList(side, isStart, rtl) { |
| 2903 |
switch (side) { |
| 2904 |
case "top": |
| 2905 |
case "bottom": |
| 2906 |
if (rtl) return isStart ? rlPlacement : lrPlacement; |
| 2907 |
return isStart ? lrPlacement : rlPlacement; |
| 2908 |
case "left": |
| 2909 |
case "right": |
| 2910 |
return isStart ? tbPlacement : btPlacement; |
| 2911 |
default: |
| 2912 |
return []; |
| 2913 |
} |
| 2914 |
} |
| 2915 |
function getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) { |
| 2916 |
const alignment = getAlignment(placement); |
| 2917 |
let list = getSideList(getSide(placement), direction === "start", rtl); |
| 2918 |
if (alignment) { |
| 2919 |
list = list.map((side) => side + "-" + alignment); |
| 2920 |
if (flipAlignment) { |
| 2921 |
list = list.concat(list.map(getOppositeAlignmentPlacement)); |
| 2922 |
} |
| 2923 |
} |
| 2924 |
return list; |
| 2925 |
} |
| 2926 |
function getOppositePlacement(placement) { |
| 2927 |
const side = getSide(placement); |
| 2928 |
return oppositeSideMap[side] + placement.slice(side.length); |
| 2929 |
} |
| 2930 |
function expandPaddingObject(padding) { |
| 2931 |
var _padding$top, _padding$right, _padding$bottom, _padding$left; |
| 2932 |
return { |
| 2933 |
top: (_padding$top = padding.top) != null ? _padding$top : 0, |
| 2934 |
right: (_padding$right = padding.right) != null ? _padding$right : 0, |
| 2935 |
bottom: (_padding$bottom = padding.bottom) != null ? _padding$bottom : 0, |
| 2936 |
left: (_padding$left = padding.left) != null ? _padding$left : 0 |
| 2937 |
}; |
| 2938 |
} |
| 2939 |
function getPaddingObject(padding) { |
| 2940 |
return typeof padding !== "number" ? expandPaddingObject(padding) : { |
| 2941 |
top: padding, |
| 2942 |
right: padding, |
| 2943 |
bottom: padding, |
| 2944 |
left: padding |
| 2945 |
}; |
| 2946 |
} |
| 2947 |
function rectToClientRect(rect) { |
| 2948 |
const { |
| 2949 |
x, |
| 2950 |
y, |
| 2951 |
width, |
| 2952 |
height |
| 2953 |
} = rect; |
| 2954 |
return { |
| 2955 |
width, |
| 2956 |
height, |
| 2957 |
top: y, |
| 2958 |
left: x, |
| 2959 |
right: x + width, |
| 2960 |
bottom: y + height, |
| 2961 |
x, |
| 2962 |
y |
| 2963 |
}; |
| 2964 |
} |
| 2965 |
|
| 2966 |
// node_modules/@base-ui/react/floating-ui-react/utils/composite.mjs |
| 2967 |
function isHiddenByStyles(styles) { |
| 2968 |
return styles.visibility === "hidden" || styles.visibility === "collapse"; |
| 2969 |
} |
| 2970 |
function isElementVisible(element, styles = element ? getComputedStyle2(element) : null) { |
| 2971 |
if (!element || !element.isConnected || !styles || isHiddenByStyles(styles)) { |
| 2972 |
return false; |
| 2973 |
} |
| 2974 |
if (typeof element.checkVisibility === "function") { |
| 2975 |
return element.checkVisibility(); |
| 2976 |
} |
| 2977 |
return styles.display !== "none" && styles.display !== "contents"; |
| 2978 |
} |
| 2979 |
|
| 2980 |
// node_modules/@base-ui/react/floating-ui-react/utils/tabbable.mjs |
| 2981 |
var CANDIDATE_SELECTOR = 'a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable="false"]),audio[controls],video[controls]'; |
| 2982 |
function getParentElement(element) { |
| 2983 |
const assignedSlot = element.assignedSlot; |
| 2984 |
if (assignedSlot) { |
| 2985 |
return assignedSlot; |
| 2986 |
} |
| 2987 |
if (element.parentElement) { |
| 2988 |
return element.parentElement; |
| 2989 |
} |
| 2990 |
const rootNode = element.getRootNode(); |
| 2991 |
return isShadowRoot(rootNode) ? rootNode.host : null; |
| 2992 |
} |
| 2993 |
function getDetailsSummary(details) { |
| 2994 |
for (const child of Array.from(details.children)) { |
| 2995 |
if (getNodeName(child) === "summary") { |
| 2996 |
return child; |
| 2997 |
} |
| 2998 |
} |
| 2999 |
return null; |
| 3000 |
} |
| 3001 |
function isWithinOpenDetailsSummary(element, details) { |
| 3002 |
const summary = getDetailsSummary(details); |
| 3003 |
return !!summary && (element === summary || contains(summary, element)); |
| 3004 |
} |
| 3005 |
function isFocusableCandidate(element) { |
| 3006 |
const nodeName = element ? getNodeName(element) : ""; |
| 3007 |
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"); |
| 3008 |
} |
| 3009 |
function isFocusableElement(element) { |
| 3010 |
if (!isFocusableCandidate(element) || !element.isConnected || element.matches(":disabled")) { |
| 3011 |
return false; |
| 3012 |
} |
| 3013 |
for (let current = element; current; current = getParentElement(current)) { |
| 3014 |
const isAncestor = current !== element; |
| 3015 |
const isSlot = getNodeName(current) === "slot"; |
| 3016 |
if (current.hasAttribute("inert")) { |
| 3017 |
return false; |
| 3018 |
} |
| 3019 |
if (isAncestor && getNodeName(current) === "details" && !current.open && !isWithinOpenDetailsSummary(element, current) || current.hasAttribute("hidden") || !isSlot && !isVisibleInTabbableTree(current, isAncestor)) { |
| 3020 |
return false; |
| 3021 |
} |
| 3022 |
} |
| 3023 |
return true; |
| 3024 |
} |
| 3025 |
function isVisibleInTabbableTree(element, isAncestor) { |
| 3026 |
const styles = getComputedStyle2(element); |
| 3027 |
if (!isAncestor) { |
| 3028 |
return isElementVisible(element, styles); |
| 3029 |
} |
| 3030 |
return styles.display !== "none"; |
| 3031 |
} |
| 3032 |
function getTabIndex(element) { |
| 3033 |
const tabIndex = element.tabIndex; |
| 3034 |
if (tabIndex < 0) { |
| 3035 |
const nodeName = getNodeName(element); |
| 3036 |
if (nodeName === "details" || nodeName === "audio" || nodeName === "video" || isHTMLElement(element) && element.isContentEditable) { |
| 3037 |
return 0; |
| 3038 |
} |
| 3039 |
} |
| 3040 |
return tabIndex; |
| 3041 |
} |
| 3042 |
function getNamedRadioInput(element) { |
| 3043 |
if (getNodeName(element) !== "input") { |
| 3044 |
return null; |
| 3045 |
} |
| 3046 |
const input = element; |
| 3047 |
return input.type === "radio" && input.name !== "" ? input : null; |
| 3048 |
} |
| 3049 |
function isTabbableRadio(element, candidates) { |
| 3050 |
const input = getNamedRadioInput(element); |
| 3051 |
if (!input) { |
| 3052 |
return true; |
| 3053 |
} |
| 3054 |
const checkedRadio = candidates.find((candidate) => { |
| 3055 |
const radio = getNamedRadioInput(candidate); |
| 3056 |
return radio?.name === input.name && radio.form === input.form && radio.checked; |
| 3057 |
}); |
| 3058 |
if (checkedRadio) { |
| 3059 |
return checkedRadio === input; |
| 3060 |
} |
| 3061 |
return candidates.find((candidate) => { |
| 3062 |
const radio = getNamedRadioInput(candidate); |
| 3063 |
return radio?.name === input.name && radio.form === input.form; |
| 3064 |
}) === input; |
| 3065 |
} |
| 3066 |
function getComposedChildren(container) { |
| 3067 |
if (isHTMLElement(container) && getNodeName(container) === "slot") { |
| 3068 |
const assignedElements = container.assignedElements({ |
| 3069 |
flatten: true |
| 3070 |
}); |
| 3071 |
if (assignedElements.length > 0) { |
| 3072 |
return assignedElements; |
| 3073 |
} |
| 3074 |
} |
| 3075 |
if (isHTMLElement(container) && container.shadowRoot) { |
| 3076 |
return Array.from(container.shadowRoot.children); |
| 3077 |
} |
| 3078 |
return Array.from(container.children); |
| 3079 |
} |
| 3080 |
function appendCandidates(container, list) { |
| 3081 |
getComposedChildren(container).forEach((child) => { |
| 3082 |
if (isFocusableCandidate(child)) { |
| 3083 |
list.push(child); |
| 3084 |
} |
| 3085 |
appendCandidates(child, list); |
| 3086 |
}); |
| 3087 |
} |
| 3088 |
function appendMatchingElements(container, selector, list) { |
| 3089 |
getComposedChildren(container).forEach((child) => { |
| 3090 |
if (isHTMLElement(child) && child.matches(selector)) { |
| 3091 |
list.push(child); |
| 3092 |
} |
| 3093 |
appendMatchingElements(child, selector, list); |
| 3094 |
}); |
| 3095 |
} |
| 3096 |
function focusable(container) { |
| 3097 |
const candidates = []; |
| 3098 |
appendCandidates(container, candidates); |
| 3099 |
return candidates.filter(isFocusableElement); |
| 3100 |
} |
| 3101 |
function tabbable(container) { |
| 3102 |
const candidates = focusable(container); |
| 3103 |
return candidates.filter((element) => getTabIndex(element) >= 0 && isTabbableRadio(element, candidates)); |
| 3104 |
} |
| 3105 |
function getTabbableIn(container, dir) { |
| 3106 |
const list = tabbable(container); |
| 3107 |
const len = list.length; |
| 3108 |
if (len === 0) { |
| 3109 |
return void 0; |
| 3110 |
} |
| 3111 |
const active = activeElement(ownerDocument(container)); |
| 3112 |
const index2 = list.indexOf(active); |
| 3113 |
const nextIndex = index2 === -1 ? dir === 1 ? 0 : len - 1 : index2 + dir; |
| 3114 |
return list[nextIndex]; |
| 3115 |
} |
| 3116 |
function getNextTabbable(referenceElement) { |
| 3117 |
return getTabbableIn(ownerDocument(referenceElement).body, 1) || referenceElement; |
| 3118 |
} |
| 3119 |
function getPreviousTabbable(referenceElement) { |
| 3120 |
return getTabbableIn(ownerDocument(referenceElement).body, -1) || referenceElement; |
| 3121 |
} |
| 3122 |
function isOutsideEvent(event, container) { |
| 3123 |
const containerElement = container || event.currentTarget; |
| 3124 |
const relatedTarget = event.relatedTarget; |
| 3125 |
return !relatedTarget || !contains(containerElement, relatedTarget); |
| 3126 |
} |
| 3127 |
function disableFocusInside(container) { |
| 3128 |
const tabbableElements = tabbable(container); |
| 3129 |
tabbableElements.forEach((element) => { |
| 3130 |
element.dataset.tabindex = element.getAttribute("tabindex") || ""; |
| 3131 |
element.setAttribute("tabindex", "-1"); |
| 3132 |
}); |
| 3133 |
} |
| 3134 |
function enableFocusInside(container) { |
| 3135 |
const elements = []; |
| 3136 |
appendMatchingElements(container, "[data-tabindex]", elements); |
| 3137 |
elements.forEach((element) => { |
| 3138 |
const tabindex = element.dataset.tabindex; |
| 3139 |
delete element.dataset.tabindex; |
| 3140 |
if (tabindex) { |
| 3141 |
element.setAttribute("tabindex", tabindex); |
| 3142 |
} else { |
| 3143 |
element.removeAttribute("tabindex"); |
| 3144 |
} |
| 3145 |
}); |
| 3146 |
} |
| 3147 |
|
| 3148 |
// node_modules/@base-ui/react/floating-ui-react/utils/nodes.mjs |
| 3149 |
function getNodeChildren(nodes, id, onlyOpenChildren = true) { |
| 3150 |
const directChildren = nodes.filter((node) => node.parentId === id); |
| 3151 |
return directChildren.flatMap((child) => [...!onlyOpenChildren || child.context?.open ? [child] : [], ...getNodeChildren(nodes, child.id, onlyOpenChildren)]); |
| 3152 |
} |
| 3153 |
|
| 3154 |
// node_modules/@base-ui/react/floating-ui-react/utils/createAttribute.mjs |
| 3155 |
function createAttribute(name) { |
| 3156 |
return `data-base-ui-${name}`; |
| 3157 |
} |
| 3158 |
|
| 3159 |
// node_modules/@base-ui/react/floating-ui-react/components/FloatingPortal.mjs |
| 3160 |
var React20 = __toESM(require_react(), 1); |
| 3161 |
var ReactDOM2 = __toESM(require_react_dom(), 1); |
| 3162 |
|
| 3163 |
// node_modules/@base-ui/react/internals/constants.mjs |
| 3164 |
var DISABLED_TRANSITIONS_STYLE = { |
| 3165 |
style: { |
| 3166 |
transition: "none" |
| 3167 |
} |
| 3168 |
}; |
| 3169 |
var BASE_UI_SWIPE_IGNORE_ATTRIBUTE = "data-base-ui-swipe-ignore"; |
| 3170 |
var LEGACY_SWIPE_IGNORE_ATTRIBUTE = "data-swipe-ignore"; |
| 3171 |
var BASE_UI_SWIPE_IGNORE_SELECTOR = `[${BASE_UI_SWIPE_IGNORE_ATTRIBUTE}]`; |
| 3172 |
var LEGACY_SWIPE_IGNORE_SELECTOR = `[${LEGACY_SWIPE_IGNORE_ATTRIBUTE}]`; |
| 3173 |
var POPUP_COLLISION_AVOIDANCE = { |
| 3174 |
fallbackAxisSide: "end" |
| 3175 |
}; |
| 3176 |
var ownerVisuallyHidden = { |
| 3177 |
clipPath: "inset(50%)", |
| 3178 |
position: "fixed", |
| 3179 |
top: 0, |
| 3180 |
left: 0 |
| 3181 |
}; |
| 3182 |
|
| 3183 |
// node_modules/@base-ui/react/floating-ui-react/components/FloatingPortal.mjs |
| 3184 |
var import_jsx_runtime3 = __toESM(require_jsx_runtime(), 1); |
| 3185 |
var PortalContext = /* @__PURE__ */ React20.createContext(null); |
| 3186 |
if (true) PortalContext.displayName = "PortalContext"; |
| 3187 |
var usePortalContext = () => React20.useContext(PortalContext); |
| 3188 |
var attr = createAttribute("portal"); |
| 3189 |
function useFloatingPortalNode(props = {}) { |
| 3190 |
const { |
| 3191 |
ref, |
| 3192 |
container: containerProp, |
| 3193 |
componentProps = EMPTY_OBJECT, |
| 3194 |
elementProps |
| 3195 |
} = props; |
| 3196 |
const uniqueId = useId(); |
| 3197 |
const portalContext = usePortalContext(); |
| 3198 |
const parentPortalNode = portalContext?.portalNode; |
| 3199 |
const [containerElement, setContainerElement] = React20.useState(null); |
| 3200 |
const [portalNode, setPortalNode] = React20.useState(null); |
| 3201 |
const setPortalNodeRef = useStableCallback((node) => { |
| 3202 |
if (node !== null) { |
| 3203 |
setPortalNode(node); |
| 3204 |
} |
| 3205 |
}); |
| 3206 |
const containerRef = React20.useRef(null); |
| 3207 |
useIsoLayoutEffect(() => { |
| 3208 |
if (containerProp === null) { |
| 3209 |
if (containerRef.current) { |
| 3210 |
containerRef.current = null; |
| 3211 |
setPortalNode(null); |
| 3212 |
setContainerElement(null); |
| 3213 |
} |
| 3214 |
return; |
| 3215 |
} |
| 3216 |
const resolvedContainer = (containerProp && (isNode(containerProp) ? containerProp : containerProp.current)) ?? parentPortalNode ?? document.body; |
| 3217 |
if (resolvedContainer == null) { |
| 3218 |
if (containerRef.current) { |
| 3219 |
containerRef.current = null; |
| 3220 |
setPortalNode(null); |
| 3221 |
setContainerElement(null); |
| 3222 |
} |
| 3223 |
return; |
| 3224 |
} |
| 3225 |
if (containerRef.current !== resolvedContainer) { |
| 3226 |
containerRef.current = resolvedContainer; |
| 3227 |
setPortalNode(null); |
| 3228 |
setContainerElement(resolvedContainer); |
| 3229 |
} |
| 3230 |
}, [containerProp, parentPortalNode]); |
| 3231 |
const portalElement = useRenderElement("div", componentProps, { |
| 3232 |
ref: [ref, setPortalNodeRef], |
| 3233 |
props: [{ |
| 3234 |
id: uniqueId, |
| 3235 |
[attr]: "" |
| 3236 |
}, elementProps] |
| 3237 |
}); |
| 3238 |
const portalSubtree = containerElement && portalElement ? /* @__PURE__ */ ReactDOM2.createPortal(portalElement, containerElement) : null; |
| 3239 |
return { |
| 3240 |
node: portalNode, |
| 3241 |
// `id` and `render` props can override or remove the generated ID. Use the exact |
| 3242 |
// rendered value so `aria-owns` never points at an ID absent from the DOM. |
| 3243 |
nodeId: /* @__PURE__ */ React20.isValidElement(portalElement) ? portalElement.props.id : void 0, |
| 3244 |
subtree: portalSubtree |
| 3245 |
}; |
| 3246 |
} |
| 3247 |
var FloatingPortal = /* @__PURE__ */ React20.forwardRef(function FloatingPortal2(componentProps, forwardedRef) { |
| 3248 |
const { |
| 3249 |
render, |
| 3250 |
className, |
| 3251 |
style, |
| 3252 |
children, |
| 3253 |
container, |
| 3254 |
portalOwnerRole, |
| 3255 |
...elementProps |
| 3256 |
} = componentProps; |
| 3257 |
const { |
| 3258 |
node: portalNode, |
| 3259 |
nodeId: portalNodeId, |
| 3260 |
subtree: portalSubtree |
| 3261 |
} = useFloatingPortalNode({ |
| 3262 |
container, |
| 3263 |
ref: forwardedRef, |
| 3264 |
componentProps, |
| 3265 |
elementProps |
| 3266 |
}); |
| 3267 |
const beforeOutsideRef = React20.useRef(null); |
| 3268 |
const afterOutsideRef = React20.useRef(null); |
| 3269 |
const beforeInsideRef = React20.useRef(null); |
| 3270 |
const afterInsideRef = React20.useRef(null); |
| 3271 |
const [focusManagerState, setFocusManagerState] = React20.useState(null); |
| 3272 |
const focusInsideDisabledRef = React20.useRef(false); |
| 3273 |
const modal = focusManagerState?.modal; |
| 3274 |
const open3 = focusManagerState?.open; |
| 3275 |
const shouldRenderGuards = !!focusManagerState && !focusManagerState.modal && focusManagerState.open && !!portalNode; |
| 3276 |
React20.useEffect(() => { |
| 3277 |
if (!portalNode || modal) { |
| 3278 |
return void 0; |
| 3279 |
} |
| 3280 |
function onFocus(event) { |
| 3281 |
if (portalNode && event.relatedTarget && isOutsideEvent(event)) { |
| 3282 |
if (event.type === "focusin") { |
| 3283 |
if (focusInsideDisabledRef.current) { |
| 3284 |
enableFocusInside(portalNode); |
| 3285 |
focusInsideDisabledRef.current = false; |
| 3286 |
} |
| 3287 |
} else { |
| 3288 |
disableFocusInside(portalNode); |
| 3289 |
focusInsideDisabledRef.current = true; |
| 3290 |
} |
| 3291 |
} |
| 3292 |
} |
| 3293 |
return mergeCleanups(addEventListener(portalNode, "focusin", onFocus, true), addEventListener(portalNode, "focusout", onFocus, true)); |
| 3294 |
}, [portalNode, modal]); |
| 3295 |
useIsoLayoutEffect(() => { |
| 3296 |
if (!portalNode || open3 !== true || !focusInsideDisabledRef.current) { |
| 3297 |
return; |
| 3298 |
} |
| 3299 |
enableFocusInside(portalNode); |
| 3300 |
focusInsideDisabledRef.current = false; |
| 3301 |
}, [open3, portalNode]); |
| 3302 |
const portalContextValue = React20.useMemo(() => ({ |
| 3303 |
beforeOutsideRef, |
| 3304 |
afterOutsideRef, |
| 3305 |
beforeInsideRef, |
| 3306 |
afterInsideRef, |
| 3307 |
portalNode, |
| 3308 |
setFocusManagerState |
| 3309 |
}), [portalNode]); |
| 3310 |
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(React20.Fragment, { |
| 3311 |
children: [portalSubtree, /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(PortalContext.Provider, { |
| 3312 |
value: portalContextValue, |
| 3313 |
children: [shouldRenderGuards && portalNode && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(FocusGuard, { |
| 3314 |
"data-type": "outside", |
| 3315 |
ref: beforeOutsideRef, |
| 3316 |
onFocus: (event) => { |
| 3317 |
if (isOutsideEvent(event, portalNode)) { |
| 3318 |
beforeInsideRef.current?.focus(); |
| 3319 |
} else { |
| 3320 |
const domReference = focusManagerState ? focusManagerState.domReference : null; |
| 3321 |
const prevTabbable = getPreviousTabbable(domReference); |
| 3322 |
prevTabbable?.focus(); |
| 3323 |
} |
| 3324 |
} |
| 3325 |
}), shouldRenderGuards && portalNode && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { |
| 3326 |
role: portalOwnerRole, |
| 3327 |
"aria-owns": portalNodeId, |
| 3328 |
style: ownerVisuallyHidden |
| 3329 |
}), portalNode && /* @__PURE__ */ ReactDOM2.createPortal(children, portalNode), shouldRenderGuards && portalNode && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(FocusGuard, { |
| 3330 |
"data-type": "outside", |
| 3331 |
ref: afterOutsideRef, |
| 3332 |
onFocus: (event) => { |
| 3333 |
if (isOutsideEvent(event, portalNode)) { |
| 3334 |
afterInsideRef.current?.focus(); |
| 3335 |
} else { |
| 3336 |
const domReference = focusManagerState ? focusManagerState.domReference : null; |
| 3337 |
const nextTabbable = getNextTabbable(domReference); |
| 3338 |
nextTabbable?.focus(); |
| 3339 |
if (focusManagerState?.closeOnFocusOut) { |
| 3340 |
focusManagerState?.onOpenChange(false, createChangeEventDetails(reason_parts_exports.focusOut, event.nativeEvent)); |
| 3341 |
} |
| 3342 |
} |
| 3343 |
} |
| 3344 |
})] |
| 3345 |
})] |
| 3346 |
}); |
| 3347 |
}); |
| 3348 |
if (true) FloatingPortal.displayName = "FloatingPortal"; |
| 3349 |
|
| 3350 |
// node_modules/@base-ui/react/floating-ui-react/components/FloatingTree.mjs |
| 3351 |
var React21 = __toESM(require_react(), 1); |
| 3352 |
|
| 3353 |
// node_modules/@base-ui/react/floating-ui-react/utils/createEventEmitter.mjs |
| 3354 |
function createEventEmitter() { |
| 3355 |
const map = /* @__PURE__ */ new Map(); |
| 3356 |
return { |
| 3357 |
emit(event, data) { |
| 3358 |
map.get(event)?.forEach((listener) => listener(data)); |
| 3359 |
}, |
| 3360 |
on(event, listener) { |
| 3361 |
if (!map.has(event)) { |
| 3362 |
map.set(event, /* @__PURE__ */ new Set()); |
| 3363 |
} |
| 3364 |
map.get(event).add(listener); |
| 3365 |
}, |
| 3366 |
off(event, listener) { |
| 3367 |
map.get(event)?.delete(listener); |
| 3368 |
} |
| 3369 |
}; |
| 3370 |
} |
| 3371 |
|
| 3372 |
// node_modules/@base-ui/react/floating-ui-react/components/FloatingTree.mjs |
| 3373 |
var import_jsx_runtime4 = __toESM(require_jsx_runtime(), 1); |
| 3374 |
var FloatingNodeContext = /* @__PURE__ */ React21.createContext(null); |
| 3375 |
if (true) FloatingNodeContext.displayName = "FloatingNodeContext"; |
| 3376 |
var FloatingTreeContext = /* @__PURE__ */ React21.createContext(null); |
| 3377 |
if (true) FloatingTreeContext.displayName = "FloatingTreeContext"; |
| 3378 |
var useFloatingParentNodeId = () => React21.useContext(FloatingNodeContext)?.id || null; |
| 3379 |
var useFloatingTree = (externalTree) => { |
| 3380 |
const contextTree = React21.useContext(FloatingTreeContext); |
| 3381 |
return externalTree ?? contextTree; |
| 3382 |
}; |
| 3383 |
|
| 3384 |
// node_modules/@base-ui/react/floating-ui-react/hooks/useClientPoint.mjs |
| 3385 |
var React22 = __toESM(require_react(), 1); |
| 3386 |
function createVirtualElement(domElement, data) { |
| 3387 |
let offsetX = null; |
| 3388 |
let offsetY = null; |
| 3389 |
let isAutoUpdateEvent = false; |
| 3390 |
return { |
| 3391 |
contextElement: domElement || void 0, |
| 3392 |
getBoundingClientRect() { |
| 3393 |
const domRect = domElement?.getBoundingClientRect() || { |
| 3394 |
width: 0, |
| 3395 |
height: 0, |
| 3396 |
x: 0, |
| 3397 |
y: 0 |
| 3398 |
}; |
| 3399 |
const isXAxis = data.axis === "x" || data.axis === "both"; |
| 3400 |
const isYAxis = data.axis === "y" || data.axis === "both"; |
| 3401 |
const canTrackCursorOnAutoUpdate = ["mouseenter", "mousemove"].includes(data.dataRef.current.openEvent?.type || "") && data.pointerType !== "touch"; |
| 3402 |
let width = domRect.width; |
| 3403 |
let height = domRect.height; |
| 3404 |
let x = domRect.x; |
| 3405 |
let y = domRect.y; |
| 3406 |
if (offsetX == null && data.x && isXAxis) { |
| 3407 |
offsetX = domRect.x - data.x; |
| 3408 |
} |
| 3409 |
if (offsetY == null && data.y && isYAxis) { |
| 3410 |
offsetY = domRect.y - data.y; |
| 3411 |
} |
| 3412 |
x -= offsetX || 0; |
| 3413 |
y -= offsetY || 0; |
| 3414 |
width = 0; |
| 3415 |
height = 0; |
| 3416 |
if (!isAutoUpdateEvent || canTrackCursorOnAutoUpdate) { |
| 3417 |
width = data.axis === "y" ? domRect.width : 0; |
| 3418 |
height = data.axis === "x" ? domRect.height : 0; |
| 3419 |
x = isXAxis && data.x != null ? data.x : x; |
| 3420 |
y = isYAxis && data.y != null ? data.y : y; |
| 3421 |
} else if (isAutoUpdateEvent && !canTrackCursorOnAutoUpdate) { |
| 3422 |
height = data.axis === "x" ? domRect.height : height; |
| 3423 |
width = data.axis === "y" ? domRect.width : width; |
| 3424 |
} |
| 3425 |
isAutoUpdateEvent = true; |
| 3426 |
return { |
| 3427 |
width, |
| 3428 |
height, |
| 3429 |
x, |
| 3430 |
y, |
| 3431 |
top: y, |
| 3432 |
right: x + width, |
| 3433 |
bottom: y + height, |
| 3434 |
left: x |
| 3435 |
}; |
| 3436 |
} |
| 3437 |
}; |
| 3438 |
} |
| 3439 |
function isMouseBasedEvent(event) { |
| 3440 |
return event != null && event.clientX != null; |
| 3441 |
} |
| 3442 |
function useClientPoint(context, props = {}) { |
| 3443 |
const { |
| 3444 |
enabled = true, |
| 3445 |
axis = "both" |
| 3446 |
} = props; |
| 3447 |
const store2 = "rootStore" in context ? context.rootStore : context; |
| 3448 |
const open3 = store2.useState("open"); |
| 3449 |
const floating = store2.useState("floatingElement"); |
| 3450 |
const domReference = store2.useState("domReferenceElement"); |
| 3451 |
const dataRef = store2.context.dataRef; |
| 3452 |
const initialRef = React22.useRef(false); |
| 3453 |
const cleanupListenerRef = React22.useRef(null); |
| 3454 |
const [pointerType, setPointerType] = React22.useState(); |
| 3455 |
const [reactive, setReactive] = React22.useState([]); |
| 3456 |
const resetReference = useStableCallback((reference2) => { |
| 3457 |
store2.set("positionReference", reference2); |
| 3458 |
}); |
| 3459 |
const setReference = useStableCallback((newX, newY, referenceElement) => { |
| 3460 |
if (initialRef.current) { |
| 3461 |
return; |
| 3462 |
} |
| 3463 |
if (dataRef.current.openEvent && !isMouseBasedEvent(dataRef.current.openEvent)) { |
| 3464 |
return; |
| 3465 |
} |
| 3466 |
store2.set("positionReference", createVirtualElement(referenceElement ?? domReference, { |
| 3467 |
x: newX, |
| 3468 |
y: newY, |
| 3469 |
axis, |
| 3470 |
dataRef, |
| 3471 |
pointerType |
| 3472 |
})); |
| 3473 |
}); |
| 3474 |
const handleReferenceEnterOrMove = useStableCallback((event) => { |
| 3475 |
if (!open3) { |
| 3476 |
setReference(event.clientX, event.clientY, event.currentTarget); |
| 3477 |
} else if (!cleanupListenerRef.current) { |
| 3478 |
setReference(event.clientX, event.clientY, event.currentTarget); |
| 3479 |
setReactive([]); |
| 3480 |
} |
| 3481 |
}); |
| 3482 |
const openCheck = isMouseLikePointerType(pointerType) ? floating : open3; |
| 3483 |
React22.useEffect(() => { |
| 3484 |
if (!enabled) { |
| 3485 |
resetReference(domReference); |
| 3486 |
return void 0; |
| 3487 |
} |
| 3488 |
if (!openCheck) { |
| 3489 |
return void 0; |
| 3490 |
} |
| 3491 |
function cleanupListener() { |
| 3492 |
cleanupListenerRef.current?.(); |
| 3493 |
cleanupListenerRef.current = null; |
| 3494 |
} |
| 3495 |
const win = getWindow(floating); |
| 3496 |
function handleMouseMove(event) { |
| 3497 |
const target = getTarget(event); |
| 3498 |
if (!contains(floating, target)) { |
| 3499 |
setReference(event.clientX, event.clientY); |
| 3500 |
} else { |
| 3501 |
cleanupListener(); |
| 3502 |
} |
| 3503 |
} |
| 3504 |
if (!dataRef.current.openEvent || isMouseBasedEvent(dataRef.current.openEvent)) { |
| 3505 |
cleanupListenerRef.current = addEventListener(win, "mousemove", handleMouseMove); |
| 3506 |
} else { |
| 3507 |
resetReference(domReference); |
| 3508 |
} |
| 3509 |
return cleanupListener; |
| 3510 |
}, [openCheck, enabled, floating, dataRef, domReference, store2, setReference, resetReference, reactive]); |
| 3511 |
React22.useEffect(() => () => { |
| 3512 |
store2.set("positionReference", null); |
| 3513 |
}, [store2]); |
| 3514 |
React22.useEffect(() => { |
| 3515 |
if (enabled && !floating) { |
| 3516 |
initialRef.current = false; |
| 3517 |
} |
| 3518 |
}, [enabled, floating]); |
| 3519 |
React22.useEffect(() => { |
| 3520 |
if (!enabled && open3) { |
| 3521 |
initialRef.current = true; |
| 3522 |
} |
| 3523 |
}, [enabled, open3]); |
| 3524 |
const reference = React22.useMemo(() => { |
| 3525 |
function setPointerTypeRef(event) { |
| 3526 |
setPointerType(event.pointerType); |
| 3527 |
} |
| 3528 |
return { |
| 3529 |
onPointerDown: setPointerTypeRef, |
| 3530 |
onPointerEnter: setPointerTypeRef, |
| 3531 |
onMouseMove: handleReferenceEnterOrMove, |
| 3532 |
onMouseEnter: handleReferenceEnterOrMove |
| 3533 |
}; |
| 3534 |
}, [handleReferenceEnterOrMove]); |
| 3535 |
return React22.useMemo(() => enabled ? { |
| 3536 |
reference, |
| 3537 |
trigger: reference |
| 3538 |
} : {}, [enabled, reference]); |
| 3539 |
} |
| 3540 |
|
| 3541 |
// node_modules/@base-ui/react/floating-ui-react/hooks/useDismiss.mjs |
| 3542 |
var React23 = __toESM(require_react(), 1); |
| 3543 |
function alwaysFalse() { |
| 3544 |
return false; |
| 3545 |
} |
| 3546 |
function normalizeProp(normalizable) { |
| 3547 |
return { |
| 3548 |
escapeKey: typeof normalizable === "boolean" ? normalizable : normalizable?.escapeKey ?? false, |
| 3549 |
outsidePress: typeof normalizable === "boolean" ? normalizable : normalizable?.outsidePress ?? true |
| 3550 |
}; |
| 3551 |
} |
| 3552 |
function useDismiss(context, props = {}) { |
| 3553 |
const { |
| 3554 |
enabled = true, |
| 3555 |
escapeKey: escapeKey2 = true, |
| 3556 |
outsidePress: outsidePressProp = true, |
| 3557 |
outsidePressEvent = "sloppy", |
| 3558 |
referencePress = alwaysFalse, |
| 3559 |
bubbles, |
| 3560 |
externalTree |
| 3561 |
} = props; |
| 3562 |
const store2 = "rootStore" in context ? context.rootStore : context; |
| 3563 |
const open3 = store2.useState("open"); |
| 3564 |
const floatingElement = store2.useState("floatingElement"); |
| 3565 |
const { |
| 3566 |
dataRef, |
| 3567 |
events |
| 3568 |
} = store2.context; |
| 3569 |
const tree = useFloatingTree(externalTree); |
| 3570 |
const outsidePressFn = useStableCallback(typeof outsidePressProp === "function" ? outsidePressProp : () => false); |
| 3571 |
const outsidePress2 = typeof outsidePressProp === "function" ? outsidePressFn : outsidePressProp; |
| 3572 |
const outsidePressEnabled = outsidePress2 !== false; |
| 3573 |
const getOutsidePressEventProp = useStableCallback(() => outsidePressEvent); |
| 3574 |
const { |
| 3575 |
escapeKey: escapeKeyBubbles, |
| 3576 |
outsidePress: outsidePressBubbles |
| 3577 |
} = normalizeProp(bubbles); |
| 3578 |
const pressStartedInsideRef = React23.useRef(false); |
| 3579 |
const pressStartPreventedRef = React23.useRef(false); |
| 3580 |
const suppressNextOutsideClickRef = React23.useRef(false); |
| 3581 |
const sawPressWhileOpenRef = React23.useRef(false); |
| 3582 |
const isComposingRef = React23.useRef(false); |
| 3583 |
const currentPointerTypeRef = React23.useRef(""); |
| 3584 |
const touchStateRef = React23.useRef(null); |
| 3585 |
const cancelDismissOnEndTimeout = useTimeout(); |
| 3586 |
const clearInsideReactTreeTimeout = useTimeout(); |
| 3587 |
const clearInsideReactTree = useStableCallback(() => { |
| 3588 |
clearInsideReactTreeTimeout.clear(); |
| 3589 |
dataRef.current.insideReactTree = false; |
| 3590 |
}); |
| 3591 |
const hasBlockingChild = useStableCallback((bubbleKey) => { |
| 3592 |
const nodeId = dataRef.current.floatingContext?.nodeId; |
| 3593 |
const children = tree ? getNodeChildren(tree.nodesRef.current, nodeId) : []; |
| 3594 |
return children.some((child) => child.context?.open && !child.context.dataRef.current[bubbleKey]); |
| 3595 |
}); |
| 3596 |
const isEventWithinOwnElements = useStableCallback((event) => { |
| 3597 |
return isEventTargetWithin(event, store2.select("floatingElement")) || isEventTargetWithin(event, store2.select("domReferenceElement")); |
| 3598 |
}); |
| 3599 |
const closeOnReferencePress = useStableCallback((event) => { |
| 3600 |
if (!referencePress()) { |
| 3601 |
return; |
| 3602 |
} |
| 3603 |
store2.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerPress, event.nativeEvent)); |
| 3604 |
}); |
| 3605 |
const closeOnEscapeKeyDown = useStableCallback((event) => { |
| 3606 |
if (!open3 || !enabled || !escapeKey2 || event.key !== "Escape") { |
| 3607 |
return; |
| 3608 |
} |
| 3609 |
if (isComposingRef.current) { |
| 3610 |
return; |
| 3611 |
} |
| 3612 |
if (!escapeKeyBubbles && hasBlockingChild("__escapeKeyBubbles")) { |
| 3613 |
return; |
| 3614 |
} |
| 3615 |
const native = isReactEvent(event) ? event.nativeEvent : event; |
| 3616 |
const eventDetails = createChangeEventDetails(reason_parts_exports.escapeKey, native); |
| 3617 |
store2.setOpen(false, eventDetails); |
| 3618 |
if (!eventDetails.isCanceled) { |
| 3619 |
event.preventDefault(); |
| 3620 |
} |
| 3621 |
if (!escapeKeyBubbles && !eventDetails.isPropagationAllowed) { |
| 3622 |
event.stopPropagation(); |
| 3623 |
} |
| 3624 |
}); |
| 3625 |
const markInsideReactTree = useStableCallback(() => { |
| 3626 |
dataRef.current.insideReactTree = true; |
| 3627 |
clearInsideReactTreeTimeout.start(0, clearInsideReactTree); |
| 3628 |
}); |
| 3629 |
const markPressStartedInsideReactTree = useStableCallback((event) => { |
| 3630 |
if (!open3 || !enabled || event.button !== 0) { |
| 3631 |
return; |
| 3632 |
} |
| 3633 |
const target = getTarget(event.nativeEvent); |
| 3634 |
if (!contains(store2.select("floatingElement"), target)) { |
| 3635 |
return; |
| 3636 |
} |
| 3637 |
if (!pressStartedInsideRef.current) { |
| 3638 |
pressStartedInsideRef.current = true; |
| 3639 |
pressStartPreventedRef.current = false; |
| 3640 |
} |
| 3641 |
}); |
| 3642 |
const markInsidePressStartPrevented = useStableCallback((event) => { |
| 3643 |
if (!open3 || !enabled) { |
| 3644 |
return; |
| 3645 |
} |
| 3646 |
if (!(event.defaultPrevented || event.nativeEvent.defaultPrevented)) { |
| 3647 |
return; |
| 3648 |
} |
| 3649 |
if (pressStartedInsideRef.current) { |
| 3650 |
pressStartPreventedRef.current = true; |
| 3651 |
} |
| 3652 |
}); |
| 3653 |
React23.useEffect(() => { |
| 3654 |
function handleOpenChange(details) { |
| 3655 |
if (!details.open) { |
| 3656 |
sawPressWhileOpenRef.current = false; |
| 3657 |
} |
| 3658 |
} |
| 3659 |
events.on("openchange", handleOpenChange); |
| 3660 |
return () => { |
| 3661 |
events.off("openchange", handleOpenChange); |
| 3662 |
}; |
| 3663 |
}, [events]); |
| 3664 |
React23.useEffect(() => { |
| 3665 |
if (!open3 || !enabled) { |
| 3666 |
if (!open3) { |
| 3667 |
sawPressWhileOpenRef.current = false; |
| 3668 |
} |
| 3669 |
return clearInsideReactTree; |
| 3670 |
} |
| 3671 |
dataRef.current.__escapeKeyBubbles = escapeKeyBubbles; |
| 3672 |
dataRef.current.__outsidePressBubbles = outsidePressBubbles; |
| 3673 |
const compositionTimeout = new Timeout(); |
| 3674 |
const preventedPressSuppressionTimeout = new Timeout(); |
| 3675 |
const doc = ownerDocument(floatingElement); |
| 3676 |
function handleCompositionStart() { |
| 3677 |
compositionTimeout.clear(); |
| 3678 |
isComposingRef.current = true; |
| 3679 |
} |
| 3680 |
function handleCompositionEnd() { |
| 3681 |
compositionTimeout.start( |
| 3682 |
// 0ms or 1ms don't work in Safari. 5ms appears to consistently work. |
| 3683 |
// Only apply to WebKit for the test to remain 0ms. |
| 3684 |
parts_exports.engine.webkit ? 5 : 0, |
| 3685 |
() => { |
| 3686 |
isComposingRef.current = false; |
| 3687 |
} |
| 3688 |
); |
| 3689 |
} |
| 3690 |
function suppressImmediateOutsideClickAfterPreventedStart() { |
| 3691 |
suppressNextOutsideClickRef.current = true; |
| 3692 |
preventedPressSuppressionTimeout.start(0, () => { |
| 3693 |
suppressNextOutsideClickRef.current = false; |
| 3694 |
}); |
| 3695 |
} |
| 3696 |
function resetPressStartState() { |
| 3697 |
pressStartedInsideRef.current = false; |
| 3698 |
pressStartPreventedRef.current = false; |
| 3699 |
} |
| 3700 |
function getOutsidePressEvent() { |
| 3701 |
const type = currentPointerTypeRef.current; |
| 3702 |
const computedType = type === "pen" || !type ? "mouse" : type; |
| 3703 |
const outsidePressEventValue = getOutsidePressEventProp(); |
| 3704 |
const resolved = typeof outsidePressEventValue === "function" ? outsidePressEventValue() : outsidePressEventValue; |
| 3705 |
if (typeof resolved === "string") { |
| 3706 |
return resolved; |
| 3707 |
} |
| 3708 |
return resolved[computedType]; |
| 3709 |
} |
| 3710 |
function shouldIgnoreEvent(event) { |
| 3711 |
const computedOutsidePressEvent = getOutsidePressEvent(); |
| 3712 |
return computedOutsidePressEvent === "intentional" && event.type !== "click" || computedOutsidePressEvent === "sloppy" && event.type === "click"; |
| 3713 |
} |
| 3714 |
function isEventWithinFloatingTree(event) { |
| 3715 |
const nodeId = dataRef.current.floatingContext?.nodeId; |
| 3716 |
const targetIsInsideChildren = tree && getNodeChildren(tree.nodesRef.current, nodeId).some((node) => isEventTargetWithin(event, node.context?.elements.floating)); |
| 3717 |
return isEventWithinOwnElements(event) || targetIsInsideChildren; |
| 3718 |
} |
| 3719 |
function closeOnPressOutside(event) { |
| 3720 |
if (shouldIgnoreEvent(event)) { |
| 3721 |
if (event.type !== "click" && !isEventWithinOwnElements(event)) { |
| 3722 |
preventedPressSuppressionTimeout.clear(); |
| 3723 |
suppressNextOutsideClickRef.current = false; |
| 3724 |
} |
| 3725 |
clearInsideReactTree(); |
| 3726 |
return; |
| 3727 |
} |
| 3728 |
if (dataRef.current.insideReactTree) { |
| 3729 |
clearInsideReactTree(); |
| 3730 |
return; |
| 3731 |
} |
| 3732 |
const target = getTarget(event); |
| 3733 |
const inertSelector = `[${createAttribute("inert")}]`; |
| 3734 |
const targetRoot = isElement(target) ? target.getRootNode() : null; |
| 3735 |
const markers = Array.from((isShadowRoot(targetRoot) ? targetRoot : ownerDocument(store2.select("floatingElement"))).querySelectorAll(inertSelector)); |
| 3736 |
const triggers = store2.context.triggerElements; |
| 3737 |
if (target && (triggers.hasElement(target) || triggers.hasMatchingElement((trigger) => contains(trigger, target)))) { |
| 3738 |
return; |
| 3739 |
} |
| 3740 |
let targetRootAncestor = isElement(target) ? target : null; |
| 3741 |
while (targetRootAncestor && !isLastTraversableNode(targetRootAncestor)) { |
| 3742 |
const nextParent = getParentNode(targetRootAncestor); |
| 3743 |
if (isLastTraversableNode(nextParent) || !isElement(nextParent)) { |
| 3744 |
break; |
| 3745 |
} |
| 3746 |
targetRootAncestor = nextParent; |
| 3747 |
} |
| 3748 |
if (markers.length && isElement(target) && !isRootElement(target) && // Clicked on a direct ancestor (e.g. FloatingOverlay). |
| 3749 |
!contains(target, store2.select("floatingElement")) && // If the target root element contains none of the markers, then the |
| 3750 |
// element was injected after the floating element rendered. |
| 3751 |
markers.every((marker) => !contains(targetRootAncestor, marker))) { |
| 3752 |
return; |
| 3753 |
} |
| 3754 |
if (isHTMLElement(target) && !("touches" in event)) { |
| 3755 |
const lastTraversableNode = isLastTraversableNode(target); |
| 3756 |
const style = getComputedStyle2(target); |
| 3757 |
const scrollRe = /auto|scroll/; |
| 3758 |
const isScrollableX = lastTraversableNode || scrollRe.test(style.overflowX); |
| 3759 |
const isScrollableY = lastTraversableNode || scrollRe.test(style.overflowY); |
| 3760 |
const canScrollX = isScrollableX && target.clientWidth > 0 && target.scrollWidth > target.clientWidth; |
| 3761 |
const canScrollY = isScrollableY && target.clientHeight > 0 && target.scrollHeight > target.clientHeight; |
| 3762 |
const isRTL4 = style.direction === "rtl"; |
| 3763 |
const pressedVerticalScrollbar = canScrollY && (isRTL4 ? event.offsetX <= target.offsetWidth - target.clientWidth : event.offsetX > target.clientWidth); |
| 3764 |
const pressedHorizontalScrollbar = canScrollX && event.offsetY > target.clientHeight; |
| 3765 |
if (pressedVerticalScrollbar || pressedHorizontalScrollbar) { |
| 3766 |
return; |
| 3767 |
} |
| 3768 |
} |
| 3769 |
if (isEventWithinFloatingTree(event)) { |
| 3770 |
return; |
| 3771 |
} |
| 3772 |
if (getOutsidePressEvent() === "intentional") { |
| 3773 |
if (event.detail !== 0 && !isVirtualClick(event) && !sawPressWhileOpenRef.current) { |
| 3774 |
return; |
| 3775 |
} |
| 3776 |
if (suppressNextOutsideClickRef.current) { |
| 3777 |
preventedPressSuppressionTimeout.clear(); |
| 3778 |
suppressNextOutsideClickRef.current = false; |
| 3779 |
return; |
| 3780 |
} |
| 3781 |
} |
| 3782 |
if (typeof outsidePress2 === "function" && !outsidePress2(event)) { |
| 3783 |
return; |
| 3784 |
} |
| 3785 |
if (hasBlockingChild("__outsidePressBubbles")) { |
| 3786 |
return; |
| 3787 |
} |
| 3788 |
store2.setOpen(false, createChangeEventDetails(reason_parts_exports.outsidePress, event)); |
| 3789 |
clearInsideReactTree(); |
| 3790 |
} |
| 3791 |
function handlePointerDown(event) { |
| 3792 |
if (getOutsidePressEvent() !== "sloppy" || event.pointerType === "touch" || !store2.select("open") || !enabled || isEventWithinOwnElements(event)) { |
| 3793 |
return; |
| 3794 |
} |
| 3795 |
closeOnPressOutside(event); |
| 3796 |
} |
| 3797 |
function handleTouchStart(event) { |
| 3798 |
if (getOutsidePressEvent() !== "sloppy" || !store2.select("open") || !enabled || isEventWithinOwnElements(event)) { |
| 3799 |
return; |
| 3800 |
} |
| 3801 |
const touch = event.touches[0]; |
| 3802 |
if (touch) { |
| 3803 |
touchStateRef.current = { |
| 3804 |
startTime: Date.now(), |
| 3805 |
startX: touch.clientX, |
| 3806 |
startY: touch.clientY, |
| 3807 |
dismissOnTouchEnd: false, |
| 3808 |
dismissOnMouseDown: true |
| 3809 |
}; |
| 3810 |
cancelDismissOnEndTimeout.start(1e3, () => { |
| 3811 |
if (touchStateRef.current) { |
| 3812 |
touchStateRef.current.dismissOnTouchEnd = false; |
| 3813 |
touchStateRef.current.dismissOnMouseDown = false; |
| 3814 |
} |
| 3815 |
}); |
| 3816 |
} |
| 3817 |
} |
| 3818 |
function addTargetEventListenerOnce(event, listener) { |
| 3819 |
const target = getTarget(event); |
| 3820 |
if (!target) { |
| 3821 |
return; |
| 3822 |
} |
| 3823 |
const unsubscribe2 = addEventListener(target, event.type, () => { |
| 3824 |
listener(event); |
| 3825 |
unsubscribe2(); |
| 3826 |
}); |
| 3827 |
} |
| 3828 |
function handleTouchStartCapture(event) { |
| 3829 |
currentPointerTypeRef.current = "touch"; |
| 3830 |
addTargetEventListenerOnce(event, handleTouchStart); |
| 3831 |
} |
| 3832 |
function closeOnPressOutsideCapture(event) { |
| 3833 |
cancelDismissOnEndTimeout.clear(); |
| 3834 |
if (event.type === "pointerdown") { |
| 3835 |
if (event.button === 0) { |
| 3836 |
sawPressWhileOpenRef.current = true; |
| 3837 |
} |
| 3838 |
currentPointerTypeRef.current = event.pointerType; |
| 3839 |
} |
| 3840 |
if (event.type === "mousedown" && touchStateRef.current && !touchStateRef.current.dismissOnMouseDown) { |
| 3841 |
return; |
| 3842 |
} |
| 3843 |
addTargetEventListenerOnce(event, (targetEvent) => { |
| 3844 |
if (targetEvent.type === "pointerdown") { |
| 3845 |
handlePointerDown(targetEvent); |
| 3846 |
} else { |
| 3847 |
closeOnPressOutside(targetEvent); |
| 3848 |
} |
| 3849 |
}); |
| 3850 |
} |
| 3851 |
function handlePressEndCapture(event) { |
| 3852 |
if (event.type === "pointercancel") { |
| 3853 |
sawPressWhileOpenRef.current = false; |
| 3854 |
} |
| 3855 |
if (!pressStartedInsideRef.current) { |
| 3856 |
return; |
| 3857 |
} |
| 3858 |
const pressStartedInsideDefaultPrevented = pressStartPreventedRef.current; |
| 3859 |
resetPressStartState(); |
| 3860 |
if (getOutsidePressEvent() !== "intentional") { |
| 3861 |
return; |
| 3862 |
} |
| 3863 |
if (event.type === "pointercancel") { |
| 3864 |
if (pressStartedInsideDefaultPrevented) { |
| 3865 |
suppressImmediateOutsideClickAfterPreventedStart(); |
| 3866 |
} |
| 3867 |
return; |
| 3868 |
} |
| 3869 |
if (isEventWithinFloatingTree(event)) { |
| 3870 |
return; |
| 3871 |
} |
| 3872 |
if (pressStartedInsideDefaultPrevented) { |
| 3873 |
suppressImmediateOutsideClickAfterPreventedStart(); |
| 3874 |
return; |
| 3875 |
} |
| 3876 |
if (typeof outsidePress2 === "function" && !outsidePress2(event)) { |
| 3877 |
return; |
| 3878 |
} |
| 3879 |
preventedPressSuppressionTimeout.clear(); |
| 3880 |
suppressNextOutsideClickRef.current = true; |
| 3881 |
clearInsideReactTree(); |
| 3882 |
} |
| 3883 |
function handleTouchMove(event) { |
| 3884 |
if (getOutsidePressEvent() !== "sloppy" || !touchStateRef.current || isEventWithinOwnElements(event)) { |
| 3885 |
return; |
| 3886 |
} |
| 3887 |
const touch = event.touches[0]; |
| 3888 |
if (!touch) { |
| 3889 |
return; |
| 3890 |
} |
| 3891 |
const deltaX = Math.abs(touch.clientX - touchStateRef.current.startX); |
| 3892 |
const deltaY = Math.abs(touch.clientY - touchStateRef.current.startY); |
| 3893 |
const distance = Math.sqrt(deltaX * deltaX + deltaY * deltaY); |
| 3894 |
if (distance > 5) { |
| 3895 |
touchStateRef.current.dismissOnTouchEnd = true; |
| 3896 |
} |
| 3897 |
if (distance > 10) { |
| 3898 |
closeOnPressOutside(event); |
| 3899 |
cancelDismissOnEndTimeout.clear(); |
| 3900 |
touchStateRef.current = null; |
| 3901 |
} |
| 3902 |
} |
| 3903 |
function handleTouchMoveCapture(event) { |
| 3904 |
addTargetEventListenerOnce(event, handleTouchMove); |
| 3905 |
} |
| 3906 |
function handleTouchEnd(event) { |
| 3907 |
if (getOutsidePressEvent() !== "sloppy" || !touchStateRef.current || isEventWithinOwnElements(event)) { |
| 3908 |
return; |
| 3909 |
} |
| 3910 |
if (touchStateRef.current.dismissOnTouchEnd) { |
| 3911 |
closeOnPressOutside(event); |
| 3912 |
} |
| 3913 |
cancelDismissOnEndTimeout.clear(); |
| 3914 |
touchStateRef.current = null; |
| 3915 |
} |
| 3916 |
function handleTouchEndCapture(event) { |
| 3917 |
addTargetEventListenerOnce(event, handleTouchEnd); |
| 3918 |
} |
| 3919 |
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, { |
| 3920 |
capture: true, |
| 3921 |
passive: true |
| 3922 |
}), addEventListener(doc, "touchmove", handleTouchMoveCapture, { |
| 3923 |
capture: true, |
| 3924 |
passive: true |
| 3925 |
}), addEventListener(doc, "touchend", handleTouchEndCapture, { |
| 3926 |
capture: true, |
| 3927 |
passive: true |
| 3928 |
}))); |
| 3929 |
return () => { |
| 3930 |
unsubscribe(); |
| 3931 |
compositionTimeout.clear(); |
| 3932 |
preventedPressSuppressionTimeout.clear(); |
| 3933 |
resetPressStartState(); |
| 3934 |
suppressNextOutsideClickRef.current = false; |
| 3935 |
clearInsideReactTree(); |
| 3936 |
}; |
| 3937 |
}, [dataRef, floatingElement, escapeKey2, outsidePressEnabled, outsidePress2, open3, enabled, escapeKeyBubbles, outsidePressBubbles, closeOnEscapeKeyDown, clearInsideReactTree, getOutsidePressEventProp, hasBlockingChild, isEventWithinOwnElements, tree, store2, cancelDismissOnEndTimeout]); |
| 3938 |
const reference = React23.useMemo(() => ({ |
| 3939 |
onKeyDown: closeOnEscapeKeyDown, |
| 3940 |
onPointerDown: closeOnReferencePress, |
| 3941 |
onClick: closeOnReferencePress |
| 3942 |
}), [closeOnEscapeKeyDown, closeOnReferencePress]); |
| 3943 |
const floating = React23.useMemo(() => ({ |
| 3944 |
onKeyDown: closeOnEscapeKeyDown, |
| 3945 |
// `onMouseDown` may be blocked if `event.preventDefault()` is called in |
| 3946 |
// `onPointerDown`, such as with <NumberField.ScrubArea>. |
| 3947 |
// See https://github.com/mui/base-ui/pull/3379 |
| 3948 |
onPointerDown: markInsidePressStartPrevented, |
| 3949 |
onMouseDown: markInsidePressStartPrevented, |
| 3950 |
onClickCapture: markInsideReactTree, |
| 3951 |
onMouseDownCapture(event) { |
| 3952 |
markInsideReactTree(); |
| 3953 |
markPressStartedInsideReactTree(event); |
| 3954 |
}, |
| 3955 |
onPointerDownCapture(event) { |
| 3956 |
markInsideReactTree(); |
| 3957 |
markPressStartedInsideReactTree(event); |
| 3958 |
}, |
| 3959 |
onMouseUpCapture: markInsideReactTree, |
| 3960 |
onTouchEndCapture: markInsideReactTree, |
| 3961 |
onTouchMoveCapture: markInsideReactTree |
| 3962 |
}), [closeOnEscapeKeyDown, markInsideReactTree, markPressStartedInsideReactTree, markInsidePressStartPrevented]); |
| 3963 |
return React23.useMemo(() => enabled ? { |
| 3964 |
reference, |
| 3965 |
floating, |
| 3966 |
trigger: reference |
| 3967 |
} : {}, [enabled, reference, floating]); |
| 3968 |
} |
| 3969 |
|
| 3970 |
// node_modules/@base-ui/react/floating-ui-react/hooks/useFloating.mjs |
| 3971 |
var React31 = __toESM(require_react(), 1); |
| 3972 |
|
| 3973 |
// node_modules/@floating-ui/core/dist/floating-ui.core.mjs |
| 3974 |
function computeCoordsFromPlacement(_ref, placement, rtl) { |
| 3975 |
let { |
| 3976 |
reference, |
| 3977 |
floating |
| 3978 |
} = _ref; |
| 3979 |
const sideAxis = getSideAxis(placement); |
| 3980 |
const alignmentAxis = getAlignmentAxis(placement); |
| 3981 |
const alignLength = getAxisLength(alignmentAxis); |
| 3982 |
const side = getSide(placement); |
| 3983 |
const isVertical = sideAxis === "y"; |
| 3984 |
const commonX = reference.x + reference.width / 2 - floating.width / 2; |
| 3985 |
const commonY = reference.y + reference.height / 2 - floating.height / 2; |
| 3986 |
const commonAlign = reference[alignLength] / 2 - floating[alignLength] / 2; |
| 3987 |
let coords; |
| 3988 |
switch (side) { |
| 3989 |
case "top": |
| 3990 |
coords = { |
| 3991 |
x: commonX, |
| 3992 |
y: reference.y - floating.height |
| 3993 |
}; |
| 3994 |
break; |
| 3995 |
case "bottom": |
| 3996 |
coords = { |
| 3997 |
x: commonX, |
| 3998 |
y: reference.y + reference.height |
| 3999 |
}; |
| 4000 |
break; |
| 4001 |
case "right": |
| 4002 |
coords = { |
| 4003 |
x: reference.x + reference.width, |
| 4004 |
y: commonY |
| 4005 |
}; |
| 4006 |
break; |
| 4007 |
case "left": |
| 4008 |
coords = { |
| 4009 |
x: reference.x - floating.width, |
| 4010 |
y: commonY |
| 4011 |
}; |
| 4012 |
break; |
| 4013 |
default: |
| 4014 |
coords = { |
| 4015 |
x: reference.x, |
| 4016 |
y: reference.y |
| 4017 |
}; |
| 4018 |
} |
| 4019 |
const alignment = getAlignment(placement); |
| 4020 |
if (alignment) { |
| 4021 |
coords[alignmentAxis] += commonAlign * (alignment === "end" ? 1 : -1) * (rtl && isVertical ? -1 : 1); |
| 4022 |
} |
| 4023 |
return coords; |
| 4024 |
} |
| 4025 |
async function detectOverflow(state, options) { |
| 4026 |
var _await$platform$isEle; |
| 4027 |
if (options === void 0) { |
| 4028 |
options = {}; |
| 4029 |
} |
| 4030 |
const { |
| 4031 |
x, |
| 4032 |
y, |
| 4033 |
platform: platform3, |
| 4034 |
rects, |
| 4035 |
elements, |
| 4036 |
strategy |
| 4037 |
} = state; |
| 4038 |
const { |
| 4039 |
boundary = "clippingAncestors", |
| 4040 |
rootBoundary = "viewport", |
| 4041 |
elementContext = "floating", |
| 4042 |
altBoundary = false, |
| 4043 |
padding = 0 |
| 4044 |
} = evaluate(options, state); |
| 4045 |
const paddingObject = getPaddingObject(padding); |
| 4046 |
const altContext = elementContext === "floating" ? "reference" : "floating"; |
| 4047 |
const element = elements[altBoundary ? altContext : elementContext]; |
| 4048 |
const clippingClientRect = rectToClientRect(await platform3.getClippingRect({ |
| 4049 |
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)), |
| 4050 |
boundary, |
| 4051 |
rootBoundary, |
| 4052 |
strategy |
| 4053 |
})); |
| 4054 |
const rect = elementContext === "floating" ? { |
| 4055 |
x, |
| 4056 |
y, |
| 4057 |
width: rects.floating.width, |
| 4058 |
height: rects.floating.height |
| 4059 |
} : rects.reference; |
| 4060 |
const offsetParent = await (platform3.getOffsetParent == null ? void 0 : platform3.getOffsetParent(elements.floating)); |
| 4061 |
const offsetScale = await (platform3.isElement == null ? void 0 : platform3.isElement(offsetParent)) && await (platform3.getScale == null ? void 0 : platform3.getScale(offsetParent)) || { |
| 4062 |
x: 1, |
| 4063 |
y: 1 |
| 4064 |
}; |
| 4065 |
const elementClientRect = rectToClientRect(platform3.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform3.convertOffsetParentRelativeRectToViewportRelativeRect({ |
| 4066 |
elements, |
| 4067 |
rect, |
| 4068 |
offsetParent, |
| 4069 |
strategy |
| 4070 |
}) : rect); |
| 4071 |
return { |
| 4072 |
top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y, |
| 4073 |
bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y, |
| 4074 |
left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x, |
| 4075 |
right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x |
| 4076 |
}; |
| 4077 |
} |
| 4078 |
var MAX_RESET_COUNT = 50; |
| 4079 |
var computePosition = async (reference, floating, config) => { |
| 4080 |
const { |
| 4081 |
placement = "bottom", |
| 4082 |
strategy = "absolute", |
| 4083 |
middleware = [], |
| 4084 |
platform: platform3 |
| 4085 |
} = config; |
| 4086 |
const platformWithDetectOverflow = platform3.detectOverflow ? platform3 : { |
| 4087 |
...platform3, |
| 4088 |
detectOverflow |
| 4089 |
}; |
| 4090 |
const rtl = await (platform3.isRTL == null ? void 0 : platform3.isRTL(floating)); |
| 4091 |
let rects = await platform3.getElementRects({ |
| 4092 |
reference, |
| 4093 |
floating, |
| 4094 |
strategy |
| 4095 |
}); |
| 4096 |
let { |
| 4097 |
x, |
| 4098 |
y |
| 4099 |
} = computeCoordsFromPlacement(rects, placement, rtl); |
| 4100 |
let statefulPlacement = placement; |
| 4101 |
let resetCount = 0; |
| 4102 |
const middlewareData = {}; |
| 4103 |
for (let i = 0; i < middleware.length; i++) { |
| 4104 |
const currentMiddleware = middleware[i]; |
| 4105 |
if (!currentMiddleware) { |
| 4106 |
continue; |
| 4107 |
} |
| 4108 |
const { |
| 4109 |
name, |
| 4110 |
fn |
| 4111 |
} = currentMiddleware; |
| 4112 |
const { |
| 4113 |
x: nextX, |
| 4114 |
y: nextY, |
| 4115 |
data, |
| 4116 |
reset |
| 4117 |
} = await fn({ |
| 4118 |
x, |
| 4119 |
y, |
| 4120 |
initialPlacement: placement, |
| 4121 |
placement: statefulPlacement, |
| 4122 |
strategy, |
| 4123 |
middlewareData, |
| 4124 |
rects, |
| 4125 |
platform: platformWithDetectOverflow, |
| 4126 |
elements: { |
| 4127 |
reference, |
| 4128 |
floating |
| 4129 |
} |
| 4130 |
}); |
| 4131 |
x = nextX != null ? nextX : x; |
| 4132 |
y = nextY != null ? nextY : y; |
| 4133 |
middlewareData[name] = { |
| 4134 |
...middlewareData[name], |
| 4135 |
...data |
| 4136 |
}; |
| 4137 |
if (reset && resetCount < MAX_RESET_COUNT) { |
| 4138 |
resetCount++; |
| 4139 |
if (typeof reset === "object") { |
| 4140 |
if (reset.placement) { |
| 4141 |
statefulPlacement = reset.placement; |
| 4142 |
} |
| 4143 |
if (reset.rects) { |
| 4144 |
rects = reset.rects === true ? await platform3.getElementRects({ |
| 4145 |
reference, |
| 4146 |
floating, |
| 4147 |
strategy |
| 4148 |
}) : reset.rects; |
| 4149 |
} |
| 4150 |
({ |
| 4151 |
x, |
| 4152 |
y |
| 4153 |
} = computeCoordsFromPlacement(rects, statefulPlacement, rtl)); |
| 4154 |
} |
| 4155 |
i = -1; |
| 4156 |
} |
| 4157 |
} |
| 4158 |
return { |
| 4159 |
x, |
| 4160 |
y, |
| 4161 |
placement: statefulPlacement, |
| 4162 |
strategy, |
| 4163 |
middlewareData |
| 4164 |
}; |
| 4165 |
}; |
| 4166 |
var flip = function(options) { |
| 4167 |
if (options === void 0) { |
| 4168 |
options = {}; |
| 4169 |
} |
| 4170 |
return { |
| 4171 |
name: "flip", |
| 4172 |
options, |
| 4173 |
async fn(state) { |
| 4174 |
var _middlewareData$arrow, _middlewareData$flip; |
| 4175 |
const { |
| 4176 |
placement, |
| 4177 |
middlewareData, |
| 4178 |
rects, |
| 4179 |
initialPlacement, |
| 4180 |
platform: platform3, |
| 4181 |
elements |
| 4182 |
} = state; |
| 4183 |
const { |
| 4184 |
mainAxis: checkMainAxis = true, |
| 4185 |
crossAxis: checkCrossAxis = true, |
| 4186 |
fallbackPlacements: specifiedFallbackPlacements, |
| 4187 |
fallbackStrategy = "bestFit", |
| 4188 |
fallbackAxisSideDirection = "none", |
| 4189 |
flipAlignment = true, |
| 4190 |
...detectOverflowOptions |
| 4191 |
} = evaluate(options, state); |
| 4192 |
if ((_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) { |
| 4193 |
return {}; |
| 4194 |
} |
| 4195 |
const side = getSide(placement); |
| 4196 |
const initialSideAxis = getSideAxis(initialPlacement); |
| 4197 |
const isBasePlacement = getSide(initialPlacement) === initialPlacement; |
| 4198 |
const rtl = await (platform3.isRTL == null ? void 0 : platform3.isRTL(elements.floating)); |
| 4199 |
const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement)); |
| 4200 |
const hasFallbackAxisSideDirection = fallbackAxisSideDirection !== "none"; |
| 4201 |
if (!specifiedFallbackPlacements && hasFallbackAxisSideDirection) { |
| 4202 |
fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl)); |
| 4203 |
} |
| 4204 |
const placements2 = [initialPlacement, ...fallbackPlacements]; |
| 4205 |
const overflow = await platform3.detectOverflow(state, detectOverflowOptions); |
| 4206 |
const overflows = []; |
| 4207 |
let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || []; |
| 4208 |
if (checkMainAxis) { |
| 4209 |
overflows.push(overflow[side]); |
| 4210 |
} |
| 4211 |
if (checkCrossAxis) { |
| 4212 |
const sides2 = getAlignmentSides(placement, rects, rtl); |
| 4213 |
overflows.push(overflow[sides2[0]], overflow[sides2[1]]); |
| 4214 |
} |
| 4215 |
overflowsData = [...overflowsData, { |
| 4216 |
placement, |
| 4217 |
overflows |
| 4218 |
}]; |
| 4219 |
if (!overflows.every((side2) => side2 <= 0)) { |
| 4220 |
var _middlewareData$flip2, _overflowsData$filter; |
| 4221 |
const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1; |
| 4222 |
const nextPlacement = placements2[nextIndex]; |
| 4223 |
if (nextPlacement) { |
| 4224 |
const ignoreCrossAxisOverflow = checkCrossAxis === "alignment" ? initialSideAxis !== getSideAxis(nextPlacement) : false; |
| 4225 |
if (!ignoreCrossAxisOverflow || // We leave the current main axis only if every placement on that axis |
| 4226 |
// overflows the main axis. |
| 4227 |
overflowsData.every((d) => getSideAxis(d.placement) === initialSideAxis ? d.overflows[0] > 0 : true)) { |
| 4228 |
return { |
| 4229 |
data: { |
| 4230 |
index: nextIndex, |
| 4231 |
overflows: overflowsData |
| 4232 |
}, |
| 4233 |
reset: { |
| 4234 |
placement: nextPlacement |
| 4235 |
} |
| 4236 |
}; |
| 4237 |
} |
| 4238 |
} |
| 4239 |
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; |
| 4240 |
if (!resetPlacement) { |
| 4241 |
switch (fallbackStrategy) { |
| 4242 |
case "bestFit": { |
| 4243 |
var _overflowsData$filter2; |
| 4244 |
const placement2 = (_overflowsData$filter2 = overflowsData.filter((d) => { |
| 4245 |
if (hasFallbackAxisSideDirection) { |
| 4246 |
const currentSideAxis = getSideAxis(d.placement); |
| 4247 |
return currentSideAxis === initialSideAxis || // Create a bias to the `y` side axis due to horizontal |
| 4248 |
// reading directions favoring greater width. |
| 4249 |
currentSideAxis === "y"; |
| 4250 |
} |
| 4251 |
return true; |
| 4252 |
}).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]; |
| 4253 |
if (placement2) { |
| 4254 |
resetPlacement = placement2; |
| 4255 |
} |
| 4256 |
break; |
| 4257 |
} |
| 4258 |
case "initialPlacement": |
| 4259 |
resetPlacement = initialPlacement; |
| 4260 |
break; |
| 4261 |
} |
| 4262 |
} |
| 4263 |
if (placement !== resetPlacement) { |
| 4264 |
return { |
| 4265 |
reset: { |
| 4266 |
placement: resetPlacement |
| 4267 |
} |
| 4268 |
}; |
| 4269 |
} |
| 4270 |
} |
| 4271 |
return {}; |
| 4272 |
} |
| 4273 |
}; |
| 4274 |
}; |
| 4275 |
var originSides = /* @__PURE__ */ new Set(["left", "top"]); |
| 4276 |
async function convertValueToCoords(state, options) { |
| 4277 |
const { |
| 4278 |
placement, |
| 4279 |
platform: platform3, |
| 4280 |
elements |
| 4281 |
} = state; |
| 4282 |
const rtl = await (platform3.isRTL == null ? void 0 : platform3.isRTL(elements.floating)); |
| 4283 |
const side = getSide(placement); |
| 4284 |
const alignment = getAlignment(placement); |
| 4285 |
const isVertical = getSideAxis(placement) === "y"; |
| 4286 |
const mainAxisMulti = originSides.has(side) ? -1 : 1; |
| 4287 |
const crossAxisMulti = rtl && isVertical ? -1 : 1; |
| 4288 |
const rawValue = evaluate(options, state); |
| 4289 |
let { |
| 4290 |
mainAxis, |
| 4291 |
crossAxis, |
| 4292 |
alignmentAxis |
| 4293 |
} = typeof rawValue === "number" ? { |
| 4294 |
mainAxis: rawValue, |
| 4295 |
crossAxis: 0, |
| 4296 |
alignmentAxis: null |
| 4297 |
} : { |
| 4298 |
mainAxis: rawValue.mainAxis || 0, |
| 4299 |
crossAxis: rawValue.crossAxis || 0, |
| 4300 |
alignmentAxis: rawValue.alignmentAxis |
| 4301 |
}; |
| 4302 |
if (alignment && typeof alignmentAxis === "number") { |
| 4303 |
crossAxis = alignment === "end" ? alignmentAxis * -1 : alignmentAxis; |
| 4304 |
} |
| 4305 |
return isVertical ? { |
| 4306 |
x: crossAxis * crossAxisMulti, |
| 4307 |
y: mainAxis * mainAxisMulti |
| 4308 |
} : { |
| 4309 |
x: mainAxis * mainAxisMulti, |
| 4310 |
y: crossAxis * crossAxisMulti |
| 4311 |
}; |
| 4312 |
} |
| 4313 |
var offset = function(options) { |
| 4314 |
if (options === void 0) { |
| 4315 |
options = 0; |
| 4316 |
} |
| 4317 |
return { |
| 4318 |
name: "offset", |
| 4319 |
options, |
| 4320 |
async fn(state) { |
| 4321 |
var _middlewareData$offse, _middlewareData$arrow; |
| 4322 |
const { |
| 4323 |
x, |
| 4324 |
y, |
| 4325 |
placement, |
| 4326 |
middlewareData |
| 4327 |
} = state; |
| 4328 |
const diffCoords = await convertValueToCoords(state, options); |
| 4329 |
if (placement === ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse.placement) && (_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) { |
| 4330 |
return {}; |
| 4331 |
} |
| 4332 |
return { |
| 4333 |
x: x + diffCoords.x, |
| 4334 |
y: y + diffCoords.y, |
| 4335 |
data: { |
| 4336 |
...diffCoords, |
| 4337 |
placement |
| 4338 |
} |
| 4339 |
}; |
| 4340 |
} |
| 4341 |
}; |
| 4342 |
}; |
| 4343 |
var shift = function(options) { |
| 4344 |
if (options === void 0) { |
| 4345 |
options = {}; |
| 4346 |
} |
| 4347 |
return { |
| 4348 |
name: "shift", |
| 4349 |
options, |
| 4350 |
async fn(state) { |
| 4351 |
const { |
| 4352 |
x, |
| 4353 |
y, |
| 4354 |
placement, |
| 4355 |
platform: platform3 |
| 4356 |
} = state; |
| 4357 |
const { |
| 4358 |
mainAxis: checkMainAxis = true, |
| 4359 |
crossAxis: checkCrossAxis = false, |
| 4360 |
limiter = { |
| 4361 |
fn: (_ref) => { |
| 4362 |
let { |
| 4363 |
x: x2, |
| 4364 |
y: y2 |
| 4365 |
} = _ref; |
| 4366 |
return { |
| 4367 |
x: x2, |
| 4368 |
y: y2 |
| 4369 |
}; |
| 4370 |
} |
| 4371 |
}, |
| 4372 |
...detectOverflowOptions |
| 4373 |
} = evaluate(options, state); |
| 4374 |
const coords = { |
| 4375 |
x, |
| 4376 |
y |
| 4377 |
}; |
| 4378 |
const overflow = await platform3.detectOverflow(state, detectOverflowOptions); |
| 4379 |
const crossAxis = getSideAxis(placement); |
| 4380 |
const mainAxis = getOppositeAxis(crossAxis); |
| 4381 |
let mainAxisCoord = coords[mainAxis]; |
| 4382 |
let crossAxisCoord = coords[crossAxis]; |
| 4383 |
const clampCoord = (axis, coord) => clamp(coord + overflow[axis === "y" ? "top" : "left"], coord, coord - overflow[axis === "y" ? "bottom" : "right"]); |
| 4384 |
if (checkMainAxis) { |
| 4385 |
mainAxisCoord = clampCoord(mainAxis, mainAxisCoord); |
| 4386 |
} |
| 4387 |
if (checkCrossAxis) { |
| 4388 |
crossAxisCoord = clampCoord(crossAxis, crossAxisCoord); |
| 4389 |
} |
| 4390 |
const limitedCoords = limiter.fn({ |
| 4391 |
...state, |
| 4392 |
[mainAxis]: mainAxisCoord, |
| 4393 |
[crossAxis]: crossAxisCoord |
| 4394 |
}); |
| 4395 |
return { |
| 4396 |
...limitedCoords, |
| 4397 |
data: { |
| 4398 |
x: limitedCoords.x - x, |
| 4399 |
y: limitedCoords.y - y, |
| 4400 |
enabled: { |
| 4401 |
[mainAxis]: checkMainAxis, |
| 4402 |
[crossAxis]: checkCrossAxis |
| 4403 |
} |
| 4404 |
} |
| 4405 |
}; |
| 4406 |
} |
| 4407 |
}; |
| 4408 |
}; |
| 4409 |
var limitShift = function(options) { |
| 4410 |
if (options === void 0) { |
| 4411 |
options = {}; |
| 4412 |
} |
| 4413 |
return { |
| 4414 |
options, |
| 4415 |
fn(state) { |
| 4416 |
var _rawOffset$mainAxis, _rawOffset$crossAxis; |
| 4417 |
const { |
| 4418 |
x, |
| 4419 |
y, |
| 4420 |
placement, |
| 4421 |
rects, |
| 4422 |
middlewareData |
| 4423 |
} = state; |
| 4424 |
const { |
| 4425 |
offset: offset4 = 0, |
| 4426 |
mainAxis: checkMainAxis = true, |
| 4427 |
crossAxis: checkCrossAxis = true |
| 4428 |
} = evaluate(options, state); |
| 4429 |
const coords = { |
| 4430 |
x, |
| 4431 |
y |
| 4432 |
}; |
| 4433 |
const crossAxis = getSideAxis(placement); |
| 4434 |
const mainAxis = getOppositeAxis(crossAxis); |
| 4435 |
let mainAxisCoord = coords[mainAxis]; |
| 4436 |
let crossAxisCoord = coords[crossAxis]; |
| 4437 |
const rawOffset = evaluate(offset4, state); |
| 4438 |
const computedOffset = typeof rawOffset === "number" ? { |
| 4439 |
mainAxis: rawOffset, |
| 4440 |
crossAxis: 0 |
| 4441 |
} : { |
| 4442 |
mainAxis: (_rawOffset$mainAxis = rawOffset.mainAxis) != null ? _rawOffset$mainAxis : 0, |
| 4443 |
crossAxis: (_rawOffset$crossAxis = rawOffset.crossAxis) != null ? _rawOffset$crossAxis : 0 |
| 4444 |
}; |
| 4445 |
if (checkMainAxis) { |
| 4446 |
const len = mainAxis === "y" ? "height" : "width"; |
| 4447 |
const limitMin = rects.reference[mainAxis] - rects.floating[len] + computedOffset.mainAxis; |
| 4448 |
const limitMax = rects.reference[mainAxis] + rects.reference[len] - computedOffset.mainAxis; |
| 4449 |
if (mainAxisCoord < limitMin) { |
| 4450 |
mainAxisCoord = limitMin; |
| 4451 |
} else if (mainAxisCoord > limitMax) { |
| 4452 |
mainAxisCoord = limitMax; |
| 4453 |
} |
| 4454 |
} |
| 4455 |
if (checkCrossAxis) { |
| 4456 |
var _middlewareData$offse, _middlewareData$offse2; |
| 4457 |
const len = mainAxis === "y" ? "width" : "height"; |
| 4458 |
const isOriginSide = originSides.has(getSide(placement)); |
| 4459 |
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); |
| 4460 |
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); |
| 4461 |
if (crossAxisCoord < limitMin) { |
| 4462 |
crossAxisCoord = limitMin; |
| 4463 |
} else if (crossAxisCoord > limitMax) { |
| 4464 |
crossAxisCoord = limitMax; |
| 4465 |
} |
| 4466 |
} |
| 4467 |
return { |
| 4468 |
[mainAxis]: mainAxisCoord, |
| 4469 |
[crossAxis]: crossAxisCoord |
| 4470 |
}; |
| 4471 |
} |
| 4472 |
}; |
| 4473 |
}; |
| 4474 |
var size = function(options) { |
| 4475 |
if (options === void 0) { |
| 4476 |
options = {}; |
| 4477 |
} |
| 4478 |
return { |
| 4479 |
name: "size", |
| 4480 |
options, |
| 4481 |
async fn(state) { |
| 4482 |
const { |
| 4483 |
placement, |
| 4484 |
rects, |
| 4485 |
platform: platform3, |
| 4486 |
elements |
| 4487 |
} = state; |
| 4488 |
const { |
| 4489 |
apply = () => { |
| 4490 |
}, |
| 4491 |
...detectOverflowOptions |
| 4492 |
} = evaluate(options, state); |
| 4493 |
const overflow = await platform3.detectOverflow(state, detectOverflowOptions); |
| 4494 |
const side = getSide(placement); |
| 4495 |
const alignment = getAlignment(placement); |
| 4496 |
const isYAxis = getSideAxis(placement) === "y"; |
| 4497 |
const { |
| 4498 |
width, |
| 4499 |
height |
| 4500 |
} = rects.floating; |
| 4501 |
let heightSide; |
| 4502 |
let widthSide; |
| 4503 |
if (side === "top" || side === "bottom") { |
| 4504 |
heightSide = side; |
| 4505 |
widthSide = alignment === (await (platform3.isRTL == null ? void 0 : platform3.isRTL(elements.floating)) ? "start" : "end") ? "left" : "right"; |
| 4506 |
} else { |
| 4507 |
widthSide = side; |
| 4508 |
heightSide = alignment === "end" ? "top" : "bottom"; |
| 4509 |
} |
| 4510 |
const maximumClippingHeight = height - overflow.top - overflow.bottom; |
| 4511 |
const maximumClippingWidth = width - overflow.left - overflow.right; |
| 4512 |
const overflowAvailableHeight = min(height - overflow[heightSide], maximumClippingHeight); |
| 4513 |
const overflowAvailableWidth = min(width - overflow[widthSide], maximumClippingWidth); |
| 4514 |
const shiftData = state.middlewareData.shift; |
| 4515 |
const noShift = !shiftData; |
| 4516 |
let availableHeight2 = overflowAvailableHeight; |
| 4517 |
let availableWidth2 = overflowAvailableWidth; |
| 4518 |
if (shiftData != null && shiftData.enabled.x) { |
| 4519 |
availableWidth2 = maximumClippingWidth; |
| 4520 |
} |
| 4521 |
if (shiftData != null && shiftData.enabled.y) { |
| 4522 |
availableHeight2 = maximumClippingHeight; |
| 4523 |
} |
| 4524 |
if (noShift && !alignment) { |
| 4525 |
if (isYAxis) { |
| 4526 |
availableWidth2 = width - 2 * max(overflow.left, overflow.right); |
| 4527 |
} else { |
| 4528 |
availableHeight2 = height - 2 * max(overflow.top, overflow.bottom); |
| 4529 |
} |
| 4530 |
} |
| 4531 |
await apply({ |
| 4532 |
...state, |
| 4533 |
availableWidth: availableWidth2, |
| 4534 |
availableHeight: availableHeight2 |
| 4535 |
}); |
| 4536 |
const nextDimensions = await platform3.getDimensions(elements.floating); |
| 4537 |
if (width !== nextDimensions.width || height !== nextDimensions.height) { |
| 4538 |
return { |
| 4539 |
reset: { |
| 4540 |
rects: true |
| 4541 |
} |
| 4542 |
}; |
| 4543 |
} |
| 4544 |
return {}; |
| 4545 |
} |
| 4546 |
}; |
| 4547 |
}; |
| 4548 |
|
| 4549 |
// node_modules/@floating-ui/dom/dist/floating-ui.dom.mjs |
| 4550 |
function getCssDimensions(element) { |
| 4551 |
const css = getComputedStyle2(element); |
| 4552 |
let width = parseFloat(css.width) || 0; |
| 4553 |
let height = parseFloat(css.height) || 0; |
| 4554 |
const hasOffset = isHTMLElement(element); |
| 4555 |
const offsetWidth = hasOffset ? element.offsetWidth : width; |
| 4556 |
const offsetHeight = hasOffset ? element.offsetHeight : height; |
| 4557 |
const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight; |
| 4558 |
if (shouldFallback) { |
| 4559 |
width = offsetWidth; |
| 4560 |
height = offsetHeight; |
| 4561 |
} |
| 4562 |
return { |
| 4563 |
width, |
| 4564 |
height, |
| 4565 |
$: shouldFallback |
| 4566 |
}; |
| 4567 |
} |
| 4568 |
function unwrapElement(element) { |
| 4569 |
return !isElement(element) ? element.contextElement : element; |
| 4570 |
} |
| 4571 |
function getScale(element) { |
| 4572 |
const domElement = unwrapElement(element); |
| 4573 |
if (!isHTMLElement(domElement)) { |
| 4574 |
return createCoords(1); |
| 4575 |
} |
| 4576 |
const rect = domElement.getBoundingClientRect(); |
| 4577 |
const { |
| 4578 |
width, |
| 4579 |
height, |
| 4580 |
$ |
| 4581 |
} = getCssDimensions(domElement); |
| 4582 |
let x = ($ ? round(rect.width) : rect.width) / width; |
| 4583 |
let y = ($ ? round(rect.height) : rect.height) / height; |
| 4584 |
if (!x || !Number.isFinite(x)) { |
| 4585 |
x = 1; |
| 4586 |
} |
| 4587 |
if (!y || !Number.isFinite(y)) { |
| 4588 |
y = 1; |
| 4589 |
} |
| 4590 |
return { |
| 4591 |
x, |
| 4592 |
y |
| 4593 |
}; |
| 4594 |
} |
| 4595 |
var noOffsets = /* @__PURE__ */ createCoords(0); |
| 4596 |
function getVisualOffsets(element) { |
| 4597 |
const win = getWindow(element); |
| 4598 |
if (!isWebKit() || !win.visualViewport) { |
| 4599 |
return noOffsets; |
| 4600 |
} |
| 4601 |
return { |
| 4602 |
x: win.visualViewport.offsetLeft, |
| 4603 |
y: win.visualViewport.offsetTop |
| 4604 |
}; |
| 4605 |
} |
| 4606 |
function shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) { |
| 4607 |
if (isFixed === void 0) { |
| 4608 |
isFixed = false; |
| 4609 |
} |
| 4610 |
return !!floatingOffsetParent && isFixed && floatingOffsetParent === getWindow(element); |
| 4611 |
} |
| 4612 |
function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) { |
| 4613 |
if (includeScale === void 0) { |
| 4614 |
includeScale = false; |
| 4615 |
} |
| 4616 |
if (isFixedStrategy === void 0) { |
| 4617 |
isFixedStrategy = false; |
| 4618 |
} |
| 4619 |
const clientRect = element.getBoundingClientRect(); |
| 4620 |
const domElement = unwrapElement(element); |
| 4621 |
let scale = createCoords(1); |
| 4622 |
if (includeScale) { |
| 4623 |
if (offsetParent) { |
| 4624 |
if (isElement(offsetParent)) { |
| 4625 |
scale = getScale(offsetParent); |
| 4626 |
} |
| 4627 |
} else { |
| 4628 |
scale = getScale(element); |
| 4629 |
} |
| 4630 |
} |
| 4631 |
const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : createCoords(0); |
| 4632 |
let x = (clientRect.left + visualOffsets.x) / scale.x; |
| 4633 |
let y = (clientRect.top + visualOffsets.y) / scale.y; |
| 4634 |
let width = clientRect.width / scale.x; |
| 4635 |
let height = clientRect.height / scale.y; |
| 4636 |
if (domElement && offsetParent) { |
| 4637 |
const win = getWindow(domElement); |
| 4638 |
const offsetWin = isElement(offsetParent) ? getWindow(offsetParent) : offsetParent; |
| 4639 |
let currentWin = win; |
| 4640 |
let currentIFrame = getFrameElement(currentWin); |
| 4641 |
while (currentIFrame && offsetWin !== currentWin) { |
| 4642 |
const iframeScale = getScale(currentIFrame); |
| 4643 |
const iframeRect = currentIFrame.getBoundingClientRect(); |
| 4644 |
const css = getComputedStyle2(currentIFrame); |
| 4645 |
const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x; |
| 4646 |
const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y; |
| 4647 |
x *= iframeScale.x; |
| 4648 |
y *= iframeScale.y; |
| 4649 |
width *= iframeScale.x; |
| 4650 |
height *= iframeScale.y; |
| 4651 |
x += left; |
| 4652 |
y += top; |
| 4653 |
currentWin = getWindow(currentIFrame); |
| 4654 |
currentIFrame = getFrameElement(currentWin); |
| 4655 |
} |
| 4656 |
} |
| 4657 |
return rectToClientRect({ |
| 4658 |
width, |
| 4659 |
height, |
| 4660 |
x, |
| 4661 |
y |
| 4662 |
}); |
| 4663 |
} |
| 4664 |
function getWindowScrollBarX(element, rect) { |
| 4665 |
const leftScroll = getNodeScroll(element).scrollLeft; |
| 4666 |
if (!rect) { |
| 4667 |
return getBoundingClientRect(getDocumentElement(element)).left + leftScroll; |
| 4668 |
} |
| 4669 |
return rect.left + leftScroll; |
| 4670 |
} |
| 4671 |
function getHTMLOffset(documentElement, scroll) { |
| 4672 |
const htmlRect = documentElement.getBoundingClientRect(); |
| 4673 |
const x = htmlRect.left + scroll.scrollLeft - getWindowScrollBarX(documentElement, htmlRect); |
| 4674 |
const y = htmlRect.top + scroll.scrollTop; |
| 4675 |
return { |
| 4676 |
x, |
| 4677 |
y |
| 4678 |
}; |
| 4679 |
} |
| 4680 |
function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) { |
| 4681 |
let { |
| 4682 |
elements, |
| 4683 |
rect, |
| 4684 |
offsetParent, |
| 4685 |
strategy |
| 4686 |
} = _ref; |
| 4687 |
const isFixed = strategy === "fixed"; |
| 4688 |
const documentElement = getDocumentElement(offsetParent); |
| 4689 |
const topLayer = elements ? isTopLayer(elements.floating) : false; |
| 4690 |
if (offsetParent === documentElement || topLayer && isFixed) { |
| 4691 |
return rect; |
| 4692 |
} |
| 4693 |
let scroll = { |
| 4694 |
scrollLeft: 0, |
| 4695 |
scrollTop: 0 |
| 4696 |
}; |
| 4697 |
let scale = createCoords(1); |
| 4698 |
const offsets = createCoords(0); |
| 4699 |
const isOffsetParentAnElement = isHTMLElement(offsetParent); |
| 4700 |
if (isOffsetParentAnElement || !isFixed) { |
| 4701 |
if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) { |
| 4702 |
scroll = getNodeScroll(offsetParent); |
| 4703 |
} |
| 4704 |
if (isOffsetParentAnElement) { |
| 4705 |
const offsetRect = getBoundingClientRect(offsetParent); |
| 4706 |
scale = getScale(offsetParent); |
| 4707 |
offsets.x = offsetRect.x + offsetParent.clientLeft; |
| 4708 |
offsets.y = offsetRect.y + offsetParent.clientTop; |
| 4709 |
} |
| 4710 |
} |
| 4711 |
const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0); |
| 4712 |
return { |
| 4713 |
width: rect.width * scale.x, |
| 4714 |
height: rect.height * scale.y, |
| 4715 |
x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x + htmlOffset.x, |
| 4716 |
y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y + htmlOffset.y |
| 4717 |
}; |
| 4718 |
} |
| 4719 |
function getClientRects(element) { |
| 4720 |
return element.getClientRects ? Array.from(element.getClientRects()) : []; |
| 4721 |
} |
| 4722 |
function getDocumentRect(html) { |
| 4723 |
const scroll = getNodeScroll(html); |
| 4724 |
const body = html.ownerDocument.body; |
| 4725 |
const width = max(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth); |
| 4726 |
const height = max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight); |
| 4727 |
let x = -scroll.scrollLeft + getWindowScrollBarX(html); |
| 4728 |
const y = -scroll.scrollTop; |
| 4729 |
if (getComputedStyle2(body).direction === "rtl") { |
| 4730 |
x += max(html.clientWidth, body.clientWidth) - width; |
| 4731 |
} |
| 4732 |
return { |
| 4733 |
width, |
| 4734 |
height, |
| 4735 |
x, |
| 4736 |
y |
| 4737 |
}; |
| 4738 |
} |
| 4739 |
var SCROLLBAR_MAX = 25; |
| 4740 |
function getViewportRect(element, strategy, rootBoundary) { |
| 4741 |
if (rootBoundary === void 0) { |
| 4742 |
rootBoundary = "viewport"; |
| 4743 |
} |
| 4744 |
const isLayoutViewport = rootBoundary === "layoutViewport"; |
| 4745 |
const win = getWindow(element); |
| 4746 |
const html = getDocumentElement(element); |
| 4747 |
const visualViewport = win.visualViewport; |
| 4748 |
let width = html.clientWidth; |
| 4749 |
let height = html.clientHeight; |
| 4750 |
let x = 0; |
| 4751 |
let y = 0; |
| 4752 |
if (visualViewport) { |
| 4753 |
const layoutRelativeClientCoords = !isWebKit() || strategy === "fixed"; |
| 4754 |
if (isLayoutViewport) { |
| 4755 |
if (!layoutRelativeClientCoords) { |
| 4756 |
x = -visualViewport.offsetLeft; |
| 4757 |
y = -visualViewport.offsetTop; |
| 4758 |
} |
| 4759 |
} else { |
| 4760 |
width = visualViewport.width; |
| 4761 |
height = visualViewport.height; |
| 4762 |
if (layoutRelativeClientCoords) { |
| 4763 |
x = visualViewport.offsetLeft; |
| 4764 |
y = visualViewport.offsetTop; |
| 4765 |
} |
| 4766 |
} |
| 4767 |
} |
| 4768 |
const windowScrollbarX = getWindowScrollBarX(html); |
| 4769 |
if (windowScrollbarX <= 0) { |
| 4770 |
const doc = html.ownerDocument; |
| 4771 |
const body = doc.body; |
| 4772 |
const bodyStyles = getComputedStyle(body); |
| 4773 |
const bodyMarginInline = doc.compatMode === "CSS1Compat" ? parseFloat(bodyStyles.marginLeft) + parseFloat(bodyStyles.marginRight) || 0 : 0; |
| 4774 |
const reservedWidth = Math.abs(html.clientWidth - body.clientWidth - bodyMarginInline); |
| 4775 |
const gutter = getComputedStyle(html).scrollbarGutter === "stable both-edges" ? reservedWidth / 2 : reservedWidth; |
| 4776 |
if (gutter <= SCROLLBAR_MAX) { |
| 4777 |
width -= gutter; |
| 4778 |
} |
| 4779 |
} |
| 4780 |
return { |
| 4781 |
width, |
| 4782 |
height, |
| 4783 |
x, |
| 4784 |
y |
| 4785 |
}; |
| 4786 |
} |
| 4787 |
function getInnerBoundingClientRect(element, strategy) { |
| 4788 |
const clientRect = getBoundingClientRect(element, true, strategy === "fixed"); |
| 4789 |
const top = clientRect.top + element.clientTop; |
| 4790 |
const left = clientRect.left + element.clientLeft; |
| 4791 |
const scale = getScale(element); |
| 4792 |
const width = element.clientWidth * scale.x; |
| 4793 |
const height = element.clientHeight * scale.y; |
| 4794 |
const x = left * scale.x; |
| 4795 |
const y = top * scale.y; |
| 4796 |
return { |
| 4797 |
width, |
| 4798 |
height, |
| 4799 |
x, |
| 4800 |
y |
| 4801 |
}; |
| 4802 |
} |
| 4803 |
function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) { |
| 4804 |
let rect; |
| 4805 |
if (clippingAncestor === "viewport" || clippingAncestor === "layoutViewport") { |
| 4806 |
rect = getViewportRect(element, strategy, clippingAncestor); |
| 4807 |
} else if (clippingAncestor === "document") { |
| 4808 |
rect = getDocumentRect(getDocumentElement(element)); |
| 4809 |
} else if (isElement(clippingAncestor)) { |
| 4810 |
rect = getInnerBoundingClientRect(clippingAncestor, strategy); |
| 4811 |
} else { |
| 4812 |
const visualOffsets = getVisualOffsets(element); |
| 4813 |
rect = { |
| 4814 |
x: clippingAncestor.x - visualOffsets.x, |
| 4815 |
y: clippingAncestor.y - visualOffsets.y, |
| 4816 |
width: clippingAncestor.width, |
| 4817 |
height: clippingAncestor.height |
| 4818 |
}; |
| 4819 |
} |
| 4820 |
return rectToClientRect(rect); |
| 4821 |
} |
| 4822 |
function getClippingElementAncestors(element, cache) { |
| 4823 |
const cachedResult = cache.get(element); |
| 4824 |
if (cachedResult) { |
| 4825 |
return cachedResult; |
| 4826 |
} |
| 4827 |
let result = getOverflowAncestors(element, [], false).filter((el) => isElement(el) && getNodeName(el) !== "body"); |
| 4828 |
let lastKeptComputedStyle = null; |
| 4829 |
const elementIsFixed = getComputedStyle2(element).position === "fixed"; |
| 4830 |
let currentNode = elementIsFixed ? getParentNode(element) : element; |
| 4831 |
while (isElement(currentNode) && !isLastTraversableNode(currentNode)) { |
| 4832 |
const computedStyle = getComputedStyle2(currentNode); |
| 4833 |
const currentNodeIsContaining = isContainingBlock(currentNode); |
| 4834 |
const lastPosition = lastKeptComputedStyle ? lastKeptComputedStyle.position : elementIsFixed ? "fixed" : ""; |
| 4835 |
const shouldDropCurrentNode = !currentNodeIsContaining && (lastPosition === "fixed" || lastPosition === "absolute" && computedStyle.position === "static"); |
| 4836 |
if (shouldDropCurrentNode) { |
| 4837 |
result = result.filter((ancestor) => ancestor !== currentNode); |
| 4838 |
} else { |
| 4839 |
lastKeptComputedStyle = computedStyle; |
| 4840 |
} |
| 4841 |
currentNode = getParentNode(currentNode); |
| 4842 |
} |
| 4843 |
cache.set(element, result); |
| 4844 |
return result; |
| 4845 |
} |
| 4846 |
function getClippingRect(_ref) { |
| 4847 |
let { |
| 4848 |
element, |
| 4849 |
boundary, |
| 4850 |
rootBoundary, |
| 4851 |
strategy |
| 4852 |
} = _ref; |
| 4853 |
const elementClippingAncestors = boundary === "clippingAncestors" ? isTopLayer(element) ? [] : getClippingElementAncestors(element, this._c) : [].concat(boundary); |
| 4854 |
const clippingAncestors = [...elementClippingAncestors, rootBoundary]; |
| 4855 |
const firstRect = getClientRectFromClippingAncestor(element, clippingAncestors[0], strategy); |
| 4856 |
let top = firstRect.top; |
| 4857 |
let right = firstRect.right; |
| 4858 |
let bottom = firstRect.bottom; |
| 4859 |
let left = firstRect.left; |
| 4860 |
for (let i = 1; i < clippingAncestors.length; i++) { |
| 4861 |
const rect = getClientRectFromClippingAncestor(element, clippingAncestors[i], strategy); |
| 4862 |
top = max(rect.top, top); |
| 4863 |
right = min(rect.right, right); |
| 4864 |
bottom = min(rect.bottom, bottom); |
| 4865 |
left = max(rect.left, left); |
| 4866 |
} |
| 4867 |
return { |
| 4868 |
width: right - left, |
| 4869 |
height: bottom - top, |
| 4870 |
x: left, |
| 4871 |
y: top |
| 4872 |
}; |
| 4873 |
} |
| 4874 |
function getDimensions2(element) { |
| 4875 |
const { |
| 4876 |
width, |
| 4877 |
height |
| 4878 |
} = getCssDimensions(element); |
| 4879 |
return { |
| 4880 |
width, |
| 4881 |
height |
| 4882 |
}; |
| 4883 |
} |
| 4884 |
function getRectRelativeToOffsetParent(element, offsetParent, strategy) { |
| 4885 |
const isOffsetParentAnElement = isHTMLElement(offsetParent); |
| 4886 |
const documentElement = getDocumentElement(offsetParent); |
| 4887 |
const isFixed = strategy === "fixed"; |
| 4888 |
const rect = getBoundingClientRect(element, true, isFixed, offsetParent); |
| 4889 |
let scroll = { |
| 4890 |
scrollLeft: 0, |
| 4891 |
scrollTop: 0 |
| 4892 |
}; |
| 4893 |
const offsets = createCoords(0); |
| 4894 |
if (isOffsetParentAnElement || !isFixed) { |
| 4895 |
if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) { |
| 4896 |
scroll = getNodeScroll(offsetParent); |
| 4897 |
} |
| 4898 |
if (isOffsetParentAnElement) { |
| 4899 |
const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent); |
| 4900 |
offsets.x = offsetRect.x + offsetParent.clientLeft; |
| 4901 |
offsets.y = offsetRect.y + offsetParent.clientTop; |
| 4902 |
} |
| 4903 |
} |
| 4904 |
if (!isOffsetParentAnElement && documentElement) { |
| 4905 |
offsets.x = getWindowScrollBarX(documentElement); |
| 4906 |
} |
| 4907 |
const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0); |
| 4908 |
const x = rect.left + scroll.scrollLeft - offsets.x - htmlOffset.x; |
| 4909 |
const y = rect.top + scroll.scrollTop - offsets.y - htmlOffset.y; |
| 4910 |
return { |
| 4911 |
x, |
| 4912 |
y, |
| 4913 |
width: rect.width, |
| 4914 |
height: rect.height |
| 4915 |
}; |
| 4916 |
} |
| 4917 |
function isStaticPositioned(element) { |
| 4918 |
return getComputedStyle2(element).position === "static"; |
| 4919 |
} |
| 4920 |
function getTrueOffsetParent(element, polyfill) { |
| 4921 |
if (!isHTMLElement(element) || getComputedStyle2(element).position === "fixed") { |
| 4922 |
return null; |
| 4923 |
} |
| 4924 |
if (polyfill) { |
| 4925 |
return polyfill(element); |
| 4926 |
} |
| 4927 |
let rawOffsetParent = element.offsetParent; |
| 4928 |
if (getDocumentElement(element) === rawOffsetParent) { |
| 4929 |
rawOffsetParent = rawOffsetParent.ownerDocument.body; |
| 4930 |
} |
| 4931 |
return rawOffsetParent; |
| 4932 |
} |
| 4933 |
function getOffsetParent(element, polyfill) { |
| 4934 |
const win = getWindow(element); |
| 4935 |
if (isTopLayer(element)) { |
| 4936 |
return win; |
| 4937 |
} |
| 4938 |
if (!isHTMLElement(element)) { |
| 4939 |
let svgOffsetParent = getParentNode(element); |
| 4940 |
while (svgOffsetParent && !isLastTraversableNode(svgOffsetParent)) { |
| 4941 |
if (isElement(svgOffsetParent) && !isStaticPositioned(svgOffsetParent)) { |
| 4942 |
return svgOffsetParent; |
| 4943 |
} |
| 4944 |
svgOffsetParent = getParentNode(svgOffsetParent); |
| 4945 |
} |
| 4946 |
return win; |
| 4947 |
} |
| 4948 |
let offsetParent = getTrueOffsetParent(element, polyfill); |
| 4949 |
while (offsetParent && isTableElement(offsetParent) && isStaticPositioned(offsetParent)) { |
| 4950 |
offsetParent = getTrueOffsetParent(offsetParent, polyfill); |
| 4951 |
} |
| 4952 |
if (offsetParent && isLastTraversableNode(offsetParent) && isStaticPositioned(offsetParent) && !isContainingBlock(offsetParent)) { |
| 4953 |
return win; |
| 4954 |
} |
| 4955 |
return offsetParent || getContainingBlock(element) || win; |
| 4956 |
} |
| 4957 |
var getElementRects = async function(data) { |
| 4958 |
const getOffsetParentFn = this.getOffsetParent || getOffsetParent; |
| 4959 |
const getDimensionsFn = this.getDimensions; |
| 4960 |
const floatingDimensions = await getDimensionsFn(data.floating); |
| 4961 |
return { |
| 4962 |
reference: getRectRelativeToOffsetParent(data.reference, await getOffsetParentFn(data.floating), data.strategy), |
| 4963 |
floating: { |
| 4964 |
x: 0, |
| 4965 |
y: 0, |
| 4966 |
width: floatingDimensions.width, |
| 4967 |
height: floatingDimensions.height |
| 4968 |
} |
| 4969 |
}; |
| 4970 |
}; |
| 4971 |
function isRTL(element) { |
| 4972 |
return getComputedStyle2(element).direction === "rtl"; |
| 4973 |
} |
| 4974 |
var platform2 = { |
| 4975 |
convertOffsetParentRelativeRectToViewportRelativeRect, |
| 4976 |
getDocumentElement, |
| 4977 |
getClippingRect, |
| 4978 |
getOffsetParent, |
| 4979 |
getElementRects, |
| 4980 |
getClientRects, |
| 4981 |
getDimensions: getDimensions2, |
| 4982 |
getScale, |
| 4983 |
isElement, |
| 4984 |
isRTL |
| 4985 |
}; |
| 4986 |
function rectsAreEqual(a, b) { |
| 4987 |
return a.x === b.x && a.y === b.y && a.width === b.width && a.height === b.height; |
| 4988 |
} |
| 4989 |
function observeMove(element, onMove, ancestorResize) { |
| 4990 |
let io = null; |
| 4991 |
let timeoutId; |
| 4992 |
const root = getDocumentElement(element); |
| 4993 |
function cleanup() { |
| 4994 |
var _io; |
| 4995 |
clearTimeout(timeoutId); |
| 4996 |
(_io = io) == null || _io.disconnect(); |
| 4997 |
io = null; |
| 4998 |
} |
| 4999 |
function refresh(skip, threshold) { |
| 5000 |
if (skip === void 0) { |
| 5001 |
skip = false; |
| 5002 |
} |
| 5003 |
if (threshold === void 0) { |
| 5004 |
threshold = 1; |
| 5005 |
} |
| 5006 |
cleanup(); |
| 5007 |
const elementRectForRootMargin = element.getBoundingClientRect(); |
| 5008 |
const { |
| 5009 |
left, |
| 5010 |
top, |
| 5011 |
width, |
| 5012 |
height |
| 5013 |
} = elementRectForRootMargin; |
| 5014 |
if (!skip) { |
| 5015 |
onMove(); |
| 5016 |
} |
| 5017 |
if (!width || !height) { |
| 5018 |
return; |
| 5019 |
} |
| 5020 |
const insetTop = floor(top); |
| 5021 |
const insetRight = floor(root.clientWidth - (left + width)); |
| 5022 |
const insetBottom = floor(root.clientHeight - (top + height)); |
| 5023 |
const insetLeft = floor(left); |
| 5024 |
const rootMargin = -insetTop + "px " + -insetRight + "px " + -insetBottom + "px " + -insetLeft + "px"; |
| 5025 |
const options = { |
| 5026 |
rootMargin, |
| 5027 |
threshold: max(0, min(1, threshold)) || 1 |
| 5028 |
}; |
| 5029 |
let isFirstUpdate = true; |
| 5030 |
function handleObserve(entries) { |
| 5031 |
const ratio = entries[0].intersectionRatio; |
| 5032 |
if (!rectsAreEqual(elementRectForRootMargin, element.getBoundingClientRect())) { |
| 5033 |
return refresh(); |
| 5034 |
} |
| 5035 |
if (ratio !== threshold) { |
| 5036 |
if (!isFirstUpdate) { |
| 5037 |
return refresh(); |
| 5038 |
} |
| 5039 |
if (!ratio) { |
| 5040 |
timeoutId = setTimeout(() => { |
| 5041 |
refresh(false, 1e-7); |
| 5042 |
}, 1e3); |
| 5043 |
} else { |
| 5044 |
refresh(false, ratio); |
| 5045 |
} |
| 5046 |
} |
| 5047 |
isFirstUpdate = false; |
| 5048 |
} |
| 5049 |
try { |
| 5050 |
io = new IntersectionObserver(handleObserve, { |
| 5051 |
...options, |
| 5052 |
// Handle <iframe>s |
| 5053 |
root: root.ownerDocument |
| 5054 |
}); |
| 5055 |
} catch (_e) { |
| 5056 |
io = new IntersectionObserver(handleObserve, options); |
| 5057 |
} |
| 5058 |
io.observe(element); |
| 5059 |
} |
| 5060 |
const win = getWindow(element); |
| 5061 |
const handleResize = () => refresh(ancestorResize); |
| 5062 |
win.addEventListener("resize", handleResize); |
| 5063 |
refresh(true); |
| 5064 |
return () => { |
| 5065 |
win.removeEventListener("resize", handleResize); |
| 5066 |
cleanup(); |
| 5067 |
}; |
| 5068 |
} |
| 5069 |
function autoUpdate(reference, floating, update2, options) { |
| 5070 |
if (options === void 0) { |
| 5071 |
options = {}; |
| 5072 |
} |
| 5073 |
const { |
| 5074 |
ancestorScroll = true, |
| 5075 |
ancestorResize = true, |
| 5076 |
elementResize = typeof ResizeObserver === "function", |
| 5077 |
layoutShift = typeof IntersectionObserver === "function", |
| 5078 |
animationFrame = false |
| 5079 |
} = options; |
| 5080 |
const referenceEl = unwrapElement(reference); |
| 5081 |
const ancestors = ancestorScroll || ancestorResize ? [...referenceEl ? getOverflowAncestors(referenceEl) : [], ...floating ? getOverflowAncestors(floating) : []] : []; |
| 5082 |
ancestors.forEach((ancestor) => { |
| 5083 |
ancestorScroll && ancestor.addEventListener("scroll", update2); |
| 5084 |
ancestorResize && ancestor.addEventListener("resize", update2); |
| 5085 |
}); |
| 5086 |
const cleanupIo = referenceEl && layoutShift ? observeMove(referenceEl, update2, ancestorResize) : null; |
| 5087 |
let reobserveFrame = -1; |
| 5088 |
let resizeObserver = null; |
| 5089 |
if (elementResize) { |
| 5090 |
resizeObserver = new ResizeObserver((_ref) => { |
| 5091 |
let [firstEntry] = _ref; |
| 5092 |
if (firstEntry && firstEntry.target === referenceEl && resizeObserver && floating) { |
| 5093 |
resizeObserver.unobserve(floating); |
| 5094 |
cancelAnimationFrame(reobserveFrame); |
| 5095 |
reobserveFrame = requestAnimationFrame(() => { |
| 5096 |
var _resizeObserver; |
| 5097 |
(_resizeObserver = resizeObserver) == null || _resizeObserver.observe(floating); |
| 5098 |
}); |
| 5099 |
} |
| 5100 |
update2(); |
| 5101 |
}); |
| 5102 |
if (referenceEl && !animationFrame) { |
| 5103 |
resizeObserver.observe(referenceEl); |
| 5104 |
} |
| 5105 |
if (floating) { |
| 5106 |
resizeObserver.observe(floating); |
| 5107 |
} |
| 5108 |
} |
| 5109 |
let frameId; |
| 5110 |
let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null; |
| 5111 |
if (animationFrame) { |
| 5112 |
frameLoop(); |
| 5113 |
} |
| 5114 |
function frameLoop() { |
| 5115 |
const nextRefRect = getBoundingClientRect(reference); |
| 5116 |
if (prevRefRect && !rectsAreEqual(prevRefRect, nextRefRect)) { |
| 5117 |
update2(); |
| 5118 |
} |
| 5119 |
prevRefRect = nextRefRect; |
| 5120 |
frameId = requestAnimationFrame(frameLoop); |
| 5121 |
} |
| 5122 |
update2(); |
| 5123 |
return () => { |
| 5124 |
var _resizeObserver2; |
| 5125 |
ancestors.forEach((ancestor) => { |
| 5126 |
ancestorScroll && ancestor.removeEventListener("scroll", update2); |
| 5127 |
ancestorResize && ancestor.removeEventListener("resize", update2); |
| 5128 |
}); |
| 5129 |
cleanupIo == null || cleanupIo(); |
| 5130 |
(_resizeObserver2 = resizeObserver) == null || _resizeObserver2.disconnect(); |
| 5131 |
resizeObserver = null; |
| 5132 |
if (animationFrame) { |
| 5133 |
cancelAnimationFrame(frameId); |
| 5134 |
} |
| 5135 |
}; |
| 5136 |
} |
| 5137 |
var offset2 = offset; |
| 5138 |
var shift2 = shift; |
| 5139 |
var flip2 = flip; |
| 5140 |
var size2 = size; |
| 5141 |
var limitShift2 = limitShift; |
| 5142 |
var computePosition2 = (reference, floating, options) => { |
| 5143 |
const cache = /* @__PURE__ */ new Map(); |
| 5144 |
const mergedOptions = options != null ? options : {}; |
| 5145 |
const platformWithCache = { |
| 5146 |
...platform2, |
| 5147 |
...mergedOptions.platform, |
| 5148 |
_c: cache |
| 5149 |
}; |
| 5150 |
return computePosition(reference, floating, { |
| 5151 |
...mergedOptions, |
| 5152 |
platform: platformWithCache |
| 5153 |
}); |
| 5154 |
}; |
| 5155 |
|
| 5156 |
// node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.mjs |
| 5157 |
var React24 = __toESM(require_react(), 1); |
| 5158 |
var import_react2 = __toESM(require_react(), 1); |
| 5159 |
var ReactDOM3 = __toESM(require_react_dom(), 1); |
| 5160 |
var isClient = typeof document !== "undefined"; |
| 5161 |
var noop2 = function noop3() { |
| 5162 |
}; |
| 5163 |
var index = isClient ? import_react2.useLayoutEffect : noop2; |
| 5164 |
function deepEqual(a, b) { |
| 5165 |
if (a === b) { |
| 5166 |
return true; |
| 5167 |
} |
| 5168 |
if (typeof a !== typeof b) { |
| 5169 |
return false; |
| 5170 |
} |
| 5171 |
if (typeof a === "function" && a.toString() === b.toString()) { |
| 5172 |
return true; |
| 5173 |
} |
| 5174 |
let length; |
| 5175 |
let i; |
| 5176 |
let keys; |
| 5177 |
if (a && b && typeof a === "object") { |
| 5178 |
if (Array.isArray(a)) { |
| 5179 |
length = a.length; |
| 5180 |
if (length !== b.length) return false; |
| 5181 |
for (i = length; i-- !== 0; ) { |
| 5182 |
if (!deepEqual(a[i], b[i])) { |
| 5183 |
return false; |
| 5184 |
} |
| 5185 |
} |
| 5186 |
return true; |
| 5187 |
} |
| 5188 |
keys = Object.keys(a); |
| 5189 |
length = keys.length; |
| 5190 |
if (length !== Object.keys(b).length) { |
| 5191 |
return false; |
| 5192 |
} |
| 5193 |
for (i = length; i-- !== 0; ) { |
| 5194 |
if (!{}.hasOwnProperty.call(b, keys[i])) { |
| 5195 |
return false; |
| 5196 |
} |
| 5197 |
} |
| 5198 |
for (i = length; i-- !== 0; ) { |
| 5199 |
const key = keys[i]; |
| 5200 |
if (key === "_owner" && a.$$typeof) { |
| 5201 |
continue; |
| 5202 |
} |
| 5203 |
if (!deepEqual(a[key], b[key])) { |
| 5204 |
return false; |
| 5205 |
} |
| 5206 |
} |
| 5207 |
return true; |
| 5208 |
} |
| 5209 |
return a !== a && b !== b; |
| 5210 |
} |
| 5211 |
function getDPR(element) { |
| 5212 |
if (typeof window === "undefined") { |
| 5213 |
return 1; |
| 5214 |
} |
| 5215 |
const win = element.ownerDocument.defaultView || window; |
| 5216 |
return win.devicePixelRatio || 1; |
| 5217 |
} |
| 5218 |
function roundByDPR(element, value) { |
| 5219 |
const dpr = getDPR(element); |
| 5220 |
return Math.round(value * dpr) / dpr; |
| 5221 |
} |
| 5222 |
function useLatestRef(value) { |
| 5223 |
const ref = React24.useRef(value); |
| 5224 |
index(() => { |
| 5225 |
ref.current = value; |
| 5226 |
}); |
| 5227 |
return ref; |
| 5228 |
} |
| 5229 |
function useFloating(options) { |
| 5230 |
if (options === void 0) { |
| 5231 |
options = {}; |
| 5232 |
} |
| 5233 |
const { |
| 5234 |
placement = "bottom", |
| 5235 |
strategy = "absolute", |
| 5236 |
middleware = [], |
| 5237 |
platform: platform3, |
| 5238 |
elements: { |
| 5239 |
reference: externalReference, |
| 5240 |
floating: externalFloating |
| 5241 |
} = {}, |
| 5242 |
transform = true, |
| 5243 |
whileElementsMounted, |
| 5244 |
open: open3 |
| 5245 |
} = options; |
| 5246 |
const [data, setData] = React24.useState({ |
| 5247 |
x: 0, |
| 5248 |
y: 0, |
| 5249 |
strategy, |
| 5250 |
placement, |
| 5251 |
middlewareData: {}, |
| 5252 |
isPositioned: false |
| 5253 |
}); |
| 5254 |
const [latestMiddleware, setLatestMiddleware] = React24.useState(middleware); |
| 5255 |
if (!deepEqual(latestMiddleware, middleware)) { |
| 5256 |
setLatestMiddleware(middleware); |
| 5257 |
} |
| 5258 |
const [_reference, _setReference] = React24.useState(null); |
| 5259 |
const [_floating, _setFloating] = React24.useState(null); |
| 5260 |
const setReference = React24.useCallback((node) => { |
| 5261 |
if (node !== referenceRef.current) { |
| 5262 |
referenceRef.current = node; |
| 5263 |
_setReference(node); |
| 5264 |
} |
| 5265 |
}, []); |
| 5266 |
const setFloating = React24.useCallback((node) => { |
| 5267 |
if (node !== floatingRef.current) { |
| 5268 |
floatingRef.current = node; |
| 5269 |
_setFloating(node); |
| 5270 |
} |
| 5271 |
}, []); |
| 5272 |
const referenceEl = externalReference || _reference; |
| 5273 |
const floatingEl = externalFloating || _floating; |
| 5274 |
const referenceRef = React24.useRef(null); |
| 5275 |
const floatingRef = React24.useRef(null); |
| 5276 |
const dataRef = React24.useRef(data); |
| 5277 |
const hasWhileElementsMounted = whileElementsMounted != null; |
| 5278 |
const whileElementsMountedRef = useLatestRef(whileElementsMounted); |
| 5279 |
const platformRef = useLatestRef(platform3); |
| 5280 |
const openRef = useLatestRef(open3); |
| 5281 |
const update2 = React24.useCallback(() => { |
| 5282 |
if (!referenceRef.current || !floatingRef.current) { |
| 5283 |
return; |
| 5284 |
} |
| 5285 |
const config = { |
| 5286 |
placement, |
| 5287 |
strategy, |
| 5288 |
middleware: latestMiddleware |
| 5289 |
}; |
| 5290 |
if (platformRef.current) { |
| 5291 |
config.platform = platformRef.current; |
| 5292 |
} |
| 5293 |
computePosition2(referenceRef.current, floatingRef.current, config).then((data2) => { |
| 5294 |
const fullData = { |
| 5295 |
...data2, |
| 5296 |
// The floating element's position may be recomputed while it's closed |
| 5297 |
// but still mounted (such as when transitioning out). To ensure |
| 5298 |
// `isPositioned` will be `false` initially on the next open, avoid |
| 5299 |
// setting it to `true` when `open === false` (must be specified). |
| 5300 |
isPositioned: openRef.current !== false |
| 5301 |
}; |
| 5302 |
if (isMountedRef.current && !deepEqual(dataRef.current, fullData)) { |
| 5303 |
dataRef.current = fullData; |
| 5304 |
ReactDOM3.flushSync(() => { |
| 5305 |
setData(fullData); |
| 5306 |
}); |
| 5307 |
} |
| 5308 |
}); |
| 5309 |
}, [latestMiddleware, placement, strategy, platformRef, openRef]); |
| 5310 |
index(() => { |
| 5311 |
if (open3 === false && dataRef.current.isPositioned) { |
| 5312 |
dataRef.current.isPositioned = false; |
| 5313 |
setData((data2) => ({ |
| 5314 |
...data2, |
| 5315 |
isPositioned: false |
| 5316 |
})); |
| 5317 |
} |
| 5318 |
}, [open3]); |
| 5319 |
const isMountedRef = React24.useRef(false); |
| 5320 |
index(() => { |
| 5321 |
isMountedRef.current = true; |
| 5322 |
return () => { |
| 5323 |
isMountedRef.current = false; |
| 5324 |
}; |
| 5325 |
}, []); |
| 5326 |
index(() => { |
| 5327 |
if (referenceEl) referenceRef.current = referenceEl; |
| 5328 |
if (floatingEl) floatingRef.current = floatingEl; |
| 5329 |
if (referenceEl && floatingEl) { |
| 5330 |
if (whileElementsMountedRef.current) { |
| 5331 |
return whileElementsMountedRef.current(referenceEl, floatingEl, update2); |
| 5332 |
} |
| 5333 |
update2(); |
| 5334 |
} |
| 5335 |
}, [referenceEl, floatingEl, update2, whileElementsMountedRef, hasWhileElementsMounted]); |
| 5336 |
const refs = React24.useMemo(() => ({ |
| 5337 |
reference: referenceRef, |
| 5338 |
floating: floatingRef, |
| 5339 |
setReference, |
| 5340 |
setFloating |
| 5341 |
}), [setReference, setFloating]); |
| 5342 |
const elements = React24.useMemo(() => ({ |
| 5343 |
reference: referenceEl, |
| 5344 |
floating: floatingEl |
| 5345 |
}), [referenceEl, floatingEl]); |
| 5346 |
const floatingStyles = React24.useMemo(() => { |
| 5347 |
const initialStyles = { |
| 5348 |
position: strategy, |
| 5349 |
left: 0, |
| 5350 |
top: 0 |
| 5351 |
}; |
| 5352 |
if (!elements.floating) { |
| 5353 |
return initialStyles; |
| 5354 |
} |
| 5355 |
const x = roundByDPR(elements.floating, data.x); |
| 5356 |
const y = roundByDPR(elements.floating, data.y); |
| 5357 |
if (transform) { |
| 5358 |
return { |
| 5359 |
...initialStyles, |
| 5360 |
transform: "translate(" + x + "px, " + y + "px)", |
| 5361 |
...getDPR(elements.floating) >= 1.5 && { |
| 5362 |
willChange: "transform" |
| 5363 |
} |
| 5364 |
}; |
| 5365 |
} |
| 5366 |
return { |
| 5367 |
position: strategy, |
| 5368 |
left: x, |
| 5369 |
top: y |
| 5370 |
}; |
| 5371 |
}, [strategy, transform, elements.floating, data.x, data.y]); |
| 5372 |
return React24.useMemo(() => ({ |
| 5373 |
...data, |
| 5374 |
update: update2, |
| 5375 |
refs, |
| 5376 |
elements, |
| 5377 |
floatingStyles |
| 5378 |
}), [data, update2, refs, elements, floatingStyles]); |
| 5379 |
} |
| 5380 |
var offset3 = (options, deps) => { |
| 5381 |
const result = offset2(options); |
| 5382 |
return { |
| 5383 |
name: result.name, |
| 5384 |
fn: result.fn, |
| 5385 |
options: [options, deps] |
| 5386 |
}; |
| 5387 |
}; |
| 5388 |
var shift3 = (options, deps) => { |
| 5389 |
const result = shift2(options); |
| 5390 |
return { |
| 5391 |
name: result.name, |
| 5392 |
fn: result.fn, |
| 5393 |
options: [options, deps] |
| 5394 |
}; |
| 5395 |
}; |
| 5396 |
var limitShift3 = (options, deps) => { |
| 5397 |
const result = limitShift2(options); |
| 5398 |
return { |
| 5399 |
fn: result.fn, |
| 5400 |
options: [options, deps] |
| 5401 |
}; |
| 5402 |
}; |
| 5403 |
var flip3 = (options, deps) => { |
| 5404 |
const result = flip2(options); |
| 5405 |
return { |
| 5406 |
name: result.name, |
| 5407 |
fn: result.fn, |
| 5408 |
options: [options, deps] |
| 5409 |
}; |
| 5410 |
}; |
| 5411 |
var size3 = (options, deps) => { |
| 5412 |
const result = size2(options); |
| 5413 |
return { |
| 5414 |
name: result.name, |
| 5415 |
fn: result.fn, |
| 5416 |
options: [options, deps] |
| 5417 |
}; |
| 5418 |
}; |
| 5419 |
|
| 5420 |
// node_modules/@base-ui/react/utils/popups/popupHandle.mjs |
| 5421 |
var BasePopupHandle = class { |
| 5422 |
/** |
| 5423 |
* Stores of every root currently using this handle, in attach order. A handle is meant to be used |
| 5424 |
* by a single mounted root, but roots can transiently overlap (e.g. during an animated route |
| 5425 |
* transition), so this stack lets `attachStore`'s cleanup restore the previous root instead of |
| 5426 |
* leaving a still-mounted root uncontrollable when a newer overlapping root detaches first. |
| 5427 |
*/ |
| 5428 |
attachedStores = []; |
| 5429 |
/** |
| 5430 |
* Store of the root that currently controls the handle: the most recently attached one still |
| 5431 |
* mounted, or `null` when no root is attached. Imperative methods are no-ops while this is `null`. |
| 5432 |
*/ |
| 5433 |
attachedStoreValue = null; |
| 5434 |
/** |
| 5435 |
* Listeners notified when `attachedStore` changes, so detached triggers can follow the store pointer. |
| 5436 |
*/ |
| 5437 |
storeListeners = /* @__PURE__ */ new Set(); |
| 5438 |
/** |
| 5439 |
* Creates a handle backed by the store used while no root is attached. |
| 5440 |
* |
| 5441 |
* @param fallbackStore Inert, closed store handed to detached triggers while no root is attached, |
| 5442 |
* so they can render and register without a mounted root. Triggers register into whichever store |
| 5443 |
* `store` currently resolves to, so while detached they live in this store's trigger map and |
| 5444 |
* migrate themselves to the root's store (and back) as it attaches/detaches. |
| 5445 |
* @param componentName Component name used to prefix dev warnings, e.g. `'Menu'` produces |
| 5446 |
* `MenuHandle.open()` in warning text. |
| 5447 |
* @param throwOnMissingTrigger Whether `open(triggerId)` throws when no trigger with that id is |
| 5448 |
* registered. Anchored popups (Menu, Popover, Tooltip, PreviewCard) need a trigger to anchor to, |
| 5449 |
* so they throw; Dialog is not anchored and instead opens unassociated with a dev warning. |
| 5450 |
*/ |
| 5451 |
constructor(fallbackStore, componentName, throwOnMissingTrigger = true) { |
| 5452 |
this.fallbackStore = fallbackStore; |
| 5453 |
this.componentName = componentName; |
| 5454 |
this.throwOnMissingTrigger = throwOnMissingTrigger; |
| 5455 |
} |
| 5456 |
get attachedStore() { |
| 5457 |
return this.attachedStoreValue; |
| 5458 |
} |
| 5459 |
/** |
| 5460 |
* Store that detached triggers read from: the attached root's store, or an inert fallback store |
| 5461 |
* used while no root is attached. |
| 5462 |
* @internal |
| 5463 |
*/ |
| 5464 |
get store() { |
| 5465 |
return this.attachedStoreValue ?? this.fallbackStore; |
| 5466 |
} |
| 5467 |
/** |
| 5468 |
* Stable fallback store used for server rendering and hydration. Root stores cannot be recorded on |
| 5469 |
* the handle during render because a handle can be shared by concurrent server-rendered requests. |
| 5470 |
* @internal |
| 5471 |
*/ |
| 5472 |
get serverStore() { |
| 5473 |
return this.fallbackStore; |
| 5474 |
} |
| 5475 |
/** |
| 5476 |
* Subscribes to changes of the attached store pointer so detached triggers re-render and re-bind |
| 5477 |
* when a root attaches or detaches. Returns a function that removes the listener. |
| 5478 |
* @internal |
| 5479 |
*/ |
| 5480 |
subscribeStore(listener) { |
| 5481 |
this.storeListeners.add(listener); |
| 5482 |
return () => { |
| 5483 |
this.storeListeners.delete(listener); |
| 5484 |
}; |
| 5485 |
} |
| 5486 |
/** |
| 5487 |
* Points the handle at a root's store and notifies subscribers so detached triggers re-render and |
| 5488 |
* re-register into it (their registration effect migrates them when the store pointer changes). |
| 5489 |
* Returns a cleanup function that detaches the store again. |
| 5490 |
* @internal |
| 5491 |
*/ |
| 5492 |
attachStore(newStore) { |
| 5493 |
this.attachedStores.push(newStore); |
| 5494 |
this.setActiveStore(newStore); |
| 5495 |
if (true) { |
| 5496 |
if (this.attachedStores.length > 1) { |
| 5497 |
const dev = this; |
| 5498 |
(dev.overlapWarningFrame ??= AnimationFrame.create()).request(() => { |
| 5499 |
if (this.attachedStores.length > 1) { |
| 5500 |
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."); |
| 5501 |
} |
| 5502 |
}); |
| 5503 |
} |
| 5504 |
} |
| 5505 |
return () => { |
| 5506 |
const index2 = this.attachedStores.lastIndexOf(newStore); |
| 5507 |
if (index2 !== -1) { |
| 5508 |
this.attachedStores.splice(index2, 1); |
| 5509 |
} |
| 5510 |
this.setActiveStore(this.attachedStores[this.attachedStores.length - 1] ?? null); |
| 5511 |
}; |
| 5512 |
} |
| 5513 |
/** |
| 5514 |
* Sets the store that currently controls the handle and notifies subscribers when it changes, so |
| 5515 |
* detached triggers re-render and migrate their registration to the new store. |
| 5516 |
*/ |
| 5517 |
setActiveStore(store2) { |
| 5518 |
if (this.attachedStoreValue !== store2) { |
| 5519 |
this.attachedStoreValue = store2; |
| 5520 |
this.storeListeners.forEach((listener) => { |
| 5521 |
listener(); |
| 5522 |
}); |
| 5523 |
} |
| 5524 |
} |
| 5525 |
/** |
| 5526 |
* Opens the attached root's store and associates it with the trigger with the given id, or a |
| 5527 |
* no-op (with a dev warning) while no root is attached. Shared by every concrete handle's public |
| 5528 |
* `open()` method, which only narrows the parameter type. |
| 5529 |
* |
| 5530 |
* When a trigger id is given but no matching trigger is registered, anchored popups throw (see |
| 5531 |
* `throwOnMissingTrigger`); Dialog opens unassociated with a dev warning instead. |
| 5532 |
* |
| 5533 |
* This method should only be called in an event handler or an effect (not during rendering). |
| 5534 |
* |
| 5535 |
* @param triggerId ID of the trigger to associate with the popup, or `null`/`undefined` to open |
| 5536 |
* without associating any trigger. |
| 5537 |
*/ |
| 5538 |
openByTrigger(triggerId) { |
| 5539 |
const attachedStore = this.attachedStore; |
| 5540 |
if (attachedStore === null) { |
| 5541 |
if (true) { |
| 5542 |
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.`); |
| 5543 |
} |
| 5544 |
return; |
| 5545 |
} |
| 5546 |
let triggerElement; |
| 5547 |
if (triggerId) { |
| 5548 |
for (let i = this.attachedStores.length - 1; i >= 0 && !triggerElement; i -= 1) { |
| 5549 |
triggerElement = this.attachedStores[i].context.triggerElements.getById(triggerId); |
| 5550 |
} |
| 5551 |
triggerElement ??= this.fallbackStore.context.triggerElements.getById(triggerId); |
| 5552 |
} |
| 5553 |
if (triggerId && !triggerElement) { |
| 5554 |
if (this.throwOnMissingTrigger) { |
| 5555 |
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)); |
| 5556 |
} |
| 5557 |
if (true) { |
| 5558 |
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.`); |
| 5559 |
} |
| 5560 |
} |
| 5561 |
attachedStore.setOpen(true, createChangeEventDetails(reason_parts_exports.imperativeAction, void 0, triggerElement)); |
| 5562 |
} |
| 5563 |
/** |
| 5564 |
* Closes the popup by setting the attached root's store to closed, or a no-op (with a dev warning) |
| 5565 |
* while no root is attached. Shared by every concrete handle's public `close()` method. |
| 5566 |
* |
| 5567 |
* This method should only be called in an event handler or an effect (not during rendering). |
| 5568 |
*/ |
| 5569 |
closePopup() { |
| 5570 |
const attachedStore = this.attachedStore; |
| 5571 |
if (attachedStore === null) { |
| 5572 |
if (true) { |
| 5573 |
console.warn(`Base UI: ${this.componentName}Handle.close() was called while no root using this handle is mounted. The call was ignored.`); |
| 5574 |
} |
| 5575 |
return; |
| 5576 |
} |
| 5577 |
attachedStore.setOpen(false, createChangeEventDetails(reason_parts_exports.imperativeAction)); |
| 5578 |
} |
| 5579 |
}; |
| 5580 |
|
| 5581 |
// node_modules/@base-ui/react/utils/popups/popupStoreUtils.mjs |
| 5582 |
var React29 = __toESM(require_react(), 1); |
| 5583 |
var ReactDOM4 = __toESM(require_react_dom(), 1); |
| 5584 |
|
| 5585 |
// node_modules/@base-ui/react/floating-ui-react/hooks/useSyncedFloatingRootContext.mjs |
| 5586 |
var React28 = __toESM(require_react(), 1); |
| 5587 |
|
| 5588 |
// node_modules/@base-ui/utils/store/useStore.mjs |
| 5589 |
var React26 = __toESM(require_react(), 1); |
| 5590 |
var import_shim = __toESM(require_shim(), 1); |
| 5591 |
var import_with_selector = __toESM(require_with_selector(), 1); |
| 5592 |
|
| 5593 |
// node_modules/@base-ui/utils/fastHooks.mjs |
| 5594 |
var React25 = __toESM(require_react(), 1); |
| 5595 |
var hooks = []; |
| 5596 |
var currentInstance = void 0; |
| 5597 |
function getInstance() { |
| 5598 |
return currentInstance; |
| 5599 |
} |
| 5600 |
function register(hook) { |
| 5601 |
hooks.push(hook); |
| 5602 |
} |
| 5603 |
function fastComponent(fn) { |
| 5604 |
const FastComponent = (props, forwardedRef) => { |
| 5605 |
const instance = useRefWithInit(createInstance).current; |
| 5606 |
let result; |
| 5607 |
try { |
| 5608 |
currentInstance = instance; |
| 5609 |
for (const hook of hooks) { |
| 5610 |
hook.before(instance); |
| 5611 |
} |
| 5612 |
result = fn(props, forwardedRef); |
| 5613 |
for (const hook of hooks) { |
| 5614 |
hook.after(instance); |
| 5615 |
} |
| 5616 |
instance.didInitialize = true; |
| 5617 |
} finally { |
| 5618 |
currentInstance = void 0; |
| 5619 |
} |
| 5620 |
return result; |
| 5621 |
}; |
| 5622 |
FastComponent.displayName = fn.displayName || fn.name; |
| 5623 |
return FastComponent; |
| 5624 |
} |
| 5625 |
function fastComponentRef(fn) { |
| 5626 |
return /* @__PURE__ */ React25.forwardRef(fastComponent(fn)); |
| 5627 |
} |
| 5628 |
function createInstance() { |
| 5629 |
return { |
| 5630 |
didInitialize: false |
| 5631 |
}; |
| 5632 |
} |
| 5633 |
|
| 5634 |
// node_modules/@base-ui/utils/store/useStore.mjs |
| 5635 |
var canUseRawUseSyncExternalStore = isReactVersionAtLeast(19); |
| 5636 |
var useStoreImplementation = canUseRawUseSyncExternalStore ? useStoreFast : useStoreLegacy; |
| 5637 |
function useStore(store2, selector, a1, a2, a3) { |
| 5638 |
return useStoreImplementation(store2, selector, a1, a2, a3); |
| 5639 |
} |
| 5640 |
function useStoreR19(store2, selector, a1, a2, a3) { |
| 5641 |
const getSelection = React26.useCallback(() => selector(store2.getSnapshot(), a1, a2, a3), [store2, selector, a1, a2, a3]); |
| 5642 |
return (0, import_shim.useSyncExternalStore)(store2.subscribe, getSelection, getSelection); |
| 5643 |
} |
| 5644 |
register({ |
| 5645 |
before(instance) { |
| 5646 |
instance.syncIndex = 0; |
| 5647 |
if (!instance.didInitialize) { |
| 5648 |
instance.syncTick = 1; |
| 5649 |
instance.syncHooks = []; |
| 5650 |
instance.didChangeStore = true; |
| 5651 |
instance.getSnapshot = () => { |
| 5652 |
let didChange2 = false; |
| 5653 |
for (let i = 0; i < instance.syncHooks.length; i += 1) { |
| 5654 |
const hook = instance.syncHooks[i]; |
| 5655 |
const value = hook.selector(hook.store.state, hook.a1, hook.a2, hook.a3); |
| 5656 |
if (!Object.is(hook.value, value)) { |
| 5657 |
didChange2 = true; |
| 5658 |
hook.value = value; |
| 5659 |
} |
| 5660 |
} |
| 5661 |
if (didChange2) { |
| 5662 |
instance.syncTick += 1; |
| 5663 |
} |
| 5664 |
return instance.syncTick; |
| 5665 |
}; |
| 5666 |
} |
| 5667 |
}, |
| 5668 |
after(instance) { |
| 5669 |
if (instance.syncHooks.length > 0) { |
| 5670 |
if (instance.didChangeStore) { |
| 5671 |
instance.didChangeStore = false; |
| 5672 |
instance.subscribe = (onStoreChange) => { |
| 5673 |
const stores = /* @__PURE__ */ new Set(); |
| 5674 |
for (const hook of instance.syncHooks) { |
| 5675 |
stores.add(hook.store); |
| 5676 |
} |
| 5677 |
const unsubscribes = []; |
| 5678 |
for (const store2 of stores) { |
| 5679 |
unsubscribes.push(store2.subscribe(onStoreChange)); |
| 5680 |
} |
| 5681 |
return () => { |
| 5682 |
for (const unsubscribe of unsubscribes) { |
| 5683 |
unsubscribe(); |
| 5684 |
} |
| 5685 |
}; |
| 5686 |
}; |
| 5687 |
} |
| 5688 |
(0, import_shim.useSyncExternalStore)(instance.subscribe, instance.getSnapshot, instance.getSnapshot); |
| 5689 |
} |
| 5690 |
} |
| 5691 |
}); |
| 5692 |
function useStoreFast(store2, selector, a1, a2, a3) { |
| 5693 |
const instance = getInstance(); |
| 5694 |
if (!instance) { |
| 5695 |
return useStoreR19(store2, selector, a1, a2, a3); |
| 5696 |
} |
| 5697 |
const index2 = instance.syncIndex; |
| 5698 |
instance.syncIndex += 1; |
| 5699 |
let hook; |
| 5700 |
if (!instance.didInitialize) { |
| 5701 |
hook = { |
| 5702 |
store: store2, |
| 5703 |
selector, |
| 5704 |
a1, |
| 5705 |
a2, |
| 5706 |
a3, |
| 5707 |
value: selector(store2.getSnapshot(), a1, a2, a3) |
| 5708 |
}; |
| 5709 |
instance.syncHooks.push(hook); |
| 5710 |
} else { |
| 5711 |
hook = instance.syncHooks[index2]; |
| 5712 |
if (hook.store !== store2 || hook.selector !== selector || !Object.is(hook.a1, a1) || !Object.is(hook.a2, a2) || !Object.is(hook.a3, a3)) { |
| 5713 |
if (hook.store !== store2) { |
| 5714 |
instance.didChangeStore = true; |
| 5715 |
} |
| 5716 |
hook.store = store2; |
| 5717 |
hook.selector = selector; |
| 5718 |
hook.a1 = a1; |
| 5719 |
hook.a2 = a2; |
| 5720 |
hook.a3 = a3; |
| 5721 |
hook.value = selector(store2.getSnapshot(), a1, a2, a3); |
| 5722 |
} |
| 5723 |
} |
| 5724 |
return hook.value; |
| 5725 |
} |
| 5726 |
function useStoreLegacy(store2, selector, a1, a2, a3) { |
| 5727 |
return (0, import_with_selector.useSyncExternalStoreWithSelector)(store2.subscribe, store2.getSnapshot, store2.getSnapshot, (state) => selector(state, a1, a2, a3)); |
| 5728 |
} |
| 5729 |
|
| 5730 |
// node_modules/@base-ui/utils/store/Store.mjs |
| 5731 |
var Store = class { |
| 5732 |
/** |
| 5733 |
* Creates a store with the given initial state, constructing the class it is called on. |
| 5734 |
* Calling it on a generic base class (e.g. `ReactStore.create(...)`) constructs that |
| 5735 |
* class but degrades the inferred instance type to `Store`; use `new` there instead. |
| 5736 |
*/ |
| 5737 |
static create(state) { |
| 5738 |
return new this(state); |
| 5739 |
} |
| 5740 |
/** |
| 5741 |
* The current state of the store. |
| 5742 |
* This property is updated immediately when the state changes as a result of calling {@link setState}, {@link update}, or {@link set}. |
| 5743 |
* 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). |
| 5744 |
* The values can be used directly (to avoid subscribing to the store) in effects or event handlers. |
| 5745 |
* |
| 5746 |
* Do not modify properties in state directly. Instead, use the provided methods to ensure proper state management and listener notification. |
| 5747 |
*/ |
| 5748 |
// Internal state to handle recursive `setState()` calls |
| 5749 |
constructor(state) { |
| 5750 |
this.state = state; |
| 5751 |
this.listeners = /* @__PURE__ */ new Set(); |
| 5752 |
this.updateTick = 0; |
| 5753 |
} |
| 5754 |
/** |
| 5755 |
* Registers a listener that will be called whenever the store's state changes. |
| 5756 |
* |
| 5757 |
* @param fn The listener function to be called on state changes. |
| 5758 |
* @returns A function to unsubscribe the listener. |
| 5759 |
*/ |
| 5760 |
subscribe = (fn) => { |
| 5761 |
this.listeners.add(fn); |
| 5762 |
return () => { |
| 5763 |
this.listeners.delete(fn); |
| 5764 |
}; |
| 5765 |
}; |
| 5766 |
/** |
| 5767 |
* Returns the current state of the store. |
| 5768 |
*/ |
| 5769 |
getSnapshot = () => { |
| 5770 |
return this.state; |
| 5771 |
}; |
| 5772 |
/** |
| 5773 |
* Updates the entire store's state and notifies all registered listeners. |
| 5774 |
* |
| 5775 |
* @param newState The new state to set for the store. |
| 5776 |
*/ |
| 5777 |
setState(newState) { |
| 5778 |
if (this.state === newState) { |
| 5779 |
return; |
| 5780 |
} |
| 5781 |
this.state = newState; |
| 5782 |
this.updateTick += 1; |
| 5783 |
const currentTick = this.updateTick; |
| 5784 |
for (const listener of this.listeners) { |
| 5785 |
if (currentTick !== this.updateTick) { |
| 5786 |
return; |
| 5787 |
} |
| 5788 |
listener(newState); |
| 5789 |
} |
| 5790 |
} |
| 5791 |
/** |
| 5792 |
* Merges the provided changes into the current state and notifies listeners if there are changes. |
| 5793 |
* Each value must match its state key. Pass an exact known subset rather than a broad |
| 5794 |
* `Partial<State>`, which may contain `undefined` for required state fields. |
| 5795 |
* |
| 5796 |
* @param changes An object containing the changes to apply to the current state. |
| 5797 |
*/ |
| 5798 |
update(changes) { |
| 5799 |
for (const key in changes) { |
| 5800 |
if (!Object.is(this.state[key], changes[key])) { |
| 5801 |
this.setState({ |
| 5802 |
...this.state, |
| 5803 |
...changes |
| 5804 |
}); |
| 5805 |
return; |
| 5806 |
} |
| 5807 |
} |
| 5808 |
} |
| 5809 |
/** |
| 5810 |
* Sets a specific key in the store's state to a new value and notifies listeners if the value has changed. |
| 5811 |
* |
| 5812 |
* @param key The key in the store's state to update. |
| 5813 |
* @param value The new value to set for the specified key. |
| 5814 |
*/ |
| 5815 |
set(key, value) { |
| 5816 |
if (!Object.is(this.state[key], value)) { |
| 5817 |
this.setState({ |
| 5818 |
...this.state, |
| 5819 |
[key]: value |
| 5820 |
}); |
| 5821 |
} |
| 5822 |
} |
| 5823 |
/** |
| 5824 |
* Gives the state a new reference and updates all registered listeners. |
| 5825 |
*/ |
| 5826 |
notifyAll() { |
| 5827 |
const newState = { |
| 5828 |
...this.state |
| 5829 |
}; |
| 5830 |
this.setState(newState); |
| 5831 |
} |
| 5832 |
use(selector, a1, a2, a3) { |
| 5833 |
return useStore(this, selector, a1, a2, a3); |
| 5834 |
} |
| 5835 |
}; |
| 5836 |
|
| 5837 |
// node_modules/@base-ui/utils/store/ReactStore.mjs |
| 5838 |
var React27 = __toESM(require_react(), 1); |
| 5839 |
var ReactStore = class extends Store { |
| 5840 |
/** |
| 5841 |
* Creates a new ReactStore instance. |
| 5842 |
* |
| 5843 |
* @param state Initial state of the store. |
| 5844 |
* @param context Non-reactive context values. |
| 5845 |
* @param selectors Optional selectors for use with `useState`. |
| 5846 |
*/ |
| 5847 |
constructor(state, context = {}, selectors3) { |
| 5848 |
super(state); |
| 5849 |
this.context = context; |
| 5850 |
this.selectors = selectors3; |
| 5851 |
} |
| 5852 |
/** |
| 5853 |
* Non-reactive values such as refs, callbacks, etc. |
| 5854 |
*/ |
| 5855 |
/** |
| 5856 |
* Synchronizes a single external value into the store. |
| 5857 |
* |
| 5858 |
* Note that the while the value in `state` is updated immediately, the value returned |
| 5859 |
* by `useState` is updated before the next render (similarly to React's `useState`). |
| 5860 |
*/ |
| 5861 |
useSyncedValue(key, value) { |
| 5862 |
React27.useDebugValue(key); |
| 5863 |
const store2 = this; |
| 5864 |
useIsoLayoutEffect(() => { |
| 5865 |
if (store2.state[key] !== value) { |
| 5866 |
store2.set(key, value); |
| 5867 |
} |
| 5868 |
}, [store2, key, value]); |
| 5869 |
} |
| 5870 |
/** |
| 5871 |
* Synchronizes a single external value into the store and |
| 5872 |
* cleans it up (sets to `undefined`) on unmount. |
| 5873 |
* |
| 5874 |
* Note that the while the value in `state` is updated immediately, the value returned |
| 5875 |
* by `useState` is updated before the next render (similarly to React's `useState`). |
| 5876 |
*/ |
| 5877 |
useSyncedValueWithCleanup(key, value) { |
| 5878 |
const store2 = this; |
| 5879 |
useIsoLayoutEffect(() => { |
| 5880 |
if (store2.state[key] !== value) { |
| 5881 |
store2.set(key, value); |
| 5882 |
} |
| 5883 |
return () => { |
| 5884 |
store2.set(key, void 0); |
| 5885 |
}; |
| 5886 |
}, [store2, key, value]); |
| 5887 |
} |
| 5888 |
/** |
| 5889 |
* Synchronizes multiple external values into the store. |
| 5890 |
* Each value must match its state key. Pass an exact known subset rather than a broad |
| 5891 |
* `Partial<State>`, which may contain `undefined` for required state fields. |
| 5892 |
* |
| 5893 |
* Note that the while the values in `state` are updated immediately, the values returned |
| 5894 |
* by `useState` are updated before the next render (similarly to React's `useState`). |
| 5895 |
* |
| 5896 |
* @param statePart An exact subset of state fields to synchronize. Unknown keys are not accepted. |
| 5897 |
*/ |
| 5898 |
useSyncedValues(statePart) { |
| 5899 |
const store2 = this; |
| 5900 |
if (true) { |
| 5901 |
React27.useDebugValue(statePart, (p) => Object.keys(p)); |
| 5902 |
const keys = React27.useRef(Object.keys(statePart)).current; |
| 5903 |
const nextKeys = Object.keys(statePart); |
| 5904 |
if (keys.length !== nextKeys.length || keys.some((key, index2) => key !== nextKeys[index2])) { |
| 5905 |
console.error("ReactStore.useSyncedValues expects the same prop keys on every render. Keys should be stable."); |
| 5906 |
} |
| 5907 |
} |
| 5908 |
const dependencies = Object.values(statePart); |
| 5909 |
useIsoLayoutEffect(() => { |
| 5910 |
store2.update(statePart); |
| 5911 |
}, [store2, ...dependencies]); |
| 5912 |
} |
| 5913 |
/** |
| 5914 |
* Registers a controllable prop pair (`controlled`, `defaultValue`) for a specific key. If `controlled` |
| 5915 |
* is non-undefined, the store's state at `key` is updated to match `controlled`. |
| 5916 |
*/ |
| 5917 |
useControlledProp(key, controlled) { |
| 5918 |
React27.useDebugValue(key); |
| 5919 |
const store2 = this; |
| 5920 |
const isControlled = controlled !== void 0; |
| 5921 |
useIsoLayoutEffect(() => { |
| 5922 |
if (isControlled && !Object.is(store2.state[key], controlled)) { |
| 5923 |
store2.setState({ |
| 5924 |
...store2.state, |
| 5925 |
[key]: controlled |
| 5926 |
}); |
| 5927 |
} |
| 5928 |
}, [store2, key, controlled, isControlled]); |
| 5929 |
if (true) { |
| 5930 |
const cache = this.controlledValues ??= /* @__PURE__ */ new Map(); |
| 5931 |
if (!cache.has(key)) { |
| 5932 |
cache.set(key, isControlled); |
| 5933 |
} |
| 5934 |
const previouslyControlled = cache.get(key); |
| 5935 |
if (previouslyControlled !== void 0 && previouslyControlled !== isControlled) { |
| 5936 |
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).`); |
| 5937 |
} |
| 5938 |
} |
| 5939 |
} |
| 5940 |
/** Gets the current value from the store using a selector with the provided key. |
| 5941 |
* |
| 5942 |
* @param key Key of the selector to use. |
| 5943 |
*/ |
| 5944 |
select(key, a1, a2, a3) { |
| 5945 |
const selector = this.selectors[key]; |
| 5946 |
return selector(this.state, a1, a2, a3); |
| 5947 |
} |
| 5948 |
/** |
| 5949 |
* Returns a value from the store's state using a selector function. |
| 5950 |
* Used to subscribe to specific parts of the state. |
| 5951 |
* This methods causes a rerender whenever the selected state changes. |
| 5952 |
* |
| 5953 |
* @param key Key of the selector to use. |
| 5954 |
*/ |
| 5955 |
useState(key, a1, a2, a3) { |
| 5956 |
React27.useDebugValue(key); |
| 5957 |
return useStore(this, this.selectors[key], a1, a2, a3); |
| 5958 |
} |
| 5959 |
/** |
| 5960 |
* Wraps a function with `useStableCallback` to ensure it has a stable reference |
| 5961 |
* and assigns it to the context. |
| 5962 |
* |
| 5963 |
* @param key Key of the event callback. Must be a function in the context. |
| 5964 |
* @param fn Function to assign. |
| 5965 |
*/ |
| 5966 |
useContextCallback(key, fn) { |
| 5967 |
React27.useDebugValue(key); |
| 5968 |
const stableFunction = useStableCallback(fn ?? NOOP); |
| 5969 |
this.context[key] = stableFunction; |
| 5970 |
} |
| 5971 |
/** |
| 5972 |
* Returns a stable setter function for a specific key in the store's state. |
| 5973 |
* It's commonly used to pass as a ref callback to React elements. |
| 5974 |
* |
| 5975 |
* @param key Key of the state to set. |
| 5976 |
*/ |
| 5977 |
useStateSetter(key) { |
| 5978 |
const ref = React27.useRef(void 0); |
| 5979 |
if (ref.current === void 0) { |
| 5980 |
ref.current = (value) => { |
| 5981 |
this.set(key, value); |
| 5982 |
}; |
| 5983 |
} |
| 5984 |
return ref.current; |
| 5985 |
} |
| 5986 |
/** |
| 5987 |
* Observes changes derived from the store's selectors and calls the listener when the selected value changes. |
| 5988 |
* |
| 5989 |
* @param key Key of the selector to observe. |
| 5990 |
* @param listener Listener function called when the selector result changes. |
| 5991 |
*/ |
| 5992 |
observe(selector, listener) { |
| 5993 |
let selectFn; |
| 5994 |
if (typeof selector === "function") { |
| 5995 |
selectFn = selector; |
| 5996 |
} else { |
| 5997 |
selectFn = this.selectors[selector]; |
| 5998 |
} |
| 5999 |
let prevValue = selectFn(this.state); |
| 6000 |
listener(prevValue, prevValue, this); |
| 6001 |
return this.subscribe((nextState) => { |
| 6002 |
const nextValue = selectFn(nextState); |
| 6003 |
if (!Object.is(prevValue, nextValue)) { |
| 6004 |
const oldValue = prevValue; |
| 6005 |
prevValue = nextValue; |
| 6006 |
listener(nextValue, oldValue, this); |
| 6007 |
} |
| 6008 |
}); |
| 6009 |
} |
| 6010 |
}; |
| 6011 |
|
| 6012 |
// node_modules/@base-ui/react/floating-ui-react/components/FloatingRootStore.mjs |
| 6013 |
var selectors = { |
| 6014 |
open: (state) => state.open, |
| 6015 |
transitionStatus: (state) => state.transitionStatus, |
| 6016 |
domReferenceElement: (state) => state.domReferenceElement, |
| 6017 |
referenceElement: (state) => state.positionReference ?? state.referenceElement, |
| 6018 |
floatingElement: (state) => state.floatingElement, |
| 6019 |
floatingId: (state) => state.floatingId |
| 6020 |
}; |
| 6021 |
var FloatingRootStore = class extends ReactStore { |
| 6022 |
constructor(options) { |
| 6023 |
const { |
| 6024 |
syncOnly, |
| 6025 |
nested, |
| 6026 |
onOpenChange, |
| 6027 |
triggerElements, |
| 6028 |
...initialState |
| 6029 |
} = options; |
| 6030 |
super({ |
| 6031 |
...initialState, |
| 6032 |
positionReference: initialState.referenceElement, |
| 6033 |
domReferenceElement: initialState.referenceElement |
| 6034 |
}, { |
| 6035 |
onOpenChange, |
| 6036 |
dataRef: { |
| 6037 |
current: {} |
| 6038 |
}, |
| 6039 |
events: createEventEmitter(), |
| 6040 |
nested, |
| 6041 |
triggerElements |
| 6042 |
}, selectors); |
| 6043 |
this.syncOnly = syncOnly; |
| 6044 |
} |
| 6045 |
/** |
| 6046 |
* Syncs the event used by hover logic to distinguish hover-open from click-like interaction. |
| 6047 |
*/ |
| 6048 |
syncOpenEvent = (newOpen, event) => { |
| 6049 |
if (!newOpen || !this.state.open || // Prevent a pending hover-open from overwriting a click-open event, while allowing |
| 6050 |
// click events to upgrade a hover-open. |
| 6051 |
event != null && isClickLikeEvent(event)) { |
| 6052 |
this.context.dataRef.current.openEvent = newOpen ? event : void 0; |
| 6053 |
} |
| 6054 |
}; |
| 6055 |
/** |
| 6056 |
* Runs the root-owned side effects for an open state change. |
| 6057 |
*/ |
| 6058 |
dispatchOpenChange = (newOpen, eventDetails) => { |
| 6059 |
this.syncOpenEvent(newOpen, eventDetails.event); |
| 6060 |
const details = { |
| 6061 |
open: newOpen, |
| 6062 |
reason: eventDetails.reason, |
| 6063 |
nativeEvent: eventDetails.event, |
| 6064 |
nested: this.context.nested, |
| 6065 |
triggerElement: eventDetails.trigger |
| 6066 |
}; |
| 6067 |
this.context.events.emit("openchange", details); |
| 6068 |
}; |
| 6069 |
/** |
| 6070 |
* Emits the `openchange` event through the internal event emitter and calls the `onOpenChange` handler with the provided arguments. |
| 6071 |
* |
| 6072 |
* @param newOpen The new open state. |
| 6073 |
* @param eventDetails Details about the event that triggered the open state change. |
| 6074 |
*/ |
| 6075 |
setOpen = (newOpen, eventDetails) => { |
| 6076 |
if (this.syncOnly) { |
| 6077 |
this.context.onOpenChange?.(newOpen, eventDetails); |
| 6078 |
return; |
| 6079 |
} |
| 6080 |
this.dispatchOpenChange(newOpen, eventDetails); |
| 6081 |
this.context.onOpenChange?.(newOpen, eventDetails); |
| 6082 |
}; |
| 6083 |
}; |
| 6084 |
|
| 6085 |
// node_modules/@base-ui/react/floating-ui-react/hooks/useSyncedFloatingRootContext.mjs |
| 6086 |
function useSyncedFloatingRootContext(options) { |
| 6087 |
const { |
| 6088 |
popupStore, |
| 6089 |
treatPopupAsFloatingElement = false, |
| 6090 |
floatingRootContext: floatingRootContextProp, |
| 6091 |
floatingId, |
| 6092 |
nested, |
| 6093 |
onOpenChange |
| 6094 |
} = options; |
| 6095 |
const open3 = popupStore.useState("open"); |
| 6096 |
const referenceElement = popupStore.useState("activeTriggerElement"); |
| 6097 |
const floatingElement = popupStore.useState(treatPopupAsFloatingElement ? "popupElement" : "positionerElement"); |
| 6098 |
const triggerElements = popupStore.context.triggerElements; |
| 6099 |
const handleOpenChange = onOpenChange; |
| 6100 |
const internalStoreRef = React28.useRef(null); |
| 6101 |
if (floatingRootContextProp === void 0 && internalStoreRef.current === null) { |
| 6102 |
internalStoreRef.current = new FloatingRootStore({ |
| 6103 |
open: open3, |
| 6104 |
transitionStatus: void 0, |
| 6105 |
referenceElement, |
| 6106 |
floatingElement, |
| 6107 |
triggerElements, |
| 6108 |
onOpenChange: handleOpenChange, |
| 6109 |
floatingId, |
| 6110 |
syncOnly: true, |
| 6111 |
nested |
| 6112 |
}); |
| 6113 |
} |
| 6114 |
const store2 = floatingRootContextProp ?? internalStoreRef.current; |
| 6115 |
popupStore.useSyncedValue("floatingId", floatingId); |
| 6116 |
useIsoLayoutEffect(() => { |
| 6117 |
const valuesToSync = { |
| 6118 |
open: open3, |
| 6119 |
floatingId, |
| 6120 |
referenceElement, |
| 6121 |
floatingElement |
| 6122 |
}; |
| 6123 |
if (isElement(referenceElement)) { |
| 6124 |
valuesToSync.domReferenceElement = referenceElement; |
| 6125 |
} |
| 6126 |
if (store2.state.positionReference === store2.state.referenceElement) { |
| 6127 |
valuesToSync.positionReference = referenceElement; |
| 6128 |
} |
| 6129 |
store2.update(valuesToSync); |
| 6130 |
}, [open3, floatingId, referenceElement, floatingElement, store2]); |
| 6131 |
store2.context.onOpenChange = handleOpenChange; |
| 6132 |
store2.context.nested = nested; |
| 6133 |
return store2; |
| 6134 |
} |
| 6135 |
|
| 6136 |
// node_modules/@base-ui/react/utils/popups/popupStoreUtils.mjs |
| 6137 |
var FOCUSABLE_POPUP_PROPS = { |
| 6138 |
tabIndex: -1, |
| 6139 |
[FOCUSABLE_ATTRIBUTE]: "" |
| 6140 |
}; |
| 6141 |
function usePopupRootStore(createStore, treatPopupAsFloatingElement = false) { |
| 6142 |
const floatingId = useId(); |
| 6143 |
const nested = useFloatingParentNodeId() != null; |
| 6144 |
const store2 = useRefWithInit(() => createStore(floatingId, nested)).current; |
| 6145 |
useSyncedFloatingRootContext({ |
| 6146 |
popupStore: store2, |
| 6147 |
treatPopupAsFloatingElement, |
| 6148 |
floatingRootContext: store2.state.floatingRootContext, |
| 6149 |
floatingId, |
| 6150 |
nested, |
| 6151 |
onOpenChange: store2.setOpen |
| 6152 |
}); |
| 6153 |
return store2; |
| 6154 |
} |
| 6155 |
function PopupHandleAttachment({ |
| 6156 |
handle, |
| 6157 |
store: store2 |
| 6158 |
}) { |
| 6159 |
useIsoLayoutEffect(() => { |
| 6160 |
return handle.attachStore(store2); |
| 6161 |
}, [handle, store2]); |
| 6162 |
return null; |
| 6163 |
} |
| 6164 |
function syncTriggerCount(store2) { |
| 6165 |
const triggerCount = store2.context.triggerElements.size; |
| 6166 |
if (store2.select("open") && store2.state.triggerCount !== triggerCount) { |
| 6167 |
store2.set("triggerCount", triggerCount); |
| 6168 |
} |
| 6169 |
} |
| 6170 |
function useTriggerRegistration(id, store2) { |
| 6171 |
const registrationRef = React29.useRef(null); |
| 6172 |
return useStableCallback((element) => { |
| 6173 |
const registration = registrationRef.current; |
| 6174 |
if (registration !== null) { |
| 6175 |
if (registration.element === element && registration.store === store2 && registration.id === id) { |
| 6176 |
return; |
| 6177 |
} |
| 6178 |
registrationRef.current = null; |
| 6179 |
const registeredStore = registration.store; |
| 6180 |
if (registeredStore.context.triggerElements.getById(registration.id) === registration.element) { |
| 6181 |
registeredStore.context.triggerElements.delete(registration.id); |
| 6182 |
syncTriggerCount(registeredStore); |
| 6183 |
} |
| 6184 |
} |
| 6185 |
if (element !== null && id !== void 0) { |
| 6186 |
registrationRef.current = { |
| 6187 |
store: store2, |
| 6188 |
id, |
| 6189 |
element |
| 6190 |
}; |
| 6191 |
store2.context.triggerElements.add(id, element); |
| 6192 |
syncTriggerCount(store2); |
| 6193 |
} |
| 6194 |
}); |
| 6195 |
} |
| 6196 |
function createPopupOpenState(state, open3, trigger, preventUnmountOnClose = false) { |
| 6197 |
let preventUnmountingOnClose = state.preventUnmountingOnClose; |
| 6198 |
if (open3) { |
| 6199 |
preventUnmountingOnClose = false; |
| 6200 |
} else if (preventUnmountOnClose) { |
| 6201 |
preventUnmountingOnClose = true; |
| 6202 |
} |
| 6203 |
const triggerId = trigger?.id ?? null; |
| 6204 |
let activeTriggerId = state.activeTriggerId; |
| 6205 |
let activeTriggerElement = state.activeTriggerElement; |
| 6206 |
if (triggerId || open3) { |
| 6207 |
activeTriggerId = triggerId; |
| 6208 |
activeTriggerElement = trigger ?? null; |
| 6209 |
} |
| 6210 |
return { |
| 6211 |
open: open3, |
| 6212 |
preventUnmountingOnClose, |
| 6213 |
activeTriggerId, |
| 6214 |
activeTriggerElement |
| 6215 |
}; |
| 6216 |
} |
| 6217 |
function attachPreventUnmountOnClose(eventDetails) { |
| 6218 |
let preventUnmountOnClose = false; |
| 6219 |
eventDetails.preventUnmountOnClose = () => { |
| 6220 |
preventUnmountOnClose = true; |
| 6221 |
}; |
| 6222 |
return () => preventUnmountOnClose; |
| 6223 |
} |
| 6224 |
function applyPopupOpenChange(store2, nextOpen, eventDetails, options = {}) { |
| 6225 |
const reason = eventDetails.reason; |
| 6226 |
const isHover = reason === reason_parts_exports.triggerHover; |
| 6227 |
const isFocusOpen = nextOpen && reason === reason_parts_exports.triggerFocus; |
| 6228 |
const isDismissClose = !nextOpen && (reason === reason_parts_exports.triggerPress || reason === reason_parts_exports.escapeKey); |
| 6229 |
const shouldPreventUnmountOnClose = attachPreventUnmountOnClose(eventDetails); |
| 6230 |
store2.context.onOpenChange?.(nextOpen, eventDetails); |
| 6231 |
if (eventDetails.isCanceled) { |
| 6232 |
return; |
| 6233 |
} |
| 6234 |
options.onBeforeDispatch?.(); |
| 6235 |
store2.state.floatingRootContext.dispatchOpenChange(nextOpen, eventDetails); |
| 6236 |
const changeState = () => { |
| 6237 |
const popupOpenState = createPopupOpenState(store2.state, nextOpen, eventDetails.trigger, shouldPreventUnmountOnClose()); |
| 6238 |
const updatedState = { |
| 6239 |
...options.extraState, |
| 6240 |
...popupOpenState |
| 6241 |
}; |
| 6242 |
if (isFocusOpen) { |
| 6243 |
updatedState.instantType = "focus"; |
| 6244 |
} else if (isDismissClose) { |
| 6245 |
updatedState.instantType = "dismiss"; |
| 6246 |
} else if (isHover) { |
| 6247 |
updatedState.instantType = void 0; |
| 6248 |
} |
| 6249 |
store2.update(updatedState); |
| 6250 |
}; |
| 6251 |
if (isHover) { |
| 6252 |
ReactDOM4.flushSync(changeState); |
| 6253 |
} else { |
| 6254 |
changeState(); |
| 6255 |
} |
| 6256 |
} |
| 6257 |
function useTriggerDataForwarding(triggerId, triggerElementRef, store2, stateUpdates) { |
| 6258 |
const isMountedByThisTrigger = store2.useState("isMountedByTrigger", triggerId); |
| 6259 |
const baseRegisterTrigger = useTriggerRegistration(triggerId, store2); |
| 6260 |
const applyTriggerData = useStableCallback((element) => { |
| 6261 |
const open3 = store2.select("open"); |
| 6262 |
const activeTriggerId = store2.select("activeTriggerId"); |
| 6263 |
if (activeTriggerId === triggerId) { |
| 6264 |
const changes = { |
| 6265 |
activeTriggerElement: element, |
| 6266 |
...open3 ? stateUpdates : null |
| 6267 |
}; |
| 6268 |
store2.update(changes); |
| 6269 |
return; |
| 6270 |
} |
| 6271 |
if (activeTriggerId == null && open3) { |
| 6272 |
const changes = { |
| 6273 |
activeTriggerId: triggerId ?? null, |
| 6274 |
activeTriggerElement: element, |
| 6275 |
...stateUpdates |
| 6276 |
}; |
| 6277 |
store2.update(changes); |
| 6278 |
} |
| 6279 |
}); |
| 6280 |
const registerTrigger = useStableCallback((element) => { |
| 6281 |
baseRegisterTrigger(element); |
| 6282 |
if (element) { |
| 6283 |
applyTriggerData(element); |
| 6284 |
} |
| 6285 |
}); |
| 6286 |
useIsoLayoutEffect(() => { |
| 6287 |
registerTrigger(triggerElementRef.current); |
| 6288 |
return () => registerTrigger(null); |
| 6289 |
}, [registerTrigger, triggerElementRef, store2, triggerId]); |
| 6290 |
useIsoLayoutEffect(() => { |
| 6291 |
if (isMountedByThisTrigger) { |
| 6292 |
const changes = { |
| 6293 |
activeTriggerElement: triggerElementRef.current, |
| 6294 |
...stateUpdates |
| 6295 |
}; |
| 6296 |
store2.update(changes); |
| 6297 |
} |
| 6298 |
}, [isMountedByThisTrigger, store2, triggerElementRef, ...Object.values(stateUpdates)]); |
| 6299 |
return { |
| 6300 |
registerTrigger, |
| 6301 |
isMountedByThisTrigger |
| 6302 |
}; |
| 6303 |
} |
| 6304 |
function useImplicitActiveTrigger(store2, options = {}) { |
| 6305 |
const { |
| 6306 |
closeOnActiveTriggerUnmount = false |
| 6307 |
} = options; |
| 6308 |
const resolvedActiveTriggerIdRef = React29.useRef(null); |
| 6309 |
const open3 = store2.useState("open"); |
| 6310 |
const reactiveTriggerCount = store2.useState("triggerCount"); |
| 6311 |
const activeTriggerId = store2.useState("activeTriggerId"); |
| 6312 |
const reactiveActiveTriggerElement = store2.useState("activeTriggerElement"); |
| 6313 |
useIsoLayoutEffect(() => { |
| 6314 |
if (!open3) { |
| 6315 |
resolvedActiveTriggerIdRef.current = null; |
| 6316 |
if (store2.state.triggerCount !== 0) { |
| 6317 |
store2.set("triggerCount", 0); |
| 6318 |
} |
| 6319 |
return; |
| 6320 |
} |
| 6321 |
const triggerCount = store2.context.triggerElements.size; |
| 6322 |
const stateUpdates = {}; |
| 6323 |
if (store2.state.triggerCount !== triggerCount) { |
| 6324 |
stateUpdates.triggerCount = triggerCount; |
| 6325 |
} |
| 6326 |
const currentActiveTriggerId = store2.select("activeTriggerId"); |
| 6327 |
let lostActiveTriggerId = null; |
| 6328 |
if (currentActiveTriggerId) { |
| 6329 |
const activeTriggerElement = store2.context.triggerElements.getById(currentActiveTriggerId); |
| 6330 |
if (!activeTriggerElement) { |
| 6331 |
for (const [triggerId, triggerElement] of store2.context.triggerElements.entries()) { |
| 6332 |
if (triggerElement === store2.state.activeTriggerElement) { |
| 6333 |
stateUpdates.activeTriggerId = triggerId; |
| 6334 |
stateUpdates.activeTriggerElement = triggerElement; |
| 6335 |
resolvedActiveTriggerIdRef.current = triggerId; |
| 6336 |
break; |
| 6337 |
} |
| 6338 |
} |
| 6339 |
if (stateUpdates.activeTriggerId === void 0) { |
| 6340 |
if (resolvedActiveTriggerIdRef.current === currentActiveTriggerId) { |
| 6341 |
lostActiveTriggerId = currentActiveTriggerId; |
| 6342 |
} else { |
| 6343 |
resolvedActiveTriggerIdRef.current = null; |
| 6344 |
} |
| 6345 |
} |
| 6346 |
} else { |
| 6347 |
resolvedActiveTriggerIdRef.current = currentActiveTriggerId; |
| 6348 |
if (activeTriggerElement !== store2.state.activeTriggerElement) { |
| 6349 |
stateUpdates.activeTriggerElement = activeTriggerElement; |
| 6350 |
} |
| 6351 |
} |
| 6352 |
} else { |
| 6353 |
resolvedActiveTriggerIdRef.current = null; |
| 6354 |
} |
| 6355 |
if (!lostActiveTriggerId && !currentActiveTriggerId && triggerCount === 1) { |
| 6356 |
const iteratorResult = store2.context.triggerElements.entries().next(); |
| 6357 |
if (!iteratorResult.done) { |
| 6358 |
const [implicitTriggerId, implicitTriggerElement] = iteratorResult.value; |
| 6359 |
stateUpdates.activeTriggerId = implicitTriggerId; |
| 6360 |
stateUpdates.activeTriggerElement = implicitTriggerElement; |
| 6361 |
resolvedActiveTriggerIdRef.current = implicitTriggerId; |
| 6362 |
} |
| 6363 |
} |
| 6364 |
if (stateUpdates.triggerCount !== void 0 || stateUpdates.activeTriggerId !== void 0 || stateUpdates.activeTriggerElement !== void 0) { |
| 6365 |
store2.update(stateUpdates); |
| 6366 |
} |
| 6367 |
if (lostActiveTriggerId) { |
| 6368 |
if (closeOnActiveTriggerUnmount) { |
| 6369 |
queueMicrotask(() => { |
| 6370 |
if (store2.select("open") && store2.select("activeTriggerId") === lostActiveTriggerId && !store2.context.triggerElements.getById(lostActiveTriggerId)) { |
| 6371 |
const eventDetails = createChangeEventDetails(reason_parts_exports.none); |
| 6372 |
store2.setOpen(false, eventDetails); |
| 6373 |
if (!eventDetails.isCanceled) { |
| 6374 |
store2.update({ |
| 6375 |
activeTriggerId: null, |
| 6376 |
activeTriggerElement: null |
| 6377 |
}); |
| 6378 |
} |
| 6379 |
} |
| 6380 |
}); |
| 6381 |
} |
| 6382 |
} |
| 6383 |
}, [open3, store2, reactiveTriggerCount, activeTriggerId, reactiveActiveTriggerElement, closeOnActiveTriggerUnmount]); |
| 6384 |
} |
| 6385 |
function useOpenStateTransitions(open3, store2, onUnmount, animateInitialOpen) { |
| 6386 |
const { |
| 6387 |
mounted, |
| 6388 |
setMounted, |
| 6389 |
transitionStatus |
| 6390 |
} = useTransitionStatus(open3, false, false, animateInitialOpen); |
| 6391 |
const preventUnmountingOnClose = store2.useState("preventUnmountingOnClose"); |
| 6392 |
const syncedPreventUnmountingOnClose = open3 ? false : preventUnmountingOnClose; |
| 6393 |
store2.useSyncedValues({ |
| 6394 |
mounted, |
| 6395 |
transitionStatus, |
| 6396 |
preventUnmountingOnClose: syncedPreventUnmountingOnClose |
| 6397 |
}); |
| 6398 |
const forceUnmount = useStableCallback(() => { |
| 6399 |
setMounted(false); |
| 6400 |
store2.update({ |
| 6401 |
activeTriggerId: null, |
| 6402 |
activeTriggerElement: null, |
| 6403 |
mounted: false, |
| 6404 |
preventUnmountingOnClose: false |
| 6405 |
}); |
| 6406 |
onUnmount?.(); |
| 6407 |
store2.context.onOpenChangeComplete?.(false); |
| 6408 |
}); |
| 6409 |
useOpenChangeComplete({ |
| 6410 |
enabled: mounted && !open3 && !syncedPreventUnmountingOnClose, |
| 6411 |
open: open3, |
| 6412 |
ref: store2.context.popupRef, |
| 6413 |
onComplete() { |
| 6414 |
if (!open3) { |
| 6415 |
forceUnmount(); |
| 6416 |
} |
| 6417 |
} |
| 6418 |
}); |
| 6419 |
return { |
| 6420 |
forceUnmount, |
| 6421 |
transitionStatus |
| 6422 |
}; |
| 6423 |
} |
| 6424 |
function usePopupInteractionProps(store2, statePart) { |
| 6425 |
store2.useSyncedValues(statePart); |
| 6426 |
useIsoLayoutEffect(() => () => { |
| 6427 |
store2.update({ |
| 6428 |
activeTriggerProps: EMPTY_OBJECT, |
| 6429 |
inactiveTriggerProps: EMPTY_OBJECT, |
| 6430 |
popupProps: EMPTY_OBJECT |
| 6431 |
}); |
| 6432 |
}, [store2]); |
| 6433 |
} |
| 6434 |
|
| 6435 |
// node_modules/@base-ui/react/utils/popups/popupTriggerMap.mjs |
| 6436 |
var devElementIdsByMap; |
| 6437 |
function getDevElementIds(map) { |
| 6438 |
devElementIdsByMap ??= /* @__PURE__ */ new WeakMap(); |
| 6439 |
let elementIds = devElementIdsByMap.get(map); |
| 6440 |
if (!elementIds) { |
| 6441 |
elementIds = /* @__PURE__ */ new WeakMap(); |
| 6442 |
devElementIdsByMap.set(map, elementIds); |
| 6443 |
} |
| 6444 |
return elementIds; |
| 6445 |
} |
| 6446 |
var PopupTriggerMap = class { |
| 6447 |
constructor() { |
| 6448 |
this.idMap = /* @__PURE__ */ new Map(); |
| 6449 |
} |
| 6450 |
/** |
| 6451 |
* Adds a trigger element with the given ID. |
| 6452 |
* |
| 6453 |
* Note: The provided element is assumed to not be registered under multiple IDs. |
| 6454 |
*/ |
| 6455 |
add(id, element) { |
| 6456 |
if (true) { |
| 6457 |
const elementIds = getDevElementIds(this); |
| 6458 |
const existingId = elementIds.get(element); |
| 6459 |
if (existingId !== void 0 && existingId !== id) { |
| 6460 |
throw new Error("Base UI: A trigger element cannot be registered under multiple IDs in PopupTriggerMap."); |
| 6461 |
} |
| 6462 |
const previousElement = this.idMap.get(id); |
| 6463 |
if (previousElement !== void 0 && previousElement !== element) { |
| 6464 |
elementIds.delete(previousElement); |
| 6465 |
} |
| 6466 |
elementIds.set(element, id); |
| 6467 |
} |
| 6468 |
this.idMap.set(id, element); |
| 6469 |
} |
| 6470 |
/** |
| 6471 |
* Removes the trigger element with the given ID. |
| 6472 |
*/ |
| 6473 |
delete(id) { |
| 6474 |
if (true) { |
| 6475 |
const element = this.idMap.get(id); |
| 6476 |
if (element !== void 0) { |
| 6477 |
devElementIdsByMap?.get(this)?.delete(element); |
| 6478 |
} |
| 6479 |
} |
| 6480 |
this.idMap.delete(id); |
| 6481 |
} |
| 6482 |
/** |
| 6483 |
* Whether the given element is registered as a trigger. |
| 6484 |
*/ |
| 6485 |
hasElement(element) { |
| 6486 |
for (const registered of this.idMap.values()) { |
| 6487 |
if (registered === element) { |
| 6488 |
return true; |
| 6489 |
} |
| 6490 |
} |
| 6491 |
return false; |
| 6492 |
} |
| 6493 |
/** |
| 6494 |
* Whether there is a registered trigger element matching the given predicate. |
| 6495 |
*/ |
| 6496 |
hasMatchingElement(predicate) { |
| 6497 |
for (const element of this.idMap.values()) { |
| 6498 |
if (predicate(element)) { |
| 6499 |
return true; |
| 6500 |
} |
| 6501 |
} |
| 6502 |
return false; |
| 6503 |
} |
| 6504 |
/** |
| 6505 |
* Returns the trigger element associated with the given ID, or undefined if no such element exists. |
| 6506 |
*/ |
| 6507 |
getById(id) { |
| 6508 |
return this.idMap.get(id); |
| 6509 |
} |
| 6510 |
/** |
| 6511 |
* Returns an iterable of all registered trigger entries, where each entry is a tuple of [id, element]. |
| 6512 |
*/ |
| 6513 |
entries() { |
| 6514 |
return this.idMap.entries(); |
| 6515 |
} |
| 6516 |
/** |
| 6517 |
* Returns an iterable of all registered trigger elements. |
| 6518 |
*/ |
| 6519 |
elements() { |
| 6520 |
return this.idMap.values(); |
| 6521 |
} |
| 6522 |
/** |
| 6523 |
* Returns the number of registered trigger elements. |
| 6524 |
*/ |
| 6525 |
get size() { |
| 6526 |
return this.idMap.size; |
| 6527 |
} |
| 6528 |
}; |
| 6529 |
|
| 6530 |
// node_modules/@base-ui/react/utils/popups/store.mjs |
| 6531 |
function createInitialPopupStoreState(triggerElements, floatingId, nested = false) { |
| 6532 |
return { |
| 6533 |
open: false, |
| 6534 |
openProp: void 0, |
| 6535 |
mounted: false, |
| 6536 |
transitionStatus: void 0, |
| 6537 |
floatingRootContext: new FloatingRootStore({ |
| 6538 |
open: false, |
| 6539 |
transitionStatus: void 0, |
| 6540 |
floatingElement: null, |
| 6541 |
referenceElement: null, |
| 6542 |
triggerElements, |
| 6543 |
floatingId, |
| 6544 |
syncOnly: true, |
| 6545 |
nested, |
| 6546 |
onOpenChange: void 0 |
| 6547 |
}), |
| 6548 |
floatingId, |
| 6549 |
triggerCount: 0, |
| 6550 |
preventUnmountingOnClose: false, |
| 6551 |
payload: void 0, |
| 6552 |
activeTriggerId: null, |
| 6553 |
activeTriggerElement: null, |
| 6554 |
triggerIdProp: void 0, |
| 6555 |
popupElement: null, |
| 6556 |
positionerElement: null, |
| 6557 |
activeTriggerProps: EMPTY_OBJECT, |
| 6558 |
inactiveTriggerProps: EMPTY_OBJECT, |
| 6559 |
popupProps: EMPTY_OBJECT |
| 6560 |
}; |
| 6561 |
} |
| 6562 |
var activeTriggerIdSelector = (state) => state.triggerIdProp ?? state.activeTriggerId; |
| 6563 |
var openSelector = (state) => state.openProp ?? state.open; |
| 6564 |
var popupIdSelector = (state) => { |
| 6565 |
const popupId = state.popupElement?.id ?? state.floatingId; |
| 6566 |
return popupId || void 0; |
| 6567 |
}; |
| 6568 |
function triggerOwnsOpenPopup(state, triggerId) { |
| 6569 |
return triggerId !== void 0 && openSelector(state) && activeTriggerIdSelector(state) === triggerId; |
| 6570 |
} |
| 6571 |
function triggerOwnsOpenPopupOrIsOnlyTrigger(state, triggerId) { |
| 6572 |
if (triggerOwnsOpenPopup(state, triggerId)) { |
| 6573 |
return true; |
| 6574 |
} |
| 6575 |
return triggerId !== void 0 && openSelector(state) && activeTriggerIdSelector(state) == null && state.triggerCount === 1; |
| 6576 |
} |
| 6577 |
var popupStoreSelectors = { |
| 6578 |
open: openSelector, |
| 6579 |
mounted: (state) => state.mounted, |
| 6580 |
transitionStatus: (state) => state.transitionStatus, |
| 6581 |
floatingRootContext: (state) => state.floatingRootContext, |
| 6582 |
triggerCount: (state) => state.triggerCount, |
| 6583 |
preventUnmountingOnClose: (state) => state.preventUnmountingOnClose, |
| 6584 |
payload: (state) => state.payload, |
| 6585 |
activeTriggerId: activeTriggerIdSelector, |
| 6586 |
activeTriggerElement: (state) => state.mounted ? state.activeTriggerElement : null, |
| 6587 |
popupId: popupIdSelector, |
| 6588 |
/** |
| 6589 |
* Whether the trigger with the given ID was used to open the popup. |
| 6590 |
*/ |
| 6591 |
isTriggerActive: (state, triggerId) => triggerId !== void 0 && activeTriggerIdSelector(state) === triggerId, |
| 6592 |
/** |
| 6593 |
* Whether the popup is open and was activated by a trigger with the given ID. |
| 6594 |
*/ |
| 6595 |
isOpenedByTrigger: (state, triggerId) => triggerOwnsOpenPopup(state, triggerId), |
| 6596 |
/** |
| 6597 |
* Whether the popup is mounted and was activated by a trigger with the given ID. |
| 6598 |
*/ |
| 6599 |
isMountedByTrigger: (state, triggerId) => triggerId !== void 0 && activeTriggerIdSelector(state) === triggerId && state.mounted, |
| 6600 |
triggerProps: (state, isActive) => isActive ? state.activeTriggerProps : state.inactiveTriggerProps, |
| 6601 |
/** |
| 6602 |
* Popup id for the trigger that currently owns the open popup. |
| 6603 |
*/ |
| 6604 |
triggerPopupId: (state, triggerId) => triggerOwnsOpenPopupOrIsOnlyTrigger(state, triggerId) ? popupIdSelector(state) : void 0, |
| 6605 |
popupProps: (state) => state.popupProps, |
| 6606 |
popupElement: (state) => state.popupElement, |
| 6607 |
positionerElement: (state) => state.positionerElement |
| 6608 |
}; |
| 6609 |
|
| 6610 |
// node_modules/@base-ui/react/utils/popups/usePopupHandleStore.mjs |
| 6611 |
var React30 = __toESM(require_react(), 1); |
| 6612 |
var import_shim2 = __toESM(require_shim(), 1); |
| 6613 |
function usePopupHandleStore(handle) { |
| 6614 |
const subscribe = React30.useCallback((listener) => { |
| 6615 |
if (handle === void 0) { |
| 6616 |
return NOOP; |
| 6617 |
} |
| 6618 |
return handle.subscribeStore(listener); |
| 6619 |
}, [handle]); |
| 6620 |
const getSnapshot = React30.useCallback(() => { |
| 6621 |
return handle === void 0 ? void 0 : handle.store; |
| 6622 |
}, [handle]); |
| 6623 |
return (0, import_shim2.useSyncExternalStore)(subscribe, getSnapshot, () => handle?.serverStore); |
| 6624 |
} |
| 6625 |
|
| 6626 |
// node_modules/@base-ui/react/floating-ui-react/hooks/useFloating.mjs |
| 6627 |
function useBaseUIFloating(options) { |
| 6628 |
return useFloatingWithStore(options, options.rootContext); |
| 6629 |
} |
| 6630 |
function useFloatingWithStore(options, store2) { |
| 6631 |
const { |
| 6632 |
nodeId, |
| 6633 |
externalTree |
| 6634 |
} = options; |
| 6635 |
const referenceElement = store2.useState("referenceElement"); |
| 6636 |
const floatingElement = store2.useState("floatingElement"); |
| 6637 |
const domReferenceElement = store2.useState("domReferenceElement"); |
| 6638 |
const open3 = store2.useState("open"); |
| 6639 |
const floatingId = store2.useState("floatingId"); |
| 6640 |
const [positionReference, setPositionReferenceRaw] = React31.useState(null); |
| 6641 |
const [localDomReference, setLocalDomReference] = React31.useState(void 0); |
| 6642 |
const [localFloatingElement, setLocalFloatingElement] = React31.useState(void 0); |
| 6643 |
const domReferenceRef = React31.useRef(null); |
| 6644 |
const tree = useFloatingTree(externalTree); |
| 6645 |
const storeElements = React31.useMemo(() => ({ |
| 6646 |
reference: referenceElement, |
| 6647 |
floating: floatingElement, |
| 6648 |
domReference: domReferenceElement |
| 6649 |
}), [referenceElement, floatingElement, domReferenceElement]); |
| 6650 |
const position = useFloating({ |
| 6651 |
...options, |
| 6652 |
elements: { |
| 6653 |
...storeElements, |
| 6654 |
...positionReference && { |
| 6655 |
reference: positionReference |
| 6656 |
} |
| 6657 |
} |
| 6658 |
}); |
| 6659 |
const localDomReferenceElement = isElement(localDomReference) ? localDomReference : null; |
| 6660 |
const syncedFloatingElement = localFloatingElement === void 0 ? store2.state.floatingElement : localFloatingElement; |
| 6661 |
store2.useSyncedValue("referenceElement", localDomReference ?? null); |
| 6662 |
store2.useSyncedValue("domReferenceElement", localDomReference === void 0 ? domReferenceElement : localDomReferenceElement); |
| 6663 |
store2.useSyncedValue("floatingElement", syncedFloatingElement); |
| 6664 |
const setPositionReference = React31.useCallback((node) => { |
| 6665 |
const computedPositionReference = isElement(node) ? { |
| 6666 |
getBoundingClientRect: () => node.getBoundingClientRect(), |
| 6667 |
getClientRects: () => node.getClientRects(), |
| 6668 |
contextElement: node |
| 6669 |
} : node; |
| 6670 |
setPositionReferenceRaw(computedPositionReference); |
| 6671 |
position.refs.setReference(computedPositionReference); |
| 6672 |
}, [position.refs]); |
| 6673 |
const setReference = React31.useCallback((node) => { |
| 6674 |
if (isElement(node) || node === null) { |
| 6675 |
domReferenceRef.current = node; |
| 6676 |
setLocalDomReference(node); |
| 6677 |
} |
| 6678 |
if (isElement(position.refs.reference.current) || position.refs.reference.current === null || // Don't allow setting virtual elements using the old technique back to |
| 6679 |
// `null` to support `positionReference` + an unstable `reference` |
| 6680 |
// callback ref. |
| 6681 |
node !== null && !isElement(node)) { |
| 6682 |
position.refs.setReference(node); |
| 6683 |
} |
| 6684 |
}, [position.refs, setLocalDomReference]); |
| 6685 |
const setFloating = React31.useCallback((node) => { |
| 6686 |
setLocalFloatingElement(node); |
| 6687 |
position.refs.setFloating(node); |
| 6688 |
}, [position.refs]); |
| 6689 |
const refs = React31.useMemo(() => ({ |
| 6690 |
...position.refs, |
| 6691 |
setReference, |
| 6692 |
setFloating, |
| 6693 |
setPositionReference, |
| 6694 |
domReference: domReferenceRef |
| 6695 |
}), [position.refs, setReference, setFloating, setPositionReference]); |
| 6696 |
const elements = React31.useMemo(() => ({ |
| 6697 |
...position.elements, |
| 6698 |
domReference: domReferenceElement |
| 6699 |
}), [position.elements, domReferenceElement]); |
| 6700 |
const context = React31.useMemo(() => ({ |
| 6701 |
...position, |
| 6702 |
dataRef: store2.context.dataRef, |
| 6703 |
open: open3, |
| 6704 |
onOpenChange: store2.setOpen, |
| 6705 |
events: store2.context.events, |
| 6706 |
floatingId, |
| 6707 |
refs, |
| 6708 |
elements, |
| 6709 |
nodeId, |
| 6710 |
rootStore: store2 |
| 6711 |
}), [position, refs, elements, nodeId, store2, open3, floatingId]); |
| 6712 |
useIsoLayoutEffect(() => { |
| 6713 |
if (domReferenceElement) { |
| 6714 |
domReferenceRef.current = domReferenceElement; |
| 6715 |
} |
| 6716 |
}, [domReferenceElement]); |
| 6717 |
useIsoLayoutEffect(() => { |
| 6718 |
store2.context.dataRef.current.floatingContext = context; |
| 6719 |
const node = tree?.nodesRef.current.find((n) => n.id === nodeId); |
| 6720 |
if (node) { |
| 6721 |
node.context = context; |
| 6722 |
} |
| 6723 |
}); |
| 6724 |
return React31.useMemo(() => ({ |
| 6725 |
...position, |
| 6726 |
context, |
| 6727 |
refs, |
| 6728 |
elements, |
| 6729 |
rootStore: store2 |
| 6730 |
}), [position, refs, elements, context, store2]); |
| 6731 |
} |
| 6732 |
|
| 6733 |
// node_modules/@base-ui/react/floating-ui-react/hooks/useFocus.mjs |
| 6734 |
var React32 = __toESM(require_react(), 1); |
| 6735 |
var isMacSafari = parts_exports.os.mac && parts_exports.engine.webkit; |
| 6736 |
function useFocus(context, props = {}) { |
| 6737 |
const { |
| 6738 |
enabled = true, |
| 6739 |
delay |
| 6740 |
} = props; |
| 6741 |
const store2 = "rootStore" in context ? context.rootStore : context; |
| 6742 |
const { |
| 6743 |
events, |
| 6744 |
dataRef |
| 6745 |
} = store2.context; |
| 6746 |
const blockFocusRef = React32.useRef(false); |
| 6747 |
const blockedReferenceRef = React32.useRef(null); |
| 6748 |
const keyboardModalityRef = React32.useRef(true); |
| 6749 |
const timeout = useTimeout(); |
| 6750 |
React32.useEffect(() => { |
| 6751 |
const domReference = store2.select("domReferenceElement"); |
| 6752 |
if (!enabled) { |
| 6753 |
return void 0; |
| 6754 |
} |
| 6755 |
const win = getWindow(domReference); |
| 6756 |
function onBlur() { |
| 6757 |
const currentDomReference = store2.select("domReferenceElement"); |
| 6758 |
if (!store2.select("open") && isHTMLElement(currentDomReference) && currentDomReference === activeElement(ownerDocument(currentDomReference))) { |
| 6759 |
blockFocusRef.current = true; |
| 6760 |
blockedReferenceRef.current = currentDomReference; |
| 6761 |
} |
| 6762 |
} |
| 6763 |
function onKeyDown() { |
| 6764 |
keyboardModalityRef.current = true; |
| 6765 |
} |
| 6766 |
function onPointerDown() { |
| 6767 |
keyboardModalityRef.current = false; |
| 6768 |
} |
| 6769 |
return mergeCleanups(addEventListener(win, "blur", onBlur), isMacSafari && addEventListener(win, "keydown", onKeyDown, true), isMacSafari && addEventListener(win, "pointerdown", onPointerDown, true)); |
| 6770 |
}, [store2, enabled]); |
| 6771 |
React32.useEffect(() => { |
| 6772 |
if (!enabled) { |
| 6773 |
return void 0; |
| 6774 |
} |
| 6775 |
function onOpenChangeLocal(details) { |
| 6776 |
if (details.reason === reason_parts_exports.triggerPress || details.reason === reason_parts_exports.escapeKey) { |
| 6777 |
const referenceElement = store2.select("domReferenceElement"); |
| 6778 |
if (isElement(referenceElement)) { |
| 6779 |
blockedReferenceRef.current = referenceElement; |
| 6780 |
blockFocusRef.current = true; |
| 6781 |
} |
| 6782 |
} |
| 6783 |
} |
| 6784 |
events.on("openchange", onOpenChangeLocal); |
| 6785 |
return () => { |
| 6786 |
events.off("openchange", onOpenChangeLocal); |
| 6787 |
}; |
| 6788 |
}, [events, enabled, store2]); |
| 6789 |
const reference = React32.useMemo(() => { |
| 6790 |
function resetBlockedFocus() { |
| 6791 |
blockFocusRef.current = false; |
| 6792 |
blockedReferenceRef.current = null; |
| 6793 |
} |
| 6794 |
return { |
| 6795 |
onMouseLeave() { |
| 6796 |
resetBlockedFocus(); |
| 6797 |
}, |
| 6798 |
onFocus(event) { |
| 6799 |
const focusTarget = event.currentTarget; |
| 6800 |
if (blockFocusRef.current) { |
| 6801 |
if (blockedReferenceRef.current === focusTarget) { |
| 6802 |
return; |
| 6803 |
} |
| 6804 |
resetBlockedFocus(); |
| 6805 |
} |
| 6806 |
const target = getTarget(event.nativeEvent); |
| 6807 |
if (isElement(target)) { |
| 6808 |
if (isMacSafari && !event.relatedTarget) { |
| 6809 |
if (!keyboardModalityRef.current && !isTypeableElement(target)) { |
| 6810 |
return; |
| 6811 |
} |
| 6812 |
} else if (!matchesFocusVisible(target)) { |
| 6813 |
return; |
| 6814 |
} |
| 6815 |
} |
| 6816 |
const movedFromOtherEnabledTrigger = isTargetInsideEnabledTrigger(event.relatedTarget, store2.context.triggerElements); |
| 6817 |
const { |
| 6818 |
nativeEvent, |
| 6819 |
currentTarget |
| 6820 |
} = event; |
| 6821 |
const delayValue = typeof delay === "function" ? delay() : delay; |
| 6822 |
if (store2.select("open") && movedFromOtherEnabledTrigger || delayValue === 0 || delayValue === void 0) { |
| 6823 |
store2.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerFocus, nativeEvent, currentTarget)); |
| 6824 |
return; |
| 6825 |
} |
| 6826 |
timeout.start(delayValue, () => { |
| 6827 |
if (blockFocusRef.current) { |
| 6828 |
return; |
| 6829 |
} |
| 6830 |
store2.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerFocus, nativeEvent, currentTarget)); |
| 6831 |
}); |
| 6832 |
}, |
| 6833 |
onBlur(event) { |
| 6834 |
resetBlockedFocus(); |
| 6835 |
const relatedTarget = event.relatedTarget; |
| 6836 |
const nativeEvent = event.nativeEvent; |
| 6837 |
const movedToFocusGuard = isElement(relatedTarget) && relatedTarget.hasAttribute(createAttribute("focus-guard")) && relatedTarget.getAttribute("data-type") === "outside"; |
| 6838 |
timeout.start(0, () => { |
| 6839 |
const domReference = store2.select("domReferenceElement"); |
| 6840 |
const activeEl = activeElement(ownerDocument(domReference)); |
| 6841 |
if (!relatedTarget && activeEl === domReference) { |
| 6842 |
return; |
| 6843 |
} |
| 6844 |
if (contains(dataRef.current.floatingContext?.refs.floating.current, activeEl) || contains(domReference, activeEl) || movedToFocusGuard) { |
| 6845 |
return; |
| 6846 |
} |
| 6847 |
const nextFocusedElement = relatedTarget ?? activeEl; |
| 6848 |
if (isTargetInsideEnabledTrigger(nextFocusedElement, store2.context.triggerElements)) { |
| 6849 |
return; |
| 6850 |
} |
| 6851 |
store2.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerFocus, nativeEvent)); |
| 6852 |
}); |
| 6853 |
} |
| 6854 |
}; |
| 6855 |
}, [dataRef, delay, store2, timeout]); |
| 6856 |
return React32.useMemo(() => enabled ? { |
| 6857 |
reference, |
| 6858 |
trigger: reference |
| 6859 |
} : {}, [enabled, reference]); |
| 6860 |
} |
| 6861 |
|
| 6862 |
// node_modules/@base-ui/react/floating-ui-react/hooks/useHoverFloatingInteraction.mjs |
| 6863 |
var React33 = __toESM(require_react(), 1); |
| 6864 |
|
| 6865 |
// node_modules/@base-ui/react/floating-ui-react/hooks/useHoverInteractionSharedState.mjs |
| 6866 |
var HoverInteraction = class _HoverInteraction { |
| 6867 |
constructor() { |
| 6868 |
this.pointerType = void 0; |
| 6869 |
this.interactedInside = false; |
| 6870 |
this.handler = void 0; |
| 6871 |
this.blockMouseMove = true; |
| 6872 |
this.performedPointerEventsMutation = false; |
| 6873 |
this.pointerEventsScopeElement = null; |
| 6874 |
this.pointerEventsReferenceElement = null; |
| 6875 |
this.pointerEventsFloatingElement = null; |
| 6876 |
this.restTimeoutPending = false; |
| 6877 |
this.openChangeTimeout = new Timeout(); |
| 6878 |
this.restTimeout = new Timeout(); |
| 6879 |
this.handleCloseOptions = void 0; |
| 6880 |
} |
| 6881 |
static create() { |
| 6882 |
return new _HoverInteraction(); |
| 6883 |
} |
| 6884 |
dispose = () => { |
| 6885 |
this.openChangeTimeout.clear(); |
| 6886 |
this.restTimeout.clear(); |
| 6887 |
}; |
| 6888 |
disposeEffect = () => { |
| 6889 |
return this.dispose; |
| 6890 |
}; |
| 6891 |
}; |
| 6892 |
var pointerEventsMutationOwnerByScopeElement = /* @__PURE__ */ new WeakMap(); |
| 6893 |
function clearSafePolygonPointerEventsMutation(instance) { |
| 6894 |
if (!instance.performedPointerEventsMutation) { |
| 6895 |
return; |
| 6896 |
} |
| 6897 |
const scopeElement = instance.pointerEventsScopeElement; |
| 6898 |
if (scopeElement && pointerEventsMutationOwnerByScopeElement.get(scopeElement) === instance) { |
| 6899 |
instance.pointerEventsScopeElement?.style.removeProperty("pointer-events"); |
| 6900 |
instance.pointerEventsReferenceElement?.style.removeProperty("pointer-events"); |
| 6901 |
instance.pointerEventsFloatingElement?.style.removeProperty("pointer-events"); |
| 6902 |
pointerEventsMutationOwnerByScopeElement.delete(scopeElement); |
| 6903 |
} |
| 6904 |
instance.performedPointerEventsMutation = false; |
| 6905 |
instance.pointerEventsScopeElement = null; |
| 6906 |
instance.pointerEventsReferenceElement = null; |
| 6907 |
instance.pointerEventsFloatingElement = null; |
| 6908 |
} |
| 6909 |
function applySafePolygonPointerEventsMutation(instance, options) { |
| 6910 |
const { |
| 6911 |
scopeElement, |
| 6912 |
referenceElement, |
| 6913 |
floatingElement |
| 6914 |
} = options; |
| 6915 |
const existingOwner = pointerEventsMutationOwnerByScopeElement.get(scopeElement); |
| 6916 |
if (existingOwner && existingOwner !== instance) { |
| 6917 |
clearSafePolygonPointerEventsMutation(existingOwner); |
| 6918 |
} |
| 6919 |
clearSafePolygonPointerEventsMutation(instance); |
| 6920 |
instance.performedPointerEventsMutation = true; |
| 6921 |
instance.pointerEventsScopeElement = scopeElement; |
| 6922 |
instance.pointerEventsReferenceElement = referenceElement; |
| 6923 |
instance.pointerEventsFloatingElement = floatingElement; |
| 6924 |
pointerEventsMutationOwnerByScopeElement.set(scopeElement, instance); |
| 6925 |
scopeElement.style.pointerEvents = "none"; |
| 6926 |
referenceElement.style.pointerEvents = "auto"; |
| 6927 |
floatingElement.style.pointerEvents = "auto"; |
| 6928 |
} |
| 6929 |
function useHoverInteractionSharedState(store2) { |
| 6930 |
const data = store2.context.dataRef.current; |
| 6931 |
const instance = useRefWithInit(() => data.hoverInteractionState ?? HoverInteraction.create()).current; |
| 6932 |
if (!data.hoverInteractionState) { |
| 6933 |
data.hoverInteractionState = instance; |
| 6934 |
} |
| 6935 |
useOnMount(data.hoverInteractionState.disposeEffect); |
| 6936 |
return data.hoverInteractionState; |
| 6937 |
} |
| 6938 |
|
| 6939 |
// node_modules/@base-ui/react/floating-ui-react/hooks/useHoverFloatingInteraction.mjs |
| 6940 |
function useHoverFloatingInteraction(context, parameters = {}) { |
| 6941 |
const { |
| 6942 |
enabled = true, |
| 6943 |
closeDelay: closeDelayProp = 0, |
| 6944 |
nodeId: nodeIdProp |
| 6945 |
} = parameters; |
| 6946 |
const store2 = "rootStore" in context ? context.rootStore : context; |
| 6947 |
const open3 = store2.useState("open"); |
| 6948 |
const floatingElement = store2.useState("floatingElement"); |
| 6949 |
const domReferenceElement = store2.useState("domReferenceElement"); |
| 6950 |
const { |
| 6951 |
dataRef |
| 6952 |
} = store2.context; |
| 6953 |
const tree = useFloatingTree(); |
| 6954 |
const parentId = useFloatingParentNodeId(); |
| 6955 |
const instance = useHoverInteractionSharedState(store2); |
| 6956 |
const childClosedTimeout = useTimeout(); |
| 6957 |
const isClickLikeOpenEvent2 = useStableCallback(() => { |
| 6958 |
return isClickLikeOpenEvent(dataRef.current.openEvent?.type, instance.interactedInside); |
| 6959 |
}); |
| 6960 |
const isHoverOpen = useStableCallback(() => { |
| 6961 |
return isHoverOpenEvent(dataRef.current.openEvent?.type); |
| 6962 |
}); |
| 6963 |
const clearPointerEvents = useStableCallback(() => { |
| 6964 |
clearSafePolygonPointerEventsMutation(instance); |
| 6965 |
}); |
| 6966 |
useIsoLayoutEffect(() => { |
| 6967 |
if (!open3) { |
| 6968 |
instance.pointerType = void 0; |
| 6969 |
instance.restTimeoutPending = false; |
| 6970 |
instance.interactedInside = false; |
| 6971 |
clearPointerEvents(); |
| 6972 |
} |
| 6973 |
}, [open3, instance, clearPointerEvents]); |
| 6974 |
React33.useEffect(() => { |
| 6975 |
return clearPointerEvents; |
| 6976 |
}, [clearPointerEvents]); |
| 6977 |
useIsoLayoutEffect(() => { |
| 6978 |
if (!enabled) { |
| 6979 |
return void 0; |
| 6980 |
} |
| 6981 |
if (open3 && instance.handleCloseOptions?.blockPointerEvents && isHoverOpen() && isElement(domReferenceElement) && floatingElement) { |
| 6982 |
const ref = domReferenceElement; |
| 6983 |
const floatingEl = floatingElement; |
| 6984 |
const doc = ownerDocument(floatingElement); |
| 6985 |
const parentFloating = tree?.nodesRef.current.find((node) => node.id === parentId)?.context?.elements.floating; |
| 6986 |
if (parentFloating) { |
| 6987 |
parentFloating.style.pointerEvents = ""; |
| 6988 |
} |
| 6989 |
const cachedScopeElement = instance.pointerEventsScopeElement !== floatingEl ? instance.pointerEventsScopeElement : null; |
| 6990 |
const parentScopeElement = parentFloating !== floatingEl ? parentFloating : null; |
| 6991 |
const scopeElement = instance.handleCloseOptions?.getScope?.() ?? cachedScopeElement ?? parentScopeElement ?? ref.closest("[data-rootownerid]") ?? doc.body; |
| 6992 |
applySafePolygonPointerEventsMutation(instance, { |
| 6993 |
scopeElement, |
| 6994 |
referenceElement: ref, |
| 6995 |
floatingElement: floatingEl |
| 6996 |
}); |
| 6997 |
return () => { |
| 6998 |
clearPointerEvents(); |
| 6999 |
}; |
| 7000 |
} |
| 7001 |
return void 0; |
| 7002 |
}, [enabled, open3, domReferenceElement, floatingElement, instance, isHoverOpen, tree, parentId, clearPointerEvents]); |
| 7003 |
React33.useEffect(() => { |
| 7004 |
if (!enabled) { |
| 7005 |
return void 0; |
| 7006 |
} |
| 7007 |
function hasParentChildren() { |
| 7008 |
return !!(tree && parentId && getNodeChildren(tree.nodesRef.current, parentId).length > 0); |
| 7009 |
} |
| 7010 |
function closeWithDelay(event) { |
| 7011 |
const closeDelay = getDelay(closeDelayProp, "close", instance.pointerType); |
| 7012 |
const close = () => { |
| 7013 |
store2.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerHover, event)); |
| 7014 |
tree?.events.emit("floating.closed", event); |
| 7015 |
}; |
| 7016 |
if (closeDelay) { |
| 7017 |
instance.openChangeTimeout.start(closeDelay, close); |
| 7018 |
} else { |
| 7019 |
instance.openChangeTimeout.clear(); |
| 7020 |
close(); |
| 7021 |
} |
| 7022 |
} |
| 7023 |
function handleInteractInside(event) { |
| 7024 |
const target = getTarget(event); |
| 7025 |
if (!isInteractiveElement(target)) { |
| 7026 |
instance.interactedInside = false; |
| 7027 |
return; |
| 7028 |
} |
| 7029 |
instance.interactedInside = target?.closest("[aria-haspopup]") != null; |
| 7030 |
} |
| 7031 |
function onFloatingMouseEnter() { |
| 7032 |
instance.openChangeTimeout.clear(); |
| 7033 |
childClosedTimeout.clear(); |
| 7034 |
tree?.events.off("floating.closed", onNodeClosed); |
| 7035 |
clearPointerEvents(); |
| 7036 |
} |
| 7037 |
function onFloatingMouseLeave(event) { |
| 7038 |
if (hasParentChildren() && tree) { |
| 7039 |
tree.events.on("floating.closed", onNodeClosed); |
| 7040 |
return; |
| 7041 |
} |
| 7042 |
if (isTargetInsideEnabledTrigger(event.relatedTarget, store2.context.triggerElements)) { |
| 7043 |
return; |
| 7044 |
} |
| 7045 |
const currentNodeId = dataRef.current.floatingContext?.nodeId ?? nodeIdProp; |
| 7046 |
const relatedTarget = event.relatedTarget; |
| 7047 |
const isMovingIntoDescendantFloating = tree && currentNodeId && isElement(relatedTarget) && getNodeChildren(tree.nodesRef.current, currentNodeId, false).some((node) => contains(node.context?.elements.floating, relatedTarget)); |
| 7048 |
if (isMovingIntoDescendantFloating) { |
| 7049 |
return; |
| 7050 |
} |
| 7051 |
if (instance.handler) { |
| 7052 |
instance.handler(event); |
| 7053 |
return; |
| 7054 |
} |
| 7055 |
clearPointerEvents(); |
| 7056 |
if (isHoverOpen() && !isClickLikeOpenEvent2()) { |
| 7057 |
closeWithDelay(event); |
| 7058 |
} |
| 7059 |
} |
| 7060 |
function onNodeClosed(event) { |
| 7061 |
if (!tree || !parentId || hasParentChildren()) { |
| 7062 |
return; |
| 7063 |
} |
| 7064 |
childClosedTimeout.start(0, () => { |
| 7065 |
tree.events.off("floating.closed", onNodeClosed); |
| 7066 |
store2.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerHover, event)); |
| 7067 |
tree.events.emit("floating.closed", event); |
| 7068 |
}); |
| 7069 |
} |
| 7070 |
const floating = floatingElement; |
| 7071 |
return mergeCleanups(floating && addEventListener(floating, "mouseenter", onFloatingMouseEnter), floating && addEventListener(floating, "mouseleave", onFloatingMouseLeave), floating && addEventListener(floating, "pointerdown", handleInteractInside, true), () => { |
| 7072 |
tree?.events.off("floating.closed", onNodeClosed); |
| 7073 |
}); |
| 7074 |
}, [enabled, floatingElement, store2, dataRef, closeDelayProp, nodeIdProp, isHoverOpen, isClickLikeOpenEvent2, clearPointerEvents, instance, tree, parentId, childClosedTimeout]); |
| 7075 |
} |
| 7076 |
|
| 7077 |
// node_modules/@base-ui/react/floating-ui-react/hooks/useHoverReferenceInteraction.mjs |
| 7078 |
var React34 = __toESM(require_react(), 1); |
| 7079 |
var ReactDOM5 = __toESM(require_react_dom(), 1); |
| 7080 |
var EMPTY_REF = { |
| 7081 |
current: null |
| 7082 |
}; |
| 7083 |
function useHoverReferenceInteraction(context, props = {}) { |
| 7084 |
const { |
| 7085 |
enabled = true, |
| 7086 |
delay = 0, |
| 7087 |
handleClose = null, |
| 7088 |
mouseOnly = false, |
| 7089 |
restMs = 0, |
| 7090 |
move = true, |
| 7091 |
triggerElementRef = EMPTY_REF, |
| 7092 |
externalTree, |
| 7093 |
isActiveTrigger = true, |
| 7094 |
getHandleCloseContext, |
| 7095 |
isClosing, |
| 7096 |
shouldOpen: shouldOpenProp, |
| 7097 |
guardStaleOpen = false |
| 7098 |
} = props; |
| 7099 |
const store2 = "rootStore" in context ? context.rootStore : context; |
| 7100 |
const { |
| 7101 |
dataRef, |
| 7102 |
events |
| 7103 |
} = store2.context; |
| 7104 |
const tree = useFloatingTree(externalTree); |
| 7105 |
const instance = useHoverInteractionSharedState(store2); |
| 7106 |
const isHoverCloseActiveRef = React34.useRef(false); |
| 7107 |
const handleCloseRef = useValueAsRef(handleClose); |
| 7108 |
const delayRef = useValueAsRef(delay); |
| 7109 |
const restMsRef = useValueAsRef(restMs); |
| 7110 |
const enabledRef = useValueAsRef(enabled); |
| 7111 |
const shouldOpenRef = useValueAsRef(shouldOpenProp); |
| 7112 |
const isClosingRef = useValueAsRef(isClosing); |
| 7113 |
const isClickLikeOpenEvent2 = useStableCallback(() => { |
| 7114 |
return isClickLikeOpenEvent(dataRef.current.openEvent?.type, instance.interactedInside); |
| 7115 |
}); |
| 7116 |
const checkShouldOpen = useStableCallback(() => { |
| 7117 |
return shouldOpenRef.current?.() !== false; |
| 7118 |
}); |
| 7119 |
const isOverInactiveTrigger = useStableCallback((currentDomReference, currentTarget, target) => { |
| 7120 |
const allTriggers = store2.context.triggerElements; |
| 7121 |
if (allTriggers.hasElement(currentTarget)) { |
| 7122 |
return !currentDomReference || !contains(currentDomReference, currentTarget); |
| 7123 |
} |
| 7124 |
if (!isElement(target)) { |
| 7125 |
return false; |
| 7126 |
} |
| 7127 |
const targetElement = target; |
| 7128 |
return allTriggers.hasMatchingElement((trigger) => contains(trigger, targetElement)) && (!currentDomReference || !contains(currentDomReference, targetElement)); |
| 7129 |
}); |
| 7130 |
const cleanupMouseMoveHandler = useStableCallback(() => { |
| 7131 |
if (!instance.handler) { |
| 7132 |
return; |
| 7133 |
} |
| 7134 |
const doc = ownerDocument(store2.select("domReferenceElement")); |
| 7135 |
doc.removeEventListener("mousemove", instance.handler); |
| 7136 |
instance.handler = void 0; |
| 7137 |
}); |
| 7138 |
const clearPointerEvents = useStableCallback(() => { |
| 7139 |
clearSafePolygonPointerEventsMutation(instance); |
| 7140 |
}); |
| 7141 |
if (isActiveTrigger) { |
| 7142 |
instance.handleCloseOptions = handleClose?.__options; |
| 7143 |
} |
| 7144 |
React34.useEffect(() => cleanupMouseMoveHandler, [cleanupMouseMoveHandler]); |
| 7145 |
React34.useEffect(() => { |
| 7146 |
if (!enabled) { |
| 7147 |
return void 0; |
| 7148 |
} |
| 7149 |
function onOpenChangeLocal(details) { |
| 7150 |
if (!details.open) { |
| 7151 |
isHoverCloseActiveRef.current = details.reason === reason_parts_exports.triggerHover; |
| 7152 |
cleanupMouseMoveHandler(); |
| 7153 |
instance.openChangeTimeout.clear(); |
| 7154 |
instance.restTimeout.clear(); |
| 7155 |
instance.blockMouseMove = true; |
| 7156 |
instance.restTimeoutPending = false; |
| 7157 |
} else { |
| 7158 |
isHoverCloseActiveRef.current = false; |
| 7159 |
} |
| 7160 |
} |
| 7161 |
events.on("openchange", onOpenChangeLocal); |
| 7162 |
return () => { |
| 7163 |
events.off("openchange", onOpenChangeLocal); |
| 7164 |
}; |
| 7165 |
}, [enabled, events, instance, cleanupMouseMoveHandler]); |
| 7166 |
React34.useEffect(() => { |
| 7167 |
if (!enabled) { |
| 7168 |
return void 0; |
| 7169 |
} |
| 7170 |
function closeWithDelay(event, runElseBranch = true) { |
| 7171 |
const closeDelay = getDelay(delayRef.current, "close", instance.pointerType); |
| 7172 |
if (closeDelay) { |
| 7173 |
instance.openChangeTimeout.start(closeDelay, () => { |
| 7174 |
store2.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerHover, event)); |
| 7175 |
tree?.events.emit("floating.closed", event); |
| 7176 |
}); |
| 7177 |
} else if (runElseBranch) { |
| 7178 |
instance.openChangeTimeout.clear(); |
| 7179 |
store2.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerHover, event)); |
| 7180 |
tree?.events.emit("floating.closed", event); |
| 7181 |
} |
| 7182 |
} |
| 7183 |
const trigger = triggerElementRef.current ?? (isActiveTrigger ? store2.select("domReferenceElement") : null); |
| 7184 |
if (!isElement(trigger)) { |
| 7185 |
return void 0; |
| 7186 |
} |
| 7187 |
function onMouseEnter(event) { |
| 7188 |
instance.openChangeTimeout.clear(); |
| 7189 |
instance.blockMouseMove = false; |
| 7190 |
if (mouseOnly && !isMouseLikePointerType(instance.pointerType)) { |
| 7191 |
return; |
| 7192 |
} |
| 7193 |
const restMsValue = getRestMs(restMsRef.current); |
| 7194 |
const openDelay = getDelay(delayRef.current, "open", instance.pointerType); |
| 7195 |
const eventTarget = getTarget(event); |
| 7196 |
const currentTarget = event.currentTarget ?? null; |
| 7197 |
const currentDomReference = store2.select("domReferenceElement"); |
| 7198 |
let triggerNode = currentTarget; |
| 7199 |
if (isElement(eventTarget) && !store2.context.triggerElements.hasElement(eventTarget)) { |
| 7200 |
for (const triggerElement of store2.context.triggerElements.elements()) { |
| 7201 |
if (contains(triggerElement, eventTarget)) { |
| 7202 |
triggerNode = triggerElement; |
| 7203 |
break; |
| 7204 |
} |
| 7205 |
} |
| 7206 |
} |
| 7207 |
if (isElement(currentTarget) && isElement(currentDomReference) && !store2.context.triggerElements.hasElement(currentTarget) && contains(currentTarget, currentDomReference)) { |
| 7208 |
triggerNode = currentDomReference; |
| 7209 |
} |
| 7210 |
const isOverInactive = triggerNode == null ? false : isOverInactiveTrigger(currentDomReference, triggerNode, eventTarget); |
| 7211 |
const isOpen = store2.select("open"); |
| 7212 |
const isInClosingTransition = isClosingRef.current?.() ?? store2.select("transitionStatus") === "ending"; |
| 7213 |
const isHoverCloseTransition = !isOpen && isInClosingTransition && isHoverCloseActiveRef.current; |
| 7214 |
const isReenteringSameTriggerDuringCloseTransition = !isOverInactive && isElement(triggerNode) && isElement(currentDomReference) && contains(currentDomReference, triggerNode) && isHoverCloseTransition; |
| 7215 |
const isRestOnlyDelay = restMsValue > 0 && !openDelay; |
| 7216 |
const shouldOpenImmediately = isOverInactive && (isOpen || isHoverCloseTransition) || isReenteringSameTriggerDuringCloseTransition; |
| 7217 |
const shouldOpen = !isOpen || isOverInactive; |
| 7218 |
if (shouldOpenImmediately) { |
| 7219 |
if (checkShouldOpen()) { |
| 7220 |
store2.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerHover, event, triggerNode)); |
| 7221 |
} |
| 7222 |
return; |
| 7223 |
} |
| 7224 |
if (isRestOnlyDelay) { |
| 7225 |
return; |
| 7226 |
} |
| 7227 |
if (openDelay) { |
| 7228 |
instance.openChangeTimeout.start(openDelay, () => { |
| 7229 |
if (shouldOpen && checkShouldOpen()) { |
| 7230 |
store2.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerHover, event, triggerNode)); |
| 7231 |
} |
| 7232 |
}); |
| 7233 |
} else if (shouldOpen) { |
| 7234 |
if (checkShouldOpen()) { |
| 7235 |
store2.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerHover, event, triggerNode)); |
| 7236 |
} |
| 7237 |
} |
| 7238 |
} |
| 7239 |
function onMouseLeave(event) { |
| 7240 |
if (isClickLikeOpenEvent2()) { |
| 7241 |
clearPointerEvents(); |
| 7242 |
return; |
| 7243 |
} |
| 7244 |
cleanupMouseMoveHandler(); |
| 7245 |
const domReferenceElement = store2.select("domReferenceElement"); |
| 7246 |
const doc = ownerDocument(domReferenceElement); |
| 7247 |
instance.restTimeout.clear(); |
| 7248 |
instance.restTimeoutPending = false; |
| 7249 |
const handleCloseContextBase = dataRef.current.floatingContext ?? getHandleCloseContext?.(); |
| 7250 |
if (isTargetInsideEnabledTrigger(event.relatedTarget, store2.context.triggerElements)) { |
| 7251 |
return; |
| 7252 |
} |
| 7253 |
if (handleCloseRef.current && handleCloseContextBase) { |
| 7254 |
if (!store2.select("open")) { |
| 7255 |
instance.openChangeTimeout.clear(); |
| 7256 |
} |
| 7257 |
const currentTrigger = triggerElementRef.current; |
| 7258 |
instance.handler = handleCloseRef.current({ |
| 7259 |
...handleCloseContextBase, |
| 7260 |
tree, |
| 7261 |
x: event.clientX, |
| 7262 |
y: event.clientY, |
| 7263 |
onClose() { |
| 7264 |
clearPointerEvents(); |
| 7265 |
cleanupMouseMoveHandler(); |
| 7266 |
if (enabledRef.current && !isClickLikeOpenEvent2() && currentTrigger === store2.select("domReferenceElement")) { |
| 7267 |
closeWithDelay(event, true); |
| 7268 |
} |
| 7269 |
} |
| 7270 |
}); |
| 7271 |
doc.addEventListener("mousemove", instance.handler); |
| 7272 |
instance.handler(event); |
| 7273 |
return; |
| 7274 |
} |
| 7275 |
const shouldClose = instance.pointerType === "touch" ? !contains(store2.select("floatingElement"), event.relatedTarget) : true; |
| 7276 |
if (shouldClose) { |
| 7277 |
closeWithDelay(event); |
| 7278 |
} |
| 7279 |
} |
| 7280 |
function onMouseOut(event) { |
| 7281 |
if (contains(trigger, event.relatedTarget)) { |
| 7282 |
return; |
| 7283 |
} |
| 7284 |
instance.openChangeTimeout.clear(); |
| 7285 |
instance.restTimeout.clear(); |
| 7286 |
instance.restTimeoutPending = false; |
| 7287 |
} |
| 7288 |
const staleOpenGuard = guardStaleOpen ? addEventListener(trigger, "mouseout", onMouseOut) : void 0; |
| 7289 |
if (move) { |
| 7290 |
return mergeCleanups(addEventListener(trigger, "mousemove", onMouseEnter, { |
| 7291 |
once: true |
| 7292 |
}), addEventListener(trigger, "mouseenter", onMouseEnter), addEventListener(trigger, "mouseleave", onMouseLeave), staleOpenGuard); |
| 7293 |
} |
| 7294 |
return mergeCleanups(addEventListener(trigger, "mouseenter", onMouseEnter), addEventListener(trigger, "mouseleave", onMouseLeave), staleOpenGuard); |
| 7295 |
}, [cleanupMouseMoveHandler, clearPointerEvents, dataRef, delayRef, store2, enabled, handleCloseRef, instance, isActiveTrigger, isOverInactiveTrigger, isClickLikeOpenEvent2, mouseOnly, move, restMsRef, triggerElementRef, tree, enabledRef, getHandleCloseContext, isClosingRef, checkShouldOpen, guardStaleOpen]); |
| 7296 |
return React34.useMemo(() => { |
| 7297 |
if (!enabled) { |
| 7298 |
return void 0; |
| 7299 |
} |
| 7300 |
function setPointerRef(event) { |
| 7301 |
instance.pointerType = event.pointerType; |
| 7302 |
} |
| 7303 |
return { |
| 7304 |
onPointerDown: setPointerRef, |
| 7305 |
onPointerEnter: setPointerRef, |
| 7306 |
onMouseMove(event) { |
| 7307 |
const { |
| 7308 |
nativeEvent |
| 7309 |
} = event; |
| 7310 |
const trigger = event.currentTarget; |
| 7311 |
const currentDomReference = store2.select("domReferenceElement"); |
| 7312 |
const currentOpen = store2.select("open"); |
| 7313 |
const isOverInactive = isOverInactiveTrigger(currentDomReference, trigger, event.target); |
| 7314 |
if (mouseOnly && !isMouseLikePointerType(instance.pointerType)) { |
| 7315 |
return; |
| 7316 |
} |
| 7317 |
if (currentOpen && isOverInactive && instance.handleCloseOptions?.blockPointerEvents) { |
| 7318 |
const floatingElement = store2.select("floatingElement"); |
| 7319 |
if (floatingElement) { |
| 7320 |
const scopeElement = instance.handleCloseOptions?.getScope?.() ?? trigger.ownerDocument.body; |
| 7321 |
applySafePolygonPointerEventsMutation(instance, { |
| 7322 |
scopeElement, |
| 7323 |
referenceElement: trigger, |
| 7324 |
floatingElement |
| 7325 |
}); |
| 7326 |
} |
| 7327 |
} |
| 7328 |
const restMsValue = getRestMs(restMsRef.current); |
| 7329 |
if (currentOpen && !isOverInactive || restMsValue === 0) { |
| 7330 |
return; |
| 7331 |
} |
| 7332 |
if (!isOverInactive && instance.restTimeoutPending && event.movementX ** 2 + event.movementY ** 2 < 2) { |
| 7333 |
return; |
| 7334 |
} |
| 7335 |
instance.restTimeout.clear(); |
| 7336 |
function handleMouseMove() { |
| 7337 |
instance.restTimeoutPending = false; |
| 7338 |
if (isClickLikeOpenEvent2()) { |
| 7339 |
return; |
| 7340 |
} |
| 7341 |
const latestOpen = store2.select("open"); |
| 7342 |
if (!instance.blockMouseMove && (!latestOpen || isOverInactive) && checkShouldOpen()) { |
| 7343 |
store2.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerHover, nativeEvent, trigger)); |
| 7344 |
} |
| 7345 |
} |
| 7346 |
if (instance.pointerType === "touch") { |
| 7347 |
ReactDOM5.flushSync(() => { |
| 7348 |
handleMouseMove(); |
| 7349 |
}); |
| 7350 |
} else if (isOverInactive && currentOpen) { |
| 7351 |
handleMouseMove(); |
| 7352 |
} else { |
| 7353 |
instance.restTimeoutPending = true; |
| 7354 |
instance.restTimeout.start(restMsValue, handleMouseMove); |
| 7355 |
} |
| 7356 |
} |
| 7357 |
}; |
| 7358 |
}, [enabled, instance, isClickLikeOpenEvent2, isOverInactiveTrigger, mouseOnly, store2, restMsRef, checkShouldOpen]); |
| 7359 |
} |
| 7360 |
|
| 7361 |
// node_modules/@base-ui/react/floating-ui-react/safePolygon.mjs |
| 7362 |
var CURSOR_SPEED_THRESHOLD = 0.1; |
| 7363 |
var CURSOR_SPEED_THRESHOLD_SQUARED = CURSOR_SPEED_THRESHOLD * CURSOR_SPEED_THRESHOLD; |
| 7364 |
var POLYGON_BUFFER = 0.5; |
| 7365 |
function hasIntersectingEdge(pointX, pointY, xi, yi, xj, yj) { |
| 7366 |
return yi >= pointY !== yj >= pointY && pointX <= (xj - xi) * (pointY - yi) / (yj - yi) + xi; |
| 7367 |
} |
| 7368 |
function isPointInQuadrilateral(pointX, pointY, x1, y1, x2, y2, x3, y3, x4, y4) { |
| 7369 |
let isInsideValue = false; |
| 7370 |
if (hasIntersectingEdge(pointX, pointY, x1, y1, x2, y2)) { |
| 7371 |
isInsideValue = !isInsideValue; |
| 7372 |
} |
| 7373 |
if (hasIntersectingEdge(pointX, pointY, x2, y2, x3, y3)) { |
| 7374 |
isInsideValue = !isInsideValue; |
| 7375 |
} |
| 7376 |
if (hasIntersectingEdge(pointX, pointY, x3, y3, x4, y4)) { |
| 7377 |
isInsideValue = !isInsideValue; |
| 7378 |
} |
| 7379 |
if (hasIntersectingEdge(pointX, pointY, x4, y4, x1, y1)) { |
| 7380 |
isInsideValue = !isInsideValue; |
| 7381 |
} |
| 7382 |
return isInsideValue; |
| 7383 |
} |
| 7384 |
function isInsideRect(pointX, pointY, rect) { |
| 7385 |
return pointX >= rect.x && pointX <= rect.x + rect.width && pointY >= rect.y && pointY <= rect.y + rect.height; |
| 7386 |
} |
| 7387 |
function isInsideAxisAlignedRect(pointX, pointY, x1, y1, x2, y2) { |
| 7388 |
const minX = Math.min(x1, x2); |
| 7389 |
const maxX = Math.max(x1, x2); |
| 7390 |
const minY = Math.min(y1, y2); |
| 7391 |
const maxY = Math.max(y1, y2); |
| 7392 |
return pointX >= minX && pointX <= maxX && pointY >= minY && pointY <= maxY; |
| 7393 |
} |
| 7394 |
function safePolygon(options = {}) { |
| 7395 |
const { |
| 7396 |
blockPointerEvents = false |
| 7397 |
} = options; |
| 7398 |
const timeout = new Timeout(); |
| 7399 |
const fn = ({ |
| 7400 |
x, |
| 7401 |
y, |
| 7402 |
placement, |
| 7403 |
elements, |
| 7404 |
onClose, |
| 7405 |
nodeId, |
| 7406 |
tree |
| 7407 |
}) => { |
| 7408 |
const side = placement?.split("-")[0]; |
| 7409 |
let hasLanded = false; |
| 7410 |
let lastX = null; |
| 7411 |
let lastY = null; |
| 7412 |
let lastCursorTime = typeof performance !== "undefined" ? performance.now() : 0; |
| 7413 |
function isCursorMovingSlowly(nextX, nextY) { |
| 7414 |
const currentTime = performance.now(); |
| 7415 |
const elapsedTime = currentTime - lastCursorTime; |
| 7416 |
if (lastX === null || lastY === null || elapsedTime === 0) { |
| 7417 |
lastX = nextX; |
| 7418 |
lastY = nextY; |
| 7419 |
lastCursorTime = currentTime; |
| 7420 |
return false; |
| 7421 |
} |
| 7422 |
const deltaX = nextX - lastX; |
| 7423 |
const deltaY = nextY - lastY; |
| 7424 |
const distanceSquared = deltaX * deltaX + deltaY * deltaY; |
| 7425 |
const thresholdSquared = elapsedTime * elapsedTime * CURSOR_SPEED_THRESHOLD_SQUARED; |
| 7426 |
lastX = nextX; |
| 7427 |
lastY = nextY; |
| 7428 |
lastCursorTime = currentTime; |
| 7429 |
return distanceSquared < thresholdSquared; |
| 7430 |
} |
| 7431 |
function close() { |
| 7432 |
timeout.clear(); |
| 7433 |
onClose(); |
| 7434 |
} |
| 7435 |
return function onMouseMove(event) { |
| 7436 |
timeout.clear(); |
| 7437 |
const domReference = elements.domReference; |
| 7438 |
const floating = elements.floating; |
| 7439 |
if (!domReference || !floating || side == null || x == null || y == null) { |
| 7440 |
return void 0; |
| 7441 |
} |
| 7442 |
const { |
| 7443 |
clientX, |
| 7444 |
clientY |
| 7445 |
} = event; |
| 7446 |
const target = getTarget(event); |
| 7447 |
const isLeave = event.type === "mouseleave"; |
| 7448 |
const isOverFloatingEl = contains(floating, target); |
| 7449 |
const isOverReferenceEl = contains(domReference, target); |
| 7450 |
if (isOverFloatingEl) { |
| 7451 |
hasLanded = true; |
| 7452 |
if (!isLeave) { |
| 7453 |
return void 0; |
| 7454 |
} |
| 7455 |
} |
| 7456 |
if (isOverReferenceEl) { |
| 7457 |
hasLanded = false; |
| 7458 |
if (!isLeave) { |
| 7459 |
hasLanded = true; |
| 7460 |
return void 0; |
| 7461 |
} |
| 7462 |
} |
| 7463 |
if (isLeave && isElement(event.relatedTarget) && contains(floating, event.relatedTarget)) { |
| 7464 |
return void 0; |
| 7465 |
} |
| 7466 |
function hasOpenChildNode() { |
| 7467 |
return Boolean(tree && getNodeChildren(tree.nodesRef.current, nodeId).length > 0); |
| 7468 |
} |
| 7469 |
function closeIfNoOpenChild() { |
| 7470 |
if (!hasOpenChildNode()) { |
| 7471 |
close(); |
| 7472 |
} |
| 7473 |
} |
| 7474 |
if (hasOpenChildNode()) { |
| 7475 |
return void 0; |
| 7476 |
} |
| 7477 |
const refRect = domReference.getBoundingClientRect(); |
| 7478 |
const rect = floating.getBoundingClientRect(); |
| 7479 |
const cursorLeaveFromRight = x > rect.right - rect.width / 2; |
| 7480 |
const cursorLeaveFromBottom = y > rect.bottom - rect.height / 2; |
| 7481 |
const isFloatingWider = rect.width > refRect.width; |
| 7482 |
const isFloatingTaller = rect.height > refRect.height; |
| 7483 |
const left = (isFloatingWider ? refRect : rect).left; |
| 7484 |
const right = (isFloatingWider ? refRect : rect).right; |
| 7485 |
const top = (isFloatingTaller ? refRect : rect).top; |
| 7486 |
const bottom = (isFloatingTaller ? refRect : rect).bottom; |
| 7487 |
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) { |
| 7488 |
closeIfNoOpenChild(); |
| 7489 |
return void 0; |
| 7490 |
} |
| 7491 |
let isInsideTroughRect = false; |
| 7492 |
switch (side) { |
| 7493 |
case "top": |
| 7494 |
isInsideTroughRect = isInsideAxisAlignedRect(clientX, clientY, left, refRect.top + 1, right, rect.bottom - 1); |
| 7495 |
break; |
| 7496 |
case "bottom": |
| 7497 |
isInsideTroughRect = isInsideAxisAlignedRect(clientX, clientY, left, rect.top + 1, right, refRect.bottom - 1); |
| 7498 |
break; |
| 7499 |
case "left": |
| 7500 |
isInsideTroughRect = isInsideAxisAlignedRect(clientX, clientY, rect.right - 1, bottom, refRect.left + 1, top); |
| 7501 |
break; |
| 7502 |
case "right": |
| 7503 |
isInsideTroughRect = isInsideAxisAlignedRect(clientX, clientY, refRect.right - 1, bottom, rect.left + 1, top); |
| 7504 |
break; |
| 7505 |
default: |
| 7506 |
} |
| 7507 |
if (isInsideTroughRect) { |
| 7508 |
return void 0; |
| 7509 |
} |
| 7510 |
if (hasLanded && !isInsideRect(clientX, clientY, refRect)) { |
| 7511 |
closeIfNoOpenChild(); |
| 7512 |
return void 0; |
| 7513 |
} |
| 7514 |
if (!isLeave && isCursorMovingSlowly(clientX, clientY)) { |
| 7515 |
closeIfNoOpenChild(); |
| 7516 |
return void 0; |
| 7517 |
} |
| 7518 |
let isInsidePolygon = false; |
| 7519 |
switch (side) { |
| 7520 |
case "top": { |
| 7521 |
const cursorXOffset = isFloatingWider ? POLYGON_BUFFER / 2 : POLYGON_BUFFER * 4; |
| 7522 |
const cursorPointOneX = isFloatingWider ? x + cursorXOffset : cursorLeaveFromRight ? x + cursorXOffset : x - cursorXOffset; |
| 7523 |
const cursorPointTwoX = isFloatingWider ? x - cursorXOffset : cursorLeaveFromRight ? x + cursorXOffset : x - cursorXOffset; |
| 7524 |
const cursorPointY = y + POLYGON_BUFFER + 1; |
| 7525 |
const commonYLeft = cursorLeaveFromRight ? rect.bottom - POLYGON_BUFFER : isFloatingWider ? rect.bottom - POLYGON_BUFFER : rect.top; |
| 7526 |
const commonYRight = cursorLeaveFromRight ? isFloatingWider ? rect.bottom - POLYGON_BUFFER : rect.top : rect.bottom - POLYGON_BUFFER; |
| 7527 |
isInsidePolygon = isPointInQuadrilateral(clientX, clientY, cursorPointOneX, cursorPointY, cursorPointTwoX, cursorPointY, rect.left, commonYLeft, rect.right, commonYRight); |
| 7528 |
break; |
| 7529 |
} |
| 7530 |
case "bottom": { |
| 7531 |
const cursorXOffset = isFloatingWider ? POLYGON_BUFFER / 2 : POLYGON_BUFFER * 4; |
| 7532 |
const cursorPointOneX = isFloatingWider ? x + cursorXOffset : cursorLeaveFromRight ? x + cursorXOffset : x - cursorXOffset; |
| 7533 |
const cursorPointTwoX = isFloatingWider ? x - cursorXOffset : cursorLeaveFromRight ? x + cursorXOffset : x - cursorXOffset; |
| 7534 |
const cursorPointY = y - POLYGON_BUFFER; |
| 7535 |
const commonYLeft = cursorLeaveFromRight ? rect.top + POLYGON_BUFFER : isFloatingWider ? rect.top + POLYGON_BUFFER : rect.bottom; |
| 7536 |
const commonYRight = cursorLeaveFromRight ? isFloatingWider ? rect.top + POLYGON_BUFFER : rect.bottom : rect.top + POLYGON_BUFFER; |
| 7537 |
isInsidePolygon = isPointInQuadrilateral(clientX, clientY, cursorPointOneX, cursorPointY, cursorPointTwoX, cursorPointY, rect.left, commonYLeft, rect.right, commonYRight); |
| 7538 |
break; |
| 7539 |
} |
| 7540 |
case "left": { |
| 7541 |
const cursorYOffset = isFloatingTaller ? POLYGON_BUFFER / 2 : POLYGON_BUFFER * 4; |
| 7542 |
const cursorPointOneY = isFloatingTaller ? y + cursorYOffset : cursorLeaveFromBottom ? y + cursorYOffset : y - cursorYOffset; |
| 7543 |
const cursorPointTwoY = isFloatingTaller ? y - cursorYOffset : cursorLeaveFromBottom ? y + cursorYOffset : y - cursorYOffset; |
| 7544 |
const cursorPointX = x + POLYGON_BUFFER + 1; |
| 7545 |
const commonXTop = cursorLeaveFromBottom ? rect.right - POLYGON_BUFFER : isFloatingTaller ? rect.right - POLYGON_BUFFER : rect.left; |
| 7546 |
const commonXBottom = cursorLeaveFromBottom ? isFloatingTaller ? rect.right - POLYGON_BUFFER : rect.left : rect.right - POLYGON_BUFFER; |
| 7547 |
isInsidePolygon = isPointInQuadrilateral(clientX, clientY, commonXTop, rect.top, commonXBottom, rect.bottom, cursorPointX, cursorPointOneY, cursorPointX, cursorPointTwoY); |
| 7548 |
break; |
| 7549 |
} |
| 7550 |
case "right": { |
| 7551 |
const cursorYOffset = isFloatingTaller ? POLYGON_BUFFER / 2 : POLYGON_BUFFER * 4; |
| 7552 |
const cursorPointOneY = isFloatingTaller ? y + cursorYOffset : cursorLeaveFromBottom ? y + cursorYOffset : y - cursorYOffset; |
| 7553 |
const cursorPointTwoY = isFloatingTaller ? y - cursorYOffset : cursorLeaveFromBottom ? y + cursorYOffset : y - cursorYOffset; |
| 7554 |
const cursorPointX = x - POLYGON_BUFFER; |
| 7555 |
const commonXTop = cursorLeaveFromBottom ? rect.left + POLYGON_BUFFER : isFloatingTaller ? rect.left + POLYGON_BUFFER : rect.right; |
| 7556 |
const commonXBottom = cursorLeaveFromBottom ? isFloatingTaller ? rect.left + POLYGON_BUFFER : rect.right : rect.left + POLYGON_BUFFER; |
| 7557 |
isInsidePolygon = isPointInQuadrilateral(clientX, clientY, cursorPointX, cursorPointOneY, cursorPointX, cursorPointTwoY, commonXTop, rect.top, commonXBottom, rect.bottom); |
| 7558 |
break; |
| 7559 |
} |
| 7560 |
default: |
| 7561 |
} |
| 7562 |
if (!isInsidePolygon) { |
| 7563 |
closeIfNoOpenChild(); |
| 7564 |
} else if (!hasLanded) { |
| 7565 |
timeout.start(40, closeIfNoOpenChild); |
| 7566 |
} |
| 7567 |
return void 0; |
| 7568 |
}; |
| 7569 |
}; |
| 7570 |
fn.__options = { |
| 7571 |
...options, |
| 7572 |
blockPointerEvents |
| 7573 |
}; |
| 7574 |
return fn; |
| 7575 |
} |
| 7576 |
|
| 7577 |
// node_modules/@base-ui/react/utils/NullStore.mjs |
| 7578 |
var NullStore = class extends ReactStore { |
| 7579 |
// `update`/`set`/`notifyAll` funnel through `setState` in the base `Store`, so overriding |
| 7580 |
// `setState` alone would neutralize them today. They are overridden explicitly so the store stays |
| 7581 |
// inert even if a future base-class change stops routing a mutator through `setState`. |
| 7582 |
setState(_newState) { |
| 7583 |
} |
| 7584 |
update(_changes) { |
| 7585 |
} |
| 7586 |
set(_key, _value) { |
| 7587 |
} |
| 7588 |
notifyAll() { |
| 7589 |
} |
| 7590 |
}; |
| 7591 |
|
| 7592 |
// node_modules/@base-ui/utils/inertValue.mjs |
| 7593 |
function inertValue(value) { |
| 7594 |
if (isReactVersionAtLeast(19)) { |
| 7595 |
return value; |
| 7596 |
} |
| 7597 |
return value ? "true" : void 0; |
| 7598 |
} |
| 7599 |
|
| 7600 |
// node_modules/@base-ui/react/internals/direction-context/DirectionContext.mjs |
| 7601 |
var React35 = __toESM(require_react(), 1); |
| 7602 |
var DirectionContext = /* @__PURE__ */ React35.createContext(void 0); |
| 7603 |
if (true) DirectionContext.displayName = "DirectionContext"; |
| 7604 |
function useDirection() { |
| 7605 |
const context = React35.useContext(DirectionContext); |
| 7606 |
return context?.direction ?? "ltr"; |
| 7607 |
} |
| 7608 |
|
| 7609 |
// node_modules/@base-ui/react/internals/useAnchorPositioning.mjs |
| 7610 |
var React36 = __toESM(require_react(), 1); |
| 7611 |
|
| 7612 |
// node_modules/@base-ui/react/floating-ui-react/middleware/arrow.mjs |
| 7613 |
var baseArrow = (options) => ({ |
| 7614 |
name: "arrow", |
| 7615 |
options, |
| 7616 |
async fn(state) { |
| 7617 |
const { |
| 7618 |
x, |
| 7619 |
y, |
| 7620 |
placement, |
| 7621 |
rects, |
| 7622 |
platform: platform3, |
| 7623 |
elements, |
| 7624 |
middlewareData |
| 7625 |
} = state; |
| 7626 |
const { |
| 7627 |
element, |
| 7628 |
padding = 0, |
| 7629 |
offsetParent = "real" |
| 7630 |
} = evaluate(options, state) || {}; |
| 7631 |
if (element == null) { |
| 7632 |
return {}; |
| 7633 |
} |
| 7634 |
const paddingObject = getPaddingObject(padding); |
| 7635 |
const coords = { |
| 7636 |
x, |
| 7637 |
y |
| 7638 |
}; |
| 7639 |
const axis = getAlignmentAxis(placement); |
| 7640 |
const length = getAxisLength(axis); |
| 7641 |
const arrowDimensions = await platform3.getDimensions(element); |
| 7642 |
const isYAxis = axis === "y"; |
| 7643 |
const minProp = isYAxis ? "top" : "left"; |
| 7644 |
const maxProp = isYAxis ? "bottom" : "right"; |
| 7645 |
const clientProp = isYAxis ? "clientHeight" : "clientWidth"; |
| 7646 |
const endDiff = rects.reference[length] + rects.reference[axis] - coords[axis] - rects.floating[length]; |
| 7647 |
const startDiff = coords[axis] - rects.reference[axis]; |
| 7648 |
const arrowOffsetParent = offsetParent === "real" ? await platform3.getOffsetParent?.(element) : elements.floating; |
| 7649 |
let clientSize = elements.floating[clientProp] || rects.floating[length]; |
| 7650 |
if (!clientSize || !await platform3.isElement?.(arrowOffsetParent)) { |
| 7651 |
clientSize = elements.floating[clientProp] || rects.floating[length]; |
| 7652 |
} |
| 7653 |
const centerToReference = endDiff / 2 - startDiff / 2; |
| 7654 |
const largestPossiblePadding = clientSize / 2 - arrowDimensions[length] / 2 - 1; |
| 7655 |
const minPadding = Math.min(paddingObject[minProp], largestPossiblePadding); |
| 7656 |
const maxPadding = Math.min(paddingObject[maxProp], largestPossiblePadding); |
| 7657 |
const min2 = minPadding; |
| 7658 |
const max2 = clientSize - arrowDimensions[length] - maxPadding; |
| 7659 |
const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference; |
| 7660 |
const offset4 = clamp(min2, center, max2); |
| 7661 |
const shouldAddOffset = !middlewareData.arrow && getAlignment(placement) != null && center !== offset4 && rects.reference[length] / 2 - (center < min2 ? minPadding : maxPadding) - arrowDimensions[length] / 2 < 0; |
| 7662 |
const alignmentOffset = shouldAddOffset ? center < min2 ? center - min2 : center - max2 : 0; |
| 7663 |
return { |
| 7664 |
[axis]: coords[axis] + alignmentOffset, |
| 7665 |
data: { |
| 7666 |
[axis]: offset4, |
| 7667 |
centerOffset: center - offset4 - alignmentOffset, |
| 7668 |
...shouldAddOffset && { |
| 7669 |
alignmentOffset |
| 7670 |
} |
| 7671 |
}, |
| 7672 |
reset: shouldAddOffset |
| 7673 |
}; |
| 7674 |
} |
| 7675 |
}); |
| 7676 |
var arrow4 = (options, deps) => { |
| 7677 |
const { |
| 7678 |
name, |
| 7679 |
fn |
| 7680 |
} = baseArrow(options); |
| 7681 |
return { |
| 7682 |
name, |
| 7683 |
fn, |
| 7684 |
options: [options, deps] |
| 7685 |
}; |
| 7686 |
}; |
| 7687 |
|
| 7688 |
// node_modules/@base-ui/react/utils/hideMiddleware.mjs |
| 7689 |
var hide4 = { |
| 7690 |
name: "hide", |
| 7691 |
async fn(state) { |
| 7692 |
const { |
| 7693 |
width, |
| 7694 |
height, |
| 7695 |
x, |
| 7696 |
y |
| 7697 |
} = state.rects.reference; |
| 7698 |
const anchorHidden2 = width === 0 && height === 0 && x === 0 && y === 0; |
| 7699 |
const overflow = await state.platform.detectOverflow(state, { |
| 7700 |
elementContext: "reference" |
| 7701 |
}); |
| 7702 |
const referenceHidden = overflow.top - height >= 0 || overflow.right - width >= 0 || overflow.bottom - height >= 0 || overflow.left - width >= 0; |
| 7703 |
return { |
| 7704 |
data: { |
| 7705 |
referenceHidden: referenceHidden || anchorHidden2 |
| 7706 |
} |
| 7707 |
}; |
| 7708 |
} |
| 7709 |
}; |
| 7710 |
|
| 7711 |
// node_modules/@base-ui/react/utils/adaptiveOriginConstants.mjs |
| 7712 |
var DEFAULT_SIDES = { |
| 7713 |
sideX: "left", |
| 7714 |
sideY: "top" |
| 7715 |
}; |
| 7716 |
|
| 7717 |
// node_modules/@base-ui/react/utils/CommonPositionerCssVars.mjs |
| 7718 |
var availableWidth = "--available-width"; |
| 7719 |
var availableHeight = "--available-height"; |
| 7720 |
var anchorWidth = "--anchor-width"; |
| 7721 |
var anchorHeight = "--anchor-height"; |
| 7722 |
var transformOrigin = "--transform-origin"; |
| 7723 |
var positionerWidth = "--positioner-width"; |
| 7724 |
var positionerHeight = "--positioner-height"; |
| 7725 |
|
| 7726 |
// node_modules/@base-ui/react/internals/useAnchorPositioning.mjs |
| 7727 |
var AVAILABLE_WIDTH_VAR = availableWidth; |
| 7728 |
var AVAILABLE_HEIGHT_VAR = availableHeight; |
| 7729 |
function getLogicalSide(sideParam, renderedSide, isRtl) { |
| 7730 |
const isLogicalSideParam = sideParam === "inline-start" || sideParam === "inline-end"; |
| 7731 |
const logicalRight = isRtl ? "inline-start" : "inline-end"; |
| 7732 |
const logicalLeft = isRtl ? "inline-end" : "inline-start"; |
| 7733 |
return { |
| 7734 |
top: "top", |
| 7735 |
right: isLogicalSideParam ? logicalRight : "right", |
| 7736 |
bottom: "bottom", |
| 7737 |
left: isLogicalSideParam ? logicalLeft : "left" |
| 7738 |
}[renderedSide]; |
| 7739 |
} |
| 7740 |
function getOffsetData(state, sideParam, isRtl) { |
| 7741 |
const { |
| 7742 |
rects, |
| 7743 |
placement |
| 7744 |
} = state; |
| 7745 |
const data = { |
| 7746 |
side: getLogicalSide(sideParam, getSide(placement), isRtl), |
| 7747 |
align: getAlignment(placement) || "center", |
| 7748 |
anchor: { |
| 7749 |
width: rects.reference.width, |
| 7750 |
height: rects.reference.height |
| 7751 |
}, |
| 7752 |
positioner: { |
| 7753 |
width: rects.floating.width, |
| 7754 |
height: rects.floating.height |
| 7755 |
} |
| 7756 |
}; |
| 7757 |
return data; |
| 7758 |
} |
| 7759 |
function useAnchorPositioning(params) { |
| 7760 |
return useAnchorPositioningWithHook(params, useBaseUIFloating); |
| 7761 |
} |
| 7762 |
function useAnchorPositioningWithHook(params, useFloatingHook) { |
| 7763 |
const { |
| 7764 |
// Public parameters |
| 7765 |
anchor, |
| 7766 |
positionMethod = "absolute", |
| 7767 |
side: sideParam = "bottom", |
| 7768 |
sideOffset = 0, |
| 7769 |
align = "center", |
| 7770 |
alignOffset = 0, |
| 7771 |
collisionBoundary, |
| 7772 |
collisionPadding: collisionPaddingParam = 5, |
| 7773 |
sticky = false, |
| 7774 |
arrowPadding = 5, |
| 7775 |
disableAnchorTracking = false, |
| 7776 |
inline: inlineMiddleware, |
| 7777 |
// Private parameters |
| 7778 |
keepMounted = false, |
| 7779 |
floatingRootContext, |
| 7780 |
mounted, |
| 7781 |
collisionAvoidance, |
| 7782 |
shift: shift4, |
| 7783 |
nodeId, |
| 7784 |
adaptiveOrigin: adaptiveOrigin2, |
| 7785 |
lazyFlip = false, |
| 7786 |
externalTree |
| 7787 |
} = params; |
| 7788 |
const [mountSide, setMountSide] = React36.useState(null); |
| 7789 |
if (!mounted && mountSide !== null) { |
| 7790 |
setMountSide(null); |
| 7791 |
} |
| 7792 |
const collisionAvoidanceSide = collisionAvoidance.side || "flip"; |
| 7793 |
const collisionAvoidanceAlign = collisionAvoidance.align || "flip"; |
| 7794 |
const collisionAvoidanceFallbackAxisSide = collisionAvoidance.fallbackAxisSide || "end"; |
| 7795 |
const shiftCrossAxis = shift4?.crossAxis ?? false; |
| 7796 |
const shiftRootBoundary = shift4?.rootBoundary; |
| 7797 |
const anchorFn = typeof anchor === "function" ? anchor : void 0; |
| 7798 |
const anchorFnCallback = useStableCallback(anchorFn); |
| 7799 |
const anchorDep = anchorFn ? anchorFnCallback : anchor; |
| 7800 |
const anchorValueRef = useValueAsRef(anchor); |
| 7801 |
const mountedRef = useValueAsRef(mounted); |
| 7802 |
const direction = useDirection(); |
| 7803 |
const isRtl = direction === "rtl"; |
| 7804 |
const side = mountSide || { |
| 7805 |
top: "top", |
| 7806 |
right: "right", |
| 7807 |
bottom: "bottom", |
| 7808 |
left: "left", |
| 7809 |
"inline-end": isRtl ? "left" : "right", |
| 7810 |
"inline-start": isRtl ? "right" : "left" |
| 7811 |
}[sideParam]; |
| 7812 |
const placement = align === "center" ? side : `${side}-${align}`; |
| 7813 |
let collisionPadding = collisionPaddingParam; |
| 7814 |
if (typeof collisionPadding === "number") { |
| 7815 |
collisionPadding = { |
| 7816 |
top: collisionPadding, |
| 7817 |
right: collisionPadding, |
| 7818 |
bottom: collisionPadding, |
| 7819 |
left: collisionPadding |
| 7820 |
}; |
| 7821 |
} else if (collisionPadding) { |
| 7822 |
collisionPadding = { |
| 7823 |
top: collisionPadding.top || 0, |
| 7824 |
right: collisionPadding.right || 0, |
| 7825 |
bottom: collisionPadding.bottom || 0, |
| 7826 |
left: collisionPadding.left || 0 |
| 7827 |
}; |
| 7828 |
} |
| 7829 |
const bias = 1; |
| 7830 |
const biasTop = sideParam === "bottom" ? bias : 0; |
| 7831 |
const biasBottom = sideParam === "top" ? bias : 0; |
| 7832 |
const biasLeft = sideParam === "right" ? bias : 0; |
| 7833 |
const biasRight = sideParam === "left" ? bias : 0; |
| 7834 |
const commonCollisionProps = { |
| 7835 |
boundary: collisionBoundary === "clipping-ancestors" ? "clippingAncestors" : collisionBoundary, |
| 7836 |
padding: collisionPadding |
| 7837 |
}; |
| 7838 |
const arrowRef = React36.useRef(null); |
| 7839 |
const sideOffsetRef = useValueAsRef(sideOffset); |
| 7840 |
const alignOffsetRef = useValueAsRef(alignOffset); |
| 7841 |
const sideOffsetDep = typeof sideOffset !== "function" ? sideOffset : 0; |
| 7842 |
const alignOffsetDep = typeof alignOffset !== "function" ? alignOffset : 0; |
| 7843 |
const middleware = []; |
| 7844 |
if (inlineMiddleware) { |
| 7845 |
middleware.push(inlineMiddleware); |
| 7846 |
} |
| 7847 |
middleware.push(offset3((state) => { |
| 7848 |
const data = getOffsetData(state, sideParam, isRtl); |
| 7849 |
const sideAxis = typeof sideOffsetRef.current === "function" ? sideOffsetRef.current(data) : sideOffsetRef.current; |
| 7850 |
const alignAxis = typeof alignOffsetRef.current === "function" ? alignOffsetRef.current(data) : alignOffsetRef.current; |
| 7851 |
return { |
| 7852 |
mainAxis: sideAxis, |
| 7853 |
crossAxis: alignAxis, |
| 7854 |
alignmentAxis: alignAxis |
| 7855 |
}; |
| 7856 |
}, [sideOffsetDep, alignOffsetDep, isRtl, sideParam])); |
| 7857 |
const shiftDisabled = collisionAvoidanceAlign === "none" && collisionAvoidanceSide !== "shift"; |
| 7858 |
const crossAxisShiftEnabled = !shiftDisabled && (sticky || shiftCrossAxis || collisionAvoidanceSide === "shift"); |
| 7859 |
const flipMiddleware = collisionAvoidanceSide === "none" ? null : flip3({ |
| 7860 |
...commonCollisionProps, |
| 7861 |
// Ensure the popup flips if it's been limited by its --available-height and it resizes. |
| 7862 |
// Since the size() padding is smaller than the flip() padding, flip() will take precedence. |
| 7863 |
padding: { |
| 7864 |
top: collisionPadding.top + bias + biasTop, |
| 7865 |
right: collisionPadding.right + bias + biasRight, |
| 7866 |
bottom: collisionPadding.bottom + bias + biasBottom, |
| 7867 |
left: collisionPadding.left + bias + biasLeft |
| 7868 |
}, |
| 7869 |
mainAxis: !shiftCrossAxis && collisionAvoidanceSide === "flip", |
| 7870 |
crossAxis: collisionAvoidanceAlign === "flip" ? "alignment" : false, |
| 7871 |
fallbackAxisSideDirection: collisionAvoidanceFallbackAxisSide |
| 7872 |
}); |
| 7873 |
const shiftMiddleware = shiftDisabled ? null : shift3({ |
| 7874 |
...commonCollisionProps, |
| 7875 |
// Use the Layout Viewport to avoid shifting around when pinch-zooming. |
| 7876 |
rootBoundary: shiftRootBoundary, |
| 7877 |
mainAxis: collisionAvoidanceAlign !== "none", |
| 7878 |
crossAxis: crossAxisShiftEnabled, |
| 7879 |
limiter: sticky || shiftCrossAxis ? void 0 : limitShift3((limitData) => { |
| 7880 |
if (!arrowRef.current) { |
| 7881 |
return {}; |
| 7882 |
} |
| 7883 |
const { |
| 7884 |
width, |
| 7885 |
height |
| 7886 |
} = arrowRef.current.getBoundingClientRect(); |
| 7887 |
const sideAxis = getSideAxis(getSide(limitData.placement)); |
| 7888 |
const arrowSize = sideAxis === "y" ? width : height; |
| 7889 |
const offsetAmount = sideAxis === "y" ? collisionPadding.left + collisionPadding.right : collisionPadding.top + collisionPadding.bottom; |
| 7890 |
return { |
| 7891 |
offset: arrowSize / 2 + offsetAmount / 2 |
| 7892 |
}; |
| 7893 |
}) |
| 7894 |
}, [commonCollisionProps, sticky, shiftCrossAxis, shiftRootBoundary, collisionPadding, collisionAvoidanceAlign]); |
| 7895 |
if (collisionAvoidanceSide === "shift" || collisionAvoidanceAlign === "shift" || align === "center") { |
| 7896 |
middleware.push(shiftMiddleware, flipMiddleware); |
| 7897 |
} else { |
| 7898 |
middleware.push(flipMiddleware, shiftMiddleware); |
| 7899 |
} |
| 7900 |
middleware.push(size3({ |
| 7901 |
...commonCollisionProps, |
| 7902 |
apply({ |
| 7903 |
elements: { |
| 7904 |
floating |
| 7905 |
}, |
| 7906 |
availableWidth: availableWidth2, |
| 7907 |
availableHeight: availableHeight2, |
| 7908 |
rects |
| 7909 |
}) { |
| 7910 |
if (!mountedRef.current) { |
| 7911 |
return; |
| 7912 |
} |
| 7913 |
const floatingStyle = floating.style; |
| 7914 |
floatingStyle.setProperty(AVAILABLE_WIDTH_VAR, `${availableWidth2}px`); |
| 7915 |
floatingStyle.setProperty(AVAILABLE_HEIGHT_VAR, `${availableHeight2}px`); |
| 7916 |
const dpr = getWindow(floating).devicePixelRatio || 1; |
| 7917 |
const { |
| 7918 |
x: x2, |
| 7919 |
y: y2, |
| 7920 |
width, |
| 7921 |
height |
| 7922 |
} = rects.reference; |
| 7923 |
const anchorWidth2 = (Math.round((x2 + width) * dpr) - Math.round(x2 * dpr)) / dpr; |
| 7924 |
const anchorHeight2 = (Math.round((y2 + height) * dpr) - Math.round(y2 * dpr)) / dpr; |
| 7925 |
floatingStyle.setProperty(anchorWidth, `${anchorWidth2}px`); |
| 7926 |
floatingStyle.setProperty(anchorHeight, `${anchorHeight2}px`); |
| 7927 |
} |
| 7928 |
}), arrow4((state) => ({ |
| 7929 |
// `transform-origin` calculations rely on an element existing. If the arrow hasn't been set, |
| 7930 |
// we'll create a fake element. |
| 7931 |
element: arrowRef.current || ownerDocument(state.elements.floating).createElement("div"), |
| 7932 |
// No padding for the fake arrow: it would displace aligned popups on narrow anchors. |
| 7933 |
padding: arrowRef.current ? arrowPadding : 0, |
| 7934 |
offsetParent: "floating" |
| 7935 |
}), [arrowPadding]), { |
| 7936 |
name: "transformOrigin", |
| 7937 |
fn(state) { |
| 7938 |
const { |
| 7939 |
elements: { |
| 7940 |
floating |
| 7941 |
}, |
| 7942 |
middlewareData: middlewareData2, |
| 7943 |
placement: renderedPlacement2, |
| 7944 |
platform: platform3, |
| 7945 |
rects, |
| 7946 |
y: y2 |
| 7947 |
} = state; |
| 7948 |
const renderedSide2 = getSide(renderedPlacement2); |
| 7949 |
const renderedAlign2 = getAlignment(renderedPlacement2); |
| 7950 |
const isVertical = getSideAxis(renderedSide2) === "y"; |
| 7951 |
const arrowEl = arrowRef.current; |
| 7952 |
const sideOffsetValue = typeof sideOffset === "function" ? sideOffset(getOffsetData(state, sideParam, isRtl)) : sideOffset; |
| 7953 |
let crossOrigin; |
| 7954 |
if (!arrowEl && renderedAlign2 && Math.abs(isVertical ? middlewareData2.shift?.x || 0 : middlewareData2.shift?.y || 0) <= 1) { |
| 7955 |
crossOrigin = renderedAlign2 === "start" === (isVertical && platform3.isRTL?.(floating) === true) ? "100%" : "0%"; |
| 7956 |
} else { |
| 7957 |
const arrowOffset = isVertical ? middlewareData2.arrow?.x || 0 : middlewareData2.arrow?.y || 0; |
| 7958 |
const arrowSize = isVertical ? arrowEl?.clientWidth || 0 : arrowEl?.clientHeight || 0; |
| 7959 |
crossOrigin = `${arrowOffset + arrowSize / 2}px`; |
| 7960 |
} |
| 7961 |
let sideOrigin = renderedSide2 === "top" || renderedSide2 === "left" ? `calc(100% + ${sideOffsetValue}px)` : `${-sideOffsetValue}px`; |
| 7962 |
if (crossAxisShiftEnabled && isVertical && Math.abs(middlewareData2.shift?.y || 0) > sideOffsetValue) { |
| 7963 |
sideOrigin = `${rects.reference.y + rects.reference.height / 2 - y2}px`; |
| 7964 |
} |
| 7965 |
floating.style.setProperty(transformOrigin, isVertical ? `${crossOrigin} ${sideOrigin}` : `${sideOrigin} ${crossOrigin}`); |
| 7966 |
return {}; |
| 7967 |
} |
| 7968 |
}, hide4, adaptiveOrigin2); |
| 7969 |
useIsoLayoutEffect(() => { |
| 7970 |
if (!mounted && floatingRootContext) { |
| 7971 |
floatingRootContext.update({ |
| 7972 |
referenceElement: null, |
| 7973 |
floatingElement: null, |
| 7974 |
domReferenceElement: null, |
| 7975 |
positionReference: null |
| 7976 |
}); |
| 7977 |
} |
| 7978 |
}, [mounted, floatingRootContext]); |
| 7979 |
const autoUpdateOptions = React36.useMemo(() => ({ |
| 7980 |
ancestorScroll: !disableAnchorTracking, |
| 7981 |
elementResize: !disableAnchorTracking && typeof ResizeObserver !== "undefined", |
| 7982 |
layoutShift: !disableAnchorTracking && typeof IntersectionObserver !== "undefined" |
| 7983 |
}), [disableAnchorTracking]); |
| 7984 |
const { |
| 7985 |
refs, |
| 7986 |
elements, |
| 7987 |
x, |
| 7988 |
y, |
| 7989 |
middlewareData, |
| 7990 |
update: update2, |
| 7991 |
placement: renderedPlacement, |
| 7992 |
context, |
| 7993 |
isPositioned, |
| 7994 |
floatingStyles: originalFloatingStyles |
| 7995 |
} = useFloatingHook({ |
| 7996 |
rootContext: floatingRootContext, |
| 7997 |
open: keepMounted ? mounted : void 0, |
| 7998 |
placement, |
| 7999 |
middleware, |
| 8000 |
strategy: positionMethod, |
| 8001 |
whileElementsMounted: keepMounted ? void 0 : (...args) => autoUpdate(...args, autoUpdateOptions), |
| 8002 |
nodeId, |
| 8003 |
externalTree |
| 8004 |
}); |
| 8005 |
const { |
| 8006 |
sideX, |
| 8007 |
sideY |
| 8008 |
} = middlewareData.adaptiveOrigin || DEFAULT_SIDES; |
| 8009 |
const resolvedPosition = isPositioned ? positionMethod : "fixed"; |
| 8010 |
const floatingStyles = React36.useMemo(() => { |
| 8011 |
let base; |
| 8012 |
if (!isPositioned) { |
| 8013 |
base = { |
| 8014 |
position: resolvedPosition, |
| 8015 |
top: 0, |
| 8016 |
left: 0 |
| 8017 |
}; |
| 8018 |
} else if (adaptiveOrigin2) { |
| 8019 |
base = { |
| 8020 |
position: resolvedPosition, |
| 8021 |
[sideX]: x, |
| 8022 |
[sideY]: y |
| 8023 |
}; |
| 8024 |
} else { |
| 8025 |
base = { |
| 8026 |
...originalFloatingStyles, |
| 8027 |
position: resolvedPosition |
| 8028 |
}; |
| 8029 |
} |
| 8030 |
base[AVAILABLE_WIDTH_VAR] = "100vw"; |
| 8031 |
base[AVAILABLE_HEIGHT_VAR] = "100vh"; |
| 8032 |
if (!isPositioned) { |
| 8033 |
base.opacity = 0; |
| 8034 |
} |
| 8035 |
return base; |
| 8036 |
}, [adaptiveOrigin2, resolvedPosition, sideX, x, sideY, y, originalFloatingStyles, isPositioned]); |
| 8037 |
const registeredPositionReferenceRef = React36.useRef(null); |
| 8038 |
useIsoLayoutEffect(() => { |
| 8039 |
if (!mounted) { |
| 8040 |
return; |
| 8041 |
} |
| 8042 |
const anchorValue = anchorValueRef.current; |
| 8043 |
const resolvedAnchor = typeof anchorValue === "function" ? anchorValue() : anchorValue; |
| 8044 |
const unwrappedElement = (isRef(resolvedAnchor) ? resolvedAnchor.current : resolvedAnchor) || null; |
| 8045 |
const finalAnchor = unwrappedElement || null; |
| 8046 |
if (finalAnchor !== registeredPositionReferenceRef.current) { |
| 8047 |
refs.setPositionReference(finalAnchor); |
| 8048 |
registeredPositionReferenceRef.current = finalAnchor; |
| 8049 |
} |
| 8050 |
}, [mounted, refs, anchorDep, anchorValueRef]); |
| 8051 |
React36.useEffect(() => { |
| 8052 |
if (!mounted) { |
| 8053 |
return; |
| 8054 |
} |
| 8055 |
const anchorValue = anchorValueRef.current; |
| 8056 |
if (typeof anchorValue === "function") { |
| 8057 |
return; |
| 8058 |
} |
| 8059 |
if (isRef(anchorValue) && anchorValue.current !== registeredPositionReferenceRef.current) { |
| 8060 |
refs.setPositionReference(anchorValue.current); |
| 8061 |
registeredPositionReferenceRef.current = anchorValue.current; |
| 8062 |
} |
| 8063 |
}, [mounted, refs, anchorDep, anchorValueRef]); |
| 8064 |
React36.useEffect(() => { |
| 8065 |
if (keepMounted && mounted && elements.reference && elements.floating) { |
| 8066 |
return autoUpdate(elements.reference, elements.floating, update2, autoUpdateOptions); |
| 8067 |
} |
| 8068 |
return void 0; |
| 8069 |
}, [keepMounted, mounted, elements, update2, autoUpdateOptions]); |
| 8070 |
const renderedSide = getSide(renderedPlacement); |
| 8071 |
const logicalRenderedSide = getLogicalSide(sideParam, renderedSide, isRtl); |
| 8072 |
const renderedAlign = getAlignment(renderedPlacement) || "center"; |
| 8073 |
const anchorHidden2 = Boolean(middlewareData.hide?.referenceHidden); |
| 8074 |
useIsoLayoutEffect(() => { |
| 8075 |
if (lazyFlip && mounted && isPositioned && renderedSide !== side) { |
| 8076 |
setMountSide(renderedSide); |
| 8077 |
} |
| 8078 |
}, [lazyFlip, mounted, isPositioned, renderedSide, side]); |
| 8079 |
const arrowStyles = React36.useMemo(() => ({ |
| 8080 |
position: "absolute", |
| 8081 |
top: middlewareData.arrow?.y, |
| 8082 |
left: middlewareData.arrow?.x |
| 8083 |
}), [middlewareData.arrow]); |
| 8084 |
const arrowUncentered = middlewareData.arrow?.centerOffset !== 0; |
| 8085 |
return React36.useMemo(() => ({ |
| 8086 |
positionerStyles: floatingStyles, |
| 8087 |
arrowStyles, |
| 8088 |
arrowRef, |
| 8089 |
arrowUncentered, |
| 8090 |
side: logicalRenderedSide, |
| 8091 |
align: renderedAlign, |
| 8092 |
physicalSide: renderedSide, |
| 8093 |
anchorHidden: anchorHidden2, |
| 8094 |
refs, |
| 8095 |
context, |
| 8096 |
isPositioned, |
| 8097 |
update: update2 |
| 8098 |
}), [floatingStyles, arrowStyles, arrowRef, arrowUncentered, logicalRenderedSide, renderedAlign, renderedSide, anchorHidden2, refs, context, isPositioned, update2]); |
| 8099 |
} |
| 8100 |
function isRef(param) { |
| 8101 |
return param != null && "current" in param; |
| 8102 |
} |
| 8103 |
|
| 8104 |
// node_modules/@base-ui/react/internals/getDisabledMountTransitionStyles.mjs |
| 8105 |
function getDisabledMountTransitionStyles(transitionStatus) { |
| 8106 |
return transitionStatus === "starting" ? DISABLED_TRANSITIONS_STYLE : EMPTY_OBJECT; |
| 8107 |
} |
| 8108 |
|
| 8109 |
// node_modules/@base-ui/react/utils/usePositioner.mjs |
| 8110 |
function usePositioner(componentProps, state, { |
| 8111 |
styles, |
| 8112 |
transitionStatus, |
| 8113 |
props, |
| 8114 |
refs, |
| 8115 |
hidden, |
| 8116 |
inert = false |
| 8117 |
}) { |
| 8118 |
const style = { |
| 8119 |
...styles |
| 8120 |
}; |
| 8121 |
if (inert) { |
| 8122 |
style.pointerEvents = "none"; |
| 8123 |
} |
| 8124 |
return useRenderElement("div", componentProps, { |
| 8125 |
state, |
| 8126 |
ref: refs, |
| 8127 |
props: [{ |
| 8128 |
role: "presentation", |
| 8129 |
hidden, |
| 8130 |
style |
| 8131 |
}, getDisabledMountTransitionStyles(transitionStatus), props], |
| 8132 |
stateAttributesMapping: popupStateMapping |
| 8133 |
}); |
| 8134 |
} |
| 8135 |
|
| 8136 |
// node_modules/@base-ui/react/button/Button.mjs |
| 8137 |
var React37 = __toESM(require_react(), 1); |
| 8138 |
var Button = /* @__PURE__ */ React37.forwardRef(function Button2(componentProps, forwardedRef) { |
| 8139 |
const { |
| 8140 |
render, |
| 8141 |
className, |
| 8142 |
disabled: disabled2 = false, |
| 8143 |
focusableWhenDisabled = false, |
| 8144 |
nativeButton = true, |
| 8145 |
style, |
| 8146 |
...elementProps |
| 8147 |
} = componentProps; |
| 8148 |
const { |
| 8149 |
getButtonProps, |
| 8150 |
buttonRef |
| 8151 |
} = useButton({ |
| 8152 |
disabled: disabled2, |
| 8153 |
focusableWhenDisabled, |
| 8154 |
native: nativeButton |
| 8155 |
}); |
| 8156 |
const state = { |
| 8157 |
disabled: disabled2 |
| 8158 |
}; |
| 8159 |
return useRenderElement("button", componentProps, { |
| 8160 |
state, |
| 8161 |
ref: [forwardedRef, buttonRef], |
| 8162 |
props: [elementProps, getButtonProps] |
| 8163 |
}); |
| 8164 |
}); |
| 8165 |
if (true) Button.displayName = "Button"; |
| 8166 |
|
| 8167 |
// node_modules/@base-ui/react/collapsible/index.parts.mjs |
| 8168 |
var index_parts_exports = {}; |
| 8169 |
__export(index_parts_exports, { |
| 8170 |
Panel: () => CollapsiblePanel, |
| 8171 |
Root: () => CollapsibleRoot, |
| 8172 |
Trigger: () => CollapsibleTrigger |
| 8173 |
}); |
| 8174 |
|
| 8175 |
// node_modules/@base-ui/react/collapsible/root/CollapsibleRoot.mjs |
| 8176 |
var React38 = __toESM(require_react(), 1); |
| 8177 |
|
| 8178 |
// node_modules/@base-ui/react/collapsible/root/stateAttributesMapping.mjs |
| 8179 |
var collapsibleStateAttributesMapping = { |
| 8180 |
...collapsibleOpenStateMapping, |
| 8181 |
...transitionStatusMapping |
| 8182 |
}; |
| 8183 |
|
| 8184 |
// node_modules/@base-ui/react/collapsible/root/CollapsibleRoot.mjs |
| 8185 |
var import_jsx_runtime5 = __toESM(require_jsx_runtime(), 1); |
| 8186 |
var CollapsibleRoot = /* @__PURE__ */ React38.forwardRef(function CollapsibleRoot2(componentProps, forwardedRef) { |
| 8187 |
const { |
| 8188 |
render, |
| 8189 |
className, |
| 8190 |
defaultOpen = false, |
| 8191 |
disabled: disabled2 = false, |
| 8192 |
onOpenChange: onOpenChangeProp, |
| 8193 |
open: open3, |
| 8194 |
style, |
| 8195 |
...elementProps |
| 8196 |
} = componentProps; |
| 8197 |
const onOpenChange = useStableCallback(onOpenChangeProp); |
| 8198 |
const collapsible = useCollapsibleRoot({ |
| 8199 |
open: open3, |
| 8200 |
defaultOpen, |
| 8201 |
onOpenChange, |
| 8202 |
disabled: disabled2 |
| 8203 |
}); |
| 8204 |
const state = React38.useMemo(() => ({ |
| 8205 |
open: collapsible.open, |
| 8206 |
disabled: collapsible.disabled, |
| 8207 |
transitionStatus: collapsible.transitionStatus |
| 8208 |
}), [collapsible.open, collapsible.disabled, collapsible.transitionStatus]); |
| 8209 |
const contextValue = React38.useMemo(() => ({ |
| 8210 |
...collapsible, |
| 8211 |
onOpenChange, |
| 8212 |
state |
| 8213 |
}), [collapsible, onOpenChange, state]); |
| 8214 |
const element = useRenderElement("div", componentProps, { |
| 8215 |
state, |
| 8216 |
ref: forwardedRef, |
| 8217 |
props: elementProps, |
| 8218 |
stateAttributesMapping: collapsibleStateAttributesMapping |
| 8219 |
}); |
| 8220 |
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(CollapsibleRootContext.Provider, { |
| 8221 |
value: contextValue, |
| 8222 |
children: element |
| 8223 |
}); |
| 8224 |
}); |
| 8225 |
if (true) CollapsibleRoot.displayName = "CollapsibleRoot"; |
| 8226 |
|
| 8227 |
// node_modules/@base-ui/react/collapsible/trigger/CollapsibleTrigger.mjs |
| 8228 |
var React39 = __toESM(require_react(), 1); |
| 8229 |
var stateAttributesMapping = { |
| 8230 |
...triggerOpenStateMapping, |
| 8231 |
...transitionStatusMapping |
| 8232 |
}; |
| 8233 |
var CollapsibleTrigger = /* @__PURE__ */ React39.forwardRef(function CollapsibleTrigger2(componentProps, forwardedRef) { |
| 8234 |
const { |
| 8235 |
panelId, |
| 8236 |
open: open3, |
| 8237 |
handleTrigger, |
| 8238 |
state, |
| 8239 |
disabled: contextDisabled |
| 8240 |
} = useCollapsibleRootContext(); |
| 8241 |
const { |
| 8242 |
className, |
| 8243 |
disabled: disabled2 = contextDisabled, |
| 8244 |
render, |
| 8245 |
nativeButton = true, |
| 8246 |
style, |
| 8247 |
...elementProps |
| 8248 |
} = componentProps; |
| 8249 |
const { |
| 8250 |
getButtonProps, |
| 8251 |
buttonRef |
| 8252 |
} = useButton({ |
| 8253 |
disabled: disabled2, |
| 8254 |
focusableWhenDisabled: true, |
| 8255 |
native: nativeButton |
| 8256 |
}); |
| 8257 |
const element = useRenderElement("button", componentProps, { |
| 8258 |
state, |
| 8259 |
ref: [forwardedRef, buttonRef], |
| 8260 |
props: [{ |
| 8261 |
"aria-controls": open3 ? panelId : void 0, |
| 8262 |
"aria-expanded": open3, |
| 8263 |
onClick: handleTrigger |
| 8264 |
}, elementProps, getButtonProps], |
| 8265 |
stateAttributesMapping |
| 8266 |
}); |
| 8267 |
return element; |
| 8268 |
}); |
| 8269 |
if (true) CollapsibleTrigger.displayName = "CollapsibleTrigger"; |
| 8270 |
|
| 8271 |
// node_modules/@base-ui/react/collapsible/panel/CollapsiblePanel.mjs |
| 8272 |
var React40 = __toESM(require_react(), 1); |
| 8273 |
|
| 8274 |
// node_modules/@base-ui/react/collapsible/panel/CollapsiblePanelCssVars.mjs |
| 8275 |
var collapsiblePanelHeight = "--collapsible-panel-height"; |
| 8276 |
var collapsiblePanelWidth = "--collapsible-panel-width"; |
| 8277 |
|
| 8278 |
// node_modules/@base-ui/react/collapsible/panel/CollapsiblePanel.mjs |
| 8279 |
var CollapsiblePanel = /* @__PURE__ */ React40.forwardRef(function CollapsiblePanel2(componentProps, forwardedRef) { |
| 8280 |
const { |
| 8281 |
className, |
| 8282 |
hiddenUntilFound: hiddenUntilFoundProp, |
| 8283 |
keepMounted: keepMountedProp, |
| 8284 |
render, |
| 8285 |
id: idProp, |
| 8286 |
style, |
| 8287 |
...elementProps |
| 8288 |
} = componentProps; |
| 8289 |
if (true) { |
| 8290 |
React40.useEffect(() => { |
| 8291 |
if (hiddenUntilFoundProp && keepMountedProp === false) { |
| 8292 |
warn("The `keepMounted={false}` prop on `Collapsible.Panel` is ignored when `hiddenUntilFound` is enabled, since the panel must remain mounted while closed."); |
| 8293 |
} |
| 8294 |
}, [hiddenUntilFoundProp, keepMountedProp]); |
| 8295 |
} |
| 8296 |
const { |
| 8297 |
defaultPanelId, |
| 8298 |
mounted, |
| 8299 |
onOpenChange, |
| 8300 |
open: open3, |
| 8301 |
setMounted, |
| 8302 |
setPanelIdState, |
| 8303 |
setOpen, |
| 8304 |
state, |
| 8305 |
transitionStatus |
| 8306 |
} = useCollapsibleRootContext(); |
| 8307 |
const hiddenUntilFound = hiddenUntilFoundProp ?? false; |
| 8308 |
const keepMounted = keepMountedProp ?? false; |
| 8309 |
const registeredId = idProp || void 0; |
| 8310 |
const id = registeredId ?? defaultPanelId; |
| 8311 |
useIsoLayoutEffect(() => { |
| 8312 |
setPanelIdState((currentId) => registeredId ?? (currentId === null ? void 0 : currentId)); |
| 8313 |
return () => { |
| 8314 |
setPanelIdState((currentId) => currentId === registeredId ? null : currentId); |
| 8315 |
}; |
| 8316 |
}, [registeredId, setPanelIdState]); |
| 8317 |
const { |
| 8318 |
height, |
| 8319 |
props, |
| 8320 |
ref, |
| 8321 |
shouldPreventOpenAnimation, |
| 8322 |
shouldRender, |
| 8323 |
transitionStatus: panelTransitionStatus, |
| 8324 |
width |
| 8325 |
} = useCollapsiblePanel({ |
| 8326 |
externalRef: forwardedRef, |
| 8327 |
hiddenUntilFound, |
| 8328 |
id, |
| 8329 |
keepMounted, |
| 8330 |
mounted, |
| 8331 |
onOpenChange, |
| 8332 |
open: open3, |
| 8333 |
setMounted, |
| 8334 |
setOpen, |
| 8335 |
transitionStatus |
| 8336 |
}); |
| 8337 |
const panelState = { |
| 8338 |
...state, |
| 8339 |
transitionStatus: panelTransitionStatus |
| 8340 |
}; |
| 8341 |
const resolvedStyle = resolveStyle(style, panelState); |
| 8342 |
const element = useRenderElement("div", { |
| 8343 |
...componentProps, |
| 8344 |
style: void 0 |
| 8345 |
}, { |
| 8346 |
state: panelState, |
| 8347 |
ref, |
| 8348 |
props: [ |
| 8349 |
props, |
| 8350 |
{ |
| 8351 |
style: { |
| 8352 |
[collapsiblePanelHeight]: height === void 0 ? "auto" : `${height}px`, |
| 8353 |
[collapsiblePanelWidth]: width === void 0 ? "auto" : `${width}px` |
| 8354 |
} |
| 8355 |
}, |
| 8356 |
elementProps, |
| 8357 |
resolvedStyle ? { |
| 8358 |
style: resolvedStyle |
| 8359 |
} : void 0, |
| 8360 |
// Resolve the public `style` prop so temporary `animationName: 'none'` |
| 8361 |
// can still win after user's inline styles have been merged. |
| 8362 |
shouldPreventOpenAnimation ? { |
| 8363 |
style: { |
| 8364 |
animationName: "none" |
| 8365 |
} |
| 8366 |
} : void 0 |
| 8367 |
], |
| 8368 |
stateAttributesMapping: collapsibleStateAttributesMapping |
| 8369 |
}); |
| 8370 |
if (!shouldRender) { |
| 8371 |
return null; |
| 8372 |
} |
| 8373 |
return element; |
| 8374 |
}); |
| 8375 |
if (true) CollapsiblePanel.displayName = "CollapsiblePanel"; |
| 8376 |
|
| 8377 |
// node_modules/@base-ui/react/utils/usePopupViewport.mjs |
| 8378 |
var React44 = __toESM(require_react(), 1); |
| 8379 |
var ReactDOM6 = __toESM(require_react_dom(), 1); |
| 8380 |
|
| 8381 |
// node_modules/@base-ui/utils/usePreviousValue.mjs |
| 8382 |
var React41 = __toESM(require_react(), 1); |
| 8383 |
function usePreviousValue(value) { |
| 8384 |
const [state, setState] = React41.useState({ |
| 8385 |
current: value, |
| 8386 |
previous: null |
| 8387 |
}); |
| 8388 |
if (!Object.is(value, state.current)) { |
| 8389 |
setState({ |
| 8390 |
current: value, |
| 8391 |
previous: state.current |
| 8392 |
}); |
| 8393 |
} |
| 8394 |
return state.previous; |
| 8395 |
} |
| 8396 |
|
| 8397 |
// node_modules/@base-ui/react/utils/usePopupAutoResize.mjs |
| 8398 |
var React42 = __toESM(require_react(), 1); |
| 8399 |
|
| 8400 |
// node_modules/@base-ui/react/utils/getCssDimensions.mjs |
| 8401 |
function getCssDimensions2(element) { |
| 8402 |
const css = getComputedStyle2(element); |
| 8403 |
let width = parseFloat(css.width) || 0; |
| 8404 |
let height = parseFloat(css.height) || 0; |
| 8405 |
const hasOffset = isHTMLElement(element); |
| 8406 |
const offsetWidth = hasOffset ? element.offsetWidth : width; |
| 8407 |
const offsetHeight = hasOffset ? element.offsetHeight : height; |
| 8408 |
const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight; |
| 8409 |
if (shouldFallback) { |
| 8410 |
width = offsetWidth; |
| 8411 |
height = offsetHeight; |
| 8412 |
} |
| 8413 |
return { |
| 8414 |
width, |
| 8415 |
height |
| 8416 |
}; |
| 8417 |
} |
| 8418 |
|
| 8419 |
// node_modules/@base-ui/react/utils/CommonPopupCssVars.mjs |
| 8420 |
var popupWidth = "--popup-width"; |
| 8421 |
var popupHeight = "--popup-height"; |
| 8422 |
|
| 8423 |
// node_modules/@base-ui/react/utils/usePopupAutoResize.mjs |
| 8424 |
function usePopupAutoResize(parameters) { |
| 8425 |
const { |
| 8426 |
popupElement, |
| 8427 |
positionerElement, |
| 8428 |
content, |
| 8429 |
mounted, |
| 8430 |
onMeasureLayout: onMeasureLayoutParam, |
| 8431 |
onMeasureLayoutComplete: onMeasureLayoutCompleteParam, |
| 8432 |
side, |
| 8433 |
direction |
| 8434 |
} = parameters; |
| 8435 |
const runOnceAnimationsFinish = useAnimationsFinished(popupElement, true); |
| 8436 |
const animationFrame = useAnimationFrame(); |
| 8437 |
const committedDimensionsRef = React42.useRef(null); |
| 8438 |
const isInitialRenderRef = React42.useRef(true); |
| 8439 |
const restoreAnchoringStylesRef = React42.useRef(NOOP); |
| 8440 |
const onMeasureLayout = useStableCallback(onMeasureLayoutParam); |
| 8441 |
const onMeasureLayoutComplete = useStableCallback(onMeasureLayoutCompleteParam); |
| 8442 |
const anchoringStyles = React42.useMemo(() => getPopupAnchoringStyles(side, direction), [side, direction]); |
| 8443 |
useIsoLayoutEffect(() => { |
| 8444 |
if (!mounted) { |
| 8445 |
restoreAnchoringStylesRef.current = NOOP; |
| 8446 |
isInitialRenderRef.current = true; |
| 8447 |
committedDimensionsRef.current = null; |
| 8448 |
return void 0; |
| 8449 |
} |
| 8450 |
if (!popupElement || !positionerElement) { |
| 8451 |
return void 0; |
| 8452 |
} |
| 8453 |
restoreAnchoringStylesRef.current = applyElementStyles(popupElement, anchoringStyles); |
| 8454 |
setPopupCssSize(popupElement, "auto"); |
| 8455 |
const restorePopupPosition = overrideElementStyle(popupElement, "position", "static"); |
| 8456 |
const restorePopupTransform = overrideElementStyle(popupElement, "transform", "none"); |
| 8457 |
const restorePopupScale = overrideElementStyle(popupElement, "scale", "1"); |
| 8458 |
const restorePositionerAvailableSize = applyElementStyles(positionerElement, { |
| 8459 |
[availableWidth]: "max-content", |
| 8460 |
[availableHeight]: "max-content" |
| 8461 |
}); |
| 8462 |
function restoreMeasurementOverrides() { |
| 8463 |
restorePopupPosition(); |
| 8464 |
restorePopupTransform(); |
| 8465 |
restorePositionerAvailableSize(); |
| 8466 |
} |
| 8467 |
function restoreMeasurementOverridesIncludingScale() { |
| 8468 |
restoreMeasurementOverrides(); |
| 8469 |
restorePopupScale(); |
| 8470 |
} |
| 8471 |
onMeasureLayout?.(); |
| 8472 |
if (isInitialRenderRef.current || committedDimensionsRef.current === null) { |
| 8473 |
setPositionerCssSize(positionerElement, "max-content"); |
| 8474 |
const dimensions = getCssDimensions2(popupElement); |
| 8475 |
committedDimensionsRef.current = dimensions; |
| 8476 |
setPositionerCssSize(positionerElement, dimensions); |
| 8477 |
restoreMeasurementOverridesIncludingScale(); |
| 8478 |
onMeasureLayoutComplete?.(null, dimensions); |
| 8479 |
isInitialRenderRef.current = false; |
| 8480 |
return () => { |
| 8481 |
restoreAnchoringStylesRef.current(); |
| 8482 |
restoreAnchoringStylesRef.current = NOOP; |
| 8483 |
}; |
| 8484 |
} |
| 8485 |
setPositionerCssSize(positionerElement, "max-content"); |
| 8486 |
const previousDimensions = committedDimensionsRef.current; |
| 8487 |
const newDimensions = getCssDimensions2(popupElement); |
| 8488 |
committedDimensionsRef.current = newDimensions; |
| 8489 |
setPopupCssSize(popupElement, previousDimensions); |
| 8490 |
restoreMeasurementOverridesIncludingScale(); |
| 8491 |
onMeasureLayoutComplete?.(previousDimensions, newDimensions); |
| 8492 |
setPositionerCssSize(positionerElement, newDimensions); |
| 8493 |
const abortController = new AbortController(); |
| 8494 |
animationFrame.request(() => { |
| 8495 |
setPopupCssSize(popupElement, newDimensions); |
| 8496 |
runOnceAnimationsFinish(() => { |
| 8497 |
popupElement.style.setProperty(popupWidth, "auto"); |
| 8498 |
popupElement.style.setProperty(popupHeight, "auto"); |
| 8499 |
}, abortController.signal); |
| 8500 |
}); |
| 8501 |
return () => { |
| 8502 |
abortController.abort(); |
| 8503 |
animationFrame.cancel(); |
| 8504 |
restoreAnchoringStylesRef.current(); |
| 8505 |
restoreAnchoringStylesRef.current = NOOP; |
| 8506 |
}; |
| 8507 |
}, [content, popupElement, positionerElement, runOnceAnimationsFinish, animationFrame, mounted, onMeasureLayout, onMeasureLayoutComplete, anchoringStyles]); |
| 8508 |
} |
| 8509 |
function getPopupAnchoringStyles(side, direction) { |
| 8510 |
const isPhysicalTop = side === "top"; |
| 8511 |
const isPhysicalLeft = side === "left" || side === (direction === "rtl" ? "inline-end" : "inline-start"); |
| 8512 |
if (!isPhysicalTop && !isPhysicalLeft) { |
| 8513 |
return EMPTY_OBJECT; |
| 8514 |
} |
| 8515 |
return { |
| 8516 |
position: "absolute", |
| 8517 |
[isPhysicalTop ? "bottom" : "top"]: "0", |
| 8518 |
[isPhysicalLeft ? "right" : "left"]: "0" |
| 8519 |
}; |
| 8520 |
} |
| 8521 |
function overrideElementStyle(element, property, value) { |
| 8522 |
const originalValue = element.style.getPropertyValue(property); |
| 8523 |
element.style.setProperty(property, value); |
| 8524 |
return () => { |
| 8525 |
element.style.setProperty(property, originalValue); |
| 8526 |
}; |
| 8527 |
} |
| 8528 |
function applyElementStyles(element, styles) { |
| 8529 |
const restorers = []; |
| 8530 |
for (const [key, value] of Object.entries(styles)) { |
| 8531 |
restorers.push(overrideElementStyle(element, key, value)); |
| 8532 |
} |
| 8533 |
return restorers.length ? () => { |
| 8534 |
restorers.forEach((restore) => restore()); |
| 8535 |
} : NOOP; |
| 8536 |
} |
| 8537 |
function setPopupCssSize(popupElement, size4) { |
| 8538 |
const width = size4 === "auto" ? "auto" : `${size4.width}px`; |
| 8539 |
const height = size4 === "auto" ? "auto" : `${size4.height}px`; |
| 8540 |
popupElement.style.setProperty(popupWidth, width); |
| 8541 |
popupElement.style.setProperty(popupHeight, height); |
| 8542 |
} |
| 8543 |
function setPositionerCssSize(positionerElement, size4) { |
| 8544 |
const width = size4 === "max-content" ? "max-content" : `${size4.width}px`; |
| 8545 |
const height = size4 === "max-content" ? "max-content" : `${size4.height}px`; |
| 8546 |
positionerElement.style.setProperty(positionerWidth, width); |
| 8547 |
positionerElement.style.setProperty(positionerHeight, height); |
| 8548 |
} |
| 8549 |
|
| 8550 |
// node_modules/@base-ui/react/direction-provider/DirectionProvider.mjs |
| 8551 |
var React43 = __toESM(require_react(), 1); |
| 8552 |
var import_jsx_runtime6 = __toESM(require_jsx_runtime(), 1); |
| 8553 |
var DirectionProvider = function DirectionProvider2(props) { |
| 8554 |
const { |
| 8555 |
direction = "ltr" |
| 8556 |
} = props; |
| 8557 |
const contextValue = React43.useMemo(() => ({ |
| 8558 |
direction |
| 8559 |
}), [direction]); |
| 8560 |
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(DirectionContext.Provider, { |
| 8561 |
value: contextValue, |
| 8562 |
children: props.children |
| 8563 |
}); |
| 8564 |
}; |
| 8565 |
if (true) DirectionProvider.displayName = "DirectionProvider"; |
| 8566 |
|
| 8567 |
// node_modules/@base-ui/react/utils/adaptiveOriginMiddleware.mjs |
| 8568 |
var adaptiveOrigin = { |
| 8569 |
name: "adaptiveOrigin", |
| 8570 |
async fn(state) { |
| 8571 |
const { |
| 8572 |
x: rawX, |
| 8573 |
y: rawY, |
| 8574 |
rects: { |
| 8575 |
floating: floatRect |
| 8576 |
}, |
| 8577 |
elements: { |
| 8578 |
floating |
| 8579 |
}, |
| 8580 |
platform: platform3, |
| 8581 |
strategy, |
| 8582 |
placement |
| 8583 |
} = state; |
| 8584 |
const win = getWindow(floating); |
| 8585 |
const styles = win.getComputedStyle(floating); |
| 8586 |
const hasTransition = styles.transitionDuration !== "0s" && styles.transitionDuration !== ""; |
| 8587 |
if (!hasTransition) { |
| 8588 |
return { |
| 8589 |
x: rawX, |
| 8590 |
y: rawY, |
| 8591 |
data: DEFAULT_SIDES |
| 8592 |
}; |
| 8593 |
} |
| 8594 |
const offsetParent = await platform3.getOffsetParent?.(floating); |
| 8595 |
let offsetDimensions = { |
| 8596 |
width: 0, |
| 8597 |
height: 0 |
| 8598 |
}; |
| 8599 |
if (strategy === "fixed" && win?.visualViewport) { |
| 8600 |
offsetDimensions = { |
| 8601 |
width: win.visualViewport.width, |
| 8602 |
height: win.visualViewport.height |
| 8603 |
}; |
| 8604 |
} else if (offsetParent === win) { |
| 8605 |
const doc = ownerDocument(floating); |
| 8606 |
offsetDimensions = { |
| 8607 |
width: doc.documentElement.clientWidth, |
| 8608 |
height: doc.documentElement.clientHeight |
| 8609 |
}; |
| 8610 |
} else if (await platform3.isElement?.(offsetParent)) { |
| 8611 |
offsetDimensions = await platform3.getDimensions(offsetParent); |
| 8612 |
} |
| 8613 |
const currentSide = getSide(placement); |
| 8614 |
let x = rawX; |
| 8615 |
let y = rawY; |
| 8616 |
if (currentSide === "left") { |
| 8617 |
x = offsetDimensions.width - (rawX + floatRect.width); |
| 8618 |
} |
| 8619 |
if (currentSide === "top") { |
| 8620 |
y = offsetDimensions.height - (rawY + floatRect.height); |
| 8621 |
} |
| 8622 |
const sideX = currentSide === "left" ? "right" : DEFAULT_SIDES.sideX; |
| 8623 |
const sideY = currentSide === "top" ? "bottom" : DEFAULT_SIDES.sideY; |
| 8624 |
return { |
| 8625 |
x, |
| 8626 |
y, |
| 8627 |
data: { |
| 8628 |
sideX, |
| 8629 |
sideY |
| 8630 |
} |
| 8631 |
}; |
| 8632 |
} |
| 8633 |
}; |
| 8634 |
|
| 8635 |
// node_modules/@base-ui/react/utils/CommonViewportDataAttributes.mjs |
| 8636 |
var activationDirection = "data-activation-direction"; |
| 8637 |
|
| 8638 |
// node_modules/@base-ui/react/utils/usePopupViewport.mjs |
| 8639 |
var import_jsx_runtime7 = __toESM(require_jsx_runtime(), 1); |
| 8640 |
var popupViewportStateMapping = { |
| 8641 |
activationDirection: (value) => value ? { |
| 8642 |
[activationDirection]: value |
| 8643 |
} : null |
| 8644 |
}; |
| 8645 |
function usePopupViewport(parameters) { |
| 8646 |
const { |
| 8647 |
store: store2, |
| 8648 |
side, |
| 8649 |
children |
| 8650 |
} = parameters; |
| 8651 |
const direction = useDirection(); |
| 8652 |
const activeTrigger = store2.useState("activeTriggerElement"); |
| 8653 |
const activeTriggerId = store2.useState("activeTriggerId"); |
| 8654 |
const open3 = store2.useState("open"); |
| 8655 |
const payload = store2.useState("payload"); |
| 8656 |
const mounted = store2.useState("mounted"); |
| 8657 |
const popupElement = store2.useState("popupElement"); |
| 8658 |
const positionerElement = store2.useState("positionerElement"); |
| 8659 |
const previousActiveTrigger = usePreviousValue(open3 ? activeTrigger : null); |
| 8660 |
const currentContentKey = usePopupContentKey(activeTriggerId, payload); |
| 8661 |
const capturedNodeRef = React44.useRef(null); |
| 8662 |
const [previousContentNode, setPreviousContentNode] = React44.useState(null); |
| 8663 |
const [newTriggerOffset, setNewTriggerOffset] = React44.useState(null); |
| 8664 |
const currentContainerRef = React44.useRef(null); |
| 8665 |
const previousContainerRef = React44.useRef(null); |
| 8666 |
const onAnimationsFinished = useAnimationsFinished(currentContainerRef, true); |
| 8667 |
const cleanupFrame = useAnimationFrame(); |
| 8668 |
const cleanupControllerRef = React44.useRef(null); |
| 8669 |
const [previousContentDimensions, setPreviousContentDimensions] = React44.useState(null); |
| 8670 |
const [showStartingStyleAttribute, setShowStartingStyleAttribute] = React44.useState(false); |
| 8671 |
useIsoLayoutEffect(() => { |
| 8672 |
store2.set("adaptiveOrigin", adaptiveOrigin); |
| 8673 |
return () => { |
| 8674 |
store2.set("adaptiveOrigin", void 0); |
| 8675 |
}; |
| 8676 |
}, [store2]); |
| 8677 |
const handleMeasureLayout = useStableCallback(() => { |
| 8678 |
currentContainerRef.current?.style.setProperty("animation", "none"); |
| 8679 |
currentContainerRef.current?.style.setProperty("transition", "none"); |
| 8680 |
previousContainerRef.current?.style.setProperty("display", "none"); |
| 8681 |
}); |
| 8682 |
const handleMeasureLayoutComplete = useStableCallback((previousDimensions) => { |
| 8683 |
currentContainerRef.current?.style.removeProperty("animation"); |
| 8684 |
currentContainerRef.current?.style.removeProperty("transition"); |
| 8685 |
previousContainerRef.current?.style.removeProperty("display"); |
| 8686 |
if (previousDimensions) { |
| 8687 |
setPreviousContentDimensions(previousDimensions); |
| 8688 |
} |
| 8689 |
}); |
| 8690 |
const armViewportCleanup = useStableCallback(() => { |
| 8691 |
cleanupControllerRef.current?.abort(); |
| 8692 |
const controller = new AbortController(); |
| 8693 |
cleanupControllerRef.current = controller; |
| 8694 |
onAnimationsFinished(() => { |
| 8695 |
setPreviousContentNode(null); |
| 8696 |
setPreviousContentDimensions(null); |
| 8697 |
capturedNodeRef.current = null; |
| 8698 |
}, controller.signal); |
| 8699 |
}); |
| 8700 |
const lastHandledTriggerRef = React44.useRef(null); |
| 8701 |
useIsoLayoutEffect(() => { |
| 8702 |
if (!open3 || !mounted) { |
| 8703 |
lastHandledTriggerRef.current = null; |
| 8704 |
} |
| 8705 |
}, [open3, mounted]); |
| 8706 |
useIsoLayoutEffect(() => { |
| 8707 |
if (activeTrigger && previousActiveTrigger && activeTrigger !== previousActiveTrigger && lastHandledTriggerRef.current !== activeTrigger && capturedNodeRef.current) { |
| 8708 |
setPreviousContentNode(capturedNodeRef.current); |
| 8709 |
setShowStartingStyleAttribute(true); |
| 8710 |
const offset4 = calculateRelativePosition(previousActiveTrigger, activeTrigger); |
| 8711 |
setNewTriggerOffset(offset4); |
| 8712 |
lastHandledTriggerRef.current = activeTrigger; |
| 8713 |
} |
| 8714 |
}, [activeTrigger, previousActiveTrigger]); |
| 8715 |
useIsoLayoutEffect(() => { |
| 8716 |
if (previousContentNode == null) { |
| 8717 |
return; |
| 8718 |
} |
| 8719 |
cleanupControllerRef.current?.abort(); |
| 8720 |
setShowStartingStyleAttribute(true); |
| 8721 |
cleanupFrame.request(() => { |
| 8722 |
ReactDOM6.flushSync(() => { |
| 8723 |
setShowStartingStyleAttribute(false); |
| 8724 |
}); |
| 8725 |
armViewportCleanup(); |
| 8726 |
}); |
| 8727 |
}, [currentContentKey, previousContentNode, armViewportCleanup, cleanupFrame]); |
| 8728 |
useIsoLayoutEffect(() => { |
| 8729 |
const source = currentContainerRef.current; |
| 8730 |
if (!source) { |
| 8731 |
return; |
| 8732 |
} |
| 8733 |
const wrapper = ownerDocument(source).createElement("div"); |
| 8734 |
for (const child of Array.from(source.childNodes)) { |
| 8735 |
wrapper.appendChild(child.cloneNode(true)); |
| 8736 |
} |
| 8737 |
capturedNodeRef.current = wrapper; |
| 8738 |
}); |
| 8739 |
const isTransitioning = previousContentNode != null; |
| 8740 |
let childrenToRender; |
| 8741 |
if (!isTransitioning) { |
| 8742 |
childrenToRender = /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { |
| 8743 |
"data-current": true, |
| 8744 |
ref: currentContainerRef, |
| 8745 |
children |
| 8746 |
}, currentContentKey); |
| 8747 |
} else { |
| 8748 |
childrenToRender = /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(React44.Fragment, { |
| 8749 |
children: [/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { |
| 8750 |
"data-previous": true, |
| 8751 |
inert: inertValue(true), |
| 8752 |
ref: previousContainerRef, |
| 8753 |
style: { |
| 8754 |
...previousContentDimensions ? { |
| 8755 |
[popupWidth]: `${previousContentDimensions.width}px`, |
| 8756 |
[popupHeight]: `${previousContentDimensions.height}px` |
| 8757 |
} : null, |
| 8758 |
position: "absolute" |
| 8759 |
}, |
| 8760 |
"data-ending-style": showStartingStyleAttribute ? void 0 : "" |
| 8761 |
}, "previous"), /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { |
| 8762 |
"data-current": true, |
| 8763 |
ref: currentContainerRef, |
| 8764 |
"data-starting-style": showStartingStyleAttribute ? "" : void 0, |
| 8765 |
children |
| 8766 |
}, currentContentKey)] |
| 8767 |
}); |
| 8768 |
} |
| 8769 |
useIsoLayoutEffect(() => { |
| 8770 |
const container = previousContainerRef.current; |
| 8771 |
if (!container || !previousContentNode) { |
| 8772 |
return; |
| 8773 |
} |
| 8774 |
container.replaceChildren(...Array.from(previousContentNode.childNodes)); |
| 8775 |
}, [previousContentNode]); |
| 8776 |
usePopupAutoResize({ |
| 8777 |
popupElement, |
| 8778 |
positionerElement, |
| 8779 |
mounted, |
| 8780 |
content: payload, |
| 8781 |
onMeasureLayout: handleMeasureLayout, |
| 8782 |
onMeasureLayoutComplete: handleMeasureLayoutComplete, |
| 8783 |
side, |
| 8784 |
direction |
| 8785 |
}); |
| 8786 |
const state = { |
| 8787 |
activationDirection: getActivationDirection(newTriggerOffset), |
| 8788 |
transitioning: isTransitioning |
| 8789 |
}; |
| 8790 |
return { |
| 8791 |
children: childrenToRender, |
| 8792 |
state |
| 8793 |
}; |
| 8794 |
} |
| 8795 |
function getActivationDirection(offset4) { |
| 8796 |
if (!offset4) { |
| 8797 |
return void 0; |
| 8798 |
} |
| 8799 |
return `${getValueWithTolerance(offset4.horizontal, 5, "right", "left")} ${getValueWithTolerance(offset4.vertical, 5, "down", "up")}`; |
| 8800 |
} |
| 8801 |
function getValueWithTolerance(value, tolerance, positiveLabel, negativeLabel) { |
| 8802 |
if (value > tolerance) { |
| 8803 |
return positiveLabel; |
| 8804 |
} |
| 8805 |
if (value < -tolerance) { |
| 8806 |
return negativeLabel; |
| 8807 |
} |
| 8808 |
return ""; |
| 8809 |
} |
| 8810 |
function calculateRelativePosition(from, to) { |
| 8811 |
const fromRect = from.getBoundingClientRect(); |
| 8812 |
const toRect = to.getBoundingClientRect(); |
| 8813 |
const fromCenter = { |
| 8814 |
x: fromRect.left + fromRect.width / 2, |
| 8815 |
y: fromRect.top + fromRect.height / 2 |
| 8816 |
}; |
| 8817 |
const toCenter = { |
| 8818 |
x: toRect.left + toRect.width / 2, |
| 8819 |
y: toRect.top + toRect.height / 2 |
| 8820 |
}; |
| 8821 |
return { |
| 8822 |
horizontal: toCenter.x - fromCenter.x, |
| 8823 |
vertical: toCenter.y - fromCenter.y |
| 8824 |
}; |
| 8825 |
} |
| 8826 |
function usePopupContentKey(activeTriggerId, payload) { |
| 8827 |
const [contentKey, setContentKey] = React44.useState(0); |
| 8828 |
const previousActiveTriggerIdRef = React44.useRef(activeTriggerId); |
| 8829 |
const previousPayloadRef = React44.useRef(payload); |
| 8830 |
const pendingPayloadUpdateRef = React44.useRef(false); |
| 8831 |
useIsoLayoutEffect(() => { |
| 8832 |
const previousActiveTriggerId = previousActiveTriggerIdRef.current; |
| 8833 |
const previousPayload = previousPayloadRef.current; |
| 8834 |
const triggerIdChanged = activeTriggerId !== previousActiveTriggerId; |
| 8835 |
const payloadChanged = payload !== previousPayload; |
| 8836 |
if (triggerIdChanged) { |
| 8837 |
setContentKey((value) => value + 1); |
| 8838 |
pendingPayloadUpdateRef.current = !payloadChanged; |
| 8839 |
} else if (pendingPayloadUpdateRef.current && payloadChanged) { |
| 8840 |
setContentKey((value) => value + 1); |
| 8841 |
pendingPayloadUpdateRef.current = false; |
| 8842 |
} |
| 8843 |
previousActiveTriggerIdRef.current = activeTriggerId; |
| 8844 |
previousPayloadRef.current = payload; |
| 8845 |
}, [activeTriggerId, payload]); |
| 8846 |
return `${activeTriggerId ?? "current"}-${contentKey}`; |
| 8847 |
} |
| 8848 |
|
| 8849 |
// node_modules/@base-ui/react/utils/FloatingPortalLite.mjs |
| 8850 |
var React45 = __toESM(require_react(), 1); |
| 8851 |
var ReactDOM7 = __toESM(require_react_dom(), 1); |
| 8852 |
var import_jsx_runtime8 = __toESM(require_jsx_runtime(), 1); |
| 8853 |
var FloatingPortalLite = /* @__PURE__ */ React45.forwardRef(function FloatingPortalLite2(componentProps, forwardedRef) { |
| 8854 |
const { |
| 8855 |
children, |
| 8856 |
container, |
| 8857 |
className, |
| 8858 |
render, |
| 8859 |
style, |
| 8860 |
...elementProps |
| 8861 |
} = componentProps; |
| 8862 |
const { |
| 8863 |
node: portalNode, |
| 8864 |
subtree: portalSubtree |
| 8865 |
} = useFloatingPortalNode({ |
| 8866 |
container, |
| 8867 |
ref: forwardedRef, |
| 8868 |
componentProps, |
| 8869 |
elementProps |
| 8870 |
}); |
| 8871 |
if (!portalSubtree && !portalNode) { |
| 8872 |
return null; |
| 8873 |
} |
| 8874 |
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(React45.Fragment, { |
| 8875 |
children: [portalSubtree, portalNode && /* @__PURE__ */ ReactDOM7.createPortal(children, portalNode)] |
| 8876 |
}); |
| 8877 |
}); |
| 8878 |
if (true) FloatingPortalLite.displayName = "FloatingPortalLite"; |
| 8879 |
|
| 8880 |
// node_modules/@base-ui/react/tooltip/index.parts.mjs |
| 8881 |
var index_parts_exports2 = {}; |
| 8882 |
__export(index_parts_exports2, { |
| 8883 |
Arrow: () => TooltipArrow, |
| 8884 |
Handle: () => TooltipHandle, |
| 8885 |
Popup: () => TooltipPopup, |
| 8886 |
Portal: () => TooltipPortal, |
| 8887 |
Positioner: () => TooltipPositioner, |
| 8888 |
Provider: () => TooltipProvider, |
| 8889 |
Root: () => TooltipRoot, |
| 8890 |
Trigger: () => TooltipTrigger, |
| 8891 |
Viewport: () => TooltipViewport, |
| 8892 |
createHandle: () => createTooltipHandle |
| 8893 |
}); |
| 8894 |
|
| 8895 |
// node_modules/@base-ui/react/tooltip/root/TooltipRoot.mjs |
| 8896 |
var React48 = __toESM(require_react(), 1); |
| 8897 |
|
| 8898 |
// node_modules/@base-ui/react/tooltip/root/TooltipRootContext.mjs |
| 8899 |
var React46 = __toESM(require_react(), 1); |
| 8900 |
var TooltipRootContext = /* @__PURE__ */ React46.createContext(void 0); |
| 8901 |
if (true) TooltipRootContext.displayName = "TooltipRootContext"; |
| 8902 |
function useTooltipRootContext(optional) { |
| 8903 |
const context = React46.useContext(TooltipRootContext); |
| 8904 |
if (context === void 0 && !optional) { |
| 8905 |
throw new Error(true ? "Base UI: TooltipRootContext is missing. Tooltip parts must be placed within <Tooltip.Root>." : formatErrorMessage_default(72)); |
| 8906 |
} |
| 8907 |
return context; |
| 8908 |
} |
| 8909 |
|
| 8910 |
// node_modules/@base-ui/react/tooltip/store/TooltipStore.mjs |
| 8911 |
var React47 = __toESM(require_react(), 1); |
| 8912 |
var selectors2 = { |
| 8913 |
...popupStoreSelectors, |
| 8914 |
disabled: (state) => state.disabled, |
| 8915 |
instantType: (state) => state.instantType, |
| 8916 |
isInstantPhase: (state) => state.isInstantPhase, |
| 8917 |
trackCursorAxis: (state) => state.trackCursorAxis, |
| 8918 |
disableHoverablePopup: (state) => state.disableHoverablePopup, |
| 8919 |
lastOpenChangeReason: (state) => state.openChangeReason, |
| 8920 |
closeOnClick: (state) => state.closeOnClick, |
| 8921 |
closeDelay: (state) => state.closeDelay, |
| 8922 |
adaptiveOrigin: (state) => state.adaptiveOrigin |
| 8923 |
}; |
| 8924 |
var TooltipStore = class extends ReactStore { |
| 8925 |
constructor(initialState, floatingId, nested) { |
| 8926 |
const triggerElements = new PopupTriggerMap(); |
| 8927 |
super(createInitialState(initialState, triggerElements, floatingId, nested), createInitialContext(triggerElements), selectors2); |
| 8928 |
} |
| 8929 |
setOpen = (nextOpen, eventDetails) => { |
| 8930 |
applyPopupOpenChange(this, nextOpen, eventDetails, { |
| 8931 |
extraState: { |
| 8932 |
openChangeReason: eventDetails.reason |
| 8933 |
} |
| 8934 |
}); |
| 8935 |
}; |
| 8936 |
// Used by trigger clicks to clear a delayed hover open without reporting a public open-state change. |
| 8937 |
cancelPendingOpen(event) { |
| 8938 |
this.state.floatingRootContext.dispatchOpenChange(false, createChangeEventDetails(reason_parts_exports.triggerPress, event)); |
| 8939 |
} |
| 8940 |
}; |
| 8941 |
function createNullTooltipStore() { |
| 8942 |
const triggerElements = new PopupTriggerMap(); |
| 8943 |
const store2 = new NullStore(Object.freeze(createInitialState(void 0, triggerElements)), Object.freeze(createInitialContext(triggerElements)), selectors2); |
| 8944 |
return Object.assign(store2, { |
| 8945 |
setOpen: NOOP, |
| 8946 |
cancelPendingOpen: NOOP |
| 8947 |
}); |
| 8948 |
} |
| 8949 |
function createInitialState(initialState, triggerElements, floatingId, nested = false) { |
| 8950 |
const state = { |
| 8951 |
...createInitialPopupStoreState(triggerElements, floatingId, nested), |
| 8952 |
disabled: false, |
| 8953 |
instantType: void 0, |
| 8954 |
isInstantPhase: false, |
| 8955 |
trackCursorAxis: "none", |
| 8956 |
disableHoverablePopup: false, |
| 8957 |
openChangeReason: null, |
| 8958 |
closeOnClick: true, |
| 8959 |
closeDelay: 0, |
| 8960 |
adaptiveOrigin: void 0, |
| 8961 |
...initialState |
| 8962 |
}; |
| 8963 |
return state; |
| 8964 |
} |
| 8965 |
function createInitialContext(triggerElements) { |
| 8966 |
return { |
| 8967 |
popupRef: /* @__PURE__ */ React47.createRef(), |
| 8968 |
onOpenChange: void 0, |
| 8969 |
onOpenChangeComplete: void 0, |
| 8970 |
triggerElements |
| 8971 |
}; |
| 8972 |
} |
| 8973 |
|
| 8974 |
// node_modules/@base-ui/react/tooltip/root/TooltipRoot.mjs |
| 8975 |
var import_jsx_runtime9 = __toESM(require_jsx_runtime(), 1); |
| 8976 |
var TooltipRoot = fastComponent(function TooltipRoot2(props) { |
| 8977 |
const { |
| 8978 |
disabled: disabled2 = false, |
| 8979 |
defaultOpen = false, |
| 8980 |
open: openProp, |
| 8981 |
disableHoverablePopup = false, |
| 8982 |
trackCursorAxis = "none", |
| 8983 |
actionsRef, |
| 8984 |
onOpenChange, |
| 8985 |
onOpenChangeComplete, |
| 8986 |
handle, |
| 8987 |
triggerId: triggerIdProp, |
| 8988 |
defaultTriggerId: defaultTriggerIdProp = null, |
| 8989 |
children |
| 8990 |
} = props; |
| 8991 |
const store2 = usePopupRootStore((floatingId, nested) => new TooltipStore({ |
| 8992 |
open: defaultOpen, |
| 8993 |
openProp, |
| 8994 |
activeTriggerId: defaultTriggerIdProp, |
| 8995 |
triggerIdProp |
| 8996 |
}, floatingId, nested)); |
| 8997 |
store2.useControlledProp("openProp", openProp); |
| 8998 |
store2.useControlledProp("triggerIdProp", triggerIdProp); |
| 8999 |
store2.useContextCallback("onOpenChange", onOpenChange); |
| 9000 |
store2.useContextCallback("onOpenChangeComplete", onOpenChangeComplete); |
| 9001 |
const openState = store2.useState("open"); |
| 9002 |
const open3 = !disabled2 && openState; |
| 9003 |
const activeTriggerId = store2.useState("activeTriggerId"); |
| 9004 |
const mounted = store2.useState("mounted"); |
| 9005 |
const payload = store2.useState("payload"); |
| 9006 |
store2.useSyncedValues({ |
| 9007 |
trackCursorAxis, |
| 9008 |
disableHoverablePopup, |
| 9009 |
disabled: disabled2 |
| 9010 |
}); |
| 9011 |
useImplicitActiveTrigger(store2, { |
| 9012 |
closeOnActiveTriggerUnmount: true |
| 9013 |
}); |
| 9014 |
const { |
| 9015 |
forceUnmount, |
| 9016 |
transitionStatus |
| 9017 |
} = useOpenStateTransitions(open3, store2); |
| 9018 |
const isInstantPhase = store2.useState("isInstantPhase"); |
| 9019 |
const instantType = store2.useState("instantType"); |
| 9020 |
const lastOpenChangeReason = store2.useState("lastOpenChangeReason"); |
| 9021 |
const previousInstantTypeRef = React48.useRef(null); |
| 9022 |
useIsoLayoutEffect(() => { |
| 9023 |
if (openState && disabled2) { |
| 9024 |
store2.setOpen(false, createChangeEventDetails(reason_parts_exports.disabled)); |
| 9025 |
} |
| 9026 |
}, [openState, disabled2, store2]); |
| 9027 |
useIsoLayoutEffect(() => { |
| 9028 |
if (transitionStatus === "ending" && lastOpenChangeReason === reason_parts_exports.none || transitionStatus !== "ending" && isInstantPhase) { |
| 9029 |
if (instantType !== "delay") { |
| 9030 |
previousInstantTypeRef.current = instantType; |
| 9031 |
} |
| 9032 |
store2.set("instantType", "delay"); |
| 9033 |
} else if (previousInstantTypeRef.current !== null) { |
| 9034 |
store2.set("instantType", previousInstantTypeRef.current); |
| 9035 |
previousInstantTypeRef.current = null; |
| 9036 |
} |
| 9037 |
}, [transitionStatus, isInstantPhase, lastOpenChangeReason, instantType, store2]); |
| 9038 |
useIsoLayoutEffect(() => { |
| 9039 |
if (open3) { |
| 9040 |
if (activeTriggerId == null) { |
| 9041 |
store2.set("payload", void 0); |
| 9042 |
} |
| 9043 |
} |
| 9044 |
}, [store2, activeTriggerId, open3]); |
| 9045 |
React48.useImperativeHandle(actionsRef, () => ({ |
| 9046 |
unmount: forceUnmount, |
| 9047 |
close: () => store2.setOpen(false, createChangeEventDetails(reason_parts_exports.imperativeAction)) |
| 9048 |
}), [forceUnmount, store2]); |
| 9049 |
const shouldRenderInteractions = open3 || mounted || !disabled2 && trackCursorAxis !== "none"; |
| 9050 |
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(TooltipRootContext.Provider, { |
| 9051 |
value: store2, |
| 9052 |
children: [handle && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(PopupHandleAttachment, { |
| 9053 |
handle, |
| 9054 |
store: store2 |
| 9055 |
}), shouldRenderInteractions && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(TooltipInteractions, { |
| 9056 |
store: store2, |
| 9057 |
disabled: disabled2, |
| 9058 |
trackCursorAxis |
| 9059 |
}), typeof children === "function" ? children({ |
| 9060 |
payload |
| 9061 |
}) : children] |
| 9062 |
}); |
| 9063 |
}); |
| 9064 |
if (true) TooltipRoot.displayName = "TooltipRoot"; |
| 9065 |
function TooltipInteractions({ |
| 9066 |
store: store2, |
| 9067 |
disabled: disabled2, |
| 9068 |
trackCursorAxis |
| 9069 |
}) { |
| 9070 |
const floatingRootContext = store2.useState("floatingRootContext"); |
| 9071 |
const dismiss = useDismiss(floatingRootContext, { |
| 9072 |
enabled: !disabled2, |
| 9073 |
referencePress: () => store2.select("closeOnClick") |
| 9074 |
}); |
| 9075 |
const clientPoint = useClientPoint(floatingRootContext, { |
| 9076 |
enabled: !disabled2 && trackCursorAxis !== "none", |
| 9077 |
axis: trackCursorAxis === "none" ? void 0 : trackCursorAxis |
| 9078 |
}); |
| 9079 |
const triggerProps = React48.useMemo(() => mergeProps(clientPoint.reference, dismiss.reference), [clientPoint.reference, dismiss.reference]); |
| 9080 |
usePopupInteractionProps(store2, { |
| 9081 |
activeTriggerProps: triggerProps, |
| 9082 |
inactiveTriggerProps: triggerProps, |
| 9083 |
popupProps: dismiss.floating ?? EMPTY_OBJECT |
| 9084 |
}); |
| 9085 |
return null; |
| 9086 |
} |
| 9087 |
|
| 9088 |
// node_modules/@base-ui/react/tooltip/trigger/TooltipTrigger.mjs |
| 9089 |
var React50 = __toESM(require_react(), 1); |
| 9090 |
|
| 9091 |
// node_modules/@base-ui/react/tooltip/provider/TooltipProviderContext.mjs |
| 9092 |
var React49 = __toESM(require_react(), 1); |
| 9093 |
var TooltipProviderContext = /* @__PURE__ */ React49.createContext(void 0); |
| 9094 |
if (true) TooltipProviderContext.displayName = "TooltipProviderContext"; |
| 9095 |
function useTooltipProviderContext() { |
| 9096 |
return React49.useContext(TooltipProviderContext); |
| 9097 |
} |
| 9098 |
|
| 9099 |
// node_modules/@base-ui/react/tooltip/utils/constants.mjs |
| 9100 |
var OPEN_DELAY = 600; |
| 9101 |
|
| 9102 |
// node_modules/@base-ui/react/tooltip/trigger/TooltipTrigger.mjs |
| 9103 |
var TOOLTIP_TRIGGER_IDENTIFIER = "data-base-ui-tooltip-trigger"; |
| 9104 |
function getTargetElement(event) { |
| 9105 |
if ("composedPath" in event) { |
| 9106 |
const path = event.composedPath(); |
| 9107 |
for (let i = 0; i < path.length; i += 1) { |
| 9108 |
const element = path[i]; |
| 9109 |
if (isElement(element)) { |
| 9110 |
return element; |
| 9111 |
} |
| 9112 |
} |
| 9113 |
} |
| 9114 |
const target = event.target; |
| 9115 |
if (isElement(target)) { |
| 9116 |
return target; |
| 9117 |
} |
| 9118 |
return null; |
| 9119 |
} |
| 9120 |
function closestEnabledTooltipTrigger(element) { |
| 9121 |
let current = element; |
| 9122 |
while (current) { |
| 9123 |
const trigger = current.closest(`[${TOOLTIP_TRIGGER_IDENTIFIER}]`); |
| 9124 |
if (trigger) { |
| 9125 |
return trigger; |
| 9126 |
} |
| 9127 |
const root = current.getRootNode(); |
| 9128 |
current = "host" in root && isElement(root.host) ? root.host : null; |
| 9129 |
} |
| 9130 |
return null; |
| 9131 |
} |
| 9132 |
var TooltipTrigger = fastComponentRef(function TooltipTrigger2(componentProps, forwardedRef) { |
| 9133 |
const { |
| 9134 |
render, |
| 9135 |
className, |
| 9136 |
style, |
| 9137 |
handle, |
| 9138 |
payload, |
| 9139 |
disabled: disabledProp, |
| 9140 |
delay, |
| 9141 |
closeOnClick = true, |
| 9142 |
closeDelay, |
| 9143 |
id: idProp, |
| 9144 |
...elementProps |
| 9145 |
} = componentProps; |
| 9146 |
const rootContext = useTooltipRootContext(true); |
| 9147 |
const handleStore = usePopupHandleStore(handle); |
| 9148 |
const store2 = handleStore ?? rootContext; |
| 9149 |
if (!store2) { |
| 9150 |
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)); |
| 9151 |
} |
| 9152 |
const thisTriggerId = useBaseUiId(idProp); |
| 9153 |
const isTriggerActive = store2.useState("isTriggerActive", thisTriggerId); |
| 9154 |
const isOpenedByThisTrigger = store2.useState("isOpenedByTrigger", thisTriggerId); |
| 9155 |
const floatingRootContext = store2.useState("floatingRootContext"); |
| 9156 |
const triggerElementRef = React50.useRef(null); |
| 9157 |
const closeDelayWithDefault = closeDelay ?? 0; |
| 9158 |
const { |
| 9159 |
registerTrigger, |
| 9160 |
isMountedByThisTrigger |
| 9161 |
} = useTriggerDataForwarding(thisTriggerId, triggerElementRef, store2, { |
| 9162 |
payload, |
| 9163 |
closeOnClick, |
| 9164 |
closeDelay: closeDelayWithDefault |
| 9165 |
}); |
| 9166 |
const providerDelay = useTooltipProviderContext(); |
| 9167 |
const { |
| 9168 |
activeIdRef, |
| 9169 |
delayRef, |
| 9170 |
isInstantPhase, |
| 9171 |
hasProvider |
| 9172 |
} = useDelayGroup(floatingRootContext, { |
| 9173 |
open: isOpenedByThisTrigger |
| 9174 |
}); |
| 9175 |
const hoverInteraction = useHoverInteractionSharedState(floatingRootContext); |
| 9176 |
store2.useSyncedValue("isInstantPhase", isInstantPhase); |
| 9177 |
const rootDisabled = store2.useState("disabled"); |
| 9178 |
const disabled2 = disabledProp ?? rootDisabled; |
| 9179 |
const disabledRef = useValueAsRef(disabled2); |
| 9180 |
const trackCursorAxis = store2.useState("trackCursorAxis"); |
| 9181 |
const disableHoverablePopup = store2.useState("disableHoverablePopup"); |
| 9182 |
const isNestedTriggerHoveredRef = React50.useRef(false); |
| 9183 |
const nestedTriggerOpenTimeout = useTimeout(); |
| 9184 |
const pointerTypeRef = React50.useRef(void 0); |
| 9185 |
function getOpenDelay() { |
| 9186 |
if (hasProvider && activeIdRef.current != null) { |
| 9187 |
return 0; |
| 9188 |
} |
| 9189 |
return delay ?? providerDelay ?? OPEN_DELAY; |
| 9190 |
} |
| 9191 |
function isEnabledNestedTriggerTarget(target) { |
| 9192 |
const triggerEl = triggerElementRef.current; |
| 9193 |
if (!triggerEl || !target) { |
| 9194 |
return false; |
| 9195 |
} |
| 9196 |
const nearestTrigger = closestEnabledTooltipTrigger(target); |
| 9197 |
return nearestTrigger !== null && nearestTrigger !== triggerEl && contains(triggerEl, nearestTrigger); |
| 9198 |
} |
| 9199 |
function detectNestedTriggerHover(target) { |
| 9200 |
const nestedTriggerHovered = isEnabledNestedTriggerTarget(target); |
| 9201 |
isNestedTriggerHoveredRef.current = nestedTriggerHovered; |
| 9202 |
if (nestedTriggerHovered) { |
| 9203 |
hoverInteraction.openChangeTimeout.clear(); |
| 9204 |
hoverInteraction.restTimeout.clear(); |
| 9205 |
hoverInteraction.restTimeoutPending = false; |
| 9206 |
nestedTriggerOpenTimeout.clear(); |
| 9207 |
} |
| 9208 |
return nestedTriggerHovered; |
| 9209 |
} |
| 9210 |
const hoverProps = useHoverReferenceInteraction(floatingRootContext, { |
| 9211 |
enabled: !disabled2, |
| 9212 |
mouseOnly: true, |
| 9213 |
move: false, |
| 9214 |
handleClose: !disableHoverablePopup && trackCursorAxis !== "both" ? safePolygon() : null, |
| 9215 |
restMs: getOpenDelay, |
| 9216 |
delay() { |
| 9217 |
if (closeDelay == null && hasProvider) { |
| 9218 |
return { |
| 9219 |
close: getDelay(delayRef.current, "close") |
| 9220 |
}; |
| 9221 |
} |
| 9222 |
return { |
| 9223 |
close: closeDelayWithDefault |
| 9224 |
}; |
| 9225 |
}, |
| 9226 |
triggerElementRef, |
| 9227 |
isActiveTrigger: isTriggerActive, |
| 9228 |
isClosing: () => store2.select("transitionStatus") === "ending", |
| 9229 |
shouldOpen() { |
| 9230 |
return !isNestedTriggerHoveredRef.current; |
| 9231 |
} |
| 9232 |
}); |
| 9233 |
const focusProps = useFocus(floatingRootContext, { |
| 9234 |
enabled: !disabled2 |
| 9235 |
}).reference; |
| 9236 |
const handleNestedTriggerHover = (event) => { |
| 9237 |
const wasNestedTriggerHovered = isNestedTriggerHoveredRef.current; |
| 9238 |
const target = getTargetElement(event); |
| 9239 |
const nestedTriggerHovered = detectNestedTriggerHover(target); |
| 9240 |
const triggerEl = triggerElementRef.current; |
| 9241 |
const targetInsideTrigger = triggerEl && target && contains(triggerEl, target); |
| 9242 |
if (nestedTriggerHovered && store2.select("open") && store2.select("lastOpenChangeReason") === reason_parts_exports.triggerHover) { |
| 9243 |
store2.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerHover, event)); |
| 9244 |
return; |
| 9245 |
} |
| 9246 |
if (wasNestedTriggerHovered && !nestedTriggerHovered && targetInsideTrigger && !disabledRef.current && !store2.select("open") && triggerEl && // Match the hover hook's non-strict mouse fallback for mouse-only event sequences. |
| 9247 |
isMouseLikePointerType(pointerTypeRef.current)) { |
| 9248 |
const open3 = () => { |
| 9249 |
if (!isNestedTriggerHoveredRef.current && !disabledRef.current && !store2.select("open")) { |
| 9250 |
store2.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerHover, event, triggerEl)); |
| 9251 |
} |
| 9252 |
}; |
| 9253 |
const openDelay = getOpenDelay(); |
| 9254 |
if (openDelay === 0) { |
| 9255 |
nestedTriggerOpenTimeout.clear(); |
| 9256 |
open3(); |
| 9257 |
} else { |
| 9258 |
nestedTriggerOpenTimeout.start(openDelay, open3); |
| 9259 |
} |
| 9260 |
} |
| 9261 |
}; |
| 9262 |
const rootTriggerProps = store2.useState("triggerProps", isMountedByThisTrigger); |
| 9263 |
const shouldApplyRootTriggerProps = isMountedByThisTrigger || trackCursorAxis !== "none"; |
| 9264 |
const state = { |
| 9265 |
open: isOpenedByThisTrigger |
| 9266 |
}; |
| 9267 |
const element = useRenderElement("button", componentProps, { |
| 9268 |
state, |
| 9269 |
ref: [forwardedRef, registerTrigger, triggerElementRef], |
| 9270 |
props: [hoverProps, focusProps, shouldApplyRootTriggerProps ? rootTriggerProps : void 0, { |
| 9271 |
onMouseOver(event) { |
| 9272 |
handleNestedTriggerHover(event.nativeEvent); |
| 9273 |
}, |
| 9274 |
onFocus(event) { |
| 9275 |
if (isEnabledNestedTriggerTarget(getTargetElement(event.nativeEvent))) { |
| 9276 |
event.preventBaseUIHandler(); |
| 9277 |
} |
| 9278 |
}, |
| 9279 |
onMouseLeave() { |
| 9280 |
isNestedTriggerHoveredRef.current = false; |
| 9281 |
nestedTriggerOpenTimeout.clear(); |
| 9282 |
pointerTypeRef.current = void 0; |
| 9283 |
}, |
| 9284 |
onPointerEnter(event) { |
| 9285 |
pointerTypeRef.current = event.pointerType; |
| 9286 |
}, |
| 9287 |
onPointerDown(event) { |
| 9288 |
pointerTypeRef.current = event.pointerType; |
| 9289 |
store2.set("closeOnClick", closeOnClick); |
| 9290 |
if (closeOnClick && !store2.select("open")) { |
| 9291 |
store2.cancelPendingOpen(event.nativeEvent); |
| 9292 |
} |
| 9293 |
}, |
| 9294 |
onClick(event) { |
| 9295 |
if (closeOnClick && !store2.select("open")) { |
| 9296 |
store2.cancelPendingOpen(event.nativeEvent); |
| 9297 |
} |
| 9298 |
}, |
| 9299 |
id: thisTriggerId, |
| 9300 |
[triggerDisabled]: disabled2 ? "" : void 0, |
| 9301 |
[TOOLTIP_TRIGGER_IDENTIFIER]: disabled2 ? void 0 : "" |
| 9302 |
}, elementProps], |
| 9303 |
stateAttributesMapping: triggerOpenStateMapping2 |
| 9304 |
}); |
| 9305 |
return element; |
| 9306 |
}); |
| 9307 |
if (true) TooltipTrigger.displayName = "TooltipTrigger"; |
| 9308 |
|
| 9309 |
// node_modules/@base-ui/react/tooltip/portal/TooltipPortal.mjs |
| 9310 |
var React52 = __toESM(require_react(), 1); |
| 9311 |
|
| 9312 |
// node_modules/@base-ui/react/tooltip/portal/TooltipPortalContext.mjs |
| 9313 |
var React51 = __toESM(require_react(), 1); |
| 9314 |
var TooltipPortalContext = /* @__PURE__ */ React51.createContext(void 0); |
| 9315 |
if (true) TooltipPortalContext.displayName = "TooltipPortalContext"; |
| 9316 |
function useTooltipPortalContext() { |
| 9317 |
const value = React51.useContext(TooltipPortalContext); |
| 9318 |
if (value === void 0) { |
| 9319 |
throw new Error(true ? "Base UI: <Tooltip.Portal> is missing." : formatErrorMessage_default(70)); |
| 9320 |
} |
| 9321 |
return value; |
| 9322 |
} |
| 9323 |
|
| 9324 |
// node_modules/@base-ui/react/tooltip/portal/TooltipPortal.mjs |
| 9325 |
var import_jsx_runtime10 = __toESM(require_jsx_runtime(), 1); |
| 9326 |
var TooltipPortal = /* @__PURE__ */ React52.forwardRef(function TooltipPortal2(props, forwardedRef) { |
| 9327 |
const { |
| 9328 |
keepMounted = false, |
| 9329 |
...portalProps |
| 9330 |
} = props; |
| 9331 |
const store2 = useTooltipRootContext(); |
| 9332 |
const mounted = store2.useState("mounted"); |
| 9333 |
const shouldRender = mounted || keepMounted; |
| 9334 |
if (!shouldRender) { |
| 9335 |
return null; |
| 9336 |
} |
| 9337 |
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(TooltipPortalContext.Provider, { |
| 9338 |
value: keepMounted, |
| 9339 |
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(FloatingPortalLite, { |
| 9340 |
ref: forwardedRef, |
| 9341 |
...portalProps |
| 9342 |
}) |
| 9343 |
}); |
| 9344 |
}); |
| 9345 |
if (true) TooltipPortal.displayName = "TooltipPortal"; |
| 9346 |
|
| 9347 |
// node_modules/@base-ui/react/tooltip/positioner/TooltipPositioner.mjs |
| 9348 |
var React54 = __toESM(require_react(), 1); |
| 9349 |
|
| 9350 |
// node_modules/@base-ui/react/tooltip/positioner/TooltipPositionerContext.mjs |
| 9351 |
var React53 = __toESM(require_react(), 1); |
| 9352 |
var TooltipPositionerContext = /* @__PURE__ */ React53.createContext(void 0); |
| 9353 |
if (true) TooltipPositionerContext.displayName = "TooltipPositionerContext"; |
| 9354 |
function useTooltipPositionerContext() { |
| 9355 |
const context = React53.useContext(TooltipPositionerContext); |
| 9356 |
if (context === void 0) { |
| 9357 |
throw new Error(true ? "Base UI: TooltipPositionerContext is missing. TooltipPositioner parts must be placed within <Tooltip.Positioner>." : formatErrorMessage_default(71)); |
| 9358 |
} |
| 9359 |
return context; |
| 9360 |
} |
| 9361 |
|
| 9362 |
// node_modules/@base-ui/react/tooltip/positioner/TooltipPositioner.mjs |
| 9363 |
var import_jsx_runtime11 = __toESM(require_jsx_runtime(), 1); |
| 9364 |
var TooltipPositioner = /* @__PURE__ */ React54.forwardRef(function TooltipPositioner2(componentProps, forwardedRef) { |
| 9365 |
const { |
| 9366 |
render, |
| 9367 |
className, |
| 9368 |
anchor, |
| 9369 |
positionMethod = "absolute", |
| 9370 |
side = "top", |
| 9371 |
align = "center", |
| 9372 |
sideOffset = 0, |
| 9373 |
alignOffset = 0, |
| 9374 |
collisionBoundary = "clipping-ancestors", |
| 9375 |
collisionPadding = 5, |
| 9376 |
arrowPadding = 5, |
| 9377 |
sticky = false, |
| 9378 |
disableAnchorTracking = false, |
| 9379 |
collisionAvoidance = POPUP_COLLISION_AVOIDANCE, |
| 9380 |
style, |
| 9381 |
...elementProps |
| 9382 |
} = componentProps; |
| 9383 |
const store2 = useTooltipRootContext(); |
| 9384 |
const keepMounted = useTooltipPortalContext(); |
| 9385 |
const open3 = store2.useState("open"); |
| 9386 |
const mounted = store2.useState("mounted"); |
| 9387 |
const trackCursorAxis = store2.useState("trackCursorAxis"); |
| 9388 |
const disableHoverablePopup = store2.useState("disableHoverablePopup"); |
| 9389 |
const floatingRootContext = store2.useState("floatingRootContext"); |
| 9390 |
const instantType = store2.useState("instantType"); |
| 9391 |
const transitionStatus = store2.useState("transitionStatus"); |
| 9392 |
const adaptiveOrigin2 = store2.useState("adaptiveOrigin"); |
| 9393 |
const positioning = useAnchorPositioning({ |
| 9394 |
anchor, |
| 9395 |
positionMethod, |
| 9396 |
floatingRootContext, |
| 9397 |
mounted, |
| 9398 |
side, |
| 9399 |
sideOffset, |
| 9400 |
align, |
| 9401 |
alignOffset, |
| 9402 |
collisionBoundary, |
| 9403 |
collisionPadding, |
| 9404 |
sticky, |
| 9405 |
arrowPadding, |
| 9406 |
disableAnchorTracking, |
| 9407 |
keepMounted, |
| 9408 |
collisionAvoidance, |
| 9409 |
adaptiveOrigin: adaptiveOrigin2 |
| 9410 |
}); |
| 9411 |
const state = React54.useMemo(() => ({ |
| 9412 |
open: open3, |
| 9413 |
side: positioning.side, |
| 9414 |
align: positioning.align, |
| 9415 |
anchorHidden: positioning.anchorHidden, |
| 9416 |
instant: trackCursorAxis !== "none" ? "tracking-cursor" : instantType |
| 9417 |
}), [open3, positioning.side, positioning.align, positioning.anchorHidden, trackCursorAxis, instantType]); |
| 9418 |
const element = usePositioner(componentProps, state, { |
| 9419 |
styles: positioning.positionerStyles, |
| 9420 |
transitionStatus, |
| 9421 |
props: elementProps, |
| 9422 |
refs: [forwardedRef, store2.useStateSetter("positionerElement")], |
| 9423 |
hidden: !mounted, |
| 9424 |
inert: !open3 || trackCursorAxis === "both" || disableHoverablePopup |
| 9425 |
}); |
| 9426 |
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(TooltipPositionerContext.Provider, { |
| 9427 |
value: positioning, |
| 9428 |
children: element |
| 9429 |
}); |
| 9430 |
}); |
| 9431 |
if (true) TooltipPositioner.displayName = "TooltipPositioner"; |
| 9432 |
|
| 9433 |
// node_modules/@base-ui/react/tooltip/popup/TooltipPopup.mjs |
| 9434 |
var React55 = __toESM(require_react(), 1); |
| 9435 |
var TooltipPopup = /* @__PURE__ */ React55.forwardRef(function TooltipPopup2(componentProps, forwardedRef) { |
| 9436 |
const { |
| 9437 |
render, |
| 9438 |
className, |
| 9439 |
style, |
| 9440 |
...elementProps |
| 9441 |
} = componentProps; |
| 9442 |
const store2 = useTooltipRootContext(); |
| 9443 |
const { |
| 9444 |
side, |
| 9445 |
align |
| 9446 |
} = useTooltipPositionerContext(); |
| 9447 |
const open3 = store2.useState("open"); |
| 9448 |
const instantType = store2.useState("instantType"); |
| 9449 |
const transitionStatus = store2.useState("transitionStatus"); |
| 9450 |
const popupProps = store2.useState("popupProps"); |
| 9451 |
const floatingContext = store2.useState("floatingRootContext"); |
| 9452 |
const disabled2 = store2.useState("disabled"); |
| 9453 |
const closeDelay = store2.useState("closeDelay"); |
| 9454 |
useOpenChangeComplete({ |
| 9455 |
open: open3, |
| 9456 |
ref: store2.context.popupRef, |
| 9457 |
onComplete() { |
| 9458 |
if (open3) { |
| 9459 |
store2.context.onOpenChangeComplete?.(true); |
| 9460 |
} |
| 9461 |
} |
| 9462 |
}); |
| 9463 |
useHoverFloatingInteraction(floatingContext, { |
| 9464 |
enabled: !disabled2, |
| 9465 |
closeDelay |
| 9466 |
}); |
| 9467 |
const setPopupElement = store2.useStateSetter("popupElement"); |
| 9468 |
const state = { |
| 9469 |
open: open3, |
| 9470 |
side, |
| 9471 |
align, |
| 9472 |
instant: instantType, |
| 9473 |
transitionStatus |
| 9474 |
}; |
| 9475 |
const element = useRenderElement("div", componentProps, { |
| 9476 |
state, |
| 9477 |
ref: [forwardedRef, store2.context.popupRef, setPopupElement], |
| 9478 |
props: [FOCUSABLE_POPUP_PROPS, popupProps, getDisabledMountTransitionStyles(transitionStatus), elementProps], |
| 9479 |
stateAttributesMapping: popupTransitionStateMapping |
| 9480 |
}); |
| 9481 |
return element; |
| 9482 |
}); |
| 9483 |
if (true) TooltipPopup.displayName = "TooltipPopup"; |
| 9484 |
|
| 9485 |
// node_modules/@base-ui/react/tooltip/arrow/TooltipArrow.mjs |
| 9486 |
var React56 = __toESM(require_react(), 1); |
| 9487 |
var TooltipArrow = /* @__PURE__ */ React56.forwardRef(function TooltipArrow2(componentProps, forwardedRef) { |
| 9488 |
const { |
| 9489 |
render, |
| 9490 |
className, |
| 9491 |
style, |
| 9492 |
...elementProps |
| 9493 |
} = componentProps; |
| 9494 |
const store2 = useTooltipRootContext(); |
| 9495 |
const { |
| 9496 |
arrowRef, |
| 9497 |
side, |
| 9498 |
align, |
| 9499 |
arrowUncentered, |
| 9500 |
arrowStyles |
| 9501 |
} = useTooltipPositionerContext(); |
| 9502 |
const open3 = store2.useState("open"); |
| 9503 |
const instantType = store2.useState("instantType"); |
| 9504 |
const state = { |
| 9505 |
open: open3, |
| 9506 |
side, |
| 9507 |
align, |
| 9508 |
uncentered: arrowUncentered, |
| 9509 |
instant: instantType |
| 9510 |
}; |
| 9511 |
const element = useRenderElement("div", componentProps, { |
| 9512 |
state, |
| 9513 |
ref: [forwardedRef, arrowRef], |
| 9514 |
props: [{ |
| 9515 |
style: arrowStyles, |
| 9516 |
"aria-hidden": true |
| 9517 |
}, elementProps], |
| 9518 |
stateAttributesMapping: popupStateMapping |
| 9519 |
}); |
| 9520 |
return element; |
| 9521 |
}); |
| 9522 |
if (true) TooltipArrow.displayName = "TooltipArrow"; |
| 9523 |
|
| 9524 |
// node_modules/@base-ui/react/tooltip/provider/TooltipProvider.mjs |
| 9525 |
var React57 = __toESM(require_react(), 1); |
| 9526 |
var import_jsx_runtime12 = __toESM(require_jsx_runtime(), 1); |
| 9527 |
var TooltipProvider = function TooltipProvider2(props) { |
| 9528 |
const { |
| 9529 |
delay, |
| 9530 |
closeDelay, |
| 9531 |
timeout = 400 |
| 9532 |
} = props; |
| 9533 |
const delayValue = React57.useMemo(() => ({ |
| 9534 |
open: delay, |
| 9535 |
close: closeDelay |
| 9536 |
}), [delay, closeDelay]); |
| 9537 |
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(TooltipProviderContext.Provider, { |
| 9538 |
value: delay, |
| 9539 |
children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(FloatingDelayGroup, { |
| 9540 |
delay: delayValue, |
| 9541 |
timeoutMs: timeout, |
| 9542 |
children: props.children |
| 9543 |
}) |
| 9544 |
}); |
| 9545 |
}; |
| 9546 |
if (true) TooltipProvider.displayName = "TooltipProvider"; |
| 9547 |
|
| 9548 |
// node_modules/@base-ui/react/tooltip/viewport/TooltipViewport.mjs |
| 9549 |
var React58 = __toESM(require_react(), 1); |
| 9550 |
var TooltipViewport = /* @__PURE__ */ React58.forwardRef(function TooltipViewport2(componentProps, forwardedRef) { |
| 9551 |
const { |
| 9552 |
render, |
| 9553 |
className, |
| 9554 |
style, |
| 9555 |
children, |
| 9556 |
...elementProps |
| 9557 |
} = componentProps; |
| 9558 |
const store2 = useTooltipRootContext(); |
| 9559 |
const positioner = useTooltipPositionerContext(); |
| 9560 |
const instantType = store2.useState("instantType"); |
| 9561 |
const { |
| 9562 |
children: childrenToRender, |
| 9563 |
state: viewportState |
| 9564 |
} = usePopupViewport({ |
| 9565 |
store: store2, |
| 9566 |
side: positioner.side, |
| 9567 |
children |
| 9568 |
}); |
| 9569 |
const state = { |
| 9570 |
activationDirection: viewportState.activationDirection, |
| 9571 |
transitioning: viewportState.transitioning, |
| 9572 |
instant: instantType |
| 9573 |
}; |
| 9574 |
return useRenderElement("div", componentProps, { |
| 9575 |
state, |
| 9576 |
ref: forwardedRef, |
| 9577 |
props: [elementProps, { |
| 9578 |
children: childrenToRender |
| 9579 |
}], |
| 9580 |
stateAttributesMapping: popupViewportStateMapping |
| 9581 |
}); |
| 9582 |
}); |
| 9583 |
if (true) TooltipViewport.displayName = "TooltipViewport"; |
| 9584 |
|
| 9585 |
// node_modules/@base-ui/react/tooltip/store/TooltipHandle.mjs |
| 9586 |
var TooltipHandle = class extends BasePopupHandle { |
| 9587 |
constructor() { |
| 9588 |
super(createNullTooltipStore(), "Tooltip"); |
| 9589 |
} |
| 9590 |
/** |
| 9591 |
* Opens the tooltip and associates it with the trigger with the given id. |
| 9592 |
* |
| 9593 |
* This method should only be called in an event handler or an effect (not during rendering). |
| 9594 |
* |
| 9595 |
* @param triggerId ID of the trigger to associate with the tooltip. The trigger must be a matching |
| 9596 |
* `Tooltip.Trigger` with this handle passed as a prop. |
| 9597 |
*/ |
| 9598 |
open(triggerId) { |
| 9599 |
this.openByTrigger(triggerId); |
| 9600 |
} |
| 9601 |
/** |
| 9602 |
* Closes the tooltip. |
| 9603 |
* |
| 9604 |
* This method should only be called in an event handler or an effect (not during rendering). |
| 9605 |
*/ |
| 9606 |
close() { |
| 9607 |
this.closePopup(); |
| 9608 |
} |
| 9609 |
/** |
| 9610 |
* Whether the tooltip is currently open. Returns `false` while no root is attached to the handle. |
| 9611 |
*/ |
| 9612 |
get isOpen() { |
| 9613 |
return this.attachedStore?.select("open") ?? false; |
| 9614 |
} |
| 9615 |
}; |
| 9616 |
function createTooltipHandle() { |
| 9617 |
return new TooltipHandle(); |
| 9618 |
} |
| 9619 |
|
| 9620 |
// node_modules/@base-ui/react/use-render/useRender.mjs |
| 9621 |
function useRender(params) { |
| 9622 |
return useRenderElement(params.defaultTagName ?? "div", params, params); |
| 9623 |
} |
| 9624 |
|
| 9625 |
// packages/ui/build-module/text/text.mjs |
| 9626 |
var import_element10 = __toESM(require_element(), 1); |
| 9627 |
var STYLE_HASH_ATTRIBUTE = "data-wp-hash"; |
| 9628 |
function getRuntime() { |
| 9629 |
const globalScope = globalThis; |
| 9630 |
if (globalScope.__wpStyleRuntime) { |
| 9631 |
return globalScope.__wpStyleRuntime; |
| 9632 |
} |
| 9633 |
globalScope.__wpStyleRuntime = { |
| 9634 |
documents: /* @__PURE__ */ new Map(), |
| 9635 |
styles: /* @__PURE__ */ new Map(), |
| 9636 |
injectedStyles: /* @__PURE__ */ new WeakMap() |
| 9637 |
}; |
| 9638 |
if (typeof document !== "undefined") { |
| 9639 |
registerDocument(document); |
| 9640 |
} |
| 9641 |
return globalScope.__wpStyleRuntime; |
| 9642 |
} |
| 9643 |
function documentContainsStyleHash(targetDocument, hash) { |
| 9644 |
if (!targetDocument.head) { |
| 9645 |
return false; |
| 9646 |
} |
| 9647 |
for (const style of targetDocument.head.querySelectorAll( |
| 9648 |
`style[${STYLE_HASH_ATTRIBUTE}]` |
| 9649 |
)) { |
| 9650 |
if (style.getAttribute(STYLE_HASH_ATTRIBUTE) === hash) { |
| 9651 |
return true; |
| 9652 |
} |
| 9653 |
} |
| 9654 |
return false; |
| 9655 |
} |
| 9656 |
function injectStyle(targetDocument, hash, css) { |
| 9657 |
if (!targetDocument.head) { |
| 9658 |
return; |
| 9659 |
} |
| 9660 |
const runtime = getRuntime(); |
| 9661 |
let injectedStyles = runtime.injectedStyles.get(targetDocument); |
| 9662 |
if (!injectedStyles) { |
| 9663 |
injectedStyles = /* @__PURE__ */ new Set(); |
| 9664 |
runtime.injectedStyles.set(targetDocument, injectedStyles); |
| 9665 |
} |
| 9666 |
if (injectedStyles.has(hash)) { |
| 9667 |
return; |
| 9668 |
} |
| 9669 |
if (documentContainsStyleHash(targetDocument, hash)) { |
| 9670 |
injectedStyles.add(hash); |
| 9671 |
return; |
| 9672 |
} |
| 9673 |
const style = targetDocument.createElement("style"); |
| 9674 |
style.setAttribute(STYLE_HASH_ATTRIBUTE, hash); |
| 9675 |
style.appendChild(targetDocument.createTextNode(css)); |
| 9676 |
targetDocument.head.appendChild(style); |
| 9677 |
injectedStyles.add(hash); |
| 9678 |
} |
| 9679 |
function registerDocument(targetDocument) { |
| 9680 |
const runtime = getRuntime(); |
| 9681 |
runtime.documents.set( |
| 9682 |
targetDocument, |
| 9683 |
(runtime.documents.get(targetDocument) ?? 0) + 1 |
| 9684 |
); |
| 9685 |
for (const [hash, css] of runtime.styles) { |
| 9686 |
injectStyle(targetDocument, hash, css); |
| 9687 |
} |
| 9688 |
return () => { |
| 9689 |
const count = runtime.documents.get(targetDocument); |
| 9690 |
if (count === void 0) { |
| 9691 |
return; |
| 9692 |
} |
| 9693 |
if (count <= 1) { |
| 9694 |
runtime.documents.delete(targetDocument); |
| 9695 |
return; |
| 9696 |
} |
| 9697 |
runtime.documents.set(targetDocument, count - 1); |
| 9698 |
}; |
| 9699 |
} |
| 9700 |
function registerStyle(hash, css) { |
| 9701 |
const runtime = getRuntime(); |
| 9702 |
runtime.styles.set(hash, css); |
| 9703 |
for (const targetDocument of runtime.documents.keys()) { |
| 9704 |
injectStyle(targetDocument, hash, css); |
| 9705 |
} |
| 9706 |
} |
| 9707 |
if (typeof process === "undefined" || true) { |
| 9708 |
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)}}}'); |
| 9709 |
} |
| 9710 |
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" }; |
| 9711 |
if (typeof process === "undefined" || true) { |
| 9712 |
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)}"); |
| 9713 |
} |
| 9714 |
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" }; |
| 9715 |
var Text = (0, import_element10.forwardRef)(function Text2({ variant = "body-md", render, className, ...props }, ref) { |
| 9716 |
const element = useRender({ |
| 9717 |
render, |
| 9718 |
defaultTagName: "span", |
| 9719 |
ref, |
| 9720 |
props: mergeProps(props, { |
| 9721 |
className: clsx_default( |
| 9722 |
style_default.text, |
| 9723 |
global_css_defense_default.heading, |
| 9724 |
global_css_defense_default.p, |
| 9725 |
style_default[variant], |
| 9726 |
className |
| 9727 |
) |
| 9728 |
}) |
| 9729 |
}); |
| 9730 |
return element; |
| 9731 |
}); |
| 9732 |
|
| 9733 |
// packages/ui/build-module/tooltip/popup.mjs |
| 9734 |
var import_element14 = __toESM(require_element(), 1); |
| 9735 |
|
| 9736 |
// packages/ui/build-module/tooltip/portal.mjs |
| 9737 |
var import_element11 = __toESM(require_element(), 1); |
| 9738 |
|
| 9739 |
// packages/ui/build-module/utils/wp-compat-overlay-slot.mjs |
| 9740 |
var STYLE_HASH_ATTRIBUTE2 = "data-wp-hash"; |
| 9741 |
function getRuntime2() { |
| 9742 |
const globalScope = globalThis; |
| 9743 |
if (globalScope.__wpStyleRuntime) { |
| 9744 |
return globalScope.__wpStyleRuntime; |
| 9745 |
} |
| 9746 |
globalScope.__wpStyleRuntime = { |
| 9747 |
documents: /* @__PURE__ */ new Map(), |
| 9748 |
styles: /* @__PURE__ */ new Map(), |
| 9749 |
injectedStyles: /* @__PURE__ */ new WeakMap() |
| 9750 |
}; |
| 9751 |
if (typeof document !== "undefined") { |
| 9752 |
registerDocument2(document); |
| 9753 |
} |
| 9754 |
return globalScope.__wpStyleRuntime; |
| 9755 |
} |
| 9756 |
function documentContainsStyleHash2(targetDocument, hash) { |
| 9757 |
if (!targetDocument.head) { |
| 9758 |
return false; |
| 9759 |
} |
| 9760 |
for (const style of targetDocument.head.querySelectorAll( |
| 9761 |
`style[${STYLE_HASH_ATTRIBUTE2}]` |
| 9762 |
)) { |
| 9763 |
if (style.getAttribute(STYLE_HASH_ATTRIBUTE2) === hash) { |
| 9764 |
return true; |
| 9765 |
} |
| 9766 |
} |
| 9767 |
return false; |
| 9768 |
} |
| 9769 |
function injectStyle2(targetDocument, hash, css) { |
| 9770 |
if (!targetDocument.head) { |
| 9771 |
return; |
| 9772 |
} |
| 9773 |
const runtime = getRuntime2(); |
| 9774 |
let injectedStyles = runtime.injectedStyles.get(targetDocument); |
| 9775 |
if (!injectedStyles) { |
| 9776 |
injectedStyles = /* @__PURE__ */ new Set(); |
| 9777 |
runtime.injectedStyles.set(targetDocument, injectedStyles); |
| 9778 |
} |
| 9779 |
if (injectedStyles.has(hash)) { |
| 9780 |
return; |
| 9781 |
} |
| 9782 |
if (documentContainsStyleHash2(targetDocument, hash)) { |
| 9783 |
injectedStyles.add(hash); |
| 9784 |
return; |
| 9785 |
} |
| 9786 |
const style = targetDocument.createElement("style"); |
| 9787 |
style.setAttribute(STYLE_HASH_ATTRIBUTE2, hash); |
| 9788 |
style.appendChild(targetDocument.createTextNode(css)); |
| 9789 |
targetDocument.head.appendChild(style); |
| 9790 |
injectedStyles.add(hash); |
| 9791 |
} |
| 9792 |
function registerDocument2(targetDocument) { |
| 9793 |
const runtime = getRuntime2(); |
| 9794 |
runtime.documents.set( |
| 9795 |
targetDocument, |
| 9796 |
(runtime.documents.get(targetDocument) ?? 0) + 1 |
| 9797 |
); |
| 9798 |
for (const [hash, css] of runtime.styles) { |
| 9799 |
injectStyle2(targetDocument, hash, css); |
| 9800 |
} |
| 9801 |
return () => { |
| 9802 |
const count = runtime.documents.get(targetDocument); |
| 9803 |
if (count === void 0) { |
| 9804 |
return; |
| 9805 |
} |
| 9806 |
if (count <= 1) { |
| 9807 |
runtime.documents.delete(targetDocument); |
| 9808 |
return; |
| 9809 |
} |
| 9810 |
runtime.documents.set(targetDocument, count - 1); |
| 9811 |
}; |
| 9812 |
} |
| 9813 |
function registerStyle2(hash, css) { |
| 9814 |
const runtime = getRuntime2(); |
| 9815 |
runtime.styles.set(hash, css); |
| 9816 |
for (const targetDocument of runtime.documents.keys()) { |
| 9817 |
injectStyle2(targetDocument, hash, css); |
| 9818 |
} |
| 9819 |
} |
| 9820 |
if (typeof process === "undefined" || true) { |
| 9821 |
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}}}"); |
| 9822 |
} |
| 9823 |
var wp_compat_overlay_slot_default = { "slot": "_11fc52b637ff8a7e__slot" }; |
| 9824 |
var WP_COMPAT_OVERLAY_SLOT_ATTRIBUTE = "data-wp-compat-overlay-slot"; |
| 9825 |
function resolveOwnerDocument() { |
| 9826 |
return typeof document === "undefined" ? null : document; |
| 9827 |
} |
| 9828 |
function isInWordPressEnvironment() { |
| 9829 |
let topWp; |
| 9830 |
try { |
| 9831 |
topWp = window.top?.wp; |
| 9832 |
} catch { |
| 9833 |
} |
| 9834 |
const wp4 = topWp ?? window.wp; |
| 9835 |
return typeof wp4?.components === "object" && wp4.components !== null; |
| 9836 |
} |
| 9837 |
var cachedSlot = null; |
| 9838 |
function ensureSlotIsAccessible(element) { |
| 9839 |
element.setAttribute("aria-hidden", "false"); |
| 9840 |
return element; |
| 9841 |
} |
| 9842 |
function createSlot(ownerDocument2) { |
| 9843 |
const element = ownerDocument2.createElement("div"); |
| 9844 |
element.setAttribute(WP_COMPAT_OVERLAY_SLOT_ATTRIBUTE, ""); |
| 9845 |
if (wp_compat_overlay_slot_default.slot) { |
| 9846 |
element.classList.add(wp_compat_overlay_slot_default.slot); |
| 9847 |
} |
| 9848 |
ownerDocument2.body.appendChild(element); |
| 9849 |
return element; |
| 9850 |
} |
| 9851 |
function getWpCompatOverlaySlot() { |
| 9852 |
if (typeof window === "undefined") { |
| 9853 |
return void 0; |
| 9854 |
} |
| 9855 |
if (!isInWordPressEnvironment() && window.__wpUiCompatOverlaySlotEnabled !== true) { |
| 9856 |
return void 0; |
| 9857 |
} |
| 9858 |
const ownerDocument2 = resolveOwnerDocument(); |
| 9859 |
if (!ownerDocument2 || !ownerDocument2.body) { |
| 9860 |
return void 0; |
| 9861 |
} |
| 9862 |
if (cachedSlot && cachedSlot.ownerDocument === ownerDocument2 && cachedSlot.isConnected) { |
| 9863 |
return ensureSlotIsAccessible(cachedSlot); |
| 9864 |
} |
| 9865 |
const existing = ownerDocument2.querySelector( |
| 9866 |
`[${WP_COMPAT_OVERLAY_SLOT_ATTRIBUTE}]` |
| 9867 |
); |
| 9868 |
if (existing instanceof HTMLDivElement) { |
| 9869 |
cachedSlot = ensureSlotIsAccessible(existing); |
| 9870 |
return cachedSlot; |
| 9871 |
} |
| 9872 |
if (cachedSlot?.isConnected) { |
| 9873 |
cachedSlot.remove(); |
| 9874 |
} |
| 9875 |
cachedSlot = ensureSlotIsAccessible(createSlot(ownerDocument2)); |
| 9876 |
return cachedSlot; |
| 9877 |
} |
| 9878 |
|
| 9879 |
// packages/ui/build-module/tooltip/portal.mjs |
| 9880 |
var import_jsx_runtime13 = __toESM(require_jsx_runtime(), 1); |
| 9881 |
var Portal = (0, import_element11.forwardRef)( |
| 9882 |
function TooltipPortal3({ container, ...restProps }, ref) { |
| 9883 |
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)( |
| 9884 |
index_parts_exports2.Portal, |
| 9885 |
{ |
| 9886 |
container: container ?? getWpCompatOverlaySlot(), |
| 9887 |
...restProps, |
| 9888 |
ref |
| 9889 |
} |
| 9890 |
); |
| 9891 |
} |
| 9892 |
); |
| 9893 |
|
| 9894 |
// packages/ui/build-module/tooltip/positioner.mjs |
| 9895 |
var import_element12 = __toESM(require_element(), 1); |
| 9896 |
var import_jsx_runtime14 = __toESM(require_jsx_runtime(), 1); |
| 9897 |
var STYLE_HASH_ATTRIBUTE3 = "data-wp-hash"; |
| 9898 |
function getRuntime3() { |
| 9899 |
const globalScope = globalThis; |
| 9900 |
if (globalScope.__wpStyleRuntime) { |
| 9901 |
return globalScope.__wpStyleRuntime; |
| 9902 |
} |
| 9903 |
globalScope.__wpStyleRuntime = { |
| 9904 |
documents: /* @__PURE__ */ new Map(), |
| 9905 |
styles: /* @__PURE__ */ new Map(), |
| 9906 |
injectedStyles: /* @__PURE__ */ new WeakMap() |
| 9907 |
}; |
| 9908 |
if (typeof document !== "undefined") { |
| 9909 |
registerDocument3(document); |
| 9910 |
} |
| 9911 |
return globalScope.__wpStyleRuntime; |
| 9912 |
} |
| 9913 |
function documentContainsStyleHash3(targetDocument, hash) { |
| 9914 |
if (!targetDocument.head) { |
| 9915 |
return false; |
| 9916 |
} |
| 9917 |
for (const style of targetDocument.head.querySelectorAll( |
| 9918 |
`style[${STYLE_HASH_ATTRIBUTE3}]` |
| 9919 |
)) { |
| 9920 |
if (style.getAttribute(STYLE_HASH_ATTRIBUTE3) === hash) { |
| 9921 |
return true; |
| 9922 |
} |
| 9923 |
} |
| 9924 |
return false; |
| 9925 |
} |
| 9926 |
function injectStyle3(targetDocument, hash, css) { |
| 9927 |
if (!targetDocument.head) { |
| 9928 |
return; |
| 9929 |
} |
| 9930 |
const runtime = getRuntime3(); |
| 9931 |
let injectedStyles = runtime.injectedStyles.get(targetDocument); |
| 9932 |
if (!injectedStyles) { |
| 9933 |
injectedStyles = /* @__PURE__ */ new Set(); |
| 9934 |
runtime.injectedStyles.set(targetDocument, injectedStyles); |
| 9935 |
} |
| 9936 |
if (injectedStyles.has(hash)) { |
| 9937 |
return; |
| 9938 |
} |
| 9939 |
if (documentContainsStyleHash3(targetDocument, hash)) { |
| 9940 |
injectedStyles.add(hash); |
| 9941 |
return; |
| 9942 |
} |
| 9943 |
const style = targetDocument.createElement("style"); |
| 9944 |
style.setAttribute(STYLE_HASH_ATTRIBUTE3, hash); |
| 9945 |
style.appendChild(targetDocument.createTextNode(css)); |
| 9946 |
targetDocument.head.appendChild(style); |
| 9947 |
injectedStyles.add(hash); |
| 9948 |
} |
| 9949 |
function registerDocument3(targetDocument) { |
| 9950 |
const runtime = getRuntime3(); |
| 9951 |
runtime.documents.set( |
| 9952 |
targetDocument, |
| 9953 |
(runtime.documents.get(targetDocument) ?? 0) + 1 |
| 9954 |
); |
| 9955 |
for (const [hash, css] of runtime.styles) { |
| 9956 |
injectStyle3(targetDocument, hash, css); |
| 9957 |
} |
| 9958 |
return () => { |
| 9959 |
const count = runtime.documents.get(targetDocument); |
| 9960 |
if (count === void 0) { |
| 9961 |
return; |
| 9962 |
} |
| 9963 |
if (count <= 1) { |
| 9964 |
runtime.documents.delete(targetDocument); |
| 9965 |
return; |
| 9966 |
} |
| 9967 |
runtime.documents.set(targetDocument, count - 1); |
| 9968 |
}; |
| 9969 |
} |
| 9970 |
function registerStyle3(hash, css) { |
| 9971 |
const runtime = getRuntime3(); |
| 9972 |
runtime.styles.set(hash, css); |
| 9973 |
for (const targetDocument of runtime.documents.keys()) { |
| 9974 |
injectStyle3(targetDocument, hash, css); |
| 9975 |
} |
| 9976 |
} |
| 9977 |
if (typeof process === "undefined" || true) { |
| 9978 |
registerStyle3("10f3806643", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._336cd3e4e743482f__box-sizing{box-sizing:border-box;*,:after,:before{box-sizing:inherit}}}}"); |
| 9979 |
} |
| 9980 |
var resets_default = { "box-sizing": "_336cd3e4e743482f__box-sizing" }; |
| 9981 |
if (typeof process === "undefined" || true) { |
| 9982 |
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}}}}'); |
| 9983 |
} |
| 9984 |
var style_default2 = { "positioner": "_480b748dd3510e64__positioner", "popup": "_50096b232db7709d__popup" }; |
| 9985 |
var Positioner = (0, import_element12.forwardRef)( |
| 9986 |
function TooltipPositioner3({ align = "center", className, side = "top", sideOffset = 4, ...props }, ref) { |
| 9987 |
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)( |
| 9988 |
index_parts_exports2.Positioner, |
| 9989 |
{ |
| 9990 |
ref, |
| 9991 |
align, |
| 9992 |
side, |
| 9993 |
sideOffset, |
| 9994 |
...props, |
| 9995 |
className: clsx_default( |
| 9996 |
resets_default["box-sizing"], |
| 9997 |
style_default2.positioner, |
| 9998 |
className |
| 9999 |
) |
| 10000 |
} |
| 10001 |
); |
| 10002 |
} |
| 10003 |
); |
| 10004 |
|
| 10005 |
// packages/ui/build-module/utils/render-slot-with-children.mjs |
| 10006 |
var import_element13 = __toESM(require_element(), 1); |
| 10007 |
function renderSlotWithChildren(slot, defaultSlot, children) { |
| 10008 |
return (0, import_element13.cloneElement)(slot ?? defaultSlot, { children }); |
| 10009 |
} |
| 10010 |
|
| 10011 |
// packages/ui/build-module/utils/theme-provider.mjs |
| 10012 |
var theme = __toESM(require_theme(), 1); |
| 10013 |
|
| 10014 |
// packages/ui/build-module/lock-unlock.mjs |
| 10015 |
var import_private_apis = __toESM(require_private_apis(), 1); |
| 10016 |
var { lock, unlock } = (0, import_private_apis.__dangerousOptInToUnstableAPIsOnlyForCoreModules)( |
| 10017 |
"I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.", |
| 10018 |
"@wordpress/ui" |
| 10019 |
); |
| 10020 |
|
| 10021 |
// packages/ui/build-module/utils/theme-provider.mjs |
| 10022 |
function getThemeProvider() { |
| 10023 |
const themePackage = theme; |
| 10024 |
if (themePackage.ThemeProvider) { |
| 10025 |
return themePackage.ThemeProvider; |
| 10026 |
} |
| 10027 |
if (!themePackage.privateApis) { |
| 10028 |
throw new Error( |
| 10029 |
"@wordpress/ui: @wordpress/theme must expose `ThemeProvider` or `privateApis.ThemeProvider`." |
| 10030 |
); |
| 10031 |
} |
| 10032 |
return unlock( |
| 10033 |
themePackage.privateApis |
| 10034 |
).ThemeProvider; |
| 10035 |
} |
| 10036 |
var ThemeProvider = getThemeProvider(); |
| 10037 |
|
| 10038 |
// packages/ui/build-module/tooltip/popup.mjs |
| 10039 |
var import_jsx_runtime15 = __toESM(require_jsx_runtime(), 1); |
| 10040 |
var STYLE_HASH_ATTRIBUTE4 = "data-wp-hash"; |
| 10041 |
function getRuntime4() { |
| 10042 |
const globalScope = globalThis; |
| 10043 |
if (globalScope.__wpStyleRuntime) { |
| 10044 |
return globalScope.__wpStyleRuntime; |
| 10045 |
} |
| 10046 |
globalScope.__wpStyleRuntime = { |
| 10047 |
documents: /* @__PURE__ */ new Map(), |
| 10048 |
styles: /* @__PURE__ */ new Map(), |
| 10049 |
injectedStyles: /* @__PURE__ */ new WeakMap() |
| 10050 |
}; |
| 10051 |
if (typeof document !== "undefined") { |
| 10052 |
registerDocument4(document); |
| 10053 |
} |
| 10054 |
return globalScope.__wpStyleRuntime; |
| 10055 |
} |
| 10056 |
function documentContainsStyleHash4(targetDocument, hash) { |
| 10057 |
if (!targetDocument.head) { |
| 10058 |
return false; |
| 10059 |
} |
| 10060 |
for (const style of targetDocument.head.querySelectorAll( |
| 10061 |
`style[${STYLE_HASH_ATTRIBUTE4}]` |
| 10062 |
)) { |
| 10063 |
if (style.getAttribute(STYLE_HASH_ATTRIBUTE4) === hash) { |
| 10064 |
return true; |
| 10065 |
} |
| 10066 |
} |
| 10067 |
return false; |
| 10068 |
} |
| 10069 |
function injectStyle4(targetDocument, hash, css) { |
| 10070 |
if (!targetDocument.head) { |
| 10071 |
return; |
| 10072 |
} |
| 10073 |
const runtime = getRuntime4(); |
| 10074 |
let injectedStyles = runtime.injectedStyles.get(targetDocument); |
| 10075 |
if (!injectedStyles) { |
| 10076 |
injectedStyles = /* @__PURE__ */ new Set(); |
| 10077 |
runtime.injectedStyles.set(targetDocument, injectedStyles); |
| 10078 |
} |
| 10079 |
if (injectedStyles.has(hash)) { |
| 10080 |
return; |
| 10081 |
} |
| 10082 |
if (documentContainsStyleHash4(targetDocument, hash)) { |
| 10083 |
injectedStyles.add(hash); |
| 10084 |
return; |
| 10085 |
} |
| 10086 |
const style = targetDocument.createElement("style"); |
| 10087 |
style.setAttribute(STYLE_HASH_ATTRIBUTE4, hash); |
| 10088 |
style.appendChild(targetDocument.createTextNode(css)); |
| 10089 |
targetDocument.head.appendChild(style); |
| 10090 |
injectedStyles.add(hash); |
| 10091 |
} |
| 10092 |
function registerDocument4(targetDocument) { |
| 10093 |
const runtime = getRuntime4(); |
| 10094 |
runtime.documents.set( |
| 10095 |
targetDocument, |
| 10096 |
(runtime.documents.get(targetDocument) ?? 0) + 1 |
| 10097 |
); |
| 10098 |
for (const [hash, css] of runtime.styles) { |
| 10099 |
injectStyle4(targetDocument, hash, css); |
| 10100 |
} |
| 10101 |
return () => { |
| 10102 |
const count = runtime.documents.get(targetDocument); |
| 10103 |
if (count === void 0) { |
| 10104 |
return; |
| 10105 |
} |
| 10106 |
if (count <= 1) { |
| 10107 |
runtime.documents.delete(targetDocument); |
| 10108 |
return; |
| 10109 |
} |
| 10110 |
runtime.documents.set(targetDocument, count - 1); |
| 10111 |
}; |
| 10112 |
} |
| 10113 |
function registerStyle4(hash, css) { |
| 10114 |
const runtime = getRuntime4(); |
| 10115 |
runtime.styles.set(hash, css); |
| 10116 |
for (const targetDocument of runtime.documents.keys()) { |
| 10117 |
injectStyle4(targetDocument, hash, css); |
| 10118 |
} |
| 10119 |
} |
| 10120 |
if (typeof process === "undefined" || true) { |
| 10121 |
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}}}}'); |
| 10122 |
} |
| 10123 |
var style_default3 = { "positioner": "_480b748dd3510e64__positioner", "popup": "_50096b232db7709d__popup" }; |
| 10124 |
var POPUP_COLOR = { background: "#1e1e1e" }; |
| 10125 |
var Popup = (0, import_element14.forwardRef)(function TooltipPopup3({ portal, positioner, children, className, ...props }, ref) { |
| 10126 |
const popupContent = /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ThemeProvider, { color: POPUP_COLOR, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)( |
| 10127 |
index_parts_exports2.Popup, |
| 10128 |
{ |
| 10129 |
ref, |
| 10130 |
className: clsx_default(style_default3.popup, className), |
| 10131 |
...props, |
| 10132 |
children |
| 10133 |
} |
| 10134 |
) }); |
| 10135 |
const positionedPopup = renderSlotWithChildren( |
| 10136 |
positioner, |
| 10137 |
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Positioner, {}), |
| 10138 |
popupContent |
| 10139 |
); |
| 10140 |
return renderSlotWithChildren(portal, /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Portal, {}), positionedPopup); |
| 10141 |
}); |
| 10142 |
|
| 10143 |
// packages/ui/build-module/tooltip/trigger.mjs |
| 10144 |
var import_element15 = __toESM(require_element(), 1); |
| 10145 |
var import_jsx_runtime16 = __toESM(require_jsx_runtime(), 1); |
| 10146 |
var Trigger = (0, import_element15.forwardRef)( |
| 10147 |
function TooltipTrigger3(props, ref) { |
| 10148 |
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(index_parts_exports2.Trigger, { ref, ...props }); |
| 10149 |
} |
| 10150 |
); |
| 10151 |
|
| 10152 |
// packages/ui/build-module/utils/direction-provider.mjs |
| 10153 |
var import_i18n = __toESM(require_i18n(), 1); |
| 10154 |
var import_jsx_runtime17 = __toESM(require_jsx_runtime(), 1); |
| 10155 |
function DirectionProvider3({ children }) { |
| 10156 |
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(DirectionProvider, { direction: (0, import_i18n.isRTL)() ? "rtl" : "ltr", children }); |
| 10157 |
} |
| 10158 |
|
| 10159 |
// packages/ui/build-module/tooltip/root.mjs |
| 10160 |
var import_jsx_runtime18 = __toESM(require_jsx_runtime(), 1); |
| 10161 |
function Root(props) { |
| 10162 |
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(DirectionProvider3, { children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(index_parts_exports2.Root, { ...props }) }); |
| 10163 |
} |
| 10164 |
|
| 10165 |
// packages/ui/build-module/link/link.mjs |
| 10166 |
var import_element16 = __toESM(require_element(), 1); |
| 10167 |
var import_i18n2 = __toESM(require_i18n(), 1); |
| 10168 |
var import_jsx_runtime19 = __toESM(require_jsx_runtime(), 1); |
| 10169 |
var STYLE_HASH_ATTRIBUTE5 = "data-wp-hash"; |
| 10170 |
function getRuntime5() { |
| 10171 |
const globalScope = globalThis; |
| 10172 |
if (globalScope.__wpStyleRuntime) { |
| 10173 |
return globalScope.__wpStyleRuntime; |
| 10174 |
} |
| 10175 |
globalScope.__wpStyleRuntime = { |
| 10176 |
documents: /* @__PURE__ */ new Map(), |
| 10177 |
styles: /* @__PURE__ */ new Map(), |
| 10178 |
injectedStyles: /* @__PURE__ */ new WeakMap() |
| 10179 |
}; |
| 10180 |
if (typeof document !== "undefined") { |
| 10181 |
registerDocument5(document); |
| 10182 |
} |
| 10183 |
return globalScope.__wpStyleRuntime; |
| 10184 |
} |
| 10185 |
function documentContainsStyleHash5(targetDocument, hash) { |
| 10186 |
if (!targetDocument.head) { |
| 10187 |
return false; |
| 10188 |
} |
| 10189 |
for (const style of targetDocument.head.querySelectorAll( |
| 10190 |
`style[${STYLE_HASH_ATTRIBUTE5}]` |
| 10191 |
)) { |
| 10192 |
if (style.getAttribute(STYLE_HASH_ATTRIBUTE5) === hash) { |
| 10193 |
return true; |
| 10194 |
} |
| 10195 |
} |
| 10196 |
return false; |
| 10197 |
} |
| 10198 |
function injectStyle5(targetDocument, hash, css) { |
| 10199 |
if (!targetDocument.head) { |
| 10200 |
return; |
| 10201 |
} |
| 10202 |
const runtime = getRuntime5(); |
| 10203 |
let injectedStyles = runtime.injectedStyles.get(targetDocument); |
| 10204 |
if (!injectedStyles) { |
| 10205 |
injectedStyles = /* @__PURE__ */ new Set(); |
| 10206 |
runtime.injectedStyles.set(targetDocument, injectedStyles); |
| 10207 |
} |
| 10208 |
if (injectedStyles.has(hash)) { |
| 10209 |
return; |
| 10210 |
} |
| 10211 |
if (documentContainsStyleHash5(targetDocument, hash)) { |
| 10212 |
injectedStyles.add(hash); |
| 10213 |
return; |
| 10214 |
} |
| 10215 |
const style = targetDocument.createElement("style"); |
| 10216 |
style.setAttribute(STYLE_HASH_ATTRIBUTE5, hash); |
| 10217 |
style.appendChild(targetDocument.createTextNode(css)); |
| 10218 |
targetDocument.head.appendChild(style); |
| 10219 |
injectedStyles.add(hash); |
| 10220 |
} |
| 10221 |
function registerDocument5(targetDocument) { |
| 10222 |
const runtime = getRuntime5(); |
| 10223 |
runtime.documents.set( |
| 10224 |
targetDocument, |
| 10225 |
(runtime.documents.get(targetDocument) ?? 0) + 1 |
| 10226 |
); |
| 10227 |
for (const [hash, css] of runtime.styles) { |
| 10228 |
injectStyle5(targetDocument, hash, css); |
| 10229 |
} |
| 10230 |
return () => { |
| 10231 |
const count = runtime.documents.get(targetDocument); |
| 10232 |
if (count === void 0) { |
| 10233 |
return; |
| 10234 |
} |
| 10235 |
if (count <= 1) { |
| 10236 |
runtime.documents.delete(targetDocument); |
| 10237 |
return; |
| 10238 |
} |
| 10239 |
runtime.documents.set(targetDocument, count - 1); |
| 10240 |
}; |
| 10241 |
} |
| 10242 |
function registerStyle5(hash, css) { |
| 10243 |
const runtime = getRuntime5(); |
| 10244 |
runtime.styles.set(hash, css); |
| 10245 |
for (const targetDocument of runtime.documents.keys()) { |
| 10246 |
injectStyle5(targetDocument, hash, css); |
| 10247 |
} |
| 10248 |
} |
| 10249 |
if (typeof process === "undefined" || true) { |
| 10250 |
registerStyle5("10f3806643", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._336cd3e4e743482f__box-sizing{box-sizing:border-box;*,:after,:before{box-sizing:inherit}}}}"); |
| 10251 |
} |
| 10252 |
var resets_default2 = { "box-sizing": "_336cd3e4e743482f__box-sizing" }; |
| 10253 |
if (typeof process === "undefined" || true) { |
| 10254 |
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))}}}"); |
| 10255 |
} |
| 10256 |
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" }; |
| 10257 |
if (typeof process === "undefined" || true) { |
| 10258 |
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"}}}'); |
| 10259 |
} |
| 10260 |
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" }; |
| 10261 |
if (typeof process === "undefined" || true) { |
| 10262 |
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)}"); |
| 10263 |
} |
| 10264 |
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" }; |
| 10265 |
var Link = (0, import_element16.forwardRef)(function Link2({ |
| 10266 |
children, |
| 10267 |
variant = "default", |
| 10268 |
tone = "brand", |
| 10269 |
openInNewTab = false, |
| 10270 |
target, |
| 10271 |
render, |
| 10272 |
className, |
| 10273 |
...props |
| 10274 |
}, ref) { |
| 10275 |
const shouldShowNewTabIndicator = openInNewTab || /^_blank$/i.test(target ?? ""); |
| 10276 |
const element = useRender({ |
| 10277 |
render, |
| 10278 |
defaultTagName: "a", |
| 10279 |
ref, |
| 10280 |
props: mergeProps(props, { |
| 10281 |
className: clsx_default( |
| 10282 |
global_css_defense_default2.a, |
| 10283 |
resets_default2["box-sizing"], |
| 10284 |
focus_module_default["outset-ring--focus-except-active"], |
| 10285 |
variant !== "unstyled" && style_default4.link, |
| 10286 |
variant !== "unstyled" && style_default4[`is-${tone}`], |
| 10287 |
variant === "unstyled" && style_default4["is-unstyled"], |
| 10288 |
className |
| 10289 |
), |
| 10290 |
target: target ?? (openInNewTab ? "_blank" : void 0), |
| 10291 |
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [ |
| 10292 |
children, |
| 10293 |
shouldShowNewTabIndicator && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)( |
| 10294 |
"span", |
| 10295 |
{ |
| 10296 |
className: style_default4["link-icon"], |
| 10297 |
role: "img", |
| 10298 |
"aria-label": ( |
| 10299 |
/* translators: accessibility text appended to link text */ |
| 10300 |
(0, import_i18n2.__)("(opens in a new tab)") |
| 10301 |
) |
| 10302 |
} |
| 10303 |
) |
| 10304 |
] }) |
| 10305 |
}) |
| 10306 |
}); |
| 10307 |
return element; |
| 10308 |
}); |
| 10309 |
|
| 10310 |
// packages/icons/build-module/library/caution.mjs |
| 10311 |
var import_primitives = __toESM(require_primitives(), 1); |
| 10312 |
var import_jsx_runtime20 = __toESM(require_jsx_runtime(), 1); |
| 10313 |
var caution_default = /* @__PURE__ */ (0, import_jsx_runtime20.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_runtime20.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" }) }); |
| 10314 |
|
| 10315 |
// packages/icons/build-module/library/chevron-down.mjs |
| 10316 |
var import_primitives2 = __toESM(require_primitives(), 1); |
| 10317 |
var import_jsx_runtime21 = __toESM(require_jsx_runtime(), 1); |
| 10318 |
var chevron_down_default = /* @__PURE__ */ (0, import_jsx_runtime21.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_runtime21.jsx)(import_primitives2.Path, { d: "M7 11L12 15L17 11", vectorEffect: "non-scaling-stroke" }) }); |
| 10319 |
|
| 10320 |
// packages/icons/build-module/library/close-small.mjs |
| 10321 |
var import_primitives3 = __toESM(require_primitives(), 1); |
| 10322 |
var import_jsx_runtime22 = __toESM(require_jsx_runtime(), 1); |
| 10323 |
var close_small_default = /* @__PURE__ */ (0, import_jsx_runtime22.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_runtime22.jsx)(import_primitives3.Path, { d: "M7.75 16.25L16.25 7.75M16.25 16.25L7.75 7.75", vectorEffect: "non-scaling-stroke" }) }); |
| 10324 |
|
| 10325 |
// packages/icons/build-module/library/error.mjs |
| 10326 |
var import_primitives4 = __toESM(require_primitives(), 1); |
| 10327 |
var import_jsx_runtime23 = __toESM(require_jsx_runtime(), 1); |
| 10328 |
var error_default = /* @__PURE__ */ (0, import_jsx_runtime23.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_runtime23.jsx)(import_primitives4.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" }) }); |
| 10329 |
|
| 10330 |
// packages/icons/build-module/library/external.mjs |
| 10331 |
var import_primitives5 = __toESM(require_primitives(), 1); |
| 10332 |
var import_jsx_runtime24 = __toESM(require_jsx_runtime(), 1); |
| 10333 |
var external_default = /* @__PURE__ */ (0, import_jsx_runtime24.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_runtime24.jsx)(import_primitives5.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" }) }); |
| 10334 |
|
| 10335 |
// packages/icons/build-module/library/info.mjs |
| 10336 |
var import_primitives6 = __toESM(require_primitives(), 1); |
| 10337 |
var import_jsx_runtime25 = __toESM(require_jsx_runtime(), 1); |
| 10338 |
var info_default = /* @__PURE__ */ (0, import_jsx_runtime25.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_runtime25.jsx)(import_primitives6.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" }) }); |
| 10339 |
|
| 10340 |
// packages/icons/build-module/library/more-vertical.mjs |
| 10341 |
var import_primitives7 = __toESM(require_primitives(), 1); |
| 10342 |
var import_jsx_runtime26 = __toESM(require_jsx_runtime(), 1); |
| 10343 |
var more_vertical_default = /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_primitives7.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", style: { fill: "none" }, stroke: "currentColor", strokeWidth: "1.5", children: [ |
| 10344 |
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_primitives7.Path, { d: "M11.75 18.25L12.25 18.25L12.25 17.75L11.75 17.75L11.75 18.25Z", fill: "currentColor", stroke: "none" }), |
| 10345 |
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_primitives7.Path, { d: "M11.75 12.25L12.25 12.25L12.25 11.75L11.75 11.75L11.75 12.25Z", fill: "currentColor", stroke: "none" }), |
| 10346 |
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_primitives7.Path, { d: "M11.75 6.25L12.25 6.25L12.25 5.75L11.75 5.75L11.75 6.25Z", fill: "currentColor", stroke: "none" }), |
| 10347 |
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_primitives7.Path, { d: "M11.75 18.25L12.25 18.25L12.25 17.75L11.75 17.75L11.75 18.25Z", vectorEffect: "non-scaling-stroke" }), |
| 10348 |
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_primitives7.Path, { d: "M11.75 12.25L12.25 12.25L12.25 11.75L11.75 11.75L11.75 12.25Z", vectorEffect: "non-scaling-stroke" }), |
| 10349 |
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_primitives7.Path, { d: "M11.75 6.25L12.25 6.25L12.25 5.75L11.75 5.75L11.75 6.25Z", vectorEffect: "non-scaling-stroke" }) |
| 10350 |
] }); |
| 10351 |
|
| 10352 |
// packages/icons/build-module/library/plus.mjs |
| 10353 |
var import_primitives8 = __toESM(require_primitives(), 1); |
| 10354 |
var import_jsx_runtime27 = __toESM(require_jsx_runtime(), 1); |
| 10355 |
var plus_default = /* @__PURE__ */ (0, import_jsx_runtime27.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_runtime27.jsx)(import_primitives8.Path, { d: "M12 18V6M18 12H6", vectorEffect: "non-scaling-stroke" }) }); |
| 10356 |
|
| 10357 |
// packages/icons/build-module/library/published.mjs |
| 10358 |
var import_primitives9 = __toESM(require_primitives(), 1); |
| 10359 |
var import_jsx_runtime28 = __toESM(require_jsx_runtime(), 1); |
| 10360 |
var published_default = /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_primitives9.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", style: { fill: "none" }, stroke: "currentColor", strokeWidth: "1.5", children: [ |
| 10361 |
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_primitives9.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" }), |
| 10362 |
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_primitives9.Path, { d: "M9 12L11 14L15 10", vectorEffect: "non-scaling-stroke" }) |
| 10363 |
] }); |
| 10364 |
|
| 10365 |
// packages/icons/build-module/library/redo.mjs |
| 10366 |
var import_primitives10 = __toESM(require_primitives(), 1); |
| 10367 |
var import_jsx_runtime29 = __toESM(require_jsx_runtime(), 1); |
| 10368 |
var redo_default = /* @__PURE__ */ (0, import_jsx_runtime29.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_runtime29.jsx)(import_primitives10.Path, { d: "M15 15L18.5 11L15 7M18.5 11H8C5 11 4.75 13.8 4.75 17", vectorEffect: "non-scaling-stroke" }) }); |
| 10369 |
|
| 10370 |
// packages/icons/build-module/library/undo.mjs |
| 10371 |
var import_primitives11 = __toESM(require_primitives(), 1); |
| 10372 |
var import_jsx_runtime30 = __toESM(require_jsx_runtime(), 1); |
| 10373 |
var undo_default = /* @__PURE__ */ (0, import_jsx_runtime30.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_runtime30.jsx)(import_primitives11.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" }) }); |
| 10374 |
|
| 10375 |
// packages/ui/build-module/icon/icon.mjs |
| 10376 |
var import_element17 = __toESM(require_element(), 1); |
| 10377 |
var import_primitives12 = __toESM(require_primitives(), 1); |
| 10378 |
var import_jsx_runtime31 = __toESM(require_jsx_runtime(), 1); |
| 10379 |
var Icon = (0, import_element17.forwardRef)(function Icon2({ icon, size: size4 = 24, style, ...restProps }, ref) { |
| 10380 |
const mergedStyle = icon.props.style || style ? { ...icon.props.style, ...style } : void 0; |
| 10381 |
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)( |
| 10382 |
import_primitives12.SVG, |
| 10383 |
{ |
| 10384 |
ref, |
| 10385 |
...icon.props, |
| 10386 |
...restProps, |
| 10387 |
...mergedStyle ? { style: mergedStyle } : {}, |
| 10388 |
width: size4, |
| 10389 |
height: size4 |
| 10390 |
} |
| 10391 |
); |
| 10392 |
}); |
| 10393 |
|
| 10394 |
// packages/ui/build-module/utils/keyboard-shortcut.mjs |
| 10395 |
var import_element19 = __toESM(require_element(), 1); |
| 10396 |
var import_i18n3 = __toESM(require_i18n(), 1); |
| 10397 |
|
| 10398 |
// packages/ui/build-module/visually-hidden/visually-hidden.mjs |
| 10399 |
var import_element18 = __toESM(require_element(), 1); |
| 10400 |
var STYLE_HASH_ATTRIBUTE6 = "data-wp-hash"; |
| 10401 |
function getRuntime6() { |
| 10402 |
const globalScope = globalThis; |
| 10403 |
if (globalScope.__wpStyleRuntime) { |
| 10404 |
return globalScope.__wpStyleRuntime; |
| 10405 |
} |
| 10406 |
globalScope.__wpStyleRuntime = { |
| 10407 |
documents: /* @__PURE__ */ new Map(), |
| 10408 |
styles: /* @__PURE__ */ new Map(), |
| 10409 |
injectedStyles: /* @__PURE__ */ new WeakMap() |
| 10410 |
}; |
| 10411 |
if (typeof document !== "undefined") { |
| 10412 |
registerDocument6(document); |
| 10413 |
} |
| 10414 |
return globalScope.__wpStyleRuntime; |
| 10415 |
} |
| 10416 |
function documentContainsStyleHash6(targetDocument, hash) { |
| 10417 |
if (!targetDocument.head) { |
| 10418 |
return false; |
| 10419 |
} |
| 10420 |
for (const style of targetDocument.head.querySelectorAll( |
| 10421 |
`style[${STYLE_HASH_ATTRIBUTE6}]` |
| 10422 |
)) { |
| 10423 |
if (style.getAttribute(STYLE_HASH_ATTRIBUTE6) === hash) { |
| 10424 |
return true; |
| 10425 |
} |
| 10426 |
} |
| 10427 |
return false; |
| 10428 |
} |
| 10429 |
function injectStyle6(targetDocument, hash, css) { |
| 10430 |
if (!targetDocument.head) { |
| 10431 |
return; |
| 10432 |
} |
| 10433 |
const runtime = getRuntime6(); |
| 10434 |
let injectedStyles = runtime.injectedStyles.get(targetDocument); |
| 10435 |
if (!injectedStyles) { |
| 10436 |
injectedStyles = /* @__PURE__ */ new Set(); |
| 10437 |
runtime.injectedStyles.set(targetDocument, injectedStyles); |
| 10438 |
} |
| 10439 |
if (injectedStyles.has(hash)) { |
| 10440 |
return; |
| 10441 |
} |
| 10442 |
if (documentContainsStyleHash6(targetDocument, hash)) { |
| 10443 |
injectedStyles.add(hash); |
| 10444 |
return; |
| 10445 |
} |
| 10446 |
const style = targetDocument.createElement("style"); |
| 10447 |
style.setAttribute(STYLE_HASH_ATTRIBUTE6, hash); |
| 10448 |
style.appendChild(targetDocument.createTextNode(css)); |
| 10449 |
targetDocument.head.appendChild(style); |
| 10450 |
injectedStyles.add(hash); |
| 10451 |
} |
| 10452 |
function registerDocument6(targetDocument) { |
| 10453 |
const runtime = getRuntime6(); |
| 10454 |
runtime.documents.set( |
| 10455 |
targetDocument, |
| 10456 |
(runtime.documents.get(targetDocument) ?? 0) + 1 |
| 10457 |
); |
| 10458 |
for (const [hash, css] of runtime.styles) { |
| 10459 |
injectStyle6(targetDocument, hash, css); |
| 10460 |
} |
| 10461 |
return () => { |
| 10462 |
const count = runtime.documents.get(targetDocument); |
| 10463 |
if (count === void 0) { |
| 10464 |
return; |
| 10465 |
} |
| 10466 |
if (count <= 1) { |
| 10467 |
runtime.documents.delete(targetDocument); |
| 10468 |
return; |
| 10469 |
} |
| 10470 |
runtime.documents.set(targetDocument, count - 1); |
| 10471 |
}; |
| 10472 |
} |
| 10473 |
function registerStyle6(hash, css) { |
| 10474 |
const runtime = getRuntime6(); |
| 10475 |
runtime.styles.set(hash, css); |
| 10476 |
for (const targetDocument of runtime.documents.keys()) { |
| 10477 |
injectStyle6(targetDocument, hash, css); |
| 10478 |
} |
| 10479 |
} |
| 10480 |
if (typeof process === "undefined" || true) { |
| 10481 |
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}}}"); |
| 10482 |
} |
| 10483 |
var style_default5 = { "visually-hidden": "f37b9e2e191ebd66__visually-hidden" }; |
| 10484 |
var VisuallyHidden = (0, import_element18.forwardRef)( |
| 10485 |
function VisuallyHidden2({ render, ...restProps }, ref) { |
| 10486 |
const element = useRender({ |
| 10487 |
render, |
| 10488 |
ref, |
| 10489 |
props: mergeProps( |
| 10490 |
{ className: style_default5["visually-hidden"] }, |
| 10491 |
restProps, |
| 10492 |
{ |
| 10493 |
// @ts-expect-error Arbitrary data-* attributes aren't indexable on the typed div props. Kept hardcoded so consumers can't change or remove it. |
| 10494 |
"data-visually-hidden": "" |
| 10495 |
} |
| 10496 |
) |
| 10497 |
}); |
| 10498 |
return element; |
| 10499 |
} |
| 10500 |
); |
| 10501 |
|
| 10502 |
// packages/ui/build-module/utils/keyboard-shortcut.mjs |
| 10503 |
var import_jsx_runtime32 = __toESM(require_jsx_runtime(), 1); |
| 10504 |
function useKeyboardShortcutProps({ |
| 10505 |
"aria-describedby": ariaDescribedBy, |
| 10506 |
"aria-keyshortcuts": ariaKeyShortcuts, |
| 10507 |
shortcut |
| 10508 |
}) { |
| 10509 |
const generatedDescriptionId = (0, import_element19.useId)(); |
| 10510 |
const descriptionId = shortcut ? generatedDescriptionId : void 0; |
| 10511 |
const describedBy = [ariaDescribedBy, descriptionId].filter(Boolean).join(" "); |
| 10512 |
return { |
| 10513 |
descriptionId, |
| 10514 |
targetProps: { |
| 10515 |
"aria-describedby": describedBy || void 0, |
| 10516 |
"aria-keyshortcuts": shortcut?.ariaKeyShortcut ?? ariaKeyShortcuts |
| 10517 |
} |
| 10518 |
}; |
| 10519 |
} |
| 10520 |
var KeyboardShortcutDescription = (0, import_element19.forwardRef)(function KeyboardShortcutDescription2({ descriptionId, shortcut }, ref) { |
| 10521 |
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)( |
| 10522 |
VisuallyHidden, |
| 10523 |
{ |
| 10524 |
id: descriptionId, |
| 10525 |
"aria-hidden": "true", |
| 10526 |
render: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { ref }), |
| 10527 |
children: (0, import_i18n3.sprintf)( |
| 10528 |
/* translators: %s: keyboard shortcut. */ |
| 10529 |
(0, import_i18n3.__)("Keyboard shortcut: %s"), |
| 10530 |
shortcut.label ?? shortcut.ariaKeyShortcut |
| 10531 |
) |
| 10532 |
} |
| 10533 |
); |
| 10534 |
}); |
| 10535 |
var KeyboardShortcutDisplay = (0, import_element19.forwardRef)(function KeyboardShortcutDisplay2({ className, shortcut }, ref) { |
| 10536 |
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("span", { ref, "aria-hidden": "true", className, dir: "ltr", children: shortcut.displayShortcut }); |
| 10537 |
}); |
| 10538 |
|
| 10539 |
// packages/ui/build-module/button/button.mjs |
| 10540 |
var import_a11y = __toESM(require_a11y(), 1); |
| 10541 |
var import_element20 = __toESM(require_element(), 1); |
| 10542 |
var import_i18n4 = __toESM(require_i18n(), 1); |
| 10543 |
var import_jsx_runtime33 = __toESM(require_jsx_runtime(), 1); |
| 10544 |
var STYLE_HASH_ATTRIBUTE7 = "data-wp-hash"; |
| 10545 |
function getRuntime7() { |
| 10546 |
const globalScope = globalThis; |
| 10547 |
if (globalScope.__wpStyleRuntime) { |
| 10548 |
return globalScope.__wpStyleRuntime; |
| 10549 |
} |
| 10550 |
globalScope.__wpStyleRuntime = { |
| 10551 |
documents: /* @__PURE__ */ new Map(), |
| 10552 |
styles: /* @__PURE__ */ new Map(), |
| 10553 |
injectedStyles: /* @__PURE__ */ new WeakMap() |
| 10554 |
}; |
| 10555 |
if (typeof document !== "undefined") { |
| 10556 |
registerDocument7(document); |
| 10557 |
} |
| 10558 |
return globalScope.__wpStyleRuntime; |
| 10559 |
} |
| 10560 |
function documentContainsStyleHash7(targetDocument, hash) { |
| 10561 |
if (!targetDocument.head) { |
| 10562 |
return false; |
| 10563 |
} |
| 10564 |
for (const style of targetDocument.head.querySelectorAll( |
| 10565 |
`style[${STYLE_HASH_ATTRIBUTE7}]` |
| 10566 |
)) { |
| 10567 |
if (style.getAttribute(STYLE_HASH_ATTRIBUTE7) === hash) { |
| 10568 |
return true; |
| 10569 |
} |
| 10570 |
} |
| 10571 |
return false; |
| 10572 |
} |
| 10573 |
function injectStyle7(targetDocument, hash, css) { |
| 10574 |
if (!targetDocument.head) { |
| 10575 |
return; |
| 10576 |
} |
| 10577 |
const runtime = getRuntime7(); |
| 10578 |
let injectedStyles = runtime.injectedStyles.get(targetDocument); |
| 10579 |
if (!injectedStyles) { |
| 10580 |
injectedStyles = /* @__PURE__ */ new Set(); |
| 10581 |
runtime.injectedStyles.set(targetDocument, injectedStyles); |
| 10582 |
} |
| 10583 |
if (injectedStyles.has(hash)) { |
| 10584 |
return; |
| 10585 |
} |
| 10586 |
if (documentContainsStyleHash7(targetDocument, hash)) { |
| 10587 |
injectedStyles.add(hash); |
| 10588 |
return; |
| 10589 |
} |
| 10590 |
const style = targetDocument.createElement("style"); |
| 10591 |
style.setAttribute(STYLE_HASH_ATTRIBUTE7, hash); |
| 10592 |
style.appendChild(targetDocument.createTextNode(css)); |
| 10593 |
targetDocument.head.appendChild(style); |
| 10594 |
injectedStyles.add(hash); |
| 10595 |
} |
| 10596 |
function registerDocument7(targetDocument) { |
| 10597 |
const runtime = getRuntime7(); |
| 10598 |
runtime.documents.set( |
| 10599 |
targetDocument, |
| 10600 |
(runtime.documents.get(targetDocument) ?? 0) + 1 |
| 10601 |
); |
| 10602 |
for (const [hash, css] of runtime.styles) { |
| 10603 |
injectStyle7(targetDocument, hash, css); |
| 10604 |
} |
| 10605 |
return () => { |
| 10606 |
const count = runtime.documents.get(targetDocument); |
| 10607 |
if (count === void 0) { |
| 10608 |
return; |
| 10609 |
} |
| 10610 |
if (count <= 1) { |
| 10611 |
runtime.documents.delete(targetDocument); |
| 10612 |
return; |
| 10613 |
} |
| 10614 |
runtime.documents.set(targetDocument, count - 1); |
| 10615 |
}; |
| 10616 |
} |
| 10617 |
function registerStyle7(hash, css) { |
| 10618 |
const runtime = getRuntime7(); |
| 10619 |
runtime.styles.set(hash, css); |
| 10620 |
for (const targetDocument of runtime.documents.keys()) { |
| 10621 |
injectStyle7(targetDocument, hash, css); |
| 10622 |
} |
| 10623 |
} |
| 10624 |
if (typeof process === "undefined" || true) { |
| 10625 |
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)}}}'); |
| 10626 |
} |
| 10627 |
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" }; |
| 10628 |
if (typeof process === "undefined" || true) { |
| 10629 |
registerStyle7("10f3806643", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._336cd3e4e743482f__box-sizing{box-sizing:border-box;*,:after,:before{box-sizing:inherit}}}}"); |
| 10630 |
} |
| 10631 |
var resets_default3 = { "box-sizing": "_336cd3e4e743482f__box-sizing" }; |
| 10632 |
if (typeof process === "undefined" || true) { |
| 10633 |
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))}}}"); |
| 10634 |
} |
| 10635 |
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" }; |
| 10636 |
if (typeof process === "undefined" || true) { |
| 10637 |
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)}"); |
| 10638 |
} |
| 10639 |
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" }; |
| 10640 |
var Button3 = (0, import_element20.forwardRef)( |
| 10641 |
function Button22({ |
| 10642 |
tone = "brand", |
| 10643 |
variant = "solid", |
| 10644 |
size: size4 = "default", |
| 10645 |
className, |
| 10646 |
focusableWhenDisabled = true, |
| 10647 |
disabled: disabled2, |
| 10648 |
loading, |
| 10649 |
loadingAnnouncement = (0, import_i18n4.__)("Loading"), |
| 10650 |
children, |
| 10651 |
...props |
| 10652 |
}, ref) { |
| 10653 |
const mergedClassName = clsx_default( |
| 10654 |
global_css_defense_default3.button, |
| 10655 |
resets_default3["box-sizing"], |
| 10656 |
focus_module_default2["outset-ring--focus-except-active"], |
| 10657 |
variant !== "unstyled" && style_default6.button, |
| 10658 |
style_default6[`is-${tone}`], |
| 10659 |
style_default6[`is-${variant}`], |
| 10660 |
style_default6[`is-${size4}`], |
| 10661 |
loading && style_default6["is-loading"], |
| 10662 |
className |
| 10663 |
); |
| 10664 |
(0, import_element20.useEffect)(() => { |
| 10665 |
if (loading && loadingAnnouncement) { |
| 10666 |
(0, import_a11y.speak)(loadingAnnouncement); |
| 10667 |
} |
| 10668 |
}, [loading, loadingAnnouncement]); |
| 10669 |
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)( |
| 10670 |
Button, |
| 10671 |
{ |
| 10672 |
ref, |
| 10673 |
className: mergedClassName, |
| 10674 |
focusableWhenDisabled, |
| 10675 |
disabled: disabled2 ?? loading, |
| 10676 |
...props, |
| 10677 |
children |
| 10678 |
} |
| 10679 |
); |
| 10680 |
} |
| 10681 |
); |
| 10682 |
|
| 10683 |
// packages/ui/build-module/button/icon.mjs |
| 10684 |
var import_element21 = __toESM(require_element(), 1); |
| 10685 |
var import_jsx_runtime34 = __toESM(require_jsx_runtime(), 1); |
| 10686 |
var STYLE_HASH_ATTRIBUTE8 = "data-wp-hash"; |
| 10687 |
function getRuntime8() { |
| 10688 |
const globalScope = globalThis; |
| 10689 |
if (globalScope.__wpStyleRuntime) { |
| 10690 |
return globalScope.__wpStyleRuntime; |
| 10691 |
} |
| 10692 |
globalScope.__wpStyleRuntime = { |
| 10693 |
documents: /* @__PURE__ */ new Map(), |
| 10694 |
styles: /* @__PURE__ */ new Map(), |
| 10695 |
injectedStyles: /* @__PURE__ */ new WeakMap() |
| 10696 |
}; |
| 10697 |
if (typeof document !== "undefined") { |
| 10698 |
registerDocument8(document); |
| 10699 |
} |
| 10700 |
return globalScope.__wpStyleRuntime; |
| 10701 |
} |
| 10702 |
function documentContainsStyleHash8(targetDocument, hash) { |
| 10703 |
if (!targetDocument.head) { |
| 10704 |
return false; |
| 10705 |
} |
| 10706 |
for (const style of targetDocument.head.querySelectorAll( |
| 10707 |
`style[${STYLE_HASH_ATTRIBUTE8}]` |
| 10708 |
)) { |
| 10709 |
if (style.getAttribute(STYLE_HASH_ATTRIBUTE8) === hash) { |
| 10710 |
return true; |
| 10711 |
} |
| 10712 |
} |
| 10713 |
return false; |
| 10714 |
} |
| 10715 |
function injectStyle8(targetDocument, hash, css) { |
| 10716 |
if (!targetDocument.head) { |
| 10717 |
return; |
| 10718 |
} |
| 10719 |
const runtime = getRuntime8(); |
| 10720 |
let injectedStyles = runtime.injectedStyles.get(targetDocument); |
| 10721 |
if (!injectedStyles) { |
| 10722 |
injectedStyles = /* @__PURE__ */ new Set(); |
| 10723 |
runtime.injectedStyles.set(targetDocument, injectedStyles); |
| 10724 |
} |
| 10725 |
if (injectedStyles.has(hash)) { |
| 10726 |
return; |
| 10727 |
} |
| 10728 |
if (documentContainsStyleHash8(targetDocument, hash)) { |
| 10729 |
injectedStyles.add(hash); |
| 10730 |
return; |
| 10731 |
} |
| 10732 |
const style = targetDocument.createElement("style"); |
| 10733 |
style.setAttribute(STYLE_HASH_ATTRIBUTE8, hash); |
| 10734 |
style.appendChild(targetDocument.createTextNode(css)); |
| 10735 |
targetDocument.head.appendChild(style); |
| 10736 |
injectedStyles.add(hash); |
| 10737 |
} |
| 10738 |
function registerDocument8(targetDocument) { |
| 10739 |
const runtime = getRuntime8(); |
| 10740 |
runtime.documents.set( |
| 10741 |
targetDocument, |
| 10742 |
(runtime.documents.get(targetDocument) ?? 0) + 1 |
| 10743 |
); |
| 10744 |
for (const [hash, css] of runtime.styles) { |
| 10745 |
injectStyle8(targetDocument, hash, css); |
| 10746 |
} |
| 10747 |
return () => { |
| 10748 |
const count = runtime.documents.get(targetDocument); |
| 10749 |
if (count === void 0) { |
| 10750 |
return; |
| 10751 |
} |
| 10752 |
if (count <= 1) { |
| 10753 |
runtime.documents.delete(targetDocument); |
| 10754 |
return; |
| 10755 |
} |
| 10756 |
runtime.documents.set(targetDocument, count - 1); |
| 10757 |
}; |
| 10758 |
} |
| 10759 |
function registerStyle8(hash, css) { |
| 10760 |
const runtime = getRuntime8(); |
| 10761 |
runtime.styles.set(hash, css); |
| 10762 |
for (const targetDocument of runtime.documents.keys()) { |
| 10763 |
injectStyle8(targetDocument, hash, css); |
| 10764 |
} |
| 10765 |
} |
| 10766 |
if (typeof process === "undefined" || true) { |
| 10767 |
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)}}}'); |
| 10768 |
} |
| 10769 |
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" }; |
| 10770 |
var ButtonIcon = (0, import_element21.forwardRef)( |
| 10771 |
function ButtonIcon2({ className, icon, ...props }, ref) { |
| 10772 |
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)( |
| 10773 |
Icon, |
| 10774 |
{ |
| 10775 |
ref, |
| 10776 |
icon, |
| 10777 |
className: clsx_default(style_default7.icon, className), |
| 10778 |
size: 24, |
| 10779 |
...props |
| 10780 |
} |
| 10781 |
); |
| 10782 |
} |
| 10783 |
); |
| 10784 |
|
| 10785 |
// packages/ui/build-module/button/index.mjs |
| 10786 |
ButtonIcon.displayName = "Button.Icon"; |
| 10787 |
var Button4 = Object.assign(Button3, { |
| 10788 |
/** |
| 10789 |
* An icon component specifically designed to work well when rendered inside |
| 10790 |
* a `Button` component. |
| 10791 |
*/ |
| 10792 |
Icon: ButtonIcon |
| 10793 |
}); |
| 10794 |
|
| 10795 |
// packages/ui/build-module/icon-button/icon-button.mjs |
| 10796 |
var import_element22 = __toESM(require_element(), 1); |
| 10797 |
var import_jsx_runtime35 = __toESM(require_jsx_runtime(), 1); |
| 10798 |
var STYLE_HASH_ATTRIBUTE9 = "data-wp-hash"; |
| 10799 |
function getRuntime9() { |
| 10800 |
const globalScope = globalThis; |
| 10801 |
if (globalScope.__wpStyleRuntime) { |
| 10802 |
return globalScope.__wpStyleRuntime; |
| 10803 |
} |
| 10804 |
globalScope.__wpStyleRuntime = { |
| 10805 |
documents: /* @__PURE__ */ new Map(), |
| 10806 |
styles: /* @__PURE__ */ new Map(), |
| 10807 |
injectedStyles: /* @__PURE__ */ new WeakMap() |
| 10808 |
}; |
| 10809 |
if (typeof document !== "undefined") { |
| 10810 |
registerDocument9(document); |
| 10811 |
} |
| 10812 |
return globalScope.__wpStyleRuntime; |
| 10813 |
} |
| 10814 |
function documentContainsStyleHash9(targetDocument, hash) { |
| 10815 |
if (!targetDocument.head) { |
| 10816 |
return false; |
| 10817 |
} |
| 10818 |
for (const style of targetDocument.head.querySelectorAll( |
| 10819 |
`style[${STYLE_HASH_ATTRIBUTE9}]` |
| 10820 |
)) { |
| 10821 |
if (style.getAttribute(STYLE_HASH_ATTRIBUTE9) === hash) { |
| 10822 |
return true; |
| 10823 |
} |
| 10824 |
} |
| 10825 |
return false; |
| 10826 |
} |
| 10827 |
function injectStyle9(targetDocument, hash, css) { |
| 10828 |
if (!targetDocument.head) { |
| 10829 |
return; |
| 10830 |
} |
| 10831 |
const runtime = getRuntime9(); |
| 10832 |
let injectedStyles = runtime.injectedStyles.get(targetDocument); |
| 10833 |
if (!injectedStyles) { |
| 10834 |
injectedStyles = /* @__PURE__ */ new Set(); |
| 10835 |
runtime.injectedStyles.set(targetDocument, injectedStyles); |
| 10836 |
} |
| 10837 |
if (injectedStyles.has(hash)) { |
| 10838 |
return; |
| 10839 |
} |
| 10840 |
if (documentContainsStyleHash9(targetDocument, hash)) { |
| 10841 |
injectedStyles.add(hash); |
| 10842 |
return; |
| 10843 |
} |
| 10844 |
const style = targetDocument.createElement("style"); |
| 10845 |
style.setAttribute(STYLE_HASH_ATTRIBUTE9, hash); |
| 10846 |
style.appendChild(targetDocument.createTextNode(css)); |
| 10847 |
targetDocument.head.appendChild(style); |
| 10848 |
injectedStyles.add(hash); |
| 10849 |
} |
| 10850 |
function registerDocument9(targetDocument) { |
| 10851 |
const runtime = getRuntime9(); |
| 10852 |
runtime.documents.set( |
| 10853 |
targetDocument, |
| 10854 |
(runtime.documents.get(targetDocument) ?? 0) + 1 |
| 10855 |
); |
| 10856 |
for (const [hash, css] of runtime.styles) { |
| 10857 |
injectStyle9(targetDocument, hash, css); |
| 10858 |
} |
| 10859 |
return () => { |
| 10860 |
const count = runtime.documents.get(targetDocument); |
| 10861 |
if (count === void 0) { |
| 10862 |
return; |
| 10863 |
} |
| 10864 |
if (count <= 1) { |
| 10865 |
runtime.documents.delete(targetDocument); |
| 10866 |
return; |
| 10867 |
} |
| 10868 |
runtime.documents.set(targetDocument, count - 1); |
| 10869 |
}; |
| 10870 |
} |
| 10871 |
function registerStyle9(hash, css) { |
| 10872 |
const runtime = getRuntime9(); |
| 10873 |
runtime.styles.set(hash, css); |
| 10874 |
for (const targetDocument of runtime.documents.keys()) { |
| 10875 |
injectStyle9(targetDocument, hash, css); |
| 10876 |
} |
| 10877 |
} |
| 10878 |
if (typeof process === "undefined" || true) { |
| 10879 |
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}}}"); |
| 10880 |
} |
| 10881 |
var style_default8 = { "icon-button": "_28cfdc260e755391__icon-button", "icon": "f1c70d719989a85a__icon" }; |
| 10882 |
var IconButton = (0, import_element22.forwardRef)( |
| 10883 |
function IconButton2({ |
| 10884 |
label, |
| 10885 |
className, |
| 10886 |
// Prevent accidental forwarding of `children` |
| 10887 |
children: _children, |
| 10888 |
disabled: disabled2, |
| 10889 |
focusableWhenDisabled = true, |
| 10890 |
icon, |
| 10891 |
size: size4, |
| 10892 |
shortcut, |
| 10893 |
positioner, |
| 10894 |
"aria-describedby": ariaDescribedBy, |
| 10895 |
"aria-keyshortcuts": ariaKeyShortcuts, |
| 10896 |
...restProps |
| 10897 |
}, ref) { |
| 10898 |
const classes = clsx_default(style_default8["icon-button"], className); |
| 10899 |
const { descriptionId, targetProps } = useKeyboardShortcutProps({ |
| 10900 |
"aria-describedby": ariaDescribedBy, |
| 10901 |
"aria-keyshortcuts": ariaKeyShortcuts, |
| 10902 |
shortcut |
| 10903 |
}); |
| 10904 |
return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(Root, { children: [ |
| 10905 |
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)( |
| 10906 |
Trigger, |
| 10907 |
{ |
| 10908 |
ref, |
| 10909 |
...targetProps, |
| 10910 |
disabled: disabled2 && !focusableWhenDisabled, |
| 10911 |
render: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)( |
| 10912 |
Button4, |
| 10913 |
{ |
| 10914 |
...restProps, |
| 10915 |
size: size4, |
| 10916 |
"aria-label": label, |
| 10917 |
disabled: disabled2, |
| 10918 |
focusableWhenDisabled |
| 10919 |
} |
| 10920 |
), |
| 10921 |
className: classes, |
| 10922 |
children: [ |
| 10923 |
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Icon, { icon, size: 24, className: style_default8.icon }), |
| 10924 |
shortcut && descriptionId && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)( |
| 10925 |
KeyboardShortcutDescription, |
| 10926 |
{ |
| 10927 |
descriptionId, |
| 10928 |
shortcut |
| 10929 |
} |
| 10930 |
) |
| 10931 |
] |
| 10932 |
} |
| 10933 |
), |
| 10934 |
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(Popup, { positioner, children: [ |
| 10935 |
label, |
| 10936 |
shortcut && /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_jsx_runtime35.Fragment, { children: [ |
| 10937 |
" ", |
| 10938 |
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(KeyboardShortcutDisplay, { shortcut }) |
| 10939 |
] }) |
| 10940 |
] }) |
| 10941 |
] }); |
| 10942 |
} |
| 10943 |
); |
| 10944 |
|
| 10945 |
// packages/ui/build-module/card/index.mjs |
| 10946 |
var card_exports = {}; |
| 10947 |
__export(card_exports, { |
| 10948 |
Content: () => Content, |
| 10949 |
FullBleed: () => FullBleed, |
| 10950 |
Header: () => Header, |
| 10951 |
Root: () => Root2, |
| 10952 |
Title: () => Title |
| 10953 |
}); |
| 10954 |
|
| 10955 |
// packages/ui/build-module/card/root.mjs |
| 10956 |
var import_element23 = __toESM(require_element(), 1); |
| 10957 |
var STYLE_HASH_ATTRIBUTE10 = "data-wp-hash"; |
| 10958 |
function getRuntime10() { |
| 10959 |
const globalScope = globalThis; |
| 10960 |
if (globalScope.__wpStyleRuntime) { |
| 10961 |
return globalScope.__wpStyleRuntime; |
| 10962 |
} |
| 10963 |
globalScope.__wpStyleRuntime = { |
| 10964 |
documents: /* @__PURE__ */ new Map(), |
| 10965 |
styles: /* @__PURE__ */ new Map(), |
| 10966 |
injectedStyles: /* @__PURE__ */ new WeakMap() |
| 10967 |
}; |
| 10968 |
if (typeof document !== "undefined") { |
| 10969 |
registerDocument10(document); |
| 10970 |
} |
| 10971 |
return globalScope.__wpStyleRuntime; |
| 10972 |
} |
| 10973 |
function documentContainsStyleHash10(targetDocument, hash) { |
| 10974 |
if (!targetDocument.head) { |
| 10975 |
return false; |
| 10976 |
} |
| 10977 |
for (const style of targetDocument.head.querySelectorAll( |
| 10978 |
`style[${STYLE_HASH_ATTRIBUTE10}]` |
| 10979 |
)) { |
| 10980 |
if (style.getAttribute(STYLE_HASH_ATTRIBUTE10) === hash) { |
| 10981 |
return true; |
| 10982 |
} |
| 10983 |
} |
| 10984 |
return false; |
| 10985 |
} |
| 10986 |
function injectStyle10(targetDocument, hash, css) { |
| 10987 |
if (!targetDocument.head) { |
| 10988 |
return; |
| 10989 |
} |
| 10990 |
const runtime = getRuntime10(); |
| 10991 |
let injectedStyles = runtime.injectedStyles.get(targetDocument); |
| 10992 |
if (!injectedStyles) { |
| 10993 |
injectedStyles = /* @__PURE__ */ new Set(); |
| 10994 |
runtime.injectedStyles.set(targetDocument, injectedStyles); |
| 10995 |
} |
| 10996 |
if (injectedStyles.has(hash)) { |
| 10997 |
return; |
| 10998 |
} |
| 10999 |
if (documentContainsStyleHash10(targetDocument, hash)) { |
| 11000 |
injectedStyles.add(hash); |
| 11001 |
return; |
| 11002 |
} |
| 11003 |
const style = targetDocument.createElement("style"); |
| 11004 |
style.setAttribute(STYLE_HASH_ATTRIBUTE10, hash); |
| 11005 |
style.appendChild(targetDocument.createTextNode(css)); |
| 11006 |
targetDocument.head.appendChild(style); |
| 11007 |
injectedStyles.add(hash); |
| 11008 |
} |
| 11009 |
function registerDocument10(targetDocument) { |
| 11010 |
const runtime = getRuntime10(); |
| 11011 |
runtime.documents.set( |
| 11012 |
targetDocument, |
| 11013 |
(runtime.documents.get(targetDocument) ?? 0) + 1 |
| 11014 |
); |
| 11015 |
for (const [hash, css] of runtime.styles) { |
| 11016 |
injectStyle10(targetDocument, hash, css); |
| 11017 |
} |
| 11018 |
return () => { |
| 11019 |
const count = runtime.documents.get(targetDocument); |
| 11020 |
if (count === void 0) { |
| 11021 |
return; |
| 11022 |
} |
| 11023 |
if (count <= 1) { |
| 11024 |
runtime.documents.delete(targetDocument); |
| 11025 |
return; |
| 11026 |
} |
| 11027 |
runtime.documents.set(targetDocument, count - 1); |
| 11028 |
}; |
| 11029 |
} |
| 11030 |
function registerStyle10(hash, css) { |
| 11031 |
const runtime = getRuntime10(); |
| 11032 |
runtime.styles.set(hash, css); |
| 11033 |
for (const targetDocument of runtime.documents.keys()) { |
| 11034 |
injectStyle10(targetDocument, hash, css); |
| 11035 |
} |
| 11036 |
} |
| 11037 |
if (typeof process === "undefined" || true) { |
| 11038 |
registerStyle10("10f3806643", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._336cd3e4e743482f__box-sizing{box-sizing:border-box;*,:after,:before{box-sizing:inherit}}}}"); |
| 11039 |
} |
| 11040 |
var resets_default4 = { "box-sizing": "_336cd3e4e743482f__box-sizing" }; |
| 11041 |
if (typeof process === "undefined" || true) { |
| 11042 |
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)}}}"); |
| 11043 |
} |
| 11044 |
var style_default9 = { "root": "_02872bf298eadc43__root", "header": "bbccc92e6ba5662d__header", "content": "_5dffdaf2a6e669ac__content", "fullbleed": "c1fa192587e1b4a6__fullbleed" }; |
| 11045 |
var Root2 = (0, import_element23.forwardRef)(function Card({ render, ...restProps }, ref) { |
| 11046 |
const mergedClassName = clsx_default(style_default9.root, resets_default4["box-sizing"]); |
| 11047 |
const element = useRender({ |
| 11048 |
defaultTagName: "div", |
| 11049 |
render, |
| 11050 |
ref, |
| 11051 |
props: mergeProps({ className: mergedClassName }, restProps) |
| 11052 |
}); |
| 11053 |
return element; |
| 11054 |
}); |
| 11055 |
|
| 11056 |
// packages/ui/build-module/card/header.mjs |
| 11057 |
var import_element24 = __toESM(require_element(), 1); |
| 11058 |
var STYLE_HASH_ATTRIBUTE11 = "data-wp-hash"; |
| 11059 |
function getRuntime11() { |
| 11060 |
const globalScope = globalThis; |
| 11061 |
if (globalScope.__wpStyleRuntime) { |
| 11062 |
return globalScope.__wpStyleRuntime; |
| 11063 |
} |
| 11064 |
globalScope.__wpStyleRuntime = { |
| 11065 |
documents: /* @__PURE__ */ new Map(), |
| 11066 |
styles: /* @__PURE__ */ new Map(), |
| 11067 |
injectedStyles: /* @__PURE__ */ new WeakMap() |
| 11068 |
}; |
| 11069 |
if (typeof document !== "undefined") { |
| 11070 |
registerDocument11(document); |
| 11071 |
} |
| 11072 |
return globalScope.__wpStyleRuntime; |
| 11073 |
} |
| 11074 |
function documentContainsStyleHash11(targetDocument, hash) { |
| 11075 |
if (!targetDocument.head) { |
| 11076 |
return false; |
| 11077 |
} |
| 11078 |
for (const style of targetDocument.head.querySelectorAll( |
| 11079 |
`style[${STYLE_HASH_ATTRIBUTE11}]` |
| 11080 |
)) { |
| 11081 |
if (style.getAttribute(STYLE_HASH_ATTRIBUTE11) === hash) { |
| 11082 |
return true; |
| 11083 |
} |
| 11084 |
} |
| 11085 |
return false; |
| 11086 |
} |
| 11087 |
function injectStyle11(targetDocument, hash, css) { |
| 11088 |
if (!targetDocument.head) { |
| 11089 |
return; |
| 11090 |
} |
| 11091 |
const runtime = getRuntime11(); |
| 11092 |
let injectedStyles = runtime.injectedStyles.get(targetDocument); |
| 11093 |
if (!injectedStyles) { |
| 11094 |
injectedStyles = /* @__PURE__ */ new Set(); |
| 11095 |
runtime.injectedStyles.set(targetDocument, injectedStyles); |
| 11096 |
} |
| 11097 |
if (injectedStyles.has(hash)) { |
| 11098 |
return; |
| 11099 |
} |
| 11100 |
if (documentContainsStyleHash11(targetDocument, hash)) { |
| 11101 |
injectedStyles.add(hash); |
| 11102 |
return; |
| 11103 |
} |
| 11104 |
const style = targetDocument.createElement("style"); |
| 11105 |
style.setAttribute(STYLE_HASH_ATTRIBUTE11, hash); |
| 11106 |
style.appendChild(targetDocument.createTextNode(css)); |
| 11107 |
targetDocument.head.appendChild(style); |
| 11108 |
injectedStyles.add(hash); |
| 11109 |
} |
| 11110 |
function registerDocument11(targetDocument) { |
| 11111 |
const runtime = getRuntime11(); |
| 11112 |
runtime.documents.set( |
| 11113 |
targetDocument, |
| 11114 |
(runtime.documents.get(targetDocument) ?? 0) + 1 |
| 11115 |
); |
| 11116 |
for (const [hash, css] of runtime.styles) { |
| 11117 |
injectStyle11(targetDocument, hash, css); |
| 11118 |
} |
| 11119 |
return () => { |
| 11120 |
const count = runtime.documents.get(targetDocument); |
| 11121 |
if (count === void 0) { |
| 11122 |
return; |
| 11123 |
} |
| 11124 |
if (count <= 1) { |
| 11125 |
runtime.documents.delete(targetDocument); |
| 11126 |
return; |
| 11127 |
} |
| 11128 |
runtime.documents.set(targetDocument, count - 1); |
| 11129 |
}; |
| 11130 |
} |
| 11131 |
function registerStyle11(hash, css) { |
| 11132 |
const runtime = getRuntime11(); |
| 11133 |
runtime.styles.set(hash, css); |
| 11134 |
for (const targetDocument of runtime.documents.keys()) { |
| 11135 |
injectStyle11(targetDocument, hash, css); |
| 11136 |
} |
| 11137 |
} |
| 11138 |
if (typeof process === "undefined" || true) { |
| 11139 |
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)}}}"); |
| 11140 |
} |
| 11141 |
var style_default10 = { "root": "_02872bf298eadc43__root", "header": "bbccc92e6ba5662d__header", "content": "_5dffdaf2a6e669ac__content", "fullbleed": "c1fa192587e1b4a6__fullbleed" }; |
| 11142 |
var Header = (0, import_element24.forwardRef)( |
| 11143 |
function CardHeader({ render, ...props }, ref) { |
| 11144 |
const element = useRender({ |
| 11145 |
defaultTagName: "div", |
| 11146 |
render, |
| 11147 |
ref, |
| 11148 |
props: mergeProps({ className: style_default10.header }, props) |
| 11149 |
}); |
| 11150 |
return element; |
| 11151 |
} |
| 11152 |
); |
| 11153 |
|
| 11154 |
// packages/ui/build-module/card/content.mjs |
| 11155 |
var import_element25 = __toESM(require_element(), 1); |
| 11156 |
var STYLE_HASH_ATTRIBUTE12 = "data-wp-hash"; |
| 11157 |
function getRuntime12() { |
| 11158 |
const globalScope = globalThis; |
| 11159 |
if (globalScope.__wpStyleRuntime) { |
| 11160 |
return globalScope.__wpStyleRuntime; |
| 11161 |
} |
| 11162 |
globalScope.__wpStyleRuntime = { |
| 11163 |
documents: /* @__PURE__ */ new Map(), |
| 11164 |
styles: /* @__PURE__ */ new Map(), |
| 11165 |
injectedStyles: /* @__PURE__ */ new WeakMap() |
| 11166 |
}; |
| 11167 |
if (typeof document !== "undefined") { |
| 11168 |
registerDocument12(document); |
| 11169 |
} |
| 11170 |
return globalScope.__wpStyleRuntime; |
| 11171 |
} |
| 11172 |
function documentContainsStyleHash12(targetDocument, hash) { |
| 11173 |
if (!targetDocument.head) { |
| 11174 |
return false; |
| 11175 |
} |
| 11176 |
for (const style of targetDocument.head.querySelectorAll( |
| 11177 |
`style[${STYLE_HASH_ATTRIBUTE12}]` |
| 11178 |
)) { |
| 11179 |
if (style.getAttribute(STYLE_HASH_ATTRIBUTE12) === hash) { |
| 11180 |
return true; |
| 11181 |
} |
| 11182 |
} |
| 11183 |
return false; |
| 11184 |
} |
| 11185 |
function injectStyle12(targetDocument, hash, css) { |
| 11186 |
if (!targetDocument.head) { |
| 11187 |
return; |
| 11188 |
} |
| 11189 |
const runtime = getRuntime12(); |
| 11190 |
let injectedStyles = runtime.injectedStyles.get(targetDocument); |
| 11191 |
if (!injectedStyles) { |
| 11192 |
injectedStyles = /* @__PURE__ */ new Set(); |
| 11193 |
runtime.injectedStyles.set(targetDocument, injectedStyles); |
| 11194 |
} |
| 11195 |
if (injectedStyles.has(hash)) { |
| 11196 |
return; |
| 11197 |
} |
| 11198 |
if (documentContainsStyleHash12(targetDocument, hash)) { |
| 11199 |
injectedStyles.add(hash); |
| 11200 |
return; |
| 11201 |
} |
| 11202 |
const style = targetDocument.createElement("style"); |
| 11203 |
style.setAttribute(STYLE_HASH_ATTRIBUTE12, hash); |
| 11204 |
style.appendChild(targetDocument.createTextNode(css)); |
| 11205 |
targetDocument.head.appendChild(style); |
| 11206 |
injectedStyles.add(hash); |
| 11207 |
} |
| 11208 |
function registerDocument12(targetDocument) { |
| 11209 |
const runtime = getRuntime12(); |
| 11210 |
runtime.documents.set( |
| 11211 |
targetDocument, |
| 11212 |
(runtime.documents.get(targetDocument) ?? 0) + 1 |
| 11213 |
); |
| 11214 |
for (const [hash, css] of runtime.styles) { |
| 11215 |
injectStyle12(targetDocument, hash, css); |
| 11216 |
} |
| 11217 |
return () => { |
| 11218 |
const count = runtime.documents.get(targetDocument); |
| 11219 |
if (count === void 0) { |
| 11220 |
return; |
| 11221 |
} |
| 11222 |
if (count <= 1) { |
| 11223 |
runtime.documents.delete(targetDocument); |
| 11224 |
return; |
| 11225 |
} |
| 11226 |
runtime.documents.set(targetDocument, count - 1); |
| 11227 |
}; |
| 11228 |
} |
| 11229 |
function registerStyle12(hash, css) { |
| 11230 |
const runtime = getRuntime12(); |
| 11231 |
runtime.styles.set(hash, css); |
| 11232 |
for (const targetDocument of runtime.documents.keys()) { |
| 11233 |
injectStyle12(targetDocument, hash, css); |
| 11234 |
} |
| 11235 |
} |
| 11236 |
if (typeof process === "undefined" || true) { |
| 11237 |
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)}}}"); |
| 11238 |
} |
| 11239 |
var style_default11 = { "root": "_02872bf298eadc43__root", "header": "bbccc92e6ba5662d__header", "content": "_5dffdaf2a6e669ac__content", "fullbleed": "c1fa192587e1b4a6__fullbleed" }; |
| 11240 |
var Content = (0, import_element25.forwardRef)( |
| 11241 |
function CardContent({ render, ...props }, ref) { |
| 11242 |
const element = useRender({ |
| 11243 |
defaultTagName: "div", |
| 11244 |
render, |
| 11245 |
ref, |
| 11246 |
props: mergeProps({ className: style_default11.content }, props) |
| 11247 |
}); |
| 11248 |
return element; |
| 11249 |
} |
| 11250 |
); |
| 11251 |
|
| 11252 |
// packages/ui/build-module/card/full-bleed.mjs |
| 11253 |
var import_element26 = __toESM(require_element(), 1); |
| 11254 |
var STYLE_HASH_ATTRIBUTE13 = "data-wp-hash"; |
| 11255 |
function getRuntime13() { |
| 11256 |
const globalScope = globalThis; |
| 11257 |
if (globalScope.__wpStyleRuntime) { |
| 11258 |
return globalScope.__wpStyleRuntime; |
| 11259 |
} |
| 11260 |
globalScope.__wpStyleRuntime = { |
| 11261 |
documents: /* @__PURE__ */ new Map(), |
| 11262 |
styles: /* @__PURE__ */ new Map(), |
| 11263 |
injectedStyles: /* @__PURE__ */ new WeakMap() |
| 11264 |
}; |
| 11265 |
if (typeof document !== "undefined") { |
| 11266 |
registerDocument13(document); |
| 11267 |
} |
| 11268 |
return globalScope.__wpStyleRuntime; |
| 11269 |
} |
| 11270 |
function documentContainsStyleHash13(targetDocument, hash) { |
| 11271 |
if (!targetDocument.head) { |
| 11272 |
return false; |
| 11273 |
} |
| 11274 |
for (const style of targetDocument.head.querySelectorAll( |
| 11275 |
`style[${STYLE_HASH_ATTRIBUTE13}]` |
| 11276 |
)) { |
| 11277 |
if (style.getAttribute(STYLE_HASH_ATTRIBUTE13) === hash) { |
| 11278 |
return true; |
| 11279 |
} |
| 11280 |
} |
| 11281 |
return false; |
| 11282 |
} |
| 11283 |
function injectStyle13(targetDocument, hash, css) { |
| 11284 |
if (!targetDocument.head) { |
| 11285 |
return; |
| 11286 |
} |
| 11287 |
const runtime = getRuntime13(); |
| 11288 |
let injectedStyles = runtime.injectedStyles.get(targetDocument); |
| 11289 |
if (!injectedStyles) { |
| 11290 |
injectedStyles = /* @__PURE__ */ new Set(); |
| 11291 |
runtime.injectedStyles.set(targetDocument, injectedStyles); |
| 11292 |
} |
| 11293 |
if (injectedStyles.has(hash)) { |
| 11294 |
return; |
| 11295 |
} |
| 11296 |
if (documentContainsStyleHash13(targetDocument, hash)) { |
| 11297 |
injectedStyles.add(hash); |
| 11298 |
return; |
| 11299 |
} |
| 11300 |
const style = targetDocument.createElement("style"); |
| 11301 |
style.setAttribute(STYLE_HASH_ATTRIBUTE13, hash); |
| 11302 |
style.appendChild(targetDocument.createTextNode(css)); |
| 11303 |
targetDocument.head.appendChild(style); |
| 11304 |
injectedStyles.add(hash); |
| 11305 |
} |
| 11306 |
function registerDocument13(targetDocument) { |
| 11307 |
const runtime = getRuntime13(); |
| 11308 |
runtime.documents.set( |
| 11309 |
targetDocument, |
| 11310 |
(runtime.documents.get(targetDocument) ?? 0) + 1 |
| 11311 |
); |
| 11312 |
for (const [hash, css] of runtime.styles) { |
| 11313 |
injectStyle13(targetDocument, hash, css); |
| 11314 |
} |
| 11315 |
return () => { |
| 11316 |
const count = runtime.documents.get(targetDocument); |
| 11317 |
if (count === void 0) { |
| 11318 |
return; |
| 11319 |
} |
| 11320 |
if (count <= 1) { |
| 11321 |
runtime.documents.delete(targetDocument); |
| 11322 |
return; |
| 11323 |
} |
| 11324 |
runtime.documents.set(targetDocument, count - 1); |
| 11325 |
}; |
| 11326 |
} |
| 11327 |
function registerStyle13(hash, css) { |
| 11328 |
const runtime = getRuntime13(); |
| 11329 |
runtime.styles.set(hash, css); |
| 11330 |
for (const targetDocument of runtime.documents.keys()) { |
| 11331 |
injectStyle13(targetDocument, hash, css); |
| 11332 |
} |
| 11333 |
} |
| 11334 |
if (typeof process === "undefined" || true) { |
| 11335 |
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)}}}"); |
| 11336 |
} |
| 11337 |
var style_default12 = { "root": "_02872bf298eadc43__root", "header": "bbccc92e6ba5662d__header", "content": "_5dffdaf2a6e669ac__content", "fullbleed": "c1fa192587e1b4a6__fullbleed" }; |
| 11338 |
var FullBleed = (0, import_element26.forwardRef)( |
| 11339 |
function CardFullBleed({ render, ...props }, ref) { |
| 11340 |
const element = useRender({ |
| 11341 |
defaultTagName: "div", |
| 11342 |
render, |
| 11343 |
ref, |
| 11344 |
props: mergeProps( |
| 11345 |
{ className: style_default12.fullbleed }, |
| 11346 |
props |
| 11347 |
) |
| 11348 |
}); |
| 11349 |
return element; |
| 11350 |
} |
| 11351 |
); |
| 11352 |
|
| 11353 |
// packages/ui/build-module/card/title.mjs |
| 11354 |
var import_element27 = __toESM(require_element(), 1); |
| 11355 |
var import_jsx_runtime36 = __toESM(require_jsx_runtime(), 1); |
| 11356 |
var DEFAULT_TAG = /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", {}); |
| 11357 |
var Title = (0, import_element27.forwardRef)( |
| 11358 |
function CardTitle({ render = DEFAULT_TAG, children, ...props }, ref) { |
| 11359 |
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)( |
| 11360 |
Text, |
| 11361 |
{ |
| 11362 |
ref, |
| 11363 |
variant: "heading-lg", |
| 11364 |
render, |
| 11365 |
...props, |
| 11366 |
children |
| 11367 |
} |
| 11368 |
); |
| 11369 |
} |
| 11370 |
); |
| 11371 |
|
| 11372 |
// packages/ui/build-module/collapsible/panel.mjs |
| 11373 |
var import_element28 = __toESM(require_element(), 1); |
| 11374 |
var import_jsx_runtime37 = __toESM(require_jsx_runtime(), 1); |
| 11375 |
var Panel = (0, import_element28.forwardRef)( |
| 11376 |
function CollapsiblePanel3(props, forwardedRef) { |
| 11377 |
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(index_parts_exports.Panel, { ref: forwardedRef, ...props }); |
| 11378 |
} |
| 11379 |
); |
| 11380 |
|
| 11381 |
// packages/ui/build-module/collapsible/root.mjs |
| 11382 |
var import_element29 = __toESM(require_element(), 1); |
| 11383 |
var import_jsx_runtime38 = __toESM(require_jsx_runtime(), 1); |
| 11384 |
var Root3 = (0, import_element29.forwardRef)( |
| 11385 |
function CollapsibleRoot3(props, forwardedRef) { |
| 11386 |
return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(index_parts_exports.Root, { ref: forwardedRef, ...props }); |
| 11387 |
} |
| 11388 |
); |
| 11389 |
|
| 11390 |
// packages/ui/build-module/collapsible/trigger.mjs |
| 11391 |
var import_element30 = __toESM(require_element(), 1); |
| 11392 |
var import_jsx_runtime39 = __toESM(require_jsx_runtime(), 1); |
| 11393 |
var Trigger2 = (0, import_element30.forwardRef)( |
| 11394 |
function CollapsibleTrigger3(props, forwardedRef) { |
| 11395 |
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(index_parts_exports.Trigger, { ref: forwardedRef, ...props }); |
| 11396 |
} |
| 11397 |
); |
| 11398 |
|
| 11399 |
// packages/ui/build-module/collapsible-card/index.mjs |
| 11400 |
var collapsible_card_exports = {}; |
| 11401 |
__export(collapsible_card_exports, { |
| 11402 |
Content: () => Content2, |
| 11403 |
Header: () => Header2, |
| 11404 |
HeaderDescription: () => HeaderDescription, |
| 11405 |
Root: () => Root32 |
| 11406 |
}); |
| 11407 |
|
| 11408 |
// packages/ui/build-module/collapsible-card/root.mjs |
| 11409 |
var import_element31 = __toESM(require_element(), 1); |
| 11410 |
var import_jsx_runtime40 = __toESM(require_jsx_runtime(), 1); |
| 11411 |
var Root32 = (0, import_element31.forwardRef)( |
| 11412 |
function CollapsibleCardRoot({ render, ...restProps }, ref) { |
| 11413 |
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)( |
| 11414 |
Root3, |
| 11415 |
{ |
| 11416 |
ref, |
| 11417 |
render: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Root2, { render }), |
| 11418 |
...restProps |
| 11419 |
} |
| 11420 |
); |
| 11421 |
} |
| 11422 |
); |
| 11423 |
|
| 11424 |
// packages/ui/build-module/collapsible-card/header.mjs |
| 11425 |
var import_compose = __toESM(require_compose(), 1); |
| 11426 |
var import_element33 = __toESM(require_element(), 1); |
| 11427 |
|
| 11428 |
// packages/ui/build-module/collapsible-card/context.mjs |
| 11429 |
var import_element32 = __toESM(require_element(), 1); |
| 11430 |
var HeaderDescriptionIdContext = (0, import_element32.createContext)(null); |
| 11431 |
|
| 11432 |
// packages/ui/build-module/collapsible-card/header.mjs |
| 11433 |
var import_jsx_runtime41 = __toESM(require_jsx_runtime(), 1); |
| 11434 |
var STYLE_HASH_ATTRIBUTE14 = "data-wp-hash"; |
| 11435 |
function getRuntime14() { |
| 11436 |
const globalScope = globalThis; |
| 11437 |
if (globalScope.__wpStyleRuntime) { |
| 11438 |
return globalScope.__wpStyleRuntime; |
| 11439 |
} |
| 11440 |
globalScope.__wpStyleRuntime = { |
| 11441 |
documents: /* @__PURE__ */ new Map(), |
| 11442 |
styles: /* @__PURE__ */ new Map(), |
| 11443 |
injectedStyles: /* @__PURE__ */ new WeakMap() |
| 11444 |
}; |
| 11445 |
if (typeof document !== "undefined") { |
| 11446 |
registerDocument14(document); |
| 11447 |
} |
| 11448 |
return globalScope.__wpStyleRuntime; |
| 11449 |
} |
| 11450 |
function documentContainsStyleHash14(targetDocument, hash) { |
| 11451 |
if (!targetDocument.head) { |
| 11452 |
return false; |
| 11453 |
} |
| 11454 |
for (const style of targetDocument.head.querySelectorAll( |
| 11455 |
`style[${STYLE_HASH_ATTRIBUTE14}]` |
| 11456 |
)) { |
| 11457 |
if (style.getAttribute(STYLE_HASH_ATTRIBUTE14) === hash) { |
| 11458 |
return true; |
| 11459 |
} |
| 11460 |
} |
| 11461 |
return false; |
| 11462 |
} |
| 11463 |
function injectStyle14(targetDocument, hash, css) { |
| 11464 |
if (!targetDocument.head) { |
| 11465 |
return; |
| 11466 |
} |
| 11467 |
const runtime = getRuntime14(); |
| 11468 |
let injectedStyles = runtime.injectedStyles.get(targetDocument); |
| 11469 |
if (!injectedStyles) { |
| 11470 |
injectedStyles = /* @__PURE__ */ new Set(); |
| 11471 |
runtime.injectedStyles.set(targetDocument, injectedStyles); |
| 11472 |
} |
| 11473 |
if (injectedStyles.has(hash)) { |
| 11474 |
return; |
| 11475 |
} |
| 11476 |
if (documentContainsStyleHash14(targetDocument, hash)) { |
| 11477 |
injectedStyles.add(hash); |
| 11478 |
return; |
| 11479 |
} |
| 11480 |
const style = targetDocument.createElement("style"); |
| 11481 |
style.setAttribute(STYLE_HASH_ATTRIBUTE14, hash); |
| 11482 |
style.appendChild(targetDocument.createTextNode(css)); |
| 11483 |
targetDocument.head.appendChild(style); |
| 11484 |
injectedStyles.add(hash); |
| 11485 |
} |
| 11486 |
function registerDocument14(targetDocument) { |
| 11487 |
const runtime = getRuntime14(); |
| 11488 |
runtime.documents.set( |
| 11489 |
targetDocument, |
| 11490 |
(runtime.documents.get(targetDocument) ?? 0) + 1 |
| 11491 |
); |
| 11492 |
for (const [hash, css] of runtime.styles) { |
| 11493 |
injectStyle14(targetDocument, hash, css); |
| 11494 |
} |
| 11495 |
return () => { |
| 11496 |
const count = runtime.documents.get(targetDocument); |
| 11497 |
if (count === void 0) { |
| 11498 |
return; |
| 11499 |
} |
| 11500 |
if (count <= 1) { |
| 11501 |
runtime.documents.delete(targetDocument); |
| 11502 |
return; |
| 11503 |
} |
| 11504 |
runtime.documents.set(targetDocument, count - 1); |
| 11505 |
}; |
| 11506 |
} |
| 11507 |
function registerStyle14(hash, css) { |
| 11508 |
const runtime = getRuntime14(); |
| 11509 |
runtime.styles.set(hash, css); |
| 11510 |
for (const targetDocument of runtime.documents.keys()) { |
| 11511 |
injectStyle14(targetDocument, hash, css); |
| 11512 |
} |
| 11513 |
} |
| 11514 |
if (typeof process === "undefined" || true) { |
| 11515 |
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)}}}}"); |
| 11516 |
} |
| 11517 |
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" }; |
| 11518 |
if (typeof process === "undefined" || true) { |
| 11519 |
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)}"); |
| 11520 |
} |
| 11521 |
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" }; |
| 11522 |
if (typeof process === "undefined" || true) { |
| 11523 |
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))}}}"); |
| 11524 |
} |
| 11525 |
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" }; |
| 11526 |
var Header2 = (0, import_element33.forwardRef)( |
| 11527 |
function CollapsibleCardHeader({ |
| 11528 |
children, |
| 11529 |
className, |
| 11530 |
render, |
| 11531 |
"aria-describedby": ariaDescribedByProp, |
| 11532 |
...restProps |
| 11533 |
}, ref) { |
| 11534 |
const [descriptionIds, setDescriptionIds] = (0, import_element33.useState)( |
| 11535 |
[] |
| 11536 |
); |
| 11537 |
const [orderedDescriptionIds, setOrderedDescriptionIds] = (0, import_element33.useState)([]); |
| 11538 |
const headerContentRef = (0, import_element33.useRef)(null); |
| 11539 |
const registerDescriptionId = (0, import_element33.useCallback)((id) => { |
| 11540 |
setDescriptionIds((currentDescriptionIds) => { |
| 11541 |
if (currentDescriptionIds.includes(id)) { |
| 11542 |
return currentDescriptionIds; |
| 11543 |
} |
| 11544 |
return [...currentDescriptionIds, id]; |
| 11545 |
}); |
| 11546 |
return () => { |
| 11547 |
setDescriptionIds( |
| 11548 |
(currentDescriptionIds) => currentDescriptionIds.filter( |
| 11549 |
(descriptionId) => descriptionId !== id |
| 11550 |
) |
| 11551 |
); |
| 11552 |
}; |
| 11553 |
}, []); |
| 11554 |
const contextValue = (0, import_element33.useMemo)( |
| 11555 |
() => ({ registerDescriptionId }), |
| 11556 |
[registerDescriptionId] |
| 11557 |
); |
| 11558 |
(0, import_compose.useIsomorphicLayoutEffect)(() => { |
| 11559 |
const registeredDescriptionIds = new Set(descriptionIds); |
| 11560 |
const nextDescriptionIds = Array.from( |
| 11561 |
headerContentRef.current?.querySelectorAll("[id]") ?? [] |
| 11562 |
).map((element) => element.id).filter((id) => registeredDescriptionIds.has(id)); |
| 11563 |
setOrderedDescriptionIds((currentDescriptionIds) => { |
| 11564 |
if (currentDescriptionIds.length === nextDescriptionIds.length && currentDescriptionIds.every( |
| 11565 |
(id, index2) => id === nextDescriptionIds[index2] |
| 11566 |
)) { |
| 11567 |
return currentDescriptionIds; |
| 11568 |
} |
| 11569 |
return nextDescriptionIds; |
| 11570 |
}); |
| 11571 |
}); |
| 11572 |
const ariaDescribedBy = Array.from( |
| 11573 |
/* @__PURE__ */ new Set([ |
| 11574 |
...ariaDescribedByProp?.split(/\s+/).filter(Boolean) ?? [], |
| 11575 |
...orderedDescriptionIds |
| 11576 |
]) |
| 11577 |
).join(" ") || void 0; |
| 11578 |
return useRender({ |
| 11579 |
defaultTagName: "div", |
| 11580 |
render, |
| 11581 |
ref, |
| 11582 |
props: mergeProps(restProps, { |
| 11583 |
className: clsx_default( |
| 11584 |
global_css_defense_default4.heading, |
| 11585 |
style_default13["heading-wrapper"], |
| 11586 |
className |
| 11587 |
), |
| 11588 |
children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(HeaderDescriptionIdContext.Provider, { value: contextValue, children: /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)( |
| 11589 |
Trigger2, |
| 11590 |
{ |
| 11591 |
className: style_default13.header, |
| 11592 |
render: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Header, {}), |
| 11593 |
nativeButton: false, |
| 11594 |
"aria-describedby": ariaDescribedBy, |
| 11595 |
children: [ |
| 11596 |
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)( |
| 11597 |
"div", |
| 11598 |
{ |
| 11599 |
ref: headerContentRef, |
| 11600 |
className: style_default13["header-content"], |
| 11601 |
children |
| 11602 |
} |
| 11603 |
), |
| 11604 |
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)( |
| 11605 |
"div", |
| 11606 |
{ |
| 11607 |
className: clsx_default( |
| 11608 |
style_default13["header-trigger-positioner"] |
| 11609 |
), |
| 11610 |
children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)( |
| 11611 |
"div", |
| 11612 |
{ |
| 11613 |
className: clsx_default( |
| 11614 |
style_default13["header-trigger-wrapper"], |
| 11615 |
global_css_defense_default4.div, |
| 11616 |
// While the interactive trigger element is the whole header, |
| 11617 |
// the focus ring will be displayed only on the icon to visually |
| 11618 |
// emulate it being the button. |
| 11619 |
focus_module_default3["outset-ring--focus-parent-visible"] |
| 11620 |
), |
| 11621 |
children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)( |
| 11622 |
Icon, |
| 11623 |
{ |
| 11624 |
icon: chevron_down_default, |
| 11625 |
className: style_default13["header-trigger"] |
| 11626 |
} |
| 11627 |
) |
| 11628 |
} |
| 11629 |
) |
| 11630 |
} |
| 11631 |
) |
| 11632 |
] |
| 11633 |
} |
| 11634 |
) }) |
| 11635 |
}) |
| 11636 |
}); |
| 11637 |
} |
| 11638 |
); |
| 11639 |
|
| 11640 |
// packages/ui/build-module/collapsible-card/header-description.mjs |
| 11641 |
var import_element34 = __toESM(require_element(), 1); |
| 11642 |
var import_jsx_runtime42 = __toESM(require_jsx_runtime(), 1); |
| 11643 |
var STYLE_HASH_ATTRIBUTE15 = "data-wp-hash"; |
| 11644 |
function getRuntime15() { |
| 11645 |
const globalScope = globalThis; |
| 11646 |
if (globalScope.__wpStyleRuntime) { |
| 11647 |
return globalScope.__wpStyleRuntime; |
| 11648 |
} |
| 11649 |
globalScope.__wpStyleRuntime = { |
| 11650 |
documents: /* @__PURE__ */ new Map(), |
| 11651 |
styles: /* @__PURE__ */ new Map(), |
| 11652 |
injectedStyles: /* @__PURE__ */ new WeakMap() |
| 11653 |
}; |
| 11654 |
if (typeof document !== "undefined") { |
| 11655 |
registerDocument15(document); |
| 11656 |
} |
| 11657 |
return globalScope.__wpStyleRuntime; |
| 11658 |
} |
| 11659 |
function documentContainsStyleHash15(targetDocument, hash) { |
| 11660 |
if (!targetDocument.head) { |
| 11661 |
return false; |
| 11662 |
} |
| 11663 |
for (const style of targetDocument.head.querySelectorAll( |
| 11664 |
`style[${STYLE_HASH_ATTRIBUTE15}]` |
| 11665 |
)) { |
| 11666 |
if (style.getAttribute(STYLE_HASH_ATTRIBUTE15) === hash) { |
| 11667 |
return true; |
| 11668 |
} |
| 11669 |
} |
| 11670 |
return false; |
| 11671 |
} |
| 11672 |
function injectStyle15(targetDocument, hash, css) { |
| 11673 |
if (!targetDocument.head) { |
| 11674 |
return; |
| 11675 |
} |
| 11676 |
const runtime = getRuntime15(); |
| 11677 |
let injectedStyles = runtime.injectedStyles.get(targetDocument); |
| 11678 |
if (!injectedStyles) { |
| 11679 |
injectedStyles = /* @__PURE__ */ new Set(); |
| 11680 |
runtime.injectedStyles.set(targetDocument, injectedStyles); |
| 11681 |
} |
| 11682 |
if (injectedStyles.has(hash)) { |
| 11683 |
return; |
| 11684 |
} |
| 11685 |
if (documentContainsStyleHash15(targetDocument, hash)) { |
| 11686 |
injectedStyles.add(hash); |
| 11687 |
return; |
| 11688 |
} |
| 11689 |
const style = targetDocument.createElement("style"); |
| 11690 |
style.setAttribute(STYLE_HASH_ATTRIBUTE15, hash); |
| 11691 |
style.appendChild(targetDocument.createTextNode(css)); |
| 11692 |
targetDocument.head.appendChild(style); |
| 11693 |
injectedStyles.add(hash); |
| 11694 |
} |
| 11695 |
function registerDocument15(targetDocument) { |
| 11696 |
const runtime = getRuntime15(); |
| 11697 |
runtime.documents.set( |
| 11698 |
targetDocument, |
| 11699 |
(runtime.documents.get(targetDocument) ?? 0) + 1 |
| 11700 |
); |
| 11701 |
for (const [hash, css] of runtime.styles) { |
| 11702 |
injectStyle15(targetDocument, hash, css); |
| 11703 |
} |
| 11704 |
return () => { |
| 11705 |
const count = runtime.documents.get(targetDocument); |
| 11706 |
if (count === void 0) { |
| 11707 |
return; |
| 11708 |
} |
| 11709 |
if (count <= 1) { |
| 11710 |
runtime.documents.delete(targetDocument); |
| 11711 |
return; |
| 11712 |
} |
| 11713 |
runtime.documents.set(targetDocument, count - 1); |
| 11714 |
}; |
| 11715 |
} |
| 11716 |
function registerStyle15(hash, css) { |
| 11717 |
const runtime = getRuntime15(); |
| 11718 |
runtime.styles.set(hash, css); |
| 11719 |
for (const targetDocument of runtime.documents.keys()) { |
| 11720 |
injectStyle15(targetDocument, hash, css); |
| 11721 |
} |
| 11722 |
} |
| 11723 |
if (typeof process === "undefined" || true) { |
| 11724 |
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)}}}}"); |
| 11725 |
} |
| 11726 |
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" }; |
| 11727 |
var DEFAULT_TAG2 = /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", {}); |
| 11728 |
var HeaderDescription = (0, import_element34.forwardRef)(function CollapsibleCardHeaderDescription({ children, className, id: idProp, render = DEFAULT_TAG2, ...restProps }, ref) { |
| 11729 |
const generatedId = (0, import_element34.useId)(); |
| 11730 |
const descriptionId = idProp ?? generatedId; |
| 11731 |
const context = (0, import_element34.useContext)(HeaderDescriptionIdContext); |
| 11732 |
if (!context) { |
| 11733 |
throw new Error( |
| 11734 |
"CollapsibleCard.HeaderDescription: Missing parent <CollapsibleCard.Header>. Render <CollapsibleCard.HeaderDescription> inside <CollapsibleCard.Header>." |
| 11735 |
); |
| 11736 |
} |
| 11737 |
(0, import_element34.useEffect)(() => { |
| 11738 |
return context?.registerDescriptionId(descriptionId); |
| 11739 |
}, [context, descriptionId]); |
| 11740 |
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)( |
| 11741 |
Text, |
| 11742 |
{ |
| 11743 |
ref, |
| 11744 |
variant: "body-md", |
| 11745 |
render, |
| 11746 |
id: descriptionId, |
| 11747 |
"aria-hidden": "true", |
| 11748 |
className: clsx_default(style_default14["header-description"], className), |
| 11749 |
...restProps, |
| 11750 |
children |
| 11751 |
} |
| 11752 |
); |
| 11753 |
}); |
| 11754 |
|
| 11755 |
// packages/ui/build-module/collapsible-card/content.mjs |
| 11756 |
var import_element35 = __toESM(require_element(), 1); |
| 11757 |
var import_jsx_runtime43 = __toESM(require_jsx_runtime(), 1); |
| 11758 |
var STYLE_HASH_ATTRIBUTE16 = "data-wp-hash"; |
| 11759 |
function getRuntime16() { |
| 11760 |
const globalScope = globalThis; |
| 11761 |
if (globalScope.__wpStyleRuntime) { |
| 11762 |
return globalScope.__wpStyleRuntime; |
| 11763 |
} |
| 11764 |
globalScope.__wpStyleRuntime = { |
| 11765 |
documents: /* @__PURE__ */ new Map(), |
| 11766 |
styles: /* @__PURE__ */ new Map(), |
| 11767 |
injectedStyles: /* @__PURE__ */ new WeakMap() |
| 11768 |
}; |
| 11769 |
if (typeof document !== "undefined") { |
| 11770 |
registerDocument16(document); |
| 11771 |
} |
| 11772 |
return globalScope.__wpStyleRuntime; |
| 11773 |
} |
| 11774 |
function documentContainsStyleHash16(targetDocument, hash) { |
| 11775 |
if (!targetDocument.head) { |
| 11776 |
return false; |
| 11777 |
} |
| 11778 |
for (const style of targetDocument.head.querySelectorAll( |
| 11779 |
`style[${STYLE_HASH_ATTRIBUTE16}]` |
| 11780 |
)) { |
| 11781 |
if (style.getAttribute(STYLE_HASH_ATTRIBUTE16) === hash) { |
| 11782 |
return true; |
| 11783 |
} |
| 11784 |
} |
| 11785 |
return false; |
| 11786 |
} |
| 11787 |
function injectStyle16(targetDocument, hash, css) { |
| 11788 |
if (!targetDocument.head) { |
| 11789 |
return; |
| 11790 |
} |
| 11791 |
const runtime = getRuntime16(); |
| 11792 |
let injectedStyles = runtime.injectedStyles.get(targetDocument); |
| 11793 |
if (!injectedStyles) { |
| 11794 |
injectedStyles = /* @__PURE__ */ new Set(); |
| 11795 |
runtime.injectedStyles.set(targetDocument, injectedStyles); |
| 11796 |
} |
| 11797 |
if (injectedStyles.has(hash)) { |
| 11798 |
return; |
| 11799 |
} |
| 11800 |
if (documentContainsStyleHash16(targetDocument, hash)) { |
| 11801 |
injectedStyles.add(hash); |
| 11802 |
return; |
| 11803 |
} |
| 11804 |
const style = targetDocument.createElement("style"); |
| 11805 |
style.setAttribute(STYLE_HASH_ATTRIBUTE16, hash); |
| 11806 |
style.appendChild(targetDocument.createTextNode(css)); |
| 11807 |
targetDocument.head.appendChild(style); |
| 11808 |
injectedStyles.add(hash); |
| 11809 |
} |
| 11810 |
function registerDocument16(targetDocument) { |
| 11811 |
const runtime = getRuntime16(); |
| 11812 |
runtime.documents.set( |
| 11813 |
targetDocument, |
| 11814 |
(runtime.documents.get(targetDocument) ?? 0) + 1 |
| 11815 |
); |
| 11816 |
for (const [hash, css] of runtime.styles) { |
| 11817 |
injectStyle16(targetDocument, hash, css); |
| 11818 |
} |
| 11819 |
return () => { |
| 11820 |
const count = runtime.documents.get(targetDocument); |
| 11821 |
if (count === void 0) { |
| 11822 |
return; |
| 11823 |
} |
| 11824 |
if (count <= 1) { |
| 11825 |
runtime.documents.delete(targetDocument); |
| 11826 |
return; |
| 11827 |
} |
| 11828 |
runtime.documents.set(targetDocument, count - 1); |
| 11829 |
}; |
| 11830 |
} |
| 11831 |
function registerStyle16(hash, css) { |
| 11832 |
const runtime = getRuntime16(); |
| 11833 |
runtime.styles.set(hash, css); |
| 11834 |
for (const targetDocument of runtime.documents.keys()) { |
| 11835 |
injectStyle16(targetDocument, hash, css); |
| 11836 |
} |
| 11837 |
} |
| 11838 |
if (typeof process === "undefined" || true) { |
| 11839 |
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)}}}}"); |
| 11840 |
} |
| 11841 |
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" }; |
| 11842 |
var Content2 = (0, import_element35.forwardRef)( |
| 11843 |
function CollapsibleCardContent({ className, render, children, hiddenUntilFound = true, ...restProps }, ref) { |
| 11844 |
return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)( |
| 11845 |
Panel, |
| 11846 |
{ |
| 11847 |
ref, |
| 11848 |
className: (state) => clsx_default( |
| 11849 |
style_default15.content, |
| 11850 |
state.open && state.transitionStatus === "idle" && style_default15["overflow-visible"], |
| 11851 |
className |
| 11852 |
), |
| 11853 |
hiddenUntilFound, |
| 11854 |
...restProps, |
| 11855 |
children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)( |
| 11856 |
Content, |
| 11857 |
{ |
| 11858 |
className: style_default15["content-inner"], |
| 11859 |
render, |
| 11860 |
children |
| 11861 |
} |
| 11862 |
) |
| 11863 |
} |
| 11864 |
); |
| 11865 |
} |
| 11866 |
); |
| 11867 |
|
| 11868 |
// packages/ui/build-module/stack/stack.mjs |
| 11869 |
var import_element36 = __toESM(require_element(), 1); |
| 11870 |
var STYLE_HASH_ATTRIBUTE17 = "data-wp-hash"; |
| 11871 |
function getRuntime17() { |
| 11872 |
const globalScope = globalThis; |
| 11873 |
if (globalScope.__wpStyleRuntime) { |
| 11874 |
return globalScope.__wpStyleRuntime; |
| 11875 |
} |
| 11876 |
globalScope.__wpStyleRuntime = { |
| 11877 |
documents: /* @__PURE__ */ new Map(), |
| 11878 |
styles: /* @__PURE__ */ new Map(), |
| 11879 |
injectedStyles: /* @__PURE__ */ new WeakMap() |
| 11880 |
}; |
| 11881 |
if (typeof document !== "undefined") { |
| 11882 |
registerDocument17(document); |
| 11883 |
} |
| 11884 |
return globalScope.__wpStyleRuntime; |
| 11885 |
} |
| 11886 |
function documentContainsStyleHash17(targetDocument, hash) { |
| 11887 |
if (!targetDocument.head) { |
| 11888 |
return false; |
| 11889 |
} |
| 11890 |
for (const style of targetDocument.head.querySelectorAll( |
| 11891 |
`style[${STYLE_HASH_ATTRIBUTE17}]` |
| 11892 |
)) { |
| 11893 |
if (style.getAttribute(STYLE_HASH_ATTRIBUTE17) === hash) { |
| 11894 |
return true; |
| 11895 |
} |
| 11896 |
} |
| 11897 |
return false; |
| 11898 |
} |
| 11899 |
function injectStyle17(targetDocument, hash, css) { |
| 11900 |
if (!targetDocument.head) { |
| 11901 |
return; |
| 11902 |
} |
| 11903 |
const runtime = getRuntime17(); |
| 11904 |
let injectedStyles = runtime.injectedStyles.get(targetDocument); |
| 11905 |
if (!injectedStyles) { |
| 11906 |
injectedStyles = /* @__PURE__ */ new Set(); |
| 11907 |
runtime.injectedStyles.set(targetDocument, injectedStyles); |
| 11908 |
} |
| 11909 |
if (injectedStyles.has(hash)) { |
| 11910 |
return; |
| 11911 |
} |
| 11912 |
if (documentContainsStyleHash17(targetDocument, hash)) { |
| 11913 |
injectedStyles.add(hash); |
| 11914 |
return; |
| 11915 |
} |
| 11916 |
const style = targetDocument.createElement("style"); |
| 11917 |
style.setAttribute(STYLE_HASH_ATTRIBUTE17, hash); |
| 11918 |
style.appendChild(targetDocument.createTextNode(css)); |
| 11919 |
targetDocument.head.appendChild(style); |
| 11920 |
injectedStyles.add(hash); |
| 11921 |
} |
| 11922 |
function registerDocument17(targetDocument) { |
| 11923 |
const runtime = getRuntime17(); |
| 11924 |
runtime.documents.set( |
| 11925 |
targetDocument, |
| 11926 |
(runtime.documents.get(targetDocument) ?? 0) + 1 |
| 11927 |
); |
| 11928 |
for (const [hash, css] of runtime.styles) { |
| 11929 |
injectStyle17(targetDocument, hash, css); |
| 11930 |
} |
| 11931 |
return () => { |
| 11932 |
const count = runtime.documents.get(targetDocument); |
| 11933 |
if (count === void 0) { |
| 11934 |
return; |
| 11935 |
} |
| 11936 |
if (count <= 1) { |
| 11937 |
runtime.documents.delete(targetDocument); |
| 11938 |
return; |
| 11939 |
} |
| 11940 |
runtime.documents.set(targetDocument, count - 1); |
| 11941 |
}; |
| 11942 |
} |
| 11943 |
function registerStyle17(hash, css) { |
| 11944 |
const runtime = getRuntime17(); |
| 11945 |
runtime.styles.set(hash, css); |
| 11946 |
for (const targetDocument of runtime.documents.keys()) { |
| 11947 |
injectStyle17(targetDocument, hash, css); |
| 11948 |
} |
| 11949 |
} |
| 11950 |
if (typeof process === "undefined" || true) { |
| 11951 |
registerStyle17("32aba35fe1", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._19ce0419607e1896__stack{display:flex}}}"); |
| 11952 |
} |
| 11953 |
var style_default16 = { "stack": "_19ce0419607e1896__stack" }; |
| 11954 |
var gapTokens = { |
| 11955 |
xs: "var(--wpds-dimension-gap-xs, 4px)", |
| 11956 |
sm: "var(--wpds-dimension-gap-sm, 8px)", |
| 11957 |
md: "var(--wpds-dimension-gap-md, 12px)", |
| 11958 |
lg: "var(--wpds-dimension-gap-lg, 16px)", |
| 11959 |
xl: "var(--wpds-dimension-gap-xl, 24px)", |
| 11960 |
"2xl": "var(--wpds-dimension-gap-2xl, 32px)", |
| 11961 |
"3xl": "var(--wpds-dimension-gap-3xl, 40px)" |
| 11962 |
}; |
| 11963 |
var Stack = (0, import_element36.forwardRef)(function Stack2({ direction, gap, align, justify, wrap, render, ...props }, ref) { |
| 11964 |
const style = { |
| 11965 |
gap: gap && gapTokens[gap], |
| 11966 |
alignItems: align, |
| 11967 |
justifyContent: justify, |
| 11968 |
flexDirection: direction, |
| 11969 |
flexWrap: wrap |
| 11970 |
}; |
| 11971 |
const element = useRender({ |
| 11972 |
render, |
| 11973 |
ref, |
| 11974 |
props: mergeProps(props, { style, className: style_default16.stack }) |
| 11975 |
}); |
| 11976 |
return element; |
| 11977 |
}); |
| 11978 |
|
| 11979 |
// packages/ui/build-module/notice/index.mjs |
| 11980 |
var notice_exports = {}; |
| 11981 |
__export(notice_exports, { |
| 11982 |
ActionButton: () => ActionButton, |
| 11983 |
ActionLink: () => ActionLink, |
| 11984 |
Actions: () => Actions, |
| 11985 |
CloseIcon: () => CloseIcon, |
| 11986 |
Description: () => Description, |
| 11987 |
Root: () => Root4, |
| 11988 |
Title: () => Title2 |
| 11989 |
}); |
| 11990 |
|
| 11991 |
// packages/ui/build-module/notice/root.mjs |
| 11992 |
var import_a11y2 = __toESM(require_a11y(), 1); |
| 11993 |
var import_element37 = __toESM(require_element(), 1); |
| 11994 |
var import_jsx_runtime44 = __toESM(require_jsx_runtime(), 1); |
| 11995 |
var STYLE_HASH_ATTRIBUTE18 = "data-wp-hash"; |
| 11996 |
function getRuntime18() { |
| 11997 |
const globalScope = globalThis; |
| 11998 |
if (globalScope.__wpStyleRuntime) { |
| 11999 |
return globalScope.__wpStyleRuntime; |
| 12000 |
} |
| 12001 |
globalScope.__wpStyleRuntime = { |
| 12002 |
documents: /* @__PURE__ */ new Map(), |
| 12003 |
styles: /* @__PURE__ */ new Map(), |
| 12004 |
injectedStyles: /* @__PURE__ */ new WeakMap() |
| 12005 |
}; |
| 12006 |
if (typeof document !== "undefined") { |
| 12007 |
registerDocument18(document); |
| 12008 |
} |
| 12009 |
return globalScope.__wpStyleRuntime; |
| 12010 |
} |
| 12011 |
function documentContainsStyleHash18(targetDocument, hash) { |
| 12012 |
if (!targetDocument.head) { |
| 12013 |
return false; |
| 12014 |
} |
| 12015 |
for (const style of targetDocument.head.querySelectorAll( |
| 12016 |
`style[${STYLE_HASH_ATTRIBUTE18}]` |
| 12017 |
)) { |
| 12018 |
if (style.getAttribute(STYLE_HASH_ATTRIBUTE18) === hash) { |
| 12019 |
return true; |
| 12020 |
} |
| 12021 |
} |
| 12022 |
return false; |
| 12023 |
} |
| 12024 |
function injectStyle18(targetDocument, hash, css) { |
| 12025 |
if (!targetDocument.head) { |
| 12026 |
return; |
| 12027 |
} |
| 12028 |
const runtime = getRuntime18(); |
| 12029 |
let injectedStyles = runtime.injectedStyles.get(targetDocument); |
| 12030 |
if (!injectedStyles) { |
| 12031 |
injectedStyles = /* @__PURE__ */ new Set(); |
| 12032 |
runtime.injectedStyles.set(targetDocument, injectedStyles); |
| 12033 |
} |
| 12034 |
if (injectedStyles.has(hash)) { |
| 12035 |
return; |
| 12036 |
} |
| 12037 |
if (documentContainsStyleHash18(targetDocument, hash)) { |
| 12038 |
injectedStyles.add(hash); |
| 12039 |
return; |
| 12040 |
} |
| 12041 |
const style = targetDocument.createElement("style"); |
| 12042 |
style.setAttribute(STYLE_HASH_ATTRIBUTE18, hash); |
| 12043 |
style.appendChild(targetDocument.createTextNode(css)); |
| 12044 |
targetDocument.head.appendChild(style); |
| 12045 |
injectedStyles.add(hash); |
| 12046 |
} |
| 12047 |
function registerDocument18(targetDocument) { |
| 12048 |
const runtime = getRuntime18(); |
| 12049 |
runtime.documents.set( |
| 12050 |
targetDocument, |
| 12051 |
(runtime.documents.get(targetDocument) ?? 0) + 1 |
| 12052 |
); |
| 12053 |
for (const [hash, css] of runtime.styles) { |
| 12054 |
injectStyle18(targetDocument, hash, css); |
| 12055 |
} |
| 12056 |
return () => { |
| 12057 |
const count = runtime.documents.get(targetDocument); |
| 12058 |
if (count === void 0) { |
| 12059 |
return; |
| 12060 |
} |
| 12061 |
if (count <= 1) { |
| 12062 |
runtime.documents.delete(targetDocument); |
| 12063 |
return; |
| 12064 |
} |
| 12065 |
runtime.documents.set(targetDocument, count - 1); |
| 12066 |
}; |
| 12067 |
} |
| 12068 |
function registerStyle18(hash, css) { |
| 12069 |
const runtime = getRuntime18(); |
| 12070 |
runtime.styles.set(hash, css); |
| 12071 |
for (const targetDocument of runtime.documents.keys()) { |
| 12072 |
injectStyle18(targetDocument, hash, css); |
| 12073 |
} |
| 12074 |
} |
| 12075 |
if (typeof process === "undefined" || true) { |
| 12076 |
registerStyle18("10f3806643", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._336cd3e4e743482f__box-sizing{box-sizing:border-box;*,:after,:before{box-sizing:inherit}}}}"); |
| 12077 |
} |
| 12078 |
var resets_default5 = { "box-sizing": "_336cd3e4e743482f__box-sizing" }; |
| 12079 |
if (typeof process === "undefined" || true) { |
| 12080 |
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))}}}"); |
| 12081 |
} |
| 12082 |
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" }; |
| 12083 |
var icons = { |
| 12084 |
neutral: null, |
| 12085 |
info: info_default, |
| 12086 |
warning: caution_default, |
| 12087 |
success: published_default, |
| 12088 |
error: error_default |
| 12089 |
}; |
| 12090 |
function getDefaultPoliteness(intent) { |
| 12091 |
return intent === "error" ? "assertive" : "polite"; |
| 12092 |
} |
| 12093 |
function safeRenderToString(message) { |
| 12094 |
if (!message) { |
| 12095 |
return void 0; |
| 12096 |
} |
| 12097 |
if (typeof message === "string") { |
| 12098 |
return message; |
| 12099 |
} |
| 12100 |
try { |
| 12101 |
return (0, import_element37.renderToString)(message); |
| 12102 |
} catch { |
| 12103 |
return void 0; |
| 12104 |
} |
| 12105 |
} |
| 12106 |
function useSpokenMessage(message, politeness) { |
| 12107 |
const spokenMessage = safeRenderToString(message); |
| 12108 |
(0, import_element37.useEffect)(() => { |
| 12109 |
if (spokenMessage) { |
| 12110 |
(0, import_a11y2.speak)(spokenMessage, politeness); |
| 12111 |
} |
| 12112 |
}, [spokenMessage, politeness]); |
| 12113 |
} |
| 12114 |
var Root4 = (0, import_element37.forwardRef)(function Notice({ |
| 12115 |
intent = "neutral", |
| 12116 |
children, |
| 12117 |
icon, |
| 12118 |
spokenMessage = children, |
| 12119 |
politeness = getDefaultPoliteness(intent), |
| 12120 |
render, |
| 12121 |
...restProps |
| 12122 |
}, ref) { |
| 12123 |
useSpokenMessage(spokenMessage, politeness); |
| 12124 |
const iconElement = icon === null ? null : icon ?? icons[intent]; |
| 12125 |
const mergedClassName = clsx_default( |
| 12126 |
style_default17.notice, |
| 12127 |
style_default17[`is-${intent}`], |
| 12128 |
resets_default5["box-sizing"] |
| 12129 |
); |
| 12130 |
const element = useRender({ |
| 12131 |
defaultTagName: "div", |
| 12132 |
render, |
| 12133 |
ref, |
| 12134 |
props: mergeProps( |
| 12135 |
{ |
| 12136 |
className: mergedClassName, |
| 12137 |
children: /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(import_jsx_runtime44.Fragment, { children: [ |
| 12138 |
children, |
| 12139 |
iconElement && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)( |
| 12140 |
Icon, |
| 12141 |
{ |
| 12142 |
className: style_default17.icon, |
| 12143 |
icon: iconElement |
| 12144 |
} |
| 12145 |
) |
| 12146 |
] }) |
| 12147 |
}, |
| 12148 |
restProps |
| 12149 |
) |
| 12150 |
}); |
| 12151 |
return element; |
| 12152 |
}); |
| 12153 |
|
| 12154 |
// packages/ui/build-module/notice/title.mjs |
| 12155 |
var import_element38 = __toESM(require_element(), 1); |
| 12156 |
var import_jsx_runtime45 = __toESM(require_jsx_runtime(), 1); |
| 12157 |
var STYLE_HASH_ATTRIBUTE19 = "data-wp-hash"; |
| 12158 |
function getRuntime19() { |
| 12159 |
const globalScope = globalThis; |
| 12160 |
if (globalScope.__wpStyleRuntime) { |
| 12161 |
return globalScope.__wpStyleRuntime; |
| 12162 |
} |
| 12163 |
globalScope.__wpStyleRuntime = { |
| 12164 |
documents: /* @__PURE__ */ new Map(), |
| 12165 |
styles: /* @__PURE__ */ new Map(), |
| 12166 |
injectedStyles: /* @__PURE__ */ new WeakMap() |
| 12167 |
}; |
| 12168 |
if (typeof document !== "undefined") { |
| 12169 |
registerDocument19(document); |
| 12170 |
} |
| 12171 |
return globalScope.__wpStyleRuntime; |
| 12172 |
} |
| 12173 |
function documentContainsStyleHash19(targetDocument, hash) { |
| 12174 |
if (!targetDocument.head) { |
| 12175 |
return false; |
| 12176 |
} |
| 12177 |
for (const style of targetDocument.head.querySelectorAll( |
| 12178 |
`style[${STYLE_HASH_ATTRIBUTE19}]` |
| 12179 |
)) { |
| 12180 |
if (style.getAttribute(STYLE_HASH_ATTRIBUTE19) === hash) { |
| 12181 |
return true; |
| 12182 |
} |
| 12183 |
} |
| 12184 |
return false; |
| 12185 |
} |
| 12186 |
function injectStyle19(targetDocument, hash, css) { |
| 12187 |
if (!targetDocument.head) { |
| 12188 |
return; |
| 12189 |
} |
| 12190 |
const runtime = getRuntime19(); |
| 12191 |
let injectedStyles = runtime.injectedStyles.get(targetDocument); |
| 12192 |
if (!injectedStyles) { |
| 12193 |
injectedStyles = /* @__PURE__ */ new Set(); |
| 12194 |
runtime.injectedStyles.set(targetDocument, injectedStyles); |
| 12195 |
} |
| 12196 |
if (injectedStyles.has(hash)) { |
| 12197 |
return; |
| 12198 |
} |
| 12199 |
if (documentContainsStyleHash19(targetDocument, hash)) { |
| 12200 |
injectedStyles.add(hash); |
| 12201 |
return; |
| 12202 |
} |
| 12203 |
const style = targetDocument.createElement("style"); |
| 12204 |
style.setAttribute(STYLE_HASH_ATTRIBUTE19, hash); |
| 12205 |
style.appendChild(targetDocument.createTextNode(css)); |
| 12206 |
targetDocument.head.appendChild(style); |
| 12207 |
injectedStyles.add(hash); |
| 12208 |
} |
| 12209 |
function registerDocument19(targetDocument) { |
| 12210 |
const runtime = getRuntime19(); |
| 12211 |
runtime.documents.set( |
| 12212 |
targetDocument, |
| 12213 |
(runtime.documents.get(targetDocument) ?? 0) + 1 |
| 12214 |
); |
| 12215 |
for (const [hash, css] of runtime.styles) { |
| 12216 |
injectStyle19(targetDocument, hash, css); |
| 12217 |
} |
| 12218 |
return () => { |
| 12219 |
const count = runtime.documents.get(targetDocument); |
| 12220 |
if (count === void 0) { |
| 12221 |
return; |
| 12222 |
} |
| 12223 |
if (count <= 1) { |
| 12224 |
runtime.documents.delete(targetDocument); |
| 12225 |
return; |
| 12226 |
} |
| 12227 |
runtime.documents.set(targetDocument, count - 1); |
| 12228 |
}; |
| 12229 |
} |
| 12230 |
function registerStyle19(hash, css) { |
| 12231 |
const runtime = getRuntime19(); |
| 12232 |
runtime.styles.set(hash, css); |
| 12233 |
for (const targetDocument of runtime.documents.keys()) { |
| 12234 |
injectStyle19(targetDocument, hash, css); |
| 12235 |
} |
| 12236 |
} |
| 12237 |
if (typeof process === "undefined" || true) { |
| 12238 |
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))}}}"); |
| 12239 |
} |
| 12240 |
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" }; |
| 12241 |
var Title2 = (0, import_element38.forwardRef)( |
| 12242 |
function NoticeTitle({ className, ...props }, ref) { |
| 12243 |
return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)( |
| 12244 |
Text, |
| 12245 |
{ |
| 12246 |
ref, |
| 12247 |
variant: "heading-md", |
| 12248 |
className: clsx_default(style_default18.title, className), |
| 12249 |
...props |
| 12250 |
} |
| 12251 |
); |
| 12252 |
} |
| 12253 |
); |
| 12254 |
|
| 12255 |
// packages/ui/build-module/notice/description.mjs |
| 12256 |
var import_element39 = __toESM(require_element(), 1); |
| 12257 |
var import_jsx_runtime46 = __toESM(require_jsx_runtime(), 1); |
| 12258 |
var STYLE_HASH_ATTRIBUTE20 = "data-wp-hash"; |
| 12259 |
function getRuntime20() { |
| 12260 |
const globalScope = globalThis; |
| 12261 |
if (globalScope.__wpStyleRuntime) { |
| 12262 |
return globalScope.__wpStyleRuntime; |
| 12263 |
} |
| 12264 |
globalScope.__wpStyleRuntime = { |
| 12265 |
documents: /* @__PURE__ */ new Map(), |
| 12266 |
styles: /* @__PURE__ */ new Map(), |
| 12267 |
injectedStyles: /* @__PURE__ */ new WeakMap() |
| 12268 |
}; |
| 12269 |
if (typeof document !== "undefined") { |
| 12270 |
registerDocument20(document); |
| 12271 |
} |
| 12272 |
return globalScope.__wpStyleRuntime; |
| 12273 |
} |
| 12274 |
function documentContainsStyleHash20(targetDocument, hash) { |
| 12275 |
if (!targetDocument.head) { |
| 12276 |
return false; |
| 12277 |
} |
| 12278 |
for (const style of targetDocument.head.querySelectorAll( |
| 12279 |
`style[${STYLE_HASH_ATTRIBUTE20}]` |
| 12280 |
)) { |
| 12281 |
if (style.getAttribute(STYLE_HASH_ATTRIBUTE20) === hash) { |
| 12282 |
return true; |
| 12283 |
} |
| 12284 |
} |
| 12285 |
return false; |
| 12286 |
} |
| 12287 |
function injectStyle20(targetDocument, hash, css) { |
| 12288 |
if (!targetDocument.head) { |
| 12289 |
return; |
| 12290 |
} |
| 12291 |
const runtime = getRuntime20(); |
| 12292 |
let injectedStyles = runtime.injectedStyles.get(targetDocument); |
| 12293 |
if (!injectedStyles) { |
| 12294 |
injectedStyles = /* @__PURE__ */ new Set(); |
| 12295 |
runtime.injectedStyles.set(targetDocument, injectedStyles); |
| 12296 |
} |
| 12297 |
if (injectedStyles.has(hash)) { |
| 12298 |
return; |
| 12299 |
} |
| 12300 |
if (documentContainsStyleHash20(targetDocument, hash)) { |
| 12301 |
injectedStyles.add(hash); |
| 12302 |
return; |
| 12303 |
} |
| 12304 |
const style = targetDocument.createElement("style"); |
| 12305 |
style.setAttribute(STYLE_HASH_ATTRIBUTE20, hash); |
| 12306 |
style.appendChild(targetDocument.createTextNode(css)); |
| 12307 |
targetDocument.head.appendChild(style); |
| 12308 |
injectedStyles.add(hash); |
| 12309 |
} |
| 12310 |
function registerDocument20(targetDocument) { |
| 12311 |
const runtime = getRuntime20(); |
| 12312 |
runtime.documents.set( |
| 12313 |
targetDocument, |
| 12314 |
(runtime.documents.get(targetDocument) ?? 0) + 1 |
| 12315 |
); |
| 12316 |
for (const [hash, css] of runtime.styles) { |
| 12317 |
injectStyle20(targetDocument, hash, css); |
| 12318 |
} |
| 12319 |
return () => { |
| 12320 |
const count = runtime.documents.get(targetDocument); |
| 12321 |
if (count === void 0) { |
| 12322 |
return; |
| 12323 |
} |
| 12324 |
if (count <= 1) { |
| 12325 |
runtime.documents.delete(targetDocument); |
| 12326 |
return; |
| 12327 |
} |
| 12328 |
runtime.documents.set(targetDocument, count - 1); |
| 12329 |
}; |
| 12330 |
} |
| 12331 |
function registerStyle20(hash, css) { |
| 12332 |
const runtime = getRuntime20(); |
| 12333 |
runtime.styles.set(hash, css); |
| 12334 |
for (const targetDocument of runtime.documents.keys()) { |
| 12335 |
injectStyle20(targetDocument, hash, css); |
| 12336 |
} |
| 12337 |
} |
| 12338 |
if (typeof process === "undefined" || true) { |
| 12339 |
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))}}}"); |
| 12340 |
} |
| 12341 |
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" }; |
| 12342 |
var Description = (0, import_element39.forwardRef)( |
| 12343 |
function NoticeDescription({ className, ...props }, ref) { |
| 12344 |
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)( |
| 12345 |
Text, |
| 12346 |
{ |
| 12347 |
ref, |
| 12348 |
variant: "body-md", |
| 12349 |
className: clsx_default(style_default19.description, className), |
| 12350 |
...props |
| 12351 |
} |
| 12352 |
); |
| 12353 |
} |
| 12354 |
); |
| 12355 |
|
| 12356 |
// packages/ui/build-module/notice/actions.mjs |
| 12357 |
var import_element40 = __toESM(require_element(), 1); |
| 12358 |
var STYLE_HASH_ATTRIBUTE21 = "data-wp-hash"; |
| 12359 |
function getRuntime21() { |
| 12360 |
const globalScope = globalThis; |
| 12361 |
if (globalScope.__wpStyleRuntime) { |
| 12362 |
return globalScope.__wpStyleRuntime; |
| 12363 |
} |
| 12364 |
globalScope.__wpStyleRuntime = { |
| 12365 |
documents: /* @__PURE__ */ new Map(), |
| 12366 |
styles: /* @__PURE__ */ new Map(), |
| 12367 |
injectedStyles: /* @__PURE__ */ new WeakMap() |
| 12368 |
}; |
| 12369 |
if (typeof document !== "undefined") { |
| 12370 |
registerDocument21(document); |
| 12371 |
} |
| 12372 |
return globalScope.__wpStyleRuntime; |
| 12373 |
} |
| 12374 |
function documentContainsStyleHash21(targetDocument, hash) { |
| 12375 |
if (!targetDocument.head) { |
| 12376 |
return false; |
| 12377 |
} |
| 12378 |
for (const style of targetDocument.head.querySelectorAll( |
| 12379 |
`style[${STYLE_HASH_ATTRIBUTE21}]` |
| 12380 |
)) { |
| 12381 |
if (style.getAttribute(STYLE_HASH_ATTRIBUTE21) === hash) { |
| 12382 |
return true; |
| 12383 |
} |
| 12384 |
} |
| 12385 |
return false; |
| 12386 |
} |
| 12387 |
function injectStyle21(targetDocument, hash, css) { |
| 12388 |
if (!targetDocument.head) { |
| 12389 |
return; |
| 12390 |
} |
| 12391 |
const runtime = getRuntime21(); |
| 12392 |
let injectedStyles = runtime.injectedStyles.get(targetDocument); |
| 12393 |
if (!injectedStyles) { |
| 12394 |
injectedStyles = /* @__PURE__ */ new Set(); |
| 12395 |
runtime.injectedStyles.set(targetDocument, injectedStyles); |
| 12396 |
} |
| 12397 |
if (injectedStyles.has(hash)) { |
| 12398 |
return; |
| 12399 |
} |
| 12400 |
if (documentContainsStyleHash21(targetDocument, hash)) { |
| 12401 |
injectedStyles.add(hash); |
| 12402 |
return; |
| 12403 |
} |
| 12404 |
const style = targetDocument.createElement("style"); |
| 12405 |
style.setAttribute(STYLE_HASH_ATTRIBUTE21, hash); |
| 12406 |
style.appendChild(targetDocument.createTextNode(css)); |
| 12407 |
targetDocument.head.appendChild(style); |
| 12408 |
injectedStyles.add(hash); |
| 12409 |
} |
| 12410 |
function registerDocument21(targetDocument) { |
| 12411 |
const runtime = getRuntime21(); |
| 12412 |
runtime.documents.set( |
| 12413 |
targetDocument, |
| 12414 |
(runtime.documents.get(targetDocument) ?? 0) + 1 |
| 12415 |
); |
| 12416 |
for (const [hash, css] of runtime.styles) { |
| 12417 |
injectStyle21(targetDocument, hash, css); |
| 12418 |
} |
| 12419 |
return () => { |
| 12420 |
const count = runtime.documents.get(targetDocument); |
| 12421 |
if (count === void 0) { |
| 12422 |
return; |
| 12423 |
} |
| 12424 |
if (count <= 1) { |
| 12425 |
runtime.documents.delete(targetDocument); |
| 12426 |
return; |
| 12427 |
} |
| 12428 |
runtime.documents.set(targetDocument, count - 1); |
| 12429 |
}; |
| 12430 |
} |
| 12431 |
function registerStyle21(hash, css) { |
| 12432 |
const runtime = getRuntime21(); |
| 12433 |
runtime.styles.set(hash, css); |
| 12434 |
for (const targetDocument of runtime.documents.keys()) { |
| 12435 |
injectStyle21(targetDocument, hash, css); |
| 12436 |
} |
| 12437 |
} |
| 12438 |
if (typeof process === "undefined" || true) { |
| 12439 |
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))}}}"); |
| 12440 |
} |
| 12441 |
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" }; |
| 12442 |
var Actions = (0, import_element40.forwardRef)( |
| 12443 |
function NoticeActions({ render, ...props }, ref) { |
| 12444 |
const element = useRender({ |
| 12445 |
defaultTagName: "div", |
| 12446 |
render, |
| 12447 |
ref, |
| 12448 |
props: mergeProps( |
| 12449 |
{ |
| 12450 |
className: style_default20.actions |
| 12451 |
}, |
| 12452 |
props |
| 12453 |
) |
| 12454 |
}); |
| 12455 |
return element; |
| 12456 |
} |
| 12457 |
); |
| 12458 |
|
| 12459 |
// packages/ui/build-module/notice/close-icon.mjs |
| 12460 |
var import_element41 = __toESM(require_element(), 1); |
| 12461 |
var import_i18n5 = __toESM(require_i18n(), 1); |
| 12462 |
var import_jsx_runtime47 = __toESM(require_jsx_runtime(), 1); |
| 12463 |
var STYLE_HASH_ATTRIBUTE22 = "data-wp-hash"; |
| 12464 |
function getRuntime22() { |
| 12465 |
const globalScope = globalThis; |
| 12466 |
if (globalScope.__wpStyleRuntime) { |
| 12467 |
return globalScope.__wpStyleRuntime; |
| 12468 |
} |
| 12469 |
globalScope.__wpStyleRuntime = { |
| 12470 |
documents: /* @__PURE__ */ new Map(), |
| 12471 |
styles: /* @__PURE__ */ new Map(), |
| 12472 |
injectedStyles: /* @__PURE__ */ new WeakMap() |
| 12473 |
}; |
| 12474 |
if (typeof document !== "undefined") { |
| 12475 |
registerDocument22(document); |
| 12476 |
} |
| 12477 |
return globalScope.__wpStyleRuntime; |
| 12478 |
} |
| 12479 |
function documentContainsStyleHash22(targetDocument, hash) { |
| 12480 |
if (!targetDocument.head) { |
| 12481 |
return false; |
| 12482 |
} |
| 12483 |
for (const style of targetDocument.head.querySelectorAll( |
| 12484 |
`style[${STYLE_HASH_ATTRIBUTE22}]` |
| 12485 |
)) { |
| 12486 |
if (style.getAttribute(STYLE_HASH_ATTRIBUTE22) === hash) { |
| 12487 |
return true; |
| 12488 |
} |
| 12489 |
} |
| 12490 |
return false; |
| 12491 |
} |
| 12492 |
function injectStyle22(targetDocument, hash, css) { |
| 12493 |
if (!targetDocument.head) { |
| 12494 |
return; |
| 12495 |
} |
| 12496 |
const runtime = getRuntime22(); |
| 12497 |
let injectedStyles = runtime.injectedStyles.get(targetDocument); |
| 12498 |
if (!injectedStyles) { |
| 12499 |
injectedStyles = /* @__PURE__ */ new Set(); |
| 12500 |
runtime.injectedStyles.set(targetDocument, injectedStyles); |
| 12501 |
} |
| 12502 |
if (injectedStyles.has(hash)) { |
| 12503 |
return; |
| 12504 |
} |
| 12505 |
if (documentContainsStyleHash22(targetDocument, hash)) { |
| 12506 |
injectedStyles.add(hash); |
| 12507 |
return; |
| 12508 |
} |
| 12509 |
const style = targetDocument.createElement("style"); |
| 12510 |
style.setAttribute(STYLE_HASH_ATTRIBUTE22, hash); |
| 12511 |
style.appendChild(targetDocument.createTextNode(css)); |
| 12512 |
targetDocument.head.appendChild(style); |
| 12513 |
injectedStyles.add(hash); |
| 12514 |
} |
| 12515 |
function registerDocument22(targetDocument) { |
| 12516 |
const runtime = getRuntime22(); |
| 12517 |
runtime.documents.set( |
| 12518 |
targetDocument, |
| 12519 |
(runtime.documents.get(targetDocument) ?? 0) + 1 |
| 12520 |
); |
| 12521 |
for (const [hash, css] of runtime.styles) { |
| 12522 |
injectStyle22(targetDocument, hash, css); |
| 12523 |
} |
| 12524 |
return () => { |
| 12525 |
const count = runtime.documents.get(targetDocument); |
| 12526 |
if (count === void 0) { |
| 12527 |
return; |
| 12528 |
} |
| 12529 |
if (count <= 1) { |
| 12530 |
runtime.documents.delete(targetDocument); |
| 12531 |
return; |
| 12532 |
} |
| 12533 |
runtime.documents.set(targetDocument, count - 1); |
| 12534 |
}; |
| 12535 |
} |
| 12536 |
function registerStyle22(hash, css) { |
| 12537 |
const runtime = getRuntime22(); |
| 12538 |
runtime.styles.set(hash, css); |
| 12539 |
for (const targetDocument of runtime.documents.keys()) { |
| 12540 |
injectStyle22(targetDocument, hash, css); |
| 12541 |
} |
| 12542 |
} |
| 12543 |
if (typeof process === "undefined" || true) { |
| 12544 |
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))}}}"); |
| 12545 |
} |
| 12546 |
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" }; |
| 12547 |
var CloseIcon = (0, import_element41.forwardRef)( |
| 12548 |
function NoticeCloseIcon({ className, icon = close_small_default, label = (0, import_i18n5.__)("Dismiss"), ...props }, ref) { |
| 12549 |
return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)( |
| 12550 |
IconButton, |
| 12551 |
{ |
| 12552 |
...props, |
| 12553 |
ref, |
| 12554 |
className: clsx_default(style_default21["close-icon"], className), |
| 12555 |
variant: "minimal", |
| 12556 |
size: "small", |
| 12557 |
tone: "neutral", |
| 12558 |
icon, |
| 12559 |
label |
| 12560 |
} |
| 12561 |
); |
| 12562 |
} |
| 12563 |
); |
| 12564 |
|
| 12565 |
// packages/ui/build-module/notice/action-button.mjs |
| 12566 |
var import_element42 = __toESM(require_element(), 1); |
| 12567 |
var import_jsx_runtime48 = __toESM(require_jsx_runtime(), 1); |
| 12568 |
var STYLE_HASH_ATTRIBUTE23 = "data-wp-hash"; |
| 12569 |
function getRuntime23() { |
| 12570 |
const globalScope = globalThis; |
| 12571 |
if (globalScope.__wpStyleRuntime) { |
| 12572 |
return globalScope.__wpStyleRuntime; |
| 12573 |
} |
| 12574 |
globalScope.__wpStyleRuntime = { |
| 12575 |
documents: /* @__PURE__ */ new Map(), |
| 12576 |
styles: /* @__PURE__ */ new Map(), |
| 12577 |
injectedStyles: /* @__PURE__ */ new WeakMap() |
| 12578 |
}; |
| 12579 |
if (typeof document !== "undefined") { |
| 12580 |
registerDocument23(document); |
| 12581 |
} |
| 12582 |
return globalScope.__wpStyleRuntime; |
| 12583 |
} |
| 12584 |
function documentContainsStyleHash23(targetDocument, hash) { |
| 12585 |
if (!targetDocument.head) { |
| 12586 |
return false; |
| 12587 |
} |
| 12588 |
for (const style of targetDocument.head.querySelectorAll( |
| 12589 |
`style[${STYLE_HASH_ATTRIBUTE23}]` |
| 12590 |
)) { |
| 12591 |
if (style.getAttribute(STYLE_HASH_ATTRIBUTE23) === hash) { |
| 12592 |
return true; |
| 12593 |
} |
| 12594 |
} |
| 12595 |
return false; |
| 12596 |
} |
| 12597 |
function injectStyle23(targetDocument, hash, css) { |
| 12598 |
if (!targetDocument.head) { |
| 12599 |
return; |
| 12600 |
} |
| 12601 |
const runtime = getRuntime23(); |
| 12602 |
let injectedStyles = runtime.injectedStyles.get(targetDocument); |
| 12603 |
if (!injectedStyles) { |
| 12604 |
injectedStyles = /* @__PURE__ */ new Set(); |
| 12605 |
runtime.injectedStyles.set(targetDocument, injectedStyles); |
| 12606 |
} |
| 12607 |
if (injectedStyles.has(hash)) { |
| 12608 |
return; |
| 12609 |
} |
| 12610 |
if (documentContainsStyleHash23(targetDocument, hash)) { |
| 12611 |
injectedStyles.add(hash); |
| 12612 |
return; |
| 12613 |
} |
| 12614 |
const style = targetDocument.createElement("style"); |
| 12615 |
style.setAttribute(STYLE_HASH_ATTRIBUTE23, hash); |
| 12616 |
style.appendChild(targetDocument.createTextNode(css)); |
| 12617 |
targetDocument.head.appendChild(style); |
| 12618 |
injectedStyles.add(hash); |
| 12619 |
} |
| 12620 |
function registerDocument23(targetDocument) { |
| 12621 |
const runtime = getRuntime23(); |
| 12622 |
runtime.documents.set( |
| 12623 |
targetDocument, |
| 12624 |
(runtime.documents.get(targetDocument) ?? 0) + 1 |
| 12625 |
); |
| 12626 |
for (const [hash, css] of runtime.styles) { |
| 12627 |
injectStyle23(targetDocument, hash, css); |
| 12628 |
} |
| 12629 |
return () => { |
| 12630 |
const count = runtime.documents.get(targetDocument); |
| 12631 |
if (count === void 0) { |
| 12632 |
return; |
| 12633 |
} |
| 12634 |
if (count <= 1) { |
| 12635 |
runtime.documents.delete(targetDocument); |
| 12636 |
return; |
| 12637 |
} |
| 12638 |
runtime.documents.set(targetDocument, count - 1); |
| 12639 |
}; |
| 12640 |
} |
| 12641 |
function registerStyle23(hash, css) { |
| 12642 |
const runtime = getRuntime23(); |
| 12643 |
runtime.styles.set(hash, css); |
| 12644 |
for (const targetDocument of runtime.documents.keys()) { |
| 12645 |
injectStyle23(targetDocument, hash, css); |
| 12646 |
} |
| 12647 |
} |
| 12648 |
if (typeof process === "undefined" || true) { |
| 12649 |
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))}}}"); |
| 12650 |
} |
| 12651 |
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" }; |
| 12652 |
var ActionButton = (0, import_element42.forwardRef)( |
| 12653 |
function NoticeActionButton({ className, loading, loadingAnnouncement, variant, ...props }, ref) { |
| 12654 |
const loadingProps = loading !== void 0 ? { loading, loadingAnnouncement: loadingAnnouncement ?? "" } : {}; |
| 12655 |
return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)( |
| 12656 |
Button4, |
| 12657 |
{ |
| 12658 |
...props, |
| 12659 |
...loadingProps, |
| 12660 |
ref, |
| 12661 |
size: "compact", |
| 12662 |
tone: "neutral", |
| 12663 |
variant, |
| 12664 |
className: clsx_default( |
| 12665 |
style_default22["action-button"], |
| 12666 |
style_default22[`is-action-button-${variant}`], |
| 12667 |
className |
| 12668 |
) |
| 12669 |
} |
| 12670 |
); |
| 12671 |
} |
| 12672 |
); |
| 12673 |
|
| 12674 |
// packages/ui/build-module/notice/action-link.mjs |
| 12675 |
var import_element43 = __toESM(require_element(), 1); |
| 12676 |
var import_jsx_runtime49 = __toESM(require_jsx_runtime(), 1); |
| 12677 |
var STYLE_HASH_ATTRIBUTE24 = "data-wp-hash"; |
| 12678 |
function getRuntime24() { |
| 12679 |
const globalScope = globalThis; |
| 12680 |
if (globalScope.__wpStyleRuntime) { |
| 12681 |
return globalScope.__wpStyleRuntime; |
| 12682 |
} |
| 12683 |
globalScope.__wpStyleRuntime = { |
| 12684 |
documents: /* @__PURE__ */ new Map(), |
| 12685 |
styles: /* @__PURE__ */ new Map(), |
| 12686 |
injectedStyles: /* @__PURE__ */ new WeakMap() |
| 12687 |
}; |
| 12688 |
if (typeof document !== "undefined") { |
| 12689 |
registerDocument24(document); |
| 12690 |
} |
| 12691 |
return globalScope.__wpStyleRuntime; |
| 12692 |
} |
| 12693 |
function documentContainsStyleHash24(targetDocument, hash) { |
| 12694 |
if (!targetDocument.head) { |
| 12695 |
return false; |
| 12696 |
} |
| 12697 |
for (const style of targetDocument.head.querySelectorAll( |
| 12698 |
`style[${STYLE_HASH_ATTRIBUTE24}]` |
| 12699 |
)) { |
| 12700 |
if (style.getAttribute(STYLE_HASH_ATTRIBUTE24) === hash) { |
| 12701 |
return true; |
| 12702 |
} |
| 12703 |
} |
| 12704 |
return false; |
| 12705 |
} |
| 12706 |
function injectStyle24(targetDocument, hash, css) { |
| 12707 |
if (!targetDocument.head) { |
| 12708 |
return; |
| 12709 |
} |
| 12710 |
const runtime = getRuntime24(); |
| 12711 |
let injectedStyles = runtime.injectedStyles.get(targetDocument); |
| 12712 |
if (!injectedStyles) { |
| 12713 |
injectedStyles = /* @__PURE__ */ new Set(); |
| 12714 |
runtime.injectedStyles.set(targetDocument, injectedStyles); |
| 12715 |
} |
| 12716 |
if (injectedStyles.has(hash)) { |
| 12717 |
return; |
| 12718 |
} |
| 12719 |
if (documentContainsStyleHash24(targetDocument, hash)) { |
| 12720 |
injectedStyles.add(hash); |
| 12721 |
return; |
| 12722 |
} |
| 12723 |
const style = targetDocument.createElement("style"); |
| 12724 |
style.setAttribute(STYLE_HASH_ATTRIBUTE24, hash); |
| 12725 |
style.appendChild(targetDocument.createTextNode(css)); |
| 12726 |
targetDocument.head.appendChild(style); |
| 12727 |
injectedStyles.add(hash); |
| 12728 |
} |
| 12729 |
function registerDocument24(targetDocument) { |
| 12730 |
const runtime = getRuntime24(); |
| 12731 |
runtime.documents.set( |
| 12732 |
targetDocument, |
| 12733 |
(runtime.documents.get(targetDocument) ?? 0) + 1 |
| 12734 |
); |
| 12735 |
for (const [hash, css] of runtime.styles) { |
| 12736 |
injectStyle24(targetDocument, hash, css); |
| 12737 |
} |
| 12738 |
return () => { |
| 12739 |
const count = runtime.documents.get(targetDocument); |
| 12740 |
if (count === void 0) { |
| 12741 |
return; |
| 12742 |
} |
| 12743 |
if (count <= 1) { |
| 12744 |
runtime.documents.delete(targetDocument); |
| 12745 |
return; |
| 12746 |
} |
| 12747 |
runtime.documents.set(targetDocument, count - 1); |
| 12748 |
}; |
| 12749 |
} |
| 12750 |
function registerStyle24(hash, css) { |
| 12751 |
const runtime = getRuntime24(); |
| 12752 |
runtime.styles.set(hash, css); |
| 12753 |
for (const targetDocument of runtime.documents.keys()) { |
| 12754 |
injectStyle24(targetDocument, hash, css); |
| 12755 |
} |
| 12756 |
} |
| 12757 |
if (typeof process === "undefined" || true) { |
| 12758 |
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))}}}"); |
| 12759 |
} |
| 12760 |
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" }; |
| 12761 |
var ActionLink = (0, import_element43.forwardRef)( |
| 12762 |
function NoticeActionLink({ className, render, ...props }, ref) { |
| 12763 |
return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)( |
| 12764 |
Text, |
| 12765 |
{ |
| 12766 |
ref, |
| 12767 |
className: clsx_default(style_default23["action-link"], className), |
| 12768 |
...props, |
| 12769 |
variant: "body-md", |
| 12770 |
render: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(Link, { tone: "neutral", variant: "default", render }) |
| 12771 |
} |
| 12772 |
); |
| 12773 |
} |
| 12774 |
); |
| 12775 |
|
| 12776 |
// packages/admin-ui/build-module/admin-theme-colors/index.mjs |
| 12777 |
var DEFAULT_THEME_COLORS = { |
| 12778 |
primary: "#3858e9", |
| 12779 |
background: "#222524" |
| 12780 |
}; |
| 12781 |
var ADMIN_THEME_COLORS = /* @__PURE__ */ new Map([ |
| 12782 |
["modern", DEFAULT_THEME_COLORS], |
| 12783 |
["fresh", { primary: "#007cba", background: "#25292b" }], |
| 12784 |
["midnight", { primary: "#cf4339", background: "#3d4042" }], |
| 12785 |
["coffee", { primary: "#916745", background: "#5b534d" }], |
| 12786 |
["ocean", { primary: "#567958", background: "#5f787f" }], |
| 12787 |
["blue", { primary: "#437aa8", background: "#3876a8" }], |
| 12788 |
["ectoplasm", { primary: "#646c3e", background: "#4f386e" }], |
| 12789 |
["sunrise", { primary: "#ad631e", background: "#cc4541" }], |
| 12790 |
["light", { primary: "#007cba", background: "#eaeeed" }] |
| 12791 |
]); |
| 12792 |
function getAdminThemeColors() { |
| 12793 |
const scheme = document.body.className.match(/admin-color-([\w-]+)/)?.[1] ?? "modern"; |
| 12794 |
return ADMIN_THEME_COLORS.get(scheme) ?? DEFAULT_THEME_COLORS; |
| 12795 |
} |
| 12796 |
|
| 12797 |
// packages/customize-widgets/build-module/components/customize-widgets/index.mjs |
| 12798 |
var import_element59 = __toESM(require_element(), 1); |
| 12799 |
var import_components7 = __toESM(require_components(), 1); |
| 12800 |
var import_theme = __toESM(require_theme(), 1); |
| 12801 |
|
| 12802 |
// packages/customize-widgets/build-module/components/error-boundary/index.mjs |
| 12803 |
var import_element44 = __toESM(require_element(), 1); |
| 12804 |
var import_i18n6 = __toESM(require_i18n(), 1); |
| 12805 |
var import_compose2 = __toESM(require_compose(), 1); |
| 12806 |
var import_hooks = __toESM(require_hooks(), 1); |
| 12807 |
var import_jsx_runtime50 = __toESM(require_jsx_runtime(), 1); |
| 12808 |
function getErrorName(error2) { |
| 12809 |
return error2 instanceof Error && error2.name || "Error"; |
| 12810 |
} |
| 12811 |
function getErrorMessage(error2) { |
| 12812 |
if (typeof error2 === "string" && error2) { |
| 12813 |
return error2; |
| 12814 |
} |
| 12815 |
if (typeof error2?.message === "string" && error2.message) { |
| 12816 |
return error2.message; |
| 12817 |
} |
| 12818 |
return "An unknown error occurred."; |
| 12819 |
} |
| 12820 |
function getErrorSections(error2, componentStack) { |
| 12821 |
const sections = [ |
| 12822 |
{ label: getErrorName(error2), content: getErrorMessage(error2) } |
| 12823 |
]; |
| 12824 |
if (error2?.stack) { |
| 12825 |
sections.push({ |
| 12826 |
label: "Stack", |
| 12827 |
content: error2.stack.trim(), |
| 12828 |
preformatted: true |
| 12829 |
}); |
| 12830 |
} |
| 12831 |
if (componentStack) { |
| 12832 |
sections.push({ |
| 12833 |
label: "Component stack", |
| 12834 |
content: componentStack.trim(), |
| 12835 |
preformatted: true |
| 12836 |
}); |
| 12837 |
} |
| 12838 |
sections.push({ |
| 12839 |
label: "Environment", |
| 12840 |
content: `User agent: ${window.navigator.userAgent}`, |
| 12841 |
preformatted: true |
| 12842 |
}); |
| 12843 |
return sections; |
| 12844 |
} |
| 12845 |
function getErrorReport(error2, componentStack) { |
| 12846 |
const sections = getErrorSections(error2, componentStack).map( |
| 12847 |
({ label, content, preformatted }) => `**${label}** |
| 12848 |
|
| 12849 |
${preformatted ? `\`\`\` |
| 12850 |
${content} |
| 12851 |
\`\`\`` : content}` |
| 12852 |
); |
| 12853 |
return ["### Error report", ...sections].join("\n\n"); |
| 12854 |
} |
| 12855 |
function CopyButton({ text, children, variant = "outline" }) { |
| 12856 |
const ref = (0, import_compose2.useCopyToClipboard)(text); |
| 12857 |
return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(notice_exports.ActionButton, { variant, ref, children }); |
| 12858 |
} |
| 12859 |
function ErrorReport({ error: error2, componentStack }) { |
| 12860 |
return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)( |
| 12861 |
Stack, |
| 12862 |
{ |
| 12863 |
className: "customize-widgets-error-boundary__report", |
| 12864 |
direction: "column", |
| 12865 |
gap: "md", |
| 12866 |
children: getErrorSections(error2, componentStack).map( |
| 12867 |
({ label, content }) => /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(Stack, { direction: "column", gap: "xs", children: [ |
| 12868 |
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(Text, { variant: "heading-md", children: label }), |
| 12869 |
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)("pre", { className: "customize-widgets-error-boundary__report-section", children: content }) |
| 12870 |
] }, label) |
| 12871 |
) |
| 12872 |
} |
| 12873 |
); |
| 12874 |
} |
| 12875 |
function ErrorDetails({ error: error2, componentStack }) { |
| 12876 |
return /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(collapsible_card_exports.Root, { className: "customize-widgets-error-boundary__details", children: [ |
| 12877 |
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(collapsible_card_exports.Header, { children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(card_exports.Title, { children: (0, import_i18n6.__)("Error details") }) }), |
| 12878 |
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(collapsible_card_exports.Content, { children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)( |
| 12879 |
ErrorReport, |
| 12880 |
{ |
| 12881 |
error: error2, |
| 12882 |
componentStack |
| 12883 |
} |
| 12884 |
) }) |
| 12885 |
] }); |
| 12886 |
} |
| 12887 |
var ErrorBoundary = class extends import_element44.Component { |
| 12888 |
constructor() { |
| 12889 |
super(...arguments); |
| 12890 |
this.state = { |
| 12891 |
error: null, |
| 12892 |
componentStack: null |
| 12893 |
}; |
| 12894 |
} |
| 12895 |
componentDidCatch(error2, errorInfo) { |
| 12896 |
this.setState({ componentStack: errorInfo?.componentStack }); |
| 12897 |
(0, import_hooks.doAction)("editor.ErrorBoundary.errorLogged", error2, errorInfo); |
| 12898 |
} |
| 12899 |
static getDerivedStateFromError(error2) { |
| 12900 |
return { error: error2 }; |
| 12901 |
} |
| 12902 |
render() { |
| 12903 |
const { error: error2, componentStack } = this.state; |
| 12904 |
if (!error2) { |
| 12905 |
return this.props.children; |
| 12906 |
} |
| 12907 |
return /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)( |
| 12908 |
Stack, |
| 12909 |
{ |
| 12910 |
className: "customize-widgets-error-boundary", |
| 12911 |
direction: "column", |
| 12912 |
gap: "lg", |
| 12913 |
children: [ |
| 12914 |
/* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(notice_exports.Root, { intent: "error", children: [ |
| 12915 |
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(notice_exports.Title, { children: (0, import_i18n6.__)("The editor has crashed") }), |
| 12916 |
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(notice_exports.Description, { children: (0, import_i18n6.__)( |
| 12917 |
"An unknown error occurred. Reload your browser to try again, or copy the error to report the problem or search." |
| 12918 |
) }), |
| 12919 |
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(notice_exports.Actions, { children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)( |
| 12920 |
CopyButton, |
| 12921 |
{ |
| 12922 |
variant: "solid", |
| 12923 |
text: () => getErrorReport(error2, componentStack), |
| 12924 |
children: (0, import_i18n6.__)("Copy error") |
| 12925 |
} |
| 12926 |
) }) |
| 12927 |
] }), |
| 12928 |
true ? /* @__PURE__ */ (0, import_jsx_runtime50.jsx)( |
| 12929 |
ErrorDetails, |
| 12930 |
{ |
| 12931 |
error: error2, |
| 12932 |
componentStack |
| 12933 |
} |
| 12934 |
) : null |
| 12935 |
] |
| 12936 |
} |
| 12937 |
); |
| 12938 |
} |
| 12939 |
}; |
| 12940 |
|
| 12941 |
// packages/customize-widgets/build-module/components/sidebar-block-editor/index.mjs |
| 12942 |
var import_compose4 = __toESM(require_compose(), 1); |
| 12943 |
var import_core_data = __toESM(require_core_data(), 1); |
| 12944 |
var import_data13 = __toESM(require_data(), 1); |
| 12945 |
var import_element56 = __toESM(require_element(), 1); |
| 12946 |
var import_block_editor8 = __toESM(require_block_editor(), 1); |
| 12947 |
var import_media_utils = __toESM(require_media_utils(), 1); |
| 12948 |
var import_preferences3 = __toESM(require_preferences(), 1); |
| 12949 |
|
| 12950 |
// packages/customize-widgets/build-module/components/block-inspector-button/index.mjs |
| 12951 |
var import_element45 = __toESM(require_element(), 1); |
| 12952 |
var import_i18n7 = __toESM(require_i18n(), 1); |
| 12953 |
var import_components = __toESM(require_components(), 1); |
| 12954 |
var import_data = __toESM(require_data(), 1); |
| 12955 |
var import_block_editor = __toESM(require_block_editor(), 1); |
| 12956 |
var import_jsx_runtime51 = __toESM(require_jsx_runtime(), 1); |
| 12957 |
function BlockInspectorButton({ inspector, closeMenu, ...props }) { |
| 12958 |
const selectedBlockClientId = (0, import_data.useSelect)( |
| 12959 |
(select) => select(import_block_editor.store).getSelectedBlockClientId(), |
| 12960 |
[] |
| 12961 |
); |
| 12962 |
const selectedBlock = (0, import_element45.useMemo)( |
| 12963 |
() => document.getElementById(`block-${selectedBlockClientId}`), |
| 12964 |
[selectedBlockClientId] |
| 12965 |
); |
| 12966 |
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)( |
| 12967 |
import_components.MenuItem, |
| 12968 |
{ |
| 12969 |
onClick: () => { |
| 12970 |
inspector.open({ |
| 12971 |
returnFocusWhenClose: selectedBlock |
| 12972 |
}); |
| 12973 |
closeMenu(); |
| 12974 |
}, |
| 12975 |
...props, |
| 12976 |
children: (0, import_i18n7.__)("Show more settings") |
| 12977 |
} |
| 12978 |
); |
| 12979 |
} |
| 12980 |
var block_inspector_button_default = BlockInspectorButton; |
| 12981 |
|
| 12982 |
// packages/customize-widgets/build-module/components/header/index.mjs |
| 12983 |
var import_components5 = __toESM(require_components(), 1); |
| 12984 |
var import_block_editor3 = __toESM(require_block_editor(), 1); |
| 12985 |
var import_element49 = __toESM(require_element(), 1); |
| 12986 |
var import_keycodes3 = __toESM(require_keycodes(), 1); |
| 12987 |
var import_i18n12 = __toESM(require_i18n(), 1); |
| 12988 |
|
| 12989 |
// packages/customize-widgets/build-module/components/inserter/index.mjs |
| 12990 |
var import_i18n8 = __toESM(require_i18n(), 1); |
| 12991 |
var import_block_editor2 = __toESM(require_block_editor(), 1); |
| 12992 |
var import_components2 = __toESM(require_components(), 1); |
| 12993 |
var import_compose3 = __toESM(require_compose(), 1); |
| 12994 |
var import_data4 = __toESM(require_data(), 1); |
| 12995 |
|
| 12996 |
// packages/customize-widgets/build-module/store/index.mjs |
| 12997 |
var import_data3 = __toESM(require_data(), 1); |
| 12998 |
|
| 12999 |
// packages/customize-widgets/build-module/store/reducer.mjs |
| 13000 |
var import_data2 = __toESM(require_data(), 1); |
| 13001 |
function blockInserterPanel(state = false, action) { |
| 13002 |
switch (action.type) { |
| 13003 |
case "SET_IS_INSERTER_OPENED": |
| 13004 |
return action.value; |
| 13005 |
} |
| 13006 |
return state; |
| 13007 |
} |
| 13008 |
var reducer_default = (0, import_data2.combineReducers)({ |
| 13009 |
blockInserterPanel |
| 13010 |
}); |
| 13011 |
|
| 13012 |
// packages/customize-widgets/build-module/store/selectors.mjs |
| 13013 |
var selectors_exports = {}; |
| 13014 |
__export(selectors_exports, { |
| 13015 |
__experimentalGetInsertionPoint: () => __experimentalGetInsertionPoint, |
| 13016 |
isInserterOpened: () => isInserterOpened |
| 13017 |
}); |
| 13018 |
var EMPTY_INSERTION_POINT = { |
| 13019 |
rootClientId: void 0, |
| 13020 |
insertionIndex: void 0 |
| 13021 |
}; |
| 13022 |
function isInserterOpened(state) { |
| 13023 |
return !!state.blockInserterPanel; |
| 13024 |
} |
| 13025 |
function __experimentalGetInsertionPoint(state) { |
| 13026 |
if (typeof state.blockInserterPanel === "boolean") { |
| 13027 |
return EMPTY_INSERTION_POINT; |
| 13028 |
} |
| 13029 |
return state.blockInserterPanel; |
| 13030 |
} |
| 13031 |
|
| 13032 |
// packages/customize-widgets/build-module/store/actions.mjs |
| 13033 |
var actions_exports = {}; |
| 13034 |
__export(actions_exports, { |
| 13035 |
setIsInserterOpened: () => setIsInserterOpened |
| 13036 |
}); |
| 13037 |
function setIsInserterOpened(value) { |
| 13038 |
return { |
| 13039 |
type: "SET_IS_INSERTER_OPENED", |
| 13040 |
value |
| 13041 |
}; |
| 13042 |
} |
| 13043 |
|
| 13044 |
// packages/customize-widgets/build-module/store/constants.mjs |
| 13045 |
var STORE_NAME = "core/customize-widgets"; |
| 13046 |
|
| 13047 |
// packages/customize-widgets/build-module/store/index.mjs |
| 13048 |
var storeConfig = { |
| 13049 |
reducer: reducer_default, |
| 13050 |
selectors: selectors_exports, |
| 13051 |
actions: actions_exports |
| 13052 |
}; |
| 13053 |
var store = (0, import_data3.createReduxStore)(STORE_NAME, storeConfig); |
| 13054 |
(0, import_data3.register)(store); |
| 13055 |
|
| 13056 |
// packages/customize-widgets/build-module/components/inserter/index.mjs |
| 13057 |
var import_jsx_runtime52 = __toESM(require_jsx_runtime(), 1); |
| 13058 |
function Inserter({ setIsOpened }) { |
| 13059 |
const inserterTitleId = (0, import_compose3.useInstanceId)( |
| 13060 |
Inserter, |
| 13061 |
"customize-widget-layout__inserter-panel-title" |
| 13062 |
); |
| 13063 |
const insertionPoint = (0, import_data4.useSelect)( |
| 13064 |
(select) => select(store).__experimentalGetInsertionPoint(), |
| 13065 |
[] |
| 13066 |
); |
| 13067 |
return /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)( |
| 13068 |
"div", |
| 13069 |
{ |
| 13070 |
className: "customize-widgets-layout__inserter-panel", |
| 13071 |
"aria-labelledby": inserterTitleId, |
| 13072 |
children: [ |
| 13073 |
/* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("div", { className: "customize-widgets-layout__inserter-panel-header", children: [ |
| 13074 |
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)( |
| 13075 |
"h2", |
| 13076 |
{ |
| 13077 |
id: inserterTitleId, |
| 13078 |
className: "customize-widgets-layout__inserter-panel-header-title", |
| 13079 |
children: (0, import_i18n8.__)("Add a block") |
| 13080 |
} |
| 13081 |
), |
| 13082 |
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)( |
| 13083 |
import_components2.Button, |
| 13084 |
{ |
| 13085 |
size: "small", |
| 13086 |
icon: close_small_default, |
| 13087 |
onClick: () => setIsOpened(false), |
| 13088 |
"aria-label": (0, import_i18n8.__)("Close inserter") |
| 13089 |
} |
| 13090 |
) |
| 13091 |
] }), |
| 13092 |
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)("div", { className: "customize-widgets-layout__inserter-panel-content", children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)( |
| 13093 |
import_block_editor2.__experimentalLibrary, |
| 13094 |
{ |
| 13095 |
rootClientId: insertionPoint.rootClientId, |
| 13096 |
__experimentalInsertionIndex: insertionPoint.insertionIndex, |
| 13097 |
showInserterHelpPanel: true, |
| 13098 |
onSelect: () => setIsOpened(false) |
| 13099 |
} |
| 13100 |
) }) |
| 13101 |
] |
| 13102 |
} |
| 13103 |
); |
| 13104 |
} |
| 13105 |
var inserter_default = Inserter; |
| 13106 |
|
| 13107 |
// packages/customize-widgets/build-module/components/more-menu/index.mjs |
| 13108 |
var import_components4 = __toESM(require_components(), 1); |
| 13109 |
var import_data7 = __toESM(require_data(), 1); |
| 13110 |
var import_element48 = __toESM(require_element(), 1); |
| 13111 |
var import_i18n11 = __toESM(require_i18n(), 1); |
| 13112 |
var import_keycodes2 = __toESM(require_keycodes(), 1); |
| 13113 |
var import_keyboard_shortcuts3 = __toESM(require_keyboard_shortcuts(), 1); |
| 13114 |
var import_preferences = __toESM(require_preferences(), 1); |
| 13115 |
|
| 13116 |
// packages/customize-widgets/build-module/components/keyboard-shortcut-help-modal/index.mjs |
| 13117 |
var import_components3 = __toESM(require_components(), 1); |
| 13118 |
var import_i18n10 = __toESM(require_i18n(), 1); |
| 13119 |
var import_keyboard_shortcuts2 = __toESM(require_keyboard_shortcuts(), 1); |
| 13120 |
var import_data6 = __toESM(require_data(), 1); |
| 13121 |
var import_element47 = __toESM(require_element(), 1); |
| 13122 |
|
| 13123 |
// packages/customize-widgets/build-module/components/keyboard-shortcut-help-modal/config.mjs |
| 13124 |
var import_i18n9 = __toESM(require_i18n(), 1); |
| 13125 |
var textFormattingShortcuts = [ |
| 13126 |
{ |
| 13127 |
keyCombination: { modifier: "primary", character: "b" }, |
| 13128 |
description: (0, import_i18n9.__)("Make the selected text bold.") |
| 13129 |
}, |
| 13130 |
{ |
| 13131 |
keyCombination: { modifier: "primary", character: "i" }, |
| 13132 |
description: (0, import_i18n9.__)("Make the selected text italic.") |
| 13133 |
}, |
| 13134 |
{ |
| 13135 |
keyCombination: { modifier: "primary", character: "k" }, |
| 13136 |
description: (0, import_i18n9.__)("Convert the selected text into a link.") |
| 13137 |
}, |
| 13138 |
{ |
| 13139 |
keyCombination: { modifier: "primaryShift", character: "k" }, |
| 13140 |
description: (0, import_i18n9.__)("Remove a link.") |
| 13141 |
}, |
| 13142 |
{ |
| 13143 |
keyCombination: { character: "[[" }, |
| 13144 |
description: (0, import_i18n9.__)("Insert a link to a post or page.") |
| 13145 |
}, |
| 13146 |
{ |
| 13147 |
keyCombination: { modifier: "primary", character: "u" }, |
| 13148 |
description: (0, import_i18n9.__)("Underline the selected text.") |
| 13149 |
}, |
| 13150 |
{ |
| 13151 |
keyCombination: { modifier: "access", character: "d" }, |
| 13152 |
description: (0, import_i18n9.__)("Strikethrough the selected text.") |
| 13153 |
}, |
| 13154 |
{ |
| 13155 |
keyCombination: { modifier: "access", character: "x" }, |
| 13156 |
description: (0, import_i18n9.__)("Make the selected text inline code.") |
| 13157 |
}, |
| 13158 |
{ |
| 13159 |
keyCombination: { |
| 13160 |
modifier: "access", |
| 13161 |
character: "0" |
| 13162 |
}, |
| 13163 |
aliases: [ |
| 13164 |
{ |
| 13165 |
modifier: "access", |
| 13166 |
character: "7" |
| 13167 |
} |
| 13168 |
], |
| 13169 |
description: (0, import_i18n9.__)("Convert the current heading to a paragraph.") |
| 13170 |
}, |
| 13171 |
{ |
| 13172 |
keyCombination: { modifier: "access", character: "1-6" }, |
| 13173 |
description: (0, import_i18n9.__)( |
| 13174 |
"Convert the current paragraph or heading to a heading of level 1 to 6." |
| 13175 |
) |
| 13176 |
}, |
| 13177 |
{ |
| 13178 |
keyCombination: { modifier: "primaryShift", character: "SPACE" }, |
| 13179 |
description: (0, import_i18n9.__)("Add non breaking space.") |
| 13180 |
} |
| 13181 |
]; |
| 13182 |
|
| 13183 |
// packages/customize-widgets/build-module/components/keyboard-shortcut-help-modal/shortcut.mjs |
| 13184 |
var import_element46 = __toESM(require_element(), 1); |
| 13185 |
var import_keycodes = __toESM(require_keycodes(), 1); |
| 13186 |
var import_jsx_runtime53 = __toESM(require_jsx_runtime(), 1); |
| 13187 |
function KeyCombination({ keyCombination, forceAriaLabel }) { |
| 13188 |
const shortcut = keyCombination.modifier ? import_keycodes.displayShortcutList[keyCombination.modifier]( |
| 13189 |
keyCombination.character |
| 13190 |
) : keyCombination.character; |
| 13191 |
const ariaLabel = keyCombination.modifier ? import_keycodes.shortcutAriaLabel[keyCombination.modifier]( |
| 13192 |
keyCombination.character |
| 13193 |
) : keyCombination.character; |
| 13194 |
return /* @__PURE__ */ (0, import_jsx_runtime53.jsx)( |
| 13195 |
"kbd", |
| 13196 |
{ |
| 13197 |
className: "customize-widgets-keyboard-shortcut-help-modal__shortcut-key-combination", |
| 13198 |
"aria-label": forceAriaLabel || ariaLabel, |
| 13199 |
children: (Array.isArray(shortcut) ? shortcut : [shortcut]).map( |
| 13200 |
(character, index2) => { |
| 13201 |
if (character === "+") { |
| 13202 |
return /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(import_element46.Fragment, { children: character }, index2); |
| 13203 |
} |
| 13204 |
return /* @__PURE__ */ (0, import_jsx_runtime53.jsx)( |
| 13205 |
"kbd", |
| 13206 |
{ |
| 13207 |
className: "customize-widgets-keyboard-shortcut-help-modal__shortcut-key", |
| 13208 |
children: character |
| 13209 |
}, |
| 13210 |
index2 |
| 13211 |
); |
| 13212 |
} |
| 13213 |
) |
| 13214 |
} |
| 13215 |
); |
| 13216 |
} |
| 13217 |
function Shortcut({ description, keyCombination, aliases = [], ariaLabel }) { |
| 13218 |
return /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(import_jsx_runtime53.Fragment, { children: [ |
| 13219 |
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("div", { className: "customize-widgets-keyboard-shortcut-help-modal__shortcut-description", children: description }), |
| 13220 |
/* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "customize-widgets-keyboard-shortcut-help-modal__shortcut-term", children: [ |
| 13221 |
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)( |
| 13222 |
KeyCombination, |
| 13223 |
{ |
| 13224 |
keyCombination, |
| 13225 |
forceAriaLabel: ariaLabel |
| 13226 |
} |
| 13227 |
), |
| 13228 |
aliases.map((alias, index2) => /* @__PURE__ */ (0, import_jsx_runtime53.jsx)( |
| 13229 |
KeyCombination, |
| 13230 |
{ |
| 13231 |
keyCombination: alias, |
| 13232 |
forceAriaLabel: ariaLabel |
| 13233 |
}, |
| 13234 |
index2 |
| 13235 |
)) |
| 13236 |
] }) |
| 13237 |
] }); |
| 13238 |
} |
| 13239 |
var shortcut_default = Shortcut; |
| 13240 |
|
| 13241 |
// packages/customize-widgets/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.mjs |
| 13242 |
var import_data5 = __toESM(require_data(), 1); |
| 13243 |
var import_keyboard_shortcuts = __toESM(require_keyboard_shortcuts(), 1); |
| 13244 |
var import_jsx_runtime54 = __toESM(require_jsx_runtime(), 1); |
| 13245 |
function DynamicShortcut({ name }) { |
| 13246 |
const { keyCombination, description, aliases } = (0, import_data5.useSelect)( |
| 13247 |
(select) => { |
| 13248 |
const { |
| 13249 |
getShortcutKeyCombination, |
| 13250 |
getShortcutDescription, |
| 13251 |
getShortcutAliases |
| 13252 |
} = select(import_keyboard_shortcuts.store); |
| 13253 |
return { |
| 13254 |
keyCombination: getShortcutKeyCombination(name), |
| 13255 |
aliases: getShortcutAliases(name), |
| 13256 |
description: getShortcutDescription(name) |
| 13257 |
}; |
| 13258 |
}, |
| 13259 |
[name] |
| 13260 |
); |
| 13261 |
if (!keyCombination) { |
| 13262 |
return null; |
| 13263 |
} |
| 13264 |
return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)( |
| 13265 |
shortcut_default, |
| 13266 |
{ |
| 13267 |
keyCombination, |
| 13268 |
description, |
| 13269 |
aliases |
| 13270 |
} |
| 13271 |
); |
| 13272 |
} |
| 13273 |
var dynamic_shortcut_default = DynamicShortcut; |
| 13274 |
|
| 13275 |
// packages/customize-widgets/build-module/components/keyboard-shortcut-help-modal/index.mjs |
| 13276 |
var import_jsx_runtime55 = __toESM(require_jsx_runtime(), 1); |
| 13277 |
var ShortcutList = ({ shortcuts }) => ( |
| 13278 |
/* |
| 13279 |
* Disable reason: The `list` ARIA role is redundant but |
| 13280 |
* Safari+VoiceOver won't announce the list otherwise. |
| 13281 |
*/ |
| 13282 |
/* eslint-disable jsx-a11y/no-redundant-roles */ |
| 13283 |
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)( |
| 13284 |
"ul", |
| 13285 |
{ |
| 13286 |
className: "customize-widgets-keyboard-shortcut-help-modal__shortcut-list", |
| 13287 |
role: "list", |
| 13288 |
children: shortcuts.map((shortcut, index2) => /* @__PURE__ */ (0, import_jsx_runtime55.jsx)( |
| 13289 |
"li", |
| 13290 |
{ |
| 13291 |
className: "customize-widgets-keyboard-shortcut-help-modal__shortcut", |
| 13292 |
children: typeof shortcut === "string" ? /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(dynamic_shortcut_default, { name: shortcut }) : /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(shortcut_default, { ...shortcut }) |
| 13293 |
}, |
| 13294 |
index2 |
| 13295 |
)) |
| 13296 |
} |
| 13297 |
) |
| 13298 |
); |
| 13299 |
var ShortcutSection = ({ title, shortcuts, className }) => /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)( |
| 13300 |
"section", |
| 13301 |
{ |
| 13302 |
className: clsx_default( |
| 13303 |
"customize-widgets-keyboard-shortcut-help-modal__section", |
| 13304 |
className |
| 13305 |
), |
| 13306 |
children: [ |
| 13307 |
!!title && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("h2", { className: "customize-widgets-keyboard-shortcut-help-modal__section-title", children: title }), |
| 13308 |
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)(ShortcutList, { shortcuts }) |
| 13309 |
] |
| 13310 |
} |
| 13311 |
); |
| 13312 |
var ShortcutCategorySection = ({ |
| 13313 |
title, |
| 13314 |
categoryName, |
| 13315 |
additionalShortcuts = [] |
| 13316 |
}) => { |
| 13317 |
const categoryShortcuts = (0, import_data6.useSelect)( |
| 13318 |
(select) => { |
| 13319 |
return select(import_keyboard_shortcuts2.store).getCategoryShortcuts( |
| 13320 |
categoryName |
| 13321 |
); |
| 13322 |
}, |
| 13323 |
[categoryName] |
| 13324 |
); |
| 13325 |
return /* @__PURE__ */ (0, import_jsx_runtime55.jsx)( |
| 13326 |
ShortcutSection, |
| 13327 |
{ |
| 13328 |
title, |
| 13329 |
shortcuts: categoryShortcuts.concat(additionalShortcuts) |
| 13330 |
} |
| 13331 |
); |
| 13332 |
}; |
| 13333 |
function KeyboardShortcutHelpModal({ |
| 13334 |
isModalActive, |
| 13335 |
toggleModal |
| 13336 |
}) { |
| 13337 |
const { registerShortcut } = (0, import_data6.useDispatch)(import_keyboard_shortcuts2.store); |
| 13338 |
(0, import_element47.useEffect)(() => { |
| 13339 |
registerShortcut({ |
| 13340 |
name: "core/customize-widgets/keyboard-shortcuts", |
| 13341 |
category: "main", |
| 13342 |
description: (0, import_i18n10.__)("Display these keyboard shortcuts."), |
| 13343 |
keyCombination: { |
| 13344 |
modifier: "access", |
| 13345 |
character: "h" |
| 13346 |
} |
| 13347 |
}); |
| 13348 |
}, [registerShortcut]); |
| 13349 |
(0, import_keyboard_shortcuts2.useShortcut)("core/customize-widgets/keyboard-shortcuts", toggleModal); |
| 13350 |
if (!isModalActive) { |
| 13351 |
return null; |
| 13352 |
} |
| 13353 |
return /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)( |
| 13354 |
import_components3.Modal, |
| 13355 |
{ |
| 13356 |
className: "customize-widgets-keyboard-shortcut-help-modal", |
| 13357 |
title: (0, import_i18n10.__)("Keyboard shortcuts"), |
| 13358 |
onRequestClose: toggleModal, |
| 13359 |
children: [ |
| 13360 |
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)( |
| 13361 |
ShortcutSection, |
| 13362 |
{ |
| 13363 |
className: "customize-widgets-keyboard-shortcut-help-modal__main-shortcuts", |
| 13364 |
shortcuts: ["core/customize-widgets/keyboard-shortcuts"] |
| 13365 |
} |
| 13366 |
), |
| 13367 |
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)( |
| 13368 |
ShortcutCategorySection, |
| 13369 |
{ |
| 13370 |
title: (0, import_i18n10.__)("Global shortcuts"), |
| 13371 |
categoryName: "global" |
| 13372 |
} |
| 13373 |
), |
| 13374 |
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)( |
| 13375 |
ShortcutCategorySection, |
| 13376 |
{ |
| 13377 |
title: (0, import_i18n10.__)("Selection shortcuts"), |
| 13378 |
categoryName: "selection" |
| 13379 |
} |
| 13380 |
), |
| 13381 |
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)( |
| 13382 |
ShortcutCategorySection, |
| 13383 |
{ |
| 13384 |
title: (0, import_i18n10.__)("Block shortcuts"), |
| 13385 |
categoryName: "block", |
| 13386 |
additionalShortcuts: [ |
| 13387 |
{ |
| 13388 |
keyCombination: { character: "/" }, |
| 13389 |
description: (0, import_i18n10.__)( |
| 13390 |
"Change the block type after adding a new paragraph." |
| 13391 |
), |
| 13392 |
/* translators: The forward-slash character. e.g. '/'. */ |
| 13393 |
ariaLabel: (0, import_i18n10.__)("Forward-slash") |
| 13394 |
} |
| 13395 |
] |
| 13396 |
} |
| 13397 |
), |
| 13398 |
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)( |
| 13399 |
ShortcutSection, |
| 13400 |
{ |
| 13401 |
title: (0, import_i18n10.__)("Text formatting"), |
| 13402 |
shortcuts: textFormattingShortcuts |
| 13403 |
} |
| 13404 |
) |
| 13405 |
] |
| 13406 |
} |
| 13407 |
); |
| 13408 |
} |
| 13409 |
|
| 13410 |
// packages/customize-widgets/build-module/components/more-menu/index.mjs |
| 13411 |
var import_jsx_runtime56 = __toESM(require_jsx_runtime(), 1); |
| 13412 |
function MoreMenu() { |
| 13413 |
const [ |
| 13414 |
isKeyboardShortcutsModalActive, |
| 13415 |
setIsKeyboardShortcutsModalVisible |
| 13416 |
] = (0, import_element48.useState)(false); |
| 13417 |
const toggleKeyboardShortcutsModal = () => setIsKeyboardShortcutsModalVisible(!isKeyboardShortcutsModalActive); |
| 13418 |
(0, import_keyboard_shortcuts3.useShortcut)( |
| 13419 |
"core/customize-widgets/keyboard-shortcuts", |
| 13420 |
toggleKeyboardShortcutsModal |
| 13421 |
); |
| 13422 |
const { toggle } = (0, import_data7.useDispatch)(import_preferences.store); |
| 13423 |
return /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(import_jsx_runtime56.Fragment, { children: [ |
| 13424 |
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)( |
| 13425 |
import_components4.ToolbarDropdownMenu, |
| 13426 |
{ |
| 13427 |
icon: more_vertical_default, |
| 13428 |
label: (0, import_i18n11.__)("Options"), |
| 13429 |
popoverProps: { |
| 13430 |
placement: "bottom-end", |
| 13431 |
className: "more-menu-dropdown__content" |
| 13432 |
}, |
| 13433 |
toggleProps: { |
| 13434 |
tooltipPosition: "bottom", |
| 13435 |
size: "compact" |
| 13436 |
}, |
| 13437 |
children: () => /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(import_jsx_runtime56.Fragment, { children: [ |
| 13438 |
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_components4.MenuGroup, { label: (0, import_i18n11._x)("View", "noun"), children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)( |
| 13439 |
import_preferences.PreferenceToggleMenuItem, |
| 13440 |
{ |
| 13441 |
scope: "core/customize-widgets", |
| 13442 |
name: "fixedToolbar", |
| 13443 |
label: (0, import_i18n11.__)("Top toolbar"), |
| 13444 |
info: (0, import_i18n11.__)( |
| 13445 |
"Access all block and document tools in a single place" |
| 13446 |
), |
| 13447 |
messageActivated: (0, import_i18n11.__)( |
| 13448 |
"Top toolbar activated" |
| 13449 |
), |
| 13450 |
messageDeactivated: (0, import_i18n11.__)( |
| 13451 |
"Top toolbar deactivated" |
| 13452 |
) |
| 13453 |
} |
| 13454 |
) }), |
| 13455 |
/* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(import_components4.MenuGroup, { label: (0, import_i18n11.__)("Tools"), children: [ |
| 13456 |
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)( |
| 13457 |
import_components4.MenuItem, |
| 13458 |
{ |
| 13459 |
onClick: () => { |
| 13460 |
setIsKeyboardShortcutsModalVisible(true); |
| 13461 |
}, |
| 13462 |
shortcut: import_keycodes2.displayShortcut.access("h"), |
| 13463 |
children: (0, import_i18n11.__)("Keyboard shortcuts") |
| 13464 |
} |
| 13465 |
), |
| 13466 |
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)( |
| 13467 |
import_components4.MenuItem, |
| 13468 |
{ |
| 13469 |
onClick: () => toggle( |
| 13470 |
"core/customize-widgets", |
| 13471 |
"welcomeGuide" |
| 13472 |
), |
| 13473 |
children: (0, import_i18n11.__)("Welcome Guide") |
| 13474 |
} |
| 13475 |
), |
| 13476 |
/* @__PURE__ */ (0, import_jsx_runtime56.jsxs)( |
| 13477 |
import_components4.MenuItem, |
| 13478 |
{ |
| 13479 |
role: "menuitem", |
| 13480 |
icon: external_default, |
| 13481 |
href: (0, import_i18n11.__)( |
| 13482 |
"https://wordpress.org/documentation/article/block-based-widgets-editor/" |
| 13483 |
), |
| 13484 |
target: "_blank", |
| 13485 |
rel: "noopener", |
| 13486 |
children: [ |
| 13487 |
(0, import_i18n11.__)("Help"), |
| 13488 |
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(VisuallyHidden, { |
| 13489 |
render: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("span", {}), |
| 13490 |
/* translators: accessibility text */ |
| 13491 |
children: (0, import_i18n11.__)("(opens in a new tab)") |
| 13492 |
}) |
| 13493 |
] |
| 13494 |
} |
| 13495 |
) |
| 13496 |
] }), |
| 13497 |
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_components4.MenuGroup, { label: (0, import_i18n11.__)("Preferences"), children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)( |
| 13498 |
import_preferences.PreferenceToggleMenuItem, |
| 13499 |
{ |
| 13500 |
scope: "core/customize-widgets", |
| 13501 |
name: "keepCaretInsideBlock", |
| 13502 |
label: (0, import_i18n11.__)( |
| 13503 |
"Contain text cursor inside block" |
| 13504 |
), |
| 13505 |
info: (0, import_i18n11.__)( |
| 13506 |
"Aids screen readers by stopping text caret from leaving blocks." |
| 13507 |
), |
| 13508 |
messageActivated: (0, import_i18n11.__)( |
| 13509 |
"Contain text cursor inside block activated" |
| 13510 |
), |
| 13511 |
messageDeactivated: (0, import_i18n11.__)( |
| 13512 |
"Contain text cursor inside block deactivated" |
| 13513 |
) |
| 13514 |
} |
| 13515 |
) }) |
| 13516 |
] }) |
| 13517 |
} |
| 13518 |
), |
| 13519 |
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)( |
| 13520 |
KeyboardShortcutHelpModal, |
| 13521 |
{ |
| 13522 |
isModalActive: isKeyboardShortcutsModalActive, |
| 13523 |
toggleModal: toggleKeyboardShortcutsModal |
| 13524 |
} |
| 13525 |
) |
| 13526 |
] }); |
| 13527 |
} |
| 13528 |
|
| 13529 |
// packages/customize-widgets/build-module/components/header/index.mjs |
| 13530 |
var import_jsx_runtime57 = __toESM(require_jsx_runtime(), 1); |
| 13531 |
function Header3({ |
| 13532 |
sidebar, |
| 13533 |
inserter, |
| 13534 |
isInserterOpened: isInserterOpened2, |
| 13535 |
setIsInserterOpened: setIsInserterOpened2, |
| 13536 |
isFixedToolbarActive |
| 13537 |
}) { |
| 13538 |
const [[hasUndo, hasRedo], setUndoRedo] = (0, import_element49.useState)([ |
| 13539 |
sidebar.hasUndo(), |
| 13540 |
sidebar.hasRedo() |
| 13541 |
]); |
| 13542 |
const shortcut = (0, import_keycodes3.isAppleOS)() ? import_keycodes3.displayShortcut.primaryShift("z") : import_keycodes3.displayShortcut.primary("y"); |
| 13543 |
(0, import_element49.useEffect)(() => { |
| 13544 |
return sidebar.subscribeHistory(() => { |
| 13545 |
setUndoRedo([sidebar.hasUndo(), sidebar.hasRedo()]); |
| 13546 |
}); |
| 13547 |
}, [sidebar]); |
| 13548 |
return /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(import_jsx_runtime57.Fragment, { children: [ |
| 13549 |
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)( |
| 13550 |
"div", |
| 13551 |
{ |
| 13552 |
className: clsx_default("customize-widgets-header", { |
| 13553 |
"is-fixed-toolbar-active": isFixedToolbarActive |
| 13554 |
}), |
| 13555 |
children: /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)( |
| 13556 |
import_block_editor3.NavigableToolbar, |
| 13557 |
{ |
| 13558 |
className: "customize-widgets-header-toolbar", |
| 13559 |
"aria-label": (0, import_i18n12.__)("Document tools"), |
| 13560 |
children: [ |
| 13561 |
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)( |
| 13562 |
import_components5.ToolbarItem, |
| 13563 |
{ |
| 13564 |
as: import_components5.Button, |
| 13565 |
icon: !(0, import_i18n12.isRTL)() ? undo_default : redo_default, |
| 13566 |
label: (0, import_i18n12.__)("Undo"), |
| 13567 |
shortcut: import_keycodes3.displayShortcut.primary("z"), |
| 13568 |
"aria-disabled": !hasUndo, |
| 13569 |
onClick: hasUndo ? sidebar.undo : void 0, |
| 13570 |
size: "compact", |
| 13571 |
className: "customize-widgets-editor-history-button undo-button" |
| 13572 |
} |
| 13573 |
), |
| 13574 |
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)( |
| 13575 |
import_components5.ToolbarItem, |
| 13576 |
{ |
| 13577 |
as: import_components5.Button, |
| 13578 |
icon: !(0, import_i18n12.isRTL)() ? redo_default : undo_default, |
| 13579 |
label: (0, import_i18n12.__)("Redo"), |
| 13580 |
shortcut, |
| 13581 |
"aria-disabled": !hasRedo, |
| 13582 |
onClick: hasRedo ? sidebar.redo : void 0, |
| 13583 |
size: "compact", |
| 13584 |
className: "customize-widgets-editor-history-button redo-button" |
| 13585 |
} |
| 13586 |
), |
| 13587 |
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)( |
| 13588 |
import_components5.ToolbarItem, |
| 13589 |
{ |
| 13590 |
as: import_components5.Button, |
| 13591 |
className: "customize-widgets-header-toolbar__inserter-toggle", |
| 13592 |
isPressed: isInserterOpened2, |
| 13593 |
variant: "primary", |
| 13594 |
icon: plus_default, |
| 13595 |
label: (0, import_i18n12._x)( |
| 13596 |
"Add block", |
| 13597 |
"Generic label for block inserter button" |
| 13598 |
), |
| 13599 |
onClick: () => { |
| 13600 |
setIsInserterOpened2((isOpen) => !isOpen); |
| 13601 |
}, |
| 13602 |
size: "compact" |
| 13603 |
} |
| 13604 |
), |
| 13605 |
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)(MoreMenu, {}) |
| 13606 |
] |
| 13607 |
} |
| 13608 |
) |
| 13609 |
} |
| 13610 |
), |
| 13611 |
(0, import_element49.createPortal)( |
| 13612 |
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)(inserter_default, { setIsOpened: setIsInserterOpened2 }), |
| 13613 |
inserter.contentContainer[0] |
| 13614 |
) |
| 13615 |
] }); |
| 13616 |
} |
| 13617 |
var header_default = Header3; |
| 13618 |
|
| 13619 |
// packages/customize-widgets/build-module/components/inserter/use-inserter.mjs |
| 13620 |
var import_element50 = __toESM(require_element(), 1); |
| 13621 |
var import_data8 = __toESM(require_data(), 1); |
| 13622 |
function useInserter(inserter) { |
| 13623 |
const isInserterOpened2 = (0, import_data8.useSelect)( |
| 13624 |
(select) => select(store).isInserterOpened(), |
| 13625 |
[] |
| 13626 |
); |
| 13627 |
const { setIsInserterOpened: setIsInserterOpened2 } = (0, import_data8.useDispatch)(store); |
| 13628 |
(0, import_element50.useEffect)(() => { |
| 13629 |
if (isInserterOpened2) { |
| 13630 |
inserter.open(); |
| 13631 |
} else { |
| 13632 |
inserter.close(); |
| 13633 |
} |
| 13634 |
}, [inserter, isInserterOpened2]); |
| 13635 |
return [ |
| 13636 |
isInserterOpened2, |
| 13637 |
(0, import_element50.useCallback)( |
| 13638 |
(updater) => { |
| 13639 |
let isOpen = updater; |
| 13640 |
if (typeof updater === "function") { |
| 13641 |
isOpen = updater( |
| 13642 |
(0, import_data8.select)(store).isInserterOpened() |
| 13643 |
); |
| 13644 |
} |
| 13645 |
setIsInserterOpened2(isOpen); |
| 13646 |
}, |
| 13647 |
[setIsInserterOpened2] |
| 13648 |
) |
| 13649 |
]; |
| 13650 |
} |
| 13651 |
|
| 13652 |
// packages/customize-widgets/build-module/components/sidebar-block-editor/sidebar-editor-provider.mjs |
| 13653 |
var import_block_editor5 = __toESM(require_block_editor(), 1); |
| 13654 |
|
| 13655 |
// packages/customize-widgets/build-module/components/sidebar-block-editor/use-sidebar-block-editor.mjs |
| 13656 |
var import_es6 = __toESM(require_es6(), 1); |
| 13657 |
var import_element51 = __toESM(require_element(), 1); |
| 13658 |
var import_is_shallow_equal = __toESM(require_is_shallow_equal(), 1); |
| 13659 |
var import_widgets2 = __toESM(require_widgets(), 1); |
| 13660 |
|
| 13661 |
// packages/customize-widgets/build-module/utils.mjs |
| 13662 |
var import_blocks = __toESM(require_blocks(), 1); |
| 13663 |
var import_widgets = __toESM(require_widgets(), 1); |
| 13664 |
function settingIdToWidgetId(settingId) { |
| 13665 |
const matches = settingId.match(/^widget_(.+)(?:\[(\d+)\])$/); |
| 13666 |
if (matches) { |
| 13667 |
const idBase = matches[1]; |
| 13668 |
const number = parseInt(matches[2], 10); |
| 13669 |
return `${idBase}-${number}`; |
| 13670 |
} |
| 13671 |
return settingId; |
| 13672 |
} |
| 13673 |
function blockToWidget(block, existingWidget = null) { |
| 13674 |
let widget; |
| 13675 |
const isValidLegacyWidgetBlock = block.name === "core/legacy-widget" && (block.attributes.id || block.attributes.instance); |
| 13676 |
if (isValidLegacyWidgetBlock) { |
| 13677 |
if (block.attributes.id) { |
| 13678 |
widget = { |
| 13679 |
id: block.attributes.id |
| 13680 |
}; |
| 13681 |
} else { |
| 13682 |
const { encoded, hash, raw, ...rest } = block.attributes.instance; |
| 13683 |
widget = { |
| 13684 |
idBase: block.attributes.idBase, |
| 13685 |
instance: { |
| 13686 |
...existingWidget?.instance, |
| 13687 |
// Required only for the customizer. |
| 13688 |
is_widget_customizer_js_value: true, |
| 13689 |
encoded_serialized_instance: encoded, |
| 13690 |
instance_hash_key: hash, |
| 13691 |
raw_instance: raw, |
| 13692 |
...rest |
| 13693 |
} |
| 13694 |
}; |
| 13695 |
} |
| 13696 |
} else { |
| 13697 |
const instance = { |
| 13698 |
content: (0, import_blocks.serialize)(block) |
| 13699 |
}; |
| 13700 |
widget = { |
| 13701 |
idBase: "block", |
| 13702 |
widgetClass: "WP_Widget_Block", |
| 13703 |
instance: { |
| 13704 |
raw_instance: instance |
| 13705 |
} |
| 13706 |
}; |
| 13707 |
} |
| 13708 |
const { form, rendered, ...restExistingWidget } = existingWidget || {}; |
| 13709 |
return { |
| 13710 |
...restExistingWidget, |
| 13711 |
...widget |
| 13712 |
}; |
| 13713 |
} |
| 13714 |
function widgetToBlock({ id, idBase, number, instance }) { |
| 13715 |
let block; |
| 13716 |
const { |
| 13717 |
encoded_serialized_instance: encoded, |
| 13718 |
instance_hash_key: hash, |
| 13719 |
raw_instance: raw, |
| 13720 |
...rest |
| 13721 |
} = instance; |
| 13722 |
if (idBase === "block") { |
| 13723 |
const parsedBlocks = (0, import_blocks.parse)(raw.content ?? "", { |
| 13724 |
__unstableSkipAutop: true |
| 13725 |
}); |
| 13726 |
block = parsedBlocks.length ? parsedBlocks[0] : (0, import_blocks.createBlock)("core/paragraph", {}); |
| 13727 |
} else if (number) { |
| 13728 |
block = (0, import_blocks.createBlock)("core/legacy-widget", { |
| 13729 |
idBase, |
| 13730 |
instance: { |
| 13731 |
encoded, |
| 13732 |
hash, |
| 13733 |
raw, |
| 13734 |
...rest |
| 13735 |
} |
| 13736 |
}); |
| 13737 |
} else { |
| 13738 |
block = (0, import_blocks.createBlock)("core/legacy-widget", { |
| 13739 |
id |
| 13740 |
}); |
| 13741 |
} |
| 13742 |
return (0, import_widgets.addWidgetIdToBlock)(block, id); |
| 13743 |
} |
| 13744 |
|
| 13745 |
// packages/customize-widgets/build-module/components/sidebar-block-editor/use-sidebar-block-editor.mjs |
| 13746 |
function widgetsToBlocks(widgets) { |
| 13747 |
return widgets.map((widget) => widgetToBlock(widget)); |
| 13748 |
} |
| 13749 |
function useSidebarBlockEditor(sidebar) { |
| 13750 |
const [blocks, setBlocks] = (0, import_element51.useState)( |
| 13751 |
() => widgetsToBlocks(sidebar.getWidgets()) |
| 13752 |
); |
| 13753 |
(0, import_element51.useEffect)(() => { |
| 13754 |
return sidebar.subscribe((prevWidgets, nextWidgets) => { |
| 13755 |
setBlocks((prevBlocks) => { |
| 13756 |
const prevWidgetsMap = new Map( |
| 13757 |
prevWidgets.map((widget) => [widget.id, widget]) |
| 13758 |
); |
| 13759 |
const prevBlocksMap = new Map( |
| 13760 |
prevBlocks.map((block) => [ |
| 13761 |
(0, import_widgets2.getWidgetIdFromBlock)(block), |
| 13762 |
block |
| 13763 |
]) |
| 13764 |
); |
| 13765 |
const nextBlocks = nextWidgets.map((nextWidget) => { |
| 13766 |
const prevWidget = prevWidgetsMap.get(nextWidget.id); |
| 13767 |
if (prevWidget && prevWidget === nextWidget) { |
| 13768 |
return prevBlocksMap.get(nextWidget.id); |
| 13769 |
} |
| 13770 |
return widgetToBlock(nextWidget); |
| 13771 |
}); |
| 13772 |
if ((0, import_is_shallow_equal.isShallowEqual)(prevBlocks, nextBlocks)) { |
| 13773 |
return prevBlocks; |
| 13774 |
} |
| 13775 |
return nextBlocks; |
| 13776 |
}); |
| 13777 |
}); |
| 13778 |
}, [sidebar]); |
| 13779 |
const onChangeBlocks = (0, import_element51.useCallback)( |
| 13780 |
(nextBlocks) => { |
| 13781 |
setBlocks((prevBlocks) => { |
| 13782 |
if ((0, import_is_shallow_equal.isShallowEqual)(prevBlocks, nextBlocks)) { |
| 13783 |
return prevBlocks; |
| 13784 |
} |
| 13785 |
const prevBlocksMap = new Map( |
| 13786 |
prevBlocks.map((block) => [ |
| 13787 |
(0, import_widgets2.getWidgetIdFromBlock)(block), |
| 13788 |
block |
| 13789 |
]) |
| 13790 |
); |
| 13791 |
const nextWidgets = nextBlocks.map((nextBlock) => { |
| 13792 |
const widgetId = (0, import_widgets2.getWidgetIdFromBlock)(nextBlock); |
| 13793 |
if (widgetId && prevBlocksMap.has(widgetId)) { |
| 13794 |
const prevBlock = prevBlocksMap.get(widgetId); |
| 13795 |
const prevWidget = sidebar.getWidget(widgetId); |
| 13796 |
if ((0, import_es6.default)(nextBlock, prevBlock) && prevWidget) { |
| 13797 |
return prevWidget; |
| 13798 |
} |
| 13799 |
return blockToWidget(nextBlock, prevWidget); |
| 13800 |
} |
| 13801 |
return blockToWidget(nextBlock); |
| 13802 |
}); |
| 13803 |
if ((0, import_is_shallow_equal.isShallowEqual)(sidebar.getWidgets(), nextWidgets)) { |
| 13804 |
return prevBlocks; |
| 13805 |
} |
| 13806 |
const addedWidgetIds = sidebar.setWidgets(nextWidgets); |
| 13807 |
return nextBlocks.reduce( |
| 13808 |
(updatedNextBlocks, nextBlock, index2) => { |
| 13809 |
const addedWidgetId = addedWidgetIds[index2]; |
| 13810 |
if (addedWidgetId !== null) { |
| 13811 |
if (updatedNextBlocks === nextBlocks) { |
| 13812 |
updatedNextBlocks = nextBlocks.slice(); |
| 13813 |
} |
| 13814 |
updatedNextBlocks[index2] = (0, import_widgets2.addWidgetIdToBlock)( |
| 13815 |
nextBlock, |
| 13816 |
addedWidgetId |
| 13817 |
); |
| 13818 |
} |
| 13819 |
return updatedNextBlocks; |
| 13820 |
}, |
| 13821 |
nextBlocks |
| 13822 |
); |
| 13823 |
}); |
| 13824 |
}, |
| 13825 |
[sidebar] |
| 13826 |
); |
| 13827 |
return [blocks, onChangeBlocks, onChangeBlocks]; |
| 13828 |
} |
| 13829 |
|
| 13830 |
// packages/customize-widgets/build-module/components/focus-control/use-blocks-focus-control.mjs |
| 13831 |
var import_element53 = __toESM(require_element(), 1); |
| 13832 |
var import_data9 = __toESM(require_data(), 1); |
| 13833 |
var import_block_editor4 = __toESM(require_block_editor(), 1); |
| 13834 |
var import_widgets3 = __toESM(require_widgets(), 1); |
| 13835 |
|
| 13836 |
// packages/customize-widgets/build-module/components/focus-control/index.mjs |
| 13837 |
var import_element52 = __toESM(require_element(), 1); |
| 13838 |
var import_jsx_runtime58 = __toESM(require_jsx_runtime(), 1); |
| 13839 |
var FocusControlContext = (0, import_element52.createContext)(); |
| 13840 |
FocusControlContext.displayName = "FocusControlContext"; |
| 13841 |
function FocusControl({ api, sidebarControls, children }) { |
| 13842 |
const [focusedWidgetIdRef, setFocusedWidgetIdRef] = (0, import_element52.useState)({ |
| 13843 |
current: null |
| 13844 |
}); |
| 13845 |
const focusWidget = (0, import_element52.useCallback)( |
| 13846 |
(widgetId) => { |
| 13847 |
for (const sidebarControl of sidebarControls) { |
| 13848 |
const widgets = sidebarControl.setting.get(); |
| 13849 |
if (widgets.includes(widgetId)) { |
| 13850 |
sidebarControl.sectionInstance.expand({ |
| 13851 |
// Schedule it after the complete callback so that |
| 13852 |
// it won't be overridden by the "Back" button focus. |
| 13853 |
completeCallback() { |
| 13854 |
setFocusedWidgetIdRef({ current: widgetId }); |
| 13855 |
} |
| 13856 |
}); |
| 13857 |
break; |
| 13858 |
} |
| 13859 |
} |
| 13860 |
}, |
| 13861 |
[sidebarControls] |
| 13862 |
); |
| 13863 |
(0, import_element52.useEffect)(() => { |
| 13864 |
function handleFocus(settingId) { |
| 13865 |
const widgetId = settingIdToWidgetId(settingId); |
| 13866 |
focusWidget(widgetId); |
| 13867 |
} |
| 13868 |
let previewBound = false; |
| 13869 |
function handleReady() { |
| 13870 |
api.previewer.preview.bind( |
| 13871 |
"focus-control-for-setting", |
| 13872 |
handleFocus |
| 13873 |
); |
| 13874 |
previewBound = true; |
| 13875 |
} |
| 13876 |
api.previewer.bind("ready", handleReady); |
| 13877 |
return () => { |
| 13878 |
api.previewer.unbind("ready", handleReady); |
| 13879 |
if (previewBound) { |
| 13880 |
api.previewer.preview.unbind( |
| 13881 |
"focus-control-for-setting", |
| 13882 |
handleFocus |
| 13883 |
); |
| 13884 |
} |
| 13885 |
}; |
| 13886 |
}, [api, focusWidget]); |
| 13887 |
const context = (0, import_element52.useMemo)( |
| 13888 |
() => [focusedWidgetIdRef, focusWidget], |
| 13889 |
[focusedWidgetIdRef, focusWidget] |
| 13890 |
); |
| 13891 |
return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(FocusControlContext.Provider, { value: context, children }); |
| 13892 |
} |
| 13893 |
var useFocusControl = () => (0, import_element52.useContext)(FocusControlContext); |
| 13894 |
|
| 13895 |
// packages/customize-widgets/build-module/components/focus-control/use-blocks-focus-control.mjs |
| 13896 |
function useBlocksFocusControl(blocks) { |
| 13897 |
const { selectBlock } = (0, import_data9.useDispatch)(import_block_editor4.store); |
| 13898 |
const [focusedWidgetIdRef] = useFocusControl(); |
| 13899 |
const blocksRef = (0, import_element53.useRef)(blocks); |
| 13900 |
(0, import_element53.useEffect)(() => { |
| 13901 |
blocksRef.current = blocks; |
| 13902 |
}, [blocks]); |
| 13903 |
(0, import_element53.useEffect)(() => { |
| 13904 |
if (focusedWidgetIdRef.current) { |
| 13905 |
const focusedBlock = blocksRef.current.find( |
| 13906 |
(block) => (0, import_widgets3.getWidgetIdFromBlock)(block) === focusedWidgetIdRef.current |
| 13907 |
); |
| 13908 |
if (focusedBlock) { |
| 13909 |
selectBlock(focusedBlock.clientId); |
| 13910 |
const blockNode = document.querySelector( |
| 13911 |
`[data-block="${focusedBlock.clientId}"]` |
| 13912 |
); |
| 13913 |
blockNode?.focus(); |
| 13914 |
} |
| 13915 |
} |
| 13916 |
}, [focusedWidgetIdRef, selectBlock]); |
| 13917 |
} |
| 13918 |
|
| 13919 |
// packages/customize-widgets/build-module/lock-unlock.mjs |
| 13920 |
var import_private_apis2 = __toESM(require_private_apis(), 1); |
| 13921 |
var { lock: lock2, unlock: unlock2 } = (0, import_private_apis2.__dangerousOptInToUnstableAPIsOnlyForCoreModules)( |
| 13922 |
"I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.", |
| 13923 |
"@wordpress/customize-widgets" |
| 13924 |
); |
| 13925 |
|
| 13926 |
// packages/customize-widgets/build-module/components/sidebar-block-editor/sidebar-editor-provider.mjs |
| 13927 |
var import_jsx_runtime59 = __toESM(require_jsx_runtime(), 1); |
| 13928 |
var { ExperimentalBlockEditorProvider } = unlock2(import_block_editor5.privateApis); |
| 13929 |
function SidebarEditorProvider({ |
| 13930 |
sidebar, |
| 13931 |
settings, |
| 13932 |
children |
| 13933 |
}) { |
| 13934 |
const [blocks, onInput, onChange] = useSidebarBlockEditor(sidebar); |
| 13935 |
useBlocksFocusControl(blocks); |
| 13936 |
return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)( |
| 13937 |
ExperimentalBlockEditorProvider, |
| 13938 |
{ |
| 13939 |
value: blocks, |
| 13940 |
onInput, |
| 13941 |
onChange, |
| 13942 |
settings, |
| 13943 |
useSubRegistry: false, |
| 13944 |
children |
| 13945 |
} |
| 13946 |
); |
| 13947 |
} |
| 13948 |
|
| 13949 |
// packages/customize-widgets/build-module/components/welcome-guide/index.mjs |
| 13950 |
var import_i18n13 = __toESM(require_i18n(), 1); |
| 13951 |
var import_components6 = __toESM(require_components(), 1); |
| 13952 |
var import_data10 = __toESM(require_data(), 1); |
| 13953 |
var import_preferences2 = __toESM(require_preferences(), 1); |
| 13954 |
var import_jsx_runtime60 = __toESM(require_jsx_runtime(), 1); |
| 13955 |
function WelcomeGuide({ sidebar }) { |
| 13956 |
const { toggle } = (0, import_data10.useDispatch)(import_preferences2.store); |
| 13957 |
const isEntirelyBlockWidgets = sidebar.getWidgets().every((widget) => widget.id.startsWith("block-")); |
| 13958 |
return /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("div", { className: "customize-widgets-welcome-guide", children: [ |
| 13959 |
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)("div", { className: "customize-widgets-welcome-guide__image__wrapper", children: /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("picture", { children: [ |
| 13960 |
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)( |
| 13961 |
"source", |
| 13962 |
{ |
| 13963 |
srcSet: "https://s.w.org/images/block-editor/welcome-editor.svg", |
| 13964 |
media: "(prefers-reduced-motion: reduce)" |
| 13965 |
} |
| 13966 |
), |
| 13967 |
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)( |
| 13968 |
"img", |
| 13969 |
{ |
| 13970 |
className: "customize-widgets-welcome-guide__image", |
| 13971 |
src: "https://s.w.org/images/block-editor/welcome-editor.gif", |
| 13972 |
width: "312", |
| 13973 |
height: "240", |
| 13974 |
alt: "" |
| 13975 |
} |
| 13976 |
) |
| 13977 |
] }) }), |
| 13978 |
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)("h1", { className: "customize-widgets-welcome-guide__heading", children: (0, import_i18n13.__)("Welcome to block Widgets") }), |
| 13979 |
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)("p", { className: "customize-widgets-welcome-guide__text", children: isEntirelyBlockWidgets ? (0, import_i18n13.__)( |
| 13980 |
"Your theme provides 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." |
| 13981 |
) : (0, import_i18n13.__)( |
| 13982 |
"You can now add any block to your site\u2019s widget areas. Don\u2019t worry, all of your favorite widgets still work flawlessly." |
| 13983 |
) }), |
| 13984 |
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)( |
| 13985 |
import_components6.Button, |
| 13986 |
{ |
| 13987 |
size: "compact", |
| 13988 |
variant: "primary", |
| 13989 |
onClick: () => toggle("core/customize-widgets", "welcomeGuide"), |
| 13990 |
children: (0, import_i18n13.__)("Got it") |
| 13991 |
} |
| 13992 |
), |
| 13993 |
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)("hr", { className: "customize-widgets-welcome-guide__separator" }), |
| 13994 |
!isEntirelyBlockWidgets && /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("p", { className: "customize-widgets-welcome-guide__more-info", children: [ |
| 13995 |
(0, import_i18n13.__)("Want to stick with the old widgets?"), |
| 13996 |
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)("br", {}), |
| 13997 |
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)( |
| 13998 |
import_components6.ExternalLink, |
| 13999 |
{ |
| 14000 |
href: (0, import_i18n13.__)( |
| 14001 |
"https://wordpress.org/plugins/classic-widgets/" |
| 14002 |
), |
| 14003 |
children: (0, import_i18n13.__)("Get the Classic Widgets plugin.") |
| 14004 |
} |
| 14005 |
) |
| 14006 |
] }), |
| 14007 |
/* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("p", { className: "customize-widgets-welcome-guide__more-info", children: [ |
| 14008 |
(0, import_i18n13.__)("New to the block editor?"), |
| 14009 |
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)("br", {}), |
| 14010 |
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)( |
| 14011 |
import_components6.ExternalLink, |
| 14012 |
{ |
| 14013 |
href: (0, import_i18n13.__)( |
| 14014 |
"https://wordpress.org/documentation/article/wordpress-block-editor/" |
| 14015 |
), |
| 14016 |
children: (0, import_i18n13.__)("Here's a detailed guide.") |
| 14017 |
} |
| 14018 |
) |
| 14019 |
] }) |
| 14020 |
] }); |
| 14021 |
} |
| 14022 |
|
| 14023 |
// packages/customize-widgets/build-module/components/keyboard-shortcuts/index.mjs |
| 14024 |
var import_element54 = __toESM(require_element(), 1); |
| 14025 |
var import_keyboard_shortcuts4 = __toESM(require_keyboard_shortcuts(), 1); |
| 14026 |
var import_keycodes4 = __toESM(require_keycodes(), 1); |
| 14027 |
var import_data11 = __toESM(require_data(), 1); |
| 14028 |
var import_i18n14 = __toESM(require_i18n(), 1); |
| 14029 |
var import_block_editor6 = __toESM(require_block_editor(), 1); |
| 14030 |
var { usesNativeUndo } = unlock2(import_block_editor6.privateApis); |
| 14031 |
function KeyboardShortcuts({ undo, redo, save }) { |
| 14032 |
(0, import_keyboard_shortcuts4.useShortcut)("core/customize-widgets/undo", (event) => { |
| 14033 |
if (usesNativeUndo(event)) { |
| 14034 |
return; |
| 14035 |
} |
| 14036 |
undo(); |
| 14037 |
event.preventDefault(); |
| 14038 |
}); |
| 14039 |
(0, import_keyboard_shortcuts4.useShortcut)("core/customize-widgets/redo", (event) => { |
| 14040 |
if (usesNativeUndo(event)) { |
| 14041 |
return; |
| 14042 |
} |
| 14043 |
redo(); |
| 14044 |
event.preventDefault(); |
| 14045 |
}); |
| 14046 |
(0, import_keyboard_shortcuts4.useShortcut)("core/customize-widgets/save", (event) => { |
| 14047 |
event.preventDefault(); |
| 14048 |
save(); |
| 14049 |
}); |
| 14050 |
return null; |
| 14051 |
} |
| 14052 |
function KeyboardShortcutsRegister() { |
| 14053 |
const { registerShortcut, unregisterShortcut } = (0, import_data11.useDispatch)( |
| 14054 |
import_keyboard_shortcuts4.store |
| 14055 |
); |
| 14056 |
(0, import_element54.useEffect)(() => { |
| 14057 |
registerShortcut({ |
| 14058 |
name: "core/customize-widgets/undo", |
| 14059 |
category: "global", |
| 14060 |
description: (0, import_i18n14.__)("Undo your last changes."), |
| 14061 |
keyCombination: { |
| 14062 |
modifier: "primary", |
| 14063 |
character: "z" |
| 14064 |
} |
| 14065 |
}); |
| 14066 |
registerShortcut({ |
| 14067 |
name: "core/customize-widgets/redo", |
| 14068 |
category: "global", |
| 14069 |
description: (0, import_i18n14.__)("Redo your last undo."), |
| 14070 |
keyCombination: { |
| 14071 |
modifier: "primaryShift", |
| 14072 |
character: "z" |
| 14073 |
}, |
| 14074 |
// Disable on Apple OS because it conflicts with the browser's |
| 14075 |
// history shortcut. It's a fine alias for both Windows and Linux. |
| 14076 |
// Since there's no conflict for Ctrl+Shift+Z on both Windows and |
| 14077 |
// Linux, we keep it as the default for consistency. |
| 14078 |
aliases: (0, import_keycodes4.isAppleOS)() ? [] : [ |
| 14079 |
{ |
| 14080 |
modifier: "primary", |
| 14081 |
character: "y" |
| 14082 |
} |
| 14083 |
] |
| 14084 |
}); |
| 14085 |
registerShortcut({ |
| 14086 |
name: "core/customize-widgets/save", |
| 14087 |
category: "global", |
| 14088 |
description: (0, import_i18n14.__)("Save your changes."), |
| 14089 |
keyCombination: { |
| 14090 |
modifier: "primary", |
| 14091 |
character: "s" |
| 14092 |
} |
| 14093 |
}); |
| 14094 |
return () => { |
| 14095 |
unregisterShortcut("core/customize-widgets/undo"); |
| 14096 |
unregisterShortcut("core/customize-widgets/redo"); |
| 14097 |
unregisterShortcut("core/customize-widgets/save"); |
| 14098 |
}; |
| 14099 |
}, [registerShortcut]); |
| 14100 |
return null; |
| 14101 |
} |
| 14102 |
KeyboardShortcuts.Register = KeyboardShortcutsRegister; |
| 14103 |
var keyboard_shortcuts_default = KeyboardShortcuts; |
| 14104 |
|
| 14105 |
// packages/customize-widgets/build-module/components/block-appender/index.mjs |
| 14106 |
var import_element55 = __toESM(require_element(), 1); |
| 14107 |
var import_block_editor7 = __toESM(require_block_editor(), 1); |
| 14108 |
var import_data12 = __toESM(require_data(), 1); |
| 14109 |
var import_jsx_runtime61 = __toESM(require_jsx_runtime(), 1); |
| 14110 |
function BlockAppender(props) { |
| 14111 |
const ref = (0, import_element55.useRef)(); |
| 14112 |
const isBlocksListEmpty = (0, import_data12.useSelect)( |
| 14113 |
(select) => select(import_block_editor7.store).getBlockCount() === 0 |
| 14114 |
); |
| 14115 |
(0, import_element55.useEffect)(() => { |
| 14116 |
if (isBlocksListEmpty && ref.current) { |
| 14117 |
const { ownerDocument: ownerDocument2 } = ref.current; |
| 14118 |
if (!ownerDocument2.activeElement || ownerDocument2.activeElement === ownerDocument2.body) { |
| 14119 |
ref.current.focus(); |
| 14120 |
} |
| 14121 |
} |
| 14122 |
}, [isBlocksListEmpty]); |
| 14123 |
return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(import_block_editor7.ButtonBlockAppender, { ...props, ref }); |
| 14124 |
} |
| 14125 |
|
| 14126 |
// packages/customize-widgets/build-module/components/sidebar-block-editor/index.mjs |
| 14127 |
var import_jsx_runtime62 = __toESM(require_jsx_runtime(), 1); |
| 14128 |
var { ExperimentalBlockCanvas: BlockCanvas } = unlock2( |
| 14129 |
import_block_editor8.privateApis |
| 14130 |
); |
| 14131 |
function SidebarBlockEditor({ |
| 14132 |
blockEditorSettings, |
| 14133 |
sidebar, |
| 14134 |
inserter, |
| 14135 |
inspector |
| 14136 |
}) { |
| 14137 |
const [isInserterOpened2, setIsInserterOpened2] = useInserter(inserter); |
| 14138 |
const isMediumViewport = (0, import_compose4.useViewportMatch)("small"); |
| 14139 |
const { |
| 14140 |
hasUploadPermissions, |
| 14141 |
isFixedToolbarActive, |
| 14142 |
keepCaretInsideBlock, |
| 14143 |
isWelcomeGuideActive |
| 14144 |
} = (0, import_data13.useSelect)((select) => { |
| 14145 |
const { get } = select(import_preferences3.store); |
| 14146 |
return { |
| 14147 |
hasUploadPermissions: select(import_core_data.store).canUser("create", { |
| 14148 |
kind: "postType", |
| 14149 |
name: "attachment" |
| 14150 |
}) ?? true, |
| 14151 |
isFixedToolbarActive: !!get( |
| 14152 |
"core/customize-widgets", |
| 14153 |
"fixedToolbar" |
| 14154 |
), |
| 14155 |
keepCaretInsideBlock: !!get( |
| 14156 |
"core/customize-widgets", |
| 14157 |
"keepCaretInsideBlock" |
| 14158 |
), |
| 14159 |
isWelcomeGuideActive: !!get( |
| 14160 |
"core/customize-widgets", |
| 14161 |
"welcomeGuide" |
| 14162 |
) |
| 14163 |
}; |
| 14164 |
}, []); |
| 14165 |
const settings = (0, import_element56.useMemo)(() => { |
| 14166 |
let mediaUploadBlockEditor; |
| 14167 |
if (hasUploadPermissions) { |
| 14168 |
mediaUploadBlockEditor = ({ onError, ...argumentsObject }) => { |
| 14169 |
(0, import_media_utils.uploadMedia)({ |
| 14170 |
wpAllowedMimeTypes: blockEditorSettings.allowedMimeTypes, |
| 14171 |
onError: ({ message }) => onError(message), |
| 14172 |
...argumentsObject |
| 14173 |
}); |
| 14174 |
}; |
| 14175 |
} |
| 14176 |
return { |
| 14177 |
...blockEditorSettings, |
| 14178 |
__experimentalSetIsInserterOpened: setIsInserterOpened2, |
| 14179 |
mediaUpload: mediaUploadBlockEditor, |
| 14180 |
hasFixedToolbar: isFixedToolbarActive || !isMediumViewport, |
| 14181 |
keepCaretInsideBlock, |
| 14182 |
__unstableHasCustomAppender: true |
| 14183 |
}; |
| 14184 |
}, [ |
| 14185 |
hasUploadPermissions, |
| 14186 |
blockEditorSettings, |
| 14187 |
isFixedToolbarActive, |
| 14188 |
isMediumViewport, |
| 14189 |
keepCaretInsideBlock, |
| 14190 |
setIsInserterOpened2 |
| 14191 |
]); |
| 14192 |
if (isWelcomeGuideActive) { |
| 14193 |
return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(WelcomeGuide, { sidebar }); |
| 14194 |
} |
| 14195 |
return /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(import_jsx_runtime62.Fragment, { children: [ |
| 14196 |
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)(keyboard_shortcuts_default.Register, {}), |
| 14197 |
/* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(SidebarEditorProvider, { sidebar, settings, children: [ |
| 14198 |
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)( |
| 14199 |
keyboard_shortcuts_default, |
| 14200 |
{ |
| 14201 |
undo: sidebar.undo, |
| 14202 |
redo: sidebar.redo, |
| 14203 |
save: sidebar.save |
| 14204 |
} |
| 14205 |
), |
| 14206 |
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)( |
| 14207 |
header_default, |
| 14208 |
{ |
| 14209 |
sidebar, |
| 14210 |
inserter, |
| 14211 |
isInserterOpened: isInserterOpened2, |
| 14212 |
setIsInserterOpened: setIsInserterOpened2, |
| 14213 |
isFixedToolbarActive: isFixedToolbarActive || !isMediumViewport |
| 14214 |
} |
| 14215 |
), |
| 14216 |
(isFixedToolbarActive || !isMediumViewport) && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(import_block_editor8.BlockToolbar, { hideDragHandle: true }), |
| 14217 |
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)( |
| 14218 |
BlockCanvas, |
| 14219 |
{ |
| 14220 |
shouldIframe: false, |
| 14221 |
styles: settings.defaultEditorStyles, |
| 14222 |
height: "100%", |
| 14223 |
children: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(import_block_editor8.BlockList, { renderAppender: BlockAppender }) |
| 14224 |
} |
| 14225 |
), |
| 14226 |
(0, import_element56.createPortal)( |
| 14227 |
// This is a temporary hack to prevent button component inside <BlockInspector> |
| 14228 |
// from submitting form when type="button" is not specified. |
| 14229 |
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)("form", { onSubmit: (event) => event.preventDefault(), children: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(import_block_editor8.BlockInspector, {}) }), |
| 14230 |
inspector.contentContainer[0] |
| 14231 |
) |
| 14232 |
] }), |
| 14233 |
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)(import_block_editor8.__unstableBlockSettingsMenuFirstItem, { children: ({ onClose }) => /* @__PURE__ */ (0, import_jsx_runtime62.jsx)( |
| 14234 |
block_inspector_button_default, |
| 14235 |
{ |
| 14236 |
inspector, |
| 14237 |
closeMenu: onClose |
| 14238 |
} |
| 14239 |
) }) |
| 14240 |
] }); |
| 14241 |
} |
| 14242 |
|
| 14243 |
// packages/customize-widgets/build-module/components/sidebar-controls/index.mjs |
| 14244 |
var import_element57 = __toESM(require_element(), 1); |
| 14245 |
var import_jsx_runtime63 = __toESM(require_jsx_runtime(), 1); |
| 14246 |
var SidebarControlsContext = (0, import_element57.createContext)(); |
| 14247 |
SidebarControlsContext.displayName = "SidebarControlsContext"; |
| 14248 |
function SidebarControls({ |
| 14249 |
sidebarControls, |
| 14250 |
activeSidebarControl, |
| 14251 |
children |
| 14252 |
}) { |
| 14253 |
const context = (0, import_element57.useMemo)( |
| 14254 |
() => ({ |
| 14255 |
sidebarControls, |
| 14256 |
activeSidebarControl |
| 14257 |
}), |
| 14258 |
[sidebarControls, activeSidebarControl] |
| 14259 |
); |
| 14260 |
return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(SidebarControlsContext.Provider, { value: context, children }); |
| 14261 |
} |
| 14262 |
function useSidebarControls() { |
| 14263 |
const { sidebarControls } = (0, import_element57.useContext)(SidebarControlsContext); |
| 14264 |
return sidebarControls; |
| 14265 |
} |
| 14266 |
function useActiveSidebarControl() { |
| 14267 |
const { activeSidebarControl } = (0, import_element57.useContext)(SidebarControlsContext); |
| 14268 |
return activeSidebarControl; |
| 14269 |
} |
| 14270 |
|
| 14271 |
// packages/customize-widgets/build-module/components/customize-widgets/use-clear-selected-block.mjs |
| 14272 |
var import_element58 = __toESM(require_element(), 1); |
| 14273 |
var import_data14 = __toESM(require_data(), 1); |
| 14274 |
var import_block_editor9 = __toESM(require_block_editor(), 1); |
| 14275 |
function useClearSelectedBlock(sidebarControl, popoverRef) { |
| 14276 |
const { hasSelectedBlock, hasMultiSelection } = (0, import_data14.useSelect)(import_block_editor9.store); |
| 14277 |
const { clearSelectedBlock } = (0, import_data14.useDispatch)(import_block_editor9.store); |
| 14278 |
(0, import_element58.useEffect)(() => { |
| 14279 |
if (popoverRef.current && sidebarControl) { |
| 14280 |
let handleClearSelectedBlock = function(element) { |
| 14281 |
if ( |
| 14282 |
// 1. Make sure there are blocks being selected. |
| 14283 |
(hasSelectedBlock() || hasMultiSelection()) && // 2. The element should exist in the DOM (not deleted). |
| 14284 |
element && ownerDocument2.contains(element) && // 3. It should also not exist in the container, the popover, nor the dialog. |
| 14285 |
!container.contains(element) && !popoverRef.current.contains(element) && !element.closest('[role="dialog"]') && // 4. The inspector should not be opened. |
| 14286 |
!inspector.expanded() |
| 14287 |
) { |
| 14288 |
clearSelectedBlock(); |
| 14289 |
} |
| 14290 |
}, handleMouseDown = function(event) { |
| 14291 |
handleClearSelectedBlock(event.target); |
| 14292 |
}, handleBlur = function() { |
| 14293 |
handleClearSelectedBlock(ownerDocument2.activeElement); |
| 14294 |
}; |
| 14295 |
const inspector = sidebarControl.inspector; |
| 14296 |
const container = sidebarControl.container[0]; |
| 14297 |
const ownerDocument2 = container.ownerDocument; |
| 14298 |
const ownerWindow = ownerDocument2.defaultView; |
| 14299 |
ownerDocument2.addEventListener("mousedown", handleMouseDown); |
| 14300 |
ownerWindow.addEventListener("blur", handleBlur); |
| 14301 |
return () => { |
| 14302 |
ownerDocument2.removeEventListener( |
| 14303 |
"mousedown", |
| 14304 |
handleMouseDown |
| 14305 |
); |
| 14306 |
ownerWindow.removeEventListener("blur", handleBlur); |
| 14307 |
}; |
| 14308 |
} |
| 14309 |
}, [ |
| 14310 |
popoverRef, |
| 14311 |
sidebarControl, |
| 14312 |
hasSelectedBlock, |
| 14313 |
hasMultiSelection, |
| 14314 |
clearSelectedBlock |
| 14315 |
]); |
| 14316 |
} |
| 14317 |
|
| 14318 |
// packages/customize-widgets/build-module/components/customize-widgets/index.mjs |
| 14319 |
var import_jsx_runtime64 = __toESM(require_jsx_runtime(), 1); |
| 14320 |
function CustomizeWidgets({ |
| 14321 |
api, |
| 14322 |
sidebarControls, |
| 14323 |
blockEditorSettings |
| 14324 |
}) { |
| 14325 |
const [activeSidebarControl, setActiveSidebarControl] = (0, import_element59.useState)(null); |
| 14326 |
const parentContainer = document.getElementById( |
| 14327 |
"customize-theme-controls" |
| 14328 |
); |
| 14329 |
const popoverRef = (0, import_element59.useRef)(); |
| 14330 |
const adminPrimary = (0, import_element59.useMemo)(() => getAdminThemeColors().primary, []); |
| 14331 |
useClearSelectedBlock(activeSidebarControl, popoverRef); |
| 14332 |
(0, import_element59.useEffect)(() => { |
| 14333 |
const unsubscribers = sidebarControls.map( |
| 14334 |
(sidebarControl) => sidebarControl.subscribe((expanded) => { |
| 14335 |
if (expanded) { |
| 14336 |
setActiveSidebarControl(sidebarControl); |
| 14337 |
} |
| 14338 |
}) |
| 14339 |
); |
| 14340 |
return () => { |
| 14341 |
unsubscribers.forEach((unsubscriber) => unsubscriber()); |
| 14342 |
}; |
| 14343 |
}, [sidebarControls]); |
| 14344 |
const activeSidebar = activeSidebarControl && (0, import_element59.createPortal)( |
| 14345 |
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)(ErrorBoundary, { children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)( |
| 14346 |
SidebarBlockEditor, |
| 14347 |
{ |
| 14348 |
blockEditorSettings, |
| 14349 |
sidebar: activeSidebarControl.sidebarAdapter, |
| 14350 |
inserter: activeSidebarControl.inserter, |
| 14351 |
inspector: activeSidebarControl.inspector |
| 14352 |
}, |
| 14353 |
activeSidebarControl.id |
| 14354 |
) }), |
| 14355 |
activeSidebarControl.container[0] |
| 14356 |
); |
| 14357 |
const popover = parentContainer && (0, import_element59.createPortal)( |
| 14358 |
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)("div", { className: "customize-widgets-popover", ref: popoverRef, children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(import_components7.Popover.Slot, {}) }), |
| 14359 |
parentContainer |
| 14360 |
); |
| 14361 |
return /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(import_components7.SlotFillProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(import_theme.ThemeProvider, { isRoot: true, color: { primary: adminPrimary }, children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)( |
| 14362 |
SidebarControls, |
| 14363 |
{ |
| 14364 |
sidebarControls, |
| 14365 |
activeSidebarControl, |
| 14366 |
children: /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)( |
| 14367 |
FocusControl, |
| 14368 |
{ |
| 14369 |
api, |
| 14370 |
sidebarControls, |
| 14371 |
children: [ |
| 14372 |
activeSidebar, |
| 14373 |
popover |
| 14374 |
] |
| 14375 |
} |
| 14376 |
) |
| 14377 |
} |
| 14378 |
) }) }); |
| 14379 |
} |
| 14380 |
|
| 14381 |
// packages/customize-widgets/build-module/controls/sidebar-section.mjs |
| 14382 |
var import_i18n15 = __toESM(require_i18n(), 1); |
| 14383 |
|
| 14384 |
// packages/customize-widgets/build-module/controls/inspector-section.mjs |
| 14385 |
function getInspectorSection() { |
| 14386 |
const { |
| 14387 |
wp: { customize } |
| 14388 |
} = window; |
| 14389 |
return class InspectorSection extends customize.Section { |
| 14390 |
constructor(id, options) { |
| 14391 |
super(id, options); |
| 14392 |
this.parentSection = options.parentSection; |
| 14393 |
this.returnFocusWhenClose = null; |
| 14394 |
this._isOpen = false; |
| 14395 |
} |
| 14396 |
get isOpen() { |
| 14397 |
return this._isOpen; |
| 14398 |
} |
| 14399 |
set isOpen(value) { |
| 14400 |
this._isOpen = value; |
| 14401 |
this.triggerActiveCallbacks(); |
| 14402 |
} |
| 14403 |
ready() { |
| 14404 |
this.contentContainer[0].classList.add( |
| 14405 |
"customize-widgets-layout__inspector" |
| 14406 |
); |
| 14407 |
} |
| 14408 |
isContextuallyActive() { |
| 14409 |
return this.isOpen; |
| 14410 |
} |
| 14411 |
onChangeExpanded(expanded, args) { |
| 14412 |
super.onChangeExpanded(expanded, args); |
| 14413 |
if (this.parentSection && !args.unchanged) { |
| 14414 |
if (expanded) { |
| 14415 |
this.parentSection.collapse({ |
| 14416 |
manualTransition: true |
| 14417 |
}); |
| 14418 |
} else { |
| 14419 |
this.parentSection.expand({ |
| 14420 |
manualTransition: true, |
| 14421 |
completeCallback: () => { |
| 14422 |
if (this.returnFocusWhenClose && !this.contentContainer[0].contains( |
| 14423 |
this.returnFocusWhenClose |
| 14424 |
)) { |
| 14425 |
this.returnFocusWhenClose.focus(); |
| 14426 |
} |
| 14427 |
} |
| 14428 |
}); |
| 14429 |
} |
| 14430 |
} |
| 14431 |
} |
| 14432 |
open({ returnFocusWhenClose } = {}) { |
| 14433 |
this.isOpen = true; |
| 14434 |
this.returnFocusWhenClose = returnFocusWhenClose; |
| 14435 |
this.expand({ |
| 14436 |
allowMultiple: true |
| 14437 |
}); |
| 14438 |
} |
| 14439 |
close() { |
| 14440 |
this.collapse({ |
| 14441 |
allowMultiple: true |
| 14442 |
}); |
| 14443 |
} |
| 14444 |
collapse(options) { |
| 14445 |
this.isOpen = false; |
| 14446 |
super.collapse(options); |
| 14447 |
} |
| 14448 |
triggerActiveCallbacks() { |
| 14449 |
this.active.callbacks.fireWith(this.active, [false, true]); |
| 14450 |
} |
| 14451 |
}; |
| 14452 |
} |
| 14453 |
|
| 14454 |
// packages/customize-widgets/build-module/controls/sidebar-section.mjs |
| 14455 |
var getInspectorSectionId = (sidebarId) => `widgets-inspector-${sidebarId}`; |
| 14456 |
function getSidebarSection() { |
| 14457 |
const { |
| 14458 |
wp: { customize } |
| 14459 |
} = window; |
| 14460 |
const reduceMotionMediaQuery = window.matchMedia( |
| 14461 |
"(prefers-reduced-motion: reduce)" |
| 14462 |
); |
| 14463 |
let isReducedMotion = reduceMotionMediaQuery.matches; |
| 14464 |
reduceMotionMediaQuery.addEventListener("change", (event) => { |
| 14465 |
isReducedMotion = event.matches; |
| 14466 |
}); |
| 14467 |
return class SidebarSection extends customize.Section { |
| 14468 |
ready() { |
| 14469 |
const InspectorSection = getInspectorSection(); |
| 14470 |
this.inspector = new InspectorSection( |
| 14471 |
getInspectorSectionId(this.id), |
| 14472 |
{ |
| 14473 |
title: (0, import_i18n15.__)("Block Settings"), |
| 14474 |
parentSection: this, |
| 14475 |
customizeAction: [ |
| 14476 |
(0, import_i18n15.__)("Customizing"), |
| 14477 |
(0, import_i18n15.__)("Widgets"), |
| 14478 |
this.params.title |
| 14479 |
].join(" \u25B8 ") |
| 14480 |
} |
| 14481 |
); |
| 14482 |
customize.section.add(this.inspector); |
| 14483 |
this.contentContainer[0].classList.add( |
| 14484 |
"customize-widgets__sidebar-section" |
| 14485 |
); |
| 14486 |
} |
| 14487 |
hasSubSectionOpened() { |
| 14488 |
return this.inspector.expanded(); |
| 14489 |
} |
| 14490 |
onChangeExpanded(expanded, _args) { |
| 14491 |
const controls = this.controls(); |
| 14492 |
const args = { |
| 14493 |
..._args, |
| 14494 |
completeCallback() { |
| 14495 |
controls.forEach((control) => { |
| 14496 |
control.onChangeSectionExpanded?.(expanded, args); |
| 14497 |
}); |
| 14498 |
_args.completeCallback?.(); |
| 14499 |
} |
| 14500 |
}; |
| 14501 |
if (args.manualTransition) { |
| 14502 |
if (expanded) { |
| 14503 |
this.contentContainer.addClass(["busy", "open"]); |
| 14504 |
this.contentContainer.removeClass("is-sub-section-open"); |
| 14505 |
this.contentContainer.closest(".wp-full-overlay").addClass("section-open"); |
| 14506 |
} else { |
| 14507 |
this.contentContainer.addClass([ |
| 14508 |
"busy", |
| 14509 |
"is-sub-section-open" |
| 14510 |
]); |
| 14511 |
this.contentContainer.closest(".wp-full-overlay").addClass("section-open"); |
| 14512 |
this.contentContainer.removeClass("open"); |
| 14513 |
} |
| 14514 |
const handleTransitionEnd = () => { |
| 14515 |
this.contentContainer.removeClass("busy"); |
| 14516 |
args.completeCallback(); |
| 14517 |
}; |
| 14518 |
if (isReducedMotion) { |
| 14519 |
handleTransitionEnd(); |
| 14520 |
} else { |
| 14521 |
this.contentContainer.one( |
| 14522 |
"transitionend", |
| 14523 |
handleTransitionEnd |
| 14524 |
); |
| 14525 |
} |
| 14526 |
} else { |
| 14527 |
super.onChangeExpanded(expanded, args); |
| 14528 |
} |
| 14529 |
} |
| 14530 |
}; |
| 14531 |
} |
| 14532 |
|
| 14533 |
// packages/customize-widgets/build-module/controls/sidebar-control.mjs |
| 14534 |
var import_data16 = __toESM(require_data(), 1); |
| 14535 |
|
| 14536 |
// packages/customize-widgets/build-module/components/sidebar-block-editor/sidebar-adapter.mjs |
| 14537 |
var { wp } = window; |
| 14538 |
function parseWidgetId(widgetId) { |
| 14539 |
const matches = widgetId.match(/^(.+)-(\d+)$/); |
| 14540 |
if (matches) { |
| 14541 |
return { |
| 14542 |
idBase: matches[1], |
| 14543 |
number: parseInt(matches[2], 10) |
| 14544 |
}; |
| 14545 |
} |
| 14546 |
return { idBase: widgetId }; |
| 14547 |
} |
| 14548 |
function widgetIdToSettingId(widgetId) { |
| 14549 |
const { idBase, number } = parseWidgetId(widgetId); |
| 14550 |
if (number) { |
| 14551 |
return `widget_${idBase}[${number}]`; |
| 14552 |
} |
| 14553 |
return `widget_${idBase}`; |
| 14554 |
} |
| 14555 |
function debounce(leading, callback, timeout) { |
| 14556 |
let isLeading = false; |
| 14557 |
let timerID; |
| 14558 |
function debounced(...args) { |
| 14559 |
const result = (isLeading ? callback : leading).apply(this, args); |
| 14560 |
isLeading = true; |
| 14561 |
clearTimeout(timerID); |
| 14562 |
timerID = setTimeout(() => { |
| 14563 |
isLeading = false; |
| 14564 |
}, timeout); |
| 14565 |
return result; |
| 14566 |
} |
| 14567 |
debounced.cancel = () => { |
| 14568 |
isLeading = false; |
| 14569 |
clearTimeout(timerID); |
| 14570 |
}; |
| 14571 |
return debounced; |
| 14572 |
} |
| 14573 |
var SidebarAdapter = class { |
| 14574 |
constructor(setting, api) { |
| 14575 |
this.setting = setting; |
| 14576 |
this.api = api; |
| 14577 |
this.locked = false; |
| 14578 |
this.widgetsCache = /* @__PURE__ */ new WeakMap(); |
| 14579 |
this.subscribers = /* @__PURE__ */ new Set(); |
| 14580 |
this.history = [ |
| 14581 |
this._getWidgetIds().map( |
| 14582 |
(widgetId) => this.getWidget(widgetId) |
| 14583 |
) |
| 14584 |
]; |
| 14585 |
this.historyIndex = 0; |
| 14586 |
this.historySubscribers = /* @__PURE__ */ new Set(); |
| 14587 |
this._debounceSetHistory = debounce( |
| 14588 |
this._pushHistory, |
| 14589 |
this._replaceHistory, |
| 14590 |
1e3 |
| 14591 |
); |
| 14592 |
this.setting.bind(this._handleSettingChange.bind(this)); |
| 14593 |
this.api.bind("change", this._handleAllSettingsChange.bind(this)); |
| 14594 |
this.undo = this.undo.bind(this); |
| 14595 |
this.redo = this.redo.bind(this); |
| 14596 |
this.save = this.save.bind(this); |
| 14597 |
} |
| 14598 |
subscribe(callback) { |
| 14599 |
this.subscribers.add(callback); |
| 14600 |
return () => { |
| 14601 |
this.subscribers.delete(callback); |
| 14602 |
}; |
| 14603 |
} |
| 14604 |
getWidgets() { |
| 14605 |
return this.history[this.historyIndex]; |
| 14606 |
} |
| 14607 |
_emit(...args) { |
| 14608 |
for (const callback of this.subscribers) { |
| 14609 |
callback(...args); |
| 14610 |
} |
| 14611 |
} |
| 14612 |
_getWidgetIds() { |
| 14613 |
return this.setting.get(); |
| 14614 |
} |
| 14615 |
_pushHistory() { |
| 14616 |
this.history = [ |
| 14617 |
...this.history.slice(0, this.historyIndex + 1), |
| 14618 |
this._getWidgetIds().map( |
| 14619 |
(widgetId) => this.getWidget(widgetId) |
| 14620 |
) |
| 14621 |
]; |
| 14622 |
this.historyIndex += 1; |
| 14623 |
this.historySubscribers.forEach((listener) => listener()); |
| 14624 |
} |
| 14625 |
_replaceHistory() { |
| 14626 |
this.history[this.historyIndex] = this._getWidgetIds().map( |
| 14627 |
(widgetId) => this.getWidget(widgetId) |
| 14628 |
); |
| 14629 |
} |
| 14630 |
_handleSettingChange() { |
| 14631 |
if (this.locked) { |
| 14632 |
return; |
| 14633 |
} |
| 14634 |
const prevWidgets = this.getWidgets(); |
| 14635 |
this._pushHistory(); |
| 14636 |
this._emit(prevWidgets, this.getWidgets()); |
| 14637 |
} |
| 14638 |
_handleAllSettingsChange(setting) { |
| 14639 |
if (this.locked) { |
| 14640 |
return; |
| 14641 |
} |
| 14642 |
if (!setting.id.startsWith("widget_")) { |
| 14643 |
return; |
| 14644 |
} |
| 14645 |
const widgetId = settingIdToWidgetId(setting.id); |
| 14646 |
if (!this.setting.get().includes(widgetId)) { |
| 14647 |
return; |
| 14648 |
} |
| 14649 |
const prevWidgets = this.getWidgets(); |
| 14650 |
this._pushHistory(); |
| 14651 |
this._emit(prevWidgets, this.getWidgets()); |
| 14652 |
} |
| 14653 |
_createWidget(widget) { |
| 14654 |
const widgetModel = wp.customize.Widgets.availableWidgets.findWhere({ |
| 14655 |
id_base: widget.idBase |
| 14656 |
}); |
| 14657 |
let number = widget.number; |
| 14658 |
if (widgetModel.get("is_multi") && !number) { |
| 14659 |
widgetModel.set( |
| 14660 |
"multi_number", |
| 14661 |
widgetModel.get("multi_number") + 1 |
| 14662 |
); |
| 14663 |
number = widgetModel.get("multi_number"); |
| 14664 |
} |
| 14665 |
const settingId = number ? `widget_${widget.idBase}[${number}]` : `widget_${widget.idBase}`; |
| 14666 |
const settingArgs = { |
| 14667 |
transport: wp.customize.Widgets.data.selectiveRefreshableWidgets[widgetModel.get("id_base")] ? "postMessage" : "refresh", |
| 14668 |
previewer: this.setting.previewer |
| 14669 |
}; |
| 14670 |
const setting = this.api.create( |
| 14671 |
settingId, |
| 14672 |
settingId, |
| 14673 |
"", |
| 14674 |
settingArgs |
| 14675 |
); |
| 14676 |
setting.set(widget.instance); |
| 14677 |
const widgetId = settingIdToWidgetId(settingId); |
| 14678 |
return widgetId; |
| 14679 |
} |
| 14680 |
_removeWidget(widget) { |
| 14681 |
const settingId = widgetIdToSettingId(widget.id); |
| 14682 |
const setting = this.api(settingId); |
| 14683 |
if (setting) { |
| 14684 |
const instance = setting.get(); |
| 14685 |
this.widgetsCache.delete(instance); |
| 14686 |
} |
| 14687 |
this.api.remove(settingId); |
| 14688 |
} |
| 14689 |
_updateWidget(widget) { |
| 14690 |
const prevWidget = this.getWidget(widget.id); |
| 14691 |
if (prevWidget === widget) { |
| 14692 |
return widget.id; |
| 14693 |
} |
| 14694 |
if (prevWidget.idBase && widget.idBase && prevWidget.idBase === widget.idBase) { |
| 14695 |
const settingId = widgetIdToSettingId(widget.id); |
| 14696 |
this.api(settingId).set(widget.instance); |
| 14697 |
return widget.id; |
| 14698 |
} |
| 14699 |
this._removeWidget(widget); |
| 14700 |
return this._createWidget(widget); |
| 14701 |
} |
| 14702 |
getWidget(widgetId) { |
| 14703 |
if (!widgetId) { |
| 14704 |
return null; |
| 14705 |
} |
| 14706 |
const { idBase, number } = parseWidgetId(widgetId); |
| 14707 |
const settingId = widgetIdToSettingId(widgetId); |
| 14708 |
const setting = this.api(settingId); |
| 14709 |
if (!setting) { |
| 14710 |
return null; |
| 14711 |
} |
| 14712 |
const instance = setting.get(); |
| 14713 |
if (this.widgetsCache.has(instance)) { |
| 14714 |
return this.widgetsCache.get(instance); |
| 14715 |
} |
| 14716 |
const widget = { |
| 14717 |
id: widgetId, |
| 14718 |
idBase, |
| 14719 |
number, |
| 14720 |
instance |
| 14721 |
}; |
| 14722 |
this.widgetsCache.set(instance, widget); |
| 14723 |
return widget; |
| 14724 |
} |
| 14725 |
_updateWidgets(nextWidgets) { |
| 14726 |
this.locked = true; |
| 14727 |
const addedWidgetIds = []; |
| 14728 |
const nextWidgetIds = nextWidgets.map((nextWidget) => { |
| 14729 |
if (nextWidget.id && this.getWidget(nextWidget.id)) { |
| 14730 |
addedWidgetIds.push(null); |
| 14731 |
return this._updateWidget(nextWidget); |
| 14732 |
} |
| 14733 |
const widgetId = this._createWidget(nextWidget); |
| 14734 |
addedWidgetIds.push(widgetId); |
| 14735 |
return widgetId; |
| 14736 |
}); |
| 14737 |
const deletedWidgets = this.getWidgets().filter( |
| 14738 |
(widget) => !nextWidgetIds.includes(widget.id) |
| 14739 |
); |
| 14740 |
deletedWidgets.forEach((widget) => this._removeWidget(widget)); |
| 14741 |
this.setting.set(nextWidgetIds); |
| 14742 |
this.locked = false; |
| 14743 |
return addedWidgetIds; |
| 14744 |
} |
| 14745 |
setWidgets(nextWidgets) { |
| 14746 |
const addedWidgetIds = this._updateWidgets(nextWidgets); |
| 14747 |
this._debounceSetHistory(); |
| 14748 |
return addedWidgetIds; |
| 14749 |
} |
| 14750 |
/** |
| 14751 |
* Undo/Redo related features |
| 14752 |
*/ |
| 14753 |
hasUndo() { |
| 14754 |
return this.historyIndex > 0; |
| 14755 |
} |
| 14756 |
hasRedo() { |
| 14757 |
return this.historyIndex < this.history.length - 1; |
| 14758 |
} |
| 14759 |
_seek(historyIndex) { |
| 14760 |
const currentWidgets = this.getWidgets(); |
| 14761 |
this.historyIndex = historyIndex; |
| 14762 |
const widgets = this.history[this.historyIndex]; |
| 14763 |
this._updateWidgets(widgets); |
| 14764 |
this._emit(currentWidgets, this.getWidgets()); |
| 14765 |
this.historySubscribers.forEach((listener) => listener()); |
| 14766 |
this._debounceSetHistory.cancel(); |
| 14767 |
} |
| 14768 |
undo() { |
| 14769 |
if (!this.hasUndo()) { |
| 14770 |
return; |
| 14771 |
} |
| 14772 |
this._seek(this.historyIndex - 1); |
| 14773 |
} |
| 14774 |
redo() { |
| 14775 |
if (!this.hasRedo()) { |
| 14776 |
return; |
| 14777 |
} |
| 14778 |
this._seek(this.historyIndex + 1); |
| 14779 |
} |
| 14780 |
subscribeHistory(listener) { |
| 14781 |
this.historySubscribers.add(listener); |
| 14782 |
return () => { |
| 14783 |
this.historySubscribers.delete(listener); |
| 14784 |
}; |
| 14785 |
} |
| 14786 |
save() { |
| 14787 |
this.api.previewer.save(); |
| 14788 |
} |
| 14789 |
}; |
| 14790 |
|
| 14791 |
// packages/customize-widgets/build-module/controls/inserter-outer-section.mjs |
| 14792 |
var import_keycodes5 = __toESM(require_keycodes(), 1); |
| 14793 |
var import_dom21 = __toESM(require_dom(), 1); |
| 14794 |
var import_data15 = __toESM(require_data(), 1); |
| 14795 |
function getInserterOuterSection() { |
| 14796 |
const { |
| 14797 |
wp: { customize } |
| 14798 |
} = window; |
| 14799 |
const OuterSection = customize.OuterSection; |
| 14800 |
customize.OuterSection = class extends OuterSection { |
| 14801 |
onChangeExpanded(expanded, args) { |
| 14802 |
if (expanded) { |
| 14803 |
customize.section.each((section) => { |
| 14804 |
if (section.params.type === "outer" && section.id !== this.id) { |
| 14805 |
if (section.expanded()) { |
| 14806 |
section.collapse(); |
| 14807 |
} |
| 14808 |
} |
| 14809 |
}); |
| 14810 |
} |
| 14811 |
return super.onChangeExpanded(expanded, args); |
| 14812 |
} |
| 14813 |
}; |
| 14814 |
customize.sectionConstructor.outer = customize.OuterSection; |
| 14815 |
return class InserterOuterSection extends customize.OuterSection { |
| 14816 |
constructor(...args) { |
| 14817 |
super(...args); |
| 14818 |
this.params.type = "outer"; |
| 14819 |
this.activeElementBeforeExpanded = null; |
| 14820 |
const ownerWindow = this.contentContainer[0].ownerDocument.defaultView; |
| 14821 |
ownerWindow.addEventListener( |
| 14822 |
"keydown", |
| 14823 |
(event) => { |
| 14824 |
if (this.expanded() && (event.keyCode === import_keycodes5.ESCAPE || event.code === "Escape") && !event.defaultPrevented) { |
| 14825 |
event.preventDefault(); |
| 14826 |
event.stopPropagation(); |
| 14827 |
(0, import_data15.dispatch)(store).setIsInserterOpened( |
| 14828 |
false |
| 14829 |
); |
| 14830 |
} |
| 14831 |
}, |
| 14832 |
// Use capture mode to make this run before other event listeners. |
| 14833 |
true |
| 14834 |
); |
| 14835 |
this.contentContainer.addClass("widgets-inserter"); |
| 14836 |
this.isFromInternalAction = false; |
| 14837 |
this.expanded.bind(() => { |
| 14838 |
if (!this.isFromInternalAction) { |
| 14839 |
(0, import_data15.dispatch)(store).setIsInserterOpened( |
| 14840 |
this.expanded() |
| 14841 |
); |
| 14842 |
} |
| 14843 |
this.isFromInternalAction = false; |
| 14844 |
}); |
| 14845 |
} |
| 14846 |
open() { |
| 14847 |
if (!this.expanded()) { |
| 14848 |
const contentContainer = this.contentContainer[0]; |
| 14849 |
this.activeElementBeforeExpanded = contentContainer.ownerDocument.activeElement; |
| 14850 |
this.isFromInternalAction = true; |
| 14851 |
this.expand({ |
| 14852 |
completeCallback() { |
| 14853 |
const searchBox = import_dom21.focus.tabbable.find(contentContainer)[1]; |
| 14854 |
if (searchBox) { |
| 14855 |
searchBox.focus(); |
| 14856 |
} |
| 14857 |
} |
| 14858 |
}); |
| 14859 |
} |
| 14860 |
} |
| 14861 |
close() { |
| 14862 |
if (this.expanded()) { |
| 14863 |
const contentContainer = this.contentContainer[0]; |
| 14864 |
const activeElement2 = contentContainer.ownerDocument.activeElement; |
| 14865 |
this.isFromInternalAction = true; |
| 14866 |
this.collapse({ |
| 14867 |
completeCallback() { |
| 14868 |
if (contentContainer.contains(activeElement2)) { |
| 14869 |
if (this.activeElementBeforeExpanded) { |
| 14870 |
this.activeElementBeforeExpanded.focus(); |
| 14871 |
} |
| 14872 |
} |
| 14873 |
} |
| 14874 |
}); |
| 14875 |
} |
| 14876 |
} |
| 14877 |
}; |
| 14878 |
} |
| 14879 |
|
| 14880 |
// packages/customize-widgets/build-module/controls/sidebar-control.mjs |
| 14881 |
var getInserterId = (controlId) => `widgets-inserter-${controlId}`; |
| 14882 |
function getSidebarControl() { |
| 14883 |
const { |
| 14884 |
wp: { customize } |
| 14885 |
} = window; |
| 14886 |
return class SidebarControl extends customize.Control { |
| 14887 |
constructor(...args) { |
| 14888 |
super(...args); |
| 14889 |
this.subscribers = /* @__PURE__ */ new Set(); |
| 14890 |
} |
| 14891 |
ready() { |
| 14892 |
const InserterOuterSection = getInserterOuterSection(); |
| 14893 |
this.inserter = new InserterOuterSection( |
| 14894 |
getInserterId(this.id), |
| 14895 |
{} |
| 14896 |
); |
| 14897 |
customize.section.add(this.inserter); |
| 14898 |
this.sectionInstance = customize.section(this.section()); |
| 14899 |
this.inspector = this.sectionInstance.inspector; |
| 14900 |
this.sidebarAdapter = new SidebarAdapter(this.setting, customize); |
| 14901 |
} |
| 14902 |
subscribe(callback) { |
| 14903 |
this.subscribers.add(callback); |
| 14904 |
return () => { |
| 14905 |
this.subscribers.delete(callback); |
| 14906 |
}; |
| 14907 |
} |
| 14908 |
onChangeSectionExpanded(expanded, args) { |
| 14909 |
if (!args.unchanged) { |
| 14910 |
if (!expanded) { |
| 14911 |
(0, import_data16.dispatch)(store).setIsInserterOpened( |
| 14912 |
false |
| 14913 |
); |
| 14914 |
} |
| 14915 |
this.subscribers.forEach( |
| 14916 |
(subscriber) => subscriber(expanded, args) |
| 14917 |
); |
| 14918 |
} |
| 14919 |
} |
| 14920 |
}; |
| 14921 |
} |
| 14922 |
|
| 14923 |
// packages/customize-widgets/build-module/filters/move-to-sidebar.mjs |
| 14924 |
var import_block_editor10 = __toESM(require_block_editor(), 1); |
| 14925 |
var import_compose5 = __toESM(require_compose(), 1); |
| 14926 |
var import_data17 = __toESM(require_data(), 1); |
| 14927 |
var import_hooks2 = __toESM(require_hooks(), 1); |
| 14928 |
var import_widgets4 = __toESM(require_widgets(), 1); |
| 14929 |
var import_jsx_runtime65 = __toESM(require_jsx_runtime(), 1); |
| 14930 |
var withMoveToSidebarToolbarItem = (0, import_compose5.createHigherOrderComponent)( |
| 14931 |
(BlockEdit) => (props) => { |
| 14932 |
let widgetId = (0, import_widgets4.getWidgetIdFromBlock)(props); |
| 14933 |
const sidebarControls = useSidebarControls(); |
| 14934 |
const activeSidebarControl = useActiveSidebarControl(); |
| 14935 |
const hasMultipleSidebars = sidebarControls?.length > 1; |
| 14936 |
const blockName = props.name; |
| 14937 |
const clientId = props.clientId; |
| 14938 |
const canInsertBlockInSidebar = (0, import_data17.useSelect)( |
| 14939 |
(select) => { |
| 14940 |
return select(import_block_editor10.store).canInsertBlockType( |
| 14941 |
blockName, |
| 14942 |
"" |
| 14943 |
); |
| 14944 |
}, |
| 14945 |
[blockName] |
| 14946 |
); |
| 14947 |
const block = (0, import_data17.useSelect)( |
| 14948 |
(select) => select(import_block_editor10.store).getBlock(clientId), |
| 14949 |
[clientId] |
| 14950 |
); |
| 14951 |
const { removeBlock } = (0, import_data17.useDispatch)(import_block_editor10.store); |
| 14952 |
const [, focusWidget] = useFocusControl(); |
| 14953 |
function moveToSidebar(sidebarControlId) { |
| 14954 |
const newSidebarControl = sidebarControls.find( |
| 14955 |
(sidebarControl) => sidebarControl.id === sidebarControlId |
| 14956 |
); |
| 14957 |
if (widgetId) { |
| 14958 |
const oldSetting = activeSidebarControl.setting; |
| 14959 |
const newSetting = newSidebarControl.setting; |
| 14960 |
oldSetting(oldSetting().filter((id) => id !== widgetId)); |
| 14961 |
newSetting([...newSetting(), widgetId]); |
| 14962 |
} else { |
| 14963 |
const sidebarAdapter = newSidebarControl.sidebarAdapter; |
| 14964 |
removeBlock(clientId); |
| 14965 |
const addedWidgetIds = sidebarAdapter.setWidgets([ |
| 14966 |
...sidebarAdapter.getWidgets(), |
| 14967 |
blockToWidget(block) |
| 14968 |
]); |
| 14969 |
widgetId = addedWidgetIds.reverse().find((id) => !!id); |
| 14970 |
} |
| 14971 |
focusWidget(widgetId); |
| 14972 |
} |
| 14973 |
return /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(import_jsx_runtime65.Fragment, { children: [ |
| 14974 |
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)(BlockEdit, { ...props }, "edit"), |
| 14975 |
hasMultipleSidebars && canInsertBlockInSidebar && /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(import_block_editor10.BlockControls, { children: /* @__PURE__ */ (0, import_jsx_runtime65.jsx)( |
| 14976 |
import_widgets4.MoveToWidgetArea, |
| 14977 |
{ |
| 14978 |
widgetAreas: sidebarControls.map( |
| 14979 |
(sidebarControl) => ({ |
| 14980 |
id: sidebarControl.id, |
| 14981 |
name: sidebarControl.params.label, |
| 14982 |
description: sidebarControl.params.description |
| 14983 |
}) |
| 14984 |
), |
| 14985 |
currentWidgetAreaId: activeSidebarControl?.id, |
| 14986 |
onSelect: moveToSidebar |
| 14987 |
} |
| 14988 |
) }) |
| 14989 |
] }); |
| 14990 |
}, |
| 14991 |
"withMoveToSidebarToolbarItem" |
| 14992 |
); |
| 14993 |
(0, import_hooks2.addFilter)( |
| 14994 |
"editor.BlockEdit", |
| 14995 |
"core/customize-widgets/block-edit", |
| 14996 |
withMoveToSidebarToolbarItem |
| 14997 |
); |
| 14998 |
|
| 14999 |
// packages/customize-widgets/build-module/filters/replace-media-upload.mjs |
| 15000 |
var import_hooks3 = __toESM(require_hooks(), 1); |
| 15001 |
var import_media_utils2 = __toESM(require_media_utils(), 1); |
| 15002 |
var replaceMediaUpload = () => import_media_utils2.MediaUpload; |
| 15003 |
(0, import_hooks3.addFilter)( |
| 15004 |
"editor.MediaUpload", |
| 15005 |
"core/edit-widgets/replace-media-upload", |
| 15006 |
replaceMediaUpload |
| 15007 |
); |
| 15008 |
|
| 15009 |
// packages/customize-widgets/build-module/filters/wide-widget-display.mjs |
| 15010 |
var import_compose6 = __toESM(require_compose(), 1); |
| 15011 |
var import_hooks4 = __toESM(require_hooks(), 1); |
| 15012 |
var import_jsx_runtime66 = __toESM(require_jsx_runtime(), 1); |
| 15013 |
var { wp: wp2 } = window; |
| 15014 |
var withWideWidgetDisplay = (0, import_compose6.createHigherOrderComponent)( |
| 15015 |
(BlockEdit) => (props) => { |
| 15016 |
const { idBase } = props.attributes; |
| 15017 |
const isWide = wp2.customize.Widgets.data.availableWidgets.find( |
| 15018 |
(widget) => widget.id_base === idBase |
| 15019 |
)?.is_wide ?? false; |
| 15020 |
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(BlockEdit, { ...props, isWide }, "edit"); |
| 15021 |
}, |
| 15022 |
"withWideWidgetDisplay" |
| 15023 |
); |
| 15024 |
(0, import_hooks4.addFilter)( |
| 15025 |
"editor.BlockEdit", |
| 15026 |
"core/customize-widgets/wide-widget-display", |
| 15027 |
withWideWidgetDisplay |
| 15028 |
); |
| 15029 |
|
| 15030 |
// packages/customize-widgets/build-module/index.mjs |
| 15031 |
var import_jsx_runtime67 = __toESM(require_jsx_runtime(), 1); |
| 15032 |
var { wp: wp3 } = window; |
| 15033 |
var DISABLED_BLOCKS = [ |
| 15034 |
"core/more", |
| 15035 |
"core/block", |
| 15036 |
"core/freeform", |
| 15037 |
"core/template-part" |
| 15038 |
]; |
| 15039 |
var ENABLE_EXPERIMENTAL_FSE_BLOCKS = false; |
| 15040 |
function initialize(editorName, blockEditorSettings) { |
| 15041 |
(0, import_data18.dispatch)(import_preferences4.store).setDefaults("core/customize-widgets", { |
| 15042 |
fixedToolbar: false, |
| 15043 |
welcomeGuide: true |
| 15044 |
}); |
| 15045 |
(0, import_data18.dispatch)(import_blocks2.store).reapplyBlockTypeFilters(); |
| 15046 |
const coreBlocks = (0, import_block_library.__experimentalGetCoreBlocks)().filter((block) => { |
| 15047 |
return !(DISABLED_BLOCKS.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")); |
| 15048 |
}); |
| 15049 |
(0, import_block_library.registerCoreBlocks)(coreBlocks); |
| 15050 |
(0, import_widgets5.registerLegacyWidgetBlock)(); |
| 15051 |
if (true) { |
| 15052 |
(0, import_block_library.__experimentalRegisterExperimentalCoreBlocks)({ |
| 15053 |
enableFSEBlocks: ENABLE_EXPERIMENTAL_FSE_BLOCKS |
| 15054 |
}); |
| 15055 |
} |
| 15056 |
(0, import_widgets5.registerLegacyWidgetVariations)(blockEditorSettings); |
| 15057 |
(0, import_widgets5.registerWidgetGroupBlock)(); |
| 15058 |
(0, import_blocks2.setFreeformContentHandlerName)("core/html"); |
| 15059 |
const SidebarControl = getSidebarControl(blockEditorSettings); |
| 15060 |
wp3.customize.sectionConstructor.sidebar = getSidebarSection(); |
| 15061 |
wp3.customize.controlConstructor.sidebar_block_editor = SidebarControl; |
| 15062 |
const container = document.createElement("div"); |
| 15063 |
document.body.appendChild(container); |
| 15064 |
wp3.customize.bind("ready", () => { |
| 15065 |
const sidebarControls = []; |
| 15066 |
wp3.customize.control.each((control) => { |
| 15067 |
if (control instanceof SidebarControl) { |
| 15068 |
sidebarControls.push(control); |
| 15069 |
} |
| 15070 |
}); |
| 15071 |
(0, import_element60.createRoot)(container).render( |
| 15072 |
/* @__PURE__ */ (0, import_jsx_runtime67.jsx)(import_element60.StrictMode, { children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)( |
| 15073 |
CustomizeWidgets, |
| 15074 |
{ |
| 15075 |
api: wp3.customize, |
| 15076 |
sidebarControls, |
| 15077 |
blockEditorSettings |
| 15078 |
} |
| 15079 |
) }) |
| 15080 |
); |
| 15081 |
}); |
| 15082 |
} |
| 15083 |
return __toCommonJS(index_exports); |
| 15084 |
})(); |
| 15085 |
/*! Bundled license information: |
| 15086 |
|
| 15087 |
use-sync-external-store/cjs/use-sync-external-store-shim.development.js: |
| 15088 |
(** |
| 15089 |
* @license React |
| 15090 |
* use-sync-external-store-shim.development.js |
| 15091 |
* |
| 15092 |
* Copyright (c) Meta Platforms, Inc. and affiliates. |
| 15093 |
* |
| 15094 |
* This source code is licensed under the MIT license found in the |
| 15095 |
* LICENSE file in the root directory of this source tree. |
| 15096 |
*) |
| 15097 |
|
| 15098 |
use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js: |
| 15099 |
(** |
| 15100 |
* @license React |
| 15101 |
* use-sync-external-store-shim/with-selector.development.js |
| 15102 |
* |
| 15103 |
* Copyright (c) Meta Platforms, Inc. and affiliates. |
| 15104 |
* |
| 15105 |
* This source code is licensed under the MIT license found in the |
| 15106 |
* LICENSE file in the root directory of this source tree. |
| 15107 |
*) |
| 15108 |
*/ |
| 15109 |
(window.wp ||= {}).customizeWidgets = wp.customizeWidgets; |
| 15110 |
})(); |
| 15111 |
//# sourceMappingURL=index.js.map |
| 15112 |
|