eatopia-ds 0.0.948 → 0.0.950

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/build/index18.js CHANGED
@@ -1,7 +1,7 @@
1
- import { j as r } from "./index24.js";
2
- import { useMemo as R, useCallback as L, useRef as wt, useState as J, useEffect as bt } from "react";
3
- import { createPortal as pe } from "react-dom";
4
- const fe = {
1
+ import { j as a } from "./index24.js";
2
+ import { useMemo as L, useCallback as P, useRef as et, useState as J, useEffect as xt } from "react";
3
+ import { createPortal as De } from "react-dom";
4
+ const Me = {
5
5
  light: {
6
6
  stockSafe: "#00E676",
7
7
  stockPast: "#c4ccd0",
@@ -50,7 +50,7 @@ const fe = {
50
50
  selectedQtyBar: "#42A5F5"
51
51
  // Azul mais claro para tema escuro
52
52
  }
53
- }, xe = {
53
+ }, Fe = {
54
54
  sm: {
55
55
  height: 170,
56
56
  segmentRatio: 0.2,
@@ -96,35 +96,60 @@ const fe = {
96
96
  pillPaddingY: 4,
97
97
  pillFontSize: 11
98
98
  }
99
- }, be = (a) => {
100
- a.roundRect || (a.roundRect = function(F, S, D, B, c) {
101
- D < 2 * c && (c = D / 2), B < 2 * c && (c = B / 2), this.beginPath(), this.moveTo(F + c, S), this.arcTo(F + D, S, F + D, S + B, c), this.arcTo(F + D, S + B, F, S + B, c), this.arcTo(F, S + B, F, S, c), this.arcTo(F, S, F + D, S, c), this.closePath();
99
+ }, Ce = (i) => {
100
+ i.roundRect || (i.roundRect = function(b, v, S, E, c) {
101
+ S < 2 * c && (c = S / 2), E < 2 * c && (c = E / 2), this.beginPath(), this.moveTo(b + c, v), this.arcTo(b + S, v, b + S, v + E, c), this.arcTo(b + S, v + E, b, v + E, c), this.arcTo(b, v + E, b, v, c), this.arcTo(b, v, b + S, v, c), this.closePath();
102
102
  });
103
- }, dt = (a, F) => {
104
- const S = parseInt(a.replace("#", ""), 16), D = Math.round(2.55 * F), B = (S >> 16) + D, c = (S >> 8 & 255) + D, j = (S & 255) + D;
105
- return "#" + (16777216 + (B < 255 ? B < 1 ? 0 : B : 255) * 65536 + (c < 255 ? c < 1 ? 0 : c : 255) * 256 + (j < 255 ? j < 1 ? 0 : j : 255)).toString(16).slice(1);
106
- }, ye = (a) => {
107
- const F = new Date(a.todayDate).getTime(), S = new Date(a.stockEndDate).getTime(), D = new Date(a.deliveryDate).getTime(), B = new Date(a.restockSuggestionStart).getTime(), c = new Date(a.restockSuggestionEnd).getTime();
108
- if (D >= S) {
109
- const p = Math.ceil((D - S) / 864e5);
103
+ }, bt = (i, b) => {
104
+ const v = parseInt(i.replace("#", ""), 16), S = Math.round(2.55 * b), E = (v >> 16) + S, c = (v >> 8 & 255) + S, w = (v & 255) + S;
105
+ return "#" + (16777216 + (E < 255 ? E < 1 ? 0 : E : 255) * 65536 + (c < 255 ? c < 1 ? 0 : c : 255) * 256 + (w < 255 ? w < 1 ? 0 : w : 255)).toString(16).slice(1);
106
+ };
107
+ function se(i) {
108
+ const b = i.split("-").map(Number);
109
+ return b.length !== 3 || b.some(Number.isNaN) ? /* @__PURE__ */ new Date(NaN) : new Date(b[0], b[1] - 1, b[2]);
110
+ }
111
+ function K(i) {
112
+ const b = i.split("T")[0], v = i.includes("T") ? i.split("T")[1] : null, S = se(b);
113
+ if (isNaN(S.getTime())) return S;
114
+ if (v) {
115
+ const [E, c, w] = v.split(":"), m = parseInt(E ?? "0", 10), nt = parseInt(c ?? "0", 10), Ft = w !== void 0 && parseInt(w.slice(0, 2), 10) || 0, s = w != null && w.includes(".") && parseInt(w.split(".")[1].slice(0, 3), 10) || 0;
116
+ Number.isNaN(m) || S.setHours(m, nt, Ft, s);
117
+ }
118
+ return S;
119
+ }
120
+ function Bt(i) {
121
+ return i.includes("T") ? K(i) : yt(se(i));
122
+ }
123
+ function yt(i) {
124
+ const b = new Date(i);
125
+ return b.setHours(23, 59, 59, 999), b;
126
+ }
127
+ const Ee = (i) => {
128
+ const b = K(i.todayDate).getTime(), v = Bt(i.stockEndDate).getTime(), S = K(i.deliveryDate).getTime(), E = K(
129
+ i.restockSuggestionStart
130
+ ).getTime(), c = Bt(
131
+ i.restockSuggestionEnd
132
+ ).getTime();
133
+ if (S >= v) {
134
+ const m = Math.ceil((S - v) / 864e5);
110
135
  return {
111
136
  status: "critical",
112
137
  title: "Risco de Ruptura",
113
- message: p > 0 ? `A entrega chegará ${p} dia(s) após o estoque acabar.` : "A entrega está prevista para o mesmo dia do fim do estoque."
138
+ message: m > 0 ? `A entrega chegará ${m} dia(s) após o estoque acabar.` : "A entrega está prevista para o mesmo dia do fim do estoque."
114
139
  };
115
140
  }
116
- if (F >= S)
141
+ if (b >= v)
117
142
  return {
118
143
  status: "critical",
119
144
  title: "Estoque Esgotado",
120
145
  message: "Seu estoque previsto chegou ao fim."
121
146
  };
122
- const j = Math.floor((S - D) / (1e3 * 60 * 60 * 24));
123
- return j <= 2 ? {
147
+ const w = Math.floor((v - S) / (1e3 * 60 * 60 * 24));
148
+ return w <= 2 ? {
124
149
  status: "urgent",
125
150
  title: "Atenção ao Prazo",
126
- message: `Margem de segurança baixa: entrega prevista para ${j} dia(s) antes do fim do estoque.`
127
- } : F >= B && F <= c ? {
151
+ message: `Margem de segurança baixa: entrega prevista para ${w} dia(s) antes do fim do estoque.`
152
+ } : b >= E && b <= c ? {
128
153
  status: "warning",
129
154
  title: "Sugestão de Compra",
130
155
  message: "Momento ideal para realizar o pedido de reposição."
@@ -134,27 +159,28 @@ const fe = {
134
159
  message: "Nível de estoque adequado. Nenhuma ação necessária."
135
160
  };
136
161
  };
137
- function Te({
138
- data: a,
139
- className: F,
140
- style: S,
141
- controls: D = !1,
142
- showLegend: B = !0,
162
+ function Be({
163
+ data: i,
164
+ className: b,
165
+ style: v,
166
+ controls: S = !1,
167
+ showLegend: E = !0,
143
168
  size: c = "md",
144
- selectedQty: j,
145
- selectedQtyDays: p,
146
- showSuggestionBar: yt = !0
169
+ selectedQty: w,
170
+ selectedQtyDays: m,
171
+ showSuggestionBar: nt = !0,
172
+ unitLabel: Ft = "kg"
147
173
  }) {
148
- const e = R(() => xe[c], [c]), u = R(
149
- () => fe[a.config.theme || "light"],
150
- [a.config.theme]
151
- ), H = R(
152
- () => ye(a.timeline),
153
- [a.timeline]
154
- ), _t = ["DOM", "SEG", "TER", "QUA", "QUI", "SEX", "SAB"], Qt = L(
155
- (o) => {
156
- if (!a.timeline.dailyConsumptionAverage) return null;
157
- const f = [
174
+ const s = L(() => Fe[c], [c]), p = L(
175
+ () => Me[i.config.theme || "light"],
176
+ [i.config.theme]
177
+ ), H = L(
178
+ () => Ee(i.timeline),
179
+ [i.timeline]
180
+ ), re = ["DOM", "SEG", "TER", "QUA", "QUI", "SEX", "SAB"], ae = P(
181
+ (e) => {
182
+ if (!i.timeline.dailyConsumptionAverage) return null;
183
+ const g = [
158
184
  "0-domingo",
159
185
  "1-segunda",
160
186
  "2-terca",
@@ -162,96 +188,101 @@ function Te({
162
188
  "4-quinta",
163
189
  "5-sexta",
164
190
  "6-sabado"
165
- ][o];
166
- return a.timeline.dailyConsumptionAverage[f] ?? null;
191
+ ][e];
192
+ return i.timeline.dailyConsumptionAverage[g] ?? null;
167
193
  },
168
- [a]
169
- ), Z = wt(null), Tt = wt(null), [y, jt] = J({
194
+ [i]
195
+ ), ot = et(null), jt = et(null), [T, Nt] = J({
170
196
  isHovering: !1,
171
197
  hoveredSection: null,
172
198
  mouseX: 0,
173
199
  mouseY: 0,
174
200
  dateAtCursor: null
175
- }), [Pt, Jt] = J({ x: 0, y: 0 }), Ft = R(() => [0.6, 0.9, 1, 1.4], []), [Wt, Ot] = J(2), [U, gt] = J(0), [ht, Kt] = J(!1), [Zt, It] = J(
176
- yt
177
- ), Y = D ? Zt : yt;
178
- bt(() => {
179
- It(yt);
180
- }, [yt]);
181
- const w = R(
182
- () => new Date(a.timeline.lastRestockDate),
183
- [a.timeline.lastRestockDate]
184
- ), tt = R(
185
- () => new Date(a.timeline.todayDate),
186
- [a.timeline.todayDate]
187
- ), T = R(
188
- () => new Date(a.timeline.stockEndDate),
189
- [a.timeline.stockEndDate]
190
- ), Lt = R(
191
- () => new Date(a.timeline.restockSuggestionStart),
192
- [a.timeline.restockSuggestionStart]
193
- ), z = R(
194
- () => new Date(a.timeline.restockSuggestionEnd),
195
- [a.timeline.restockSuggestionEnd]
196
- ), P = R(
197
- () => new Date(a.timeline.deliveryDate),
198
- [a.timeline.deliveryDate]
199
- ), M = 1e3 * 60 * 60 * 24, A = R(
200
- () => a.config.pixelsPerDay * Ft[Wt],
201
- [a.config.pixelsPerDay, Wt, Ft]
202
- ), b = L(
203
- (o) => {
204
- const t = (o.getTime() - w.getTime()) / M;
205
- return e.padding.left + t * A - U;
201
+ }), [qt, le] = J({ x: 0, y: 0 }), Lt = L(() => [0.6, 0.9, 1, 1.4, 1.8], []), [Gt, Ut] = J(3), [q, it] = J(0), [vt, ce] = J(!1), [de, zt] = J(
202
+ nt
203
+ ), Y = S ? de : nt;
204
+ xt(() => {
205
+ zt(nt);
206
+ }, [nt]);
207
+ const M = L(
208
+ () => K(i.timeline.lastRestockDate),
209
+ [i.timeline.lastRestockDate]
210
+ ), st = L(
211
+ () => K(i.timeline.todayDate),
212
+ [i.timeline.todayDate]
213
+ ), C = L(
214
+ () => Bt(i.timeline.stockEndDate),
215
+ [i.timeline.stockEndDate]
216
+ ), Vt = L(
217
+ () => K(i.timeline.restockSuggestionStart),
218
+ [i.timeline.restockSuggestionStart]
219
+ ), U = L(
220
+ () => Bt(i.timeline.restockSuggestionEnd),
221
+ [i.timeline.restockSuggestionEnd]
222
+ ), I = L(
223
+ () => K(i.timeline.deliveryDate),
224
+ [i.timeline.deliveryDate]
225
+ ), A = 1e3 * 60 * 60 * 24, X = L(
226
+ () => i.config.pixelsPerDay * Lt[Gt],
227
+ [i.config.pixelsPerDay, Gt, Lt]
228
+ ), y = P(
229
+ (e) => {
230
+ const t = (e.getTime() - M.getTime()) / A;
231
+ return s.padding.left + t * X - q;
206
232
  },
207
233
  [
208
- w,
209
- A,
210
- e.padding.left,
211
- U,
212
- M
234
+ M,
235
+ X,
236
+ s.padding.left,
237
+ q,
238
+ A
213
239
  ]
214
- ), Ht = L(
215
- (o) => {
216
- const t = (o - e.padding.left + U) / A, f = new Date(w);
217
- return f.setDate(f.getDate() + Math.floor(t)), f;
240
+ ), _t = P(
241
+ (e) => {
242
+ const t = (e - s.padding.left + q) / X, g = new Date(M);
243
+ return g.setDate(g.getDate() + Math.floor(t)), g;
218
244
  },
219
- [w, A, e.padding.left, U]
220
- ), et = (o) => `${o.getDate().toString().padStart(2, "0")}/${(o.getMonth() + 1).toString().padStart(2, "0")}`, ut = L(() => {
221
- const o = Z.current;
222
- if (!o) return;
223
- const t = o.getContext("2d");
245
+ [M, X, s.padding.left, q]
246
+ ), ge = (e) => `${e.getDate().toString().padStart(2, "0")}/${(e.getMonth() + 1).toString().padStart(2, "0")}`, St = (e) => {
247
+ const t = e.getDate().toString().padStart(2, "0"), g = (e.getMonth() + 1).toString().padStart(2, "0");
248
+ if (e.getHours() === 0 && e.getMinutes() === 0) return `${t}/${g}`;
249
+ const F = e.getHours().toString().padStart(2, "0"), d = e.getMinutes().toString().padStart(2, "0");
250
+ return `${t}/${g} ${F}:${d}`;
251
+ }, Tt = P(() => {
252
+ const e = ot.current;
253
+ if (!e) return;
254
+ const t = e.getContext("2d");
224
255
  if (!t) return;
225
- be(t);
226
- const f = window.devicePixelRatio || 1, x = o.getBoundingClientRect().width, g = e.height;
227
- if (o.width = x * f, o.height = g * f, t.scale(f, f), t.clearRect(0, 0, x, g), t.fillStyle = u.background, t.roundRect(0, 0, x, g, 12), t.fill(), y.isHovering && y.dateAtCursor) {
228
- const i = b(y.dateAtCursor), n = a.config.theme === "dark";
229
- t.fillStyle = n ? "rgba(255, 255, 255, 0.05)" : "rgba(0, 0, 0, 0.05)";
230
- const s = e.padding.top, l = g - e.padding.bottom - e.padding.top;
231
- t.fillRect(i, s, A, l);
256
+ Ce(t);
257
+ const g = window.devicePixelRatio || 1, d = e.getBoundingClientRect().width, u = s.height;
258
+ if (e.width = d * g, e.height = u * g, t.scale(g, g), t.clearRect(0, 0, d, u), t.fillStyle = p.background, t.roundRect(0, 0, d, u, 12), t.fill(), T.isHovering && T.dateAtCursor) {
259
+ const n = y(T.dateAtCursor), o = i.config.theme === "dark";
260
+ t.fillStyle = o ? "rgba(255, 255, 255, 0.05)" : "rgba(0, 0, 0, 0.05)";
261
+ const r = s.padding.top, l = u - s.padding.bottom - s.padding.top;
262
+ t.fillRect(n, r, X, l);
232
263
  }
233
- const $ = b(w), k = b(tt), X = b(T), W = b(P);
234
- b(Lt);
235
- const G = b(z), Q = e.padding.top, E = (g - e.padding.top - e.padding.bottom) * e.segmentRatio, q = Q + 5, V = q + E + 2;
236
- t.strokeStyle = u.textSecondary, t.lineWidth = 1, t.setLineDash([]);
237
- let mt = Math.max(
238
- z.getTime(),
239
- P.getTime(),
240
- T.getTime()
264
+ const W = y(M), B = y(st), j = y(C), O = y(I);
265
+ y(Vt);
266
+ const z = y(U), V = s.padding.top, R = (u - s.padding.top - s.padding.bottom) * s.segmentRatio, N = V + 5, _ = N + R + 2;
267
+ t.strokeStyle = p.textSecondary, t.lineWidth = 1, t.setLineDash([]);
268
+ let wt = Math.max(
269
+ U.getTime(),
270
+ I.getTime(),
271
+ C.getTime()
241
272
  );
242
- if (typeof p == "number" && p > 0) {
243
- const i = new Date(
244
- Math.max(P.getTime(), T.getTime())
245
- ), n = new Date(
246
- i.getTime() + p * M
247
- );
248
- mt = Math.max(mt, n.getTime());
273
+ if (typeof m == "number" && m > 0) {
274
+ const n = new Date(
275
+ Math.max(I.getTime(), C.getTime())
276
+ ), o = new Date(
277
+ n.getTime() + (m - 1) * A
278
+ ), r = yt(o);
279
+ wt = Math.max(wt, r.getTime());
249
280
  }
250
- const st = new Date(mt);
251
- st.setDate(st.getDate() + 2);
252
- const I = Math.ceil(
253
- (st.getTime() - w.getTime()) / (1e3 * 60 * 60 * 24)
254
- ), at = [
281
+ const gt = new Date(wt);
282
+ gt.setDate(gt.getDate() + 2);
283
+ const $ = Math.ceil(
284
+ (gt.getTime() - M.getTime()) / (1e3 * 60 * 60 * 24)
285
+ ), ut = [
255
286
  "JAN",
256
287
  "FEV",
257
288
  "MAR",
@@ -264,52 +295,52 @@ function Te({
264
295
  "OUT",
265
296
  "NOV",
266
297
  "DEZ"
267
- ], pt = (i) => {
268
- const n = i % 2 === 0;
269
- return a.config.theme === "dark" ? n ? "rgba(71, 85, 105, 0.25)" : "rgba(51, 65, 85, 0.4)" : n ? "rgba(241, 245, 249, 0.6)" : "rgba(203, 213, 225, 0.5)";
270
- }, ft = (i, n) => {
271
- const s = i % 2 === 0;
272
- return a.config.theme === "dark" ? s ? "rgba(148, 163, 184, 1)" : "rgba(226, 232, 240, 1)" : s ? "rgba(100, 116, 139, 1)" : "rgba(51, 65, 85, 1)";
298
+ ], kt = (n) => {
299
+ const o = n % 2 === 0;
300
+ return i.config.theme === "dark" ? o ? "rgba(71, 85, 105, 0.25)" : "rgba(51, 65, 85, 0.4)" : o ? "rgba(241, 245, 249, 0.6)" : "rgba(203, 213, 225, 0.5)";
301
+ }, Dt = (n, o) => {
302
+ const r = n % 2 === 0;
303
+ return i.config.theme === "dark" ? r ? "rgba(148, 163, 184, 1)" : "rgba(226, 232, 240, 1)" : r ? "rgba(100, 116, 139, 1)" : "rgba(51, 65, 85, 1)";
273
304
  }, Mt = [];
274
- let rt = -1, vt = -1, Et = e.padding.left;
275
- for (let i = 0; i <= I; i++) {
276
- const n = new Date(w);
277
- n.setDate(n.getDate() + i);
278
- const s = b(n), l = n.getMonth(), d = n.getFullYear();
279
- (l !== rt || d !== vt) && (rt !== -1 && Mt.push({
280
- month: rt,
281
- year: vt,
282
- startX: Et,
283
- endX: s
284
- }), rt = l, vt = d, Et = s);
305
+ let ht = -1, Xt = -1, Wt = s.padding.left;
306
+ for (let n = 0; n <= $; n++) {
307
+ const o = new Date(M);
308
+ o.setDate(o.getDate() + n);
309
+ const r = y(o), l = o.getMonth(), f = o.getFullYear();
310
+ (l !== ht || f !== Xt) && (ht !== -1 && Mt.push({
311
+ month: ht,
312
+ year: Xt,
313
+ startX: Wt,
314
+ endX: r
315
+ }), ht = l, Xt = f, Wt = r);
285
316
  }
286
- if (rt !== -1) {
287
- const i = new Date(w);
288
- i.setDate(i.getDate() + I), Mt.push({
289
- month: rt,
290
- year: vt,
291
- startX: Et,
292
- endX: b(i) + A
317
+ if (ht !== -1) {
318
+ const n = new Date(M);
319
+ n.setDate(n.getDate() + $), Mt.push({
320
+ month: ht,
321
+ year: Xt,
322
+ startX: Wt,
323
+ endX: y(n) + X
293
324
  });
294
325
  }
295
- const Nt = Q, Ut = g - e.padding.bottom - Q;
296
- for (const i of Mt) {
297
- const n = Math.max(i.startX, e.padding.left), l = Math.min(i.endX, x - e.padding.right) - n;
326
+ const te = V, ee = u - s.padding.bottom - V;
327
+ for (const n of Mt) {
328
+ const o = Math.max(n.startX, s.padding.left), l = Math.min(n.endX, d - s.padding.right) - o;
298
329
  if (l > 0) {
299
- t.fillStyle = pt(i.month), t.fillRect(n, Nt, l, Ut);
300
- const d = Nt + Ut - 15;
301
- t.fillStyle = a.config.theme === "dark" ? "rgba(148, 163, 184, 0.35)" : "rgba(100, 116, 139, 0.25)";
302
- const h = `bold ${(e.fontSize + 4) * 2}px system-ui, -apple-system, sans-serif`, m = new Date(i.year, i.month, 2), v = b(m), K = v >= e.padding.left && v <= x - e.padding.right, xt = new Date(i.year, i.month + 1, 2), ct = b(xt);
303
- ct >= e.padding.left && ct <= x - e.padding.right && (t.save(), t.font = h, t.textAlign = "right", t.textBaseline = "bottom", t.fillText(
304
- at[i.month],
305
- ct - 4,
306
- d
307
- ), t.restore()), K && (t.save(), t.font = h, t.textAlign = "left", t.textBaseline = "bottom", t.fillText(at[i.month], v + 4, d), t.restore());
330
+ t.fillStyle = kt(n.month), t.fillRect(o, te, l, ee);
331
+ const f = te + ee - 15;
332
+ t.fillStyle = i.config.theme === "dark" ? "rgba(148, 163, 184, 0.35)" : "rgba(100, 116, 139, 0.25)";
333
+ const h = `bold ${(s.fontSize + 4) * 2}px system-ui, -apple-system, sans-serif`, x = new Date(n.year, n.month, 2), D = y(x), tt = D >= s.padding.left && D <= d - s.padding.right, pt = new Date(n.year, n.month + 1, 2), ft = y(pt);
334
+ ft >= s.padding.left && ft <= d - s.padding.right && (t.save(), t.font = h, t.textAlign = "right", t.textBaseline = "bottom", t.fillText(
335
+ ut[n.month],
336
+ ft - 4,
337
+ f
338
+ ), t.restore()), tt && (t.save(), t.font = h, t.textAlign = "left", t.textBaseline = "bottom", t.fillText(ut[n.month], D + 4, f), t.restore());
308
339
  }
309
340
  }
310
- const le = ["DOM", "SEG", "TER", "QUA", "QUI", "SEX", "SAB"], zt = (i) => {
311
- if (!a.timeline.dailyConsumptionAverage) return null;
312
- const s = [
341
+ const Te = ["DOM", "SEG", "TER", "QUA", "QUI", "SEX", "SAB"], ne = (n) => {
342
+ if (!i.timeline.dailyConsumptionAverage) return null;
343
+ const r = [
313
344
  "0-domingo",
314
345
  "1-segunda",
315
346
  "2-terca",
@@ -317,405 +348,448 @@ function Te({
317
348
  "4-quinta",
318
349
  "5-sexta",
319
350
  "6-sabado"
320
- ][i];
321
- return a.timeline.dailyConsumptionAverage[s] ?? null;
351
+ ][n];
352
+ return i.timeline.dailyConsumptionAverage[r] ?? null;
322
353
  };
323
- for (let i = 0; i <= I; i++) {
324
- const n = new Date(w);
325
- n.setDate(n.getDate() + i);
326
- const s = b(n);
327
- if (s >= e.padding.left && s <= x - e.padding.right) {
328
- const l = n.getDay(), d = l === 0 || l === 6, h = n.getMonth();
329
- n.getDate() === 1 && (t.save(), t.strokeStyle = a.config.theme === "dark" ? "rgba(148, 163, 184, 0.8)" : "rgba(71, 85, 105, 0.6)", t.lineWidth = 2, t.beginPath(), t.moveTo(s, Q), t.lineTo(s, g - e.padding.bottom + 20), t.stroke(), t.restore()), t.strokeStyle = u.textSecondary, t.lineWidth = 1, t.beginPath(), t.moveTo(s, Q), t.lineTo(s, g - e.padding.bottom), t.stroke();
330
- const v = 30, K = Math.abs(s - k) < v, xt = Math.abs(s - W) < v, ct = Math.abs(s - X) < v, kt = Math.max(W, X), Rt = Math.abs(s - kt) < v;
331
- if (!(!d && (K || xt || ct || Rt))) {
332
- const Bt = s + A / 2, de = g - e.padding.bottom + 8;
333
- t.fillStyle = ft(h), t.font = `${e.fontSize}px system-ui, -apple-system, sans-serif`, t.textAlign = "center", t.textBaseline = "top", t.fillText(
334
- n.getDate().toString().padStart(2, "0"),
335
- Bt,
336
- de
337
- );
338
- const Vt = zt(l), ge = Vt !== null ? Vt : 0;
339
- t.fillStyle = a.config.theme === "dark" ? "rgba(148, 163, 184, 0.7)" : "rgba(100, 116, 139, 0.7)", t.font = `${e.fontSize - 3}px system-ui, -apple-system, sans-serif`, t.textAlign = "center", t.textBaseline = "bottom";
340
- const he = g - e.padding.bottom - 18;
341
- t.fillText(ge.toFixed(2), Bt, he);
342
- const ue = le[l];
343
- t.fillStyle = ft(h), t.font = `${d ? "bold " : ""}${e.fontSize - 2}px system-ui, -apple-system, sans-serif`;
344
- const me = g - e.padding.bottom - 4;
345
- t.textBaseline = "bottom", t.fillText(ue, Bt, me);
346
- }
354
+ for (let n = 0; n <= $; n++) {
355
+ const o = new Date(
356
+ M.getFullYear(),
357
+ M.getMonth(),
358
+ M.getDate() + n
359
+ ), r = y(o);
360
+ if (r >= s.padding.left && r <= d - s.padding.right) {
361
+ const l = o.getDay(), f = l === 0 || l === 6, h = o.getMonth();
362
+ o.getDate() === 1 && (t.save(), t.strokeStyle = i.config.theme === "dark" ? "rgba(148, 163, 184, 0.8)" : "rgba(71, 85, 105, 0.6)", t.lineWidth = 2, t.beginPath(), t.moveTo(r, V), t.lineTo(r, u - s.padding.bottom + 20), t.stroke(), t.restore()), t.strokeStyle = p.textSecondary, t.lineWidth = 1, t.beginPath(), t.moveTo(r, V), t.lineTo(r, u - s.padding.bottom), t.stroke();
363
+ const D = r + X / 2, tt = u - s.padding.bottom + 8;
364
+ t.fillStyle = Dt(h), t.font = `${s.fontSize}px system-ui, -apple-system, sans-serif`, t.textAlign = "center", t.textBaseline = "top", t.fillText(o.getDate().toString().padStart(2, "0"), D, tt);
365
+ const pt = ne(l), ft = pt !== null ? pt : 0;
366
+ t.fillStyle = i.config.theme === "dark" ? "rgba(148, 163, 184, 0.7)" : "rgba(100, 116, 139, 0.7)", t.font = `${s.fontSize - 3}px system-ui, -apple-system, sans-serif`, t.textAlign = "center", t.textBaseline = "bottom";
367
+ const Rt = u - s.padding.bottom - 18;
368
+ t.fillText(ft.toFixed(2), D, Rt);
369
+ const Yt = Te[l];
370
+ t.fillStyle = Dt(h), t.font = `${f ? "bold " : ""}${s.fontSize - 2}px system-ui, -apple-system, sans-serif`;
371
+ const ke = u - s.padding.bottom - 4;
372
+ t.textBaseline = "bottom", t.fillText(Yt, D, ke);
347
373
  }
348
374
  }
349
- if (ht && a.timeline.dailyConsumptionAverage) {
350
- const i = Object.values(
351
- a.timeline.dailyConsumptionAverage
352
- ).filter((m) => typeof m == "number"), n = i.length > 0 ? Math.max(...i, 1) : 1, s = e.padding.bottom * 0.5, l = g - e.padding.bottom, d = s, h = [];
353
- for (let m = 0; m <= I; m++) {
354
- const v = new Date(w);
355
- v.setDate(v.getDate() + m);
356
- const K = b(v);
357
- if (K >= e.padding.left && K <= x - e.padding.right) {
358
- const xt = v.getDay(), kt = (zt(xt) ?? 0) / n, Rt = l - kt * d;
359
- h.push({ x: K + A / 2, y: Rt });
375
+ if (vt && i.timeline.dailyConsumptionAverage) {
376
+ const n = Object.values(
377
+ i.timeline.dailyConsumptionAverage
378
+ ).filter((x) => typeof x == "number"), o = n.length > 0 ? Math.max(...n, 1) : 1, r = s.padding.bottom * 0.5, l = u - s.padding.bottom, f = r, h = [];
379
+ for (let x = 0; x <= $; x++) {
380
+ const D = new Date(M);
381
+ D.setDate(D.getDate() + x);
382
+ const tt = y(D);
383
+ if (tt >= s.padding.left && tt <= d - s.padding.right) {
384
+ const pt = D.getDay(), Rt = (ne(pt) ?? 0) / o, Yt = l - Rt * f;
385
+ h.push({ x: tt + X / 2, y: Yt });
360
386
  }
361
387
  }
362
388
  if (h.length > 1) {
363
389
  t.save(), t.strokeStyle = "rgba(0, 0, 0, 0.25)", t.lineWidth = 2, t.lineCap = "round", t.lineJoin = "round", t.miterLimit = 2, t.beginPath(), t.moveTo(h[0].x, h[0].y);
364
- for (let m = 1; m < h.length; m++)
365
- t.lineTo(h[m].x, h[m].y);
390
+ for (let x = 1; x < h.length; x++)
391
+ t.lineTo(h[x].x, h[x].y);
366
392
  t.stroke(), t.restore();
367
393
  }
368
394
  }
369
- const lt = Math.max($, e.padding.left), ce = (i, n, s) => {
370
- const l = t.createLinearGradient(0, n, 0, n + s);
371
- return l.addColorStop(0, i), l.addColorStop(1, dt(i, -15)), l;
372
- }, At = (i, n, s) => {
373
- const l = t.createLinearGradient(n, 0, n + s, 0);
374
- return l.addColorStop(0, i), l.addColorStop(1, dt(i, -10)), l;
375
- }, Xt = (i, n, s, l, d) => {
376
- if (!d) return;
377
- const h = (i + n) / 2, m = s + l / 2;
378
- t.textAlign = "center", t.font = `${e.fontSize - 1}px system-ui, -apple-system, sans-serif`, t.fillStyle = "#FFFFFF", t.textBaseline = "middle", t.shadowColor = "rgba(0, 0, 0, 0.35)", t.shadowBlur = 3, t.shadowOffsetY = 1, t.fillText(d, h, m), t.shadowColor = "transparent", t.shadowBlur = 0, t.shadowOffsetY = 0;
395
+ const mt = Math.max(W, s.padding.left), we = (n, o, r) => {
396
+ const l = t.createLinearGradient(0, o, 0, o + r);
397
+ return l.addColorStop(0, n), l.addColorStop(1, bt(n, -15)), l;
398
+ }, Ot = (n, o, r) => {
399
+ const l = t.createLinearGradient(o, 0, o + r, 0);
400
+ return l.addColorStop(0, n), l.addColorStop(1, bt(n, -10)), l;
401
+ }, $t = (n, o, r, l, f) => {
402
+ if (!f) return;
403
+ const h = (n + o) / 2, x = r + l / 2;
404
+ t.textAlign = "center", t.font = `${s.fontSize - 1}px system-ui, -apple-system, sans-serif`, t.fillStyle = "#FFFFFF", t.textBaseline = "middle", t.shadowColor = "rgba(0, 0, 0, 0.35)", t.shadowBlur = 3, t.shadowOffsetY = 1, t.fillText(f, h, x), t.shadowColor = "transparent", t.shadowBlur = 0, t.shadowOffsetY = 0;
379
405
  };
380
- if (t.lineWidth = 1, t.lineJoin = "round", k > lt) {
381
- const i = k - lt;
382
- t.beginPath(), t.globalAlpha = 1, t.fillStyle = ce(u.stockPast, q, E), t.strokeStyle = dt(u.stockPast, -20), t.lineWidth = 1.5;
383
- const n = lt, s = q, l = i, d = E, h = 6;
384
- t.moveTo(n + h, s), t.lineTo(n + l, s), t.lineTo(n + l, s + d), t.lineTo(n + h, s + d), t.quadraticCurveTo(n, s + d, n, s + d - h), t.lineTo(n, s + h), t.quadraticCurveTo(n, s, n + h, s), t.fill(), t.stroke(), t.closePath();
385
- const m = Math.max(
406
+ t.lineWidth = 1, t.lineJoin = "round";
407
+ const oe = new Date(
408
+ Math.min(st.getTime(), C.getTime())
409
+ ), Ht = y(oe);
410
+ if (Ht > mt) {
411
+ const n = Ht - mt;
412
+ t.beginPath(), t.globalAlpha = 1, t.fillStyle = we(p.stockPast, N, R), t.strokeStyle = bt(p.stockPast, -20), t.lineWidth = 1.5;
413
+ const o = mt, r = N, l = n, f = R, h = 6;
414
+ t.moveTo(o + h, r), t.lineTo(o + l, r), t.lineTo(o + l, r + f), t.lineTo(o + h, r + f), t.quadraticCurveTo(o, r + f, o, r + f - h), t.lineTo(o, r + h), t.quadraticCurveTo(o, r, o + h, r), t.fill(), t.stroke(), t.closePath();
415
+ const x = Math.max(
386
416
  0,
387
- Math.round((tt.getTime() - w.getTime()) / M)
388
- ), v = `${m} dia${m === 1 ? "" : "s"} consumido${m === 1 ? "" : "s"}`;
389
- Xt(
390
- lt,
391
- k,
392
- q,
393
- E,
394
- v
417
+ Math.round(
418
+ (oe.getTime() - M.getTime()) / A
419
+ )
420
+ ), D = `${x} dia${x === 1 ? "" : "s"} consumido${x === 1 ? "" : "s"}`;
421
+ $t(
422
+ mt,
423
+ Ht,
424
+ N,
425
+ R,
426
+ D
395
427
  );
396
428
  }
397
- if (X > k) {
398
- const i = X - k;
399
- t.beginPath(), t.globalAlpha = 1, t.fillStyle = At(
400
- u.stockFuture,
401
- k,
402
- i
403
- ), t.strokeStyle = dt(u.stockFuture, -20), t.lineWidth = 1.5;
404
- const n = k, s = q, l = i, d = E, h = 6;
405
- t.moveTo(n, s), t.lineTo(n + l - h, s), t.quadraticCurveTo(n + l, s, n + l, s + h), t.lineTo(n + l, s + d - h), t.quadraticCurveTo(n + l, s + d, n + l - h, s + d), t.lineTo(n, s + d), t.lineTo(n, s), t.fill(), t.stroke(), t.closePath();
406
- const m = Math.max(
429
+ if (j > B) {
430
+ const n = j - B;
431
+ t.beginPath(), t.globalAlpha = 1, t.fillStyle = Ot(
432
+ p.stockFuture,
433
+ B,
434
+ n
435
+ ), t.strokeStyle = bt(p.stockFuture, -20), t.lineWidth = 1.5;
436
+ const o = B, r = N, l = n, f = R, h = 6;
437
+ t.moveTo(o, r), t.lineTo(o + l - h, r), t.quadraticCurveTo(o + l, r, o + l, r + h), t.lineTo(o + l, r + f - h), t.quadraticCurveTo(o + l, r + f, o + l - h, r + f), t.lineTo(o, r + f), t.lineTo(o, r), t.fill(), t.stroke(), t.closePath();
438
+ const x = Math.max(
407
439
  0,
408
- Math.round((T.getTime() - tt.getTime()) / M)
409
- ), v = `${m} dia${m === 1 ? "" : "s"} restante${m === 1 ? "" : "s"}`;
410
- Xt(
411
- k,
412
- X,
413
- q,
414
- E,
415
- v
440
+ Math.round((C.getTime() - st.getTime()) / A)
441
+ ), D = `${x} dia${x === 1 ? "" : "s"} restante${x === 1 ? "" : "s"}`;
442
+ $t(
443
+ B,
444
+ j,
445
+ N,
446
+ R,
447
+ D
416
448
  );
417
449
  }
418
- const _ = Math.max(W, X);
419
- if (Y && G > _ && _ >= e.padding.left) {
420
- const i = G - _;
421
- t.beginPath(), t.globalAlpha = 1, t.fillStyle = At(
422
- u.alert,
423
- _,
424
- i
425
- ), t.strokeStyle = dt(u.alert, -20), t.lineWidth = 1.5, t.roundRect(
450
+ const Q = Math.max(O, j);
451
+ if (Y && z > Q && Q >= s.padding.left) {
452
+ const n = z - Q;
453
+ t.beginPath(), t.globalAlpha = 1, t.fillStyle = Ot(
454
+ p.alert,
455
+ Q,
456
+ n
457
+ ), t.strokeStyle = bt(p.alert, -20), t.lineWidth = 1.5, t.roundRect(
458
+ Q,
426
459
  _,
427
- V,
428
- i,
429
- E,
460
+ n,
461
+ R,
430
462
  6
431
463
  ), t.fill(), t.stroke(), t.closePath();
432
- const n = Math.max(
464
+ const o = Math.max(
433
465
  0,
434
- Math.round(i / A)
435
- ), s = `${n} dia${n === 1 ? "" : "s"}`;
436
- Xt(
466
+ Math.round(n / X)
467
+ ), r = `${o} dia${o === 1 ? "" : "s"}`;
468
+ $t(
469
+ Q,
470
+ z,
437
471
  _,
438
- G,
439
- V,
440
- E,
441
- s
472
+ R,
473
+ r
442
474
  );
443
475
  }
444
- if (typeof p == "number" && p > 0 && typeof j == "number") {
445
- const i = new Date(
446
- Math.max(P.getTime(), T.getTime())
447
- ), n = Math.max(W, X), s = new Date(
448
- i.getTime() + p * M
449
- ), d = b(s) - n;
450
- if (d > 0) {
451
- const h = E * 0.5, m = V + E + 4;
452
- t.beginPath(), t.globalAlpha = 1, t.fillStyle = At(
453
- u.selectedQtyBar,
454
- n,
455
- d
456
- ), t.strokeStyle = dt(
457
- u.selectedQtyBar,
476
+ if (typeof m == "number" && m > 0 && typeof w == "number") {
477
+ const n = new Date(
478
+ Math.max(I.getTime(), C.getTime())
479
+ ), o = Math.max(O, j), r = new Date(
480
+ n.getTime() + (m - 1) * A
481
+ ), l = yt(r), h = y(l) - o;
482
+ if (h > 0) {
483
+ const x = R * 0.5, D = _ + R + 4;
484
+ t.beginPath(), t.globalAlpha = 1, t.fillStyle = Ot(
485
+ p.selectedQtyBar,
486
+ o,
487
+ h
488
+ ), t.strokeStyle = bt(
489
+ p.selectedQtyBar,
458
490
  -20
459
491
  ), t.lineWidth = 1.5, t.roundRect(
460
- n,
461
- m,
462
- d,
492
+ o,
493
+ D,
463
494
  h,
495
+ x,
464
496
  4
465
497
  ), t.fill(), t.stroke(), t.closePath();
466
498
  }
467
499
  }
468
- if (y.isHovering && y.hoveredSection) {
469
- if (t.save(), t.globalAlpha = 0.18, t.fillStyle = a.config.theme === "dark" ? "#FFFFFF" : "#000000", y.hoveredSection === "stock")
500
+ if (T.isHovering && T.hoveredSection) {
501
+ if (t.save(), t.globalAlpha = 0.18, t.fillStyle = i.config.theme === "dark" ? "#FFFFFF" : "#000000", T.hoveredSection === "stock")
470
502
  t.fillRect(
471
- lt,
472
- q,
473
- X - lt,
474
- E
503
+ mt,
504
+ N,
505
+ j - mt,
506
+ R
475
507
  );
476
- else if (y.hoveredSection === "suggestion" && Y)
508
+ else if (T.hoveredSection === "suggestion" && Y)
477
509
  t.fillRect(
510
+ Q,
478
511
  _,
479
- V,
480
- G - _,
481
- E
512
+ z - Q,
513
+ R
482
514
  );
483
- else if (y.hoveredSection === "selectedQty" && typeof p == "number" && p > 0) {
484
- const i = Math.max(W, X), n = new Date(
485
- Math.max(P.getTime(), T.getTime())
486
- ), s = new Date(
487
- n.getTime() + p * M
488
- ), l = b(s), d = E * 0.5, h = V + E + 4;
515
+ else if (T.hoveredSection === "selectedQty" && typeof m == "number" && m > 0) {
516
+ const n = Math.max(O, j), o = new Date(
517
+ Math.max(I.getTime(), C.getTime())
518
+ ), r = new Date(
519
+ o.getTime() + (m - 1) * A
520
+ ), l = yt(r), f = y(l), h = R * 0.5, x = _ + R + 4;
489
521
  t.fillRect(
490
- i,
491
- h,
492
- l - i,
493
- d
522
+ n,
523
+ x,
524
+ f - n,
525
+ h
494
526
  );
495
527
  }
496
528
  t.restore();
497
529
  }
498
- const Gt = (i, n, s, l) => {
499
- t.font = `bold ${e.pillFontSize}px system-ui, -apple-system, sans-serif`;
500
- const d = t.measureText(s.toUpperCase()), h = e.pillPaddingX;
501
- e.pillPaddingY;
502
- const m = e.pillHeight, v = d.width + h * 2;
530
+ const ie = (n, o, r, l) => {
531
+ t.font = `bold ${s.pillFontSize}px system-ui, -apple-system, sans-serif`;
532
+ const f = t.measureText(r.toUpperCase()), h = s.pillPaddingX;
533
+ s.pillPaddingY;
534
+ const x = s.pillHeight, D = f.width + h * 2;
503
535
  t.shadowColor = "rgba(0, 0, 0, 0.1)", t.shadowBlur = 4, t.shadowOffsetY = 2, t.fillStyle = l, t.beginPath(), t.roundRect(
504
- i - v / 2,
505
- n,
506
- v,
507
- m,
508
- m / 2
509
- ), t.fill(), t.shadowColor = "transparent", t.shadowBlur = 0, t.shadowOffsetY = 0, t.fillStyle = "#FFFFFF", t.textAlign = "center", t.textBaseline = "middle", t.fillText(s.toUpperCase(), i, n + m / 2 + 1);
536
+ n - D / 2,
537
+ o,
538
+ D,
539
+ x,
540
+ x / 2
541
+ ), t.fill(), t.shadowColor = "transparent", t.shadowBlur = 0, t.shadowOffsetY = 0, t.fillStyle = "#FFFFFF", t.textAlign = "center", t.textBaseline = "middle", t.fillText(r.toUpperCase(), n, o + x / 2 + 1);
510
542
  };
511
- if (k >= e.padding.left && k <= x - e.padding.right && (t.shadowColor = "rgba(41, 121, 255, 0.3)", t.shadowBlur = 6, t.globalAlpha = 1, t.strokeStyle = u.todayIndicator, t.lineWidth = 2, t.beginPath(), t.moveTo(k, 0), t.lineTo(k, g - e.padding.bottom), t.stroke(), t.shadowColor = "transparent", t.shadowBlur = 0, Gt(
512
- k,
513
- g - e.padding.bottom + 20,
514
- "Hoje",
515
- u.todayIndicator
516
- )), W >= e.padding.left && W <= x - e.padding.right && (t.globalAlpha = 1, t.strokeStyle = u.deliveryBar, t.lineWidth = 1.5, t.setLineDash([3, 3]), t.beginPath(), t.moveTo(W, 0), t.lineTo(W, g - e.padding.bottom), t.stroke(), t.setLineDash([]), Gt(
517
- W,
518
- g - e.padding.bottom + 20,
543
+ if (B >= s.padding.left && B <= d - s.padding.right) {
544
+ const n = B, o = X, r = V, l = u - s.padding.bottom;
545
+ t.globalAlpha = 0.12, t.fillStyle = p.todayIndicator, t.fillRect(
546
+ n,
547
+ r,
548
+ o,
549
+ l - r
550
+ ), t.globalAlpha = 1, t.strokeStyle = p.todayIndicator, t.lineWidth = 1.5, t.beginPath(), t.moveTo(n, r), t.lineTo(n, l), t.stroke();
551
+ const f = n + o / 2;
552
+ ie(
553
+ f,
554
+ u - s.padding.bottom + 20,
555
+ "Hoje",
556
+ p.todayIndicator
557
+ );
558
+ }
559
+ if (O >= s.padding.left && O <= d - s.padding.right && (t.globalAlpha = 1, t.strokeStyle = p.deliveryBar, t.lineWidth = 1.5, t.setLineDash([3, 3]), t.beginPath(), t.moveTo(O, 0), t.lineTo(O, u - s.padding.bottom), t.stroke(), t.setLineDash([]), ie(
560
+ O,
561
+ u - s.padding.bottom + 20,
519
562
  "Entrega",
520
- u.deliveryBar
563
+ p.deliveryBar
521
564
  )), Y) {
522
- const i = e.fontSize + 6, n = _ + A / 2 - i / 2, s = V - i - 4, l = H.status === "critical" ? u.alertCritical : H.status === "urgent" ? u.alertUrgent : H.status === "warning" ? u.alertWarning : H.status === "success" ? u.alertSuccess : u.alertInfo;
565
+ const n = s.fontSize + 6, o = Q + X / 2 - n / 2, r = _ - n - 4, l = H.status === "critical" ? p.alertCritical : H.status === "urgent" ? p.alertUrgent : H.status === "warning" ? p.alertWarning : H.status === "success" ? p.alertSuccess : p.alertInfo;
523
566
  t.beginPath(), t.arc(
524
- n + i / 2,
525
- s + i / 2,
526
- i / 2,
567
+ o + n / 2,
568
+ r + n / 2,
569
+ n / 2,
527
570
  0,
528
571
  Math.PI * 2
529
- ), t.fillStyle = l, t.fill(), t.shadowColor = "rgba(0, 0, 0, 0.2)", t.shadowBlur = 4, t.shadowOffsetY = 2, t.fillStyle = "#FFFFFF", t.font = `bold ${i * 0.6}px system-ui, -apple-system, sans-serif`, t.textAlign = "center", t.textBaseline = "middle";
530
- const d = H.status === "critical" || H.status === "urgent" || H.status === "warning" ? "!" : H.status === "success" ? "✓" : "i";
572
+ ), t.fillStyle = l, t.fill(), t.shadowColor = "rgba(0, 0, 0, 0.2)", t.shadowBlur = 4, t.shadowOffsetY = 2, t.fillStyle = "#FFFFFF", t.font = `bold ${n * 0.6}px system-ui, -apple-system, sans-serif`, t.textAlign = "center", t.textBaseline = "middle";
573
+ const f = H.status === "critical" || H.status === "urgent" || H.status === "warning" ? "!" : H.status === "success" ? "✓" : "i";
531
574
  t.fillText(
532
- d,
533
- n + i / 2,
534
- s + i / 2
575
+ f,
576
+ o + n / 2,
577
+ r + n / 2
535
578
  ), t.shadowColor = "transparent", t.shadowBlur = 0, t.shadowOffsetY = 0;
536
579
  }
537
580
  t.globalAlpha = 1;
538
581
  }, [
539
- a,
540
- b,
541
- w,
542
- tt,
543
- T,
544
- Lt,
545
- z,
546
- P,
547
- u,
548
- e,
582
+ i,
549
583
  y,
550
584
  M,
551
- A,
552
- j,
585
+ st,
586
+ C,
587
+ Vt,
588
+ U,
589
+ I,
553
590
  p,
591
+ s,
592
+ T,
593
+ A,
594
+ X,
595
+ w,
596
+ m,
554
597
  H,
555
- ht,
598
+ vt,
556
599
  Y
557
- ]), Yt = L(
558
- (o, t) => {
559
- const f = Z.current;
560
- if (!f) return null;
561
- const O = f.getBoundingClientRect(), x = o - O.left, g = t - O.top, $ = e.padding.top, k = e.height - e.padding.top - e.padding.bottom, X = k * e.segmentRatio, W = $ + 5, G = W + X + 2, Q = G + X + 4, Ct = X * 0.5, E = b(w);
562
- b(tt);
563
- const q = b(T), V = b(P), mt = b(z), st = Math.max(V, q);
600
+ ]), Qt = P(
601
+ (e, t) => {
602
+ const g = ot.current;
603
+ if (!g) return null;
604
+ const F = g.getBoundingClientRect(), d = e - F.left, u = t - F.top, W = s.padding.top, B = s.height - s.padding.top - s.padding.bottom, j = B * s.segmentRatio, O = W + 5, z = O + j + 2, V = z + j + 4, It = j * 0.5, R = y(M);
605
+ y(st);
606
+ const N = y(C), _ = y(I), wt = y(U), gt = Math.max(_, N);
564
607
  if (Y) {
565
- const I = e.fontSize + 6, at = st + A / 2 - I / 2, pt = G - I - 4;
608
+ const $ = s.fontSize + 6, ut = gt + X / 2 - $ / 2, kt = z - $ - 4;
566
609
  if (Math.sqrt(
567
- Math.pow(x - (at + I / 2), 2) + Math.pow(g - (pt + I / 2), 2)
568
- ) <= I / 2 + 4)
610
+ Math.pow(d - (ut + $ / 2), 2) + Math.pow(u - (kt + $ / 2), 2)
611
+ ) <= $ / 2 + 4)
569
612
  return "alertIcon";
570
613
  }
571
- if (g < $ || g > $ + k + Ct + 10)
614
+ if (u < W || u > W + B + It + 10)
572
615
  return null;
573
- if (typeof p == "number" && p > 0 && typeof j == "number") {
574
- const I = Math.max(V, q), at = new Date(
575
- Math.max(P.getTime(), T.getTime())
576
- ), pt = new Date(
577
- at.getTime() + p * M
578
- ), ft = b(pt);
579
- if (g >= Q && g <= Q + Ct && x >= I && x <= ft)
616
+ if (typeof m == "number" && m > 0 && typeof w == "number") {
617
+ const $ = Math.max(_, N), ut = new Date(
618
+ Math.max(I.getTime(), C.getTime())
619
+ ), kt = new Date(
620
+ ut.getTime() + (m - 1) * A
621
+ ), Dt = yt(kt), Mt = y(Dt);
622
+ if (u >= V && u <= V + It && d >= $ && d <= Mt)
580
623
  return "selectedQty";
581
624
  }
582
- return g >= W && g <= W + X && x >= E && x <= q ? "stock" : Y && g >= G && g <= G + X && x >= st && x <= mt ? "suggestion" : null;
625
+ return u >= O && u <= O + j && d >= R && d <= N ? "stock" : Y && u >= z && u <= z + j && d >= gt && d <= wt ? "suggestion" : null;
583
626
  },
584
627
  [
585
- b,
586
- tt,
587
- T,
588
- z,
628
+ y,
629
+ st,
630
+ C,
631
+ U,
632
+ M,
633
+ I,
634
+ s,
589
635
  w,
590
- P,
591
- e,
592
- j,
593
- p,
636
+ m,
637
+ X,
594
638
  A,
595
- M,
596
639
  Y
597
640
  ]
598
- ), $t = R(() => {
599
- let o = Math.max(
600
- z.getTime(),
601
- P.getTime(),
602
- T.getTime()
641
+ ), Jt = L(() => {
642
+ let e = Math.max(
643
+ U.getTime(),
644
+ I.getTime(),
645
+ C.getTime()
603
646
  );
604
- if (typeof p == "number" && p > 0) {
605
- const f = new Date(
606
- Math.max(P.getTime(), T.getTime())
607
- ), O = new Date(
608
- f.getTime() + p * M
609
- );
610
- o = Math.max(o, O.getTime());
647
+ if (typeof m == "number" && m > 0) {
648
+ const g = new Date(
649
+ Math.max(I.getTime(), C.getTime())
650
+ ), F = new Date(
651
+ g.getTime() + (m - 1) * A
652
+ ), d = yt(F);
653
+ e = Math.max(e, d.getTime());
611
654
  }
612
- const t = new Date(o);
655
+ const t = new Date(e);
613
656
  return t.setDate(t.getDate() + 2), t;
614
- }, [z, P, T, p, M]), qt = R(() => Math.ceil(
615
- ($t.getTime() - w.getTime()) / M
616
- ), [$t, w, M]), Dt = R(() => e.padding.left + qt * A + e.padding.right, [
617
- qt,
618
- A,
619
- e.padding.left,
620
- e.padding.right
621
- ]), [St, te] = J(0);
622
- bt(() => {
623
- const o = () => {
624
- Z.current && te(Z.current.getBoundingClientRect().width);
657
+ }, [U, I, C, m, A]), Kt = L(() => Math.ceil(
658
+ (Jt.getTime() - M.getTime()) / A
659
+ ), [Jt, M, A]), rt = L(() => s.padding.left + Kt * X + s.padding.right, [
660
+ Kt,
661
+ X,
662
+ s.padding.left,
663
+ s.padding.right
664
+ ]), [Z, ue] = J(0);
665
+ xt(() => {
666
+ const e = () => {
667
+ ot.current && ue(ot.current.getBoundingClientRect().width);
625
668
  };
626
- return o(), window.addEventListener("resize", o), () => window.removeEventListener("resize", o);
669
+ return e(), window.addEventListener("resize", e), () => window.removeEventListener("resize", e);
627
670
  }, []);
628
- const C = R(() => St === 0 ? 0 : Math.max(0, Dt - St), [Dt, St]), [N, nt] = J(!1), ot = wt(0), it = wt(0), ee = L(
629
- (o) => {
630
- o.preventDefault(), nt(!0), ot.current = o.clientX, it.current = U;
671
+ const k = L(() => Z === 0 ? 0 : Math.max(0, rt - Z), [rt, Z]), Zt = et(null), [Ct, at] = J(!1), G = et(!1), lt = et(0), ct = et(0), [Et, At] = J(!1), dt = et(!1), he = P(
672
+ (e) => {
673
+ e.preventDefault(), G.current = !0, at(!0), lt.current = e.clientX, ct.current = q;
631
674
  },
632
- [U]
633
- ), ne = L(
634
- (o) => {
635
- o.touches.length === 1 && (o.preventDefault(), nt(!0), ot.current = o.touches[0].clientX, it.current = U);
675
+ [q]
676
+ ), me = P(
677
+ (e) => {
678
+ e.touches.length === 1 && (e.preventDefault(), G.current = !0, at(!0), lt.current = e.touches[0].clientX, ct.current = q);
636
679
  },
637
- [U]
638
- ), oe = L(
639
- (o) => {
640
- const t = Z.current;
680
+ [q]
681
+ ), pe = P(
682
+ (e) => {
683
+ const t = ot.current;
641
684
  if (!t) return;
642
- if (N && C > 0) {
643
- const $ = ot.current - o.clientX, k = it.current + $;
644
- gt(Math.max(0, Math.min(C, k)));
685
+ if (G.current && k > 0) {
686
+ const W = lt.current - e.clientX, B = ct.current + W;
687
+ it(Math.max(0, Math.min(k, B)));
645
688
  return;
646
689
  }
647
- const f = t.getBoundingClientRect(), O = o.clientX - f.left, x = Yt(o.clientX, o.clientY), g = Ht(O);
648
- jt({
690
+ const g = t.getBoundingClientRect(), F = e.clientX - g.left, d = Qt(e.clientX, e.clientY), u = _t(F);
691
+ Nt({
649
692
  isHovering: !0,
650
- hoveredSection: x,
651
- mouseX: o.clientX,
652
- mouseY: o.clientY,
653
- dateAtCursor: g
654
- }), Jt({ x: o.clientX, y: o.clientY });
693
+ hoveredSection: d,
694
+ mouseX: e.clientX,
695
+ mouseY: e.clientY,
696
+ dateAtCursor: u
697
+ }), le({ x: e.clientX, y: e.clientY });
655
698
  },
656
- [Yt, Ht, N, C]
657
- ), ie = L(() => {
658
- jt({
699
+ [Qt, _t, k]
700
+ ), fe = P(() => {
701
+ Nt({
659
702
  isHovering: !1,
660
703
  hoveredSection: null,
661
704
  mouseX: 0,
662
705
  mouseY: 0,
663
706
  dateAtCursor: null
664
707
  });
665
- }, []), se = L(() => {
666
- nt(!1);
667
- }, []), ae = L(
668
- (o) => {
669
- if (o.touches.length === 1 && N && C > 0) {
670
- o.preventDefault();
671
- const t = ot.current - o.touches[0].clientX, f = it.current + t;
672
- gt(Math.max(0, Math.min(C, f)));
708
+ }, []), xe = P(() => {
709
+ G.current = !1, at(!1);
710
+ }, []), be = P(
711
+ (e) => {
712
+ if (e.touches.length === 1 && G.current && k > 0) {
713
+ e.preventDefault();
714
+ const t = lt.current - e.touches[0].clientX, g = ct.current + t;
715
+ it(Math.max(0, Math.min(k, g)));
673
716
  }
674
717
  },
675
- [N, C]
676
- ), re = L(() => {
677
- nt(!1);
718
+ [k]
719
+ ), ye = P(() => {
720
+ G.current = !1, at(!1);
678
721
  }, []);
679
- return bt(() => {
680
- const o = (x) => {
681
- if (N && C > 0) {
682
- const g = ot.current - x.clientX, $ = it.current + g;
683
- gt(Math.max(0, Math.min(C, $)));
722
+ xt(() => {
723
+ const e = (d) => {
724
+ if (G.current && k > 0) {
725
+ const u = lt.current - d.clientX, W = ct.current + u;
726
+ it(Math.max(0, Math.min(k, W)));
684
727
  }
685
728
  }, t = () => {
686
- nt(!1);
687
- }, f = (x) => {
688
- if (x.touches.length === 1 && N && C > 0) {
689
- x.preventDefault();
690
- const g = ot.current - x.touches[0].clientX, $ = it.current + g;
691
- gt(Math.max(0, Math.min(C, $)));
729
+ G.current = !1, at(!1);
730
+ }, g = (d) => {
731
+ if (d.touches.length === 1 && G.current && k > 0) {
732
+ d.preventDefault();
733
+ const u = lt.current - d.touches[0].clientX, W = ct.current + u;
734
+ it(Math.max(0, Math.min(k, W)));
692
735
  }
693
- }, O = () => {
694
- nt(!1);
736
+ }, F = () => {
737
+ G.current = !1, at(!1);
738
+ };
739
+ return Ct && (window.addEventListener("mousemove", e), window.addEventListener("mouseup", t), window.addEventListener("touchmove", g, {
740
+ passive: !1
741
+ }), window.addEventListener("touchend", F)), () => {
742
+ window.removeEventListener("mousemove", e), window.removeEventListener("mouseup", t), window.removeEventListener("touchmove", g), window.removeEventListener("touchend", F);
743
+ };
744
+ }, [Ct, k]);
745
+ const Pt = P(
746
+ (e) => {
747
+ const t = Zt.current;
748
+ if (!t || k <= 0) return;
749
+ const g = t.getBoundingClientRect(), F = g.width, d = Z / rt * F, u = F - d;
750
+ if (u <= 0) return;
751
+ const B = e - g.left - d / 2, j = Math.max(0, Math.min(1, B / u));
752
+ it(j * k);
753
+ },
754
+ [k, Z, rt]
755
+ ), ve = P((e) => {
756
+ e.preventDefault(), e.stopPropagation(), dt.current = !0, At(!0);
757
+ }, []), Se = P((e) => {
758
+ e.stopPropagation(), e.touches.length === 1 && (dt.current = !0, At(!0));
759
+ }, []);
760
+ return xt(() => {
761
+ const e = (d) => {
762
+ dt.current && Pt(d.clientX);
763
+ }, t = () => {
764
+ dt.current = !1, At(!1);
765
+ }, g = (d) => {
766
+ d.touches.length === 1 && dt.current && (d.preventDefault(), Pt(d.touches[0].clientX));
767
+ }, F = () => {
768
+ dt.current = !1, At(!1);
695
769
  };
696
- return N && (window.addEventListener("mousemove", o), window.addEventListener("mouseup", t), window.addEventListener("touchmove", f, {
770
+ return Et && (window.addEventListener("mousemove", e), window.addEventListener("mouseup", t), window.addEventListener("touchmove", g, {
697
771
  passive: !1
698
- }), window.addEventListener("touchend", O)), () => {
699
- window.removeEventListener("mousemove", o), window.removeEventListener("mouseup", t), window.removeEventListener("touchmove", f), window.removeEventListener("touchend", O);
772
+ }), window.addEventListener("touchend", F)), () => {
773
+ window.removeEventListener("mousemove", e), window.removeEventListener("mouseup", t), window.removeEventListener("touchmove", g), window.removeEventListener("touchend", F);
700
774
  };
701
- }, [N, C]), bt(() => {
702
- ut();
703
- }, [ut]), bt(() => {
704
- const o = () => {
705
- ut();
775
+ }, [Et, Pt]), xt(() => {
776
+ Tt();
777
+ }, [Tt]), xt(() => {
778
+ const e = () => {
779
+ Tt();
706
780
  };
707
- window.addEventListener("resize", o);
781
+ window.addEventListener("resize", e);
708
782
  const t = new ResizeObserver(() => {
709
- ut();
783
+ Tt();
710
784
  });
711
- return Tt.current && t.observe(Tt.current), () => {
712
- window.removeEventListener("resize", o), t.disconnect();
785
+ return jt.current && t.observe(jt.current), () => {
786
+ window.removeEventListener("resize", e), t.disconnect();
713
787
  };
714
- }, [ut]), /* @__PURE__ */ r.jsxs(
788
+ }, [Tt]), /* @__PURE__ */ a.jsxs(
715
789
  "div",
716
790
  {
717
- ref: Tt,
718
- className: F,
791
+ ref: jt,
792
+ className: b,
719
793
  style: {
720
794
  position: "relative",
721
795
  width: "100%",
@@ -723,10 +797,10 @@ function Te({
723
797
  overflow: "hidden",
724
798
  touchAction: "pan-x pan-y",
725
799
  // Permite gestos de pan (scroll) em mobile
726
- ...S
800
+ ...v
727
801
  },
728
802
  children: [
729
- D && /* @__PURE__ */ r.jsxs(
803
+ S && /* @__PURE__ */ a.jsxs(
730
804
  "div",
731
805
  {
732
806
  style: {
@@ -734,14 +808,14 @@ function Te({
734
808
  justifyContent: "flex-end",
735
809
  gap: c === "sm" ? 6 : 8,
736
810
  paddingBottom: 8,
737
- paddingRight: e.padding.right
811
+ paddingRight: s.padding.right
738
812
  },
739
813
  children: [
740
- /* @__PURE__ */ r.jsx(
814
+ /* @__PURE__ */ a.jsx(
741
815
  "button",
742
816
  {
743
817
  type: "button",
744
- onClick: () => Ot((o) => Math.max(0, o - 1)),
818
+ onClick: () => Ut((e) => Math.max(0, e - 1)),
745
819
  style: {
746
820
  width: c === "sm" ? 36 : 44,
747
821
  height: c === "sm" ? 36 : 44,
@@ -749,7 +823,7 @@ function Te({
749
823
  minHeight: c === "sm" ? 36 : 44,
750
824
  borderRadius: 999,
751
825
  border: "1px solid rgba(0,0,0,0.16)",
752
- background: a.config.theme === "dark" ? "rgba(38,50,56,0.9)" : "rgba(255,255,255,0.9)",
826
+ background: i.config.theme === "dark" ? "rgba(38,50,56,0.9)" : "rgba(255,255,255,0.9)",
753
827
  display: "flex",
754
828
  alignItems: "center",
755
829
  justifyContent: "center",
@@ -762,12 +836,12 @@ function Te({
762
836
  children: "-"
763
837
  }
764
838
  ),
765
- /* @__PURE__ */ r.jsx(
839
+ /* @__PURE__ */ a.jsx(
766
840
  "button",
767
841
  {
768
842
  type: "button",
769
- onClick: () => Ot(
770
- (o) => Math.min(Ft.length - 1, o + 1)
843
+ onClick: () => Ut(
844
+ (e) => Math.min(Lt.length - 1, e + 1)
771
845
  ),
772
846
  style: {
773
847
  width: c === "sm" ? 36 : 44,
@@ -776,7 +850,7 @@ function Te({
776
850
  minHeight: c === "sm" ? 36 : 44,
777
851
  borderRadius: 999,
778
852
  border: "1px solid rgba(0,0,0,0.16)",
779
- background: a.config.theme === "dark" ? "rgba(38,50,56,0.9)" : "rgba(255,255,255,0.9)",
853
+ background: i.config.theme === "dark" ? "rgba(38,50,56,0.9)" : "rgba(255,255,255,0.9)",
780
854
  display: "flex",
781
855
  alignItems: "center",
782
856
  justifyContent: "center",
@@ -789,11 +863,11 @@ function Te({
789
863
  children: "+"
790
864
  }
791
865
  ),
792
- /* @__PURE__ */ r.jsx(
866
+ /* @__PURE__ */ a.jsx(
793
867
  "button",
794
868
  {
795
869
  type: "button",
796
- onClick: () => It((o) => !o),
870
+ onClick: () => zt((e) => !e),
797
871
  style: {
798
872
  width: c === "sm" ? 36 : 44,
799
873
  height: c === "sm" ? 36 : 44,
@@ -801,14 +875,14 @@ function Te({
801
875
  minHeight: c === "sm" ? 36 : 44,
802
876
  borderRadius: 999,
803
877
  border: "1px solid rgba(0,0,0,0.16)",
804
- background: Y ? a.config.theme === "dark" ? "rgba(38,50,56,0.9)" : "rgba(255,255,255,0.9)" : a.config.theme === "dark" ? "rgba(0,0,0,0.7)" : "rgba(0,0,0,0.5)",
878
+ background: Y ? i.config.theme === "dark" ? "rgba(38,50,56,0.9)" : "rgba(255,255,255,0.9)" : i.config.theme === "dark" ? "rgba(0,0,0,0.7)" : "rgba(0,0,0,0.5)",
805
879
  display: "flex",
806
880
  alignItems: "center",
807
881
  justifyContent: "center",
808
882
  fontSize: c === "sm" ? 14 : 16,
809
883
  cursor: "pointer",
810
884
  boxShadow: "0 1px 2px rgba(0,0,0,0.25)",
811
- color: Y ? a.config.theme === "dark" ? "#ECEFF1" : "#263238" : "#FFFFFF",
885
+ color: Y ? i.config.theme === "dark" ? "#ECEFF1" : "#263238" : "#FFFFFF",
812
886
  fontWeight: "bold",
813
887
  touchAction: "manipulation",
814
888
  WebkitTapHighlightColor: "transparent"
@@ -817,11 +891,11 @@ function Te({
817
891
  children: "S"
818
892
  }
819
893
  ),
820
- a.timeline.dailyConsumptionAverage && /* @__PURE__ */ r.jsx(
894
+ i.timeline.dailyConsumptionAverage && /* @__PURE__ */ a.jsx(
821
895
  "button",
822
896
  {
823
897
  type: "button",
824
- onClick: () => Kt((o) => !o),
898
+ onClick: () => ce((e) => !e),
825
899
  style: {
826
900
  width: c === "sm" ? 36 : 44,
827
901
  height: c === "sm" ? 36 : 44,
@@ -829,84 +903,96 @@ function Te({
829
903
  minHeight: c === "sm" ? 36 : 44,
830
904
  borderRadius: 999,
831
905
  border: "1px solid rgba(0,0,0,0.16)",
832
- background: ht ? a.config.theme === "dark" ? "rgba(0,0,0,0.7)" : "rgba(0,0,0,0.5)" : a.config.theme === "dark" ? "rgba(38,50,56,0.9)" : "rgba(255,255,255,0.9)",
906
+ background: vt ? i.config.theme === "dark" ? "rgba(0,0,0,0.7)" : "rgba(0,0,0,0.5)" : i.config.theme === "dark" ? "rgba(38,50,56,0.9)" : "rgba(255,255,255,0.9)",
833
907
  display: "flex",
834
908
  alignItems: "center",
835
909
  justifyContent: "center",
836
910
  fontSize: c === "sm" ? 14 : 16,
837
911
  cursor: "pointer",
838
912
  boxShadow: "0 1px 2px rgba(0,0,0,0.25)",
839
- color: ht ? "#FFFFFF" : a.config.theme === "dark" ? "#ECEFF1" : "#263238",
913
+ color: vt ? "#FFFFFF" : i.config.theme === "dark" ? "#ECEFF1" : "#263238",
840
914
  fontWeight: "bold",
841
915
  touchAction: "manipulation",
842
916
  WebkitTapHighlightColor: "transparent"
843
917
  },
844
- title: ht ? "Ocultar linha de consumo" : "Mostrar linha de consumo",
918
+ title: vt ? "Ocultar linha de consumo" : "Mostrar linha de consumo",
845
919
  children: "C"
846
920
  }
847
921
  )
848
922
  ]
849
923
  }
850
924
  ),
851
- /* @__PURE__ */ r.jsxs(
925
+ /* @__PURE__ */ a.jsxs(
852
926
  "div",
853
927
  {
854
928
  style: {
855
929
  position: "relative",
856
930
  width: "100%",
857
- minHeight: C > 0 ? e.height + 22 : e.height
931
+ minHeight: k > 0 ? s.height + 8 + 15 : s.height
858
932
  },
859
933
  children: [
860
- /* @__PURE__ */ r.jsx(
934
+ /* @__PURE__ */ a.jsx(
861
935
  "canvas",
862
936
  {
863
- ref: Z,
864
- onMouseMove: oe,
865
- onMouseLeave: ie,
866
- onMouseDown: ee,
867
- onMouseUp: se,
868
- onTouchStart: ne,
869
- onTouchMove: ae,
870
- onTouchEnd: re,
937
+ ref: ot,
938
+ onMouseMove: pe,
939
+ onMouseLeave: fe,
940
+ onMouseDown: he,
941
+ onMouseUp: xe,
942
+ onTouchStart: me,
943
+ onTouchMove: be,
944
+ onTouchEnd: ye,
871
945
  style: {
872
946
  width: "100%",
873
- height: `${e.height}px`,
947
+ height: `${s.height}px`,
874
948
  display: "block",
875
- cursor: C > 0 ? N ? "grabbing" : "grab" : "pointer",
949
+ cursor: k > 0 ? Ct ? "grabbing" : "grab" : "pointer",
876
950
  touchAction: "pan-x"
877
951
  }
878
952
  }
879
953
  ),
880
- C > 0 && /* @__PURE__ */ r.jsx(
954
+ k > 0 && /* @__PURE__ */ a.jsx(
881
955
  "div",
882
956
  {
957
+ ref: Zt,
883
958
  style: {
884
959
  position: "absolute",
885
- top: e.height + 8,
886
- left: e.padding.left,
887
- right: e.padding.right,
888
- height: 6,
889
- backgroundColor: a.config.theme === "dark" ? "rgba(255,255,255,0.1)" : "rgba(0,0,0,0.1)",
890
- borderRadius: 3,
891
- cursor: "pointer"
960
+ top: s.height + 8,
961
+ left: 0,
962
+ right: 0,
963
+ height: 15,
964
+ backgroundColor: i.config.theme === "dark" ? "rgba(255,255,255,0.1)" : "rgba(0,0,0,0.1)",
965
+ borderRadius: 7.5,
966
+ cursor: "pointer",
967
+ display: "flex",
968
+ alignItems: "center"
892
969
  },
893
- onClick: (o) => {
894
- const t = o.currentTarget.getBoundingClientRect(), O = (o.clientX - t.left) / t.width;
895
- gt(O * C);
970
+ onClick: (e) => {
971
+ if (e.target !== e.currentTarget) return;
972
+ const t = e.currentTarget.getBoundingClientRect(), F = (e.clientX - t.left) / t.width;
973
+ it(F * k);
896
974
  },
897
- children: /* @__PURE__ */ r.jsx(
975
+ children: /* @__PURE__ */ a.jsx(
898
976
  "div",
899
977
  {
978
+ role: "slider",
979
+ "aria-valuenow": q,
980
+ "aria-valuemin": 0,
981
+ "aria-valuemax": k,
982
+ onMouseDown: ve,
983
+ onTouchStart: Se,
900
984
  style: {
901
985
  position: "absolute",
902
- top: 0,
903
- left: `${C > 0 ? U / C * 100 : 0}%`,
904
- width: `${Math.max(10, St / Dt * 100)}%`,
986
+ top: "50%",
987
+ transform: "translateY(-50%)",
988
+ width: `${Math.max(10, Z / rt * 100)}%`,
989
+ left: `${k > 0 ? q / k * (100 - Math.max(10, Z / rt * 100)) : 0}%`,
905
990
  maxWidth: "100%",
906
- height: "100%",
907
- backgroundColor: a.config.theme === "dark" ? "rgba(255,255,255,0.4)" : "rgba(0,0,0,0.3)",
908
- borderRadius: 3,
909
- transition: N ? "none" : "left 0.1s ease-out"
991
+ height: 9,
992
+ backgroundColor: i.config.theme === "dark" ? "rgba(255,255,255,0.4)" : "rgba(0,0,0,0.3)",
993
+ borderRadius: 4.5,
994
+ cursor: Et ? "grabbing" : "grab",
995
+ transition: Ct || Et ? "none" : "left 0.1s ease-out"
910
996
  }
911
997
  }
912
998
  )
@@ -915,16 +1001,16 @@ function Te({
915
1001
  ]
916
1002
  }
917
1003
  ),
918
- y.isHovering && (y.dateAtCursor || y.hoveredSection === "alertIcon") && typeof document < "u" && pe(
919
- /* @__PURE__ */ r.jsx(
1004
+ T.isHovering && (T.dateAtCursor || T.hoveredSection === "alertIcon") && typeof document < "u" && De(
1005
+ /* @__PURE__ */ a.jsx(
920
1006
  "div",
921
1007
  {
922
1008
  style: {
923
1009
  position: "fixed",
924
- left: `${Pt.x}px`,
925
- top: `${Pt.y}px`,
926
- backgroundColor: u.tooltipBackground,
927
- color: u.tooltipText,
1010
+ left: `${qt.x}px`,
1011
+ top: `${qt.y}px`,
1012
+ backgroundColor: p.tooltipBackground,
1013
+ color: p.tooltipText,
928
1014
  padding: "6px 10px",
929
1015
  borderRadius: "6px",
930
1016
  fontSize: "10px",
@@ -934,84 +1020,85 @@ function Te({
934
1020
  transform: "translate(-50%, calc(-100% - 10px))",
935
1021
  whiteSpace: "nowrap"
936
1022
  },
937
- children: y.hoveredSection === "alertIcon" ? /* @__PURE__ */ r.jsxs(r.Fragment, { children: [
938
- /* @__PURE__ */ r.jsx("div", { style: { fontWeight: "bold", marginBottom: "4px" }, children: H.title }),
939
- /* @__PURE__ */ r.jsx("div", { children: H.message })
940
- ] }) : /* @__PURE__ */ r.jsxs(r.Fragment, { children: [
941
- /* @__PURE__ */ r.jsx("div", { style: { fontWeight: "bold", marginBottom: "4px" }, children: y.dateAtCursor && et(y.dateAtCursor) }),
942
- y.dateAtCursor && !y.hoveredSection && /* @__PURE__ */ r.jsxs(r.Fragment, { children: [
943
- /* @__PURE__ */ r.jsx("div", { style: { marginBottom: 2 }, children: _t[y.dateAtCursor.getDay()] }),
944
- /* @__PURE__ */ r.jsxs("div", { children: [
1023
+ children: T.hoveredSection === "alertIcon" ? /* @__PURE__ */ a.jsxs(a.Fragment, { children: [
1024
+ /* @__PURE__ */ a.jsx("div", { style: { fontWeight: "bold", marginBottom: "4px" }, children: H.title }),
1025
+ /* @__PURE__ */ a.jsx("div", { children: H.message })
1026
+ ] }) : /* @__PURE__ */ a.jsxs(a.Fragment, { children: [
1027
+ /* @__PURE__ */ a.jsx("div", { style: { fontWeight: "bold", marginBottom: "4px" }, children: T.dateAtCursor && ge(T.dateAtCursor) }),
1028
+ T.dateAtCursor && !T.hoveredSection && /* @__PURE__ */ a.jsxs(a.Fragment, { children: [
1029
+ /* @__PURE__ */ a.jsx("div", { style: { marginBottom: 2 }, children: re[T.dateAtCursor.getDay()] }),
1030
+ /* @__PURE__ */ a.jsxs("div", { children: [
945
1031
  "Consumo médio:",
946
1032
  " ",
947
1033
  (() => {
948
- const o = y.dateAtCursor.getDay(), t = Qt(o);
1034
+ const e = T.dateAtCursor.getDay(), t = ae(e);
949
1035
  return t !== null ? `${t.toFixed(2)}` : "0.0";
950
1036
  })()
951
1037
  ] })
952
1038
  ] }),
953
- y.hoveredSection === "stock" && /* @__PURE__ */ r.jsxs(r.Fragment, { children: [
954
- /* @__PURE__ */ r.jsxs("div", { style: { marginBottom: 2 }, children: [
955
- et(w),
956
- " — ",
957
- et(T)
1039
+ T.hoveredSection === "stock" && /* @__PURE__ */ a.jsxs(a.Fragment, { children: [
1040
+ /* @__PURE__ */ a.jsxs("div", { style: { marginBottom: 2 }, children: [
1041
+ St(M),
1042
+ " —",
1043
+ " ",
1044
+ St(C)
958
1045
  ] }),
959
- /* @__PURE__ */ r.jsxs("div", { children: [
1046
+ /* @__PURE__ */ a.jsxs("div", { children: [
960
1047
  "Estoque disponível até ",
961
- et(T)
1048
+ St(C)
962
1049
  ] }),
963
- /* @__PURE__ */ r.jsx("div", { style: { marginTop: 2 }, children: (() => {
964
- const o = Math.max(
1050
+ /* @__PURE__ */ a.jsx("div", { style: { marginTop: 2 }, children: (() => {
1051
+ const e = Math.max(
965
1052
  0,
966
1053
  Math.round(
967
- (T.getTime() - w.getTime()) / M
1054
+ (C.getTime() - M.getTime()) / A
968
1055
  )
969
- ), t = a.timeline.stockWeightKg ?? a.timeline.restockSuggestionWeight;
970
- return `${o} dia(s) de estoque${t ? ` • ${t} kg` : ""}`;
1056
+ ), t = i.timeline.stockWeightKg ?? i.timeline.restockSuggestionWeight;
1057
+ return `${e} dia(s) de estoque${t ? ` • ${t} ${Ft}` : ""}`;
971
1058
  })() })
972
1059
  ] }),
973
- y.hoveredSection === "suggestion" && /* @__PURE__ */ r.jsxs(r.Fragment, { children: [
974
- /* @__PURE__ */ r.jsx("div", { style: { marginBottom: 2 }, children: (() => {
975
- const o = new Date(
1060
+ T.hoveredSection === "suggestion" && /* @__PURE__ */ a.jsxs(a.Fragment, { children: [
1061
+ /* @__PURE__ */ a.jsx("div", { style: { marginBottom: 2 }, children: (() => {
1062
+ const e = new Date(
976
1063
  Math.max(
977
- P.getTime(),
978
- T.getTime()
1064
+ I.getTime(),
1065
+ C.getTime()
979
1066
  )
980
1067
  );
981
- return `${et(o)} — ${et(z)}`;
1068
+ return `${St(e)} — ${St(U)}`;
982
1069
  })() }),
983
- /* @__PURE__ */ r.jsx("div", { children: "Período crítico para compra" }),
984
- /* @__PURE__ */ r.jsx("div", { style: { marginTop: 2 }, children: (() => {
985
- const o = new Date(
1070
+ /* @__PURE__ */ a.jsx("div", { children: "Período crítico para compra" }),
1071
+ /* @__PURE__ */ a.jsx("div", { style: { marginTop: 2 }, children: (() => {
1072
+ const e = new Date(
986
1073
  Math.max(
987
- P.getTime(),
988
- T.getTime()
1074
+ I.getTime(),
1075
+ C.getTime()
989
1076
  )
990
1077
  ), t = Math.max(
991
1078
  0,
992
1079
  Math.round(
993
- (z.getTime() - o.getTime()) / M
1080
+ (U.getTime() - e.getTime()) / A
994
1081
  )
995
- ), f = a.timeline.restockSuggestionWeight;
996
- return `${t} dia(s) de sugestão${f ? ` • ${f} kg` : ""}`;
1082
+ ), g = i.timeline.restockSuggestionWeight;
1083
+ return `${t} dia(s) de sugestão${g ? ` • ${g} ${Ft}` : ""}`;
997
1084
  })() })
998
1085
  ] }),
999
- y.hoveredSection === "selectedQty" && typeof j == "number" && typeof p == "number" && /* @__PURE__ */ r.jsxs("div", { children: [
1086
+ T.hoveredSection === "selectedQty" && typeof w == "number" && typeof m == "number" && /* @__PURE__ */ a.jsxs("div", { children: [
1000
1087
  "O estoque selecionado de ",
1001
- j,
1088
+ w,
1002
1089
  " deve durar",
1003
1090
  " ",
1004
- p % 1 === 0 ? p : p.toFixed(1),
1091
+ m % 1 === 0 ? m : m.toFixed(1),
1005
1092
  " ",
1006
1093
  "dia",
1007
- p === 1 ? "" : "s"
1094
+ m === 1 ? "" : "s"
1008
1095
  ] })
1009
1096
  ] })
1010
1097
  }
1011
1098
  ),
1012
1099
  document.body
1013
1100
  ),
1014
- B && /* @__PURE__ */ r.jsxs(
1101
+ E && /* @__PURE__ */ a.jsxs(
1015
1102
  "div",
1016
1103
  {
1017
1104
  style: {
@@ -1020,88 +1107,88 @@ function Te({
1020
1107
  flexWrap: "wrap",
1021
1108
  justifyContent: "flex-end",
1022
1109
  gap: "8px",
1023
- backgroundColor: u.legendBackground,
1110
+ backgroundColor: p.legendBackground,
1024
1111
  padding: "8px 10px",
1025
1112
  marginTop: "8px",
1026
1113
  borderRadius: "4px",
1027
1114
  fontSize: "10px",
1028
- color: u.textPrimary
1115
+ color: p.textPrimary
1029
1116
  },
1030
1117
  children: [
1031
- /* @__PURE__ */ r.jsxs("div", { style: { display: "flex", alignItems: "center", gap: "6px" }, children: [
1032
- /* @__PURE__ */ r.jsx(
1118
+ /* @__PURE__ */ a.jsxs("div", { style: { display: "flex", alignItems: "center", gap: "6px" }, children: [
1119
+ /* @__PURE__ */ a.jsx(
1033
1120
  "div",
1034
1121
  {
1035
1122
  style: {
1036
1123
  width: "10px",
1037
1124
  height: "10px",
1038
- backgroundColor: u.stockPast,
1125
+ backgroundColor: p.stockPast,
1039
1126
  borderRadius: "2px"
1040
1127
  }
1041
1128
  }
1042
1129
  ),
1043
- /* @__PURE__ */ r.jsx("span", { children: "Estoque Passado" })
1130
+ /* @__PURE__ */ a.jsx("span", { children: "Estoque Passado" })
1044
1131
  ] }),
1045
- /* @__PURE__ */ r.jsxs("div", { style: { display: "flex", alignItems: "center", gap: "6px" }, children: [
1046
- /* @__PURE__ */ r.jsx(
1132
+ /* @__PURE__ */ a.jsxs("div", { style: { display: "flex", alignItems: "center", gap: "6px" }, children: [
1133
+ /* @__PURE__ */ a.jsx(
1047
1134
  "div",
1048
1135
  {
1049
1136
  style: {
1050
1137
  width: "10px",
1051
1138
  height: "10px",
1052
- backgroundColor: u.stockFuture,
1139
+ backgroundColor: p.stockFuture,
1053
1140
  borderRadius: "2px"
1054
1141
  }
1055
1142
  }
1056
1143
  ),
1057
- /* @__PURE__ */ r.jsx("span", { children: "Previsão Estoque" })
1144
+ /* @__PURE__ */ a.jsx("span", { children: "Previsão Estoque" })
1058
1145
  ] }),
1059
- Y && /* @__PURE__ */ r.jsxs("div", { style: { display: "flex", alignItems: "center", gap: "6px" }, children: [
1060
- /* @__PURE__ */ r.jsx(
1146
+ Y && /* @__PURE__ */ a.jsxs("div", { style: { display: "flex", alignItems: "center", gap: "6px" }, children: [
1147
+ /* @__PURE__ */ a.jsx(
1061
1148
  "div",
1062
1149
  {
1063
1150
  style: {
1064
1151
  width: "10px",
1065
1152
  height: "10px",
1066
- backgroundColor: u.alert,
1153
+ backgroundColor: p.alert,
1067
1154
  borderRadius: "2px"
1068
1155
  }
1069
1156
  }
1070
1157
  ),
1071
- /* @__PURE__ */ r.jsx("span", { children: "Sugestão Compra" })
1158
+ /* @__PURE__ */ a.jsx("span", { children: "Sugestão Compra" })
1072
1159
  ] }),
1073
- /* @__PURE__ */ r.jsxs("div", { style: { display: "flex", alignItems: "center", gap: "6px" }, children: [
1074
- /* @__PURE__ */ r.jsx(
1160
+ /* @__PURE__ */ a.jsxs("div", { style: { display: "flex", alignItems: "center", gap: "6px" }, children: [
1161
+ /* @__PURE__ */ a.jsx(
1075
1162
  "div",
1076
1163
  {
1077
1164
  style: {
1078
1165
  width: "2px",
1079
1166
  height: "10px",
1080
- borderLeft: `2px dashed ${u.deliveryBar}`,
1167
+ borderLeft: `2px dashed ${p.deliveryBar}`,
1081
1168
  marginLeft: "4px",
1082
1169
  marginRight: "4px"
1083
1170
  }
1084
1171
  }
1085
1172
  ),
1086
- /* @__PURE__ */ r.jsx("span", { children: "Data Entrega" })
1173
+ /* @__PURE__ */ a.jsx("span", { children: "Data Entrega" })
1087
1174
  ] }),
1088
- typeof p == "number" && p > 0 && typeof j == "number" && /* @__PURE__ */ r.jsxs(
1175
+ typeof m == "number" && m > 0 && typeof w == "number" && /* @__PURE__ */ a.jsxs(
1089
1176
  "div",
1090
1177
  {
1091
1178
  style: { display: "flex", alignItems: "center", gap: "6px" },
1092
1179
  children: [
1093
- /* @__PURE__ */ r.jsx(
1180
+ /* @__PURE__ */ a.jsx(
1094
1181
  "div",
1095
1182
  {
1096
1183
  style: {
1097
1184
  width: "10px",
1098
1185
  height: "5px",
1099
- backgroundColor: u.selectedQtyBar,
1186
+ backgroundColor: p.selectedQtyBar,
1100
1187
  borderRadius: "2px"
1101
1188
  }
1102
1189
  }
1103
1190
  ),
1104
- /* @__PURE__ */ r.jsx("span", { children: "Qtd. Selecionada" })
1191
+ /* @__PURE__ */ a.jsx("span", { children: "Qtd. Selecionada" })
1105
1192
  ]
1106
1193
  }
1107
1194
  )
@@ -1113,6 +1200,6 @@ function Te({
1113
1200
  );
1114
1201
  }
1115
1202
  export {
1116
- Te as StockLeadTime
1203
+ Be as StockLeadTime
1117
1204
  };
1118
1205
  //# sourceMappingURL=index18.js.map