
/**
 *   WARNING: This file is intended to be used within MySheerID.
 *   This file is not intended for use in other contexts and there are no guarantees about its behavior outside of MySheerID.
 */ 
/**
 *   VERSION: 2.240.0-alpha.1
 *   BUILD_TIMESTAMP: 1780360182346
 *   BUILD_DATE: Tue Jun 02 2026 00:29:42 GMT+0000 (Coordinated Universal Time)
 *   BUILD_COMMIT: 758cedd37e00f49a728d704d9ed36884f0f12d79
 */
import { an as m, r as c, ao as be, ap as Ze, aq as d } from "../_mysheerid-preview.js";
const ze = (e) => typeof e == "object" && e != null && e.nodeType === 1, Ge = (e, t) => (!t || e !== "hidden") && e !== "visible" && e !== "clip", pe = (e, t) => {
  if (e.clientHeight < e.scrollHeight || e.clientWidth < e.scrollWidth) {
    const i = getComputedStyle(e, null);
    return Ge(i.overflowY, t) || Ge(i.overflowX, t) || ((n) => {
      const r = ((l) => {
        if (!l.ownerDocument || !l.ownerDocument.defaultView) return null;
        try {
          return l.ownerDocument.defaultView.frameElement;
        } catch {
          return null;
        }
      })(n);
      return !!r && (r.clientHeight < n.scrollHeight || r.clientWidth < n.scrollWidth);
    })(e);
  }
  return !1;
}, ye = (e, t, i, n, r, l, u, o) => l < e && u > t || l > e && u < t ? 0 : l <= e && o <= i || u >= t && o >= i ? l - e - n : u > t && o < i || l < e && o > i ? u - t + r : 0, It = (e) => {
  const t = e.parentElement;
  return t ?? (e.getRootNode().host || null);
}, mt = (e, t) => {
  var i, n, r, l;
  if (typeof document > "u") return [];
  const { inline: u, boundary: o, skipOverflowHiddenElements: a } = t, v = typeof o == "function" ? o : (H) => H !== o;
  if (!ze(e)) throw new TypeError("Invalid target");
  const x = document.scrollingElement || document.documentElement, V = [];
  let p = e;
  for (; ze(p) && v(p); ) {
    if (p = It(p), p === x) {
      V.push(p);
      break;
    }
    p != null && p === document.body && pe(p) && !pe(document.documentElement) || p != null && pe(p, a) && V.push(p);
  }
  const w = (n = (i = window.visualViewport) == null ? void 0 : i.width) != null ? n : innerWidth, R = (l = (r = window.visualViewport) == null ? void 0 : r.height) != null ? l : innerHeight, { scrollX: C, scrollY: A } = window, { height: X, width: b, top: te, right: y, bottom: ce, left: j } = e.getBoundingClientRect(), { top: Ee, right: fe, left: N } = ((H) => {
    const I = window.getComputedStyle(H);
    return { top: parseFloat(I.scrollMarginTop) || 0, right: parseFloat(I.scrollMarginRight) || 0, bottom: parseFloat(I.scrollMarginBottom) || 0, left: parseFloat(I.scrollMarginLeft) || 0 };
  })(e);
  let P = te - Ee, D = u === "center" ? j + b / 2 - N + fe : u === "end" ? y + fe : j - N;
  const ne = [];
  for (let H = 0; H < V.length; H++) {
    const I = V[H], { height: ie, width: Y, top: he, right: re, bottom: ge, left: J } = I.getBoundingClientRect();
    if (te >= 0 && j >= 0 && ce <= R && y <= w && (I === x && !pe(I) || te >= he && ce <= ge && j >= J && y <= re)) return ne;
    const Q = getComputedStyle(I), Z = parseInt(Q.borderLeftWidth, 10), ue = parseInt(Q.borderTopWidth, 10), h = parseInt(Q.borderRightWidth, 10), f = parseInt(Q.borderBottomWidth, 10);
    let s = 0, g = 0;
    const E = "offsetWidth" in I ? I.offsetWidth - I.clientWidth - Z - h : 0, S = "offsetHeight" in I ? I.offsetHeight - I.clientHeight - ue - f : 0, M = "offsetWidth" in I ? I.offsetWidth === 0 ? 0 : Y / I.offsetWidth : 0, O = "offsetHeight" in I ? I.offsetHeight === 0 ? 0 : ie / I.offsetHeight : 0;
    if (x === I) s = ye(A, A + R, R, ue, f, A + P, A + P + X, X), g = u === "start" ? D : u === "center" ? D - w / 2 : u === "end" ? D - w : ye(C, C + w, w, Z, h, C + D, C + D + b, b), s = Math.max(0, s + A), g = Math.max(0, g + C);
    else {
      s = ye(he, ge, ie, ue, f + S, P, P + X, X), g = u === "start" ? D - J - Z : u === "center" ? D - (J + Y / 2) + E / 2 : u === "end" ? D - re + h + E : ye(J, re, Y, Z, h + E, D, D + b, b);
      const { scrollLeft: k, scrollTop: K } = I;
      s = O === 0 ? 0 : Math.max(0, Math.min(K + s / O, I.scrollHeight - ie / O + S)), g = M === 0 ? 0 : Math.max(0, Math.min(k + g / M, I.scrollWidth - Y / M + E)), P += K - s, D += k - g;
    }
    ne.push({ el: I, top: s, left: g });
  }
  return ne;
};
var bt = 0;
function pt() {
  return String(bt++);
}
function _e(e) {
  var t = c.useRef(e);
  return t.current = e, t;
}
function et(e, t) {
  var i;
  function n() {
    i && clearTimeout(i);
  }
  function r() {
    for (var l = arguments.length, u = new Array(l), o = 0; o < l; o++)
      u[o] = arguments[o];
    n(), i = setTimeout(function() {
      i = null, e.apply(void 0, u);
    }, t);
  }
  return r.cancel = n, r;
}
var yt = et(function(e) {
  tt(e).textContent = "";
}, 500);
function tt(e) {
  var t = e.getElementById("a11y-status-message");
  return t || (t = e.createElement("div"), t.setAttribute("id", "a11y-status-message"), t.setAttribute("role", "status"), t.setAttribute("aria-live", "polite"), t.setAttribute("aria-relevant", "additions text"), Object.assign(t.style, {
    border: "0",
    clip: "rect(0 0 0 0)",
    height: "1px",
    margin: "-1px",
    overflow: "hidden",
    padding: "0",
    position: "absolute",
    width: "1px"
  }), e.body.appendChild(t), t);
}
function xt(e, t) {
  if (!(!e || !t)) {
    var i = tt(t);
    i.textContent = e, yt(t);
  }
}
function wt(e) {
  var t = e?.getElementById("a11y-status-message");
  t && t.remove();
}
function nt() {
}
function ke(e, t) {
  if (!t)
    return e;
  var i = Object.keys(e);
  return i.reduce(function(n, r) {
    return t[r] !== void 0 && (n[r] = t[r]), n;
  }, m({}, e));
}
function Ct(e, t) {
  if (e) {
    var i = mt(e, {
      boundary: t
    });
    i.forEach(function(n) {
      var r = n.el, l = n.top, u = n.left;
      r.scrollTop = l, r.scrollLeft = u;
    });
  }
}
function Xe(e, t, i) {
  var n = e === t || t instanceof i.Node && e.contains && e.contains(t);
  return n;
}
function $() {
  for (var e = arguments.length, t = new Array(e), i = 0; i < e; i++)
    t[i] = arguments[i];
  return function(n) {
    for (var r = arguments.length, l = new Array(r > 1 ? r - 1 : 0), u = 1; u < r; u++)
      l[u - 1] = arguments[u];
    return t.some(function(o) {
      return o && o.apply(void 0, [n].concat(l)), n.preventDownshiftDefault || n.hasOwnProperty("nativeEvent") && n.nativeEvent.preventDownshiftDefault;
    });
  };
}
function xe() {
  for (var e = arguments.length, t = new Array(e), i = 0; i < e; i++)
    t[i] = arguments[i];
  return function(n) {
    t.forEach(function(r) {
      typeof r == "function" ? r(n) : r && (r.current = n);
    });
  };
}
function Dt(e, t) {
  return e[t] !== void 0;
}
function Et(e) {
  var t = e.key, i = e.keyCode;
  return i >= 37 && i <= 40 && t.indexOf("Arrow") !== 0 ? "Arrow" + t : t;
}
function we(e, t, i, n, r) {
  var l = i.length;
  if (l === 0)
    return -1;
  var u = l - 1;
  (typeof e != "number" || e < 0 || e > u) && (e = t > 0 ? -1 : u + 1);
  var o = e + t;
  o < 0 ? o = u : o > u && (o = 0);
  var a = Ce(o, t < 0, i, n, r);
  return a === -1 ? e >= l ? -1 : e : a;
}
function Ce(e, t, i, n, r) {
  r === void 0 && (r = !1);
  var l = i.length;
  if (t) {
    for (var u = e; u >= 0; u--)
      if (!n(i[u], u))
        return u;
  } else
    for (var o = e; o < l; o++)
      if (!n(i[o], o))
        return o;
  return r ? Ce(t ? l - 1 : 0, t, i, n) : -1;
}
function Ye(e, t, i, n) {
  return n === void 0 && (n = !0), i && t.some(function(r) {
    return r && (Xe(r, e, i) || n && Xe(r, i.document.activeElement, i));
  });
}
function Ve(e) {
  return "" + e.slice(0, 1).toUpperCase() + e.slice(1);
}
function Rt(e, t, i, n) {
  for (var r = e.type, l = {}, u = Object.keys(i), o = 0, a = u; o < a.length; o++) {
    var v = a[o];
    Mt(v, e, t, i, n), n[v] !== i[v] && (l[v] = n[v]);
  }
  t.onStateChange && Object.keys(l).length && t.onStateChange(m({
    type: r
  }, l));
}
function Mt(e, t, i, n, r) {
  if (r[e] !== n[e]) {
    var l = "on" + Ve(e) + "Change", u = i[l];
    if (typeof u == "function") {
      var o = t.type;
      u(m({
        type: o
      }, r));
    }
  }
}
function Ot(e, t, i, n) {
  var r = c.useRef(null), l = c.useRef(void 0), u = _e(t), o = c.useCallback(function(p, w) {
    l.current = w, p = ke(p, u.current);
    var R = e(p, u.current, w), C = u.current.stateReducer(p, m({}, w, {
      changes: R
    }));
    return m({}, p, C);
  }, [u, e]), a = c.useReducer(o, t, i), v = a[0], x = a[1], V = l.current;
  return c.useEffect(function() {
    var p, w = ke((p = r.current) != null ? p : {}, u.current), R = V && r.current && !n(w, v);
    R && Rt(V, u.current, w, v), r.current = v;
  }, [v, V, n, u]), [v, x];
}
function kt(e, t, i, n) {
  if (e !== void 0 && t !== void 0)
    return [e, t];
  if (e !== void 0) {
    var r = i.indexOf(e);
    if (r < 0)
      throw new Error(n);
    return [e, i.indexOf(e)];
  }
  if (t !== void 0) {
    var l = i[t];
    if (l === void 0)
      throw new Error(n);
    return [l, t];
  }
  throw new Error(n);
}
function Se() {
  var e = c.useRef(!0);
  return c.useEffect(function() {
    return e.current = !1, function() {
      e.current = !0;
    };
  }, []), e.current;
}
function Tt(e, t) {
  return t.changes;
}
var Vt = {
  environment: d.shape({
    addEventListener: d.func.isRequired,
    removeEventListener: d.func.isRequired,
    document: d.shape({
      createElement: d.func.isRequired,
      getElementById: d.func.isRequired,
      activeElement: d.any.isRequired,
      body: d.any.isRequired
    }).isRequired,
    Node: d.func.isRequired
  }),
  itemToKey: d.func,
  stateReducer: d.func
};
function U(e, t, i) {
  var n = e["default" + Ve(t)];
  return n !== void 0 ? n : i[t];
}
function ae(e, t, i) {
  var n = e[t];
  if (n !== void 0)
    return n;
  var r = e["initial" + Ve(t)];
  return r !== void 0 ? r : U(e, t, i);
}
var Je = et(function(e, t) {
  xt(e, t);
}, 200);
function St(e, t, i, n) {
  var r = n?.document, l = Se();
  c.useEffect(function() {
    if (!(!e || l || !r)) {
      var u = e(t);
      Je(u, r);
    }
  }, i), c.useEffect(function() {
    return function() {
      Je.cancel(), wt(r);
    };
  }, [r]);
}
var oe = m({}, Vt, {
  getA11yStatusMessage: d.func,
  highlightedIndex: d.number,
  defaultHighlightedIndex: d.number,
  initialHighlightedIndex: d.number,
  isOpen: d.bool,
  defaultIsOpen: d.bool,
  initialIsOpen: d.bool,
  selectedItem: d.any,
  initialSelectedItem: d.any,
  defaultSelectedItem: d.any,
  id: d.string,
  labelId: d.string,
  menuId: d.string,
  getItemId: d.func,
  toggleButtonId: d.string,
  onSelectedItemChange: d.func,
  onHighlightedIndexChange: d.func,
  onStateChange: d.func,
  onIsOpenChange: d.func,
  scrollIntoView: d.func
}), de = {
  itemToString: function(t) {
    return t ? String(t) : "";
  },
  itemToKey: function(t) {
    return t;
  },
  stateReducer: Tt,
  scrollIntoView: Ct,
  environment: (
    /* istanbul ignore next (ssr) */
    typeof window > "u" ? void 0 : window
  )
}, T = {
  highlightedIndex: -1,
  isOpen: !1,
  selectedItem: null,
  inputValue: ""
}, Kt = typeof window < "u" && typeof window.document < "u" && typeof window.document.createElement < "u" ? c.useLayoutEffect : c.useEffect;
function Ht(e) {
  var t = ae(e, "selectedItem", T), i = ae(e, "isOpen", T), n = Pt(e), r = ae(e, "inputValue", T);
  return {
    highlightedIndex: n < 0 && t && i ? e.items.findIndex(function(l) {
      return e.itemToKey(l) === e.itemToKey(t);
    }) : n,
    isOpen: i,
    selectedItem: t,
    inputValue: r
  };
}
function se(e, t, i) {
  var n = e.items, r = e.initialHighlightedIndex, l = e.defaultHighlightedIndex, u = e.isItemDisabled, o = e.itemToKey, a = t.selectedItem, v = t.highlightedIndex;
  return n.length === 0 ? -1 : r !== void 0 && v === r && !u(n[r], r) ? r : l !== void 0 && !u(n[l], l) ? l : a ? n.findIndex(function(x) {
    return o(a) === o(x);
  }) : i < 0 && !u(n[n.length - 1], n.length - 1) ? n.length - 1 : i > 0 && !u(n[0], 0) ? 0 : -1;
}
function Bt(e, t, i) {
  var n = c.useRef({
    isMouseDown: !1,
    isTouchMove: !1,
    isTouchEnd: !1
  }), r = c.useCallback(function() {
    return i.map(function(l) {
      return l.current;
    });
  }, [i]);
  return c.useEffect(function() {
    if (!e)
      return nt;
    function l() {
      n.current.isTouchEnd = !1, n.current.isMouseDown = !0;
    }
    function u(x) {
      n.current.isMouseDown = !1, Ye(x.target, r(), e) || t();
    }
    function o() {
      n.current.isTouchEnd = !1, n.current.isTouchMove = !1;
    }
    function a() {
      n.current.isTouchMove = !0;
    }
    function v(x) {
      n.current.isTouchEnd = !0, !n.current.isTouchMove && !Ye(x.target, r(), e, !1) && t();
    }
    return e.addEventListener("mousedown", l), e.addEventListener("mouseup", u), e.addEventListener("touchstart", o), e.addEventListener("touchmove", a), e.addEventListener("touchend", v), function() {
      e.removeEventListener("mousedown", l), e.removeEventListener("mouseup", u), e.removeEventListener("touchstart", o), e.removeEventListener("touchmove", a), e.removeEventListener("touchend", v);
    };
  }, [e, r, t]), n.current;
}
var Lt = function() {
  return nt;
};
function $t(e) {
  var t = e.highlightedIndex, i = e.isOpen, n = e.itemRefs, r = e.getItemNodeFromIndex, l = e.menuElement, u = e.scrollIntoView, o = c.useRef(!0);
  return Kt(function() {
    t < 0 || !i || !Object.keys(n.current).length || (o.current === !1 ? o.current = !0 : u(r(t), l));
  }, [t]), o;
}
function Qe(e, t, i) {
  var n;
  i === void 0 && (i = !0);
  var r = ((n = e.items) == null ? void 0 : n.length) && t >= 0;
  return m({
    isOpen: !1,
    highlightedIndex: -1
  }, r && m({
    selectedItem: e.items[t],
    isOpen: U(e, "isOpen", T),
    highlightedIndex: U(e, "highlightedIndex", T)
  }, i && {
    inputValue: e.itemToString(e.items[t])
  }));
}
function At(e, t) {
  return e.isOpen === t.isOpen && e.inputValue === t.inputValue && e.highlightedIndex === t.highlightedIndex && e.selectedItem === t.selectedItem;
}
function Te(e) {
  var t = U(e, "highlightedIndex", T);
  return t > -1 && e.isItemDisabled(e.items[t], t) ? -1 : t;
}
function Pt(e) {
  var t = ae(e, "highlightedIndex", T);
  return t > -1 && e.isItemDisabled(e.items[t], t) ? -1 : t;
}
function Ft(e, t, i, n) {
  var r = i.type, l;
  switch (r) {
    case n.ItemMouseMove:
      l = {
        highlightedIndex: i.disabled ? -1 : i.index
      };
      break;
    case n.MenuMouseLeave:
      l = {
        highlightedIndex: -1
      };
      break;
    case n.ToggleButtonClick:
    case n.FunctionToggleMenu:
      l = {
        isOpen: !e.isOpen,
        highlightedIndex: e.isOpen ? -1 : se(t, e, 0)
      };
      break;
    case n.FunctionOpenMenu:
      l = {
        isOpen: !0,
        highlightedIndex: se(t, e, 0)
      };
      break;
    case n.FunctionCloseMenu:
      l = {
        isOpen: !1
      };
      break;
    case n.FunctionSetHighlightedIndex:
      l = {
        highlightedIndex: t.isItemDisabled(t.items[i.highlightedIndex], i.highlightedIndex) ? -1 : i.highlightedIndex
      };
      break;
    case n.FunctionSetInputValue:
      l = {
        inputValue: i.inputValue
      };
      break;
    case n.FunctionReset:
      l = {
        highlightedIndex: Te(t),
        isOpen: U(t, "isOpen", T),
        selectedItem: U(t, "selectedItem", T),
        inputValue: U(t, "inputValue", T)
      };
      break;
    default:
      throw new Error("Reducer called without proper action type.");
  }
  return m({}, e, l);
}
m({}, oe, {
  items: d.array.isRequired,
  isItemDisabled: d.func
});
m({}, de, {
  isItemDisabled: function() {
    return !1;
  }
});
var Wt = m({}, Ze), it = Wt.useId, qt = typeof it == "function" ? Ut : jt;
function Ut(e) {
  var t = e.id, i = e.labelId, n = e.menuId, r = e.getItemId, l = e.toggleButtonId, u = e.inputId, o = "downshift-" + it();
  t || (t = o);
  var a = c.useMemo(function() {
    return {
      labelId: i ?? t + "-label",
      menuId: n ?? t + "-menu",
      getItemId: r ?? function(v) {
        return t + "-item-" + v;
      },
      toggleButtonId: l ?? t + "-toggle-button",
      inputId: u ?? t + "-input"
    };
  }, [r, t, u, i, n, l]);
  return a;
}
function jt(e) {
  var t = e.id, i = e.labelId, n = e.menuId, r = e.getItemId, l = e.toggleButtonId, u = e.inputId, o = c.useRef(t ?? "downshift-" + pt()), a = o.current, v = c.useMemo(function() {
    return {
      labelId: i ?? a + "-label",
      menuId: n ?? a + "-menu",
      getItemId: r ?? function(x) {
        return a + "-item-" + x;
      },
      toggleButtonId: l ?? a + "-toggle-button",
      inputId: u ?? a + "-input"
    };
  }, [r, u, i, n, l, a]);
  return v;
}
var Ke = 0, He = 1, Be = 2, Le = 3, $e = 4, Ae = 5, Pe = 6, Fe = 7, We = 8, De = 9, qe = 10, rt = 11, ut = 12, Ue = 13, lt = 14, at = 15, ot = 16, dt = 17, st = 18, je = 19, ct = 20, ft = 21, Ne = 22, ht = /* @__PURE__ */ Object.freeze({
  __proto__: null,
  ControlledPropUpdatedSelectedItem: Ne,
  FunctionCloseMenu: dt,
  FunctionOpenMenu: ot,
  FunctionReset: ft,
  FunctionSelectItem: je,
  FunctionSetHighlightedIndex: st,
  FunctionSetInputValue: ct,
  FunctionToggleMenu: at,
  InputBlur: De,
  InputChange: We,
  InputClick: qe,
  InputKeyDownArrowDown: Ke,
  InputKeyDownArrowUp: He,
  InputKeyDownEnd: $e,
  InputKeyDownEnter: Fe,
  InputKeyDownEscape: Be,
  InputKeyDownHome: Le,
  InputKeyDownPageDown: Pe,
  InputKeyDownPageUp: Ae,
  ItemClick: Ue,
  ItemMouseMove: ut,
  MenuMouseLeave: rt,
  ToggleButtonClick: lt
});
function Nt(e) {
  var t = Ht(e), i = t.selectedItem, n = t.inputValue;
  return n === "" && i && e.defaultInputValue === void 0 && e.initialInputValue === void 0 && e.inputValue === void 0 && (n = e.itemToString(i)), m({}, t, {
    inputValue: n
  });
}
m({}, oe, {
  items: d.array.isRequired,
  isItemDisabled: d.func,
  inputValue: d.string,
  defaultInputValue: d.string,
  initialInputValue: d.string,
  inputId: d.string,
  onInputValueChange: d.func
});
function zt(e, t, i, n) {
  var r = c.useRef(), l = Ot(e, t, i, n), u = l[0], o = l[1], a = Se();
  return c.useEffect(function() {
    if (Dt(t, "selectedItem")) {
      if (!a) {
        var v = t.itemToKey(t.selectedItem) !== t.itemToKey(r.current);
        v && o({
          type: Ne,
          inputValue: t.itemToString(t.selectedItem)
        });
      }
      r.current = u.selectedItem === r.current ? t.selectedItem : u.selectedItem;
    }
  }, [u.selectedItem, t.selectedItem]), [ke(u, t), o];
}
var Gt = m({}, de, {
  isItemDisabled: function() {
    return !1;
  }
});
function Xt(e, t, i) {
  var n, r = i.type, l = i.altKey, u;
  switch (r) {
    case Ue:
      u = {
        isOpen: U(t, "isOpen", T),
        highlightedIndex: Te(t),
        selectedItem: t.items[i.index],
        inputValue: t.itemToString(t.items[i.index])
      };
      break;
    case Ke:
      e.isOpen ? u = {
        highlightedIndex: we(e.highlightedIndex, 1, t.items, t.isItemDisabled, !0)
      } : u = {
        highlightedIndex: l && e.selectedItem == null ? -1 : se(t, e, 1),
        isOpen: t.items.length >= 0
      };
      break;
    case He:
      e.isOpen ? l ? u = Qe(t, e.highlightedIndex) : u = {
        highlightedIndex: we(e.highlightedIndex, -1, t.items, t.isItemDisabled, !0)
      } : u = {
        highlightedIndex: se(t, e, -1),
        isOpen: t.items.length >= 0
      };
      break;
    case Fe:
      u = Qe(t, e.highlightedIndex);
      break;
    case Be:
      u = m({
        isOpen: !1,
        highlightedIndex: -1
      }, !e.isOpen && {
        selectedItem: null,
        inputValue: ""
      });
      break;
    case Ae:
      u = {
        highlightedIndex: we(e.highlightedIndex, -10, t.items, t.isItemDisabled, !0)
      };
      break;
    case Pe:
      u = {
        highlightedIndex: we(e.highlightedIndex, 10, t.items, t.isItemDisabled, !0)
      };
      break;
    case Le:
      u = {
        highlightedIndex: Ce(0, !1, t.items, t.isItemDisabled)
      };
      break;
    case $e:
      u = {
        highlightedIndex: Ce(t.items.length - 1, !0, t.items, t.isItemDisabled)
      };
      break;
    case De:
      u = m({
        isOpen: !1,
        highlightedIndex: -1
      }, e.highlightedIndex >= 0 && ((n = t.items) == null ? void 0 : n.length) && i.selectItem && {
        selectedItem: t.items[e.highlightedIndex],
        inputValue: t.itemToString(t.items[e.highlightedIndex])
      });
      break;
    case We:
      u = {
        isOpen: !0,
        highlightedIndex: Te(t),
        inputValue: i.inputValue
      };
      break;
    case qe:
      u = {
        isOpen: !e.isOpen,
        highlightedIndex: e.isOpen ? -1 : se(t, e, 0)
      };
      break;
    case je:
      u = {
        selectedItem: i.selectedItem,
        inputValue: t.itemToString(i.selectedItem)
      };
      break;
    case Ne:
      u = {
        inputValue: i.inputValue
      };
      break;
    default:
      return Ft(e, t, i, ht);
  }
  return m({}, e, u);
}
var Yt = ["onMouseLeave", "refKey", "ref"], Jt = ["item", "index", "refKey", "ref", "onMouseMove", "onMouseDown", "onClick", "onPress", "disabled"], Qt = ["onClick", "onPress", "refKey", "ref"], Zt = ["onKeyDown", "onChange", "onInput", "onBlur", "onChangeText", "onClick", "refKey", "ref"];
_t.stateChangeTypes = ht;
function _t(e) {
  e === void 0 && (e = {});
  var t = m({}, Gt, e), i = t.items, n = t.scrollIntoView, r = t.environment, l = t.getA11yStatusMessage, u = zt(Xt, t, Nt, At), o = u[0], a = u[1], v = o.isOpen, x = o.highlightedIndex, V = o.selectedItem, p = o.inputValue, w = c.useRef(null), R = c.useRef({}), C = c.useRef(null), A = c.useRef(null), X = Se(), b = qt(t), te = c.useRef(), y = _e({
    state: o,
    props: t
  }), ce = c.useCallback(function(h) {
    return R.current[b.getItemId(h)];
  }, [b]);
  St(l, o, [v, x, V, p], r);
  var j = $t({
    menuElement: w.current,
    highlightedIndex: x,
    isOpen: v,
    itemRefs: R,
    scrollIntoView: n,
    getItemNodeFromIndex: ce
  });
  c.useEffect(function() {
    var h = ae(t, "isOpen", T);
    h && C.current && C.current.focus();
  }, []), c.useEffect(function() {
    X || (te.current = i.length);
  });
  var Ee = c.useCallback(function() {
    y.current.state.isOpen && a({
      type: De
    });
  }, [a, y]), fe = c.useMemo(function() {
    return [w, A, C];
  }, []), N = Bt(r, Ee, fe), P = Lt();
  c.useEffect(function() {
    v || (R.current = {});
  }, [v]), c.useEffect(function() {
    var h;
    !v || !(r != null && r.document) || !(C != null && (h = C.current) != null && h.focus) || r.document.activeElement !== C.current && C.current.focus();
  }, [v, r]);
  var D = c.useMemo(function() {
    return {
      ArrowDown: function(f) {
        f.preventDefault(), a({
          type: Ke,
          altKey: f.altKey
        });
      },
      ArrowUp: function(f) {
        f.preventDefault(), a({
          type: He,
          altKey: f.altKey
        });
      },
      Home: function(f) {
        y.current.state.isOpen && (f.preventDefault(), a({
          type: Le
        }));
      },
      End: function(f) {
        y.current.state.isOpen && (f.preventDefault(), a({
          type: $e
        }));
      },
      Escape: function(f) {
        var s = y.current.state;
        (s.isOpen || s.inputValue || s.selectedItem || s.highlightedIndex > -1) && (f.preventDefault(), a({
          type: Be
        }));
      },
      Enter: function(f) {
        var s = y.current.state;
        !s.isOpen || f.which === 229 || (f.preventDefault(), a({
          type: Fe
        }));
      },
      PageUp: function(f) {
        y.current.state.isOpen && (f.preventDefault(), a({
          type: Ae
        }));
      },
      PageDown: function(f) {
        y.current.state.isOpen && (f.preventDefault(), a({
          type: Pe
        }));
      }
    };
  }, [a, y]), ne = c.useCallback(function(h) {
    return m({
      id: b.labelId,
      htmlFor: b.inputId
    }, h);
  }, [b]), H = c.useCallback(function(h, f) {
    var s, g = h === void 0 ? {} : h, E = g.onMouseLeave, S = g.refKey, M = S === void 0 ? "ref" : S, O = g.ref, k = be(g, Yt), K = f === void 0 ? {} : f;
    return K.suppressRefError, m((s = {}, s[M] = xe(O, function(F) {
      w.current = F;
    }), s.id = b.menuId, s.role = "listbox", s["aria-labelledby"] = k && k["aria-label"] ? void 0 : "" + b.labelId, s.onMouseLeave = $(E, function() {
      a({
        type: rt
      });
    }), s), k);
  }, [a, P, b]), I = c.useCallback(function(h) {
    var f, s, g = h === void 0 ? {} : h, E = g.item, S = g.index, M = g.refKey, O = M === void 0 ? "ref" : M, k = g.ref, K = g.onMouseMove, F = g.onMouseDown, Re = g.onClick;
    g.onPress;
    var _ = g.disabled, Me = be(g, Jt);
    _ !== void 0 && console.warn('Passing "disabled" as an argument to getItemProps is not supported anymore. Please use the isItemDisabled prop from useCombobox.');
    var B = y.current, ve = B.props, Ie = B.state, me = kt(E, S, ve.items, "Pass either item or index to getItemProps!"), Oe = me[0], L = me[1], ee = ve.isItemDisabled(Oe, L), W = "onClick", z = Re, q = function() {
      N.isTouchEnd || L === Ie.highlightedIndex || (j.current = !1, a({
        type: ut,
        index: L,
        disabled: ee
      }));
    }, G = function() {
      a({
        type: Ue,
        index: L
      });
    }, gt = function(vt) {
      return vt.preventDefault();
    };
    return m((f = {}, f[O] = xe(k, function(le) {
      le && (R.current[b.getItemId(L)] = le);
    }), f["aria-disabled"] = ee, f["aria-selected"] = L === Ie.highlightedIndex, f.id = b.getItemId(L), f.role = "option", f), !ee && (s = {}, s[W] = $(z, G), s), {
      onMouseMove: $(K, q),
      onMouseDown: $(F, gt)
    }, Me);
  }, [a, b, y, N, j]), ie = c.useCallback(function(h) {
    var f, s = h === void 0 ? {} : h, g = s.onClick;
    s.onPress;
    var E = s.refKey, S = E === void 0 ? "ref" : E, M = s.ref, O = be(s, Qt), k = y.current.state, K = function() {
      a({
        type: lt
      });
    };
    return m((f = {}, f[S] = xe(M, function(F) {
      A.current = F;
    }), f["aria-controls"] = b.menuId, f["aria-expanded"] = k.isOpen, f.id = b.toggleButtonId, f.tabIndex = -1, f), !O.disabled && m({}, {
      onClick: $(g, K)
    }), O);
  }, [a, y, b]), Y = c.useCallback(function(h, f) {
    var s, g = h === void 0 ? {} : h, E = g.onKeyDown, S = g.onChange, M = g.onInput, O = g.onBlur;
    g.onChangeText;
    var k = g.onClick, K = g.refKey, F = K === void 0 ? "ref" : K, Re = g.ref, _ = be(g, Zt), Me = f === void 0 ? {} : f;
    Me.suppressRefError;
    var B = y.current.state, ve = function(q) {
      var G = Et(q);
      G && D[G] && D[G](q);
    }, Ie = function(q) {
      a({
        type: We,
        inputValue: q.target.value
      });
    }, me = function(q) {
      if (r != null && r.document && B.isOpen && !N.isMouseDown) {
        var G = q.relatedTarget === null && r.document.activeElement !== r.document.body;
        a({
          type: De,
          selectItem: !G
        });
      }
    }, Oe = function() {
      a({
        type: qe
      });
    }, L = "onChange", ee = {};
    if (!_.disabled) {
      var W;
      ee = (W = {}, W[L] = $(S, M, Ie), W.onKeyDown = $(E, ve), W.onBlur = $(O, me), W.onClick = $(k, Oe), W);
    }
    return m((s = {}, s[F] = xe(Re, function(z) {
      C.current = z;
    }), s["aria-activedescendant"] = B.isOpen && B.highlightedIndex > -1 ? b.getItemId(B.highlightedIndex) : "", s["aria-autocomplete"] = "list", s["aria-controls"] = b.menuId, s["aria-expanded"] = B.isOpen, s["aria-labelledby"] = _ && _["aria-label"] ? void 0 : b.labelId, s.autoComplete = "off", s.id = b.inputId, s.role = "combobox", s.value = B.inputValue, s), ee, _);
  }, [a, b, r, D, y, N, P]), he = c.useCallback(function() {
    a({
      type: at
    });
  }, [a]), re = c.useCallback(function() {
    a({
      type: dt
    });
  }, [a]), ge = c.useCallback(function() {
    a({
      type: ot
    });
  }, [a]), J = c.useCallback(function(h) {
    a({
      type: st,
      highlightedIndex: h
    });
  }, [a]), Q = c.useCallback(function(h) {
    a({
      type: je,
      selectedItem: h
    });
  }, [a]), Z = c.useCallback(function(h) {
    a({
      type: ct,
      inputValue: h
    });
  }, [a]), ue = c.useCallback(function() {
    a({
      type: ft
    });
  }, [a]);
  return {
    // prop getters.
    getItemProps: I,
    getLabelProps: ne,
    getMenuProps: H,
    getInputProps: Y,
    getToggleButtonProps: ie,
    // actions.
    toggleMenu: he,
    openMenu: ge,
    closeMenu: re,
    setHighlightedIndex: J,
    setInputValue: Z,
    selectItem: Q,
    reset: ue,
    // state.
    highlightedIndex: x,
    isOpen: v,
    selectedItem: V,
    inputValue: p
  };
}
oe.stateReducer, oe.itemToKey, oe.environment, d.array, d.array, d.array, d.func, d.number, d.number, d.number, d.func, d.func, d.string, d.string;
de.itemToKey, de.stateReducer, de.environment;
var en = m({}, Ze);
en.useId;
d.func;
export {
  _t as u
};
