bs-ad-calendar-react 1.3.2 → 1.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,78 +1,78 @@
1
- import { jsx as g, jsxs as S, Fragment as pe } from "react/jsx-runtime";
2
- import { useMemo as vt, useState as B, useEffect as Yt, useRef as Ft } from "react";
3
- const Q = [1943, 4, 14], Lt = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31], be = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31], W = [[[30, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31], 365], [[31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], 366], [[30, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31], 365], [[31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], 366], [[31, 31, 31, 32, 31, 31, 29, 30, 30, 29, 29, 31], 365], [[31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], 366], [[31, 31, 31, 32, 31, 31, 29, 30, 30, 29, 30, 30], 365], [[31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], 366], [[31, 31, 31, 32, 31, 31, 29, 30, 30, 29, 30, 30], 365], [[31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 29, 30, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31], 366], [[31, 31, 31, 32, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31], 366], [[31, 31, 31, 32, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], 366], [[30, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31], 365], [[31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 31, 32, 31, 32, 30, 30, 29, 30, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], 366], [[30, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31], 365], [[31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], 366], [[30, 32, 31, 32, 31, 31, 29, 30, 30, 29, 29, 31], 365], [[31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], 366], [[31, 31, 31, 32, 31, 31, 29, 30, 30, 29, 30, 30], 365], [[31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], 366], [[31, 31, 31, 32, 31, 31, 29, 30, 30, 29, 30, 30], 365], [[31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 29, 30, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], 366], [[31, 31, 31, 32, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31], 366], [[31, 31, 31, 32, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31], 366], [[31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 31, 32, 31, 32, 30, 30, 29, 30, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], 366], [[30, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31], 365], [[31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], 366], [[30, 32, 31, 32, 31, 31, 29, 30, 29, 30, 29, 31], 365], [[31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], 366], [[31, 31, 31, 32, 31, 31, 29, 30, 30, 29, 29, 31], 365], [[31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], 366], [[31, 31, 31, 32, 31, 31, 29, 30, 30, 29, 30, 30], 365], [[31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 29, 30, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], 366], [[31, 31, 31, 32, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31], 366], [[31, 31, 31, 32, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31], 366], [[31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], 366], [[30, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31], 365], [[31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], 366], [[30, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31], 365], [[31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], 366], [[31, 31, 31, 32, 31, 31, 29, 30, 30, 29, 29, 31], 365], [[31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], 366], [[31, 31, 31, 32, 31, 31, 29, 30, 30, 29, 30, 30], 365], [[31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30], 365]];
1
+ import { jsxs as C, jsx as g, Fragment as pe } from "react/jsx-runtime";
2
+ import { useMemo as mt, useState as H, useEffect as Dt, useRef as xt } from "react";
3
+ const tt = [1943, 4, 14], Lt = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31], Se = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31], _ = [[[30, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31], 365], [[31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], 366], [[30, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31], 365], [[31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], 366], [[31, 31, 31, 32, 31, 31, 29, 30, 30, 29, 29, 31], 365], [[31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], 366], [[31, 31, 31, 32, 31, 31, 29, 30, 30, 29, 30, 30], 365], [[31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], 366], [[31, 31, 31, 32, 31, 31, 29, 30, 30, 29, 30, 30], 365], [[31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 29, 30, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31], 366], [[31, 31, 31, 32, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31], 366], [[31, 31, 31, 32, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], 366], [[30, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31], 365], [[31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 31, 32, 31, 32, 30, 30, 29, 30, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], 366], [[30, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31], 365], [[31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], 366], [[30, 32, 31, 32, 31, 31, 29, 30, 30, 29, 29, 31], 365], [[31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], 366], [[31, 31, 31, 32, 31, 31, 29, 30, 30, 29, 30, 30], 365], [[31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], 366], [[31, 31, 31, 32, 31, 31, 29, 30, 30, 29, 30, 30], 365], [[31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 29, 30, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], 366], [[31, 31, 31, 32, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31], 366], [[31, 31, 31, 32, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31], 366], [[31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 31, 32, 31, 32, 30, 30, 29, 30, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], 366], [[30, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31], 365], [[31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], 366], [[30, 32, 31, 32, 31, 31, 29, 30, 29, 30, 29, 31], 365], [[31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], 366], [[31, 31, 31, 32, 31, 31, 29, 30, 30, 29, 29, 31], 365], [[31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], 366], [[31, 31, 31, 32, 31, 31, 29, 30, 30, 29, 30, 30], 365], [[31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 29, 30, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], 366], [[31, 31, 31, 32, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31], 366], [[31, 31, 31, 32, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31], 366], [[31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], 366], [[30, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31], 365], [[31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], 366], [[30, 32, 31, 32, 31, 30, 30, 30, 29, 30, 29, 31], 365], [[31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], 366], [[31, 31, 31, 32, 31, 31, 29, 30, 30, 29, 29, 31], 365], [[31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30], 365], [[31, 32, 31, 32, 31, 30, 30, 30, 29, 29, 30, 31], 366], [[31, 31, 31, 32, 31, 31, 29, 30, 30, 29, 30, 30], 365], [[31, 31, 32, 31, 31, 31, 30, 29, 30, 29, 30, 30], 365], [[31, 31, 32, 32, 31, 30, 30, 29, 30, 29, 30, 30], 365]];
4
4
  let Rt = class extends Error {
5
5
  constructor(t) {
6
6
  super(t), this.name = "DateOutOfRangeError";
7
7
  }
8
8
  };
