welcome-ui
Version:
Customizable design system with react, typescript, tailwindcss and ariakit.
347 lines (341 loc) • 10.3 kB
JavaScript
"use client";
import { i as ot, t as C, P as st, Q as at, R as ut, S as F, J as it, G as ct, I as ft, T as lt, U as dt, M as N, d as St, a as P, u as pt, V as vt } from "./OE2EFRVA-C3721cM3.js";
import * as I from "react";
import X from "react";
import { g as _t } from "./index-PAaZGbyz.js";
function T(t, n) {
const e = t.__unstableInternals;
return ot(e, "Invalid store"), e[n];
}
function W(t, ...n) {
let e = t, l = e, a = Symbol(), o = lt;
const u = /* @__PURE__ */ new Set(), c = /* @__PURE__ */ new Set(), v = /* @__PURE__ */ new Set(), m = /* @__PURE__ */ new Set(), _ = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new WeakMap(), d = /* @__PURE__ */ new WeakMap(), g = (s) => (v.add(s), () => v.delete(s)), x = () => {
const s = u.size, r = Symbol();
u.add(r);
const b = () => {
u.delete(r), !u.size && o();
};
if (s) return b;
const w = ut(e).map(
(L) => F(
...n.map((V) => {
var h;
const D = (h = V == null ? void 0 : V.getState) == null ? void 0 : h.call(V);
if (D && C(D, L))
return tt(V, [L], (U) => {
p(
L,
U[L],
// @ts-expect-error - Not public API. This is just to prevent
// infinite loops.
!0
);
});
})
)
), A = [];
for (const L of v)
A.push(L());
const B = n.map(Z);
return o = F(...w, ...A, ...B), b;
}, E = (s, r, b = m) => (b.add(r), d.set(r, s), () => {
var w;
(w = i.get(r)) == null || w(), i.delete(r), d.delete(r), b.delete(r);
}), R = (s, r) => E(s, r), M = (s, r) => (i.set(r, r(e, e)), E(s, r)), q = (s, r) => (i.set(r, r(e, l)), E(s, r, _)), S = (s) => W(at(e, s), y), f = (s) => W(st(e, s), y), O = () => e, p = (s, r, b = !1) => {
var w;
if (!C(e, s)) return;
const A = it(r, e[s]);
if (A === e[s]) return;
if (!b)
for (const h of n)
(w = h == null ? void 0 : h.setState) == null || w.call(h, s, A);
const B = e;
e = ct(ft({}, e), { [s]: A });
const L = Symbol();
a = L, c.add(s);
const V = (h, D, U) => {
var H;
const $ = d.get(h), rt = (z) => U ? U.has(z) : z === s;
(!$ || $.some(rt)) && ((H = i.get(h)) == null || H(), i.set(h, h(e, D)));
};
for (const h of m)
V(h, B);
queueMicrotask(() => {
if (a !== L) return;
const h = e;
for (const D of _)
V(D, l, c);
l = h, c.clear();
});
}, y = {
getState: O,
setState: p,
__unstableInternals: {
setup: g,
init: x,
subscribe: R,
sync: M,
batch: q,
pick: S,
omit: f
}
};
return y;
}
function Rt(t, ...n) {
if (t)
return T(t, "setup")(...n);
}
function Z(t, ...n) {
if (t)
return T(t, "init")(...n);
}
function k(t, ...n) {
if (t)
return T(t, "subscribe")(...n);
}
function tt(t, ...n) {
if (t)
return T(t, "sync")(...n);
}
function ht(t, ...n) {
if (t)
return T(t, "batch")(...n);
}
function Vt(t, ...n) {
if (t)
return T(t, "omit")(...n);
}
function Tt(t, ...n) {
if (t)
return T(t, "pick")(...n);
}
function At(...t) {
var n;
const e = {};
for (const a of t) {
const o = (n = a == null ? void 0 : a.getState) == null ? void 0 : n.call(a);
o && Object.assign(e, o);
}
const l = W(e, ...t);
return Object.assign({}, ...t, l);
}
function Dt(t, n) {
if (process.env.NODE_ENV === "production" || !n) return;
const e = Object.entries(t).filter(([o, u]) => o.startsWith("default") && u !== void 0).map(([o]) => {
var u;
const c = o.replace("default", "");
return `${((u = c[0]) == null ? void 0 : u.toLowerCase()) || ""}${c.slice(1)}`;
});
if (!e.length) return;
const l = n.getState();
if (e.filter(
(o) => C(l, o)
).length)
throw new Error(
`Passing a store prop in conjunction with a default state is not supported.
const store = useSelectStore();
<SelectProvider store={store} defaultValue="Apple" />
^ ^
Instead, pass the default state to the topmost store:
const store = useSelectStore({ defaultValue: "Apple" });
<SelectProvider store={store} />
See https://github.com/ariakit/ariakit/pull/2745 for more details.
If there's a particular need for this, please submit a feature request at https://github.com/ariakit/ariakit
`
);
}
var j = { exports: {} }, G = {}, Y;
function mt() {
if (Y) return G;
Y = 1;
var t = X;
function n(i, d) {
return i === d && (i !== 0 || 1 / i === 1 / d) || i !== i && d !== d;
}
var e = typeof Object.is == "function" ? Object.is : n, l = t.useState, a = t.useEffect, o = t.useLayoutEffect, u = t.useDebugValue;
function c(i, d) {
var g = d(), x = l({ inst: { value: g, getSnapshot: d } }), E = x[0].inst, R = x[1];
return o(function() {
E.value = g, E.getSnapshot = d, v(E) && R({ inst: E });
}, [i, g, d]), a(function() {
return v(E) && R({ inst: E }), i(function() {
v(E) && R({ inst: E });
});
}, [i]), u(g), g;
}
function v(i) {
var d = i.getSnapshot;
i = i.value;
try {
var g = d();
return !e(i, g);
} catch {
return !0;
}
}
function m(i, d) {
return d();
}
var _ = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ? m : c;
return G.useSyncExternalStore = t.useSyncExternalStore !== void 0 ? t.useSyncExternalStore : _, G;
}
var K = {}, J;
function Et() {
return J || (J = 1, process.env.NODE_ENV !== "production" && function() {
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
var t = X, n = t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
function e(S) {
{
for (var f = arguments.length, O = new Array(f > 1 ? f - 1 : 0), p = 1; p < f; p++)
O[p - 1] = arguments[p];
l("error", S, O);
}
}
function l(S, f, O) {
{
var p = n.ReactDebugCurrentFrame, y = p.getStackAddendum();
y !== "" && (f += "%s", O = O.concat([y]));
var s = O.map(function(r) {
return String(r);
});
s.unshift("Warning: " + f), Function.prototype.apply.call(console[S], console, s);
}
}
function a(S, f) {
return S === f && (S !== 0 || 1 / S === 1 / f) || S !== S && f !== f;
}
var o = typeof Object.is == "function" ? Object.is : a, u = t.useState, c = t.useEffect, v = t.useLayoutEffect, m = t.useDebugValue, _ = !1, i = !1;
function d(S, f, O) {
_ || t.startTransition !== void 0 && (_ = !0, e("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));
var p = f();
if (!i) {
var y = f();
o(p, y) || (e("The result of getSnapshot should be cached to avoid an infinite loop"), i = !0);
}
var s = u({
inst: {
value: p,
getSnapshot: f
}
}), r = s[0].inst, b = s[1];
return v(function() {
r.value = p, r.getSnapshot = f, g(r) && b({
inst: r
});
}, [S, p, f]), c(function() {
g(r) && b({
inst: r
});
var w = function() {
g(r) && b({
inst: r
});
};
return S(w);
}, [S]), m(p), p;
}
function g(S) {
var f = S.getSnapshot, O = S.value;
try {
var p = f();
return !o(O, p);
} catch {
return !0;
}
}
function x(S, f, O) {
return f();
}
var E = typeof window < "u" && typeof window.document < "u" && typeof window.document.createElement < "u", R = !E, M = R ? x : d, q = t.useSyncExternalStore !== void 0 ? t.useSyncExternalStore : M;
K.useSyncExternalStore = q, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error());
}()), K;
}
var Q;
function gt() {
return Q || (Q = 1, process.env.NODE_ENV === "production" ? j.exports = mt() : j.exports = Et()), j.exports;
}
var Ot = gt();
const bt = /* @__PURE__ */ _t(Ot);
var { useSyncExternalStore: et } = bt, nt = () => () => {
};
function yt(t, n = dt) {
const e = I.useCallback(
(a) => t ? k(t, null, a) : nt(),
[t]
), l = () => {
const a = typeof n == "string" ? n : null, o = typeof n == "function" ? n : null, u = t == null ? void 0 : t.getState();
if (o) return o(u);
if (u && a && C(u, a))
return u[a];
};
return et(e, l, l);
}
function It(t, n) {
const e = I.useRef(
{}
), l = I.useCallback(
(o) => t ? k(t, null, o) : nt(),
[t]
), a = () => {
const o = t == null ? void 0 : t.getState();
let u = !1;
const c = e.current;
for (const v in n) {
const m = n[v];
if (typeof m == "function") {
const _ = m(o);
_ !== c[v] && (c[v] = _, u = !0);
}
if (typeof m == "string") {
if (!o || !C(o, m)) continue;
const _ = o[m];
_ !== c[v] && (c[v] = _, u = !0);
}
}
return u && (e.current = P({}, c)), e.current;
};
return et(l, a, a);
}
function Ct(t, n, e, l) {
const a = C(n, e) ? n[e] : void 0, o = l ? n[l] : void 0, u = vt({ value: a, setValue: o });
N(() => tt(t, [e], (c, v) => {
const { value: m, setValue: _ } = u.current;
_ && c[e] !== v[e] && c[e] !== m && _(c[e]);
}), [t, e]), N(() => {
if (a !== void 0)
return t.setState(e, a), ht(t, [e], () => {
a !== void 0 && t.setState(e, a);
});
});
}
function Ut(t, n) {
const [e, l] = I.useState(() => t(n));
N(() => Z(e), [e]);
const a = I.useCallback(
(c) => yt(e, c),
[e]
), o = I.useMemo(
() => St(P({}, e), { useState: a }),
[e, a]
), u = pt(() => {
l((c) => t(P(P({}, n), c.getState())));
});
return [o, u];
}
export {
tt as a,
Ut as b,
W as c,
Ct as d,
k as e,
ht as f,
It as g,
Z as i,
At as m,
Vt as o,
Tt as p,
Rt as s,
Dt as t,
yt as u
};