'use strict';

var Accordion = require('./Accordion-BoTckTBI.js');
var Alert = require('./Alert-DnIUdIE3.js');
var Avatar = require('./Avatar-CNao5gvP.js');
var Badge = require('./Badge-_-PRf6aq.js');
var Button = require('./Button-BniJ4TT_.js');
var Callout = require('./Callout-CVNpjTde.js');
var Checkbox = require('./Checkbox-DOlS2oCD.js');
var ColorPicker = require('./ColorPicker-Uxgn8U0h.js');
var DatePicker = require('./DatePicker-C0BwxIh8.js');
var TimePicker = require('./TimePicker-DReL0GSv.js');
require('./TimePickerPanel-DGNr97cj.js');
var pureDayjs = require('dayjs');
var localeData = require('dayjs/plugin/localeData');
var utc = require('dayjs/plugin/utc');
var weekday = require('dayjs/plugin/weekday');
var weekOfYear = require('dayjs/plugin/weekOfYear');
var TranslationProvider = require('./TranslationProvider-DBZHXmzX.js');
var DirectionProvider = require('./DirectionProvider-Bec-6U8p.js');
var Dialog = require('./Dialog-CtI_yWsJ.js');
var components_DropdownMenu = require('./components/DropdownMenu.js');
var Empty = require('./Empty-CfPLWsLK.js');
var Input = require('./Input-pkugjUb0.js');
var Kbd = require('./Kbd-DHirsI--.js');
var Label = require('./Label-B7FbeB5i.js');
var Pagination = require('./Pagination-Byzt9Kmj.js');
var RadioGroup = require('./RadioGroup-1RAoe38m.js');
var Select = require('./Select-nifsTqzo.js');
var MultiEmailInput = require('./MultiEmailInput-l0_YVjbp.js');
var Sheet = require('./Sheet-BTZe2VQk.js');
var Popover = require('./Popover-DRT0YYzK.js');
var Progress = require('./Progress-DoCxZ_ZH.js');
var Slider = require('./Slider-jNUS9vt8.js');
var Spinner = require('./Spinner-DQutDMQq.js');
var Stepper = require('./Stepper-DCoLl2ZS.js');
var Toastr = require('./Toastr-BGp7-kmf.js');
var Switch = require('./Switch-CFf8DtB_.js');
var Tabs = require('./Tabs-D2247rd7.js');
var Textarea = require('./Textarea-BfdlAJ59.js');
var Tooltip = require('./Tooltip-criVUtIg.js');
var Typography = require('./Typography-DaZ0HTha.js');
var DataTable = require('./DataTable-Dg0pX7Ng.js');
var Tree = require('./Tree-BPd0DuLh.js');
var TreeSelect = require('./TreeSelect-BoffO6qD.js');
var useMobile = require('./use-mobile-B-UYxtqX.js');
var utils = require('./utils-CTr7wn5d.js');
require('react/jsx-runtime');
require('react');
require('./primitives/Accordion.js');
require('./chevron-down-CPsWSS51.js');
require('./createLucideIcon-D0tRgV6l.js');
require('./chevron-up-BpwpBnZU.js');
require('./index-CGUGhyIp.js');
require('./index-Ch55j1or.js');
require('./index-D-iDn9RI.js');
require('./index-COPkC3I5.js');
require('./index-CyrAgb4H.js');
require('./index-CCdG4z4E.js');
require('./index-DMbj7vXd.js');
require('react-dom');
require('./index-BiGm7NEA.js');
require('./index-DcCSSgb7.js');
require('./index-BwAq9ba8.js');
require('./index-BY6wgiQV.js');
require('react-i18next');
require('./primitives/Dialog.js');
require('./button--P7-oIJb.js');
require('./index-BZhTddX0.js');
require('./index-DuNgWCXZ.js');
require('./dialog-CWSpiRjk.js');
require('./x-Brw3FJst.js');
require('./index-BLGrl3PF.js');
require('./index-Bvu9MiFi.js');
require('./index-lWVw05cs.js');
require('./index-ChSOMM8b.js');
require('./index-Df-Ffa3s.js');
require('./primitives/Avatar.js');
require('./index-DnKJmaCq.js');
require('./index-BrpkRQoS.js');
require('./primitives/Tooltip.js');
require('./tooltip-C-568jEL.js');
require('./index-C9ICrOhM.js');
require('./floating-ui.react-dom-B4Aw6O7R.js');
require('./index-Bf0WsHta.js');
require('./index-CB9xFokC.js');
require('./renderIcon-fLF3odqg.js');
require('./primitives/Badge.js');
require('react-router-dom');
require('./primitives/Button.js');
require('./primitives/Spinner.js');
require('./loader-circle-Bw7zP2Gn.js');
require('./primitives/Alert.js');
require('./triangle-alert-ZUMRpmzW.js');
require('./primitives/Checkbox.js');
require('./check-BQgcDXys.js');
require('./index-CF951Pw9.js');
require('./primitives/Field.js');
require('./label-Bdc9ytTI.js');
require('./separator-CPy2gyg1.js');
require('react-colorful');
require('./primitives/Popover.js');
require('./Calendar-jVF8fRaS.js');
require('./chevron-left-BldoOh5p.js');
require('./chevron-right-0jNdwX2Q.js');
require('./primitives/ScrollArea.js');
require('./index-EyWRfsCG.js');
require('i18next');
require('./primitives/DropdownMenu.js');
require('./index-D1SiRLYs.js');
require('./index-DoVhdseB.js');
require('./primitives/ButtonGroup.js');
require('./primitives/Empty.js');
require('./primitives/InputGroup.js');
require('./input-group-CFZl_aQS.js');
require('./input-CgKPISj_.js');
require('./textarea-CZSSY75H.js');
require('./primitives/Kbd.js');
require('./primitives/Label.js');
require('./primitives/Pagination.js');
require('./ellipsis-4aubOI2n.js');
require('./primitives/RadioGroup.js');
require('./SelectFieldWrapper-DEA--2wj.js');
require('./primitives/Combobox.js');
require('./with-selector-DeKHbQY7.js');
require('./primitives/Sheet.js');
require('./sheet-BZt84aab.js');
require('./primitives/HoverCard.js');
require('./primitives/Progress.js');
require('./primitives/Slider.js');
require('./index-Vlwnyfvs.js');
require('./primitives/Switch.js');
require('./primitives/Tabs.js');
require('./primitives/Textarea.js');
require('./primitives/Table.js');
require('./redux-DEF7lAd1.js');

