@innosolutions/inno-calendar 1.0.71 → 2.0.0

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.
Files changed (198) hide show
  1. package/CHANGELOG.md +93 -0
  2. package/LICENSE +48 -0
  3. package/README.md +333 -305
  4. package/dist/components/event/event-card.d.ts +3 -27
  5. package/dist/components/event/event-card.d.ts.map +1 -1
  6. package/dist/components/header/calendar-header.d.ts +14 -3
  7. package/dist/components/header/calendar-header.d.ts.map +1 -1
  8. package/dist/components/index.cjs +1 -1
  9. package/dist/components/index.d.ts +7 -6
  10. package/dist/components/index.d.ts.map +1 -1
  11. package/dist/components/index.mjs +48 -57
  12. package/dist/components/index.mjs.map +1 -1
  13. package/dist/components/inno-calendar.d.ts +139 -72
  14. package/dist/components/inno-calendar.d.ts.map +1 -1
  15. package/dist/components/primitives/field-layer.d.ts +12 -0
  16. package/dist/components/primitives/field-layer.d.ts.map +1 -0
  17. package/dist/components/primitives/index.d.ts +3 -0
  18. package/dist/components/primitives/index.d.ts.map +1 -1
  19. package/dist/components/primitives/quick-create.d.ts +44 -0
  20. package/dist/components/primitives/quick-create.d.ts.map +1 -0
  21. package/dist/components/primitives/recurrence-field.d.ts +102 -0
  22. package/dist/components/primitives/recurrence-field.d.ts.map +1 -0
  23. package/dist/components/primitives/when-row.d.ts +41 -0
  24. package/dist/components/primitives/when-row.d.ts.map +1 -0
  25. package/dist/components/shell/calendar-settings.d.ts +28 -0
  26. package/dist/components/shell/calendar-settings.d.ts.map +1 -0
  27. package/dist/components/shell/calendar-sidebar.d.ts +27 -0
  28. package/dist/components/shell/calendar-sidebar.d.ts.map +1 -0
  29. package/dist/components/shell/filter-panel.d.ts +10 -0
  30. package/dist/components/shell/filter-panel.d.ts.map +1 -0
  31. package/dist/components/shell/index.d.ts +5 -0
  32. package/dist/components/shell/index.d.ts.map +1 -0
  33. package/dist/components/shell/mini-month.d.ts +16 -0
  34. package/dist/components/shell/mini-month.d.ts.map +1 -0
  35. package/dist/components/ui/index.d.ts +0 -2
  36. package/dist/components/ui/index.d.ts.map +1 -1
  37. package/dist/components/views/agenda-view.d.ts +14 -15
  38. package/dist/components/views/agenda-view.d.ts.map +1 -1
  39. package/dist/components/views/day-events-expansion.d.ts +1 -1
  40. package/dist/components/views/day-events-expansion.d.ts.map +1 -1
  41. package/dist/components/views/day-view.d.ts +2 -6
  42. package/dist/components/views/day-view.d.ts.map +1 -1
  43. package/dist/components/views/index.d.ts +2 -1
  44. package/dist/components/views/index.d.ts.map +1 -1
  45. package/dist/components/views/month-view.d.ts +2 -12
  46. package/dist/components/views/month-view.d.ts.map +1 -1
  47. package/dist/components/views/resource-columns-view.d.ts +23 -0
  48. package/dist/components/views/resource-columns-view.d.ts.map +1 -0
  49. package/dist/components/views/timeline-view.d.ts +2 -6
  50. package/dist/components/views/timeline-view.d.ts.map +1 -1
  51. package/dist/components/views/week-view.d.ts +10 -6
  52. package/dist/components/views/week-view.d.ts.map +1 -1
  53. package/dist/components/views/year-view.d.ts +2 -6
  54. package/dist/components/views/year-view.d.ts.map +1 -1
  55. package/dist/core/constants.d.ts +32 -1
  56. package/dist/core/constants.d.ts.map +1 -1
  57. package/dist/core/context/drag-drop-context.d.ts +15 -1
  58. package/dist/core/context/drag-drop-context.d.ts.map +1 -1
  59. package/dist/core/context/event-card-context.d.ts +16 -0
  60. package/dist/core/context/event-card-context.d.ts.map +1 -0
  61. package/dist/core/context/inno-calendar-provider.d.ts +10 -1
  62. package/dist/core/context/inno-calendar-provider.d.ts.map +1 -1
  63. package/dist/core/context/slot-selection-context.d.ts +16 -0
  64. package/dist/core/context/slot-selection-context.d.ts.map +1 -1
  65. package/dist/core/index.cjs +1 -1
  66. package/dist/core/index.d.ts +3 -1
  67. package/dist/core/index.d.ts.map +1 -1
  68. package/dist/core/index.mjs +160 -155
  69. package/dist/core/index.mjs.map +1 -1
  70. package/dist/core/types.d.ts +44 -503
  71. package/dist/core/types.d.ts.map +1 -1
  72. package/dist/core/utils/date-input.d.ts +8 -0
  73. package/dist/core/utils/date-input.d.ts.map +1 -0
  74. package/dist/core/utils/grid-utils.d.ts.map +1 -1
  75. package/dist/core/utils/index.d.ts +1 -0
  76. package/dist/core/utils/index.d.ts.map +1 -1
  77. package/dist/core/utils/time-format.d.ts +24 -0
  78. package/dist/core/utils/time-format.d.ts.map +1 -0
  79. package/dist/core/utils/view-storage.d.ts +2 -2
  80. package/dist/core/utils/view-storage.d.ts.map +1 -1
  81. package/dist/core/z-layers.d.ts +21 -0
  82. package/dist/core/z-layers.d.ts.map +1 -0
  83. package/dist/index.cjs +1 -1
  84. package/dist/index.d.ts +0 -1
  85. package/dist/index.d.ts.map +1 -1
  86. package/dist/index.mjs +227 -234
  87. package/dist/index.mjs.map +1 -1
  88. package/dist/inno-calendar-B6qXIqxY.js +7433 -0
  89. package/dist/inno-calendar-B6qXIqxY.js.map +1 -0
  90. package/dist/inno-calendar-BnCt65PZ.cjs +11 -0
  91. package/dist/inno-calendar-BnCt65PZ.cjs.map +1 -0
  92. package/dist/lib/index.cjs +1 -1
  93. package/dist/lib/index.mjs +1 -1
  94. package/dist/position-utils-BzSoogFQ.cjs +2 -0
  95. package/dist/position-utils-BzSoogFQ.cjs.map +1 -0
  96. package/dist/position-utils-CBSmf90e.js +1106 -0
  97. package/dist/position-utils-CBSmf90e.js.map +1 -0
  98. package/dist/styles/index.css +1 -1
  99. package/dist/use-slot-selection-CxPvMluJ.cjs +2 -0
  100. package/dist/use-slot-selection-CxPvMluJ.cjs.map +1 -0
  101. package/dist/use-slot-selection-IXHnP8C1.js +357 -0
  102. package/dist/use-slot-selection-IXHnP8C1.js.map +1 -0
  103. package/dist/utils-B6yFEsav.js +9 -0
  104. package/dist/utils-B6yFEsav.js.map +1 -0
  105. package/dist/utils-IjLH3w2e.cjs +2 -0
  106. package/dist/utils-IjLH3w2e.cjs.map +1 -0
  107. package/dist/utils.cjs +1 -1
  108. package/dist/utils.d.ts +1 -1
  109. package/dist/utils.d.ts.map +1 -1
  110. package/dist/utils.mjs +99 -96
  111. package/dist/z-layers-Bavypndz.cjs +2 -0
  112. package/dist/z-layers-Bavypndz.cjs.map +1 -0
  113. package/dist/z-layers-r5PdtThu.js +637 -0
  114. package/dist/z-layers-r5PdtThu.js.map +1 -0
  115. package/package.json +117 -138
  116. package/AGENT.md +0 -1783
  117. package/dist/agenda-widget-Bl-Gb588.cjs +0 -2
  118. package/dist/agenda-widget-Bl-Gb588.cjs.map +0 -1
  119. package/dist/agenda-widget-DrRyLzTK.js +0 -4126
  120. package/dist/agenda-widget-DrRyLzTK.js.map +0 -1
  121. package/dist/components/calendar.d.ts +0 -45
  122. package/dist/components/calendar.d.ts.map +0 -1
  123. package/dist/components/event/event-page-transition.d.ts +0 -32
  124. package/dist/components/event/event-page-transition.d.ts.map +0 -1
  125. package/dist/components/filters/calendar-filter-sidebar.d.ts +0 -54
  126. package/dist/components/filters/calendar-filter-sidebar.d.ts.map +0 -1
  127. package/dist/components/filters/index.d.ts +0 -9
  128. package/dist/components/filters/index.d.ts.map +0 -1
  129. package/dist/components/filters/schedule-type-filter.d.ts +0 -31
  130. package/dist/components/filters/schedule-type-filter.d.ts.map +0 -1
  131. package/dist/components/filters/user-filter.d.ts +0 -31
  132. package/dist/components/filters/user-filter.d.ts.map +0 -1
  133. package/dist/components/header/components/index.d.ts +0 -8
  134. package/dist/components/header/components/index.d.ts.map +0 -1
  135. package/dist/components/integrated-calendar.d.ts +0 -37
  136. package/dist/components/integrated-calendar.d.ts.map +0 -1
  137. package/dist/components/settings/badge-variant-setting.d.ts +0 -25
  138. package/dist/components/settings/badge-variant-setting.d.ts.map +0 -1
  139. package/dist/components/settings/index.d.ts +0 -10
  140. package/dist/components/settings/index.d.ts.map +0 -1
  141. package/dist/components/settings/slot-duration-setting.d.ts +0 -20
  142. package/dist/components/settings/slot-duration-setting.d.ts.map +0 -1
  143. package/dist/components/settings/visible-hours-setting.d.ts +0 -23
  144. package/dist/components/settings/visible-hours-setting.d.ts.map +0 -1
  145. package/dist/components/settings/working-hours-setting.d.ts +0 -41
  146. package/dist/components/settings/working-hours-setting.d.ts.map +0 -1
  147. package/dist/components/ui/dialog.d.ts +0 -35
  148. package/dist/components/ui/dialog.d.ts.map +0 -1
  149. package/dist/components/ui/select.d.ts +0 -12
  150. package/dist/components/ui/select.d.ts.map +0 -1
  151. package/dist/components/widget/agenda-dropdown.d.ts +0 -20
  152. package/dist/components/widget/agenda-dropdown.d.ts.map +0 -1
  153. package/dist/components/widget/agenda-widget.d.ts +0 -27
  154. package/dist/components/widget/agenda-widget.d.ts.map +0 -1
  155. package/dist/components/widget/index.d.ts +0 -6
  156. package/dist/components/widget/index.d.ts.map +0 -1
  157. package/dist/index-D2U2F80P.cjs +0 -2
  158. package/dist/index-D2U2F80P.cjs.map +0 -1
  159. package/dist/index-DtaLkIY8.js +0 -2777
  160. package/dist/index-DtaLkIY8.js.map +0 -1
  161. package/dist/position-utils-D_KpwRus.js +0 -1053
  162. package/dist/position-utils-D_KpwRus.js.map +0 -1
  163. package/dist/position-utils-ksZ_IjXC.cjs +0 -2
  164. package/dist/position-utils-ksZ_IjXC.cjs.map +0 -1
  165. package/dist/presets/default/default-calendar.d.ts +0 -44
  166. package/dist/presets/default/default-calendar.d.ts.map +0 -1
  167. package/dist/presets/default/index.d.ts +0 -2
  168. package/dist/presets/default/index.d.ts.map +0 -1
  169. package/dist/presets/index.cjs +0 -2
  170. package/dist/presets/index.cjs.map +0 -1
  171. package/dist/presets/index.d.ts +0 -3
  172. package/dist/presets/index.d.ts.map +0 -1
  173. package/dist/presets/index.mjs +0 -6
  174. package/dist/presets/index.mjs.map +0 -1
  175. package/dist/presets/tailwind/index.d.ts +0 -2
  176. package/dist/presets/tailwind/index.d.ts.map +0 -1
  177. package/dist/presets/tailwind/tailwind-calendar.d.ts +0 -122
  178. package/dist/presets/tailwind/tailwind-calendar.d.ts.map +0 -1
  179. package/dist/slot-selection-context-CLYZU6ul.cjs +0 -2
  180. package/dist/slot-selection-context-CLYZU6ul.cjs.map +0 -1
  181. package/dist/slot-selection-context-Ct5cVcKW.js +0 -611
  182. package/dist/slot-selection-context-Ct5cVcKW.js.map +0 -1
  183. package/dist/tailwind-calendar-BbUb61uY.cjs +0 -2
  184. package/dist/tailwind-calendar-BbUb61uY.cjs.map +0 -1
  185. package/dist/tailwind-calendar-DrwGVSF-.js +0 -400
  186. package/dist/tailwind-calendar-DrwGVSF-.js.map +0 -1
  187. package/dist/use-calendar-BK0nQYJq.cjs +0 -2
  188. package/dist/use-calendar-BK0nQYJq.cjs.map +0 -1
  189. package/dist/use-calendar-DJI35SSd.js +0 -175
  190. package/dist/use-calendar-DJI35SSd.js.map +0 -1
  191. package/dist/use-slot-selection-CCE11R4j.cjs +0 -2
  192. package/dist/use-slot-selection-CCE11R4j.cjs.map +0 -1
  193. package/dist/use-slot-selection-CX1w8EdM.js +0 -188
  194. package/dist/use-slot-selection-CX1w8EdM.js.map +0 -1
  195. package/dist/week-view-BXmaRChB.cjs +0 -11
  196. package/dist/week-view-BXmaRChB.cjs.map +0 -1
  197. package/dist/week-view-BeasFcyR.js +0 -3520
  198. package/dist/week-view-BeasFcyR.js.map +0 -1
