1;!function(){try { var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof global?global:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&((e._debugIds|| (e._debugIds={}))[n]="a12939b3-c11a-4460-821f-3385a6ee07ab")}catch(e){}}(); 2(globalThis["TURBOPACK"] || (globalThis["TURBOPACK"] = [])).push([typeof document === "object" ? document.currentScript : undefined, 3673836, ((__turbopack_context__) => { 4"use strict"; 5 6// MERGED MODULE: [project]/node_modules/react-datocms/dist/esm/Image/index.js [app-client] (ecmascript) 7; 8// biome-ignore lint/style/useImportType: wrong warning 9var __TURBOPACK__imported__module__271645__ = __turbopack_context__.i(271645); 10// MERGED MODULE: [project]/node_modules/react-datocms/dist/esm/RSCImage/utils.js [app-client] (ecmascript) 11; 12var __TURBOPACK__imported__module__271645__1 = __TURBOPACK__imported__module__271645__; 13; 14function priorityProp(fetchPriority) { 15 // https://github.com/vercel/next.js/commit/68d5a3892b4edf1b62e3ece4ada324065a96b6f3 16 // biome-ignore lint/suspicious/noExplicitAny: React.use is only available on React 19, react@canary and react@beta 17 if (typeof __TURBOPACK__imported__module__271645__1["default"].use === 'function') { 18 return { 19 fetchPriority 20 }; 21 } 22 return { 23 fetchpriority: fetchPriority 24 }; 25} 26const bogusBaseUrl = 'https://example.com/'; 27const buildSrcSetFromSrc = (src, width, candidateMultipliers)=>{ 28 if (!(src && width)) { 29 return undefined; 30 } 31 return candidateMultipliers.map((multiplier)=>{ 32 const url = new URL(src, bogusBaseUrl); 33 if (multiplier !== 1) { 34 url.searchParams.set('dpr', "".concat(multiplier)); 35 const maxH = url.searchParams.get('max-h'); 36 const maxW = url.searchParams.get('max-w'); 37 if (maxH) { 38 url.searchParams.set('max-h', "".concat(Math.floor(Number.parseInt(maxH) * multiplier))); 39 } 40 if (maxW) { 41 url.searchParams.set('max-w', "".concat(Math.floor(Number.parseInt(maxW) * multiplier))); 42 } 43 } 44 const finalWidth = Math.floor(width * multiplier); 45 if (finalWidth < 50) { 46 return null; 47 } 48 return "".concat(url.toString().replace(bogusBaseUrl, '/'), " ").concat(finalWidth, "w"); 49 }).filter(Boolean).join(','); 50}; 51function buildWebpSource(data, sizes) { 52 var _a; 53 return data.webpSrcSet && __TURBOPACK__imported__module__271645__1["default"].createElement("source", { 54 srcSet: data.webpSrcSet, 55 sizes: (_a = sizes !== null && sizes !== void 0 ? sizes : data.sizes) !== null && _a !== void 0 ? _a : undefined, 56 type: "image/webp" 57 }); 58} 59function buildRegularSource(data, sizes, srcSetCandidates) { 60 var _a, _b; 61 return __TURBOPACK__imported__module__271645__1["default"].createElement("source", { 62 srcSet: (_a = data.srcSet) !== null && _a !== void 0 ? _a : buildSrcSetFromSrc(data.src, data.width, srcSetCandidates), 63 sizes: (_b = sizes !== null && sizes !== void 0 ? sizes : data.sizes) !== null && _b !== void 0 ? _b : undefined 64 }); 65} 66// MERGED MODULE: [project]/node_modules/react-datocms/node_modules/react-intersection-observer/dist/index.mjs [app-client] (ecmascript) 67; 68var __TURBOPACK__imported__module__271645__2 = __TURBOPACK__imported__module__271645__; 69"use client"; 70var __defProp = Object.defineProperty; 71var __defNormalProp = (obj, key, value)=>key in obj ? __defProp(obj, key, { 72 enumerable: true, 73 configurable: true, 74 writable: true, 75 value 76 }) : obj[key] = value; 77var __publicField = (obj, key, value)=>__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value); 78;
79// src/observe.ts 80var observerMap = /* @__PURE__ */ new Map(); 81var RootIds = /* @__PURE__ */ new WeakMap(); 82var rootId = 0; 83var unsupportedValue = void 0; 84function defaultFallbackInView(inView) { 85 unsupportedValue = inView; 86} 87function getRootId(root) { 88 if (!root) return "0"; 89 if (RootIds.has(root)) return RootIds.get(root); 90 rootId += 1; 91 RootIds.set(root, rootId.toString()); 92 return RootIds.get(root); 93} 94function optionsToId(options) { 95 return Object.keys(options).sort().filter((key)=>options[key] !== void 0).map((key)=>{ 96 return "".concat(key, "_").concat(key === "root" ? getRootId(options.root) : options[key]); 97 }).toString(); 98} 99function createObserver(options) { 100 const id = optionsToId(options); 101 let instance = observerMap.get(id); 102 if (!instance) { 103 const elements = /* @__PURE__ */ new Map(); 104 let thresholds; 105 const observer = new IntersectionObserver((entries)=>{ 106 entries.forEach((entry)=>{ 107 var _a; 108 const inView = entry.isIntersecting && thresholds.some((threshold)=>entry.intersectionRatio >= threshold); 109 if (options.trackVisibility && typeof entry.isVisible === "undefined") { 110 entry.isVisible = inView; 111 } 112 (_a = elements.get(entry.target)) == null ? void 0 : _a.forEach((callback)=>{ 113 callback(inView, entry); 114 }); 115 }); 116 }, options); 117 thresholds = observer.thresholds || (Array.isArray(options.threshold) ? options.threshold : [ 118 options.threshold || 0 119 ]); 120 instance = { 121 id, 122 observer, 123 elements 124 }; 125 observerMap.set(id, instance); 126 } 127 return instance; 128} 129function observe(element, callback) { 130 let options = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}, fallbackInView = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : unsupportedValue; 131 if (typeof window.IntersectionObserver === "undefined" && fallbackInView !== void 0) { 132 const bounds = element.getBoundingClientRect(); 133 callback(fallbackInView, { 134 isIntersecting: fallbackInView, 135 target: element, 136 intersectionRatio: typeof options.threshold === "number" ? options.threshold : 0, 137 time: 0, 138 boundingClientRect: bounds, 139 intersectionRect: bounds, 140 rootBounds: bounds 141 }); 142 return ()=>{}; 143 } 144 const { id, observer, elements } = createObserver(options); 145 const callbacks = elements.get(element) || []; 146 if (!elements.has(element)) { 147 elements.set(element, callbacks); 148 } 149 callbacks.push(callback); 150 observer.observe(element); 151 return function unobserve() { 152 callbacks.splice(callbacks.indexOf(callback), 1); 153 if (callbacks.length === 0) { 154 elements.delete(element); 155 observer.unobserve(element); 156 } 157 if (elements.size === 0) { 158 observer.disconnect(); 159 observerMap.delete(id); 160 } 161 }; 162}
163// src/InView.tsx 164function isPlainChildren(props) { 165 return typeof props.children !== "function"; 166} 167var InView = class extends __TURBOPACK__imported__module__271645__2["Component"] { 168 componentDidMount() { 169 this.unobserve(); 170 this.observeNode(); 171 } 172 componentDidUpdate(prevProps) { 173 if (prevProps.rootMargin !== this.props.rootMargin || prevProps.root !== this.props.root || prevProps.threshold !== this.props.threshold || prevProps.skip !== this.props.skip || prevProps.trackVisibility !== this.props.trackVisibility || prevProps.delay !== this.props.delay) { 174 this.unobserve(); 175 this.observeNode(); 176 } 177 } 178 componentWillUnmount() { 179 this.unobserve(); 180 } 181 observeNode() { 182 if (!this.node || this.props.skip) return; 183 const { threshold, root, rootMargin, trackVisibility, delay, fallbackInView } = this.props; 184 this._unobserveCb = observe(this.node, this.handleChange, { 185 threshold, 186 root, 187 rootMargin, 188 // @ts-ignore 189 trackVisibility, 190 // @ts-ignore 191 delay 192 }, fallbackInView); 193 } 194 unobserve() { 195 if (this._unobserveCb) { 196 this._unobserveCb(); 197 this._unobserveCb = null; 198 } 199 } 200 render() { 201 const { children } = this.props; 202 if (typeof children === "function") { 203 const { inView, entry } = this.state; 204 return children({ 205 inView, 206 entry, 207 ref: this.handleNode 208 }); 209 } 210 const { as, triggerOnce, threshold, root, rootMargin, onChange, skip, trackVisibility, delay, initialInView, fallbackInView, ...props } = this.props; 211 return __TURBOPACK__imported__module__271645__2["createElement"](as || "div", { 212 ref: this.handleNode, 213 ...props 214 }, children); 215 } 216 constructor(props){ 217 super(props); 218 __publicField(this, "node", null); 219 __publicField(this, "_unobserveCb", null); 220 __publicField(this, "handleNode", (node)=>{ 221 if (this.node) { 222 this.unobserve(); 223 if (!node && !this.props.triggerOnce && !this.props.skip) { 224 this.setState({ 225 inView: !!this.props.initialInView, 226 entry: void 0 227 }); 228 } 229 } 230 this.node = node ? node : null; 231 this.observeNode(); 232 }); 233 __publicField(this, "handleChange", (inView, entry)=>{ 234 if (inView && this.props.triggerOnce) { 235 this.unobserve(); 236 } 237 if (!isPlainChildren(this.props)) { 238 this.setState({ 239 inView, 240 entry 241 }); 242 } 243 if (this.props.onChange) { 244 this.props.onChange(inView, entry); 245 } 246 }); 247 this.state = { 248 inView: !!props.initialInView, 249 entry: void 0 250 }; 251 } 252}; 253; 254function useInView() { 255 let { threshold, delay, trackVisibility, rootMargin, root, triggerOnce, skip, initialInView, fallbackInView, onChange } = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}; 256 var _a; 257 const [ref, setRef] = __TURBOPACK__imported__module__271645__2["useState"](null); 258 const callback = __TURBOPACK__imported__module__271645__2["useRef"](onChange); 259 const [state, setState] = __TURBOPACK__imported__module__271645__2["useState"]({ 260 inView: !!initialInView, 261 entry: void 0 262 }); 263 callback.current = onChange; 264 __TURBOPACK__imported__module__271645__2["useEffect"](()=>{ 265 if (skip || !ref) return; 266 let unobserve; 267 unobserve = observe(ref, (inView, entry)=>{ 268 setState({ 269 inView, 270 entry 271 }); 272 if (callback.current) callback.current(inView, entry); 273 if (entry.isIntersecting && triggerOnce && unobserve) { 274 unobserve(); 275 unobserve = void 0; 276 } 277 }, { 278 root, 279 rootMargin, 280 threshold, 281 // @ts-ignore 282 trackVisibility, 283 // @ts-ignore 284 delay 285 }, fallbackInView); 286 return ()=>{
287 if (unobserve) { 288 unobserve(); 289 } 290 }; 291 }, // We break the rule here, because we aren't including the actual `threshold` variable 292 // eslint-disable-next-line react-hooks/exhaustive-deps 293 [ 294 // If the threshold is an array, convert it to a string, so it won't change between renders. 295 Array.isArray(threshold) ? threshold.toString() : threshold, 296 ref, 297 root, 298 rootMargin, 299 triggerOnce, 300 skip, 301 trackVisibility, 302 fallbackInView, 303 delay 304 ]); 305 const entryTarget = (_a = state.entry) == null ? void 0 : _a.target; 306 const previousEntryTarget = __TURBOPACK__imported__module__271645__2["useRef"](void 0); 307 if (!ref && entryTarget && !triggerOnce && !skip && previousEntryTarget.current !== entryTarget) { 308 previousEntryTarget.current = entryTarget; 309 setState({ 310 inView: !!initialInView, 311 entry: void 0 312 }); 313 } 314 const result = [ 315 setRef, 316 state.inView, 317 state.entry 318 ]; 319 result.ref = result[0]; 320 result.inView = result[1]; 321 result.entry = result[2]; 322 return result; 323} 324; 325// MERGED MODULE: [project]/node_modules/react-datocms/dist/esm/Image/utils.js [app-client] (ecmascript) 326; 327var __TURBOPACK__imported__module__467034__ = __turbopack_context__.i(467034); 328var __TURBOPACK__imported__module__271645__3 = __TURBOPACK__imported__module__271645__; 329; 330const isSsr = typeof window === 'undefined'; 331const isIntersectionObserverAvailable = isSsr ? false : !!window.IntersectionObserver; 332const universalBtoa = (str)=>isSsr ? __TURBOPACK__imported__module__467034__["Buffer"].from(str.toString(), 'binary').toString('base64') : window.btoa(str); 333function useImageLoad(ref, callback) { 334 const [loaded, setLoaded] = (0, __TURBOPACK__imported__module__271645__3["useState"])(false); 335 function handleLoad() { 336 setLoaded(true); 337 callback === null || callback === void 0 ? void 0 : callback(); 338 } 339 // https://stackoverflow.com/q/39777833/266535 340 (0, __TURBOPACK__imported__module__271645__3["useEffect"])(()=>{ 341 if (!ref.current) { 342 return; 343 } 344 if (ref.current.complete && ref.current.naturalWidth) { 345 handleLoad(); 346 } 347 }, []); 348 return [ 349 loaded, 350 handleLoad 351 ]; 352} 353function useMergedRef() { 354 for(var _len = arguments.length, refs = new Array(_len), _key = 0; _key < _len; _key++){ 355 refs[_key] = arguments[_key]; 356 } 357 return (0, __TURBOPACK__imported__module__271645__3["useCallback"])((element)=>{ 358 for(let i = 0; i < refs.length; i++){ 359 const ref = refs[i]; 360 if (typeof ref === 'function') ref(element); 361 else if (ref && typeof ref === 'object') ref.current = element; 362 } 363 }, refs); 364} 365const absolutePositioning = { 366 position: 'absolute', 367 left: 0, 368 top: 0, 369 width: '100%', 370 height: '100%', 371 maxWidth: 'none', 372 maxHeight: 'none' 373}; 374'use client'; 375; 376; 377; 378; 379; 380const imageAddStrategy = (param)=>{ 381 let { priority, inView, loaded } = param; 382 if (priority) { 383 return true; 384 } 385 if (isSsr) { 386 return false; 387 } 388 if (isIntersectionObserverAvailable) { 389 return inView || loaded; 390 } 391 return true; 392}; 393const imageShowStrategy = (param)=>{ 394 let { priority, loaded } = param; 395 if (priority) { 396 return true; 397 } 398 if (isSsr) { 399 return false; 400 } 401 if (isIntersectionObserverAvailable) { 402 return loaded; 403 } 404 return true; 405}; 406const Image = (0, __TURBOPACK__imported__module__271645__["forwardRef"])((param, ref)=>{ 407 let { className, fadeInDuration = 500, intersectionTreshold, intersectionThreshold, intersectionMargin, pictureClassName, imgClassName, style, pictureStyle, imgStyle, layout = 'intrinsic', objectFit, objectPosition, data, onLoad, usePlaceholder = true, priority = false, sizes, srcSetCandidates = [ 408 0.25, 409 0.5, 410 0.75, 411 1, 412 1.5, 413 2, 414 3, 415 4 416 ], placeholderClassName, placeholderStyle, referrerPolicy = 'no-referrer-when-downgrade' } = param; 417 var _a, _b, _c, _d, _e, _f; 418 const imageRef = (0, __TURBOPACK__imported__module__271645__["useRef"])(null); 419 const [loaded, handleLoad] = useImageLoad(imageRef, onLoad); 420 const [viewRef, inView] = useInView({ 421 threshold: intersectionThreshold || intersectionTreshold || 0, 422 rootMargin: intersectionMargin || '0px 0px 0px 0px', 423 triggerOnce: true, 424 fallbackInView: true 425 }); 426 const rootRef = useMergedRef(ref, viewRef); 427 const addImage = imageAddStrategy({ 428 priority, 429 inView, 430 loaded 431 }); 432 const showImage = imageShowStrategy({ 433 priority, 434 inView, 435 loaded 436 }); 437 // When no explicit `sizes` is given, default lazy images to `sizes="auto"` 438 // so the browser picks the optimal `srcset` candidate from the rendered 439 // width. This component injects the real <img> only once it scrolls into 440 // view, at which point its box is already laid out â so `auto` resolves 441 // correctly. Per the HTML spec, `auto` needs the <img> to be lazy AND carry 442 // a `sizes` starting with `auto`, and a <source>'s `auto` only engages when 443 // its sibling <img> does too â hence `resolvedSizes` + `loading="lazy"` on 444 // the injected <img> below (and the <noscript> fallback already is lazy). 445 // Skipped for `priority` (eager) images; `, 100vw` is the legacy fallback. 446 const resolvedSizes = (_a = sizes !== null && sizes !== void 0 ? sizes : data.sizes) !== null && _a !== void 0 ? _a : priority ? undefined : 'auto, 100vw'; 447 const webpSource = buildWebpSource(data, resolvedSizes); 448 const regularSource = buildRegularSource(data, resolvedSizes, srcSetCandidates); 449 const transition = fadeInDuration > 0 ? "opacity ".concat(fadeInDuration, "ms") : undefined; 450 const basePlaceholderStyle = Object.assign({ 451 transition, 452 opacity: showImage ? 0 : 1, 453 // During the opacity transition of the placeholder to the definitive version, 454 // hardware acceleration is triggered. This results in the browser trying to render the 455 // placeholder with your GPU, causing blurred edges. Solution: style the placeholder 456 // so the edges overflow the container 457 position: 'absolute', 458 left: '-5%', 459 top: '-5%', 460 width: '110%', 461 height: data.base64 ? 'auto' : '110%', 462 maxWidth: 'none', 463 maxHeight: 'none' 464 }, placeholderStyle); 465 const placeholder = usePlaceholder && data.base64 ? __TURBOPACK__imported__module__271645__["default"].createElement("img", { 466 "aria-hidden": "true", 467 alt: "", 468 src: data.base64, 469 className: placeholderClassName, 470 style: Object.assign({ 471 objectFit, 472 objectPosition 473 }, basePlaceholderStyle) 474 }) : usePlaceholder && data.bgColor ? __TURBOPACK__imported__module__271645__["default"].createElement("div", { 475 className: placeholderClassName, 476 style: Object.assign({ 477 backgroundColor: data.bgColor 478 }, basePlaceholderStyle) 479 }) : null; 480 const { width, aspectRatio } = data; 481 const height = (_b = data.height) !== null && _b !== void 0 ? _b : aspectRatio ? width / aspectRatio : 0; 482 const svg = '<svg xmlns="http://www.w3.org/2000/svg" width="'.concat(width, '" height="').concat(height, '"></svg>'); 483 const sizer = layout !== 'fill' ? __TURBOPACK__imported__module__271645__["default"].createElement("img", { 484 className: imgClassName, 485 style: Object.assign({ 486 display: 'block', 487 width: '100%' 488 }, imgStyle), 489 src: "data:image/svg+xml;base64,".concat(universalBtoa(svg)), 490 "aria-hidden": "true", 491 alt: "" 492 }) : null; 493 return __TURBOPACK__imported__module__271645__["default"].createElement("div", { 494 ref: rootRef, 495 className: className, 496 style: Object.assign(Object.assign({ 497 overflow: 'hidden' 498 }, layout === 'fill' ? absolutePositioning : layout === 'intrinsic' ? { 499 position: 'relative', 500 width: '100%', 501 maxWidth: width 502 } : layout === 'fixed' ? { 503 position: 'relative', 504 width 505 } : { 506 position: 'relative', 507 width: '100%' 508 }), style) 509 }, sizer, placeholder, addImage && __TURBOPACK__imported__module__271645__["default"].createElement("picture", { 510 className: pictureClassName, 511 style: pictureStyle 512 }, webpSource, regularSource, data.src && // biome-ignore lint/a11y/useAltText: We do support the `alt` attribute 513 __TURBOPACK__imported__module__271645__["default"].createElement("img", Object.assign({ 514 ref: imageRef, 515 src: data.src, 516 alt: (_c = data.alt) !== null && _c !== void 0 ? _c : '', 517 title: (_d = data.title) !== null && _d !== void 0 ? _d : undefined, 518 onLoad: handleLoad, 519 sizes: resolvedSizes, 520 loading: priority ? undefined : 'lazy' 521 }, priorityProp(priority ? 'high' : undefined), { 522 className: imgClassName, 523 style: Object.assign(Object.assign(Object.assign({ 524 opacity: showImage ? 1 : 0, 525 transition 526 }, absolutePositioning), { 527 objectFit, 528 objectPosition 529 }), imgStyle), 530 referrerPolicy: referrerPolicy 531 }))), __TURBOPACK__imported__module__271645__["default"].createElement("noscript", null, __TURBOPACK__imported__module__271645__["default"].createElement("picture", { 532 className: pictureClassName, 533 style: pictureStyle 534 }, webpSource, regularSource, data.src && // biome-ignore lint/a11y/useAltText: We do support the `alt` attribute 535 __TURBOPACK__imported__module__271645__["default"].createElement("img", Object.assign({ 536 src: data.src, 537 alt: (_e = data.alt) !== null && _e !== void 0 ? _e : '', 538 title: (_f = data.title) !== null && _f !== void 0 ? _f : undefined, 539 className: imgClassName, 540 style: Object.assign(Object.assign(Object.assign({}, absolutePositioning), { 541 objectFit, 542 objectPosition 543 }), imgStyle), 544 loading: priority ? undefined : 'lazy' 545 }, priorityProp(priority ? 'high' : undefined), { 546 referrerPolicy: referrerPolicy 547 }))))); 548}); 549__turbopack_context__.s([ 550 "Image", 551 0, 552 Image 553], 673836); 554}), 555722678, 942803, 556((__turbopack_context__) => { 557"use strict"; 558 559// MERGED MODULE: [project]/node_modules/@headlessui/react/dist/components/label/label.js [a
559pp-client] (ecmascript) 560; 561var __TURBOPACK__imported__module__271645__ = __turbopack_context__.i(271645); 562var __TURBOPACK__imported__module__914189__ = __turbopack_context__.i(914189); 563var __TURBOPACK__imported__module__835696__ = __turbopack_context__.i(835696); 564var __TURBOPACK__imported__module__255743__ = __turbopack_context__.i(255743); 565var __TURBOPACK__imported__module__294316__ = __turbopack_context__.i(294316); 566var __TURBOPACK__imported__module__601893__ = __turbopack_context__.i(601893); 567// MERGED MODULE: [project]/node_modules/@headlessui/react/dist/internal/id.js [app-client] (ecmascript) 568; 569var __TURBOPACK__imported__module__271645__1 = __TURBOPACK__imported__module__271645__; 570; 571let e = /*#__PURE__*/ (0, __TURBOPACK__imported__module__271645__1["createContext"])(void 0); 572function u() { 573 return (0, __TURBOPACK__imported__module__271645__1["useContext"])(e); 574} 575function f(param) { 576 let { id: t, children: r } = param; 577 return /*#__PURE__*/ __TURBOPACK__imported__module__271645__1["default"].createElement(e.Provider, { 578 value: t 579 }, r); 580} 581; 582__turbopack_context__.s([ 583 "IdProvider", 584 0, 585 f, 586 "useProvidedId", 587 0, 588 u 589], 942803); 590var __TURBOPACK__imported__module__813581__ = __turbopack_context__.i(813581); 591var __TURBOPACK__imported__module__700020__ = __turbopack_context__.i(700020); 592"use client"; 593; 594; 595; 596; 597; 598; 599; 600; 601; 602; 603let L = /*#__PURE__*/ (0, __TURBOPACK__imported__module__271645__["createContext"])(null); 604L.displayName = "LabelContext"; 605function C() { 606 let n = (0, __TURBOPACK__imported__module__271645__["useContext"])(L); 607 if (n === null) { 608 let l = new Error("You used a <Label /> component, but it is not inside a relevant parent."); 609 throw Error.captureStackTrace && Error.captureStackTrace(l, C), l; 610 } 611 return n; 612} 613function N(n) { 614 var a, e, o; 615 let l = (e = (a = (0, __TURBOPACK__imported__module__271645__["useContext"])(L)) == null ? void 0 : a.value) != null ? e : void 0; 616 return ((o = n == null ? void 0 : n.length) != null ? o : 0) > 0 ? [ 617 l, 618 ...n 619 ].filter(Boolean).join(" ") : l; 620} 621function V() { 622 let { inherit: n = !1 } = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}; 623 let l = N(), [a, e] = (0, __TURBOPACK__imported__module__271645__["useState"])([]), o = n ? [ 624 l, 625 ...a 626 ].filter(Boolean) : a; 627 return [ 628 o.length > 0 ? o.join(" ") : void 0, 629 (0, __TURBOPACK__imported__module__271645__["useMemo"])(()=>function(t) { 630 let p = (0, __TURBOPACK__imported__module__914189__["useEvent"])((i)=>(e((u)=>[ 631 ...u, 632 i 633 ]), ()=>e((u)=>{ 634 let d = u.slice(), f = d.indexOf(i); 635 return f !== -1 && d.splice(f, 1), d; 636 }))), b = (0, __TURBOPACK__imported__module__271645__["useMemo"])(()=>({ 637 register: p, 638 slot: t.slot, 639 name: t.name, 640 props: t.props, 641 value: t.value 642 }), [ 643 p, 644 t.slot, 645 t.name, 646 t.props, 647 t.value 648 ]); 649 return /*#__PURE__*/ __TURBOPACK__imported__module__271645__["default"].createElement(L.Provider, { 650 value: b 651 }, t.children); 652 }, [ 653 e 654 ]) 655 ]; 656} 657let G = "label"; 658function U(n, l) { 659 var y; 660 let a = (0, __TURBOPACK__imported__module__271645__["useId"])(), e = C(), o = u(), T = (0, __TURBOPACK__imported__module__601893__["useDisabled"])(), { id: t = "headlessui-label-".concat(a), htmlFor: p = o != null ? o : (y = e.props) == null ? void 0 : y.htmlFor, passive: b = !1, ...i } = n, u1 = (0, __TURBOPACK__imported__module__294316__["useSyncRefs"])(l); 661 (0, __TURBOPACK__imported__module__835696__["useIsoMorphicEffect"])(()=>e.register(t), [ 662 t, 663 e.register 664 ]); 665 let d = (0, __TURBOPACK__imported__module__914189__["useEvent"])((s)=>{ 666 let g = s.currentTarget; 667 if (!(s.target !== s.currentTarget && __TURBOPACK__imported__module__813581__["isInteractiveElement"](s.target)) && (__TURBOPACK__imported__module__813581__["isHTMLLabelElement"](g) && s.preventDefault(), e.props && "onClick" in e.props && typeof e.props.onClick == "function" && e.props.onClick(s), __TURBOPACK__imported__module__813581__["isHTMLLabelElement"](g))) { 668 let r = document.getElementById(g.htmlFor); 669 if (r) { 670 let E = r.getAttribute("disabled"); 671 if (E === "true" || E === "") return; 672 let x = r.getAttribute("aria-disabled"); 673 if (x === "true" || x === "") return; 674 (__TURBOPACK__imported__module__813581__["isHTMLInputElement"](r) && (r.type === "file" || r.type === "radio" || r.type === "checkbox") || r.role === "radio" || r.role === "checkbox" || r.role === "switch") && r.click(), r.focus({ 675 preventScroll: !0 676 }); 677 } 678 } 679 }), f = (0, __TURBOPACK__imported__module__255743__["useSlot"])({ 680 ...e.slot, 681 disabled: T || !1 682 }), c = { 683 ref: u1, 684 ...e.props, 685 id: t, 686 htmlFor: p, 687 onClick: d 688 }; 689 return b && ("onClick" in c && (delete c.htmlFor, delete c.onClick), "onClick" in i && delete i.onClick), (0, __TURBOPACK__imported__module__700020__["useRender"])()({ 690 ourProps: c, 691 theirProps: i, 692 slot: f, 693 defaultTag: p ? G : "div", 694 name: e.name || "Label" 695 }); 696} 697let j = (0, __TURBOPACK__imported__module__700020__["forwardRefWithAs"])(U), Z = Object.assign(j, {}); 698; 699__turbopack_context__.s([ 700 "Label", 701 0, 702 Z, 703 "useLabelContext", 704 0, 705 C, 706 "useLabelledBy", 707 0, 708 N, 709 "useLabels", 710 0, 711 V 712], 722678); 713}), 714233538, ((__turbopack_context__) => { 715"use strict"; 716 717var __TURBOPACK__imported__module__813581__ = __turbopack_context__.i(813581); 718; 719function s(l) { 720 let e = l.parentElement, t = null; 721 for(; e && !__TURBOPACK__imported__module__813581__["isHTMLFieldSetElement"](e);)__TURBOPACK__imported__module__813581__["isHTMLLegendElement"](e) && (t = e), e = e.parentElement; 722 let i = (e == null ? void 0 : e.getAttribute("disabled")) === ""; 723 return i && r(t) ? !1 : i; 724} 725function r(l) { 726 if (!l) return !1; 727 let e = l.previousElementSibling; 728 for(; e !== null;){ 729 if (__TURBOPACK__imported__module__813581__["isHTMLLegendElement"](e)) return !1; 730 e = e.previousElementSibling; 731 } 732 return !0; 733} 734; 735__turbopack_context__.s([ 736 "isDisabledReactIssue7711", 737 0, 738 s 739]); 740}), 741340143, ((__turbopack_context__) => { 742"use strict"; 743 744var __TURBOPACK__imported__module__271645__ = __turbopack_context__.i(271645); 745var __TURBOPACK__imported__module__402155__ = __turbopack_context__.i(402155); 746var __TURBOPACK__imported__module__835696__ = __turbopack_context__.i(835696); 747; 748; 749; 750function F(c, param) { 751 let { container: e, accept: t, walk: r } = param; 752 let o = (0, __TURBOPACK__imported__module__271645__["useRef"])(t), l = (0, __TURBOPACK__imported__module__271645__["useRef"])(r); 753 (0, __TURBOPACK__imported__module__271645__["useEffect"])(()=>{ 754 o.current = t, l.current = r; 755 }, [ 756 t, 757 r 758 ]), (0, __TURBOPACK__imported__module__835696__["useIsoMorphicEffect"])(()=>{ 759 if (!e || !c) return; 760 let n = (0, __TURBOPACK__imported__module__402155__["getOwnerDocument"])(e); 761 if (!n) return; 762 let f = o.current, p = l.current, i = Object.assign((m)=>f(m), { 763 acceptNode: f 764 }), u = n.createTreeWalker(e, NodeFilter.SHOW_ELEMENT, i, !1); 765 for(; u.nextNode();)p(u.currentNode); 766 }, [ 767 e, 768 c, 769 o, 770 l 771 ]); 772} 773; 774__turbopack_context__.s([ 775 "useTreeWalker", 776 0, 777 F 778]); 779}), 780992704, 919751, 781((__turbopack_context__) => { 782"use strict"; 783 784// MERGED MODULE: [project]/node_modules/@headlessui/react/dist/hooks/use-element-size.js [a
784pp-client] (ecmascript) 785; 786var __TURBOPACK__imported__module__271645__ = __turbopack_context__.i(271645); 787var __TURBOPACK__imported__module__544508__ = __turbopack_context__.i(544508); 788var __TURBOPACK__imported__module__835696__ = __turbopack_context__.i(835696); 789; 790; 791; 792function h(i) { 793 if (i === null) return { 794 width: 0, 795 height: 0 796 }; 797 let { width: t, height: e } = i.getBoundingClientRect(); 798 return { 799 width: t, 800 height: e 801 }; 802} 803function w(i, t) { 804 let e = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : !1; 805 let [r, f] = (0, __TURBOPACK__imported__module__271645__["useState"])(()=>h(t)); 806 return (0, __TURBOPACK__imported__module__835696__["useIsoMorphicEffect"])(()=>{ 807 if (!t || !i) return; 808 let n = (0, __TURBOPACK__imported__module__544508__["disposables"])(); 809 return n.requestAnimationFrame(function s() { 810 n.requestAnimationFrame(s), f((u)=>{ 811 let o = h(t); 812 return o.width === u.width && o.height === u.height ? u : o; 813 }); 814 }), ()=>{ 815 n.dispose(); 816 }; 817 }, [ 818 t, 819 i 820 ]), e ? { 821 width: "".concat(r.width, "px"), 822 height: "".concat(r.height, "px") 823 } : r; 824} 825; 826__turbopack_context__.s([ 827 "useElementSize", 828 0, 829 w 830], 992704); 831// MERGED MODULE: [project]/node_modules/@headlessui/react/dist/internal/floating.js [app-client] (ecmascript) 832; 833var __TURBOPACK__imported__module__953760__ = __turbopack_context__.i(953760); 834var __TURBOPACK__imported__module__258950__ = __turbopack_context__.i(258950); 835// MERGED MODULE: [project]/node_modules/@floating-ui/react/dist/floating-ui.react.mjs [app-client] (ecmascript) <locals> 836; 837var __TURBOPACK__imported__module__247167__ = __turbopack_context__.i(247167); 838var __TURBOPACK__imported__module__271645__1 = __TURBOPACK__imported__module__271645__; 839// MERGED MODULE: [project]/node_modules/@floating-ui/react/dist/floating-ui.react.utils.mjs [app-client] (ecmascript) 840; 841var __TURBOPACK__imported__module__229315__ = __turbopack_context__.i(229315); 842; 843function activeElement(doc) { 844 let activeElement = doc.activeElement; 845 while(((_activeElement = activeElement) == null || (_activeElement = _activeElement.shadowRoot) == null ? void 0 : _activeElement.activeElement) != null){ 846 var _activeElement; 847 activeElement = activeElement.shadowRoot.activeElement; 848 } 849 return activeElement; 850} 851function contains(parent, child) { 852 if (!parent || !child) { 853 return false; 854 } 855 const rootNode = child.getRootNode == null ? void 0 : child.getRootNode(); 856 // First, attempt with faster native method 857 if (parent.contains(child)) { 858 return true; 859 } 860 // then fallback to custom implementation with Shadow DOM support 861 if (rootNode && (0, __TURBOPACK__imported__module__229315__["isShadowRoot"])(rootNode)) { 862 let next = child; 863 while(next){ 864 if (parent === next) { 865 return true; 866 } 867 // @ts-ignore 868 next = next.parentNode || next.host; 869 } 870 } 871 // Give up, the result is false 872 return false; 873} 874// Avoid Chrome DevTools blue warning. 875function getPlatform() { 876 const uaData = navigator.userAgentData; 877 if (uaData != null && uaData.platform) { 878 return uaData.platform; 879 } 880 return navigator.platform; 881} 882function getUserAgent() { 883 const uaData = navigator.userAgentData; 884 if (uaData && Array.isArray(uaData.brands)) { 885 return uaData.brands.map((_ref)=>{ 886 let { brand, version } = _ref; 887 return brand + "/" + version; 888 }).join(' '); 889 } 890 return navigator.userAgent; 891} 892// License: https://github.com/adobe/react-spectrum/blob/b35d5c02fe900badccd0cf1a8f23bb593419f238/packages/@react-aria/utils/src/isVirtualEvent.ts 893function isVirtualClick(event) { 894 // FIXME: Firefox is now emitting a deprecation warning for `mozInputSource`. 895 // Try to find a workaround for this. `react-aria` source still has the check. 896 if (event.mozInputSource === 0 && event.isTrusted) { 897 return true; 898 } 899 if (isAndroid() && event.pointerType) { 900 return event.type === 'click' && event.buttons === 1; 901 } 902 return event.detail === 0 && !event.pointerType; 903} 904function isVirtualPointerEvent(event) { 905 if (isJSDOM()) return false;
906 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. 907 event.width < 1 && event.height < 1 && event.pressure === 0 && event.detail === 0 && event.pointerType === 'touch'; 908} 909function isSafari() { 910 // Chrome DevTools does not complain about navigator.vendor 911 return /apple/i.test(navigator.vendor); 912} 913function isAndroid() { 914 const re = /android/i; 915 return re.test(getPlatform()) || re.test(getUserAgent()); 916} 917function isMac() { 918 return getPlatform().toLowerCase().startsWith('mac') && !navigator.maxTouchPoints; 919} 920function isJSDOM() { 921 return getUserAgent().includes('jsdom/'); 922} 923function isMouseLikePointerType(pointerType, strict) { 924 // On some Linux machines with Chromium, mouse inputs return a `pointerType` 925 // of "pen": https://github.com/floating-ui/floating-ui/issues/2015 926 const values = [ 927 'mouse', 928 'pen' 929 ]; 930 if (!strict) { 931 values.push('', undefined); 932 } 933 return values.includes(pointerType); 934} 935function isReactEvent(event) { 936 return 'nativeEvent' in event; 937} 938function isRootElement(element) { 939 return element.matches('html,body'); 940} 941function getDocument(node) { 942 return (node == null ? void 0 : node.ownerDocument) || document; 943} 944function isEventTargetWithin(event, node) { 945 if (node == null) { 946 return false; 947 } 948 if ('composedPath' in event) { 949 return event.composedPath().includes(node); 950 } 951 // TS thinks `event` is of type never as it assumes all browsers support composedPath, but browsers without shadow dom don't 952 const e = event; 953 return e.target != null && node.contains(e.target); 954} 955function getTarget(event) {
956 if ('composedPath' in event) { 957 return event.composedPath()[0]; 958 } 959 // TS thinks `event` is of type never as it assumes all browsers support 960 // `composedPath()`, but browsers without shadow DOM don't. 961 return event.target; 962} 963const TYPEABLE_SELECTOR = "input:not([type='hidden']):not([disabled])," + "[contenteditable]:not([contenteditable='false']),textarea:not([disabled])"; 964function isTypeableElement(element) { 965 return (0, __TURBOPACK__imported__module__229315__["isHTMLElement"])(element) && element.matches(TYPEABLE_SELECTOR); 966} 967function stopEvent(event) { 968 event.preventDefault(); 969 event.stopPropagation(); 970} 971function isTypeableCombobox(element) { 972 if (!element) return false; 973 return element.getAttribute('role') === 'combobox' && isTypeableElement(element); 974} 975; 976var __TURBOPACK__imported__module__343084__ = __turbopack_context__.i(343084); 977var __TURBOPACK__imported__module__229315__1 = __TURBOPACK__imported__module__229315__; 978var __TURBOPACK__imported__module__397126__ = __turbopack_context__.i(397126); 979var __TURBOPACK__imported__module__174080__ = __turbopack_context__.i(174080); 980var __TURBOPACK__imported__module__258950__1 = __TURBOPACK__imported__module__258950__; 981var __TURBOPACK__imported__module__953760__1 = __TURBOPACK__imported__module__953760__; 982; 983; 984; 985; 986; 987; 988; 989; 990; 991/** 992 * Merges an array of refs into a single memoized callback ref or `null`. 993 * @see https://floating-ui.com/docs/react-utils#usemergerefs 994 */ function useMergeRefs(refs) { 995 return __TURBOPACK__imported__module__271645__1.useMemo(()=>{ 996 if (refs.every((ref)=>ref == null)) { 997 return null; 998 } 999 return (value)=>{ 1000 refs.forEach((ref)=>{ 1001 if (typeof ref === 'function') { 1002 ref(value); 1003 } else if (ref != null) { 1004 ref.current = value; 1005 } 1006 }); 1007 }; 1008 // eslint-disable-next-line react-hooks/exhaustive-deps 1009 }, refs); 1010} 1011// https://github.com/mui/material-ui/issues/41190#issuecomment-2040873379 1012const SafeReact = { 1013 ...__TURBOPACK__imported__module__271645__1 1014}; 1015const useInsertionEffect = SafeReact.useInsertionEffect; 1016const useSafeInsertionEffect = useInsertionEffect || ((fn)=>fn()); 1017function useEffectEvent(callback) { 1018 const ref = __TURBOPACK__imported__module__271645__1.useRef(()=>{ 1019 if ("TURBOPACK compile-time falsy", 0) //TURBOPACK unreachable 1020 ; 1021 }); 1022 useSafeInsertionEffect(()=>{ 1023 ref.current = callback; 1024 }); 1025 return __TURBOPACK__imported__module__271645__1.useCallback(function() { 1026 for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){ 1027 args[_key] = arguments[_key]; 1028 } 1029 return ref.current == null ? void 0 : ref.current(...args); 1030 }, []); 1031} 1032const ARROW_UP = 'ArrowUp'; 1033const ARROW_DOWN = 'ArrowDown'; 1034const ARROW_LEFT = 'ArrowLeft'; 1035const ARROW_RIGHT = 'ArrowRight'; 1036function isDifferentRow(index, cols, prevRow) { 1037 return Math.floor(index / cols) !== prevRow; 1038} 1039function isIndexOutOfBounds(listRef, index) { 1040 return index < 0 || index >= listRef.current.length; 1041} 1042function getMinIndex(listRef, disabledIndices) { 1043 return findNonDisabledIndex(listRef, { 1044 disabledIndices 1045 }); 1046} 1047function getMaxIndex(listRef, disabledIndices) { 1048 return findNonDisabledIndex(listRef, { 1049 decrement: true, 1050 startingIndex: listRef.current.length, 1051 disabledIndices 1052 }); 1053} 1054function findNonDisabledIndex(listRef, _temp) { 1055 let { startingIndex = -1, decrement = false, disabledIndices, amount = 1 } = _temp === void 0 ? {} : _temp; 1056 const list = listRef.current; 1057 let index = startingIndex; 1058 do { 1059 index += decrement ? -amount : amount; 1060 }while (index >= 0 && index <= list.length - 1 && isDisabled(list, index, disabledIndices)) 1061 return index; 1062} 1063function getGridNavigatedIndex(elementsRef, _ref) { 1064 let { event, orientation, loop, rtl, cols, disabledIndices, minIndex, maxIndex, prevIndex, stopEvent: stop = false } = _ref; 1065 let nextIndex = prevIndex; 1066 if (event.key === ARROW_UP) { 1067 stop && stopEvent(event); 1068 if (prevIndex === -1) { 1069 nextIndex = maxIndex; 1070 } else { 1071 nextIndex = findNonDisabledIndex(elementsRef, { 1072 startingIndex: nextIndex, 1073 amount: cols, 1074 decrement: true, 1075 disabledIndices 1076 }); 1077 if (loop && (prevIndex - cols < minIndex || nextIndex < 0)) { 1078 const col = prevIndex % cols; 1079 const maxCol = maxIndex % cols; 1080 const offset = maxIndex - (maxCol - col); 1081 if (maxCol === col) { 1082 nextIndex = maxIndex; 1083 } else { 1084 nextIndex = maxCol > col ? offset : offset - cols; 1085 } 1086 } 1087 } 1088 if (isIndexOutOfBounds(elementsRef, nextIndex)) { 1089 nextIndex = prevIndex; 1090 } 1091 } 1092 if (event.key === ARROW_DOWN) { 1093 stop && stopEvent(event); 1094 if (prevIndex === -1) { 1095 nextIndex = minIndex; 1096 } else { 1097 nextIndex = findNonDisabledIndex(elementsRef, { 1098 startingIndex: prevIndex, 1099 amount: cols, 1100 disabledIndices 1101 }); 1102 if (loop && prevIndex + cols > maxIndex) { 1103 nextIndex = findNonDisabledIndex(elementsRef, { 1104 startingIndex: prevIndex % cols - cols, 1105 amount: cols, 1106 disabledIndices 1107 }); 1108 } 1109 } 1110 if (isIndexOutOfBounds(elementsRef, nextIndex)) { 1111 nextIndex = prevIndex; 1112 } 1113 } 1114 // Remains on the same row/column. 1115 if (orientation === 'both') { 1116 const prevRow = (0, __TURBOPACK__imported__module__343084__["floor"])(prevIndex / cols
1116); 1117 if (event.key === (rtl ? ARROW_LEFT : ARROW_RIGHT)) { 1118 stop && stopEvent(event); 1119 if (prevIndex % cols !== cols - 1) { 1120 nextIndex = findNonDisabledIndex(elementsRef, { 1121 startingIndex: prevIndex, 1122 disabledIndices 1123 }); 1124 if (loop && isDifferentRow(nextIndex, cols, prevRow)) { 1125 nextIndex = findNonDisabledIndex(elementsRef, { 1126 startingIndex: prevIndex - prevIndex % cols - 1, 1127 disabledIndices 1128 }); 1129 } 1130 } else if (loop) { 1131 nextIndex = findNonDisabledIndex(elementsRef, { 1132 startingIndex: prevIndex - prevIndex % cols - 1, 1133 disabledIndices 1134 }); 1135 } 1136 if (isDifferentRow(nextIndex, cols, prevRow)) { 1137 nextIndex = prevIndex; 1138 } 1139 } 1140 if (event.key === (rtl ? ARROW_RIGHT : ARROW_LEFT)) { 1141 stop && stopEvent(event); 1142 if (prevIndex % cols !== 0) { 1143 nextIndex = findNonDisabledIndex(elementsRef, { 1144 startingIndex: prevIndex, 1145 decrement: true, 1146 disabledIndices 1147 }); 1148 if (loop && isDifferentRow(nextIndex, cols, prevRow)) { 1149 nextIndex = findNonDisabledIndex(elementsRef, { 1150 startingIndex: prevIndex + (cols - prevIndex % cols), 1151 decrement: true, 1152 disabledIndices 1153 }); 1154 } 1155 } else if (loop) { 1156 nextIndex = findNonDisabledIndex(elementsRef, { 1157 startingIndex: prevIndex + (cols - prevIndex % cols), 1158 decrement: true, 1159 disabledIndices 1160 }); 1161 } 1162 if (isDifferentRow(nextIndex, cols, prevRow)) { 1163 nextIndex = prevIndex; 1164 } 1165 } 1166 const lastRow = (0, __TURBOPACK__imported__module__343084__["floor"])(maxIndex / cols) === prevRow; 1167 if (isIndexOutOfBounds(elementsRef, nextIndex)) { 1168 if (loop && lastRow) { 1169 nextIndex = event.key === (rtl ? ARROW_RIGHT : ARROW_LEFT) ? maxIndex : findNonDisabledIndex(elementsRef, { 1170 startingIndex: prevIndex - prevIndex % cols - 1, 1171 disabledIndices 1172 }); 1173 } else { 1174 nextIndex = prevIndex; 1175 } 1176 } 1177 } 1178 return nextIndex; 1179} 1180/** For each cell index, gets the item index that occupies that cell */ function buildCellMap(sizes, cols, dense) { 1181 const cellMap = []; 1182 let startIndex = 0;
1183 sizes.forEach((_ref2, index)=>{ 1184 let { width, height } = _ref2; 1185 if (width > cols) { 1186 if ("TURBOPACK compile-time falsy", 0) //TURBOPACK unreachable 1187 ; 1188 } 1189 let itemPlaced = false; 1190 if (dense) { 1191 startIndex = 0; 1192 } 1193 while(!itemPlaced){ 1194 const targetCells = []; 1195 for(let i = 0; i < width; i++){ 1196 for(let j = 0; j < height; j++){ 1197 targetCells.push(startIndex + i + j * cols); 1198 } 1199 } 1200 if (startIndex % cols + width <= cols && targetCells.every((cell)=>cellMap[cell] == null)) { 1201 targetCells.forEach((cell)=>{ 1202 cellMap[cell] = index; 1203 }); 1204 itemPlaced = true; 1205 } else { 1206 startIndex++; 1207 } 1208 } 1209 }); 1210 // convert into a non-sparse array 1211 return [ 1212 ...cellMap 1213 ]; 1214} 1215/** Gets cell index of an item's corner or -1 when index is -1. */ function getCellIndexOfCorner(index, sizes, cellMap, cols, corner) { 1216 if (index === -1) return -1; 1217 const firstCellIndex = cellMap.indexOf(index); 1218 const sizeItem = sizes[index]; 1219 switch(corner){ 1220 case 'tl': 1221 return firstCellIndex; 1222 case 'tr': 1223 if (!sizeItem) { 1224 return firstCellIndex; 1225 } 1226 return firstCellIndex + sizeItem.width - 1; 1227 case 'bl': 1228 if (!sizeItem) { 1229 return firstCellIndex; 1230 } 1231 return firstCellIndex + (sizeItem.height - 1) * cols; 1232 case 'br': 1233 return cellMap.lastIndexOf(index); 1234 } 1235} 1236/** Gets all cell indices that correspond to the specified indices */ function getCellIndices(indices, cellMap) { 1237 return cellMap.flatMap((index, cellIndex)=>indices.includes(index) ? [ 1238 cellIndex 1239 ] : []); 1240} 1241function isDisabled(list, index, disabledIndices) { 1242 if (disabledIndices) { 1243 return disabledIndices.includes(index); 1244 } 1245 const element = list[index]; 1246 return element == null || element.hasAttribute('disabled') || element.getAttribute('aria-disabled') === 'true'; 1247} 1248var index = typeof document !== 'undefined' ? __TURBOPACK__imported__module__271645__1["useLayoutEffect"] : __TURBOPACK__imported__module__271645__1["useEffect"]; 1249function sortByDocumentPosition(a, b) { 1250 const position = a.compareDocumentPosition(b); 1251 if (position & Node.DOCUMENT_POSITION_FOLLOWING || position & Node.DOCUMENT_POSITION_CONTAINED_BY) { 1252 return -1; 1253 } 1254 if (position & Node.DOCUMENT_POSITION_PRECEDING || position & Node.DOCUMENT_POSITION_CONTAINS) { 1255 return 1; 1256 } 1257 return 0; 1258} 1259function areMapsEqual(map1, map2) { 1260 if (map1.size !== map2.size) { 1261 return false; 1262 } 1263 for (const [key, value] of map1.entries()){ 1264 if (value !== map2.get(key)) { 1265 return false; 1266 } 1267 } 1268 return true; 1269} 1270const FloatingListContext = /*#__PURE__*/ __TURBOPACK__imported__module__271645__1.createContext({ 1271 register: ()=>{}, 1272 unregister: ()=>{}, 1273 map: /*#__PURE__*/ new Map(), 1274 elementsRef: { 1275 current: [] 1276 } 1277}); 1278/** 1279 * Provides context for a list of items within the floating element. 1280 * @see https://floating-ui.com/docs/FloatingList 1281 */ function FloatingList(props) { 1282 const { children, elementsRef, labelsRef } = props; 1283 const [map, setMap] = __TURBOPACK__imported__module__271645__1.useState(()=>new Map()); 1284 const register = __TURBOPACK__imported__module__271645__1.useCallback((node)=>{ 1285 setMap((prevMap)=>new Map(prevMap).set(node, null)); 1286 }, []); 1287 const unregister = __TURBOPACK__imported__module__271645__1.useCallback((node)=>{ 1288 setMap((prevMap)=>{ 1289 const map = new Map(prevMap); 1290 map.delete(node); 1291 return map; 1292 }); 1293 }, []); 1294 index(()=>{ 1295 const newMap = new Map(map); 1296 const nodes = Array.from(newMap.keys()).sort(sortByDocumentPosition); 1297 nodes.forEach((node, index)=>{ 1298 newMap.set(node, index); 1299 }); 1300 if (!areMapsEqual(map, newMap)) { 1301 setMap(newMap); 1302 } 1303 }, [ 1304 map 1305 ]); 1306 return /*#__PURE__*/ __TURBOPACK__imported__module__271645__1.createElement(FloatingListContext.Provider, { 1307 value: __TURBOPACK__imported__module__271645__1.useMemo(()=>({ 1308 register, 1309 unregister, 1310 map, 1311 elementsRef, 1312 labelsRef 1313 }), [ 1314 register, 1315 unregister, 1316 map, 1317 elementsRef, 1318 labelsRef 1319 ]) 1320 }, children); 1321} 1322/** 1323 * Used to register a list item and its index (DOM position) in the 1324 * `FloatingList`. 1325 * @see https://floating-ui.com/docs/FloatingList#uselistitem 1326 */ function useListItem(props) { 1327 if (props === void 0) { 1328 props = {}; 1329 } 1330 const { label } = props; 1331 const { register, unregister, map, elementsRef, labelsRef } = __TURBOPACK__imported__module__271645__1.useContext(FloatingListContext); 1332 const [index$1, setIndex] = __TURBOPACK__imported__module__271645__1.useState(null); 1333 const componentRef = __TURBOPACK__imported__module__271645__1.useRef(null); 1334 const ref = __TURBOPACK__imported__module__271645__1.useCallback((node)=>{ 1335 componentRef.current = node; 1336 if (index$1 !== null) { 1337 elementsRef.current[index$1] = node; 1338 if (labelsRef) { 1339 var _node$textContent; 1340 const isLabelDefined = label !== undefined; 1341 labelsRef.current[index$1] = isLabelDefined ? label : (_node$textContent = node == null ? void 0 : node.textContent) != null ? _node$textContent : null; 1342 } 1343 } 1344 }, [ 1345 index$1, 1346 elementsRef, 1347 labelsRef, 1348 label 1349 ]); 1350 index(()=>{ 1351 const node = componentRef.current; 1352 if (node) { 1353 register(node); 1354 return ()=>{ 1355 unregister(node); 1356 }; 1357 } 1358 }, [ 1359 register, 1360 unregister 1361 ]); 1362 index(()=>{ 1363 const index = componentRef.current ? map.get(componentRef.current) : null; 1364 if (index != null) { 1365 setIndex(index); 1366 } 1367 }, [ 1368 map 1369 ]); 1370 return __TURBOPACK__imported__module__271645__1.useMemo(()=>({ 1371 ref, 1372 index: index$1 == null ? -1 : index$1 1373 }), [ 1374 index$1, 1375 ref 1376 ]); 1377} 1378function renderJsx(render, computedProps) { 1379 if (typeof render === 'function') { 1380 return render(computedProps); 1381 } 1382 if (render) { 1383 return /*#__PURE__*/ __TURBOPACK__imported__module__271645__1.cloneElement(render, computedProps); 1384 } 1385 return /*#__PURE__*/ __TURBOPACK__imported__module__271645__1.createElement("div", computedProps); 1386} 1387const CompositeContext = /*#__PURE__*/ __TURBOPACK__imported__module__271645__1.createContext({ 1388 activeIndex: 0, 1389 onNavigate: ()=>{} 1390}); 1391const horizontalKeys = [ 1392 ARROW_LEFT, 1393 ARROW_RIGHT 1394]; 1395const verticalKeys = [ 1396 ARROW_UP, 1397 ARROW_DOWN 1398]; 1399const allKeys = [ 1400 ...horizontalKeys, 1401 ...verticalKeys 1402]; 1403/** 1404 * Creates a single tab stop whose items are navigated by arrow keys, which 1405 * provides list navigation outside of floating element contexts. 1406 * 1407 * This is useful to enable navigation of a list of items that arenât part of a 1408 * floating element. A menubar is an example of a composite, with each reference 1409 * element being an item. 1410 * @see https://floating-ui.com/docs/Composite 1411 */ const Composite = /*#__PURE__*/ __TURBOPACK__imported__module__271645__1.forwardRef(function Composite(props, forwardedRef) { 1412 const { render, orientation = 'both', loop = true, rtl = false, cols = 1, disabledIndices, activeIndex: externalActiveIndex, onNavigate: externalSetActiveIndex, itemSizes, dense = false, ...domProps } = props; 1413 const [internalActiveIndex, internalSetActiveIndex] = __TURBOPACK__imported__module__271645__1.useState(0); 1414 const activeIndex = externalActiveIndex != null ? externalActiveIndex : internalActiveIndex; 1415 const onNavigate = useEffectEvent(externalSetActiveIndex != null ? externalSetActiveIndex : internalSetActiveIndex); 1416 const elementsRef = __TURBOPACK__imported__module__271645__1.useRef([]); 1417 const renderElementProps = render && typeof render !== 'function' ? render.props : {}; 1418 const contextValue = __TURBOPACK__imported__module__271645__1.useMemo(()=>({ 1419 activeIndex, 1420 onNavigate 1421 }), [ 1422 activeIndex, 1423 onNavigate 1424 ]); 1425 const isGrid = cols > 1; 1426 function handleKeyDown(event) { 1427 if (!allKeys.includes(event.key)) return; 1428 let nextIndex = activeIndex; 1429 const minIndex = getMinIndex(elementsRef, disabledIndices); 1430 const maxIndex = getMaxIndex(elementsRef, disabledIndices); 1431 const horizontalEndKey = rtl ? ARROW_LEFT : ARROW_RIGHT; 1432 const horizontalStartKey = rtl ? ARROW_RIGHT : ARROW_LEFT; 1433 if (isGrid) { 1434 const sizes = itemSizes || Array.from({ 1435 length: elementsRef.current.length 1436 }, ()=>({ 1437 width: 1, 1438 height: 1 1439 })); 1440 // To calculate movements on the grid, we use hypothetical cell indices
1441 // as if every item was 1x1, then convert back to real indices. 1442 const cellMap = buildCellMap(sizes, cols, dense); 1443 const minGridIndex = cellMap.findIndex((index)=>index != null && !isDisabled(elementsRef.current, index, disabledIndices)); 1444 // last enabled index 1445 const maxGridIndex = cellMap.reduce((foundIndex, index, cellIndex)=>index != null && !isDisabled(elementsRef.current, index, disabledIndices) ? cellIndex : foundIndex, -1); 1446 const maybeNextIndex = cellMap[getGridNavigatedIndex({ 1447 current: cellMap.map((itemIndex)=>itemIndex ? elementsRef.current[itemIndex] : null) 1448 }, { 1449 event, 1450 orientation, 1451 loop, 1452 rtl, 1453 cols, 1454 // treat undefined (empty grid spaces) as disabled indices so we 1455 // don't end up in them 1456 disabledIndices: getCellIndices([ 1457 ...disabledIndices || elementsRef.current.map((_, index)=>isDisabled(elementsRef.current, index) ? index : undefined), 1458 undefined 1459 ], cellMap), 1460 minIndex: minGridIndex, 1461 maxIndex: maxGridIndex, 1462 prevIndex: getCellIndexOfCorner(activeIndex > maxIndex ? minIndex : activeIndex, sizes, cellMap, cols, // use a corner matching the edge closest to the direction we're 1463 // moving in so we don't end up in the same item. Prefer 1464 // top/left over bottom/right. 1465 event.key === ARROW_DOWN ? 'bl' : event.key === horizontalEndKey ? 'tr' : 'tl') 1466 })]; 1467 if (maybeNextIndex != null) { 1468 nextIndex = maybeNextIndex; 1469 } 1470 } 1471 const toEndKeys = { 1472 horizontal: [ 1473 horizontalEndKey 1474 ], 1475 vertical: [ 1476 ARROW_DOWN 1477 ], 1478 both: [ 1479 horizontalEndKey, 1480 ARROW_DOWN 1481 ] 1482 }[orientation]; 1483 const toStartKeys = { 1484 horizontal: [ 1485 horizontalStartKey 1486 ], 1487 vertical: [ 1488 ARROW_UP 1489 ], 1490 both: [ 1491 horizontalStartKey, 1492 ARROW_UP 1493 ] 1494 }[orientation]; 1495 const preventedKeys = isGrid ? allKeys : ({ 1496 horizontal: horizontalKeys, 1497 vertical: verticalKeys, 1498 both: allKeys 1499 })[orientation]; 1500 if (nextIndex === activeIndex && [ 1501 ...toEndKeys, 1502 ...toStartKeys 1503 ].includes(event.key)) { 1504 if (loop && nextIndex === maxIndex && toEndKeys.includes(event.key)) { 1505 nextIndex = minIndex; 1506 } else if (loop && nextIndex === minIndex && toStartKeys.includes(event.key)) { 1507 nextIndex = maxIndex; 1508 } else { 1509 nextIndex = findNonDisabledIndex(elementsRef, { 1510 startingIndex: nextIndex, 1511 decrement: toStartKeys.includes(event.key), 1512 disabledIndices 1513 }); 1514 } 1515 } 1516 if (nextIndex !== activeIndex && !isIndexOutOfBounds(elementsRef, nextIndex)) { 1517 var _elementsRef$current$; 1518 event.stopPropagation(); 1519 if (preventedKeys.includes(event.key)) { 1520 event.preventDefault(); 1521 } 1522 onNavigate(nextIndex); 1523 (_elementsRef$current$ = elementsRef.current[nextIndex]) == null || _elementsRef$current$.focus(); 1524 } 1525 } 1526 const computedProps = { 1527 ...domProps, 1528 ...renderElementProps, 1529 ref: forwardedRef, 1530 'aria-orientation': orientation === 'both' ? undefined : orientation, 1531 onKeyDown (e) { 1532 domProps.onKeyDown == null || domProps.onKeyDown(e); 1533 renderElementProps.onKeyDown == null || renderElementProps.onKeyDown(e); 1534 handleKeyDown(e); 1535 } 1536 }; 1537 return /*#__PURE__*/ __TURBOPACK__imported__module__271645__1.createElement(CompositeContext.Provider, { 1538 value: contextValue 1539 }, /*#__PURE__*/ __TURBOPACK__imported__module__271645__1.createElement(FloatingList, { 1540 elementsRef: elementsRef 1541 }, renderJsx(render, computedProps))); 1542}); 1543/** 1544 * @see https://floating-ui.com/docs/Composite 1545 */ const CompositeItem = /*#__PURE__*/ __TURBOPACK__imported__module__271645__1.forwardRef(function CompositeItem(props, forwardedRef) { 1546 const { render, ...domProps } = props; 1547 const renderElementProps = render && typeof render !== 'function' ? render.props : {}; 1548 const { activeIndex, onNavigate } = __TURBOPACK__imported__module__271645__1.useContext(CompositeContext); 1549 const { ref, index } = useListItem(); 1550 const mergedRef = useMergeRefs([ 1551 ref, 1552 forwardedRef, 1553 renderElementProps.ref 1554 ]); 1555 const isActive = activeIndex === index; 1556 const computedProps = { 1557 ...domProps, 1558 ...renderElementProps, 1559 ref: mergedRef, 1560 tabIndex: isActive ? 0 : -1, 1561 'data-active': isActive ? '' : undefined, 1562 onFocus (e) { 1563 domProps.onFocus == null || domProps.onFocus(e); 1564 renderElementProps.onFocus == null || renderElementProps.onFocus(e); 1565 onNavigate(index); 1566 } 1567 }; 1568 return renderJsx(render, computedProps); 1569}); 1570function _extends() { 1571 _extends = ("TURBOPACK compile-time truthy", 1) ? Object.assign.bind() : "TURBOPACK unreachable"; 1572 return _extends.apply(this, arguments); 1573} 1574let serverHandoffComplete = false;
1575let count = 0; 1576const genId = ()=>// on <React 18 1577 "floating-ui-" + Math.random().toString(36).slice(2, 6) + count++; 1578function useFloatingId() { 1579 const [id, setId] = __TURBOPACK__imported__module__271645__1.useState(()=>serverHandoffComplete ? genId() : undefined); 1580 index(()=>{ 1581 if (id == null) { 1582 setId(genId()); 1583 } 1584 // eslint-disable-next-line react-hooks/exhaustive-deps 1585 }, []); 1586 __TURBOPACK__imported__module__271645__1.useEffect(()=>{ 1587 serverHandoffComplete = true; 1588 }, []); 1589 return id; 1590} 1591const useReactId = SafeReact.useId; 1592/** 1593 * Uses React 18's built-in `useId()` when available, or falls back to a 1594 * slightly less performant (requiring a double render) implementation for 1595 * earlier React versions. 1596 * @see https://floating-ui.com/docs/react-utils#useid 1597 */ const useId = useReactId || useFloatingId; 1598let devMessageSet; 1599if ("TURBOPACK compile-time falsy", 0) //TURBOPACK unreachable 1600; 1601function warn() { 1602 var _devMessageSet; 1603 for(var _len = arguments.length, messages = new Array(_len), _key = 0; _key < _len; _key++){ 1604 messages[_key] = arguments[_key]; 1605 } 1606 const message = "Floating UI: " + messages.join(' '); 1607 if (!((_devMessageSet = devMessageSet) != null && _devMessageSet.has(message))) { 1608 var _devMessageSet2; 1609 (_devMessageSet2 = devMessageSet) == null || _devMessageSet2.add(message); 1610 console.warn(message); 1611 } 1612} 1613function error() { 1614 var _devMessageSet3; 1615 for(var _len2 = arguments.length, messages = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++){ 1616 messages[_key2] = arguments[_key2]; 1617 } 1618 const message = "Floating UI: " + messages.join(' '); 1619 if (!((_devMessageSet3 = devMessageSet) != null && _devMessageSet3.has(message))) { 1620 var _devMessageSet4; 1621 (_devMessageSet4 = devMessageSet) == null || _devMessageSet4.add(message); 1622 console.error(message); 1623 } 1624} 1625/** 1626 * Renders a pointing arrow triangle. 1627 * @see https://floating-ui.com/docs/FloatingArrow 1628 */ const FloatingArrow = /*#__PURE__*/ __TURBOPACK__imported__module__271645__1.forwardRef(function FloatingArrow(props, ref) { 1629 const { context: { placement, elements: { floating }, middlewareData: { arrow, shift } }, width = 14, height = 7, tipRadius = 0, strokeWidth = 0, staticOffset, stroke, d, style: { transform, ...restStyle } = {}, ...rest } = props; 1630 if ("TURBOPACK compile-time falsy", 0) //TURBOPACK unreachable 1631 ; 1632 const clipPathId = useId(); 1633 const [isRTL, setIsRTL] = __TURBOPACK__imported__module__271645__1.useState(false); 1634 // https://github.com/floating-ui/floating-ui/issues/2932 1635 index(()=>{ 1636 if (!floating) return; 1637 const isRTL = (0, __TURBOPACK__imported__module__229315__1["getComputedStyle"])(floating).direction === 'rtl'; 1638 if (isRTL) { 1639 setIsRTL(true); 1640 } 1641 }, [ 1642 floating 1643 ]); 1644 if (!floating) { 1645 return null; 1646 } 1647 const [side, alignment] = placement.split('-'); 1648 const isVerticalSide = side === 'top' || side === 'bottom'; 1649 let computedStaticOffset = staticOffset; 1650 if (isVerticalSide && shift != null && shift.x || !isVerticalSide && shift != null && shift.y) { 1651 computedStaticOffset = null; 1652 } 1653 // Strokes must be double the border width, this ensures the stroke's width 1654 // works as you'd expect. 1655 const computedStrokeWidth = strokeWidth * 2; 1656 const halfStrokeWidth = computedStrokeWidth / 2; 1657 const svgX = width / 2 * (tipRadius / -8 + 1); 1658 const svgY = height / 2 * tipRadius / 4; 1659 const isCustomShape = !!d; 1660 const yOffsetProp = computedStaticOffset && alignment === 'end' ? 'bottom' : 'top'; 1661 let xOffsetProp = computedStaticOffset && alignment === 'end' ? 'right' : 'left'; 1662 if (computedStaticOffset && isRTL) { 1663 xOffsetProp = alignment === 'end' ? 'left' : 'right'; 1664 } 1665 const arrowX = (arrow == null ? void 0 : arrow.x) != null ? computedStaticOffset || arrow.x : ''; 1666 const arrowY = (arrow == null ? void 0 : arrow.y) != null ? computedStaticOffset || arrow.y : ''; 1667 const dValue = d || 'M0,0' + (" H" + width) + (" L" + (width - svgX) + "," + (height - svgY)) + (" Q" + width / 2 + "," + height + " " + svgX + "," + (height - svgY)) + ' Z'; 1668 const rotation = { 1669 top: isCustomShape ? 'rotate(180deg)' : '', 1670 left: isCustomShape ? 'rotate(90deg)' : 'rotate(-90deg)', 1671 bottom: isCustomShape ? '' : 'rotate(180deg)', 1672 right: isCustomShape ? 'rotate(-90deg)' : 'rotate(90deg)' 1673 }[side]; 1674 return /*#__PURE__*/ __TURBOPACK__imported__module__271645__1.createElement("svg", _extends({}, rest, { 1675 "aria-hidden": true, 1676 ref: ref, 1677 width: isCustomShape ? width : width + computedStrokeWidth, 1678 height: width,
1679 viewBox: "0 0 " + width + " " + (height > width ? height : width), 1680 style: { 1681 position: 'absolute', 1682 pointerEvents: 'none', 1683 [xOffsetProp]: arrowX, 1684 [yOffsetProp]: arrowY, 1685 [side]: isVerticalSide || isCustomShape ? '100%' : "calc(100% - " + computedStrokeWidth / 2 + "px)", 1686 transform: [ 1687 rotation, 1688 transform 1689 ].filter((t)=>!!t).join(' '), 1690 ...restStyle 1691 } 1692 }), computedStrokeWidth > 0 && /*#__PURE__*/ __TURBOPACK__imported__module__271645__1.createElement("path", { 1693 clipPath: "url(#" + clipPathId + ")", 1694 fill: "none", 1695 stroke: stroke, 1696 strokeWidth: computedStrokeWidth + (d ? 0 : 1), 1697 d: dValue 1698 }), /*#__PURE__*/ __TURBOPACK__imported__module__271645__1.createElement("path", { 1699 stroke: computedStrokeWidth && !d ? rest.fill : 'none', 1700 d: dValue 1701 }), /*#__PURE__*/ __TURBOPACK__imported__module__271645__1.createElement("clipPath", { 1702 id: clipPathId 1703 }, /*#__PURE__*/ __TURBOPACK__imported__module__271645__1.createElement("rect", { 1704 x: -halfStrokeWidth, 1705 y: halfStrokeWidth * (isCustomShape ? -1 : 1), 1706 width: width + computedStrokeWidth, 1707 height: width 1708 }))); 1709}); 1710function createPubSub() { 1711 const map = new Map(); 1712 return { 1713 emit (event, data) { 1714 var _map$get; 1715 (_map$get = map.get(event)) == null || _map$get.forEach((handler)=>handler(data)); 1716 }, 1717 on (event, listener) { 1718 map.set(event, [ 1719 ...map.get(event) || [], 1720 listener 1721 ]); 1722 }, 1723 off (event, listener) { 1724 var _map$get2; 1725 map.set(event, ((_map$get2 = map.get(event)) == null ? void 0 : _map$get2.filter((l)=>l !== listener)) || []); 1726 } 1727 }; 1728} 1729const FloatingNodeContext = /*#__PURE__*/ __TURBOPACK__imported__module__271645__1.createContext(null); 1730const FloatingTreeContext = /*#__PURE__*/ __TURBOPACK__imported__module__271645__1.createContext(null); 1731/** 1732 * Returns the parent node id for nested floating elements, if available. 1733 * Returns `null` for top-level floating elements. 1734 */ const useFloatingParentNodeId = ()=>{ 1735 var _React$useContext; 1736 return ((_React$useContext = __TURBOPACK__imported__module__271645__1.useContext(FloatingNodeContext)) == null ? void 0 : _React$useContext.id) || null; 1737}; 1738/** 1739 * Returns the nearest floating tree context, if available. 1740 */ const useFloatingTree = ()=>__TURBOPACK__imported__module__271645__1.useContext(FloatingTreeContext); 1741/** 1742 * Registers a node into the `FloatingTree`, returning its id. 1743 * @see https://floating-ui.com/docs/FloatingTree 1744 */ function useFloatingNodeId(customParentId) { 1745 const id = useId(); 1746 const tree = useFloatingTree(); 1747 const reactParentId = useFloatingParentNodeId(); 1748 const parentId = customParentId || reactParentId; 1749 index(()=>{ 1750 const node = { 1751 id, 1752 parentId 1753 }; 1754 tree == null || tree.addNode(node); 1755 return ()=>{ 1756 tree == null || tree.removeNode(node); 1757 }; 1758 }, [ 1759 tree, 1760 id, 1761 parentId 1762 ]); 1763 return id; 1764} 1765/** 1766 * Provides parent node context for nested floating elements. 1767 * @see https://floating-ui.com/docs/FloatingTree 1768 */ function FloatingNode(props) { 1769 const { children, id } = props; 1770 const parentId = useFloatingParentNodeId(); 1771 return /*#__PURE__*/ __TURBOPACK__imported__module__271645__1.createElement(FloatingNodeContext.Provider, { 1772 value: __TURBOPACK__imported__module__271645__1.useMemo(()=>({ 1773 id, 1774 parentId 1775 }), [ 1776 id, 1777 parentId 1778 ]) 1779 }, children); 1780} 1781/** 1782 * Provides context for nested floating elements when they are not children of 1783 * each other on the DOM. 1784 * This is not necessary in all cases, except when there must be explicit communication between parent and child floating elements. It is necessary for: 1785 * - The `bubbles` option in the `useDismiss()` Hook 1786 * - Nested virtual list navigation
1787 * - Nested floating elements that each open on hover 1788 * - Custom communication between parent and child floating elements 1789 * @see https://floating-ui.com/docs/FloatingTree 1790 */ function FloatingTree(props) { 1791 const { children } = props; 1792 const nodesRef = __TURBOPACK__imported__module__271645__1.useRef([]); 1793 const addNode = __TURBOPACK__imported__module__271645__1.useCallback((node)=>{ 1794 nodesRef.current = [ 1795 ...nodesRef.current, 1796 node 1797 ]; 1798 }, []); 1799 const removeNode = __TURBOPACK__imported__module__271645__1.useCallback((node)=>{ 1800 nodesRef.current = nodesRef.current.filter((n)=>n !== node); 1801 }, []); 1802 const events = __TURBOPACK__imported__module__271645__1.useState(()=>createPubSub())[0]; 1803 return /*#__PURE__*/ __TURBOPACK__imported__module__271645__1.createElement(FloatingTreeContext.Provider, { 1804 value: __TURBOPACK__imported__module__271645__1.useMemo(()=>({ 1805 nodesRef, 1806 addNode, 1807 removeNode, 1808 events 1809 }), [ 1810 addNode, 1811 removeNode, 1812 events 1813 ]) 1814 }, children); 1815} 1816function createAttribute(name) { 1817 return "data-floating-ui-" + name; 1818} 1819function useLatestRef(value) { 1820 const ref = (0, __TURBOPACK__imported__module__271645__1["useRef"])(value); 1821 index(()=>{ 1822 ref.current = value; 1823 }); 1824 return ref; 1825} 1826const safePolygonIdentifier = /*#__PURE__*/ createAttribute('safe-polygon'); 1827function getDelay(value, prop, pointerType) { 1828 if (pointerType && !isMouseLikePointerType(pointerType)) { 1829 return 0; 1830 } 1831 if (typeof value === 'number') { 1832 return value; 1833 } 1834 return value == null ? void 0 : value[prop]; 1835} 1836/** 1837 * Opens the floating element while hovering over the reference element, like 1838 * CSS `:hover`. 1839 * @see https://floating-ui.com/docs/useHover 1840 */ function useHover(context, props) { 1841 if (props === void 0) { 1842 props = {}; 1843 } 1844 const { open, onOpenChange, dataRef, events, elements } = context; 1845 const { enabled = true, delay = 0, handleClose = null, mouseOnly = false, restMs = 0, move = true } = props; 1846 const tree = useFloatingTree(); 1847 const parentId = useFloatingParentNodeId(); 1848 const handleCloseRef = useLatestRef(handleClose); 1849 const delayRef = useLatestRef(delay); 1850 const openRef = useLatestRef(open); 1851 const pointerTypeRef = __TURBOPACK__imported__module__271645__1.useRef(); 1852 const timeoutRef = __TURBOPACK__imported__module__271645__1.useRef(-1); 1853 const handlerRef = __TURBOPACK__imported__module__271645__1.useRef(); 1854 const restTimeoutRef = __TURBOPACK__imported__module__271645__1.useRef(-1); 1855 const blockMouseMoveRef = __TURBOPACK__imported__module__271645__1.useRef(true); 1856 const performedPointerEventsMutationRef = __TURBOPACK__imported__module__271645__1.useRef(false); 1857 const unbindMouseMoveRef = __TURBOPACK__imported__module__271645__1.useRef(()=>{}); 1858 const restTimeoutPendingRef = __TURBOPACK__imported__module__271645__1.useRef(false); 1859 const isHoverOpen = __TURBOPACK__imported__module__271645__1.useCallback(()=>{ 1860 var _dataRef$current$open; 1861 const type = (_dataRef$current$open = dataRef.current.openEvent) == null ? void 0 : _dataRef$current$open.type; 1862 return (type == null ? void 0 : type.includes('mouse')) && type !== 'mousedown'; 1863 }, [ 1864 dataRef 1865 ]); 1866 // When closing before opening, clear the delay timeouts to cancel it 1867 // from showing. 1868 __TURBOPACK__imported__module__271645__1.useEffect(()=>{ 1869 if (!enabled) return; 1870 function onOpenChange(_ref) { 1871 let { open } = _ref; 1872 if (!open) { 1873 clearTimeout(timeoutRef.current); 1874 clearTimeout(restTimeoutRef.current); 1875 blockMouseMoveRef.current = true; 1876 restTimeoutPendingRef.current = false; 1877 } 1878 } 1879 events.on('openchange', onOpenChange); 1880 return ()=>{ 1881 events.off('openchange', onOpenChange); 1882 }; 1883 }, [ 1884 enabled, 1885 events 1886 ]); 1887 __TURBOPACK__imported__module__271645__1.useEffect(()=>{ 1888 if (!enabled) return; 1889 if (!handleCloseRef.current) return; 1890 if (!open) return; 1891 function onLeave(event) { 1892 if (isHoverOpen()) { 1893 onOpenChange(false, event, 'hover'); 1894 } 1895 } 1896 const html = getDocument(elements.floating).documentElement; 1897 html.addEventListener('mouseleave', onLeave); 1898 return ()=>{ 1899 html.removeEventListener('mouseleave', onLeave); 1900 }; 1901 }, [ 1902 elements.floating, 1903 open, 1904 onOpenChange, 1905 enabled, 1906 handleCloseRef, 1907 isHoverOpen 1908 ]); 1909 const closeWithDelay = __TURBOPACK__imported__module__271645__1.useCallback(function(event, runElseBranch, reason) { 1910 if (runElseBranch === void 0) { 1911 runElseBranch = true; 1912 } 1913 if (reason === void 0) { 1914 reason = 'hover'; 1915 } 1916 const closeDelay = getDelay(delayRef.current, 'close', pointerTypeRef.current); 1917 if (closeDelay && !handlerRef.current) { 1918 clearTimeout(timeoutRef.current); 1919 timeoutRef.current = window.setTimeout(()=>
1919onOpenChange(false, event, reason), closeDelay); 1920 } else if (runElseBranch) { 1921 clearTimeout(timeoutRef.current); 1922 onOpenChange(false, event, reason); 1923 } 1924 }, [ 1925 delayRef, 1926 onOpenChange 1927 ]); 1928 const cleanupMouseMoveHandler = useEffectEvent(()=>{ 1929 unbindMouseMoveRef.current(); 1930 handlerRef.current = undefined; 1931 }); 1932 const clearPointerEvents = useEffectEvent(()=>{ 1933 if (performedPointerEventsMutationRef.current) { 1934 const body = getDocument(elements.floating).body; 1935 body.style.pointerEvents = ''; 1936 body.removeAttribute(safePolygonIdentifier); 1937 performedPointerEventsMutationRef.current = false; 1938 } 1939 }); 1940 const isClickLikeOpenEvent = useEffectEvent(()=>{ 1941 return dataRef.current.openEvent ? [ 1942 'click', 1943 'mousedown' 1944 ].includes(dataRef.current.openEvent.type) : false; 1945 }); 1946 // Registering the mouse events on the reference directly to bypass React's 1947 // delegation system. If the cursor was on a disabled element and then entered 1948 // the reference (no gap), `mouseenter` doesn't fire in the delegation system. 1949 __TURBOPACK__imported__module__271645__1.useEffect(()=>{ 1950 if (!enabled) return; 1951 function onMouseEnter(event) { 1952 clearTimeout(timeoutRef.current); 1953 blockMouseMoveRef.current = false; 1954 if (mouseOnly && !isMouseLikePointerType(pointerTypeRef.current) || restMs > 0 && !getDelay(delayRef.current, 'open')) { 1955 return; 1956 } 1957 const openDelay = getDelay(delayRef.current, 'open', pointerTypeRef.current); 1958 if (openDelay) { 1959 timeoutRef.current = window.setTimeout(()=>{ 1960 if (!openRef.current) { 1961 onOpenChange(true, event, 'hover'); 1962 } 1963 }, openDelay); 1964 } else if (!open) { 1965 onOpenChange(true, event, 'hover'); 1966 } 1967 } 1968 function onMouseLeave(event) { 1969 if (isClickLikeOpenEvent()) return; 1970 unbindMouseMoveRef.current(); 1971 const doc = getDocument(elements.floating); 1972 clearTimeout(restTimeoutRef.current); 1973 restTimeoutPendingRef.current = false; 1974 if (handleCloseRef.current && dataRef.current.floatingContext) { 1975 // Prevent clearing `onScrollMouseLeave` timeout. 1976 if (!open) { 1977 clearTimeout(timeoutRef.current); 1978 } 1979 handlerRef.current = handleCloseRef.current({ 1980 ...dataRef.current.floatingContext, 1981 tree, 1982 x: event.clientX, 1983 y: event.clientY, 1984 onClose () { 1985 clearPointerEvents(); 1986 cleanupMouseMoveHandler(); 1987 if (!isClickLikeOpenEvent()) { 1988 closeWithDelay(event, true, 'safe-polygon'); 1989 } 1990 } 1991 }); 1992 const handler = handlerRef.current; 1993 doc.addEventListener('mousemove', handler); 1994 unbindMouseMoveRef.current = ()=>{ 1995 doc.removeEventListener('mousemove', handler); 1996 }; 1997 return; 1998 } 1999 // Allow interactivity without `safePolygon` on touch devices. With a 2000 // pointer, a short close delay is an alternative, so it should work 2001 // consistently. 2002 const shouldClose = pointerTypeRef.current === 'touch' ? !contains(elements.floating, event.relatedTarget) : true; 2003 if (shouldClose) { 2004 closeWithDelay(event); 2005 } 2006 } 2007 // Ensure the floating element closes after scrolling even if the pointer 2008 // did not move. 2009 // https://github.com/floating-ui/floating-ui/discussions/1692 2010 function onScrollMouseLeave(event) { 2011 if (isClickLikeOpenEvent()) return; 2012 if (!dataRef.current.floatingContext) return; 2013 handleCloseRef.current == null || handleCloseRef.current({ 2014 ...dataRef.current.floatingContext, 2015 tree, 2016 x: event.clientX, 2017 y: event.clientY, 2018 onClose () { 2019 clearPointerEvents(); 2020 cleanupMouseMoveHandler(); 2021 if (!isClickLikeOpenEvent()) { 2022 closeWithDelay(event); 2023 } 2024 } 2025 })(event); 2026 } 2027 if ((0, __TURBOPACK__imported__module__229315__1["isElement"])(elements.domReference)) { 2028 var _elements$floating; 2029 const ref = elements.domReference; 2030 open && ref.addEventListener('mouseleave', onScrollMouseLeave); 2031 (_elements$floating = elements.floating) == null || _elements$floating.addEventListener('mouseleave', onScrollMouseLeave); 2032 move && ref.addEventListener('mousemove', onMouseEnter, { 2033 once: true 2034 }); 2035 ref.addEventListener('mouseenter', onMouseEnter); 2036 ref.addEventListener('mouseleave', onMouseLeave); 2037 return ()=>{ 2038 var _elements$floating2; 2039 open && ref.removeEventListener('mouseleave', onScrollMouseLeave); 2040 (_elements$floating2 = elements.floating) == null || _elements$floating2.removeEventListener('mouseleave', onScrollMouseLeave); 2041 move && ref.removeEventListener('mousemove', onMouseEnter); 2042 ref.removeEventListener('mouseenter', onMouseEnter); 2043 ref.removeEventListener('mouseleave', onMouseLeave); 2044 }; 2045 } 2046 }, [ 2047 elements, 2048 enabled, 2049 context, 2050 mouseOnly, 2051 restMs, 2052 move, 2053 closeWithDelay, 2054 cleanupMouseMoveHandler, 2055 clearPointerEvents, 2056 onOpenChange, 2057 open, 2058 openRef, 2059 tree, 2060 delayRef, 2061 handleCloseRef, 2062 dataRef, 2063 isClickLikeOpenEvent 2064 ]); 2065 // Block pointer-events of every element other than the reference and floating 2066 // while the floating element is open and has a `handleClose` handler. Also 2067 // handles nested floating elements. 2068 // https://github.com/floating-ui/floating-ui/issues/1722 2069 index(()=>{ 2070 var _handleCloseRef$curre; 2071 if (!enabled) return; 2072 if (open && (_handleCloseRef$curre = handleCloseRef.current) != null && _handleCloseRef$curre.__options.blockPointerEvents && isHoverOpen()) { 2073 performedPointerEventsMutationRef.current = true; 2074 const floatingEl = elements.floating; 2075 if ((0, __TURBOPACK__imported__module__229315__1["isElement"])(elements.domReference) && floatingEl) { 2076 var _tree$nodesRef$curren; 2077 const body = getDocument(elements.floating).body; 2078 body.setAttribute(safePolygonIdentifier, ''); 2079 const ref = elements.domReference; 2080 const parentFloating = tree == null || (_tree$nodesRef$curren = tree.nodesRef.current.find((node)=>node.id === parentId)) == null || (_tree$nodesRef$curren = _tree$nodesRef$curren.context) == null ? void 0 : _tree$nodesRef$curren.elements.floating; 2081 if (parentFloating) { 2082 parentFloating.style.pointerEvents = ''; 2083 } 2084 body.style.pointerEvents = 'none'; 2085 ref.style.pointerEvents = 'auto'; 2086 floatingEl.style.pointerEvents = 'auto'; 2087 return ()=>{ 2088 body.style.pointerEvents = ''; 2089 ref.style.pointerEvents = ''; 2090 floatingEl.style.pointerEvents = ''; 2091 }; 2092 } 2093 } 2094 }, [ 2095 enabled, 2096 open, 2097 parentId, 2098 elements, 2099 tree, 2100 handleCloseRef, 2101 isHoverOpen 2102 ]); 2103 index(()=>{ 2104 if (!open) { 2105 pointerTypeRef.current = undefined; 2106 restTimeoutPendingRef.current = false;
2107 cleanupMouseMoveHandler(); 2108 clearPointerEvents(); 2109 } 2110 }, [ 2111 open, 2112 cleanupMouseMoveHandler, 2113 clearPointerEvents 2114 ]); 2115 __TURBOPACK__imported__module__271645__1.useEffect(()=>{ 2116 return ()=>{ 2117 cleanupMouseMoveHandler(); 2118 clearTimeout(timeoutRef.current); 2119 clearTimeout(restTimeoutRef.current); 2120 clearPointerEvents(); 2121 }; 2122 }, [ 2123 enabled, 2124 elements.domReference, 2125 cleanupMouseMoveHandler, 2126 clearPointerEvents 2127 ]); 2128 const reference = __TURBOPACK__imported__module__271645__1.useMemo(()=>{ 2129 function setPointerRef(event) { 2130 pointerTypeRef.current = event.pointerType; 2131 } 2132 return { 2133 onPointerDown: setPointerRef, 2134 onPointerEnter: setPointerRef, 2135 onMouseMove (event) { 2136 const { nativeEvent } = event; 2137 function handleMouseMove() { 2138 if (!blockMouseMoveRef.current && !openRef.current) { 2139 onOpenChange(true, nativeEvent, 'hover'); 2140 } 2141 } 2142 if (mouseOnly && !isMouseLikePointerType(pointerTypeRef.current)) { 2143 return; 2144 } 2145 if (open || restMs === 0) { 2146 return; 2147 } 2148 // Ignore insignificant movements to account for tremors. 2149 if (restTimeoutPendingRef.current && event.movementX ** 2 + event.movementY ** 2 < 2) { 2150 return; 2151 } 2152 clearTimeout(restTimeoutRef.current); 2153 if (pointerTypeRef.current === 'touch') { 2154 handleMouseMove(); 2155 } else { 2156 restTimeoutPendingRef.current = true; 2157 restTimeoutRef.current = window.setTimeout(handleMouseMove, restMs); 2158 } 2159 } 2160 }; 2161 }, [ 2162 mouseOnly, 2163 onOpenChange, 2164 open, 2165 openRef, 2166 restMs 2167 ]); 2168 const floating = __TURBOPACK__imported__module__271645__1.useMemo(()=>({ 2169 onMouseEnter () { 2170 clearTimeout(timeoutRef.current); 2171 }, 2172 onMouseLeave (event) { 2173 if (!isClickLikeOpenEvent()) { 2174 closeWithDelay(event.nativeEvent, false); 2175 } 2176 } 2177 }), [ 2178 closeWithDelay, 2179 isClickLikeOpenEvent 2180 ]); 2181 return __TURBOPACK__imported__module__271645__1.useMemo(()=>enabled ? { 2182 reference, 2183 floating 2184 } : {}, [ 2185 enabled, 2186 reference, 2187 floating 2188 ]); 2189} 2190const NOOP = ()=>{}; 2191const FloatingDelayGroupContext = /*#__PURE__*/ __TURBOPACK__imported__module__271645__1.createContext({ 2192 delay: 0, 2193 initialDelay: 0, 2194 timeoutMs: 0, 2195 currentId: null, 2196 setCurrentId: NOOP, 2197 setState: NOOP, 2198 isInstantPhase: false 2199}); 2200/** 2201 * @deprecated 2202 * Use the return value of `useDelayGroup()` instead. 2203 */ const useDelayGroupContext = ()=>__TURBOPACK__imported__module__271645__1.useContext(FloatingDelayGroupContext); 2204/** 2205 * Provides context for a group of floating elements that should share a 2206 * `delay`. 2207 * @see https://floating-ui.com/docs/FloatingDelayGroup 2208 */ function FloatingDelayGroup(props) { 2209 const { children, delay, timeoutMs = 0 } = props; 2210 const [state, setState] = __TURBOPACK__imported__module__271645__1.useReducer((prev, next)=>({ 2211 ...prev, 2212 ...next 2213 }), { 2214 delay, 2215 timeoutMs, 2216 initialDelay: delay, 2217 currentId: null, 2218 isInstantPhase: false 2219 }); 2220 const initialCurrentIdRef = __TURBOPACK__imported__module__271645__1.useRef(null); 2221 const setCurrentId = __TURBOPACK__imported__module__271645__1.useCallback((currentId)=>{ 2222 setState({ 2223 currentId 2224 }); 2225 }, []); 2226 index(()=>{ 2227 if (state.currentId) { 2228 if (initialCurrentIdRef.current === null) { 2229 initialCurrentIdRef.current = state.currentId; 2230 } else if (!state.isInstantPhase) { 2231 setState({ 2232 isInstantPhase: true 2233 }); 2234 } 2235 } else { 2236 if (state.isInstantPhase) { 2237 setState({ 2238 isInstantPhase: false 2239 }); 2240 } 2241 initialCurrentIdRef.current = null; 2242 } 2243 }, [ 2244 state.currentId, 2245 state.isInstantPhase 2246 ]); 2247 return /*#__PURE__*/ __TURBOPACK__imported__module__271645__1.createElement(FloatingDelayGroupContext.Provider, { 2248 value: __TURBOPACK__imported__module__271645__1.useMemo(()=>({ 2249 ...state, 2250 setState, 2251 setCurrentId 2252 }), [ 2253 state, 2254 setCurrentId 2255 ]) 2256 }, children); 2257} 2258/**
2259 * Enables grouping when called inside a component that's a child of a 2260 * `FloatingDelayGroup`. 2261 * @see https://floating-ui.com/docs/FloatingDelayGroup 2262 */ function useDelayGroup(context, options) { 2263 if (options === void 0) { 2264 options = {}; 2265 } 2266 const { open, onOpenChange, floatingId } = context; 2267 const { id: optionId, enabled = true } = options; 2268 const id = optionId != null ? optionId : floatingId; 2269 const groupContext = useDelayGroupContext(); 2270 const { currentId, setCurrentId, initialDelay, setState, timeoutMs } = groupContext; 2271 index(()=>{ 2272 if (!enabled) return; 2273 if (!currentId) return; 2274 setState({ 2275 delay: { 2276 open: 1, 2277 close: getDelay(initialDelay, 'close') 2278 } 2279 }); 2280 if (currentId !== id) { 2281 onOpenChange(false); 2282 } 2283 }, [ 2284 enabled, 2285 id, 2286 onOpenChange, 2287 setState, 2288 currentId, 2289 initialDelay 2290 ]); 2291 index(()=>{ 2292 function unset() { 2293 onOpenChange(false); 2294 setState({ 2295 delay: initialDelay, 2296 currentId: null 2297 }); 2298 } 2299 if (!enabled) return; 2300 if (!currentId) return; 2301 if (!open && currentId === id) { 2302 if (timeoutMs) { 2303 const timeout = window.setTimeout(unset, timeoutMs); 2304 return ()=>{ 2305 clearTimeout(timeout); 2306 }; 2307 } 2308 unset(); 2309 } 2310 }, [ 2311 enabled, 2312 open, 2313 setState, 2314 currentId, 2315 id, 2316 onOpenChange, 2317 initialDelay, 2318 timeoutMs 2319 ]); 2320 index(()=>{ 2321 if (!enabled) return; 2322 if (setCurrentId === NOOP || !open) return; 2323 setCurrentId(id); 2324 }, [ 2325 enabled, 2326 open, 2327 setCurrentId, 2328 id 2329 ]); 2330 return groupContext; 2331} 2332let rafId = 0; 2333function enqueueFocus(el, options) { 2334 if (options === void 0) { 2335 options = {}; 2336 } 2337 const { preventScroll = false, cancelPrevious = true, sync = false } = options; 2338 cancelPrevious && cancelAnimationFrame(rafId); 2339 const exec = ()=>el == null ? void 0 : el.focus({ 2340 preventScroll 2341 }); 2342 if (sync) { 2343 exec(); 2344 } else { 2345 rafId = requestAnimationFrame(exec); 2346 } 2347} 2348function getAncestors(nodes, id) { 2349 var _nodes$find; 2350 let allAncestors = []; 2351 let currentParentId = (_nodes$find = nodes.find((node)=>node.id === id)) == null ? void 0 : _nodes$find.parentId; 2352 while(currentParentId){ 2353 const currentNode = nodes.find((node)=>node.id === currentParentId); 2354 currentParentId = currentNode == null ? void 0 : currentNode.parentId; 2355 if (currentNode) { 2356 allAncestors = allAncestors.concat(currentNode); 2357 } 2358 } 2359 return allAncestors; 2360} 2361function getChildren(nodes, id) { 2362 let allChildren = nodes.filter((node)=>{ 2363 var _node$context; 2364 return node.parentId === id && ((_node$context = node.context) == null ? void 0 : _node$context.open); 2365 }); 2366 let currentChildren = allChildren; 2367 while(currentChildren.length){ 2368 currentChildren = nodes.filter((node)=>{ 2369 var _currentChildren; 2370 return (_currentChildren = currentChildren) == null ? void 0 : _currentChildren.some((n)=>{ 2371 var _node$context2; 2372 return node.parentId === n.id && ((_node$context2 = node.context) == null ? void 0 : _node$context2.open); 2373 }); 2374 }); 2375 allChildren = allChildren.concat(currentChildren); 2376 } 2377 return allChildren; 2378} 2379function getDeepestNode(nodes, id) { 2380 let deepestNodeId; 2381 let maxDepth = -1; 2382 function findDeepest(nodeId, depth) { 2383 if (depth > maxDepth) { 2384 deepestNodeId = nodeId; 2385 maxDepth = depth; 2386 } 2387 const children = getChildren(nodes, nodeId); 2388 children.forEach((child)=>{ 2389 findDeepest(child.id, depth + 1); 2390 }); 2391 } 2392 findDeepest(id, 0); 2393 return nodes.find((node)=>node.id === deepestNodeId); 2394} 2395// Modified to add conditional `aria-hidden` support: 2396// https://github.com/theKashey/aria-hidden/blob/9220c8f4a4fd35f63bee5510a9f41a37264382d4/src/index.ts 2397let counterMap = /*#__PURE__*/ new WeakMap(); 2398let uncontrolledElementsSet = /*#__PURE__*/ new WeakSet(); 2399let markerMap = {}; 2400let lockCount$1 = 0; 2401const supportsInert = ()=>typeof HTMLElement !== 'undefined' && 'inert' in HTMLElement.prototype; 2402const unwrapHost = (node)=>node && (node.host || unwrapHost(node.parentNode)); 2403const correctElements = (parent, targets)=>targets.map((target)=>{ 2404 if (parent.contains(target)) { 2405 return target; 2406 } 2407 const correctedTarget = unwrapHost(target); 2408 if (parent.contains(correctedTarget)) { 2409 return correctedTarget; 2410 } 2411 return null; 2412 }).filter((x)=>x != null); 2413function applyAttributeToOthers(uncorrectedAvoidElements, body, ariaHidden, inert) { 2414 const markerName = 'data-floating-ui-inert'; 2415 const controlAttribute = inert ? 'inert' : ariaHidden ? 'aria-hidden' : null; 2416 const avoidElements = correctElements(body, uncorrectedAvoidElements); 2417 const elementsToKeep = new Set(); 2418 const elementsToStop = new Set(avoidElements); 2419 const hiddenElements = []; 2420 if (!markerMap[markerName]) { 2421 markerMap[markerName] = new WeakMap(); 2422 } 2423 const markerCounter = markerMap[markerName];
2424 avoidElements.forEach(keep); 2425 deep(body); 2426 elementsToKeep.clear(); 2427 function keep(el) { 2428 if (!el || elementsToKeep.has(el)) { 2429 return; 2430 } 2431 elementsToKeep.add(el); 2432 el.parentNode && keep(el.parentNode); 2433 } 2434 function deep(parent) { 2435 if (!parent || elementsToStop.has(parent)) { 2436 return; 2437 } 2438 [].forEach.call(parent.children, (node)=>{ 2439 if ((0, __TURBOPACK__imported__module__229315__1["getNodeName"])(node) === 'script') return; 2440 if (elementsToKeep.has(node)) { 2441 deep(node); 2442 } else { 2443 const attr = controlAttribute ? node.getAttribute(controlAttribute) : null; 2444 const alreadyHidden = attr !== null && attr !== 'false'; 2445 const counterValue = (counterMap.get(node) || 0) + 1; 2446 const markerValue = (markerCounter.get(node) || 0) + 1; 2447 counterMap.set(node, counterValue); 2448 markerCounter.set(node, markerValue); 2449 hiddenElements.push(node); 2450 if (counterValue === 1 && alreadyHidden) { 2451 uncontrolledElementsSet.add(node); 2452 } 2453 if (markerValue === 1) { 2454 node.setAttribute(markerName, ''); 2455 } 2456 if (!alreadyHidden && controlAttribute) { 2457 node.setAttribute(controlAttribute, 'true'); 2458 } 2459 } 2460 }); 2461 } 2462 lockCount$1++; 2463 return ()=>{ 2464 hiddenElements.forEach((element)=>{ 2465 const counterValue = (counterMap.get(element) || 0) - 1; 2466 const markerValue = (markerCounter.get(element) || 0) - 1; 2467 counterMap.set(element, counterValue); 2468 markerCounter.set(element, markerValue); 2469 if (!counterValue) { 2470 if (!uncontrolledElementsSet.has(element) && controlAttribute) { 2471 element.removeAttribute(controlAttribute); 2472 } 2473 uncontrolledElementsSet.delete(element); 2474 } 2475 if (!markerValue) { 2476 element.removeAttribute(markerName); 2477 } 2478 }); 2479 lockCount$1--; 2480 if (!lockCount$1) { 2481 counterMap = new WeakMap(); 2482 counterMap = new WeakMap(); 2483 uncontrolledElementsSet = new WeakSet(); 2484 markerMap = {}; 2485 } 2486 }; 2487} 2488function markOthers(avoidElements, ariaHidden, inert) { 2489 if (ariaHidden === void 0) { 2490 ariaHidden = false; 2491 } 2492 if (inert === void 0) { 2493 inert = false; 2494 } 2495 const body = getDocument(avoidElements[0]).body; 2496 return applyAttributeToOthers(avoidElements.concat(Array.from(body.querySelectorAll('[aria-live]'))), body, ariaHidden, inert); 2497} 2498const getTabbableOptions = ()=>({ 2499 getShadowRoot: true, 2500 displayCheck: // JSDOM does not support the `tabbable` library. To solve this we can 2501 // check if `ResizeObserver` is a real function (not polyfilled), which 2502 // determines if the current environment is JSDOM-like. 2503 typeof ResizeObserver === 'function' && ResizeObserver.toString().includes('[native code]') ? 'full' : 'none' 2504 }); 2505function getTabbableIn(container, direction) { 2506 const allTabbable = (0, __TURBOPACK__imported__module__397126__["tabbable"])(container, getTabbableOptions()); 2507 if (direction === 'prev') { 2508 allTabbable.reverse(); 2509 } 2510 const activeIndex = allTabbable.indexOf(activeElement(getDocument(container))); 2511 const nextTabbableElements = allTabbable.slice(activeIndex + 1); 2512 return nextTabbableElements[0]; 2513} 2514function getNextTabbable() { 2515 return getTabbableIn(document.body, 'next'); 2516} 2517function getPreviousTabbable() { 2518 return getTabbableIn(document.body, 'prev'); 2519} 2520function isOutsideEvent(event, container) { 2521 const containerElement = container || event.currentTarget; 2522 const relatedTarget = event.relatedTarget; 2523 return !relatedTarget || !contains(containerElement, relatedTarget); 2524} 2525function disableFocusInside(container) { 2526 const tabbableElements = (0, __TURBOPACK__imported__module__397126__["tabbable"])(container, getTabbableOptions());
2527 tabbableElements.forEach((element)=>{ 2528 element.dataset.tabindex = element.getAttribute('tabindex') || ''; 2529 element.setAttribute('tabindex', '-1'); 2530 }); 2531} 2532function enableFocusInside(container) { 2533 const elements = container.querySelectorAll('[data-tabindex]'); 2534 elements.forEach((element)=>{ 2535 const tabindex = element.dataset.tabindex; 2536 delete element.dataset.tabindex; 2537 if (tabindex) { 2538 element.setAttribute('tabindex', tabindex); 2539 } else { 2540 element.removeAttribute('tabindex'); 2541 } 2542 }); 2543} 2544// See Diego Haz's Sandbox for making this logic work well on Safari/iOS: 2545// https://codesandbox.io/s/tabbable-portal-f4tng?file=/src/FocusTrap.tsx 2546const HIDDEN_STYLES = { 2547 border: 0, 2548 clip: 'rect(0 0 0 0)', 2549 height: '1px', 2550 margin: '-1px', 2551 overflow: 'hidden', 2552 padding: 0, 2553 position: 'fixed', 2554 whiteSpace: 'nowrap', 2555 width: '1px', 2556 top: 0, 2557 left: 0 2558}; 2559let timeoutId; 2560function setActiveElementOnTab(event) { 2561 if (event.key === 'Tab') { 2562 event.target; 2563 clearTimeout(timeoutId); 2564 } 2565} 2566const FocusGuard = /*#__PURE__*/ __TURBOPACK__imported__module__271645__1.forwardRef(function FocusGuard(props, ref) { 2567 const [role, setRole] = __TURBOPACK__imported__module__271645__1.useState(); 2568 index(()=>{ 2569 if (isSafari()) { 2570 // Unlike other screen readers such as NVDA and JAWS, the virtual cursor 2571 // on VoiceOver does trigger the onFocus event, so we can use the focus 2572 // trap element. On Safari, only buttons trigger the onFocus event. 2573 // NB: "group" role in the Sandbox no longer appears to work, must be a 2574 // button role. 2575 setRole('button'); 2576 } 2577 document.addEventListener('keydown', setActiveElementOnTab); 2578 return ()=>{ 2579 document.removeEventListener('keydown', setActiveElementOnTab); 2580 }; 2581 }, []); 2582 const restProps = { 2583 ref, 2584 tabIndex: 0, 2585 // Role is only for VoiceOver 2586 role, 2587 'aria-hidden': role ? undefined : true, 2588 [createAttribute('focus-guard')]: '', 2589 style: HIDDEN_STYLES 2590 }; 2591 return /*#__PURE__*/ __TURBOPACK__imported__module__271645__1.createElement("span", _extends({}, props, restProps)); 2592}); 2593const PortalContext = /*#__PURE__*/ __TURBOPACK__imported__module__271645__1.createContext(null); 2594const attr = /*#__PURE__*/ createAttribute('portal'); 2595/** 2596 * @see https://floating-ui.com/docs/FloatingPortal#usefloatingportalnode 2597 */ function useFloatingPortalNode(props) { 2598 if (props === void 0) { 2599 props = {}; 2600 } 2601 const { id, root } = props; 2602 const uniqueId = useId(); 2603 const portalContext = usePortalContext(); 2604 const [portalNode, setPortalNode] = __TURBOPACK__imported__module__271645__1.useState(null); 2605 const portalNodeRef = __TURBOPACK__imported__module__271645__1.useRef(null); 2606 index(()=>{ 2607 return ()=>{ 2608 portalNode == null || portalNode.remove(); 2609 // Allow the subsequent layout effects to create a new node on updates. 2610 // The portal node will still be cleaned up on unmount. 2611 // https://github.com/floating-ui/floating-ui/issues/2454 2612 queueMicrotask(()=>{ 2613 portalNodeRef.current = null; 2614 }); 2615 }; 2616 }, [ 2617 portalNode 2618 ]); 2619 index(()=>{ 2620 // Wait for the uniqueId to be generated before creating the portal node in 2621 // React <18 (using `useFloatingId` instead of the native `useId`). 2622 // https://github.com/floating-ui/floating-ui/issues/2778 2623 if (!uniqueId) return; 2624 if (portalNodeRef.current) return; 2625 const existingIdRoot = id ? document.getElementById(id) : null; 2626 if (!existingIdRoot) return; 2627 const subRoot = document.createElement('div'); 2628 subRoot.id = uniqueId; 2629 subRoot.setAttribute(attr, ''); 2630 existingIdRoot.appendChild(subRoot); 2631 portalNodeRef.current = subRoot; 2632 setPortalNode(subRoot); 2633 }, [ 2634 id, 2635 uniqueId 2636 ]); 2637 index(()=>{ 2638 // Wait for the root to exist before creating the portal node. The root must 2639 // be stored in state, not a ref, for this to work reactively. 2640 if (root === null) return; 2641 if (!uniqueId) return; 2642 if (portalNodeRef.current) return; 2643 let container = root || (portalContext == null ? void 0 : portalContext.portalNode); 2644 if (container && !(0, __TURBOPACK__imported__module__229315__1["isElement"])(container)) container = container.current; 2645 container = container || document.body; 2646 let idWrapper = null; 2647 if (id) { 2648 idWrapper = document.createElement('div'); 2649 idWrapper.id = id; 2650 container.appendChild(idWrapper); 2651 } 2652 const subRoot = document.createElement('div'); 2653 subRoot.id = uniqueId; 2654 subRoot.setAttribute(attr, ''); 2655 container = idWrapper || container; 2656 container.appendChild(subRoot); 2657 portalNodeRef.current = subRoot; 2658 setPortalNode(subRoot); 2659 }, [ 2660 id, 2661 root, 2662 uniqueId, 2663 portalContext 2664 ]); 2665 return portalNode; 2666} 2667/** 2668 * Portals the floating element into a given container element â by default, 2669 * outside of the app root and into the body. 2670 * This is necessary to ensure the floating element can appear outside any 2671 * potential parent containers that cause clipping (such as `overflow: hidden`), 2672 * while retaining its location in the React tree. 2673 * @see https://floating-ui.com/docs/FloatingPortal 2674 */ function FloatingPortal(props) { 2675 const { children, id, root, preserveTabOrder = true } = props;
2676 const portalNode = useFloatingPortalNode({ 2677 id, 2678 root 2679 }); 2680 const [focusManagerState, setFocusManagerState] = __TURBOPACK__imported__module__271645__1.useState(null); 2681 const beforeOutsideRef = __TURBOPACK__imported__module__271645__1.useRef(null); 2682 const afterOutsideRef = __TURBOPACK__imported__module__271645__1.useRef(null); 2683 const beforeInsideRef = __TURBOPACK__imported__module__271645__1.useRef(null); 2684 const afterInsideRef = __TURBOPACK__imported__module__271645__1.useRef(null); 2685 const modal = focusManagerState == null ? void 0 : focusManagerState.modal; 2686 const open = focusManagerState == null ? void 0 : focusManagerState.open; 2687 const shouldRenderGuards = // The FocusManager and therefore floating element are currently open/ 2688 // rendered. 2689 !!focusManagerState && // Guards are only for non-modal focus management. 2690 !focusManagerState.modal && // Don't render if unmount is transitioning. 2691 focusManagerState.open && preserveTabOrder && !!(root || portalNode); 2692 // https://codesandbox.io/s/tabbable-portal-f4tng?file=/src/TabbablePortal.tsx 2693 __TURBOPACK__imported__module__271645__1.useEffect(()=>{ 2694 if (!portalNode || !preserveTabOrder || modal) { 2695 return; 2696 } 2697 // Make sure elements inside the portal element are tabbable only when the 2698 // portal has already been focused, either by tabbing into a focus trap 2699 // element outside or using the mouse. 2700 function onFocus(event) { 2701 if (portalNode && isOutsideEvent(event)) { 2702 const focusing = event.type === 'focusin'; 2703 const manageFocus = focusing ? enableFocusInside : disableFocusInside; 2704 manageFocus(portalNode); 2705 } 2706 } 2707 // Listen to the event on the capture phase so they run before the focus 2708 // trap elements onFocus prop is called. 2709 portalNode.addEventListener('focusin', onFocus, true); 2710 portalNode.addEventListener('focusout', onFocus, true); 2711 return ()=>{ 2712 portalNode.removeEventListener('focusin', onFocus, true); 2713 portalNode.removeEventListener('focusout', onFocus, true); 2714 }; 2715 }, [ 2716 portalNode, 2717 preserveTabOrder, 2718 modal 2719 ]); 2720 __TURBOPACK__imported__module__271645__1.useEffect(()=>{ 2721 if (!portalNode) return; 2722 if (open) return; 2723 enableFocusInside(portalNode); 2724 }, [ 2725 open, 2726 portalNode 2727 ]); 2728 return /*#__PURE__*/ __TURBOPACK__imported__module__271645__1.createElement(PortalContext.Provider, { 2729 value: __TURBOPACK__imported__module__271645__1.useMemo(()=>({ 2730 preserveTabOrder, 2731 beforeOutsideRef, 2732 afterOutsideRef, 2733 beforeInsideRef, 2734 afterInsideRef, 2735 portalNode, 2736 setFocusManagerState 2737 }), [ 2738 preserveTabOrder, 2739 portalNode 2740 ]) 2741 }, shouldRenderGuards && portalNode && /*#__PURE__*/ __TURBOPACK__imported__module__271645__1.createElement(FocusGuard, { 2742 "data-type": "outside", 2743 ref: beforeOutsideRef, 2744 onFocus: (event)=>{ 2745 if (isOutsideEvent(event, portalNode)) { 2746 var _beforeInsideRef$curr; 2747 (_beforeInsideRef$curr = beforeInsideRef.current) == null || _beforeInsideRef$curr.focus(); 2748 } else { 2749 const prevTabbable = getPreviousTabbable() || (focusManagerState == null ? void 0 : focusManagerState.refs.domReference.current); 2750 prevTabbable == null || prevTabbable.focus(); 2751 } 2752 } 2753 }), shouldRenderGuards && portalNode && /*#__PURE__*/ __TURBOPACK__imported__module__271645__1.createElement("span", { 2754 "aria-owns": portalNode.id, 2755 style: HIDDEN_STYLES 2756 }), portalNode && /*#__PURE__*/ __TURBOPACK__imported__module__174080__["createPortal"](children, portalNode), shouldRenderGuards && portalNode && /*#__PURE__*/ __TURBOPACK__imported__module__271645__1.createElement(FocusGuard, { 2757 "data-type": "outside", 2758 ref: afterOutsideRef, 2759 onFocus: (event)=>{ 2760 if (isOutsideEvent(event, portalNode)) { 2761 var _afterInsideRef$curre; 2762 (_afterInsideRef$curre = afterInsideRef.current) == null || _afterInsideRef$curre.focus(); 2763 } else { 2764 const nextTabbable = getNextTabbable() || (focusManagerState == null ? void 0 : focu
2764sManagerState.refs.domReference.current); 2765 nextTabbable == null || nextTabbable.focus(); 2766 (focusManagerState == null ? void 0 : focusManagerState.closeOnFocusOut) && (focusManagerState == null ? void 0 : focusManagerState.onOpenChange(false, event.nativeEvent, 'focus-out')); 2767 } 2768 } 2769 })); 2770} 2771const usePortalContext = ()=>__TURBOPACK__imported__module__271645__1.useContext(PortalContext); 2772const FOCUSABLE_ATTRIBUTE = 'data-floating-ui-focusable'; 2773function getFloatingFocusElement(floatingElement) { 2774 if (!floatingElement) { 2775 return null; 2776 } 2777 // Try to find the element that has `{...getFloatingProps()}` spread on it. 2778 // This indicates the floating element is acting as a positioning wrapper, and 2779 // so focus should be managed on the child element with the event handlers and 2780 // aria props. 2781 return floatingElement.hasAttribute(FOCUSABLE_ATTRIBUTE) ? floatingElement : floatingElement.querySelector("[" + FOCUSABLE_ATTRIBUTE + "]") || floatingElement; 2782} 2783const LIST_LIMIT = 20; 2784let previouslyFocusedElements = []; 2785function addPreviouslyFocusedElement(element) { 2786 previouslyFocusedElements = previouslyFocusedElements.filter((el)=>el.isConnected); 2787 let tabbableEl = element; 2788 if (!tabbableEl || (0, __TURBOPACK__imported__module__229315__1["getNodeName"])(tabbableEl) === 'body') return; 2789 if (!(0, __TURBOPACK__imported__module__397126__["isTabbable"])(tabbableEl, getTabbableOptions())) { 2790 const tabbableChild = (0, __TURBOPACK__imported__module__397126__["tabbable"])(tabbableEl, getTabbableOptions())[0]; 2791 if (tabbableChild) { 2792 tabbableEl = tabbableChild; 2793 } 2794 } 2795 previouslyFocusedElements.push(tabbableEl); 2796 if (previouslyFocusedElements.length > LIST_LIMIT) { 2797 previouslyFocusedElements = previouslyFocusedElements.slice(-LIST_LIMIT); 2798 } 2799} 2800function getPreviouslyFocusedElement() { 2801 return previouslyFocusedElements.slice().reverse().find((el)=>el.isConnected); 2802} 2803const VisuallyHiddenDismiss = /*#__PURE__*/ __TURBOPACK__imported__module__271645__1.forwardRef(function VisuallyHiddenDismiss(props, ref) { 2804 return /*#__PURE__*/ __TURBOPACK__imported__module__271645__1.createElement("button", _extends({}, props, { 2805 type: "button", 2806 ref: ref, 2807 tabIndex: -1, 2808 style: HIDDEN_STYLES 2809 })); 2810}); 2811/** 2812 * Provides focus management for the floating element. 2813 * @see https://floating-ui.com/docs/FloatingFocusManager 2814 */ function FloatingFocusManager(props) { 2815 const { context, children, disabled = false, order = [ 2816 'content' 2817 ], guards: _guards = true, initialFocus = 0, returnFocus = true, restoreFocus = false, modal = true, visuallyHiddenDismiss = false, closeOnFocusOut = true } = props; 2818 const { open, refs, nodeId, onOpenChange, events, dataRef, floatingId, elements: { domReference, floating } } = context; 2819 const ignoreInitialFocus = typeof initialFocus === 'number' && initialFocus < 0; 2820 // If the reference is a combobox and is typeable (e.g. input/textarea), 2821 // there are different focus semantics. The guards should not be rendered, but 2822 // aria-hidden should be applied to all nodes still. Further, the visually 2823 // hidden dismiss button should only appear at the end of the list, not the 2824 // start. 2825 const isUntrappedTypeableCombobox = isTypeableCombobox(domReference) && ignoreInitialFocus; 2826 // Force the guards to be rendered if the `inert` attribute is not supported. 2827 const guards = supportsInert() ? _guards : true; 2828 const orderRef = useLatestRef(order); 2829 const initialFocusRef = useLatestRef(initialFocus); 2830 const returnFocusRef = useLatestRef(returnFocus); 2831 const tree = useFloatingTree(); 2832 const portalContext = usePortalContext(); 2833 const startDismissButtonRef = __TURBOPACK__imported__module__271645__1.useRef(null); 2834 const endDismissButtonRef = __TURBOPACK__imported__module__271645__1.useRef(null); 2835 const preventReturnFocusRef = __TURBOPACK__imported__module__271645__1.useRef(false); 2836 const isPointerDownRef = __TURBOPACK__imported__module__271645__1.useRef(false); 2837 const tabbableIndexRef = __TURBOPACK__imported__module__271645__1.useRef(-1); 2838 const isInsidePortal = portalContext != null; 2839 const floatingFocusElement = getFloatingFocusElement(floating); 2840 const getTabbableContent = useEffectEvent(function(container) { 2841 if (container === void 0) { 2842 container = floatingFocusElement; 2843 } 2844 return container ? (0, __TURBOPACK__imported__module__397126__["tabbable"])(container, getTabbableOptions()) : []; 2845 }); 2846 const getTabbableElements = useEffectEvent((container)=>{ 2847 const content = getTabbableContent(container); 2848 return orderRef.current.map((type)=>{ 2849 if (domReference && type === 'reference') { 2850 return domReference; 2851 } 2852 if (floatingFocusElement && type === 'floating') { 2853 return floatingFocusElement; 2854 } 2855 return content; 2856 }
2856).filter(Boolean).flat(); 2857 }); 2858 __TURBOPACK__imported__module__271645__1.useEffect(()=>{ 2859 if (disabled) return; 2860 if (!modal) return; 2861 function onKeyDown(event) { 2862 if (event.key === 'Tab') { 2863 // The focus guards have nothing to focus, so we need to stop the event. 2864 if (contains(floatingFocusElement, activeElement(getDocument(floatingFocusElement))) && getTabbableContent().length === 0 && !isUntrappedTypeableCombobox) { 2865 stopEvent(event); 2866 } 2867 const els = getTabbableElements(); 2868 const target = getTarget(event); 2869 if (orderRef.current[0] === 'reference' && target === domReference) { 2870 stopEvent(event); 2871 if (event.shiftKey) { 2872 enqueueFocus(els[els.length - 1]); 2873 } else { 2874 enqueueFocus(els[1]); 2875 } 2876 } 2877 if (orderRef.current[1] === 'floating' && target === floatingFocusElement && event.shiftKey) { 2878 stopEvent(event); 2879 enqueueFocus(els[0]); 2880 } 2881 } 2882 } 2883 const doc = getDocument(floatingFocusElement); 2884 doc.addEventListener('keydown', onKeyDown); 2885 return ()=>{ 2886 doc.removeEventListener('keydown', onKeyDown); 2887 }; 2888 }, [ 2889 disabled, 2890 domReference, 2891 floatingFocusElement, 2892 modal, 2893 orderRef, 2894 isUntrappedTypeableCombobox, 2895 getTabbableContent, 2896 getTabbableElements 2897 ]); 2898 __TURBOPACK__imported__module__271645__1.useEffect(()=>{ 2899 if (disabled) return; 2900 if (!floating) return; 2901 function handleFocusIn(event) { 2902 const target = getTarget(event); 2903 const tabbableContent = getTabbableContent(); 2904 const tabbableIndex = tabbableContent.indexOf(target); 2905 if (tabbableIndex !== -1) { 2906 tabbableIndexRef.current = tabbableIndex; 2907 } 2908 } 2909 floating.addEventListener('focusin', handleFocusIn); 2910 return ()=>{ 2911 floating.removeEventListener('focusin', handleFocusIn); 2912 }; 2913 }, [ 2914 disabled, 2915 floating, 2916 getTabbableContent 2917 ]); 2918 __TURBOPACK__imported__module__271645__1.useEffect(()=>{ 2919 if (disabled) return; 2920 if (!closeOnFocusOut) return; 2921 // In Safari, buttons lose focus when pressing them. 2922 function handlePointerDown() { 2923 isPointerDownRef.current = true; 2924 setTimeout(()=>{ 2925 isPointerDownRef.current = false; 2926 }); 2927 } 2928 function handleFocusOutside(event) { 2929 const relatedTarget = event.relatedTarget; 2930 queueMicrotask(()=>{ 2931 const movedToUnrelatedNode = !(contains(domReference, relatedTarget) || contains(floating, relatedTarget) || contains(relatedTarget, floating) || contains(portalContext == null ? void 0 : portalContext.portalNode, relatedTarget) || relatedTarget != null && relatedTarget.hasAttribute(createAttribute('focus-guard')) || tree && (getChildren(tree.nodesRef.current, nodeId).find((node)=>{ 2932 var _node$context, _node$context2; 2933 return contains((_node$context = node.context) == null ? void 0 : _node$context.elements.floating, relatedTarget) || contains((_node$context2 = node.context) == null ? void 0 : _node$context2.elements.domReference, relatedTarget); 2934 }) || getAncestors(tree.nodesRef.current, nodeId).find((node)=>{ 2935 var _node$context3, _node$context4; 2936 return ((_node$context3 = node.context) == null ? void 0 : _node$context3.elements.floating) === relatedTarget || ((_node$context4 = node.context) == null ? void 0 : _node$context4.elements.domReference) === relatedTarget; 2937 }))); 2938 // Restore focus to the previous tabbable element index to prevent 2939 // focus from being lost outside the floating tree. 2940 if (restoreFocus && movedToUnrelatedNode && activeElement(getDocument(floatingFocusElement)) === getDocument(floatingFocusElement).body) { 2941 // Let `FloatingPortal` effect knows that focus is still inside the 2942 // floating tree. 2943 if ((0, __TURBOPACK__imported__module__229315__1["isHTMLElement"])(floatingFocusElement)) { 2944 floatingFocusElement.focus(); 2945 } 2946 const prevTabbableIndex = tabbableIndexRef.current; 2947 const tabbableContent = getTabbableContent(); 2948 const nodeToFocus = tabbableContent[prevTabbableIndex] || tabbableContent[tabbableContent.length - 1] || floatingFocusElement; 2949 if ((0, __TURBOPACK__imported__module__229315__1["isHTMLElement"])(nodeToFocus)) { 2950 nodeToFocus.focus(); 2951 } 2952 } 2953 // Focus did not move inside the floating tree, and there are no tabbable 2954 // portal guards to handle closing. 2955 if ((isUntrappedTypeableCombobox ? true : !modal) && relatedTarget && movedToUnrelatedNode && !isPointerDownRef.current && // Fix React 18 Str
2955ict Mode returnFocus due to double rendering. 2956 relatedTarget !== getPreviouslyFocusedElement()) { 2957 preventReturnFocusRef.current = true; 2958 onOpenChange(false, event, 'focus-out'); 2959 } 2960 }); 2961 } 2962 if (floating && (0, __TURBOPACK__imported__module__229315__1["isHTMLElement"])(domReference)) { 2963 domReference.addEventListener('focusout', handleFocusOutside); 2964 domReference.addEventListener('pointerdown', handlePointerDown); 2965 floating.addEventListener('focusout', handleFocusOutside); 2966 return ()=>{ 2967 domReference.removeEventListener('focusout', handleFocusOutside); 2968 domReference.removeEventListener('pointerdown', handlePointerDown); 2969 floating.removeEventListener('focusout', handleFocusOutside); 2970 }; 2971 } 2972 }, [ 2973 disabled, 2974 domReference, 2975 floating, 2976 floatingFocusElement, 2977 modal, 2978 nodeId, 2979 tree, 2980 portalContext, 2981 onOpenChange, 2982 closeOnFocusOut, 2983 restoreFocus, 2984 getTabbableContent, 2985 isUntrappedTypeableCombobox 2986 ]); 2987 __TURBOPACK__imported__module__271645__1.useEffect(()=>{ 2988 var _portalContext$portal; 2989 if (disabled) return; 2990 // Don't hide portals nested within the parent portal. 2991 const portalNodes = Array.from((portalContext == null || (_portalContext$portal = portalContext.portalNode) == null ? void 0 : _portalContext$portal.querySelectorAll("[" + createAttribute('portal') + "]")) || []); 2992 if (floating) { 2993 const insideElements = [ 2994 floating, 2995 ...portalNodes, 2996 startDismissButtonRef.current, 2997 endDismissButtonRef.current, 2998 orderRef.current.includes('reference') || isUntrappedTypeableCombobox ? domReference : null 2999 ].filter((x)=>x != null); 3000 const cleanup = modal || isUntrappedTypeableCombobox ? markOthers(insideElements, guards, !guards) : markOthers(insideElements); 3001 return ()=>{ 3002 cleanup(); 3003 }; 3004 } 3005 }, [ 3006 disabled, 3007 domReference, 3008 floating, 3009 modal, 3010 orderRef, 3011 portalContext, 3012 isUntrappedTypeableCombobox, 3013 guards 3014 ]); 3015 index(()=>{ 3016 if (disabled || !(0, __TURBOPACK__imported__module__229315__1["isHTMLElement"])(floatingFocusElement)) return; 3017 const doc = getDocument(floatingFocusElement); 3018 const previouslyFocusedElement = activeElement(doc); 3019 // Wait for any layout effect state setters to execute to set `tabIndex`. 3020 queueMicrotask(()=>{ 3021 const focusableElements = getTabbableElements(floatingFocusElement); 3022 const initialFocusValue = initialFocusRef.current; 3023 const elToFocus = (typeof initialFocusValue === 'number' ? focusableElements[initialFocusValue] : initialFocusValue.current) || floatingFocusElement; 3024 const focusAlreadyInsideFloatingEl = contains(floatingFocusElement, previouslyFocusedElement); 3025 if (!ignoreInitialFocus && !focusAlreadyInsideFloatingEl && open) { 3026 enqueueFocus(elToFocus, { 3027 preventScroll: elToFocus === floatingFocusElement 3028 }); 3029 } 3030 }); 3031 }, [ 3032 disabled, 3033 open, 3034 floatingFocusElement, 3035 ignoreInitialFocus, 3036 getTabbableElements, 3037 initialFocusRef 3038 ]); 3039 index(()=>{ 3040 if (disabled || !floatingFocusElement) return; 3041 let preventReturnFocusScroll = false; 3042 const doc = getDocument(floatingFocusElement); 3043 const previouslyFocusedElement = activeElement(doc); 3044 const contextData = dataRef.current; 3045 let openEvent = contextData.openEvent; 3046 addPreviouslyFocusedElement(previouslyFocusedElement); 3047 // Dismissing via outside press should always ignore `returnFocus` to 3048 // prevent unwanted scrolling. 3049 function onOpenChange(_ref) { 3050 let { open, reason, event, nested } = _ref; 3051 if (open) { 3052 openEvent = event; 3053 } 3054 if (reason === 'escape-key' && refs.domReference.current) { 3055 addPreviouslyFocusedElement(refs.domReference.current); 3056 } 3057 if (reason === 'hover' && event.type === 'mouseleave') { 3058 preventReturnFocusRef.current = true; 3059 } 3060 if (reason !== 'outside-press') return; 3061 if (nested) { 3062 preventReturnFocusRef.current = false;
3063 preventReturnFocusScroll = true; 3064 } else { 3065 preventReturnFocusRef.current = !(isVirtualClick(event) || isVirtualPointerEvent(event)); 3066 } 3067 } 3068 events.on('openchange', onOpenChange); 3069 const fallbackEl = doc.createElement('span'); 3070 fallbackEl.setAttribute('tabindex', '-1'); 3071 fallbackEl.setAttribute('aria-hidden', 'true'); 3072 Object.assign(fallbackEl.style, HIDDEN_STYLES); 3073 if (isInsidePortal && domReference) { 3074 domReference.insertAdjacentElement('afterend', fallbackEl); 3075 } 3076 function getReturnElement() { 3077 if (typeof returnFocusRef.current === 'boolean') { 3078 return getPreviouslyFocusedElement() || fallbackEl; 3079 } 3080 return returnFocusRef.current.current || fallbackEl; 3081 } 3082 return ()=>{ 3083 events.off('openchange', onOpenChange); 3084 const activeEl = activeElement(doc); 3085 const isFocusInsideFloatingTree = contains(floating, activeEl) || tree && getChildren(tree.nodesRef.current, nodeId).some((node)=>{ 3086 var _node$context5; 3087 return contains((_node$context5 = node.context) == null ? void 0 : _node$context5.elements.floating, activeEl); 3088 }); 3089 const shouldFocusReference = isFocusInsideFloatingTree || openEvent && [ 3090 'click', 3091 'mousedown' 3092 ].includes(openEvent.type); 3093 if (shouldFocusReference && refs.domReference.current) { 3094 addPreviouslyFocusedElement(refs.domReference.current); 3095 } 3096 const returnElement = getReturnElement(); 3097 queueMicrotask(()=>{ 3098 if (// eslint-disable-next-line react-hooks/exhaustive-deps 3099 returnFocusRef.current && !preventReturnFocusRef.current && (0, __TURBOPACK__imported__module__229315__1["isHTMLElement"])(returnElement) && (// If the focus moved somewhere else after mount, avoid returning focus 3100 // since it likely entered a different element which should be 3101 // respected: https://github.com/floating-ui/floating-ui/issues/2607 3102 returnElement !== activeEl && activeEl !== doc.body ? isFocusInsideFloatingTree : true)) { 3103 returnElement.focus({ 3104 preventScroll: preventReturnFocusScroll 3105 }); 3106 } 3107 fallbackEl.remove(); 3108 }); 3109 }; 3110 }, [ 3111 disabled, 3112 floating, 3113 floatingFocusElement, 3114 returnFocusRef, 3115 dataRef, 3116 refs, 3117 events, 3118 tree, 3119 nodeId, 3120 isInsidePortal, 3121 domReference 3122 ]); 3123 __TURBOPACK__imported__module__271645__1.useEffect(()=>{ 3124 // The `returnFocus` cleanup behavior is inside a microtask; ensure we 3125 // wait for it to complete before resetting the flag. 3126 queueMicrotask(()=>{ 3127 preventReturnFocusRef.current = false; 3128 }); 3129 }, [ 3130 disabled 3131 ]); 3132 // Synchronize the `context` & `modal` value to the FloatingPortal context. 3133 // It will decide whether or not it needs to render its own guards. 3134 index(()=>{ 3135 if (disabled) return; 3136 if (!portalContext) return; 3137 portalContext.setFocusManagerState({ 3138 modal, 3139 closeOnFocusOut, 3140 open, 3141 onOpenChange, 3142 refs 3143 }); 3144 return ()=>{ 3145 portalContext.setFocusManagerState(null); 3146 }; 3147 }, [ 3148 disabled, 3149 portalContext, 3150 modal, 3151 open, 3152 onOpenChange, 3153 refs, 3154 closeOnFocusOut 3155 ]); 3156 index(()=>{ 3157 if (disabled) return; 3158 if (!floatingFocusElement) return; 3159 if (typeof MutationObserver !== 'function') return; 3160 if (ignoreInitialFocus) return; 3161 const handleMutation = ()=>{ 3162 const tabIndex = floatingFocusElement.getAttribute('tabindex'); 3163 const tabbableContent = getTabbableContent(); 3164 const activeEl = activeElement(getDocument(floating)); 3165 const tabbableIndex = tabbableContent.indexOf(activeEl); 3166 if (tabbableIndex !== -1) { 3167 tabbableIndexRef.current = tabbableIndex; 3168 } 3169 if (orderRef.current.includes('floating') || activeEl !== refs.domReference.current && tabbableContent.length === 0) { 3170 if (tabIndex !== '0') { 3171 floatingFocusElement.setAttribute('tabindex', '0'); 3172 } 3173 } else if (tabIndex !== '-1') { 3174 floatingFocusElement.setAttribute('tabindex', '-1'); 3175 } 3176 }; 3177 handleMutation(); 3178 const observer = new MutationObserver(handleMutation); 3179 observer.observe(floatingFocusElement, { 3180 childList: true, 3181 subtree: true, 3182 attributes: true 3183 }); 3184 return ()=>{ 3185 observer.disconnect(); 3186 }; 3187 }, [ 3188 disabled, 3189 floating, 3190 floatingFocusElement, 3191 refs, 3192 orderRef, 3193 getTabbableContent, 3194 ignoreInitialFocus 3195 ]); 3196 function renderDismissButton(location) { 3197 if (disabled || !visuallyHiddenDismiss || !modal) { 3198 return null; 3199 } 3200 return /*#__PURE__*/ __TURBOPACK__imported__module__271645__1.createElement(VisuallyHiddenDismiss, { 3201 ref: location === 'start' ? startDismissButtonRef : endDismissButtonRef, 3202 onClick: (event)=>onOpenChange(false, event.nativeEvent) 3203 }, typeof visuallyHiddenDismiss === 'string' ? visuallyHiddenDismiss : 'Dismiss'); 3204 } 3205 const shouldRenderGuards = !disabled && guards && (modal ? !isUntrappedTypeableCombobox : true) && (isInsidePortal || modal); 3206 return /*#__PURE__*/ __TURBOPACK__imported__module__271645__1.createElement(__TURBOPACK__imported__module__271645__1.Fragment, null, shouldRenderGuards && /*#__PURE__*/ __TURBOPACK__imported__module__271645__1.createElement(FocusGuard, { 3207 "data-type": "inside", 3208 ref: portalContext == null ? void 0 : portalContext.beforeInsideRef, 3209 onFocus: (event)=>{ 3210 if (modal) { 3211 const els = getTabbableElements(); 3212 enqueueFocus(order[0] === 'reference' ? els[0] : els[els.length - 1]); 3213 } else if (portalContext != null && portalContext.preserveTabOrder && portalContext.portalNode) { 3214 preventReturnFocusRef.current = false;
3215 if (isOutsideEvent(event, portalContext.portalNode)) { 3216 const nextTabbable = getNextTabbable() || domReference; 3217 nextTabbable == null || nextTabbable.focus(); 3218 } else { 3219 var _portalContext$before; 3220 (_portalContext$before = portalContext.beforeOutsideRef.current) == null || _portalContext$before.focus(); 3221 } 3222 } 3223 } 3224 }), !isUntrappedTypeableCombobox && renderDismissButton('start'), children, renderDismissButton('end'), shouldRenderGuards && /*#__PURE__*/ __TURBOPACK__imported__module__271645__1.createElement(FocusGuard, { 3225 "data-type": "inside", 3226 ref: portalContext == null ? void 0 : portalContext.afterInsideRef, 3227 onFocus: (event)=>{ 3228 if (modal) { 3229 enqueueFocus(getTabbableElements()[0]); 3230 } else if (portalContext != null && portalContext.preserveTabOrder && portalContext.portalNode) { 3231 if (closeOnFocusOut) { 3232 preventReturnFocusRef.current = true; 3233 } 3234 if (isOutsideEvent(event, portalContext.portalNode)) { 3235 const prevTabbable = getPreviousTabbable() || domReference; 3236 prevTabbable == null || prevTabbable.focus(); 3237 } else { 3238 var _portalContext$afterO; 3239 (_portalContext$afterO = portalContext.afterOutsideRef.current) == null || _portalContext$afterO.focus(); 3240 } 3241 } 3242 } 3243 })); 3244} 3245let lockCount = 0; 3246function enableScrollLock() { 3247 const isIOS = /iP(hone|ad|od)|iOS/.test(getPlatform()); 3248 const bodyStyle = document.body.style; 3249 // RTL <body> scrollbar 3250 const scrollbarX = Math.round(document.documentElement.getBoundingClientRect().left) + document.documentElement.scrollLeft; 3251 const paddingProp = scrollbarX ? 'paddingLeft' : 'paddingRight'; 3252 const scrollbarWidth = window.innerWidth - document.documentElement.clientWidth; 3253 const scrollX = bodyStyle.left ? parseFloat(bodyStyle.left) : window.scrollX; 3254 const scrollY = bodyStyle.top ? parseFloat(bodyStyle.top) : window.scrollY; 3255 bodyStyle.overflow = 'hidden'; 3256 if (scrollbarWidth) { 3257 bodyStyle[paddingProp] = scrollbarWidth + "px"; 3258 } 3259 // Only iOS doesn't respect `overflow: hidden` on document.body, and this 3260 // technique has fewer side effects. 3261 if (isIOS) { 3262 var _window$visualViewpor, _window$visualViewpor2; 3263 // iOS 12 does not support `visualViewport`. 3264 const offsetLeft = ((_window$visualViewpor = window.visualViewport) == null ? void 0 : _window$visualViewpor.offsetLeft) || 0; 3265 const offsetTop = ((_window$visualViewpor2 = window.visualViewport) == null ? void 0 : _window$visualViewpor2.offsetTop) || 0; 3266 Object.assign(bodyStyle, { 3267 position: 'fixed', 3268 top: -(scrollY - Math.floor(offsetTop)) + "px", 3269 left: -(scrollX - Math.floor(offsetLeft)) + "px", 3270 right: '0' 3271 }); 3272 } 3273 return ()=>{ 3274 Object.assign(bodyStyle, { 3275 overflow: '', 3276 [paddingProp]: '' 3277 }); 3278 if (isIOS) { 3279 Object.assign(bodyStyle, { 3280 position: '', 3281 top: '', 3282 left: '', 3283 right: '' 3284 }); 3285 window.scrollTo(scrollX, scrollY); 3286 } 3287 }; 3288} 3289let cleanup = ()=>{}; 3290/** 3291 * Provides base styling for a fixed overlay element to dim content or block 3292 * pointer events behind a floating element. 3293 * It's a regular `<div>`, so it can be styled via any CSS solution you prefer. 3294 * @see https://floating-ui.com/docs/FloatingOverlay 3295 */ const FloatingOverlay = /*#__PURE__*/ __TURBOPACK__imported__module__271645__1.forwardRef(function FloatingOverlay(props, ref) { 3296 const { lockScroll = false, ...rest } = props; 3297 index(()=>{ 3298 if (!lockScroll) return; 3299 lockCount++; 3300 if (lockCount === 1) { 3301 cleanup = enableScrollLock(); 3302 } 3303 return ()=>{ 3304 lockCount--; 3305 if (lockCount === 0) { 3306 cleanup(); 3307 } 3308 }; 3309 }, [ 3310 lockScroll 3311 ]); 3312 return /*#__PURE__*/ __TURBOPACK__imported__module__271645__1.createElement("div", _extends({ 3313 ref: ref 3314 }, rest, { 3315 style: { 3316 position: 'fixed', 3317 overflow: 'auto', 3318 top: 0, 3319 right: 0, 3320 bottom: 0, 3321 left: 0, 3322 ...rest.style 3323 } 3324 })); 3325}); 3326function isButtonTarget(event) { 3327 return (0, __TURBOPACK__imported__module__229315__1["isHTMLElement"])(event.target) && event.target.tagName === 'BUTTON'; 3328} 3329function isSpaceIgnored(element) { 3330 return isTypeableElement(element); 3331} 3332/** 3333 * Opens or closes the floating element when clicking the reference element. 3334 * @see https://floating-ui.com/docs/useClick 3335 */ function useClick(context, props) { 3336 if (props === void 0) { 3337 props = {}; 3338 } 3339 const { open, onOpenChange, dataRef, elements: { domReference } } = context; 3340 const { enabled = true, event: eventOption = 'click', toggle = true, ignoreMouse = false, keyboardHandlers = true, stickIfOpen = true } = props; 3341 const pointerTypeRef = __TURBOPACK__imported__module__271645__1.useRef(); 3342 const didKeyDownRef = __TURBOPACK__imported__module__271645__1.useRef(false); 3343 const reference = __TURBOPACK__imported__module__271645__1.useMemo(()=>({ 3344 onPointerDown (event) { 3345 pointerTypeRef.current = event.pointerType; 3346 }, 3347 onMouseDown (event) { 3348 const pointerType = pointerTypeRef.current; 3349 // Ignore all buttons except for the "main" button. 3350 // https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/button 3351 if (event.button !== 0) return; 3352 if (eventOption === 'click') return; 3353 if (isMouseLikePointerType(pointerType, true) && ignoreMouse) return; 3354 if (open && toggle && (dataRef.current.openEvent && stickIfOpen ? dataRef.current.openEvent.type === 'mousedown' : true)) { 3355 onOpenChange(false, event.nativeEvent, 'click'); 3356 } else { 3357 // Prevent stealing focus from the floating element 3358 event.preventDefault(); 3359 onOpenChange(true, event.nativeEvent, 'click'); 3360 } 3361 }, 3362 onClick (event) { 3363 const pointerType = pointerTypeRef.current; 3364 if (eventOption === 'mousedown' && pointerTypeRef.current) { 3365 pointerTypeRef.current = undefined; 3366 return; 3367 } 3368 if (isMouseLikePointerType(pointerType, true) && ignoreMouse) return; 3369 if (open && toggle && (dataRef.current.openEvent && stickIfOpen ? dataRef.current.openEvent.type === 'click' : true)) { 3370 onOpenChange(false, event.nativeEvent, 'click'); 3371 } else { 3372 onOpenChange(true, event.nativeEvent, 'click'); 3373 } 3374 }, 3375 onKeyDown (event) { 3376 pointerTypeRef.current = undefined; 3377 if (event.defaultPrevented || !keyboardHandlers || isButtonTarget(event)) { 3378 return; 3379 } 3380 if (event.key === ' ' && !isSpaceIgnored(domReference)) { 3381 // Prevent scrolling 3382 event.preventDefault(); 3383 didKeyDownRef.current = true; 3384 } 3385 if (event.key === 'Enter') { 3386 if (open && toggle) { 3387 onOpenChange(false, event.nativeEvent, 'click'); 3388 } else { 3389 onOpenChange(true, event.nativeEvent, 'click'); 3390 } 3391 } 3392 }, 3393 onKeyUp (event) { 3394 if (event.defaultPrevented || !keyboardHandlers || isButtonTarget(event) || isSpaceIgnored(domReference)) { 3395 return; 3396 } 3397 if (event.key === ' ' && didKeyDownRef.current) { 3398 didKeyDownRef.current = false;
3399 if (open && toggle) { 3400 onOpenChange(false, event.nativeEvent, 'click'); 3401 } else { 3402 onOpenChange(true, event.nativeEvent, 'click'); 3403 } 3404 } 3405 } 3406 }), [ 3407 dataRef, 3408 domReference, 3409 eventOption, 3410 ignoreMouse, 3411 keyboardHandlers, 3412 onOpenChange, 3413 open, 3414 stickIfOpen, 3415 toggle 3416 ]); 3417 return __TURBOPACK__imported__module__271645__1.useMemo(()=>enabled ? { 3418 reference 3419 } : {}, [ 3420 enabled, 3421 reference 3422 ]); 3423} 3424function createVirtualElement(domElement, data) { 3425 let offsetX = null; 3426 let offsetY = null; 3427 let isAutoUpdateEvent = false; 3428 return { 3429 contextElement: domElement || undefined, 3430 getBoundingClientRect () { 3431 var _data$dataRef$current; 3432 const domRect = (domElement == null ? void 0 : domElement.getBoundingClientRect()) || { 3433 width: 0, 3434 height: 0, 3435 x: 0, 3436 y: 0 3437 }; 3438 const isXAxis = data.axis === 'x' || data.axis === 'both'; 3439 const isYAxis = data.axis === 'y' || data.axis === 'both'; 3440 const canTrackCursorOnAutoUpdate = [ 3441 'mouseenter', 3442 'mousemove' 3443 ].includes(((_data$dataRef$current = data.dataRef.current.openEvent) == null ? void 0 : _data$dataRef$current.type) || '') && data.pointerType !== 'touch'; 3444 let width = domRect.width; 3445 let height = domRect.height; 3446 let x = domRect.x; 3447 let y = domRect.y; 3448 if (offsetX == null && data.x && isXAxis) { 3449 offsetX = domRect.x - data.x; 3450 } 3451 if (offsetY == null && data.y && isYAxis) { 3452 offsetY = domRect.y - data.y; 3453 } 3454 x -= offsetX || 0; 3455 y -= offsetY || 0; 3456 width = 0; 3457 height = 0; 3458 if (!isAutoUpdateEvent || canTrackCursorOnAutoUpdate) { 3459 width = data.axis === 'y' ? domRect.width : 0; 3460 height = data.axis === 'x' ? domRect.height : 0; 3461 x = isXAxis && data.x != null ? data.x : x; 3462 y = isYAxis && data.y != null ? data.y : y; 3463 } else if (isAutoUpdateEvent && !canTrackCursorOnAutoUpdate) { 3464 height = data.axis === 'x' ? domRect.height : height; 3465 width = data.axis === 'y' ? domRect.width : width; 3466 } 3467 isAutoUpdateEvent = true; 3468 return { 3469 width, 3470 height, 3471 x, 3472 y, 3473 top: y, 3474 right: x + width, 3475 bottom: y + height, 3476 left: x 3477 }; 3478 } 3479 }; 3480} 3481function isMouseBasedEvent(event) { 3482 return event != null && event.clientX != null; 3483} 3484/** 3485 * Positions the floating element relative to a client point (in the viewport), 3486 * such as the mouse position. By default, it follows the mouse cursor. 3487 * @see https://floating-ui.com/docs/useClientPoint 3488 */ function useClientPoint(context, props) { 3489 if (props === void 0) { 3490 props = {}; 3491 } 3492 const { open, dataRef, elements: { floating, domReference }, refs } = context; 3493 const { enabled = true, axis = 'both', x = null, y = null } = props; 3494 const initialRef = __TURBOPACK__imported__module__271645__1.useRef(false); 3495 const cleanupListenerRef = __TURBOPACK__imported__module__271645__1.useRef(null); 3496 const [pointerType, setPointerType] = __TURBOPACK__imported__module__271645__1.useState(); 3497 const [reactive, setReactive] = __TURBOPACK__imported__module__271645__1.useState([]); 3498 const setReference = useEffectEvent((x, y)=>{ 3499 if (initialRef.current) return; 3500 // Prevent setting if the open event was not a mouse-like one 3501 // (e.g. focus to open, then hover over the reference element). 3502 // Only apply if the event exists. 3503 if (dataRef.current.openEvent && !isMouseBasedEvent(dataRef.current.openEvent)) { 3504 return; 3505 }
3506 refs.setPositionReference(createVirtualElement(domReference, { 3507 x, 3508 y, 3509 axis, 3510 dataRef, 3511 pointerType 3512 })); 3513 }); 3514 const handleReferenceEnterOrMove = useEffectEvent((event)=>{ 3515 if (x != null || y != null) return; 3516 if (!open) { 3517 setReference(event.clientX, event.clientY); 3518 } else if (!cleanupListenerRef.current) { 3519 // If there's no cleanup, there's no listener, but we want to ensure 3520 // we add the listener if the cursor landed on the floating element and 3521 // then back on the reference (i.e. it's interactive). 3522 setReactive([]); 3523 } 3524 }); 3525 // If the pointer is a mouse-like pointer, we want to continue following the 3526 // mouse even if the floating element is transitioning out. On touch 3527 // devices, this is undesirable because the floating element will move to 3528 // the dismissal touch point. 3529 const openCheck = isMouseLikePointerType(pointerType) ? floating : open; 3530 const addListener = __TURBOPACK__imported__module__271645__1.useCallback(()=>{ 3531 // Explicitly specified `x`/`y` coordinates shouldn't add a listener. 3532 if (!openCheck || !enabled || x != null || y != null) return; 3533 const win = (0, __TURBOPACK__imported__module__229315__1["getWindow"])(floating); 3534 function handleMouseMove(event) { 3535 const target = getTarget(event); 3536 if (!contains(floating, target)) { 3537 setReference(event.clientX, event.clientY); 3538 } else { 3539 win.removeEventListener('mousemove', handleMouseMove); 3540 cleanupListenerRef.current = null; 3541 } 3542 } 3543 if (!dataRef.current.openEvent || isMouseBasedEvent(dataRef.current.openEvent)) { 3544 win.addEventListener('mousemove', handleMouseMove); 3545 const cleanup = ()=>{ 3546 win.removeEventListener('mousemove', handleMouseMove); 3547 cleanupListenerRef.current = null; 3548 }; 3549 cleanupListenerRef.current = cleanup; 3550 return cleanup; 3551 } 3552 refs.setPositionReference(domReference); 3553 }, [ 3554 openCheck, 3555 enabled, 3556 x, 3557 y, 3558 floating, 3559 dataRef, 3560 refs, 3561 domReference, 3562 setReference 3563 ]); 3564 __TURBOPACK__imported__module__271645__1.useEffect(()=>{ 3565 return addListener(); 3566 }, [ 3567 addListener, 3568 reactive 3569 ]); 3570 __TURBOPACK__imported__module__271645__1.useEffect(()=>{ 3571 if (enabled && !floating) { 3572 initialRef.current = false; 3573 } 3574 }, [ 3575 enabled, 3576 floating 3577 ]); 3578 __TURBOPACK__imported__module__271645__1.useEffect(()=>{ 3579 if (!enabled && open) { 3580 initialRef.current = true; 3581 } 3582 }, [ 3583 enabled, 3584 open 3585 ]); 3586 index(()=>{ 3587 if (enabled && (x != null || y != null)) { 3588 initialRef.current = false; 3589 setReference(x, y); 3590 } 3591 }, [ 3592 enabled, 3593 x, 3594 y, 3595 setReference 3596 ]); 3597 const reference = __TURBOPACK__imported__module__271645__1.useMemo(()=>{ 3598 function setPointerTypeRef(_ref) { 3599 let { pointerType } = _ref; 3600 setPointerType(pointerType); 3601 } 3602 return { 3603 onPointerDown: setPointerTypeRef, 3604 onPointerEnter: setPointerTypeRef, 3605 onMouseMove: handleReferenceEnterOrMove, 3606 onMouseEnter: handleReferenceEnterOrMove 3607 }; 3608 }, [ 3609 handleReferenceEnterOrMove 3610 ]); 3611 return __TURBOPACK__imported__module__271645__1.useMemo(()=>enabled ? { 3612 reference 3613 } : {}, [ 3614 enabled, 3615 reference 3616 ]); 3617} 3618const bubbleHandlerKeys = { 3619 pointerdown: 'onPointerDown', 3620 mousedown: 'onMouseDown', 3621 click: 'onClick' 3622}; 3623const captureHandlerKeys = { 3624 pointerdown: 'onPointerDownCapture', 3625 mousedown: 'onMouseDownCapture', 3626 click: 'onClickCapture' 3627}; 3628const normalizeProp = (normalizable)=>{ 3629 var _normalizable$escapeK, _normalizable$outside; 3630 return { 3631 escapeKey: typeof normalizable === 'boolean' ? normalizable : (_normalizable$escapeK = normalizable == null ? void 0 : normalizable.escapeKey) != null ? _normalizable$escapeK : false, 3632 outsidePress: typeof normalizable === 'boolean' ? normalizable : (_normalizable$outside = normalizable == null ? void 0 : normalizable.outsidePress) != null ? _normalizable$outside : true 3633 }; 3634}; 3635/** 3636 * Closes the floating element when a dismissal is requested â by default, when 3637 * the user presses the `escape` key or outside of the floating element. 3638 * @see https://floating-ui.com/docs/useDismiss 3639 */ function useDismiss(context, props) { 3640 if (props === void 0) { 3641 props = {}; 3642 } 3643 const { open, onOpenChange, elements, dataRef } = context; 3644 const { enabled = true, escapeKey = true, outsidePress: unstable_outsidePress = true, outsidePressEvent = 'pointerdown', referencePress = false, referencePressEvent = 'pointerdown', ancestorScroll = false, bubbles, c
3644apture } = props; 3645 const tree = useFloatingTree(); 3646 const outsidePressFn = useEffectEvent(typeof unstable_outsidePress === 'function' ? unstable_outsidePress : ()=>false); 3647 const outsidePress = typeof unstable_outsidePress === 'function' ? outsidePressFn : unstable_outsidePress; 3648 const insideReactTreeRef = __TURBOPACK__imported__module__271645__1.useRef(false); 3649 const endedOrStartedInsideRef = __TURBOPACK__imported__module__271645__1.useRef(false); 3650 const { escapeKey: escapeKeyBubbles, outsidePress: outsidePressBubbles } = normalizeProp(bubbles); 3651 const { escapeKey: escapeKeyCapture, outsidePress: outsidePressCapture } = normalizeProp(capture); 3652 const isComposingRef = __TURBOPACK__imported__module__271645__1.useRef(false); 3653 const closeOnEscapeKeyDown = useEffectEvent((event)=>{ 3654 var _dataRef$current$floa; 3655 if (!open || !enabled || !escapeKey || event.key !== 'Escape') { 3656 return; 3657 } 3658 // Wait until IME is settled. Pressing `Escape` while composing should 3659 // close the compose menu, but not the floating element. 3660 if (isComposingRef.current) { 3661 return; 3662 } 3663 const nodeId = (_dataRef$current$floa = dataRef.current.floatingContext) == null ? void 0 : _dataRef$current$floa.nodeId; 3664 const children = tree ? getChildren(tree.nodesRef.current, nodeId) : []; 3665 if (!escapeKeyBubbles) { 3666 event.stopPropagation(); 3667 if (children.length > 0) { 3668 let shouldDismiss = true; 3669 children.forEach((child)=>{ 3670 var _child$context; 3671 if ((_child$context = child.context) != null && _child$context.open && !child.context.dataRef.current.__escapeKeyBubbles) { 3672 shouldDismiss = false; 3673 return; 3674 } 3675 }); 3676 if (!shouldDismiss) { 3677 return; 3678 } 3679 } 3680 } 3681 onOpenChange(false, isReactEvent(event) ? event.nativeEvent : event, 'escape-key'); 3682 }); 3683 const closeOnEscapeKeyDownCapture = useEffectEvent((event)=>{ 3684 var _getTarget2; 3685 const callback = ()=>{ 3686 var _getTarget; 3687 closeOnEscapeKeyDown(event); 3688 (_getTarget = getTarget(event)) == null || _getTarget.removeEventListener('keydown', callback); 3689 }; 3690 (_getTarget2 = getTarget(event)) == null || _getTarget2.addEventListener('keydown', callback); 3691 }); 3692 const closeOnPressOutside = useEffectEvent((event)=>{ 3693 var _dataRef$current$floa2; 3694 // Given developers can stop the propagation of the synthetic event, 3695 // we can only be confident with a positive value. 3696 const insideReactTree = insideReactTreeRef.current; 3697 insideReactTreeRef.current = false; 3698 // When click outside is lazy (`click` event), handle dragging. 3699 // Don't close if: 3700 // - The click started inside the floating element. 3701 // - The click ended inside the floating element. 3702 const endedOrStartedInside = endedOrStartedInsideRef.current; 3703 endedOrStartedInsideRef.current = false; 3704 if (outsidePressEvent === 'click' && endedOrStartedInside) { 3705 return; 3706 } 3707 if (insideReactTree) { 3708 return; 3709 } 3710 if (typeof outsidePress === 'function' && !outsidePress(event)) { 3711 return; 3712 } 3713 const target = getTarget(event); 3714 const inertSelector = "[" + createAttribute('inert') + "]"; 3715 const markers = getDocument(elements.floating).querySelectorAll(inertSelector); 3716 let targetRootAncestor = (0, __TURBOPACK__imported__module__229315__1["isElement"])(target) ? target : null; 3717 while(targetRootAncestor && !(0, __TURBOPACK__imported__module__229315__1["isLastTraversableNode"])(targetRootAncestor)){ 3718 const nextParent = (0, __TURBOPACK__imported__module__229315__1["getParentNode"])(targetRootAncestor); 3719 if ((0, __TURBOPACK__imported__module__229315__1["isLastTraversableNode"])(nextParent) || !(0, __TURBOPACK__imported__module__229315__1["isElement"])(nextParent)) { 3720 break; 3721 } 3722 targetRootAncestor = nextParent; 3723 } 3724 // Check if the click occurred on a third-party element injected after the 3725 // floating element rendered. 3726 if (markers.length && (0, __TURBOPACK__imported__module__229315__1["isElement"])(target) && !isRootElement(target) && // Clicked on a direct ancestor (e.g. FloatingOverlay). 3727 !contains(target, elements.floating) && // If the target root element contains
3727none of the markers, then the 3728 // element was injected after the floating element rendered. 3729 Array.from(markers).every((marker)=>!contains(targetRootAncestor, marker))) { 3730 return; 3731 } 3732 // Check if the click occurred on the scrollbar 3733 if ((0, __TURBOPACK__imported__module__229315__1["isHTMLElement"])(target) && floating) { 3734 // In Firefox, `target.scrollWidth > target.clientWidth` for inline 3735 // elements. 3736 const canScrollX = target.clientWidth > 0 && target.scrollWidth > target.clientWidth; 3737 const canScrollY = target.clientHeight > 0 && target.scrollHeight > target.clientHeight; 3738 let xCond = canScrollY && event.offsetX > target.clientWidth; 3739 // In some browsers it is possible to change the <body> (or window) 3740 // scrollbar to the left side, but is very rare and is difficult to 3741 // check for. Plus, for modal dialogs with backdrops, it is more 3742 // important that the backdrop is checked but not so much the window. 3743 if (canScrollY) { 3744 const isRTL = (0, __TURBOPACK__imported__module__229315__1["getComputedStyle"])(target).direction === 'rtl'; 3745 if (isRTL) { 3746 xCond = event.offsetX <= target.offsetWidth - target.clientWidth; 3747 } 3748 } 3749 if (xCond || canScrollX && event.offsetY > target.clientHeight) { 3750 return; 3751 } 3752 } 3753 const nodeId = (_dataRef$current$floa2 = dataRef.current.floatingContext) == null ? void 0 : _dataRef$current$floa2.nodeId; 3754 const targetIsInsideChildren = tree && getChildren(tree.nodesRef.current, nodeId).some((node)=>{ 3755 var _node$context; 3756 return isEventTargetWithin(event, (_node$context = node.context) == null ? void 0 : _node$context.elements.floating); 3757 }); 3758 if (isEventTargetWithin(event, elements.floating) || isEventTargetWithin(event, elements.domReference) || targetIsInsideChildren) { 3759 return; 3760 } 3761 const children = tree ? getChildren(tree.nodesRef.current, nodeId) : []; 3762 if (children.length > 0) { 3763 let shouldDismiss = true; 3764 children.forEach((child)=>{ 3765 var _child$context2; 3766 if ((_child$context2 = child.context) != null && _child$context2.open && !child.context.dataRef.current.__outsidePressBubbles) { 3767 shouldDismiss = false; 3768 return; 3769 } 3770 }); 3771 if (!shouldDismiss) { 3772 return; 3773 } 3774 } 3775 onOpenChange(false, event, 'outside-press'); 3776 }); 3777 const closeOnPressOutsideCapture = useEffectEvent((event)=>{ 3778 var _getTarget4; 3779 const callback = ()=>{ 3780 var _getTarget3; 3781 closeOnPressOutside(event); 3782 (_getTarget3 = getTarget(event)) == null || _getTarget3.removeEventListener(outsidePressEvent, callback); 3783 }; 3784 (_getTarget4 = getTarget(event)) == null || _getTarget4.addEventListener(outsidePressEvent, callback); 3785 }); 3786 __TURBOPACK__imported__module__271645__1.useEffect(()=>{ 3787 if (!open || !enabled) { 3788 return; 3789 } 3790 dataRef.current.__escapeKeyBubbles = escapeKeyBubbles; 3791 dataRef.current.__outsidePressBubbles = outsidePressBubbles; 3792 let compositionTimeout = -1; 3793 function onScroll(event) { 3794 onOpenChange(false, event, 'ancestor-scroll'); 3795 } 3796 function handleCompositionStart() { 3797 window.clearTimeout(compositionTimeout); 3798 isComposingRef.current = true; 3799 } 3800 function handleCompositionEnd() { 3801 // Safari fires `compositionend` before `keydown`, so we need to wait 3802 // until the next tick to set `isComposing` to `false`. 3803 // https://bugs.webkit.org/show_bug.cgi?id=165004 3804 compositionTimeout = window.setTimeout(()=>{ 3805 isComposingRef.current = false; 3806 }, // 0ms or 1ms don't work in Safari. 5ms appears to consistently work. 3807 // Only apply to WebKit for the test to remain 0ms. 3808 (0, __TURBOPACK__imported__module__229315__1["isWebKit"])() ? 5 : 0); 3809 } 3810 const doc = getDocument(elements.floating); 3811 if (escapeKey) { 3812 doc.addEventListener('keydown', escapeKeyCapture ? closeOnEscapeKeyDownCapture : closeOnEscapeKeyDown, escapeKeyCapture); 3813 doc.addEventListener('compositionstart', handleCompositionStart); 3814 doc.addEventListener('compositionend', handleCompositionEnd); 3815 } 3816 outsidePress && doc.addEventListener(outsidePressEvent, outsidePressCapture ? closeOnPressOutsideCapture : closeOnPressOutside, outsidePressCapture); 3817 let ancestors = []; 3818 if (ancestorScroll) { 3819 if ((0, __TURBOPACK__imported__module__229315__1["isElement"])(elements.domReference)) { 3820 ancestors = (0, __TURBOPACK__imported__module__229315__1["getOverflowAncestors"])(elements.domReference); 3821 } 3822 if ((0, __TURBOPACK__imported__module__229315__1["isElement"])(elements.floating)) { 3823 ancestors = ancestors.concat((0, __TURBOPACK__imported__module__229315__1["getOverflowAncestors"])(elements.floating)); 3824 } 3825 if (!(0, __TURBOPACK__imported__module__229315__1["isElement"])(elements.reference) && elements.reference && elements.reference.contextElement) { 3826 ancestors = ancestors.concat((0, __TURBOPACK__imported__module__229315__1["getOverflowAncestors"])(elements.reference.contextElement)); 3827 } 3828 } 3829 // Ignore the visual viewport for scrolling dismissal (allow pinch-zoom) 3830 ancestors = ancestors.filter((ancestor)=>{ 3831 var _doc$defaultView; 3832 return ancestor !== ((_doc$defaultView = doc.defaultView) == null ? void 0 : _doc$defaultView.visualVie
3832wport); 3833 }); 3834 ancestors.forEach((ancestor)=>{ 3835 ancestor.addEventListener('scroll', onScroll, { 3836 passive: true 3837 }); 3838 }); 3839 return ()=>{ 3840 if (escapeKey) { 3841 doc.removeEventListener('keydown', escapeKeyCapture ? closeOnEscapeKeyDownCapture : closeOnEscapeKeyDown, escapeKeyCapture); 3842 doc.removeEventListener('compositionstart', handleCompositionStart); 3843 doc.removeEventListener('compositionend', handleCompositionEnd); 3844 } 3845 outsidePress && doc.removeEventListener(outsidePressEvent, outsidePressCapture ? closeOnPressOutsideCapture : closeOnPressOutside, outsidePressCapture); 3846 ancestors.forEach((ancestor)=>{ 3847 ancestor.removeEventListener('scroll', onScroll); 3848 }); 3849 window.clearTimeout(compositionTimeout); 3850 }; 3851 }, [ 3852 dataRef, 3853 elements, 3854 escapeKey, 3855 outsidePress, 3856 outsidePressEvent, 3857 open, 3858 onOpenChange, 3859 ancestorScroll, 3860 enabled, 3861 escapeKeyBubbles, 3862 outsidePressBubbles, 3863 closeOnEscapeKeyDown, 3864 escapeKeyCapture, 3865 closeOnEscapeKeyDownCapture, 3866 closeOnPressOutside, 3867 outsidePressCapture, 3868 closeOnPressOutsideCapture 3869 ]); 3870 __TURBOPACK__imported__module__271645__1.useEffect(()=>{ 3871 insideReactTreeRef.current = false; 3872 }, [ 3873 outsidePress, 3874 outsidePressEvent 3875 ]); 3876 const reference = __TURBOPACK__imported__module__271645__1.useMemo(()=>({ 3877 onKeyDown: closeOnEscapeKeyDown, 3878 [bubbleHandlerKeys[referencePressEvent]]: (event)=>{ 3879 if (referencePress) { 3880 onOpenChange(false, event.nativeEvent, 'reference-press'); 3881 } 3882 } 3883 }), [ 3884 closeOnEscapeKeyDown, 3885 onOpenChange, 3886 referencePress, 3887 referencePressEvent 3888 ]); 3889 const floating = __TURBOPACK__imported__module__271645__1.useMemo(()=>({ 3890 onKeyDown: closeOnEscapeKeyDown, 3891 onMouseDown () { 3892 endedOrStartedInsideRef.current = true; 3893 }, 3894 onMouseUp () { 3895 endedOrStartedInsideRef.current = true; 3896 }, 3897 [captureHandlerKeys[outsidePressEvent]]: ()=>{ 3898 insideReactTreeRef.current = true; 3899 } 3900 }), [ 3901 closeOnEscapeKeyDown, 3902 outsidePressEvent 3903 ]); 3904 return __TURBOPACK__imported__module__271645__1.useMemo(()=>enabled ? { 3905 reference, 3906 floating 3907 } : {}, [ 3908 enabled, 3909 reference, 3910 floating 3911 ]); 3912} 3913function useFloatingRootContext(options) { 3914 const { open = false, onOpenChange: onOpenChangeProp, elements: elementsProp } = options; 3915 const floatingId = useId(); 3916 const dataRef = __TURBOPACK__imported__module__271645__1.useRef({}); 3917 const [events] = __TURBOPACK__imported__module__271645__1.useState(()=>createPubSub()); 3918 const nested = useFloatingParentNodeId() != null; 3919 if ("TURBOPACK compile-time falsy", 0) //TURBOPACK unreachable 3920 ; 3921 const [positionReference, setPositionReference] = __TURBOPACK__imported__module__271645__1.useState(elementsProp.reference); 3922 const onOpenChange = useEffectEvent((open, event, reason)=>{ 3923 dataRef.current.openEvent = open ? event : undefined; 3924 events.emit('openchange', { 3925 open, 3926 event, 3927 reason, 3928 nested 3929 }); 3930 onOpenChangeProp == null || onOpenChangeProp(open, event, reason); 3931 }); 3932 const refs = __TURBOPACK__imported__module__271645__1.useMemo(()=>({ 3933 setPositionReference 3934 }), []); 3935 const elements = __TURBOPACK__imported__module__271645__1.useMemo(()=>({ 3936 reference: positionReference || elementsProp.reference || null, 3937 floating: elementsProp.floating || null, 3938 domReference: elementsProp.reference 3939 }), [ 3940 positionReference, 3941 elementsProp.reference, 3942 elementsProp.floating 3943 ]); 3944 return __TURBOPACK__imported__module__271645__1.useMemo(()=>({ 3945 dataRef, 3946 open, 3947 onOpenChange, 3948 elements, 3949 events, 3950 floatingId, 3951 refs 3952 }), [ 3953 open, 3954 onOpenChange, 3955 elements, 3956 events, 3957 floatingId, 3958 refs 3959 ]); 3960} 3961/** 3962 * Provides data to position a floating element and context to add interactions. 3963 * @see https://floating-ui.com/docs/useFloating 3964 */ function useFloating(options) { 3965 if (options === void 0) { 3966 options = {}; 3967 } 3968 const { nodeId } = options; 3969 const internalRootContext = useFloatingRootContext({ 3970 ...options, 3971 elements: { 3972 reference: null, 3973 floating: null, 3974 ...options.elements 3975 } 3976 }); 3977 const rootContext = options.rootContext || internalRootContext; 3978 const computedElements = rootContext.elements; 3979 const [_domReference, setDomReference] = __TURBOPACK__imported__module__271645__1.useState(null); 3980 const [positionReference, _setPositionReference] = __TURBOPACK__imported__module__271645__1.useState(null); 3981 const optionDomReference = computedElements == null ? void 0 : computedElements.domReference; 3982 const domReference = optionDomReference || _domReference; 3983 const domReferenceRef = __TURBOPACK__imported__module__271645__1.useRef(null); 3984 const tree = useFloatingTree(); 3985 index(()=>{ 3986 if (domReference) { 3987 domReferenceRef.current = domReference; 3988 } 3989 }, [ 3990 domReference 3991 ]); 3992 const position = (0, __TURBOPACK__imported__module__258950__1["useFloating"])({ 3993 ...options, 3994 elements: { 3995 ...computedElements, 3996 ...positionReference && { 3997 reference: positionReference 3998 } 3999 } 4000 }); 4001 const setPositionReference = __TURBOPACK__imported__module__271645__1.useCallback((node)=>{ 4002 const computedPositionReference = (0, __TURBOPACK__imported__module__229315__1["isElement"])(node) ? { 4003 getBoundingClientRect: ()=>node.getBoundingClientRect(), 4004 contextElement: node 4005 } : node; 4006 // Store the positionReference in state if the DOM reference is specified externally via the 4007 // `elements.reference` option. This ensures that it won't be overridden on future renders. 4008 _setPositionReference(computedPositionReference); 4009 position.refs.setReference(computedPositionReference); 4010 }, [ 4011 position.refs 4012 ]); 4013 const setReference = __TURBOPACK__imported__module__271645__1.useCallback((node)=>{ 4014 if ((0, __TURBOPACK__imported__module__229315__1["isElement"])(node) || node === null) { 4015 domReferenceRef.current = node; 4016 setDomReference(node); 4017 } 4018 // Backwards-compatibility for passing a virtual element to `reference` 4019 // after it has set the DOM reference. 4020 if ((0, __TURBOPACK__imported__module__229315__1["isElement"])(position.refs.reference.current) || position.refs.reference.current === null || // Don't allow setting virtual elements using the old technique back to
4021 // `null` to support `positionReference` + an unstable `reference` 4022 // callback ref. 4023 node !== null && !(0, __TURBOPACK__imported__module__229315__1["isElement"])(node)) { 4024 position.refs.setReference(node); 4025 } 4026 }, [ 4027 position.refs 4028 ]); 4029 const refs = __TURBOPACK__imported__module__271645__1.useMemo(()=>({ 4030 ...position.refs, 4031 setReference, 4032 setPositionReference, 4033 domReference: domReferenceRef 4034 }), [ 4035 position.refs, 4036 setReference, 4037 setPositionReference 4038 ]); 4039 const elements = __TURBOPACK__imported__module__271645__1.useMemo(()=>({ 4040 ...position.elements, 4041 domReference: domReference 4042 }), [ 4043 position.elements, 4044 domReference 4045 ]); 4046 const context = __TURBOPACK__imported__module__271645__1.useMemo(()=>({ 4047 ...position, 4048 ...rootContext, 4049 refs, 4050 elements, 4051 nodeId 4052 }), [ 4053 position, 4054 refs, 4055 elements, 4056 nodeId, 4057 rootContext 4058 ]); 4059 index(()=>{ 4060 rootContext.dataRef.current.floatingContext = context; 4061 const node = tree == null ? void 0 : tree.nodesRef.current.find((node)=>node.id === nodeId); 4062 if (node) { 4063 node.context = context; 4064 } 4065 }); 4066 return __TURBOPACK__imported__module__271645__1.useMemo(()=>({ 4067 ...position, 4068 context, 4069 refs, 4070 elements 4071 }), [ 4072 position, 4073 refs, 4074 elements, 4075 context 4076 ]); 4077} 4078/** 4079 * Opens the floating element while the reference element has focus, like CSS 4080 * `:focus`. 4081 * @see https://floating-ui.com/docs/useFocus 4082 */ function useFocus(context, props) { 4083 if (props === void 0) { 4084 props = {}; 4085 } 4086 const { open, onOpenChange, events, dataRef, elements } = context; 4087 const { enabled = true, visibleOnly = true } = props; 4088 const blockFocusRef = __TURBOPACK__imported__module__271645__1.useRef(false); 4089 const timeoutRef = __TURBOPACK__imported__module__271645__1.useRef(); 4090 const keyboardModalityRef = __TURBOPACK__imported__module__271645__1.useRef(true); 4091 __TURBOPACK__imported__module__271645__1.useEffect(()=>{ 4092 if (!enabled) return; 4093 const win = (0, __TURBOPACK__imported__module__229315__1["getWindow"])(elements.domReference); 4094 // If the reference was focused and the user left the tab/window, and the 4095 // floating element was not open, the focus should be blocked when they 4096 // return to the tab/window. 4097 function onBlur() { 4098 if (!open && (0, __TURBOPACK__imported__module__229315__1["isHTMLElement"])(elements.domReference) && elements.domReference === activeElement(getDocument(elements.domReference))) { 4099 blockFocusRef.current = true; 4100 } 4101 } 4102 function onKeyDown() { 4103 keyboardModalityRef.current = true; 4104 } 4105 win.addEventListener('blur', onBlur); 4106 win.addEventListener('keydown', onKeyDown, true); 4107 return ()=>{ 4108 win.removeEventListener('blur', onBlur); 4109 win.removeEventListener('keydown', onKeyDown, true); 4110 }; 4111 }, [ 4112 elements.domReference, 4113 open, 4114 enabled 4115 ]); 4116 __TURBOPACK__imported__module__271645__1.useEffect(()=>{ 4117 if (!enabled) return; 4118 function onOpenChange(_ref) { 4119 let { reason } = _ref; 4120 if (reason === 'reference-press' || reason === 'escape-key') { 4121 blockFocusRef.current = true; 4122 } 4123 } 4124 events.on('openchange', onOpenChange); 4125 return ()=>{ 4126 events.off('openchange', onOpenChange); 4127 }; 4128 }, [ 4129 events, 4130 enabled 4131 ]); 4132 __TURBOPACK__imported__module__271645__1.useEffect(()=>{ 4133 return ()=>{ 4134 clearTimeout(timeoutRef.current); 4135 }; 4136 }, []); 4137 const reference = __TURBOPACK__imported__module__271645__1.useMemo(()=>({ 4138 onPointerDown (event) { 4139 if (isVirtualPointerEvent(event.nativeEvent)) return; 4140 keyboardModalityRef.current = false;
4141 }, 4142 onMouseLeave () { 4143 blockFocusRef.current = false; 4144 }, 4145 onFocus (event) { 4146 if (blockFocusRef.current) return; 4147 const target = getTarget(event.nativeEvent); 4148 if (visibleOnly && (0, __TURBOPACK__imported__module__229315__1["isElement"])(target)) { 4149 try { 4150 // Mac Safari unreliably matches `:focus-visible` on the reference 4151 // if focus was outside the page initially - use the fallback 4152 // instead. 4153 if (isSafari() && isMac()) throw Error(); 4154 if (!target.matches(':focus-visible')) return; 4155 } catch (e) { 4156 // Old browsers will throw an error when using `:focus-visible`. 4157 if (!keyboardModalityRef.current && !isTypeableElement(target)) { 4158 return; 4159 } 4160 } 4161 } 4162 onOpenChange(true, event.nativeEvent, 'focus'); 4163 }, 4164 onBlur (event) { 4165 blockFocusRef.current = false; 4166 const relatedTarget = event.relatedTarget; 4167 const nativeEvent = event.nativeEvent; 4168 // Hit the non-modal focus management portal guard. Focus will be 4169 // moved into the floating element immediately after. 4170 const movedToFocusGuard = (0, __TURBOPACK__imported__module__229315__1["isElement"])(relatedTarget) && relatedTarget.hasAttribute(createAttribute('focus-guard')) && relatedTarget.getAttribute('data-type') === 'outside'; 4171 // Wait for the window blur listener to fire. 4172 timeoutRef.current = window.setTimeout(()=>{ 4173 var _dataRef$current$floa; 4174 const activeEl = activeElement(elements.domReference ? elements.domReference.ownerDocument : document); 4175 // Focus left the page, keep it open. 4176 if (!relatedTarget && activeEl === elements.domReference) return; 4177 // When focusing the reference element (e.g. regular click), then 4178 // clicking into the floating element, prevent it from hiding. 4179 // Note: it must be focusable, e.g. `tabindex="-1"`. 4180 // We can not rely on relatedTarget to point to the correct element 4181 // as it will only point to the shadow host of the newly focused element 4182 // and not the element that actually has received focus if it is located 4183 // inside a shadow root. 4184 if (contains((_dataRef$current$floa = dataRef.current.floatingContext) == null ? void 0 : _dataRef$current$floa.refs.floating.current, activeEl) || contains(elements.domReference, activeEl) || movedToFocusGuard) { 4185 return; 4186 } 4187 onOpenChange(false, nativeEvent, 'focus'); 4188 }); 4189 } 4190 }), [ 4191 dataRef, 4192 elements.domReference, 4193 onOpenChange, 4194 visibleOnly 4195 ]); 4196 return __TURBOPACK__imported__module__271645__1.useMemo(()=>enabled ? { 4197 reference 4198 } : {}, [ 4199 enabled, 4200 reference 4201 ]); 4202} 4203const ACTIVE_KEY = 'active'; 4204const SELECTED_KEY = 'selected'; 4205function mergeProps(userProps, propsList, elementKey) { 4206 const map = new Map(); 4207 const isItem = elementKey === 'item'; 4208 let domUserProps = userProps; 4209 if (isItem && userProps) { 4210 const { [ACTIVE_KEY]: _, [SELECTED_KEY]: __, ...validProps } = userProps; 4211 domUserProps = validProps; 4212 } 4213 return { 4214 ...elementKey === 'floating' && { 4215 tabIndex: -1, 4216 [FOCUSABLE_ATTRIBUTE]: '' 4217 }, 4218 ...domUserProps, 4219 ...propsList.map((value)=>{ 4220 const propsOrGetProps = value ? value[elementKey] : null; 4221 if (typeof propsOrGetProps === 'function') { 4222 return userProps ? propsOrGetProps(userProps) : null; 4223 } 4224 return propsOrGetProps; 4225 }).concat(userProps).reduce((acc, props)=>{ 4226 if (!props) { 4227 return acc; 4228 }
4229 Object.entries(props).forEach((_ref)=>{ 4230 let [key, value] = _ref; 4231 if (isItem && [ 4232 ACTIVE_KEY, 4233 SELECTED_KEY 4234 ].includes(key)) { 4235 return; 4236 } 4237 if (key.indexOf('on') === 0) { 4238 if (!map.has(key)) { 4239 map.set(key, []); 4240 } 4241 if (typeof value === 'function') { 4242 var _map$get; 4243 (_map$get = map.get(key)) == null || _map$get.push(value); 4244 acc[key] = function() { 4245 var _map$get2; 4246 for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){ 4247 args[_key] = arguments[_key]; 4248 } 4249 return (_map$get2 = map.get(key)) == null ? void 0 : _map$get2.map((fn)=>fn(...args)).find((val)=>val !== undefined); 4250 }; 4251 } 4252 } else { 4253 acc[key] = value; 4254 } 4255 }); 4256 return acc; 4257 }, {}) 4258 }; 4259} 4260/** 4261 * Merges an array of interaction hooks' props into prop getters, allowing 4262 * event handler functions to be composed together without overwriting one 4263 * another. 4264 * @see https://floating-ui.com/docs/useInteractions 4265 */ function useInteractions(propsList) { 4266 if (propsList === void 0) { 4267 propsList = []; 4268 } 4269 const referenceDeps = propsList.map((key)=>key == null ? void 0 : key.reference); 4270 const floatingDeps = propsList.map((key)=>key == null ? void 0 : key.floating); 4271 const itemDeps = propsList.map((key)=>key == null ? void 0 : key.item); 4272 const getReferenceProps = __TURBOPACK__imported__module__271645__1.useCallback((userProps)=>mergeProps(userProps, propsList, 'reference'), // eslint-disable-next-line react-hooks/exhaustive-deps 4273 referenceDeps); 4274 const getFloatingProps = __TURBOPACK__imported__module__271645__1.useCallback((userProps)=>mergeProps(userProps, propsList, 'floating'), // eslint-disable-next-line react-hooks/exhaustive-deps 4275 floatingDeps); 4276 const getItemProps = __TURBOPACK__imported__module__271645__1.useCallback((userProps)=>mergeProps(userProps, propsList, 'item'), // eslint-disable-next-line react-hooks/exhaustive-deps 4277 itemDeps); 4278 return __TURBOPACK__imported__module__271645__1.useMemo(()=>({ 4279 getReferenceProps, 4280 getFloatingProps, 4281 getItemProps 4282 }), [ 4283 getReferenceProps, 4284 getFloatingProps, 4285 getItemProps 4286 ]); 4287} 4288let isPreventScrollSupported = false; 4289function doSwitch(orientation, vertical, horizontal) { 4290 switch(orientation){ 4291 case 'vertical': 4292 return vertical; 4293 case 'horizontal': 4294 return horizontal; 4295 default: 4296 return vertical || horizontal; 4297 } 4298} 4299function isMainOrientationKey(key, orientation) { 4300 const vertical = key === ARROW_UP || key === ARROW_DOWN; 4301 const horizontal = key === ARROW_LEFT || key === ARROW_RIGHT; 4302 return doSwitch(orientation, vertical, horizontal); 4303} 4304function isMainOrientationToEndKey(key, orientation, rtl) { 4305 const vertical = key === ARROW_DOWN; 4306 const horizontal = rtl ? key === ARROW_LEFT : key === ARROW_RIGHT; 4307 return doSwitch(orientation, vertical, horizontal) || key === 'Enter' || key === ' ' || key === ''; 4308} 4309function isCrossOrientationOpenKey(key, orientation, rtl) { 4310 const vertical = rtl ? key === ARROW_LEFT : key === ARROW_RIGHT; 4311 const horizontal = key === ARROW_DOWN; 4312 return doSwitch(orientation, vertical, horizontal); 4313} 4314function isCrossOrientationCloseKey(key, orientation, rtl) { 4315 const vertical = rtl ? key === ARROW_RIGHT : key === ARROW_LEFT; 4316 const horizontal = key === ARROW_UP; 4317 return doSwitch(orientation, vertical, horizontal); 4318} 4319/** 4320 * Adds arrow key-based navigation of a list of items, either using real DOM 4321 * focus or virtual focus. 4322 * @see https://floating-ui.com/docs/useListNavigation 4323 */ function useListNavigation(context, props) { 4324 const { open, onOpenChange, elements } = context; 4325 const { listRef, activeIndex, onNavigate: unstable_onNavigate = ()=>{}, enabled = true, selectedIndex = null, allowEscape = false, loop = false, nested = false, rtl = false, virtual = false, focusItemOnOpen = 'auto', focusItemOnHover = true, openOnArrowKeyDown = true, disabledIndices = undefined, orientation = 'vertical', cols = 1, scrollItemIntoView = true, virtualItemRef, itemSizes, dense = false } = props; 4326 if ("TURBOPACK compile-time falsy", 0) //TURBOPACK unreachable 4327 ; 4328 const floatingFocusElement = getFloatingFocusElement(elements.floating); 4329 const floatingFocusElementRef = useLatestRef(floatingFocusElement); 4330 const parentId = useFloatingParentNodeId(); 4331 const tree = useFloatingTree(); 4332 const onNavigate = useEffectEvent(unstable_onNavigate); 4333 const typeableComboboxReference = isTypeableCombobox(elements.domReference); 4334 const focusItemOnOpenRef = __TURBOPACK__imported__module__271645__1.useRef(focusItemOnOpen); 4335 const indexRef = __TURBOPACK__imported__module__271645__1.useRef(selectedIndex != null ? selectedIndex : -1);
4336 const keyRef = __TURBOPACK__imported__module__271645__1.useRef(null); 4337 const isPointerModalityRef = __TURBOPACK__imported__module__271645__1.useRef(true); 4338 const previousOnNavigateRef = __TURBOPACK__imported__module__271645__1.useRef(onNavigate); 4339 const previousMountedRef = __TURBOPACK__imported__module__271645__1.useRef(!!elements.floating); 4340 const previousOpenRef = __TURBOPACK__imported__module__271645__1.useRef(open); 4341 const forceSyncFocus = __TURBOPACK__imported__module__271645__1.useRef(false); 4342 const forceScrollIntoViewRef = __TURBOPACK__imported__module__271645__1.useRef(false); 4343 const disabledIndicesRef = useLatestRef(disabledIndices); 4344 const latestOpenRef = useLatestRef(open); 4345 const scrollItemIntoViewRef = useLatestRef(scrollItemIntoView); 4346 const selectedIndexRef = useLatestRef(selectedIndex); 4347 const [activeId, setActiveId] = __TURBOPACK__imported__module__271645__1.useState(); 4348 const [virtualId, setVirtualId] = __TURBOPACK__imported__module__271645__1.useState(); 4349 const focusItem = useEffectEvent(function(listRef, indexRef, forceScrollIntoView) { 4350 if (forceScrollIntoView === void 0) { 4351 forceScrollIntoView = false; 4352 } 4353 function runFocus(item) { 4354 if (virtual) {
4355 setActiveId(item.id); 4356 tree == null || tree.events.emit('virtualfocus', item); 4357 if (virtualItemRef) { 4358 virtualItemRef.current = item; 4359 } 4360 } else { 4361 enqueueFocus(item, { 4362 preventScroll: true, 4363 // Mac Safari does not move the virtual cursor unless the focus call 4364 // is sync. However, for the very first focus call, we need to wait 4365 // for the position to be ready in order to prevent unwanted 4366 // scrolling. This means the virtual cursor will not move to the first 4367 // item when first opening the floating element, but will on 4368 // subsequent calls. `preventScroll` is supported in modern Safari, 4369 // so we can use that instead. 4370 // iOS Safari must be async or the first item will not be focused. 4371 sync: isMac() && isSafari() ? isPreventScrollSupported || forceSyncFocus.current : false 4372 }); 4373 } 4374 } 4375 const initialItem = listRef.current[indexRef.current]; 4376 if (initialItem) { 4377 runFocus(initialItem); 4378 } 4379 requestAnimationFrame(()=>{ 4380 const waitedItem = listRef.current[indexRef.current] || initialItem; 4381 if (!waitedItem) return; 4382 if (!initialItem) { 4383 runFocus(waitedItem); 4384 } 4385 const scrollIntoViewOptions = scrollItemIntoViewRef.current; 4386 const shouldScrollIntoView = scrollIntoViewOptions && item && (forceScrollIntoView || !isPointerModalityRef.current); 4387 if (shouldScrollIntoView) { 4388 // JSDOM doesn't support `.scrollIntoView()` but it's widely supported 4389 // by all browsers. 4390 waitedItem.scrollIntoView == null || waitedItem.scrollIntoView(typeof scrollIntoViewOptions === 'boolean' ? { 4391 block: 'nearest', 4392 inline: 'nearest' 4393 } : scrollIntoViewOptions); 4394 } 4395 }); 4396 }); 4397 index(()=>{ 4398 document.createElement('div').focus({ 4399 get preventScroll () { 4400 isPreventScrollSupported = true; 4401 return false; 4402 } 4403 }); 4404 }, []); 4405 // Sync `selectedIndex` to be the `activeIndex` upon opening the floating 4406 // element. Also, reset `activeIndex` upon closing the floating element. 4407 index(()=>{ 4408 if (!enabled) return; 4409 if (open && elements.floating) { 4410 if (focusItemOnOpenRef.current && selectedIndex != null) { 4411 // Regardless of the pointer modality, we want to ensure the selected 4412 // item comes into view when the floating element is opened. 4413 forceScrollIntoViewRef.current = true; 4414 indexRef.current = selectedIndex; 4415 onNavigate(selectedIndex); 4416 } 4417 } else if (previousMountedRef.current) { 4418 // Since the user can specify `onNavigate` conditionally 4419 // (onNavigate: open ? setActiveIndex : setSelectedIndex), 4420 // we store and call the previous function. 4421 indexRef.current = -1; 4422 previousOnNavigateRef.current(null); 4423 } 4424 }, [ 4425 enabled, 4426 open, 4427 elements.floating, 4428 selectedIndex, 4429 onNavigate 4430 ]); 4431 // Sync `activeIndex` to be the focused item while the floating element is 4432 // open. 4433 index(()=>{ 4434 if (!enabled) return; 4435 if (open && elements.floating) { 4436 if (activeIndex == null) { 4437 forceSyncFocus.current = false; 4438 if (selectedIndexRef.current != null) { 4439 return; 4440 } 4441 // Reset while the floating element was open (e.g. the list changed). 4442 if (previousMountedRef.current) { 4443 indexRef.current = -1; 4444 focusItem(listRef, indexRef); 4445 } 4446 // Initial sync. 4447 if ((!previousOpenRef.current || !previousMountedRef.current) && focusItemOnOpenRef.current && (keyRef.current != null || focusItemOnOpenRef.current === true && keyRef.current == null)) { 4448 let runs = 0; 4449 const waitForListPopulated = ()=>{ 4450 if (listRef.current[0] == null) { 4451 // Avoid letting the browser paint if possible on the first try, 4452 // otherwise use rAF. Don't try more than twice, since something 4453 // is wrong otherwise. 4454 if (runs < 2) { 4455 const scheduler = runs ? requestAnimationFrame : queueMicrotask; 4456 scheduler(waitForListPopulated); 4457 } 4458 runs++; 4459 } else { 4460 indexRef.current = keyRef.current == null || isMainOrientationToEndKey(keyRef.current, orientation, rtl) || nested ? getMinIndex(listRef, disabledIndicesRef.current) : getMaxIndex(listRef, disabledIndicesRef.current); 4461 keyRef.current = null; 4462 onNavigate(indexRef.current); 4463 } 4464 }; 4465 waitForListPopulated(); 4466 } 4467 } else if (!isIndexOutOfBounds(listRef, activeIndex)) { 4468 indexRef.current = activeIndex; 4469 focusItem(listRef, indexRef, forceScrollIntoViewRef.current); 4470 forceScrollIntoViewRef.current = false;
4471 } 4472 } 4473 }, [ 4474 enabled, 4475 open, 4476 elements.floating, 4477 activeIndex, 4478 selectedIndexRef, 4479 nested, 4480 listRef, 4481 orientation, 4482 rtl, 4483 onNavigate, 4484 focusItem, 4485 disabledIndicesRef 4486 ]); 4487 // Ensure the parent floating element has focus when a nested child closes 4488 // to allow arrow key navigation to work after the pointer leaves the child. 4489 index(()=>{ 4490 var _nodes$find; 4491 if (!enabled || elements.floating || !tree || virtual || !previousMountedRef.current) { 4492 return; 4493 } 4494 const nodes = tree.nodesRef.current; 4495 const parent = (_nodes$find = nodes.find((node)=>node.id === parentId)) == null || (_nodes$find = _nodes$find.context) == null ? void 0 : _nodes$find.elements.floating; 4496 const activeEl = activeElement(getDocument(elements.floating)); 4497 const treeContainsActiveEl = nodes.some((node)=>node.context && contains(node.context.elements.floating, activeEl)); 4498 if (parent && !treeContainsActiveEl && isPointerModalityRef.current) { 4499 parent.focus({ 4500 preventScroll: true 4501 }); 4502 } 4503 }, [ 4504 enabled, 4505 elements.floating, 4506 tree, 4507 parentId, 4508 virtual 4509 ]); 4510 index(()=>{ 4511 if (!enabled) return; 4512 if (!tree) return; 4513 if (!virtual) return; 4514 if (parentId) return; 4515 function handleVirtualFocus(item) { 4516 setVirtualId(item.id); 4517 if (virtualItemRef) { 4518 virtualItemRef.current = item; 4519 } 4520 } 4521 tree.events.on('virtualfocus', handleVirtualFocus); 4522 return ()=>{ 4523 tree.events.off('virtualfocus', handleVirtualFocus); 4524 }; 4525 }, [ 4526 enabled, 4527 tree, 4528 virtual, 4529 parentId, 4530 virtualItemRef 4531 ]); 4532 index(()=>{ 4533 previousOnNavigateRef.current = onNavigate; 4534 previousMountedRef.current = !!elements.floating; 4535 }); 4536 index(()=>{ 4537 if (!open) { 4538 keyRef.current = null; 4539 } 4540 }, [ 4541 open 4542 ]); 4543 index(()=>{ 4544 previousOpenRef.current = open; 4545 }, [ 4546 open 4547 ]); 4548 const hasActiveIndex = activeIndex != null; 4549 const item = __TURBOPACK__imported__module__271645__1.useMemo(()=>{ 4550 function syncCurrentTarget(currentTarget) { 4551 if (!open) return; 4552 const index = listRef.current.indexOf(currentTarget); 4553 if (index !== -1) { 4554 onNavigate(index); 4555 } 4556 } 4557 const props = { 4558 onFocus (_ref) { 4559 let { currentTarget } = _ref; 4560 syncCurrentTarget(currentTarget); 4561 }, 4562 onClick: (_ref2)=>{ 4563 let { currentTarget } = _ref2; 4564 return currentTarget.focus({ 4565 preventScroll: true 4566 }); 4567 }, 4568 // Safari 4569 ...focusItemOnHover && { 4570 onMouseMove (_ref3) { 4571 let { currentTarget } = _ref3; 4572 syncCurrentTarget(currentTarget); 4573 }, 4574 onPointerLeave (_ref4) { 4575 let { pointerType } = _ref4; 4576 if (!isPointerModalityRef.current || pointerType === 'touch') { 4577 return; 4578 } 4579 indexRef.current = -1; 4580 focusItem(listRef, indexRef); 4581 onNavigate(null); 4582 if (!virtual) { 4583 enqueueFocus(floatingFocusElementRef.current, { 4584 preventScroll: true 4585 }); 4586 } 4587 } 4588 } 4589 }; 4590 return props; 4591 }, [ 4592 open, 4593 floatingFocusElementRef, 4594 focusItem, 4595 focusItemOnHover, 4596 listRef, 4597 onNavigate, 4598 virtual 4599 ]); 4600 const commonOnKeyDown = useEffectEvent((event)=>{ 4601 isPointerModalityRef.current = false; 4602 forceSyncFocus.current = true; 4603 // When composing a character, Chrome fires ArrowDown twice. Firefox/Safari 4604 // don't appear to suffer from this. `event.isComposing` is avoided due to 4605 // Safari not supporting it properly (although it's not needed in the first 4606 // place for Safari, just avoiding any possible issues). 4607 if (event.which === 229) { 4608 return; 4609 } 4610 // If the floating element is animating out, ignore navigation. Otherwise, 4611 // the `activeIndex` gets set to 0 despite not being open so the next time 4612 // the user ArrowDowns, the first item won't be focused. 4613 if (!latestOpenRef.current && event.currentTarget === floatingFocusElementRef.current) { 4614 return; 4615 } 4616 if (nested && isCrossOrientationCloseKey(event.key, orientation, rtl)) { 4617 stopEvent(event); 4618 onOpenChange(false, event.nativeEvent, 'list-navigation'); 4619 if ((0, __TURBOPACK__imported__module__229315__1["isHTMLElement"])(elements.domReference)) { 4620 if (virtual) { 4621 tree == null || tree.events.emit('virtualfocus', elements.domReference); 4622 } else { 4623 elements.domReference.focus(); 4624 } 4625 } 4626 return; 4627 } 4628 const currentIndex = indexRef.current; 4629 const minIndex = getMinIndex(listRef, disabledIndices); 4630 const maxIndex = getMaxIndex(listRef, disabledIndices); 4631 if (!typeableComboboxReference) { 4632 if (event.key === 'Home') { 4633 stopEvent(event); 4634 indexRef.current = minIndex; 4635 onNavigate(indexRef.current); 4636 } 4637 if (event.key === 'End') { 4638 stopEvent(event); 4639 indexRef.current = maxIndex; 4640 onNavigate(indexRef.current); 4641 } 4642 } 4643 // Grid navigation. 4644 if (cols > 1) { 4645 const sizes = itemSizes || Array.from({ 4646 length: listRef.current.length 4647 }, ()=>({ 4648 width: 1, 4649 height: 1 4650 })); 4651 // To calculate movements on the grid, we use hypothetical cell indices
4652 // as if every item was 1x1, then convert back to real indices. 4653 const cellMap = buildCellMap(sizes, cols, dense); 4654 const minGridIndex = cellMap.findIndex((index)=>index != null && !isDisabled(listRef.current, index, disabledIndices)); 4655 // last enabled index 4656 const maxGridIndex = cellMap.reduce((foundIndex, index, cellIndex)=>index != null && !isDisabled(listRef.current, index, disabledIndices) ? cellIndex : foundIndex, -1); 4657 const index = cellMap[getGridNavigatedIndex({ 4658 current: cellMap.map((itemIndex)=>itemIndex != null ? listRef.current[itemIndex] : null) 4659 }, { 4660 event, 4661 orientation, 4662 loop, 4663 rtl, 4664 cols, 4665 // treat undefined (empty grid spaces) as disabled indices so we 4666 // don't end up in them 4667 disabledIndices: getCellIndices([ 4668 ...disabledIndices || listRef.current.map((_, index)=>isDisabled(listRef.current, index) ? index : undefined), 4669 undefined 4670 ], cellMap), 4671 minIndex: minGridIndex, 4672 maxIndex: maxGridIndex, 4673 prevIndex: getCellIndexOfCorner(indexRef.current > maxIndex ? minIndex : indexRef.current, sizes, cellMap, cols, // use a corner matching the edge closest to the direction 4674 // we're moving in so we don't end up in the same item. Prefer 4675 // top/left over bottom/right. 4676 event.key === ARROW_DOWN ? 'bl' : event.key === (rtl ? ARROW_LEFT : ARROW_RIGHT) ? 'tr' : 'tl'), 4677 stopEvent: true 4678 })]; 4679 if (index != null) { 4680 indexRef.current = index; 4681 onNavigate(indexRef.current); 4682 } 4683 if (orientation === 'both') { 4684 return; 4685 } 4686 } 4687 if (isMainOrientationKey(event.key, orientation)) { 4688 stopEvent(event); 4689 // Reset the index if no item is focused. 4690 if (open && !virtual && activeElement(event.currentTarget.ownerDocument) === event.currentTarget) { 4691 indexRef.current = isMainOrientationToEndKey(event.key, orientation, rtl) ? minIndex : maxIndex; 4692 onNavigate(indexRef.current); 4693 return; 4694 } 4695 if (isMainOrientationToEndKey(event.key, orientation, rtl)) { 4696 if (loop) { 4697 indexRef.current = currentIndex >= maxIndex ? allowEscape && currentIndex !== listRef.current.length ? -1 : minIndex : findNonDisabledIndex(listRef, { 4698 startingIndex: currentIndex, 4699 disabledIndices 4700 }); 4701 } else { 4702 indexRef.current = Math.min(maxIndex, findNonDisabledIndex(listRef, { 4703 startingIndex: currentIndex, 4704 disabledIndices 4705 })); 4706 } 4707 } else { 4708 if (loop) { 4709 indexRef.current = currentIndex <= minIndex ? allowEscape && currentIndex !== -1 ? listRef.current.length : maxIndex : findNonDisabledIndex(listRef, { 4710 startingIndex: currentIndex, 4711 decrement: true, 4712 disabledIndices 4713 }); 4714 } else { 4715 indexRef.current = Math.max(minIndex, findNonDisabledIndex(listRef, { 4716 startingIndex: currentIndex, 4717 decrement: true, 4718 disabledIndices 4719 })); 4720 } 4721 } 4722 if (isIndexOutOfBounds(listRef, indexRef.current)) { 4723 onNavigate(null); 4724 } else { 4725 onNavigate(indexRef.current); 4726 } 4727 } 4728 }); 4729 const ariaActiveDescendantProp = __TURBOPACK__imported__module__271645__1.useMemo(()=>{ 4730 return virtual && open && hasActiveIndex && { 4731 'aria-activedescendant': virtualId || activeId 4732 }; 4733 }, [ 4734 virtual, 4735 open, 4736 hasActiveIndex, 4737 virtualId, 4738 activeId 4739 ]); 4740 const floating = __TURBOPACK__imported__module__271645__1.useMemo(()=>{ 4741 return { 4742 'aria-orientation': orientation === 'both' ? undefined : orientation, 4743 ...!isTypeableCombobox(elements.domReference) && ariaActiveDescendantProp, 4744 onKeyDown: commonOnKeyDown, 4745 onPointerMove () { 4746 isPointerModalityRef.current = true; 4747 } 4748 }; 4749 }, [ 4750 ariaActiveDescendantProp, 4751 commonOnKeyDown, 4752 elements.domReference, 4753 orientation 4754 ]); 4755 const reference = __TURBOPACK__imported__module__271645__1.useMemo(()=>{ 4756 function checkVirtualMouse(event) { 4757 if (focusItemOnOpen === 'auto' && isVirtualClick(event.
4757nativeEvent)) { 4758 focusItemOnOpenRef.current = true; 4759 } 4760 } 4761 function checkVirtualPointer(event) { 4762 // `pointerdown` fires first, reset the state then perform the checks. 4763 focusItemOnOpenRef.current = focusItemOnOpen; 4764 if (focusItemOnOpen === 'auto' && isVirtualPointerEvent(event.nativeEvent)) { 4765 focusItemOnOpenRef.current = true; 4766 } 4767 } 4768 return { 4769 ...ariaActiveDescendantProp, 4770 onKeyDown (event) { 4771 isPointerModalityRef.current = false; 4772 const isArrowKey = event.key.startsWith('Arrow'); 4773 const isHomeOrEndKey = [ 4774 'Home', 4775 'End' 4776 ].includes(event.key); 4777 const isMoveKey = isArrowKey || isHomeOrEndKey; 4778 const isCrossOpenKey = isCrossOrientationOpenKey(event.key, orientation, rtl); 4779 const isCrossCloseKey = isCrossOrientationCloseKey(event.key, orientation, rtl); 4780 const isMainKey = isMainOrientationKey(event.key, orientation); 4781 const isNavigationKey = (nested ? isCrossOpenKey : isMainKey) || event.key === 'Enter' || event.key.trim() === ''; 4782 if (virtual && open) { 4783 const rootNode = tree == null ? void 0 : tree.nodesRef.current.find((node)=>node.parentId == null); 4784 const deepestNode = tree && rootNode ? getDeepestNode(tree.nodesRef.current, rootNode.id) : null; 4785 if (isMoveKey && deepestNode && virtualItemRef) { 4786 const eventObject = new KeyboardEvent('keydown', { 4787 key: event.key, 4788 bubbles: true 4789 }); 4790 if (isCrossOpenKey || isCrossCloseKey) { 4791 var _deepestNode$context, _deepestNode$context2; 4792 const isCurrentTarget = ((_deepestNode$context = deepestNode.context) == null ? void 0 : _deepestNode$context.elements.domReference) === event.currentTarget; 4793 const dispatchItem = isCrossCloseKey && !isCurrentTarget ? (_deepestNode$context2 = deepestNode.context) == null ? void 0 : _deepestNode$context2.elements.domReference : isCrossOpenKey ? listRef.current.find((item)=>(item == null ? void 0 : item.id) === activeId) : null; 4794 if (dispatchItem) { 4795 stopEvent(event); 4796 dispatchItem.dispatchEvent(eventObject); 4797 setVirtualId(undefined); 4798 } 4799 } 4800 if ((isMainKey || isHomeOrEndKey) && deepestNode.context) { 4801 if (deepestNode.context.open && deepestNode.parentId && event.currentTarget !== deepestNode.context.elements.domReference) { 4802 var _deepestNode$context$; 4803 stopEvent(event); 4804 (_deepestNode$context$ = deepestNode.context.elements.domReference) == null || _deepestNode$context$.dispatchEvent(eventObject); 4805 return; 4806 } 4807 } 4808 } 4809 return commonOnKeyDown(event); 4810 } 4811 // If a floating element should not open on arrow key down, avoid 4812 // setting `activeIndex` while it's closed. 4813 if (!open && !openOnArrowKeyDown && isArrowKey) { 4814 return; 4815 } 4816 if (isNavigationKey) { 4817 keyRef.current = nested && isMainKey ? null : event.key; 4818 } 4819 if (nested) { 4820 if (isCrossOpenKey) { 4821 stopEvent(event); 4822 if (open) { 4823 indexRef.current = getMinIndex(listRef, disabledIndicesRef.current); 4824 onNavigate(indexRef.current); 4825 } else { 4826 onOpenChange(true, event.nativeEvent, 'list-navigation'); 4827 } 4828 } 4829 return; 4830 } 4831 if (isMainKey) { 4832 if (selectedIndex != null) { 4833 indexRef.current = selectedIndex; 4834 } 4835 stopEvent(event); 4836 if (!open && openOnArrowKeyDown) { 4837 onOpenChange(true, event.nativeEvent, 'list-navigation'); 4838 } else { 4839 commonOnKeyDown(event); 4840 } 4841 if (open) { 4842 onNavigate(indexRef.current); 4843 } 4844 } 4845 }, 4846 onFocus () { 4847 if (open && !virtual) { 4848 onNavigate(null); 4849 } 4850 }, 4851 onPointerDown: checkVirtualPointer, 4852 onMouseDown: checkVirtualMouse, 4853 onClick: checkVirtualMouse 4854 }; 4855 }, [ 4856 activeId, 4857 ariaActiveDescendantProp, 4858 commonOnKeyDown, 4859 disabledIndicesRef, 4860 focusItemOnOpen, 4861 listRef, 4862 nested, 4863 onNavigate, 4864 onOpenChange, 4865 open, 4866 openOnArrowKeyDown, 4867 orientation, 4868 rtl, 4869 selectedIndex, 4870 tree, 4871 virtual, 4872 virtualItemRef 4873 ]); 4874 return __TURBOPACK__imported__module__271645__1.useMemo(()=>enabled ? { 4875 reference, 4876 floating, 4877 item 4878 } : {}, [ 4879 enabled, 4880 reference, 4881 floating, 4882 item 4883 ]); 4884} 4885const componentRoleToAriaRoleMap = /*#__PURE__*/ new Map([ 4886 [ 4887 'select', 4888 'listbox' 4889 ], 4890 [ 4891 'combobox', 4892 'listbox' 4893 ], 4894 [ 4895 'label', 4896 false 4897 ] 4898]); 4899/** 4900 * Adds base screen reader props to the reference and floating elements for a 4901 * given floating element `role`. 4902 * @see https://floating-ui.com/docs/useRole 4903 */ function useRole(context, props) { 4904 var _componentRoleToAriaR; 4905 if (props === void 0) { 4906 props = {}; 4907 } 4908 const { open, floatingId } = context; 4909 const { enabled = true, role = 'dialog' } = props; 4910 const ariaRole = (_componentRoleToAriaR = componentRoleToAriaRoleMap.get(role)) != null ? _componentRoleToAriaR : role; 4911 const referenceId = useId(); 4912 const parentId = useFloatingParentNodeId(); 4913 const isNested = parentId != null; 4914 const reference = __TURBOPACK__imported__module__271645__1.useMemo(()=>{ 4915 if (ariaRole === 'tooltip' || role === 'label') { 4916 return { 4917 ["aria-" + (role === 'label' ? 'labelledby' : 'de
4917scribedby')]: open ? floatingId : undefined 4918 }; 4919 } 4920 return { 4921 'aria-expanded': open ? 'true' : 'false', 4922 'aria-haspopup': ariaRole === 'alertdialog' ? 'dialog' : ariaRole, 4923 'aria-controls': open ? floatingId : undefined, 4924 ...ariaRole === 'listbox' && { 4925 role: 'combobox' 4926 }, 4927 ...ariaRole === 'menu' && { 4928 id: referenceId 4929 }, 4930 ...ariaRole === 'menu' && isNested && { 4931 role: 'menuitem' 4932 }, 4933 ...role === 'select' && { 4934 'aria-autocomplete': 'none' 4935 }, 4936 ...role === 'combobox' && { 4937 'aria-autocomplete': 'list' 4938 } 4939 }; 4940 }, [ 4941 ariaRole, 4942 floatingId, 4943 isNested, 4944 open, 4945 referenceId, 4946 role 4947 ]); 4948 const floating = __TURBOPACK__imported__module__271645__1.useMemo(()=>{ 4949 const floatingProps = { 4950 id: floatingId, 4951 ...ariaRole && { 4952 role: ariaRole 4953 } 4954 }; 4955 if (ariaRole === 'tooltip' || role === 'label') { 4956 return floatingProps; 4957 } 4958 return { 4959 ...floatingProps, 4960 ...ariaRole === 'menu' && { 4961 'aria-labelledby': referenceId 4962 } 4963 }; 4964 }, [ 4965 ariaRole, 4966 floatingId, 4967 referenceId, 4968 role 4969 ]); 4970 const item = __TURBOPACK__imported__module__271645__1.useCallback((_ref)=>{ 4971 let { active, selected } = _ref; 4972 const commonProps = { 4973 role: 'option', 4974 ...active && { 4975 id: floatingId + "-option" 4976 } 4977 }; 4978 // For `menu`, we are unable to tell if the item is a `menuitemradio` 4979 // or `menuitemcheckbox`. For backwards-compatibility reasons, also 4980 // avoid defaulting to `menuitem` as it may overwrite custom role props. 4981 switch(role){ 4982 case 'select': 4983 return { 4984 ...commonProps, 4985 'aria-selected': active && selected 4986 }; 4987 case 'combobox': 4988 { 4989 return { 4990 ...commonProps, 4991 ...active && { 4992 'aria-selected': true 4993 } 4994 }; 4995 } 4996 } 4997 return {}; 4998 }, [ 4999 floatingId, 5000 role 5001 ]); 5002 return __TURBOPACK__imported__module__271645__1.useMemo(()=>enabled ? { 5003 reference, 5004 floating, 5005 item 5006 } : {}, [ 5007 enabled, 5008 reference, 5009 floating, 5010 item 5011 ]); 5012} 5013// Converts a JS style key like `backgroundColor` to a CSS transition-property 5014// like `background-color`. 5015const camelCaseToKebabCase = (str)=>str.replace(/[A-Z]+(?![a-z])|[A-Z]/g, ($, ofs)=>(ofs ? '-' : '') + $.toLowerCase()); 5016function execWithArgsOrReturn(valueOrFn, args) { 5017 return typeof valueOrFn === 'function' ? valueOrFn(args) : valueOrFn; 5018} 5019function useDelayUnmount(open, durationMs) { 5020 const [isMounted, setIsMounted] = __TURBOPACK__imported__module__271645__1.useState(open); 5021 if (open && !isMounted) { 5022 setIsMounted(true); 5023 } 5024 __TURBOPACK__imported__module__271645__1.useEffect(()=>{ 5025 if (!open && isMounted) { 5026 const timeout = setTimeout(()=>setIsMounted(false), durationMs); 5027 return ()=>clearTimeout(timeout); 5028 } 5029 }, [ 5030 open, 5031 isMounted, 5032 durationMs 5033 ]); 5034 return isMounted; 5035} 5036/** 5037 * Provides a status string to apply CSS transitions to a floating element, 5038 * correctly handling placement-aware transitions. 5039 * @see https://floating-ui.com/docs/useTransition#usetransitionstatus 5040 */ function useTransitionStatus(context, props) { 5041 if (props === void 0) { 5042 props = {}; 5043 } 5044 const { open, elements: { floating } } = context; 5045 const { duration = 250 } = props; 5046 const isNumberDuration = typeof duration === 'number'; 5047 const closeDuration = (isNumberDuration ? duration : duration.close) || 0; 5048 const [status, setStatus] = __TURBOPACK__imported__module__271645__1.useState('unmounted'); 5049 const isMounted = useDelayUnmount(open, closeDuration); 5050 if (!isMounted && status === 'close') { 5051 setStatus('unmounted'); 5052 } 5053 index(()=>{ 5054 if (!floating) return; 5055 if (open) { 5056 setStatus('initial'); 5057 const frame = requestAnimationFrame(()=>{ 5058 setStatus('open'); 5059 }); 5060 return ()=>{ 5061 cancelAnimationFrame(frame); 5062 }; 5063 } 5064 setStatus('close'); 5065 }, [ 5066 open, 5067 floating 5068 ]); 5069 return { 5070 isMounted, 5071 status 5072 }; 5073} 5074/** 5075 * Provides styles to apply CSS transitions to a floating element, correctly 5076 * handling placement-aware transitions. Wrapper around `useTransitionStatus`. 5077 * @see https://floating-ui.com/docs/useTransition#usetransitionstyles 5078 */ function useTransitionStyles(context, props) { 5079 if (props === void 0) { 5080 props = {}; 5081 } 5082 const { initial: unstable_initial = { 5083 opacity: 0 5084 }, open: unstable_open, close: unstable_close, common: unstable_common, duration = 250 } = props; 5085 const placement = context.placement; 5086 const side = placement.split('-')[0]; 5087 const fnArgs = __TURBOPACK__imported__module__271645__1.useMemo(()=>({ 5088 side, 5089 placement 5090 }), [ 5091 side, 5092 placement 5093 ]); 5094 const isNumberDuration = typeof duration === 'number'; 5095 const openDuration = (isNumberDuration ? duration : duration.open) || 0; 5096 const closeDuration = (isNumberDuration ? duration : duration.close) || 0; 5097 const [styles, setStyles] = __TURBOPACK__imported__module__271645__1.useState(()=>({ 5098 ...execWithArgsOrReturn(unstable_common, fnArgs), 5099 ...execWithArgsOrReturn(unstable_initial, fnArgs) 5100 })); 5101 const { isMounted, status } = useTransitionStatus(context, { 5102 duration 5103 }); 5104 const initialRef = useLatestRef(unstable_initial); 5105 const openRef = useLatestRef(unstable_open); 5106 const closeRef = useLatestRef(unstable_close); 5107 const commonRef = useLatestRef(unstable_common); 5108 index(()=>{ 5109 const initialStyles = execWithArgsOrReturn(initialRef.current, fnArgs); 5110 const closeStyles = execWithArgsOrReturn(closeRef.current, fnArgs); 5111 const commonStyles = execWithArgsOrReturn(commonRef.current, fnArgs); 5112 const openStyles = execWithArgsOrReturn(openRef.current, fnArgs) || Object.keys(initialStyles).reduce((acc, key)=>{ 5113 acc[key] = ''; 5114 return acc; 5115 }, {}); 5116 if (status === 'initial') { 5117 setStyles((styles)=>({ 5118 transitionProperty: styles.transitionProperty, 5119 ...commonStyles, 5120 ...initialStyles 5121 })); 5122 } 5123 if (status === 'open') { 5124 setStyles({ 5125 transitionProperty: Object.keys(openStyles).map(camelCaseToKebabCase).join(','), 5126 transitionDuration: openDuration + "ms", 5127 ...commonStyles, 5128 ...openStyles 5129 }); 5130 } 5131 if (status === 'close') { 5132 const styles = closeStyles || initialStyles; 5133 setStyles({ 5134 transitionProperty: Object.keys(styles).map(camelCaseToKebabCase).join(','), 5135 transitionDuration: closeDuration + "ms", 5136 ...commonStyles, 5137 ...styles 5138 }); 5139 } 5140 }, [ 5141 closeDuration, 5142 closeRef, 5143 initialRef, 5144 openRef, 5145 commonRef, 5146 openDuration, 5147 status, 5148 fnArgs 5149 ]); 5150 return { 5151 isMounted, 5152 styles 5153 }; 5154} 5155/** 5156 * Provides a matching callback that can be used to focus an item as the user 5157 * types, often used in tandem with `useListNavigation()`. 5158 * @see https://floating-ui.com/docs/useTypeahead 5159 */ function useTypeahead(context, props) { 5160 var _ref; 5161 const { open, dataRef } = context; 5162 const { listRef, activeIndex, onMatch: unstable_onMatch, onTypingChange: unstable_onTypingChange, enabled = true, findMatch = null, resetMs = 750, ignoreKeys = [], selectedIndex = null } = props; 5163 const timeoutIdRef = __TURBOPACK__imported__module__271645__1.useRef(); 5164 const stringRef = __TURBOPACK__imported__module__271645__1.useRef(''); 5165 const prevIndexRef = __TURBOPACK__imported__module__271645__1.useRef((_ref = selectedIndex != null ? selectedIndex : activeIndex) != null ? _ref : -1); 5166 const matchIndexRef = __TURBOPACK__imported__module__271645__1.useRef(null); 5167 const onMatch = useEffectEvent(unstable_onMatch); 5168 const onTypingChange = useEffectEvent(unstable_onTypingChange);
5169 const findMatchRef = useLatestRef(findMatch); 5170 const ignoreKeysRef = useLatestRef(ignoreKeys); 5171 index(()=>{ 5172 if (open) { 5173 clearTimeout(timeoutIdRef.current); 5174 matchIndexRef.current = null; 5175 stringRef.current = ''; 5176 } 5177 }, [ 5178 open 5179 ]); 5180 index(()=>{ 5181 // Sync arrow key navigation but not typeahead navigation. 5182 if (open && stringRef.current === '') { 5183 var _ref2; 5184 prevIndexRef.current = (_ref2 = selectedIndex != null ? selectedIndex : activeIndex) != null ? _ref2 : -1; 5185 } 5186 }, [ 5187 open, 5188 selectedIndex, 5189 activeIndex 5190 ]); 5191 const setTypingChange = useEffectEvent((value)=>{ 5192 if (value) { 5193 if (!dataRef.current.typing) { 5194 dataRef.current.typing = value; 5195 onTypingChange(value); 5196 } 5197 } else { 5198 if (dataRef.current.typing) { 5199 dataRef.current.typing = value; 5200 onTypingChange(value); 5201 } 5202 } 5203 }); 5204 const onKeyDown = useEffectEvent((event)=>{ 5205 function getMatchingIndex(list, orderedList, string) { 5206 const str = findMatchRef.current ? findMatchRef.current(orderedList, string) : orderedList.find((text)=>(text == null ? void 0 : text.toLocaleLowerCase().indexOf(string.toLocaleLowerCase())) === 0); 5207 return str ? list.indexOf(str) : -1; 5208 } 5209 const listContent = listRef.current; 5210 if (stringRef.current.length > 0 && stringRef.current[0] !== ' ') { 5211 if (getMatchingIndex(listContent, listContent, stringRef.current) === -1) { 5212 setTypingChange(false); 5213 } else if (event.key === ' ') { 5214 stopEvent(event); 5215 } 5216 } 5217 if (listContent == null || ignoreKeysRef.current.includes(event.key) || // Character key. 5218 event.key.length !== 1 || // Modifier key. 5219 event.ctrlKey || event.metaKey || event.altKey) { 5220 return; 5221 } 5222 if (open && event.key !== ' ') { 5223 stopEvent(event); 5224 setTypingChange(true); 5225 } 5226 // Bail out if the list contains a word like "llama" or "aaron". TODO: 5227 // allow it in this case, too. 5228 const allowRapidSuccessionOfFirstLetter = listContent.every((text)=>{ 5229 var _text$, _text$2; 5230 return text ? ((_text$ = text[0]) == null ? void 0 : _text$.toLocaleLowerCase()) !== ((_text$2 = text[1]) == null ? void 0 : _text$2.toLocaleLowerCase()) : true; 5231 }); 5232 // Allows the user to cycle through items that start with the same letter 5233 // in rapid succession. 5234 if (allowRapidSuccessionOfFirstLetter && stringRef.current === event.key) { 5235 stringRef.current = ''; 5236 prevIndexRef.current = matchIndexRef.current; 5237 } 5238 stringRef.current += event.key; 5239 clearTimeout(timeoutIdRef.current); 5240 timeoutIdRef.current = setTimeout(()=>{ 5241 stringRef.current = ''; 5242 prevIndexRef.current = matchIndexRef.current; 5243 setTypingChange(false); 5244 }, resetMs); 5245 const prevIndex = prevIndexRef.current; 5246 const index = getMatchingIndex(listContent, [ 5247 ...listContent.slice((prevIndex || 0) + 1), 5248 ...listContent.slice(0, (prevIndex || 0) + 1) 5249 ], stringRef.current); 5250 if (index !== -1) { 5251 onMatch(index); 5252 matchIndexRef.current = index; 5253 } else if (event.key !== ' ') { 5254 stringRef.current = ''; 5255 setTypingChange(false); 5256 } 5257 }); 5258 const reference = __TURBOPACK__imported__module__271645__1.useMemo(()=>({ 5259 onKeyDown 5260 }), [ 5261 onKeyDown 5262 ]); 5263 const floating = __TURBOPACK__imported__module__271645__1.useMemo(()=>{ 5264 return { 5265 onKeyDown, 5266 onKeyUp (event) { 5267 if (event.key === ' ') { 5268 setTypingChange(false); 5269 } 5270 } 5271 }; 5272 }, [ 5273 onKeyDown, 5274 setTypingChange 5275 ]); 5276 return __TURBOPACK__imported__module__271645__1.useMemo(()=>enabled ? { 5277 reference, 5278 floating 5279 } : {}, [ 5280 enabled, 5281 reference, 5282 floating 5283 ]); 5284} 5285function getArgsWithCustomFloatingHeight(state, height) { 5286 return { 5287 ...state, 5288 rects: { 5289 ...state.rects, 5290 floating: { 5291 ...state.rects.floating, 5292 height 5293 } 5294 } 5295 }; 5296} 5297/** 5298 * Positions the floating element such that an inner element inside of it is 5299 * anchored to the reference element. 5300 * @see https://floating-ui.com/docs/inner 5301 */ const inner = (props)=>({ 5302 name: 'inner', 5303 options: props, 5304 async fn (state) { 5305 const { listRef, overflowRef, onFallbackChange, offset: innerOffset = 0, index = 0, minItemsVisible = 4, referenceOverflowThreshold = 0, scrollRef, ...detectOverflowOptions } = (0, __TURBOPACK__imported__module__343084__["evaluate"])(props, state); 5306 const { rects, elements: { floating } } = state; 5307 const item = listRef.current[index]; 5308 const scrollEl = (scrollRef == null ? void 0 : scrollRef.current) || floating; 5309 // Valid combinations: 5310 // 1. Floating element is the scrollRef and has a border (default) 5311 // 2. Floating element is not the scrollRef, floating element has a border 5312 // 3. Floating element is not the scrollRef, scrollRef has a border 5313 // Floating > {...getFloatingProps()} wrapper > scrollRef > items is not 5314 // allowed as VoiceOver doesn't work. 5315 const clientTop = floating.clientTop || scrollEl.clientTop; 5316 const floatingIsBordered = floating.clientTop !== 0; 5317 const scrollElIsBordered = scrollEl.clientTop !== 0; 5318 const floatingIsScrollEl = floating === scrollEl; 5319 if ("TURBOPACK compile-time falsy", 0) //TURBOPACK unreachable 5320 ; 5321 if (!item) { 5322 return {}; 5323 } 5324 const nextArgs = { 5325 ...state, 5326 ...await (0, __TURBOPACK__imported__module__258950__1["offset"])(-item.offsetTop - floating.clientTop - rects.reference.height / 2 - item.offsetHeight / 2 - innerOffset).fn(state) 5327 }; 5328 const overflow = await (0, __TURBOPACK__imported__module__953760__1["detectOverflow"])(getArgsWithCustomFloatingHeight(nextArgs, scrollEl.scrollHeight + clientTop + floating.clientTop), detectOverflowOptions); 5329 const refOverflow = await (0, __TURBOPACK__imported__module__953760__1["detectOverflow"])(nextArgs, { 5330 ...detectOverflowOptions, 5331 elementContext: 'reference' 5332 }); 5333 const diffY = (0, __TURBOPACK__imported__module__343084__["max"])(0, overflow.top);
5334 const nextY = nextArgs.y + diffY; 5335 const isScrollable = scrollEl.scrollHeight > scrollEl.clientHeight; 5336 const rounder = isScrollable ? (v)=>v : __TURBOPACK__imported__module__343084__["round"]; 5337 const maxHeight = rounder((0, __TURBOPACK__imported__module__343084__["max"])(0, scrollEl.scrollHeight + (floatingIsBordered && floatingIsScrollEl || scrollElIsBordered ? clientTop * 2 : 0) - diffY - (0, __TURBOPACK__imported__module__343084__["max"])(0, overflow.bottom))); 5338 scrollEl.style.maxHeight = maxHeight + "px"; 5339 scrollEl.scrollTop = diffY; 5340 // There is not enough space, fallback to standard anchored positioning 5341 if (onFallbackChange) { 5342 const shouldFallback = scrollEl.offsetHeight < item.offsetHeight * (0, __TURBOPACK__imported__module__343084__["min"])(minItemsVisible, listRef.current.length) - 1 || refOverflow.top >= -referenceOverflowThreshold || refOverflow.bottom >= -referenceOverflowThreshold; 5343 __TURBOPACK__imported__module__174080__["flushSync"](()=>onFallbackChange(shouldFallback)); 5344 } 5345 if (overflowRef) { 5346 overflowRef.current = await (0, __TURBOPACK__imported__module__953760__1["detectOverflow"])(getArgsWithCustomFloatingHeight({ 5347 ...nextArgs, 5348 y: nextY 5349 }, scrollEl.offsetHeight + clientTop + floating.clientTop), detectOverflowOptions); 5350 } 5351 return { 5352 y: nextY 5353 }; 5354 } 5355 }); 5356/** 5357 * Changes the `inner` middleware's `offset` upon a `wheel` event to 5358 * expand the floating element's height, revealing more list items. 5359 * @see https://floating-ui.com/docs/inner 5360 */ function useInnerOffset(context, props) { 5361 const { open, elements } = context; 5362 const { enabled = true, overflowRef, scrollRef, onChange: unstable_onChange } = props; 5363 const onChange = useEffectEvent(unstable_onChange); 5364 const controlledScrollingRef = __TURBOPACK__imported__module__271645__1.useRef(false); 5365 const prevScrollTopRef = __TURBOPACK__imported__module__271645__1.useRef(null); 5366 const initialOverflowRef = __TURBOPACK__imported__module__271645__1.useRef(null); 5367 __TURBOPACK__imported__module__271645__1.useEffect(()=>{ 5368 if (!enabled) return; 5369 function onWheel(e) { 5370 if (e.ctrlKey || !el || overflowRef.current == null) { 5371 return; 5372 } 5373 const dY = e.deltaY; 5374 const isAtTop = overflowRef.current.top >= -0.5; 5375 const isAtBottom = overflowRef.current.bottom >= -0.5; 5376 const remainingScroll = el.scrollHeight - el.clientHeight; 5377 const sign = dY < 0 ? -1 : 1; 5378 const method = dY < 0 ? 'max' : 'min'; 5379 if (el.scrollHeight <= el.clientHeight) { 5380 return; 5381 } 5382 if (!isAtTop && dY > 0 || !isAtBottom && dY < 0) { 5383 e.preventDefault(); 5384 __TURBOPACK__imported__module__174080__["flushSync"](()=>{ 5385 onChange((d)=>d + Math[method](dY, remainingScroll * sign)); 5386 }); 5387 } else if (/firefox/i.test(getUserAgent())) { 5388 // Needed to propagate scrolling during momentum scrolling phase once 5389 // it gets limited by the boundary. UX improvement, not critical. 5390 el.scrollTop += dY; 5391 } 5392 } 5393 const el = (scrollRef == null ? void 0 : scrollRef.current) || elements.floating; 5394 if (open && el) { 5395 el.addEventListener('wheel', onWheel); 5396 // Wait for the position to be ready. 5397 requestAnimationFrame(()=>{ 5398 prevScrollTopRef.current = el.scrollTop; 5399 if (overflowRef.current != null) { 5400 initialOverflowRef.current = { 5401 ...overflowRef.current 5402 }; 5403 } 5404 }); 5405 return ()=>{ 5406 prevScrollTopRef.current = null; 5407 initialOverflowRef.current = null; 5408 el.removeEventListener('wheel', onWheel); 5409 }; 5410 } 5411 }, [ 5412 enabled, 5413 open, 5414 elements.floating, 5415 overflowRef, 5416 scrollRef, 5417 onChange 5418 ]); 5419 const floating = __TURBOPACK__imported__module__271645__1.useMemo(()=>({ 5420 onKeyDown () { 5421 controlledScrollingRef.current = true; 5422 }, 5423 onWheel () { 5424 controlledScrollingRef.current = false;
5425 }, 5426 onPointerMove () { 5427 controlledScrollingRef.current = false; 5428 }, 5429 onScroll () { 5430 const el = (scrollRef == null ? void 0 : scrollRef.current) || elements.floating; 5431 if (!overflowRef.current || !el || !controlledScrollingRef.current) { 5432 return; 5433 } 5434 if (prevScrollTopRef.current !== null) { 5435 const scrollDiff = el.scrollTop - prevScrollTopRef.current; 5436 if (overflowRef.current.bottom < -0.5 && scrollDiff < -1 || overflowRef.current.top < -0.5 && scrollDiff > 1) { 5437 __TURBOPACK__imported__module__174080__["flushSync"](()=>onChange((d)=>d + scrollDiff)); 5438 } 5439 } 5440 // [Firefox] Wait for the height change to have been applied. 5441 requestAnimationFrame(()=>{ 5442 prevScrollTopRef.current = el.scrollTop; 5443 }); 5444 } 5445 }), [ 5446 elements.floating, 5447 onChange, 5448 overflowRef, 5449 scrollRef 5450 ]); 5451 return __TURBOPACK__imported__module__271645__1.useMemo(()=>enabled ? { 5452 floating 5453 } : {}, [ 5454 enabled, 5455 floating 5456 ]); 5457} 5458function isPointInPolygon(point, polygon) { 5459 const [x, y] = point; 5460 let isInside = false;
5461 const length = polygon.length; 5462 for(let i = 0, j = length - 1; i < length; j = i++){ 5463 const [xi, yi] = polygon[i] || [ 5464 0, 5465 0 5466 ]; 5467 const [xj, yj] = polygon[j] || [ 5468 0, 5469 0 5470 ]; 5471 const intersect = yi >= y !== yj >= y && x <= (xj - xi) * (y - yi) / (yj - yi) + xi; 5472 if (intersect) { 5473 isInside = !isInside; 5474 } 5475 } 5476 return isInside; 5477} 5478function isInside(point, rect) { 5479 return point[0] >= rect.x && point[0] <= rect.x + rect.width && point[1] >= rect.y && point[1] <= rect.y + rect.height; 5480} 5481/** 5482 * Generates a safe polygon area that the user can traverse without closing the 5483 * floating element once leaving the reference element. 5484 * @see https://floating-ui.com/docs/useHover#safepolygon 5485 */ function safePolygon(options) { 5486 if (options === void 0) { 5487 options = {}; 5488 } 5489 const { buffer = 0.5, blockPointerEvents = false, requireIntent = true } = options; 5490 let timeoutId; 5491 let hasLanded = false; 5492 let lastX = null; 5493 let lastY = null; 5494 let lastCursorTime = performance.now(); 5495 function getCursorSpeed(x, y) { 5496 const currentTime = performance.now(); 5497 const elapsedTime = currentTime - lastCursorTime; 5498 if (lastX === null || lastY === null || elapsedTime === 0) { 5499 lastX = x; 5500 lastY = y; 5501 lastCursorTime = currentTime; 5502 return null; 5503 } 5504 const deltaX = x - lastX; 5505 const deltaY = y - lastY; 5506 const distance = Math.sqrt(deltaX * deltaX + deltaY * deltaY); 5507 const speed = distance / elapsedTime; // px / ms 5508 lastX = x; 5509 lastY = y; 5510 lastCursorTime = currentTime; 5511 return speed; 5512 } 5513 const fn = (_ref)=>{ 5514 let { x, y, placement, elements, onClose, nodeId, tree } = _ref; 5515 return function onMouseMove(event) { 5516 function close() { 5517 clearTimeout(timeoutId); 5518 onClose(); 5519 } 5520 clearTimeout(timeoutId); 5521 if (!elements.domReference || !elements.floating || placement == null || x == null || y == null) { 5522 return; 5523 } 5524 const { clientX, clientY } = event; 5525 const clientPoint = [ 5526 clientX, 5527 clientY 5528 ]; 5529 const target = getTarget(event); 5530 const isLeave = event.type === 'mouseleave'; 5531 const isOverFloatingEl = contains(elements.floating, target); 5532 const isOverReferenceEl = contains(elements.domReference, target); 5533 const refRect = elements.domReference.getBoundingClientRect(); 5534 const rect = elements.floating.getBoundingClientRect(); 5535 const side = placement.split('-')[0]; 5536 const cursorLeaveFromRight = x > rect.right - rect.width / 2; 5537 const cursorLeaveFromBottom = y > rect.bottom - rect.height / 2; 5538 const isOverReferenceRect = isInside(clientPoint, refRect); 5539 const isFloatingWider = rect.width > refRect.width; 5540 const isFloatingTaller = rect.height > refRect.height; 5541 const left = (isFloatingWider ? refRect : rect).left; 5542 const right = (isFloatingWider ? refRect : rect).right; 5543 const top = (isFloatingTaller ? refRect : rect).top; 5544 const bottom = (isFloatingTaller ? refRect : rect).bottom; 5545 if (isOverFloatingEl) { 5546 hasLanded = true; 5547 if (!isLeave) { 5548 return; 5549 } 5550 } 5551 if (isOverReferenceEl) { 5552 hasLanded = false; 5553 } 5554 if (isOverReferenceEl && !isLeave) { 5555 hasLanded = true; 5556 return; 5557 } 5558 // Prevent overlapping floating element from being stuck in an open-close 5559 // loop: https://github.com/floating-ui/floating-ui/issues/1910 5560 if (isLeave && (0, __TURBOPACK__imported__module__229315__1["isElement"])(event.relatedTarget) && contains(elements.floating, event.relatedTarget)) { 5561 return; 5562 } 5563 // If any nested child is open, abort. 5564 if (tree && getChildren(tree.nodesRef.current, nodeId).some((_ref2)=>{ 5565 let { context } = _ref2; 5566 return context == null ? void 0 : context.open; 5567 })) { 5568 return; 5569 } 5570 // If the pointer is leaving from the opposite side, the "buffer" logic 5571 // creates a point where the floating element remains open, but should be 5572 // ignored. 5573 // A constant of 1 handles floating point rounding errors. 5574 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) { 5575 return close(); 5576 } 5577 // Ignore when the cursor is within the rectangular trough between the 5578 // two elements. Since the triangle is created from the cursor point, 5579 // which can start beyond the ref element's edge, traversing back and 5580 // forth from the ref to the floating element can cause it to close. This 5581 // ensures it always remains open in that case. 5582 let rectPoly = []; 5583 switch(side){ 5584 case 'top': 5585 rectPoly = [ 5586 [ 5587 left, 5588 refRect.top + 1 5589 ], 5590 [ 5591 left, 5592 rect.bottom - 1 5593 ], 5594 [ 5595 right, 5596 rect.bottom - 1 5597 ], 5598 [ 5599 right, 5600 refRect.top + 1 5601 ] 5602 ]; 5603 break; 5604 case 'bottom': 5605 rectPoly = [ 5606 [ 5607 left, 5608 rect.top + 1 5609 ], 5610 [ 5611 left, 5612 refRect.bottom - 1 5613 ], 5614 [ 5615 right, 5616 refRect.bottom - 1 5617 ], 5618 [ 5619 right, 5620 rect.top + 1 5621 ] 5622 ]; 5623 break; 5624 case 'left': 5625 rectPoly = [ 5626 [ 5627 rect.right - 1, 5628 bottom 5629 ], 5630 [ 5631 rect.right - 1, 5632 top 5633 ], 5634 [ 5635 refRect.left + 1, 5636 top 5637 ], 5638 [ 5639 refRect.left + 1, 5640 bottom 5641 ] 5642 ]; 5643 break; 5644 case 'right': 5645 rectPoly = [ 5646 [ 5647 refRect.right - 1, 5648 bottom 5649 ], 5650 [ 5651 refRect.right - 1, 5652 top 5653 ], 5654 [ 5655 rect.left + 1, 5656 top 5657 ], 5658 [ 5659 rect.left + 1, 5660 bottom 5661 ] 5662 ]; 5663 break; 5664 } 5665 function getPolygon(_ref3) { 5666 let [x, y] = _ref3; 5667 switch(side){ 5668 case 'top': 5669 { 5670 const cursorPointOne = [ 5671 isFloatingWider ? x + buffer / 2 : cursorLeaveFromRight ? x + buffer * 4 : x - buffer * 4, 5672 y + buffer + 1 5673 ]; 5674 const cursorPointTwo = [ 5675 isFloatingWider ? x - buffer / 2 : cursorLeaveFromRight ? x + buffer * 4 : x - buffer * 4, 5676 y + buffer + 1 5677 ]; 5678 const commonPoints = [ 5679 [ 5680 rect.left, 5681 cursorLeaveFromRight ? rect.bottom - buffer : isFloatingWider ? rect.bottom - buffer : rect.top 5682 ], 5683 [ 5684 rect.right, 5685 cursorLeaveFromRight ? isFloatingWider ? rect.bottom - buffer : rect.top : rect.bottom - buffer 5686 ] 5687 ]; 5688 return [ 5689 cursorPointOne, 5690 cursorPointTwo, 5691 ...commonPoints 5692 ]; 5693 } 5694 case 'bottom': 5695 { 5696 const cursorPointOne = [ 5697 isFloatingWider ? x + buffer / 2 : cursorLeaveFromRight ? x + buffer * 4 : x - buffer * 4, 5698 y - buffer 5699 ]; 5700 const cursorPointTwo = [ 5701 isFloatingWider ? x - buffer / 2 : cursorLeaveFromRight ? x + buffer * 4 : x - buffer * 4, 5702 y - buffer 5703 ]; 5704 const commonPoints = [ 5705 [ 5706 rect.left, 5707 cursorLeaveFromRight ? rect.top + buffer : isFloatingWider ? rect.top + buffer : rect.bottom 5708 ], 5709 [ 5710 rect.right, 5711 cursorLeaveFromRight ? isFloatingWider ? rect.top + buffer : rect.bottom : rect.top + buffer 5712 ] 5713 ]; 5714 return [ 5715 cursorPointOne, 5716 cursorPointTwo, 5717 ...commonPoints 5718 ]; 5719 } 5720 case 'left': 5721 { 5722 const cursorPointOne = [ 5723 x + buffer + 1, 5724 isFloatingTaller ? y + buffer / 2 : cursorLeaveFromBottom ? y + buffer * 4 : y - buffer * 4 5725 ]; 5726 const cursorPointTwo = [ 5727 x + buffer + 1, 5728 isFloatingTaller ? y - buffer / 2 : cursorLeaveFromBottom ? y + buffer * 4 : y - buffer * 4 5729 ]; 5730 const commonPoints = [ 5731 [ 5732 cursorLeaveFromBottom ? rect.right - buffer : isFloatingTaller ? rect.right - buffer : rect.left, 5733 rect.top 5734 ], 5735 [ 5736 cursorLeaveFromBottom ? isFloatingTaller ? rect.right - buffer : rect.left : rect.right - buffer, 5737 rect.bottom 5738 ] 5739 ]; 5740 return [ 5741 ...commonPoints, 5742 cursorPointOne, 5743 cursorPointTwo 5744 ]; 5745 } 5746 case 'right': 5747 { 5748 const cursorPointOne = [ 5749 x - buffer, 5750 isFloatingTaller ? y + buffer / 2 : cursorLeaveFromBottom ? y + buffer * 4 : y - buffer * 4 5751 ]; 5752 const cursorPointTwo = [ 5753 x - buffer, 5754 isFloatingTaller ? y - buffer / 2 : cursorLeaveFromBottom ? y + buffer * 4 : y - buffer * 4 5755 ]; 5756 const commonPoints = [ 5757 [ 5758 cursorLeaveFromBottom ? rect.left + buffer : isFloatingTaller ? rect.left + buffer : rect.right, 5759 rect.top 5760 ], 5761 [ 5762 cursorLeaveFromBottom ? isFloatingTaller ? rect.left + buffer : rect.right : rect.left + buffer, 5763 rect.bottom 5764 ] 5765 ]; 5766 return [ 5767 cursorPointOne, 5768 cursorPointTwo, 5769 ...commonPoints 5770 ]; 5771 } 5772 } 5773 } 5774 if (isPointInPolygon([ 5775 clientX, 5776 clientY 5777 ], rectPoly)) { 5778 return; 5779 } 5780 if (hasLanded && !isOverReferenceRect) { 5781 return close(); 5782 } 5783 if (!isLeave && requireIntent) { 5784 const cursorSpeed = getCursorSpeed(event.clientX, event.clientY); 5785 const cursorSpeedThreshold = 0.1;
5786 if (cursorSpeed !== null && cursorSpeed < cursorSpeedThreshold) { 5787 return close(); 5788 } 5789 } 5790 if (!isPointInPolygon([ 5791 clientX, 5792 clientY 5793 ], getPolygon([ 5794 x, 5795 y 5796 ]))) { 5797 close(); 5798 } else if (!hasLanded && requireIntent) { 5799 timeoutId = window.setTimeout(close, 40); 5800 } 5801 }; 5802 }; 5803 fn.__options = { 5804 blockPointerEvents 5805 }; 5806 return fn; 5807} 5808; 5809var __TURBOPACK__imported__module__271645__2 = __TURBOPACK__imported__module__271645__; 5810var __TURBOPACK__imported__module__746725__ = __turbopack_context__.i(746725); 5811var __TURBOPACK__imported__module__914189__ = __turbopack_context__.i(914189); 5812var __TURBOPACK__imported__module__835696__1 = __TURBOPACK__imported__module__835696__; 5813var __TURBOPACK__imported__module__813581__ = __turbopack_context__.i(813581); 5814; 5815; 5816; 5817; 5818; 5819; 5820; 5821let y = /*#__PURE__*/ (0, __TURBOPACK__imported__module__271645__2["createContext"])({ 5822 styles: void 0, 5823 setReference: ()=>{}, 5824 setFloating: ()=>{}, 5825 getReferenceProps: ()=>({}), 5826 getFloatingProps: ()=>({}), 5827 slot: {} 5828}); 5829y.displayName = "FloatingContext"; 5830let $ = /*#__PURE__*/ (0, __TURBOPACK__imported__module__271645__2["createContext"])(null); 5831$.displayName = "PlacementContext"; 5832function ye(e) { 5833 return (0, __TURBOPACK__imported__module__271645__2["useMemo"])(()=>e ? typeof e == "string" ? { 5834 to: e 5835 } : e : null, [ 5836 e 5837 ]); 5838} 5839function Fe() { 5840 return (0, __TURBOPACK__imported__module__271645__2["useContext"])(y).setReference; 5841} 5842function be() { 5843 return (0, __TURBOPACK__imported__module__271645__2["useContext"])(y).getReferenceProps; 5844} 5845function Te() { 5846 let { getFloatingProps: e, slot: t } = (0, __TURBOPACK__imported__module__271645__2["useContext"])(y); 5847 return (0, __TURBOPACK__imported__module__271645__2["useCallback"])(function() { 5848 for(var _len = arguments.length, n = new Array(_len), _key = 0; _key < _len; _key++){ 5849 n[_key] = arguments[_key]; 5850 } 5851 return Object.assign({}, e(...n), { 5852 "data-anchor": t.anchor 5853 }); 5854 }, [ 5855 e, 5856 t 5857 ]); 5858} 5859function Re() { 5860 let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : null; 5861 e === !1 && (e = null), typeof e == "string" && (e = { 5862 to: e 5863 }); 5864 let t = (0, __TURBOPACK__imported__module__271645__2["useContext"])($), n = (0, __TURBOPACK__imported__module__271645__2["useMemo"])(()=>e, [ 5865 JSON.stringify(e, (l, o)=>{ 5866 var u; 5867 return (u = o == null ? void 0 : o.outerHTML) != null ? u : o; 5868 }) 5869 ]); 5870 (0, __TURBOPACK__imported__module__835696__1["useIsoMorphicEffect"])(()=>{ 5871 t == null || t(n != null ? n : null); 5872 }, [ 5873 t, 5874 n 5875 ]); 5876 let r = (0, __TURBOPACK__imported__module__271645__2["useContext"])(y); 5877 return (0, __TURBOPACK__imported__module__271645__2["useMemo"])(()=>[ 5878 r.setFloating, 5879 e ? r.styles : {} 5880 ], [ 5881 r.setFloating, 5882 e, 5883 r.styles 5884 ]); 5885} 5886let D = 4; 5887function Ae(param) { 5888 let { children: e, enabled: t = !0 } = param; 5889 let [n, r] = (0, __TURBOPACK__imported__module__271645__2["useState"])(null), [l, o] = (0, __TURBOPACK__imported__module__271645__2["useState"])(0), u = (0, __TURBOPACK__imported__module__271645__2["useRef"])(null), [f, s] = (0, __TURBOPACK__imported__module__271645__2["useState"])(null); 5890 ce(f); 5891 let i = t && n !== null && f !== null, { to: F = "bottom", gap: E = 0, offset: A = 0, padding: c = 0, inner: h } = ge(n, f), [a, p = "center"] = F.split(" "); 5892 (0, __TURBOPACK__imported__module__835696__1["useIsoMorphicEffect"])(()=>{ 5893 i && o(0); 5894 }, [ 5895 i 5896 ]); 5897 let { refs: b, floatingStyles: S, context: g } = useFloating({ 5898 open: i, 5899 placement: a === "selection" ? p === "center" ? "bottom" : "bottom-".concat(p) : p === "center" ? "".concat(a) : "".concat(a, "-").concat(p), 5900 strategy: "absolute", 5901 transform: !1, 5902 middleware: [ 5903 (0, __TURBOPACK__imported__module__258950__["offset"])({ 5904 mainAxis: a === "selection" ? 0 : E, 5905 crossAxis: A 5906 }), 5907 (0, __TURBOPACK__imported__module__258950__["shift"])({ 5908 padding: c 5909 }), 5910 a !== "selection" && (0, __TURBOPACK__imported__module__258950__["flip"])({ 5911 padding: c 5912 }), 5913 a === "selection" && h ? inner({ 5914 ...h, 5915 padding: c, 5916 overflowRef: u, 5917 offset: l, 5918 minItemsVisible: D, 5919 referenceOverflowThreshold: c, 5920 onFallbackChange (P) { 5921 var L, N; 5922 if (!P) return; 5923 let d = g.elements.floating; 5924 if (!d) return; 5925 let M = parseFloat(getComputedStyle(d).scrollPaddingBottom) || 0, I = Math.min(D, d.childElementCount), W = 0, B = 0; 5926 for (let m of (N = (L = g.elements.floating) == null ? void 0 : L.childNodes) != null ? N : [])if (__TURBOPACK__imported__module__813581__["isHTMLElement"](m)) { 5927 let x = m.offsetTop, k = x + m.clientHeight + M, H = d.scrollTop, U = H + d.clientHeight; 5928 if (x >= H && k <= U) I--; 5929 else { 5930 B = Math.max(0, Math.min(k, U) - Math.max(x, H)), W = m.clientHeight; 5931 break; 5932 } 5933 } 5934 I >= 1 && o((m)=>{ 5935 let x = W * I - B + M; 5936 return m >= x ? m : x; 5937 }); 5938 } 5939 }) : null, 5940 (0, __TURBOPACK__imported__module__258950__["size"])({ 5941 padding: c, 5942 apply (param) { 5943 let { availableWidth: P, availableHeight: d, elements: M } = param; 5944 Object.assign(M.floating.style, { 5945 overflow: "auto", 5946 maxWidth: "".concat(P, "px"), 5947 maxHeight: "min(var(--anchor-max-height, 100vh), ".concat(d, "px)") 5948 }); 5949 } 5950 })
5951 ].filter(Boolean), 5952 whileElementsMounted: __TURBOPACK__imported__module__953760__["autoUpdate"] 5953 }), [w = a, V = p] = g.placement.split("-"); 5954 a === "selection" && (w = "selection"); 5955 let G = (0, __TURBOPACK__imported__module__271645__2["useMemo"])(()=>({ 5956 anchor: [ 5957 w, 5958 V 5959 ].filter(Boolean).join(" ") 5960 }), [ 5961 w, 5962 V 5963 ]), K = useInnerOffset(g, { 5964 overflowRef: u, 5965 onChange: o 5966 }), { getReferenceProps: Q, getFloatingProps: X } = useInteractions([ 5967 K 5968 ]), Y = (0, __TURBOPACK__imported__module__914189__["useEvent"])((P)=>{ 5969 s(P), b.setFloating(P); 5970 }); 5971 return /*#__PURE__*/ __TURBOPACK__imported__module__271645__2["createElement"]($.Provider, { 5972 value: r 5973 }, /*#__PURE__*/ __TURBOPACK__imported__module__271645__2["createElement"](y.Provider, { 5974 value: { 5975 setFloating: Y, 5976 setReference: b.setReference, 5977 styles: S, 5978 getReferenceProps: Q, 5979 getFloatingProps: X, 5980 slot: G 5981 } 5982 }, e)); 5983} 5984function ce(e) { 5985 (0, __TURBOPACK__imported__module__835696__1["useIsoMorphicEffect"])(()=>{ 5986 if (!e) return; 5987 let t = new MutationObserver(()=>{ 5988 let n = window.getComputedStyle(e).maxHeight, r = parseFloat(n); 5989 if (isNaN(r)) return; 5990 let l = parseInt(n); 5991 isNaN(l) || r !== l && (e.style.maxHeight = "".concat(Math.ceil(r), "px")); 5992 }); 5993 return t.observe(e, { 5994 attributes: !0, 5995 attributeFilter: [ 5996 "style" 5997 ] 5998 }), ()=>{ 5999 t.disconnect(); 6000 }; 6001 }, [ 6002 e 6003 ]); 6004} 6005function ge(e, t) { 6006 var o, u, f; 6007 let n = O((o = e == null ? void 0 : e.gap) != null ? o : "var(--anchor-gap, 0)", t), r = O((u = e == null ? void 0 : e.offset) != null ? u : "var(--anchor-offset, 0)", t), l = O((f = e == null ? void 0 : e.padding) != null ? f : "var(--anchor-padding, 0)", t); 6008 return { 6009 ...e, 6010 gap: n, 6011 offset: r, 6012 padding: l 6013 }; 6014} 6015function O(e, t) { 6016 let n = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : void 0; 6017 let r = (0, __TURBOPACK__imported__module__746725__["useDisposables"])(), l = (0, __TURBOPACK__imported__module__914189__["useEvent"])((s, i)=>{ 6018 if (s == null) return [ 6019 n, 6020 null 6021 ]; 6022 if (typeof s == "number") return [ 6023 s, 6024 null 6025 ]; 6026 if (typeof s == "string") { 6027 if (!i) return [ 6028 n, 6029 null 6030 ]; 6031 let F = J(s, i); 6032 return [ 6033 F, 6034 (E)=>{ 6035 let A = q(s); 6036 { 6037 let c = A.map((h)=>window.getComputedStyle(i).getPropertyValue(h)); 6038 r.requestAnimationFrame(function h() { 6039 r.nextFrame(h); 6040 let a = !1; 6041 for (let [b, S] of A.entries()){ 6042 let g = window.getComputedStyle(i).getPropertyValue(S); 6043 if (c[b] !== g) { 6044 c[b] = g, a = !0; 6045 break; 6046 } 6047 } 6048 if (!a) return; 6049 let p = J(s, i); 6050 F !== p && (E(p), F = p); 6051 }); 6052 } 6053 return r.dispose; 6054 } 6055 ]; 6056 } 6057 return [ 6058 n, 6059 null 6060 ]; 6061 }), o = (0, __TURBOPACK__imported__module__271645__2["useMemo"])(()=>l(e, t)[0], [ 6062 e, 6063 t 6064 ]), [u = o, f] = (0, __TURBOPACK__imported__module__271645__2["useState"])(); 6065 return (0, __TURBOPACK__imported__module__835696__1["useIsoMorphicEffect"])(()=>{ 6066 let [s, i] = l(e, t); 6067 if (f(s), !!i) return i(f); 6068 }, [ 6069 e, 6070 t 6071 ]), u; 6072} 6073function q(e) { 6074 let t = /var\((.*)\)/.exec(e); 6075 if (t) { 6076 let n = t[1].indexOf(","); 6077 if (n === -1) return [ 6078 t[1] 6079 ]; 6080 let r = t[1].slice(0, n).trim(), l = t[1].slice(n + 1).trim(); 6081 return l ? [ 6082 r, 6083 ...q(l) 6084 ] : [ 6085 r 6086 ]; 6087 } 6088 return []; 6089} 6090function J(e, t) { 6091 let n = document.createElement("div"); 6092 t.appendChild(n), n.style.setProperty("margin-top", "0px", "important"), n.style.setProperty("margin-top", e, "important"); 6093 let r = parseFloat(window.getComputedStyle(n).marginTop) || 0; 6094 return t.removeChild(n), r; 6095} 6096; 6097__turbopack_context__.s([ 6098 "FloatingProvider", 6099 0, 6100 Ae, 6101 "useFloatingPanel", 6102 0, 6103 Re, 6104 "useFloatingPanelProps", 6105 0, 6106 Te, 6107 "useFloatingReference", 6108 0, 6109 Fe, 6110 "useFloatingReferenceProps", 6111 0, 6112 be, 6113 "useResolvedAnchor", 6114 0, 6115 ye 6116], 919751); 6117}), 6118488374, 863516, 6119157138, 6120571616, 612165659, 6122667310, 6123((__turbopack_context__) => { 6124"use strict"; 6125 6126// MERGED MODULE: [project]/node_modules/@headlessui/react/dist/hooks/use-handle-toggle.js [a
6126pp-client] (ecmascript) 6127; 6128var __TURBOPACK__imported__module__271645__ = __turbopack_context__.i(271645); 6129// MERGED MODULE: [project]/node_modules/@headlessui/react/dist/components/mouse.js [app-client] (ecmascript) 6130; 6131var g = ((f)=>(f[f.Left = 0] = "Left", f[f.Right = 2] = "Right", f))(g || {}); 6132; 6133__turbopack_context__.s([ 6134 "MouseButton", 6135 0, 6136 g 6137], 863516); 6138var __TURBOPACK__imported__module__233538__ = __turbopack_context__.i(233538); 6139var __TURBOPACK__imported__module__914189__ = __turbopack_context__.i(914189); 6140; 6141; 6142; 6143; 6144function s(t) { 6145 let r = (0, __TURBOPACK__imported__module__271645__["useRef"])(null), u = (0, __TURBOPACK__imported__module__914189__["useEvent"])((e)=>{ 6146 r.current = e.pointerType, !(0, __TURBOPACK__imported__module__233538__["isDisabledReactIssue7711"])(e.currentTarget) && e.pointerType === "mouse" && e.button === g.Left && (e.preventDefault(), t(e)); 6147 }), i = (0, __TURBOPACK__imported__module__914189__["useEvent"])((e)=>{ 6148 r.current !== "mouse" && ((0, __TURBOPACK__imported__module__233538__["isDisabledReactIssue7711"])(e.currentTarget) || t(e)); 6149 }); 6150 return { 6151 onPointerDown: u, 6152 onClick: i 6153 }; 6154} 6155; 6156__turbopack_context__.s([ 6157 "useHandleToggle", 6158 0, 6159 s 6160], 488374); 6161// MERGED MODULE: [project]/node_modules/@headlessui/react/dist/hooks/use-quick-release.js [app-client] (ecmascript) 6162; 6163var __TURBOPACK__imported__module__271645__1 = __TURBOPACK__imported__module__271645__; 6164var __TURBOPACK__imported__module__813581__ = __turbopack_context__.i(813581); 6165var __TURBOPACK__imported__module__22357__ = __turbopack_context__.i(22357); 6166; 6167; 6168; 6169var H = ((e)=>(e[e.Ignore = 0] = "Ignore", e[e.Select = 1] = "Select", e[e.Close = 2] = "Close", e))(H || {}); 6170const S = { 6171 Ignore: { 6172 kind: 0 6173 }, 6174 Select: (r)=>({ 6175 kind: 1, 6176 target: r 6177 }), 6178 Close: { 6179 kind: 2 6180 } 6181}, M = 200, f = 5; 6182function L(r, param) { 6183 let { trigger: n, action: T, close: e, select: p } = param; 6184 let l = (0, __TURBOPACK__imported__module__271645__1["useRef"])(null), i = (0, __TURBOPACK__imported__module__271645__1["useRef"])(null), u = (0, __TURBOPACK__imported__module__271645__1["useRef"])(null); 6185 (0, __TURBOPACK__imported__module__22357__["useDocumentEvent"])(r && n !== null, "pointerdown", (t)=>{ 6186 __TURBOPACK__imported__module__813581__["isNode"](t == null ? void 0 : t.target) && n != null && n.contains(t.target) && (i.current = t.x, u.current = t.y, l.current = t.timeStamp); 6187 }), (0, __TURBOPACK__imported__module__22357__["useDocumentEvent"])(r && n !== null, "pointerup", (t)=>{ 6188 var s, m; 6189 let c = l.current; 6190 if (c === null || (l.current = null, !__TURBOPACK__imported__module__813581__["isHTMLorSVGElement"](t.target)) || Math.abs(t.x - ((s = i.current) != null ? s : t.x)) < f && Math.abs(t.y - ((m = u.current) != null ? m : t.y)) < f) return; 6191 let a = T(t); 6192 switch(a.kind){ 6193 case 0: 6194 return; 6195 case 1: 6196 { 6197 t.timeStamp - c > M && (p(a.target), e()); 6198 break; 6199 } 6200 case 2: 6201 { 6202 e(); 6203 break; 6204 } 6205 } 6206 }, { 6207 capture: !0 6208 }); 6209} 6210; 6211__turbopack_context__.s([ 6212 "Action", 6213 0, 6214 S, 6215 "useQuickRelease", 6216 0, 6217 L 6218], 157138); 6219// MERGED MODULE: [project]/node_modules/@headlessui/react/dist/hooks/use-tracked-pointer.js [app-client] (ecmascript) 6220; 6221var __TURBOPACK__imported__module__271645__2 = __TURBOPACK__imported__module__271645__; 6222; 6223function t(e) { 6224 return [ 6225 e.screenX, 6226 e.screenY 6227 ]; 6228} 6229function u() { 6230 let e = (0, __TURBOPACK__imported__module__271645__2["useRef"])([ 6231 -1, 6232 -1 6233 ]); 6234 return { 6235 wasMoved (r) { 6236 let n = t(r); 6237 return e.current[0] === n[0] && e.current[1] === n[1] ? !1 : (e.current = n, !0); 6238 }, 6239 update (r) { 6240 e.current = t(r); 6241 } 6242 }; 6243} 6244; 6245__turbopack_context__.s([ 6246 "useTrackedPointer", 6247 0, 6248 u 6249], 571616); 6250// MERGED MODULE: [project]/node_modules/@headlessui/react/dist/utils/calculate-active-index.js [app-client] (ecmascript) 6251; 6252function u1(l) { 6253 throw new Error("Unexpected object: " + l); 6254} 6255var c = ((i)=>(i[i.First = 0] = "First", i[i.Previous = 1] = "Previous", i[i.Next = 2] = "Next", i[i.Last = 3] = "Last", i[i.Specific = 4] = "Specific", i[i.Nothing = 5] = "Nothing", i))(c || {}); 6256function f1(l, n) { 6257 let t = n.resolveItems(); 6258 if (t.length <= 0) return null; 6259 let r = n.resolveActiveIndex(), s = r != null ? r : -1; 6260 switch(l.focus){ 6261 case 0: 6262 { 6263 for(let e = 0; e < t.length; ++e)if (!n.resolveDisabled(t[e], e, t)) return e; 6264 return r; 6265 } 6266 case 1: 6267 { 6268 s === -1 && (s = t.length);
6269 for(let e = s - 1; e >= 0; --e)if (!n.resolveDisabled(t[e], e, t)) return e; 6270 return r; 6271 } 6272 case 2: 6273 { 6274 for(let e = s + 1; e < t.length; ++e)if (!n.resolveDisabled(t[e], e, t)) return e; 6275 return r; 6276 } 6277 case 3: 6278 { 6279 for(let e = t.length - 1; e >= 0; --e)if (!n.resolveDisabled(t[e], e, t)) return e; 6280 return r; 6281 } 6282 case 4: 6283 { 6284 for(let e = 0; e < t.length; ++e)if (n.resolveId(t[e], e, t) === l.id) return e; 6285 return r; 6286 } 6287 case 5: 6288 return null; 6289 default: 6290 u1(l); 6291 } 6292} 6293; 6294__turbopack_context__.s([ 6295 "Focus", 6296 0, 6297 c, 6298 "calculateActiveIndex", 6299 0, 6300 f1 6301], 65659); 6302// MERGED MODULE: [project]/node_modules/@headlessui/react/dist/utils/element-movement.js [app-client] (ecmascript) 6303; 6304var __TURBOPACK__imported__module__544508__ = __turbopack_context__.i(544508); 6305; 6306const c1 = { 6307 Idle: { 6308 kind: "Idle" 6309 }, 6310 Tracked: (e)=>({ 6311 kind: "Tracked", 6312 position: e 6313 }), 6314 Moved: { 6315 kind: "Moved" 6316 } 6317}; 6318function a(e) { 6319 let t = e.getBoundingClientRect(); 6320 return "".concat(t.x, ",").concat(t.y); 6321} 6322function p(e, t, i) { 6323 let n = (0, __TURBOPACK__imported__module__544508__["disposables"])(); 6324 if (t.kind === "Tracked") { 6325 let o = function() { 6326 d !== a(e) && (n.dispose(), i()); 6327 }; 6328 var f = o; 6329 let { position: d } = t, s = new ResizeObserver(o); 6330 s.observe(e), n.add(()=>s.disconnect()), n.addEventListener(window, "scroll", o, { 6331 passive: !0 6332 }), n.addEventListener(window, "resize", o); 6333 } 6334 return ()=>n.dispose(); 6335} 6336; 6337__turbopack_context__.s([ 6338 "ElementPositionState", 6339 0, 6340 c1, 6341 "computeVisualPosition", 6342 0, 6343 a, 6344 "detectMovement", 6345 0, 6346 p 6347], 667310); 6348}), 6349249578, ((__turbopack_context__) => { 6350"use strict"; 6351 6352// MERGED MODULE: [project]/node_modules/@headlessui/react/dist/hooks/use-text-value.js [app-client] (ecmascript) 6353; 6354var __TURBOPACK__imported__module__271645__ = __turbopack_context__.i(271645); 6355// MERGED MODULE: [project]/node_modules/@headlessui/react/dist/utils/get-text-value.js [app-client] (ecmascript) 6356; 6357var __TURBOPACK__imported__module__813581__ = __turbopack_context__.i(813581); 6358; 6359let a = /([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g; 6360function o(e) { 6361 var l, n; 6362 let i = (l = e.innerText) != null ? l : "", t = e.cloneNode(!0); 6363 if (!__TURBOPACK__imported__module__813581__["isHTMLElement"](t)) return i; 6364 let u = !1; 6365 for (let f of t.querySelectorAll('[hidden],[aria-hidden],[role="img"]'))f.remove(), u = !0; 6366 let r = u ? (n = t.innerText) != null ? n : "" : i; 6367 return a.test(r) && (r = r.replace(a, "")), r; 6368} 6369function F(e) { 6370 let i = e.getAttribute("aria-label"); 6371 if (typeof i == "string") return i.trim(); 6372 let t = e.getAttribute("aria-labelledby"); 6373 if (t) { 6374 let u = t.split(" ").map((r)=>{ 6375 let l = document.getElementById(r); 6376 if (l) { 6377 let n = l.getAttribute("aria-label"); 6378 return typeof n == "string" ? n.trim() : o(l).trim(); 6379 } 6380 return null; 6381 }).filter(Boolean); 6382 if (u.length > 0) return u.join(", "); 6383 } 6384 return o(e).trim(); 6385} 6386; 6387var __TURBOPACK__imported__module__914189__ = __turbopack_context__.i(914189); 6388; 6389; 6390; 6391function s(c) { 6392 let t = (0, __TURBOPACK__imported__module__271645__["useRef"])(""), r = (0, __TURBOPACK__imported__module__271645__["useRef"])(""); 6393 return (0, __TURBOPACK__imported__module__914189__["useEvent"])(()=>{ 6394 let e = c.current; 6395 if (!e) return ""; 6396 let u = e.innerText; 6397 if (t.current === u) return r.current; 6398 let n = F(e).trim().toLowerCase(); 6399 return t.current = u, r.current = n, n; 6400 }); 6401} 6402; 6403__turbopack_context__.s([ 6404 "useTextValue", 6405 0, 6406 s 6407], 249578); 6408}), 6409989895, ((__turbopack_context__) => { 6410"use strict"; 6411 6412// MERGED MODULE: [project]/node_modules/@headlessui/react/dist/components/menu/menu.js [app-client] (ecmascript) 6413; 6414var __TURBOPACK__imported__module__429427__ = __turbopack_context__.i(429427); 6415var __TURBOPACK__imported__module__371330__ = __turbopack_context__.i(371330); 6416var __TURBOPACK__imported__module__271645__ = __turbopack_context__.i(271645); 6417var __TURBOPACK__imported__module__174080__ = __turbopack_context__.i(174080); 6418var __TURBOPACK__imported__module__394487__ = __turbopack_context__.i(394487); 6419var __TURBOPACK__imported__module__746725__ = __turbopack_context__.i(746725); 6420var __TURBOPACK__imported__module__992704__ = __turbopack_context__.i(992704); 6421var __TURBOPACK__imported__module__914189__ = __turbopack_context__.i(914189); 6422var __TURBOPACK__imported__module__488374__ = __turbopack_context__.i(488374); 6423var __TURBOPACK__imported__module__684653__ = __turbopack_context__.i(684653); 6424var __TURBOPACK__imported__module__835696__ = __turbopack_context__.i(835696); 6425var __TURBOPACK__imported__module__877891__ = __turbopack_context__.i(877891); 6426var __TURBOPACK__imported__module__952744__ = __turbopack_context__.i(952744); 6427var __TURBOPACK__imported__module__605083__ = __turbopack_context__.i(605083); 6428var __TURBOPACK__imported__module__157138__ = __turbopack_context__.i(157138); 6429var __TURBOPACK__imported__module__144279__ = __turbopack_context__.i(144279); 6430var __TURBOPACK__imported__module__101852__ = __turbopack_context__.i(101852); 6431var __TURBOPACK__imported__module__255743__ = __turbopack_context__.i(255743); 6432var __TURBOPACK__imported__module__294316__ = __turbopack_context__.i(294316); 6433var __TURBOPACK__imported__module__249578__ = __turbopack_context__.i(249578); 6434var __TURBOPACK__imported__module__571616__ = __turbopack_context__.i(571616); 6435var __TURBOPACK__imported__module__83733__ = __turbopack_context__.i(83733); 6436var __TURBOPACK__imported__module__340143__ = __turbopack_context__.i(340143); 6437var __TURBOPACK__imported__module__919751__ = __turbopack_context__.i(919751); 6438var __TURBOPACK__imported__module__233137__ = __turbopack_context__.i(233137); 6439var __TURBOPACK__imported__module__341650__ = __turbopack_context__.i(341650); 6440var __TURBOPACK__imported__module__140407__ = __turbopack_context__.i(140407); 6441var __TURBOPACK__imported__module__65659__ = __turbopack_context__.i(65659); 6442var __TURBOPACK__imported__module__544508__ = __turbopack_context__.i(544508); 6443var __TURBOPACK__imported__module__813581__ = __turbopack_context__.i(813581); 6444var __TURBOPACK__imported__module__652265__ = __turbopack_context__.i(652265); 6445var __TURBOPACK__imported__module__397701__ = __turbopack_context__.i(397701); 6446var __TURBOPACK__imported__module__402155__ = __turbopack_context__.i(402155); 6447var __TURBOPACK__imported__module__700020__ = __turbopack_context__.i(700020); 6448var __TURBOPACK__imported__module__35889__ = __turbopack_context__.i(35889); 6449var __TURBOPACK__imported__module__998348__ = __turbopack_context__.i(998348); 6450var __TURBOPACK__imported__module__722678__ = __turbopack_context__.i(722678); 6451var __TURBOPACK__imported__module__635307__ = __turbopack_context__.i(635307); 6452// MERGED MODULE: [project]/node_modules/@headlessui/react/dist/components/menu/menu-machine.js [app-client] (ecmascript) 6453; 6454var __TURBOPACK__imported__module__825720__ = __turbopack_context__.i(825720); 6455var __TURBOPACK__imported__module__341650__1 = __TURBOPACK__imported__module__341650__; 6456var __TURBOPACK__imported__module__65659__1 = __TURBOPACK__imported__module__65659__; 6457var __TURBOPACK__imported__module__667310__ = __turbopack_context__.i(667310); 6458var __TURBOPACK__imported__module__652265__1 = __TURBOPACK__imported__module__652265__; 6459var __TURBOPACK__imported__module__397701__1 = __TURBOPACK__imported__module__397701__; 6460var y = Object.defineProperty; 6461var M = (e, i, t)=>i in e ? y(e, i, { 6462 enumerable: !0, 6463 configurable: !0, 6464 writable: !0, 6465 value: t 6466 }) : e[i] = t; 6467var S = (e, i, t)=>(M(e, typeof i != "symbol" ? i + "" : i, t), t); 6468; 6469; 6470; 6471; 6472; 6473; 6474var P = ((t)=>(t[t.Open = 0] = "Open", t[t.Closed = 1] = "Closed", t))(P || {}), D = ((t)=>(t[t.Pointer = 0] = "Pointer", t[t.Other = 1] = "Other", t))(D || {}), C = ((o)=>(o[o.OpenMenu = 0] = "OpenMenu", o[o.CloseMenu = 1] = "CloseMenu", o[o.GoToItem = 2] = "GoToItem", o[o.Search = 3] = "Search", o[o.ClearSearch = 4] = "ClearSearch", o[o.RegisterItems = 5] = "RegisterItems", o[o.UnregisterItems = 6] = "UnregisterItems", o[o.SetButtonElement = 7] = "SetButtonElement", o[o.SetItemsElement = 8] = "SetItemsElement", o[o.SortItems = 9] = "SortItems", o[o.MarkButtonAsMoved = 10] = "MarkButtonAsMoved", o))(C || {}); 6475function x(e) { 6476 let i = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : (t)=>t; 6477 let t = e.activeItemIndex !== null ? e.items[e.activeItemIndex] : null, n = (0, __TURBOPACK__imported__module__652265__1["sortByDomNode"])(i(e.items.slice()), (s)=>s.dataRef.current.domRef.current), r = t ? n.indexOf(t) : null; 6478 return r === -1 && (r = null), { 6479 items: n, 6480 activeItemIndex: r 6481 }; 6482} 6483let k = { 6484 [1] (e) { 6485 if (e.menuState === 1) return e; 6486 let i = e.buttonElement ? __TURBOPACK__imported__module__667310__["ElementPositionState"].Tracked((0, __TURBOPACK__imported__module__667310__["computeVisualPosition"])(e.buttonElement)) : e.buttonPositionState; 6487 return { 6488 ...e, 6489 activeItemIndex: null, 6490 pendingFocus: { 6491 focus: __TURBOPACK__imported__module__65659__1["Focus"].Nothing 6492 }, 6493 menuState: 1, 6494 buttonPositionState: i 6495 }; 6496 }, 6497 [0] (e, i) { 6498 return e.menuState === 0 ? e : { 6499 ...e, 6500 __demoMode: !1, 6501 pendingFocus: i.focus, 6502 menuState: 0, 6503 buttonPositionState: __TURBOPACK__imported__module__667310__["ElementPositionState"].Idle 6504 }; 6505 }, 6506 [2]: (e, i)=>{ 6507 var s, l, a, I, f; 6508 if (e.menuState === 1) return e; 6509 let t = { 6510 ...e, 6511 searchQuery: "", 6512 activationTrigger: (s = i.trigger) != null ? s : 1, 6513 __demoMode: !1 6514 }; 6515 if (i.focus === __TURBOPACK__imported__module__65659__1["Focus"].Nothing) return { 6516 ...t, 6517 activeItemIndex: null 6518 }; 6519 if (i.focus === __TURBOPACK__imported__module__65659__1["Focus"].Specific) return { 6520 ...t, 6521 activeItemIndex: e.items.findIndex((d)=>d.id === i.id) 6522 }; 6523 if (i.focus === __TURBOPACK__imported__module__65659__1["Focus"].Previous) { 6524 let d = e.activeItemIndex; 6525 if (d !== null) { 6526 let o = e.items[d].dataRef.current.domRef, c = (0, __TURBOPACK__imported__module__65659__1["calculateActiveIndex"])(i, { 6527 resolveItems: ()=>e.items, 6528 resolveActiveIndex: ()=>e.activeItemIndex, 6529 resolveId: (u)=>u.id, 6530 resolveDisabled: (u)=>u.dataRef.current.disabled 6531 }); 6532 if (c !== null) { 6533 let u = e.items[c].dataRef.current.domRef; 6534 if (((l = o.current) == null ? void 0 : l.previousElementSibling) === u.current || ((a = u.current) == null ? void 0 : a.previousElementSibling) === null) return { 6535 ...t, 6536 activeItemIndex: c 6537 }; 6538 } 6539 } 6540 } else if (i.focus === __TURBOPACK__imported__module__65659__1["Focus"].Next) { 6541 let d = e.activeItemIndex; 6542 if (d !== null) { 6543 let o = e.items[d].dataRef.current.domRef, c = (0, __TURBOPACK__imported__module__65659__1["calculateActiveIndex"])(i, { 6544 resolveItems: ()=>e.items, 6545 resolveActiveIndex: ()=>e.activeItemIndex, 6546 resolveId: (u)=>u.id, 6547 resolveDisabled: (u)=>u.dataRef.current.disabled 6548 }); 6549 if (c !== null) { 6550 let u = e.items[c].dataRef.current.domRef; 6551 if (((I = o.current) == null ? void 0 : I.nextElementSibling) === u.current || ((f = u.current) == null ? void 0 : f.nextElementSibling) === null) return { 6552 ...t, 6553 activeItemIndex: c 6554 }; 6555 } 6556 } 6557 } 6558 let n = x(e), r = (0, __TURBOPACK__imported__module__65659__1["calculateActiveIndex"])(i, { 6559 resolveItems: ()=>n.items, 6560 resolveActiveIndex: ()=>n.activeItemIndex, 6561 resolveId: (d)=>d.id, 6562 resolveDisabled: (d)=>d.dataRef.current.disabled 6563 }); 6564 return { 6565 ...t, 6566 ...n, 6567 activeItemIndex: r 6568 }; 6569 }, 6570 [3]: (e, i)=>{ 6571 let n = e.searchQuery !== "" ? 0 : 1, r = e.searchQuery + i.value.toLowerCase(), l = (e.activeItemIndex !== null ? e.items.slice(e.activeItemIndex + n).concat(e.items.slice(0, e.activeItemIndex + n)) : e.items).find((I)=>{ 6572 var f; 6573 return ((f = I.dataRef.current.textValue) == null ? void 0 : f.startsWith(r)) && !I.dataRef.current.disabled; 6574 }), a = l ? e.items.indexOf(l) : -1; 6575 return a === -1 || a === e.activeItemIndex ? { 6576 ...e, 6577 searchQuery: r 6578 } : { 6579 ...e, 6580 searchQuery: r, 6581 activeItemIndex: a, 6582 activationTrigger: 1 6583 }; 6584 }, 6585 [4] (e) { 6586 return e.searchQuery === "" ? e : { 6587 ...e, 6588 searchQuery: "", 6589 searchActiveItemIndex: null 6590 }; 6591 }, 6592 [5]: (e, i)=>{ 6593 let t = e.items.concat(i.items.map((r)=>r)), n = e.activeItemIndex; 6594 return e.pendingFocus.focus !== __TURBOPACK__imported__module__65659__1["Focus"].Nothing && (n = (0, __TURBOPACK__imported__module__65659__1["calculateActiveIndex"])(e.pendingFocus, { 6595 resolveItems: ()=>t, 6596 resolveActiveIndex: ()=>e.activeItemIndex, 6597 resolveId: (r)=>r.id, 6598 resolveDisabled: (r)=>r.dataRef.current.disabled 6599 })), { 6600 ...e, 6601 items: t, 6602 activeItemIndex: n, 6603 pendingFocus: { 6604 focus: __TURBOPACK__imported__module__65659__1["Focus"].Nothing 6605 }, 6606 pendingShouldSort: !0 6607 }; 6608 }, 6609 [6]: (e, i)=>{ 6610 let t = e.items, n = [], r = new Set(i.items); 6611 for (let [s, l] of t.entries())if (r.has(l.id) && (n.push(s), r.delete(l.id), r.size === 0)) break; 6612 if (n.length > 0) { 6613 t = t.slice(); 6614 for (let s of n.reverse())t.splice(s, 1); 6615 } 6616 return { 6617 ...e, 6618 items: t, 6619 activationTrigger: 1 6620 }; 6621 }, 6622 [7]: (e, i)=>e.buttonElement === i.element ? e : { 6623 ...e, 6624 buttonElement: i.element 6625 }, 6626 [8]: (e, i)=>e.itemsElement === i.element ? e : { 6627 ...e, 6628 itemsElement: i.element 6629 }, 6630 [9]: (e)=>e.pendingShouldSort ? { 6631 ...e, 6632 ...x(e), 6633 pendingShouldSort: !1 6634 } : e, 6635 [10] (e) { 6636 return e.buttonPositionState.kind !== "Tracked" ? e : { 6637 ...e, 6638 buttonPositionState: __TURBOPACK__imported__module__667310__["ElementPositionState"].Moved 6639 }; 6640 } 6641}; 6642class h extends __TURBOPACK__imported__module__825720__["Machine"] { 6643 static new(param) { 6644 let { id: t, __demoMode: n = !1 } = param; 6645 return new h({ 6646 id: t, 6647 __demoMode: n, 6648 menuState: n ? 0 : 1, 6649 buttonElement: null, 6650 itemsElement: null, 6651 items: [], 6652 searchQuery: "", 6653 activeItemIndex: null, 6654 activationTrigger: 1, 6655 pendingShouldSort: !1, 6656 pendingFocus: { 6657 focus: __TURBOPACK__imported__module__65659__1["Focus"].Nothing 6658 }, 6659 buttonPositionState: __TURBOPACK__imported__module__667310__["ElementPositionState"].Idle 6660 }); 6661 } 6662 reduce(t, n) { 6663 return (0, __TURBOPACK__imported__module__397701__1["match"])(n.type, k, t, n); 6664 } 6665 constructor(t){ 6666 super(t); 6667 S(this
6667, "actions", { 6668 registerItem: (0, __TURBOPACK__imported__module__825720__["batch"])(()=>{ 6669 let t = [], n = new Set; 6670 return [ 6671 (r, s)=>{ 6672 n.has(s) || (n.add(s), t.push({ 6673 id: r, 6674 dataRef: s 6675 })); 6676 }, 6677 ()=>(n.clear(), this.send({ 6678 type: 5, 6679 items: t.splice(0) 6680 })) 6681 ]; 6682 }), 6683 unregisterItem: (0, __TURBOPACK__imported__module__825720__["batch"])(()=>{ 6684 let t = []; 6685 return [ 6686 (n)=>t.push(n), 6687 ()=>this.send({ 6688 type: 6, 6689 items: t.splice(0) 6690 }) 6691 ]; 6692 }) 6693 }); 6694 S(this, "selectors", { 6695 activeDescendantId (t) { 6696 var s; 6697 let n = t.activeItemIndex, r = t.items; 6698 return n === null || (s = r[n]) == null ? void 0 : s.id; 6699 }, 6700 isActive (t, n) { 6701 var l; 6702 let r = t.activeItemIndex, s = t.items; 6703 return r !== null ? ((l = s[r]) == null ? void 0 : l.id) === n : !1; 6704 }, 6705 shouldScrollIntoView (t, n) { 6706 return t.__demoMode || t.menuState !== 0 || t.activationTrigger === 0 ? !1 : this.isActive(t, n); 6707 }, 6708 didButtonMove (t) { 6709 return t.buttonPositionState.kind === "Moved"; 6710 } 6711 }); 6712 this.on(5, ()=>{ 6713 this.disposables.requestAnimationFrame(()=>{ 6714 this.send({ 6715 type: 9 6716 }); 6717 }); 6718 }); 6719 { 6720 let n = this.state.id, r = __TURBOPACK__imported__module__341650__1["stackMachines"].get(null); 6721 this.disposables.add(r.on(__TURBOPACK__imported__module__341650__1["ActionTypes"].Push, (s)=>{ 6722 !r.selectors.isTop(s, n) && this.state.menuState === 0 && this.send({ 6723 type: 1 6724 }); 6725 })), this.on(0, ()=>r.actions.push(n)), this.on(1, ()=>r.actions.pop(n)); 6726 } 6727 this.disposables.group((n)=>{ 6728 this.on(1, (r)=>{ 6729 r.buttonElement && (n.dispose(), n.add((0, __TURBOPACK__imported__module__667310__["detectMovement"])(r.buttonElement, r.buttonPositionState, ()=>{ 6730 this.send({ 6731 type: 10 6732 }); 6733 }))); 6734 }); 6735 }); 6736 } 6737} 6738; 6739// MERGED MODULE: [project]/node_modules/@headlessui/react/dist/components/menu/menu-machine-glue.js [app-client] (ecmascript) 6740; 6741var __TURBOPACK__imported__module__271645__1 = __TURBOPACK__imported__module__271645__; 6742var __TURBOPACK__imported__module__526599__ = __turbopack_context__.i(526599); 6743; 6744; 6745; 6746const a = /*#__PURE__*/ (0, __TURBOPACK__imported__module__271645__1["createContext"])(null); 6747function p(t) { 6748 let n = (0, __TURBOPACK__imported__module__271645__1["useContext"])(a); 6749 if (n === null) { 6750 let e = new Error("<".concat(t, " /> is missing a parent <Menu /> component.")); 6751 throw Error.captureStackTrace && Error.captureStackTrace(e, s), e; 6752 } 6753 return n; 6754} 6755function s(param) { 6756 let { id: t, __demoMode: n = !1 } = param; 6757 let e = (0, __TURBOPACK__imported__module__271645__1["useMemo"])(()=>h.new({ 6758 id: t, 6759 __demoMode: n 6760 }), []); 6761 return (0, __TURBOPACK__imported__module__526599__["useOnUnmount"])(()=>
6761e.dispose()), e; 6762} 6763; 6764"use client"; 6765; 6766; 6767; 6768; 6769; 6770; 6771; 6772; 6773; 6774; 6775; 6776; 6777; 6778; 6779; 6780; 6781; 6782; 6783; 6784; 6785; 6786; 6787; 6788; 6789; 6790; 6791; 6792; 6793; 6794; 6795; 6796; 6797; 6798; 6799; 6800; 6801; 6802; 6803; 6804; 6805; 6806let Ze = __TURBOPACK__imported__module__271645__["Fragment"]; 6807function et(m, y) { 6808 let l = (0, __TURBOPACK__imported__module__271645__["useId"])(), { __demoMode: a1 = !1, ...p } = m, s1 = s({ 6809 id: l, 6810 __demoMode: a1 6811 }), [n, M, f] = (0, __TURBOPACK__imported__module__140407__["useSlice"])(s1, (d)=>[ 6812 d.menuState, 6813 d.itemsElement, 6814 d.buttonElement 6815 ]), _ = (0, __TURBOPACK__imported__module__294316__["useSyncRefs"])(y), o = __TURBOPACK__imported__module__341650__["stackMachines"].get(null), F = (0, __TURBOPACK__imported__module__140407__["useSlice"])(o, (0, __TURBOPACK__imported__module__271645__["useCallback"])((d)=>o.selectors.isTop(d, l), [ 6816 o, 6817 l 6818 ])); 6819 (0, __TURBOPACK__imported__module__952744__["useOutsideClick"])(F, [ 6820 f, 6821 M 6822 ], (d, T)=>{ 6823 var P; 6824 s1.send({ 6825 type: C.CloseMenu 6826 }), (0, __TURBOPACK__imported__module__652265__["isFocusableElement"])(T, __TURBOPACK__imported__module__652265__["FocusableMode"].Loose) || (d.preventDefault(), (P = s1.state.buttonElement) == null || P.focus()); 6827 }); 6828 let I = (0, __TURBOPACK__imported__module__914189__["useEvent"])(()=>{ 6829 s1.send({ 6830 type: C.CloseMenu 6831 }); 6832 }), b = (0, __TURBOPACK__imported__module__255743__["useSlot"])({ 6833 open: n === P.Open, 6834 close: I 6835 }), i = { 6836 ref: _ 6837 }, g = (0, __TURBOPACK__imported__module__700020__["useRender"])(); 6838 return /*#__PURE__*/ __TURBOPACK__imported__module__271645__["default"].createElement(__TURBOPACK__imported__module__919751__["FloatingProvider"], null, /*#__PURE__*/ __TURBOPACK__imported__module__271645__["default"].createElement(a.Provider, { 6839 value: s1 6840 }, /*#__PURE__*/ __TURBOPACK__imported__module__271645__["default"].createElement(__TURBOPACK__imported__module__233137__["OpenClosedProvider"], { 6841 value: (0, __TURBOPACK__imported__module__397701__["match"])(n, { 6842 [P.Open]: __TURBOPACK__imported__module__233137__["State"].Open, 6843 [P.Closed]: __TURBOPACK__imported__module__233137__["State"].Closed 6844 }) 6845 }, g({ 6846 ourProps: i, 6847 theirProps: p, 6848 slot: b, 6849 defaultTag: Ze, 6850 name: "Menu" 6851 })))); 6852} 6853let tt = "button"; 6854function ot(m, y) { 6855 let l = p("Menu.Button"), a = (0, __TURBOPACK__imported__module__271645__["useId"])(), { id: p1 = "headlessui-menu-button-".concat(a), disabled: s = !1, autoFocus: n = !1, ...M } = m, f = (0, __TURBOPACK__imported__module__271645__["useRef"])(null), _ = (0, __TURBOPACK__imported__module__919751__["useFloatingReferenceProps"])(), o = (0, __TURBOPACK__imported__module__294316__["useSyncRefs"])(y, f, (0, __TURBOPACK__imported__module__919751__["useFloatingReference"])(), (0, __TURBOPACK__imported__module__914189__["useEvent"])((t)=>l.send({ 6856 type: C.SetButtonElement, 6857 element: t 6858 }))), F = (0, __TURBOPACK__imported__module__914189__["useEvent"])((t)=>{ 6859 switch(t.key){ 6860 case __TURBOPACK__imported__module__998348__["Keys"].Space: 6861 case __TURBOPACK__imported__module__998348__["Keys"].Enter: 6862 case __TURBOPACK__imported__module__998348__["Keys"].ArrowDown: 6863 t.preventDefault(), t.stopPropagation(), l.send({ 6864 type: C.OpenMenu, 6865 focus: { 6866 focus: __TURBOPACK__imported__module__65659__["Focus"].First 6867 } 6868 }); 6869 break; 6870 case __TURBOPACK__imported__module__998348__["Keys"].ArrowUp: 6871 t.preventDefault(), t.stopPropagation(), l.send({ 6872 type: C.OpenMenu, 6873 focus: { 6874 focus: __TURBOPACK__imported__module__65659__["Focus"].Last 6875 } 6876 }); 6877 break; 6878 } 6879 }), I = (0, __TURBOPACK__imported__module__914189__["useEvent"])((t)=>{ 6880 switch(t.key){ 6881 case __TURBOPACK__imported__module__998348__["Keys"].Space: 6882 t.preventDefault(); 6883 break; 6884 } 6885 }), [b, i, g] = (0, __TURBOPACK__imported__module__140407__["useSlice"])(l, (t)=>[ 6886 t.menuState, 6887 t.buttonElement, 6888 t.itemsElement 6889 ]), d = b === P.Open; 6890 (0, __TURBOPACK__imported__module__157138__["useQuickRelease"])(d, { 6891 trigger: i, 6892 action: (0, __TURBOPACK__imported__module__271645__["useCallback"])((t)=>{ 6893 if (i != null && i.contains(t.target)) return __TURBOPACK__imported__module__157138__["Action"].Ignore; 6894 let S = t.target.closest('[role="menuitem"]:not([data-disabled])'); 6895 return __TURBOPACK__imported__module__813581__["isHTMLElement"](S) ? __TURBOPACK__imported__module__157138__["Action"].Select(S) : g != null && g.contains(t.target) ? __TURBOPACK__imported__module__157138__["Action"].Ignore : __TURBOPACK__imported__module__157138__["Action"].Close; 6896 }, [ 6897 i, 6898 g 6899 ]), 6900 close: (0, __TURBOPACK__imported__module__271645__["useCallback"])(()=>l.send({
6901 type: C.CloseMenu 6902 }), []), 6903 select: (0, __TURBOPACK__imported__module__271645__["useCallback"])((t)=>t.click(), []) 6904 }); 6905 let T = (0, __TURBOPACK__imported__module__488374__["useHandleToggle"])((t)=>{ 6906 var S; 6907 s || (b === P.Open ? ((0, __TURBOPACK__imported__module__174080__["flushSync"])(()=>l.send({ 6908 type: C.CloseMenu 6909 })), (S = f.current) == null || S.focus({ 6910 preventScroll: !0 6911 })) : (t.preventDefault(), l.send({ 6912 type: C.OpenMenu, 6913 focus: { 6914 focus: __TURBOPACK__imported__module__65659__["Focus"].Nothing 6915 }, 6916 trigger: D.Pointer 6917 }))); 6918 }), { isFocusVisible: P1, focusProps: L } = (0, __TURBOPACK__imported__module__429427__["useFocusRing"])({ 6919 autoFocus: n 6920 }), { isHovered: O, hoverProps: v } = (0, __TURBOPACK__imported__module__371330__["useHover"])({ 6921 isDisabled: s 6922 }), { pressed: D1, pressProps: U } = (0, __TURBOPACK__imported__module__394487__["useActivePress"])({ 6923 disabled: s 6924 }), H = (0, __TURBOPACK__imported__module__255743__["useSlot"])({ 6925 open: b === P.Open, 6926 active: D1 || b === P.Open, 6927 disabled: s, 6928 hover: O, 6929 focus: P1, 6930 autofocus: n 6931 }), G = (0, __TURBOPACK__imported__module__700020__["mergeProps"])(_(), { 6932 ref: o, 6933 id: p1, 6934 type: (0, __TURBOPACK__imported__module__144279__["useResolveButtonType"])(m, f.current), 6935 "aria-haspopup": "menu", 6936 "aria-controls": g == null ? void 0 : g.id, 6937 "aria-expanded": b === P.Open, 6938 disabled: s || void 0, 6939 autoFocus: n, 6940 onKeyDown: F, 6941 onKeyUp: I 6942 }, T, L, v, U); 6943 return (0, __TURBOPACK__imported__module__700020__["useRender"])()({ 6944 ourProps: G, 6945 theirProps: M, 6946 slot: H, 6947 defaultTag: tt, 6948 name: "Menu.Button" 6949 }); 6950} 6951let nt = "div", rt = __TURBOPACK__imported__module__700020__["RenderFeatures"].RenderStrategy | __TURBOPACK__imported__module__700020__["RenderFeatures"].Static; 6952function at(m, y) { 6953 let l = (0, __TURBOPACK__imported__module__271645__["useId"])(), { id: a = "headlessui-menu-items-".concat(l), anchor: p1, portal: s = !1, modal: n = !0, transition: M = !1, ...f } = m, _ = (0, __TURBOPACK__imported__module__919751__["useResolvedAnchor"])(p1), o = p("Menu.Items"), [F, I] = (0, __TURBOPACK__imported__module__919751__["useFloatingPanel"])(_), b = (0, __TURBOPACK__imported__module__919751__["useFloatingPanelProps"])(), [i, g] = (0, __TURBOPACK__imported__module__271645__["useState"])(null), d = (0, __TURBOPACK__imported__module__294316__["useSyncRefs"])(y, _ ? F : null, (0, __TURBOPACK__imported__module__914189__["useEvent"])((e)=>o.send({ 6954 type: C.SetItemsElement, 6955 element: e 6956 })), g), [T, P1] = (0, __TURBOPACK__imported__module__140407__["useSlice"])(o, (e)=>[ 6957 e.menuState, 6958 e.buttonElement 6959 ]), L = (0, __TURBOPACK__imported__module__605083__["useOwnerDocument"])(P1), O = (0, __TURBOPACK__imported__module__605083__["useOwnerDocument"])(i); 6960 _ && (s = !0); 6961 let v = (0, __TURBOPACK__imported__module__233137__["useOpenClosed"])(), [D, U] = (0, __TURBOPACK__imported__module__83733__["useTransition"])(M, i, v !== null ? (v & __TURBOPACK__imported__module__233137__["State"].Open) === __TURBOPACK__imported__module__233137__["State"].Open : T === P.Open); 6962 (0, __TURBOPACK__imported__module__877891__["useOnDisappear"])(D, P1, ()=>{ 6963 o.send({ 6964 type: C.CloseMenu 6965 }); 6966 }); 6967 let H = (0, __TURBOPACK__imported__module__140407__["useSlice"])(o, (e)=>e.__demoMode), G = H ? !1 : n && T === P.Open; 6968 (0, __TURBOPACK__imported__module__101852__["useScrollLock"])(G, O); 6969 let w = H ? !1 : n && T === P.Open; 6970 (0, __TURBOPACK__imported__module__684653__["useInertOthers"])(w, { 6971 allowed: (0, __TURBOPACK__imported__module__271645__["useCallback"])(()=>[ 6972 P1, 6973 i 6974 ], [ 6975 P1, 6976 i 6977 ]) 6978 }); 6979 let S = (0, __TURBOPACK__imported__module__140407__["useSlice"])(o, o.selectors.didButtonMove) ? !1 : D; 6980 (0, __TURBOPACK__imported__module__271645__["useEffect"])(()=>{ 6981 let e = i; 6982 e && T === P.Open && ((0, __TURBOPACK__imported__module__402155__["isActiveElement"])(e) || e.focus({ 6983 preventScroll: !0 6984 })); 6985 }, [ 6986 T, 6987 i 6988 ]), (0, __TURBOPACK__imported__module__340143__["useTreeWalker"])(T === P.Open, { 6989 container: i, 6990 accept (e) { 6991 return e.getAttribute("role") === "menuitem" ? NodeFilter.FILTER_REJECT : e.hasAttribute("role") ? NodeFilter.FILTER_SKIP : NodeFilter.FILTER_ACCEPT; 6992 }, 6993 walk (e) { 6994 e.setAttribute("role", "none"); 6995 } 6996 }); 6997 let z = (0, __TURBOPACK__imported__module__746725__["useDisposables"])(), le = (0, __TURBOPACK__imported__module__914189__["useEvent"])((e)=>{ 6998 var N, Y, Z; 6999 switch(z.dispose(), e.key){ 7000 case __TURBOPACK__imported__module__998348__["Keys"].Space: 7001 if (o.state.searchQuery !== "") return e.preventDefault(), e.stopPropagation(), o.send({ 7002 type: C.Search, 7003 value: e.key 7004 }); 7005 case __TURBOPACK__imported__module__998348__["Keys"].Enter: 7006 if (e.preventDefault(), e.stopPropagation(), o.state.activeItemIndex !== null) { 7007 let { dataRef: de } = o.state.items[o.state.activeItemIndex]; 7008 (Y = (N = de.current) == null ? void 0 : N.domRef.current) == null || Y.click(); 7009 } 7010 o.send({
7011 type: C.CloseMenu 7012 }), (0, __TURBOPACK__imported__module__652265__["restoreFocusIfNecessary"])(o.state.buttonElement); 7013 break; 7014 case __TURBOPACK__imported__module__998348__["Keys"].ArrowDown: 7015 return e.preventDefault(), e.stopPropagation(), o.send({ 7016 type: C.GoToItem, 7017 focus: __TURBOPACK__imported__module__65659__["Focus"].Next 7018 }); 7019 case __TURBOPACK__imported__module__998348__["Keys"].ArrowUp: 7020 return e.preventDefault(), e.stopPropagation(), o.send({ 7021 type: C.GoToItem, 7022 focus: __TURBOPACK__imported__module__65659__["Focus"].Previous 7023 }); 7024 case __TURBOPACK__imported__module__998348__["Keys"].Home: 7025 case __TURBOPACK__imported__module__998348__["Keys"].PageUp: 7026 return e.preventDefault(), e.stopPropagation(), o.send({ 7027 type: C.GoToItem, 7028 focus: __TURBOPACK__imported__module__65659__["Focus"].First 7029 }); 7030 case __TURBOPACK__imported__module__998348__["Keys"].End: 7031 case __TURBOPACK__imported__module__998348__["Keys"].PageDown: 7032 return e.preventDefault(), e.stopPropagation(), o.send({ 7033 type: C.GoToItem, 7034 focus: __TURBOPACK__imported__module__65659__["Focus"].Last 7035 }); 7036 case __TURBOPACK__imported__module__998348__["Keys"].Escape: 7037 e.preventDefault(), e.stopPropagation(), (0, __TURBOPACK__imported__module__174080__["flushSync"])(()=>o.send({ 7038 type: C.CloseMenu 7039 })), (Z = o.state.buttonElement) == null || Z.focus({ 7040 preventScroll: !0 7041 }); 7042 break; 7043 case __TURBOPACK__imported__module__998348__["Keys"].Tab: 7044 e.preventDefault(), e.stopPropagation(), (0, __TURBOPACK__imported__module__174080__["flushSync"])(()=>o.send({ 7045 type: C.CloseMenu 7046 })), (0, __TURBOPACK__imported__module__652265__["focusFrom"])(o.state.buttonElement, e.shiftKey ? __TURBOPACK__imported__module__652265__["Focus"].Previous : __TURBOPACK__imported__module__652265__["Focus"].Next); 7047 break; 7048 default: 7049 e.key.length === 1 && (o.send({ 7050 type: C.Search, 7051 value: e.key 7052 }), z.setTimeout(()=>o.send({ 7053 type: C.ClearSearch 7054 }), 350)); 7055 break; 7056 } 7057 }), pe = (0, __TURBOPACK__imported__module__914189__["useEvent"])((e)=>{ 7058 switch(e.key){ 7059 case __TURBOPACK__imported__module__998348__["Keys"].Space: 7060 e.preventDefault(); 7061 break; 7062 } 7063 }), ie = (0, __TURBOPACK__imported__module__255743__["useSlot"])({ 7064 open: T === P.Open 7065 }), ue = (0, __TURBOPACK__imported__module__700020__["mergeProps"])(_ ? b() : {}, { 7066 "aria-activedescendant": (0, __TURBOPACK__imported__module__140407__["useSlice"])(o, o.selectors.activeDescendantId), 7067 "aria-labelledby": (0, __TURBOPACK__imported__module__140407__["useSlice"])(o, (e)=>{ 7068 var N; 7069 return (N = e.buttonElement) == null ? void 0 : N.id; 7070 }), 7071 id: a, 7072 onKeyDown: le, 7073 onKeyUp: pe, 7074 role: "menu", 7075 tabIndex: T === P.Open ? 0 : void 0, 7076 ref: d, 7077 style: { 7078 ...f.style, 7079 ...I, 7080 "--button-width": (0, __TURBOPACK__imported__module__992704__["useElementSize"])(D, P1, !0).width 7081 }, 7082 ...(0, __TURBOPACK__imported__module__83733__["transitionDataAttributes"])(U) 7083 }), me = (0, __TURBOPACK__imported__module__700020__["useRender"])(); 7084 return /*#__PURE__*/ __TURBOPACK__imported__module__271645__["default"].createElement(__TURBOPACK__imported__module__635307__["Portal"], { 7085 enabled: s ? m.static || D : !1, 7086 ownerDocument: L 7087 }, me({ 7088 ourProps: ue, 7089 theirProps: f, 7090 slot: ie, 7091 defaultTag: nt, 7092 features: rt, 7093 visible: S, 7094 name: "Menu.Items" 7095 })); 7096} 7097let st = __TURBOPACK__imported__module__271645__["Fragment"]; 7098function lt(m, y) { 7099 let l = (0, __TURBOPACK__imported__module__271645__["useId"])(), { id: a = "headlessui-menu-item-".concat(l), disabled: p1 = !1, ...s } = m, n = p("Menu.Item"), M = (0, __TURBOPACK__imported__module__140407__["useSlice"])(n, (t)=>n.selectors.isActive(t, a)), f = (0, __TURBOPACK__imported__module__271645__["useRef"])(null), _ = (0, __TURBOPACK__imported__module__294316__["useSyncRefs"])(y, f), o = (0, __TURBOPACK__imported__module__140407__["useSlice"])(n, (t)=>n.selectors.shouldScrollIntoView(t, a)); 7100 (0, __TURBOPACK__imported__module__835696__["useIsoMorphicEffect"])(()=>{ 7101 if (o) return (0, __TURBOPACK__imported__module__544508__["disposables"])().requestAnimationFrame(()=>{ 7102 var t, S; 7103 (S = (t = f.current) == null ? void 0 : t.scrollIntoView) == null || S.call(t, { 7104 block: "nearest" 7105 }); 7106 }); 7107 }, [ 7108 o, 7109 f 7110 ]); 7111 let F = (0, __TURBOPACK__imported__module__249578__["useTextValue"])(f), I = (0, __TURBOPACK__imported__module__271645__["useRef"])({ 7112 disabled: p1, 7113 domRef: f, 7114 get textValue () { 7115 return F(); 7116 } 7117 }); 7118 (0, __TURBOPACK__imported__module__835696__["useIsoMorphicEffect"])(()=>{ 7119 I.current.disabled = p1; 7120 }, [ 7121 I, 7122 p1 7123 ]), (0, __TURBOPACK__imported__module__835696__["useIsoMorphicEffect"])(()=>(n.actions.registerItem(a, I), ()=>n.actions.unregisterItem(a)), [ 7124 I, 7125 a 7126 ]); 7127 let b = (0, __TURBOPACK__imported__module__914189__["useEvent"])(()=>{ 7128 n.send({
7129 type: C.CloseMenu 7130 }); 7131 }), i = (0, __TURBOPACK__imported__module__914189__["useEvent"])((t)=>{ 7132 if (p1) return t.preventDefault(); 7133 n.send({ 7134 type: C.CloseMenu 7135 }), (0, __TURBOPACK__imported__module__652265__["restoreFocusIfNecessary"])(n.state.buttonElement); 7136 }), g = (0, __TURBOPACK__imported__module__914189__["useEvent"])(()=>{ 7137 if (p1) return n.send({ 7138 type: C.GoToItem, 7139 focus: __TURBOPACK__imported__module__65659__["Focus"].Nothing 7140 }); 7141 n.send({ 7142 type: C.GoToItem, 7143 focus: __TURBOPACK__imported__module__65659__["Focus"].Specific, 7144 id: a 7145 }); 7146 }), d = (0, __TURBOPACK__imported__module__571616__["useTrackedPointer"])(), T = (0, __TURBOPACK__imported__module__914189__["useEvent"])((t)=>d.update(t)), P = (0, __TURBOPACK__imported__module__914189__["useEvent"])((t)=>{ 7147 d.wasMoved(t) && (p1 || M || n.send({ 7148 type: C.GoToItem, 7149 focus: __TURBOPACK__imported__module__65659__["Focus"].Specific, 7150 id: a, 7151 trigger: D.Pointer 7152 })); 7153 }), L = (0, __TURBOPACK__imported__module__914189__["useEvent"])((t)=>{ 7154 d.wasMoved(t) && (p1 || M && n.state.activationTrigger === D.Pointer && n.send({ 7155 type: C.GoToItem, 7156 focus: __TURBOPACK__imported__module__65659__["Focus"].Nothing 7157 })); 7158 }), [O, v] = (0, __TURBOPACK__imported__module__722678__["useLabels"])(), [D1, U] = (0, __TURBOPACK__imported__module__35889__["useDescriptions"])(), H = (0, __TURBOPACK__imported__module__255743__["useSlot"])({ 7159 active: M, 7160 focus: M, 7161 disabled: p1, 7162 close: b 7163 }), G = { 7164 id: a, 7165 ref: _, 7166 role: "menuitem", 7167 tabIndex: p1 === !0 ? void 0 : -1, 7168 "aria-disabled": p1 === !0 ? !0 : void 0, 7169 "aria-labelledby": O, 7170 "aria-describedby": D1, 7171 disabled: void 0, 7172 onClick: i, 7173 onFocus: g, 7174 onPointerEnter: T, 7175 onMouseEnter: T, 7176 onPointerMove: P, 7177 onMouseMove: P, 7178 onPointerLeave: L, 7179 onMouseLeave: L 7180 }, w = (0, __TURBOPACK__imported__module__700020__["useRender"])(); 7181 return /*#__PURE__*/ __TURBOPACK__imported__module__271645__["default"].createElement(v, null, /*#__PURE__*/ __TURBOPACK__imported__module__271645__["default"].createElement(U, null, w({ 7182 ourProps: G, 7183 theirProps: s, 7184 slot: H, 7185 defaultTag: st, 7186 name: "Menu.Item" 7187 }))); 7188} 7189let pt = "div"; 7190function it(m, y) { 7191 let [l, a] = (0, __TURBOPACK__imported__module__722678__["useLabels"])(), p = m, s = { 7192 ref: y, 7193 "aria-labelledby": l, 7194 role: "group" 7195 }, n = (0, __TURBOPACK__imported__module__700020__["useRender"])(); 7196 return /*#__PURE__*/ __TURBOPACK__imported__module__271645__["default"].createElement(a, null, n({ 7197 ourProps: s, 7198 theirProps: p, 7199 slot: {}, 7200 defaultTag: pt, 7201 name: "Menu.Section" 7202 })); 7203} 7204let ut = "header"; 7205function mt(m, y) { 7206 let l = (0, __TURBOPACK__imported__module__271645__["useId"])(), { id: a = "headlessui-menu-heading-".concat(l), ...p } = m, s = (0, __TURBOPACK__imported__module__722678__["useLabelContext"])(); 7207 (0, __TURBOPACK__imported__module__835696__["useIsoMorphicEffect"])(()=>s.register(a), [ 7208 a, 7209 s.register 7210 ]); 7211 let n = { 7212 id: a, 7213 ref: y, 7214 role: "presentation", 7215 ...s.props 7216 }; 7217 return (0, __TURBOPACK__imported__module__700020__["useRender"])()({ 7218 ourProps: n, 7219 theirProps: p, 7220 slot: {}, 7221 defaultTag: ut, 7222 name: "Menu.Heading" 7223 }); 7224} 7225let dt = "div"; 7226function Tt(m, y) { 7227 let l = m, a = { 7228 ref: y, 7229 role: "separator" 7230 }; 7231 return (0, __TURBOPACK__imported__module__700020__["useRender"])()({ 7232 ourProps: a, 7233 theirProps: l, 7234 slot: {}, 7235 defaultTag: dt, 7236 name: "Menu.Separator" 7237 }); 7238} 7239let ct = (0, __TURBOPACK__imported__module__700020__["forwardRefWithAs"])(et), ft = (0, __TURBOPACK__imported__module__700020__["forwardRefWithAs"])(ot), yt = (0, __TURBOPACK__imported__module__700020__["forwardRefWithAs"])(at), gt = (0, __TURBOPACK__imported__module__700020__["forwardRefWithAs"])(lt), Pt = (0, __TURBOPACK__imported__module__700020__["forwardRefWithAs"])(it), Et = (0, __TURBOPACK__imported__module__700020__["forwardRefWithAs"])(mt), Mt = (0, __TURBOPACK__imported__module__700020__["forwardRefWithAs"])(Tt), lo = Object.assign(ct, { 7240 Button: ft, 7241 Items: yt, 7242 Item: gt, 7243 Section: Pt, 7244 Heading: Et, 7245 Separator: Mt 7246}); 7247; 7248__turbopack_context__.s([ 7249 "Menu", 7250 0, 7251 lo, 7252 "MenuButton", 7253 0, 7254 ft, 7255 "MenuHeading", 7256 0, 7257 Et, 7258 "MenuItem", 7259 0, 7260 gt, 7261 "MenuItems", 7262 0, 7263 yt, 7264 "MenuSection", 7265 0, 7266 Pt, 7267 "MenuSeparator", 7268 0, 7269 Mt 7270], 989895); 7271}), 7272817450, ((__turbopack_context__) => { 7273"use strict"; 7274 7275// Generated by @compas/code-gen 7276var __TURBOPACK__imported__module__954616__ = __turbopack_context__.i(954616); 7277var __TURBOPACK__imported__module__912598__ = __turbopack_context__.i(912598); 7278var __TURBOPACK__imported__module__197643__ = __turbopack_context__.i(197643); 7279var __TURBOPACK__imported__module__710191__ = __turbopack_context__.i(710191); 7280; 7281; 7282;
7283function useSupportContact() { 7284 let options = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}; 7285 const axiosInstance = (0, __TURBOPACK__imported__module__197643__["useApi"])(); 7286 const queryClient = (0, __TURBOPACK__imported__module__912598__["useQueryClient"])(); 7287 return (0, __TURBOPACK__imported__module__954616__["useMutation"])({ 7288 mutationFn: (variables)=>(0, __TURBOPACK__imported__module__710191__["apiSupportContact"])(axiosInstance, { 7289 name: variables["name"], 7290 phone: variables["phone"], 7291 email: variables["email"], 7292 department: variables["department"], 7293 question: variables["question"] 7294 }, variables === null || variables === void 0 ? void 0 : variables.requestConfig), 7295 ...options 7296 }); 7297} 7298function useSupportSubscribeNewsletter() { 7299 let options = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}; 7300 const axiosInstance = (0, __TURBOPACK__imported__module__197643__["useApi"])(); 7301 const queryClient = (0, __TURBOPACK__imported__module__912598__["useQueryClient"])(); 7302 return (0, __TURBOPACK__imported__module__954616__["useMutation"])({ 7303 mutationFn: (variables)=>(0, __TURBOPACK__imported__module__710191__["apiSupportSubscribeNewsletter"])(axiosInstance, { 7304 email: variables["email"] 7305 }, variables === null || variables === void 0 ? void 0 : variables.requestConfig), 7306 ...options 7307 }); 7308} 7309__turbopack_context__.s([ 7310 "useSupportContact", 7311 0, 7312 useSupportContact, 7313 "useSupportSubscribeNewsletter", 7314 0, 7315 useSupportSubscribeNewsletter 7316]); 7317}), 7318]); 7319 7320//# debugId=a12939b3-c11a-4460-821f-3385a6ee07ab
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.