import { a as e, n as t } from './chunk-BneVvdWh.js';
import { S as n } from './iframe-B-AKBcwT.js';
import { t as r } from './jsx-runtime-Bn1Ys6_W.js';
import { t as i } from './compiler-runtime-C9X80vSn.js';
import { n as a, t as o } from './clsx-D6G9p0rQ.js';
var s,
    c = t(() => {
        s = `.uktmonthcalendar{box-sizing:border-box;flex-direction:column;flex:auto;max-width:325px;display:flex}.uktmonthcalendar-month-title{box-sizing:border-box;flex:none;justify-content:center;align-items:center;padding-bottom:25px;display:flex}h3.uktmonthcalendar-month-title-text{color:#000;text-align:center;margin:0;font-size:18px;font-weight:600;line-height:23px}.uktmonthcalendar-month-week{grid-column-gap:0px;grid-template-columns:repeat(auto-fit,minmax(46px,1fr));grid-auto-flow:dense;box-sizing:border-box;flex:none;padding-bottom:12px;display:grid}.uktmonthcalendar-month-week .week-day-item{flex:auto;justify-content:center;align-items:center;display:flex}.uktmonthcalendar-month-week span.week-day-item-text{text-align:center;color:#9a9a9a;margin:0;font-size:13px;line-height:21px}.uktmonthcalendar-month-days{flex-direction:column;flex:auto;display:flex}.uktmonthcalendar-month-row{grid-column-gap:0px;grid-template-columns:repeat(auto-fit,minmax(46px,1fr));grid-auto-flow:dense;flex:auto;margin-bottom:1px;display:grid}.uktmonthcalendar-month-day-item{cursor:pointer;background-color:#0000;border:none;justify-content:center;align-items:center;width:46px;height:46px;display:flex;position:relative}.uktmonthcalendar-month-day-item:disabled{cursor:auto}.uktmonthcalendar-month-day-item.is-today span.month-day-item-text{color:#eb4e3d}.uktmonthcalendar.is-range .uktmonthcalendar-month-day-item.is-selected{background-color:#f6f6f6}.uktmonthcalendar.is-range .uktmonthcalendar-month-day-item.start-date{background-color:#f6f6f6;border-top-left-radius:50%;border-bottom-left-radius:50%}.uktmonthcalendar.is-range .uktmonthcalendar-month-day-item.end-date{background-color:#f6f6f6;border-top-right-radius:50%;border-bottom-right-radius:50%}:is(.uktmonthcalendar-month-day-item.start-date,.uktmonthcalendar-month-day-item.end-date):after{opacity:1;visibility:visible;background-color:#000}:is(.uktmonthcalendar-month-day-item.start-date,.uktmonthcalendar-month-day-item.end-date) span.month-day-item-text{color:#fff}.uktmonthcalendar-month-day-item:hover:after,.uktmonthcalendar-month-day-item.is-today:hover:after{opacity:1;visibility:visible;border-color:#000}.uktmonthcalendar-month-day-item:after{content:"";pointer-events:none;opacity:0;visibility:hidden;border:1px solid #000;border-radius:50%;width:43px;height:43px;transition:opacity .25s ease-in-out;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)}.uktmonthcalendar-month-day-item.is-empty:after{content:none}.uktmonthcalendar-month-day-item span.month-day-item-text{text-align:center;color:#000;z-index:1;margin:0;font-size:13px;line-height:21px;position:relative}`;
    }),
    l,
    u,
    d,
    f,
    p,
    m,
    h,
    g,
    _ = t(() => {
        ((l = 1970),
            (u = [
                `January`,
                `February`,
                `March`,
                `April`,
                `May`,
                `June`,
                `July`,
                `August`,
                `September`,
                `October`,
                `November`,
                `December`,
            ]),
            (d = (e, t) => (t ? e.getUTCFullYear() : e.getFullYear()) - l),
            (f = (e, t) => d(e, t) * 12 + (t ? e.getUTCMonth() : e.getMonth())),
            (p = (e) => Math.floor(e / 12) + l),
            (m = (e) => {
                let t = e % 12;
                return Number.isNaN(t) ? `` : (t < 0 && (t = 12 + t), u[t]);
            }),
            (h = (e, t, n) => {
                let r = e < 0 ? (12 - Math.abs(e % 12)) % 12 : e % 12,
                    i = p(e);
                return n ? new Date(Date.UTC(i, r, t)) : new Date(i, r, t);
            }),
            (g = (e, t) => h(e + 1, 0, t)));
    });
