import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
import { OnlineStatusAccountOfflineIcon } from '../../../lib/icons/OnlineStatusAccountOffline.js';
import { OnlineStatusDeviceOfflineIcon } from '../../../lib/icons/OnlineStatusDeviceOffline.js';
import { OnlineStatusOnlineIcon } from '../../../lib/icons/OnlineStatusOnline.js';
export function OnlineStatus(props) {
    const { device } = props;
    return (_jsx("div", { className: 'seam-online-status', children: isDeviceAccountOffline(device) ? (_jsx(AccountOfflineContent, {})) : (_jsx(AccountOnlineContent, { isOnline: device.properties.online })) }));
}
function AccountOfflineContent() {
    return (_jsxs(_Fragment, { children: [_jsx(OnlineStatusAccountOfflineIcon, {}), _jsx("span", { className: 'seam-text-danger', children: t.accountOffline })] }));
}
function AccountOnlineContent(props) {
    const { isOnline } = props;
    if (isOnline) {
        return (_jsxs(_Fragment, { children: [_jsx(OnlineStatusOnlineIcon, {}), _jsx("span", { className: 'seam-status-text', children: t.online })] }));
    }
    return (_jsxs(_Fragment, { children: [_jsx(OnlineStatusDeviceOfflineIcon, {}), _jsx("span", { className: 'seam-text-danger', children: t.deviceOffline })] }));
}
export const isDeviceAccountOffline = (device) => device.errors.filter((error) => error.error_code === 'account_disconnected')
    .length > 0;
const t = {
    online: 'Online',
    accountOffline: 'Account Offline',
    deviceOffline: 'Device Offline',
};
//# sourceMappingURL=OnlineStatus.js.map