import { c as Pe, a as ze, $ as I, b as Se, e as Te } from "./mergeProps-Dsl8k3Ig.es.js";
import { $ as we } from "./filterDOMProps-BSVCO5jK.es.js";
import { a as Ke, c as E } from "./scrollIntoView-B7D07fJk.es.js";
import { f as Me, $ as je } from "./useFocusVisible-B3HmFL2Q.es.js";
import { $ as R } from "./useLocalizedStringFormatter-DWb0DkHL.es.js";
import { useRef as O, useMemo as Ne } from "react";
import { $ as Ve } from "./LiveAnnouncer-CsPyaceH.es.js";
import { $ as Re } from "./useUpdateEffect-CCDx8D4X.es.js";
import { $ as Oe } from "./useHasTabbableChild-DXq72IE3.es.js";
import { $ as Le } from "./Header-CiYtrnTw.es.js";
import { e as Ue } from "./openLink-BNz58j4a.es.js";
import { $ as f } from "./getScrollParent-MZgwmCKW.es.js";
import { a as K } from "./FocusScope-CqEZq7sr.es.js";
import { $ as C } from "./focusSafely-Cwb0Tyy6.es.js";
import { g as We } from "./SelectionManager-CX9btso_.es.js";
import { $ as _e } from "./context-DW7UvQ8z.es.js";
const F = /* @__PURE__ */ new WeakMap();
function M(e, u) {
  var t;
  let { id: o } = (t = F.get(e)) !== null && t !== void 0 ? t : {};
  if (!o) throw new Error("Unknown list");
  return `${o}-${Ge(u)}`;
}
function Ge(e) {
  return typeof e == "string" ? e.replace(/\s*/g, "") : "" + e;
}
var L = {};
L = {
  deselectedItem: (e) => `${e.item} غير المحدد`,
  longPressToSelect: "اضغط مطولًا للدخول إلى وضع التحديد.",
  select: "تحديد",
  selectedAll: "جميع العناصر المحددة.",
  selectedCount: (e, u) => `${u.plural(e.count, {
    "=0": "لم يتم تحديد عناصر",
    one: () => `${u.number(e.count)} عنصر محدد`,
    other: () => `${u.number(e.count)} عنصر محدد`
  })}.`,
  selectedItem: (e) => `${e.item} المحدد`
};
var U = {};
U = {
  deselectedItem: (e) => `${e.item} не е избран.`,
  longPressToSelect: "Натиснете и задръжте за да влезете в избирателен режим.",
  select: "Изберете",
  selectedAll: "Всички елементи са избрани.",
  selectedCount: (e, u) => `${u.plural(e.count, {
    "=0": "Няма избрани елементи",
    one: () => `${u.number(e.count)} избран елемент`,
    other: () => `${u.number(e.count)} избрани елементи`
  })}.`,
  selectedItem: (e) => `${e.item} избран.`
};
var W = {};
W = {
  deselectedItem: (e) => `Položka ${e.item} není vybrána.`,
  longPressToSelect: "Dlouhým stisknutím přejdete do režimu výběru.",
  select: "Vybrat",
  selectedAll: "Vybrány všechny položky.",
  selectedCount: (e, u) => `${u.plural(e.count, {
    "=0": "Nevybrány žádné položky",
    one: () => `Vybrána ${u.number(e.count)} položka`,
    other: () => `Vybráno ${u.number(e.count)} položek`
  })}.`,
  selectedItem: (e) => `Vybrána položka ${e.item}.`
};
var _ = {};
_ = {
  deselectedItem: (e) => `${e.item} ikke valgt.`,
  longPressToSelect: "Lav et langt tryk for at aktivere valgtilstand.",
  select: "Vælg",
  selectedAll: "Alle elementer valgt.",
  selectedCount: (e, u) => `${u.plural(e.count, {
    "=0": "Ingen elementer valgt",
    one: () => `${u.number(e.count)} element valgt`,
    other: () => `${u.number(e.count)} elementer valgt`
  })}.`,
  selectedItem: (e) => `${e.item} valgt.`
};
var G = {};
G = {
  deselectedItem: (e) => `${e.item} nicht ausgewählt.`,
  longPressToSelect: "Gedrückt halten, um Auswahlmodus zu öffnen.",
  select: "Auswählen",
  selectedAll: "Alle Elemente ausgewählt.",
  selectedCount: (e, u) => `${u.plural(e.count, {
    "=0": "Keine Elemente ausgewählt",
    one: () => `${u.number(e.count)} Element ausgewählt`,
    other: () => `${u.number(e.count)} Elemente ausgewählt`
  })}.`,
  selectedItem: (e) => `${e.item} ausgewählt.`
};
var Z = {};
Z = {
  deselectedItem: (e) => `Δεν επιλέχθηκε το στοιχείο ${e.item}.`,
  longPressToSelect: "Πατήστε παρατεταμένα για να μπείτε σε λειτουργία επιλογής.",
  select: "Επιλογή",
  selectedAll: "Επιλέχθηκαν όλα τα στοιχεία.",
  selectedCount: (e, u) => `${u.plural(e.count, {
    "=0": "Δεν επιλέχθηκαν στοιχεία",
    one: () => `Επιλέχθηκε ${u.number(e.count)} στοιχείο`,
    other: () => `Επιλέχθηκαν ${u.number(e.count)} στοιχεία`
  })}.`,
  selectedItem: (e) => `Επιλέχθηκε το στοιχείο ${e.item}.`
};
var H = {};
H = {
  deselectedItem: (e) => `${e.item} not selected.`,
  select: "Select",
  selectedCount: (e, u) => `${u.plural(e.count, {
    "=0": "No items selected",
    one: () => `${u.number(e.count)} item selected`,
    other: () => `${u.number(e.count)} items selected`
  })}.`,
  selectedAll: "All items selected.",
  selectedItem: (e) => `${e.item} selected.`,
  longPressToSelect: "Long press to enter selection mode."
};
var q = {};
q = {
  deselectedItem: (e) => `${e.item} no seleccionado.`,
  longPressToSelect: "Mantenga pulsado para abrir el modo de selección.",
  select: "Seleccionar",
  selectedAll: "Todos los elementos seleccionados.",
  selectedCount: (e, u) => `${u.plural(e.count, {
    "=0": "Ningún elemento seleccionado",
    one: () => `${u.number(e.count)} elemento seleccionado`,
    other: () => `${u.number(e.count)} elementos seleccionados`
  })}.`,
  selectedItem: (e) => `${e.item} seleccionado.`
};
var J = {};
J = {
  deselectedItem: (e) => `${e.item} pole valitud.`,
  longPressToSelect: "Valikurežiimi sisenemiseks vajutage pikalt.",
  select: "Vali",
  selectedAll: "Kõik üksused valitud.",
  selectedCount: (e, u) => `${u.plural(e.count, {
    "=0": "Üksusi pole valitud",
    one: () => `${u.number(e.count)} üksus valitud`,
    other: () => `${u.number(e.count)} üksust valitud`
  })}.`,
  selectedItem: (e) => `${e.item} valitud.`
};
var X = {};
X = {
  deselectedItem: (e) => `Kohdetta ${e.item} ei valittu.`,
  longPressToSelect: "Siirry valintatilaan painamalla pitkään.",
  select: "Valitse",
  selectedAll: "Kaikki kohteet valittu.",
  selectedCount: (e, u) => `${u.plural(e.count, {
    "=0": "Ei yhtään kohdetta valittu",
    one: () => `${u.number(e.count)} kohde valittu`,
    other: () => `${u.number(e.count)} kohdetta valittu`
  })}.`,
  selectedItem: (e) => `${e.item} valittu.`
};
var Y = {};
Y = {
  deselectedItem: (e) => `${e.item} non sélectionné.`,
  longPressToSelect: "Appuyez de manière prolongée pour passer en mode de sélection.",
  select: "Sélectionner",
  selectedAll: "Tous les éléments sélectionnés.",
  selectedCount: (e, u) => `${u.plural(e.count, {
    "=0": "Aucun élément sélectionné",
    one: () => `${u.number(e.count)} élément sélectionné`,
    other: () => `${u.number(e.count)} éléments sélectionnés`
  })}.`,
  selectedItem: (e) => `${e.item} sélectionné.`
};
var Q = {};
Q = {
  deselectedItem: (e) => `${e.item} לא נבחר.`,
  longPressToSelect: "הקשה ארוכה לכניסה למצב בחירה.",
  select: "בחר",
  selectedAll: "כל הפריטים נבחרו.",
  selectedCount: (e, u) => `${u.plural(e.count, {
    "=0": "לא נבחרו פריטים",
    one: () => `פריט ${u.number(e.count)} נבחר`,
    other: () => `${u.number(e.count)} פריטים נבחרו`
  })}.`,
  selectedItem: (e) => `${e.item} נבחר.`
};
var ee = {};
ee = {
  deselectedItem: (e) => `Stavka ${e.item} nije odabrana.`,
  longPressToSelect: "Dugo pritisnite za ulazak u način odabira.",
  select: "Odaberite",
  selectedAll: "Odabrane su sve stavke.",
  selectedCount: (e, u) => `${u.plural(e.count, {
    "=0": "Nije odabrana nijedna stavka",
    one: () => `Odabrana je ${u.number(e.count)} stavka`,
    other: () => `Odabrano je ${u.number(e.count)} stavki`
  })}.`,
  selectedItem: (e) => `Stavka ${e.item} je odabrana.`
};
var ue = {};
ue = {
  deselectedItem: (e) => `${e.item} nincs kijelölve.`,
  longPressToSelect: "Nyomja hosszan a kijelöléshez.",
  select: "Kijelölés",
  selectedAll: "Az összes elem kijelölve.",
  selectedCount: (e, u) => `${u.plural(e.count, {
    "=0": "Egy elem sincs kijelölve",
    one: () => `${u.number(e.count)} elem kijelölve`,
    other: () => `${u.number(e.count)} elem kijelölve`
  })}.`,
  selectedItem: (e) => `${e.item} kijelölve.`
};
var te = {};
te = {
  deselectedItem: (e) => `${e.item} non selezionato.`,
  longPressToSelect: "Premi a lungo per passare alla modalità di selezione.",
  select: "Seleziona",
  selectedAll: "Tutti gli elementi selezionati.",
  selectedCount: (e, u) => `${u.plural(e.count, {
    "=0": "Nessun elemento selezionato",
    one: () => `${u.number(e.count)} elemento selezionato`,
    other: () => `${u.number(e.count)} elementi selezionati`
  })}.`,
  selectedItem: (e) => `${e.item} selezionato.`
};
var le = {};
le = {
  deselectedItem: (e) => `${e.item} が選択されていません。`,
  longPressToSelect: "長押しして選択モードを開きます。",
  select: "選択",
  selectedAll: "すべての項目を選択しました。",
  selectedCount: (e, u) => `${u.plural(e.count, {
    "=0": "項目が選択されていません",
    one: () => `${u.number(e.count)} 項目を選択しました`,
    other: () => `${u.number(e.count)} 項目を選択しました`
  })}。`,
  selectedItem: (e) => `${e.item} を選択しました。`
};
var ne = {};
ne = {
  deselectedItem: (e) => `${e.item}이(가) 선택되지 않았습니다.`,
  longPressToSelect: "선택 모드로 들어가려면 길게 누르십시오.",
  select: "선택",
  selectedAll: "모든 항목이 선택되었습니다.",
  selectedCount: (e, u) => `${u.plural(e.count, {
    "=0": "선택된 항목이 없습니다",
    one: () => `${u.number(e.count)}개 항목이 선택되었습니다`,
    other: () => `${u.number(e.count)}개 항목이 선택되었습니다`
  })}.`,
  selectedItem: (e) => `${e.item}이(가) 선택되었습니다.`
};
var oe = {};
oe = {
  deselectedItem: (e) => `${e.item} nepasirinkta.`,
  longPressToSelect: "Norėdami įjungti pasirinkimo režimą, paspauskite ir palaikykite.",
  select: "Pasirinkti",
  selectedAll: "Pasirinkti visi elementai.",
  selectedCount: (e, u) => `${u.plural(e.count, {
    "=0": "Nepasirinktas nė vienas elementas",
    one: () => `Pasirinktas ${u.number(e.count)} elementas`,
    other: () => `Pasirinkta elementų: ${u.number(e.count)}`
  })}.`,
  selectedItem: (e) => `Pasirinkta: ${e.item}.`
};
var ie = {};
ie = {
  deselectedItem: (e) => `Vienums ${e.item} nav atlasīts.`,
  longPressToSelect: "Ilgi turiet nospiestu. lai ieslēgtu atlases režīmu.",
  select: "Atlasīt",
  selectedAll: "Atlasīti visi vienumi.",
  selectedCount: (e, u) => `${u.plural(e.count, {
    "=0": "Nav atlasīts neviens vienums",
    one: () => `Atlasīto vienumu skaits: ${u.number(e.count)}`,
    other: () => `Atlasīto vienumu skaits: ${u.number(e.count)}`
  })}.`,
  selectedItem: (e) => `Atlasīts vienums ${e.item}.`
};
var ce = {};
ce = {
  deselectedItem: (e) => `${e.item} er ikke valgt.`,
  longPressToSelect: "Bruk et langt trykk for å gå inn i valgmodus.",
  select: "Velg",
  selectedAll: "Alle elementer er valgt.",
  selectedCount: (e, u) => `${u.plural(e.count, {
    "=0": "Ingen elementer er valgt",
    one: () => `${u.number(e.count)} element er valgt`,
    other: () => `${u.number(e.count)} elementer er valgt`
  })}.`,
  selectedItem: (e) => `${e.item} er valgt.`
};
var se = {};
se = {
  deselectedItem: (e) => `${e.item} niet geselecteerd.`,
  longPressToSelect: "Druk lang om de selectiemodus te openen.",
  select: "Selecteren",
  selectedAll: "Alle items geselecteerd.",
  selectedCount: (e, u) => `${u.plural(e.count, {
    "=0": "Geen items geselecteerd",
    one: () => `${u.number(e.count)} item geselecteerd`,
    other: () => `${u.number(e.count)} items geselecteerd`
  })}.`,
  selectedItem: (e) => `${e.item} geselecteerd.`
};
var ae = {};
ae = {
  deselectedItem: (e) => `Nie zaznaczono ${e.item}.`,
  longPressToSelect: "Naciśnij i przytrzymaj, aby wejść do trybu wyboru.",
  select: "Zaznacz",
  selectedAll: "Wszystkie zaznaczone elementy.",
  selectedCount: (e, u) => `${u.plural(e.count, {
    "=0": "Nie zaznaczono żadnych elementów",
    one: () => `${u.number(e.count)} zaznaczony element`,
    other: () => `${u.number(e.count)} zaznaczonych elementów`
  })}.`,
  selectedItem: (e) => `Zaznaczono ${e.item}.`
};
var re = {};
re = {
  deselectedItem: (e) => `${e.item} não selecionado.`,
  longPressToSelect: "Mantenha pressionado para entrar no modo de seleção.",
  select: "Selecionar",
  selectedAll: "Todos os itens selecionados.",
  selectedCount: (e, u) => `${u.plural(e.count, {
    "=0": "Nenhum item selecionado",
    one: () => `${u.number(e.count)} item selecionado`,
    other: () => `${u.number(e.count)} itens selecionados`
  })}.`,
  selectedItem: (e) => `${e.item} selecionado.`
};
var de = {};
de = {
  deselectedItem: (e) => `${e.item} não selecionado.`,
  longPressToSelect: "Prima continuamente para entrar no modo de seleção.",
  select: "Selecionar",
  selectedAll: "Todos os itens selecionados.",
  selectedCount: (e, u) => `${u.plural(e.count, {
    "=0": "Nenhum item selecionado",
    one: () => `${u.number(e.count)} item selecionado`,
    other: () => `${u.number(e.count)} itens selecionados`
  })}.`,
  selectedItem: (e) => `${e.item} selecionado.`
};
var $e = {};
$e = {
  deselectedItem: (e) => `${e.item} neselectat.`,
  longPressToSelect: "Apăsați lung pentru a intra în modul de selectare.",
  select: "Selectare",
  selectedAll: "Toate elementele selectate.",
  selectedCount: (e, u) => `${u.plural(e.count, {
    "=0": "Niciun element selectat",
    one: () => `${u.number(e.count)} element selectat`,
    other: () => `${u.number(e.count)} elemente selectate`
  })}.`,
  selectedItem: (e) => `${e.item} selectat.`
};
var me = {};
me = {
  deselectedItem: (e) => `${e.item} не выбрано.`,
  longPressToSelect: "Нажмите и удерживайте для входа в режим выбора.",
  select: "Выбрать",
  selectedAll: "Выбраны все элементы.",
  selectedCount: (e, u) => `${u.plural(e.count, {
    "=0": "Нет выбранных элементов",
    one: () => `${u.number(e.count)} элемент выбран`,
    other: () => `${u.number(e.count)} элементов выбрано`
  })}.`,
  selectedItem: (e) => `${e.item} выбрано.`
};
var be = {};
be = {
  deselectedItem: (e) => `Nevybraté položky: ${e.item}.`,
  longPressToSelect: "Dlhším stlačením prejdite do režimu výberu.",
  select: "Vybrať",
  selectedAll: "Všetky vybraté položky.",
  selectedCount: (e, u) => `${u.plural(e.count, {
    "=0": "Žiadne vybraté položky",
    one: () => `${u.number(e.count)} vybratá položka`,
    other: () => `Počet vybratých položiek:${u.number(e.count)}`
  })}.`,
  selectedItem: (e) => `Vybraté položky: ${e.item}.`
};
var pe = {};
pe = {
  deselectedItem: (e) => `Element ${e.item} ni izbran.`,
  longPressToSelect: "Za izbirni način pritisnite in dlje časa držite.",
  select: "Izberite",
  selectedAll: "Vsi elementi so izbrani.",
  selectedCount: (e, u) => `${u.plural(e.count, {
    "=0": "Noben element ni izbran",
    one: () => `${u.number(e.count)} element je izbran`,
    other: () => `${u.number(e.count)} elementov je izbranih`
  })}.`,
  selectedItem: (e) => `Element ${e.item} je izbran.`
};
var Be = {};
Be = {
  deselectedItem: (e) => `${e.item} nije izabrano.`,
  longPressToSelect: "Dugo pritisnite za ulazak u režim biranja.",
  select: "Izaberite",
  selectedAll: "Izabrane su sve stavke.",
  selectedCount: (e, u) => `${u.plural(e.count, {
    "=0": "Nije izabrana nijedna stavka",
    one: () => `Izabrana je ${u.number(e.count)} stavka`,
    other: () => `Izabrano je ${u.number(e.count)} stavki`
  })}.`,
  selectedItem: (e) => `${e.item} je izabrano.`
};
var De = {};
De = {
  deselectedItem: (e) => `${e.item} ej markerat.`,
  longPressToSelect: "Tryck länge när du vill öppna väljarläge.",
  select: "Markera",
  selectedAll: "Alla markerade objekt.",
  selectedCount: (e, u) => `${u.plural(e.count, {
    "=0": "Inga markerade objekt",
    one: () => `${u.number(e.count)} markerat objekt`,
    other: () => `${u.number(e.count)} markerade objekt`
  })}.`,
  selectedItem: (e) => `${e.item} markerat.`
};
var xe = {};
xe = {
  deselectedItem: (e) => `${e.item} seçilmedi.`,
  longPressToSelect: "Seçim moduna girmek için uzun basın.",
  select: "Seç",
  selectedAll: "Tüm ögeler seçildi.",
  selectedCount: (e, u) => `${u.plural(e.count, {
    "=0": "Hiçbir öge seçilmedi",
    one: () => `${u.number(e.count)} öge seçildi`,
    other: () => `${u.number(e.count)} öge seçildi`
  })}.`,
  selectedItem: (e) => `${e.item} seçildi.`
};
var ve = {};
ve = {
  deselectedItem: (e) => `${e.item} не вибрано.`,
  longPressToSelect: "Виконайте довге натиснення, щоб перейти в режим вибору.",
  select: "Вибрати",
  selectedAll: "Усі елементи вибрано.",
  selectedCount: (e, u) => `${u.plural(e.count, {
    "=0": "Жодних елементів не вибрано",
    one: () => `${u.number(e.count)} елемент вибрано`,
    other: () => `Вибрано елементів: ${u.number(e.count)}`
  })}.`,
  selectedItem: (e) => `${e.item} вибрано.`
};
var Ce = {};
Ce = {
  deselectedItem: (e) => `未选择 ${e.item}。`,
  longPressToSelect: "长按以进入选择模式。",
  select: "选择",
  selectedAll: "已选择所有项目。",
  selectedCount: (e, u) => `${u.plural(e.count, {
    "=0": "未选择项目",
    one: () => `已选择 ${u.number(e.count)} 个项目`,
    other: () => `已选择 ${u.number(e.count)} 个项目`
  })}。`,
  selectedItem: (e) => `已选择 ${e.item}。`
};
var Ee = {};
Ee = {
  deselectedItem: (e) => `未選取「${e.item}」。`,
  longPressToSelect: "長按以進入選擇模式。",
  select: "選取",
  selectedAll: "已選取所有項目。",
  selectedCount: (e, u) => `${u.plural(e.count, {
    "=0": "未選取任何項目",
    one: () => `已選取 ${u.number(e.count)} 個項目`,
    other: () => `已選取 ${u.number(e.count)} 個項目`
  })}。`,
  selectedItem: (e) => `已選取「${e.item}」。`
};
var P = {};
P = {
  "ar-AE": L,
  "bg-BG": U,
  "cs-CZ": W,
  "da-DK": _,
  "de-DE": G,
  "el-GR": Z,
  "en-US": H,
  "es-ES": q,
  "et-EE": J,
  "fi-FI": X,
  "fr-FR": Y,
  "he-IL": Q,
  "hr-HR": ee,
  "hu-HU": ue,
  "it-IT": te,
  "ja-JP": le,
  "ko-KR": ne,
  "lt-LT": oe,
  "lv-LV": ie,
  "nb-NO": ce,
  "nl-NL": se,
  "pl-PL": ae,
  "pt-BR": re,
  "pt-PT": de,
  "ro-RO": $e,
  "ru-RU": me,
  "sk-SK": be,
  "sl-SI": pe,
  "sr-SP": Be,
  "sv-SE": De,
  "tr-TR": xe,
  "uk-UA": ve,
  "zh-CN": Ce,
  "zh-TW": Ee
};
function Ze(e) {
  return e && e.__esModule ? e.default : e;
}
function He(e, u) {
  let { getRowText: t = (c) => {
    var s, D, p, $;
    return ($ = (s = (D = u.collection).getTextValue) === null || s === void 0 ? void 0 : s.call(D, c)) !== null && $ !== void 0 ? $ : (p = u.collection.getItem(c)) === null || p === void 0 ? void 0 : p.textValue;
  } } = e, o = R(Ze(P), "@react-aria/grid"), i = u.selectionManager.rawSelection, l = O(i), B = Pe(() => {
    var c;
    if (!u.selectionManager.isFocused || i === l.current) {
      l.current = i;
      return;
    }
    let s = j(i, l.current), D = j(l.current, i), p = u.selectionManager.selectionBehavior === "replace", $ = [];
    if (u.selectionManager.selectedKeys.size === 1 && p) {
      let d = u.selectionManager.selectedKeys.keys().next().value;
      if (d != null && u.collection.getItem(d)) {
        let m = t(d);
        m && $.push(o.format("selectedItem", {
          item: m
        }));
      }
    } else if (s.size === 1 && D.size === 0) {
      let d = s.keys().next().value;
      if (d != null) {
        let m = t(d);
        m && $.push(o.format("selectedItem", {
          item: m
        }));
      }
    } else if (D.size === 1 && s.size === 0) {
      let d = D.keys().next().value;
      if (d != null && u.collection.getItem(d)) {
        let m = t(d);
        m && $.push(o.format("deselectedItem", {
          item: m
        }));
      }
    }
    u.selectionManager.selectionMode === "multiple" && ($.length === 0 || i === "all" || i.size > 1 || l.current === "all" || ((c = l.current) === null || c === void 0 ? void 0 : c.size) > 1) && $.push(i === "all" ? o.format("selectedAll") : o.format("selectedCount", {
      count: i.size
    })), $.length > 0 && Ve($.join(" ")), l.current = i;
  });
  Re(() => {
    if (u.selectionManager.isFocused) B();
    else {
      let c = requestAnimationFrame(B);
      return () => cancelAnimationFrame(c);
    }
  }, [
    i,
    u.selectionManager.isFocused
  ]);
}
function j(e, u) {
  let t = /* @__PURE__ */ new Set();
  if (e === "all" || u === "all") return t;
  for (let o of e.keys()) u.has(o) || t.add(o);
  return t;
}
function qe(e) {
  return e && e.__esModule ? e.default : e;
}
function Je(e) {
  let u = R(qe(P), "@react-aria/grid"), t = Me(), o = (t === "pointer" || t === "virtual" || t == null) && typeof window < "u" && "ontouchstart" in window, i = Ne(() => {
    let B = e.selectionManager.selectionMode, c = e.selectionManager.selectionBehavior, s;
    return o && (s = u.format("longPressToSelect")), c === "replace" && B !== "none" && e.hasItemActions ? s : void 0;
  }, [
    e.selectionManager.selectionMode,
    e.selectionManager.selectionBehavior,
    e.hasItemActions,
    u,
    o
  ]);
  return Ke(i);
}
function mu(e, u, t) {
  let { isVirtualized: o, keyboardDelegate: i, layoutDelegate: l, onAction: B, disallowTypeAhead: c, linkBehavior: s = "action", keyboardNavigationBehavior: D = "arrow", escapeKeyBehavior: p = "clearSelection", shouldSelectOnPressUp: $ } = e;
  !e["aria-label"] && !e["aria-labelledby"] && console.warn("An aria-label or aria-labelledby prop is required for accessibility.");
  let { listProps: d } = Le({
    selectionManager: u.selectionManager,
    collection: u.collection,
    disabledKeys: u.disabledKeys,
    ref: t,
    keyboardDelegate: i,
    layoutDelegate: l,
    isVirtualized: o,
    selectOnFocus: u.selectionManager.selectionBehavior === "replace",
    shouldFocusWrap: e.shouldFocusWrap,
    linkBehavior: s,
    disallowTypeAhead: c,
    autoFocus: e.autoFocus,
    escapeKeyBehavior: p
  }), m = ze(e.id);
  F.set(u, {
    id: m,
    onAction: B,
    linkBehavior: s,
    keyboardNavigationBehavior: D,
    shouldSelectOnPressUp: $
  });
  let h = Je({
    selectionManager: u.selectionManager,
    hasItemActions: !!B
  }), k = Oe(t, {
    isDisabled: u.collection.size !== 0
  }), x = we(e, {
    labelable: !0
  }), A = I(
    x,
    {
      role: "grid",
      id: m,
      "aria-multiselectable": u.selectionManager.selectionMode === "multiple" ? "true" : void 0
    },
    // If collection is empty, make sure the grid is tabbable unless there is a child tabbable element.
    u.collection.size === 0 ? {
      tabIndex: k ? -1 : 0
    } : d,
    h
  );
  return o && (A["aria-rowcount"] = u.collection.size, A["aria-colcount"] = 1), He({}, u), {
    gridProps: A
  };
}
const N = {
  expand: {
    ltr: "ArrowRight",
    rtl: "ArrowLeft"
  },
  collapse: {
    ltr: "ArrowLeft",
    rtl: "ArrowRight"
  }
};
function bu(e, u, t) {
  var o, i;
  let { node: l, isVirtualized: B } = e, { direction: c } = _e(), { onAction: s, linkBehavior: D, keyboardNavigationBehavior: p, shouldSelectOnPressUp: $ } = F.get(u), d = Se(), m = O(null), h = () => {
    var n;
    t.current !== null && (m.current != null && l.key !== m.current || !(!((n = t.current) === null || n === void 0) && n.contains(document.activeElement))) && C(t.current);
  }, k = {}, x = e.hasChildItems, A = u.selectionManager.isLink(l.key);
  if (l != null && "expandedKeys" in u) {
    var y, z;
    let n = (y = (z = u.collection).getChildren) === null || y === void 0 ? void 0 : y.call(z, l.key);
    x = x || [
      ...n ?? []
    ].length > 1, s == null && !A && u.selectionManager.selectionMode === "none" && x && (s = () => u.toggleKey(l.key));
    let a = x ? u.expandedKeys.has(l.key) : void 0, b = 1;
    if (l.level > 0 && l?.parentKey != null) {
      let r = u.collection.getItem(l.parentKey);
      if (r) {
        var g, S;
        b = [
          ...(g = (S = u.collection).getChildren) === null || g === void 0 ? void 0 : g.call(S, r.key)
        ].filter((Fe) => Fe.type === "item").length;
      }
    } else b = [
      ...u.collection
    ].filter((r) => r.level === 0 && r.type === "item").length;
    k = {
      "aria-expanded": a,
      "aria-level": l.level + 1,
      "aria-posinset": l?.index + 1,
      "aria-setsize": b
    };
  }
  let { itemProps: fe, ...T } = We({
    selectionManager: u.selectionManager,
    key: l.key,
    ref: t,
    isVirtualized: B,
    shouldSelectOnPressUp: e.shouldSelectOnPressUp || $,
    onAction: s || !((o = l.props) === null || o === void 0) && o.onAction ? Te((i = l.props) === null || i === void 0 ? void 0 : i.onAction, s ? () => s(l.key) : void 0) : void 0,
    focus: h,
    linkBehavior: D
  }), Ae = (n) => {
    if (!n.currentTarget.contains(n.target) || !t.current || !document.activeElement) return;
    let a = K(t.current);
    if (a.currentNode = document.activeElement, "expandedKeys" in u && document.activeElement === t.current) {
      if (n.key === N.expand[c] && u.selectionManager.focusedKey === l.key && x && !u.expandedKeys.has(l.key)) {
        u.toggleKey(l.key), n.stopPropagation();
        return;
      } else if (n.key === N.collapse[c] && u.selectionManager.focusedKey === l.key && x && u.expandedKeys.has(l.key)) {
        u.toggleKey(l.key), n.stopPropagation();
        return;
      }
    }
    switch (n.key) {
      case "ArrowLeft":
        if (p === "arrow") {
          let r = c === "rtl" ? a.nextNode() : a.previousNode();
          if (r)
            n.preventDefault(), n.stopPropagation(), C(r), E(r, {
              containingElement: f(t.current)
            });
          else if (n.preventDefault(), n.stopPropagation(), c === "rtl")
            C(t.current), E(t.current, {
              containingElement: f(t.current)
            });
          else {
            a.currentNode = t.current;
            let v = V(a);
            v && (C(v), E(v, {
              containingElement: f(t.current)
            }));
          }
        }
        break;
      case "ArrowRight":
        if (p === "arrow") {
          let r = c === "rtl" ? a.previousNode() : a.nextNode();
          if (r)
            n.preventDefault(), n.stopPropagation(), C(r), E(r, {
              containingElement: f(t.current)
            });
          else if (n.preventDefault(), n.stopPropagation(), c === "ltr")
            C(t.current), E(t.current, {
              containingElement: f(t.current)
            });
          else {
            a.currentNode = t.current;
            let v = V(a);
            v && (C(v), E(v, {
              containingElement: f(t.current)
            }));
          }
        }
        break;
      case "ArrowUp":
      case "ArrowDown":
        if (!n.altKey && t.current.contains(n.target)) {
          var b;
          n.stopPropagation(), n.preventDefault(), (b = t.current.parentElement) === null || b === void 0 || b.dispatchEvent(new KeyboardEvent(n.nativeEvent.type, n.nativeEvent));
        }
        break;
    }
  }, ke = (n) => {
    if (m.current = l.key, n.target !== t.current) {
      je() || u.selectionManager.setFocusedKey(l.key);
      return;
    }
  }, he = (n) => {
    if (!(!n.currentTarget.contains(n.target) || !t.current || !document.activeElement))
      switch (n.key) {
        case "Tab":
          if (p === "tab") {
            let a = K(t.current, {
              tabbable: !0
            });
            a.currentNode = document.activeElement, (n.shiftKey ? a.previousNode() : a.nextNode()) && n.stopPropagation();
          }
      }
  }, ye = Ue(l.props), ge = T.hasAction ? ye : {}, w = I(fe, ge, {
    role: "row",
    onKeyDownCapture: Ae,
    onKeyDown: he,
    onFocus: ke,
    // 'aria-label': [(node.textValue || undefined), rowAnnouncement].filter(Boolean).join(', '),
    "aria-label": l.textValue || void 0,
    "aria-selected": u.selectionManager.canSelectItem(l.key) ? u.selectionManager.isSelected(l.key) : void 0,
    "aria-disabled": u.selectionManager.isDisabled(l.key) || void 0,
    "aria-labelledby": d && l.textValue ? `${M(u, l.key)} ${d}` : void 0,
    id: M(u, l.key)
  });
  if (B) {
    let { collection: n } = u, a = [
      ...n
    ];
    w["aria-rowindex"] = a.find((b) => b.type === "section") ? [
      ...n.getKeys()
    ].filter((b) => {
      var r;
      return ((r = n.getItem(b)) === null || r === void 0 ? void 0 : r.type) !== "section";
    }).findIndex((b) => b === l.key) + 1 : l.index + 1;
  }
  let Ie = {
    role: "gridcell",
    "aria-colindex": 1
  };
  return {
    rowProps: {
      ...I(w, k)
    },
    gridCellProps: Ie,
    descriptionProps: {
      id: d
    },
    ...T
  };
}
function V(e) {
  let u = null, t = null;
  do
    t = e.lastChild(), t && (u = t);
  while (t);
  return u;
}
export {
  mu as $,
  bu as a,
  P as b,
  M as c,
  Je as d,
  He as e
};
//# sourceMappingURL=useGridListItem-CJrr2QNO.es.js.map