@@ -1,4126 +0,0 @@
1
- import { jsx as e, jsxs as r, Fragment as ke } from "react/jsx-runtime";
2
- import { g as ct, u as kt, C as Nt } from "./use-calendar-DJI35SSd.js";
3
- import { useCallback as B, useState as le, useEffect as he, forwardRef as We, useRef as ae, useMemo as re, useLayoutEffect as dt, useImperativeHandle as Dt } from "react";
4
- import { c as f } from "./index-DtaLkIY8.js";
5
- import { P as ut, p as ht, o as mt, z as pe, I as Ct, J as Mt, B as Me, K as Et, L as Ye, x as xe, F as ve, y as we, k as Lt, C as St, M as Ke, A as Tt, W as It, c as Ht, N as zt } from "./week-view-BeasFcyR.js";
6
- import { j as At, D as jt, I as Pt, e as Wt, S as _t } from "./slot-selection-context-Ct5cVcKW.js";
7
- import { aG as ue, b2 as _e, L as ft, as as $t, a2 as Ft, ad as Ot, o as gt, Y as Bt } from "./position-utils-D_KpwRus.js";
8
- function Rt({ view: t, className: n = "" }) {
9
- return /* @__PURE__ */ e(
10
- "div",
11
- {
12
- className: n,
13
- style: {
14
- display: "flex",
15
- alignItems: "center",
16
- justifyContent: "center",
17
- minHeight: "400px",
18
- backgroundColor: "#f9fafb",
19
- borderRadius: "0.5rem",
20
- border: "1px dashed #d1d5db"
21
- },
22
- children: /* @__PURE__ */ r("div", { style: { textAlign: "center", color: "#6b7280" }, children: [
23
- /* @__PURE__ */ r("p", { style: { fontSize: "1.125rem", fontWeight: 500 }, children: [
24
- t.charAt(0).toUpperCase() + t.slice(1),
25
- " View"
26
- ] }),
27
- /* @__PURE__ */ e("p", { style: { fontSize: "0.875rem" }, children: "Implementation pending" })
28
- ] })
29
- }
30
- );
31
- }
32
- function qe({ view: t, className: n }) {
33
- return /* @__PURE__ */ e(Rt, { view: t, className: n });
34
- }
35
- function Ir(t) {
36
- const {
37
- events: n,
38
- resources: a,
39
- scheduleTypes: o,
40
- initialView: s = "week",
41
- initialDate: l,
42
- initialFilters: p,
43
- preferences: h,
44
- locale: c,
45
- slots: v,
46
- renderEvent: H,
47
- onViewChange: b,
48
- onDateChange: w,
49
- onEventClick: P,
50
- onSlotSelect: S,
51
- onFiltersChange: $,
52
- className: F,
53
- children: R
54
- } = t, I = ct();
55
- if (I)
56
- return /* @__PURE__ */ e("div", { className: F, style: { position: "relative" }, children: R ?? /* @__PURE__ */ e(qe, { view: I.view, className: F }) });
57
- const L = kt({
58
- events: n,
59
- resources: a,
60
- scheduleTypes: o,
61
- initialView: s,
62
- initialDate: l,
63
- initialFilters: p,
64
- preferences: h,
65
- locale: c,
66
- onViewChange: b,
67
- onDateChange: w,
68
- onEventClick: P,
69
- onSlotSelect: S,
70
- onFiltersChange: $
71
- });
72
- return /* @__PURE__ */ e(Nt, { value: L, children: /* @__PURE__ */ e("div", { className: F, style: { position: "relative" }, children: R ?? /* @__PURE__ */ e(qe, { view: L.view, className: F }) }) });
73
- }
74
- function Ut({ className: t }) {
75
- return /* @__PURE__ */ r(
76
- "svg",
77
- {
78
- xmlns: "http://www.w3.org/2000/svg",
79
- viewBox: "0 0 24 24",
80
- fill: "none",
81
- stroke: "currentColor",
82
- strokeWidth: "2",
83
- strokeLinecap: "round",
84
- strokeLinejoin: "round",
85
- className: t,
86
- children: [
87
- /* @__PURE__ */ e("path", { d: "M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z" }),
88
- /* @__PURE__ */ e("path", { d: "m15 5 4 4" })
89
- ]
90
- }
91
- );
92
- }
93
- function pt({ className: t }) {
94
- return /* @__PURE__ */ r(
95
- "svg",
96
- {
97
- xmlns: "http://www.w3.org/2000/svg",
98
- viewBox: "0 0 24 24",
99
- fill: "none",
100
- stroke: "currentColor",
101
- strokeWidth: "2",
102
- strokeLinecap: "round",
103
- strokeLinejoin: "round",
104
- className: t,
105
- children: [
106
- /* @__PURE__ */ e("path", { d: "M3 6h18" }),
107
- /* @__PURE__ */ e("path", { d: "M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6" }),
108
- /* @__PURE__ */ e("path", { d: "M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2" }),
109
- /* @__PURE__ */ e("line", { x1: "10", x2: "10", y1: "11", y2: "17" }),
110
- /* @__PURE__ */ e("line", { x1: "14", x2: "14", y1: "11", y2: "17" })
111
- ]
112
- }
113
- );
114
- }
115
- function Pe({ className: t }) {
116
- return /* @__PURE__ */ r(
117
- "svg",
118
- {
119
- xmlns: "http://www.w3.org/2000/svg",
120
- viewBox: "0 0 24 24",
121
- fill: "none",
122
- stroke: "currentColor",
123
- strokeWidth: "2",
124
- strokeLinecap: "round",
125
- strokeLinejoin: "round",
126
- className: t,
127
- children: [
128
- /* @__PURE__ */ e("path", { d: "M18 6 6 18" }),
129
- /* @__PURE__ */ e("path", { d: "m6 6 12 12" })
130
- ]
131
- }
132
- );
133
- }
134
- function Vt({ className: t }) {
135
- return /* @__PURE__ */ r(
136
- "svg",
137
- {
138
- xmlns: "http://www.w3.org/2000/svg",
139
- viewBox: "0 0 24 24",
140
- fill: "none",
141
- stroke: "currentColor",
142
- strokeWidth: "2",
143
- strokeLinecap: "round",
144
- strokeLinejoin: "round",
145
- className: t,
146
- children: [
147
- /* @__PURE__ */ e("circle", { cx: "12", cy: "12", r: "10" }),
148
- /* @__PURE__ */ e("path", { d: "m4.9 4.9 14.2 14.2" })
149
- ]
150
- }
151
- );
152
- }
153
- function Ie({ className: t }) {
154
- return /* @__PURE__ */ e(
155
- "svg",
156
- {
157
- xmlns: "http://www.w3.org/2000/svg",
158
- viewBox: "0 0 24 24",
159
- fill: "none",
160
- stroke: "currentColor",
161
- strokeWidth: "2",
162
- strokeLinecap: "round",
163
- strokeLinejoin: "round",
164
- className: t,
165
- children: /* @__PURE__ */ e("path", { d: "M20 6 9 17l-5-5" })
166
- }
167
- );
168
- }
169
- function Yt({ className: t }) {
170
- return /* @__PURE__ */ r(
171
- "svg",
172
- {
173
- xmlns: "http://www.w3.org/2000/svg",
174
- viewBox: "0 0 24 24",
175
- fill: "none",
176
- stroke: "currentColor",
177
- strokeWidth: "2",
178
- strokeLinecap: "round",
179
- strokeLinejoin: "round",
180
- className: t,
181
- children: [
182
- /* @__PURE__ */ e("circle", { cx: "12", cy: "12", r: "10" }),
183
- /* @__PURE__ */ e("path", { d: "m9 12 2 2 4-4" })
184
- ]
185
- }
186
- );
187
- }
188
- function Kt({ className: t }) {
189
- return /* @__PURE__ */ e(
190
- "svg",
191
- {
192
- xmlns: "http://www.w3.org/2000/svg",
193
- viewBox: "0 0 24 24",
194
- fill: "none",
195
- stroke: "currentColor",
196
- strokeWidth: "2",
197
- strokeLinecap: "round",
198
- strokeLinejoin: "round",
199
- className: t,
200
- children: /* @__PURE__ */ e("path", { d: "m6 9 6 6 6-6" })
201
- }
202
- );
203
- }
204
- function qt({ className: t }) {
205
- return /* @__PURE__ */ r(
206
- "svg",
207
- {
208
- xmlns: "http://www.w3.org/2000/svg",
209
- viewBox: "0 0 24 24",
210
- fill: "none",
211
- stroke: "currentColor",
212
- strokeWidth: "2",
213
- strokeLinecap: "round",
214
- strokeLinejoin: "round",
215
- className: t,
216
- children: [
217
- /* @__PURE__ */ e("path", { d: "M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2" }),
218
- /* @__PURE__ */ e("circle", { cx: "9", cy: "7", r: "4" }),
219
- /* @__PURE__ */ e("path", { d: "M22 21v-2a4 4 0 0 0-3-3.87" }),
220
- /* @__PURE__ */ e("path", { d: "M16 3.13a4 4 0 0 1 0 7.75" })
221
- ]
222
- }
223
- );
224
- }
225
- function Gt({ className: t }) {
226
- return /* @__PURE__ */ r(
227
- "svg",
228
- {
229
- xmlns: "http://www.w3.org/2000/svg",
230
- viewBox: "0 0 24 24",
231
- fill: "none",
232
- stroke: "currentColor",
233
- strokeWidth: "2",
234
- strokeLinecap: "round",
235
- strokeLinejoin: "round",
236
- className: t,
237
- children: [
238
- /* @__PURE__ */ e("path", { d: "M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0" }),
239
- /* @__PURE__ */ e("circle", { cx: "12", cy: "10", r: "3" })
240
- ]
241
- }
242
- );
243
- }
244
- function Jt({ className: t }) {
245
- return /* @__PURE__ */ r(
246
- "svg",
247
- {
248
- xmlns: "http://www.w3.org/2000/svg",
249
- viewBox: "0 0 24 24",
250
- fill: "none",
251
- stroke: "currentColor",
252
- strokeWidth: "2",
253
- strokeLinecap: "round",
254
- strokeLinejoin: "round",
255
- className: t,
256
- children: [
257
- /* @__PURE__ */ e("path", { d: "M8 2v4" }),
258
- /* @__PURE__ */ e("path", { d: "M16 2v4" }),
259
- /* @__PURE__ */ e("rect", { width: "18", height: "18", x: "3", y: "4", rx: "2" }),
260
- /* @__PURE__ */ e("path", { d: "M3 10h18" })
261
- ]
262
- }
263
- );
264
- }
265
- function Xt({ className: t }) {
266
- return /* @__PURE__ */ r(
267
- "svg",
268
- {
269
- xmlns: "http://www.w3.org/2000/svg",
270
- viewBox: "0 0 24 24",
271
- fill: "none",
272
- stroke: "currentColor",
273
- strokeWidth: "2",
274
- strokeLinecap: "round",
275
- strokeLinejoin: "round",
276
- className: t,
277
- children: [
278
- /* @__PURE__ */ e("path", { d: "M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z" }),
279
- /* @__PURE__ */ e("path", { d: "M14 2v4a2 2 0 0 0 2 2h4" }),
280
- /* @__PURE__ */ e("path", { d: "M10 9H8" }),
281
- /* @__PURE__ */ e("path", { d: "M16 13H8" }),
282
- /* @__PURE__ */ e("path", { d: "M16 17H8" })
283
- ]
284
- }
285
- );
286
- }
287
- function Ee({ className: t }) {
288
- return /* @__PURE__ */ e(
289
- "svg",
290
- {
291
- xmlns: "http://www.w3.org/2000/svg",
292
- viewBox: "0 0 24 24",
293
- fill: "none",
294
- stroke: "currentColor",
295
- strokeWidth: "2",
296
- strokeLinecap: "round",
297
- strokeLinejoin: "round",
298
- className: f("animate-spin", t),
299
- children: /* @__PURE__ */ e("path", { d: "M21 12a9 9 0 1 1-6.219-8.56" })
300
- }
301
- );
302
- }
303
- const Qt = {
304
- edit: "Edit",
305
- delete: "Delete",
306
- cancel: "Cancel Event",
307
- close: "Close",
308
- going: "Going",
309
- notGoing: "Not Going",
310
- confirmMeeting: "Confirm meeting took place",
311
- completed: "Completed",
312
- canceled: "Canceled",
313
- participants: "Participants",
314
- guest: "guest",
315
- guests: "guests",
316
- confirmed: "confirmed",
317
- organizer: "Organizer",
318
- client: "Client",
319
- more: "more",
320
- noDateProvided: "No date provided",
321
- eventNotFound: "Event not found",
322
- cancellationNote: "Cancellation Note",
323
- canceledOn: "Canceled on",
324
- acceptThisEvent: "Accept this event only",
325
- acceptAllEvents: "Accept all events",
326
- deleteConfirmTitle: "Delete Event",
327
- deleteConfirmDescription: "Are you sure you want to delete this event? This action cannot be undone."
328
- }, He = We(
329
- ({ onClick: t, label: n, children: a, className: o, variant: s = "ghost", ...l }, p) => /* @__PURE__ */ r(xe, { children: [
330
- /* @__PURE__ */ e(ve, { asChild: !0, children: /* @__PURE__ */ e(
331
- "button",
332
- {
333
- type: "button",
334
- ref: p,
335
- onClick: t,
336
- className: f(
337
- "h-8 w-8 rounded-full flex items-center justify-center transition-colors",
338
- s === "ghost" && "hover:bg-zinc-100 dark:hover:bg-zinc-800 text-zinc-600 dark:text-zinc-400",
339
- s === "destructive" && "hover:bg-red-50 dark:hover:bg-red-950/30 text-zinc-600 dark:text-zinc-400 hover:text-red-600",
340
- o
341
- ),
342
- "aria-label": n,
343
- ...l,
344
- children: a
345
- }
346
- ) }),
347
- /* @__PURE__ */ e(we, { side: "bottom", className: "text-xs", children: n })
348
- ] })
349
- );
350
- He.displayName = "IconButton";
351
- function Zt({ src: t, alt: n, initials: a, className: o, isClient: s }) {
352
- const [l, p] = le(!1);
353
- return /* @__PURE__ */ e(
354
- "div",
355
- {
356
- className: f(
357
- "relative h-7 w-7 rounded-full overflow-hidden shrink-0",
358
- o
359
- ),
360
- children: t && !l ? /* @__PURE__ */ e(
361
- "img",
362
- {
363
- src: t,
364
- alt: n,
365
- className: "h-full w-full object-cover",
366
- onError: () => p(!0)
367
- }
368
- ) : /* @__PURE__ */ e(
369
- "div",
370
- {
371
- className: f(
372
- "h-full w-full flex items-center justify-center text-[10px] font-medium",
373
- s ? "bg-amber-100 dark:bg-amber-900/30 text-amber-700 dark:text-amber-300" : "bg-zinc-200 dark:bg-zinc-700 text-zinc-700 dark:text-zinc-300"
374
- ),
375
- children: a
376
- }
377
- )
378
- }
379
- );
380
- }
381
- function Ge({
382
- participant: t,
383
- isEventCanceled: n = !1,
384
- labels: a
385
- }) {
386
- const o = t.name || "Unknown", s = o.split(" ").map((w) => w[0]).join("").toUpperCase().slice(0, 2), l = t.isOrganizer ?? !1, p = t.isConfirmed, h = p === !0, c = p === !1, v = t.isClient ?? !1, H = t.profilePicture || t.avatar, b = n;
387
- return /* @__PURE__ */ r(
388
- "div",
389
- {
390
- className: f(
391
- "flex items-center gap-3 py-0",
392
- b && "opacity-60"
393
- ),
394
- children: [
395
- /* @__PURE__ */ r("div", { className: "relative", children: [
396
- /* @__PURE__ */ e(
397
- Zt,
398
- {
399
- src: H,
400
- alt: o,
401
- initials: s,
402
- isClient: v,
403
- className: f(b && "grayscale")
404
- }
405
- ),
406
- b || c ? /* @__PURE__ */ e("div", { className: "absolute -bottom-0.5 -right-0.5 h-3.5 w-3.5 rounded-full bg-white dark:bg-zinc-900 flex items-center justify-center", children: /* @__PURE__ */ e("div", { className: "h-3 w-3 rounded-full bg-red-100 dark:bg-red-900/50 flex items-center justify-center", children: /* @__PURE__ */ e(Pe, { className: "h-2 w-2 text-red-600 dark:text-red-400 stroke-[3]" }) }) }) : h ? /* @__PURE__ */ e("div", { className: "absolute -bottom-0.5 -right-0.5 h-3.5 w-3.5 rounded-full bg-white dark:bg-zinc-900 flex items-center justify-center", children: /* @__PURE__ */ e("div", { className: "h-3 w-3 rounded-full bg-green-100 dark:bg-green-900/50 flex items-center justify-center", children: /* @__PURE__ */ e(Ie, { className: "h-2 w-2 text-green-600 dark:text-green-400 stroke-[3]" }) }) }) : null
407
- ] }),
408
- /* @__PURE__ */ r("div", { className: "!h-fit min-w-0 gap-0", children: [
409
- /* @__PURE__ */ e("div", { className: "gap-0", children: /* @__PURE__ */ e(
410
- "span",
411
- {
412
- className: f(
413
- "text-sm text-zinc-900 dark:text-zinc-100 truncate",
414
- b && "line-through text-zinc-500 dark:text-zinc-500"
415
- ),
416
- children: o
417
- }
418
- ) }),
419
- v && /* @__PURE__ */ e("div", { className: "text-[10px] px-1.5 w-fit py-0.5 rounded bg-amber-100 dark:bg-amber-900/30 text-amber-700 dark:text-amber-300 font-medium", children: a.client }),
420
- l && !b && /* @__PURE__ */ e("div", { className: "text-xs text-zinc-500", children: a.organizer })
421
- ] })
422
- ]
423
- }
424
- );
425
- }
426
- function en({
427
- open: t,
428
- onOpenChange: n,
429
- title: a,
430
- children: o
431
- }) {
432
- return he(() => {
433
- if (!t) return;
434
- const s = (l) => {
435
- l.key === "Escape" && n(!1);
436
- };
437
- return document.addEventListener("keydown", s), () => document.removeEventListener("keydown", s);
438
- }, [t, n]), he(() => (t ? document.body.style.overflow = "hidden" : document.body.style.overflow = "", () => {
439
- document.body.style.overflow = "";
440
- }), [t]), t ? /* @__PURE__ */ r("div", { className: "fixed inset-0 z-50", children: [
441
- /* @__PURE__ */ e(
442
- "div",
443
- {
444
- className: "fixed inset-0 bg-black/50 backdrop-blur-sm",
445
- onClick: () => n(!1),
446
- onKeyDown: (s) => {
447
- (s.key === "Enter" || s.key === " ") && n(!1);
448
- }
449
- }
450
- ),
451
- /* @__PURE__ */ e("div", { className: "fixed inset-x-4 top-[50%] translate-y-[-50%] max-w-md mx-auto", children: /* @__PURE__ */ r("div", { className: "bg-white dark:bg-zinc-900 rounded-2xl shadow-xl overflow-hidden", children: [
452
- a && /* @__PURE__ */ e("div", { className: "sr-only", children: a }),
453
- o
454
- ] }) })
455
- ] }) : null;
456
- }
457
- function tn({
458
- open: t,
459
- onOpenChange: n,
460
- title: a,
461
- description: o,
462
- cancelLabel: s,
463
- confirmLabel: l,
464
- onConfirm: p,
465
- isLoading: h
466
- }) {
467
- return t ? /* @__PURE__ */ r("div", { className: "fixed inset-0 z-[60]", children: [
468
- /* @__PURE__ */ e(
469
- "div",
470
- {
471
- className: "fixed inset-0 bg-black/50 backdrop-blur-sm",
472
- onClick: () => n(!1),
473
- onKeyDown: (c) => {
474
- (c.key === "Enter" || c.key === " ") && n(!1);
475
- }
476
- }
477
- ),
478
- /* @__PURE__ */ e("div", { className: "fixed inset-x-4 top-[50%] translate-y-[-50%] max-w-md mx-auto", children: /* @__PURE__ */ r("div", { className: "bg-white dark:bg-zinc-900 rounded-lg shadow-xl p-6", children: [
479
- /* @__PURE__ */ e("h2", { className: "text-lg font-semibold text-zinc-900 dark:text-zinc-100", children: a }),
480
- /* @__PURE__ */ e("p", { className: "mt-2 text-sm text-zinc-600 dark:text-zinc-400", children: o }),
481
- /* @__PURE__ */ r("div", { className: "mt-4 flex justify-end gap-3", children: [
482
- /* @__PURE__ */ e(
483
- Me,
484
- {
485
- variant: "outline",
486
- size: "sm",
487
- onClick: () => n(!1),
488
- children: s
489
- }
490
- ),
491
- /* @__PURE__ */ r(
492
- Me,
493
- {
494
- variant: "destructive",
495
- size: "sm",
496
- onClick: p,
497
- disabled: h,
498
- children: [
499
- h && /* @__PURE__ */ e(Ee, { className: "h-4 w-4 mr-2" }),
500
- /* @__PURE__ */ e(pt, { className: "h-4 w-4 mr-2" }),
501
- l
502
- ]
503
- }
504
- )
505
- ] })
506
- ] }) })
507
- ] }) : null;
508
- }
509
- function nn(t, n) {
510
- return t.toLocaleDateString(void 0, {
511
- weekday: "long",
512
- month: "long",
513
- day: "numeric"
514
- });
515
- }
516
- function rn(t, n) {
517
- const a = {
518
- hour: "2-digit",
519
- minute: "2-digit",
520
- hour12: !1
521
- };
522
- return `${t.toLocaleTimeString(void 0, a)} – ${n.toLocaleTimeString(void 0, a)}`;
523
- }
524
- function on(t) {
525
- return t.toLocaleDateString(void 0, {
526
- day: "2-digit",
527
- month: "short",
528
- year: "numeric",
529
- hour: "2-digit",
530
- minute: "2-digit"
531
- });
532
- }
533
- function an(t) {
534
- const [n, a] = le(() => typeof window < "u" ? window.matchMedia(t).matches : !1);
535
- return he(() => {
536
- if (typeof window > "u") return;
537
- const o = window.matchMedia(t), s = (l) => a(l.matches);
538
- return o.addEventListener("change", s), () => o.removeEventListener("change", s);
539
- }, [t]), n;
540
- }
541
- function Je({
542
- event: t,
543
- labels: n,
544
- isLoading: a,
545
- onClose: o,
546
- onEdit: s,
547
- onDelete: l,
548
- onCancel: p,
549
- onAccept: h,
550
- onDecline: c,
551
- onConfirmMeeting: v,
552
- canEdit: H = !0,
553
- canDelete: b = !1,
554
- canCancel: w = !0,
555
- isCurrentUserParticipant: P = !1,
556
- isCurrentUserClient: S = !1,
557
- currentUserAcceptStatus: $,
558
- isAcceptLoading: F = !1,
559
- isDeclineLoading: R = !1,
560
- isConfirmLoading: I = !1,
561
- isDeleteLoading: L = !1,
562
- renderParticipant: W,
563
- renderHeaderActions: z,
564
- renderCancelReason: X,
565
- renderDeleteConfirmation: M,
566
- formatDate: _ = nn,
567
- formatTimeRange: A = rn
568
- }) {
569
- const [K, q] = le(!1), Y = !(t.isCanceled || t.meetingTookPlace), g = t.isRecurring ?? !1, C = t.participantDetails, u = t.participantsNames || [], N = C && C.length > 0, y = $ === !0, V = $ === !1, O = P && !S && Y, G = N ? C.filter((J) => J.isConfirmed).length : t.isAccepted ? u.length : 0, U = N ? C.length : u.length, se = t.scheduleTypeColor || t.hexColor || "#039BE5", Z = B(() => t.startDate ? _(t.startDate) : n.noDateProvided, [t.startDate, _, n.noDateProvided]), me = B(() => t.startDate && t.endDate ? A(t.startDate, t.endDate) : null, [t.startDate, t.endDate, A]), Ne = () => {
570
- o(), s?.(t);
571
- }, te = () => {
572
- o(), p?.(t);
573
- }, ce = () => {
574
- q(!0);
575
- }, fe = () => {
576
- l?.(t), q(!1);
577
- };
578
- return a ? /* @__PURE__ */ e("div", { className: "flex h-48 items-center justify-center", children: /* @__PURE__ */ e(Ee, { className: "h-6 w-6 text-zinc-400" }) }) : /* @__PURE__ */ r(pe, { delayDuration: 300, children: [
579
- /* @__PURE__ */ r("div", { className: "flex flex-col gap-0.5 p-3", children: [
580
- /* @__PURE__ */ e("div", { className: "flex items-start justify-end gap-0.5", children: z ? z({ onClose: o }) : /* @__PURE__ */ r(ke, { children: [
581
- Y && H && s && /* @__PURE__ */ e(He, { onClick: Ne, label: n.edit, children: /* @__PURE__ */ e(Ut, { className: "h-[18px] w-[18px]" }) }),
582
- Y && w && p && /* @__PURE__ */ e(He, { onClick: te, label: n.cancel, children: /* @__PURE__ */ e(Vt, { className: "h-[18px] w-[18px]" }) }),
583
- b && l && /* @__PURE__ */ e(
584
- He,
585
- {
586
- onClick: ce,
587
- label: n.delete,
588
- variant: "destructive",
589
- children: /* @__PURE__ */ e(pt, { className: "h-[18px] w-[18px]" })
590
- }
591
- ),
592
- /* @__PURE__ */ e(He, { onClick: o, label: n.close, children: /* @__PURE__ */ e(Pe, { className: "h-[18px] w-[18px]" }) })
593
- ] }) }),
594
- /* @__PURE__ */ e("div", { children: /* @__PURE__ */ r("div", { className: "flex items-start gap-2", children: [
595
- /* @__PURE__ */ e(
596
- "div",
597
- {
598
- className: "w-4 h-4 rounded mt-1 shrink-0",
599
- style: { backgroundColor: se }
600
- }
601
- ),
602
- /* @__PURE__ */ r("div", { className: "flex-1 min-w-0", children: [
603
- /* @__PURE__ */ r("div", { className: "flex items-center gap-2 flex-wrap", children: [
604
- /* @__PURE__ */ e(
605
- "h2",
606
- {
607
- className: f(
608
- "text-[22px] font-normal text-zinc-900 dark:text-zinc-100 leading-tight",
609
- t.isCanceled && "line-through opacity-60"
610
- ),
611
- children: t.title
612
- }
613
- ),
614
- t.meetingTookPlace && /* @__PURE__ */ r("span", { className: "inline-flex items-center gap-1 px-2 py-0.5 rounded-full bg-green-100 dark:bg-green-900/30 text-green-700 dark:text-green-400 text-xs font-medium", children: [
615
- /* @__PURE__ */ e(Yt, { className: "h-3 w-3" }),
616
- n.completed
617
- ] }),
618
- t.isCanceled && /* @__PURE__ */ r("span", { className: "inline-flex items-center gap-1 px-2 py-0.5 rounded-full bg-red-100 dark:bg-red-900/30 text-red-700 dark:text-red-400 text-xs font-medium", children: [
619
- /* @__PURE__ */ e(Pe, { className: "h-3 w-3" }),
620
- n.canceled
621
- ] })
622
- ] }),
623
- /* @__PURE__ */ r("div", { className: "mt-1 text-sm text-zinc-600 dark:text-zinc-400", children: [
624
- /* @__PURE__ */ e("span", { children: Z() }),
625
- me() && /* @__PURE__ */ r(ke, { children: [
626
- /* @__PURE__ */ e("span", { className: "mx-1.5", children: "·" }),
627
- /* @__PURE__ */ e("span", { children: me() })
628
- ] })
629
- ] }),
630
- g && t.recurrenceSummary && /* @__PURE__ */ e("div", { className: "text-sm text-zinc-500 dark:text-zinc-500", children: t.recurrenceSummary })
631
- ] })
632
- ] }) }),
633
- t.isCanceled && /* @__PURE__ */ e("div", { className: "mx-4 p-3 rounded-lg bg-red-50 dark:bg-red-950/30", children: X ? X(t) : /* @__PURE__ */ e("div", { className: "flex items-start gap-0", children: /* @__PURE__ */ r("div", { className: "flex-1 min-w-0", children: [
634
- /* @__PURE__ */ e("div", { className: "text-sm font-medium text-red-700 dark:text-red-400", children: n.cancellationNote }),
635
- t.cancelReason && /* @__PURE__ */ r("div", { className: "mt-1 text-sm text-red-600/80 dark:text-red-400/80 italic", children: [
636
- '"',
637
- t.cancelReason,
638
- '"'
639
- ] }),
640
- t.canceledDate && /* @__PURE__ */ r("div", { className: "mt-1.5 text-xs text-red-500/70 dark:text-red-400/60", children: [
641
- n.canceledOn,
642
- " ",
643
- on(t.canceledDate)
644
- ] })
645
- ] }) }) }),
646
- /* @__PURE__ */ r("div", { className: "space-y-0.5", children: [
647
- t.address && /* @__PURE__ */ r("div", { className: "flex items-start gap-2", children: [
648
- /* @__PURE__ */ e(Gt, { className: "h-5 w-5 text-zinc-400 mt-0.5 shrink-0" }),
649
- /* @__PURE__ */ e("span", { className: "text-sm text-zinc-700 dark:text-zinc-300", children: t.address })
650
- ] }),
651
- (N || u.length > 0) && /* @__PURE__ */ r("div", { className: "flex items-start gap-2 py-0", children: [
652
- /* @__PURE__ */ e(qt, { className: "h-5 w-5 text-zinc-400 mt-0.5 shrink-0" }),
653
- /* @__PURE__ */ r("div", { className: "flex-1", children: [
654
- /* @__PURE__ */ r("div", { className: "flex items-center gap-0", children: [
655
- /* @__PURE__ */ r("span", { className: "text-sm text-zinc-900 dark:text-zinc-100 font-medium", children: [
656
- U,
657
- " ",
658
- U !== 1 ? n.guests : n.guest
659
- ] }),
660
- U > 0 && /* @__PURE__ */ r("span", { className: "text-xs text-zinc-500", children: [
661
- "(",
662
- G,
663
- " ",
664
- n.confirmed,
665
- ")"
666
- ] })
667
- ] }),
668
- /* @__PURE__ */ r("div", { className: "mt-2 space-y-2", children: [
669
- N ? C.slice(0, 6).map(
670
- (J, m) => W ? W(J, m) : /* @__PURE__ */ e(
671
- Ge,
672
- {
673
- participant: J,
674
- isEventCanceled: t.isCanceled,
675
- labels: n
676
- },
677
- J.id
678
- )
679
- ) : u.slice(0, 6).map((J, m) => {
680
- const j = {
681
- id: String(m),
682
- name: J,
683
- email: "",
684
- isConfirmed: t.isAccepted,
685
- isOrganizer: m === 0,
686
- isClient: !1
687
- };
688
- return W ? W(j, m) : /* @__PURE__ */ e(
689
- Ge,
690
- {
691
- participant: j,
692
- isEventCanceled: t.isCanceled,
693
- labels: n
694
- },
695
- J
696
- );
697
- }),
698
- U > 6 && /* @__PURE__ */ r("div", { className: "text-xs text-zinc-500 py-1.5 pl-10", children: [
699
- "+",
700
- U - 6,
701
- " ",
702
- n.more
703
- ] })
704
- ] })
705
- ] })
706
- ] }),
707
- t.description && /* @__PURE__ */ r("div", { className: "flex items-start gap-2", children: [
708
- /* @__PURE__ */ e(Xt, { className: "h-5 w-5 text-zinc-400 mt-0.5 shrink-0" }),
709
- /* @__PURE__ */ e("p", { className: "text-sm text-zinc-700 dark:text-zinc-300 whitespace-pre-wrap", children: t.description })
710
- ] }),
711
- /* @__PURE__ */ r("div", { className: "flex items-start gap-2", children: [
712
- /* @__PURE__ */ e(Jt, { className: "h-5 w-5 text-zinc-400 mt-0.5 shrink-0" }),
713
- /* @__PURE__ */ e("div", { className: "text-sm text-zinc-700 dark:text-zinc-300", children: N && C.find((J) => J.isOrganizer)?.name || u[0] || "Calendar" })
714
- ] })
715
- ] }),
716
- O && h && c && /* @__PURE__ */ e("div", { className: "border-t border-zinc-100 dark:border-zinc-800 mt-3 py-3", children: /* @__PURE__ */ r("div", { className: "flex items-center gap-2", children: [
717
- g ? /* @__PURE__ */ r(Ct, { children: [
718
- /* @__PURE__ */ e(Mt, { asChild: !0, children: /* @__PURE__ */ r("div", { className: "flex", children: [
719
- /* @__PURE__ */ e(
720
- Me,
721
- {
722
- size: "sm",
723
- variant: "outline",
724
- className: f(
725
- "rounded-r-none gap-1.5 h-8 !border-none !bg-green-100 text-green-800 hover:!bg-green-200",
726
- y && "!bg-green-700 !text-white hover:!bg-green-700"
727
- ),
728
- onClick: (J) => {
729
- J.stopPropagation(), y || h(t);
730
- },
731
- disabled: F,
732
- children: F ? /* @__PURE__ */ e(Ee, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ r(ke, { children: [
733
- y && /* @__PURE__ */ e(Ie, { className: "h-3.5 w-3.5" }),
734
- n.going
735
- ] })
736
- }
737
- ),
738
- /* @__PURE__ */ e(
739
- Me,
740
- {
741
- size: "sm",
742
- variant: "outline",
743
- className: f(
744
- "rounded-l-none px-1.5 h-8 !border-none !bg-green-100 text-green-800 hover:!bg-green-200",
745
- y && "!bg-green-700 !text-white hover:!bg-green-700"
746
- ),
747
- children: /* @__PURE__ */ e(Kt, { className: "h-3.5 w-3.5" })
748
- }
749
- )
750
- ] }) }),
751
- /* @__PURE__ */ r(Et, { align: "start", children: [
752
- /* @__PURE__ */ r(
753
- Ye,
754
- {
755
- className: f(
756
- "gap-1.5 h-8 !border-none !bg-green-50 text-green-800 hover:!bg-green-100",
757
- y && "!bg-green-700 !text-white hover:!bg-green-700"
758
- ),
759
- onClick: () => h(t),
760
- children: [
761
- /* @__PURE__ */ e(Ie, { className: "h-3.5 w-3.5 mr-2 text-green-600" }),
762
- n.acceptThisEvent
763
- ]
764
- }
765
- ),
766
- /* @__PURE__ */ r(Ye, { onClick: () => h(t), children: [
767
- /* @__PURE__ */ e(Ie, { className: "h-3.5 w-3.5 mr-2 text-green-600" }),
768
- n.acceptAllEvents
769
- ] })
770
- ] })
771
- ] }) : /* @__PURE__ */ e(
772
- Me,
773
- {
774
- size: "sm",
775
- variant: "outline",
776
- className: f(
777
- "gap-1.5 h-8 !border-none !bg-green-100 text-green-800 hover:!bg-green-200",
778
- y && "!bg-green-700 !text-white hover:!bg-green-700"
779
- ),
780
- onClick: () => {
781
- y || h(t);
782
- },
783
- disabled: F,
784
- children: F ? /* @__PURE__ */ e(Ee, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ r(ke, { children: [
785
- y && /* @__PURE__ */ e(Ie, { className: "h-3.5 w-3.5" }),
786
- n.going
787
- ] })
788
- }
789
- ),
790
- /* @__PURE__ */ e(
791
- Me,
792
- {
793
- size: "sm",
794
- variant: "outline",
795
- className: f(
796
- "gap-1.5 h-8 !border-none !bg-rose-100 text-rose-800 hover:!bg-rose-200",
797
- V && "!bg-rose-700 !text-white hover:!bg-rose-700"
798
- ),
799
- onClick: () => {
800
- V || c(t);
801
- },
802
- disabled: R,
803
- children: R ? /* @__PURE__ */ e(Ee, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ r(ke, { children: [
804
- V && /* @__PURE__ */ e(Pe, { className: "h-3.5 w-3.5" }),
805
- n.notGoing
806
- ] })
807
- }
808
- )
809
- ] }) }),
810
- P && y && !t.meetingTookPlace && !t.isCanceled && v && /* @__PURE__ */ e("div", { className: "border-t border-zinc-100 dark:border-zinc-800 py-3", children: /* @__PURE__ */ r(
811
- Me,
812
- {
813
- size: "sm",
814
- variant: "outline",
815
- className: "w-full h-9 hover:!bg-green-100 hover:text-green-700 text-green-700 !bg-green-100 !border-none dark:text-green-400 dark:hover:bg-green-950/30",
816
- onClick: () => v(t),
817
- disabled: I,
818
- children: [
819
- I && /* @__PURE__ */ e(Ee, { className: "h-4 w-4 mr-2" }),
820
- n.confirmMeeting
821
- ]
822
- }
823
- ) })
824
- ] }),
825
- M ? K && M({
826
- onConfirm: fe,
827
- onCancel: () => q(!1),
828
- isLoading: L
829
- }) : /* @__PURE__ */ e(
830
- tn,
831
- {
832
- open: K,
833
- onOpenChange: q,
834
- title: n.deleteConfirmTitle,
835
- description: n.deleteConfirmDescription,
836
- cancelLabel: n.cancel,
837
- confirmLabel: n.delete,
838
- onConfirm: fe,
839
- isLoading: L
840
- }
841
- )
842
- ] });
843
- }
844
- function Hr({
845
- event: t,
846
- children: n,
847
- open: a,
848
- onOpenChange: o,
849
- isLoading: s,
850
- labels: l,
851
- onEdit: p,
852
- onDelete: h,
853
- onCancel: c,
854
- onAccept: v,
855
- onDecline: H,
856
- onConfirmMeeting: b,
857
- canEdit: w = !0,
858
- canDelete: P = !1,
859
- canCancel: S = !0,
860
- isCurrentUserParticipant: $,
861
- isCurrentUserClient: F,
862
- currentUserAcceptStatus: R,
863
- isAcceptLoading: I,
864
- isDeclineLoading: L,
865
- isConfirmLoading: W,
866
- isDeleteLoading: z,
867
- renderParticipant: X,
868
- renderHeaderActions: M,
869
- renderCancelReason: _,
870
- renderDeleteConfirmation: A,
871
- formatDate: K,
872
- formatTimeRange: q,
873
- className: Y,
874
- width: g = 360
875
- }) {
876
- const C = an("(min-width: 768px)"), u = { ...Qt, ...l }, N = B(() => {
877
- o?.(!1);
878
- }, [o]), y = {
879
- event: t,
880
- labels: u,
881
- isLoading: s,
882
- onClose: N,
883
- onEdit: p,
884
- onDelete: h,
885
- onCancel: c,
886
- onAccept: v,
887
- onDecline: H,
888
- onConfirmMeeting: b,
889
- canEdit: w,
890
- canDelete: P,
891
- canCancel: S,
892
- isCurrentUserParticipant: $,
893
- isCurrentUserClient: F,
894
- currentUserAcceptStatus: R,
895
- isAcceptLoading: I,
896
- isDeclineLoading: L,
897
- isConfirmLoading: W,
898
- isDeleteLoading: z,
899
- renderParticipant: X,
900
- renderHeaderActions: M,
901
- renderCancelReason: _,
902
- renderDeleteConfirmation: A,
903
- formatDate: K,
904
- formatTimeRange: q
905
- };
906
- return C ? /* @__PURE__ */ r(ut, { open: a ?? !1, onOpenChange: o ?? (() => {
907
- }), children: [
908
- /* @__PURE__ */ e(ht, { asChild: !0, children: n }),
909
- /* @__PURE__ */ e(
910
- mt,
911
- {
912
- className: f(
913
- "p-0 shadow-lg !rounded-2xl bg-white dark:bg-zinc-900 overflow-hidden border z-50",
914
- Y
915
- ),
916
- style: { width: g },
917
- align: "center",
918
- side: "bottom",
919
- sideOffset: 4,
920
- children: /* @__PURE__ */ e(Je, { ...y })
921
- }
922
- )
923
- ] }) : /* @__PURE__ */ r(ke, { children: [
924
- n,
925
- /* @__PURE__ */ e(
926
- en,
927
- {
928
- open: a ?? !1,
929
- onOpenChange: o ?? (() => {
930
- }),
931
- title: t.title,
932
- children: /* @__PURE__ */ e(Je, { ...y })
933
- }
934
- )
935
- ] });
936
- }
937
- const Fe = 44, Xe = 4, sn = 56, Qe = 8, Ae = 80, Se = 140, Ze = 100, et = 2, ln = 8, cn = 18;
938
- function dn(t) {
939
- return t.split(" ").map((n) => n[0]).join("").toUpperCase().slice(0, 2);
940
- }
941
- function un(t, n) {
942
- const a = [];
943
- for (let o = 0; o < n; o++) {
944
- const s = new Date(t);
945
- s.setDate(s.getDate() + o), a.push(s);
946
- }
947
- return a;
948
- }
949
- function hn(t, n, a) {
950
- const o = [];
951
- return t.forEach((s, l) => {
952
- for (let p = n; p < a; p++)
953
- o.push({ hour: p, dayIndex: l, date: s });
954
- }), o;
955
- }
956
- function Oe(t) {
957
- return `${t.toString().padStart(2, "0")}:00`;
958
- }
959
- function mn(t) {
960
- return t.toLocaleDateString("en-US", {
961
- weekday: "short",
962
- month: "short",
963
- day: "numeric"
964
- });
965
- }
966
- function tt(t) {
967
- const n = [...t].sort((s, l) => s.startCol !== l.startCol ? s.startCol - l.startCol : l.spanCols - s.spanCols), a = [], o = [];
968
- for (const s of n) {
969
- let l = 0;
970
- for (; o[l] !== void 0 && o[l] > s.startCol; )
971
- l++;
972
- o[l] = s.startCol + s.spanCols, a.push({
973
- ...s,
974
- stackIndex: l
975
- });
976
- }
977
- return a;
978
- }
979
- function fn({ src: t, alt: n, fallback: a, className: o }) {
980
- return /* @__PURE__ */ e(
981
- "div",
982
- {
983
- className: f(
984
- "relative flex shrink-0 overflow-hidden rounded-sm border bg-muted",
985
- o
986
- ),
987
- children: t ? /* @__PURE__ */ e(
988
- "img",
989
- {
990
- src: t,
991
- alt: n,
992
- className: "aspect-square h-full w-full object-cover"
993
- }
994
- ) : /* @__PURE__ */ e("div", { className: "flex h-full w-full items-center justify-center bg-muted text-muted-foreground", children: a })
995
- }
996
- );
997
- }
998
- const gn = 18, pn = 10, xn = 32;
999
- function vn({ text: t, className: n }) {
1000
- const a = ae(null), o = ae(null), [s, l] = le({
1001
- active: !1,
1002
- durationSec: 0
1003
- });
1004
- return dt(() => {
1005
- const p = a.current, h = o.current;
1006
- if (!p || !h) return;
1007
- const c = () => {
1008
- const H = h.offsetWidth, b = p.clientWidth;
1009
- if (H > b + 1) {
1010
- const w = H + xn, P = Math.max(
1011
- pn,
1012
- w / gn
1013
- );
1014
- l(
1015
- (S) => S.active && Math.abs(S.durationSec - P) < 0.1 ? S : { active: !0, durationSec: P }
1016
- );
1017
- } else
1018
- l((w) => w.active ? { active: !1, durationSec: 0 } : w);
1019
- };
1020
- c();
1021
- const v = new ResizeObserver(c);
1022
- return v.observe(p), v.observe(h), () => v.disconnect();
1023
- }, [t]), /* @__PURE__ */ e(
1024
- "div",
1025
- {
1026
- ref: a,
1027
- className: f(
1028
- "ic-marquee relative min-w-0 overflow-hidden",
1029
- s.active && "ic-marquee--active",
1030
- n
1031
- ),
1032
- children: /* @__PURE__ */ r(
1033
- "div",
1034
- {
1035
- className: "ic-marquee-track inline-flex whitespace-nowrap will-change-transform",
1036
- style: s.active ? { animationDuration: `${s.durationSec}s` } : void 0,
1037
- children: [
1038
- /* @__PURE__ */ e("span", { ref: o, className: "ic-marquee-copy", children: t }),
1039
- s.active && /* @__PURE__ */ e("span", { "aria-hidden": "true", className: "ic-marquee-copy", children: t })
1040
- ]
1041
- }
1042
- )
1043
- }
1044
- );
1045
- }
1046
- const wn = 7;
1047
- function Te({
1048
- daysToShow: t = wn,
1049
- events: n,
1050
- users: a = [],
1051
- alwaysShowResources: o,
1052
- selectedDate: s,
1053
- onDateChange: l,
1054
- onEventClick: p,
1055
- onSlotClick: h,
1056
- onSlotSelect: c,
1057
- visibleHours: v,
1058
- className: H,
1059
- getEventUserId: b,
1060
- renderPopover: w,
1061
- slots: P,
1062
- classNames: S,
1063
- enableDrag: $ = !0,
1064
- resourceColumnConfig: F
1065
- }) {
1066
- const R = F?.variant ?? "marquee", I = F?.showAvatar ?? "auto", L = ae(null), W = At(), [z, X] = le(null), M = ae(!1), [_, A] = le(null), K = s ?? /* @__PURE__ */ new Date(), q = !0, Y = v?.from ?? ln, g = v?.to ?? cn, C = g - Y, u = re(() => {
1067
- const i = new Date(K);
1068
- if (t === 1 || t === 3)
1069
- return i.setHours(0, 0, 0, 0), i;
1070
- const d = i.getDay(), x = d === 0 ? -6 : 1 - d;
1071
- return i.setDate(i.getDate() + x), i.setHours(0, 0, 0, 0), i;
1072
- }, [K, t]), N = re(
1073
- () => un(u, t),
1074
- [u, t]
1075
- ), y = re(
1076
- () => hn(N, Y, g),
1077
- [q, N, Y, g]
1078
- ), O = b ?? ((i) => {
1079
- if (i.resourceId) return i.resourceId;
1080
- const d = i.data;
1081
- if (d?.userId) return String(d.userId);
1082
- if (d?.user && typeof d.user == "object" && d.user.id)
1083
- return String(d.user.id);
1084
- if (i.user?.id) return i.user.id;
1085
- if (i.participants?.[0]?.id) return i.participants[0].id;
1086
- }), G = re(() => {
1087
- const i = /* @__PURE__ */ new Map();
1088
- for (const d of a)
1089
- i.set(d.id, {
1090
- id: d.id,
1091
- name: d.name,
1092
- avatar: d.avatar ?? void 0,
1093
- email: d.email
1094
- });
1095
- for (const d of n) {
1096
- const k = d.data?.user;
1097
- k?.id && !i.has(k.id) && i.set(k.id, {
1098
- id: k.id,
1099
- name: k.name ?? "",
1100
- avatar: k.avatar ?? void 0,
1101
- email: k.email
1102
- }), d.user?.id && !i.has(d.user.id) && i.set(d.user.id, {
1103
- id: d.user.id,
1104
- name: d.user.name,
1105
- avatar: d.user.avatar ?? void 0,
1106
- email: d.user.email
1107
- });
1108
- for (const D of d.participants || [])
1109
- D.id && !i.has(D.id) && i.set(D.id, {
1110
- id: D.id,
1111
- name: D.name,
1112
- avatar: D.avatar ?? void 0,
1113
- email: D.email
1114
- });
1115
- }
1116
- return Array.from(i.values());
1117
- }, [a, n]), U = re(() => {
1118
- const i = [], d = /* @__PURE__ */ new Map();
1119
- for (const D of G)
1120
- d.set(D.id, []);
1121
- d.set("unassigned", []);
1122
- for (const D of n) {
1123
- const E = O(D) ?? "unassigned";
1124
- (d.get(E) ?? d.get("unassigned")).push(D);
1125
- }
1126
- const x = (D) => {
1127
- const E = [];
1128
- for (const T of D) {
1129
- const ne = T.startDate.getHours() + T.startDate.getMinutes() / 60, oe = T.endDate.getHours() + T.endDate.getMinutes() / 60;
1130
- for (let Q = 0; Q < N.length; Q++) {
1131
- const ie = N[Q], De = _e(ie), Ce = ft(ie);
1132
- if (T.startDate <= Ce && T.endDate >= De) {
1133
- let ye = Y, Le = g;
1134
- if (T.startDate >= De && (ye = Math.max(Y, ne)), T.endDate <= Ce && (Le = Math.min(g, oe)), ye = Math.max(
1135
- Y,
1136
- Math.min(g, ye)
1137
- ), Le = Math.max(
1138
- Y,
1139
- Math.min(g, Le)
1140
- ), Le > ye) {
1141
- const bt = Q * C + (ye - Y), yt = Le - ye;
1142
- E.push({
1143
- event: T,
1144
- startCol: bt,
1145
- spanCols: yt
1146
- });
1147
- }
1148
- }
1149
- }
1150
- }
1151
- return E;
1152
- };
1153
- for (const D of G) {
1154
- const E = d.get(D.id) ?? [], T = x(E), ne = tt(T), oe = ne.reduce(
1155
- (Q, ie) => Math.max(Q, ie.stackIndex + 1),
1156
- 0
1157
- );
1158
- i.push({
1159
- user: D,
1160
- events: ne,
1161
- maxStack: Math.max(oe, 1)
1162
- });
1163
- }
1164
- const k = d.get("unassigned") ?? [];
1165
- if (k.length > 0) {
1166
- const D = x(k), E = tt(D), T = E.reduce(
1167
- (ne, oe) => Math.max(ne, oe.stackIndex + 1),
1168
- 0
1169
- );
1170
- i.push({
1171
- user: {
1172
- id: "unassigned",
1173
- name: "Unassigned",
1174
- avatar: void 0,
1175
- email: void 0
1176
- },
1177
- events: E,
1178
- maxStack: Math.max(T, 1)
1179
- });
1180
- }
1181
- if (o?.length) {
1182
- const D = new Set(i.map((E) => E.user.id));
1183
- for (const E of o)
1184
- D.has(E.id) || (i.push({
1185
- user: {
1186
- id: E.id,
1187
- name: E.name,
1188
- avatar: E.avatar ?? void 0,
1189
- email: E.email
1190
- },
1191
- events: [],
1192
- maxStack: 1
1193
- }), D.add(E.id));
1194
- }
1195
- return i;
1196
- }, [
1197
- G,
1198
- n,
1199
- N,
1200
- q,
1201
- C,
1202
- Y,
1203
- g,
1204
- O,
1205
- o
1206
- ]), se = re(() => {
1207
- const i = /* @__PURE__ */ new Map();
1208
- for (const d of U)
1209
- for (const x of d.events)
1210
- if (x.spanCols <= 1) {
1211
- const k = Math.floor(x.startCol), D = i.get(k) ?? 0;
1212
- i.set(k, D + 1);
1213
- }
1214
- return i;
1215
- }, [U]), Z = re(() => {
1216
- const i = y.length, d = Ae, x = [];
1217
- for (let k = 0; k < i; k++) {
1218
- const D = se.get(k) ?? 0;
1219
- D > et ? x.push(
1220
- Ze + (D - et) * 20
1221
- ) : D > 0 ? x.push(Math.max(d, Ze)) : x.push(d);
1222
- }
1223
- return x;
1224
- }, [
1225
- q,
1226
- y.length,
1227
- N.length,
1228
- se
1229
- ]), me = (i) => Math.max(
1230
- sn,
1231
- i * (Fe + Xe) + Qe * 2
1232
- ), Ne = Se + Z.reduce((i, d) => i + d, 0), te = re(() => {
1233
- const i = [0];
1234
- for (let d = 0; d < Z.length; d++)
1235
- i.push(i[d] + Z[d]);
1236
- return i;
1237
- }, [Z]), ce = B(
1238
- (i) => {
1239
- const d = te.length - 1;
1240
- if (i <= 0) return te[0] ?? 0;
1241
- if (i >= d) return te[d] ?? 0;
1242
- const x = Math.floor(i), k = te[x] ?? 0, D = te[x + 1] ?? k;
1243
- return k + (i - x) * (D - k);
1244
- },
1245
- [te]
1246
- );
1247
- dt(() => {
1248
- const i = L.current;
1249
- if (!i) return;
1250
- const d = () => {
1251
- let x = -1;
1252
- const D = (/* @__PURE__ */ new Date()).getHours();
1253
- {
1254
- for (let E = 0; E < y.length; E++) {
1255
- const T = y[E];
1256
- if (T && ue(T.date) && T.hour <= D && T.hour + 1 > D) {
1257
- x = E;
1258
- break;
1259
- }
1260
- }
1261
- if (x === -1)
1262
- for (let E = 0; E < y.length; E++) {
1263
- const T = y[E];
1264
- if (T && ue(T.date)) {
1265
- x = E;
1266
- break;
1267
- }
1268
- }
1269
- }
1270
- if (x !== -1) {
1271
- const E = (te[x] ?? 0) + Se, T = i.clientWidth, ne = Math.max(0, E - T / 3);
1272
- i.scrollTo({
1273
- left: ne,
1274
- behavior: "instant"
1275
- });
1276
- }
1277
- };
1278
- requestAnimationFrame(() => {
1279
- requestAnimationFrame(d);
1280
- });
1281
- }, [K, y, N, te, q]);
1282
- const fe = B(
1283
- (i, d) => {
1284
- const x = d.getBoundingClientRect(), k = i - x.left + d.scrollLeft;
1285
- for (let D = 0; D < te.length - 1; D++) {
1286
- const E = te[D], T = te[D + 1];
1287
- if (k >= E && k < T) {
1288
- const ne = (k - E) / (T - E), oe = Math.floor(ne * 60), Q = Math.round(oe / 15) * 15;
1289
- return { colIndex: D, minute: Math.min(Q, 45) };
1290
- }
1291
- }
1292
- return null;
1293
- },
1294
- [te]
1295
- ), J = B(
1296
- (i, d) => {
1297
- if (y[i]) {
1298
- const x = y[i], k = new Date(x.date);
1299
- return k.setHours(x.hour, d ?? 0, 0, 0), { date: k, hour: x.hour };
1300
- }
1301
- return { date: /* @__PURE__ */ new Date() };
1302
- },
1303
- [q, y, N]
1304
- ), m = B(
1305
- (i, d) => {
1306
- if (i.preventDefault(), i.dataTransfer.dropEffect = "move", !W?.isDragging || !W.dragState) return;
1307
- const x = i.currentTarget, k = fe(i.clientX, x);
1308
- if (!k) return;
1309
- const { colIndex: D, minute: E } = k, { date: T, hour: ne } = J(D, E);
1310
- W.updateDragPreview(T, ne, E, d);
1311
- const { originalStartDate: oe, originalEndDate: Q } = W.dragState, ie = Q.getTime() - oe.getTime(), De = y.length;
1312
- let Ce;
1313
- {
1314
- const ye = ie / 36e5;
1315
- Ce = Math.max(1, Math.ceil(ye));
1316
- }
1317
- Ce = Math.min(Ce, De - D), A({ resourceId: d, colIndex: D, spanCols: Ce });
1318
- },
1319
- [W, fe, J, q, y.length, N.length]
1320
- ), j = B(
1321
- (i) => {
1322
- const d = i.relatedTarget;
1323
- i.currentTarget.contains(d) || A(null);
1324
- },
1325
- []
1326
- ), ee = B(
1327
- (i, d) => {
1328
- i.preventDefault(), A(null), W?.isDragging && W.endDrag();
1329
- },
1330
- [W]
1331
- ), de = B(
1332
- (i, d) => {
1333
- if (!z || z.resourceId !== i) return !1;
1334
- const x = Math.min(z.startCol, z.endCol), k = Math.max(z.startCol, z.endCol);
1335
- return d >= x && d <= k;
1336
- },
1337
- [z]
1338
- ), ze = B(
1339
- (i, d) => !_ || _.resourceId !== i ? !1 : d >= _.colIndex && d < _.colIndex + _.spanCols,
1340
- [_]
1341
- ), vt = B(
1342
- (i, d, x) => {
1343
- x.button !== 0 && x.pointerType === "mouse" || (c || h) && (x.preventDefault(), M.current = !0, X({ resourceId: i, startCol: d, endCol: d, isSelecting: !0 }));
1344
- },
1345
- [c, h]
1346
- ), wt = B(
1347
- (i, d, x) => {
1348
- if (M.current && !(!z || z.resourceId !== i)) {
1349
- if (x.buttons === 0) {
1350
- M.current = !1;
1351
- return;
1352
- }
1353
- X((k) => k ? { ...k, endCol: d } : null);
1354
- }
1355
- },
1356
- [z]
1357
- ), $e = B(() => {
1358
- if (!M.current || !z) return;
1359
- M.current = !1;
1360
- const i = Math.min(z.startCol, z.endCol), d = Math.max(z.startCol, z.endCol), x = J(i), k = J(d), D = new Date(x.date), E = new Date(k.date);
1361
- k.hour !== void 0 && E.setHours(k.hour + 1, 0, 0, 0);
1362
- const T = {
1363
- startDate: D,
1364
- endDate: E,
1365
- resourceId: z.resourceId
1366
- };
1367
- i === d && h && h(x.date, x.hour, z.resourceId), c?.(T), X((ne) => ne ? { ...ne, isSelecting: !1 } : null), setTimeout(() => X(null), 150);
1368
- }, [z, J, q, h, c]);
1369
- return he(() => {
1370
- const i = () => {
1371
- M.current && $e();
1372
- };
1373
- return window.addEventListener("pointerup", i), window.addEventListener("pointercancel", i), () => {
1374
- window.removeEventListener("pointerup", i), window.removeEventListener("pointercancel", i);
1375
- };
1376
- }, [$e]), he(() => {
1377
- W?.isDragging || A(null);
1378
- }, [W?.isDragging]), /* @__PURE__ */ e("div", { className: f("flex h-full flex-col", H), children: /* @__PURE__ */ e("div", { className: "ic-timeline-scroll-container flex-1", ref: L, children: /* @__PURE__ */ r("div", { className: "relative", style: { minWidth: Ne }, children: [
1379
- // Hour mode: Day headers + Hour sub-headers - sticky wrapper with flex child (sticky + flex breaks sticky)
1380
- /* @__PURE__ */ e("div", { className: "ic-timeline-header sticky top-0 z-20 border-b bg-background", children: t > 1 ? (
1381
- // Multi-day: Resources cell spans both day-header + hour-header rows
1382
- /* @__PURE__ */ r("div", { className: "flex", children: [
1383
- /* @__PURE__ */ e(
1384
- "div",
1385
- {
1386
- className: "flex shrink-0 items-center justify-center border-r bg-background px-2 sticky left-0 z-10",
1387
- style: { width: Se },
1388
- children: /* @__PURE__ */ e("span", { className: "text-[10px] font-medium uppercase text-muted-foreground", children: "Resources" })
1389
- }
1390
- ),
1391
- /* @__PURE__ */ r("div", { className: "flex min-w-0 flex-col", children: [
1392
- /* @__PURE__ */ e("div", { className: "flex border-b", children: N.map((i, d) => {
1393
- const x = ue(i), k = d * C, D = Z.slice(k, k + C).reduce((E, T) => E + T, 0);
1394
- return /* @__PURE__ */ e(
1395
- "div",
1396
- {
1397
- className: f(
1398
- "flex shrink-0 items-center justify-center border-r py-1.5 font-medium",
1399
- x ? "bg-primary/10 text-primary" : "bg-muted/30"
1400
- ),
1401
- style: { width: D },
1402
- children: /* @__PURE__ */ e("span", { className: "text-xs", children: mn(i) })
1403
- },
1404
- `day-${i.toISOString()}`
1405
- );
1406
- }) }),
1407
- /* @__PURE__ */ e("div", { className: "flex", children: y.map((i, d) => {
1408
- const x = i.hour === Y, k = ue(i.date), D = Z[d] ?? Ae;
1409
- return /* @__PURE__ */ e(
1410
- "div",
1411
- {
1412
- className: f(
1413
- "flex shrink-0 items-center justify-center py-1.5 text-[10px] text-muted-foreground",
1414
- x && d > 0 ? "border-l-2 border-l-border" : "border-r border-r-border/50",
1415
- k && "bg-primary/5"
1416
- ),
1417
- style: { width: D },
1418
- children: Oe(i.hour)
1419
- },
1420
- `hour-${i.dayIndex}-${i.hour}`
1421
- );
1422
- }) })
1423
- ] })
1424
- ] })
1425
- ) : (
1426
- // Single-day: simple single row
1427
- /* @__PURE__ */ r("div", { className: "flex", children: [
1428
- /* @__PURE__ */ e(
1429
- "div",
1430
- {
1431
- className: "flex shrink-0 items-center border-r bg-background px-2 py-2",
1432
- style: { width: Se },
1433
- children: /* @__PURE__ */ e("span", { className: "text-[10px] font-medium uppercase text-muted-foreground", children: "Resources" })
1434
- }
1435
- ),
1436
- y.map((i, d) => {
1437
- const x = i.hour === Y, k = ue(i.date), D = Z[d] ?? Ae;
1438
- return /* @__PURE__ */ e(
1439
- "div",
1440
- {
1441
- className: f(
1442
- "flex shrink-0 items-center justify-center py-1.5 text-[10px] text-muted-foreground",
1443
- x && d > 0 ? "border-l-2 border-l-border" : "border-r border-r-border/50",
1444
- k && "bg-primary/5"
1445
- ),
1446
- style: { width: D },
1447
- children: Oe(i.hour)
1448
- },
1449
- `hour-${i.dayIndex}-${i.hour}`
1450
- );
1451
- })
1452
- ] })
1453
- ) }),
1454
- U.map((i) => {
1455
- const d = me(i.maxStack);
1456
- return /* @__PURE__ */ r(
1457
- "div",
1458
- {
1459
- className: f(
1460
- "relative flex border-b",
1461
- S?.resourceRow
1462
- ),
1463
- style: { height: d },
1464
- children: [
1465
- /* @__PURE__ */ e(
1466
- "div",
1467
- {
1468
- className: "sticky left-0 z-10",
1469
- style: { width: Se },
1470
- children: /* @__PURE__ */ r(
1471
- "div",
1472
- {
1473
- className: f(
1474
- "flex h-full items-center gap-2 sm:gap-3 border-r bg-background px-2 sm:px-4",
1475
- S?.resourceHeader
1476
- ),
1477
- children: [
1478
- (() => {
1479
- const x = !!i.user.avatar;
1480
- return I === !0 || I === "auto" && x ? /* @__PURE__ */ e(
1481
- fn,
1482
- {
1483
- className: "size-7",
1484
- src: i.user.avatar,
1485
- alt: i.user.name,
1486
- fallback: dn(i.user.name)
1487
- }
1488
- ) : null;
1489
- })(),
1490
- R === "marquee" ? /* @__PURE__ */ e(
1491
- vn,
1492
- {
1493
- text: i.user.name,
1494
- className: "flex-1 text-xs sm:text-sm font-medium"
1495
- }
1496
- ) : /* @__PURE__ */ e("span", { className: "min-w-0 flex-1 truncate text-xs sm:text-sm font-medium", children: i.user.name })
1497
- ]
1498
- }
1499
- )
1500
- }
1501
- ),
1502
- /* @__PURE__ */ r(
1503
- "div",
1504
- {
1505
- className: "ic-timeline-grid relative flex",
1506
- onDragOver: (x) => m(x, i.user.id),
1507
- onDragLeave: j,
1508
- onDrop: (x) => ee(x, i.user.id),
1509
- children: [
1510
- // Hour mode cells — interactive buttons for slot selection
1511
- y.map((x, k) => {
1512
- const D = x.hour === Y && k > 0, E = Z[k] ?? Ae, T = de(i.user.id, k), ne = ze(i.user.id, k), oe = !!(c || h);
1513
- return /* @__PURE__ */ e(
1514
- "div",
1515
- {
1516
- role: oe ? "button" : void 0,
1517
- tabIndex: oe ? 0 : void 0,
1518
- "aria-label": oe ? `Select ${Oe(x.hour)} on ${x.date.toLocaleDateString()} for ${i.user.name}` : void 0,
1519
- onPointerDown: (Q) => vt(i.user.id, k, Q),
1520
- onPointerEnter: (Q) => wt(i.user.id, k, Q),
1521
- onPointerUp: $e,
1522
- onKeyDown: (Q) => {
1523
- if (oe && (Q.key === "Enter" || Q.key === " ")) {
1524
- Q.preventDefault();
1525
- const ie = J(k);
1526
- h?.(ie.date, ie.hour, i.user.id), c?.({
1527
- startDate: ie.date,
1528
- endDate: (() => {
1529
- const De = new Date(ie.date);
1530
- return ie.hour !== void 0 && De.setHours(ie.hour + 1, 0, 0, 0), De;
1531
- })(),
1532
- resourceId: i.user.id
1533
- });
1534
- }
1535
- },
1536
- className: f(
1537
- "shrink-0 select-none touch-none transition-colors",
1538
- oe && "cursor-pointer",
1539
- D ? "border-l-2 border-l-border" : "border-r border-r-border/50",
1540
- ue(x.date) && "bg-primary/5",
1541
- // Hover — subtle feedback (only when not selecting or dragging)
1542
- oe && !z?.isSelecting && !W?.isDragging && "hover:bg-blue-50/60",
1543
- // Slot selection highlight
1544
- T && "bg-blue-100/70",
1545
- // Drop target highlight
1546
- ne && "bg-primary/20 ring-2 ring-primary ring-inset"
1547
- ),
1548
- style: { width: E }
1549
- },
1550
- `cell-${x.dayIndex}-${x.hour}`
1551
- );
1552
- }),
1553
- i.events.map((x) => {
1554
- const k = ce(x.startCol), D = ce(x.startCol + x.spanCols), E = k + 2, T = D - k - 4, ne = Qe + x.stackIndex * (Fe + Xe), oe = t === 1 ? "timeline-day" : t === 3 ? "timeline-3day" : "timeline-week", Q = P?.eventCard;
1555
- return /* @__PURE__ */ e(
1556
- "div",
1557
- {
1558
- className: "absolute",
1559
- style: {
1560
- left: E,
1561
- width: Math.max(T, 0),
1562
- // No forced minimum - columns are guaranteed wide enough
1563
- top: ne,
1564
- height: Fe
1565
- },
1566
- children: Q ? /* @__PURE__ */ e(
1567
- Q,
1568
- {
1569
- event: x.event,
1570
- view: oe,
1571
- isCompact: !0,
1572
- onClick: () => p?.(x.event)
1573
- }
1574
- ) : /* @__PURE__ */ e(
1575
- Lt,
1576
- {
1577
- event: x.event,
1578
- variant: "compact",
1579
- enableDrag: $,
1580
- onClick: p,
1581
- renderPopover: w,
1582
- className: f(
1583
- "h-full w-full",
1584
- S?.eventCardCompact
1585
- )
1586
- }
1587
- )
1588
- },
1589
- x.event.id
1590
- );
1591
- })
1592
- ]
1593
- }
1594
- )
1595
- ]
1596
- },
1597
- i.user.id
1598
- );
1599
- }),
1600
- U.length === 0 && /* @__PURE__ */ e("div", { className: "flex items-center justify-center py-20 text-muted-foreground", children: "No users or events to display" })
1601
- ] }) }) });
1602
- }
1603
- const bn = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], yn = [
1604
- "January",
1605
- "February",
1606
- "March",
1607
- "April",
1608
- "May",
1609
- "June",
1610
- "July",
1611
- "August",
1612
- "September",
1613
- "October",
1614
- "November",
1615
- "December"
1616
- ];
1617
- function nt(t) {
1618
- const n = t.hexColor;
1619
- return n ? { backgroundColor: n } : {};
1620
- }
1621
- function kn({ day: t, date: n, events: a, isCurrentMonth: o, onDayClick: s }) {
1622
- const l = ue(n), p = 3, h = a.length;
1623
- return /* @__PURE__ */ r(
1624
- "button",
1625
- {
1626
- type: "button",
1627
- onClick: () => s?.(n),
1628
- className: f(
1629
- "flex h-9 sm:h-11 flex-1 flex-col items-center justify-start gap-0.5 rounded-md pt-0.5 sm:pt-1",
1630
- "hover:bg-accent focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",
1631
- "transition-colors",
1632
- !o && "opacity-40"
1633
- ),
1634
- children: [
1635
- /* @__PURE__ */ e(
1636
- "div",
1637
- {
1638
- className: f(
1639
- "flex size-5 sm:size-6 items-center justify-center rounded-full text-[10px] sm:text-xs font-medium",
1640
- l && "bg-primary font-semibold text-primary-foreground"
1641
- ),
1642
- children: t
1643
- }
1644
- ),
1645
- h > 0 && /* @__PURE__ */ e("div", { className: "mt-0.5 flex items-center gap-0.5", children: h <= p ? a.map((c) => /* @__PURE__ */ e(
1646
- "div",
1647
- {
1648
- className: "size-1 sm:size-1.5 rounded-full bg-primary",
1649
- style: nt(c)
1650
- },
1651
- c.id
1652
- )) : /* @__PURE__ */ r(ke, { children: [
1653
- a.slice(0, p).map((c) => /* @__PURE__ */ e(
1654
- "div",
1655
- {
1656
- className: "size-1 sm:size-1.5 rounded-full bg-primary",
1657
- style: nt(c)
1658
- },
1659
- c.id
1660
- )),
1661
- /* @__PURE__ */ r("span", { className: "text-[6px] sm:text-[7px] font-medium text-muted-foreground", children: [
1662
- "+",
1663
- h - p
1664
- ] })
1665
- ] }) })
1666
- ]
1667
- }
1668
- );
1669
- }
1670
- function Nn({
1671
- date: t,
1672
- events: n,
1673
- onMonthClick: a,
1674
- onDayClick: o
1675
- }) {
1676
- const s = re(() => Ft(t, 0), [t]);
1677
- return /* @__PURE__ */ r("div", { className: "flex flex-col", children: [
1678
- /* @__PURE__ */ e(
1679
- "button",
1680
- {
1681
- type: "button",
1682
- onClick: () => a?.(t),
1683
- className: f(
1684
- "w-full rounded-t-lg border px-2 sm:px-3 py-1.5 sm:py-2 text-xs sm:text-sm font-semibold",
1685
- "hover:bg-accent focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",
1686
- "transition-colors"
1687
- ),
1688
- children: yn[t.getMonth()]
1689
- }
1690
- ),
1691
- /* @__PURE__ */ r("div", { className: "flex-1 space-y-1.5 sm:space-y-2 rounded-b-lg border border-t-0 p-2 sm:p-3", children: [
1692
- /* @__PURE__ */ e("div", { className: "grid grid-cols-7 gap-x-0.5 text-center", children: bn.map((l, p) => /* @__PURE__ */ r("div", { className: "text-[9px] sm:text-xs font-medium text-muted-foreground", children: [
1693
- /* @__PURE__ */ e("span", { className: "sm:hidden", children: l[0] }),
1694
- /* @__PURE__ */ e("span", { className: "hidden sm:inline", children: l })
1695
- ] }, p)) }),
1696
- /* @__PURE__ */ e("div", { className: "grid grid-cols-7 gap-x-0.5 gap-y-1", children: s.map((l, p) => {
1697
- const h = Ot(n, l.date);
1698
- return /* @__PURE__ */ e(
1699
- kn,
1700
- {
1701
- day: l.date.getDate(),
1702
- date: l.date,
1703
- events: h,
1704
- isCurrentMonth: l.isCurrentMonth,
1705
- onDayClick: o
1706
- },
1707
- `${p + 1}-${l.date.toISOString()}`
1708
- );
1709
- }) })
1710
- ] })
1711
- ] });
1712
- }
1713
- function Dn({
1714
- events: t,
1715
- year: n,
1716
- onMonthClick: a,
1717
- onDayClick: o,
1718
- className: s,
1719
- slots: l,
1720
- classNames: p
1721
- }) {
1722
- const h = re(() => $t(n), [n]);
1723
- return /* @__PURE__ */ r("div", { className: f("flex flex-col h-full", s), children: [
1724
- /* @__PURE__ */ e("div", { className: "flex items-center justify-center border-b px-4 py-3", children: /* @__PURE__ */ e("h2", { className: "text-lg font-semibold", children: n }) }),
1725
- /* @__PURE__ */ e("div", { className: "flex-1 overflow-auto p-4", children: /* @__PURE__ */ e("div", { className: "grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4", children: h.map((c) => /* @__PURE__ */ e(
1726
- Nn,
1727
- {
1728
- date: c,
1729
- events: t,
1730
- onMonthClick: a,
1731
- onDayClick: o
1732
- },
1733
- c.getMonth()
1734
- )) }) })
1735
- ] });
1736
- }
1737
- const je = 200, Cn = 60, Mn = 300, En = 7, rt = 2, Be = 40, Ln = 18;
1738
- function Sn() {
1739
- return /* @__PURE__ */ e(
1740
- "svg",
1741
- {
1742
- width: "12",
1743
- height: "12",
1744
- viewBox: "0 0 24 24",
1745
- fill: "none",
1746
- stroke: "currentColor",
1747
- strokeWidth: "2.5",
1748
- strokeLinecap: "round",
1749
- strokeLinejoin: "round",
1750
- "aria-hidden": "true",
1751
- children: /* @__PURE__ */ e("path", { d: "m18 15-6-6-6 6" })
1752
- }
1753
- );
1754
- }
1755
- function Tn() {
1756
- return /* @__PURE__ */ e(
1757
- "svg",
1758
- {
1759
- width: "12",
1760
- height: "12",
1761
- viewBox: "0 0 24 24",
1762
- fill: "none",
1763
- stroke: "currentColor",
1764
- strokeWidth: "2.5",
1765
- strokeLinecap: "round",
1766
- strokeLinejoin: "round",
1767
- "aria-hidden": "true",
1768
- children: /* @__PURE__ */ e("path", { d: "m6 9 6 6 6-6" })
1769
- }
1770
- );
1771
- }
1772
- function In() {
1773
- return /* @__PURE__ */ e(
1774
- "svg",
1775
- {
1776
- width: "12",
1777
- height: "12",
1778
- viewBox: "0 0 24 24",
1779
- fill: "none",
1780
- stroke: "currentColor",
1781
- strokeWidth: "2.5",
1782
- strokeLinecap: "round",
1783
- strokeLinejoin: "round",
1784
- "aria-hidden": "true",
1785
- children: /* @__PURE__ */ e("path", { d: "m15 18-6-6 6-6" })
1786
- }
1787
- );
1788
- }
1789
- function Hn() {
1790
- return /* @__PURE__ */ e(
1791
- "svg",
1792
- {
1793
- width: "12",
1794
- height: "12",
1795
- viewBox: "0 0 24 24",
1796
- fill: "none",
1797
- stroke: "currentColor",
1798
- strokeWidth: "2.5",
1799
- strokeLinecap: "round",
1800
- strokeLinejoin: "round",
1801
- "aria-hidden": "true",
1802
- children: /* @__PURE__ */ e("path", { d: "m9 18 6-6-6-6" })
1803
- }
1804
- );
1805
- }
1806
- function zn({
1807
- containerRef: t,
1808
- currentDate: n,
1809
- className: a
1810
- }) {
1811
- const [o, s] = le({
1812
- canUp: !1,
1813
- canDown: !1,
1814
- canLeft: !1,
1815
- canRight: !1
1816
- }), [l, p] = le({ x: 0, y: 0 }), [h, c] = le(!1), v = o.canUp || o.canDown || o.canLeft || o.canRight, H = ae(null), b = ae(null), w = ae(null), P = ae(!1), S = ae({ x: 0, y: 0 }), $ = ae({ x: 0, y: 0 }), F = ae(0), R = ae(null), I = B(() => {
1817
- const u = t.current;
1818
- if (!u) return;
1819
- const N = 4;
1820
- s({
1821
- canUp: u.scrollTop > N,
1822
- canDown: u.scrollTop + u.clientHeight < u.scrollHeight - N,
1823
- canLeft: u.scrollLeft > N,
1824
- canRight: u.scrollLeft + u.clientWidth < u.scrollWidth - N
1825
- });
1826
- }, [t]);
1827
- he(() => {
1828
- const u = t.current;
1829
- if (!u) return;
1830
- I(), u.addEventListener("scroll", I, { passive: !0 });
1831
- const N = new ResizeObserver(I);
1832
- N.observe(u);
1833
- const y = new MutationObserver(I);
1834
- return y.observe(u, { childList: !0, subtree: !0 }), () => {
1835
- u.removeEventListener("scroll", I), N.disconnect(), y.disconnect();
1836
- };
1837
- }, [t, I]);
1838
- const L = B(
1839
- (u, N) => {
1840
- t.current?.scrollBy({ left: u, top: N, behavior: "smooth" });
1841
- },
1842
- [t]
1843
- ), W = B(() => L(0, -je), [L]), z = B(() => L(0, je), [L]), X = B(() => L(-je, 0), [L]), M = B(() => L(je, 0), [L]), _ = B(() => {
1844
- H.current && (clearTimeout(H.current), H.current = null), b.current && (clearInterval(b.current), b.current = null);
1845
- }, []), A = B((u) => {
1846
- u(), H.current = setTimeout(() => {
1847
- b.current = setInterval(u, Cn);
1848
- }, Mn);
1849
- }, []);
1850
- he(() => _, [_]), he(() => {
1851
- const u = t.current;
1852
- if (!u) return;
1853
- const N = (y) => {
1854
- if (y.ctrlKey || y.metaKey || y.altKey) return;
1855
- const V = y.target.tagName;
1856
- if (!(V === "INPUT" || V === "TEXTAREA" || y.target.isContentEditable))
1857
- switch (y.key) {
1858
- case "ArrowUp":
1859
- y.preventDefault(), W();
1860
- break;
1861
- case "ArrowDown":
1862
- y.preventDefault(), z();
1863
- break;
1864
- case "ArrowLeft":
1865
- y.preventDefault(), X();
1866
- break;
1867
- case "ArrowRight":
1868
- y.preventDefault(), M();
1869
- break;
1870
- }
1871
- };
1872
- return u.addEventListener("keydown", N), () => u.removeEventListener("keydown", N);
1873
- }, [t, W, z, X, M]), he(() => {
1874
- if (!v) return;
1875
- const u = R.current;
1876
- if (!u) return;
1877
- let N = 0;
1878
- const y = () => {
1879
- const U = u.offsetParent;
1880
- if (!U) return;
1881
- const se = U.getBoundingClientRect(), Z = window.innerHeight;
1882
- if (se.height <= Z) {
1883
- u.style.removeProperty("top"), u.style.removeProperty("bottom");
1884
- return;
1885
- }
1886
- const Ne = Math.min(se.bottom, Z) - se.top, te = u.offsetHeight, ce = Ne - te - 12, fe = 12, J = U.clientHeight - te - 12, m = Math.max(fe, Math.min(ce, J));
1887
- u.style.top = `${m}px`, u.style.bottom = "auto";
1888
- }, V = () => {
1889
- cancelAnimationFrame(N), N = requestAnimationFrame(y);
1890
- }, O = [window];
1891
- let G = u.parentElement;
1892
- for (; G; ) {
1893
- const U = getComputedStyle(G);
1894
- /(auto|scroll)/.test(U.overflow + U.overflowY) && O.push(G), G = G.parentElement;
1895
- }
1896
- for (const U of O)
1897
- U.addEventListener("scroll", V, { passive: !0 });
1898
- return window.addEventListener("resize", V, { passive: !0 }), y(), () => {
1899
- cancelAnimationFrame(N);
1900
- for (const U of O)
1901
- U.removeEventListener("scroll", V);
1902
- window.removeEventListener("resize", V);
1903
- };
1904
- }, [v]);
1905
- const K = B(() => {
1906
- P.current = !1, c(!1), p({ x: 0, y: 0 }), $.current = { x: 0, y: 0 }, F.current && cancelAnimationFrame(F.current);
1907
- }, []), q = B(
1908
- (u) => {
1909
- u.preventDefault(), P.current = !0, c(!0), S.current = { x: u.clientX, y: u.clientY }, $.current = { x: 0, y: 0 }, u.target.setPointerCapture(u.pointerId);
1910
- const N = () => {
1911
- if (!P.current) return;
1912
- const y = t.current;
1913
- if (y) {
1914
- const { x: V, y: O } = $.current, G = Math.sqrt(V * V + O * O);
1915
- if (G > rt) {
1916
- const se = Math.min(G / Be, 1) * Ln;
1917
- y.scrollLeft += V / G * se, y.scrollTop += O / G * se;
1918
- }
1919
- }
1920
- F.current = requestAnimationFrame(N);
1921
- };
1922
- F.current = requestAnimationFrame(N);
1923
- },
1924
- [t]
1925
- ), Y = B((u) => {
1926
- if (!P.current) return;
1927
- const N = u.clientX - S.current.x, y = u.clientY - S.current.y;
1928
- $.current = { x: N, y };
1929
- const V = Math.sqrt(N * N + y * y);
1930
- if (V < rt)
1931
- p({ x: 0, y: 0 });
1932
- else {
1933
- const G = Math.min(V, Be) / Be * En;
1934
- p({
1935
- x: N / V * G,
1936
- y: y / V * G
1937
- });
1938
- }
1939
- }, []), g = B(
1940
- (u) => {
1941
- switch (u.key) {
1942
- case "ArrowUp":
1943
- u.preventDefault(), W();
1944
- break;
1945
- case "ArrowDown":
1946
- u.preventDefault(), z();
1947
- break;
1948
- case "ArrowLeft":
1949
- u.preventDefault(), X();
1950
- break;
1951
- case "ArrowRight":
1952
- u.preventDefault(), M();
1953
- break;
1954
- }
1955
- },
1956
- [W, z, X, M]
1957
- );
1958
- if (!v) return null;
1959
- const C = n ? n.toLocaleDateString(void 0, {
1960
- weekday: "short",
1961
- month: "short",
1962
- day: "numeric"
1963
- }) : null;
1964
- return /* @__PURE__ */ r(
1965
- "div",
1966
- {
1967
- ref: R,
1968
- className: `inno-scroll-nav-wrapper ${a ?? ""}`,
1969
- role: "toolbar",
1970
- "aria-label": "Scroll navigation",
1971
- onKeyDown: g,
1972
- children: [
1973
- C && /* @__PURE__ */ e("div", { className: "inno-scroll-nav-date", "aria-live": "polite", children: C }),
1974
- /* @__PURE__ */ r("div", { className: "inno-scroll-nav", children: [
1975
- /* @__PURE__ */ e(
1976
- "button",
1977
- {
1978
- type: "button",
1979
- className: `inno-scroll-nav-btn inno-scroll-nav-up ${o.canUp ? "" : "inno-scroll-nav-btn-disabled"}`,
1980
- "aria-label": "Scroll up",
1981
- disabled: !o.canUp,
1982
- onPointerDown: () => A(W),
1983
- onPointerUp: _,
1984
- onPointerLeave: _,
1985
- tabIndex: o.canUp ? 0 : -1,
1986
- children: /* @__PURE__ */ e(Sn, {})
1987
- }
1988
- ),
1989
- /* @__PURE__ */ e(
1990
- "button",
1991
- {
1992
- type: "button",
1993
- className: `inno-scroll-nav-btn inno-scroll-nav-left ${o.canLeft ? "" : "inno-scroll-nav-btn-disabled"}`,
1994
- "aria-label": "Scroll left",
1995
- disabled: !o.canLeft,
1996
- onPointerDown: () => A(X),
1997
- onPointerUp: _,
1998
- onPointerLeave: _,
1999
- tabIndex: o.canLeft ? 0 : -1,
2000
- children: /* @__PURE__ */ e(In, {})
2001
- }
2002
- ),
2003
- /* @__PURE__ */ e(
2004
- "button",
2005
- {
2006
- ref: w,
2007
- type: "button",
2008
- className: `inno-scroll-nav-joystick ${h ? "inno-scroll-nav-joystick-active" : ""}`,
2009
- "aria-label": "Drag to scroll freely",
2010
- onPointerDown: q,
2011
- onPointerMove: Y,
2012
- onPointerUp: K,
2013
- onPointerCancel: K,
2014
- tabIndex: 0,
2015
- children: /* @__PURE__ */ e(
2016
- "span",
2017
- {
2018
- className: "inno-scroll-nav-joystick-dot",
2019
- style: {
2020
- transform: `translate(${l.x}px, ${l.y}px)`
2021
- }
2022
- }
2023
- )
2024
- }
2025
- ),
2026
- /* @__PURE__ */ e(
2027
- "button",
2028
- {
2029
- type: "button",
2030
- className: `inno-scroll-nav-btn inno-scroll-nav-right ${o.canRight ? "" : "inno-scroll-nav-btn-disabled"}`,
2031
- "aria-label": "Scroll right",
2032
- disabled: !o.canRight,
2033
- onPointerDown: () => A(M),
2034
- onPointerUp: _,
2035
- onPointerLeave: _,
2036
- tabIndex: o.canRight ? 0 : -1,
2037
- children: /* @__PURE__ */ e(Hn, {})
2038
- }
2039
- ),
2040
- /* @__PURE__ */ e(
2041
- "button",
2042
- {
2043
- type: "button",
2044
- className: `inno-scroll-nav-btn inno-scroll-nav-down ${o.canDown ? "" : "inno-scroll-nav-btn-disabled"}`,
2045
- "aria-label": "Scroll down",
2046
- disabled: !o.canDown,
2047
- onPointerDown: () => A(z),
2048
- onPointerUp: _,
2049
- onPointerLeave: _,
2050
- tabIndex: o.canDown ? 0 : -1,
2051
- children: /* @__PURE__ */ e(Tn, {})
2052
- }
2053
- )
2054
- ] })
2055
- ]
2056
- }
2057
- );
2058
- }
2059
- function An(t) {
2060
- switch (t) {
2061
- case "day":
2062
- case "week":
2063
- return "time";
2064
- default:
2065
- return "day";
2066
- }
2067
- }
2068
- function jn({
2069
- onEventClick: t,
2070
- onSlotClick: n,
2071
- onSlotSelect: a,
2072
- onAddEvent: o,
2073
- alwaysShowResources: s,
2074
- className: l,
2075
- showHeader: p = !0,
2076
- minSelectionMinutes: h = 30,
2077
- showMoreMode: c,
2078
- showMoreEventsInPopover: v = !1,
2079
- isLoading: H = !1,
2080
- slots: b,
2081
- classNames: w,
2082
- settingsContent: P,
2083
- filterContent: S,
2084
- headerActions: $,
2085
- renderPopover: F,
2086
- calendarRef: R,
2087
- headerConfig: I,
2088
- resourceColumnConfig: L,
2089
- eventDetailMode: W,
2090
- renderEventDetail: z
2091
- }) {
2092
- const X = c ?? (v ? "popover" : "expand"), {
2093
- view: M,
2094
- setView: _,
2095
- selectedDate: A,
2096
- setSelectedDate: K,
2097
- slotDuration: q,
2098
- filteredEvents: Y,
2099
- users: g,
2100
- visibleHours: C,
2101
- workingHours: u,
2102
- badgeVariant: N,
2103
- showWorkingHoursOnly: y,
2104
- clearFocusEventId: V
2105
- } = Wt(), O = re(() => {
2106
- if (!y || !u)
2107
- return {
2108
- startHour: C.start,
2109
- endHour: C.end
2110
- };
2111
- let m = 24, j = 0;
2112
- for (const ee of Object.keys(u)) {
2113
- const de = u[Number(ee)];
2114
- !de || de.enabled === !1 || (de.from < m && (m = de.from), de.to > j && (j = de.to));
2115
- }
2116
- return m >= j ? {
2117
- startHour: C.start,
2118
- endHour: C.end
2119
- } : { startHour: m, endHour: j };
2120
- }, [y, u, C]), G = O, U = ae(null);
2121
- Dt(
2122
- R,
2123
- () => ({
2124
- scrollToToday: () => {
2125
- const m = /* @__PURE__ */ new Date();
2126
- K(m, M), requestAnimationFrame(() => {
2127
- requestAnimationFrame(() => {
2128
- const j = U.current?.querySelector(
2129
- ".ic-timeline-scroll-container, [class*='overflow-auto']"
2130
- );
2131
- if (!j) return;
2132
- const ze = (m.getHours() - O.startHour) * 96;
2133
- ze > 0 && j.scrollTo({
2134
- top: Math.max(0, ze - 100),
2135
- // Offset to show some context
2136
- behavior: "smooth"
2137
- });
2138
- });
2139
- });
2140
- },
2141
- scrollToWorkingHours: () => {
2142
- let m = 8;
2143
- if (u)
2144
- for (const j of Object.keys(u)) {
2145
- const ee = u[Number(j)];
2146
- ee?.enabled && ee.from < m && (m = Math.max(ee.from - 1, 0));
2147
- }
2148
- requestAnimationFrame(() => {
2149
- requestAnimationFrame(() => {
2150
- const j = U.current?.querySelector(
2151
- ".ic-timeline-scroll-container, [class*='overflow-auto']"
2152
- );
2153
- if (!j) return;
2154
- const de = (m - O.startHour) * 96;
2155
- j.scrollTo({
2156
- top: Math.max(0, de),
2157
- behavior: "smooth"
2158
- });
2159
- });
2160
- });
2161
- },
2162
- getViewRect: () => U.current?.getBoundingClientRect() ?? null,
2163
- focusEvent: (m) => {
2164
- V(), requestAnimationFrame(() => {
2165
- V();
2166
- });
2167
- const j = U.current?.querySelector(
2168
- `[data-event-id="${m}"]`
2169
- );
2170
- j && setTimeout(() => j.click(), 150);
2171
- }
2172
- }),
2173
- [
2174
- K,
2175
- M,
2176
- O,
2177
- u,
2178
- V
2179
- ]
2180
- );
2181
- const se = re(() => An(M), [M]), Z = B(
2182
- (m) => {
2183
- if (a) {
2184
- a(m);
2185
- return;
2186
- }
2187
- if (n) {
2188
- const j = m.startDate.getHours();
2189
- n(m.startDate, j);
2190
- }
2191
- },
2192
- [a, n]
2193
- ), me = B(
2194
- (m) => {
2195
- _("day"), K(m, "day");
2196
- },
2197
- [K, _]
2198
- ), Ne = B(
2199
- (m) => {
2200
- _("month"), K(m, "month");
2201
- },
2202
- [K, _]
2203
- ), te = B(
2204
- (m) => {
2205
- t?.(m);
2206
- },
2207
- [t]
2208
- ), ce = B(
2209
- (m, j, ee) => {
2210
- n?.(m, j);
2211
- },
2212
- [n]
2213
- ), fe = () => {
2214
- const m = Y, j = te, ee = F;
2215
- switch (M) {
2216
- case "day":
2217
- return /* @__PURE__ */ e(
2218
- Ht,
2219
- {
2220
- events: m,
2221
- date: A,
2222
- visibleHours: G,
2223
- workingHours: u,
2224
- slotDuration: q,
2225
- badgeVariant: N,
2226
- onEventClick: j,
2227
- renderPopover: ee,
2228
- ...b && { slots: b },
2229
- ...w && { classNames: w }
2230
- }
2231
- );
2232
- case "week":
2233
- return /* @__PURE__ */ e(
2234
- It,
2235
- {
2236
- events: m,
2237
- date: A,
2238
- visibleHours: G,
2239
- workingHours: u,
2240
- slotDuration: q,
2241
- badgeVariant: N,
2242
- onEventClick: j,
2243
- renderPopover: ee,
2244
- ...b && { slots: b },
2245
- ...w && { classNames: w }
2246
- }
2247
- );
2248
- case "month":
2249
- return /* @__PURE__ */ e(
2250
- Ke,
2251
- {
2252
- events: m,
2253
- date: A,
2254
- badgeVariant: N,
2255
- onEventClick: j,
2256
- onDayClick: me,
2257
- renderPopover: ee,
2258
- showMoreMode: X,
2259
- ...b && { slots: b },
2260
- ...w && { classNames: w }
2261
- }
2262
- );
2263
- case "year":
2264
- return /* @__PURE__ */ e(
2265
- Dn,
2266
- {
2267
- events: m,
2268
- year: A.getFullYear(),
2269
- onMonthClick: Ne,
2270
- onDayClick: me,
2271
- ...b && { slots: b },
2272
- ...w && { classNames: w }
2273
- }
2274
- );
2275
- case "agenda":
2276
- return /* @__PURE__ */ e(
2277
- Tt,
2278
- {
2279
- events: m,
2280
- date: A,
2281
- onEventClick: j,
2282
- renderPopover: ee,
2283
- ...b && { slots: b },
2284
- ...w && { classNames: w }
2285
- }
2286
- );
2287
- // Resource views — delegate to TimelineView with matching day count
2288
- case "resource-day":
2289
- return /* @__PURE__ */ e(
2290
- Te,
2291
- {
2292
- daysToShow: 1,
2293
- events: m,
2294
- users: g,
2295
- ...s && { alwaysShowResources: s },
2296
- selectedDate: A,
2297
- visibleHours: {
2298
- from: O.startHour,
2299
- to: O.endHour
2300
- },
2301
- onEventClick: j,
2302
- onSlotSelect: Z,
2303
- onSlotClick: ce,
2304
- renderPopover: ee,
2305
- ...b && { slots: b },
2306
- ...w && { classNames: w },
2307
- ...L && { resourceColumnConfig: L }
2308
- }
2309
- );
2310
- case "resource-week":
2311
- return /* @__PURE__ */ e(
2312
- Te,
2313
- {
2314
- daysToShow: 7,
2315
- events: m,
2316
- users: g,
2317
- ...s && { alwaysShowResources: s },
2318
- selectedDate: A,
2319
- visibleHours: {
2320
- from: O.startHour,
2321
- to: O.endHour
2322
- },
2323
- onEventClick: j,
2324
- onSlotSelect: Z,
2325
- onSlotClick: ce,
2326
- renderPopover: ee,
2327
- ...b && { slots: b },
2328
- ...w && { classNames: w },
2329
- ...L && { resourceColumnConfig: L }
2330
- }
2331
- );
2332
- // Timeline views
2333
- case "timeline-day":
2334
- return /* @__PURE__ */ e(
2335
- Te,
2336
- {
2337
- daysToShow: 1,
2338
- events: m,
2339
- users: g,
2340
- ...s && { alwaysShowResources: s },
2341
- selectedDate: A,
2342
- visibleHours: {
2343
- from: O.startHour,
2344
- to: O.endHour
2345
- },
2346
- onEventClick: j,
2347
- onSlotSelect: Z,
2348
- onSlotClick: ce,
2349
- renderPopover: ee,
2350
- ...b && { slots: b },
2351
- ...w && { classNames: w },
2352
- ...L && { resourceColumnConfig: L }
2353
- }
2354
- );
2355
- case "timeline-3day":
2356
- return /* @__PURE__ */ e(
2357
- Te,
2358
- {
2359
- daysToShow: 3,
2360
- events: m,
2361
- users: g,
2362
- ...s && { alwaysShowResources: s },
2363
- selectedDate: A,
2364
- visibleHours: {
2365
- from: O.startHour,
2366
- to: O.endHour
2367
- },
2368
- onEventClick: j,
2369
- onSlotSelect: Z,
2370
- onSlotClick: ce,
2371
- renderPopover: ee,
2372
- ...b && { slots: b },
2373
- ...w && { classNames: w },
2374
- ...L && { resourceColumnConfig: L }
2375
- }
2376
- );
2377
- case "timeline-week":
2378
- return /* @__PURE__ */ e(
2379
- Te,
2380
- {
2381
- daysToShow: 7,
2382
- events: m,
2383
- users: g,
2384
- ...s && { alwaysShowResources: s },
2385
- selectedDate: A,
2386
- visibleHours: {
2387
- from: O.startHour,
2388
- to: O.endHour
2389
- },
2390
- onEventClick: j,
2391
- onSlotSelect: Z,
2392
- onSlotClick: ce,
2393
- renderPopover: ee,
2394
- ...b && { slots: b },
2395
- ...w && { classNames: w },
2396
- ...L && { resourceColumnConfig: L }
2397
- }
2398
- );
2399
- default:
2400
- return /* @__PURE__ */ e(
2401
- Ke,
2402
- {
2403
- events: m,
2404
- date: A,
2405
- badgeVariant: N,
2406
- onEventClick: j,
2407
- onDayClick: me,
2408
- ...b && { slots: b },
2409
- ...w && { classNames: w }
2410
- }
2411
- );
2412
- }
2413
- }, J = ae(null);
2414
- return he(() => {
2415
- U.current = J.current;
2416
- }), /* @__PURE__ */ e(
2417
- _t,
2418
- {
2419
- mode: se,
2420
- onSelect: Z,
2421
- minDurationMinutes: h,
2422
- slotDurationMinutes: q,
2423
- enabled: !!(a || n),
2424
- children: /* @__PURE__ */ r(
2425
- "div",
2426
- {
2427
- className: f(
2428
- "inno-calendar-root flex flex-col h-full p-4",
2429
- w?.root,
2430
- l
2431
- ),
2432
- children: [
2433
- p && /* @__PURE__ */ e(
2434
- St,
2435
- {
2436
- currentDate: A,
2437
- view: M,
2438
- events: Y,
2439
- onViewChange: _,
2440
- onNavigateToday: () => K(/* @__PURE__ */ new Date(), M),
2441
- onNavigatePrev: () => {
2442
- const m = new Date(A);
2443
- M === "day" || M === "timeline-day" || M === "resource-day" ? m.setDate(m.getDate() - 1) : M === "timeline-3day" ? m.setDate(m.getDate() - 3) : M === "week" || M === "timeline-week" || M === "resource-week" ? m.setDate(m.getDate() - 7) : M === "month" ? m.setMonth(m.getMonth() - 1) : M === "year" ? m.setFullYear(m.getFullYear() - 1) : m.setDate(m.getDate() - 7), K(m, M);
2444
- },
2445
- onNavigateNext: () => {
2446
- const m = new Date(A);
2447
- M === "day" || M === "timeline-day" || M === "resource-day" ? m.setDate(m.getDate() + 1) : M === "timeline-3day" ? m.setDate(m.getDate() + 3) : M === "week" || M === "timeline-week" || M === "resource-week" ? m.setDate(m.getDate() + 7) : M === "month" ? m.setMonth(m.getMonth() + 1) : M === "year" ? m.setFullYear(m.getFullYear() + 1) : m.setDate(m.getDate() + 7), K(m, M);
2448
- },
2449
- availableViews: [
2450
- "day",
2451
- "week",
2452
- "month",
2453
- // 'year', NOTE: Intentionally blocked cause it would severe performance issues when there are many events
2454
- "agenda"
2455
- ],
2456
- showTimelineViews: !0,
2457
- showSettings: !!P,
2458
- ...!$ && o && { onAddEvent: o },
2459
- actions: $,
2460
- settingsContent: P,
2461
- filterContent: S,
2462
- ...I && { headerConfig: I }
2463
- }
2464
- ),
2465
- /* @__PURE__ */ r("div", { className: "relative flex-1 min-h-0", children: [
2466
- /* @__PURE__ */ e(
2467
- "div",
2468
- {
2469
- ref: J,
2470
- className: f(
2471
- "h-full border rounded-lg bg-white overflow-x-auto",
2472
- w?.viewContainer
2473
- ),
2474
- children: fe()
2475
- }
2476
- ),
2477
- H && /* @__PURE__ */ e("div", { className: "inno-calendar-loading-overlay", children: /* @__PURE__ */ e("div", { className: "inno-calendar-spinner" }) }),
2478
- /* @__PURE__ */ e(zn, { containerRef: J, currentDate: A })
2479
- ] })
2480
- ]
2481
- }
2482
- )
2483
- }
2484
- );
2485
- }
2486
- function Pn({
2487
- events: t,
2488
- users: n = [],
2489
- alwaysShowResources: a,
2490
- scheduleTypes: o = [],
2491
- initialView: s,
2492
- initialDate: l,
2493
- initialSelectedUserId: p,
2494
- initialScheduleTypeIds: h,
2495
- initialParticipantIds: c,
2496
- initialWorkingHoursView: v,
2497
- initialSearchQuery: H,
2498
- preferencesConfig: b,
2499
- onEventClick: w,
2500
- onSlotClick: P,
2501
- onSlotSelect: S,
2502
- onAddEvent: $,
2503
- onEventDrop: F,
2504
- onDateChange: R,
2505
- onViewChange: I,
2506
- className: L,
2507
- showHeader: W = !0,
2508
- minSelectionMinutes: z = 30,
2509
- showMoreMode: X,
2510
- showMoreEventsInPopover: M = !1,
2511
- isLoading: _ = !1,
2512
- renderPopover: A,
2513
- slots: K,
2514
- classNames: q,
2515
- settingsContent: Y,
2516
- filterContent: g,
2517
- headerActions: C,
2518
- focusEventId: u,
2519
- headerConfig: N,
2520
- resourceColumnConfig: y,
2521
- viewPersistence: V,
2522
- eventDetailMode: O,
2523
- renderEventDetail: G
2524
- }, U) {
2525
- return /* @__PURE__ */ e(jt, { ...F && { onEventDrop: F }, children: /* @__PURE__ */ e(
2526
- Pt,
2527
- {
2528
- initialEvents: t,
2529
- initialUsers: n,
2530
- initialScheduleTypes: o,
2531
- ...s && { initialView: s },
2532
- ...l && { initialDate: l },
2533
- ...p && { initialSelectedUserId: p },
2534
- ...h && { initialScheduleTypeIds: h },
2535
- ...c && { initialParticipantIds: c },
2536
- ...v && { initialWorkingHoursView: v },
2537
- ...H && { initialSearchQuery: H },
2538
- ...b && { preferencesConfig: b },
2539
- ...R && { onDateChange: R },
2540
- ...I && { onViewChange: I },
2541
- ...u && { initialFocusEventId: u },
2542
- ...V && { viewPersistence: V },
2543
- children: /* @__PURE__ */ e(
2544
- jn,
2545
- {
2546
- ...w && { onEventClick: w },
2547
- ...P && { onSlotClick: P },
2548
- ...S && { onSlotSelect: S },
2549
- ...$ && { onAddEvent: $ },
2550
- ...a && { alwaysShowResources: a },
2551
- ...A && { renderPopover: A },
2552
- className: L,
2553
- showHeader: W,
2554
- minSelectionMinutes: z,
2555
- ...X && { showMoreMode: X },
2556
- showMoreEventsInPopover: M,
2557
- isLoading: _,
2558
- ...K && { slots: K },
2559
- ...q && { classNames: q },
2560
- settingsContent: Y,
2561
- filterContent: g,
2562
- headerActions: C,
2563
- calendarRef: U,
2564
- ...N && { headerConfig: N },
2565
- ...y && { resourceColumnConfig: y },
2566
- ...O && { eventDetailMode: O },
2567
- ...G && { renderEventDetail: G }
2568
- }
2569
- )
2570
- }
2571
- ) });
2572
- }
2573
- const zr = We(Pn), be = We(
2574
- ({ className: t, children: n, ...a }, o) => /* @__PURE__ */ e(
2575
- "select",
2576
- {
2577
- ref: o,
2578
- className: f(
2579
- "flex h-9 w-full rounded-md border border-input bg-background px-3 py-1 text-sm shadow-sm",
2580
- "ring-offset-background",
2581
- "focus:outline-none focus:ring-1 focus:ring-ring",
2582
- "disabled:cursor-not-allowed disabled:opacity-50",
2583
- "[&>option]:bg-background",
2584
- t
2585
- ),
2586
- ...a,
2587
- children: n
2588
- }
2589
- )
2590
- );
2591
- be.displayName = "Select";
2592
- const ge = We(({ className: t, ...n }, a) => /* @__PURE__ */ e(
2593
- "label",
2594
- {
2595
- ref: a,
2596
- className: f(
2597
- "text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",
2598
- t
2599
- ),
2600
- ...n
2601
- }
2602
- ));
2603
- ge.displayName = "Label";
2604
- function Wn({ className: t }) {
2605
- return /* @__PURE__ */ r(
2606
- "svg",
2607
- {
2608
- className: t,
2609
- xmlns: "http://www.w3.org/2000/svg",
2610
- width: "24",
2611
- height: "24",
2612
- viewBox: "0 0 24 24",
2613
- fill: "none",
2614
- stroke: "currentColor",
2615
- strokeWidth: "2",
2616
- strokeLinecap: "round",
2617
- strokeLinejoin: "round",
2618
- children: [
2619
- /* @__PURE__ */ e("circle", { cx: "12", cy: "12", r: "10" }),
2620
- /* @__PURE__ */ e("path", { d: "M12 16v-4" }),
2621
- /* @__PURE__ */ e("path", { d: "M12 8h.01" })
2622
- ]
2623
- }
2624
- );
2625
- }
2626
- function _n({ className: t }) {
2627
- return /* @__PURE__ */ r(
2628
- "svg",
2629
- {
2630
- className: t,
2631
- xmlns: "http://www.w3.org/2000/svg",
2632
- width: "24",
2633
- height: "24",
2634
- viewBox: "0 0 24 24",
2635
- fill: "none",
2636
- stroke: "currentColor",
2637
- strokeWidth: "2",
2638
- strokeLinecap: "round",
2639
- strokeLinejoin: "round",
2640
- children: [
2641
- /* @__PURE__ */ e("rect", { width: "18", height: "11", x: "3", y: "11", rx: "2", ry: "2" }),
2642
- /* @__PURE__ */ e("path", { d: "M7 11V7a5 5 0 0 1 10 0v4" })
2643
- ]
2644
- }
2645
- );
2646
- }
2647
- const $n = [
2648
- { value: 15, label: "15 minutes" },
2649
- { value: 30, label: "30 minutes" },
2650
- { value: 60, label: "1 hour" }
2651
- ];
2652
- function Ar({
2653
- value: t,
2654
- onChange: n,
2655
- isLocked: a = !1,
2656
- className: o,
2657
- labels: s = {}
2658
- }) {
2659
- const l = {
2660
- title: "Slot duration",
2661
- lockedMessage: "This setting is locked by the administrator",
2662
- infoMessage: "Set the time slot duration for day and week calendar views.",
2663
- ...s
2664
- }, p = (h) => {
2665
- a || n(Number(h.target.value));
2666
- };
2667
- return /* @__PURE__ */ r("div", { className: f("flex flex-col gap-3", o), children: [
2668
- /* @__PURE__ */ r("div", { className: "flex items-center gap-2", children: [
2669
- /* @__PURE__ */ e(ge, { className: "text-sm font-semibold", children: l.title }),
2670
- a ? /* @__PURE__ */ e(pe, { delayDuration: 100, children: /* @__PURE__ */ r(xe, { children: [
2671
- /* @__PURE__ */ e(ve, { children: /* @__PURE__ */ e(_n, { className: "size-3 text-muted-foreground" }) }),
2672
- /* @__PURE__ */ e(we, { children: /* @__PURE__ */ e("p", { children: l.lockedMessage }) })
2673
- ] }) }) : /* @__PURE__ */ e(pe, { delayDuration: 100, children: /* @__PURE__ */ r(xe, { children: [
2674
- /* @__PURE__ */ e(ve, { children: /* @__PURE__ */ e(Wn, { className: "size-3 text-muted-foreground" }) }),
2675
- /* @__PURE__ */ e(we, { className: "max-w-64 text-center", children: /* @__PURE__ */ e("p", { children: l.infoMessage }) })
2676
- ] }) })
2677
- ] }),
2678
- /* @__PURE__ */ e(
2679
- be,
2680
- {
2681
- value: t.toString(),
2682
- onChange: p,
2683
- disabled: a,
2684
- className: "h-9 w-[128px] text-sm",
2685
- children: $n.map((h) => /* @__PURE__ */ e("option", { value: h.value.toString(), children: h.label }, h.value))
2686
- }
2687
- )
2688
- ] });
2689
- }
2690
- function Fn({ className: t }) {
2691
- return /* @__PURE__ */ r(
2692
- "svg",
2693
- {
2694
- className: t,
2695
- xmlns: "http://www.w3.org/2000/svg",
2696
- width: "24",
2697
- height: "24",
2698
- viewBox: "0 0 24 24",
2699
- fill: "none",
2700
- stroke: "currentColor",
2701
- strokeWidth: "2",
2702
- strokeLinecap: "round",
2703
- strokeLinejoin: "round",
2704
- children: [
2705
- /* @__PURE__ */ e("circle", { cx: "12", cy: "12", r: "10" }),
2706
- /* @__PURE__ */ e("path", { d: "M12 16v-4" }),
2707
- /* @__PURE__ */ e("path", { d: "M12 8h.01" })
2708
- ]
2709
- }
2710
- );
2711
- }
2712
- function On({ className: t }) {
2713
- return /* @__PURE__ */ r(
2714
- "svg",
2715
- {
2716
- className: t,
2717
- xmlns: "http://www.w3.org/2000/svg",
2718
- width: "24",
2719
- height: "24",
2720
- viewBox: "0 0 24 24",
2721
- fill: "none",
2722
- stroke: "currentColor",
2723
- strokeWidth: "2",
2724
- strokeLinecap: "round",
2725
- strokeLinejoin: "round",
2726
- children: [
2727
- /* @__PURE__ */ e("rect", { width: "18", height: "11", x: "3", y: "11", rx: "2", ry: "2" }),
2728
- /* @__PURE__ */ e("path", { d: "M7 11V7a5 5 0 0 1 10 0v4" })
2729
- ]
2730
- }
2731
- );
2732
- }
2733
- const Bn = [
2734
- { value: "dot", label: "Dot indicator" },
2735
- { value: "colored", label: "Full color" },
2736
- { value: "mixed", label: "Mixed" }
2737
- ];
2738
- function jr({
2739
- value: t,
2740
- onChange: n,
2741
- isLocked: a = !1,
2742
- className: o,
2743
- labels: s = {}
2744
- }) {
2745
- const l = {
2746
- title: "Event display",
2747
- lockedMessage: "This setting is locked by the administrator",
2748
- infoMessage: "Choose how events are displayed. Dot shows a small indicator, colored fills the entire event, mixed uses both.",
2749
- options: {
2750
- dot: "Dot indicator",
2751
- colored: "Full color",
2752
- mixed: "Mixed"
2753
- },
2754
- ...s
2755
- }, p = (c) => l.options?.[c] ?? c, h = (c) => {
2756
- a || n(c.target.value);
2757
- };
2758
- return /* @__PURE__ */ r("div", { className: f("flex flex-col gap-3", o), children: [
2759
- /* @__PURE__ */ r("div", { className: "flex items-center gap-2", children: [
2760
- /* @__PURE__ */ e(ge, { className: "text-sm font-semibold", children: l.title }),
2761
- a ? /* @__PURE__ */ e(pe, { delayDuration: 100, children: /* @__PURE__ */ r(xe, { children: [
2762
- /* @__PURE__ */ e(ve, { children: /* @__PURE__ */ e(On, { className: "size-3 text-muted-foreground" }) }),
2763
- /* @__PURE__ */ e(we, { children: /* @__PURE__ */ e("p", { children: l.lockedMessage }) })
2764
- ] }) }) : /* @__PURE__ */ e(pe, { delayDuration: 100, children: /* @__PURE__ */ r(xe, { children: [
2765
- /* @__PURE__ */ e(ve, { children: /* @__PURE__ */ e(Fn, { className: "size-3 text-muted-foreground" }) }),
2766
- /* @__PURE__ */ e(we, { className: "max-w-64 text-center", children: /* @__PURE__ */ e("p", { children: l.infoMessage }) })
2767
- ] }) })
2768
- ] }),
2769
- /* @__PURE__ */ e(
2770
- be,
2771
- {
2772
- value: t,
2773
- onChange: h,
2774
- disabled: a,
2775
- className: "h-9 w-[128px] text-sm",
2776
- children: Bn.map((c) => /* @__PURE__ */ e("option", { value: c.value, children: p(c.value) }, c.value))
2777
- }
2778
- )
2779
- ] });
2780
- }
2781
- function Rn({ className: t }) {
2782
- return /* @__PURE__ */ r(
2783
- "svg",
2784
- {
2785
- className: t,
2786
- xmlns: "http://www.w3.org/2000/svg",
2787
- width: "24",
2788
- height: "24",
2789
- viewBox: "0 0 24 24",
2790
- fill: "none",
2791
- stroke: "currentColor",
2792
- strokeWidth: "2",
2793
- strokeLinecap: "round",
2794
- strokeLinejoin: "round",
2795
- children: [
2796
- /* @__PURE__ */ e("circle", { cx: "12", cy: "12", r: "10" }),
2797
- /* @__PURE__ */ e("path", { d: "M12 16v-4" }),
2798
- /* @__PURE__ */ e("path", { d: "M12 8h.01" })
2799
- ]
2800
- }
2801
- );
2802
- }
2803
- function Un({ className: t }) {
2804
- return /* @__PURE__ */ r(
2805
- "svg",
2806
- {
2807
- className: t,
2808
- xmlns: "http://www.w3.org/2000/svg",
2809
- width: "24",
2810
- height: "24",
2811
- viewBox: "0 0 24 24",
2812
- fill: "none",
2813
- stroke: "currentColor",
2814
- strokeWidth: "2",
2815
- strokeLinecap: "round",
2816
- strokeLinejoin: "round",
2817
- children: [
2818
- /* @__PURE__ */ e("rect", { width: "18", height: "11", x: "3", y: "11", rx: "2", ry: "2" }),
2819
- /* @__PURE__ */ e("path", { d: "M7 11V7a5 5 0 0 1 10 0v4" })
2820
- ]
2821
- }
2822
- );
2823
- }
2824
- function Vn() {
2825
- return Array.from({ length: 25 }, (t, n) => ({
2826
- value: n,
2827
- label: `${String(n).padStart(2, "0")}:00`
2828
- }));
2829
- }
2830
- function Pr({
2831
- value: t,
2832
- onChange: n,
2833
- isLocked: a = !1,
2834
- className: o,
2835
- labels: s = {}
2836
- }) {
2837
- const l = {
2838
- title: "Visible hours",
2839
- from: "From",
2840
- to: "To",
2841
- lockedMessage: "This setting is locked by the administrator",
2842
- infoMessage: "Set the visible hour range for day and week views. Hours outside this range will be hidden.",
2843
- ...s
2844
- }, p = Vn(), h = (v) => {
2845
- if (a) return;
2846
- const H = Number(v.target.value);
2847
- H < t.endHour && n({ ...t, startHour: H });
2848
- }, c = (v) => {
2849
- if (a) return;
2850
- const H = Number(v.target.value);
2851
- H > t.startHour && n({ ...t, endHour: H });
2852
- };
2853
- return /* @__PURE__ */ r("div", { className: f("flex flex-col gap-3", o), children: [
2854
- /* @__PURE__ */ r("div", { className: "flex items-center gap-2", children: [
2855
- /* @__PURE__ */ e(ge, { className: "text-sm font-semibold", children: l.title }),
2856
- a ? /* @__PURE__ */ e(pe, { delayDuration: 100, children: /* @__PURE__ */ r(xe, { children: [
2857
- /* @__PURE__ */ e(ve, { children: /* @__PURE__ */ e(Un, { className: "size-3 text-muted-foreground" }) }),
2858
- /* @__PURE__ */ e(we, { children: /* @__PURE__ */ e("p", { children: l.lockedMessage }) })
2859
- ] }) }) : /* @__PURE__ */ e(pe, { delayDuration: 100, children: /* @__PURE__ */ r(xe, { children: [
2860
- /* @__PURE__ */ e(ve, { children: /* @__PURE__ */ e(Rn, { className: "size-3 text-muted-foreground" }) }),
2861
- /* @__PURE__ */ e(we, { className: "max-w-64 text-center", children: /* @__PURE__ */ e("p", { children: l.infoMessage }) })
2862
- ] }) })
2863
- ] }),
2864
- /* @__PURE__ */ r("div", { className: "flex items-center gap-2", children: [
2865
- /* @__PURE__ */ r("div", { className: "flex flex-col gap-1", children: [
2866
- /* @__PURE__ */ e(ge, { className: "text-xs text-muted-foreground", children: l.from }),
2867
- /* @__PURE__ */ e(
2868
- be,
2869
- {
2870
- value: t.startHour.toString(),
2871
- onChange: h,
2872
- disabled: a,
2873
- className: "h-9 w-[88px] text-sm",
2874
- children: p.map((v) => /* @__PURE__ */ e(
2875
- "option",
2876
- {
2877
- value: v.value.toString(),
2878
- disabled: v.value >= t.endHour,
2879
- children: v.label
2880
- },
2881
- v.value
2882
- ))
2883
- }
2884
- )
2885
- ] }),
2886
- /* @__PURE__ */ e("span", { className: "mt-5 text-muted-foreground", children: "—" }),
2887
- /* @__PURE__ */ r("div", { className: "flex flex-col gap-1", children: [
2888
- /* @__PURE__ */ e(ge, { className: "text-xs text-muted-foreground", children: l.to }),
2889
- /* @__PURE__ */ e(
2890
- be,
2891
- {
2892
- value: t.endHour.toString(),
2893
- onChange: c,
2894
- disabled: a,
2895
- className: "h-9 w-[88px] text-sm",
2896
- children: p.map((v) => /* @__PURE__ */ e(
2897
- "option",
2898
- {
2899
- value: v.value.toString(),
2900
- disabled: v.value <= t.startHour,
2901
- children: v.label
2902
- },
2903
- v.value
2904
- ))
2905
- }
2906
- )
2907
- ] })
2908
- ] })
2909
- ] });
2910
- }
2911
- function Yn({ className: t }) {
2912
- return /* @__PURE__ */ r(
2913
- "svg",
2914
- {
2915
- className: t,
2916
- xmlns: "http://www.w3.org/2000/svg",
2917
- width: "24",
2918
- height: "24",
2919
- viewBox: "0 0 24 24",
2920
- fill: "none",
2921
- stroke: "currentColor",
2922
- strokeWidth: "2",
2923
- strokeLinecap: "round",
2924
- strokeLinejoin: "round",
2925
- children: [
2926
- /* @__PURE__ */ e("circle", { cx: "12", cy: "12", r: "10" }),
2927
- /* @__PURE__ */ e("path", { d: "M12 16v-4" }),
2928
- /* @__PURE__ */ e("path", { d: "M12 8h.01" })
2929
- ]
2930
- }
2931
- );
2932
- }
2933
- function Kn({ className: t }) {
2934
- return /* @__PURE__ */ r(
2935
- "svg",
2936
- {
2937
- className: t,
2938
- xmlns: "http://www.w3.org/2000/svg",
2939
- width: "24",
2940
- height: "24",
2941
- viewBox: "0 0 24 24",
2942
- fill: "none",
2943
- stroke: "currentColor",
2944
- strokeWidth: "2",
2945
- strokeLinecap: "round",
2946
- strokeLinejoin: "round",
2947
- children: [
2948
- /* @__PURE__ */ e("rect", { width: "18", height: "11", x: "3", y: "11", rx: "2", ry: "2" }),
2949
- /* @__PURE__ */ e("path", { d: "M7 11V7a5 5 0 0 1 10 0v4" })
2950
- ]
2951
- }
2952
- );
2953
- }
2954
- function qn({ className: t }) {
2955
- return /* @__PURE__ */ e(
2956
- "svg",
2957
- {
2958
- className: t,
2959
- xmlns: "http://www.w3.org/2000/svg",
2960
- width: "24",
2961
- height: "24",
2962
- viewBox: "0 0 24 24",
2963
- fill: "none",
2964
- stroke: "currentColor",
2965
- strokeWidth: "2",
2966
- strokeLinecap: "round",
2967
- strokeLinejoin: "round",
2968
- children: /* @__PURE__ */ e("path", { d: "M20 6 9 17l-5-5" })
2969
- }
2970
- );
2971
- }
2972
- const Gn = [
2973
- "monday",
2974
- "tuesday",
2975
- "wednesday",
2976
- "thursday",
2977
- "friday",
2978
- "saturday",
2979
- "sunday"
2980
- ];
2981
- function Jn() {
2982
- return Array.from({ length: 25 }, (t, n) => ({
2983
- value: n,
2984
- label: `${String(n).padStart(2, "0")}:00`
2985
- }));
2986
- }
2987
- const ot = {
2988
- sunday: "Sun",
2989
- monday: "Mon",
2990
- tuesday: "Tue",
2991
- wednesday: "Wed",
2992
- thursday: "Thu",
2993
- friday: "Fri",
2994
- saturday: "Sat"
2995
- };
2996
- function Xn({ dayLabel: t, config: n, onChange: a, disabled: o, hourOptions: s }) {
2997
- const l = () => {
2998
- o || a({ ...n, enabled: !n.enabled });
2999
- }, p = (c) => {
3000
- if (o) return;
3001
- const v = Number(c.target.value);
3002
- v < n.to && a({ ...n, from: v });
3003
- }, h = (c) => {
3004
- if (o) return;
3005
- const v = Number(c.target.value);
3006
- v > n.from && a({ ...n, to: v });
3007
- };
3008
- return /* @__PURE__ */ r("div", { className: "flex items-center gap-2", children: [
3009
- /* @__PURE__ */ e(
3010
- "button",
3011
- {
3012
- type: "button",
3013
- role: "checkbox",
3014
- "aria-checked": n.enabled,
3015
- "aria-label": `Enable ${t}`,
3016
- onClick: l,
3017
- disabled: o,
3018
- className: f(
3019
- "flex size-5 shrink-0 items-center justify-center rounded border transition-colors",
3020
- n.enabled ? "border-primary bg-primary text-primary-foreground" : "border-input bg-background",
3021
- o && "cursor-not-allowed opacity-50"
3022
- ),
3023
- children: n.enabled && /* @__PURE__ */ e(qn, { className: "size-3" })
3024
- }
3025
- ),
3026
- /* @__PURE__ */ e("span", { className: f("w-10 text-sm", !n.enabled && "text-muted-foreground"), children: t }),
3027
- /* @__PURE__ */ e(
3028
- be,
3029
- {
3030
- value: n.from.toString(),
3031
- onChange: p,
3032
- disabled: o || !n.enabled,
3033
- className: "h-8 w-[76px] text-xs",
3034
- children: s.map((c) => /* @__PURE__ */ e("option", { value: c.value.toString(), disabled: c.value >= n.to, children: c.label }, c.value))
3035
- }
3036
- ),
3037
- /* @__PURE__ */ e("span", { className: "text-xs text-muted-foreground", children: "—" }),
3038
- /* @__PURE__ */ e(
3039
- be,
3040
- {
3041
- value: n.to.toString(),
3042
- onChange: h,
3043
- disabled: o || !n.enabled,
3044
- className: "h-8 w-[76px] text-xs",
3045
- children: s.map((c) => /* @__PURE__ */ e("option", { value: c.value.toString(), disabled: c.value <= n.from, children: c.label }, c.value))
3046
- }
3047
- )
3048
- ] });
3049
- }
3050
- function Wr({
3051
- value: t,
3052
- onChange: n,
3053
- isLocked: a = !1,
3054
- className: o,
3055
- labels: s = {}
3056
- }) {
3057
- const l = {
3058
- title: "Working hours",
3059
- lockedMessage: "This setting is locked by the administrator",
3060
- infoMessage: "Configure working hours for each day of the week. Non-working hours will be grayed out in day and week views.",
3061
- days: ot,
3062
- ...s
3063
- }, p = Jn(), h = (c, v) => {
3064
- a || n({ ...t, [c]: v });
3065
- };
3066
- return /* @__PURE__ */ r("div", { className: f("flex flex-col gap-3", o), children: [
3067
- /* @__PURE__ */ r("div", { className: "flex items-center gap-2", children: [
3068
- /* @__PURE__ */ e(ge, { className: "text-sm font-semibold", children: l.title }),
3069
- a ? /* @__PURE__ */ e(pe, { delayDuration: 100, children: /* @__PURE__ */ r(xe, { children: [
3070
- /* @__PURE__ */ e(ve, { children: /* @__PURE__ */ e(Kn, { className: "size-3 text-muted-foreground" }) }),
3071
- /* @__PURE__ */ e(we, { children: /* @__PURE__ */ e("p", { children: l.lockedMessage }) })
3072
- ] }) }) : /* @__PURE__ */ e(pe, { delayDuration: 100, children: /* @__PURE__ */ r(xe, { children: [
3073
- /* @__PURE__ */ e(ve, { children: /* @__PURE__ */ e(Yn, { className: "size-3 text-muted-foreground" }) }),
3074
- /* @__PURE__ */ e(we, { className: "max-w-64 text-center", children: /* @__PURE__ */ e("p", { children: l.infoMessage }) })
3075
- ] }) })
3076
- ] }),
3077
- /* @__PURE__ */ e("div", { className: "flex flex-col gap-2", children: Gn.map((c) => /* @__PURE__ */ e(
3078
- Xn,
3079
- {
3080
- dayLabel: l.days?.[c] ?? ot[c],
3081
- config: t[c],
3082
- onChange: (v) => h(c, v),
3083
- disabled: a,
3084
- hourOptions: p
3085
- },
3086
- c
3087
- )) })
3088
- ] });
3089
- }
3090
- const _r = {
3091
- sunday: { enabled: !1, from: 8, to: 18 },
3092
- monday: { enabled: !0, from: 8, to: 18 },
3093
- tuesday: { enabled: !0, from: 8, to: 18 },
3094
- wednesday: { enabled: !0, from: 8, to: 18 },
3095
- thursday: { enabled: !0, from: 8, to: 18 },
3096
- friday: { enabled: !0, from: 8, to: 18 },
3097
- saturday: { enabled: !1, from: 8, to: 18 }
3098
- };
3099
- function Re({ className: t }) {
3100
- return /* @__PURE__ */ e(
3101
- "svg",
3102
- {
3103
- className: t,
3104
- xmlns: "http://www.w3.org/2000/svg",
3105
- viewBox: "0 0 24 24",
3106
- fill: "none",
3107
- stroke: "currentColor",
3108
- strokeWidth: "3",
3109
- strokeLinecap: "round",
3110
- strokeLinejoin: "round",
3111
- children: /* @__PURE__ */ e("polyline", { points: "20 6 9 17 4 12" })
3112
- }
3113
- );
3114
- }
3115
- function Qn({ className: t }) {
3116
- return /* @__PURE__ */ r(
3117
- "svg",
3118
- {
3119
- className: t,
3120
- xmlns: "http://www.w3.org/2000/svg",
3121
- viewBox: "0 0 24 24",
3122
- fill: "none",
3123
- stroke: "currentColor",
3124
- strokeWidth: "2",
3125
- strokeLinecap: "round",
3126
- strokeLinejoin: "round",
3127
- children: [
3128
- /* @__PURE__ */ e("circle", { cx: "11", cy: "11", r: "8" }),
3129
- /* @__PURE__ */ e("line", { x1: "21", y1: "21", x2: "16.65", y2: "16.65" })
3130
- ]
3131
- }
3132
- );
3133
- }
3134
- function Zn({ className: t }) {
3135
- return /* @__PURE__ */ r(
3136
- "svg",
3137
- {
3138
- className: t,
3139
- xmlns: "http://www.w3.org/2000/svg",
3140
- viewBox: "0 0 24 24",
3141
- fill: "none",
3142
- stroke: "currentColor",
3143
- strokeWidth: "2",
3144
- strokeLinecap: "round",
3145
- strokeLinejoin: "round",
3146
- children: [
3147
- /* @__PURE__ */ e("line", { x1: "18", y1: "6", x2: "6", y2: "18" }),
3148
- /* @__PURE__ */ e("line", { x1: "6", y1: "6", x2: "18", y2: "18" })
3149
- ]
3150
- }
3151
- );
3152
- }
3153
- function Ue({ checked: t, onCheckedChange: n, className: a, children: o }) {
3154
- return /* @__PURE__ */ e(
3155
- "button",
3156
- {
3157
- type: "button",
3158
- role: "checkbox",
3159
- "aria-checked": t,
3160
- onClick: () => n(!t),
3161
- className: a,
3162
- children: o
3163
- }
3164
- );
3165
- }
3166
- function er({ src: t, alt: n, fallback: a, className: o }) {
3167
- const [s, l] = le(!1);
3168
- return !t || s ? /* @__PURE__ */ e(
3169
- "div",
3170
- {
3171
- className: f(
3172
- "flex items-center justify-center bg-zinc-200 text-zinc-600 font-medium text-sm",
3173
- o
3174
- ),
3175
- children: a || "?"
3176
- }
3177
- ) : /* @__PURE__ */ e(
3178
- "img",
3179
- {
3180
- src: t,
3181
- alt: n || "",
3182
- className: f("object-cover", o),
3183
- onError: () => l(!0)
3184
- }
3185
- );
3186
- }
3187
- function at({ value: t, onChange: n, placeholder: a, className: o }) {
3188
- return /* @__PURE__ */ r("div", { className: f("relative", o), children: [
3189
- /* @__PURE__ */ e(Qn, { className: "absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground" }),
3190
- /* @__PURE__ */ e(
3191
- "input",
3192
- {
3193
- type: "text",
3194
- value: t,
3195
- onChange: (s) => n(s.target.value),
3196
- placeholder: a,
3197
- className: "h-9 w-full rounded-lg border border-border bg-white pl-9 pr-3 text-sm placeholder:text-muted-foreground focus:border-primary focus:outline-none focus:ring-1 focus:ring-primary"
3198
- }
3199
- )
3200
- ] });
3201
- }
3202
- function st(t, n, a, o = 0.3) {
3203
- if (!n.trim()) return t;
3204
- const s = n.toLowerCase();
3205
- return t.filter((l) => a(l).some((h) => h ? h.toLowerCase().includes(s) : !1));
3206
- }
3207
- const tr = {
3208
- title: "Filters",
3209
- subtitle: "Filter calendar events",
3210
- scheduleTypes: "Event Types",
3211
- participants: "Participants",
3212
- clearAll: "Clear all",
3213
- selectAll: "Select all",
3214
- unselectAll: "Unselect all",
3215
- searchScheduleTypes: "Search event types...",
3216
- searchParticipants: "Search participants...",
3217
- noScheduleTypes: "No event types found",
3218
- noParticipants: "No participants found"
3219
- };
3220
- function $r({
3221
- scheduleTypes: t,
3222
- users: n,
3223
- selectedScheduleTypeIds: a,
3224
- onScheduleTypeChange: o,
3225
- selectedUserIds: s,
3226
- onUserChange: l,
3227
- onClearAll: p,
3228
- className: h,
3229
- scheduleTypesLoading: c = !1,
3230
- usersLoading: v = !1,
3231
- labels: H,
3232
- getScheduleTypeName: b
3233
- }) {
3234
- const w = { ...tr, ...H }, [P, S] = le(""), [$, F] = le(""), R = re(() => P.trim() ? st(t, P, (g) => [
3235
- g.name,
3236
- b?.(g) || g.name
3237
- ]) : t, [t, P, b]), I = re(() => $.trim() ? st(n, $, (g) => [g.name, g.email || ""]) : n, [n, $]), L = R.length > 0 && R.every((g) => a.includes(g.id)), W = I.length > 0 && I.every((g) => s.includes(g.id)), z = a.length + s.length, X = (g, C) => {
3238
- const u = C ? [...a, g] : a.filter((N) => N !== g);
3239
- o(u);
3240
- }, M = () => {
3241
- if (L) {
3242
- const g = new Set(R.map((C) => C.id));
3243
- o(a.filter((C) => !g.has(C)));
3244
- } else {
3245
- const g = /* @__PURE__ */ new Set([
3246
- ...a,
3247
- ...R.map((C) => C.id)
3248
- ]);
3249
- o(Array.from(g));
3250
- }
3251
- }, _ = (g, C) => {
3252
- const u = C ? [...s, g] : s.filter((N) => N !== g);
3253
- l(u);
3254
- }, A = () => {
3255
- if (W) {
3256
- const g = new Set(I.map((C) => C.id));
3257
- l(s.filter((C) => !g.has(C)));
3258
- } else {
3259
- const g = /* @__PURE__ */ new Set([...s, ...I.map((C) => C.id)]);
3260
- l(Array.from(g));
3261
- }
3262
- }, K = () => {
3263
- o([]), l([]), p?.();
3264
- }, q = (g) => b ? b(g) : g.name, Y = (g) => g.colorHex || g.color || "#069AD7";
3265
- return /* @__PURE__ */ r(
3266
- "div",
3267
- {
3268
- className: f(
3269
- "flex min-w-72 max-w-72 flex-col rounded-lg border bg-white shadow-sm",
3270
- h
3271
- ),
3272
- children: [
3273
- /* @__PURE__ */ r("header", { className: "flex items-start justify-between gap-2 px-4 pb-2 pt-4", children: [
3274
- /* @__PURE__ */ r("div", { className: "flex flex-col", children: [
3275
- /* @__PURE__ */ e("h3", { className: "text-base font-semibold text-foreground", children: w.title }),
3276
- /* @__PURE__ */ e("p", { className: "text-xs text-muted-foreground", children: w.subtitle })
3277
- ] }),
3278
- z > 0 && /* @__PURE__ */ r(
3279
- "button",
3280
- {
3281
- type: "button",
3282
- onClick: K,
3283
- className: "flex h-auto items-center gap-1 rounded-md px-2 py-1 text-xs font-medium text-destructive transition-colors hover:bg-destructive/10",
3284
- children: [
3285
- /* @__PURE__ */ e(Zn, { className: "h-3.5 w-3.5" }),
3286
- w.clearAll
3287
- ]
3288
- }
3289
- )
3290
- ] }),
3291
- /* @__PURE__ */ e("div", { className: "h-px w-full bg-border/60" }),
3292
- /* @__PURE__ */ r("section", { className: "flex flex-col", children: [
3293
- /* @__PURE__ */ r("div", { className: "flex items-center justify-between px-4 py-3", children: [
3294
- /* @__PURE__ */ e("h4", { className: "text-sm font-medium text-foreground", children: w.scheduleTypes }),
3295
- /* @__PURE__ */ e(
3296
- "button",
3297
- {
3298
- type: "button",
3299
- onClick: M,
3300
- className: "text-xs font-medium text-primary transition-colors hover:text-primary/80",
3301
- children: L ? w.unselectAll : w.selectAll
3302
- }
3303
- )
3304
- ] }),
3305
- t.length > 6 && /* @__PURE__ */ e("div", { className: "px-4 pb-3", children: /* @__PURE__ */ e(
3306
- at,
3307
- {
3308
- value: P,
3309
- onChange: S,
3310
- placeholder: w.searchScheduleTypes
3311
- }
3312
- ) }),
3313
- /* @__PURE__ */ r("div", { className: "flex max-h-[220px] flex-col gap-2 overflow-y-auto px-4 pb-2 scrollbar-thin", children: [
3314
- c ? (
3315
- // Loading skeletons
3316
- Array.from({ length: 4 }).map((g, C) => /* @__PURE__ */ r(
3317
- "div",
3318
- {
3319
- className: "flex animate-pulse items-center gap-2 rounded-md border border-border/60 bg-muted/40 p-2",
3320
- children: [
3321
- /* @__PURE__ */ e("div", { className: "h-5 w-5 rounded bg-muted-foreground/20" }),
3322
- /* @__PURE__ */ e("div", { className: "h-3 w-24 rounded bg-muted-foreground/20" })
3323
- ]
3324
- },
3325
- `skeleton-${C}`
3326
- ))
3327
- ) : R.map((g) => {
3328
- const C = a.includes(g.id), u = Y(g);
3329
- return /* @__PURE__ */ r(
3330
- Ue,
3331
- {
3332
- checked: C,
3333
- onCheckedChange: (N) => X(g.id, N),
3334
- className: f(
3335
- "relative flex w-full cursor-pointer items-center justify-between gap-3 rounded-md border border-border bg-white px-3 py-2 transition-colors hover:border-primary/50",
3336
- C && "border-primary bg-primary/5"
3337
- ),
3338
- children: [
3339
- /* @__PURE__ */ r("div", { className: "flex items-center gap-2", children: [
3340
- /* @__PURE__ */ e(
3341
- "span",
3342
- {
3343
- className: f(
3344
- "flex h-4 w-4 items-center justify-center rounded border border-border text-xs transition-colors",
3345
- C && "border-primary bg-primary text-primary-foreground"
3346
- ),
3347
- children: C && /* @__PURE__ */ e(Re, { className: "h-3 w-3" })
3348
- }
3349
- ),
3350
- /* @__PURE__ */ e("span", { className: "text-sm font-medium text-foreground", children: q(g) })
3351
- ] }),
3352
- /* @__PURE__ */ e(
3353
- "div",
3354
- {
3355
- className: "h-4 w-4 rounded-full border",
3356
- style: {
3357
- backgroundColor: u,
3358
- borderColor: u
3359
- }
3360
- }
3361
- )
3362
- ]
3363
- },
3364
- g.id
3365
- );
3366
- }),
3367
- !c && R.length === 0 && /* @__PURE__ */ e("p", { className: "px-2 py-1 text-xs text-muted-foreground", children: w.noScheduleTypes })
3368
- ] })
3369
- ] }),
3370
- /* @__PURE__ */ e("div", { className: "h-px w-full bg-border/60" }),
3371
- /* @__PURE__ */ r("section", { className: "flex flex-col", children: [
3372
- /* @__PURE__ */ r("div", { className: "flex items-center justify-between px-4 py-3", children: [
3373
- /* @__PURE__ */ e("h4", { className: "text-sm font-medium text-foreground", children: w.participants }),
3374
- /* @__PURE__ */ e(
3375
- Ue,
3376
- {
3377
- checked: W,
3378
- onCheckedChange: () => A(),
3379
- className: f(
3380
- "flex h-5 w-5 items-center justify-center rounded border border-border bg-white transition-colors hover:border-primary/50",
3381
- W && "border-primary bg-primary text-primary-foreground"
3382
- ),
3383
- children: W && /* @__PURE__ */ e(Re, { className: "h-3.5 w-3.5" })
3384
- }
3385
- )
3386
- ] }),
3387
- /* @__PURE__ */ e("div", { className: "px-4 pb-3", children: /* @__PURE__ */ e(
3388
- at,
3389
- {
3390
- value: $,
3391
- onChange: F,
3392
- placeholder: w.searchParticipants
3393
- }
3394
- ) }),
3395
- /* @__PURE__ */ r("div", { className: "flex max-h-[400px] flex-col gap-2 overflow-y-auto px-4 pb-4 scrollbar-thin", children: [
3396
- v ? (
3397
- // Loading skeletons
3398
- Array.from({ length: 4 }).map((g, C) => /* @__PURE__ */ r(
3399
- "div",
3400
- {
3401
- className: "flex animate-pulse items-center gap-3 rounded-md border border-border/60 bg-muted/40 p-3",
3402
- children: [
3403
- /* @__PURE__ */ e("div", { className: "h-5 w-5 rounded bg-muted-foreground/20" }),
3404
- /* @__PURE__ */ e("div", { className: "h-10 w-10 rounded-full bg-muted-foreground/20" }),
3405
- /* @__PURE__ */ r("div", { className: "space-y-2", children: [
3406
- /* @__PURE__ */ e("div", { className: "h-3 w-24 rounded bg-muted-foreground/20" }),
3407
- /* @__PURE__ */ e("div", { className: "h-2 w-32 rounded bg-muted-foreground/10" })
3408
- ] })
3409
- ]
3410
- },
3411
- `p-skeleton-${C}`
3412
- ))
3413
- ) : I.map((g) => {
3414
- const C = s.includes(g.id);
3415
- return /* @__PURE__ */ r(
3416
- Ue,
3417
- {
3418
- checked: C,
3419
- onCheckedChange: (u) => _(g.id, u),
3420
- className: f(
3421
- "relative flex w-full cursor-pointer items-start gap-2 rounded-lg border border-border bg-white p-2 transition-colors hover:border-primary/50",
3422
- C && "border-primary bg-zinc-50"
3423
- ),
3424
- children: [
3425
- /* @__PURE__ */ e(
3426
- "span",
3427
- {
3428
- className: f(
3429
- "flex h-4 w-4 flex-shrink-0 items-center justify-center rounded border border-border transition-colors",
3430
- C && "border-primary bg-primary text-primary-foreground"
3431
- ),
3432
- children: C && /* @__PURE__ */ e(Re, { className: "h-2.5 w-2.5" })
3433
- }
3434
- ),
3435
- /* @__PURE__ */ r("div", { className: "flex flex-1 items-start gap-2", children: [
3436
- /* @__PURE__ */ e(
3437
- er,
3438
- {
3439
- src: g.avatar ?? null,
3440
- alt: g.name,
3441
- fallback: g.name?.[0]?.toUpperCase() ?? "?",
3442
- className: "h-10 w-10 rounded-lg"
3443
- }
3444
- ),
3445
- /* @__PURE__ */ r("div", { className: "flex max-w-[140px] flex-col gap-0.5 overflow-hidden", children: [
3446
- /* @__PURE__ */ e("span", { className: "line-clamp-1 text-sm font-medium text-foreground", children: g.name }),
3447
- /* @__PURE__ */ e(
3448
- "span",
3449
- {
3450
- className: "truncate text-[11px] text-muted-foreground",
3451
- title: g.email,
3452
- children: g.email
3453
- }
3454
- )
3455
- ] })
3456
- ] })
3457
- ]
3458
- },
3459
- g.id
3460
- );
3461
- }),
3462
- !v && I.length === 0 && /* @__PURE__ */ e("p", { className: "px-4 text-xs text-muted-foreground", children: w.noParticipants })
3463
- ] })
3464
- ] })
3465
- ]
3466
- }
3467
- );
3468
- }
3469
- function nr({ className: t }) {
3470
- return /* @__PURE__ */ r(
3471
- "svg",
3472
- {
3473
- className: t,
3474
- xmlns: "http://www.w3.org/2000/svg",
3475
- width: "24",
3476
- height: "24",
3477
- viewBox: "0 0 24 24",
3478
- fill: "none",
3479
- stroke: "currentColor",
3480
- strokeWidth: "2",
3481
- strokeLinecap: "round",
3482
- strokeLinejoin: "round",
3483
- children: [
3484
- /* @__PURE__ */ e("path", { d: "M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z" }),
3485
- /* @__PURE__ */ e("circle", { cx: "7.5", cy: "7.5", r: ".5", fill: "currentColor" })
3486
- ]
3487
- }
3488
- );
3489
- }
3490
- function Fr({
3491
- scheduleTypes: t,
3492
- value: n,
3493
- onChange: a,
3494
- allLabel: o = "All types",
3495
- className: s,
3496
- label: l
3497
- }) {
3498
- const p = (c) => {
3499
- a(c.target.value);
3500
- }, h = t.find((c) => String(c.id) === n);
3501
- return /* @__PURE__ */ r("div", { className: f("flex flex-col gap-1", s), children: [
3502
- l && /* @__PURE__ */ e(ge, { className: "text-xs text-muted-foreground", children: l }),
3503
- /* @__PURE__ */ r("div", { className: "relative", children: [
3504
- h ? /* @__PURE__ */ e(
3505
- "span",
3506
- {
3507
- className: "pointer-events-none absolute left-2.5 top-1/2 size-3 -translate-y-1/2 rounded-full",
3508
- style: { backgroundColor: h.color }
3509
- }
3510
- ) : /* @__PURE__ */ e(nr, { className: "pointer-events-none absolute left-2.5 top-1/2 size-4 -translate-y-1/2 text-muted-foreground" }),
3511
- /* @__PURE__ */ r(
3512
- be,
3513
- {
3514
- value: n,
3515
- onChange: p,
3516
- className: "h-9 w-full min-w-[140px] pl-8 pr-8 text-sm",
3517
- children: [
3518
- /* @__PURE__ */ e("option", { value: "all", children: o }),
3519
- t.map((c) => /* @__PURE__ */ e("option", { value: String(c.id), children: c.label }, c.id))
3520
- ]
3521
- }
3522
- )
3523
- ] })
3524
- ] });
3525
- }
3526
- function rr({ className: t }) {
3527
- return /* @__PURE__ */ r(
3528
- "svg",
3529
- {
3530
- className: t,
3531
- xmlns: "http://www.w3.org/2000/svg",
3532
- width: "24",
3533
- height: "24",
3534
- viewBox: "0 0 24 24",
3535
- fill: "none",
3536
- stroke: "currentColor",
3537
- strokeWidth: "2",
3538
- strokeLinecap: "round",
3539
- strokeLinejoin: "round",
3540
- children: [
3541
- /* @__PURE__ */ e("path", { d: "M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2" }),
3542
- /* @__PURE__ */ e("circle", { cx: "9", cy: "7", r: "4" }),
3543
- /* @__PURE__ */ e("path", { d: "M22 21v-2a4 4 0 0 0-3-3.87" }),
3544
- /* @__PURE__ */ e("path", { d: "M16 3.13a4 4 0 0 1 0 7.75" })
3545
- ]
3546
- }
3547
- );
3548
- }
3549
- function Or({
3550
- users: t,
3551
- value: n,
3552
- onChange: a,
3553
- allLabel: o = "All users",
3554
- className: s,
3555
- label: l
3556
- }) {
3557
- const p = (h) => {
3558
- a(h.target.value);
3559
- };
3560
- return /* @__PURE__ */ r("div", { className: f("flex flex-col gap-1", s), children: [
3561
- l && /* @__PURE__ */ e(ge, { className: "text-xs text-muted-foreground", children: l }),
3562
- /* @__PURE__ */ r("div", { className: "relative", children: [
3563
- /* @__PURE__ */ e(rr, { className: "pointer-events-none absolute left-2.5 top-1/2 size-4 -translate-y-1/2 text-muted-foreground" }),
3564
- /* @__PURE__ */ r(
3565
- be,
3566
- {
3567
- value: n,
3568
- onChange: p,
3569
- className: "h-9 w-full min-w-[120px] pl-8 pr-8 text-sm",
3570
- children: [
3571
- /* @__PURE__ */ e("option", { value: "all", children: o }),
3572
- t.map((h) => /* @__PURE__ */ e("option", { value: h.id, children: h.name }, h.id))
3573
- ]
3574
- }
3575
- )
3576
- ] })
3577
- ] });
3578
- }
3579
- function or({ className: t }) {
3580
- return /* @__PURE__ */ r(
3581
- "svg",
3582
- {
3583
- xmlns: "http://www.w3.org/2000/svg",
3584
- viewBox: "0 0 24 24",
3585
- fill: "none",
3586
- stroke: "currentColor",
3587
- strokeWidth: 1.8,
3588
- strokeLinecap: "round",
3589
- strokeLinejoin: "round",
3590
- className: t,
3591
- children: [
3592
- /* @__PURE__ */ e("path", { d: "M8 2v4" }),
3593
- /* @__PURE__ */ e("path", { d: "M16 2v4" }),
3594
- /* @__PURE__ */ e("rect", { width: "18", height: "18", x: "3", y: "4", rx: "2" }),
3595
- /* @__PURE__ */ e("path", { d: "M3 10h18" }),
3596
- /* @__PURE__ */ e("path", { d: "M8 14h.01" }),
3597
- /* @__PURE__ */ e("path", { d: "M12 14h.01" }),
3598
- /* @__PURE__ */ e("path", { d: "M16 14h.01" }),
3599
- /* @__PURE__ */ e("path", { d: "M8 18h.01" }),
3600
- /* @__PURE__ */ e("path", { d: "M12 18h.01" }),
3601
- /* @__PURE__ */ e("path", { d: "M16 18h.01" })
3602
- ]
3603
- }
3604
- );
3605
- }
3606
- function ar({ className: t }) {
3607
- return /* @__PURE__ */ r(
3608
- "svg",
3609
- {
3610
- xmlns: "http://www.w3.org/2000/svg",
3611
- viewBox: "0 0 24 24",
3612
- fill: "none",
3613
- stroke: "currentColor",
3614
- strokeWidth: 2,
3615
- strokeLinecap: "round",
3616
- strokeLinejoin: "round",
3617
- className: t,
3618
- children: [
3619
- /* @__PURE__ */ e("path", { d: "M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5" }),
3620
- /* @__PURE__ */ e("path", { d: "M16 2v4" }),
3621
- /* @__PURE__ */ e("path", { d: "M8 2v4" }),
3622
- /* @__PURE__ */ e("path", { d: "M3 10h5" }),
3623
- /* @__PURE__ */ e("path", { d: "M17.5 17.5 16 16.3V14" }),
3624
- /* @__PURE__ */ e("circle", { cx: "16", cy: "16", r: "6" })
3625
- ]
3626
- }
3627
- );
3628
- }
3629
- function sr({ className: t }) {
3630
- return /* @__PURE__ */ e(
3631
- "svg",
3632
- {
3633
- xmlns: "http://www.w3.org/2000/svg",
3634
- viewBox: "0 0 24 24",
3635
- fill: "none",
3636
- stroke: "currentColor",
3637
- strokeWidth: 2,
3638
- strokeLinecap: "round",
3639
- strokeLinejoin: "round",
3640
- className: t,
3641
- children: /* @__PURE__ */ e("path", { d: "m9 18 6-6-6-6" })
3642
- }
3643
- );
3644
- }
3645
- function ir({ className: t }) {
3646
- return /* @__PURE__ */ r(
3647
- "svg",
3648
- {
3649
- xmlns: "http://www.w3.org/2000/svg",
3650
- viewBox: "0 0 24 24",
3651
- fill: "none",
3652
- stroke: "currentColor",
3653
- strokeWidth: 2,
3654
- strokeLinecap: "round",
3655
- strokeLinejoin: "round",
3656
- className: t,
3657
- children: [
3658
- /* @__PURE__ */ e("path", { d: "M15 3h6v6" }),
3659
- /* @__PURE__ */ e("path", { d: "M10 14 21 3" }),
3660
- /* @__PURE__ */ e("path", { d: "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6" })
3661
- ]
3662
- }
3663
- );
3664
- }
3665
- function lr(t) {
3666
- const n = t.getFullYear(), a = String(t.getMonth() + 1).padStart(2, "0"), o = String(t.getDate()).padStart(2, "0");
3667
- return `${n}-${a}-${o}`;
3668
- }
3669
- function it(t) {
3670
- const n = t.getHours(), a = t.getMinutes(), o = n >= 12 ? "PM" : "AM", s = n % 12 || 12, l = String(a).padStart(2, "0");
3671
- return `${s}:${l} ${o}`;
3672
- }
3673
- function cr(t) {
3674
- const n = it(t.startDate), a = it(t.endDate);
3675
- return `${n} - ${a}`;
3676
- }
3677
- function dr(t) {
3678
- const n = gt(/* @__PURE__ */ new Date(), 1);
3679
- return t.getFullYear() === n.getFullYear() && t.getMonth() === n.getMonth() && t.getDate() === n.getDate();
3680
- }
3681
- function ur(t) {
3682
- if (ue(t)) return "Today";
3683
- if (dr(t)) return "Tomorrow";
3684
- const n = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], a = [
3685
- "Jan",
3686
- "Feb",
3687
- "Mar",
3688
- "Apr",
3689
- "May",
3690
- "Jun",
3691
- "Jul",
3692
- "Aug",
3693
- "Sep",
3694
- "Oct",
3695
- "Nov",
3696
- "Dec"
3697
- ], o = n[t.getDay()], s = a[t.getMonth()], l = t.getDate();
3698
- return `${o}, ${s} ${l}`;
3699
- }
3700
- function hr(t, n) {
3701
- const a = /* @__PURE__ */ new Map();
3702
- for (const o of t) {
3703
- const s = lr(o.startDate), l = a.get(s) ?? [];
3704
- l.push(o), a.set(s, l);
3705
- }
3706
- return Array.from(a.entries()).map(([o, s]) => {
3707
- const l = [...s].sort(
3708
- (h, c) => h.startDate.getTime() - c.startDate.getTime()
3709
- ), p = n > 0 ? l.slice(0, n) : l;
3710
- return {
3711
- date: new Date(o),
3712
- dateKey: o,
3713
- events: p,
3714
- hasMore: n > 0 && l.length > n
3715
- };
3716
- }).sort((o, s) => o.date.getTime() - s.date.getTime());
3717
- }
3718
- function mr(t) {
3719
- const n = _e(/* @__PURE__ */ new Date()), a = ft(/* @__PURE__ */ new Date());
3720
- return t.filter((o) => o.startDate >= n && o.startDate <= a).length;
3721
- }
3722
- function Ve({ className: t }) {
3723
- return /* @__PURE__ */ e("div", { className: f("animate-pulse rounded-md bg-muted", t) });
3724
- }
3725
- function fr({ event: t, onClick: n }) {
3726
- return /* @__PURE__ */ r(
3727
- "button",
3728
- {
3729
- type: "button",
3730
- onClick: () => n?.(t),
3731
- className: f(
3732
- "w-full text-left rounded-lg transition-colors",
3733
- "hover:bg-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
3734
- "flex items-start gap-3 p-2"
3735
- ),
3736
- children: [
3737
- /* @__PURE__ */ e(
3738
- "div",
3739
- {
3740
- className: "shrink-0 rounded-full mt-1.5 size-2",
3741
- style: { backgroundColor: t.color ?? "#3b82f6" }
3742
- }
3743
- ),
3744
- /* @__PURE__ */ r("div", { className: "min-w-0 flex-1", children: [
3745
- /* @__PURE__ */ e("p", { className: "text-sm font-medium truncate", children: t.title }),
3746
- /* @__PURE__ */ e("p", { className: "text-xs text-muted-foreground truncate", children: cr(t) })
3747
- ] }),
3748
- n && /* @__PURE__ */ e(sr, { className: "shrink-0 size-4 text-muted-foreground/50 mt-1" })
3749
- ]
3750
- }
3751
- );
3752
- }
3753
- function gr({ group: t, onEventClick: n }) {
3754
- return /* @__PURE__ */ r("div", { className: "space-y-1", children: [
3755
- /* @__PURE__ */ r("div", { className: "flex items-center justify-between px-2 py-1.5", children: [
3756
- /* @__PURE__ */ e("h3", { className: f("text-xs font-semibold", ue(t.date) && "text-primary"), children: ur(t.date) }),
3757
- t.hasMore && /* @__PURE__ */ r("span", { className: "text-[10px] text-muted-foreground", children: [
3758
- "+",
3759
- t.events.length,
3760
- " more"
3761
- ] })
3762
- ] }),
3763
- /* @__PURE__ */ e("div", { className: "space-y-0.5", children: t.events.map((a) => /* @__PURE__ */ e(fr, { event: a, onClick: n }, a.id)) })
3764
- ] });
3765
- }
3766
- function Br({
3767
- events: t,
3768
- isLoading: n = !1,
3769
- className: a,
3770
- daysAhead: o = 7,
3771
- maxEventsPerDay: s = 3,
3772
- onEventClick: l,
3773
- onNavigateToAgenda: p
3774
- }) {
3775
- const [h, c] = le(!1), v = re(() => {
3776
- const S = _e(/* @__PURE__ */ new Date()), $ = gt(S, o);
3777
- return t.filter((F) => F.endDate >= S && F.startDate < $);
3778
- }, [t, o]), H = re(
3779
- () => hr(v, s),
3780
- [v, s]
3781
- ), b = re(() => mr(t), [t]), w = (S) => {
3782
- c(!1), l?.(S);
3783
- }, P = () => {
3784
- c(!1), p?.();
3785
- };
3786
- return /* @__PURE__ */ r(ut, { open: h, onOpenChange: c, children: [
3787
- /* @__PURE__ */ r(
3788
- ht,
3789
- {
3790
- className: f(
3791
- "relative rounded-xl hover:text-zinc-700 hover:!bg-zinc-300 !bg-zinc-200 text-zinc-600 shadow-none !px-2.5 p-2 max-h-10",
3792
- a
3793
- ),
3794
- children: [
3795
- /* @__PURE__ */ e(or, { className: "h-4 w-4" }),
3796
- b > 0 && /* @__PURE__ */ e(
3797
- zt,
3798
- {
3799
- variant: "destructive",
3800
- className: "absolute -right-4 -top-4 m-3 flex h-5 w-5 items-center justify-center rounded-full bg-primary p-0 text-[10px] font-medium hover:bg-primary",
3801
- children: b > 99 ? "99+" : b
3802
- }
3803
- )
3804
- ]
3805
- }
3806
- ),
3807
- /* @__PURE__ */ r(mt, { className: "w-80 rounded-xl p-0", align: "end", side: "bottom", sideOffset: 8, children: [
3808
- /* @__PURE__ */ r("div", { className: "flex items-center justify-between border-b p-4", children: [
3809
- /* @__PURE__ */ r("div", { children: [
3810
- /* @__PURE__ */ e("h3", { className: "text-sm font-semibold", children: "Upcoming" }),
3811
- /* @__PURE__ */ e("p", { className: "text-xs text-muted-foreground", children: b > 0 ? `${b} event${b > 1 ? "s" : ""} today` : "No events today" })
3812
- ] }),
3813
- p && /* @__PURE__ */ r(
3814
- "button",
3815
- {
3816
- type: "button",
3817
- onClick: P,
3818
- className: "text-xs text-primary hover:underline flex items-center gap-1",
3819
- children: [
3820
- "View all",
3821
- /* @__PURE__ */ e(ir, { className: "size-3" })
3822
- ]
3823
- }
3824
- )
3825
- ] }),
3826
- /* @__PURE__ */ e("div", { className: "max-h-80 overflow-y-auto p-2", children: n ? /* @__PURE__ */ e("div", { className: "space-y-2 p-2", children: Array.from({ length: 3 }).map((S, $) => /* @__PURE__ */ r("div", { className: "flex space-x-3", children: [
3827
- /* @__PURE__ */ e(Ve, { className: "h-2 w-2 rounded-full mt-2" }),
3828
- /* @__PURE__ */ r("div", { className: "flex-1 space-y-2", children: [
3829
- /* @__PURE__ */ e(Ve, { className: "h-4 w-full" }),
3830
- /* @__PURE__ */ e(Ve, { className: "h-3 w-3/4" })
3831
- ] })
3832
- ] }, $)) }) : H.length === 0 ? /* @__PURE__ */ r("div", { className: "flex flex-col items-center justify-center py-8 text-center", children: [
3833
- /* @__PURE__ */ e(ar, { className: "mb-2 h-8 w-8 text-muted-foreground/50" }),
3834
- /* @__PURE__ */ e("p", { className: "text-sm text-muted-foreground", children: "No upcoming events" }),
3835
- /* @__PURE__ */ r("p", { className: "text-xs text-muted-foreground/70", children: [
3836
- "Your schedule is clear for the next ",
3837
- o,
3838
- " days"
3839
- ] })
3840
- ] }) : /* @__PURE__ */ e("div", { className: "space-y-3 divide-y", children: H.map((S) => /* @__PURE__ */ e(
3841
- gr,
3842
- {
3843
- group: S,
3844
- onEventClick: w
3845
- },
3846
- S.dateKey
3847
- )) }) })
3848
- ] })
3849
- ] });
3850
- }
3851
- function pr({ className: t }) {
3852
- return /* @__PURE__ */ r(
3853
- "svg",
3854
- {
3855
- xmlns: "http://www.w3.org/2000/svg",
3856
- width: "24",
3857
- height: "24",
3858
- viewBox: "0 0 24 24",
3859
- fill: "none",
3860
- stroke: "currentColor",
3861
- strokeWidth: "2",
3862
- strokeLinecap: "round",
3863
- strokeLinejoin: "round",
3864
- className: t,
3865
- children: [
3866
- /* @__PURE__ */ e("path", { d: "M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5" }),
3867
- /* @__PURE__ */ e("path", { d: "M16 2v4" }),
3868
- /* @__PURE__ */ e("path", { d: "M8 2v4" }),
3869
- /* @__PURE__ */ e("path", { d: "M3 10h5" }),
3870
- /* @__PURE__ */ e("path", { d: "M17.5 17.5 16 16.25V14" }),
3871
- /* @__PURE__ */ e("circle", { cx: "16", cy: "16", r: "6" })
3872
- ]
3873
- }
3874
- );
3875
- }
3876
- function xt({ className: t }) {
3877
- return /* @__PURE__ */ e(
3878
- "svg",
3879
- {
3880
- xmlns: "http://www.w3.org/2000/svg",
3881
- width: "24",
3882
- height: "24",
3883
- viewBox: "0 0 24 24",
3884
- fill: "none",
3885
- stroke: "currentColor",
3886
- strokeWidth: "2",
3887
- strokeLinecap: "round",
3888
- strokeLinejoin: "round",
3889
- className: t,
3890
- children: /* @__PURE__ */ e("path", { d: "m9 18 6-6-6-6" })
3891
- }
3892
- );
3893
- }
3894
- function xr(t) {
3895
- const n = /* @__PURE__ */ new Date();
3896
- return n.setDate(n.getDate() + 1), t.getFullYear() === n.getFullYear() && t.getMonth() === n.getMonth() && t.getDate() === n.getDate();
3897
- }
3898
- function lt(t) {
3899
- const n = t.getHours(), a = t.getMinutes(), o = n >= 12 ? "PM" : "AM";
3900
- return `${n % 12 || 12}:${a.toString().padStart(2, "0")} ${o}`;
3901
- }
3902
- function vr(t) {
3903
- return new Intl.DateTimeFormat("en-US", {
3904
- weekday: "long",
3905
- month: "short",
3906
- day: "numeric"
3907
- }).format(t);
3908
- }
3909
- function wr(t) {
3910
- const n = lt(t.startDate), a = lt(t.endDate);
3911
- return `${n} - ${a}`;
3912
- }
3913
- function br(t) {
3914
- return ue(t) ? "Today" : xr(t) ? "Tomorrow" : vr(t);
3915
- }
3916
- function yr(t, n) {
3917
- const a = /* @__PURE__ */ new Map();
3918
- for (const o of t) {
3919
- const s = Bt(o.startDate), l = a.get(s) ?? [];
3920
- l.push(o), a.set(s, l);
3921
- }
3922
- return Array.from(a.entries()).map(([o, s]) => {
3923
- const l = [...s].sort(
3924
- (h, c) => h.startDate.getTime() - c.startDate.getTime()
3925
- ), p = n > 0 ? l.slice(0, n) : l;
3926
- return {
3927
- date: new Date(o),
3928
- dateKey: o,
3929
- events: p,
3930
- hasMore: n > 0 && l.length > n
3931
- };
3932
- }).sort((o, s) => o.date.getTime() - s.date.getTime());
3933
- }
3934
- function kr({ event: t, onClick: n, compact: a }) {
3935
- return /* @__PURE__ */ r(
3936
- "button",
3937
- {
3938
- type: "button",
3939
- onClick: () => n?.(t),
3940
- className: f(
3941
- "w-full text-left rounded-lg transition-colors",
3942
- "hover:bg-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
3943
- "flex items-start gap-3",
3944
- a ? "p-2" : "p-3"
3945
- ),
3946
- children: [
3947
- /* @__PURE__ */ e(
3948
- "div",
3949
- {
3950
- className: f("shrink-0 rounded-full mt-1", a ? "size-2" : "size-2.5"),
3951
- style: { backgroundColor: t.color ?? "#3b82f6" }
3952
- }
3953
- ),
3954
- /* @__PURE__ */ r("div", { className: "min-w-0 flex-1", children: [
3955
- /* @__PURE__ */ e("p", { className: f("font-medium truncate", a ? "text-xs" : "text-sm"), children: t.title }),
3956
- /* @__PURE__ */ e("p", { className: f("text-muted-foreground truncate", a ? "text-[10px]" : "text-xs"), children: wr(t) })
3957
- ] }),
3958
- n && /* @__PURE__ */ e(
3959
- xt,
3960
- {
3961
- className: f("shrink-0 text-muted-foreground/50", a ? "size-3" : "size-4")
3962
- }
3963
- )
3964
- ]
3965
- }
3966
- );
3967
- }
3968
- function Nr({
3969
- group: t,
3970
- onEventClick: n,
3971
- onViewMore: a,
3972
- compact: o
3973
- }) {
3974
- return /* @__PURE__ */ r("div", { className: "space-y-1", children: [
3975
- /* @__PURE__ */ r("div", { className: f("flex items-center justify-between px-2", o ? "py-1" : "py-1.5"), children: [
3976
- /* @__PURE__ */ e(
3977
- "h3",
3978
- {
3979
- className: f(
3980
- "font-semibold",
3981
- o ? "text-xs" : "text-sm",
3982
- ue(t.date) && "text-primary"
3983
- ),
3984
- children: br(t.date)
3985
- }
3986
- ),
3987
- t.hasMore && a && /* @__PURE__ */ e(
3988
- "button",
3989
- {
3990
- type: "button",
3991
- onClick: () => a(t.date),
3992
- className: f("text-primary hover:underline", o ? "text-[10px]" : "text-xs"),
3993
- children: "+more"
3994
- }
3995
- )
3996
- ] }),
3997
- /* @__PURE__ */ e("div", { className: "space-y-0.5", children: t.events.map((s) => /* @__PURE__ */ e(kr, { event: s, onClick: n, compact: o }, s.id)) })
3998
- ] });
3999
- }
4000
- function Rr({
4001
- events: t,
4002
- daysAhead: n = 7,
4003
- maxEventsPerDay: a = 3,
4004
- onEventClick: o,
4005
- onViewAll: s,
4006
- className: l,
4007
- emptyState: p,
4008
- title: h = "Upcoming",
4009
- showHeader: c = !0,
4010
- compact: v = !1
4011
- }) {
4012
- const H = ct(), b = H?.filteredEvents, w = H?.currentDate ?? /* @__PURE__ */ new Date(), P = t ?? b ?? [], S = re(() => {
4013
- const R = _e(w), I = new Date(R);
4014
- return I.setDate(I.getDate() + n), P.filter((L) => L.endDate >= R && L.startDate < I);
4015
- }, [P, n, w]), $ = re(
4016
- () => yr(S, a),
4017
- [S, a]
4018
- ), F = S.length;
4019
- return $.length === 0 ? /* @__PURE__ */ r("div", { className: f("rounded-lg border bg-card", l), children: [
4020
- c && /* @__PURE__ */ e(
4021
- "div",
4022
- {
4023
- className: f(
4024
- "border-b px-4 flex items-center justify-between",
4025
- v ? "py-2" : "py-3"
4026
- ),
4027
- children: /* @__PURE__ */ e("h2", { className: f("font-semibold", v ? "text-sm" : "text-base"), children: h })
4028
- }
4029
- ),
4030
- /* @__PURE__ */ e(
4031
- "div",
4032
- {
4033
- className: f(
4034
- "flex flex-col items-center justify-center text-center",
4035
- v ? "py-6 px-4" : "py-10 px-6"
4036
- ),
4037
- children: p ?? /* @__PURE__ */ r(ke, { children: [
4038
- /* @__PURE__ */ e(
4039
- pr,
4040
- {
4041
- className: f("text-muted-foreground/50 mb-2", v ? "size-8" : "size-10")
4042
- }
4043
- ),
4044
- /* @__PURE__ */ e("p", { className: f("text-muted-foreground", v ? "text-xs" : "text-sm"), children: "No upcoming events" })
4045
- ] })
4046
- }
4047
- )
4048
- ] }) : /* @__PURE__ */ r("div", { className: f("rounded-lg border bg-card overflow-hidden", l), children: [
4049
- c && /* @__PURE__ */ r(
4050
- "div",
4051
- {
4052
- className: f(
4053
- "border-b px-4 flex items-center justify-between",
4054
- v ? "py-2" : "py-3"
4055
- ),
4056
- children: [
4057
- /* @__PURE__ */ r("div", { className: "flex items-center gap-2", children: [
4058
- /* @__PURE__ */ e("h2", { className: f("font-semibold", v ? "text-sm" : "text-base"), children: h }),
4059
- /* @__PURE__ */ e(
4060
- "span",
4061
- {
4062
- className: f(
4063
- "text-muted-foreground bg-muted rounded-full px-2",
4064
- v ? "text-[10px] py-0" : "text-xs py-0.5"
4065
- ),
4066
- children: F
4067
- }
4068
- )
4069
- ] }),
4070
- s && /* @__PURE__ */ r(
4071
- "button",
4072
- {
4073
- type: "button",
4074
- onClick: () => s(),
4075
- className: f(
4076
- "text-primary hover:underline flex items-center gap-0.5",
4077
- v ? "text-xs" : "text-sm"
4078
- ),
4079
- children: [
4080
- "View all",
4081
- /* @__PURE__ */ e(xt, { className: "size-3" })
4082
- ]
4083
- }
4084
- )
4085
- ]
4086
- }
4087
- ),
4088
- /* @__PURE__ */ e(
4089
- "div",
4090
- {
4091
- className: f(
4092
- "divide-y overflow-auto",
4093
- v ? "p-2 max-h-[280px]" : "p-3 max-h-[400px]"
4094
- ),
4095
- children: $.map((R) => /* @__PURE__ */ e(
4096
- Nr,
4097
- {
4098
- group: R,
4099
- onEventClick: o,
4100
- onViewMore: s ? (I) => s(I) : void 0,
4101
- compact: v
4102
- },
4103
- R.dateKey
4104
- ))
4105
- }
4106
- )
4107
- ] });
4108
- }
4109
- export {
4110
- Br as A,
4111
- jr as B,
4112
- Ir as C,
4113
- _r as D,
4114
- Hr as E,
4115
- zr as I,
4116
- Fr as S,
4117
- Te as T,
4118
- Or as U,
4119
- Pr as V,
4120
- Wr as W,
4121
- Dn as Y,
4122
- Rr as a,
4123
- $r as b,
4124
- Ar as c
4125
- };
4126
- //# sourceMappingURL=agenda-widget-DrRyLzTK.js.map