function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }

var pureDayjs__default = /*#__PURE__*/_interopDefault(pureDayjs);
var localeData__default = /*#__PURE__*/_interopDefault(localeData);
var utc__default = /*#__PURE__*/_interopDefault(utc);
var weekday__default = /*#__PURE__*/_interopDefault(weekday);
var weekOfYear__default = /*#__PURE__*/_interopDefault(weekOfYear);

const typeToPos = {
    year: 0,
    month: 1,
    day: 2,
    hour: 3,
    minute: 4,
    second: 5,
};
const dateTimeFormatDefaults = {
    year: "numeric",
    month: "2-digit",
    day: "2-digit",
    hour: "2-digit",
    minute: "2-digit",
    second: "2-digit",
};
const dtfCache = new Map();
const getDateTimeFormat = (timezone, options = {}) => {
    const timeZoneName = options.timeZoneName || "short";
    const key = `${timezone}|${timeZoneName}`;
    let dtf = dtfCache.get(key);
    if (!dtf) {
        dtf = new Intl.DateTimeFormat("en-US", {
            ...dateTimeFormatDefaults,
            hour12: false,
            timeZone: timezone,
            timeZoneName,
        });
        dtfCache.set(key, dtf);
    }
    return dtf;
};
const localeStringifierCache = new Map();
const getLocaleStringifier = (timezone) => {
    let localeStringifier = localeStringifierCache.get(timezone);
    if (!localeStringifier) {
        localeStringifier = new Intl.DateTimeFormat("en-US", {
            ...dateTimeFormatDefaults,
            timeZone: timezone,
        });
        localeStringifierCache.set(timezone, localeStringifier);
    }
    return localeStringifier;
};
const timezonePlugin = (_o, c, d) => {
    let defaultTimezone;
    const dayjsFactory = d;
    const dayjsClass = c;
    const makeFormatParts = (timestamp, timezone, options = {}) => {
        const date = new Date(timestamp);
        const dtf = getDateTimeFormat(timezone, options);
        return dtf.formatToParts(date);
    };
    const tzOffset = (timestamp, timezone) => {
        const formatResult = makeFormatParts(timestamp, timezone);
        const filled = [];
        for (let i = 0; i < formatResult.length; i += 1) {
            const { type, value } = formatResult[i];
            const pos = typeToPos[type];
            if (pos >= 0) {
                filled[pos] = parseInt(value, 10);
            }
        }
        const hour = filled[3];
        const fixedHour = hour === 24 ? 0 : hour;
        const utcString = `${filled[0]}-${filled[1]}-${filled[2]} ${fixedHour}:${filled[4]}:${filled[5]}:000`;
        const utcTs = dayjsFactory.utc(utcString).valueOf();
        let asTS = Number(timestamp);
        const over = asTS % 1000;
        asTS -= over;
        return (utcTs - asTS) / (60 * 1000);
    };
    const fixOffset = (localTS, o0, tz) => {
        let utcGuess = localTS - o0 * 60 * 1000;
        const o2 = tzOffset(utcGuess, tz);
        if (o0 === o2) {
            return [utcGuess, o0];
        }
        utcGuess -= (o2 - o0) * 60 * 1000;
        const o3 = tzOffset(utcGuess, tz);
        if (o2 === o3) {
            return [utcGuess, o2];
        }
        return [localTS - Math.min(o2, o3) * 60 * 1000, Math.max(o2, o3)];
    };
    const proto = dayjsClass.prototype;
    proto.tz = function (timezone = defaultTimezone, keepLocalTime) {
        const oldOffset = this.utcOffset();
        const date = this.toDate();
        const target = getLocaleStringifier(timezone).format(date);
        const diff = Math.round((date.getTime() - new Date(target).getTime()) / 1000 / 60);
        let ins = dayjsFactory(target)
            .$set("millisecond", this.$ms)
            .utcOffset(-Math.round(date.getTimezoneOffset() / 15) * 15 - diff, true);
        if (keepLocalTime) {
            const newOffset = ins.utcOffset();
            ins = ins.add(oldOffset - newOffset, "minute");
        }
        ins.$x.$timezone = timezone;
        return ins;
    };
    proto.offsetName = function (type) {
        const zone = this.$x.$timezone || dayjsFactory.tz.guess();
        const result = makeFormatParts(this.valueOf(), zone, {
            timeZoneName: type,
        }).find((m) => m.type.toLowerCase() === "timezonename");
        return result && result.value;
    };
    const oldStartOf = proto.startOf;
    proto.startOf = function (units, startOf) {
        if (!this.$x || !this.$x.$timezone) {
            return oldStartOf.call(this, units, startOf);
        }
        const withoutTz = dayjsFactory(this.format("YYYY-MM-DD HH:mm:ss:SSS"));
        const startOfWithoutTz = oldStartOf.call(withoutTz, units, startOf);
        return startOfWithoutTz.tz(this.$x.$timezone, true);
    };
    const tzFunction = function (input, arg1, arg2) {
        const parseFormat = arg2 && arg1;
        const timezone = arg2 || arg1 || defaultTimezone;
        const previousOffset = tzOffset(Number(dayjsFactory()), timezone);
        if (typeof input !== "string") {
            return dayjsFactory(input).tz(timezone);
        }
        const localTs = dayjsFactory.utc(input, parseFormat).valueOf();
        const [targetTs, targetOffset] = fixOffset(localTs, previousOffset, timezone);
        const ins = dayjsFactory(targetTs).utcOffset(targetOffset);
        ins.$x.$timezone = timezone;
        return ins;
    };
    tzFunction.guess = function () {
        return Intl.DateTimeFormat().resolvedOptions().timeZone;
    };
    tzFunction.setDefault = function (timezone) {
        defaultTimezone = timezone;
    };
    dayjsFactory.tz = tzFunction;
};