function v(e) {
    let t = (0, y.c)(47),
        {
            className: n,
            dateEnd: r,
            dateEndPreview: i,
            dateStart: a,
            isRange: c,
            month: l,
            onChange: u,
            onChangeEndPreview: d,
            title: _,
        } = e,
        v,
        w,
        T,
        E,
        D,
        O,
        k;
    if (
        t[0] !== l ||
        t[1] !== n ||
        t[2] !== r ||
        t[3] !== i ||
        t[4] !== a ||
        t[5] !== c ||
        t[6] !== u ||
        t[7] !== d ||
        t[8] !== _
    ) {
        let e = new Date(),
            y = Number.isFinite(l)
                ? Math.max(-(2 ** 53 - 1), Math.min(2 ** 53 - 1, l))
                : f(e),
            A = p(y);
        _ ??= `${m(y)} ${A}`;
        let j = h(y, 1),
            M = g(y),
            N = M.getDate(),
            P = j.getDay(),
            F = 7 - (M.getDay() % 7),
            I = N + P + F,
            [L, R, z] = [a, r, i].reduce(
                (e, t, n) => {
                    if (
                        (t != null && !(t instanceof Date) && (t = new Date(t)),
                        t == null || Number.isNaN(t.getTime()))
                    )
                        return e;
                    let r = f(t);
                    if (
                        (r < y
                            ? (e[n] = -1)
                            : r > y
                              ? (e[n] = N + 1)
                              : (e[n] = t.getDate()),
                        n === 1)
                    ) {
                        let t = e[n - 1],
                            r = e[n];
                        t != null && r != null && t > r && ((e[n - 1] = r), (e[n] = t));
                    }
                    return e;
                },
                [null, null, null],
            ),
            B;
        t[17] === u
            ? (B = t[18])
            : ((B = (e) => {
                  let { date: t } = e.currentTarget.dataset;
                  t && u && u(t);
              }),
              (t[17] = u),
              (t[18] = B));
        let V = B,
            H;
        t[19] !== c || t[20] !== d
            ? ((H = (e) => {
                  if (c && d) {
                      let { date: t } = e.currentTarget.dataset;
                      t && d(t);
                  }
              }),
              (t[19] = c),
              (t[20] = d),
              (t[21] = H))
            : (H = t[21]);
        let U = H;
        ((v = b.Fragment),
            t[22] === Symbol.for(`react.memo_cache_sentinel`)
                ? ((k = (0, x.jsx)(`style`, {
                      href: `@acusti/date-picker/MonthCalendar`,
                      precedence: `medium`,
                      children: s,
                  })),
                  (t[22] = k))
                : (k = t[22]),
            t[23] !== n || t[24] !== c
                ? ((E = o(C, n, { 'is-range': c })),
                  (t[23] = n),
                  (t[24] = c),
                  (t[25] = E))
                : (E = t[25]),
            t[26] === _
                ? (D = t[27])
                : ((D = (0, x.jsx)(`div`, {
                      className: `${C}-month-title`,
                      children: (0, x.jsx)(`h3`, {
                          className: `${C}-month-title-text`,
                          children: _,
                      }),
                  })),
                  (t[26] = _),
                  (t[27] = D)));
        let W;
        t[28] === Symbol.for(`react.memo_cache_sentinel`)
            ? ((W = (0, x.jsx)(`div`, {
                  className: `week-day-item`,
                  children: (0, x.jsx)(`span`, {
                      className: `week-day-item-text`,
                      children: `Su`,
                  }),
              })),
              (t[28] = W))
            : (W = t[28]);
        let G;
        t[29] === Symbol.for(`react.memo_cache_sentinel`)
            ? ((G = (0, x.jsx)(`div`, {
                  className: `week-day-item`,
                  children: (0, x.jsx)(`span`, {
                      className: `week-day-item-text`,
                      children: `Mo`,
                  }),
              })),
              (t[29] = G))
            : (G = t[29]);
        let K;
        t[30] === Symbol.for(`react.memo_cache_sentinel`)
            ? ((K = (0, x.jsx)(`div`, {
                  className: `week-day-item`,
                  children: (0, x.jsx)(`span`, {
                      className: `week-day-item-text`,
                      children: `Tu`,
                  }),
              })),
              (t[30] = K))
            : (K = t[30]);
        let q;
        t[31] === Symbol.for(`react.memo_cache_sentinel`)
            ? ((q = (0, x.jsx)(`div`, {
                  className: `week-day-item`,
                  children: (0, x.jsx)(`span`, {
                      className: `week-day-item-text`,
                      children: `We`,
                  }),
              })),
              (t[31] = q))
            : (q = t[31]);
        let J;
        t[32] === Symbol.for(`react.memo_cache_sentinel`)
            ? ((J = (0, x.jsx)(`div`, {
                  className: `week-day-item`,
                  children: (0, x.jsx)(`span`, {
                      className: `week-day-item-text`,
                      children: `Th`,
                  }),
              })),
              (t[32] = J))
            : (J = t[32]);
        let Y;
        (t[33] === Symbol.for(`react.memo_cache_sentinel`)
            ? ((Y = (0, x.jsx)(`div`, {
                  className: `week-day-item`,
                  children: (0, x.jsx)(`span`, {
                      className: `week-day-item-text`,
                      children: `Fr`,
                  }),
              })),
              (t[33] = Y))
            : (Y = t[33]),
            t[34] === Symbol.for(`react.memo_cache_sentinel`)
                ? ((O = (0, x.jsxs)(`div`, {
                      className: `${C}-month-week`,
                      children: [
                          W,
                          G,
                          K,
                          q,
                          J,
                          Y,
                          (0, x.jsx)(`div`, {
                              className: `week-day-item`,
                              children: (0, x.jsx)(`span`, {
                                  className: `week-day-item-text`,
                                  children: `Sa`,
                              }),
                          }),
                      ],
                  })),
                  (t[34] = O))
                : (O = t[34]),
            (w = `${C}-month-days`),
            (T = Array(Math.floor(I / 7))
                .fill(null)
                .map((t, n) =>
                    (0, x.jsx)(
                        `div`,
                        {
                            className: `${C}-month-row`,
                            children: S.map((t, r) => {
                                r += n * 7;
                                let i = r - P + 1,
                                    a = i < 1 || i > N,
                                    s = a ? null : h(y, i),
                                    c = L != null && i > L,
                                    l =
                                        (R == null && z != null && i < z) ||
                                        (R != null && i < R);
                                return (0, x.jsx)(
                                    `button`,
                                    {
                                        className: o(`${C}-month-day-item`, {
                                            'end-date': !a && i === R,
                                            'is-empty': a,
                                            'is-selected': !a && c && l,
                                            'is-today':
                                                !a && y === f(e) && i === e.getDate(),
                                            'start-date': !a && i === L,
                                        }),
                                        'data-date': s?.toISOString(),
                                        disabled: a,
                                        onClick: V,
                                        onMouseEnter: U,
                                        type: `button`,
                                        children: a
                                            ? null
                                            : (0, x.jsx)(`span`, {
                                                  className: `month-day-item-text`,
                                                  children: i,
                                              }),
                                    },
                                    `MonthDayItem-${i}`,
                                );
                            }),
                        },
                        `MonthRow-${n}`,
                    ),
                )),
            (t[0] = l),
            (t[1] = n),
            (t[2] = r),
            (t[3] = i),
            (t[4] = a),
            (t[5] = c),
            (t[6] = u),
            (t[7] = d),
            (t[8] = _),
            (t[9] = v),
            (t[10] = w),
            (t[11] = T),
            (t[12] = E),
            (t[13] = D),
            (t[14] = O),
            (t[15] = k),
            (t[16] = _));
    } else
        ((v = t[9]),
            (w = t[10]),
            (T = t[11]),
            (E = t[12]),
            (D = t[13]),
            (O = t[14]),
            (k = t[15]),
            (_ = t[16]));
    let A;
    t[35] !== w || t[36] !== T
        ? ((A = (0, x.jsx)(`div`, { className: w, children: T })),
          (t[35] = w),
          (t[36] = T),
          (t[37] = A))
        : (A = t[37]);
    let j;
    t[38] !== E || t[39] !== D || t[40] !== O || t[41] !== A
        ? ((j = (0, x.jsxs)(`div`, { className: E, children: [D, O, A] })),
          (t[38] = E),
          (t[39] = D),
          (t[40] = O),
          (t[41] = A),
          (t[42] = j))
        : (j = t[42]);
    let M;
    return (
        t[43] !== v || t[44] !== k || t[45] !== j
            ? ((M = (0, x.jsxs)(v, { children: [k, j] })),
              (t[43] = v),
              (t[44] = k),
              (t[45] = j),
              (t[46] = M))
            : (M = t[46]),
        M
    );
}
var y,
    b,
    x,
    S,
    C,
    w = t(() => {
        ((y = i()),
            a(),
            (b = e(n(), 1)),
            c(),
            _(),
            (x = r()),
            (S = Array(7).fill(null)),
            (C = `uktmonthcalendar`),
            (v.__docgenInfo = {
                description: ``,
                methods: [],
                displayName: `MonthCalendar`,
                props: {
                    className: {
                        required: !1,
                        tsType: { name: `string` },
                        description: ``,
                    },
                    dateEnd: {
                        required: !1,
                        tsType: {
                            name: `union`,
                            raw: `Date | null | number | string`,
                            elements: [
                                { name: `Date` },
                                { name: `null` },
                                { name: `number` },
                                { name: `string` },
                            ],
                        },
                        description: ``,
                    },
                    dateEndPreview: {
                        required: !1,
                        tsType: {
                            name: `union`,
                            raw: `null | string`,
                            elements: [{ name: `null` }, { name: `string` }],
                        },
                        description: ``,
                    },
                    dateStart: {
                        required: !1,
                        tsType: {
                            name: `union`,
                            raw: `Date | null | number | string`,
                            elements: [
                                { name: `Date` },
                                { name: `null` },
                                { name: `number` },
                                { name: `string` },
                            ],
                        },
                        description: ``,
                    },
                    isRange: {
                        required: !1,
                        tsType: { name: `boolean` },
                        description: ``,
                    },
                    month: { required: !0, tsType: { name: `number` }, description: `` },
                    onChange: {
                        required: !1,
                        tsType: {
                            name: `signature`,
                            type: `function`,
                            raw: `(date: string) => void`,
                            signature: {
                                arguments: [{ type: { name: `string` }, name: `date` }],
                                return: { name: `void` },
                            },
                        },
                        description: ``,
                    },
                    onChangeEndPreview: {
                        required: !1,
                        tsType: {
                            name: `signature`,
                            type: `function`,
                            raw: `(date: string) => void`,
                            signature: {
                                arguments: [{ type: { name: `string` }, name: `date` }],
                                return: { name: `void` },
                            },
                        },
                        description: ``,
                    },
                    title: { required: !1, tsType: { name: `string` }, description: `` },
                },
            }));
    }),
    T = t(() => {
        (w(), _());
    }),
    E = t(() => {}),
    D,
    O,
    k,
    A,
    j;
