@mlw-packages/react-components 1.7.15 → 1.7.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -651,6 +651,13 @@ __export(index_exports, {
651
651
  MonthView: () => MonthView,
652
652
  MoreButton: () => MoreButton,
653
653
  MultiCombobox: () => MultiCombobox,
654
+ MultiSelectBase: () => MultiSelectBase,
655
+ MultiSelectContentBase: () => MultiSelectContentBase,
656
+ MultiSelectGroupBase: () => MultiSelectGroupBase,
657
+ MultiSelectItemBase: () => MultiSelectItemBase,
658
+ MultiSelectSeparatorBase: () => MultiSelectSeparatorBase,
659
+ MultiSelectTriggerBase: () => MultiSelectTriggerBase,
660
+ MultiSelectValueBase: () => MultiSelectValueBase,
654
661
  NavigationMenuBase: () => NavigationMenuBase,
655
662
  NavigationMenuContentBase: () => NavigationMenuContentBase,
656
663
  NavigationMenuIndicatorBase: () => NavigationMenuIndicatorBase,
@@ -729,7 +736,6 @@ __export(index_exports, {
729
736
  StartHour: () => StartHour,
730
737
  StatusIndicator: () => StatusIndicator,
731
738
  SwitchBase: () => SwitchBase,
732
- TITLE_CLASSNAME: () => TITLE_CLASSNAME,
733
739
  TableBase: () => TableBase,
734
740
  TableBodyBase: () => TableBodyBase,
735
741
  TableCaptionBase: () => TableCaptionBase,
@@ -761,31 +767,16 @@ __export(index_exports, {
761
767
  VisibilityButton: () => VisibilityButton,
762
768
  WeekCellsHeight: () => WeekCellsHeight,
763
769
  WeekView: () => WeekView,
764
- adaptDataForTooltip: () => adaptDataForTooltip,
765
770
  addHoursToDate: () => addHoursToDate,
766
771
  badgeVariants: () => badgeVariants,
767
- buildPercentFormatter: () => buildPercentFormatter,
768
772
  buttonVariantsBase: () => buttonVariantsBase,
769
773
  compactTick: () => compactTick,
770
- computeAllKeys: () => computeAllKeys,
771
- computeAxisLabelWidth: () => computeAxisLabelWidth,
772
- computeChartWidth: () => computeChartWidth,
773
- computeEstimatedAxisNeeded: () => computeEstimatedAxisNeeded,
774
- computeLabelSample: () => computeLabelSample,
775
- computeLeftRightKeys: () => computeLeftRightKeys,
776
- computeNiceMax: () => computeNiceMax,
777
- computeProcessedData: () => computeProcessedData,
778
- computeSeriesOrder: () => computeSeriesOrder,
779
774
  convert12HourTo24Hour: () => convert12HourTo24Hour,
780
- createFinalValueFormatter: () => createFinalValueFormatter,
781
- createYTickFormatter: () => createYTickFormatter,
782
775
  detectDataFields: () => detectDataFields,
783
776
  detectXAxis: () => detectXAxis,
784
777
  display12HourValue: () => display12HourValue,
785
- estimateTextWidth: () => estimateTextWidth,
786
778
  formatFieldName: () => formatFieldName,
787
779
  generateAdditionalColors: () => generateAdditionalColors,
788
- generateColors: () => generateColors,
789
780
  getAgendaEventsForDay: () => getAgendaEventsForDay,
790
781
  getAllEventsForDay: () => getAllEventsForDay,
791
782
  getArrowByType: () => getArrowByType,
@@ -806,9 +797,8 @@ __export(index_exports, {
806
797
  isValid12Hour: () => isValid12Hour,
807
798
  isValidHour: () => isValidHour,
808
799
  isValidMinuteOrSecond: () => isValidMinuteOrSecond,
809
- maxForKeys: () => maxForKeys,
810
- minForKeys: () => minForKeys,
811
800
  niceCeil: () => niceCeil,
801
+ renderInsideBarLabel: () => renderInsideBarLabel,
812
802
  renderPillLabel: () => pillLabelRenderer_default,
813
803
  resolveChartMargins: () => resolveChartMargins,
814
804
  resolveContainerPaddingLeft: () => resolveContainerPaddingLeft,
@@ -821,12 +811,10 @@ __export(index_exports, {
821
811
  toast: () => toast2,
822
812
  useCalendarDnd: () => useCalendarDnd,
823
813
  useChartHighlights: () => useChartHighlights,
824
- useChartLayout: () => useChartLayout,
825
814
  useCurrentTimeIndicator: () => useCurrentTimeIndicator,
826
815
  useDrag: () => useDrag,
827
816
  useEventVisibility: () => useEventVisibility,
828
817
  useIsMobile: () => useIsMobile,
829
- useMeasureWidth: () => useMeasureWidth,
830
818
  useTheme: () => useTheme
831
819
  });
832
820
  module.exports = __toCommonJS(index_exports);
@@ -2406,7 +2394,7 @@ function AvatarCombobox({
2406
2394
  }
2407
2395
 
2408
2396
  // src/components/charts/Chart.tsx
2409
- var import_react23 = require("react");
2397
+ var import_react21 = require("react");
2410
2398
  var import_recharts = require("recharts");
2411
2399
 
2412
2400
  // src/components/charts/utils/helpers.ts
@@ -2763,7 +2751,7 @@ var Highlights = ({
2763
2751
  const label = mapperConfig[k]?.label ?? k;
2764
2752
  const color = finalColors[k];
2765
2753
  const pillClasses = cn(
2766
- "inline-flex items-center gap-2 px-3 py-1 rounded-full text-sm border transition-all select-none relative overflow-hidden",
2754
+ "inline-flex items-center gap-2 px-2 rounded-lg text-xs border transition-all select-none relative overflow-hidden h-7",
2767
2755
  isHighlighted ? "pr-8" : "",
2768
2756
  isHighlighted ? "bg-card/95 border-2 text-foreground shadow-[0_6px_18px_rgba(0,0,0,0.12)]" : "bg-muted/10 border-border text-muted-foreground hover:bg-muted/5"
2769
2757
  );
@@ -2798,7 +2786,7 @@ var Highlights = ({
2798
2786
  style: {
2799
2787
  backgroundColor: color,
2800
2788
  borderColor: isHighlighted ? color : "transparent",
2801
- boxShadow: isHighlighted ? `0 6px 20px ${color}33` : void 0
2789
+ boxShadow: isHighlighted ? `0 6px 10px ${color}33` : void 0
2802
2790
  },
2803
2791
  layout: true,
2804
2792
  initial: { scale: 0.8, opacity: 0.9 },
@@ -2813,7 +2801,7 @@ var Highlights = ({
2813
2801
  showFullLabel ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
2814
2802
  import_framer_motion8.motion.span,
2815
2803
  {
2816
- className: "truncate max-w-[10rem] pr-2",
2804
+ className: "truncate max-w-[10rem] mt-0.5",
2817
2805
  layout: true,
2818
2806
  children: label
2819
2807
  }
@@ -3815,107 +3803,8 @@ var TooltipSimple = ({
3815
3803
  };
3816
3804
  var TooltipSimple_default = TooltipSimple;
3817
3805
 
3818
- // src/components/charts/NoData.tsx
3819
- var import_jsx_runtime27 = require("react/jsx-runtime");
3820
- var NoData = ({
3821
- paddingLeft = 0,
3822
- height = 360,
3823
- message = "Sem dados para exibir",
3824
- className
3825
- }) => {
3826
- const svgHeight = typeof height === "number" ? height : 360;
3827
- const bars = [
3828
- { x: 120, w: 120, h: svgHeight * 0.45, label: "Label 0" },
3829
- { x: 260, w: 120, h: svgHeight * 0.75, label: "Label 1" },
3830
- { x: 400, w: 120, h: svgHeight * 0.65, label: "Label 2" },
3831
- { x: 540, w: 120, h: svgHeight * 0.55, label: "Label 3" },
3832
- { x: 680, w: 120, h: svgHeight * 0.25, label: "Label 4" }
3833
- ];
3834
- const styleVars = {
3835
- ["--pl"]: `${paddingLeft}px`,
3836
- ["--svg-h"]: typeof height === "number" ? `${height}px` : String(height)
3837
- };
3838
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
3839
- "div",
3840
- {
3841
- className: cn(
3842
- "rounded-lg bg-card p-2 relative overflow-visible w-full",
3843
- className
3844
- ),
3845
- style: styleVars,
3846
- role: "img",
3847
- "aria-label": message,
3848
- children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "w-full flex items-center justify-center pl-[var(--pl)] pr-3 h-[var(--svg-h)]", children: /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "w-full max-w-[900px] relative", children: [
3849
- /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
3850
- "svg",
3851
- {
3852
- className: "w-full h-[var(--svg-h)]",
3853
- width: "100%",
3854
- viewBox: `0 0 900 ${svgHeight}`,
3855
- preserveAspectRatio: "none",
3856
- children: [
3857
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
3858
- "rect",
3859
- {
3860
- x: 0,
3861
- y: 0,
3862
- width: 900,
3863
- height: svgHeight,
3864
- fill: "transparent"
3865
- }
3866
- ),
3867
- Array.from({ length: 5 }).map((_, i) => {
3868
- const y = 40 + (svgHeight - 80) / 4 * i;
3869
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
3870
- "line",
3871
- {
3872
- x1: 60,
3873
- x2: 840,
3874
- y1: y,
3875
- y2: y,
3876
- stroke: "rgba(0,0,0,0.06)",
3877
- strokeWidth: 1
3878
- },
3879
- `g-${i}`
3880
- );
3881
- }),
3882
- bars.map((b, i) => /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("g", { children: [
3883
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
3884
- "rect",
3885
- {
3886
- x: b.x,
3887
- y: svgHeight - 60 - b.h,
3888
- width: b.w,
3889
- height: b.h,
3890
- rx: 6,
3891
- fill: "rgba(0,0,0,0.06)",
3892
- stroke: "rgba(0,0,0,0.04)"
3893
- }
3894
- ),
3895
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
3896
- "text",
3897
- {
3898
- x: b.x + b.w / 2,
3899
- y: svgHeight - 20,
3900
- fill: "rgba(0,0,0,0.35)",
3901
- fontSize: 12,
3902
- textAnchor: "middle",
3903
- children: b.label
3904
- }
3905
- )
3906
- ] }, `barg-${i}`))
3907
- ]
3908
- }
3909
- ),
3910
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "absolute inset-0 flex items-center justify-center pointer-events-none h-[var(--svg-h)]", children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "pointer-events-auto bg-transparent px-3", children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "text-2xl font-extrabold text-black/80", children: message }) }) })
3911
- ] }) })
3912
- }
3913
- );
3914
- };
3915
- var NoData_default = NoData;
3916
-
3917
3806
  // src/components/charts/utils/pillLabelRenderer.tsx