9
- const _t = () => Q[0] + 1, jt = () => Q[0] + W.length - 1, Pt = () => 2e3, Wt = () => 2e3 + W.length - 1, yt = (e) => e % 400 === 0 || e % 4 === 0 && e % 100 !== 0, kt = (e) => yt(e) ? be : Lt, Se = (e, t, n) => !(e < _t() || e > jt() || t < 1 || t > 12 || n < 1 || n > kt(e)[t - 1]), xt = (e, t, n) => {
9
+ const _t = () => tt[0] + 1, jt = () => tt[0] + _.length - 1, Pt = () => 2e3, Wt = () => 2e3 + _.length - 1, yt = (e) => e % 400 === 0 || e % 4 === 0 && e % 100 !== 0, Ct = (e) => yt(e) ? Se : Lt, be = (e, t, n) => !(e < _t() || e > jt() || t < 1 || t > 12 || n < 1 || n > Ct(e)[t - 1]), Nt = (e, t, n) => {
10
10
  let a = e * 365 + n;
11
11
  for (let s = 0; s < t - 1; s++) a += Lt[s];
12
12
  return t <= 2 && (e -= 1), a += Math.floor(e / 4) - Math.floor(e / 100) + Math.floor(e / 400), a;
13
13
  };
14
14
  function Ee(e, t, n) {
15
15
  const a = t + 1;
16
- if (!Se(e, a, n)) throw new Rt("Date out of range");
17
- let s = 2e3, r = 1, o = 1, u = Math.abs(xt(e, a, n) - xt(...Q)), i = 0;
18
- for (; u >= W[i][1]; ) u -= W[i][1], s += 1, i += 1;
16
+ if (!be(e, a, n)) throw new Rt("Date out of range");
17
+ let s = 2e3, r = 1, o = 1, i = Math.abs(Nt(e, a, n) - Nt(...tt)), u = 0;
18
+ for (; i >= _[u][1]; ) i -= _[u][1], s += 1, u += 1;
19
19
  let h = 0;
20
- for (; u >= W[i][0][h]; ) u -= W[i][0][h], r += 1, h += 1;
21
- return o += u, [s, r - 1, o];
20
+ for (; i >= _[u][0][h]; ) i -= _[u][0][h], r += 1, h += 1;
21
+ return o += i, [s, r - 1, o];
22
22
  }
23
- const we = (e, t, n) => !(e < Pt() || e > Wt() || t < 1 || t > 12 || n < 1 || n > W[e - 2e3][0][t - 1]), Ye = (e, t, n) => {
23
+ const we = (e, t, n) => !(e < Pt() || e > Wt() || t < 1 || t > 12 || n < 1 || n > _[e - 2e3][0][t - 1]), Ye = (e, t, n) => {
24
24
  let a = n - 1;
25
25
  const s = e - 2e3;
26
- for (let r = 0; r < t - 1; r++) a += W[s][0][r];
27
- for (let r = 0; r < s; r++) a += W[r][1];
26
+ for (let r = 0; r < t - 1; r++) a += _[s][0][r];
27
+ for (let r = 0; r < s; r++) a += _[r][1];
28
28
  return a;
29
29
  }, ke = (e, t, n) => {
30
30
  const a = t + 1;
31
31
  if (!we(e, a, n)) throw new Rt("Date out of range");
32
- let [s, r, o] = [Q[0], 1, 1];
33
- const u = kt(s).slice(0, Q[1] - 1).reduce((f, d) => f + d, 0) + Q[2] - 1;
34
- let i = Math.abs(Ye(e, a, n) + u);
35
- for (; i >= 366 && yt(s) || i >= 365 && !yt(s); ) i -= yt(s) ? 366 : 365, s += 1;
36
- const h = kt(s);
32
+ let [s, r, o] = [tt[0], 1, 1];
33
+ const i = Ct(s).slice(0, tt[1] - 1).reduce((f, l) => f + l, 0) + tt[2] - 1;
34
+ let u = Math.abs(Ye(e, a, n) + i);
35
+ for (; u >= 366 && yt(s) || u >= 365 && !yt(s); ) u -= yt(s) ? 366 : 365, s += 1;
36
+ const h = Ct(s);
37
37
  let c = 0;
38
- for (; i >= h[c]; ) i -= h[c], r += 1, c += 1;
39
- return o += i, [s, r - 1, o];
40
- }, J = { enMinYear: _t, enMaxYear: jt, npMinYear: Pt, npMaxYear: Wt, englishToNepali: Ee, nepaliToEnglish: ke }, Ut = "en", L = "ne", Jt = 207e5, Vt = 198e5, Ce = 5049018e5, Ae = new Date(1986, 0, 1, 0, 15), Mt = ["Baisakh", "Jestha", "Asar", "Shrawan", "Bhadra", "Aswin", "Kartik", "Mangsir", "Poush", "Magh", "Falgun", "Chaitra"], Ct = ["Bai", "Jes", "Asa", "Shr", "Bhd", "Asw", "Kar", "Man", "Pou", "Mag", "Fal", "Cha"], Kt = ["बैशाख", "जेठ", "असार", "श्रावण", "भाद्र", "आश्विन", "कार्तिक", "मंसिर", "पौष", "माघ", "फाल्गुण", "चैत्र"], $e = ["बै", "जे", "अ", "श्रा", "भा", "आ", "का", "मं", "पौ", "मा", "फा", "चै"], At = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"], $t = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], ve = ["जनवरी", "फेब्रुअरी", "मार्च", "अप्रिल", "मे", "जुन", "जुलाई", "अगस्ट", "सेप्टेम्बर", "अक्टोबर", "नोभेम्बर", "डिसेम्बर"], Fe = ["जन", "फेब", "मार", "अप्रि", "मे", "जुन", "जुला", "अग", "सेप", "अक्टो", "नोभे", "डिसे"], Gt = ["०", "१", "२", "३", "४", "५", "६", "७", "८", "९"], tt = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], pt = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], zt = ["आइत", "सोम", "मंगल", "बुध", "बिहि", "शुक्र", "शनि"], qt = ["आइतबार", "सोमबार", "मंगलबार", "बुधबार", "बिहिबार", "शुक्रबार", "शनिबार"], xe = /(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DD?|ddd?d?|do?|YYYY|YY|y{2,4}|yo?|a|A|hh?|HH?|mm?|ss?|SSS|x|X|.)/g, Ne = (e) => {
41
- const t = e.getTime(), n = t < Ce ? Vt : Jt, a = new Date(t + n), s = a.getUTCFullYear(), r = a.getUTCMonth(), o = a.getUTCDate(), u = a.getUTCHours(), i = a.getUTCMinutes(), h = a.getUTCSeconds(), c = a.getUTCMilliseconds(), f = a.getUTCDay();
42
- return { year: s, month0: r, day: o, hour: u, minute: i, second: h, ms: c, weekDay: f };
43
- }, Nt = (e, t, n, a, s, r, o) => {
44
- const u = new Date(e, t, n, a, s, r, o);
45
- let i = u < Ae ? Vt : Jt;
46
- const h = -1 * u.getTimezoneOffset() * 60 * 1e3;
47
- return new Date(u.getTime() - i + h);
38
+ for (; u >= h[c]; ) u -= h[c], r += 1, c += 1;
39
+ return o += u, [s, r - 1, o];
40
+ }, W = { enMinYear: _t, enMaxYear: jt, npMinYear: Pt, npMaxYear: Wt, englishToNepali: Ee, nepaliToEnglish: ke }, Ut = "en", T = "ne", Jt = 207e5, Kt = 198e5, Ce = 5049018e5, $e = new Date(1986, 0, 1, 0, 15), pt = ["Baisakh", "Jestha", "Asar", "Shrawan", "Bhadra", "Aswin", "Kartik", "Mangsir", "Poush", "Magh", "Falgun", "Chaitra"], $t = ["Bai", "Jes", "Asa", "Shr", "Bhd", "Asw", "Kar", "Man", "Pou", "Mag", "Fal", "Cha"], Gt = ["बैशाख", "जेठ", "असार", "श्रावण", "भाद्र", "आश्विन", "कार्तिक", "मंसिर", "पौष", "माघ", "फाल्गुण", "चैत्र"], Ae = ["बै", "जे", "अ", "श्रा", "भा", "आ", "का", "मं", "पौ", "मा", "फा", "चै"], At = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"], vt = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], ve = ["जनवरी", "फेब्रुअरी", "मार्च", "अप्रिल", "मे", "जुन", "जुलाई", "अगस्ट", "सेप्टेम्बर", "अक्टोबर", "नोभेम्बर", "डिसेम्बर"], Fe = ["जन", "फेब", "मार", "अप्रि", "मे", "जुन", "जुला", "अग", "सेप", "अक्टो", "नोभे", "डिसे"], zt = ["०", "१", "२", "३", "४", "५", "६", "७", "८", "९"], et = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], St = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], Vt = ["आइत", "सोम", "मंगल", "बुध", "बिहि", "शुक्र", "शनि"], qt = ["आइतबार", "सोमबार", "मंगलबार", "बुधबार", "बिहिबार", "शुक्रबार", "शनिबार"], xe = /(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DD?|ddd?d?|do?|YYYY|YY|y{2,4}|yo?|a|A|hh?|HH?|mm?|ss?|SSS|x|X|.)/g, Ne = (e) => {
41
+ const t = e.getTime(), n = t < Ce ? Kt : Jt, a = new Date(t + n), s = a.getUTCFullYear(), r = a.getUTCMonth(), o = a.getUTCDate(), i = a.getUTCHours(), u = a.getUTCMinutes(), h = a.getUTCSeconds(), c = a.getUTCMilliseconds(), f = a.getUTCDay();
42
+ return { year: s, month0: r, day: o, hour: i, minute: u, second: h, ms: c, weekDay: f };
43
+ }, Ht = (e, t, n, a, s, r, o) => {
44
+ const i = new Date(e, t, n, a, s, r, o);
45
+ let u = i < $e ? Kt : Jt;
46
+ const h = -1 * i.getTimezoneOffset() * 60 * 1e3;
47
+ return new Date(i.getTime() - u + h);
48
48
  }, bt = (e) => {
49
49
  const t = e.match(xe);
50
50
  return t ? t.map((n) => n.startsWith("[") && n.endsWith("]") ? n.slice(1, -1) : n) : [];
51
- }, P = (e) => {
51
+ }, R = (e) => {
52
52
  if (e.length === 0) return new RegExp("");
53
53
  let t = [...e];
54
54
  if (t = t.sort((a, s) => s.length - a.length), t[0] === "") return new RegExp("");
55
55
  const n = `(${t.join("|")})`;
56
56
  return new RegExp(n);
57
- }, x = (e) => e.toString().padStart(2, "0"), Xt = (e) => e.toString().padStart(3, "0"), He = (e) => e.split("").map((t) => Gt[t.charCodeAt(0) - 48]).join(""), b = (e, t) => {
57
+ }, x = (e) => e.toString().padStart(2, "0"), Xt = (e) => e.toString().padStart(3, "0"), He = (e) => e.split("").map((t) => zt[t.charCodeAt(0) - 48]).join(""), Y = (e, t) => {
58
58
  const n = typeof e == "string" ? e : String(e);
59
- return t !== L ? n : He(n);
60
- }, Oe = (e, t) => b(e.getYear(), t).substring(2), Te = (e, t) => b(e.getYear(), t), Be = (e, t) => b(e.getEnglishYear(), t).substring(2), Ie = (e, t) => b(e.getEnglishYear(), t), Le = (e, t) => b(e.getMonth() + 1, t), Re = (e, t) => b(x(e.getMonth() + 1), t), _e = (e, t) => t === L ? $e[e.getMonth()] : Ct[e.getMonth()], je = (e, t) => t === L ? Kt[e.getMonth()] : Mt[e.getMonth()], Pe = (e, t) => b(e.getEnglishMonth() + 1, t), We = (e, t) => b(x(e.getEnglishMonth() + 1), t), Ue = (e, t) => t === L ? Fe[e.getEnglishMonth()] : $t[e.getEnglishMonth()], Je = (e, t) => t === L ? ve[e.getEnglishMonth()] : At[e.getEnglishMonth()], Ve = (e, t) => b(e.getDate(), t), Ke = (e, t) => b(x(e.getDate()), t), Ge = (e, t) => b(e.getEnglishDate(), t), ze = (e, t) => b(x(e.getEnglishDate()), t), Zt = (e, t) => b(e.getDay(), t), Dt = (e, t) => t === L ? zt[e.getDay()] : tt[e.getDay()], Qt = (e, t) => t === L ? qt[e.getDay()] : pt[e.getDay()], te = (e, t) => b(e.getHours(), t), ee = (e, t) => b(x(e.getHours()), t), ne = (e, t) => {
59
+ return t !== T ? n : He(n);
60
+ }, Oe = (e, t) => Y(e.getYear(), t).substring(2), Be = (e, t) => Y(e.getYear(), t), Te = (e, t) => Y(e.getEnglishYear(), t).substring(2), Ie = (e, t) => Y(e.getEnglishYear(), t), Le = (e, t) => Y(e.getMonth() + 1, t), Re = (e, t) => Y(x(e.getMonth() + 1), t), _e = (e, t) => t === T ? Ae[e.getMonth()] : $t[e.getMonth()], je = (e, t) => t === T ? Gt[e.getMonth()] : pt[e.getMonth()], Pe = (e, t) => Y(e.getEnglishMonth() + 1, t), We = (e, t) => Y(x(e.getEnglishMonth() + 1), t), Ue = (e, t) => t === T ? Fe[e.getEnglishMonth()] : vt[e.getEnglishMonth()], Je = (e, t) => t === T ? ve[e.getEnglishMonth()] : At[e.getEnglishMonth()], Ke = (e, t) => Y(e.getDate(), t), Ge = (e, t) => Y(x(e.getDate()), t), ze = (e, t) => Y(e.getEnglishDate(), t), Ve = (e, t) => Y(x(e.getEnglishDate()), t), Zt = (e, t) => Y(e.getDay(), t), ft = (e, t) => t === T ? Vt[e.getDay()] : et[e.getDay()], Qt = (e, t) => t === T ? qt[e.getDay()] : St[e.getDay()], te = (e, t) => Y(e.getHours(), t), ee = (e, t) => Y(x(e.getHours()), t), ne = (e, t) => {
61
61
  const n = e.getHours(), a = n > 12 ? n - 12 : n;
62
- return b(a, t);
62
+ return Y(a, t);
63
63
  }, se = (e, t) => {
64
64
  const n = e.getHours(), a = n > 12 ? n - 12 : n;
65
- return b(x(a), t);
66
- }, ae = (e, t) => b(e.getMinutes(), t), re = (e, t) => b(x(e.getMinutes()), t), oe = (e, t) => b(e.getSeconds(), t), ie = (e, t) => b(x(e.getSeconds()), t), ue = (e, t) => b(Xt(e.getMilliseconds()), t), ce = (e, t) => t === L ? e.getHours() >= 12 ? "पिम" : "एम" : e.getHours() >= 12 ? "PM" : "AM", he = (e, t) => t === L ? e.getHours() >= 12 ? "पिम" : "एम" : e.getHours() >= 12 ? "pm" : "am", Ht = { YY: Oe, YYYY: Te, M: Le, MM: Re, MMM: _e, MMMM: je, D: Ve, DD: Ke, d: Zt, dd: Dt, ddd: Dt, dddd: Qt, H: te, HH: ee, h: ne, hh: se, m: ae, mm: re, s: oe, ss: ie, SSS: ue, A: ce, a: he }, le = (e, t, n) => {
67
- const a = bt(t), s = (r) => r in Ht ? Ht[r](e, n) : r;
68
- return a.map(s).join("");
69
- }, qe = (e, t) => le(e, t, Ut), Xe = (e, t) => le(e, t, L), Ze = (e) => {
70
- const t = x(e.getYear()), n = x(e.getMonth() + 1), a = x(e.getDate()), s = x(e.getHours()), r = x(e.getMinutes()), o = x(e.getSeconds()), u = e.getMilliseconds(), i = u === 0 ? "" : `.${Xt(u)}`;
71
- return `${t}-${n}-${a} ${s}:${r}:${o}${i}`;
72
- }, Ot = { YY: Be, YYYY: Ie, M: Pe, MM: We, MMM: Ue, MMMM: Je, D: Ge, DD: ze, d: Zt, dd: Dt, ddd: Dt, dddd: Qt, H: te, HH: ee, h: ne, hh: se, m: ae, mm: re, s: oe, ss: ie, SSS: ue, A: ce, a: he }, de = (e, t, n) => {
65
+ return Y(x(a), t);
66
+ }, ae = (e, t) => Y(e.getMinutes(), t), re = (e, t) => Y(x(e.getMinutes()), t), oe = (e, t) => Y(e.getSeconds(), t), ie = (e, t) => Y(x(e.getSeconds()), t), ue = (e, t) => Y(Xt(e.getMilliseconds()), t), ce = (e, t) => t === T ? e.getHours() >= 12 ? "पिम" : "एम" : e.getHours() >= 12 ? "PM" : "AM", he = (e, t) => t === T ? e.getHours() >= 12 ? "पिम" : "एम" : e.getHours() >= 12 ? "pm" : "am", Ot = { YY: Oe, YYYY: Be, M: Le, MM: Re, MMM: _e, MMMM: je, D: Ke, DD: Ge, d: Zt, dd: ft, ddd: ft, dddd: Qt, H: te, HH: ee, h: ne, hh: se, m: ae, mm: re, s: oe, ss: ie, SSS: ue, A: ce, a: he }, le = (e, t, n) => {
73
67
  const a = bt(t), s = (r) => r in Ot ? Ot[r](e, n) : r;
74
68
  return a.map(s).join("");
75
- }, Qe = (e, t) => de(e, t, Ut), t3 = (e, t) => de(e, t, L);
69
+ }, qe = (e, t) => le(e, t, Ut), Xe = (e, t) => le(e, t, T), Ze = (e) => {
70
+ const t = x(e.getYear()), n = x(e.getMonth() + 1), a = x(e.getDate()), s = x(e.getHours()), r = x(e.getMinutes()), o = x(e.getSeconds()), i = e.getMilliseconds(), u = i === 0 ? "" : `.${Xt(i)}`;
71
+ return `${t}-${n}-${a} ${s}:${r}:${o}${u}`;
72
+ }, Bt = { YY: Te, YYYY: Ie, M: Pe, MM: We, MMM: Ue, MMMM: Je, D: ze, DD: Ve, d: Zt, dd: ft, ddd: ft, dddd: Qt, H: te, HH: ee, h: ne, hh: se, m: ae, mm: re, s: oe, ss: ie, SSS: ue, A: ce, a: he }, de = (e, t, n) => {
73
+ const a = bt(t), s = (r) => r in Bt ? Bt[r](e, n) : r;
74
+ return a.map(s).join("");
75
+ }, Qe = (e, t) => de(e, t, Ut), t3 = (e, t) => de(e, t, T);
76
76
  function e3(e) {
77
77
  const t = e.split(/[-./]/, 3), [n, a = 1, s = 1] = t.map((r) => {
78
78
  const o = parseInt(r, 10);
@@ -83,19 +83,19 @@ function e3(e) {
83
83
  }
84
84
  function n3(e) {
85
85
  if (!e) return [0, 0, 0, 0];
86
- const [t, n = "0"] = e.split(".", 2), a = t.split(":", 3), [s, r = 0, o = 0] = a.map((i) => {
87
- const h = parseInt(i, 10);
86
+ const [t, n = "0"] = e.split(".", 2), a = t.split(":", 3), [s, r = 0, o = 0] = a.map((u) => {
87
+ const h = parseInt(u, 10);
88
88
  if (Number.isNaN(h)) throw new Error("Invalid time");
89
89
  return h;
90
90
  });
91
- let u = parseInt(n, 10);
92
- return Number.isNaN(u) && (u = 0), [s, r, o, u];
91
+ let i = parseInt(n, 10);
92
+ return Number.isNaN(i) && (i = 0), [s, r, o, i];
93
93
  }
94
94
  function s3(e) {
95
- const [t, n] = e.split(" ", 2), [a, s, r] = e3(t), [o, u, i, h] = n3(n);
96
- return [a, s, r, o, u, i, h];
95
+ const [t, n] = e.split(" ", 2), [a, s, r] = e3(t), [o, i, u, h] = n3(n);
96
+ return [a, s, r, o, i, u, h];
97
97
  }
98
- const Tt = { YY: /(\d\d)/, YYYY: /(\d\d\d\d)/, M: /(1[0-2]|0[1-9]|[1-9])/, MM: /(1[0-2]|0[1-9]|[1-9])/, D: /(3[0-2]|[1-2]\d|0[1-9]|[1-9]| [1-9])/, DD: /(3[0-2]|[1-2]\d|0[1-9]|[1-9]| [1-9])/, H: /(2[0-3]|[0-1]\d|\d)/, HH: /(2[0-3]|[0-1]\d|\d)/, hh: /(1[0-2]|0[1-9]|[1-9])/, mm: /([0-5]\d|\d)/, ss: /([0-5]\d|\d)/, SSS: /(\d\d\d)/, A: /(AM|PM)/, a: /(am|pm)/, MMMM: P(Mt), MMM: P(Ct), dddd: P(pt), ddd: P(tt), dd: P(tt), d: /([0-6])/ };
98
+ const Tt = { YY: /(\d\d)/, YYYY: /(\d\d\d\d)/, M: /(1[0-2]|0[1-9]|[1-9])/, MM: /(1[0-2]|0[1-9]|[1-9])/, D: /(3[0-2]|[1-2]\d|0[1-9]|[1-9]| [1-9])/, DD: /(3[0-2]|[1-2]\d|0[1-9]|[1-9]| [1-9])/, H: /(2[0-3]|[0-1]\d|\d)/, HH: /(2[0-3]|[0-1]\d|\d)/, hh: /(1[0-2]|0[1-9]|[1-9])/, mm: /([0-5]\d|\d)/, ss: /([0-5]\d|\d)/, SSS: /(\d\d\d)/, A: /(AM|PM)/, a: /(am|pm)/, MMMM: R(pt), MMM: R($t), dddd: R(St), ddd: R(et), dd: R(et), d: /([0-6])/ };
99
99
  function a3(e) {
100
100
  const t = [], n = [];
101
101
  for (const s of e) s in Tt ? (t.push(s), n.push(Tt[s].source)) : n.push(s.replace(/[-\/\\^$*+?.()|[\]{}]/g, "\\$&"));
@@ -103,129 +103,129 @@ function a3(e) {
103
103
  return { dateTokens: t, regex: new RegExp(`^${a}$`) };
104
104
  }
105
105
  function r3(e, t) {
106
- let [n, a, s, r, o, u, i, h] = [0, 1, 1, 0, 0, 0, 0, 0], c = !1, f = !1;
107
- for (let d = 0; d < e.length; d++) {
108
- const k = e[d], m = parseInt(t[d + 1]);
109
- switch (k) {
106
+ let [n, a, s, r, o, i, u, h] = [0, 1, 1, 0, 0, 0, 0, 0], c = !1, f = !1;
107
+ for (let l = 0; l < e.length; l++) {
108
+ const $ = e[l], D = parseInt(t[l + 1]);
109
+ switch ($) {
110
110
  case "YYYY":
111
- n = m;
111
+ n = D;
112
112
  break;
113
113
  case "YY":
114
- n = 2e3 + parseInt(t[d]);
114
+ n = 2e3 + parseInt(t[l]);
115
115
  break;
116
116
  case "MM":
117
117
  case "M":
118
- a = m;
118
+ a = D;
119
119
  break;
120
120
  case "MMMM":
121
- a = Mt.indexOf(t[d + 1]) + 1;
121
+ a = pt.indexOf(t[l + 1]) + 1;
122
122
  break;
123
123
  case "MMM":
124
- a = Ct.indexOf(t[d + 1]) + 1;
124
+ a = $t.indexOf(t[l + 1]) + 1;
125
125
  break;
126
126
  case "DD":
127
127
  case "D":
128
- s = m;
128
+ s = D;
129
129
  break;
130
130
  case "HH":
131
131
  case "H":
132
- r = m;
132
+ r = D;
133
133
  break;
134
134
  case "hh":
135
135
  case "h":
136
- o = m, f = !0;
136
+ o = D, f = !0;
137
137
  break;
138
138
  case "mm":
139
139
  case "m":
140
- u = m;
140
+ i = D;
141
141
  break;
142
142
  case "ss":
143
143
  case "s":
144
- i = m;
144
+ u = D;
145
145
  break;
146
146
  case "SSS":
147
- h = m;
147
+ h = D;
148
148
  break;
149
149
  case "A":
150
150
  case "a":
151
- c = t[d + 1].toLowerCase() === "pm";
151
+ c = t[l + 1].toLowerCase() === "pm";
152
152
  }
153
153
  }
154
- return f && (r = o + (c ? 12 : 0)), { year: n, month0: a - 1, day: s, hour: r, minute: u, second: i, ms: h };
154
+ return f && (r = o + (c ? 12 : 0)), { year: n, month0: a - 1, day: s, hour: r, minute: i, second: u, ms: h };
155
155
  }
156
156
  function ge(e, t) {
157
157
  const n = bt(t), { dateTokens: a, regex: s } = a3(n), r = RegExp(s).exec(e);
158
158
  if (!r) throw new Error("Invalid date format");
159
- const { year: o, month0: u, day: i, hour: h, minute: c, second: f, ms: d } = r3(a, r);
160
- return [o, u, i, h, c, f, d];
159
+ const { year: o, month0: i, day: u, hour: h, minute: c, second: f, ms: l } = r3(a, r);
160
+ return [o, i, u, h, c, f, l];
161
161
  }
162
- const Bt = { YY: /(\d\d)/, YYYY: /(\d\d\d\d)/, M: /(1[0-2]|0[1-9]|[1-9])/, MM: /(1[0-2]|0[1-9]|[1-9])/, D: /(3[0-2]|[1-2]\d|0[1-9]|[1-9]| [1-9])/, DD: /(3[0-2]|[1-2]\d|0[1-9]|[1-9]| [1-9])/, H: /(2[0-3]|[0-1]\d|\d)/, HH: /(2[0-3]|[0-1]\d|\d)/, hh: /(1[0-2]|0[1-9]|[1-9])/, mm: /([0-5]\d|\d)/, ss: /([0-5]\d|\d)/, SSS: /(\d\d\d)/, A: /(AM|PM)/, a: /(am|pm)/, MMMM: P(At), MMM: P($t), dddd: P(pt), ddd: P(tt), dd: P(tt), d: /([0-6])/ };
162
+ const It = { YY: /(\d\d)/, YYYY: /(\d\d\d\d)/, M: /(1[0-2]|0[1-9]|[1-9])/, MM: /(1[0-2]|0[1-9]|[1-9])/, D: /(3[0-2]|[1-2]\d|0[1-9]|[1-9]| [1-9])/, DD: /(3[0-2]|[1-2]\d|0[1-9]|[1-9]| [1-9])/, H: /(2[0-3]|[0-1]\d|\d)/, HH: /(2[0-3]|[0-1]\d|\d)/, hh: /(1[0-2]|0[1-9]|[1-9])/, mm: /([0-5]\d|\d)/, ss: /([0-5]\d|\d)/, SSS: /(\d\d\d)/, A: /(AM|PM)/, a: /(am|pm)/, MMMM: R(At), MMM: R(vt), dddd: R(St), ddd: R(et), dd: R(et), d: /([0-6])/ };
163
163
  function o3(e) {
164
164
  const t = [], n = [];
165
- for (const s of e) s in Bt ? (t.push(s), n.push(Bt[s].source)) : n.push(s.replace(/[-\/\\^$*+?.()|[\]{}]/g, "\\$&"));
165
+ for (const s of e) s in It ? (t.push(s), n.push(It[s].source)) : n.push(s.replace(/[-\/\\^$*+?.()|[\]{}]/g, "\\$&"));
166
166
  const a = n.join("");
167
167
  return { dateTokens: t, regex: new RegExp(`^${a}$`) };
168
168
  }
169
169
  function i3(e, t) {
170
- let [n, a, s, r, o, u, i, h] = [0, 1, 1, 0, 0, 0, 0, 0], c = !1, f = !1;
171
- for (let d = 0; d < e.length; d++) {
172
- const k = e[d], m = parseInt(t[d + 1]);
173
- switch (k) {
170
+ let [n, a, s, r, o, i, u, h] = [0, 1, 1, 0, 0, 0, 0, 0], c = !1, f = !1;
171
+ for (let l = 0; l < e.length; l++) {
172
+ const $ = e[l], D = parseInt(t[l + 1]);
173
+ switch ($) {
174
174
  case "YYYY":
175
- n = m;
175
+ n = D;
176
176
  break;
177
177
  case "YY":
178
- n = 2e3 + parseInt(t[d]);
178
+ n = 2e3 + parseInt(t[l]);
179
179
  break;
180
180
  case "MM":
181
181
  case "M":
182
- a = m;
182
+ a = D;
183
183
  break;
184
184
  case "MMMM":
185
- a = At.indexOf(t[d + 1]) + 1;
185
+ a = At.indexOf(t[l + 1]) + 1;
186
186
  break;
187
187
  case "MMM":
188
- a = $t.indexOf(t[d + 1]) + 1;
188
+ a = vt.indexOf(t[l + 1]) + 1;
189
189
  break;
190
190
  case "DD":
191
191
  case "D":
192
- s = m;
192
+ s = D;
193
193
  break;
194
194
  case "HH":
195
195
  case "H":
196
- r = m;
196
+ r = D;
197
197
  break;
198
198
  case "hh":
199
199
  case "h":
200
- o = m, f = !0;
200
+ o = D, f = !0;
201
201
  break;
202
202
  case "mm":
203
203
  case "m":
204
- u = m;
204
+ i = D;
205
205
  break;
206
206
  case "ss":
207
207
  case "s":
208
- i = m;
208
+ u = D;
209
209
  break;
210
210
  case "SSS":
211
- h = m;
211
+ h = D;
212
212
  break;
213
213
  case "A":
214
214
  case "a":
215
- c = t[d + 1].toLowerCase() === "pm";
215
+ c = t[l + 1].toLowerCase() === "pm";
216
216
  }
217
217
  }
218
- return f && (r = o + (c ? 12 : 0)), { year: n, month0: a - 1, day: s, hour: r, minute: u, second: i, ms: h };
218
+ return f && (r = o + (c ? 12 : 0)), { year: n, month0: a - 1, day: s, hour: r, minute: i, second: u, ms: h };
219
219
  }
220
220
  function u3(e, t) {
221
221
  const n = bt(t), { dateTokens: a, regex: s } = o3(n), r = RegExp(s).exec(e);
222
222
  if (!r) throw new Error("Invalid date format");
223
- const { year: o, month0: u, day: i, hour: h, minute: c, second: f, ms: d } = i3(a, r);
224
- return [o, u, i, h, c, f, d];
223
+ const { year: o, month0: i, day: u, hour: h, minute: c, second: f, ms: l } = i3(a, r);
224
+ return [o, i, u, h, c, f, l];
225
225
  }
226
226
  function c3(e) {
227
227
  const t = { एम: "AM", पिम: "PM" };
228
- Kt.forEach((a, s) => t[a] = Mt[s]), qt.forEach((a, s) => t[a] = pt[s]), zt.forEach((a, s) => t[a] = tt[s]), Gt.forEach((a, s) => t[a] = String(s));
228
+ Gt.forEach((a, s) => t[a] = pt[s]), qt.forEach((a, s) => t[a] = St[s]), Vt.forEach((a, s) => t[a] = et[s]), zt.forEach((a, s) => t[a] = String(s));
229
229
  const n = new RegExp(Object.keys(t).join("|"), "g");
230
230
  return e.replace(n, (a) => t[a]);
231
231
  }
@@ -233,23 +233,23 @@ function h3(e, t) {
233
233
  const n = c3(e);
234
234
  return ge(n, t);
235
235
  }
236
- class St extends Error {
236
+ class Et extends Error {
237
237
  constructor(t) {
238
238
  super(t), this.name = "ValidationError";
239
239
  }
240
240
  }
241
241
  const l3 = (e) => {
242
- if (e < 0 || e > 23) throw new St("Hour should be in the range 0-23");
242
+ if (e < 0 || e > 23) throw new Et("Hour should be in the range 0-23");
243
243
  }, d3 = (e) => {
244
- if (e < 0 || e > 59) throw new St("Minute should be in the range 0-59");
244
+ if (e < 0 || e > 59) throw new Et("Minute should be in the range 0-59");
245
245
  }, g3 = (e) => {
246
- if (e < 0 || e > 59) throw new St("Second should be in the range 0-59");
246
+ if (e < 0 || e > 59) throw new Et("Second should be in the range 0-59");
247
247
  }, m3 = (e) => {
248
- if (e < 0 || e > 999) throw new St("Millisecond should be in the range 0-999");
249
- }, f3 = (e, t, n, a) => {
248
+ if (e < 0 || e > 999) throw new Et("Millisecond should be in the range 0-999");
249
+ }, D3 = (e, t, n, a) => {
250
250
  l3(e), d3(t), g3(n), m3(a);
251
251
  };
252
- class Y {
252
+ class w {
253
253
  timestamp;
254
254
  year;
255
255
  yearEn;
@@ -263,7 +263,7 @@ class Y {
263
263
  constructor(...t) {
264
264
  if (t.length === 0) this.initFromCurrentDate();
265
265
  else if (t.length === 1 && t[0] instanceof Date) this.initFromEnglishDate(t[0]);
266
- else if (t.length === 1 && t[0] instanceof Y) this.initFromNepaliDate(t[0]);
266
+ else if (t.length === 1 && t[0] instanceof w) this.initFromNepaliDate(t[0]);
267
267
  else if (t.length === 1 && typeof t[0] == "string") this.parseFromString(t[0]);
268
268
  else if (t.length === 1 && typeof t[0] == "number") this.initFromTimestamp(t[0]);
269
269
  else if (t.length === 2 && typeof t[0] == "string" && typeof t[1] == "string") this.parseFromStringWithFormat(t[0], t[1]);
@@ -295,9 +295,9 @@ class Y {
295
295
  }
296
296
  _setDateObject(t, n = !0) {
297
297
  this.timestamp = t;
298
- const { year: a, month0: s, day: r, hour: o, minute: u, weekDay: i } = Ne(t);
299
- if (this.yearEn = a, this.monthEn = s, this.dayEn = r, this.hour = o, this.minute = u, this.weekDay = i, n) {
300
- const [h, c, f] = J.englishToNepali(a, s, r);
298
+ const { year: a, month0: s, day: r, hour: o, minute: i, weekDay: u } = Ne(t);
299
+ if (this.yearEn = a, this.monthEn = s, this.dayEn = r, this.hour = o, this.minute = i, this.weekDay = u, n) {
300
+ const [h, c, f] = W.englishToNepali(a, s, r);
301
301
  this.year = h, this.month = c, this.day = f;
302
302
  }
303
303
  }
@@ -364,10 +364,10 @@ class Y {
364
364
  setTime(t) {
365
365
  this._setDateObject(new Date(t));
366
366
  }
367
- set(t, n, a, s, r, o, u) {
368
- f3(s, r, o, u);
369
- const [i, h, c] = J.nepaliToEnglish(t, n, a);
370
- this.year = t, this.month = n, this.day = a, this._setDateObject(Nt(i, h, c, s, r, o, u), !1);
367
+ set(t, n, a, s, r, o, i) {
368
+ D3(s, r, o, i);
369
+ const [u, h, c] = W.nepaliToEnglish(t, n, a);
370
+ this.year = t, this.month = n, this.day = a, this._setDateObject(Ht(u, h, c, s, r, o, i), !1);
371
371
  }
372
372
  setDateObject(t) {
373
373
  this._setDateObject(t, !0);
@@ -387,35 +387,35 @@ class Y {
387
387
  formatEnglishDateInNepali(t) {
388
388
  return t3(this, t);
389
389
  }
390
- static fromEnglishDate(t, n, a, s = 0, r = 0, o = 0, u = 0) {
391
- const i = Nt(t, n, a, s, r, o, u);
392
- return new Y(i);
390
+ static fromEnglishDate(t, n, a, s = 0, r = 0, o = 0, i = 0) {
391
+ const u = Ht(t, n, a, s, r, o, i);
392
+ return new w(u);
393
393
  }
394
394
  static parseNepaliFormat(t, n) {
395
- const [a, s, r, o, u, i, h] = h3(t, n);
396
- return new Y(a, s, r, o, u, i, h);
395
+ const [a, s, r, o, i, u, h] = h3(t, n);
396
+ return new w(a, s, r, o, i, u, h);
397
397
  }
398
398
  static parseEnglishDate(t, n) {
399
- const [a, s, r, o, u, i, h] = u3(t, n);
400
- return Y.fromEnglishDate(a, s, r, o, u, i, h);
399
+ const [a, s, r, o, i, u, h] = u3(t, n);
400
+ return w.fromEnglishDate(a, s, r, o, i, u, h);
401
401
  }
402
402
  static getDaysOfMonth(t, n) {
403
- if (t < J.npMinYear() || t > J.npMaxYear()) throw new Error("Year out of range");
403
+ if (t < W.npMinYear() || t > W.npMaxYear()) throw new Error("Year out of range");
404
404
  if (n < 0 || n > 11) throw new Error("Month out of range");
405
- return W[t - J.npMinYear()][0][n];
405
+ return _[t - W.npMinYear()][0][n];
406
406
  }
407
407
  static minSupportedDate() {
408
- return Y.fromEnglishDate(J.enMinYear(), 0, 1).getDateObject();
408
+ return w.fromEnglishDate(W.enMinYear(), 0, 1).getDateObject();
409
409
  }
410
410
  static maxSupportedDate() {
411
- return Y.fromEnglishDate(J.enMaxYear(), 11, 31).getDateObject();
411
+ return w.fromEnglishDate(W.enMaxYear(), 11, 31).getDateObject();
412
412
  }
413
413
  static minSupportedNepaliDate() {
414
- return new Y(J.npMinYear(), 0, 1);
414
+ return new w(W.npMinYear(), 0, 1);
415
415
  }
416
416
  static maxSupportedNepaliDate() {
417
- const t = J.npMaxYear();
418
- return new Y(t, 11, this.getDaysOfMonth(t, 11));
417
+ const t = W.npMaxYear();
418
+ return new w(t, 11, this.getDaysOfMonth(t, 11));
419
419
  }
420
420
  static minimum() {
421
421
  return console.warn("`NepaliDate.minimum()` is deprecated and will be removed in a future version. Please use `NepaliDate.minSupportedDate()` instead."), this.minSupportedDate();
@@ -450,7 +450,7 @@ const y3 = [
450
450
  "Magh",
451
451
  "Falgun",
452
452
  "Chaitra"
453
- ], D3 = [
453
+ ], f3 = [
454
454
  "January",
455
455
  "February",
456
456
  "March",
@@ -463,7 +463,7 @@ const y3 = [
463
463
  "October",
464
464
  "November",
465
465
  "December"
466
- ], M3 = ["आइत", "सोम", "मंगल", "बुध", "बिहि", "शुक्र", "शनि"], p3 = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], b3 = ["०", "१", "२", "३", "४", "५", "६", "७", "८", "९"], N3 = {
466
+ ], M3 = ["आइत", "सोम", "मंगल", "बुध", "बिहि", "शुक्र", "शनि"], p3 = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], S3 = ["०", "१", "२", "३", "४", "५", "६", "७", "८", "९"], N3 = {
467
467
  light: {
468
468
  primary: "#3b82f6",
469
469
  background: "#ffffff",
@@ -484,43 +484,43 @@ const y3 = [
484
484
  today: "#1e40af",
485
485
  disabled: "#6b7280"
486
486
  }
487
- }, V = (e) => e.toString().split("").map((t) => b3[parseInt(t)]).join(""), fe = (e, t, n) => {
487
+ }, U = (e) => e.toString().split("").map((t) => S3[parseInt(t)]).join(""), De = (e, t, n) => {
488
488
  if (e === "BS")
489
489
  try {
490
- const a = n === 11 ? new Y(t + 1, 0, 1) : new Y(t, n + 1, 1);
491
- return new Y(a.getTime() - 1440 * 60 * 1e3).getDate();
490
+ const a = n === 11 ? new w(t + 1, 0, 1) : new w(t, n + 1, 1);
491
+ return new w(a.getTime() - 1440 * 60 * 1e3).getDate();
492
492
  } catch {
493
493
  return 30;
494
494
  }
495
495
  return new Date(t, n + 1, 0).getDate();
496
- }, S3 = (e, t, n) => {
496
+ }, b3 = (e, t, n) => {
497
497
  if (e === "BS")
498
498
  try {
499
- return new Y(t, n, 1).getDay() || 0;
499
+ return new w(t, n, 1).getDay() || 0;
500
500
  } catch {
501
501
  return 0;
502
502
  }
503
503
  return new Date(t, n, 1).getDay();
504
- }, H = (e) => {
504
+ }, N = (e) => {
505
505
  const t = /* @__PURE__ */ new Date();
506
506
  if (e === "BS")
507
507
  try {
508
- const n = Y.fromEnglishDate(t.getFullYear(), t.getMonth(), t.getDate());
508
+ const n = w.fromEnglishDate(t.getFullYear(), t.getMonth(), t.getDate());
509
509
  return { year: n.getYear(), month: n.getMonth(), day: n.getDate() };
510
510
  } catch {
511
511
  return { year: 2081, month: 0, day: 1 };
512
512
  }
513
513
  return { year: t.getFullYear(), month: t.getMonth(), day: t.getDate() };
514
- }, wt = (e, t, n, a, s) => {
514
+ }, kt = (e, t, n, a, s) => {
515
515
  if (e === "BS")
516
516
  try {
517
- const r = new Y(t, n, a), o = r.getEnglishYear(), u = r.getEnglishMonth(), i = r.getEnglishDate(), h = `${o}-${String(u + 1).padStart(2, "0")}-${String(i).padStart(2, "0")}`;
517
+ const r = new w(t, n, a), o = r.getEnglishYear(), i = r.getEnglishMonth(), u = r.getEnglishDate(), h = `${o}-${String(i + 1).padStart(2, "0")}-${String(u).padStart(2, "0")}`;
518
518
  return {
519
519
  bs: `${t}-${String(n + 1).padStart(2, "0")}-${String(a).padStart(2, "0")}`,
520
520
  ad: h,
521
521
  formatted: {
522
522
  bs: `${s[n]} ${a}, ${t}`,
523
- ad: new Date(o, u, i).toLocaleDateString("en-US", { year: "numeric", month: "long", day: "numeric" })
523
+ ad: new Date(o, i, u).toLocaleDateString("en-US", { year: "numeric", month: "long", day: "numeric" })
524
524
  }
525
525
  };
526
526
  } catch {
@@ -537,17 +537,17 @@ const y3 = [
537
537
  else {
538
538
  const r = `${t}-${String(n + 1).padStart(2, "0")}-${String(a).padStart(2, "0")}`, o = new Date(t, n, a);
539
539
  try {
540
- const u = Y.fromEnglishDate(t, n, a), i = `${u.getYear()}-${String(u.getMonth() + 1).padStart(2, "0")}-${String(u.getDate()).padStart(2, "0")}`;
540
+ const i = w.fromEnglishDate(t, n, a), u = `${i.getYear()}-${String(i.getMonth() + 1).padStart(2, "0")}-${String(i.getDate()).padStart(2, "0")}`;
541
541
  return {
542
542
  ad: r,
543
- bs: i,
543
+ bs: u,
544
544
  formatted: {
545
545
  ad: o.toLocaleDateString("en-US", {
546
546
  year: "numeric",
547
547
  month: "long",
548
548
  day: "numeric"
549
549
  }),
550
- bs: `${me[u.getMonth()]} ${u.getDate()}, ${u.getYear()}`
550
+ bs: `${me[i.getMonth()]} ${i.getDate()}, ${i.getYear()}`
551
551
  }
552
552
  };
553
553
  } catch {
@@ -568,86 +568,87 @@ const y3 = [
568
568
  }, H3 = (e, t, n) => {
569
569
  const a = new Date(e.year, e.month, e.day).getTime(), s = new Date(t.year, t.month, t.day).getTime(), r = new Date(n.year, n.month, n.day).getTime();
570
570
  return a >= s && a <= r;
571
- }, It = (e) => {
571
+ }, Mt = (e) => {
572
572
  try {
573
573
  const [t, n, a] = e.split("-").map(Number);
574
574
  return !t || !n || !a ? null : { year: t, month: n - 1, day: a };
575
575
  } catch {
576
576
  return null;
577
577
  }
578
- }, et = (e, t, n) => {
578
+ }, nt = (e, t, n) => {
579
579
  if (!t && !n) return !1;
580
580
  const a = new Date(e.year, e.month, e.day).getTime();
581
581
  if (t) {
582
- const s = It(t);
582
+ const s = Mt(t);
583
583
  if (s) {
584
584
  const r = new Date(s.year, s.month, s.day).getTime();
585
585
  if (a < r) return !0;
586
586
  }
587
587
  }
588
588
  if (n) {
589
- const s = It(n);
589
+ const s = Mt(n);
590
590
  if (s) {
591
591
  const r = new Date(s.year, s.month, s.day).getTime();
592
592
  if (a > r) return !0;
593
593
  }
594
594
  }
595
595
  return !1;
596
- }, E3 = (e = "AD") => {
597
- const t = vt(() => H(e), [e]), [n, a] = B(t.year), [s, r] = B(t.month), [o, u] = B(null), [i, h] = B(null), [c, f] = B(null);
598
- Yt(() => {
599
- a(t.year), r(t.month);
600
- }, [t.year, t.month]);
601
- const d = vt(() => {
602
- const E = fe(e, n, s), $ = S3(e, n, s), p = [];
603
- for (let C = 0; C < $; C++)
604
- p.push(null);
605
- for (let C = 1; C <= E; C++)
606
- p.push(C);
607
- return p;
608
- }, [n, s, e]);
596
+ }, E3 = (e = "AD", t) => {
597
+ const n = mt(() => N(e), [e]), a = mt(() => t ? Mt(t) : null, [t]), [s, r] = H(a?.year ?? n.year), [o, i] = H(a?.month ?? n.month), [u, h] = H(a), [c, f] = H(null), [l, $] = H(null);
598
+ Dt(() => {
599
+ const M = t ? Mt(t) : null;
600
+ M ? (r(M.year), i(M.month)) : (r(n.year), i(n.month));
601
+ }, [e]);
602
+ const D = mt(() => {
603
+ const M = De(e, s, o), B = b3(e, s, o), k = [];
604
+ for (let b = 0; b < B; b++)
605
+ k.push(null);
606
+ for (let b = 1; b <= M; b++)
607
+ k.push(b);
608
+ return k;
609
+ }, [s, o, e]);
609
610
  return {
610
611
  // State
611
- currentYear: n,
612
- currentMonth: s,
613
- selectedDate: o,
614
- rangeStart: i,
615
- rangeEnd: c,
616
- today: t,
617
- calendarDays: d,
612
+ currentYear: s,
613
+ currentMonth: o,
614
+ selectedDate: u,
615
+ rangeStart: c,
616
+ rangeEnd: l,
617
+ today: n,
618
+ calendarDays: D,
618
619
  // Actions
619
- setCurrentYear: a,
620
- setCurrentMonth: r,
621
- setSelectedDate: u,
622
- setRangeStart: h,
623
- setRangeEnd: f,
624
- navigateMonth: (E) => {
625
- let p = s + E, C = n;
626
- for (; p > 11; )
627
- p -= 12, C += 1;
628
- for (; p < 0; )
629
- p += 12, C -= 1;
630
- r(p), a(C);
620
+ setCurrentYear: r,
621
+ setCurrentMonth: i,
622
+ setSelectedDate: h,
623
+ setRangeStart: f,
624
+ setRangeEnd: $,
625
+ navigateMonth: (M) => {
626
+ let k = o + M, b = s;
627
+ for (; k > 11; )
628
+ k -= 12, b += 1;
629
+ for (; k < 0; )
630
+ k += 12, b -= 1;
631
+ i(k), r(b);
631
632
  },
632
633
  // Helpers
633
- isToday: (E) => n === t.year && s === t.month && E === t.day,
634
- isSelected: (E, $ = "single") => $ === "range" ? !!(i && i.year === n && i.month === s && i.day === E) || !!(c && c.year === n && c.month === s && c.day === E) : !!(o && o.year === n && o.month === s && o.day === E),
635
- isInRange: (E) => {
636
- if (!i || !c) return !1;
637
- const $ = new Date(n, s, E).getTime(), p = new Date(i.year, i.month, i.day).getTime(), C = new Date(c.year, c.month, c.day).getTime();
638
- return $ >= p && $ <= C;
634
+ isToday: (M) => s === n.year && o === n.month && M === n.day,
635
+ isSelected: (M, B = "single") => B === "range" ? !!(c && c.year === s && c.month === o && c.day === M) || !!(l && l.year === s && l.month === o && l.day === M) : !!(u && u.year === s && u.month === o && u.day === M),
636
+ isInRange: (M) => {
637
+ if (!c || !l) return !1;
638
+ const B = new Date(s, o, M).getTime(), k = new Date(c.year, c.month, c.day).getTime(), b = new Date(l.year, l.month, l.day).getTime();
639
+ return B >= k && B <= b;
639
640
  }
640
641
  };
641
- }, Z = (e, t, n) => {
642
+ }, Q = (e, t, n) => {
642
643
  if (n === "BS")
643
644
  try {
644
- const a = new Y(e.year, e.month, e.day), s = new Date(
645
+ const a = new w(e.year, e.month, e.day), s = new Date(
645
646
  a.getEnglishYear(),
646
647
  a.getEnglishMonth(),
647
648
  a.getEnglishDate()
648
649
  );
649
650
  s.setDate(s.getDate() + t);
650
- const r = Y.fromEnglishDate(
651
+ const r = w.fromEnglishDate(
651
652
  s.getFullYear(),
652
653
  s.getMonth(),
653
654
  s.getDate()
@@ -660,7 +661,7 @@ const y3 = [
660
661
  const a = new Date(e.year, e.month, e.day);
661
662
  return a.setDate(a.getDate() + t), { year: a.getFullYear(), month: a.getMonth(), day: a.getDate() };
662
663
  }
663
- }, dt = (e, t, n) => {
664
+ }, ht = (e, t, n) => {
664
665
  if (n === "BS")
665
666
  try {
666
667
  let a = e.year, s = e.month + t;
@@ -668,7 +669,7 @@ const y3 = [
668
669
  a -= 1, s += 12;
669
670
  for (; s >= 12; )
670
671
  a += 1, s -= 12;
671
- const r = fe("BS", a, s), o = Math.min(e.day, r);
672
+ const r = De("BS", a, s), o = Math.min(e.day, r);
672
673
  return { year: a, month: s, day: o };
673
674
  } catch {
674
675
  return e;
@@ -677,11 +678,11 @@ const y3 = [
677
678
  const a = new Date(e.year, e.month, e.day);
678
679
  return a.setMonth(a.getMonth() + t), { year: a.getFullYear(), month: a.getMonth(), day: a.getDate() };
679
680
  }
680
- }, z = (e) => ({ year: e.year, month: e.month, day: 1 }), w3 = (e, t) => {
681
+ }, V = (e) => ({ year: e.year, month: e.month, day: 1 }), w3 = (e, t) => {
681
682
  if (t === "BS")
682
683
  try {
683
- const a = new Y(e.year, e.month, e.day).getDay();
684
- return Z(e, -a, "BS");
684
+ const a = new w(e.year, e.month, e.day).getDay();
685
+ return Q(e, -a, "BS");
685
686
  } catch {
686
687
  return e;
687
688
  }
@@ -708,7 +709,7 @@ const y3 = [
708
709
  key: "today",
709
710
  label: "Today",
710
711
  getValue: (s) => {
711
- const r = H(s);
712
+ const r = N(s);
712
713
  return { start: r, end: r };
713
714
  }
714
715
  },
@@ -716,7 +717,7 @@ const y3 = [
716
717
  key: "yesterday",
717
718
  label: "Yesterday",
718
719
  getValue: (s) => {
719
- const r = H(s), o = Z(r, -1, s);
720
+ const r = N(s), o = Q(r, -1, s);
720
721
  return { start: o, end: o };
721
722
  }
722
723
  },
@@ -724,7 +725,7 @@ const y3 = [
724
725
  key: "thisWeek",
725
726
  label: "This Week",
726
727
  getValue: (s) => {
727
- const r = H(s);
728
+ const r = N(s);
728
729
  return { start: w3(r, s), end: r };
729
730
  }
730
731
  },
@@ -732,72 +733,72 @@ const y3 = [
732
733
  key: "last7days",
733
734
  label: "Last 7 Days",
734
735
  getValue: (s) => {
735
- const r = H(s);
736
- return { start: Z(r, -6, s), end: r };
736
+ const r = N(s);
737
+ return { start: Q(r, -6, s), end: r };
737
738
  }
738
739
  },
739
740
  {
740
741
  key: "last30days",
741
742
  label: "Last 30 Days",
742
743
  getValue: (s) => {
743
- const r = H(s);
744
- return { start: Z(r, -29, s), end: r };
744
+ const r = N(s);
745
+ return { start: Q(r, -29, s), end: r };
745
746
  }
746
747
  },
747
748
  {
748
749
  key: "thisMonth",
749
750
  label: "This Month",
750
751
  getValue: (s) => {
751
- const r = H(s);
752
- return { start: z(r), end: r };
752
+ const r = N(s);
753
+ return { start: V(r), end: r };
753
754
  }
754
755
  },
755
756
  {
756
757
  key: "lastMonth",
757
758
  label: "Last Month",
758
759
  getValue: (s) => {
759
- const r = H(s), o = Z(z(r), -1, s);
760
- return { start: z(o), end: o };
760
+ const r = N(s), o = Q(V(r), -1, s);
761
+ return { start: V(o), end: o };
761
762
  }
762
763
  },
763
764
  {
764
765
  key: "last3months",
765
766
  label: "Last 3 Months",
766
767
  getValue: (s) => {
767
- const r = H(s), o = dt(r, -2, s);
768
- return { start: z(o), end: r };
768
+ const r = N(s), o = ht(r, -2, s);
769
+ return { start: V(o), end: r };
769
770
  }
770
771
  },
771
772
  {
772
773
  key: "last6months",
773
774
  label: "Last 6 Months",
774
775
  getValue: (s) => {
775
- const r = H(s), o = dt(r, -5, s);
776
- return { start: z(o), end: r };
776
+ const r = N(s), o = ht(r, -5, s);
777
+ return { start: V(o), end: r };
777
778
  }
778
779
  },
779
780
  {
780
781
  key: "last180days",
781
782
  label: "Last 180 Days",
782
783
  getValue: (s) => {
783
- const r = H(s);
784
- return { start: Z(r, -179, s), end: r };
784
+ const r = N(s);
785
+ return { start: Q(r, -179, s), end: r };
785
786
  }
786
787
  },
787
788
  {
788
789
  key: "last9months",
789
790
  label: "Last 9 Months",
790
791
  getValue: (s) => {
791
- const r = H(s), o = dt(r, -8, s);
792
- return { start: z(o), end: r };
792
+ const r = N(s), o = ht(r, -8, s);
793
+ return { start: V(o), end: r };
793
794
  }
794
795
  },
795
796
  {
796
797
  key: "lastYear",
797
798
  label: "Last Year",
798
799
  getValue: (s) => {
799
- const r = H(s), o = dt(r, -11, s);
800
- return { start: z(o), end: r };
800
+ const r = N(s), o = ht(r, -11, s);
801
+ return { start: V(o), end: r };
801
802
  }
802
803
  }
803
804
  ], a = e ? n.filter((s) => e.includes(s.key)) : n;
@@ -810,59 +811,59 @@ const y3 = [
810
811
  onMonthChange: s,
811
812
  onClose: r,
812
813
  showNepaliNumbers: o = !1,
813
- convertToNepaliNumber: u = (h) => h.toString(),
814
- calendarType: i
814
+ convertToNepaliNumber: i = (h) => h.toString(),
815
+ calendarType: u
815
816
  }) => {
816
- const [h, c] = B(Math.floor(e / 12) * 12), f = i === "BS" ? 2e3 : 1944, d = i === "BS" ? 2100 : 2043;
817
- return /* @__PURE__ */ g("div", { className: "bsac-picker-overlay", onClick: r, children: /* @__PURE__ */ S("div", { className: "bsac-picker-content", onClick: (k) => k.stopPropagation(), children: [
818
- /* @__PURE__ */ S("div", { className: "bsac-picker-header", children: [
817
+ const [h, c] = H(Math.floor(e / 12) * 12), f = u === "BS" ? 2e3 : 1944, l = u === "BS" ? 2100 : 2043;
818
+ return /* @__PURE__ */ C("div", { className: "bsac-picker-inline", onClick: ($) => $.stopPropagation(), children: [
819
+ /* @__PURE__ */ C("div", { className: "bsac-picker-header", children: [
819
820
  /* @__PURE__ */ g("h3", { children: "Select Month & Year" }),
820
821
  /* @__PURE__ */ g("button", { className: "bsac-close-btn", onClick: r, children: "×" })
821
822
  ] }),
822
- /* @__PURE__ */ S("div", { className: "bsac-picker-body", children: [
823
- /* @__PURE__ */ S("div", { className: "bsac-picker-section", children: [
824
- /* @__PURE__ */ S("div", { className: "bsac-picker-section-header", children: [
823
+ /* @__PURE__ */ C("div", { className: "bsac-picker-body", children: [
824
+ /* @__PURE__ */ C("div", { className: "bsac-picker-section", children: [
825
+ /* @__PURE__ */ C("div", { className: "bsac-picker-section-header", children: [
825
826
  /* @__PURE__ */ g("label", { children: "Year" }),
826
- /* @__PURE__ */ S("div", { className: "bsac-year-nav", children: [
827
+ /* @__PURE__ */ C("div", { className: "bsac-year-nav", children: [
827
828
  /* @__PURE__ */ g("button", { onClick: () => c(Math.max(f, h - 12)), disabled: h <= f, children: "«" }),
828
- /* @__PURE__ */ S("span", { children: [
829
- o ? u(h) : h,
829
+ /* @__PURE__ */ C("span", { children: [
830
+ o ? i(h) : h,
830
831
  " – ",
831
- o ? u(h + 11) : h + 11
832
+ o ? i(h + 11) : h + 11
832
833
  ] }),
833
- /* @__PURE__ */ g("button", { onClick: () => c(Math.min(d - 11, h + 12)), disabled: h + 11 >= d, children: "»" })
834
+ /* @__PURE__ */ g("button", { onClick: () => c(Math.min(l - 11, h + 12)), disabled: h + 11 >= l, children: "»" })
834
835
  ] })
835
836
  ] }),
836
- /* @__PURE__ */ g("div", { className: "bsac-year-grid", children: Array.from({ length: 12 }, (k, m) => {
837
- const A = h + m;
838
- return A > d ? null : /* @__PURE__ */ g(
837
+ /* @__PURE__ */ g("div", { className: "bsac-year-grid", children: Array.from({ length: 12 }, ($, D) => {
838
+ const F = h + D;
839
+ return F > l ? null : /* @__PURE__ */ g(
839
840
  "button",
840
841
  {
841
- onClick: () => a(A),
842
- className: A === e ? "bsac-selected" : "",
843
- children: o ? u(A) : A
842
+ onClick: () => a(F),
843
+ className: F === e ? "bsac-selected" : "",
844
+ children: o ? i(F) : F
844
845
  },
845
- A
846
+ F
846
847
  );
847
848
  }) })
848
849
  ] }),
849
- /* @__PURE__ */ S("div", { className: "bsac-picker-section", children: [
850
+ /* @__PURE__ */ C("div", { className: "bsac-picker-section", children: [
850
851
  /* @__PURE__ */ g("label", { children: "Month" }),
851
- /* @__PURE__ */ g("div", { className: "bsac-month-grid", children: n.map((k, m) => /* @__PURE__ */ g(
852
+ /* @__PURE__ */ g("div", { className: "bsac-month-grid", children: n.map(($, D) => /* @__PURE__ */ g(
852
853
  "button",
853
854
  {
854
855
  onClick: () => {
855
- s(m), r();
856
+ s(D), r();
856
857
  },
857
- className: m === t ? "bsac-selected" : "",
858
- children: k
858
+ className: D === t ? "bsac-selected" : "",
859
+ children: $
859
860
  },
860
- m
861
+ D
861
862
  )) })
862
863
  ] })
863
864
  ] })
864
- ] }) });
865
- }, gt = ({
865
+ ] });
866
+ }, lt = ({
866
867
  currentMonth: e,
867
868
  currentYear: t,
868
869
  months: n,
@@ -870,18 +871,18 @@ const y3 = [
870
871
  onYearChange: s,
871
872
  onMonthChange: r,
872
873
  disabled: o = !1,
873
- showNepaliNumbers: u = !1,
874
- convertToNepaliNumber: i,
874
+ showNepaliNumbers: i = !1,
875
+ convertToNepaliNumber: u,
875
876
  calendarType: h
876
877
  }) => {
877
- const [c, f] = B(!1);
878
- return /* @__PURE__ */ S("div", { className: "bsac-header", children: [
878
+ const [c, f] = H(!1);
879
+ return /* @__PURE__ */ C("div", { className: "bsac-header", children: [
879
880
  /* @__PURE__ */ g("button", { className: "bsac-nav-btn", onClick: () => a(-12), disabled: o, "aria-label": "Previous year", children: "«" }),
880
881
  /* @__PURE__ */ g("button", { className: "bsac-nav-btn", onClick: () => a(-1), disabled: o, "aria-label": "Previous month", children: "‹" }),
881
- /* @__PURE__ */ S("button", { className: "bsac-month-year-btn", onClick: () => f(!0), disabled: o, children: [
882
+ /* @__PURE__ */ C("button", { className: "bsac-month-year-btn", onClick: () => f(!0), disabled: o, children: [
882
883
  n[e],
883
884
  " ",
884
- u ? i(t) : t
885
+ i ? u(t) : t
885
886
  ] }),
886
887
  /* @__PURE__ */ g("button", { className: "bsac-nav-btn", onClick: () => a(1), disabled: o, "aria-label": "Next month", children: "›" }),
887
888
  /* @__PURE__ */ g("button", { className: "bsac-nav-btn", onClick: () => a(12), disabled: o, "aria-label": "Next year", children: "»" }),
@@ -894,13 +895,13 @@ const y3 = [
894
895
  onYearChange: s,
895
896
  onMonthChange: r,
896
897
  onClose: () => f(!1),
897
- showNepaliNumbers: u,
898
- convertToNepaliNumber: i,
898
+ showNepaliNumbers: i,
899
+ convertToNepaliNumber: u,
899
900
  calendarType: h
900
901
  }
901
902
  )
902
903
  ] });
903
- }, mt = ({
904
+ }, dt = ({
904
905
  calendarDays: e,
905
906
  days: t,
906
907
  onDateSelect: n,
@@ -908,27 +909,27 @@ const y3 = [
908
909
  isInRange: s,
909
910
  isToday: r,
910
911
  isDisabled: o,
911
- disabled: u = !1,
912
- showNepaliNumbers: i = !1,
912
+ disabled: i = !1,
913
+ showNepaliNumbers: u = !1,
913
914
  convertToNepaliNumber: h
914
- }) => /* @__PURE__ */ S("div", { className: "bsac-grid", children: [
915
+ }) => /* @__PURE__ */ C("div", { className: "bsac-grid", children: [
915
916
  t.map((c) => /* @__PURE__ */ g("div", { className: "bsac-day-header", children: c }, c)),
916
917
  e.map((c, f) => {
917
- const d = c ? o?.(c) || u : !1, k = c ? a(c) : !1, m = c ? s(c) : !1, A = c ? r(c) : !1, O = [
918
+ const l = c ? o?.(c) || i : !1, $ = c ? a(c) : !1, D = c ? s(c) : !1, F = c ? r(c) : !1, I = [
918
919
  "bsac-day",
919
- c ? d ? "bsac-day-disabled" : k ? "bsac-day-selected" : m ? "bsac-day-in-range" : A ? "bsac-day-today" : "" : "bsac-day-empty"
920
+ c ? l ? "bsac-day-disabled" : $ ? "bsac-day-selected" : D ? "bsac-day-in-range" : F ? "bsac-day-today" : "" : "bsac-day-empty"
920
921
  ].filter(Boolean).join(" ");
921
922
  return /* @__PURE__ */ g(
922
923
  "div",
923
924
  {
924
- className: O,
925
- onClick: () => c && !d && n(c),
926
- children: c ? i ? h(c) : c : ""
925
+ className: I,
926
+ onClick: () => c && !l && n(c),
927
+ children: c ? u ? h(c) : c : ""
927
928
  },
928
929
  f
929
930
  );
930
931
  })
931
- ] }), ft = ({
932
+ ] }), gt = ({
932
933
  presets: e,
933
934
  calendarType: t,
934
935
  onPresetSelect: n,
@@ -936,8 +937,8 @@ const y3 = [
936
937
  position: s = "top"
937
938
  }) => {
938
939
  const r = (o) => {
939
- const u = o.getValue(t);
940
- n(o, u);
940
+ const i = o.getValue(t);
941
+ n(o, i);
941
942
  };
942
943
  return /* @__PURE__ */ g("div", { className: `bsac-presets bsac-presets--${s}`, children: e.map((o) => /* @__PURE__ */ g(
943
944
  "button",
@@ -956,290 +957,290 @@ const y3 = [
956
957
  showToday: s = !0,
957
958
  disabled: r = !1,
958
959
  outputFormat: o = "both",
959
- onDateSelect: u,
960
- mode: i = "single",
960
+ onDateSelect: i,
961
+ mode: u = "single",
961
962
  onRangeSelect: h,
962
963
  showRangePresets: c = !1,
963
964
  rangePresetsPosition: f = "top",
964
- predefinedRanges: d,
965
- presetKeys: k,
966
- presetLabels: m,
967
- onPresetSelect: A,
968
- renderPresets: O,
969
- showNepaliMonths: E = !1,
970
- showNepaliDays: $ = !1,
971
- showNepaliNumbers: p = !1,
972
- theme: C = "light",
973
- colors: nt,
974
- minDate: I,
975
- maxDate: K
965
+ predefinedRanges: l,
966
+ presetKeys: $,
967
+ presetLabels: D,
968
+ onPresetSelect: F,
969
+ renderPresets: I,
970
+ showNepaliMonths: st = !1,
971
+ showNepaliDays: q = !1,
972
+ showNepaliNumbers: M = !1,
973
+ theme: B = "light",
974
+ colors: k,
975
+ minDate: b,
976
+ maxDate: J
976
977
  }) => {
977
978
  const {
978
- currentYear: T,
979
- currentMonth: N,
980
- rangeStart: U,
981
- rangeEnd: y,
982
- calendarDays: w,
983
- setSelectedDate: R,
984
- setRangeStart: M,
985
- setRangeEnd: v,
986
- setCurrentYear: _,
987
- setCurrentMonth: j,
988
- navigateMonth: F,
989
- isToday: st,
990
- isSelected: at,
991
- isInRange: rt
992
- } = E3(e), [ot, Et] = B(), it = d || Y3(k, m), ut = (l, D) => ({
993
- start: wt(e, l.year, l.month, l.day, G),
994
- end: wt(e, D.year, D.month, D.day, G)
995
- }), G = e === "BS" && E ? y3 : e === "BS" ? me : D3, ct = e === "BS" && $ ? M3 : p3, ht = (l, D) => {
996
- D.start && D.end && (M(D.start), v(D.end), _(D.start.year), j(D.start.month), Et(l.key), A?.(l, D), h?.(ut(D.start, D.end)));
997
- }, ye = (l, D) => {
998
- M(l), v(D), Et(void 0), h?.(ut(l, D));
999
- }, lt = (l) => {
979
+ currentYear: O,
980
+ currentMonth: v,
981
+ rangeStart: L,
982
+ rangeEnd: wt,
983
+ calendarDays: K,
984
+ setSelectedDate: Ft,
985
+ setRangeStart: m,
986
+ setRangeEnd: S,
987
+ setCurrentYear: A,
988
+ setCurrentMonth: y,
989
+ navigateMonth: E,
990
+ isToday: j,
991
+ isSelected: P,
992
+ isInRange: G
993
+ } = E3(e, t), [at, Yt] = H(), rt = l || Y3($, D), ot = (d, p) => ({
994
+ start: kt(e, d.year, d.month, d.day, z),
995
+ end: kt(e, p.year, p.month, p.day, z)
996
+ }), z = e === "BS" && st ? y3 : e === "BS" ? me : f3, it = e === "BS" && q ? M3 : p3, ut = (d, p) => {
997
+ p.start && p.end && (m(p.start), S(p.end), A(p.start.year), y(p.start.month), Yt(d.key), F?.(d, p), h?.(ot(p.start, p.end)));
998
+ }, ye = (d, p) => {
999
+ m(d), S(p), Yt(void 0), h?.(ot(d, p));
1000
+ }, ct = (d) => {
1000
1001
  if (r) return;
1001
- const D = { year: T, month: N, day: l };
1002
- if (et(D, I, K)) return;
1003
- if (i === "range") {
1004
- if (Et(void 0), !U || U && y)
1005
- M(D), v(null);
1002
+ const p = { year: O, month: v, day: d };
1003
+ if (nt(p, b, J)) return;
1004
+ if (u === "range") {
1005
+ if (Yt(void 0), !L || L && wt)
1006
+ m(p), S(null);
1006
1007
  else {
1007
- const X = new Date(U.year, U.month, U.day).getTime();
1008
- new Date(D.year, D.month, D.day).getTime() < X ? (M(D), v(U), h?.(ut(D, U))) : (v(D), h?.(ut(U, D)));
1008
+ const Z = new Date(L.year, L.month, L.day).getTime();
1009
+ new Date(p.year, p.month, p.day).getTime() < Z ? (m(p), S(L), h?.(ot(p, L))) : (S(p), h?.(ot(L, p)));
1009
1010
  }
1010
1011
  return;
1011
1012
  }
1012
- R(D);
1013
- const q = wt(e, T, N, l, G);
1014
- if (u?.(q), n) {
1015
- let X;
1013
+ Ft(p);
1014
+ const X = kt(e, O, v, d, z);
1015
+ if (i?.(X), n) {
1016
+ let Z;
1016
1017
  switch (o) {
1017
1018
  case "iso":
1018
- X = q.ad;
1019
+ Z = X.ad;
1019
1020
  break;
1020
1021
  case "object":
1021
- X = JSON.stringify(q);
1022
+ Z = JSON.stringify(X);
1022
1023
  break;
1023
1024
  default:
1024
- X = JSON.stringify(q);
1025
+ Z = JSON.stringify(X);
1025
1026
  break;
1026
1027
  }
1027
- n(X);
1028
+ n(Z);
1028
1029
  }
1029
- }, De = (l) => {
1030
+ }, fe = (d) => {
1030
1031
  if (!r) {
1031
- switch (l.key) {
1032
+ switch (d.key) {
1032
1033
  case "ArrowLeft":
1033
- F(-1);
1034
+ E(-1);
1034
1035
  break;
1035
1036
  case "ArrowRight":
1036
- F(1);
1037
+ E(1);
1037
1038
  break;
1038
1039
  case "ArrowUp":
1039
- F(-12);
1040
+ E(-12);
1040
1041
  break;
1041
1042
  case "ArrowDown":
1042
- F(12);
1043
+ E(12);
1043
1044
  break;
1044
1045
  case "PageUp":
1045
- l.shiftKey ? F(-12) : F(-1);
1046
+ d.shiftKey ? E(-12) : E(-1);
1046
1047
  break;
1047
1048
  case "PageDown":
1048
- l.shiftKey ? F(12) : F(1);
1049
+ d.shiftKey ? E(12) : E(1);
1049
1050
  break;
1050
1051
  default:
1051
1052
  return;
1052
1053
  }
1053
- l.preventDefault();
1054
+ d.preventDefault();
1054
1055
  }
1055
1056
  }, Me = {
1056
- ...nt ? Object.entries(nt).reduce(
1057
- (l, [D, q]) => (l[`--calendar-${D}`] = q, l),
1057
+ ...k ? Object.entries(k).reduce(
1058
+ (d, [p, X]) => (d[`--calendar-${p}`] = X, d),
1058
1059
  {}
1059
1060
  ) : {}
1060
1061
  };
1061
- return /* @__PURE__ */ S(
1062
+ return /* @__PURE__ */ C(
1062
1063
  "div",
1063
1064
  {
1064
1065
  className: `bsac-calendar ${a}`,
1065
1066
  style: Me,
1066
- "data-theme": C,
1067
- onKeyDown: De,
1067
+ "data-theme": B,
1068
+ onKeyDown: fe,
1068
1069
  tabIndex: 0,
1069
1070
  role: "application",
1070
1071
  "aria-label": "Calendar",
1071
1072
  children: [
1072
- i === "range" && O && /* @__PURE__ */ S("div", { style: { display: "flex", gap: "16px" }, children: [
1073
- /* @__PURE__ */ g("div", { children: O({ onRangeChange: ye }) }),
1074
- /* @__PURE__ */ S("div", { style: { flex: 1 }, children: [
1073
+ u === "range" && I && /* @__PURE__ */ C("div", { style: { display: "flex", gap: "16px" }, children: [
1074
+ /* @__PURE__ */ g("div", { children: I({ onRangeChange: ye }) }),
1075
+ /* @__PURE__ */ C("div", { style: { flex: 1 }, children: [
1075
1076
  /* @__PURE__ */ g(
1076
- gt,
1077
+ lt,
1077
1078
  {
1078
- currentMonth: N,
1079
- currentYear: T,
1080
- months: G,
1081
- onNavigateMonth: F,
1082
- onYearChange: _,
1083
- onMonthChange: j,
1079
+ currentMonth: v,
1080
+ currentYear: O,
1081
+ months: z,
1082
+ onNavigateMonth: E,
1083
+ onYearChange: A,
1084
+ onMonthChange: y,
1084
1085
  disabled: r,
1085
- showNepaliNumbers: p,
1086
- convertToNepaliNumber: V,
1086
+ showNepaliNumbers: M,
1087
+ convertToNepaliNumber: U,
1087
1088
  calendarType: e
1088
1089
  }
1089
1090
  ),
1090
1091
  /* @__PURE__ */ g(
1091
- mt,
1092
+ dt,
1092
1093
  {
1093
- calendarDays: w,
1094
- days: ct,
1095
- onDateSelect: lt,
1096
- isSelected: (l) => at(l, i),
1097
- isInRange: rt,
1098
- isToday: (l) => s && st(l),
1099
- isDisabled: (l) => et({ year: T, month: N, day: l }, I, K),
1094
+ calendarDays: K,
1095
+ days: it,
1096
+ onDateSelect: ct,
1097
+ isSelected: (d) => P(d, u),
1098
+ isInRange: G,
1099
+ isToday: (d) => s && j(d),
1100
+ isDisabled: (d) => nt({ year: O, month: v, day: d }, b, J),
1100
1101
  disabled: r,
1101
- showNepaliNumbers: p,
1102
- convertToNepaliNumber: V
1102
+ showNepaliNumbers: M,
1103
+ convertToNepaliNumber: U
1103
1104
  }
1104
1105
  )
1105
1106
  ] })
1106
1107
  ] }),
1107
- i === "range" && c && f === "left" && !O && /* @__PURE__ */ S("div", { style: { display: "flex", gap: "16px", flexWrap: "nowrap" }, children: [
1108
+ u === "range" && c && f === "left" && !I && /* @__PURE__ */ C("div", { style: { display: "flex", gap: "16px", flexWrap: "nowrap" }, children: [
1108
1109
  /* @__PURE__ */ g(
1109
- ft,
1110
+ gt,
1110
1111
  {
1111
- presets: it,
1112
+ presets: rt,
1112
1113
  calendarType: e,
1113
- onPresetSelect: ht,
1114
- activePreset: ot,
1114
+ onPresetSelect: ut,
1115
+ activePreset: at,
1115
1116
  position: "left"
1116
1117
  }
1117
1118
  ),
1118
- /* @__PURE__ */ S("div", { children: [
1119
+ /* @__PURE__ */ C("div", { children: [
1119
1120
  /* @__PURE__ */ g(
1120
- gt,
1121
+ lt,
1121
1122
  {
1122
- currentMonth: N,
1123
- currentYear: T,
1124
- months: G,
1125
- onNavigateMonth: F,
1126
- onYearChange: _,
1127
- onMonthChange: j,
1123
+ currentMonth: v,
1124
+ currentYear: O,
1125
+ months: z,
1126
+ onNavigateMonth: E,
1127
+ onYearChange: A,
1128
+ onMonthChange: y,
1128
1129
  disabled: r,
1129
- showNepaliNumbers: p,
1130
- convertToNepaliNumber: V,
1130
+ showNepaliNumbers: M,
1131
+ convertToNepaliNumber: U,
1131
1132
  calendarType: e
1132
1133
  }
1133
1134
  ),
1134
1135
  /* @__PURE__ */ g(
1135
- mt,
1136
+ dt,
1136
1137
  {
1137
- calendarDays: w,
1138
- days: ct,
1139
- onDateSelect: lt,
1140
- isSelected: (l) => at(l, i),
1141
- isInRange: rt,
1142
- isToday: (l) => s && st(l),
1143
- isDisabled: (l) => et({ year: T, month: N, day: l }, I, K),
1138
+ calendarDays: K,
1139
+ days: it,
1140
+ onDateSelect: ct,
1141
+ isSelected: (d) => P(d, u),
1142
+ isInRange: G,
1143
+ isToday: (d) => s && j(d),
1144
+ isDisabled: (d) => nt({ year: O, month: v, day: d }, b, J),
1144
1145
  disabled: r,
1145
- showNepaliNumbers: p,
1146
- convertToNepaliNumber: V
1146
+ showNepaliNumbers: M,
1147
+ convertToNepaliNumber: U
1147
1148
  }
1148
1149
  )
1149
1150
  ] })
1150
1151
  ] }),
1151
- i === "range" && c && f === "right" && !O && /* @__PURE__ */ S("div", { style: { display: "flex", gap: "16px", flexWrap: "nowrap" }, children: [
1152
- /* @__PURE__ */ S("div", { children: [
1152
+ u === "range" && c && f === "right" && !I && /* @__PURE__ */ C("div", { style: { display: "flex", gap: "16px", flexWrap: "nowrap" }, children: [
1153
+ /* @__PURE__ */ C("div", { children: [
1153
1154
  /* @__PURE__ */ g(
1154
- gt,
1155
+ lt,
1155
1156
  {
1156
- currentMonth: N,
1157
- currentYear: T,
1158
- months: G,
1159
- onNavigateMonth: F,
1160
- onYearChange: _,
1161
- onMonthChange: j,
1157
+ currentMonth: v,
1158
+ currentYear: O,
1159
+ months: z,
1160
+ onNavigateMonth: E,
1161
+ onYearChange: A,
1162
+ onMonthChange: y,
1162
1163
  disabled: r,
1163
- showNepaliNumbers: p,
1164
- convertToNepaliNumber: V,
1164
+ showNepaliNumbers: M,
1165
+ convertToNepaliNumber: U,
1165
1166
  calendarType: e
1166
1167
  }
1167
1168
  ),
1168
1169
  /* @__PURE__ */ g(
1169
- mt,
1170
+ dt,
1170
1171
  {
1171
- calendarDays: w,
1172
- days: ct,
1173
- onDateSelect: lt,
1174
- isSelected: (l) => at(l, i),
1175
- isInRange: rt,
1176
- isToday: (l) => s && st(l),
1177
- isDisabled: (l) => et({ year: T, month: N, day: l }, I, K),
1172
+ calendarDays: K,
1173
+ days: it,
1174
+ onDateSelect: ct,
1175
+ isSelected: (d) => P(d, u),
1176
+ isInRange: G,
1177
+ isToday: (d) => s && j(d),
1178
+ isDisabled: (d) => nt({ year: O, month: v, day: d }, b, J),
1178
1179
  disabled: r,
1179
- showNepaliNumbers: p,
1180
- convertToNepaliNumber: V
1180
+ showNepaliNumbers: M,
1181
+ convertToNepaliNumber: U
1181
1182
  }
1182
1183
  )
1183
1184
  ] }),
1184
1185
  /* @__PURE__ */ g(
1185
- ft,
1186
+ gt,
1186
1187
  {
1187
- presets: it,
1188
+ presets: rt,
1188
1189
  calendarType: e,
1189
- onPresetSelect: ht,
1190
- activePreset: ot,
1190
+ onPresetSelect: ut,
1191
+ activePreset: at,
1191
1192
  position: "right"
1192
1193
  }
1193
1194
  )
1194
1195
  ] }),
1195
- (!i || i === "single" || !c && !O || f === "top" || f === "bottom") && /* @__PURE__ */ S(pe, { children: [
1196
- i === "range" && c && f === "top" && /* @__PURE__ */ g(
1197
- ft,
1196
+ (!u || u === "single" || !c && !I || f === "top" || f === "bottom") && /* @__PURE__ */ C(pe, { children: [
1197
+ u === "range" && c && f === "top" && /* @__PURE__ */ g(
1198
+ gt,
1198
1199
  {
1199
- presets: it,
1200
+ presets: rt,
1200
1201
  calendarType: e,
1201
- onPresetSelect: ht,
1202
- activePreset: ot,
1202
+ onPresetSelect: ut,
1203
+ activePreset: at,
1203
1204
  position: "top"
1204
1205
  }
1205
1206
  ),
1206
1207
  /* @__PURE__ */ g(
1207
- gt,
1208
+ lt,
1208
1209
  {
1209
- currentMonth: N,
1210
- currentYear: T,
1211
- months: G,
1212
- onNavigateMonth: F,
1213
- onYearChange: _,
1214
- onMonthChange: j,
1210
+ currentMonth: v,
1211
+ currentYear: O,
1212
+ months: z,
1213
+ onNavigateMonth: E,
1214
+ onYearChange: A,
1215
+ onMonthChange: y,
1215
1216
  disabled: r,
1216
- showNepaliNumbers: p,
1217
- convertToNepaliNumber: V,
1217
+ showNepaliNumbers: M,
1218
+ convertToNepaliNumber: U,
1218
1219
  calendarType: e
1219
1220
  }
1220
1221
  ),
1221
1222
  /* @__PURE__ */ g(
1222
- mt,
1223
+ dt,
1223
1224
  {
1224
- calendarDays: w,
1225
- days: ct,
1226
- onDateSelect: lt,
1227
- isSelected: (l) => at(l, i),
1228
- isInRange: rt,
1229
- isToday: (l) => s && st(l),
1230
- isDisabled: (l) => et({ year: T, month: N, day: l }, I, K),
1225
+ calendarDays: K,
1226
+ days: it,
1227
+ onDateSelect: ct,
1228
+ isSelected: (d) => P(d, u),
1229
+ isInRange: G,
1230
+ isToday: (d) => s && j(d),
1231
+ isDisabled: (d) => nt({ year: O, month: v, day: d }, b, J),
1231
1232
  disabled: r,
1232
- showNepaliNumbers: p,
1233
- convertToNepaliNumber: V
1233
+ showNepaliNumbers: M,
1234
+ convertToNepaliNumber: U
1234
1235
  }
1235
1236
  ),
1236
- i === "range" && c && f === "bottom" && /* @__PURE__ */ g(
1237
- ft,
1237
+ u === "range" && c && f === "bottom" && /* @__PURE__ */ g(
1238
+ gt,
1238
1239
  {
1239
- presets: it,
1240
+ presets: rt,
1240
1241
  calendarType: e,
1241
- onPresetSelect: ht,
1242
- activePreset: ot,
1242
+ onPresetSelect: ut,
1243
+ activePreset: at,
1243
1244
  position: "bottom"
1244
1245
  }
1245
1246
  )
@@ -1247,7 +1248,7 @@ const y3 = [
1247
1248
  ]
1248
1249
  }
1249
1250
  );
1250
- }, T3 = ({
1251
+ }, B3 = ({
1251
1252
  placeholder: e = "Select date",
1252
1253
  format: t = "YYYY-MM-DD",
1253
1254
  defaultValue: n,
@@ -1255,93 +1256,117 @@ const y3 = [
1255
1256
  inputClassName: s = "",
1256
1257
  popupClassName: r = "",
1257
1258
  style: o,
1258
- inputStyle: u,
1259
- icon: i,
1259
+ inputStyle: i,
1260
+ icon: u,
1260
1261
  showIcon: h = !0,
1261
1262
  calendarType: c = "AD",
1262
1263
  ...f
1263
1264
  }) => {
1264
- const [d, k] = B(!1), [m, A] = B(null), [O, E] = B(() => {
1265
+ const [l, $] = H(!1), [D, F] = H(null), [I, st] = H(void 0), [q, M] = H(() => {
1265
1266
  if (!n) return "";
1266
1267
  if (c === "BS")
1267
1268
  try {
1268
- const [y, w, R] = n.split("-").map(Number), M = Y.fromEnglishDate(y, w - 1, R);
1269
- return `${M.getYear()}-${String(M.getMonth() + 1).padStart(2, "0")}-${String(M.getDate()).padStart(2, "0")}`;
1269
+ const [m, S, A] = n.split("-").map(Number), y = w.fromEnglishDate(m, S - 1, A);
1270
+ return `${y.getYear()}-${String(y.getMonth() + 1).padStart(2, "0")}-${String(y.getDate()).padStart(2, "0")}`;
1270
1271
  } catch {
1271
1272
  return n;
1272
1273
  }
1273
1274
  return n;
1274
- }), $ = Ft(null), p = Ft(null), [C, nt] = B({ visibility: "hidden" }), I = () => {
1275
- if (!$.current) return;
1276
- const y = $.current.getBoundingClientRect(), w = p.current?.offsetHeight || 360, R = p.current?.offsetWidth || 280, M = window.innerHeight - y.bottom, v = window.innerWidth - y.left, _ = M >= w + 8 ? y.bottom + 8 : Math.max(8, y.top - w - 8), j = v >= R ? y.left : Math.max(8, y.right - R);
1277
- nt({ top: _, left: j, visibility: "visible" });
1275
+ });
1276
+ Dt(() => {
1277
+ if (n)
1278
+ if (c === "BS")
1279
+ try {
1280
+ const [m, S, A] = n.split("-").map(Number), y = w.fromEnglishDate(m, S - 1, A);
1281
+ M(`${y.getYear()}-${String(y.getMonth() + 1).padStart(2, "0")}-${String(y.getDate()).padStart(2, "0")}`);
1282
+ } catch {
1283
+ M(n);
1284
+ }
1285
+ else
1286
+ M(n);
1287
+ }, [n, c]);
1288
+ const B = mt(() => {
1289
+ if (n) {
1290
+ if (c === "BS")
1291
+ try {
1292
+ const [m, S, A] = n.split("-").map(Number), y = w.fromEnglishDate(m, S - 1, A);
1293
+ return `${y.getYear()}-${String(y.getMonth() + 1).padStart(2, "0")}-${String(y.getDate()).padStart(2, "0")}`;
1294
+ } catch {
1295
+ return n;
1296
+ }
1297
+ return n;
1298
+ }
1299
+ }, [n, c]), k = xt(null), b = xt(null), [J, O] = H({ visibility: "hidden" }), v = () => {
1300
+ if (!k.current) return;
1301
+ const m = k.current.getBoundingClientRect(), S = b.current?.offsetHeight || 360, A = b.current?.offsetWidth || 280, y = window.innerHeight - m.bottom, E = window.innerWidth - m.left, j = y >= S + 8 ? m.bottom + 8 : Math.max(8, m.top - S - 8), P = E >= A ? m.left : Math.max(8, m.right - A);
1302
+ O({ top: j, left: P, visibility: "visible" });
1278
1303
  };
1279
- Yt(() => (d && (requestAnimationFrame(I), window.addEventListener("scroll", I, !0), window.addEventListener("resize", I)), () => {
1280
- window.removeEventListener("scroll", I, !0), window.removeEventListener("resize", I);
1281
- }), [d]), Yt(() => {
1282
- const y = (w) => {
1283
- $.current && !$.current.contains(w.target) && k(!1);
1304
+ Dt(() => (l && (requestAnimationFrame(v), window.addEventListener("scroll", v, !0), window.addEventListener("resize", v)), () => {
1305
+ window.removeEventListener("scroll", v, !0), window.removeEventListener("resize", v);
1306
+ }), [l]), Dt(() => {
1307
+ const m = (S) => {
1308
+ k.current && !k.current.contains(S.target) && $(!1);
1284
1309
  };
1285
- return d && document.addEventListener("mousedown", y), () => document.removeEventListener("mousedown", y);
1286
- }, [d]);
1287
- const K = (y) => {
1288
- A(y), E(c === "BS" ? y.bs : y.ad), k(!1), a?.(y);
1289
- }, T = (y) => {
1290
- const w = y.target.value;
1291
- if (w === "") {
1292
- E("");
1310
+ return l && document.addEventListener("mousedown", m), () => document.removeEventListener("mousedown", m);
1311
+ }, [l]);
1312
+ const L = (m) => {
1313
+ F(m), st(c === "BS" ? m.bs : m.ad), M(c === "BS" ? m.bs : m.ad), $(!1), a?.(m);
1314
+ }, wt = (m) => {
1315
+ const S = m.target.value;
1316
+ if (S === "") {
1317
+ M("");
1293
1318
  return;
1294
1319
  }
1295
- if ((y.target.selectionStart || 0) === w.length && w.length > O.length) {
1296
- const M = w.replace(/[^0-9]/g, "");
1297
- let v = M;
1298
- M.length > 4 && M.length <= 6 ? v = M.slice(0, 4) + "-" + M.slice(4) : M.length > 6 && (v = M.slice(0, 4) + "-" + M.slice(4, 6) + "-" + M.slice(6, 8)), E(v);
1320
+ if ((m.target.selectionStart || 0) === S.length && S.length > q.length) {
1321
+ const y = S.replace(/[^0-9]/g, "");
1322
+ let E = y;
1323
+ y.length > 4 && y.length <= 6 ? E = y.slice(0, 4) + "-" + y.slice(4) : y.length > 6 && (E = y.slice(0, 4) + "-" + y.slice(4, 6) + "-" + y.slice(6, 8)), M(E);
1299
1324
  } else {
1300
- const M = w.replace(/[^0-9-]/g, "");
1301
- M.length <= 10 && E(M);
1325
+ const y = S.replace(/[^0-9-]/g, "");
1326
+ y.length <= 10 && M(y);
1302
1327
  }
1303
- }, N = () => {
1304
- const y = O.trim();
1305
- if (!y) {
1306
- A(null);
1328
+ }, K = () => {
1329
+ const m = q.trim();
1330
+ if (!m) {
1331
+ F(null);
1307
1332
  return;
1308
1333
  }
1309
- const w = y.match(/^(\d{4})-(\d{2})-(\d{2})$/);
1310
- if (w) {
1311
- const [, R, M, v] = w, _ = parseInt(M), j = parseInt(v);
1312
- if (_ < 1 || _ > 12 || j < 1 || j > 32) {
1313
- E(m ? c === "BS" ? m.bs : m.ad : "");
1334
+ const S = m.match(/^(\d{4})-(\d{2})-(\d{2})$/);
1335
+ if (S) {
1336
+ const [, A, y, E] = S, j = parseInt(y), P = parseInt(E);
1337
+ if (j < 1 || j > 12 || P < 1 || P > 32) {
1338
+ M(D ? c === "BS" ? D.bs : D.ad : "");
1314
1339
  return;
1315
1340
  }
1316
- const F = {
1317
- bs: c === "BS" ? `${R}-${M}-${v}` : "",
1318
- ad: c === "AD" ? `${R}-${M}-${v}` : "",
1341
+ const G = {
1342
+ bs: c === "BS" ? `${A}-${y}-${E}` : "",
1343
+ ad: c === "AD" ? `${A}-${y}-${E}` : "",
1319
1344
  formatted: {
1320
- bs: c === "BS" ? y : "",
1321
- ad: c === "AD" ? y : ""
1345
+ bs: c === "BS" ? m : "",
1346
+ ad: c === "AD" ? m : ""
1322
1347
  }
1323
1348
  };
1324
- if (A(F), m === null) return;
1325
- a?.(F);
1326
- } else y.length < 10 && E(m ? c === "BS" ? m.bs : m.ad : "");
1349
+ if (F(G), D === null) return;
1350
+ a?.(G);
1351
+ } else m.length < 10 && M(D ? c === "BS" ? D.bs : D.ad : "");
1327
1352
  };
1328
- return /* @__PURE__ */ S("div", { className: "bsac-datepicker", ref: $, style: o, children: [
1353
+ return /* @__PURE__ */ C("div", { className: "bsac-datepicker", ref: k, style: o, children: [
1329
1354
  /* @__PURE__ */ g(
1330
1355
  "input",
1331
1356
  {
1332
1357
  type: "text",
1333
- value: O,
1358
+ value: q,
1334
1359
  placeholder: e,
1335
- onChange: T,
1336
- onBlur: N,
1337
- onKeyDown: (y) => {
1338
- y.key === "Enter" ? (N(), k(!1)) : y.key === "Escape" && k(!1);
1360
+ onChange: wt,
1361
+ onBlur: K,
1362
+ onKeyDown: (m) => {
1363
+ m.key === "Enter" ? (K(), $(!1)) : m.key === "Escape" && $(!1);
1339
1364
  },
1340
1365
  className: `bsac-input ${s}`,
1341
- style: u,
1366
+ style: i,
1342
1367
  "aria-label": "Date picker input",
1343
1368
  "aria-haspopup": "dialog",
1344
- "aria-expanded": d,
1369
+ "aria-expanded": l,
1345
1370
  maxLength: 10
1346
1371
  }
1347
1372
  ),
@@ -1350,10 +1375,10 @@ const y3 = [
1350
1375
  {
1351
1376
  type: "button",
1352
1377
  className: "bsac-icon-btn",
1353
- onClick: () => k(!d),
1378
+ onClick: () => $(!l),
1354
1379
  "aria-label": "Toggle calendar",
1355
1380
  style: { display: h ? "flex" : "none" },
1356
- children: i || /* @__PURE__ */ S("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
1381
+ children: u || /* @__PURE__ */ C("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
1357
1382
  /* @__PURE__ */ g("rect", { x: "3", y: "4", width: "18", height: "18", rx: "2", ry: "2" }),
1358
1383
  /* @__PURE__ */ g("line", { x1: "16", y1: "2", x2: "16", y2: "6" }),
1359
1384
  /* @__PURE__ */ g("line", { x1: "8", y1: "2", x2: "8", y2: "6" }),
@@ -1361,27 +1386,27 @@ const y3 = [
1361
1386
  ] })
1362
1387
  }
1363
1388
  ),
1364
- d && /* @__PURE__ */ g("div", { ref: p, className: `bsac-popup ${r}`, style: C, children: /* @__PURE__ */ g(C3, { calendarType: c, onDateSelect: K, ...f }) })
1389
+ /* @__PURE__ */ g("div", { ref: b, className: `bsac-popup ${r}`, style: { ...J, display: l ? void 0 : "none" }, children: /* @__PURE__ */ g(C3, { calendarType: c, onDateSelect: L, value: I ?? B, ...f }) })
1365
1390
  ] });
1366
1391
  };
1367
1392
  export {
1368
1393
  C3 as Calendar,
1369
- T3 as CalendarInput,
1394
+ B3 as CalendarInput,
1370
1395
  N3 as DEFAULT_COLORS,
1371
- T3 as DatePicker,
1396
+ B3 as DatePicker,
1372
1397
  p3 as ENGLISH_DAYS,
1373
- D3 as ENGLISH_MONTHS_AD,
1398
+ f3 as ENGLISH_MONTHS_AD,
1374
1399
  me as ENGLISH_MONTHS_BS,
1375
1400
  M3 as NEPALI_DAYS,
1376
- b3 as NEPALI_DIGITS,
1401
+ S3 as NEPALI_DIGITS,
1377
1402
  y3 as NEPALI_MONTHS,
1378
1403
  O3 as PRESET_KEYS,
1379
- V as convertToNepaliNumber,
1380
- wt as createDateOutput,
1404
+ U as convertToNepaliNumber,
1405
+ kt as createDateOutput,
1381
1406
  Y3 as createPredefinedRanges,
1382
- fe as getDaysInMonth,
1383
- S3 as getFirstDayOfMonth,
1384
- H as getTodayDate,
1407
+ De as getDaysInMonth,
1408
+ b3 as getFirstDayOfMonth,
1409
+ N as getTodayDate,
1385
1410
  H3 as isDateInRange,
1386
1411
  E3 as useCalendar
1387
1412
  };