t(() => {
    (T(),
        E(),
        (D = {
            argTypes: {
                dateEnd: {
                    control: `date`,
                    description: `(optional) end date of current date range`,
                },
                dateStart: {
                    control: `date`,
                    description: `(optional) start date of current date range`,
                },
            },
            component: v,
            parameters: {
                docs: {
                    description: {
                        component:
                            '`MonthCalendar` is a React component that renders a calendar UI for the given month.',
                    },
                },
            },
            tags: [`autodocs`],
            title: `UIKit/Controls/DatePicker/MonthCalendar`,
        }),
        (O = { args: { className: `month-calendar-story`, month: f(new Date()) } }),
        (k = { args: { className: `february-month-calendar-story`, month: 181 } }),
        (A = {
            args: {
                className: `date-range-month-calendar-story`,
                dateEnd: new Date(2023, 10, 14),
                dateStart: new Date(2023, 10, 9),
                month: f(new Date(2023, 10, 1)),
            },
        }),
        (O.parameters = {
            ...O.parameters,
            docs: {
                ...O.parameters?.docs,
                source: {
                    originalSource: `{
  args: {
    className: 'month-calendar-story',
    month: getMonthFromDate(new Date())
  }
}`,
                    ...O.parameters?.docs?.source,
                },
            },
        }),
        (k.parameters = {
            ...k.parameters,
            docs: {
                ...k.parameters?.docs,
                source: {
                    originalSource: `{
  args: {
    className: 'february-month-calendar-story',
    month: 181
  }
}`,
                    ...k.parameters?.docs?.source,
                },
            },
        }),
        (A.parameters = {
            ...A.parameters,
            docs: {
                ...A.parameters?.docs,
                source: {
                    originalSource: `{
  args: {
    className: 'date-range-month-calendar-story',
    dateEnd: new Date(2023, 10, 14),
    dateStart: new Date(2023, 10, 9),
    month: getMonthFromDate(new Date(2023, 10, 1))
  }
}`,
                    ...A.parameters?.docs?.source,
                },
            },
        }),
        (j = [`ThisMonthsCalendar`, `February1985Calendar`, `DateRangeDiwaliCalendar`]));
})();
export {
    A as DateRangeDiwaliCalendar,
    k as February1985Calendar,
    O as ThisMonthsCalendar,
    j as __namedExportsOrder,
    D as default,
};