3918
- var import_jsx_runtime28 = require("react/jsx-runtime");
3807
+ var import_jsx_runtime27 = require("react/jsx-runtime");
3919
3808
  var formatCompactNumber = (value) => {
3920
3809
  const isNegative = value < 0;
3921
3810
  const absValue = Math.abs(value);
@@ -3960,7 +3849,7 @@ var renderPillLabel = (color, variant, valueFormatter2) => {
3960
3849
  40,
3961
3850
  String(text).length * approxCharWidth + paddingX * 2
3962
3851
  );
3963
- const pillHeight = 20;
3852
+ const pillHeight = 14;
3964
3853
  const xNum = parseNumber(x);
3965
3854
  const px = parseNumber(props.x);
3966
3855
  const pWidth = parseNumber(props.width);
@@ -4006,8 +3895,8 @@ var renderPillLabel = (color, variant, valueFormatter2) => {
4006
3895
  } else {
4007
3896
  textColor = "#374151";
4008
3897
  }
4009
- return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("g", { children: [
4010
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3898
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("g", { children: [
3899
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
4011
3900
  "rect",
4012
3901
  {
4013
3902
  x: rectX,
@@ -4020,13 +3909,13 @@ var renderPillLabel = (color, variant, valueFormatter2) => {
4020
3909
  strokeWidth: rectStroke ? 1 : 0
4021
3910
  }
4022
3911
  ),
4023
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3912
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
4024
3913
  "text",
4025
3914
  {
4026
3915
  x: textX,
4027
- y: textY + 2,
3916
+ y: textY + 1,
4028
3917
  fill: textColor,
4029
- fontSize: 13,
3918
+ fontSize: 10,
4030
3919
  fontWeight: 700,
4031
3920
  textAnchor: "middle",
4032
3921
  dominantBaseline: "central",
@@ -4038,414 +3927,369 @@ var renderPillLabel = (color, variant, valueFormatter2) => {
4038
3927
  };
4039
3928
  };
4040
3929
  var pillLabelRenderer_default = renderPillLabel;
4041
-
4042
- // src/components/charts/utils/dataStats.ts
4043
- function maxForKeys(processedData, keys) {
4044
- let max = 0;
4045
- for (const row of processedData) {
4046
- const r = row;
4047
- for (const key of keys) {
4048
- const v = r[key];
4049
- if (typeof v === "number" && Number.isFinite(v) && v > max)
4050
- max = v;
4051
- }
4052
- }
4053
- return max;
4054
- }
4055
- function minForKeys(processedData, keys) {
4056
- let min = 0;
4057
- for (const row of processedData) {
4058
- const r = row;
4059
- for (const key of keys) {
4060
- const v = r[key];
4061
- if (typeof v === "number" && Number.isFinite(v) && v < min)
4062
- min = v;
4063
- }
4064
- }
4065
- return min;
4066
- }
4067
-
4068
- // src/components/charts/utils/formatters.ts
4069
- var TITLE_CLASSNAME = "text-xl font-semibold text-foreground mb-3";
4070
- function buildPercentFormatter(decimals = 0) {
4071
- return (v) => {
4072
- const n = Number(String(v));
4073
- if (Number.isNaN(n)) return String(v ?? "");
4074
- const value = Math.abs(n) <= 1 ? n * 100 : n;
4075
- return `${value.toFixed(decimals)}%`;
4076
- };
4077
- }
4078
- function createFinalValueFormatter(valueFormatter2, formatBR) {
4079
- const nf = new Intl.NumberFormat("pt-BR", {
4080
- minimumFractionDigits: 2,
4081
- maximumFractionDigits: 2
4082
- });
4083
- if (valueFormatter2) {
4084
- if (formatBR) {
4085
- const wrapped = (props) => {
4086
- const { value, formattedValue } = props;
4087
- let num = NaN;
4088
- if (typeof value === "number") num = value;
4089
- else if (typeof value === "string" && value.trim() !== "") {
4090
- const parsed = Number(value);
4091
- num = Number.isNaN(parsed) ? NaN : parsed;
4092
- }
4093
- const brFormatted = !Number.isNaN(num) ? nf.format(num) : String(formattedValue ?? value ?? "");
4094
- return valueFormatter2({
4095
- ...props,
4096
- formattedValue: brFormatted,
4097
- value: void 0
4098
- });
4099
- };
4100
- return wrapped;
4101
- }
4102
- return valueFormatter2;
4103
- }
4104
- if (!formatBR) return void 0;
4105
- const builtIn = (props) => {
4106
- const { value, formattedValue } = props;
4107
- let num = NaN;
4108
- if (typeof value === "number") num = value;
4109
- else if (typeof value === "string" && value.trim() !== "") {
4110
- const parsed = Number(value);
4111
- num = Number.isNaN(parsed) ? NaN : parsed;
4112
- }
4113
- if (!Number.isNaN(num)) return String(nf.format(num));
4114
- return String(formattedValue ?? value ?? "");
4115
- };
4116
- return builtIn;
4117
- }
4118
- function createYTickFormatter(finalValueFormatter) {
4119
- const nf = new Intl.NumberFormat("pt-BR", {
4120
- minimumFractionDigits: 2,
4121
- maximumFractionDigits: 2
4122
- });
4123
- const stripCurrency = (s) => String(s).replace(/^\s*R\$\s?/, "");
4124
- if (finalValueFormatter) {
4125
- return (v) => {
4126
- const num = Number(String(v));
4127
- const formatted = Number.isNaN(num) ? String(v ?? "") : nf.format(num);
4128
- const out = finalValueFormatter({
4129
- value: v,
4130
- formattedValue: formatted
4131
- });
4132
- return stripCurrency(String(out));
3930
+ var renderInsideBarLabel = (color, valueFormatter2) => {
3931
+ return (props) => {
3932
+ const { x, y, value, width, height, viewBox, cx, cy, index } = props;
3933
+ const defaultFormatted = typeof value === "number" ? formatCompactNumber(value) : String(value ?? "");
3934
+ const text = valueFormatter2 ? valueFormatter2({ value, formattedValue: defaultFormatted, ...props }) : defaultFormatted;
3935
+ const parseNumberLocal = (v) => {
3936
+ if (typeof v === "number") return v;
3937
+ if (typeof v === "string" && v.trim() !== "" && !Number.isNaN(Number(v)))
3938
+ return Number(v);
3939
+ return void 0;
4133
3940
  };
4134
- }
4135
- return (value) => {
4136
- const num = Number(String(value));
4137
- return Number.isNaN(num) ? String(value ?? "") : nf.format(num);
4138
- };
4139
- }
4140
-
4141
- // src/components/charts/utils/generateColorMap.ts
4142
- function generateColors(dataKeys, colors2, mapperConfig) {
4143
- const colorMap = {};
4144
- const allColors = generateAdditionalColors(colors2, dataKeys.length);
4145
- dataKeys.forEach((key, index) => {
4146
- colorMap[key] = mapperConfig[key]?.color || allColors[index] || colors2[index % colors2.length];
4147
- });
4148
- return colorMap;
4149
- }
4150
-
4151
- // src/components/charts/utils/tooltip.ts
4152
- function adaptDataForTooltip(universalData, xAxisKey) {
4153
- const out = {};
4154
- for (const k of Object.keys(universalData)) {
4155
- const v = universalData[k];
4156
- if (typeof v === "number") out[k] = v;
4157
- else if (typeof v === "string") out[k] = v;
4158
- else if (v === null || v === void 0) out[k] = "";
4159
- else out[k] = String(v);
4160
- }
4161
- out.name = String(
4162
- universalData[xAxisKey] ?? universalData.name ?? "N/A"
4163
- );
4164
- return out;
4165
- }
4166
-
4167
- // src/components/charts/utils/measure.ts
4168
- function estimateTextWidth(text) {
4169
- const s = String(text ?? "");
4170
- if (typeof document === "undefined") return Math.min(200, s.length * 8 + 12);
4171
- const canvas = document.createElement("canvas");
4172
- const ctx = canvas.getContext("2d");
4173
- if (!ctx) return Math.min(200, s.length * 8 + 12);
4174
- ctx.font = "12px system-ui, -apple-system, 'Segoe UI', Roboto";
4175
- const w = Math.ceil(ctx.measureText(s).width) + 12;
4176
- return Math.min(300, w);
4177
- }
4178
-
4179
- // src/components/charts/utils/chartHelpers.ts
4180
- function computeSeriesOrder(series, mapperConfig) {
4181
- const seriesOrder = [];
4182
- if (series) {
4183
- if (series.bar)
4184
- series.bar.forEach((k) => seriesOrder.push({ type: "bar", key: k }));
4185
- if (series.line)
4186
- series.line.forEach((k) => seriesOrder.push({ type: "line", key: k }));
4187
- if (series.area)
4188
- series.area.forEach((k) => seriesOrder.push({ type: "area", key: k }));
4189
- } else {
4190
- Object.keys(mapperConfig).forEach(
4191
- (k) => seriesOrder.push({ type: "bar", key: k })
4192
- );
4193
- }
4194
- return seriesOrder;
4195
- }
4196
- function computeProcessedData(data, xAxisKey) {
4197
- return data.map((item) => ({
4198
- ...item,
4199
- name: String(item[xAxisKey] ?? "N/A")
4200
- }));
4201
- }
4202
- function computeAllKeys(seriesOrder) {
4203
- return seriesOrder.map((s) => s.key).filter(Boolean);
4204
- }
4205
- function computeLeftRightKeys(allKeys, yAxisMap) {
4206
- const normalize = (v) => {
4207
- if (v === "left" || v === "right") return v;
4208
- if (v === 1 || v === "1" || v === true) return "right";
4209
- return "left";
4210
- };
4211
- const leftKeys = !yAxisMap ? allKeys : allKeys.filter((k) => normalize(yAxisMap?.[k]) === "left");
4212
- const rightKeys = !yAxisMap ? [] : allKeys.filter((k) => normalize(yAxisMap?.[k]) === "right");
4213
- return { leftKeys, rightKeys };
4214
- }
4215
- function computeNiceMax(value) {
4216
- let padding = 0.08;
4217
- if (value > 1e6) padding = 0.05;
4218
- if (value > 1e7) padding = 0.03;
4219
- if (value === 0) padding = 0.12;
4220
- const padded = value * (1 + padding);
4221
- return padded;
4222
- }
4223
- function computeChartWidth(dataLength, seriesCounts, niceMax, opts) {
4224
- const basePerPoint = 60;
4225
- const perBarExtra = seriesCounts.bar > 0 ? Math.max(0, seriesCounts.bar - 1) * 8 : 0;
4226
- const perOtherExtra = (seriesCounts.line + seriesCounts.area) * 4;
4227
- let sizeFactor = 1;
4228
- if (niceMax > 1e5) sizeFactor = 1.1;
4229
- if (niceMax > 1e6) sizeFactor = 1.2;
4230
- if (niceMax > 1e7) sizeFactor = 1.3;
4231
- const perPoint = Math.round(
4232
- (basePerPoint + perBarExtra + perOtherExtra) * sizeFactor
4233
- );
4234
- const marginExtra = 120;
4235
- const calculated = Math.max(1, dataLength) * perPoint + marginExtra;
4236
- const minWidth = opts?.minWidth ?? 300;
4237
- const maxWidth = opts?.maxWidth ?? 1800;
4238
- return Math.max(minWidth, Math.min(maxWidth, calculated));
4239
- }
4240
- function computeLabelSample(keys, candidates, yTickFormatter) {
4241
- if (!keys || keys.length === 0) return "";
4242
- return String(
4243
- candidates.map((v) => yTickFormatter(v)).sort((a, b) => String(b).length - String(a).length)[0] ?? ""
4244
- );
4245
- }
4246
- function computeEstimatedAxisNeeded(labelSample, axisLabel, containerPaddingLeft = 16, defaultLeftMargin = 0) {
4247
- const tickW = labelSample ? estimateTextWidth(labelSample) : 0;
4248
- const axisW = axisLabel ? estimateTextWidth(axisLabel) + 8 : 0;
4249
- return Math.max(
4250
- defaultLeftMargin,
4251
- Math.ceil(tickW + axisW + containerPaddingLeft / 2)
4252
- );
4253
- }
4254
- function computeAxisLabelWidth(label) {
4255
- return label ? estimateTextWidth(label) : 0;
4256
- }
4257
-
4258
- // src/components/charts/hooks/useMeasureWidth.ts
4259
- var import_react21 = require("react");
4260
- function useMeasureWidth() {
4261
- const wrapperRef = (0, import_react21.useRef)(null);
4262
- const [measuredWidth, setMeasuredWidth] = (0, import_react21.useState)(null);
4263
- (0, import_react21.useLayoutEffect)(() => {
4264
- const el = wrapperRef.current;
4265
- if (!el) return;
4266
- const ro = new ResizeObserver((entries) => {
4267
- const r = entries[0];
4268
- if (r && typeof r.contentRect.width === "number") {
4269
- setMeasuredWidth(Math.round(r.contentRect.width));
3941
+ const px = parseNumberLocal(x);
3942
+ const py = parseNumberLocal(y);
3943
+ const pWidth = parseNumberLocal(width);
3944
+ const pHeight = parseNumberLocal(height);
3945
+ const cxNum = parseNumberLocal(cx);
3946
+ const vb = viewBox;
3947
+ let centerX;
3948
+ if (typeof px === "number" && typeof pWidth === "number") {
3949
+ centerX = px + pWidth / 2;
3950
+ } else if (typeof cxNum === "number") {
3951
+ centerX = cxNum;
3952
+ } else if (vb && typeof vb.x === "number" && typeof vb.width === "number") {
3953
+ const approxCols = Math.max(1, index + 1);
3954
+ const colWidth = vb.width / approxCols;
3955
+ centerX = (vb.x ?? 0) + colWidth * (index + 0.5);
3956
+ } else {
3957
+ centerX = typeof index === "number" ? index * 40 + 24 : 0;
3958
+ }
3959
+ let centerY;
3960
+ if (typeof py === "number" && typeof pHeight === "number") {
3961
+ centerY = py + pHeight / 2;
3962
+ } else if (typeof cy === "number") {
3963
+ centerY = cy;
3964
+ } else if (vb && typeof vb.y === "number" && typeof vb.height === "number") {
3965
+ centerY = (vb.y ?? 0) + (vb.height ?? 0) / 2;
3966
+ } else {
3967
+ centerY = 0;
3968
+ }
3969
+ const baseFontSize = 10;
3970
+ let fontSize = baseFontSize;
3971
+ if (typeof pWidth === "number") {
3972
+ const padding = 7;
3973
+ const approxCharWidth = 7;
3974
+ const requiredWidth = String(text).length * approxCharWidth + padding * 2;
3975
+ const widthScale = Math.min(1, pWidth / Math.max(1, requiredWidth));
3976
+ fontSize = Math.max(1, Math.round(baseFontSize * widthScale));
3977
+ }
3978
+ if (typeof pHeight === "number") {
3979
+ const heightRef = 14;
3980
+ const heightFactor = Math.max(0.8, Math.min(1.6, pHeight / heightRef));
3981
+ fontSize = Math.min(18, Math.max(8, Math.round(fontSize * heightFactor)));
3982
+ }
3983
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
3984
+ "text",
3985
+ {
3986
+ x: centerX,
3987
+ y: centerY,
3988
+ fill: "#ffffff",
3989
+ fontSize,
3990
+ fontWeight: 700,
3991
+ textAnchor: "middle",
3992
+ dominantBaseline: "central",
3993
+ style: { pointerEvents: "none" },
3994
+ children: text
4270
3995
  }
4271
- });
4272
- ro.observe(el);
4273
- setMeasuredWidth(Math.round(el.getBoundingClientRect().width));
4274
- return () => ro.disconnect();
4275
- }, []);
4276
- return { wrapperRef, measuredWidth };
4277
- }
4278
-
4279
- // src/components/charts/hooks/useChartLayout.ts
4280
- var import_react22 = require("react");
4281
- function useChartLayout(args) {
4282
- const {
4283
- width,
4284
- measuredWidth,
4285
- points,
4286
- seriesCounts,
4287
- niceMax,
4288
- yAxes,
4289
- yAxisLabel,
4290
- chartMargin,
4291
- showLabels,
4292
- showLegend,
4293
- xAxisLabel,
4294
- leftLabelSample,
4295
- rightLabelSample
4296
- } = args;
4297
- const containerPaddingLeft = 16;
4298
- const defaultChartRightMargin = 30;
4299
- const defaultChartLeftMargin = 0;
4300
- const computedWidth = (0, import_react22.useMemo)(() => {
4301
- if (typeof width === "number") return width;
4302
- return computeChartWidth(points, seriesCounts, niceMax, {
4303
- minWidth: 300,
4304
- maxWidth: 1800
4305
- });
4306
- }, [
4307
- width,
4308
- points,
4309
- seriesCounts.bar,
4310
- seriesCounts.line,
4311
- seriesCounts.area,
4312
- niceMax
4313
- ]);
4314
- const measuredInner = measuredWidth ? Math.max(0, measuredWidth - 32) : void 0;
4315
- const effectiveChartWidth = typeof width === "number" ? width : measuredInner ?? computedWidth;
4316
- const estimatedLeftNeeded = computeEstimatedAxisNeeded(
4317
- leftLabelSample ?? "",
4318
- yAxisLabel,
4319
- containerPaddingLeft,
4320
- defaultChartLeftMargin
4321
- );
4322
- const estimatedRightNeeded = computeEstimatedAxisNeeded(
4323
- rightLabelSample ?? "",
4324
- yAxes?.right?.label,
4325
- containerPaddingLeft,
4326
- defaultChartRightMargin
4327
- );
4328
- const finalChartLeftMargin = chartMargin?.left ?? Math.max(estimatedLeftNeeded, yAxisLabel ? 40 : defaultChartLeftMargin);
4329
- const finalChartRightMargin = chartMargin?.right ?? Math.max(defaultChartRightMargin, estimatedRightNeeded);
4330
- const finalChartTopMargin = chartMargin?.top ?? (showLabels ? 48 : 20);
4331
- const baseBottom = chartMargin?.bottom ?? 5;
4332
- const extraForXAxisLabel = xAxisLabel ? 22 : 0;
4333
- const extraForLegend = showLegend ? 36 : 0;
4334
- const finalChartBottomMargin = baseBottom + extraForXAxisLabel + extraForLegend;
4335
- const chartInnerWidth = effectiveChartWidth - finalChartLeftMargin - finalChartRightMargin;
4336
- const leftAxisLabelWidth = computeAxisLabelWidth(
4337
- yAxes?.left?.label ?? yAxisLabel
4338
- );
4339
- const rightAxisLabelWidth = computeAxisLabelWidth(yAxes?.right?.label);
4340
- const leftYAxisLabelDx = Math.ceil(leftAxisLabelWidth / 2) + 8;
4341
- const rightYAxisLabelDx = Math.ceil(rightAxisLabelWidth / 2) + 8;
4342
- return {
4343
- containerPaddingLeft,
4344
- computedWidth,
4345
- measuredInner,
4346
- effectiveChartWidth,
4347
- chartInnerWidth,
4348
- finalChartLeftMargin,
4349
- finalChartRightMargin,
4350
- finalChartTopMargin,
4351
- finalChartBottomMargin,
4352
- leftYAxisLabelDx,
4353
- rightYAxisLabelDx
3996
+ );
4354
3997
  };
4355
- }
3998
+ };
4356
3999
 
4357
- // src/components/charts/Chart.tsx
4358
- var import_jsx_runtime29 = require("react/jsx-runtime");
4359
- var DEFAULT_COLORS2 = ["#55af7d", "#8e68ff", "#2273e1"];
4360
- var Chart = ({
4361
- data,
4362
- series,
4363
- className,
4364
- height = 350,
4365
- width = "100%",
4366
- colors: colors2 = DEFAULT_COLORS2,
4367
- gridColor,
4368
- showGrid = true,
4369
- showTooltip = true,
4370
- showLegend = true,
4371
- title,
4372
- titlePosition = "left",
4373
- showLabels = false,
4374
- xAxis,
4375
- xAxisLabel,
4376
- yAxisLabel,
4377
- labelMap,
4378
- valueFormatter: valueFormatter2,
4379
- categoryFormatter,
4380
- enableHighlights = false,
4381
- enableShowOnly = false,
4382
- enablePeriodsDropdown = false,
4383
- enableDraggableTooltips = false,
4384
- showTooltipTotal = false,
4385
- maxTooltips = 5,
4386
- formatBR = false,
4387
- chartMargin,
4388
- yAxisMap,
4389
- yAxes,
4390
- periodLabel = "Per\xEDodo"
4000
+ // src/components/charts/NoData.tsx
4001
+ var import_jsx_runtime28 = require("react/jsx-runtime");
4002
+ var NoData = ({
4003
+ paddingLeft = 0,
4004
+ height = 360,
4005
+ message = "Sem dados para exibir",
4006
+ className
4391
4007
  }) => {
4392
- const smartConfig = (0, import_react23.useMemo)(() => {
4393
- const resolvedXAxisKey = typeof xAxis === "string" ? xAxis : xAxis && xAxis.dataKey || detectXAxis(data);
4394
- const xAxisConfig2 = typeof xAxis === "string" ? {
4395
- dataKey: resolvedXAxisKey,
4396
- label: formatFieldName(resolvedXAxisKey),
4397
- autoLabel: true
4398
- } : {
4399
- dataKey: resolvedXAxisKey,
4400
- label: xAxis?.label ?? formatFieldName(resolvedXAxisKey),
4401
- valueFormatter: xAxis?.valueFormatter,
4402
- autoLabel: xAxis?.autoLabel ?? true
4403
- };
4404
- const detectedFields = detectDataFields(data, xAxisConfig2.dataKey);
4405
- const mapperConfig2 = detectedFields.reduce((acc, field) => {
4406
- acc[field] = {
4407
- label: labelMap?.[field] ?? formatFieldName(field),
4408
- type: "number",
4409
- visible: true
4410
- };
4008
+ const svgHeight = typeof height === "number" ? height : 360;
4009
+ const bars = [
4010
+ { x: 120, w: 120, h: svgHeight * 0.45, label: "Label 0" },
4011
+ { x: 260, w: 120, h: svgHeight * 0.75, label: "Label 1" },
4012
+ { x: 400, w: 120, h: svgHeight * 0.65, label: "Label 2" },
4013
+ { x: 540, w: 120, h: svgHeight * 0.55, label: "Label 3" },
4014
+ { x: 680, w: 120, h: svgHeight * 0.25, label: "Label 4" }
4015
+ ];
4016
+ const styleVars = {
4017
+ ["--pl"]: `${paddingLeft}px`,
4018
+ ["--svg-h"]: typeof height === "number" ? `${height}px` : String(height)
4019
+ };
4020
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
4021
+ "div",
4022
+ {
4023
+ className: cn(
4024
+ "rounded-lg bg-card p-3 relative overflow-visible w-full",
4025
+ className
4026
+ ),
4027
+ style: styleVars,
4028
+ role: "img",
4029
+ "aria-label": message,
4030
+ children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "w-full flex items-center justify-center pl-[var(--pl)] pr-3 h-[var(--svg-h)]", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "w-full max-w-[900px] relative", children: [
4031
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
4032
+ "svg",
4033
+ {
4034
+ className: "w-full h-[var(--svg-h)]",
4035
+ width: "100%",
4036
+ viewBox: `0 0 900 ${svgHeight}`,
4037
+ preserveAspectRatio: "none",
4038
+ children: [
4039
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("defs", { children: [
4040
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("linearGradient", { id: "barGradient", x1: "0", x2: "0", y1: "0", y2: "1", children: [
4041
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("stop", { offset: "0%", stopColor: "#60a5fa", stopOpacity: "0.95" }),
4042
+ "= "
4043
+ ] }),
4044
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
4045
+ "filter",
4046
+ {
4047
+ id: "softShadow",
4048
+ x: "-20%",
4049
+ y: "-20%",
4050
+ width: "140%",
4051
+ height: "140%",
4052
+ children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
4053
+ "feDropShadow",
4054
+ {
4055
+ dx: "0",
4056
+ dy: "6",
4057
+ stdDeviation: "8",
4058
+ floodColor: "#0f172a",
4059
+ floodOpacity: "0.06"
4060
+ }
4061
+ )
4062
+ }
4063
+ )
4064
+ ] }),
4065
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
4066
+ "rect",
4067
+ {
4068
+ x: 0,
4069
+ y: 0,
4070
+ width: 900,
4071
+ height: svgHeight,
4072
+ fill: "transparent"
4073
+ }
4074
+ ),
4075
+ Array.from({ length: 5 }).map((_, i) => {
4076
+ const y = 40 + (svgHeight - 80) / 4 * i;
4077
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
4078
+ "line",
4079
+ {
4080
+ x1: 60,
4081
+ x2: 840,
4082
+ y1: y,
4083
+ y2: y,
4084
+ stroke: "rgba(15,23,42,0.06)",
4085
+ strokeWidth: 1
4086
+ },
4087
+ `g-${i}`
4088
+ );
4089
+ }),
4090
+ bars.map((b, i) => /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("g", { children: [
4091
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
4092
+ "rect",
4093
+ {
4094
+ x: b.x,
4095
+ y: svgHeight - 60 - b.h,
4096
+ width: b.w,
4097
+ height: b.h,
4098
+ rx: 8,
4099
+ fill: "url(#barGradient)",
4100
+ filter: "url(#softShadow)",
4101
+ opacity: 0.95
4102
+ }
4103
+ ),
4104
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
4105
+ "rect",
4106
+ {
4107
+ x: b.x,
4108
+ y: svgHeight - 60 - b.h,
4109
+ width: b.w,
4110
+ height: b.h,
4111
+ rx: 8,
4112
+ fill: "none",
4113
+ stroke: "rgba(15,23,42,0.06)"
4114
+ }
4115
+ ),
4116
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
4117
+ "text",
4118
+ {
4119
+ x: b.x + b.w / 2,
4120
+ y: svgHeight - 20,
4121
+ fill: "rgba(15,23,42,0.45)",
4122
+ fontSize: 12,
4123
+ textAnchor: "middle",
4124
+ children: b.label
4125
+ }
4126
+ )
4127
+ ] }, `barg-${i}`))
4128
+ ]
4129
+ }
4130
+ ),
4131
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "absolute inset-0 flex items-center justify-center pointer-events-none h-[var(--svg-h)]", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "pointer-events-auto bg-transparent px-3 text-center", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "text-2xl sm:text-3xl font-semibold text-black", children: message }) }) })
4132
+ ] }) })
4133
+ }
4134
+ );
4135
+ };
4136
+ var NoData_default = NoData;
4137
+
4138
+ // src/components/charts/Chart.tsx
4139
+ var import_jsx_runtime29 = require("react/jsx-runtime");
4140
+ var DEFAULT_COLORS2 = ["#55af7d", "#8e68ff", "#2273e1"];
4141
+ var Chart = ({
4142
+ data,
4143
+ series,
4144
+ className,
4145
+ height = 350,
4146
+ width = "100%",
4147
+ colors: colors2 = DEFAULT_COLORS2,
4148
+ gridColor,
4149
+ showGrid = true,
4150
+ showTooltip = true,
4151
+ showLegend = true,
4152
+ title,
4153
+ titlePosition = "left",
4154
+ showLabels = false,
4155
+ xAxis,
4156
+ biaxial,
4157
+ xAxisLabel,
4158
+ yAxisLabel,
4159
+ labelMap,
4160
+ valueFormatter: valueFormatter2,
4161
+ categoryFormatter,
4162
+ enableHighlights = false,
4163
+ enableShowOnly = false,
4164
+ enablePeriodsDropdown = false,
4165
+ enableDraggableTooltips = false,
4166
+ showTooltipTotal = false,
4167
+ periodLabel = "Per\xEDodo",
4168
+ maxTooltips = 5,
4169
+ formatBR = false,
4170
+ chartMargin
4171
+ }) => {
4172
+ const smartConfig = (0, import_react21.useMemo)(() => {
4173
+ const resolvedXAxisKey = typeof xAxis === "string" ? xAxis : xAxis && xAxis.dataKey || detectXAxis(data);
4174
+ const xAxisConfig2 = typeof xAxis === "string" ? {
4175
+ dataKey: resolvedXAxisKey,
4176
+ label: formatFieldName(resolvedXAxisKey),
4177
+ autoLabel: true
4178
+ } : {
4179
+ dataKey: resolvedXAxisKey,
4180
+ label: xAxis?.label ?? formatFieldName(resolvedXAxisKey),
4181
+ valueFormatter: xAxis?.valueFormatter,
4182
+ autoLabel: xAxis?.autoLabel ?? true
4183
+ };
4184
+ const detectedFields = detectDataFields(data, xAxisConfig2.dataKey);
4185
+ const mapperConfig2 = detectedFields.reduce((acc, field) => {
4186
+ acc[field] = {
4187
+ label: labelMap?.[field] ?? formatFieldName(field),
4188
+ type: "number",
4189
+ visible: true
4190
+ };
4411
4191
  return acc;
4412
4192
  }, {});
4413
4193
  return { xAxisConfig: xAxisConfig2, mapperConfig: mapperConfig2 };
4414
4194
  }, [data, xAxis, labelMap]);
4415
4195
  const { xAxisConfig, mapperConfig } = smartConfig;
4416
- const [activeTooltips, setActiveTooltips] = (0, import_react23.useState)([]);
4417
- const [highlightedSeries, setHighlightedSeries] = (0, import_react23.useState)(
4196
+ const [activeTooltips, setActiveTooltips] = (0, import_react21.useState)([]);
4197
+ const [highlightedSeries, setHighlightedSeries] = (0, import_react21.useState)(
4418
4198
  /* @__PURE__ */ new Set()
4419
4199
  );
4420
- const [showOnlyHighlighted, setShowOnlyHighlighted] = (0, import_react23.useState)(false);
4421
- (0, import_react23.useEffect)(() => {
4200
+ const [showOnlyHighlighted, setShowOnlyHighlighted] = (0, import_react21.useState)(false);
4201
+ (0, import_react21.useEffect)(() => {
4422
4202
  if (highlightedSeries.size === 0 && showOnlyHighlighted) {
4423
4203
  setShowOnlyHighlighted(false);
4424
4204
  }
4425
4205
  }, [highlightedSeries, showOnlyHighlighted]);
4426
- const processedData = computeProcessedData(
4427
- data,
4428
- xAxisConfig.dataKey
4429
- );
4430
- const { wrapperRef, measuredWidth } = useMeasureWidth();
4431
- const seriesOrder = computeSeriesOrder(series, mapperConfig);
4432
- const allKeys = computeAllKeys(seriesOrder);
4433
- const finalColors = (0, import_react23.useMemo)(
4434
- () => generateColors(allKeys, colors2, mapperConfig),
4435
- [allKeys, colors2, mapperConfig]
4436
- );
4437
- const adaptDataForTooltip2 = (0, import_react23.useCallback)(
4438
- (universalData) => adaptDataForTooltip(universalData, xAxisConfig.dataKey),
4206
+ const processedData = data.map((item) => ({
4207
+ ...item,
4208
+ name: String(item[xAxisConfig.dataKey] || "N/A")
4209
+ }));
4210
+ const wrapperRef = (0, import_react21.useRef)(null);
4211
+ const [measuredWidth, setMeasuredWidth] = (0, import_react21.useState)(null);
4212
+ (0, import_react21.useLayoutEffect)(() => {
4213
+ const el = wrapperRef.current;
4214
+ if (!el) return;
4215
+ const ro = new ResizeObserver((entries) => {
4216
+ const r = entries[0];
4217
+ if (r && typeof r.contentRect.width === "number") {
4218
+ setMeasuredWidth(Math.round(r.contentRect.width));
4219
+ }
4220
+ });
4221
+ ro.observe(el);
4222
+ setMeasuredWidth(Math.round(el.getBoundingClientRect().width));
4223
+ return () => ro.disconnect();
4224
+ }, []);
4225
+ const seriesOrder = [];
4226
+ if (series) {
4227
+ if (series.bar)
4228
+ series.bar.forEach((k) => seriesOrder.push({ type: "bar", key: k }));
4229
+ if (series.line)
4230
+ series.line.forEach((k) => seriesOrder.push({ type: "line", key: k }));
4231
+ if (series.area)
4232
+ series.area.forEach((k) => seriesOrder.push({ type: "area", key: k }));
4233
+ } else {
4234
+ Object.keys(mapperConfig).forEach(
4235
+ (k) => seriesOrder.push({ type: "bar", key: k })
4236
+ );
4237
+ }
4238
+ const allKeys = seriesOrder.map((s) => s.key).filter(Boolean);
4239
+ const generateColors = (0, import_react21.useCallback)(
4240
+ (dataKeys) => {
4241
+ const colorMap = {};
4242
+ const allColors = generateAdditionalColors(colors2, dataKeys.length);
4243
+ dataKeys.forEach((key, index) => {
4244
+ colorMap[key] = mapperConfig[key]?.color || allColors[index] || colors2[index % colors2.length];
4245
+ });
4246
+ return colorMap;
4247
+ },
4248
+ [colors2, mapperConfig]
4249
+ );
4250
+ const finalColors = (0, import_react21.useMemo)(
4251
+ () => generateColors(allKeys),
4252
+ [generateColors, allKeys]
4253
+ );
4254
+ const biaxialConfigNormalized = (0, import_react21.useMemo)(() => {
4255
+ if (!biaxial) return null;
4256
+ if (typeof biaxial === "string") return { key: [biaxial] };
4257
+ if (Array.isArray(biaxial)) return { key: biaxial };
4258
+ return biaxial;
4259
+ }, [biaxial]);
4260
+ (0, import_react21.useMemo)(() => {
4261
+ if (!biaxialConfigNormalized) return;
4262
+ const leftLabelMissing = !yAxisLabel || String(yAxisLabel).trim() === "";
4263
+ const rightLabelMissing = !biaxialConfigNormalized.label || String(biaxialConfigNormalized.label).trim() === "";
4264
+ if (leftLabelMissing || rightLabelMissing) {
4265
+ throw new Error(
4266
+ "When using `biaxial`, you must provide both `yAxisLabel` (left axis) and `biaxial.label` (right axis)."
4267
+ );
4268
+ }
4269
+ }, [biaxialConfigNormalized, yAxisLabel]);
4270
+ const rightKeys = (0, import_react21.useMemo)(
4271
+ () => biaxialConfigNormalized?.key ?? [],
4272
+ [biaxialConfigNormalized]
4273
+ );
4274
+ const leftKeys = (0, import_react21.useMemo)(
4275
+ () => allKeys.filter((k) => !rightKeys.includes(k)),
4276
+ [allKeys, rightKeys]
4277
+ );
4278
+ const adaptDataForTooltip = (0, import_react21.useCallback)(
4279
+ (universalData) => ({
4280
+ ...universalData,
4281
+ name: String(universalData[xAxisConfig.dataKey] || "N/A")
4282
+ }),
4439
4283
  [xAxisConfig.dataKey]
4440
4284
  );
4441
- const activePeriods = (0, import_react23.useMemo)(
4442
- () => activeTooltips.map((t) => adaptDataForTooltip2(t.data).name),
4443
- [activeTooltips, adaptDataForTooltip2]
4285
+ const activePeriods = (0, import_react21.useMemo)(
4286
+ () => activeTooltips.map((t) => adaptDataForTooltip(t.data).name),
4287
+ [activeTooltips, adaptDataForTooltip]
4444
4288
  );
4445
- (0, import_react23.useEffect)(() => {
4289
+ (0, import_react21.useEffect)(() => {
4446
4290
  window.dispatchEvent(new Event("recountTooltips"));
4447
4291
  }, [activeTooltips.length]);
4448
- const toggleHighlight = (0, import_react23.useCallback)((key) => {
4292
+ const toggleHighlight = (0, import_react21.useCallback)((key) => {
4449
4293
  setHighlightedSeries((prev) => {
4450
4294
  const next = new Set(prev);
4451
4295
  if (next.has(key)) next.delete(key);
@@ -4453,47 +4297,104 @@ var Chart = ({
4453
4297
  return next;
4454
4298
  });
4455
4299
  }, []);
4456
- const maxDataValue = (0, import_react23.useMemo)(
4457
- () => maxForKeys(processedData, allKeys),
4458
- [processedData, allKeys]
4459
- );
4460
- const minDataValue = (0, import_react23.useMemo)(
4461
- () => minForKeys(processedData, allKeys),
4462
- [processedData, allKeys]
4463
- );
4464
- const { leftKeys, rightKeys } = (0, import_react23.useMemo)(
4465
- () => computeLeftRightKeys(allKeys, yAxisMap),
4466
- [allKeys, yAxisMap]
4467
- );
4468
- const maxLeft = (0, import_react23.useMemo)(
4469
- () => maxForKeys(processedData, leftKeys),
4470
- [leftKeys, processedData]
4471
- );
4472
- const minLeft = (0, import_react23.useMemo)(
4473
- () => minForKeys(processedData, leftKeys),
4474
- [leftKeys, processedData]
4475
- );
4476
- const maxRight = (0, import_react23.useMemo)(
4477
- () => rightKeys.length > 0 ? maxForKeys(processedData, rightKeys) : 0,
4478
- [rightKeys, processedData]
4479
- );
4480
- const minRight = (0, import_react23.useMemo)(
4481
- () => rightKeys.length > 0 ? minForKeys(processedData, rightKeys) : 0,
4482
- [rightKeys, processedData]
4483
- );
4484
- const niceMaxLeft = (0, import_react23.useMemo)(
4485
- () => niceCeil(computeNiceMax(maxLeft)),
4486
- [maxLeft]
4487
- );
4488
- const niceMaxRight = (0, import_react23.useMemo)(
4489
- () => niceCeil(computeNiceMax(maxRight)),
4490
- [maxRight]
4300
+ const maxLeftDataValue = (0, import_react21.useMemo)(() => {
4301
+ let max = 0;
4302
+ const numericKeys = leftKeys.length > 0 ? leftKeys : allKeys;
4303
+ for (const row of processedData) {
4304
+ const r = row;
4305
+ for (const key of numericKeys) {
4306
+ const v = r[key];
4307
+ if (typeof v === "number" && Number.isFinite(v) && v > max) max = v;
4308
+ }
4309
+ }
4310
+ return max;
4311
+ }, [processedData, leftKeys, allKeys]);
4312
+ const minLeftDataValue = (0, import_react21.useMemo)(() => {
4313
+ let min = 0;
4314
+ const numericKeys = leftKeys.length > 0 ? leftKeys : allKeys;
4315
+ for (const row of processedData) {
4316
+ const r = row;
4317
+ for (const key of numericKeys) {
4318
+ const v = r[key];
4319
+ if (typeof v === "number" && Number.isFinite(v) && v < min)
4320
+ min = v;
4321
+ }
4322
+ }
4323
+ return min;
4324
+ }, [processedData, leftKeys, allKeys]);
4325
+ const maxRightDataValue = (0, import_react21.useMemo)(() => {
4326
+ let max = 0;
4327
+ if (rightKeys.length === 0) return max;
4328
+ for (const row of processedData) {
4329
+ const r = row;
4330
+ for (const key of rightKeys) {
4331
+ const v = r[key];
4332
+ if (typeof v === "number" && Number.isFinite(v) && v > max) max = v;
4333
+ }
4334
+ }
4335
+ return max;
4336
+ }, [processedData, rightKeys]);
4337
+ const minRightDataValue = (0, import_react21.useMemo)(() => {
4338
+ let min = 0;
4339
+ if (rightKeys.length === 0) return min;
4340
+ for (const row of processedData) {
4341
+ const r = row;
4342
+ for (const key of rightKeys) {
4343
+ const v = r[key];
4344
+ if (typeof v === "number" && Number.isFinite(v) && v < min)
4345
+ min = v;
4346
+ }
4347
+ }
4348
+ return min;
4349
+ }, [processedData, rightKeys]);
4350
+ const computeNiceMax = (0, import_react21.useCallback)((maxValue) => {
4351
+ let padding = 0.08;
4352
+ if (maxValue > 1e6) padding = 0.05;
4353
+ if (maxValue > 1e7) padding = 0.03;
4354
+ if (maxValue === 0) padding = 0.12;
4355
+ const padded = maxValue * (1 + padding);
4356
+ return niceCeil(padded);
4357
+ }, []);
4358
+ const niceMaxLeft = (0, import_react21.useMemo)(
4359
+ () => computeNiceMax(maxLeftDataValue),
4360
+ [computeNiceMax, maxLeftDataValue]
4491
4361
  );
4492
- const niceMax = (0, import_react23.useMemo)(
4493
- () => niceCeil(computeNiceMax(maxDataValue)),
4494
- [maxDataValue]
4362
+ const niceMaxRight = (0, import_react21.useMemo)(
4363
+ () => computeNiceMax(maxRightDataValue),
4364
+ [computeNiceMax, maxRightDataValue]
4495
4365
  );
4496
- const toggleTooltip = (0, import_react23.useCallback)(
4366
+ const computedWidth = (0, import_react21.useMemo)(() => {
4367
+ if (typeof width === "number") return width;
4368
+ const points = Math.max(1, processedData.length);
4369
+ const barCount = series?.bar?.length ?? 0;
4370
+ const lineCount = series?.line?.length ?? 0;
4371
+ const areaCount = series?.area?.length ?? 0;
4372
+ const basePerPoint = 60;
4373
+ const perBarExtra = barCount > 0 ? Math.max(0, barCount - 1) * 8 : 0;
4374
+ const perOtherExtra = (lineCount + areaCount) * 4;
4375
+ const overallNiceMax = Math.max(niceMaxLeft || 0, niceMaxRight || 0);
4376
+ let sizeFactor = 1;
4377
+ if (overallNiceMax > 1e5) sizeFactor = 1.1;
4378
+ if (overallNiceMax > 1e6) sizeFactor = 1.2;
4379
+ if (overallNiceMax > 1e7) sizeFactor = 1.3;
4380
+ const perPoint = Math.round(
4381
+ (basePerPoint + perBarExtra + perOtherExtra) * sizeFactor
4382
+ );
4383
+ const marginExtra = 120;
4384
+ const calculated = points * perPoint + marginExtra;
4385
+ const minWidth = 300;
4386
+ const maxWidth = 1800;
4387
+ return Math.max(minWidth, Math.min(maxWidth, calculated));
4388
+ }, [
4389
+ width,
4390
+ processedData.length,
4391
+ series?.bar?.length,
4392
+ series?.line?.length,
4393
+ series?.area?.length,
4394
+ niceMaxLeft,
4395
+ niceMaxRight
4396
+ ]);
4397
+ const toggleTooltip = (0, import_react21.useCallback)(
4497
4398
  (tooltipId, data2, basePosition) => {
4498
4399
  const existingIndex = activeTooltips.findIndex((t) => t.id === tooltipId);
4499
4400
  if (existingIndex !== -1) {
@@ -4522,7 +4423,7 @@ var Chart = ({
4522
4423
  },
4523
4424
  [activeTooltips, maxTooltips]
4524
4425
  );
4525
- const handleChartClick = (0, import_react23.useCallback)(
4426
+ const handleChartClick = (0, import_react21.useCallback)(
4526
4427
  (e) => {
4527
4428
  if (!enableDraggableTooltips) return;
4528
4429
  const ev = e;
@@ -4540,7 +4441,7 @@ var Chart = ({
4540
4441
  },
4541
4442
  [enableDraggableTooltips, xAxisConfig.dataKey, toggleTooltip]
4542
4443
  );
4543
- const handleBarClick = (0, import_react23.useCallback)(
4444
+ const handleBarClick = (0, import_react21.useCallback)(
4544
4445
  (data2, index, event) => {
4545
4446
  if (!enableDraggableTooltips) return;
4546
4447
  event.stopPropagation();
@@ -4554,7 +4455,7 @@ var Chart = ({
4554
4455
  },
4555
4456
  [enableDraggableTooltips, xAxisConfig.dataKey, toggleTooltip]
4556
4457
  );
4557
- const handleSeriesClick = (0, import_react23.useCallback)(
4458
+ const handleSeriesClick = (0, import_react21.useCallback)(
4558
4459
  (...args) => {
4559
4460
  if (args.length >= 3) {
4560
4461
  const [data2, index, event] = args;
@@ -4565,7 +4466,7 @@ var Chart = ({
4565
4466
  },
4566
4467
  [handleBarClick, handleChartClick]
4567
4468
  );
4568
- const onTooltipPositionChange = (0, import_react23.useCallback)(
4469
+ const onTooltipPositionChange = (0, import_react21.useCallback)(
4569
4470
  (id, position) => {
4570
4471
  setActiveTooltips(
4571
4472
  (prev) => prev.map((t) => t.id === id ? { ...t, position } : t)
@@ -4573,75 +4474,103 @@ var Chart = ({
4573
4474
  },
4574
4475
  []
4575
4476
  );
4576
- const titleClassName = TITLE_CLASSNAME;
4577
- const finalValueFormatter = (0, import_react23.useMemo)(
4578
- () => createFinalValueFormatter(valueFormatter2, formatBR),
4579
- [valueFormatter2, formatBR]
4580
- );
4581
- const yTickFormatter = (0, import_react23.useMemo)(
4582
- () => createYTickFormatter(finalValueFormatter),
4583
- [finalValueFormatter]
4477
+ const titleClassName = (0, import_react21.useMemo)(
4478
+ () => "text-[1.4rem] font-semibold text-foreground mb-3",
4479
+ []
4584
4480
  );
4481
+ const finalValueFormatter = (0, import_react21.useMemo)(() => {
4482
+ const nf = new Intl.NumberFormat("pt-BR", {
4483
+ minimumFractionDigits: 2,
4484
+ maximumFractionDigits: 2
4485
+ });
4486
+ if (valueFormatter2) {
4487
+ if (formatBR) {
4488
+ const wrapped = (props) => {
4489
+ const { value, formattedValue } = props;
4490
+ let num = NaN;
4491
+ if (typeof value === "number") num = value;
4492
+ else if (typeof value === "string" && value.trim() !== "") {
4493
+ const parsed = Number(value);
4494
+ num = Number.isNaN(parsed) ? NaN : parsed;
4495
+ }
4496
+ const brFormatted = !Number.isNaN(num) ? nf.format(num) : String(formattedValue ?? value ?? "");
4497
+ return valueFormatter2({
4498
+ ...props,
4499
+ formattedValue: brFormatted,
4500
+ value: void 0
4501
+ });
4502
+ };
4503
+ return wrapped;
4504
+ }
4505
+ return valueFormatter2;
4506
+ }
4507
+ if (!formatBR) return void 0;
4508
+ const builtIn = (props) => {
4509
+ const { value, formattedValue } = props;
4510
+ let num = NaN;
4511
+ if (typeof value === "number") num = value;
4512
+ else if (typeof value === "string" && value.trim() !== "") {
4513
+ const parsed = Number(value);
4514
+ num = Number.isNaN(parsed) ? NaN : parsed;
4515
+ }
4516
+ if (!Number.isNaN(num)) return nf.format(num);
4517
+ return String(formattedValue ?? value ?? "");
4518
+ };
4519
+ return builtIn;
4520
+ }, [valueFormatter2, formatBR]);
4521
+ const yTickFormatter = (0, import_react21.useMemo)(() => {
4522
+ const nf = new Intl.NumberFormat("pt-BR", {
4523
+ minimumFractionDigits: 2,
4524
+ maximumFractionDigits: 2
4525
+ });
4526
+ const stripCurrency = (s) => String(s).replace(/^\s*R\$\s?/, "");
4527
+ if (finalValueFormatter) {
4528
+ return (v) => {
4529
+ const num = Number(String(v));
4530
+ const formatted = Number.isNaN(num) ? String(v ?? "") : nf.format(num);
4531
+ const out = finalValueFormatter({
4532
+ value: v,
4533
+ formattedValue: formatted
4534
+ });
4535
+ return stripCurrency(String(out));
4536
+ };
4537
+ }
4538
+ return (value) => {
4539
+ const num = Number(String(value));
4540
+ return Number.isNaN(num) ? String(value ?? "") : nf.format(num);
4541
+ };
4542
+ }, [finalValueFormatter]);
4585
4543
  const finalEnableHighlights = enableHighlights;
4586
4544
  const finalEnableShowOnly = enableShowOnly;
4587
4545
  const finalEnablePeriodsDropdown = enablePeriodsDropdown && enableDraggableTooltips;
4588
- const leftLabelSample = (0, import_react23.useMemo)(
4589
- () => computeLabelSample(
4590
- leftKeys,
4591
- [maxLeft, minLeft, niceMaxLeft],
4592
- yTickFormatter
4593
- ),
4594
- [leftKeys, maxLeft, minLeft, niceMaxLeft, yTickFormatter]
4595
- );
4596
- const rightLabelSample = (0, import_react23.useMemo)(
4597
- () => computeLabelSample(
4598
- rightKeys,
4599
- [maxRight, minRight, niceMaxRight],
4600
- yTickFormatter
4601
- ),
4602
- [rightKeys, maxRight, minRight, niceMaxRight, yTickFormatter]
4603
- );
4604
- const {
4605
- containerPaddingLeft,
4606
- computedWidth,
4607
- measuredInner,
4608
- chartInnerWidth,
4609
- finalChartLeftMargin,
4610
- finalChartRightMargin,
4611
- finalChartTopMargin,
4612
- finalChartBottomMargin,
4613
- leftYAxisLabelDx,
4614
- rightYAxisLabelDx
4615
- } = useChartLayout({
4616
- width,
4617
- measuredWidth,
4618
- points: Math.max(1, processedData.length),
4619
- seriesCounts: {
4620
- bar: series?.bar?.length ?? 0,
4621
- line: series?.line?.length ?? 0,
4622
- area: series?.area?.length ?? 0
4623
- },
4624
- niceMax,
4625
- yAxes,
4626
- yAxisLabel,
4627
- chartMargin,
4628
- showLabels,
4629
- showLegend,
4630
- xAxisLabel,
4631
- leftLabelSample,
4632
- rightLabelSample
4633
- });
4634
- const leftAxisTickFormatter = (0, import_react23.useMemo)(() => {
4635
- if (yAxes?.left?.percent)
4636
- return buildPercentFormatter(yAxes.left.percentDecimals ?? 0);
4637
- return yTickFormatter;
4638
- }, [yAxes?.left, yTickFormatter]);
4639
- const rightAxisTickFormatter = (0, import_react23.useMemo)(() => {
4640
- if (yAxes?.right?.percent)
4641
- return buildPercentFormatter(yAxes.right.percentDecimals ?? 0);
4642
- return yTickFormatter;
4643
- }, [yAxes?.right, yTickFormatter]);
4644
- const openTooltipForPeriod = (0, import_react23.useCallback)(
4546
+ const defaultChartRightMargin = 30;
4547
+ const defaultChartLeftMargin = 0;
4548
+ const axisLabelMargin = 56;
4549
+ const containerPaddingLeft = -6;
4550
+ const finalChartRightMargin = chartMargin?.right ?? (rightKeys.length > 0 ? axisLabelMargin : defaultChartRightMargin);
4551
+ const finalChartLeftMargin = chartMargin?.left ?? (yAxisLabel ? axisLabelMargin : defaultChartLeftMargin);
4552
+ const yAxisTickWidth = (0, import_react21.useMemo)(() => {
4553
+ if (typeof chartMargin?.left === "number") return chartMargin.left;
4554
+ if (yAxisLabel) return axisLabelMargin;
4555
+ const samples = [minLeftDataValue, niceMaxLeft, Math.round((minLeftDataValue + niceMaxLeft) / 2), 0];
4556
+ const formatted = samples.map((v) => String(yTickFormatter(v)));
4557
+ const maxLen = formatted.reduce((m, s) => Math.max(m, s.length), 0);
4558
+ const estimated = Math.max(48, Math.min(220, maxLen * 8 + 24));
4559
+ return estimated;
4560
+ }, [chartMargin?.left, yAxisLabel, yTickFormatter, minLeftDataValue, niceMaxLeft]);
4561
+ const composedChartLeftMargin = chartMargin?.left ?? defaultChartLeftMargin;
4562
+ const composedChartRightMargin = chartMargin?.right ?? defaultChartRightMargin;
4563
+ const finalChartTopMargin = chartMargin?.top ?? (showLabels ? 48 : 20);
4564
+ const baseBottom = chartMargin?.bottom ?? 5;
4565
+ const extraForXAxisLabel = xAxisLabel ? 22 : 0;
4566
+ const extraForLegend = showLegend ? 36 : 0;
4567
+ const finalChartBottomMargin = baseBottom + extraForXAxisLabel + extraForLegend;
4568
+ const measuredInner = measuredWidth ? Math.max(0, measuredWidth - 32) : void 0;
4569
+ const effectiveChartWidth = typeof width === "number" ? width : measuredInner ?? computedWidth;
4570
+ const chartInnerWidth = effectiveChartWidth - composedChartLeftMargin - composedChartRightMargin;
4571
+ const leftYAxisLabelDx = -Math.max(12, Math.round(yAxisTickWidth / 2));
4572
+ const rightYAxisLabelDx = Math.max(12, Math.round(finalChartRightMargin / 2));
4573
+ const openTooltipForPeriod = (0, import_react21.useCallback)(
4645
4574
  (periodName) => {
4646
4575
  if (!enableDraggableTooltips) return;
4647
4576
  const row = processedData.find((r) => String(r.name) === periodName);
@@ -4687,11 +4616,20 @@ var Chart = ({
4687
4616
  if (!data) return null;
4688
4617
  if (Array.isArray(data) && data.length === 0) {
4689
4618
  return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
4690
- NoData_default,
4619
+ "div",
4691
4620
  {
4692
- paddingLeft: containerPaddingLeft + finalChartLeftMargin,
4693
- height,
4694
- message: "Sem dados para exibir"
4621
+ className: cn(
4622
+ "rounded-lg bg-card p-4 relative w-full text-muted-foreground"
4623
+ ),
4624
+ children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
4625
+ "div",
4626
+ {
4627
+ style: {
4628
+ paddingLeft: `${containerPaddingLeft + finalChartLeftMargin}px`
4629
+ },
4630
+ children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(NoData_default, {})
4631
+ }
4632
+ )
4695
4633
  }
4696
4634
  );
4697
4635
  }
@@ -4701,13 +4639,14 @@ var Chart = ({
4701
4639
  ref: wrapperRef,
4702
4640
  style: {
4703
4641
  width: "100%",
4704
- overflow: "visible",
4642
+ overflowX: "hidden",
4643
+ overflowY: "hidden",
4705
4644
  minWidth: 0
4706
4645
  },
4707
4646
  children: /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
4708
4647
  "div",
4709
4648
  {
4710
- className: cn("rounded-lg bg-card p-2 relative", className),
4649
+ className: cn("rounded-lg bg-card relative", className),
4711
4650
  style: { width: "100%", maxWidth: "100%", minWidth: 0 },
4712
4651
  children: [
4713
4652
  title && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
@@ -4719,9 +4658,9 @@ var Chart = ({
4719
4658
  display: "flex",
4720
4659
  justifyContent: titlePosition === "center" ? "center" : titlePosition === "right" ? "flex-end" : "flex-start",
4721
4660
  alignItems: "center",
4722
- marginTop: 4
4661
+ marginTop: "19px"
4723
4662
  },
4724
- children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("h3", { className: titleClassName, children: title })
4663
+ children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: titleClassName, children: title })
4725
4664
  }
4726
4665
  ),
4727
4666
  allKeys.length > 0 && (finalEnableHighlights || finalEnableShowOnly) && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
@@ -4837,85 +4776,33 @@ var Chart = ({
4837
4776
  },
4838
4777
  label: xAxisLabel ? {
4839
4778
  value: xAxisLabel,
4840
- position: "bottom",
4841
- offset: 12,
4779
+ position: "insideBottomRight",
4780
+ offset: -5,
4842
4781
  style: {
4843
4782
  fontSize: 12,
4844
4783
  fill: "hsl(var(--muted-foreground))",
4845
- fontWeight: 500
4846
- }
4847
- } : void 0
4848
- }
4849
- ),
4850
- rightKeys.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_jsx_runtime29.Fragment, { children: [
4851
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
4852
- import_recharts.YAxis,
4853
- {
4854
- yAxisId: "left",
4855
- stroke: yAxes?.left?.stroke || "hsl(var(--muted-foreground))",
4856
- width: yAxes?.left?.width,
4857
- fontSize: 12,
4858
- tickLine: false,
4859
- axisLine: false,
4860
- tickFormatter: leftAxisTickFormatter,
4861
- domain: [Math.min(minLeft, 0), niceMaxLeft],
4862
- tickCount: 6,
4863
- label: yAxes?.left?.label ?? yAxisLabel ? {
4864
- value: yAxes?.left?.label ?? yAxisLabel,
4865
- angle: -90,
4866
- position: "left",
4867
- dx: -leftYAxisLabelDx,
4868
- style: {
4869
- fontSize: 12,
4870
- fill: "hsl(var(--muted-foreground))",
4871
- fontWeight: 500,
4872
- textAnchor: "middle"
4873
- }
4874
- } : void 0
4875
- }
4876
- ),
4877
- /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
4878
- import_recharts.YAxis,
4879
- {
4880
- yAxisId: "right",
4881
- orientation: "right",
4882
- stroke: yAxes?.right?.stroke || "hsl(var(--muted-foreground))",
4883
- width: yAxes?.right?.width,
4884
- fontSize: 12,
4885
- tickLine: false,
4886
- axisLine: false,
4887
- tickFormatter: rightAxisTickFormatter,
4888
- domain: [Math.min(minRight, 0), niceMaxRight],
4889
- tickCount: 6,
4890
- label: yAxes?.right?.label ? {
4891
- value: yAxes?.right?.label,
4892
- angle: -90,
4893
- position: "right",
4894
- dx: rightYAxisLabelDx,
4895
- style: {
4896
- fontSize: 12,
4897
- fill: "hsl(var(--muted-foreground))",
4898
- fontWeight: 500,
4899
- textAnchor: "middle"
4900
- }
4901
- } : void 0
4902
- }
4903
- )
4904
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_jsx_runtime29.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
4784
+ fontWeight: 500
4785
+ }
4786
+ } : void 0
4787
+ }
4788
+ ),
4789
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
4905
4790
  import_recharts.YAxis,
4906
4791
  {
4792
+ yAxisId: "left",
4793
+ width: yAxisTickWidth,
4907
4794
  stroke: "hsl(var(--muted-foreground))",
4908
4795
  fontSize: 12,
4909
4796
  tickLine: false,
4910
4797
  axisLine: false,
4911
4798
  tickFormatter: yTickFormatter,
4912
- domain: [Math.min(minDataValue, 0), niceMax],
4799
+ domain: [Math.min(minLeftDataValue, 0), niceMaxLeft],
4913
4800
  tickCount: 6,
4914
4801
  label: yAxisLabel ? {
4915
4802
  value: yAxisLabel,
4916
4803
  angle: -90,
4917
4804
  position: "left",
4918
- dx: -leftYAxisLabelDx,
4805
+ dx: leftYAxisLabelDx,
4919
4806
  style: {
4920
4807
  fontSize: 12,
4921
4808
  fill: "hsl(var(--muted-foreground))",
@@ -4924,38 +4811,88 @@ var Chart = ({
4924
4811
  }
4925
4812
  } : void 0
4926
4813
  }
4927
- ) }),
4928
- (minDataValue < 0 || minLeft < 0 || minRight < 0) && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
4814
+ ),
4815
+ minLeftDataValue < 0 && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
4929
4816
  import_recharts.ReferenceLine,
4930
4817
  {
4931
4818
  y: 0,
4819
+ yAxisId: "left",
4932
4820
  stroke: "hsl(var(--muted-foreground))",
4933
4821
  strokeWidth: 1,
4934
4822
  strokeDasharray: "4 4"
4935
4823
  }
4936
4824
  ),
4825
+ rightKeys.length > 0 && (() => {
4826
+ const decimals = typeof biaxialConfigNormalized?.decimals === "number" ? Math.max(0, Math.floor(biaxialConfigNormalized.decimals)) : 2;
4827
+ const rightTickFormatter = (v) => {
4828
+ if (biaxialConfigNormalized?.percentage) {
4829
+ const num = Number(String(v));
4830
+ const nf = new Intl.NumberFormat("pt-BR", {
4831
+ minimumFractionDigits: decimals,
4832
+ maximumFractionDigits: decimals
4833
+ });
4834
+ const out = Number.isNaN(num) ? String(v ?? "") : nf.format(num);
4835
+ return `${out}%`;
4836
+ }
4837
+ return yTickFormatter(v);
4838
+ };
4839
+ const firstRightKey = biaxialConfigNormalized?.key && biaxialConfigNormalized.key[0];
4840
+ const defaultRightColor = firstRightKey && finalColors[firstRightKey] || "hsl(var(--muted-foreground))";
4841
+ const rightAxisColor = (() => {
4842
+ if (!biaxialConfigNormalized) return defaultRightColor;
4843
+ if (typeof biaxialConfigNormalized.stroke === "string")
4844
+ return biaxialConfigNormalized.stroke;
4845
+ if (biaxialConfigNormalized.stroke && firstRightKey && typeof biaxialConfigNormalized.stroke === "object")
4846
+ return biaxialConfigNormalized.stroke[firstRightKey] || defaultRightColor;
4847
+ return defaultRightColor;
4848
+ })();
4849
+ return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
4850
+ import_recharts.YAxis,
4851
+ {
4852
+ yAxisId: "right",
4853
+ width: finalChartRightMargin,
4854
+ orientation: "right",
4855
+ stroke: "hsl(var(--muted-foreground))",
4856
+ fontSize: 12,
4857
+ tickLine: false,
4858
+ axisLine: false,
4859
+ tick: { fill: rightAxisColor },
4860
+ tickFormatter: rightTickFormatter,
4861
+ domain: [Math.min(minRightDataValue, 0), niceMaxRight],
4862
+ tickCount: 6,
4863
+ label: biaxialConfigNormalized?.label ? {
4864
+ value: biaxialConfigNormalized.label,
4865
+ angle: -90,
4866
+ position: "right",
4867
+ dx: rightYAxisLabelDx,
4868
+ style: {
4869
+ fontSize: 12,
4870
+ fill: "hsl(var(--muted-foreground))",
4871
+ fontWeight: 500,
4872
+ textAnchor: "middle"
4873
+ }
4874
+ } : void 0
4875
+ }
4876
+ );
4877
+ })(),
4937
4878
  showTooltip && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
4938
4879
  import_recharts.Tooltip,
4939
4880
  {
4940
4881
  content: showTooltipTotal ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
4941
4882
  TooltipWithTotal_default,
4942
4883
  {
4943
- periodLabel,
4944
4884
  finalColors,
4945
4885
  valueFormatter: finalValueFormatter,
4946
4886
  categoryFormatter,
4947
- yAxisMap,
4948
- isBiaxial: rightKeys.length > 0
4887
+ periodLabel
4949
4888
  }
4950
4889
  ) : /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
4951
4890
  TooltipSimple_default,
4952
4891
  {
4953
- periodLabel,
4954
4892
  finalColors,
4955
4893
  valueFormatter: finalValueFormatter,
4956
4894
  categoryFormatter,
4957
- yAxisMap,
4958
- isBiaxial: rightKeys.length > 0
4895
+ periodLabel
4959
4896
  }
4960
4897
  ),
4961
4898
  cursor: { fill: "hsl(var(--muted))", opacity: 0.1 }
@@ -4973,25 +4910,23 @@ var Chart = ({
4973
4910
  ),
4974
4911
  seriesOrder.map((s) => {
4975
4912
  const key = s.key;
4976
- const rawMapped = rightKeys.length > 0 ? yAxisMap?.[key] ?? "left" : void 0;
4977
- const seriesYAxisId = (() => {
4978
- if (rawMapped === void 0) return void 0;
4979
- if (rawMapped === "left" || rawMapped === "right")
4980
- return rawMapped;
4981
- if (rawMapped === 1 || rawMapped === "1" || rawMapped === "right")
4982
- return "right";
4983
- return "left";
4984
- })();
4985
4913
  if (showOnlyHighlighted && !highlightedSeries.has(key))
4986
4914
  return null;
4987
4915
  const label = mapperConfig[key]?.label ?? labelMap?.[key] ?? formatFieldName(key);
4988
- const color = finalColors[key];
4916
+ let color = finalColors[key];
4917
+ if (rightKeys.includes(key) && biaxialConfigNormalized?.stroke) {
4918
+ if (typeof biaxialConfigNormalized.stroke === "string") {
4919
+ color = biaxialConfigNormalized.stroke;
4920
+ } else {
4921
+ color = biaxialConfigNormalized.stroke[key] ?? color;
4922
+ }
4923
+ }
4989
4924
  if (s.type === "bar") {
4990
4925
  return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
4991
4926
  import_recharts.Bar,
4992
4927
  {
4993
- yAxisId: seriesYAxisId,
4994
4928
  dataKey: key,
4929
+ yAxisId: rightKeys.includes(key) ? "right" : "left",
4995
4930
  name: label,
4996
4931
  fill: color,
4997
4932
  radius: [4, 4, 0, 0],
@@ -5013,13 +4948,12 @@ var Chart = ({
5013
4948
  import_recharts.LabelList,
5014
4949
  {
5015
4950
  dataKey: key,
5016
- position: "top",
5017
- content: pillLabelRenderer_default(
4951
+ position: "insideTop",
4952
+ content: renderInsideBarLabel(
5018
4953
  color,
5019
- "filled",
5020
4954
  finalValueFormatter
5021
4955
  ),
5022
- offset: 8
4956
+ offset: 0
5023
4957
  }
5024
4958
  ) : null
5025
4959
  },
@@ -5030,8 +4964,8 @@ var Chart = ({
5030
4964
  return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
5031
4965
  import_recharts.Line,
5032
4966
  {
5033
- yAxisId: seriesYAxisId,
5034
4967
  dataKey: key,
4968
+ yAxisId: rightKeys.includes(key) ? "right" : "left",
5035
4969
  name: label,
5036
4970
  stroke: color,
5037
4971
  strokeWidth: 2,
@@ -5064,8 +4998,8 @@ var Chart = ({
5064
4998
  return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
5065
4999
  import_recharts.Area,
5066
5000
  {
5067
- yAxisId: seriesYAxisId,
5068
5001
  dataKey: key,
5002
+ yAxisId: rightKeys.includes(key) ? "right" : "left",
5069
5003
  name: label,
5070
5004
  stroke: color,
5071
5005
  fill: color,
@@ -5103,7 +5037,7 @@ var Chart = ({
5103
5037
  DraggableTooltip_default,
5104
5038
  {
5105
5039
  id: tooltip.id,
5106
- data: adaptDataForTooltip2(tooltip.data),
5040
+ data: adaptDataForTooltip(tooltip.data),
5107
5041
  position: tooltip.position,
5108
5042
  title,
5109
5043
  dataKeys: allKeys,
@@ -5142,7 +5076,7 @@ var Chart = ({
5142
5076
  var Chart_default = Chart;
5143
5077
 
5144
5078
  // src/components/charts/BarChart.tsx
5145
- var import_react24 = require("react");
5079
+ var import_react22 = require("react");
5146
5080
  var import_recharts2 = require("recharts");
5147
5081
  var import_jsx_runtime30 = require("react/jsx-runtime");
5148
5082
  var DEFAULT_COLORS3 = ["#55af7d", "#8e68ff", "#2273e1"];
@@ -5174,7 +5108,7 @@ var BarChart = ({
5174
5108
  containerPaddingLeft,
5175
5109
  16
5176
5110
  );
5177
- const smartConfig = (0, import_react24.useMemo)(() => {
5111
+ const smartConfig = (0, import_react22.useMemo)(() => {
5178
5112
  const providedMapper = yAxis ?? mapper;
5179
5113
  if (autoDetect === true || xAxis == null || providedMapper == null) {
5180
5114
  const detectedXAxis = detectXAxis(data);
@@ -5224,20 +5158,20 @@ var BarChart = ({
5224
5158
  return { xAxisConfig: xAxisConfig2, mapperConfig: mapperConfig2 };
5225
5159
  }, [data, xAxis, mapper, yAxis, autoDetect, labelMap]);
5226
5160
  const { xAxisConfig, mapperConfig } = smartConfig;
5227
- const [activeTooltips, setActiveTooltips] = (0, import_react24.useState)([]);
5228
- const [isDragging, setIsDragging] = (0, import_react24.useState)(null);
5229
- const [dragOffset, setDragOffset] = (0, import_react24.useState)({
5161
+ const [activeTooltips, setActiveTooltips] = (0, import_react22.useState)([]);
5162
+ const [isDragging, setIsDragging] = (0, import_react22.useState)(null);
5163
+ const [dragOffset, setDragOffset] = (0, import_react22.useState)({
5230
5164
  x: 0,
5231
5165
  y: 0
5232
5166
  });
5233
- const [globalTooltipCount, setGlobalTooltipCount] = (0, import_react24.useState)(0);
5234
- const [alignmentGuides, setAlignmentGuides] = (0, import_react24.useState)([]);
5167
+ const [globalTooltipCount, setGlobalTooltipCount] = (0, import_react22.useState)(0);
5168
+ const [alignmentGuides, setAlignmentGuides] = (0, import_react22.useState)([]);
5235
5169
  const processedData = data.map((item) => ({
5236
5170
  ...item,
5237
5171
  name: String(item[xAxisConfig.dataKey] || "N/A")
5238
5172
  // Garantir propriedade 'name' para tooltip
5239
5173
  }));
5240
- const generateColors2 = (dataKeys2) => {
5174
+ const generateColors = (dataKeys2) => {
5241
5175
  const colorMap = {};
5242
5176
  const allColors = generateAdditionalColors(colors2, dataKeys2.length);
5243
5177
  dataKeys2.forEach((key, index) => {
@@ -5246,15 +5180,15 @@ var BarChart = ({
5246
5180
  return colorMap;
5247
5181
  };
5248
5182
  const dataKeys = Object.keys(mapperConfig);
5249
- const finalColors = generateColors2(dataKeys);
5250
- const adaptDataForTooltip2 = (universalData) => {
5183
+ const finalColors = generateColors(dataKeys);
5184
+ const adaptDataForTooltip = (universalData) => {
5251
5185
  return {
5252
5186
  ...universalData,
5253
5187
  name: String(universalData[xAxisConfig.dataKey] || "N/A")
5254
5188
  // Garantir que tem a propriedade 'name'
5255
5189
  };
5256
5190
  };
5257
- const maxDataValue = (0, import_react24.useMemo)(() => {
5191
+ const maxDataValue = (0, import_react22.useMemo)(() => {
5258
5192
  let max = 0;
5259
5193
  const keys = Object.keys(mapperConfig);
5260
5194
  for (const row of processedData) {
@@ -5267,7 +5201,7 @@ var BarChart = ({
5267
5201
  }
5268
5202
  return max;
5269
5203
  }, [processedData, mapperConfig]);
5270
- const niceMax = (0, import_react24.useMemo)(() => {
5204
+ const niceMax = (0, import_react22.useMemo)(() => {
5271
5205
  let padding2 = 0.08;
5272
5206
  if (maxDataValue > 1e6) padding2 = 0.05;
5273
5207
  if (maxDataValue > 1e7) padding2 = 0.03;
@@ -5308,7 +5242,7 @@ var BarChart = ({
5308
5242
  const GUIDE_THRESHOLD2 = 60;
5309
5243
  const STRONG_SNAP_THRESHOLD2 = 35;
5310
5244
  const PRECISION_SNAP_THRESHOLD2 = 8;
5311
- const updateAlignmentGuides = (0, import_react24.useCallback)(
5245
+ const updateAlignmentGuides = (0, import_react22.useCallback)(
5312
5246
  (draggedTooltipId, currentPosition) => {
5313
5247
  if (!isDragging) return;
5314
5248
  const getAllTooltips = () => {
@@ -5372,7 +5306,7 @@ var BarChart = ({
5372
5306
  },
5373
5307
  [isDragging, activeTooltips]
5374
5308
  );
5375
- const snapToGuides = (0, import_react24.useCallback)(
5309
+ const snapToGuides = (0, import_react22.useCallback)(
5376
5310
  (position) => {
5377
5311
  const snappedPosition = { ...position };
5378
5312
  let hasSnapped = false;
@@ -5434,7 +5368,7 @@ var BarChart = ({
5434
5368
  setIsDragging(tooltipId);
5435
5369
  setDragOffset({ x: offsetX, y: offsetY });
5436
5370
  };
5437
- (0, import_react24.useEffect)(() => {
5371
+ (0, import_react22.useEffect)(() => {
5438
5372
  let rafId;
5439
5373
  let lastMousePosition = { x: 0, y: 0 };
5440
5374
  const handleGlobalMouseMove = (e) => {
@@ -5492,7 +5426,7 @@ var BarChart = ({
5492
5426
  updateAlignmentGuides,
5493
5427
  snapToGuides
5494
5428
  ]);
5495
- (0, import_react24.useEffect)(() => {
5429
+ (0, import_react22.useEffect)(() => {
5496
5430
  const handleCloseAllTooltips = () => {
5497
5431
  setActiveTooltips([]);
5498
5432
  setGlobalTooltipCount(0);
@@ -5502,7 +5436,7 @@ var BarChart = ({
5502
5436
  window.removeEventListener("closeAllTooltips", handleCloseAllTooltips);
5503
5437
  };
5504
5438
  }, []);
5505
- (0, import_react24.useEffect)(() => {
5439
+ (0, import_react22.useEffect)(() => {
5506
5440
  const handleTooltipCountRequest = () => {
5507
5441
  window.dispatchEvent(
5508
5442
  new CustomEvent("tooltipCountResponse", {
@@ -5541,7 +5475,7 @@ var BarChart = ({
5541
5475
  );
5542
5476
  };
5543
5477
  }, [activeTooltips]);
5544
- (0, import_react24.useEffect)(() => {
5478
+ (0, import_react22.useEffect)(() => {
5545
5479
  if (isDragging) return;
5546
5480
  let totalCount = 0;
5547
5481
  const handleCountResponse = (event) => {
@@ -5778,7 +5712,7 @@ var BarChart = ({
5778
5712
  DraggableTooltip_default,
5779
5713
  {
5780
5714
  id: tooltip.id,
5781
- data: adaptDataForTooltip2(tooltip.data),
5715
+ data: adaptDataForTooltip(tooltip.data),
5782
5716
  position: tooltip.position,
5783
5717
  isDragging: isDragging === tooltip.id,
5784
5718
  title,
@@ -5807,7 +5741,7 @@ var BarChart = ({
5807
5741
  var BarChart_default = BarChart;
5808
5742
 
5809
5743
  // src/components/charts/LineChart.tsx
5810
- var import_react25 = require("react");
5744
+ var import_react23 = require("react");
5811
5745
  var import_recharts3 = require("recharts");
5812
5746
  var import_jsx_runtime31 = require("react/jsx-runtime");
5813
5747
  var defaultData = [
@@ -5841,15 +5775,15 @@ var CustomLineChart = ({
5841
5775
  containerPaddingLeft,
5842
5776
  16
5843
5777
  );
5844
- const [activeTooltips, setActiveTooltips] = (0, import_react25.useState)([]);
5845
- const [isDragging, setIsDragging] = (0, import_react25.useState)(null);
5846
- const [dragOffset, setDragOffset] = (0, import_react25.useState)({
5778
+ const [activeTooltips, setActiveTooltips] = (0, import_react23.useState)([]);
5779
+ const [isDragging, setIsDragging] = (0, import_react23.useState)(null);
5780
+ const [dragOffset, setDragOffset] = (0, import_react23.useState)({
5847
5781
  x: 0,
5848
5782
  y: 0
5849
5783
  });
5850
- const [globalTooltipCount, setGlobalTooltipCount] = (0, import_react25.useState)(0);
5851
- const [alignmentGuides, setAlignmentGuides] = (0, import_react25.useState)([]);
5852
- const generateColors2 = (dataKeys2) => {
5784
+ const [globalTooltipCount, setGlobalTooltipCount] = (0, import_react23.useState)(0);
5785
+ const [alignmentGuides, setAlignmentGuides] = (0, import_react23.useState)([]);
5786
+ const generateColors = (dataKeys2) => {
5853
5787
  const colorMap = {};
5854
5788
  const allColors = generateAdditionalColors(colors2, dataKeys2.length);
5855
5789
  dataKeys2.forEach((key, index) => {
@@ -5857,12 +5791,12 @@ var CustomLineChart = ({
5857
5791
  });
5858
5792
  return colorMap;
5859
5793
  };
5860
- const dataKeys = (0, import_react25.useMemo)(
5794
+ const dataKeys = (0, import_react23.useMemo)(
5861
5795
  () => data.length > 0 ? Object.keys(data[0]).filter((key) => key !== "name") : [],
5862
5796
  [data]
5863
5797
  );
5864
- const finalColors = generateColors2(dataKeys);
5865
- const maxDataValue = (0, import_react25.useMemo)(() => {
5798
+ const finalColors = generateColors(dataKeys);
5799
+ const maxDataValue = (0, import_react23.useMemo)(() => {
5866
5800
  let max = 0;
5867
5801
  for (const row of data) {
5868
5802
  const r = row;
@@ -5874,7 +5808,7 @@ var CustomLineChart = ({
5874
5808
  }
5875
5809
  return max;
5876
5810
  }, [data, dataKeys]);
5877
- const niceMax = (0, import_react25.useMemo)(() => {
5811
+ const niceMax = (0, import_react23.useMemo)(() => {
5878
5812
  let padding2 = 0.08;
5879
5813
  if (maxDataValue > 1e6) padding2 = 0.05;
5880
5814
  if (maxDataValue > 1e7) padding2 = 0.03;
@@ -5950,10 +5884,10 @@ var CustomLineChart = ({
5950
5884
  const handleChartBackgroundClick = () => {
5951
5885
  setActiveTooltips([]);
5952
5886
  };
5953
- const handleCloseAllTooltips = (0, import_react25.useCallback)(() => {
5887
+ const handleCloseAllTooltips = (0, import_react23.useCallback)(() => {
5954
5888
  window.dispatchEvent(new CustomEvent("closeAllTooltips"));
5955
5889
  }, []);
5956
- const updateAlignmentGuides = (0, import_react25.useCallback)(
5890
+ const updateAlignmentGuides = (0, import_react23.useCallback)(
5957
5891
  (draggedTooltipId, draggedPosition) => {
5958
5892
  const SNAP_THRESHOLD = 15;
5959
5893
  const draggedTooltip = activeTooltips.find(
@@ -6034,7 +5968,7 @@ var CustomLineChart = ({
6034
5968
  },
6035
5969
  [activeTooltips]
6036
5970
  );
6037
- const snapToGuides = (0, import_react25.useCallback)(
5971
+ const snapToGuides = (0, import_react23.useCallback)(
6038
5972
  (position) => {
6039
5973
  const SNAP_DISTANCE = 10;
6040
5974
  const snappedPosition = { ...position };
@@ -6062,7 +5996,7 @@ var CustomLineChart = ({
6062
5996
  setIsDragging(tooltipId);
6063
5997
  setDragOffset({ x: offsetX, y: offsetY });
6064
5998
  };
6065
- (0, import_react25.useEffect)(() => {
5999
+ (0, import_react23.useEffect)(() => {
6066
6000
  let rafId;
6067
6001
  let lastMousePosition = { x: 0, y: 0 };
6068
6002
  const handleGlobalMouseMove = (e) => {
@@ -6109,7 +6043,7 @@ var CustomLineChart = ({
6109
6043
  updateAlignmentGuides,
6110
6044
  snapToGuides
6111
6045
  ]);
6112
- (0, import_react25.useEffect)(() => {
6046
+ (0, import_react23.useEffect)(() => {
6113
6047
  const handleCloseAllTooltips2 = () => {
6114
6048
  setActiveTooltips([]);
6115
6049
  setGlobalTooltipCount(0);
@@ -6119,7 +6053,7 @@ var CustomLineChart = ({
6119
6053
  window.removeEventListener("closeAllTooltips", handleCloseAllTooltips2);
6120
6054
  };
6121
6055
  }, []);
6122
- (0, import_react25.useEffect)(() => {
6056
+ (0, import_react23.useEffect)(() => {
6123
6057
  const handleTooltipCountRequest = () => {
6124
6058
  window.dispatchEvent(
6125
6059
  new CustomEvent("tooltipCountResponse", {
@@ -6163,7 +6097,7 @@ var CustomLineChart = ({
6163
6097
  );
6164
6098
  };
6165
6099
  }, [activeTooltips]);
6166
- (0, import_react25.useEffect)(() => {
6100
+ (0, import_react23.useEffect)(() => {
6167
6101
  if (isDragging) return;
6168
6102
  let totalCount = 0;
6169
6103
  const handleCountResponse = (event) => {
@@ -6485,13 +6419,13 @@ var CustomPieChart = ({
6485
6419
  var PieChart_default = CustomPieChart;
6486
6420
 
6487
6421
  // src/components/charts/hooks/useChartHighlights.tsx
6488
- var import_react26 = require("react");
6422
+ var import_react24 = require("react");
6489
6423
  var useChartHighlights = () => {
6490
- const [highlightedSeries, setHighlightedSeries] = (0, import_react26.useState)(
6424
+ const [highlightedSeries, setHighlightedSeries] = (0, import_react24.useState)(
6491
6425
  /* @__PURE__ */ new Set()
6492
6426
  );
6493
- const [showOnlyHighlighted, setShowOnlyHighlighted] = (0, import_react26.useState)(false);
6494
- const toggleHighlight = (0, import_react26.useCallback)((key) => {
6427
+ const [showOnlyHighlighted, setShowOnlyHighlighted] = (0, import_react24.useState)(false);
6428
+ const toggleHighlight = (0, import_react24.useCallback)((key) => {
6495
6429
  setHighlightedSeries((prev) => {
6496
6430
  const next = new Set(prev);
6497
6431
  if (next.has(key)) {
@@ -6502,17 +6436,17 @@ var useChartHighlights = () => {
6502
6436
  return next;
6503
6437
  });
6504
6438
  }, []);
6505
- const clearHighlights = (0, import_react26.useCallback)(() => {
6439
+ const clearHighlights = (0, import_react24.useCallback)(() => {
6506
6440
  setHighlightedSeries(/* @__PURE__ */ new Set());
6507
6441
  setShowOnlyHighlighted(false);
6508
6442
  }, []);
6509
- const isHighlighted = (0, import_react26.useCallback)(
6443
+ const isHighlighted = (0, import_react24.useCallback)(
6510
6444
  (key) => {
6511
6445
  return highlightedSeries.has(key);
6512
6446
  },
6513
6447
  [highlightedSeries]
6514
6448
  );
6515
- const getSeriesStyle = (0, import_react26.useCallback)(
6449
+ const getSeriesStyle = (0, import_react24.useCallback)(
6516
6450
  (key) => {
6517
6451
  const hasHighlights = highlightedSeries.size > 0;
6518
6452
  const isSeriesHighlighted = highlightedSeries.has(key);
@@ -6650,7 +6584,7 @@ function Badge({
6650
6584
  }
6651
6585
 
6652
6586
  // src/components/ui/data/CalendarBase.tsx
6653
- var import_react27 = require("@phosphor-icons/react");
6587
+ var import_react25 = require("@phosphor-icons/react");
6654
6588
  var import_react_day_picker = require("react-day-picker");
6655
6589
  var import_jsx_runtime35 = require("react/jsx-runtime");
6656
6590
  function CalendarBase({
@@ -6695,8 +6629,8 @@ function CalendarBase({
6695
6629
  ...classNames
6696
6630
  },
6697
6631
  components: {
6698
- IconLeft: () => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_react27.CaretLeftIcon, { className: "h-4 w-4" }),
6699
- IconRight: () => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_react27.CaretRightIcon, { className: "h-4 w-4" })
6632
+ IconLeft: () => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_react25.CaretLeftIcon, { className: "h-4 w-4" }),
6633
+ IconRight: () => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_react25.CaretRightIcon, { className: "h-4 w-4" })
6700
6634
  },
6701
6635
  ...props
6702
6636
  }
@@ -6774,7 +6708,7 @@ CardFooterBase.displayName = "CardFooter";
6774
6708
  // src/components/ui/data/FileUploader.tsx
6775
6709
  var React18 = __toESM(require("react"));
6776
6710
  var import_framer_motion10 = require("framer-motion");
6777
- var import_react28 = require("@phosphor-icons/react");
6711
+ var import_react26 = require("@phosphor-icons/react");
6778
6712
  var import_jsx_runtime37 = require("react/jsx-runtime");
6779
6713
  var formatFileSize = (bytes) => {
6780
6714
  if (bytes === 0) return "0 Bytes";
@@ -6790,38 +6724,38 @@ var getFileTypeIcon = (file) => {
6790
6724
  const extension = getFileExtension(file.name).toLowerCase();
6791
6725
  const mimeType = file.type.toLowerCase();
6792
6726
  if (extension === "pdf" || mimeType === "application/pdf") {
6793
- return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_react28.FilePdfIcon, { size: 20, className: "text-red-500" });
6727
+ return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_react26.FilePdfIcon, { size: 20, className: "text-red-500" });
6794
6728
  }
6795
6729
  if (["doc", "docx"].includes(extension) || mimeType.includes("word")) {
6796
- return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_react28.FileDocIcon, { size: 20, className: "text-blue-500" });
6730
+ return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_react26.FileDocIcon, { size: 20, className: "text-blue-500" });
6797
6731
  }
6798
6732
  if (["xls", "xlsx"].includes(extension) || mimeType.includes("sheet")) {
6799
- return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_react28.FileXlsIcon, { size: 20, className: "text-green-500" });
6733
+ return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_react26.FileXlsIcon, { size: 20, className: "text-green-500" });
6800
6734
  }
6801
6735
  if (["ppt", "pptx"].includes(extension) || mimeType.includes("presentation")) {
6802
- return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_react28.FilePptIcon, { size: 20, className: "text-orange-500" });
6736
+ return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_react26.FilePptIcon, { size: 20, className: "text-orange-500" });
6803
6737
  }
6804
6738
  if (extension === "csv" || mimeType === "text/csv") {
6805
- return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_react28.FileCsvIcon, { size: 20, className: "text-green-600" });
6739
+ return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_react26.FileCsvIcon, { size: 20, className: "text-green-600" });
6806
6740
  }
6807
6741
  if (["txt", "md", "json", "xml", "js", "ts", "html", "css"].includes(
6808
6742
  extension
6809
6743
  ) || mimeType.includes("text")) {
6810
- return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_react28.FileTextIcon, { size: 20, className: "text-gray-500" });
6744
+ return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_react26.FileTextIcon, { size: 20, className: "text-gray-500" });
6811
6745
  }
6812
6746
  if (mimeType.startsWith("image/")) {
6813
- return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_react28.FileImageIcon, { size: 20, className: "text-purple-500" });
6747
+ return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_react26.FileImageIcon, { size: 20, className: "text-purple-500" });
6814
6748
  }
6815
6749
  if (mimeType.startsWith("video/")) {
6816
- return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_react28.FileVideoIcon, { size: 20, className: "text-pink-500" });
6750
+ return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_react26.FileVideoIcon, { size: 20, className: "text-pink-500" });
6817
6751
  }
6818
6752
  if (mimeType.startsWith("audio/")) {
6819
- return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_react28.FileAudioIcon, { size: 20, className: "text-indigo-500" });
6753
+ return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_react26.FileAudioIcon, { size: 20, className: "text-indigo-500" });
6820
6754
  }
6821
6755
  if (["zip", "rar", "7z", "tar", "gz"].includes(extension)) {
6822
- return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_react28.FileZipIcon, { size: 20, className: "text-yellow-600" });
6756
+ return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_react26.FileZipIcon, { size: 20, className: "text-yellow-600" });
6823
6757
  }
6824
- return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_react28.FileIcon, { size: 20, className: "text-muted-foreground" });
6758
+ return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_react26.FileIcon, { size: 20, className: "text-muted-foreground" });
6825
6759
  };
6826
6760
  var createImagePreview = (file) => {
6827
6761
  return new Promise((resolve) => {
@@ -7051,7 +6985,7 @@ var FileUploader = React18.forwardRef(
7051
6985
  color: isDragging ? `hsl(var(--primary))` : `hsl(var(--muted-foreground))`
7052
6986
  },
7053
6987
  transition: { duration: 0.3 },
7054
- children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_react28.CloudArrowUpIcon, { size: 64 })
6988
+ children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_react26.CloudArrowUpIcon, { size: 64 })
7055
6989
  }
7056
6990
  )
7057
6991
  }
@@ -7093,7 +7027,7 @@ var FileUploader = React18.forwardRef(
7093
7027
  ),
7094
7028
  transition: { duration: 0.3 },
7095
7029
  children: [
7096
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: "h-4 w-4 text-primary flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_react28.CheckIcon, { size: 16, className: "text-emerald-500" }) }),
7030
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: "h-4 w-4 text-primary flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_react26.CheckIcon, { size: 16, className: "text-emerald-500" }) }),
7097
7031
  /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(
7098
7032
  import_framer_motion10.motion.span,
7099
7033
  {
@@ -7195,7 +7129,7 @@ var FileUploader = React18.forwardRef(
7195
7129
  handleRemoveFile(file.id);
7196
7130
  },
7197
7131
  className: "",
7198
- children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_react28.XIcon, { size: 12 })
7132
+ children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_react26.XIcon, { size: 12 })
7199
7133
  }
7200
7134
  )
7201
7135
  ]
@@ -7319,7 +7253,7 @@ AlertDialogCancelBase.displayName = AlertDialogPrimitive.Cancel.displayName;
7319
7253
 
7320
7254
  // src/components/ui/feedback/DestructiveDialog.tsx
7321
7255
  var React20 = __toESM(require("react"));
7322
- var import_react29 = require("@phosphor-icons/react");
7256
+ var import_react27 = require("@phosphor-icons/react");
7323
7257
  var import_jsx_runtime39 = require("react/jsx-runtime");
7324
7258
  var DestructiveDialog = ({
7325
7259
  title,
@@ -7339,7 +7273,7 @@ var DestructiveDialog = ({
7339
7273
  className: cn("border border-destructive bg-background", className),
7340
7274
  children: [
7341
7275
  /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "flex items-start gap-4", children: [
7342
- /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: "flex items-center justify-center w-10 h-10 rounded-full ring-1 ring-destructive/30", children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_react29.XCircleIcon, { className: "w-6 h-6 text-destructive" }) }),
7276
+ /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: "flex items-center justify-center w-10 h-10 rounded-full ring-1 ring-destructive/30", children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_react27.XCircleIcon, { className: "w-6 h-6 text-destructive" }) }),
7343
7277
  /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "flex-1", children: [
7344
7278
  /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(AlertDialogTitleBase, { className: "text-lg sm:text-xl font-semibold text-destructive", children: title }),
7345
7279
  /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(AlertDialogDescriptionBase, { className: "mt-2 text-sm text-muted-foreground", children: description })
@@ -7548,7 +7482,7 @@ LoadingBase.displayName = "LoadingBase";
7548
7482
  // src/components/ui/feedback/ModalBase.tsx
7549
7483
  var React22 = __toESM(require("react"));
7550
7484
  var DialogPrimitive2 = __toESM(require("@radix-ui/react-dialog"));
7551
- var import_react30 = require("@phosphor-icons/react");
7485
+ var import_react28 = require("@phosphor-icons/react");
7552
7486
  var import_jsx_runtime41 = require("react/jsx-runtime");
7553
7487
  var ModalBase = DialogPrimitive2.Root;
7554
7488
  var ModalTriggerBase = DialogPrimitive2.Trigger;
@@ -7621,7 +7555,7 @@ var ModalContentBase = React22.forwardRef(
7621
7555
  children: [
7622
7556
  children,
7623
7557
  /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(DialogPrimitive2.Close, { className: "absolute right-3 top-3 sm:right-4 sm:top-4 rounded-md bg-muted/10 p-1.5 opacity-80 hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none z-10 hover:bg-muted/20 transition-colors", children: [
7624
- /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_react30.XIcon, { className: "h-5 w-5 sm:h-4 sm:w-4 text-foreground" }),
7558
+ /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_react28.XIcon, { className: "h-5 w-5 sm:h-4 sm:w-4 text-foreground" }),
7625
7559
  /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("span", { className: "sr-only", children: "Close" })
7626
7560
  ] })
7627
7561
  ]
@@ -7945,7 +7879,7 @@ function SkeletonBase({
7945
7879
  }
7946
7880
 
7947
7881
  // src/components/ui/feedback/SonnerBase.tsx
7948
- var import_react31 = require("@phosphor-icons/react");
7882
+ var import_react29 = require("@phosphor-icons/react");
7949
7883
  var import_sonner2 = require("sonner");
7950
7884
  var import_jsx_runtime44 = require("react/jsx-runtime");
7951
7885
  var iconBaseClass = "w-5 h-auto";
@@ -7997,23 +7931,23 @@ var Toaster = ({ testId, ...props }) => {
7997
7931
  };
7998
7932
  var toast2 = {
7999
7933
  success: (message) => import_sonner2.toast.success(message, {
8000
- icon: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_react31.CheckCircleIcon, { className: `${iconBaseClass} text-green-600`, weight: "fill" }),
7934
+ icon: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_react29.CheckCircleIcon, { className: `${iconBaseClass} text-green-600`, weight: "fill" }),
8001
7935
  className: "sonner-success"
8002
7936
  }),
8003
7937
  error: (message) => import_sonner2.toast.error(message, {
8004
- icon: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_react31.XCircleIcon, { className: `${iconBaseClass} text-red-600`, weight: "fill" }),
7938
+ icon: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_react29.XCircleIcon, { className: `${iconBaseClass} text-red-600`, weight: "fill" }),
8005
7939
  className: "sonner-error"
8006
7940
  }),
8007
7941
  warning: (message) => import_sonner2.toast.warning(message, {
8008
- icon: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_react31.WarningIcon, { className: `${iconBaseClass} text-yellow-600`, weight: "fill" }),
7942
+ icon: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_react29.WarningIcon, { className: `${iconBaseClass} text-yellow-600`, weight: "fill" }),
8009
7943
  className: "sonner-WarningIcon"
8010
7944
  }),
8011
7945
  info: (message) => import_sonner2.toast.info(message, {
8012
- icon: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_react31.InfoIcon, { className: `${iconBaseClass} text-blue-600`, weight: "fill" }),
7946
+ icon: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_react29.InfoIcon, { className: `${iconBaseClass} text-blue-600`, weight: "fill" }),
8013
7947
  className: "sonner-InfoIcon"
8014
7948
  }),
8015
7949
  loading: (message) => (0, import_sonner2.toast)(message, {
8016
- icon: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_react31.SpinnerIcon, { className: `${iconBaseClass} animate-spin text-neutral-500`, weight: "fill" }),
7950
+ icon: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_react29.SpinnerIcon, { className: `${iconBaseClass} animate-spin text-neutral-500`, weight: "fill" }),
8017
7951
  className: "sonner-loading"
8018
7952
  })
8019
7953
  };
@@ -8021,7 +7955,7 @@ var toast2 = {
8021
7955
  // src/components/ui/form/CheckBoxBase.tsx
8022
7956
  var React24 = __toESM(require("react"));
8023
7957
  var CheckboxPrimitive = __toESM(require("@radix-ui/react-checkbox"));
8024
- var import_react32 = require("@phosphor-icons/react");
7958
+ var import_react30 = require("@phosphor-icons/react");
8025
7959
  var import_framer_motion11 = require("framer-motion");
8026
7960
  var import_jsx_runtime45 = require("react/jsx-runtime");
8027
7961
  var CheckboxBase = React24.forwardRef(({ className, testid: dataTestId = "checkbox-base", checked: checkedProp, defaultChecked, onCheckedChange, ...props }, ref) => {
@@ -8060,8 +7994,8 @@ var CheckboxBase = React24.forwardRef(({ className, testid: dataTestId = "checkb
8060
7994
  transition: { type: "spring", stiffness: 500, damping: 30 },
8061
7995
  className: "flex items-center justify-center text-current",
8062
7996
  children: [
8063
- checkedState === true && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_react32.CheckIcon, { className: "h-4 w-4", weight: "bold" }),
8064
- checkedState === "indeterminate" && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_react32.MinusIcon, { className: "h-4 w-4", weight: "bold" })
7997
+ checkedState === true && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_react30.CheckIcon, { className: "h-4 w-4", weight: "bold" }),
7998
+ checkedState === "indeterminate" && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_react30.MinusIcon, { className: "h-4 w-4", weight: "bold" })
8065
7999
  ]
8066
8000
  }
8067
8001
  ) })
@@ -8073,7 +8007,7 @@ CheckboxBase.displayName = CheckboxPrimitive.Root.displayName;
8073
8007
  // src/components/ui/form/CollapsibleBase.tsx
8074
8008
  var React25 = __toESM(require("react"));
8075
8009
  var CollapsiblePrimitive = __toESM(require("@radix-ui/react-collapsible"));
8076
- var import_react33 = require("@phosphor-icons/react");
8010
+ var import_react31 = require("@phosphor-icons/react");
8077
8011
  var import_jsx_runtime46 = require("react/jsx-runtime");
8078
8012
  var CollapsibleBase = React25.forwardRef(({ ...props }, ref) => {
8079
8013
  return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(CollapsiblePrimitive.Root, { ref, "data-slot": "collapsible", ...props });
@@ -8095,7 +8029,7 @@ var CollapsibleTriggerBase = React25.forwardRef(({ className, children, leftIcon
8095
8029
  leftIcon && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("span", { className: "flex-shrink-0 [&>svg]:size-4", children: leftIcon }),
8096
8030
  /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("span", { children })
8097
8031
  ] }),
8098
- showCaret && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("span", { className: "caret-icon flex-shrink-0 transition-transform duration-500 ease-[cubic-bezier(0.4,0,0.2,1)]", children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_react33.CaretUpDownIcon, { className: "h-4 w-4" }) })
8032
+ showCaret && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("span", { className: "caret-icon flex-shrink-0 transition-transform duration-500 ease-[cubic-bezier(0.4,0,0.2,1)]", children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_react31.CaretUpDownIcon, { className: "h-4 w-4" }) })
8099
8033
  ]
8100
8034
  }
8101
8035
  );
@@ -8176,7 +8110,7 @@ HoverCardContentBase.displayName = HoverCardPrimitive.Content.displayName;
8176
8110
  // src/components/ui/form/Input-OTP-Base.tsx
8177
8111
  var React27 = __toESM(require("react"));
8178
8112
  var import_input_otp = require("input-otp");
8179
- var import_react34 = require("@phosphor-icons/react");
8113
+ var import_react32 = require("@phosphor-icons/react");
8180
8114
  var import_jsx_runtime48 = require("react/jsx-runtime");
8181
8115
  function InputOTPBase({
8182
8116
  className,
@@ -8231,7 +8165,7 @@ function InputOTPSlotBase({
8231
8165
  );
8232
8166
  }
8233
8167
  function InputOTPSeparatorBase({ ...props }) {
8234
- return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { "data-slot": "input-otp-separator", role: "separator", ...props, children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_react34.MinusIcon, {}) });
8168
+ return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { "data-slot": "input-otp-separator", role: "separator", ...props, children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_react32.MinusIcon, {}) });
8235
8169
  }
8236
8170
 
8237
8171
  // src/components/ui/form/SliderBase.tsx
@@ -8319,7 +8253,7 @@ SlideBase.displayName = "SlideBase";
8319
8253
 
8320
8254
  // src/components/ui/form/SmallButtons.tsx
8321
8255
  var React29 = __toESM(require("react"));
8322
- var import_react35 = require("@phosphor-icons/react");
8256
+ var import_react33 = require("@phosphor-icons/react");
8323
8257
  var import_jsx_runtime50 = require("react/jsx-runtime");
8324
8258
  var EditButton = React29.forwardRef(
8325
8259
  ({
@@ -8350,7 +8284,7 @@ var EditButton = React29.forwardRef(
8350
8284
  ),
8351
8285
  ...props,
8352
8286
  children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
8353
- import_react35.PencilSimpleIcon,
8287
+ import_react33.PencilSimpleIcon,
8354
8288
  {
8355
8289
  size: iconSize,
8356
8290
  color: iconColor,
@@ -8390,7 +8324,7 @@ var ChangeButton = React29.forwardRef(
8390
8324
  ),
8391
8325
  ...props,
8392
8326
  children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
8393
- import_react35.ArrowsLeftRightIcon,
8327
+ import_react33.ArrowsLeftRightIcon,
8394
8328
  {
8395
8329
  size: iconSize,
8396
8330
  color: iconColor,
@@ -8430,7 +8364,7 @@ var SaveButton = React29.forwardRef(
8430
8364
  ),
8431
8365
  ...props,
8432
8366
  children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
8433
- import_react35.FloppyDiskIcon,
8367
+ import_react33.FloppyDiskIcon,
8434
8368
  {
8435
8369
  size: iconSize,
8436
8370
  color: iconColor,
@@ -8470,7 +8404,7 @@ var AddButton = React29.forwardRef(
8470
8404
  ),
8471
8405
  ...props,
8472
8406
  children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
8473
- import_react35.PlusIcon,
8407
+ import_react33.PlusIcon,
8474
8408
  {
8475
8409
  size: iconSize,
8476
8410
  color: iconColor,
@@ -8510,7 +8444,7 @@ var CloseButton = React29.forwardRef(
8510
8444
  ),
8511
8445
  ...props,
8512
8446
  children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
8513
- import_react35.XIcon,
8447
+ import_react33.XIcon,
8514
8448
  {
8515
8449
  size: iconSize,
8516
8450
  color: iconColor,
@@ -8542,7 +8476,7 @@ var DownloadButton = ({
8542
8476
  ),
8543
8477
  ...props,
8544
8478
  children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
8545
- import_react35.DownloadSimpleIcon,
8479
+ import_react33.DownloadSimpleIcon,
8546
8480
  {
8547
8481
  size: 18,
8548
8482
  className: "transition-transform duration-300 group-hover:translate-y-0.5"
@@ -8571,7 +8505,7 @@ var UploadButton = ({
8571
8505
  ),
8572
8506
  ...props,
8573
8507
  children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
8574
- import_react35.UploadSimpleIcon,
8508
+ import_react33.UploadSimpleIcon,
8575
8509
  {
8576
8510
  size: 18,
8577
8511
  className: "transition-transform duration-300 group-hover:-translate-y-0.5"
@@ -8600,7 +8534,7 @@ var CopyButton = ({
8600
8534
  ),
8601
8535
  ...props,
8602
8536
  children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
8603
- import_react35.CopyIcon,
8537
+ import_react33.CopyIcon,
8604
8538
  {
8605
8539
  size: 18,
8606
8540
  className: "transition-transform duration-200 group-hover:scale-110"
@@ -8629,7 +8563,7 @@ var RefreshButton = ({
8629
8563
  ),
8630
8564
  ...props,
8631
8565
  children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
8632
- import_react35.ArrowClockwiseIcon,
8566
+ import_react33.ArrowClockwiseIcon,
8633
8567
  {
8634
8568
  size: 18,
8635
8569
  className: "transition-transform duration-500 group-hover:rotate-180"
@@ -8658,7 +8592,7 @@ var SearchButton = ({
8658
8592
  ),
8659
8593
  ...props,
8660
8594
  children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
8661
- import_react35.MagnifyingGlassIcon,
8595
+ import_react33.MagnifyingGlassIcon,
8662
8596
  {
8663
8597
  size: 18,
8664
8598
  className: "transition-transform duration-200 group-hover:scale-110 group-hover:-rotate-12"
@@ -8687,7 +8621,7 @@ var BackButton = ({
8687
8621
  ),
8688
8622
  ...props,
8689
8623
  children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
8690
- import_react35.ArrowLeftIcon,
8624
+ import_react33.ArrowLeftIcon,
8691
8625
  {
8692
8626
  size: 18,
8693
8627
  className: "transition-transform duration-300 group-hover:-translate-x-1"
@@ -8716,7 +8650,7 @@ var SettingsButton = ({
8716
8650
  ),
8717
8651
  ...props,
8718
8652
  children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
8719
- import_react35.GearIcon,
8653
+ import_react33.GearIcon,
8720
8654
  {
8721
8655
  size: 18,
8722
8656
  className: "transition-transform duration-500 group-hover:rotate-90"
@@ -8745,7 +8679,7 @@ var NotificationButton = ({
8745
8679
  ),
8746
8680
  ...props,
8747
8681
  children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
8748
- import_react35.BellIcon,
8682
+ import_react33.BellIcon,
8749
8683
  {
8750
8684
  size: 18,
8751
8685
  className: "transition-transform duration-300 group-hover:scale-110 group-hover:-rotate-12"
@@ -8774,7 +8708,7 @@ var MoreButton = ({
8774
8708
  ),
8775
8709
  ...props,
8776
8710
  children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
8777
- import_react35.DotsThreeIcon,
8711
+ import_react33.DotsThreeIcon,
8778
8712
  {
8779
8713
  size: 18,
8780
8714
  className: "transition-transform duration-200 group-hover:scale-110"
@@ -8803,7 +8737,7 @@ var CheckButton = ({
8803
8737
  ),
8804
8738
  ...props,
8805
8739
  children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
8806
- import_react35.CheckIcon,
8740
+ import_react33.CheckIcon,
8807
8741
  {
8808
8742
  size: 18,
8809
8743
  className: "transition-transform duration-200 group-hover:scale-110"
@@ -8839,7 +8773,7 @@ var FilterButton = ({
8839
8773
  ),
8840
8774
  ...props,
8841
8775
  children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
8842
- import_react35.FunnelIcon,
8776
+ import_react33.FunnelIcon,
8843
8777
  {
8844
8778
  size: iconSize,
8845
8779
  color: iconColor,
@@ -8878,7 +8812,7 @@ var LikeButton = ({
8878
8812
  ),
8879
8813
  ...props,
8880
8814
  children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
8881
- import_react35.HeartIcon,
8815
+ import_react33.HeartIcon,
8882
8816
  {
8883
8817
  size: iconSize,
8884
8818
  color: iconColor,
@@ -8917,7 +8851,7 @@ var FavoriteButton = ({
8917
8851
  ),
8918
8852
  ...props,
8919
8853
  children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
8920
- import_react35.StarIcon,
8854
+ import_react33.StarIcon,
8921
8855
  {
8922
8856
  size: iconSize,
8923
8857
  color: iconColor,
@@ -8955,14 +8889,14 @@ var VisibilityButton = ({
8955
8889
  ),
8956
8890
  ...props,
8957
8891
  children: isVisible ? /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
8958
- import_react35.EyeIcon,
8892
+ import_react33.EyeIcon,
8959
8893
  {
8960
8894
  size: iconSize,
8961
8895
  color: iconColor,
8962
8896
  className: "transition-opacity duration-200"
8963
8897
  }
8964
8898
  ) : /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
8965
- import_react35.EyeSlashIcon,
8899
+ import_react33.EyeSlashIcon,
8966
8900
  {
8967
8901
  size: iconSize,
8968
8902
  color: iconColor,
@@ -9002,14 +8936,14 @@ var LockButton = ({
9002
8936
  ),
9003
8937
  ...props,
9004
8938
  children: isLocked ? /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
9005
- import_react35.LockIcon,
8939
+ import_react33.LockIcon,
9006
8940
  {
9007
8941
  size: iconSize,
9008
8942
  color: iconColor,
9009
8943
  className: "transition-all duration-200 group-hover:scale-110"
9010
8944
  }
9011
8945
  ) : /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
9012
- import_react35.LockOpenIcon,
8946
+ import_react33.LockOpenIcon,
9013
8947
  {
9014
8948
  size: iconSize,
9015
8949
  color: iconColor,
@@ -9055,7 +8989,7 @@ SwitchBase.displayName = SwitchPrimitives.Root.displayName;
9055
8989
  // src/components/ui/form/TextAreaBase.tsx
9056
8990
  var React31 = __toESM(require("react"));
9057
8991
  var import_framer_motion12 = require("framer-motion");
9058
- var import_react36 = require("@phosphor-icons/react");
8992
+ var import_react34 = require("@phosphor-icons/react");
9059
8993
  var import_jsx_runtime52 = require("react/jsx-runtime");
9060
8994
  var TextAreaBase = React31.forwardRef(
9061
8995
  ({ className, clearable = false, onClear, ...props }, ref) => {
@@ -9152,7 +9086,7 @@ var TextAreaBase = React31.forwardRef(
9152
9086
  ),
9153
9087
  disabled: props.disabled,
9154
9088
  "aria-label": "Limpar texto",
9155
- children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_react36.TrashIcon, { size: 16, weight: "regular" })
9089
+ children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_react34.TrashIcon, { size: 16, weight: "regular" })
9156
9090
  }
9157
9091
  ) }),
9158
9092
  /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(
@@ -9230,7 +9164,7 @@ TextAreaBase.displayName = "TextAreaBase";
9230
9164
  // src/components/ui/layout/CarouselBase.tsx
9231
9165
  var React32 = __toESM(require("react"));
9232
9166
  var import_embla_carousel_react = __toESM(require("embla-carousel-react"));
9233
- var import_react37 = require("@phosphor-icons/react");
9167
+ var import_react35 = require("@phosphor-icons/react");
9234
9168
  var import_jsx_runtime53 = require("react/jsx-runtime");
9235
9169
  var CarouselContext = React32.createContext(null);
9236
9170
  function useCarousel() {
@@ -9391,7 +9325,7 @@ function CarouselPreviousBase({
9391
9325
  onClick: scrollPrev,
9392
9326
  ...props,
9393
9327
  children: [
9394
- /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(import_react37.ArrowLeftIcon, {}),
9328
+ /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(import_react35.ArrowLeftIcon, {}),
9395
9329
  /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { className: "sr-only", children: "Previous slide" })
9396
9330
  ]
9397
9331
  }
@@ -9421,7 +9355,7 @@ function CarouselNextBase({
9421
9355
  onClick: scrollNext,
9422
9356
  ...props,
9423
9357
  children: [
9424
- /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(import_react37.ArrowRightIcon, {}),
9358
+ /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(import_react35.ArrowRightIcon, {}),
9425
9359
  /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { className: "sr-only", children: "Next slide" })
9426
9360
  ]
9427
9361
  }
@@ -9604,7 +9538,7 @@ TabsContentBase.displayName = TabsPrimitive.Content.displayName;
9604
9538
 
9605
9539
  // src/components/ui/navigation/BreadcrumbBase.tsx
9606
9540
  var import_react_slot4 = require("@radix-ui/react-slot");
9607
- var import_react38 = require("@phosphor-icons/react");
9541
+ var import_react36 = require("@phosphor-icons/react");
9608
9542
  var import_jsx_runtime57 = require("react/jsx-runtime");
9609
9543
  function BreadcrumbBase({ ...props }) {
9610
9544
  return /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("nav", { "aria-label": "breadcrumb", "data-slot": "breadcrumb", ...props });
@@ -9673,7 +9607,7 @@ function BreadcrumbSeparatorBase({
9673
9607
  "aria-hidden": "true",
9674
9608
  className: cn("[&>svg]:size-3.5", className),
9675
9609
  ...props,
9676
- children: children ?? /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(import_react38.CaretRightIcon, {})
9610
+ children: children ?? /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(import_react36.CaretRightIcon, {})
9677
9611
  }
9678
9612
  );
9679
9613
  }
@@ -9690,7 +9624,7 @@ function BreadcrumbEllipsisBase({
9690
9624
  className: cn("flex size-9 items-center justify-center", className),
9691
9625
  ...props,
9692
9626
  children: [
9693
- /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(import_react38.DotsThreeIcon, { className: "size-4" }),
9627
+ /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(import_react36.DotsThreeIcon, { className: "size-4" }),
9694
9628
  /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("span", { className: "sr-only", children: "More" })
9695
9629
  ]
9696
9630
  }
@@ -9699,7 +9633,7 @@ function BreadcrumbEllipsisBase({
9699
9633
 
9700
9634
  // src/components/ui/navigation/NavigationMenuBase.tsx
9701
9635
  var NavigationMenuPrimitive = __toESM(require("@radix-ui/react-navigation-menu"));
9702
- var import_react39 = require("@phosphor-icons/react");
9636
+ var import_react37 = require("@phosphor-icons/react");
9703
9637
  var import_jsx_runtime58 = require("react/jsx-runtime");
9704
9638
  function NavigationMenuBase({
9705
9639
  className,
@@ -9767,7 +9701,7 @@ function NavigationMenuTriggerBase({
9767
9701
  children: [
9768
9702
  children,
9769
9703
  /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
9770
- import_react39.CaretDownIcon,
9704
+ import_react37.CaretDownIcon,
9771
9705
  {
9772
9706
  className: "relative top-[1px] ml-1 size-3 transition duration-300 group-data-[state=open]:rotate-180",
9773
9707
  "aria-hidden": "true"
@@ -9870,7 +9804,7 @@ function useIsMobile() {
9870
9804
  var React37 = __toESM(require("react"));
9871
9805
  var SheetPrimitive = __toESM(require("@radix-ui/react-dialog"));
9872
9806
  var import_class_variance_authority4 = require("class-variance-authority");
9873
- var import_react40 = require("@phosphor-icons/react");
9807
+ var import_react38 = require("@phosphor-icons/react");
9874
9808
  var import_jsx_runtime59 = require("react/jsx-runtime");
9875
9809
  var SheetBase = SheetPrimitive.Root;
9876
9810
  var SheetTriggerBase = SheetPrimitive.Trigger;
@@ -9914,7 +9848,7 @@ var SheetContentBase = React37.forwardRef(({ side = "right", className, children
9914
9848
  ...props,
9915
9849
  children: [
9916
9850
  /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(SheetPrimitive.Close, { className: "absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary", children: [
9917
- /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(import_react40.XIcon, { className: "h-4 w-4" }),
9851
+ /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(import_react38.XIcon, { className: "h-4 w-4" }),
9918
9852
  /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("span", { className: "sr-only", children: "Close" })
9919
9853
  ] }),
9920
9854
  children
@@ -9971,7 +9905,7 @@ var SheetDescriptionBase = React37.forwardRef(({ className, ...props }, ref) =>
9971
9905
  SheetDescriptionBase.displayName = SheetPrimitive.Description.displayName;
9972
9906
 
9973
9907
  // src/components/ui/navigation/SidebarBase.tsx
9974
- var import_react41 = require("@phosphor-icons/react");
9908
+ var import_react39 = require("@phosphor-icons/react");
9975
9909
  var import_jsx_runtime60 = require("react/jsx-runtime");
9976
9910
  var SIDEBAR_COOKIE_NAME = "sidebar:state";
9977
9911
  var SIDEBAR_COOKIE_MAX_AGE = 60 * 60 * 24 * 7;
@@ -10165,7 +10099,7 @@ var SidebarTriggerBase = React38.forwardRef(({ className, onClick, ...props }, r
10165
10099
  ...props,
10166
10100
  children: [
10167
10101
  /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("span", { className: "sr-only", children: "Toggle SidebarBase" }),
10168
- /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(import_react41.SidebarSimpleIcon, {})
10102
+ /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(import_react39.SidebarSimpleIcon, {})
10169
10103
  ]
10170
10104
  }
10171
10105
  ) });
@@ -10659,11 +10593,11 @@ function DrawerDescriptionBase({
10659
10593
  }
10660
10594
 
10661
10595
  // src/hooks/use-universal-tooltip.tsx
10662
- var import_react42 = require("react");
10596
+ var import_react40 = require("react");
10663
10597
  var import_jsx_runtime62 = require("react/jsx-runtime");
10664
- var UniversalTooltipContext = (0, import_react42.createContext)(null);
10598
+ var UniversalTooltipContext = (0, import_react40.createContext)(null);
10665
10599
  var useUniversalTooltip = () => {
10666
- const context = (0, import_react42.useContext)(UniversalTooltipContext);
10600
+ const context = (0, import_react40.useContext)(UniversalTooltipContext);
10667
10601
  if (!context) {
10668
10602
  throw new Error("useUniversalTooltip deve ser usado dentro de UniversalTooltipProvider");
10669
10603
  }
@@ -10671,7 +10605,7 @@ var useUniversalTooltip = () => {
10671
10605
  };
10672
10606
  var useTooltip = () => {
10673
10607
  const { addTooltip, removeTooltip, startDrag } = useUniversalTooltip();
10674
- const createTooltip = (0, import_react42.useCallback)((element, content, options) => {
10608
+ const createTooltip = (0, import_react40.useCallback)((element, content, options) => {
10675
10609
  const rect = element.getBoundingClientRect();
10676
10610
  let position;
10677
10611
  switch (options?.position || "auto") {
@@ -10701,7 +10635,7 @@ var useTooltip = () => {
10701
10635
  metadata: options?.metadata
10702
10636
  });
10703
10637
  }, [addTooltip]);
10704
- const handleElementMouseDown = (0, import_react42.useCallback)((tooltipId, event) => {
10638
+ const handleElementMouseDown = (0, import_react40.useCallback)((tooltipId, event) => {
10705
10639
  const rect = event.target.getBoundingClientRect();
10706
10640
  const offset = {
10707
10641
  x: event.clientX - rect.left,
@@ -10860,7 +10794,7 @@ var import_date_fns = require("date-fns");
10860
10794
  // src/components/picker/calendar.tsx
10861
10795
  var React40 = __toESM(require("react"));
10862
10796
  var import_react_day_picker2 = require("react-day-picker");
10863
- var import_react43 = require("@phosphor-icons/react");
10797
+ var import_react41 = require("@phosphor-icons/react");
10864
10798
  var import_framer_motion14 = require("framer-motion");
10865
10799
  var import_jsx_runtime64 = require("react/jsx-runtime");
10866
10800
  function CalendarBase2({
@@ -10937,8 +10871,8 @@ function CalendarBase2({
10937
10871
  ...classNames
10938
10872
  },
10939
10873
  components: {
10940
- IconLeft: () => /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(import_react43.CaretLeftIcon, { className: "h-4 w-4" }),
10941
- IconRight: () => /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(import_react43.CaretRightIcon, { className: "h-4 w-4" })
10874
+ IconLeft: () => /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(import_react41.CaretLeftIcon, { className: "h-4 w-4" }),
10875
+ IconRight: () => /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(import_react41.CaretRightIcon, { className: "h-4 w-4" })
10942
10876
  },
10943
10877
  ...props
10944
10878
  }
@@ -10954,15 +10888,15 @@ CalendarBase2.displayName = "CalendarBase";
10954
10888
 
10955
10889
  // src/components/picker/DateTimePicker.tsx
10956
10890
  var import_locale = require("date-fns/locale");
10957
- var import_react46 = require("react");
10891
+ var import_react44 = require("react");
10958
10892
 
10959
10893
  // src/components/picker/TimePicker.tsx
10960
10894
  var import_framer_motion15 = require("framer-motion");
10961
10895
  var React42 = __toESM(require("react"));
10962
10896
 
10963
10897
  // src/components/picker/TimePickerInput.tsx
10964
- var import_react44 = require("@phosphor-icons/react");
10965
- var import_react45 = __toESM(require("react"));
10898
+ var import_react42 = require("@phosphor-icons/react");
10899
+ var import_react43 = __toESM(require("react"));
10966
10900
 
10967
10901
  // src/components/picker/utils/time-picker-utils.ts
10968
10902
  function isValidHour(value) {
@@ -11105,7 +11039,7 @@ function display12HourValue(hours) {
11105
11039
 
11106
11040
  // src/components/picker/TimePickerInput.tsx
11107
11041
  var import_jsx_runtime65 = require("react/jsx-runtime");
11108
- var TimePickerInput = import_react45.default.forwardRef(
11042
+ var TimePickerInput = import_react43.default.forwardRef(
11109
11043
  ({
11110
11044
  className,
11111
11045
  type = "tel",
@@ -11124,10 +11058,10 @@ var TimePickerInput = import_react45.default.forwardRef(
11124
11058
  label,
11125
11059
  ...props
11126
11060
  }, ref) => {
11127
- const [flag, setFlag] = import_react45.default.useState(false);
11128
- const [prevIntKey, setPrevIntKey] = import_react45.default.useState("0");
11129
- const [isFocused, setIsFocused] = import_react45.default.useState(false);
11130
- import_react45.default.useEffect(() => {
11061
+ const [flag, setFlag] = import_react43.default.useState(false);
11062
+ const [prevIntKey, setPrevIntKey] = import_react43.default.useState("0");
11063
+ const [isFocused, setIsFocused] = import_react43.default.useState(false);
11064
+ import_react43.default.useEffect(() => {
11131
11065
  if (flag) {
11132
11066
  const timer = setTimeout(() => {
11133
11067
  setFlag(false);
@@ -11135,7 +11069,7 @@ var TimePickerInput = import_react45.default.forwardRef(
11135
11069
  return () => clearTimeout(timer);
11136
11070
  }
11137
11071
  }, [flag]);
11138
- const calculatedValue = import_react45.default.useMemo(() => {
11072
+ const calculatedValue = import_react43.default.useMemo(() => {
11139
11073
  return getDateByType(date, picker);
11140
11074
  }, [date, picker]);
11141
11075
  const calculateNewValue = (key) => {
@@ -11224,7 +11158,7 @@ var TimePickerInput = import_react45.default.forwardRef(
11224
11158
  ),
11225
11159
  tabIndex: -1,
11226
11160
  "aria-label": `Incrementar ${getPickerLabel().toLowerCase()}`,
11227
- children: /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(import_react44.CaretUpIcon, { size: 14, className: "sm:w-4 sm:h-4" })
11161
+ children: /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(import_react42.CaretUpIcon, { size: 14, className: "sm:w-4 sm:h-4" })
11228
11162
  }
11229
11163
  ),
11230
11164
  /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("div", { className: "relative", children: [
@@ -11291,7 +11225,7 @@ var TimePickerInput = import_react45.default.forwardRef(
11291
11225
  ),
11292
11226
  tabIndex: -1,
11293
11227
  "aria-label": `Decrementar ${getPickerLabel().toLowerCase()}`,
11294
- children: /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(import_react44.CaretDownIcon, { size: 14, className: "sm:w-4 sm:h-4" })
11228
+ children: /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(import_react42.CaretDownIcon, { size: 14, className: "sm:w-4 sm:h-4" })
11295
11229
  }
11296
11230
  )
11297
11231
  ]
@@ -11400,7 +11334,7 @@ function TimePicker({
11400
11334
  }
11401
11335
 
11402
11336
  // src/components/picker/DateTimePicker.tsx
11403
- var import_react47 = require("@phosphor-icons/react");
11337
+ var import_react45 = require("@phosphor-icons/react");
11404
11338
  var import_jsx_runtime67 = require("react/jsx-runtime");
11405
11339
  function DateTimePicker({
11406
11340
  label,
@@ -11415,9 +11349,9 @@ function DateTimePicker({
11415
11349
  className,
11416
11350
  error
11417
11351
  }) {
11418
- const [internalDate, setInternalDate] = (0, import_react46.useState)(date);
11419
- const [open, setOpen] = (0, import_react46.useState)(false);
11420
- const [timePickerOpen, setTimePickerOpen] = (0, import_react46.useState)(false);
11352
+ const [internalDate, setInternalDate] = (0, import_react44.useState)(date);
11353
+ const [open, setOpen] = (0, import_react44.useState)(false);
11354
+ const [timePickerOpen, setTimePickerOpen] = (0, import_react44.useState)(false);
11421
11355
  const handleSelect = (newDay) => {
11422
11356
  if (!newDay) return;
11423
11357
  if (!internalDate) {
@@ -11448,7 +11382,7 @@ function DateTimePicker({
11448
11382
  if (!timeFormat) return "dd MMMM yyyy";
11449
11383
  return `dd MMMM yyyy - ${timeFormat}`;
11450
11384
  };
11451
- (0, import_react46.useEffect)(() => {
11385
+ (0, import_react44.useEffect)(() => {
11452
11386
  setInternalDate(date);
11453
11387
  }, [date, open]);
11454
11388
  return /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("div", { className: cn("w-full sm:w-auto", className), children: [
@@ -11479,7 +11413,7 @@ function DateTimePicker({
11479
11413
  children: date ? (0, import_date_fns.format)(date, getDisplayFormat(), { locale: import_locale.ptBR }) : "Selecione uma data"
11480
11414
  }
11481
11415
  ),
11482
- /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(import_react47.CalendarBlankIcon, { className: "flex-shrink-0 w-5 h-5 sm:w-6 sm:h-6" })
11416
+ /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(import_react45.CalendarBlankIcon, { className: "flex-shrink-0 w-5 h-5 sm:w-6 sm:h-6" })
11483
11417
  ]
11484
11418
  }
11485
11419
  )
@@ -11529,7 +11463,7 @@ function DateTimePicker({
11529
11463
  "shadow-sm hover:shadow-md no-active-animation"
11530
11464
  ),
11531
11465
  children: [
11532
- /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(import_react47.ClockIcon, { className: "text-primary flex-shrink-0 w-4 h-4 sm:w-5 sm:h-5" }),
11466
+ /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(import_react45.ClockIcon, { className: "text-primary flex-shrink-0 w-4 h-4 sm:w-5 sm:h-5" }),
11533
11467
  /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("span", { className: "text-black truncate", children: internalDate ? (0, import_date_fns.format)(internalDate, getTimeFormat() || "HH:mm", {
11534
11468
  locale: import_locale.ptBR
11535
11469
  }) : "00:00" })
@@ -11592,7 +11526,7 @@ var React43 = __toESM(require("react"));
11592
11526
  var import_react_day_picker3 = require("react-day-picker");
11593
11527
  var import_pt_BR = __toESM(require("date-fns/locale/pt-BR"));
11594
11528
  var import_date_fns2 = require("date-fns");
11595
- var import_react48 = require("@phosphor-icons/react");
11529
+ var import_react46 = require("@phosphor-icons/react");
11596
11530
  var import_framer_motion16 = require("framer-motion");
11597
11531
  var import_ssr7 = require("@phosphor-icons/react/dist/ssr");
11598
11532
  var import_jsx_runtime68 = require("react/jsx-runtime");
@@ -11654,7 +11588,7 @@ function RangePicker({
11654
11588
  {
11655
11589
  animate: open ? { rotate: 8, scale: 1.15 } : { rotate: 0, scale: 1 },
11656
11590
  transition: { type: "spring", stiffness: 300, damping: 18 },
11657
- children: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(import_react48.CalendarBlankIcon, { className: "flex-shrink-0 w-5 h-5 sm:w-6 sm:h-6" })
11591
+ children: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(import_react46.CalendarBlankIcon, { className: "flex-shrink-0 w-5 h-5 sm:w-6 sm:h-6" })
11658
11592
  }
11659
11593
  )
11660
11594
  ]
@@ -11731,8 +11665,8 @@ function RangePicker({
11731
11665
  day_hidden: "invisible"
11732
11666
  },
11733
11667
  components: {
11734
- IconLeft: () => /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(import_react48.CaretLeftIcon, { className: "h-4 w-4" }),
11735
- IconRight: () => /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(import_react48.CaretRightIcon, { className: "h-4 w-4" })
11668
+ IconLeft: () => /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(import_react46.CaretLeftIcon, { className: "h-4 w-4" }),
11669
+ IconRight: () => /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(import_react46.CaretRightIcon, { className: "h-4 w-4" })
11736
11670
  }
11737
11671
  }
11738
11672
  )
@@ -11804,7 +11738,7 @@ RangePicker.displayName = "RangePicker";
11804
11738
 
11805
11739
  // src/components/ui/navigation/ContextMenuBase.tsx
11806
11740
  var ContextMenuPrimitive = __toESM(require("@radix-ui/react-context-menu"));
11807
- var import_react49 = require("@phosphor-icons/react");
11741
+ var import_react47 = require("@phosphor-icons/react");
11808
11742
  var import_jsx_runtime69 = require("react/jsx-runtime");
11809
11743
  function ContextMenuBase(props) {
11810
11744
  return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(ContextMenuPrimitive.Root, { "data-slot": "context-menu", ...props });
@@ -11846,7 +11780,7 @@ function ContextMenuSubTriggerBase({
11846
11780
  ...props,
11847
11781
  children: [
11848
11782
  children,
11849
- /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(import_react49.CaretRightIcon, { className: "ml-auto" })
11783
+ /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(import_react47.CaretRightIcon, { className: "ml-auto" })
11850
11784
  ]
11851
11785
  }
11852
11786
  );
@@ -11941,7 +11875,7 @@ function ContextMenuCheckboxItemBase({
11941
11875
  checked,
11942
11876
  ...props,
11943
11877
  children: [
11944
- /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("span", { className: "pointer-events-none absolute left-2 flex size-3.5 items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(ContextMenuPrimitive.ItemIndicator, { children: /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(import_react49.CheckIcon, { className: "size-4" }) }) }),
11878
+ /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("span", { className: "pointer-events-none absolute left-2 flex size-3.5 items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(ContextMenuPrimitive.ItemIndicator, { children: /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(import_react47.CheckIcon, { className: "size-4" }) }) }),
11945
11879
  children
11946
11880
  ]
11947
11881
  }
@@ -11966,7 +11900,7 @@ function ContextMenuRadioItemBase({
11966
11900
  ),
11967
11901
  ...props,
11968
11902
  children: [
11969
- /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("span", { className: "pointer-events-none absolute left-2 flex size-3.5 items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(ContextMenuPrimitive.ItemIndicator, { children: /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(import_react49.CircleIcon, { className: "size-2 fill-current" }) }) }),
11903
+ /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("span", { className: "pointer-events-none absolute left-2 flex size-3.5 items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(ContextMenuPrimitive.ItemIndicator, { children: /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(import_react47.CircleIcon, { className: "size-2 fill-current" }) }) }),
11970
11904
  children
11971
11905
  ]
11972
11906
  }
@@ -12015,8 +11949,8 @@ function ContextMenuShortcutBase({
12015
11949
  }
12016
11950
 
12017
11951
  // src/components/ui/CodeBlock.tsx
12018
- var import_react50 = require("@phosphor-icons/react");
12019
- var import_react51 = __toESM(require("react"));
11952
+ var import_react48 = require("@phosphor-icons/react");
11953
+ var import_react49 = __toESM(require("react"));
12020
11954
  var import_react_syntax_highlighter = require("react-syntax-highlighter");
12021
11955
  var import_jsx_runtime70 = require("react/jsx-runtime");
12022
11956
  var CodeBlock = ({
@@ -12028,11 +11962,11 @@ var CodeBlock = ({
12028
11962
  breadcrumb = [],
12029
11963
  showStats = true
12030
11964
  }) => {
12031
- const [copied, setCopied] = import_react51.default.useState(false);
12032
- const [activeTab, setActiveTab] = import_react51.default.useState(0);
12033
- const [isExpanded, setIsExpanded] = import_react51.default.useState(false);
11965
+ const [copied, setCopied] = import_react49.default.useState(false);
11966
+ const [activeTab, setActiveTab] = import_react49.default.useState(0);
11967
+ const [isExpanded, setIsExpanded] = import_react49.default.useState(false);
12034
11968
  const tabsExist = tabs.length > 0;
12035
- const cssVars = import_react51.default.useMemo(
11969
+ const cssVars = import_react49.default.useMemo(
12036
11970
  () => ({
12037
11971
  container: {
12038
11972
  backgroundColor: "hsl(var(--card))",
@@ -12097,12 +12031,12 @@ var CodeBlock = ({
12097
12031
  case "jsx":
12098
12032
  case "typescript":
12099
12033
  case "tsx":
12100
- return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(import_react50.CodeIcon, { size: "1em", className: "text-yellow-400" });
12034
+ return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(import_react48.CodeIcon, { size: "1em", className: "text-yellow-400" });
12101
12035
  case "bash":
12102
12036
  case "shell":
12103
- return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(import_react50.TerminalIcon, { size: "1em", className: "text-green-400" });
12037
+ return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(import_react48.TerminalIcon, { size: "1em", className: "text-green-400" });
12104
12038
  default:
12105
- return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(import_react50.FileArchiveIcon, { size: "1em", className: "text-blue-400" });
12039
+ return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(import_react48.FileArchiveIcon, { size: "1em", className: "text-blue-400" });
12106
12040
  }
12107
12041
  };
12108
12042
  const getCodeStats = (source) => {
@@ -12127,8 +12061,8 @@ var CodeBlock = ({
12127
12061
  /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("div", { className: "w-3 h-3 rounded-full bg-green-500" })
12128
12062
  ] }),
12129
12063
  breadcrumb.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { className: "flex items-center min-w-0", children: [
12130
- /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(import_react50.FolderIcon, { size: "1em", style: cssVars.icon }),
12131
- /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("div", { className: "flex items-center min-w-0 ml-2", children: breadcrumb.map((crumb, index) => /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)(import_react51.default.Fragment, { children: [
12064
+ /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(import_react48.FolderIcon, { size: "1em", style: cssVars.icon }),
12065
+ /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("div", { className: "flex items-center min-w-0 ml-2", children: breadcrumb.map((crumb, index) => /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)(import_react49.default.Fragment, { children: [
12132
12066
  /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
12133
12067
  "span",
12134
12068
  {
@@ -12138,7 +12072,7 @@ var CodeBlock = ({
12138
12072
  }
12139
12073
  ),
12140
12074
  index < breadcrumb.length - 1 && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
12141
- import_react50.ArrowRightIcon,
12075
+ import_react48.ArrowRightIcon,
12142
12076
  {
12143
12077
  size: "0.75em",
12144
12078
  style: cssVars.icon,
@@ -12169,7 +12103,7 @@ var CodeBlock = ({
12169
12103
  onClick: () => setIsExpanded(!isExpanded),
12170
12104
  className: `p-2 transition-colors hover:bg-gray-200 dark:hover:bg-slate-700`,
12171
12105
  title: "Toggle fullscreen",
12172
- children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(import_react50.ArrowsOutIcon, { size: "1em", style: cssVars.icon })
12106
+ children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(import_react48.ArrowsOutIcon, { size: "1em", style: cssVars.icon })
12173
12107
  }
12174
12108
  ),
12175
12109
  /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
@@ -12178,7 +12112,7 @@ var CodeBlock = ({
12178
12112
  onClick: downloadCode,
12179
12113
  className: `p-2 transition-colors hover:bg-gray-200 dark:hover:bg-slate-700`,
12180
12114
  title: "Download code",
12181
- children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(import_react50.DownloadIcon, { size: "1em", style: cssVars.icon })
12115
+ children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(import_react48.DownloadIcon, { size: "1em", style: cssVars.icon })
12182
12116
  }
12183
12117
  ),
12184
12118
  /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
@@ -12188,12 +12122,12 @@ var CodeBlock = ({
12188
12122
  className: `p-2 transition-colors hover:bg-gray-200 dark:hover:bg-slate-700`,
12189
12123
  title: "Copy code",
12190
12124
  children: copied ? /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
12191
- import_react50.CheckIcon,
12125
+ import_react48.CheckIcon,
12192
12126
  {
12193
12127
  size: "1em",
12194
12128
  style: { color: "hsl(var(--primary))" }
12195
12129
  }
12196
- ) : /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(import_react50.CopyIcon, { size: "1em", style: cssVars.icon })
12130
+ ) : /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(import_react48.CopyIcon, { size: "1em", style: cssVars.icon })
12197
12131
  }
12198
12132
  )
12199
12133
  ] })
@@ -12306,7 +12240,7 @@ var CodeBlock = ({
12306
12240
  ] })
12307
12241
  ] }),
12308
12242
  /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { className: "flex items-center gap-1 shrink-0", children: [
12309
- /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(import_react50.GearIcon, { size: "0.75em", style: cssVars.icon }),
12243
+ /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(import_react48.GearIcon, { size: "0.75em", style: cssVars.icon }),
12310
12244
  /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("span", { children: "UTF-8" })
12311
12245
  ] })
12312
12246
  ]
@@ -12385,13 +12319,13 @@ function StatusIndicator({
12385
12319
  }
12386
12320
 
12387
12321
  // src/components/ui/form/DebouncedInput.tsx
12388
- var import_react52 = require("react");
12389
- var import_react53 = require("@phosphor-icons/react");
12322
+ var import_react50 = require("react");
12323
+ var import_react51 = require("@phosphor-icons/react");
12390
12324
  var import_jsx_runtime72 = require("react/jsx-runtime");
12391
12325
  function DebouncedInput({
12392
12326
  value: initialValue,
12393
12327
  onChange,
12394
- debounce = 500,
12328
+ debounce: debounce2 = 500,
12395
12329
  label,
12396
12330
  labelClassname,
12397
12331
  leftIcon,
@@ -12401,27 +12335,27 @@ function DebouncedInput({
12401
12335
  error,
12402
12336
  ...props
12403
12337
  }) {
12404
- const [value, setValue] = (0, import_react52.useState)(initialValue);
12405
- const [isDebouncing, setIsDebouncing] = (0, import_react52.useState)(false);
12406
- (0, import_react52.useEffect)(() => {
12338
+ const [value, setValue] = (0, import_react50.useState)(initialValue);
12339
+ const [isDebouncing, setIsDebouncing] = (0, import_react50.useState)(false);
12340
+ (0, import_react50.useEffect)(() => {
12407
12341
  setValue(initialValue);
12408
12342
  }, [initialValue]);
12409
- (0, import_react52.useEffect)(() => {
12343
+ (0, import_react50.useEffect)(() => {
12410
12344
  if (value !== initialValue) {
12411
12345
  setIsDebouncing(true);
12412
12346
  }
12413
12347
  const timeout = setTimeout(() => {
12414
12348
  onChange(value);
12415
12349
  setIsDebouncing(false);
12416
- }, debounce);
12350
+ }, debounce2);
12417
12351
  return () => {
12418
12352
  clearTimeout(timeout);
12419
12353
  setIsDebouncing(false);
12420
12354
  };
12421
- }, [debounce, initialValue, onChange, value]);
12355
+ }, [debounce2, initialValue, onChange, value]);
12422
12356
  const renderRightIcon = () => {
12423
12357
  if (showLoadingIndicator && isDebouncing) {
12424
- return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(import_react53.CircleNotchIcon, { className: "h-4 w-4 animate-spin text-muted-foreground" });
12358
+ return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(import_react51.CircleNotchIcon, { className: "h-4 w-4 animate-spin text-muted-foreground" });
12425
12359
  }
12426
12360
  return rightIcon;
12427
12361
  };
@@ -12444,15 +12378,32 @@ function DebouncedInput({
12444
12378
  // src/components/event-calendar/AgendaView.tsx
12445
12379
  var import_date_fns3 = require("date-fns");
12446
12380
  var import_locale2 = require("date-fns/locale");
12447
- var import_react54 = require("react");
12448
- var import_react55 = require("@phosphor-icons/react");
12381
+ var import_react52 = require("react");
12382
+ var import_react53 = require("@phosphor-icons/react");
12449
12383
  var import_jsx_runtime73 = require("react/jsx-runtime");
12450
12384
  function AgendaView({
12451
12385
  currentDate,
12452
12386
  events,
12453
- onEventSelect
12387
+ onEventSelect,
12388
+ showUndatedEvents = false
12454
12389
  }) {
12455
- const days = (0, import_react54.useMemo)(() => {
12390
+ const isValidDate3 = (d) => {
12391
+ try {
12392
+ const t = d instanceof Date ? d.getTime() : new Date(String(d)).getTime();
12393
+ return !isNaN(t);
12394
+ } catch {
12395
+ return false;
12396
+ }
12397
+ };
12398
+ const datedEvents = (0, import_react52.useMemo)(
12399
+ () => events.filter((e) => isValidDate3(e.start) && isValidDate3(e.end)),
12400
+ [events]
12401
+ );
12402
+ const undatedEvents = (0, import_react52.useMemo)(
12403
+ () => events.filter((e) => !(isValidDate3(e.start) && isValidDate3(e.end))),
12404
+ [events]
12405
+ );
12406
+ const days = (0, import_react52.useMemo)(() => {
12456
12407
  console.log("Agenda view updating with date:", currentDate.toISOString());
12457
12408
  return Array.from(
12458
12409
  { length: AgendaDaysToShow },
@@ -12462,58 +12413,76 @@ function AgendaView({
12462
12413
  const handleEventClick = (event, e) => {
12463
12414
  e.stopPropagation();
12464
12415
  console.log("Agenda view event clicked:", event);
12465
- onEventSelect(event);
12416
+ if (onEventSelect) onEventSelect(event);
12466
12417
  };
12467
12418
  const hasEvents = days.some(
12468
- (day) => getAgendaEventsForDay(events, day).length > 0
12419
+ (day) => getAgendaEventsForDay(datedEvents, day).length > 0
12469
12420
  );
12470
- return /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("div", { className: "border-border/70 border-t px-4", children: !hasEvents ? /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("div", { className: "flex min-h-[70svh] flex-col items-center justify-center py-16 text-center", children: [
12471
- /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(import_react55.CalendarIcon, { className: "mb-2 text-muted-foreground/50", size: 32 }),
12421
+ return /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("div", { className: "border-border/70 border-t px-4", children: !hasEvents && !(showUndatedEvents && undatedEvents.length > 0) ? /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("div", { className: "flex min-h-[70svh] flex-col items-center justify-center py-16 text-center", children: [
12422
+ /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(import_react53.CalendarIcon, { className: "mb-2 text-muted-foreground/50", size: 32 }),
12472
12423
  /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("h3", { className: "font-medium text-lg", children: "Nenhum evento encontrado" }),
12473
12424
  /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("p", { className: "text-muted-foreground", children: "N\xE3o h\xE1 eventos agendados para este per\xEDodo." })
12474
- ] }) : days.map((day) => {
12475
- const dayEvents = getAgendaEventsForDay(events, day);
12476
- if (dayEvents.length === 0) return null;
12477
- return /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)(
12478
- "div",
12479
- {
12480
- className: "relative my-12 border-border/70 border-t",
12481
- children: [
12482
- /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
12483
- "span",
12484
- {
12485
- className: "-top-3 absolute left-0 flex h-6 items-center bg-background pe-4 text-[10px] uppercase data-today:font-medium sm:pe-4 sm:text-xs",
12486
- "data-today": (0, import_date_fns3.isToday)(day) || void 0,
12487
- children: (() => {
12488
- const s = (0, import_date_fns3.format)(day, "d MMM, EEEE", { locale: import_locale2.ptBR });
12489
- return s.split(" ").map((w) => w ? w[0].toUpperCase() + w.slice(1) : w).join(" ");
12490
- })()
12491
- }
12492
- ),
12493
- /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("div", { className: "mt-6 space-y-2", children: dayEvents.map((event) => /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
12494
- EventItem,
12495
- {
12496
- event,
12497
- onClick: (e) => handleEventClick(event, e),
12498
- view: "agenda"
12499
- },
12500
- event.id
12501
- )) })
12502
- ]
12503
- },
12504
- day.toString()
12505
- );
12506
- }) });
12425
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)(import_jsx_runtime73.Fragment, { children: [
12426
+ days.map((day) => {
12427
+ const dayEvents = getAgendaEventsForDay(datedEvents, day);
12428
+ if (dayEvents.length === 0) return null;
12429
+ return /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)(
12430
+ "div",
12431
+ {
12432
+ className: "relative my-12 border-border/70 border-t",
12433
+ children: [
12434
+ /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
12435
+ "span",
12436
+ {
12437
+ className: "-top-3 absolute left-0 flex h-6 items-center bg-background pe-4 text-[10px] uppercase data-today:font-medium sm:pe-4 sm:text-xs",
12438
+ "data-today": (0, import_date_fns3.isToday)(day) || void 0,
12439
+ children: (() => {
12440
+ const s = (0, import_date_fns3.format)(day, "d MMM, EEEE", { locale: import_locale2.ptBR });
12441
+ return s.split(" ").map((w) => w ? w[0].toUpperCase() + w.slice(1) : w).join(" ");
12442
+ })()
12443
+ }
12444
+ ),
12445
+ /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("div", { className: "mt-6 space-y-2", children: dayEvents.map((event) => /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
12446
+ EventItem,
12447
+ {
12448
+ event,
12449
+ onClick: onEventSelect ? (e) => handleEventClick(event, e) : void 0,
12450
+ view: "agenda",
12451
+ agendaOnly: showUndatedEvents,
12452
+ className: onEventSelect ? void 0 : "cursor-default hover:shadow-none hover:scale-100"
12453
+ },
12454
+ event.id
12455
+ )) })
12456
+ ]
12457
+ },
12458
+ day.toString()
12459
+ );
12460
+ }),
12461
+ showUndatedEvents && undatedEvents.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("div", { className: "relative my-12 border-border/70 border-t", children: [
12462
+ /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("span", { className: "-top-3 absolute left-0 flex h-6 items-center bg-background pe-4 text-[10px] uppercase sm:pe-4 sm:text-xs", children: "Data de Atendimento n\xE3o Prevista" }),
12463
+ /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("div", { className: "mt-6 space-y-2", children: undatedEvents.map((event) => /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
12464
+ EventItem,
12465
+ {
12466
+ event,
12467
+ onClick: onEventSelect ? (e) => handleEventClick(event, e) : void 0,
12468
+ view: "agenda",
12469
+ agendaOnly: showUndatedEvents,
12470
+ className: showUndatedEvents ? "cursor-default hover:shadow-none hover:scale-100 bg-gray-200/50 hover:bg-gray-200/40 text-gray-900/80 dark:bg-gray-700/25 dark:text-gray-200/90 shadow-none " : onEventSelect ? void 0 : "cursor-default hover:shadow-none hover:scale-100"
12471
+ },
12472
+ event.id
12473
+ )) })
12474
+ ] })
12475
+ ] }) });
12507
12476
  }
12508
12477
 
12509
12478
  // src/components/event-calendar/CalendarDND.tsx
12510
12479
  var import_core = require("@dnd-kit/core");
12511
12480
  var import_date_fns4 = require("date-fns");
12512
- var import_react57 = require("react");
12481
+ var import_react55 = require("react");
12513
12482
 
12514
12483
  // src/components/event-calendar/hooks.ts
12515
- var import_react56 = require("react");
12516
- var CalendarDndContext = (0, import_react56.createContext)({
12484
+ var import_react54 = require("react");
12485
+ var CalendarDndContext = (0, import_react54.createContext)({
12517
12486
  activeEvent: null,
12518
12487
  activeId: null,
12519
12488
  activeView: null,
@@ -12523,7 +12492,7 @@ var CalendarDndContext = (0, import_react56.createContext)({
12523
12492
  isMultiDay: false,
12524
12493
  multiDayWidth: null
12525
12494
  });
12526
- var useCalendarDnd = () => (0, import_react56.useContext)(CalendarDndContext);
12495
+ var useCalendarDnd = () => (0, import_react54.useContext)(CalendarDndContext);
12527
12496
 
12528
12497
  // src/components/event-calendar/CalendarDND.tsx
12529
12498
  var import_jsx_runtime74 = require("react/jsx-runtime");
@@ -12531,17 +12500,17 @@ function CalendarDndProvider({
12531
12500
  children,
12532
12501
  onEventUpdate
12533
12502
  }) {
12534
- const [activeEvent, setActiveEvent] = (0, import_react57.useState)(null);
12535
- const [activeId, setActiveId] = (0, import_react57.useState)(null);
12536
- const [activeView, setActiveView] = (0, import_react57.useState)(
12503
+ const [activeEvent, setActiveEvent] = (0, import_react55.useState)(null);
12504
+ const [activeId, setActiveId] = (0, import_react55.useState)(null);
12505
+ const [activeView, setActiveView] = (0, import_react55.useState)(
12537
12506
  null
12538
12507
  );
12539
- const [currentTime, setCurrentTime] = (0, import_react57.useState)(null);
12540
- const [eventHeight, setEventHeight] = (0, import_react57.useState)(null);
12541
- const [isMultiDay, setIsMultiDay] = (0, import_react57.useState)(false);
12542
- const [multiDayWidth, setMultiDayWidth] = (0, import_react57.useState)(null);
12543
- const [dragHandlePosition, setDragHandlePosition] = (0, import_react57.useState)(null);
12544
- const eventDimensions = (0, import_react57.useRef)({ height: 0 });
12508
+ const [currentTime, setCurrentTime] = (0, import_react55.useState)(null);
12509
+ const [eventHeight, setEventHeight] = (0, import_react55.useState)(null);
12510
+ const [isMultiDay, setIsMultiDay] = (0, import_react55.useState)(false);
12511
+ const [multiDayWidth, setMultiDayWidth] = (0, import_react55.useState)(null);
12512
+ const [dragHandlePosition, setDragHandlePosition] = (0, import_react55.useState)(null);
12513
+ const eventDimensions = (0, import_react55.useRef)({ height: 0 });
12545
12514
  const sensors = (0, import_core.useSensors)(
12546
12515
  (0, import_core.useSensor)(import_core.MouseSensor, {
12547
12516
  // Require the mouse to move by 5px before activating
@@ -12563,7 +12532,7 @@ function CalendarDndProvider({
12563
12532
  }
12564
12533
  })
12565
12534
  );
12566
- const dndContextId = (0, import_react57.useId)();
12535
+ const dndContextId = (0, import_react55.useId)();
12567
12536
  const handleDragStart = (event) => {
12568
12537
  const { active } = event;
12569
12538
  if (!active.data.current) {
@@ -12755,7 +12724,7 @@ var DefaultEndHour = 10;
12755
12724
 
12756
12725
  // src/components/event-calendar/DayView.tsx
12757
12726
  var import_date_fns5 = require("date-fns");
12758
- var import_react58 = require("react");
12727
+ var import_react56 = require("react");
12759
12728
  var import_jsx_runtime75 = require("react/jsx-runtime");
12760
12729
  function DayView({
12761
12730
  currentDate,
@@ -12763,14 +12732,14 @@ function DayView({
12763
12732
  onEventSelect,
12764
12733
  onEventCreate
12765
12734
  }) {
12766
- const hours = (0, import_react58.useMemo)(() => {
12735
+ const hours = (0, import_react56.useMemo)(() => {
12767
12736
  const dayStart = (0, import_date_fns5.startOfDay)(currentDate);
12768
12737
  return (0, import_date_fns5.eachHourOfInterval)({
12769
12738
  end: (0, import_date_fns5.addHours)(dayStart, EndHour - 1),
12770
12739
  start: (0, import_date_fns5.addHours)(dayStart, StartHour)
12771
12740
  });
12772
12741
  }, [currentDate]);
12773
- const dayEvents = (0, import_react58.useMemo)(() => {
12742
+ const dayEvents = (0, import_react56.useMemo)(() => {
12774
12743
  return events.filter((event) => {
12775
12744
  const eventStart = new Date(event.start);
12776
12745
  const eventEnd = new Date(event.end);
@@ -12779,17 +12748,17 @@ function DayView({
12779
12748
  (a, b) => new Date(a.start).getTime() - new Date(b.start).getTime()
12780
12749
  );
12781
12750
  }, [currentDate, events]);
12782
- const allDayEvents = (0, import_react58.useMemo)(() => {
12751
+ const allDayEvents = (0, import_react56.useMemo)(() => {
12783
12752
  return dayEvents.filter((event) => {
12784
12753
  return event.allDay || isMultiDayEvent(event);
12785
12754
  });
12786
12755
  }, [dayEvents]);
12787
- const timeEvents = (0, import_react58.useMemo)(() => {
12756
+ const timeEvents = (0, import_react56.useMemo)(() => {
12788
12757
  return dayEvents.filter((event) => {
12789
12758
  return !event.allDay && !isMultiDayEvent(event);
12790
12759
  });
12791
12760
  }, [dayEvents]);
12792
- const positionedEvents = (0, import_react58.useMemo)(() => {
12761
+ const positionedEvents = (0, import_react56.useMemo)(() => {
12793
12762
  const result = [];
12794
12763
  const dayStart = (0, import_date_fns5.startOfDay)(currentDate);
12795
12764
  const sortedEvents = [...timeEvents].sort((a, b) => {
@@ -12970,7 +12939,7 @@ function DayView({
12970
12939
  var import_core2 = require("@dnd-kit/core");
12971
12940
  var import_utilities = require("@dnd-kit/utilities");
12972
12941
  var import_date_fns6 = require("date-fns");
12973
- var import_react59 = require("react");
12942
+ var import_react57 = require("react");
12974
12943
  var import_jsx_runtime76 = require("react/jsx-runtime");
12975
12944
  function DraggableEvent({
12976
12945
  event,
@@ -12985,8 +12954,8 @@ function DraggableEvent({
12985
12954
  "aria-hidden": ariaHidden
12986
12955
  }) {
12987
12956
  const { activeId } = useCalendarDnd();
12988
- const elementRef = (0, import_react59.useRef)(null);
12989
- const [dragHandlePosition, setDragHandlePosition] = (0, import_react59.useState)(null);
12957
+ const elementRef = (0, import_react57.useRef)(null);
12958
+ const [dragHandlePosition, setDragHandlePosition] = (0, import_react57.useState)(null);
12990
12959
  const eventStart = new Date(event.start);
12991
12960
  const eventEnd = new Date(event.end);
12992
12961
  const isMultiDayEvent2 = isMultiDay || event.allDay || (0, import_date_fns6.differenceInDays)(eventEnd, eventStart) >= 1;
@@ -13111,9 +13080,9 @@ function DroppableCell({
13111
13080
  // src/components/event-calendar/EventCalendar.tsx
13112
13081
  var import_date_fns7 = require("date-fns");
13113
13082
  var import_locale3 = require("date-fns/locale");
13114
- var import_react60 = require("react");
13083
+ var import_react58 = require("react");
13115
13084
  var import_sonner3 = require("sonner");
13116
- var import_react61 = require("@phosphor-icons/react");
13085
+ var import_react59 = require("@phosphor-icons/react");
13117
13086
  var import_jsx_runtime78 = require("react/jsx-runtime");
13118
13087
  function EventCalendar({
13119
13088
  events = [],
@@ -13121,14 +13090,19 @@ function EventCalendar({
13121
13090
  onEventUpdate,
13122
13091
  onEventDelete,
13123
13092
  className,
13124
- initialView = "month"
13093
+ initialView = "month",
13094
+ mode = "default"
13125
13095
  }) {
13126
- const [currentDate, setCurrentDate] = (0, import_react60.useState)(/* @__PURE__ */ new Date());
13127
- const [view, setView] = (0, import_react60.useState)(initialView);
13128
- const [isFading, setIsFading] = (0, import_react60.useState)(false);
13096
+ const isAgendaOnly = mode === "agenda-only";
13097
+ const [currentDate, setCurrentDate] = (0, import_react58.useState)(/* @__PURE__ */ new Date());
13098
+ const [view, setView] = (0, import_react58.useState)(
13099
+ isAgendaOnly ? "agenda" : initialView
13100
+ );
13101
+ const [isFading, setIsFading] = (0, import_react58.useState)(false);
13129
13102
  const FADE_DURATION = 220;
13130
- const changeView = (0, import_react60.useCallback)(
13103
+ const changeView = (0, import_react58.useCallback)(
13131
13104
  (next) => {
13105
+ if (isAgendaOnly) return;
13132
13106
  if (next === view) return;
13133
13107
  setIsFading(true);
13134
13108
  window.setTimeout(() => {
@@ -13136,14 +13110,14 @@ function EventCalendar({
13136
13110
  requestAnimationFrame(() => setIsFading(false));
13137
13111
  }, FADE_DURATION);
13138
13112
  },
13139
- [view]
13113
+ [view, isAgendaOnly]
13140
13114
  );
13141
- const [isPaging, setIsPaging] = (0, import_react60.useState)(false);
13142
- const [pageDirection, setPageDirection] = (0, import_react60.useState)(
13115
+ const [isPaging, setIsPaging] = (0, import_react58.useState)(false);
13116
+ const [pageDirection, setPageDirection] = (0, import_react58.useState)(
13143
13117
  null
13144
13118
  );
13145
13119
  const PAGE_DURATION = 200;
13146
- const pageTransition = (0, import_react60.useCallback)(
13120
+ const pageTransition = (0, import_react58.useCallback)(
13147
13121
  (applyDateChange, direction) => {
13148
13122
  setIsPaging(true);
13149
13123
  setPageDirection(direction);
@@ -13157,20 +13131,20 @@ function EventCalendar({
13157
13131
  },
13158
13132
  []
13159
13133
  );
13160
- const [isEventDialogOpen, setIsEventDialogOpen] = (0, import_react60.useState)(false);
13161
- const [selectedEvent, setSelectedEvent] = (0, import_react60.useState)(
13134
+ const [isEventDialogOpen, setIsEventDialogOpen] = (0, import_react58.useState)(false);
13135
+ const [selectedEvent, setSelectedEvent] = (0, import_react58.useState)(
13162
13136
  null
13163
13137
  );
13164
- (0, import_react60.useEffect)(() => {
13138
+ (0, import_react58.useEffect)(() => {
13165
13139
  const handleKeyDown = (e) => {
13166
13140
  if (isEventDialogOpen || e.target instanceof HTMLInputElement || e.target instanceof HTMLTextAreaElement || e.target instanceof HTMLElement && e.target.isContentEditable) {
13167
13141
  return;
13168
13142
  }
13143
+ if (isAgendaOnly) return;
13169
13144
  switch (e.key.toLowerCase()) {
13170
13145
  case "m":
13171
13146
  changeView("month");
13172
13147
  break;
13173
- // aceitar tanto 'w' (inglês) quanto 's' (pt-BR para "semana")
13174
13148
  case "w":
13175
13149
  case "s":
13176
13150
  changeView("week");
@@ -13187,7 +13161,7 @@ function EventCalendar({
13187
13161
  return () => {
13188
13162
  window.removeEventListener("keydown", handleKeyDown);
13189
13163
  };
13190
- }, [isEventDialogOpen, changeView]);
13164
+ }, [isEventDialogOpen, changeView, isAgendaOnly]);
13191
13165
  const handlePrevious = () => {
13192
13166
  pageTransition(() => {
13193
13167
  if (view === "month") {
@@ -13218,11 +13192,13 @@ function EventCalendar({
13218
13192
  setCurrentDate(/* @__PURE__ */ new Date());
13219
13193
  };
13220
13194
  const handleEventSelect = (event) => {
13195
+ if (isAgendaOnly) return;
13221
13196
  console.log("Event selected:", event);
13222
13197
  setSelectedEvent(event);
13223
13198
  setIsEventDialogOpen(true);
13224
13199
  };
13225
13200
  const handleEventCreate = (startTime) => {
13201
+ if (isAgendaOnly) return;
13226
13202
  console.log("Creating new event at:", startTime);
13227
13203
  const minutes = startTime.getMinutes();
13228
13204
  const remainder = minutes % 15;
@@ -13296,7 +13272,7 @@ function EventCalendar({
13296
13272
  position: "bottom-left"
13297
13273
  });
13298
13274
  };
13299
- const viewTitle = (0, import_react60.useMemo)(() => {
13275
+ const viewTitle = (0, import_react58.useMemo)(() => {
13300
13276
  const capitalize = (s) => s && s.length > 0 ? s.charAt(0).toUpperCase() + s.slice(1) : s;
13301
13277
  if (view === "month") {
13302
13278
  return capitalize((0, import_date_fns7.format)(currentDate, "MMMM yyyy", { locale: import_locale3.ptBR }));
@@ -13316,7 +13292,9 @@ function EventCalendar({
13316
13292
  const month = capitalize((0, import_date_fns7.format)(currentDate, "MMMM", { locale: import_locale3.ptBR }));
13317
13293
  const year = (0, import_date_fns7.format)(currentDate, "yyyy", { locale: import_locale3.ptBR });
13318
13294
  const short = `${dayNum} de ${month} de ${year}`;
13319
- const long = `${(0, import_date_fns7.format)(currentDate, "EEE", { locale: import_locale3.ptBR })}, ${dayNum} de ${month} de ${year}`;
13295
+ const long = `${(0, import_date_fns7.format)(currentDate, "EEE", {
13296
+ locale: import_locale3.ptBR
13297
+ })}, ${dayNum} de ${month} de ${year}`;
13320
13298
  return /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)(import_jsx_runtime78.Fragment, { children: [
13321
13299
  /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("span", { "aria-hidden": "true", className: "min-[480px]:hidden", children: short }),
13322
13300
  /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("span", { "aria-hidden": "true", className: "max-[479px]:hidden min-md:hidden", children: short }),
@@ -13335,224 +13313,228 @@ function EventCalendar({
13335
13313
  }
13336
13314
  return capitalize((0, import_date_fns7.format)(currentDate, "MMMM yyyy", { locale: import_locale3.ptBR }));
13337
13315
  }, [currentDate, view]);
13338
- return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
13339
- "div",
13340
- {
13341
- className: "flex flex-col rounded-lg border has-data-[slot=month-view]:flex-1 p-6",
13342
- style: {
13343
- "--event-gap": `${EventGap}px`,
13344
- "--event-height": `${EventHeight}px`,
13345
- "--week-cells-height": `${WeekCellsHeight}px`
13346
- },
13347
- children: /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)(CalendarDndProvider, { onEventUpdate: handleEventUpdate, children: [
13348
- /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)(
13349
- "div",
13350
- {
13351
- className: cn(
13352
- "flex items-center justify-between p-2 sm:p-4",
13353
- className
13354
- ),
13355
- children: [
13356
- /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)("div", { className: "flex items-center gap-1 sm:gap-4", children: [
13357
- /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)(
13358
- ButtonBase,
13359
- {
13360
- className: "max-[479px]:aspect-square max-[479px]:p-0!",
13361
- onClick: handleToday,
13362
- variant: "outline",
13363
- children: [
13364
- /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
13365
- import_react61.CalendarIcon,
13366
- {
13367
- "aria-hidden": "true",
13368
- className: "min-[480px]:hidden",
13369
- size: 16
13370
- }
13371
- ),
13372
- /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("span", { className: "max-[479px]:sr-only", children: "Hoje" })
13373
- ]
13374
- }
13375
- ),
13376
- /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)("div", { className: "flex items-center sm:gap-2", children: [
13316
+ const calendarContent = /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)(import_jsx_runtime78.Fragment, { children: [
13317
+ /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)(
13318
+ "div",
13319
+ {
13320
+ className: cn(
13321
+ "flex items-center justify-between p-2 sm:p-4",
13322
+ className
13323
+ ),
13324
+ children: [
13325
+ /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)("div", { className: "flex items-center gap-1 sm:gap-4", children: [
13326
+ !isAgendaOnly && /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)(
13327
+ ButtonBase,
13328
+ {
13329
+ className: "max-[479px]:aspect-square max-[479px]:p-0!",
13330
+ onClick: handleToday,
13331
+ variant: "outline",
13332
+ children: [
13377
13333
  /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
13378
- ButtonBase,
13334
+ import_react59.CalendarIcon,
13379
13335
  {
13380
- "aria-label": "Anterior",
13381
- onClick: handlePrevious,
13382
- size: "icon",
13383
- variant: "ghost",
13384
- children: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(import_react61.CaretLeft, { "aria-hidden": "true", size: 16 })
13336
+ "aria-hidden": "true",
13337
+ className: "min-[480px]:hidden",
13338
+ size: 16
13385
13339
  }
13386
13340
  ),
13387
- /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
13388
- ButtonBase,
13389
- {
13390
- "aria-label": "Pr\xF3ximo",
13391
- onClick: handleNext,
13392
- size: "icon",
13393
- variant: "ghost",
13394
- children: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(import_react61.CaretRight, { "aria-hidden": "true", size: 16 })
13395
- }
13396
- )
13397
- ] }),
13398
- /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("h2", { className: "font-semibold text-sm sm:text-lg md:text-xl", children: viewTitle })
13399
- ] }),
13400
- /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)("div", { className: "flex items-center gap-2", children: [
13401
- /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)(DropDownMenuBase, { children: [
13402
- /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(DropDownMenuTriggerBase, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)(
13403
- ButtonBase,
13404
- {
13405
- className: "gap-1.5 max-[479px]:h-8",
13406
- variant: "outline",
13407
- children: [
13408
- /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)("span", { children: [
13409
- /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("span", { "aria-hidden": "true", className: "min-[480px]:hidden", children: (() => {
13410
- const labels = {
13411
- month: "M\xEAs",
13412
- week: "Semana",
13413
- day: "Dia",
13414
- agenda: "Agenda"
13415
- };
13416
- return (labels[view] || view).charAt(0).toUpperCase();
13417
- })() }),
13418
- /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("span", { className: "max-[479px]:sr-only", children: (() => {
13419
- const labels = {
13420
- month: "M\xEAs",
13421
- week: "Semana",
13422
- day: "Dia",
13423
- agenda: "Agenda"
13424
- };
13425
- return labels[view] || view;
13426
- })() })
13427
- ] }),
13428
- /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
13429
- import_react61.ArrowDownIcon,
13430
- {
13431
- "aria-hidden": "true",
13432
- className: "-me-1 opacity-60",
13433
- size: 16
13434
- }
13435
- )
13436
- ]
13437
- }
13438
- ) }),
13439
- /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)(DropDownMenuContentBase, { align: "end", className: "min-w-32", children: [
13440
- /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)(DropDownMenuItemBase, { onClick: () => changeView("month"), children: [
13441
- "M\xEAs ",
13442
- /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(DropDownMenuShortcutBase, { children: "M" })
13443
- ] }),
13444
- /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)(DropDownMenuItemBase, { onClick: () => changeView("week"), children: [
13445
- "Semana ",
13446
- /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(DropDownMenuShortcutBase, { children: "S" })
13447
- ] }),
13448
- /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)(DropDownMenuItemBase, { onClick: () => changeView("day"), children: [
13449
- "Dia ",
13450
- /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(DropDownMenuShortcutBase, { children: "D" })
13451
- ] }),
13452
- /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)(DropDownMenuItemBase, { onClick: () => changeView("agenda"), children: [
13453
- "Agenda ",
13454
- /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(DropDownMenuShortcutBase, { children: "A" })
13455
- ] })
13456
- ] })
13457
- ] }),
13458
- /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)(
13459
- ButtonBase,
13460
- {
13461
- className: "max-[479px]:aspect-square max-[479px]:p-0!",
13462
- onClick: () => {
13463
- setSelectedEvent(null);
13464
- setIsEventDialogOpen(true);
13465
- },
13466
- size: "sm",
13467
- children: [
13468
- /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
13469
- import_react61.PlusIcon,
13470
- {
13471
- "aria-hidden": "true",
13472
- className: "sm:-ms-1 opacity-60",
13473
- size: 16
13474
- }
13475
- ),
13476
- /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("span", { className: "max-sm:sr-only", children: "Novo evento" })
13477
- ]
13478
- }
13479
- )
13480
- ] })
13481
- ]
13482
- }
13483
- ),
13484
- /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)(
13485
- "div",
13486
- {
13487
- className: cn(
13488
- "flex flex-1 flex-col transition-all duration-200 ease-in-out",
13489
- isFading ? "opacity-0 -translate-y-2 pointer-events-none" : isPaging ? pageDirection === "left" ? "-translate-x-4 opacity-0 pointer-events-none" : "translate-x-4 opacity-0 pointer-events-none" : "opacity-100 translate-y-0"
13341
+ /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("span", { className: "max-[479px]:sr-only", children: "Hoje" })
13342
+ ]
13343
+ }
13490
13344
  ),
13491
- "aria-live": "polite",
13492
- children: [
13493
- view === "month" && /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
13494
- MonthView,
13495
- {
13496
- currentDate,
13497
- events,
13498
- onEventCreate: handleEventCreate,
13499
- onEventSelect: handleEventSelect
13500
- }
13501
- ),
13502
- view === "week" && /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
13503
- WeekView,
13345
+ /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)("div", { className: "flex items-center sm:gap-2", children: [
13346
+ /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
13347
+ ButtonBase,
13504
13348
  {
13505
- currentDate,
13506
- events,
13507
- onEventCreate: handleEventCreate,
13508
- onEventSelect: handleEventSelect
13349
+ "aria-label": "Anterior",
13350
+ onClick: handlePrevious,
13351
+ size: "icon",
13352
+ variant: "ghost",
13353
+ children: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(import_react59.CaretLeft, { "aria-hidden": "true", size: 16 })
13509
13354
  }
13510
13355
  ),
13511
- view === "day" && /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
13512
- DayView,
13356
+ /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
13357
+ ButtonBase,
13513
13358
  {
13514
- currentDate,
13515
- events,
13516
- onEventCreate: handleEventCreate,
13517
- onEventSelect: handleEventSelect
13359
+ "aria-label": "Pr\xF3ximo",
13360
+ onClick: handleNext,
13361
+ size: "icon",
13362
+ variant: "ghost",
13363
+ children: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(import_react59.CaretRight, { "aria-hidden": "true", size: 16 })
13518
13364
  }
13519
- ),
13520
- view === "agenda" && /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
13521
- AgendaView,
13365
+ )
13366
+ ] }),
13367
+ /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("h2", { className: "font-semibold text-sm sm:text-lg md:text-xl", children: viewTitle })
13368
+ ] }),
13369
+ /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("div", { className: "flex items-center gap-2", children: !isAgendaOnly && /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)(import_jsx_runtime78.Fragment, { children: [
13370
+ /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)(DropDownMenuBase, { children: [
13371
+ /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(DropDownMenuTriggerBase, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)(
13372
+ ButtonBase,
13522
13373
  {
13523
- currentDate,
13524
- events,
13525
- onEventSelect: handleEventSelect
13374
+ className: "gap-1.5 max-[479px]:h-8",
13375
+ variant: "outline",
13376
+ children: [
13377
+ /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)("span", { children: [
13378
+ /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("span", { "aria-hidden": "true", className: "min-[480px]:hidden", children: (() => {
13379
+ const labels = {
13380
+ month: "M\xEAs",
13381
+ week: "Semana",
13382
+ day: "Dia",
13383
+ agenda: "Agenda"
13384
+ };
13385
+ return (labels[view] || view).charAt(0).toUpperCase();
13386
+ })() }),
13387
+ /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("span", { className: "max-[479px]:sr-only", children: (() => {
13388
+ const labels = {
13389
+ month: "M\xEAs",
13390
+ week: "Semana",
13391
+ day: "Dia",
13392
+ agenda: "Agenda"
13393
+ };
13394
+ return labels[view] || view;
13395
+ })() })
13396
+ ] }),
13397
+ /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
13398
+ import_react59.ArrowDownIcon,
13399
+ {
13400
+ "aria-hidden": "true",
13401
+ className: "-me-1 opacity-60",
13402
+ size: 16
13403
+ }
13404
+ )
13405
+ ]
13526
13406
  }
13527
- )
13528
- ]
13529
- }
13407
+ ) }),
13408
+ /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)(DropDownMenuContentBase, { align: "end", className: "min-w-32", children: [
13409
+ /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)(DropDownMenuItemBase, { onClick: () => changeView("month"), children: [
13410
+ "M\xEAs ",
13411
+ /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(DropDownMenuShortcutBase, { children: "M" })
13412
+ ] }),
13413
+ /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)(DropDownMenuItemBase, { onClick: () => changeView("week"), children: [
13414
+ "Semana",
13415
+ " ",
13416
+ /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(DropDownMenuShortcutBase, { children: "S" })
13417
+ ] }),
13418
+ /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)(DropDownMenuItemBase, { onClick: () => changeView("day"), children: [
13419
+ "Dia ",
13420
+ /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(DropDownMenuShortcutBase, { children: "D" })
13421
+ ] }),
13422
+ /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)(DropDownMenuItemBase, { onClick: () => changeView("agenda"), children: [
13423
+ "Agenda",
13424
+ " ",
13425
+ /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(DropDownMenuShortcutBase, { children: "A" })
13426
+ ] })
13427
+ ] })
13428
+ ] }),
13429
+ /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)(
13430
+ ButtonBase,
13431
+ {
13432
+ className: "max-[479px]:aspect-square max-[479px]:p-0!",
13433
+ onClick: () => {
13434
+ setSelectedEvent(null);
13435
+ setIsEventDialogOpen(true);
13436
+ },
13437
+ size: "sm",
13438
+ children: [
13439
+ /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
13440
+ import_react59.PlusIcon,
13441
+ {
13442
+ "aria-hidden": "true",
13443
+ className: "sm:-ms-1 opacity-60",
13444
+ size: 16
13445
+ }
13446
+ ),
13447
+ /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("span", { className: "max-sm:sr-only", children: "Novo evento" })
13448
+ ]
13449
+ }
13450
+ )
13451
+ ] }) })
13452
+ ]
13453
+ }
13454
+ ),
13455
+ /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)(
13456
+ "div",
13457
+ {
13458
+ className: cn(
13459
+ "flex flex-1 flex-col transition-all duration-200 ease-in-out",
13460
+ isFading ? "opacity-0 -translate-y-2 pointer-events-none" : isPaging ? pageDirection === "left" ? "-translate-x-4 opacity-0 pointer-events-none" : "translate-x-4 opacity-0 pointer-events-none" : "opacity-100 translate-y-0"
13530
13461
  ),
13531
- /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
13532
- EventDialog,
13533
- {
13534
- event: selectedEvent,
13535
- isOpen: isEventDialogOpen,
13536
- onClose: () => {
13537
- setIsEventDialogOpen(false);
13538
- setSelectedEvent(null);
13539
- },
13540
- onDelete: handleEventDelete,
13541
- onSave: handleEventSave
13542
- }
13543
- )
13544
- ] })
13462
+ "aria-live": "polite",
13463
+ children: [
13464
+ view === "month" && /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
13465
+ MonthView,
13466
+ {
13467
+ currentDate,
13468
+ events,
13469
+ onEventCreate: handleEventCreate,
13470
+ onEventSelect: handleEventSelect
13471
+ }
13472
+ ),
13473
+ view === "week" && /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
13474
+ WeekView,
13475
+ {
13476
+ currentDate,
13477
+ events,
13478
+ onEventCreate: handleEventCreate,
13479
+ onEventSelect: handleEventSelect
13480
+ }
13481
+ ),
13482
+ view === "day" && /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
13483
+ DayView,
13484
+ {
13485
+ currentDate,
13486
+ events,
13487
+ onEventCreate: handleEventCreate,
13488
+ onEventSelect: handleEventSelect
13489
+ }
13490
+ ),
13491
+ view === "agenda" && /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
13492
+ AgendaView,
13493
+ {
13494
+ currentDate,
13495
+ events,
13496
+ onEventSelect: isAgendaOnly ? void 0 : handleEventSelect,
13497
+ showUndatedEvents: isAgendaOnly
13498
+ }
13499
+ )
13500
+ ]
13501
+ }
13502
+ ),
13503
+ /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
13504
+ EventDialog,
13505
+ {
13506
+ event: selectedEvent,
13507
+ isOpen: isEventDialogOpen,
13508
+ onClose: () => {
13509
+ setIsEventDialogOpen(false);
13510
+ setSelectedEvent(null);
13511
+ },
13512
+ onDelete: handleEventDelete,
13513
+ onSave: handleEventSave
13514
+ }
13515
+ )
13516
+ ] });
13517
+ return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
13518
+ "div",
13519
+ {
13520
+ className: "flex flex-col rounded-lg border has-data-[slot=month-view]:flex-1 p-6",
13521
+ style: {
13522
+ "--event-gap": `${EventGap}px`,
13523
+ "--event-height": `${EventHeight}px`,
13524
+ "--week-cells-height": `${WeekCellsHeight}px`
13525
+ },
13526
+ children: isAgendaOnly ? calendarContent : /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(CalendarDndProvider, { onEventUpdate: handleEventUpdate, children: calendarContent })
13545
13527
  }
13546
13528
  );
13547
13529
  }
13548
13530
 
13549
13531
  // src/components/event-calendar/EventDialog.tsx
13550
13532
  var import_date_fns8 = require("date-fns");
13551
- var import_react62 = require("react");
13533
+ var import_react60 = require("react");
13552
13534
  var import_react_radio_group = require("@radix-ui/react-radio-group");
13553
13535
  var import_framer_motion17 = require("framer-motion");
13554
13536
  var import_locale4 = require("date-fns/locale");
13555
- var import_react63 = require("@phosphor-icons/react");
13537
+ var import_react61 = require("@phosphor-icons/react");
13556
13538
  var import_jsx_runtime79 = require("react/jsx-runtime");
13557
13539
  function EventDialog({
13558
13540
  event,
@@ -13561,21 +13543,21 @@ function EventDialog({
13561
13543
  onSave,
13562
13544
  onDelete
13563
13545
  }) {
13564
- const [title, setTitle] = (0, import_react62.useState)("");
13565
- const [description, setDescription] = (0, import_react62.useState)("");
13566
- const [startDate, setStartDate] = (0, import_react62.useState)(/* @__PURE__ */ new Date());
13567
- const [endDate, setEndDate] = (0, import_react62.useState)(/* @__PURE__ */ new Date());
13568
- const [startTime, setStartTime] = (0, import_react62.useState)(`${DefaultStartHour}:00`);
13569
- const [endTime, setEndTime] = (0, import_react62.useState)(`${DefaultEndHour}:00`);
13570
- const [allDay, setAllDay] = (0, import_react62.useState)(false);
13571
- const [location, setLocation] = (0, import_react62.useState)("");
13572
- const [color, setColor] = (0, import_react62.useState)("sky");
13573
- const [error, setError] = (0, import_react62.useState)(null);
13574
- const [startDateOpen, setStartDateOpen] = (0, import_react62.useState)(false);
13575
- const [endDateOpen, setEndDateOpen] = (0, import_react62.useState)(false);
13576
- (0, import_react62.useEffect)(() => {
13546
+ const [title, setTitle] = (0, import_react60.useState)("");
13547
+ const [description, setDescription] = (0, import_react60.useState)("");
13548
+ const [startDate, setStartDate] = (0, import_react60.useState)(/* @__PURE__ */ new Date());
13549
+ const [endDate, setEndDate] = (0, import_react60.useState)(/* @__PURE__ */ new Date());
13550
+ const [startTime, setStartTime] = (0, import_react60.useState)(`${DefaultStartHour}:00`);
13551
+ const [endTime, setEndTime] = (0, import_react60.useState)(`${DefaultEndHour}:00`);
13552
+ const [allDay, setAllDay] = (0, import_react60.useState)(false);
13553
+ const [location, setLocation] = (0, import_react60.useState)("");
13554
+ const [color, setColor] = (0, import_react60.useState)("sky");
13555
+ const [error, setError] = (0, import_react60.useState)(null);
13556
+ const [startDateOpen, setStartDateOpen] = (0, import_react60.useState)(false);
13557
+ const [endDateOpen, setEndDateOpen] = (0, import_react60.useState)(false);
13558
+ (0, import_react60.useEffect)(() => {
13577
13559
  }, [event]);
13578
- const resetForm = (0, import_react62.useCallback)(() => {
13560
+ const resetForm = (0, import_react60.useCallback)(() => {
13579
13561
  setTitle("");
13580
13562
  setDescription("");
13581
13563
  setStartDate(/* @__PURE__ */ new Date());
@@ -13587,12 +13569,12 @@ function EventDialog({
13587
13569
  setColor("sky");
13588
13570
  setError(null);
13589
13571
  }, []);
13590
- const formatTimeForInput = (0, import_react62.useCallback)((date) => {
13572
+ const formatTimeForInput = (0, import_react60.useCallback)((date) => {
13591
13573
  const hours = date.getHours().toString().padStart(2, "0");
13592
13574
  const minutes = Math.floor(date.getMinutes() / 15) * 15;
13593
13575
  return `${hours}:${minutes.toString().padStart(2, "0")}`;
13594
13576
  }, []);
13595
- (0, import_react62.useEffect)(() => {
13577
+ (0, import_react60.useEffect)(() => {
13596
13578
  if (event) {
13597
13579
  setTitle(event.title || "");
13598
13580
  setDescription(event.description || "");
@@ -13610,7 +13592,7 @@ function EventDialog({
13610
13592
  resetForm();
13611
13593
  }
13612
13594
  }, [event, formatTimeForInput, resetForm]);
13613
- const timeOptions = (0, import_react62.useMemo)(() => {
13595
+ const timeOptions = (0, import_react60.useMemo)(() => {
13614
13596
  const options = [];
13615
13597
  for (let hour = StartHour; hour <= EndHour; hour++) {
13616
13598
  for (let minute = 0; minute < 60; minute += 15) {
@@ -13799,7 +13781,7 @@ function EventDialog({
13799
13781
  }
13800
13782
  ),
13801
13783
  /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
13802
- import_react63.CalendarIcon,
13784
+ import_react61.CalendarIcon,
13803
13785
  {
13804
13786
  "aria-hidden": "true",
13805
13787
  className: "shrink-0 text-muted-foreground/80",
@@ -13878,7 +13860,7 @@ function EventDialog({
13878
13860
  }
13879
13861
  ),
13880
13862
  /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
13881
- import_react63.CalendarIcon,
13863
+ import_react61.CalendarIcon,
13882
13864
  {
13883
13865
  "aria-hidden": "true",
13884
13866
  className: "shrink-0 text-muted-foreground/80",
@@ -13936,7 +13918,7 @@ function EventDialog({
13936
13918
  allDay ? "bg-primary border-transparent text-white" : " border border-input"
13937
13919
  ),
13938
13920
  children: [
13939
- /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(import_react63.CalendarIcon, { size: 14, "aria-hidden": "true" }),
13921
+ /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(import_react61.CalendarIcon, { size: 14, "aria-hidden": "true" }),
13940
13922
  "Dia inteiro"
13941
13923
  ]
13942
13924
  }
@@ -13995,7 +13977,7 @@ function EventDialog({
13995
13977
  onClick: handleDelete,
13996
13978
  size: "icon",
13997
13979
  variant: "outline",
13998
- children: /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(import_react63.TrashIcon, { "aria-hidden": "true", size: 16 })
13980
+ children: /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(import_react61.TrashIcon, { "aria-hidden": "true", size: 16 })
13999
13981
  }
14000
13982
  ),
14001
13983
  /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)("div", { className: "flex flex-1 justify-end gap-2", children: [
@@ -14010,11 +13992,19 @@ function EventDialog({
14010
13992
 
14011
13993
  // src/components/event-calendar/EventItem.tsx
14012
13994
  var import_date_fns9 = require("date-fns");
14013
- var import_react64 = require("react");
13995
+ var import_react62 = require("react");
14014
13996
  var import_jsx_runtime80 = require("react/jsx-runtime");
14015
13997
  var formatTimeWithOptionalMinutes = (date) => {
14016
13998
  return (0, import_date_fns9.format)(date, "HH:mm");
14017
13999
  };
14000
+ var isValidDate = (d) => {
14001
+ try {
14002
+ const dt = d instanceof Date ? d : new Date(String(d));
14003
+ return !isNaN(dt.getTime());
14004
+ } catch {
14005
+ return false;
14006
+ }
14007
+ };
14018
14008
  function EventWrapper({
14019
14009
  event,
14020
14010
  isFirstDay = true,
@@ -14030,16 +14020,18 @@ function EventWrapper({
14030
14020
  onTouchStart,
14031
14021
  ariaLabel
14032
14022
  }) {
14033
- const displayEnd = currentTime ? new Date(
14023
+ const hasValidTimeForWrapper = isValidDate(event.start) && isValidDate(event.end);
14024
+ const displayEnd = hasValidTimeForWrapper ? currentTime ? new Date(
14034
14025
  new Date(currentTime).getTime() + (new Date(event.end).getTime() - new Date(event.start).getTime())
14035
- ) : new Date(event.end);
14036
- const isEventInPast = (0, import_date_fns9.isPast)(displayEnd);
14026
+ ) : new Date(event.end) : void 0;
14027
+ const isEventInPast = displayEnd ? (0, import_date_fns9.isPast)(displayEnd) : false;
14028
+ const colorClasses = hasValidTimeForWrapper ? getEventColorClasses(event.color) : "bg-gray-200/50 hover:bg-gray-200/40 text-gray-900/80 dark:bg-gray-700/25 dark:text-gray-200/90 shadow-none";
14037
14029
  return /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
14038
14030
  "button",
14039
14031
  {
14040
14032
  className: cn(
14041
14033
  "flex w-full select-none overflow-hidden px-3 py-1 text-left font-medium outline-none transition-transform duration-150 ease-out backdrop-blur-sm focus-visible:ring-2 focus-visible:ring-ring/50 focus-visible:border-ring data-dragging:cursor-grabbing data-past-event:line-through data-dragging:shadow-lg sm:px-3 rounded-lg shadow-sm hover:shadow-md hover:scale-105",
14042
- getEventColorClasses(event.color),
14034
+ colorClasses,
14043
14035
  getBorderRadiusClasses(isFirstDay, isLastDay),
14044
14036
  className
14045
14037
  ),
@@ -14070,21 +14062,39 @@ function EventItem({
14070
14062
  dndListeners,
14071
14063
  dndAttributes,
14072
14064
  onMouseDown,
14073
- onTouchStart
14065
+ onTouchStart,
14066
+ agendaOnly = false
14074
14067
  }) {
14075
14068
  const eventColor = event.color;
14076
- const displayStart = (0, import_react64.useMemo)(() => {
14077
- return currentTime || new Date(event.start);
14078
- }, [currentTime, event.start]);
14079
- const displayEnd = (0, import_react64.useMemo)(() => {
14080
- return currentTime ? new Date(
14081
- new Date(currentTime).getTime() + (new Date(event.end).getTime() - new Date(event.start).getTime())
14082
- ) : new Date(event.end);
14083
- }, [currentTime, event.start, event.end]);
14084
- const durationMinutes = (0, import_react64.useMemo)(() => {
14069
+ const hasValidTime = isValidDate(event.start) && isValidDate(event.end) || isValidDate(event.attend_date);
14070
+ const colorClasses = hasValidTime ? getEventColorClasses(eventColor) : "bg-gray-200/50 hover:bg-gray-200/40 text-gray-900/80 dark:bg-gray-700/25 dark:text-gray-200/90 shadow-none";
14071
+ const displayStart = (0, import_react62.useMemo)(() => {
14072
+ if (!hasValidTime) return void 0;
14073
+ if (isValidDate(event.start))
14074
+ return currentTime || new Date(event.start);
14075
+ if (isValidDate(event.attend_date))
14076
+ return currentTime || new Date(event.attend_date);
14077
+ return void 0;
14078
+ }, [currentTime, event.start, event.attend_date, hasValidTime]);
14079
+ const displayEnd = (0, import_react62.useMemo)(() => {
14080
+ if (!hasValidTime) return void 0;
14081
+ if (isValidDate(event.end)) {
14082
+ return currentTime ? new Date(
14083
+ new Date(currentTime).getTime() + (new Date(event.end).getTime() - new Date(event.start).getTime())
14084
+ ) : new Date(event.end);
14085
+ }
14086
+ if (isValidDate(event.attend_date)) {
14087
+ const start = new Date(event.attend_date);
14088
+ return addHoursToDate(start, 1);
14089
+ }
14090
+ return void 0;
14091
+ }, [currentTime, event.start, event.end, event.attend_date, hasValidTime]);
14092
+ const durationMinutes = (0, import_react62.useMemo)(() => {
14093
+ if (!hasValidTime || !displayStart || !displayEnd) return 0;
14085
14094
  return (0, import_date_fns9.differenceInMinutes)(displayEnd, displayStart);
14086
- }, [displayStart, displayEnd]);
14095
+ }, [displayStart, displayEnd, hasValidTime]);
14087
14096
  const getEventTime = () => {
14097
+ if (!hasValidTime) return "";
14088
14098
  if (event.allDay) return "All day";
14089
14099
  if (durationMinutes < 45) {
14090
14100
  return formatTimeWithOptionalMinutes(displayStart);
@@ -14093,9 +14103,20 @@ function EventItem({
14093
14103
  displayStart
14094
14104
  )} - ${formatTimeWithOptionalMinutes(displayEnd)}`;
14095
14105
  };
14096
- const ariaLabel = event.allDay ? `${event.title}, All day` : durationMinutes < 45 ? `${event.title}, ${formatTimeWithOptionalMinutes(displayStart)}` : `${event.title}, ${formatTimeWithOptionalMinutes(
14097
- displayStart
14098
- )} - ${formatTimeWithOptionalMinutes(displayEnd)}`;
14106
+ let ariaLabel;
14107
+ if (!hasValidTime) {
14108
+ ariaLabel = event.title;
14109
+ } else if (event.allDay) {
14110
+ ariaLabel = `${event.title}, All day`;
14111
+ } else if (durationMinutes < 45) {
14112
+ ariaLabel = `${event.title}, ${formatTimeWithOptionalMinutes(
14113
+ displayStart
14114
+ )}`;
14115
+ } else {
14116
+ ariaLabel = `${event.title}, ${formatTimeWithOptionalMinutes(
14117
+ displayStart
14118
+ )} - ${formatTimeWithOptionalMinutes(displayEnd)}`;
14119
+ }
14099
14120
  if (view === "month") {
14100
14121
  return /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
14101
14122
  EventWrapper,
@@ -14116,8 +14137,17 @@ function EventItem({
14116
14137
  onMouseDown,
14117
14138
  onTouchStart,
14118
14139
  children: children || /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("span", { className: "flex items-center gap-2 truncate", children: [
14119
- !event.allDay && /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("span", { className: "truncate font-normal opacity-80 sm:text-[11px] bg-white/10 px-2 py-0.5 rounded-full text-[11px]", children: formatTimeWithOptionalMinutes(displayStart) }),
14120
- /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("span", { className: "truncate font-medium", children: event.title })
14140
+ !event.allDay && hasValidTime && displayStart && /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("span", { className: "truncate font-normal opacity-80 sm:text-[11px] bg-white/10 px-2 py-0.5 rounded-full text-[11px]", children: formatTimeWithOptionalMinutes(displayStart) }),
14141
+ /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
14142
+ "span",
14143
+ {
14144
+ className: cn(
14145
+ "truncate",
14146
+ agendaOnly ? "font-bold text-lg" : "font-medium"
14147
+ ),
14148
+ children: event.title
14149
+ }
14150
+ )
14121
14151
  ] })
14122
14152
  }
14123
14153
  );
@@ -14144,21 +14174,81 @@ function EventItem({
14144
14174
  onMouseDown,
14145
14175
  onTouchStart,
14146
14176
  children: durationMinutes < 45 ? /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("div", { className: "flex items-center justify-between w-full", children: [
14147
- /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("div", { className: "truncate", children: event.title }),
14148
- showTime && /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("span", { className: "ml-2 inline-block bg-white/10 px-2 py-0.5 rounded-full text-[11px] opacity-90", children: formatTimeWithOptionalMinutes(displayStart) })
14177
+ /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("div", { className: cn("truncate", agendaOnly ? "text-lg" : ""), children: event.title }),
14178
+ showTime && hasValidTime && displayStart && /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("span", { className: "ml-2 inline-block bg-white/10 px-2 py-0.5 rounded-full text-[11px] opacity-90", children: formatTimeWithOptionalMinutes(displayStart) })
14149
14179
  ] }) : /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)(import_jsx_runtime80.Fragment, { children: [
14150
- /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("div", { className: "truncate font-medium", children: event.title }),
14151
- showTime && /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("div", { className: "truncate font-normal opacity-70 sm:text-[11px]", children: /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("span", { className: "inline-block bg-white/5 px-2 py-0.5 rounded-full", children: getEventTime() }) })
14180
+ /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
14181
+ "div",
14182
+ {
14183
+ className: cn(
14184
+ "truncate font-medium",
14185
+ agendaOnly ? "text-lg" : ""
14186
+ ),
14187
+ children: event.title
14188
+ }
14189
+ ),
14190
+ showTime && hasValidTime && /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("div", { className: "truncate font-normal opacity-70 sm:text-[11px]", children: /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("span", { className: "inline-block bg-white/5 px-2 py-0.5 rounded-full", children: getEventTime() }) })
14152
14191
  ] })
14153
14192
  }
14154
14193
  );
14155
14194
  }
14195
+ if (!hasValidTime) {
14196
+ return /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)(
14197
+ "button",
14198
+ {
14199
+ className: cn(
14200
+ "flex w-full flex-col gap-2 rounded-lg p-3 text-left outline-none transition-shadow duration-150 ease-out hover:bg-white/3 focus-visible:ring-2 focus-visible:ring-ring/50 focus-visible:border-ring",
14201
+ getEventColorClasses(eventColor),
14202
+ className
14203
+ ),
14204
+ "aria-label": ariaLabel,
14205
+ onClick,
14206
+ onMouseDown,
14207
+ onTouchStart,
14208
+ type: "button",
14209
+ ...dndListeners,
14210
+ ...dndAttributes,
14211
+ children: [
14212
+ /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("div", { className: cn("font-medium", agendaOnly ? "text-lg" : "text-sm"), children: event.title }),
14213
+ /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
14214
+ "div",
14215
+ {
14216
+ className: cn(
14217
+ "opacity-70 flex items-center gap-2",
14218
+ agendaOnly ? "text-sm" : "text-xs"
14219
+ ),
14220
+ children: event.location && /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("span", { className: "opacity-80 flex items-center gap-1", children: [
14221
+ "-",
14222
+ /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("span", { className: "truncate", children: event.location })
14223
+ ] })
14224
+ }
14225
+ ),
14226
+ event.description && /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
14227
+ "div",
14228
+ {
14229
+ className: cn(
14230
+ "my-1 opacity-90",
14231
+ agendaOnly ? "text-sm" : "text-xs"
14232
+ ),
14233
+ style: {
14234
+ display: "-webkit-box",
14235
+ WebkitLineClamp: 2,
14236
+ WebkitBoxOrient: "vertical",
14237
+ overflow: "hidden"
14238
+ },
14239
+ children: event.description
14240
+ }
14241
+ )
14242
+ ]
14243
+ }
14244
+ );
14245
+ }
14156
14246
  return /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)(
14157
14247
  "button",
14158
14248
  {
14159
14249
  className: cn(
14160
14250
  "flex w-full flex-col gap-2 rounded-lg p-3 text-left outline-none transition-shadow duration-150 ease-out hover:bg-white/3 focus-visible:ring-2 focus-visible:ring-ring/50 focus-visible:border-ring data-past-event:line-through data-past-event:opacity-90",
14161
- getEventColorClasses(eventColor),
14251
+ colorClasses,
14162
14252
  className
14163
14253
  ),
14164
14254
  "data-past-event": (0, import_date_fns9.isPast)(displayEnd) || void 0,
@@ -14170,23 +14260,32 @@ function EventItem({
14170
14260
  ...dndListeners,
14171
14261
  ...dndAttributes,
14172
14262
  children: [
14173
- /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("div", { className: "font-medium text-sm", children: event.title }),
14174
- /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("div", { className: "text-xs opacity-70 flex items-center gap-2", children: [
14175
- event.allDay ? /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("span", { className: "uppercase", children: "All day" }) : /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("span", { className: "uppercase", children: [
14176
- formatTimeWithOptionalMinutes(displayStart),
14177
- " -",
14178
- " ",
14179
- formatTimeWithOptionalMinutes(displayEnd)
14180
- ] }),
14181
- event.location && /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("span", { className: "opacity-80 flex items-center gap-1", children: [
14182
- "-",
14183
- /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("span", { className: "truncate", children: event.location })
14184
- ] })
14185
- ] }),
14263
+ /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("div", { className: cn("font-medium", agendaOnly ? "text-lg" : "text-sm"), children: event.title }),
14264
+ /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)(
14265
+ "div",
14266
+ {
14267
+ className: cn(
14268
+ "opacity-70 flex items-center gap-2",
14269
+ agendaOnly ? "text-sm" : "text-xs"
14270
+ ),
14271
+ children: [
14272
+ event.allDay ? /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("span", { className: "uppercase", children: "All day" }) : /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("span", { className: "uppercase", children: [
14273
+ formatTimeWithOptionalMinutes(displayStart),
14274
+ " -",
14275
+ " ",
14276
+ formatTimeWithOptionalMinutes(displayEnd)
14277
+ ] }),
14278
+ event.location && /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("span", { className: "opacity-80 flex items-center gap-1", children: [
14279
+ "-",
14280
+ /* @__PURE__ */ (0, import_jsx_runtime80.jsx)("span", { className: "truncate", children: event.location })
14281
+ ] })
14282
+ ]
14283
+ }
14284
+ ),
14186
14285
  event.description && /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
14187
14286
  "div",
14188
14287
  {
14189
- className: "my-1 text-xs opacity-90",
14288
+ className: cn("my-1 opacity-90", agendaOnly ? "text-sm" : "text-xs"),
14190
14289
  style: {
14191
14290
  display: "-webkit-box",
14192
14291
  WebkitLineClamp: 2,
@@ -14204,9 +14303,9 @@ function EventItem({
14204
14303
  // src/components/event-calendar/EventsPopUp.tsx
14205
14304
  var import_date_fns10 = require("date-fns");
14206
14305
  var import_locale5 = require("date-fns/locale");
14207
- var import_react65 = require("react");
14306
+ var import_react63 = require("react");
14208
14307
  var import_framer_motion18 = require("framer-motion");
14209
- var import_react66 = require("@phosphor-icons/react");
14308
+ var import_react64 = require("@phosphor-icons/react");
14210
14309
  var import_jsx_runtime81 = require("react/jsx-runtime");
14211
14310
  function EventsPopup({
14212
14311
  date,
@@ -14215,8 +14314,8 @@ function EventsPopup({
14215
14314
  onClose,
14216
14315
  onEventSelect
14217
14316
  }) {
14218
- const popupRef = (0, import_react65.useRef)(null);
14219
- (0, import_react65.useEffect)(() => {
14317
+ const popupRef = (0, import_react63.useRef)(null);
14318
+ (0, import_react63.useEffect)(() => {
14220
14319
  const handleClickOutside = (event) => {
14221
14320
  if (popupRef.current && !popupRef.current.contains(event.target)) {
14222
14321
  onClose();
@@ -14227,7 +14326,7 @@ function EventsPopup({
14227
14326
  document.removeEventListener("mousedown", handleClickOutside);
14228
14327
  };
14229
14328
  }, [onClose]);
14230
- (0, import_react65.useEffect)(() => {
14329
+ (0, import_react63.useEffect)(() => {
14231
14330
  const handleEscKey = (event) => {
14232
14331
  if (event.key === "Escape") {
14233
14332
  onClose();
@@ -14239,10 +14338,10 @@ function EventsPopup({
14239
14338
  };
14240
14339
  }, [onClose]);
14241
14340
  const handleEventClick = (event) => {
14242
- onEventSelect(event);
14341
+ if (onEventSelect) onEventSelect(event);
14243
14342
  onClose();
14244
14343
  };
14245
- const adjustedPosition = (0, import_react65.useMemo)(() => {
14344
+ const adjustedPosition = (0, import_react63.useMemo)(() => {
14246
14345
  const positionCopy = { ...position };
14247
14346
  if (popupRef.current) {
14248
14347
  const rect = popupRef.current.getBoundingClientRect();
@@ -14286,7 +14385,7 @@ function EventsPopup({
14286
14385
  className: "rounded-full p-1 hover:bg-muted",
14287
14386
  onClick: onClose,
14288
14387
  type: "button",
14289
- children: /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(import_react66.XIcon, { className: "h-4 w-4" })
14388
+ children: /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(import_react64.XIcon, { className: "h-4 w-4" })
14290
14389
  }
14291
14390
  )
14292
14391
  ] }),
@@ -14295,18 +14394,20 @@ function EventsPopup({
14295
14394
  const eventEnd = new Date(event.end);
14296
14395
  const isFirstDay = (0, import_date_fns10.isSameDay)(date, eventStart);
14297
14396
  const isLastDay = (0, import_date_fns10.isSameDay)(date, eventEnd);
14397
+ const clickable = Boolean(onEventSelect);
14298
14398
  return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
14299
14399
  "div",
14300
14400
  {
14301
- className: "cursor-pointer",
14302
- onClick: () => handleEventClick(event),
14401
+ className: clickable ? "cursor-pointer" : "cursor-default",
14402
+ onClick: clickable ? () => handleEventClick(event) : void 0,
14303
14403
  children: /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
14304
14404
  EventItem,
14305
14405
  {
14306
14406
  event,
14307
14407
  isFirstDay,
14308
14408
  isLastDay,
14309
- view: "agenda"
14409
+ view: "agenda",
14410
+ className: clickable ? void 0 : "cursor-default hover:shadow-none hover:scale-100"
14310
14411
  }
14311
14412
  )
14312
14413
  },
@@ -14321,11 +14422,11 @@ function EventsPopup({
14321
14422
  // src/components/event-calendar/hooks/use-current-time-indicator.ts
14322
14423
  var import_date_fns11 = require("date-fns");
14323
14424
  var import_locale6 = require("date-fns/locale");
14324
- var import_react67 = require("react");
14425
+ var import_react65 = require("react");
14325
14426
  function useCurrentTimeIndicator(currentDate, view) {
14326
- const [currentTimePosition, setCurrentTimePosition] = (0, import_react67.useState)(0);
14327
- const [currentTimeVisible, setCurrentTimeVisible] = (0, import_react67.useState)(false);
14328
- (0, import_react67.useEffect)(() => {
14427
+ const [currentTimePosition, setCurrentTimePosition] = (0, import_react65.useState)(0);
14428
+ const [currentTimeVisible, setCurrentTimeVisible] = (0, import_react65.useState)(false);
14429
+ (0, import_react65.useEffect)(() => {
14329
14430
  const calculateTimePosition = () => {
14330
14431
  const now = /* @__PURE__ */ new Date();
14331
14432
  const hours = now.getHours();
@@ -14356,15 +14457,15 @@ function useCurrentTimeIndicator(currentDate, view) {
14356
14457
  }
14357
14458
 
14358
14459
  // src/components/event-calendar/hooks/use-event-visibility.ts
14359
- var import_react68 = require("react");
14460
+ var import_react66 = require("react");
14360
14461
  function useEventVisibility({
14361
14462
  eventHeight,
14362
14463
  eventGap
14363
14464
  }) {
14364
- const contentRef = (0, import_react68.useRef)(null);
14365
- const observerRef = (0, import_react68.useRef)(null);
14366
- const [contentHeight, setContentHeight] = (0, import_react68.useState)(null);
14367
- (0, import_react68.useLayoutEffect)(() => {
14465
+ const contentRef = (0, import_react66.useRef)(null);
14466
+ const observerRef = (0, import_react66.useRef)(null);
14467
+ const [contentHeight, setContentHeight] = (0, import_react66.useState)(null);
14468
+ (0, import_react66.useLayoutEffect)(() => {
14368
14469
  if (!contentRef.current) return;
14369
14470
  const updateHeight = () => {
14370
14471
  if (contentRef.current) {
@@ -14384,7 +14485,7 @@ function useEventVisibility({
14384
14485
  }
14385
14486
  };
14386
14487
  }, []);
14387
- const getVisibleEventCount = (0, import_react68.useMemo)(() => {
14488
+ const getVisibleEventCount = (0, import_react66.useMemo)(() => {
14388
14489
  return (totalEvents) => {
14389
14490
  if (!contentHeight) return totalEvents;
14390
14491
  const maxEvents = Math.floor(contentHeight / (eventHeight + eventGap));
@@ -14404,7 +14505,7 @@ function useEventVisibility({
14404
14505
  // src/components/event-calendar/MonthView.tsx
14405
14506
  var import_date_fns12 = require("date-fns");
14406
14507
  var import_locale7 = require("date-fns/locale");
14407
- var import_react69 = require("react");
14508
+ var import_react67 = require("react");
14408
14509
  var import_jsx_runtime82 = require("react/jsx-runtime");
14409
14510
  function MonthView({
14410
14511
  currentDate,
@@ -14412,21 +14513,21 @@ function MonthView({
14412
14513
  onEventSelect,
14413
14514
  onEventCreate
14414
14515
  }) {
14415
- const days = (0, import_react69.useMemo)(() => {
14516
+ const days = (0, import_react67.useMemo)(() => {
14416
14517
  const monthStart = (0, import_date_fns12.startOfMonth)(currentDate);
14417
14518
  const monthEnd = (0, import_date_fns12.endOfMonth)(monthStart);
14418
14519
  const calendarStart = (0, import_date_fns12.startOfWeek)(monthStart, { weekStartsOn: 0 });
14419
14520
  const calendarEnd = (0, import_date_fns12.endOfWeek)(monthEnd, { weekStartsOn: 0 });
14420
14521
  return (0, import_date_fns12.eachDayOfInterval)({ end: calendarEnd, start: calendarStart });
14421
14522
  }, [currentDate]);
14422
- const weekdays = (0, import_react69.useMemo)(() => {
14523
+ const weekdays = (0, import_react67.useMemo)(() => {
14423
14524
  return Array.from({ length: 7 }).map((_, i) => {
14424
14525
  const date = (0, import_date_fns12.addDays)((0, import_date_fns12.startOfWeek)(/* @__PURE__ */ new Date(), { weekStartsOn: 0 }), i);
14425
14526
  const short = (0, import_date_fns12.format)(date, "EEE", { locale: import_locale7.ptBR });
14426
14527
  return short.charAt(0).toUpperCase() + short.slice(1);
14427
14528
  });
14428
14529
  }, []);
14429
- const weeks = (0, import_react69.useMemo)(() => {
14530
+ const weeks = (0, import_react67.useMemo)(() => {
14430
14531
  const result = [];
14431
14532
  let week = [];
14432
14533
  for (let i = 0; i < days.length; i++) {
@@ -14442,12 +14543,12 @@ function MonthView({
14442
14543
  e.stopPropagation();
14443
14544
  onEventSelect(event);
14444
14545
  };
14445
- const [isMounted, setIsMounted] = (0, import_react69.useState)(false);
14546
+ const [isMounted, setIsMounted] = (0, import_react67.useState)(false);
14446
14547
  const { contentRef, getVisibleEventCount } = useEventVisibility({
14447
14548
  eventGap: EventGap,
14448
14549
  eventHeight: EventHeight
14449
14550
  });
14450
- (0, import_react69.useEffect)(() => {
14551
+ (0, import_react67.useEffect)(() => {
14451
14552
  setIsMounted(true);
14452
14553
  }, []);
14453
14554
  return /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("div", { className: "contents", "data-slot": "month-view", children: [
@@ -14622,6 +14723,7 @@ function MonthView({
14622
14723
 
14623
14724
  // src/components/event-calendar/utils.ts
14624
14725
  var import_date_fns13 = require("date-fns");
14726
+ var import_date_fns14 = require("date-fns");
14625
14727
  function getEventColorClasses(color) {
14626
14728
  const eventColor = color || "sky";
14627
14729
  switch (eventColor) {
@@ -14654,15 +14756,16 @@ function getBorderRadiusClasses(isFirstDay, isLastDay) {
14654
14756
  return "rounded-none";
14655
14757
  }
14656
14758
  function isMultiDayEvent(event) {
14657
- const eventStart = new Date(event.start);
14658
- const eventEnd = new Date(event.end);
14759
+ const eventStart = isValidDate2(event.start) ? new Date(event.start) : void 0;
14760
+ const eventEnd = isValidDate2(event.end) ? new Date(event.end) : void 0;
14761
+ if (!eventStart || !eventEnd) return !!event.allDay;
14659
14762
  return event.allDay || eventStart.getDate() !== eventEnd.getDate();
14660
14763
  }
14661
14764
  function getEventsForDay(events, day) {
14662
14765
  return events.filter((event) => {
14663
- const eventStart = new Date(event.start);
14664
- return (0, import_date_fns13.isSameDay)(day, eventStart);
14665
- }).sort((a, b) => new Date(a.start).getTime() - new Date(b.start).getTime());
14766
+ const eventStart = isValidDate2(event.start) ? new Date(event.start) : isValidDate2(event.attend_date) ? new Date(event.attend_date) : void 0;
14767
+ return eventStart ? (0, import_date_fns13.isSameDay)(day, eventStart) : false;
14768
+ }).sort((a, b) => getEventStartTimestamp(a) - getEventStartTimestamp(b));
14666
14769
  }
14667
14770
  function sortEvents(events) {
14668
14771
  return [...events].sort((a, b) => {
@@ -14670,30 +14773,47 @@ function sortEvents(events) {
14670
14773
  const bIsMultiDay = isMultiDayEvent(b);
14671
14774
  if (aIsMultiDay && !bIsMultiDay) return -1;
14672
14775
  if (!aIsMultiDay && bIsMultiDay) return 1;
14673
- return new Date(a.start).getTime() - new Date(b.start).getTime();
14776
+ return getEventStartTimestamp(a) - getEventStartTimestamp(b);
14674
14777
  });
14675
14778
  }
14676
14779
  function getSpanningEventsForDay(events, day) {
14677
14780
  return events.filter((event) => {
14678
14781
  if (!isMultiDayEvent(event)) return false;
14679
- const eventStart = new Date(event.start);
14680
- const eventEnd = new Date(event.end);
14782
+ const eventStart = isValidDate2(event.start) ? new Date(event.start) : void 0;
14783
+ const eventEnd = isValidDate2(event.end) ? new Date(event.end) : void 0;
14784
+ if (!eventStart || !eventEnd) return false;
14681
14785
  return !(0, import_date_fns13.isSameDay)(day, eventStart) && ((0, import_date_fns13.isSameDay)(day, eventEnd) || day > eventStart && day < eventEnd);
14682
14786
  });
14683
14787
  }
14684
14788
  function getAllEventsForDay(events, day) {
14685
14789
  return events.filter((event) => {
14686
- const eventStart = new Date(event.start);
14687
- const eventEnd = new Date(event.end);
14688
- return (0, import_date_fns13.isSameDay)(day, eventStart) || (0, import_date_fns13.isSameDay)(day, eventEnd) || day > eventStart && day < eventEnd;
14790
+ const eventStart = isValidDate2(event.start) ? new Date(event.start) : void 0;
14791
+ const eventEnd = isValidDate2(event.end) ? new Date(event.end) : void 0;
14792
+ if (!eventStart) return false;
14793
+ return (0, import_date_fns13.isSameDay)(day, eventStart) || (eventEnd ? (0, import_date_fns13.isSameDay)(day, eventEnd) : false) || (eventEnd ? day > eventStart && day < eventEnd : false);
14689
14794
  });
14690
14795
  }
14691
14796
  function getAgendaEventsForDay(events, day) {
14692
14797
  return events.filter((event) => {
14693
- const eventStart = new Date(event.start);
14694
- const eventEnd = new Date(event.end);
14695
- return (0, import_date_fns13.isSameDay)(day, eventStart) || (0, import_date_fns13.isSameDay)(day, eventEnd) || day > eventStart && day < eventEnd;
14696
- }).sort((a, b) => new Date(a.start).getTime() - new Date(b.start).getTime());
14798
+ const eventStart = isValidDate2(event.start) ? new Date(event.start) : isValidDate2(event.attend_date) ? new Date(event.attend_date) : void 0;
14799
+ const eventEnd = isValidDate2(event.end) ? new Date(event.end) : isValidDate2(event.attend_date) ? (0, import_date_fns14.addHours)(new Date(event.attend_date), 1) : void 0;
14800
+ if (!eventStart) return false;
14801
+ return (0, import_date_fns13.isSameDay)(day, eventStart) || (eventEnd ? (0, import_date_fns13.isSameDay)(day, eventEnd) : false) || (eventEnd ? day > eventStart && day < eventEnd : false);
14802
+ }).sort((a, b) => getEventStartTimestamp(a) - getEventStartTimestamp(b));
14803
+ }
14804
+ function isValidDate2(d) {
14805
+ try {
14806
+ const t = d instanceof Date ? d.getTime() : new Date(String(d)).getTime();
14807
+ return !isNaN(t);
14808
+ } catch {
14809
+ return false;
14810
+ }
14811
+ }
14812
+ function getEventStartTimestamp(e) {
14813
+ if (isValidDate2(e.start)) return new Date(e.start).getTime();
14814
+ if (isValidDate2(e.attend_date))
14815
+ return new Date(e.attend_date).getTime();
14816
+ return Number.MAX_SAFE_INTEGER;
14697
14817
  }
14698
14818
  function addHoursToDate(date, hours) {
14699
14819
  const result = new Date(date);
@@ -14702,9 +14822,9 @@ function addHoursToDate(date, hours) {
14702
14822
  }
14703
14823
 
14704
14824
  // src/components/event-calendar/WeekView.tsx
14705
- var import_date_fns14 = require("date-fns");
14825
+ var import_date_fns15 = require("date-fns");
14706
14826
  var import_locale8 = require("date-fns/locale");
14707
- var import_react70 = require("react");
14827
+ var import_react68 = require("react");
14708
14828
  var import_jsx_runtime83 = require("react/jsx-runtime");
14709
14829
  function WeekView({
14710
14830
  currentDate,
@@ -14712,40 +14832,40 @@ function WeekView({
14712
14832
  onEventSelect,
14713
14833
  onEventCreate
14714
14834
  }) {
14715
- const days = (0, import_react70.useMemo)(() => {
14716
- const weekStart2 = (0, import_date_fns14.startOfWeek)(currentDate, { weekStartsOn: 0 });
14717
- const weekEnd = (0, import_date_fns14.endOfWeek)(currentDate, { weekStartsOn: 0 });
14718
- return (0, import_date_fns14.eachDayOfInterval)({ end: weekEnd, start: weekStart2 });
14835
+ const days = (0, import_react68.useMemo)(() => {
14836
+ const weekStart2 = (0, import_date_fns15.startOfWeek)(currentDate, { weekStartsOn: 0 });
14837
+ const weekEnd = (0, import_date_fns15.endOfWeek)(currentDate, { weekStartsOn: 0 });
14838
+ return (0, import_date_fns15.eachDayOfInterval)({ end: weekEnd, start: weekStart2 });
14719
14839
  }, [currentDate]);
14720
- const weekStart = (0, import_react70.useMemo)(
14721
- () => (0, import_date_fns14.startOfWeek)(currentDate, { weekStartsOn: 0 }),
14840
+ const weekStart = (0, import_react68.useMemo)(
14841
+ () => (0, import_date_fns15.startOfWeek)(currentDate, { weekStartsOn: 0 }),
14722
14842
  [currentDate]
14723
14843
  );
14724
- const hours = (0, import_react70.useMemo)(() => {
14725
- const dayStart = (0, import_date_fns14.startOfDay)(currentDate);
14726
- return (0, import_date_fns14.eachHourOfInterval)({
14727
- end: (0, import_date_fns14.addHours)(dayStart, EndHour - 1),
14728
- start: (0, import_date_fns14.addHours)(dayStart, StartHour)
14844
+ const hours = (0, import_react68.useMemo)(() => {
14845
+ const dayStart = (0, import_date_fns15.startOfDay)(currentDate);
14846
+ return (0, import_date_fns15.eachHourOfInterval)({
14847
+ end: (0, import_date_fns15.addHours)(dayStart, EndHour - 1),
14848
+ start: (0, import_date_fns15.addHours)(dayStart, StartHour)
14729
14849
  });
14730
14850
  }, [currentDate]);
14731
- const allDayEvents = (0, import_react70.useMemo)(() => {
14851
+ const allDayEvents = (0, import_react68.useMemo)(() => {
14732
14852
  return events.filter((event) => {
14733
14853
  return event.allDay || isMultiDayEvent(event);
14734
14854
  }).filter((event) => {
14735
14855
  const eventStart = new Date(event.start);
14736
14856
  const eventEnd = new Date(event.end);
14737
14857
  return days.some(
14738
- (day) => (0, import_date_fns14.isSameDay)(day, eventStart) || (0, import_date_fns14.isSameDay)(day, eventEnd) || day > eventStart && day < eventEnd
14858
+ (day) => (0, import_date_fns15.isSameDay)(day, eventStart) || (0, import_date_fns15.isSameDay)(day, eventEnd) || day > eventStart && day < eventEnd
14739
14859
  );
14740
14860
  });
14741
14861
  }, [events, days]);
14742
- const processedDayEvents = (0, import_react70.useMemo)(() => {
14862
+ const processedDayEvents = (0, import_react68.useMemo)(() => {
14743
14863
  const result = days.map((day) => {
14744
14864
  const dayEvents = events.filter((event) => {
14745
14865
  if (event.allDay || isMultiDayEvent(event)) return false;
14746
14866
  const eventStart = new Date(event.start);
14747
14867
  const eventEnd = new Date(event.end);
14748
- return (0, import_date_fns14.isSameDay)(day, eventStart) || (0, import_date_fns14.isSameDay)(day, eventEnd) || eventStart < day && eventEnd > day;
14868
+ return (0, import_date_fns15.isSameDay)(day, eventStart) || (0, import_date_fns15.isSameDay)(day, eventEnd) || eventStart < day && eventEnd > day;
14749
14869
  });
14750
14870
  const sortedEvents = [...dayEvents].sort((a, b) => {
14751
14871
  const aStart = new Date(a.start);
@@ -14754,20 +14874,20 @@ function WeekView({
14754
14874
  const bEnd = new Date(b.end);
14755
14875
  if (aStart < bStart) return -1;
14756
14876
  if (aStart > bStart) return 1;
14757
- const aDuration = (0, import_date_fns14.differenceInMinutes)(aEnd, aStart);
14758
- const bDuration = (0, import_date_fns14.differenceInMinutes)(bEnd, bStart);
14877
+ const aDuration = (0, import_date_fns15.differenceInMinutes)(aEnd, aStart);
14878
+ const bDuration = (0, import_date_fns15.differenceInMinutes)(bEnd, bStart);
14759
14879
  return bDuration - aDuration;
14760
14880
  });
14761
14881
  const positionedEvents = [];
14762
- const dayStart = (0, import_date_fns14.startOfDay)(day);
14882
+ const dayStart = (0, import_date_fns15.startOfDay)(day);
14763
14883
  const columns = [];
14764
14884
  for (const event of sortedEvents) {
14765
14885
  const eventStart = new Date(event.start);
14766
14886
  const eventEnd = new Date(event.end);
14767
- const adjustedStart = (0, import_date_fns14.isSameDay)(day, eventStart) ? eventStart : dayStart;
14768
- const adjustedEnd = (0, import_date_fns14.isSameDay)(day, eventEnd) ? eventEnd : (0, import_date_fns14.addHours)(dayStart, 24);
14769
- const startHour = (0, import_date_fns14.getHours)(adjustedStart) + (0, import_date_fns14.getMinutes)(adjustedStart) / 60;
14770
- const endHour = (0, import_date_fns14.getHours)(adjustedEnd) + (0, import_date_fns14.getMinutes)(adjustedEnd) / 60;
14887
+ const adjustedStart = (0, import_date_fns15.isSameDay)(day, eventStart) ? eventStart : dayStart;
14888
+ const adjustedEnd = (0, import_date_fns15.isSameDay)(day, eventEnd) ? eventEnd : (0, import_date_fns15.addHours)(dayStart, 24);
14889
+ const startHour = (0, import_date_fns15.getHours)(adjustedStart) + (0, import_date_fns15.getMinutes)(adjustedStart) / 60;
14890
+ const endHour = (0, import_date_fns15.getHours)(adjustedEnd) + (0, import_date_fns15.getMinutes)(adjustedEnd) / 60;
14771
14891
  const top = (startHour - StartHour) * WeekCellsHeight;
14772
14892
  const height = (endHour - startHour) * WeekCellsHeight;
14773
14893
  let columnIndex = 0;
@@ -14779,7 +14899,7 @@ function WeekView({
14779
14899
  placed = true;
14780
14900
  } else {
14781
14901
  const overlaps = col.some(
14782
- (c) => (0, import_date_fns14.areIntervalsOverlapping)(
14902
+ (c) => (0, import_date_fns15.areIntervalsOverlapping)(
14783
14903
  { end: adjustedEnd, start: adjustedStart },
14784
14904
  {
14785
14905
  end: new Date(c.event.end),
@@ -14824,19 +14944,19 @@ function WeekView({
14824
14944
  );
14825
14945
  return /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)("div", { className: "flex h-full flex-col", "data-slot": "week-view", children: [
14826
14946
  /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)("div", { className: "sticky top-0 z-30 grid grid-cols-8 border-border/70 border-b bg-background/80 backdrop-blur-md", children: [
14827
- /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("div", { className: "py-2 text-center text-muted-foreground/70 text-sm", children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("span", { className: "max-[479px]:sr-only", children: (0, import_date_fns14.format)(/* @__PURE__ */ new Date(), "O") }) }),
14947
+ /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("div", { className: "py-2 text-center text-muted-foreground/70 text-sm", children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("span", { className: "max-[479px]:sr-only", children: (0, import_date_fns15.format)(/* @__PURE__ */ new Date(), "O") }) }),
14828
14948
  days.map((day) => /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)(
14829
14949
  "div",
14830
14950
  {
14831
14951
  className: "py-2 text-center text-muted-foreground/70 text-sm data-today:font-medium data-today:text-foreground",
14832
- "data-today": (0, import_date_fns14.isToday)(day) || void 0,
14952
+ "data-today": (0, import_date_fns15.isToday)(day) || void 0,
14833
14953
  children: [
14834
14954
  /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)("span", { "aria-hidden": "true", className: "sm:hidden", children: [
14835
- (0, import_date_fns14.format)(day, "EEE", { locale: import_locale8.ptBR })[0],
14955
+ (0, import_date_fns15.format)(day, "EEE", { locale: import_locale8.ptBR })[0],
14836
14956
  " ",
14837
- (0, import_date_fns14.format)(day, "d", { locale: import_locale8.ptBR })
14957
+ (0, import_date_fns15.format)(day, "d", { locale: import_locale8.ptBR })
14838
14958
  ] }),
14839
- /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("span", { className: "max-sm:hidden", children: (0, import_date_fns14.format)(day, "EEE dd", { locale: import_locale8.ptBR }) })
14959
+ /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("span", { className: "max-sm:hidden", children: (0, import_date_fns15.format)(day, "EEE dd", { locale: import_locale8.ptBR }) })
14840
14960
  ]
14841
14961
  },
14842
14962
  day.toString()
@@ -14848,19 +14968,19 @@ function WeekView({
14848
14968
  const dayAllDayEvents = allDayEvents.filter((event) => {
14849
14969
  const eventStart = new Date(event.start);
14850
14970
  const eventEnd = new Date(event.end);
14851
- return (0, import_date_fns14.isSameDay)(day, eventStart) || day > eventStart && day < eventEnd || (0, import_date_fns14.isSameDay)(day, eventEnd);
14971
+ return (0, import_date_fns15.isSameDay)(day, eventStart) || day > eventStart && day < eventEnd || (0, import_date_fns15.isSameDay)(day, eventEnd);
14852
14972
  });
14853
14973
  return /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
14854
14974
  "div",
14855
14975
  {
14856
14976
  className: "relative border-border/70 border-r p-1 last:border-r-0",
14857
- "data-today": (0, import_date_fns14.isToday)(day) || void 0,
14977
+ "data-today": (0, import_date_fns15.isToday)(day) || void 0,
14858
14978
  children: dayAllDayEvents.map((event) => {
14859
14979
  const eventStart = new Date(event.start);
14860
14980
  const eventEnd = new Date(event.end);
14861
- const isFirstDay = (0, import_date_fns14.isSameDay)(day, eventStart);
14862
- const isLastDay = (0, import_date_fns14.isSameDay)(day, eventEnd);
14863
- const isFirstVisibleDay = dayIndex === 0 && (0, import_date_fns14.isBefore)(eventStart, weekStart);
14981
+ const isFirstDay = (0, import_date_fns15.isSameDay)(day, eventStart);
14982
+ const isLastDay = (0, import_date_fns15.isSameDay)(day, eventEnd);
14983
+ const isFirstVisibleDay = dayIndex === 0 && (0, import_date_fns15.isBefore)(eventStart, weekStart);
14864
14984
  const shouldShowTitle = isFirstDay || isFirstVisibleDay;
14865
14985
  return /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
14866
14986
  EventItem,
@@ -14895,7 +15015,7 @@ function WeekView({
14895
15015
  "div",
14896
15016
  {
14897
15017
  className: "relative min-h-[var(--week-cells-height)] border-border/70 border-b last:border-b-0",
14898
- children: index > 0 && /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("span", { className: "-top-3 absolute left-0 flex h-6 w-16 max-w-full items-center justify-end bg-background pe-2 text-[10px] text-muted-foreground/70 sm:pe-4 sm:text-xs", children: (0, import_date_fns14.format)(hour, "HH:mm") })
15018
+ children: index > 0 && /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("span", { className: "-top-3 absolute left-0 flex h-6 w-16 max-w-full items-center justify-end bg-background pe-2 text-[10px] text-muted-foreground/70 sm:pe-4 sm:text-xs", children: (0, import_date_fns15.format)(hour, "HH:mm") })
14899
15019
  },
14900
15020
  hour.toString()
14901
15021
  )) }),
@@ -14903,7 +15023,7 @@ function WeekView({
14903
15023
  "div",
14904
15024
  {
14905
15025
  className: "relative grid auto-cols-fr border-border/70 border-r last:border-r-0",
14906
- "data-today": (0, import_date_fns14.isToday)(day) || void 0,
15026
+ "data-today": (0, import_date_fns15.isToday)(day) || void 0,
14907
15027
  children: [
14908
15028
  (processedDayEvents[dayIndex] ?? []).map((positionedEvent) => /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
14909
15029
  "div",
@@ -14930,7 +15050,7 @@ function WeekView({
14930
15050
  },
14931
15051
  positionedEvent.event.id
14932
15052
  )),
14933
- currentTimeVisible && (0, import_date_fns14.isToday)(day) && /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
15053
+ currentTimeVisible && (0, import_date_fns15.isToday)(day) && /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
14934
15054
  "div",
14935
15055
  {
14936
15056
  className: "pointer-events-none absolute right-0 left-0 z-20",
@@ -14942,7 +15062,7 @@ function WeekView({
14942
15062
  }
14943
15063
  ),
14944
15064
  hours.map((hour) => {
14945
- const hourValue = (0, import_date_fns14.getHours)(hour);
15065
+ const hourValue = (0, import_date_fns15.getHours)(hour);
14946
15066
  return /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
14947
15067
  "div",
14948
15068
  {
@@ -14985,11 +15105,11 @@ function WeekView({
14985
15105
  }
14986
15106
 
14987
15107
  // src/components/ui/form/CheckBoxThree.tsx
14988
- var import_react71 = require("react");
15108
+ var import_react69 = require("react");
14989
15109
  var import_framer_motion19 = require("framer-motion");
14990
15110
  var import_jsx_runtime84 = require("react/jsx-runtime");
14991
15111
  function useCheckboxTree(initialTree) {
14992
- const initialCheckedNodes = (0, import_react71.useMemo)(() => {
15112
+ const initialCheckedNodes = (0, import_react69.useMemo)(() => {
14993
15113
  const checkedSet = /* @__PURE__ */ new Set();
14994
15114
  const initializeCheckedNodes = (node) => {
14995
15115
  if (node.defaultChecked) {
@@ -15000,8 +15120,8 @@ function useCheckboxTree(initialTree) {
15000
15120
  initializeCheckedNodes(initialTree);
15001
15121
  return checkedSet;
15002
15122
  }, [initialTree]);
15003
- const [checkedNodes, setCheckedNodes] = (0, import_react71.useState)(initialCheckedNodes);
15004
- const isChecked = (0, import_react71.useCallback)(
15123
+ const [checkedNodes, setCheckedNodes] = (0, import_react69.useState)(initialCheckedNodes);
15124
+ const isChecked = (0, import_react69.useCallback)(
15005
15125
  (node) => {
15006
15126
  if (!node.children) {
15007
15127
  return checkedNodes.has(node.id);
@@ -15019,7 +15139,7 @@ function useCheckboxTree(initialTree) {
15019
15139
  },
15020
15140
  [checkedNodes]
15021
15141
  );
15022
- const handleCheck = (0, import_react71.useCallback)(
15142
+ const handleCheck = (0, import_react69.useCallback)(
15023
15143
  (node) => {
15024
15144
  const newCheckedNodes = new Set(checkedNodes);
15025
15145
  const toggleNode = (n, check) => {
@@ -15049,9 +15169,9 @@ function CheckboxTree({ tree, renderNode }) {
15049
15169
  onCheckedChange,
15050
15170
  children
15051
15171
  }) => {
15052
- const [open, setOpen] = (0, import_react71.useState)(() => !!node.children && status !== false);
15053
- const checkboxRef = (0, import_react71.useRef)(null);
15054
- (0, import_react71.useEffect)(() => {
15172
+ const [open, setOpen] = (0, import_react69.useState)(() => !!node.children && status !== false);
15173
+ const checkboxRef = (0, import_react69.useRef)(null);
15174
+ (0, import_react69.useEffect)(() => {
15055
15175
  if (checkboxRef.current) {
15056
15176
  checkboxRef.current.indeterminate = status === "indeterminate";
15057
15177
  }
@@ -15134,6 +15254,320 @@ function CheckboxTree({ tree, renderNode }) {
15134
15254
  return renderTreeNode(tree);
15135
15255
  }
15136
15256
 
15257
+ // src/components/selects/MultiSelectBase.tsx
15258
+ var import_react70 = require("@phosphor-icons/react");
15259
+ var import_react71 = require("react");
15260
+ var import_framer_motion20 = require("framer-motion");
15261
+ var import_jsx_runtime85 = require("react/jsx-runtime");
15262
+ var MultiSelectContext = (0, import_react71.createContext)(null);
15263
+ function MultiSelectBase({
15264
+ children,
15265
+ values,
15266
+ defaultValues,
15267
+ onValuesChange,
15268
+ disabled,
15269
+ empty,
15270
+ error
15271
+ }) {
15272
+ const [open, setOpen] = (0, import_react71.useState)(false);
15273
+ const [internalValues, setInternalValues] = (0, import_react71.useState)(
15274
+ new Set(values ?? defaultValues)
15275
+ );
15276
+ const selectedValues = values ? new Set(values) : internalValues;
15277
+ const [items, setItems] = (0, import_react71.useState)(/* @__PURE__ */ new Map());
15278
+ function toggleValue(value) {
15279
+ if (disabled) return;
15280
+ const getNewSet = (prev) => {
15281
+ const newSet = new Set(prev);
15282
+ if (newSet.has(value)) {
15283
+ newSet.delete(value);
15284
+ } else {
15285
+ newSet.add(value);
15286
+ }
15287
+ return newSet;
15288
+ };
15289
+ setInternalValues(getNewSet);
15290
+ onValuesChange?.([...getNewSet(selectedValues)]);
15291
+ }
15292
+ const onItemAdded = (0, import_react71.useCallback)((value, label) => {
15293
+ setItems((prev) => {
15294
+ if (prev.get(value) === label) return prev;
15295
+ return new Map(prev).set(value, label);
15296
+ });
15297
+ }, []);
15298
+ return /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
15299
+ MultiSelectContext.Provider,
15300
+ {
15301
+ value: {
15302
+ open,
15303
+ setOpen,
15304
+ selectedValues,
15305
+ toggleValue,
15306
+ items,
15307
+ onItemAdded,
15308
+ disabled,
15309
+ emptyMessage: empty,
15310
+ error
15311
+ },
15312
+ children: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
15313
+ PopoverBase,
15314
+ {
15315
+ open,
15316
+ onOpenChange: (v) => !disabled && setOpen(v),
15317
+ modal: true,
15318
+ children
15319
+ }
15320
+ )
15321
+ }
15322
+ );
15323
+ }
15324
+ function MultiSelectTriggerBase({
15325
+ className,
15326
+ children,
15327
+ error: propError,
15328
+ ...props
15329
+ }) {
15330
+ const { open, disabled, error: contextError } = useMultiSelectContext();
15331
+ const error = propError ?? contextError;
15332
+ return /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("div", { className: cn("w-full", error && "mb-0"), children: [
15333
+ /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(PopoverTriggerBase, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)(
15334
+ ButtonBase,
15335
+ {
15336
+ ...props,
15337
+ variant: props.variant ?? "outline",
15338
+ role: props.role ?? "combobox",
15339
+ "aria-expanded": props["aria-expanded"] ?? open,
15340
+ "aria-disabled": disabled || void 0,
15341
+ disabled,
15342
+ className: cn(
15343
+ "flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border bg-background px-3 py-2 text-sm shadow-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1 min-w-[150px]",
15344
+ error ? "border-destructive focus:ring-1 focus:ring-destructive" : "border-input focus:ring-1 focus:ring-ring",
15345
+ className
15346
+ ),
15347
+ children: [
15348
+ children,
15349
+ /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(import_react70.CaretUpDownIcon, { className: "size-4 shrink-0 opacity-50" })
15350
+ ]
15351
+ }
15352
+ ) }),
15353
+ error ? /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(ErrorMessage_default, { error }) : null
15354
+ ] });
15355
+ }
15356
+ function MultiSelectValueBase({
15357
+ placeholder,
15358
+ clickToRemove = true,
15359
+ className,
15360
+ overflowBehavior = "wrap-when-open",
15361
+ ...props
15362
+ }) {
15363
+ const { selectedValues, toggleValue, items, open } = useMultiSelectContext();
15364
+ const [overflowAmount, setOverflowAmount] = (0, import_react71.useState)(0);
15365
+ const valueRef = (0, import_react71.useRef)(null);
15366
+ const overflowRef = (0, import_react71.useRef)(null);
15367
+ const mutationObserverRef = (0, import_react71.useRef)(null);
15368
+ const resizeObserverRef = (0, import_react71.useRef)(null);
15369
+ const shouldWrap = overflowBehavior === "wrap" || overflowBehavior === "wrap-when-open" && open;
15370
+ const checkOverflow = (0, import_react71.useCallback)(() => {
15371
+ if (valueRef.current == null) return;
15372
+ const containerElement = valueRef.current;
15373
+ const overflowElement = overflowRef.current;
15374
+ const items2 = containerElement.querySelectorAll(
15375
+ "[data-selected-item]"
15376
+ );
15377
+ if (overflowElement != null) overflowElement.style.display = "none";
15378
+ items2.forEach((child) => child.style.removeProperty("display"));
15379
+ let amount = 0;
15380
+ for (let i = items2.length - 1; i >= 0; i--) {
15381
+ const child = items2[i];
15382
+ if (containerElement.scrollWidth <= containerElement.clientWidth) {
15383
+ break;
15384
+ }
15385
+ amount = items2.length - i;
15386
+ child.style.display = "none";
15387
+ overflowElement?.style.removeProperty("display");
15388
+ }
15389
+ setOverflowAmount(amount);
15390
+ }, []);
15391
+ const handleResize = (0, import_react71.useCallback)(
15392
+ (node) => {
15393
+ if (node == null) {
15394
+ valueRef.current = null;
15395
+ if (resizeObserverRef.current) {
15396
+ resizeObserverRef.current.disconnect();
15397
+ resizeObserverRef.current = null;
15398
+ }
15399
+ if (mutationObserverRef.current) {
15400
+ mutationObserverRef.current.disconnect();
15401
+ mutationObserverRef.current = null;
15402
+ }
15403
+ return;
15404
+ }
15405
+ valueRef.current = node;
15406
+ if (resizeObserverRef.current) {
15407
+ resizeObserverRef.current.disconnect();
15408
+ resizeObserverRef.current = null;
15409
+ }
15410
+ if (mutationObserverRef.current) {
15411
+ mutationObserverRef.current.disconnect();
15412
+ mutationObserverRef.current = null;
15413
+ }
15414
+ const mo = new MutationObserver(checkOverflow);
15415
+ const ro = new ResizeObserver(debounce(checkOverflow, 100));
15416
+ mutationObserverRef.current = mo;
15417
+ resizeObserverRef.current = ro;
15418
+ mo.observe(node, {
15419
+ childList: true,
15420
+ attributes: true,
15421
+ attributeFilter: ["class", "style"]
15422
+ });
15423
+ ro.observe(node);
15424
+ checkOverflow();
15425
+ },
15426
+ [checkOverflow]
15427
+ );
15428
+ if (selectedValues.size === 0 && placeholder) {
15429
+ return /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("span", { className: "min-w-0 overflow-hidden font-normal text-muted-foreground ", children: placeholder });
15430
+ }
15431
+ return /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)(
15432
+ "div",
15433
+ {
15434
+ ...props,
15435
+ ref: handleResize,
15436
+ className: cn(
15437
+ "flex w-full gap-1.5 overflow-hidden",
15438
+ shouldWrap && "h-full flex-wrap",
15439
+ className
15440
+ ),
15441
+ children: [
15442
+ [...selectedValues].filter((value) => items.has(value)).map((value) => /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)(
15443
+ Badge,
15444
+ {
15445
+ "data-selected-item": true,
15446
+ size: "sm",
15447
+ className: "group flex items-center gap-1",
15448
+ onClick: clickToRemove ? (e) => {
15449
+ e.stopPropagation();
15450
+ toggleValue(value);
15451
+ } : void 0,
15452
+ children: [
15453
+ items.get(value),
15454
+ clickToRemove && /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(import_react70.XIcon, { className: "size-3 text-muted-foreground group-hover:text-destructive" })
15455
+ ]
15456
+ },
15457
+ value
15458
+ )),
15459
+ /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)(
15460
+ Badge,
15461
+ {
15462
+ style: {
15463
+ display: overflowAmount > 0 && !shouldWrap ? "block" : "none"
15464
+ },
15465
+ ref: overflowRef,
15466
+ children: [
15467
+ "+",
15468
+ overflowAmount
15469
+ ]
15470
+ }
15471
+ )
15472
+ ]
15473
+ }
15474
+ );
15475
+ }
15476
+ function MultiSelectContentBase({
15477
+ search = true,
15478
+ children,
15479
+ ...props
15480
+ }) {
15481
+ const canSearch = typeof search === "object" ? true : search;
15482
+ const { emptyMessage } = useMultiSelectContext();
15483
+ return /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(import_jsx_runtime85.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(PopoverContentBase, { className: "w-[--radix-popover-trigger-width] relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md p-0", children: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
15484
+ import_framer_motion20.motion.div,
15485
+ {
15486
+ initial: { opacity: 0, scale: 0.95 },
15487
+ animate: { opacity: 1, scale: 1 },
15488
+ exit: { opacity: 0, scale: 0.95 },
15489
+ transition: { duration: 0.2 },
15490
+ children: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("div", { className: cn(" "), children: /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)(CommandBase, { ...props, children: [
15491
+ canSearch ? /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
15492
+ CommandInputBase,
15493
+ {
15494
+ placeholder: typeof search === "object" ? search.placeholder : void 0
15495
+ }
15496
+ ) : /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("button", { autoFocus: true, className: "sr-only" }),
15497
+ /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)(CommandListBase, { children: [
15498
+ canSearch && /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(CommandEmptyBase, { children: typeof search === "object" ? search.emptyMessage ?? emptyMessage : emptyMessage }),
15499
+ children
15500
+ ] })
15501
+ ] }) })
15502
+ }
15503
+ ) }) });
15504
+ }
15505
+ function MultiSelectItemBase({
15506
+ value,
15507
+ children,
15508
+ badgeLabel,
15509
+ onSelect,
15510
+ ...props
15511
+ }) {
15512
+ const { toggleValue, selectedValues, onItemAdded } = useMultiSelectContext();
15513
+ const isSelected = selectedValues.has(value);
15514
+ (0, import_react71.useEffect)(() => {
15515
+ onItemAdded(value, badgeLabel ?? children);
15516
+ }, [value, children, onItemAdded, badgeLabel]);
15517
+ return /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
15518
+ CommandItemBase,
15519
+ {
15520
+ ...props,
15521
+ onSelect: () => {
15522
+ toggleValue(value);
15523
+ onSelect?.(value);
15524
+ },
15525
+ children: /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)(
15526
+ import_framer_motion20.motion.div,
15527
+ {
15528
+ whileHover: { scale: 1.02 },
15529
+ whileTap: { scale: 0.98 },
15530
+ transition: { duration: 0.1 },
15531
+ children: [
15532
+ /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("span", { className: "absolute right-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
15533
+ import_framer_motion20.motion.div,
15534
+ {
15535
+ initial: { scale: 0 },
15536
+ animate: { scale: isSelected ? 1 : 0 },
15537
+ transition: { type: "spring", stiffness: 500, damping: 30 },
15538
+ children: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(import_react70.CheckIcon, { className: "size-4" })
15539
+ }
15540
+ ) }),
15541
+ children
15542
+ ]
15543
+ }
15544
+ )
15545
+ }
15546
+ );
15547
+ }
15548
+ function MultiSelectGroupBase(props) {
15549
+ return /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(CommandGroupBase, { ...props });
15550
+ }
15551
+ function MultiSelectSeparatorBase(props) {
15552
+ return /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(CommandSeparatorBase, { ...props });
15553
+ }
15554
+ function useMultiSelectContext() {
15555
+ const context = (0, import_react71.useContext)(MultiSelectContext);
15556
+ if (context == null) {
15557
+ throw new Error(
15558
+ "useMultiSelectContext must be used within a MultiSelectContext"
15559
+ );
15560
+ }
15561
+ return context;
15562
+ }
15563
+ function debounce(func, wait) {
15564
+ let timeout = null;
15565
+ return function(...args) {
15566
+ if (timeout) clearTimeout(timeout);
15567
+ timeout = setTimeout(() => func.apply(this, args), wait);
15568
+ };
15569
+ }
15570
+
15137
15571
  // src/hooks/use-drag.tsx
15138
15572
  var import_react72 = require("react");
15139
15573
  var useDrag = (options = {}) => {