import { a as e, n as t } from './chunk-BneVvdWh.js';
import { S as n } from './iframe-B-AKBcwT.js';
import { a as r, c as i } from './theming-ugaMF2e3.js';
import { t as a } from './react-dom-BMbxhwuz.js';
import { t as o } from './jsx-runtime-Bn1Ys6_W.js';
function s(e, t) {
    typeof e == `function` ? e(t) : e != null && (e.current = t);
}
function c(...e) {
    return (t) => e.forEach((e) => s(e, t));
}
function l(...e) {
    return le.useCallback(c(...e), e);
}
function u(e) {
    return M.isValidElement(e) && e.type === ve;
}
function d(e, t) {
    let n = { ...t };
    for (let r in t) {
        let i = e[r],
            a = t[r];
        /^on[A-Z]/.test(r)
            ? i && a
                ? (n[r] = (...e) => {
                      (a(...e), i(...e));
                  })
                : i && (n[r] = i)
            : r === `style`
              ? (n[r] = { ...i, ...a })
              : r === `className` && (n[r] = [i, a].filter(Boolean).join(` `));
    }
    return { ...e, ...n };
}
function ee(e) {
    let t = Object.getOwnPropertyDescriptor(e.props, `ref`)?.get,
        n = t && `isReactWarning` in t && t.isReactWarning;
    return n
        ? e.ref
        : ((t = Object.getOwnPropertyDescriptor(e, `ref`)?.get),
          (n = t && `isReactWarning` in t && t.isReactWarning),
          n ? e.props.ref : e.props.ref || e.ref);
}
function f(e, t) {
    return pe.useReducer((e, n) => t[e][n] ?? e, e);
}
function p(e) {
    let [t, n] = P.useState(),
        r = P.useRef({}),
        i = P.useRef(e),
        a = P.useRef(`none`),
        [o, s] = f(e ? `mounted` : `unmounted`, {
            mounted: { UNMOUNT: `unmounted`, ANIMATION_OUT: `unmountSuspended` },
            unmountSuspended: { MOUNT: `mounted`, ANIMATION_END: `unmounted` },
            unmounted: { MOUNT: `mounted` },
        });
    return (
        P.useEffect(() => {
            let e = m(r.current);
            a.current = o === `mounted` ? e : `none`;
        }, [o]),
        U(() => {
            let t = r.current,
                n = i.current;
            if (n !== e) {
                let r = a.current,
                    o = m(t);
                (e
                    ? s(`MOUNT`)
                    : o === `none` || t?.display === `none`
                      ? s(`UNMOUNT`)
                      : s(n && r !== o ? `ANIMATION_OUT` : `UNMOUNT`),
                    (i.current = e));
            }
        }, [e, s]),
        U(() => {
            if (t) {
                let e = (e) => {
                        let n = m(r.current).includes(e.animationName);
                        e.target === t && n && de.flushSync(() => s(`ANIMATION_END`));
                    },
                    n = (e) => {
                        e.target === t && (a.current = m(r.current));
                    };
                return (
                    t.addEventListener(`animationstart`, n),
                    t.addEventListener(`animationcancel`, e),
                    t.addEventListener(`animationend`, e),
                    () => {
                        (t.removeEventListener(`animationstart`, n),
                            t.removeEventListener(`animationcancel`, e),
                            t.removeEventListener(`animationend`, e));
                    }
                );
            } else s(`ANIMATION_END`);
        }, [t, s]),
        {
            isPresent: [`mounted`, `unmountSuspended`].includes(o),
            ref: P.useCallback((e) => {
                (e && (r.current = getComputedStyle(e)), n(e));
            }, []),
        }
    );
}
function m(e) {
    return e?.animationName || `none`;
}
function h(e) {
    let t = Object.getOwnPropertyDescriptor(e.props, `ref`)?.get,
        n = t && `isReactWarning` in t && t.isReactWarning;
    return n
        ? e.ref
        : ((t = Object.getOwnPropertyDescriptor(e, `ref`)?.get),
          (n = t && `isReactWarning` in t && t.isReactWarning),
          n ? e.props.ref : e.props.ref || e.ref);
}
function te(e, t = []) {
    let n = [];
    function r(t, r) {
        let i = F.createContext(r),
            a = n.length;
        n = [...n, r];
        function o(t) {
            let { scope: n, children: r, ...o } = t,
                s = n?.[e][a] || i,
                c = F.useMemo(() => o, Object.values(o));
            return (0, me.jsx)(s.Provider, { value: c, children: r });
        }
        function s(n, o) {
            let s = o?.[e][a] || i,
                c = F.useContext(s);
            if (c) return c;
            if (r !== void 0) return r;
            throw Error(`\`${n}\` must be used within \`${t}\``);
        }
        return ((o.displayName = t + `Provider`), [o, s]);
    }
    let i = () => {
        let t = n.map((e) => F.createContext(e));
        return function (n) {
            let r = n?.[e] || t;
            return F.useMemo(() => ({ [`__scope${e}`]: { ...n, [e]: r } }), [n, r]);
        };
    };
    return ((i.scopeName = e), [r, g(i, ...t)]);
}
function g(...e) {
    let t = e[0];
    if (e.length === 1) return t;
    let n = () => {
        let n = e.map((e) => ({ useScope: e(), scopeName: e.scopeName }));
        return function (e) {
            let r = n.reduce((t, { useScope: n, scopeName: r }) => {
                let i = n(e)[`__scope${r}`];
                return { ...t, ...i };
            }, {});
            return F.useMemo(() => ({ [`__scope${t.scopeName}`]: r }), [r]);
        };
    };
    return ((n.scopeName = t.scopeName), n);
}
function _(e) {
    let t = I.useRef(e);
    return (
        I.useEffect(() => {
            t.current = e;
        }),
        I.useMemo(
            () =>
                (...e) =>
                    t.current?.(...e),
            [],
        )
    );
}
function v(e) {
    let t = L.useContext(ye);
    return e || t || `ltr`;
}
function y(e, [t, n]) {
    return Math.min(n, Math.max(t, e));
}
function b(e, t, { checkForDefaultPrevented: n = !0 } = {}) {
    return function (r) {
        if ((e?.(r), n === !1 || !r.defaultPrevented)) return t?.(r);
    };
}
function x(e, t) {
    return he.useReducer((e, n) => t[e][n] ?? e, e);
}
function S(e) {
    return e ? parseInt(e, 10) : 0;
}
function C(e, t) {
    let n = e / t;
    return isNaN(n) ? 0 : n;
}
function w(e) {
    let t = C(e.viewport, e.content),
        n = e.scrollbar.paddingStart + e.scrollbar.paddingEnd,
        r = (e.scrollbar.size - n) * t;
    return Math.max(r, 18);
}
function T(e, t, n, r = `ltr`) {
    let i = w(n),
        a = i / 2,
        o = t || a,
        s = i - o,
        c = n.scrollbar.paddingStart + o,
        l = n.scrollbar.size - n.scrollbar.paddingEnd - s,
        u = n.content - n.viewport,
        d = r === `ltr` ? [0, u] : [u * -1, 0];
    return ne([c, l], d)(e);
}
function E(e, t, n = `ltr`) {
    let r = w(t),
        i = t.scrollbar.paddingStart + t.scrollbar.paddingEnd,
        a = t.scrollbar.size - i,
        o = t.content - t.viewport,
        s = a - r,
        c = y(e, n === `ltr` ? [0, o] : [o * -1, 0]);
    return ne([0, o], [0, s])(c);
}
function ne(e, t) {
    return (n) => {
        if (e[0] === e[1] || t[0] === t[1]) return t[0];
        let r = (t[1] - t[0]) / (e[1] - e[0]);
        return t[0] + r * (n - e[0]);
    };
}
function re(e, t) {
    return e > 0 && e < t;
}
function D(e, t) {
    let n = _(e),
        r = j.useRef(0);
    return (
        j.useEffect(() => () => window.clearTimeout(r.current), []),
        j.useCallback(() => {
            (window.clearTimeout(r.current), (r.current = window.setTimeout(n, t)));
        }, [n, t])
    );
}
function O(e, t) {
    let n = _(t);
    U(() => {
        let t = 0;
        if (e) {
            let r = new ResizeObserver(() => {
                (cancelAnimationFrame(t), (t = window.requestAnimationFrame(n)));
            });
            return (
                r.observe(e),
                () => {
                    (window.cancelAnimationFrame(t), r.unobserve(e));
                }
            );
        }
    }, [e, n]);
}
function ie(e, t) {
    let { asChild: n, children: r } = e;
    if (!n) return typeof t == `function` ? t(r) : t;
    let i = j.Children.only(r);
    return j.cloneElement(i, {
        children: typeof t == `function` ? t(i.props.children) : t,
    });
}
async function ae(e) {
    try {
        await $.top?.navigator.clipboard.writeText(e);
    } catch {
        await $.navigator.clipboard.writeText(e);
    }
}
async function oe(e) {
    let t = Q.createElement(`TEXTAREA`),
        n = Q.activeElement;
    ((t.value = e),
        Q.body.appendChild(t),
        t.select(),
        Q.execCommand(`copy`),
        Q.body.removeChild(t),
        n.focus());
}
function se() {
    return $.navigator?.clipboard ? ae : oe;
}
var k,
    A,
    j,
    ce,
    M,
    le,
    N,
    ue,
    P,
    de,
    fe,
    pe,
    F,
    me,
    I,
    L,
    he,
    R,
    ge,
    z,
    _e,
    B,
    V,
    ve,
    H,
    U,
    W,
    ye,
    G,
    be,
    xe,
    Se,
    K,
    Ce,
    we,
    Te,
    q,
    Ee,
    De,
    Oe,
    ke,
    J,
    Ae,
    je,
    Me,
    Ne,
    Pe,
    Y,
    Fe,
    Ie,
    X,
    Le,
    Re,
    ze,
    Be,
    Ve,
    He,
    Ue,
    We,
    Ge,
    Ke,
    qe,
    Je,
    Z,
    Ye,
    Q,
    $,
    Xe = t(() => {
        ((k = e(n(), 1)),
            r(),
            (A = e(n(), 1)),
            (j = e(n(), 1)),
            (ce = e(n(), 1)),
            a(),
            (M = e(n(), 1)),
            (le = e(n(), 1)),
            (N = o()),
            (ue = o()),
            (P = e(n(), 1)),
            (de = e(a(), 1)),
            (fe = e(n(), 1)),
            (pe = e(n(), 1)),
            (F = e(n(), 1)),
            (me = o()),
            (I = e(n(), 1)),
            (L = e(n(), 1)),
            o(),
            (he = e(n(), 1)),
            (R = o()),
            (ge = i.div(({ theme: e, $flexLayout: t = !1 }) => [
                { background: e.background.content },
                t
                    ? {
                          display: `inline-flex`,
                          marginInlineStart: `auto`,
                          alignSelf: `flex-end`,
                      }
                    : {
                          position: `absolute`,
                          bottom: 0,
                          right: 0,
                          maxWidth: `100%`,
                          display: `flex`,
                          zIndex: 1,
                      },
            ])),
            (z = i.button(
                ({ theme: e }) => ({
                    margin: 0,
                    border: `0 none`,
                    padding: `4px 10px`,
                    cursor: `pointer`,
                    display: `flex`,
                    alignItems: `center`,
                    color: e.color.defaultText,
                    background: e.background.content,
                    fontSize: 12,
                    lineHeight: `16px`,
                    fontFamily: e.typography.fonts.base,
                    fontWeight: e.typography.weight.bold,
                    borderTop: `1px solid ${e.appBorderColor}`,
                    borderLeft: `1px solid ${e.appBorderColor}`,
                    marginLeft: -1,
                    borderRadius: `4px 0 0 0`,
                    '&:not(:last-child)': {
                        borderRight: `1px solid ${e.appBorderColor}`,
                    },
                    '& + *': {
                        borderLeft: `1px solid ${e.appBorderColor}`,
                        borderRadius: 0,
                    },
                    '&:focus': {
                        boxShadow: `${e.color.secondary} 0 -3px 0 0 inset`,
                        outline: `0 none`,
                        '@media (forced-colors: active)': {
                            outline: `1px solid highlight`,
                        },
                    },
                }),
                ({ disabled: e }) => e && { cursor: `not-allowed`, opacity: 0.5 },
            )),
            (z.displayName = `ActionButton`),
            (_e = ({ actionItems: e, flexLayout: t = !1, ...n }) =>
                k.createElement(
                    ge,
                    { ...n, $flexLayout: t },
                    e.map(({ title: e, className: t, onClick: n, disabled: r }, i) =>
                        k.createElement(
                            z,
                            { key: i, className: t, onClick: n, disabled: !!r },
                            e,
                        ),
                    ),
                )),
            (B = M.forwardRef((e, t) => {
                let { children: n, ...r } = e,
                    i = M.Children.toArray(n),
                    a = i.find(u);
                if (a) {
                    let e = a.props.children,
                        n = i.map((t) =>
                            t === a
                                ? M.Children.count(e) > 1
                                    ? M.Children.only(null)
                                    : M.isValidElement(e)
                                      ? e.props.children
                                      : null
                                : t,
                        );
                    return (0, N.jsx)(V, {
                        ...r,
                        ref: t,
                        children: M.isValidElement(e)
                            ? M.cloneElement(e, void 0, n)
                            : null,
                    });
                }
                return (0, N.jsx)(V, { ...r, ref: t, children: n });
            })),
            (B.displayName = `Slot`),
            (V = M.forwardRef((e, t) => {
                let { children: n, ...r } = e;
                if (M.isValidElement(n)) {
                    let e = ee(n);
                    return M.cloneElement(n, { ...d(r, n.props), ref: t ? c(t, e) : e });
                }
                return M.Children.count(n) > 1 ? M.Children.only(null) : null;
            })),
            (V.displayName = `SlotClone`),
            (ve = ({ children: e }) => (0, N.jsx)(N.Fragment, { children: e })),
            (H = [
                `a`,
                `button`,
                `div`,
                `form`,
                `h2`,
                `h3`,
                `img`,
                `input`,
                `label`,
                `li`,
                `nav`,
                `ol`,
                `p`,
                `span`,
                `svg`,
                `ul`,
            ].reduce((e, t) => {
                let n = ce.forwardRef((e, n) => {
                    let { asChild: r, ...i } = e,
                        a = r ? B : t;
                    return (
                        typeof window < `u` && (window[Symbol.for(`radix-ui`)] = !0),
                        (0, ue.jsx)(a, { ...i, ref: n })
                    );
                });
                return ((n.displayName = `Primitive.${t}`), { ...e, [t]: n });
            }, {})),
            (U = globalThis?.document ? fe.useLayoutEffect : () => {}),
            (W = (e) => {
                let { present: t, children: n } = e,
                    r = p(t),
                    i =
                        typeof n == `function`
                            ? n({ present: r.isPresent })
                            : P.Children.only(n),
                    a = l(r.ref, h(i));
                return typeof n == `function` || r.isPresent
                    ? P.cloneElement(i, { ref: a })
                    : null;
            }),
            (W.displayName = `Presence`),
            (ye = L.createContext(void 0)),
            (G = `ScrollArea`),
            ([be, xe] = te(G)),
            ([Se, K] = be(G)),
            (Ce = j.forwardRef((e, t) => {
                let {
                        __scopeScrollArea: n,
                        type: r = `hover`,
                        dir: i,
                        scrollHideDelay: a = 600,
                        ...o
                    } = e,
                    [s, c] = j.useState(null),
                    [u, d] = j.useState(null),
                    [ee, f] = j.useState(null),
                    [p, m] = j.useState(null),
                    [h, te] = j.useState(null),
                    [g, _] = j.useState(0),
                    [y, b] = j.useState(0),
                    [x, S] = j.useState(!1),
                    [C, w] = j.useState(!1),
                    T = l(t, (e) => c(e)),
                    E = v(i);
                return (0, R.jsx)(Se, {
                    scope: n,
                    type: r,
                    dir: E,
                    scrollHideDelay: a,
                    scrollArea: s,
                    viewport: u,
                    onViewportChange: d,
                    content: ee,
                    onContentChange: f,
                    scrollbarX: p,
                    onScrollbarXChange: m,
                    scrollbarXEnabled: x,
                    onScrollbarXEnabledChange: S,
                    scrollbarY: h,
                    onScrollbarYChange: te,
                    scrollbarYEnabled: C,
                    onScrollbarYEnabledChange: w,
                    onCornerWidthChange: _,
                    onCornerHeightChange: b,
                    children: (0, R.jsx)(H.div, {
                        dir: E,
                        ...o,
                        ref: T,
                        style: {
                            position: `relative`,
                            '--radix-scroll-area-corner-width': g + `px`,
                            '--radix-scroll-area-corner-height': y + `px`,
                            ...e.style,
                        },
                    }),
                });
            })),
            (Ce.displayName = G),
            (we = `ScrollAreaViewport`),
            (Te = j.forwardRef((e, t) => {
                let { __scopeScrollArea: n, children: r, asChild: i, nonce: a, ...o } = e,
                    s = K(we, n),
                    c = l(t, j.useRef(null), s.onViewportChange);
                return (0, R.jsxs)(R.Fragment, {
                    children: [
                        (0, R.jsx)(`style`, {
                            dangerouslySetInnerHTML: {
                                __html: `
[data-radix-scroll-area-viewport] {
  scrollbar-width: none;
  -ms-overflow-style: none;
  -webkit-overflow-scrolling: touch;
}
[data-radix-scroll-area-viewport]::-webkit-scrollbar {
  display: none;
}
:where([data-radix-scroll-area-viewport]) {
  display: flex;
  flex-direction: column;
  align-items: stretch;
}
:where([data-radix-scroll-area-content]) {
  flex-grow: 1;
}
`,
                            },
                            nonce: a,
                        }),
                        (0, R.jsx)(H.div, {
                            'data-radix-scroll-area-viewport': ``,
                            ...o,
                            asChild: i,
                            ref: c,
                            style: {
                                overflowX: s.scrollbarXEnabled ? `scroll` : `hidden`,
                                overflowY: s.scrollbarYEnabled ? `scroll` : `hidden`,
                                ...e.style,
                            },
                            children: ie({ asChild: i, children: r }, (e) =>
                                (0, R.jsx)(`div`, {
                                    'data-radix-scroll-area-content': ``,
                                    ref: s.onContentChange,
                                    style: {
                                        minWidth: s.scrollbarXEnabled
                                            ? `fit-content`
                                            : void 0,
                                    },
                                    children: e,
                                }),
                            ),
                        }),
                    ],
                });
            })),
            (Te.displayName = we),
            (q = `ScrollAreaScrollbar`),
            (Ee = j.forwardRef((e, t) => {
                let { forceMount: n, ...r } = e,
                    i = K(q, e.__scopeScrollArea),
                    { onScrollbarXEnabledChange: a, onScrollbarYEnabledChange: o } = i,
                    s = e.orientation === `horizontal`;
                return (
                    j.useEffect(
                        () => (
                            s ? a(!0) : o(!0),
                            () => {
                                s ? a(!1) : o(!1);
                            }
                        ),
                        [s, a, o],
                    ),
                    i.type === `hover`
                        ? (0, R.jsx)(De, { ...r, ref: t, forceMount: n })
                        : i.type === `scroll`
                          ? (0, R.jsx)(Oe, { ...r, ref: t, forceMount: n })
                          : i.type === `auto`
                            ? (0, R.jsx)(ke, { ...r, ref: t, forceMount: n })
                            : i.type === `always`
                              ? (0, R.jsx)(J, { ...r, ref: t })
                              : null
                );
            })),
            (Ee.displayName = q),
            (De = j.forwardRef((e, t) => {
                let { forceMount: n, ...r } = e,
                    i = K(q, e.__scopeScrollArea),
                    [a, o] = j.useState(!1);
                return (
                    j.useEffect(() => {
                        let e = i.scrollArea,
                            t = 0;
                        if (e) {
                            let n = () => {
                                    (window.clearTimeout(t), o(!0));
                                },
                                r = () => {
                                    t = window.setTimeout(() => o(!1), i.scrollHideDelay);
                                };
                            return (
                                e.addEventListener(`pointerenter`, n),
                                e.addEventListener(`pointerleave`, r),
                                () => {
                                    (window.clearTimeout(t),
                                        e.removeEventListener(`pointerenter`, n),
                                        e.removeEventListener(`pointerleave`, r));
                                }
                            );
                        }
                    }, [i.scrollArea, i.scrollHideDelay]),
                    (0, R.jsx)(W, {
                        present: n || a,
                        children: (0, R.jsx)(ke, {
                            'data-state': a ? `visible` : `hidden`,
                            ...r,
                            ref: t,
                        }),
                    })
                );
            })),
            (Oe = j.forwardRef((e, t) => {
                let { forceMount: n, ...r } = e,
                    i = K(q, e.__scopeScrollArea),
                    a = e.orientation === `horizontal`,
                    o = D(() => c(`SCROLL_END`), 100),
                    [s, c] = x(`hidden`, {
                        hidden: { SCROLL: `scrolling` },
                        scrolling: { SCROLL_END: `idle`, POINTER_ENTER: `interacting` },
                        interacting: { SCROLL: `interacting`, POINTER_LEAVE: `idle` },
                        idle: {
                            HIDE: `hidden`,
                            SCROLL: `scrolling`,
                            POINTER_ENTER: `interacting`,
                        },
                    });
                return (
                    j.useEffect(() => {
                        if (s === `idle`) {
                            let e = window.setTimeout(() => c(`HIDE`), i.scrollHideDelay);
                            return () => window.clearTimeout(e);
                        }
                    }, [s, i.scrollHideDelay, c]),
                    j.useEffect(() => {
                        let e = i.viewport,
                            t = a ? `scrollLeft` : `scrollTop`;
                        if (e) {
                            let n = e[t],
                                r = () => {
                                    let r = e[t];
                                    (n !== r && (c(`SCROLL`), o()), (n = r));
                                };
                            return (
                                e.addEventListener(`scroll`, r),
                                () => e.removeEventListener(`scroll`, r)
                            );
                        }
                    }, [i.viewport, a, c, o]),
                    (0, R.jsx)(W, {
                        present: n || s !== `hidden`,
                        children: (0, R.jsx)(J, {
                            'data-state': s === `hidden` ? `hidden` : `visible`,
                            ...r,
                            ref: t,
                            onPointerEnter: b(e.onPointerEnter, () => c(`POINTER_ENTER`)),
                            onPointerLeave: b(e.onPointerLeave, () => c(`POINTER_LEAVE`)),
                        }),
                    })
                );
            })),
            (ke = j.forwardRef((e, t) => {
                let n = K(q, e.__scopeScrollArea),
                    { forceMount: r, ...i } = e,
                    [a, o] = j.useState(!1),
                    s = e.orientation === `horizontal`,
                    c = D(() => {
                        if (n.viewport) {
                            let e = n.viewport.offsetWidth < n.viewport.scrollWidth,
                                t = n.viewport.offsetHeight < n.viewport.scrollHeight;
                            o(s ? e : t);
                        }
                    }, 10);
                return (
                    O(n.viewport, c),
                    O(n.content, c),
                    (0, R.jsx)(W, {
                        present: r || a,
                        children: (0, R.jsx)(J, {
                            'data-state': a ? `visible` : `hidden`,
                            ...i,
                            ref: t,
                        }),
                    })
                );
            })),
            (J = j.forwardRef((e, t) => {
                let { orientation: n = `vertical`, ...r } = e,
                    i = K(q, e.__scopeScrollArea),
                    a = j.useRef(null),
                    o = j.useRef(0),
                    [s, c] = j.useState({
                        content: 0,
                        viewport: 0,
                        scrollbar: { size: 0, paddingStart: 0, paddingEnd: 0 },
                    }),
                    l = C(s.viewport, s.content),
                    u = {
                        ...r,
                        sizes: s,
                        onSizesChange: c,
                        hasThumb: l > 0 && l < 1,
                        onThumbChange: (e) => (a.current = e),
                        onThumbPointerUp: () => (o.current = 0),
                        onThumbPointerDown: (e) => (o.current = e),
                    };
                function d(e, t) {
                    return T(e, o.current, s, t);
                }
                return n === `horizontal`
                    ? (0, R.jsx)(Ae, {
                          ...u,
                          ref: t,
                          onThumbPositionChange: () => {
                              if (i.viewport && a.current) {
                                  let e = i.viewport.scrollLeft,
                                      t = E(e, s, i.dir);
                                  a.current.style.transform = `translate3d(${t}px, 0, 0)`;
                              }
                          },
                          onWheelScroll: (e) => {
                              i.viewport && (i.viewport.scrollLeft = e);
                          },
                          onDragScroll: (e) => {
                              i.viewport && (i.viewport.scrollLeft = d(e, i.dir));
                          },
                      })
                    : n === `vertical`
                      ? (0, R.jsx)(je, {
                            ...u,
                            ref: t,
                            onThumbPositionChange: () => {
                                if (i.viewport && a.current) {
                                    let e = i.viewport.scrollTop,
                                        t = E(e, s);
                                    a.current.style.transform = `translate3d(0, ${t}px, 0)`;
                                }
                            },
                            onWheelScroll: (e) => {
                                i.viewport && (i.viewport.scrollTop = e);
                            },
                            onDragScroll: (e) => {
                                i.viewport && (i.viewport.scrollTop = d(e));
                            },
                        })
                      : null;
            })),
            (Ae = j.forwardRef((e, t) => {
                let { sizes: n, onSizesChange: r, ...i } = e,
                    a = K(q, e.__scopeScrollArea),
                    [o, s] = j.useState(),
                    c = j.useRef(null),
                    u = l(t, c, a.onScrollbarXChange);
                return (
                    j.useEffect(() => {
                        c.current && s(getComputedStyle(c.current));
                    }, [c]),
                    (0, R.jsx)(Pe, {
                        'data-orientation': `horizontal`,
                        ...i,
                        ref: u,
                        sizes: n,
                        style: {
                            bottom: 0,
                            left:
                                a.dir === `rtl`
                                    ? `var(--radix-scroll-area-corner-width)`
                                    : 0,
                            right:
                                a.dir === `ltr`
                                    ? `var(--radix-scroll-area-corner-width)`
                                    : 0,
                            '--radix-scroll-area-thumb-width': w(n) + `px`,
                            ...e.style,
                        },
                        onThumbPointerDown: (t) => e.onThumbPointerDown(t.x),
                        onDragScroll: (t) => e.onDragScroll(t.x),
                        onWheelScroll: (t, n) => {
                            if (a.viewport) {
                                let r = a.viewport.scrollLeft + t.deltaX;
                                (e.onWheelScroll(r), re(r, n) && t.preventDefault());
                            }
                        },
                        onResize: () => {
                            c.current &&
                                a.viewport &&
                                o &&
                                r({
                                    content: a.viewport.scrollWidth,
                                    viewport: a.viewport.offsetWidth,
                                    scrollbar: {
                                        size: c.current.clientWidth,
                                        paddingStart: S(o.paddingLeft),
                                        paddingEnd: S(o.paddingRight),
                                    },
                                });
                        },
                    })
                );
            })),
            (je = j.forwardRef((e, t) => {
                let { sizes: n, onSizesChange: r, ...i } = e,
                    a = K(q, e.__scopeScrollArea),
                    [o, s] = j.useState(),
                    c = j.useRef(null),
                    u = l(t, c, a.onScrollbarYChange);
                return (
                    j.useEffect(() => {
                        c.current && s(getComputedStyle(c.current));
                    }, [c]),
                    (0, R.jsx)(Pe, {
                        'data-orientation': `vertical`,
                        ...i,
                        ref: u,
                        sizes: n,
                        style: {
                            top: 0,
                            right: a.dir === `ltr` ? 0 : void 0,
                            left: a.dir === `rtl` ? 0 : void 0,
                            bottom: `var(--radix-scroll-area-corner-height)`,
                            '--radix-scroll-area-thumb-height': w(n) + `px`,
                            ...e.style,
                        },
                        onThumbPointerDown: (t) => e.onThumbPointerDown(t.y),
                        onDragScroll: (t) => e.onDragScroll(t.y),
                        onWheelScroll: (t, n) => {
                            if (a.viewport) {
                                let r = a.viewport.scrollTop + t.deltaY;
                                (e.onWheelScroll(r), re(r, n) && t.preventDefault());
                            }
                        },
                        onResize: () => {
                            c.current &&
                                a.viewport &&
                                o &&
                                r({
                                    content: a.viewport.scrollHeight,
                                    viewport: a.viewport.offsetHeight,
                                    scrollbar: {
                                        size: c.current.clientHeight,
                                        paddingStart: S(o.paddingTop),
                                        paddingEnd: S(o.paddingBottom),
                                    },
                                });
                        },
                    })
                );
            })),
            ([Me, Ne] = be(q)),
            (Pe = j.forwardRef((e, t) => {
                let {
                        __scopeScrollArea: n,
                        sizes: r,
                        hasThumb: i,
                        onThumbChange: a,
                        onThumbPointerUp: o,
                        onThumbPointerDown: s,
                        onThumbPositionChange: c,
                        onDragScroll: u,
                        onWheelScroll: d,
                        onResize: ee,
                        ...f
                    } = e,
                    p = K(q, n),
                    [m, h] = j.useState(null),
                    te = l(t, (e) => h(e)),
                    g = j.useRef(null),
                    v = j.useRef(``),
                    y = p.viewport,
                    x = r.content - r.viewport,
                    S = _(d),
                    C = _(c),
                    w = D(ee, 10);
                function T(e) {
                    g.current &&
                        u({
                            x: e.clientX - g.current.left,
                            y: e.clientY - g.current.top,
                        });
                }
                return (
                    j.useEffect(() => {
                        let e = (e) => {
                            let t = e.target;
                            m?.contains(t) && S(e, x);
                        };
                        return (
                            document.addEventListener(`wheel`, e, { passive: !1 }),
                            () =>
                                document.removeEventListener(`wheel`, e, { passive: !1 })
                        );
                    }, [y, m, x, S]),
                    j.useEffect(C, [r, C]),
                    O(m, w),
                    O(p.content, w),
                    (0, R.jsx)(Me, {
                        scope: n,
                        scrollbar: m,
                        hasThumb: i,
                        onThumbChange: _(a),
                        onThumbPointerUp: _(o),
                        onThumbPositionChange: C,
                        onThumbPointerDown: _(s),
                        children: (0, R.jsx)(H.div, {
                            ...f,
                            ref: te,
                            style: { position: `absolute`, ...f.style },
                            onPointerDown: b(e.onPointerDown, (e) => {
                                e.button === 0 &&
                                    (e.target.setPointerCapture(e.pointerId),
                                    (g.current = m.getBoundingClientRect()),
                                    (v.current = document.body.style.webkitUserSelect),
                                    (document.body.style.webkitUserSelect = `none`),
                                    p.viewport &&
                                        (p.viewport.style.scrollBehavior = `auto`),
                                    T(e));
                            }),
                            onPointerMove: b(e.onPointerMove, T),
                            onPointerUp: b(e.onPointerUp, (e) => {
                                let t = e.target;
                                (t.hasPointerCapture(e.pointerId) &&
                                    t.releasePointerCapture(e.pointerId),
                                    (document.body.style.webkitUserSelect = v.current),
                                    p.viewport && (p.viewport.style.scrollBehavior = ``),
                                    (g.current = null));
                            }),
                        }),
                    })
                );
            })),
            (Y = `ScrollAreaThumb`),
            (Fe = j.forwardRef((e, t) => {
                let { forceMount: n, ...r } = e,
                    i = Ne(Y, e.__scopeScrollArea);
                return (0, R.jsx)(W, {
                    present: n || i.hasThumb,
                    children: (0, R.jsx)(Ie, { ref: t, ...r }),
                });
            })),
            (Ie = j.forwardRef((e, t) => {
                let { __scopeScrollArea: n, style: r, ...i } = e,
                    a = K(Y, n),
                    o = Ne(Y, n),
                    { onThumbPositionChange: s } = o,
                    c = l(t, (e) => o.onThumbChange(e)),
                    u = j.useRef(),
                    d = D(() => {
                        u.current &&= (u.current(), void 0);
                    }, 100);
                return (
                    j.useEffect(() => {
                        let e = a.viewport;
                        if (e) {
                            let t = () => {
                                (d(), !u.current && ((u.current = ze(e, s)), s()));
                            };
                            return (
                                s(),
                                e.addEventListener(`scroll`, t),
                                () => e.removeEventListener(`scroll`, t)
                            );
                        }
                    }, [a.viewport, d, s]),
                    (0, R.jsx)(H.div, {
                        'data-state': o.hasThumb ? `visible` : `hidden`,
                        ...i,
                        ref: c,
                        style: {
                            width: `var(--radix-scroll-area-thumb-width)`,
                            height: `var(--radix-scroll-area-thumb-height)`,
                            ...r,
                        },
                        onPointerDownCapture: b(e.onPointerDownCapture, (e) => {
                            let t = e.target.getBoundingClientRect(),
                                n = e.clientX - t.left,
                                r = e.clientY - t.top;
                            o.onThumbPointerDown({ x: n, y: r });
                        }),
                        onPointerUp: b(e.onPointerUp, o.onThumbPointerUp),
                    })
                );
            })),
            (Fe.displayName = Y),
            (X = `ScrollAreaCorner`),
            (Le = j.forwardRef((e, t) => {
                let n = K(X, e.__scopeScrollArea),
                    r = !!(n.scrollbarX && n.scrollbarY);
                return n.type !== `scroll` && r ? (0, R.jsx)(Re, { ...e, ref: t }) : null;
            })),
            (Le.displayName = X),
            (Re = j.forwardRef((e, t) => {
                let { __scopeScrollArea: n, ...r } = e,
                    i = K(X, n),
                    [a, o] = j.useState(0),
                    [s, c] = j.useState(0),
                    l = !!(a && s);
                return (
                    O(i.scrollbarX, () => {
                        let e = i.scrollbarX?.offsetHeight || 0;
                        (i.onCornerHeightChange(e), c(e));
                    }),
                    O(i.scrollbarY, () => {
                        let e = i.scrollbarY?.offsetWidth || 0;
                        (i.onCornerWidthChange(e), o(e));
                    }),
                    l
                        ? (0, R.jsx)(H.div, {
                              ...r,
                              ref: t,
                              style: {
                                  width: a,
                                  height: s,
                                  position: `absolute`,
                                  right: i.dir === `ltr` ? 0 : void 0,
                                  left: i.dir === `rtl` ? 0 : void 0,
                                  bottom: 0,
                                  ...e.style,
                              },
                          })
                        : null
                );
            })),
            (ze = (e, t = () => {}) => {
                let n = { left: e.scrollLeft, top: e.scrollTop },
                    r = 0;
                return (
                    (function i() {
                        let a = { left: e.scrollLeft, top: e.scrollTop },
                            o = n.left !== a.left,
                            s = n.top !== a.top;
                        ((o || s) && t(), (n = a), (r = window.requestAnimationFrame(i)));
                    })(),
                    () => window.cancelAnimationFrame(r)
                );
            }),
            (Be = Ce),
            (Ve = Te),
            (He = Ee),
            (Ue = Fe),
            (We = Le),
            (Ge = i(Be)(({ scrollbarsize: e, offset: t }) => ({
                width: `100%`,
                height: `100%`,
                overflow: `hidden`,
                '--scrollbar-size': `${e + t}px`,
                '--radix-scroll-area-thumb-width': `${e}px`,
            }))),
            (Ke = i(Ve)(({ focusable: e, theme: t }) => ({
                width: `100%`,
                height: `100%`,
                '&:focus': e
                    ? { outline: `2px solid ${t.color.secondary}`, outlineOffset: -2 }
                    : {},
            }))),
            (qe = i(He)(({ offset: e, horizontal: t, vertical: n }) => ({
                display: `flex`,
                userSelect: `none`,
                touchAction: `none`,
                background: `transparent`,
                transition: `all 0.2s ease-out`,
                borderRadius: `var(--scrollbar-size)`,
                zIndex: 1,
                '&[data-orientation="vertical"]': {
                    width: `var(--scrollbar-size)`,
                    paddingRight: e,
                    marginTop: e,
                    marginBottom: t === `true` && n === `true` ? 0 : e,
                },
                '&[data-orientation="horizontal"]': {
                    flexDirection: `column`,
                    height: `var(--scrollbar-size)`,
                    paddingBottom: e,
                    marginLeft: e,
                    marginRight: t === `true` && n === `true` ? 0 : e,
                },
            }))),
            (Je = i(Ue)(({ theme: e }) => ({
                flex: 1,
                background: e.textMutedColor,
                opacity: 0.5,
                borderRadius: `var(--scrollbar-size)`,
                position: `relative`,
                transition: `opacity 0.2s ease-out`,
                zIndex: 1,
                '&:hover': { opacity: 0.8 },
                '::before': {
                    content: `""`,
                    position: `absolute`,
                    top: `50%`,
                    left: `50%`,
                    transform: `translate(-50%,-50%)`,
                    width: `100%`,
                    height: `100%`,
                },
            }))),
            (Z = (0, A.forwardRef)(
                (
                    {
                        children: e,
                        horizontal: t = !1,
                        vertical: n = !1,
                        offset: r = 2,
                        scrollbarSize: i = 6,
                        scrollPadding: a = 0,
                        className: o,
                        focusable: s = !1,
                    },
                    c,
                ) =>
                    A.createElement(
                        Ge,
                        { scrollbarsize: i, offset: r, className: o },
                        A.createElement(
                            Ke,
                            {
                                ref: c,
                                style: { scrollPadding: a },
                                tabIndex: s ? 0 : void 0,
                                focusable: s,
                            },
                            e,
                        ),
                        t &&
                            A.createElement(
                                qe,
                                {
                                    orientation: `horizontal`,
                                    offset: r,
                                    horizontal: t.toString(),
                                    vertical: n.toString(),
                                },
                                A.createElement(Je, null),
                            ),
                        n &&
                            A.createElement(
                                qe,
                                {
                                    orientation: `vertical`,
                                    offset: r,
                                    horizontal: t.toString(),
                                    vertical: n.toString(),
                                },
                                A.createElement(Je, null),
                            ),
                        t && n && A.createElement(We, null),
                    ),
            )),
            (Z.displayName = `ScrollArea`),
            ({ global: Ye } = __STORYBOOK_MODULE_GLOBAL__),
            ({ document: Q, window: $ } = Ye));
    });
export { Xe as i, Z as n, se as r, _e as t };