pureDayjs__default.default.extend(weekOfYear__default.default);
pureDayjs__default.default.extend(weekday__default.default);
pureDayjs__default.default.extend(localeData__default.default);
pureDayjs__default.default.extend(utc__default.default);
pureDayjs__default.default.extend(timezonePlugin);
class LRUCache {
    limit;
    cache;
    constructor(limit) {
        this.limit = limit;
        this.cache = new Map();
    }
    get(key) {
        const value = this.cache.get(key);
        this.cache.delete(key);
        if (value !== undefined) {
            this.cache.set(key, value);
        }
        return value;
    }
    set(key, value) {
        if (this.cache.size >= this.limit) {
            const oldestKey = this.cache.keys().next().value;
            if (oldestKey !== undefined) {
                this.cache.delete(oldestKey);
            }
        }
        this.cache.set(key, value);
    }
    has(key) {
        return this.cache.has(key);
    }
}
const hasTimezone = (dateString) => {
    const timezoneRegex = /Z|[+-]\d{2}:\d{2}$|[+-]\d{4}$|GMT([+-]\d{4})?$/;
    return timezoneRegex.test(dateString);
};
const cache = new LRUCache(1000);
const pureDayjsWithTz = pureDayjs__default.default;
const dayjs = (...args) => {
    const cacheKey = JSON.stringify(args);
    if (cache.has(cacheKey) && args[0] !== undefined)
        return cache.get(cacheKey);
    const userTimezone = pureDayjsWithTz.tz()?.$x?.$timezone;
    const browserTimezone = pureDayjsWithTz.tz.guess();
    const timezone = userTimezone || browserTimezone;
    if (userTimezone === browserTimezone || userTimezone === undefined) {
        const result = pureDayjsWithTz(...args);
        if (args[0] !== undefined)
            cache.set(cacheKey, result);
        return result;
    }
    const mutableArgs = [...args];
    if (mutableArgs.length > 0 &&
        (typeof mutableArgs[0] === "string" || mutableArgs[0] === null)) {
        const pureDayjsArgs = [mutableArgs[0], mutableArgs[1]];
        if (typeof mutableArgs[0] === "string" && hasTimezone(mutableArgs[0])) {
            mutableArgs[0] = pureDayjsWithTz(...pureDayjsArgs);
        }
        else {
            mutableArgs[0] = pureDayjsWithTz(...pureDayjsArgs).format("YYYY-MM-DD HH:mm:ss");
            mutableArgs[1] = "YYYY-MM-DD HH:mm:ss";
        }
    }
    if (mutableArgs[0]?.toString() === "Invalid Date") {
        const result = pureDayjsWithTz(...mutableArgs);
        if (mutableArgs[0] !== undefined)
            cache.set(cacheKey, result);
        return result;
    }
    const result = mutableArgs.length === 2
        ? pureDayjsWithTz.tz(mutableArgs[0], mutableArgs[1], timezone)
        : pureDayjsWithTz.tz(mutableArgs[0], timezone);
    if (mutableArgs[0] !== undefined)
        cache.set(cacheKey, result);
    return result;
};
Object.assign(dayjs, { ...pureDayjs__default.default });
const getTimezoneAppliedDateTime = (inputDateTime) => {
    const timezoneAppliedDateTime = (date) => date && typeof date.format === "function"
        ? dayjs(date.format("YYYY-MM-DD HH:mm:ss"))
        : null;
    return Array.isArray(inputDateTime)
        ? inputDateTime.map(timezoneAppliedDateTime)
        : timezoneAppliedDateTime(inputDateTime);
};

