UNPKG

react-flexible-datepicker

Version:
1,647 lines 57.2 kB
import './style.css'; import * as b from "react"; import C, { forwardRef as bt, useLayoutEffect as it, useEffect as st, createContext as Et, useState as Le, useContext as We } from "react"; import * as Rt from "react-dom"; const Pe = (e) => C.createElement( "svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 16 16", fill: "none", ...e, className: e.className }, C.createElement("path", { stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "1.8", d: "M3.5 6l4.193 3.887a.414.414 0 00.138.083.488.488 0 00.337 0c.053-.02.1-.048.138-.083L12.5 6" }) ), $t = (e) => C.createElement( "svg", { xmlns: "http://www.w3.org/2000/svg", fill: "currentColor", viewBox: "0 0 20 20", ...e, className: e.className }, C.createElement("path", { fillRule: "evenodd", d: "M6 2a1 1 0 00-1 1v1H4a2 2 0 00-2 2v10a2 2 0 002 2h12a2 2 0 002-2V6a2 2 0 00-2-2h-1V3a1 1 0 10-2 0v1H7V3a1 1 0 00-1-1zm0 5a1 1 0 000 2h8a1 1 0 100-2H6z", clipRule: "evenodd" }) ), K = (...e) => e.filter(Boolean).join(" "), me = bt(({ children: e, className: t, withHoverEffect: n = !0, ...r }, o) => C.createElement("button", { ...r, ref: o, className: K("border border-secondary-200 p-2.5 text-sm text-gray-700 rounded-md disabled:text-gray-400 focus:ring-1 flex items-center justify-center", n ? "hover:enabled:bg-blue-50" : "", t) }, e)); me.displayName = "Button"; function re(e) { return ct(e) ? (e.nodeName || "").toLowerCase() : "#document"; } function U(e) { var t; return (e == null || (t = e.ownerDocument) == null ? void 0 : t.defaultView) || window; } function Q(e) { var t; return (t = (ct(e) ? e.ownerDocument : e.document) || window.document) == null ? void 0 : t.documentElement; } function ct(e) { return e instanceof Node || e instanceof U(e).Node; } function V(e) { return e instanceof Element || e instanceof U(e).Element; } function z(e) { return e instanceof HTMLElement || e instanceof U(e).HTMLElement; } function Te(e) { return typeof ShadowRoot > "u" ? !1 : e instanceof ShadowRoot || e instanceof U(e).ShadowRoot; } function ye(e) { const { overflow: t, overflowX: n, overflowY: r, display: o } = X(e); return /auto|scroll|overlay|hidden|clip/.test(t + r + n) && !["inline", "contents"].includes(o); } function Dt(e) { return ["table", "td", "th"].includes(re(e)); } function Ae(e) { const t = Ie(), n = X(e); return n.transform !== "none" || n.perspective !== "none" || (n.containerType ? n.containerType !== "normal" : !1) || !t && (n.backdropFilter ? n.backdropFilter !== "none" : !1) || !t && (n.filter ? n.filter !== "none" : !1) || ["transform", "perspective", "filter"].some((r) => (n.willChange || "").includes(r)) || ["paint", "layout", "strict", "content"].some((r) => (n.contain || "").includes(r)); } function Ct(e) { let t = se(e); for (; z(t) && !le(t); ) { if (Ae(t)) return t; t = se(t); } return null; } function Ie() { return typeof CSS > "u" || !CSS.supports ? !1 : CSS.supports("-webkit-backdrop-filter", "none"); } function le(e) { return ["html", "body", "#document"].includes(re(e)); } function X(e) { return U(e).getComputedStyle(e); } function $e(e) { return V(e) ? { scrollLeft: e.scrollLeft, scrollTop: e.scrollTop } : { scrollLeft: e.pageXOffset, scrollTop: e.pageYOffset }; } function se(e) { if (re(e) === "html") return e; const t = ( // Step into the shadow DOM of the parent of a slotted node. e.assignedSlot || // DOM Element detected. e.parentNode || // ShadowRoot detected. Te(e) && e.host || // Fallback. Q(e) ); return Te(t) ? t.host : t; } function at(e) { const t = se(e); return le(t) ? e.ownerDocument ? e.ownerDocument.body : e.body : z(t) && ye(t) ? t : at(t); } function ne(e, t, n) { var r; t === void 0 && (t = []), n === void 0 && (n = !0); const o = at(e), i = o === ((r = e.ownerDocument) == null ? void 0 : r.body), s = U(o); return i ? t.concat(s, s.visualViewport || [], ye(o) ? o : [], s.frameElement && n ? ne(s.frameElement) : []) : t.concat(o, ne(o, [], n)); } function je(e, t) { if (!e || !t) return !1; const n = t.getRootNode && t.getRootNode(); if (e.contains(t)) return !0; if (n && Te(n)) { let r = t; for (; r; ) { if (e === r) return !0; r = r.parentNode || r.host; } } return !1; } function Ke(e, t) { const n = ["mouse", "pen"]; return t || n.push("", void 0), n.includes(e); } function kt(e) { return "nativeEvent" in e; } function Mt(e) { return e.matches("html,body"); } function Ue(e) { return (e == null ? void 0 : e.ownerDocument) || document; } function Me(e, t) { if (t == null) return !1; if ("composedPath" in e) return e.composedPath().includes(t); const n = e; return n.target != null && t.contains(n.target); } function he(e) { return "composedPath" in e ? e.composedPath()[0] : e.target; } const Ot = "input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])"; function St(e) { return z(e) && e.matches(Ot); } const ge = Math.min, Z = Math.max, be = Math.round, ve = Math.floor, oe = (e) => ({ x: e, y: e }); function Fe(e, t) { return typeof e == "function" ? e(t) : e; } function De(e) { return e.split("-")[0]; } function He(e) { return e.split("-")[1]; } function _t(e) { return e === "x" ? "y" : "x"; } function Pt(e) { return e === "y" ? "height" : "width"; } function Ce(e) { return ["top", "bottom"].includes(De(e)) ? "y" : "x"; } function Tt(e) { return _t(Ce(e)); } function Nt(e) { return { top: 0, right: 0, bottom: 0, left: 0, ...e }; } function Lt(e) { return typeof e != "number" ? Nt(e) : { top: e, right: e, bottom: e, left: e }; } function Ee(e) { return { ...e, top: e.y, left: e.x, right: e.x + e.width, bottom: e.y + e.height }; } function ze(e, t, n) { let { reference: r, floating: o } = e; const i = Ce(t), s = Tt(t), c = Pt(s), u = De(t), l = i === "y", p = r.x + r.width / 2 - o.width / 2, h = r.y + r.height / 2 - o.height / 2, y = r[c] / 2 - o[c] / 2; let m; switch (u) { case "top": m = { x: p, y: r.y - o.height }; break; case "bottom": m = { x: p, y: r.y + r.height }; break; case "right": m = { x: r.x + r.width, y: h }; break; case "left": m = { x: r.x - o.width, y: h }; break; default: m = { x: r.x, y: r.y }; } switch (He(t)) { case "start": m[s] -= y * (n && l ? -1 : 1); break; case "end": m[s] += y * (n && l ? -1 : 1); break; } return m; } const Wt = async (e, t, n) => { const { placement: r = "bottom", strategy: o = "absolute", middleware: i = [], platform: s } = n, c = i.filter(Boolean), u = await (s.isRTL == null ? void 0 : s.isRTL(t)); let l = await s.getElementRects({ reference: e, floating: t, strategy: o }), { x: p, y: h } = ze(l, r, u), y = r, m = {}, v = 0; for (let E = 0; E < c.length; E++) { const { name: N, fn: k } = c[E], { x: _, y: W, data: S, reset: $ } = await k({ x: p, y: h, initialPlacement: r, placement: y, strategy: o, middlewareData: m, rects: l, platform: s, elements: { reference: e, floating: t } }); if (p = _ ?? p, h = W ?? h, m = { ...m, [N]: { ...m[N], ...S } }, $ && v <= 50) { v++, typeof $ == "object" && ($.placement && (y = $.placement), $.rects && (l = $.rects === !0 ? await s.getElementRects({ reference: e, floating: t, strategy: o }) : $.rects), { x: p, y: h } = ze(l, y, u)), E = -1; continue; } } return { x: p, y: h, placement: y, strategy: o, middlewareData: m }; }; async function At(e, t) { var n; t === void 0 && (t = {}); const { x: r, y: o, platform: i, rects: s, elements: c, strategy: u } = e, { boundary: l = "clippingAncestors", rootBoundary: p = "viewport", elementContext: h = "floating", altBoundary: y = !1, padding: m = 0 } = Fe(t, e), v = Lt(m), N = c[y ? h === "floating" ? "reference" : "floating" : h], k = Ee(await i.getClippingRect({ element: (n = await (i.isElement == null ? void 0 : i.isElement(N))) == null || n ? N : N.contextElement || await (i.getDocumentElement == null ? void 0 : i.getDocumentElement(c.floating)), boundary: l, rootBoundary: p, strategy: u })), _ = h === "floating" ? { ...s.floating, x: r, y: o } : s.reference, W = await (i.getOffsetParent == null ? void 0 : i.getOffsetParent(c.floating)), S = await (i.isElement == null ? void 0 : i.isElement(W)) ? await (i.getScale == null ? void 0 : i.getScale(W)) || { x: 1, y: 1 } : { x: 1, y: 1 }, $ = Ee(i.convertOffsetParentRelativeRectToViewportRelativeRect ? await i.convertOffsetParentRelativeRectToViewportRelativeRect({ rect: _, offsetParent: W, strategy: u }) : _); return { top: (k.top - $.top + v.top) / S.y, bottom: ($.bottom - k.bottom + v.bottom) / S.y, left: (k.left - $.left + v.left) / S.x, right: ($.right - k.right + v.right) / S.x }; } async function It(e, t) { const { placement: n, platform: r, elements: o } = e, i = await (r.isRTL == null ? void 0 : r.isRTL(o.floating)), s = De(n), c = He(n), u = Ce(n) === "y", l = ["left", "top"].includes(s) ? -1 : 1, p = i && u ? -1 : 1, h = Fe(t, e); let { mainAxis: y, crossAxis: m, alignmentAxis: v } = typeof h == "number" ? { mainAxis: h, crossAxis: 0, alignmentAxis: null } : { mainAxis: 0, crossAxis: 0, alignmentAxis: null, ...h }; return c && typeof v == "number" && (m = c === "end" ? v * -1 : v), u ? { x: m * p, y: y * l } : { x: y * l, y: m * p }; } const Ft = function(e) { return e === void 0 && (e = 0), { name: "offset", options: e, async fn(t) { var n, r; const { x: o, y: i, placement: s, middlewareData: c } = t, u = await It(t, e); return s === ((n = c.offset) == null ? void 0 : n.placement) && (r = c.arrow) != null && r.alignmentOffset ? {} : { x: o + u.x, y: i + u.y, data: { ...u, placement: s } }; } }; }, Ht = function(e) { return e === void 0 && (e = {}), { name: "size", options: e, async fn(t) { const { placement: n, rects: r, platform: o, elements: i } = t, { apply: s = () => { }, ...c } = Fe(e, t), u = await At(t, c), l = De(n), p = He(n), h = Ce(n) === "y", { width: y, height: m } = r.floating; let v, E; l === "top" || l === "bottom" ? (v = l, E = p === (await (o.isRTL == null ? void 0 : o.isRTL(i.floating)) ? "start" : "end") ? "left" : "right") : (E = l, v = p === "end" ? "top" : "bottom"); const N = m - u[v], k = y - u[E], _ = !t.middlewareData.shift; let W = N, S = k; if (h) { const O = y - u.left - u.right; S = p || _ ? ge(k, O) : O; } else { const O = m - u.top - u.bottom; W = p || _ ? ge(N, O) : O; } if (_ && !p) { const O = Z(u.left, 0), B = Z(u.right, 0), M = Z(u.top, 0), A = Z(u.bottom, 0); h ? S = y - 2 * (O !== 0 || B !== 0 ? O + B : Z(u.left, u.right)) : W = m - 2 * (M !== 0 || A !== 0 ? M + A : Z(u.top, u.bottom)); } await s({ ...t, availableWidth: S, availableHeight: W }); const $ = await o.getDimensions(i.floating); return y !== $.width || m !== $.height ? { reset: { rects: !0 } } : {}; } }; }; function ut(e) { const t = X(e); let n = parseFloat(t.width) || 0, r = parseFloat(t.height) || 0; const o = z(e), i = o ? e.offsetWidth : n, s = o ? e.offsetHeight : r, c = be(n) !== i || be(r) !== s; return c && (n = i, r = s), { width: n, height: r, $: c }; } function Be(e) { return V(e) ? e : e.contextElement; } function ue(e) { const t = Be(e); if (!z(t)) return oe(1); const n = t.getBoundingClientRect(), { width: r, height: o, $: i } = ut(t); let s = (i ? be(n.width) : n.width) / r, c = (i ? be(n.height) : n.height) / o; return (!s || !Number.isFinite(s)) && (s = 1), (!c || !Number.isFinite(c)) && (c = 1), { x: s, y: c }; } const Bt = /* @__PURE__ */ oe(0); function lt(e) { const t = U(e); return !Ie() || !t.visualViewport ? Bt : { x: t.visualViewport.offsetLeft, y: t.visualViewport.offsetTop }; } function Vt(e, t, n) { return t === void 0 && (t = !1), !n || t && n !== U(e) ? !1 : t; } function ce(e, t, n, r) { t === void 0 && (t = !1), n === void 0 && (n = !1); const o = e.getBoundingClientRect(), i = Be(e); let s = oe(1); t && (r ? V(r) && (s = ue(r)) : s = ue(e)); const c = Vt(i, n, r) ? lt(i) : oe(0); let u = (o.left + c.x) / s.x, l = (o.top + c.y) / s.y, p = o.width / s.x, h = o.height / s.y; if (i) { const y = U(i), m = r && V(r) ? U(r) : r; let v = y.frameElement; for (; v && r && m !== y; ) { const E = ue(v), N = v.getBoundingClientRect(), k = X(v), _ = N.left + (v.clientLeft + parseFloat(k.paddingLeft)) * E.x, W = N.top + (v.clientTop + parseFloat(k.paddingTop)) * E.y; u *= E.x, l *= E.y, p *= E.x, h *= E.y, u += _, l += W, v = U(v).frameElement; } } return Ee({ width: p, height: h, x: u, y: l }); } function Yt(e) { let { rect: t, offsetParent: n, strategy: r } = e; const o = z(n), i = Q(n); if (n === i) return t; let s = { scrollLeft: 0, scrollTop: 0 }, c = oe(1); const u = oe(0); if ((o || !o && r !== "fixed") && ((re(n) !== "body" || ye(i)) && (s = $e(n)), z(n))) { const l = ce(n); c = ue(n), u.x = l.x + n.clientLeft, u.y = l.y + n.clientTop; } return { width: t.width * c.x, height: t.height * c.y, x: t.x * c.x - s.scrollLeft * c.x + u.x, y: t.y * c.y - s.scrollTop * c.y + u.y }; } function jt(e) { return Array.from(e.getClientRects()); } function ft(e) { return ce(Q(e)).left + $e(e).scrollLeft; } function Kt(e) { const t = Q(e), n = $e(e), r = e.ownerDocument.body, o = Z(t.scrollWidth, t.clientWidth, r.scrollWidth, r.clientWidth), i = Z(t.scrollHeight, t.clientHeight, r.scrollHeight, r.clientHeight); let s = -n.scrollLeft + ft(e); const c = -n.scrollTop; return X(r).direction === "rtl" && (s += Z(t.clientWidth, r.clientWidth) - o), { width: o, height: i, x: s, y: c }; } function Ut(e, t) { const n = U(e), r = Q(e), o = n.visualViewport; let i = r.clientWidth, s = r.clientHeight, c = 0, u = 0; if (o) { i = o.width, s = o.height; const l = Ie(); (!l || l && t === "fixed") && (c = o.offsetLeft, u = o.offsetTop); } return { width: i, height: s, x: c, y: u }; } function zt(e, t) { const n = ce(e, !0, t === "fixed"), r = n.top + e.clientTop, o = n.left + e.clientLeft, i = z(e) ? ue(e) : oe(1), s = e.clientWidth * i.x, c = e.clientHeight * i.y, u = o * i.x, l = r * i.y; return { width: s, height: c, x: u, y: l }; } function Xe(e, t, n) { let r; if (t === "viewport") r = Ut(e, n); else if (t === "document") r = Kt(Q(e)); else if (V(t)) r = zt(t, n); else { const o = lt(e); r = { ...t, x: t.x - o.x, y: t.y - o.y }; } return Ee(r); } function dt(e, t) { const n = se(e); return n === t || !V(n) || le(n) ? !1 : X(n).position === "fixed" || dt(n, t); } function Xt(e, t) { const n = t.get(e); if (n) return n; let r = ne(e, [], !1).filter((c) => V(c) && re(c) !== "body"), o = null; const i = X(e).position === "fixed"; let s = i ? se(e) : e; for (; V(s) && !le(s); ) { const c = X(s), u = Ae(s); !u && c.position === "fixed" && (o = null), (i ? !u && !o : !u && c.position === "static" && !!o && ["absolute", "fixed"].includes(o.position) || ye(s) && !u && dt(e, s)) ? r = r.filter((p) => p !== s) : o = c, s = se(s); } return t.set(e, r), r; } function qt(e) { let { element: t, boundary: n, rootBoundary: r, strategy: o } = e; const s = [...n === "clippingAncestors" ? Xt(t, this._c) : [].concat(n), r], c = s[0], u = s.reduce((l, p) => { const h = Xe(t, p, o); return l.top = Z(h.top, l.top), l.right = ge(h.right, l.right), l.bottom = ge(h.bottom, l.bottom), l.left = Z(h.left, l.left), l; }, Xe(t, c, o)); return { width: u.right - u.left, height: u.bottom - u.top, x: u.left, y: u.top }; } function Jt(e) { return ut(e); } function Zt(e, t, n) { const r = z(t), o = Q(t), i = n === "fixed", s = ce(e, !0, i, t); let c = { scrollLeft: 0, scrollTop: 0 }; const u = oe(0); if (r || !r && !i) if ((re(t) !== "body" || ye(o)) && (c = $e(t)), r) { const l = ce(t, !0, i, t); u.x = l.x + t.clientLeft, u.y = l.y + t.clientTop; } else o && (u.x = ft(o)); return { x: s.left + c.scrollLeft - u.x, y: s.top + c.scrollTop - u.y, width: s.width, height: s.height }; } function qe(e, t) { return !z(e) || X(e).position === "fixed" ? null : t ? t(e) : e.offsetParent; } function ht(e, t) { const n = U(e); if (!z(e)) return n; let r = qe(e, t); for (; r && Dt(r) && X(r).position === "static"; ) r = qe(r, t); return r && (re(r) === "html" || re(r) === "body" && X(r).position === "static" && !Ae(r)) ? n : r || Ct(e) || n; } const Gt = async function(e) { let { reference: t, floating: n, strategy: r } = e; const o = this.getOffsetParent || ht, i = this.getDimensions; return { reference: Zt(t, await o(n), r), floating: { x: 0, y: 0, ...await i(n) } }; }; function Qt(e) { return X(e).direction === "rtl"; } const en = { convertOffsetParentRelativeRectToViewportRelativeRect: Yt, getDocumentElement: Q, getClippingRect: qt, getOffsetParent: ht, getElementRects: Gt, getClientRects: jt, getDimensions: Jt, getScale: ue, isElement: V, isRTL: Qt }; function tn(e, t) { let n = null, r; const o = Q(e); function i() { clearTimeout(r), n && n.disconnect(), n = null; } function s(c, u) { c === void 0 && (c = !1), u === void 0 && (u = 1), i(); const { left: l, top: p, width: h, height: y } = e.getBoundingClientRect(); if (c || t(), !h || !y) return; const m = ve(p), v = ve(o.clientWidth - (l + h)), E = ve(o.clientHeight - (p + y)), N = ve(l), _ = { rootMargin: -m + "px " + -v + "px " + -E + "px " + -N + "px", threshold: Z(0, ge(1, u)) || 1 }; let W = !0; function S($) { const O = $[0].intersectionRatio; if (O !== u) { if (!W) return s(); O ? s(!1, O) : r = setTimeout(() => { s(!1, 1e-7); }, 100); } W = !1; } try { n = new IntersectionObserver(S, { ..._, // Handle <iframe>s root: o.ownerDocument }); } catch { n = new IntersectionObserver(S, _); } n.observe(e); } return s(!0), i; } function nn(e, t, n, r) { r === void 0 && (r = {}); const { ancestorScroll: o = !0, ancestorResize: i = !0, elementResize: s = typeof ResizeObserver == "function", layoutShift: c = typeof IntersectionObserver == "function", animationFrame: u = !1 } = r, l = Be(e), p = o || i ? [...l ? ne(l) : [], ...ne(t)] : []; p.forEach((k) => { o && k.addEventListener("scroll", n, { passive: !0 }), i && k.addEventListener("resize", n); }); const h = l && c ? tn(l, n) : null; let y = -1, m = null; s && (m = new ResizeObserver((k) => { let [_] = k; _ && _.target === l && m && (m.unobserve(t), cancelAnimationFrame(y), y = requestAnimationFrame(() => { m && m.observe(t); })), n(); }), l && !u && m.observe(l), m.observe(t)); let v, E = u ? ce(e) : null; u && N(); function N() { const k = ce(e); E && (k.x !== E.x || k.y !== E.y || k.width !== E.width || k.height !== E.height) && n(), E = k, v = requestAnimationFrame(N); } return n(), () => { p.forEach((k) => { o && k.removeEventListener("scroll", n), i && k.removeEventListener("resize", n); }), h && h(), m && m.disconnect(), m = null, u && cancelAnimationFrame(v); }; } const rn = (e, t, n) => { const r = /* @__PURE__ */ new Map(), o = { platform: en, ...n }, i = { ...o.platform, _c: r }; return Wt(e, t, { ...o, platform: i }); }; var xe = typeof document < "u" ? it : st; function Re(e, t) { if (e === t) return !0; if (typeof e != typeof t) return !1; if (typeof e == "function" && e.toString() === t.toString()) return !0; let n, r, o; if (e && t && typeof e == "object") { if (Array.isArray(e)) { if (n = e.length, n != t.length) return !1; for (r = n; r-- !== 0; ) if (!Re(e[r], t[r])) return !1; return !0; } if (o = Object.keys(e), n = o.length, n !== Object.keys(t).length) return !1; for (r = n; r-- !== 0; ) if (!{}.hasOwnProperty.call(t, o[r])) return !1; for (r = n; r-- !== 0; ) { const i = o[r]; if (!(i === "_owner" && e.$$typeof) && !Re(e[i], t[i])) return !1; } return !0; } return e !== e && t !== t; } function mt(e) { return typeof window > "u" ? 1 : (e.ownerDocument.defaultView || window).devicePixelRatio || 1; } function Je(e, t) { const n = mt(e); return Math.round(t * n) / n; } function Ze(e) { const t = b.useRef(e); return xe(() => { t.current = e; }), t; } function on(e) { e === void 0 && (e = {}); const { placement: t = "bottom", strategy: n = "absolute", middleware: r = [], platform: o, elements: { reference: i, floating: s } = {}, transform: c = !0, whileElementsMounted: u, open: l } = e, [p, h] = b.useState({ x: 0, y: 0, strategy: n, placement: t, middlewareData: {}, isPositioned: !1 }), [y, m] = b.useState(r); Re(y, r) || m(r); const [v, E] = b.useState(null), [N, k] = b.useState(null), _ = b.useCallback((f) => { f != O.current && (O.current = f, E(f)); }, [E]), W = b.useCallback((f) => { f !== B.current && (B.current = f, k(f)); }, [k]), S = i || v, $ = s || N, O = b.useRef(null), B = b.useRef(null), M = b.useRef(p), A = Ze(u), T = Ze(o), D = b.useCallback(() => { if (!O.current || !B.current) return; const f = { placement: t, strategy: n, middleware: y }; T.current && (f.platform = T.current), rn(O.current, B.current, f).then((g) => { const a = { ...g, isPositioned: !0 }; q.current && !Re(M.current, a) && (M.current = a, Rt.flushSync(() => { h(a); })); }); }, [y, t, n, T]); xe(() => { l === !1 && M.current.isPositioned && (M.current.isPositioned = !1, h((f) => ({ ...f, isPositioned: !1 }))); }, [l]); const q = b.useRef(!1); xe(() => (q.current = !0, () => { q.current = !1; }), []), xe(() => { if (S && (O.current = S), $ && (B.current = $), S && $) { if (A.current) return A.current(S, $, D); D(); } }, [S, $, D, A]); const G = b.useMemo(() => ({ reference: O, floating: B, setReference: _, setFloating: W }), [_, W]), w = b.useMemo(() => ({ reference: S, floating: $ }), [S, $]), d = b.useMemo(() => { const f = { position: n, left: 0, top: 0 }; if (!w.floating) return f; const g = Je(w.floating, p.x), a = Je(w.floating, p.y); return c ? { ...f, transform: "translate(" + g + "px, " + a + "px)", ...mt(w.floating) >= 1.5 && { willChange: "transform" } } : { position: n, left: g, top: a }; }, [n, c, w.floating, p.x, p.y]); return b.useMemo(() => ({ ...p, update: D, refs: G, elements: w, floatingStyles: d }), [p, D, G, w, d]); } const sn = b[/* @__PURE__ */ "useInsertionEffect".toString()], cn = sn || ((e) => e()); function ae(e) { const t = b.useRef(() => { if (process.env.NODE_ENV !== "production") throw new Error("Cannot call an event handler while rendering."); }); return cn(() => { t.current = e; }), b.useCallback(function() { for (var n = arguments.length, r = new Array(n), o = 0; o < n; o++) r[o] = arguments[o]; return t.current == null ? void 0 : t.current(...r); }, []); } var gt = typeof document < "u" ? it : st; let Oe = !1, an = 0; const Ge = () => "floating-ui-" + an++; function un() { const [e, t] = b.useState(() => Oe ? Ge() : void 0); return gt(() => { e == null && t(Ge()); }, []), b.useEffect(() => { Oe || (Oe = !0); }, []), e; } const ln = b[/* @__PURE__ */ "useId".toString()], fn = ln || un; function dn() { const e = /* @__PURE__ */ new Map(); return { emit(t, n) { var r; (r = e.get(t)) == null || r.forEach((o) => o(n)); }, on(t, n) { e.set(t, [...e.get(t) || [], n]); }, off(t, n) { var r; e.set(t, ((r = e.get(t)) == null ? void 0 : r.filter((o) => o !== n)) || []); } }; } const hn = /* @__PURE__ */ b.createContext(null), mn = /* @__PURE__ */ b.createContext(null), gn = () => { var e; return ((e = b.useContext(hn)) == null ? void 0 : e.id) || null; }, pt = () => b.useContext(mn); function pn(e) { return "data-floating-ui-" + e; } function Se(e, t) { let n = e.filter((o) => { var i; return o.parentId === t && ((i = o.context) == null ? void 0 : i.open); }), r = n; for (; r.length; ) r = e.filter((o) => { var i; return (i = r) == null ? void 0 : i.some((s) => { var c; return o.parentId === s.id && ((c = o.context) == null ? void 0 : c.open); }); }), n = n.concat(r); return n; } function Qe(e) { return z(e.target) && e.target.tagName === "BUTTON"; } function et(e) { return St(e); } function yn(e, t) { t === void 0 && (t = {}); const { open: n, onOpenChange: r, dataRef: o, elements: { domReference: i } } = e, { enabled: s = !0, event: c = "click", toggle: u = !0, ignoreMouse: l = !1, keyboardHandlers: p = !0 } = t, h = b.useRef(), y = b.useRef(!1); return b.useMemo(() => s ? { reference: { onPointerDown(m) { h.current = m.pointerType; }, onMouseDown(m) { m.button === 0 && (Ke(h.current, !0) && l || c !== "click" && (n && u && (!o.current.openEvent || o.current.openEvent.type === "mousedown") ? r(!1, m.nativeEvent, "click") : (m.preventDefault(), r(!0, m.nativeEvent, "click")))); }, onClick(m) { if (c === "mousedown" && h.current) { h.current = void 0; return; } Ke(h.current, !0) && l || (n && u && (!o.current.openEvent || o.current.openEvent.type === "click") ? r(!1, m.nativeEvent, "click") : r(!0, m.nativeEvent, "click")); }, onKeyDown(m) { h.current = void 0, !(m.defaultPrevented || !p || Qe(m)) && (m.key === " " && !et(i) && (m.preventDefault(), y.current = !0), m.key === "Enter" && r(!(n && u), m.nativeEvent, "click")); }, onKeyUp(m) { m.defaultPrevented || !p || Qe(m) || et(i) || m.key === " " && y.current && (y.current = !1, r(!(n && u), m.nativeEvent, "click")); } } } : {}, [s, o, c, l, p, i, u, n, r]); } const wn = { pointerdown: "onPointerDown", mousedown: "onMouseDown", click: "onClick" }, vn = { pointerdown: "onPointerDownCapture", mousedown: "onMouseDownCapture", click: "onClickCapture" }, tt = (e) => { var t, n; return { escapeKey: typeof e == "boolean" ? e : (t = e == null ? void 0 : e.escapeKey) != null ? t : !1, outsidePress: typeof e == "boolean" ? e : (n = e == null ? void 0 : e.outsidePress) != null ? n : !0 }; }; function xn(e, t) { t === void 0 && (t = {}); const { open: n, onOpenChange: r, nodeId: o, elements: { reference: i, domReference: s, floating: c }, dataRef: u } = e, { enabled: l = !0, escapeKey: p = !0, outsidePress: h = !0, outsidePressEvent: y = "pointerdown", referencePress: m = !1, referencePressEvent: v = "pointerdown", ancestorScroll: E = !1, bubbles: N, capture: k } = t, _ = pt(), W = ae(typeof h == "function" ? h : () => !1), S = typeof h == "function" ? W : h, $ = b.useRef(!1), O = b.useRef(!1), { escapeKey: B, outsidePress: M } = tt(N), { escapeKey: A, outsidePress: T } = tt(k), D = ae((d) => { if (!n || !l || !p || d.key !== "Escape") return; const f = _ ? Se(_.nodesRef.current, o) : []; if (!B && (d.stopPropagation(), f.length > 0)) { let g = !0; if (f.forEach((a) => { var x; if ((x = a.context) != null && x.open && !a.context.dataRef.current.__escapeKeyBubbles) { g = !1; return; } }), !g) return; } r(!1, kt(d) ? d.nativeEvent : d, "escape-key"); }), q = ae((d) => { var f; const g = () => { var a; D(d), (a = he(d)) == null || a.removeEventListener("keydown", g); }; (f = he(d)) == null || f.addEventListener("keydown", g); }), G = ae((d) => { const f = $.current; $.current = !1; const g = O.current; if (O.current = !1, y === "click" && g || f || typeof S == "function" && !S(d)) return; const a = he(d), x = "[" + pn("inert") + "]", R = Ue(c).querySelectorAll(x); let P = V(a) ? a : null; for (; P && !le(P); ) { const L = se(P); if (le(L) || !V(L)) break; P = L; } if (R.length && V(a) && !Mt(a) && // Clicked on a direct ancestor (e.g. FloatingOverlay). !je(a, c) && // If the target root element contains none of the markers, then the // element was injected after the floating element rendered. Array.from(R).every((L) => !je(P, L))) return; if (z(a) && c) { const L = a.clientWidth > 0 && a.scrollWidth > a.clientWidth, H = a.clientHeight > 0 && a.scrollHeight > a.clientHeight; let J = H && d.offsetX > a.clientWidth; if (H && X(a).direction === "rtl" && (J = d.offsetX <= a.offsetWidth - a.clientWidth), J || L && d.offsetY > a.clientHeight) return; } const I = _ && Se(_.nodesRef.current, o).some((L) => { var H; return Me(d, (H = L.context) == null ? void 0 : H.elements.floating); }); if (Me(d, c) || Me(d, s) || I) return; const F = _ ? Se(_.nodesRef.current, o) : []; if (F.length > 0) { let L = !0; if (F.forEach((H) => { var J; if ((J = H.context) != null && J.open && !H.context.dataRef.current.__outsidePressBubbles) { L = !1; return; } }), !L) return; } r(!1, d, "outside-press"); }), w = ae((d) => { var f; const g = () => { var a; G(d), (a = he(d)) == null || a.removeEventListener(y, g); }; (f = he(d)) == null || f.addEventListener(y, g); }); return b.useEffect(() => { if (!n || !l) return; u.current.__escapeKeyBubbles = B, u.current.__outsidePressBubbles = M; function d(a) { r(!1, a, "ancestor-scroll"); } const f = Ue(c); p && f.addEventListener("keydown", A ? q : D, A), S && f.addEventListener(y, T ? w : G, T); let g = []; return E && (V(s) && (g = ne(s)), V(c) && (g = g.concat(ne(c))), !V(i) && i && i.contextElement && (g = g.concat(ne(i.contextElement)))), g = g.filter((a) => { var x; return a !== ((x = f.defaultView) == null ? void 0 : x.visualViewport); }), g.forEach((a) => { a.addEventListener("scroll", d, { passive: !0 }); }), () => { p && f.removeEventListener("keydown", A ? q : D, A), S && f.removeEventListener(y, T ? w : G, T), g.forEach((a) => { a.removeEventListener("scroll", d); }); }; }, [u, c, s, i, p, S, y, n, r, E, l, B, M, D, A, q, G, T, w]), b.useEffect(() => { $.current = !1; }, [S, y]), b.useMemo(() => l ? { reference: { onKeyDown: D, [wn[v]]: (d) => { m && r(!1, d.nativeEvent, "reference-press"); } }, floating: { onKeyDown: D, onMouseDown() { O.current = !0; }, onMouseUp() { O.current = !0; }, [vn[y]]: () => { $.current = !0; } } } : {}, [l, m, y, v, r, D]); } let Ne; process.env.NODE_ENV !== "production" && (Ne = /* @__PURE__ */ new Set()); function bn(e) { var t; e === void 0 && (e = {}); const { open: n = !1, onOpenChange: r, nodeId: o } = e; if (process.env.NODE_ENV !== "production") { var i; const M = "Floating UI: Cannot pass a virtual element to the `elements.reference` option, as it must be a real DOM element. Use `refs.setPositionReference` instead."; if ((i = e.elements) != null && i.reference && !V(e.elements.reference)) { var s; if (!((s = Ne) != null && s.has(M))) { var c; (c = Ne) == null || c.add(M), console.error(M); } } } const [u, l] = b.useState(null), p = ((t = e.elements) == null ? void 0 : t.reference) || u, h = on(e), y = pt(), m = gn() != null, v = ae((M, A, T) => { M && (N.current.openEvent = A), k.emit("openchange", { open: M, event: A, reason: T, nested: m }), r == null || r(M, A, T); }), E = b.useRef(null), N = b.useRef({}), k = b.useState(() => dn())[0], _ = fn(), W = b.useCallback((M) => { const A = V(M) ? { getBoundingClientRect: () => M.getBoundingClientRect(), contextElement: M } : M; h.refs.setReference(A); }, [h.refs]), S = b.useCallback((M) => { (V(M) || M === null) && (E.current = M, l(M)), (V(h.refs.reference.current) || h.refs.reference.current === null || // Don't allow setting virtual elements using the old technique back to // `null` to support `positionReference` + an unstable `reference` // callback ref. M !== null && !V(M)) && h.refs.setReference(M); }, [h.refs]), $ = b.useMemo(() => ({ ...h.refs, setReference: S, setPositionReference: W, domReference: E }), [h.refs, S, W]), O = b.useMemo(() => ({ ...h.elements, domReference: p }), [h.elements, p]), B = b.useMemo(() => ({ ...h, refs: $, elements: O, dataRef: N, nodeId: o, floatingId: _, events: k, open: n, onOpenChange: v }), [h, o, _, k, n, v, $, O]); return gt(() => { const M = y == null ? void 0 : y.nodesRef.current.find((A) => A.id === o); M && (M.context = B); }), b.useMemo(() => ({ ...h, context: B, refs: $, elements: O }), [h, $, O, B]); } const nt = "active", rt = "selected"; function _e(e, t, n) { const r = /* @__PURE__ */ new Map(), o = n === "item"; let i = e; if (o && e) { const { [nt]: s, [rt]: c, ...u } = e; i = u; } return { ...n === "floating" && { tabIndex: -1 }, ...i, ...t.map((s) => { const c = s ? s[n] : null; return typeof c == "function" ? e ? c(e) : null : c; }).concat(e).reduce((s, c) => (c && Object.entries(c).forEach((u) => { let [l, p] = u; if (!(o && [nt, rt].includes(l))) if (l.indexOf("on") === 0) { if (r.has(l) || r.set(l, []), typeof p == "function") { var h; (h = r.get(l)) == null || h.push(p), s[l] = function() { for (var y, m = arguments.length, v = new Array(m), E = 0; E < m; E++) v[E] = arguments[E]; return (y = r.get(l)) == null ? void 0 : y.map((N) => N(...v)).find((N) => N !== void 0); }; } } else s[l] = p; }), s), {}) }; } function En(e) { e === void 0 && (e = []); const t = e, n = b.useCallback( (i) => _e(i, e, "reference"), // eslint-disable-next-line react-hooks/exhaustive-deps t ), r = b.useCallback( (i) => _e(i, e, "floating"), // eslint-disable-next-line react-hooks/exhaustive-deps t ), o = b.useCallback( (i) => _e(i, e, "item"), // Granularly check for `item` changes, because the `getItemProps` getter // should be as referentially stable as possible since it may be passed as // a prop to many components. All `item` key values must therefore be // memoized. // eslint-disable-next-line react-hooks/exhaustive-deps e.map((i) => i == null ? void 0 : i.item) ); return b.useMemo(() => ({ getReferenceProps: n, getFloatingProps: r, getItemProps: o }), [n, r, o]); } const ke = Et(null), Rn = ({ children: e }) => { const [t, n] = Le(!1), { refs: r, floatingStyles: o, context: i } = bn({ open: t, onOpenChange: n, whileElementsMounted: nn, middleware: [ Ft(8), Ht({ apply({ rects: y, elements: m }) { Object.assign(m.floating.style, { minWidth: `${y.reference.width}px` }); } }) ] }), s = yn(i), c = xn(i), { getReferenceProps: u, getFloatingProps: l } = En([s, c]), h = { isPanelOpen: t, refs: r, floatingStyles: o, getReferenceProps: u, getFloatingProps: l, close: () => { n(!1); } }; return C.createElement(ke.Provider, { value: h }, e); }, $n = ({ children: e, disabled: t, className: n }) => { const r = We(ke); return C.createElement( me, { ref: r == null ? void 0 : r.refs.setReference, className: K(`w-72 border border-secondary-700 rounded-md shadow-xs flex items-center gap-x-2 px-4 py-2 ${t ? "bg-secondary-600 text-neutral-800" : "text-gray-700 hover:bg-info-50"}`, n), ...r == null ? void 0 : r.getReferenceProps() }, e, C.createElement(Pe, { className: "w-4 h-4 ml-auto" }) ); }, Dn = ({ classes: e, children: t }) => C.createElement("div", { className: K("shadow-sm border bg-white border-neutral-200 flex flex-col p-6 rounded-lg", e == null ? void 0 : e.root) }, t), Cn = ({ children: e, classes: t }) => { const n = We(ke); return (!n || (n == null ? void 0 : n.isPanelOpen)) && C.createElement( "div", { ref: n == null ? void 0 : n.refs.setFloating, style: n == null ? void 0 : n.floatingStyles, ...n == null ? void 0 : n.getFloatingProps() }, C.createElement(Dn, { classes: t }, e) ); }, pe = ({ children: e }) => C.createElement(Rn, null, e); pe.Button = $n; pe.Panel = Cn; const kn = ({ children: e, className: t }) => C.createElement("div", { className: K("grid grid-cols-[36px_36px_36px_36px_36px_36px_36px] grid-rows-[36px_36px_36px_36px_36px_36px_36px] gap-1", t) }, e); var Ve = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}; function Ye(e) { return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e; } var yt = { exports: {} }; (function(e, t) { (function(n, r) { e.exports = r(); })(Ve, function() { var n = 1e3, r = 6e4, o = 36e5, i = "millisecond", s = "second", c = "minute", u = "hour", l = "day", p = "week", h = "month", y = "quarter", m = "year", v = "date", E = "Invalid Date", N = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/, k = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g, _ = { name: "en", weekdays: "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"), months: "January_February_March_April_May_June_July_August_September_October_November_December".split("_"), ordinal: function(w) { var d = ["th", "st", "nd", "rd"], f = w % 100; return "[" + w + (d[(f - 20) % 10] || d[f] || d[0]) + "]"; } }, W = function(w, d, f) { var g = String(w); return !g || g.length >= d ? w : "" + Array(d + 1 - g.length).join(f) + w; }, S = { s: W, z: function(w) { var d = -w.utcOffset(), f = Math.abs(d), g = Math.floor(f / 60), a = f % 60; return (d <= 0 ? "+" : "-") + W(g, 2, "0") + ":" + W(a, 2, "0"); }, m: function w(d, f) { if (d.date() < f.date()) return -w(f, d); var g = 12 * (f.year() - d.year()) + (f.month() - d.month()), a = d.clone().add(g, h), x = f - a < 0, R = d.clone().add(g + (x ? -1 : 1), h); return +(-(g + (f - a) / (x ? a - R : R - a)) || 0); }, a: function(w) { return w < 0 ? Math.ceil(w) || 0 : Math.floor(w); }, p: function(w) { return { M: h, y: m, w: p, d: l, D: v, h: u, m: c, s, ms: i, Q: y }[w] || String(w || "").toLowerCase().replace(/s$/, ""); }, u: function(w) { return w === void 0; } }, $ = "en", O = {}; O[$] = _; var B = "$isDayjsObject", M = function(w) { return w instanceof q || !(!w || !w[B]); }, A = function w(d, f, g) { var a; if (!d) return $; if (typeof d == "string") { var x = d.toLowerCase(); O[x] && (a = x), f && (O[x] = f, a = x); var R = d.split("-"); if (!a && R.length > 1) return w(R[0]); } else { var P = d.name; O[P] = d, a = P; } return !g && a && ($ = a), a || !g && $; }, T = function(w, d) { if (M(w)) return w.clone(); var f = typeof d == "object" ? d : {}; return f.date = w, f.args = arguments, new q(f); }, D = S; D.l = A, D.i = M, D.w = function(w, d) { return T(w, { locale: d.$L, utc: d.$u, x: d.$x, $offset: d.$offset }); }; var q = function() { function w(f) { this.$L = A(f.locale, null, !0), this.parse(f), this.$x = this.$x || f.x || {}, this[B] = !0; } var d = w.prototype; return d.parse = function(f) { this.$d = function(g) { var a = g.date, x = g.utc; if (a === null) return /* @__PURE__ */ new Date(NaN); if (D.u(a)) return /* @__PURE__ */ new Date(); if (a instanceof Date) return new Date(a); if (typeof a == "string" && !/Z$/i.test(a)) { var R = a.match(N); if (R) { var P = R[2] - 1 || 0, I = (R[7] || "0").substring(0, 3); return x ? new Date(Date.UTC(R[1], P, R[3] || 1, R[4] || 0, R[5] || 0, R[6] || 0, I)) : new Date(R[1], P, R[3] || 1, R[4] || 0, R[5] || 0, R[6] || 0, I); } } return new Date(a); }(f), this.init(); }, d.init = function() { var f = this.$d; this.$y = f.getFullYear(), this.$M = f.getMonth(), this.$D = f.getDate(), this.$W = f.getDay(), this.$H = f.getHours(), this.$m = f.getMinutes(), this.$s = f.getSeconds(), this.$ms = f.getMilliseconds(); }, d.$utils = function() { return D; }, d.isValid = function() { return this.$d.toString() !== E; }, d.isSame = function(f, g) { var a = T(f); return this.startOf(g) <= a && a <= this.endOf(g); }, d.isAfter = function(f, g) { return T(f) < this.startOf(g); }, d.isBefore = function(f, g) { return this.endOf(g) < T(f); }, d.$g = function(f, g, a) { return D.u(f) ? this[g] : this.set(a, f); }, d.unix = function() { return Math.floor(this.valueOf() / 1e3); }, d.valueOf = function() { return this.$d.getTime(); }, d.startOf = function(f, g) { var a = this, x = !!D.u(g) || g, R = D.p(f), P = function(ie, j) { var te = D.w(a.$u ? Date.UTC(a.$y, j, ie) : new Date(a.$y, j, ie), a); return x ? te : te.endOf(l); }, I = function(ie, j) { return D.w(a.toDate()[ie].apply(a.toDate("s"), (x ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(j)), a); }, F = this.$W, L = this.$M, H = this.$D, J = "set" + (this.$u ? "UTC" : ""); switch (R) { case m: return x ? P(1, 0) : P(31, 11); case h: return x ? P(1, L) : P(0, L + 1); case p: var ee = this.$locale().weekStart || 0, fe = (F < ee ? F + 7 : F) - ee; return P(x ? H - fe : H + (6 - fe), L); case l: case v: return I(J + "Hours", 0); case u: return I(J + "Minutes", 1); case c: return I(J + "Seconds", 2); case s: return I(J + "Milliseconds", 3); default: return this.clone(); } }, d.endOf = function(f) { return this.startOf(f, !1); }, d.$set = function(f, g) { var a, x = D.p(f), R = "set" + (this.$u ? "UTC" : ""), P = (a = {}, a[l] = R + "Date", a[v] = R + "Date", a[h] = R + "Month", a[m] = R + "FullYear", a[u] = R + "Hours", a[c] = R + "Minutes", a[s] = R + "Seconds", a[i] = R + "Milliseconds", a)[x], I = x === l ? this.$D + (g - this.$W) : g; if (x === h || x === m) { var F = this.clone().set(v, 1); F.$d[P](I), F.init(), this.$d = F.set(v, Math.min(this.$D, F.daysInMonth())).$d; } else P && this.$d[P](I); return this.init(), this; }, d.set = function(f, g) { return this.clone().$set(f, g); }, d.get = function(f) { return this[D.p(f)](); }, d.add = function(f, g) { var a, x = this; f = Number(f); var R = D.p(g), P = function(L) { var H = T(x); return D.w(H.date(H.date() + Math.round(L * f)), x); }; if (R === h) return this.set(h, this.$M + f); if (R === m) return this.set(m, this.$y + f); if (R === l) return P(1); if (R === p) return P(7); var I = (a = {}, a[c] = r, a[u] = o, a[s] = n, a)[R] || 1, F = this.$d.getTime() + f * I; return D.w(F, this); }, d.subtract = function(f, g) { return this.add(-1 * f, g); }, d.format = function(f) { var g = this, a = this.$locale(); if (!this.isValid()) return a.invalidDate || E; var x = f || "YYYY-MM-DDTHH:mm:ssZ", R = D.z(this), P = this.$H, I = this.$m, F = this.$M, L = a.weekdays, H = a.months, J = a.meridiem, ee = function(j, te, de, we) { return j && (j[te] || j(g, x)) || de[te].slice(0, we); }, fe = function(j) { return D.s(P % 12 || 12, j, "0"); }, ie = J || function(j, te, de) { var we = j < 12 ? "AM" : "PM"; return de ? we.toLowerCase() : we; }; return x.replace(k, function(j, te) { return te || function(de) { switch (de) { case "YY": return String(g.$y).slice(-2); case "YYYY": return D.s(g.$y, 4, "0"); case "M": return F + 1; case "MM": return D.s(F + 1, 2, "0"); case "MMM": return ee(a.monthsShort, F, H, 3); case "MMMM": return ee(H, F); case "D": return g.$D; case "DD": return D.s(g.$D, 2, "0"); case "d": return String(g.$W); case "dd": return ee(a.weekdaysMin, g.$W, L, 2); case "ddd": return ee(a.weekdaysShort, g.$W, L, 3); case "dddd": return L[g.$W]; case "H": return String(P); case "HH": return D.s(P, 2, "0"); case "h": return fe(1); case "hh": return fe(2); case "a": return ie(P, I, !0); case "A": return ie(P, I, !1); case "m": return String(I); case "mm": return D.s(I, 2, "0"); case "s": return String(g.$s); case "ss": return D.s(g.$s, 2, "0"); case "SSS": return D.s(g.$ms, 3, "0"); case "Z": return R; } return null; }(j) || R.replace(":", ""); }); }, d.utcOffset = function() { return 15 * -Math.round(this.$d.getTimezoneOffset() / 15); }, d.diff = function(f, g, a) { var x, R = this, P = D.p(g), I = T(f), F = (I.utcOffset() - this.utcOffset()) * r, L = this - I, H = function() { return D.m(R, I); }; switch (P) { case m: x = H() / 12; break; case h: x = H(); break; case y: x = H() / 3; break; case p: x = (L - F) / 6048e5; break; case l: x = (L - F) / 864e5; break; case u: x = L / o; break; case c: x = L / r; break; case s: x = L / n; break; default: x = L; } return a ? x : D.a(x); }, d.daysInMonth = function() { return this.endOf(h).$D; }, d.$locale = function() { return O[this.$L]; }, d.locale = function(f, g) { if (!f) return this.$L; var a = this.clone(), x = A(f, g, !0); return x && (a.$L = x), a; }, d.clone = function() { return D.w(this.$d, this); }, d.toDate = function() { return new Date(this.valueOf()); }, d.toJSON