| 1 |
var __create = Object.create; |
| 2 |
var __defProp = Object.defineProperty; |
| 3 |
var __getOwnPropDesc = Object.getOwnPropertyDescriptor; |
| 4 |
var __getOwnPropNames = Object.getOwnPropertyNames; |
| 5 |
var __getProtoOf = Object.getPrototypeOf; |
| 6 |
var __hasOwnProp = Object.prototype.hasOwnProperty; |
| 7 |
var __commonJS = (cb, mod) => function __require() { |
| 8 |
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; |
| 9 |
}; |
| 10 |
var __export = (target, all) => { |
| 11 |
for (var name in all) |
| 12 |
__defProp(target, name, { get: all[name], enumerable: true }); |
| 13 |
}; |
| 14 |
var __copyProps = (to, from, except, desc) => { |
| 15 |
if (from && typeof from === "object" || typeof from === "function") { |
| 16 |
for (let key of __getOwnPropNames(from)) |
| 17 |
if (!__hasOwnProp.call(to, key) && key !== except) |
| 18 |
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); |
| 19 |
} |
| 20 |
return to; |
| 21 |
}; |
| 22 |
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( |
| 23 |
// If the importer is in node compatibility mode or this is not an ESM |
| 24 |
// file that has been converted to a CommonJS file using a Babel- |
| 25 |
// compatible transform (i.e. "__esModule" has not been set), then set |
| 26 |
// "default" to the CommonJS "module.exports" for node compatibility. |
| 27 |
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, |
| 28 |
mod |
| 29 |
)); |
| 30 |
|
| 31 |
// package-external:@wordpress/i18n |
| 32 |
var require_i18n = __commonJS({ |
| 33 |
"package-external:@wordpress/i18n"(exports, module) { |
| 34 |
module.exports = window.wp.i18n; |
| 35 |
} |
| 36 |
}); |
| 37 |
|
| 38 |
// package-external:@wordpress/element |
| 39 |
var require_element = __commonJS({ |
| 40 |
"package-external:@wordpress/element"(exports, module) { |
| 41 |
module.exports = window.wp.element; |
| 42 |
} |
| 43 |
}); |
| 44 |
|
| 45 |
// package-external:@wordpress/primitives |
| 46 |
var require_primitives = __commonJS({ |
| 47 |
"package-external:@wordpress/primitives"(exports, module) { |
| 48 |
module.exports = window.wp.primitives; |
| 49 |
} |
| 50 |
}); |
| 51 |
|
| 52 |
// vendor-external:react/jsx-runtime |
| 53 |
var require_jsx_runtime = __commonJS({ |
| 54 |
"vendor-external:react/jsx-runtime"(exports, module) { |
| 55 |
module.exports = window.ReactJSXRuntime; |
| 56 |
} |
| 57 |
}); |
| 58 |
|
| 59 |
// vendor-external:react |
| 60 |
var require_react = __commonJS({ |
| 61 |
"vendor-external:react"(exports, module) { |
| 62 |
module.exports = window.React; |
| 63 |
} |
| 64 |
}); |
| 65 |
|
| 66 |
// vendor-external:react-dom |
| 67 |
var require_react_dom = __commonJS({ |
| 68 |
"vendor-external:react-dom"(exports, module) { |
| 69 |
module.exports = window.ReactDOM; |
| 70 |
} |
| 71 |
}); |
| 72 |
|
| 73 |
// node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js |
| 74 |
var require_use_sync_external_store_shim_development = __commonJS({ |
| 75 |
"node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js"(exports) { |
| 76 |
"use strict"; |
| 77 |
(function() { |
| 78 |
function is(x, y) { |
| 79 |
return x === y && (0 !== x || 1 / x === 1 / y) || x !== x && y !== y; |
| 80 |
} |
| 81 |
function useSyncExternalStore$2(subscribe, getSnapshot) { |
| 82 |
didWarnOld18Alpha || void 0 === React117.startTransition || (didWarnOld18Alpha = true, console.error( |
| 83 |
"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." |
| 84 |
)); |
| 85 |
var value = getSnapshot(); |
| 86 |
if (!didWarnUncachedGetSnapshot) { |
| 87 |
var cachedValue = getSnapshot(); |
| 88 |
objectIs(value, cachedValue) || (console.error( |
| 89 |
"The result of getSnapshot should be cached to avoid an infinite loop" |
| 90 |
), didWarnUncachedGetSnapshot = true); |
| 91 |
} |
| 92 |
cachedValue = useState25({ |
| 93 |
inst: { value, getSnapshot } |
| 94 |
}); |
| 95 |
var inst = cachedValue[0].inst, forceUpdate = cachedValue[1]; |
| 96 |
useLayoutEffect3( |
| 97 |
function() { |
| 98 |
inst.value = value; |
| 99 |
inst.getSnapshot = getSnapshot; |
| 100 |
checkIfSnapshotChanged(inst) && forceUpdate({ inst }); |
| 101 |
}, |
| 102 |
[subscribe, value, getSnapshot] |
| 103 |
); |
| 104 |
useEffect22( |
| 105 |
function() { |
| 106 |
checkIfSnapshotChanged(inst) && forceUpdate({ inst }); |
| 107 |
return subscribe(function() { |
| 108 |
checkIfSnapshotChanged(inst) && forceUpdate({ inst }); |
| 109 |
}); |
| 110 |
}, |
| 111 |
[subscribe] |
| 112 |
); |
| 113 |
useDebugValue2(value); |
| 114 |
return value; |
| 115 |
} |
| 116 |
function checkIfSnapshotChanged(inst) { |
| 117 |
var latestGetSnapshot = inst.getSnapshot; |
| 118 |
inst = inst.value; |
| 119 |
try { |
| 120 |
var nextValue = latestGetSnapshot(); |
| 121 |
return !objectIs(inst, nextValue); |
| 122 |
} catch (error2) { |
| 123 |
return true; |
| 124 |
} |
| 125 |
} |
| 126 |
function useSyncExternalStore$1(subscribe, getSnapshot) { |
| 127 |
return getSnapshot(); |
| 128 |
} |
| 129 |
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error()); |
| 130 |
var React117 = require_react(), objectIs = "function" === typeof Object.is ? Object.is : is, useState25 = React117.useState, useEffect22 = React117.useEffect, useLayoutEffect3 = React117.useLayoutEffect, useDebugValue2 = React117.useDebugValue, didWarnOld18Alpha = false, didWarnUncachedGetSnapshot = false, shim = "undefined" === typeof window || "undefined" === typeof window.document || "undefined" === typeof window.document.createElement ? useSyncExternalStore$1 : useSyncExternalStore$2; |
| 131 |
exports.useSyncExternalStore = void 0 !== React117.useSyncExternalStore ? React117.useSyncExternalStore : shim; |
| 132 |
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error()); |
| 133 |
})(); |
| 134 |
} |
| 135 |
}); |
| 136 |
|
| 137 |
// node_modules/use-sync-external-store/shim/index.js |
| 138 |
var require_shim = __commonJS({ |
| 139 |
"node_modules/use-sync-external-store/shim/index.js"(exports, module) { |
| 140 |
"use strict"; |
| 141 |
if (false) { |
| 142 |
module.exports = null; |
| 143 |
} else { |
| 144 |
module.exports = require_use_sync_external_store_shim_development(); |
| 145 |
} |
| 146 |
} |
| 147 |
}); |
| 148 |
|
| 149 |
// node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js |
| 150 |
var require_with_selector_development = __commonJS({ |
| 151 |
"node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js"(exports) { |
| 152 |
"use strict"; |
| 153 |
(function() { |
| 154 |
function is(x, y) { |
| 155 |
return x === y && (0 !== x || 1 / x === 1 / y) || x !== x && y !== y; |
| 156 |
} |
| 157 |
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error()); |
| 158 |
var React117 = require_react(), shim = require_shim(), objectIs = "function" === typeof Object.is ? Object.is : is, useSyncExternalStore2 = shim.useSyncExternalStore, useRef43 = React117.useRef, useEffect22 = React117.useEffect, useMemo34 = React117.useMemo, useDebugValue2 = React117.useDebugValue; |
| 159 |
exports.useSyncExternalStoreWithSelector = function(subscribe, getSnapshot, getServerSnapshot, selector, isEqual) { |
| 160 |
var instRef = useRef43(null); |
| 161 |
if (null === instRef.current) { |
| 162 |
var inst = { hasValue: false, value: null }; |
| 163 |
instRef.current = inst; |
| 164 |
} else inst = instRef.current; |
| 165 |
instRef = useMemo34( |
| 166 |
function() { |
| 167 |
function memoizedSelector(nextSnapshot) { |
| 168 |
if (!hasMemo) { |
| 169 |
hasMemo = true; |
| 170 |
memoizedSnapshot = nextSnapshot; |
| 171 |
nextSnapshot = selector(nextSnapshot); |
| 172 |
if (void 0 !== isEqual && inst.hasValue) { |
| 173 |
var currentSelection = inst.value; |
| 174 |
if (isEqual(currentSelection, nextSnapshot)) |
| 175 |
return memoizedSelection = currentSelection; |
| 176 |
} |
| 177 |
return memoizedSelection = nextSnapshot; |
| 178 |
} |
| 179 |
currentSelection = memoizedSelection; |
| 180 |
if (objectIs(memoizedSnapshot, nextSnapshot)) |
| 181 |
return currentSelection; |
| 182 |
var nextSelection = selector(nextSnapshot); |
| 183 |
if (void 0 !== isEqual && isEqual(currentSelection, nextSelection)) |
| 184 |
return memoizedSnapshot = nextSnapshot, currentSelection; |
| 185 |
memoizedSnapshot = nextSnapshot; |
| 186 |
return memoizedSelection = nextSelection; |
| 187 |
} |
| 188 |
var hasMemo = false, memoizedSnapshot, memoizedSelection, maybeGetServerSnapshot = void 0 === getServerSnapshot ? null : getServerSnapshot; |
| 189 |
return [ |
| 190 |
function() { |
| 191 |
return memoizedSelector(getSnapshot()); |
| 192 |
}, |
| 193 |
null === maybeGetServerSnapshot ? void 0 : function() { |
| 194 |
return memoizedSelector(maybeGetServerSnapshot()); |
| 195 |
} |
| 196 |
]; |
| 197 |
}, |
| 198 |
[getSnapshot, getServerSnapshot, selector, isEqual] |
| 199 |
); |
| 200 |
var value = useSyncExternalStore2(subscribe, instRef[0], instRef[1]); |
| 201 |
useEffect22( |
| 202 |
function() { |
| 203 |
inst.hasValue = true; |
| 204 |
inst.value = value; |
| 205 |
}, |
| 206 |
[value] |
| 207 |
); |
| 208 |
useDebugValue2(value); |
| 209 |
return value; |
| 210 |
}; |
| 211 |
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error()); |
| 212 |
})(); |
| 213 |
} |
| 214 |
}); |
| 215 |
|
| 216 |
// node_modules/use-sync-external-store/shim/with-selector.js |
| 217 |
var require_with_selector = __commonJS({ |
| 218 |
"node_modules/use-sync-external-store/shim/with-selector.js"(exports, module) { |
| 219 |
"use strict"; |
| 220 |
if (false) { |
| 221 |
module.exports = null; |
| 222 |
} else { |
| 223 |
module.exports = require_with_selector_development(); |
| 224 |
} |
| 225 |
} |
| 226 |
}); |
| 227 |
|
| 228 |
// package-external:@wordpress/theme |
| 229 |
var require_theme = __commonJS({ |
| 230 |
"package-external:@wordpress/theme"(exports, module) { |
| 231 |
module.exports = window.wp.theme; |
| 232 |
} |
| 233 |
}); |
| 234 |
|
| 235 |
// package-external:@wordpress/private-apis |
| 236 |
var require_private_apis = __commonJS({ |
| 237 |
"package-external:@wordpress/private-apis"(exports, module) { |
| 238 |
module.exports = window.wp.privateApis; |
| 239 |
} |
| 240 |
}); |
| 241 |
|
| 242 |
// widgets/events/widget.ts |
| 243 |
var import_i18n5 = __toESM(require_i18n()); |
| 244 |
|
| 245 |
// packages/icons/build-module/library/calendar.mjs |
| 246 |
var import_primitives = __toESM(require_primitives(), 1); |
| 247 |
var import_jsx_runtime = __toESM(require_jsx_runtime(), 1); |
| 248 |
var calendar_default = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_primitives.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_primitives.Path, { d: "M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm.5 16c0 .3-.2.5-.5.5H5c-.3 0-.5-.2-.5-.5V7h15v12zM9 10H7v2h2v-2zm0 4H7v2h2v-2zm4-4h-2v2h2v-2zm4 0h-2v2h2v-2zm-4 4h-2v2h2v-2zm4 0h-2v2h2v-2z" }) }); |
| 249 |
|
| 250 |
// packages/icons/build-module/library/close-small.mjs |
| 251 |
var import_primitives2 = __toESM(require_primitives(), 1); |
| 252 |
var import_jsx_runtime2 = __toESM(require_jsx_runtime(), 1); |
| 253 |
var close_small_default = /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_primitives2.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_primitives2.Path, { d: "M12 13.06l3.712 3.713 1.061-1.06L13.061 12l3.712-3.712-1.06-1.06L12 10.938 8.288 7.227l-1.061 1.06L10.939 12l-3.712 3.712 1.06 1.061L12 13.061z" }) }); |
| 254 |
|
| 255 |
// packages/icons/build-module/library/map-marker.mjs |
| 256 |
var import_primitives3 = __toESM(require_primitives(), 1); |
| 257 |
var import_jsx_runtime3 = __toESM(require_jsx_runtime(), 1); |
| 258 |
var map_marker_default = /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_primitives3.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_primitives3.Path, { d: "M12 9c-.8 0-1.5.7-1.5 1.5S11.2 12 12 12s1.5-.7 1.5-1.5S12.8 9 12 9zm0-5c-3.6 0-6.5 2.8-6.5 6.2 0 .8.3 1.8.9 3.1.5 1.1 1.2 2.3 2 3.6.7 1 3 3.8 3.2 3.9l.4.5.4-.5c.2-.2 2.6-2.9 3.2-3.9.8-1.2 1.5-2.5 2-3.6.6-1.3.9-2.3.9-3.1C18.5 6.8 15.6 4 12 4zm4.3 8.7c-.5 1-1.1 2.2-1.9 3.4-.5.7-1.7 2.2-2.4 3-.7-.8-1.9-2.3-2.4-3-.8-1.2-1.4-2.3-1.9-3.3-.6-1.4-.7-2.2-.7-2.5 0-2.6 2.2-4.7 5-4.7s5 2.1 5 4.7c0 .2-.1 1-.7 2.4z" }) }); |
| 259 |
|
| 260 |
// widgets/events/components/location-setting-control/location-setting-control.tsx |
| 261 |
var import_element51 = __toESM(require_element()); |
| 262 |
|
| 263 |
// widgets/events/components/location-picker/location-picker.tsx |
| 264 |
var import_element50 = __toESM(require_element()); |
| 265 |
var import_i18n4 = __toESM(require_i18n()); |
| 266 |
|
| 267 |
// node_modules/clsx/dist/clsx.mjs |
| 268 |
function r(e) { |
| 269 |
var t, f, n = ""; |
| 270 |
if ("string" == typeof e || "number" == typeof e) n += e; |
| 271 |
else if ("object" == typeof e) if (Array.isArray(e)) { |
| 272 |
var o = e.length; |
| 273 |
for (t = 0; t < o; t++) e[t] && (f = r(e[t])) && (n && (n += " "), n += f); |
| 274 |
} else for (f in e) e[f] && (n && (n += " "), n += f); |
| 275 |
return n; |
| 276 |
} |
| 277 |
function clsx() { |
| 278 |
for (var e, t, f = 0, n = "", o = arguments.length; f < o; f++) (e = arguments[f]) && (t = r(e)) && (n && (n += " "), n += t); |
| 279 |
return n; |
| 280 |
} |
| 281 |
var clsx_default = clsx; |
| 282 |
|
| 283 |
// node_modules/@base-ui/utils/esm/useControlled.js |
| 284 |
var React = __toESM(require_react(), 1); |
| 285 |
|
| 286 |
// node_modules/@base-ui/utils/esm/error.js |
| 287 |
var set; |
| 288 |
if (true) { |
| 289 |
set = /* @__PURE__ */ new Set(); |
| 290 |
} |
| 291 |
function error(...messages) { |
| 292 |
if (true) { |
| 293 |
const messageKey = messages.join(" "); |
| 294 |
if (!set.has(messageKey)) { |
| 295 |
set.add(messageKey); |
| 296 |
console.error(`Base UI: ${messageKey}`); |
| 297 |
} |
| 298 |
} |
| 299 |
} |
| 300 |
|
| 301 |
// node_modules/@base-ui/utils/esm/useControlled.js |
| 302 |
function useControlled({ |
| 303 |
controlled, |
| 304 |
default: defaultProp, |
| 305 |
name, |
| 306 |
state = "value" |
| 307 |
}) { |
| 308 |
const { |
| 309 |
current: isControlled |
| 310 |
} = React.useRef(controlled !== void 0); |
| 311 |
const [valueState, setValue] = React.useState(defaultProp); |
| 312 |
const value = isControlled ? controlled : valueState; |
| 313 |
if (true) { |
| 314 |
React.useEffect(() => { |
| 315 |
if (isControlled !== (controlled !== void 0)) { |
| 316 |
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")); |
| 317 |
} |
| 318 |
}, [state, name, controlled]); |
| 319 |
const { |
| 320 |
current: defaultValue |
| 321 |
} = React.useRef(defaultProp); |
| 322 |
React.useEffect(() => { |
| 323 |
if (!isControlled && serializeToDevModeString(defaultValue) !== serializeToDevModeString(defaultProp)) { |
| 324 |
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")); |
| 325 |
} |
| 326 |
}, [defaultProp]); |
| 327 |
} |
| 328 |
const setValueIfUncontrolled = React.useCallback((newValue) => { |
| 329 |
if (!isControlled) { |
| 330 |
setValue(newValue); |
| 331 |
} |
| 332 |
}, []); |
| 333 |
return [value, setValueIfUncontrolled]; |
| 334 |
} |
| 335 |
function serializeToDevModeString(input) { |
| 336 |
let nextId = 0; |
| 337 |
const seen = /* @__PURE__ */ new WeakMap(); |
| 338 |
try { |
| 339 |
const result = JSON.stringify(input, function replacer(key, value) { |
| 340 |
if (key === "_owner" && this != null && typeof this === "object" && "$$typeof" in this) { |
| 341 |
return void 0; |
| 342 |
} |
| 343 |
if (typeof value === "bigint") { |
| 344 |
return `__bigint__:${value}`; |
| 345 |
} |
| 346 |
if (value !== null && typeof value === "object") { |
| 347 |
const id = seen.get(value); |
| 348 |
if (id !== void 0) { |
| 349 |
return `__object__:${id}`; |
| 350 |
} |
| 351 |
seen.set(value, nextId); |
| 352 |
nextId += 1; |
| 353 |
} |
| 354 |
return value; |
| 355 |
}); |
| 356 |
return result ?? `__top__:${typeof input}`; |
| 357 |
} catch { |
| 358 |
return "__unserializable__"; |
| 359 |
} |
| 360 |
} |
| 361 |
|
| 362 |
// node_modules/@base-ui/utils/esm/safeReact.js |
| 363 |
var React2 = __toESM(require_react(), 1); |
| 364 |
var SafeReact = { |
| 365 |
...React2 |
| 366 |
}; |
| 367 |
|
| 368 |
// node_modules/@base-ui/utils/esm/useRefWithInit.js |
| 369 |
var React3 = __toESM(require_react(), 1); |
| 370 |
var UNINITIALIZED = {}; |
| 371 |
function useRefWithInit(init, initArg) { |
| 372 |
const ref = React3.useRef(UNINITIALIZED); |
| 373 |
if (ref.current === UNINITIALIZED) { |
| 374 |
ref.current = init(initArg); |
| 375 |
} |
| 376 |
return ref; |
| 377 |
} |
| 378 |
|
| 379 |
// node_modules/@base-ui/utils/esm/useStableCallback.js |
| 380 |
var useInsertionEffect = SafeReact.useInsertionEffect; |
| 381 |
var useSafeInsertionEffect = ( |
| 382 |
// React 17 doesn't have useInsertionEffect. |
| 383 |
useInsertionEffect && // Preact replaces useInsertionEffect with useLayoutEffect and fires too late. |
| 384 |
useInsertionEffect !== SafeReact.useLayoutEffect ? useInsertionEffect : (fn) => fn() |
| 385 |
); |
| 386 |
function useStableCallback(callback) { |
| 387 |
const stable = useRefWithInit(createStableCallback).current; |
| 388 |
stable.next = callback; |
| 389 |
useSafeInsertionEffect(stable.effect); |
| 390 |
return stable.trampoline; |
| 391 |
} |
| 392 |
function createStableCallback() { |
| 393 |
const stable = { |
| 394 |
next: void 0, |
| 395 |
callback: assertNotCalled, |
| 396 |
trampoline: (...args) => stable.callback?.(...args), |
| 397 |
effect: () => { |
| 398 |
stable.callback = stable.next; |
| 399 |
} |
| 400 |
}; |
| 401 |
return stable; |
| 402 |
} |
| 403 |
function assertNotCalled() { |
| 404 |
if (true) { |
| 405 |
throw ( |
| 406 |
/* minify-error-disabled */ |
| 407 |
new Error("Base UI: Cannot call an event handler while rendering.") |
| 408 |
); |
| 409 |
} |
| 410 |
} |
| 411 |
|
| 412 |
// node_modules/@base-ui/utils/esm/useIsoLayoutEffect.js |
| 413 |
var React4 = __toESM(require_react(), 1); |
| 414 |
var noop = () => { |
| 415 |
}; |
| 416 |
var useIsoLayoutEffect = typeof document !== "undefined" ? React4.useLayoutEffect : noop; |
| 417 |
|
| 418 |
// node_modules/@base-ui/utils/esm/warn.js |
| 419 |
var set2; |
| 420 |
if (true) { |
| 421 |
set2 = /* @__PURE__ */ new Set(); |
| 422 |
} |
| 423 |
function warn(...messages) { |
| 424 |
if (true) { |
| 425 |
const messageKey = messages.join(" "); |
| 426 |
if (!set2.has(messageKey)) { |
| 427 |
set2.add(messageKey); |
| 428 |
console.warn(`Base UI: ${messageKey}`); |
| 429 |
} |
| 430 |
} |
| 431 |
} |
| 432 |
|
| 433 |
// node_modules/@base-ui/react/esm/internals/composite/list/CompositeList.js |
| 434 |
var React6 = __toESM(require_react(), 1); |
| 435 |
|
| 436 |
// node_modules/@base-ui/react/esm/internals/composite/list/CompositeListContext.js |
| 437 |
var React5 = __toESM(require_react(), 1); |
| 438 |
var CompositeListContext = /* @__PURE__ */ React5.createContext({ |
| 439 |
register: () => { |
| 440 |
}, |
| 441 |
unregister: () => { |
| 442 |
}, |
| 443 |
subscribeMapChange: () => { |
| 444 |
return () => { |
| 445 |
}; |
| 446 |
}, |
| 447 |
elementsRef: { |
| 448 |
current: [] |
| 449 |
}, |
| 450 |
nextIndexRef: { |
| 451 |
current: 0 |
| 452 |
} |
| 453 |
}); |
| 454 |
if (true) CompositeListContext.displayName = "CompositeListContext"; |
| 455 |
function useCompositeListContext() { |
| 456 |
return React5.useContext(CompositeListContext); |
| 457 |
} |
| 458 |
|
| 459 |
// node_modules/@base-ui/react/esm/internals/composite/list/CompositeList.js |
| 460 |
var import_jsx_runtime4 = __toESM(require_jsx_runtime(), 1); |
| 461 |
function CompositeList(props) { |
| 462 |
const { |
| 463 |
children, |
| 464 |
elementsRef, |
| 465 |
labelsRef, |
| 466 |
onMapChange: onMapChangeProp |
| 467 |
} = props; |
| 468 |
const onMapChange = useStableCallback(onMapChangeProp); |
| 469 |
const nextIndexRef = React6.useRef(0); |
| 470 |
const listeners = useRefWithInit(createListeners).current; |
| 471 |
const map = useRefWithInit(createMap).current; |
| 472 |
const [mapTick, setMapTick] = React6.useState(0); |
| 473 |
const lastTickRef = React6.useRef(mapTick); |
| 474 |
const register2 = useStableCallback((node, metadata) => { |
| 475 |
map.set(node, metadata ?? null); |
| 476 |
lastTickRef.current += 1; |
| 477 |
setMapTick(lastTickRef.current); |
| 478 |
}); |
| 479 |
const unregister = useStableCallback((node) => { |
| 480 |
map.delete(node); |
| 481 |
lastTickRef.current += 1; |
| 482 |
setMapTick(lastTickRef.current); |
| 483 |
}); |
| 484 |
const sortedMap = React6.useMemo(() => { |
| 485 |
disableEslintWarning(mapTick); |
| 486 |
const newMap = /* @__PURE__ */ new Map(); |
| 487 |
const sortedNodes = Array.from(map.keys()).filter((node) => node.isConnected).sort(sortByDocumentPosition); |
| 488 |
sortedNodes.forEach((node, index2) => { |
| 489 |
const metadata = map.get(node) ?? {}; |
| 490 |
newMap.set(node, { |
| 491 |
...metadata, |
| 492 |
index: index2 |
| 493 |
}); |
| 494 |
}); |
| 495 |
return newMap; |
| 496 |
}, [map, mapTick]); |
| 497 |
useIsoLayoutEffect(() => { |
| 498 |
if (typeof MutationObserver !== "function" || sortedMap.size === 0) { |
| 499 |
return void 0; |
| 500 |
} |
| 501 |
const mutationObserver = new MutationObserver((entries) => { |
| 502 |
const diff = /* @__PURE__ */ new Set(); |
| 503 |
const updateDiff = (node) => diff.has(node) ? diff.delete(node) : diff.add(node); |
| 504 |
entries.forEach((entry) => { |
| 505 |
entry.removedNodes.forEach(updateDiff); |
| 506 |
entry.addedNodes.forEach(updateDiff); |
| 507 |
}); |
| 508 |
if (diff.size === 0) { |
| 509 |
lastTickRef.current += 1; |
| 510 |
setMapTick(lastTickRef.current); |
| 511 |
} |
| 512 |
}); |
| 513 |
sortedMap.forEach((_, node) => { |
| 514 |
if (node.parentElement) { |
| 515 |
mutationObserver.observe(node.parentElement, { |
| 516 |
childList: true |
| 517 |
}); |
| 518 |
} |
| 519 |
}); |
| 520 |
return () => { |
| 521 |
mutationObserver.disconnect(); |
| 522 |
}; |
| 523 |
}, [sortedMap]); |
| 524 |
useIsoLayoutEffect(() => { |
| 525 |
const shouldUpdateLengths = lastTickRef.current === mapTick; |
| 526 |
if (shouldUpdateLengths) { |
| 527 |
if (elementsRef.current.length !== sortedMap.size) { |
| 528 |
elementsRef.current.length = sortedMap.size; |
| 529 |
} |
| 530 |
if (labelsRef && labelsRef.current.length !== sortedMap.size) { |
| 531 |
labelsRef.current.length = sortedMap.size; |
| 532 |
} |
| 533 |
nextIndexRef.current = sortedMap.size; |
| 534 |
} |
| 535 |
onMapChange(sortedMap); |
| 536 |
}, [onMapChange, sortedMap, elementsRef, labelsRef, mapTick]); |
| 537 |
useIsoLayoutEffect(() => { |
| 538 |
return () => { |
| 539 |
elementsRef.current = []; |
| 540 |
}; |
| 541 |
}, [elementsRef]); |
| 542 |
useIsoLayoutEffect(() => { |
| 543 |
return () => { |
| 544 |
if (labelsRef) { |
| 545 |
labelsRef.current = []; |
| 546 |
} |
| 547 |
}; |
| 548 |
}, [labelsRef]); |
| 549 |
const subscribeMapChange = useStableCallback((fn) => { |
| 550 |
listeners.add(fn); |
| 551 |
return () => { |
| 552 |
listeners.delete(fn); |
| 553 |
}; |
| 554 |
}); |
| 555 |
useIsoLayoutEffect(() => { |
| 556 |
listeners.forEach((l) => l(sortedMap)); |
| 557 |
}, [listeners, sortedMap]); |
| 558 |
const contextValue = React6.useMemo(() => ({ |
| 559 |
register: register2, |
| 560 |
unregister, |
| 561 |
subscribeMapChange, |
| 562 |
elementsRef, |
| 563 |
labelsRef, |
| 564 |
nextIndexRef |
| 565 |
}), [register2, unregister, subscribeMapChange, elementsRef, labelsRef, nextIndexRef]); |
| 566 |
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(CompositeListContext.Provider, { |
| 567 |
value: contextValue, |
| 568 |
children |
| 569 |
}); |
| 570 |
} |
| 571 |
function createMap() { |
| 572 |
return /* @__PURE__ */ new Map(); |
| 573 |
} |
| 574 |
function createListeners() { |
| 575 |
return /* @__PURE__ */ new Set(); |
| 576 |
} |
| 577 |
function sortByDocumentPosition(a, b) { |
| 578 |
const position = a.compareDocumentPosition(b); |
| 579 |
if (position & Node.DOCUMENT_POSITION_FOLLOWING || position & Node.DOCUMENT_POSITION_CONTAINED_BY) { |
| 580 |
return -1; |
| 581 |
} |
| 582 |
if (position & Node.DOCUMENT_POSITION_PRECEDING || position & Node.DOCUMENT_POSITION_CONTAINS) { |
| 583 |
return 1; |
| 584 |
} |
| 585 |
return 0; |
| 586 |
} |
| 587 |
function disableEslintWarning(_) { |
| 588 |
} |
| 589 |
|
| 590 |
// node_modules/@base-ui/react/esm/internals/direction-context/DirectionContext.js |
| 591 |
var React7 = __toESM(require_react(), 1); |
| 592 |
var DirectionContext = /* @__PURE__ */ React7.createContext(void 0); |
| 593 |
if (true) DirectionContext.displayName = "DirectionContext"; |
| 594 |
function useDirection() { |
| 595 |
const context = React7.useContext(DirectionContext); |
| 596 |
return context?.direction ?? "ltr"; |
| 597 |
} |
| 598 |
|
| 599 |
// node_modules/@base-ui/react/esm/internals/useRenderElement.js |
| 600 |
var React10 = __toESM(require_react(), 1); |
| 601 |
|
| 602 |
// node_modules/@base-ui/utils/esm/useMergedRefs.js |
| 603 |
function useMergedRefs(a, b, c, d) { |
| 604 |
const forkRef = useRefWithInit(createForkRef).current; |
| 605 |
if (didChange(forkRef, a, b, c, d)) { |
| 606 |
update(forkRef, [a, b, c, d]); |
| 607 |
} |
| 608 |
return forkRef.callback; |
| 609 |
} |
| 610 |
function useMergedRefsN(refs) { |
| 611 |
const forkRef = useRefWithInit(createForkRef).current; |
| 612 |
if (didChangeN(forkRef, refs)) { |
| 613 |
update(forkRef, refs); |
| 614 |
} |
| 615 |
return forkRef.callback; |
| 616 |
} |
| 617 |
function createForkRef() { |
| 618 |
return { |
| 619 |
callback: null, |
| 620 |
cleanup: null, |
| 621 |
refs: [] |
| 622 |
}; |
| 623 |
} |
| 624 |
function didChange(forkRef, a, b, c, d) { |
| 625 |
return forkRef.refs[0] !== a || forkRef.refs[1] !== b || forkRef.refs[2] !== c || forkRef.refs[3] !== d; |
| 626 |
} |
| 627 |
function didChangeN(forkRef, newRefs) { |
| 628 |
return forkRef.refs.length !== newRefs.length || forkRef.refs.some((ref, index2) => ref !== newRefs[index2]); |
| 629 |
} |
| 630 |
function update(forkRef, refs) { |
| 631 |
forkRef.refs = refs; |
| 632 |
if (refs.every((ref) => ref == null)) { |
| 633 |
forkRef.callback = null; |
| 634 |
return; |
| 635 |
} |
| 636 |
forkRef.callback = (instance) => { |
| 637 |
if (forkRef.cleanup) { |
| 638 |
forkRef.cleanup(); |
| 639 |
forkRef.cleanup = null; |
| 640 |
} |
| 641 |
if (instance != null) { |
| 642 |
const cleanupCallbacks = Array(refs.length).fill(null); |
| 643 |
for (let i = 0; i < refs.length; i += 1) { |
| 644 |
const ref = refs[i]; |
| 645 |
if (ref == null) { |
| 646 |
continue; |
| 647 |
} |
| 648 |
switch (typeof ref) { |
| 649 |
case "function": { |
| 650 |
const refCleanup = ref(instance); |
| 651 |
if (typeof refCleanup === "function") { |
| 652 |
cleanupCallbacks[i] = refCleanup; |
| 653 |
} |
| 654 |
break; |
| 655 |
} |
| 656 |
case "object": { |
| 657 |
ref.current = instance; |
| 658 |
break; |
| 659 |
} |
| 660 |
default: |
| 661 |
} |
| 662 |
} |
| 663 |
forkRef.cleanup = () => { |
| 664 |
for (let i = 0; i < refs.length; i += 1) { |
| 665 |
const ref = refs[i]; |
| 666 |
if (ref == null) { |
| 667 |
continue; |
| 668 |
} |
| 669 |
switch (typeof ref) { |
| 670 |
case "function": { |
| 671 |
const cleanupCallback = cleanupCallbacks[i]; |
| 672 |
if (typeof cleanupCallback === "function") { |
| 673 |
cleanupCallback(); |
| 674 |
} else { |
| 675 |
ref(null); |
| 676 |
} |
| 677 |
break; |
| 678 |
} |
| 679 |
case "object": { |
| 680 |
ref.current = null; |
| 681 |
break; |
| 682 |
} |
| 683 |
default: |
| 684 |
} |
| 685 |
} |
| 686 |
}; |
| 687 |
} |
| 688 |
}; |
| 689 |
} |
| 690 |
|
| 691 |
// node_modules/@base-ui/utils/esm/getReactElementRef.js |
| 692 |
var React9 = __toESM(require_react(), 1); |
| 693 |
|
| 694 |
// node_modules/@base-ui/utils/esm/reactVersion.js |
| 695 |
var React8 = __toESM(require_react(), 1); |
| 696 |
var majorVersion = parseInt(React8.version, 10); |
| 697 |
function isReactVersionAtLeast(reactVersionToCheck) { |
| 698 |
return majorVersion >= reactVersionToCheck; |
| 699 |
} |
| 700 |
|
| 701 |
// node_modules/@base-ui/utils/esm/getReactElementRef.js |
| 702 |
function getReactElementRef(element) { |
| 703 |
if (!/* @__PURE__ */ React9.isValidElement(element)) { |
| 704 |
return null; |
| 705 |
} |
| 706 |
const reactElement = element; |
| 707 |
const propsWithRef = reactElement.props; |
| 708 |
return (isReactVersionAtLeast(19) ? propsWithRef?.ref : reactElement.ref) ?? null; |
| 709 |
} |
| 710 |
|
| 711 |
// node_modules/@base-ui/utils/esm/mergeObjects.js |
| 712 |
function mergeObjects(a, b) { |
| 713 |
if (a && !b) { |
| 714 |
return a; |
| 715 |
} |
| 716 |
if (!a && b) { |
| 717 |
return b; |
| 718 |
} |
| 719 |
if (a || b) { |
| 720 |
return { |
| 721 |
...a, |
| 722 |
...b |
| 723 |
}; |
| 724 |
} |
| 725 |
return void 0; |
| 726 |
} |
| 727 |
|
| 728 |
// node_modules/@base-ui/utils/esm/empty.js |
| 729 |
function NOOP() { |
| 730 |
} |
| 731 |
var EMPTY_ARRAY = Object.freeze([]); |
| 732 |
var EMPTY_OBJECT = Object.freeze({}); |
| 733 |
|
| 734 |
// node_modules/@base-ui/react/esm/internals/getStateAttributesProps.js |
| 735 |
function getStateAttributesProps(state, customMapping) { |
| 736 |
const props = {}; |
| 737 |
for (const key in state) { |
| 738 |
const value = state[key]; |
| 739 |
if (customMapping?.hasOwnProperty(key)) { |
| 740 |
const customProps = customMapping[key](value); |
| 741 |
if (customProps != null) { |
| 742 |
Object.assign(props, customProps); |
| 743 |
} |
| 744 |
continue; |
| 745 |
} |
| 746 |
if (value === true) { |
| 747 |
props[`data-${key.toLowerCase()}`] = ""; |
| 748 |
} else if (value) { |
| 749 |
props[`data-${key.toLowerCase()}`] = value.toString(); |
| 750 |
} |
| 751 |
} |
| 752 |
return props; |
| 753 |
} |
| 754 |
|
| 755 |
// node_modules/@base-ui/react/esm/utils/resolveClassName.js |
| 756 |
function resolveClassName(className, state) { |
| 757 |
return typeof className === "function" ? className(state) : className; |
| 758 |
} |
| 759 |
|
| 760 |
// node_modules/@base-ui/react/esm/utils/resolveStyle.js |
| 761 |
function resolveStyle(style, state) { |
| 762 |
return typeof style === "function" ? style(state) : style; |
| 763 |
} |
| 764 |
|
| 765 |
// node_modules/@base-ui/react/esm/merge-props/mergeProps.js |
| 766 |
var EMPTY_PROPS = {}; |
| 767 |
function mergeProps(a, b, c, d, e) { |
| 768 |
if (!c && !d && !e && !a) { |
| 769 |
return createInitialMergedProps(b); |
| 770 |
} |
| 771 |
let merged = createInitialMergedProps(a); |
| 772 |
if (b) { |
| 773 |
merged = mergeInto(merged, b); |
| 774 |
} |
| 775 |
if (c) { |
| 776 |
merged = mergeInto(merged, c); |
| 777 |
} |
| 778 |
if (d) { |
| 779 |
merged = mergeInto(merged, d); |
| 780 |
} |
| 781 |
if (e) { |
| 782 |
merged = mergeInto(merged, e); |
| 783 |
} |
| 784 |
return merged; |
| 785 |
} |
| 786 |
function mergePropsN(props) { |
| 787 |
if (props.length === 0) { |
| 788 |
return EMPTY_PROPS; |
| 789 |
} |
| 790 |
if (props.length === 1) { |
| 791 |
return createInitialMergedProps(props[0]); |
| 792 |
} |
| 793 |
let merged = createInitialMergedProps(props[0]); |
| 794 |
for (let i = 1; i < props.length; i += 1) { |
| 795 |
merged = mergeInto(merged, props[i]); |
| 796 |
} |
| 797 |
return merged; |
| 798 |
} |
| 799 |
function createInitialMergedProps(inputProps) { |
| 800 |
if (isPropsGetter(inputProps)) { |
| 801 |
return { |
| 802 |
...resolvePropsGetter(inputProps, EMPTY_PROPS) |
| 803 |
}; |
| 804 |
} |
| 805 |
return copyInitialProps(inputProps); |
| 806 |
} |
| 807 |
function mergeInto(merged, inputProps) { |
| 808 |
if (isPropsGetter(inputProps)) { |
| 809 |
return resolvePropsGetter(inputProps, merged); |
| 810 |
} |
| 811 |
return mutablyMergeInto(merged, inputProps); |
| 812 |
} |
| 813 |
function copyInitialProps(inputProps) { |
| 814 |
const copiedProps = { |
| 815 |
...inputProps |
| 816 |
}; |
| 817 |
for (const propName in copiedProps) { |
| 818 |
const propValue = copiedProps[propName]; |
| 819 |
if (isEventHandler(propName, propValue)) { |
| 820 |
copiedProps[propName] = wrapEventHandler(propValue); |
| 821 |
} |
| 822 |
} |
| 823 |
return copiedProps; |
| 824 |
} |
| 825 |
function mutablyMergeInto(mergedProps, externalProps) { |
| 826 |
if (!externalProps) { |
| 827 |
return mergedProps; |
| 828 |
} |
| 829 |
for (const propName in externalProps) { |
| 830 |
const externalPropValue = externalProps[propName]; |
| 831 |
switch (propName) { |
| 832 |
case "style": { |
| 833 |
mergedProps[propName] = mergeObjects(mergedProps.style, externalPropValue); |
| 834 |
break; |
| 835 |
} |
| 836 |
case "className": { |
| 837 |
mergedProps[propName] = mergeClassNames(mergedProps.className, externalPropValue); |
| 838 |
break; |
| 839 |
} |
| 840 |
default: { |
| 841 |
if (isEventHandler(propName, externalPropValue)) { |
| 842 |
mergedProps[propName] = mergeEventHandlers(mergedProps[propName], externalPropValue); |
| 843 |
} else { |
| 844 |
mergedProps[propName] = externalPropValue; |
| 845 |
} |
| 846 |
} |
| 847 |
} |
| 848 |
} |
| 849 |
return mergedProps; |
| 850 |
} |
| 851 |
function isEventHandler(key, value) { |
| 852 |
const code0 = key.charCodeAt(0); |
| 853 |
const code1 = key.charCodeAt(1); |
| 854 |
const code2 = key.charCodeAt(2); |
| 855 |
return code0 === 111 && code1 === 110 && code2 >= 65 && code2 <= 90 && (typeof value === "function" || typeof value === "undefined"); |
| 856 |
} |
| 857 |
function isPropsGetter(inputProps) { |
| 858 |
return typeof inputProps === "function"; |
| 859 |
} |
| 860 |
function resolvePropsGetter(inputProps, previousProps) { |
| 861 |
if (isPropsGetter(inputProps)) { |
| 862 |
return inputProps(previousProps); |
| 863 |
} |
| 864 |
return inputProps ?? EMPTY_PROPS; |
| 865 |
} |
| 866 |
function mergeEventHandlers(ourHandler, theirHandler) { |
| 867 |
if (!theirHandler) { |
| 868 |
return ourHandler; |
| 869 |
} |
| 870 |
if (!ourHandler) { |
| 871 |
return wrapEventHandler(theirHandler); |
| 872 |
} |
| 873 |
return (...args) => { |
| 874 |
const event = args[0]; |
| 875 |
if (isSyntheticEvent(event)) { |
| 876 |
const baseUIEvent = event; |
| 877 |
makeEventPreventable(baseUIEvent); |
| 878 |
const result2 = theirHandler(...args); |
| 879 |
if (!baseUIEvent.baseUIHandlerPrevented) { |
| 880 |
ourHandler?.(...args); |
| 881 |
} |
| 882 |
return result2; |
| 883 |
} |
| 884 |
const result = theirHandler(...args); |
| 885 |
ourHandler?.(...args); |
| 886 |
return result; |
| 887 |
}; |
| 888 |
} |
| 889 |
function wrapEventHandler(handler) { |
| 890 |
if (!handler) { |
| 891 |
return handler; |
| 892 |
} |
| 893 |
return (...args) => { |
| 894 |
const event = args[0]; |
| 895 |
if (isSyntheticEvent(event)) { |
| 896 |
makeEventPreventable(event); |
| 897 |
} |
| 898 |
return handler(...args); |
| 899 |
}; |
| 900 |
} |
| 901 |
function makeEventPreventable(event) { |
| 902 |
event.preventBaseUIHandler = () => { |
| 903 |
event.baseUIHandlerPrevented = true; |
| 904 |
}; |
| 905 |
return event; |
| 906 |
} |
| 907 |
function mergeClassNames(ourClassName, theirClassName) { |
| 908 |
if (theirClassName) { |
| 909 |
if (ourClassName) { |
| 910 |
return theirClassName + " " + ourClassName; |
| 911 |
} |
| 912 |
return theirClassName; |
| 913 |
} |
| 914 |
return ourClassName; |
| 915 |
} |
| 916 |
function isSyntheticEvent(event) { |
| 917 |
return event != null && typeof event === "object" && "nativeEvent" in event; |
| 918 |
} |
| 919 |
|
| 920 |
// node_modules/@base-ui/react/esm/internals/useRenderElement.js |
| 921 |
var import_react = __toESM(require_react(), 1); |
| 922 |
function useRenderElement(element, componentProps, params = {}) { |
| 923 |
const renderProp = componentProps.render; |
| 924 |
const outProps = useRenderElementProps(componentProps, params); |
| 925 |
if (params.enabled === false) { |
| 926 |
return null; |
| 927 |
} |
| 928 |
const state = params.state ?? EMPTY_OBJECT; |
| 929 |
return evaluateRenderProp(element, renderProp, outProps, state); |
| 930 |
} |
| 931 |
function useRenderElementProps(componentProps, params = {}) { |
| 932 |
const { |
| 933 |
className: classNameProp, |
| 934 |
style: styleProp, |
| 935 |
render: renderProp |
| 936 |
} = componentProps; |
| 937 |
const { |
| 938 |
state = EMPTY_OBJECT, |
| 939 |
ref, |
| 940 |
props, |
| 941 |
stateAttributesMapping: stateAttributesMapping7, |
| 942 |
enabled = true |
| 943 |
} = params; |
| 944 |
const className = enabled ? resolveClassName(classNameProp, state) : void 0; |
| 945 |
const style = enabled ? resolveStyle(styleProp, state) : void 0; |
| 946 |
const stateProps = enabled ? getStateAttributesProps(state, stateAttributesMapping7) : EMPTY_OBJECT; |
| 947 |
const resolvedProps = enabled && props ? resolveRenderFunctionProps(props) : void 0; |
| 948 |
const outProps = enabled ? mergeObjects(stateProps, resolvedProps) ?? {} : EMPTY_OBJECT; |
| 949 |
if (typeof document !== "undefined") { |
| 950 |
if (!enabled) { |
| 951 |
useMergedRefs(null, null); |
| 952 |
} else if (Array.isArray(ref)) { |
| 953 |
outProps.ref = useMergedRefsN([outProps.ref, getReactElementRef(renderProp), ...ref]); |
| 954 |
} else { |
| 955 |
outProps.ref = useMergedRefs(outProps.ref, getReactElementRef(renderProp), ref); |
| 956 |
} |
| 957 |
} |
| 958 |
if (!enabled) { |
| 959 |
return EMPTY_OBJECT; |
| 960 |
} |
| 961 |
if (className !== void 0) { |
| 962 |
outProps.className = mergeClassNames(outProps.className, className); |
| 963 |
} |
| 964 |
if (style !== void 0) { |
| 965 |
outProps.style = mergeObjects(outProps.style, style); |
| 966 |
} |
| 967 |
return outProps; |
| 968 |
} |
| 969 |
function resolveRenderFunctionProps(props) { |
| 970 |
if (Array.isArray(props)) { |
| 971 |
return mergePropsN(props); |
| 972 |
} |
| 973 |
return mergeProps(void 0, props); |
| 974 |
} |
| 975 |
var REACT_LAZY_TYPE = /* @__PURE__ */ Symbol.for("react.lazy"); |
| 976 |
var COMPONENT_IDENTIFIER_PATTERN = /^[A-Z][A-Za-z0-9$]*$/; |
| 977 |
var LOWERCASE_CHARACTER_PATTERN = /[a-z]/; |
| 978 |
function evaluateRenderProp(element, render, props, state) { |
| 979 |
if (render) { |
| 980 |
if (typeof render === "function") { |
| 981 |
if (true) { |
| 982 |
warnIfRenderPropLooksLikeComponent(render); |
| 983 |
} |
| 984 |
return render(props, state); |
| 985 |
} |
| 986 |
const mergedProps = mergeProps(props, render.props); |
| 987 |
mergedProps.ref = props.ref; |
| 988 |
let newElement = render; |
| 989 |
if (newElement?.$$typeof === REACT_LAZY_TYPE) { |
| 990 |
const children = React10.Children.toArray(render); |
| 991 |
newElement = children[0]; |
| 992 |
} |
| 993 |
if (true) { |
| 994 |
if (!/* @__PURE__ */ React10.isValidElement(newElement)) { |
| 995 |
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")); |
| 996 |
} |
| 997 |
} |
| 998 |
return /* @__PURE__ */ React10.cloneElement(newElement, mergedProps); |
| 999 |
} |
| 1000 |
if (element) { |
| 1001 |
if (typeof element === "string") { |
| 1002 |
return renderTag(element, props); |
| 1003 |
} |
| 1004 |
} |
| 1005 |
throw new Error(true ? "Base UI: Render element or function are not defined." : formatErrorMessage_default(8)); |
| 1006 |
} |
| 1007 |
function warnIfRenderPropLooksLikeComponent(renderFn) { |
| 1008 |
const functionName = renderFn.name; |
| 1009 |
if (functionName.length === 0) { |
| 1010 |
return; |
| 1011 |
} |
| 1012 |
if (!COMPONENT_IDENTIFIER_PATTERN.test(functionName)) { |
| 1013 |
return; |
| 1014 |
} |
| 1015 |
if (!LOWERCASE_CHARACTER_PATTERN.test(functionName)) { |
| 1016 |
return; |
| 1017 |
} |
| 1018 |
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"); |
| 1019 |
} |
| 1020 |
function renderTag(Tag, props) { |
| 1021 |
if (Tag === "button") { |
| 1022 |
return /* @__PURE__ */ (0, import_react.createElement)("button", { |
| 1023 |
type: "button", |
| 1024 |
...props, |
| 1025 |
key: props.key |
| 1026 |
}); |
| 1027 |
} |
| 1028 |
if (Tag === "img") { |
| 1029 |
return /* @__PURE__ */ (0, import_react.createElement)("img", { |
| 1030 |
alt: "", |
| 1031 |
...props, |
| 1032 |
key: props.key |
| 1033 |
}); |
| 1034 |
} |
| 1035 |
return /* @__PURE__ */ React10.createElement(Tag, props); |
| 1036 |
} |
| 1037 |
|
| 1038 |
// node_modules/@base-ui/react/esm/internals/reason-parts.js |
| 1039 |
var reason_parts_exports = {}; |
| 1040 |
__export(reason_parts_exports, { |
| 1041 |
cancelOpen: () => cancelOpen, |
| 1042 |
chipRemovePress: () => chipRemovePress, |
| 1043 |
clearPress: () => clearPress, |
| 1044 |
closePress: () => closePress, |
| 1045 |
closeWatcher: () => closeWatcher, |
| 1046 |
decrementPress: () => decrementPress, |
| 1047 |
disabled: () => disabled, |
| 1048 |
drag: () => drag, |
| 1049 |
escapeKey: () => escapeKey, |
| 1050 |
focusOut: () => focusOut, |
| 1051 |
imperativeAction: () => imperativeAction, |
| 1052 |
incrementPress: () => incrementPress, |
| 1053 |
initial: () => initial, |
| 1054 |
inputBlur: () => inputBlur, |
| 1055 |
inputChange: () => inputChange, |
| 1056 |
inputClear: () => inputClear, |
| 1057 |
inputPaste: () => inputPaste, |
| 1058 |
inputPress: () => inputPress, |
| 1059 |
itemPress: () => itemPress, |
| 1060 |
keyboard: () => keyboard, |
| 1061 |
linkPress: () => linkPress, |
| 1062 |
listNavigation: () => listNavigation, |
| 1063 |
missing: () => missing, |
| 1064 |
none: () => none, |
| 1065 |
outsidePress: () => outsidePress, |
| 1066 |
pointer: () => pointer, |
| 1067 |
scrub: () => scrub, |
| 1068 |
siblingOpen: () => siblingOpen, |
| 1069 |
swipe: () => swipe, |
| 1070 |
trackPress: () => trackPress, |
| 1071 |
triggerFocus: () => triggerFocus, |
| 1072 |
triggerHover: () => triggerHover, |
| 1073 |
triggerPress: () => triggerPress, |
| 1074 |
wheel: () => wheel, |
| 1075 |
windowResize: () => windowResize |
| 1076 |
}); |
| 1077 |
var none = "none"; |
| 1078 |
var triggerPress = "trigger-press"; |
| 1079 |
var triggerHover = "trigger-hover"; |
| 1080 |
var triggerFocus = "trigger-focus"; |
| 1081 |
var outsidePress = "outside-press"; |
| 1082 |
var itemPress = "item-press"; |
| 1083 |
var closePress = "close-press"; |
| 1084 |
var linkPress = "link-press"; |
| 1085 |
var clearPress = "clear-press"; |
| 1086 |
var chipRemovePress = "chip-remove-press"; |
| 1087 |
var trackPress = "track-press"; |
| 1088 |
var incrementPress = "increment-press"; |
| 1089 |
var decrementPress = "decrement-press"; |
| 1090 |
var inputChange = "input-change"; |
| 1091 |
var inputClear = "input-clear"; |
| 1092 |
var inputBlur = "input-blur"; |
| 1093 |
var inputPaste = "input-paste"; |
| 1094 |
var inputPress = "input-press"; |
| 1095 |
var focusOut = "focus-out"; |
| 1096 |
var escapeKey = "escape-key"; |
| 1097 |
var closeWatcher = "close-watcher"; |
| 1098 |
var listNavigation = "list-navigation"; |
| 1099 |
var keyboard = "keyboard"; |
| 1100 |
var pointer = "pointer"; |
| 1101 |
var drag = "drag"; |
| 1102 |
var wheel = "wheel"; |
| 1103 |
var scrub = "scrub"; |
| 1104 |
var cancelOpen = "cancel-open"; |
| 1105 |
var siblingOpen = "sibling-open"; |
| 1106 |
var disabled = "disabled"; |
| 1107 |
var missing = "missing"; |
| 1108 |
var initial = "initial"; |
| 1109 |
var imperativeAction = "imperative-action"; |
| 1110 |
var swipe = "swipe"; |
| 1111 |
var windowResize = "window-resize"; |
| 1112 |
|
| 1113 |
// node_modules/@base-ui/react/esm/internals/createBaseUIEventDetails.js |
| 1114 |
function createChangeEventDetails(reason, event, trigger, customProperties) { |
| 1115 |
let canceled = false; |
| 1116 |
let allowPropagation = false; |
| 1117 |
const custom = customProperties ?? EMPTY_OBJECT; |
| 1118 |
const details = { |
| 1119 |
reason, |
| 1120 |
event: event ?? new Event("base-ui"), |
| 1121 |
cancel() { |
| 1122 |
canceled = true; |
| 1123 |
}, |
| 1124 |
allowPropagation() { |
| 1125 |
allowPropagation = true; |
| 1126 |
}, |
| 1127 |
get isCanceled() { |
| 1128 |
return canceled; |
| 1129 |
}, |
| 1130 |
get isPropagationAllowed() { |
| 1131 |
return allowPropagation; |
| 1132 |
}, |
| 1133 |
trigger, |
| 1134 |
...custom |
| 1135 |
}; |
| 1136 |
return details; |
| 1137 |
} |
| 1138 |
function createGenericEventDetails(reason, event, customProperties) { |
| 1139 |
const custom = customProperties ?? EMPTY_OBJECT; |
| 1140 |
const details = { |
| 1141 |
reason, |
| 1142 |
event: event ?? new Event("base-ui"), |
| 1143 |
...custom |
| 1144 |
}; |
| 1145 |
return details; |
| 1146 |
} |
| 1147 |
|
| 1148 |
// node_modules/@base-ui/utils/esm/useId.js |
| 1149 |
var React11 = __toESM(require_react(), 1); |
| 1150 |
var globalId = 0; |
| 1151 |
function useGlobalId(idOverride, prefix = "mui") { |
| 1152 |
const [defaultId, setDefaultId] = React11.useState(idOverride); |
| 1153 |
const id = idOverride || defaultId; |
| 1154 |
React11.useEffect(() => { |
| 1155 |
if (defaultId == null) { |
| 1156 |
globalId += 1; |
| 1157 |
setDefaultId(`${prefix}-${globalId}`); |
| 1158 |
} |
| 1159 |
}, [defaultId, prefix]); |
| 1160 |
return id; |
| 1161 |
} |
| 1162 |
var maybeReactUseId = SafeReact.useId; |
| 1163 |
function useId(idOverride, prefix) { |
| 1164 |
if (maybeReactUseId !== void 0) { |
| 1165 |
const reactId = maybeReactUseId(); |
| 1166 |
return idOverride ?? (prefix ? `${prefix}-${reactId}` : reactId); |
| 1167 |
} |
| 1168 |
return useGlobalId(idOverride, prefix); |
| 1169 |
} |
| 1170 |
|
| 1171 |
// node_modules/@base-ui/react/esm/internals/useBaseUiId.js |
| 1172 |
function useBaseUiId(idOverride) { |
| 1173 |
return useId(idOverride, "base-ui"); |
| 1174 |
} |
| 1175 |
|
| 1176 |
// node_modules/@base-ui/react/esm/internals/useTransitionStatus.js |
| 1177 |
var React13 = __toESM(require_react(), 1); |
| 1178 |
|
| 1179 |
// node_modules/@base-ui/utils/esm/useOnMount.js |
| 1180 |
var React12 = __toESM(require_react(), 1); |
| 1181 |
var EMPTY = []; |
| 1182 |
function useOnMount(fn) { |
| 1183 |
React12.useEffect(fn, EMPTY); |
| 1184 |
} |
| 1185 |
|
| 1186 |
// node_modules/@base-ui/utils/esm/useAnimationFrame.js |
| 1187 |
var EMPTY2 = null; |
| 1188 |
var LAST_RAF = globalThis.requestAnimationFrame; |
| 1189 |
var Scheduler = class { |
| 1190 |
/* This implementation uses an array as a backing data-structure for frame callbacks. |
| 1191 |
* It allows `O(1)` callback cancelling by inserting a `null` in the array, though it |
| 1192 |
* never calls the native `cancelAnimationFrame` if there are no frames left. This can |
| 1193 |
* be much more efficient if there is a call pattern that alterns as |
| 1194 |
* "request-cancel-request-cancel-…". |
| 1195 |
* But in the case of "request-request-…-cancel-cancel-…", it leaves the final animation |
| 1196 |
* frame to run anyway. We turn that frame into a `O(1)` no-op via `callbacksCount`. */ |
| 1197 |
callbacks = []; |
| 1198 |
callbacksCount = 0; |
| 1199 |
nextId = 1; |
| 1200 |
startId = 1; |
| 1201 |
isScheduled = false; |
| 1202 |
tick = (timestamp) => { |
| 1203 |
this.isScheduled = false; |
| 1204 |
const currentCallbacks = this.callbacks; |
| 1205 |
const currentCallbacksCount = this.callbacksCount; |
| 1206 |
this.callbacks = []; |
| 1207 |
this.callbacksCount = 0; |
| 1208 |
this.startId = this.nextId; |
| 1209 |
if (currentCallbacksCount > 0) { |
| 1210 |
for (let i = 0; i < currentCallbacks.length; i += 1) { |
| 1211 |
currentCallbacks[i]?.(timestamp); |
| 1212 |
} |
| 1213 |
} |
| 1214 |
}; |
| 1215 |
request(fn) { |
| 1216 |
const id = this.nextId; |
| 1217 |
this.nextId += 1; |
| 1218 |
this.callbacks.push(fn); |
| 1219 |
this.callbacksCount += 1; |
| 1220 |
const didRAFChange = LAST_RAF !== requestAnimationFrame && (LAST_RAF = requestAnimationFrame, true); |
| 1221 |
if (!this.isScheduled || didRAFChange) { |
| 1222 |
requestAnimationFrame(this.tick); |
| 1223 |
this.isScheduled = true; |
| 1224 |
} |
| 1225 |
return id; |
| 1226 |
} |
| 1227 |
cancel(id) { |
| 1228 |
const index2 = id - this.startId; |
| 1229 |
if (index2 < 0 || index2 >= this.callbacks.length) { |
| 1230 |
return; |
| 1231 |
} |
| 1232 |
this.callbacks[index2] = null; |
| 1233 |
this.callbacksCount -= 1; |
| 1234 |
} |
| 1235 |
}; |
| 1236 |
var scheduler = new Scheduler(); |
| 1237 |
var AnimationFrame = class _AnimationFrame { |
| 1238 |
static create() { |
| 1239 |
return new _AnimationFrame(); |
| 1240 |
} |
| 1241 |
static request(fn) { |
| 1242 |
return scheduler.request(fn); |
| 1243 |
} |
| 1244 |
static cancel(id) { |
| 1245 |
return scheduler.cancel(id); |
| 1246 |
} |
| 1247 |
currentId = EMPTY2; |
| 1248 |
/** |
| 1249 |
* Executes `fn` after `delay`, clearing any previously scheduled call. |
| 1250 |
*/ |
| 1251 |
request(fn) { |
| 1252 |
this.cancel(); |
| 1253 |
this.currentId = scheduler.request(() => { |
| 1254 |
this.currentId = EMPTY2; |
| 1255 |
fn(); |
| 1256 |
}); |
| 1257 |
} |
| 1258 |
cancel = () => { |
| 1259 |
if (this.currentId !== EMPTY2) { |
| 1260 |
scheduler.cancel(this.currentId); |
| 1261 |
this.currentId = EMPTY2; |
| 1262 |
} |
| 1263 |
}; |
| 1264 |
disposeEffect = () => { |
| 1265 |
return this.cancel; |
| 1266 |
}; |
| 1267 |
}; |
| 1268 |
function useAnimationFrame() { |
| 1269 |
const timeout = useRefWithInit(AnimationFrame.create).current; |
| 1270 |
useOnMount(timeout.disposeEffect); |
| 1271 |
return timeout; |
| 1272 |
} |
| 1273 |
|
| 1274 |
// node_modules/@base-ui/react/esm/internals/useTransitionStatus.js |
| 1275 |
function useTransitionStatus(open, enableIdleState = false, deferEndingState = false) { |
| 1276 |
const [transitionStatus, setTransitionStatus] = React13.useState(open && enableIdleState ? "idle" : void 0); |
| 1277 |
const [mounted, setMounted] = React13.useState(open); |
| 1278 |
if (open && !mounted) { |
| 1279 |
setMounted(true); |
| 1280 |
setTransitionStatus("starting"); |
| 1281 |
} |
| 1282 |
if (!open && mounted && transitionStatus !== "ending" && !deferEndingState) { |
| 1283 |
setTransitionStatus("ending"); |
| 1284 |
} |
| 1285 |
if (!open && !mounted && transitionStatus === "ending") { |
| 1286 |
setTransitionStatus(void 0); |
| 1287 |
} |
| 1288 |
useIsoLayoutEffect(() => { |
| 1289 |
if (!open && mounted && transitionStatus !== "ending" && deferEndingState) { |
| 1290 |
const frame = AnimationFrame.request(() => { |
| 1291 |
setTransitionStatus("ending"); |
| 1292 |
}); |
| 1293 |
return () => { |
| 1294 |
AnimationFrame.cancel(frame); |
| 1295 |
}; |
| 1296 |
} |
| 1297 |
return void 0; |
| 1298 |
}, [open, mounted, transitionStatus, deferEndingState]); |
| 1299 |
useIsoLayoutEffect(() => { |
| 1300 |
if (!open || enableIdleState) { |
| 1301 |
return void 0; |
| 1302 |
} |
| 1303 |
const frame = AnimationFrame.request(() => { |
| 1304 |
setTransitionStatus(void 0); |
| 1305 |
}); |
| 1306 |
return () => { |
| 1307 |
AnimationFrame.cancel(frame); |
| 1308 |
}; |
| 1309 |
}, [enableIdleState, open]); |
| 1310 |
useIsoLayoutEffect(() => { |
| 1311 |
if (!open || !enableIdleState) { |
| 1312 |
return void 0; |
| 1313 |
} |
| 1314 |
if (open && mounted && transitionStatus !== "idle") { |
| 1315 |
setTransitionStatus("starting"); |
| 1316 |
} |
| 1317 |
const frame = AnimationFrame.request(() => { |
| 1318 |
setTransitionStatus("idle"); |
| 1319 |
}); |
| 1320 |
return () => { |
| 1321 |
AnimationFrame.cancel(frame); |
| 1322 |
}; |
| 1323 |
}, [enableIdleState, open, mounted, transitionStatus]); |
| 1324 |
return { |
| 1325 |
mounted, |
| 1326 |
setMounted, |
| 1327 |
transitionStatus |
| 1328 |
}; |
| 1329 |
} |
| 1330 |
|
| 1331 |
// node_modules/@base-ui/react/esm/internals/composite/list/useCompositeListItem.js |
| 1332 |
var React14 = __toESM(require_react(), 1); |
| 1333 |
var IndexGuessBehavior = /* @__PURE__ */ (function(IndexGuessBehavior2) { |
| 1334 |
IndexGuessBehavior2[IndexGuessBehavior2["None"] = 0] = "None"; |
| 1335 |
IndexGuessBehavior2[IndexGuessBehavior2["GuessFromOrder"] = 1] = "GuessFromOrder"; |
| 1336 |
return IndexGuessBehavior2; |
| 1337 |
})({}); |
| 1338 |
function useCompositeListItem(params = {}) { |
| 1339 |
const { |
| 1340 |
label, |
| 1341 |
metadata, |
| 1342 |
textRef, |
| 1343 |
indexGuessBehavior, |
| 1344 |
index: externalIndex |
| 1345 |
} = params; |
| 1346 |
const { |
| 1347 |
register: register2, |
| 1348 |
unregister, |
| 1349 |
subscribeMapChange, |
| 1350 |
elementsRef, |
| 1351 |
labelsRef, |
| 1352 |
nextIndexRef |
| 1353 |
} = useCompositeListContext(); |
| 1354 |
const indexRef = React14.useRef(-1); |
| 1355 |
const [index2, setIndex] = React14.useState(externalIndex ?? (indexGuessBehavior === IndexGuessBehavior.GuessFromOrder ? () => { |
| 1356 |
if (indexRef.current === -1) { |
| 1357 |
const newIndex = nextIndexRef.current; |
| 1358 |
nextIndexRef.current += 1; |
| 1359 |
indexRef.current = newIndex; |
| 1360 |
} |
| 1361 |
return indexRef.current; |
| 1362 |
} : -1)); |
| 1363 |
const componentRef = React14.useRef(null); |
| 1364 |
const ref = React14.useCallback((node) => { |
| 1365 |
componentRef.current = node; |
| 1366 |
if (index2 !== -1 && node !== null) { |
| 1367 |
elementsRef.current[index2] = node; |
| 1368 |
if (labelsRef) { |
| 1369 |
const isLabelDefined = label !== void 0; |
| 1370 |
labelsRef.current[index2] = isLabelDefined ? label : textRef?.current?.textContent ?? node.textContent; |
| 1371 |
} |
| 1372 |
} |
| 1373 |
}, [index2, elementsRef, labelsRef, label, textRef]); |
| 1374 |
useIsoLayoutEffect(() => { |
| 1375 |
if (externalIndex != null) { |
| 1376 |
return void 0; |
| 1377 |
} |
| 1378 |
const node = componentRef.current; |
| 1379 |
if (node) { |
| 1380 |
register2(node, metadata); |
| 1381 |
return () => { |
| 1382 |
unregister(node); |
| 1383 |
}; |
| 1384 |
} |
| 1385 |
return void 0; |
| 1386 |
}, [externalIndex, register2, unregister, metadata]); |
| 1387 |
useIsoLayoutEffect(() => { |
| 1388 |
if (externalIndex != null) { |
| 1389 |
return void 0; |
| 1390 |
} |
| 1391 |
return subscribeMapChange((map) => { |
| 1392 |
const i = componentRef.current ? map.get(componentRef.current)?.index : null; |
| 1393 |
if (i != null) { |
| 1394 |
setIndex(i); |
| 1395 |
} |
| 1396 |
}); |
| 1397 |
}, [externalIndex, subscribeMapChange, setIndex]); |
| 1398 |
return React14.useMemo(() => ({ |
| 1399 |
ref, |
| 1400 |
index: index2 |
| 1401 |
}), [index2, ref]); |
| 1402 |
} |
| 1403 |
|
| 1404 |
// node_modules/@base-ui/react/esm/internals/stateAttributesMapping.js |
| 1405 |
var TransitionStatusDataAttributes = /* @__PURE__ */ (function(TransitionStatusDataAttributes2) { |
| 1406 |
TransitionStatusDataAttributes2["startingStyle"] = "data-starting-style"; |
| 1407 |
TransitionStatusDataAttributes2["endingStyle"] = "data-ending-style"; |
| 1408 |
return TransitionStatusDataAttributes2; |
| 1409 |
})({}); |
| 1410 |
var STARTING_HOOK = { |
| 1411 |
[TransitionStatusDataAttributes.startingStyle]: "" |
| 1412 |
}; |
| 1413 |
var ENDING_HOOK = { |
| 1414 |
[TransitionStatusDataAttributes.endingStyle]: "" |
| 1415 |
}; |
| 1416 |
var transitionStatusMapping = { |
| 1417 |
transitionStatus(value) { |
| 1418 |
if (value === "starting") { |
| 1419 |
return STARTING_HOOK; |
| 1420 |
} |
| 1421 |
if (value === "ending") { |
| 1422 |
return ENDING_HOOK; |
| 1423 |
} |
| 1424 |
return null; |
| 1425 |
} |
| 1426 |
}; |
| 1427 |
|
| 1428 |
// node_modules/@base-ui/react/esm/internals/use-button/useButton.js |
| 1429 |
var React17 = __toESM(require_react(), 1); |
| 1430 |
|
| 1431 |
// node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.mjs |
| 1432 |
function hasWindow() { |
| 1433 |
return typeof window !== "undefined"; |
| 1434 |
} |
| 1435 |
function getNodeName(node) { |
| 1436 |
if (isNode(node)) { |
| 1437 |
return (node.nodeName || "").toLowerCase(); |
| 1438 |
} |
| 1439 |
return "#document"; |
| 1440 |
} |
| 1441 |
function getWindow(node) { |
| 1442 |
var _node$ownerDocument; |
| 1443 |
return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window; |
| 1444 |
} |
| 1445 |
function getDocumentElement(node) { |
| 1446 |
var _ref; |
| 1447 |
return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement; |
| 1448 |
} |
| 1449 |
function isNode(value) { |
| 1450 |
if (!hasWindow()) { |
| 1451 |
return false; |
| 1452 |
} |
| 1453 |
return value instanceof Node || value instanceof getWindow(value).Node; |
| 1454 |
} |
| 1455 |
function isElement(value) { |
| 1456 |
if (!hasWindow()) { |
| 1457 |
return false; |
| 1458 |
} |
| 1459 |
return value instanceof Element || value instanceof getWindow(value).Element; |
| 1460 |
} |
| 1461 |
function isHTMLElement(value) { |
| 1462 |
if (!hasWindow()) { |
| 1463 |
return false; |
| 1464 |
} |
| 1465 |
return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement; |
| 1466 |
} |
| 1467 |
function isShadowRoot(value) { |
| 1468 |
if (!hasWindow() || typeof ShadowRoot === "undefined") { |
| 1469 |
return false; |
| 1470 |
} |
| 1471 |
return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot; |
| 1472 |
} |
| 1473 |
function isOverflowElement(element) { |
| 1474 |
const { |
| 1475 |
overflow, |
| 1476 |
overflowX, |
| 1477 |
overflowY, |
| 1478 |
display |
| 1479 |
} = getComputedStyle2(element); |
| 1480 |
return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && display !== "inline" && display !== "contents"; |
| 1481 |
} |
| 1482 |
function isTableElement(element) { |
| 1483 |
return /^(table|td|th)$/.test(getNodeName(element)); |
| 1484 |
} |
| 1485 |
function isTopLayer(element) { |
| 1486 |
try { |
| 1487 |
if (element.matches(":popover-open")) { |
| 1488 |
return true; |
| 1489 |
} |
| 1490 |
} catch (_e) { |
| 1491 |
} |
| 1492 |
try { |
| 1493 |
return element.matches(":modal"); |
| 1494 |
} catch (_e) { |
| 1495 |
return false; |
| 1496 |
} |
| 1497 |
} |
| 1498 |
var willChangeRe = /transform|translate|scale|rotate|perspective|filter/; |
| 1499 |
var containRe = /paint|layout|strict|content/; |
| 1500 |
var isNotNone = (value) => !!value && value !== "none"; |
| 1501 |
var isWebKitValue; |
| 1502 |
function isContainingBlock(elementOrCss) { |
| 1503 |
const css = isElement(elementOrCss) ? getComputedStyle2(elementOrCss) : elementOrCss; |
| 1504 |
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 || ""); |
| 1505 |
} |
| 1506 |
function getContainingBlock(element) { |
| 1507 |
let currentNode = getParentNode(element); |
| 1508 |
while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) { |
| 1509 |
if (isContainingBlock(currentNode)) { |
| 1510 |
return currentNode; |
| 1511 |
} else if (isTopLayer(currentNode)) { |
| 1512 |
return null; |
| 1513 |
} |
| 1514 |
currentNode = getParentNode(currentNode); |
| 1515 |
} |
| 1516 |
return null; |
| 1517 |
} |
| 1518 |
function isWebKit() { |
| 1519 |
if (isWebKitValue == null) { |
| 1520 |
isWebKitValue = typeof CSS !== "undefined" && CSS.supports && CSS.supports("-webkit-backdrop-filter", "none"); |
| 1521 |
} |
| 1522 |
return isWebKitValue; |
| 1523 |
} |
| 1524 |
function isLastTraversableNode(node) { |
| 1525 |
return /^(html|body|#document)$/.test(getNodeName(node)); |
| 1526 |
} |
| 1527 |
function getComputedStyle2(element) { |
| 1528 |
return getWindow(element).getComputedStyle(element); |
| 1529 |
} |
| 1530 |
function getNodeScroll(element) { |
| 1531 |
if (isElement(element)) { |
| 1532 |
return { |
| 1533 |
scrollLeft: element.scrollLeft, |
| 1534 |
scrollTop: element.scrollTop |
| 1535 |
}; |
| 1536 |
} |
| 1537 |
return { |
| 1538 |
scrollLeft: element.scrollX, |
| 1539 |
scrollTop: element.scrollY |
| 1540 |
}; |
| 1541 |
} |
| 1542 |
function getParentNode(node) { |
| 1543 |
if (getNodeName(node) === "html") { |
| 1544 |
return node; |
| 1545 |
} |
| 1546 |
const result = ( |
| 1547 |
// Step into the shadow DOM of the parent of a slotted node. |
| 1548 |
node.assignedSlot || // DOM Element detected. |
| 1549 |
node.parentNode || // ShadowRoot detected. |
| 1550 |
isShadowRoot(node) && node.host || // Fallback. |
| 1551 |
getDocumentElement(node) |
| 1552 |
); |
| 1553 |
return isShadowRoot(result) ? result.host : result; |
| 1554 |
} |
| 1555 |
function getNearestOverflowAncestor(node) { |
| 1556 |
const parentNode = getParentNode(node); |
| 1557 |
if (isLastTraversableNode(parentNode)) { |
| 1558 |
return node.ownerDocument ? node.ownerDocument.body : node.body; |
| 1559 |
} |
| 1560 |
if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) { |
| 1561 |
return parentNode; |
| 1562 |
} |
| 1563 |
return getNearestOverflowAncestor(parentNode); |
| 1564 |
} |
| 1565 |
function getOverflowAncestors(node, list, traverseIframes) { |
| 1566 |
var _node$ownerDocument2; |
| 1567 |
if (list === void 0) { |
| 1568 |
list = []; |
| 1569 |
} |
| 1570 |
if (traverseIframes === void 0) { |
| 1571 |
traverseIframes = true; |
| 1572 |
} |
| 1573 |
const scrollableAncestor = getNearestOverflowAncestor(node); |
| 1574 |
const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body); |
| 1575 |
const win = getWindow(scrollableAncestor); |
| 1576 |
if (isBody) { |
| 1577 |
const frameElement = getFrameElement(win); |
| 1578 |
return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], frameElement && traverseIframes ? getOverflowAncestors(frameElement) : []); |
| 1579 |
} else { |
| 1580 |
return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes)); |
| 1581 |
} |
| 1582 |
} |
| 1583 |
function getFrameElement(win) { |
| 1584 |
return win.parent && Object.getPrototypeOf(win.parent) ? win.frameElement : null; |
| 1585 |
} |
| 1586 |
|
| 1587 |
// node_modules/@base-ui/react/esm/internals/composite/root/CompositeRootContext.js |
| 1588 |
var React15 = __toESM(require_react(), 1); |
| 1589 |
var CompositeRootContext = /* @__PURE__ */ React15.createContext(void 0); |
| 1590 |
if (true) CompositeRootContext.displayName = "CompositeRootContext"; |
| 1591 |
function useCompositeRootContext(optional = false) { |
| 1592 |
const context = React15.useContext(CompositeRootContext); |
| 1593 |
if (context === void 0 && !optional) { |
| 1594 |
throw new Error(true ? "Base UI: CompositeRootContext is missing. Composite parts must be placed within <Composite.Root>." : formatErrorMessage_default(16)); |
| 1595 |
} |
| 1596 |
return context; |
| 1597 |
} |
| 1598 |
|
| 1599 |
// node_modules/@base-ui/react/esm/utils/useFocusableWhenDisabled.js |
| 1600 |
var React16 = __toESM(require_react(), 1); |
| 1601 |
function useFocusableWhenDisabled(parameters) { |
| 1602 |
const { |
| 1603 |
focusableWhenDisabled, |
| 1604 |
disabled: disabled2, |
| 1605 |
composite = false, |
| 1606 |
tabIndex: tabIndexProp = 0, |
| 1607 |
isNativeButton |
| 1608 |
} = parameters; |
| 1609 |
const isFocusableComposite = composite && focusableWhenDisabled !== false; |
| 1610 |
const isNonFocusableComposite = composite && focusableWhenDisabled === false; |
| 1611 |
const props = React16.useMemo(() => { |
| 1612 |
const additionalProps = { |
| 1613 |
// allow Tabbing away from focusableWhenDisabled elements |
| 1614 |
onKeyDown(event) { |
| 1615 |
if (disabled2 && focusableWhenDisabled && event.key !== "Tab") { |
| 1616 |
event.preventDefault(); |
| 1617 |
} |
| 1618 |
} |
| 1619 |
}; |
| 1620 |
if (!composite) { |
| 1621 |
additionalProps.tabIndex = tabIndexProp; |
| 1622 |
if (!isNativeButton && disabled2) { |
| 1623 |
additionalProps.tabIndex = focusableWhenDisabled ? tabIndexProp : -1; |
| 1624 |
} |
| 1625 |
} |
| 1626 |
if (isNativeButton && (focusableWhenDisabled || isFocusableComposite) || !isNativeButton && disabled2) { |
| 1627 |
additionalProps["aria-disabled"] = disabled2; |
| 1628 |
} |
| 1629 |
if (isNativeButton && (!focusableWhenDisabled || isNonFocusableComposite)) { |
| 1630 |
additionalProps.disabled = disabled2; |
| 1631 |
} |
| 1632 |
return additionalProps; |
| 1633 |
}, [composite, disabled2, focusableWhenDisabled, isFocusableComposite, isNonFocusableComposite, isNativeButton, tabIndexProp]); |
| 1634 |
return { |
| 1635 |
props |
| 1636 |
}; |
| 1637 |
} |
| 1638 |
|
| 1639 |
// node_modules/@base-ui/react/esm/internals/use-button/useButton.js |
| 1640 |
function useButton(parameters = {}) { |
| 1641 |
const { |
| 1642 |
disabled: disabled2 = false, |
| 1643 |
focusableWhenDisabled, |
| 1644 |
tabIndex = 0, |
| 1645 |
native: isNativeButton = true, |
| 1646 |
composite: compositeProp |
| 1647 |
} = parameters; |
| 1648 |
const elementRef = React17.useRef(null); |
| 1649 |
const compositeRootContext = useCompositeRootContext(true); |
| 1650 |
const isCompositeItem = compositeProp ?? compositeRootContext !== void 0; |
| 1651 |
const { |
| 1652 |
props: focusableWhenDisabledProps |
| 1653 |
} = useFocusableWhenDisabled({ |
| 1654 |
focusableWhenDisabled, |
| 1655 |
disabled: disabled2, |
| 1656 |
composite: isCompositeItem, |
| 1657 |
tabIndex, |
| 1658 |
isNativeButton |
| 1659 |
}); |
| 1660 |
if (true) { |
| 1661 |
React17.useEffect(() => { |
| 1662 |
if (!elementRef.current) { |
| 1663 |
return; |
| 1664 |
} |
| 1665 |
const isButtonTag = isButtonElement(elementRef.current); |
| 1666 |
if (isNativeButton) { |
| 1667 |
if (!isButtonTag) { |
| 1668 |
const ownerStackMessage = SafeReact.captureOwnerStack?.() || ""; |
| 1669 |
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`."; |
| 1670 |
error(`${message}${ownerStackMessage}`); |
| 1671 |
} |
| 1672 |
} else if (isButtonTag) { |
| 1673 |
const ownerStackMessage = SafeReact.captureOwnerStack?.() || ""; |
| 1674 |
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`."; |
| 1675 |
error(`${message}${ownerStackMessage}`); |
| 1676 |
} |
| 1677 |
}, [isNativeButton]); |
| 1678 |
} |
| 1679 |
const updateDisabled = React17.useCallback(() => { |
| 1680 |
const element = elementRef.current; |
| 1681 |
if (!isButtonElement(element)) { |
| 1682 |
return; |
| 1683 |
} |
| 1684 |
if (isCompositeItem && disabled2 && focusableWhenDisabledProps.disabled === void 0 && element.disabled) { |
| 1685 |
element.disabled = false; |
| 1686 |
} |
| 1687 |
}, [disabled2, focusableWhenDisabledProps.disabled, isCompositeItem]); |
| 1688 |
useIsoLayoutEffect(updateDisabled, [updateDisabled]); |
| 1689 |
const getButtonProps = React17.useCallback((externalProps = {}) => { |
| 1690 |
const { |
| 1691 |
onClick: externalOnClick, |
| 1692 |
onMouseDown: externalOnMouseDown, |
| 1693 |
onKeyUp: externalOnKeyUp, |
| 1694 |
onKeyDown: externalOnKeyDown, |
| 1695 |
onPointerDown: externalOnPointerDown, |
| 1696 |
...otherExternalProps |
| 1697 |
} = externalProps; |
| 1698 |
return mergeProps({ |
| 1699 |
onClick(event) { |
| 1700 |
if (disabled2) { |
| 1701 |
event.preventDefault(); |
| 1702 |
return; |
| 1703 |
} |
| 1704 |
externalOnClick?.(event); |
| 1705 |
}, |
| 1706 |
onMouseDown(event) { |
| 1707 |
if (!disabled2) { |
| 1708 |
externalOnMouseDown?.(event); |
| 1709 |
} |
| 1710 |
}, |
| 1711 |
onKeyDown(event) { |
| 1712 |
if (disabled2) { |
| 1713 |
return; |
| 1714 |
} |
| 1715 |
makeEventPreventable(event); |
| 1716 |
externalOnKeyDown?.(event); |
| 1717 |
if (event.baseUIHandlerPrevented) { |
| 1718 |
return; |
| 1719 |
} |
| 1720 |
const isCurrentTarget = event.target === event.currentTarget; |
| 1721 |
const currentTarget = event.currentTarget; |
| 1722 |
const isButton = isButtonElement(currentTarget); |
| 1723 |
const isLink = !isNativeButton && isValidLinkElement(currentTarget); |
| 1724 |
const shouldClick = isCurrentTarget && (isNativeButton ? isButton : !isLink); |
| 1725 |
const isEnterKey = event.key === "Enter"; |
| 1726 |
const isSpaceKey = event.key === " "; |
| 1727 |
const role = currentTarget.getAttribute("role"); |
| 1728 |
const isTextNavigationRole = role?.startsWith("menuitem") || role === "option" || role === "gridcell"; |
| 1729 |
if (isCurrentTarget && isCompositeItem && isSpaceKey) { |
| 1730 |
if (event.defaultPrevented && isTextNavigationRole) { |
| 1731 |
return; |
| 1732 |
} |
| 1733 |
event.preventDefault(); |
| 1734 |
if (isLink || isNativeButton && isButton) { |
| 1735 |
currentTarget.click(); |
| 1736 |
event.preventBaseUIHandler(); |
| 1737 |
} else if (shouldClick) { |
| 1738 |
externalOnClick?.(event); |
| 1739 |
event.preventBaseUIHandler(); |
| 1740 |
} |
| 1741 |
return; |
| 1742 |
} |
| 1743 |
if (shouldClick) { |
| 1744 |
if (!isNativeButton && (isSpaceKey || isEnterKey)) { |
| 1745 |
event.preventDefault(); |
| 1746 |
} |
| 1747 |
if (!isNativeButton && isEnterKey) { |
| 1748 |
externalOnClick?.(event); |
| 1749 |
} |
| 1750 |
} |
| 1751 |
}, |
| 1752 |
onKeyUp(event) { |
| 1753 |
if (disabled2) { |
| 1754 |
return; |
| 1755 |
} |
| 1756 |
makeEventPreventable(event); |
| 1757 |
externalOnKeyUp?.(event); |
| 1758 |
if (event.target === event.currentTarget && isNativeButton && isCompositeItem && isButtonElement(event.currentTarget) && event.key === " ") { |
| 1759 |
event.preventDefault(); |
| 1760 |
return; |
| 1761 |
} |
| 1762 |
if (event.baseUIHandlerPrevented) { |
| 1763 |
return; |
| 1764 |
} |
| 1765 |
if (event.target === event.currentTarget && !isNativeButton && !isCompositeItem && event.key === " ") { |
| 1766 |
externalOnClick?.(event); |
| 1767 |
} |
| 1768 |
}, |
| 1769 |
onPointerDown(event) { |
| 1770 |
if (disabled2) { |
| 1771 |
event.preventDefault(); |
| 1772 |
return; |
| 1773 |
} |
| 1774 |
externalOnPointerDown?.(event); |
| 1775 |
} |
| 1776 |
}, isNativeButton ? { |
| 1777 |
type: "button" |
| 1778 |
} : { |
| 1779 |
role: "button" |
| 1780 |
}, focusableWhenDisabledProps, otherExternalProps); |
| 1781 |
}, [disabled2, focusableWhenDisabledProps, isCompositeItem, isNativeButton]); |
| 1782 |
const buttonRef = useStableCallback((element) => { |
| 1783 |
elementRef.current = element; |
| 1784 |
updateDisabled(); |
| 1785 |
}); |
| 1786 |
return { |
| 1787 |
getButtonProps, |
| 1788 |
buttonRef |
| 1789 |
}; |
| 1790 |
} |
| 1791 |
function isButtonElement(elem) { |
| 1792 |
return isHTMLElement(elem) && elem.tagName === "BUTTON"; |
| 1793 |
} |
| 1794 |
function isValidLinkElement(elem) { |
| 1795 |
return Boolean(elem?.tagName === "A" && elem?.href); |
| 1796 |
} |
| 1797 |
|
| 1798 |
// node_modules/@base-ui/utils/esm/detectBrowser.js |
| 1799 |
var hasNavigator = typeof navigator !== "undefined"; |
| 1800 |
var nav = getNavigatorData(); |
| 1801 |
var platform = getPlatform(); |
| 1802 |
var userAgent = getUserAgent(); |
| 1803 |
var isWebKit2 = typeof CSS === "undefined" || !CSS.supports ? false : CSS.supports("-webkit-backdrop-filter:none"); |
| 1804 |
var isIOS = ( |
| 1805 |
// iPads can claim to be MacIntel |
| 1806 |
nav.platform === "MacIntel" && nav.maxTouchPoints > 1 ? true : /iP(hone|ad|od)|iOS/.test(nav.platform) |
| 1807 |
); |
| 1808 |
var isFirefox = hasNavigator && /firefox/i.test(userAgent); |
| 1809 |
var isSafari = hasNavigator && /apple/i.test(navigator.vendor); |
| 1810 |
var isEdge = hasNavigator && /Edg/i.test(userAgent); |
| 1811 |
var isAndroid = hasNavigator && /android/i.test(platform) || /android/i.test(userAgent); |
| 1812 |
var isMac = hasNavigator && platform.toLowerCase().startsWith("mac") && !navigator.maxTouchPoints; |
| 1813 |
var isJSDOM = userAgent.includes("jsdom/"); |
| 1814 |
function getNavigatorData() { |
| 1815 |
if (!hasNavigator) { |
| 1816 |
return { |
| 1817 |
platform: "", |
| 1818 |
maxTouchPoints: -1 |
| 1819 |
}; |
| 1820 |
} |
| 1821 |
const uaData = navigator.userAgentData; |
| 1822 |
if (uaData?.platform) { |
| 1823 |
return { |
| 1824 |
platform: uaData.platform, |
| 1825 |
maxTouchPoints: navigator.maxTouchPoints |
| 1826 |
}; |
| 1827 |
} |
| 1828 |
return { |
| 1829 |
platform: navigator.platform ?? "", |
| 1830 |
maxTouchPoints: navigator.maxTouchPoints ?? -1 |
| 1831 |
}; |
| 1832 |
} |
| 1833 |
function getUserAgent() { |
| 1834 |
if (!hasNavigator) { |
| 1835 |
return ""; |
| 1836 |
} |
| 1837 |
const uaData = navigator.userAgentData; |
| 1838 |
if (uaData && Array.isArray(uaData.brands)) { |
| 1839 |
return uaData.brands.map(({ |
| 1840 |
brand, |
| 1841 |
version: version2 |
| 1842 |
}) => `${brand}/${version2}`).join(" "); |
| 1843 |
} |
| 1844 |
return navigator.userAgent; |
| 1845 |
} |
| 1846 |
function getPlatform() { |
| 1847 |
if (!hasNavigator) { |
| 1848 |
return ""; |
| 1849 |
} |
| 1850 |
const uaData = navigator.userAgentData; |
| 1851 |
if (uaData?.platform) { |
| 1852 |
return uaData.platform; |
| 1853 |
} |
| 1854 |
return navigator.platform ?? ""; |
| 1855 |
} |
| 1856 |
|
| 1857 |
// node_modules/@base-ui/react/esm/floating-ui-react/utils/constants.js |
| 1858 |
var FOCUSABLE_ATTRIBUTE = "data-base-ui-focusable"; |
| 1859 |
var TYPEABLE_SELECTOR = "input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])"; |
| 1860 |
var ARROW_LEFT = "ArrowLeft"; |
| 1861 |
var ARROW_RIGHT = "ArrowRight"; |
| 1862 |
var ARROW_UP = "ArrowUp"; |
| 1863 |
var ARROW_DOWN = "ArrowDown"; |
| 1864 |
|
| 1865 |
// node_modules/@base-ui/react/esm/internals/shadowDom.js |
| 1866 |
function activeElement(doc) { |
| 1867 |
let element = doc.activeElement; |
| 1868 |
while (element?.shadowRoot?.activeElement != null) { |
| 1869 |
element = element.shadowRoot.activeElement; |
| 1870 |
} |
| 1871 |
return element; |
| 1872 |
} |
| 1873 |
function contains(parent, child) { |
| 1874 |
if (!parent || !child) { |
| 1875 |
return false; |
| 1876 |
} |
| 1877 |
const rootNode = child.getRootNode?.(); |
| 1878 |
if (parent.contains(child)) { |
| 1879 |
return true; |
| 1880 |
} |
| 1881 |
if (rootNode && isShadowRoot(rootNode)) { |
| 1882 |
let next = child; |
| 1883 |
while (next) { |
| 1884 |
if (parent === next) { |
| 1885 |
return true; |
| 1886 |
} |
| 1887 |
next = next.parentNode || next.host; |
| 1888 |
} |
| 1889 |
} |
| 1890 |
return false; |
| 1891 |
} |
| 1892 |
function getTarget(event) { |
| 1893 |
if ("composedPath" in event) { |
| 1894 |
return event.composedPath()[0]; |
| 1895 |
} |
| 1896 |
return event.target; |
| 1897 |
} |
| 1898 |
|
| 1899 |
// node_modules/@base-ui/react/esm/floating-ui-react/utils/element.js |
| 1900 |
function isTargetInsideEnabledTrigger(target, triggerElements) { |
| 1901 |
if (!isElement(target)) { |
| 1902 |
return false; |
| 1903 |
} |
| 1904 |
const targetElement = target; |
| 1905 |
if (triggerElements.hasElement(targetElement)) { |
| 1906 |
return !targetElement.hasAttribute("data-trigger-disabled"); |
| 1907 |
} |
| 1908 |
for (const [, trigger] of triggerElements.entries()) { |
| 1909 |
if (contains(trigger, targetElement)) { |
| 1910 |
return !trigger.hasAttribute("data-trigger-disabled"); |
| 1911 |
} |
| 1912 |
} |
| 1913 |
return false; |
| 1914 |
} |
| 1915 |
function isEventTargetWithin(event, node) { |
| 1916 |
if (node == null) { |
| 1917 |
return false; |
| 1918 |
} |
| 1919 |
if ("composedPath" in event) { |
| 1920 |
return event.composedPath().includes(node); |
| 1921 |
} |
| 1922 |
const eventAgain = event; |
| 1923 |
return eventAgain.target != null && node.contains(eventAgain.target); |
| 1924 |
} |
| 1925 |
function isRootElement(element) { |
| 1926 |
return element.matches("html,body"); |
| 1927 |
} |
| 1928 |
function isTypeableElement(element) { |
| 1929 |
return isHTMLElement(element) && element.matches(TYPEABLE_SELECTOR); |
| 1930 |
} |
| 1931 |
function isInteractiveElement(element) { |
| 1932 |
return element?.closest(`button,a[href],[role="button"],select,[tabindex]:not([tabindex="-1"]),${TYPEABLE_SELECTOR}`) != null; |
| 1933 |
} |
| 1934 |
function isTypeableCombobox(element) { |
| 1935 |
if (!element) { |
| 1936 |
return false; |
| 1937 |
} |
| 1938 |
return element.getAttribute("role") === "combobox" && isTypeableElement(element); |
| 1939 |
} |
| 1940 |
function matchesFocusVisible(element) { |
| 1941 |
if (!element || isJSDOM) { |
| 1942 |
return true; |
| 1943 |
} |
| 1944 |
try { |
| 1945 |
return element.matches(":focus-visible"); |
| 1946 |
} catch (_e) { |
| 1947 |
return true; |
| 1948 |
} |
| 1949 |
} |
| 1950 |
function getFloatingFocusElement(floatingElement) { |
| 1951 |
if (!floatingElement) { |
| 1952 |
return null; |
| 1953 |
} |
| 1954 |
return floatingElement.hasAttribute(FOCUSABLE_ATTRIBUTE) ? floatingElement : floatingElement.querySelector(`[${FOCUSABLE_ATTRIBUTE}]`) || floatingElement; |
| 1955 |
} |
| 1956 |
|
| 1957 |
// node_modules/@base-ui/react/esm/floating-ui-react/utils/nodes.js |
| 1958 |
function getNodeChildren(nodes, id, onlyOpenChildren = true) { |
| 1959 |
const directChildren = nodes.filter((node) => node.parentId === id); |
| 1960 |
return directChildren.flatMap((child) => [...!onlyOpenChildren || child.context?.open ? [child] : [], ...getNodeChildren(nodes, child.id, onlyOpenChildren)]); |
| 1961 |
} |
| 1962 |
function getNodeAncestors(nodes, id) { |
| 1963 |
let allAncestors = []; |
| 1964 |
let currentParentId = nodes.find((node) => node.id === id)?.parentId; |
| 1965 |
while (currentParentId) { |
| 1966 |
const currentNode = nodes.find((node) => node.id === currentParentId); |
| 1967 |
currentParentId = currentNode?.parentId; |
| 1968 |
if (currentNode) { |
| 1969 |
allAncestors = allAncestors.concat(currentNode); |
| 1970 |
} |
| 1971 |
} |
| 1972 |
return allAncestors; |
| 1973 |
} |
| 1974 |
|
| 1975 |
// node_modules/@base-ui/react/esm/floating-ui-react/utils/event.js |
| 1976 |
function stopEvent(event) { |
| 1977 |
event.preventDefault(); |
| 1978 |
event.stopPropagation(); |
| 1979 |
} |
| 1980 |
function isReactEvent(event) { |
| 1981 |
return "nativeEvent" in event; |
| 1982 |
} |
| 1983 |
function isVirtualClick(event) { |
| 1984 |
if (event.pointerType === "" && event.isTrusted) { |
| 1985 |
return true; |
| 1986 |
} |
| 1987 |
if (isAndroid && event.pointerType) { |
| 1988 |
return event.type === "click" && event.buttons === 1; |
| 1989 |
} |
| 1990 |
return event.detail === 0 && !event.pointerType; |
| 1991 |
} |
| 1992 |
function isVirtualPointerEvent(event) { |
| 1993 |
if (isJSDOM) { |
| 1994 |
return false; |
| 1995 |
} |
| 1996 |
return !isAndroid && event.width === 0 && event.height === 0 || isAndroid && event.width === 1 && event.height === 1 && event.pressure === 0 && event.detail === 0 && event.pointerType === "mouse" || // iOS VoiceOver returns 0.333• for width/height. |
| 1997 |
event.width < 1 && event.height < 1 && event.pressure === 0 && event.detail === 0 && event.pointerType === "touch"; |
| 1998 |
} |
| 1999 |
function isMouseLikePointerType(pointerType, strict) { |
| 2000 |
const values = ["mouse", "pen"]; |
| 2001 |
if (!strict) { |
| 2002 |
values.push("", void 0); |
| 2003 |
} |
| 2004 |
return values.includes(pointerType); |
| 2005 |
} |
| 2006 |
function isClickLikeEvent(event) { |
| 2007 |
const type = event.type; |
| 2008 |
return type === "click" || type === "mousedown" || type === "keydown" || type === "keyup"; |
| 2009 |
} |
| 2010 |
|
| 2011 |
// node_modules/@floating-ui/utils/dist/floating-ui.utils.mjs |
| 2012 |
var sides = ["top", "right", "bottom", "left"]; |
| 2013 |
var min = Math.min; |
| 2014 |
var max = Math.max; |
| 2015 |
var round = Math.round; |
| 2016 |
var floor = Math.floor; |
| 2017 |
var createCoords = (v) => ({ |
| 2018 |
x: v, |
| 2019 |
y: v |
| 2020 |
}); |
| 2021 |
var oppositeSideMap = { |
| 2022 |
left: "right", |
| 2023 |
right: "left", |
| 2024 |
bottom: "top", |
| 2025 |
top: "bottom" |
| 2026 |
}; |
| 2027 |
function clamp(start, value, end) { |
| 2028 |
return max(start, min(value, end)); |
| 2029 |
} |
| 2030 |
function evaluate(value, param) { |
| 2031 |
return typeof value === "function" ? value(param) : value; |
| 2032 |
} |
| 2033 |
function getSide(placement) { |
| 2034 |
return placement.split("-")[0]; |
| 2035 |
} |
| 2036 |
function getAlignment(placement) { |
| 2037 |
return placement.split("-")[1]; |
| 2038 |
} |
| 2039 |
function getOppositeAxis(axis) { |
| 2040 |
return axis === "x" ? "y" : "x"; |
| 2041 |
} |
| 2042 |
function getAxisLength(axis) { |
| 2043 |
return axis === "y" ? "height" : "width"; |
| 2044 |
} |
| 2045 |
function getSideAxis(placement) { |
| 2046 |
const firstChar = placement[0]; |
| 2047 |
return firstChar === "t" || firstChar === "b" ? "y" : "x"; |
| 2048 |
} |
| 2049 |
function getAlignmentAxis(placement) { |
| 2050 |
return getOppositeAxis(getSideAxis(placement)); |
| 2051 |
} |
| 2052 |
function getAlignmentSides(placement, rects, rtl) { |
| 2053 |
if (rtl === void 0) { |
| 2054 |
rtl = false; |
| 2055 |
} |
| 2056 |
const alignment = getAlignment(placement); |
| 2057 |
const alignmentAxis = getAlignmentAxis(placement); |
| 2058 |
const length = getAxisLength(alignmentAxis); |
| 2059 |
let mainAlignmentSide = alignmentAxis === "x" ? alignment === (rtl ? "end" : "start") ? "right" : "left" : alignment === "start" ? "bottom" : "top"; |
| 2060 |
if (rects.reference[length] > rects.floating[length]) { |
| 2061 |
mainAlignmentSide = getOppositePlacement(mainAlignmentSide); |
| 2062 |
} |
| 2063 |
return [mainAlignmentSide, getOppositePlacement(mainAlignmentSide)]; |
| 2064 |
} |
| 2065 |
function getExpandedPlacements(placement) { |
| 2066 |
const oppositePlacement = getOppositePlacement(placement); |
| 2067 |
return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)]; |
| 2068 |
} |
| 2069 |
function getOppositeAlignmentPlacement(placement) { |
| 2070 |
return placement.includes("start") ? placement.replace("start", "end") : placement.replace("end", "start"); |
| 2071 |
} |
| 2072 |
var lrPlacement = ["left", "right"]; |
| 2073 |
var rlPlacement = ["right", "left"]; |
| 2074 |
var tbPlacement = ["top", "bottom"]; |
| 2075 |
var btPlacement = ["bottom", "top"]; |
| 2076 |
function getSideList(side, isStart, rtl) { |
| 2077 |
switch (side) { |
| 2078 |
case "top": |
| 2079 |
case "bottom": |
| 2080 |
if (rtl) return isStart ? rlPlacement : lrPlacement; |
| 2081 |
return isStart ? lrPlacement : rlPlacement; |
| 2082 |
case "left": |
| 2083 |
case "right": |
| 2084 |
return isStart ? tbPlacement : btPlacement; |
| 2085 |
default: |
| 2086 |
return []; |
| 2087 |
} |
| 2088 |
} |
| 2089 |
function getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) { |
| 2090 |
const alignment = getAlignment(placement); |
| 2091 |
let list = getSideList(getSide(placement), direction === "start", rtl); |
| 2092 |
if (alignment) { |
| 2093 |
list = list.map((side) => side + "-" + alignment); |
| 2094 |
if (flipAlignment) { |
| 2095 |
list = list.concat(list.map(getOppositeAlignmentPlacement)); |
| 2096 |
} |
| 2097 |
} |
| 2098 |
return list; |
| 2099 |
} |
| 2100 |
function getOppositePlacement(placement) { |
| 2101 |
const side = getSide(placement); |
| 2102 |
return oppositeSideMap[side] + placement.slice(side.length); |
| 2103 |
} |
| 2104 |
function expandPaddingObject(padding) { |
| 2105 |
return { |
| 2106 |
top: 0, |
| 2107 |
right: 0, |
| 2108 |
bottom: 0, |
| 2109 |
left: 0, |
| 2110 |
...padding |
| 2111 |
}; |
| 2112 |
} |
| 2113 |
function getPaddingObject(padding) { |
| 2114 |
return typeof padding !== "number" ? expandPaddingObject(padding) : { |
| 2115 |
top: padding, |
| 2116 |
right: padding, |
| 2117 |
bottom: padding, |
| 2118 |
left: padding |
| 2119 |
}; |
| 2120 |
} |
| 2121 |
function rectToClientRect(rect) { |
| 2122 |
const { |
| 2123 |
x, |
| 2124 |
y, |
| 2125 |
width, |
| 2126 |
height |
| 2127 |
} = rect; |
| 2128 |
return { |
| 2129 |
width, |
| 2130 |
height, |
| 2131 |
top: y, |
| 2132 |
left: x, |
| 2133 |
right: x + width, |
| 2134 |
bottom: y + height, |
| 2135 |
x, |
| 2136 |
y |
| 2137 |
}; |
| 2138 |
} |
| 2139 |
|
| 2140 |
// node_modules/@base-ui/react/esm/floating-ui-react/utils/composite.js |
| 2141 |
function isDifferentGridRow(index2, cols, prevRow) { |
| 2142 |
return Math.floor(index2 / cols) !== prevRow; |
| 2143 |
} |
| 2144 |
function isIndexOutOfListBounds(list, index2) { |
| 2145 |
return index2 < 0 || index2 >= list.length; |
| 2146 |
} |
| 2147 |
function getMinListIndex(listRef, disabledIndices) { |
| 2148 |
return findNonDisabledListIndex(listRef.current, { |
| 2149 |
disabledIndices |
| 2150 |
}); |
| 2151 |
} |
| 2152 |
function getMaxListIndex(listRef, disabledIndices) { |
| 2153 |
return findNonDisabledListIndex(listRef.current, { |
| 2154 |
decrement: true, |
| 2155 |
startingIndex: listRef.current.length, |
| 2156 |
disabledIndices |
| 2157 |
}); |
| 2158 |
} |
| 2159 |
function findNonDisabledListIndex(list, { |
| 2160 |
startingIndex = -1, |
| 2161 |
decrement = false, |
| 2162 |
disabledIndices, |
| 2163 |
amount = 1 |
| 2164 |
} = {}) { |
| 2165 |
let index2 = startingIndex; |
| 2166 |
do { |
| 2167 |
index2 += decrement ? -amount : amount; |
| 2168 |
} while (index2 >= 0 && index2 <= list.length - 1 && isListIndexDisabled(list, index2, disabledIndices)); |
| 2169 |
return index2; |
| 2170 |
} |
| 2171 |
function getGridNavigatedIndex(list, { |
| 2172 |
event, |
| 2173 |
orientation, |
| 2174 |
loopFocus, |
| 2175 |
onLoop, |
| 2176 |
rtl, |
| 2177 |
cols, |
| 2178 |
disabledIndices, |
| 2179 |
minIndex, |
| 2180 |
maxIndex, |
| 2181 |
prevIndex, |
| 2182 |
stopEvent: stop = false |
| 2183 |
}) { |
| 2184 |
let nextIndex = prevIndex; |
| 2185 |
let verticalDirection; |
| 2186 |
if (event.key === ARROW_UP) { |
| 2187 |
verticalDirection = "up"; |
| 2188 |
} else if (event.key === ARROW_DOWN) { |
| 2189 |
verticalDirection = "down"; |
| 2190 |
} |
| 2191 |
if (verticalDirection) { |
| 2192 |
const rows = []; |
| 2193 |
const rowIndexMap = []; |
| 2194 |
let hasRoleRow = false; |
| 2195 |
let visibleItemCount = 0; |
| 2196 |
{ |
| 2197 |
let currentRowEl = null; |
| 2198 |
let currentRowIndex = -1; |
| 2199 |
list.forEach((el, idx) => { |
| 2200 |
if (el == null) { |
| 2201 |
return; |
| 2202 |
} |
| 2203 |
visibleItemCount += 1; |
| 2204 |
const rowEl = el.closest('[role="row"]'); |
| 2205 |
if (rowEl) { |
| 2206 |
hasRoleRow = true; |
| 2207 |
} |
| 2208 |
if (rowEl !== currentRowEl || currentRowIndex === -1) { |
| 2209 |
currentRowEl = rowEl; |
| 2210 |
currentRowIndex += 1; |
| 2211 |
rows[currentRowIndex] = []; |
| 2212 |
} |
| 2213 |
rows[currentRowIndex].push(idx); |
| 2214 |
rowIndexMap[idx] = currentRowIndex; |
| 2215 |
}); |
| 2216 |
} |
| 2217 |
let hasDomRows = false; |
| 2218 |
let inferredDomCols = 0; |
| 2219 |
if (hasRoleRow) { |
| 2220 |
for (const row of rows) { |
| 2221 |
const rowLength = row.length; |
| 2222 |
if (rowLength > inferredDomCols) { |
| 2223 |
inferredDomCols = rowLength; |
| 2224 |
} |
| 2225 |
if (rowLength !== cols) { |
| 2226 |
hasDomRows = true; |
| 2227 |
} |
| 2228 |
} |
| 2229 |
} |
| 2230 |
const hasVirtualizedGaps = hasDomRows && visibleItemCount < list.length; |
| 2231 |
const verticalCols = inferredDomCols || cols; |
| 2232 |
const navigateVertically = (direction) => { |
| 2233 |
if (!hasDomRows || prevIndex === -1) { |
| 2234 |
return void 0; |
| 2235 |
} |
| 2236 |
const currentRow = rowIndexMap[prevIndex]; |
| 2237 |
if (currentRow == null) { |
| 2238 |
return void 0; |
| 2239 |
} |
| 2240 |
const colInRow = rows[currentRow].indexOf(prevIndex); |
| 2241 |
const step = direction === "up" ? -1 : 1; |
| 2242 |
for (let nextRow = currentRow + step, i = 0; i < rows.length; i += 1, nextRow += step) { |
| 2243 |
if (nextRow < 0 || nextRow >= rows.length) { |
| 2244 |
if (!loopFocus || hasVirtualizedGaps) { |
| 2245 |
return void 0; |
| 2246 |
} |
| 2247 |
nextRow = nextRow < 0 ? rows.length - 1 : 0; |
| 2248 |
if (onLoop) { |
| 2249 |
const clampedCol = Math.min(colInRow, rows[nextRow].length - 1); |
| 2250 |
const targetItemIndex = rows[nextRow][clampedCol] ?? rows[nextRow][0]; |
| 2251 |
const returnedItemIndex = onLoop(event, prevIndex, targetItemIndex); |
| 2252 |
nextRow = rowIndexMap[returnedItemIndex] ?? nextRow; |
| 2253 |
} |
| 2254 |
} |
| 2255 |
const targetRow = rows[nextRow]; |
| 2256 |
for (let col = Math.min(colInRow, targetRow.length - 1); col >= 0; col -= 1) { |
| 2257 |
const candidate = targetRow[col]; |
| 2258 |
if (!isListIndexDisabled(list, candidate, disabledIndices)) { |
| 2259 |
return candidate; |
| 2260 |
} |
| 2261 |
} |
| 2262 |
} |
| 2263 |
return void 0; |
| 2264 |
}; |
| 2265 |
const navigateVerticallyWithInferredRows = (direction) => { |
| 2266 |
if (!hasVirtualizedGaps || prevIndex === -1) { |
| 2267 |
return void 0; |
| 2268 |
} |
| 2269 |
const colInRow = prevIndex % verticalCols; |
| 2270 |
const rowStep = direction === "up" ? -verticalCols : verticalCols; |
| 2271 |
const lastRowStart = maxIndex - maxIndex % verticalCols; |
| 2272 |
const rowCount = floor(maxIndex / verticalCols) + 1; |
| 2273 |
for (let rowStart = prevIndex - colInRow + rowStep, i = 0; i < rowCount; i += 1, rowStart += rowStep) { |
| 2274 |
if (rowStart < 0 || rowStart > maxIndex) { |
| 2275 |
if (!loopFocus) { |
| 2276 |
return void 0; |
| 2277 |
} |
| 2278 |
rowStart = rowStart < 0 ? lastRowStart : 0; |
| 2279 |
} |
| 2280 |
const rowEnd = Math.min(rowStart + verticalCols - 1, maxIndex); |
| 2281 |
for (let candidate = Math.min(rowStart + colInRow, rowEnd); candidate >= rowStart; candidate -= 1) { |
| 2282 |
if (!isListIndexDisabled(list, candidate, disabledIndices)) { |
| 2283 |
return candidate; |
| 2284 |
} |
| 2285 |
} |
| 2286 |
} |
| 2287 |
return void 0; |
| 2288 |
}; |
| 2289 |
if (stop) { |
| 2290 |
stopEvent(event); |
| 2291 |
} |
| 2292 |
const verticalCandidate = navigateVertically(verticalDirection) ?? navigateVerticallyWithInferredRows(verticalDirection); |
| 2293 |
if (verticalCandidate !== void 0) { |
| 2294 |
nextIndex = verticalCandidate; |
| 2295 |
} else if (prevIndex === -1) { |
| 2296 |
nextIndex = verticalDirection === "up" ? maxIndex : minIndex; |
| 2297 |
} else { |
| 2298 |
nextIndex = findNonDisabledListIndex(list, { |
| 2299 |
startingIndex: prevIndex, |
| 2300 |
amount: verticalCols, |
| 2301 |
decrement: verticalDirection === "up", |
| 2302 |
disabledIndices |
| 2303 |
}); |
| 2304 |
if (loopFocus) { |
| 2305 |
if (verticalDirection === "up" && (prevIndex - verticalCols < minIndex || nextIndex < 0)) { |
| 2306 |
const col = prevIndex % verticalCols; |
| 2307 |
const maxCol = maxIndex % verticalCols; |
| 2308 |
const offset4 = maxIndex - (maxCol - col); |
| 2309 |
if (maxCol === col) { |
| 2310 |
nextIndex = maxIndex; |
| 2311 |
} else { |
| 2312 |
nextIndex = maxCol > col ? offset4 : offset4 - verticalCols; |
| 2313 |
} |
| 2314 |
if (onLoop) { |
| 2315 |
nextIndex = onLoop(event, prevIndex, nextIndex); |
| 2316 |
} |
| 2317 |
} |
| 2318 |
if (verticalDirection === "down" && prevIndex + verticalCols > maxIndex) { |
| 2319 |
nextIndex = findNonDisabledListIndex(list, { |
| 2320 |
startingIndex: prevIndex % verticalCols - verticalCols, |
| 2321 |
amount: verticalCols, |
| 2322 |
disabledIndices |
| 2323 |
}); |
| 2324 |
if (onLoop) { |
| 2325 |
nextIndex = onLoop(event, prevIndex, nextIndex); |
| 2326 |
} |
| 2327 |
} |
| 2328 |
} |
| 2329 |
} |
| 2330 |
if (isIndexOutOfListBounds(list, nextIndex)) { |
| 2331 |
nextIndex = prevIndex; |
| 2332 |
} |
| 2333 |
} |
| 2334 |
if (orientation === "both") { |
| 2335 |
const prevRow = floor(prevIndex / cols); |
| 2336 |
if (event.key === (rtl ? ARROW_LEFT : ARROW_RIGHT)) { |
| 2337 |
if (stop) { |
| 2338 |
stopEvent(event); |
| 2339 |
} |
| 2340 |
if (prevIndex % cols !== cols - 1) { |
| 2341 |
nextIndex = findNonDisabledListIndex(list, { |
| 2342 |
startingIndex: prevIndex, |
| 2343 |
disabledIndices |
| 2344 |
}); |
| 2345 |
if (loopFocus && isDifferentGridRow(nextIndex, cols, prevRow)) { |
| 2346 |
nextIndex = findNonDisabledListIndex(list, { |
| 2347 |
startingIndex: prevIndex - prevIndex % cols - 1, |
| 2348 |
disabledIndices |
| 2349 |
}); |
| 2350 |
if (onLoop) { |
| 2351 |
nextIndex = onLoop(event, prevIndex, nextIndex); |
| 2352 |
} |
| 2353 |
} |
| 2354 |
} else if (loopFocus) { |
| 2355 |
nextIndex = findNonDisabledListIndex(list, { |
| 2356 |
startingIndex: prevIndex - prevIndex % cols - 1, |
| 2357 |
disabledIndices |
| 2358 |
}); |
| 2359 |
if (onLoop) { |
| 2360 |
nextIndex = onLoop(event, prevIndex, nextIndex); |
| 2361 |
} |
| 2362 |
} |
| 2363 |
if (isDifferentGridRow(nextIndex, cols, prevRow)) { |
| 2364 |
nextIndex = prevIndex; |
| 2365 |
} |
| 2366 |
} |
| 2367 |
if (event.key === (rtl ? ARROW_RIGHT : ARROW_LEFT)) { |
| 2368 |
if (stop) { |
| 2369 |
stopEvent(event); |
| 2370 |
} |
| 2371 |
if (prevIndex % cols !== 0) { |
| 2372 |
nextIndex = findNonDisabledListIndex(list, { |
| 2373 |
startingIndex: prevIndex, |
| 2374 |
decrement: true, |
| 2375 |
disabledIndices |
| 2376 |
}); |
| 2377 |
if (loopFocus && isDifferentGridRow(nextIndex, cols, prevRow)) { |
| 2378 |
nextIndex = findNonDisabledListIndex(list, { |
| 2379 |
startingIndex: prevIndex + (cols - prevIndex % cols), |
| 2380 |
decrement: true, |
| 2381 |
disabledIndices |
| 2382 |
}); |
| 2383 |
if (onLoop) { |
| 2384 |
nextIndex = onLoop(event, prevIndex, nextIndex); |
| 2385 |
} |
| 2386 |
} |
| 2387 |
} else if (loopFocus) { |
| 2388 |
nextIndex = findNonDisabledListIndex(list, { |
| 2389 |
startingIndex: prevIndex + (cols - prevIndex % cols), |
| 2390 |
decrement: true, |
| 2391 |
disabledIndices |
| 2392 |
}); |
| 2393 |
if (onLoop) { |
| 2394 |
nextIndex = onLoop(event, prevIndex, nextIndex); |
| 2395 |
} |
| 2396 |
} |
| 2397 |
if (isDifferentGridRow(nextIndex, cols, prevRow)) { |
| 2398 |
nextIndex = prevIndex; |
| 2399 |
} |
| 2400 |
} |
| 2401 |
const lastRow = floor(maxIndex / cols) === prevRow; |
| 2402 |
if (isIndexOutOfListBounds(list, nextIndex)) { |
| 2403 |
if (loopFocus && lastRow) { |
| 2404 |
nextIndex = event.key === (rtl ? ARROW_RIGHT : ARROW_LEFT) ? maxIndex : findNonDisabledListIndex(list, { |
| 2405 |
startingIndex: prevIndex - prevIndex % cols - 1, |
| 2406 |
disabledIndices |
| 2407 |
}); |
| 2408 |
if (onLoop) { |
| 2409 |
nextIndex = onLoop(event, prevIndex, nextIndex); |
| 2410 |
} |
| 2411 |
} else { |
| 2412 |
nextIndex = prevIndex; |
| 2413 |
} |
| 2414 |
} |
| 2415 |
} |
| 2416 |
return nextIndex; |
| 2417 |
} |
| 2418 |
function createGridCellMap(sizes, cols, dense) { |
| 2419 |
const cellMap = []; |
| 2420 |
let startIndex = 0; |
| 2421 |
sizes.forEach(({ |
| 2422 |
width, |
| 2423 |
height |
| 2424 |
}, index2) => { |
| 2425 |
if (width > cols) { |
| 2426 |
if (true) { |
| 2427 |
throw new Error(`[Floating UI]: Invalid grid - item width at index ${index2} is greater than grid columns`); |
| 2428 |
} |
| 2429 |
} |
| 2430 |
let itemPlaced = false; |
| 2431 |
if (dense) { |
| 2432 |
startIndex = 0; |
| 2433 |
} |
| 2434 |
while (!itemPlaced) { |
| 2435 |
const targetCells = []; |
| 2436 |
for (let i = 0; i < width; i += 1) { |
| 2437 |
for (let j = 0; j < height; j += 1) { |
| 2438 |
targetCells.push(startIndex + i + j * cols); |
| 2439 |
} |
| 2440 |
} |
| 2441 |
if (startIndex % cols + width <= cols && targetCells.every((cell) => cellMap[cell] == null)) { |
| 2442 |
targetCells.forEach((cell) => { |
| 2443 |
cellMap[cell] = index2; |
| 2444 |
}); |
| 2445 |
itemPlaced = true; |
| 2446 |
} else { |
| 2447 |
startIndex += 1; |
| 2448 |
} |
| 2449 |
} |
| 2450 |
}); |
| 2451 |
return [...cellMap]; |
| 2452 |
} |
| 2453 |
function getGridCellIndexOfCorner(index2, sizes, cellMap, cols, corner) { |
| 2454 |
if (index2 === -1) { |
| 2455 |
return -1; |
| 2456 |
} |
| 2457 |
const firstCellIndex = cellMap.indexOf(index2); |
| 2458 |
const sizeItem = sizes[index2]; |
| 2459 |
switch (corner) { |
| 2460 |
case "tl": |
| 2461 |
return firstCellIndex; |
| 2462 |
case "tr": |
| 2463 |
if (!sizeItem) { |
| 2464 |
return firstCellIndex; |
| 2465 |
} |
| 2466 |
return firstCellIndex + sizeItem.width - 1; |
| 2467 |
case "bl": |
| 2468 |
if (!sizeItem) { |
| 2469 |
return firstCellIndex; |
| 2470 |
} |
| 2471 |
return firstCellIndex + (sizeItem.height - 1) * cols; |
| 2472 |
case "br": |
| 2473 |
return cellMap.lastIndexOf(index2); |
| 2474 |
default: |
| 2475 |
return -1; |
| 2476 |
} |
| 2477 |
} |
| 2478 |
function getGridCellIndices(indices, cellMap) { |
| 2479 |
return cellMap.flatMap((index2, cellIndex) => indices.includes(index2) ? [cellIndex] : []); |
| 2480 |
} |
| 2481 |
function isListIndexDisabled(list, index2, disabledIndices) { |
| 2482 |
const isExplicitlyDisabled = typeof disabledIndices === "function" ? disabledIndices(index2) : disabledIndices?.includes(index2) ?? false; |
| 2483 |
if (isExplicitlyDisabled) { |
| 2484 |
return true; |
| 2485 |
} |
| 2486 |
const element = list[index2]; |
| 2487 |
if (!element) { |
| 2488 |
return false; |
| 2489 |
} |
| 2490 |
if (!isElementVisible(element)) { |
| 2491 |
return true; |
| 2492 |
} |
| 2493 |
return !disabledIndices && (element.hasAttribute("disabled") || element.getAttribute("aria-disabled") === "true"); |
| 2494 |
} |
| 2495 |
function isHiddenByStyles(styles) { |
| 2496 |
return styles.visibility === "hidden" || styles.visibility === "collapse"; |
| 2497 |
} |
| 2498 |
function isElementVisible(element, styles = element ? getComputedStyle2(element) : null) { |
| 2499 |
if (!element || !element.isConnected || !styles || isHiddenByStyles(styles)) { |
| 2500 |
return false; |
| 2501 |
} |
| 2502 |
if (typeof element.checkVisibility === "function") { |
| 2503 |
return element.checkVisibility(); |
| 2504 |
} |
| 2505 |
return styles.display !== "none" && styles.display !== "contents"; |
| 2506 |
} |
| 2507 |
|
| 2508 |
// node_modules/@base-ui/utils/esm/owner.js |
| 2509 |
function ownerDocument(node) { |
| 2510 |
return node?.ownerDocument || document; |
| 2511 |
} |
| 2512 |
|
| 2513 |
// node_modules/@base-ui/react/esm/floating-ui-react/utils/tabbable.js |
| 2514 |
var CANDIDATE_SELECTOR = 'a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable="false"]),audio[controls],video[controls]'; |
| 2515 |
function getParentElement(element) { |
| 2516 |
const assignedSlot = element.assignedSlot; |
| 2517 |
if (assignedSlot) { |
| 2518 |
return assignedSlot; |
| 2519 |
} |
| 2520 |
if (element.parentElement) { |
| 2521 |
return element.parentElement; |
| 2522 |
} |
| 2523 |
const rootNode = element.getRootNode(); |
| 2524 |
return isShadowRoot(rootNode) ? rootNode.host : null; |
| 2525 |
} |
| 2526 |
function getDetailsSummary(details) { |
| 2527 |
for (const child of Array.from(details.children)) { |
| 2528 |
if (getNodeName(child) === "summary") { |
| 2529 |
return child; |
| 2530 |
} |
| 2531 |
} |
| 2532 |
return null; |
| 2533 |
} |
| 2534 |
function isWithinOpenDetailsSummary(element, details) { |
| 2535 |
const summary = getDetailsSummary(details); |
| 2536 |
return !!summary && (element === summary || contains(summary, element)); |
| 2537 |
} |
| 2538 |
function isFocusableCandidate(element) { |
| 2539 |
const nodeName = element ? getNodeName(element) : ""; |
| 2540 |
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"); |
| 2541 |
} |
| 2542 |
function isFocusableElement(element) { |
| 2543 |
if (!isFocusableCandidate(element) || !element.isConnected || element.matches(":disabled")) { |
| 2544 |
return false; |
| 2545 |
} |
| 2546 |
for (let current = element; current; current = getParentElement(current)) { |
| 2547 |
const isAncestor = current !== element; |
| 2548 |
const isSlot = getNodeName(current) === "slot"; |
| 2549 |
if (current.hasAttribute("inert")) { |
| 2550 |
return false; |
| 2551 |
} |
| 2552 |
if (isAncestor && getNodeName(current) === "details" && !current.open && !isWithinOpenDetailsSummary(element, current) || current.hasAttribute("hidden") || !isSlot && !isVisibleInTabbableTree(current, isAncestor)) { |
| 2553 |
return false; |
| 2554 |
} |
| 2555 |
} |
| 2556 |
return true; |
| 2557 |
} |
| 2558 |
function isVisibleInTabbableTree(element, isAncestor) { |
| 2559 |
const styles = getComputedStyle2(element); |
| 2560 |
if (!isAncestor) { |
| 2561 |
return isElementVisible(element, styles); |
| 2562 |
} |
| 2563 |
return styles.display !== "none"; |
| 2564 |
} |
| 2565 |
function getTabIndex(element) { |
| 2566 |
const tabIndex = element.tabIndex; |
| 2567 |
if (tabIndex < 0) { |
| 2568 |
const nodeName = getNodeName(element); |
| 2569 |
if (nodeName === "details" || nodeName === "audio" || nodeName === "video" || isHTMLElement(element) && element.isContentEditable) { |
| 2570 |
return 0; |
| 2571 |
} |
| 2572 |
} |
| 2573 |
return tabIndex; |
| 2574 |
} |
| 2575 |
function getNamedRadioInput(element) { |
| 2576 |
if (getNodeName(element) !== "input") { |
| 2577 |
return null; |
| 2578 |
} |
| 2579 |
const input = element; |
| 2580 |
return input.type === "radio" && input.name !== "" ? input : null; |
| 2581 |
} |
| 2582 |
function isTabbableRadio(element, candidates) { |
| 2583 |
const input = getNamedRadioInput(element); |
| 2584 |
if (!input) { |
| 2585 |
return true; |
| 2586 |
} |
| 2587 |
const checkedRadio = candidates.find((candidate) => { |
| 2588 |
const radio = getNamedRadioInput(candidate); |
| 2589 |
return radio?.name === input.name && radio.form === input.form && radio.checked; |
| 2590 |
}); |
| 2591 |
if (checkedRadio) { |
| 2592 |
return checkedRadio === input; |
| 2593 |
} |
| 2594 |
return candidates.find((candidate) => { |
| 2595 |
const radio = getNamedRadioInput(candidate); |
| 2596 |
return radio?.name === input.name && radio.form === input.form; |
| 2597 |
}) === input; |
| 2598 |
} |
| 2599 |
function getComposedChildren(container) { |
| 2600 |
if (isHTMLElement(container) && getNodeName(container) === "slot") { |
| 2601 |
const assignedElements = container.assignedElements({ |
| 2602 |
flatten: true |
| 2603 |
}); |
| 2604 |
if (assignedElements.length > 0) { |
| 2605 |
return assignedElements; |
| 2606 |
} |
| 2607 |
} |
| 2608 |
if (isHTMLElement(container) && container.shadowRoot) { |
| 2609 |
return Array.from(container.shadowRoot.children); |
| 2610 |
} |
| 2611 |
return Array.from(container.children); |
| 2612 |
} |
| 2613 |
function appendCandidates(container, list) { |
| 2614 |
getComposedChildren(container).forEach((child) => { |
| 2615 |
if (isFocusableCandidate(child)) { |
| 2616 |
list.push(child); |
| 2617 |
} |
| 2618 |
appendCandidates(child, list); |
| 2619 |
}); |
| 2620 |
} |
| 2621 |
function appendMatchingElements(container, selector, list) { |
| 2622 |
getComposedChildren(container).forEach((child) => { |
| 2623 |
if (isHTMLElement(child) && child.matches(selector)) { |
| 2624 |
list.push(child); |
| 2625 |
} |
| 2626 |
appendMatchingElements(child, selector, list); |
| 2627 |
}); |
| 2628 |
} |
| 2629 |
function isTabbable(element) { |
| 2630 |
return isFocusableElement(element) && getTabIndex(element) >= 0; |
| 2631 |
} |
| 2632 |
function focusable(container) { |
| 2633 |
const candidates = []; |
| 2634 |
appendCandidates(container, candidates); |
| 2635 |
return candidates.filter(isFocusableElement); |
| 2636 |
} |
| 2637 |
function tabbable(container) { |
| 2638 |
const candidates = focusable(container); |
| 2639 |
return candidates.filter((element) => getTabIndex(element) >= 0 && isTabbableRadio(element, candidates)); |
| 2640 |
} |
| 2641 |
function getTabbableIn(container, dir) { |
| 2642 |
const list = tabbable(container); |
| 2643 |
const len = list.length; |
| 2644 |
if (len === 0) { |
| 2645 |
return void 0; |
| 2646 |
} |
| 2647 |
const active = activeElement(ownerDocument(container)); |
| 2648 |
const index2 = list.indexOf(active); |
| 2649 |
const nextIndex = index2 === -1 ? dir === 1 ? 0 : len - 1 : index2 + dir; |
| 2650 |
return list[nextIndex]; |
| 2651 |
} |
| 2652 |
function getNextTabbable(referenceElement) { |
| 2653 |
return getTabbableIn(ownerDocument(referenceElement).body, 1) || referenceElement; |
| 2654 |
} |
| 2655 |
function getPreviousTabbable(referenceElement) { |
| 2656 |
return getTabbableIn(ownerDocument(referenceElement).body, -1) || referenceElement; |
| 2657 |
} |
| 2658 |
function isOutsideEvent(event, container) { |
| 2659 |
const containerElement = container || event.currentTarget; |
| 2660 |
const relatedTarget = event.relatedTarget; |
| 2661 |
return !relatedTarget || !contains(containerElement, relatedTarget); |
| 2662 |
} |
| 2663 |
function disableFocusInside(container) { |
| 2664 |
const tabbableElements = tabbable(container); |
| 2665 |
tabbableElements.forEach((element) => { |
| 2666 |
element.dataset.tabindex = element.getAttribute("tabindex") || ""; |
| 2667 |
element.setAttribute("tabindex", "-1"); |
| 2668 |
}); |
| 2669 |
} |
| 2670 |
function enableFocusInside(container) { |
| 2671 |
const elements = []; |
| 2672 |
appendMatchingElements(container, "[data-tabindex]", elements); |
| 2673 |
elements.forEach((element) => { |
| 2674 |
const tabindex = element.dataset.tabindex; |
| 2675 |
delete element.dataset.tabindex; |
| 2676 |
if (tabindex) { |
| 2677 |
element.setAttribute("tabindex", tabindex); |
| 2678 |
} else { |
| 2679 |
element.removeAttribute("tabindex"); |
| 2680 |
} |
| 2681 |
}); |
| 2682 |
} |
| 2683 |
|
| 2684 |
// node_modules/@base-ui/utils/esm/addEventListener.js |
| 2685 |
function addEventListener(target, type, listener, options) { |
| 2686 |
target.addEventListener(type, listener, options); |
| 2687 |
return () => { |
| 2688 |
target.removeEventListener(type, listener, options); |
| 2689 |
}; |
| 2690 |
} |
| 2691 |
|
| 2692 |
// node_modules/@base-ui/utils/esm/useValueAsRef.js |
| 2693 |
function useValueAsRef(value) { |
| 2694 |
const latest = useRefWithInit(createLatestRef, value).current; |
| 2695 |
latest.next = value; |
| 2696 |
useIsoLayoutEffect(latest.effect); |
| 2697 |
return latest; |
| 2698 |
} |
| 2699 |
function createLatestRef(value) { |
| 2700 |
const latest = { |
| 2701 |
current: value, |
| 2702 |
next: value, |
| 2703 |
effect: () => { |
| 2704 |
latest.current = latest.next; |
| 2705 |
} |
| 2706 |
}; |
| 2707 |
return latest; |
| 2708 |
} |
| 2709 |
|
| 2710 |
// node_modules/@base-ui/react/esm/internals/useOpenChangeComplete.js |
| 2711 |
var React18 = __toESM(require_react(), 1); |
| 2712 |
|
| 2713 |
// node_modules/@base-ui/react/esm/internals/useAnimationsFinished.js |
| 2714 |
var ReactDOM = __toESM(require_react_dom(), 1); |
| 2715 |
|
| 2716 |
// node_modules/@base-ui/react/esm/utils/resolveRef.js |
| 2717 |
function resolveRef(maybeRef) { |
| 2718 |
if (maybeRef == null) { |
| 2719 |
return maybeRef; |
| 2720 |
} |
| 2721 |
return "current" in maybeRef ? maybeRef.current : maybeRef; |
| 2722 |
} |
| 2723 |
|
| 2724 |
// node_modules/@base-ui/react/esm/internals/useAnimationsFinished.js |
| 2725 |
function useAnimationsFinished(elementOrRef, waitForStartingStyleRemoved = false, treatAbortedAsFinished = true) { |
| 2726 |
const frame = useAnimationFrame(); |
| 2727 |
return useStableCallback((fnToExecute, signal = null) => { |
| 2728 |
frame.cancel(); |
| 2729 |
const element = resolveRef(elementOrRef); |
| 2730 |
if (element == null) { |
| 2731 |
return; |
| 2732 |
} |
| 2733 |
const resolvedElement = element; |
| 2734 |
const done = () => { |
| 2735 |
ReactDOM.flushSync(fnToExecute); |
| 2736 |
}; |
| 2737 |
if (typeof resolvedElement.getAnimations !== "function" || globalThis.BASE_UI_ANIMATIONS_DISABLED) { |
| 2738 |
fnToExecute(); |
| 2739 |
return; |
| 2740 |
} |
| 2741 |
function exec() { |
| 2742 |
Promise.all(resolvedElement.getAnimations().map((animation) => animation.finished)).then(() => { |
| 2743 |
if (!signal?.aborted) { |
| 2744 |
done(); |
| 2745 |
} |
| 2746 |
}).catch(() => { |
| 2747 |
if (treatAbortedAsFinished) { |
| 2748 |
if (!signal?.aborted) { |
| 2749 |
done(); |
| 2750 |
} |
| 2751 |
return; |
| 2752 |
} |
| 2753 |
const currentAnimations = resolvedElement.getAnimations(); |
| 2754 |
if (!signal?.aborted && currentAnimations.length > 0 && currentAnimations.some((animation) => animation.pending || animation.playState !== "finished")) { |
| 2755 |
exec(); |
| 2756 |
} |
| 2757 |
}); |
| 2758 |
} |
| 2759 |
if (waitForStartingStyleRemoved) { |
| 2760 |
const startingStyleAttribute = TransitionStatusDataAttributes.startingStyle; |
| 2761 |
if (!resolvedElement.hasAttribute(startingStyleAttribute)) { |
| 2762 |
frame.request(exec); |
| 2763 |
return; |
| 2764 |
} |
| 2765 |
const attributeObserver = new MutationObserver(() => { |
| 2766 |
if (!resolvedElement.hasAttribute(startingStyleAttribute)) { |
| 2767 |
attributeObserver.disconnect(); |
| 2768 |
exec(); |
| 2769 |
} |
| 2770 |
}); |
| 2771 |
attributeObserver.observe(resolvedElement, { |
| 2772 |
attributes: true, |
| 2773 |
attributeFilter: [startingStyleAttribute] |
| 2774 |
}); |
| 2775 |
signal?.addEventListener("abort", () => attributeObserver.disconnect(), { |
| 2776 |
once: true |
| 2777 |
}); |
| 2778 |
return; |
| 2779 |
} |
| 2780 |
frame.request(exec); |
| 2781 |
}); |
| 2782 |
} |
| 2783 |
|
| 2784 |
// node_modules/@base-ui/react/esm/internals/useOpenChangeComplete.js |
| 2785 |
function useOpenChangeComplete(parameters) { |
| 2786 |
const { |
| 2787 |
enabled = true, |
| 2788 |
open, |
| 2789 |
ref, |
| 2790 |
onComplete: onCompleteParam |
| 2791 |
} = parameters; |
| 2792 |
const onComplete = useStableCallback(onCompleteParam); |
| 2793 |
const runOnceAnimationsFinish = useAnimationsFinished(ref, open, false); |
| 2794 |
React18.useEffect(() => { |
| 2795 |
if (!enabled) { |
| 2796 |
return void 0; |
| 2797 |
} |
| 2798 |
const abortController = new AbortController(); |
| 2799 |
runOnceAnimationsFinish(onComplete, abortController.signal); |
| 2800 |
return () => { |
| 2801 |
abortController.abort(); |
| 2802 |
}; |
| 2803 |
}, [enabled, open, onComplete, runOnceAnimationsFinish]); |
| 2804 |
} |
| 2805 |
|
| 2806 |
// node_modules/@base-ui/utils/esm/useOnFirstRender.js |
| 2807 |
var React19 = __toESM(require_react(), 1); |
| 2808 |
function useOnFirstRender(fn) { |
| 2809 |
const ref = React19.useRef(true); |
| 2810 |
if (ref.current) { |
| 2811 |
ref.current = false; |
| 2812 |
fn(); |
| 2813 |
} |
| 2814 |
} |
| 2815 |
|
| 2816 |
// node_modules/@base-ui/utils/esm/useTimeout.js |
| 2817 |
var EMPTY3 = 0; |
| 2818 |
var Timeout = class _Timeout { |
| 2819 |
static create() { |
| 2820 |
return new _Timeout(); |
| 2821 |
} |
| 2822 |
currentId = EMPTY3; |
| 2823 |
/** |
| 2824 |
* Executes `fn` after `delay`, clearing any previously scheduled call. |
| 2825 |
*/ |
| 2826 |
start(delay, fn) { |
| 2827 |
this.clear(); |
| 2828 |
this.currentId = setTimeout(() => { |
| 2829 |
this.currentId = EMPTY3; |
| 2830 |
fn(); |
| 2831 |
}, delay); |
| 2832 |
} |
| 2833 |
isStarted() { |
| 2834 |
return this.currentId !== EMPTY3; |
| 2835 |
} |
| 2836 |
clear = () => { |
| 2837 |
if (this.currentId !== EMPTY3) { |
| 2838 |
clearTimeout(this.currentId); |
| 2839 |
this.currentId = EMPTY3; |
| 2840 |
} |
| 2841 |
}; |
| 2842 |
disposeEffect = () => { |
| 2843 |
return this.clear; |
| 2844 |
}; |
| 2845 |
}; |
| 2846 |
function useTimeout() { |
| 2847 |
const timeout = useRefWithInit(Timeout.create).current; |
| 2848 |
useOnMount(timeout.disposeEffect); |
| 2849 |
return timeout; |
| 2850 |
} |
| 2851 |
|
| 2852 |
// node_modules/@base-ui/utils/esm/useScrollLock.js |
| 2853 |
var originalHtmlStyles = {}; |
| 2854 |
var originalBodyStyles = {}; |
| 2855 |
var originalHtmlScrollBehavior = ""; |
| 2856 |
function hasInsetScrollbars(referenceElement) { |
| 2857 |
if (typeof document === "undefined") { |
| 2858 |
return false; |
| 2859 |
} |
| 2860 |
const doc = ownerDocument(referenceElement); |
| 2861 |
const win = getWindow(doc); |
| 2862 |
return win.innerWidth - doc.documentElement.clientWidth > 0; |
| 2863 |
} |
| 2864 |
function supportsStableScrollbarGutter(referenceElement) { |
| 2865 |
const supported = typeof CSS !== "undefined" && CSS.supports && CSS.supports("scrollbar-gutter", "stable"); |
| 2866 |
if (!supported || typeof document === "undefined") { |
| 2867 |
return false; |
| 2868 |
} |
| 2869 |
const doc = ownerDocument(referenceElement); |
| 2870 |
const html = doc.documentElement; |
| 2871 |
const body = doc.body; |
| 2872 |
const scrollContainer = isOverflowElement(html) ? html : body; |
| 2873 |
const originalScrollContainerOverflowY = scrollContainer.style.overflowY; |
| 2874 |
const originalHtmlStyleGutter = html.style.scrollbarGutter; |
| 2875 |
html.style.scrollbarGutter = "stable"; |
| 2876 |
scrollContainer.style.overflowY = "scroll"; |
| 2877 |
const before = scrollContainer.offsetWidth; |
| 2878 |
scrollContainer.style.overflowY = "hidden"; |
| 2879 |
const after = scrollContainer.offsetWidth; |
| 2880 |
scrollContainer.style.overflowY = originalScrollContainerOverflowY; |
| 2881 |
html.style.scrollbarGutter = originalHtmlStyleGutter; |
| 2882 |
return before === after; |
| 2883 |
} |
| 2884 |
function preventScrollOverlayScrollbars(referenceElement) { |
| 2885 |
const doc = ownerDocument(referenceElement); |
| 2886 |
const html = doc.documentElement; |
| 2887 |
const body = doc.body; |
| 2888 |
const elementToLock = isOverflowElement(html) ? html : body; |
| 2889 |
const originalElementToLockStyles = { |
| 2890 |
overflowY: elementToLock.style.overflowY, |
| 2891 |
overflowX: elementToLock.style.overflowX |
| 2892 |
}; |
| 2893 |
Object.assign(elementToLock.style, { |
| 2894 |
overflowY: "hidden", |
| 2895 |
overflowX: "hidden" |
| 2896 |
}); |
| 2897 |
return () => { |
| 2898 |
Object.assign(elementToLock.style, originalElementToLockStyles); |
| 2899 |
}; |
| 2900 |
} |
| 2901 |
function preventScrollInsetScrollbars(referenceElement) { |
| 2902 |
const doc = ownerDocument(referenceElement); |
| 2903 |
const html = doc.documentElement; |
| 2904 |
const body = doc.body; |
| 2905 |
const win = getWindow(html); |
| 2906 |
let scrollTop = 0; |
| 2907 |
let scrollLeft = 0; |
| 2908 |
let updateGutterOnly = false; |
| 2909 |
const resizeFrame = AnimationFrame.create(); |
| 2910 |
if (isWebKit2 && (win.visualViewport?.scale ?? 1) !== 1) { |
| 2911 |
return () => { |
| 2912 |
}; |
| 2913 |
} |
| 2914 |
function lockScroll() { |
| 2915 |
const htmlStyles = win.getComputedStyle(html); |
| 2916 |
const bodyStyles = win.getComputedStyle(body); |
| 2917 |
const htmlScrollbarGutterValue = htmlStyles.scrollbarGutter || ""; |
| 2918 |
const hasBothEdges = htmlScrollbarGutterValue.includes("both-edges"); |
| 2919 |
const scrollbarGutterValue = hasBothEdges ? "stable both-edges" : "stable"; |
| 2920 |
scrollTop = html.scrollTop; |
| 2921 |
scrollLeft = html.scrollLeft; |
| 2922 |
originalHtmlStyles = { |
| 2923 |
scrollbarGutter: html.style.scrollbarGutter, |
| 2924 |
overflowY: html.style.overflowY, |
| 2925 |
overflowX: html.style.overflowX |
| 2926 |
}; |
| 2927 |
originalHtmlScrollBehavior = html.style.scrollBehavior; |
| 2928 |
originalBodyStyles = { |
| 2929 |
position: body.style.position, |
| 2930 |
height: body.style.height, |
| 2931 |
width: body.style.width, |
| 2932 |
boxSizing: body.style.boxSizing, |
| 2933 |
overflowY: body.style.overflowY, |
| 2934 |
overflowX: body.style.overflowX, |
| 2935 |
scrollBehavior: body.style.scrollBehavior |
| 2936 |
}; |
| 2937 |
const isScrollableY = html.scrollHeight > html.clientHeight; |
| 2938 |
const isScrollableX = html.scrollWidth > html.clientWidth; |
| 2939 |
const hasConstantOverflowY = htmlStyles.overflowY === "scroll" || bodyStyles.overflowY === "scroll"; |
| 2940 |
const hasConstantOverflowX = htmlStyles.overflowX === "scroll" || bodyStyles.overflowX === "scroll"; |
| 2941 |
const scrollbarWidth = Math.max(0, win.innerWidth - body.clientWidth); |
| 2942 |
const scrollbarHeight = Math.max(0, win.innerHeight - body.clientHeight); |
| 2943 |
const marginY = parseFloat(bodyStyles.marginTop) + parseFloat(bodyStyles.marginBottom); |
| 2944 |
const marginX = parseFloat(bodyStyles.marginLeft) + parseFloat(bodyStyles.marginRight); |
| 2945 |
const elementToLock = isOverflowElement(html) ? html : body; |
| 2946 |
updateGutterOnly = supportsStableScrollbarGutter(referenceElement); |
| 2947 |
if (updateGutterOnly) { |
| 2948 |
html.style.scrollbarGutter = scrollbarGutterValue; |
| 2949 |
elementToLock.style.overflowY = "hidden"; |
| 2950 |
elementToLock.style.overflowX = "hidden"; |
| 2951 |
return; |
| 2952 |
} |
| 2953 |
Object.assign(html.style, { |
| 2954 |
scrollbarGutter: scrollbarGutterValue, |
| 2955 |
overflowY: "hidden", |
| 2956 |
overflowX: "hidden" |
| 2957 |
}); |
| 2958 |
if (isScrollableY || hasConstantOverflowY) { |
| 2959 |
html.style.overflowY = "scroll"; |
| 2960 |
} |
| 2961 |
if (isScrollableX || hasConstantOverflowX) { |
| 2962 |
html.style.overflowX = "scroll"; |
| 2963 |
} |
| 2964 |
Object.assign(body.style, { |
| 2965 |
position: "relative", |
| 2966 |
height: marginY || scrollbarHeight ? `calc(100dvh - ${marginY + scrollbarHeight}px)` : "100dvh", |
| 2967 |
width: marginX || scrollbarWidth ? `calc(100vw - ${marginX + scrollbarWidth}px)` : "100vw", |
| 2968 |
boxSizing: "border-box", |
| 2969 |
overflow: "hidden", |
| 2970 |
scrollBehavior: "unset" |
| 2971 |
}); |
| 2972 |
body.scrollTop = scrollTop; |
| 2973 |
body.scrollLeft = scrollLeft; |
| 2974 |
html.setAttribute("data-base-ui-scroll-locked", ""); |
| 2975 |
html.style.scrollBehavior = "unset"; |
| 2976 |
} |
| 2977 |
function cleanup() { |
| 2978 |
Object.assign(html.style, originalHtmlStyles); |
| 2979 |
Object.assign(body.style, originalBodyStyles); |
| 2980 |
if (!updateGutterOnly) { |
| 2981 |
html.scrollTop = scrollTop; |
| 2982 |
html.scrollLeft = scrollLeft; |
| 2983 |
html.removeAttribute("data-base-ui-scroll-locked"); |
| 2984 |
html.style.scrollBehavior = originalHtmlScrollBehavior; |
| 2985 |
} |
| 2986 |
} |
| 2987 |
function handleResize() { |
| 2988 |
cleanup(); |
| 2989 |
resizeFrame.request(lockScroll); |
| 2990 |
} |
| 2991 |
lockScroll(); |
| 2992 |
const unsubscribeResize = addEventListener(win, "resize", handleResize); |
| 2993 |
return () => { |
| 2994 |
resizeFrame.cancel(); |
| 2995 |
cleanup(); |
| 2996 |
if (typeof win.removeEventListener === "function") { |
| 2997 |
unsubscribeResize(); |
| 2998 |
} |
| 2999 |
}; |
| 3000 |
} |
| 3001 |
var ScrollLocker = class { |
| 3002 |
lockCount = 0; |
| 3003 |
restore = null; |
| 3004 |
timeoutLock = Timeout.create(); |
| 3005 |
timeoutUnlock = Timeout.create(); |
| 3006 |
acquire(referenceElement) { |
| 3007 |
this.lockCount += 1; |
| 3008 |
if (this.lockCount === 1 && this.restore === null) { |
| 3009 |
this.timeoutLock.start(0, () => this.lock(referenceElement)); |
| 3010 |
} |
| 3011 |
return this.release; |
| 3012 |
} |
| 3013 |
release = () => { |
| 3014 |
this.lockCount -= 1; |
| 3015 |
if (this.lockCount === 0 && this.restore) { |
| 3016 |
this.timeoutUnlock.start(0, this.unlock); |
| 3017 |
} |
| 3018 |
}; |
| 3019 |
unlock = () => { |
| 3020 |
if (this.lockCount === 0 && this.restore) { |
| 3021 |
this.restore?.(); |
| 3022 |
this.restore = null; |
| 3023 |
} |
| 3024 |
}; |
| 3025 |
lock(referenceElement) { |
| 3026 |
if (this.lockCount === 0 || this.restore !== null) { |
| 3027 |
return; |
| 3028 |
} |
| 3029 |
const doc = ownerDocument(referenceElement); |
| 3030 |
const html = doc.documentElement; |
| 3031 |
const htmlOverflowY = getWindow(html).getComputedStyle(html).overflowY; |
| 3032 |
if (htmlOverflowY === "hidden" || htmlOverflowY === "clip") { |
| 3033 |
this.restore = NOOP; |
| 3034 |
return; |
| 3035 |
} |
| 3036 |
const hasOverlayScrollbars = isIOS || !hasInsetScrollbars(referenceElement); |
| 3037 |
this.restore = hasOverlayScrollbars ? preventScrollOverlayScrollbars(referenceElement) : preventScrollInsetScrollbars(referenceElement); |
| 3038 |
} |
| 3039 |
}; |
| 3040 |
var SCROLL_LOCKER = new ScrollLocker(); |
| 3041 |
function useScrollLock(enabled = true, referenceElement = null) { |
| 3042 |
useIsoLayoutEffect(() => { |
| 3043 |
if (!enabled) { |
| 3044 |
return void 0; |
| 3045 |
} |
| 3046 |
return SCROLL_LOCKER.acquire(referenceElement); |
| 3047 |
}, [enabled, referenceElement]); |
| 3048 |
} |
| 3049 |
|
| 3050 |
// node_modules/@base-ui/react/esm/floating-ui-react/components/FloatingDelayGroup.js |
| 3051 |
var React20 = __toESM(require_react(), 1); |
| 3052 |
|
| 3053 |
// node_modules/@base-ui/react/esm/floating-ui-react/hooks/useHoverShared.js |
| 3054 |
function resolveValue(value, pointerType) { |
| 3055 |
if (pointerType != null && !isMouseLikePointerType(pointerType)) { |
| 3056 |
return 0; |
| 3057 |
} |
| 3058 |
if (typeof value === "function") { |
| 3059 |
return value(); |
| 3060 |
} |
| 3061 |
return value; |
| 3062 |
} |
| 3063 |
function getDelay(value, prop, pointerType) { |
| 3064 |
const result = resolveValue(value, pointerType); |
| 3065 |
if (typeof result === "number") { |
| 3066 |
return result; |
| 3067 |
} |
| 3068 |
return result?.[prop]; |
| 3069 |
} |
| 3070 |
function getRestMs(value) { |
| 3071 |
if (typeof value === "function") { |
| 3072 |
return value(); |
| 3073 |
} |
| 3074 |
return value; |
| 3075 |
} |
| 3076 |
function isClickLikeOpenEvent(openEventType, interactedInside) { |
| 3077 |
return interactedInside || openEventType === "click" || openEventType === "mousedown"; |
| 3078 |
} |
| 3079 |
function isHoverOpenEvent(openEventType) { |
| 3080 |
return openEventType?.includes("mouse") && openEventType !== "mousedown"; |
| 3081 |
} |
| 3082 |
|
| 3083 |
// node_modules/@base-ui/react/esm/floating-ui-react/components/FloatingDelayGroup.js |
| 3084 |
var import_jsx_runtime5 = __toESM(require_jsx_runtime(), 1); |
| 3085 |
var FloatingDelayGroupContext = /* @__PURE__ */ React20.createContext({ |
| 3086 |
hasProvider: false, |
| 3087 |
timeoutMs: 0, |
| 3088 |
delayRef: { |
| 3089 |
current: 0 |
| 3090 |
}, |
| 3091 |
initialDelayRef: { |
| 3092 |
current: 0 |
| 3093 |
}, |
| 3094 |
timeout: new Timeout(), |
| 3095 |
currentIdRef: { |
| 3096 |
current: null |
| 3097 |
}, |
| 3098 |
currentContextRef: { |
| 3099 |
current: null |
| 3100 |
} |
| 3101 |
}); |
| 3102 |
if (true) FloatingDelayGroupContext.displayName = "FloatingDelayGroupContext"; |
| 3103 |
function FloatingDelayGroup(props) { |
| 3104 |
const { |
| 3105 |
children, |
| 3106 |
delay, |
| 3107 |
timeoutMs = 0 |
| 3108 |
} = props; |
| 3109 |
const delayRef = React20.useRef(delay); |
| 3110 |
const initialDelayRef = React20.useRef(delay); |
| 3111 |
const currentIdRef = React20.useRef(null); |
| 3112 |
const currentContextRef = React20.useRef(null); |
| 3113 |
const timeout = useTimeout(); |
| 3114 |
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(FloatingDelayGroupContext.Provider, { |
| 3115 |
value: React20.useMemo(() => ({ |
| 3116 |
hasProvider: true, |
| 3117 |
delayRef, |
| 3118 |
initialDelayRef, |
| 3119 |
currentIdRef, |
| 3120 |
timeoutMs, |
| 3121 |
currentContextRef, |
| 3122 |
timeout |
| 3123 |
}), [timeoutMs, timeout]), |
| 3124 |
children |
| 3125 |
}); |
| 3126 |
} |
| 3127 |
function useDelayGroup(context, options = { |
| 3128 |
open: false |
| 3129 |
}) { |
| 3130 |
const { |
| 3131 |
open |
| 3132 |
} = options; |
| 3133 |
const store = "rootStore" in context ? context.rootStore : context; |
| 3134 |
const floatingId = store.useState("floatingId"); |
| 3135 |
const groupContext = React20.useContext(FloatingDelayGroupContext); |
| 3136 |
const { |
| 3137 |
currentIdRef, |
| 3138 |
delayRef, |
| 3139 |
timeoutMs, |
| 3140 |
initialDelayRef, |
| 3141 |
currentContextRef, |
| 3142 |
hasProvider, |
| 3143 |
timeout |
| 3144 |
} = groupContext; |
| 3145 |
const [isInstantPhase, setIsInstantPhase] = React20.useState(false); |
| 3146 |
useIsoLayoutEffect(() => { |
| 3147 |
function unset() { |
| 3148 |
setIsInstantPhase(false); |
| 3149 |
currentContextRef.current?.setIsInstantPhase(false); |
| 3150 |
currentIdRef.current = null; |
| 3151 |
currentContextRef.current = null; |
| 3152 |
delayRef.current = initialDelayRef.current; |
| 3153 |
} |
| 3154 |
if (!currentIdRef.current) { |
| 3155 |
return void 0; |
| 3156 |
} |
| 3157 |
if (!open && currentIdRef.current === floatingId) { |
| 3158 |
setIsInstantPhase(false); |
| 3159 |
if (timeoutMs) { |
| 3160 |
const closingId = floatingId; |
| 3161 |
timeout.start(timeoutMs, () => { |
| 3162 |
if (store.select("open") || currentIdRef.current && currentIdRef.current !== closingId) { |
| 3163 |
return; |
| 3164 |
} |
| 3165 |
unset(); |
| 3166 |
}); |
| 3167 |
return () => { |
| 3168 |
timeout.clear(); |
| 3169 |
}; |
| 3170 |
} |
| 3171 |
unset(); |
| 3172 |
} |
| 3173 |
return void 0; |
| 3174 |
}, [open, floatingId, currentIdRef, delayRef, timeoutMs, initialDelayRef, currentContextRef, timeout, store]); |
| 3175 |
useIsoLayoutEffect(() => { |
| 3176 |
if (!open) { |
| 3177 |
return; |
| 3178 |
} |
| 3179 |
const prevContext = currentContextRef.current; |
| 3180 |
const prevId = currentIdRef.current; |
| 3181 |
timeout.clear(); |
| 3182 |
currentContextRef.current = { |
| 3183 |
onOpenChange: store.setOpen, |
| 3184 |
setIsInstantPhase |
| 3185 |
}; |
| 3186 |
currentIdRef.current = floatingId; |
| 3187 |
delayRef.current = { |
| 3188 |
open: 0, |
| 3189 |
close: getDelay(initialDelayRef.current, "close") |
| 3190 |
}; |
| 3191 |
if (prevId !== null && prevId !== floatingId) { |
| 3192 |
setIsInstantPhase(true); |
| 3193 |
prevContext?.setIsInstantPhase(true); |
| 3194 |
prevContext?.onOpenChange(false, createChangeEventDetails(reason_parts_exports.none)); |
| 3195 |
} else { |
| 3196 |
setIsInstantPhase(false); |
| 3197 |
prevContext?.setIsInstantPhase(false); |
| 3198 |
} |
| 3199 |
}, [open, floatingId, store, currentIdRef, delayRef, initialDelayRef, currentContextRef, timeout]); |
| 3200 |
useIsoLayoutEffect(() => { |
| 3201 |
return () => { |
| 3202 |
currentContextRef.current = null; |
| 3203 |
}; |
| 3204 |
}, [currentContextRef]); |
| 3205 |
return React20.useMemo(() => ({ |
| 3206 |
hasProvider, |
| 3207 |
delayRef, |
| 3208 |
isInstantPhase |
| 3209 |
}), [hasProvider, delayRef, isInstantPhase]); |
| 3210 |
} |
| 3211 |
|
| 3212 |
// node_modules/@base-ui/react/esm/floating-ui-react/components/FloatingFocusManager.js |
| 3213 |
var React24 = __toESM(require_react(), 1); |
| 3214 |
|
| 3215 |
// node_modules/@base-ui/utils/esm/mergeCleanups.js |
| 3216 |
function mergeCleanups(...cleanups) { |
| 3217 |
return () => { |
| 3218 |
for (let i = 0; i < cleanups.length; i += 1) { |
| 3219 |
const cleanup = cleanups[i]; |
| 3220 |
if (cleanup) { |
| 3221 |
cleanup(); |
| 3222 |
} |
| 3223 |
} |
| 3224 |
}; |
| 3225 |
} |
| 3226 |
|
| 3227 |
// node_modules/@base-ui/react/esm/utils/FocusGuard.js |
| 3228 |
var React21 = __toESM(require_react(), 1); |
| 3229 |
|
| 3230 |
// node_modules/@base-ui/utils/esm/visuallyHidden.js |
| 3231 |
var visuallyHiddenBase = { |
| 3232 |
clipPath: "inset(50%)", |
| 3233 |
overflow: "hidden", |
| 3234 |
whiteSpace: "nowrap", |
| 3235 |
border: 0, |
| 3236 |
padding: 0, |
| 3237 |
width: 1, |
| 3238 |
height: 1, |
| 3239 |
margin: -1 |
| 3240 |
}; |
| 3241 |
var visuallyHidden = { |
| 3242 |
...visuallyHiddenBase, |
| 3243 |
position: "fixed", |
| 3244 |
top: 0, |
| 3245 |
left: 0 |
| 3246 |
}; |
| 3247 |
var visuallyHiddenInput = { |
| 3248 |
...visuallyHiddenBase, |
| 3249 |
position: "absolute" |
| 3250 |
}; |
| 3251 |
|
| 3252 |
// node_modules/@base-ui/react/esm/utils/FocusGuard.js |
| 3253 |
var import_jsx_runtime6 = __toESM(require_jsx_runtime(), 1); |
| 3254 |
var FocusGuard = /* @__PURE__ */ React21.forwardRef(function FocusGuard2(props, ref) { |
| 3255 |
const [role, setRole] = React21.useState(); |
| 3256 |
useIsoLayoutEffect(() => { |
| 3257 |
if (isSafari) { |
| 3258 |
setRole("button"); |
| 3259 |
} |
| 3260 |
}, []); |
| 3261 |
const restProps = { |
| 3262 |
tabIndex: 0, |
| 3263 |
// Role is only for VoiceOver |
| 3264 |
role |
| 3265 |
}; |
| 3266 |
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { |
| 3267 |
...props, |
| 3268 |
ref, |
| 3269 |
style: visuallyHidden, |
| 3270 |
"aria-hidden": role ? void 0 : true, |
| 3271 |
...restProps, |
| 3272 |
"data-base-ui-focus-guard": "" |
| 3273 |
}); |
| 3274 |
}); |
| 3275 |
if (true) FocusGuard.displayName = "FocusGuard"; |
| 3276 |
|
| 3277 |
// node_modules/@base-ui/react/esm/floating-ui-react/utils/createAttribute.js |
| 3278 |
function createAttribute(name) { |
| 3279 |
return `data-base-ui-${name}`; |
| 3280 |
} |
| 3281 |
|
| 3282 |
// node_modules/@base-ui/react/esm/floating-ui-react/utils/enqueueFocus.js |
| 3283 |
var rafId = 0; |
| 3284 |
function enqueueFocus(el, options = {}) { |
| 3285 |
const { |
| 3286 |
preventScroll = false, |
| 3287 |
sync = false, |
| 3288 |
shouldFocus |
| 3289 |
} = options; |
| 3290 |
cancelAnimationFrame(rafId); |
| 3291 |
function exec() { |
| 3292 |
if (shouldFocus && !shouldFocus()) { |
| 3293 |
return; |
| 3294 |
} |
| 3295 |
el?.focus({ |
| 3296 |
preventScroll |
| 3297 |
}); |
| 3298 |
} |
| 3299 |
if (sync) { |
| 3300 |
exec(); |
| 3301 |
return NOOP; |
| 3302 |
} |
| 3303 |
const currentRafId = requestAnimationFrame(exec); |
| 3304 |
rafId = currentRafId; |
| 3305 |
return () => { |
| 3306 |
if (rafId === currentRafId) { |
| 3307 |
cancelAnimationFrame(currentRafId); |
| 3308 |
rafId = 0; |
| 3309 |
} |
| 3310 |
}; |
| 3311 |
} |
| 3312 |
|
| 3313 |
// node_modules/@base-ui/react/esm/floating-ui-react/utils/markOthers.js |
| 3314 |
var counters = { |
| 3315 |
inert: /* @__PURE__ */ new WeakMap(), |
| 3316 |
"aria-hidden": /* @__PURE__ */ new WeakMap() |
| 3317 |
}; |
| 3318 |
var markerName = "data-base-ui-inert"; |
| 3319 |
var uncontrolledElementsSets = { |
| 3320 |
inert: /* @__PURE__ */ new WeakSet(), |
| 3321 |
"aria-hidden": /* @__PURE__ */ new WeakSet() |
| 3322 |
}; |
| 3323 |
var markerCounterMap = /* @__PURE__ */ new WeakMap(); |
| 3324 |
var lockCount = 0; |
| 3325 |
function getUncontrolledElementsSet(controlAttribute) { |
| 3326 |
return uncontrolledElementsSets[controlAttribute]; |
| 3327 |
} |
| 3328 |
function unwrapHost(node) { |
| 3329 |
if (!node) { |
| 3330 |
return null; |
| 3331 |
} |
| 3332 |
return isShadowRoot(node) ? node.host : unwrapHost(node.parentNode); |
| 3333 |
} |
| 3334 |
var correctElements = (parent, targets) => targets.map((target) => { |
| 3335 |
if (parent.contains(target)) { |
| 3336 |
return target; |
| 3337 |
} |
| 3338 |
const correctedTarget = unwrapHost(target); |
| 3339 |
if (parent.contains(correctedTarget)) { |
| 3340 |
return correctedTarget; |
| 3341 |
} |
| 3342 |
return null; |
| 3343 |
}).filter((x) => x != null); |
| 3344 |
var buildKeepSet = (targets) => { |
| 3345 |
const keep = /* @__PURE__ */ new Set(); |
| 3346 |
targets.forEach((target) => { |
| 3347 |
let node = target; |
| 3348 |
while (node && !keep.has(node)) { |
| 3349 |
keep.add(node); |
| 3350 |
node = node.parentNode; |
| 3351 |
} |
| 3352 |
}); |
| 3353 |
return keep; |
| 3354 |
}; |
| 3355 |
var collectOutsideElements = (root, keepElements, stopElements) => { |
| 3356 |
const outside = []; |
| 3357 |
const walk = (parent) => { |
| 3358 |
if (!parent || stopElements.has(parent)) { |
| 3359 |
return; |
| 3360 |
} |
| 3361 |
Array.from(parent.children).forEach((node) => { |
| 3362 |
if (getNodeName(node) === "script") { |
| 3363 |
return; |
| 3364 |
} |
| 3365 |
if (keepElements.has(node)) { |
| 3366 |
walk(node); |
| 3367 |
} else { |
| 3368 |
outside.push(node); |
| 3369 |
} |
| 3370 |
}); |
| 3371 |
}; |
| 3372 |
walk(root); |
| 3373 |
return outside; |
| 3374 |
}; |
| 3375 |
function applyAttributeToOthers(uncorrectedAvoidElements, body, ariaHidden, inert, { |
| 3376 |
mark = true, |
| 3377 |
markerIgnoreElements = [] |
| 3378 |
}) { |
| 3379 |
const controlAttribute = inert ? "inert" : ariaHidden ? "aria-hidden" : null; |
| 3380 |
let counterMap = null; |
| 3381 |
let uncontrolledElementsSet = null; |
| 3382 |
const avoidElements = correctElements(body, uncorrectedAvoidElements); |
| 3383 |
const markerIgnoreTargets = mark ? correctElements(body, markerIgnoreElements) : []; |
| 3384 |
const markerIgnoreSet = new Set(markerIgnoreTargets); |
| 3385 |
const markerTargets = mark ? collectOutsideElements(body, buildKeepSet(avoidElements), new Set(avoidElements)).filter((target) => !markerIgnoreSet.has(target)) : []; |
| 3386 |
const hiddenElements = []; |
| 3387 |
const markedElements = []; |
| 3388 |
if (controlAttribute) { |
| 3389 |
const map = counters[controlAttribute]; |
| 3390 |
const currentUncontrolledElementsSet = getUncontrolledElementsSet(controlAttribute); |
| 3391 |
uncontrolledElementsSet = currentUncontrolledElementsSet; |
| 3392 |
counterMap = map; |
| 3393 |
const ariaLiveElements = correctElements(body, Array.from(body.querySelectorAll("[aria-live]"))); |
| 3394 |
const controlElements = avoidElements.concat(ariaLiveElements); |
| 3395 |
const controlTargets = collectOutsideElements(body, buildKeepSet(controlElements), new Set(controlElements)); |
| 3396 |
controlTargets.forEach((node) => { |
| 3397 |
const attr2 = node.getAttribute(controlAttribute); |
| 3398 |
const alreadyHidden = attr2 !== null && attr2 !== "false"; |
| 3399 |
const counterValue = (map.get(node) || 0) + 1; |
| 3400 |
map.set(node, counterValue); |
| 3401 |
hiddenElements.push(node); |
| 3402 |
if (counterValue === 1 && alreadyHidden) { |
| 3403 |
currentUncontrolledElementsSet.add(node); |
| 3404 |
} |
| 3405 |
if (!alreadyHidden) { |
| 3406 |
node.setAttribute(controlAttribute, controlAttribute === "inert" ? "" : "true"); |
| 3407 |
} |
| 3408 |
}); |
| 3409 |
} |
| 3410 |
if (mark) { |
| 3411 |
markerTargets.forEach((node) => { |
| 3412 |
const markerValue = (markerCounterMap.get(node) || 0) + 1; |
| 3413 |
markerCounterMap.set(node, markerValue); |
| 3414 |
markedElements.push(node); |
| 3415 |
if (markerValue === 1) { |
| 3416 |
node.setAttribute(markerName, ""); |
| 3417 |
} |
| 3418 |
}); |
| 3419 |
} |
| 3420 |
lockCount += 1; |
| 3421 |
return () => { |
| 3422 |
if (counterMap) { |
| 3423 |
hiddenElements.forEach((element) => { |
| 3424 |
const currentCounterValue = counterMap.get(element) || 0; |
| 3425 |
const counterValue = currentCounterValue - 1; |
| 3426 |
counterMap.set(element, counterValue); |
| 3427 |
if (!counterValue) { |
| 3428 |
if (!uncontrolledElementsSet?.has(element) && controlAttribute) { |
| 3429 |
element.removeAttribute(controlAttribute); |
| 3430 |
} |
| 3431 |
uncontrolledElementsSet?.delete(element); |
| 3432 |
} |
| 3433 |
}); |
| 3434 |
} |
| 3435 |
if (mark) { |
| 3436 |
markedElements.forEach((element) => { |
| 3437 |
const markerValue = (markerCounterMap.get(element) || 0) - 1; |
| 3438 |
markerCounterMap.set(element, markerValue); |
| 3439 |
if (!markerValue) { |
| 3440 |
element.removeAttribute(markerName); |
| 3441 |
} |
| 3442 |
}); |
| 3443 |
} |
| 3444 |
lockCount -= 1; |
| 3445 |
if (!lockCount) { |
| 3446 |
counters.inert = /* @__PURE__ */ new WeakMap(); |
| 3447 |
counters["aria-hidden"] = /* @__PURE__ */ new WeakMap(); |
| 3448 |
uncontrolledElementsSets.inert = /* @__PURE__ */ new WeakSet(); |
| 3449 |
uncontrolledElementsSets["aria-hidden"] = /* @__PURE__ */ new WeakSet(); |
| 3450 |
markerCounterMap = /* @__PURE__ */ new WeakMap(); |
| 3451 |
} |
| 3452 |
}; |
| 3453 |
} |
| 3454 |
function markOthers(avoidElements, options = {}) { |
| 3455 |
const { |
| 3456 |
ariaHidden = false, |
| 3457 |
inert = false, |
| 3458 |
mark = true, |
| 3459 |
markerIgnoreElements = [] |
| 3460 |
} = options; |
| 3461 |
const body = ownerDocument(avoidElements[0]).body; |
| 3462 |
return applyAttributeToOthers(avoidElements, body, ariaHidden, inert, { |
| 3463 |
mark, |
| 3464 |
markerIgnoreElements |
| 3465 |
}); |
| 3466 |
} |
| 3467 |
|
| 3468 |
// node_modules/@base-ui/react/esm/floating-ui-react/components/FloatingPortal.js |
| 3469 |
var React22 = __toESM(require_react(), 1); |
| 3470 |
var ReactDOM2 = __toESM(require_react_dom(), 1); |
| 3471 |
|
| 3472 |
// node_modules/@base-ui/react/esm/internals/constants.js |
| 3473 |
var DISABLED_TRANSITIONS_STYLE = { |
| 3474 |
style: { |
| 3475 |
transition: "none" |
| 3476 |
} |
| 3477 |
}; |
| 3478 |
var CLICK_TRIGGER_IDENTIFIER = "data-base-ui-click-trigger"; |
| 3479 |
var BASE_UI_SWIPE_IGNORE_ATTRIBUTE = "data-base-ui-swipe-ignore"; |
| 3480 |
var LEGACY_SWIPE_IGNORE_ATTRIBUTE = "data-swipe-ignore"; |
| 3481 |
var BASE_UI_SWIPE_IGNORE_SELECTOR = `[${BASE_UI_SWIPE_IGNORE_ATTRIBUTE}]`; |
| 3482 |
var LEGACY_SWIPE_IGNORE_SELECTOR = `[${LEGACY_SWIPE_IGNORE_ATTRIBUTE}]`; |
| 3483 |
var DROPDOWN_COLLISION_AVOIDANCE = { |
| 3484 |
fallbackAxisSide: "none" |
| 3485 |
}; |
| 3486 |
var POPUP_COLLISION_AVOIDANCE = { |
| 3487 |
fallbackAxisSide: "end" |
| 3488 |
}; |
| 3489 |
var ownerVisuallyHidden = { |
| 3490 |
clipPath: "inset(50%)", |
| 3491 |
position: "fixed", |
| 3492 |
top: 0, |
| 3493 |
left: 0 |
| 3494 |
}; |
| 3495 |
|
| 3496 |
// node_modules/@base-ui/react/esm/floating-ui-react/components/FloatingPortal.js |
| 3497 |
var import_jsx_runtime7 = __toESM(require_jsx_runtime(), 1); |
| 3498 |
var PortalContext = /* @__PURE__ */ React22.createContext(null); |
| 3499 |
if (true) PortalContext.displayName = "PortalContext"; |
| 3500 |
var usePortalContext = () => React22.useContext(PortalContext); |
| 3501 |
var attr = createAttribute("portal"); |
| 3502 |
function useFloatingPortalNode(props = {}) { |
| 3503 |
const { |
| 3504 |
ref, |
| 3505 |
container: containerProp, |
| 3506 |
componentProps = EMPTY_OBJECT, |
| 3507 |
elementProps |
| 3508 |
} = props; |
| 3509 |
const uniqueId = useId(); |
| 3510 |
const portalContext = usePortalContext(); |
| 3511 |
const parentPortalNode = portalContext?.portalNode; |
| 3512 |
const [containerElement, setContainerElement] = React22.useState(null); |
| 3513 |
const [portalNode, setPortalNode] = React22.useState(null); |
| 3514 |
const setPortalNodeRef = useStableCallback((node) => { |
| 3515 |
if (node !== null) { |
| 3516 |
setPortalNode(node); |
| 3517 |
} |
| 3518 |
}); |
| 3519 |
const containerRef = React22.useRef(null); |
| 3520 |
useIsoLayoutEffect(() => { |
| 3521 |
if (containerProp === null) { |
| 3522 |
if (containerRef.current) { |
| 3523 |
containerRef.current = null; |
| 3524 |
setPortalNode(null); |
| 3525 |
setContainerElement(null); |
| 3526 |
} |
| 3527 |
return; |
| 3528 |
} |
| 3529 |
if (uniqueId == null) { |
| 3530 |
return; |
| 3531 |
} |
| 3532 |
const resolvedContainer = (containerProp && (isNode(containerProp) ? containerProp : containerProp.current)) ?? parentPortalNode ?? document.body; |
| 3533 |
if (resolvedContainer == null) { |
| 3534 |
if (containerRef.current) { |
| 3535 |
containerRef.current = null; |
| 3536 |
setPortalNode(null); |
| 3537 |
setContainerElement(null); |
| 3538 |
} |
| 3539 |
return; |
| 3540 |
} |
| 3541 |
if (containerRef.current !== resolvedContainer) { |
| 3542 |
containerRef.current = resolvedContainer; |
| 3543 |
setPortalNode(null); |
| 3544 |
setContainerElement(resolvedContainer); |
| 3545 |
} |
| 3546 |
}, [containerProp, parentPortalNode, uniqueId]); |
| 3547 |
const portalElement = useRenderElement("div", componentProps, { |
| 3548 |
ref: [ref, setPortalNodeRef], |
| 3549 |
props: [{ |
| 3550 |
id: uniqueId, |
| 3551 |
[attr]: "" |
| 3552 |
}, elementProps] |
| 3553 |
}); |
| 3554 |
const portalSubtree = containerElement && portalElement ? /* @__PURE__ */ ReactDOM2.createPortal(portalElement, containerElement) : null; |
| 3555 |
return { |
| 3556 |
portalNode, |
| 3557 |
portalSubtree |
| 3558 |
}; |
| 3559 |
} |
| 3560 |
var FloatingPortal = /* @__PURE__ */ React22.forwardRef(function FloatingPortal2(componentProps, forwardedRef) { |
| 3561 |
const { |
| 3562 |
render, |
| 3563 |
className, |
| 3564 |
style, |
| 3565 |
children, |
| 3566 |
container, |
| 3567 |
renderGuards, |
| 3568 |
...elementProps |
| 3569 |
} = componentProps; |
| 3570 |
const { |
| 3571 |
portalNode, |
| 3572 |
portalSubtree |
| 3573 |
} = useFloatingPortalNode({ |
| 3574 |
container, |
| 3575 |
ref: forwardedRef, |
| 3576 |
componentProps, |
| 3577 |
elementProps |
| 3578 |
}); |
| 3579 |
const beforeOutsideRef = React22.useRef(null); |
| 3580 |
const afterOutsideRef = React22.useRef(null); |
| 3581 |
const beforeInsideRef = React22.useRef(null); |
| 3582 |
const afterInsideRef = React22.useRef(null); |
| 3583 |
const [focusManagerState, setFocusManagerState] = React22.useState(null); |
| 3584 |
const focusInsideDisabledRef = React22.useRef(false); |
| 3585 |
const modal = focusManagerState?.modal; |
| 3586 |
const open = focusManagerState?.open; |
| 3587 |
const shouldRenderGuards = typeof renderGuards === "boolean" ? renderGuards : !!focusManagerState && !focusManagerState.modal && focusManagerState.open && !!portalNode; |
| 3588 |
React22.useEffect(() => { |
| 3589 |
if (!portalNode || modal) { |
| 3590 |
return void 0; |
| 3591 |
} |
| 3592 |
function onFocus(event) { |
| 3593 |
if (portalNode && event.relatedTarget && isOutsideEvent(event)) { |
| 3594 |
if (event.type === "focusin") { |
| 3595 |
if (focusInsideDisabledRef.current) { |
| 3596 |
enableFocusInside(portalNode); |
| 3597 |
focusInsideDisabledRef.current = false; |
| 3598 |
} |
| 3599 |
} else { |
| 3600 |
disableFocusInside(portalNode); |
| 3601 |
focusInsideDisabledRef.current = true; |
| 3602 |
} |
| 3603 |
} |
| 3604 |
} |
| 3605 |
return mergeCleanups(addEventListener(portalNode, "focusin", onFocus, true), addEventListener(portalNode, "focusout", onFocus, true)); |
| 3606 |
}, [portalNode, modal]); |
| 3607 |
React22.useEffect(() => { |
| 3608 |
if (!portalNode || open !== false) { |
| 3609 |
return; |
| 3610 |
} |
| 3611 |
enableFocusInside(portalNode); |
| 3612 |
focusInsideDisabledRef.current = false; |
| 3613 |
}, [open, portalNode]); |
| 3614 |
const portalContextValue = React22.useMemo(() => ({ |
| 3615 |
beforeOutsideRef, |
| 3616 |
afterOutsideRef, |
| 3617 |
beforeInsideRef, |
| 3618 |
afterInsideRef, |
| 3619 |
portalNode, |
| 3620 |
setFocusManagerState |
| 3621 |
}), [portalNode]); |
| 3622 |
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(React22.Fragment, { |
| 3623 |
children: [portalSubtree, /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(PortalContext.Provider, { |
| 3624 |
value: portalContextValue, |
| 3625 |
children: [shouldRenderGuards && portalNode && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(FocusGuard, { |
| 3626 |
"data-type": "outside", |
| 3627 |
ref: beforeOutsideRef, |
| 3628 |
onFocus: (event) => { |
| 3629 |
if (isOutsideEvent(event, portalNode)) { |
| 3630 |
beforeInsideRef.current?.focus(); |
| 3631 |
} else { |
| 3632 |
const domReference = focusManagerState ? focusManagerState.domReference : null; |
| 3633 |
const prevTabbable = getPreviousTabbable(domReference); |
| 3634 |
prevTabbable?.focus(); |
| 3635 |
} |
| 3636 |
} |
| 3637 |
}), shouldRenderGuards && portalNode && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { |
| 3638 |
"aria-owns": portalNode.id, |
| 3639 |
style: ownerVisuallyHidden |
| 3640 |
}), portalNode && /* @__PURE__ */ ReactDOM2.createPortal(children, portalNode), shouldRenderGuards && portalNode && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(FocusGuard, { |
| 3641 |
"data-type": "outside", |
| 3642 |
ref: afterOutsideRef, |
| 3643 |
onFocus: (event) => { |
| 3644 |
if (isOutsideEvent(event, portalNode)) { |
| 3645 |
afterInsideRef.current?.focus(); |
| 3646 |
} else { |
| 3647 |
const domReference = focusManagerState ? focusManagerState.domReference : null; |
| 3648 |
const nextTabbable = getNextTabbable(domReference); |
| 3649 |
nextTabbable?.focus(); |
| 3650 |
if (focusManagerState?.closeOnFocusOut) { |
| 3651 |
focusManagerState?.onOpenChange(false, createChangeEventDetails(reason_parts_exports.focusOut, event.nativeEvent)); |
| 3652 |
} |
| 3653 |
} |
| 3654 |
} |
| 3655 |
})] |
| 3656 |
})] |
| 3657 |
}); |
| 3658 |
}); |
| 3659 |
if (true) FloatingPortal.displayName = "FloatingPortal"; |
| 3660 |
|
| 3661 |
// node_modules/@base-ui/react/esm/floating-ui-react/components/FloatingTree.js |
| 3662 |
var React23 = __toESM(require_react(), 1); |
| 3663 |
|
| 3664 |
// node_modules/@base-ui/react/esm/floating-ui-react/utils/createEventEmitter.js |
| 3665 |
function createEventEmitter() { |
| 3666 |
const map = /* @__PURE__ */ new Map(); |
| 3667 |
return { |
| 3668 |
emit(event, data) { |
| 3669 |
map.get(event)?.forEach((listener) => listener(data)); |
| 3670 |
}, |
| 3671 |
on(event, listener) { |
| 3672 |
if (!map.has(event)) { |
| 3673 |
map.set(event, /* @__PURE__ */ new Set()); |
| 3674 |
} |
| 3675 |
map.get(event).add(listener); |
| 3676 |
}, |
| 3677 |
off(event, listener) { |
| 3678 |
map.get(event)?.delete(listener); |
| 3679 |
} |
| 3680 |
}; |
| 3681 |
} |
| 3682 |
|
| 3683 |
// node_modules/@base-ui/react/esm/floating-ui-react/components/FloatingTree.js |
| 3684 |
var import_jsx_runtime8 = __toESM(require_jsx_runtime(), 1); |
| 3685 |
var FloatingNodeContext = /* @__PURE__ */ React23.createContext(null); |
| 3686 |
if (true) FloatingNodeContext.displayName = "FloatingNodeContext"; |
| 3687 |
var FloatingTreeContext = /* @__PURE__ */ React23.createContext(null); |
| 3688 |
if (true) FloatingTreeContext.displayName = "FloatingTreeContext"; |
| 3689 |
var useFloatingParentNodeId = () => React23.useContext(FloatingNodeContext)?.id || null; |
| 3690 |
var useFloatingTree = (externalTree) => { |
| 3691 |
const contextTree = React23.useContext(FloatingTreeContext); |
| 3692 |
return externalTree ?? contextTree; |
| 3693 |
}; |
| 3694 |
|
| 3695 |
// node_modules/@base-ui/react/esm/floating-ui-react/components/FloatingFocusManager.js |
| 3696 |
var import_jsx_runtime9 = __toESM(require_jsx_runtime(), 1); |
| 3697 |
function getEventType(event, lastInteractionType) { |
| 3698 |
const win = getWindow(getTarget(event)); |
| 3699 |
if (event instanceof win.KeyboardEvent) { |
| 3700 |
return "keyboard"; |
| 3701 |
} |
| 3702 |
if (event instanceof win.FocusEvent) { |
| 3703 |
return lastInteractionType || "keyboard"; |
| 3704 |
} |
| 3705 |
if ("pointerType" in event) { |
| 3706 |
return event.pointerType || "keyboard"; |
| 3707 |
} |
| 3708 |
if ("touches" in event) { |
| 3709 |
return "touch"; |
| 3710 |
} |
| 3711 |
if (event instanceof win.MouseEvent) { |
| 3712 |
return lastInteractionType || (event.detail === 0 ? "keyboard" : "mouse"); |
| 3713 |
} |
| 3714 |
return ""; |
| 3715 |
} |
| 3716 |
var LIST_LIMIT = 20; |
| 3717 |
var previouslyFocusedElements = []; |
| 3718 |
function clearDisconnectedPreviouslyFocusedElements() { |
| 3719 |
previouslyFocusedElements = previouslyFocusedElements.filter((entry) => { |
| 3720 |
return entry.deref()?.isConnected; |
| 3721 |
}); |
| 3722 |
} |
| 3723 |
function addPreviouslyFocusedElement(element) { |
| 3724 |
clearDisconnectedPreviouslyFocusedElements(); |
| 3725 |
if (element && getNodeName(element) !== "body") { |
| 3726 |
previouslyFocusedElements.push(new WeakRef(element)); |
| 3727 |
if (previouslyFocusedElements.length > LIST_LIMIT) { |
| 3728 |
previouslyFocusedElements = previouslyFocusedElements.slice(-LIST_LIMIT); |
| 3729 |
} |
| 3730 |
} |
| 3731 |
} |
| 3732 |
function getPreviouslyFocusedElement() { |
| 3733 |
clearDisconnectedPreviouslyFocusedElements(); |
| 3734 |
return previouslyFocusedElements[previouslyFocusedElements.length - 1]?.deref(); |
| 3735 |
} |
| 3736 |
function getFirstTabbableElement(container) { |
| 3737 |
if (!container) { |
| 3738 |
return null; |
| 3739 |
} |
| 3740 |
if (isTabbable(container)) { |
| 3741 |
return container; |
| 3742 |
} |
| 3743 |
return tabbable(container)[0] || container; |
| 3744 |
} |
| 3745 |
function handleTabIndex(floatingFocusElement, orderRef) { |
| 3746 |
if (floatingFocusElement.hasAttribute("tabindex") && !floatingFocusElement.hasAttribute("data-tabindex")) { |
| 3747 |
return; |
| 3748 |
} |
| 3749 |
if (!orderRef.current.includes("floating") && !floatingFocusElement.getAttribute("role")?.includes("dialog")) { |
| 3750 |
return; |
| 3751 |
} |
| 3752 |
const focusableElements = focusable(floatingFocusElement); |
| 3753 |
const tabbableContent = focusableElements.filter((element) => { |
| 3754 |
const dataTabIndex = element.getAttribute("data-tabindex") || ""; |
| 3755 |
return isTabbable(element) || element.hasAttribute("data-tabindex") && !dataTabIndex.startsWith("-"); |
| 3756 |
}); |
| 3757 |
const tabIndex = floatingFocusElement.getAttribute("tabindex"); |
| 3758 |
if (orderRef.current.includes("floating") || tabbableContent.length === 0) { |
| 3759 |
if (tabIndex !== "0") { |
| 3760 |
floatingFocusElement.setAttribute("tabindex", "0"); |
| 3761 |
} |
| 3762 |
} else if (tabIndex !== "-1" || floatingFocusElement.hasAttribute("data-tabindex") && floatingFocusElement.getAttribute("data-tabindex") !== "-1") { |
| 3763 |
floatingFocusElement.setAttribute("tabindex", "-1"); |
| 3764 |
floatingFocusElement.setAttribute("data-tabindex", "-1"); |
| 3765 |
} |
| 3766 |
} |
| 3767 |
function FloatingFocusManager(props) { |
| 3768 |
const { |
| 3769 |
context, |
| 3770 |
children, |
| 3771 |
disabled: disabled2 = false, |
| 3772 |
initialFocus = true, |
| 3773 |
returnFocus = true, |
| 3774 |
restoreFocus = false, |
| 3775 |
modal = true, |
| 3776 |
closeOnFocusOut = true, |
| 3777 |
openInteractionType = "", |
| 3778 |
nextFocusableElement, |
| 3779 |
previousFocusableElement, |
| 3780 |
beforeContentFocusGuardRef, |
| 3781 |
externalTree, |
| 3782 |
getInsideElements |
| 3783 |
} = props; |
| 3784 |
const store = "rootStore" in context ? context.rootStore : context; |
| 3785 |
const open = store.useState("open"); |
| 3786 |
const domReference = store.useState("domReferenceElement"); |
| 3787 |
const floating = store.useState("floatingElement"); |
| 3788 |
const { |
| 3789 |
events, |
| 3790 |
dataRef |
| 3791 |
} = store.context; |
| 3792 |
const getNodeId = useStableCallback(() => dataRef.current.floatingContext?.nodeId); |
| 3793 |
const ignoreInitialFocus = initialFocus === false; |
| 3794 |
const isUntrappedTypeableCombobox = isTypeableCombobox(domReference) && ignoreInitialFocus; |
| 3795 |
const orderRef = React24.useRef(["content"]); |
| 3796 |
const initialFocusRef = useValueAsRef(initialFocus); |
| 3797 |
const returnFocusRef = useValueAsRef(returnFocus); |
| 3798 |
const openInteractionTypeRef = useValueAsRef(openInteractionType); |
| 3799 |
const tree = useFloatingTree(externalTree); |
| 3800 |
const portalContext = usePortalContext(); |
| 3801 |
const preventReturnFocusRef = React24.useRef(false); |
| 3802 |
const isPointerDownRef = React24.useRef(false); |
| 3803 |
const pointerDownOutsideRef = React24.useRef(false); |
| 3804 |
const lastFocusedTabbableRef = React24.useRef(null); |
| 3805 |
const closeTypeRef = React24.useRef(""); |
| 3806 |
const lastInteractionTypeRef = React24.useRef(""); |
| 3807 |
const beforeGuardRef = React24.useRef(null); |
| 3808 |
const afterGuardRef = React24.useRef(null); |
| 3809 |
const mergedBeforeGuardRef = useMergedRefs(beforeGuardRef, beforeContentFocusGuardRef, portalContext?.beforeInsideRef); |
| 3810 |
const mergedAfterGuardRef = useMergedRefs(afterGuardRef, portalContext?.afterInsideRef); |
| 3811 |
const blurTimeout = useTimeout(); |
| 3812 |
const pointerDownTimeout = useTimeout(); |
| 3813 |
const restoreFocusFrame = useAnimationFrame(); |
| 3814 |
const isInsidePortal = portalContext != null; |
| 3815 |
const floatingFocusElement = getFloatingFocusElement(floating); |
| 3816 |
const getTabbableContent = useStableCallback((container = floatingFocusElement) => { |
| 3817 |
return container ? tabbable(container) : []; |
| 3818 |
}); |
| 3819 |
const getResolvedInsideElements = useStableCallback(() => getInsideElements?.().filter((element) => element != null) ?? []); |
| 3820 |
React24.useEffect(() => { |
| 3821 |
if (disabled2 || !modal) { |
| 3822 |
return void 0; |
| 3823 |
} |
| 3824 |
function onKeyDown(event) { |
| 3825 |
if (event.key === "Tab") { |
| 3826 |
if (contains(floatingFocusElement, activeElement(ownerDocument(floatingFocusElement))) && getTabbableContent().length === 0 && !isUntrappedTypeableCombobox) { |
| 3827 |
stopEvent(event); |
| 3828 |
} |
| 3829 |
} |
| 3830 |
} |
| 3831 |
const doc = ownerDocument(floatingFocusElement); |
| 3832 |
return addEventListener(doc, "keydown", onKeyDown); |
| 3833 |
}, [disabled2, floatingFocusElement, modal, isUntrappedTypeableCombobox, getTabbableContent]); |
| 3834 |
React24.useEffect(() => { |
| 3835 |
if (disabled2 || !open) { |
| 3836 |
return void 0; |
| 3837 |
} |
| 3838 |
const doc = ownerDocument(floatingFocusElement); |
| 3839 |
function clearPointerDownOutside() { |
| 3840 |
pointerDownOutsideRef.current = false; |
| 3841 |
} |
| 3842 |
function onPointerDown(event) { |
| 3843 |
const target = getTarget(event); |
| 3844 |
const insideElements = getResolvedInsideElements(); |
| 3845 |
const pointerTargetInside = contains(floating, target) || contains(domReference, target) || contains(portalContext?.portalNode, target) || insideElements.some((element) => element === target || contains(element, target)); |
| 3846 |
pointerDownOutsideRef.current = !pointerTargetInside; |
| 3847 |
lastInteractionTypeRef.current = event.pointerType || "keyboard"; |
| 3848 |
if (target?.closest(`[${CLICK_TRIGGER_IDENTIFIER}]`)) { |
| 3849 |
isPointerDownRef.current = true; |
| 3850 |
} |
| 3851 |
} |
| 3852 |
function onKeyDown() { |
| 3853 |
lastInteractionTypeRef.current = "keyboard"; |
| 3854 |
} |
| 3855 |
return mergeCleanups(addEventListener(doc, "pointerdown", onPointerDown, true), addEventListener(doc, "pointerup", clearPointerDownOutside, true), addEventListener(doc, "pointercancel", clearPointerDownOutside, true), addEventListener(doc, "keydown", onKeyDown, true)); |
| 3856 |
}, [disabled2, floating, domReference, floatingFocusElement, open, portalContext, getResolvedInsideElements]); |
| 3857 |
React24.useEffect(() => { |
| 3858 |
if (disabled2 || !closeOnFocusOut) { |
| 3859 |
return void 0; |
| 3860 |
} |
| 3861 |
const doc = ownerDocument(floatingFocusElement); |
| 3862 |
function handlePointerDown() { |
| 3863 |
isPointerDownRef.current = true; |
| 3864 |
pointerDownTimeout.start(0, () => { |
| 3865 |
isPointerDownRef.current = false; |
| 3866 |
}); |
| 3867 |
} |
| 3868 |
function handleFocusIn(event) { |
| 3869 |
const target = getTarget(event); |
| 3870 |
if (isTabbable(target)) { |
| 3871 |
lastFocusedTabbableRef.current = target; |
| 3872 |
} |
| 3873 |
} |
| 3874 |
function handleFocusOutside(event) { |
| 3875 |
const relatedTarget = event.relatedTarget; |
| 3876 |
const currentTarget = event.currentTarget; |
| 3877 |
const target = getTarget(event); |
| 3878 |
queueMicrotask(() => { |
| 3879 |
const nodeId = getNodeId(); |
| 3880 |
const triggers = store.context.triggerElements; |
| 3881 |
const insideElements = getResolvedInsideElements(); |
| 3882 |
const isRelatedFocusGuard = relatedTarget?.hasAttribute(createAttribute("focus-guard")) && [beforeGuardRef.current, afterGuardRef.current, portalContext?.beforeInsideRef.current, portalContext?.afterInsideRef.current, portalContext?.beforeOutsideRef.current, portalContext?.afterOutsideRef.current, resolveRef(previousFocusableElement), resolveRef(nextFocusableElement)].includes(relatedTarget); |
| 3883 |
const movedToUnrelatedNode = !(contains(domReference, relatedTarget) || contains(floating, relatedTarget) || contains(relatedTarget, floating) || contains(portalContext?.portalNode, relatedTarget) || insideElements.some((element) => element === relatedTarget || contains(element, relatedTarget)) || relatedTarget != null && triggers.hasElement(relatedTarget) || triggers.hasMatchingElement((trigger) => contains(trigger, relatedTarget)) || isRelatedFocusGuard || tree && (getNodeChildren(tree.nodesRef.current, nodeId).find((node) => contains(node.context?.elements.floating, relatedTarget) || contains(node.context?.elements.domReference, relatedTarget)) || getNodeAncestors(tree.nodesRef.current, nodeId).find((node) => [node.context?.elements.floating, getFloatingFocusElement(node.context?.elements.floating)].includes(relatedTarget) || node.context?.elements.domReference === relatedTarget))); |
| 3884 |
if (currentTarget === domReference && floatingFocusElement) { |
| 3885 |
handleTabIndex(floatingFocusElement, orderRef); |
| 3886 |
} |
| 3887 |
if (restoreFocus && currentTarget !== domReference && !isElementVisible(target) && activeElement(doc) === doc.body) { |
| 3888 |
if (isHTMLElement(floatingFocusElement)) { |
| 3889 |
floatingFocusElement.focus(); |
| 3890 |
if (restoreFocus === "popup") { |
| 3891 |
restoreFocusFrame.request(() => { |
| 3892 |
floatingFocusElement.focus(); |
| 3893 |
}); |
| 3894 |
return; |
| 3895 |
} |
| 3896 |
} |
| 3897 |
const tabbableContent = getTabbableContent(); |
| 3898 |
const prevTabbable = lastFocusedTabbableRef.current; |
| 3899 |
const nodeToFocus = (prevTabbable && tabbableContent.includes(prevTabbable) ? prevTabbable : null) || tabbableContent[tabbableContent.length - 1] || floatingFocusElement; |
| 3900 |
if (isHTMLElement(nodeToFocus)) { |
| 3901 |
nodeToFocus.focus(); |
| 3902 |
} |
| 3903 |
} |
| 3904 |
if (dataRef.current.insideReactTree) { |
| 3905 |
dataRef.current.insideReactTree = false; |
| 3906 |
return; |
| 3907 |
} |
| 3908 |
if ((isUntrappedTypeableCombobox ? true : !modal) && relatedTarget && movedToUnrelatedNode && !isPointerDownRef.current && // Fix React 18 Strict Mode returnFocus due to double rendering. |
| 3909 |
// For an "untrapped" typeable combobox (input role=combobox with |
| 3910 |
// initialFocus=false), re-opening the popup and tabbing out should still close it even |
| 3911 |
// when the previously focused element (e.g. the next tabbable outside the popup) is |
| 3912 |
// focused again. Otherwise, the popup remains open on the second Tab sequence: |
| 3913 |
// click input -> Tab (closes) -> click input -> Tab. |
| 3914 |
// Allow closing when `isUntrappedTypeableCombobox` regardless of the previously focused element. |
| 3915 |
(isUntrappedTypeableCombobox || relatedTarget !== getPreviouslyFocusedElement())) { |
| 3916 |
preventReturnFocusRef.current = true; |
| 3917 |
store.setOpen(false, createChangeEventDetails(reason_parts_exports.focusOut, event)); |
| 3918 |
} |
| 3919 |
}); |
| 3920 |
} |
| 3921 |
function markInsideReactTree() { |
| 3922 |
if (pointerDownOutsideRef.current) { |
| 3923 |
return; |
| 3924 |
} |
| 3925 |
dataRef.current.insideReactTree = true; |
| 3926 |
blurTimeout.start(0, () => { |
| 3927 |
dataRef.current.insideReactTree = false; |
| 3928 |
}); |
| 3929 |
} |
| 3930 |
const domReferenceElement = isHTMLElement(domReference) ? domReference : null; |
| 3931 |
if (!floating && !domReferenceElement) { |
| 3932 |
return void 0; |
| 3933 |
} |
| 3934 |
return mergeCleanups(domReferenceElement && addEventListener(domReferenceElement, "focusout", handleFocusOutside), domReferenceElement && addEventListener(domReferenceElement, "pointerdown", handlePointerDown), floating && addEventListener(floating, "focusin", handleFocusIn), floating && addEventListener(floating, "focusout", handleFocusOutside), floating && portalContext && addEventListener(floating, "focusout", markInsideReactTree, true)); |
| 3935 |
}, [disabled2, domReference, floating, floatingFocusElement, modal, tree, portalContext, store, closeOnFocusOut, restoreFocus, getTabbableContent, isUntrappedTypeableCombobox, getNodeId, orderRef, dataRef, blurTimeout, pointerDownTimeout, restoreFocusFrame, nextFocusableElement, previousFocusableElement, getResolvedInsideElements]); |
| 3936 |
React24.useEffect(() => { |
| 3937 |
if (disabled2 || !floating || !open) { |
| 3938 |
return void 0; |
| 3939 |
} |
| 3940 |
const portalNodes = Array.from(portalContext?.portalNode?.querySelectorAll(`[${createAttribute("portal")}]`) || []); |
| 3941 |
const ancestors = tree ? getNodeAncestors(tree.nodesRef.current, getNodeId()) : []; |
| 3942 |
const rootAncestorComboboxDomReference = ancestors.find((node) => isTypeableCombobox(node.context?.elements.domReference || null))?.context?.elements.domReference; |
| 3943 |
const controlInsideElements = [floating, ...portalNodes, beforeGuardRef.current, afterGuardRef.current, portalContext?.beforeOutsideRef.current, portalContext?.afterOutsideRef.current, ...getResolvedInsideElements()]; |
| 3944 |
const insideElements = [...controlInsideElements, rootAncestorComboboxDomReference, resolveRef(previousFocusableElement), resolveRef(nextFocusableElement), isUntrappedTypeableCombobox ? domReference : null].filter((x) => x != null); |
| 3945 |
const ariaHiddenCleanup = markOthers(insideElements, { |
| 3946 |
ariaHidden: modal || isUntrappedTypeableCombobox, |
| 3947 |
mark: false |
| 3948 |
}); |
| 3949 |
const markerInsideElements = [floating, ...portalNodes].filter((x) => x != null); |
| 3950 |
const markerCleanup = markOthers(markerInsideElements); |
| 3951 |
return () => { |
| 3952 |
markerCleanup(); |
| 3953 |
ariaHiddenCleanup(); |
| 3954 |
}; |
| 3955 |
}, [open, disabled2, domReference, floating, modal, portalContext, isUntrappedTypeableCombobox, tree, getNodeId, nextFocusableElement, previousFocusableElement, getResolvedInsideElements]); |
| 3956 |
useIsoLayoutEffect(() => { |
| 3957 |
if (!open || disabled2 || !isHTMLElement(floatingFocusElement)) { |
| 3958 |
return; |
| 3959 |
} |
| 3960 |
const doc = ownerDocument(floatingFocusElement); |
| 3961 |
const previouslyFocusedElement = activeElement(doc); |
| 3962 |
queueMicrotask(() => { |
| 3963 |
const initialFocusValueOrFn = initialFocusRef.current; |
| 3964 |
const resolvedInitialFocus = typeof initialFocusValueOrFn === "function" ? initialFocusValueOrFn(openInteractionTypeRef.current || "") : initialFocusValueOrFn; |
| 3965 |
if (resolvedInitialFocus === void 0 || resolvedInitialFocus === false) { |
| 3966 |
return; |
| 3967 |
} |
| 3968 |
const focusAlreadyInsideFloatingEl = contains(floatingFocusElement, previouslyFocusedElement); |
| 3969 |
if (focusAlreadyInsideFloatingEl) { |
| 3970 |
return; |
| 3971 |
} |
| 3972 |
let focusableElements = null; |
| 3973 |
const getDefaultFocusElement = () => { |
| 3974 |
if (focusableElements == null) { |
| 3975 |
focusableElements = getTabbableContent(floatingFocusElement); |
| 3976 |
} |
| 3977 |
return focusableElements[0] || floatingFocusElement; |
| 3978 |
}; |
| 3979 |
let elToFocus; |
| 3980 |
if (resolvedInitialFocus === true || resolvedInitialFocus === null) { |
| 3981 |
elToFocus = getDefaultFocusElement(); |
| 3982 |
} else { |
| 3983 |
elToFocus = resolveRef(resolvedInitialFocus); |
| 3984 |
} |
| 3985 |
elToFocus = elToFocus || getDefaultFocusElement(); |
| 3986 |
const hadFocusInside = contains(floatingFocusElement, activeElement(doc)); |
| 3987 |
enqueueFocus(elToFocus, { |
| 3988 |
preventScroll: elToFocus === floatingFocusElement, |
| 3989 |
shouldFocus() { |
| 3990 |
if (hadFocusInside) { |
| 3991 |
return true; |
| 3992 |
} |
| 3993 |
const currentActiveElement = activeElement(doc); |
| 3994 |
const focusMovedInside = currentActiveElement !== elToFocus && contains(floatingFocusElement, currentActiveElement); |
| 3995 |
return !focusMovedInside; |
| 3996 |
} |
| 3997 |
}); |
| 3998 |
}); |
| 3999 |
}, [disabled2, open, floatingFocusElement, getTabbableContent, initialFocusRef, openInteractionTypeRef]); |
| 4000 |
useIsoLayoutEffect(() => { |
| 4001 |
if (disabled2 || !floatingFocusElement) { |
| 4002 |
return void 0; |
| 4003 |
} |
| 4004 |
const doc = ownerDocument(floatingFocusElement); |
| 4005 |
const previouslyFocusedElement = activeElement(doc); |
| 4006 |
addPreviouslyFocusedElement(previouslyFocusedElement); |
| 4007 |
function onOpenChangeLocal(details) { |
| 4008 |
if (!details.open) { |
| 4009 |
closeTypeRef.current = getEventType(details.nativeEvent, lastInteractionTypeRef.current); |
| 4010 |
} |
| 4011 |
if (details.reason === reason_parts_exports.triggerHover && details.nativeEvent.type === "mouseleave") { |
| 4012 |
preventReturnFocusRef.current = true; |
| 4013 |
} |
| 4014 |
if (details.reason !== reason_parts_exports.outsidePress) { |
| 4015 |
return; |
| 4016 |
} |
| 4017 |
if (details.nested) { |
| 4018 |
preventReturnFocusRef.current = false; |
| 4019 |
} else if (isVirtualClick(details.nativeEvent) || isVirtualPointerEvent(details.nativeEvent)) { |
| 4020 |
preventReturnFocusRef.current = false; |
| 4021 |
} else { |
| 4022 |
let isPreventScrollSupported = false; |
| 4023 |
ownerDocument(floatingFocusElement).createElement("div").focus({ |
| 4024 |
get preventScroll() { |
| 4025 |
isPreventScrollSupported = true; |
| 4026 |
return false; |
| 4027 |
} |
| 4028 |
}); |
| 4029 |
if (isPreventScrollSupported) { |
| 4030 |
preventReturnFocusRef.current = false; |
| 4031 |
} else { |
| 4032 |
preventReturnFocusRef.current = true; |
| 4033 |
} |
| 4034 |
} |
| 4035 |
} |
| 4036 |
events.on("openchange", onOpenChangeLocal); |
| 4037 |
function getReturnElement() { |
| 4038 |
const returnFocusValueOrFn = returnFocusRef.current; |
| 4039 |
let resolvedReturnFocusValue = typeof returnFocusValueOrFn === "function" ? returnFocusValueOrFn(closeTypeRef.current) : returnFocusValueOrFn; |
| 4040 |
if (resolvedReturnFocusValue === void 0 || resolvedReturnFocusValue === false) { |
| 4041 |
return null; |
| 4042 |
} |
| 4043 |
if (resolvedReturnFocusValue === null) { |
| 4044 |
resolvedReturnFocusValue = true; |
| 4045 |
} |
| 4046 |
if (typeof resolvedReturnFocusValue === "boolean") { |
| 4047 |
if (domReference?.isConnected) { |
| 4048 |
return domReference; |
| 4049 |
} |
| 4050 |
return getPreviouslyFocusedElement() || null; |
| 4051 |
} |
| 4052 |
const fallback = domReference?.isConnected ? domReference : getPreviouslyFocusedElement(); |
| 4053 |
return resolveRef(resolvedReturnFocusValue) || fallback || null; |
| 4054 |
} |
| 4055 |
return () => { |
| 4056 |
events.off("openchange", onOpenChangeLocal); |
| 4057 |
const activeEl = activeElement(doc); |
| 4058 |
const insideElements = getResolvedInsideElements(); |
| 4059 |
const isFocusInsideFloatingTree = contains(floating, activeEl) || insideElements.some((element) => element === activeEl || contains(element, activeEl)) || tree && getNodeChildren(tree.nodesRef.current, getNodeId(), false).some((node) => contains(node.context?.elements.floating, activeEl)); |
| 4060 |
const returnFocusValueOrFn = returnFocusRef.current; |
| 4061 |
const returnElement = getReturnElement(); |
| 4062 |
queueMicrotask(() => { |
| 4063 |
const tabbableReturnElement = getFirstTabbableElement(returnElement); |
| 4064 |
const hasExplicitReturnFocus = typeof returnFocusValueOrFn !== "boolean"; |
| 4065 |
if (returnFocusValueOrFn && !preventReturnFocusRef.current && isHTMLElement(tabbableReturnElement) && // If the focus moved somewhere else after mount, avoid returning focus |
| 4066 |
// since it likely entered a different element which should be |
| 4067 |
// respected: https://github.com/floating-ui/floating-ui/issues/2607 |
| 4068 |
(!hasExplicitReturnFocus && tabbableReturnElement !== activeEl && activeEl !== doc.body ? isFocusInsideFloatingTree : true)) { |
| 4069 |
tabbableReturnElement.focus({ |
| 4070 |
preventScroll: true |
| 4071 |
}); |
| 4072 |
} |
| 4073 |
preventReturnFocusRef.current = false; |
| 4074 |
}); |
| 4075 |
}; |
| 4076 |
}, [disabled2, floating, floatingFocusElement, returnFocusRef, events, tree, domReference, getNodeId, getResolvedInsideElements]); |
| 4077 |
useIsoLayoutEffect(() => { |
| 4078 |
if (!isWebKit2 || open || !floating) { |
| 4079 |
return; |
| 4080 |
} |
| 4081 |
const activeEl = activeElement(ownerDocument(floating)); |
| 4082 |
if (!isHTMLElement(activeEl) || !isTypeableElement(activeEl)) { |
| 4083 |
return; |
| 4084 |
} |
| 4085 |
if (contains(floating, activeEl)) { |
| 4086 |
activeEl.blur(); |
| 4087 |
} |
| 4088 |
}, [open, floating]); |
| 4089 |
useIsoLayoutEffect(() => { |
| 4090 |
if (disabled2 || !portalContext) { |
| 4091 |
return void 0; |
| 4092 |
} |
| 4093 |
portalContext.setFocusManagerState({ |
| 4094 |
modal, |
| 4095 |
closeOnFocusOut, |
| 4096 |
open, |
| 4097 |
onOpenChange: store.setOpen, |
| 4098 |
domReference |
| 4099 |
}); |
| 4100 |
return () => { |
| 4101 |
portalContext.setFocusManagerState(null); |
| 4102 |
}; |
| 4103 |
}, [disabled2, portalContext, modal, open, store, closeOnFocusOut, domReference]); |
| 4104 |
useIsoLayoutEffect(() => { |
| 4105 |
if (disabled2 || !floatingFocusElement) { |
| 4106 |
return void 0; |
| 4107 |
} |
| 4108 |
handleTabIndex(floatingFocusElement, orderRef); |
| 4109 |
return () => { |
| 4110 |
queueMicrotask(clearDisconnectedPreviouslyFocusedElements); |
| 4111 |
}; |
| 4112 |
}, [disabled2, floatingFocusElement, orderRef]); |
| 4113 |
const shouldRenderGuards = !disabled2 && (modal ? !isUntrappedTypeableCombobox : true) && (isInsidePortal || modal); |
| 4114 |
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(React24.Fragment, { |
| 4115 |
children: [shouldRenderGuards && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(FocusGuard, { |
| 4116 |
"data-type": "inside", |
| 4117 |
ref: mergedBeforeGuardRef, |
| 4118 |
onFocus: (event) => { |
| 4119 |
if (modal) { |
| 4120 |
const els = getTabbableContent(); |
| 4121 |
enqueueFocus(els[els.length - 1]); |
| 4122 |
} else if (portalContext?.portalNode) { |
| 4123 |
preventReturnFocusRef.current = false; |
| 4124 |
if (isOutsideEvent(event, portalContext.portalNode)) { |
| 4125 |
const nextTabbable = getNextTabbable(domReference); |
| 4126 |
nextTabbable?.focus(); |
| 4127 |
} else { |
| 4128 |
resolveRef(previousFocusableElement ?? portalContext.beforeOutsideRef)?.focus(); |
| 4129 |
} |
| 4130 |
} |
| 4131 |
} |
| 4132 |
}), children, shouldRenderGuards && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(FocusGuard, { |
| 4133 |
"data-type": "inside", |
| 4134 |
ref: mergedAfterGuardRef, |
| 4135 |
onFocus: (event) => { |
| 4136 |
if (modal) { |
| 4137 |
enqueueFocus(getTabbableContent()[0]); |
| 4138 |
} else if (portalContext?.portalNode) { |
| 4139 |
if (closeOnFocusOut) { |
| 4140 |
preventReturnFocusRef.current = true; |
| 4141 |
} |
| 4142 |
if (isOutsideEvent(event, portalContext.portalNode)) { |
| 4143 |
const prevTabbable = getPreviousTabbable(domReference); |
| 4144 |
prevTabbable?.focus(); |
| 4145 |
} else { |
| 4146 |
resolveRef(nextFocusableElement ?? portalContext.afterOutsideRef)?.focus(); |
| 4147 |
} |
| 4148 |
} |
| 4149 |
} |
| 4150 |
})] |
| 4151 |
}); |
| 4152 |
} |
| 4153 |
|
| 4154 |
// node_modules/@base-ui/react/esm/floating-ui-react/hooks/useClick.js |
| 4155 |
var React25 = __toESM(require_react(), 1); |
| 4156 |
function useClick(context, props = {}) { |
| 4157 |
const { |
| 4158 |
enabled = true, |
| 4159 |
event: eventOption = "click", |
| 4160 |
toggle = true, |
| 4161 |
ignoreMouse = false, |
| 4162 |
stickIfOpen = true, |
| 4163 |
touchOpenDelay = 0, |
| 4164 |
reason = reason_parts_exports.triggerPress |
| 4165 |
} = props; |
| 4166 |
const store = "rootStore" in context ? context.rootStore : context; |
| 4167 |
const dataRef = store.context.dataRef; |
| 4168 |
const pointerTypeRef = React25.useRef(void 0); |
| 4169 |
const frame = useAnimationFrame(); |
| 4170 |
const touchOpenTimeout = useTimeout(); |
| 4171 |
const reference = React25.useMemo(() => { |
| 4172 |
function setOpenWithTouchDelay(nextOpen, nativeEvent, target, pointerType) { |
| 4173 |
const details = createChangeEventDetails(reason, nativeEvent, target); |
| 4174 |
if (nextOpen && pointerType === "touch" && touchOpenDelay > 0) { |
| 4175 |
touchOpenTimeout.start(touchOpenDelay, () => { |
| 4176 |
store.setOpen(true, details); |
| 4177 |
}); |
| 4178 |
} else { |
| 4179 |
store.setOpen(nextOpen, details); |
| 4180 |
} |
| 4181 |
} |
| 4182 |
function getNextOpen(open, currentTarget, isClickLikeOpenEvent2) { |
| 4183 |
const openEvent = dataRef.current.openEvent; |
| 4184 |
const hasClickedOnInactiveTrigger = store.select("domReferenceElement") !== currentTarget; |
| 4185 |
if (open && hasClickedOnInactiveTrigger) { |
| 4186 |
return true; |
| 4187 |
} |
| 4188 |
if (!open) { |
| 4189 |
return true; |
| 4190 |
} |
| 4191 |
if (!toggle) { |
| 4192 |
return true; |
| 4193 |
} |
| 4194 |
if (openEvent && stickIfOpen) { |
| 4195 |
return !isClickLikeOpenEvent2(openEvent.type); |
| 4196 |
} |
| 4197 |
return false; |
| 4198 |
} |
| 4199 |
return { |
| 4200 |
onPointerDown(event) { |
| 4201 |
pointerTypeRef.current = event.pointerType; |
| 4202 |
}, |
| 4203 |
onMouseDown(event) { |
| 4204 |
const pointerType = pointerTypeRef.current; |
| 4205 |
const nativeEvent = event.nativeEvent; |
| 4206 |
const open = store.select("open"); |
| 4207 |
if (event.button !== 0 || eventOption === "click" || isMouseLikePointerType(pointerType, true) && ignoreMouse) { |
| 4208 |
return; |
| 4209 |
} |
| 4210 |
const nextOpen = getNextOpen(open, event.currentTarget, (openEventType) => openEventType === "click" || openEventType === "mousedown"); |
| 4211 |
const target = getTarget(nativeEvent); |
| 4212 |
if (isTypeableElement(target)) { |
| 4213 |
setOpenWithTouchDelay(nextOpen, nativeEvent, target, pointerType); |
| 4214 |
return; |
| 4215 |
} |
| 4216 |
const eventCurrentTarget = event.currentTarget; |
| 4217 |
frame.request(() => { |
| 4218 |
setOpenWithTouchDelay(nextOpen, nativeEvent, eventCurrentTarget, pointerType); |
| 4219 |
}); |
| 4220 |
}, |
| 4221 |
onClick(event) { |
| 4222 |
if (eventOption === "mousedown-only") { |
| 4223 |
return; |
| 4224 |
} |
| 4225 |
const pointerType = pointerTypeRef.current; |
| 4226 |
if (eventOption === "mousedown" && pointerType) { |
| 4227 |
pointerTypeRef.current = void 0; |
| 4228 |
return; |
| 4229 |
} |
| 4230 |
if (isMouseLikePointerType(pointerType, true) && ignoreMouse) { |
| 4231 |
return; |
| 4232 |
} |
| 4233 |
const open = store.select("open"); |
| 4234 |
const nextOpen = getNextOpen(open, event.currentTarget, (openEventType) => openEventType === "click" || openEventType === "mousedown" || openEventType === "keydown" || openEventType === "keyup"); |
| 4235 |
setOpenWithTouchDelay(nextOpen, event.nativeEvent, event.currentTarget, pointerType); |
| 4236 |
}, |
| 4237 |
onKeyDown() { |
| 4238 |
pointerTypeRef.current = void 0; |
| 4239 |
} |
| 4240 |
}; |
| 4241 |
}, [dataRef, eventOption, ignoreMouse, reason, store, stickIfOpen, toggle, frame, touchOpenTimeout, touchOpenDelay]); |
| 4242 |
return React25.useMemo(() => enabled ? { |
| 4243 |
reference |
| 4244 |
} : EMPTY_OBJECT, [enabled, reference]); |
| 4245 |
} |
| 4246 |
|
| 4247 |
// node_modules/@base-ui/react/esm/floating-ui-react/hooks/useClientPoint.js |
| 4248 |
var React26 = __toESM(require_react(), 1); |
| 4249 |
function createVirtualElement(domElement, data) { |
| 4250 |
let offsetX = null; |
| 4251 |
let offsetY = null; |
| 4252 |
let isAutoUpdateEvent = false; |
| 4253 |
return { |
| 4254 |
contextElement: domElement || void 0, |
| 4255 |
getBoundingClientRect() { |
| 4256 |
const domRect = domElement?.getBoundingClientRect() || { |
| 4257 |
width: 0, |
| 4258 |
height: 0, |
| 4259 |
x: 0, |
| 4260 |
y: 0 |
| 4261 |
}; |
| 4262 |
const isXAxis = data.axis === "x" || data.axis === "both"; |
| 4263 |
const isYAxis = data.axis === "y" || data.axis === "both"; |
| 4264 |
const canTrackCursorOnAutoUpdate = ["mouseenter", "mousemove"].includes(data.dataRef.current.openEvent?.type || "") && data.pointerType !== "touch"; |
| 4265 |
let width = domRect.width; |
| 4266 |
let height = domRect.height; |
| 4267 |
let x = domRect.x; |
| 4268 |
let y = domRect.y; |
| 4269 |
if (offsetX == null && data.x && isXAxis) { |
| 4270 |
offsetX = domRect.x - data.x; |
| 4271 |
} |
| 4272 |
if (offsetY == null && data.y && isYAxis) { |
| 4273 |
offsetY = domRect.y - data.y; |
| 4274 |
} |
| 4275 |
x -= offsetX || 0; |
| 4276 |
y -= offsetY || 0; |
| 4277 |
width = 0; |
| 4278 |
height = 0; |
| 4279 |
if (!isAutoUpdateEvent || canTrackCursorOnAutoUpdate) { |
| 4280 |
width = data.axis === "y" ? domRect.width : 0; |
| 4281 |
height = data.axis === "x" ? domRect.height : 0; |
| 4282 |
x = isXAxis && data.x != null ? data.x : x; |
| 4283 |
y = isYAxis && data.y != null ? data.y : y; |
| 4284 |
} else if (isAutoUpdateEvent && !canTrackCursorOnAutoUpdate) { |
| 4285 |
height = data.axis === "x" ? domRect.height : height; |
| 4286 |
width = data.axis === "y" ? domRect.width : width; |
| 4287 |
} |
| 4288 |
isAutoUpdateEvent = true; |
| 4289 |
return { |
| 4290 |
width, |
| 4291 |
height, |
| 4292 |
x, |
| 4293 |
y, |
| 4294 |
top: y, |
| 4295 |
right: x + width, |
| 4296 |
bottom: y + height, |
| 4297 |
left: x |
| 4298 |
}; |
| 4299 |
} |
| 4300 |
}; |
| 4301 |
} |
| 4302 |
function isMouseBasedEvent(event) { |
| 4303 |
return event != null && event.clientX != null; |
| 4304 |
} |
| 4305 |
function useClientPoint(context, props = {}) { |
| 4306 |
const { |
| 4307 |
enabled = true, |
| 4308 |
axis = "both" |
| 4309 |
} = props; |
| 4310 |
const store = "rootStore" in context ? context.rootStore : context; |
| 4311 |
const open = store.useState("open"); |
| 4312 |
const floating = store.useState("floatingElement"); |
| 4313 |
const domReference = store.useState("domReferenceElement"); |
| 4314 |
const dataRef = store.context.dataRef; |
| 4315 |
const initialRef = React26.useRef(false); |
| 4316 |
const cleanupListenerRef = React26.useRef(null); |
| 4317 |
const [pointerType, setPointerType] = React26.useState(); |
| 4318 |
const [reactive, setReactive] = React26.useState([]); |
| 4319 |
const resetReference = useStableCallback((reference2) => { |
| 4320 |
store.set("positionReference", reference2); |
| 4321 |
}); |
| 4322 |
const setReference = useStableCallback((newX, newY, referenceElement) => { |
| 4323 |
if (initialRef.current) { |
| 4324 |
return; |
| 4325 |
} |
| 4326 |
if (dataRef.current.openEvent && !isMouseBasedEvent(dataRef.current.openEvent)) { |
| 4327 |
return; |
| 4328 |
} |
| 4329 |
store.set("positionReference", createVirtualElement(referenceElement ?? domReference, { |
| 4330 |
x: newX, |
| 4331 |
y: newY, |
| 4332 |
axis, |
| 4333 |
dataRef, |
| 4334 |
pointerType |
| 4335 |
})); |
| 4336 |
}); |
| 4337 |
const handleReferenceEnterOrMove = useStableCallback((event) => { |
| 4338 |
if (!open) { |
| 4339 |
setReference(event.clientX, event.clientY, event.currentTarget); |
| 4340 |
} else if (!cleanupListenerRef.current) { |
| 4341 |
setReference(event.clientX, event.clientY, event.currentTarget); |
| 4342 |
setReactive([]); |
| 4343 |
} |
| 4344 |
}); |
| 4345 |
const openCheck = isMouseLikePointerType(pointerType) ? floating : open; |
| 4346 |
React26.useEffect(() => { |
| 4347 |
if (!enabled) { |
| 4348 |
resetReference(domReference); |
| 4349 |
return void 0; |
| 4350 |
} |
| 4351 |
if (!openCheck) { |
| 4352 |
return void 0; |
| 4353 |
} |
| 4354 |
function cleanupListener() { |
| 4355 |
cleanupListenerRef.current?.(); |
| 4356 |
cleanupListenerRef.current = null; |
| 4357 |
} |
| 4358 |
const win = getWindow(floating); |
| 4359 |
function handleMouseMove(event) { |
| 4360 |
const target = getTarget(event); |
| 4361 |
if (!contains(floating, target)) { |
| 4362 |
setReference(event.clientX, event.clientY); |
| 4363 |
} else { |
| 4364 |
cleanupListener(); |
| 4365 |
} |
| 4366 |
} |
| 4367 |
if (!dataRef.current.openEvent || isMouseBasedEvent(dataRef.current.openEvent)) { |
| 4368 |
cleanupListenerRef.current = addEventListener(win, "mousemove", handleMouseMove); |
| 4369 |
} else { |
| 4370 |
resetReference(domReference); |
| 4371 |
} |
| 4372 |
return cleanupListener; |
| 4373 |
}, [openCheck, enabled, floating, dataRef, domReference, store, setReference, resetReference, reactive]); |
| 4374 |
React26.useEffect(() => () => { |
| 4375 |
store.set("positionReference", null); |
| 4376 |
}, [store]); |
| 4377 |
React26.useEffect(() => { |
| 4378 |
if (enabled && !floating) { |
| 4379 |
initialRef.current = false; |
| 4380 |
} |
| 4381 |
}, [enabled, floating]); |
| 4382 |
React26.useEffect(() => { |
| 4383 |
if (!enabled && open) { |
| 4384 |
initialRef.current = true; |
| 4385 |
} |
| 4386 |
}, [enabled, open]); |
| 4387 |
const reference = React26.useMemo(() => { |
| 4388 |
function setPointerTypeRef(event) { |
| 4389 |
setPointerType(event.pointerType); |
| 4390 |
} |
| 4391 |
return { |
| 4392 |
onPointerDown: setPointerTypeRef, |
| 4393 |
onPointerEnter: setPointerTypeRef, |
| 4394 |
onMouseMove: handleReferenceEnterOrMove, |
| 4395 |
onMouseEnter: handleReferenceEnterOrMove |
| 4396 |
}; |
| 4397 |
}, [handleReferenceEnterOrMove]); |
| 4398 |
return React26.useMemo(() => enabled ? { |
| 4399 |
reference, |
| 4400 |
trigger: reference |
| 4401 |
} : {}, [enabled, reference]); |
| 4402 |
} |
| 4403 |
|
| 4404 |
// node_modules/@base-ui/react/esm/floating-ui-react/hooks/useDismiss.js |
| 4405 |
var React27 = __toESM(require_react(), 1); |
| 4406 |
var bubbleHandlerKeys = { |
| 4407 |
intentional: "onClick", |
| 4408 |
sloppy: "onPointerDown" |
| 4409 |
}; |
| 4410 |
function alwaysFalse() { |
| 4411 |
return false; |
| 4412 |
} |
| 4413 |
function normalizeProp(normalizable) { |
| 4414 |
return { |
| 4415 |
escapeKey: typeof normalizable === "boolean" ? normalizable : normalizable?.escapeKey ?? false, |
| 4416 |
outsidePress: typeof normalizable === "boolean" ? normalizable : normalizable?.outsidePress ?? true |
| 4417 |
}; |
| 4418 |
} |
| 4419 |
function useDismiss(context, props = {}) { |
| 4420 |
const { |
| 4421 |
enabled = true, |
| 4422 |
escapeKey: escapeKey2 = true, |
| 4423 |
outsidePress: outsidePressProp = true, |
| 4424 |
outsidePressEvent = "sloppy", |
| 4425 |
referencePress = alwaysFalse, |
| 4426 |
referencePressEvent = "sloppy", |
| 4427 |
bubbles, |
| 4428 |
externalTree |
| 4429 |
} = props; |
| 4430 |
const store = "rootStore" in context ? context.rootStore : context; |
| 4431 |
const open = store.useState("open"); |
| 4432 |
const floatingElement = store.useState("floatingElement"); |
| 4433 |
const { |
| 4434 |
dataRef |
| 4435 |
} = store.context; |
| 4436 |
const tree = useFloatingTree(externalTree); |
| 4437 |
const outsidePressFn = useStableCallback(typeof outsidePressProp === "function" ? outsidePressProp : () => false); |
| 4438 |
const outsidePress2 = typeof outsidePressProp === "function" ? outsidePressFn : outsidePressProp; |
| 4439 |
const outsidePressEnabled = outsidePress2 !== false; |
| 4440 |
const getOutsidePressEventProp = useStableCallback(() => outsidePressEvent); |
| 4441 |
const { |
| 4442 |
escapeKey: escapeKeyBubbles, |
| 4443 |
outsidePress: outsidePressBubbles |
| 4444 |
} = normalizeProp(bubbles); |
| 4445 |
const pressStartedInsideRef = React27.useRef(false); |
| 4446 |
const pressStartPreventedRef = React27.useRef(false); |
| 4447 |
const suppressNextOutsideClickRef = React27.useRef(false); |
| 4448 |
const isComposingRef = React27.useRef(false); |
| 4449 |
const currentPointerTypeRef = React27.useRef(""); |
| 4450 |
const touchStateRef = React27.useRef(null); |
| 4451 |
const cancelDismissOnEndTimeout = useTimeout(); |
| 4452 |
const clearInsideReactTreeTimeout = useTimeout(); |
| 4453 |
const clearInsideReactTree = useStableCallback(() => { |
| 4454 |
clearInsideReactTreeTimeout.clear(); |
| 4455 |
dataRef.current.insideReactTree = false; |
| 4456 |
}); |
| 4457 |
const hasBlockingChild = useStableCallback((bubbleKey) => { |
| 4458 |
const nodeId = dataRef.current.floatingContext?.nodeId; |
| 4459 |
const children = tree ? getNodeChildren(tree.nodesRef.current, nodeId) : []; |
| 4460 |
return children.some((child) => child.context?.open && !child.context.dataRef.current[bubbleKey]); |
| 4461 |
}); |
| 4462 |
const isEventWithinOwnElements = useStableCallback((event) => { |
| 4463 |
return isEventTargetWithin(event, store.select("floatingElement")) || isEventTargetWithin(event, store.select("domReferenceElement")); |
| 4464 |
}); |
| 4465 |
const closeOnReferencePress = useStableCallback((event) => { |
| 4466 |
if (!referencePress()) { |
| 4467 |
return; |
| 4468 |
} |
| 4469 |
store.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerPress, event.nativeEvent)); |
| 4470 |
}); |
| 4471 |
const closeOnEscapeKeyDown = useStableCallback((event) => { |
| 4472 |
if (!open || !enabled || !escapeKey2 || event.key !== "Escape") { |
| 4473 |
return; |
| 4474 |
} |
| 4475 |
if (isComposingRef.current) { |
| 4476 |
return; |
| 4477 |
} |
| 4478 |
if (!escapeKeyBubbles && hasBlockingChild("__escapeKeyBubbles")) { |
| 4479 |
return; |
| 4480 |
} |
| 4481 |
const native = isReactEvent(event) ? event.nativeEvent : event; |
| 4482 |
const eventDetails = createChangeEventDetails(reason_parts_exports.escapeKey, native); |
| 4483 |
store.setOpen(false, eventDetails); |
| 4484 |
if (!eventDetails.isCanceled) { |
| 4485 |
event.preventDefault(); |
| 4486 |
} |
| 4487 |
if (!escapeKeyBubbles && !eventDetails.isPropagationAllowed) { |
| 4488 |
event.stopPropagation(); |
| 4489 |
} |
| 4490 |
}); |
| 4491 |
const markInsideReactTree = useStableCallback(() => { |
| 4492 |
dataRef.current.insideReactTree = true; |
| 4493 |
clearInsideReactTreeTimeout.start(0, clearInsideReactTree); |
| 4494 |
}); |
| 4495 |
const markPressStartedInsideReactTree = useStableCallback((event) => { |
| 4496 |
if (!open || !enabled || event.button !== 0) { |
| 4497 |
return; |
| 4498 |
} |
| 4499 |
const target = getTarget(event.nativeEvent); |
| 4500 |
if (!contains(store.select("floatingElement"), target)) { |
| 4501 |
return; |
| 4502 |
} |
| 4503 |
if (!pressStartedInsideRef.current) { |
| 4504 |
pressStartedInsideRef.current = true; |
| 4505 |
pressStartPreventedRef.current = false; |
| 4506 |
} |
| 4507 |
}); |
| 4508 |
const markInsidePressStartPrevented = useStableCallback((event) => { |
| 4509 |
if (!open || !enabled) { |
| 4510 |
return; |
| 4511 |
} |
| 4512 |
if (!(event.defaultPrevented || event.nativeEvent.defaultPrevented)) { |
| 4513 |
return; |
| 4514 |
} |
| 4515 |
if (pressStartedInsideRef.current) { |
| 4516 |
pressStartPreventedRef.current = true; |
| 4517 |
} |
| 4518 |
}); |
| 4519 |
React27.useEffect(() => { |
| 4520 |
if (!open || !enabled) { |
| 4521 |
return void 0; |
| 4522 |
} |
| 4523 |
dataRef.current.__escapeKeyBubbles = escapeKeyBubbles; |
| 4524 |
dataRef.current.__outsidePressBubbles = outsidePressBubbles; |
| 4525 |
const compositionTimeout = new Timeout(); |
| 4526 |
const preventedPressSuppressionTimeout = new Timeout(); |
| 4527 |
function handleCompositionStart() { |
| 4528 |
compositionTimeout.clear(); |
| 4529 |
isComposingRef.current = true; |
| 4530 |
} |
| 4531 |
function handleCompositionEnd() { |
| 4532 |
compositionTimeout.start( |
| 4533 |
// 0ms or 1ms don't work in Safari. 5ms appears to consistently work. |
| 4534 |
// Only apply to WebKit for the test to remain 0ms. |
| 4535 |
isWebKit() ? 5 : 0, |
| 4536 |
() => { |
| 4537 |
isComposingRef.current = false; |
| 4538 |
} |
| 4539 |
); |
| 4540 |
} |
| 4541 |
function suppressImmediateOutsideClickAfterPreventedStart() { |
| 4542 |
suppressNextOutsideClickRef.current = true; |
| 4543 |
preventedPressSuppressionTimeout.start(0, () => { |
| 4544 |
suppressNextOutsideClickRef.current = false; |
| 4545 |
}); |
| 4546 |
} |
| 4547 |
function resetPressStartState() { |
| 4548 |
pressStartedInsideRef.current = false; |
| 4549 |
pressStartPreventedRef.current = false; |
| 4550 |
} |
| 4551 |
function getOutsidePressEvent() { |
| 4552 |
const type = currentPointerTypeRef.current; |
| 4553 |
const computedType = type === "pen" || !type ? "mouse" : type; |
| 4554 |
const outsidePressEventValue = getOutsidePressEventProp(); |
| 4555 |
const resolved = typeof outsidePressEventValue === "function" ? outsidePressEventValue() : outsidePressEventValue; |
| 4556 |
if (typeof resolved === "string") { |
| 4557 |
return resolved; |
| 4558 |
} |
| 4559 |
return resolved[computedType]; |
| 4560 |
} |
| 4561 |
function shouldIgnoreEvent(event) { |
| 4562 |
const computedOutsidePressEvent = getOutsidePressEvent(); |
| 4563 |
return computedOutsidePressEvent === "intentional" && event.type !== "click" || computedOutsidePressEvent === "sloppy" && event.type === "click"; |
| 4564 |
} |
| 4565 |
function isEventWithinFloatingTree(event) { |
| 4566 |
const nodeId = dataRef.current.floatingContext?.nodeId; |
| 4567 |
const targetIsInsideChildren = tree && getNodeChildren(tree.nodesRef.current, nodeId).some((node) => isEventTargetWithin(event, node.context?.elements.floating)); |
| 4568 |
return isEventWithinOwnElements(event) || targetIsInsideChildren; |
| 4569 |
} |
| 4570 |
function closeOnPressOutside(event) { |
| 4571 |
if (shouldIgnoreEvent(event)) { |
| 4572 |
if (event.type !== "click" && !isEventWithinOwnElements(event)) { |
| 4573 |
preventedPressSuppressionTimeout.clear(); |
| 4574 |
suppressNextOutsideClickRef.current = false; |
| 4575 |
} |
| 4576 |
clearInsideReactTree(); |
| 4577 |
return; |
| 4578 |
} |
| 4579 |
if (dataRef.current.insideReactTree) { |
| 4580 |
clearInsideReactTree(); |
| 4581 |
return; |
| 4582 |
} |
| 4583 |
const target = getTarget(event); |
| 4584 |
const inertSelector = `[${createAttribute("inert")}]`; |
| 4585 |
const targetRoot = isElement(target) ? target.getRootNode() : null; |
| 4586 |
const markers = Array.from((isShadowRoot(targetRoot) ? targetRoot : ownerDocument(store.select("floatingElement"))).querySelectorAll(inertSelector)); |
| 4587 |
const triggers = store.context.triggerElements; |
| 4588 |
if (target && (triggers.hasElement(target) || triggers.hasMatchingElement((trigger) => contains(trigger, target)))) { |
| 4589 |
return; |
| 4590 |
} |
| 4591 |
let targetRootAncestor = isElement(target) ? target : null; |
| 4592 |
while (targetRootAncestor && !isLastTraversableNode(targetRootAncestor)) { |
| 4593 |
const nextParent = getParentNode(targetRootAncestor); |
| 4594 |
if (isLastTraversableNode(nextParent) || !isElement(nextParent)) { |
| 4595 |
break; |
| 4596 |
} |
| 4597 |
targetRootAncestor = nextParent; |
| 4598 |
} |
| 4599 |
if (markers.length && isElement(target) && !isRootElement(target) && // Clicked on a direct ancestor (e.g. FloatingOverlay). |
| 4600 |
!contains(target, store.select("floatingElement")) && // If the target root element contains none of the markers, then the |
| 4601 |
// element was injected after the floating element rendered. |
| 4602 |
markers.every((marker) => !contains(targetRootAncestor, marker))) { |
| 4603 |
return; |
| 4604 |
} |
| 4605 |
if (isHTMLElement(target) && !("touches" in event)) { |
| 4606 |
const lastTraversableNode = isLastTraversableNode(target); |
| 4607 |
const style = getComputedStyle2(target); |
| 4608 |
const scrollRe = /auto|scroll/; |
| 4609 |
const isScrollableX = lastTraversableNode || scrollRe.test(style.overflowX); |
| 4610 |
const isScrollableY = lastTraversableNode || scrollRe.test(style.overflowY); |
| 4611 |
const canScrollX = isScrollableX && target.clientWidth > 0 && target.scrollWidth > target.clientWidth; |
| 4612 |
const canScrollY = isScrollableY && target.clientHeight > 0 && target.scrollHeight > target.clientHeight; |
| 4613 |
const isRTL2 = style.direction === "rtl"; |
| 4614 |
const pressedVerticalScrollbar = canScrollY && (isRTL2 ? event.offsetX <= target.offsetWidth - target.clientWidth : event.offsetX > target.clientWidth); |
| 4615 |
const pressedHorizontalScrollbar = canScrollX && event.offsetY > target.clientHeight; |
| 4616 |
if (pressedVerticalScrollbar || pressedHorizontalScrollbar) { |
| 4617 |
return; |
| 4618 |
} |
| 4619 |
} |
| 4620 |
if (isEventWithinFloatingTree(event)) { |
| 4621 |
return; |
| 4622 |
} |
| 4623 |
if (getOutsidePressEvent() === "intentional" && suppressNextOutsideClickRef.current) { |
| 4624 |
preventedPressSuppressionTimeout.clear(); |
| 4625 |
suppressNextOutsideClickRef.current = false; |
| 4626 |
return; |
| 4627 |
} |
| 4628 |
if (typeof outsidePress2 === "function" && !outsidePress2(event)) { |
| 4629 |
return; |
| 4630 |
} |
| 4631 |
if (hasBlockingChild("__outsidePressBubbles")) { |
| 4632 |
return; |
| 4633 |
} |
| 4634 |
store.setOpen(false, createChangeEventDetails(reason_parts_exports.outsidePress, event)); |
| 4635 |
clearInsideReactTree(); |
| 4636 |
} |
| 4637 |
function handlePointerDown(event) { |
| 4638 |
if (getOutsidePressEvent() !== "sloppy" || event.pointerType === "touch" || !store.select("open") || !enabled || isEventWithinOwnElements(event)) { |
| 4639 |
return; |
| 4640 |
} |
| 4641 |
closeOnPressOutside(event); |
| 4642 |
} |
| 4643 |
function handleTouchStart(event) { |
| 4644 |
if (getOutsidePressEvent() !== "sloppy" || !store.select("open") || !enabled || isEventWithinOwnElements(event)) { |
| 4645 |
return; |
| 4646 |
} |
| 4647 |
const touch = event.touches[0]; |
| 4648 |
if (touch) { |
| 4649 |
touchStateRef.current = { |
| 4650 |
startTime: Date.now(), |
| 4651 |
startX: touch.clientX, |
| 4652 |
startY: touch.clientY, |
| 4653 |
dismissOnTouchEnd: false, |
| 4654 |
dismissOnMouseDown: true |
| 4655 |
}; |
| 4656 |
cancelDismissOnEndTimeout.start(1e3, () => { |
| 4657 |
if (touchStateRef.current) { |
| 4658 |
touchStateRef.current.dismissOnTouchEnd = false; |
| 4659 |
touchStateRef.current.dismissOnMouseDown = false; |
| 4660 |
} |
| 4661 |
}); |
| 4662 |
} |
| 4663 |
} |
| 4664 |
function addTargetEventListenerOnce(event, listener) { |
| 4665 |
const target = getTarget(event); |
| 4666 |
if (!target) { |
| 4667 |
return; |
| 4668 |
} |
| 4669 |
const unsubscribe2 = addEventListener(target, event.type, () => { |
| 4670 |
listener(event); |
| 4671 |
unsubscribe2(); |
| 4672 |
}); |
| 4673 |
} |
| 4674 |
function handleTouchStartCapture(event) { |
| 4675 |
currentPointerTypeRef.current = "touch"; |
| 4676 |
addTargetEventListenerOnce(event, handleTouchStart); |
| 4677 |
} |
| 4678 |
function closeOnPressOutsideCapture(event) { |
| 4679 |
cancelDismissOnEndTimeout.clear(); |
| 4680 |
if (event.type === "pointerdown") { |
| 4681 |
currentPointerTypeRef.current = event.pointerType; |
| 4682 |
} |
| 4683 |
if (event.type === "mousedown" && touchStateRef.current && !touchStateRef.current.dismissOnMouseDown) { |
| 4684 |
return; |
| 4685 |
} |
| 4686 |
addTargetEventListenerOnce(event, (targetEvent) => { |
| 4687 |
if (targetEvent.type === "pointerdown") { |
| 4688 |
handlePointerDown(targetEvent); |
| 4689 |
} else { |
| 4690 |
closeOnPressOutside(targetEvent); |
| 4691 |
} |
| 4692 |
}); |
| 4693 |
} |
| 4694 |
function handlePressEndCapture(event) { |
| 4695 |
if (!pressStartedInsideRef.current) { |
| 4696 |
return; |
| 4697 |
} |
| 4698 |
const pressStartedInsideDefaultPrevented = pressStartPreventedRef.current; |
| 4699 |
resetPressStartState(); |
| 4700 |
if (getOutsidePressEvent() !== "intentional") { |
| 4701 |
return; |
| 4702 |
} |
| 4703 |
if (event.type === "pointercancel") { |
| 4704 |
if (pressStartedInsideDefaultPrevented) { |
| 4705 |
suppressImmediateOutsideClickAfterPreventedStart(); |
| 4706 |
} |
| 4707 |
return; |
| 4708 |
} |
| 4709 |
if (isEventWithinFloatingTree(event)) { |
| 4710 |
return; |
| 4711 |
} |
| 4712 |
if (pressStartedInsideDefaultPrevented) { |
| 4713 |
suppressImmediateOutsideClickAfterPreventedStart(); |
| 4714 |
return; |
| 4715 |
} |
| 4716 |
if (typeof outsidePress2 === "function" && !outsidePress2(event)) { |
| 4717 |
return; |
| 4718 |
} |
| 4719 |
preventedPressSuppressionTimeout.clear(); |
| 4720 |
suppressNextOutsideClickRef.current = true; |
| 4721 |
clearInsideReactTree(); |
| 4722 |
} |
| 4723 |
function handleTouchMove(event) { |
| 4724 |
if (getOutsidePressEvent() !== "sloppy" || !touchStateRef.current || isEventWithinOwnElements(event)) { |
| 4725 |
return; |
| 4726 |
} |
| 4727 |
const touch = event.touches[0]; |
| 4728 |
if (!touch) { |
| 4729 |
return; |
| 4730 |
} |
| 4731 |
const deltaX = Math.abs(touch.clientX - touchStateRef.current.startX); |
| 4732 |
const deltaY = Math.abs(touch.clientY - touchStateRef.current.startY); |
| 4733 |
const distance = Math.sqrt(deltaX * deltaX + deltaY * deltaY); |
| 4734 |
if (distance > 5) { |
| 4735 |
touchStateRef.current.dismissOnTouchEnd = true; |
| 4736 |
} |
| 4737 |
if (distance > 10) { |
| 4738 |
closeOnPressOutside(event); |
| 4739 |
cancelDismissOnEndTimeout.clear(); |
| 4740 |
touchStateRef.current = null; |
| 4741 |
} |
| 4742 |
} |
| 4743 |
function handleTouchMoveCapture(event) { |
| 4744 |
addTargetEventListenerOnce(event, handleTouchMove); |
| 4745 |
} |
| 4746 |
function handleTouchEnd(event) { |
| 4747 |
if (getOutsidePressEvent() !== "sloppy" || !touchStateRef.current || isEventWithinOwnElements(event)) { |
| 4748 |
return; |
| 4749 |
} |
| 4750 |
if (touchStateRef.current.dismissOnTouchEnd) { |
| 4751 |
closeOnPressOutside(event); |
| 4752 |
} |
| 4753 |
cancelDismissOnEndTimeout.clear(); |
| 4754 |
touchStateRef.current = null; |
| 4755 |
} |
| 4756 |
function handleTouchEndCapture(event) { |
| 4757 |
addTargetEventListenerOnce(event, handleTouchEnd); |
| 4758 |
} |
| 4759 |
const doc = ownerDocument(floatingElement); |
| 4760 |
const unsubscribe = mergeCleanups(escapeKey2 && mergeCleanups(addEventListener(doc, "keydown", closeOnEscapeKeyDown), addEventListener(doc, "compositionstart", handleCompositionStart), addEventListener(doc, "compositionend", handleCompositionEnd)), outsidePressEnabled && mergeCleanups(addEventListener(doc, "click", closeOnPressOutsideCapture, true), addEventListener(doc, "pointerdown", closeOnPressOutsideCapture, true), addEventListener(doc, "pointerup", handlePressEndCapture, true), addEventListener(doc, "pointercancel", handlePressEndCapture, true), addEventListener(doc, "mousedown", closeOnPressOutsideCapture, true), addEventListener(doc, "mouseup", handlePressEndCapture, true), addEventListener(doc, "touchstart", handleTouchStartCapture, true), addEventListener(doc, "touchmove", handleTouchMoveCapture, true), addEventListener(doc, "touchend", handleTouchEndCapture, true))); |
| 4761 |
return () => { |
| 4762 |
unsubscribe(); |
| 4763 |
compositionTimeout.clear(); |
| 4764 |
preventedPressSuppressionTimeout.clear(); |
| 4765 |
resetPressStartState(); |
| 4766 |
suppressNextOutsideClickRef.current = false; |
| 4767 |
}; |
| 4768 |
}, [dataRef, floatingElement, escapeKey2, outsidePressEnabled, outsidePress2, open, enabled, escapeKeyBubbles, outsidePressBubbles, closeOnEscapeKeyDown, clearInsideReactTree, getOutsidePressEventProp, hasBlockingChild, isEventWithinOwnElements, tree, store, cancelDismissOnEndTimeout]); |
| 4769 |
React27.useEffect(clearInsideReactTree, [outsidePress2, clearInsideReactTree]); |
| 4770 |
const reference = React27.useMemo(() => ({ |
| 4771 |
onKeyDown: closeOnEscapeKeyDown, |
| 4772 |
[bubbleHandlerKeys[referencePressEvent]]: closeOnReferencePress, |
| 4773 |
...referencePressEvent !== "intentional" && { |
| 4774 |
onClick: closeOnReferencePress |
| 4775 |
} |
| 4776 |
}), [closeOnEscapeKeyDown, closeOnReferencePress, referencePressEvent]); |
| 4777 |
const floating = React27.useMemo(() => ({ |
| 4778 |
onKeyDown: closeOnEscapeKeyDown, |
| 4779 |
// `onMouseDown` may be blocked if `event.preventDefault()` is called in |
| 4780 |
// `onPointerDown`, such as with <NumberField.ScrubArea>. |
| 4781 |
// See https://github.com/mui/base-ui/pull/3379 |
| 4782 |
onPointerDown: markInsidePressStartPrevented, |
| 4783 |
onMouseDown: markInsidePressStartPrevented, |
| 4784 |
onClickCapture: markInsideReactTree, |
| 4785 |
onMouseDownCapture(event) { |
| 4786 |
markInsideReactTree(); |
| 4787 |
markPressStartedInsideReactTree(event); |
| 4788 |
}, |
| 4789 |
onPointerDownCapture(event) { |
| 4790 |
markInsideReactTree(); |
| 4791 |
markPressStartedInsideReactTree(event); |
| 4792 |
}, |
| 4793 |
onMouseUpCapture: markInsideReactTree, |
| 4794 |
onTouchEndCapture: markInsideReactTree, |
| 4795 |
onTouchMoveCapture: markInsideReactTree |
| 4796 |
}), [closeOnEscapeKeyDown, markInsideReactTree, markPressStartedInsideReactTree, markInsidePressStartPrevented]); |
| 4797 |
return React27.useMemo(() => enabled ? { |
| 4798 |
reference, |
| 4799 |
floating, |
| 4800 |
trigger: reference |
| 4801 |
} : {}, [enabled, reference, floating]); |
| 4802 |
} |
| 4803 |
|
| 4804 |
// node_modules/@base-ui/react/esm/floating-ui-react/hooks/useFloating.js |
| 4805 |
var React34 = __toESM(require_react(), 1); |
| 4806 |
|
| 4807 |
// node_modules/@floating-ui/core/dist/floating-ui.core.mjs |
| 4808 |
function computeCoordsFromPlacement(_ref, placement, rtl) { |
| 4809 |
let { |
| 4810 |
reference, |
| 4811 |
floating |
| 4812 |
} = _ref; |
| 4813 |
const sideAxis = getSideAxis(placement); |
| 4814 |
const alignmentAxis = getAlignmentAxis(placement); |
| 4815 |
const alignLength = getAxisLength(alignmentAxis); |
| 4816 |
const side = getSide(placement); |
| 4817 |
const isVertical = sideAxis === "y"; |
| 4818 |
const commonX = reference.x + reference.width / 2 - floating.width / 2; |
| 4819 |
const commonY = reference.y + reference.height / 2 - floating.height / 2; |
| 4820 |
const commonAlign = reference[alignLength] / 2 - floating[alignLength] / 2; |
| 4821 |
let coords; |
| 4822 |
switch (side) { |
| 4823 |
case "top": |
| 4824 |
coords = { |
| 4825 |
x: commonX, |
| 4826 |
y: reference.y - floating.height |
| 4827 |
}; |
| 4828 |
break; |
| 4829 |
case "bottom": |
| 4830 |
coords = { |
| 4831 |
x: commonX, |
| 4832 |
y: reference.y + reference.height |
| 4833 |
}; |
| 4834 |
break; |
| 4835 |
case "right": |
| 4836 |
coords = { |
| 4837 |
x: reference.x + reference.width, |
| 4838 |
y: commonY |
| 4839 |
}; |
| 4840 |
break; |
| 4841 |
case "left": |
| 4842 |
coords = { |
| 4843 |
x: reference.x - floating.width, |
| 4844 |
y: commonY |
| 4845 |
}; |
| 4846 |
break; |
| 4847 |
default: |
| 4848 |
coords = { |
| 4849 |
x: reference.x, |
| 4850 |
y: reference.y |
| 4851 |
}; |
| 4852 |
} |
| 4853 |
switch (getAlignment(placement)) { |
| 4854 |
case "start": |
| 4855 |
coords[alignmentAxis] -= commonAlign * (rtl && isVertical ? -1 : 1); |
| 4856 |
break; |
| 4857 |
case "end": |
| 4858 |
coords[alignmentAxis] += commonAlign * (rtl && isVertical ? -1 : 1); |
| 4859 |
break; |
| 4860 |
} |
| 4861 |
return coords; |
| 4862 |
} |
| 4863 |
async function detectOverflow(state, options) { |
| 4864 |
var _await$platform$isEle; |
| 4865 |
if (options === void 0) { |
| 4866 |
options = {}; |
| 4867 |
} |
| 4868 |
const { |
| 4869 |
x, |
| 4870 |
y, |
| 4871 |
platform: platform3, |
| 4872 |
rects, |
| 4873 |
elements, |
| 4874 |
strategy |
| 4875 |
} = state; |
| 4876 |
const { |
| 4877 |
boundary = "clippingAncestors", |
| 4878 |
rootBoundary = "viewport", |
| 4879 |
elementContext = "floating", |
| 4880 |
altBoundary = false, |
| 4881 |
padding = 0 |
| 4882 |
} = evaluate(options, state); |
| 4883 |
const paddingObject = getPaddingObject(padding); |
| 4884 |
const altContext = elementContext === "floating" ? "reference" : "floating"; |
| 4885 |
const element = elements[altBoundary ? altContext : elementContext]; |
| 4886 |
const clippingClientRect = rectToClientRect(await platform3.getClippingRect({ |
| 4887 |
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)), |
| 4888 |
boundary, |
| 4889 |
rootBoundary, |
| 4890 |
strategy |
| 4891 |
})); |
| 4892 |
const rect = elementContext === "floating" ? { |
| 4893 |
x, |
| 4894 |
y, |
| 4895 |
width: rects.floating.width, |
| 4896 |
height: rects.floating.height |
| 4897 |
} : rects.reference; |
| 4898 |
const offsetParent = await (platform3.getOffsetParent == null ? void 0 : platform3.getOffsetParent(elements.floating)); |
| 4899 |
const offsetScale = await (platform3.isElement == null ? void 0 : platform3.isElement(offsetParent)) ? await (platform3.getScale == null ? void 0 : platform3.getScale(offsetParent)) || { |
| 4900 |
x: 1, |
| 4901 |
y: 1 |
| 4902 |
} : { |
| 4903 |
x: 1, |
| 4904 |
y: 1 |
| 4905 |
}; |
| 4906 |
const elementClientRect = rectToClientRect(platform3.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform3.convertOffsetParentRelativeRectToViewportRelativeRect({ |
| 4907 |
elements, |
| 4908 |
rect, |
| 4909 |
offsetParent, |
| 4910 |
strategy |
| 4911 |
}) : rect); |
| 4912 |
return { |
| 4913 |
top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y, |
| 4914 |
bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y, |
| 4915 |
left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x, |
| 4916 |
right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x |
| 4917 |
}; |
| 4918 |
} |
| 4919 |
var MAX_RESET_COUNT = 50; |
| 4920 |
var computePosition = async (reference, floating, config) => { |
| 4921 |
const { |
| 4922 |
placement = "bottom", |
| 4923 |
strategy = "absolute", |
| 4924 |
middleware = [], |
| 4925 |
platform: platform3 |
| 4926 |
} = config; |
| 4927 |
const platformWithDetectOverflow = platform3.detectOverflow ? platform3 : { |
| 4928 |
...platform3, |
| 4929 |
detectOverflow |
| 4930 |
}; |
| 4931 |
const rtl = await (platform3.isRTL == null ? void 0 : platform3.isRTL(floating)); |
| 4932 |
let rects = await platform3.getElementRects({ |
| 4933 |
reference, |
| 4934 |
floating, |
| 4935 |
strategy |
| 4936 |
}); |
| 4937 |
let { |
| 4938 |
x, |
| 4939 |
y |
| 4940 |
} = computeCoordsFromPlacement(rects, placement, rtl); |
| 4941 |
let statefulPlacement = placement; |
| 4942 |
let resetCount = 0; |
| 4943 |
const middlewareData = {}; |
| 4944 |
for (let i = 0; i < middleware.length; i++) { |
| 4945 |
const currentMiddleware = middleware[i]; |
| 4946 |
if (!currentMiddleware) { |
| 4947 |
continue; |
| 4948 |
} |
| 4949 |
const { |
| 4950 |
name, |
| 4951 |
fn |
| 4952 |
} = currentMiddleware; |
| 4953 |
const { |
| 4954 |
x: nextX, |
| 4955 |
y: nextY, |
| 4956 |
data, |
| 4957 |
reset |
| 4958 |
} = await fn({ |
| 4959 |
x, |
| 4960 |
y, |
| 4961 |
initialPlacement: placement, |
| 4962 |
placement: statefulPlacement, |
| 4963 |
strategy, |
| 4964 |
middlewareData, |
| 4965 |
rects, |
| 4966 |
platform: platformWithDetectOverflow, |
| 4967 |
elements: { |
| 4968 |
reference, |
| 4969 |
floating |
| 4970 |
} |
| 4971 |
}); |
| 4972 |
x = nextX != null ? nextX : x; |
| 4973 |
y = nextY != null ? nextY : y; |
| 4974 |
middlewareData[name] = { |
| 4975 |
...middlewareData[name], |
| 4976 |
...data |
| 4977 |
}; |
| 4978 |
if (reset && resetCount < MAX_RESET_COUNT) { |
| 4979 |
resetCount++; |
| 4980 |
if (typeof reset === "object") { |
| 4981 |
if (reset.placement) { |
| 4982 |
statefulPlacement = reset.placement; |
| 4983 |
} |
| 4984 |
if (reset.rects) { |
| 4985 |
rects = reset.rects === true ? await platform3.getElementRects({ |
| 4986 |
reference, |
| 4987 |
floating, |
| 4988 |
strategy |
| 4989 |
}) : reset.rects; |
| 4990 |
} |
| 4991 |
({ |
| 4992 |
x, |
| 4993 |
y |
| 4994 |
} = computeCoordsFromPlacement(rects, statefulPlacement, rtl)); |
| 4995 |
} |
| 4996 |
i = -1; |
| 4997 |
} |
| 4998 |
} |
| 4999 |
return { |
| 5000 |
x, |
| 5001 |
y, |
| 5002 |
placement: statefulPlacement, |
| 5003 |
strategy, |
| 5004 |
middlewareData |
| 5005 |
}; |
| 5006 |
}; |
| 5007 |
var flip = function(options) { |
| 5008 |
if (options === void 0) { |
| 5009 |
options = {}; |
| 5010 |
} |
| 5011 |
return { |
| 5012 |
name: "flip", |
| 5013 |
options, |
| 5014 |
async fn(state) { |
| 5015 |
var _middlewareData$arrow, _middlewareData$flip; |
| 5016 |
const { |
| 5017 |
placement, |
| 5018 |
middlewareData, |
| 5019 |
rects, |
| 5020 |
initialPlacement, |
| 5021 |
platform: platform3, |
| 5022 |
elements |
| 5023 |
} = state; |
| 5024 |
const { |
| 5025 |
mainAxis: checkMainAxis = true, |
| 5026 |
crossAxis: checkCrossAxis = true, |
| 5027 |
fallbackPlacements: specifiedFallbackPlacements, |
| 5028 |
fallbackStrategy = "bestFit", |
| 5029 |
fallbackAxisSideDirection = "none", |
| 5030 |
flipAlignment = true, |
| 5031 |
...detectOverflowOptions |
| 5032 |
} = evaluate(options, state); |
| 5033 |
if ((_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) { |
| 5034 |
return {}; |
| 5035 |
} |
| 5036 |
const side = getSide(placement); |
| 5037 |
const initialSideAxis = getSideAxis(initialPlacement); |
| 5038 |
const isBasePlacement = getSide(initialPlacement) === initialPlacement; |
| 5039 |
const rtl = await (platform3.isRTL == null ? void 0 : platform3.isRTL(elements.floating)); |
| 5040 |
const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement)); |
| 5041 |
const hasFallbackAxisSideDirection = fallbackAxisSideDirection !== "none"; |
| 5042 |
if (!specifiedFallbackPlacements && hasFallbackAxisSideDirection) { |
| 5043 |
fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl)); |
| 5044 |
} |
| 5045 |
const placements2 = [initialPlacement, ...fallbackPlacements]; |
| 5046 |
const overflow = await platform3.detectOverflow(state, detectOverflowOptions); |
| 5047 |
const overflows = []; |
| 5048 |
let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || []; |
| 5049 |
if (checkMainAxis) { |
| 5050 |
overflows.push(overflow[side]); |
| 5051 |
} |
| 5052 |
if (checkCrossAxis) { |
| 5053 |
const sides2 = getAlignmentSides(placement, rects, rtl); |
| 5054 |
overflows.push(overflow[sides2[0]], overflow[sides2[1]]); |
| 5055 |
} |
| 5056 |
overflowsData = [...overflowsData, { |
| 5057 |
placement, |
| 5058 |
overflows |
| 5059 |
}]; |
| 5060 |
if (!overflows.every((side2) => side2 <= 0)) { |
| 5061 |
var _middlewareData$flip2, _overflowsData$filter; |
| 5062 |
const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1; |
| 5063 |
const nextPlacement = placements2[nextIndex]; |
| 5064 |
if (nextPlacement) { |
| 5065 |
const ignoreCrossAxisOverflow = checkCrossAxis === "alignment" ? initialSideAxis !== getSideAxis(nextPlacement) : false; |
| 5066 |
if (!ignoreCrossAxisOverflow || // We leave the current main axis only if every placement on that axis |
| 5067 |
// overflows the main axis. |
| 5068 |
overflowsData.every((d) => getSideAxis(d.placement) === initialSideAxis ? d.overflows[0] > 0 : true)) { |
| 5069 |
return { |
| 5070 |
data: { |
| 5071 |
index: nextIndex, |
| 5072 |
overflows: overflowsData |
| 5073 |
}, |
| 5074 |
reset: { |
| 5075 |
placement: nextPlacement |
| 5076 |
} |
| 5077 |
}; |
| 5078 |
} |
| 5079 |
} |
| 5080 |
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; |
| 5081 |
if (!resetPlacement) { |
| 5082 |
switch (fallbackStrategy) { |
| 5083 |
case "bestFit": { |
| 5084 |
var _overflowsData$filter2; |
| 5085 |
const placement2 = (_overflowsData$filter2 = overflowsData.filter((d) => { |
| 5086 |
if (hasFallbackAxisSideDirection) { |
| 5087 |
const currentSideAxis = getSideAxis(d.placement); |
| 5088 |
return currentSideAxis === initialSideAxis || // Create a bias to the `y` side axis due to horizontal |
| 5089 |
// reading directions favoring greater width. |
| 5090 |
currentSideAxis === "y"; |
| 5091 |
} |
| 5092 |
return true; |
| 5093 |
}).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]; |
| 5094 |
if (placement2) { |
| 5095 |
resetPlacement = placement2; |
| 5096 |
} |
| 5097 |
break; |
| 5098 |
} |
| 5099 |
case "initialPlacement": |
| 5100 |
resetPlacement = initialPlacement; |
| 5101 |
break; |
| 5102 |
} |
| 5103 |
} |
| 5104 |
if (placement !== resetPlacement) { |
| 5105 |
return { |
| 5106 |
reset: { |
| 5107 |
placement: resetPlacement |
| 5108 |
} |
| 5109 |
}; |
| 5110 |
} |
| 5111 |
} |
| 5112 |
return {}; |
| 5113 |
} |
| 5114 |
}; |
| 5115 |
}; |
| 5116 |
function getSideOffsets(overflow, rect) { |
| 5117 |
return { |
| 5118 |
top: overflow.top - rect.height, |
| 5119 |
right: overflow.right - rect.width, |
| 5120 |
bottom: overflow.bottom - rect.height, |
| 5121 |
left: overflow.left - rect.width |
| 5122 |
}; |
| 5123 |
} |
| 5124 |
function isAnySideFullyClipped(overflow) { |
| 5125 |
return sides.some((side) => overflow[side] >= 0); |
| 5126 |
} |
| 5127 |
var hide = function(options) { |
| 5128 |
if (options === void 0) { |
| 5129 |
options = {}; |
| 5130 |
} |
| 5131 |
return { |
| 5132 |
name: "hide", |
| 5133 |
options, |
| 5134 |
async fn(state) { |
| 5135 |
const { |
| 5136 |
rects, |
| 5137 |
platform: platform3 |
| 5138 |
} = state; |
| 5139 |
const { |
| 5140 |
strategy = "referenceHidden", |
| 5141 |
...detectOverflowOptions |
| 5142 |
} = evaluate(options, state); |
| 5143 |
switch (strategy) { |
| 5144 |
case "referenceHidden": { |
| 5145 |
const overflow = await platform3.detectOverflow(state, { |
| 5146 |
...detectOverflowOptions, |
| 5147 |
elementContext: "reference" |
| 5148 |
}); |
| 5149 |
const offsets = getSideOffsets(overflow, rects.reference); |
| 5150 |
return { |
| 5151 |
data: { |
| 5152 |
referenceHiddenOffsets: offsets, |
| 5153 |
referenceHidden: isAnySideFullyClipped(offsets) |
| 5154 |
} |
| 5155 |
}; |
| 5156 |
} |
| 5157 |
case "escaped": { |
| 5158 |
const overflow = await platform3.detectOverflow(state, { |
| 5159 |
...detectOverflowOptions, |
| 5160 |
altBoundary: true |
| 5161 |
}); |
| 5162 |
const offsets = getSideOffsets(overflow, rects.floating); |
| 5163 |
return { |
| 5164 |
data: { |
| 5165 |
escapedOffsets: offsets, |
| 5166 |
escaped: isAnySideFullyClipped(offsets) |
| 5167 |
} |
| 5168 |
}; |
| 5169 |
} |
| 5170 |
default: { |
| 5171 |
return {}; |
| 5172 |
} |
| 5173 |
} |
| 5174 |
} |
| 5175 |
}; |
| 5176 |
}; |
| 5177 |
var originSides = /* @__PURE__ */ new Set(["left", "top"]); |
| 5178 |
async function convertValueToCoords(state, options) { |
| 5179 |
const { |
| 5180 |
placement, |
| 5181 |
platform: platform3, |
| 5182 |
elements |
| 5183 |
} = state; |
| 5184 |
const rtl = await (platform3.isRTL == null ? void 0 : platform3.isRTL(elements.floating)); |
| 5185 |
const side = getSide(placement); |
| 5186 |
const alignment = getAlignment(placement); |
| 5187 |
const isVertical = getSideAxis(placement) === "y"; |
| 5188 |
const mainAxisMulti = originSides.has(side) ? -1 : 1; |
| 5189 |
const crossAxisMulti = rtl && isVertical ? -1 : 1; |
| 5190 |
const rawValue = evaluate(options, state); |
| 5191 |
let { |
| 5192 |
mainAxis, |
| 5193 |
crossAxis, |
| 5194 |
alignmentAxis |
| 5195 |
} = typeof rawValue === "number" ? { |
| 5196 |
mainAxis: rawValue, |
| 5197 |
crossAxis: 0, |
| 5198 |
alignmentAxis: null |
| 5199 |
} : { |
| 5200 |
mainAxis: rawValue.mainAxis || 0, |
| 5201 |
crossAxis: rawValue.crossAxis || 0, |
| 5202 |
alignmentAxis: rawValue.alignmentAxis |
| 5203 |
}; |
| 5204 |
if (alignment && typeof alignmentAxis === "number") { |
| 5205 |
crossAxis = alignment === "end" ? alignmentAxis * -1 : alignmentAxis; |
| 5206 |
} |
| 5207 |
return isVertical ? { |
| 5208 |
x: crossAxis * crossAxisMulti, |
| 5209 |
y: mainAxis * mainAxisMulti |
| 5210 |
} : { |
| 5211 |
x: mainAxis * mainAxisMulti, |
| 5212 |
y: crossAxis * crossAxisMulti |
| 5213 |
}; |
| 5214 |
} |
| 5215 |
var offset = function(options) { |
| 5216 |
if (options === void 0) { |
| 5217 |
options = 0; |
| 5218 |
} |
| 5219 |
return { |
| 5220 |
name: "offset", |
| 5221 |
options, |
| 5222 |
async fn(state) { |
| 5223 |
var _middlewareData$offse, _middlewareData$arrow; |
| 5224 |
const { |
| 5225 |
x, |
| 5226 |
y, |
| 5227 |
placement, |
| 5228 |
middlewareData |
| 5229 |
} = state; |
| 5230 |
const diffCoords = await convertValueToCoords(state, options); |
| 5231 |
if (placement === ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse.placement) && (_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) { |
| 5232 |
return {}; |
| 5233 |
} |
| 5234 |
return { |
| 5235 |
x: x + diffCoords.x, |
| 5236 |
y: y + diffCoords.y, |
| 5237 |
data: { |
| 5238 |
...diffCoords, |
| 5239 |
placement |
| 5240 |
} |
| 5241 |
}; |
| 5242 |
} |
| 5243 |
}; |
| 5244 |
}; |
| 5245 |
var shift = function(options) { |
| 5246 |
if (options === void 0) { |
| 5247 |
options = {}; |
| 5248 |
} |
| 5249 |
return { |
| 5250 |
name: "shift", |
| 5251 |
options, |
| 5252 |
async fn(state) { |
| 5253 |
const { |
| 5254 |
x, |
| 5255 |
y, |
| 5256 |
placement, |
| 5257 |
platform: platform3 |
| 5258 |
} = state; |
| 5259 |
const { |
| 5260 |
mainAxis: checkMainAxis = true, |
| 5261 |
crossAxis: checkCrossAxis = false, |
| 5262 |
limiter = { |
| 5263 |
fn: (_ref) => { |
| 5264 |
let { |
| 5265 |
x: x2, |
| 5266 |
y: y2 |
| 5267 |
} = _ref; |
| 5268 |
return { |
| 5269 |
x: x2, |
| 5270 |
y: y2 |
| 5271 |
}; |
| 5272 |
} |
| 5273 |
}, |
| 5274 |
...detectOverflowOptions |
| 5275 |
} = evaluate(options, state); |
| 5276 |
const coords = { |
| 5277 |
x, |
| 5278 |
y |
| 5279 |
}; |
| 5280 |
const overflow = await platform3.detectOverflow(state, detectOverflowOptions); |
| 5281 |
const crossAxis = getSideAxis(getSide(placement)); |
| 5282 |
const mainAxis = getOppositeAxis(crossAxis); |
| 5283 |
let mainAxisCoord = coords[mainAxis]; |
| 5284 |
let crossAxisCoord = coords[crossAxis]; |
| 5285 |
if (checkMainAxis) { |
| 5286 |
const minSide = mainAxis === "y" ? "top" : "left"; |
| 5287 |
const maxSide = mainAxis === "y" ? "bottom" : "right"; |
| 5288 |
const min2 = mainAxisCoord + overflow[minSide]; |
| 5289 |
const max2 = mainAxisCoord - overflow[maxSide]; |
| 5290 |
mainAxisCoord = clamp(min2, mainAxisCoord, max2); |
| 5291 |
} |
| 5292 |
if (checkCrossAxis) { |
| 5293 |
const minSide = crossAxis === "y" ? "top" : "left"; |
| 5294 |
const maxSide = crossAxis === "y" ? "bottom" : "right"; |
| 5295 |
const min2 = crossAxisCoord + overflow[minSide]; |
| 5296 |
const max2 = crossAxisCoord - overflow[maxSide]; |
| 5297 |
crossAxisCoord = clamp(min2, crossAxisCoord, max2); |
| 5298 |
} |
| 5299 |
const limitedCoords = limiter.fn({ |
| 5300 |
...state, |
| 5301 |
[mainAxis]: mainAxisCoord, |
| 5302 |
[crossAxis]: crossAxisCoord |
| 5303 |
}); |
| 5304 |
return { |
| 5305 |
...limitedCoords, |
| 5306 |
data: { |
| 5307 |
x: limitedCoords.x - x, |
| 5308 |
y: limitedCoords.y - y, |
| 5309 |
enabled: { |
| 5310 |
[mainAxis]: checkMainAxis, |
| 5311 |
[crossAxis]: checkCrossAxis |
| 5312 |
} |
| 5313 |
} |
| 5314 |
}; |
| 5315 |
} |
| 5316 |
}; |
| 5317 |
}; |
| 5318 |
var limitShift = function(options) { |
| 5319 |
if (options === void 0) { |
| 5320 |
options = {}; |
| 5321 |
} |
| 5322 |
return { |
| 5323 |
options, |
| 5324 |
fn(state) { |
| 5325 |
const { |
| 5326 |
x, |
| 5327 |
y, |
| 5328 |
placement, |
| 5329 |
rects, |
| 5330 |
middlewareData |
| 5331 |
} = state; |
| 5332 |
const { |
| 5333 |
offset: offset4 = 0, |
| 5334 |
mainAxis: checkMainAxis = true, |
| 5335 |
crossAxis: checkCrossAxis = true |
| 5336 |
} = evaluate(options, state); |
| 5337 |
const coords = { |
| 5338 |
x, |
| 5339 |
y |
| 5340 |
}; |
| 5341 |
const crossAxis = getSideAxis(placement); |
| 5342 |
const mainAxis = getOppositeAxis(crossAxis); |
| 5343 |
let mainAxisCoord = coords[mainAxis]; |
| 5344 |
let crossAxisCoord = coords[crossAxis]; |
| 5345 |
const rawOffset = evaluate(offset4, state); |
| 5346 |
const computedOffset = typeof rawOffset === "number" ? { |
| 5347 |
mainAxis: rawOffset, |
| 5348 |
crossAxis: 0 |
| 5349 |
} : { |
| 5350 |
mainAxis: 0, |
| 5351 |
crossAxis: 0, |
| 5352 |
...rawOffset |
| 5353 |
}; |
| 5354 |
if (checkMainAxis) { |
| 5355 |
const len = mainAxis === "y" ? "height" : "width"; |
| 5356 |
const limitMin = rects.reference[mainAxis] - rects.floating[len] + computedOffset.mainAxis; |
| 5357 |
const limitMax = rects.reference[mainAxis] + rects.reference[len] - computedOffset.mainAxis; |
| 5358 |
if (mainAxisCoord < limitMin) { |
| 5359 |
mainAxisCoord = limitMin; |
| 5360 |
} else if (mainAxisCoord > limitMax) { |
| 5361 |
mainAxisCoord = limitMax; |
| 5362 |
} |
| 5363 |
} |
| 5364 |
if (checkCrossAxis) { |
| 5365 |
var _middlewareData$offse, _middlewareData$offse2; |
| 5366 |
const len = mainAxis === "y" ? "width" : "height"; |
| 5367 |
const isOriginSide = originSides.has(getSide(placement)); |
| 5368 |
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); |
| 5369 |
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); |
| 5370 |
if (crossAxisCoord < limitMin) { |
| 5371 |
crossAxisCoord = limitMin; |
| 5372 |
} else if (crossAxisCoord > limitMax) { |
| 5373 |
crossAxisCoord = limitMax; |
| 5374 |
} |
| 5375 |
} |
| 5376 |
return { |
| 5377 |
[mainAxis]: mainAxisCoord, |
| 5378 |
[crossAxis]: crossAxisCoord |
| 5379 |
}; |
| 5380 |
} |
| 5381 |
}; |
| 5382 |
}; |
| 5383 |
var size = function(options) { |
| 5384 |
if (options === void 0) { |
| 5385 |
options = {}; |
| 5386 |
} |
| 5387 |
return { |
| 5388 |
name: "size", |
| 5389 |
options, |
| 5390 |
async fn(state) { |
| 5391 |
var _state$middlewareData, _state$middlewareData2; |
| 5392 |
const { |
| 5393 |
placement, |
| 5394 |
rects, |
| 5395 |
platform: platform3, |
| 5396 |
elements |
| 5397 |
} = state; |
| 5398 |
const { |
| 5399 |
apply = () => { |
| 5400 |
}, |
| 5401 |
...detectOverflowOptions |
| 5402 |
} = evaluate(options, state); |
| 5403 |
const overflow = await platform3.detectOverflow(state, detectOverflowOptions); |
| 5404 |
const side = getSide(placement); |
| 5405 |
const alignment = getAlignment(placement); |
| 5406 |
const isYAxis = getSideAxis(placement) === "y"; |
| 5407 |
const { |
| 5408 |
width, |
| 5409 |
height |
| 5410 |
} = rects.floating; |
| 5411 |
let heightSide; |
| 5412 |
let widthSide; |
| 5413 |
if (side === "top" || side === "bottom") { |
| 5414 |
heightSide = side; |
| 5415 |
widthSide = alignment === (await (platform3.isRTL == null ? void 0 : platform3.isRTL(elements.floating)) ? "start" : "end") ? "left" : "right"; |
| 5416 |
} else { |
| 5417 |
widthSide = side; |
| 5418 |
heightSide = alignment === "end" ? "top" : "bottom"; |
| 5419 |
} |
| 5420 |
const maximumClippingHeight = height - overflow.top - overflow.bottom; |
| 5421 |
const maximumClippingWidth = width - overflow.left - overflow.right; |
| 5422 |
const overflowAvailableHeight = min(height - overflow[heightSide], maximumClippingHeight); |
| 5423 |
const overflowAvailableWidth = min(width - overflow[widthSide], maximumClippingWidth); |
| 5424 |
const noShift = !state.middlewareData.shift; |
| 5425 |
let availableHeight = overflowAvailableHeight; |
| 5426 |
let availableWidth = overflowAvailableWidth; |
| 5427 |
if ((_state$middlewareData = state.middlewareData.shift) != null && _state$middlewareData.enabled.x) { |
| 5428 |
availableWidth = maximumClippingWidth; |
| 5429 |
} |
| 5430 |
if ((_state$middlewareData2 = state.middlewareData.shift) != null && _state$middlewareData2.enabled.y) { |
| 5431 |
availableHeight = maximumClippingHeight; |
| 5432 |
} |
| 5433 |
if (noShift && !alignment) { |
| 5434 |
const xMin = max(overflow.left, 0); |
| 5435 |
const xMax = max(overflow.right, 0); |
| 5436 |
const yMin = max(overflow.top, 0); |
| 5437 |
const yMax = max(overflow.bottom, 0); |
| 5438 |
if (isYAxis) { |
| 5439 |
availableWidth = width - 2 * (xMin !== 0 || xMax !== 0 ? xMin + xMax : max(overflow.left, overflow.right)); |
| 5440 |
} else { |
| 5441 |
availableHeight = height - 2 * (yMin !== 0 || yMax !== 0 ? yMin + yMax : max(overflow.top, overflow.bottom)); |
| 5442 |
} |
| 5443 |
} |
| 5444 |
await apply({ |
| 5445 |
...state, |
| 5446 |
availableWidth, |
| 5447 |
availableHeight |
| 5448 |
}); |
| 5449 |
const nextDimensions = await platform3.getDimensions(elements.floating); |
| 5450 |
if (width !== nextDimensions.width || height !== nextDimensions.height) { |
| 5451 |
return { |
| 5452 |
reset: { |
| 5453 |
rects: true |
| 5454 |
} |
| 5455 |
}; |
| 5456 |
} |
| 5457 |
return {}; |
| 5458 |
} |
| 5459 |
}; |
| 5460 |
}; |
| 5461 |
|
| 5462 |
// node_modules/@floating-ui/dom/dist/floating-ui.dom.mjs |
| 5463 |
function getCssDimensions(element) { |
| 5464 |
const css = getComputedStyle2(element); |
| 5465 |
let width = parseFloat(css.width) || 0; |
| 5466 |
let height = parseFloat(css.height) || 0; |
| 5467 |
const hasOffset = isHTMLElement(element); |
| 5468 |
const offsetWidth = hasOffset ? element.offsetWidth : width; |
| 5469 |
const offsetHeight = hasOffset ? element.offsetHeight : height; |
| 5470 |
const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight; |
| 5471 |
if (shouldFallback) { |
| 5472 |
width = offsetWidth; |
| 5473 |
height = offsetHeight; |
| 5474 |
} |
| 5475 |
return { |
| 5476 |
width, |
| 5477 |
height, |
| 5478 |
$: shouldFallback |
| 5479 |
}; |
| 5480 |
} |
| 5481 |
function unwrapElement(element) { |
| 5482 |
return !isElement(element) ? element.contextElement : element; |
| 5483 |
} |
| 5484 |
function getScale(element) { |
| 5485 |
const domElement = unwrapElement(element); |
| 5486 |
if (!isHTMLElement(domElement)) { |
| 5487 |
return createCoords(1); |
| 5488 |
} |
| 5489 |
const rect = domElement.getBoundingClientRect(); |
| 5490 |
const { |
| 5491 |
width, |
| 5492 |
height, |
| 5493 |
$ |
| 5494 |
} = getCssDimensions(domElement); |
| 5495 |
let x = ($ ? round(rect.width) : rect.width) / width; |
| 5496 |
let y = ($ ? round(rect.height) : rect.height) / height; |
| 5497 |
if (!x || !Number.isFinite(x)) { |
| 5498 |
x = 1; |
| 5499 |
} |
| 5500 |
if (!y || !Number.isFinite(y)) { |
| 5501 |
y = 1; |
| 5502 |
} |
| 5503 |
return { |
| 5504 |
x, |
| 5505 |
y |
| 5506 |
}; |
| 5507 |
} |
| 5508 |
var noOffsets = /* @__PURE__ */ createCoords(0); |
| 5509 |
function getVisualOffsets(element) { |
| 5510 |
const win = getWindow(element); |
| 5511 |
if (!isWebKit() || !win.visualViewport) { |
| 5512 |
return noOffsets; |
| 5513 |
} |
| 5514 |
return { |
| 5515 |
x: win.visualViewport.offsetLeft, |
| 5516 |
y: win.visualViewport.offsetTop |
| 5517 |
}; |
| 5518 |
} |
| 5519 |
function shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) { |
| 5520 |
if (isFixed === void 0) { |
| 5521 |
isFixed = false; |
| 5522 |
} |
| 5523 |
if (!floatingOffsetParent || isFixed && floatingOffsetParent !== getWindow(element)) { |
| 5524 |
return false; |
| 5525 |
} |
| 5526 |
return isFixed; |
| 5527 |
} |
| 5528 |
function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) { |
| 5529 |
if (includeScale === void 0) { |
| 5530 |
includeScale = false; |
| 5531 |
} |
| 5532 |
if (isFixedStrategy === void 0) { |
| 5533 |
isFixedStrategy = false; |
| 5534 |
} |
| 5535 |
const clientRect = element.getBoundingClientRect(); |
| 5536 |
const domElement = unwrapElement(element); |
| 5537 |
let scale = createCoords(1); |
| 5538 |
if (includeScale) { |
| 5539 |
if (offsetParent) { |
| 5540 |
if (isElement(offsetParent)) { |
| 5541 |
scale = getScale(offsetParent); |
| 5542 |
} |
| 5543 |
} else { |
| 5544 |
scale = getScale(element); |
| 5545 |
} |
| 5546 |
} |
| 5547 |
const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : createCoords(0); |
| 5548 |
let x = (clientRect.left + visualOffsets.x) / scale.x; |
| 5549 |
let y = (clientRect.top + visualOffsets.y) / scale.y; |
| 5550 |
let width = clientRect.width / scale.x; |
| 5551 |
let height = clientRect.height / scale.y; |
| 5552 |
if (domElement) { |
| 5553 |
const win = getWindow(domElement); |
| 5554 |
const offsetWin = offsetParent && isElement(offsetParent) ? getWindow(offsetParent) : offsetParent; |
| 5555 |
let currentWin = win; |
| 5556 |
let currentIFrame = getFrameElement(currentWin); |
| 5557 |
while (currentIFrame && offsetParent && offsetWin !== currentWin) { |
| 5558 |
const iframeScale = getScale(currentIFrame); |
| 5559 |
const iframeRect = currentIFrame.getBoundingClientRect(); |
| 5560 |
const css = getComputedStyle2(currentIFrame); |
| 5561 |
const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x; |
| 5562 |
const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y; |
| 5563 |
x *= iframeScale.x; |
| 5564 |
y *= iframeScale.y; |
| 5565 |
width *= iframeScale.x; |
| 5566 |
height *= iframeScale.y; |
| 5567 |
x += left; |
| 5568 |
y += top; |
| 5569 |
currentWin = getWindow(currentIFrame); |
| 5570 |
currentIFrame = getFrameElement(currentWin); |
| 5571 |
} |
| 5572 |
} |
| 5573 |
return rectToClientRect({ |
| 5574 |
width, |
| 5575 |
height, |
| 5576 |
x, |
| 5577 |
y |
| 5578 |
}); |
| 5579 |
} |
| 5580 |
function getWindowScrollBarX(element, rect) { |
| 5581 |
const leftScroll = getNodeScroll(element).scrollLeft; |
| 5582 |
if (!rect) { |
| 5583 |
return getBoundingClientRect(getDocumentElement(element)).left + leftScroll; |
| 5584 |
} |
| 5585 |
return rect.left + leftScroll; |
| 5586 |
} |
| 5587 |
function getHTMLOffset(documentElement, scroll) { |
| 5588 |
const htmlRect = documentElement.getBoundingClientRect(); |
| 5589 |
const x = htmlRect.left + scroll.scrollLeft - getWindowScrollBarX(documentElement, htmlRect); |
| 5590 |
const y = htmlRect.top + scroll.scrollTop; |
| 5591 |
return { |
| 5592 |
x, |
| 5593 |
y |
| 5594 |
}; |
| 5595 |
} |
| 5596 |
function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) { |
| 5597 |
let { |
| 5598 |
elements, |
| 5599 |
rect, |
| 5600 |
offsetParent, |
| 5601 |
strategy |
| 5602 |
} = _ref; |
| 5603 |
const isFixed = strategy === "fixed"; |
| 5604 |
const documentElement = getDocumentElement(offsetParent); |
| 5605 |
const topLayer = elements ? isTopLayer(elements.floating) : false; |
| 5606 |
if (offsetParent === documentElement || topLayer && isFixed) { |
| 5607 |
return rect; |
| 5608 |
} |
| 5609 |
let scroll = { |
| 5610 |
scrollLeft: 0, |
| 5611 |
scrollTop: 0 |
| 5612 |
}; |
| 5613 |
let scale = createCoords(1); |
| 5614 |
const offsets = createCoords(0); |
| 5615 |
const isOffsetParentAnElement = isHTMLElement(offsetParent); |
| 5616 |
if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) { |
| 5617 |
if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) { |
| 5618 |
scroll = getNodeScroll(offsetParent); |
| 5619 |
} |
| 5620 |
if (isOffsetParentAnElement) { |
| 5621 |
const offsetRect = getBoundingClientRect(offsetParent); |
| 5622 |
scale = getScale(offsetParent); |
| 5623 |
offsets.x = offsetRect.x + offsetParent.clientLeft; |
| 5624 |
offsets.y = offsetRect.y + offsetParent.clientTop; |
| 5625 |
} |
| 5626 |
} |
| 5627 |
const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0); |
| 5628 |
return { |
| 5629 |
width: rect.width * scale.x, |
| 5630 |
height: rect.height * scale.y, |
| 5631 |
x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x + htmlOffset.x, |
| 5632 |
y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y + htmlOffset.y |
| 5633 |
}; |
| 5634 |
} |
| 5635 |
function getClientRects(element) { |
| 5636 |
return Array.from(element.getClientRects()); |
| 5637 |
} |
| 5638 |
function getDocumentRect(element) { |
| 5639 |
const html = getDocumentElement(element); |
| 5640 |
const scroll = getNodeScroll(element); |
| 5641 |
const body = element.ownerDocument.body; |
| 5642 |
const width = max(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth); |
| 5643 |
const height = max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight); |
| 5644 |
let x = -scroll.scrollLeft + getWindowScrollBarX(element); |
| 5645 |
const y = -scroll.scrollTop; |
| 5646 |
if (getComputedStyle2(body).direction === "rtl") { |
| 5647 |
x += max(html.clientWidth, body.clientWidth) - width; |
| 5648 |
} |
| 5649 |
return { |
| 5650 |
width, |
| 5651 |
height, |
| 5652 |
x, |
| 5653 |
y |
| 5654 |
}; |
| 5655 |
} |
| 5656 |
var SCROLLBAR_MAX = 25; |
| 5657 |
function getViewportRect(element, strategy) { |
| 5658 |
const win = getWindow(element); |
| 5659 |
const html = getDocumentElement(element); |
| 5660 |
const visualViewport = win.visualViewport; |
| 5661 |
let width = html.clientWidth; |
| 5662 |
let height = html.clientHeight; |
| 5663 |
let x = 0; |
| 5664 |
let y = 0; |
| 5665 |
if (visualViewport) { |
| 5666 |
width = visualViewport.width; |
| 5667 |
height = visualViewport.height; |
| 5668 |
const visualViewportBased = isWebKit(); |
| 5669 |
if (!visualViewportBased || visualViewportBased && strategy === "fixed") { |
| 5670 |
x = visualViewport.offsetLeft; |
| 5671 |
y = visualViewport.offsetTop; |
| 5672 |
} |
| 5673 |
} |
| 5674 |
const windowScrollbarX = getWindowScrollBarX(html); |
| 5675 |
if (windowScrollbarX <= 0) { |
| 5676 |
const doc = html.ownerDocument; |
| 5677 |
const body = doc.body; |
| 5678 |
const bodyStyles = getComputedStyle(body); |
| 5679 |
const bodyMarginInline = doc.compatMode === "CSS1Compat" ? parseFloat(bodyStyles.marginLeft) + parseFloat(bodyStyles.marginRight) || 0 : 0; |
| 5680 |
const clippingStableScrollbarWidth = Math.abs(html.clientWidth - body.clientWidth - bodyMarginInline); |
| 5681 |
if (clippingStableScrollbarWidth <= SCROLLBAR_MAX) { |
| 5682 |
width -= clippingStableScrollbarWidth; |
| 5683 |
} |
| 5684 |
} else if (windowScrollbarX <= SCROLLBAR_MAX) { |
| 5685 |
width += windowScrollbarX; |
| 5686 |
} |
| 5687 |
return { |
| 5688 |
width, |
| 5689 |
height, |
| 5690 |
x, |
| 5691 |
y |
| 5692 |
}; |
| 5693 |
} |
| 5694 |
function getInnerBoundingClientRect(element, strategy) { |
| 5695 |
const clientRect = getBoundingClientRect(element, true, strategy === "fixed"); |
| 5696 |
const top = clientRect.top + element.clientTop; |
| 5697 |
const left = clientRect.left + element.clientLeft; |
| 5698 |
const scale = isHTMLElement(element) ? getScale(element) : createCoords(1); |
| 5699 |
const width = element.clientWidth * scale.x; |
| 5700 |
const height = element.clientHeight * scale.y; |
| 5701 |
const x = left * scale.x; |
| 5702 |
const y = top * scale.y; |
| 5703 |
return { |
| 5704 |
width, |
| 5705 |
height, |
| 5706 |
x, |
| 5707 |
y |
| 5708 |
}; |
| 5709 |
} |
| 5710 |
function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) { |
| 5711 |
let rect; |
| 5712 |
if (clippingAncestor === "viewport") { |
| 5713 |
rect = getViewportRect(element, strategy); |
| 5714 |
} else if (clippingAncestor === "document") { |
| 5715 |
rect = getDocumentRect(getDocumentElement(element)); |
| 5716 |
} else if (isElement(clippingAncestor)) { |
| 5717 |
rect = getInnerBoundingClientRect(clippingAncestor, strategy); |
| 5718 |
} else { |
| 5719 |
const visualOffsets = getVisualOffsets(element); |
| 5720 |
rect = { |
| 5721 |
x: clippingAncestor.x - visualOffsets.x, |
| 5722 |
y: clippingAncestor.y - visualOffsets.y, |
| 5723 |
width: clippingAncestor.width, |
| 5724 |
height: clippingAncestor.height |
| 5725 |
}; |
| 5726 |
} |
| 5727 |
return rectToClientRect(rect); |
| 5728 |
} |
| 5729 |
function hasFixedPositionAncestor(element, stopNode) { |
| 5730 |
const parentNode = getParentNode(element); |
| 5731 |
if (parentNode === stopNode || !isElement(parentNode) || isLastTraversableNode(parentNode)) { |
| 5732 |
return false; |
| 5733 |
} |
| 5734 |
return getComputedStyle2(parentNode).position === "fixed" || hasFixedPositionAncestor(parentNode, stopNode); |
| 5735 |
} |
| 5736 |
function getClippingElementAncestors(element, cache) { |
| 5737 |
const cachedResult = cache.get(element); |
| 5738 |
if (cachedResult) { |
| 5739 |
return cachedResult; |
| 5740 |
} |
| 5741 |
let result = getOverflowAncestors(element, [], false).filter((el) => isElement(el) && getNodeName(el) !== "body"); |
| 5742 |
let currentContainingBlockComputedStyle = null; |
| 5743 |
const elementIsFixed = getComputedStyle2(element).position === "fixed"; |
| 5744 |
let currentNode = elementIsFixed ? getParentNode(element) : element; |
| 5745 |
while (isElement(currentNode) && !isLastTraversableNode(currentNode)) { |
| 5746 |
const computedStyle = getComputedStyle2(currentNode); |
| 5747 |
const currentNodeIsContaining = isContainingBlock(currentNode); |
| 5748 |
if (!currentNodeIsContaining && computedStyle.position === "fixed") { |
| 5749 |
currentContainingBlockComputedStyle = null; |
| 5750 |
} |
| 5751 |
const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === "static" && !!currentContainingBlockComputedStyle && (currentContainingBlockComputedStyle.position === "absolute" || currentContainingBlockComputedStyle.position === "fixed") || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode); |
| 5752 |
if (shouldDropCurrentNode) { |
| 5753 |
result = result.filter((ancestor) => ancestor !== currentNode); |
| 5754 |
} else { |
| 5755 |
currentContainingBlockComputedStyle = computedStyle; |
| 5756 |
} |
| 5757 |
currentNode = getParentNode(currentNode); |
| 5758 |
} |
| 5759 |
cache.set(element, result); |
| 5760 |
return result; |
| 5761 |
} |
| 5762 |
function getClippingRect(_ref) { |
| 5763 |
let { |
| 5764 |
element, |
| 5765 |
boundary, |
| 5766 |
rootBoundary, |
| 5767 |
strategy |
| 5768 |
} = _ref; |
| 5769 |
const elementClippingAncestors = boundary === "clippingAncestors" ? isTopLayer(element) ? [] : getClippingElementAncestors(element, this._c) : [].concat(boundary); |
| 5770 |
const clippingAncestors = [...elementClippingAncestors, rootBoundary]; |
| 5771 |
const firstRect = getClientRectFromClippingAncestor(element, clippingAncestors[0], strategy); |
| 5772 |
let top = firstRect.top; |
| 5773 |
let right = firstRect.right; |
| 5774 |
let bottom = firstRect.bottom; |
| 5775 |
let left = firstRect.left; |
| 5776 |
for (let i = 1; i < clippingAncestors.length; i++) { |
| 5777 |
const rect = getClientRectFromClippingAncestor(element, clippingAncestors[i], strategy); |
| 5778 |
top = max(rect.top, top); |
| 5779 |
right = min(rect.right, right); |
| 5780 |
bottom = min(rect.bottom, bottom); |
| 5781 |
left = max(rect.left, left); |
| 5782 |
} |
| 5783 |
return { |
| 5784 |
width: right - left, |
| 5785 |
height: bottom - top, |
| 5786 |
x: left, |
| 5787 |
y: top |
| 5788 |
}; |
| 5789 |
} |
| 5790 |
function getDimensions(element) { |
| 5791 |
const { |
| 5792 |
width, |
| 5793 |
height |
| 5794 |
} = getCssDimensions(element); |
| 5795 |
return { |
| 5796 |
width, |
| 5797 |
height |
| 5798 |
}; |
| 5799 |
} |
| 5800 |
function getRectRelativeToOffsetParent(element, offsetParent, strategy) { |
| 5801 |
const isOffsetParentAnElement = isHTMLElement(offsetParent); |
| 5802 |
const documentElement = getDocumentElement(offsetParent); |
| 5803 |
const isFixed = strategy === "fixed"; |
| 5804 |
const rect = getBoundingClientRect(element, true, isFixed, offsetParent); |
| 5805 |
let scroll = { |
| 5806 |
scrollLeft: 0, |
| 5807 |
scrollTop: 0 |
| 5808 |
}; |
| 5809 |
const offsets = createCoords(0); |
| 5810 |
function setLeftRTLScrollbarOffset() { |
| 5811 |
offsets.x = getWindowScrollBarX(documentElement); |
| 5812 |
} |
| 5813 |
if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) { |
| 5814 |
if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) { |
| 5815 |
scroll = getNodeScroll(offsetParent); |
| 5816 |
} |
| 5817 |
if (isOffsetParentAnElement) { |
| 5818 |
const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent); |
| 5819 |
offsets.x = offsetRect.x + offsetParent.clientLeft; |
| 5820 |
offsets.y = offsetRect.y + offsetParent.clientTop; |
| 5821 |
} else if (documentElement) { |
| 5822 |
setLeftRTLScrollbarOffset(); |
| 5823 |
} |
| 5824 |
} |
| 5825 |
if (isFixed && !isOffsetParentAnElement && documentElement) { |
| 5826 |
setLeftRTLScrollbarOffset(); |
| 5827 |
} |
| 5828 |
const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0); |
| 5829 |
const x = rect.left + scroll.scrollLeft - offsets.x - htmlOffset.x; |
| 5830 |
const y = rect.top + scroll.scrollTop - offsets.y - htmlOffset.y; |
| 5831 |
return { |
| 5832 |
x, |
| 5833 |
y, |
| 5834 |
width: rect.width, |
| 5835 |
height: rect.height |
| 5836 |
}; |
| 5837 |
} |
| 5838 |
function isStaticPositioned(element) { |
| 5839 |
return getComputedStyle2(element).position === "static"; |
| 5840 |
} |
| 5841 |
function getTrueOffsetParent(element, polyfill) { |
| 5842 |
if (!isHTMLElement(element) || getComputedStyle2(element).position === "fixed") { |
| 5843 |
return null; |
| 5844 |
} |
| 5845 |
if (polyfill) { |
| 5846 |
return polyfill(element); |
| 5847 |
} |
| 5848 |
let rawOffsetParent = element.offsetParent; |
| 5849 |
if (getDocumentElement(element) === rawOffsetParent) { |
| 5850 |
rawOffsetParent = rawOffsetParent.ownerDocument.body; |
| 5851 |
} |
| 5852 |
return rawOffsetParent; |
| 5853 |
} |
| 5854 |
function getOffsetParent(element, polyfill) { |
| 5855 |
const win = getWindow(element); |
| 5856 |
if (isTopLayer(element)) { |
| 5857 |
return win; |
| 5858 |
} |
| 5859 |
if (!isHTMLElement(element)) { |
| 5860 |
let svgOffsetParent = getParentNode(element); |
| 5861 |
while (svgOffsetParent && !isLastTraversableNode(svgOffsetParent)) { |
| 5862 |
if (isElement(svgOffsetParent) && !isStaticPositioned(svgOffsetParent)) { |
| 5863 |
return svgOffsetParent; |
| 5864 |
} |
| 5865 |
svgOffsetParent = getParentNode(svgOffsetParent); |
| 5866 |
} |
| 5867 |
return win; |
| 5868 |
} |
| 5869 |
let offsetParent = getTrueOffsetParent(element, polyfill); |
| 5870 |
while (offsetParent && isTableElement(offsetParent) && isStaticPositioned(offsetParent)) { |
| 5871 |
offsetParent = getTrueOffsetParent(offsetParent, polyfill); |
| 5872 |
} |
| 5873 |
if (offsetParent && isLastTraversableNode(offsetParent) && isStaticPositioned(offsetParent) && !isContainingBlock(offsetParent)) { |
| 5874 |
return win; |
| 5875 |
} |
| 5876 |
return offsetParent || getContainingBlock(element) || win; |
| 5877 |
} |
| 5878 |
var getElementRects = async function(data) { |
| 5879 |
const getOffsetParentFn = this.getOffsetParent || getOffsetParent; |
| 5880 |
const getDimensionsFn = this.getDimensions; |
| 5881 |
const floatingDimensions = await getDimensionsFn(data.floating); |
| 5882 |
return { |
| 5883 |
reference: getRectRelativeToOffsetParent(data.reference, await getOffsetParentFn(data.floating), data.strategy), |
| 5884 |
floating: { |
| 5885 |
x: 0, |
| 5886 |
y: 0, |
| 5887 |
width: floatingDimensions.width, |
| 5888 |
height: floatingDimensions.height |
| 5889 |
} |
| 5890 |
}; |
| 5891 |
}; |
| 5892 |
function isRTL(element) { |
| 5893 |
return getComputedStyle2(element).direction === "rtl"; |
| 5894 |
} |
| 5895 |
var platform2 = { |
| 5896 |
convertOffsetParentRelativeRectToViewportRelativeRect, |
| 5897 |
getDocumentElement, |
| 5898 |
getClippingRect, |
| 5899 |
getOffsetParent, |
| 5900 |
getElementRects, |
| 5901 |
getClientRects, |
| 5902 |
getDimensions, |
| 5903 |
getScale, |
| 5904 |
isElement, |
| 5905 |
isRTL |
| 5906 |
}; |
| 5907 |
function rectsAreEqual(a, b) { |
| 5908 |
return a.x === b.x && a.y === b.y && a.width === b.width && a.height === b.height; |
| 5909 |
} |
| 5910 |
function observeMove(element, onMove) { |
| 5911 |
let io = null; |
| 5912 |
let timeoutId; |
| 5913 |
const root = getDocumentElement(element); |
| 5914 |
function cleanup() { |
| 5915 |
var _io; |
| 5916 |
clearTimeout(timeoutId); |
| 5917 |
(_io = io) == null || _io.disconnect(); |
| 5918 |
io = null; |
| 5919 |
} |
| 5920 |
function refresh(skip, threshold) { |
| 5921 |
if (skip === void 0) { |
| 5922 |
skip = false; |
| 5923 |
} |
| 5924 |
if (threshold === void 0) { |
| 5925 |
threshold = 1; |
| 5926 |
} |
| 5927 |
cleanup(); |
| 5928 |
const elementRectForRootMargin = element.getBoundingClientRect(); |
| 5929 |
const { |
| 5930 |
left, |
| 5931 |
top, |
| 5932 |
width, |
| 5933 |
height |
| 5934 |
} = elementRectForRootMargin; |
| 5935 |
if (!skip) { |
| 5936 |
onMove(); |
| 5937 |
} |
| 5938 |
if (!width || !height) { |
| 5939 |
return; |
| 5940 |
} |
| 5941 |
const insetTop = floor(top); |
| 5942 |
const insetRight = floor(root.clientWidth - (left + width)); |
| 5943 |
const insetBottom = floor(root.clientHeight - (top + height)); |
| 5944 |
const insetLeft = floor(left); |
| 5945 |
const rootMargin = -insetTop + "px " + -insetRight + "px " + -insetBottom + "px " + -insetLeft + "px"; |
| 5946 |
const options = { |
| 5947 |
rootMargin, |
| 5948 |
threshold: max(0, min(1, threshold)) || 1 |
| 5949 |
}; |
| 5950 |
let isFirstUpdate = true; |
| 5951 |
function handleObserve(entries) { |
| 5952 |
const ratio = entries[0].intersectionRatio; |
| 5953 |
if (ratio !== threshold) { |
| 5954 |
if (!isFirstUpdate) { |
| 5955 |
return refresh(); |
| 5956 |
} |
| 5957 |
if (!ratio) { |
| 5958 |
timeoutId = setTimeout(() => { |
| 5959 |
refresh(false, 1e-7); |
| 5960 |
}, 1e3); |
| 5961 |
} else { |
| 5962 |
refresh(false, ratio); |
| 5963 |
} |
| 5964 |
} |
| 5965 |
if (ratio === 1 && !rectsAreEqual(elementRectForRootMargin, element.getBoundingClientRect())) { |
| 5966 |
refresh(); |
| 5967 |
} |
| 5968 |
isFirstUpdate = false; |
| 5969 |
} |
| 5970 |
try { |
| 5971 |
io = new IntersectionObserver(handleObserve, { |
| 5972 |
...options, |
| 5973 |
// Handle <iframe>s |
| 5974 |
root: root.ownerDocument |
| 5975 |
}); |
| 5976 |
} catch (_e) { |
| 5977 |
io = new IntersectionObserver(handleObserve, options); |
| 5978 |
} |
| 5979 |
io.observe(element); |
| 5980 |
} |
| 5981 |
refresh(true); |
| 5982 |
return cleanup; |
| 5983 |
} |
| 5984 |
function autoUpdate(reference, floating, update2, options) { |
| 5985 |
if (options === void 0) { |
| 5986 |
options = {}; |
| 5987 |
} |
| 5988 |
const { |
| 5989 |
ancestorScroll = true, |
| 5990 |
ancestorResize = true, |
| 5991 |
elementResize = typeof ResizeObserver === "function", |
| 5992 |
layoutShift = typeof IntersectionObserver === "function", |
| 5993 |
animationFrame = false |
| 5994 |
} = options; |
| 5995 |
const referenceEl = unwrapElement(reference); |
| 5996 |
const ancestors = ancestorScroll || ancestorResize ? [...referenceEl ? getOverflowAncestors(referenceEl) : [], ...floating ? getOverflowAncestors(floating) : []] : []; |
| 5997 |
ancestors.forEach((ancestor) => { |
| 5998 |
ancestorScroll && ancestor.addEventListener("scroll", update2, { |
| 5999 |
passive: true |
| 6000 |
}); |
| 6001 |
ancestorResize && ancestor.addEventListener("resize", update2); |
| 6002 |
}); |
| 6003 |
const cleanupIo = referenceEl && layoutShift ? observeMove(referenceEl, update2) : null; |
| 6004 |
let reobserveFrame = -1; |
| 6005 |
let resizeObserver = null; |
| 6006 |
if (elementResize) { |
| 6007 |
resizeObserver = new ResizeObserver((_ref) => { |
| 6008 |
let [firstEntry] = _ref; |
| 6009 |
if (firstEntry && firstEntry.target === referenceEl && resizeObserver && floating) { |
| 6010 |
resizeObserver.unobserve(floating); |
| 6011 |
cancelAnimationFrame(reobserveFrame); |
| 6012 |
reobserveFrame = requestAnimationFrame(() => { |
| 6013 |
var _resizeObserver; |
| 6014 |
(_resizeObserver = resizeObserver) == null || _resizeObserver.observe(floating); |
| 6015 |
}); |
| 6016 |
} |
| 6017 |
update2(); |
| 6018 |
}); |
| 6019 |
if (referenceEl && !animationFrame) { |
| 6020 |
resizeObserver.observe(referenceEl); |
| 6021 |
} |
| 6022 |
if (floating) { |
| 6023 |
resizeObserver.observe(floating); |
| 6024 |
} |
| 6025 |
} |
| 6026 |
let frameId; |
| 6027 |
let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null; |
| 6028 |
if (animationFrame) { |
| 6029 |
frameLoop(); |
| 6030 |
} |
| 6031 |
function frameLoop() { |
| 6032 |
const nextRefRect = getBoundingClientRect(reference); |
| 6033 |
if (prevRefRect && !rectsAreEqual(prevRefRect, nextRefRect)) { |
| 6034 |
update2(); |
| 6035 |
} |
| 6036 |
prevRefRect = nextRefRect; |
| 6037 |
frameId = requestAnimationFrame(frameLoop); |
| 6038 |
} |
| 6039 |
update2(); |
| 6040 |
return () => { |
| 6041 |
var _resizeObserver2; |
| 6042 |
ancestors.forEach((ancestor) => { |
| 6043 |
ancestorScroll && ancestor.removeEventListener("scroll", update2); |
| 6044 |
ancestorResize && ancestor.removeEventListener("resize", update2); |
| 6045 |
}); |
| 6046 |
cleanupIo == null || cleanupIo(); |
| 6047 |
(_resizeObserver2 = resizeObserver) == null || _resizeObserver2.disconnect(); |
| 6048 |
resizeObserver = null; |
| 6049 |
if (animationFrame) { |
| 6050 |
cancelAnimationFrame(frameId); |
| 6051 |
} |
| 6052 |
}; |
| 6053 |
} |
| 6054 |
var offset2 = offset; |
| 6055 |
var shift2 = shift; |
| 6056 |
var flip2 = flip; |
| 6057 |
var size2 = size; |
| 6058 |
var hide2 = hide; |
| 6059 |
var limitShift2 = limitShift; |
| 6060 |
var computePosition2 = (reference, floating, options) => { |
| 6061 |
const cache = /* @__PURE__ */ new Map(); |
| 6062 |
const mergedOptions = { |
| 6063 |
platform: platform2, |
| 6064 |
...options |
| 6065 |
}; |
| 6066 |
const platformWithCache = { |
| 6067 |
...mergedOptions.platform, |
| 6068 |
_c: cache |
| 6069 |
}; |
| 6070 |
return computePosition(reference, floating, { |
| 6071 |
...mergedOptions, |
| 6072 |
platform: platformWithCache |
| 6073 |
}); |
| 6074 |
}; |
| 6075 |
|
| 6076 |
// node_modules/@base-ui/react/node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.mjs |
| 6077 |
var React28 = __toESM(require_react(), 1); |
| 6078 |
var import_react2 = __toESM(require_react(), 1); |
| 6079 |
var ReactDOM3 = __toESM(require_react_dom(), 1); |
| 6080 |
var isClient = typeof document !== "undefined"; |
| 6081 |
var noop2 = function noop3() { |
| 6082 |
}; |
| 6083 |
var index = isClient ? import_react2.useLayoutEffect : noop2; |
| 6084 |
function deepEqual(a, b) { |
| 6085 |
if (a === b) { |
| 6086 |
return true; |
| 6087 |
} |
| 6088 |
if (typeof a !== typeof b) { |
| 6089 |
return false; |
| 6090 |
} |
| 6091 |
if (typeof a === "function" && a.toString() === b.toString()) { |
| 6092 |
return true; |
| 6093 |
} |
| 6094 |
let length; |
| 6095 |
let i; |
| 6096 |
let keys; |
| 6097 |
if (a && b && typeof a === "object") { |
| 6098 |
if (Array.isArray(a)) { |
| 6099 |
length = a.length; |
| 6100 |
if (length !== b.length) return false; |
| 6101 |
for (i = length; i-- !== 0; ) { |
| 6102 |
if (!deepEqual(a[i], b[i])) { |
| 6103 |
return false; |
| 6104 |
} |
| 6105 |
} |
| 6106 |
return true; |
| 6107 |
} |
| 6108 |
keys = Object.keys(a); |
| 6109 |
length = keys.length; |
| 6110 |
if (length !== Object.keys(b).length) { |
| 6111 |
return false; |
| 6112 |
} |
| 6113 |
for (i = length; i-- !== 0; ) { |
| 6114 |
if (!{}.hasOwnProperty.call(b, keys[i])) { |
| 6115 |
return false; |
| 6116 |
} |
| 6117 |
} |
| 6118 |
for (i = length; i-- !== 0; ) { |
| 6119 |
const key = keys[i]; |
| 6120 |
if (key === "_owner" && a.$$typeof) { |
| 6121 |
continue; |
| 6122 |
} |
| 6123 |
if (!deepEqual(a[key], b[key])) { |
| 6124 |
return false; |
| 6125 |
} |
| 6126 |
} |
| 6127 |
return true; |
| 6128 |
} |
| 6129 |
return a !== a && b !== b; |
| 6130 |
} |
| 6131 |
function getDPR(element) { |
| 6132 |
if (typeof window === "undefined") { |
| 6133 |
return 1; |
| 6134 |
} |
| 6135 |
const win = element.ownerDocument.defaultView || window; |
| 6136 |
return win.devicePixelRatio || 1; |
| 6137 |
} |
| 6138 |
function roundByDPR(element, value) { |
| 6139 |
const dpr = getDPR(element); |
| 6140 |
return Math.round(value * dpr) / dpr; |
| 6141 |
} |
| 6142 |
function useLatestRef(value) { |
| 6143 |
const ref = React28.useRef(value); |
| 6144 |
index(() => { |
| 6145 |
ref.current = value; |
| 6146 |
}); |
| 6147 |
return ref; |
| 6148 |
} |
| 6149 |
function useFloating(options) { |
| 6150 |
if (options === void 0) { |
| 6151 |
options = {}; |
| 6152 |
} |
| 6153 |
const { |
| 6154 |
placement = "bottom", |
| 6155 |
strategy = "absolute", |
| 6156 |
middleware = [], |
| 6157 |
platform: platform3, |
| 6158 |
elements: { |
| 6159 |
reference: externalReference, |
| 6160 |
floating: externalFloating |
| 6161 |
} = {}, |
| 6162 |
transform = true, |
| 6163 |
whileElementsMounted, |
| 6164 |
open |
| 6165 |
} = options; |
| 6166 |
const [data, setData] = React28.useState({ |
| 6167 |
x: 0, |
| 6168 |
y: 0, |
| 6169 |
strategy, |
| 6170 |
placement, |
| 6171 |
middlewareData: {}, |
| 6172 |
isPositioned: false |
| 6173 |
}); |
| 6174 |
const [latestMiddleware, setLatestMiddleware] = React28.useState(middleware); |
| 6175 |
if (!deepEqual(latestMiddleware, middleware)) { |
| 6176 |
setLatestMiddleware(middleware); |
| 6177 |
} |
| 6178 |
const [_reference, _setReference] = React28.useState(null); |
| 6179 |
const [_floating, _setFloating] = React28.useState(null); |
| 6180 |
const setReference = React28.useCallback((node) => { |
| 6181 |
if (node !== referenceRef.current) { |
| 6182 |
referenceRef.current = node; |
| 6183 |
_setReference(node); |
| 6184 |
} |
| 6185 |
}, []); |
| 6186 |
const setFloating = React28.useCallback((node) => { |
| 6187 |
if (node !== floatingRef.current) { |
| 6188 |
floatingRef.current = node; |
| 6189 |
_setFloating(node); |
| 6190 |
} |
| 6191 |
}, []); |
| 6192 |
const referenceEl = externalReference || _reference; |
| 6193 |
const floatingEl = externalFloating || _floating; |
| 6194 |
const referenceRef = React28.useRef(null); |
| 6195 |
const floatingRef = React28.useRef(null); |
| 6196 |
const dataRef = React28.useRef(data); |
| 6197 |
const hasWhileElementsMounted = whileElementsMounted != null; |
| 6198 |
const whileElementsMountedRef = useLatestRef(whileElementsMounted); |
| 6199 |
const platformRef = useLatestRef(platform3); |
| 6200 |
const openRef = useLatestRef(open); |
| 6201 |
const update2 = React28.useCallback(() => { |
| 6202 |
if (!referenceRef.current || !floatingRef.current) { |
| 6203 |
return; |
| 6204 |
} |
| 6205 |
const config = { |
| 6206 |
placement, |
| 6207 |
strategy, |
| 6208 |
middleware: latestMiddleware |
| 6209 |
}; |
| 6210 |
if (platformRef.current) { |
| 6211 |
config.platform = platformRef.current; |
| 6212 |
} |
| 6213 |
computePosition2(referenceRef.current, floatingRef.current, config).then((data2) => { |
| 6214 |
const fullData = { |
| 6215 |
...data2, |
| 6216 |
// The floating element's position may be recomputed while it's closed |
| 6217 |
// but still mounted (such as when transitioning out). To ensure |
| 6218 |
// `isPositioned` will be `false` initially on the next open, avoid |
| 6219 |
// setting it to `true` when `open === false` (must be specified). |
| 6220 |
isPositioned: openRef.current !== false |
| 6221 |
}; |
| 6222 |
if (isMountedRef.current && !deepEqual(dataRef.current, fullData)) { |
| 6223 |
dataRef.current = fullData; |
| 6224 |
ReactDOM3.flushSync(() => { |
| 6225 |
setData(fullData); |
| 6226 |
}); |
| 6227 |
} |
| 6228 |
}); |
| 6229 |
}, [latestMiddleware, placement, strategy, platformRef, openRef]); |
| 6230 |
index(() => { |
| 6231 |
if (open === false && dataRef.current.isPositioned) { |
| 6232 |
dataRef.current.isPositioned = false; |
| 6233 |
setData((data2) => ({ |
| 6234 |
...data2, |
| 6235 |
isPositioned: false |
| 6236 |
})); |
| 6237 |
} |
| 6238 |
}, [open]); |
| 6239 |
const isMountedRef = React28.useRef(false); |
| 6240 |
index(() => { |
| 6241 |
isMountedRef.current = true; |
| 6242 |
return () => { |
| 6243 |
isMountedRef.current = false; |
| 6244 |
}; |
| 6245 |
}, []); |
| 6246 |
index(() => { |
| 6247 |
if (referenceEl) referenceRef.current = referenceEl; |
| 6248 |
if (floatingEl) floatingRef.current = floatingEl; |
| 6249 |
if (referenceEl && floatingEl) { |
| 6250 |
if (whileElementsMountedRef.current) { |
| 6251 |
return whileElementsMountedRef.current(referenceEl, floatingEl, update2); |
| 6252 |
} |
| 6253 |
update2(); |
| 6254 |
} |
| 6255 |
}, [referenceEl, floatingEl, update2, whileElementsMountedRef, hasWhileElementsMounted]); |
| 6256 |
const refs = React28.useMemo(() => ({ |
| 6257 |
reference: referenceRef, |
| 6258 |
floating: floatingRef, |
| 6259 |
setReference, |
| 6260 |
setFloating |
| 6261 |
}), [setReference, setFloating]); |
| 6262 |
const elements = React28.useMemo(() => ({ |
| 6263 |
reference: referenceEl, |
| 6264 |
floating: floatingEl |
| 6265 |
}), [referenceEl, floatingEl]); |
| 6266 |
const floatingStyles = React28.useMemo(() => { |
| 6267 |
const initialStyles = { |
| 6268 |
position: strategy, |
| 6269 |
left: 0, |
| 6270 |
top: 0 |
| 6271 |
}; |
| 6272 |
if (!elements.floating) { |
| 6273 |
return initialStyles; |
| 6274 |
} |
| 6275 |
const x = roundByDPR(elements.floating, data.x); |
| 6276 |
const y = roundByDPR(elements.floating, data.y); |
| 6277 |
if (transform) { |
| 6278 |
return { |
| 6279 |
...initialStyles, |
| 6280 |
transform: "translate(" + x + "px, " + y + "px)", |
| 6281 |
...getDPR(elements.floating) >= 1.5 && { |
| 6282 |
willChange: "transform" |
| 6283 |
} |
| 6284 |
}; |
| 6285 |
} |
| 6286 |
return { |
| 6287 |
position: strategy, |
| 6288 |
left: x, |
| 6289 |
top: y |
| 6290 |
}; |
| 6291 |
}, [strategy, transform, elements.floating, data.x, data.y]); |
| 6292 |
return React28.useMemo(() => ({ |
| 6293 |
...data, |
| 6294 |
update: update2, |
| 6295 |
refs, |
| 6296 |
elements, |
| 6297 |
floatingStyles |
| 6298 |
}), [data, update2, refs, elements, floatingStyles]); |
| 6299 |
} |
| 6300 |
var offset3 = (options, deps) => { |
| 6301 |
const result = offset2(options); |
| 6302 |
return { |
| 6303 |
name: result.name, |
| 6304 |
fn: result.fn, |
| 6305 |
options: [options, deps] |
| 6306 |
}; |
| 6307 |
}; |
| 6308 |
var shift3 = (options, deps) => { |
| 6309 |
const result = shift2(options); |
| 6310 |
return { |
| 6311 |
name: result.name, |
| 6312 |
fn: result.fn, |
| 6313 |
options: [options, deps] |
| 6314 |
}; |
| 6315 |
}; |
| 6316 |
var limitShift3 = (options, deps) => { |
| 6317 |
const result = limitShift2(options); |
| 6318 |
return { |
| 6319 |
fn: result.fn, |
| 6320 |
options: [options, deps] |
| 6321 |
}; |
| 6322 |
}; |
| 6323 |
var flip3 = (options, deps) => { |
| 6324 |
const result = flip2(options); |
| 6325 |
return { |
| 6326 |
name: result.name, |
| 6327 |
fn: result.fn, |
| 6328 |
options: [options, deps] |
| 6329 |
}; |
| 6330 |
}; |
| 6331 |
var size3 = (options, deps) => { |
| 6332 |
const result = size2(options); |
| 6333 |
return { |
| 6334 |
name: result.name, |
| 6335 |
fn: result.fn, |
| 6336 |
options: [options, deps] |
| 6337 |
}; |
| 6338 |
}; |
| 6339 |
var hide3 = (options, deps) => { |
| 6340 |
const result = hide2(options); |
| 6341 |
return { |
| 6342 |
name: result.name, |
| 6343 |
fn: result.fn, |
| 6344 |
options: [options, deps] |
| 6345 |
}; |
| 6346 |
}; |
| 6347 |
|
| 6348 |
// node_modules/@base-ui/react/esm/utils/popups/popupStoreUtils.js |
| 6349 |
var React33 = __toESM(require_react(), 1); |
| 6350 |
|
| 6351 |
// node_modules/@base-ui/react/esm/floating-ui-react/hooks/useSyncedFloatingRootContext.js |
| 6352 |
var React32 = __toESM(require_react(), 1); |
| 6353 |
|
| 6354 |
// node_modules/@base-ui/utils/esm/store/createSelector.js |
| 6355 |
var createSelector = (a, b, c, d, e, f, ...other) => { |
| 6356 |
if (other.length > 0) { |
| 6357 |
throw new Error(true ? "Unsupported number of selectors" : formatErrorMessage_default(1)); |
| 6358 |
} |
| 6359 |
let selector; |
| 6360 |
if (a && b && c && d && e && f) { |
| 6361 |
selector = (state, a1, a2, a3) => { |
| 6362 |
const va = a(state, a1, a2, a3); |
| 6363 |
const vb = b(state, a1, a2, a3); |
| 6364 |
const vc = c(state, a1, a2, a3); |
| 6365 |
const vd = d(state, a1, a2, a3); |
| 6366 |
const ve = e(state, a1, a2, a3); |
| 6367 |
return f(va, vb, vc, vd, ve, a1, a2, a3); |
| 6368 |
}; |
| 6369 |
} else if (a && b && c && d && e) { |
| 6370 |
selector = (state, a1, a2, a3) => { |
| 6371 |
const va = a(state, a1, a2, a3); |
| 6372 |
const vb = b(state, a1, a2, a3); |
| 6373 |
const vc = c(state, a1, a2, a3); |
| 6374 |
const vd = d(state, a1, a2, a3); |
| 6375 |
return e(va, vb, vc, vd, a1, a2, a3); |
| 6376 |
}; |
| 6377 |
} else if (a && b && c && d) { |
| 6378 |
selector = (state, a1, a2, a3) => { |
| 6379 |
const va = a(state, a1, a2, a3); |
| 6380 |
const vb = b(state, a1, a2, a3); |
| 6381 |
const vc = c(state, a1, a2, a3); |
| 6382 |
return d(va, vb, vc, a1, a2, a3); |
| 6383 |
}; |
| 6384 |
} else if (a && b && c) { |
| 6385 |
selector = (state, a1, a2, a3) => { |
| 6386 |
const va = a(state, a1, a2, a3); |
| 6387 |
const vb = b(state, a1, a2, a3); |
| 6388 |
return c(va, vb, a1, a2, a3); |
| 6389 |
}; |
| 6390 |
} else if (a && b) { |
| 6391 |
selector = (state, a1, a2, a3) => { |
| 6392 |
const va = a(state, a1, a2, a3); |
| 6393 |
return b(va, a1, a2, a3); |
| 6394 |
}; |
| 6395 |
} else if (a) { |
| 6396 |
selector = a; |
| 6397 |
} else { |
| 6398 |
throw ( |
| 6399 |
/* minify-error-disabled */ |
| 6400 |
new Error("Missing arguments") |
| 6401 |
); |
| 6402 |
} |
| 6403 |
return selector; |
| 6404 |
}; |
| 6405 |
|
| 6406 |
// node_modules/@base-ui/utils/esm/store/useStore.js |
| 6407 |
var React30 = __toESM(require_react(), 1); |
| 6408 |
var import_shim = __toESM(require_shim(), 1); |
| 6409 |
var import_with_selector = __toESM(require_with_selector(), 1); |
| 6410 |
|
| 6411 |
// node_modules/@base-ui/utils/esm/fastHooks.js |
| 6412 |
var React29 = __toESM(require_react(), 1); |
| 6413 |
var hooks = []; |
| 6414 |
var currentInstance = void 0; |
| 6415 |
function getInstance() { |
| 6416 |
return currentInstance; |
| 6417 |
} |
| 6418 |
function register(hook) { |
| 6419 |
hooks.push(hook); |
| 6420 |
} |
| 6421 |
function fastComponent(fn) { |
| 6422 |
const FastComponent = (props, forwardedRef) => { |
| 6423 |
const instance = useRefWithInit(createInstance).current; |
| 6424 |
let result; |
| 6425 |
try { |
| 6426 |
currentInstance = instance; |
| 6427 |
for (const hook of hooks) { |
| 6428 |
hook.before(instance); |
| 6429 |
} |
| 6430 |
result = fn(props, forwardedRef); |
| 6431 |
for (const hook of hooks) { |
| 6432 |
hook.after(instance); |
| 6433 |
} |
| 6434 |
instance.didInitialize = true; |
| 6435 |
} finally { |
| 6436 |
currentInstance = void 0; |
| 6437 |
} |
| 6438 |
return result; |
| 6439 |
}; |
| 6440 |
FastComponent.displayName = fn.displayName || fn.name; |
| 6441 |
return FastComponent; |
| 6442 |
} |
| 6443 |
function fastComponentRef(fn) { |
| 6444 |
return /* @__PURE__ */ React29.forwardRef(fastComponent(fn)); |
| 6445 |
} |
| 6446 |
function createInstance() { |
| 6447 |
return { |
| 6448 |
didInitialize: false |
| 6449 |
}; |
| 6450 |
} |
| 6451 |
|
| 6452 |
// node_modules/@base-ui/utils/esm/store/useStore.js |
| 6453 |
var canUseRawUseSyncExternalStore = isReactVersionAtLeast(19); |
| 6454 |
var useStoreImplementation = canUseRawUseSyncExternalStore ? useStoreFast : useStoreLegacy; |
| 6455 |
function useStore(store, selector, a1, a2, a3) { |
| 6456 |
return useStoreImplementation(store, selector, a1, a2, a3); |
| 6457 |
} |
| 6458 |
function useStoreR19(store, selector, a1, a2, a3) { |
| 6459 |
const getSelection = React30.useCallback(() => selector(store.getSnapshot(), a1, a2, a3), [store, selector, a1, a2, a3]); |
| 6460 |
return (0, import_shim.useSyncExternalStore)(store.subscribe, getSelection, getSelection); |
| 6461 |
} |
| 6462 |
register({ |
| 6463 |
before(instance) { |
| 6464 |
instance.syncIndex = 0; |
| 6465 |
if (!instance.didInitialize) { |
| 6466 |
instance.syncTick = 1; |
| 6467 |
instance.syncHooks = []; |
| 6468 |
instance.didChangeStore = true; |
| 6469 |
instance.getSnapshot = () => { |
| 6470 |
let didChange2 = false; |
| 6471 |
for (let i = 0; i < instance.syncHooks.length; i += 1) { |
| 6472 |
const hook = instance.syncHooks[i]; |
| 6473 |
const value = hook.selector(hook.store.state, hook.a1, hook.a2, hook.a3); |
| 6474 |
if (hook.didChange || !Object.is(hook.value, value)) { |
| 6475 |
didChange2 = true; |
| 6476 |
hook.value = value; |
| 6477 |
hook.didChange = false; |
| 6478 |
} |
| 6479 |
} |
| 6480 |
if (didChange2) { |
| 6481 |
instance.syncTick += 1; |
| 6482 |
} |
| 6483 |
return instance.syncTick; |
| 6484 |
}; |
| 6485 |
} |
| 6486 |
}, |
| 6487 |
after(instance) { |
| 6488 |
if (instance.syncHooks.length > 0) { |
| 6489 |
if (instance.didChangeStore) { |
| 6490 |
instance.didChangeStore = false; |
| 6491 |
instance.subscribe = (onStoreChange) => { |
| 6492 |
const stores = /* @__PURE__ */ new Set(); |
| 6493 |
for (const hook of instance.syncHooks) { |
| 6494 |
stores.add(hook.store); |
| 6495 |
} |
| 6496 |
const unsubscribes = []; |
| 6497 |
for (const store of stores) { |
| 6498 |
unsubscribes.push(store.subscribe(onStoreChange)); |
| 6499 |
} |
| 6500 |
return () => { |
| 6501 |
for (const unsubscribe of unsubscribes) { |
| 6502 |
unsubscribe(); |
| 6503 |
} |
| 6504 |
}; |
| 6505 |
}; |
| 6506 |
} |
| 6507 |
(0, import_shim.useSyncExternalStore)(instance.subscribe, instance.getSnapshot, instance.getSnapshot); |
| 6508 |
} |
| 6509 |
} |
| 6510 |
}); |
| 6511 |
function useStoreFast(store, selector, a1, a2, a3) { |
| 6512 |
const instance = getInstance(); |
| 6513 |
if (!instance) { |
| 6514 |
return useStoreR19(store, selector, a1, a2, a3); |
| 6515 |
} |
| 6516 |
const index2 = instance.syncIndex; |
| 6517 |
instance.syncIndex += 1; |
| 6518 |
let hook; |
| 6519 |
if (!instance.didInitialize) { |
| 6520 |
hook = { |
| 6521 |
store, |
| 6522 |
selector, |
| 6523 |
a1, |
| 6524 |
a2, |
| 6525 |
a3, |
| 6526 |
value: selector(store.getSnapshot(), a1, a2, a3), |
| 6527 |
didChange: false |
| 6528 |
}; |
| 6529 |
instance.syncHooks.push(hook); |
| 6530 |
} else { |
| 6531 |
hook = instance.syncHooks[index2]; |
| 6532 |
if (hook.store !== store || hook.selector !== selector || !Object.is(hook.a1, a1) || !Object.is(hook.a2, a2) || !Object.is(hook.a3, a3)) { |
| 6533 |
if (hook.store !== store) { |
| 6534 |
instance.didChangeStore = true; |
| 6535 |
} |
| 6536 |
hook.store = store; |
| 6537 |
hook.selector = selector; |
| 6538 |
hook.a1 = a1; |
| 6539 |
hook.a2 = a2; |
| 6540 |
hook.a3 = a3; |
| 6541 |
hook.didChange = true; |
| 6542 |
} |
| 6543 |
} |
| 6544 |
return hook.value; |
| 6545 |
} |
| 6546 |
function useStoreLegacy(store, selector, a1, a2, a3) { |
| 6547 |
return (0, import_with_selector.useSyncExternalStoreWithSelector)(store.subscribe, store.getSnapshot, store.getSnapshot, (state) => selector(state, a1, a2, a3)); |
| 6548 |
} |
| 6549 |
|
| 6550 |
// node_modules/@base-ui/utils/esm/store/Store.js |
| 6551 |
var Store = class { |
| 6552 |
/** |
| 6553 |
* The current state of the store. |
| 6554 |
* This property is updated immediately when the state changes as a result of calling {@link setState}, {@link update}, or {@link set}. |
| 6555 |
* 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). |
| 6556 |
* The values can be used directly (to avoid subscribing to the store) in effects or event handlers. |
| 6557 |
* |
| 6558 |
* Do not modify properties in state directly. Instead, use the provided methods to ensure proper state management and listener notification. |
| 6559 |
*/ |
| 6560 |
// Internal state to handle recursive `setState()` calls |
| 6561 |
constructor(state) { |
| 6562 |
this.state = state; |
| 6563 |
this.listeners = /* @__PURE__ */ new Set(); |
| 6564 |
this.updateTick = 0; |
| 6565 |
} |
| 6566 |
/** |
| 6567 |
* Registers a listener that will be called whenever the store's state changes. |
| 6568 |
* |
| 6569 |
* @param fn The listener function to be called on state changes. |
| 6570 |
* @returns A function to unsubscribe the listener. |
| 6571 |
*/ |
| 6572 |
subscribe = (fn) => { |
| 6573 |
this.listeners.add(fn); |
| 6574 |
return () => { |
| 6575 |
this.listeners.delete(fn); |
| 6576 |
}; |
| 6577 |
}; |
| 6578 |
/** |
| 6579 |
* Returns the current state of the store. |
| 6580 |
*/ |
| 6581 |
getSnapshot = () => { |
| 6582 |
return this.state; |
| 6583 |
}; |
| 6584 |
/** |
| 6585 |
* Updates the entire store's state and notifies all registered listeners. |
| 6586 |
* |
| 6587 |
* @param newState The new state to set for the store. |
| 6588 |
*/ |
| 6589 |
setState(newState) { |
| 6590 |
if (this.state === newState) { |
| 6591 |
return; |
| 6592 |
} |
| 6593 |
this.state = newState; |
| 6594 |
this.updateTick += 1; |
| 6595 |
const currentTick = this.updateTick; |
| 6596 |
for (const listener of this.listeners) { |
| 6597 |
if (currentTick !== this.updateTick) { |
| 6598 |
return; |
| 6599 |
} |
| 6600 |
listener(newState); |
| 6601 |
} |
| 6602 |
} |
| 6603 |
/** |
| 6604 |
* Merges the provided changes into the current state and notifies listeners if there are changes. |
| 6605 |
* |
| 6606 |
* @param changes An object containing the changes to apply to the current state. |
| 6607 |
*/ |
| 6608 |
update(changes) { |
| 6609 |
for (const key in changes) { |
| 6610 |
if (!Object.is(this.state[key], changes[key])) { |
| 6611 |
this.setState({ |
| 6612 |
...this.state, |
| 6613 |
...changes |
| 6614 |
}); |
| 6615 |
return; |
| 6616 |
} |
| 6617 |
} |
| 6618 |
} |
| 6619 |
/** |
| 6620 |
* Sets a specific key in the store's state to a new value and notifies listeners if the value has changed. |
| 6621 |
* |
| 6622 |
* @param key The key in the store's state to update. |
| 6623 |
* @param value The new value to set for the specified key. |
| 6624 |
*/ |
| 6625 |
set(key, value) { |
| 6626 |
if (!Object.is(this.state[key], value)) { |
| 6627 |
this.setState({ |
| 6628 |
...this.state, |
| 6629 |
[key]: value |
| 6630 |
}); |
| 6631 |
} |
| 6632 |
} |
| 6633 |
/** |
| 6634 |
* Gives the state a new reference and updates all registered listeners. |
| 6635 |
*/ |
| 6636 |
notifyAll() { |
| 6637 |
const newState = { |
| 6638 |
...this.state |
| 6639 |
}; |
| 6640 |
this.setState(newState); |
| 6641 |
} |
| 6642 |
use(selector, a1, a2, a3) { |
| 6643 |
return useStore(this, selector, a1, a2, a3); |
| 6644 |
} |
| 6645 |
}; |
| 6646 |
|
| 6647 |
// node_modules/@base-ui/utils/esm/store/ReactStore.js |
| 6648 |
var React31 = __toESM(require_react(), 1); |
| 6649 |
var ReactStore = class extends Store { |
| 6650 |
/** |
| 6651 |
* Creates a new ReactStore instance. |
| 6652 |
* |
| 6653 |
* @param state Initial state of the store. |
| 6654 |
* @param context Non-reactive context values. |
| 6655 |
* @param selectors Optional selectors for use with `useState`. |
| 6656 |
*/ |
| 6657 |
constructor(state, context = {}, selectors4) { |
| 6658 |
super(state); |
| 6659 |
this.context = context; |
| 6660 |
this.selectors = selectors4; |
| 6661 |
} |
| 6662 |
/** |
| 6663 |
* Non-reactive values such as refs, callbacks, etc. |
| 6664 |
*/ |
| 6665 |
/** |
| 6666 |
* Synchronizes a single external value into the store. |
| 6667 |
* |
| 6668 |
* Note that the while the value in `state` is updated immediately, the value returned |
| 6669 |
* by `useState` is updated before the next render (similarly to React's `useState`). |
| 6670 |
*/ |
| 6671 |
useSyncedValue(key, value) { |
| 6672 |
React31.useDebugValue(key); |
| 6673 |
const store = this; |
| 6674 |
useIsoLayoutEffect(() => { |
| 6675 |
if (store.state[key] !== value) { |
| 6676 |
store.set(key, value); |
| 6677 |
} |
| 6678 |
}, [store, key, value]); |
| 6679 |
} |
| 6680 |
/** |
| 6681 |
* Synchronizes a single external value into the store and |
| 6682 |
* cleans it up (sets to `undefined`) on unmount. |
| 6683 |
* |
| 6684 |
* Note that the while the value in `state` is updated immediately, the value returned |
| 6685 |
* by `useState` is updated before the next render (similarly to React's `useState`). |
| 6686 |
*/ |
| 6687 |
useSyncedValueWithCleanup(key, value) { |
| 6688 |
const store = this; |
| 6689 |
useIsoLayoutEffect(() => { |
| 6690 |
if (store.state[key] !== value) { |
| 6691 |
store.set(key, value); |
| 6692 |
} |
| 6693 |
return () => { |
| 6694 |
store.set(key, void 0); |
| 6695 |
}; |
| 6696 |
}, [store, key, value]); |
| 6697 |
} |
| 6698 |
/** |
| 6699 |
* Synchronizes multiple external values into the store. |
| 6700 |
* |
| 6701 |
* Note that the while the values in `state` are updated immediately, the values returned |
| 6702 |
* by `useState` are updated before the next render (similarly to React's `useState`). |
| 6703 |
*/ |
| 6704 |
useSyncedValues(statePart) { |
| 6705 |
const store = this; |
| 6706 |
if (true) { |
| 6707 |
React31.useDebugValue(statePart, (p) => Object.keys(p)); |
| 6708 |
const keys = React31.useRef(Object.keys(statePart)).current; |
| 6709 |
const nextKeys = Object.keys(statePart); |
| 6710 |
if (keys.length !== nextKeys.length || keys.some((key, index2) => key !== nextKeys[index2])) { |
| 6711 |
console.error("ReactStore.useSyncedValues expects the same prop keys on every render. Keys should be stable."); |
| 6712 |
} |
| 6713 |
} |
| 6714 |
const dependencies = Object.values(statePart); |
| 6715 |
useIsoLayoutEffect(() => { |
| 6716 |
store.update(statePart); |
| 6717 |
}, [store, ...dependencies]); |
| 6718 |
} |
| 6719 |
/** |
| 6720 |
* Registers a controllable prop pair (`controlled`, `defaultValue`) for a specific key. If `controlled` |
| 6721 |
* is non-undefined, the store's state at `key` is updated to match `controlled`. |
| 6722 |
*/ |
| 6723 |
useControlledProp(key, controlled) { |
| 6724 |
React31.useDebugValue(key); |
| 6725 |
const store = this; |
| 6726 |
const isControlled = controlled !== void 0; |
| 6727 |
useIsoLayoutEffect(() => { |
| 6728 |
if (isControlled && !Object.is(store.state[key], controlled)) { |
| 6729 |
store.setState({ |
| 6730 |
...store.state, |
| 6731 |
[key]: controlled |
| 6732 |
}); |
| 6733 |
} |
| 6734 |
}, [store, key, controlled, isControlled]); |
| 6735 |
if (true) { |
| 6736 |
const cache = this.controlledValues ??= /* @__PURE__ */ new Map(); |
| 6737 |
if (!cache.has(key)) { |
| 6738 |
cache.set(key, isControlled); |
| 6739 |
} |
| 6740 |
const previouslyControlled = cache.get(key); |
| 6741 |
if (previouslyControlled !== void 0 && previouslyControlled !== isControlled) { |
| 6742 |
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).`); |
| 6743 |
} |
| 6744 |
} |
| 6745 |
} |
| 6746 |
/** Gets the current value from the store using a selector with the provided key. |
| 6747 |
* |
| 6748 |
* @param key Key of the selector to use. |
| 6749 |
*/ |
| 6750 |
select(key, a1, a2, a3) { |
| 6751 |
const selector = this.selectors[key]; |
| 6752 |
return selector(this.state, a1, a2, a3); |
| 6753 |
} |
| 6754 |
/** |
| 6755 |
* Returns a value from the store's state using a selector function. |
| 6756 |
* Used to subscribe to specific parts of the state. |
| 6757 |
* This methods causes a rerender whenever the selected state changes. |
| 6758 |
* |
| 6759 |
* @param key Key of the selector to use. |
| 6760 |
*/ |
| 6761 |
useState(key, a1, a2, a3) { |
| 6762 |
React31.useDebugValue(key); |
| 6763 |
return useStore(this, this.selectors[key], a1, a2, a3); |
| 6764 |
} |
| 6765 |
/** |
| 6766 |
* Wraps a function with `useStableCallback` to ensure it has a stable reference |
| 6767 |
* and assigns it to the context. |
| 6768 |
* |
| 6769 |
* @param key Key of the event callback. Must be a function in the context. |
| 6770 |
* @param fn Function to assign. |
| 6771 |
*/ |
| 6772 |
useContextCallback(key, fn) { |
| 6773 |
React31.useDebugValue(key); |
| 6774 |
const stableFunction = useStableCallback(fn ?? NOOP); |
| 6775 |
this.context[key] = stableFunction; |
| 6776 |
} |
| 6777 |
/** |
| 6778 |
* Returns a stable setter function for a specific key in the store's state. |
| 6779 |
* It's commonly used to pass as a ref callback to React elements. |
| 6780 |
* |
| 6781 |
* @param key Key of the state to set. |
| 6782 |
*/ |
| 6783 |
useStateSetter(key) { |
| 6784 |
const ref = React31.useRef(void 0); |
| 6785 |
if (ref.current === void 0) { |
| 6786 |
ref.current = (value) => { |
| 6787 |
this.set(key, value); |
| 6788 |
}; |
| 6789 |
} |
| 6790 |
return ref.current; |
| 6791 |
} |
| 6792 |
/** |
| 6793 |
* Observes changes derived from the store's selectors and calls the listener when the selected value changes. |
| 6794 |
* |
| 6795 |
* @param key Key of the selector to observe. |
| 6796 |
* @param listener Listener function called when the selector result changes. |
| 6797 |
*/ |
| 6798 |
observe(selector, listener) { |
| 6799 |
let selectFn; |
| 6800 |
if (typeof selector === "function") { |
| 6801 |
selectFn = selector; |
| 6802 |
} else { |
| 6803 |
selectFn = this.selectors[selector]; |
| 6804 |
} |
| 6805 |
let prevValue = selectFn(this.state); |
| 6806 |
listener(prevValue, prevValue, this); |
| 6807 |
return this.subscribe((nextState) => { |
| 6808 |
const nextValue = selectFn(nextState); |
| 6809 |
if (!Object.is(prevValue, nextValue)) { |
| 6810 |
const oldValue = prevValue; |
| 6811 |
prevValue = nextValue; |
| 6812 |
listener(nextValue, oldValue, this); |
| 6813 |
} |
| 6814 |
}); |
| 6815 |
} |
| 6816 |
}; |
| 6817 |
|
| 6818 |
// node_modules/@base-ui/react/esm/floating-ui-react/components/FloatingRootStore.js |
| 6819 |
var selectors = { |
| 6820 |
open: createSelector((state) => state.open), |
| 6821 |
transitionStatus: createSelector((state) => state.transitionStatus), |
| 6822 |
domReferenceElement: createSelector((state) => state.domReferenceElement), |
| 6823 |
referenceElement: createSelector((state) => state.positionReference ?? state.referenceElement), |
| 6824 |
floatingElement: createSelector((state) => state.floatingElement), |
| 6825 |
floatingId: createSelector((state) => state.floatingId) |
| 6826 |
}; |
| 6827 |
var FloatingRootStore = class extends ReactStore { |
| 6828 |
constructor(options) { |
| 6829 |
const { |
| 6830 |
syncOnly, |
| 6831 |
nested, |
| 6832 |
onOpenChange, |
| 6833 |
triggerElements, |
| 6834 |
...initialState |
| 6835 |
} = options; |
| 6836 |
super({ |
| 6837 |
...initialState, |
| 6838 |
positionReference: initialState.referenceElement, |
| 6839 |
domReferenceElement: initialState.referenceElement |
| 6840 |
}, { |
| 6841 |
onOpenChange, |
| 6842 |
dataRef: { |
| 6843 |
current: {} |
| 6844 |
}, |
| 6845 |
events: createEventEmitter(), |
| 6846 |
nested, |
| 6847 |
triggerElements |
| 6848 |
}, selectors); |
| 6849 |
this.syncOnly = syncOnly; |
| 6850 |
} |
| 6851 |
/** |
| 6852 |
* Syncs the event used by hover logic to distinguish hover-open from click-like interaction. |
| 6853 |
*/ |
| 6854 |
syncOpenEvent = (newOpen, event) => { |
| 6855 |
if (!newOpen || !this.state.open || // Prevent a pending hover-open from overwriting a click-open event, while allowing |
| 6856 |
// click events to upgrade a hover-open. |
| 6857 |
event != null && isClickLikeEvent(event)) { |
| 6858 |
this.context.dataRef.current.openEvent = newOpen ? event : void 0; |
| 6859 |
} |
| 6860 |
}; |
| 6861 |
/** |
| 6862 |
* Runs the root-owned side effects for an open state change. |
| 6863 |
*/ |
| 6864 |
dispatchOpenChange = (newOpen, eventDetails) => { |
| 6865 |
this.syncOpenEvent(newOpen, eventDetails.event); |
| 6866 |
const details = { |
| 6867 |
open: newOpen, |
| 6868 |
reason: eventDetails.reason, |
| 6869 |
nativeEvent: eventDetails.event, |
| 6870 |
nested: this.context.nested, |
| 6871 |
triggerElement: eventDetails.trigger |
| 6872 |
}; |
| 6873 |
this.context.events.emit("openchange", details); |
| 6874 |
}; |
| 6875 |
/** |
| 6876 |
* Emits the `openchange` event through the internal event emitter and calls the `onOpenChange` handler with the provided arguments. |
| 6877 |
* |
| 6878 |
* @param newOpen The new open state. |
| 6879 |
* @param eventDetails Details about the event that triggered the open state change. |
| 6880 |
*/ |
| 6881 |
setOpen = (newOpen, eventDetails) => { |
| 6882 |
if (this.syncOnly) { |
| 6883 |
this.context.onOpenChange?.(newOpen, eventDetails); |
| 6884 |
return; |
| 6885 |
} |
| 6886 |
this.dispatchOpenChange(newOpen, eventDetails); |
| 6887 |
this.context.onOpenChange?.(newOpen, eventDetails); |
| 6888 |
}; |
| 6889 |
}; |
| 6890 |
|
| 6891 |
// node_modules/@base-ui/react/esm/floating-ui-react/hooks/useSyncedFloatingRootContext.js |
| 6892 |
function useSyncedFloatingRootContext(options) { |
| 6893 |
const { |
| 6894 |
popupStore, |
| 6895 |
treatPopupAsFloatingElement = false, |
| 6896 |
floatingRootContext: floatingRootContextProp, |
| 6897 |
floatingId, |
| 6898 |
nested, |
| 6899 |
onOpenChange |
| 6900 |
} = options; |
| 6901 |
const open = popupStore.useState("open"); |
| 6902 |
const referenceElement = popupStore.useState("activeTriggerElement"); |
| 6903 |
const floatingElement = popupStore.useState(treatPopupAsFloatingElement ? "popupElement" : "positionerElement"); |
| 6904 |
const triggerElements = popupStore.context.triggerElements; |
| 6905 |
const handleOpenChange = onOpenChange; |
| 6906 |
const internalStoreRef = React32.useRef(null); |
| 6907 |
if (floatingRootContextProp === void 0 && internalStoreRef.current === null) { |
| 6908 |
internalStoreRef.current = new FloatingRootStore({ |
| 6909 |
open, |
| 6910 |
transitionStatus: void 0, |
| 6911 |
referenceElement, |
| 6912 |
floatingElement, |
| 6913 |
triggerElements, |
| 6914 |
onOpenChange: handleOpenChange, |
| 6915 |
floatingId, |
| 6916 |
syncOnly: true, |
| 6917 |
nested |
| 6918 |
}); |
| 6919 |
} |
| 6920 |
const store = floatingRootContextProp ?? internalStoreRef.current; |
| 6921 |
popupStore.useSyncedValue("floatingId", floatingId); |
| 6922 |
useIsoLayoutEffect(() => { |
| 6923 |
const valuesToSync = { |
| 6924 |
open, |
| 6925 |
floatingId, |
| 6926 |
referenceElement, |
| 6927 |
floatingElement |
| 6928 |
}; |
| 6929 |
if (isElement(referenceElement)) { |
| 6930 |
valuesToSync.domReferenceElement = referenceElement; |
| 6931 |
} |
| 6932 |
if (store.state.positionReference === store.state.referenceElement) { |
| 6933 |
valuesToSync.positionReference = referenceElement; |
| 6934 |
} |
| 6935 |
store.update(valuesToSync); |
| 6936 |
}, [open, floatingId, referenceElement, floatingElement, store]); |
| 6937 |
store.context.onOpenChange = handleOpenChange; |
| 6938 |
store.context.nested = nested; |
| 6939 |
return store; |
| 6940 |
} |
| 6941 |
|
| 6942 |
// node_modules/@base-ui/react/esm/utils/popups/popupStoreUtils.js |
| 6943 |
var FOCUSABLE_POPUP_PROPS = { |
| 6944 |
tabIndex: -1, |
| 6945 |
[FOCUSABLE_ATTRIBUTE]: "" |
| 6946 |
}; |
| 6947 |
function usePopupStore(externalStore, createStore, treatPopupAsFloatingElement = false) { |
| 6948 |
const floatingId = useId(); |
| 6949 |
const nested = useFloatingParentNodeId() != null; |
| 6950 |
const internalStoreRef = React33.useRef(null); |
| 6951 |
if (externalStore === void 0 && internalStoreRef.current === null) { |
| 6952 |
internalStoreRef.current = createStore(floatingId, nested); |
| 6953 |
} |
| 6954 |
const store = externalStore ?? internalStoreRef.current; |
| 6955 |
useSyncedFloatingRootContext({ |
| 6956 |
popupStore: store, |
| 6957 |
treatPopupAsFloatingElement, |
| 6958 |
floatingRootContext: store.state.floatingRootContext, |
| 6959 |
floatingId, |
| 6960 |
nested, |
| 6961 |
onOpenChange: store.setOpen |
| 6962 |
}); |
| 6963 |
return { |
| 6964 |
store, |
| 6965 |
internalStore: internalStoreRef.current |
| 6966 |
}; |
| 6967 |
} |
| 6968 |
function useTriggerRegistration(id, store) { |
| 6969 |
const registeredElementIdRef = React33.useRef(null); |
| 6970 |
const registeredElementRef = React33.useRef(null); |
| 6971 |
return React33.useCallback((element) => { |
| 6972 |
if (id === void 0) { |
| 6973 |
return; |
| 6974 |
} |
| 6975 |
let shouldSyncTriggerCount = false; |
| 6976 |
if (registeredElementIdRef.current !== null) { |
| 6977 |
const registeredId = registeredElementIdRef.current; |
| 6978 |
const registeredElement = registeredElementRef.current; |
| 6979 |
const currentElement = store.context.triggerElements.getById(registeredId); |
| 6980 |
if (registeredElement && currentElement === registeredElement) { |
| 6981 |
store.context.triggerElements.delete(registeredId); |
| 6982 |
shouldSyncTriggerCount = true; |
| 6983 |
} |
| 6984 |
registeredElementIdRef.current = null; |
| 6985 |
registeredElementRef.current = null; |
| 6986 |
} |
| 6987 |
if (element !== null) { |
| 6988 |
registeredElementIdRef.current = id; |
| 6989 |
registeredElementRef.current = element; |
| 6990 |
store.context.triggerElements.add(id, element); |
| 6991 |
shouldSyncTriggerCount = true; |
| 6992 |
} |
| 6993 |
if (shouldSyncTriggerCount) { |
| 6994 |
const triggerCount = store.context.triggerElements.size; |
| 6995 |
if (store.select("open") && store.state.triggerCount !== triggerCount) { |
| 6996 |
store.set("triggerCount", triggerCount); |
| 6997 |
} |
| 6998 |
} |
| 6999 |
}, [store, id]); |
| 7000 |
} |
| 7001 |
function setOpenTriggerState(state, open, trigger) { |
| 7002 |
const triggerId = trigger?.id ?? null; |
| 7003 |
if (triggerId || open) { |
| 7004 |
state.activeTriggerId = triggerId; |
| 7005 |
state.activeTriggerElement = trigger ?? null; |
| 7006 |
} |
| 7007 |
} |
| 7008 |
function useTriggerDataForwarding(triggerId, triggerElementRef, store, stateUpdates) { |
| 7009 |
const isMountedByThisTrigger = store.useState("isMountedByTrigger", triggerId); |
| 7010 |
const baseRegisterTrigger = useTriggerRegistration(triggerId, store); |
| 7011 |
const registerTrigger = useStableCallback((element) => { |
| 7012 |
baseRegisterTrigger(element); |
| 7013 |
if (!element) { |
| 7014 |
return; |
| 7015 |
} |
| 7016 |
const open = store.select("open"); |
| 7017 |
const activeTriggerId = store.select("activeTriggerId"); |
| 7018 |
if (activeTriggerId === triggerId) { |
| 7019 |
store.update({ |
| 7020 |
activeTriggerElement: element, |
| 7021 |
...open ? stateUpdates : null |
| 7022 |
}); |
| 7023 |
return; |
| 7024 |
} |
| 7025 |
if (activeTriggerId == null && open) { |
| 7026 |
store.update({ |
| 7027 |
activeTriggerId: triggerId, |
| 7028 |
activeTriggerElement: element, |
| 7029 |
...stateUpdates |
| 7030 |
}); |
| 7031 |
} |
| 7032 |
}); |
| 7033 |
useIsoLayoutEffect(() => { |
| 7034 |
if (isMountedByThisTrigger) { |
| 7035 |
store.update({ |
| 7036 |
activeTriggerElement: triggerElementRef.current, |
| 7037 |
...stateUpdates |
| 7038 |
}); |
| 7039 |
} |
| 7040 |
}, [isMountedByThisTrigger, store, triggerElementRef, ...Object.values(stateUpdates)]); |
| 7041 |
return { |
| 7042 |
registerTrigger, |
| 7043 |
isMountedByThisTrigger |
| 7044 |
}; |
| 7045 |
} |
| 7046 |
function useImplicitActiveTrigger(store) { |
| 7047 |
const open = store.useState("open"); |
| 7048 |
const reactiveTriggerCount = store.useState("triggerCount"); |
| 7049 |
useIsoLayoutEffect(() => { |
| 7050 |
if (!open) { |
| 7051 |
if (store.state.triggerCount !== 0) { |
| 7052 |
store.set("triggerCount", 0); |
| 7053 |
} |
| 7054 |
return; |
| 7055 |
} |
| 7056 |
const triggerCount = store.context.triggerElements.size; |
| 7057 |
const stateUpdates = {}; |
| 7058 |
if (store.state.triggerCount !== triggerCount) { |
| 7059 |
stateUpdates.triggerCount = triggerCount; |
| 7060 |
} |
| 7061 |
if (!store.select("activeTriggerId") && triggerCount === 1) { |
| 7062 |
const iteratorResult = store.context.triggerElements.entries().next(); |
| 7063 |
if (!iteratorResult.done) { |
| 7064 |
const [implicitTriggerId, implicitTriggerElement] = iteratorResult.value; |
| 7065 |
stateUpdates.activeTriggerId = implicitTriggerId; |
| 7066 |
stateUpdates.activeTriggerElement = implicitTriggerElement; |
| 7067 |
} |
| 7068 |
} |
| 7069 |
if (stateUpdates.triggerCount !== void 0 || stateUpdates.activeTriggerId !== void 0) { |
| 7070 |
store.update(stateUpdates); |
| 7071 |
} |
| 7072 |
}, [open, store, reactiveTriggerCount]); |
| 7073 |
} |
| 7074 |
function useOpenStateTransitions(open, store, onUnmount) { |
| 7075 |
const { |
| 7076 |
mounted, |
| 7077 |
setMounted, |
| 7078 |
transitionStatus |
| 7079 |
} = useTransitionStatus(open); |
| 7080 |
store.useSyncedValues({ |
| 7081 |
mounted, |
| 7082 |
transitionStatus |
| 7083 |
}); |
| 7084 |
const forceUnmount = useStableCallback(() => { |
| 7085 |
setMounted(false); |
| 7086 |
store.update({ |
| 7087 |
activeTriggerId: null, |
| 7088 |
activeTriggerElement: null, |
| 7089 |
mounted: false, |
| 7090 |
preventUnmountingOnClose: false |
| 7091 |
}); |
| 7092 |
onUnmount?.(); |
| 7093 |
store.context.onOpenChangeComplete?.(false); |
| 7094 |
}); |
| 7095 |
const preventUnmountingOnClose = store.useState("preventUnmountingOnClose"); |
| 7096 |
useOpenChangeComplete({ |
| 7097 |
enabled: mounted && !open && !preventUnmountingOnClose, |
| 7098 |
open, |
| 7099 |
ref: store.context.popupRef, |
| 7100 |
onComplete() { |
| 7101 |
if (!open) { |
| 7102 |
forceUnmount(); |
| 7103 |
} |
| 7104 |
} |
| 7105 |
}); |
| 7106 |
return { |
| 7107 |
forceUnmount, |
| 7108 |
transitionStatus |
| 7109 |
}; |
| 7110 |
} |
| 7111 |
function usePopupInteractionProps(store, statePart) { |
| 7112 |
store.useSyncedValues(statePart); |
| 7113 |
useIsoLayoutEffect(() => () => { |
| 7114 |
store.update({ |
| 7115 |
activeTriggerProps: EMPTY_OBJECT, |
| 7116 |
inactiveTriggerProps: EMPTY_OBJECT, |
| 7117 |
popupProps: EMPTY_OBJECT |
| 7118 |
}); |
| 7119 |
}, [store]); |
| 7120 |
} |
| 7121 |
|
| 7122 |
// node_modules/@base-ui/react/esm/utils/popups/popupTriggerMap.js |
| 7123 |
var PopupTriggerMap = class { |
| 7124 |
constructor() { |
| 7125 |
this.elementsSet = /* @__PURE__ */ new Set(); |
| 7126 |
this.idMap = /* @__PURE__ */ new Map(); |
| 7127 |
} |
| 7128 |
/** |
| 7129 |
* Adds a trigger element with the given ID. |
| 7130 |
* |
| 7131 |
* Note: The provided element is assumed to not be registered under multiple IDs. |
| 7132 |
*/ |
| 7133 |
add(id, element) { |
| 7134 |
const existingElement = this.idMap.get(id); |
| 7135 |
if (existingElement === element) { |
| 7136 |
return; |
| 7137 |
} |
| 7138 |
if (existingElement !== void 0) { |
| 7139 |
this.elementsSet.delete(existingElement); |
| 7140 |
} |
| 7141 |
this.elementsSet.add(element); |
| 7142 |
this.idMap.set(id, element); |
| 7143 |
if (true) { |
| 7144 |
if (this.elementsSet.size !== this.idMap.size) { |
| 7145 |
throw new Error("Base UI: A trigger element cannot be registered under multiple IDs in PopupTriggerMap."); |
| 7146 |
} |
| 7147 |
} |
| 7148 |
} |
| 7149 |
/** |
| 7150 |
* Removes the trigger element with the given ID. |
| 7151 |
*/ |
| 7152 |
delete(id) { |
| 7153 |
const element = this.idMap.get(id); |
| 7154 |
if (element) { |
| 7155 |
this.elementsSet.delete(element); |
| 7156 |
this.idMap.delete(id); |
| 7157 |
} |
| 7158 |
} |
| 7159 |
/** |
| 7160 |
* Whether the given element is registered as a trigger. |
| 7161 |
*/ |
| 7162 |
hasElement(element) { |
| 7163 |
return this.elementsSet.has(element); |
| 7164 |
} |
| 7165 |
/** |
| 7166 |
* Whether there is a registered trigger element matching the given predicate. |
| 7167 |
*/ |
| 7168 |
hasMatchingElement(predicate) { |
| 7169 |
for (const element of this.elementsSet) { |
| 7170 |
if (predicate(element)) { |
| 7171 |
return true; |
| 7172 |
} |
| 7173 |
} |
| 7174 |
return false; |
| 7175 |
} |
| 7176 |
/** |
| 7177 |
* Returns the trigger element associated with the given ID, or undefined if no such element exists. |
| 7178 |
*/ |
| 7179 |
getById(id) { |
| 7180 |
return this.idMap.get(id); |
| 7181 |
} |
| 7182 |
/** |
| 7183 |
* Returns an iterable of all registered trigger entries, where each entry is a tuple of [id, element]. |
| 7184 |
*/ |
| 7185 |
entries() { |
| 7186 |
return this.idMap.entries(); |
| 7187 |
} |
| 7188 |
/** |
| 7189 |
* Returns an iterable of all registered trigger elements. |
| 7190 |
*/ |
| 7191 |
elements() { |
| 7192 |
return this.elementsSet.values(); |
| 7193 |
} |
| 7194 |
/** |
| 7195 |
* Returns the number of registered trigger elements. |
| 7196 |
*/ |
| 7197 |
get size() { |
| 7198 |
return this.idMap.size; |
| 7199 |
} |
| 7200 |
}; |
| 7201 |
|
| 7202 |
// node_modules/@base-ui/react/esm/floating-ui-react/utils/getEmptyRootContext.js |
| 7203 |
function getEmptyRootContext() { |
| 7204 |
return new FloatingRootStore({ |
| 7205 |
open: false, |
| 7206 |
transitionStatus: void 0, |
| 7207 |
floatingElement: null, |
| 7208 |
referenceElement: null, |
| 7209 |
triggerElements: new PopupTriggerMap(), |
| 7210 |
floatingId: void 0, |
| 7211 |
syncOnly: false, |
| 7212 |
nested: false, |
| 7213 |
onOpenChange: void 0 |
| 7214 |
}); |
| 7215 |
} |
| 7216 |
|
| 7217 |
// node_modules/@base-ui/react/esm/utils/popups/store.js |
| 7218 |
function createInitialPopupStoreState() { |
| 7219 |
return { |
| 7220 |
open: false, |
| 7221 |
openProp: void 0, |
| 7222 |
mounted: false, |
| 7223 |
transitionStatus: void 0, |
| 7224 |
floatingRootContext: getEmptyRootContext(), |
| 7225 |
floatingId: void 0, |
| 7226 |
triggerCount: 0, |
| 7227 |
preventUnmountingOnClose: false, |
| 7228 |
payload: void 0, |
| 7229 |
activeTriggerId: null, |
| 7230 |
activeTriggerElement: null, |
| 7231 |
triggerIdProp: void 0, |
| 7232 |
popupElement: null, |
| 7233 |
positionerElement: null, |
| 7234 |
activeTriggerProps: EMPTY_OBJECT, |
| 7235 |
inactiveTriggerProps: EMPTY_OBJECT, |
| 7236 |
popupProps: EMPTY_OBJECT |
| 7237 |
}; |
| 7238 |
} |
| 7239 |
function createPopupFloatingRootContext(triggerElements, floatingId, nested = false) { |
| 7240 |
return new FloatingRootStore({ |
| 7241 |
open: false, |
| 7242 |
transitionStatus: void 0, |
| 7243 |
floatingElement: null, |
| 7244 |
referenceElement: null, |
| 7245 |
triggerElements, |
| 7246 |
floatingId, |
| 7247 |
syncOnly: true, |
| 7248 |
nested, |
| 7249 |
onOpenChange: void 0 |
| 7250 |
}); |
| 7251 |
} |
| 7252 |
var activeTriggerIdSelector = createSelector((state) => state.triggerIdProp ?? state.activeTriggerId); |
| 7253 |
var openSelector = createSelector((state) => state.openProp ?? state.open); |
| 7254 |
var popupIdSelector = createSelector((state) => { |
| 7255 |
const popupId = state.popupElement?.id ?? state.floatingId; |
| 7256 |
return popupId || void 0; |
| 7257 |
}); |
| 7258 |
function triggerOwnsOpenPopup(state, triggerId) { |
| 7259 |
return triggerId !== void 0 && openSelector(state) && activeTriggerIdSelector(state) === triggerId; |
| 7260 |
} |
| 7261 |
function triggerOwnsOpenPopupOrIsOnlyTrigger(state, triggerId) { |
| 7262 |
if (triggerOwnsOpenPopup(state, triggerId)) { |
| 7263 |
return true; |
| 7264 |
} |
| 7265 |
return triggerId !== void 0 && openSelector(state) && activeTriggerIdSelector(state) == null && state.triggerCount === 1; |
| 7266 |
} |
| 7267 |
var popupStoreSelectors = { |
| 7268 |
open: openSelector, |
| 7269 |
mounted: createSelector((state) => state.mounted), |
| 7270 |
transitionStatus: createSelector((state) => state.transitionStatus), |
| 7271 |
floatingRootContext: createSelector((state) => state.floatingRootContext), |
| 7272 |
triggerCount: createSelector((state) => state.triggerCount), |
| 7273 |
preventUnmountingOnClose: createSelector((state) => state.preventUnmountingOnClose), |
| 7274 |
payload: createSelector((state) => state.payload), |
| 7275 |
activeTriggerId: activeTriggerIdSelector, |
| 7276 |
activeTriggerElement: createSelector((state) => state.mounted ? state.activeTriggerElement : null), |
| 7277 |
popupId: popupIdSelector, |
| 7278 |
/** |
| 7279 |
* Whether the trigger with the given ID was used to open the popup. |
| 7280 |
*/ |
| 7281 |
isTriggerActive: createSelector((state, triggerId) => triggerId !== void 0 && activeTriggerIdSelector(state) === triggerId), |
| 7282 |
/** |
| 7283 |
* Whether the popup is open and was activated by a trigger with the given ID. |
| 7284 |
*/ |
| 7285 |
isOpenedByTrigger: createSelector((state, triggerId) => triggerOwnsOpenPopup(state, triggerId)), |
| 7286 |
/** |
| 7287 |
* Whether the popup is mounted and was activated by a trigger with the given ID. |
| 7288 |
*/ |
| 7289 |
isMountedByTrigger: createSelector((state, triggerId) => triggerId !== void 0 && activeTriggerIdSelector(state) === triggerId && state.mounted), |
| 7290 |
triggerProps: createSelector((state, isActive) => isActive ? state.activeTriggerProps : state.inactiveTriggerProps), |
| 7291 |
/** |
| 7292 |
* Popup id for the trigger that currently owns the open popup. |
| 7293 |
*/ |
| 7294 |
triggerPopupId: createSelector((state, triggerId) => triggerOwnsOpenPopupOrIsOnlyTrigger(state, triggerId) ? popupIdSelector(state) : void 0), |
| 7295 |
popupProps: createSelector((state) => state.popupProps), |
| 7296 |
popupElement: createSelector((state) => state.popupElement), |
| 7297 |
positionerElement: createSelector((state) => state.positionerElement) |
| 7298 |
}; |
| 7299 |
|
| 7300 |
// node_modules/@base-ui/react/esm/floating-ui-react/hooks/useFloatingRootContext.js |
| 7301 |
function useFloatingRootContext(options) { |
| 7302 |
const { |
| 7303 |
open = false, |
| 7304 |
onOpenChange, |
| 7305 |
elements = {} |
| 7306 |
} = options; |
| 7307 |
const floatingId = useId(); |
| 7308 |
const nested = useFloatingParentNodeId() != null; |
| 7309 |
if (true) { |
| 7310 |
const optionDomReference = elements.reference; |
| 7311 |
if (optionDomReference && !isElement(optionDomReference)) { |
| 7312 |
console.error("Cannot pass a virtual element to the `elements.reference` option,", "as it must be a real DOM element. Use `context.setPositionReference()`", "instead."); |
| 7313 |
} |
| 7314 |
} |
| 7315 |
const store = useRefWithInit(() => new FloatingRootStore({ |
| 7316 |
open, |
| 7317 |
transitionStatus: void 0, |
| 7318 |
onOpenChange, |
| 7319 |
referenceElement: elements.reference ?? null, |
| 7320 |
floatingElement: elements.floating ?? null, |
| 7321 |
triggerElements: new PopupTriggerMap(), |
| 7322 |
floatingId, |
| 7323 |
syncOnly: false, |
| 7324 |
nested |
| 7325 |
})).current; |
| 7326 |
useIsoLayoutEffect(() => { |
| 7327 |
const valuesToSync = { |
| 7328 |
open, |
| 7329 |
floatingId |
| 7330 |
}; |
| 7331 |
if (elements.reference !== void 0) { |
| 7332 |
valuesToSync.referenceElement = elements.reference; |
| 7333 |
valuesToSync.domReferenceElement = isElement(elements.reference) ? elements.reference : null; |
| 7334 |
} |
| 7335 |
if (elements.floating !== void 0) { |
| 7336 |
valuesToSync.floatingElement = elements.floating; |
| 7337 |
} |
| 7338 |
store.update(valuesToSync); |
| 7339 |
}, [open, floatingId, elements.reference, elements.floating, store]); |
| 7340 |
store.context.onOpenChange = onOpenChange; |
| 7341 |
store.context.nested = nested; |
| 7342 |
return store; |
| 7343 |
} |
| 7344 |
|
| 7345 |
// node_modules/@base-ui/react/esm/floating-ui-react/hooks/useFloating.js |
| 7346 |
function useFloating2(options = {}) { |
| 7347 |
const { |
| 7348 |
nodeId, |
| 7349 |
externalTree |
| 7350 |
} = options; |
| 7351 |
const internalStore = useFloatingRootContext(options); |
| 7352 |
const store = options.rootContext || internalStore; |
| 7353 |
const referenceElement = store.useState("referenceElement"); |
| 7354 |
const floatingElement = store.useState("floatingElement"); |
| 7355 |
const domReferenceElement = store.useState("domReferenceElement"); |
| 7356 |
const open = store.useState("open"); |
| 7357 |
const floatingId = store.useState("floatingId"); |
| 7358 |
const [positionReference, setPositionReferenceRaw] = React34.useState(null); |
| 7359 |
const [localDomReference, setLocalDomReference] = React34.useState(void 0); |
| 7360 |
const [localFloatingElement, setLocalFloatingElement] = React34.useState(void 0); |
| 7361 |
const domReferenceRef = React34.useRef(null); |
| 7362 |
const tree = useFloatingTree(externalTree); |
| 7363 |
const storeElements = React34.useMemo(() => ({ |
| 7364 |
reference: referenceElement, |
| 7365 |
floating: floatingElement, |
| 7366 |
domReference: domReferenceElement |
| 7367 |
}), [referenceElement, floatingElement, domReferenceElement]); |
| 7368 |
const position = useFloating({ |
| 7369 |
...options, |
| 7370 |
elements: { |
| 7371 |
...storeElements, |
| 7372 |
...positionReference && { |
| 7373 |
reference: positionReference |
| 7374 |
} |
| 7375 |
} |
| 7376 |
}); |
| 7377 |
const localDomReferenceElement = isElement(localDomReference) ? localDomReference : null; |
| 7378 |
const syncedFloatingElement = localFloatingElement === void 0 ? store.state.floatingElement : localFloatingElement; |
| 7379 |
store.useSyncedValue("referenceElement", localDomReference ?? null); |
| 7380 |
store.useSyncedValue("domReferenceElement", localDomReference === void 0 ? domReferenceElement : localDomReferenceElement); |
| 7381 |
store.useSyncedValue("floatingElement", syncedFloatingElement); |
| 7382 |
const setPositionReference = React34.useCallback((node) => { |
| 7383 |
const computedPositionReference = isElement(node) ? { |
| 7384 |
getBoundingClientRect: () => node.getBoundingClientRect(), |
| 7385 |
getClientRects: () => node.getClientRects(), |
| 7386 |
contextElement: node |
| 7387 |
} : node; |
| 7388 |
setPositionReferenceRaw(computedPositionReference); |
| 7389 |
position.refs.setReference(computedPositionReference); |
| 7390 |
}, [position.refs]); |
| 7391 |
const setReference = React34.useCallback((node) => { |
| 7392 |
if (isElement(node) || node === null) { |
| 7393 |
domReferenceRef.current = node; |
| 7394 |
setLocalDomReference(node); |
| 7395 |
} |
| 7396 |
if (isElement(position.refs.reference.current) || position.refs.reference.current === null || // Don't allow setting virtual elements using the old technique back to |
| 7397 |
// `null` to support `positionReference` + an unstable `reference` |
| 7398 |
// callback ref. |
| 7399 |
node !== null && !isElement(node)) { |
| 7400 |
position.refs.setReference(node); |
| 7401 |
} |
| 7402 |
}, [position.refs, setLocalDomReference]); |
| 7403 |
const setFloating = React34.useCallback((node) => { |
| 7404 |
setLocalFloatingElement(node); |
| 7405 |
position.refs.setFloating(node); |
| 7406 |
}, [position.refs]); |
| 7407 |
const refs = React34.useMemo(() => ({ |
| 7408 |
...position.refs, |
| 7409 |
setReference, |
| 7410 |
setFloating, |
| 7411 |
setPositionReference, |
| 7412 |
domReference: domReferenceRef |
| 7413 |
}), [position.refs, setReference, setFloating, setPositionReference]); |
| 7414 |
const elements = React34.useMemo(() => ({ |
| 7415 |
...position.elements, |
| 7416 |
domReference: domReferenceElement |
| 7417 |
}), [position.elements, domReferenceElement]); |
| 7418 |
const context = React34.useMemo(() => ({ |
| 7419 |
...position, |
| 7420 |
dataRef: store.context.dataRef, |
| 7421 |
open, |
| 7422 |
onOpenChange: store.setOpen, |
| 7423 |
events: store.context.events, |
| 7424 |
floatingId, |
| 7425 |
refs, |
| 7426 |
elements, |
| 7427 |
nodeId, |
| 7428 |
rootStore: store |
| 7429 |
}), [position, refs, elements, nodeId, store, open, floatingId]); |
| 7430 |
useIsoLayoutEffect(() => { |
| 7431 |
if (domReferenceElement) { |
| 7432 |
domReferenceRef.current = domReferenceElement; |
| 7433 |
} |
| 7434 |
}, [domReferenceElement]); |
| 7435 |
useIsoLayoutEffect(() => { |
| 7436 |
store.context.dataRef.current.floatingContext = context; |
| 7437 |
const node = tree?.nodesRef.current.find((n) => n.id === nodeId); |
| 7438 |
if (node) { |
| 7439 |
node.context = context; |
| 7440 |
} |
| 7441 |
}); |
| 7442 |
return React34.useMemo(() => ({ |
| 7443 |
...position, |
| 7444 |
context, |
| 7445 |
refs, |
| 7446 |
elements, |
| 7447 |
rootStore: store |
| 7448 |
}), [position, refs, elements, context, store]); |
| 7449 |
} |
| 7450 |
|
| 7451 |
// node_modules/@base-ui/react/esm/floating-ui-react/hooks/useFocus.js |
| 7452 |
var React35 = __toESM(require_react(), 1); |
| 7453 |
var isMacSafari = isMac && isSafari; |
| 7454 |
function useFocus(context, props = {}) { |
| 7455 |
const { |
| 7456 |
enabled = true, |
| 7457 |
delay |
| 7458 |
} = props; |
| 7459 |
const store = "rootStore" in context ? context.rootStore : context; |
| 7460 |
const { |
| 7461 |
events, |
| 7462 |
dataRef |
| 7463 |
} = store.context; |
| 7464 |
const blockFocusRef = React35.useRef(false); |
| 7465 |
const blockedReferenceRef = React35.useRef(null); |
| 7466 |
const keyboardModalityRef = React35.useRef(true); |
| 7467 |
const timeout = useTimeout(); |
| 7468 |
React35.useEffect(() => { |
| 7469 |
const domReference = store.select("domReferenceElement"); |
| 7470 |
if (!enabled) { |
| 7471 |
return void 0; |
| 7472 |
} |
| 7473 |
const win = getWindow(domReference); |
| 7474 |
function onBlur() { |
| 7475 |
const currentDomReference = store.select("domReferenceElement"); |
| 7476 |
if (!store.select("open") && isHTMLElement(currentDomReference) && currentDomReference === activeElement(ownerDocument(currentDomReference))) { |
| 7477 |
blockFocusRef.current = true; |
| 7478 |
} |
| 7479 |
} |
| 7480 |
function onKeyDown() { |
| 7481 |
keyboardModalityRef.current = true; |
| 7482 |
} |
| 7483 |
function onPointerDown() { |
| 7484 |
keyboardModalityRef.current = false; |
| 7485 |
} |
| 7486 |
return mergeCleanups(addEventListener(win, "blur", onBlur), isMacSafari && addEventListener(win, "keydown", onKeyDown, true), isMacSafari && addEventListener(win, "pointerdown", onPointerDown, true)); |
| 7487 |
}, [store, enabled]); |
| 7488 |
React35.useEffect(() => { |
| 7489 |
if (!enabled) { |
| 7490 |
return void 0; |
| 7491 |
} |
| 7492 |
function onOpenChangeLocal(details) { |
| 7493 |
if (details.reason === reason_parts_exports.triggerPress || details.reason === reason_parts_exports.escapeKey) { |
| 7494 |
const referenceElement = store.select("domReferenceElement"); |
| 7495 |
if (isElement(referenceElement)) { |
| 7496 |
blockedReferenceRef.current = referenceElement; |
| 7497 |
blockFocusRef.current = true; |
| 7498 |
} |
| 7499 |
} |
| 7500 |
} |
| 7501 |
events.on("openchange", onOpenChangeLocal); |
| 7502 |
return () => { |
| 7503 |
events.off("openchange", onOpenChangeLocal); |
| 7504 |
}; |
| 7505 |
}, [events, enabled, store]); |
| 7506 |
const reference = React35.useMemo(() => { |
| 7507 |
function resetBlockedFocus() { |
| 7508 |
blockFocusRef.current = false; |
| 7509 |
blockedReferenceRef.current = null; |
| 7510 |
} |
| 7511 |
return { |
| 7512 |
onMouseLeave() { |
| 7513 |
resetBlockedFocus(); |
| 7514 |
}, |
| 7515 |
onFocus(event) { |
| 7516 |
const focusTarget = event.currentTarget; |
| 7517 |
if (blockFocusRef.current) { |
| 7518 |
if (blockedReferenceRef.current === focusTarget) { |
| 7519 |
return; |
| 7520 |
} |
| 7521 |
resetBlockedFocus(); |
| 7522 |
} |
| 7523 |
const target = getTarget(event.nativeEvent); |
| 7524 |
if (isElement(target)) { |
| 7525 |
if (isMacSafari && !event.relatedTarget) { |
| 7526 |
if (!keyboardModalityRef.current && !isTypeableElement(target)) { |
| 7527 |
return; |
| 7528 |
} |
| 7529 |
} else if (!matchesFocusVisible(target)) { |
| 7530 |
return; |
| 7531 |
} |
| 7532 |
} |
| 7533 |
const movedFromOtherEnabledTrigger = isTargetInsideEnabledTrigger(event.relatedTarget, store.context.triggerElements); |
| 7534 |
const { |
| 7535 |
nativeEvent, |
| 7536 |
currentTarget |
| 7537 |
} = event; |
| 7538 |
const delayValue = typeof delay === "function" ? delay() : delay; |
| 7539 |
if (store.select("open") && movedFromOtherEnabledTrigger || delayValue === 0 || delayValue === void 0) { |
| 7540 |
store.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerFocus, nativeEvent, currentTarget)); |
| 7541 |
return; |
| 7542 |
} |
| 7543 |
timeout.start(delayValue, () => { |
| 7544 |
if (blockFocusRef.current) { |
| 7545 |
return; |
| 7546 |
} |
| 7547 |
store.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerFocus, nativeEvent, currentTarget)); |
| 7548 |
}); |
| 7549 |
}, |
| 7550 |
onBlur(event) { |
| 7551 |
resetBlockedFocus(); |
| 7552 |
const relatedTarget = event.relatedTarget; |
| 7553 |
const nativeEvent = event.nativeEvent; |
| 7554 |
const movedToFocusGuard = isElement(relatedTarget) && relatedTarget.hasAttribute(createAttribute("focus-guard")) && relatedTarget.getAttribute("data-type") === "outside"; |
| 7555 |
timeout.start(0, () => { |
| 7556 |
const domReference = store.select("domReferenceElement"); |
| 7557 |
const activeEl = activeElement(ownerDocument(domReference)); |
| 7558 |
if (!relatedTarget && activeEl === domReference) { |
| 7559 |
return; |
| 7560 |
} |
| 7561 |
if (contains(dataRef.current.floatingContext?.refs.floating.current, activeEl) || contains(domReference, activeEl) || movedToFocusGuard) { |
| 7562 |
return; |
| 7563 |
} |
| 7564 |
const nextFocusedElement = relatedTarget ?? activeEl; |
| 7565 |
if (isTargetInsideEnabledTrigger(nextFocusedElement, store.context.triggerElements)) { |
| 7566 |
return; |
| 7567 |
} |
| 7568 |
store.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerFocus, nativeEvent)); |
| 7569 |
}); |
| 7570 |
} |
| 7571 |
}; |
| 7572 |
}, [dataRef, delay, store, timeout]); |
| 7573 |
return React35.useMemo(() => enabled ? { |
| 7574 |
reference, |
| 7575 |
trigger: reference |
| 7576 |
} : {}, [enabled, reference]); |
| 7577 |
} |
| 7578 |
|
| 7579 |
// node_modules/@base-ui/react/esm/floating-ui-react/hooks/useHoverFloatingInteraction.js |
| 7580 |
var React36 = __toESM(require_react(), 1); |
| 7581 |
|
| 7582 |
// node_modules/@base-ui/react/esm/floating-ui-react/hooks/useHoverInteractionSharedState.js |
| 7583 |
var HoverInteraction = class _HoverInteraction { |
| 7584 |
constructor() { |
| 7585 |
this.pointerType = void 0; |
| 7586 |
this.interactedInside = false; |
| 7587 |
this.handler = void 0; |
| 7588 |
this.blockMouseMove = true; |
| 7589 |
this.performedPointerEventsMutation = false; |
| 7590 |
this.pointerEventsScopeElement = null; |
| 7591 |
this.pointerEventsReferenceElement = null; |
| 7592 |
this.pointerEventsFloatingElement = null; |
| 7593 |
this.restTimeoutPending = false; |
| 7594 |
this.openChangeTimeout = new Timeout(); |
| 7595 |
this.restTimeout = new Timeout(); |
| 7596 |
this.handleCloseOptions = void 0; |
| 7597 |
} |
| 7598 |
static create() { |
| 7599 |
return new _HoverInteraction(); |
| 7600 |
} |
| 7601 |
dispose = () => { |
| 7602 |
this.openChangeTimeout.clear(); |
| 7603 |
this.restTimeout.clear(); |
| 7604 |
}; |
| 7605 |
disposeEffect = () => { |
| 7606 |
return this.dispose; |
| 7607 |
}; |
| 7608 |
}; |
| 7609 |
var pointerEventsMutationOwnerByScopeElement = /* @__PURE__ */ new WeakMap(); |
| 7610 |
function clearSafePolygonPointerEventsMutation(instance) { |
| 7611 |
if (!instance.performedPointerEventsMutation) { |
| 7612 |
return; |
| 7613 |
} |
| 7614 |
const scopeElement = instance.pointerEventsScopeElement; |
| 7615 |
if (scopeElement && pointerEventsMutationOwnerByScopeElement.get(scopeElement) === instance) { |
| 7616 |
instance.pointerEventsScopeElement?.style.removeProperty("pointer-events"); |
| 7617 |
instance.pointerEventsReferenceElement?.style.removeProperty("pointer-events"); |
| 7618 |
instance.pointerEventsFloatingElement?.style.removeProperty("pointer-events"); |
| 7619 |
pointerEventsMutationOwnerByScopeElement.delete(scopeElement); |
| 7620 |
} |
| 7621 |
instance.performedPointerEventsMutation = false; |
| 7622 |
instance.pointerEventsScopeElement = null; |
| 7623 |
instance.pointerEventsReferenceElement = null; |
| 7624 |
instance.pointerEventsFloatingElement = null; |
| 7625 |
} |
| 7626 |
function applySafePolygonPointerEventsMutation(instance, options) { |
| 7627 |
const { |
| 7628 |
scopeElement, |
| 7629 |
referenceElement, |
| 7630 |
floatingElement |
| 7631 |
} = options; |
| 7632 |
const existingOwner = pointerEventsMutationOwnerByScopeElement.get(scopeElement); |
| 7633 |
if (existingOwner && existingOwner !== instance) { |
| 7634 |
clearSafePolygonPointerEventsMutation(existingOwner); |
| 7635 |
} |
| 7636 |
clearSafePolygonPointerEventsMutation(instance); |
| 7637 |
instance.performedPointerEventsMutation = true; |
| 7638 |
instance.pointerEventsScopeElement = scopeElement; |
| 7639 |
instance.pointerEventsReferenceElement = referenceElement; |
| 7640 |
instance.pointerEventsFloatingElement = floatingElement; |
| 7641 |
pointerEventsMutationOwnerByScopeElement.set(scopeElement, instance); |
| 7642 |
scopeElement.style.pointerEvents = "none"; |
| 7643 |
referenceElement.style.pointerEvents = "auto"; |
| 7644 |
floatingElement.style.pointerEvents = "auto"; |
| 7645 |
} |
| 7646 |
function useHoverInteractionSharedState(store) { |
| 7647 |
const data = store.context.dataRef.current; |
| 7648 |
const instance = useRefWithInit(() => data.hoverInteractionState ?? HoverInteraction.create()).current; |
| 7649 |
if (!data.hoverInteractionState) { |
| 7650 |
data.hoverInteractionState = instance; |
| 7651 |
} |
| 7652 |
useOnMount(data.hoverInteractionState.disposeEffect); |
| 7653 |
return data.hoverInteractionState; |
| 7654 |
} |
| 7655 |
|
| 7656 |
// node_modules/@base-ui/react/esm/floating-ui-react/hooks/useHoverFloatingInteraction.js |
| 7657 |
function useHoverFloatingInteraction(context, parameters = {}) { |
| 7658 |
const { |
| 7659 |
enabled = true, |
| 7660 |
closeDelay: closeDelayProp = 0, |
| 7661 |
nodeId: nodeIdProp |
| 7662 |
} = parameters; |
| 7663 |
const store = "rootStore" in context ? context.rootStore : context; |
| 7664 |
const open = store.useState("open"); |
| 7665 |
const floatingElement = store.useState("floatingElement"); |
| 7666 |
const domReferenceElement = store.useState("domReferenceElement"); |
| 7667 |
const { |
| 7668 |
dataRef |
| 7669 |
} = store.context; |
| 7670 |
const tree = useFloatingTree(); |
| 7671 |
const parentId = useFloatingParentNodeId(); |
| 7672 |
const instance = useHoverInteractionSharedState(store); |
| 7673 |
const childClosedTimeout = useTimeout(); |
| 7674 |
const isClickLikeOpenEvent2 = useStableCallback(() => { |
| 7675 |
return isClickLikeOpenEvent(dataRef.current.openEvent?.type, instance.interactedInside); |
| 7676 |
}); |
| 7677 |
const isHoverOpen = useStableCallback(() => { |
| 7678 |
return isHoverOpenEvent(dataRef.current.openEvent?.type); |
| 7679 |
}); |
| 7680 |
const clearPointerEvents = useStableCallback(() => { |
| 7681 |
clearSafePolygonPointerEventsMutation(instance); |
| 7682 |
}); |
| 7683 |
useIsoLayoutEffect(() => { |
| 7684 |
if (!open) { |
| 7685 |
instance.pointerType = void 0; |
| 7686 |
instance.restTimeoutPending = false; |
| 7687 |
instance.interactedInside = false; |
| 7688 |
clearPointerEvents(); |
| 7689 |
} |
| 7690 |
}, [open, instance, clearPointerEvents]); |
| 7691 |
React36.useEffect(() => { |
| 7692 |
return clearPointerEvents; |
| 7693 |
}, [clearPointerEvents]); |
| 7694 |
useIsoLayoutEffect(() => { |
| 7695 |
if (!enabled) { |
| 7696 |
return void 0; |
| 7697 |
} |
| 7698 |
if (open && instance.handleCloseOptions?.blockPointerEvents && isHoverOpen() && isElement(domReferenceElement) && floatingElement) { |
| 7699 |
const ref = domReferenceElement; |
| 7700 |
const floatingEl = floatingElement; |
| 7701 |
const doc = ownerDocument(floatingElement); |
| 7702 |
const parentFloating = tree?.nodesRef.current.find((node) => node.id === parentId)?.context?.elements.floating; |
| 7703 |
if (parentFloating) { |
| 7704 |
parentFloating.style.pointerEvents = ""; |
| 7705 |
} |
| 7706 |
const cachedScopeElement = instance.pointerEventsScopeElement !== floatingEl ? instance.pointerEventsScopeElement : null; |
| 7707 |
const parentScopeElement = parentFloating !== floatingEl ? parentFloating : null; |
| 7708 |
const scopeElement = instance.handleCloseOptions?.getScope?.() ?? cachedScopeElement ?? parentScopeElement ?? ref.closest("[data-rootownerid]") ?? doc.body; |
| 7709 |
applySafePolygonPointerEventsMutation(instance, { |
| 7710 |
scopeElement, |
| 7711 |
referenceElement: ref, |
| 7712 |
floatingElement: floatingEl |
| 7713 |
}); |
| 7714 |
return () => { |
| 7715 |
clearPointerEvents(); |
| 7716 |
}; |
| 7717 |
} |
| 7718 |
return void 0; |
| 7719 |
}, [enabled, open, domReferenceElement, floatingElement, instance, isHoverOpen, tree, parentId, clearPointerEvents]); |
| 7720 |
React36.useEffect(() => { |
| 7721 |
if (!enabled) { |
| 7722 |
return void 0; |
| 7723 |
} |
| 7724 |
function hasParentChildren() { |
| 7725 |
return !!(tree && parentId && getNodeChildren(tree.nodesRef.current, parentId).length > 0); |
| 7726 |
} |
| 7727 |
function closeWithDelay(event) { |
| 7728 |
const closeDelay = getDelay(closeDelayProp, "close", instance.pointerType); |
| 7729 |
const close = () => { |
| 7730 |
store.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerHover, event)); |
| 7731 |
tree?.events.emit("floating.closed", event); |
| 7732 |
}; |
| 7733 |
if (closeDelay) { |
| 7734 |
instance.openChangeTimeout.start(closeDelay, close); |
| 7735 |
} else { |
| 7736 |
instance.openChangeTimeout.clear(); |
| 7737 |
close(); |
| 7738 |
} |
| 7739 |
} |
| 7740 |
function handleInteractInside(event) { |
| 7741 |
const target = getTarget(event); |
| 7742 |
if (!isInteractiveElement(target)) { |
| 7743 |
instance.interactedInside = false; |
| 7744 |
return; |
| 7745 |
} |
| 7746 |
instance.interactedInside = target?.closest("[aria-haspopup]") != null; |
| 7747 |
} |
| 7748 |
function onFloatingMouseEnter() { |
| 7749 |
instance.openChangeTimeout.clear(); |
| 7750 |
childClosedTimeout.clear(); |
| 7751 |
tree?.events.off("floating.closed", onNodeClosed); |
| 7752 |
clearPointerEvents(); |
| 7753 |
} |
| 7754 |
function onFloatingMouseLeave(event) { |
| 7755 |
if (hasParentChildren() && tree) { |
| 7756 |
tree.events.on("floating.closed", onNodeClosed); |
| 7757 |
return; |
| 7758 |
} |
| 7759 |
if (isTargetInsideEnabledTrigger(event.relatedTarget, store.context.triggerElements)) { |
| 7760 |
return; |
| 7761 |
} |
| 7762 |
const currentNodeId = dataRef.current.floatingContext?.nodeId ?? nodeIdProp; |
| 7763 |
const relatedTarget = event.relatedTarget; |
| 7764 |
const isMovingIntoDescendantFloating = tree && currentNodeId && isElement(relatedTarget) && getNodeChildren(tree.nodesRef.current, currentNodeId, false).some((node) => contains(node.context?.elements.floating, relatedTarget)); |
| 7765 |
if (isMovingIntoDescendantFloating) { |
| 7766 |
return; |
| 7767 |
} |
| 7768 |
if (instance.handler) { |
| 7769 |
instance.handler(event); |
| 7770 |
return; |
| 7771 |
} |
| 7772 |
clearPointerEvents(); |
| 7773 |
if (!isClickLikeOpenEvent2()) { |
| 7774 |
closeWithDelay(event); |
| 7775 |
} |
| 7776 |
} |
| 7777 |
function onNodeClosed(event) { |
| 7778 |
if (!tree || !parentId || hasParentChildren()) { |
| 7779 |
return; |
| 7780 |
} |
| 7781 |
childClosedTimeout.start(0, () => { |
| 7782 |
tree.events.off("floating.closed", onNodeClosed); |
| 7783 |
store.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerHover, event)); |
| 7784 |
tree.events.emit("floating.closed", event); |
| 7785 |
}); |
| 7786 |
} |
| 7787 |
const floating = floatingElement; |
| 7788 |
return mergeCleanups(floating && addEventListener(floating, "mouseenter", onFloatingMouseEnter), floating && addEventListener(floating, "mouseleave", onFloatingMouseLeave), floating && addEventListener(floating, "pointerdown", handleInteractInside, true), () => { |
| 7789 |
tree?.events.off("floating.closed", onNodeClosed); |
| 7790 |
}); |
| 7791 |
}, [enabled, floatingElement, store, dataRef, closeDelayProp, nodeIdProp, isClickLikeOpenEvent2, clearPointerEvents, instance, tree, parentId, childClosedTimeout]); |
| 7792 |
} |
| 7793 |
|
| 7794 |
// node_modules/@base-ui/react/esm/floating-ui-react/hooks/useHoverReferenceInteraction.js |
| 7795 |
var React37 = __toESM(require_react(), 1); |
| 7796 |
var ReactDOM4 = __toESM(require_react_dom(), 1); |
| 7797 |
var EMPTY_REF = { |
| 7798 |
current: null |
| 7799 |
}; |
| 7800 |
function useHoverReferenceInteraction(context, props = {}) { |
| 7801 |
const { |
| 7802 |
enabled = true, |
| 7803 |
delay = 0, |
| 7804 |
handleClose = null, |
| 7805 |
mouseOnly = false, |
| 7806 |
restMs = 0, |
| 7807 |
move = true, |
| 7808 |
triggerElementRef = EMPTY_REF, |
| 7809 |
externalTree, |
| 7810 |
isActiveTrigger = true, |
| 7811 |
getHandleCloseContext, |
| 7812 |
isClosing, |
| 7813 |
shouldOpen: shouldOpenProp |
| 7814 |
} = props; |
| 7815 |
const store = "rootStore" in context ? context.rootStore : context; |
| 7816 |
const { |
| 7817 |
dataRef, |
| 7818 |
events |
| 7819 |
} = store.context; |
| 7820 |
const tree = useFloatingTree(externalTree); |
| 7821 |
const instance = useHoverInteractionSharedState(store); |
| 7822 |
const isHoverCloseActiveRef = React37.useRef(false); |
| 7823 |
const handleCloseRef = useValueAsRef(handleClose); |
| 7824 |
const delayRef = useValueAsRef(delay); |
| 7825 |
const restMsRef = useValueAsRef(restMs); |
| 7826 |
const enabledRef = useValueAsRef(enabled); |
| 7827 |
const shouldOpenRef = useValueAsRef(shouldOpenProp); |
| 7828 |
const isClosingRef = useValueAsRef(isClosing); |
| 7829 |
const isClickLikeOpenEvent2 = useStableCallback(() => { |
| 7830 |
return isClickLikeOpenEvent(dataRef.current.openEvent?.type, instance.interactedInside); |
| 7831 |
}); |
| 7832 |
const checkShouldOpen = useStableCallback(() => { |
| 7833 |
return shouldOpenRef.current?.() !== false; |
| 7834 |
}); |
| 7835 |
const isOverInactiveTrigger = useStableCallback((currentDomReference, currentTarget, target) => { |
| 7836 |
const allTriggers = store.context.triggerElements; |
| 7837 |
if (allTriggers.hasElement(currentTarget)) { |
| 7838 |
return !currentDomReference || !contains(currentDomReference, currentTarget); |
| 7839 |
} |
| 7840 |
if (!isElement(target)) { |
| 7841 |
return false; |
| 7842 |
} |
| 7843 |
const targetElement = target; |
| 7844 |
return allTriggers.hasMatchingElement((trigger) => contains(trigger, targetElement)) && (!currentDomReference || !contains(currentDomReference, targetElement)); |
| 7845 |
}); |
| 7846 |
const cleanupMouseMoveHandler = useStableCallback(() => { |
| 7847 |
if (!instance.handler) { |
| 7848 |
return; |
| 7849 |
} |
| 7850 |
const doc = ownerDocument(store.select("domReferenceElement")); |
| 7851 |
doc.removeEventListener("mousemove", instance.handler); |
| 7852 |
instance.handler = void 0; |
| 7853 |
}); |
| 7854 |
const clearPointerEvents = useStableCallback(() => { |
| 7855 |
clearSafePolygonPointerEventsMutation(instance); |
| 7856 |
}); |
| 7857 |
if (isActiveTrigger) { |
| 7858 |
instance.handleCloseOptions = handleCloseRef.current?.__options; |
| 7859 |
} |
| 7860 |
React37.useEffect(() => cleanupMouseMoveHandler, [cleanupMouseMoveHandler]); |
| 7861 |
React37.useEffect(() => { |
| 7862 |
if (!enabled) { |
| 7863 |
return void 0; |
| 7864 |
} |
| 7865 |
function onOpenChangeLocal(details) { |
| 7866 |
if (!details.open) { |
| 7867 |
isHoverCloseActiveRef.current = details.reason === reason_parts_exports.triggerHover; |
| 7868 |
cleanupMouseMoveHandler(); |
| 7869 |
instance.openChangeTimeout.clear(); |
| 7870 |
instance.restTimeout.clear(); |
| 7871 |
instance.blockMouseMove = true; |
| 7872 |
instance.restTimeoutPending = false; |
| 7873 |
} else { |
| 7874 |
isHoverCloseActiveRef.current = false; |
| 7875 |
} |
| 7876 |
} |
| 7877 |
events.on("openchange", onOpenChangeLocal); |
| 7878 |
return () => { |
| 7879 |
events.off("openchange", onOpenChangeLocal); |
| 7880 |
}; |
| 7881 |
}, [enabled, events, instance, cleanupMouseMoveHandler]); |
| 7882 |
React37.useEffect(() => { |
| 7883 |
if (!enabled) { |
| 7884 |
return void 0; |
| 7885 |
} |
| 7886 |
function closeWithDelay(event, runElseBranch = true) { |
| 7887 |
const closeDelay = getDelay(delayRef.current, "close", instance.pointerType); |
| 7888 |
if (closeDelay) { |
| 7889 |
instance.openChangeTimeout.start(closeDelay, () => { |
| 7890 |
store.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerHover, event)); |
| 7891 |
tree?.events.emit("floating.closed", event); |
| 7892 |
}); |
| 7893 |
} else if (runElseBranch) { |
| 7894 |
instance.openChangeTimeout.clear(); |
| 7895 |
store.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerHover, event)); |
| 7896 |
tree?.events.emit("floating.closed", event); |
| 7897 |
} |
| 7898 |
} |
| 7899 |
const trigger = triggerElementRef.current ?? (isActiveTrigger ? store.select("domReferenceElement") : null); |
| 7900 |
if (!isElement(trigger)) { |
| 7901 |
return void 0; |
| 7902 |
} |
| 7903 |
function onMouseEnter(event) { |
| 7904 |
instance.openChangeTimeout.clear(); |
| 7905 |
instance.blockMouseMove = false; |
| 7906 |
if (mouseOnly && !isMouseLikePointerType(instance.pointerType)) { |
| 7907 |
return; |
| 7908 |
} |
| 7909 |
const restMsValue = getRestMs(restMsRef.current); |
| 7910 |
const openDelay = getDelay(delayRef.current, "open", instance.pointerType); |
| 7911 |
const eventTarget = getTarget(event); |
| 7912 |
const currentTarget = event.currentTarget ?? null; |
| 7913 |
const currentDomReference = store.select("domReferenceElement"); |
| 7914 |
let triggerNode = currentTarget; |
| 7915 |
if (isElement(eventTarget) && !store.context.triggerElements.hasElement(eventTarget)) { |
| 7916 |
for (const triggerElement of store.context.triggerElements.elements()) { |
| 7917 |
if (contains(triggerElement, eventTarget)) { |
| 7918 |
triggerNode = triggerElement; |
| 7919 |
break; |
| 7920 |
} |
| 7921 |
} |
| 7922 |
} |
| 7923 |
if (isElement(currentTarget) && isElement(currentDomReference) && !store.context.triggerElements.hasElement(currentTarget) && contains(currentTarget, currentDomReference)) { |
| 7924 |
triggerNode = currentDomReference; |
| 7925 |
} |
| 7926 |
const isOverInactive = triggerNode == null ? false : isOverInactiveTrigger(currentDomReference, triggerNode, eventTarget); |
| 7927 |
const isOpen = store.select("open"); |
| 7928 |
const isInClosingTransition = isClosingRef.current?.() ?? store.select("transitionStatus") === "ending"; |
| 7929 |
const isHoverCloseTransition = !isOpen && isInClosingTransition && isHoverCloseActiveRef.current; |
| 7930 |
const isReenteringSameTriggerDuringCloseTransition = !isOverInactive && isElement(triggerNode) && isElement(currentDomReference) && contains(currentDomReference, triggerNode) && isHoverCloseTransition; |
| 7931 |
const isRestOnlyDelay = restMsValue > 0 && !openDelay; |
| 7932 |
const shouldOpenImmediately = isOverInactive && (isOpen || isHoverCloseTransition) || isReenteringSameTriggerDuringCloseTransition; |
| 7933 |
const shouldOpen = !isOpen || isOverInactive; |
| 7934 |
if (shouldOpenImmediately) { |
| 7935 |
if (checkShouldOpen()) { |
| 7936 |
store.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerHover, event, triggerNode)); |
| 7937 |
} |
| 7938 |
return; |
| 7939 |
} |
| 7940 |
if (isRestOnlyDelay) { |
| 7941 |
return; |
| 7942 |
} |
| 7943 |
if (openDelay) { |
| 7944 |
instance.openChangeTimeout.start(openDelay, () => { |
| 7945 |
if (shouldOpen && checkShouldOpen()) { |
| 7946 |
store.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerHover, event, triggerNode)); |
| 7947 |
} |
| 7948 |
}); |
| 7949 |
} else if (shouldOpen) { |
| 7950 |
if (checkShouldOpen()) { |
| 7951 |
store.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerHover, event, triggerNode)); |
| 7952 |
} |
| 7953 |
} |
| 7954 |
} |
| 7955 |
function onMouseLeave(event) { |
| 7956 |
if (isClickLikeOpenEvent2()) { |
| 7957 |
clearPointerEvents(); |
| 7958 |
return; |
| 7959 |
} |
| 7960 |
cleanupMouseMoveHandler(); |
| 7961 |
const domReferenceElement = store.select("domReferenceElement"); |
| 7962 |
const doc = ownerDocument(domReferenceElement); |
| 7963 |
instance.restTimeout.clear(); |
| 7964 |
instance.restTimeoutPending = false; |
| 7965 |
const handleCloseContextBase = dataRef.current.floatingContext ?? getHandleCloseContext?.(); |
| 7966 |
if (isTargetInsideEnabledTrigger(event.relatedTarget, store.context.triggerElements)) { |
| 7967 |
return; |
| 7968 |
} |
| 7969 |
if (handleCloseRef.current && handleCloseContextBase) { |
| 7970 |
if (!store.select("open")) { |
| 7971 |
instance.openChangeTimeout.clear(); |
| 7972 |
} |
| 7973 |
const currentTrigger = triggerElementRef.current; |
| 7974 |
instance.handler = handleCloseRef.current({ |
| 7975 |
...handleCloseContextBase, |
| 7976 |
tree, |
| 7977 |
x: event.clientX, |
| 7978 |
y: event.clientY, |
| 7979 |
onClose() { |
| 7980 |
clearPointerEvents(); |
| 7981 |
cleanupMouseMoveHandler(); |
| 7982 |
if (enabledRef.current && !isClickLikeOpenEvent2() && currentTrigger === store.select("domReferenceElement")) { |
| 7983 |
closeWithDelay(event, true); |
| 7984 |
} |
| 7985 |
} |
| 7986 |
}); |
| 7987 |
doc.addEventListener("mousemove", instance.handler); |
| 7988 |
instance.handler(event); |
| 7989 |
return; |
| 7990 |
} |
| 7991 |
const shouldClose = instance.pointerType === "touch" ? !contains(store.select("floatingElement"), event.relatedTarget) : true; |
| 7992 |
if (shouldClose) { |
| 7993 |
closeWithDelay(event); |
| 7994 |
} |
| 7995 |
} |
| 7996 |
if (move) { |
| 7997 |
return mergeCleanups(addEventListener(trigger, "mousemove", onMouseEnter, { |
| 7998 |
once: true |
| 7999 |
}), addEventListener(trigger, "mouseenter", onMouseEnter), addEventListener(trigger, "mouseleave", onMouseLeave)); |
| 8000 |
} |
| 8001 |
return mergeCleanups(addEventListener(trigger, "mouseenter", onMouseEnter), addEventListener(trigger, "mouseleave", onMouseLeave)); |
| 8002 |
}, [cleanupMouseMoveHandler, clearPointerEvents, dataRef, delayRef, store, enabled, handleCloseRef, instance, isActiveTrigger, isOverInactiveTrigger, isClickLikeOpenEvent2, mouseOnly, move, restMsRef, triggerElementRef, tree, enabledRef, getHandleCloseContext, isClosingRef, checkShouldOpen]); |
| 8003 |
return React37.useMemo(() => { |
| 8004 |
if (!enabled) { |
| 8005 |
return void 0; |
| 8006 |
} |
| 8007 |
function setPointerRef(event) { |
| 8008 |
instance.pointerType = event.pointerType; |
| 8009 |
} |
| 8010 |
return { |
| 8011 |
onPointerDown: setPointerRef, |
| 8012 |
onPointerEnter: setPointerRef, |
| 8013 |
onMouseMove(event) { |
| 8014 |
const { |
| 8015 |
nativeEvent |
| 8016 |
} = event; |
| 8017 |
const trigger = event.currentTarget; |
| 8018 |
const currentDomReference = store.select("domReferenceElement"); |
| 8019 |
const currentOpen = store.select("open"); |
| 8020 |
const isOverInactive = isOverInactiveTrigger(currentDomReference, trigger, event.target); |
| 8021 |
if (mouseOnly && !isMouseLikePointerType(instance.pointerType)) { |
| 8022 |
return; |
| 8023 |
} |
| 8024 |
if (currentOpen && isOverInactive && instance.handleCloseOptions?.blockPointerEvents) { |
| 8025 |
const floatingElement = store.select("floatingElement"); |
| 8026 |
if (floatingElement) { |
| 8027 |
const scopeElement = instance.handleCloseOptions?.getScope?.() ?? trigger.ownerDocument.body; |
| 8028 |
applySafePolygonPointerEventsMutation(instance, { |
| 8029 |
scopeElement, |
| 8030 |
referenceElement: trigger, |
| 8031 |
floatingElement |
| 8032 |
}); |
| 8033 |
} |
| 8034 |
} |
| 8035 |
const restMsValue = getRestMs(restMsRef.current); |
| 8036 |
if (currentOpen && !isOverInactive || restMsValue === 0) { |
| 8037 |
return; |
| 8038 |
} |
| 8039 |
if (!isOverInactive && instance.restTimeoutPending && event.movementX ** 2 + event.movementY ** 2 < 2) { |
| 8040 |
return; |
| 8041 |
} |
| 8042 |
instance.restTimeout.clear(); |
| 8043 |
function handleMouseMove() { |
| 8044 |
instance.restTimeoutPending = false; |
| 8045 |
if (isClickLikeOpenEvent2()) { |
| 8046 |
return; |
| 8047 |
} |
| 8048 |
const latestOpen = store.select("open"); |
| 8049 |
if (!instance.blockMouseMove && (!latestOpen || isOverInactive) && checkShouldOpen()) { |
| 8050 |
store.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerHover, nativeEvent, trigger)); |
| 8051 |
} |
| 8052 |
} |
| 8053 |
if (instance.pointerType === "touch") { |
| 8054 |
ReactDOM4.flushSync(() => { |
| 8055 |
handleMouseMove(); |
| 8056 |
}); |
| 8057 |
} else if (isOverInactive && currentOpen) { |
| 8058 |
handleMouseMove(); |
| 8059 |
} else { |
| 8060 |
instance.restTimeoutPending = true; |
| 8061 |
instance.restTimeout.start(restMsValue, handleMouseMove); |
| 8062 |
} |
| 8063 |
} |
| 8064 |
}; |
| 8065 |
}, [enabled, instance, isClickLikeOpenEvent2, isOverInactiveTrigger, mouseOnly, store, restMsRef, checkShouldOpen]); |
| 8066 |
} |
| 8067 |
|
| 8068 |
// node_modules/@base-ui/react/esm/floating-ui-react/hooks/useListNavigation.js |
| 8069 |
var React38 = __toESM(require_react(), 1); |
| 8070 |
var ESCAPE = "Escape"; |
| 8071 |
function doSwitch(orientation, vertical, horizontal) { |
| 8072 |
switch (orientation) { |
| 8073 |
case "vertical": |
| 8074 |
return vertical; |
| 8075 |
case "horizontal": |
| 8076 |
return horizontal; |
| 8077 |
default: |
| 8078 |
return vertical || horizontal; |
| 8079 |
} |
| 8080 |
} |
| 8081 |
function isMainOrientationKey(key, orientation) { |
| 8082 |
const vertical = key === ARROW_UP || key === ARROW_DOWN; |
| 8083 |
const horizontal = key === ARROW_LEFT || key === ARROW_RIGHT; |
| 8084 |
return doSwitch(orientation, vertical, horizontal); |
| 8085 |
} |
| 8086 |
function isMainOrientationToEndKey(key, orientation, rtl) { |
| 8087 |
const vertical = key === ARROW_DOWN; |
| 8088 |
const horizontal = rtl ? key === ARROW_LEFT : key === ARROW_RIGHT; |
| 8089 |
return doSwitch(orientation, vertical, horizontal) || key === "Enter" || key === " " || key === ""; |
| 8090 |
} |
| 8091 |
function isCrossOrientationOpenKey(key, orientation, rtl) { |
| 8092 |
const vertical = rtl ? key === ARROW_LEFT : key === ARROW_RIGHT; |
| 8093 |
const horizontal = key === ARROW_DOWN; |
| 8094 |
return doSwitch(orientation, vertical, horizontal); |
| 8095 |
} |
| 8096 |
function isCrossOrientationCloseKey(key, orientation, rtl, cols) { |
| 8097 |
const vertical = rtl ? key === ARROW_RIGHT : key === ARROW_LEFT; |
| 8098 |
const horizontal = key === ARROW_UP; |
| 8099 |
if (orientation === "both" || orientation === "horizontal" && cols && cols > 1) { |
| 8100 |
return key === ESCAPE; |
| 8101 |
} |
| 8102 |
return doSwitch(orientation, vertical, horizontal); |
| 8103 |
} |
| 8104 |
function useListNavigation(context, props) { |
| 8105 |
const { |
| 8106 |
listRef, |
| 8107 |
activeIndex, |
| 8108 |
onNavigate: onNavigateProp = () => { |
| 8109 |
}, |
| 8110 |
enabled = true, |
| 8111 |
selectedIndex = null, |
| 8112 |
allowEscape = false, |
| 8113 |
loopFocus = false, |
| 8114 |
nested = false, |
| 8115 |
rtl = false, |
| 8116 |
virtual = false, |
| 8117 |
focusItemOnOpen = "auto", |
| 8118 |
focusItemOnHover = true, |
| 8119 |
openOnArrowKeyDown = true, |
| 8120 |
disabledIndices = void 0, |
| 8121 |
orientation = "vertical", |
| 8122 |
parentOrientation, |
| 8123 |
cols = 1, |
| 8124 |
id, |
| 8125 |
resetOnPointerLeave = true, |
| 8126 |
externalTree |
| 8127 |
} = props; |
| 8128 |
if (true) { |
| 8129 |
if (allowEscape) { |
| 8130 |
if (!loopFocus) { |
| 8131 |
console.warn("`useListNavigation` looping must be enabled to allow escaping."); |
| 8132 |
} |
| 8133 |
if (!virtual) { |
| 8134 |
console.warn("`useListNavigation` must be virtual to allow escaping."); |
| 8135 |
} |
| 8136 |
} |
| 8137 |
if (orientation === "vertical" && cols > 1) { |
| 8138 |
console.warn("In grid list navigation mode (`cols` > 1), the `orientation` should", 'be either "horizontal" or "both".'); |
| 8139 |
} |
| 8140 |
} |
| 8141 |
const store = "rootStore" in context ? context.rootStore : context; |
| 8142 |
const open = store.useState("open"); |
| 8143 |
const floatingElement = store.useState("floatingElement"); |
| 8144 |
const domReferenceElement = store.useState("domReferenceElement"); |
| 8145 |
const dataRef = store.context.dataRef; |
| 8146 |
const floatingFocusElement = getFloatingFocusElement(floatingElement); |
| 8147 |
const typeableComboboxReference = isTypeableCombobox(domReferenceElement); |
| 8148 |
const floatingFocusElementRef = useValueAsRef(floatingFocusElement); |
| 8149 |
const parentId = useFloatingParentNodeId(); |
| 8150 |
const tree = useFloatingTree(externalTree); |
| 8151 |
const focusItemOnOpenRef = React38.useRef(focusItemOnOpen); |
| 8152 |
const indexRef = React38.useRef(selectedIndex ?? -1); |
| 8153 |
const keyRef = React38.useRef(null); |
| 8154 |
const isPointerModalityRef = React38.useRef(true); |
| 8155 |
const onNavigate = useStableCallback((event) => { |
| 8156 |
onNavigateProp(indexRef.current === -1 ? null : indexRef.current, event); |
| 8157 |
}); |
| 8158 |
const previousOnNavigateRef = React38.useRef(onNavigate); |
| 8159 |
const previousMountedRef = React38.useRef(!!floatingElement); |
| 8160 |
const previousOpenRef = React38.useRef(open); |
| 8161 |
const forceSyncFocusRef = React38.useRef(false); |
| 8162 |
const forceScrollIntoViewRef = React38.useRef(false); |
| 8163 |
const cancelQueuedFocusRef = React38.useRef(null); |
| 8164 |
const disabledIndicesRef = useValueAsRef(disabledIndices); |
| 8165 |
const latestOpenRef = useValueAsRef(open); |
| 8166 |
const selectedIndexRef = useValueAsRef(selectedIndex); |
| 8167 |
const resetOnPointerLeaveRef = useValueAsRef(resetOnPointerLeave); |
| 8168 |
const focusFrame = useAnimationFrame(); |
| 8169 |
const waitForListPopulatedFrame = useAnimationFrame(); |
| 8170 |
const focusItem = useStableCallback(() => { |
| 8171 |
function runFocus(item2) { |
| 8172 |
if (virtual) { |
| 8173 |
tree?.events.emit("virtualfocus", item2); |
| 8174 |
} else { |
| 8175 |
cancelQueuedFocusRef.current = enqueueFocus(item2, { |
| 8176 |
sync: forceSyncFocusRef.current, |
| 8177 |
preventScroll: true |
| 8178 |
}); |
| 8179 |
} |
| 8180 |
} |
| 8181 |
const initialItem = listRef.current[indexRef.current]; |
| 8182 |
const forceScrollIntoView = forceScrollIntoViewRef.current; |
| 8183 |
if (initialItem) { |
| 8184 |
runFocus(initialItem); |
| 8185 |
} |
| 8186 |
const scheduler2 = forceSyncFocusRef.current ? (callback) => callback() : (callback) => focusFrame.request(callback); |
| 8187 |
scheduler2(() => { |
| 8188 |
const waitedItem = listRef.current[indexRef.current] || initialItem; |
| 8189 |
if (!waitedItem) { |
| 8190 |
return; |
| 8191 |
} |
| 8192 |
if (!initialItem) { |
| 8193 |
runFocus(waitedItem); |
| 8194 |
} |
| 8195 |
const shouldScrollIntoView = ( |
| 8196 |
// eslint-disable-next-line @typescript-eslint/no-use-before-define |
| 8197 |
item && (forceScrollIntoView || !isPointerModalityRef.current) |
| 8198 |
); |
| 8199 |
if (shouldScrollIntoView) { |
| 8200 |
waitedItem.scrollIntoView?.({ |
| 8201 |
block: "nearest", |
| 8202 |
inline: "nearest" |
| 8203 |
}); |
| 8204 |
} |
| 8205 |
}); |
| 8206 |
}); |
| 8207 |
useIsoLayoutEffect(() => { |
| 8208 |
dataRef.current.orientation = orientation; |
| 8209 |
}, [dataRef, orientation]); |
| 8210 |
useIsoLayoutEffect(() => { |
| 8211 |
if (!enabled) { |
| 8212 |
return; |
| 8213 |
} |
| 8214 |
if (open && floatingElement) { |
| 8215 |
indexRef.current = selectedIndex ?? -1; |
| 8216 |
if (focusItemOnOpenRef.current && selectedIndex != null) { |
| 8217 |
forceScrollIntoViewRef.current = true; |
| 8218 |
onNavigate(); |
| 8219 |
} |
| 8220 |
} else if (previousMountedRef.current) { |
| 8221 |
indexRef.current = -1; |
| 8222 |
previousOnNavigateRef.current(); |
| 8223 |
} |
| 8224 |
}, [enabled, open, floatingElement, selectedIndex, onNavigate]); |
| 8225 |
useIsoLayoutEffect(() => { |
| 8226 |
if (!enabled) { |
| 8227 |
return; |
| 8228 |
} |
| 8229 |
if (!open) { |
| 8230 |
forceSyncFocusRef.current = false; |
| 8231 |
return; |
| 8232 |
} |
| 8233 |
if (!floatingElement) { |
| 8234 |
return; |
| 8235 |
} |
| 8236 |
if (activeIndex == null) { |
| 8237 |
forceSyncFocusRef.current = false; |
| 8238 |
if (selectedIndexRef.current != null) { |
| 8239 |
return; |
| 8240 |
} |
| 8241 |
if (previousMountedRef.current) { |
| 8242 |
indexRef.current = -1; |
| 8243 |
focusItem(); |
| 8244 |
} |
| 8245 |
if ((!previousOpenRef.current || !previousMountedRef.current) && focusItemOnOpenRef.current && (keyRef.current != null || focusItemOnOpenRef.current === true && keyRef.current == null)) { |
| 8246 |
let runs = 0; |
| 8247 |
const waitForListPopulated = () => { |
| 8248 |
if (listRef.current[0] == null) { |
| 8249 |
if (runs < 2) { |
| 8250 |
const scheduler2 = runs ? (callback) => waitForListPopulatedFrame.request(callback) : queueMicrotask; |
| 8251 |
scheduler2(waitForListPopulated); |
| 8252 |
} |
| 8253 |
runs += 1; |
| 8254 |
} else { |
| 8255 |
indexRef.current = keyRef.current == null || isMainOrientationToEndKey(keyRef.current, orientation, rtl) || nested ? getMinListIndex(listRef) : getMaxListIndex(listRef); |
| 8256 |
keyRef.current = null; |
| 8257 |
onNavigate(); |
| 8258 |
} |
| 8259 |
}; |
| 8260 |
waitForListPopulated(); |
| 8261 |
} |
| 8262 |
} else if (!isIndexOutOfListBounds(listRef.current, activeIndex)) { |
| 8263 |
indexRef.current = activeIndex; |
| 8264 |
focusItem(); |
| 8265 |
forceScrollIntoViewRef.current = false; |
| 8266 |
} |
| 8267 |
}, [enabled, open, floatingElement, activeIndex, selectedIndexRef, nested, listRef, orientation, rtl, onNavigate, focusItem, waitForListPopulatedFrame]); |
| 8268 |
useIsoLayoutEffect(() => { |
| 8269 |
if (!enabled || floatingElement || !tree || virtual || !previousMountedRef.current) { |
| 8270 |
return; |
| 8271 |
} |
| 8272 |
const nodes = tree.nodesRef.current; |
| 8273 |
const parent = nodes.find((node) => node.id === parentId)?.context?.elements.floating; |
| 8274 |
const activeEl = activeElement(ownerDocument(floatingElement)); |
| 8275 |
const treeContainsActiveEl = nodes.some((node) => node.context && contains(node.context.elements.floating, activeEl)); |
| 8276 |
if (parent && !treeContainsActiveEl && isPointerModalityRef.current) { |
| 8277 |
parent.focus({ |
| 8278 |
preventScroll: true |
| 8279 |
}); |
| 8280 |
} |
| 8281 |
}, [enabled, floatingElement, tree, parentId, virtual]); |
| 8282 |
useIsoLayoutEffect(() => { |
| 8283 |
previousOnNavigateRef.current = onNavigate; |
| 8284 |
previousOpenRef.current = open; |
| 8285 |
previousMountedRef.current = !!floatingElement; |
| 8286 |
}); |
| 8287 |
useIsoLayoutEffect(() => { |
| 8288 |
if (!open) { |
| 8289 |
keyRef.current = null; |
| 8290 |
focusItemOnOpenRef.current = focusItemOnOpen; |
| 8291 |
} |
| 8292 |
}, [open, focusItemOnOpen]); |
| 8293 |
const hasActiveIndex = activeIndex != null; |
| 8294 |
const syncCurrentTarget = useStableCallback((event) => { |
| 8295 |
if (!latestOpenRef.current) { |
| 8296 |
return; |
| 8297 |
} |
| 8298 |
const index2 = listRef.current.indexOf(event.currentTarget); |
| 8299 |
if (index2 !== -1 && (indexRef.current !== index2 || activeIndex !== index2)) { |
| 8300 |
indexRef.current = index2; |
| 8301 |
onNavigate(event); |
| 8302 |
} |
| 8303 |
}); |
| 8304 |
const getParentOrientation = useStableCallback(() => { |
| 8305 |
return parentOrientation ?? tree?.nodesRef.current.find((node) => node.id === parentId)?.context?.dataRef?.current.orientation; |
| 8306 |
}); |
| 8307 |
const getMinEnabledIndex = useStableCallback(() => { |
| 8308 |
return getMinListIndex(listRef, disabledIndicesRef.current); |
| 8309 |
}); |
| 8310 |
const commonOnKeyDown = useStableCallback((event) => { |
| 8311 |
isPointerModalityRef.current = false; |
| 8312 |
forceSyncFocusRef.current = true; |
| 8313 |
if (event.which === 229) { |
| 8314 |
return; |
| 8315 |
} |
| 8316 |
if (!latestOpenRef.current && event.currentTarget === floatingFocusElementRef.current) { |
| 8317 |
return; |
| 8318 |
} |
| 8319 |
if (nested && isCrossOrientationCloseKey(event.key, orientation, rtl, cols)) { |
| 8320 |
if (!isMainOrientationKey(event.key, getParentOrientation())) { |
| 8321 |
stopEvent(event); |
| 8322 |
} |
| 8323 |
store.setOpen(false, createChangeEventDetails(reason_parts_exports.listNavigation, event.nativeEvent)); |
| 8324 |
if (isHTMLElement(domReferenceElement)) { |
| 8325 |
if (virtual) { |
| 8326 |
tree?.events.emit("virtualfocus", domReferenceElement); |
| 8327 |
} else { |
| 8328 |
domReferenceElement.focus(); |
| 8329 |
} |
| 8330 |
} |
| 8331 |
return; |
| 8332 |
} |
| 8333 |
const currentIndex = indexRef.current; |
| 8334 |
const minIndex = getMinListIndex(listRef, disabledIndices); |
| 8335 |
const maxIndex = getMaxListIndex(listRef, disabledIndices); |
| 8336 |
if (!typeableComboboxReference) { |
| 8337 |
if (event.key === "Home") { |
| 8338 |
stopEvent(event); |
| 8339 |
indexRef.current = minIndex; |
| 8340 |
onNavigate(event); |
| 8341 |
} |
| 8342 |
if (event.key === "End") { |
| 8343 |
stopEvent(event); |
| 8344 |
indexRef.current = maxIndex; |
| 8345 |
onNavigate(event); |
| 8346 |
} |
| 8347 |
} |
| 8348 |
if (cols > 1) { |
| 8349 |
const sizes = Array.from({ |
| 8350 |
length: listRef.current.length |
| 8351 |
}, () => ({ |
| 8352 |
width: 1, |
| 8353 |
height: 1 |
| 8354 |
})); |
| 8355 |
const cellMap = createGridCellMap(sizes, cols, false); |
| 8356 |
const minGridIndex = cellMap.findIndex((index3) => index3 != null && !isListIndexDisabled(listRef.current, index3, disabledIndices)); |
| 8357 |
const maxGridIndex = cellMap.reduce((foundIndex, index3, cellIndex) => index3 != null && !isListIndexDisabled(listRef.current, index3, disabledIndices) ? cellIndex : foundIndex, -1); |
| 8358 |
const index2 = cellMap[getGridNavigatedIndex(cellMap.map((itemIndex) => itemIndex != null ? listRef.current[itemIndex] : null), { |
| 8359 |
event, |
| 8360 |
orientation, |
| 8361 |
loopFocus, |
| 8362 |
rtl, |
| 8363 |
cols, |
| 8364 |
// treat undefined (empty grid spaces) as disabled indices so we |
| 8365 |
// don't end up in them |
| 8366 |
disabledIndices: getGridCellIndices([...(typeof disabledIndices !== "function" ? disabledIndices : null) || listRef.current.map((_, listIndex) => isListIndexDisabled(listRef.current, listIndex, disabledIndices) ? listIndex : void 0), void 0], cellMap), |
| 8367 |
minIndex: minGridIndex, |
| 8368 |
maxIndex: maxGridIndex, |
| 8369 |
prevIndex: getGridCellIndexOfCorner( |
| 8370 |
indexRef.current > maxIndex ? minIndex : indexRef.current, |
| 8371 |
sizes, |
| 8372 |
cellMap, |
| 8373 |
cols, |
| 8374 |
// use a corner matching the edge closest to the direction |
| 8375 |
// we're moving in so we don't end up in the same item. Prefer |
| 8376 |
// top/left over bottom/right. |
| 8377 |
// eslint-disable-next-line no-nested-ternary |
| 8378 |
event.key === ARROW_DOWN ? "bl" : event.key === (rtl ? ARROW_LEFT : ARROW_RIGHT) ? "tr" : "tl" |
| 8379 |
), |
| 8380 |
stopEvent: true |
| 8381 |
})]; |
| 8382 |
if (index2 != null) { |
| 8383 |
indexRef.current = index2; |
| 8384 |
onNavigate(event); |
| 8385 |
} |
| 8386 |
if (orientation === "both") { |
| 8387 |
return; |
| 8388 |
} |
| 8389 |
} |
| 8390 |
if (isMainOrientationKey(event.key, orientation)) { |
| 8391 |
stopEvent(event); |
| 8392 |
if (open && !virtual && activeElement(event.currentTarget.ownerDocument) === event.currentTarget) { |
| 8393 |
indexRef.current = isMainOrientationToEndKey(event.key, orientation, rtl) ? minIndex : maxIndex; |
| 8394 |
onNavigate(event); |
| 8395 |
return; |
| 8396 |
} |
| 8397 |
if (isMainOrientationToEndKey(event.key, orientation, rtl)) { |
| 8398 |
if (loopFocus) { |
| 8399 |
if (currentIndex >= maxIndex) { |
| 8400 |
if (allowEscape && currentIndex !== listRef.current.length) { |
| 8401 |
indexRef.current = -1; |
| 8402 |
} else { |
| 8403 |
forceSyncFocusRef.current = false; |
| 8404 |
indexRef.current = minIndex; |
| 8405 |
} |
| 8406 |
} else { |
| 8407 |
indexRef.current = findNonDisabledListIndex(listRef.current, { |
| 8408 |
startingIndex: currentIndex, |
| 8409 |
disabledIndices |
| 8410 |
}); |
| 8411 |
} |
| 8412 |
} else { |
| 8413 |
indexRef.current = Math.min(maxIndex, findNonDisabledListIndex(listRef.current, { |
| 8414 |
startingIndex: currentIndex, |
| 8415 |
disabledIndices |
| 8416 |
})); |
| 8417 |
} |
| 8418 |
} else if (loopFocus) { |
| 8419 |
if (currentIndex <= minIndex) { |
| 8420 |
if (allowEscape && currentIndex !== -1) { |
| 8421 |
indexRef.current = listRef.current.length; |
| 8422 |
} else { |
| 8423 |
forceSyncFocusRef.current = false; |
| 8424 |
indexRef.current = maxIndex; |
| 8425 |
} |
| 8426 |
} else { |
| 8427 |
indexRef.current = findNonDisabledListIndex(listRef.current, { |
| 8428 |
startingIndex: currentIndex, |
| 8429 |
decrement: true, |
| 8430 |
disabledIndices |
| 8431 |
}); |
| 8432 |
} |
| 8433 |
} else { |
| 8434 |
indexRef.current = Math.max(minIndex, findNonDisabledListIndex(listRef.current, { |
| 8435 |
startingIndex: currentIndex, |
| 8436 |
decrement: true, |
| 8437 |
disabledIndices |
| 8438 |
})); |
| 8439 |
} |
| 8440 |
if (isIndexOutOfListBounds(listRef.current, indexRef.current)) { |
| 8441 |
indexRef.current = -1; |
| 8442 |
} |
| 8443 |
onNavigate(event); |
| 8444 |
} |
| 8445 |
}); |
| 8446 |
const item = React38.useMemo(() => { |
| 8447 |
const itemProps = { |
| 8448 |
onFocus(event) { |
| 8449 |
forceSyncFocusRef.current = true; |
| 8450 |
syncCurrentTarget(event); |
| 8451 |
}, |
| 8452 |
onClick: ({ |
| 8453 |
currentTarget |
| 8454 |
}) => currentTarget.focus({ |
| 8455 |
preventScroll: true |
| 8456 |
}), |
| 8457 |
// Safari |
| 8458 |
onMouseMove(event) { |
| 8459 |
forceSyncFocusRef.current = true; |
| 8460 |
forceScrollIntoViewRef.current = false; |
| 8461 |
if (focusItemOnHover) { |
| 8462 |
syncCurrentTarget(event); |
| 8463 |
} |
| 8464 |
}, |
| 8465 |
onPointerLeave(event) { |
| 8466 |
if (!latestOpenRef.current || !isPointerModalityRef.current || event.pointerType === "touch") { |
| 8467 |
return; |
| 8468 |
} |
| 8469 |
forceSyncFocusRef.current = true; |
| 8470 |
const relatedTarget = event.relatedTarget; |
| 8471 |
if (!focusItemOnHover || listRef.current.includes(relatedTarget)) { |
| 8472 |
return; |
| 8473 |
} |
| 8474 |
if (!resetOnPointerLeaveRef.current) { |
| 8475 |
return; |
| 8476 |
} |
| 8477 |
cancelQueuedFocusRef.current?.(); |
| 8478 |
cancelQueuedFocusRef.current = null; |
| 8479 |
indexRef.current = -1; |
| 8480 |
onNavigate(event); |
| 8481 |
if (!virtual) { |
| 8482 |
const floatingFocusEl = floatingFocusElementRef.current; |
| 8483 |
const activeEl = activeElement(ownerDocument(floatingFocusEl)); |
| 8484 |
if (floatingFocusEl && contains(floatingFocusEl, activeEl)) { |
| 8485 |
floatingFocusEl.focus({ |
| 8486 |
preventScroll: true |
| 8487 |
}); |
| 8488 |
} |
| 8489 |
} |
| 8490 |
} |
| 8491 |
}; |
| 8492 |
return itemProps; |
| 8493 |
}, [syncCurrentTarget, latestOpenRef, floatingFocusElementRef, focusItemOnHover, listRef, onNavigate, resetOnPointerLeaveRef, virtual]); |
| 8494 |
const ariaActiveDescendantProp = React38.useMemo(() => { |
| 8495 |
return virtual && open && hasActiveIndex && { |
| 8496 |
"aria-activedescendant": `${id}-${activeIndex}` |
| 8497 |
}; |
| 8498 |
}, [virtual, open, hasActiveIndex, id, activeIndex]); |
| 8499 |
const floating = React38.useMemo(() => { |
| 8500 |
return { |
| 8501 |
"aria-orientation": orientation === "both" ? void 0 : orientation, |
| 8502 |
...!typeableComboboxReference ? ariaActiveDescendantProp : {}, |
| 8503 |
onKeyDown(event) { |
| 8504 |
if (event.key === "Tab" && event.shiftKey && open && !virtual) { |
| 8505 |
const target = getTarget(event.nativeEvent); |
| 8506 |
if (target && !contains(floatingFocusElementRef.current, target)) { |
| 8507 |
return; |
| 8508 |
} |
| 8509 |
stopEvent(event); |
| 8510 |
store.setOpen(false, createChangeEventDetails(reason_parts_exports.focusOut, event.nativeEvent)); |
| 8511 |
if (isHTMLElement(domReferenceElement)) { |
| 8512 |
domReferenceElement.focus(); |
| 8513 |
} |
| 8514 |
return; |
| 8515 |
} |
| 8516 |
commonOnKeyDown(event); |
| 8517 |
}, |
| 8518 |
onPointerMove() { |
| 8519 |
isPointerModalityRef.current = true; |
| 8520 |
} |
| 8521 |
}; |
| 8522 |
}, [ariaActiveDescendantProp, commonOnKeyDown, floatingFocusElementRef, orientation, typeableComboboxReference, store, open, virtual, domReferenceElement]); |
| 8523 |
const trigger = React38.useMemo(() => { |
| 8524 |
function openOnNavigationKeyDown(event) { |
| 8525 |
store.setOpen(true, createChangeEventDetails(reason_parts_exports.listNavigation, event.nativeEvent, event.currentTarget)); |
| 8526 |
} |
| 8527 |
function checkVirtualMouse(event) { |
| 8528 |
if (focusItemOnOpen === "auto" && isVirtualClick(event.nativeEvent)) { |
| 8529 |
focusItemOnOpenRef.current = !virtual; |
| 8530 |
} |
| 8531 |
} |
| 8532 |
function checkVirtualPointer(event) { |
| 8533 |
focusItemOnOpenRef.current = focusItemOnOpen; |
| 8534 |
if (focusItemOnOpen === "auto" && isVirtualPointerEvent(event.nativeEvent)) { |
| 8535 |
focusItemOnOpenRef.current = true; |
| 8536 |
} |
| 8537 |
} |
| 8538 |
return { |
| 8539 |
onKeyDown(event) { |
| 8540 |
const currentOpen = store.select("open"); |
| 8541 |
isPointerModalityRef.current = false; |
| 8542 |
const isArrowKey = event.key.startsWith("Arrow"); |
| 8543 |
const isParentCrossOpenKey = isCrossOrientationOpenKey(event.key, getParentOrientation(), rtl); |
| 8544 |
const isMainKey = isMainOrientationKey(event.key, orientation); |
| 8545 |
const isNavigationKey = (nested ? isParentCrossOpenKey : isMainKey) || event.key === "Enter" || event.key.trim() === ""; |
| 8546 |
if (virtual && currentOpen) { |
| 8547 |
return commonOnKeyDown(event); |
| 8548 |
} |
| 8549 |
if (!currentOpen && !openOnArrowKeyDown && isArrowKey) { |
| 8550 |
return void 0; |
| 8551 |
} |
| 8552 |
if (isNavigationKey) { |
| 8553 |
const isParentMainKey = isMainOrientationKey(event.key, getParentOrientation()); |
| 8554 |
keyRef.current = nested && isParentMainKey ? null : event.key; |
| 8555 |
} |
| 8556 |
if (nested) { |
| 8557 |
if (isParentCrossOpenKey) { |
| 8558 |
stopEvent(event); |
| 8559 |
if (currentOpen) { |
| 8560 |
indexRef.current = getMinEnabledIndex(); |
| 8561 |
onNavigate(event); |
| 8562 |
} else { |
| 8563 |
openOnNavigationKeyDown(event); |
| 8564 |
} |
| 8565 |
} |
| 8566 |
return void 0; |
| 8567 |
} |
| 8568 |
if (isMainKey) { |
| 8569 |
if (selectedIndexRef.current != null) { |
| 8570 |
indexRef.current = selectedIndexRef.current; |
| 8571 |
} |
| 8572 |
stopEvent(event); |
| 8573 |
if (!currentOpen && openOnArrowKeyDown) { |
| 8574 |
openOnNavigationKeyDown(event); |
| 8575 |
} else { |
| 8576 |
commonOnKeyDown(event); |
| 8577 |
} |
| 8578 |
if (currentOpen) { |
| 8579 |
onNavigate(event); |
| 8580 |
} |
| 8581 |
} |
| 8582 |
return void 0; |
| 8583 |
}, |
| 8584 |
onFocus(event) { |
| 8585 |
if (store.select("open") && !virtual) { |
| 8586 |
indexRef.current = -1; |
| 8587 |
onNavigate(event); |
| 8588 |
} |
| 8589 |
}, |
| 8590 |
onPointerDown: checkVirtualPointer, |
| 8591 |
onPointerEnter: checkVirtualPointer, |
| 8592 |
onMouseDown: checkVirtualMouse, |
| 8593 |
onClick: checkVirtualMouse |
| 8594 |
}; |
| 8595 |
}, [commonOnKeyDown, focusItemOnOpen, getMinEnabledIndex, nested, onNavigate, store, openOnArrowKeyDown, orientation, getParentOrientation, rtl, selectedIndexRef, virtual]); |
| 8596 |
const reference = React38.useMemo(() => { |
| 8597 |
return { |
| 8598 |
...ariaActiveDescendantProp, |
| 8599 |
...trigger |
| 8600 |
}; |
| 8601 |
}, [ariaActiveDescendantProp, trigger]); |
| 8602 |
return React38.useMemo(() => enabled ? { |
| 8603 |
reference, |
| 8604 |
floating, |
| 8605 |
item, |
| 8606 |
trigger |
| 8607 |
} : {}, [enabled, reference, floating, trigger, item]); |
| 8608 |
} |
| 8609 |
|
| 8610 |
// node_modules/@base-ui/react/esm/floating-ui-react/hooks/useTypeahead.js |
| 8611 |
var React39 = __toESM(require_react(), 1); |
| 8612 |
function useTypeahead(context, props) { |
| 8613 |
const { |
| 8614 |
listRef, |
| 8615 |
elementsRef, |
| 8616 |
activeIndex, |
| 8617 |
onMatch: onMatchProp, |
| 8618 |
onTyping, |
| 8619 |
enabled = true, |
| 8620 |
resetMs = 750, |
| 8621 |
selectedIndex = null |
| 8622 |
} = props; |
| 8623 |
const store = "rootStore" in context ? context.rootStore : context; |
| 8624 |
const open = store.useState("open"); |
| 8625 |
const timeout = useTimeout(); |
| 8626 |
const stringRef = React39.useRef(""); |
| 8627 |
const prevIndexRef = React39.useRef(selectedIndex ?? activeIndex ?? -1); |
| 8628 |
const matchIndexRef = React39.useRef(null); |
| 8629 |
const onKeyDown = useStableCallback((event) => { |
| 8630 |
function isVisible(index3) { |
| 8631 |
const element = elementsRef?.current[index3]; |
| 8632 |
return !element || isElementVisible(element); |
| 8633 |
} |
| 8634 |
function getMatchingIndex(list, string, startIndex2 = 0) { |
| 8635 |
if (list.length === 0) { |
| 8636 |
return -1; |
| 8637 |
} |
| 8638 |
const normalizedStartIndex = (startIndex2 % list.length + list.length) % list.length; |
| 8639 |
const lowerString = string.toLocaleLowerCase(); |
| 8640 |
for (let offset4 = 0; offset4 < list.length; offset4 += 1) { |
| 8641 |
const index3 = (normalizedStartIndex + offset4) % list.length; |
| 8642 |
const text = list[index3]; |
| 8643 |
if (!text?.toLocaleLowerCase().startsWith(lowerString) || !isVisible(index3)) { |
| 8644 |
continue; |
| 8645 |
} |
| 8646 |
return index3; |
| 8647 |
} |
| 8648 |
return -1; |
| 8649 |
} |
| 8650 |
const listContent = listRef.current; |
| 8651 |
if (stringRef.current.length > 0 && event.key === " ") { |
| 8652 |
stopEvent(event); |
| 8653 |
onTyping?.(true); |
| 8654 |
} |
| 8655 |
if (stringRef.current.length > 0 && stringRef.current[0] !== " ") { |
| 8656 |
if (getMatchingIndex(listContent, stringRef.current) === -1 && event.key !== " ") { |
| 8657 |
onTyping?.(false); |
| 8658 |
} |
| 8659 |
} |
| 8660 |
if (listContent == null || // Character key. |
| 8661 |
event.key.length !== 1 || // Modifier key. |
| 8662 |
event.ctrlKey || event.metaKey || event.altKey) { |
| 8663 |
return; |
| 8664 |
} |
| 8665 |
if (open && event.key !== " ") { |
| 8666 |
stopEvent(event); |
| 8667 |
onTyping?.(true); |
| 8668 |
} |
| 8669 |
const isNewSession = stringRef.current === ""; |
| 8670 |
if (isNewSession) { |
| 8671 |
prevIndexRef.current = selectedIndex ?? activeIndex ?? -1; |
| 8672 |
} |
| 8673 |
const allowRapidSuccessionOfFirstLetter = listContent.every((text) => text ? text[0]?.toLocaleLowerCase() !== text[1]?.toLocaleLowerCase() : true); |
| 8674 |
if (allowRapidSuccessionOfFirstLetter && stringRef.current === event.key) { |
| 8675 |
stringRef.current = ""; |
| 8676 |
prevIndexRef.current = matchIndexRef.current; |
| 8677 |
} |
| 8678 |
stringRef.current += event.key; |
| 8679 |
timeout.start(resetMs, () => { |
| 8680 |
stringRef.current = ""; |
| 8681 |
prevIndexRef.current = matchIndexRef.current; |
| 8682 |
onTyping?.(false); |
| 8683 |
}); |
| 8684 |
const prevIndex = isNewSession ? selectedIndex ?? activeIndex ?? -1 : prevIndexRef.current; |
| 8685 |
const startIndex = (prevIndex ?? 0) + 1; |
| 8686 |
const index2 = getMatchingIndex(listContent, stringRef.current, startIndex); |
| 8687 |
if (index2 !== -1) { |
| 8688 |
onMatchProp?.(index2); |
| 8689 |
matchIndexRef.current = index2; |
| 8690 |
} else if (event.key !== " ") { |
| 8691 |
stringRef.current = ""; |
| 8692 |
onTyping?.(false); |
| 8693 |
} |
| 8694 |
}); |
| 8695 |
const onBlur = useStableCallback((event) => { |
| 8696 |
const next = event.relatedTarget; |
| 8697 |
const currentDomReferenceElement = store.select("domReferenceElement"); |
| 8698 |
const currentFloatingElement = store.select("floatingElement"); |
| 8699 |
const withinComposite = contains(currentDomReferenceElement, next) || contains(currentFloatingElement, next); |
| 8700 |
if (withinComposite) { |
| 8701 |
return; |
| 8702 |
} |
| 8703 |
timeout.clear(); |
| 8704 |
stringRef.current = ""; |
| 8705 |
prevIndexRef.current = matchIndexRef.current; |
| 8706 |
onTyping?.(false); |
| 8707 |
}); |
| 8708 |
useIsoLayoutEffect(() => { |
| 8709 |
if (!open && selectedIndex !== null) { |
| 8710 |
return; |
| 8711 |
} |
| 8712 |
timeout.clear(); |
| 8713 |
matchIndexRef.current = null; |
| 8714 |
if (stringRef.current !== "") { |
| 8715 |
stringRef.current = ""; |
| 8716 |
} |
| 8717 |
}, [open, selectedIndex, timeout]); |
| 8718 |
useIsoLayoutEffect(() => { |
| 8719 |
if (open && stringRef.current === "") { |
| 8720 |
prevIndexRef.current = selectedIndex ?? activeIndex ?? -1; |
| 8721 |
} |
| 8722 |
}, [open, selectedIndex, activeIndex]); |
| 8723 |
const sharedProps = React39.useMemo(() => ({ |
| 8724 |
onKeyDown, |
| 8725 |
onBlur |
| 8726 |
}), [onKeyDown, onBlur]); |
| 8727 |
return React39.useMemo(() => enabled ? { |
| 8728 |
reference: sharedProps, |
| 8729 |
floating: sharedProps |
| 8730 |
} : {}, [enabled, sharedProps]); |
| 8731 |
} |
| 8732 |
|
| 8733 |
// node_modules/@base-ui/react/esm/floating-ui-react/safePolygon.js |
| 8734 |
var CURSOR_SPEED_THRESHOLD = 0.1; |
| 8735 |
var CURSOR_SPEED_THRESHOLD_SQUARED = CURSOR_SPEED_THRESHOLD * CURSOR_SPEED_THRESHOLD; |
| 8736 |
var POLYGON_BUFFER = 0.5; |
| 8737 |
function hasIntersectingEdge(pointX, pointY, xi, yi, xj, yj) { |
| 8738 |
return yi >= pointY !== yj >= pointY && pointX <= (xj - xi) * (pointY - yi) / (yj - yi) + xi; |
| 8739 |
} |
| 8740 |
function isPointInQuadrilateral(pointX, pointY, x1, y1, x2, y2, x3, y3, x4, y4) { |
| 8741 |
let isInsideValue = false; |
| 8742 |
if (hasIntersectingEdge(pointX, pointY, x1, y1, x2, y2)) { |
| 8743 |
isInsideValue = !isInsideValue; |
| 8744 |
} |
| 8745 |
if (hasIntersectingEdge(pointX, pointY, x2, y2, x3, y3)) { |
| 8746 |
isInsideValue = !isInsideValue; |
| 8747 |
} |
| 8748 |
if (hasIntersectingEdge(pointX, pointY, x3, y3, x4, y4)) { |
| 8749 |
isInsideValue = !isInsideValue; |
| 8750 |
} |
| 8751 |
if (hasIntersectingEdge(pointX, pointY, x4, y4, x1, y1)) { |
| 8752 |
isInsideValue = !isInsideValue; |
| 8753 |
} |
| 8754 |
return isInsideValue; |
| 8755 |
} |
| 8756 |
function isInsideRect(pointX, pointY, rect) { |
| 8757 |
return pointX >= rect.x && pointX <= rect.x + rect.width && pointY >= rect.y && pointY <= rect.y + rect.height; |
| 8758 |
} |
| 8759 |
function isInsideAxisAlignedRect(pointX, pointY, x1, y1, x2, y2) { |
| 8760 |
const minX = Math.min(x1, x2); |
| 8761 |
const maxX = Math.max(x1, x2); |
| 8762 |
const minY = Math.min(y1, y2); |
| 8763 |
const maxY = Math.max(y1, y2); |
| 8764 |
return pointX >= minX && pointX <= maxX && pointY >= minY && pointY <= maxY; |
| 8765 |
} |
| 8766 |
function safePolygon(options = {}) { |
| 8767 |
const { |
| 8768 |
blockPointerEvents = false |
| 8769 |
} = options; |
| 8770 |
const timeout = new Timeout(); |
| 8771 |
const fn = ({ |
| 8772 |
x, |
| 8773 |
y, |
| 8774 |
placement, |
| 8775 |
elements, |
| 8776 |
onClose, |
| 8777 |
nodeId, |
| 8778 |
tree |
| 8779 |
}) => { |
| 8780 |
const side = placement?.split("-")[0]; |
| 8781 |
let hasLanded = false; |
| 8782 |
let lastX = null; |
| 8783 |
let lastY = null; |
| 8784 |
let lastCursorTime = typeof performance !== "undefined" ? performance.now() : 0; |
| 8785 |
function isCursorMovingSlowly(nextX, nextY) { |
| 8786 |
const currentTime = performance.now(); |
| 8787 |
const elapsedTime = currentTime - lastCursorTime; |
| 8788 |
if (lastX === null || lastY === null || elapsedTime === 0) { |
| 8789 |
lastX = nextX; |
| 8790 |
lastY = nextY; |
| 8791 |
lastCursorTime = currentTime; |
| 8792 |
return false; |
| 8793 |
} |
| 8794 |
const deltaX = nextX - lastX; |
| 8795 |
const deltaY = nextY - lastY; |
| 8796 |
const distanceSquared = deltaX * deltaX + deltaY * deltaY; |
| 8797 |
const thresholdSquared = elapsedTime * elapsedTime * CURSOR_SPEED_THRESHOLD_SQUARED; |
| 8798 |
lastX = nextX; |
| 8799 |
lastY = nextY; |
| 8800 |
lastCursorTime = currentTime; |
| 8801 |
return distanceSquared < thresholdSquared; |
| 8802 |
} |
| 8803 |
function close() { |
| 8804 |
timeout.clear(); |
| 8805 |
onClose(); |
| 8806 |
} |
| 8807 |
return function onMouseMove(event) { |
| 8808 |
timeout.clear(); |
| 8809 |
const domReference = elements.domReference; |
| 8810 |
const floating = elements.floating; |
| 8811 |
if (!domReference || !floating || side == null || x == null || y == null) { |
| 8812 |
return void 0; |
| 8813 |
} |
| 8814 |
const { |
| 8815 |
clientX, |
| 8816 |
clientY |
| 8817 |
} = event; |
| 8818 |
const target = getTarget(event); |
| 8819 |
const isLeave = event.type === "mouseleave"; |
| 8820 |
const isOverFloatingEl = contains(floating, target); |
| 8821 |
const isOverReferenceEl = contains(domReference, target); |
| 8822 |
if (isOverFloatingEl) { |
| 8823 |
hasLanded = true; |
| 8824 |
if (!isLeave) { |
| 8825 |
return void 0; |
| 8826 |
} |
| 8827 |
} |
| 8828 |
if (isOverReferenceEl) { |
| 8829 |
hasLanded = false; |
| 8830 |
if (!isLeave) { |
| 8831 |
hasLanded = true; |
| 8832 |
return void 0; |
| 8833 |
} |
| 8834 |
} |
| 8835 |
if (isLeave && isElement(event.relatedTarget) && contains(floating, event.relatedTarget)) { |
| 8836 |
return void 0; |
| 8837 |
} |
| 8838 |
function hasOpenChildNode() { |
| 8839 |
return Boolean(tree && getNodeChildren(tree.nodesRef.current, nodeId).length > 0); |
| 8840 |
} |
| 8841 |
function closeIfNoOpenChild() { |
| 8842 |
if (!hasOpenChildNode()) { |
| 8843 |
close(); |
| 8844 |
} |
| 8845 |
} |
| 8846 |
if (hasOpenChildNode()) { |
| 8847 |
return void 0; |
| 8848 |
} |
| 8849 |
const refRect = domReference.getBoundingClientRect(); |
| 8850 |
const rect = floating.getBoundingClientRect(); |
| 8851 |
const cursorLeaveFromRight = x > rect.right - rect.width / 2; |
| 8852 |
const cursorLeaveFromBottom = y > rect.bottom - rect.height / 2; |
| 8853 |
const isFloatingWider = rect.width > refRect.width; |
| 8854 |
const isFloatingTaller = rect.height > refRect.height; |
| 8855 |
const left = (isFloatingWider ? refRect : rect).left; |
| 8856 |
const right = (isFloatingWider ? refRect : rect).right; |
| 8857 |
const top = (isFloatingTaller ? refRect : rect).top; |
| 8858 |
const bottom = (isFloatingTaller ? refRect : rect).bottom; |
| 8859 |
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) { |
| 8860 |
closeIfNoOpenChild(); |
| 8861 |
return void 0; |
| 8862 |
} |
| 8863 |
let isInsideTroughRect = false; |
| 8864 |
switch (side) { |
| 8865 |
case "top": |
| 8866 |
isInsideTroughRect = isInsideAxisAlignedRect(clientX, clientY, left, refRect.top + 1, right, rect.bottom - 1); |
| 8867 |
break; |
| 8868 |
case "bottom": |
| 8869 |
isInsideTroughRect = isInsideAxisAlignedRect(clientX, clientY, left, rect.top + 1, right, refRect.bottom - 1); |
| 8870 |
break; |
| 8871 |
case "left": |
| 8872 |
isInsideTroughRect = isInsideAxisAlignedRect(clientX, clientY, rect.right - 1, bottom, refRect.left + 1, top); |
| 8873 |
break; |
| 8874 |
case "right": |
| 8875 |
isInsideTroughRect = isInsideAxisAlignedRect(clientX, clientY, refRect.right - 1, bottom, rect.left + 1, top); |
| 8876 |
break; |
| 8877 |
default: |
| 8878 |
} |
| 8879 |
if (isInsideTroughRect) { |
| 8880 |
return void 0; |
| 8881 |
} |
| 8882 |
if (hasLanded && !isInsideRect(clientX, clientY, refRect)) { |
| 8883 |
closeIfNoOpenChild(); |
| 8884 |
return void 0; |
| 8885 |
} |
| 8886 |
if (!isLeave && isCursorMovingSlowly(clientX, clientY)) { |
| 8887 |
closeIfNoOpenChild(); |
| 8888 |
return void 0; |
| 8889 |
} |
| 8890 |
let isInsidePolygon = false; |
| 8891 |
switch (side) { |
| 8892 |
case "top": { |
| 8893 |
const cursorXOffset = isFloatingWider ? POLYGON_BUFFER / 2 : POLYGON_BUFFER * 4; |
| 8894 |
const cursorPointOneX = isFloatingWider ? x + cursorXOffset : cursorLeaveFromRight ? x + cursorXOffset : x - cursorXOffset; |
| 8895 |
const cursorPointTwoX = isFloatingWider ? x - cursorXOffset : cursorLeaveFromRight ? x + cursorXOffset : x - cursorXOffset; |
| 8896 |
const cursorPointY = y + POLYGON_BUFFER + 1; |
| 8897 |
const commonYLeft = cursorLeaveFromRight ? rect.bottom - POLYGON_BUFFER : isFloatingWider ? rect.bottom - POLYGON_BUFFER : rect.top; |
| 8898 |
const commonYRight = cursorLeaveFromRight ? isFloatingWider ? rect.bottom - POLYGON_BUFFER : rect.top : rect.bottom - POLYGON_BUFFER; |
| 8899 |
isInsidePolygon = isPointInQuadrilateral(clientX, clientY, cursorPointOneX, cursorPointY, cursorPointTwoX, cursorPointY, rect.left, commonYLeft, rect.right, commonYRight); |
| 8900 |
break; |
| 8901 |
} |
| 8902 |
case "bottom": { |
| 8903 |
const cursorXOffset = isFloatingWider ? POLYGON_BUFFER / 2 : POLYGON_BUFFER * 4; |
| 8904 |
const cursorPointOneX = isFloatingWider ? x + cursorXOffset : cursorLeaveFromRight ? x + cursorXOffset : x - cursorXOffset; |
| 8905 |
const cursorPointTwoX = isFloatingWider ? x - cursorXOffset : cursorLeaveFromRight ? x + cursorXOffset : x - cursorXOffset; |
| 8906 |
const cursorPointY = y - POLYGON_BUFFER; |
| 8907 |
const commonYLeft = cursorLeaveFromRight ? rect.top + POLYGON_BUFFER : isFloatingWider ? rect.top + POLYGON_BUFFER : rect.bottom; |
| 8908 |
const commonYRight = cursorLeaveFromRight ? isFloatingWider ? rect.top + POLYGON_BUFFER : rect.bottom : rect.top + POLYGON_BUFFER; |
| 8909 |
isInsidePolygon = isPointInQuadrilateral(clientX, clientY, cursorPointOneX, cursorPointY, cursorPointTwoX, cursorPointY, rect.left, commonYLeft, rect.right, commonYRight); |
| 8910 |
break; |
| 8911 |
} |
| 8912 |
case "left": { |
| 8913 |
const cursorYOffset = isFloatingTaller ? POLYGON_BUFFER / 2 : POLYGON_BUFFER * 4; |
| 8914 |
const cursorPointOneY = isFloatingTaller ? y + cursorYOffset : cursorLeaveFromBottom ? y + cursorYOffset : y - cursorYOffset; |
| 8915 |
const cursorPointTwoY = isFloatingTaller ? y - cursorYOffset : cursorLeaveFromBottom ? y + cursorYOffset : y - cursorYOffset; |
| 8916 |
const cursorPointX = x + POLYGON_BUFFER + 1; |
| 8917 |
const commonXTop = cursorLeaveFromBottom ? rect.right - POLYGON_BUFFER : isFloatingTaller ? rect.right - POLYGON_BUFFER : rect.left; |
| 8918 |
const commonXBottom = cursorLeaveFromBottom ? isFloatingTaller ? rect.right - POLYGON_BUFFER : rect.left : rect.right - POLYGON_BUFFER; |
| 8919 |
isInsidePolygon = isPointInQuadrilateral(clientX, clientY, commonXTop, rect.top, commonXBottom, rect.bottom, cursorPointX, cursorPointOneY, cursorPointX, cursorPointTwoY); |
| 8920 |
break; |
| 8921 |
} |
| 8922 |
case "right": { |
| 8923 |
const cursorYOffset = isFloatingTaller ? POLYGON_BUFFER / 2 : POLYGON_BUFFER * 4; |
| 8924 |
const cursorPointOneY = isFloatingTaller ? y + cursorYOffset : cursorLeaveFromBottom ? y + cursorYOffset : y - cursorYOffset; |
| 8925 |
const cursorPointTwoY = isFloatingTaller ? y - cursorYOffset : cursorLeaveFromBottom ? y + cursorYOffset : y - cursorYOffset; |
| 8926 |
const cursorPointX = x - POLYGON_BUFFER; |
| 8927 |
const commonXTop = cursorLeaveFromBottom ? rect.left + POLYGON_BUFFER : isFloatingTaller ? rect.left + POLYGON_BUFFER : rect.right; |
| 8928 |
const commonXBottom = cursorLeaveFromBottom ? isFloatingTaller ? rect.left + POLYGON_BUFFER : rect.right : rect.left + POLYGON_BUFFER; |
| 8929 |
isInsidePolygon = isPointInQuadrilateral(clientX, clientY, cursorPointX, cursorPointOneY, cursorPointX, cursorPointTwoY, commonXTop, rect.top, commonXBottom, rect.bottom); |
| 8930 |
break; |
| 8931 |
} |
| 8932 |
default: |
| 8933 |
} |
| 8934 |
if (!isInsidePolygon) { |
| 8935 |
closeIfNoOpenChild(); |
| 8936 |
} else if (!hasLanded) { |
| 8937 |
timeout.start(40, closeIfNoOpenChild); |
| 8938 |
} |
| 8939 |
return void 0; |
| 8940 |
}; |
| 8941 |
}; |
| 8942 |
fn.__options = { |
| 8943 |
...options, |
| 8944 |
blockPointerEvents |
| 8945 |
}; |
| 8946 |
return fn; |
| 8947 |
} |
| 8948 |
|
| 8949 |
// node_modules/@base-ui/react/esm/utils/popupStateMapping.js |
| 8950 |
var CommonPopupDataAttributes = (function(CommonPopupDataAttributes2) { |
| 8951 |
CommonPopupDataAttributes2["open"] = "data-open"; |
| 8952 |
CommonPopupDataAttributes2["closed"] = "data-closed"; |
| 8953 |
CommonPopupDataAttributes2[CommonPopupDataAttributes2["startingStyle"] = TransitionStatusDataAttributes.startingStyle] = "startingStyle"; |
| 8954 |
CommonPopupDataAttributes2[CommonPopupDataAttributes2["endingStyle"] = TransitionStatusDataAttributes.endingStyle] = "endingStyle"; |
| 8955 |
CommonPopupDataAttributes2["anchorHidden"] = "data-anchor-hidden"; |
| 8956 |
CommonPopupDataAttributes2["side"] = "data-side"; |
| 8957 |
CommonPopupDataAttributes2["align"] = "data-align"; |
| 8958 |
return CommonPopupDataAttributes2; |
| 8959 |
})({}); |
| 8960 |
var CommonTriggerDataAttributes = /* @__PURE__ */ (function(CommonTriggerDataAttributes2) { |
| 8961 |
CommonTriggerDataAttributes2["popupOpen"] = "data-popup-open"; |
| 8962 |
CommonTriggerDataAttributes2["pressed"] = "data-pressed"; |
| 8963 |
return CommonTriggerDataAttributes2; |
| 8964 |
})({}); |
| 8965 |
var TRIGGER_HOOK = { |
| 8966 |
[CommonTriggerDataAttributes.popupOpen]: "" |
| 8967 |
}; |
| 8968 |
var PRESSABLE_TRIGGER_HOOK = { |
| 8969 |
[CommonTriggerDataAttributes.popupOpen]: "", |
| 8970 |
[CommonTriggerDataAttributes.pressed]: "" |
| 8971 |
}; |
| 8972 |
var POPUP_OPEN_HOOK = { |
| 8973 |
[CommonPopupDataAttributes.open]: "" |
| 8974 |
}; |
| 8975 |
var POPUP_CLOSED_HOOK = { |
| 8976 |
[CommonPopupDataAttributes.closed]: "" |
| 8977 |
}; |
| 8978 |
var ANCHOR_HIDDEN_HOOK = { |
| 8979 |
[CommonPopupDataAttributes.anchorHidden]: "" |
| 8980 |
}; |
| 8981 |
var triggerOpenStateMapping = { |
| 8982 |
open(value) { |
| 8983 |
if (value) { |
| 8984 |
return TRIGGER_HOOK; |
| 8985 |
} |
| 8986 |
return null; |
| 8987 |
} |
| 8988 |
}; |
| 8989 |
var pressableTriggerOpenStateMapping = { |
| 8990 |
open(value) { |
| 8991 |
if (value) { |
| 8992 |
return PRESSABLE_TRIGGER_HOOK; |
| 8993 |
} |
| 8994 |
return null; |
| 8995 |
} |
| 8996 |
}; |
| 8997 |
var popupStateMapping = { |
| 8998 |
open(value) { |
| 8999 |
if (value) { |
| 9000 |
return POPUP_OPEN_HOOK; |
| 9001 |
} |
| 9002 |
return POPUP_CLOSED_HOOK; |
| 9003 |
}, |
| 9004 |
anchorHidden(value) { |
| 9005 |
if (value) { |
| 9006 |
return ANCHOR_HIDDEN_HOOK; |
| 9007 |
} |
| 9008 |
return null; |
| 9009 |
} |
| 9010 |
}; |
| 9011 |
|
| 9012 |
// node_modules/@base-ui/utils/esm/inertValue.js |
| 9013 |
function inertValue(value) { |
| 9014 |
if (isReactVersionAtLeast(19)) { |
| 9015 |
return value; |
| 9016 |
} |
| 9017 |
return value ? "true" : void 0; |
| 9018 |
} |
| 9019 |
|
| 9020 |
// node_modules/@base-ui/react/esm/utils/InternalBackdrop.js |
| 9021 |
var React40 = __toESM(require_react(), 1); |
| 9022 |
var import_jsx_runtime10 = __toESM(require_jsx_runtime(), 1); |
| 9023 |
var InternalBackdrop = /* @__PURE__ */ React40.forwardRef(function InternalBackdrop2(props, ref) { |
| 9024 |
const { |
| 9025 |
cutout, |
| 9026 |
...otherProps |
| 9027 |
} = props; |
| 9028 |
let clipPath; |
| 9029 |
if (cutout) { |
| 9030 |
const rect = cutout.getBoundingClientRect(); |
| 9031 |
clipPath = `polygon(0% 0%,100% 0%,100% 100%,0% 100%,0% 0%,${rect.left}px ${rect.top}px,${rect.left}px ${rect.bottom}px,${rect.right}px ${rect.bottom}px,${rect.right}px ${rect.top}px,${rect.left}px ${rect.top}px)`; |
| 9032 |
} |
| 9033 |
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { |
| 9034 |
ref, |
| 9035 |
role: "presentation", |
| 9036 |
"data-base-ui-inert": "", |
| 9037 |
...otherProps, |
| 9038 |
style: { |
| 9039 |
position: "fixed", |
| 9040 |
inset: 0, |
| 9041 |
userSelect: "none", |
| 9042 |
WebkitUserSelect: "none", |
| 9043 |
clipPath |
| 9044 |
} |
| 9045 |
}); |
| 9046 |
}); |
| 9047 |
if (true) InternalBackdrop.displayName = "InternalBackdrop"; |
| 9048 |
|
| 9049 |
// node_modules/@base-ui/react/esm/utils/useOpenInteractionType.js |
| 9050 |
var React43 = __toESM(require_react(), 1); |
| 9051 |
|
| 9052 |
// node_modules/@base-ui/utils/esm/useEnhancedClickHandler.js |
| 9053 |
var React41 = __toESM(require_react(), 1); |
| 9054 |
function useEnhancedClickHandler(handler) { |
| 9055 |
const lastClickInteractionTypeRef = React41.useRef(""); |
| 9056 |
const handlePointerDown = React41.useCallback((event) => { |
| 9057 |
if (event.defaultPrevented) { |
| 9058 |
return; |
| 9059 |
} |
| 9060 |
lastClickInteractionTypeRef.current = event.pointerType; |
| 9061 |
handler(event, event.pointerType); |
| 9062 |
}, [handler]); |
| 9063 |
const handleClick = React41.useCallback((event) => { |
| 9064 |
if (event.detail === 0) { |
| 9065 |
handler(event, "keyboard"); |
| 9066 |
return; |
| 9067 |
} |
| 9068 |
if ("pointerType" in event) { |
| 9069 |
handler(event, event.pointerType); |
| 9070 |
} else { |
| 9071 |
handler(event, lastClickInteractionTypeRef.current); |
| 9072 |
} |
| 9073 |
lastClickInteractionTypeRef.current = ""; |
| 9074 |
}, [handler]); |
| 9075 |
return { |
| 9076 |
onClick: handleClick, |
| 9077 |
onPointerDown: handlePointerDown |
| 9078 |
}; |
| 9079 |
} |
| 9080 |
|
| 9081 |
// node_modules/@base-ui/react/esm/internals/useValueChanged.js |
| 9082 |
var React42 = __toESM(require_react(), 1); |
| 9083 |
function useValueChanged(value, onChange) { |
| 9084 |
const valueRef = React42.useRef(value); |
| 9085 |
const onChangeCallback = useStableCallback(onChange); |
| 9086 |
useIsoLayoutEffect(() => { |
| 9087 |
if (valueRef.current === value) { |
| 9088 |
return; |
| 9089 |
} |
| 9090 |
onChangeCallback(valueRef.current); |
| 9091 |
}, [value, onChangeCallback]); |
| 9092 |
useIsoLayoutEffect(() => { |
| 9093 |
valueRef.current = value; |
| 9094 |
}, [value]); |
| 9095 |
} |
| 9096 |
|
| 9097 |
// node_modules/@base-ui/react/esm/utils/useOpenInteractionType.js |
| 9098 |
function useOpenMethodTriggerProps(open, setOpenMethod) { |
| 9099 |
const handleTriggerClick = useStableCallback((_, interactionType) => { |
| 9100 |
const isOpen = typeof open === "function" ? open() : open; |
| 9101 |
if (!isOpen) { |
| 9102 |
setOpenMethod(interactionType || // On iOS Safari, the hitslop around touch targets means tapping outside an element's |
| 9103 |
// bounds does not fire `pointerdown` but does fire `mousedown`. The `interactionType` |
| 9104 |
// will be "" in that case. |
| 9105 |
(isIOS ? "touch" : "")); |
| 9106 |
} |
| 9107 |
}); |
| 9108 |
const { |
| 9109 |
onClick, |
| 9110 |
onPointerDown |
| 9111 |
} = useEnhancedClickHandler(handleTriggerClick); |
| 9112 |
return React43.useMemo(() => ({ |
| 9113 |
onClick, |
| 9114 |
onPointerDown |
| 9115 |
}), [onClick, onPointerDown]); |
| 9116 |
} |
| 9117 |
function useOpenInteractionType(open) { |
| 9118 |
const [openMethod, setOpenMethod] = React43.useState(null); |
| 9119 |
const triggerProps = useOpenMethodTriggerProps(open, setOpenMethod); |
| 9120 |
useValueChanged(open, (previousOpen) => { |
| 9121 |
if (previousOpen && !open) { |
| 9122 |
setOpenMethod(null); |
| 9123 |
} |
| 9124 |
}); |
| 9125 |
return React43.useMemo(() => ({ |
| 9126 |
openMethod, |
| 9127 |
triggerProps |
| 9128 |
}), [openMethod, triggerProps]); |
| 9129 |
} |
| 9130 |
|
| 9131 |
// node_modules/@base-ui/react/esm/autocomplete/index.parts.js |
| 9132 |
var index_parts_exports = {}; |
| 9133 |
__export(index_parts_exports, { |
| 9134 |
Arrow: () => ComboboxArrow, |
| 9135 |
Backdrop: () => ComboboxBackdrop, |
| 9136 |
Clear: () => ComboboxClear, |
| 9137 |
Collection: () => ComboboxCollection, |
| 9138 |
Empty: () => ComboboxEmpty, |
| 9139 |
Group: () => ComboboxGroup, |
| 9140 |
GroupLabel: () => ComboboxGroupLabel, |
| 9141 |
Icon: () => ComboboxIcon, |
| 9142 |
Input: () => ComboboxInput, |
| 9143 |
InputGroup: () => AutocompleteInputGroup, |
| 9144 |
Item: () => AutocompleteItem, |
| 9145 |
List: () => ComboboxList, |
| 9146 |
Popup: () => ComboboxPopup, |
| 9147 |
Portal: () => ComboboxPortal, |
| 9148 |
Positioner: () => ComboboxPositioner, |
| 9149 |
Root: () => AutocompleteRoot, |
| 9150 |
Row: () => ComboboxRow, |
| 9151 |
Separator: () => Separator, |
| 9152 |
Status: () => ComboboxStatus, |
| 9153 |
Trigger: () => AutocompleteTrigger, |
| 9154 |
Value: () => AutocompleteValue, |
| 9155 |
useFilter: () => useCoreFilter, |
| 9156 |
useFilteredItems: () => useFilteredItems |
| 9157 |
}); |
| 9158 |
|
| 9159 |
// node_modules/@base-ui/react/esm/autocomplete/root/AutocompleteRoot.js |
| 9160 |
var React53 = __toESM(require_react(), 1); |
| 9161 |
|
| 9162 |
// node_modules/@base-ui/react/esm/combobox/root/AriaCombobox.js |
| 9163 |
var React52 = __toESM(require_react(), 1); |
| 9164 |
|
| 9165 |
// node_modules/@base-ui/react/esm/combobox/root/ComboboxRootContext.js |
| 9166 |
var React44 = __toESM(require_react(), 1); |
| 9167 |
var ComboboxRootContext = /* @__PURE__ */ React44.createContext(void 0); |
| 9168 |
if (true) ComboboxRootContext.displayName = "ComboboxRootContext"; |
| 9169 |
var ComboboxFloatingContext = /* @__PURE__ */ React44.createContext(void 0); |
| 9170 |
if (true) ComboboxFloatingContext.displayName = "ComboboxFloatingContext"; |
| 9171 |
var ComboboxDerivedItemsContext = /* @__PURE__ */ React44.createContext(void 0); |
| 9172 |
if (true) ComboboxDerivedItemsContext.displayName = "ComboboxDerivedItemsContext"; |
| 9173 |
var ComboboxInputValueContext = /* @__PURE__ */ React44.createContext(""); |
| 9174 |
if (true) ComboboxInputValueContext.displayName = "ComboboxInputValueContext"; |
| 9175 |
function useComboboxRootContext() { |
| 9176 |
const context = React44.useContext(ComboboxRootContext); |
| 9177 |
if (!context) { |
| 9178 |
throw new Error(true ? "Base UI: ComboboxRootContext is missing. Combobox parts must be placed within <Combobox.Root>." : formatErrorMessage_default(22)); |
| 9179 |
} |
| 9180 |
return context; |
| 9181 |
} |
| 9182 |
function useComboboxFloatingContext() { |
| 9183 |
const context = React44.useContext(ComboboxFloatingContext); |
| 9184 |
if (!context) { |
| 9185 |
throw new Error(true ? "Base UI: ComboboxFloatingContext is missing. Combobox parts must be placed within <Combobox.Root>." : formatErrorMessage_default(23)); |
| 9186 |
} |
| 9187 |
return context; |
| 9188 |
} |
| 9189 |
function useComboboxDerivedItemsContext() { |
| 9190 |
const context = React44.useContext(ComboboxDerivedItemsContext); |
| 9191 |
if (!context) { |
| 9192 |
throw new Error(true ? "Base UI: ComboboxItemsContext is missing. Combobox parts must be placed within <Combobox.Root>." : formatErrorMessage_default(24)); |
| 9193 |
} |
| 9194 |
return context; |
| 9195 |
} |
| 9196 |
function useComboboxInputValueContext() { |
| 9197 |
return React44.useContext(ComboboxInputValueContext); |
| 9198 |
} |
| 9199 |
|
| 9200 |
// node_modules/@base-ui/react/esm/internals/itemEquality.js |
| 9201 |
var defaultItemEquality = (itemValue, selectedValue) => Object.is(itemValue, selectedValue); |
| 9202 |
function compareItemEquality(itemValue, selectedValue, comparer) { |
| 9203 |
if (itemValue == null || selectedValue == null) { |
| 9204 |
return Object.is(itemValue, selectedValue); |
| 9205 |
} |
| 9206 |
return comparer(itemValue, selectedValue); |
| 9207 |
} |
| 9208 |
function selectedValueIncludes(selectedValues, itemValue, comparer) { |
| 9209 |
if (!selectedValues || selectedValues.length === 0) { |
| 9210 |
return false; |
| 9211 |
} |
| 9212 |
return selectedValues.some((selectedValue) => { |
| 9213 |
if (selectedValue === void 0) { |
| 9214 |
return false; |
| 9215 |
} |
| 9216 |
return compareItemEquality(itemValue, selectedValue, comparer); |
| 9217 |
}); |
| 9218 |
} |
| 9219 |
function findItemIndex(itemValues, selectedValue, comparer) { |
| 9220 |
if (!itemValues || itemValues.length === 0) { |
| 9221 |
return -1; |
| 9222 |
} |
| 9223 |
return itemValues.findIndex((itemValue) => { |
| 9224 |
if (itemValue === void 0) { |
| 9225 |
return false; |
| 9226 |
} |
| 9227 |
return compareItemEquality(itemValue, selectedValue, comparer); |
| 9228 |
}); |
| 9229 |
} |
| 9230 |
function removeItem(selectedValues, itemValue, comparer) { |
| 9231 |
return selectedValues.filter((selectedValue) => !compareItemEquality(itemValue, selectedValue, comparer)); |
| 9232 |
} |
| 9233 |
|
| 9234 |
// node_modules/@base-ui/react/esm/internals/resolveValueLabel.js |
| 9235 |
var React45 = __toESM(require_react(), 1); |
| 9236 |
|
| 9237 |
// node_modules/@base-ui/react/esm/internals/serializeValue.js |
| 9238 |
function serializeValue(value) { |
| 9239 |
if (value == null) { |
| 9240 |
return ""; |
| 9241 |
} |
| 9242 |
if (typeof value === "string") { |
| 9243 |
return value; |
| 9244 |
} |
| 9245 |
try { |
| 9246 |
return JSON.stringify(value); |
| 9247 |
} catch { |
| 9248 |
return String(value); |
| 9249 |
} |
| 9250 |
} |
| 9251 |
|
| 9252 |
// node_modules/@base-ui/react/esm/internals/resolveValueLabel.js |
| 9253 |
var import_jsx_runtime11 = __toESM(require_jsx_runtime(), 1); |
| 9254 |
function isGroupedItems(items) { |
| 9255 |
return items != null && items.length > 0 && typeof items[0] === "object" && items[0] != null && "items" in items[0]; |
| 9256 |
} |
| 9257 |
function hasNullItemLabel(items) { |
| 9258 |
if (!Array.isArray(items)) { |
| 9259 |
return items != null && "null" in items; |
| 9260 |
} |
| 9261 |
const arrayItems = items; |
| 9262 |
if (isGroupedItems(arrayItems)) { |
| 9263 |
for (const group of arrayItems) { |
| 9264 |
for (const item of group.items) { |
| 9265 |
if (item && item.value == null && item.label != null) { |
| 9266 |
return true; |
| 9267 |
} |
| 9268 |
} |
| 9269 |
} |
| 9270 |
return false; |
| 9271 |
} |
| 9272 |
for (const item of arrayItems) { |
| 9273 |
if (item && item.value == null && item.label != null) { |
| 9274 |
return true; |
| 9275 |
} |
| 9276 |
} |
| 9277 |
return false; |
| 9278 |
} |
| 9279 |
function stringifyAsLabel(item, itemToStringLabel) { |
| 9280 |
if (itemToStringLabel && item != null) { |
| 9281 |
return itemToStringLabel(item) ?? ""; |
| 9282 |
} |
| 9283 |
if (item && typeof item === "object") { |
| 9284 |
if ("label" in item && item.label != null) { |
| 9285 |
return String(item.label); |
| 9286 |
} |
| 9287 |
if ("value" in item) { |
| 9288 |
return String(item.value); |
| 9289 |
} |
| 9290 |
} |
| 9291 |
return serializeValue(item); |
| 9292 |
} |
| 9293 |
function stringifyAsValue(item, itemToStringValue) { |
| 9294 |
if (itemToStringValue && item != null) { |
| 9295 |
return itemToStringValue(item) ?? ""; |
| 9296 |
} |
| 9297 |
if (item && typeof item === "object" && "value" in item && "label" in item) { |
| 9298 |
return serializeValue(item.value); |
| 9299 |
} |
| 9300 |
return serializeValue(item); |
| 9301 |
} |
| 9302 |
|
| 9303 |
// node_modules/@base-ui/react/esm/combobox/store.js |
| 9304 |
var selectors2 = { |
| 9305 |
id: createSelector((state) => state.id), |
| 9306 |
labelId: createSelector((state) => state.labelId), |
| 9307 |
items: createSelector((state) => state.items), |
| 9308 |
selectedValue: createSelector((state) => state.selectedValue), |
| 9309 |
hasSelectionChips: createSelector((state) => { |
| 9310 |
const selectedValue = state.selectedValue; |
| 9311 |
return Array.isArray(selectedValue) && selectedValue.length > 0; |
| 9312 |
}), |
| 9313 |
hasSelectedValue: createSelector((state) => { |
| 9314 |
const { |
| 9315 |
selectedValue, |
| 9316 |
selectionMode |
| 9317 |
} = state; |
| 9318 |
if (selectedValue == null) { |
| 9319 |
return false; |
| 9320 |
} |
| 9321 |
if (selectionMode === "multiple" && Array.isArray(selectedValue)) { |
| 9322 |
return selectedValue.length > 0; |
| 9323 |
} |
| 9324 |
return true; |
| 9325 |
}), |
| 9326 |
hasNullItemLabel: createSelector((state, enabled) => { |
| 9327 |
return enabled ? hasNullItemLabel(state.items) : false; |
| 9328 |
}), |
| 9329 |
open: createSelector((state) => state.open), |
| 9330 |
mounted: createSelector((state) => state.mounted), |
| 9331 |
forceMounted: createSelector((state) => state.forceMounted), |
| 9332 |
inline: createSelector((state) => state.inline), |
| 9333 |
activeIndex: createSelector((state) => state.activeIndex), |
| 9334 |
selectedIndex: createSelector((state) => state.selectedIndex), |
| 9335 |
isActive: createSelector((state, index2) => state.activeIndex === index2), |
| 9336 |
isSelected: createSelector((state, itemValue) => { |
| 9337 |
const comparer = state.isItemEqualToValue; |
| 9338 |
const selectedValue = state.selectedValue; |
| 9339 |
if (Array.isArray(selectedValue)) { |
| 9340 |
return selectedValue.some((selectedItem) => compareItemEquality(itemValue, selectedItem, comparer)); |
| 9341 |
} |
| 9342 |
return compareItemEquality(itemValue, selectedValue, comparer); |
| 9343 |
}), |
| 9344 |
transitionStatus: createSelector((state) => state.transitionStatus), |
| 9345 |
popupProps: createSelector((state) => state.popupProps), |
| 9346 |
inputProps: createSelector((state) => state.inputProps), |
| 9347 |
triggerProps: createSelector((state) => state.triggerProps), |
| 9348 |
itemProps: createSelector((state) => state.itemProps), |
| 9349 |
positionerElement: createSelector((state) => state.positionerElement), |
| 9350 |
listElement: createSelector((state) => state.listElement), |
| 9351 |
triggerElement: createSelector((state) => state.triggerElement), |
| 9352 |
inputElement: createSelector((state) => state.inputElement), |
| 9353 |
inputGroupElement: createSelector((state) => state.inputGroupElement), |
| 9354 |
popupSide: createSelector((state) => state.popupSide), |
| 9355 |
openMethod: createSelector((state) => state.openMethod), |
| 9356 |
inputInsidePopup: createSelector((state) => state.inputInsidePopup), |
| 9357 |
inputOwnsFormValue: createSelector((state) => state.inputOwnsFormValue), |
| 9358 |
selectionMode: createSelector((state) => state.selectionMode), |
| 9359 |
name: createSelector((state) => state.name), |
| 9360 |
form: createSelector((state) => state.form), |
| 9361 |
disabled: createSelector((state) => state.disabled), |
| 9362 |
readOnly: createSelector((state) => state.readOnly), |
| 9363 |
required: createSelector((state) => state.required), |
| 9364 |
grid: createSelector((state) => state.grid), |
| 9365 |
virtualized: createSelector((state) => state.virtualized), |
| 9366 |
itemToStringLabel: createSelector((state) => state.itemToStringLabel), |
| 9367 |
isItemEqualToValue: createSelector((state) => state.isItemEqualToValue), |
| 9368 |
modal: createSelector((state) => state.modal), |
| 9369 |
autoHighlight: createSelector((state) => state.autoHighlight), |
| 9370 |
submitOnItemClick: createSelector((state) => state.submitOnItemClick) |
| 9371 |
}; |
| 9372 |
|
| 9373 |
// node_modules/@base-ui/react/esm/internals/field-root-context/FieldRootContext.js |
| 9374 |
var React46 = __toESM(require_react(), 1); |
| 9375 |
|
| 9376 |
// node_modules/@base-ui/react/esm/field/control/FieldControlDataAttributes.js |
| 9377 |
var FieldControlDataAttributes = /* @__PURE__ */ (function(FieldControlDataAttributes2) { |
| 9378 |
FieldControlDataAttributes2["disabled"] = "data-disabled"; |
| 9379 |
FieldControlDataAttributes2["valid"] = "data-valid"; |
| 9380 |
FieldControlDataAttributes2["invalid"] = "data-invalid"; |
| 9381 |
FieldControlDataAttributes2["touched"] = "data-touched"; |
| 9382 |
FieldControlDataAttributes2["dirty"] = "data-dirty"; |
| 9383 |
FieldControlDataAttributes2["filled"] = "data-filled"; |
| 9384 |
FieldControlDataAttributes2["focused"] = "data-focused"; |
| 9385 |
return FieldControlDataAttributes2; |
| 9386 |
})({}); |
| 9387 |
|
| 9388 |
// node_modules/@base-ui/react/esm/internals/field-constants/constants.js |
| 9389 |
var DEFAULT_VALIDITY_STATE = { |
| 9390 |
badInput: false, |
| 9391 |
customError: false, |
| 9392 |
patternMismatch: false, |
| 9393 |
rangeOverflow: false, |
| 9394 |
rangeUnderflow: false, |
| 9395 |
stepMismatch: false, |
| 9396 |
tooLong: false, |
| 9397 |
tooShort: false, |
| 9398 |
typeMismatch: false, |
| 9399 |
valid: null, |
| 9400 |
valueMissing: false |
| 9401 |
}; |
| 9402 |
var DEFAULT_FIELD_STATE_ATTRIBUTES = { |
| 9403 |
valid: null, |
| 9404 |
touched: false, |
| 9405 |
dirty: false, |
| 9406 |
filled: false, |
| 9407 |
focused: false |
| 9408 |
}; |
| 9409 |
var DEFAULT_FIELD_ROOT_STATE = { |
| 9410 |
disabled: false, |
| 9411 |
...DEFAULT_FIELD_STATE_ATTRIBUTES |
| 9412 |
}; |
| 9413 |
var fieldValidityMapping = { |
| 9414 |
valid(value) { |
| 9415 |
if (value === null) { |
| 9416 |
return null; |
| 9417 |
} |
| 9418 |
if (value) { |
| 9419 |
return { |
| 9420 |
[FieldControlDataAttributes.valid]: "" |
| 9421 |
}; |
| 9422 |
} |
| 9423 |
return { |
| 9424 |
[FieldControlDataAttributes.invalid]: "" |
| 9425 |
}; |
| 9426 |
} |
| 9427 |
}; |
| 9428 |
|
| 9429 |
// node_modules/@base-ui/react/esm/internals/field-root-context/FieldRootContext.js |
| 9430 |
var DEFAULT_FIELD_ROOT_CONTEXT = { |
| 9431 |
invalid: void 0, |
| 9432 |
name: void 0, |
| 9433 |
validityData: { |
| 9434 |
state: DEFAULT_VALIDITY_STATE, |
| 9435 |
errors: [], |
| 9436 |
error: "", |
| 9437 |
value: "", |
| 9438 |
initialValue: null |
| 9439 |
}, |
| 9440 |
setValidityData: NOOP, |
| 9441 |
disabled: void 0, |
| 9442 |
touched: DEFAULT_FIELD_STATE_ATTRIBUTES.touched, |
| 9443 |
setTouched: NOOP, |
| 9444 |
dirty: DEFAULT_FIELD_STATE_ATTRIBUTES.dirty, |
| 9445 |
setDirty: NOOP, |
| 9446 |
filled: DEFAULT_FIELD_STATE_ATTRIBUTES.filled, |
| 9447 |
setFilled: NOOP, |
| 9448 |
focused: DEFAULT_FIELD_STATE_ATTRIBUTES.focused, |
| 9449 |
setFocused: NOOP, |
| 9450 |
validate: () => null, |
| 9451 |
validationMode: "onSubmit", |
| 9452 |
validationDebounceTime: 0, |
| 9453 |
shouldValidateOnChange: () => false, |
| 9454 |
state: DEFAULT_FIELD_ROOT_STATE, |
| 9455 |
markedDirtyRef: { |
| 9456 |
current: false |
| 9457 |
}, |
| 9458 |
registerFieldControl: NOOP, |
| 9459 |
validation: { |
| 9460 |
getValidationProps: (props = EMPTY_OBJECT) => props, |
| 9461 |
getInputValidationProps: (props = EMPTY_OBJECT) => props, |
| 9462 |
inputRef: { |
| 9463 |
current: null |
| 9464 |
}, |
| 9465 |
commit: async () => { |
| 9466 |
} |
| 9467 |
} |
| 9468 |
}; |
| 9469 |
var FieldRootContext = /* @__PURE__ */ React46.createContext(DEFAULT_FIELD_ROOT_CONTEXT); |
| 9470 |
if (true) FieldRootContext.displayName = "FieldRootContext"; |
| 9471 |
function useFieldRootContext(optional = true) { |
| 9472 |
const context = React46.useContext(FieldRootContext); |
| 9473 |
if (context.setValidityData === NOOP && !optional) { |
| 9474 |
throw new Error(true ? "Base UI: FieldRootContext is missing. Field parts must be placed within <Field.Root>." : formatErrorMessage_default(28)); |
| 9475 |
} |
| 9476 |
return context; |
| 9477 |
} |
| 9478 |
|
| 9479 |
// node_modules/@base-ui/react/esm/internals/field-register-control/useRegisterFieldControl.js |
| 9480 |
var React47 = __toESM(require_react(), 1); |
| 9481 |
function useRegisterFieldControl(controlRef, id, value, getFormValueOverride, enabled = true) { |
| 9482 |
const { |
| 9483 |
registerFieldControl |
| 9484 |
} = useFieldRootContext(); |
| 9485 |
const sourceRef = React47.useRef(null); |
| 9486 |
if (!sourceRef.current) { |
| 9487 |
sourceRef.current = /* @__PURE__ */ Symbol(); |
| 9488 |
} |
| 9489 |
useIsoLayoutEffect(() => { |
| 9490 |
const source = sourceRef.current; |
| 9491 |
if (!source || !enabled) { |
| 9492 |
return void 0; |
| 9493 |
} |
| 9494 |
const registration = { |
| 9495 |
controlRef, |
| 9496 |
getValue: getFormValueOverride, |
| 9497 |
id, |
| 9498 |
value |
| 9499 |
}; |
| 9500 |
registerFieldControl(source, registration); |
| 9501 |
return () => { |
| 9502 |
registerFieldControl(source, void 0); |
| 9503 |
}; |
| 9504 |
}, [controlRef, enabled, getFormValueOverride, id, registerFieldControl, value]); |
| 9505 |
} |
| 9506 |
|
| 9507 |
// node_modules/@base-ui/react/esm/internals/form-context/FormContext.js |
| 9508 |
var React48 = __toESM(require_react(), 1); |
| 9509 |
var FormContext = /* @__PURE__ */ React48.createContext({ |
| 9510 |
formRef: { |
| 9511 |
current: { |
| 9512 |
fields: /* @__PURE__ */ new Map() |
| 9513 |
} |
| 9514 |
}, |
| 9515 |
errors: {}, |
| 9516 |
clearErrors: NOOP, |
| 9517 |
validationMode: "onSubmit", |
| 9518 |
submitAttemptedRef: { |
| 9519 |
current: false |
| 9520 |
} |
| 9521 |
}); |
| 9522 |
if (true) FormContext.displayName = "FormContext"; |
| 9523 |
function useFormContext() { |
| 9524 |
return React48.useContext(FormContext); |
| 9525 |
} |
| 9526 |
|
| 9527 |
// node_modules/@base-ui/react/esm/internals/labelable-provider/useLabelableId.js |
| 9528 |
var React50 = __toESM(require_react(), 1); |
| 9529 |
|
| 9530 |
// node_modules/@base-ui/react/esm/internals/labelable-provider/LabelableContext.js |
| 9531 |
var React49 = __toESM(require_react(), 1); |
| 9532 |
var LabelableContext = /* @__PURE__ */ React49.createContext({ |
| 9533 |
controlId: void 0, |
| 9534 |
registerControlId: NOOP, |
| 9535 |
labelId: void 0, |
| 9536 |
setLabelId: NOOP, |
| 9537 |
messageIds: [], |
| 9538 |
setMessageIds: NOOP, |
| 9539 |
getDescriptionProps: (externalProps) => externalProps |
| 9540 |
}); |
| 9541 |
if (true) LabelableContext.displayName = "LabelableContext"; |
| 9542 |
function useLabelableContext() { |
| 9543 |
return React49.useContext(LabelableContext); |
| 9544 |
} |
| 9545 |
|
| 9546 |
// node_modules/@base-ui/react/esm/internals/labelable-provider/useLabelableId.js |
| 9547 |
function useLabelableId(params = {}) { |
| 9548 |
const { |
| 9549 |
id, |
| 9550 |
implicit = false, |
| 9551 |
controlRef |
| 9552 |
} = params; |
| 9553 |
const { |
| 9554 |
controlId, |
| 9555 |
registerControlId |
| 9556 |
} = useLabelableContext(); |
| 9557 |
const defaultId = useBaseUiId(id); |
| 9558 |
const controlIdForEffect = implicit ? controlId : void 0; |
| 9559 |
const controlSourceRef = useRefWithInit(() => /* @__PURE__ */ Symbol("labelable-control")); |
| 9560 |
const hasRegisteredRef = React50.useRef(false); |
| 9561 |
const hadExplicitIdRef = React50.useRef(id != null); |
| 9562 |
const unregisterControlId = useStableCallback(() => { |
| 9563 |
if (!hasRegisteredRef.current || registerControlId === NOOP) { |
| 9564 |
return; |
| 9565 |
} |
| 9566 |
hasRegisteredRef.current = false; |
| 9567 |
registerControlId(controlSourceRef.current, void 0); |
| 9568 |
}); |
| 9569 |
useIsoLayoutEffect(() => { |
| 9570 |
if (registerControlId === NOOP) { |
| 9571 |
return void 0; |
| 9572 |
} |
| 9573 |
let nextId; |
| 9574 |
if (implicit) { |
| 9575 |
const elem = controlRef?.current; |
| 9576 |
if (isElement(elem) && elem.closest("label") != null) { |
| 9577 |
nextId = id ?? null; |
| 9578 |
} else { |
| 9579 |
nextId = controlIdForEffect ?? defaultId; |
| 9580 |
} |
| 9581 |
} else if (id != null) { |
| 9582 |
hadExplicitIdRef.current = true; |
| 9583 |
nextId = id; |
| 9584 |
} else if (hadExplicitIdRef.current) { |
| 9585 |
nextId = defaultId; |
| 9586 |
} else { |
| 9587 |
unregisterControlId(); |
| 9588 |
return void 0; |
| 9589 |
} |
| 9590 |
if (nextId === void 0) { |
| 9591 |
unregisterControlId(); |
| 9592 |
return void 0; |
| 9593 |
} |
| 9594 |
hasRegisteredRef.current = true; |
| 9595 |
registerControlId(controlSourceRef.current, nextId); |
| 9596 |
return void 0; |
| 9597 |
}, [id, controlRef, controlIdForEffect, registerControlId, implicit, defaultId, controlSourceRef, unregisterControlId]); |
| 9598 |
React50.useEffect(() => { |
| 9599 |
return unregisterControlId; |
| 9600 |
}, [unregisterControlId]); |
| 9601 |
return controlId ?? defaultId; |
| 9602 |
} |
| 9603 |
|
| 9604 |
// node_modules/@base-ui/react/esm/combobox/root/utils/index.js |
| 9605 |
function createCollatorItemFilter(collatorFilter, itemToStringLabel) { |
| 9606 |
return (item, query) => { |
| 9607 |
if (item == null) { |
| 9608 |
return false; |
| 9609 |
} |
| 9610 |
const itemString = stringifyAsLabel(item, itemToStringLabel); |
| 9611 |
return collatorFilter.contains(itemString, query); |
| 9612 |
}; |
| 9613 |
} |
| 9614 |
function createSingleSelectionCollatorFilter(collatorFilter, itemToStringLabel, selectedValue) { |
| 9615 |
return (item, query) => { |
| 9616 |
if (item == null) { |
| 9617 |
return false; |
| 9618 |
} |
| 9619 |
if (!query) { |
| 9620 |
return true; |
| 9621 |
} |
| 9622 |
const itemString = stringifyAsLabel(item, itemToStringLabel); |
| 9623 |
const selectedString = selectedValue != null ? stringifyAsLabel(selectedValue, itemToStringLabel) : ""; |
| 9624 |
if (selectedString && collatorFilter.contains(selectedString, query) && selectedString.length === query.length) { |
| 9625 |
return true; |
| 9626 |
} |
| 9627 |
return collatorFilter.contains(itemString, query); |
| 9628 |
}; |
| 9629 |
} |
| 9630 |
|
| 9631 |
// node_modules/@base-ui/react/esm/combobox/root/utils/useFilter.js |
| 9632 |
var React51 = __toESM(require_react(), 1); |
| 9633 |
|
| 9634 |
// node_modules/@base-ui/react/esm/internals/filter.js |
| 9635 |
var filterCache = /* @__PURE__ */ new Map(); |
| 9636 |
function getFilter(options = {}) { |
| 9637 |
const mergedOptions = { |
| 9638 |
usage: "search", |
| 9639 |
sensitivity: "base", |
| 9640 |
ignorePunctuation: true, |
| 9641 |
...options |
| 9642 |
}; |
| 9643 |
const cacheKey = `${stringifyLocale(options.locale)}|${JSON.stringify(mergedOptions)}`; |
| 9644 |
const cachedFilter = filterCache.get(cacheKey); |
| 9645 |
if (cachedFilter) { |
| 9646 |
return cachedFilter; |
| 9647 |
} |
| 9648 |
const collator = new Intl.Collator(options.locale, mergedOptions); |
| 9649 |
const filter = { |
| 9650 |
contains(item, query, itemToString) { |
| 9651 |
if (!query) { |
| 9652 |
return true; |
| 9653 |
} |
| 9654 |
const itemString = stringifyAsLabel(item, itemToString); |
| 9655 |
for (let i = 0; i <= itemString.length - query.length; i += 1) { |
| 9656 |
if (collator.compare(itemString.slice(i, i + query.length), query) === 0) { |
| 9657 |
return true; |
| 9658 |
} |
| 9659 |
} |
| 9660 |
return false; |
| 9661 |
}, |
| 9662 |
startsWith(item, query, itemToString) { |
| 9663 |
if (!query) { |
| 9664 |
return true; |
| 9665 |
} |
| 9666 |
const itemString = stringifyAsLabel(item, itemToString); |
| 9667 |
return collator.compare(itemString.slice(0, query.length), query) === 0; |
| 9668 |
}, |
| 9669 |
endsWith(item, query, itemToString) { |
| 9670 |
if (!query) { |
| 9671 |
return true; |
| 9672 |
} |
| 9673 |
const itemString = stringifyAsLabel(item, itemToString); |
| 9674 |
const queryLength = query.length; |
| 9675 |
return itemString.length >= queryLength && collator.compare(itemString.slice(itemString.length - queryLength), query) === 0; |
| 9676 |
} |
| 9677 |
}; |
| 9678 |
filterCache.set(cacheKey, filter); |
| 9679 |
return filter; |
| 9680 |
} |
| 9681 |
function stringifyLocale(locale) { |
| 9682 |
if (Array.isArray(locale)) { |
| 9683 |
return locale.map((value) => stringifyLocale(value)).join(","); |
| 9684 |
} |
| 9685 |
if (locale == null) { |
| 9686 |
return ""; |
| 9687 |
} |
| 9688 |
return String(locale); |
| 9689 |
} |
| 9690 |
|
| 9691 |
// node_modules/@base-ui/react/esm/combobox/root/utils/useFilter.js |
| 9692 |
var useCoreFilter = getFilter; |
| 9693 |
|
| 9694 |
// node_modules/@base-ui/react/esm/combobox/root/utils/constants.js |
| 9695 |
var NO_ACTIVE_VALUE = /* @__PURE__ */ Symbol("none"); |
| 9696 |
var INITIAL_LAST_HIGHLIGHT = { |
| 9697 |
value: NO_ACTIVE_VALUE, |
| 9698 |
index: -1 |
| 9699 |
}; |
| 9700 |
|
| 9701 |
// node_modules/@base-ui/react/esm/combobox/root/AriaCombobox.js |
| 9702 |
var import_jsx_runtime12 = __toESM(require_jsx_runtime(), 1); |
| 9703 |
function AriaCombobox(props) { |
| 9704 |
const { |
| 9705 |
id: idProp, |
| 9706 |
onOpenChangeComplete: onOpenChangeCompleteProp, |
| 9707 |
defaultSelectedValue = null, |
| 9708 |
selectedValue: selectedValueProp, |
| 9709 |
onSelectedValueChange, |
| 9710 |
defaultInputValue: defaultInputValueProp, |
| 9711 |
inputValue: inputValueProp, |
| 9712 |
open: openProp, |
| 9713 |
defaultOpen = false, |
| 9714 |
selectionMode = "none", |
| 9715 |
onItemHighlighted: onItemHighlightedProp, |
| 9716 |
name: nameProp, |
| 9717 |
form, |
| 9718 |
disabled: disabledProp = false, |
| 9719 |
readOnly = false, |
| 9720 |
required = false, |
| 9721 |
inputRef: inputRefProp, |
| 9722 |
grid = false, |
| 9723 |
items, |
| 9724 |
filteredItems: filteredItemsProp, |
| 9725 |
filter: filterProp, |
| 9726 |
openOnInputClick = true, |
| 9727 |
autoHighlight = false, |
| 9728 |
keepHighlight = false, |
| 9729 |
highlightItemOnHover = true, |
| 9730 |
loopFocus = true, |
| 9731 |
itemToStringLabel, |
| 9732 |
itemToStringValue, |
| 9733 |
isItemEqualToValue = defaultItemEquality, |
| 9734 |
virtualized = false, |
| 9735 |
inline: inlineProp = false, |
| 9736 |
fillInputOnItemPress = true, |
| 9737 |
modal = false, |
| 9738 |
limit = -1, |
| 9739 |
autoComplete = "list", |
| 9740 |
formAutoComplete, |
| 9741 |
locale, |
| 9742 |
submitOnItemClick = false |
| 9743 |
} = props; |
| 9744 |
const { |
| 9745 |
clearErrors |
| 9746 |
} = useFormContext(); |
| 9747 |
const { |
| 9748 |
setDirty, |
| 9749 |
validityData, |
| 9750 |
shouldValidateOnChange, |
| 9751 |
setFilled, |
| 9752 |
name: fieldName, |
| 9753 |
disabled: fieldDisabled, |
| 9754 |
setTouched, |
| 9755 |
setFocused, |
| 9756 |
validationMode, |
| 9757 |
validation |
| 9758 |
} = useFieldRootContext(); |
| 9759 |
const direction = useDirection(); |
| 9760 |
const id = useLabelableId({ |
| 9761 |
id: idProp |
| 9762 |
}); |
| 9763 |
const collatorFilter = useCoreFilter({ |
| 9764 |
locale |
| 9765 |
}); |
| 9766 |
const [queryChangedAfterOpen, setQueryChangedAfterOpen] = React52.useState(false); |
| 9767 |
const [closeQuery, setCloseQuery] = React52.useState(null); |
| 9768 |
const listRef = React52.useRef([]); |
| 9769 |
const labelsRef = React52.useRef([]); |
| 9770 |
const popupRef = React52.useRef(null); |
| 9771 |
const inputRef = React52.useRef(null); |
| 9772 |
const startDismissRef = React52.useRef(null); |
| 9773 |
const endDismissRef = React52.useRef(null); |
| 9774 |
const emptyRef = React52.useRef(null); |
| 9775 |
const keyboardActiveRef = React52.useRef(true); |
| 9776 |
const hadInputClearRef = React52.useRef(false); |
| 9777 |
const chipsContainerRef = React52.useRef(null); |
| 9778 |
const clearRef = React52.useRef(null); |
| 9779 |
const selectionEventRef = React52.useRef(null); |
| 9780 |
const lastHighlightRef = React52.useRef(INITIAL_LAST_HIGHLIGHT); |
| 9781 |
const pendingQueryHighlightRef = React52.useRef(null); |
| 9782 |
const valuesRef = React52.useRef([]); |
| 9783 |
const allValuesRef = React52.useRef([]); |
| 9784 |
const disabled2 = fieldDisabled || disabledProp; |
| 9785 |
const name = fieldName ?? nameProp; |
| 9786 |
const multiple = selectionMode === "multiple"; |
| 9787 |
const single = selectionMode === "single"; |
| 9788 |
const hasInputValue = inputValueProp !== void 0 || defaultInputValueProp !== void 0; |
| 9789 |
const hasItems = items !== void 0; |
| 9790 |
const hasFilteredItemsProp = filteredItemsProp !== void 0; |
| 9791 |
let autoHighlightMode; |
| 9792 |
if (autoHighlight === "always") { |
| 9793 |
autoHighlightMode = "always"; |
| 9794 |
} else { |
| 9795 |
autoHighlightMode = autoHighlight ? "input-change" : false; |
| 9796 |
} |
| 9797 |
const [selectedValue, setSelectedValueUnwrapped] = useControlled({ |
| 9798 |
controlled: selectedValueProp, |
| 9799 |
default: multiple ? defaultSelectedValue ?? EMPTY_ARRAY : defaultSelectedValue, |
| 9800 |
name: "Combobox", |
| 9801 |
state: "selectedValue" |
| 9802 |
}); |
| 9803 |
const filter = React52.useMemo(() => { |
| 9804 |
if (filterProp === null) { |
| 9805 |
return () => true; |
| 9806 |
} |
| 9807 |
if (filterProp !== void 0) { |
| 9808 |
return filterProp; |
| 9809 |
} |
| 9810 |
if (single && !queryChangedAfterOpen) { |
| 9811 |
return createSingleSelectionCollatorFilter(collatorFilter, itemToStringLabel, selectedValue); |
| 9812 |
} |
| 9813 |
return createCollatorItemFilter(collatorFilter, itemToStringLabel); |
| 9814 |
}, [filterProp, single, selectedValue, queryChangedAfterOpen, collatorFilter, itemToStringLabel]); |
| 9815 |
const initialDefaultInputValue = useRefWithInit(() => { |
| 9816 |
if (hasInputValue) { |
| 9817 |
return defaultInputValueProp ?? ""; |
| 9818 |
} |
| 9819 |
if (single) { |
| 9820 |
return stringifyAsLabel(selectedValue, itemToStringLabel); |
| 9821 |
} |
| 9822 |
return ""; |
| 9823 |
}).current; |
| 9824 |
const [inputValue, setInputValueUnwrapped] = useControlled({ |
| 9825 |
controlled: inputValueProp, |
| 9826 |
default: initialDefaultInputValue, |
| 9827 |
name: "Combobox", |
| 9828 |
state: "inputValue" |
| 9829 |
}); |
| 9830 |
const [open, setOpenUnwrapped] = useControlled({ |
| 9831 |
controlled: openProp, |
| 9832 |
default: defaultOpen, |
| 9833 |
name: "Combobox", |
| 9834 |
state: "open" |
| 9835 |
}); |
| 9836 |
const isGrouped = isGroupedItems(items); |
| 9837 |
const query = closeQuery ?? (inputValue === "" ? "" : String(inputValue).trim()); |
| 9838 |
const selectedLabelString = single ? stringifyAsLabel(selectedValue, itemToStringLabel) : ""; |
| 9839 |
const shouldBypassFiltering = single && !queryChangedAfterOpen && query !== "" && selectedLabelString !== "" && selectedLabelString.length === query.length && collatorFilter.contains(selectedLabelString, query); |
| 9840 |
const filterQuery = shouldBypassFiltering ? "" : query; |
| 9841 |
const shouldIgnoreExternalFiltering = hasItems && hasFilteredItemsProp && shouldBypassFiltering; |
| 9842 |
const flatItems = React52.useMemo(() => { |
| 9843 |
if (!items) { |
| 9844 |
return EMPTY_ARRAY; |
| 9845 |
} |
| 9846 |
if (isGrouped) { |
| 9847 |
return items.flatMap((group) => group.items); |
| 9848 |
} |
| 9849 |
return items; |
| 9850 |
}, [items, isGrouped]); |
| 9851 |
const filteredItems = React52.useMemo(() => { |
| 9852 |
if (filteredItemsProp && !shouldIgnoreExternalFiltering) { |
| 9853 |
return filteredItemsProp; |
| 9854 |
} |
| 9855 |
if (!items) { |
| 9856 |
return EMPTY_ARRAY; |
| 9857 |
} |
| 9858 |
if (isGrouped) { |
| 9859 |
const groupedItems = items; |
| 9860 |
const resultingGroups = []; |
| 9861 |
let currentCount = 0; |
| 9862 |
for (const group of groupedItems) { |
| 9863 |
if (limit > -1 && currentCount >= limit) { |
| 9864 |
break; |
| 9865 |
} |
| 9866 |
const candidateItems = filterQuery === "" ? group.items : group.items.filter((item) => filter(item, filterQuery, itemToStringLabel)); |
| 9867 |
if (candidateItems.length === 0) { |
| 9868 |
continue; |
| 9869 |
} |
| 9870 |
const remainingLimit = limit > -1 ? limit - currentCount : Infinity; |
| 9871 |
const itemsToTake = candidateItems.slice(0, remainingLimit); |
| 9872 |
if (itemsToTake.length > 0) { |
| 9873 |
const newGroup = { |
| 9874 |
...group, |
| 9875 |
items: itemsToTake |
| 9876 |
}; |
| 9877 |
resultingGroups.push(newGroup); |
| 9878 |
currentCount += itemsToTake.length; |
| 9879 |
} |
| 9880 |
} |
| 9881 |
return resultingGroups; |
| 9882 |
} |
| 9883 |
if (filterQuery === "") { |
| 9884 |
return limit > -1 ? flatItems.slice(0, limit) : ( |
| 9885 |
// The cast here is done as `flatItems` is readonly. |
| 9886 |
// valuesRef.current, a mutable ref, can be set to `flatFilteredItems`, which may |
| 9887 |
// reference this exact readonly value, creating a mutation risk. |
| 9888 |
// However, <Combobox.Item> can never mutate this value as the mutating effect |
| 9889 |
// bails early when `items` is provided, and this is only ever returned |
| 9890 |
// when `items` is provided due to the early return at the top of this hook. |
| 9891 |
flatItems |
| 9892 |
); |
| 9893 |
} |
| 9894 |
const limitedItems = []; |
| 9895 |
for (const item of flatItems) { |
| 9896 |
if (limit > -1 && limitedItems.length >= limit) { |
| 9897 |
break; |
| 9898 |
} |
| 9899 |
if (filter(item, filterQuery, itemToStringLabel)) { |
| 9900 |
limitedItems.push(item); |
| 9901 |
} |
| 9902 |
} |
| 9903 |
return limitedItems; |
| 9904 |
}, [filteredItemsProp, shouldIgnoreExternalFiltering, items, isGrouped, filterQuery, limit, filter, itemToStringLabel, flatItems]); |
| 9905 |
const flatFilteredItems = React52.useMemo(() => { |
| 9906 |
if (isGrouped) { |
| 9907 |
const groups = filteredItems; |
| 9908 |
return groups.flatMap((g) => g.items); |
| 9909 |
} |
| 9910 |
return filteredItems; |
| 9911 |
}, [filteredItems, isGrouped]); |
| 9912 |
const store = useRefWithInit(() => new Store({ |
| 9913 |
id, |
| 9914 |
labelId: void 0, |
| 9915 |
selectedValue, |
| 9916 |
open, |
| 9917 |
filter, |
| 9918 |
query, |
| 9919 |
items, |
| 9920 |
selectionMode, |
| 9921 |
listRef, |
| 9922 |
labelsRef, |
| 9923 |
popupRef, |
| 9924 |
emptyRef, |
| 9925 |
inputRef, |
| 9926 |
startDismissRef, |
| 9927 |
endDismissRef, |
| 9928 |
keyboardActiveRef, |
| 9929 |
chipsContainerRef, |
| 9930 |
clearRef, |
| 9931 |
valuesRef, |
| 9932 |
allValuesRef, |
| 9933 |
selectionEventRef, |
| 9934 |
name, |
| 9935 |
form, |
| 9936 |
disabled: disabled2, |
| 9937 |
readOnly, |
| 9938 |
required, |
| 9939 |
grid, |
| 9940 |
isGrouped, |
| 9941 |
virtualized, |
| 9942 |
openOnInputClick, |
| 9943 |
itemToStringLabel, |
| 9944 |
isItemEqualToValue, |
| 9945 |
modal, |
| 9946 |
autoHighlight: autoHighlightMode, |
| 9947 |
submitOnItemClick, |
| 9948 |
hasInputValue, |
| 9949 |
mounted: false, |
| 9950 |
forceMounted: false, |
| 9951 |
transitionStatus: "idle", |
| 9952 |
inline: inlineProp, |
| 9953 |
activeIndex: null, |
| 9954 |
selectedIndex: null, |
| 9955 |
popupProps: {}, |
| 9956 |
inputProps: {}, |
| 9957 |
triggerProps: {}, |
| 9958 |
itemProps: EMPTY_OBJECT, |
| 9959 |
positionerElement: null, |
| 9960 |
listElement: null, |
| 9961 |
triggerElement: null, |
| 9962 |
inputElement: null, |
| 9963 |
inputGroupElement: null, |
| 9964 |
popupSide: null, |
| 9965 |
openMethod: null, |
| 9966 |
inputInsidePopup: true, |
| 9967 |
// Avoid duplicate names in the server HTML. Popup inputs aren't rendered |
| 9968 |
// until after hydration, so the hidden input takes over then if needed. |
| 9969 |
inputOwnsFormValue: selectionMode === "none", |
| 9970 |
onOpenChangeComplete: onOpenChangeCompleteProp || NOOP, |
| 9971 |
// Placeholder callbacks replaced on first render |
| 9972 |
setOpen: NOOP, |
| 9973 |
setInputValue: NOOP, |
| 9974 |
setSelectedValue: NOOP, |
| 9975 |
setIndices: NOOP, |
| 9976 |
onItemHighlighted: NOOP, |
| 9977 |
handleSelection: NOOP, |
| 9978 |
forceMount: NOOP, |
| 9979 |
requestSubmit: NOOP |
| 9980 |
})).current; |
| 9981 |
const fieldRawValue = selectionMode === "none" ? inputValue : selectedValue; |
| 9982 |
const fieldStringValue = React52.useMemo(() => { |
| 9983 |
if (selectionMode === "none") { |
| 9984 |
return fieldRawValue; |
| 9985 |
} |
| 9986 |
if (Array.isArray(selectedValue)) { |
| 9987 |
return selectedValue.map((value) => stringifyAsValue(value, itemToStringValue)); |
| 9988 |
} |
| 9989 |
return stringifyAsValue(selectedValue, itemToStringValue); |
| 9990 |
}, [fieldRawValue, itemToStringValue, selectionMode, selectedValue]); |
| 9991 |
const onItemHighlighted = useStableCallback(onItemHighlightedProp); |
| 9992 |
const onOpenChangeComplete = useStableCallback(onOpenChangeCompleteProp); |
| 9993 |
const activeIndex = useStore(store, selectors2.activeIndex); |
| 9994 |
const selectedIndex = useStore(store, selectors2.selectedIndex); |
| 9995 |
const positionerElement = useStore(store, selectors2.positionerElement); |
| 9996 |
const listElement = useStore(store, selectors2.listElement); |
| 9997 |
const triggerElement = useStore(store, selectors2.triggerElement); |
| 9998 |
const inputElement = useStore(store, selectors2.inputElement); |
| 9999 |
const inputGroupElement = useStore(store, selectors2.inputGroupElement); |
| 10000 |
const inline4 = useStore(store, selectors2.inline); |
| 10001 |
const inputInsidePopup = useStore(store, selectors2.inputInsidePopup); |
| 10002 |
const inputOwnsFormValue = useStore(store, selectors2.inputOwnsFormValue); |
| 10003 |
const triggerRef = useValueAsRef(triggerElement); |
| 10004 |
const { |
| 10005 |
mounted, |
| 10006 |
setMounted, |
| 10007 |
transitionStatus |
| 10008 |
} = useTransitionStatus(open); |
| 10009 |
const { |
| 10010 |
openMethod, |
| 10011 |
triggerProps |
| 10012 |
} = useOpenInteractionType(open); |
| 10013 |
const getStringifiedValueForForm = useStableCallback(() => fieldStringValue); |
| 10014 |
useRegisterFieldControl(inputInsidePopup ? triggerRef : inputRef, id, fieldRawValue, getStringifiedValueForForm); |
| 10015 |
const forceMount = useStableCallback(() => { |
| 10016 |
if (items) { |
| 10017 |
labelsRef.current = flatFilteredItems.map((item) => stringifyAsLabel(item, itemToStringLabel)); |
| 10018 |
} else { |
| 10019 |
store.set("forceMounted", true); |
| 10020 |
} |
| 10021 |
}); |
| 10022 |
const initialSelectedValueRef = React52.useRef(selectedValue); |
| 10023 |
useIsoLayoutEffect(() => { |
| 10024 |
if (selectedValue !== initialSelectedValueRef.current) { |
| 10025 |
forceMount(); |
| 10026 |
} |
| 10027 |
}, [forceMount, selectedValue]); |
| 10028 |
const setIndices = useStableCallback((options) => { |
| 10029 |
store.update(options); |
| 10030 |
const type = options.type || "none"; |
| 10031 |
if (options.activeIndex === void 0) { |
| 10032 |
return; |
| 10033 |
} |
| 10034 |
if (options.activeIndex === null) { |
| 10035 |
if (lastHighlightRef.current !== INITIAL_LAST_HIGHLIGHT) { |
| 10036 |
lastHighlightRef.current = INITIAL_LAST_HIGHLIGHT; |
| 10037 |
onItemHighlighted(void 0, createGenericEventDetails(type, void 0, { |
| 10038 |
index: -1 |
| 10039 |
})); |
| 10040 |
} |
| 10041 |
} else { |
| 10042 |
const activeValue = valuesRef.current[options.activeIndex]; |
| 10043 |
lastHighlightRef.current = { |
| 10044 |
value: activeValue, |
| 10045 |
index: options.activeIndex |
| 10046 |
}; |
| 10047 |
onItemHighlighted(activeValue, createGenericEventDetails(type, void 0, { |
| 10048 |
index: options.activeIndex |
| 10049 |
})); |
| 10050 |
} |
| 10051 |
}); |
| 10052 |
const setInputValue = useStableCallback((next, eventDetails) => { |
| 10053 |
hadInputClearRef.current = eventDetails.reason === reason_parts_exports.inputClear; |
| 10054 |
props.onInputValueChange?.(next, eventDetails); |
| 10055 |
if (eventDetails.isCanceled) { |
| 10056 |
return; |
| 10057 |
} |
| 10058 |
if (eventDetails.reason === reason_parts_exports.inputChange) { |
| 10059 |
const event = eventDetails.event; |
| 10060 |
const inputType = event.inputType; |
| 10061 |
const isTypedInput = event.type === "compositionend" || inputType != null && inputType !== "" && inputType !== "insertReplacementText"; |
| 10062 |
if (isTypedInput) { |
| 10063 |
const hasQuery = next.trim() !== ""; |
| 10064 |
if (hasQuery) { |
| 10065 |
setQueryChangedAfterOpen(true); |
| 10066 |
} |
| 10067 |
pendingQueryHighlightRef.current = { |
| 10068 |
hasQuery |
| 10069 |
}; |
| 10070 |
if (hasQuery && autoHighlightMode && store.state.activeIndex == null) { |
| 10071 |
store.set("activeIndex", 0); |
| 10072 |
} |
| 10073 |
} |
| 10074 |
} |
| 10075 |
setInputValueUnwrapped(next); |
| 10076 |
}); |
| 10077 |
const setOpen = useStableCallback((nextOpen, eventDetails) => { |
| 10078 |
if (open === nextOpen) { |
| 10079 |
return; |
| 10080 |
} |
| 10081 |
if (eventDetails.reason === "escape-key" && hasItems && flatFilteredItems.length === 0 && !store.state.emptyRef.current) { |
| 10082 |
eventDetails.allowPropagation(); |
| 10083 |
} |
| 10084 |
props.onOpenChange?.(nextOpen, eventDetails); |
| 10085 |
if (eventDetails.isCanceled) { |
| 10086 |
return; |
| 10087 |
} |
| 10088 |
if (nextOpen && multiple && inputInsidePopup && !inline4 && closeQuery !== null) { |
| 10089 |
setQueryChangedAfterOpen(false); |
| 10090 |
setCloseQuery(null); |
| 10091 |
if (inputValue !== "") { |
| 10092 |
setInputValue("", createChangeEventDetails(reason_parts_exports.inputClear, eventDetails.event)); |
| 10093 |
} |
| 10094 |
} |
| 10095 |
if (!nextOpen && queryChangedAfterOpen) { |
| 10096 |
if (single) { |
| 10097 |
if (!inline4) { |
| 10098 |
setCloseQuery(query); |
| 10099 |
} |
| 10100 |
if (query === "") { |
| 10101 |
setQueryChangedAfterOpen(false); |
| 10102 |
} |
| 10103 |
} else if (multiple) { |
| 10104 |
if (!inline4) { |
| 10105 |
setCloseQuery(query); |
| 10106 |
} |
| 10107 |
if (inputInsidePopup) { |
| 10108 |
setIndices({ |
| 10109 |
activeIndex: null |
| 10110 |
}); |
| 10111 |
} |
| 10112 |
if (!inputInsidePopup || inline4) { |
| 10113 |
setInputValue("", createChangeEventDetails(reason_parts_exports.inputClear, eventDetails.event)); |
| 10114 |
} |
| 10115 |
} |
| 10116 |
} |
| 10117 |
setOpenUnwrapped(nextOpen); |
| 10118 |
if (!nextOpen && inputInsidePopup && (eventDetails.reason === reason_parts_exports.focusOut || eventDetails.reason === reason_parts_exports.outsidePress)) { |
| 10119 |
setTouched(true); |
| 10120 |
setFocused(false); |
| 10121 |
if (validationMode === "onBlur") { |
| 10122 |
const valueToValidate = selectionMode === "none" ? inputValue : selectedValue; |
| 10123 |
validation.commit(valueToValidate); |
| 10124 |
} |
| 10125 |
} |
| 10126 |
}); |
| 10127 |
const setSelectedValue = useStableCallback((nextValue, eventDetails) => { |
| 10128 |
onSelectedValueChange?.(nextValue, eventDetails); |
| 10129 |
if (eventDetails.isCanceled) { |
| 10130 |
return; |
| 10131 |
} |
| 10132 |
setSelectedValueUnwrapped(nextValue); |
| 10133 |
const shouldFillInput = selectionMode === "none" && popupRef.current && fillInputOnItemPress || single && !store.state.inputInsidePopup; |
| 10134 |
if (shouldFillInput) { |
| 10135 |
setInputValue(stringifyAsLabel(nextValue, itemToStringLabel), createChangeEventDetails(eventDetails.reason, eventDetails.event)); |
| 10136 |
} |
| 10137 |
if (single && nextValue != null && eventDetails.reason !== reason_parts_exports.inputChange && queryChangedAfterOpen && !inline4) { |
| 10138 |
setCloseQuery(query); |
| 10139 |
} |
| 10140 |
}); |
| 10141 |
const handleSelection = useStableCallback((event, passedValue) => { |
| 10142 |
let itemValue = passedValue; |
| 10143 |
if (itemValue === void 0) { |
| 10144 |
if (activeIndex === null) { |
| 10145 |
return; |
| 10146 |
} |
| 10147 |
itemValue = valuesRef.current[activeIndex]; |
| 10148 |
} |
| 10149 |
const targetEl = getTarget(event); |
| 10150 |
const overrideEvent = selectionEventRef.current ?? event; |
| 10151 |
selectionEventRef.current = null; |
| 10152 |
const eventDetails = createChangeEventDetails(reason_parts_exports.itemPress, overrideEvent); |
| 10153 |
const href = targetEl?.closest("a")?.getAttribute("href"); |
| 10154 |
if (href) { |
| 10155 |
if (href.startsWith("#")) { |
| 10156 |
setOpen(false, eventDetails); |
| 10157 |
} |
| 10158 |
return; |
| 10159 |
} |
| 10160 |
if (multiple) { |
| 10161 |
const currentSelectedValue = Array.isArray(selectedValue) ? selectedValue : []; |
| 10162 |
const isCurrentlySelected = selectedValueIncludes(currentSelectedValue, itemValue, store.state.isItemEqualToValue); |
| 10163 |
const nextValue = isCurrentlySelected ? removeItem(currentSelectedValue, itemValue, store.state.isItemEqualToValue) : [...currentSelectedValue, itemValue]; |
| 10164 |
setSelectedValue(nextValue, eventDetails); |
| 10165 |
const wasFiltering = inputRef.current ? inputRef.current.value.trim() !== "" : false; |
| 10166 |
if (!wasFiltering) { |
| 10167 |
return; |
| 10168 |
} |
| 10169 |
if (store.state.inputInsidePopup) { |
| 10170 |
setInputValue("", createChangeEventDetails(reason_parts_exports.inputClear, eventDetails.event)); |
| 10171 |
} else { |
| 10172 |
setOpen(false, eventDetails); |
| 10173 |
} |
| 10174 |
} else { |
| 10175 |
setSelectedValue(itemValue, eventDetails); |
| 10176 |
setOpen(false, eventDetails); |
| 10177 |
} |
| 10178 |
}); |
| 10179 |
const requestSubmit = useStableCallback(() => { |
| 10180 |
if (!store.state.submitOnItemClick) { |
| 10181 |
return; |
| 10182 |
} |
| 10183 |
const formElement = validation.inputRef.current?.form ?? store.state.inputElement?.form; |
| 10184 |
if (formElement && typeof formElement.requestSubmit === "function") { |
| 10185 |
formElement.requestSubmit(); |
| 10186 |
} |
| 10187 |
}); |
| 10188 |
const handleUnmount = useStableCallback(() => { |
| 10189 |
setMounted(false); |
| 10190 |
onOpenChangeComplete?.(false); |
| 10191 |
setQueryChangedAfterOpen(false); |
| 10192 |
setCloseQuery(null); |
| 10193 |
if (selectionMode === "none") { |
| 10194 |
setIndices({ |
| 10195 |
activeIndex: null, |
| 10196 |
selectedIndex: null |
| 10197 |
}); |
| 10198 |
} else { |
| 10199 |
setIndices({ |
| 10200 |
activeIndex: null |
| 10201 |
}); |
| 10202 |
} |
| 10203 |
if (multiple && inputRef.current && inputRef.current.value !== "" && !hadInputClearRef.current) { |
| 10204 |
setInputValue("", createChangeEventDetails(reason_parts_exports.inputClear)); |
| 10205 |
} |
| 10206 |
if (single) { |
| 10207 |
if (store.state.inputInsidePopup) { |
| 10208 |
if (inputRef.current && inputRef.current.value !== "") { |
| 10209 |
setInputValue("", createChangeEventDetails(reason_parts_exports.inputClear)); |
| 10210 |
} |
| 10211 |
} else { |
| 10212 |
const stringVal = stringifyAsLabel(selectedValue, itemToStringLabel); |
| 10213 |
if (inputRef.current && inputRef.current.value !== stringVal) { |
| 10214 |
const reason = stringVal === "" ? reason_parts_exports.inputClear : reason_parts_exports.none; |
| 10215 |
setInputValue(stringVal, createChangeEventDetails(reason)); |
| 10216 |
} |
| 10217 |
} |
| 10218 |
} |
| 10219 |
}); |
| 10220 |
const resolvedPopupRef = React52.useMemo(() => { |
| 10221 |
if (inline4 && positionerElement) { |
| 10222 |
return { |
| 10223 |
current: positionerElement.closest('[role="dialog"]') |
| 10224 |
}; |
| 10225 |
} |
| 10226 |
return popupRef; |
| 10227 |
}, [inline4, positionerElement]); |
| 10228 |
useOpenChangeComplete({ |
| 10229 |
enabled: !props.actionsRef, |
| 10230 |
open, |
| 10231 |
ref: resolvedPopupRef, |
| 10232 |
onComplete() { |
| 10233 |
if (!open) { |
| 10234 |
handleUnmount(); |
| 10235 |
} |
| 10236 |
} |
| 10237 |
}); |
| 10238 |
React52.useImperativeHandle(props.actionsRef, () => ({ |
| 10239 |
unmount: handleUnmount |
| 10240 |
}), [handleUnmount]); |
| 10241 |
useIsoLayoutEffect(function syncSelectedIndex() { |
| 10242 |
if (open || selectionMode === "none") { |
| 10243 |
return; |
| 10244 |
} |
| 10245 |
const registry = items ? flatItems : allValuesRef.current; |
| 10246 |
if (multiple) { |
| 10247 |
const currentValue = Array.isArray(selectedValue) ? selectedValue : []; |
| 10248 |
const lastValue = currentValue[currentValue.length - 1]; |
| 10249 |
const lastIndex = findItemIndex(registry, lastValue, isItemEqualToValue); |
| 10250 |
setIndices({ |
| 10251 |
selectedIndex: lastIndex === -1 ? null : lastIndex |
| 10252 |
}); |
| 10253 |
} else { |
| 10254 |
const index2 = findItemIndex(registry, selectedValue, isItemEqualToValue); |
| 10255 |
setIndices({ |
| 10256 |
selectedIndex: index2 === -1 ? null : index2 |
| 10257 |
}); |
| 10258 |
} |
| 10259 |
}, [open, selectedValue, items, selectionMode, flatItems, multiple, isItemEqualToValue, setIndices]); |
| 10260 |
useIsoLayoutEffect(() => { |
| 10261 |
if (items) { |
| 10262 |
valuesRef.current = flatFilteredItems; |
| 10263 |
listRef.current.length = flatFilteredItems.length; |
| 10264 |
} |
| 10265 |
}, [items, flatFilteredItems]); |
| 10266 |
useIsoLayoutEffect(() => { |
| 10267 |
const pendingHighlight = pendingQueryHighlightRef.current; |
| 10268 |
if (pendingHighlight) { |
| 10269 |
if (pendingHighlight.hasQuery) { |
| 10270 |
if (autoHighlightMode) { |
| 10271 |
store.set("activeIndex", 0); |
| 10272 |
} |
| 10273 |
} else if (autoHighlightMode === "always") { |
| 10274 |
store.set("activeIndex", 0); |
| 10275 |
} |
| 10276 |
pendingQueryHighlightRef.current = null; |
| 10277 |
} |
| 10278 |
if (!open && !inline4) { |
| 10279 |
return; |
| 10280 |
} |
| 10281 |
const shouldUseFlatFilteredItems = hasItems || hasFilteredItemsProp; |
| 10282 |
const candidateItems = shouldUseFlatFilteredItems ? flatFilteredItems : valuesRef.current; |
| 10283 |
const storeActiveIndex = store.state.activeIndex; |
| 10284 |
if (storeActiveIndex == null) { |
| 10285 |
if (autoHighlightMode === "always" && candidateItems.length > 0) { |
| 10286 |
store.set("activeIndex", 0); |
| 10287 |
return; |
| 10288 |
} |
| 10289 |
if (lastHighlightRef.current !== INITIAL_LAST_HIGHLIGHT) { |
| 10290 |
lastHighlightRef.current = INITIAL_LAST_HIGHLIGHT; |
| 10291 |
store.state.onItemHighlighted(void 0, createGenericEventDetails(reason_parts_exports.none, void 0, { |
| 10292 |
index: -1 |
| 10293 |
})); |
| 10294 |
} |
| 10295 |
return; |
| 10296 |
} |
| 10297 |
if (storeActiveIndex >= candidateItems.length) { |
| 10298 |
if (lastHighlightRef.current !== INITIAL_LAST_HIGHLIGHT) { |
| 10299 |
lastHighlightRef.current = INITIAL_LAST_HIGHLIGHT; |
| 10300 |
store.state.onItemHighlighted(void 0, createGenericEventDetails(reason_parts_exports.none, void 0, { |
| 10301 |
index: -1 |
| 10302 |
})); |
| 10303 |
} |
| 10304 |
store.set("activeIndex", null); |
| 10305 |
return; |
| 10306 |
} |
| 10307 |
const itemValue = candidateItems[storeActiveIndex]; |
| 10308 |
const previouslyHighlightedItemValue = lastHighlightRef.current.value; |
| 10309 |
const isSameItem = previouslyHighlightedItemValue !== NO_ACTIVE_VALUE && compareItemEquality(itemValue, previouslyHighlightedItemValue, store.state.isItemEqualToValue); |
| 10310 |
if (lastHighlightRef.current.index !== storeActiveIndex || !isSameItem) { |
| 10311 |
lastHighlightRef.current = { |
| 10312 |
value: itemValue, |
| 10313 |
index: storeActiveIndex |
| 10314 |
}; |
| 10315 |
store.state.onItemHighlighted(itemValue, createGenericEventDetails(reason_parts_exports.none, void 0, { |
| 10316 |
index: storeActiveIndex |
| 10317 |
})); |
| 10318 |
} |
| 10319 |
}, [activeIndex, autoHighlightMode, hasFilteredItemsProp, hasItems, flatFilteredItems, inline4, open, store]); |
| 10320 |
useIsoLayoutEffect(() => { |
| 10321 |
if (selectionMode === "none") { |
| 10322 |
setFilled(String(inputValue) !== ""); |
| 10323 |
return; |
| 10324 |
} |
| 10325 |
setFilled(multiple ? Array.isArray(selectedValue) && selectedValue.length > 0 : selectedValue != null); |
| 10326 |
}, [setFilled, selectionMode, inputValue, selectedValue, multiple]); |
| 10327 |
React52.useEffect(() => { |
| 10328 |
if (hasItems && autoHighlightMode && flatFilteredItems.length === 0) { |
| 10329 |
setIndices({ |
| 10330 |
activeIndex: null |
| 10331 |
}); |
| 10332 |
} |
| 10333 |
}, [hasItems, autoHighlightMode, flatFilteredItems.length, setIndices]); |
| 10334 |
useValueChanged(query, () => { |
| 10335 |
if (!open || query === "" || query === String(initialDefaultInputValue)) { |
| 10336 |
return; |
| 10337 |
} |
| 10338 |
setQueryChangedAfterOpen(true); |
| 10339 |
}); |
| 10340 |
useValueChanged(selectedValue, () => { |
| 10341 |
if (selectionMode === "none") { |
| 10342 |
return; |
| 10343 |
} |
| 10344 |
clearErrors(name); |
| 10345 |
setDirty(selectedValue !== validityData.initialValue); |
| 10346 |
if (shouldValidateOnChange()) { |
| 10347 |
validation.commit(selectedValue); |
| 10348 |
} else { |
| 10349 |
validation.commit(selectedValue, true); |
| 10350 |
} |
| 10351 |
if (single && !hasInputValue && !inputInsidePopup) { |
| 10352 |
const nextInputValue = stringifyAsLabel(selectedValue, itemToStringLabel); |
| 10353 |
if (inputValue !== nextInputValue) { |
| 10354 |
setInputValue(nextInputValue, createChangeEventDetails(reason_parts_exports.none)); |
| 10355 |
} |
| 10356 |
} |
| 10357 |
}); |
| 10358 |
useValueChanged(inputValue, () => { |
| 10359 |
if (selectionMode !== "none") { |
| 10360 |
return; |
| 10361 |
} |
| 10362 |
clearErrors(name); |
| 10363 |
setDirty(inputValue !== validityData.initialValue); |
| 10364 |
if (shouldValidateOnChange()) { |
| 10365 |
validation.commit(inputValue); |
| 10366 |
} else { |
| 10367 |
validation.commit(inputValue, true); |
| 10368 |
} |
| 10369 |
}); |
| 10370 |
useValueChanged(items, () => { |
| 10371 |
if (!single || hasInputValue || inputInsidePopup || queryChangedAfterOpen) { |
| 10372 |
return; |
| 10373 |
} |
| 10374 |
const nextInputValue = stringifyAsLabel(selectedValue, itemToStringLabel); |
| 10375 |
if (inputValue !== nextInputValue) { |
| 10376 |
setInputValue(nextInputValue, createChangeEventDetails(reason_parts_exports.none)); |
| 10377 |
} |
| 10378 |
}); |
| 10379 |
const floatingRootContext = useFloatingRootContext({ |
| 10380 |
open: inline4 ? true : open, |
| 10381 |
onOpenChange: setOpen, |
| 10382 |
elements: { |
| 10383 |
reference: inputInsidePopup ? triggerElement : inputElement, |
| 10384 |
floating: positionerElement |
| 10385 |
} |
| 10386 |
}); |
| 10387 |
let ariaHasPopup; |
| 10388 |
let ariaExpanded; |
| 10389 |
if (!inline4) { |
| 10390 |
ariaHasPopup = grid ? "grid" : "listbox"; |
| 10391 |
ariaExpanded = open ? "true" : "false"; |
| 10392 |
} |
| 10393 |
const role = React52.useMemo(() => { |
| 10394 |
const isPlainInput = inputElement?.tagName === "INPUT"; |
| 10395 |
const shouldTreatAsInput = inputElement == null || isPlainInput; |
| 10396 |
const shouldApplyAria = shouldTreatAsInput || open; |
| 10397 |
const reference = shouldTreatAsInput ? { |
| 10398 |
autoComplete: "off", |
| 10399 |
spellCheck: "false", |
| 10400 |
autoCorrect: "off", |
| 10401 |
autoCapitalize: "none" |
| 10402 |
} : {}; |
| 10403 |
if (shouldApplyAria) { |
| 10404 |
reference.role = "combobox"; |
| 10405 |
reference["aria-expanded"] = ariaExpanded; |
| 10406 |
reference["aria-haspopup"] = ariaHasPopup; |
| 10407 |
reference["aria-controls"] = open ? listElement?.id : void 0; |
| 10408 |
reference["aria-autocomplete"] = autoComplete; |
| 10409 |
} |
| 10410 |
return { |
| 10411 |
reference, |
| 10412 |
floating: { |
| 10413 |
role: "presentation" |
| 10414 |
} |
| 10415 |
}; |
| 10416 |
}, [inputElement, open, ariaExpanded, ariaHasPopup, listElement?.id, autoComplete]); |
| 10417 |
const click = useClick(floatingRootContext, { |
| 10418 |
enabled: !readOnly && !disabled2 && openOnInputClick, |
| 10419 |
event: "mousedown-only", |
| 10420 |
toggle: false, |
| 10421 |
// Apply a small delay for touch to let mobile viewport/keyboard positioning settle. |
| 10422 |
// This avoids top-bottom flip flickers if the preferred position is "top" when first tapping. |
| 10423 |
touchOpenDelay: inputInsidePopup ? 0 : 100, |
| 10424 |
reason: reason_parts_exports.inputPress |
| 10425 |
}); |
| 10426 |
const dismiss = useDismiss(floatingRootContext, { |
| 10427 |
enabled: !readOnly && !disabled2 && !inline4, |
| 10428 |
outsidePressEvent: { |
| 10429 |
mouse: "sloppy", |
| 10430 |
// The visual viewport (affected by the mobile software keyboard) can be |
| 10431 |
// somewhat small. The user may want to scroll the screen to see more of |
| 10432 |
// the popup. |
| 10433 |
touch: "intentional" |
| 10434 |
}, |
| 10435 |
// Without a popup, let the Escape key bubble the event up to other popups' handlers. |
| 10436 |
bubbles: inline4 ? true : void 0, |
| 10437 |
outsidePress(event) { |
| 10438 |
const target = getTarget(event); |
| 10439 |
return !contains(triggerElement, target) && !contains(clearRef.current, target) && !contains(chipsContainerRef.current, target) && !contains(inputGroupElement, target); |
| 10440 |
} |
| 10441 |
}); |
| 10442 |
const listNavigation2 = useListNavigation(floatingRootContext, { |
| 10443 |
enabled: !readOnly && !disabled2, |
| 10444 |
id, |
| 10445 |
listRef, |
| 10446 |
activeIndex, |
| 10447 |
selectedIndex, |
| 10448 |
virtual: true, |
| 10449 |
loopFocus, |
| 10450 |
allowEscape: loopFocus && !autoHighlightMode, |
| 10451 |
focusItemOnOpen: queryChangedAfterOpen || selectionMode === "none" && !autoHighlightMode ? false : "auto", |
| 10452 |
focusItemOnHover: highlightItemOnHover, |
| 10453 |
resetOnPointerLeave: !keepHighlight, |
| 10454 |
// `cols` > 1 enables grid navigation. |
| 10455 |
// Since <Combobox.Row> infers column sizes (and is required when building a grid), |
| 10456 |
// it works correctly even with a value of `2`. |
| 10457 |
// Floating UI tests don't require `role="row"` wrappers, so retains the number API. |
| 10458 |
cols: grid ? 2 : 1, |
| 10459 |
orientation: grid ? "horizontal" : void 0, |
| 10460 |
rtl: direction === "rtl", |
| 10461 |
disabledIndices: EMPTY_ARRAY, |
| 10462 |
onNavigate(nextActiveIndex, event) { |
| 10463 |
if (!event && !open || transitionStatus === "ending") { |
| 10464 |
return; |
| 10465 |
} |
| 10466 |
if (!event) { |
| 10467 |
setIndices({ |
| 10468 |
activeIndex: nextActiveIndex |
| 10469 |
}); |
| 10470 |
} else { |
| 10471 |
setIndices({ |
| 10472 |
activeIndex: nextActiveIndex, |
| 10473 |
type: keyboardActiveRef.current ? "keyboard" : "pointer" |
| 10474 |
}); |
| 10475 |
} |
| 10476 |
} |
| 10477 |
}); |
| 10478 |
const inputProps = React52.useMemo(() => mergeProps(listNavigation2.reference, dismiss.reference, click.reference, role.reference), [listNavigation2.reference, dismiss.reference, click.reference, role.reference]); |
| 10479 |
const popupProps = React52.useMemo(() => mergeProps(FOCUSABLE_POPUP_PROPS, listNavigation2.floating, dismiss.floating, role.floating), [listNavigation2.floating, dismiss.floating, role.floating]); |
| 10480 |
const itemProps = React52.useMemo(() => { |
| 10481 |
const listNavigationItemProps = listNavigation2.item; |
| 10482 |
if (!listNavigationItemProps) { |
| 10483 |
return EMPTY_OBJECT; |
| 10484 |
} |
| 10485 |
return { |
| 10486 |
...listNavigationItemProps, |
| 10487 |
onFocus: void 0 |
| 10488 |
}; |
| 10489 |
}, [listNavigation2.item]); |
| 10490 |
useOnFirstRender(() => { |
| 10491 |
store.update({ |
| 10492 |
inline: inlineProp, |
| 10493 |
popupProps, |
| 10494 |
inputProps, |
| 10495 |
triggerProps, |
| 10496 |
itemProps, |
| 10497 |
setOpen, |
| 10498 |
setInputValue, |
| 10499 |
setSelectedValue, |
| 10500 |
setIndices, |
| 10501 |
onItemHighlighted, |
| 10502 |
handleSelection, |
| 10503 |
forceMount, |
| 10504 |
requestSubmit |
| 10505 |
}); |
| 10506 |
}); |
| 10507 |
useIsoLayoutEffect(() => { |
| 10508 |
store.update({ |
| 10509 |
id, |
| 10510 |
selectedValue, |
| 10511 |
open, |
| 10512 |
mounted, |
| 10513 |
transitionStatus, |
| 10514 |
items, |
| 10515 |
inline: inlineProp, |
| 10516 |
popupProps, |
| 10517 |
inputProps, |
| 10518 |
triggerProps, |
| 10519 |
openMethod, |
| 10520 |
itemProps, |
| 10521 |
selectionMode, |
| 10522 |
name, |
| 10523 |
form, |
| 10524 |
disabled: disabled2, |
| 10525 |
readOnly, |
| 10526 |
required, |
| 10527 |
grid, |
| 10528 |
isGrouped, |
| 10529 |
virtualized, |
| 10530 |
onOpenChangeComplete, |
| 10531 |
openOnInputClick, |
| 10532 |
itemToStringLabel, |
| 10533 |
modal, |
| 10534 |
autoHighlight: autoHighlightMode, |
| 10535 |
isItemEqualToValue, |
| 10536 |
submitOnItemClick, |
| 10537 |
hasInputValue, |
| 10538 |
requestSubmit, |
| 10539 |
inputOwnsFormValue: selectionMode === "none" && (inlineProp || !store.state.inputInsidePopup) |
| 10540 |
}); |
| 10541 |
}, [store, id, selectedValue, open, mounted, transitionStatus, items, popupProps, inputProps, itemProps, openMethod, triggerProps, selectionMode, name, disabled2, readOnly, required, validation, grid, isGrouped, virtualized, onOpenChangeComplete, openOnInputClick, itemToStringLabel, modal, isItemEqualToValue, submitOnItemClick, hasInputValue, inlineProp, requestSubmit, autoHighlightMode, form]); |
| 10542 |
const hiddenInputRef = useMergedRefs(inputRefProp, validation.inputRef); |
| 10543 |
const itemsContextValue = React52.useMemo(() => ({ |
| 10544 |
query, |
| 10545 |
hasItems, |
| 10546 |
filteredItems, |
| 10547 |
flatFilteredItems |
| 10548 |
}), [query, hasItems, filteredItems, flatFilteredItems]); |
| 10549 |
const serializedValue = React52.useMemo(() => { |
| 10550 |
if (Array.isArray(fieldRawValue)) { |
| 10551 |
return ""; |
| 10552 |
} |
| 10553 |
return stringifyAsValue(fieldRawValue, itemToStringValue); |
| 10554 |
}, [fieldRawValue, itemToStringValue]); |
| 10555 |
const hasMultipleSelection = multiple && Array.isArray(selectedValue) && selectedValue.length > 0; |
| 10556 |
const hiddenInputName = multiple || selectionMode === "none" && inputOwnsFormValue ? void 0 : name; |
| 10557 |
const hiddenInputs = React52.useMemo(() => { |
| 10558 |
if (!multiple || !Array.isArray(selectedValue) || !name) { |
| 10559 |
return null; |
| 10560 |
} |
| 10561 |
return selectedValue.map((value) => { |
| 10562 |
const currentSerializedValue = stringifyAsValue(value, itemToStringValue); |
| 10563 |
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("input", { |
| 10564 |
type: "hidden", |
| 10565 |
form, |
| 10566 |
name, |
| 10567 |
value: currentSerializedValue |
| 10568 |
}, currentSerializedValue); |
| 10569 |
}); |
| 10570 |
}, [multiple, selectedValue, form, name, itemToStringValue]); |
| 10571 |
const children = /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(React52.Fragment, { |
| 10572 |
children: [props.children, /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("input", { |
| 10573 |
...validation.getInputValidationProps({ |
| 10574 |
// Move focus when the hidden input is focused. |
| 10575 |
onFocus() { |
| 10576 |
if (inputInsidePopup) { |
| 10577 |
triggerElement?.focus(); |
| 10578 |
return; |
| 10579 |
} |
| 10580 |
(inputRef.current || triggerElement)?.focus(); |
| 10581 |
}, |
| 10582 |
// Handle browser autofill. |
| 10583 |
onChange(event) { |
| 10584 |
if (event.nativeEvent.defaultPrevented || disabled2 || readOnly) { |
| 10585 |
event.preventBaseUIHandler?.(); |
| 10586 |
return; |
| 10587 |
} |
| 10588 |
const nextValue = event.currentTarget.value; |
| 10589 |
const details = createChangeEventDetails(reason_parts_exports.none, event.nativeEvent); |
| 10590 |
function handleChange() { |
| 10591 |
if (multiple) { |
| 10592 |
return; |
| 10593 |
} |
| 10594 |
if (selectionMode === "none") { |
| 10595 |
setDirty(nextValue !== validityData.initialValue); |
| 10596 |
setInputValue(nextValue, details); |
| 10597 |
if (shouldValidateOnChange()) { |
| 10598 |
validation.commit(nextValue); |
| 10599 |
} |
| 10600 |
return; |
| 10601 |
} |
| 10602 |
const matchingValue = valuesRef.current.find((v) => { |
| 10603 |
const candidateValue = stringifyAsValue(v, itemToStringValue); |
| 10604 |
if (candidateValue.toLowerCase() === nextValue.toLowerCase()) { |
| 10605 |
return true; |
| 10606 |
} |
| 10607 |
const candidateLabel = stringifyAsLabel(v, itemToStringLabel); |
| 10608 |
if (candidateLabel.toLowerCase() === nextValue.toLowerCase()) { |
| 10609 |
return true; |
| 10610 |
} |
| 10611 |
return false; |
| 10612 |
}); |
| 10613 |
if (matchingValue != null) { |
| 10614 |
setDirty(matchingValue !== validityData.initialValue); |
| 10615 |
setSelectedValue?.(matchingValue, details); |
| 10616 |
if (shouldValidateOnChange()) { |
| 10617 |
validation.commit(matchingValue); |
| 10618 |
} |
| 10619 |
} |
| 10620 |
} |
| 10621 |
if (items) { |
| 10622 |
handleChange(); |
| 10623 |
} else { |
| 10624 |
forceMount(); |
| 10625 |
queueMicrotask(handleChange); |
| 10626 |
} |
| 10627 |
} |
| 10628 |
}), |
| 10629 |
id: id && hiddenInputName == null ? `${id}-hidden-input` : void 0, |
| 10630 |
form, |
| 10631 |
name: hiddenInputName, |
| 10632 |
autoComplete: formAutoComplete, |
| 10633 |
disabled: disabled2, |
| 10634 |
required: required && !hasMultipleSelection, |
| 10635 |
readOnly, |
| 10636 |
value: serializedValue, |
| 10637 |
ref: hiddenInputRef, |
| 10638 |
style: hiddenInputName ? visuallyHiddenInput : visuallyHidden, |
| 10639 |
tabIndex: -1, |
| 10640 |
"aria-hidden": true, |
| 10641 |
suppressHydrationWarning: true |
| 10642 |
}), hiddenInputs] |
| 10643 |
}); |
| 10644 |
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ComboboxRootContext.Provider, { |
| 10645 |
value: store, |
| 10646 |
children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ComboboxFloatingContext.Provider, { |
| 10647 |
value: floatingRootContext, |
| 10648 |
children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ComboboxDerivedItemsContext.Provider, { |
| 10649 |
value: itemsContextValue, |
| 10650 |
children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ComboboxInputValueContext.Provider, { |
| 10651 |
value: inputValue, |
| 10652 |
children |
| 10653 |
}) |
| 10654 |
}) |
| 10655 |
}) |
| 10656 |
}); |
| 10657 |
} |
| 10658 |
|
| 10659 |
// node_modules/@base-ui/react/esm/autocomplete/root/AutocompleteRoot.js |
| 10660 |
var import_jsx_runtime13 = __toESM(require_jsx_runtime(), 1); |
| 10661 |
function AutocompleteRoot(props) { |
| 10662 |
const { |
| 10663 |
openOnInputClick = false, |
| 10664 |
value, |
| 10665 |
defaultValue, |
| 10666 |
onValueChange, |
| 10667 |
mode = "list", |
| 10668 |
itemToStringValue, |
| 10669 |
...other |
| 10670 |
} = props; |
| 10671 |
const enableInline = mode === "inline" || mode === "both"; |
| 10672 |
const staticItems = mode === "inline" || mode === "none"; |
| 10673 |
const isControlled = value !== void 0; |
| 10674 |
const [internalValue, setInternalValue] = React53.useState(defaultValue ?? ""); |
| 10675 |
const [inlineInputValue, setInlineInputValue] = React53.useState(""); |
| 10676 |
React53.useEffect(() => { |
| 10677 |
if (isControlled) { |
| 10678 |
setInlineInputValue(""); |
| 10679 |
} |
| 10680 |
}, [value, isControlled]); |
| 10681 |
let resolvedInputValue; |
| 10682 |
if (enableInline && inlineInputValue !== "") { |
| 10683 |
resolvedInputValue = inlineInputValue; |
| 10684 |
} else if (isControlled) { |
| 10685 |
resolvedInputValue = value ?? ""; |
| 10686 |
} else { |
| 10687 |
resolvedInputValue = internalValue; |
| 10688 |
} |
| 10689 |
const collator = useCoreFilter(); |
| 10690 |
const baseFilter = React53.useMemo(() => { |
| 10691 |
if (other.filter !== void 0) { |
| 10692 |
return other.filter; |
| 10693 |
} |
| 10694 |
return collator.contains; |
| 10695 |
}, [other.filter, collator]); |
| 10696 |
const resolvedQuery = String(isControlled ? value : internalValue).trim(); |
| 10697 |
const resolvedFilter = React53.useMemo(() => { |
| 10698 |
if (mode !== "both") { |
| 10699 |
return staticItems ? null : baseFilter; |
| 10700 |
} |
| 10701 |
if (baseFilter === null) { |
| 10702 |
return null; |
| 10703 |
} |
| 10704 |
return (item, _query, toString) => { |
| 10705 |
return baseFilter(item, resolvedQuery, toString); |
| 10706 |
}; |
| 10707 |
}, [baseFilter, mode, resolvedQuery, staticItems]); |
| 10708 |
function handleValueChange(nextValue, eventDetails) { |
| 10709 |
setInlineInputValue(""); |
| 10710 |
if (!isControlled) { |
| 10711 |
setInternalValue(nextValue); |
| 10712 |
} |
| 10713 |
onValueChange?.(nextValue, eventDetails); |
| 10714 |
} |
| 10715 |
function handleItemHighlighted(highlightedValue, eventDetails) { |
| 10716 |
props.onItemHighlighted?.(highlightedValue, eventDetails); |
| 10717 |
if (eventDetails.reason === reason_parts_exports.pointer) { |
| 10718 |
return; |
| 10719 |
} |
| 10720 |
if (enableInline) { |
| 10721 |
if (highlightedValue == null) { |
| 10722 |
setInlineInputValue(""); |
| 10723 |
} else { |
| 10724 |
setInlineInputValue(stringifyAsLabel(highlightedValue, itemToStringValue)); |
| 10725 |
} |
| 10726 |
} else { |
| 10727 |
setInlineInputValue(""); |
| 10728 |
} |
| 10729 |
} |
| 10730 |
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(AriaCombobox, { |
| 10731 |
...other, |
| 10732 |
itemToStringLabel: itemToStringValue, |
| 10733 |
openOnInputClick, |
| 10734 |
selectionMode: "none", |
| 10735 |
fillInputOnItemPress: true, |
| 10736 |
filter: resolvedFilter, |
| 10737 |
autoComplete: mode, |
| 10738 |
inputValue: resolvedInputValue, |
| 10739 |
defaultInputValue: defaultValue, |
| 10740 |
onInputValueChange: handleValueChange, |
| 10741 |
onItemHighlighted: handleItemHighlighted |
| 10742 |
}); |
| 10743 |
} |
| 10744 |
|
| 10745 |
// node_modules/@base-ui/react/esm/autocomplete/value/AutocompleteValue.js |
| 10746 |
var React54 = __toESM(require_react(), 1); |
| 10747 |
var import_jsx_runtime14 = __toESM(require_jsx_runtime(), 1); |
| 10748 |
function AutocompleteValue(props) { |
| 10749 |
const { |
| 10750 |
children |
| 10751 |
} = props; |
| 10752 |
const inputValue = useComboboxInputValueContext(); |
| 10753 |
let returnValue = null; |
| 10754 |
if (typeof children === "function") { |
| 10755 |
returnValue = children(String(inputValue)); |
| 10756 |
} else if (children != null) { |
| 10757 |
returnValue = children; |
| 10758 |
} else { |
| 10759 |
returnValue = inputValue; |
| 10760 |
} |
| 10761 |
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(React54.Fragment, { |
| 10762 |
children: returnValue |
| 10763 |
}); |
| 10764 |
} |
| 10765 |
|
| 10766 |
// node_modules/@base-ui/react/esm/combobox/trigger/ComboboxTrigger.js |
| 10767 |
var React55 = __toESM(require_react(), 1); |
| 10768 |
|
| 10769 |
// node_modules/@base-ui/react/esm/combobox/utils/stateAttributesMapping.js |
| 10770 |
var triggerStateAttributesMapping = { |
| 10771 |
...pressableTriggerOpenStateMapping, |
| 10772 |
...fieldValidityMapping, |
| 10773 |
popupSide: (side) => side ? { |
| 10774 |
"data-popup-side": side |
| 10775 |
} : null, |
| 10776 |
listEmpty: (empty) => empty ? { |
| 10777 |
"data-list-empty": "" |
| 10778 |
} : null |
| 10779 |
}; |
| 10780 |
|
| 10781 |
// node_modules/@base-ui/react/esm/utils/getPseudoElementBounds.js |
| 10782 |
function getPseudoElementBounds(element) { |
| 10783 |
const elementRect = element.getBoundingClientRect(); |
| 10784 |
if (true) { |
| 10785 |
return elementRect; |
| 10786 |
} |
| 10787 |
const win = getWindow(element); |
| 10788 |
const beforeStyles = win.getComputedStyle(element, "::before"); |
| 10789 |
const afterStyles = win.getComputedStyle(element, "::after"); |
| 10790 |
const hasPseudoElements = beforeStyles.content !== "none" || afterStyles.content !== "none"; |
| 10791 |
if (!hasPseudoElements) { |
| 10792 |
return elementRect; |
| 10793 |
} |
| 10794 |
const beforeWidth = parseFloat(beforeStyles.width) || 0; |
| 10795 |
const beforeHeight = parseFloat(beforeStyles.height) || 0; |
| 10796 |
const afterWidth = parseFloat(afterStyles.width) || 0; |
| 10797 |
const afterHeight = parseFloat(afterStyles.height) || 0; |
| 10798 |
const totalWidth = Math.max(elementRect.width, beforeWidth, afterWidth); |
| 10799 |
const totalHeight = Math.max(elementRect.height, beforeHeight, afterHeight); |
| 10800 |
const widthDiff = totalWidth - elementRect.width; |
| 10801 |
const heightDiff = totalHeight - elementRect.height; |
| 10802 |
return { |
| 10803 |
left: elementRect.left - widthDiff / 2, |
| 10804 |
right: elementRect.right + widthDiff / 2, |
| 10805 |
top: elementRect.top - heightDiff / 2, |
| 10806 |
bottom: elementRect.bottom + heightDiff / 2 |
| 10807 |
}; |
| 10808 |
} |
| 10809 |
|
| 10810 |
// node_modules/@base-ui/react/esm/utils/resolveAriaLabelledBy.js |
| 10811 |
function resolveAriaLabelledBy(fieldLabelId, localLabelId) { |
| 10812 |
return fieldLabelId ?? localLabelId; |
| 10813 |
} |
| 10814 |
|
| 10815 |
// node_modules/@base-ui/react/esm/combobox/trigger/ComboboxTrigger.js |
| 10816 |
var BOUNDARY_OFFSET = 2; |
| 10817 |
var ComboboxTrigger = /* @__PURE__ */ React55.forwardRef(function ComboboxTrigger2(componentProps, forwardedRef) { |
| 10818 |
const { |
| 10819 |
render, |
| 10820 |
className, |
| 10821 |
nativeButton = true, |
| 10822 |
disabled: disabledProp = false, |
| 10823 |
id: idProp, |
| 10824 |
style, |
| 10825 |
...elementProps |
| 10826 |
} = componentProps; |
| 10827 |
const { |
| 10828 |
state: fieldState, |
| 10829 |
disabled: fieldDisabled, |
| 10830 |
setTouched, |
| 10831 |
setFocused, |
| 10832 |
validationMode, |
| 10833 |
validation |
| 10834 |
} = useFieldRootContext(); |
| 10835 |
const { |
| 10836 |
labelId: fieldLabelId |
| 10837 |
} = useLabelableContext(); |
| 10838 |
const store = useComboboxRootContext(); |
| 10839 |
const { |
| 10840 |
filteredItems |
| 10841 |
} = useComboboxDerivedItemsContext(); |
| 10842 |
const selectionMode = useStore(store, selectors2.selectionMode); |
| 10843 |
const comboboxDisabled = useStore(store, selectors2.disabled); |
| 10844 |
const readOnly = useStore(store, selectors2.readOnly); |
| 10845 |
const required = useStore(store, selectors2.required); |
| 10846 |
const mounted = useStore(store, selectors2.mounted); |
| 10847 |
const popupSideValue = useStore(store, selectors2.popupSide); |
| 10848 |
const positionerElement = useStore(store, selectors2.positionerElement); |
| 10849 |
const listElement = useStore(store, selectors2.listElement); |
| 10850 |
const triggerProps = useStore(store, selectors2.triggerProps); |
| 10851 |
const triggerElement = useStore(store, selectors2.triggerElement); |
| 10852 |
const inputInsidePopup = useStore(store, selectors2.inputInsidePopup); |
| 10853 |
const rootId = useStore(store, selectors2.id); |
| 10854 |
const comboboxLabelId = useStore(store, selectors2.labelId); |
| 10855 |
const open = useStore(store, selectors2.open); |
| 10856 |
const selectedValue = useStore(store, selectors2.selectedValue); |
| 10857 |
const activeIndex = useStore(store, selectors2.activeIndex); |
| 10858 |
const selectedIndex = useStore(store, selectors2.selectedIndex); |
| 10859 |
const hasSelectedValue = useStore(store, selectors2.hasSelectedValue); |
| 10860 |
const floatingRootContext = useComboboxFloatingContext(); |
| 10861 |
const inputValue = useComboboxInputValueContext(); |
| 10862 |
const focusTimeout = useTimeout(); |
| 10863 |
const disabled2 = fieldDisabled || comboboxDisabled || disabledProp; |
| 10864 |
const listEmpty = filteredItems.length === 0; |
| 10865 |
const popupSide = mounted && positionerElement ? popupSideValue : null; |
| 10866 |
useLabelableId({ |
| 10867 |
id: inputInsidePopup ? idProp : void 0 |
| 10868 |
}); |
| 10869 |
const id = inputInsidePopup ? idProp ?? rootId : idProp; |
| 10870 |
const ariaLabelledBy = resolveAriaLabelledBy(fieldLabelId, comboboxLabelId); |
| 10871 |
const currentPointerTypeRef = React55.useRef(""); |
| 10872 |
function trackPointerType(event) { |
| 10873 |
currentPointerTypeRef.current = event.pointerType; |
| 10874 |
} |
| 10875 |
const domReference = floatingRootContext.useState("domReferenceElement"); |
| 10876 |
React55.useEffect(() => { |
| 10877 |
if (!inputInsidePopup) { |
| 10878 |
return; |
| 10879 |
} |
| 10880 |
if (triggerElement && triggerElement !== domReference) { |
| 10881 |
floatingRootContext.set("domReferenceElement", triggerElement); |
| 10882 |
} |
| 10883 |
}, [triggerElement, domReference, floatingRootContext, inputInsidePopup]); |
| 10884 |
const { |
| 10885 |
reference: triggerTypeaheadProps |
| 10886 |
} = useTypeahead(floatingRootContext, { |
| 10887 |
enabled: !open && !readOnly && !comboboxDisabled && selectionMode === "single", |
| 10888 |
listRef: store.state.labelsRef, |
| 10889 |
activeIndex, |
| 10890 |
selectedIndex, |
| 10891 |
onMatch(index2) { |
| 10892 |
const nextSelectedValue = store.state.valuesRef.current[index2]; |
| 10893 |
if (nextSelectedValue !== void 0) { |
| 10894 |
store.state.setSelectedValue(nextSelectedValue, createChangeEventDetails("none")); |
| 10895 |
} |
| 10896 |
} |
| 10897 |
}); |
| 10898 |
const { |
| 10899 |
reference: triggerClickProps |
| 10900 |
} = useClick(floatingRootContext, { |
| 10901 |
enabled: !readOnly && !comboboxDisabled, |
| 10902 |
event: "mousedown" |
| 10903 |
}); |
| 10904 |
const { |
| 10905 |
buttonRef, |
| 10906 |
getButtonProps |
| 10907 |
} = useButton({ |
| 10908 |
native: nativeButton, |
| 10909 |
disabled: disabled2 |
| 10910 |
}); |
| 10911 |
const state = { |
| 10912 |
...fieldState, |
| 10913 |
open, |
| 10914 |
disabled: disabled2, |
| 10915 |
popupSide, |
| 10916 |
listEmpty, |
| 10917 |
placeholder: selectionMode === "none" ? false : !hasSelectedValue |
| 10918 |
}; |
| 10919 |
const setTriggerElement = useStableCallback((element2) => { |
| 10920 |
store.set("triggerElement", element2); |
| 10921 |
}); |
| 10922 |
const element = useRenderElement("button", componentProps, { |
| 10923 |
ref: [forwardedRef, buttonRef, setTriggerElement], |
| 10924 |
state, |
| 10925 |
props: [triggerProps, triggerClickProps, triggerTypeaheadProps, { |
| 10926 |
id, |
| 10927 |
tabIndex: inputInsidePopup ? 0 : -1, |
| 10928 |
role: inputInsidePopup ? "combobox" : void 0, |
| 10929 |
"aria-expanded": open ? "true" : "false", |
| 10930 |
"aria-haspopup": inputInsidePopup ? "dialog" : "listbox", |
| 10931 |
"aria-controls": open ? listElement?.id : void 0, |
| 10932 |
"aria-required": inputInsidePopup ? required || void 0 : void 0, |
| 10933 |
"aria-labelledby": ariaLabelledBy, |
| 10934 |
onPointerDown: trackPointerType, |
| 10935 |
onPointerEnter: trackPointerType, |
| 10936 |
onFocus() { |
| 10937 |
setFocused(true); |
| 10938 |
if (disabled2 || readOnly) { |
| 10939 |
return; |
| 10940 |
} |
| 10941 |
focusTimeout.start(0, store.state.forceMount); |
| 10942 |
}, |
| 10943 |
onBlur(event) { |
| 10944 |
if (contains(positionerElement, event.relatedTarget)) { |
| 10945 |
return; |
| 10946 |
} |
| 10947 |
setTouched(true); |
| 10948 |
setFocused(false); |
| 10949 |
if (validationMode === "onBlur") { |
| 10950 |
const valueToValidate = selectionMode === "none" ? inputValue : selectedValue; |
| 10951 |
validation.commit(valueToValidate); |
| 10952 |
} |
| 10953 |
}, |
| 10954 |
onMouseDown(event) { |
| 10955 |
if (disabled2 || readOnly) { |
| 10956 |
return; |
| 10957 |
} |
| 10958 |
if (!inputInsidePopup) { |
| 10959 |
floatingRootContext.set("domReferenceElement", event.currentTarget); |
| 10960 |
} |
| 10961 |
store.state.forceMount(); |
| 10962 |
if (currentPointerTypeRef.current !== "touch") { |
| 10963 |
store.state.inputRef.current?.focus(); |
| 10964 |
if (!inputInsidePopup) { |
| 10965 |
event.preventDefault(); |
| 10966 |
} |
| 10967 |
} |
| 10968 |
if (open) { |
| 10969 |
return; |
| 10970 |
} |
| 10971 |
const doc = ownerDocument(event.currentTarget); |
| 10972 |
function handleMouseUp(mouseEvent) { |
| 10973 |
if (!triggerElement) { |
| 10974 |
return; |
| 10975 |
} |
| 10976 |
const mouseUpTarget = getTarget(mouseEvent); |
| 10977 |
const positioner = store.state.positionerElement; |
| 10978 |
const list = store.state.listElement; |
| 10979 |
if (contains(triggerElement, mouseUpTarget) || contains(positioner, mouseUpTarget) || contains(list, mouseUpTarget) || mouseUpTarget === triggerElement) { |
| 10980 |
return; |
| 10981 |
} |
| 10982 |
const bounds = getPseudoElementBounds(triggerElement); |
| 10983 |
const withinHorizontal = mouseEvent.clientX >= bounds.left - BOUNDARY_OFFSET && mouseEvent.clientX <= bounds.right + BOUNDARY_OFFSET; |
| 10984 |
const withinVertical = mouseEvent.clientY >= bounds.top - BOUNDARY_OFFSET && mouseEvent.clientY <= bounds.bottom + BOUNDARY_OFFSET; |
| 10985 |
if (withinHorizontal && withinVertical) { |
| 10986 |
return; |
| 10987 |
} |
| 10988 |
store.state.setOpen(false, createChangeEventDetails("cancel-open", mouseEvent)); |
| 10989 |
} |
| 10990 |
if (inputInsidePopup) { |
| 10991 |
doc.addEventListener("mouseup", handleMouseUp, { |
| 10992 |
once: true |
| 10993 |
}); |
| 10994 |
} |
| 10995 |
}, |
| 10996 |
onKeyDown(event) { |
| 10997 |
if (disabled2 || readOnly) { |
| 10998 |
return; |
| 10999 |
} |
| 11000 |
if (event.key === "ArrowDown" || event.key === "ArrowUp") { |
| 11001 |
stopEvent(event); |
| 11002 |
store.state.setOpen(true, createChangeEventDetails(reason_parts_exports.listNavigation, event.nativeEvent)); |
| 11003 |
store.state.inputRef.current?.focus(); |
| 11004 |
} |
| 11005 |
} |
| 11006 |
}, validation ? validation.getValidationProps(elementProps) : elementProps, getButtonProps], |
| 11007 |
stateAttributesMapping: triggerStateAttributesMapping |
| 11008 |
}); |
| 11009 |
return element; |
| 11010 |
}); |
| 11011 |
if (true) ComboboxTrigger.displayName = "ComboboxTrigger"; |
| 11012 |
|
| 11013 |
// node_modules/@base-ui/react/esm/autocomplete/trigger/AutocompleteTrigger.js |
| 11014 |
var AutocompleteTrigger = ComboboxTrigger; |
| 11015 |
|
| 11016 |
// node_modules/@base-ui/react/esm/combobox/input/ComboboxInput.js |
| 11017 |
var React59 = __toESM(require_react(), 1); |
| 11018 |
|
| 11019 |
// node_modules/@base-ui/react/esm/combobox/chips/ComboboxChipsContext.js |
| 11020 |
var React56 = __toESM(require_react(), 1); |
| 11021 |
var ComboboxChipsContext = /* @__PURE__ */ React56.createContext(void 0); |
| 11022 |
if (true) ComboboxChipsContext.displayName = "ComboboxChipsContext"; |
| 11023 |
function useComboboxChipsContext() { |
| 11024 |
return React56.useContext(ComboboxChipsContext); |
| 11025 |
} |
| 11026 |
|
| 11027 |
// node_modules/@base-ui/react/esm/combobox/positioner/ComboboxPositionerContext.js |
| 11028 |
var React57 = __toESM(require_react(), 1); |
| 11029 |
var ComboboxPositionerContext = /* @__PURE__ */ React57.createContext(void 0); |
| 11030 |
if (true) ComboboxPositionerContext.displayName = "ComboboxPositionerContext"; |
| 11031 |
function useComboboxPositionerContext(optional) { |
| 11032 |
const context = React57.useContext(ComboboxPositionerContext); |
| 11033 |
if (context === void 0 && !optional) { |
| 11034 |
throw new Error(true ? "Base UI: <Combobox.Popup> and <Combobox.Arrow> must be used within the <Combobox.Positioner> component" : formatErrorMessage_default(21)); |
| 11035 |
} |
| 11036 |
return context; |
| 11037 |
} |
| 11038 |
|
| 11039 |
// node_modules/@base-ui/react/esm/combobox/utils/ComboboxInternalDismissButton.js |
| 11040 |
var React58 = __toESM(require_react(), 1); |
| 11041 |
var import_jsx_runtime15 = __toESM(require_jsx_runtime(), 1); |
| 11042 |
var ComboboxInternalDismissButton = /* @__PURE__ */ React58.forwardRef(function ComboboxInternalDismissButton2(_, forwardedRef) { |
| 11043 |
const store = useComboboxRootContext(); |
| 11044 |
const { |
| 11045 |
buttonRef, |
| 11046 |
getButtonProps |
| 11047 |
} = useButton({ |
| 11048 |
native: false |
| 11049 |
}); |
| 11050 |
const mergedRef = useMergedRefs(forwardedRef, buttonRef); |
| 11051 |
function handleDismiss(event) { |
| 11052 |
store.state.setOpen(false, createChangeEventDetails(reason_parts_exports.closePress, event.nativeEvent, event.currentTarget)); |
| 11053 |
} |
| 11054 |
const dismissProps = getButtonProps({ |
| 11055 |
onClick: handleDismiss |
| 11056 |
}); |
| 11057 |
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { |
| 11058 |
ref: mergedRef, |
| 11059 |
...dismissProps, |
| 11060 |
"aria-label": "Dismiss", |
| 11061 |
tabIndex: void 0, |
| 11062 |
style: visuallyHiddenInput |
| 11063 |
}); |
| 11064 |
}); |
| 11065 |
if (true) ComboboxInternalDismissButton.displayName = "ComboboxInternalDismissButton"; |
| 11066 |
|
| 11067 |
// node_modules/@base-ui/react/esm/combobox/input/ComboboxInput.js |
| 11068 |
var import_jsx_runtime16 = __toESM(require_jsx_runtime(), 1); |
| 11069 |
var ComboboxInput = /* @__PURE__ */ React59.forwardRef(function ComboboxInput2(componentProps, forwardedRef) { |
| 11070 |
const { |
| 11071 |
render, |
| 11072 |
className, |
| 11073 |
disabled: disabledProp = false, |
| 11074 |
id: idProp, |
| 11075 |
style, |
| 11076 |
...elementProps |
| 11077 |
} = componentProps; |
| 11078 |
const { |
| 11079 |
state: fieldState, |
| 11080 |
disabled: fieldDisabled, |
| 11081 |
setTouched, |
| 11082 |
setFocused, |
| 11083 |
validationMode, |
| 11084 |
validation |
| 11085 |
} = useFieldRootContext(); |
| 11086 |
const { |
| 11087 |
labelId: fieldLabelId |
| 11088 |
} = useLabelableContext(); |
| 11089 |
const comboboxChipsContext = useComboboxChipsContext(); |
| 11090 |
const positioning = useComboboxPositionerContext(true); |
| 11091 |
const hasPositionerParent = Boolean(positioning); |
| 11092 |
const store = useComboboxRootContext(); |
| 11093 |
const { |
| 11094 |
filteredItems |
| 11095 |
} = useComboboxDerivedItemsContext(); |
| 11096 |
const inputValue = useComboboxInputValueContext(); |
| 11097 |
const direction = useDirection(); |
| 11098 |
const required = useStore(store, selectors2.required); |
| 11099 |
const comboboxDisabled = useStore(store, selectors2.disabled); |
| 11100 |
const readOnly = useStore(store, selectors2.readOnly); |
| 11101 |
const name = useStore(store, selectors2.name); |
| 11102 |
const form = useStore(store, selectors2.form); |
| 11103 |
const selectionMode = useStore(store, selectors2.selectionMode); |
| 11104 |
const autoHighlightMode = useStore(store, selectors2.autoHighlight); |
| 11105 |
const inputProps = useStore(store, selectors2.inputProps); |
| 11106 |
const triggerProps = useStore(store, selectors2.triggerProps); |
| 11107 |
const open = useStore(store, selectors2.open); |
| 11108 |
const mounted = useStore(store, selectors2.mounted); |
| 11109 |
const selectedValue = useStore(store, selectors2.selectedValue); |
| 11110 |
const popupSideValue = useStore(store, selectors2.popupSide); |
| 11111 |
const positionerElement = useStore(store, selectors2.positionerElement); |
| 11112 |
const rootId = useStore(store, selectors2.id); |
| 11113 |
const inline4 = useStore(store, selectors2.inline); |
| 11114 |
const modal = useStore(store, selectors2.modal); |
| 11115 |
const autoHighlightEnabled = Boolean(autoHighlightMode); |
| 11116 |
const popupSide = mounted && positionerElement ? popupSideValue : null; |
| 11117 |
const disabled2 = fieldDisabled || comboboxDisabled || disabledProp; |
| 11118 |
const listEmpty = filteredItems.length === 0; |
| 11119 |
const isInsidePopup = hasPositionerParent || inline4; |
| 11120 |
const focusManagerModal = !isInsidePopup || modal; |
| 11121 |
const id = useBaseUiId(idProp ?? (!isInsidePopup ? rootId : void 0)); |
| 11122 |
const ariaLabelledBy = resolveAriaLabelledBy(fieldLabelId, void 0); |
| 11123 |
const fieldStateForInput = hasPositionerParent ? DEFAULT_FIELD_STATE_ATTRIBUTES : fieldState; |
| 11124 |
const [composingValue, setComposingValue] = React59.useState(null); |
| 11125 |
const isComposingRef = React59.useRef(false); |
| 11126 |
const lastActiveIndexRef = React59.useRef(null); |
| 11127 |
const shouldRestoreActiveIndexRef = React59.useRef(false); |
| 11128 |
const inputOwnsFormValue = selectionMode === "none" && !hasPositionerParent; |
| 11129 |
const setInputElement = useStableCallback((element2) => { |
| 11130 |
const nextIsInsidePopup = hasPositionerParent || store.state.inline; |
| 11131 |
if (nextIsInsidePopup && !store.state.hasInputValue) { |
| 11132 |
store.state.setInputValue("", createChangeEventDetails(reason_parts_exports.none)); |
| 11133 |
} |
| 11134 |
store.update({ |
| 11135 |
inputElement: element2, |
| 11136 |
inputInsidePopup: nextIsInsidePopup, |
| 11137 |
inputOwnsFormValue |
| 11138 |
}); |
| 11139 |
}); |
| 11140 |
const validationProps = hasPositionerParent || !validation ? elementProps : validation.getValidationProps(elementProps); |
| 11141 |
const state = { |
| 11142 |
...fieldStateForInput, |
| 11143 |
open, |
| 11144 |
disabled: disabled2, |
| 11145 |
readOnly, |
| 11146 |
popupSide, |
| 11147 |
listEmpty |
| 11148 |
}; |
| 11149 |
function handleKeyDown(event) { |
| 11150 |
if (!comboboxChipsContext) { |
| 11151 |
return void 0; |
| 11152 |
} |
| 11153 |
let nextIndex; |
| 11154 |
const { |
| 11155 |
highlightedChipIndex |
| 11156 |
} = comboboxChipsContext; |
| 11157 |
const renderedChipsCount = comboboxChipsContext.chipsRef.current.length; |
| 11158 |
const isRtl = direction === "rtl"; |
| 11159 |
const previousChipKey = isRtl ? "ArrowRight" : "ArrowLeft"; |
| 11160 |
const nextChipKey = isRtl ? "ArrowLeft" : "ArrowRight"; |
| 11161 |
if (highlightedChipIndex !== void 0) { |
| 11162 |
if (event.key === previousChipKey) { |
| 11163 |
event.preventDefault(); |
| 11164 |
if (highlightedChipIndex > 0) { |
| 11165 |
nextIndex = highlightedChipIndex - 1; |
| 11166 |
} else { |
| 11167 |
nextIndex = void 0; |
| 11168 |
} |
| 11169 |
} else if (event.key === nextChipKey) { |
| 11170 |
event.preventDefault(); |
| 11171 |
if (highlightedChipIndex < renderedChipsCount - 1) { |
| 11172 |
nextIndex = highlightedChipIndex + 1; |
| 11173 |
} else { |
| 11174 |
nextIndex = void 0; |
| 11175 |
} |
| 11176 |
} else if (event.key === "Backspace" || event.key === "Delete") { |
| 11177 |
event.preventDefault(); |
| 11178 |
const computedNextIndex = highlightedChipIndex >= selectedValue.length - 1 ? selectedValue.length - 2 : highlightedChipIndex; |
| 11179 |
nextIndex = computedNextIndex >= 0 ? computedNextIndex : void 0; |
| 11180 |
store.state.setIndices({ |
| 11181 |
activeIndex: null, |
| 11182 |
selectedIndex: null, |
| 11183 |
type: "keyboard" |
| 11184 |
}); |
| 11185 |
} |
| 11186 |
return nextIndex; |
| 11187 |
} |
| 11188 |
if (event.key === previousChipKey && (event.currentTarget.selectionStart ?? 0) === 0 && selectedValue.length > 0) { |
| 11189 |
event.preventDefault(); |
| 11190 |
nextIndex = renderedChipsCount > 0 ? renderedChipsCount - 1 : void 0; |
| 11191 |
} else if (event.key === "Backspace" && event.currentTarget.value === "" && selectedValue.length > 0) { |
| 11192 |
store.state.setIndices({ |
| 11193 |
activeIndex: null, |
| 11194 |
selectedIndex: null, |
| 11195 |
type: "keyboard" |
| 11196 |
}); |
| 11197 |
event.preventDefault(); |
| 11198 |
} |
| 11199 |
return nextIndex; |
| 11200 |
} |
| 11201 |
const element = useRenderElement("input", componentProps, { |
| 11202 |
state, |
| 11203 |
ref: [forwardedRef, store.state.inputRef, setInputElement], |
| 11204 |
props: [inputProps, triggerProps, { |
| 11205 |
type: "text", |
| 11206 |
value: componentProps.value ?? composingValue ?? inputValue, |
| 11207 |
"aria-readonly": readOnly || void 0, |
| 11208 |
"aria-required": required || void 0, |
| 11209 |
"aria-labelledby": ariaLabelledBy, |
| 11210 |
disabled: disabled2, |
| 11211 |
readOnly, |
| 11212 |
required: selectionMode === "none" ? required : void 0, |
| 11213 |
form, |
| 11214 |
...inputOwnsFormValue && name && { |
| 11215 |
name |
| 11216 |
}, |
| 11217 |
id, |
| 11218 |
onFocus() { |
| 11219 |
setFocused(true); |
| 11220 |
if (!inline4 || !shouldRestoreActiveIndexRef.current) { |
| 11221 |
return; |
| 11222 |
} |
| 11223 |
shouldRestoreActiveIndexRef.current = false; |
| 11224 |
const nextActiveIndex = lastActiveIndexRef.current; |
| 11225 |
if (nextActiveIndex == null || // `valuesRef` can be sparse, so guard against restoring a removed slot. |
| 11226 |
!Object.hasOwn(store.state.valuesRef.current, nextActiveIndex)) { |
| 11227 |
return; |
| 11228 |
} |
| 11229 |
store.state.setIndices({ |
| 11230 |
activeIndex: nextActiveIndex |
| 11231 |
}); |
| 11232 |
}, |
| 11233 |
onBlur() { |
| 11234 |
setTouched(true); |
| 11235 |
setFocused(false); |
| 11236 |
const activeIndex = store.state.activeIndex; |
| 11237 |
if (inline4 && activeIndex !== null && autoHighlightMode !== "always") { |
| 11238 |
lastActiveIndexRef.current = activeIndex; |
| 11239 |
shouldRestoreActiveIndexRef.current = true; |
| 11240 |
store.state.setIndices({ |
| 11241 |
activeIndex: null |
| 11242 |
}); |
| 11243 |
} |
| 11244 |
if (validationMode === "onBlur") { |
| 11245 |
const valueToValidate = selectionMode === "none" ? inputValue : selectedValue; |
| 11246 |
validation.commit(valueToValidate); |
| 11247 |
} |
| 11248 |
}, |
| 11249 |
onCompositionStart(event) { |
| 11250 |
if (isAndroid) { |
| 11251 |
return; |
| 11252 |
} |
| 11253 |
isComposingRef.current = true; |
| 11254 |
setComposingValue(event.currentTarget.value); |
| 11255 |
}, |
| 11256 |
onCompositionEnd(event) { |
| 11257 |
isComposingRef.current = false; |
| 11258 |
const next = event.currentTarget.value; |
| 11259 |
setComposingValue(null); |
| 11260 |
store.state.setInputValue(next, createChangeEventDetails(reason_parts_exports.inputChange, event.nativeEvent)); |
| 11261 |
}, |
| 11262 |
onChange(event) { |
| 11263 |
const inputType = event.nativeEvent.inputType; |
| 11264 |
const autofillLikeInput = !inputType || inputType === "insertReplacementText"; |
| 11265 |
const shouldOpenOnInput = isComposingRef.current || !autofillLikeInput; |
| 11266 |
if (isComposingRef.current) { |
| 11267 |
const nextVal = event.currentTarget.value; |
| 11268 |
setComposingValue(nextVal); |
| 11269 |
if (nextVal === "" && !store.state.openOnInputClick && !store.state.inputInsidePopup) { |
| 11270 |
store.state.setOpen(false, createChangeEventDetails(reason_parts_exports.inputClear, event.nativeEvent)); |
| 11271 |
} |
| 11272 |
const trimmed2 = nextVal.trim(); |
| 11273 |
const shouldMaintainHighlight = autoHighlightEnabled && trimmed2 !== ""; |
| 11274 |
if (!readOnly && !disabled2 && trimmed2) { |
| 11275 |
if (shouldOpenOnInput) { |
| 11276 |
store.state.setOpen(true, createChangeEventDetails(reason_parts_exports.inputChange, event.nativeEvent)); |
| 11277 |
if (!autoHighlightEnabled) { |
| 11278 |
store.state.setIndices({ |
| 11279 |
activeIndex: null, |
| 11280 |
selectedIndex: null, |
| 11281 |
type: store.state.keyboardActiveRef.current ? "keyboard" : "pointer" |
| 11282 |
}); |
| 11283 |
} |
| 11284 |
} |
| 11285 |
} |
| 11286 |
if (open && store.state.activeIndex !== null && !shouldMaintainHighlight) { |
| 11287 |
store.state.setIndices({ |
| 11288 |
activeIndex: null, |
| 11289 |
selectedIndex: null, |
| 11290 |
type: store.state.keyboardActiveRef.current ? "keyboard" : "pointer" |
| 11291 |
}); |
| 11292 |
} |
| 11293 |
return; |
| 11294 |
} |
| 11295 |
store.state.setInputValue(event.currentTarget.value, createChangeEventDetails(reason_parts_exports.inputChange, event.nativeEvent)); |
| 11296 |
const empty = event.currentTarget.value === ""; |
| 11297 |
const clearDetails = createChangeEventDetails(reason_parts_exports.inputClear, event.nativeEvent); |
| 11298 |
if (empty && !store.state.inputInsidePopup) { |
| 11299 |
if (selectionMode === "single") { |
| 11300 |
store.state.setSelectedValue(null, clearDetails); |
| 11301 |
} |
| 11302 |
if (!store.state.openOnInputClick) { |
| 11303 |
store.state.setOpen(false, clearDetails); |
| 11304 |
} |
| 11305 |
} |
| 11306 |
const trimmed = event.currentTarget.value.trim(); |
| 11307 |
if (!readOnly && !disabled2 && trimmed) { |
| 11308 |
if (shouldOpenOnInput) { |
| 11309 |
store.state.setOpen(true, createChangeEventDetails(reason_parts_exports.inputChange, event.nativeEvent)); |
| 11310 |
if (!autoHighlightEnabled) { |
| 11311 |
store.state.setIndices({ |
| 11312 |
activeIndex: null, |
| 11313 |
selectedIndex: null, |
| 11314 |
type: store.state.keyboardActiveRef.current ? "keyboard" : "pointer" |
| 11315 |
}); |
| 11316 |
} |
| 11317 |
} |
| 11318 |
} |
| 11319 |
if (open && store.state.activeIndex !== null && !autoHighlightEnabled) { |
| 11320 |
store.state.setIndices({ |
| 11321 |
activeIndex: null, |
| 11322 |
selectedIndex: null, |
| 11323 |
type: store.state.keyboardActiveRef.current ? "keyboard" : "pointer" |
| 11324 |
}); |
| 11325 |
} |
| 11326 |
}, |
| 11327 |
onKeyDown(event) { |
| 11328 |
if (disabled2 || readOnly) { |
| 11329 |
return; |
| 11330 |
} |
| 11331 |
if (event.ctrlKey || event.shiftKey || event.altKey || event.metaKey) { |
| 11332 |
return; |
| 11333 |
} |
| 11334 |
store.state.keyboardActiveRef.current = true; |
| 11335 |
const input = event.currentTarget; |
| 11336 |
const scrollAmount = input.scrollWidth - input.clientWidth; |
| 11337 |
const isRTL2 = direction === "rtl"; |
| 11338 |
if (event.key === "Home") { |
| 11339 |
stopEvent(event); |
| 11340 |
const cursor = isFirefox && isRTL2 ? input.value.length : 0; |
| 11341 |
input.setSelectionRange(cursor, cursor); |
| 11342 |
input.scrollLeft = 0; |
| 11343 |
return; |
| 11344 |
} |
| 11345 |
if (event.key === "End") { |
| 11346 |
stopEvent(event); |
| 11347 |
const cursor = isFirefox && isRTL2 ? 0 : input.value.length; |
| 11348 |
input.setSelectionRange(cursor, cursor); |
| 11349 |
input.scrollLeft = isRTL2 ? -scrollAmount : scrollAmount; |
| 11350 |
return; |
| 11351 |
} |
| 11352 |
if (!mounted && event.key === "Escape") { |
| 11353 |
const isClear = selectionMode === "multiple" && Array.isArray(selectedValue) ? selectedValue.length === 0 : selectedValue === null; |
| 11354 |
const details = createChangeEventDetails(reason_parts_exports.escapeKey, event.nativeEvent); |
| 11355 |
const value = selectionMode === "multiple" ? [] : null; |
| 11356 |
store.state.setInputValue("", details); |
| 11357 |
store.state.setSelectedValue(value, details); |
| 11358 |
if (!isClear && !store.state.inline && !details.isPropagationAllowed) { |
| 11359 |
event.stopPropagation(); |
| 11360 |
} |
| 11361 |
return; |
| 11362 |
} |
| 11363 |
if (comboboxChipsContext && event.key === "Backspace" && input.value === "" && comboboxChipsContext.highlightedChipIndex === void 0 && Array.isArray(selectedValue) && selectedValue.length > 0) { |
| 11364 |
const renderedChipsCount = comboboxChipsContext.chipsRef.current.length; |
| 11365 |
const removalIndex = renderedChipsCount > 0 ? renderedChipsCount - 1 : selectedValue.length - 1; |
| 11366 |
const newValue = selectedValue.filter((_, index2) => index2 !== removalIndex); |
| 11367 |
store.state.setIndices({ |
| 11368 |
activeIndex: null, |
| 11369 |
selectedIndex: null, |
| 11370 |
type: store.state.keyboardActiveRef.current ? "keyboard" : "pointer" |
| 11371 |
}); |
| 11372 |
store.state.setSelectedValue(newValue, createChangeEventDetails(reason_parts_exports.none, event.nativeEvent)); |
| 11373 |
return; |
| 11374 |
} |
| 11375 |
const hadHighlightedChip = comboboxChipsContext?.highlightedChipIndex !== void 0; |
| 11376 |
const nextIndex = handleKeyDown(event); |
| 11377 |
comboboxChipsContext?.setHighlightedChipIndex(nextIndex); |
| 11378 |
if (nextIndex !== void 0) { |
| 11379 |
comboboxChipsContext?.chipsRef.current[nextIndex]?.focus(); |
| 11380 |
} else if (hadHighlightedChip) { |
| 11381 |
store.state.inputRef.current?.focus(); |
| 11382 |
} |
| 11383 |
if (event.which === 229) { |
| 11384 |
return; |
| 11385 |
} |
| 11386 |
if (event.key === "Enter" && open) { |
| 11387 |
const activeIndex = store.state.activeIndex; |
| 11388 |
const nativeEvent = event.nativeEvent; |
| 11389 |
if (activeIndex === null) { |
| 11390 |
if (inline4) { |
| 11391 |
return; |
| 11392 |
} |
| 11393 |
store.state.setOpen(false, createChangeEventDetails(reason_parts_exports.none, nativeEvent)); |
| 11394 |
return; |
| 11395 |
} |
| 11396 |
stopEvent(event); |
| 11397 |
const listItem = store.state.listRef.current[activeIndex]; |
| 11398 |
if (listItem) { |
| 11399 |
store.state.selectionEventRef.current = nativeEvent; |
| 11400 |
listItem.click(); |
| 11401 |
store.state.selectionEventRef.current = null; |
| 11402 |
} |
| 11403 |
} |
| 11404 |
}, |
| 11405 |
onPointerMove() { |
| 11406 |
store.state.keyboardActiveRef.current = false; |
| 11407 |
}, |
| 11408 |
onPointerDown() { |
| 11409 |
store.state.keyboardActiveRef.current = false; |
| 11410 |
} |
| 11411 |
}, validationProps], |
| 11412 |
stateAttributesMapping: triggerStateAttributesMapping |
| 11413 |
}); |
| 11414 |
const renderedInput = hasPositionerParent ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(FieldRootContext.Provider, { |
| 11415 |
value: DEFAULT_FIELD_ROOT_CONTEXT, |
| 11416 |
children: element |
| 11417 |
}) : element; |
| 11418 |
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(React59.Fragment, { |
| 11419 |
children: [open && focusManagerModal && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ComboboxInternalDismissButton, { |
| 11420 |
ref: store.state.startDismissRef |
| 11421 |
}), renderedInput] |
| 11422 |
}); |
| 11423 |
}); |
| 11424 |
if (true) ComboboxInput.displayName = "ComboboxInput"; |
| 11425 |
|
| 11426 |
// node_modules/@base-ui/react/esm/combobox/input-group/ComboboxInputGroup.js |
| 11427 |
var React60 = __toESM(require_react(), 1); |
| 11428 |
|
| 11429 |
// node_modules/@base-ui/react/esm/combobox/utils/handleInputPress.js |
| 11430 |
function handleInputPress(event, store, disabled2, readOnly, shouldIgnoreTarget) { |
| 11431 |
if (event.baseUIHandlerPrevented || readOnly) { |
| 11432 |
return; |
| 11433 |
} |
| 11434 |
const target = getTarget(event.nativeEvent); |
| 11435 |
const targetElement = isElement(target) ? target : null; |
| 11436 |
if (targetElement !== event.currentTarget && (shouldIgnoreTarget?.(targetElement) || isInteractiveElement(targetElement))) { |
| 11437 |
return; |
| 11438 |
} |
| 11439 |
event.preventDefault(); |
| 11440 |
if (disabled2) { |
| 11441 |
return; |
| 11442 |
} |
| 11443 |
store.state.inputRef.current?.focus(); |
| 11444 |
if (store.state.openOnInputClick) { |
| 11445 |
store.state.setOpen(true, createChangeEventDetails(reason_parts_exports.inputPress, event.nativeEvent)); |
| 11446 |
} |
| 11447 |
} |
| 11448 |
|
| 11449 |
// node_modules/@base-ui/react/esm/combobox/input-group/ComboboxInputGroup.js |
| 11450 |
var ComboboxInputGroup = /* @__PURE__ */ React60.forwardRef(function ComboboxInputGroup2(componentProps, forwardedRef) { |
| 11451 |
const { |
| 11452 |
render, |
| 11453 |
className, |
| 11454 |
style, |
| 11455 |
...elementProps |
| 11456 |
} = componentProps; |
| 11457 |
const { |
| 11458 |
state: fieldState |
| 11459 |
} = useFieldRootContext(); |
| 11460 |
const store = useComboboxRootContext(); |
| 11461 |
const { |
| 11462 |
filteredItems |
| 11463 |
} = useComboboxDerivedItemsContext(); |
| 11464 |
const open = useStore(store, selectors2.open); |
| 11465 |
const mounted = useStore(store, selectors2.mounted); |
| 11466 |
const popupSideValue = useStore(store, selectors2.popupSide); |
| 11467 |
const positionerElement = useStore(store, selectors2.positionerElement); |
| 11468 |
const comboboxDisabled = useStore(store, selectors2.disabled); |
| 11469 |
const readOnly = useStore(store, selectors2.readOnly); |
| 11470 |
const hasSelectedValue = useStore(store, selectors2.hasSelectedValue); |
| 11471 |
const selectionMode = useStore(store, selectors2.selectionMode); |
| 11472 |
const popupSide = mounted && positionerElement ? popupSideValue : null; |
| 11473 |
const disabled2 = comboboxDisabled; |
| 11474 |
const listEmpty = filteredItems.length === 0; |
| 11475 |
const placeholder = selectionMode === "none" ? false : !hasSelectedValue; |
| 11476 |
const state = { |
| 11477 |
...fieldState, |
| 11478 |
open, |
| 11479 |
disabled: disabled2, |
| 11480 |
readOnly, |
| 11481 |
popupSide, |
| 11482 |
listEmpty, |
| 11483 |
placeholder |
| 11484 |
}; |
| 11485 |
const setInputGroupElement = useStableCallback((element) => { |
| 11486 |
store.set("inputGroupElement", element); |
| 11487 |
}); |
| 11488 |
return useRenderElement("div", componentProps, { |
| 11489 |
ref: [forwardedRef, setInputGroupElement], |
| 11490 |
props: [{ |
| 11491 |
role: "group", |
| 11492 |
onMouseDown(event) { |
| 11493 |
handleInputPress(event, store, disabled2, readOnly, (target) => { |
| 11494 |
return contains(store.state.chipsContainerRef.current, target); |
| 11495 |
}); |
| 11496 |
} |
| 11497 |
}, elementProps], |
| 11498 |
state, |
| 11499 |
stateAttributesMapping: triggerStateAttributesMapping |
| 11500 |
}); |
| 11501 |
}); |
| 11502 |
if (true) ComboboxInputGroup.displayName = "ComboboxInputGroup"; |
| 11503 |
|
| 11504 |
// node_modules/@base-ui/react/esm/autocomplete/input-group/AutocompleteInputGroup.js |
| 11505 |
var AutocompleteInputGroup = ComboboxInputGroup; |
| 11506 |
|
| 11507 |
// node_modules/@base-ui/react/esm/combobox/icon/ComboboxIcon.js |
| 11508 |
var React61 = __toESM(require_react(), 1); |
| 11509 |
var ComboboxIcon = /* @__PURE__ */ React61.forwardRef(function ComboboxIcon2(componentProps, forwardedRef) { |
| 11510 |
const { |
| 11511 |
render, |
| 11512 |
className, |
| 11513 |
style, |
| 11514 |
...elementProps |
| 11515 |
} = componentProps; |
| 11516 |
const element = useRenderElement("span", componentProps, { |
| 11517 |
ref: forwardedRef, |
| 11518 |
props: [{ |
| 11519 |
"aria-hidden": true, |
| 11520 |
children: "\u25BC" |
| 11521 |
}, elementProps] |
| 11522 |
}); |
| 11523 |
return element; |
| 11524 |
}); |
| 11525 |
if (true) ComboboxIcon.displayName = "ComboboxIcon"; |
| 11526 |
|
| 11527 |
// node_modules/@base-ui/react/esm/combobox/clear/ComboboxClear.js |
| 11528 |
var React62 = __toESM(require_react(), 1); |
| 11529 |
var stateAttributesMapping = { |
| 11530 |
...transitionStatusMapping, |
| 11531 |
...triggerOpenStateMapping |
| 11532 |
}; |
| 11533 |
var ComboboxClear = /* @__PURE__ */ React62.forwardRef(function ComboboxClear2(componentProps, forwardedRef) { |
| 11534 |
const { |
| 11535 |
render, |
| 11536 |
className, |
| 11537 |
disabled: disabledProp = false, |
| 11538 |
nativeButton = true, |
| 11539 |
keepMounted = false, |
| 11540 |
style, |
| 11541 |
...elementProps |
| 11542 |
} = componentProps; |
| 11543 |
const { |
| 11544 |
disabled: fieldDisabled |
| 11545 |
} = useFieldRootContext(); |
| 11546 |
const store = useComboboxRootContext(); |
| 11547 |
const selectionMode = useStore(store, selectors2.selectionMode); |
| 11548 |
const comboboxDisabled = useStore(store, selectors2.disabled); |
| 11549 |
const readOnly = useStore(store, selectors2.readOnly); |
| 11550 |
const open = useStore(store, selectors2.open); |
| 11551 |
const selectedValue = useStore(store, selectors2.selectedValue); |
| 11552 |
const hasSelectionChips = useStore(store, selectors2.hasSelectionChips); |
| 11553 |
const inputValue = useComboboxInputValueContext(); |
| 11554 |
let visible = false; |
| 11555 |
if (selectionMode === "none") { |
| 11556 |
visible = inputValue !== ""; |
| 11557 |
} else if (selectionMode === "single") { |
| 11558 |
visible = selectedValue != null; |
| 11559 |
} else { |
| 11560 |
visible = hasSelectionChips; |
| 11561 |
} |
| 11562 |
const disabled2 = fieldDisabled || comboboxDisabled || disabledProp; |
| 11563 |
const { |
| 11564 |
buttonRef, |
| 11565 |
getButtonProps |
| 11566 |
} = useButton({ |
| 11567 |
native: nativeButton, |
| 11568 |
disabled: disabled2 |
| 11569 |
}); |
| 11570 |
const { |
| 11571 |
mounted, |
| 11572 |
transitionStatus, |
| 11573 |
setMounted |
| 11574 |
} = useTransitionStatus(visible); |
| 11575 |
const state = { |
| 11576 |
disabled: disabled2, |
| 11577 |
visible, |
| 11578 |
open, |
| 11579 |
transitionStatus |
| 11580 |
}; |
| 11581 |
useOpenChangeComplete({ |
| 11582 |
open: visible, |
| 11583 |
ref: store.state.clearRef, |
| 11584 |
onComplete() { |
| 11585 |
if (!visible) { |
| 11586 |
setMounted(false); |
| 11587 |
} |
| 11588 |
} |
| 11589 |
}); |
| 11590 |
const element = useRenderElement("button", componentProps, { |
| 11591 |
state, |
| 11592 |
ref: [forwardedRef, buttonRef, store.state.clearRef], |
| 11593 |
props: [{ |
| 11594 |
tabIndex: -1, |
| 11595 |
children: "x", |
| 11596 |
// Avoid stealing focus from the input. |
| 11597 |
onMouseDown(event) { |
| 11598 |
event.preventDefault(); |
| 11599 |
}, |
| 11600 |
onClick(event) { |
| 11601 |
if (disabled2 || readOnly) { |
| 11602 |
return; |
| 11603 |
} |
| 11604 |
const keyboardActiveRef = store.state.keyboardActiveRef; |
| 11605 |
store.state.setInputValue("", createChangeEventDetails(reason_parts_exports.clearPress, event.nativeEvent)); |
| 11606 |
if (selectionMode !== "none") { |
| 11607 |
store.state.setSelectedValue(Array.isArray(selectedValue) ? [] : null, createChangeEventDetails(reason_parts_exports.clearPress, event.nativeEvent)); |
| 11608 |
store.state.setIndices({ |
| 11609 |
activeIndex: null, |
| 11610 |
selectedIndex: null, |
| 11611 |
type: keyboardActiveRef.current ? "keyboard" : "pointer" |
| 11612 |
}); |
| 11613 |
} else { |
| 11614 |
store.state.setIndices({ |
| 11615 |
activeIndex: null, |
| 11616 |
type: keyboardActiveRef.current ? "keyboard" : "pointer" |
| 11617 |
}); |
| 11618 |
} |
| 11619 |
store.state.inputRef.current?.focus(); |
| 11620 |
} |
| 11621 |
}, elementProps, getButtonProps], |
| 11622 |
stateAttributesMapping |
| 11623 |
}); |
| 11624 |
const shouldRender = keepMounted || mounted; |
| 11625 |
if (!shouldRender) { |
| 11626 |
return null; |
| 11627 |
} |
| 11628 |
return element; |
| 11629 |
}); |
| 11630 |
if (true) ComboboxClear.displayName = "ComboboxClear"; |
| 11631 |
|
| 11632 |
// node_modules/@base-ui/react/esm/combobox/list/ComboboxList.js |
| 11633 |
var React65 = __toESM(require_react(), 1); |
| 11634 |
|
| 11635 |
// node_modules/@base-ui/react/esm/combobox/collection/ComboboxCollection.js |
| 11636 |
var React64 = __toESM(require_react(), 1); |
| 11637 |
|
| 11638 |
// node_modules/@base-ui/react/esm/combobox/collection/GroupCollectionContext.js |
| 11639 |
var React63 = __toESM(require_react(), 1); |
| 11640 |
var import_jsx_runtime17 = __toESM(require_jsx_runtime(), 1); |
| 11641 |
var GroupCollectionContext = /* @__PURE__ */ React63.createContext(null); |
| 11642 |
if (true) GroupCollectionContext.displayName = "GroupCollectionContext"; |
| 11643 |
function useGroupCollectionContext() { |
| 11644 |
return React63.useContext(GroupCollectionContext); |
| 11645 |
} |
| 11646 |
function GroupCollectionProvider(props) { |
| 11647 |
const { |
| 11648 |
children, |
| 11649 |
items |
| 11650 |
} = props; |
| 11651 |
const contextValue = React63.useMemo(() => ({ |
| 11652 |
items |
| 11653 |
}), [items]); |
| 11654 |
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(GroupCollectionContext.Provider, { |
| 11655 |
value: contextValue, |
| 11656 |
children |
| 11657 |
}); |
| 11658 |
} |
| 11659 |
|
| 11660 |
// node_modules/@base-ui/react/esm/combobox/collection/ComboboxCollection.js |
| 11661 |
var import_jsx_runtime18 = __toESM(require_jsx_runtime(), 1); |
| 11662 |
function ComboboxCollection(props) { |
| 11663 |
const { |
| 11664 |
children |
| 11665 |
} = props; |
| 11666 |
const { |
| 11667 |
filteredItems |
| 11668 |
} = useComboboxDerivedItemsContext(); |
| 11669 |
const groupContext = useGroupCollectionContext(); |
| 11670 |
const itemsToRender = groupContext ? groupContext.items : filteredItems; |
| 11671 |
if (!itemsToRender) { |
| 11672 |
return null; |
| 11673 |
} |
| 11674 |
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(React64.Fragment, { |
| 11675 |
children: itemsToRender.map(children) |
| 11676 |
}); |
| 11677 |
} |
| 11678 |
|
| 11679 |
// node_modules/@base-ui/react/esm/combobox/list/ComboboxList.js |
| 11680 |
var import_jsx_runtime19 = __toESM(require_jsx_runtime(), 1); |
| 11681 |
var ComboboxList = /* @__PURE__ */ React65.forwardRef(function ComboboxList2(componentProps, forwardedRef) { |
| 11682 |
var _ComboboxCollection; |
| 11683 |
const { |
| 11684 |
render, |
| 11685 |
className, |
| 11686 |
style, |
| 11687 |
children, |
| 11688 |
...elementProps |
| 11689 |
} = componentProps; |
| 11690 |
const store = useComboboxRootContext(); |
| 11691 |
const floatingRootContext = useComboboxFloatingContext(); |
| 11692 |
const hasPositionerContext = Boolean(useComboboxPositionerContext(true)); |
| 11693 |
const { |
| 11694 |
filteredItems, |
| 11695 |
hasItems |
| 11696 |
} = useComboboxDerivedItemsContext(); |
| 11697 |
const selectionMode = useStore(store, selectors2.selectionMode); |
| 11698 |
const grid = useStore(store, selectors2.grid); |
| 11699 |
const popupProps = useStore(store, selectors2.popupProps); |
| 11700 |
const virtualized = useStore(store, selectors2.virtualized); |
| 11701 |
const multiple = selectionMode === "multiple"; |
| 11702 |
const empty = filteredItems.length === 0; |
| 11703 |
const setPositionerElement = useStableCallback((element2) => { |
| 11704 |
store.set("positionerElement", element2); |
| 11705 |
}); |
| 11706 |
const setListElement = useStableCallback((element2) => { |
| 11707 |
store.set("listElement", element2); |
| 11708 |
}); |
| 11709 |
const resolvedChildren = React65.useMemo(() => { |
| 11710 |
if (typeof children === "function") { |
| 11711 |
return _ComboboxCollection || (_ComboboxCollection = /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(ComboboxCollection, { |
| 11712 |
children |
| 11713 |
})); |
| 11714 |
} |
| 11715 |
return children; |
| 11716 |
}, [children]); |
| 11717 |
const state = { |
| 11718 |
empty |
| 11719 |
}; |
| 11720 |
const floatingId = floatingRootContext.useState("floatingId"); |
| 11721 |
const element = useRenderElement("div", componentProps, { |
| 11722 |
state, |
| 11723 |
ref: [forwardedRef, setListElement, hasPositionerContext ? null : setPositionerElement], |
| 11724 |
props: [popupProps, { |
| 11725 |
children: resolvedChildren, |
| 11726 |
tabIndex: -1, |
| 11727 |
id: floatingId, |
| 11728 |
role: grid ? "grid" : "listbox", |
| 11729 |
"aria-multiselectable": multiple ? "true" : void 0, |
| 11730 |
onKeyDown(event) { |
| 11731 |
if (store.state.disabled || store.state.readOnly) { |
| 11732 |
return; |
| 11733 |
} |
| 11734 |
if (event.key === "Enter") { |
| 11735 |
const activeIndex = store.state.activeIndex; |
| 11736 |
if (activeIndex == null) { |
| 11737 |
return; |
| 11738 |
} |
| 11739 |
stopEvent(event); |
| 11740 |
const nativeEvent = event.nativeEvent; |
| 11741 |
const listItem = store.state.listRef.current[activeIndex]; |
| 11742 |
if (listItem) { |
| 11743 |
store.state.selectionEventRef.current = nativeEvent; |
| 11744 |
listItem.click(); |
| 11745 |
store.state.selectionEventRef.current = null; |
| 11746 |
} |
| 11747 |
} |
| 11748 |
}, |
| 11749 |
onKeyDownCapture() { |
| 11750 |
store.state.keyboardActiveRef.current = true; |
| 11751 |
}, |
| 11752 |
onPointerMoveCapture() { |
| 11753 |
store.state.keyboardActiveRef.current = false; |
| 11754 |
} |
| 11755 |
}, elementProps] |
| 11756 |
}); |
| 11757 |
if (virtualized) { |
| 11758 |
return element; |
| 11759 |
} |
| 11760 |
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(CompositeList, { |
| 11761 |
elementsRef: store.state.listRef, |
| 11762 |
labelsRef: hasItems ? void 0 : store.state.labelsRef, |
| 11763 |
children: element |
| 11764 |
}); |
| 11765 |
}); |
| 11766 |
if (true) ComboboxList.displayName = "ComboboxList"; |
| 11767 |
|
| 11768 |
// node_modules/@base-ui/react/esm/combobox/status/ComboboxStatus.js |
| 11769 |
var React67 = __toESM(require_react(), 1); |
| 11770 |
|
| 11771 |
// node_modules/@base-ui/react/esm/combobox/utils/useInitialLiveRegionTextMutation.js |
| 11772 |
var React66 = __toESM(require_react(), 1); |
| 11773 |
var LIVE_REGION_MARKER = "\u2060"; |
| 11774 |
var INITIAL_LIVE_REGION_TEXT_MUTATION_RESET_DELAY = 200; |
| 11775 |
function findLastTextNode(root) { |
| 11776 |
const walker = root.ownerDocument.createTreeWalker(root, NodeFilter.SHOW_TEXT); |
| 11777 |
let lastTextNode = null; |
| 11778 |
while (walker.nextNode()) { |
| 11779 |
const textNode = walker.currentNode; |
| 11780 |
if (textNode.nodeValue !== "") { |
| 11781 |
lastTextNode = textNode; |
| 11782 |
} |
| 11783 |
} |
| 11784 |
return lastTextNode; |
| 11785 |
} |
| 11786 |
function useInitialLiveRegionTextMutation() { |
| 11787 |
const timeout = useTimeout(); |
| 11788 |
const rootRef = React66.useRef(null); |
| 11789 |
React66.useEffect(() => { |
| 11790 |
if (isIOS) { |
| 11791 |
return void 0; |
| 11792 |
} |
| 11793 |
const root = rootRef.current; |
| 11794 |
if (root == null) { |
| 11795 |
return void 0; |
| 11796 |
} |
| 11797 |
const textNode = findLastTextNode(root); |
| 11798 |
if (textNode == null) { |
| 11799 |
return void 0; |
| 11800 |
} |
| 11801 |
const originalValue = textNode.nodeValue ?? ""; |
| 11802 |
const markedValue = `${originalValue}${LIVE_REGION_MARKER}`; |
| 11803 |
textNode.nodeValue = markedValue; |
| 11804 |
timeout.start(INITIAL_LIVE_REGION_TEXT_MUTATION_RESET_DELAY, () => { |
| 11805 |
if (textNode.nodeValue === markedValue) { |
| 11806 |
textNode.nodeValue = originalValue; |
| 11807 |
} |
| 11808 |
}); |
| 11809 |
return () => { |
| 11810 |
timeout.clear(); |
| 11811 |
if (textNode.nodeValue === markedValue) { |
| 11812 |
textNode.nodeValue = originalValue; |
| 11813 |
} |
| 11814 |
}; |
| 11815 |
}, [rootRef, timeout]); |
| 11816 |
return rootRef; |
| 11817 |
} |
| 11818 |
|
| 11819 |
// node_modules/@base-ui/react/esm/combobox/status/ComboboxStatus.js |
| 11820 |
var ComboboxStatus = /* @__PURE__ */ React67.forwardRef(function ComboboxStatus2(componentProps, forwardedRef) { |
| 11821 |
const { |
| 11822 |
render, |
| 11823 |
className, |
| 11824 |
style, |
| 11825 |
children: childrenProp, |
| 11826 |
...elementProps |
| 11827 |
} = componentProps; |
| 11828 |
const statusRef = useInitialLiveRegionTextMutation(); |
| 11829 |
return useRenderElement("div", componentProps, { |
| 11830 |
ref: [forwardedRef, statusRef], |
| 11831 |
props: [{ |
| 11832 |
children: childrenProp, |
| 11833 |
role: "status", |
| 11834 |
"aria-live": "polite", |
| 11835 |
"aria-atomic": true |
| 11836 |
}, elementProps] |
| 11837 |
}); |
| 11838 |
}); |
| 11839 |
if (true) ComboboxStatus.displayName = "ComboboxStatus"; |
| 11840 |
|
| 11841 |
// node_modules/@base-ui/react/esm/combobox/portal/ComboboxPortal.js |
| 11842 |
var React69 = __toESM(require_react(), 1); |
| 11843 |
|
| 11844 |
// node_modules/@base-ui/react/esm/combobox/portal/ComboboxPortalContext.js |
| 11845 |
var React68 = __toESM(require_react(), 1); |
| 11846 |
var ComboboxPortalContext = /* @__PURE__ */ React68.createContext(void 0); |
| 11847 |
if (true) ComboboxPortalContext.displayName = "ComboboxPortalContext"; |
| 11848 |
function useComboboxPortalContext() { |
| 11849 |
const context = React68.useContext(ComboboxPortalContext); |
| 11850 |
if (context === void 0) { |
| 11851 |
throw new Error(true ? "Base UI: <Combobox.Portal> is missing." : formatErrorMessage_default(20)); |
| 11852 |
} |
| 11853 |
return context; |
| 11854 |
} |
| 11855 |
|
| 11856 |
// node_modules/@base-ui/react/esm/combobox/portal/ComboboxPortal.js |
| 11857 |
var import_jsx_runtime20 = __toESM(require_jsx_runtime(), 1); |
| 11858 |
var ComboboxPortal = /* @__PURE__ */ React69.forwardRef(function ComboboxPortal2(props, forwardedRef) { |
| 11859 |
const { |
| 11860 |
keepMounted = false, |
| 11861 |
...portalProps |
| 11862 |
} = props; |
| 11863 |
const store = useComboboxRootContext(); |
| 11864 |
const mounted = useStore(store, selectors2.mounted); |
| 11865 |
const forceMounted = useStore(store, selectors2.forceMounted); |
| 11866 |
const shouldRender = mounted || keepMounted || forceMounted; |
| 11867 |
if (!shouldRender) { |
| 11868 |
return null; |
| 11869 |
} |
| 11870 |
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(ComboboxPortalContext.Provider, { |
| 11871 |
value: keepMounted, |
| 11872 |
children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(FloatingPortal, { |
| 11873 |
ref: forwardedRef, |
| 11874 |
...portalProps |
| 11875 |
}) |
| 11876 |
}); |
| 11877 |
}); |
| 11878 |
if (true) ComboboxPortal.displayName = "ComboboxPortal"; |
| 11879 |
|
| 11880 |
// node_modules/@base-ui/react/esm/combobox/backdrop/ComboboxBackdrop.js |
| 11881 |
var React70 = __toESM(require_react(), 1); |
| 11882 |
var stateAttributesMapping2 = { |
| 11883 |
...popupStateMapping, |
| 11884 |
...transitionStatusMapping |
| 11885 |
}; |
| 11886 |
var ComboboxBackdrop = /* @__PURE__ */ React70.forwardRef(function ComboboxBackdrop2(componentProps, forwardedRef) { |
| 11887 |
const { |
| 11888 |
render, |
| 11889 |
className, |
| 11890 |
style, |
| 11891 |
...elementProps |
| 11892 |
} = componentProps; |
| 11893 |
const store = useComboboxRootContext(); |
| 11894 |
const open = useStore(store, selectors2.open); |
| 11895 |
const mounted = useStore(store, selectors2.mounted); |
| 11896 |
const transitionStatus = useStore(store, selectors2.transitionStatus); |
| 11897 |
const state = { |
| 11898 |
open, |
| 11899 |
transitionStatus |
| 11900 |
}; |
| 11901 |
return useRenderElement("div", componentProps, { |
| 11902 |
state, |
| 11903 |
ref: forwardedRef, |
| 11904 |
stateAttributesMapping: stateAttributesMapping2, |
| 11905 |
props: [{ |
| 11906 |
role: "presentation", |
| 11907 |
hidden: !mounted, |
| 11908 |
style: { |
| 11909 |
userSelect: "none", |
| 11910 |
WebkitUserSelect: "none" |
| 11911 |
} |
| 11912 |
}, elementProps] |
| 11913 |
}); |
| 11914 |
}); |
| 11915 |
if (true) ComboboxBackdrop.displayName = "ComboboxBackdrop"; |
| 11916 |
|
| 11917 |
// node_modules/@base-ui/react/esm/combobox/positioner/ComboboxPositioner.js |
| 11918 |
var React73 = __toESM(require_react(), 1); |
| 11919 |
|
| 11920 |
// node_modules/@base-ui/react/esm/utils/useAnchorPositioning.js |
| 11921 |
var React71 = __toESM(require_react(), 1); |
| 11922 |
|
| 11923 |
// node_modules/@base-ui/react/esm/floating-ui-react/middleware/arrow.js |
| 11924 |
var baseArrow = (options) => ({ |
| 11925 |
name: "arrow", |
| 11926 |
options, |
| 11927 |
async fn(state) { |
| 11928 |
const { |
| 11929 |
x, |
| 11930 |
y, |
| 11931 |
placement, |
| 11932 |
rects, |
| 11933 |
platform: platform3, |
| 11934 |
elements, |
| 11935 |
middlewareData |
| 11936 |
} = state; |
| 11937 |
const { |
| 11938 |
element, |
| 11939 |
padding = 0, |
| 11940 |
offsetParent = "real" |
| 11941 |
} = evaluate(options, state) || {}; |
| 11942 |
if (element == null) { |
| 11943 |
return {}; |
| 11944 |
} |
| 11945 |
const paddingObject = getPaddingObject(padding); |
| 11946 |
const coords = { |
| 11947 |
x, |
| 11948 |
y |
| 11949 |
}; |
| 11950 |
const axis = getAlignmentAxis(placement); |
| 11951 |
const length = getAxisLength(axis); |
| 11952 |
const arrowDimensions = await platform3.getDimensions(element); |
| 11953 |
const isYAxis = axis === "y"; |
| 11954 |
const minProp = isYAxis ? "top" : "left"; |
| 11955 |
const maxProp = isYAxis ? "bottom" : "right"; |
| 11956 |
const clientProp = isYAxis ? "clientHeight" : "clientWidth"; |
| 11957 |
const endDiff = rects.reference[length] + rects.reference[axis] - coords[axis] - rects.floating[length]; |
| 11958 |
const startDiff = coords[axis] - rects.reference[axis]; |
| 11959 |
const arrowOffsetParent = offsetParent === "real" ? await platform3.getOffsetParent?.(element) : elements.floating; |
| 11960 |
let clientSize = elements.floating[clientProp] || rects.floating[length]; |
| 11961 |
if (!clientSize || !await platform3.isElement?.(arrowOffsetParent)) { |
| 11962 |
clientSize = elements.floating[clientProp] || rects.floating[length]; |
| 11963 |
} |
| 11964 |
const centerToReference = endDiff / 2 - startDiff / 2; |
| 11965 |
const largestPossiblePadding = clientSize / 2 - arrowDimensions[length] / 2 - 1; |
| 11966 |
const minPadding = Math.min(paddingObject[minProp], largestPossiblePadding); |
| 11967 |
const maxPadding = Math.min(paddingObject[maxProp], largestPossiblePadding); |
| 11968 |
const min2 = minPadding; |
| 11969 |
const max2 = clientSize - arrowDimensions[length] - maxPadding; |
| 11970 |
const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference; |
| 11971 |
const offset4 = clamp(min2, center, max2); |
| 11972 |
const shouldAddOffset = !middlewareData.arrow && getAlignment(placement) != null && center !== offset4 && rects.reference[length] / 2 - (center < min2 ? minPadding : maxPadding) - arrowDimensions[length] / 2 < 0; |
| 11973 |
const alignmentOffset = shouldAddOffset ? center < min2 ? center - min2 : center - max2 : 0; |
| 11974 |
return { |
| 11975 |
[axis]: coords[axis] + alignmentOffset, |
| 11976 |
data: { |
| 11977 |
[axis]: offset4, |
| 11978 |
centerOffset: center - offset4 - alignmentOffset, |
| 11979 |
...shouldAddOffset && { |
| 11980 |
alignmentOffset |
| 11981 |
} |
| 11982 |
}, |
| 11983 |
reset: shouldAddOffset |
| 11984 |
}; |
| 11985 |
} |
| 11986 |
}); |
| 11987 |
var arrow4 = (options, deps) => ({ |
| 11988 |
...baseArrow(options), |
| 11989 |
options: [options, deps] |
| 11990 |
}); |
| 11991 |
|
| 11992 |
// node_modules/@base-ui/react/esm/utils/hideMiddleware.js |
| 11993 |
var hide4 = { |
| 11994 |
name: "hide", |
| 11995 |
async fn(state) { |
| 11996 |
const { |
| 11997 |
width, |
| 11998 |
height, |
| 11999 |
x, |
| 12000 |
y |
| 12001 |
} = state.rects.reference; |
| 12002 |
const anchorHidden = width === 0 && height === 0 && x === 0 && y === 0; |
| 12003 |
const nativeHideResult = await hide3().fn(state); |
| 12004 |
return { |
| 12005 |
data: { |
| 12006 |
referenceHidden: nativeHideResult.data?.referenceHidden || anchorHidden |
| 12007 |
} |
| 12008 |
}; |
| 12009 |
} |
| 12010 |
}; |
| 12011 |
|
| 12012 |
// node_modules/@base-ui/react/esm/utils/adaptiveOriginMiddleware.js |
| 12013 |
var DEFAULT_SIDES = { |
| 12014 |
sideX: "left", |
| 12015 |
sideY: "top" |
| 12016 |
}; |
| 12017 |
var adaptiveOrigin = { |
| 12018 |
name: "adaptiveOrigin", |
| 12019 |
async fn(state) { |
| 12020 |
const { |
| 12021 |
x: rawX, |
| 12022 |
y: rawY, |
| 12023 |
rects: { |
| 12024 |
floating: floatRect |
| 12025 |
}, |
| 12026 |
elements: { |
| 12027 |
floating |
| 12028 |
}, |
| 12029 |
platform: platform3, |
| 12030 |
strategy, |
| 12031 |
placement |
| 12032 |
} = state; |
| 12033 |
const win = getWindow(floating); |
| 12034 |
const styles = win.getComputedStyle(floating); |
| 12035 |
const hasTransition = styles.transitionDuration !== "0s" && styles.transitionDuration !== ""; |
| 12036 |
if (!hasTransition) { |
| 12037 |
return { |
| 12038 |
x: rawX, |
| 12039 |
y: rawY, |
| 12040 |
data: DEFAULT_SIDES |
| 12041 |
}; |
| 12042 |
} |
| 12043 |
const offsetParent = await platform3.getOffsetParent?.(floating); |
| 12044 |
let offsetDimensions = { |
| 12045 |
width: 0, |
| 12046 |
height: 0 |
| 12047 |
}; |
| 12048 |
if (strategy === "fixed" && win?.visualViewport) { |
| 12049 |
offsetDimensions = { |
| 12050 |
width: win.visualViewport.width, |
| 12051 |
height: win.visualViewport.height |
| 12052 |
}; |
| 12053 |
} else if (offsetParent === win) { |
| 12054 |
const doc = ownerDocument(floating); |
| 12055 |
offsetDimensions = { |
| 12056 |
width: doc.documentElement.clientWidth, |
| 12057 |
height: doc.documentElement.clientHeight |
| 12058 |
}; |
| 12059 |
} else if (await platform3.isElement?.(offsetParent)) { |
| 12060 |
offsetDimensions = await platform3.getDimensions(offsetParent); |
| 12061 |
} |
| 12062 |
const currentSide = getSide(placement); |
| 12063 |
let x = rawX; |
| 12064 |
let y = rawY; |
| 12065 |
if (currentSide === "left") { |
| 12066 |
x = offsetDimensions.width - (rawX + floatRect.width); |
| 12067 |
} |
| 12068 |
if (currentSide === "top") { |
| 12069 |
y = offsetDimensions.height - (rawY + floatRect.height); |
| 12070 |
} |
| 12071 |
const sideX = currentSide === "left" ? "right" : DEFAULT_SIDES.sideX; |
| 12072 |
const sideY = currentSide === "top" ? "bottom" : DEFAULT_SIDES.sideY; |
| 12073 |
return { |
| 12074 |
x, |
| 12075 |
y, |
| 12076 |
data: { |
| 12077 |
sideX, |
| 12078 |
sideY |
| 12079 |
} |
| 12080 |
}; |
| 12081 |
} |
| 12082 |
}; |
| 12083 |
|
| 12084 |
// node_modules/@base-ui/react/esm/utils/useAnchorPositioning.js |
| 12085 |
function getLogicalSide(sideParam, renderedSide, isRtl) { |
| 12086 |
const isLogicalSideParam = sideParam === "inline-start" || sideParam === "inline-end"; |
| 12087 |
const logicalRight = isRtl ? "inline-start" : "inline-end"; |
| 12088 |
const logicalLeft = isRtl ? "inline-end" : "inline-start"; |
| 12089 |
return { |
| 12090 |
top: "top", |
| 12091 |
right: isLogicalSideParam ? logicalRight : "right", |
| 12092 |
bottom: "bottom", |
| 12093 |
left: isLogicalSideParam ? logicalLeft : "left" |
| 12094 |
}[renderedSide]; |
| 12095 |
} |
| 12096 |
function getOffsetData(state, sideParam, isRtl) { |
| 12097 |
const { |
| 12098 |
rects, |
| 12099 |
placement |
| 12100 |
} = state; |
| 12101 |
const data = { |
| 12102 |
side: getLogicalSide(sideParam, getSide(placement), isRtl), |
| 12103 |
align: getAlignment(placement) || "center", |
| 12104 |
anchor: { |
| 12105 |
width: rects.reference.width, |
| 12106 |
height: rects.reference.height |
| 12107 |
}, |
| 12108 |
positioner: { |
| 12109 |
width: rects.floating.width, |
| 12110 |
height: rects.floating.height |
| 12111 |
} |
| 12112 |
}; |
| 12113 |
return data; |
| 12114 |
} |
| 12115 |
function useAnchorPositioning(params) { |
| 12116 |
const { |
| 12117 |
// Public parameters |
| 12118 |
anchor, |
| 12119 |
positionMethod = "absolute", |
| 12120 |
side: sideParam = "bottom", |
| 12121 |
sideOffset = 0, |
| 12122 |
align = "center", |
| 12123 |
alignOffset = 0, |
| 12124 |
collisionBoundary, |
| 12125 |
collisionPadding: collisionPaddingParam = 5, |
| 12126 |
sticky = false, |
| 12127 |
arrowPadding = 5, |
| 12128 |
disableAnchorTracking = false, |
| 12129 |
inline: inlineMiddleware, |
| 12130 |
// Private parameters |
| 12131 |
keepMounted = false, |
| 12132 |
floatingRootContext, |
| 12133 |
mounted, |
| 12134 |
collisionAvoidance, |
| 12135 |
shiftCrossAxis = false, |
| 12136 |
nodeId, |
| 12137 |
adaptiveOrigin: adaptiveOrigin2, |
| 12138 |
lazyFlip = false, |
| 12139 |
externalTree |
| 12140 |
} = params; |
| 12141 |
const [mountSide, setMountSide] = React71.useState(null); |
| 12142 |
if (!mounted && mountSide !== null) { |
| 12143 |
setMountSide(null); |
| 12144 |
} |
| 12145 |
const collisionAvoidanceSide = collisionAvoidance.side || "flip"; |
| 12146 |
const collisionAvoidanceAlign = collisionAvoidance.align || "flip"; |
| 12147 |
const collisionAvoidanceFallbackAxisSide = collisionAvoidance.fallbackAxisSide || "end"; |
| 12148 |
const anchorFn = typeof anchor === "function" ? anchor : void 0; |
| 12149 |
const anchorFnCallback = useStableCallback(anchorFn); |
| 12150 |
const anchorDep = anchorFn ? anchorFnCallback : anchor; |
| 12151 |
const anchorValueRef = useValueAsRef(anchor); |
| 12152 |
const mountedRef = useValueAsRef(mounted); |
| 12153 |
const direction = useDirection(); |
| 12154 |
const isRtl = direction === "rtl"; |
| 12155 |
const side = mountSide || { |
| 12156 |
top: "top", |
| 12157 |
right: "right", |
| 12158 |
bottom: "bottom", |
| 12159 |
left: "left", |
| 12160 |
"inline-end": isRtl ? "left" : "right", |
| 12161 |
"inline-start": isRtl ? "right" : "left" |
| 12162 |
}[sideParam]; |
| 12163 |
const placement = align === "center" ? side : `${side}-${align}`; |
| 12164 |
let collisionPadding = collisionPaddingParam; |
| 12165 |
const bias = 1; |
| 12166 |
const biasTop = sideParam === "bottom" ? bias : 0; |
| 12167 |
const biasBottom = sideParam === "top" ? bias : 0; |
| 12168 |
const biasLeft = sideParam === "right" ? bias : 0; |
| 12169 |
const biasRight = sideParam === "left" ? bias : 0; |
| 12170 |
if (typeof collisionPadding === "number") { |
| 12171 |
collisionPadding = { |
| 12172 |
top: collisionPadding + biasTop, |
| 12173 |
right: collisionPadding + biasRight, |
| 12174 |
bottom: collisionPadding + biasBottom, |
| 12175 |
left: collisionPadding + biasLeft |
| 12176 |
}; |
| 12177 |
} else if (collisionPadding) { |
| 12178 |
collisionPadding = { |
| 12179 |
top: (collisionPadding.top || 0) + biasTop, |
| 12180 |
right: (collisionPadding.right || 0) + biasRight, |
| 12181 |
bottom: (collisionPadding.bottom || 0) + biasBottom, |
| 12182 |
left: (collisionPadding.left || 0) + biasLeft |
| 12183 |
}; |
| 12184 |
} |
| 12185 |
const commonCollisionProps = { |
| 12186 |
boundary: collisionBoundary === "clipping-ancestors" ? "clippingAncestors" : collisionBoundary, |
| 12187 |
padding: collisionPadding |
| 12188 |
}; |
| 12189 |
const arrowRef = React71.useRef(null); |
| 12190 |
const sideOffsetRef = useValueAsRef(sideOffset); |
| 12191 |
const alignOffsetRef = useValueAsRef(alignOffset); |
| 12192 |
const sideOffsetDep = typeof sideOffset !== "function" ? sideOffset : 0; |
| 12193 |
const alignOffsetDep = typeof alignOffset !== "function" ? alignOffset : 0; |
| 12194 |
const middleware = []; |
| 12195 |
if (inlineMiddleware) { |
| 12196 |
middleware.push(inlineMiddleware); |
| 12197 |
} |
| 12198 |
middleware.push(offset3((state) => { |
| 12199 |
const data = getOffsetData(state, sideParam, isRtl); |
| 12200 |
const sideAxis = typeof sideOffsetRef.current === "function" ? sideOffsetRef.current(data) : sideOffsetRef.current; |
| 12201 |
const alignAxis = typeof alignOffsetRef.current === "function" ? alignOffsetRef.current(data) : alignOffsetRef.current; |
| 12202 |
return { |
| 12203 |
mainAxis: sideAxis, |
| 12204 |
crossAxis: alignAxis, |
| 12205 |
alignmentAxis: alignAxis |
| 12206 |
}; |
| 12207 |
}, [sideOffsetDep, alignOffsetDep, isRtl, sideParam])); |
| 12208 |
const shiftDisabled = collisionAvoidanceAlign === "none" && collisionAvoidanceSide !== "shift"; |
| 12209 |
const crossAxisShiftEnabled = !shiftDisabled && (sticky || shiftCrossAxis || collisionAvoidanceSide === "shift"); |
| 12210 |
const flipMiddleware = collisionAvoidanceSide === "none" ? null : flip3({ |
| 12211 |
...commonCollisionProps, |
| 12212 |
// Ensure the popup flips if it's been limited by its --available-height and it resizes. |
| 12213 |
// Since the size() padding is smaller than the flip() padding, flip() will take precedence. |
| 12214 |
padding: { |
| 12215 |
top: collisionPadding.top + bias, |
| 12216 |
right: collisionPadding.right + bias, |
| 12217 |
bottom: collisionPadding.bottom + bias, |
| 12218 |
left: collisionPadding.left + bias |
| 12219 |
}, |
| 12220 |
mainAxis: !shiftCrossAxis && collisionAvoidanceSide === "flip", |
| 12221 |
crossAxis: collisionAvoidanceAlign === "flip" ? "alignment" : false, |
| 12222 |
fallbackAxisSideDirection: collisionAvoidanceFallbackAxisSide |
| 12223 |
}); |
| 12224 |
const shiftMiddleware = shiftDisabled ? null : shift3((data) => { |
| 12225 |
const html = ownerDocument(data.elements.floating).documentElement; |
| 12226 |
return { |
| 12227 |
...commonCollisionProps, |
| 12228 |
// Use the Layout Viewport to avoid shifting around when pinch-zooming |
| 12229 |
// for context menus. |
| 12230 |
rootBoundary: shiftCrossAxis ? { |
| 12231 |
x: 0, |
| 12232 |
y: 0, |
| 12233 |
width: html.clientWidth, |
| 12234 |
height: html.clientHeight |
| 12235 |
} : void 0, |
| 12236 |
mainAxis: collisionAvoidanceAlign !== "none", |
| 12237 |
crossAxis: crossAxisShiftEnabled, |
| 12238 |
limiter: sticky || shiftCrossAxis ? void 0 : limitShift3((limitData) => { |
| 12239 |
if (!arrowRef.current) { |
| 12240 |
return {}; |
| 12241 |
} |
| 12242 |
const { |
| 12243 |
width, |
| 12244 |
height |
| 12245 |
} = arrowRef.current.getBoundingClientRect(); |
| 12246 |
const sideAxis = getSideAxis(getSide(limitData.placement)); |
| 12247 |
const arrowSize = sideAxis === "y" ? width : height; |
| 12248 |
const offsetAmount = sideAxis === "y" ? collisionPadding.left + collisionPadding.right : collisionPadding.top + collisionPadding.bottom; |
| 12249 |
return { |
| 12250 |
offset: arrowSize / 2 + offsetAmount / 2 |
| 12251 |
}; |
| 12252 |
}) |
| 12253 |
}; |
| 12254 |
}, [commonCollisionProps, sticky, shiftCrossAxis, collisionPadding, collisionAvoidanceAlign]); |
| 12255 |
if (collisionAvoidanceSide === "shift" || collisionAvoidanceAlign === "shift" || align === "center") { |
| 12256 |
middleware.push(shiftMiddleware, flipMiddleware); |
| 12257 |
} else { |
| 12258 |
middleware.push(flipMiddleware, shiftMiddleware); |
| 12259 |
} |
| 12260 |
middleware.push(size3({ |
| 12261 |
...commonCollisionProps, |
| 12262 |
apply({ |
| 12263 |
elements: { |
| 12264 |
floating |
| 12265 |
}, |
| 12266 |
availableWidth, |
| 12267 |
availableHeight, |
| 12268 |
rects |
| 12269 |
}) { |
| 12270 |
if (!mountedRef.current) { |
| 12271 |
return; |
| 12272 |
} |
| 12273 |
const floatingStyle = floating.style; |
| 12274 |
floatingStyle.setProperty("--available-width", `${availableWidth}px`); |
| 12275 |
floatingStyle.setProperty("--available-height", `${availableHeight}px`); |
| 12276 |
const dpr = getWindow(floating).devicePixelRatio || 1; |
| 12277 |
const { |
| 12278 |
x: x2, |
| 12279 |
y: y2, |
| 12280 |
width, |
| 12281 |
height |
| 12282 |
} = rects.reference; |
| 12283 |
const anchorWidth = (Math.round((x2 + width) * dpr) - Math.round(x2 * dpr)) / dpr; |
| 12284 |
const anchorHeight = (Math.round((y2 + height) * dpr) - Math.round(y2 * dpr)) / dpr; |
| 12285 |
floatingStyle.setProperty("--anchor-width", `${anchorWidth}px`); |
| 12286 |
floatingStyle.setProperty("--anchor-height", `${anchorHeight}px`); |
| 12287 |
} |
| 12288 |
}), arrow4((state) => ({ |
| 12289 |
// `transform-origin` calculations rely on an element existing. If the arrow hasn't been set, |
| 12290 |
// we'll create a fake element. |
| 12291 |
element: arrowRef.current || ownerDocument(state.elements.floating).createElement("div"), |
| 12292 |
padding: arrowPadding, |
| 12293 |
offsetParent: "floating" |
| 12294 |
}), [arrowPadding]), { |
| 12295 |
name: "transformOrigin", |
| 12296 |
fn(state) { |
| 12297 |
const { |
| 12298 |
elements: elements2, |
| 12299 |
middlewareData: middlewareData2, |
| 12300 |
placement: renderedPlacement2, |
| 12301 |
rects, |
| 12302 |
y: y2 |
| 12303 |
} = state; |
| 12304 |
const currentRenderedSide = getSide(renderedPlacement2); |
| 12305 |
const currentRenderedAxis = getSideAxis(currentRenderedSide); |
| 12306 |
const arrowEl = arrowRef.current; |
| 12307 |
const arrowX = middlewareData2.arrow?.x || 0; |
| 12308 |
const arrowY = middlewareData2.arrow?.y || 0; |
| 12309 |
const arrowWidth = arrowEl?.clientWidth || 0; |
| 12310 |
const arrowHeight = arrowEl?.clientHeight || 0; |
| 12311 |
const transformX = arrowX + arrowWidth / 2; |
| 12312 |
const transformY = arrowY + arrowHeight / 2; |
| 12313 |
const shiftY = Math.abs(middlewareData2.shift?.y || 0); |
| 12314 |
const halfAnchorHeight = rects.reference.height / 2; |
| 12315 |
const sideOffsetValue = typeof sideOffset === "function" ? sideOffset(getOffsetData(state, sideParam, isRtl)) : sideOffset; |
| 12316 |
const isOverlappingAnchor = shiftY > sideOffsetValue; |
| 12317 |
const adjacentTransformOrigin = { |
| 12318 |
top: `${transformX}px calc(100% + ${sideOffsetValue}px)`, |
| 12319 |
bottom: `${transformX}px ${-sideOffsetValue}px`, |
| 12320 |
left: `calc(100% + ${sideOffsetValue}px) ${transformY}px`, |
| 12321 |
right: `${-sideOffsetValue}px ${transformY}px` |
| 12322 |
}[currentRenderedSide]; |
| 12323 |
const overlapTransformOrigin = `${transformX}px ${rects.reference.y + halfAnchorHeight - y2}px`; |
| 12324 |
elements2.floating.style.setProperty("--transform-origin", crossAxisShiftEnabled && currentRenderedAxis === "y" && isOverlappingAnchor ? overlapTransformOrigin : adjacentTransformOrigin); |
| 12325 |
return {}; |
| 12326 |
} |
| 12327 |
}, hide4, adaptiveOrigin2); |
| 12328 |
useIsoLayoutEffect(() => { |
| 12329 |
if (!mounted && floatingRootContext) { |
| 12330 |
floatingRootContext.update({ |
| 12331 |
referenceElement: null, |
| 12332 |
floatingElement: null, |
| 12333 |
domReferenceElement: null, |
| 12334 |
positionReference: null |
| 12335 |
}); |
| 12336 |
} |
| 12337 |
}, [mounted, floatingRootContext]); |
| 12338 |
const autoUpdateOptions = React71.useMemo(() => ({ |
| 12339 |
elementResize: !disableAnchorTracking && typeof ResizeObserver !== "undefined", |
| 12340 |
layoutShift: !disableAnchorTracking && typeof IntersectionObserver !== "undefined" |
| 12341 |
}), [disableAnchorTracking]); |
| 12342 |
const { |
| 12343 |
refs, |
| 12344 |
elements, |
| 12345 |
x, |
| 12346 |
y, |
| 12347 |
middlewareData, |
| 12348 |
update: update2, |
| 12349 |
placement: renderedPlacement, |
| 12350 |
context, |
| 12351 |
isPositioned, |
| 12352 |
floatingStyles: originalFloatingStyles |
| 12353 |
} = useFloating2({ |
| 12354 |
rootContext: floatingRootContext, |
| 12355 |
open: keepMounted ? mounted : void 0, |
| 12356 |
placement, |
| 12357 |
middleware, |
| 12358 |
strategy: positionMethod, |
| 12359 |
whileElementsMounted: keepMounted ? void 0 : (...args) => autoUpdate(...args, autoUpdateOptions), |
| 12360 |
nodeId, |
| 12361 |
externalTree |
| 12362 |
}); |
| 12363 |
const { |
| 12364 |
sideX, |
| 12365 |
sideY |
| 12366 |
} = middlewareData.adaptiveOrigin || DEFAULT_SIDES; |
| 12367 |
const resolvedPosition = isPositioned ? positionMethod : "fixed"; |
| 12368 |
const floatingStyles = React71.useMemo(() => { |
| 12369 |
const base = adaptiveOrigin2 ? { |
| 12370 |
position: resolvedPosition, |
| 12371 |
[sideX]: x, |
| 12372 |
[sideY]: y |
| 12373 |
} : { |
| 12374 |
position: resolvedPosition, |
| 12375 |
...originalFloatingStyles |
| 12376 |
}; |
| 12377 |
if (!isPositioned) { |
| 12378 |
base.opacity = 0; |
| 12379 |
} |
| 12380 |
return base; |
| 12381 |
}, [adaptiveOrigin2, resolvedPosition, sideX, x, sideY, y, originalFloatingStyles, isPositioned]); |
| 12382 |
const registeredPositionReferenceRef = React71.useRef(null); |
| 12383 |
useIsoLayoutEffect(() => { |
| 12384 |
if (!mounted) { |
| 12385 |
return; |
| 12386 |
} |
| 12387 |
const anchorValue = anchorValueRef.current; |
| 12388 |
const resolvedAnchor = typeof anchorValue === "function" ? anchorValue() : anchorValue; |
| 12389 |
const unwrappedElement = (isRef(resolvedAnchor) ? resolvedAnchor.current : resolvedAnchor) || null; |
| 12390 |
const finalAnchor = unwrappedElement || null; |
| 12391 |
if (finalAnchor !== registeredPositionReferenceRef.current) { |
| 12392 |
refs.setPositionReference(finalAnchor); |
| 12393 |
registeredPositionReferenceRef.current = finalAnchor; |
| 12394 |
} |
| 12395 |
}, [mounted, refs, anchorDep, anchorValueRef]); |
| 12396 |
React71.useEffect(() => { |
| 12397 |
if (!mounted) { |
| 12398 |
return; |
| 12399 |
} |
| 12400 |
const anchorValue = anchorValueRef.current; |
| 12401 |
if (typeof anchorValue === "function") { |
| 12402 |
return; |
| 12403 |
} |
| 12404 |
if (isRef(anchorValue) && anchorValue.current !== registeredPositionReferenceRef.current) { |
| 12405 |
refs.setPositionReference(anchorValue.current); |
| 12406 |
registeredPositionReferenceRef.current = anchorValue.current; |
| 12407 |
} |
| 12408 |
}, [mounted, refs, anchorDep, anchorValueRef]); |
| 12409 |
React71.useEffect(() => { |
| 12410 |
if (keepMounted && mounted && elements.domReference && elements.floating) { |
| 12411 |
return autoUpdate(elements.domReference, elements.floating, update2, autoUpdateOptions); |
| 12412 |
} |
| 12413 |
return void 0; |
| 12414 |
}, [keepMounted, mounted, elements, update2, autoUpdateOptions]); |
| 12415 |
const renderedSide = getSide(renderedPlacement); |
| 12416 |
const logicalRenderedSide = getLogicalSide(sideParam, renderedSide, isRtl); |
| 12417 |
const renderedAlign = getAlignment(renderedPlacement) || "center"; |
| 12418 |
const anchorHidden = Boolean(middlewareData.hide?.referenceHidden); |
| 12419 |
useIsoLayoutEffect(() => { |
| 12420 |
if (lazyFlip && mounted && isPositioned) { |
| 12421 |
setMountSide(renderedSide); |
| 12422 |
} |
| 12423 |
}, [lazyFlip, mounted, isPositioned, renderedSide]); |
| 12424 |
const arrowStyles = React71.useMemo(() => ({ |
| 12425 |
position: "absolute", |
| 12426 |
top: middlewareData.arrow?.y, |
| 12427 |
left: middlewareData.arrow?.x |
| 12428 |
}), [middlewareData.arrow]); |
| 12429 |
const arrowUncentered = middlewareData.arrow?.centerOffset !== 0; |
| 12430 |
return React71.useMemo(() => ({ |
| 12431 |
positionerStyles: floatingStyles, |
| 12432 |
arrowStyles, |
| 12433 |
arrowRef, |
| 12434 |
arrowUncentered, |
| 12435 |
side: logicalRenderedSide, |
| 12436 |
align: renderedAlign, |
| 12437 |
physicalSide: renderedSide, |
| 12438 |
anchorHidden, |
| 12439 |
refs, |
| 12440 |
context, |
| 12441 |
isPositioned, |
| 12442 |
update: update2 |
| 12443 |
}), [floatingStyles, arrowStyles, arrowRef, arrowUncentered, logicalRenderedSide, renderedAlign, renderedSide, anchorHidden, refs, context, isPositioned, update2]); |
| 12444 |
} |
| 12445 |
function isRef(param) { |
| 12446 |
return param != null && "current" in param; |
| 12447 |
} |
| 12448 |
|
| 12449 |
// node_modules/@base-ui/react/esm/utils/getDisabledMountTransitionStyles.js |
| 12450 |
function getDisabledMountTransitionStyles(transitionStatus) { |
| 12451 |
return transitionStatus === "starting" ? DISABLED_TRANSITIONS_STYLE : EMPTY_OBJECT; |
| 12452 |
} |
| 12453 |
|
| 12454 |
// node_modules/@base-ui/react/esm/utils/usePositioner.js |
| 12455 |
function usePositioner(componentProps, state, { |
| 12456 |
styles, |
| 12457 |
transitionStatus, |
| 12458 |
props, |
| 12459 |
refs, |
| 12460 |
hidden, |
| 12461 |
inert = false |
| 12462 |
}) { |
| 12463 |
const style = { |
| 12464 |
...styles |
| 12465 |
}; |
| 12466 |
if (inert) { |
| 12467 |
style.pointerEvents = "none"; |
| 12468 |
} |
| 12469 |
return useRenderElement("div", componentProps, { |
| 12470 |
state, |
| 12471 |
ref: refs, |
| 12472 |
props: [{ |
| 12473 |
role: "presentation", |
| 12474 |
hidden, |
| 12475 |
style |
| 12476 |
}, getDisabledMountTransitionStyles(transitionStatus), props], |
| 12477 |
stateAttributesMapping: popupStateMapping |
| 12478 |
}); |
| 12479 |
} |
| 12480 |
|
| 12481 |
// node_modules/@base-ui/react/esm/utils/useAnchoredPopupScrollLock.js |
| 12482 |
var React72 = __toESM(require_react(), 1); |
| 12483 |
var VIEWPORT_WIDTH_TOLERANCE_PX = 20; |
| 12484 |
function useAnchoredPopupScrollLock(enabled, touchOpen, positionerElement, referenceElement) { |
| 12485 |
const [touchOpenShouldLockScroll, setTouchOpenShouldLockScroll] = React72.useState(false); |
| 12486 |
useIsoLayoutEffect(() => { |
| 12487 |
if (!enabled || !touchOpen || positionerElement == null) { |
| 12488 |
setTouchOpenShouldLockScroll(false); |
| 12489 |
return; |
| 12490 |
} |
| 12491 |
const viewportWidth = ownerDocument(positionerElement).documentElement.clientWidth; |
| 12492 |
const popupWidth = positionerElement.offsetWidth; |
| 12493 |
setTouchOpenShouldLockScroll(viewportWidth > 0 && popupWidth > 0 && popupWidth >= viewportWidth - VIEWPORT_WIDTH_TOLERANCE_PX); |
| 12494 |
}, [enabled, touchOpen, positionerElement]); |
| 12495 |
useScrollLock(enabled && (!touchOpen || touchOpenShouldLockScroll), referenceElement); |
| 12496 |
} |
| 12497 |
|
| 12498 |
// node_modules/@base-ui/react/esm/combobox/positioner/ComboboxPositioner.js |
| 12499 |
var import_jsx_runtime21 = __toESM(require_jsx_runtime(), 1); |
| 12500 |
var ComboboxPositioner = /* @__PURE__ */ React73.forwardRef(function ComboboxPositioner2(componentProps, forwardedRef) { |
| 12501 |
const { |
| 12502 |
render, |
| 12503 |
className, |
| 12504 |
anchor, |
| 12505 |
positionMethod = "absolute", |
| 12506 |
side = "bottom", |
| 12507 |
align = "center", |
| 12508 |
sideOffset = 0, |
| 12509 |
alignOffset = 0, |
| 12510 |
collisionBoundary = "clipping-ancestors", |
| 12511 |
collisionPadding = 5, |
| 12512 |
arrowPadding = 5, |
| 12513 |
sticky = false, |
| 12514 |
disableAnchorTracking = false, |
| 12515 |
collisionAvoidance = DROPDOWN_COLLISION_AVOIDANCE, |
| 12516 |
style: styleProp, |
| 12517 |
...elementProps |
| 12518 |
} = componentProps; |
| 12519 |
const store = useComboboxRootContext(); |
| 12520 |
const { |
| 12521 |
filteredItems |
| 12522 |
} = useComboboxDerivedItemsContext(); |
| 12523 |
const floatingRootContext = useComboboxFloatingContext(); |
| 12524 |
const keepMounted = useComboboxPortalContext(); |
| 12525 |
const modal = useStore(store, selectors2.modal); |
| 12526 |
const open = useStore(store, selectors2.open); |
| 12527 |
const mounted = useStore(store, selectors2.mounted); |
| 12528 |
const openMethod = useStore(store, selectors2.openMethod); |
| 12529 |
const positionerElement = useStore(store, selectors2.positionerElement); |
| 12530 |
const triggerElement = useStore(store, selectors2.triggerElement); |
| 12531 |
const inputElement = useStore(store, selectors2.inputElement); |
| 12532 |
const inputGroupElement = useStore(store, selectors2.inputGroupElement); |
| 12533 |
const inputInsidePopup = useStore(store, selectors2.inputInsidePopup); |
| 12534 |
const transitionStatus = useStore(store, selectors2.transitionStatus); |
| 12535 |
const empty = filteredItems.length === 0; |
| 12536 |
const resolvedAnchor = anchor ?? (inputInsidePopup ? triggerElement : inputGroupElement ?? inputElement); |
| 12537 |
const positioning = useAnchorPositioning({ |
| 12538 |
anchor: resolvedAnchor, |
| 12539 |
floatingRootContext, |
| 12540 |
positionMethod, |
| 12541 |
mounted, |
| 12542 |
side, |
| 12543 |
sideOffset, |
| 12544 |
align, |
| 12545 |
alignOffset, |
| 12546 |
arrowPadding, |
| 12547 |
collisionBoundary, |
| 12548 |
collisionPadding, |
| 12549 |
sticky, |
| 12550 |
disableAnchorTracking, |
| 12551 |
keepMounted, |
| 12552 |
collisionAvoidance, |
| 12553 |
lazyFlip: true |
| 12554 |
}); |
| 12555 |
useAnchoredPopupScrollLock(open && modal, openMethod === "touch", positionerElement, triggerElement); |
| 12556 |
const state = { |
| 12557 |
open, |
| 12558 |
side: positioning.side, |
| 12559 |
align: positioning.align, |
| 12560 |
anchorHidden: positioning.anchorHidden, |
| 12561 |
empty |
| 12562 |
}; |
| 12563 |
useIsoLayoutEffect(() => { |
| 12564 |
store.set("popupSide", positioning.side); |
| 12565 |
}, [store, positioning.side]); |
| 12566 |
const setPositionerElement = useStableCallback((element2) => { |
| 12567 |
store.set("positionerElement", element2); |
| 12568 |
}); |
| 12569 |
const element = usePositioner(componentProps, state, { |
| 12570 |
styles: positioning.positionerStyles, |
| 12571 |
transitionStatus, |
| 12572 |
props: elementProps, |
| 12573 |
refs: [forwardedRef, setPositionerElement], |
| 12574 |
hidden: !mounted, |
| 12575 |
inert: !open |
| 12576 |
}); |
| 12577 |
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(ComboboxPositionerContext.Provider, { |
| 12578 |
value: positioning, |
| 12579 |
children: [mounted && modal && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(InternalBackdrop, { |
| 12580 |
inert: inertValue(!open), |
| 12581 |
cutout: inputGroupElement ?? inputElement ?? triggerElement |
| 12582 |
}), element] |
| 12583 |
}); |
| 12584 |
}); |
| 12585 |
if (true) ComboboxPositioner.displayName = "ComboboxPositioner"; |
| 12586 |
|
| 12587 |
// node_modules/@base-ui/react/esm/combobox/popup/ComboboxPopup.js |
| 12588 |
var React74 = __toESM(require_react(), 1); |
| 12589 |
var import_jsx_runtime22 = __toESM(require_jsx_runtime(), 1); |
| 12590 |
var stateAttributesMapping3 = { |
| 12591 |
...popupStateMapping, |
| 12592 |
...transitionStatusMapping |
| 12593 |
}; |
| 12594 |
var ComboboxPopup = /* @__PURE__ */ React74.forwardRef(function ComboboxPopup2(componentProps, forwardedRef) { |
| 12595 |
const { |
| 12596 |
render, |
| 12597 |
className, |
| 12598 |
style, |
| 12599 |
initialFocus, |
| 12600 |
finalFocus, |
| 12601 |
...elementProps |
| 12602 |
} = componentProps; |
| 12603 |
const store = useComboboxRootContext(); |
| 12604 |
const positioning = useComboboxPositionerContext(); |
| 12605 |
const floatingRootContext = useComboboxFloatingContext(); |
| 12606 |
const { |
| 12607 |
filteredItems |
| 12608 |
} = useComboboxDerivedItemsContext(); |
| 12609 |
const mounted = useStore(store, selectors2.mounted); |
| 12610 |
const open = useStore(store, selectors2.open); |
| 12611 |
const openMethod = useStore(store, selectors2.openMethod); |
| 12612 |
const transitionStatus = useStore(store, selectors2.transitionStatus); |
| 12613 |
const inputInsidePopup = useStore(store, selectors2.inputInsidePopup); |
| 12614 |
const inputElement = useStore(store, selectors2.inputElement); |
| 12615 |
const modal = useStore(store, selectors2.modal); |
| 12616 |
const empty = filteredItems.length === 0; |
| 12617 |
useOpenChangeComplete({ |
| 12618 |
open, |
| 12619 |
ref: store.state.popupRef, |
| 12620 |
onComplete() { |
| 12621 |
if (open) { |
| 12622 |
store.state.onOpenChangeComplete(true); |
| 12623 |
} |
| 12624 |
} |
| 12625 |
}); |
| 12626 |
const state = { |
| 12627 |
open, |
| 12628 |
side: positioning.side, |
| 12629 |
align: positioning.align, |
| 12630 |
anchorHidden: positioning.anchorHidden, |
| 12631 |
transitionStatus, |
| 12632 |
empty |
| 12633 |
}; |
| 12634 |
const element = useRenderElement("div", componentProps, { |
| 12635 |
state, |
| 12636 |
ref: [forwardedRef, store.state.popupRef], |
| 12637 |
props: [{ |
| 12638 |
role: inputInsidePopup ? "dialog" : "presentation", |
| 12639 |
tabIndex: -1, |
| 12640 |
onFocus(event) { |
| 12641 |
const target = getTarget(event.nativeEvent); |
| 12642 |
if (openMethod !== "touch" && (contains(store.state.listElement, target) || target === event.currentTarget)) { |
| 12643 |
store.state.inputRef.current?.focus(); |
| 12644 |
} |
| 12645 |
} |
| 12646 |
}, getDisabledMountTransitionStyles(transitionStatus), elementProps], |
| 12647 |
stateAttributesMapping: stateAttributesMapping3 |
| 12648 |
}); |
| 12649 |
const computedDefaultInitialFocus = inputInsidePopup ? (interactionType) => interactionType === "touch" ? store.state.popupRef.current : inputElement : false; |
| 12650 |
const resolvedInitialFocus = initialFocus === void 0 ? computedDefaultInitialFocus : initialFocus; |
| 12651 |
let resolvedFinalFocus; |
| 12652 |
if (finalFocus != null) { |
| 12653 |
resolvedFinalFocus = finalFocus; |
| 12654 |
} else { |
| 12655 |
resolvedFinalFocus = inputInsidePopup ? void 0 : false; |
| 12656 |
} |
| 12657 |
const focusManagerModal = !inputInsidePopup || modal; |
| 12658 |
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(FloatingFocusManager, { |
| 12659 |
context: floatingRootContext, |
| 12660 |
disabled: !mounted, |
| 12661 |
modal: focusManagerModal, |
| 12662 |
openInteractionType: openMethod, |
| 12663 |
initialFocus: resolvedInitialFocus, |
| 12664 |
returnFocus: resolvedFinalFocus, |
| 12665 |
getInsideElements: () => [store.state.startDismissRef.current, store.state.endDismissRef.current], |
| 12666 |
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(React74.Fragment, { |
| 12667 |
children: [element, focusManagerModal && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ComboboxInternalDismissButton, { |
| 12668 |
ref: store.state.endDismissRef |
| 12669 |
})] |
| 12670 |
}) |
| 12671 |
}); |
| 12672 |
}); |
| 12673 |
if (true) ComboboxPopup.displayName = "ComboboxPopup"; |
| 12674 |
|
| 12675 |
// node_modules/@base-ui/react/esm/combobox/arrow/ComboboxArrow.js |
| 12676 |
var React75 = __toESM(require_react(), 1); |
| 12677 |
var ComboboxArrow = /* @__PURE__ */ React75.forwardRef(function ComboboxArrow2(componentProps, forwardedRef) { |
| 12678 |
const { |
| 12679 |
render, |
| 12680 |
className, |
| 12681 |
style, |
| 12682 |
...elementProps |
| 12683 |
} = componentProps; |
| 12684 |
const store = useComboboxRootContext(); |
| 12685 |
const { |
| 12686 |
arrowRef, |
| 12687 |
side, |
| 12688 |
align, |
| 12689 |
arrowUncentered, |
| 12690 |
arrowStyles |
| 12691 |
} = useComboboxPositionerContext(); |
| 12692 |
const open = useStore(store, selectors2.open); |
| 12693 |
const state = { |
| 12694 |
open, |
| 12695 |
side, |
| 12696 |
align, |
| 12697 |
uncentered: arrowUncentered |
| 12698 |
}; |
| 12699 |
return useRenderElement("div", componentProps, { |
| 12700 |
ref: [arrowRef, forwardedRef], |
| 12701 |
stateAttributesMapping: popupStateMapping, |
| 12702 |
state, |
| 12703 |
props: { |
| 12704 |
style: arrowStyles, |
| 12705 |
"aria-hidden": true, |
| 12706 |
...elementProps |
| 12707 |
} |
| 12708 |
}); |
| 12709 |
}); |
| 12710 |
if (true) ComboboxArrow.displayName = "ComboboxArrow"; |
| 12711 |
|
| 12712 |
// node_modules/@base-ui/react/esm/combobox/group/ComboboxGroup.js |
| 12713 |
var React77 = __toESM(require_react(), 1); |
| 12714 |
|
| 12715 |
// node_modules/@base-ui/react/esm/combobox/group/ComboboxGroupContext.js |
| 12716 |
var React76 = __toESM(require_react(), 1); |
| 12717 |
var ComboboxGroupContext = /* @__PURE__ */ React76.createContext(void 0); |
| 12718 |
if (true) ComboboxGroupContext.displayName = "ComboboxGroupContext"; |
| 12719 |
function useComboboxGroupContext() { |
| 12720 |
const context = React76.useContext(ComboboxGroupContext); |
| 12721 |
if (context === void 0) { |
| 12722 |
throw new Error(true ? "Base UI: ComboboxGroupContext is missing. ComboboxGroup parts must be placed within <Combobox.Group>." : formatErrorMessage_default(18)); |
| 12723 |
} |
| 12724 |
return context; |
| 12725 |
} |
| 12726 |
|
| 12727 |
// node_modules/@base-ui/react/esm/combobox/group/ComboboxGroup.js |
| 12728 |
var import_jsx_runtime23 = __toESM(require_jsx_runtime(), 1); |
| 12729 |
var ComboboxGroup = /* @__PURE__ */ React77.forwardRef(function ComboboxGroup2(componentProps, forwardedRef) { |
| 12730 |
const { |
| 12731 |
render, |
| 12732 |
className, |
| 12733 |
style, |
| 12734 |
items, |
| 12735 |
...elementProps |
| 12736 |
} = componentProps; |
| 12737 |
const [labelId, setLabelId] = React77.useState(); |
| 12738 |
const contextValue = React77.useMemo(() => ({ |
| 12739 |
labelId, |
| 12740 |
setLabelId, |
| 12741 |
items |
| 12742 |
}), [labelId, setLabelId, items]); |
| 12743 |
const element = useRenderElement("div", componentProps, { |
| 12744 |
ref: forwardedRef, |
| 12745 |
props: [{ |
| 12746 |
role: "group", |
| 12747 |
"aria-labelledby": labelId |
| 12748 |
}, elementProps] |
| 12749 |
}); |
| 12750 |
const wrappedElement = /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(ComboboxGroupContext.Provider, { |
| 12751 |
value: contextValue, |
| 12752 |
children: element |
| 12753 |
}); |
| 12754 |
if (items) { |
| 12755 |
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(GroupCollectionProvider, { |
| 12756 |
items, |
| 12757 |
children: wrappedElement |
| 12758 |
}); |
| 12759 |
} |
| 12760 |
return wrappedElement; |
| 12761 |
}); |
| 12762 |
if (true) ComboboxGroup.displayName = "ComboboxGroup"; |
| 12763 |
|
| 12764 |
// node_modules/@base-ui/react/esm/combobox/group-label/ComboboxGroupLabel.js |
| 12765 |
var React78 = __toESM(require_react(), 1); |
| 12766 |
var ComboboxGroupLabel = /* @__PURE__ */ React78.forwardRef(function ComboboxGroupLabel2(componentProps, forwardedRef) { |
| 12767 |
const { |
| 12768 |
render, |
| 12769 |
className, |
| 12770 |
style, |
| 12771 |
id: idProp, |
| 12772 |
...elementProps |
| 12773 |
} = componentProps; |
| 12774 |
const { |
| 12775 |
setLabelId |
| 12776 |
} = useComboboxGroupContext(); |
| 12777 |
const id = useBaseUiId(idProp); |
| 12778 |
useIsoLayoutEffect(() => { |
| 12779 |
setLabelId(id); |
| 12780 |
return () => { |
| 12781 |
setLabelId(void 0); |
| 12782 |
}; |
| 12783 |
}, [id, setLabelId]); |
| 12784 |
const element = useRenderElement("div", componentProps, { |
| 12785 |
ref: forwardedRef, |
| 12786 |
props: [{ |
| 12787 |
id |
| 12788 |
}, elementProps] |
| 12789 |
}); |
| 12790 |
return element; |
| 12791 |
}); |
| 12792 |
if (true) ComboboxGroupLabel.displayName = "ComboboxGroupLabel"; |
| 12793 |
|
| 12794 |
// node_modules/@base-ui/react/esm/combobox/item/ComboboxItem.js |
| 12795 |
var React81 = __toESM(require_react(), 1); |
| 12796 |
var ReactDOM5 = __toESM(require_react_dom(), 1); |
| 12797 |
|
| 12798 |
// node_modules/@base-ui/react/esm/combobox/item/ComboboxItemContext.js |
| 12799 |
var React79 = __toESM(require_react(), 1); |
| 12800 |
var ComboboxItemContext = /* @__PURE__ */ React79.createContext(void 0); |
| 12801 |
if (true) ComboboxItemContext.displayName = "ComboboxItemContext"; |
| 12802 |
|
| 12803 |
// node_modules/@base-ui/react/esm/combobox/row/ComboboxRowContext.js |
| 12804 |
var React80 = __toESM(require_react(), 1); |
| 12805 |
var ComboboxRowContext = /* @__PURE__ */ React80.createContext(false); |
| 12806 |
if (true) ComboboxRowContext.displayName = "ComboboxRowContext"; |
| 12807 |
function useComboboxRowContext() { |
| 12808 |
return React80.useContext(ComboboxRowContext); |
| 12809 |
} |
| 12810 |
|
| 12811 |
// node_modules/@base-ui/react/esm/combobox/item/ComboboxItem.js |
| 12812 |
var import_jsx_runtime24 = __toESM(require_jsx_runtime(), 1); |
| 12813 |
var ComboboxItem = /* @__PURE__ */ React81.memo(/* @__PURE__ */ React81.forwardRef(function ComboboxItem2(componentProps, forwardedRef) { |
| 12814 |
const { |
| 12815 |
render, |
| 12816 |
className, |
| 12817 |
style, |
| 12818 |
value: itemValue = null, |
| 12819 |
index: indexProp, |
| 12820 |
disabled: disabled2 = false, |
| 12821 |
nativeButton = false, |
| 12822 |
...elementProps |
| 12823 |
} = componentProps; |
| 12824 |
const didPointerDownRef = React81.useRef(false); |
| 12825 |
const textRef = React81.useRef(null); |
| 12826 |
const listItem = useCompositeListItem({ |
| 12827 |
index: indexProp, |
| 12828 |
textRef, |
| 12829 |
indexGuessBehavior: IndexGuessBehavior.GuessFromOrder |
| 12830 |
}); |
| 12831 |
const store = useComboboxRootContext(); |
| 12832 |
const isRow = useComboboxRowContext(); |
| 12833 |
const { |
| 12834 |
flatFilteredItems, |
| 12835 |
hasItems |
| 12836 |
} = useComboboxDerivedItemsContext(); |
| 12837 |
const open = useStore(store, selectors2.open); |
| 12838 |
const selectionMode = useStore(store, selectors2.selectionMode); |
| 12839 |
const readOnly = useStore(store, selectors2.readOnly); |
| 12840 |
const virtualized = useStore(store, selectors2.virtualized); |
| 12841 |
const isItemEqualToValue = useStore(store, selectors2.isItemEqualToValue); |
| 12842 |
const selectable = selectionMode !== "none"; |
| 12843 |
const index2 = indexProp ?? (virtualized ? findItemIndex(flatFilteredItems, itemValue, isItemEqualToValue) : listItem.index); |
| 12844 |
const hasRegistered = listItem.index !== -1; |
| 12845 |
const rootId = useStore(store, selectors2.id); |
| 12846 |
const highlighted = useStore(store, selectors2.isActive, index2); |
| 12847 |
const matchesSelectedValue = useStore(store, selectors2.isSelected, itemValue); |
| 12848 |
const itemProps = useStore(store, selectors2.itemProps); |
| 12849 |
const itemRef = React81.useRef(null); |
| 12850 |
const id = rootId != null && hasRegistered ? `${rootId}-${index2}` : void 0; |
| 12851 |
const selected = matchesSelectedValue && selectable; |
| 12852 |
useIsoLayoutEffect(() => { |
| 12853 |
const shouldRun = hasRegistered && (virtualized || indexProp != null); |
| 12854 |
if (!shouldRun) { |
| 12855 |
return void 0; |
| 12856 |
} |
| 12857 |
const list = store.state.listRef.current; |
| 12858 |
list[index2] = itemRef.current; |
| 12859 |
return () => { |
| 12860 |
delete list[index2]; |
| 12861 |
}; |
| 12862 |
}, [hasRegistered, virtualized, index2, indexProp, store]); |
| 12863 |
useIsoLayoutEffect(() => { |
| 12864 |
if (!hasRegistered || hasItems) { |
| 12865 |
return void 0; |
| 12866 |
} |
| 12867 |
const visibleMap = store.state.valuesRef.current; |
| 12868 |
visibleMap[index2] = itemValue; |
| 12869 |
if (selectionMode !== "none") { |
| 12870 |
store.state.allValuesRef.current.push(itemValue); |
| 12871 |
} |
| 12872 |
return () => { |
| 12873 |
delete visibleMap[index2]; |
| 12874 |
}; |
| 12875 |
}, [hasRegistered, hasItems, index2, itemValue, store, selectionMode]); |
| 12876 |
useIsoLayoutEffect(() => { |
| 12877 |
if (!open) { |
| 12878 |
didPointerDownRef.current = false; |
| 12879 |
return; |
| 12880 |
} |
| 12881 |
if (!hasRegistered || hasItems) { |
| 12882 |
return; |
| 12883 |
} |
| 12884 |
const selectedValue = store.state.selectedValue; |
| 12885 |
const lastSelectedValue = Array.isArray(selectedValue) ? selectedValue[selectedValue.length - 1] : selectedValue; |
| 12886 |
if (compareItemEquality(itemValue, lastSelectedValue, isItemEqualToValue)) { |
| 12887 |
store.set("selectedIndex", index2); |
| 12888 |
} |
| 12889 |
}, [hasRegistered, hasItems, open, store, index2, itemValue, isItemEqualToValue]); |
| 12890 |
const { |
| 12891 |
getButtonProps, |
| 12892 |
buttonRef |
| 12893 |
} = useButton({ |
| 12894 |
disabled: disabled2, |
| 12895 |
focusableWhenDisabled: true, |
| 12896 |
native: nativeButton, |
| 12897 |
composite: true |
| 12898 |
}); |
| 12899 |
const state = { |
| 12900 |
disabled: disabled2, |
| 12901 |
selected, |
| 12902 |
highlighted |
| 12903 |
}; |
| 12904 |
function commitSelection(nativeEvent) { |
| 12905 |
function selectItem() { |
| 12906 |
store.state.handleSelection(nativeEvent, itemValue); |
| 12907 |
} |
| 12908 |
if (store.state.submitOnItemClick) { |
| 12909 |
ReactDOM5.flushSync(selectItem); |
| 12910 |
store.state.requestSubmit(); |
| 12911 |
} else { |
| 12912 |
selectItem(); |
| 12913 |
} |
| 12914 |
} |
| 12915 |
const defaultProps = { |
| 12916 |
id, |
| 12917 |
role: isRow ? "gridcell" : "option", |
| 12918 |
"aria-selected": selectable ? selected : void 0, |
| 12919 |
// Focusable items steal focus from the input upon mouseup. |
| 12920 |
// Warn if the user renders a natively focusable element like `<button>`, |
| 12921 |
// as it should be a `<div>` instead. |
| 12922 |
tabIndex: void 0, |
| 12923 |
onPointerDownCapture(event) { |
| 12924 |
didPointerDownRef.current = true; |
| 12925 |
event.preventDefault(); |
| 12926 |
}, |
| 12927 |
onMouseDown(event) { |
| 12928 |
event.preventDefault(); |
| 12929 |
}, |
| 12930 |
onClick(event) { |
| 12931 |
if (disabled2 || readOnly) { |
| 12932 |
return; |
| 12933 |
} |
| 12934 |
commitSelection(event.nativeEvent); |
| 12935 |
}, |
| 12936 |
onMouseUp(event) { |
| 12937 |
const pointerStartedOnItem = didPointerDownRef.current; |
| 12938 |
didPointerDownRef.current = false; |
| 12939 |
if (disabled2 || readOnly || event.button !== 0 || pointerStartedOnItem || !highlighted) { |
| 12940 |
return; |
| 12941 |
} |
| 12942 |
commitSelection(event.nativeEvent); |
| 12943 |
} |
| 12944 |
}; |
| 12945 |
const element = useRenderElement("div", componentProps, { |
| 12946 |
ref: [buttonRef, forwardedRef, listItem.ref, itemRef], |
| 12947 |
state, |
| 12948 |
props: [itemProps, defaultProps, elementProps, getButtonProps] |
| 12949 |
}); |
| 12950 |
const contextValue = React81.useMemo(() => ({ |
| 12951 |
selected, |
| 12952 |
textRef |
| 12953 |
}), [selected, textRef]); |
| 12954 |
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(ComboboxItemContext.Provider, { |
| 12955 |
value: contextValue, |
| 12956 |
children: element |
| 12957 |
}); |
| 12958 |
})); |
| 12959 |
if (true) ComboboxItem.displayName = "ComboboxItem"; |
| 12960 |
|
| 12961 |
// node_modules/@base-ui/react/esm/autocomplete/item/AutocompleteItem.js |
| 12962 |
var AutocompleteItem = ComboboxItem; |
| 12963 |
|
| 12964 |
// node_modules/@base-ui/react/esm/combobox/row/ComboboxRow.js |
| 12965 |
var React82 = __toESM(require_react(), 1); |
| 12966 |
var import_jsx_runtime25 = __toESM(require_jsx_runtime(), 1); |
| 12967 |
var ComboboxRow = /* @__PURE__ */ React82.forwardRef(function ComboboxRow2(componentProps, forwardedRef) { |
| 12968 |
const { |
| 12969 |
render, |
| 12970 |
className, |
| 12971 |
style, |
| 12972 |
...elementProps |
| 12973 |
} = componentProps; |
| 12974 |
const element = useRenderElement("div", componentProps, { |
| 12975 |
ref: forwardedRef, |
| 12976 |
props: [{ |
| 12977 |
role: "row" |
| 12978 |
}, elementProps] |
| 12979 |
}); |
| 12980 |
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ComboboxRowContext.Provider, { |
| 12981 |
value: true, |
| 12982 |
children: element |
| 12983 |
}); |
| 12984 |
}); |
| 12985 |
if (true) ComboboxRow.displayName = "ComboboxRow"; |
| 12986 |
|
| 12987 |
// node_modules/@base-ui/react/esm/combobox/empty/ComboboxEmpty.js |
| 12988 |
var React83 = __toESM(require_react(), 1); |
| 12989 |
var ComboboxEmpty = /* @__PURE__ */ React83.forwardRef(function ComboboxEmpty2(componentProps, forwardedRef) { |
| 12990 |
const { |
| 12991 |
render, |
| 12992 |
className, |
| 12993 |
style, |
| 12994 |
children: childrenProp, |
| 12995 |
...elementProps |
| 12996 |
} = componentProps; |
| 12997 |
const { |
| 12998 |
filteredItems |
| 12999 |
} = useComboboxDerivedItemsContext(); |
| 13000 |
const store = useComboboxRootContext(); |
| 13001 |
const emptyRef = useInitialLiveRegionTextMutation(); |
| 13002 |
const children = filteredItems.length === 0 ? childrenProp : null; |
| 13003 |
return useRenderElement("div", componentProps, { |
| 13004 |
ref: [forwardedRef, store.state.emptyRef, emptyRef], |
| 13005 |
props: [{ |
| 13006 |
children, |
| 13007 |
role: "status", |
| 13008 |
"aria-live": "polite", |
| 13009 |
"aria-atomic": true |
| 13010 |
}, elementProps] |
| 13011 |
}); |
| 13012 |
}); |
| 13013 |
if (true) ComboboxEmpty.displayName = "ComboboxEmpty"; |
| 13014 |
|
| 13015 |
// node_modules/@base-ui/react/esm/separator/Separator.js |
| 13016 |
var React84 = __toESM(require_react(), 1); |
| 13017 |
var Separator = /* @__PURE__ */ React84.forwardRef(function SeparatorComponent(componentProps, forwardedRef) { |
| 13018 |
const { |
| 13019 |
className, |
| 13020 |
render, |
| 13021 |
orientation = "horizontal", |
| 13022 |
style, |
| 13023 |
...elementProps |
| 13024 |
} = componentProps; |
| 13025 |
const state = { |
| 13026 |
orientation |
| 13027 |
}; |
| 13028 |
const element = useRenderElement("div", componentProps, { |
| 13029 |
state, |
| 13030 |
ref: forwardedRef, |
| 13031 |
props: [{ |
| 13032 |
role: "separator", |
| 13033 |
"aria-orientation": orientation |
| 13034 |
}, elementProps] |
| 13035 |
}); |
| 13036 |
return element; |
| 13037 |
}); |
| 13038 |
if (true) Separator.displayName = "Separator"; |
| 13039 |
|
| 13040 |
// node_modules/@base-ui/react/esm/combobox/root/utils/useFilteredItems.js |
| 13041 |
function useFilteredItems() { |
| 13042 |
const items = useComboboxDerivedItemsContext(); |
| 13043 |
return items.filteredItems; |
| 13044 |
} |
| 13045 |
|
| 13046 |
// node_modules/@base-ui/react/esm/button/Button.js |
| 13047 |
var React85 = __toESM(require_react(), 1); |
| 13048 |
var Button = /* @__PURE__ */ React85.forwardRef(function Button2(componentProps, forwardedRef) { |
| 13049 |
const { |
| 13050 |
render, |
| 13051 |
className, |
| 13052 |
disabled: disabled2 = false, |
| 13053 |
focusableWhenDisabled = false, |
| 13054 |
nativeButton = true, |
| 13055 |
style, |
| 13056 |
...elementProps |
| 13057 |
} = componentProps; |
| 13058 |
const { |
| 13059 |
getButtonProps, |
| 13060 |
buttonRef |
| 13061 |
} = useButton({ |
| 13062 |
disabled: disabled2, |
| 13063 |
focusableWhenDisabled, |
| 13064 |
native: nativeButton |
| 13065 |
}); |
| 13066 |
const state = { |
| 13067 |
disabled: disabled2 |
| 13068 |
}; |
| 13069 |
return useRenderElement("button", componentProps, { |
| 13070 |
state, |
| 13071 |
ref: [forwardedRef, buttonRef], |
| 13072 |
props: [elementProps, getButtonProps] |
| 13073 |
}); |
| 13074 |
}); |
| 13075 |
if (true) Button.displayName = "Button"; |
| 13076 |
|
| 13077 |
// node_modules/@base-ui/react/esm/field/item/FieldItemContext.js |
| 13078 |
var React86 = __toESM(require_react(), 1); |
| 13079 |
var FieldItemContext = /* @__PURE__ */ React86.createContext({ |
| 13080 |
disabled: false |
| 13081 |
}); |
| 13082 |
if (true) FieldItemContext.displayName = "FieldItemContext"; |
| 13083 |
|
| 13084 |
// node_modules/@base-ui/react/esm/checkbox-group/CheckboxGroupContext.js |
| 13085 |
var React87 = __toESM(require_react(), 1); |
| 13086 |
var CheckboxGroupContext = /* @__PURE__ */ React87.createContext(void 0); |
| 13087 |
if (true) CheckboxGroupContext.displayName = "CheckboxGroupContext"; |
| 13088 |
function useCheckboxGroupContext(optional = true) { |
| 13089 |
const context = React87.useContext(CheckboxGroupContext); |
| 13090 |
if (context === void 0 && !optional) { |
| 13091 |
throw new Error(true ? "Base UI: CheckboxGroupContext is missing. CheckboxGroup parts must be placed within <CheckboxGroup>." : formatErrorMessage_default(3)); |
| 13092 |
} |
| 13093 |
return context; |
| 13094 |
} |
| 13095 |
|
| 13096 |
// node_modules/@base-ui/react/esm/utils/useRegisteredLabelId.js |
| 13097 |
function useRegisteredLabelId(idProp, setLabelId) { |
| 13098 |
const id = useBaseUiId(idProp); |
| 13099 |
useIsoLayoutEffect(() => { |
| 13100 |
setLabelId(id); |
| 13101 |
return () => { |
| 13102 |
setLabelId(void 0); |
| 13103 |
}; |
| 13104 |
}, [id, setLabelId]); |
| 13105 |
return id; |
| 13106 |
} |
| 13107 |
|
| 13108 |
// node_modules/@base-ui/react/esm/internals/labelable-provider/useLabel.js |
| 13109 |
function useLabel(params = {}) { |
| 13110 |
const { |
| 13111 |
id: idProp, |
| 13112 |
fallbackControlId, |
| 13113 |
native = false, |
| 13114 |
setLabelId: setLabelIdProp, |
| 13115 |
focusControl: focusControlProp |
| 13116 |
} = params; |
| 13117 |
const { |
| 13118 |
controlId: contextControlId, |
| 13119 |
setLabelId: setContextLabelId |
| 13120 |
} = useLabelableContext(); |
| 13121 |
const syncLabelId = useStableCallback((nextLabelId) => { |
| 13122 |
setContextLabelId(nextLabelId); |
| 13123 |
setLabelIdProp?.(nextLabelId); |
| 13124 |
}); |
| 13125 |
const id = useRegisteredLabelId(idProp, syncLabelId); |
| 13126 |
const resolvedControlId = contextControlId ?? fallbackControlId; |
| 13127 |
function focusControl(event) { |
| 13128 |
if (focusControlProp) { |
| 13129 |
focusControlProp(event, resolvedControlId); |
| 13130 |
return; |
| 13131 |
} |
| 13132 |
if (!resolvedControlId) { |
| 13133 |
return; |
| 13134 |
} |
| 13135 |
const controlElement = ownerDocument(event.currentTarget).getElementById(resolvedControlId); |
| 13136 |
if (isHTMLElement(controlElement)) { |
| 13137 |
focusElementWithVisible(controlElement); |
| 13138 |
} |
| 13139 |
} |
| 13140 |
function handleInteraction(event) { |
| 13141 |
const target = getTarget(event.nativeEvent); |
| 13142 |
if (target?.closest("button,input,select,textarea")) { |
| 13143 |
return; |
| 13144 |
} |
| 13145 |
if (!event.defaultPrevented && event.detail > 1) { |
| 13146 |
event.preventDefault(); |
| 13147 |
} |
| 13148 |
if (native) { |
| 13149 |
return; |
| 13150 |
} |
| 13151 |
focusControl(event); |
| 13152 |
} |
| 13153 |
return native ? { |
| 13154 |
id, |
| 13155 |
htmlFor: resolvedControlId ?? void 0, |
| 13156 |
onMouseDown: handleInteraction |
| 13157 |
} : { |
| 13158 |
id, |
| 13159 |
onClick: handleInteraction, |
| 13160 |
onPointerDown(event) { |
| 13161 |
event.preventDefault(); |
| 13162 |
} |
| 13163 |
}; |
| 13164 |
} |
| 13165 |
function focusElementWithVisible(element) { |
| 13166 |
element.focus({ |
| 13167 |
// Available from Chrome 144+ (January 2026). |
| 13168 |
// Safari and Firefox already support it. |
| 13169 |
focusVisible: true |
| 13170 |
}); |
| 13171 |
} |
| 13172 |
|
| 13173 |
// node_modules/@base-ui/react/esm/utils/usePopupViewport.js |
| 13174 |
var React90 = __toESM(require_react(), 1); |
| 13175 |
var ReactDOM6 = __toESM(require_react_dom(), 1); |
| 13176 |
|
| 13177 |
// node_modules/@base-ui/utils/esm/usePreviousValue.js |
| 13178 |
var React88 = __toESM(require_react(), 1); |
| 13179 |
function usePreviousValue(value) { |
| 13180 |
const [state, setState] = React88.useState({ |
| 13181 |
current: value, |
| 13182 |
previous: null |
| 13183 |
}); |
| 13184 |
if (value !== state.current) { |
| 13185 |
setState({ |
| 13186 |
current: value, |
| 13187 |
previous: state.current |
| 13188 |
}); |
| 13189 |
} |
| 13190 |
return state.previous; |
| 13191 |
} |
| 13192 |
|
| 13193 |
// node_modules/@base-ui/react/esm/utils/usePopupAutoResize.js |
| 13194 |
var React89 = __toESM(require_react(), 1); |
| 13195 |
|
| 13196 |
// node_modules/@base-ui/react/esm/utils/getCssDimensions.js |
| 13197 |
function getCssDimensions2(element) { |
| 13198 |
const css = getComputedStyle2(element); |
| 13199 |
let width = parseFloat(css.width) || 0; |
| 13200 |
let height = parseFloat(css.height) || 0; |
| 13201 |
const hasOffset = isHTMLElement(element); |
| 13202 |
const offsetWidth = hasOffset ? element.offsetWidth : width; |
| 13203 |
const offsetHeight = hasOffset ? element.offsetHeight : height; |
| 13204 |
const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight; |
| 13205 |
if (shouldFallback) { |
| 13206 |
width = offsetWidth; |
| 13207 |
height = offsetHeight; |
| 13208 |
} |
| 13209 |
return { |
| 13210 |
width, |
| 13211 |
height |
| 13212 |
}; |
| 13213 |
} |
| 13214 |
|
| 13215 |
// node_modules/@base-ui/react/esm/utils/usePopupAutoResize.js |
| 13216 |
var DEFAULT_ENABLED = () => true; |
| 13217 |
function usePopupAutoResize(parameters) { |
| 13218 |
const { |
| 13219 |
popupElement, |
| 13220 |
positionerElement, |
| 13221 |
content, |
| 13222 |
mounted, |
| 13223 |
enabled = DEFAULT_ENABLED, |
| 13224 |
onMeasureLayout: onMeasureLayoutParam, |
| 13225 |
onMeasureLayoutComplete: onMeasureLayoutCompleteParam, |
| 13226 |
side, |
| 13227 |
direction |
| 13228 |
} = parameters; |
| 13229 |
const runOnceAnimationsFinish = useAnimationsFinished(popupElement, true, false); |
| 13230 |
const animationFrame = useAnimationFrame(); |
| 13231 |
const committedDimensionsRef = React89.useRef(null); |
| 13232 |
const liveDimensionsRef = React89.useRef(null); |
| 13233 |
const isInitialRenderRef = React89.useRef(true); |
| 13234 |
const restoreAnchoringStylesRef = React89.useRef(NOOP); |
| 13235 |
const onMeasureLayout = useStableCallback(onMeasureLayoutParam); |
| 13236 |
const onMeasureLayoutComplete = useStableCallback(onMeasureLayoutCompleteParam); |
| 13237 |
const anchoringStyles = React89.useMemo(() => { |
| 13238 |
let isOriginSide = side === "top"; |
| 13239 |
let isPhysicalLeft = side === "left"; |
| 13240 |
if (direction === "rtl") { |
| 13241 |
isOriginSide = isOriginSide || side === "inline-end"; |
| 13242 |
isPhysicalLeft = isPhysicalLeft || side === "inline-end"; |
| 13243 |
} else { |
| 13244 |
isOriginSide = isOriginSide || side === "inline-start"; |
| 13245 |
isPhysicalLeft = isPhysicalLeft || side === "inline-start"; |
| 13246 |
} |
| 13247 |
return isOriginSide ? { |
| 13248 |
position: "absolute", |
| 13249 |
[side === "top" ? "bottom" : "top"]: "0", |
| 13250 |
[isPhysicalLeft ? "right" : "left"]: "0" |
| 13251 |
} : EMPTY_OBJECT; |
| 13252 |
}, [side, direction]); |
| 13253 |
useIsoLayoutEffect(() => { |
| 13254 |
if (!mounted || !enabled() || typeof ResizeObserver !== "function") { |
| 13255 |
restoreAnchoringStylesRef.current = NOOP; |
| 13256 |
isInitialRenderRef.current = true; |
| 13257 |
committedDimensionsRef.current = null; |
| 13258 |
liveDimensionsRef.current = null; |
| 13259 |
return void 0; |
| 13260 |
} |
| 13261 |
if (!popupElement || !positionerElement) { |
| 13262 |
return void 0; |
| 13263 |
} |
| 13264 |
restoreAnchoringStylesRef.current = applyElementStyles(popupElement, anchoringStyles); |
| 13265 |
const observer = new ResizeObserver((entries) => { |
| 13266 |
const entry = entries[0]; |
| 13267 |
if (entry) { |
| 13268 |
liveDimensionsRef.current = { |
| 13269 |
width: Math.ceil(entry.borderBoxSize[0].inlineSize), |
| 13270 |
height: Math.ceil(entry.borderBoxSize[0].blockSize) |
| 13271 |
}; |
| 13272 |
} |
| 13273 |
}); |
| 13274 |
observer.observe(popupElement); |
| 13275 |
setPopupCssSize(popupElement, "auto"); |
| 13276 |
const restorePopupPosition = overrideElementStyle(popupElement, "position", "static"); |
| 13277 |
const restorePopupTransform = overrideElementStyle(popupElement, "transform", "none"); |
| 13278 |
const restorePopupScale = overrideElementStyle(popupElement, "scale", "1"); |
| 13279 |
const restorePositionerAvailableSize = applyElementStyles(positionerElement, { |
| 13280 |
"--available-width": "max-content", |
| 13281 |
"--available-height": "max-content" |
| 13282 |
}); |
| 13283 |
function restoreMeasurementOverrides() { |
| 13284 |
restorePopupPosition(); |
| 13285 |
restorePopupTransform(); |
| 13286 |
restorePositionerAvailableSize(); |
| 13287 |
} |
| 13288 |
function restoreMeasurementOverridesIncludingScale() { |
| 13289 |
restoreMeasurementOverrides(); |
| 13290 |
restorePopupScale(); |
| 13291 |
} |
| 13292 |
onMeasureLayout?.(); |
| 13293 |
if (isInitialRenderRef.current || committedDimensionsRef.current === null) { |
| 13294 |
setPositionerCssSize(positionerElement, "max-content"); |
| 13295 |
const dimensions = getCssDimensions2(popupElement); |
| 13296 |
committedDimensionsRef.current = dimensions; |
| 13297 |
setPositionerCssSize(positionerElement, dimensions); |
| 13298 |
restoreMeasurementOverridesIncludingScale(); |
| 13299 |
onMeasureLayoutComplete?.(null, dimensions); |
| 13300 |
isInitialRenderRef.current = false; |
| 13301 |
return () => { |
| 13302 |
observer.disconnect(); |
| 13303 |
restoreAnchoringStylesRef.current(); |
| 13304 |
restoreAnchoringStylesRef.current = NOOP; |
| 13305 |
}; |
| 13306 |
} |
| 13307 |
setPopupCssSize(popupElement, "auto"); |
| 13308 |
setPositionerCssSize(positionerElement, "max-content"); |
| 13309 |
const previousDimensions = committedDimensionsRef.current ?? liveDimensionsRef.current; |
| 13310 |
const newDimensions = getCssDimensions2(popupElement); |
| 13311 |
committedDimensionsRef.current = newDimensions; |
| 13312 |
if (!previousDimensions) { |
| 13313 |
setPositionerCssSize(positionerElement, newDimensions); |
| 13314 |
restoreMeasurementOverridesIncludingScale(); |
| 13315 |
onMeasureLayoutComplete?.(null, newDimensions); |
| 13316 |
return () => { |
| 13317 |
observer.disconnect(); |
| 13318 |
animationFrame.cancel(); |
| 13319 |
restoreAnchoringStylesRef.current(); |
| 13320 |
restoreAnchoringStylesRef.current = NOOP; |
| 13321 |
}; |
| 13322 |
} |
| 13323 |
setPopupCssSize(popupElement, previousDimensions); |
| 13324 |
restoreMeasurementOverridesIncludingScale(); |
| 13325 |
onMeasureLayoutComplete?.(previousDimensions, newDimensions); |
| 13326 |
setPositionerCssSize(positionerElement, newDimensions); |
| 13327 |
const abortController = new AbortController(); |
| 13328 |
animationFrame.request(() => { |
| 13329 |
setPopupCssSize(popupElement, newDimensions); |
| 13330 |
runOnceAnimationsFinish(() => { |
| 13331 |
popupElement.style.setProperty("--popup-width", "auto"); |
| 13332 |
popupElement.style.setProperty("--popup-height", "auto"); |
| 13333 |
}, abortController.signal); |
| 13334 |
}); |
| 13335 |
return () => { |
| 13336 |
observer.disconnect(); |
| 13337 |
abortController.abort(); |
| 13338 |
animationFrame.cancel(); |
| 13339 |
restoreAnchoringStylesRef.current(); |
| 13340 |
restoreAnchoringStylesRef.current = NOOP; |
| 13341 |
}; |
| 13342 |
}, [content, popupElement, positionerElement, runOnceAnimationsFinish, animationFrame, enabled, mounted, onMeasureLayout, onMeasureLayoutComplete, anchoringStyles]); |
| 13343 |
} |
| 13344 |
function overrideElementStyle(element, property, value) { |
| 13345 |
const originalValue = element.style.getPropertyValue(property); |
| 13346 |
element.style.setProperty(property, value); |
| 13347 |
return () => { |
| 13348 |
element.style.setProperty(property, originalValue); |
| 13349 |
}; |
| 13350 |
} |
| 13351 |
function applyElementStyles(element, styles) { |
| 13352 |
const restorers = []; |
| 13353 |
for (const [key, value] of Object.entries(styles)) { |
| 13354 |
restorers.push(overrideElementStyle(element, key, value)); |
| 13355 |
} |
| 13356 |
return restorers.length ? () => { |
| 13357 |
restorers.forEach((restore) => restore()); |
| 13358 |
} : NOOP; |
| 13359 |
} |
| 13360 |
function setPopupCssSize(popupElement, size4) { |
| 13361 |
const width = size4 === "auto" ? "auto" : `${size4.width}px`; |
| 13362 |
const height = size4 === "auto" ? "auto" : `${size4.height}px`; |
| 13363 |
popupElement.style.setProperty("--popup-width", width); |
| 13364 |
popupElement.style.setProperty("--popup-height", height); |
| 13365 |
} |
| 13366 |
function setPositionerCssSize(positionerElement, size4) { |
| 13367 |
const width = size4 === "max-content" ? "max-content" : `${size4.width}px`; |
| 13368 |
const height = size4 === "max-content" ? "max-content" : `${size4.height}px`; |
| 13369 |
positionerElement.style.setProperty("--positioner-width", width); |
| 13370 |
positionerElement.style.setProperty("--positioner-height", height); |
| 13371 |
} |
| 13372 |
|
| 13373 |
// node_modules/@base-ui/react/esm/utils/usePopupViewport.js |
| 13374 |
var import_jsx_runtime26 = __toESM(require_jsx_runtime(), 1); |
| 13375 |
function usePopupViewport(parameters) { |
| 13376 |
const { |
| 13377 |
store, |
| 13378 |
side, |
| 13379 |
cssVars, |
| 13380 |
children |
| 13381 |
} = parameters; |
| 13382 |
const direction = useDirection(); |
| 13383 |
const activeTrigger = store.useState("activeTriggerElement"); |
| 13384 |
const activeTriggerId = store.useState("activeTriggerId"); |
| 13385 |
const open = store.useState("open"); |
| 13386 |
const payload = store.useState("payload"); |
| 13387 |
const mounted = store.useState("mounted"); |
| 13388 |
const popupElement = store.useState("popupElement"); |
| 13389 |
const positionerElement = store.useState("positionerElement"); |
| 13390 |
const previousActiveTrigger = usePreviousValue(open ? activeTrigger : null); |
| 13391 |
const currentContentKey = usePopupContentKey(activeTriggerId, payload); |
| 13392 |
const capturedNodeRef = React90.useRef(null); |
| 13393 |
const [previousContentNode, setPreviousContentNode] = React90.useState(null); |
| 13394 |
const [newTriggerOffset, setNewTriggerOffset] = React90.useState(null); |
| 13395 |
const currentContainerRef = React90.useRef(null); |
| 13396 |
const previousContainerRef = React90.useRef(null); |
| 13397 |
const onAnimationsFinished = useAnimationsFinished(currentContainerRef, true, false); |
| 13398 |
const cleanupFrame = useAnimationFrame(); |
| 13399 |
const [previousContentDimensions, setPreviousContentDimensions] = React90.useState(null); |
| 13400 |
const [showStartingStyleAttribute, setShowStartingStyleAttribute] = React90.useState(false); |
| 13401 |
useIsoLayoutEffect(() => { |
| 13402 |
store.set("hasViewport", true); |
| 13403 |
return () => { |
| 13404 |
store.set("hasViewport", false); |
| 13405 |
}; |
| 13406 |
}, [store]); |
| 13407 |
const handleMeasureLayout = useStableCallback(() => { |
| 13408 |
currentContainerRef.current?.style.setProperty("animation", "none"); |
| 13409 |
currentContainerRef.current?.style.setProperty("transition", "none"); |
| 13410 |
previousContainerRef.current?.style.setProperty("display", "none"); |
| 13411 |
}); |
| 13412 |
const handleMeasureLayoutComplete = useStableCallback((previousDimensions) => { |
| 13413 |
currentContainerRef.current?.style.removeProperty("animation"); |
| 13414 |
currentContainerRef.current?.style.removeProperty("transition"); |
| 13415 |
previousContainerRef.current?.style.removeProperty("display"); |
| 13416 |
if (previousDimensions) { |
| 13417 |
setPreviousContentDimensions(previousDimensions); |
| 13418 |
} |
| 13419 |
}); |
| 13420 |
const lastHandledTriggerRef = React90.useRef(null); |
| 13421 |
useIsoLayoutEffect(() => { |
| 13422 |
if (activeTrigger && previousActiveTrigger && activeTrigger !== previousActiveTrigger && lastHandledTriggerRef.current !== activeTrigger && capturedNodeRef.current) { |
| 13423 |
setPreviousContentNode(capturedNodeRef.current); |
| 13424 |
setShowStartingStyleAttribute(true); |
| 13425 |
const offset4 = calculateRelativePosition(previousActiveTrigger, activeTrigger); |
| 13426 |
setNewTriggerOffset(offset4); |
| 13427 |
cleanupFrame.request(() => { |
| 13428 |
ReactDOM6.flushSync(() => { |
| 13429 |
setShowStartingStyleAttribute(false); |
| 13430 |
}); |
| 13431 |
onAnimationsFinished(() => { |
| 13432 |
setPreviousContentNode(null); |
| 13433 |
setPreviousContentDimensions(null); |
| 13434 |
capturedNodeRef.current = null; |
| 13435 |
}); |
| 13436 |
}); |
| 13437 |
lastHandledTriggerRef.current = activeTrigger; |
| 13438 |
} |
| 13439 |
}, [activeTrigger, previousActiveTrigger, previousContentNode, onAnimationsFinished, cleanupFrame]); |
| 13440 |
useIsoLayoutEffect(() => { |
| 13441 |
const source = currentContainerRef.current; |
| 13442 |
if (!source) { |
| 13443 |
return; |
| 13444 |
} |
| 13445 |
const wrapper = ownerDocument(source).createElement("div"); |
| 13446 |
for (const child of Array.from(source.childNodes)) { |
| 13447 |
wrapper.appendChild(child.cloneNode(true)); |
| 13448 |
} |
| 13449 |
capturedNodeRef.current = wrapper; |
| 13450 |
}); |
| 13451 |
const isTransitioning = previousContentNode != null; |
| 13452 |
let childrenToRender; |
| 13453 |
if (!isTransitioning) { |
| 13454 |
childrenToRender = /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { |
| 13455 |
"data-current": true, |
| 13456 |
ref: currentContainerRef, |
| 13457 |
children |
| 13458 |
}, currentContentKey); |
| 13459 |
} else { |
| 13460 |
childrenToRender = /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(React90.Fragment, { |
| 13461 |
children: [/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { |
| 13462 |
"data-previous": true, |
| 13463 |
inert: inertValue(true), |
| 13464 |
ref: previousContainerRef, |
| 13465 |
style: { |
| 13466 |
...previousContentDimensions ? { |
| 13467 |
[cssVars.popupWidth]: `${previousContentDimensions.width}px`, |
| 13468 |
[cssVars.popupHeight]: `${previousContentDimensions.height}px` |
| 13469 |
} : null, |
| 13470 |
position: "absolute" |
| 13471 |
}, |
| 13472 |
"data-ending-style": showStartingStyleAttribute ? void 0 : "" |
| 13473 |
}, "previous"), /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { |
| 13474 |
"data-current": true, |
| 13475 |
ref: currentContainerRef, |
| 13476 |
"data-starting-style": showStartingStyleAttribute ? "" : void 0, |
| 13477 |
children |
| 13478 |
}, currentContentKey)] |
| 13479 |
}); |
| 13480 |
} |
| 13481 |
useIsoLayoutEffect(() => { |
| 13482 |
const container = previousContainerRef.current; |
| 13483 |
if (!container || !previousContentNode) { |
| 13484 |
return; |
| 13485 |
} |
| 13486 |
container.replaceChildren(...Array.from(previousContentNode.childNodes)); |
| 13487 |
}, [previousContentNode]); |
| 13488 |
usePopupAutoResize({ |
| 13489 |
popupElement, |
| 13490 |
positionerElement, |
| 13491 |
mounted, |
| 13492 |
content: payload, |
| 13493 |
onMeasureLayout: handleMeasureLayout, |
| 13494 |
onMeasureLayoutComplete: handleMeasureLayoutComplete, |
| 13495 |
side, |
| 13496 |
direction |
| 13497 |
}); |
| 13498 |
const state = { |
| 13499 |
activationDirection: getActivationDirection(newTriggerOffset), |
| 13500 |
transitioning: isTransitioning |
| 13501 |
}; |
| 13502 |
return { |
| 13503 |
children: childrenToRender, |
| 13504 |
state |
| 13505 |
}; |
| 13506 |
} |
| 13507 |
function getActivationDirection(offset4) { |
| 13508 |
if (!offset4) { |
| 13509 |
return void 0; |
| 13510 |
} |
| 13511 |
return `${getValueWithTolerance(offset4.horizontal, 5, "right", "left")} ${getValueWithTolerance(offset4.vertical, 5, "down", "up")}`; |
| 13512 |
} |
| 13513 |
function getValueWithTolerance(value, tolerance, positiveLabel, negativeLabel) { |
| 13514 |
if (value > tolerance) { |
| 13515 |
return positiveLabel; |
| 13516 |
} |
| 13517 |
if (value < -tolerance) { |
| 13518 |
return negativeLabel; |
| 13519 |
} |
| 13520 |
return ""; |
| 13521 |
} |
| 13522 |
function calculateRelativePosition(from, to) { |
| 13523 |
const fromRect = from.getBoundingClientRect(); |
| 13524 |
const toRect = to.getBoundingClientRect(); |
| 13525 |
const fromCenter = { |
| 13526 |
x: fromRect.left + fromRect.width / 2, |
| 13527 |
y: fromRect.top + fromRect.height / 2 |
| 13528 |
}; |
| 13529 |
const toCenter = { |
| 13530 |
x: toRect.left + toRect.width / 2, |
| 13531 |
y: toRect.top + toRect.height / 2 |
| 13532 |
}; |
| 13533 |
return { |
| 13534 |
horizontal: toCenter.x - fromCenter.x, |
| 13535 |
vertical: toCenter.y - fromCenter.y |
| 13536 |
}; |
| 13537 |
} |
| 13538 |
function usePopupContentKey(activeTriggerId, payload) { |
| 13539 |
const [contentKey, setContentKey] = React90.useState(0); |
| 13540 |
const previousActiveTriggerIdRef = React90.useRef(activeTriggerId); |
| 13541 |
const previousPayloadRef = React90.useRef(payload); |
| 13542 |
const pendingPayloadUpdateRef = React90.useRef(false); |
| 13543 |
useIsoLayoutEffect(() => { |
| 13544 |
const previousActiveTriggerId = previousActiveTriggerIdRef.current; |
| 13545 |
const previousPayload = previousPayloadRef.current; |
| 13546 |
const triggerIdChanged = activeTriggerId !== previousActiveTriggerId; |
| 13547 |
const payloadChanged = payload !== previousPayload; |
| 13548 |
if (triggerIdChanged) { |
| 13549 |
setContentKey((value) => value + 1); |
| 13550 |
pendingPayloadUpdateRef.current = !payloadChanged; |
| 13551 |
} else if (pendingPayloadUpdateRef.current && payloadChanged) { |
| 13552 |
setContentKey((value) => value + 1); |
| 13553 |
pendingPayloadUpdateRef.current = false; |
| 13554 |
} |
| 13555 |
previousActiveTriggerIdRef.current = activeTriggerId; |
| 13556 |
previousPayloadRef.current = payload; |
| 13557 |
}, [activeTriggerId, payload]); |
| 13558 |
return `${activeTriggerId ?? "current"}-${contentKey}`; |
| 13559 |
} |
| 13560 |
|
| 13561 |
// node_modules/@base-ui/react/esm/field/index.parts.js |
| 13562 |
var index_parts_exports2 = {}; |
| 13563 |
__export(index_parts_exports2, { |
| 13564 |
Control: () => FieldControl, |
| 13565 |
Description: () => FieldDescription, |
| 13566 |
Error: () => FieldError, |
| 13567 |
Item: () => FieldItem, |
| 13568 |
Label: () => FieldLabel, |
| 13569 |
Root: () => FieldRoot, |
| 13570 |
Validity: () => FieldValidity |
| 13571 |
}); |
| 13572 |
|
| 13573 |
// node_modules/@base-ui/react/esm/field/root/FieldRoot.js |
| 13574 |
var React95 = __toESM(require_react(), 1); |
| 13575 |
|
| 13576 |
// node_modules/@base-ui/react/esm/fieldset/root/FieldsetRootContext.js |
| 13577 |
var React91 = __toESM(require_react(), 1); |
| 13578 |
var FieldsetRootContext = /* @__PURE__ */ React91.createContext({ |
| 13579 |
legendId: void 0, |
| 13580 |
setLegendId: () => { |
| 13581 |
}, |
| 13582 |
disabled: void 0 |
| 13583 |
}); |
| 13584 |
if (true) FieldsetRootContext.displayName = "FieldsetRootContext"; |
| 13585 |
function useFieldsetRootContext(optional = false) { |
| 13586 |
const context = React91.useContext(FieldsetRootContext); |
| 13587 |
if (!context && !optional) { |
| 13588 |
throw new Error(true ? "Base UI: FieldsetRootContext is missing. Fieldset parts must be placed within <Fieldset.Root>." : formatErrorMessage_default(86)); |
| 13589 |
} |
| 13590 |
return context; |
| 13591 |
} |
| 13592 |
|
| 13593 |
// node_modules/@base-ui/react/esm/internals/labelable-provider/LabelableProvider.js |
| 13594 |
var React92 = __toESM(require_react(), 1); |
| 13595 |
var import_jsx_runtime27 = __toESM(require_jsx_runtime(), 1); |
| 13596 |
var LabelableProvider = function LabelableProvider2(props) { |
| 13597 |
const defaultId = useBaseUiId(); |
| 13598 |
const initialControlId = props.controlId === void 0 ? defaultId : props.controlId; |
| 13599 |
const [controlId, setControlIdState] = React92.useState(initialControlId); |
| 13600 |
const [labelId, setLabelId] = React92.useState(props.labelId); |
| 13601 |
const [messageIds, setMessageIds] = React92.useState([]); |
| 13602 |
const registrationsRef = useRefWithInit(() => /* @__PURE__ */ new Map()); |
| 13603 |
const { |
| 13604 |
messageIds: parentMessageIds |
| 13605 |
} = useLabelableContext(); |
| 13606 |
const registerControlId = useStableCallback((source, nextId) => { |
| 13607 |
const registrations = registrationsRef.current; |
| 13608 |
if (nextId === void 0) { |
| 13609 |
registrations.delete(source); |
| 13610 |
return; |
| 13611 |
} |
| 13612 |
registrations.set(source, nextId); |
| 13613 |
setControlIdState((prev) => { |
| 13614 |
if (registrations.size === 0) { |
| 13615 |
return void 0; |
| 13616 |
} |
| 13617 |
let nextControlId; |
| 13618 |
for (const id of registrations.values()) { |
| 13619 |
if (prev !== void 0 && id === prev) { |
| 13620 |
return prev; |
| 13621 |
} |
| 13622 |
if (nextControlId === void 0) { |
| 13623 |
nextControlId = id; |
| 13624 |
} |
| 13625 |
} |
| 13626 |
return nextControlId; |
| 13627 |
}); |
| 13628 |
}); |
| 13629 |
const getDescriptionProps = React92.useCallback((externalProps) => { |
| 13630 |
return mergeProps({ |
| 13631 |
"aria-describedby": parentMessageIds.concat(messageIds).join(" ") || void 0 |
| 13632 |
}, externalProps); |
| 13633 |
}, [parentMessageIds, messageIds]); |
| 13634 |
const contextValue = React92.useMemo(() => ({ |
| 13635 |
controlId, |
| 13636 |
registerControlId, |
| 13637 |
labelId, |
| 13638 |
setLabelId, |
| 13639 |
messageIds, |
| 13640 |
setMessageIds, |
| 13641 |
getDescriptionProps |
| 13642 |
}), [controlId, registerControlId, labelId, setLabelId, messageIds, setMessageIds, getDescriptionProps]); |
| 13643 |
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(LabelableContext.Provider, { |
| 13644 |
value: contextValue, |
| 13645 |
children: props.children |
| 13646 |
}); |
| 13647 |
}; |
| 13648 |
if (true) LabelableProvider.displayName = "LabelableProvider"; |
| 13649 |
|
| 13650 |
// node_modules/@base-ui/react/esm/field/root/useFieldValidation.js |
| 13651 |
var React93 = __toESM(require_react(), 1); |
| 13652 |
|
| 13653 |
// node_modules/@base-ui/react/esm/field/utils/getCombinedFieldValidityData.js |
| 13654 |
function getCombinedFieldValidityData(validityData, invalid) { |
| 13655 |
return { |
| 13656 |
...validityData, |
| 13657 |
state: { |
| 13658 |
...validityData.state, |
| 13659 |
valid: !invalid && validityData.state.valid |
| 13660 |
} |
| 13661 |
}; |
| 13662 |
} |
| 13663 |
|
| 13664 |
// node_modules/@base-ui/react/esm/field/root/useFieldValidation.js |
| 13665 |
var validityKeys = Object.keys(DEFAULT_VALIDITY_STATE); |
| 13666 |
function isOnlyValueMissing(state) { |
| 13667 |
if (!state || state.valid || !state.valueMissing) { |
| 13668 |
return false; |
| 13669 |
} |
| 13670 |
let onlyValueMissing = false; |
| 13671 |
for (const key of validityKeys) { |
| 13672 |
if (key === "valid") { |
| 13673 |
continue; |
| 13674 |
} |
| 13675 |
if (key === "valueMissing") { |
| 13676 |
onlyValueMissing = state[key]; |
| 13677 |
} |
| 13678 |
if (state[key]) { |
| 13679 |
onlyValueMissing = false; |
| 13680 |
} |
| 13681 |
} |
| 13682 |
return onlyValueMissing; |
| 13683 |
} |
| 13684 |
function useFieldValidation(params) { |
| 13685 |
const { |
| 13686 |
formRef, |
| 13687 |
clearErrors |
| 13688 |
} = useFormContext(); |
| 13689 |
const { |
| 13690 |
setValidityData, |
| 13691 |
validate, |
| 13692 |
validityData, |
| 13693 |
validationDebounceTime, |
| 13694 |
invalid, |
| 13695 |
markedDirtyRef, |
| 13696 |
state, |
| 13697 |
name, |
| 13698 |
shouldValidateOnChange, |
| 13699 |
getRegisteredFieldId |
| 13700 |
} = params; |
| 13701 |
const { |
| 13702 |
controlId, |
| 13703 |
getDescriptionProps |
| 13704 |
} = useLabelableContext(); |
| 13705 |
const timeout = useTimeout(); |
| 13706 |
const inputRef = React93.useRef(null); |
| 13707 |
const commit = useStableCallback(async (value, revalidate = false) => { |
| 13708 |
const element = inputRef.current; |
| 13709 |
if (!element) { |
| 13710 |
return; |
| 13711 |
} |
| 13712 |
function updateRegisteredFieldValidity(nextValidityData2, externalInvalid = invalid) { |
| 13713 |
const fieldId = getRegisteredFieldId() ?? controlId; |
| 13714 |
if (fieldId == null) { |
| 13715 |
return; |
| 13716 |
} |
| 13717 |
const currentFieldData = formRef.current.fields.get(fieldId); |
| 13718 |
if (!currentFieldData) { |
| 13719 |
return; |
| 13720 |
} |
| 13721 |
const validityDataWithFormErrors = getCombinedFieldValidityData(nextValidityData2, externalInvalid); |
| 13722 |
formRef.current.fields.set(fieldId, { |
| 13723 |
...currentFieldData, |
| 13724 |
validityData: validityDataWithFormErrors |
| 13725 |
}); |
| 13726 |
} |
| 13727 |
if (revalidate) { |
| 13728 |
if (state.valid !== false) { |
| 13729 |
return; |
| 13730 |
} |
| 13731 |
const currentNativeValidity = element.validity; |
| 13732 |
if (!currentNativeValidity.valueMissing) { |
| 13733 |
const nextValidityData2 = { |
| 13734 |
value, |
| 13735 |
state: { |
| 13736 |
...DEFAULT_VALIDITY_STATE, |
| 13737 |
valid: true |
| 13738 |
}, |
| 13739 |
error: "", |
| 13740 |
errors: [], |
| 13741 |
initialValue: validityData.initialValue |
| 13742 |
}; |
| 13743 |
element.setCustomValidity(""); |
| 13744 |
updateRegisteredFieldValidity(nextValidityData2, false); |
| 13745 |
setValidityData(nextValidityData2); |
| 13746 |
return; |
| 13747 |
} |
| 13748 |
const currentNativeValidityObject = validityKeys.reduce((acc, key) => { |
| 13749 |
acc[key] = currentNativeValidity[key]; |
| 13750 |
return acc; |
| 13751 |
}, {}); |
| 13752 |
if (!currentNativeValidityObject.valid && !isOnlyValueMissing(currentNativeValidityObject)) { |
| 13753 |
return; |
| 13754 |
} |
| 13755 |
} |
| 13756 |
function getState(el) { |
| 13757 |
const computedState = validityKeys.reduce((acc, key) => { |
| 13758 |
acc[key] = el.validity[key]; |
| 13759 |
return acc; |
| 13760 |
}, {}); |
| 13761 |
let hasOnlyValueMissingError = false; |
| 13762 |
for (const key of validityKeys) { |
| 13763 |
if (key === "valid") { |
| 13764 |
continue; |
| 13765 |
} |
| 13766 |
if (key === "valueMissing" && computedState[key]) { |
| 13767 |
hasOnlyValueMissingError = true; |
| 13768 |
} else if (computedState[key]) { |
| 13769 |
return computedState; |
| 13770 |
} |
| 13771 |
} |
| 13772 |
if (hasOnlyValueMissingError && !markedDirtyRef.current) { |
| 13773 |
computedState.valid = true; |
| 13774 |
computedState.valueMissing = false; |
| 13775 |
} |
| 13776 |
return computedState; |
| 13777 |
} |
| 13778 |
timeout.clear(); |
| 13779 |
let result = null; |
| 13780 |
let validationErrors = []; |
| 13781 |
const nextState = getState(element); |
| 13782 |
let defaultValidationMessage; |
| 13783 |
const validateOnChange = shouldValidateOnChange(); |
| 13784 |
if (element.validationMessage && !validateOnChange) { |
| 13785 |
defaultValidationMessage = element.validationMessage; |
| 13786 |
validationErrors = [element.validationMessage]; |
| 13787 |
} else { |
| 13788 |
const formValues = Array.from(formRef.current.fields.values()).reduce((acc, field) => { |
| 13789 |
if (field.name) { |
| 13790 |
acc[field.name] = field.getValue(); |
| 13791 |
} |
| 13792 |
return acc; |
| 13793 |
}, {}); |
| 13794 |
const resultOrPromise = validate(value, formValues); |
| 13795 |
if (typeof resultOrPromise === "object" && resultOrPromise !== null && "then" in resultOrPromise) { |
| 13796 |
result = await resultOrPromise; |
| 13797 |
} else { |
| 13798 |
result = resultOrPromise; |
| 13799 |
} |
| 13800 |
if (result !== null) { |
| 13801 |
nextState.valid = false; |
| 13802 |
nextState.customError = true; |
| 13803 |
if (Array.isArray(result)) { |
| 13804 |
validationErrors = result; |
| 13805 |
element.setCustomValidity(result.join("\n")); |
| 13806 |
} else if (result) { |
| 13807 |
validationErrors = [result]; |
| 13808 |
element.setCustomValidity(result); |
| 13809 |
} |
| 13810 |
} else if (validateOnChange) { |
| 13811 |
element.setCustomValidity(""); |
| 13812 |
nextState.customError = false; |
| 13813 |
if (element.validationMessage) { |
| 13814 |
defaultValidationMessage = element.validationMessage; |
| 13815 |
validationErrors = [element.validationMessage]; |
| 13816 |
} else if (element.validity.valid && !nextState.valid) { |
| 13817 |
nextState.valid = true; |
| 13818 |
} |
| 13819 |
} |
| 13820 |
} |
| 13821 |
const nextValidityData = { |
| 13822 |
value, |
| 13823 |
state: nextState, |
| 13824 |
error: defaultValidationMessage ?? (Array.isArray(result) ? result[0] : result ?? ""), |
| 13825 |
errors: validationErrors, |
| 13826 |
initialValue: validityData.initialValue |
| 13827 |
}; |
| 13828 |
updateRegisteredFieldValidity(nextValidityData); |
| 13829 |
setValidityData(nextValidityData); |
| 13830 |
}); |
| 13831 |
const getValidationProps = React93.useCallback((externalProps = {}) => mergeProps(getDescriptionProps, state.valid === false ? { |
| 13832 |
"aria-invalid": true |
| 13833 |
} : EMPTY_OBJECT, externalProps), [getDescriptionProps, state.valid]); |
| 13834 |
const getInputValidationProps = React93.useCallback((externalProps = {}) => mergeProps({ |
| 13835 |
onChange(event) { |
| 13836 |
if (event.nativeEvent.defaultPrevented) { |
| 13837 |
return; |
| 13838 |
} |
| 13839 |
clearErrors(name); |
| 13840 |
if (!shouldValidateOnChange()) { |
| 13841 |
commit(event.currentTarget.value, true); |
| 13842 |
return; |
| 13843 |
} |
| 13844 |
const element = event.currentTarget; |
| 13845 |
if (element.value === "") { |
| 13846 |
commit(element.value); |
| 13847 |
return; |
| 13848 |
} |
| 13849 |
timeout.clear(); |
| 13850 |
if (validationDebounceTime) { |
| 13851 |
timeout.start(validationDebounceTime, () => { |
| 13852 |
commit(element.value); |
| 13853 |
}); |
| 13854 |
} else { |
| 13855 |
commit(element.value); |
| 13856 |
} |
| 13857 |
} |
| 13858 |
}, getValidationProps(externalProps)), [getValidationProps, clearErrors, name, timeout, commit, validationDebounceTime, shouldValidateOnChange]); |
| 13859 |
return React93.useMemo(() => ({ |
| 13860 |
getValidationProps, |
| 13861 |
getInputValidationProps, |
| 13862 |
inputRef, |
| 13863 |
commit |
| 13864 |
}), [getValidationProps, getInputValidationProps, commit]); |
| 13865 |
} |
| 13866 |
|
| 13867 |
// node_modules/@base-ui/react/esm/internals/field-register-control/useFieldControlRegistration.js |
| 13868 |
var React94 = __toESM(require_react(), 1); |
| 13869 |
function useFieldControlRegistration(params) { |
| 13870 |
const { |
| 13871 |
commit, |
| 13872 |
invalid, |
| 13873 |
markedDirtyRef, |
| 13874 |
name, |
| 13875 |
setRegisteredFieldId, |
| 13876 |
setValidityData, |
| 13877 |
validityData |
| 13878 |
} = params; |
| 13879 |
const { |
| 13880 |
formRef |
| 13881 |
} = useFormContext(); |
| 13882 |
const activeFieldControlSourceRef = React94.useRef(null); |
| 13883 |
const registrationRef = React94.useRef(null); |
| 13884 |
const fallbackControlRef = React94.useRef(null); |
| 13885 |
const getValueForForm = useStableCallback(() => { |
| 13886 |
const registration = registrationRef.current; |
| 13887 |
if (!registration) { |
| 13888 |
return void 0; |
| 13889 |
} |
| 13890 |
if (registration.getValue) { |
| 13891 |
return registration.getValue(); |
| 13892 |
} |
| 13893 |
return registration.value; |
| 13894 |
}); |
| 13895 |
const validate = useStableCallback(() => { |
| 13896 |
const registration = registrationRef.current; |
| 13897 |
if (!registration) { |
| 13898 |
return; |
| 13899 |
} |
| 13900 |
let nextValue = registration.value; |
| 13901 |
if (nextValue === void 0) { |
| 13902 |
nextValue = getValueForForm(); |
| 13903 |
} |
| 13904 |
markedDirtyRef.current = true; |
| 13905 |
commit(nextValue); |
| 13906 |
}); |
| 13907 |
function refreshRegistration() { |
| 13908 |
const registration = registrationRef.current; |
| 13909 |
if (!registration || !registration.id) { |
| 13910 |
return; |
| 13911 |
} |
| 13912 |
formRef.current.fields.set(registration.id, { |
| 13913 |
getValue: getValueForForm, |
| 13914 |
name, |
| 13915 |
controlRef: registration.controlRef ?? fallbackControlRef, |
| 13916 |
validityData: getCombinedFieldValidityData(validityData, invalid), |
| 13917 |
validate |
| 13918 |
}); |
| 13919 |
} |
| 13920 |
function deleteRegistration(id = registrationRef.current?.id) { |
| 13921 |
if (id) { |
| 13922 |
formRef.current.fields.delete(id); |
| 13923 |
} |
| 13924 |
} |
| 13925 |
function syncInitialValue() { |
| 13926 |
const registration = registrationRef.current; |
| 13927 |
if (!registration) { |
| 13928 |
return; |
| 13929 |
} |
| 13930 |
let initialValue = registration.value; |
| 13931 |
if (initialValue === void 0) { |
| 13932 |
initialValue = getValueForForm(); |
| 13933 |
} |
| 13934 |
if (validityData.initialValue === null && initialValue !== null) { |
| 13935 |
setValidityData((prev) => ({ |
| 13936 |
...prev, |
| 13937 |
initialValue |
| 13938 |
})); |
| 13939 |
} |
| 13940 |
} |
| 13941 |
useIsoLayoutEffect(() => { |
| 13942 |
const registration = registrationRef.current; |
| 13943 |
if (!registration || !registration.id) { |
| 13944 |
return; |
| 13945 |
} |
| 13946 |
formRef.current.fields.set(registration.id, { |
| 13947 |
getValue: getValueForForm, |
| 13948 |
name, |
| 13949 |
controlRef: registration.controlRef ?? fallbackControlRef, |
| 13950 |
validityData: getCombinedFieldValidityData(validityData, invalid), |
| 13951 |
validate |
| 13952 |
}); |
| 13953 |
}, [formRef, getValueForForm, invalid, name, validate, validityData]); |
| 13954 |
useIsoLayoutEffect(() => { |
| 13955 |
const fields = formRef.current.fields; |
| 13956 |
return () => { |
| 13957 |
const id = registrationRef.current?.id; |
| 13958 |
if (id) { |
| 13959 |
fields.delete(id); |
| 13960 |
} |
| 13961 |
}; |
| 13962 |
}, [formRef]); |
| 13963 |
return useStableCallback((source, registration) => { |
| 13964 |
if (!registration) { |
| 13965 |
if (activeFieldControlSourceRef.current === source) { |
| 13966 |
activeFieldControlSourceRef.current = null; |
| 13967 |
deleteRegistration(); |
| 13968 |
registrationRef.current = null; |
| 13969 |
setRegisteredFieldId(void 0); |
| 13970 |
} |
| 13971 |
return; |
| 13972 |
} |
| 13973 |
const previousId = registrationRef.current?.id; |
| 13974 |
activeFieldControlSourceRef.current = source; |
| 13975 |
registrationRef.current = registration; |
| 13976 |
setRegisteredFieldId(registration.id); |
| 13977 |
if (previousId && previousId !== registration.id) { |
| 13978 |
deleteRegistration(previousId); |
| 13979 |
} |
| 13980 |
syncInitialValue(); |
| 13981 |
refreshRegistration(); |
| 13982 |
}); |
| 13983 |
} |
| 13984 |
|
| 13985 |
// node_modules/@base-ui/react/esm/field/root/FieldRoot.js |
| 13986 |
var import_jsx_runtime28 = __toESM(require_jsx_runtime(), 1); |
| 13987 |
var FieldRootInner = /* @__PURE__ */ React95.forwardRef(function FieldRootInner2(componentProps, forwardedRef) { |
| 13988 |
const { |
| 13989 |
errors, |
| 13990 |
validationMode: formValidationMode, |
| 13991 |
submitAttemptedRef |
| 13992 |
} = useFormContext(); |
| 13993 |
const { |
| 13994 |
render, |
| 13995 |
className, |
| 13996 |
validate: validateProp, |
| 13997 |
validationDebounceTime = 0, |
| 13998 |
validationMode = formValidationMode, |
| 13999 |
name, |
| 14000 |
disabled: disabledProp = false, |
| 14001 |
invalid: invalidProp, |
| 14002 |
dirty: dirtyProp, |
| 14003 |
touched: touchedProp, |
| 14004 |
actionsRef, |
| 14005 |
style, |
| 14006 |
...elementProps |
| 14007 |
} = componentProps; |
| 14008 |
const { |
| 14009 |
disabled: disabledFieldset |
| 14010 |
} = useFieldsetRootContext(); |
| 14011 |
const validate = useStableCallback(validateProp || (() => null)); |
| 14012 |
const disabled2 = disabledFieldset || disabledProp; |
| 14013 |
const [touchedState, setTouchedUnwrapped] = React95.useState(false); |
| 14014 |
const [dirtyState, setDirtyUnwrapped] = React95.useState(false); |
| 14015 |
const [filled, setFilled] = React95.useState(false); |
| 14016 |
const [focused, setFocused] = React95.useState(false); |
| 14017 |
const dirty = dirtyProp ?? dirtyState; |
| 14018 |
const touched = touchedProp ?? touchedState; |
| 14019 |
const markedDirtyRef = React95.useRef(false); |
| 14020 |
const registeredFieldIdRef = React95.useRef(void 0); |
| 14021 |
const getRegisteredFieldId = React95.useCallback(() => registeredFieldIdRef.current, []); |
| 14022 |
const setRegisteredFieldId = React95.useCallback((id) => { |
| 14023 |
registeredFieldIdRef.current = id; |
| 14024 |
}, []); |
| 14025 |
const setDirty = useStableCallback((value) => { |
| 14026 |
if (dirtyProp !== void 0) { |
| 14027 |
return; |
| 14028 |
} |
| 14029 |
if (value) { |
| 14030 |
markedDirtyRef.current = true; |
| 14031 |
} |
| 14032 |
setDirtyUnwrapped(value); |
| 14033 |
}); |
| 14034 |
const setTouched = useStableCallback((value) => { |
| 14035 |
if (touchedProp !== void 0) { |
| 14036 |
return; |
| 14037 |
} |
| 14038 |
setTouchedUnwrapped(value); |
| 14039 |
}); |
| 14040 |
const shouldValidateOnChange = useStableCallback(() => validationMode === "onChange" || validationMode === "onSubmit" && submitAttemptedRef.current); |
| 14041 |
const hasFormError = !!name && Object.hasOwn(errors, name) && errors[name] !== void 0; |
| 14042 |
const invalid = invalidProp === true || hasFormError; |
| 14043 |
const [validityData, setValidityData] = React95.useState({ |
| 14044 |
state: DEFAULT_VALIDITY_STATE, |
| 14045 |
error: "", |
| 14046 |
errors: [], |
| 14047 |
value: null, |
| 14048 |
initialValue: null |
| 14049 |
}); |
| 14050 |
const valid = !invalid && validityData.state.valid; |
| 14051 |
const state = React95.useMemo(() => ({ |
| 14052 |
disabled: disabled2, |
| 14053 |
touched, |
| 14054 |
dirty, |
| 14055 |
valid, |
| 14056 |
filled, |
| 14057 |
focused |
| 14058 |
}), [disabled2, touched, dirty, valid, filled, focused]); |
| 14059 |
const validation = useFieldValidation({ |
| 14060 |
setValidityData, |
| 14061 |
validate, |
| 14062 |
validityData, |
| 14063 |
validationDebounceTime, |
| 14064 |
invalid, |
| 14065 |
markedDirtyRef, |
| 14066 |
state, |
| 14067 |
name, |
| 14068 |
shouldValidateOnChange, |
| 14069 |
getRegisteredFieldId |
| 14070 |
}); |
| 14071 |
const validityValue = validityData.value; |
| 14072 |
const handleImperativeValidate = React95.useCallback(() => { |
| 14073 |
markedDirtyRef.current = true; |
| 14074 |
validation.commit(validityValue); |
| 14075 |
}, [validation, validityValue]); |
| 14076 |
const registerFieldControl = useFieldControlRegistration({ |
| 14077 |
commit: validation.commit, |
| 14078 |
invalid, |
| 14079 |
markedDirtyRef, |
| 14080 |
name, |
| 14081 |
setRegisteredFieldId, |
| 14082 |
setValidityData, |
| 14083 |
validityData |
| 14084 |
}); |
| 14085 |
React95.useImperativeHandle(actionsRef, () => ({ |
| 14086 |
validate: handleImperativeValidate |
| 14087 |
}), [handleImperativeValidate]); |
| 14088 |
const contextValue = React95.useMemo(() => ({ |
| 14089 |
invalid, |
| 14090 |
name, |
| 14091 |
validityData, |
| 14092 |
setValidityData, |
| 14093 |
disabled: disabled2, |
| 14094 |
touched, |
| 14095 |
setTouched, |
| 14096 |
dirty, |
| 14097 |
setDirty, |
| 14098 |
filled, |
| 14099 |
setFilled, |
| 14100 |
focused, |
| 14101 |
setFocused, |
| 14102 |
validate, |
| 14103 |
validationMode, |
| 14104 |
validationDebounceTime, |
| 14105 |
shouldValidateOnChange, |
| 14106 |
state, |
| 14107 |
markedDirtyRef, |
| 14108 |
registerFieldControl, |
| 14109 |
validation |
| 14110 |
}), [invalid, name, validityData, disabled2, touched, setTouched, dirty, setDirty, filled, setFilled, focused, setFocused, validate, validationMode, validationDebounceTime, shouldValidateOnChange, state, registerFieldControl, validation]); |
| 14111 |
const element = useRenderElement("div", componentProps, { |
| 14112 |
ref: forwardedRef, |
| 14113 |
state, |
| 14114 |
props: elementProps, |
| 14115 |
stateAttributesMapping: fieldValidityMapping |
| 14116 |
}); |
| 14117 |
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(FieldRootContext.Provider, { |
| 14118 |
value: contextValue, |
| 14119 |
children: element |
| 14120 |
}); |
| 14121 |
}); |
| 14122 |
if (true) FieldRootInner.displayName = "FieldRootInner"; |
| 14123 |
var FieldRoot = /* @__PURE__ */ React95.forwardRef(function FieldRoot2(componentProps, forwardedRef) { |
| 14124 |
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(LabelableProvider, { |
| 14125 |
children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(FieldRootInner, { |
| 14126 |
...componentProps, |
| 14127 |
ref: forwardedRef |
| 14128 |
}) |
| 14129 |
}); |
| 14130 |
}); |
| 14131 |
if (true) FieldRoot.displayName = "FieldRoot"; |
| 14132 |
|
| 14133 |
// node_modules/@base-ui/react/esm/field/label/FieldLabel.js |
| 14134 |
var React96 = __toESM(require_react(), 1); |
| 14135 |
var FieldLabel = /* @__PURE__ */ React96.forwardRef(function FieldLabel2(componentProps, forwardedRef) { |
| 14136 |
const { |
| 14137 |
render, |
| 14138 |
className, |
| 14139 |
style, |
| 14140 |
id: idProp, |
| 14141 |
nativeLabel = true, |
| 14142 |
...elementProps |
| 14143 |
} = componentProps; |
| 14144 |
const fieldRootContext = useFieldRootContext(false); |
| 14145 |
const { |
| 14146 |
labelId |
| 14147 |
} = useLabelableContext(); |
| 14148 |
const labelRef = React96.useRef(null); |
| 14149 |
const labelProps = useLabel({ |
| 14150 |
id: labelId ?? idProp, |
| 14151 |
native: nativeLabel |
| 14152 |
}); |
| 14153 |
if (true) { |
| 14154 |
React96.useEffect(() => { |
| 14155 |
if (!labelRef.current) { |
| 14156 |
return; |
| 14157 |
} |
| 14158 |
const isLabelTag = labelRef.current.tagName === "LABEL"; |
| 14159 |
if (nativeLabel) { |
| 14160 |
if (!isLabelTag) { |
| 14161 |
const ownerStackMessage = SafeReact.captureOwnerStack?.() || ""; |
| 14162 |
const message = "<Field.Label> expected a <label> element because the `nativeLabel` prop is true. Rendering a non-<label> disables native label association, so `htmlFor` will not work. Use a real <label> in the `render` prop, or set `nativeLabel` to `false`."; |
| 14163 |
error(`${message}${ownerStackMessage}`); |
| 14164 |
} |
| 14165 |
} else if (isLabelTag) { |
| 14166 |
const ownerStackMessage = SafeReact.captureOwnerStack?.() || ""; |
| 14167 |
const message = "<Field.Label> expected a non-<label> element because the `nativeLabel` prop is false. Rendering a <label> assumes native label behavior while Base UI treats it as non-native, which can cause unexpected pointer behavior. Use a non-<label> in the `render` prop, or set `nativeLabel` to `true`."; |
| 14168 |
error(`${message}${ownerStackMessage}`); |
| 14169 |
} |
| 14170 |
}, [nativeLabel]); |
| 14171 |
} |
| 14172 |
const element = useRenderElement("label", componentProps, { |
| 14173 |
ref: [forwardedRef, labelRef], |
| 14174 |
state: fieldRootContext.state, |
| 14175 |
props: [labelProps, elementProps], |
| 14176 |
stateAttributesMapping: fieldValidityMapping |
| 14177 |
}); |
| 14178 |
return element; |
| 14179 |
}); |
| 14180 |
if (true) FieldLabel.displayName = "FieldLabel"; |
| 14181 |
|
| 14182 |
// node_modules/@base-ui/react/esm/field/error/FieldError.js |
| 14183 |
var React97 = __toESM(require_react(), 1); |
| 14184 |
var import_jsx_runtime29 = __toESM(require_jsx_runtime(), 1); |
| 14185 |
var stateAttributesMapping4 = { |
| 14186 |
...fieldValidityMapping, |
| 14187 |
...transitionStatusMapping |
| 14188 |
}; |
| 14189 |
var FieldError = /* @__PURE__ */ React97.forwardRef(function FieldError2(componentProps, forwardedRef) { |
| 14190 |
const { |
| 14191 |
render, |
| 14192 |
id: idProp, |
| 14193 |
className, |
| 14194 |
match, |
| 14195 |
style, |
| 14196 |
...elementProps |
| 14197 |
} = componentProps; |
| 14198 |
const id = useBaseUiId(idProp); |
| 14199 |
const { |
| 14200 |
validityData, |
| 14201 |
state: fieldState, |
| 14202 |
name |
| 14203 |
} = useFieldRootContext(false); |
| 14204 |
const { |
| 14205 |
setMessageIds |
| 14206 |
} = useLabelableContext(); |
| 14207 |
const { |
| 14208 |
errors |
| 14209 |
} = useFormContext(); |
| 14210 |
const formError = name ? errors[name] : null; |
| 14211 |
const hasSpecificMatch = typeof match === "string"; |
| 14212 |
let rendered = false; |
| 14213 |
if (match === true) { |
| 14214 |
rendered = true; |
| 14215 |
} else if (hasSpecificMatch) { |
| 14216 |
rendered = Boolean(validityData.state[match]); |
| 14217 |
} else { |
| 14218 |
rendered = Boolean(formError) || validityData.state.valid === false; |
| 14219 |
} |
| 14220 |
const { |
| 14221 |
mounted, |
| 14222 |
transitionStatus, |
| 14223 |
setMounted |
| 14224 |
} = useTransitionStatus(rendered); |
| 14225 |
useIsoLayoutEffect(() => { |
| 14226 |
if (!rendered || !id) { |
| 14227 |
return void 0; |
| 14228 |
} |
| 14229 |
setMessageIds((v) => v.concat(id)); |
| 14230 |
return () => { |
| 14231 |
setMessageIds((v) => v.filter((item) => item !== id)); |
| 14232 |
}; |
| 14233 |
}, [rendered, id, setMessageIds]); |
| 14234 |
const errorRef = React97.useRef(null); |
| 14235 |
const [lastRenderedMessage, setLastRenderedMessage] = React97.useState(null); |
| 14236 |
const [lastRenderedMessageKey, setLastRenderedMessageKey] = React97.useState(null); |
| 14237 |
const clientErrorMessage = validityData.errors.length > 1 ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("ul", { |
| 14238 |
children: validityData.errors.map((message) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("li", { |
| 14239 |
children: message |
| 14240 |
}, message)) |
| 14241 |
}) : validityData.error; |
| 14242 |
const errorMessage = hasSpecificMatch ? clientErrorMessage : formError || clientErrorMessage; |
| 14243 |
let errorKey = validityData.error; |
| 14244 |
if (formError != null) { |
| 14245 |
errorKey = Array.isArray(formError) ? JSON.stringify(formError) : formError; |
| 14246 |
} else if (validityData.errors.length > 1) { |
| 14247 |
errorKey = JSON.stringify(validityData.errors); |
| 14248 |
} |
| 14249 |
if (rendered && errorKey !== lastRenderedMessageKey) { |
| 14250 |
setLastRenderedMessageKey(errorKey); |
| 14251 |
setLastRenderedMessage(errorMessage); |
| 14252 |
} |
| 14253 |
useOpenChangeComplete({ |
| 14254 |
open: rendered, |
| 14255 |
ref: errorRef, |
| 14256 |
onComplete() { |
| 14257 |
if (!rendered) { |
| 14258 |
setMounted(false); |
| 14259 |
} |
| 14260 |
} |
| 14261 |
}); |
| 14262 |
const state = { |
| 14263 |
...fieldState, |
| 14264 |
transitionStatus |
| 14265 |
}; |
| 14266 |
const element = useRenderElement("div", componentProps, { |
| 14267 |
ref: [forwardedRef, errorRef], |
| 14268 |
state, |
| 14269 |
props: [{ |
| 14270 |
id, |
| 14271 |
children: rendered ? errorMessage : lastRenderedMessage |
| 14272 |
}, elementProps], |
| 14273 |
stateAttributesMapping: stateAttributesMapping4, |
| 14274 |
enabled: mounted |
| 14275 |
}); |
| 14276 |
if (!mounted) { |
| 14277 |
return null; |
| 14278 |
} |
| 14279 |
return element; |
| 14280 |
}); |
| 14281 |
if (true) FieldError.displayName = "FieldError"; |
| 14282 |
|
| 14283 |
// node_modules/@base-ui/react/esm/field/description/FieldDescription.js |
| 14284 |
var React98 = __toESM(require_react(), 1); |
| 14285 |
var FieldDescription = /* @__PURE__ */ React98.forwardRef(function FieldDescription2(componentProps, forwardedRef) { |
| 14286 |
const { |
| 14287 |
render, |
| 14288 |
id: idProp, |
| 14289 |
className, |
| 14290 |
style, |
| 14291 |
...elementProps |
| 14292 |
} = componentProps; |
| 14293 |
const id = useBaseUiId(idProp); |
| 14294 |
const fieldRootContext = useFieldRootContext(false); |
| 14295 |
const { |
| 14296 |
setMessageIds |
| 14297 |
} = useLabelableContext(); |
| 14298 |
useIsoLayoutEffect(() => { |
| 14299 |
if (!id) { |
| 14300 |
return void 0; |
| 14301 |
} |
| 14302 |
setMessageIds((v) => v.concat(id)); |
| 14303 |
return () => { |
| 14304 |
setMessageIds((v) => v.filter((item) => item !== id)); |
| 14305 |
}; |
| 14306 |
}, [id, setMessageIds]); |
| 14307 |
const element = useRenderElement("p", componentProps, { |
| 14308 |
ref: forwardedRef, |
| 14309 |
state: fieldRootContext.state, |
| 14310 |
props: [{ |
| 14311 |
id |
| 14312 |
}, elementProps], |
| 14313 |
stateAttributesMapping: fieldValidityMapping |
| 14314 |
}); |
| 14315 |
return element; |
| 14316 |
}); |
| 14317 |
if (true) FieldDescription.displayName = "FieldDescription"; |
| 14318 |
|
| 14319 |
// node_modules/@base-ui/react/esm/field/control/FieldControl.js |
| 14320 |
var React99 = __toESM(require_react(), 1); |
| 14321 |
var FieldControl = /* @__PURE__ */ React99.forwardRef(function FieldControl2(componentProps, forwardedRef) { |
| 14322 |
const { |
| 14323 |
render, |
| 14324 |
className, |
| 14325 |
id: idProp, |
| 14326 |
name: nameProp, |
| 14327 |
value: valueProp, |
| 14328 |
disabled: disabledProp = false, |
| 14329 |
onValueChange, |
| 14330 |
defaultValue, |
| 14331 |
autoFocus = false, |
| 14332 |
style, |
| 14333 |
...elementProps |
| 14334 |
} = componentProps; |
| 14335 |
const { |
| 14336 |
state: fieldState, |
| 14337 |
name: fieldName, |
| 14338 |
disabled: fieldDisabled, |
| 14339 |
setTouched, |
| 14340 |
setDirty, |
| 14341 |
validityData, |
| 14342 |
setFocused, |
| 14343 |
setFilled, |
| 14344 |
validationMode, |
| 14345 |
validation |
| 14346 |
} = useFieldRootContext(); |
| 14347 |
const disabled2 = fieldDisabled || disabledProp; |
| 14348 |
const name = fieldName ?? nameProp; |
| 14349 |
const state = { |
| 14350 |
...fieldState, |
| 14351 |
disabled: disabled2 |
| 14352 |
}; |
| 14353 |
const { |
| 14354 |
labelId |
| 14355 |
} = useLabelableContext(); |
| 14356 |
const id = useLabelableId({ |
| 14357 |
id: idProp |
| 14358 |
}); |
| 14359 |
useIsoLayoutEffect(() => { |
| 14360 |
const hasExternalValue = valueProp != null; |
| 14361 |
if (validation.inputRef.current?.value || hasExternalValue && valueProp !== "") { |
| 14362 |
setFilled(true); |
| 14363 |
} else if (hasExternalValue && valueProp === "") { |
| 14364 |
setFilled(false); |
| 14365 |
} |
| 14366 |
}, [validation.inputRef, setFilled, valueProp]); |
| 14367 |
const inputRef = React99.useRef(null); |
| 14368 |
useIsoLayoutEffect(() => { |
| 14369 |
if (autoFocus && inputRef.current === activeElement(ownerDocument(inputRef.current))) { |
| 14370 |
setFocused(true); |
| 14371 |
} |
| 14372 |
}, [autoFocus, setFocused]); |
| 14373 |
const [valueUnwrapped] = useControlled({ |
| 14374 |
controlled: valueProp, |
| 14375 |
default: defaultValue, |
| 14376 |
name: "FieldControl", |
| 14377 |
state: "value" |
| 14378 |
}); |
| 14379 |
const isControlled = valueProp !== void 0; |
| 14380 |
const value = isControlled ? valueUnwrapped : void 0; |
| 14381 |
const getValueFromInput = useStableCallback(() => validation.inputRef.current?.value); |
| 14382 |
useRegisterFieldControl(validation.inputRef, id, value, getValueFromInput); |
| 14383 |
const element = useRenderElement("input", componentProps, { |
| 14384 |
ref: [forwardedRef, inputRef], |
| 14385 |
state, |
| 14386 |
props: [{ |
| 14387 |
id, |
| 14388 |
disabled: disabled2, |
| 14389 |
name, |
| 14390 |
ref: validation.inputRef, |
| 14391 |
"aria-labelledby": labelId, |
| 14392 |
autoFocus, |
| 14393 |
...isControlled ? { |
| 14394 |
value |
| 14395 |
} : { |
| 14396 |
defaultValue |
| 14397 |
}, |
| 14398 |
onChange(event) { |
| 14399 |
const inputValue = event.currentTarget.value; |
| 14400 |
onValueChange?.(inputValue, createChangeEventDetails(reason_parts_exports.none, event.nativeEvent)); |
| 14401 |
setDirty(inputValue !== validityData.initialValue); |
| 14402 |
setFilled(inputValue !== ""); |
| 14403 |
}, |
| 14404 |
onFocus() { |
| 14405 |
setFocused(true); |
| 14406 |
}, |
| 14407 |
onBlur(event) { |
| 14408 |
setTouched(true); |
| 14409 |
setFocused(false); |
| 14410 |
if (validationMode === "onBlur") { |
| 14411 |
validation.commit(event.currentTarget.value); |
| 14412 |
} |
| 14413 |
}, |
| 14414 |
onKeyDown(event) { |
| 14415 |
if (event.currentTarget.tagName === "INPUT" && event.key === "Enter") { |
| 14416 |
setTouched(true); |
| 14417 |
validation.commit(event.currentTarget.value); |
| 14418 |
} |
| 14419 |
} |
| 14420 |
}, validation.getInputValidationProps(), elementProps], |
| 14421 |
stateAttributesMapping: fieldValidityMapping |
| 14422 |
}); |
| 14423 |
return element; |
| 14424 |
}); |
| 14425 |
if (true) FieldControl.displayName = "FieldControl"; |
| 14426 |
|
| 14427 |
// node_modules/@base-ui/react/esm/field/validity/FieldValidity.js |
| 14428 |
var React100 = __toESM(require_react(), 1); |
| 14429 |
var import_jsx_runtime30 = __toESM(require_jsx_runtime(), 1); |
| 14430 |
var FieldValidity = function FieldValidity2(props) { |
| 14431 |
const { |
| 14432 |
children |
| 14433 |
} = props; |
| 14434 |
const { |
| 14435 |
validityData, |
| 14436 |
invalid |
| 14437 |
} = useFieldRootContext(false); |
| 14438 |
const combinedFieldValidityData = React100.useMemo(() => getCombinedFieldValidityData(validityData, invalid), [validityData, invalid]); |
| 14439 |
const isInvalid = combinedFieldValidityData.state.valid === false; |
| 14440 |
const { |
| 14441 |
transitionStatus |
| 14442 |
} = useTransitionStatus(isInvalid); |
| 14443 |
const fieldValidityState = React100.useMemo(() => { |
| 14444 |
return { |
| 14445 |
...combinedFieldValidityData, |
| 14446 |
validity: combinedFieldValidityData.state, |
| 14447 |
transitionStatus |
| 14448 |
}; |
| 14449 |
}, [combinedFieldValidityData, transitionStatus]); |
| 14450 |
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(React100.Fragment, { |
| 14451 |
children: children(fieldValidityState) |
| 14452 |
}); |
| 14453 |
}; |
| 14454 |
if (true) FieldValidity.displayName = "FieldValidity"; |
| 14455 |
|
| 14456 |
// node_modules/@base-ui/react/esm/field/item/FieldItem.js |
| 14457 |
var React101 = __toESM(require_react(), 1); |
| 14458 |
var import_jsx_runtime31 = __toESM(require_jsx_runtime(), 1); |
| 14459 |
var FieldItem = /* @__PURE__ */ React101.forwardRef(function FieldItem2(componentProps, forwardedRef) { |
| 14460 |
const { |
| 14461 |
render, |
| 14462 |
className, |
| 14463 |
style, |
| 14464 |
disabled: disabledProp = false, |
| 14465 |
...elementProps |
| 14466 |
} = componentProps; |
| 14467 |
const { |
| 14468 |
state, |
| 14469 |
disabled: rootDisabled |
| 14470 |
} = useFieldRootContext(false); |
| 14471 |
const disabled2 = rootDisabled || disabledProp; |
| 14472 |
const checkboxGroupContext = useCheckboxGroupContext(); |
| 14473 |
const hasParentCheckbox = checkboxGroupContext?.allValues !== void 0; |
| 14474 |
const controlId = hasParentCheckbox ? checkboxGroupContext?.parent.id : void 0; |
| 14475 |
const fieldItemContext = React101.useMemo(() => ({ |
| 14476 |
disabled: disabled2 |
| 14477 |
}), [disabled2]); |
| 14478 |
const element = useRenderElement("div", componentProps, { |
| 14479 |
ref: forwardedRef, |
| 14480 |
state, |
| 14481 |
props: elementProps, |
| 14482 |
stateAttributesMapping: fieldValidityMapping |
| 14483 |
}); |
| 14484 |
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(LabelableProvider, { |
| 14485 |
controlId, |
| 14486 |
children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(FieldItemContext.Provider, { |
| 14487 |
value: fieldItemContext, |
| 14488 |
children: element |
| 14489 |
}) |
| 14490 |
}); |
| 14491 |
}); |
| 14492 |
if (true) FieldItem.displayName = "FieldItem"; |
| 14493 |
|
| 14494 |
// node_modules/@base-ui/react/esm/input/Input.js |
| 14495 |
var React102 = __toESM(require_react(), 1); |
| 14496 |
var import_jsx_runtime32 = __toESM(require_jsx_runtime(), 1); |
| 14497 |
var Input = /* @__PURE__ */ React102.forwardRef(function Input2(props, forwardedRef) { |
| 14498 |
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(index_parts_exports2.Control, { |
| 14499 |
ref: forwardedRef, |
| 14500 |
...props |
| 14501 |
}); |
| 14502 |
}); |
| 14503 |
if (true) Input.displayName = "Input"; |
| 14504 |
|
| 14505 |
// node_modules/@base-ui/react/esm/utils/FloatingPortalLite.js |
| 14506 |
var React103 = __toESM(require_react(), 1); |
| 14507 |
var ReactDOM7 = __toESM(require_react_dom(), 1); |
| 14508 |
var import_jsx_runtime33 = __toESM(require_jsx_runtime(), 1); |
| 14509 |
var FloatingPortalLite = /* @__PURE__ */ React103.forwardRef(function FloatingPortalLite2(componentProps, forwardedRef) { |
| 14510 |
const { |
| 14511 |
children, |
| 14512 |
container, |
| 14513 |
className, |
| 14514 |
render, |
| 14515 |
style, |
| 14516 |
...elementProps |
| 14517 |
} = componentProps; |
| 14518 |
const { |
| 14519 |
portalNode, |
| 14520 |
portalSubtree |
| 14521 |
} = useFloatingPortalNode({ |
| 14522 |
container, |
| 14523 |
ref: forwardedRef, |
| 14524 |
componentProps, |
| 14525 |
elementProps |
| 14526 |
}); |
| 14527 |
if (!portalSubtree && !portalNode) { |
| 14528 |
return null; |
| 14529 |
} |
| 14530 |
return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(React103.Fragment, { |
| 14531 |
children: [portalSubtree, portalNode && /* @__PURE__ */ ReactDOM7.createPortal(children, portalNode)] |
| 14532 |
}); |
| 14533 |
}); |
| 14534 |
if (true) FloatingPortalLite.displayName = "FloatingPortalLite"; |
| 14535 |
|
| 14536 |
// node_modules/@base-ui/react/esm/tooltip/index.parts.js |
| 14537 |
var index_parts_exports3 = {}; |
| 14538 |
__export(index_parts_exports3, { |
| 14539 |
Arrow: () => TooltipArrow, |
| 14540 |
Handle: () => TooltipHandle, |
| 14541 |
Popup: () => TooltipPopup, |
| 14542 |
Portal: () => TooltipPortal, |
| 14543 |
Positioner: () => TooltipPositioner, |
| 14544 |
Provider: () => TooltipProvider, |
| 14545 |
Root: () => TooltipRoot, |
| 14546 |
Trigger: () => TooltipTrigger, |
| 14547 |
Viewport: () => TooltipViewport, |
| 14548 |
createHandle: () => createTooltipHandle |
| 14549 |
}); |
| 14550 |
|
| 14551 |
// node_modules/@base-ui/react/esm/tooltip/root/TooltipRoot.js |
| 14552 |
var React106 = __toESM(require_react(), 1); |
| 14553 |
|
| 14554 |
// node_modules/@base-ui/react/esm/tooltip/root/TooltipRootContext.js |
| 14555 |
var React104 = __toESM(require_react(), 1); |
| 14556 |
var TooltipRootContext = /* @__PURE__ */ React104.createContext(void 0); |
| 14557 |
if (true) TooltipRootContext.displayName = "TooltipRootContext"; |
| 14558 |
function useTooltipRootContext(optional) { |
| 14559 |
const context = React104.useContext(TooltipRootContext); |
| 14560 |
if (context === void 0 && !optional) { |
| 14561 |
throw new Error(true ? "Base UI: TooltipRootContext is missing. Tooltip parts must be placed within <Tooltip.Root>." : formatErrorMessage_default(72)); |
| 14562 |
} |
| 14563 |
return context; |
| 14564 |
} |
| 14565 |
|
| 14566 |
// node_modules/@base-ui/react/esm/tooltip/store/TooltipStore.js |
| 14567 |
var React105 = __toESM(require_react(), 1); |
| 14568 |
var ReactDOM8 = __toESM(require_react_dom(), 1); |
| 14569 |
var selectors3 = { |
| 14570 |
...popupStoreSelectors, |
| 14571 |
disabled: createSelector((state) => state.disabled), |
| 14572 |
instantType: createSelector((state) => state.instantType), |
| 14573 |
isInstantPhase: createSelector((state) => state.isInstantPhase), |
| 14574 |
trackCursorAxis: createSelector((state) => state.trackCursorAxis), |
| 14575 |
disableHoverablePopup: createSelector((state) => state.disableHoverablePopup), |
| 14576 |
lastOpenChangeReason: createSelector((state) => state.openChangeReason), |
| 14577 |
closeOnClick: createSelector((state) => state.closeOnClick), |
| 14578 |
closeDelay: createSelector((state) => state.closeDelay), |
| 14579 |
hasViewport: createSelector((state) => state.hasViewport) |
| 14580 |
}; |
| 14581 |
var TooltipStore = class _TooltipStore extends ReactStore { |
| 14582 |
constructor(initialState, floatingId, nested = false) { |
| 14583 |
const triggerElements = new PopupTriggerMap(); |
| 14584 |
const state = { |
| 14585 |
...createInitialState(), |
| 14586 |
...initialState |
| 14587 |
}; |
| 14588 |
state.floatingRootContext = createPopupFloatingRootContext(triggerElements, floatingId, nested); |
| 14589 |
super(state, { |
| 14590 |
popupRef: /* @__PURE__ */ React105.createRef(), |
| 14591 |
onOpenChange: void 0, |
| 14592 |
onOpenChangeComplete: void 0, |
| 14593 |
triggerElements |
| 14594 |
}, selectors3); |
| 14595 |
} |
| 14596 |
setOpen = (nextOpen, eventDetails) => { |
| 14597 |
const reason = eventDetails.reason; |
| 14598 |
const isHover = reason === reason_parts_exports.triggerHover; |
| 14599 |
const isFocusOpen = nextOpen && reason === reason_parts_exports.triggerFocus; |
| 14600 |
const isDismissClose = !nextOpen && (reason === reason_parts_exports.triggerPress || reason === reason_parts_exports.escapeKey); |
| 14601 |
eventDetails.preventUnmountOnClose = () => { |
| 14602 |
this.set("preventUnmountingOnClose", true); |
| 14603 |
}; |
| 14604 |
this.context.onOpenChange?.(nextOpen, eventDetails); |
| 14605 |
if (eventDetails.isCanceled) { |
| 14606 |
return; |
| 14607 |
} |
| 14608 |
this.state.floatingRootContext.dispatchOpenChange(nextOpen, eventDetails); |
| 14609 |
const changeState = () => { |
| 14610 |
const updatedState = { |
| 14611 |
open: nextOpen, |
| 14612 |
openChangeReason: reason |
| 14613 |
}; |
| 14614 |
if (isFocusOpen) { |
| 14615 |
updatedState.instantType = "focus"; |
| 14616 |
} else if (isDismissClose) { |
| 14617 |
updatedState.instantType = "dismiss"; |
| 14618 |
} else if (reason === reason_parts_exports.triggerHover) { |
| 14619 |
updatedState.instantType = void 0; |
| 14620 |
} |
| 14621 |
setOpenTriggerState(updatedState, nextOpen, eventDetails.trigger); |
| 14622 |
this.update(updatedState); |
| 14623 |
}; |
| 14624 |
if (isHover) { |
| 14625 |
ReactDOM8.flushSync(changeState); |
| 14626 |
} else { |
| 14627 |
changeState(); |
| 14628 |
} |
| 14629 |
}; |
| 14630 |
// Used by trigger clicks to clear a delayed hover open without reporting a public open-state change. |
| 14631 |
cancelPendingOpen(event) { |
| 14632 |
this.state.floatingRootContext.dispatchOpenChange(false, createChangeEventDetails(reason_parts_exports.triggerPress, event)); |
| 14633 |
} |
| 14634 |
static useStore(externalStore, initialState) { |
| 14635 |
const store = usePopupStore(externalStore, (floatingId, nested) => new _TooltipStore(initialState, floatingId, nested)).store; |
| 14636 |
return store; |
| 14637 |
} |
| 14638 |
}; |
| 14639 |
function createInitialState() { |
| 14640 |
return { |
| 14641 |
...createInitialPopupStoreState(), |
| 14642 |
disabled: false, |
| 14643 |
instantType: void 0, |
| 14644 |
isInstantPhase: false, |
| 14645 |
trackCursorAxis: "none", |
| 14646 |
disableHoverablePopup: false, |
| 14647 |
openChangeReason: null, |
| 14648 |
closeOnClick: true, |
| 14649 |
closeDelay: 0, |
| 14650 |
hasViewport: false |
| 14651 |
}; |
| 14652 |
} |
| 14653 |
|
| 14654 |
// node_modules/@base-ui/react/esm/tooltip/root/TooltipRoot.js |
| 14655 |
var import_jsx_runtime34 = __toESM(require_jsx_runtime(), 1); |
| 14656 |
var TooltipRoot = fastComponent(function TooltipRoot2(props) { |
| 14657 |
const { |
| 14658 |
disabled: disabled2 = false, |
| 14659 |
defaultOpen = false, |
| 14660 |
open: openProp, |
| 14661 |
disableHoverablePopup = false, |
| 14662 |
trackCursorAxis = "none", |
| 14663 |
actionsRef, |
| 14664 |
onOpenChange, |
| 14665 |
onOpenChangeComplete, |
| 14666 |
handle, |
| 14667 |
triggerId: triggerIdProp, |
| 14668 |
defaultTriggerId: defaultTriggerIdProp = null, |
| 14669 |
children |
| 14670 |
} = props; |
| 14671 |
const store = TooltipStore.useStore(handle?.store, { |
| 14672 |
open: defaultOpen, |
| 14673 |
openProp, |
| 14674 |
activeTriggerId: defaultTriggerIdProp, |
| 14675 |
triggerIdProp |
| 14676 |
}); |
| 14677 |
useOnFirstRender(() => { |
| 14678 |
if (openProp === void 0 && store.state.open === false && defaultOpen === true) { |
| 14679 |
store.update({ |
| 14680 |
open: true, |
| 14681 |
activeTriggerId: defaultTriggerIdProp |
| 14682 |
}); |
| 14683 |
} |
| 14684 |
}); |
| 14685 |
store.useControlledProp("openProp", openProp); |
| 14686 |
store.useControlledProp("triggerIdProp", triggerIdProp); |
| 14687 |
store.useContextCallback("onOpenChange", onOpenChange); |
| 14688 |
store.useContextCallback("onOpenChangeComplete", onOpenChangeComplete); |
| 14689 |
const openState = store.useState("open"); |
| 14690 |
const open = !disabled2 && openState; |
| 14691 |
const activeTriggerId = store.useState("activeTriggerId"); |
| 14692 |
const mounted = store.useState("mounted"); |
| 14693 |
const payload = store.useState("payload"); |
| 14694 |
store.useSyncedValues({ |
| 14695 |
trackCursorAxis, |
| 14696 |
disableHoverablePopup |
| 14697 |
}); |
| 14698 |
store.useSyncedValue("disabled", disabled2); |
| 14699 |
useImplicitActiveTrigger(store); |
| 14700 |
const { |
| 14701 |
forceUnmount, |
| 14702 |
transitionStatus |
| 14703 |
} = useOpenStateTransitions(open, store); |
| 14704 |
const isInstantPhase = store.useState("isInstantPhase"); |
| 14705 |
const instantType = store.useState("instantType"); |
| 14706 |
const lastOpenChangeReason = store.useState("lastOpenChangeReason"); |
| 14707 |
const previousInstantTypeRef = React106.useRef(null); |
| 14708 |
useIsoLayoutEffect(() => { |
| 14709 |
if (openState && disabled2) { |
| 14710 |
store.setOpen(false, createChangeEventDetails(reason_parts_exports.disabled)); |
| 14711 |
} |
| 14712 |
}, [openState, disabled2, store]); |
| 14713 |
useIsoLayoutEffect(() => { |
| 14714 |
if (transitionStatus === "ending" && lastOpenChangeReason === reason_parts_exports.none || transitionStatus !== "ending" && isInstantPhase) { |
| 14715 |
if (instantType !== "delay") { |
| 14716 |
previousInstantTypeRef.current = instantType; |
| 14717 |
} |
| 14718 |
store.set("instantType", "delay"); |
| 14719 |
} else if (previousInstantTypeRef.current !== null) { |
| 14720 |
store.set("instantType", previousInstantTypeRef.current); |
| 14721 |
previousInstantTypeRef.current = null; |
| 14722 |
} |
| 14723 |
}, [transitionStatus, isInstantPhase, lastOpenChangeReason, instantType, store]); |
| 14724 |
useIsoLayoutEffect(() => { |
| 14725 |
if (open) { |
| 14726 |
if (activeTriggerId == null) { |
| 14727 |
store.set("payload", void 0); |
| 14728 |
} |
| 14729 |
} |
| 14730 |
}, [store, activeTriggerId, open]); |
| 14731 |
const handleImperativeClose = React106.useCallback(() => { |
| 14732 |
store.setOpen(false, createChangeEventDetails(reason_parts_exports.imperativeAction)); |
| 14733 |
}, [store]); |
| 14734 |
React106.useImperativeHandle(actionsRef, () => ({ |
| 14735 |
unmount: forceUnmount, |
| 14736 |
close: handleImperativeClose |
| 14737 |
}), [forceUnmount, handleImperativeClose]); |
| 14738 |
const shouldRenderInteractions = open || mounted || !disabled2 && trackCursorAxis !== "none"; |
| 14739 |
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(TooltipRootContext.Provider, { |
| 14740 |
value: store, |
| 14741 |
children: [shouldRenderInteractions && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(TooltipInteractions, { |
| 14742 |
store, |
| 14743 |
disabled: disabled2, |
| 14744 |
trackCursorAxis |
| 14745 |
}), typeof children === "function" ? children({ |
| 14746 |
payload |
| 14747 |
}) : children] |
| 14748 |
}); |
| 14749 |
}); |
| 14750 |
if (true) TooltipRoot.displayName = "TooltipRoot"; |
| 14751 |
function TooltipInteractions({ |
| 14752 |
store, |
| 14753 |
disabled: disabled2, |
| 14754 |
trackCursorAxis |
| 14755 |
}) { |
| 14756 |
const floatingRootContext = store.useState("floatingRootContext"); |
| 14757 |
const dismiss = useDismiss(floatingRootContext, { |
| 14758 |
enabled: !disabled2, |
| 14759 |
referencePress: () => store.select("closeOnClick") |
| 14760 |
}); |
| 14761 |
const clientPoint = useClientPoint(floatingRootContext, { |
| 14762 |
enabled: !disabled2 && trackCursorAxis !== "none", |
| 14763 |
axis: trackCursorAxis === "none" ? void 0 : trackCursorAxis |
| 14764 |
}); |
| 14765 |
const activeTriggerProps = React106.useMemo(() => mergeProps(clientPoint.reference, dismiss.reference), [clientPoint.reference, dismiss.reference]); |
| 14766 |
const inactiveTriggerProps = React106.useMemo(() => mergeProps(clientPoint.trigger, dismiss.trigger), [clientPoint.trigger, dismiss.trigger]); |
| 14767 |
const popupProps = React106.useMemo(() => mergeProps(FOCUSABLE_POPUP_PROPS, clientPoint.floating, dismiss.floating), [clientPoint.floating, dismiss.floating]); |
| 14768 |
usePopupInteractionProps(store, { |
| 14769 |
activeTriggerProps, |
| 14770 |
inactiveTriggerProps, |
| 14771 |
popupProps |
| 14772 |
}); |
| 14773 |
return null; |
| 14774 |
} |
| 14775 |
|
| 14776 |
// node_modules/@base-ui/react/esm/tooltip/trigger/TooltipTrigger.js |
| 14777 |
var React108 = __toESM(require_react(), 1); |
| 14778 |
|
| 14779 |
// node_modules/@base-ui/react/esm/tooltip/provider/TooltipProviderContext.js |
| 14780 |
var React107 = __toESM(require_react(), 1); |
| 14781 |
var TooltipProviderContext = /* @__PURE__ */ React107.createContext(void 0); |
| 14782 |
if (true) TooltipProviderContext.displayName = "TooltipProviderContext"; |
| 14783 |
function useTooltipProviderContext() { |
| 14784 |
return React107.useContext(TooltipProviderContext); |
| 14785 |
} |
| 14786 |
|
| 14787 |
// node_modules/@base-ui/react/esm/tooltip/trigger/TooltipTriggerDataAttributes.js |
| 14788 |
var TooltipTriggerDataAttributes = (function(TooltipTriggerDataAttributes2) { |
| 14789 |
TooltipTriggerDataAttributes2[TooltipTriggerDataAttributes2["popupOpen"] = CommonTriggerDataAttributes.popupOpen] = "popupOpen"; |
| 14790 |
TooltipTriggerDataAttributes2["triggerDisabled"] = "data-trigger-disabled"; |
| 14791 |
return TooltipTriggerDataAttributes2; |
| 14792 |
})({}); |
| 14793 |
|
| 14794 |
// node_modules/@base-ui/react/esm/tooltip/utils/constants.js |
| 14795 |
var OPEN_DELAY = 600; |
| 14796 |
|
| 14797 |
// node_modules/@base-ui/react/esm/tooltip/trigger/TooltipTrigger.js |
| 14798 |
var TOOLTIP_TRIGGER_IDENTIFIER = "data-base-ui-tooltip-trigger"; |
| 14799 |
function getTargetElement(event) { |
| 14800 |
if ("composedPath" in event) { |
| 14801 |
const path = event.composedPath(); |
| 14802 |
for (let i = 0; i < path.length; i += 1) { |
| 14803 |
const element = path[i]; |
| 14804 |
if (isElement(element)) { |
| 14805 |
return element; |
| 14806 |
} |
| 14807 |
} |
| 14808 |
} |
| 14809 |
const target = event.target; |
| 14810 |
if (isElement(target)) { |
| 14811 |
return target; |
| 14812 |
} |
| 14813 |
return null; |
| 14814 |
} |
| 14815 |
function closestEnabledTooltipTrigger(element) { |
| 14816 |
let current = element; |
| 14817 |
while (current) { |
| 14818 |
if (current.hasAttribute(TOOLTIP_TRIGGER_IDENTIFIER)) { |
| 14819 |
return current; |
| 14820 |
} |
| 14821 |
const parentElement = current.parentElement; |
| 14822 |
if (parentElement) { |
| 14823 |
current = parentElement; |
| 14824 |
continue; |
| 14825 |
} |
| 14826 |
const root = current.getRootNode(); |
| 14827 |
current = "host" in root && isElement(root.host) ? root.host : null; |
| 14828 |
} |
| 14829 |
return null; |
| 14830 |
} |
| 14831 |
var TooltipTrigger = fastComponentRef(function TooltipTrigger2(componentProps, forwardedRef) { |
| 14832 |
const { |
| 14833 |
render, |
| 14834 |
className, |
| 14835 |
style, |
| 14836 |
handle, |
| 14837 |
payload, |
| 14838 |
disabled: disabledProp, |
| 14839 |
delay, |
| 14840 |
closeOnClick = true, |
| 14841 |
closeDelay, |
| 14842 |
id: idProp, |
| 14843 |
...elementProps |
| 14844 |
} = componentProps; |
| 14845 |
const rootContext = useTooltipRootContext(true); |
| 14846 |
const store = handle?.store ?? rootContext; |
| 14847 |
if (!store) { |
| 14848 |
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)); |
| 14849 |
} |
| 14850 |
const thisTriggerId = useBaseUiId(idProp); |
| 14851 |
const isTriggerActive = store.useState("isTriggerActive", thisTriggerId); |
| 14852 |
const isOpenedByThisTrigger = store.useState("isOpenedByTrigger", thisTriggerId); |
| 14853 |
const floatingRootContext = store.useState("floatingRootContext"); |
| 14854 |
const triggerElementRef = React108.useRef(null); |
| 14855 |
const delayWithDefault = delay ?? OPEN_DELAY; |
| 14856 |
const closeDelayWithDefault = closeDelay ?? 0; |
| 14857 |
const { |
| 14858 |
registerTrigger, |
| 14859 |
isMountedByThisTrigger |
| 14860 |
} = useTriggerDataForwarding(thisTriggerId, triggerElementRef, store, { |
| 14861 |
payload, |
| 14862 |
closeOnClick, |
| 14863 |
closeDelay: closeDelayWithDefault |
| 14864 |
}); |
| 14865 |
const providerContext = useTooltipProviderContext(); |
| 14866 |
const { |
| 14867 |
delayRef, |
| 14868 |
isInstantPhase, |
| 14869 |
hasProvider |
| 14870 |
} = useDelayGroup(floatingRootContext, { |
| 14871 |
open: isOpenedByThisTrigger |
| 14872 |
}); |
| 14873 |
const hoverInteraction = useHoverInteractionSharedState(floatingRootContext); |
| 14874 |
store.useSyncedValue("isInstantPhase", isInstantPhase); |
| 14875 |
const rootDisabled = store.useState("disabled"); |
| 14876 |
const disabled2 = disabledProp ?? rootDisabled; |
| 14877 |
const disabledRef = useValueAsRef(disabled2); |
| 14878 |
const trackCursorAxis = store.useState("trackCursorAxis"); |
| 14879 |
const disableHoverablePopup = store.useState("disableHoverablePopup"); |
| 14880 |
const isNestedTriggerHoveredRef = React108.useRef(false); |
| 14881 |
const nestedTriggerOpenTimeout = useTimeout(); |
| 14882 |
const pointerTypeRef = React108.useRef(void 0); |
| 14883 |
function getOpenDelay() { |
| 14884 |
const providerDelay = providerContext?.delay; |
| 14885 |
const groupOpenValue = typeof delayRef.current === "object" ? delayRef.current.open : void 0; |
| 14886 |
let computedOpenDelay = delayWithDefault; |
| 14887 |
if (hasProvider) { |
| 14888 |
if (groupOpenValue !== 0) { |
| 14889 |
computedOpenDelay = delay ?? providerDelay ?? delayWithDefault; |
| 14890 |
} else { |
| 14891 |
computedOpenDelay = 0; |
| 14892 |
} |
| 14893 |
} |
| 14894 |
return computedOpenDelay; |
| 14895 |
} |
| 14896 |
function isEnabledNestedTriggerTarget(target) { |
| 14897 |
const triggerEl = triggerElementRef.current; |
| 14898 |
if (!triggerEl || !target) { |
| 14899 |
return false; |
| 14900 |
} |
| 14901 |
const nearestTrigger = closestEnabledTooltipTrigger(target); |
| 14902 |
return nearestTrigger !== null && nearestTrigger !== triggerEl && contains(triggerEl, nearestTrigger); |
| 14903 |
} |
| 14904 |
function detectNestedTriggerHover(target) { |
| 14905 |
const nestedTriggerHovered = isEnabledNestedTriggerTarget(target); |
| 14906 |
isNestedTriggerHoveredRef.current = nestedTriggerHovered; |
| 14907 |
if (nestedTriggerHovered) { |
| 14908 |
hoverInteraction.openChangeTimeout.clear(); |
| 14909 |
hoverInteraction.restTimeout.clear(); |
| 14910 |
hoverInteraction.restTimeoutPending = false; |
| 14911 |
nestedTriggerOpenTimeout.clear(); |
| 14912 |
} |
| 14913 |
return nestedTriggerHovered; |
| 14914 |
} |
| 14915 |
const hoverProps = useHoverReferenceInteraction(floatingRootContext, { |
| 14916 |
enabled: !disabled2, |
| 14917 |
mouseOnly: true, |
| 14918 |
move: false, |
| 14919 |
handleClose: !disableHoverablePopup && trackCursorAxis !== "both" ? safePolygon() : null, |
| 14920 |
restMs: getOpenDelay, |
| 14921 |
delay() { |
| 14922 |
const closeValue = typeof delayRef.current === "object" ? delayRef.current.close : void 0; |
| 14923 |
let computedCloseDelay = closeDelayWithDefault; |
| 14924 |
if (closeDelay == null && hasProvider) { |
| 14925 |
computedCloseDelay = closeValue; |
| 14926 |
} |
| 14927 |
return { |
| 14928 |
close: computedCloseDelay |
| 14929 |
}; |
| 14930 |
}, |
| 14931 |
triggerElementRef, |
| 14932 |
isActiveTrigger: isTriggerActive, |
| 14933 |
isClosing: () => store.select("transitionStatus") === "ending", |
| 14934 |
shouldOpen() { |
| 14935 |
return !isNestedTriggerHoveredRef.current; |
| 14936 |
} |
| 14937 |
}); |
| 14938 |
const focusProps = useFocus(floatingRootContext, { |
| 14939 |
enabled: !disabled2 |
| 14940 |
}).reference; |
| 14941 |
const handleNestedTriggerHover = (event) => { |
| 14942 |
const wasNestedTriggerHovered = isNestedTriggerHoveredRef.current; |
| 14943 |
const target = getTargetElement(event); |
| 14944 |
const nestedTriggerHovered = detectNestedTriggerHover(target); |
| 14945 |
const triggerEl = triggerElementRef.current; |
| 14946 |
const targetInsideTrigger = triggerEl && target && contains(triggerEl, target); |
| 14947 |
if (nestedTriggerHovered && store.select("open") && store.select("lastOpenChangeReason") === reason_parts_exports.triggerHover) { |
| 14948 |
store.setOpen(false, createChangeEventDetails(reason_parts_exports.triggerHover, event)); |
| 14949 |
return; |
| 14950 |
} |
| 14951 |
if (wasNestedTriggerHovered && !nestedTriggerHovered && targetInsideTrigger && !disabledRef.current && !store.select("open") && triggerEl && // Match the hover hook's non-strict mouse fallback for mouse-only event sequences. |
| 14952 |
isMouseLikePointerType(pointerTypeRef.current)) { |
| 14953 |
const open = () => { |
| 14954 |
if (!isNestedTriggerHoveredRef.current && !disabledRef.current && !store.select("open")) { |
| 14955 |
store.setOpen(true, createChangeEventDetails(reason_parts_exports.triggerHover, event, triggerEl)); |
| 14956 |
} |
| 14957 |
}; |
| 14958 |
const openDelay = getOpenDelay(); |
| 14959 |
if (openDelay === 0) { |
| 14960 |
nestedTriggerOpenTimeout.clear(); |
| 14961 |
open(); |
| 14962 |
} else { |
| 14963 |
nestedTriggerOpenTimeout.start(openDelay, open); |
| 14964 |
} |
| 14965 |
} |
| 14966 |
}; |
| 14967 |
const rootTriggerProps = store.useState("triggerProps", isMountedByThisTrigger); |
| 14968 |
const shouldApplyRootTriggerProps = isMountedByThisTrigger || trackCursorAxis !== "none"; |
| 14969 |
const state = { |
| 14970 |
open: isOpenedByThisTrigger |
| 14971 |
}; |
| 14972 |
const element = useRenderElement("button", componentProps, { |
| 14973 |
state, |
| 14974 |
ref: [forwardedRef, registerTrigger, triggerElementRef], |
| 14975 |
props: [hoverProps, focusProps, shouldApplyRootTriggerProps ? rootTriggerProps : void 0, { |
| 14976 |
onMouseOver(event) { |
| 14977 |
handleNestedTriggerHover(event.nativeEvent); |
| 14978 |
}, |
| 14979 |
onFocus(event) { |
| 14980 |
if (isEnabledNestedTriggerTarget(getTargetElement(event.nativeEvent))) { |
| 14981 |
event.preventBaseUIHandler(); |
| 14982 |
} |
| 14983 |
}, |
| 14984 |
onMouseLeave() { |
| 14985 |
isNestedTriggerHoveredRef.current = false; |
| 14986 |
nestedTriggerOpenTimeout.clear(); |
| 14987 |
pointerTypeRef.current = void 0; |
| 14988 |
}, |
| 14989 |
onPointerEnter(event) { |
| 14990 |
pointerTypeRef.current = event.pointerType; |
| 14991 |
}, |
| 14992 |
onPointerDown(event) { |
| 14993 |
pointerTypeRef.current = event.pointerType; |
| 14994 |
store.set("closeOnClick", closeOnClick); |
| 14995 |
if (closeOnClick && !store.select("open")) { |
| 14996 |
store.cancelPendingOpen(event.nativeEvent); |
| 14997 |
} |
| 14998 |
}, |
| 14999 |
onClick(event) { |
| 15000 |
if (closeOnClick && !store.select("open")) { |
| 15001 |
store.cancelPendingOpen(event.nativeEvent); |
| 15002 |
} |
| 15003 |
}, |
| 15004 |
id: thisTriggerId, |
| 15005 |
[TooltipTriggerDataAttributes.triggerDisabled]: disabled2 ? "" : void 0, |
| 15006 |
[TOOLTIP_TRIGGER_IDENTIFIER]: disabled2 ? void 0 : "" |
| 15007 |
}, elementProps], |
| 15008 |
stateAttributesMapping: triggerOpenStateMapping |
| 15009 |
}); |
| 15010 |
return element; |
| 15011 |
}); |
| 15012 |
if (true) TooltipTrigger.displayName = "TooltipTrigger"; |
| 15013 |
|
| 15014 |
// node_modules/@base-ui/react/esm/tooltip/portal/TooltipPortal.js |
| 15015 |
var React110 = __toESM(require_react(), 1); |
| 15016 |
|
| 15017 |
// node_modules/@base-ui/react/esm/tooltip/portal/TooltipPortalContext.js |
| 15018 |
var React109 = __toESM(require_react(), 1); |
| 15019 |
var TooltipPortalContext = /* @__PURE__ */ React109.createContext(void 0); |
| 15020 |
if (true) TooltipPortalContext.displayName = "TooltipPortalContext"; |
| 15021 |
function useTooltipPortalContext() { |
| 15022 |
const value = React109.useContext(TooltipPortalContext); |
| 15023 |
if (value === void 0) { |
| 15024 |
throw new Error(true ? "Base UI: <Tooltip.Portal> is missing." : formatErrorMessage_default(70)); |
| 15025 |
} |
| 15026 |
return value; |
| 15027 |
} |
| 15028 |
|
| 15029 |
// node_modules/@base-ui/react/esm/tooltip/portal/TooltipPortal.js |
| 15030 |
var import_jsx_runtime35 = __toESM(require_jsx_runtime(), 1); |
| 15031 |
var TooltipPortal = /* @__PURE__ */ React110.forwardRef(function TooltipPortal2(props, forwardedRef) { |
| 15032 |
const { |
| 15033 |
keepMounted = false, |
| 15034 |
...portalProps |
| 15035 |
} = props; |
| 15036 |
const store = useTooltipRootContext(); |
| 15037 |
const mounted = store.useState("mounted"); |
| 15038 |
const shouldRender = mounted || keepMounted; |
| 15039 |
if (!shouldRender) { |
| 15040 |
return null; |
| 15041 |
} |
| 15042 |
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(TooltipPortalContext.Provider, { |
| 15043 |
value: keepMounted, |
| 15044 |
children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(FloatingPortalLite, { |
| 15045 |
ref: forwardedRef, |
| 15046 |
...portalProps |
| 15047 |
}) |
| 15048 |
}); |
| 15049 |
}); |
| 15050 |
if (true) TooltipPortal.displayName = "TooltipPortal"; |
| 15051 |
|
| 15052 |
// node_modules/@base-ui/react/esm/tooltip/positioner/TooltipPositioner.js |
| 15053 |
var React112 = __toESM(require_react(), 1); |
| 15054 |
|
| 15055 |
// node_modules/@base-ui/react/esm/tooltip/positioner/TooltipPositionerContext.js |
| 15056 |
var React111 = __toESM(require_react(), 1); |
| 15057 |
var TooltipPositionerContext = /* @__PURE__ */ React111.createContext(void 0); |
| 15058 |
if (true) TooltipPositionerContext.displayName = "TooltipPositionerContext"; |
| 15059 |
function useTooltipPositionerContext() { |
| 15060 |
const context = React111.useContext(TooltipPositionerContext); |
| 15061 |
if (context === void 0) { |
| 15062 |
throw new Error(true ? "Base UI: TooltipPositionerContext is missing. TooltipPositioner parts must be placed within <Tooltip.Positioner>." : formatErrorMessage_default(71)); |
| 15063 |
} |
| 15064 |
return context; |
| 15065 |
} |
| 15066 |
|
| 15067 |
// node_modules/@base-ui/react/esm/tooltip/positioner/TooltipPositioner.js |
| 15068 |
var import_jsx_runtime36 = __toESM(require_jsx_runtime(), 1); |
| 15069 |
var TooltipPositioner = /* @__PURE__ */ React112.forwardRef(function TooltipPositioner2(componentProps, forwardedRef) { |
| 15070 |
const { |
| 15071 |
render, |
| 15072 |
className, |
| 15073 |
anchor, |
| 15074 |
positionMethod = "absolute", |
| 15075 |
side = "top", |
| 15076 |
align = "center", |
| 15077 |
sideOffset = 0, |
| 15078 |
alignOffset = 0, |
| 15079 |
collisionBoundary = "clipping-ancestors", |
| 15080 |
collisionPadding = 5, |
| 15081 |
arrowPadding = 5, |
| 15082 |
sticky = false, |
| 15083 |
disableAnchorTracking = false, |
| 15084 |
collisionAvoidance = POPUP_COLLISION_AVOIDANCE, |
| 15085 |
style, |
| 15086 |
...elementProps |
| 15087 |
} = componentProps; |
| 15088 |
const store = useTooltipRootContext(); |
| 15089 |
const keepMounted = useTooltipPortalContext(); |
| 15090 |
const open = store.useState("open"); |
| 15091 |
const mounted = store.useState("mounted"); |
| 15092 |
const trackCursorAxis = store.useState("trackCursorAxis"); |
| 15093 |
const disableHoverablePopup = store.useState("disableHoverablePopup"); |
| 15094 |
const floatingRootContext = store.useState("floatingRootContext"); |
| 15095 |
const instantType = store.useState("instantType"); |
| 15096 |
const transitionStatus = store.useState("transitionStatus"); |
| 15097 |
const hasViewport = store.useState("hasViewport"); |
| 15098 |
const positioning = useAnchorPositioning({ |
| 15099 |
anchor, |
| 15100 |
positionMethod, |
| 15101 |
floatingRootContext, |
| 15102 |
mounted, |
| 15103 |
side, |
| 15104 |
sideOffset, |
| 15105 |
align, |
| 15106 |
alignOffset, |
| 15107 |
collisionBoundary, |
| 15108 |
collisionPadding, |
| 15109 |
sticky, |
| 15110 |
arrowPadding, |
| 15111 |
disableAnchorTracking, |
| 15112 |
keepMounted, |
| 15113 |
collisionAvoidance, |
| 15114 |
adaptiveOrigin: hasViewport ? adaptiveOrigin : void 0 |
| 15115 |
}); |
| 15116 |
const state = React112.useMemo(() => ({ |
| 15117 |
open, |
| 15118 |
side: positioning.side, |
| 15119 |
align: positioning.align, |
| 15120 |
anchorHidden: positioning.anchorHidden, |
| 15121 |
instant: trackCursorAxis !== "none" ? "tracking-cursor" : instantType |
| 15122 |
}), [open, positioning.side, positioning.align, positioning.anchorHidden, trackCursorAxis, instantType]); |
| 15123 |
const element = usePositioner(componentProps, state, { |
| 15124 |
styles: positioning.positionerStyles, |
| 15125 |
transitionStatus, |
| 15126 |
props: elementProps, |
| 15127 |
refs: [forwardedRef, store.useStateSetter("positionerElement")], |
| 15128 |
hidden: !mounted, |
| 15129 |
inert: !open || trackCursorAxis === "both" || disableHoverablePopup |
| 15130 |
}); |
| 15131 |
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(TooltipPositionerContext.Provider, { |
| 15132 |
value: positioning, |
| 15133 |
children: element |
| 15134 |
}); |
| 15135 |
}); |
| 15136 |
if (true) TooltipPositioner.displayName = "TooltipPositioner"; |
| 15137 |
|
| 15138 |
// node_modules/@base-ui/react/esm/tooltip/popup/TooltipPopup.js |
| 15139 |
var React113 = __toESM(require_react(), 1); |
| 15140 |
var stateAttributesMapping5 = { |
| 15141 |
...popupStateMapping, |
| 15142 |
...transitionStatusMapping |
| 15143 |
}; |
| 15144 |
var TooltipPopup = /* @__PURE__ */ React113.forwardRef(function TooltipPopup2(componentProps, forwardedRef) { |
| 15145 |
const { |
| 15146 |
render, |
| 15147 |
className, |
| 15148 |
style, |
| 15149 |
...elementProps |
| 15150 |
} = componentProps; |
| 15151 |
const store = useTooltipRootContext(); |
| 15152 |
const { |
| 15153 |
side, |
| 15154 |
align |
| 15155 |
} = useTooltipPositionerContext(); |
| 15156 |
const open = store.useState("open"); |
| 15157 |
const instantType = store.useState("instantType"); |
| 15158 |
const transitionStatus = store.useState("transitionStatus"); |
| 15159 |
const popupProps = store.useState("popupProps"); |
| 15160 |
const floatingContext = store.useState("floatingRootContext"); |
| 15161 |
const disabled2 = store.useState("disabled"); |
| 15162 |
const closeDelay = store.useState("closeDelay"); |
| 15163 |
useOpenChangeComplete({ |
| 15164 |
open, |
| 15165 |
ref: store.context.popupRef, |
| 15166 |
onComplete() { |
| 15167 |
if (open) { |
| 15168 |
store.context.onOpenChangeComplete?.(true); |
| 15169 |
} |
| 15170 |
} |
| 15171 |
}); |
| 15172 |
useHoverFloatingInteraction(floatingContext, { |
| 15173 |
enabled: !disabled2, |
| 15174 |
closeDelay |
| 15175 |
}); |
| 15176 |
const setPopupElement = store.useStateSetter("popupElement"); |
| 15177 |
const state = { |
| 15178 |
open, |
| 15179 |
side, |
| 15180 |
align, |
| 15181 |
instant: instantType, |
| 15182 |
transitionStatus |
| 15183 |
}; |
| 15184 |
const element = useRenderElement("div", componentProps, { |
| 15185 |
state, |
| 15186 |
ref: [forwardedRef, store.context.popupRef, setPopupElement], |
| 15187 |
props: [popupProps, getDisabledMountTransitionStyles(transitionStatus), elementProps], |
| 15188 |
stateAttributesMapping: stateAttributesMapping5 |
| 15189 |
}); |
| 15190 |
return element; |
| 15191 |
}); |
| 15192 |
if (true) TooltipPopup.displayName = "TooltipPopup"; |
| 15193 |
|
| 15194 |
// node_modules/@base-ui/react/esm/tooltip/arrow/TooltipArrow.js |
| 15195 |
var React114 = __toESM(require_react(), 1); |
| 15196 |
var TooltipArrow = /* @__PURE__ */ React114.forwardRef(function TooltipArrow2(componentProps, forwardedRef) { |
| 15197 |
const { |
| 15198 |
render, |
| 15199 |
className, |
| 15200 |
style, |
| 15201 |
...elementProps |
| 15202 |
} = componentProps; |
| 15203 |
const store = useTooltipRootContext(); |
| 15204 |
const { |
| 15205 |
arrowRef, |
| 15206 |
side, |
| 15207 |
align, |
| 15208 |
arrowUncentered, |
| 15209 |
arrowStyles |
| 15210 |
} = useTooltipPositionerContext(); |
| 15211 |
const open = store.useState("open"); |
| 15212 |
const instantType = store.useState("instantType"); |
| 15213 |
const state = { |
| 15214 |
open, |
| 15215 |
side, |
| 15216 |
align, |
| 15217 |
uncentered: arrowUncentered, |
| 15218 |
instant: instantType |
| 15219 |
}; |
| 15220 |
const element = useRenderElement("div", componentProps, { |
| 15221 |
state, |
| 15222 |
ref: [forwardedRef, arrowRef], |
| 15223 |
props: [{ |
| 15224 |
style: arrowStyles, |
| 15225 |
"aria-hidden": true |
| 15226 |
}, elementProps], |
| 15227 |
stateAttributesMapping: popupStateMapping |
| 15228 |
}); |
| 15229 |
return element; |
| 15230 |
}); |
| 15231 |
if (true) TooltipArrow.displayName = "TooltipArrow"; |
| 15232 |
|
| 15233 |
// node_modules/@base-ui/react/esm/tooltip/provider/TooltipProvider.js |
| 15234 |
var React115 = __toESM(require_react(), 1); |
| 15235 |
var import_jsx_runtime37 = __toESM(require_jsx_runtime(), 1); |
| 15236 |
var TooltipProvider = function TooltipProvider2(props) { |
| 15237 |
const { |
| 15238 |
delay, |
| 15239 |
closeDelay, |
| 15240 |
timeout = 400 |
| 15241 |
} = props; |
| 15242 |
const contextValue = React115.useMemo(() => ({ |
| 15243 |
delay, |
| 15244 |
closeDelay |
| 15245 |
}), [delay, closeDelay]); |
| 15246 |
const delayValue = React115.useMemo(() => ({ |
| 15247 |
open: delay, |
| 15248 |
close: closeDelay |
| 15249 |
}), [delay, closeDelay]); |
| 15250 |
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(TooltipProviderContext.Provider, { |
| 15251 |
value: contextValue, |
| 15252 |
children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(FloatingDelayGroup, { |
| 15253 |
delay: delayValue, |
| 15254 |
timeoutMs: timeout, |
| 15255 |
children: props.children |
| 15256 |
}) |
| 15257 |
}); |
| 15258 |
}; |
| 15259 |
if (true) TooltipProvider.displayName = "TooltipProvider"; |
| 15260 |
|
| 15261 |
// node_modules/@base-ui/react/esm/tooltip/viewport/TooltipViewport.js |
| 15262 |
var React116 = __toESM(require_react(), 1); |
| 15263 |
|
| 15264 |
// node_modules/@base-ui/react/esm/tooltip/viewport/TooltipViewportCssVars.js |
| 15265 |
var TooltipViewportCssVars = /* @__PURE__ */ (function(TooltipViewportCssVars2) { |
| 15266 |
TooltipViewportCssVars2["popupWidth"] = "--popup-width"; |
| 15267 |
TooltipViewportCssVars2["popupHeight"] = "--popup-height"; |
| 15268 |
return TooltipViewportCssVars2; |
| 15269 |
})({}); |
| 15270 |
|
| 15271 |
// node_modules/@base-ui/react/esm/tooltip/viewport/TooltipViewport.js |
| 15272 |
var stateAttributesMapping6 = { |
| 15273 |
activationDirection: (value) => value ? { |
| 15274 |
"data-activation-direction": value |
| 15275 |
} : null |
| 15276 |
}; |
| 15277 |
var TooltipViewport = /* @__PURE__ */ React116.forwardRef(function TooltipViewport2(componentProps, forwardedRef) { |
| 15278 |
const { |
| 15279 |
render, |
| 15280 |
className, |
| 15281 |
style, |
| 15282 |
children, |
| 15283 |
...elementProps |
| 15284 |
} = componentProps; |
| 15285 |
const store = useTooltipRootContext(); |
| 15286 |
const positioner = useTooltipPositionerContext(); |
| 15287 |
const instantType = store.useState("instantType"); |
| 15288 |
const { |
| 15289 |
children: childrenToRender, |
| 15290 |
state: viewportState |
| 15291 |
} = usePopupViewport({ |
| 15292 |
store, |
| 15293 |
side: positioner.side, |
| 15294 |
cssVars: TooltipViewportCssVars, |
| 15295 |
children |
| 15296 |
}); |
| 15297 |
const state = { |
| 15298 |
activationDirection: viewportState.activationDirection, |
| 15299 |
transitioning: viewportState.transitioning, |
| 15300 |
instant: instantType |
| 15301 |
}; |
| 15302 |
return useRenderElement("div", componentProps, { |
| 15303 |
state, |
| 15304 |
ref: forwardedRef, |
| 15305 |
props: [elementProps, { |
| 15306 |
children: childrenToRender |
| 15307 |
}], |
| 15308 |
stateAttributesMapping: stateAttributesMapping6 |
| 15309 |
}); |
| 15310 |
}); |
| 15311 |
if (true) TooltipViewport.displayName = "TooltipViewport"; |
| 15312 |
|
| 15313 |
// node_modules/@base-ui/react/esm/tooltip/store/TooltipHandle.js |
| 15314 |
var TooltipHandle = class { |
| 15315 |
/** |
| 15316 |
* Internal store holding the tooltip state. |
| 15317 |
* @internal |
| 15318 |
*/ |
| 15319 |
constructor() { |
| 15320 |
this.store = new TooltipStore(); |
| 15321 |
} |
| 15322 |
/** |
| 15323 |
* Opens the tooltip and associates it with the trigger with the given ID. |
| 15324 |
* The trigger must be a Tooltip.Trigger component with this handle passed as a prop. |
| 15325 |
* |
| 15326 |
* This method should only be called in an event handler or an effect (not during rendering). |
| 15327 |
* |
| 15328 |
* @param triggerId ID of the trigger to associate with the tooltip. |
| 15329 |
*/ |
| 15330 |
open(triggerId) { |
| 15331 |
const triggerElement = triggerId ? this.store.context.triggerElements.getById(triggerId) : void 0; |
| 15332 |
if (triggerId && !triggerElement) { |
| 15333 |
throw new Error(true ? `Base UI: TooltipHandle.open: No trigger found with id "${triggerId}".` : formatErrorMessage_default(81, triggerId)); |
| 15334 |
} |
| 15335 |
this.store.setOpen(true, createChangeEventDetails(reason_parts_exports.imperativeAction, void 0, triggerElement)); |
| 15336 |
} |
| 15337 |
/** |
| 15338 |
* Closes the tooltip. |
| 15339 |
*/ |
| 15340 |
close() { |
| 15341 |
this.store.setOpen(false, createChangeEventDetails(reason_parts_exports.imperativeAction, void 0, void 0)); |
| 15342 |
} |
| 15343 |
/** |
| 15344 |
* Indicates whether the tooltip is currently open. |
| 15345 |
*/ |
| 15346 |
get isOpen() { |
| 15347 |
return this.store.select("open"); |
| 15348 |
} |
| 15349 |
}; |
| 15350 |
function createTooltipHandle() { |
| 15351 |
return new TooltipHandle(); |
| 15352 |
} |
| 15353 |
|
| 15354 |
// node_modules/@base-ui/react/esm/use-render/useRender.js |
| 15355 |
function useRender(params) { |
| 15356 |
return useRenderElement(params.defaultTagName ?? "div", params, params); |
| 15357 |
} |
| 15358 |
|
| 15359 |
// packages/ui/build-module/text/text.mjs |
| 15360 |
var import_element16 = __toESM(require_element(), 1); |
| 15361 |
var STYLE_HASH_ATTRIBUTE = "data-wp-hash"; |
| 15362 |
function getRuntime() { |
| 15363 |
const globalScope = globalThis; |
| 15364 |
if (globalScope.__wpStyleRuntime) { |
| 15365 |
return globalScope.__wpStyleRuntime; |
| 15366 |
} |
| 15367 |
globalScope.__wpStyleRuntime = { |
| 15368 |
documents: /* @__PURE__ */ new Map(), |
| 15369 |
styles: /* @__PURE__ */ new Map(), |
| 15370 |
injectedStyles: /* @__PURE__ */ new WeakMap() |
| 15371 |
}; |
| 15372 |
if (typeof document !== "undefined") { |
| 15373 |
registerDocument(document); |
| 15374 |
} |
| 15375 |
return globalScope.__wpStyleRuntime; |
| 15376 |
} |
| 15377 |
function documentContainsStyleHash(targetDocument, hash) { |
| 15378 |
if (!targetDocument.head) { |
| 15379 |
return false; |
| 15380 |
} |
| 15381 |
for (const style of targetDocument.head.querySelectorAll( |
| 15382 |
`style[${STYLE_HASH_ATTRIBUTE}]` |
| 15383 |
)) { |
| 15384 |
if (style.getAttribute(STYLE_HASH_ATTRIBUTE) === hash) { |
| 15385 |
return true; |
| 15386 |
} |
| 15387 |
} |
| 15388 |
return false; |
| 15389 |
} |
| 15390 |
function injectStyle(targetDocument, hash, css) { |
| 15391 |
if (!targetDocument.head) { |
| 15392 |
return; |
| 15393 |
} |
| 15394 |
const runtime = getRuntime(); |
| 15395 |
let injectedStyles = runtime.injectedStyles.get(targetDocument); |
| 15396 |
if (!injectedStyles) { |
| 15397 |
injectedStyles = /* @__PURE__ */ new Set(); |
| 15398 |
runtime.injectedStyles.set(targetDocument, injectedStyles); |
| 15399 |
} |
| 15400 |
if (injectedStyles.has(hash)) { |
| 15401 |
return; |
| 15402 |
} |
| 15403 |
if (documentContainsStyleHash(targetDocument, hash)) { |
| 15404 |
injectedStyles.add(hash); |
| 15405 |
return; |
| 15406 |
} |
| 15407 |
const style = targetDocument.createElement("style"); |
| 15408 |
style.setAttribute(STYLE_HASH_ATTRIBUTE, hash); |
| 15409 |
style.appendChild(targetDocument.createTextNode(css)); |
| 15410 |
targetDocument.head.appendChild(style); |
| 15411 |
injectedStyles.add(hash); |
| 15412 |
} |
| 15413 |
function registerDocument(targetDocument) { |
| 15414 |
const runtime = getRuntime(); |
| 15415 |
runtime.documents.set( |
| 15416 |
targetDocument, |
| 15417 |
(runtime.documents.get(targetDocument) ?? 0) + 1 |
| 15418 |
); |
| 15419 |
for (const [hash, css] of runtime.styles) { |
| 15420 |
injectStyle(targetDocument, hash, css); |
| 15421 |
} |
| 15422 |
return () => { |
| 15423 |
const count = runtime.documents.get(targetDocument); |
| 15424 |
if (count === void 0) { |
| 15425 |
return; |
| 15426 |
} |
| 15427 |
if (count <= 1) { |
| 15428 |
runtime.documents.delete(targetDocument); |
| 15429 |
return; |
| 15430 |
} |
| 15431 |
runtime.documents.set(targetDocument, count - 1); |
| 15432 |
}; |
| 15433 |
} |
| 15434 |
function registerStyle(hash, css) { |
| 15435 |
const runtime = getRuntime(); |
| 15436 |
runtime.styles.set(hash, css); |
| 15437 |
for (const targetDocument of runtime.documents.keys()) { |
| 15438 |
injectStyle(targetDocument, hash, css); |
| 15439 |
} |
| 15440 |
} |
| 15441 |
if (typeof process === "undefined" || true) { |
| 15442 |
registerStyle("0c5702ddca", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._83ed8a8da5dd50ea__text{margin:0}._14437cfb77831647__heading-2xl{--_gcd-heading-font-size:var(--wpds-typography-font-size-2xl,32px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-medium,499);--_gcd-p-font-size:var(--wpds-typography-font-size-2xl,32px);--_gcd-p-line-height:var(--wpds-typography-line-height-2xl,40px);font-size:var(--wpds-typography-font-size-2xl,32px);line-height:var(--wpds-typography-line-height-2xl,40px)}._14437cfb77831647__heading-2xl,._3c78b7fa9b4072dd__heading-xl{font-family:var(--wpds-typography-font-family-heading,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-weight:var(--wpds-typography-font-weight-medium,499)}._3c78b7fa9b4072dd__heading-xl{--_gcd-heading-font-size:var(--wpds-typography-font-size-xl,20px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-medium,499);--_gcd-p-font-size:var(--wpds-typography-font-size-xl,20px);--_gcd-p-line-height:var(--wpds-typography-line-height-md,24px);font-size:var(--wpds-typography-font-size-xl,20px);line-height:var(--wpds-typography-line-height-md,24px)}.aa58f227716bcde2__heading-lg{--_gcd-heading-font-size:var(--wpds-typography-font-size-lg,15px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-medium,499);--_gcd-p-font-size:var(--wpds-typography-font-size-lg,15px);--_gcd-p-line-height:var(--wpds-typography-line-height-sm,20px);font-size:var(--wpds-typography-font-size-lg,15px)}.aa58f227716bcde2__heading-lg,.fc4da56d8dfe52c4__heading-md{font-family:var(--wpds-typography-font-family-heading,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-weight:var(--wpds-typography-font-weight-medium,499);line-height:var(--wpds-typography-line-height-sm,20px)}.fc4da56d8dfe52c4__heading-md{--_gcd-heading-font-size:var(--wpds-typography-font-size-md,13px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-medium,499);--_gcd-p-font-size:var(--wpds-typography-font-size-md,13px);--_gcd-p-line-height:var(--wpds-typography-line-height-sm,20px);font-size:var(--wpds-typography-font-size-md,13px)}.a9b78c7c82e8dff7__heading-sm{--_gcd-heading-font-size:var(--wpds-typography-font-size-xs,11px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-medium,499);--_gcd-p-font-size:var(--wpds-typography-font-size-xs,11px);--_gcd-p-line-height:var(--wpds-typography-line-height-xs,16px);font-family:var(--wpds-typography-font-family-heading,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wpds-typography-font-size-xs,11px);font-weight:var(--wpds-typography-font-weight-medium,499);line-height:var(--wpds-typography-line-height-xs,16px);text-transform:uppercase}._305ff559e52180d5__body-xl{--_gcd-heading-font-size:var(--wpds-typography-font-size-xl,20px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-regular,400);--_gcd-p-font-size:var(--wpds-typography-font-size-xl,20px);--_gcd-p-line-height:var(--wpds-typography-line-height-xl,32px);font-size:var(--wpds-typography-font-size-xl,20px);line-height:var(--wpds-typography-line-height-xl,32px)}._305ff559e52180d5__body-xl,.ca1aa3fc2029e958__body-lg{font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-weight:var(--wpds-typography-font-weight-regular,400)}.ca1aa3fc2029e958__body-lg{--_gcd-heading-font-size:var(--wpds-typography-font-size-lg,15px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-regular,400);--_gcd-p-font-size:var(--wpds-typography-font-size-lg,15px);--_gcd-p-line-height:var(--wpds-typography-line-height-md,24px);font-size:var(--wpds-typography-font-size-lg,15px);line-height:var(--wpds-typography-line-height-md,24px)}._131101940be12424__body-md{--_gcd-heading-font-size:var(--wpds-typography-font-size-md,13px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-regular,400);--_gcd-p-font-size:var(--wpds-typography-font-size-md,13px);--_gcd-p-line-height:var(--wpds-typography-line-height-sm,20px);font-size:var(--wpds-typography-font-size-md,13px);line-height:var(--wpds-typography-line-height-sm,20px)}._0e8d87a42c1f75fa__body-sm,._131101940be12424__body-md{font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-weight:var(--wpds-typography-font-weight-regular,400)}._0e8d87a42c1f75fa__body-sm{--_gcd-heading-font-size:var(--wpds-typography-font-size-sm,12px);--_gcd-heading-font-weight:var(--wpds-typography-font-weight-regular,400);--_gcd-p-font-size:var(--wpds-typography-font-size-sm,12px);--_gcd-p-line-height:var(--wpds-typography-line-height-xs,16px);font-size:var(--wpds-typography-font-size-sm,12px);line-height:var(--wpds-typography-line-height-xs,16px)}}}'); |
| 15443 |
} |
| 15444 |
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" }; |
| 15445 |
if (typeof process === "undefined" || true) { |
| 15446 |
registerStyle("d390e935a7", "._6defc79820e382c6__button{box-sizing:var(--_gcd-button-box-sizing,border-box);font-family:var(--_gcd-button-font-family,inherit);font-size:var(--_gcd-button-font-size,inherit);font-weight:var(--_gcd-button-font-weight,inherit)}.d2cff2e5dea83bd1__input{box-sizing:var(--_gcd-input-box-sizing,border-box);font-family:var(--_gcd-input-font-family,inherit);font-size:var(--_gcd-input-font-size,inherit);font-weight:var(--_gcd-input-font-weight,inherit);margin:var(--_gcd-input-margin,0);&:is(textarea,[type=text],[type=password],[type=color],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){background-color:var(--_gcd-input-background-color,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))}&::placeholder{color:var(--_gcd-input-placeholder-color,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-medium,499));margin:var(--_gcd-heading-margin,0)}._2c0831b0499dbd6e__a,._2c0831b0499dbd6e__a:is(:hover,:focus,:active){border-radius:var(--_gcd-a-border-radius,0);box-shadow:var(--_gcd-a-box-shadow,none);color:var(--_gcd-a-color,inherit);outline:var(--_gcd-a-outline,0 solid transparent);transition:var(--_gcd-a-transition,none)}"); |
| 15447 |
} |
| 15448 |
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" }; |
| 15449 |
var Text = (0, import_element16.forwardRef)(function Text2({ variant = "body-md", render, className, ...props }, ref) { |
| 15450 |
const element = useRender({ |
| 15451 |
render, |
| 15452 |
defaultTagName: "span", |
| 15453 |
ref, |
| 15454 |
props: mergeProps(props, { |
| 15455 |
className: clsx_default( |
| 15456 |
style_default.text, |
| 15457 |
global_css_defense_default.heading, |
| 15458 |
global_css_defense_default.p, |
| 15459 |
style_default[variant], |
| 15460 |
className |
| 15461 |
) |
| 15462 |
}) |
| 15463 |
}); |
| 15464 |
return element; |
| 15465 |
}); |
| 15466 |
|
| 15467 |
// packages/ui/build-module/button/button.mjs |
| 15468 |
var import_element17 = __toESM(require_element(), 1); |
| 15469 |
var import_i18n = __toESM(require_i18n(), 1); |
| 15470 |
var import_jsx_runtime38 = __toESM(require_jsx_runtime(), 1); |
| 15471 |
import { speak } from "@wordpress/a11y"; |
| 15472 |
var STYLE_HASH_ATTRIBUTE2 = "data-wp-hash"; |
| 15473 |
function getRuntime2() { |
| 15474 |
const globalScope = globalThis; |
| 15475 |
if (globalScope.__wpStyleRuntime) { |
| 15476 |
return globalScope.__wpStyleRuntime; |
| 15477 |
} |
| 15478 |
globalScope.__wpStyleRuntime = { |
| 15479 |
documents: /* @__PURE__ */ new Map(), |
| 15480 |
styles: /* @__PURE__ */ new Map(), |
| 15481 |
injectedStyles: /* @__PURE__ */ new WeakMap() |
| 15482 |
}; |
| 15483 |
if (typeof document !== "undefined") { |
| 15484 |
registerDocument2(document); |
| 15485 |
} |
| 15486 |
return globalScope.__wpStyleRuntime; |
| 15487 |
} |
| 15488 |
function documentContainsStyleHash2(targetDocument, hash) { |
| 15489 |
if (!targetDocument.head) { |
| 15490 |
return false; |
| 15491 |
} |
| 15492 |
for (const style of targetDocument.head.querySelectorAll( |
| 15493 |
`style[${STYLE_HASH_ATTRIBUTE2}]` |
| 15494 |
)) { |
| 15495 |
if (style.getAttribute(STYLE_HASH_ATTRIBUTE2) === hash) { |
| 15496 |
return true; |
| 15497 |
} |
| 15498 |
} |
| 15499 |
return false; |
| 15500 |
} |
| 15501 |
function injectStyle2(targetDocument, hash, css) { |
| 15502 |
if (!targetDocument.head) { |
| 15503 |
return; |
| 15504 |
} |
| 15505 |
const runtime = getRuntime2(); |
| 15506 |
let injectedStyles = runtime.injectedStyles.get(targetDocument); |
| 15507 |
if (!injectedStyles) { |
| 15508 |
injectedStyles = /* @__PURE__ */ new Set(); |
| 15509 |
runtime.injectedStyles.set(targetDocument, injectedStyles); |
| 15510 |
} |
| 15511 |
if (injectedStyles.has(hash)) { |
| 15512 |
return; |
| 15513 |
} |
| 15514 |
if (documentContainsStyleHash2(targetDocument, hash)) { |
| 15515 |
injectedStyles.add(hash); |
| 15516 |
return; |
| 15517 |
} |
| 15518 |
const style = targetDocument.createElement("style"); |
| 15519 |
style.setAttribute(STYLE_HASH_ATTRIBUTE2, hash); |
| 15520 |
style.appendChild(targetDocument.createTextNode(css)); |
| 15521 |
targetDocument.head.appendChild(style); |
| 15522 |
injectedStyles.add(hash); |
| 15523 |
} |
| 15524 |
function registerDocument2(targetDocument) { |
| 15525 |
const runtime = getRuntime2(); |
| 15526 |
runtime.documents.set( |
| 15527 |
targetDocument, |
| 15528 |
(runtime.documents.get(targetDocument) ?? 0) + 1 |
| 15529 |
); |
| 15530 |
for (const [hash, css] of runtime.styles) { |
| 15531 |
injectStyle2(targetDocument, hash, css); |
| 15532 |
} |
| 15533 |
return () => { |
| 15534 |
const count = runtime.documents.get(targetDocument); |
| 15535 |
if (count === void 0) { |
| 15536 |
return; |
| 15537 |
} |
| 15538 |
if (count <= 1) { |
| 15539 |
runtime.documents.delete(targetDocument); |
| 15540 |
return; |
| 15541 |
} |
| 15542 |
runtime.documents.set(targetDocument, count - 1); |
| 15543 |
}; |
| 15544 |
} |
| 15545 |
function registerStyle2(hash, css) { |
| 15546 |
const runtime = getRuntime2(); |
| 15547 |
runtime.styles.set(hash, css); |
| 15548 |
for (const targetDocument of runtime.documents.keys()) { |
| 15549 |
injectStyle2(targetDocument, hash, css); |
| 15550 |
} |
| 15551 |
} |
| 15552 |
if (typeof process === "undefined" || true) { |
| 15553 |
registerStyle2("4c317b0736", '@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-medium,499);--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:padding-box;background-color:var(--wp-ui-button-background-color);border-color:var(--wp-ui-button-border-color);border-radius:var(--wpds-border-radius-sm,2px);border-style:solid;border-width:1px;color:var(--wp-ui-button-foreground-color);display:inline-flex;font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wp-ui-button-font-size);font-weight:var(--wp-ui-button-font-weight);gap:var(--wpds-dimension-gap-sm,8px);justify-content:center;line-height:var(--wpds-typography-line-height-sm,20px);max-width:100%;min-height:var(--wp-ui-button-height);min-width:var(--wp-ui-button-min-width);overflow-wrap:anywhere;padding-block:var(--wp-ui-button-padding-block);padding-inline:var(--wp-ui-button-padding-inline);position:relative;text-align:center;text-decoration:none;&:not([data-disabled]){cursor:var(--wpds-cursor-control,pointer)}@media not (prefers-reduced-motion){transition:color .1s ease-out;*{transition:opacity .1s ease-out}}&[href]{cursor:pointer}[href]{color:inherit;text-decoration:inherit}&:not([data-disabled]):is(:hover,:active,:focus){background-color:var(--wp-ui-button-background-color-active);border-color:var(--wp-ui-button-border-color-active);color:var(--wp-ui-button-foreground-color-active)}&[data-disabled]:not(._914b42f315c0e580__is-loading){background-color:var(--wp-ui-button-background-color-disabled);border-color:var(--wp-ui-button-border-color-disabled);color:var(--wp-ui-button-foreground-color-disabled);@media (forced-colors:active){border-bottom-color:GrayText;border-left-color:GrayText;border-right-color:GrayText;border-top-color:GrayText;color:GrayText}}&:before{aspect-ratio:1;border:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid;border-block-end-color: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);inset-inline-start:50%;opacity:0;pointer-events:none;position:absolute;top:50%;transform:translate(-50%,-50%);@media not (prefers-reduced-motion){transition:opacity .1s ease-out}@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:0;--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)}}}'); |
| 15554 |
} |
| 15555 |
var style_default2 = { "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" }; |
| 15556 |
if (typeof process === "undefined" || true) { |
| 15557 |
registerStyle2("10f3806643", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._336cd3e4e743482f__box-sizing{box-sizing:border-box;*,:after,:before{box-sizing:inherit}}}}"); |
| 15558 |
} |
| 15559 |
var resets_default = { "box-sizing": "_336cd3e4e743482f__box-sizing" }; |
| 15560 |
if (typeof process === "undefined" || true) { |
| 15561 |
registerStyle2("5f8e7aa0bc", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._08e8a2e44959f892__outset-ring--focus:focus,._970d04df7376df67__outset-ring--focus-within-except-active:focus-within:not(:has(:active)),.c5cb3ee4bddaa8e4__outset-ring--focus-within-visible:focus-within:has(:focus-visible),.cd83dfc2126a0846__outset-ring--focus-within:focus-within,.d0541bc9dd9dc7b6__outset-ring--focus-visible:focus-visible,.e25b2bdd7aa21721__outset-ring--focus-except-active:focus:not(:active),:focus-visible .ecadb9e080e2dfa5__outset-ring--focus-parent-visible{--_gcd-a-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9));--_gcd-div-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9));outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9));outline-offset:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px))}}}"); |
| 15562 |
} |
| 15563 |
var focus_default = { "outset-ring--focus": "_08e8a2e44959f892__outset-ring--focus", "outset-ring--focus-except-active": "e25b2bdd7aa21721__outset-ring--focus-except-active", "outset-ring--focus-visible": "d0541bc9dd9dc7b6__outset-ring--focus-visible", "outset-ring--focus-within": "cd83dfc2126a0846__outset-ring--focus-within", "outset-ring--focus-within-except-active": "_970d04df7376df67__outset-ring--focus-within-except-active", "outset-ring--focus-within-visible": "c5cb3ee4bddaa8e4__outset-ring--focus-within-visible", "outset-ring--focus-parent-visible": "ecadb9e080e2dfa5__outset-ring--focus-parent-visible" }; |
| 15564 |
if (typeof process === "undefined" || true) { |
| 15565 |
registerStyle2("d390e935a7", "._6defc79820e382c6__button{box-sizing:var(--_gcd-button-box-sizing,border-box);font-family:var(--_gcd-button-font-family,inherit);font-size:var(--_gcd-button-font-size,inherit);font-weight:var(--_gcd-button-font-weight,inherit)}.d2cff2e5dea83bd1__input{box-sizing:var(--_gcd-input-box-sizing,border-box);font-family:var(--_gcd-input-font-family,inherit);font-size:var(--_gcd-input-font-size,inherit);font-weight:var(--_gcd-input-font-weight,inherit);margin:var(--_gcd-input-margin,0);&:is(textarea,[type=text],[type=password],[type=color],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){background-color:var(--_gcd-input-background-color,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))}&::placeholder{color:var(--_gcd-input-placeholder-color,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-medium,499));margin:var(--_gcd-heading-margin,0)}._2c0831b0499dbd6e__a,._2c0831b0499dbd6e__a:is(:hover,:focus,:active){border-radius:var(--_gcd-a-border-radius,0);box-shadow:var(--_gcd-a-box-shadow,none);color:var(--_gcd-a-color,inherit);outline:var(--_gcd-a-outline,0 solid transparent);transition:var(--_gcd-a-transition,none)}"); |
| 15566 |
} |
| 15567 |
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" }; |
| 15568 |
var Button3 = (0, import_element17.forwardRef)( |
| 15569 |
function Button22({ |
| 15570 |
tone = "brand", |
| 15571 |
variant = "solid", |
| 15572 |
size: size4 = "default", |
| 15573 |
className, |
| 15574 |
focusableWhenDisabled = true, |
| 15575 |
disabled: disabled2, |
| 15576 |
loading, |
| 15577 |
loadingAnnouncement = (0, import_i18n.__)("Loading"), |
| 15578 |
children, |
| 15579 |
...props |
| 15580 |
}, ref) { |
| 15581 |
const mergedClassName = clsx_default( |
| 15582 |
global_css_defense_default2.button, |
| 15583 |
resets_default["box-sizing"], |
| 15584 |
focus_default["outset-ring--focus-except-active"], |
| 15585 |
variant !== "unstyled" && style_default2.button, |
| 15586 |
style_default2[`is-${tone}`], |
| 15587 |
style_default2[`is-${variant}`], |
| 15588 |
style_default2[`is-${size4}`], |
| 15589 |
loading && style_default2["is-loading"], |
| 15590 |
className |
| 15591 |
); |
| 15592 |
(0, import_element17.useEffect)(() => { |
| 15593 |
if (loading && loadingAnnouncement) { |
| 15594 |
speak(loadingAnnouncement); |
| 15595 |
} |
| 15596 |
}, [loading, loadingAnnouncement]); |
| 15597 |
return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)( |
| 15598 |
Button, |
| 15599 |
{ |
| 15600 |
ref, |
| 15601 |
className: mergedClassName, |
| 15602 |
focusableWhenDisabled, |
| 15603 |
disabled: disabled2 ?? loading, |
| 15604 |
...props, |
| 15605 |
children |
| 15606 |
} |
| 15607 |
); |
| 15608 |
} |
| 15609 |
); |
| 15610 |
|
| 15611 |
// packages/ui/build-module/button/icon.mjs |
| 15612 |
var import_element19 = __toESM(require_element(), 1); |
| 15613 |
|
| 15614 |
// packages/ui/build-module/icon/icon.mjs |
| 15615 |
var import_element18 = __toESM(require_element(), 1); |
| 15616 |
var import_primitives4 = __toESM(require_primitives(), 1); |
| 15617 |
var import_jsx_runtime39 = __toESM(require_jsx_runtime(), 1); |
| 15618 |
var Icon = (0, import_element18.forwardRef)(function Icon2({ icon, size: size4 = 24, ...restProps }, ref) { |
| 15619 |
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)( |
| 15620 |
import_primitives4.SVG, |
| 15621 |
{ |
| 15622 |
ref, |
| 15623 |
...icon.props, |
| 15624 |
...restProps, |
| 15625 |
width: size4, |
| 15626 |
height: size4 |
| 15627 |
} |
| 15628 |
); |
| 15629 |
}); |
| 15630 |
|
| 15631 |
// packages/ui/build-module/button/icon.mjs |
| 15632 |
var import_jsx_runtime40 = __toESM(require_jsx_runtime(), 1); |
| 15633 |
var STYLE_HASH_ATTRIBUTE3 = "data-wp-hash"; |
| 15634 |
function getRuntime3() { |
| 15635 |
const globalScope = globalThis; |
| 15636 |
if (globalScope.__wpStyleRuntime) { |
| 15637 |
return globalScope.__wpStyleRuntime; |
| 15638 |
} |
| 15639 |
globalScope.__wpStyleRuntime = { |
| 15640 |
documents: /* @__PURE__ */ new Map(), |
| 15641 |
styles: /* @__PURE__ */ new Map(), |
| 15642 |
injectedStyles: /* @__PURE__ */ new WeakMap() |
| 15643 |
}; |
| 15644 |
if (typeof document !== "undefined") { |
| 15645 |
registerDocument3(document); |
| 15646 |
} |
| 15647 |
return globalScope.__wpStyleRuntime; |
| 15648 |
} |
| 15649 |
function documentContainsStyleHash3(targetDocument, hash) { |
| 15650 |
if (!targetDocument.head) { |
| 15651 |
return false; |
| 15652 |
} |
| 15653 |
for (const style of targetDocument.head.querySelectorAll( |
| 15654 |
`style[${STYLE_HASH_ATTRIBUTE3}]` |
| 15655 |
)) { |
| 15656 |
if (style.getAttribute(STYLE_HASH_ATTRIBUTE3) === hash) { |
| 15657 |
return true; |
| 15658 |
} |
| 15659 |
} |
| 15660 |
return false; |
| 15661 |
} |
| 15662 |
function injectStyle3(targetDocument, hash, css) { |
| 15663 |
if (!targetDocument.head) { |
| 15664 |
return; |
| 15665 |
} |
| 15666 |
const runtime = getRuntime3(); |
| 15667 |
let injectedStyles = runtime.injectedStyles.get(targetDocument); |
| 15668 |
if (!injectedStyles) { |
| 15669 |
injectedStyles = /* @__PURE__ */ new Set(); |
| 15670 |
runtime.injectedStyles.set(targetDocument, injectedStyles); |
| 15671 |
} |
| 15672 |
if (injectedStyles.has(hash)) { |
| 15673 |
return; |
| 15674 |
} |
| 15675 |
if (documentContainsStyleHash3(targetDocument, hash)) { |
| 15676 |
injectedStyles.add(hash); |
| 15677 |
return; |
| 15678 |
} |
| 15679 |
const style = targetDocument.createElement("style"); |
| 15680 |
style.setAttribute(STYLE_HASH_ATTRIBUTE3, hash); |
| 15681 |
style.appendChild(targetDocument.createTextNode(css)); |
| 15682 |
targetDocument.head.appendChild(style); |
| 15683 |
injectedStyles.add(hash); |
| 15684 |
} |
| 15685 |
function registerDocument3(targetDocument) { |
| 15686 |
const runtime = getRuntime3(); |
| 15687 |
runtime.documents.set( |
| 15688 |
targetDocument, |
| 15689 |
(runtime.documents.get(targetDocument) ?? 0) + 1 |
| 15690 |
); |
| 15691 |
for (const [hash, css] of runtime.styles) { |
| 15692 |
injectStyle3(targetDocument, hash, css); |
| 15693 |
} |
| 15694 |
return () => { |
| 15695 |
const count = runtime.documents.get(targetDocument); |
| 15696 |
if (count === void 0) { |
| 15697 |
return; |
| 15698 |
} |
| 15699 |
if (count <= 1) { |
| 15700 |
runtime.documents.delete(targetDocument); |
| 15701 |
return; |
| 15702 |
} |
| 15703 |
runtime.documents.set(targetDocument, count - 1); |
| 15704 |
}; |
| 15705 |
} |
| 15706 |
function registerStyle3(hash, css) { |
| 15707 |
const runtime = getRuntime3(); |
| 15708 |
runtime.styles.set(hash, css); |
| 15709 |
for (const targetDocument of runtime.documents.keys()) { |
| 15710 |
injectStyle3(targetDocument, hash, css); |
| 15711 |
} |
| 15712 |
} |
| 15713 |
if (typeof process === "undefined" || true) { |
| 15714 |
registerStyle3("4c317b0736", '@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-medium,499);--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:padding-box;background-color:var(--wp-ui-button-background-color);border-color:var(--wp-ui-button-border-color);border-radius:var(--wpds-border-radius-sm,2px);border-style:solid;border-width:1px;color:var(--wp-ui-button-foreground-color);display:inline-flex;font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wp-ui-button-font-size);font-weight:var(--wp-ui-button-font-weight);gap:var(--wpds-dimension-gap-sm,8px);justify-content:center;line-height:var(--wpds-typography-line-height-sm,20px);max-width:100%;min-height:var(--wp-ui-button-height);min-width:var(--wp-ui-button-min-width);overflow-wrap:anywhere;padding-block:var(--wp-ui-button-padding-block);padding-inline:var(--wp-ui-button-padding-inline);position:relative;text-align:center;text-decoration:none;&:not([data-disabled]){cursor:var(--wpds-cursor-control,pointer)}@media not (prefers-reduced-motion){transition:color .1s ease-out;*{transition:opacity .1s ease-out}}&[href]{cursor:pointer}[href]{color:inherit;text-decoration:inherit}&:not([data-disabled]):is(:hover,:active,:focus){background-color:var(--wp-ui-button-background-color-active);border-color:var(--wp-ui-button-border-color-active);color:var(--wp-ui-button-foreground-color-active)}&[data-disabled]:not(._914b42f315c0e580__is-loading){background-color:var(--wp-ui-button-background-color-disabled);border-color:var(--wp-ui-button-border-color-disabled);color:var(--wp-ui-button-foreground-color-disabled);@media (forced-colors:active){border-bottom-color:GrayText;border-left-color:GrayText;border-right-color:GrayText;border-top-color:GrayText;color:GrayText}}&:before{aspect-ratio:1;border:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid;border-block-end-color: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);inset-inline-start:50%;opacity:0;pointer-events:none;position:absolute;top:50%;transform:translate(-50%,-50%);@media not (prefers-reduced-motion){transition:opacity .1s ease-out}@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:0;--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)}}}'); |
| 15715 |
} |
| 15716 |
var style_default3 = { "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" }; |
| 15717 |
var ButtonIcon = (0, import_element19.forwardRef)( |
| 15718 |
function ButtonIcon2({ className, icon, ...props }, ref) { |
| 15719 |
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)( |
| 15720 |
Icon, |
| 15721 |
{ |
| 15722 |
ref, |
| 15723 |
icon, |
| 15724 |
className: clsx_default(style_default3.icon, className), |
| 15725 |
size: 24, |
| 15726 |
...props |
| 15727 |
} |
| 15728 |
); |
| 15729 |
} |
| 15730 |
); |
| 15731 |
|
| 15732 |
// packages/ui/build-module/button/index.mjs |
| 15733 |
ButtonIcon.displayName = "Button.Icon"; |
| 15734 |
var Button4 = Object.assign(Button3, { |
| 15735 |
/** |
| 15736 |
* An icon component specifically designed to work well when rendered inside |
| 15737 |
* a `Button` component. |
| 15738 |
*/ |
| 15739 |
Icon: ButtonIcon |
| 15740 |
}); |
| 15741 |
|
| 15742 |
// packages/ui/build-module/utils/render-slot-with-children.mjs |
| 15743 |
var import_element20 = __toESM(require_element(), 1); |
| 15744 |
function renderSlotWithChildren(slot, defaultSlot, children) { |
| 15745 |
return (0, import_element20.cloneElement)(slot ?? defaultSlot, { children }); |
| 15746 |
} |
| 15747 |
|
| 15748 |
// packages/ui/build-module/utils/theme-provider.mjs |
| 15749 |
var theme = __toESM(require_theme(), 1); |
| 15750 |
|
| 15751 |
// packages/ui/build-module/lock-unlock.mjs |
| 15752 |
var import_private_apis = __toESM(require_private_apis(), 1); |
| 15753 |
var { lock, unlock } = (0, import_private_apis.__dangerousOptInToUnstableAPIsOnlyForCoreModules)( |
| 15754 |
"I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.", |
| 15755 |
"@wordpress/ui" |
| 15756 |
); |
| 15757 |
|
| 15758 |
// packages/ui/build-module/utils/theme-provider.mjs |
| 15759 |
function getThemeProvider() { |
| 15760 |
const themePackage = theme; |
| 15761 |
if (themePackage.ThemeProvider) { |
| 15762 |
return themePackage.ThemeProvider; |
| 15763 |
} |
| 15764 |
if (!themePackage.privateApis) { |
| 15765 |
throw new Error( |
| 15766 |
"@wordpress/ui: @wordpress/theme must expose `ThemeProvider` or `privateApis.ThemeProvider`." |
| 15767 |
); |
| 15768 |
} |
| 15769 |
return unlock( |
| 15770 |
themePackage.privateApis |
| 15771 |
).ThemeProvider; |
| 15772 |
} |
| 15773 |
var ThemeProvider = getThemeProvider(); |
| 15774 |
|
| 15775 |
// packages/ui/build-module/stack/stack.mjs |
| 15776 |
var import_element21 = __toESM(require_element(), 1); |
| 15777 |
var STYLE_HASH_ATTRIBUTE4 = "data-wp-hash"; |
| 15778 |
function getRuntime4() { |
| 15779 |
const globalScope = globalThis; |
| 15780 |
if (globalScope.__wpStyleRuntime) { |
| 15781 |
return globalScope.__wpStyleRuntime; |
| 15782 |
} |
| 15783 |
globalScope.__wpStyleRuntime = { |
| 15784 |
documents: /* @__PURE__ */ new Map(), |
| 15785 |
styles: /* @__PURE__ */ new Map(), |
| 15786 |
injectedStyles: /* @__PURE__ */ new WeakMap() |
| 15787 |
}; |
| 15788 |
if (typeof document !== "undefined") { |
| 15789 |
registerDocument4(document); |
| 15790 |
} |
| 15791 |
return globalScope.__wpStyleRuntime; |
| 15792 |
} |
| 15793 |
function documentContainsStyleHash4(targetDocument, hash) { |
| 15794 |
if (!targetDocument.head) { |
| 15795 |
return false; |
| 15796 |
} |
| 15797 |
for (const style of targetDocument.head.querySelectorAll( |
| 15798 |
`style[${STYLE_HASH_ATTRIBUTE4}]` |
| 15799 |
)) { |
| 15800 |
if (style.getAttribute(STYLE_HASH_ATTRIBUTE4) === hash) { |
| 15801 |
return true; |
| 15802 |
} |
| 15803 |
} |
| 15804 |
return false; |
| 15805 |
} |
| 15806 |
function injectStyle4(targetDocument, hash, css) { |
| 15807 |
if (!targetDocument.head) { |
| 15808 |
return; |
| 15809 |
} |
| 15810 |
const runtime = getRuntime4(); |
| 15811 |
let injectedStyles = runtime.injectedStyles.get(targetDocument); |
| 15812 |
if (!injectedStyles) { |
| 15813 |
injectedStyles = /* @__PURE__ */ new Set(); |
| 15814 |
runtime.injectedStyles.set(targetDocument, injectedStyles); |
| 15815 |
} |
| 15816 |
if (injectedStyles.has(hash)) { |
| 15817 |
return; |
| 15818 |
} |
| 15819 |
if (documentContainsStyleHash4(targetDocument, hash)) { |
| 15820 |
injectedStyles.add(hash); |
| 15821 |
return; |
| 15822 |
} |
| 15823 |
const style = targetDocument.createElement("style"); |
| 15824 |
style.setAttribute(STYLE_HASH_ATTRIBUTE4, hash); |
| 15825 |
style.appendChild(targetDocument.createTextNode(css)); |
| 15826 |
targetDocument.head.appendChild(style); |
| 15827 |
injectedStyles.add(hash); |
| 15828 |
} |
| 15829 |
function registerDocument4(targetDocument) { |
| 15830 |
const runtime = getRuntime4(); |
| 15831 |
runtime.documents.set( |
| 15832 |
targetDocument, |
| 15833 |
(runtime.documents.get(targetDocument) ?? 0) + 1 |
| 15834 |
); |
| 15835 |
for (const [hash, css] of runtime.styles) { |
| 15836 |
injectStyle4(targetDocument, hash, css); |
| 15837 |
} |
| 15838 |
return () => { |
| 15839 |
const count = runtime.documents.get(targetDocument); |
| 15840 |
if (count === void 0) { |
| 15841 |
return; |
| 15842 |
} |
| 15843 |
if (count <= 1) { |
| 15844 |
runtime.documents.delete(targetDocument); |
| 15845 |
return; |
| 15846 |
} |
| 15847 |
runtime.documents.set(targetDocument, count - 1); |
| 15848 |
}; |
| 15849 |
} |
| 15850 |
function registerStyle4(hash, css) { |
| 15851 |
const runtime = getRuntime4(); |
| 15852 |
runtime.styles.set(hash, css); |
| 15853 |
for (const targetDocument of runtime.documents.keys()) { |
| 15854 |
injectStyle4(targetDocument, hash, css); |
| 15855 |
} |
| 15856 |
} |
| 15857 |
if (typeof process === "undefined" || true) { |
| 15858 |
registerStyle4("32aba35fe1", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._19ce0419607e1896__stack{display:flex}}}"); |
| 15859 |
} |
| 15860 |
var style_default4 = { "stack": "_19ce0419607e1896__stack" }; |
| 15861 |
var gapTokens = { |
| 15862 |
xs: "var(--wpds-dimension-gap-xs, 4px)", |
| 15863 |
sm: "var(--wpds-dimension-gap-sm, 8px)", |
| 15864 |
md: "var(--wpds-dimension-gap-md, 12px)", |
| 15865 |
lg: "var(--wpds-dimension-gap-lg, 16px)", |
| 15866 |
xl: "var(--wpds-dimension-gap-xl, 24px)", |
| 15867 |
"2xl": "var(--wpds-dimension-gap-2xl, 32px)", |
| 15868 |
"3xl": "var(--wpds-dimension-gap-3xl, 40px)" |
| 15869 |
}; |
| 15870 |
var Stack = (0, import_element21.forwardRef)(function Stack2({ direction, gap, align, justify, wrap, render, ...props }, ref) { |
| 15871 |
const style = { |
| 15872 |
gap: gap && gapTokens[gap], |
| 15873 |
alignItems: align, |
| 15874 |
justifyContent: justify, |
| 15875 |
flexDirection: direction, |
| 15876 |
flexWrap: wrap |
| 15877 |
}; |
| 15878 |
const element = useRender({ |
| 15879 |
render, |
| 15880 |
ref, |
| 15881 |
props: mergeProps(props, { style, className: style_default4.stack }) |
| 15882 |
}); |
| 15883 |
return element; |
| 15884 |
}); |
| 15885 |
|
| 15886 |
// packages/ui/build-module/icon-button/icon-button.mjs |
| 15887 |
var import_element26 = __toESM(require_element(), 1); |
| 15888 |
|
| 15889 |
// packages/ui/build-module/tooltip/popup.mjs |
| 15890 |
var import_element24 = __toESM(require_element(), 1); |
| 15891 |
|
| 15892 |
// packages/ui/build-module/tooltip/portal.mjs |
| 15893 |
var import_element22 = __toESM(require_element(), 1); |
| 15894 |
|
| 15895 |
// packages/ui/build-module/utils/wp-compat-overlay-slot.mjs |
| 15896 |
var STYLE_HASH_ATTRIBUTE5 = "data-wp-hash"; |
| 15897 |
function getRuntime5() { |
| 15898 |
const globalScope = globalThis; |
| 15899 |
if (globalScope.__wpStyleRuntime) { |
| 15900 |
return globalScope.__wpStyleRuntime; |
| 15901 |
} |
| 15902 |
globalScope.__wpStyleRuntime = { |
| 15903 |
documents: /* @__PURE__ */ new Map(), |
| 15904 |
styles: /* @__PURE__ */ new Map(), |
| 15905 |
injectedStyles: /* @__PURE__ */ new WeakMap() |
| 15906 |
}; |
| 15907 |
if (typeof document !== "undefined") { |
| 15908 |
registerDocument5(document); |
| 15909 |
} |
| 15910 |
return globalScope.__wpStyleRuntime; |
| 15911 |
} |
| 15912 |
function documentContainsStyleHash5(targetDocument, hash) { |
| 15913 |
if (!targetDocument.head) { |
| 15914 |
return false; |
| 15915 |
} |
| 15916 |
for (const style of targetDocument.head.querySelectorAll( |
| 15917 |
`style[${STYLE_HASH_ATTRIBUTE5}]` |
| 15918 |
)) { |
| 15919 |
if (style.getAttribute(STYLE_HASH_ATTRIBUTE5) === hash) { |
| 15920 |
return true; |
| 15921 |
} |
| 15922 |
} |
| 15923 |
return false; |
| 15924 |
} |
| 15925 |
function injectStyle5(targetDocument, hash, css) { |
| 15926 |
if (!targetDocument.head) { |
| 15927 |
return; |
| 15928 |
} |
| 15929 |
const runtime = getRuntime5(); |
| 15930 |
let injectedStyles = runtime.injectedStyles.get(targetDocument); |
| 15931 |
if (!injectedStyles) { |
| 15932 |
injectedStyles = /* @__PURE__ */ new Set(); |
| 15933 |
runtime.injectedStyles.set(targetDocument, injectedStyles); |
| 15934 |
} |
| 15935 |
if (injectedStyles.has(hash)) { |
| 15936 |
return; |
| 15937 |
} |
| 15938 |
if (documentContainsStyleHash5(targetDocument, hash)) { |
| 15939 |
injectedStyles.add(hash); |
| 15940 |
return; |
| 15941 |
} |
| 15942 |
const style = targetDocument.createElement("style"); |
| 15943 |
style.setAttribute(STYLE_HASH_ATTRIBUTE5, hash); |
| 15944 |
style.appendChild(targetDocument.createTextNode(css)); |
| 15945 |
targetDocument.head.appendChild(style); |
| 15946 |
injectedStyles.add(hash); |
| 15947 |
} |
| 15948 |
function registerDocument5(targetDocument) { |
| 15949 |
const runtime = getRuntime5(); |
| 15950 |
runtime.documents.set( |
| 15951 |
targetDocument, |
| 15952 |
(runtime.documents.get(targetDocument) ?? 0) + 1 |
| 15953 |
); |
| 15954 |
for (const [hash, css] of runtime.styles) { |
| 15955 |
injectStyle5(targetDocument, hash, css); |
| 15956 |
} |
| 15957 |
return () => { |
| 15958 |
const count = runtime.documents.get(targetDocument); |
| 15959 |
if (count === void 0) { |
| 15960 |
return; |
| 15961 |
} |
| 15962 |
if (count <= 1) { |
| 15963 |
runtime.documents.delete(targetDocument); |
| 15964 |
return; |
| 15965 |
} |
| 15966 |
runtime.documents.set(targetDocument, count - 1); |
| 15967 |
}; |
| 15968 |
} |
| 15969 |
function registerStyle5(hash, css) { |
| 15970 |
const runtime = getRuntime5(); |
| 15971 |
runtime.styles.set(hash, css); |
| 15972 |
for (const targetDocument of runtime.documents.keys()) { |
| 15973 |
injectStyle5(targetDocument, hash, css); |
| 15974 |
} |
| 15975 |
} |
| 15976 |
if (typeof process === "undefined" || true) { |
| 15977 |
registerStyle5("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}}}"); |
| 15978 |
} |
| 15979 |
var wp_compat_overlay_slot_default = { "slot": "_11fc52b637ff8a7e__slot" }; |
| 15980 |
var WP_COMPAT_OVERLAY_SLOT_ATTRIBUTE = "data-wp-compat-overlay-slot"; |
| 15981 |
function resolveOwnerDocument() { |
| 15982 |
return typeof document === "undefined" ? null : document; |
| 15983 |
} |
| 15984 |
function isInWordPressEnvironment() { |
| 15985 |
let topWp; |
| 15986 |
try { |
| 15987 |
topWp = window.top?.wp; |
| 15988 |
} catch { |
| 15989 |
} |
| 15990 |
const wp = topWp ?? window.wp; |
| 15991 |
return typeof wp?.components === "object" && wp.components !== null; |
| 15992 |
} |
| 15993 |
var cachedSlot = null; |
| 15994 |
function createSlot(ownerDocument2) { |
| 15995 |
const element = ownerDocument2.createElement("div"); |
| 15996 |
element.setAttribute(WP_COMPAT_OVERLAY_SLOT_ATTRIBUTE, ""); |
| 15997 |
if (wp_compat_overlay_slot_default.slot) { |
| 15998 |
element.classList.add(wp_compat_overlay_slot_default.slot); |
| 15999 |
} |
| 16000 |
ownerDocument2.body.appendChild(element); |
| 16001 |
return element; |
| 16002 |
} |
| 16003 |
function getWpCompatOverlaySlot() { |
| 16004 |
if (typeof window === "undefined") { |
| 16005 |
return void 0; |
| 16006 |
} |
| 16007 |
if (!isInWordPressEnvironment() && window.__wpUiCompatOverlaySlotEnabled !== true) { |
| 16008 |
return void 0; |
| 16009 |
} |
| 16010 |
const ownerDocument2 = resolveOwnerDocument(); |
| 16011 |
if (!ownerDocument2 || !ownerDocument2.body) { |
| 16012 |
return void 0; |
| 16013 |
} |
| 16014 |
if (cachedSlot && cachedSlot.ownerDocument === ownerDocument2 && cachedSlot.isConnected) { |
| 16015 |
return cachedSlot; |
| 16016 |
} |
| 16017 |
const existing = ownerDocument2.querySelector( |
| 16018 |
`[${WP_COMPAT_OVERLAY_SLOT_ATTRIBUTE}]` |
| 16019 |
); |
| 16020 |
if (existing instanceof HTMLDivElement) { |
| 16021 |
cachedSlot = existing; |
| 16022 |
return existing; |
| 16023 |
} |
| 16024 |
if (cachedSlot?.isConnected) { |
| 16025 |
cachedSlot.remove(); |
| 16026 |
} |
| 16027 |
cachedSlot = createSlot(ownerDocument2); |
| 16028 |
return cachedSlot; |
| 16029 |
} |
| 16030 |
|
| 16031 |
// packages/ui/build-module/tooltip/portal.mjs |
| 16032 |
var import_jsx_runtime41 = __toESM(require_jsx_runtime(), 1); |
| 16033 |
var Portal = (0, import_element22.forwardRef)( |
| 16034 |
function TooltipPortal3({ container, ...restProps }, ref) { |
| 16035 |
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)( |
| 16036 |
index_parts_exports3.Portal, |
| 16037 |
{ |
| 16038 |
container: container ?? getWpCompatOverlaySlot(), |
| 16039 |
...restProps, |
| 16040 |
ref |
| 16041 |
} |
| 16042 |
); |
| 16043 |
} |
| 16044 |
); |
| 16045 |
|
| 16046 |
// packages/ui/build-module/tooltip/positioner.mjs |
| 16047 |
var import_element23 = __toESM(require_element(), 1); |
| 16048 |
var import_jsx_runtime42 = __toESM(require_jsx_runtime(), 1); |
| 16049 |
var STYLE_HASH_ATTRIBUTE6 = "data-wp-hash"; |
| 16050 |
function getRuntime6() { |
| 16051 |
const globalScope = globalThis; |
| 16052 |
if (globalScope.__wpStyleRuntime) { |
| 16053 |
return globalScope.__wpStyleRuntime; |
| 16054 |
} |
| 16055 |
globalScope.__wpStyleRuntime = { |
| 16056 |
documents: /* @__PURE__ */ new Map(), |
| 16057 |
styles: /* @__PURE__ */ new Map(), |
| 16058 |
injectedStyles: /* @__PURE__ */ new WeakMap() |
| 16059 |
}; |
| 16060 |
if (typeof document !== "undefined") { |
| 16061 |
registerDocument6(document); |
| 16062 |
} |
| 16063 |
return globalScope.__wpStyleRuntime; |
| 16064 |
} |
| 16065 |
function documentContainsStyleHash6(targetDocument, hash) { |
| 16066 |
if (!targetDocument.head) { |
| 16067 |
return false; |
| 16068 |
} |
| 16069 |
for (const style of targetDocument.head.querySelectorAll( |
| 16070 |
`style[${STYLE_HASH_ATTRIBUTE6}]` |
| 16071 |
)) { |
| 16072 |
if (style.getAttribute(STYLE_HASH_ATTRIBUTE6) === hash) { |
| 16073 |
return true; |
| 16074 |
} |
| 16075 |
} |
| 16076 |
return false; |
| 16077 |
} |
| 16078 |
function injectStyle6(targetDocument, hash, css) { |
| 16079 |
if (!targetDocument.head) { |
| 16080 |
return; |
| 16081 |
} |
| 16082 |
const runtime = getRuntime6(); |
| 16083 |
let injectedStyles = runtime.injectedStyles.get(targetDocument); |
| 16084 |
if (!injectedStyles) { |
| 16085 |
injectedStyles = /* @__PURE__ */ new Set(); |
| 16086 |
runtime.injectedStyles.set(targetDocument, injectedStyles); |
| 16087 |
} |
| 16088 |
if (injectedStyles.has(hash)) { |
| 16089 |
return; |
| 16090 |
} |
| 16091 |
if (documentContainsStyleHash6(targetDocument, hash)) { |
| 16092 |
injectedStyles.add(hash); |
| 16093 |
return; |
| 16094 |
} |
| 16095 |
const style = targetDocument.createElement("style"); |
| 16096 |
style.setAttribute(STYLE_HASH_ATTRIBUTE6, hash); |
| 16097 |
style.appendChild(targetDocument.createTextNode(css)); |
| 16098 |
targetDocument.head.appendChild(style); |
| 16099 |
injectedStyles.add(hash); |
| 16100 |
} |
| 16101 |
function registerDocument6(targetDocument) { |
| 16102 |
const runtime = getRuntime6(); |
| 16103 |
runtime.documents.set( |
| 16104 |
targetDocument, |
| 16105 |
(runtime.documents.get(targetDocument) ?? 0) + 1 |
| 16106 |
); |
| 16107 |
for (const [hash, css] of runtime.styles) { |
| 16108 |
injectStyle6(targetDocument, hash, css); |
| 16109 |
} |
| 16110 |
return () => { |
| 16111 |
const count = runtime.documents.get(targetDocument); |
| 16112 |
if (count === void 0) { |
| 16113 |
return; |
| 16114 |
} |
| 16115 |
if (count <= 1) { |
| 16116 |
runtime.documents.delete(targetDocument); |
| 16117 |
return; |
| 16118 |
} |
| 16119 |
runtime.documents.set(targetDocument, count - 1); |
| 16120 |
}; |
| 16121 |
} |
| 16122 |
function registerStyle6(hash, css) { |
| 16123 |
const runtime = getRuntime6(); |
| 16124 |
runtime.styles.set(hash, css); |
| 16125 |
for (const targetDocument of runtime.documents.keys()) { |
| 16126 |
injectStyle6(targetDocument, hash, css); |
| 16127 |
} |
| 16128 |
} |
| 16129 |
if (typeof process === "undefined" || true) { |
| 16130 |
registerStyle6("10f3806643", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._336cd3e4e743482f__box-sizing{box-sizing:border-box;*,:after,:before{box-sizing:inherit}}}}"); |
| 16131 |
} |
| 16132 |
var resets_default2 = { "box-sizing": "_336cd3e4e743482f__box-sizing" }; |
| 16133 |
if (typeof process === "undefined" || true) { |
| 16134 |
registerStyle6("789467362f", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._480b748dd3510e64__positioner{z-index:var(--wp-ui-tooltip-z-index,initial)}._50096b232db7709d__popup{background-color:var(--wpds-color-background-surface-neutral-strong,#fff);border-radius:var(--wpds-border-radius-md,4px);box-shadow:var(--wpds-elevation-sm,0 1px 2px 0 #0000000d,0 2px 3px 0 #0000000a,0 6px 6px 0 #00000008,0 8px 8px 0 #00000005);color:var(--wpds-color-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}}}}'); |
| 16135 |
} |
| 16136 |
var style_default5 = { "positioner": "_480b748dd3510e64__positioner", "popup": "_50096b232db7709d__popup" }; |
| 16137 |
var Positioner = (0, import_element23.forwardRef)( |
| 16138 |
function TooltipPositioner3({ align = "center", className, side = "top", sideOffset = 4, ...props }, ref) { |
| 16139 |
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)( |
| 16140 |
index_parts_exports3.Positioner, |
| 16141 |
{ |
| 16142 |
ref, |
| 16143 |
align, |
| 16144 |
side, |
| 16145 |
sideOffset, |
| 16146 |
...props, |
| 16147 |
className: clsx_default( |
| 16148 |
resets_default2["box-sizing"], |
| 16149 |
style_default5.positioner, |
| 16150 |
className |
| 16151 |
) |
| 16152 |
} |
| 16153 |
); |
| 16154 |
} |
| 16155 |
); |
| 16156 |
|
| 16157 |
// packages/ui/build-module/tooltip/popup.mjs |
| 16158 |
var import_jsx_runtime43 = __toESM(require_jsx_runtime(), 1); |
| 16159 |
var STYLE_HASH_ATTRIBUTE7 = "data-wp-hash"; |
| 16160 |
function getRuntime7() { |
| 16161 |
const globalScope = globalThis; |
| 16162 |
if (globalScope.__wpStyleRuntime) { |
| 16163 |
return globalScope.__wpStyleRuntime; |
| 16164 |
} |
| 16165 |
globalScope.__wpStyleRuntime = { |
| 16166 |
documents: /* @__PURE__ */ new Map(), |
| 16167 |
styles: /* @__PURE__ */ new Map(), |
| 16168 |
injectedStyles: /* @__PURE__ */ new WeakMap() |
| 16169 |
}; |
| 16170 |
if (typeof document !== "undefined") { |
| 16171 |
registerDocument7(document); |
| 16172 |
} |
| 16173 |
return globalScope.__wpStyleRuntime; |
| 16174 |
} |
| 16175 |
function documentContainsStyleHash7(targetDocument, hash) { |
| 16176 |
if (!targetDocument.head) { |
| 16177 |
return false; |
| 16178 |
} |
| 16179 |
for (const style of targetDocument.head.querySelectorAll( |
| 16180 |
`style[${STYLE_HASH_ATTRIBUTE7}]` |
| 16181 |
)) { |
| 16182 |
if (style.getAttribute(STYLE_HASH_ATTRIBUTE7) === hash) { |
| 16183 |
return true; |
| 16184 |
} |
| 16185 |
} |
| 16186 |
return false; |
| 16187 |
} |
| 16188 |
function injectStyle7(targetDocument, hash, css) { |
| 16189 |
if (!targetDocument.head) { |
| 16190 |
return; |
| 16191 |
} |
| 16192 |
const runtime = getRuntime7(); |
| 16193 |
let injectedStyles = runtime.injectedStyles.get(targetDocument); |
| 16194 |
if (!injectedStyles) { |
| 16195 |
injectedStyles = /* @__PURE__ */ new Set(); |
| 16196 |
runtime.injectedStyles.set(targetDocument, injectedStyles); |
| 16197 |
} |
| 16198 |
if (injectedStyles.has(hash)) { |
| 16199 |
return; |
| 16200 |
} |
| 16201 |
if (documentContainsStyleHash7(targetDocument, hash)) { |
| 16202 |
injectedStyles.add(hash); |
| 16203 |
return; |
| 16204 |
} |
| 16205 |
const style = targetDocument.createElement("style"); |
| 16206 |
style.setAttribute(STYLE_HASH_ATTRIBUTE7, hash); |
| 16207 |
style.appendChild(targetDocument.createTextNode(css)); |
| 16208 |
targetDocument.head.appendChild(style); |
| 16209 |
injectedStyles.add(hash); |
| 16210 |
} |
| 16211 |
function registerDocument7(targetDocument) { |
| 16212 |
const runtime = getRuntime7(); |
| 16213 |
runtime.documents.set( |
| 16214 |
targetDocument, |
| 16215 |
(runtime.documents.get(targetDocument) ?? 0) + 1 |
| 16216 |
); |
| 16217 |
for (const [hash, css] of runtime.styles) { |
| 16218 |
injectStyle7(targetDocument, hash, css); |
| 16219 |
} |
| 16220 |
return () => { |
| 16221 |
const count = runtime.documents.get(targetDocument); |
| 16222 |
if (count === void 0) { |
| 16223 |
return; |
| 16224 |
} |
| 16225 |
if (count <= 1) { |
| 16226 |
runtime.documents.delete(targetDocument); |
| 16227 |
return; |
| 16228 |
} |
| 16229 |
runtime.documents.set(targetDocument, count - 1); |
| 16230 |
}; |
| 16231 |
} |
| 16232 |
function registerStyle7(hash, css) { |
| 16233 |
const runtime = getRuntime7(); |
| 16234 |
runtime.styles.set(hash, css); |
| 16235 |
for (const targetDocument of runtime.documents.keys()) { |
| 16236 |
injectStyle7(targetDocument, hash, css); |
| 16237 |
} |
| 16238 |
} |
| 16239 |
if (typeof process === "undefined" || true) { |
| 16240 |
registerStyle7("789467362f", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._480b748dd3510e64__positioner{z-index:var(--wp-ui-tooltip-z-index,initial)}._50096b232db7709d__popup{background-color:var(--wpds-color-background-surface-neutral-strong,#fff);border-radius:var(--wpds-border-radius-md,4px);box-shadow:var(--wpds-elevation-sm,0 1px 2px 0 #0000000d,0 2px 3px 0 #0000000a,0 6px 6px 0 #00000008,0 8px 8px 0 #00000005);color:var(--wpds-color-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}}}}'); |
| 16241 |
} |
| 16242 |
var style_default6 = { "positioner": "_480b748dd3510e64__positioner", "popup": "_50096b232db7709d__popup" }; |
| 16243 |
var POPUP_COLOR = { background: "#1e1e1e" }; |
| 16244 |
var Popup = (0, import_element24.forwardRef)(function TooltipPopup3({ portal, positioner, children, className, ...props }, ref) { |
| 16245 |
const popupContent = /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(ThemeProvider, { color: POPUP_COLOR, children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)( |
| 16246 |
index_parts_exports3.Popup, |
| 16247 |
{ |
| 16248 |
ref, |
| 16249 |
className: clsx_default(style_default6.popup, className), |
| 16250 |
...props, |
| 16251 |
children |
| 16252 |
} |
| 16253 |
) }); |
| 16254 |
const positionedPopup = renderSlotWithChildren( |
| 16255 |
positioner, |
| 16256 |
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(Positioner, {}), |
| 16257 |
popupContent |
| 16258 |
); |
| 16259 |
return renderSlotWithChildren(portal, /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(Portal, {}), positionedPopup); |
| 16260 |
}); |
| 16261 |
|
| 16262 |
// packages/ui/build-module/tooltip/trigger.mjs |
| 16263 |
var import_element25 = __toESM(require_element(), 1); |
| 16264 |
var import_jsx_runtime44 = __toESM(require_jsx_runtime(), 1); |
| 16265 |
var Trigger = (0, import_element25.forwardRef)( |
| 16266 |
function TooltipTrigger3(props, ref) { |
| 16267 |
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(index_parts_exports3.Trigger, { ref, ...props }); |
| 16268 |
} |
| 16269 |
); |
| 16270 |
|
| 16271 |
// packages/ui/build-module/tooltip/root.mjs |
| 16272 |
var import_jsx_runtime45 = __toESM(require_jsx_runtime(), 1); |
| 16273 |
function Root(props) { |
| 16274 |
return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(index_parts_exports3.Root, { ...props }); |
| 16275 |
} |
| 16276 |
|
| 16277 |
// packages/ui/build-module/tooltip/provider.mjs |
| 16278 |
var import_jsx_runtime46 = __toESM(require_jsx_runtime(), 1); |
| 16279 |
function Provider({ ...props }) { |
| 16280 |
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(index_parts_exports3.Provider, { ...props }); |
| 16281 |
} |
| 16282 |
|
| 16283 |
// packages/ui/build-module/icon-button/icon-button.mjs |
| 16284 |
var import_jsx_runtime47 = __toESM(require_jsx_runtime(), 1); |
| 16285 |
var STYLE_HASH_ATTRIBUTE8 = "data-wp-hash"; |
| 16286 |
function getRuntime8() { |
| 16287 |
const globalScope = globalThis; |
| 16288 |
if (globalScope.__wpStyleRuntime) { |
| 16289 |
return globalScope.__wpStyleRuntime; |
| 16290 |
} |
| 16291 |
globalScope.__wpStyleRuntime = { |
| 16292 |
documents: /* @__PURE__ */ new Map(), |
| 16293 |
styles: /* @__PURE__ */ new Map(), |
| 16294 |
injectedStyles: /* @__PURE__ */ new WeakMap() |
| 16295 |
}; |
| 16296 |
if (typeof document !== "undefined") { |
| 16297 |
registerDocument8(document); |
| 16298 |
} |
| 16299 |
return globalScope.__wpStyleRuntime; |
| 16300 |
} |
| 16301 |
function documentContainsStyleHash8(targetDocument, hash) { |
| 16302 |
if (!targetDocument.head) { |
| 16303 |
return false; |
| 16304 |
} |
| 16305 |
for (const style of targetDocument.head.querySelectorAll( |
| 16306 |
`style[${STYLE_HASH_ATTRIBUTE8}]` |
| 16307 |
)) { |
| 16308 |
if (style.getAttribute(STYLE_HASH_ATTRIBUTE8) === hash) { |
| 16309 |
return true; |
| 16310 |
} |
| 16311 |
} |
| 16312 |
return false; |
| 16313 |
} |
| 16314 |
function injectStyle8(targetDocument, hash, css) { |
| 16315 |
if (!targetDocument.head) { |
| 16316 |
return; |
| 16317 |
} |
| 16318 |
const runtime = getRuntime8(); |
| 16319 |
let injectedStyles = runtime.injectedStyles.get(targetDocument); |
| 16320 |
if (!injectedStyles) { |
| 16321 |
injectedStyles = /* @__PURE__ */ new Set(); |
| 16322 |
runtime.injectedStyles.set(targetDocument, injectedStyles); |
| 16323 |
} |
| 16324 |
if (injectedStyles.has(hash)) { |
| 16325 |
return; |
| 16326 |
} |
| 16327 |
if (documentContainsStyleHash8(targetDocument, hash)) { |
| 16328 |
injectedStyles.add(hash); |
| 16329 |
return; |
| 16330 |
} |
| 16331 |
const style = targetDocument.createElement("style"); |
| 16332 |
style.setAttribute(STYLE_HASH_ATTRIBUTE8, hash); |
| 16333 |
style.appendChild(targetDocument.createTextNode(css)); |
| 16334 |
targetDocument.head.appendChild(style); |
| 16335 |
injectedStyles.add(hash); |
| 16336 |
} |
| 16337 |
function registerDocument8(targetDocument) { |
| 16338 |
const runtime = getRuntime8(); |
| 16339 |
runtime.documents.set( |
| 16340 |
targetDocument, |
| 16341 |
(runtime.documents.get(targetDocument) ?? 0) + 1 |
| 16342 |
); |
| 16343 |
for (const [hash, css] of runtime.styles) { |
| 16344 |
injectStyle8(targetDocument, hash, css); |
| 16345 |
} |
| 16346 |
return () => { |
| 16347 |
const count = runtime.documents.get(targetDocument); |
| 16348 |
if (count === void 0) { |
| 16349 |
return; |
| 16350 |
} |
| 16351 |
if (count <= 1) { |
| 16352 |
runtime.documents.delete(targetDocument); |
| 16353 |
return; |
| 16354 |
} |
| 16355 |
runtime.documents.set(targetDocument, count - 1); |
| 16356 |
}; |
| 16357 |
} |
| 16358 |
function registerStyle8(hash, css) { |
| 16359 |
const runtime = getRuntime8(); |
| 16360 |
runtime.styles.set(hash, css); |
| 16361 |
for (const targetDocument of runtime.documents.keys()) { |
| 16362 |
injectStyle8(targetDocument, hash, css); |
| 16363 |
} |
| 16364 |
} |
| 16365 |
if (typeof process === "undefined" || true) { |
| 16366 |
registerStyle8("65cec4cf71", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer compositions{._28cfdc260e755391__icon-button{--wp-ui-button-aspect-ratio:1;--wp-ui-button-padding-inline:0;--wp-ui-button-min-width:unset}.f1c70d719989a85a__icon{margin:-1px}}}"); |
| 16367 |
} |
| 16368 |
var style_default7 = { "icon-button": "_28cfdc260e755391__icon-button", "icon": "f1c70d719989a85a__icon" }; |
| 16369 |
var IconButton = (0, import_element26.forwardRef)( |
| 16370 |
function IconButton2({ |
| 16371 |
label, |
| 16372 |
className, |
| 16373 |
// Prevent accidental forwarding of `children` |
| 16374 |
children: _children, |
| 16375 |
disabled: disabled2, |
| 16376 |
focusableWhenDisabled = true, |
| 16377 |
icon, |
| 16378 |
size: size4, |
| 16379 |
shortcut, |
| 16380 |
positioner, |
| 16381 |
...restProps |
| 16382 |
}, ref) { |
| 16383 |
const classes = clsx_default(style_default7["icon-button"], className); |
| 16384 |
return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(Provider, { delay: 0, children: /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(Root, { children: [ |
| 16385 |
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)( |
| 16386 |
Trigger, |
| 16387 |
{ |
| 16388 |
ref, |
| 16389 |
disabled: disabled2 && !focusableWhenDisabled, |
| 16390 |
render: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)( |
| 16391 |
Button4, |
| 16392 |
{ |
| 16393 |
...restProps, |
| 16394 |
size: size4, |
| 16395 |
"aria-label": label, |
| 16396 |
"aria-keyshortcuts": shortcut?.ariaKeyShortcut, |
| 16397 |
disabled: disabled2, |
| 16398 |
focusableWhenDisabled |
| 16399 |
} |
| 16400 |
), |
| 16401 |
className: classes, |
| 16402 |
children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)( |
| 16403 |
Icon, |
| 16404 |
{ |
| 16405 |
icon, |
| 16406 |
size: 24, |
| 16407 |
className: style_default7.icon |
| 16408 |
} |
| 16409 |
) |
| 16410 |
} |
| 16411 |
), |
| 16412 |
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(Popup, { positioner, children: [ |
| 16413 |
label, |
| 16414 |
shortcut && /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(import_jsx_runtime47.Fragment, { children: [ |
| 16415 |
" ", |
| 16416 |
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { "aria-hidden": "true", children: shortcut.displayShortcut }) |
| 16417 |
] }) |
| 16418 |
] }) |
| 16419 |
] }) }); |
| 16420 |
} |
| 16421 |
); |
| 16422 |
|
| 16423 |
// packages/ui/build-module/form/primitives/autocomplete/index.mjs |
| 16424 |
var autocomplete_exports = {}; |
| 16425 |
__export(autocomplete_exports, { |
| 16426 |
Clear: () => Clear, |
| 16427 |
Collection: () => Collection, |
| 16428 |
Empty: () => Empty, |
| 16429 |
Group: () => Group, |
| 16430 |
GroupLabel: () => GroupLabel, |
| 16431 |
Input: () => Input4, |
| 16432 |
InputGroup: () => InputGroup, |
| 16433 |
Item: () => Item, |
| 16434 |
List: () => List, |
| 16435 |
ListBody: () => ListBody, |
| 16436 |
Popup: () => Popup2, |
| 16437 |
Portal: () => Portal2, |
| 16438 |
Positioner: () => Positioner2, |
| 16439 |
Root: () => Root2, |
| 16440 |
Value: () => Value |
| 16441 |
}); |
| 16442 |
|
| 16443 |
// packages/ui/build-module/form/primitives/autocomplete/clear.mjs |
| 16444 |
var import_element27 = __toESM(require_element(), 1); |
| 16445 |
var import_i18n2 = __toESM(require_i18n(), 1); |
| 16446 |
var import_jsx_runtime48 = __toESM(require_jsx_runtime(), 1); |
| 16447 |
var DEFAULT_RENDER = ({ |
| 16448 |
"aria-label": ariaLabel = (0, import_i18n2.__)("Clear"), |
| 16449 |
...props |
| 16450 |
}, { disabled: disabled2 }) => /* @__PURE__ */ (0, import_jsx_runtime48.jsx)( |
| 16451 |
IconButton, |
| 16452 |
{ |
| 16453 |
icon: close_small_default, |
| 16454 |
focusableWhenDisabled: false, |
| 16455 |
disabled: disabled2, |
| 16456 |
"aria-hidden": disabled2 || void 0, |
| 16457 |
size: "small", |
| 16458 |
variant: "minimal", |
| 16459 |
tone: "neutral", |
| 16460 |
label: ariaLabel, |
| 16461 |
...props |
| 16462 |
} |
| 16463 |
); |
| 16464 |
var Clear = (0, import_element27.forwardRef)( |
| 16465 |
function Clear2({ render = DEFAULT_RENDER, ...restProps }, ref) { |
| 16466 |
return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)( |
| 16467 |
index_parts_exports.Clear, |
| 16468 |
{ |
| 16469 |
ref, |
| 16470 |
render, |
| 16471 |
...restProps |
| 16472 |
} |
| 16473 |
); |
| 16474 |
} |
| 16475 |
); |
| 16476 |
|
| 16477 |
// packages/ui/build-module/form/primitives/autocomplete/collection.mjs |
| 16478 |
var import_jsx_runtime49 = __toESM(require_jsx_runtime(), 1); |
| 16479 |
function Collection({ |
| 16480 |
children, |
| 16481 |
...restProps |
| 16482 |
}) { |
| 16483 |
return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(index_parts_exports.Collection, { ...restProps, children }); |
| 16484 |
} |
| 16485 |
|
| 16486 |
// packages/ui/build-module/form/primitives/autocomplete/empty.mjs |
| 16487 |
var import_element28 = __toESM(require_element(), 1); |
| 16488 |
var import_jsx_runtime50 = __toESM(require_jsx_runtime(), 1); |
| 16489 |
var STYLE_HASH_ATTRIBUTE9 = "data-wp-hash"; |
| 16490 |
function getRuntime9() { |
| 16491 |
const globalScope = globalThis; |
| 16492 |
if (globalScope.__wpStyleRuntime) { |
| 16493 |
return globalScope.__wpStyleRuntime; |
| 16494 |
} |
| 16495 |
globalScope.__wpStyleRuntime = { |
| 16496 |
documents: /* @__PURE__ */ new Map(), |
| 16497 |
styles: /* @__PURE__ */ new Map(), |
| 16498 |
injectedStyles: /* @__PURE__ */ new WeakMap() |
| 16499 |
}; |
| 16500 |
if (typeof document !== "undefined") { |
| 16501 |
registerDocument9(document); |
| 16502 |
} |
| 16503 |
return globalScope.__wpStyleRuntime; |
| 16504 |
} |
| 16505 |
function documentContainsStyleHash9(targetDocument, hash) { |
| 16506 |
if (!targetDocument.head) { |
| 16507 |
return false; |
| 16508 |
} |
| 16509 |
for (const style of targetDocument.head.querySelectorAll( |
| 16510 |
`style[${STYLE_HASH_ATTRIBUTE9}]` |
| 16511 |
)) { |
| 16512 |
if (style.getAttribute(STYLE_HASH_ATTRIBUTE9) === hash) { |
| 16513 |
return true; |
| 16514 |
} |
| 16515 |
} |
| 16516 |
return false; |
| 16517 |
} |
| 16518 |
function injectStyle9(targetDocument, hash, css) { |
| 16519 |
if (!targetDocument.head) { |
| 16520 |
return; |
| 16521 |
} |
| 16522 |
const runtime = getRuntime9(); |
| 16523 |
let injectedStyles = runtime.injectedStyles.get(targetDocument); |
| 16524 |
if (!injectedStyles) { |
| 16525 |
injectedStyles = /* @__PURE__ */ new Set(); |
| 16526 |
runtime.injectedStyles.set(targetDocument, injectedStyles); |
| 16527 |
} |
| 16528 |
if (injectedStyles.has(hash)) { |
| 16529 |
return; |
| 16530 |
} |
| 16531 |
if (documentContainsStyleHash9(targetDocument, hash)) { |
| 16532 |
injectedStyles.add(hash); |
| 16533 |
return; |
| 16534 |
} |
| 16535 |
const style = targetDocument.createElement("style"); |
| 16536 |
style.setAttribute(STYLE_HASH_ATTRIBUTE9, hash); |
| 16537 |
style.appendChild(targetDocument.createTextNode(css)); |
| 16538 |
targetDocument.head.appendChild(style); |
| 16539 |
injectedStyles.add(hash); |
| 16540 |
} |
| 16541 |
function registerDocument9(targetDocument) { |
| 16542 |
const runtime = getRuntime9(); |
| 16543 |
runtime.documents.set( |
| 16544 |
targetDocument, |
| 16545 |
(runtime.documents.get(targetDocument) ?? 0) + 1 |
| 16546 |
); |
| 16547 |
for (const [hash, css] of runtime.styles) { |
| 16548 |
injectStyle9(targetDocument, hash, css); |
| 16549 |
} |
| 16550 |
return () => { |
| 16551 |
const count = runtime.documents.get(targetDocument); |
| 16552 |
if (count === void 0) { |
| 16553 |
return; |
| 16554 |
} |
| 16555 |
if (count <= 1) { |
| 16556 |
runtime.documents.delete(targetDocument); |
| 16557 |
return; |
| 16558 |
} |
| 16559 |
runtime.documents.set(targetDocument, count - 1); |
| 16560 |
}; |
| 16561 |
} |
| 16562 |
function registerStyle9(hash, css) { |
| 16563 |
const runtime = getRuntime9(); |
| 16564 |
runtime.styles.set(hash, css); |
| 16565 |
for (const targetDocument of runtime.documents.keys()) { |
| 16566 |
injectStyle9(targetDocument, hash, css); |
| 16567 |
} |
| 16568 |
} |
| 16569 |
if (typeof process === "undefined" || true) { |
| 16570 |
registerStyle9("b5813d84e6", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._380b81b8f79fb10f__dropdown-motion{--wp-ui-dropdown-slide-distance:4px;--wp-ui-dropdown-slide-duration:var(--wpds-motion-duration-md,200ms);--wp-ui-dropdown-slide-easing:var(--wpds-motion-easing-expressive,cubic-bezier(0.25,0,0,1));--wp-ui-dropdown-fade-duration:var(--wpds-motion-duration-sm,100ms);--wp-ui-dropdown-fade-easing:linear;@media not (prefers-reduced-motion){transition-duration:var(--wp-ui-dropdown-slide-duration),var(--wp-ui-dropdown-fade-duration);transition-property:transform,opacity;transition-timing-function:var(--wp-ui-dropdown-slide-easing),var(--wp-ui-dropdown-fade-easing);will-change:transform,opacity}opacity:1;transform:translate(0);&[data-instant]{transition:none}&[data-ending-style],&[data-starting-style]{opacity:0}&[data-side=bottom][data-ending-style],&[data-side=bottom][data-starting-style]{transform:translateY(calc(var(--wp-ui-dropdown-slide-distance)*-1))}&[data-side=top][data-ending-style],&[data-side=top][data-starting-style]{transform:translateY(var(--wp-ui-dropdown-slide-distance))}&[data-side=left][data-ending-style],&[data-side=left][data-starting-style]{transform:translateX(var(--wp-ui-dropdown-slide-distance))}&[data-side=right][data-ending-style],&[data-side=right][data-starting-style]{transform:translateX(calc(var(--wp-ui-dropdown-slide-distance)*-1))}}}}@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._234b520016b4e56f__popup{--wp-ui-popup-padding:var(--wpds-dimension-padding-xs,4px);background-color:var(--wpds-color-background-surface-neutral-strong,#fff);border:var(--wpds-border-width-xs,1px) solid var(--wpds-color-stroke-surface-neutral,#dbdbdb);border-radius:var(--wpds-border-radius-md,4px);box-shadow:var(--wpds-elevation-md,0 2px 3px 0 #0000000d,0 4px 5px 0 #0000000a,0 12px 12px 0 #00000008,0 16px 16px 0 #00000005);display:grid;grid-template-areas:"header" "main";grid-template-rows:auto minmax(0,1fr);max-height:min(var(--available-height),480px,60dvh);max-width:var(--available-width);min-width:var(--anchor-width)}.f43dc7c768d7b622__list{color:var(--wpds-color-foreground-interactive-neutral,#1e1e1e);display:grid;font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wpds-typography-font-size-md,13px);grid-area:main;grid-template-areas:"scrollable" "footer";grid-template-rows:minmax(0,1fr) auto;line-height:var(--wpds-typography-line-height-sm,20px)}._233cd60cdb84a2ef__list-scrollable-container{grid-area:scrollable;overflow-block:auto;overscroll-behavior:contain;scroll-padding-block:var(--wp-ui-popup-padding);&:not(:empty){padding-block:var(--wp-ui-popup-padding)}}.ec4db6f0122263e7__list-footer{grid-area:footer;padding-block:var(--wp-ui-popup-padding);._233cd60cdb84a2ef__list-scrollable-container:not(:empty)+&{border-block-start:var(--wpds-border-width-xs,1px) solid var(--wpds-color-stroke-surface-neutral,#dbdbdb)}}.b3c0d7f103fb10a2__group:not(:first-child){margin-block-start:var(--wpds-dimension-gap-sm,8px)}._21b59380477c306c__group-label{align-items:center;color:var(--wpds-color-foreground-content-neutral-weak,#707070);display:flex;min-height:var(--wpds-dimension-size-md,32px);padding-inline:var(--wpds-dimension-padding-md,12px)}._684ccb7988365b4f__item{--wp-ui-popup-item-height:var(--wpds-dimension-size-lg,40px);--wp-ui-popup-item-padding-inline:var(--wpds-dimension-padding-md,12px);--wp-ui-popup-item-padding-block:var(--wpds-dimension-padding-xs,4px);align-items:center;border-radius:var(--wpds-border-radius-sm,2px);display:flex;gap:var(--wpds-dimension-gap-xs,4px);justify-content:flex-start;margin-inline:var(--wp-ui-popup-padding);min-height:var(--wp-ui-popup-item-height);padding-block:var(--wp-ui-popup-item-padding-block);padding-inline-end:var(--wp-ui-popup-item-padding-inline);padding-inline-start:calc(var(--wp-ui-popup-item-padding-inline) - var(--wpds-dimension-padding-xs, 4px));user-select:none;&:not([data-disabled]){cursor:var(--wpds-cursor-control,pointer)}&.f181b98b0d33282a__is-size-compact{--wp-ui-popup-item-height:var(--wpds-dimension-size-md,32px);--wp-ui-popup-item-padding-inline:var(--wpds-dimension-padding-sm,8px)}&._38f7faff93c61958__is-size-small{--wp-ui-popup-item-height:var(--wpds-dimension-size-sm,24px);--wp-ui-popup-item-padding-inline:var(--wpds-dimension-padding-sm,8px);--wp-ui-popup-item-padding-block:2px}&:not([data-selected]){._92fbe4765dfad5ee__item-indicator-icon{opacity:0}}&[data-highlighted]:not([aria-disabled=true]){background-color:var(--wpds-color-background-interactive-brand-weak-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 12%,#fff));color:var(--wpds-color-foreground-interactive-neutral,#1e1e1e);outline:none;@media (forced-colors:active){outline:1px solid Highlight}}&[aria-disabled=true]{background-color:var(--wpds-color-background-interactive-brand-weak-disabled,#0000);color:var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d);@media (forced-colors:active){color:GrayText}}}.a3adcfd0b73ffd40__item-icon{flex-shrink:0}._06c7ff39d2f685b9__empty:not(:empty){--wp-ui-popup-empty-min-height:var(--wpds-dimension-size-lg,40px);--wp-ui-popup-empty-padding-inline:var(--wpds-dimension-padding-md,12px);align-items:center;color:var(--wpds-color-foreground-content-neutral-weak,#707070);display:flex;font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wpds-typography-font-size-md,13px);grid-area:main;line-height:var(--wpds-typography-line-height-sm,20px);min-height:var(--wp-ui-popup-empty-min-height);padding-inline:var(--wp-ui-popup-empty-padding-inline)}}}'); |
| 16571 |
} |
| 16572 |
var item_popup_default = { "popup": "_234b520016b4e56f__popup _380b81b8f79fb10f__dropdown-motion", "list": "f43dc7c768d7b622__list", "list-scrollable-container": "_233cd60cdb84a2ef__list-scrollable-container", "list-footer": "ec4db6f0122263e7__list-footer", "group": "b3c0d7f103fb10a2__group", "group-label": "_21b59380477c306c__group-label", "item": "_684ccb7988365b4f__item", "is-size-compact": "f181b98b0d33282a__is-size-compact", "is-size-small": "_38f7faff93c61958__is-size-small", "item-indicator-icon": "_92fbe4765dfad5ee__item-indicator-icon", "item-icon": "a3adcfd0b73ffd40__item-icon", "empty": "_06c7ff39d2f685b9__empty" }; |
| 16573 |
var Empty = (0, import_element28.forwardRef)( |
| 16574 |
function Empty2({ className, ...restProps }, ref) { |
| 16575 |
return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)( |
| 16576 |
index_parts_exports.Empty, |
| 16577 |
{ |
| 16578 |
className: clsx_default(item_popup_default.empty, className), |
| 16579 |
ref, |
| 16580 |
...restProps |
| 16581 |
} |
| 16582 |
); |
| 16583 |
} |
| 16584 |
); |
| 16585 |
|
| 16586 |
// packages/ui/build-module/form/primitives/autocomplete/group.mjs |
| 16587 |
var import_element29 = __toESM(require_element(), 1); |
| 16588 |
var import_jsx_runtime51 = __toESM(require_jsx_runtime(), 1); |
| 16589 |
var STYLE_HASH_ATTRIBUTE10 = "data-wp-hash"; |
| 16590 |
function getRuntime10() { |
| 16591 |
const globalScope = globalThis; |
| 16592 |
if (globalScope.__wpStyleRuntime) { |
| 16593 |
return globalScope.__wpStyleRuntime; |
| 16594 |
} |
| 16595 |
globalScope.__wpStyleRuntime = { |
| 16596 |
documents: /* @__PURE__ */ new Map(), |
| 16597 |
styles: /* @__PURE__ */ new Map(), |
| 16598 |
injectedStyles: /* @__PURE__ */ new WeakMap() |
| 16599 |
}; |
| 16600 |
if (typeof document !== "undefined") { |
| 16601 |
registerDocument10(document); |
| 16602 |
} |
| 16603 |
return globalScope.__wpStyleRuntime; |
| 16604 |
} |
| 16605 |
function documentContainsStyleHash10(targetDocument, hash) { |
| 16606 |
if (!targetDocument.head) { |
| 16607 |
return false; |
| 16608 |
} |
| 16609 |
for (const style of targetDocument.head.querySelectorAll( |
| 16610 |
`style[${STYLE_HASH_ATTRIBUTE10}]` |
| 16611 |
)) { |
| 16612 |
if (style.getAttribute(STYLE_HASH_ATTRIBUTE10) === hash) { |
| 16613 |
return true; |
| 16614 |
} |
| 16615 |
} |
| 16616 |
return false; |
| 16617 |
} |
| 16618 |
function injectStyle10(targetDocument, hash, css) { |
| 16619 |
if (!targetDocument.head) { |
| 16620 |
return; |
| 16621 |
} |
| 16622 |
const runtime = getRuntime10(); |
| 16623 |
let injectedStyles = runtime.injectedStyles.get(targetDocument); |
| 16624 |
if (!injectedStyles) { |
| 16625 |
injectedStyles = /* @__PURE__ */ new Set(); |
| 16626 |
runtime.injectedStyles.set(targetDocument, injectedStyles); |
| 16627 |
} |
| 16628 |
if (injectedStyles.has(hash)) { |
| 16629 |
return; |
| 16630 |
} |
| 16631 |
if (documentContainsStyleHash10(targetDocument, hash)) { |
| 16632 |
injectedStyles.add(hash); |
| 16633 |
return; |
| 16634 |
} |
| 16635 |
const style = targetDocument.createElement("style"); |
| 16636 |
style.setAttribute(STYLE_HASH_ATTRIBUTE10, hash); |
| 16637 |
style.appendChild(targetDocument.createTextNode(css)); |
| 16638 |
targetDocument.head.appendChild(style); |
| 16639 |
injectedStyles.add(hash); |
| 16640 |
} |
| 16641 |
function registerDocument10(targetDocument) { |
| 16642 |
const runtime = getRuntime10(); |
| 16643 |
runtime.documents.set( |
| 16644 |
targetDocument, |
| 16645 |
(runtime.documents.get(targetDocument) ?? 0) + 1 |
| 16646 |
); |
| 16647 |
for (const [hash, css] of runtime.styles) { |
| 16648 |
injectStyle10(targetDocument, hash, css); |
| 16649 |
} |
| 16650 |
return () => { |
| 16651 |
const count = runtime.documents.get(targetDocument); |
| 16652 |
if (count === void 0) { |
| 16653 |
return; |
| 16654 |
} |
| 16655 |
if (count <= 1) { |
| 16656 |
runtime.documents.delete(targetDocument); |
| 16657 |
return; |
| 16658 |
} |
| 16659 |
runtime.documents.set(targetDocument, count - 1); |
| 16660 |
}; |
| 16661 |
} |
| 16662 |
function registerStyle10(hash, css) { |
| 16663 |
const runtime = getRuntime10(); |
| 16664 |
runtime.styles.set(hash, css); |
| 16665 |
for (const targetDocument of runtime.documents.keys()) { |
| 16666 |
injectStyle10(targetDocument, hash, css); |
| 16667 |
} |
| 16668 |
} |
| 16669 |
if (typeof process === "undefined" || true) { |
| 16670 |
registerStyle10("b5813d84e6", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._380b81b8f79fb10f__dropdown-motion{--wp-ui-dropdown-slide-distance:4px;--wp-ui-dropdown-slide-duration:var(--wpds-motion-duration-md,200ms);--wp-ui-dropdown-slide-easing:var(--wpds-motion-easing-expressive,cubic-bezier(0.25,0,0,1));--wp-ui-dropdown-fade-duration:var(--wpds-motion-duration-sm,100ms);--wp-ui-dropdown-fade-easing:linear;@media not (prefers-reduced-motion){transition-duration:var(--wp-ui-dropdown-slide-duration),var(--wp-ui-dropdown-fade-duration);transition-property:transform,opacity;transition-timing-function:var(--wp-ui-dropdown-slide-easing),var(--wp-ui-dropdown-fade-easing);will-change:transform,opacity}opacity:1;transform:translate(0);&[data-instant]{transition:none}&[data-ending-style],&[data-starting-style]{opacity:0}&[data-side=bottom][data-ending-style],&[data-side=bottom][data-starting-style]{transform:translateY(calc(var(--wp-ui-dropdown-slide-distance)*-1))}&[data-side=top][data-ending-style],&[data-side=top][data-starting-style]{transform:translateY(var(--wp-ui-dropdown-slide-distance))}&[data-side=left][data-ending-style],&[data-side=left][data-starting-style]{transform:translateX(var(--wp-ui-dropdown-slide-distance))}&[data-side=right][data-ending-style],&[data-side=right][data-starting-style]{transform:translateX(calc(var(--wp-ui-dropdown-slide-distance)*-1))}}}}@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._234b520016b4e56f__popup{--wp-ui-popup-padding:var(--wpds-dimension-padding-xs,4px);background-color:var(--wpds-color-background-surface-neutral-strong,#fff);border:var(--wpds-border-width-xs,1px) solid var(--wpds-color-stroke-surface-neutral,#dbdbdb);border-radius:var(--wpds-border-radius-md,4px);box-shadow:var(--wpds-elevation-md,0 2px 3px 0 #0000000d,0 4px 5px 0 #0000000a,0 12px 12px 0 #00000008,0 16px 16px 0 #00000005);display:grid;grid-template-areas:"header" "main";grid-template-rows:auto minmax(0,1fr);max-height:min(var(--available-height),480px,60dvh);max-width:var(--available-width);min-width:var(--anchor-width)}.f43dc7c768d7b622__list{color:var(--wpds-color-foreground-interactive-neutral,#1e1e1e);display:grid;font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wpds-typography-font-size-md,13px);grid-area:main;grid-template-areas:"scrollable" "footer";grid-template-rows:minmax(0,1fr) auto;line-height:var(--wpds-typography-line-height-sm,20px)}._233cd60cdb84a2ef__list-scrollable-container{grid-area:scrollable;overflow-block:auto;overscroll-behavior:contain;scroll-padding-block:var(--wp-ui-popup-padding);&:not(:empty){padding-block:var(--wp-ui-popup-padding)}}.ec4db6f0122263e7__list-footer{grid-area:footer;padding-block:var(--wp-ui-popup-padding);._233cd60cdb84a2ef__list-scrollable-container:not(:empty)+&{border-block-start:var(--wpds-border-width-xs,1px) solid var(--wpds-color-stroke-surface-neutral,#dbdbdb)}}.b3c0d7f103fb10a2__group:not(:first-child){margin-block-start:var(--wpds-dimension-gap-sm,8px)}._21b59380477c306c__group-label{align-items:center;color:var(--wpds-color-foreground-content-neutral-weak,#707070);display:flex;min-height:var(--wpds-dimension-size-md,32px);padding-inline:var(--wpds-dimension-padding-md,12px)}._684ccb7988365b4f__item{--wp-ui-popup-item-height:var(--wpds-dimension-size-lg,40px);--wp-ui-popup-item-padding-inline:var(--wpds-dimension-padding-md,12px);--wp-ui-popup-item-padding-block:var(--wpds-dimension-padding-xs,4px);align-items:center;border-radius:var(--wpds-border-radius-sm,2px);display:flex;gap:var(--wpds-dimension-gap-xs,4px);justify-content:flex-start;margin-inline:var(--wp-ui-popup-padding);min-height:var(--wp-ui-popup-item-height);padding-block:var(--wp-ui-popup-item-padding-block);padding-inline-end:var(--wp-ui-popup-item-padding-inline);padding-inline-start:calc(var(--wp-ui-popup-item-padding-inline) - var(--wpds-dimension-padding-xs, 4px));user-select:none;&:not([data-disabled]){cursor:var(--wpds-cursor-control,pointer)}&.f181b98b0d33282a__is-size-compact{--wp-ui-popup-item-height:var(--wpds-dimension-size-md,32px);--wp-ui-popup-item-padding-inline:var(--wpds-dimension-padding-sm,8px)}&._38f7faff93c61958__is-size-small{--wp-ui-popup-item-height:var(--wpds-dimension-size-sm,24px);--wp-ui-popup-item-padding-inline:var(--wpds-dimension-padding-sm,8px);--wp-ui-popup-item-padding-block:2px}&:not([data-selected]){._92fbe4765dfad5ee__item-indicator-icon{opacity:0}}&[data-highlighted]:not([aria-disabled=true]){background-color:var(--wpds-color-background-interactive-brand-weak-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 12%,#fff));color:var(--wpds-color-foreground-interactive-neutral,#1e1e1e);outline:none;@media (forced-colors:active){outline:1px solid Highlight}}&[aria-disabled=true]{background-color:var(--wpds-color-background-interactive-brand-weak-disabled,#0000);color:var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d);@media (forced-colors:active){color:GrayText}}}.a3adcfd0b73ffd40__item-icon{flex-shrink:0}._06c7ff39d2f685b9__empty:not(:empty){--wp-ui-popup-empty-min-height:var(--wpds-dimension-size-lg,40px);--wp-ui-popup-empty-padding-inline:var(--wpds-dimension-padding-md,12px);align-items:center;color:var(--wpds-color-foreground-content-neutral-weak,#707070);display:flex;font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wpds-typography-font-size-md,13px);grid-area:main;line-height:var(--wpds-typography-line-height-sm,20px);min-height:var(--wp-ui-popup-empty-min-height);padding-inline:var(--wp-ui-popup-empty-padding-inline)}}}'); |
| 16671 |
} |
| 16672 |
var item_popup_default2 = { "popup": "_234b520016b4e56f__popup _380b81b8f79fb10f__dropdown-motion", "list": "f43dc7c768d7b622__list", "list-scrollable-container": "_233cd60cdb84a2ef__list-scrollable-container", "list-footer": "ec4db6f0122263e7__list-footer", "group": "b3c0d7f103fb10a2__group", "group-label": "_21b59380477c306c__group-label", "item": "_684ccb7988365b4f__item", "is-size-compact": "f181b98b0d33282a__is-size-compact", "is-size-small": "_38f7faff93c61958__is-size-small", "item-indicator-icon": "_92fbe4765dfad5ee__item-indicator-icon", "item-icon": "a3adcfd0b73ffd40__item-icon", "empty": "_06c7ff39d2f685b9__empty" }; |
| 16673 |
var Group = (0, import_element29.forwardRef)( |
| 16674 |
function Group2({ className, children, ...restProps }, ref) { |
| 16675 |
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)( |
| 16676 |
index_parts_exports.Group, |
| 16677 |
{ |
| 16678 |
className: clsx_default(item_popup_default2.group, className), |
| 16679 |
ref, |
| 16680 |
...restProps, |
| 16681 |
children |
| 16682 |
} |
| 16683 |
); |
| 16684 |
} |
| 16685 |
); |
| 16686 |
|
| 16687 |
// packages/ui/build-module/form/primitives/autocomplete/group-label.mjs |
| 16688 |
var import_element30 = __toESM(require_element(), 1); |
| 16689 |
var import_jsx_runtime52 = __toESM(require_jsx_runtime(), 1); |
| 16690 |
var STYLE_HASH_ATTRIBUTE11 = "data-wp-hash"; |
| 16691 |
function getRuntime11() { |
| 16692 |
const globalScope = globalThis; |
| 16693 |
if (globalScope.__wpStyleRuntime) { |
| 16694 |
return globalScope.__wpStyleRuntime; |
| 16695 |
} |
| 16696 |
globalScope.__wpStyleRuntime = { |
| 16697 |
documents: /* @__PURE__ */ new Map(), |
| 16698 |
styles: /* @__PURE__ */ new Map(), |
| 16699 |
injectedStyles: /* @__PURE__ */ new WeakMap() |
| 16700 |
}; |
| 16701 |
if (typeof document !== "undefined") { |
| 16702 |
registerDocument11(document); |
| 16703 |
} |
| 16704 |
return globalScope.__wpStyleRuntime; |
| 16705 |
} |
| 16706 |
function documentContainsStyleHash11(targetDocument, hash) { |
| 16707 |
if (!targetDocument.head) { |
| 16708 |
return false; |
| 16709 |
} |
| 16710 |
for (const style of targetDocument.head.querySelectorAll( |
| 16711 |
`style[${STYLE_HASH_ATTRIBUTE11}]` |
| 16712 |
)) { |
| 16713 |
if (style.getAttribute(STYLE_HASH_ATTRIBUTE11) === hash) { |
| 16714 |
return true; |
| 16715 |
} |
| 16716 |
} |
| 16717 |
return false; |
| 16718 |
} |
| 16719 |
function injectStyle11(targetDocument, hash, css) { |
| 16720 |
if (!targetDocument.head) { |
| 16721 |
return; |
| 16722 |
} |
| 16723 |
const runtime = getRuntime11(); |
| 16724 |
let injectedStyles = runtime.injectedStyles.get(targetDocument); |
| 16725 |
if (!injectedStyles) { |
| 16726 |
injectedStyles = /* @__PURE__ */ new Set(); |
| 16727 |
runtime.injectedStyles.set(targetDocument, injectedStyles); |
| 16728 |
} |
| 16729 |
if (injectedStyles.has(hash)) { |
| 16730 |
return; |
| 16731 |
} |
| 16732 |
if (documentContainsStyleHash11(targetDocument, hash)) { |
| 16733 |
injectedStyles.add(hash); |
| 16734 |
return; |
| 16735 |
} |
| 16736 |
const style = targetDocument.createElement("style"); |
| 16737 |
style.setAttribute(STYLE_HASH_ATTRIBUTE11, hash); |
| 16738 |
style.appendChild(targetDocument.createTextNode(css)); |
| 16739 |
targetDocument.head.appendChild(style); |
| 16740 |
injectedStyles.add(hash); |
| 16741 |
} |
| 16742 |
function registerDocument11(targetDocument) { |
| 16743 |
const runtime = getRuntime11(); |
| 16744 |
runtime.documents.set( |
| 16745 |
targetDocument, |
| 16746 |
(runtime.documents.get(targetDocument) ?? 0) + 1 |
| 16747 |
); |
| 16748 |
for (const [hash, css] of runtime.styles) { |
| 16749 |
injectStyle11(targetDocument, hash, css); |
| 16750 |
} |
| 16751 |
return () => { |
| 16752 |
const count = runtime.documents.get(targetDocument); |
| 16753 |
if (count === void 0) { |
| 16754 |
return; |
| 16755 |
} |
| 16756 |
if (count <= 1) { |
| 16757 |
runtime.documents.delete(targetDocument); |
| 16758 |
return; |
| 16759 |
} |
| 16760 |
runtime.documents.set(targetDocument, count - 1); |
| 16761 |
}; |
| 16762 |
} |
| 16763 |
function registerStyle11(hash, css) { |
| 16764 |
const runtime = getRuntime11(); |
| 16765 |
runtime.styles.set(hash, css); |
| 16766 |
for (const targetDocument of runtime.documents.keys()) { |
| 16767 |
injectStyle11(targetDocument, hash, css); |
| 16768 |
} |
| 16769 |
} |
| 16770 |
if (typeof process === "undefined" || true) { |
| 16771 |
registerStyle11("b5813d84e6", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._380b81b8f79fb10f__dropdown-motion{--wp-ui-dropdown-slide-distance:4px;--wp-ui-dropdown-slide-duration:var(--wpds-motion-duration-md,200ms);--wp-ui-dropdown-slide-easing:var(--wpds-motion-easing-expressive,cubic-bezier(0.25,0,0,1));--wp-ui-dropdown-fade-duration:var(--wpds-motion-duration-sm,100ms);--wp-ui-dropdown-fade-easing:linear;@media not (prefers-reduced-motion){transition-duration:var(--wp-ui-dropdown-slide-duration),var(--wp-ui-dropdown-fade-duration);transition-property:transform,opacity;transition-timing-function:var(--wp-ui-dropdown-slide-easing),var(--wp-ui-dropdown-fade-easing);will-change:transform,opacity}opacity:1;transform:translate(0);&[data-instant]{transition:none}&[data-ending-style],&[data-starting-style]{opacity:0}&[data-side=bottom][data-ending-style],&[data-side=bottom][data-starting-style]{transform:translateY(calc(var(--wp-ui-dropdown-slide-distance)*-1))}&[data-side=top][data-ending-style],&[data-side=top][data-starting-style]{transform:translateY(var(--wp-ui-dropdown-slide-distance))}&[data-side=left][data-ending-style],&[data-side=left][data-starting-style]{transform:translateX(var(--wp-ui-dropdown-slide-distance))}&[data-side=right][data-ending-style],&[data-side=right][data-starting-style]{transform:translateX(calc(var(--wp-ui-dropdown-slide-distance)*-1))}}}}@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._234b520016b4e56f__popup{--wp-ui-popup-padding:var(--wpds-dimension-padding-xs,4px);background-color:var(--wpds-color-background-surface-neutral-strong,#fff);border:var(--wpds-border-width-xs,1px) solid var(--wpds-color-stroke-surface-neutral,#dbdbdb);border-radius:var(--wpds-border-radius-md,4px);box-shadow:var(--wpds-elevation-md,0 2px 3px 0 #0000000d,0 4px 5px 0 #0000000a,0 12px 12px 0 #00000008,0 16px 16px 0 #00000005);display:grid;grid-template-areas:"header" "main";grid-template-rows:auto minmax(0,1fr);max-height:min(var(--available-height),480px,60dvh);max-width:var(--available-width);min-width:var(--anchor-width)}.f43dc7c768d7b622__list{color:var(--wpds-color-foreground-interactive-neutral,#1e1e1e);display:grid;font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wpds-typography-font-size-md,13px);grid-area:main;grid-template-areas:"scrollable" "footer";grid-template-rows:minmax(0,1fr) auto;line-height:var(--wpds-typography-line-height-sm,20px)}._233cd60cdb84a2ef__list-scrollable-container{grid-area:scrollable;overflow-block:auto;overscroll-behavior:contain;scroll-padding-block:var(--wp-ui-popup-padding);&:not(:empty){padding-block:var(--wp-ui-popup-padding)}}.ec4db6f0122263e7__list-footer{grid-area:footer;padding-block:var(--wp-ui-popup-padding);._233cd60cdb84a2ef__list-scrollable-container:not(:empty)+&{border-block-start:var(--wpds-border-width-xs,1px) solid var(--wpds-color-stroke-surface-neutral,#dbdbdb)}}.b3c0d7f103fb10a2__group:not(:first-child){margin-block-start:var(--wpds-dimension-gap-sm,8px)}._21b59380477c306c__group-label{align-items:center;color:var(--wpds-color-foreground-content-neutral-weak,#707070);display:flex;min-height:var(--wpds-dimension-size-md,32px);padding-inline:var(--wpds-dimension-padding-md,12px)}._684ccb7988365b4f__item{--wp-ui-popup-item-height:var(--wpds-dimension-size-lg,40px);--wp-ui-popup-item-padding-inline:var(--wpds-dimension-padding-md,12px);--wp-ui-popup-item-padding-block:var(--wpds-dimension-padding-xs,4px);align-items:center;border-radius:var(--wpds-border-radius-sm,2px);display:flex;gap:var(--wpds-dimension-gap-xs,4px);justify-content:flex-start;margin-inline:var(--wp-ui-popup-padding);min-height:var(--wp-ui-popup-item-height);padding-block:var(--wp-ui-popup-item-padding-block);padding-inline-end:var(--wp-ui-popup-item-padding-inline);padding-inline-start:calc(var(--wp-ui-popup-item-padding-inline) - var(--wpds-dimension-padding-xs, 4px));user-select:none;&:not([data-disabled]){cursor:var(--wpds-cursor-control,pointer)}&.f181b98b0d33282a__is-size-compact{--wp-ui-popup-item-height:var(--wpds-dimension-size-md,32px);--wp-ui-popup-item-padding-inline:var(--wpds-dimension-padding-sm,8px)}&._38f7faff93c61958__is-size-small{--wp-ui-popup-item-height:var(--wpds-dimension-size-sm,24px);--wp-ui-popup-item-padding-inline:var(--wpds-dimension-padding-sm,8px);--wp-ui-popup-item-padding-block:2px}&:not([data-selected]){._92fbe4765dfad5ee__item-indicator-icon{opacity:0}}&[data-highlighted]:not([aria-disabled=true]){background-color:var(--wpds-color-background-interactive-brand-weak-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 12%,#fff));color:var(--wpds-color-foreground-interactive-neutral,#1e1e1e);outline:none;@media (forced-colors:active){outline:1px solid Highlight}}&[aria-disabled=true]{background-color:var(--wpds-color-background-interactive-brand-weak-disabled,#0000);color:var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d);@media (forced-colors:active){color:GrayText}}}.a3adcfd0b73ffd40__item-icon{flex-shrink:0}._06c7ff39d2f685b9__empty:not(:empty){--wp-ui-popup-empty-min-height:var(--wpds-dimension-size-lg,40px);--wp-ui-popup-empty-padding-inline:var(--wpds-dimension-padding-md,12px);align-items:center;color:var(--wpds-color-foreground-content-neutral-weak,#707070);display:flex;font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wpds-typography-font-size-md,13px);grid-area:main;line-height:var(--wpds-typography-line-height-sm,20px);min-height:var(--wp-ui-popup-empty-min-height);padding-inline:var(--wp-ui-popup-empty-padding-inline)}}}'); |
| 16772 |
} |
| 16773 |
var item_popup_default3 = { "popup": "_234b520016b4e56f__popup _380b81b8f79fb10f__dropdown-motion", "list": "f43dc7c768d7b622__list", "list-scrollable-container": "_233cd60cdb84a2ef__list-scrollable-container", "list-footer": "ec4db6f0122263e7__list-footer", "group": "b3c0d7f103fb10a2__group", "group-label": "_21b59380477c306c__group-label", "item": "_684ccb7988365b4f__item", "is-size-compact": "f181b98b0d33282a__is-size-compact", "is-size-small": "_38f7faff93c61958__is-size-small", "item-indicator-icon": "_92fbe4765dfad5ee__item-indicator-icon", "item-icon": "a3adcfd0b73ffd40__item-icon", "empty": "_06c7ff39d2f685b9__empty" }; |
| 16774 |
var GroupLabel = (0, import_element30.forwardRef)(function GroupLabel2({ className, children, ...restProps }, ref) { |
| 16775 |
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)( |
| 16776 |
Text, |
| 16777 |
{ |
| 16778 |
variant: "heading-sm", |
| 16779 |
className: clsx_default(item_popup_default3["group-label"], className), |
| 16780 |
render: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(index_parts_exports.GroupLabel, { ref, ...restProps }), |
| 16781 |
children |
| 16782 |
} |
| 16783 |
); |
| 16784 |
}); |
| 16785 |
|
| 16786 |
// packages/ui/build-module/form/primitives/autocomplete/input-group.mjs |
| 16787 |
var import_element31 = __toESM(require_element(), 1); |
| 16788 |
var import_jsx_runtime53 = __toESM(require_jsx_runtime(), 1); |
| 16789 |
var InputGroup = (0, import_element31.forwardRef)(function InputGroup2(props, ref) { |
| 16790 |
return /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(index_parts_exports.InputGroup, { ref, ...props }); |
| 16791 |
}); |
| 16792 |
|
| 16793 |
// packages/ui/build-module/form/primitives/autocomplete/input.mjs |
| 16794 |
var import_element35 = __toESM(require_element(), 1); |
| 16795 |
|
| 16796 |
// packages/ui/build-module/form/primitives/input/input.mjs |
| 16797 |
var import_element34 = __toESM(require_element(), 1); |
| 16798 |
|
| 16799 |
// packages/ui/build-module/form/primitives/input-layout/input-layout.mjs |
| 16800 |
var import_element32 = __toESM(require_element(), 1); |
| 16801 |
var import_jsx_runtime54 = __toESM(require_jsx_runtime(), 1); |
| 16802 |
var STYLE_HASH_ATTRIBUTE12 = "data-wp-hash"; |
| 16803 |
function getRuntime12() { |
| 16804 |
const globalScope = globalThis; |
| 16805 |
if (globalScope.__wpStyleRuntime) { |
| 16806 |
return globalScope.__wpStyleRuntime; |
| 16807 |
} |
| 16808 |
globalScope.__wpStyleRuntime = { |
| 16809 |
documents: /* @__PURE__ */ new Map(), |
| 16810 |
styles: /* @__PURE__ */ new Map(), |
| 16811 |
injectedStyles: /* @__PURE__ */ new WeakMap() |
| 16812 |
}; |
| 16813 |
if (typeof document !== "undefined") { |
| 16814 |
registerDocument12(document); |
| 16815 |
} |
| 16816 |
return globalScope.__wpStyleRuntime; |
| 16817 |
} |
| 16818 |
function documentContainsStyleHash12(targetDocument, hash) { |
| 16819 |
if (!targetDocument.head) { |
| 16820 |
return false; |
| 16821 |
} |
| 16822 |
for (const style of targetDocument.head.querySelectorAll( |
| 16823 |
`style[${STYLE_HASH_ATTRIBUTE12}]` |
| 16824 |
)) { |
| 16825 |
if (style.getAttribute(STYLE_HASH_ATTRIBUTE12) === hash) { |
| 16826 |
return true; |
| 16827 |
} |
| 16828 |
} |
| 16829 |
return false; |
| 16830 |
} |
| 16831 |
function injectStyle12(targetDocument, hash, css) { |
| 16832 |
if (!targetDocument.head) { |
| 16833 |
return; |
| 16834 |
} |
| 16835 |
const runtime = getRuntime12(); |
| 16836 |
let injectedStyles = runtime.injectedStyles.get(targetDocument); |
| 16837 |
if (!injectedStyles) { |
| 16838 |
injectedStyles = /* @__PURE__ */ new Set(); |
| 16839 |
runtime.injectedStyles.set(targetDocument, injectedStyles); |
| 16840 |
} |
| 16841 |
if (injectedStyles.has(hash)) { |
| 16842 |
return; |
| 16843 |
} |
| 16844 |
if (documentContainsStyleHash12(targetDocument, hash)) { |
| 16845 |
injectedStyles.add(hash); |
| 16846 |
return; |
| 16847 |
} |
| 16848 |
const style = targetDocument.createElement("style"); |
| 16849 |
style.setAttribute(STYLE_HASH_ATTRIBUTE12, hash); |
| 16850 |
style.appendChild(targetDocument.createTextNode(css)); |
| 16851 |
targetDocument.head.appendChild(style); |
| 16852 |
injectedStyles.add(hash); |
| 16853 |
} |
| 16854 |
function registerDocument12(targetDocument) { |
| 16855 |
const runtime = getRuntime12(); |
| 16856 |
runtime.documents.set( |
| 16857 |
targetDocument, |
| 16858 |
(runtime.documents.get(targetDocument) ?? 0) + 1 |
| 16859 |
); |
| 16860 |
for (const [hash, css] of runtime.styles) { |
| 16861 |
injectStyle12(targetDocument, hash, css); |
| 16862 |
} |
| 16863 |
return () => { |
| 16864 |
const count = runtime.documents.get(targetDocument); |
| 16865 |
if (count === void 0) { |
| 16866 |
return; |
| 16867 |
} |
| 16868 |
if (count <= 1) { |
| 16869 |
runtime.documents.delete(targetDocument); |
| 16870 |
return; |
| 16871 |
} |
| 16872 |
runtime.documents.set(targetDocument, count - 1); |
| 16873 |
}; |
| 16874 |
} |
| 16875 |
function registerStyle12(hash, css) { |
| 16876 |
const runtime = getRuntime12(); |
| 16877 |
runtime.styles.set(hash, css); |
| 16878 |
for (const targetDocument of runtime.documents.keys()) { |
| 16879 |
injectStyle12(targetDocument, hash, css); |
| 16880 |
} |
| 16881 |
} |
| 16882 |
if (typeof process === "undefined" || true) { |
| 16883 |
registerStyle12("d390e935a7", "._6defc79820e382c6__button{box-sizing:var(--_gcd-button-box-sizing,border-box);font-family:var(--_gcd-button-font-family,inherit);font-size:var(--_gcd-button-font-size,inherit);font-weight:var(--_gcd-button-font-weight,inherit)}.d2cff2e5dea83bd1__input{box-sizing:var(--_gcd-input-box-sizing,border-box);font-family:var(--_gcd-input-font-family,inherit);font-size:var(--_gcd-input-font-size,inherit);font-weight:var(--_gcd-input-font-weight,inherit);margin:var(--_gcd-input-margin,0);&:is(textarea,[type=text],[type=password],[type=color],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){background-color:var(--_gcd-input-background-color,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))}&::placeholder{color:var(--_gcd-input-placeholder-color,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-medium,499));margin:var(--_gcd-heading-margin,0)}._2c0831b0499dbd6e__a,._2c0831b0499dbd6e__a:is(:hover,:focus,:active){border-radius:var(--_gcd-a-border-radius,0);box-shadow:var(--_gcd-a-box-shadow,none);color:var(--_gcd-a-color,inherit);outline:var(--_gcd-a-outline,0 solid transparent);transition:var(--_gcd-a-transition,none)}"); |
| 16884 |
} |
| 16885 |
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" }; |
| 16886 |
if (typeof process === "undefined" || true) { |
| 16887 |
registerStyle12("10f3806643", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._336cd3e4e743482f__box-sizing{box-sizing:border-box;*,:after,:before{box-sizing:inherit}}}}"); |
| 16888 |
} |
| 16889 |
var resets_default3 = { "box-sizing": "_336cd3e4e743482f__box-sizing" }; |
| 16890 |
if (typeof process === "undefined" || true) { |
| 16891 |
registerStyle12("bc14d8e61b", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{.cb2baafdc08746bb__input-layout{--wp-ui-input-layout-padding-inline:var(--wpds-dimension-padding-md,12px);background-color:var(--wpds-color-background-interactive-neutral-weak,#0000);border-color:var(--wpds-color-stroke-interactive-neutral,#8d8d8d);border-radius:var(--wpds-border-radius-sm,2px);border-style:solid;border-width:var(--wpds-border-width-xs,1px);color:var(--wpds-color-foreground-interactive-neutral,#1e1e1e);display:flex;font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:max(var(--wpds-typography-font-size-md,13px),16px);height:var(--wpds-dimension-size-lg,40px);line-height:1;@media (min-width:600px){font-size:var(--wpds-typography-font-size-md,13px)}&._0c807a84cbb94e0c__is-size-compact{height:var(--wpds-dimension-size-md,32px)}&._0c807a84cbb94e0c__is-size-compact,&.ed67cda122dc1e7b__is-size-small{--wp-ui-input-layout-padding-inline:var(--wpds-dimension-padding-sm,8px)}&.ed67cda122dc1e7b__is-size-small{height:var(--wpds-dimension-size-sm,24px)}&._6fb7104732387680__is-disabled,&:has([data-can-disable-input-layout][data-disabled]){background-color:var(--wpds-color-background-interactive-neutral-weak-disabled,#0000);border-color:var(--wpds-color-stroke-interactive-neutral-disabled,#dbdbdb);color:var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d);@media (forced-colors:active){border-bottom-color:GrayText;border-left-color:GrayText;border-right-color:GrayText;border-top-color:GrayText;color:GrayText}}&._8097270636ca6100__is-borderless{border-color:transparent}&:has(._0d7afad74a057888__input-layout-slot:focus-within){outline:none}&:hover:not(._6fb7104732387680__is-disabled,:has([data-can-disable-input-layout][data-disabled]),._8097270636ca6100__is-borderless){border-color:var(--wpds-color-stroke-interactive-neutral-active,#6e6e6e)}}.c192b41a12b4387b__slot-wrapper{display:contents}._0d7afad74a057888__input-layout-slot{align-items:center;display:flex;&._0c952682762ca288__is-padding-minimal{--wp-ui-input-layout-prefix-padding-start:calc(var(--wp-ui-input-layout-padding-inline) - var(--wpds-dimension-padding-xs, 4px));--wp-ui-input-layout-suffix-padding-end:calc(var(--wp-ui-input-layout-padding-inline) - var(--wpds-dimension-padding-xs, 4px))}[data-slot-type=prefix] &{padding-inline-start:var(--wp-ui-input-layout-prefix-padding-start,var(--wp-ui-input-layout-padding-inline))}[data-slot-type=suffix] &{padding-inline-end:var(--wp-ui-input-layout-suffix-padding-end,var(--wp-ui-input-layout-padding-inline))}}}}'); |
| 16892 |
} |
| 16893 |
var style_default8 = { "input-layout": "cb2baafdc08746bb__input-layout", "is-size-compact": "_0c807a84cbb94e0c__is-size-compact", "is-size-small": "ed67cda122dc1e7b__is-size-small", "is-disabled": "_6fb7104732387680__is-disabled", "is-borderless": "_8097270636ca6100__is-borderless", "input-layout-slot": "_0d7afad74a057888__input-layout-slot", "slot-wrapper": "c192b41a12b4387b__slot-wrapper", "is-padding-minimal": "_0c952682762ca288__is-padding-minimal" }; |
| 16894 |
var InputLayout = (0, import_element32.forwardRef)( |
| 16895 |
function InputLayout2({ |
| 16896 |
className, |
| 16897 |
children, |
| 16898 |
visuallyDisabled, |
| 16899 |
size: size4 = "default", |
| 16900 |
isBorderless, |
| 16901 |
prefix, |
| 16902 |
suffix, |
| 16903 |
...restProps |
| 16904 |
}, ref) { |
| 16905 |
return /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)( |
| 16906 |
"div", |
| 16907 |
{ |
| 16908 |
ref, |
| 16909 |
className: clsx_default( |
| 16910 |
global_css_defense_default3.div, |
| 16911 |
resets_default3["box-sizing"], |
| 16912 |
style_default8["input-layout"], |
| 16913 |
style_default8[`is-size-${size4}`], |
| 16914 |
visuallyDisabled && style_default8["is-disabled"], |
| 16915 |
isBorderless && style_default8["is-borderless"], |
| 16916 |
className |
| 16917 |
), |
| 16918 |
...restProps, |
| 16919 |
children: [ |
| 16920 |
import_element32.Children.count(prefix) > 0 && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)( |
| 16921 |
"div", |
| 16922 |
{ |
| 16923 |
className: style_default8["slot-wrapper"], |
| 16924 |
"data-slot-type": "prefix", |
| 16925 |
children: prefix |
| 16926 |
} |
| 16927 |
), |
| 16928 |
children, |
| 16929 |
import_element32.Children.count(suffix) > 0 && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)( |
| 16930 |
"div", |
| 16931 |
{ |
| 16932 |
className: style_default8["slot-wrapper"], |
| 16933 |
"data-slot-type": "suffix", |
| 16934 |
children: suffix |
| 16935 |
} |
| 16936 |
) |
| 16937 |
] |
| 16938 |
} |
| 16939 |
); |
| 16940 |
} |
| 16941 |
); |
| 16942 |
|
| 16943 |
// packages/ui/build-module/form/primitives/input-layout/slot.mjs |
| 16944 |
var import_element33 = __toESM(require_element(), 1); |
| 16945 |
var import_jsx_runtime55 = __toESM(require_jsx_runtime(), 1); |
| 16946 |
var STYLE_HASH_ATTRIBUTE13 = "data-wp-hash"; |
| 16947 |
function getRuntime13() { |
| 16948 |
const globalScope = globalThis; |
| 16949 |
if (globalScope.__wpStyleRuntime) { |
| 16950 |
return globalScope.__wpStyleRuntime; |
| 16951 |
} |
| 16952 |
globalScope.__wpStyleRuntime = { |
| 16953 |
documents: /* @__PURE__ */ new Map(), |
| 16954 |
styles: /* @__PURE__ */ new Map(), |
| 16955 |
injectedStyles: /* @__PURE__ */ new WeakMap() |
| 16956 |
}; |
| 16957 |
if (typeof document !== "undefined") { |
| 16958 |
registerDocument13(document); |
| 16959 |
} |
| 16960 |
return globalScope.__wpStyleRuntime; |
| 16961 |
} |
| 16962 |
function documentContainsStyleHash13(targetDocument, hash) { |
| 16963 |
if (!targetDocument.head) { |
| 16964 |
return false; |
| 16965 |
} |
| 16966 |
for (const style of targetDocument.head.querySelectorAll( |
| 16967 |
`style[${STYLE_HASH_ATTRIBUTE13}]` |
| 16968 |
)) { |
| 16969 |
if (style.getAttribute(STYLE_HASH_ATTRIBUTE13) === hash) { |
| 16970 |
return true; |
| 16971 |
} |
| 16972 |
} |
| 16973 |
return false; |
| 16974 |
} |
| 16975 |
function injectStyle13(targetDocument, hash, css) { |
| 16976 |
if (!targetDocument.head) { |
| 16977 |
return; |
| 16978 |
} |
| 16979 |
const runtime = getRuntime13(); |
| 16980 |
let injectedStyles = runtime.injectedStyles.get(targetDocument); |
| 16981 |
if (!injectedStyles) { |
| 16982 |
injectedStyles = /* @__PURE__ */ new Set(); |
| 16983 |
runtime.injectedStyles.set(targetDocument, injectedStyles); |
| 16984 |
} |
| 16985 |
if (injectedStyles.has(hash)) { |
| 16986 |
return; |
| 16987 |
} |
| 16988 |
if (documentContainsStyleHash13(targetDocument, hash)) { |
| 16989 |
injectedStyles.add(hash); |
| 16990 |
return; |
| 16991 |
} |
| 16992 |
const style = targetDocument.createElement("style"); |
| 16993 |
style.setAttribute(STYLE_HASH_ATTRIBUTE13, hash); |
| 16994 |
style.appendChild(targetDocument.createTextNode(css)); |
| 16995 |
targetDocument.head.appendChild(style); |
| 16996 |
injectedStyles.add(hash); |
| 16997 |
} |
| 16998 |
function registerDocument13(targetDocument) { |
| 16999 |
const runtime = getRuntime13(); |
| 17000 |
runtime.documents.set( |
| 17001 |
targetDocument, |
| 17002 |
(runtime.documents.get(targetDocument) ?? 0) + 1 |
| 17003 |
); |
| 17004 |
for (const [hash, css] of runtime.styles) { |
| 17005 |
injectStyle13(targetDocument, hash, css); |
| 17006 |
} |
| 17007 |
return () => { |
| 17008 |
const count = runtime.documents.get(targetDocument); |
| 17009 |
if (count === void 0) { |
| 17010 |
return; |
| 17011 |
} |
| 17012 |
if (count <= 1) { |
| 17013 |
runtime.documents.delete(targetDocument); |
| 17014 |
return; |
| 17015 |
} |
| 17016 |
runtime.documents.set(targetDocument, count - 1); |
| 17017 |
}; |
| 17018 |
} |
| 17019 |
function registerStyle13(hash, css) { |
| 17020 |
const runtime = getRuntime13(); |
| 17021 |
runtime.styles.set(hash, css); |
| 17022 |
for (const targetDocument of runtime.documents.keys()) { |
| 17023 |
injectStyle13(targetDocument, hash, css); |
| 17024 |
} |
| 17025 |
} |
| 17026 |
if (typeof process === "undefined" || true) { |
| 17027 |
registerStyle13("bc14d8e61b", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{.cb2baafdc08746bb__input-layout{--wp-ui-input-layout-padding-inline:var(--wpds-dimension-padding-md,12px);background-color:var(--wpds-color-background-interactive-neutral-weak,#0000);border-color:var(--wpds-color-stroke-interactive-neutral,#8d8d8d);border-radius:var(--wpds-border-radius-sm,2px);border-style:solid;border-width:var(--wpds-border-width-xs,1px);color:var(--wpds-color-foreground-interactive-neutral,#1e1e1e);display:flex;font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:max(var(--wpds-typography-font-size-md,13px),16px);height:var(--wpds-dimension-size-lg,40px);line-height:1;@media (min-width:600px){font-size:var(--wpds-typography-font-size-md,13px)}&._0c807a84cbb94e0c__is-size-compact{height:var(--wpds-dimension-size-md,32px)}&._0c807a84cbb94e0c__is-size-compact,&.ed67cda122dc1e7b__is-size-small{--wp-ui-input-layout-padding-inline:var(--wpds-dimension-padding-sm,8px)}&.ed67cda122dc1e7b__is-size-small{height:var(--wpds-dimension-size-sm,24px)}&._6fb7104732387680__is-disabled,&:has([data-can-disable-input-layout][data-disabled]){background-color:var(--wpds-color-background-interactive-neutral-weak-disabled,#0000);border-color:var(--wpds-color-stroke-interactive-neutral-disabled,#dbdbdb);color:var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d);@media (forced-colors:active){border-bottom-color:GrayText;border-left-color:GrayText;border-right-color:GrayText;border-top-color:GrayText;color:GrayText}}&._8097270636ca6100__is-borderless{border-color:transparent}&:has(._0d7afad74a057888__input-layout-slot:focus-within){outline:none}&:hover:not(._6fb7104732387680__is-disabled,:has([data-can-disable-input-layout][data-disabled]),._8097270636ca6100__is-borderless){border-color:var(--wpds-color-stroke-interactive-neutral-active,#6e6e6e)}}.c192b41a12b4387b__slot-wrapper{display:contents}._0d7afad74a057888__input-layout-slot{align-items:center;display:flex;&._0c952682762ca288__is-padding-minimal{--wp-ui-input-layout-prefix-padding-start:calc(var(--wp-ui-input-layout-padding-inline) - var(--wpds-dimension-padding-xs, 4px));--wp-ui-input-layout-suffix-padding-end:calc(var(--wp-ui-input-layout-padding-inline) - var(--wpds-dimension-padding-xs, 4px))}[data-slot-type=prefix] &{padding-inline-start:var(--wp-ui-input-layout-prefix-padding-start,var(--wp-ui-input-layout-padding-inline))}[data-slot-type=suffix] &{padding-inline-end:var(--wp-ui-input-layout-suffix-padding-end,var(--wp-ui-input-layout-padding-inline))}}}}'); |
| 17028 |
} |
| 17029 |
var style_default9 = { "input-layout": "cb2baafdc08746bb__input-layout", "is-size-compact": "_0c807a84cbb94e0c__is-size-compact", "is-size-small": "ed67cda122dc1e7b__is-size-small", "is-disabled": "_6fb7104732387680__is-disabled", "is-borderless": "_8097270636ca6100__is-borderless", "input-layout-slot": "_0d7afad74a057888__input-layout-slot", "slot-wrapper": "c192b41a12b4387b__slot-wrapper", "is-padding-minimal": "_0c952682762ca288__is-padding-minimal" }; |
| 17030 |
var InputLayoutSlot = (0, import_element33.forwardRef)(function InputLayoutSlot2({ padding = "default", className, ...restProps }, ref) { |
| 17031 |
return /* @__PURE__ */ (0, import_jsx_runtime55.jsx)( |
| 17032 |
"div", |
| 17033 |
{ |
| 17034 |
ref, |
| 17035 |
className: clsx_default( |
| 17036 |
style_default9["input-layout-slot"], |
| 17037 |
style_default9[`is-padding-${padding}`], |
| 17038 |
className |
| 17039 |
), |
| 17040 |
...restProps |
| 17041 |
} |
| 17042 |
); |
| 17043 |
}); |
| 17044 |
InputLayoutSlot.displayName = "InputLayout.Slot"; |
| 17045 |
|
| 17046 |
// packages/ui/build-module/form/primitives/input-layout/index.mjs |
| 17047 |
var InputLayout3 = Object.assign(InputLayout, { |
| 17048 |
Slot: InputLayoutSlot |
| 17049 |
}); |
| 17050 |
|
| 17051 |
// packages/ui/build-module/form/primitives/input/input.mjs |
| 17052 |
var import_jsx_runtime56 = __toESM(require_jsx_runtime(), 1); |
| 17053 |
var STYLE_HASH_ATTRIBUTE14 = "data-wp-hash"; |
| 17054 |
function getRuntime14() { |
| 17055 |
const globalScope = globalThis; |
| 17056 |
if (globalScope.__wpStyleRuntime) { |
| 17057 |
return globalScope.__wpStyleRuntime; |
| 17058 |
} |
| 17059 |
globalScope.__wpStyleRuntime = { |
| 17060 |
documents: /* @__PURE__ */ new Map(), |
| 17061 |
styles: /* @__PURE__ */ new Map(), |
| 17062 |
injectedStyles: /* @__PURE__ */ new WeakMap() |
| 17063 |
}; |
| 17064 |
if (typeof document !== "undefined") { |
| 17065 |
registerDocument14(document); |
| 17066 |
} |
| 17067 |
return globalScope.__wpStyleRuntime; |
| 17068 |
} |
| 17069 |
function documentContainsStyleHash14(targetDocument, hash) { |
| 17070 |
if (!targetDocument.head) { |
| 17071 |
return false; |
| 17072 |
} |
| 17073 |
for (const style of targetDocument.head.querySelectorAll( |
| 17074 |
`style[${STYLE_HASH_ATTRIBUTE14}]` |
| 17075 |
)) { |
| 17076 |
if (style.getAttribute(STYLE_HASH_ATTRIBUTE14) === hash) { |
| 17077 |
return true; |
| 17078 |
} |
| 17079 |
} |
| 17080 |
return false; |
| 17081 |
} |
| 17082 |
function injectStyle14(targetDocument, hash, css) { |
| 17083 |
if (!targetDocument.head) { |
| 17084 |
return; |
| 17085 |
} |
| 17086 |
const runtime = getRuntime14(); |
| 17087 |
let injectedStyles = runtime.injectedStyles.get(targetDocument); |
| 17088 |
if (!injectedStyles) { |
| 17089 |
injectedStyles = /* @__PURE__ */ new Set(); |
| 17090 |
runtime.injectedStyles.set(targetDocument, injectedStyles); |
| 17091 |
} |
| 17092 |
if (injectedStyles.has(hash)) { |
| 17093 |
return; |
| 17094 |
} |
| 17095 |
if (documentContainsStyleHash14(targetDocument, hash)) { |
| 17096 |
injectedStyles.add(hash); |
| 17097 |
return; |
| 17098 |
} |
| 17099 |
const style = targetDocument.createElement("style"); |
| 17100 |
style.setAttribute(STYLE_HASH_ATTRIBUTE14, hash); |
| 17101 |
style.appendChild(targetDocument.createTextNode(css)); |
| 17102 |
targetDocument.head.appendChild(style); |
| 17103 |
injectedStyles.add(hash); |
| 17104 |
} |
| 17105 |
function registerDocument14(targetDocument) { |
| 17106 |
const runtime = getRuntime14(); |
| 17107 |
runtime.documents.set( |
| 17108 |
targetDocument, |
| 17109 |
(runtime.documents.get(targetDocument) ?? 0) + 1 |
| 17110 |
); |
| 17111 |
for (const [hash, css] of runtime.styles) { |
| 17112 |
injectStyle14(targetDocument, hash, css); |
| 17113 |
} |
| 17114 |
return () => { |
| 17115 |
const count = runtime.documents.get(targetDocument); |
| 17116 |
if (count === void 0) { |
| 17117 |
return; |
| 17118 |
} |
| 17119 |
if (count <= 1) { |
| 17120 |
runtime.documents.delete(targetDocument); |
| 17121 |
return; |
| 17122 |
} |
| 17123 |
runtime.documents.set(targetDocument, count - 1); |
| 17124 |
}; |
| 17125 |
} |
| 17126 |
function registerStyle14(hash, css) { |
| 17127 |
const runtime = getRuntime14(); |
| 17128 |
runtime.styles.set(hash, css); |
| 17129 |
for (const targetDocument of runtime.documents.keys()) { |
| 17130 |
injectStyle14(targetDocument, hash, css); |
| 17131 |
} |
| 17132 |
} |
| 17133 |
if (typeof process === "undefined" || true) { |
| 17134 |
registerStyle14("d390e935a7", "._6defc79820e382c6__button{box-sizing:var(--_gcd-button-box-sizing,border-box);font-family:var(--_gcd-button-font-family,inherit);font-size:var(--_gcd-button-font-size,inherit);font-weight:var(--_gcd-button-font-weight,inherit)}.d2cff2e5dea83bd1__input{box-sizing:var(--_gcd-input-box-sizing,border-box);font-family:var(--_gcd-input-font-family,inherit);font-size:var(--_gcd-input-font-size,inherit);font-weight:var(--_gcd-input-font-weight,inherit);margin:var(--_gcd-input-margin,0);&:is(textarea,[type=text],[type=password],[type=color],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){background-color:var(--_gcd-input-background-color,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))}&::placeholder{color:var(--_gcd-input-placeholder-color,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-medium,499));margin:var(--_gcd-heading-margin,0)}._2c0831b0499dbd6e__a,._2c0831b0499dbd6e__a:is(:hover,:focus,:active){border-radius:var(--_gcd-a-border-radius,0);box-shadow:var(--_gcd-a-box-shadow,none);color:var(--_gcd-a-color,inherit);outline:var(--_gcd-a-outline,0 solid transparent);transition:var(--_gcd-a-transition,none)}"); |
| 17135 |
} |
| 17136 |
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" }; |
| 17137 |
if (typeof process === "undefined" || true) { |
| 17138 |
registerStyle14("5f8e7aa0bc", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._08e8a2e44959f892__outset-ring--focus:focus,._970d04df7376df67__outset-ring--focus-within-except-active:focus-within:not(:has(:active)),.c5cb3ee4bddaa8e4__outset-ring--focus-within-visible:focus-within:has(:focus-visible),.cd83dfc2126a0846__outset-ring--focus-within:focus-within,.d0541bc9dd9dc7b6__outset-ring--focus-visible:focus-visible,.e25b2bdd7aa21721__outset-ring--focus-except-active:focus:not(:active),:focus-visible .ecadb9e080e2dfa5__outset-ring--focus-parent-visible{--_gcd-a-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9));--_gcd-div-outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9));outline:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px)) solid var(--wpds-color-stroke-focus,var(--wp-admin-theme-color,#3858e9));outline-offset:var(--wpds-border-width-focus,var(--wp-admin-border-width-focus,2px))}}}"); |
| 17139 |
} |
| 17140 |
var focus_default2 = { "outset-ring--focus": "_08e8a2e44959f892__outset-ring--focus", "outset-ring--focus-except-active": "e25b2bdd7aa21721__outset-ring--focus-except-active", "outset-ring--focus-visible": "d0541bc9dd9dc7b6__outset-ring--focus-visible", "outset-ring--focus-within": "cd83dfc2126a0846__outset-ring--focus-within", "outset-ring--focus-within-except-active": "_970d04df7376df67__outset-ring--focus-within-except-active", "outset-ring--focus-within-visible": "c5cb3ee4bddaa8e4__outset-ring--focus-within-visible", "outset-ring--focus-parent-visible": "ecadb9e080e2dfa5__outset-ring--focus-parent-visible" }; |
| 17141 |
if (typeof process === "undefined" || true) { |
| 17142 |
registerStyle14("5f69bdbcb5", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._2ae7be2fc1bb17a3__input{--_gcd-input-padding:var(--wp-ui-input-padding-block,0) var(--wp-ui-input-layout-padding-inline,0);background:transparent;border:none;color:var(--wpds-color-foreground-interactive-neutral,#1e1e1e);font-family:inherit;font-size:inherit;line-height:inherit;outline:none;padding-block:var(--wp-ui-input-padding-block,0);padding-inline:var(--wp-ui-input-layout-padding-inline,0);width:100%;&::placeholder{color:var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d)}&:disabled,&[aria-disabled=true]{color:var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d);@media (forced-colors:active){color:GrayText}}&[type=email],&[type=url]{direction:ltr}}}}"); |
| 17143 |
} |
| 17144 |
var style_default10 = { "input": "_2ae7be2fc1bb17a3__input" }; |
| 17145 |
var Input3 = (0, import_element34.forwardRef)(function Input22({ className, size: size4 = "default", prefix, suffix, style, ...restProps }, ref) { |
| 17146 |
return /* @__PURE__ */ (0, import_jsx_runtime56.jsx)( |
| 17147 |
InputLayout3, |
| 17148 |
{ |
| 17149 |
className: clsx_default( |
| 17150 |
focus_default2["outset-ring--focus-within"], |
| 17151 |
className |
| 17152 |
), |
| 17153 |
style, |
| 17154 |
size: size4, |
| 17155 |
visuallyDisabled: restProps.disabled, |
| 17156 |
prefix, |
| 17157 |
suffix, |
| 17158 |
children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)( |
| 17159 |
Input, |
| 17160 |
{ |
| 17161 |
ref, |
| 17162 |
className: clsx_default(global_css_defense_default4.input, style_default10.input), |
| 17163 |
...restProps |
| 17164 |
} |
| 17165 |
) |
| 17166 |
} |
| 17167 |
); |
| 17168 |
}); |
| 17169 |
|
| 17170 |
// packages/ui/build-module/form/primitives/autocomplete/input.mjs |
| 17171 |
var import_jsx_runtime57 = __toESM(require_jsx_runtime(), 1); |
| 17172 |
var DEFAULT_RENDER2 = (props) => /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Input3, { ...props }); |
| 17173 |
var Input4 = (0, import_element35.forwardRef)( |
| 17174 |
function Input23({ render = DEFAULT_RENDER2, ...restProps }, ref) { |
| 17175 |
return /* @__PURE__ */ (0, import_jsx_runtime57.jsx)( |
| 17176 |
index_parts_exports.Input, |
| 17177 |
{ |
| 17178 |
ref, |
| 17179 |
render, |
| 17180 |
...restProps |
| 17181 |
} |
| 17182 |
); |
| 17183 |
} |
| 17184 |
); |
| 17185 |
|
| 17186 |
// packages/ui/build-module/form/primitives/autocomplete/item.mjs |
| 17187 |
var import_element36 = __toESM(require_element(), 1); |
| 17188 |
var import_jsx_runtime58 = __toESM(require_jsx_runtime(), 1); |
| 17189 |
var STYLE_HASH_ATTRIBUTE15 = "data-wp-hash"; |
| 17190 |
function getRuntime15() { |
| 17191 |
const globalScope = globalThis; |
| 17192 |
if (globalScope.__wpStyleRuntime) { |
| 17193 |
return globalScope.__wpStyleRuntime; |
| 17194 |
} |
| 17195 |
globalScope.__wpStyleRuntime = { |
| 17196 |
documents: /* @__PURE__ */ new Map(), |
| 17197 |
styles: /* @__PURE__ */ new Map(), |
| 17198 |
injectedStyles: /* @__PURE__ */ new WeakMap() |
| 17199 |
}; |
| 17200 |
if (typeof document !== "undefined") { |
| 17201 |
registerDocument15(document); |
| 17202 |
} |
| 17203 |
return globalScope.__wpStyleRuntime; |
| 17204 |
} |
| 17205 |
function documentContainsStyleHash15(targetDocument, hash) { |
| 17206 |
if (!targetDocument.head) { |
| 17207 |
return false; |
| 17208 |
} |
| 17209 |
for (const style of targetDocument.head.querySelectorAll( |
| 17210 |
`style[${STYLE_HASH_ATTRIBUTE15}]` |
| 17211 |
)) { |
| 17212 |
if (style.getAttribute(STYLE_HASH_ATTRIBUTE15) === hash) { |
| 17213 |
return true; |
| 17214 |
} |
| 17215 |
} |
| 17216 |
return false; |
| 17217 |
} |
| 17218 |
function injectStyle15(targetDocument, hash, css) { |
| 17219 |
if (!targetDocument.head) { |
| 17220 |
return; |
| 17221 |
} |
| 17222 |
const runtime = getRuntime15(); |
| 17223 |
let injectedStyles = runtime.injectedStyles.get(targetDocument); |
| 17224 |
if (!injectedStyles) { |
| 17225 |
injectedStyles = /* @__PURE__ */ new Set(); |
| 17226 |
runtime.injectedStyles.set(targetDocument, injectedStyles); |
| 17227 |
} |
| 17228 |
if (injectedStyles.has(hash)) { |
| 17229 |
return; |
| 17230 |
} |
| 17231 |
if (documentContainsStyleHash15(targetDocument, hash)) { |
| 17232 |
injectedStyles.add(hash); |
| 17233 |
return; |
| 17234 |
} |
| 17235 |
const style = targetDocument.createElement("style"); |
| 17236 |
style.setAttribute(STYLE_HASH_ATTRIBUTE15, hash); |
| 17237 |
style.appendChild(targetDocument.createTextNode(css)); |
| 17238 |
targetDocument.head.appendChild(style); |
| 17239 |
injectedStyles.add(hash); |
| 17240 |
} |
| 17241 |
function registerDocument15(targetDocument) { |
| 17242 |
const runtime = getRuntime15(); |
| 17243 |
runtime.documents.set( |
| 17244 |
targetDocument, |
| 17245 |
(runtime.documents.get(targetDocument) ?? 0) + 1 |
| 17246 |
); |
| 17247 |
for (const [hash, css] of runtime.styles) { |
| 17248 |
injectStyle15(targetDocument, hash, css); |
| 17249 |
} |
| 17250 |
return () => { |
| 17251 |
const count = runtime.documents.get(targetDocument); |
| 17252 |
if (count === void 0) { |
| 17253 |
return; |
| 17254 |
} |
| 17255 |
if (count <= 1) { |
| 17256 |
runtime.documents.delete(targetDocument); |
| 17257 |
return; |
| 17258 |
} |
| 17259 |
runtime.documents.set(targetDocument, count - 1); |
| 17260 |
}; |
| 17261 |
} |
| 17262 |
function registerStyle15(hash, css) { |
| 17263 |
const runtime = getRuntime15(); |
| 17264 |
runtime.styles.set(hash, css); |
| 17265 |
for (const targetDocument of runtime.documents.keys()) { |
| 17266 |
injectStyle15(targetDocument, hash, css); |
| 17267 |
} |
| 17268 |
} |
| 17269 |
if (typeof process === "undefined" || true) { |
| 17270 |
registerStyle15("b5813d84e6", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._380b81b8f79fb10f__dropdown-motion{--wp-ui-dropdown-slide-distance:4px;--wp-ui-dropdown-slide-duration:var(--wpds-motion-duration-md,200ms);--wp-ui-dropdown-slide-easing:var(--wpds-motion-easing-expressive,cubic-bezier(0.25,0,0,1));--wp-ui-dropdown-fade-duration:var(--wpds-motion-duration-sm,100ms);--wp-ui-dropdown-fade-easing:linear;@media not (prefers-reduced-motion){transition-duration:var(--wp-ui-dropdown-slide-duration),var(--wp-ui-dropdown-fade-duration);transition-property:transform,opacity;transition-timing-function:var(--wp-ui-dropdown-slide-easing),var(--wp-ui-dropdown-fade-easing);will-change:transform,opacity}opacity:1;transform:translate(0);&[data-instant]{transition:none}&[data-ending-style],&[data-starting-style]{opacity:0}&[data-side=bottom][data-ending-style],&[data-side=bottom][data-starting-style]{transform:translateY(calc(var(--wp-ui-dropdown-slide-distance)*-1))}&[data-side=top][data-ending-style],&[data-side=top][data-starting-style]{transform:translateY(var(--wp-ui-dropdown-slide-distance))}&[data-side=left][data-ending-style],&[data-side=left][data-starting-style]{transform:translateX(var(--wp-ui-dropdown-slide-distance))}&[data-side=right][data-ending-style],&[data-side=right][data-starting-style]{transform:translateX(calc(var(--wp-ui-dropdown-slide-distance)*-1))}}}}@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._234b520016b4e56f__popup{--wp-ui-popup-padding:var(--wpds-dimension-padding-xs,4px);background-color:var(--wpds-color-background-surface-neutral-strong,#fff);border:var(--wpds-border-width-xs,1px) solid var(--wpds-color-stroke-surface-neutral,#dbdbdb);border-radius:var(--wpds-border-radius-md,4px);box-shadow:var(--wpds-elevation-md,0 2px 3px 0 #0000000d,0 4px 5px 0 #0000000a,0 12px 12px 0 #00000008,0 16px 16px 0 #00000005);display:grid;grid-template-areas:"header" "main";grid-template-rows:auto minmax(0,1fr);max-height:min(var(--available-height),480px,60dvh);max-width:var(--available-width);min-width:var(--anchor-width)}.f43dc7c768d7b622__list{color:var(--wpds-color-foreground-interactive-neutral,#1e1e1e);display:grid;font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wpds-typography-font-size-md,13px);grid-area:main;grid-template-areas:"scrollable" "footer";grid-template-rows:minmax(0,1fr) auto;line-height:var(--wpds-typography-line-height-sm,20px)}._233cd60cdb84a2ef__list-scrollable-container{grid-area:scrollable;overflow-block:auto;overscroll-behavior:contain;scroll-padding-block:var(--wp-ui-popup-padding);&:not(:empty){padding-block:var(--wp-ui-popup-padding)}}.ec4db6f0122263e7__list-footer{grid-area:footer;padding-block:var(--wp-ui-popup-padding);._233cd60cdb84a2ef__list-scrollable-container:not(:empty)+&{border-block-start:var(--wpds-border-width-xs,1px) solid var(--wpds-color-stroke-surface-neutral,#dbdbdb)}}.b3c0d7f103fb10a2__group:not(:first-child){margin-block-start:var(--wpds-dimension-gap-sm,8px)}._21b59380477c306c__group-label{align-items:center;color:var(--wpds-color-foreground-content-neutral-weak,#707070);display:flex;min-height:var(--wpds-dimension-size-md,32px);padding-inline:var(--wpds-dimension-padding-md,12px)}._684ccb7988365b4f__item{--wp-ui-popup-item-height:var(--wpds-dimension-size-lg,40px);--wp-ui-popup-item-padding-inline:var(--wpds-dimension-padding-md,12px);--wp-ui-popup-item-padding-block:var(--wpds-dimension-padding-xs,4px);align-items:center;border-radius:var(--wpds-border-radius-sm,2px);display:flex;gap:var(--wpds-dimension-gap-xs,4px);justify-content:flex-start;margin-inline:var(--wp-ui-popup-padding);min-height:var(--wp-ui-popup-item-height);padding-block:var(--wp-ui-popup-item-padding-block);padding-inline-end:var(--wp-ui-popup-item-padding-inline);padding-inline-start:calc(var(--wp-ui-popup-item-padding-inline) - var(--wpds-dimension-padding-xs, 4px));user-select:none;&:not([data-disabled]){cursor:var(--wpds-cursor-control,pointer)}&.f181b98b0d33282a__is-size-compact{--wp-ui-popup-item-height:var(--wpds-dimension-size-md,32px);--wp-ui-popup-item-padding-inline:var(--wpds-dimension-padding-sm,8px)}&._38f7faff93c61958__is-size-small{--wp-ui-popup-item-height:var(--wpds-dimension-size-sm,24px);--wp-ui-popup-item-padding-inline:var(--wpds-dimension-padding-sm,8px);--wp-ui-popup-item-padding-block:2px}&:not([data-selected]){._92fbe4765dfad5ee__item-indicator-icon{opacity:0}}&[data-highlighted]:not([aria-disabled=true]){background-color:var(--wpds-color-background-interactive-brand-weak-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 12%,#fff));color:var(--wpds-color-foreground-interactive-neutral,#1e1e1e);outline:none;@media (forced-colors:active){outline:1px solid Highlight}}&[aria-disabled=true]{background-color:var(--wpds-color-background-interactive-brand-weak-disabled,#0000);color:var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d);@media (forced-colors:active){color:GrayText}}}.a3adcfd0b73ffd40__item-icon{flex-shrink:0}._06c7ff39d2f685b9__empty:not(:empty){--wp-ui-popup-empty-min-height:var(--wpds-dimension-size-lg,40px);--wp-ui-popup-empty-padding-inline:var(--wpds-dimension-padding-md,12px);align-items:center;color:var(--wpds-color-foreground-content-neutral-weak,#707070);display:flex;font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wpds-typography-font-size-md,13px);grid-area:main;line-height:var(--wpds-typography-line-height-sm,20px);min-height:var(--wp-ui-popup-empty-min-height);padding-inline:var(--wp-ui-popup-empty-padding-inline)}}}'); |
| 17271 |
} |
| 17272 |
var item_popup_default4 = { "popup": "_234b520016b4e56f__popup _380b81b8f79fb10f__dropdown-motion", "list": "f43dc7c768d7b622__list", "list-scrollable-container": "_233cd60cdb84a2ef__list-scrollable-container", "list-footer": "ec4db6f0122263e7__list-footer", "group": "b3c0d7f103fb10a2__group", "group-label": "_21b59380477c306c__group-label", "item": "_684ccb7988365b4f__item", "is-size-compact": "f181b98b0d33282a__is-size-compact", "is-size-small": "_38f7faff93c61958__is-size-small", "item-indicator-icon": "_92fbe4765dfad5ee__item-indicator-icon", "item-icon": "a3adcfd0b73ffd40__item-icon", "empty": "_06c7ff39d2f685b9__empty" }; |
| 17273 |
if (typeof process === "undefined" || true) { |
| 17274 |
registerStyle15("10f3806643", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._336cd3e4e743482f__box-sizing{box-sizing:border-box;*,:after,:before{box-sizing:inherit}}}}"); |
| 17275 |
} |
| 17276 |
var resets_default4 = { "box-sizing": "_336cd3e4e743482f__box-sizing" }; |
| 17277 |
var Item = (0, import_element36.forwardRef)( |
| 17278 |
function Item2({ className, children, ...restProps }, ref) { |
| 17279 |
return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)( |
| 17280 |
index_parts_exports.Item, |
| 17281 |
{ |
| 17282 |
className: clsx_default( |
| 17283 |
resets_default4["box-sizing"], |
| 17284 |
item_popup_default4.item, |
| 17285 |
className |
| 17286 |
), |
| 17287 |
ref, |
| 17288 |
...restProps, |
| 17289 |
children |
| 17290 |
} |
| 17291 |
); |
| 17292 |
} |
| 17293 |
); |
| 17294 |
|
| 17295 |
// packages/ui/build-module/form/primitives/autocomplete/list.mjs |
| 17296 |
var import_element37 = __toESM(require_element(), 1); |
| 17297 |
var import_jsx_runtime59 = __toESM(require_jsx_runtime(), 1); |
| 17298 |
var STYLE_HASH_ATTRIBUTE16 = "data-wp-hash"; |
| 17299 |
function getRuntime16() { |
| 17300 |
const globalScope = globalThis; |
| 17301 |
if (globalScope.__wpStyleRuntime) { |
| 17302 |
return globalScope.__wpStyleRuntime; |
| 17303 |
} |
| 17304 |
globalScope.__wpStyleRuntime = { |
| 17305 |
documents: /* @__PURE__ */ new Map(), |
| 17306 |
styles: /* @__PURE__ */ new Map(), |
| 17307 |
injectedStyles: /* @__PURE__ */ new WeakMap() |
| 17308 |
}; |
| 17309 |
if (typeof document !== "undefined") { |
| 17310 |
registerDocument16(document); |
| 17311 |
} |
| 17312 |
return globalScope.__wpStyleRuntime; |
| 17313 |
} |
| 17314 |
function documentContainsStyleHash16(targetDocument, hash) { |
| 17315 |
if (!targetDocument.head) { |
| 17316 |
return false; |
| 17317 |
} |
| 17318 |
for (const style of targetDocument.head.querySelectorAll( |
| 17319 |
`style[${STYLE_HASH_ATTRIBUTE16}]` |
| 17320 |
)) { |
| 17321 |
if (style.getAttribute(STYLE_HASH_ATTRIBUTE16) === hash) { |
| 17322 |
return true; |
| 17323 |
} |
| 17324 |
} |
| 17325 |
return false; |
| 17326 |
} |
| 17327 |
function injectStyle16(targetDocument, hash, css) { |
| 17328 |
if (!targetDocument.head) { |
| 17329 |
return; |
| 17330 |
} |
| 17331 |
const runtime = getRuntime16(); |
| 17332 |
let injectedStyles = runtime.injectedStyles.get(targetDocument); |
| 17333 |
if (!injectedStyles) { |
| 17334 |
injectedStyles = /* @__PURE__ */ new Set(); |
| 17335 |
runtime.injectedStyles.set(targetDocument, injectedStyles); |
| 17336 |
} |
| 17337 |
if (injectedStyles.has(hash)) { |
| 17338 |
return; |
| 17339 |
} |
| 17340 |
if (documentContainsStyleHash16(targetDocument, hash)) { |
| 17341 |
injectedStyles.add(hash); |
| 17342 |
return; |
| 17343 |
} |
| 17344 |
const style = targetDocument.createElement("style"); |
| 17345 |
style.setAttribute(STYLE_HASH_ATTRIBUTE16, hash); |
| 17346 |
style.appendChild(targetDocument.createTextNode(css)); |
| 17347 |
targetDocument.head.appendChild(style); |
| 17348 |
injectedStyles.add(hash); |
| 17349 |
} |
| 17350 |
function registerDocument16(targetDocument) { |
| 17351 |
const runtime = getRuntime16(); |
| 17352 |
runtime.documents.set( |
| 17353 |
targetDocument, |
| 17354 |
(runtime.documents.get(targetDocument) ?? 0) + 1 |
| 17355 |
); |
| 17356 |
for (const [hash, css] of runtime.styles) { |
| 17357 |
injectStyle16(targetDocument, hash, css); |
| 17358 |
} |
| 17359 |
return () => { |
| 17360 |
const count = runtime.documents.get(targetDocument); |
| 17361 |
if (count === void 0) { |
| 17362 |
return; |
| 17363 |
} |
| 17364 |
if (count <= 1) { |
| 17365 |
runtime.documents.delete(targetDocument); |
| 17366 |
return; |
| 17367 |
} |
| 17368 |
runtime.documents.set(targetDocument, count - 1); |
| 17369 |
}; |
| 17370 |
} |
| 17371 |
function registerStyle16(hash, css) { |
| 17372 |
const runtime = getRuntime16(); |
| 17373 |
runtime.styles.set(hash, css); |
| 17374 |
for (const targetDocument of runtime.documents.keys()) { |
| 17375 |
injectStyle16(targetDocument, hash, css); |
| 17376 |
} |
| 17377 |
} |
| 17378 |
if (typeof process === "undefined" || true) { |
| 17379 |
registerStyle16("b5813d84e6", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._380b81b8f79fb10f__dropdown-motion{--wp-ui-dropdown-slide-distance:4px;--wp-ui-dropdown-slide-duration:var(--wpds-motion-duration-md,200ms);--wp-ui-dropdown-slide-easing:var(--wpds-motion-easing-expressive,cubic-bezier(0.25,0,0,1));--wp-ui-dropdown-fade-duration:var(--wpds-motion-duration-sm,100ms);--wp-ui-dropdown-fade-easing:linear;@media not (prefers-reduced-motion){transition-duration:var(--wp-ui-dropdown-slide-duration),var(--wp-ui-dropdown-fade-duration);transition-property:transform,opacity;transition-timing-function:var(--wp-ui-dropdown-slide-easing),var(--wp-ui-dropdown-fade-easing);will-change:transform,opacity}opacity:1;transform:translate(0);&[data-instant]{transition:none}&[data-ending-style],&[data-starting-style]{opacity:0}&[data-side=bottom][data-ending-style],&[data-side=bottom][data-starting-style]{transform:translateY(calc(var(--wp-ui-dropdown-slide-distance)*-1))}&[data-side=top][data-ending-style],&[data-side=top][data-starting-style]{transform:translateY(var(--wp-ui-dropdown-slide-distance))}&[data-side=left][data-ending-style],&[data-side=left][data-starting-style]{transform:translateX(var(--wp-ui-dropdown-slide-distance))}&[data-side=right][data-ending-style],&[data-side=right][data-starting-style]{transform:translateX(calc(var(--wp-ui-dropdown-slide-distance)*-1))}}}}@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._234b520016b4e56f__popup{--wp-ui-popup-padding:var(--wpds-dimension-padding-xs,4px);background-color:var(--wpds-color-background-surface-neutral-strong,#fff);border:var(--wpds-border-width-xs,1px) solid var(--wpds-color-stroke-surface-neutral,#dbdbdb);border-radius:var(--wpds-border-radius-md,4px);box-shadow:var(--wpds-elevation-md,0 2px 3px 0 #0000000d,0 4px 5px 0 #0000000a,0 12px 12px 0 #00000008,0 16px 16px 0 #00000005);display:grid;grid-template-areas:"header" "main";grid-template-rows:auto minmax(0,1fr);max-height:min(var(--available-height),480px,60dvh);max-width:var(--available-width);min-width:var(--anchor-width)}.f43dc7c768d7b622__list{color:var(--wpds-color-foreground-interactive-neutral,#1e1e1e);display:grid;font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wpds-typography-font-size-md,13px);grid-area:main;grid-template-areas:"scrollable" "footer";grid-template-rows:minmax(0,1fr) auto;line-height:var(--wpds-typography-line-height-sm,20px)}._233cd60cdb84a2ef__list-scrollable-container{grid-area:scrollable;overflow-block:auto;overscroll-behavior:contain;scroll-padding-block:var(--wp-ui-popup-padding);&:not(:empty){padding-block:var(--wp-ui-popup-padding)}}.ec4db6f0122263e7__list-footer{grid-area:footer;padding-block:var(--wp-ui-popup-padding);._233cd60cdb84a2ef__list-scrollable-container:not(:empty)+&{border-block-start:var(--wpds-border-width-xs,1px) solid var(--wpds-color-stroke-surface-neutral,#dbdbdb)}}.b3c0d7f103fb10a2__group:not(:first-child){margin-block-start:var(--wpds-dimension-gap-sm,8px)}._21b59380477c306c__group-label{align-items:center;color:var(--wpds-color-foreground-content-neutral-weak,#707070);display:flex;min-height:var(--wpds-dimension-size-md,32px);padding-inline:var(--wpds-dimension-padding-md,12px)}._684ccb7988365b4f__item{--wp-ui-popup-item-height:var(--wpds-dimension-size-lg,40px);--wp-ui-popup-item-padding-inline:var(--wpds-dimension-padding-md,12px);--wp-ui-popup-item-padding-block:var(--wpds-dimension-padding-xs,4px);align-items:center;border-radius:var(--wpds-border-radius-sm,2px);display:flex;gap:var(--wpds-dimension-gap-xs,4px);justify-content:flex-start;margin-inline:var(--wp-ui-popup-padding);min-height:var(--wp-ui-popup-item-height);padding-block:var(--wp-ui-popup-item-padding-block);padding-inline-end:var(--wp-ui-popup-item-padding-inline);padding-inline-start:calc(var(--wp-ui-popup-item-padding-inline) - var(--wpds-dimension-padding-xs, 4px));user-select:none;&:not([data-disabled]){cursor:var(--wpds-cursor-control,pointer)}&.f181b98b0d33282a__is-size-compact{--wp-ui-popup-item-height:var(--wpds-dimension-size-md,32px);--wp-ui-popup-item-padding-inline:var(--wpds-dimension-padding-sm,8px)}&._38f7faff93c61958__is-size-small{--wp-ui-popup-item-height:var(--wpds-dimension-size-sm,24px);--wp-ui-popup-item-padding-inline:var(--wpds-dimension-padding-sm,8px);--wp-ui-popup-item-padding-block:2px}&:not([data-selected]){._92fbe4765dfad5ee__item-indicator-icon{opacity:0}}&[data-highlighted]:not([aria-disabled=true]){background-color:var(--wpds-color-background-interactive-brand-weak-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 12%,#fff));color:var(--wpds-color-foreground-interactive-neutral,#1e1e1e);outline:none;@media (forced-colors:active){outline:1px solid Highlight}}&[aria-disabled=true]{background-color:var(--wpds-color-background-interactive-brand-weak-disabled,#0000);color:var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d);@media (forced-colors:active){color:GrayText}}}.a3adcfd0b73ffd40__item-icon{flex-shrink:0}._06c7ff39d2f685b9__empty:not(:empty){--wp-ui-popup-empty-min-height:var(--wpds-dimension-size-lg,40px);--wp-ui-popup-empty-padding-inline:var(--wpds-dimension-padding-md,12px);align-items:center;color:var(--wpds-color-foreground-content-neutral-weak,#707070);display:flex;font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wpds-typography-font-size-md,13px);grid-area:main;line-height:var(--wpds-typography-line-height-sm,20px);min-height:var(--wp-ui-popup-empty-min-height);padding-inline:var(--wp-ui-popup-empty-padding-inline)}}}'); |
| 17380 |
} |
| 17381 |
var item_popup_default5 = { "popup": "_234b520016b4e56f__popup _380b81b8f79fb10f__dropdown-motion", "list": "f43dc7c768d7b622__list", "list-scrollable-container": "_233cd60cdb84a2ef__list-scrollable-container", "list-footer": "ec4db6f0122263e7__list-footer", "group": "b3c0d7f103fb10a2__group", "group-label": "_21b59380477c306c__group-label", "item": "_684ccb7988365b4f__item", "is-size-compact": "f181b98b0d33282a__is-size-compact", "is-size-small": "_38f7faff93c61958__is-size-small", "item-indicator-icon": "_92fbe4765dfad5ee__item-indicator-icon", "item-icon": "a3adcfd0b73ffd40__item-icon", "empty": "_06c7ff39d2f685b9__empty" }; |
| 17382 |
var List = (0, import_element37.forwardRef)( |
| 17383 |
function List2({ className, ...restProps }, ref) { |
| 17384 |
return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)( |
| 17385 |
index_parts_exports.List, |
| 17386 |
{ |
| 17387 |
className: clsx_default(item_popup_default5.list, className), |
| 17388 |
ref, |
| 17389 |
...restProps |
| 17390 |
} |
| 17391 |
); |
| 17392 |
} |
| 17393 |
); |
| 17394 |
|
| 17395 |
// packages/ui/build-module/form/primitives/autocomplete/list-body.mjs |
| 17396 |
var import_element38 = __toESM(require_element(), 1); |
| 17397 |
var STYLE_HASH_ATTRIBUTE17 = "data-wp-hash"; |
| 17398 |
function getRuntime17() { |
| 17399 |
const globalScope = globalThis; |
| 17400 |
if (globalScope.__wpStyleRuntime) { |
| 17401 |
return globalScope.__wpStyleRuntime; |
| 17402 |
} |
| 17403 |
globalScope.__wpStyleRuntime = { |
| 17404 |
documents: /* @__PURE__ */ new Map(), |
| 17405 |
styles: /* @__PURE__ */ new Map(), |
| 17406 |
injectedStyles: /* @__PURE__ */ new WeakMap() |
| 17407 |
}; |
| 17408 |
if (typeof document !== "undefined") { |
| 17409 |
registerDocument17(document); |
| 17410 |
} |
| 17411 |
return globalScope.__wpStyleRuntime; |
| 17412 |
} |
| 17413 |
function documentContainsStyleHash17(targetDocument, hash) { |
| 17414 |
if (!targetDocument.head) { |
| 17415 |
return false; |
| 17416 |
} |
| 17417 |
for (const style of targetDocument.head.querySelectorAll( |
| 17418 |
`style[${STYLE_HASH_ATTRIBUTE17}]` |
| 17419 |
)) { |
| 17420 |
if (style.getAttribute(STYLE_HASH_ATTRIBUTE17) === hash) { |
| 17421 |
return true; |
| 17422 |
} |
| 17423 |
} |
| 17424 |
return false; |
| 17425 |
} |
| 17426 |
function injectStyle17(targetDocument, hash, css) { |
| 17427 |
if (!targetDocument.head) { |
| 17428 |
return; |
| 17429 |
} |
| 17430 |
const runtime = getRuntime17(); |
| 17431 |
let injectedStyles = runtime.injectedStyles.get(targetDocument); |
| 17432 |
if (!injectedStyles) { |
| 17433 |
injectedStyles = /* @__PURE__ */ new Set(); |
| 17434 |
runtime.injectedStyles.set(targetDocument, injectedStyles); |
| 17435 |
} |
| 17436 |
if (injectedStyles.has(hash)) { |
| 17437 |
return; |
| 17438 |
} |
| 17439 |
if (documentContainsStyleHash17(targetDocument, hash)) { |
| 17440 |
injectedStyles.add(hash); |
| 17441 |
return; |
| 17442 |
} |
| 17443 |
const style = targetDocument.createElement("style"); |
| 17444 |
style.setAttribute(STYLE_HASH_ATTRIBUTE17, hash); |
| 17445 |
style.appendChild(targetDocument.createTextNode(css)); |
| 17446 |
targetDocument.head.appendChild(style); |
| 17447 |
injectedStyles.add(hash); |
| 17448 |
} |
| 17449 |
function registerDocument17(targetDocument) { |
| 17450 |
const runtime = getRuntime17(); |
| 17451 |
runtime.documents.set( |
| 17452 |
targetDocument, |
| 17453 |
(runtime.documents.get(targetDocument) ?? 0) + 1 |
| 17454 |
); |
| 17455 |
for (const [hash, css] of runtime.styles) { |
| 17456 |
injectStyle17(targetDocument, hash, css); |
| 17457 |
} |
| 17458 |
return () => { |
| 17459 |
const count = runtime.documents.get(targetDocument); |
| 17460 |
if (count === void 0) { |
| 17461 |
return; |
| 17462 |
} |
| 17463 |
if (count <= 1) { |
| 17464 |
runtime.documents.delete(targetDocument); |
| 17465 |
return; |
| 17466 |
} |
| 17467 |
runtime.documents.set(targetDocument, count - 1); |
| 17468 |
}; |
| 17469 |
} |
| 17470 |
function registerStyle17(hash, css) { |
| 17471 |
const runtime = getRuntime17(); |
| 17472 |
runtime.styles.set(hash, css); |
| 17473 |
for (const targetDocument of runtime.documents.keys()) { |
| 17474 |
injectStyle17(targetDocument, hash, css); |
| 17475 |
} |
| 17476 |
} |
| 17477 |
if (typeof process === "undefined" || true) { |
| 17478 |
registerStyle17("b5813d84e6", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._380b81b8f79fb10f__dropdown-motion{--wp-ui-dropdown-slide-distance:4px;--wp-ui-dropdown-slide-duration:var(--wpds-motion-duration-md,200ms);--wp-ui-dropdown-slide-easing:var(--wpds-motion-easing-expressive,cubic-bezier(0.25,0,0,1));--wp-ui-dropdown-fade-duration:var(--wpds-motion-duration-sm,100ms);--wp-ui-dropdown-fade-easing:linear;@media not (prefers-reduced-motion){transition-duration:var(--wp-ui-dropdown-slide-duration),var(--wp-ui-dropdown-fade-duration);transition-property:transform,opacity;transition-timing-function:var(--wp-ui-dropdown-slide-easing),var(--wp-ui-dropdown-fade-easing);will-change:transform,opacity}opacity:1;transform:translate(0);&[data-instant]{transition:none}&[data-ending-style],&[data-starting-style]{opacity:0}&[data-side=bottom][data-ending-style],&[data-side=bottom][data-starting-style]{transform:translateY(calc(var(--wp-ui-dropdown-slide-distance)*-1))}&[data-side=top][data-ending-style],&[data-side=top][data-starting-style]{transform:translateY(var(--wp-ui-dropdown-slide-distance))}&[data-side=left][data-ending-style],&[data-side=left][data-starting-style]{transform:translateX(var(--wp-ui-dropdown-slide-distance))}&[data-side=right][data-ending-style],&[data-side=right][data-starting-style]{transform:translateX(calc(var(--wp-ui-dropdown-slide-distance)*-1))}}}}@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._234b520016b4e56f__popup{--wp-ui-popup-padding:var(--wpds-dimension-padding-xs,4px);background-color:var(--wpds-color-background-surface-neutral-strong,#fff);border:var(--wpds-border-width-xs,1px) solid var(--wpds-color-stroke-surface-neutral,#dbdbdb);border-radius:var(--wpds-border-radius-md,4px);box-shadow:var(--wpds-elevation-md,0 2px 3px 0 #0000000d,0 4px 5px 0 #0000000a,0 12px 12px 0 #00000008,0 16px 16px 0 #00000005);display:grid;grid-template-areas:"header" "main";grid-template-rows:auto minmax(0,1fr);max-height:min(var(--available-height),480px,60dvh);max-width:var(--available-width);min-width:var(--anchor-width)}.f43dc7c768d7b622__list{color:var(--wpds-color-foreground-interactive-neutral,#1e1e1e);display:grid;font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wpds-typography-font-size-md,13px);grid-area:main;grid-template-areas:"scrollable" "footer";grid-template-rows:minmax(0,1fr) auto;line-height:var(--wpds-typography-line-height-sm,20px)}._233cd60cdb84a2ef__list-scrollable-container{grid-area:scrollable;overflow-block:auto;overscroll-behavior:contain;scroll-padding-block:var(--wp-ui-popup-padding);&:not(:empty){padding-block:var(--wp-ui-popup-padding)}}.ec4db6f0122263e7__list-footer{grid-area:footer;padding-block:var(--wp-ui-popup-padding);._233cd60cdb84a2ef__list-scrollable-container:not(:empty)+&{border-block-start:var(--wpds-border-width-xs,1px) solid var(--wpds-color-stroke-surface-neutral,#dbdbdb)}}.b3c0d7f103fb10a2__group:not(:first-child){margin-block-start:var(--wpds-dimension-gap-sm,8px)}._21b59380477c306c__group-label{align-items:center;color:var(--wpds-color-foreground-content-neutral-weak,#707070);display:flex;min-height:var(--wpds-dimension-size-md,32px);padding-inline:var(--wpds-dimension-padding-md,12px)}._684ccb7988365b4f__item{--wp-ui-popup-item-height:var(--wpds-dimension-size-lg,40px);--wp-ui-popup-item-padding-inline:var(--wpds-dimension-padding-md,12px);--wp-ui-popup-item-padding-block:var(--wpds-dimension-padding-xs,4px);align-items:center;border-radius:var(--wpds-border-radius-sm,2px);display:flex;gap:var(--wpds-dimension-gap-xs,4px);justify-content:flex-start;margin-inline:var(--wp-ui-popup-padding);min-height:var(--wp-ui-popup-item-height);padding-block:var(--wp-ui-popup-item-padding-block);padding-inline-end:var(--wp-ui-popup-item-padding-inline);padding-inline-start:calc(var(--wp-ui-popup-item-padding-inline) - var(--wpds-dimension-padding-xs, 4px));user-select:none;&:not([data-disabled]){cursor:var(--wpds-cursor-control,pointer)}&.f181b98b0d33282a__is-size-compact{--wp-ui-popup-item-height:var(--wpds-dimension-size-md,32px);--wp-ui-popup-item-padding-inline:var(--wpds-dimension-padding-sm,8px)}&._38f7faff93c61958__is-size-small{--wp-ui-popup-item-height:var(--wpds-dimension-size-sm,24px);--wp-ui-popup-item-padding-inline:var(--wpds-dimension-padding-sm,8px);--wp-ui-popup-item-padding-block:2px}&:not([data-selected]){._92fbe4765dfad5ee__item-indicator-icon{opacity:0}}&[data-highlighted]:not([aria-disabled=true]){background-color:var(--wpds-color-background-interactive-brand-weak-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 12%,#fff));color:var(--wpds-color-foreground-interactive-neutral,#1e1e1e);outline:none;@media (forced-colors:active){outline:1px solid Highlight}}&[aria-disabled=true]{background-color:var(--wpds-color-background-interactive-brand-weak-disabled,#0000);color:var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d);@media (forced-colors:active){color:GrayText}}}.a3adcfd0b73ffd40__item-icon{flex-shrink:0}._06c7ff39d2f685b9__empty:not(:empty){--wp-ui-popup-empty-min-height:var(--wpds-dimension-size-lg,40px);--wp-ui-popup-empty-padding-inline:var(--wpds-dimension-padding-md,12px);align-items:center;color:var(--wpds-color-foreground-content-neutral-weak,#707070);display:flex;font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wpds-typography-font-size-md,13px);grid-area:main;line-height:var(--wpds-typography-line-height-sm,20px);min-height:var(--wp-ui-popup-empty-min-height);padding-inline:var(--wp-ui-popup-empty-padding-inline)}}}'); |
| 17479 |
} |
| 17480 |
var item_popup_default6 = { "popup": "_234b520016b4e56f__popup _380b81b8f79fb10f__dropdown-motion", "list": "f43dc7c768d7b622__list", "list-scrollable-container": "_233cd60cdb84a2ef__list-scrollable-container", "list-footer": "ec4db6f0122263e7__list-footer", "group": "b3c0d7f103fb10a2__group", "group-label": "_21b59380477c306c__group-label", "item": "_684ccb7988365b4f__item", "is-size-compact": "f181b98b0d33282a__is-size-compact", "is-size-small": "_38f7faff93c61958__is-size-small", "item-indicator-icon": "_92fbe4765dfad5ee__item-indicator-icon", "item-icon": "a3adcfd0b73ffd40__item-icon", "empty": "_06c7ff39d2f685b9__empty" }; |
| 17481 |
var ListBody = (0, import_element38.forwardRef)( |
| 17482 |
function ListBody2({ render, ...props }, ref) { |
| 17483 |
const element = useRender({ |
| 17484 |
defaultTagName: "div", |
| 17485 |
render, |
| 17486 |
ref, |
| 17487 |
props: mergeProps( |
| 17488 |
{ className: item_popup_default6["list-scrollable-container"] }, |
| 17489 |
props |
| 17490 |
) |
| 17491 |
}); |
| 17492 |
return element; |
| 17493 |
} |
| 17494 |
); |
| 17495 |
|
| 17496 |
// packages/ui/build-module/form/primitives/autocomplete/popup.mjs |
| 17497 |
var import_element41 = __toESM(require_element(), 1); |
| 17498 |
|
| 17499 |
// packages/ui/build-module/form/primitives/autocomplete/portal.mjs |
| 17500 |
var import_element39 = __toESM(require_element(), 1); |
| 17501 |
var import_jsx_runtime60 = __toESM(require_jsx_runtime(), 1); |
| 17502 |
var Portal2 = (0, import_element39.forwardRef)( |
| 17503 |
function AutocompletePortal({ container, ...restProps }, ref) { |
| 17504 |
return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)( |
| 17505 |
index_parts_exports.Portal, |
| 17506 |
{ |
| 17507 |
container: container ?? getWpCompatOverlaySlot(), |
| 17508 |
...restProps, |
| 17509 |
ref |
| 17510 |
} |
| 17511 |
); |
| 17512 |
} |
| 17513 |
); |
| 17514 |
|
| 17515 |
// packages/ui/build-module/form/primitives/autocomplete/positioner.mjs |
| 17516 |
var import_element40 = __toESM(require_element(), 1); |
| 17517 |
|
| 17518 |
// packages/ui/build-module/form/primitives/constants.mjs |
| 17519 |
var ITEM_POPUP_POSITIONER_PROPS = { |
| 17520 |
align: "start", |
| 17521 |
sideOffset: 8, |
| 17522 |
collisionPadding: 12 |
| 17523 |
}; |
| 17524 |
|
| 17525 |
// packages/ui/build-module/form/primitives/autocomplete/positioner.mjs |
| 17526 |
var import_jsx_runtime61 = __toESM(require_jsx_runtime(), 1); |
| 17527 |
var STYLE_HASH_ATTRIBUTE18 = "data-wp-hash"; |
| 17528 |
function getRuntime18() { |
| 17529 |
const globalScope = globalThis; |
| 17530 |
if (globalScope.__wpStyleRuntime) { |
| 17531 |
return globalScope.__wpStyleRuntime; |
| 17532 |
} |
| 17533 |
globalScope.__wpStyleRuntime = { |
| 17534 |
documents: /* @__PURE__ */ new Map(), |
| 17535 |
styles: /* @__PURE__ */ new Map(), |
| 17536 |
injectedStyles: /* @__PURE__ */ new WeakMap() |
| 17537 |
}; |
| 17538 |
if (typeof document !== "undefined") { |
| 17539 |
registerDocument18(document); |
| 17540 |
} |
| 17541 |
return globalScope.__wpStyleRuntime; |
| 17542 |
} |
| 17543 |
function documentContainsStyleHash18(targetDocument, hash) { |
| 17544 |
if (!targetDocument.head) { |
| 17545 |
return false; |
| 17546 |
} |
| 17547 |
for (const style of targetDocument.head.querySelectorAll( |
| 17548 |
`style[${STYLE_HASH_ATTRIBUTE18}]` |
| 17549 |
)) { |
| 17550 |
if (style.getAttribute(STYLE_HASH_ATTRIBUTE18) === hash) { |
| 17551 |
return true; |
| 17552 |
} |
| 17553 |
} |
| 17554 |
return false; |
| 17555 |
} |
| 17556 |
function injectStyle18(targetDocument, hash, css) { |
| 17557 |
if (!targetDocument.head) { |
| 17558 |
return; |
| 17559 |
} |
| 17560 |
const runtime = getRuntime18(); |
| 17561 |
let injectedStyles = runtime.injectedStyles.get(targetDocument); |
| 17562 |
if (!injectedStyles) { |
| 17563 |
injectedStyles = /* @__PURE__ */ new Set(); |
| 17564 |
runtime.injectedStyles.set(targetDocument, injectedStyles); |
| 17565 |
} |
| 17566 |
if (injectedStyles.has(hash)) { |
| 17567 |
return; |
| 17568 |
} |
| 17569 |
if (documentContainsStyleHash18(targetDocument, hash)) { |
| 17570 |
injectedStyles.add(hash); |
| 17571 |
return; |
| 17572 |
} |
| 17573 |
const style = targetDocument.createElement("style"); |
| 17574 |
style.setAttribute(STYLE_HASH_ATTRIBUTE18, hash); |
| 17575 |
style.appendChild(targetDocument.createTextNode(css)); |
| 17576 |
targetDocument.head.appendChild(style); |
| 17577 |
injectedStyles.add(hash); |
| 17578 |
} |
| 17579 |
function registerDocument18(targetDocument) { |
| 17580 |
const runtime = getRuntime18(); |
| 17581 |
runtime.documents.set( |
| 17582 |
targetDocument, |
| 17583 |
(runtime.documents.get(targetDocument) ?? 0) + 1 |
| 17584 |
); |
| 17585 |
for (const [hash, css] of runtime.styles) { |
| 17586 |
injectStyle18(targetDocument, hash, css); |
| 17587 |
} |
| 17588 |
return () => { |
| 17589 |
const count = runtime.documents.get(targetDocument); |
| 17590 |
if (count === void 0) { |
| 17591 |
return; |
| 17592 |
} |
| 17593 |
if (count <= 1) { |
| 17594 |
runtime.documents.delete(targetDocument); |
| 17595 |
return; |
| 17596 |
} |
| 17597 |
runtime.documents.set(targetDocument, count - 1); |
| 17598 |
}; |
| 17599 |
} |
| 17600 |
function registerStyle18(hash, css) { |
| 17601 |
const runtime = getRuntime18(); |
| 17602 |
runtime.styles.set(hash, css); |
| 17603 |
for (const targetDocument of runtime.documents.keys()) { |
| 17604 |
injectStyle18(targetDocument, hash, css); |
| 17605 |
} |
| 17606 |
} |
| 17607 |
if (typeof process === "undefined" || true) { |
| 17608 |
registerStyle18("10f3806643", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._336cd3e4e743482f__box-sizing{box-sizing:border-box;*,:after,:before{box-sizing:inherit}}}}"); |
| 17609 |
} |
| 17610 |
var resets_default5 = { "box-sizing": "_336cd3e4e743482f__box-sizing" }; |
| 17611 |
if (typeof process === "undefined" || true) { |
| 17612 |
registerStyle18("e61eb95308", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{._8eb0a29484225eea__positioner{z-index:var(--wp-ui-autocomplete-z-index,initial)}}}"); |
| 17613 |
} |
| 17614 |
var style_default11 = { "positioner": "_8eb0a29484225eea__positioner" }; |
| 17615 |
var Positioner2 = (0, import_element40.forwardRef)( |
| 17616 |
function AutocompletePositioner({ className, ...props }, ref) { |
| 17617 |
return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)( |
| 17618 |
index_parts_exports.Positioner, |
| 17619 |
{ |
| 17620 |
...ITEM_POPUP_POSITIONER_PROPS, |
| 17621 |
...props, |
| 17622 |
ref, |
| 17623 |
className: clsx_default( |
| 17624 |
resets_default5["box-sizing"], |
| 17625 |
style_default11.positioner, |
| 17626 |
className |
| 17627 |
) |
| 17628 |
} |
| 17629 |
); |
| 17630 |
} |
| 17631 |
); |
| 17632 |
|
| 17633 |
// packages/ui/build-module/form/primitives/autocomplete/popup.mjs |
| 17634 |
var import_jsx_runtime62 = __toESM(require_jsx_runtime(), 1); |
| 17635 |
var STYLE_HASH_ATTRIBUTE19 = "data-wp-hash"; |
| 17636 |
function getRuntime19() { |
| 17637 |
const globalScope = globalThis; |
| 17638 |
if (globalScope.__wpStyleRuntime) { |
| 17639 |
return globalScope.__wpStyleRuntime; |
| 17640 |
} |
| 17641 |
globalScope.__wpStyleRuntime = { |
| 17642 |
documents: /* @__PURE__ */ new Map(), |
| 17643 |
styles: /* @__PURE__ */ new Map(), |
| 17644 |
injectedStyles: /* @__PURE__ */ new WeakMap() |
| 17645 |
}; |
| 17646 |
if (typeof document !== "undefined") { |
| 17647 |
registerDocument19(document); |
| 17648 |
} |
| 17649 |
return globalScope.__wpStyleRuntime; |
| 17650 |
} |
| 17651 |
function documentContainsStyleHash19(targetDocument, hash) { |
| 17652 |
if (!targetDocument.head) { |
| 17653 |
return false; |
| 17654 |
} |
| 17655 |
for (const style of targetDocument.head.querySelectorAll( |
| 17656 |
`style[${STYLE_HASH_ATTRIBUTE19}]` |
| 17657 |
)) { |
| 17658 |
if (style.getAttribute(STYLE_HASH_ATTRIBUTE19) === hash) { |
| 17659 |
return true; |
| 17660 |
} |
| 17661 |
} |
| 17662 |
return false; |
| 17663 |
} |
| 17664 |
function injectStyle19(targetDocument, hash, css) { |
| 17665 |
if (!targetDocument.head) { |
| 17666 |
return; |
| 17667 |
} |
| 17668 |
const runtime = getRuntime19(); |
| 17669 |
let injectedStyles = runtime.injectedStyles.get(targetDocument); |
| 17670 |
if (!injectedStyles) { |
| 17671 |
injectedStyles = /* @__PURE__ */ new Set(); |
| 17672 |
runtime.injectedStyles.set(targetDocument, injectedStyles); |
| 17673 |
} |
| 17674 |
if (injectedStyles.has(hash)) { |
| 17675 |
return; |
| 17676 |
} |
| 17677 |
if (documentContainsStyleHash19(targetDocument, hash)) { |
| 17678 |
injectedStyles.add(hash); |
| 17679 |
return; |
| 17680 |
} |
| 17681 |
const style = targetDocument.createElement("style"); |
| 17682 |
style.setAttribute(STYLE_HASH_ATTRIBUTE19, hash); |
| 17683 |
style.appendChild(targetDocument.createTextNode(css)); |
| 17684 |
targetDocument.head.appendChild(style); |
| 17685 |
injectedStyles.add(hash); |
| 17686 |
} |
| 17687 |
function registerDocument19(targetDocument) { |
| 17688 |
const runtime = getRuntime19(); |
| 17689 |
runtime.documents.set( |
| 17690 |
targetDocument, |
| 17691 |
(runtime.documents.get(targetDocument) ?? 0) + 1 |
| 17692 |
); |
| 17693 |
for (const [hash, css] of runtime.styles) { |
| 17694 |
injectStyle19(targetDocument, hash, css); |
| 17695 |
} |
| 17696 |
return () => { |
| 17697 |
const count = runtime.documents.get(targetDocument); |
| 17698 |
if (count === void 0) { |
| 17699 |
return; |
| 17700 |
} |
| 17701 |
if (count <= 1) { |
| 17702 |
runtime.documents.delete(targetDocument); |
| 17703 |
return; |
| 17704 |
} |
| 17705 |
runtime.documents.set(targetDocument, count - 1); |
| 17706 |
}; |
| 17707 |
} |
| 17708 |
function registerStyle19(hash, css) { |
| 17709 |
const runtime = getRuntime19(); |
| 17710 |
runtime.styles.set(hash, css); |
| 17711 |
for (const targetDocument of runtime.documents.keys()) { |
| 17712 |
injectStyle19(targetDocument, hash, css); |
| 17713 |
} |
| 17714 |
} |
| 17715 |
if (typeof process === "undefined" || true) { |
| 17716 |
registerStyle19("b5813d84e6", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._380b81b8f79fb10f__dropdown-motion{--wp-ui-dropdown-slide-distance:4px;--wp-ui-dropdown-slide-duration:var(--wpds-motion-duration-md,200ms);--wp-ui-dropdown-slide-easing:var(--wpds-motion-easing-expressive,cubic-bezier(0.25,0,0,1));--wp-ui-dropdown-fade-duration:var(--wpds-motion-duration-sm,100ms);--wp-ui-dropdown-fade-easing:linear;@media not (prefers-reduced-motion){transition-duration:var(--wp-ui-dropdown-slide-duration),var(--wp-ui-dropdown-fade-duration);transition-property:transform,opacity;transition-timing-function:var(--wp-ui-dropdown-slide-easing),var(--wp-ui-dropdown-fade-easing);will-change:transform,opacity}opacity:1;transform:translate(0);&[data-instant]{transition:none}&[data-ending-style],&[data-starting-style]{opacity:0}&[data-side=bottom][data-ending-style],&[data-side=bottom][data-starting-style]{transform:translateY(calc(var(--wp-ui-dropdown-slide-distance)*-1))}&[data-side=top][data-ending-style],&[data-side=top][data-starting-style]{transform:translateY(var(--wp-ui-dropdown-slide-distance))}&[data-side=left][data-ending-style],&[data-side=left][data-starting-style]{transform:translateX(var(--wp-ui-dropdown-slide-distance))}&[data-side=right][data-ending-style],&[data-side=right][data-starting-style]{transform:translateX(calc(var(--wp-ui-dropdown-slide-distance)*-1))}}}}@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._234b520016b4e56f__popup{--wp-ui-popup-padding:var(--wpds-dimension-padding-xs,4px);background-color:var(--wpds-color-background-surface-neutral-strong,#fff);border:var(--wpds-border-width-xs,1px) solid var(--wpds-color-stroke-surface-neutral,#dbdbdb);border-radius:var(--wpds-border-radius-md,4px);box-shadow:var(--wpds-elevation-md,0 2px 3px 0 #0000000d,0 4px 5px 0 #0000000a,0 12px 12px 0 #00000008,0 16px 16px 0 #00000005);display:grid;grid-template-areas:"header" "main";grid-template-rows:auto minmax(0,1fr);max-height:min(var(--available-height),480px,60dvh);max-width:var(--available-width);min-width:var(--anchor-width)}.f43dc7c768d7b622__list{color:var(--wpds-color-foreground-interactive-neutral,#1e1e1e);display:grid;font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wpds-typography-font-size-md,13px);grid-area:main;grid-template-areas:"scrollable" "footer";grid-template-rows:minmax(0,1fr) auto;line-height:var(--wpds-typography-line-height-sm,20px)}._233cd60cdb84a2ef__list-scrollable-container{grid-area:scrollable;overflow-block:auto;overscroll-behavior:contain;scroll-padding-block:var(--wp-ui-popup-padding);&:not(:empty){padding-block:var(--wp-ui-popup-padding)}}.ec4db6f0122263e7__list-footer{grid-area:footer;padding-block:var(--wp-ui-popup-padding);._233cd60cdb84a2ef__list-scrollable-container:not(:empty)+&{border-block-start:var(--wpds-border-width-xs,1px) solid var(--wpds-color-stroke-surface-neutral,#dbdbdb)}}.b3c0d7f103fb10a2__group:not(:first-child){margin-block-start:var(--wpds-dimension-gap-sm,8px)}._21b59380477c306c__group-label{align-items:center;color:var(--wpds-color-foreground-content-neutral-weak,#707070);display:flex;min-height:var(--wpds-dimension-size-md,32px);padding-inline:var(--wpds-dimension-padding-md,12px)}._684ccb7988365b4f__item{--wp-ui-popup-item-height:var(--wpds-dimension-size-lg,40px);--wp-ui-popup-item-padding-inline:var(--wpds-dimension-padding-md,12px);--wp-ui-popup-item-padding-block:var(--wpds-dimension-padding-xs,4px);align-items:center;border-radius:var(--wpds-border-radius-sm,2px);display:flex;gap:var(--wpds-dimension-gap-xs,4px);justify-content:flex-start;margin-inline:var(--wp-ui-popup-padding);min-height:var(--wp-ui-popup-item-height);padding-block:var(--wp-ui-popup-item-padding-block);padding-inline-end:var(--wp-ui-popup-item-padding-inline);padding-inline-start:calc(var(--wp-ui-popup-item-padding-inline) - var(--wpds-dimension-padding-xs, 4px));user-select:none;&:not([data-disabled]){cursor:var(--wpds-cursor-control,pointer)}&.f181b98b0d33282a__is-size-compact{--wp-ui-popup-item-height:var(--wpds-dimension-size-md,32px);--wp-ui-popup-item-padding-inline:var(--wpds-dimension-padding-sm,8px)}&._38f7faff93c61958__is-size-small{--wp-ui-popup-item-height:var(--wpds-dimension-size-sm,24px);--wp-ui-popup-item-padding-inline:var(--wpds-dimension-padding-sm,8px);--wp-ui-popup-item-padding-block:2px}&:not([data-selected]){._92fbe4765dfad5ee__item-indicator-icon{opacity:0}}&[data-highlighted]:not([aria-disabled=true]){background-color:var(--wpds-color-background-interactive-brand-weak-active,color-mix(in oklch,var(--wp-admin-theme-color,#3858e9) 12%,#fff));color:var(--wpds-color-foreground-interactive-neutral,#1e1e1e);outline:none;@media (forced-colors:active){outline:1px solid Highlight}}&[aria-disabled=true]{background-color:var(--wpds-color-background-interactive-brand-weak-disabled,#0000);color:var(--wpds-color-foreground-interactive-neutral-disabled,#8d8d8d);@media (forced-colors:active){color:GrayText}}}.a3adcfd0b73ffd40__item-icon{flex-shrink:0}._06c7ff39d2f685b9__empty:not(:empty){--wp-ui-popup-empty-min-height:var(--wpds-dimension-size-lg,40px);--wp-ui-popup-empty-padding-inline:var(--wpds-dimension-padding-md,12px);align-items:center;color:var(--wpds-color-foreground-content-neutral-weak,#707070);display:flex;font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wpds-typography-font-size-md,13px);grid-area:main;line-height:var(--wpds-typography-line-height-sm,20px);min-height:var(--wp-ui-popup-empty-min-height);padding-inline:var(--wp-ui-popup-empty-padding-inline)}}}'); |
| 17717 |
} |
| 17718 |
var item_popup_default7 = { "popup": "_234b520016b4e56f__popup _380b81b8f79fb10f__dropdown-motion", "list": "f43dc7c768d7b622__list", "list-scrollable-container": "_233cd60cdb84a2ef__list-scrollable-container", "list-footer": "ec4db6f0122263e7__list-footer", "group": "b3c0d7f103fb10a2__group", "group-label": "_21b59380477c306c__group-label", "item": "_684ccb7988365b4f__item", "is-size-compact": "f181b98b0d33282a__is-size-compact", "is-size-small": "_38f7faff93c61958__is-size-small", "item-indicator-icon": "_92fbe4765dfad5ee__item-indicator-icon", "item-icon": "a3adcfd0b73ffd40__item-icon", "empty": "_06c7ff39d2f685b9__empty" }; |
| 17719 |
var Popup2 = (0, import_element41.forwardRef)( |
| 17720 |
function Popup22({ className, portal, positioner, ...restProps }, ref) { |
| 17721 |
const popupContent = /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(ThemeProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)( |
| 17722 |
index_parts_exports.Popup, |
| 17723 |
{ |
| 17724 |
ref, |
| 17725 |
className: clsx_default(item_popup_default7.popup, className), |
| 17726 |
...restProps |
| 17727 |
} |
| 17728 |
) }); |
| 17729 |
const positionedPopup = renderSlotWithChildren( |
| 17730 |
positioner, |
| 17731 |
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)(Positioner2, {}), |
| 17732 |
popupContent |
| 17733 |
); |
| 17734 |
return renderSlotWithChildren(portal, /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(Portal2, {}), positionedPopup); |
| 17735 |
} |
| 17736 |
); |
| 17737 |
|
| 17738 |
// packages/ui/build-module/form/primitives/autocomplete/root.mjs |
| 17739 |
var import_jsx_runtime63 = __toESM(require_jsx_runtime(), 1); |
| 17740 |
function Root2(props) { |
| 17741 |
return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(index_parts_exports.Root, { ...props }); |
| 17742 |
} |
| 17743 |
|
| 17744 |
// packages/ui/build-module/form/primitives/autocomplete/value.mjs |
| 17745 |
var import_jsx_runtime64 = __toESM(require_jsx_runtime(), 1); |
| 17746 |
function Value(props) { |
| 17747 |
return /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(index_parts_exports.Value, { ...props }); |
| 17748 |
} |
| 17749 |
|
| 17750 |
// packages/ui/build-module/form/primitives/field/index.mjs |
| 17751 |
var field_exports = {}; |
| 17752 |
__export(field_exports, { |
| 17753 |
Control: () => Control, |
| 17754 |
Description: () => Description, |
| 17755 |
Details: () => Details, |
| 17756 |
Item: () => Item3, |
| 17757 |
Label: () => Label, |
| 17758 |
Root: () => Root3 |
| 17759 |
}); |
| 17760 |
|
| 17761 |
// packages/ui/build-module/form/primitives/field/root.mjs |
| 17762 |
var import_element42 = __toESM(require_element(), 1); |
| 17763 |
var import_jsx_runtime65 = __toESM(require_jsx_runtime(), 1); |
| 17764 |
var STYLE_HASH_ATTRIBUTE20 = "data-wp-hash"; |
| 17765 |
function getRuntime20() { |
| 17766 |
const globalScope = globalThis; |
| 17767 |
if (globalScope.__wpStyleRuntime) { |
| 17768 |
return globalScope.__wpStyleRuntime; |
| 17769 |
} |
| 17770 |
globalScope.__wpStyleRuntime = { |
| 17771 |
documents: /* @__PURE__ */ new Map(), |
| 17772 |
styles: /* @__PURE__ */ new Map(), |
| 17773 |
injectedStyles: /* @__PURE__ */ new WeakMap() |
| 17774 |
}; |
| 17775 |
if (typeof document !== "undefined") { |
| 17776 |
registerDocument20(document); |
| 17777 |
} |
| 17778 |
return globalScope.__wpStyleRuntime; |
| 17779 |
} |
| 17780 |
function documentContainsStyleHash20(targetDocument, hash) { |
| 17781 |
if (!targetDocument.head) { |
| 17782 |
return false; |
| 17783 |
} |
| 17784 |
for (const style of targetDocument.head.querySelectorAll( |
| 17785 |
`style[${STYLE_HASH_ATTRIBUTE20}]` |
| 17786 |
)) { |
| 17787 |
if (style.getAttribute(STYLE_HASH_ATTRIBUTE20) === hash) { |
| 17788 |
return true; |
| 17789 |
} |
| 17790 |
} |
| 17791 |
return false; |
| 17792 |
} |
| 17793 |
function injectStyle20(targetDocument, hash, css) { |
| 17794 |
if (!targetDocument.head) { |
| 17795 |
return; |
| 17796 |
} |
| 17797 |
const runtime = getRuntime20(); |
| 17798 |
let injectedStyles = runtime.injectedStyles.get(targetDocument); |
| 17799 |
if (!injectedStyles) { |
| 17800 |
injectedStyles = /* @__PURE__ */ new Set(); |
| 17801 |
runtime.injectedStyles.set(targetDocument, injectedStyles); |
| 17802 |
} |
| 17803 |
if (injectedStyles.has(hash)) { |
| 17804 |
return; |
| 17805 |
} |
| 17806 |
if (documentContainsStyleHash20(targetDocument, hash)) { |
| 17807 |
injectedStyles.add(hash); |
| 17808 |
return; |
| 17809 |
} |
| 17810 |
const style = targetDocument.createElement("style"); |
| 17811 |
style.setAttribute(STYLE_HASH_ATTRIBUTE20, hash); |
| 17812 |
style.appendChild(targetDocument.createTextNode(css)); |
| 17813 |
targetDocument.head.appendChild(style); |
| 17814 |
injectedStyles.add(hash); |
| 17815 |
} |
| 17816 |
function registerDocument20(targetDocument) { |
| 17817 |
const runtime = getRuntime20(); |
| 17818 |
runtime.documents.set( |
| 17819 |
targetDocument, |
| 17820 |
(runtime.documents.get(targetDocument) ?? 0) + 1 |
| 17821 |
); |
| 17822 |
for (const [hash, css] of runtime.styles) { |
| 17823 |
injectStyle20(targetDocument, hash, css); |
| 17824 |
} |
| 17825 |
return () => { |
| 17826 |
const count = runtime.documents.get(targetDocument); |
| 17827 |
if (count === void 0) { |
| 17828 |
return; |
| 17829 |
} |
| 17830 |
if (count <= 1) { |
| 17831 |
runtime.documents.delete(targetDocument); |
| 17832 |
return; |
| 17833 |
} |
| 17834 |
runtime.documents.set(targetDocument, count - 1); |
| 17835 |
}; |
| 17836 |
} |
| 17837 |
function registerStyle20(hash, css) { |
| 17838 |
const runtime = getRuntime20(); |
| 17839 |
runtime.styles.set(hash, css); |
| 17840 |
for (const targetDocument of runtime.documents.keys()) { |
| 17841 |
injectStyle20(targetDocument, hash, css); |
| 17842 |
} |
| 17843 |
} |
| 17844 |
if (typeof process === "undefined" || true) { |
| 17845 |
registerStyle20("10f3806643", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._336cd3e4e743482f__box-sizing{box-sizing:border-box;*,:after,:before{box-sizing:inherit}}}}"); |
| 17846 |
} |
| 17847 |
var resets_default6 = { "box-sizing": "_336cd3e4e743482f__box-sizing" }; |
| 17848 |
var DEFAULT_RENDER3 = (props) => /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(Stack, { ...props, direction: "column", gap: "sm" }); |
| 17849 |
var Root3 = (0, import_element42.forwardRef)(function Root22({ className, render = DEFAULT_RENDER3, ...restProps }, ref) { |
| 17850 |
return /* @__PURE__ */ (0, import_jsx_runtime65.jsx)( |
| 17851 |
index_parts_exports2.Root, |
| 17852 |
{ |
| 17853 |
ref, |
| 17854 |
className: clsx_default(resets_default6["box-sizing"], className), |
| 17855 |
render, |
| 17856 |
...restProps |
| 17857 |
} |
| 17858 |
); |
| 17859 |
}); |
| 17860 |
|
| 17861 |
// packages/ui/build-module/form/primitives/field/item.mjs |
| 17862 |
var import_element43 = __toESM(require_element(), 1); |
| 17863 |
var import_jsx_runtime66 = __toESM(require_jsx_runtime(), 1); |
| 17864 |
var Item3 = (0, import_element43.forwardRef)(function Item22(props, ref) { |
| 17865 |
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(index_parts_exports2.Item, { ref, ...props }); |
| 17866 |
}); |
| 17867 |
|
| 17868 |
// packages/ui/build-module/form/primitives/field/label.mjs |
| 17869 |
var import_element45 = __toESM(require_element(), 1); |
| 17870 |
|
| 17871 |
// packages/ui/build-module/visually-hidden/visually-hidden.mjs |
| 17872 |
var import_element44 = __toESM(require_element(), 1); |
| 17873 |
var STYLE_HASH_ATTRIBUTE21 = "data-wp-hash"; |
| 17874 |
function getRuntime21() { |
| 17875 |
const globalScope = globalThis; |
| 17876 |
if (globalScope.__wpStyleRuntime) { |
| 17877 |
return globalScope.__wpStyleRuntime; |
| 17878 |
} |
| 17879 |
globalScope.__wpStyleRuntime = { |
| 17880 |
documents: /* @__PURE__ */ new Map(), |
| 17881 |
styles: /* @__PURE__ */ new Map(), |
| 17882 |
injectedStyles: /* @__PURE__ */ new WeakMap() |
| 17883 |
}; |
| 17884 |
if (typeof document !== "undefined") { |
| 17885 |
registerDocument21(document); |
| 17886 |
} |
| 17887 |
return globalScope.__wpStyleRuntime; |
| 17888 |
} |
| 17889 |
function documentContainsStyleHash21(targetDocument, hash) { |
| 17890 |
if (!targetDocument.head) { |
| 17891 |
return false; |
| 17892 |
} |
| 17893 |
for (const style of targetDocument.head.querySelectorAll( |
| 17894 |
`style[${STYLE_HASH_ATTRIBUTE21}]` |
| 17895 |
)) { |
| 17896 |
if (style.getAttribute(STYLE_HASH_ATTRIBUTE21) === hash) { |
| 17897 |
return true; |
| 17898 |
} |
| 17899 |
} |
| 17900 |
return false; |
| 17901 |
} |
| 17902 |
function injectStyle21(targetDocument, hash, css) { |
| 17903 |
if (!targetDocument.head) { |
| 17904 |
return; |
| 17905 |
} |
| 17906 |
const runtime = getRuntime21(); |
| 17907 |
let injectedStyles = runtime.injectedStyles.get(targetDocument); |
| 17908 |
if (!injectedStyles) { |
| 17909 |
injectedStyles = /* @__PURE__ */ new Set(); |
| 17910 |
runtime.injectedStyles.set(targetDocument, injectedStyles); |
| 17911 |
} |
| 17912 |
if (injectedStyles.has(hash)) { |
| 17913 |
return; |
| 17914 |
} |
| 17915 |
if (documentContainsStyleHash21(targetDocument, hash)) { |
| 17916 |
injectedStyles.add(hash); |
| 17917 |
return; |
| 17918 |
} |
| 17919 |
const style = targetDocument.createElement("style"); |
| 17920 |
style.setAttribute(STYLE_HASH_ATTRIBUTE21, hash); |
| 17921 |
style.appendChild(targetDocument.createTextNode(css)); |
| 17922 |
targetDocument.head.appendChild(style); |
| 17923 |
injectedStyles.add(hash); |
| 17924 |
} |
| 17925 |
function registerDocument21(targetDocument) { |
| 17926 |
const runtime = getRuntime21(); |
| 17927 |
runtime.documents.set( |
| 17928 |
targetDocument, |
| 17929 |
(runtime.documents.get(targetDocument) ?? 0) + 1 |
| 17930 |
); |
| 17931 |
for (const [hash, css] of runtime.styles) { |
| 17932 |
injectStyle21(targetDocument, hash, css); |
| 17933 |
} |
| 17934 |
return () => { |
| 17935 |
const count = runtime.documents.get(targetDocument); |
| 17936 |
if (count === void 0) { |
| 17937 |
return; |
| 17938 |
} |
| 17939 |
if (count <= 1) { |
| 17940 |
runtime.documents.delete(targetDocument); |
| 17941 |
return; |
| 17942 |
} |
| 17943 |
runtime.documents.set(targetDocument, count - 1); |
| 17944 |
}; |
| 17945 |
} |
| 17946 |
function registerStyle21(hash, css) { |
| 17947 |
const runtime = getRuntime21(); |
| 17948 |
runtime.styles.set(hash, css); |
| 17949 |
for (const targetDocument of runtime.documents.keys()) { |
| 17950 |
injectStyle21(targetDocument, hash, css); |
| 17951 |
} |
| 17952 |
} |
| 17953 |
if (typeof process === "undefined" || true) { |
| 17954 |
registerStyle21("fa606a57ae", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{.f37b9e2e191ebd66__visually-hidden{word-wrap:normal;border:0;clip-path:inset(50%);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;word-break:normal}}}"); |
| 17955 |
} |
| 17956 |
var style_default12 = { "visually-hidden": "f37b9e2e191ebd66__visually-hidden" }; |
| 17957 |
var VisuallyHidden = (0, import_element44.forwardRef)( |
| 17958 |
function VisuallyHidden2({ render, ...restProps }, ref) { |
| 17959 |
const element = useRender({ |
| 17960 |
render, |
| 17961 |
ref, |
| 17962 |
props: mergeProps( |
| 17963 |
{ className: style_default12["visually-hidden"] }, |
| 17964 |
restProps, |
| 17965 |
{ |
| 17966 |
// @ts-expect-error Arbitrary data-* attributes aren't indexable on the typed div props. Kept hardcoded so consumers can't change or remove it. |
| 17967 |
"data-visually-hidden": "" |
| 17968 |
} |
| 17969 |
) |
| 17970 |
}); |
| 17971 |
return element; |
| 17972 |
} |
| 17973 |
); |
| 17974 |
|
| 17975 |
// packages/ui/build-module/form/primitives/field/label.mjs |
| 17976 |
var import_jsx_runtime67 = __toESM(require_jsx_runtime(), 1); |
| 17977 |
var STYLE_HASH_ATTRIBUTE22 = "data-wp-hash"; |
| 17978 |
function getRuntime22() { |
| 17979 |
const globalScope = globalThis; |
| 17980 |
if (globalScope.__wpStyleRuntime) { |
| 17981 |
return globalScope.__wpStyleRuntime; |
| 17982 |
} |
| 17983 |
globalScope.__wpStyleRuntime = { |
| 17984 |
documents: /* @__PURE__ */ new Map(), |
| 17985 |
styles: /* @__PURE__ */ new Map(), |
| 17986 |
injectedStyles: /* @__PURE__ */ new WeakMap() |
| 17987 |
}; |
| 17988 |
if (typeof document !== "undefined") { |
| 17989 |
registerDocument22(document); |
| 17990 |
} |
| 17991 |
return globalScope.__wpStyleRuntime; |
| 17992 |
} |
| 17993 |
function documentContainsStyleHash22(targetDocument, hash) { |
| 17994 |
if (!targetDocument.head) { |
| 17995 |
return false; |
| 17996 |
} |
| 17997 |
for (const style of targetDocument.head.querySelectorAll( |
| 17998 |
`style[${STYLE_HASH_ATTRIBUTE22}]` |
| 17999 |
)) { |
| 18000 |
if (style.getAttribute(STYLE_HASH_ATTRIBUTE22) === hash) { |
| 18001 |
return true; |
| 18002 |
} |
| 18003 |
} |
| 18004 |
return false; |
| 18005 |
} |
| 18006 |
function injectStyle22(targetDocument, hash, css) { |
| 18007 |
if (!targetDocument.head) { |
| 18008 |
return; |
| 18009 |
} |
| 18010 |
const runtime = getRuntime22(); |
| 18011 |
let injectedStyles = runtime.injectedStyles.get(targetDocument); |
| 18012 |
if (!injectedStyles) { |
| 18013 |
injectedStyles = /* @__PURE__ */ new Set(); |
| 18014 |
runtime.injectedStyles.set(targetDocument, injectedStyles); |
| 18015 |
} |
| 18016 |
if (injectedStyles.has(hash)) { |
| 18017 |
return; |
| 18018 |
} |
| 18019 |
if (documentContainsStyleHash22(targetDocument, hash)) { |
| 18020 |
injectedStyles.add(hash); |
| 18021 |
return; |
| 18022 |
} |
| 18023 |
const style = targetDocument.createElement("style"); |
| 18024 |
style.setAttribute(STYLE_HASH_ATTRIBUTE22, hash); |
| 18025 |
style.appendChild(targetDocument.createTextNode(css)); |
| 18026 |
targetDocument.head.appendChild(style); |
| 18027 |
injectedStyles.add(hash); |
| 18028 |
} |
| 18029 |
function registerDocument22(targetDocument) { |
| 18030 |
const runtime = getRuntime22(); |
| 18031 |
runtime.documents.set( |
| 18032 |
targetDocument, |
| 18033 |
(runtime.documents.get(targetDocument) ?? 0) + 1 |
| 18034 |
); |
| 18035 |
for (const [hash, css] of runtime.styles) { |
| 18036 |
injectStyle22(targetDocument, hash, css); |
| 18037 |
} |
| 18038 |
return () => { |
| 18039 |
const count = runtime.documents.get(targetDocument); |
| 18040 |
if (count === void 0) { |
| 18041 |
return; |
| 18042 |
} |
| 18043 |
if (count <= 1) { |
| 18044 |
runtime.documents.delete(targetDocument); |
| 18045 |
return; |
| 18046 |
} |
| 18047 |
runtime.documents.set(targetDocument, count - 1); |
| 18048 |
}; |
| 18049 |
} |
| 18050 |
function registerStyle22(hash, css) { |
| 18051 |
const runtime = getRuntime22(); |
| 18052 |
runtime.styles.set(hash, css); |
| 18053 |
for (const targetDocument of runtime.documents.keys()) { |
| 18054 |
injectStyle22(targetDocument, hash, css); |
| 18055 |
} |
| 18056 |
} |
| 18057 |
if (typeof process === "undefined" || true) { |
| 18058 |
registerStyle22("4b9484aa9f", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._2d5ad850b2f90964__label{--wp-ui-field-label-line-height:var(--wpds-typography-line-height-xs,16px);color:var(--wpds-color-foreground-content-neutral,#1e1e1e);font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wpds-typography-font-size-xs,11px);font-weight:var(--wpds-typography-font-weight-medium,499);line-height:var(--wp-ui-field-label-line-height);text-transform:uppercase;&._17c4214649230bea__is-plain{font-size:var(--wpds-typography-font-size-md,13px);text-transform:none}}._08a3750500e0233f__description{--_gcd-p-font-size:var(--wpds-typography-font-size-sm,12px);--_gcd-p-line-height:var(--wpds-typography-line-height-xs,16px);--_gcd-p-margin:0;text-wrap:pretty;color:var(--wpds-color-foreground-content-neutral-weak,#707070);font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wpds-typography-font-size-sm,12px);line-height:var(--wpds-typography-line-height-xs,16px)}}}'); |
| 18059 |
} |
| 18060 |
var field_default = { "label": "_2d5ad850b2f90964__label", "is-plain": "_17c4214649230bea__is-plain", "description": "_08a3750500e0233f__description" }; |
| 18061 |
var Label = (0, import_element45.forwardRef)( |
| 18062 |
function Label2({ className, hideFromVision, variant, ...restProps }, ref) { |
| 18063 |
const label = /* @__PURE__ */ (0, import_jsx_runtime67.jsx)( |
| 18064 |
index_parts_exports2.Label, |
| 18065 |
{ |
| 18066 |
ref, |
| 18067 |
className: clsx_default( |
| 18068 |
field_default.label, |
| 18069 |
variant && field_default[`is-${variant}`], |
| 18070 |
className |
| 18071 |
), |
| 18072 |
...restProps |
| 18073 |
} |
| 18074 |
); |
| 18075 |
if (hideFromVision) { |
| 18076 |
return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(VisuallyHidden, { render: label }); |
| 18077 |
} |
| 18078 |
return label; |
| 18079 |
} |
| 18080 |
); |
| 18081 |
|
| 18082 |
// packages/ui/build-module/form/primitives/field/description.mjs |
| 18083 |
var import_element46 = __toESM(require_element(), 1); |
| 18084 |
var import_jsx_runtime68 = __toESM(require_jsx_runtime(), 1); |
| 18085 |
var STYLE_HASH_ATTRIBUTE23 = "data-wp-hash"; |
| 18086 |
function getRuntime23() { |
| 18087 |
const globalScope = globalThis; |
| 18088 |
if (globalScope.__wpStyleRuntime) { |
| 18089 |
return globalScope.__wpStyleRuntime; |
| 18090 |
} |
| 18091 |
globalScope.__wpStyleRuntime = { |
| 18092 |
documents: /* @__PURE__ */ new Map(), |
| 18093 |
styles: /* @__PURE__ */ new Map(), |
| 18094 |
injectedStyles: /* @__PURE__ */ new WeakMap() |
| 18095 |
}; |
| 18096 |
if (typeof document !== "undefined") { |
| 18097 |
registerDocument23(document); |
| 18098 |
} |
| 18099 |
return globalScope.__wpStyleRuntime; |
| 18100 |
} |
| 18101 |
function documentContainsStyleHash23(targetDocument, hash) { |
| 18102 |
if (!targetDocument.head) { |
| 18103 |
return false; |
| 18104 |
} |
| 18105 |
for (const style of targetDocument.head.querySelectorAll( |
| 18106 |
`style[${STYLE_HASH_ATTRIBUTE23}]` |
| 18107 |
)) { |
| 18108 |
if (style.getAttribute(STYLE_HASH_ATTRIBUTE23) === hash) { |
| 18109 |
return true; |
| 18110 |
} |
| 18111 |
} |
| 18112 |
return false; |
| 18113 |
} |
| 18114 |
function injectStyle23(targetDocument, hash, css) { |
| 18115 |
if (!targetDocument.head) { |
| 18116 |
return; |
| 18117 |
} |
| 18118 |
const runtime = getRuntime23(); |
| 18119 |
let injectedStyles = runtime.injectedStyles.get(targetDocument); |
| 18120 |
if (!injectedStyles) { |
| 18121 |
injectedStyles = /* @__PURE__ */ new Set(); |
| 18122 |
runtime.injectedStyles.set(targetDocument, injectedStyles); |
| 18123 |
} |
| 18124 |
if (injectedStyles.has(hash)) { |
| 18125 |
return; |
| 18126 |
} |
| 18127 |
if (documentContainsStyleHash23(targetDocument, hash)) { |
| 18128 |
injectedStyles.add(hash); |
| 18129 |
return; |
| 18130 |
} |
| 18131 |
const style = targetDocument.createElement("style"); |
| 18132 |
style.setAttribute(STYLE_HASH_ATTRIBUTE23, hash); |
| 18133 |
style.appendChild(targetDocument.createTextNode(css)); |
| 18134 |
targetDocument.head.appendChild(style); |
| 18135 |
injectedStyles.add(hash); |
| 18136 |
} |
| 18137 |
function registerDocument23(targetDocument) { |
| 18138 |
const runtime = getRuntime23(); |
| 18139 |
runtime.documents.set( |
| 18140 |
targetDocument, |
| 18141 |
(runtime.documents.get(targetDocument) ?? 0) + 1 |
| 18142 |
); |
| 18143 |
for (const [hash, css] of runtime.styles) { |
| 18144 |
injectStyle23(targetDocument, hash, css); |
| 18145 |
} |
| 18146 |
return () => { |
| 18147 |
const count = runtime.documents.get(targetDocument); |
| 18148 |
if (count === void 0) { |
| 18149 |
return; |
| 18150 |
} |
| 18151 |
if (count <= 1) { |
| 18152 |
runtime.documents.delete(targetDocument); |
| 18153 |
return; |
| 18154 |
} |
| 18155 |
runtime.documents.set(targetDocument, count - 1); |
| 18156 |
}; |
| 18157 |
} |
| 18158 |
function registerStyle23(hash, css) { |
| 18159 |
const runtime = getRuntime23(); |
| 18160 |
runtime.styles.set(hash, css); |
| 18161 |
for (const targetDocument of runtime.documents.keys()) { |
| 18162 |
injectStyle23(targetDocument, hash, css); |
| 18163 |
} |
| 18164 |
} |
| 18165 |
if (typeof process === "undefined" || true) { |
| 18166 |
registerStyle23("d390e935a7", "._6defc79820e382c6__button{box-sizing:var(--_gcd-button-box-sizing,border-box);font-family:var(--_gcd-button-font-family,inherit);font-size:var(--_gcd-button-font-size,inherit);font-weight:var(--_gcd-button-font-weight,inherit)}.d2cff2e5dea83bd1__input{box-sizing:var(--_gcd-input-box-sizing,border-box);font-family:var(--_gcd-input-font-family,inherit);font-size:var(--_gcd-input-font-size,inherit);font-weight:var(--_gcd-input-font-weight,inherit);margin:var(--_gcd-input-margin,0);&:is(textarea,[type=text],[type=password],[type=color],[type=date],[type=datetime],[type=datetime-local],[type=email],[type=month],[type=number],[type=search],[type=tel],[type=time],[type=url],[type=week]){background-color:var(--_gcd-input-background-color,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))}&::placeholder{color:var(--_gcd-input-placeholder-color,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-medium,499));margin:var(--_gcd-heading-margin,0)}._2c0831b0499dbd6e__a,._2c0831b0499dbd6e__a:is(:hover,:focus,:active){border-radius:var(--_gcd-a-border-radius,0);box-shadow:var(--_gcd-a-box-shadow,none);color:var(--_gcd-a-color,inherit);outline:var(--_gcd-a-outline,0 solid transparent);transition:var(--_gcd-a-transition,none)}"); |
| 18167 |
} |
| 18168 |
var global_css_defense_default5 = { "button": "_6defc79820e382c6__button", "input": "d2cff2e5dea83bd1__input", "textarea": "_547d86373d02e108__textarea", "div": "_8c15fd0ed9f28ba4__div", "p": "_43cec3e1eec1066d__p", "heading": "e97669c6d9a38497__heading", "a": "_2c0831b0499dbd6e__a" }; |
| 18169 |
if (typeof process === "undefined" || true) { |
| 18170 |
registerStyle23("4b9484aa9f", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._2d5ad850b2f90964__label{--wp-ui-field-label-line-height:var(--wpds-typography-line-height-xs,16px);color:var(--wpds-color-foreground-content-neutral,#1e1e1e);font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wpds-typography-font-size-xs,11px);font-weight:var(--wpds-typography-font-weight-medium,499);line-height:var(--wp-ui-field-label-line-height);text-transform:uppercase;&._17c4214649230bea__is-plain{font-size:var(--wpds-typography-font-size-md,13px);text-transform:none}}._08a3750500e0233f__description{--_gcd-p-font-size:var(--wpds-typography-font-size-sm,12px);--_gcd-p-line-height:var(--wpds-typography-line-height-xs,16px);--_gcd-p-margin:0;text-wrap:pretty;color:var(--wpds-color-foreground-content-neutral-weak,#707070);font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wpds-typography-font-size-sm,12px);line-height:var(--wpds-typography-line-height-xs,16px)}}}'); |
| 18171 |
} |
| 18172 |
var field_default2 = { "label": "_2d5ad850b2f90964__label", "is-plain": "_17c4214649230bea__is-plain", "description": "_08a3750500e0233f__description" }; |
| 18173 |
var Description = (0, import_element46.forwardRef)(function Description2({ className, ...restProps }, ref) { |
| 18174 |
return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)( |
| 18175 |
index_parts_exports2.Description, |
| 18176 |
{ |
| 18177 |
ref, |
| 18178 |
className: clsx_default( |
| 18179 |
global_css_defense_default5.p, |
| 18180 |
field_default2.description, |
| 18181 |
className |
| 18182 |
), |
| 18183 |
...restProps |
| 18184 |
} |
| 18185 |
); |
| 18186 |
}); |
| 18187 |
|
| 18188 |
// packages/ui/build-module/form/primitives/field/details.mjs |
| 18189 |
var import_element47 = __toESM(require_element(), 1); |
| 18190 |
var import_i18n3 = __toESM(require_i18n(), 1); |
| 18191 |
var import_jsx_runtime69 = __toESM(require_jsx_runtime(), 1); |
| 18192 |
var STYLE_HASH_ATTRIBUTE24 = "data-wp-hash"; |
| 18193 |
function getRuntime24() { |
| 18194 |
const globalScope = globalThis; |
| 18195 |
if (globalScope.__wpStyleRuntime) { |
| 18196 |
return globalScope.__wpStyleRuntime; |
| 18197 |
} |
| 18198 |
globalScope.__wpStyleRuntime = { |
| 18199 |
documents: /* @__PURE__ */ new Map(), |
| 18200 |
styles: /* @__PURE__ */ new Map(), |
| 18201 |
injectedStyles: /* @__PURE__ */ new WeakMap() |
| 18202 |
}; |
| 18203 |
if (typeof document !== "undefined") { |
| 18204 |
registerDocument24(document); |
| 18205 |
} |
| 18206 |
return globalScope.__wpStyleRuntime; |
| 18207 |
} |
| 18208 |
function documentContainsStyleHash24(targetDocument, hash) { |
| 18209 |
if (!targetDocument.head) { |
| 18210 |
return false; |
| 18211 |
} |
| 18212 |
for (const style of targetDocument.head.querySelectorAll( |
| 18213 |
`style[${STYLE_HASH_ATTRIBUTE24}]` |
| 18214 |
)) { |
| 18215 |
if (style.getAttribute(STYLE_HASH_ATTRIBUTE24) === hash) { |
| 18216 |
return true; |
| 18217 |
} |
| 18218 |
} |
| 18219 |
return false; |
| 18220 |
} |
| 18221 |
function injectStyle24(targetDocument, hash, css) { |
| 18222 |
if (!targetDocument.head) { |
| 18223 |
return; |
| 18224 |
} |
| 18225 |
const runtime = getRuntime24(); |
| 18226 |
let injectedStyles = runtime.injectedStyles.get(targetDocument); |
| 18227 |
if (!injectedStyles) { |
| 18228 |
injectedStyles = /* @__PURE__ */ new Set(); |
| 18229 |
runtime.injectedStyles.set(targetDocument, injectedStyles); |
| 18230 |
} |
| 18231 |
if (injectedStyles.has(hash)) { |
| 18232 |
return; |
| 18233 |
} |
| 18234 |
if (documentContainsStyleHash24(targetDocument, hash)) { |
| 18235 |
injectedStyles.add(hash); |
| 18236 |
return; |
| 18237 |
} |
| 18238 |
const style = targetDocument.createElement("style"); |
| 18239 |
style.setAttribute(STYLE_HASH_ATTRIBUTE24, hash); |
| 18240 |
style.appendChild(targetDocument.createTextNode(css)); |
| 18241 |
targetDocument.head.appendChild(style); |
| 18242 |
injectedStyles.add(hash); |
| 18243 |
} |
| 18244 |
function registerDocument24(targetDocument) { |
| 18245 |
const runtime = getRuntime24(); |
| 18246 |
runtime.documents.set( |
| 18247 |
targetDocument, |
| 18248 |
(runtime.documents.get(targetDocument) ?? 0) + 1 |
| 18249 |
); |
| 18250 |
for (const [hash, css] of runtime.styles) { |
| 18251 |
injectStyle24(targetDocument, hash, css); |
| 18252 |
} |
| 18253 |
return () => { |
| 18254 |
const count = runtime.documents.get(targetDocument); |
| 18255 |
if (count === void 0) { |
| 18256 |
return; |
| 18257 |
} |
| 18258 |
if (count <= 1) { |
| 18259 |
runtime.documents.delete(targetDocument); |
| 18260 |
return; |
| 18261 |
} |
| 18262 |
runtime.documents.set(targetDocument, count - 1); |
| 18263 |
}; |
| 18264 |
} |
| 18265 |
function registerStyle24(hash, css) { |
| 18266 |
const runtime = getRuntime24(); |
| 18267 |
runtime.styles.set(hash, css); |
| 18268 |
for (const targetDocument of runtime.documents.keys()) { |
| 18269 |
injectStyle24(targetDocument, hash, css); |
| 18270 |
} |
| 18271 |
} |
| 18272 |
if (typeof process === "undefined" || true) { |
| 18273 |
registerStyle24("4b9484aa9f", '@layer wp-ui{@layer utilities, components, compositions, overrides;@layer utilities{._2d5ad850b2f90964__label{--wp-ui-field-label-line-height:var(--wpds-typography-line-height-xs,16px);color:var(--wpds-color-foreground-content-neutral,#1e1e1e);font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wpds-typography-font-size-xs,11px);font-weight:var(--wpds-typography-font-weight-medium,499);line-height:var(--wp-ui-field-label-line-height);text-transform:uppercase;&._17c4214649230bea__is-plain{font-size:var(--wpds-typography-font-size-md,13px);text-transform:none}}._08a3750500e0233f__description{--_gcd-p-font-size:var(--wpds-typography-font-size-sm,12px);--_gcd-p-line-height:var(--wpds-typography-line-height-xs,16px);--_gcd-p-margin:0;text-wrap:pretty;color:var(--wpds-color-foreground-content-neutral-weak,#707070);font-family:var(--wpds-typography-font-family-body,-apple-system,system-ui,"Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue",sans-serif);font-size:var(--wpds-typography-font-size-sm,12px);line-height:var(--wpds-typography-line-height-xs,16px)}}}'); |
| 18274 |
} |
| 18275 |
var field_default3 = { "label": "_2d5ad850b2f90964__label", "is-plain": "_17c4214649230bea__is-plain", "description": "_08a3750500e0233f__description" }; |
| 18276 |
var Details = (0, import_element47.forwardRef)( |
| 18277 |
function Details2({ className, ...restProps }, ref) { |
| 18278 |
return /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)(import_jsx_runtime69.Fragment, { children: [ |
| 18279 |
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)(VisuallyHidden, { render: /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(index_parts_exports2.Description, {}), children: (0, import_i18n3.__)("More details follow the field.") }), |
| 18280 |
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)( |
| 18281 |
"div", |
| 18282 |
{ |
| 18283 |
ref, |
| 18284 |
className: clsx_default(field_default3.description, className), |
| 18285 |
...restProps |
| 18286 |
} |
| 18287 |
) |
| 18288 |
] }); |
| 18289 |
} |
| 18290 |
); |
| 18291 |
|
| 18292 |
// packages/ui/build-module/form/primitives/field/control.mjs |
| 18293 |
var import_element48 = __toESM(require_element(), 1); |
| 18294 |
var import_jsx_runtime70 = __toESM(require_jsx_runtime(), 1); |
| 18295 |
var Control = (0, import_element48.forwardRef)( |
| 18296 |
function Control2(props, ref) { |
| 18297 |
return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(index_parts_exports2.Control, { ref, ...props }); |
| 18298 |
} |
| 18299 |
); |
| 18300 |
|
| 18301 |
// packages/ui/build-module/form/input-control/input-control.mjs |
| 18302 |
var import_element49 = __toESM(require_element(), 1); |
| 18303 |
var import_jsx_runtime71 = __toESM(require_jsx_runtime(), 1); |
| 18304 |
var InputControl = (0, import_element49.forwardRef)( |
| 18305 |
function InputControl2({ |
| 18306 |
className, |
| 18307 |
label, |
| 18308 |
description, |
| 18309 |
details, |
| 18310 |
hideLabelFromVision, |
| 18311 |
...restProps |
| 18312 |
}, ref) { |
| 18313 |
return /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)(field_exports.Root, { className, children: [ |
| 18314 |
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(field_exports.Label, { hideFromVision: hideLabelFromVision, children: label }), |
| 18315 |
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Input3, { ref, ...restProps }), |
| 18316 |
description && /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(field_exports.Description, { children: description }), |
| 18317 |
details && /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(field_exports.Details, { children: details }) |
| 18318 |
] }); |
| 18319 |
} |
| 18320 |
); |
| 18321 |
|
| 18322 |
// widgets/events/components/location-picker/location-picker.module.css |
| 18323 |
var location_picker_default = { |
| 18324 |
locationInput: "location_picker_locationInput" |
| 18325 |
}; |
| 18326 |
|
| 18327 |
// widgets/events/components/location-picker/location-picker.tsx |
| 18328 |
var import_jsx_runtime72 = __toESM(require_jsx_runtime()); |
| 18329 |
var DRAFT_DEBOUNCE_MS = 300; |
| 18330 |
function LocationPicker({ |
| 18331 |
onSubmit = () => { |
| 18332 |
}, |
| 18333 |
seedInput = "", |
| 18334 |
hideLabelFromVision = true, |
| 18335 |
selectButton = true, |
| 18336 |
onChange |
| 18337 |
}) { |
| 18338 |
const locationInputId = (0, import_element50.useId)(); |
| 18339 |
const [locationInput, setLocationInput] = (0, import_element50.useState)(seedInput); |
| 18340 |
const [locationOptions, setLocationOptions] = (0, import_element50.useState)([]); |
| 18341 |
const [isLocatingCity, setIsLocatingCity] = (0, import_element50.useState)(false); |
| 18342 |
const draftTimeoutRef = (0, import_element50.useRef)( |
| 18343 |
null |
| 18344 |
); |
| 18345 |
(0, import_element50.useEffect)(() => { |
| 18346 |
if (!selectButton || seedInput) { |
| 18347 |
setLocationInput(seedInput); |
| 18348 |
} |
| 18349 |
}, [selectButton, seedInput]); |
| 18350 |
const clearDraftTimeout = (0, import_element50.useCallback)(() => { |
| 18351 |
if (draftTimeoutRef.current) { |
| 18352 |
clearTimeout(draftTimeoutRef.current); |
| 18353 |
draftTimeoutRef.current = null; |
| 18354 |
} |
| 18355 |
}, []); |
| 18356 |
const tryPublishDraft = (0, import_element50.useCallback)(() => { |
| 18357 |
if (selectButton || !onChange) { |
| 18358 |
return; |
| 18359 |
} |
| 18360 |
const draft = locationInput.trim(); |
| 18361 |
const saved = seedInput.trim(); |
| 18362 |
if (draft === saved) { |
| 18363 |
return; |
| 18364 |
} |
| 18365 |
onChange(locationInput); |
| 18366 |
}, [selectButton, locationInput, onChange, seedInput]); |
| 18367 |
const scheduleDraftPublish = (0, import_element50.useCallback)(() => { |
| 18368 |
if (selectButton || !onChange) { |
| 18369 |
return; |
| 18370 |
} |
| 18371 |
clearDraftTimeout(); |
| 18372 |
draftTimeoutRef.current = setTimeout(() => { |
| 18373 |
draftTimeoutRef.current = null; |
| 18374 |
tryPublishDraft(); |
| 18375 |
}, DRAFT_DEBOUNCE_MS); |
| 18376 |
}, [clearDraftTimeout, selectButton, onChange, tryPublishDraft]); |
| 18377 |
(0, import_element50.useEffect)(() => { |
| 18378 |
if (selectButton || !onChange) { |
| 18379 |
clearDraftTimeout(); |
| 18380 |
return; |
| 18381 |
} |
| 18382 |
scheduleDraftPublish(); |
| 18383 |
return clearDraftTimeout; |
| 18384 |
}, [clearDraftTimeout, selectButton, onChange, scheduleDraftPublish]); |
| 18385 |
const flushDraftPublish = (0, import_element50.useCallback)(() => { |
| 18386 |
clearDraftTimeout(); |
| 18387 |
tryPublishDraft(); |
| 18388 |
}, [clearDraftTimeout, tryPublishDraft]); |
| 18389 |
const fillCityFromGeolocation = async () => { |
| 18390 |
if (!navigator.geolocation || isLocatingCity) { |
| 18391 |
return; |
| 18392 |
} |
| 18393 |
setIsLocatingCity(true); |
| 18394 |
try { |
| 18395 |
const position = await new Promise( |
| 18396 |
(resolve, reject) => { |
| 18397 |
navigator.geolocation.getCurrentPosition(resolve, reject, { |
| 18398 |
enableHighAccuracy: false, |
| 18399 |
timeout: 1e4 |
| 18400 |
}); |
| 18401 |
} |
| 18402 |
); |
| 18403 |
const { latitude, longitude } = position.coords; |
| 18404 |
const response = await fetch( |
| 18405 |
`https://nominatim.openstreetmap.org/reverse?format=jsonv2&lat=${latitude}&lon=${longitude}` |
| 18406 |
); |
| 18407 |
const data = await response.json(); |
| 18408 |
const city = data.address?.city ?? data.address?.town ?? data.address?.village ?? data.address?.municipality; |
| 18409 |
if (city) { |
| 18410 |
setLocationInput(city); |
| 18411 |
} |
| 18412 |
} catch { |
| 18413 |
} finally { |
| 18414 |
setIsLocatingCity(false); |
| 18415 |
} |
| 18416 |
}; |
| 18417 |
(0, import_element50.useEffect)(() => { |
| 18418 |
const query = locationInput.trim(); |
| 18419 |
if (query.length < 2) { |
| 18420 |
setLocationOptions([]); |
| 18421 |
return; |
| 18422 |
} |
| 18423 |
const controller = new AbortController(); |
| 18424 |
const timeoutId = setTimeout(async () => { |
| 18425 |
try { |
| 18426 |
const params = new URLSearchParams({ |
| 18427 |
q: query, |
| 18428 |
featureType: "city", |
| 18429 |
format: "jsonv2", |
| 18430 |
addressdetails: "1", |
| 18431 |
limit: "8" |
| 18432 |
}); |
| 18433 |
const response = await fetch( |
| 18434 |
`https://nominatim.openstreetmap.org/search?${params}`, |
| 18435 |
{ signal: controller.signal } |
| 18436 |
); |
| 18437 |
const data = await response.json(); |
| 18438 |
const seen = /* @__PURE__ */ new Set(); |
| 18439 |
const nextOptions = data.map((place) => { |
| 18440 |
const city = place.address?.city ?? place.address?.town ?? place.address?.village ?? place.address?.municipality; |
| 18441 |
const country = place.address?.country; |
| 18442 |
if (!city) { |
| 18443 |
return null; |
| 18444 |
} |
| 18445 |
const label = country ? `${city}, ${country}` : city; |
| 18446 |
if (seen.has(label.toLowerCase())) { |
| 18447 |
return null; |
| 18448 |
} |
| 18449 |
seen.add(label.toLowerCase()); |
| 18450 |
return { |
| 18451 |
id: String(place.place_id), |
| 18452 |
value: label |
| 18453 |
}; |
| 18454 |
}).filter(Boolean); |
| 18455 |
setLocationOptions(nextOptions); |
| 18456 |
} catch (error2) { |
| 18457 |
if (error2 instanceof Error && error2.name === "AbortError") { |
| 18458 |
return; |
| 18459 |
} |
| 18460 |
setLocationOptions([]); |
| 18461 |
} |
| 18462 |
}, 200); |
| 18463 |
return () => { |
| 18464 |
clearTimeout(timeoutId); |
| 18465 |
controller.abort(); |
| 18466 |
}; |
| 18467 |
}, [locationInput]); |
| 18468 |
return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)( |
| 18469 |
"form", |
| 18470 |
{ |
| 18471 |
onSubmit: (e) => { |
| 18472 |
e.preventDefault(); |
| 18473 |
if (selectButton) { |
| 18474 |
onSubmit(locationInput); |
| 18475 |
} |
| 18476 |
}, |
| 18477 |
children: /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)(Stack, { direction: "row", align: "start", wrap: "wrap", gap: "sm", children: [ |
| 18478 |
/* @__PURE__ */ (0, import_jsx_runtime72.jsxs)( |
| 18479 |
autocomplete_exports.Root, |
| 18480 |
{ |
| 18481 |
items: locationOptions, |
| 18482 |
value: locationInput, |
| 18483 |
onValueChange: setLocationInput, |
| 18484 |
children: [ |
| 18485 |
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)( |
| 18486 |
autocomplete_exports.Input, |
| 18487 |
{ |
| 18488 |
id: locationInputId, |
| 18489 |
className: location_picker_default.locationInput, |
| 18490 |
render: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)( |
| 18491 |
InputControl, |
| 18492 |
{ |
| 18493 |
autoComplete: "off", |
| 18494 |
label: (0, import_i18n4.__)("City"), |
| 18495 |
hideLabelFromVision, |
| 18496 |
size: "compact", |
| 18497 |
description: (0, import_i18n4.__)( |
| 18498 |
"Select a city to view upcoming events." |
| 18499 |
), |
| 18500 |
onValueChange: () => { |
| 18501 |
}, |
| 18502 |
onBlur: !selectButton ? flushDraftPublish : void 0, |
| 18503 |
suffix: /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)(InputLayout3.Slot, { padding: "minimal", children: [ |
| 18504 |
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)(autocomplete_exports.Clear, {}), |
| 18505 |
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)( |
| 18506 |
IconButton, |
| 18507 |
{ |
| 18508 |
icon: map_marker_default, |
| 18509 |
label: (0, import_i18n4.__)( |
| 18510 |
"Use current location" |
| 18511 |
), |
| 18512 |
onClick: fillCityFromGeolocation, |
| 18513 |
disabled: isLocatingCity, |
| 18514 |
size: "small", |
| 18515 |
variant: "minimal" |
| 18516 |
} |
| 18517 |
) |
| 18518 |
] }) |
| 18519 |
} |
| 18520 |
), |
| 18521 |
placeholder: (0, import_i18n4.__)("City, like Tokyo\u2026") |
| 18522 |
} |
| 18523 |
), |
| 18524 |
locationOptions.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(autocomplete_exports.Popup, { children: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(autocomplete_exports.List, { children: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(autocomplete_exports.ListBody, { children: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(autocomplete_exports.Collection, { children: (item) => /* @__PURE__ */ (0, import_jsx_runtime72.jsx)( |
| 18525 |
autocomplete_exports.Item, |
| 18526 |
{ |
| 18527 |
value: item, |
| 18528 |
children: item.value |
| 18529 |
}, |
| 18530 |
item.id |
| 18531 |
) }) }) }) }) |
| 18532 |
] |
| 18533 |
} |
| 18534 |
), |
| 18535 |
selectButton && /* @__PURE__ */ (0, import_jsx_runtime72.jsx)( |
| 18536 |
Button4, |
| 18537 |
{ |
| 18538 |
variant: "outline", |
| 18539 |
size: "compact", |
| 18540 |
type: "submit", |
| 18541 |
disabled: !locationInput.trim(), |
| 18542 |
children: (0, import_i18n4.__)("Select") |
| 18543 |
} |
| 18544 |
) |
| 18545 |
] }) |
| 18546 |
} |
| 18547 |
); |
| 18548 |
} |
| 18549 |
|
| 18550 |
// widgets/events/components/location-setting-control/location-setting-control.tsx |
| 18551 |
var import_jsx_runtime73 = __toESM(require_jsx_runtime()); |
| 18552 |
function LocationSettingControl({ |
| 18553 |
data, |
| 18554 |
field, |
| 18555 |
onChange, |
| 18556 |
hideLabelFromVision |
| 18557 |
}) { |
| 18558 |
const value = field.getValue({ item: data }); |
| 18559 |
const onLocationChange = (0, import_element51.useCallback)( |
| 18560 |
(location) => { |
| 18561 |
onChange( |
| 18562 |
field.setValue({ |
| 18563 |
item: data, |
| 18564 |
value: location.trim() |
| 18565 |
}) |
| 18566 |
); |
| 18567 |
}, |
| 18568 |
[data, field, onChange] |
| 18569 |
); |
| 18570 |
return /* @__PURE__ */ (0, import_jsx_runtime73.jsx)( |
| 18571 |
LocationPicker, |
| 18572 |
{ |
| 18573 |
seedInput: value ?? "", |
| 18574 |
hideLabelFromVision, |
| 18575 |
selectButton: false, |
| 18576 |
onChange: onLocationChange |
| 18577 |
} |
| 18578 |
); |
| 18579 |
} |
| 18580 |
|
| 18581 |
// widgets/events/widget.ts |
| 18582 |
var widget_default = { |
| 18583 |
name: "core/events", |
| 18584 |
title: (0, import_i18n5.__)("WordPress events"), |
| 18585 |
icon: calendar_default, |
| 18586 |
attributes: [ |
| 18587 |
{ |
| 18588 |
id: "location", |
| 18589 |
type: "text", |
| 18590 |
label: (0, import_i18n5.__)("Event location"), |
| 18591 |
description: (0, import_i18n5.__)( |
| 18592 |
"City or region for nearby events. Edits apply when you save this panel." |
| 18593 |
), |
| 18594 |
Edit: LocationSettingControl |
| 18595 |
} |
| 18596 |
] |
| 18597 |
}; |
| 18598 |
export { |
| 18599 |
widget_default as default |
| 18600 |
}; |
| 18601 |
/*! Bundled license information: |
| 18602 |
|
| 18603 |
use-sync-external-store/cjs/use-sync-external-store-shim.development.js: |
| 18604 |
(** |
| 18605 |
* @license React |
| 18606 |
* use-sync-external-store-shim.development.js |
| 18607 |
* |
| 18608 |
* Copyright (c) Meta Platforms, Inc. and affiliates. |
| 18609 |
* |
| 18610 |
* This source code is licensed under the MIT license found in the |
| 18611 |
* LICENSE file in the root directory of this source tree. |
| 18612 |
*) |
| 18613 |
|
| 18614 |
use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js: |
| 18615 |
(** |
| 18616 |
* @license React |
| 18617 |
* use-sync-external-store-shim/with-selector.development.js |
| 18618 |
* |
| 18619 |
* Copyright (c) Meta Platforms, Inc. and affiliates. |
| 18620 |
* |
| 18621 |
* This source code is licensed under the MIT license found in the |
| 18622 |
* LICENSE file in the root directory of this source tree. |
| 18623 |
*) |
| 18624 |
*/ |
| 18625 |
|