exports.Accordion = Accordion.Accordion;
exports.Alert = Alert.Alert;
exports.Avatar = Avatar.AvatarNamespace;
exports.Badge = Badge.Badge;
exports.Button = Button.Button;
exports.Callout = Callout.Callout;
exports.Checkbox = Checkbox.Checkbox;
exports.ColorPicker = ColorPicker.ColorPicker;
exports.DatePicker = DatePicker.DatePicker;
exports.TimePicker = TimePicker.TimePicker;
exports.TranslationProvider = TranslationProvider.TranslationProvider;
exports.translations = TranslationProvider.resources;
exports.DirectionProvider = DirectionProvider.DirectionProvider;
exports.Dialog = Dialog.Dialog;
exports.DropdownMenu = components_DropdownMenu.DropdownMenu;
exports.Empty = Empty.Empty;
exports.Input = Input.Input;
exports.Kbd = Kbd.KbdNamespace;
exports.Label = Label.Label;
exports.Pagination = Pagination.Pagination;
exports.RadioGroup = RadioGroup.RadioGroup;
exports.Select = Select.Select;
exports.MultiEmailInput = MultiEmailInput.MultiEmailInput;
exports.Sheet = Sheet.Sheet;
exports.Popover = Popover.Popover;
exports.Progress = Progress.Progress;
exports.Slider = Slider.Slider;
exports.Spinner = Spinner.Spinner;
exports.Stepper = Stepper.Stepper;
exports.Toastr = Toastr.Toastr;
exports.Switch = Switch.Switch;
exports.Tabs = Tabs.Tabs;
exports.Textarea = Textarea.Textarea;
exports.Tooltip = Tooltip.Tooltip;
exports.Typography = Typography.Typography;
exports.typographyVariants = Typography.typographyVariants;
exports.DataTable = DataTable.DataTable;
exports.useColumnOrdering = DataTable.useColumnOrdering;
exports.useColumnPinning = DataTable.useColumnPinning;
exports.useColumnVisibility = DataTable.useColumnVisibility;
exports.useTablePagination = DataTable.useTablePagination;
exports.useTableSelection = DataTable.useTableSelection;
exports.useTableSort = DataTable.useTableSort;
exports.Tree = Tree.Tree;
exports.TreeSelect = TreeSelect.TreeSelect;
exports.useIsMobile = useMobile.useIsMobile;
exports.cn = utils.cn;
exports.dayjs = dayjs;
exports.getTimezoneAppliedDateTime = getTimezoneAppliedDateTime;
//# sourceMappingURL=index.js.map
