1(function() { 2 try { 3 var e = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof globalThis ? globalThis : "undefined" != typeof self ? self : {}; 4 e.SENTRY_RELEASE = { id: "9bd7631" }; 5 var n = new e.Error().stack; 6 n && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[n] = "6671137b-c341-4b2d-9f9d-200e79c78740", e._sentryDebugIdIdentifier = "sentry-dbid-6671137b-c341-4b2d-9f9d-200e79c78740"); 7 } catch (e) {} 8})(); 9import { a as __toESM, n as __esmMin } from "./rolldown-runtime-C0oiEAqH.js"; 10import { t as require_jsx_runtime } from "./jsx-runtime-BypSXy5Z.js"; 11import { t as require_react } from "./react-CRpDT2aV.js"; 12import { a as init_dist$4, o as init_dist$5, r as createSlot, s as useComposedRefs } from "./dist-D8oTWj2d.js"; 13import { a as init_dist$9, c as useLayoutEffect2, d as composeEventHandlers, f as init_dist$8, i as useControllableState, l as createContextScope, o as useId, r as init_dist$7, s as init_dist$10, u as init_dist$6 } from "./dist-Dhx3nznu.js"; 14import { r as init_dist$11, t as Primitive } from "./dist-CJFVwizW.js"; 15import { h as useCallbackRef, m as init_dist$12 } from "./dist-CQuIF0xP.js"; 16//#region node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected]__@types+r_ed97e98f526881a1c9b799d335ea2adc/node_modules/@radix-ui/react-collection/dist/index.mjs 17// @__NO_SIDE_EFFECTS__ 18function createCollection(name) { 19 const PROVIDER_NAME = name + "CollectionProvider"; 20 const [createCollectionContext, createCollectionScope] = createContextScope(PROVIDER_NAME); 21 const [CollectionProviderImpl, useCollectionContext] = createCollectionContext(PROVIDER_NAME, { 22 collectionRef: { current: null }, 23 itemMap: /* @__PURE__ */ new Map() 24 }); 25 const CollectionProvider = /* @__PURE__ */ __name$3((props) => { 26 const { scope, children } = props; 27 const ref = import_react$4.useRef(null); 28 const itemMap = import_react$4.useRef(/* @__PURE__ */ new Map()).current; 29 return /* @__PURE__ */ (0, import_jsx_runtime$2.jsx)(CollectionProviderImpl, { 30 scope, 31 itemMap, 32 collectionRef: ref, 33 children 34 }); 35 }, "CollectionProvider"); 36 CollectionProvider.displayName = PROVIDER_NAME; 37 const COLLECTION_SLOT_NAME = name + "CollectionSlot"; 38 const CollectionSlotImpl = createSlot(COLLECTION_SLOT_NAME); 39 const CollectionSlot = import_react$4.forwardRef((props, forwardedRef) => { 40 const { scope, children } = props; 41 const context = useCollectionContext(COLLECTION_SLOT_NAME, scope); 42 const composedRefs = useComposedRefs(forwardedRef, context.collectionRef); 43 return /* @__PURE__ */ (0, import_jsx_runtime$2.jsx)(CollectionSlotImpl, { 44 ref: composedRefs, 45 children 46 }); 47 }); 48 CollectionSlot.displayName = COLLECTION_SLOT_NAME; 49 const ITEM_SLOT_NAME = name + "CollectionItemSlot"; 50 const ITEM_DATA_ATTR = "data-radix-collection-item"; 51 const CollectionItemSlotImpl = createSlot(ITEM_SLOT_NAME); 52 const CollectionItemSlot = import_react$4.forwardRef((props, forwardedRef) => { 53 const { scope, children, ...itemData } = props; 54 const ref = import_react$4.useRef(null); 55 const composedRefs = useComposedRefs(forwardedRef, ref); 56 const context = useCollectionContext(ITEM_SLOT_NAME, scope); 57 import_react$4.useEffect(() => { 58 context.itemMap.set(ref, { 59 ref, 60 ...itemData 61 }); 62 return () =>
62 void context.itemMap.delete(ref); 63 }); 64 return /* @__PURE__ */ (0, import_jsx_runtime$2.jsx)(CollectionItemSlotImpl, { 65 [ITEM_DATA_ATTR]: "", 66 ref: composedRefs, 67 children 68 }); 69 }); 70 CollectionItemSlot.displayName = ITEM_SLOT_NAME; 71 function useCollection(scope) { 72 const context = useCollectionContext(name + "CollectionConsumer", scope); 73 return import_react$4.useCallback(() => { 74 const collectionNode = context.collectionRef.current; 75 if (!collectionNode) return []; 76 const orderedNodes = Array.from(collectionNode.querySelectorAll(`[${ITEM_DATA_ATTR}]`)); 77 return Array.from(context.itemMap.values()).sort((a, b) => orderedNodes.indexOf(a.ref.current) - orderedNodes.indexOf(b.ref.current)); 78 }, [context.collectionRef, context.itemMap]); 79 } 80 __name$3(useCollection, "useCollection"); 81 return [ 82 { 83 Provider: CollectionProvider, 84 Slot: CollectionSlot, 85 ItemSlot: CollectionItemSlot 86 }, 87 useCollection, 88 createCollectionScope 89 ]; 90} 91function at(array, index) { 92 if ("at" in Array.prototype) return Array.prototype.at.call(array, index); 93 const actualIndex = toSafeIndex(array, index); 94 return actualIndex === -1 ? void 0 : array[actualIndex]; 95} 96function toSafeIndex(array, index) { 97 const length = array.length; 98 const relativeIndex = toSafeInteger(index); 99 const actualIndex = relativeIndex >= 0 ? relativeIndex : length + relativeIndex; 100 return actualIndex < 0 || actualIndex >= length ? -1 : actualIndex; 101} 102function toSafeInteger(number) { 103 return number !== number || number === 0 ? 0 : Math.trunc(number); 104} 105// @__NO_SIDE_EFFECTS__ 106function createCollection2(name) { 107 const PROVIDER_NAME = name + "CollectionProvider"; 108 const [createCollectionContext, createCollectionScope] = createContextScope(PROVIDER_NAME); 109 const [CollectionContextProvider, useCollectionContext] = createCollectionContext(PROVIDER_NAME, { 110 collectionElement: null, 111 collectionRef: { current: null }, 112 collectionRefObject: { current: null }, 113 itemMap: new OrderedDict(), 114 setItemMap: /* @__PURE__ */ __name$3(() => void 0, "setItemMap") 115 }); 116 const CollectionProvider = /* @__PURE__ */ __name$3(({ state, ...props }) => {
117 return state ? /* @__PURE__ */ (0, import_jsx_runtime$3.jsx)(CollectionProviderImpl, { 118 ...props, 119 state 120 }) : /* @__PURE__ */ (0, import_jsx_runtime$3.jsx)(CollectionInit, { ...props }); 121 }, "CollectionProvider"); 122 CollectionProvider.displayName = PROVIDER_NAME; 123 const CollectionInit = /* @__PURE__ */ __name$3((props) => { 124 const state = useInitCollection(); 125 return /* @__PURE__ */ (0, import_jsx_runtime$3.jsx)(CollectionProviderImpl, { 126 ...props, 127 state 128 }); 129 }, "CollectionInit"); 130 CollectionInit.displayName = PROVIDER_NAME + "Init"; 131 const CollectionProviderImpl = /* @__PURE__ */ __name$3((props) => { 132 const { scope, children, state } = props; 133 const ref = import_react$5.useRef(null); 134 const [collectionElement, setCollectionElement] = import_react$5.useState(null); 135 const composeRefs = useComposedRefs(ref, setCollectionElement); 136 const [itemMap, setItemMap] = state; 137 import_react$5.useEffect(() => { 138 if (!collectionElement) return; 139 const observer = getChildListObserver(() => {}); 140 observer.observe(collectionElement, { 141 childList: true, 142 subtree: true 143 }); 144 return () => { 145 observer.disconnect(); 146 }; 147 }, [collectionElement]); 148 return /* @__PURE__ */ (0, import_jsx_runtime$3.jsx)(CollectionContextProvider, { 149 scope, 150 itemMap, 151 setItemMap, 152 collectionRef: composeRefs, 153 collectionRefObject: ref, 154 collectionElement, 155 children 156 }); 157 }, "CollectionProviderImpl"); 158 CollectionProviderImpl.displayName = PROVIDER_NAME + "Impl"; 159 const COLLECTION_SLOT_NAME = name + "CollectionSlot"; 160 const CollectionSlotImpl = createSlot(COLLECTION_SLOT_NAME); 161 const CollectionSlot = import_react$5.forwardRef((props, forwardedRef) => { 162 const { scope, children } = props; 163 const context = useCollectionContext(COLLECTION_SLOT_NAME, scope); 164 const composedRefs = useComposedRefs(forwardedRef, context.collectionRef); 165 return /* @__PURE__ */ (0, import_jsx_runtime$3.jsx)(CollectionSlotImpl, { 166 ref: composedRefs, 167 children 168 }); 169 }); 170 CollectionSlot.displayName = COLLECTION_SLOT_NAME; 171 const ITEM_SLOT_NAME = name + "CollectionItemSlot"; 172 const ITEM_DATA_ATTR = "data-radix-collection-item"; 173 const CollectionItemSlotImpl = createSlot(ITEM_SLOT_NAME); 174 const CollectionItemSlot = import_react$5.forwardRef((props, forwardedRef) => { 175 const { scope, children, ...itemData } = props; 176 const ref = import_react$5.useRef(null); 177 const [element, setElement] = import_react$5.useState(null); 178 const composedRefs = useComposedRefs(forwardedRef, ref, setElement); 179 const { setItemMap } = useCollectionContext(ITEM_SLOT_NAME, scope); 180 const itemDataRef = import_react$5.useRef(itemData); 181 if (!shallowEqual(itemDataRef.current, itemData)) itemDataRef.current = itemData; 182 const memoizedItemData = itemDataRef.current; 183 import_react$5.useEffect(() => { 184 const itemData2 = memoizedItemData; 185 setItemMap((map) => { 186 if (!element) return map; 187 if (!map.has(element)) { 188 map.set(element, { 189 ...itemData2, 190 element 191 }); 192 return map.toSorted(sortByDocumentPosition); 193 } 194 return map.set(element, { 195 ...itemData2, 196 element 197 }).toSorted(sortByDocumentPosition); 198 }); 199 return () => { 200 setItemMap((map) => { 201 if (!element || !map.has(element)) return map; 202 map.delete(element); 203 return new OrderedDict(map); 204 }); 205 }; 206 }, [ 207 element, 208 memoizedItemData, 209 setItemMap 210 ]); 211 return /* @__PURE__ */ (0, import_jsx_runtime$3.jsx)(CollectionItemSlotImpl, { 212 [ITEM_DATA_ATTR]: "", 213 ref: composedRefs, 214 children 215 }); 216 }); 217 CollectionItemSlot.displayName = ITEM_SLOT_NAME; 218 function useInitCollection() { 219 return import_react$5.useState(new OrderedDict()); 220 } 221 __name$3(useInitCollection, "useInitCollection"); 222 function useCollection(scope) { 223 const { itemMap } = useCollectionContext(name + "CollectionConsumer", scope); 224 return itemMap; 225 } 226 __name$3(useCollection, "useCollection"); 227 return [{ 228 Provider: CollectionProvider, 229 Slot: CollectionSlot, 230 ItemSlot: CollectionItemSlot 231 }, { 232 createCollectionScope, 233 useCollection, 234 useInitCollection 235 }]; 236} 237function shallowEqual(a, b) { 238 if (a === b) return true; 239 if (typeof a !== "object" || typeof b !== "object") return false;
240 if (a == null || b == null) return false; 241 const keysA = Object.keys(a); 242 const keysB = Object.keys(b); 243 if (keysA.length !== keysB.length) return false; 244 for (const key of keysA) { 245 if (!Object.prototype.hasOwnProperty.call(b, key)) return false; 246 if (a[key] !== b[key]) return false; 247 } 248 return true; 249} 250function isElementPreceding(a, b) { 251 return !!(b.compareDocumentPosition(a) & Node.DOCUMENT_POSITION_PRECEDING); 252} 253function sortByDocumentPosition(a, b) { 254 return !a[1].element || !b[1].element ? 0 : isElementPreceding(a[1].element, b[1].element) ? -1 : 1; 255} 256function getChildListObserver(callback) { 257 return new MutationObserver((mutationsList) => { 258 for (const mutation of mutationsList) if (mutation.type === "childList") { 259 callback(); 260 return; 261 } 262 }); 263} 264var import_react$4, import_jsx_runtime$2, import_react$5, import_jsx_runtime$3, __defProp$3, __name$3, __instanciated, OrderedDict; 265function init_dist() { 266 return (init_dist = __esmMin((() => { 267 import_react$4 = /* @__PURE__ */ __toESM(require_react(), 1); 268 init_dist$6(); 269 init_dist$5(); 270 init_dist$4(); 271 import_jsx_runtime$2 = require_jsx_runtime(); 272 import_react$5 = /* @__PURE__ */ __toESM(require_react(), 1); 273 import_jsx_runtime$3 = require_jsx_runtime(); 274 __defProp$3 = Object.defineProperty; 275 __name$3 = (target, value) => __defProp$3(target, "name", { 276 value, 277 configurable: true 278 }); 279 __name$3(createCollection, "createCollection"); 280 __instanciated = /* @__PURE__ */ new WeakMap(); 281 OrderedDict = class _OrderedDict extends Map { 282 static { 283 __name$3(this, "OrderedDict"); 284 } 285 #keys; 286 constructor(entries) { 287 super(entries); 288 this.#keys = [...super.keys()]; 289 __instanciated.set(this, true); 290 } 291 set(key, value) { 292 if (__instanciated.get(this)) { 293 if (this.has(key)) this.#keys[this.#keys.indexOf(key)] = key; 294 else this.#keys.push(key); 295 } 296 super.set(key, value); 297 return this; 298 } 299 insert(index, key, value) { 300 const has = this.has(key); 301 const length = this.#keys.length; 302 const relativeIndex = toSafeInteger(index); 303 let actualIndex = relativeIndex >= 0 ? relativeIndex : length + relativeIndex; 304 const safeIndex = actualIndex < 0 || actualIndex >= length ? -1 : actualIndex; 305 if (safeIndex === this.size || has && safeIndex === this.size - 1 || safeIndex === -1) { 306 this.set(key, value); 307 return this; 308 } 309 const size = this.size + (has ? 0 : 1); 310 if (relativeIndex < 0) actualIndex++; 311 const keys = [...this.#keys]; 312 let nextValue; 313 let shouldSkip = false; 314 for (let i = actualIndex; i < size; i++) if (actualIndex === i) { 315 let nextKey = keys[i]; 316 if (keys[i] === key) nextKey = keys[i + 1]; 317 if (has) this.delete(key); 318 nextValue = this.get(nextKey); 319 this.set(key, value); 320 } else { 321 if (!shouldSkip && keys[i - 1] === key) shouldSkip = true; 322 const currentKey = keys[shouldSkip ? i : i - 1]; 323 const currentValue = nextValue; 324 nextValue = this.get(currentKey); 325 this.delete(currentKey); 326 this.set(currentKey, currentValue); 327 } 328 return this; 329 } 330 with(index, key, value) { 331 const copy = new _OrderedDict(this); 332 copy.insert(index, key, value); 333 return copy; 334 } 335 before(key) { 336 const index = this.#keys.indexOf(key) - 1; 337 if (index < 0) return; 338 return this.entryAt(index); 339 } 340 /** 341 * Sets a new key-value pair at the position before the given key. 342 */ 343 setBefore(key, newKey, value) { 344 const index = this.#keys.indexOf(key); 345 if (index === -1) return this; 346 return this.insert(index, newKey, value); 347 } 348 after(key) { 349 let index = this.#keys.indexOf(key); 350 index = index === -1 || index === this.size - 1 ? -1 : index + 1; 351 if (index === -1) return; 352 return this.entryAt(index); 353 } 354 /** 355 * Sets a new key-value pair at the position after the given key. 356 */ 357 setAfter(key, newKey, value) { 358 const index = this.#keys.indexOf(key); 359 if (index === -1) return this; 360 return this.insert(index + 1, newKey, value); 361 } 362 first() { 363 return this.entryAt(0); 364 }
365 last() { 366 return this.entryAt(-1); 367 } 368 clear() { 369 this.#keys = []; 370 return super.clear(); 371 } 372 delete(key) { 373 const deleted = super.delete(key); 374 if (deleted) this.#keys.splice(this.#keys.indexOf(key), 1); 375 return deleted; 376 } 377 deleteAt(index) { 378 const key = this.keyAt(index); 379 if (key !== void 0) return this.delete(key); 380 return false; 381 } 382 at(index) { 383 const key = at(this.#keys, index); 384 if (key !== void 0) return this.get(key); 385 } 386 entryAt(index) { 387 const key = at(this.#keys, index); 388 if (key !== void 0) return [key, this.get(key)]; 389 } 390 indexOf(key) { 391 return this.#keys.indexOf(key); 392 } 393 keyAt(index) { 394 return at(this.#keys, index); 395 } 396 from(key, offset) { 397 const index = this.indexOf(key); 398 if (index === -1) return; 399 let dest = index + offset; 400 if (dest < 0) dest = 0; 401 if (dest >= this.size) dest = this.size - 1; 402 return this.at(dest); 403 } 404 keyFrom(key, offset) { 405 const index = this.indexOf(key); 406 if (index === -1) return; 407 let dest = index + offset; 408 if (dest < 0) dest = 0; 409 if (dest >= this.size) dest = this.size - 1; 410 return this.keyAt(dest); 411 } 412 find(predicate, thisArg) { 413 let index = 0; 414 for (const entry of this) { 415 if (Reflect.apply(predicate, thisArg, [ 416 entry, 417 index, 418 this 419 ])) return entry; 420 index++; 421 } 422 } 423 findIndex(predicate, thisArg) { 424 let index = 0; 425 for (const entry of this) { 426 if (Reflect.apply(predicate, thisArg, [ 427 entry, 428 index, 429 this 430 ])) return index; 431 index++; 432 } 433 return -1; 434 } 435 filter(predicate, thisArg) { 436 const entries = []; 437 let index = 0; 438 for (const entry of this) { 439 if (Reflect.apply(predicate, thisArg, [ 440 entry, 441 index, 442 this 443 ])) entries.push(entry); 444 index++; 445 } 446 return new _OrderedDict(entries); 447 } 448 map(callbackfn, thisArg) { 449 const entries = []; 450 let index = 0; 451 for (const entry of this) { 452 entries.push([entry[0], Reflect.apply(callbackfn, thisArg, [ 453 entry, 454 index, 455 this 456 ])]); 457 index++; 458 } 459 return new _OrderedDict(entries); 460 } 461 reduce(...args) { 462 const [callbackfn, initialValue] = args; 463 let index = 0; 464 let accumulator = initialValue ?? this.at(0); 465 for (const entry of this) { 466 if (index === 0 && args.length === 1) accumulator = entry; 467 else accumulator = Reflect.apply(callbackfn, this, [ 468 accumulator, 469 entry, 470 index, 471 this 472 ]); 473 index++; 474 } 475 return accumulator; 476 } 477 reduceRight(...args) { 478 const [callbackfn, initialValue] = args; 479 let accumulator = initialValue ?? this.at(-1); 480 for (let index = this.size - 1; index >= 0; index--) { 481 const entry = this.at(index); 482 if (index === this.size - 1 && args.length === 1) accumulator = entry; 483 else accumulator = Reflect.apply(callbackfn, this, [ 484 accumulator, 485 entry, 486 index, 487 this 488 ]); 489 } 490 return accumulator; 491 } 492 toSorted(compareFn) { 493 const entries = [...this.entries()].sort(compareFn); 494 return new _OrderedDict(entries); 495 } 496 toReversed() { 497 const reversed = new _OrderedDict(); 498 for (let index = this.size - 1; index >= 0; index--) { 499 const key = this.keyAt(index); 500 const element = this.get(key); 501 reversed.set(key, element); 502 } 503 return reversed; 504 } 505 toSpliced(...args) { 506 const entries = [...this.entries()]; 507 entries.splice(...args); 508 return new _OrderedDict(entries); 509 } 510 slice(start, end) { 511 const result = new _OrderedDict(); 512 let stop = this.size - 1; 513 if (start === void 0) return result; 514 if (start < 0) start = start + this.size; 515 if (end !== void 0 && end > 0) stop = end - 1; 516 for (let index = start; index <= stop; index++) { 517 const key = this.keyAt(index); 518 const element = this.get(key); 519 result.set(key, element); 520 } 521 return result; 522 } 523 every(predicate, thisArg) { 524 let index = 0; 525 for (const entry of this) { 526 if (!Reflect.apply(predicate, thisArg, [ 527 entry, 528 index, 529 this 530 ])) return false;
531 index++; 532 } 533 return true; 534 } 535 some(predicate, thisArg) { 536 let index = 0; 537 for (const entry of this) { 538 if (Reflect.apply(predicate, thisArg, [ 539 entry, 540 index, 541 this 542 ])) return true; 543 index++; 544 } 545 return false; 546 } 547 }; 548 __name$3(at, "at"); 549 __name$3(toSafeIndex, "toSafeIndex"); 550 __name$3(toSafeInteger, "toSafeInteger"); 551 __name$3(createCollection2, "createCollection"); 552 __name$3(shallowEqual, "shallowEqual"); 553 __name$3(isElementPreceding, "isElementPreceding"); 554 __name$3(sortByDocumentPosition, "sortByDocumentPosition"); 555 __name$3(getChildListObserver, "getChildListObserver"); 556 })))(); 557} 558//#endregion 559//#region node_modules/.pnpm/@[email protected]_@[email protected][email protected]/node_modules/@radix-ui/react-direction/dist/index.mjs 560function useDirection(localDir) { 561 const globalDir = import_react$3.useContext(DirectionContext); 562 return localDir || globalDir || "ltr"; 563} 564var import_react$3, __defProp$2, __name$2, DirectionContext; 565function init_dist$1() { 566 return (init_dist$1 = __esmMin((() => { 567 import_react$3 = /* @__PURE__ */ __toESM(require_react(), 1); 568 require_jsx_runtime(); 569 __defProp$2 = Object.defineProperty; 570 __name$2 = (target, value) => __defProp$2(target, "name", { 571 value, 572 configurable: true 573 }); 574 DirectionContext = import_react$3.createContext(void 0); 575 __name$2(useDirection, "useDirection"); 576 })))(); 577} 578//#endregion 579//#region node_modules/.pnpm/@[email protected]_@[email protected][email protected]/node_modules/@radix-ui/react-use-is-hydrated/dist/index.mjs 580function useIsHydrated() { 581 const [isHydrated, setIsHydrated] = import_react$2.useState(_isHydrated); 582 import_react$2.useEffect(() => { 583 if (!_isHydrated) { 584 _isHydrated = true; 585 setIsHydrated(true); 586 } 587 }, []); 588 return isHydrated; 589} 590function subscribe() { 591 return () => {}; 592} 593function useIsHydratedModern() { 594 return useReactSyncExternalStore(subscribe, () => true, () => false); 595} 596var import_react$1, import_react$2, __defProp$1, __name$1, _isHydrated, useReactSyncExternalStore, useIsHydrated2; 597function init_dist$2() { 598 return (init_dist$2 = __esmMin((() => { 599 import_react$1 = /* @__PURE__ */ __toESM(require_react(), 1); 600 import_react$2 = /* @__PURE__ */ __toESM(require_react(), 1); 601 __defProp$1 = Object.defineProperty; 602 __name$1 = (target, value) => __defProp$1(target, "name", { 603 value, 604 configurable: true 605 }); 606 _isHydrated = false; 607 __name$1(useIsHydrated, "useIsHydrated"); 608 useReactSyncExternalStore = import_react$1[" useSyncExternalStore ".trim().toString()]; 609 __name$1(subscribe, "subscribe"); 610 __name$1(useIsHydratedModern, "useIsHydratedModern"); 611 useIsHydrated2 = typeof useReactSyncExternalStore === "function" ? useIsHydratedModern : useIsHydrated; 612 })))(); 613} 614//#endregion 615//#region node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected]__@types_81f1fd0d9cdef2b0433035d03950785c/node_modules/@radix-ui/react-roving-focus/dist/index.mjs 616function getDirectionAwareKey(key, dir) { 617 if (dir !== "rtl") return key; 618 return key === "ArrowLeft" ? "ArrowRight" : key === "ArrowRight" ? "ArrowLeft" : key; 619} 620function getFocusIntent(event, orientation, dir) { 621 const key = getDirectionAwareKey(event.key, dir); 622 if (orientation === "vertical" && ["ArrowLeft", "ArrowRight"].includes(key)) return void 0; 623 if (orientation === "horizontal" && ["ArrowUp", "ArrowDown"].includes(key)) return void 0; 624 return MAP_KEY_TO_FOCUS_INTENT[key]; 625} 626function focusFirst(candidates, preventScroll = false) { 627 const PREVIOUSLY_FOCUSED_ELEMENT = document.activeElement; 628 for (const candidate of candidates) { 629 if (candidate === PREVIOUSLY_FOCUSED_ELEMENT) return; 630 candidate.focus({ preventScroll }); 631 if (document.activeElement !== PREVIOUSLY_FOCUSED_ELEMENT) return; 632 } 633} 634function wrapArray(array, startIndex) { 635 return array.map((_, index) => array[(startIndex + index) % array.length]); 636} 637var import_react, import_jsx_runtime, __defProp, __name, ENTRY_FOCUS, EVENT_OPTIONS, GROUP_NAME, Collection, useCollection, createCollectionScope, createRovingFocusGroupContext, createRovingFocusGroupScope, RovingFocusProvider, useRovingFocusContext, RovingFocusGroup, RovingFocusGroupImpl, ITEM_NAME, RovingFocusGroupItem, MAP_KEY_TO_FOCUS_INTENT, Root, Item; 638function init_dist$3() { 639 return (init_dist$3 = __esmMin((() => { 640 import_react = /* @__PURE__ */ __toESM(require_react(), 1); 641 init_dist$8(); 642 init_dist(); 643 init_dist$5(); 644 init_dist$6(); 645 init_dist$9(); 646 init_dist$11(); 647 init_dist$12(); 648 init_dist$7(); 649 init_dist$1(); 650 init_dist$10(); 651 init_dist$2(); 652 import_jsx_runtime = require_jsx_runtime(); 653 __defProp = Object.defineProperty; 654 __name = (target, value) =>
654 __defProp(target, "name", { 655 value, 656 configurable: true 657 }); 658 ENTRY_FOCUS = "rovingFocusGroup.onEntryFocus"; 659 EVENT_OPTIONS = { 660 bubbles: false, 661 cancelable: true 662 }; 663 GROUP_NAME = "RovingFocusGroup"; 664 [Collection, useCollection, createCollectionScope] = /* @__PURE__ */ createCollection(GROUP_NAME); 665 [createRovingFocusGroupContext, createRovingFocusGroupScope] = createContextScope(GROUP_NAME, [createCollectionScope]); 666 [RovingFocusProvider, useRovingFocusContext] = createRovingFocusGroupContext(GROUP_NAME); 667 RovingFocusGroup = /* @__PURE__ */ import_react.forwardRef(/* @__PURE__ */ __name(function RovingFocusGroup2(props, forwardedRef) { 668 return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Collection.Provider, { 669 scope: props.__scopeRovingFocusGroup, 670 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Collection.Slot, { 671 scope: props.__scopeRovingFocusGroup, 672 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RovingFocusGroupImpl, { 673 ...props, 674 ref: forwardedRef 675 }) 676 }) 677 }); 678 }, "RovingFocusGroup")); 679 RovingFocusGroupImpl = /* @__PURE__ */ import_react.forwardRef(/* @__PURE__ */ __name(function RovingFocusGroupImpl2(props, forwardedRef) { 680 const { __scopeRovingFocusGroup, orientation, loop = false, dir, currentTabStopId: currentTabStopIdProp, defaultCurrentTabStopId, onCurrentTabStopIdChange, onEntryFocus, preventScrollOnEntryFocus = false, ...groupProps } = props; 681 const ref = import_react.useRef(null); 682 const composedRefs = useComposedRefs(forwardedRef, ref); 683 const direction = useDirection(dir); 684 const [currentTabStopId, setCurrentTabStopId] = useControllableState({ 685 prop: currentTabStopIdProp, 686 defaultProp: defaultCurrentTabStopId ?? null, 687 onChange: onCurrentTabStopIdChange, 688 caller: GROUP_NAME 689 }); 690 const [isTabbingBackOut, setIsTabbingBackOut] = import_react.useState(false); 691 const handleEntryFocus = useCallbackRef(onEntryFocus); 692 const getItems = useCollection(__scopeRovingFocusGroup); 693 const isClickFocusRef = import_react.useRef(false); 694 const [focusableItemsCount, setFocusableItemsCount] = import_react.useState(0); 695 import_react.useEffect(() => { 696 const node = ref.current; 697 if (node) { 698 node.addEventListener(ENTRY_FOCUS, handleEntryFocus); 699 return () => node.removeEventListener(ENTRY_FOCUS, handleEntryFocus); 700 } 701 }, [handleEntryFocus]); 702 return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RovingFocusProvider, { 703 scope: __scopeRovingFocusGroup, 704 orientation, 705 dir: direction, 706 loop, 707 currentTabStopId, 708 onItemFocus: import_react.useCallback((tabStopId) => setCurrentTabStopId(tabStopId), [setCurrentTabStopId]), 709 onItemShiftTab: import_react.useCallback(() => setIsTabbingBackOut(true), []), 710 onFocusableItemAdd: import_react.useCallback(() => setFocusableItemsCount((prevCount) => prevCount + 1), []), 711 onFocusableItemRemove: import_react.useCallback(() => setFocusableItemsCount((prevCount) => prevCount - 1), []), 712 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Primitive.div, { 713 tabIndex: isTabbingBackOut || focusableItemsCount === 0 ? -1 : 0, 714 "data-orientation": orientation, 715 ...groupProps, 716 ref: composedRefs, 717 style: { 718 outline: "none", 719 ...props.style 720 }, 721 onMouseDown: composeEventHandlers(props.onMouseDown, () => { 722 isClickFocusRef.current = true; 723 }), 724 onFocus: composeEventHandlers(props.onFocus, (event) => { 725 const isKeyboardFocus = !isClickFocusRef.current; 726 if (event.target === event.currentTarget && isKeyboardFocus && !isTabbingBackOut) { 727 const entryFocusEvent = new CustomEvent(ENTRY_FOCUS, EVENT_OPTIONS); 728 event.currentTarget.dispatchEvent(entryFocusEvent); 729 if (!entryFocusEvent.defaultPrevented) { 730 const items = getItems().filter((item) => item.focusable); 731 focusFirst([ 732 items.find((item) => item.active), 733 items.find((item) => item.id === currentTabStopId), 734 ...items 735 ].filter(Boolean).map((item) => item.ref.current), preventScrollOnEntryFocus); 736 } 737 } 738 isClickFocusRef.current = false;
739 }), 740 onBlur: composeEventHandlers(props.onBlur, () => setIsTabbingBackOut(false)) 741 }) 742 }); 743 }, "RovingFocusGroupImpl")); 744 ITEM_NAME = "RovingFocusGroupItem"; 745 RovingFocusGroupItem = /* @__PURE__ */ import_react.forwardRef(/* @__PURE__ */ __name(function RovingFocusGroupItem2(props, forwardedRef) { 746 const { __scopeRovingFocusGroup, focusable = true, active = false, tabStopId, children, ...itemProps } = props; 747 const autoId = useId(); 748 const id = tabStopId || autoId; 749 const context = useRovingFocusContext(ITEM_NAME, __scopeRovingFocusGroup); 750 const isCurrentTabStop = context.currentTabStopId === id; 751 const getItems = useCollection(__scopeRovingFocusGroup); 752 const { onFocusableItemAdd, onFocusableItemRemove, currentTabStopId } = context; 753 const isHydrated = useIsHydrated2(); 754 useLayoutEffect2(() => { 755 if (!isHydrated || !focusable) return; 756 onFocusableItemAdd(); 757 return () => onFocusableItemRemove(); 758 }, [ 759 isHydrated, 760 focusable, 761 onFocusableItemAdd, 762 onFocusableItemRemove 763 ]); 764 import_react.useEffect(() => { 765 if (isHydrated || !focusable) return; 766 onFocusableItemAdd(); 767 return () => onFocusableItemRemove(); 768 }, [ 769 isHydrated, 770 focusable, 771 onFocusableItemAdd, 772 onFocusableItemRemove 773 ]); 774 return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Collection.ItemSlot, { 775 scope: __scopeRovingFocusGroup, 776 id, 777 focusable, 778 active, 779 children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Primitive.span, { 780 tabIndex: isCurrentTabStop ? 0 : -1, 781 "data-orientation": context.orientation, 782 ...itemProps, 783 ref: forwardedRef, 784 onMouseDown: composeEventHandlers(props.onMouseDown, (event) => { 785 if (!focusable) event.preventDefault(); 786 else context.onItemFocus(id); 787 }), 788 onFocus: composeEventHandlers(props.onFocus, () => context.onItemFocus(id)), 789 onKeyDown: composeEventHandlers(props.onKeyDown, (event) => { 790 if (event.key === "Tab" && event.shiftKey) { 791 context.onItemShiftTab(); 792 return; 793 } 794 if (event.target !== event.currentTarget) return; 795 const focusIntent = getFocusIntent(event, context.orientation, context.dir); 796 if (focusIntent !== void 0) { 797 if (event.metaKey || event.ctrlKey || event.altKey || event.shiftKey) return; 798 event.preventDefault(); 799 let candidateNodes = getItems().filter((item) => item.focusable).map((item) => item.ref.current); 800 if (focusIntent === "last") candidateNodes.reverse(); 801 else if (focusIntent === "prev" || focusIntent === "next") { 802 if (focusIntent === "prev") candidateNodes.reverse(); 803 const currentIndex = candidateNodes.indexOf(event.currentTarget); 804 candidateNodes = context.loop ? wrapArray(candidateNodes, currentIndex + 1) : candidateNodes.slice(currentIndex + 1); 805 } 806 setTimeout(() => focusFirst(candidateNodes)); 807 } 808 }), 809 children: typeof children === "function" ? children({ 810 isCurrentTabStop, 811 hasTabStop: currentTabStopId != null 812 }) : children 813 }) 814 }); 815 }, "RovingFocusGroupItem")); 816 MAP_KEY_TO_FOCUS_INTENT = { 817 ArrowLeft: "prev", 818 ArrowUp: "prev", 819 ArrowRight: "next", 820 ArrowDown: "next", 821 PageUp: "first", 822 Home: "first", 823 PageDown: "last", 824 End: "last" 825 }; 826 __name(getDirectionAwareKey, "getDirectionAwareKey"); 827 __name(getFocusIntent, "getFocusIntent"); 828 __name(focusFirst, "focusFirst"); 829 __name(wrapArray, "wrapArray"); 830 Root = RovingFocusGroup; 831 Item = RovingFocusGroupItem; 832 })))(); 833} 834//#endregion 835export { init_dist$1 as a, init_dist as c, init_dist$3 as i, Root as n, useDirection as o, createRovingFocusGroupScope as r, createCollection as s, Item as t };
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.