@object-ui/plugin-calendar 4.0.3 → 4.0.5

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.
package/dist/index.js CHANGED
@@ -1,465 +1,14 @@
1
1
  import * as e from "react";
2
- import t, { createContext as n, useCallback as r, useContext as i, useEffect as a, useMemo as o, useRef as s, useState as c } from "react";
3
- import { ComponentRegistry as l, buildExpandFields as u, extractRecords as d } from "@object-ui/core";
4
- import { useNavigationOverlay as f, useSchemaContext as p } from "@object-ui/react";
5
- import { CalendarIcon as m, ChevronLeftIcon as h, ChevronRightIcon as g, PlusIcon as _ } from "lucide-react";
6
- import { Button as v, Calendar as y, NavigationOverlay as b, Popover as x, PopoverContent as S, PopoverTrigger as C, Select as w, SelectContent as T, SelectItem as E, SelectTrigger as D, SelectValue as O, cn as k, useIsMobile as A } from "@object-ui/components";
7
- //#region \0rolldown/runtime.js
8
- var j = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t.exports), M = /* @__PURE__ */ ((e) => typeof require < "u" ? require : typeof Proxy < "u" ? new Proxy(e, { get: (e, t) => (typeof require < "u" ? require : e)[t] }) : e)(function(e) {
9
- if (typeof require < "u") return require.apply(this, arguments);
10
- throw Error("Calling `require` for \"" + e + "\" in an environment that doesn't expose the `require` function. See https://rolldown.rs/in-depth/bundling-cjs#require-external-modules for more details.");
11
- }), N = (e, t, n, r) => {
12
- let i = [n, {
13
- code: t,
14
- ...r || {}
15
- }];
16
- if (e?.services?.logger?.forward) return e.services.logger.forward(i, "warn", "react-i18next::", !0);
17
- B(i[0]) && (i[0] = `react-i18next:: ${i[0]}`), e?.services?.logger?.warn ? e.services.logger.warn(...i) : console?.warn && console.warn(...i);
18
- }, P = {}, F = (e, t, n, r) => {
19
- B(n) && P[n] || (B(n) && (P[n] = /* @__PURE__ */ new Date()), N(e, t, n, r));
20
- }, I = (e, t) => () => {
21
- if (e.isInitialized) t();
22
- else {
23
- let n = () => {
24
- setTimeout(() => {
25
- e.off("initialized", n);
26
- }, 0), t();
27
- };
28
- e.on("initialized", n);
29
- }
30
- }, L = (e, t, n) => {
31
- e.loadNamespaces(t, I(e, n));
32
- }, R = (e, t, n, r) => {
33
- if (B(n) && (n = [n]), e.options.preload && e.options.preload.indexOf(t) > -1) return L(e, n, r);
34
- n.forEach((t) => {
35
- e.options.ns.indexOf(t) < 0 && e.options.ns.push(t);
36
- }), e.loadLanguages(t, I(e, r));
37
- }, z = (e, t, n = {}) => !t.languages || !t.languages.length ? (F(t, "NO_LANGUAGES", "i18n.languages were undefined or empty", { languages: t.languages }), !0) : t.hasLoadedNamespace(e, {
38
- lng: n.lng,
39
- precheck: (t, r) => {
40
- if (n.bindI18n && n.bindI18n.indexOf("languageChanging") > -1 && t.services.backendConnector.backend && t.isLanguageChangingTo && !r(t.isLanguageChangingTo, e)) return !1;
41
- }
42
- }), B = (e) => typeof e == "string", V = (e) => typeof e == "object" && !!e, H = /&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g, U = {
43
- "&amp;": "&",
44
- "&#38;": "&",
45
- "&lt;": "<",
46
- "&#60;": "<",
47
- "&gt;": ">",
48
- "&#62;": ">",
49
- "&apos;": "'",
50
- "&#39;": "'",
51
- "&quot;": "\"",
52
- "&#34;": "\"",
53
- "&nbsp;": " ",
54
- "&#160;": " ",
55
- "&copy;": "©",
56
- "&#169;": "©",
57
- "&reg;": "®",
58
- "&#174;": "®",
59
- "&hellip;": "…",
60
- "&#8230;": "…",
61
- "&#x2F;": "/",
62
- "&#47;": "/"
63
- }, W = (e) => U[e], G = {
64
- bindI18n: "languageChanged",
65
- bindI18nStore: "",
66
- transEmptyNodeValue: "",
67
- transSupportBasicHtmlNodes: !0,
68
- transWrapTextNodes: "",
69
- transKeepBasicHtmlNodesFor: [
70
- "br",
71
- "strong",
72
- "i",
73
- "p"
74
- ],
75
- useSuspense: !0,
76
- unescape: (e) => e.replace(H, W),
77
- transDefaultProps: void 0
78
- }, K = () => G, q, ee = () => q, te = n(), ne = class {
79
- constructor() {
80
- this.usedNamespaces = {};
81
- }
82
- addUsedNamespaces(e) {
83
- e.forEach((e) => {
84
- this.usedNamespaces[e] || (this.usedNamespaces[e] = !0);
85
- });
86
- }
87
- getUsedNamespaces() {
88
- return Object.keys(this.usedNamespaces);
89
- }
90
- }, re = /* @__PURE__ */ j(((e) => {
91
- var t = M("react");
92
- function n(e, t) {
93
- return e === t && (e !== 0 || 1 / e == 1 / t) || e !== e && t !== t;
94
- }
95
- var r = typeof Object.is == "function" ? Object.is : n, i = t.useState, a = t.useEffect, o = t.useLayoutEffect, s = t.useDebugValue;
96
- function c(e, t) {
97
- var n = t(), r = i({ inst: {
98
- value: n,
99
- getSnapshot: t
100
- } }), c = r[0].inst, u = r[1];
101
- return o(function() {
102
- c.value = n, c.getSnapshot = t, l(c) && u({ inst: c });
103
- }, [
104
- e,
105
- n,
106
- t
107
- ]), a(function() {
108
- return l(c) && u({ inst: c }), e(function() {
109
- l(c) && u({ inst: c });
110
- });
111
- }, [e]), s(n), n;
112
- }
113
- function l(e) {
114
- var t = e.getSnapshot;
115
- e = e.value;
116
- try {
117
- var n = t();
118
- return !r(e, n);
119
- } catch {
120
- return !0;
121
- }
122
- }
123
- function u(e, t) {
124
- return t();
125
- }
126
- var d = typeof window > "u" || window.document === void 0 || window.document.createElement === void 0 ? u : c;
127
- e.useSyncExternalStore = t.useSyncExternalStore === void 0 ? d : t.useSyncExternalStore;
128
- })), ie = /* @__PURE__ */ j(((e) => {
129
- process.env.NODE_ENV !== "production" && (function() {
130
- function t(e, t) {
131
- return e === t && (e !== 0 || 1 / e == 1 / t) || e !== e && t !== t;
132
- }
133
- function n(e, t) {
134
- d || a.startTransition === void 0 || (d = !0, console.error("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));
135
- var n = t();
136
- if (!f) {
137
- var i = t();
138
- o(n, i) || (console.error("The result of getSnapshot should be cached to avoid an infinite loop"), f = !0);
139
- }
140
- i = s({ inst: {
141
- value: n,
142
- getSnapshot: t
143
- } });
144
- var p = i[0].inst, m = i[1];
145
- return l(function() {
146
- p.value = n, p.getSnapshot = t, r(p) && m({ inst: p });
147
- }, [
148
- e,
149
- n,
150
- t
151
- ]), c(function() {
152
- return r(p) && m({ inst: p }), e(function() {
153
- r(p) && m({ inst: p });
154
- });
155
- }, [e]), u(n), n;
156
- }
157
- function r(e) {
158
- var t = e.getSnapshot;
159
- e = e.value;
160
- try {
161
- var n = t();
162
- return !o(e, n);
163
- } catch {
164
- return !0;
165
- }
166
- }
167
- function i(e, t) {
168
- return t();
169
- }
170
- typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
171
- var a = M("react"), o = typeof Object.is == "function" ? Object.is : t, s = a.useState, c = a.useEffect, l = a.useLayoutEffect, u = a.useDebugValue, d = !1, f = !1, p = typeof window > "u" || window.document === void 0 || window.document.createElement === void 0 ? i : n;
172
- e.useSyncExternalStore = a.useSyncExternalStore === void 0 ? p : a.useSyncExternalStore, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
173
- })();
174
- })), ae = (/* @__PURE__ */ j(((e, t) => {
175
- process.env.NODE_ENV === "production" ? t.exports = re() : t.exports = ie();
176
- })))(), oe = {
177
- t: (e, t) => {
178
- if (B(t)) return t;
179
- if (V(t) && B(t.defaultValue)) return t.defaultValue;
180
- if (typeof e == "function") return "";
181
- if (Array.isArray(e)) {
182
- let t = e[e.length - 1];
183
- return typeof t == "function" ? "" : t;
184
- }
185
- return e;
186
- },
187
- ready: !1
188
- }, se = () => () => {}, ce = (e, t = {}) => {
189
- let { i18n: n } = t, { i18n: l, defaultNS: u } = i(te) || {}, d = n || l || ee();
190
- d && !d.reportNamespaces && (d.reportNamespaces = new ne()), d || F(d, "NO_I18NEXT_INSTANCE", "useTranslation: You will need to pass in an i18next instance by using initReactI18next");
191
- let f = o(() => ({
192
- ...K(),
193
- ...d?.options?.react,
194
- ...t
195
- }), [d, t]), { useSuspense: p, keyPrefix: m } = f, h = e || u || d?.options?.defaultNS, g = B(h) ? [h] : h || ["translation"], _ = o(() => g, g);
196
- d?.reportNamespaces?.addUsedNamespaces?.(_);
197
- let v = s(0), y = r((e) => {
198
- if (!d) return se;
199
- let { bindI18n: t, bindI18nStore: n } = f, r = () => {
200
- v.current += 1, e();
201
- };
202
- return t && d.on(t, r), n && d.store.on(n, r), () => {
203
- t && t.split(" ").forEach((e) => d.off(e, r)), n && n.split(" ").forEach((e) => d.store.off(e, r));
204
- };
205
- }, [d, f]), b = s(), x = r(() => {
206
- if (!d) return oe;
207
- let e = !!(d.isInitialized || d.initializedStoreOnce) && _.every((e) => z(e, d, f)), n = t.lng || d.language, r = v.current, i = b.current;
208
- if (i && i.ready === e && i.lng === n && i.keyPrefix === m && i.revision === r) return i;
209
- let a = {
210
- t: d.getFixedT(n, f.nsMode === "fallback" ? _ : _[0], m),
211
- ready: e,
212
- lng: n,
213
- keyPrefix: m,
214
- revision: r
215
- };
216
- return b.current = a, a;
217
- }, [
218
- d,
219
- _,
220
- m,
221
- f,
222
- t.lng
223
- ]), [S, C] = c(0), { t: w, ready: T } = (0, ae.useSyncExternalStore)(y, x, x);
224
- a(() => {
225
- if (d && !T && !p) {
226
- let e = () => C((e) => e + 1);
227
- t.lng ? R(d, t.lng, _, e) : L(d, _, e);
228
- }
229
- }, [
230
- d,
231
- t.lng,
232
- _,
233
- T,
234
- p,
235
- S
236
- ]);
237
- let E = d || {}, D = s(null), O = s(), k = (e) => {
238
- let t = Object.getOwnPropertyDescriptors(e);
239
- t.__original && delete t.__original;
240
- let n = Object.create(Object.getPrototypeOf(e), t);
241
- if (!Object.prototype.hasOwnProperty.call(n, "__original")) try {
242
- Object.defineProperty(n, "__original", {
243
- value: e,
244
- writable: !1,
245
- enumerable: !1,
246
- configurable: !1
247
- });
248
- } catch {}
249
- return n;
250
- }, A = o(() => {
251
- let e = E, t = e?.language, n = e;
252
- e && (D.current && D.current.__original === e && O.current === t ? n = D.current : (n = k(e), D.current = n, O.current = t));
253
- let r = !T && !p ? (...e) => (F(d, "USE_T_BEFORE_READY", "useTranslation: t was called before ready. When using useSuspense: false, make sure to check the ready flag before using t."), w(...e)) : w, i = [
254
- r,
255
- n,
256
- T
257
- ];
258
- return i.t = r, i.i18n = n, i.ready = T, i;
259
- }, [
260
- w,
261
- E,
262
- T,
263
- E.resolvedLanguage,
264
- E.language,
265
- E.languages
266
- ]);
267
- if (d && p && !T) throw new Promise((e) => {
268
- let n = () => e();
269
- t.lng ? R(d, t.lng, _, n) : L(d, _, n);
270
- });
271
- return A;
272
- }, le = n(null);
273
- function ue(e) {
274
- let t = i(le), { t: n, i18n: r } = ce(e);
275
- return {
276
- t: n,
277
- language: t?.language || r.language || "en",
278
- changeLanguage: t?.changeLanguage || (async (e) => {
279
- await r.changeLanguage(e);
280
- }),
281
- direction: t?.direction || "ltr",
282
- i18n: r
283
- };
284
- }
285
- //#endregion
286
- //#region ../../node_modules/.pnpm/react@19.2.5/node_modules/react/cjs/react-jsx-runtime.production.js
287
- var de = /* @__PURE__ */ j(((e) => {
288
- var t = Symbol.for("react.transitional.element"), n = Symbol.for("react.fragment");
289
- function r(e, n, r) {
290
- var i = null;
291
- if (r !== void 0 && (i = "" + r), n.key !== void 0 && (i = "" + n.key), "key" in n) for (var a in r = {}, n) a !== "key" && (r[a] = n[a]);
292
- else r = n;
293
- return n = r.ref, {
294
- $$typeof: t,
295
- type: e,
296
- key: i,
297
- ref: n === void 0 ? null : n,
298
- props: r
299
- };
300
- }
301
- e.Fragment = n, e.jsx = r, e.jsxs = r;
302
- })), fe = /* @__PURE__ */ j(((e) => {
303
- process.env.NODE_ENV !== "production" && (function() {
304
- function t(e) {
305
- if (e == null) return null;
306
- if (typeof e == "function") return e.$$typeof === O ? null : e.displayName || e.name || null;
307
- if (typeof e == "string") return e;
308
- switch (e) {
309
- case _: return "Fragment";
310
- case y: return "Profiler";
311
- case v: return "StrictMode";
312
- case C: return "Suspense";
313
- case w: return "SuspenseList";
314
- case D: return "Activity";
315
- }
316
- if (typeof e == "object") switch (typeof e.tag == "number" && console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), e.$$typeof) {
317
- case g: return "Portal";
318
- case x: return e.displayName || "Context";
319
- case b: return (e._context.displayName || "Context") + ".Consumer";
320
- case S:
321
- var n = e.render;
322
- return e = e.displayName, e ||= (e = n.displayName || n.name || "", e === "" ? "ForwardRef" : "ForwardRef(" + e + ")"), e;
323
- case T: return n = e.displayName || null, n === null ? t(e.type) || "Memo" : n;
324
- case E:
325
- n = e._payload, e = e._init;
326
- try {
327
- return t(e(n));
328
- } catch {}
329
- }
330
- return null;
331
- }
332
- function n(e) {
333
- return "" + e;
334
- }
335
- function r(e) {
336
- try {
337
- n(e);
338
- var t = !1;
339
- } catch {
340
- t = !0;
341
- }
342
- if (t) {
343
- t = console;
344
- var r = t.error, i = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object";
345
- return r.call(t, "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.", i), n(e);
346
- }
347
- }
348
- function i(e) {
349
- if (e === _) return "<>";
350
- if (typeof e == "object" && e && e.$$typeof === E) return "<...>";
351
- try {
352
- var n = t(e);
353
- return n ? "<" + n + ">" : "<...>";
354
- } catch {
355
- return "<...>";
356
- }
357
- }
358
- function a() {
359
- var e = k.A;
360
- return e === null ? null : e.getOwner();
361
- }
362
- function o() {
363
- return Error("react-stack-top-frame");
364
- }
365
- function s(e) {
366
- if (A.call(e, "key")) {
367
- var t = Object.getOwnPropertyDescriptor(e, "key").get;
368
- if (t && t.isReactWarning) return !1;
369
- }
370
- return e.key !== void 0;
371
- }
372
- function c(e, t) {
373
- function n() {
374
- P || (P = !0, console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)", t));
375
- }
376
- n.isReactWarning = !0, Object.defineProperty(e, "key", {
377
- get: n,
378
- configurable: !0
379
- });
380
- }
381
- function l() {
382
- var e = t(this.type);
383
- return F[e] || (F[e] = !0, console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")), e = this.props.ref, e === void 0 ? null : e;
384
- }
385
- function u(e, t, n, r, i, a) {
386
- var o = n.ref;
387
- return e = {
388
- $$typeof: h,
389
- type: e,
390
- key: t,
391
- props: n,
392
- _owner: r
393
- }, (o === void 0 ? null : o) === null ? Object.defineProperty(e, "ref", {
394
- enumerable: !1,
395
- value: null
396
- }) : Object.defineProperty(e, "ref", {
397
- enumerable: !1,
398
- get: l
399
- }), e._store = {}, Object.defineProperty(e._store, "validated", {
400
- configurable: !1,
401
- enumerable: !1,
402
- writable: !0,
403
- value: 0
404
- }), Object.defineProperty(e, "_debugInfo", {
405
- configurable: !1,
406
- enumerable: !1,
407
- writable: !0,
408
- value: null
409
- }), Object.defineProperty(e, "_debugStack", {
410
- configurable: !1,
411
- enumerable: !1,
412
- writable: !0,
413
- value: i
414
- }), Object.defineProperty(e, "_debugTask", {
415
- configurable: !1,
416
- enumerable: !1,
417
- writable: !0,
418
- value: a
419
- }), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
420
- }
421
- function d(e, n, i, o, l, d) {
422
- var p = n.children;
423
- if (p !== void 0) if (o) if (j(p)) {
424
- for (o = 0; o < p.length; o++) f(p[o]);
425
- Object.freeze && Object.freeze(p);
426
- } else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
427
- else f(p);
428
- if (A.call(n, "key")) {
429
- p = t(e);
430
- var m = Object.keys(n).filter(function(e) {
431
- return e !== "key";
432
- });
433
- o = 0 < m.length ? "{key: someKey, " + m.join(": ..., ") + ": ...}" : "{key: someKey}", R[p + o] || (m = 0 < m.length ? "{" + m.join(": ..., ") + ": ...}" : "{}", console.error("A props object containing a \"key\" prop is being spread into JSX:\n let props = %s;\n <%s {...props} />\nReact keys must be passed directly to JSX without using spread:\n let props = %s;\n <%s key={someKey} {...props} />", o, p, m, p), R[p + o] = !0);
434
- }
435
- if (p = null, i !== void 0 && (r(i), p = "" + i), s(n) && (r(n.key), p = "" + n.key), "key" in n) for (var h in i = {}, n) h !== "key" && (i[h] = n[h]);
436
- else i = n;
437
- return p && c(i, typeof e == "function" ? e.displayName || e.name || "Unknown" : e), u(e, p, i, a(), l, d);
438
- }
439
- function f(e) {
440
- p(e) ? e._store && (e._store.validated = 1) : typeof e == "object" && e && e.$$typeof === E && (e._payload.status === "fulfilled" ? p(e._payload.value) && e._payload.value._store && (e._payload.value._store.validated = 1) : e._store && (e._store.validated = 1));
441
- }
442
- function p(e) {
443
- return typeof e == "object" && !!e && e.$$typeof === h;
444
- }
445
- var m = M("react"), h = Symbol.for("react.transitional.element"), g = Symbol.for("react.portal"), _ = Symbol.for("react.fragment"), v = Symbol.for("react.strict_mode"), y = Symbol.for("react.profiler"), b = Symbol.for("react.consumer"), x = Symbol.for("react.context"), S = Symbol.for("react.forward_ref"), C = Symbol.for("react.suspense"), w = Symbol.for("react.suspense_list"), T = Symbol.for("react.memo"), E = Symbol.for("react.lazy"), D = Symbol.for("react.activity"), O = Symbol.for("react.client.reference"), k = m.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, A = Object.prototype.hasOwnProperty, j = Array.isArray, N = console.createTask ? console.createTask : function() {
446
- return null;
447
- };
448
- m = { react_stack_bottom_frame: function(e) {
449
- return e();
450
- } };
451
- var P, F = {}, I = m.react_stack_bottom_frame.bind(m, o)(), L = N(i(o)), R = {};
452
- e.Fragment = _, e.jsx = function(e, t, n) {
453
- var r = 1e4 > k.recentlyCreatedOwnerStacks++;
454
- return d(e, t, n, !1, r ? Error("react-stack-top-frame") : I, r ? N(i(e)) : L);
455
- }, e.jsxs = function(e, t, n) {
456
- var r = 1e4 > k.recentlyCreatedOwnerStacks++;
457
- return d(e, t, n, !0, r ? Error("react-stack-top-frame") : I, r ? N(i(e)) : L);
458
- };
459
- })();
460
- })), J = (/* @__PURE__ */ j(((e, t) => {
461
- process.env.NODE_ENV === "production" ? t.exports = de() : t.exports = fe();
462
- })))(), Y = "bg-blue-500 text-white", pe = /* @__PURE__ */ new Date(), X = {
2
+ import t, { useCallback as n, useEffect as r, useMemo as i, useRef as a, useState as o } from "react";
3
+ import { ComponentRegistry as s, buildExpandFields as c, extractRecords as l } from "@object-ui/core";
4
+ import { useNavigationOverlay as u, useSchemaContext as d } from "@object-ui/react";
5
+ import { CalendarIcon as f, ChevronLeftIcon as p, ChevronRightIcon as m, PlusIcon as h } from "lucide-react";
6
+ import { Button as g, Calendar as _, NavigationOverlay as v, Popover as y, PopoverContent as b, PopoverTrigger as x, Select as S, SelectContent as C, SelectItem as w, SelectTrigger as T, SelectValue as E, cn as D, useIsMobile as O } from "@object-ui/components";
7
+ import { useObjectTranslation as k } from "@object-ui/i18n";
8
+ import { jsx as A, jsxs as j } from "react/jsx-runtime";
9
+ import { usePullToRefresh as M } from "@object-ui/mobile";
10
+ //#region src/CalendarView.tsx
11
+ var N = "bg-blue-500 text-white", P = /* @__PURE__ */ new Date(), F = {
463
12
  "calendar.today": "Today",
464
13
  "calendar.month": "Month",
465
14
  "calendar.week": "Week",
@@ -467,12 +16,12 @@ var de = /* @__PURE__ */ j(((e) => {
467
16
  "calendar.newEvent": "New event",
468
17
  "calendar.moreEvents": "+{{count}} more"
469
18
  };
470
- function Z() {
19
+ function I() {
471
20
  try {
472
- let e = ue();
21
+ let e = k();
473
22
  return e.t("calendar.today") === "calendar.today" ? {
474
23
  t: (e, t) => {
475
- let n = X[e] || e;
24
+ let n = F[e] || e;
476
25
  if (t) for (let [e, r] of Object.entries(t)) n = n.replace(`{{${e}}}`, String(r));
477
26
  return n;
478
27
  },
@@ -484,7 +33,7 @@ function Z() {
484
33
  } catch {
485
34
  return {
486
35
  t: (e, t) => {
487
- let n = X[e] || e;
36
+ let n = F[e] || e;
488
37
  if (t) for (let [e, r] of Object.entries(t)) n = n.replace(`{{${e}}}`, String(r));
489
38
  return n;
490
39
  },
@@ -492,171 +41,171 @@ function Z() {
492
41
  };
493
42
  }
494
43
  }
495
- function Q({ events: t = [], view: n = "month", currentDate: r = pe, locale: i = "default", onEventClick: a, onDateClick: o, onViewChange: s, onNavigate: c, onAddClick: l, onEventDrop: u, className: d }) {
496
- let [f, p] = e.useState(n), [b, A] = e.useState(r), { t: j, language: M } = Z(), N = i === "default" ? M : i;
44
+ function L({ events: t = [], view: n = "month", currentDate: r = P, locale: i = "default", onEventClick: a, onDateClick: o, onViewChange: s, onNavigate: c, onAddClick: l, onEventDrop: u, className: d }) {
45
+ let [v, O] = e.useState(n), [k, M] = e.useState(r), { t: N, language: F } = I(), L = i === "default" ? F : i;
497
46
  e.useEffect(() => {
498
- A(r);
47
+ M(r);
499
48
  }, [r]), e.useEffect(() => {
500
- p(n);
49
+ O(n);
501
50
  }, [n]);
502
- let P = e.useRef(s);
503
- P.current = s, e.useEffect(() => {
51
+ let z = e.useRef(s);
52
+ z.current = s, e.useEffect(() => {
504
53
  let e = window.matchMedia("(max-width: 639px)"), t = (e) => {
505
- e.matches && (p("day"), P.current?.("day"));
54
+ e.matches && (O("day"), z.current?.("day"));
506
55
  };
507
56
  return t(e), e.addEventListener("change", t), () => e.removeEventListener("change", t);
508
57
  }, []);
509
- let F = () => {
510
- let e = new Date(b);
511
- f === "month" ? e.setMonth(e.getMonth() - 1) : f === "week" ? e.setDate(e.getDate() - 7) : e.setDate(e.getDate() - 1), A(e), c?.(e);
512
- }, I = () => {
513
- let e = new Date(b);
514
- f === "month" ? e.setMonth(e.getMonth() + 1) : f === "week" ? e.setDate(e.getDate() + 7) : e.setDate(e.getDate() + 1), A(e), c?.(e);
515
- }, L = () => {
58
+ let B = () => {
59
+ let e = new Date(k);
60
+ v === "month" ? e.setMonth(e.getMonth() - 1) : v === "week" ? e.setDate(e.getDate() - 7) : e.setDate(e.getDate() - 1), M(e), c?.(e);
61
+ }, V = () => {
62
+ let e = new Date(k);
63
+ v === "month" ? e.setMonth(e.getMonth() + 1) : v === "week" ? e.setDate(e.getDate() + 7) : e.setDate(e.getDate() + 1), M(e), c?.(e);
64
+ }, G = () => {
516
65
  let e = /* @__PURE__ */ new Date();
517
- A(e), c?.(e);
518
- }, R = (e) => {
519
- p(e), s?.(e);
520
- }, z = () => {
521
- if (f === "month") return b.toLocaleDateString(N, {
66
+ M(e), c?.(e);
67
+ }, K = (e) => {
68
+ O(e), s?.(e);
69
+ }, q = () => {
70
+ if (v === "month") return k.toLocaleDateString(L, {
522
71
  month: "long",
523
72
  year: "numeric"
524
73
  });
525
- if (f === "week") {
526
- let e = me(b), t = new Date(e);
527
- return t.setDate(t.getDate() + 6), `${e.toLocaleDateString(N, {
74
+ if (v === "week") {
75
+ let e = R(k), t = new Date(e);
76
+ return t.setDate(t.getDate() + 6), `${e.toLocaleDateString(L, {
528
77
  month: "short",
529
78
  day: "numeric"
530
- })} - ${t.toLocaleDateString(N, {
79
+ })} - ${t.toLocaleDateString(L, {
531
80
  month: "short",
532
81
  day: "numeric",
533
82
  year: "numeric"
534
83
  })}`;
535
- } else return b.toLocaleDateString(N, {
84
+ } else return k.toLocaleDateString(L, {
536
85
  weekday: "long",
537
86
  month: "long",
538
87
  day: "numeric",
539
88
  year: "numeric"
540
89
  });
541
- }, B = e.useRef(0);
542
- return /* @__PURE__ */ (0, J.jsxs)("div", {
90
+ }, J = e.useRef(0);
91
+ return /* @__PURE__ */ j("div", {
543
92
  role: "region",
544
93
  "aria-label": "Calendar",
545
- className: k("flex flex-col h-full bg-background min-w-0 overflow-hidden", d),
546
- children: [/* @__PURE__ */ (0, J.jsxs)("div", {
94
+ className: D("flex flex-col h-full bg-background min-w-0 overflow-hidden", d),
95
+ children: [/* @__PURE__ */ j("div", {
547
96
  className: "flex flex-wrap items-center justify-between gap-2 p-2 sm:p-4 border-b min-w-0",
548
- children: [/* @__PURE__ */ (0, J.jsxs)("div", {
97
+ children: [/* @__PURE__ */ j("div", {
549
98
  className: "flex items-center gap-4",
550
- children: [/* @__PURE__ */ (0, J.jsxs)("div", {
99
+ children: [/* @__PURE__ */ j("div", {
551
100
  className: "flex items-center bg-muted/50 rounded-lg p-1 gap-1",
552
101
  children: [
553
- /* @__PURE__ */ (0, J.jsx)(v, {
102
+ /* @__PURE__ */ A(g, {
554
103
  variant: "ghost",
555
104
  size: "sm",
556
- onClick: L,
105
+ onClick: G,
557
106
  className: "h-8",
558
107
  "aria-label": "Go to today",
559
- children: j("calendar.today")
108
+ children: N("calendar.today")
560
109
  }),
561
- /* @__PURE__ */ (0, J.jsx)("div", { className: "h-4 w-px bg-border mx-1" }),
562
- /* @__PURE__ */ (0, J.jsx)(v, {
110
+ /* @__PURE__ */ A("div", { className: "h-4 w-px bg-border mx-1" }),
111
+ /* @__PURE__ */ A(g, {
563
112
  variant: "ghost",
564
113
  size: "icon",
565
114
  "aria-label": "Previous period",
566
- onClick: F,
115
+ onClick: B,
567
116
  className: "h-8 w-8",
568
- children: /* @__PURE__ */ (0, J.jsx)(h, { className: "h-4 w-4" })
117
+ children: /* @__PURE__ */ A(p, { className: "h-4 w-4" })
569
118
  }),
570
- /* @__PURE__ */ (0, J.jsx)(v, {
119
+ /* @__PURE__ */ A(g, {
571
120
  variant: "ghost",
572
121
  size: "icon",
573
122
  "aria-label": "Next period",
574
- onClick: I,
123
+ onClick: V,
575
124
  className: "h-8 w-8",
576
- children: /* @__PURE__ */ (0, J.jsx)(g, { className: "h-4 w-4" })
125
+ children: /* @__PURE__ */ A(m, { className: "h-4 w-4" })
577
126
  })
578
127
  ]
579
- }), /* @__PURE__ */ (0, J.jsxs)(x, { children: [/* @__PURE__ */ (0, J.jsx)(C, {
128
+ }), /* @__PURE__ */ j(y, { children: [/* @__PURE__ */ A(x, {
580
129
  asChild: !0,
581
- children: /* @__PURE__ */ (0, J.jsxs)(v, {
130
+ children: /* @__PURE__ */ j(g, {
582
131
  variant: "ghost",
583
- "aria-label": `Current date: ${z()}`,
584
- className: k("text-base sm:text-xl font-semibold h-auto px-2 sm:px-3 py-1 hover:bg-muted/50 transition-colors", "flex items-center gap-2"),
585
- children: [/* @__PURE__ */ (0, J.jsx)(m, { className: "h-5 w-5 text-muted-foreground" }), /* @__PURE__ */ (0, J.jsx)("span", { children: z() })]
132
+ "aria-label": `Current date: ${q()}`,
133
+ className: D("text-base sm:text-xl font-semibold h-auto px-2 sm:px-3 py-1 hover:bg-muted/50 transition-colors", "flex items-center gap-2"),
134
+ children: [/* @__PURE__ */ A(f, { className: "h-5 w-5 text-muted-foreground" }), /* @__PURE__ */ A("span", { children: q() })]
586
135
  })
587
- }), /* @__PURE__ */ (0, J.jsx)(S, {
136
+ }), /* @__PURE__ */ A(b, {
588
137
  className: "w-auto p-0",
589
138
  align: "start",
590
- children: /* @__PURE__ */ (0, J.jsx)(y, {
139
+ children: /* @__PURE__ */ A(_, {
591
140
  mode: "single",
592
- selected: b,
141
+ selected: k,
593
142
  onSelect: (e) => {
594
- e && (A(e), c?.(e));
143
+ e && (M(e), c?.(e));
595
144
  },
596
145
  initialFocus: !0,
597
146
  fromYear: 2e3,
598
147
  toYear: 2050
599
148
  })
600
149
  })] })]
601
- }), /* @__PURE__ */ (0, J.jsxs)("div", {
150
+ }), /* @__PURE__ */ j("div", {
602
151
  className: "flex items-center gap-2",
603
- children: [/* @__PURE__ */ (0, J.jsxs)(w, {
604
- value: f,
605
- onValueChange: R,
606
- children: [/* @__PURE__ */ (0, J.jsx)(D, {
152
+ children: [/* @__PURE__ */ j(S, {
153
+ value: v,
154
+ onValueChange: K,
155
+ children: [/* @__PURE__ */ A(T, {
607
156
  className: "w-32 bg-background",
608
- children: /* @__PURE__ */ (0, J.jsx)(O, {})
609
- }), /* @__PURE__ */ (0, J.jsxs)(T, { children: [
610
- /* @__PURE__ */ (0, J.jsx)(E, {
157
+ children: /* @__PURE__ */ A(E, {})
158
+ }), /* @__PURE__ */ j(C, { children: [
159
+ /* @__PURE__ */ A(w, {
611
160
  value: "day",
612
- children: j("calendar.day")
161
+ children: N("calendar.day")
613
162
  }),
614
- /* @__PURE__ */ (0, J.jsx)(E, {
163
+ /* @__PURE__ */ A(w, {
615
164
  value: "week",
616
- children: j("calendar.week")
165
+ children: N("calendar.week")
617
166
  }),
618
- /* @__PURE__ */ (0, J.jsx)(E, {
167
+ /* @__PURE__ */ A(w, {
619
168
  value: "month",
620
- children: j("calendar.month")
169
+ children: N("calendar.month")
621
170
  })
622
171
  ] })]
623
- }), l && /* @__PURE__ */ (0, J.jsxs)(v, {
172
+ }), l && /* @__PURE__ */ j(g, {
624
173
  onClick: l,
625
174
  size: "sm",
626
175
  className: "gap-1",
627
- children: [/* @__PURE__ */ (0, J.jsx)(_, { className: "h-4 w-4" }), j("calendar.newEvent")]
176
+ children: [/* @__PURE__ */ A(h, { className: "h-4 w-4" }), N("calendar.newEvent")]
628
177
  })]
629
178
  })]
630
- }), /* @__PURE__ */ (0, J.jsxs)("div", {
179
+ }), /* @__PURE__ */ j("div", {
631
180
  className: "flex-1 overflow-auto",
632
181
  onTouchStart: (e) => {
633
- B.current = e.touches[0].clientX;
182
+ J.current = e.touches[0].clientX;
634
183
  },
635
184
  onTouchEnd: (e) => {
636
- let t = B.current - e.changedTouches[0].clientX;
185
+ let t = J.current - e.changedTouches[0].clientX;
637
186
  if (Math.abs(t) > 50) {
638
- let e = new Date(b);
639
- f === "day" ? e.setDate(e.getDate() + (t > 0 ? 1 : -1)) : f === "week" ? e.setDate(e.getDate() + (t > 0 ? 7 : -7)) : e.setMonth(e.getMonth() + (t > 0 ? 1 : -1)), A(e), c?.(e);
187
+ let e = new Date(k);
188
+ v === "day" ? e.setDate(e.getDate() + (t > 0 ? 1 : -1)) : v === "week" ? e.setDate(e.getDate() + (t > 0 ? 7 : -7)) : e.setMonth(e.getMonth() + (t > 0 ? 1 : -1)), M(e), c?.(e);
640
189
  }
641
190
  },
642
191
  children: [
643
- f === "month" && /* @__PURE__ */ (0, J.jsx)(ve, {
644
- date: b,
192
+ v === "month" && /* @__PURE__ */ A(H, {
193
+ date: k,
645
194
  events: t,
646
- locale: N,
195
+ locale: L,
647
196
  onEventClick: a,
648
197
  onDateClick: o,
649
198
  onEventDrop: u
650
199
  }),
651
- f === "week" && /* @__PURE__ */ (0, J.jsx)(ye, {
652
- date: b,
200
+ v === "week" && /* @__PURE__ */ A(U, {
201
+ date: k,
653
202
  events: t,
654
- locale: N,
203
+ locale: L,
655
204
  onEventClick: a,
656
205
  onDateClick: o
657
206
  }),
658
- f === "day" && /* @__PURE__ */ (0, J.jsx)(be, {
659
- date: b,
207
+ v === "day" && /* @__PURE__ */ A(W, {
208
+ date: k,
660
209
  events: t,
661
210
  onEventClick: a,
662
211
  onDateClick: o
@@ -665,11 +214,11 @@ function Q({ events: t = [], view: n = "month", currentDate: r = pe, locale: i =
665
214
  })]
666
215
  });
667
216
  }
668
- function me(e) {
217
+ function R(e) {
669
218
  let t = new Date(e), n = t.getDay(), r = t.getDate() - n;
670
219
  return t.setDate(r), t;
671
220
  }
672
- function he(e) {
221
+ function z(e) {
673
222
  let t = e.getFullYear(), n = e.getMonth(), r = new Date(t, n, 1), i = new Date(t, n + 1, 0), a = r.getDay(), o = [];
674
223
  for (let e = a - 1; e >= 0; e--) {
675
224
  let t = new Date(r.getTime());
@@ -683,10 +232,10 @@ function he(e) {
683
232
  }
684
233
  return o;
685
234
  }
686
- function ge(e, t) {
235
+ function B(e, t) {
687
236
  return e.getFullYear() === t.getFullYear() && e.getMonth() === t.getMonth() && e.getDate() === t.getDate();
688
237
  }
689
- function _e(e, t) {
238
+ function V(e, t) {
690
239
  return t.filter((t) => {
691
240
  let n = new Date(t.start), r = t.end ? new Date(t.end) : new Date(n), i = new Date(e);
692
241
  i.setHours(0, 0, 0, 0);
@@ -698,8 +247,8 @@ function _e(e, t) {
698
247
  return s.setHours(23, 59, 59, 999), i <= s && a >= o;
699
248
  });
700
249
  }
701
- function ve({ date: t, events: n, locale: r = "default", onEventClick: i, onDateClick: a, onEventDrop: o }) {
702
- let s = e.useMemo(() => he(t), [t.getFullYear(), t.getMonth()]), c = e.useMemo(() => /* @__PURE__ */ new Date(), []), { t: l } = Z(), u = e.useMemo(() => {
250
+ function H({ date: t, events: n, locale: r = "default", onEventClick: i, onDateClick: a, onEventDrop: o }) {
251
+ let s = e.useMemo(() => z(t), [t.getFullYear(), t.getMonth()]), c = e.useMemo(() => /* @__PURE__ */ new Date(), []), { t: l } = I(), u = e.useMemo(() => {
703
252
  let e = new Date(2024, 0, 7);
704
253
  return Array.from({ length: 7 }, (t, n) => {
705
254
  let i = new Date(e);
@@ -738,23 +287,23 @@ function ve({ date: t, events: n, locale: r = "default", onEventClick: i, onDate
738
287
  let u = new Date(a.getTime() + l), d;
739
288
  i.end && (d = new Date(new Date(i.end).getTime() + l)), o(i, u, d);
740
289
  };
741
- return /* @__PURE__ */ (0, J.jsxs)("div", {
290
+ return /* @__PURE__ */ j("div", {
742
291
  className: "flex flex-col h-full",
743
- children: [/* @__PURE__ */ (0, J.jsx)("div", {
292
+ children: [/* @__PURE__ */ A("div", {
744
293
  role: "row",
745
294
  className: "grid grid-cols-7 border-b",
746
- children: u.map((e) => /* @__PURE__ */ (0, J.jsx)("div", {
295
+ children: u.map((e) => /* @__PURE__ */ A("div", {
747
296
  role: "columnheader",
748
297
  className: "p-2 text-center text-sm font-medium text-muted-foreground border-r last:border-r-0",
749
298
  children: e
750
299
  }, e))
751
- }), /* @__PURE__ */ (0, J.jsx)("div", {
300
+ }), /* @__PURE__ */ A("div", {
752
301
  role: "grid",
753
302
  "aria-label": "Calendar grid",
754
303
  className: "grid grid-cols-7 flex-1 auto-rows-fr",
755
304
  children: s.map((e, n) => {
756
- let r = `${e.getFullYear()}-${e.getMonth()}-${e.getDate()}`, s = h.get(r) || [], u = e.getMonth() === t.getMonth(), f = ge(e, c);
757
- return /* @__PURE__ */ (0, J.jsxs)("div", {
305
+ let r = `${e.getFullYear()}-${e.getMonth()}-${e.getDate()}`, s = h.get(r) || [], u = e.getMonth() === t.getMonth(), f = B(e, c);
306
+ return /* @__PURE__ */ j("div", {
758
307
  role: "gridcell",
759
308
  "aria-label": `${e.toLocaleDateString("default", {
760
309
  weekday: "long",
@@ -762,31 +311,31 @@ function ve({ date: t, events: n, locale: r = "default", onEventClick: i, onDate
762
311
  day: "numeric",
763
312
  year: "numeric"
764
313
  })}${s.length > 0 ? `, ${s.length} event${s.length > 1 ? "s" : ""}` : ""}`,
765
- className: k("border-b border-r last:border-r-0 p-2 min-h-[100px] cursor-pointer hover:bg-accent/50", !u && "bg-muted/50 text-muted-foreground opacity-50", p === n && "ring-2 ring-primary"),
314
+ className: D("border-b border-r last:border-r-0 p-2 min-h-[100px] cursor-pointer hover:bg-accent/50", !u && "bg-muted/50 text-muted-foreground opacity-50", p === n && "ring-2 ring-primary"),
766
315
  onClick: () => a?.(e),
767
316
  onDragOver: (e) => v(e, n),
768
317
  onDragLeave: y,
769
318
  onDrop: (t) => b(t, e),
770
- children: [/* @__PURE__ */ (0, J.jsx)("div", {
771
- className: k("text-sm font-medium mb-2", f && "inline-flex items-center justify-center rounded-full bg-primary text-primary-foreground h-6 w-6"),
319
+ children: [/* @__PURE__ */ A("div", {
320
+ className: D("text-sm font-medium mb-2", f && "inline-flex items-center justify-center rounded-full bg-primary text-primary-foreground h-6 w-6"),
772
321
  ...f ? { "aria-current": "date" } : {},
773
322
  children: e.getDate()
774
- }), /* @__PURE__ */ (0, J.jsxs)("div", {
323
+ }), /* @__PURE__ */ j("div", {
775
324
  className: "space-y-1",
776
- children: [s.slice(0, 3).map((e) => /* @__PURE__ */ (0, J.jsx)("div", {
325
+ children: [s.slice(0, 3).map((e) => /* @__PURE__ */ A("div", {
777
326
  role: "button",
778
327
  title: e.title,
779
328
  "aria-label": e.title,
780
329
  draggable: !!o,
781
330
  onDragStart: (t) => g(t, e),
782
331
  onDragEnd: _,
783
- className: k("text-xs px-2 py-1 rounded truncate cursor-pointer hover:opacity-80", e.color?.startsWith("#") ? "text-white" : e.color || Y, d === e.id && "opacity-50"),
332
+ className: D("text-xs px-2 py-1 rounded truncate cursor-pointer hover:opacity-80", e.color?.startsWith("#") ? "text-white" : e.color || N, d === e.id && "opacity-50"),
784
333
  style: e.color && e.color.startsWith("#") ? { backgroundColor: e.color } : void 0,
785
334
  onClick: (t) => {
786
335
  t.stopPropagation(), i?.(e);
787
336
  },
788
337
  children: e.title
789
- }, e.id)), s.length > 3 && /* @__PURE__ */ (0, J.jsx)("div", {
338
+ }, e.id)), s.length > 3 && /* @__PURE__ */ A("div", {
790
339
  className: "text-xs text-muted-foreground px-2",
791
340
  children: l("calendar.moreEvents", { count: s.length - 3 })
792
341
  })]
@@ -796,40 +345,40 @@ function ve({ date: t, events: n, locale: r = "default", onEventClick: i, onDate
796
345
  })]
797
346
  });
798
347
  }
799
- function ye({ date: t, events: n, locale: r = "default", onEventClick: i, onDateClick: a }) {
348
+ function U({ date: t, events: n, locale: r = "default", onEventClick: i, onDateClick: a }) {
800
349
  let o = e.useRef(null), s = (e) => {
801
350
  a && (o.current = setTimeout(() => {
802
351
  a(e);
803
352
  }, 500));
804
353
  }, c = () => {
805
354
  o.current &&= (clearTimeout(o.current), null);
806
- }, l = me(t), u = Array.from({ length: 7 }, (e, t) => {
355
+ }, l = R(t), u = Array.from({ length: 7 }, (e, t) => {
807
356
  let n = new Date(l);
808
357
  return n.setDate(n.getDate() + t), n;
809
358
  }), d = /* @__PURE__ */ new Date();
810
- return /* @__PURE__ */ (0, J.jsxs)("div", {
359
+ return /* @__PURE__ */ j("div", {
811
360
  className: "flex flex-col h-full",
812
- children: [/* @__PURE__ */ (0, J.jsx)("div", {
361
+ children: [/* @__PURE__ */ A("div", {
813
362
  className: "grid grid-cols-7 border-b",
814
363
  children: u.map((e) => {
815
- let t = ge(e, d);
816
- return /* @__PURE__ */ (0, J.jsxs)("div", {
364
+ let t = B(e, d);
365
+ return /* @__PURE__ */ j("div", {
817
366
  className: "p-3 text-center border-r last:border-r-0",
818
- children: [/* @__PURE__ */ (0, J.jsx)("div", {
367
+ children: [/* @__PURE__ */ A("div", {
819
368
  className: "text-sm font-medium text-muted-foreground",
820
369
  children: e.toLocaleDateString(r, { weekday: "short" })
821
- }), /* @__PURE__ */ (0, J.jsx)("div", {
822
- className: k("text-lg font-semibold mt-1", t && "inline-flex items-center justify-center rounded-full bg-primary text-primary-foreground h-8 w-8"),
370
+ }), /* @__PURE__ */ A("div", {
371
+ className: D("text-lg font-semibold mt-1", t && "inline-flex items-center justify-center rounded-full bg-primary text-primary-foreground h-8 w-8"),
823
372
  children: e.getDate()
824
373
  })]
825
374
  }, e.toISOString());
826
375
  })
827
- }), /* @__PURE__ */ (0, J.jsx)("div", {
376
+ }), /* @__PURE__ */ A("div", {
828
377
  role: "grid",
829
378
  className: "grid grid-cols-7 flex-1",
830
379
  children: u.map((e) => {
831
- let t = _e(e, n);
832
- return /* @__PURE__ */ (0, J.jsx)("div", {
380
+ let t = V(e, n);
381
+ return /* @__PURE__ */ A("div", {
833
382
  role: "gridcell",
834
383
  "aria-label": `${e.toLocaleDateString("default", {
835
384
  weekday: "long",
@@ -841,21 +390,21 @@ function ye({ date: t, events: n, locale: r = "default", onEventClick: i, onDate
841
390
  onClick: () => a?.(e),
842
391
  onTouchStart: () => s(e),
843
392
  onTouchEnd: c,
844
- children: /* @__PURE__ */ (0, J.jsx)("div", {
393
+ children: /* @__PURE__ */ A("div", {
845
394
  className: "space-y-2",
846
- children: t.map((e) => /* @__PURE__ */ (0, J.jsxs)("div", {
395
+ children: t.map((e) => /* @__PURE__ */ j("div", {
847
396
  role: "button",
848
397
  title: e.title,
849
398
  "aria-label": e.title,
850
- className: k("text-xs sm:text-sm px-2 sm:px-3 py-1.5 sm:py-2 rounded cursor-pointer hover:opacity-80", e.color?.startsWith("#") ? "text-white" : e.color || Y),
399
+ className: D("text-xs sm:text-sm px-2 sm:px-3 py-1.5 sm:py-2 rounded cursor-pointer hover:opacity-80", e.color?.startsWith("#") ? "text-white" : e.color || N),
851
400
  style: e.color && e.color.startsWith("#") ? { backgroundColor: e.color } : void 0,
852
401
  onClick: (t) => {
853
402
  t.stopPropagation(), i?.(e);
854
403
  },
855
- children: [/* @__PURE__ */ (0, J.jsx)("div", {
404
+ children: [/* @__PURE__ */ A("div", {
856
405
  className: "font-medium truncate",
857
406
  children: e.title
858
- }), !e.allDay && /* @__PURE__ */ (0, J.jsx)("div", {
407
+ }), !e.allDay && /* @__PURE__ */ A("div", {
859
408
  className: "text-xs opacity-90 mt-1",
860
409
  children: e.start.toLocaleTimeString("default", {
861
410
  hour: "numeric",
@@ -869,8 +418,8 @@ function ye({ date: t, events: n, locale: r = "default", onEventClick: i, onDate
869
418
  })]
870
419
  });
871
420
  }
872
- function be({ date: t, events: n, onEventClick: r, onDateClick: i }) {
873
- let a = _e(t, n), o = Array.from({ length: 24 }, (e, t) => t), s = e.useRef(null), c = (e) => {
421
+ function W({ date: t, events: n, onEventClick: r, onDateClick: i }) {
422
+ let a = V(t, n), o = Array.from({ length: 24 }, (e, t) => t), s = e.useRef(null), c = (e) => {
874
423
  i && (s.current = setTimeout(() => {
875
424
  let n = new Date(t);
876
425
  n.setHours(e, 0, 0, 0), i(n);
@@ -878,33 +427,33 @@ function be({ date: t, events: n, onEventClick: r, onDateClick: i }) {
878
427
  }, l = () => {
879
428
  s.current &&= (clearTimeout(s.current), null);
880
429
  };
881
- return /* @__PURE__ */ (0, J.jsx)("div", {
430
+ return /* @__PURE__ */ A("div", {
882
431
  className: "flex flex-col h-full",
883
- children: /* @__PURE__ */ (0, J.jsx)("div", {
432
+ children: /* @__PURE__ */ A("div", {
884
433
  role: "list",
885
434
  className: "flex-1 overflow-auto",
886
435
  children: o.map((e) => {
887
436
  let t = a.filter((t) => t.allDay ? e === 0 : t.start.getHours() === e);
888
- return /* @__PURE__ */ (0, J.jsxs)("div", {
437
+ return /* @__PURE__ */ j("div", {
889
438
  role: "listitem",
890
439
  className: "flex border-b min-h-[60px]",
891
- children: [/* @__PURE__ */ (0, J.jsx)("div", {
440
+ children: [/* @__PURE__ */ A("div", {
892
441
  className: "w-20 p-2 text-sm text-muted-foreground border-r",
893
442
  children: e === 0 ? "12 AM" : e < 12 ? `${e} AM` : e === 12 ? "12 PM" : `${e - 12} PM`
894
- }), /* @__PURE__ */ (0, J.jsx)("div", {
443
+ }), /* @__PURE__ */ A("div", {
895
444
  className: "flex-1 p-2 space-y-2",
896
445
  onTouchStart: () => c(e),
897
446
  onTouchEnd: l,
898
- children: t.map((e) => /* @__PURE__ */ (0, J.jsxs)("div", {
447
+ children: t.map((e) => /* @__PURE__ */ j("div", {
899
448
  title: e.title,
900
449
  "aria-label": e.title,
901
- className: k("px-2 sm:px-3 py-1.5 sm:py-2 rounded cursor-pointer hover:opacity-80", e.color?.startsWith("#") ? "text-white" : e.color || Y),
450
+ className: D("px-2 sm:px-3 py-1.5 sm:py-2 rounded cursor-pointer hover:opacity-80", e.color?.startsWith("#") ? "text-white" : e.color || N),
902
451
  style: e.color && e.color.startsWith("#") ? { backgroundColor: e.color } : void 0,
903
452
  onClick: () => r?.(e),
904
- children: [/* @__PURE__ */ (0, J.jsx)("div", {
453
+ children: [/* @__PURE__ */ A("div", {
905
454
  className: "font-medium truncate",
906
455
  children: e.title
907
- }), !e.allDay && /* @__PURE__ */ (0, J.jsxs)("div", {
456
+ }), !e.allDay && /* @__PURE__ */ j("div", {
908
457
  className: "text-xs opacity-90 mt-1",
909
458
  children: [e.start.toLocaleTimeString("default", {
910
459
  hour: "numeric",
@@ -922,61 +471,8 @@ function be({ date: t, events: n, onEventClick: r, onDateClick: i }) {
922
471
  });
923
472
  }
924
473
  //#endregion
925
- //#region ../mobile/dist/usePullToRefresh.js
926
- function xe(e) {
927
- let { onRefresh: t, threshold: n = 80, enabled: i = !0 } = e, o = s(null), [l, u] = c(!1), [d, f] = c(0), p = s(0), m = r((e) => {
928
- if (!i || l) return;
929
- let t = o.current;
930
- t && t.scrollTop === 0 && (p.current = e.touches[0].clientY);
931
- }, [i, l]), h = r((e) => {
932
- if (!i || l || !p.current) return;
933
- let t = e.touches[0].clientY - p.current;
934
- t > 0 && f(Math.min(t, n * 1.5));
935
- }, [
936
- i,
937
- l,
938
- n
939
- ]), g = r(async () => {
940
- if (!i || l) return;
941
- let e = d;
942
- if (f(0), p.current = 0, e >= n) {
943
- u(!0);
944
- try {
945
- await t();
946
- } finally {
947
- u(!1);
948
- }
949
- }
950
- }, [
951
- i,
952
- l,
953
- d,
954
- n,
955
- t
956
- ]);
957
- return a(() => {
958
- let e = o.current;
959
- if (!(!e || !i)) return e.addEventListener("touchstart", m, { passive: !0 }), e.addEventListener("touchmove", h, { passive: !0 }), e.addEventListener("touchend", g, { passive: !0 }), () => {
960
- e.removeEventListener("touchstart", m), e.removeEventListener("touchmove", h), e.removeEventListener("touchend", g);
961
- };
962
- }, [
963
- m,
964
- h,
965
- g,
966
- i
967
- ]), {
968
- ref: o,
969
- isRefreshing: l,
970
- pullDistance: d
971
- };
972
- }
973
- //#endregion
974
- //#region ../mobile/dist/MobileProvider.js
975
- var Se = n(null);
976
- Se.displayName = "MobileContext";
977
- //#endregion
978
474
  //#region src/ObjectCalendar.tsx
979
- function Ce(e) {
475
+ function G(e) {
980
476
  return "data" in e && e.data ? e.data : "staticData" in e && e.staticData ? {
981
477
  provider: "value",
982
478
  items: e.staticData
@@ -985,7 +481,7 @@ function Ce(e) {
985
481
  object: e.objectName
986
482
  } : null;
987
483
  }
988
- function we(e) {
484
+ function K(e) {
989
485
  if (e) {
990
486
  if (typeof e == "string") {
991
487
  let t = e.split(" "), n = t[0], r = t[1]?.toLowerCase() === "desc" ? "desc" : "asc";
@@ -994,7 +490,7 @@ function we(e) {
994
490
  if (Array.isArray(e)) return e.reduce((e, t) => (t.field && t.order && (e[t.field] = t.order), e), {});
995
491
  }
996
492
  }
997
- function Te(e) {
493
+ function q(e) {
998
494
  return "filter" in e && e.filter && typeof e.filter == "object" && "calendar" in e.filter ? e.filter.calendar : e.calendar ? e.calendar : e.startDateField || e.dateField ? {
999
495
  startDateField: e.startDateField || e.dateField,
1000
496
  endDateField: e.endDateField || e.endField,
@@ -1003,64 +499,64 @@ function Te(e) {
1003
499
  allDayField: e.allDayField
1004
500
  } : null;
1005
501
  }
1006
- var Ee = ({ schema: e, dataSource: t, className: n, data: i, loading: l, onEventClick: p, onRowClick: m, onDateClick: h, onNavigate: g, onViewChange: _, onEventDrop: v, locale: y }) => {
1007
- let x = Array.isArray(i), [S, C] = c(x ? i : []), [w, T] = c(x ? l ?? !1 : !0), [E, D] = c(null), [O, k] = c(null), [j, M] = c(/* @__PURE__ */ new Date()), N = A(), P = e.defaultView, [F, I] = c(() => {
1008
- let e = P === "day" || !P;
1009
- return typeof window < "u" && window.innerWidth < 768 && e ? "month" : P || "month";
502
+ var J = ({ schema: e, dataSource: t, className: s, data: d, loading: f, onEventClick: p, onRowClick: m, onDateClick: h, onNavigate: g, onViewChange: _, onEventDrop: y, locale: b }) => {
503
+ let x = Array.isArray(d), [S, C] = o(x ? d : []), [w, T] = o(x ? f ?? !1 : !0), [E, D] = o(null), [k, N] = o(null), [P, F] = o(/* @__PURE__ */ new Date()), I = O(), R = e.defaultView, [z, B] = o(() => {
504
+ let e = R === "day" || !R;
505
+ return typeof window < "u" && window.innerWidth < 768 && e ? "month" : R || "month";
1010
506
  });
1011
- a(() => {
1012
- N && F === "day" && (P === "day" || !P) && I("month");
1013
- }, [N]);
1014
- let [L, R] = c(0);
1015
- a(() => {
507
+ r(() => {
508
+ I && z === "day" && (R === "day" || !R) && B("month");
509
+ }, [I]);
510
+ let [V, H] = o(0);
511
+ r(() => {
1016
512
  if (!x && !(!t?.onMutation || !e.objectName)) return t.onMutation((t) => {
1017
- t.resource === e.objectName && R((e) => e + 1);
513
+ t.resource === e.objectName && H((e) => e + 1);
1018
514
  });
1019
515
  }, [
1020
516
  t,
1021
517
  e.objectName,
1022
518
  x
1023
519
  ]);
1024
- let { ref: z, isRefreshing: B, pullDistance: V } = xe({
1025
- onRefresh: r(async () => {
1026
- R((e) => e + 1);
520
+ let { ref: U, isRefreshing: W, pullDistance: J } = M({
521
+ onRefresh: n(async () => {
522
+ H((e) => e + 1);
1027
523
  }, []),
1028
524
  enabled: !!t && !!e.objectName
1029
- }), H = o(() => Ce(e), [
525
+ }), Y = i(() => G(e), [
1030
526
  e.data,
1031
527
  e.staticData,
1032
528
  e.objectName
1033
- ]), U = o(() => Te(e), [
529
+ ]), X = i(() => q(e), [
1034
530
  e.filter,
1035
531
  e.calendar,
1036
532
  e.dateField,
1037
533
  e.endField,
1038
534
  e.titleField,
1039
535
  e.colorField
1040
- ]), W = H?.provider === "value", G = s(null);
1041
- G.current = O, a(() => {
1042
- x && C(i);
1043
- }, [i, x]), a(() => {
1044
- x && l !== void 0 && T(l);
1045
- }, [l, x]), a(() => {
536
+ ]), Z = Y?.provider === "value", Q = a(null);
537
+ Q.current = k, r(() => {
538
+ x && C(d);
539
+ }, [d, x]), r(() => {
540
+ x && f !== void 0 && T(f);
541
+ }, [f, x]), r(() => {
1046
542
  if (x) return;
1047
543
  let n = !0;
1048
544
  return (async () => {
1049
545
  try {
1050
546
  if (!n) return;
1051
- if (T(!0), W && H?.provider === "value") {
1052
- n && (C(H.items), T(!1));
547
+ if (T(!0), Z && Y?.provider === "value") {
548
+ n && (C(Y.items), T(!1));
1053
549
  return;
1054
550
  }
1055
551
  if (!t || typeof t.find != "function") throw Error("DataSource required for object/api providers");
1056
- if (H?.provider === "object") {
1057
- let r = H.object, i = u(G.current?.fields), a = d(await t.find(r, {
552
+ if (Y?.provider === "object") {
553
+ let r = Y.object, i = c(Q.current?.fields), a = l(await t.find(r, {
1058
554
  $filter: e.filter,
1059
- $orderby: we(e.sort),
555
+ $orderby: K(e.sort),
1060
556
  ...i.length > 0 ? { $expand: i } : {}
1061
557
  }));
1062
558
  n && C(a);
1063
- } else H?.provider === "api" && (console.warn("API provider not yet implemented for ObjectCalendar"), n && C([]));
559
+ } else Y?.provider === "api" && (console.warn("API provider not yet implemented for ObjectCalendar"), n && C([]));
1064
560
  n && T(!1);
1065
561
  } catch (e) {
1066
562
  console.error("[ObjectCalendar] Error fetching data:", e), n && (D(e), T(!1));
@@ -1070,19 +566,19 @@ var Ee = ({ schema: e, dataSource: t, className: n, data: i, loading: l, onEvent
1070
566
  };
1071
567
  }, [
1072
568
  x,
1073
- H,
569
+ Y,
1074
570
  t,
1075
- W,
571
+ Z,
1076
572
  e.filter,
1077
573
  e.sort,
1078
- L
1079
- ]), a(() => {
1080
- !W && t && (async () => {
574
+ V
575
+ ]), r(() => {
576
+ !Z && t && (async () => {
1081
577
  try {
1082
578
  if (!t) return;
1083
- let n = H?.provider === "object" ? H.object : e.objectName;
579
+ let n = Y?.provider === "object" ? Y.object : e.objectName;
1084
580
  if (!n) return;
1085
- k(await t.getObjectSchema(n));
581
+ N(await t.getObjectSchema(n));
1086
582
  } catch (e) {
1087
583
  console.error("Failed to fetch object schema:", e);
1088
584
  }
@@ -1090,12 +586,12 @@ var Ee = ({ schema: e, dataSource: t, className: n, data: i, loading: l, onEvent
1090
586
  }, [
1091
587
  e.objectName,
1092
588
  t,
1093
- W,
1094
- H
589
+ Z,
590
+ Y
1095
591
  ]);
1096
- let K = o(() => {
1097
- if (!U || !S.length) return [];
1098
- let { startDateField: e, endDateField: t, titleField: n, colorField: r } = U, i = O?.titleFormat, a = O?.NAME_FIELD_KEY, o = [
592
+ let ee = i(() => {
593
+ if (!X || !S.length) return [];
594
+ let { startDateField: e, endDateField: t, titleField: n, colorField: r } = X, i = k?.titleFormat, a = k?.NAME_FIELD_KEY, o = [
1099
595
  "name",
1100
596
  "full_name",
1101
597
  "fullName",
@@ -1143,78 +639,78 @@ var Ee = ({ schema: e, dataSource: t, className: n, data: i, loading: l, onEvent
1143
639
  }).filter((e) => !isNaN(e.start.getTime()));
1144
640
  }, [
1145
641
  S,
1146
- U,
1147
- O
642
+ X,
643
+ k
1148
644
  ]);
1149
- r(() => {
645
+ n(() => {
1150
646
  h?.(/* @__PURE__ */ new Date());
1151
647
  }, [h]);
1152
- let q = f({
648
+ let $ = u({
1153
649
  navigation: e.navigation,
1154
650
  objectName: e.objectName,
1155
651
  onRowClick: m
1156
652
  });
1157
- return w ? /* @__PURE__ */ (0, J.jsx)("div", {
1158
- className: n,
1159
- children: /* @__PURE__ */ (0, J.jsx)("div", {
653
+ return w ? /* @__PURE__ */ A("div", {
654
+ className: s,
655
+ children: /* @__PURE__ */ A("div", {
1160
656
  className: "flex items-center justify-center h-96",
1161
- children: /* @__PURE__ */ (0, J.jsx)("div", {
657
+ children: /* @__PURE__ */ A("div", {
1162
658
  className: "text-muted-foreground",
1163
659
  children: "Loading calendar..."
1164
660
  })
1165
661
  })
1166
- }) : E ? /* @__PURE__ */ (0, J.jsx)("div", {
1167
- className: n,
1168
- children: /* @__PURE__ */ (0, J.jsx)("div", {
662
+ }) : E ? /* @__PURE__ */ A("div", {
663
+ className: s,
664
+ children: /* @__PURE__ */ A("div", {
1169
665
  className: "flex items-center justify-center h-96",
1170
- children: /* @__PURE__ */ (0, J.jsxs)("div", {
666
+ children: /* @__PURE__ */ j("div", {
1171
667
  className: "text-destructive",
1172
668
  children: ["Error: ", E.message]
1173
669
  })
1174
670
  })
1175
- }) : U ? /* @__PURE__ */ (0, J.jsxs)("div", {
1176
- ref: z,
1177
- className: n,
671
+ }) : X ? /* @__PURE__ */ j("div", {
672
+ ref: U,
673
+ className: s,
1178
674
  children: [
1179
- V > 0 && /* @__PURE__ */ (0, J.jsx)("div", {
675
+ J > 0 && /* @__PURE__ */ A("div", {
1180
676
  className: "flex items-center justify-center text-xs text-muted-foreground",
1181
- style: { height: V },
1182
- children: B ? "Refreshing…" : "Pull to refresh"
677
+ style: { height: J },
678
+ children: W ? "Refreshing…" : "Pull to refresh"
1183
679
  }),
1184
- /* @__PURE__ */ (0, J.jsx)("div", {
680
+ /* @__PURE__ */ A("div", {
1185
681
  className: "border rounded-lg bg-background h-[calc(100vh-120px)] sm:h-[calc(100vh-160px)] md:h-[calc(100vh-200px)] min-h-[400px] sm:min-h-[600px]",
1186
- children: /* @__PURE__ */ (0, J.jsx)(Q, {
1187
- events: K,
1188
- currentDate: j,
1189
- view: F,
1190
- locale: y,
682
+ children: /* @__PURE__ */ A(L, {
683
+ events: ee,
684
+ currentDate: P,
685
+ view: z,
686
+ locale: b,
1191
687
  onEventClick: (e) => {
1192
- q.handleClick(e.data), p?.(e.data);
688
+ $.handleClick(e.data), p?.(e.data);
1193
689
  },
1194
690
  onDateClick: h,
1195
691
  onNavigate: (e) => {
1196
- M(e), g?.(e);
692
+ F(e), g?.(e);
1197
693
  },
1198
694
  onViewChange: (e) => {
1199
- I(e), _?.(e);
695
+ B(e), _?.(e);
1200
696
  },
1201
697
  onAddClick: void 0,
1202
- onEventDrop: v ? (e, t, n) => {
1203
- v(e.data, t, n);
698
+ onEventDrop: y ? (e, t, n) => {
699
+ y(e.data, t, n);
1204
700
  } : void 0
1205
701
  })
1206
702
  }),
1207
- q.isOverlay && /* @__PURE__ */ (0, J.jsx)(b, {
1208
- ...q,
703
+ $.isOverlay && /* @__PURE__ */ A(v, {
704
+ ...$,
1209
705
  title: "Event Details",
1210
- children: (e) => /* @__PURE__ */ (0, J.jsx)("div", {
706
+ children: (e) => /* @__PURE__ */ A("div", {
1211
707
  className: "space-y-3",
1212
- children: Object.entries(e).map(([e, t]) => /* @__PURE__ */ (0, J.jsxs)("div", {
708
+ children: Object.entries(e).map(([e, t]) => /* @__PURE__ */ j("div", {
1213
709
  className: "flex flex-col",
1214
- children: [/* @__PURE__ */ (0, J.jsx)("span", {
710
+ children: [/* @__PURE__ */ A("span", {
1215
711
  className: "text-xs font-medium text-muted-foreground uppercase tracking-wide",
1216
712
  children: e.replace(/_/g, " ")
1217
- }), /* @__PURE__ */ (0, J.jsx)("span", {
713
+ }), /* @__PURE__ */ A("span", {
1218
714
  className: "text-sm",
1219
715
  children: String(t ?? "—")
1220
716
  })]
@@ -1222,11 +718,11 @@ var Ee = ({ schema: e, dataSource: t, className: n, data: i, loading: l, onEvent
1222
718
  })
1223
719
  })
1224
720
  ]
1225
- }) : /* @__PURE__ */ (0, J.jsx)("div", {
1226
- className: n,
1227
- children: /* @__PURE__ */ (0, J.jsx)("div", {
721
+ }) : /* @__PURE__ */ A("div", {
722
+ className: s,
723
+ children: /* @__PURE__ */ A("div", {
1228
724
  className: "flex items-center justify-center h-96",
1229
- children: /* @__PURE__ */ (0, J.jsx)("div", {
725
+ children: /* @__PURE__ */ A("div", {
1230
726
  className: "text-muted-foreground",
1231
727
  children: "Calendar configuration required. Please specify startDateField and titleField."
1232
728
  })
@@ -1235,8 +731,9 @@ var Ee = ({ schema: e, dataSource: t, className: n, data: i, loading: l, onEvent
1235
731
  };
1236
732
  //#endregion
1237
733
  //#region src/calendar-view-renderer.tsx
1238
- l.register("calendar-view", ({ schema: e, className: n, onAction: r, ...i }) => {
1239
- let a = t.useMemo(() => !e.data || !Array.isArray(e.data) ? [] : e.data.map((t, n) => {
734
+ s.register("calendar-view", ({ schema: e, className: n, onAction: r, ...i }) => /* @__PURE__ */ A(L, {
735
+ className: n,
736
+ events: t.useMemo(() => !e.data || !Array.isArray(e.data) ? [] : e.data.map((t, n) => {
1240
737
  let r = e.titleField || "title", i = e.startDateField || "start", a = e.endDateField || "end", o = e.colorField || "color", s = e.allDayField || "allDay";
1241
738
  return {
1242
739
  id: t.id || t._id || n,
@@ -1254,19 +751,15 @@ l.register("calendar-view", ({ schema: e, className: n, onAction: r, ...i }) =>
1254
751
  e.endDateField,
1255
752
  e.colorField,
1256
753
  e.allDayField
1257
- ]);
1258
- return /* @__PURE__ */ (0, J.jsx)(Q, {
1259
- className: n,
1260
- events: a,
1261
- onEventClick: (e) => {
1262
- r?.({
1263
- type: "event-click",
1264
- payload: e
1265
- });
1266
- },
1267
- ...i
1268
- });
1269
- }, {
754
+ ]),
755
+ onEventClick: (e) => {
756
+ r?.({
757
+ type: "event-click",
758
+ payload: e
759
+ });
760
+ },
761
+ ...i
762
+ }), {
1270
763
  namespace: "plugin-calendar",
1271
764
  label: "Calendar View",
1272
765
  inputs: [
@@ -1386,15 +879,15 @@ l.register("calendar-view", ({ schema: e, className: n, onAction: r, ...i }) =>
1386
879
  });
1387
880
  //#endregion
1388
881
  //#region src/index.tsx
1389
- var $ = ({ schema: e, ...t }) => {
1390
- let { dataSource: n } = p() || {};
1391
- return /* @__PURE__ */ (0, J.jsx)(Ee, {
882
+ var Y = ({ schema: e, ...t }) => {
883
+ let { dataSource: n } = d() || {};
884
+ return /* @__PURE__ */ A(J, {
1392
885
  schema: e,
1393
886
  dataSource: n,
1394
887
  ...t
1395
888
  });
1396
889
  };
1397
- l.register("object-calendar", $, {
890
+ s.register("object-calendar", Y, {
1398
891
  namespace: "plugin-calendar",
1399
892
  label: "Object Calendar",
1400
893
  category: "view",
@@ -1409,7 +902,7 @@ l.register("object-calendar", $, {
1409
902
  label: "Calendar Config",
1410
903
  description: "startDateField, endDateField, titleField, colorField"
1411
904
  }]
1412
- }), l.register("calendar", $, {
905
+ }), s.register("calendar", Y, {
1413
906
  namespace: "view",
1414
907
  label: "Calendar View",
1415
908
  category: "view",
@@ -1426,4 +919,4 @@ l.register("object-calendar", $, {
1426
919
  }]
1427
920
  });
1428
921
  //#endregion
1429
- export { Q as CalendarView, Ee as ObjectCalendar, $ as ObjectCalendarRenderer };
922
+ export { L as CalendarView, J as ObjectCalendar, Y as ObjectCalendarRenderer };