welcome-ui
Version:
Customizable design system with react • styled-components • styled-system and ariakit.
1,083 lines (1,082 loc) • 45.3 kB
JavaScript
"use client";
import { P as o } from "./index-DgSynio4.mjs";
import { cloneElement as et, Component as tt } from "react";
function Z(t, n) {
if (t == null) return {};
var r = {};
for (var s in t) if ({}.hasOwnProperty.call(t, s)) {
if (n.indexOf(s) !== -1) continue;
r[s] = t[s];
}
return r;
}
function M() {
return M = Object.assign ? Object.assign.bind() : function(t) {
for (var n = 1; n < arguments.length; n++) {
var r = arguments[n];
for (var s in r) ({}).hasOwnProperty.call(r, s) && (t[s] = r[s]);
}
return t;
}, M.apply(null, arguments);
}
function me(t) {
if (t === void 0) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
return t;
}
function fe(t, n) {
return fe = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(r, s) {
return r.__proto__ = s, r;
}, fe(t, n);
}
function nt(t, n) {
t.prototype = Object.create(n.prototype), t.prototype.constructor = t, fe(t, n);
}
var ie = { exports: {} }, O = {}, Ee;
function ot() {
if (Ee) return O;
Ee = 1;
var t = 60103, n = 60106, r = 60107, s = 60108, l = 60114, e = 60109, d = 60110, v = 60112, y = 60113, C = 60120, S = 60115, N = 60116, V = 60121, P = 60122, b = 60117, H = 60129, T = 60131;
if (typeof Symbol == "function" && Symbol.for) {
var f = Symbol.for;
t = f("react.element"), n = f("react.portal"), r = f("react.fragment"), s = f("react.strict_mode"), l = f("react.profiler"), e = f("react.provider"), d = f("react.context"), v = f("react.forward_ref"), y = f("react.suspense"), C = f("react.suspense_list"), S = f("react.memo"), N = f("react.lazy"), V = f("react.block"), P = f("react.server.block"), b = f("react.fundamental"), H = f("react.debug_trace_mode"), T = f("react.legacy_hidden");
}
function i(a) {
if (typeof a == "object" && a !== null) {
var R = a.$$typeof;
switch (R) {
case t:
switch (a = a.type, a) {
case r:
case l:
case s:
case y:
case C:
return a;
default:
switch (a = a && a.$$typeof, a) {
case d:
case v:
case N:
case S:
case e:
return a;
default:
return R;
}
}
case n:
return R;
}
}
}
var c = e, u = t, _ = v, m = r, E = N, g = S, h = n, I = l, w = s, x = y;
return O.ContextConsumer = d, O.ContextProvider = c, O.Element = u, O.ForwardRef = _, O.Fragment = m, O.Lazy = E, O.Memo = g, O.Portal = h, O.Profiler = I, O.StrictMode = w, O.Suspense = x, O.isAsyncMode = function() {
return !1;
}, O.isConcurrentMode = function() {
return !1;
}, O.isContextConsumer = function(a) {
return i(a) === d;
}, O.isContextProvider = function(a) {
return i(a) === e;
}, O.isElement = function(a) {
return typeof a == "object" && a !== null && a.$$typeof === t;
}, O.isForwardRef = function(a) {
return i(a) === v;
}, O.isFragment = function(a) {
return i(a) === r;
}, O.isLazy = function(a) {
return i(a) === N;
}, O.isMemo = function(a) {
return i(a) === S;
}, O.isPortal = function(a) {
return i(a) === n;
}, O.isProfiler = function(a) {
return i(a) === l;
}, O.isStrictMode = function(a) {
return i(a) === s;
}, O.isSuspense = function(a) {
return i(a) === y;
}, O.isValidElementType = function(a) {
return typeof a == "string" || typeof a == "function" || a === r || a === l || a === H || a === s || a === y || a === C || a === T || typeof a == "object" && a !== null && (a.$$typeof === N || a.$$typeof === S || a.$$typeof === e || a.$$typeof === d || a.$$typeof === v || a.$$typeof === b || a.$$typeof === V || a[0] === P);
}, O.typeOf = i, O;
}
var D = {}, Ie;
function rt() {
return Ie || (Ie = 1, process.env.NODE_ENV !== "production" && function() {
var t = 60103, n = 60106, r = 60107, s = 60108, l = 60114, e = 60109, d = 60110, v = 60112, y = 60113, C = 60120, S = 60115, N = 60116, V = 60121, P = 60122, b = 60117, H = 60129, T = 60131;
if (typeof Symbol == "function" && Symbol.for) {
var f = Symbol.for;
t = f("react.element"), n = f("react.portal"), r = f("react.fragment"), s = f("react.strict_mode"), l = f("react.profiler"), e = f("react.provider"), d = f("react.context"), v = f("react.forward_ref"), y = f("react.suspense"), C = f("react.suspense_list"), S = f("react.memo"), N = f("react.lazy"), V = f("react.block"), P = f("react.server.block"), b = f("react.fundamental"), f("react.scope"), f("react.opaque.id"), H = f("react.debug_trace_mode"), f("react.offscreen"), T = f("react.legacy_hidden");
}
var i = !1;
function c(p) {
return !!(typeof p == "string" || typeof p == "function" || p === r || p === l || p === H || p === s || p === y || p === C || p === T || i || typeof p == "object" && p !== null && (p.$$typeof === N || p.$$typeof === S || p.$$typeof === e || p.$$typeof === d || p.$$typeof === v || p.$$typeof === b || p.$$typeof === V || p[0] === P));
}
function u(p) {
if (typeof p == "object" && p !== null) {
var F = p.$$typeof;
switch (F) {
case t:
var re = p.type;
switch (re) {
case r:
case l:
case s:
case y:
case C:
return re;
default:
var ve = re && re.$$typeof;
switch (ve) {
case d:
case v:
case N:
case S:
case e:
return ve;
default:
return F;
}
}
case n:
return F;
}
}
}
var _ = d, m = e, E = t, g = v, h = r, I = N, w = S, x = n, a = l, R = s, A = y, B = !1, Y = !1;
function ee(p) {
return B || (B = !0, console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 18+.")), !1;
}
function W(p) {
return Y || (Y = !0, console.warn("The ReactIs.isConcurrentMode() alias has been deprecated, and will be removed in React 18+.")), !1;
}
function U(p) {
return u(p) === d;
}
function j(p) {
return u(p) === e;
}
function G(p) {
return typeof p == "object" && p !== null && p.$$typeof === t;
}
function q(p) {
return u(p) === v;
}
function X(p) {
return u(p) === r;
}
function k(p) {
return u(p) === N;
}
function $(p) {
return u(p) === S;
}
function z(p) {
return u(p) === n;
}
function te(p) {
return u(p) === l;
}
function ne(p) {
return u(p) === s;
}
function oe(p) {
return u(p) === y;
}
D.ContextConsumer = _, D.ContextProvider = m, D.Element = E, D.ForwardRef = g, D.Fragment = h, D.Lazy = I, D.Memo = w, D.Portal = x, D.Profiler = a, D.StrictMode = R, D.Suspense = A, D.isAsyncMode = ee, D.isConcurrentMode = W, D.isContextConsumer = U, D.isContextProvider = j, D.isElement = G, D.isForwardRef = q, D.isFragment = X, D.isLazy = k, D.isMemo = $, D.isPortal = z, D.isProfiler = te, D.isStrictMode = ne, D.isSuspense = oe, D.isValidElementType = c, D.typeOf = u;
}()), D;
}
var ye;
function it() {
return ye || (ye = 1, process.env.NODE_ENV === "production" ? ie.exports = ot() : ie.exports = rt()), ie.exports;
}
var we = it();
let Ne = (t) => typeof t == "object" && t != null && t.nodeType === 1, Oe = (t, n) => (!n || t !== "hidden") && t !== "visible" && t !== "clip", de = (t, n) => {
if (t.clientHeight < t.scrollHeight || t.clientWidth < t.scrollWidth) {
let r = getComputedStyle(t, null);
return Oe(r.overflowY, n) || Oe(r.overflowX, n) || ((s) => {
let l = ((e) => {
if (!e.ownerDocument || !e.ownerDocument.defaultView) return null;
try {
return e.ownerDocument.defaultView.frameElement;
} catch {
return null;
}
})(s);
return !!l && (l.clientHeight < s.scrollHeight || l.clientWidth < s.scrollWidth);
})(t);
}
return !1;
}, se = (t, n, r, s, l, e, d, v) => e < t && d > n || e > t && d < n ? 0 : e <= t && v <= r || d >= n && v >= r ? e - t - s : d > n && v < r || e < t && v > r ? d - n + l : 0, st = (t) => {
let n = t.parentElement;
return n ?? (t.getRootNode().host || null);
};
var ut = (t, n) => {
var r, s, l, e, d, v;
if (typeof document > "u") return [];
let { inline: y, boundary: C, skipOverflowHiddenElements: S } = n, N = typeof C == "function" ? C : (x) => x !== C;
if (!Ne(t)) throw new TypeError("Invalid target");
let V = document.scrollingElement || document.documentElement, P = [], b = t;
for (; Ne(b) && N(b); ) {
if (b = st(b), b === V) {
P.push(b);
break;
}
b != null && b === document.body && de(b) && !de(document.documentElement) || b != null && de(b, S) && P.push(b);
}
let H = (s = (r = window.visualViewport) == null ? void 0 : r.width) != null ? s : innerWidth, T = (e = (l = window.visualViewport) == null ? void 0 : l.height) != null ? e : innerHeight, f = (d = window.scrollX) != null ? d : pageXOffset, i = (v = window.scrollY) != null ? v : pageYOffset, { height: c, width: u, top: _, right: m, bottom: E, left: g } = t.getBoundingClientRect(), h = _, I = y === "center" ? g + u / 2 : y === "end" ? m : g, w = [];
for (let x = 0; x < P.length; x++) {
let a = P[x], { height: R, width: A, top: B, right: Y, bottom: ee, left: W } = a.getBoundingClientRect();
if (_ >= 0 && g >= 0 && E <= T && m <= H && _ >= B && E <= ee && g >= W && m <= Y) return w;
let U = getComputedStyle(a), j = parseInt(U.borderLeftWidth, 10), G = parseInt(U.borderTopWidth, 10), q = parseInt(U.borderRightWidth, 10), X = parseInt(U.borderBottomWidth, 10), k = 0, $ = 0, z = "offsetWidth" in a ? a.offsetWidth - a.clientWidth - j - q : 0, te = "offsetHeight" in a ? a.offsetHeight - a.clientHeight - G - X : 0, ne = "offsetWidth" in a ? a.offsetWidth === 0 ? 0 : A / a.offsetWidth : 0, oe = "offsetHeight" in a ? a.offsetHeight === 0 ? 0 : R / a.offsetHeight : 0;
if (V === a) k = se(i, i + T, T, G, X, i + h, i + h + c, c), $ = y === "start" ? I : y === "center" ? I - H / 2 : y === "end" ? I - H : se(f, f + H, H, j, q, f + I, f + I + u, u), k = Math.max(0, k + i), $ = Math.max(0, $ + f);
else {
k = se(B, ee, R, G, X + te, h, h + c, c), $ = y === "start" ? I - W - j : y === "center" ? I - (W + A / 2) + z / 2 : y === "end" ? I - Y + q + z : se(W, Y, A, j, q + z, I, I + u, u);
let { scrollLeft: p, scrollTop: F } = a;
k = Math.max(0, Math.min(F + k / oe, a.scrollHeight - R / oe + te)), $ = Math.max(0, Math.min(p + $ / ne, a.scrollWidth - A / ne + z)), h += F - k, I += p - $;
}
w.push({ el: a, top: k, left: $ });
}
return w;
}, le = function() {
return le = Object.assign || function(n) {
for (var r, s = 1, l = arguments.length; s < l; s++) {
r = arguments[s];
for (var e in r) Object.prototype.hasOwnProperty.call(r, e) && (n[e] = r[e]);
}
return n;
}, le.apply(this, arguments);
}, at = 0;
function De(t) {
return typeof t == "function" ? t : L;
}
function L() {
}
function Pe(t, n) {
if (t) {
var r = ut(t, {
boundary: n
});
r.forEach(function(s) {
var l = s.el, e = s.top, d = s.left;
l.scrollTop = e, l.scrollLeft = d;
});
}
}
function be(t, n, r) {
var s = t === n || n instanceof r.Node && t.contains && t.contains(n);
return s;
}
function he(t, n) {
var r;
function s() {
r && clearTimeout(r);
}
function l() {
for (var e = arguments.length, d = new Array(e), v = 0; v < e; v++)
d[v] = arguments[v];
s(), r = setTimeout(function() {
r = null, t.apply(void 0, d);
}, n);
}
return l.cancel = s, l;
}
function K() {
for (var t = arguments.length, n = new Array(t), r = 0; r < t; r++)
n[r] = arguments[r];
return function(s) {
for (var l = arguments.length, e = new Array(l > 1 ? l - 1 : 0), d = 1; d < l; d++)
e[d - 1] = arguments[d];
return n.some(function(v) {
return v && v.apply(void 0, [s].concat(e)), s.preventDownshiftDefault || s.hasOwnProperty("nativeEvent") && s.nativeEvent.preventDownshiftDefault;
});
};
}
function Se() {
for (var t = arguments.length, n = new Array(t), r = 0; r < t; r++)
n[r] = arguments[r];
return function(s) {
n.forEach(function(l) {
typeof l == "function" ? l(s) : l && (l.current = s);
});
};
}
function ct() {
return String(at++);
}
function Me(t) {
var n = t.isOpen, r = t.resultCount, s = t.previousResultCount;
return n ? r ? r !== s ? r + " result" + (r === 1 ? " is" : "s are") + " available, use up and down arrow keys to navigate. Press Enter key to select." : "" : "No results are available." : "";
}
function Ce(t, n) {
return t = Array.isArray(t) ? (
/* istanbul ignore next (preact) */
t[0]
) : t, !t && n ? n : t;
}
function He(t) {
return typeof t.type == "string";
}
function Ae(t) {
return t.props;
}
function lt(t, n) {
console.error('The property "' + n + '" is required in "' + t + '"');
}
var dt = ["highlightedIndex", "inputValue", "isOpen", "selectedItem", "type"];
function ue(t) {
t === void 0 && (t = {});
var n = {};
return dt.forEach(function(r) {
t.hasOwnProperty(r) && (n[r] = t[r]);
}), n;
}
function pt(t, n) {
return Object.keys(t).reduce(function(r, s) {
return r[s] = _e(n, s) ? n[s] : t[s], r;
}, {});
}
function _e(t, n) {
return t[n] !== void 0;
}
function Ve(t) {
var n = t.key, r = t.keyCode;
return r >= 37 && r <= 40 && n.indexOf("Arrow") !== 0 ? "Arrow" + n : n;
}
function ft(t) {
return Object.prototype.toString.call(t) === "[object Object]";
}
function pe(t, n, r, s, l) {
if (l === void 0 && (l = !0), r === 0)
return -1;
var e = r - 1;
(typeof n != "number" || n < 0 || n >= r) && (n = t > 0 ? -1 : e + 1);
var d = n + t;
d < 0 ? d = l ? e : 0 : d > e && (d = l ? 0 : e);
var v = Q(t, d, r, s, l);
return v === -1 ? n >= r ? -1 : n : v;
}
function Q(t, n, r, s, l) {
var e = s(n);
if (!e || !e.hasAttribute("disabled"))
return n;
if (t > 0) {
for (var d = n + 1; d < r; d++)
if (!s(d).hasAttribute("disabled"))
return d;
} else
for (var v = n - 1; v >= 0; v--)
if (!s(v).hasAttribute("disabled"))
return v;
return l ? t > 0 ? Q(1, 0, r, s, !1) : Q(-1, r - 1, r, s, !1) : -1;
}
function xe(t, n, r, s) {
return s === void 0 && (s = !0), n.some(function(l) {
return l && (be(l, t, r) || s && be(l, r.document.activeElement, r));
});
}
var Te = L;
process.env.NODE_ENV !== "production" && (Te = function(n, r, s) {
var l = "This prop should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled Downshift element for the lifetime of the component. More info: https://github.com/downshift-js/downshift#control-props";
Object.keys(n).forEach(function(e) {
r[e] !== void 0 && s[e] === void 0 ? console.error('downshift: A component has changed the controlled prop "' + e + '" to be uncontrolled. ' + l) : r[e] === void 0 && s[e] !== void 0 && console.error('downshift: A component has changed the uncontrolled prop "' + e + '" to be controlled. ' + l);
});
});
var _t = he(function(t) {
$e(t).textContent = "";
}, 500);
function ke(t, n) {
var r = $e(n);
t && (r.textContent = t, _t(n));
}
function $e(t) {
t === void 0 && (t = document);
var n = t.getElementById("a11y-status-message");
return n || (n = t.createElement("div"), n.setAttribute("id", "a11y-status-message"), n.setAttribute("role", "status"), n.setAttribute("aria-live", "polite"), n.setAttribute("aria-relevant", "additions text"), Object.assign(n.style, {
border: "0",
clip: "rect(0 0 0 0)",
height: "1px",
margin: "-1px",
overflow: "hidden",
padding: "0",
position: "absolute",
width: "1px"
}), t.body.appendChild(n), n);
}
var Ke = process.env.NODE_ENV !== "production" ? "__autocomplete_unknown__" : 0, Le = process.env.NODE_ENV !== "production" ? "__autocomplete_mouseup__" : 1, Be = process.env.NODE_ENV !== "production" ? "__autocomplete_item_mouseenter__" : 2, ae = process.env.NODE_ENV !== "production" ? "__autocomplete_keydown_arrow_up__" : 3, ce = process.env.NODE_ENV !== "production" ? "__autocomplete_keydown_arrow_down__" : 4, Ye = process.env.NODE_ENV !== "production" ? "__autocomplete_keydown_escape__" : 5, We = process.env.NODE_ENV !== "production" ? "__autocomplete_keydown_enter__" : 6, Ue = process.env.NODE_ENV !== "production" ? "__autocomplete_keydown_home__" : 7, je = process.env.NODE_ENV !== "production" ? "__autocomplete_keydown_end__" : 8, qe = process.env.NODE_ENV !== "production" ? "__autocomplete_click_item__" : 9, ze = process.env.NODE_ENV !== "production" ? "__autocomplete_blur_input__" : 10, Fe = process.env.NODE_ENV !== "production" ? "__autocomplete_change_input__" : 11, Ge = process.env.NODE_ENV !== "production" ? "__autocomplete_keydown_space_button__" : 12, ge = process.env.NODE_ENV !== "production" ? "__autocomplete_click_button__" : 13, Xe = process.env.NODE_ENV !== "production" ? "__autocomplete_blur_button__" : 14, Ze = process.env.NODE_ENV !== "production" ? "__autocomplete_controlled_prop_updated_selected_item__" : 15, Je = process.env.NODE_ENV !== "production" ? "__autocomplete_touchend__" : 16, gt = /* @__PURE__ */ Object.freeze({
__proto__: null,
unknown: Ke,
mouseUp: Le,
itemMouseEnter: Be,
keyDownArrowUp: ae,
keyDownArrowDown: ce,
keyDownEscape: Ye,
keyDownEnter: We,
keyDownHome: Ue,
keyDownEnd: je,
clickItem: qe,
blurInput: ze,
changeInput: Fe,
keyDownSpaceButton: Ge,
clickButton: ge,
blurButton: Xe,
controlledPropUpdatedSelectedItem: Ze,
touchEnd: Je
}), ht = ["refKey", "ref"], vt = ["onClick", "onPress", "onKeyDown", "onKeyUp", "onBlur"], mt = ["onKeyDown", "onBlur", "onChange", "onInput", "onChangeText"], Et = ["refKey", "ref"], It = ["onMouseMove", "onMouseDown", "onClick", "onPress", "index", "item"], Qe = /* @__PURE__ */ function() {
var t = /* @__PURE__ */ function(n) {
nt(r, n);
function r(l) {
var e;
e = n.call(this, l) || this, e.id = e.props.id || "downshift-" + ct(), e.menuId = e.props.menuId || e.id + "-menu", e.labelId = e.props.labelId || e.id + "-label", e.inputId = e.props.inputId || e.id + "-input", e.getItemId = e.props.getItemId || function(i) {
return e.id + "-item-" + i;
}, e.input = null, e.items = [], e.itemCount = null, e.previousResultCount = 0, e.timeoutIds = [], e.internalSetTimeout = function(i, c) {
var u = setTimeout(function() {
e.timeoutIds = e.timeoutIds.filter(function(_) {
return _ !== u;
}), i();
}, c);
e.timeoutIds.push(u);
}, e.setItemCount = function(i) {
e.itemCount = i;
}, e.unsetItemCount = function() {
e.itemCount = null;
}, e.setHighlightedIndex = function(i, c) {
i === void 0 && (i = e.props.defaultHighlightedIndex), c === void 0 && (c = {}), c = ue(c), e.internalSetState(M({
highlightedIndex: i
}, c));
}, e.clearSelection = function(i) {
e.internalSetState({
selectedItem: null,
inputValue: "",
highlightedIndex: e.props.defaultHighlightedIndex,
isOpen: e.props.defaultIsOpen
}, i);
}, e.selectItem = function(i, c, u) {
c = ue(c), e.internalSetState(M({
isOpen: e.props.defaultIsOpen,
highlightedIndex: e.props.defaultHighlightedIndex,
selectedItem: i,
inputValue: e.props.itemToString(i)
}, c), u);
}, e.selectItemAtIndex = function(i, c, u) {
var _ = e.items[i];
_ != null && e.selectItem(_, c, u);
}, e.selectHighlightedItem = function(i, c) {
return e.selectItemAtIndex(e.getState().highlightedIndex, i, c);
}, e.internalSetState = function(i, c) {
var u, _, m = {}, E = typeof i == "function";
return !E && i.hasOwnProperty("inputValue") && e.props.onInputValueChange(i.inputValue, M({}, e.getStateAndHelpers(), i)), e.setState(function(g) {
g = e.getState(g);
var h = E ? i(g) : i;
h = e.props.stateReducer(g, h), u = h.hasOwnProperty("selectedItem");
var I = {};
return u && h.selectedItem !== g.selectedItem && (_ = h.selectedItem), h.type = h.type || Ke, Object.keys(h).forEach(function(w) {
g[w] !== h[w] && (m[w] = h[w]), w !== "type" && (h[w], _e(e.props, w) || (I[w] = h[w]));
}), E && h.hasOwnProperty("inputValue") && e.props.onInputValueChange(h.inputValue, M({}, e.getStateAndHelpers(), h)), I;
}, function() {
De(c)();
var g = Object.keys(m).length > 1;
g && e.props.onStateChange(m, e.getStateAndHelpers()), u && e.props.onSelect(i.selectedItem, e.getStateAndHelpers()), _ !== void 0 && e.props.onChange(_, e.getStateAndHelpers()), e.props.onUserAction(m, e.getStateAndHelpers());
});
}, e.rootRef = function(i) {
return e._rootNode = i;
}, e.getRootProps = function(i, c) {
var u, _ = i === void 0 ? {} : i, m = _.refKey, E = m === void 0 ? "ref" : m, g = _.ref, h = Z(_, ht), I = c === void 0 ? {} : c, w = I.suppressRefError, x = w === void 0 ? !1 : w;
e.getRootProps.called = !0, e.getRootProps.refKey = E, e.getRootProps.suppressRefError = x;
var a = e.getState(), R = a.isOpen;
return M((u = {}, u[E] = Se(g, e.rootRef), u.role = "combobox", u["aria-expanded"] = R, u["aria-haspopup"] = "listbox", u["aria-owns"] = R ? e.menuId : null, u["aria-labelledby"] = e.labelId, u), h);
}, e.keyDownHandlers = {
ArrowDown: function(c) {
var u = this;
if (c.preventDefault(), this.getState().isOpen) {
var _ = c.shiftKey ? 5 : 1;
this.moveHighlightedIndex(_, {
type: ce
});
} else
this.internalSetState({
isOpen: !0,
type: ce
}, function() {
var m = u.getItemCount();
if (m > 0) {
var E = u.getState(), g = E.highlightedIndex, h = pe(1, g, m, function(I) {
return u.getItemNodeFromIndex(I);
});
u.setHighlightedIndex(h, {
type: ce
});
}
});
},
ArrowUp: function(c) {
var u = this;
if (c.preventDefault(), this.getState().isOpen) {
var _ = c.shiftKey ? -5 : -1;
this.moveHighlightedIndex(_, {
type: ae
});
} else
this.internalSetState({
isOpen: !0,
type: ae
}, function() {
var m = u.getItemCount();
if (m > 0) {
var E = u.getState(), g = E.highlightedIndex, h = pe(-1, g, m, function(I) {
return u.getItemNodeFromIndex(I);
});
u.setHighlightedIndex(h, {
type: ae
});
}
});
},
Enter: function(c) {
if (c.which !== 229) {
var u = this.getState(), _ = u.isOpen, m = u.highlightedIndex;
if (_ && m != null) {
c.preventDefault();
var E = this.items[m], g = this.getItemNodeFromIndex(m);
if (E == null || g && g.hasAttribute("disabled"))
return;
this.selectHighlightedItem({
type: We
});
}
}
},
Escape: function(c) {
c.preventDefault(), this.reset(M({
type: Ye
}, !this.state.isOpen && {
selectedItem: null,
inputValue: ""
}));
}
}, e.buttonKeyDownHandlers = M({}, e.keyDownHandlers, {
" ": function(c) {
c.preventDefault(), this.toggleMenu({
type: Ge
});
}
}), e.inputKeyDownHandlers = M({}, e.keyDownHandlers, {
Home: function(c) {
var u = this, _ = this.getState(), m = _.isOpen;
if (m) {
c.preventDefault();
var E = this.getItemCount();
if (!(E <= 0 || !m)) {
var g = Q(1, 0, E, function(h) {
return u.getItemNodeFromIndex(h);
}, !1);
this.setHighlightedIndex(g, {
type: Ue
});
}
}
},
End: function(c) {
var u = this, _ = this.getState(), m = _.isOpen;
if (m) {
c.preventDefault();
var E = this.getItemCount();
if (!(E <= 0 || !m)) {
var g = Q(-1, E - 1, E, function(h) {
return u.getItemNodeFromIndex(h);
}, !1);
this.setHighlightedIndex(g, {
type: je
});
}
}
}
}), e.getToggleButtonProps = function(i) {
var c = i === void 0 ? {} : i, u = c.onClick;
c.onPress;
var _ = c.onKeyDown, m = c.onKeyUp, E = c.onBlur, g = Z(c, vt), h = e.getState(), I = h.isOpen, w = {
onClick: K(u, e.buttonHandleClick),
onKeyDown: K(_, e.buttonHandleKeyDown),
onKeyUp: K(m, e.buttonHandleKeyUp),
onBlur: K(E, e.buttonHandleBlur)
}, x = g.disabled ? {} : w;
return M({
type: "button",
role: "button",
"aria-label": I ? "close menu" : "open menu",
"aria-haspopup": !0,
"data-toggle": !0
}, x, g);
}, e.buttonHandleKeyUp = function(i) {
i.preventDefault();
}, e.buttonHandleKeyDown = function(i) {
var c = Ve(i);
e.buttonKeyDownHandlers[c] && e.buttonKeyDownHandlers[c].call(me(e), i);
}, e.buttonHandleClick = function(i) {
i.preventDefault(), e.props.environment.document.activeElement === e.props.environment.document.body && i.target.focus(), process.env.NODE_ENV === "test" ? e.toggleMenu({
type: ge
}) : e.internalSetTimeout(function() {
return e.toggleMenu({
type: ge
});
});
}, e.buttonHandleBlur = function(i) {
var c = i.target;
e.internalSetTimeout(function() {
!e.isMouseDown && (e.props.environment.document.activeElement == null || e.props.environment.document.activeElement.id !== e.inputId) && e.props.environment.document.activeElement !== c && e.reset({
type: Xe
});
});
}, e.getLabelProps = function(i) {
return M({
htmlFor: e.inputId,
id: e.labelId
}, i);
}, e.getInputProps = function(i) {
var c = i === void 0 ? {} : i, u = c.onKeyDown, _ = c.onBlur, m = c.onChange, E = c.onInput;
c.onChangeText;
var g = Z(c, mt), h, I = {};
h = "onChange";
var w = e.getState(), x = w.inputValue, a = w.isOpen, R = w.highlightedIndex;
if (!g.disabled) {
var A;
I = (A = {}, A[h] = K(m, E, e.inputHandleChange), A.onKeyDown = K(u, e.inputHandleKeyDown), A.onBlur = K(_, e.inputHandleBlur), A);
}
return M({
"aria-autocomplete": "list",
"aria-activedescendant": a && typeof R == "number" && R >= 0 ? e.getItemId(R) : null,
"aria-controls": a ? e.menuId : null,
"aria-labelledby": g && g["aria-label"] ? void 0 : e.labelId,
// https://developer.mozilla.org/en-US/docs/Web/Security/Securing_your_site/Turning_off_form_autocompletion
// revert back since autocomplete="nope" is ignored on latest Chrome and Opera
autoComplete: "off",
value: x,
id: e.inputId
}, I, g);
}, e.inputHandleKeyDown = function(i) {
var c = Ve(i);
c && e.inputKeyDownHandlers[c] && e.inputKeyDownHandlers[c].call(me(e), i);
}, e.inputHandleChange = function(i) {
e.internalSetState({
type: Fe,
isOpen: !0,
inputValue: i.target.value,
highlightedIndex: e.props.defaultHighlightedIndex
});
}, e.inputHandleBlur = function() {
e.internalSetTimeout(function() {
var i = e.props.environment.document && !!e.props.environment.document.activeElement && !!e.props.environment.document.activeElement.dataset && e.props.environment.document.activeElement.dataset.toggle && e._rootNode && e._rootNode.contains(e.props.environment.document.activeElement);
!e.isMouseDown && !i && e.reset({
type: ze
});
});
}, e.menuRef = function(i) {
e._menuNode = i;
}, e.getMenuProps = function(i, c) {
var u, _ = i === void 0 ? {} : i, m = _.refKey, E = m === void 0 ? "ref" : m, g = _.ref, h = Z(_, Et), I = c === void 0 ? {} : c, w = I.suppressRefError, x = w === void 0 ? !1 : w;
return e.getMenuProps.called = !0, e.getMenuProps.refKey = E, e.getMenuProps.suppressRefError = x, M((u = {}, u[E] = Se(g, e.menuRef), u.role = "listbox", u["aria-labelledby"] = h && h["aria-label"] ? null : e.labelId, u.id = e.menuId, u), h);
}, e.getItemProps = function(i) {
var c, u = i === void 0 ? {} : i, _ = u.onMouseMove, m = u.onMouseDown, E = u.onClick;
u.onPress;
var g = u.index, h = u.item, I = h === void 0 ? process.env.NODE_ENV === "production" ? (
/* istanbul ignore next */
void 0
) : lt("getItemProps", "item") : h, w = Z(u, It);
g === void 0 ? (e.items.push(I), g = e.items.indexOf(I)) : e.items[g] = I;
var x = "onClick", a = E, R = (c = {
// onMouseMove is used over onMouseEnter here. onMouseMove
// is only triggered on actual mouse movement while onMouseEnter
// can fire on DOM changes, interrupting keyboard navigation
onMouseMove: K(_, function() {
g !== e.getState().highlightedIndex && (e.setHighlightedIndex(g, {
type: Be
}), e.avoidScrolling = !0, e.internalSetTimeout(function() {
return e.avoidScrolling = !1;
}, 250));
}),
onMouseDown: K(m, function(B) {
B.preventDefault();
})
}, c[x] = K(a, function() {
e.selectItemAtIndex(g, {
type: qe
});
}), c), A = w.disabled ? {
onMouseDown: R.onMouseDown
} : R;
return M({
id: e.getItemId(g),
role: "option",
"aria-selected": e.getState().highlightedIndex === g
}, A, w);
}, e.clearItems = function() {
e.items = [];
}, e.reset = function(i, c) {
i === void 0 && (i = {}), i = ue(i), e.internalSetState(function(u) {
var _ = u.selectedItem;
return M({
isOpen: e.props.defaultIsOpen,
highlightedIndex: e.props.defaultHighlightedIndex,
inputValue: e.props.itemToString(_)
}, i);
}, c);
}, e.toggleMenu = function(i, c) {
i === void 0 && (i = {}), i = ue(i), e.internalSetState(function(u) {
var _ = u.isOpen;
return M({
isOpen: !_
}, _ && {
highlightedIndex: e.props.defaultHighlightedIndex
}, i);
}, function() {
var u = e.getState(), _ = u.isOpen, m = u.highlightedIndex;
_ && e.getItemCount() > 0 && typeof m == "number" && e.setHighlightedIndex(m, i), De(c)();
});
}, e.openMenu = function(i) {
e.internalSetState({
isOpen: !0
}, i);
}, e.closeMenu = function(i) {
e.internalSetState({
isOpen: !1
}, i);
}, e.updateStatus = he(function() {
var i = e.getState(), c = e.items[i.highlightedIndex], u = e.getItemCount(), _ = e.props.getA11yStatusMessage(M({
itemToString: e.props.itemToString,
previousResultCount: e.previousResultCount,
resultCount: u,
highlightedItem: c
}, i));
e.previousResultCount = u, ke(_, e.props.environment.document);
}, 200);
var d = e.props, v = d.defaultHighlightedIndex, y = d.initialHighlightedIndex, C = y === void 0 ? v : y, S = d.defaultIsOpen, N = d.initialIsOpen, V = N === void 0 ? S : N, P = d.initialInputValue, b = P === void 0 ? "" : P, H = d.initialSelectedItem, T = H === void 0 ? null : H, f = e.getState({
highlightedIndex: C,
isOpen: V,
inputValue: b,
selectedItem: T
});
return f.selectedItem != null && e.props.initialInputValue === void 0 && (f.inputValue = e.props.itemToString(f.selectedItem)), e.state = f, e;
}
var s = r.prototype;
return s.internalClearTimeouts = function() {
this.timeoutIds.forEach(function(e) {
clearTimeout(e);
}), this.timeoutIds = [];
}, s.getState = function(e) {
return e === void 0 && (e = this.state), pt(e, this.props);
}, s.getItemCount = function() {
var e = this.items.length;
return this.itemCount != null ? e = this.itemCount : this.props.itemCount !== void 0 && (e = this.props.itemCount), e;
}, s.getItemNodeFromIndex = function(e) {
return this.props.environment.document.getElementById(this.getItemId(e));
}, s.scrollHighlightedItemIntoView = function() {
{
var e = this.getItemNodeFromIndex(this.getState().highlightedIndex);
this.props.scrollIntoView(e, this._menuNode);
}
}, s.moveHighlightedIndex = function(e, d) {
var v = this, y = this.getItemCount(), C = this.getState(), S = C.highlightedIndex;
if (y > 0) {
var N = pe(e, S, y, function(V) {
return v.getItemNodeFromIndex(V);
});
this.setHighlightedIndex(N, d);
}
}, s.getStateAndHelpers = function() {
var e = this.getState(), d = e.highlightedIndex, v = e.inputValue, y = e.selectedItem, C = e.isOpen, S = this.props.itemToString, N = this.id, V = this.getRootProps, P = this.getToggleButtonProps, b = this.getLabelProps, H = this.getMenuProps, T = this.getInputProps, f = this.getItemProps, i = this.openMenu, c = this.closeMenu, u = this.toggleMenu, _ = this.selectItem, m = this.selectItemAtIndex, E = this.selectHighlightedItem, g = this.setHighlightedIndex, h = this.clearSelection, I = this.clearItems, w = this.reset, x = this.setItemCount, a = this.unsetItemCount, R = this.internalSetState;
return {
// prop getters
getRootProps: V,
getToggleButtonProps: P,
getLabelProps: b,
getMenuProps: H,
getInputProps: T,
getItemProps: f,
// actions
reset: w,
openMenu: i,
closeMenu: c,
toggleMenu: u,
selectItem: _,
selectItemAtIndex: m,
selectHighlightedItem: E,
setHighlightedIndex: g,
clearSelection: h,
clearItems: I,
setItemCount: x,
unsetItemCount: a,
setState: R,
// props
itemToString: S,
// derived
id: N,
// state
highlightedIndex: d,
inputValue: v,
isOpen: C,
selectedItem: y
};
}, s.componentDidMount = function() {
var e = this;
process.env.NODE_ENV !== "production" && this.getMenuProps.called && !this.getMenuProps.suppressRefError && Re(this._menuNode, this.getMenuProps);
{
var d = function() {
e.isMouseDown = !0;
}, v = function(P) {
e.isMouseDown = !1;
var b = xe(P.target, [e._rootNode, e._menuNode], e.props.environment);
!b && e.getState().isOpen && e.reset({
type: Le
}, function() {
return e.props.onOuterClick(e.getStateAndHelpers());
});
}, y = function() {
e.isTouchMove = !1;
}, C = function() {
e.isTouchMove = !0;
}, S = function(P) {
var b = xe(P.target, [e._rootNode, e._menuNode], e.props.environment, !1);
!e.isTouchMove && !b && e.getState().isOpen && e.reset({
type: Je
}, function() {
return e.props.onOuterClick(e.getStateAndHelpers());
});
}, N = this.props.environment;
N.addEventListener("mousedown", d), N.addEventListener("mouseup", v), N.addEventListener("touchstart", y), N.addEventListener("touchmove", C), N.addEventListener("touchend", S), this.cleanup = function() {
e.internalClearTimeouts(), e.updateStatus.cancel(), N.removeEventListener("mousedown", d), N.removeEventListener("mouseup", v), N.removeEventListener("touchstart", y), N.removeEventListener("touchmove", C), N.removeEventListener("touchend", S);
};
}
}, s.shouldScroll = function(e, d) {
var v = this.props.highlightedIndex === void 0 ? this.getState() : this.props, y = v.highlightedIndex, C = d.highlightedIndex === void 0 ? e : d, S = C.highlightedIndex, N = y && this.getState().isOpen && !e.isOpen, V = y !== S;
return N || V;
}, s.componentDidUpdate = function(e, d) {
process.env.NODE_ENV !== "production" && (Te(this.state, e, this.props), this.getMenuProps.called && !this.getMenuProps.suppressRefError && Re(this._menuNode, this.getMenuProps)), _e(this.props, "selectedItem") && this.props.selectedItemChanged(e.selectedItem, this.props.selectedItem) && this.internalSetState({
type: Ze,
inputValue: this.props.itemToString(this.props.selectedItem)
}), !this.avoidScrolling && this.shouldScroll(d, e) && this.scrollHighlightedItemIntoView(), this.updateStatus();
}, s.componentWillUnmount = function() {
this.cleanup();
}, s.render = function() {
var e = Ce(this.props.children, L);
this.clearItems(), this.getRootProps.called = !1, this.getRootProps.refKey = void 0, this.getRootProps.suppressRefError = void 0, this.getMenuProps.called = !1, this.getMenuProps.refKey = void 0, this.getMenuProps.suppressRefError = void 0, this.getLabelProps.called = !1, this.getInputProps.called = !1;
var d = Ce(e(this.getStateAndHelpers()));
if (!d)
return null;
if (this.getRootProps.called || this.props.suppressRefError)
return process.env.NODE_ENV !== "production" && !this.getRootProps.suppressRefError && !this.props.suppressRefError && yt(d, this.getRootProps), d;
if (He(d))
return /* @__PURE__ */ et(d, this.getRootProps(Ae(d)));
if (process.env.NODE_ENV !== "production")
throw new Error("downshift: If you return a non-DOM element, you must apply the getRootProps function");
}, r;
}(tt);
return t.defaultProps = {
defaultHighlightedIndex: null,
defaultIsOpen: !1,
getA11yStatusMessage: Me,
itemToString: function(r) {
return r == null ? "" : (process.env.NODE_ENV !== "production" && ft(r) && !r.hasOwnProperty("toString") && console.warn("downshift: An object was passed to the default implementation of `itemToString`. You should probably provide your own `itemToString` implementation. Please refer to the `itemToString` API documentation.", "The object that was passed:", r), String(r));
},
onStateChange: L,
onInputValueChange: L,
onUserAction: L,
onChange: L,
onSelect: L,
onOuterClick: L,
selectedItemChanged: function(r, s) {
return r !== s;
},
environment: (
/* istanbul ignore next (ssr) */
typeof window > "u" ? {} : window
),
stateReducer: function(r, s) {
return s;
},
suppressRefError: !1,
scrollIntoView: Pe
}, t.stateChangeTypes = gt, t;
}();
process.env.NODE_ENV !== "production" && (Qe.propTypes = {
children: o.func,
defaultHighlightedIndex: o.number,
defaultIsOpen: o.bool,
initialHighlightedIndex: o.number,
initialSelectedItem: o.any,
initialInputValue: o.string,
initialIsOpen: o.bool,
getA11yStatusMessage: o.func,
itemToString: o.func,
onChange: o.func,
onSelect: o.func,
onStateChange: o.func,
onInputValueChange: o.func,
onUserAction: o.func,
onOuterClick: o.func,
selectedItemChanged: o.func,
stateReducer: o.func,
itemCount: o.number,
id: o.string,
environment: o.shape({
addEventListener: o.func,
removeEventListener: o.func,
document: o.shape({
getElementById: o.func,
activeElement: o.any,
body: o.any
})
}),
suppressRefError: o.bool,
scrollIntoView: o.func,
// things we keep in state for uncontrolled components
// but can accept as props for controlled components
/* eslint-disable react/no-unused-prop-types */
selectedItem: o.any,
isOpen: o.bool,
inputValue: o.string,
highlightedIndex: o.number,
labelId: o.string,
inputId: o.string,
menuId: o.string,
getItemId: o.func
/* eslint-enable react/no-unused-prop-types */
});
var Ct = Qe;
function Re(t, n) {
var r = n.refKey;
t || console.error('downshift: The ref prop "' + r + '" from getMenuProps was not applied correctly on your menu element.');
}
function yt(t, n) {
var r = n.refKey, s = r !== "ref", l = !He(t);
l && !s && !we.isForwardRef(t) ? console.error("downshift: You returned a non-DOM element. You must specify a refKey in getRootProps") : !l && s && console.error('downshift: You returned a DOM element. You should not specify a refKey in getRootProps. You specified "' + r + '"'), !we.isForwardRef(t) && !Ae(t)[r] && console.error('downshift: You must apply the ref prop "' + r + '" from getRootProps onto your root element.');
}
function wt(t, n) {
return n.changes;
}
function Nt(t) {
var n = t.selectedItem, r = t.itemToString;
return n ? r(n) + " has been selected." : "";
}
he(function(t, n) {
ke(t(), n);
}, 200);
function Ot(t) {
return t ? String(t) : "";
}
var J = {
itemToString: Ot,
stateReducer: wt,
getA11ySelectionMessage: Nt,
scrollIntoView: Pe,
environment: (
/* istanbul ignore next (ssr) */
typeof window > "u" ? {} : window
)
};
process.env.NODE_ENV;
process.env.NODE_ENV;
o.array.isRequired, o.func, o.func, o.func, o.number, o.number, o.number, o.bool, o.bool, o.bool, o.any, o.any, o.any, o.string, o.string, o.string, o.func, o.string, o.func, o.func, o.func, o.func, o.func, o.shape({
addEventListener: o.func,
removeEventListener: o.func,
document: o.shape({
getElementById: o.func,
activeElement: o.any,
body: o.any
})
});
function Dt(t) {
var n = t.isOpen, r = t.resultCount, s = t.previousResultCount;
return n ? r ? r !== s ? "".concat(r, " result").concat(r === 1 ? " is" : "s are", " available, use up and down arrow keys to navigate. Press Enter or Space Bar keys to select.") : "" : "No results are available." : "";
}
le(le({}, J), { getA11yStatusMessage: Dt });
process.env.NODE_ENV;
process.env.NODE_ENV;
process.env.NODE_ENV;
process.env.NODE_ENV;
process.env.NODE_ENV;
process.env.NODE_ENV;
process.env.NODE_ENV;
process.env.NODE_ENV;
process.env.NODE_ENV;
process.env.NODE_ENV;
process.env.NODE_ENV;
process.env.NODE_ENV;
process.env.NODE_ENV;
process.env.NODE_ENV;
process.env.NODE_ENV;
process.env.NODE_ENV;
process.env.NODE_ENV;
process.env.NODE_ENV;
process.env.NODE_ENV;
process.env.NODE_ENV;
process.env.NODE_ENV;
process.env.NODE_ENV;
process.env.NODE_ENV;
process.env.NODE_ENV;
process.env.NODE_ENV;
process.env.NODE_ENV;
process.env.NODE_ENV;
process.env.NODE_ENV;
process.env.NODE_ENV;
process.env.NODE_ENV;
process.env.NODE_ENV;
process.env.NODE_ENV;
process.env.NODE_ENV;
process.env.NODE_ENV;
process.env.NODE_ENV;
process.env.NODE_ENV;
process.env.NODE_ENV;
process.env.NODE_ENV;
process.env.NODE_ENV;
process.env.NODE_ENV;
process.env.NODE_ENV;
process.env.NODE_ENV;
process.env.NODE_ENV;
process.env.NODE_ENV;
process.env.NODE_ENV;
process.env.NODE_ENV;
o.array.isRequired, o.func, o.func, o.func, o.func, o.number, o.number, o.number, o.bool, o.bool, o.bool, o.any, o.any, o.any, o.string, o.string, o.string, o.string, o.string, o.string, o.func, o.string, o.string, o.func, o.func, o.func, o.func, o.func, o.func, o.shape({
addEventListener: o.func,
removeEventListener: o.func,
document: o.shape({
getElementById: o.func,
activeElement: o.any,
body: o.any
})
});
process.env.NODE_ENV;
M({}, J, {
selectedItemChanged: function(n, r) {
return n !== r;
},
getA11yStatusMessage: Me
});
o.array, o.array, o.array, o.func, o.func, o.func, o.number, o.number, o.number, o.func, o.func, o.string, o.string, o.shape({
addEventListener: o.func,
removeEventListener: o.func,
document: o.shape({
getElementById: o.func,
activeElement: o.any,
body: o.any
})
});
J.itemToString, J.stateReducer, J.environment;
process.env.NODE_ENV;
process.env.NODE_ENV;
process.env.NODE_ENV;
process.env.NODE_ENV;
process.env.NODE_ENV;
process.env.NODE_ENV;
process.env.NODE_ENV;
process.env.NODE_ENV;
process.env.NODE_ENV;
process.env.NODE_ENV;
process.env.NODE_ENV;
process.env.NODE_ENV;
process.env.NODE_ENV;
process.env.NODE_ENV;
export {
Ct as D,
fe as _,
me as a
};