@innosolutions/inno-calendar 1.0.72 → 2.0.1

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